From ec4b788e493b3ea0acc787687a63b4ff4b987024 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 6 Dec 2023 14:21:21 +0100 Subject: [PATCH] feat: use SCSS variables internally (#344) BREAKING CHANGE: CSS variables are no longer defined globally, and the file `themes/jse-theme-default.css` is now removed (replaced by an internal `defaults.scss`). The provided dark theme still works as-is. The CSS variable `--jse-modal-theme-color` has been renamed to `--jse-modal-editor-theme-color`, and `--jse-modal-theme-color-highlight` has been renamed to `--jse-modal-editor-theme-color-highlight`. --- src/lib/components/JSONEditor.scss | 5 +- .../__snapshots__/JSONEditor.test.ts.snap | 20 +- .../components/controls/ColorPickerPopup.scss | 14 +- .../components/controls/DropdownButton.scss | 18 +- src/lib/components/controls/EditableDiv.scss | 6 +- .../controls/EditableDivShared.scss | 14 +- src/lib/components/controls/JSONPreview.scss | 12 +- src/lib/components/controls/Menu.scss | 26 +-- src/lib/components/controls/Message.scss | 24 +- .../controls/ValidationErrorsOverview.scss | 8 +- .../controls/contextmenu/ContextMenu.scss | 20 +- .../contextmenu/ContextMenuPointer.scss | 16 +- .../controls/navigationBar/NavigationBar.scss | 22 +- .../navigationBar/NavigationBarDropdown.scss | 16 +- .../navigationBar/NavigationBarItem.scss | 8 +- .../NavigationBarPathEditor.scss | 22 +- .../SelectQueryLanguage.scss | 8 +- .../components/controls/tooltip/Tooltip.scss | 10 +- src/lib/components/modals/CopyPasteModal.scss | 2 +- src/lib/components/modals/Header.scss | 4 +- .../components/modals/JSONEditorModal.scss | 8 +- src/lib/components/modals/Modal.scss | 23 +- src/lib/components/modals/SortModal.scss | 8 +- src/lib/components/modals/TransformModal.scss | 20 +- .../components/modals/TransformWizard.scss | 8 +- .../modals/repair/JSONRepairComponent.scss | 17 +- .../components/modes/tablemode/TableMode.scss | 40 ++-- .../modes/tablemode/TableModeWelcome.scss | 12 +- .../modes/tablemode/tag/InlineValue.scss | 10 +- .../components/modes/textmode/StatusBar.scss | 18 +- .../components/modes/textmode/TextMode.scss | 111 ++++----- .../textmode/codemirror/codemirror-theme.ts | 10 +- .../modes/treemode/CollapsedItems.scss | 13 +- .../modes/treemode/CollapsedItems.svelte | 7 +- .../components/modes/treemode/JSONKey.scss | 12 +- .../components/modes/treemode/JSONNode.scss | 69 +++--- .../components/modes/treemode/JSONNode.svelte | 22 +- .../components/modes/treemode/TreeMode.scss | 26 +-- .../modes/treemode/ValidationErrorIcon.scss | 2 +- .../components/modes/treemode/Welcome.scss | 12 +- .../highlight/SearchResultHighlighter.scss | 8 +- .../modes/treemode/menu/SearchBox.scss | 28 +-- .../value/components/BooleanToggle.scss | 2 +- .../plugins/value/components/ColorPicker.scss | 8 +- .../plugins/value/components/EnumValue.scss | 6 +- .../value/components/ReadonlyValue.scss | 8 +- .../value/components/TimestampTag.scss | 2 +- src/lib/styles.scss | 57 ++--- src/lib/themes/defaults.scss | 211 ++++++++++++++++++ src/lib/themes/jse-theme-dark.css | 5 +- src/lib/themes/jse-theme-default.css | 161 ------------- src/routes/development/+page.svelte | 2 +- src/routes/themes/jse-theme-big.css | 2 +- 53 files changed, 640 insertions(+), 583 deletions(-) create mode 100644 src/lib/themes/defaults.scss delete mode 100644 src/lib/themes/jse-theme-default.css diff --git a/src/lib/components/JSONEditor.scss b/src/lib/components/JSONEditor.scss index b5be93ef..8fe5e3fe 100644 --- a/src/lib/components/JSONEditor.scss +++ b/src/lib/components/JSONEditor.scss @@ -1,4 +1,3 @@ -@import '../themes/jse-theme-default'; // do not put the .css extension here, else the file will not be bundled @import '../styles'; .jse-main { @@ -6,8 +5,8 @@ height: 100%; min-width: 0; min-height: $contents-min-height; - font-family: var(--jse-font-family); - font-size: var(--jse-font-size); + font-family: $font-family; + font-size: $font-size; line-height: normal; position: relative; display: flex; diff --git a/src/lib/components/__snapshots__/JSONEditor.test.ts.snap b/src/lib/components/__snapshots__/JSONEditor.test.ts.snap index da7ee1f2..78d05f50 100644 --- a/src/lib/components/__snapshots__/JSONEditor.test.ts.snap +++ b/src/lib/components/__snapshots__/JSONEditor.test.ts.snap @@ -1482,11 +1482,11 @@ exports[`JSONEditor > render tree mode 1`] = ` class="jse-json-node jse-expanded s-BfIc3EpAoT-Y jse-root" data-path="" role="treeitem" + style="--level: 0;" tabindex="-1" >
render tree mode 1`] = ` class="jse-json-node jse-expanded s-BfIc3EpAoT-Y" data-path="%2F0" role="treeitem" + style="--level: 1;" tabindex="-1" >
render tree mode 1`] = ` class="jse-json-node s-BfIc3EpAoT-Y" data-path="%2F0%2Fid" role="treeitem" + style="--level: 2;" tabindex="-1" >
render tree mode 1`] = `