@knime/kds-components 10.2.0 → 11.0.0
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 +25 -0
- package/dist/index.css +17 -17
- package/dist/index.js +101 -67
- package/dist/index.js.map +1 -1
- package/dist/src/util/index.d.ts +1 -1
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/useKdsDarkMode.d.ts +80 -9
- package/dist/src/util/useKdsDarkMode.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @knime/kds-components
|
|
2
2
|
|
|
3
|
+
## 11.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- df12b1a: - `useKdsDarkMode`: export the `KdsDarkMode` type for what it returns.
|
|
8
|
+
- `useKdsDarkModeController`:
|
|
9
|
+
- add a composable that applies the stored preference to the page and returns `preferredMode`, `isDarkPreferred`, `isLightPreferred`, `isSystemPreferred`, a writable `isDark`, `isLight`, and `lightDark`.
|
|
10
|
+
- export the `KdsDarkModeController` type for what it returns.
|
|
11
|
+
|
|
12
|
+
BREAKING CHANGES:
|
|
13
|
+
|
|
14
|
+
- `useKdsDarkMode`:
|
|
15
|
+
- make it read-only. It returns `isDark`, `isLight`, and `lightDark`, read from the `color-scheme` of `<html>`, and changes neither the page nor the stored preference.
|
|
16
|
+
- stop returning `preferredMode`, `isDarkPreferred`, `isLightPreferred`, and `isSystemPreferred`. To apply, set, or read the stored preference, call `useKdsDarkModeController()` instead.
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 880698d: `KdsFileExplorer`: Remove z-index isolation for custom drag preview, which interferes with a
|
|
21
|
+
consumer's own z-index stack. Also allow customizing z-index value
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @knime/kds-styles@11.0.0
|
|
27
|
+
|
|
3
28
|
## 10.2.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/dist/index.css
CHANGED
|
@@ -4459,7 +4459,7 @@ td {
|
|
|
4459
4459
|
cursor: pointer;
|
|
4460
4460
|
}
|
|
4461
4461
|
|
|
4462
|
-
.file-explorer[data-v-
|
|
4462
|
+
.file-explorer[data-v-d13e0460] {
|
|
4463
4463
|
display: flex;
|
|
4464
4464
|
flex: 1 0 0%;
|
|
4465
4465
|
flex-direction: column;
|
|
@@ -4468,10 +4468,10 @@ td {
|
|
|
4468
4468
|
/* needed so that the virtualization container can size the wrapper properly */
|
|
4469
4469
|
min-height: 0;
|
|
4470
4470
|
}
|
|
4471
|
-
.file-explorer-item[data-v-
|
|
4472
|
-
height: var(--
|
|
4471
|
+
.file-explorer-item[data-v-d13e0460] {
|
|
4472
|
+
height: var(--v2bc72e90);
|
|
4473
4473
|
}
|
|
4474
|
-
thead[data-v-
|
|
4474
|
+
thead[data-v-d13e0460] {
|
|
4475
4475
|
/* Hide table head for better readability but keeping it for a11y reasons */
|
|
4476
4476
|
position: absolute;
|
|
4477
4477
|
|
|
@@ -4482,7 +4482,7 @@ thead[data-v-8ba92819] {
|
|
|
4482
4482
|
overflow: hidden;
|
|
4483
4483
|
white-space: nowrap; /* added line */
|
|
4484
4484
|
}
|
|
4485
|
-
table[data-v-
|
|
4485
|
+
table[data-v-d13e0460] {
|
|
4486
4486
|
height: 100%;
|
|
4487
4487
|
overflow: hidden auto;
|
|
4488
4488
|
scrollbar-gutter: stable;
|
|
@@ -4493,19 +4493,19 @@ table[data-v-8ba92819] {
|
|
|
4493
4493
|
}
|
|
4494
4494
|
table,
|
|
4495
4495
|
tbody {
|
|
4496
|
-
&[data-v-
|
|
4496
|
+
&[data-v-d13e0460] {
|
|
4497
4497
|
width: 100%;
|
|
4498
4498
|
border-spacing: 0;
|
|
4499
4499
|
}
|
|
4500
|
-
&[data-v-
|
|
4500
|
+
&[data-v-d13e0460]:not(:has(.empty)) {
|
|
4501
4501
|
display: block;
|
|
4502
4502
|
}
|
|
4503
4503
|
}
|
|
4504
4504
|
table:focus {
|
|
4505
|
-
&[data-v-
|
|
4505
|
+
&[data-v-d13e0460] {
|
|
4506
4506
|
outline: none;
|
|
4507
4507
|
}
|
|
4508
|
-
&.keyboard-focus[data-v-
|
|
4508
|
+
&.keyboard-focus[data-v-d13e0460] {
|
|
4509
4509
|
outline: 2px solid var(--kds-color-focus-outline);
|
|
4510
4510
|
border-radius: var(--kds-border-radius-container-0-25x);
|
|
4511
4511
|
}
|
|
@@ -4513,13 +4513,13 @@ table:focus {
|
|
|
4513
4513
|
|
|
4514
4514
|
/*
|
|
4515
4515
|
* Empty state layout. When the folder is empty there are no virtualized rows,
|
|
4516
|
-
* so we drop the CSS-table display and lay the message out with flexbox.
|
|
4516
|
+
* so we drop the CSS-table display and lay the message out with flexbox.
|
|
4517
4517
|
* This keeps the message at the top with a fixed top spacing, horizontally centered,
|
|
4518
4518
|
* and lets the bordered box grow to contain it. The previous solution with a `height: 100%`
|
|
4519
|
-
* CSS table instead distributed the single short row inconsistently
|
|
4519
|
+
* CSS table instead distributed the single short row inconsistently
|
|
4520
4520
|
* (Chrome centers it, Firefox keeps it at the top).
|
|
4521
4521
|
*/
|
|
4522
|
-
table[data-v-
|
|
4522
|
+
table[data-v-d13e0460]:has(.empty) {
|
|
4523
4523
|
display: flex;
|
|
4524
4524
|
flex-direction: column;
|
|
4525
4525
|
|
|
@@ -4527,7 +4527,7 @@ table[data-v-8ba92819]:has(.empty) {
|
|
|
4527
4527
|
* message when the surrounding container is only as tall as its content. */
|
|
4528
4528
|
min-height: var(--kds-dimension-component-height-12-5x);
|
|
4529
4529
|
}
|
|
4530
|
-
tbody[data-v-
|
|
4530
|
+
tbody[data-v-d13e0460]:has(.empty) {
|
|
4531
4531
|
display: flex;
|
|
4532
4532
|
flex: 1 0 0;
|
|
4533
4533
|
flex-direction: column;
|
|
@@ -4535,15 +4535,15 @@ tbody[data-v-8ba92819]:has(.empty) {
|
|
|
4535
4535
|
min-height: max-content;
|
|
4536
4536
|
padding-top: var(--kds-spacing-container-4x);
|
|
4537
4537
|
}
|
|
4538
|
-
.empty[data-v-
|
|
4539
|
-
.empty td[data-v-
|
|
4538
|
+
.empty[data-v-d13e0460],
|
|
4539
|
+
.empty td[data-v-d13e0460] {
|
|
4540
4540
|
display: block;
|
|
4541
4541
|
}
|
|
4542
|
-
.custom-preview[data-v-
|
|
4542
|
+
.custom-preview[data-v-d13e0460] {
|
|
4543
4543
|
position: fixed;
|
|
4544
4544
|
top: 0;
|
|
4545
4545
|
left: 0;
|
|
4546
|
-
z-index: 9;
|
|
4546
|
+
z-index: var(--kds-file-explorer-custom-drag-preview-z-index, 9);
|
|
4547
4547
|
width: 70px;
|
|
4548
4548
|
height: 70px;
|
|
4549
4549
|
pointer-events: none;
|
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-XR1PupNA.js";
|
|
3
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, onScopeDispose, 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, useEventListener, useLocalStorage, useMousePressed, usePreferredDark, useRafFn, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
|
|
4
|
+
import { onClickOutside, useElementSize, useEventListener, useLocalStorage, useMousePressed, useMutationObserver, usePreferredDark, useRafFn, 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",
|
|
@@ -33762,7 +33762,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33762
33762
|
"renameFile"
|
|
33763
33763
|
], ["update:activeRenamedItemId"]),
|
|
33764
33764
|
setup(__props, { emit: __emit }) {
|
|
33765
|
-
useCssVars((_ctx) => ({ "
|
|
33765
|
+
useCssVars((_ctx) => ({ "v2bc72e90": itemHeight.value + "px" }));
|
|
33766
33766
|
const props = __props;
|
|
33767
33767
|
/** The id of the item currently being renamed. */
|
|
33768
33768
|
const activeRenamedItemId = useModel(__props, "activeRenamedItemId");
|
|
@@ -33986,15 +33986,15 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33986
33986
|
const slots = useSlots();
|
|
33987
33987
|
const dynamicColumnSlotNames = computed(() => Object.keys(slots).filter((key) => key.startsWith("dynamicColumn")));
|
|
33988
33988
|
return (_ctx, _cache) => {
|
|
33989
|
-
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
|
|
33993
|
-
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
createElementVNode("tbody", null, [!__props.isRootFolder ? (openBlock(), createBlock(FileExplorerItemBack_default, {
|
|
33989
|
+
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
33990
|
+
createElementVNode("table", mergeProps({
|
|
33991
|
+
tabindex: "0",
|
|
33992
|
+
class: ["scroll-container", { "keyboard-focus": unref(keyPressedUntilMouseClick) }],
|
|
33993
|
+
"aria-label": "list of files in the current folder"
|
|
33994
|
+
}, unref(containerProps), {
|
|
33995
|
+
onFocus: handleFocusOnTable,
|
|
33996
|
+
onKeydown: _cache[11] || (_cache[11] = (...args) => unref(handleKeyboardNavigation) && unref(handleKeyboardNavigation)(...args))
|
|
33997
|
+
}), [createElementVNode("tbody", null, [!__props.isRootFolder ? (openBlock(), createBlock(FileExplorerItemBack_default, {
|
|
33998
33998
|
key: 0,
|
|
33999
33999
|
ref_key: "itemBack",
|
|
34000
34000
|
ref: itemBack,
|
|
@@ -34011,8 +34011,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
34011
34011
|
"class",
|
|
34012
34012
|
"is-dragging",
|
|
34013
34013
|
"onDragover"
|
|
34014
|
-
])) : createCommentVNode("", true)]),
|
|
34015
|
-
createElementVNode("tbody", normalizeProps(guardReactiveProps(unref(wrapperProps))), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), ({ data: item, index }) => {
|
|
34014
|
+
])) : createCommentVNode("", true)]), createElementVNode("tbody", normalizeProps(guardReactiveProps(unref(wrapperProps))), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), ({ data: item, index }) => {
|
|
34016
34015
|
return openBlock(), createBlock(FileExplorerItem_default, {
|
|
34017
34016
|
key: item.id,
|
|
34018
34017
|
ref_for: true,
|
|
@@ -34092,7 +34091,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
34092
34091
|
"onDrop",
|
|
34093
34092
|
"onDblclick"
|
|
34094
34093
|
]);
|
|
34095
|
-
}), 128)), __props.items.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_2$11, [createElementVNode("td", null, [createVNode(KdsEmptyState_default, mergeProps({ headline: __props.emptyState?.headline ?? "Folder is empty" }, __props.emptyState), null, 16, ["headline"])])])) : createCommentVNode("", true)], 16),
|
|
34094
|
+
}), 128)), __props.items.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_2$11, [createElementVNode("td", null, [createVNode(KdsEmptyState_default, mergeProps({ headline: __props.emptyState?.headline ?? "Folder is empty" }, __props.emptyState), null, 16, ["headline"])])])) : createCommentVNode("", true)], 16)], 16),
|
|
34096
34095
|
__props.draggingAnimationMode !== "disabled" ? (openBlock(), createElementBlock("div", {
|
|
34097
34096
|
key: 0,
|
|
34098
34097
|
ref_key: "customPreviewContainer",
|
|
@@ -34101,32 +34100,33 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
34101
34100
|
}, [renderSlot(_ctx.$slots, "customDragPreview", {}, () => [createElementVNode("div", {
|
|
34102
34101
|
ref_key: "customDragPreviewPlaceholder",
|
|
34103
34102
|
ref: customDragPreviewPlaceholder
|
|
34104
|
-
}, null, 512)], true)], 512)) : createCommentVNode("", true)
|
|
34105
|
-
|
|
34106
|
-
|
|
34107
|
-
|
|
34108
|
-
|
|
34109
|
-
|
|
34110
|
-
|
|
34111
|
-
|
|
34112
|
-
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
|
|
34116
|
-
|
|
34117
|
-
|
|
34118
|
-
|
|
34119
|
-
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
|
|
34126
|
-
|
|
34103
|
+
}, null, 512)], true)], 512)) : createCommentVNode("", true),
|
|
34104
|
+
createVNode(KdsPopover_default, {
|
|
34105
|
+
ref_key: "popover",
|
|
34106
|
+
ref: popover,
|
|
34107
|
+
"popover-type": "manual",
|
|
34108
|
+
"model-value": Boolean(contextMenuAnchor.value && contextMenuItems.value.length > 0),
|
|
34109
|
+
placement: "bottom-left",
|
|
34110
|
+
"aria-label": "Menu",
|
|
34111
|
+
onKeydown: _cache[14] || (_cache[14] = withKeys(withModifiers(($event) => closeContextMenu(), ["stop", "prevent"]), ["esc"])),
|
|
34112
|
+
onFocusout: _cache[15] || (_cache[15] = ($event) => closeContextMenu())
|
|
34113
|
+
}, {
|
|
34114
|
+
default: withCtx(() => [createVNode(unref(KdsMenuContainer_default), {
|
|
34115
|
+
id: "file-explorer-options-menu",
|
|
34116
|
+
ref_key: "contextMenu",
|
|
34117
|
+
ref: contextMenu,
|
|
34118
|
+
ariaLabel: "File explorer context",
|
|
34119
|
+
items: contextMenuItems.value,
|
|
34120
|
+
"menu-max-height": __props.maxContextMenuHeight,
|
|
34121
|
+
onItemClick: _cache[12] || (_cache[12] = ($event) => closeContextMenu()),
|
|
34122
|
+
onContextmenu: _cache[13] || (_cache[13] = withModifiers(() => {}, ["prevent", "stop"]))
|
|
34123
|
+
}, null, 8, ["items", "menu-max-height"])]),
|
|
34124
|
+
_: 1
|
|
34125
|
+
}, 8, ["model-value"])
|
|
34126
|
+
]);
|
|
34127
34127
|
};
|
|
34128
34128
|
}
|
|
34129
|
-
}), [["__scopeId", "data-v-
|
|
34129
|
+
}), [["__scopeId", "data-v-d13e0460"]]);
|
|
34130
34130
|
//#endregion
|
|
34131
34131
|
//#region src/layouts/explorer/FileExplorer/enums.ts
|
|
34132
34132
|
var kdsFileExplorerSize = {
|
|
@@ -36486,8 +36486,8 @@ var KDS_DARK_MODE_STORAGE_KEY = "KNIME_DARK_MODE";
|
|
|
36486
36486
|
/**
|
|
36487
36487
|
* Key an earlier implementation used to persist the *derived* light/dark state
|
|
36488
36488
|
* alongside the preference. Nothing reads or writes it any more — see
|
|
36489
|
-
* {@link
|
|
36490
|
-
* lingering in browsers that ran that version.
|
|
36489
|
+
* {@link createKdsDarkModeController} — so it is cleared once to stop a stale
|
|
36490
|
+
* value from lingering in browsers that ran that version.
|
|
36491
36491
|
*/
|
|
36492
36492
|
var OBSOLETE_EFFECTIVE_STORAGE_KEY = `${KDS_DARK_MODE_STORAGE_KEY}_EFFECTIVE`;
|
|
36493
36493
|
var defaultMode = kdsDarkModeType.SYSTEM;
|
|
@@ -36515,8 +36515,44 @@ var clearObsoleteEffectiveMode = () => {
|
|
|
36515
36515
|
} catch {}
|
|
36516
36516
|
};
|
|
36517
36517
|
/**
|
|
36518
|
+
* Reads the `color-scheme` of `<html>`, which the `light-dark()` color tokens
|
|
36519
|
+
* resolve against, so it reports what the page renders, whoever themes it: the
|
|
36520
|
+
* app's CSS, `useKdsDarkModeController()` or an embedder.
|
|
36521
|
+
*/
|
|
36522
|
+
var createReadOnlyKdsDarkMode = () => {
|
|
36523
|
+
const documentElement = globalThis.document?.documentElement;
|
|
36524
|
+
const readColorScheme = () => documentElement ? getComputedStyle(documentElement).colorScheme : "normal";
|
|
36525
|
+
const colorScheme = ref(readColorScheme());
|
|
36526
|
+
const update = () => {
|
|
36527
|
+
colorScheme.value = readColorScheme();
|
|
36528
|
+
};
|
|
36529
|
+
useMutationObserver(documentElement, update, { attributeFilter: [
|
|
36530
|
+
"style",
|
|
36531
|
+
"class",
|
|
36532
|
+
"data-theme"
|
|
36533
|
+
] });
|
|
36534
|
+
const systemPrefersDark = usePreferredDark();
|
|
36535
|
+
watch(systemPrefersDark, update);
|
|
36536
|
+
const isDark = computed(() => {
|
|
36537
|
+
const schemes = colorScheme.value.split(" ");
|
|
36538
|
+
return schemes.includes("dark") && (!schemes.includes("light") || systemPrefersDark.value);
|
|
36539
|
+
});
|
|
36540
|
+
const isLight = computed(() => !isDark.value);
|
|
36541
|
+
const lightDark = (color) => isDark.value ? color.dark : color.light;
|
|
36542
|
+
return {
|
|
36543
|
+
/** Whether the page renders dark right now. */
|
|
36544
|
+
isDark,
|
|
36545
|
+
/** Whether the page renders light right now. */
|
|
36546
|
+
isLight,
|
|
36547
|
+
/**
|
|
36548
|
+
* Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
|
|
36549
|
+
*/
|
|
36550
|
+
lightDark
|
|
36551
|
+
};
|
|
36552
|
+
};
|
|
36553
|
+
/**
|
|
36518
36554
|
* The user preference is the *only* persisted state; the effective light/dark
|
|
36519
|
-
* value is
|
|
36555
|
+
* value is read from the page, which the preference is applied to.
|
|
36520
36556
|
*
|
|
36521
36557
|
* Persisting the derived value as well (as an earlier implementation did) gave
|
|
36522
36558
|
* the same fact two storage keys that could disagree. Every instance wrote the
|
|
@@ -36528,18 +36564,15 @@ var clearObsoleteEffectiveMode = () => {
|
|
|
36528
36564
|
* feedback edge entirely: nothing writes unless the user changes the
|
|
36529
36565
|
* preference.
|
|
36530
36566
|
*/
|
|
36531
|
-
var
|
|
36567
|
+
var createKdsDarkModeController = (page) => {
|
|
36532
36568
|
const userPreference = useLocalStorage(KDS_DARK_MODE_STORAGE_KEY, defaultMode);
|
|
36533
|
-
|
|
36569
|
+
watch(userPreference, applyToDocument, { immediate: true });
|
|
36534
36570
|
const isDark = computed({
|
|
36535
|
-
get()
|
|
36536
|
-
return userPreference.value === kdsDarkModeType.SYSTEM ? systemPrefersDark.value : userPreference.value === kdsDarkModeType.DARK;
|
|
36537
|
-
},
|
|
36571
|
+
get: () => page.isDark.value,
|
|
36538
36572
|
set(value) {
|
|
36539
36573
|
userPreference.value = value ? kdsDarkModeType.DARK : kdsDarkModeType.LIGHT;
|
|
36540
36574
|
}
|
|
36541
36575
|
});
|
|
36542
|
-
watch(userPreference, applyToDocument, { immediate: true });
|
|
36543
36576
|
const preferredMode = computed({
|
|
36544
36577
|
get() {
|
|
36545
36578
|
return userPreference.value;
|
|
@@ -36551,9 +36584,8 @@ var createKdsDarkMode = () => {
|
|
|
36551
36584
|
const isDarkPreferred = computed(() => userPreference.value === kdsDarkModeType.DARK);
|
|
36552
36585
|
const isLightPreferred = computed(() => userPreference.value === kdsDarkModeType.LIGHT);
|
|
36553
36586
|
const isSystemPreferred = computed(() => userPreference.value === kdsDarkModeType.SYSTEM);
|
|
36554
|
-
const isLight = computed(() => !isDark.value);
|
|
36555
|
-
const lightDark = (color) => isDark.value ? color.dark : color.light;
|
|
36556
36587
|
return {
|
|
36588
|
+
...page,
|
|
36557
36589
|
/**
|
|
36558
36590
|
* The current user *preference* (`'light' | 'dark' | 'system'`) as a
|
|
36559
36591
|
* writable computed — use it to read the preference or set it, e.g. via a
|
|
@@ -36567,34 +36599,36 @@ var createKdsDarkMode = () => {
|
|
|
36567
36599
|
/** Whether the user *preference* is set to 'system'. */
|
|
36568
36600
|
isSystemPreferred,
|
|
36569
36601
|
/**
|
|
36570
|
-
* Whether
|
|
36571
|
-
* `
|
|
36572
|
-
* reflects what is actually rendered. Use it for JS/canvas theming (e.g.
|
|
36573
|
-
* charts) that cannot rely on CSS `light-dark()`. Writable: setting it
|
|
36574
|
-
* stores an explicit `'light'`/`'dark'` preference.
|
|
36602
|
+
* Whether the page renders dark right now. Writable: setting it stores an
|
|
36603
|
+
* explicit `'light'`/`'dark'` preference.
|
|
36575
36604
|
*/
|
|
36576
|
-
isDark
|
|
36577
|
-
/**
|
|
36578
|
-
* Whether light styling is effectively active right now (the complement of
|
|
36579
|
-
* `isDark`). Like `isDark`, this resolves 'system' against the OS
|
|
36580
|
-
* preference, unlike the preference-only `isLightPreferred`.
|
|
36581
|
-
*/
|
|
36582
|
-
isLight,
|
|
36583
|
-
/**
|
|
36584
|
-
* Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
|
|
36585
|
-
*/
|
|
36586
|
-
lightDark
|
|
36605
|
+
isDark
|
|
36587
36606
|
};
|
|
36588
36607
|
};
|
|
36608
|
+
var sharedReadOnly;
|
|
36589
36609
|
var shared;
|
|
36610
|
+
/**
|
|
36611
|
+
* Reports whether the page renders dark and changes nothing, so the app or
|
|
36612
|
+
* embedder that themes the page stays in charge. Use it in components that
|
|
36613
|
+
* theme something CSS cannot reach, such as a Monaco editor or a chart.
|
|
36614
|
+
*/
|
|
36590
36615
|
var useKdsDarkMode = () => {
|
|
36616
|
+
sharedReadOnly ??= effectScope(true).run(createReadOnlyKdsDarkMode);
|
|
36617
|
+
return sharedReadOnly;
|
|
36618
|
+
};
|
|
36619
|
+
/**
|
|
36620
|
+
* Applies the stored preference to the page and exposes it, e.g. for a mode
|
|
36621
|
+
* picker. Only the app that lets KDS own its theme calls it.
|
|
36622
|
+
*/
|
|
36623
|
+
var useKdsDarkModeController = () => {
|
|
36591
36624
|
if (!shared) {
|
|
36592
36625
|
clearObsoleteEffectiveMode();
|
|
36593
|
-
|
|
36626
|
+
const page = useKdsDarkMode();
|
|
36627
|
+
shared = effectScope(true).run(() => createKdsDarkModeController(page));
|
|
36594
36628
|
}
|
|
36595
36629
|
return shared;
|
|
36596
36630
|
};
|
|
36597
36631
|
//#endregion
|
|
36598
|
-
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, KdsPagination_default as KdsPagination, 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, useKdsMultiSelection, useKdsNameValidator, vKdsTooltip };
|
|
36632
|
+
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, KdsPagination_default as KdsPagination, 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, useKdsDarkModeController, useKdsDynamicModal, useKdsIsTruncated, useKdsMultiSelection, useKdsNameValidator, vKdsTooltip };
|
|
36599
36633
|
|
|
36600
36634
|
//# sourceMappingURL=index.js.map
|