@knime/kds-components 6.7.1 → 6.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/index.css +5 -5
- package/dist/index.js +68 -26
- package/dist/index.js.map +1 -1
- package/dist/src/util/useKdsDarkMode.d.ts +3 -2
- package/dist/src/util/useKdsDarkMode.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @knime/kds-components
|
|
2
2
|
|
|
3
|
+
## 6.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2d8e635: - `useKdsDarkMode`:
|
|
8
|
+
- fix the theme flashing continuously once several instances or browser tabs are open: the effective light/dark value is derived from the preference instead of being persisted next to it, so re-deriving no longer writes to storage and can no longer feed back into the other instances.
|
|
9
|
+
- stop persisting `KNIME_DARK_MODE_EFFECTIVE`, and clear a value left behind by earlier versions. `KNIME_DARK_MODE` remains the single stored preference.
|
|
10
|
+
- return one shared instance instead of independent state per call.
|
|
11
|
+
- writing `isDark` now stores an explicit `'light'`/`'dark'` preference, rather than being reverted the next time the mode was derived.
|
|
12
|
+
- @knime/kds-styles@6.8.1
|
|
13
|
+
|
|
14
|
+
## 6.8.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- de14193: `KdsSubText`: fix the sub-text line being a fraction of a pixel too short for the leading error / warning icons and the validating spinner, which grew the container by that amount whenever one of them appeared — most visibly with `preserveSubTextSpace` enabled, where the reserved line is meant to keep the height constant.
|
|
19
|
+
|
|
20
|
+
The minimum height is now `--kds-dimension-component-height-0-75x` (12px) rather than one line of the sub-text font. It is a fixed height because the line has to fit a leading icon whenever one is shown, and the icons it can show — `KdsIcon size="small"` for the error / warning states and `KdsLoadingSpinner size="small"` while validating — are exactly 12px tall, slightly more than one line of text.
|
|
21
|
+
|
|
22
|
+
As a result **every** sub-text row grows by that fraction of a pixel, in every form field, whether or not `preserveSubTextSpace` is set. Layouts measured to the pixel around a form field may shift accordingly.
|
|
23
|
+
- @knime/kds-styles@6.8.0
|
|
24
|
+
|
|
3
25
|
## 6.7.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -891,21 +891,21 @@ body:has(dialog.modal[open]) {
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
.subtext {
|
|
894
|
-
&[data-v-
|
|
894
|
+
&[data-v-1bd6d710] {
|
|
895
895
|
display: flex;
|
|
896
896
|
gap: var(--kds-spacing-container-0-25x);
|
|
897
|
-
min-height:
|
|
897
|
+
min-height: var(--kds-dimension-component-height-0-75x);
|
|
898
898
|
margin-top: var(--kds-spacing-container-0-25x);
|
|
899
899
|
font: var(--kds-font-base-subtext-small);
|
|
900
900
|
color: var(--kds-color-text-and-icon-muted);
|
|
901
901
|
}
|
|
902
|
-
&.error[data-v-
|
|
902
|
+
&.error[data-v-1bd6d710] {
|
|
903
903
|
color: var(--kds-color-text-and-icon-danger);
|
|
904
904
|
}
|
|
905
|
-
&.warning[data-v-
|
|
905
|
+
&.warning[data-v-1bd6d710] {
|
|
906
906
|
color: var(--kds-color-text-and-icon-warning);
|
|
907
907
|
}
|
|
908
|
-
& .subtext-text[data-v-
|
|
908
|
+
& .subtext-text[data-v-1bd6d710] {
|
|
909
909
|
min-width: 0;
|
|
910
910
|
}
|
|
911
911
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as _plugin_vue_export_helper_default, o as kdsPopoverRoles, r as kdsPopoverPlacement, s as kdsPopoverType, t as KdsPopover_default, u as __exportAll$1 } from "./KdsPopover-DBU9xVEK.js";
|
|
2
2
|
import { a as useKdsIsTruncated, i as elementOverflowsHorizontally, n as useIcon, r as vKdsTooltip, t as KdsIcon_default } from "./KdsIcon-B-82z79O.js";
|
|
3
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
|
-
import { onClickOutside,
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineAsyncComponent, defineComponent, effectScope, getCurrentInstance, guardReactiveProps, h, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
|
+
import { onClickOutside, useElementSize, useLocalStorage, useMousePressed, usePreferredDark, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
|
|
5
5
|
import './index.css';//#region src/components/accessories/Avatar/enums.ts
|
|
6
6
|
var kdsAvatarSize = {
|
|
7
7
|
SMALL: "small",
|
|
@@ -10238,7 +10238,7 @@ var KdsSubText_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
10238
10238
|
})) : createCommentVNode("", true), createElementVNode("span", _hoisted_2$47, toDisplayString(props.subText), 1)], 10, _hoisted_1$72)) : createCommentVNode("", true);
|
|
10239
10239
|
};
|
|
10240
10240
|
}
|
|
10241
|
-
}), [["__scopeId", "data-v-
|
|
10241
|
+
}), [["__scopeId", "data-v-1bd6d710"]]);
|
|
10242
10242
|
//#endregion
|
|
10243
10243
|
//#region src/components/forms/Checkbox/BaseCheckbox.vue?vue&type=script&setup=true&lang.ts
|
|
10244
10244
|
var _hoisted_1$71 = [
|
|
@@ -35527,26 +35527,63 @@ var kdsDarkModeTypes = Object.values(kdsDarkModeType);
|
|
|
35527
35527
|
//#endregion
|
|
35528
35528
|
//#region src/util/useKdsDarkMode.ts
|
|
35529
35529
|
var KDS_DARK_MODE_STORAGE_KEY = "KNIME_DARK_MODE";
|
|
35530
|
+
/**
|
|
35531
|
+
* Key an earlier implementation used to persist the *derived* light/dark state
|
|
35532
|
+
* alongside the preference. Nothing reads or writes it any more — see
|
|
35533
|
+
* {@link createKdsDarkMode} — so it is cleared once to stop a stale value from
|
|
35534
|
+
* lingering in browsers that ran that version.
|
|
35535
|
+
*/
|
|
35536
|
+
var OBSOLETE_EFFECTIVE_STORAGE_KEY = `${KDS_DARK_MODE_STORAGE_KEY}_EFFECTIVE`;
|
|
35530
35537
|
var defaultMode = kdsDarkModeType.SYSTEM;
|
|
35531
|
-
|
|
35538
|
+
/**
|
|
35539
|
+
* `color-scheme` drives the `light-dark()` color tokens, `data-theme` exposes
|
|
35540
|
+
* the mode itself. A `'system'` preference stays undecided in `color-scheme`,
|
|
35541
|
+
* so the browser resolves it against the OS — which is also why this depends
|
|
35542
|
+
* on the preference alone and not on the resolved light/dark value.
|
|
35543
|
+
*/
|
|
35544
|
+
var applyToDocument = (preference) => {
|
|
35545
|
+
const documentElement = globalThis.document?.documentElement;
|
|
35546
|
+
if (!documentElement) return;
|
|
35547
|
+
documentElement.style.setProperty("color-scheme", preference === kdsDarkModeType.SYSTEM ? "light dark" : preference);
|
|
35548
|
+
documentElement.dataset.theme = preference;
|
|
35549
|
+
};
|
|
35550
|
+
/**
|
|
35551
|
+
* Guarded on both counts: `localStorage` is absent when rendering on a server,
|
|
35552
|
+
* and merely touching it throws in a sandboxed iframe without same-origin
|
|
35553
|
+
* access. Neither is a reason to take the composable down — there is simply
|
|
35554
|
+
* nothing to clear.
|
|
35555
|
+
*/
|
|
35556
|
+
var clearObsoleteEffectiveMode = () => {
|
|
35557
|
+
try {
|
|
35558
|
+
globalThis.localStorage?.removeItem(OBSOLETE_EFFECTIVE_STORAGE_KEY);
|
|
35559
|
+
} catch {}
|
|
35560
|
+
};
|
|
35561
|
+
/**
|
|
35562
|
+
* The user preference is the *only* persisted state; the effective light/dark
|
|
35563
|
+
* value is derived from it and the OS preference on read.
|
|
35564
|
+
*
|
|
35565
|
+
* Persisting the derived value as well (as an earlier implementation did) gave
|
|
35566
|
+
* the same fact two storage keys that could disagree. Every instance wrote the
|
|
35567
|
+
* derived key whenever it re-derived, `useStorage` mirrors those writes into
|
|
35568
|
+
* every other instance and browser tab, and the write-back re-triggered the
|
|
35569
|
+
* derivation there — so a disagreement, however brief, sustained itself as a
|
|
35570
|
+
* write loop between tabs. Each write re-stamped the document attributes,
|
|
35571
|
+
* which is what made the UI flash. Deriving instead of storing removes the
|
|
35572
|
+
* feedback edge entirely: nothing writes unless the user changes the
|
|
35573
|
+
* preference.
|
|
35574
|
+
*/
|
|
35575
|
+
var createKdsDarkMode = () => {
|
|
35532
35576
|
const userPreference = useLocalStorage(KDS_DARK_MODE_STORAGE_KEY, defaultMode);
|
|
35533
|
-
const
|
|
35534
|
-
|
|
35535
|
-
|
|
35536
|
-
|
|
35537
|
-
|
|
35538
|
-
|
|
35539
|
-
|
|
35540
|
-
themeValue = kdsDarkModeType.SYSTEM;
|
|
35541
|
-
} else cssMode = themeValue = isDarkValue ? kdsDarkModeType.DARK : kdsDarkModeType.LIGHT;
|
|
35542
|
-
document.documentElement.style.setProperty("color-scheme", cssMode);
|
|
35543
|
-
document.documentElement.dataset.theme = themeValue;
|
|
35577
|
+
const systemPrefersDark = usePreferredDark();
|
|
35578
|
+
const isDark = computed({
|
|
35579
|
+
get() {
|
|
35580
|
+
return userPreference.value === kdsDarkModeType.SYSTEM ? systemPrefersDark.value : userPreference.value === kdsDarkModeType.DARK;
|
|
35581
|
+
},
|
|
35582
|
+
set(value) {
|
|
35583
|
+
userPreference.value = value ? kdsDarkModeType.DARK : kdsDarkModeType.LIGHT;
|
|
35544
35584
|
}
|
|
35545
35585
|
});
|
|
35546
|
-
watch(
|
|
35547
|
-
if (preference === kdsDarkModeType.SYSTEM) isDark.value = systemDark;
|
|
35548
|
-
else isDark.value = preference === kdsDarkModeType.DARK;
|
|
35549
|
-
}, { immediate: true });
|
|
35586
|
+
watch(userPreference, applyToDocument, { immediate: true });
|
|
35550
35587
|
return {
|
|
35551
35588
|
/**
|
|
35552
35589
|
* The current user *preference* (`'light' | 'dark' | 'system'`) as a
|
|
@@ -35562,20 +35599,17 @@ var useKdsDarkMode = () => {
|
|
|
35562
35599
|
}
|
|
35563
35600
|
}),
|
|
35564
35601
|
/** Whether the user *preference* is dark. Note: `false` when the preference is 'system' — for the actually-rendered state use `isDark`. */
|
|
35565
|
-
isDarkPreferred: computed(() =>
|
|
35566
|
-
return userPreference.value === kdsDarkModeType.DARK;
|
|
35567
|
-
}),
|
|
35602
|
+
isDarkPreferred: computed(() => userPreference.value === kdsDarkModeType.DARK),
|
|
35568
35603
|
/** Whether the user *preference* is light. Note: `false` when the preference is 'system' — for the actually-rendered state use `isLight`. */
|
|
35569
|
-
isLightPreferred: computed(() =>
|
|
35570
|
-
return userPreference.value === kdsDarkModeType.LIGHT;
|
|
35571
|
-
}),
|
|
35604
|
+
isLightPreferred: computed(() => userPreference.value === kdsDarkModeType.LIGHT),
|
|
35572
35605
|
/** Whether the user *preference* is set to 'system'. */
|
|
35573
35606
|
isSystemPreferred: computed(() => userPreference.value === kdsDarkModeType.SYSTEM),
|
|
35574
35607
|
/**
|
|
35575
35608
|
* Whether dark styling is effectively active right now. Unlike
|
|
35576
35609
|
* `isDarkPreferred` this resolves 'system' against the OS preference, so it
|
|
35577
35610
|
* reflects what is actually rendered. Use it for JS/canvas theming (e.g.
|
|
35578
|
-
* charts) that cannot rely on CSS `light-dark()`.
|
|
35611
|
+
* charts) that cannot rely on CSS `light-dark()`. Writable: setting it
|
|
35612
|
+
* stores an explicit `'light'`/`'dark'` preference.
|
|
35579
35613
|
*/
|
|
35580
35614
|
isDark,
|
|
35581
35615
|
/**
|
|
@@ -35586,6 +35620,14 @@ var useKdsDarkMode = () => {
|
|
|
35586
35620
|
isLight: computed(() => !isDark.value)
|
|
35587
35621
|
};
|
|
35588
35622
|
};
|
|
35623
|
+
var shared;
|
|
35624
|
+
var useKdsDarkMode = () => {
|
|
35625
|
+
if (!shared) {
|
|
35626
|
+
clearObsoleteEffectiveMode();
|
|
35627
|
+
shared = effectScope(true).run(createKdsDarkMode);
|
|
35628
|
+
}
|
|
35629
|
+
return shared;
|
|
35630
|
+
};
|
|
35589
35631
|
//#endregion
|
|
35590
35632
|
export { KdsAccordion_default as KdsAccordion, KdsAvatar_default as KdsAvatar, KdsAvatarCounter_default as KdsAvatarCounter, KdsBadge_default as KdsBadge, KdsBanner_default as KdsBanner, KdsBreadcrumb_default as KdsBreadcrumb, KdsButton_default as KdsButton, KdsCard_default as KdsCard, KdsCheckbox_default as KdsCheckbox, KdsCheckboxGroup_default as KdsCheckboxGroup, KdsClickableCard_default as KdsClickableCard, KdsColorInput_default as KdsColorInput, KdsColorSwatch_default as KdsColorSwatch, KdsContextMenu_default as KdsContextMenu, KdsDataType_default as KdsDataType, KdsDateInput_default as KdsDateInput, KdsDateTimeFormatInput_default as KdsDateTimeFormatInput, KdsDateTimeInput_default as KdsDateTimeInput, KdsDescription_default as KdsDescription, KdsDivider_default as KdsDivider, KdsDonutChart_default as KdsDonutChart, KdsDropdown_default as KdsDropdown, KdsDynamicModalProvider_default as KdsDynamicModalProvider, KdsEmptyState_default as KdsEmptyState, KdsFileExplorer_default as KdsFileExplorer, KdsFileSelector_default as KdsFileSelector, KdsIcon_default as KdsIcon, KdsInfoToggleButton_default as KdsInfoToggleButton, KdsInlineMessage_default as KdsInlineMessage, KdsIntervalInput_default as KdsIntervalInput, KdsKeyboardShortcut_default as KdsKeyboardShortcut, KdsLabel_default as KdsLabel, KdsLimitBar_default as KdsLimitBar, KdsLink_default as KdsLink, KdsLinkButton_default as KdsLinkButton, KdsLinkCard_default as KdsLinkCard, KdsListContainer_default as KdsListContainer, KdsLiveStatus_default as KdsLiveStatus, KdsLoadingSkeleton_default as KdsLoadingSkeleton, KdsLoadingSpinner_default as KdsLoadingSpinner, KdsMenu_default as KdsMenu, KdsMenuButton_default as KdsMenuButton, KdsMissingValueIcon_default as KdsMissingValueIcon, KdsModal_default as KdsModal, KdsModalLayout_default as KdsModalLayout, KdsMultiSelectButton_default as KdsMultiSelectButton, KdsMultiSelectDropdown_default as KdsMultiSelectDropdown, KdsNavItem_default as KdsNavItem, KdsNavigation_default as KdsNavigation, KdsNumberInput_default as KdsNumberInput, KdsPanel_default as KdsPanel, KdsPasswordInput_default as KdsPasswordInput, KdsPatternInput_default as KdsPatternInput, KdsPopover_default as KdsPopover, KdsPortIcon_default as KdsPortIcon, KdsPreviewList_default as KdsPreviewList, KdsProgressBar_default as KdsProgressBar, KdsProgressButton_default as KdsProgressButton, KdsRadioButton_default as KdsRadioButton, KdsRadioButtonGroup_default as KdsRadioButtonGroup, KdsResponsiveButtonGroup_default as KdsResponsiveButtonGroup, KdsSearchInput_default as KdsSearchInput, KdsSelectButton_default as KdsSelectButton, KdsSelectableCard_default as KdsSelectableCard, KdsSideDrawer_default as KdsSideDrawer, KdsSortableListBox_default as KdsSortableListBox, KdsSplitButton_default as KdsSplitButton, KdsSplitPanel_default as KdsSplitPanel, KdsSubText_default as KdsSubText, KdsTabBar_default as KdsTabBar, KdsTabPanel_default as KdsTabPanel, KdsTextHighlight_default as KdsTextHighlight, KdsTextInput_default as KdsTextInput, KdsTextarea_default as KdsTextarea, KdsTimeInput_default as KdsTimeInput, KdsToggleButton_default as KdsToggleButton, KdsToggleSwitch_default as KdsToggleSwitch, KdsTree_default as KdsTree, KdsTwinList_default as KdsTwinList, KdsUsernameInput_default as KdsUsernameInput, KdsValueSwitch_default as KdsValueSwitch, KdsVariableToggleButton_default as KdsVariableToggleButton, KdsZonedDateTimeInput_default as KdsZonedDateTimeInput, PORT_SIZE, kdsAccessorySize, kdsAccessorySizes, kdsAccessoryType, kdsAccessoryTypes, kdsActionButtonType, kdsActionButtonTypes, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsFeedbackVariant as kdsBannerVariant, kdsFeedbackVariant as kdsInlineMessageVariant, kdsFeedbackVariants as kdsBannerVariants, kdsFeedbackVariants as kdsInlineMessageVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardBodyVariant, kdsCardBodyVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsKeyboardShortcutSize, kdsKeyboardShortcutSizes, kdsLimitBarThresholdVariant, kdsLimitBarThresholdVariants, kdsLinkSize, kdsLinkSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsPortType, kdsPortTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsSplitPanelDirection, kdsSplitPanelDirections, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsToggleSwitchLabelPosition, kdsToggleSwitchLabelPositions, kdsToggleSwitchSize, kdsToggleSwitchSizes, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, vKdsTooltip };
|
|
35591
35633
|
|