@knime/kds-components 10.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"KdsToggleSwitch.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/ToggleSwitch/KdsToggleSwitch.vue"],"names":[],"mappings":"AA8PA,KAAK,gBAAgB,GAAG;IACxB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkHF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"KdsToggleSwitch.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/ToggleSwitch/KdsToggleSwitch.vue"],"names":[],"mappings":"AAgRA,KAAK,gBAAgB,GAAG;IACxB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA8HF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,8 +1,9 @@
1
1
  export declare const kdsToggleSwitchSize: {
2
+ readonly XSMALL: "xsmall";
2
3
  readonly SMALL: "small";
3
4
  readonly MEDIUM: "medium";
4
5
  };
5
- export declare const kdsToggleSwitchSizes: ("small" | "medium")[];
6
+ export declare const kdsToggleSwitchSizes: ("small" | "medium" | "xsmall")[];
6
7
  export declare const kdsToggleSwitchLabelPosition: {
7
8
  readonly RIGHT: "right";
8
9
  readonly TOP: "top";
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/ToggleSwitch/enums.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,eAAO,MAAM,oBAAoB,wBAAqC,CAAC;AAEvE,eAAO,MAAM,4BAA4B;;;CAG/B,CAAC;AAEX,eAAO,MAAM,6BAA6B,qBAEzC,CAAC"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/ToggleSwitch/enums.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,eAAO,MAAM,oBAAoB,mCAAqC,CAAC;AAEvE,eAAO,MAAM,4BAA4B;;;CAG/B,CAAC;AAEX,eAAO,MAAM,6BAA6B,qBAEzC,CAAC"}
@@ -1,4 +1,4 @@
1
- export { useKdsDarkMode } from './useKdsDarkMode';
1
+ export { useKdsDarkMode, useKdsDarkModeController } from './useKdsDarkMode';
2
2
  export { useKdsIsTruncated } from './useKdsIsTruncated';
3
3
  export { useKdsMultiSelection } from './multiSelection/useKdsMultiSelection';
4
4
  export { useKdsNameValidator } from './useKdsNameValidator';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG5D,mBAAmB,kBAAkB,CAAC;AACtC,YAAY,EACV,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAC1F,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG5D,mBAAmB,kBAAkB,CAAC;AACtC,YAAY,EACV,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAC1F,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC"}
@@ -2,7 +2,36 @@ import { KdsColor, KdsColorValue } from '@knime/kds-styles/tokens';
2
2
  import { kdsDarkModeType } from './enums';
3
3
  export declare const KDS_DARK_MODE_STORAGE_KEY = "KNIME_DARK_MODE";
4
4
  export type KdsDarkModeType = (typeof kdsDarkModeType)[keyof typeof kdsDarkModeType];
5
- export declare const useKdsDarkMode: () => {
5
+ /**
6
+ * Reads the `color-scheme` of `<html>`, which the `light-dark()` color tokens
7
+ * resolve against, so it reports what the page renders, whoever themes it: the
8
+ * app's CSS, `useKdsDarkModeController()` or an embedder.
9
+ */
10
+ declare const createReadOnlyKdsDarkMode: () => {
11
+ /** Whether the page renders dark right now. */
12
+ isDark: import('vue').ComputedRef<boolean>;
13
+ /** Whether the page renders light right now. */
14
+ isLight: import('vue').ComputedRef<boolean>;
15
+ /**
16
+ * Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
17
+ */
18
+ lightDark: (color: KdsColor) => KdsColorValue;
19
+ };
20
+ /**
21
+ * The user preference is the *only* persisted state; the effective light/dark
22
+ * value is read from the page, which the preference is applied to.
23
+ *
24
+ * Persisting the derived value as well (as an earlier implementation did) gave
25
+ * the same fact two storage keys that could disagree. Every instance wrote the
26
+ * derived key whenever it re-derived, `useStorage` mirrors those writes into
27
+ * every other instance and browser tab, and the write-back re-triggered the
28
+ * derivation there — so a disagreement, however brief, sustained itself as a
29
+ * write loop between tabs. Each write re-stamped the document attributes,
30
+ * which is what made the UI flash. Deriving instead of storing removes the
31
+ * feedback edge entirely: nothing writes unless the user changes the
32
+ * preference.
33
+ */
34
+ declare const createKdsDarkModeController: (page: KdsDarkMode) => {
6
35
  /**
7
36
  * The current user *preference* (`'light' | 'dark' | 'system'`) as a
8
37
  * writable computed — use it to read the preference or set it, e.g. via a
@@ -16,22 +45,64 @@ export declare const useKdsDarkMode: () => {
16
45
  /** Whether the user *preference* is set to 'system'. */
17
46
  isSystemPreferred: import('vue').ComputedRef<boolean>;
18
47
  /**
19
- * Whether dark styling is effectively active right now. Unlike
20
- * `isDarkPreferred` this resolves 'system' against the OS preference, so it
21
- * reflects what is actually rendered. Use it for JS/canvas theming (e.g.
22
- * charts) that cannot rely on CSS `light-dark()`. Writable: setting it
23
- * stores an explicit `'light'`/`'dark'` preference.
48
+ * Whether the page renders dark right now. Writable: setting it stores an
49
+ * explicit `'light'`/`'dark'` preference.
24
50
  */
25
51
  isDark: import('vue').WritableComputedRef<boolean, boolean>;
52
+ /** Whether the page renders light right now. */
53
+ isLight: import('vue').ComputedRef<boolean>;
26
54
  /**
27
- * Whether light styling is effectively active right now (the complement of
28
- * `isDark`). Like `isDark`, this resolves 'system' against the OS
29
- * preference, unlike the preference-only `isLightPreferred`.
55
+ * Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
30
56
  */
57
+ lightDark: (color: KdsColor) => KdsColorValue;
58
+ };
59
+ /** What `useKdsDarkMode()` returns. */
60
+ export type KdsDarkMode = ReturnType<typeof createReadOnlyKdsDarkMode>;
61
+ /** What `useKdsDarkModeController()` returns. */
62
+ export type KdsDarkModeController = ReturnType<typeof createKdsDarkModeController>;
63
+ /**
64
+ * Reports whether the page renders dark and changes nothing, so the app or
65
+ * embedder that themes the page stays in charge. Use it in components that
66
+ * theme something CSS cannot reach, such as a Monaco editor or a chart.
67
+ */
68
+ export declare const useKdsDarkMode: () => {
69
+ /** Whether the page renders dark right now. */
70
+ isDark: import('vue').ComputedRef<boolean>;
71
+ /** Whether the page renders light right now. */
72
+ isLight: import('vue').ComputedRef<boolean>;
73
+ /**
74
+ * Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
75
+ */
76
+ lightDark: (color: KdsColor) => KdsColorValue;
77
+ };
78
+ /**
79
+ * Applies the stored preference to the page and exposes it, e.g. for a mode
80
+ * picker. Only the app that lets KDS own its theme calls it.
81
+ */
82
+ export declare const useKdsDarkModeController: () => {
83
+ /**
84
+ * The current user *preference* (`'light' | 'dark' | 'system'`) as a
85
+ * writable computed — use it to read the preference or set it, e.g. via a
86
+ * `v-model` on a mode picker.
87
+ */
88
+ preferredMode: import('vue').WritableComputedRef<KdsDarkModeType, KdsDarkModeType>;
89
+ /** Whether the user *preference* is dark. Note: `false` when the preference is 'system' — for the actually-rendered state use `isDark`. */
90
+ isDarkPreferred: import('vue').ComputedRef<boolean>;
91
+ /** Whether the user *preference* is light. Note: `false` when the preference is 'system' — for the actually-rendered state use `isLight`. */
92
+ isLightPreferred: import('vue').ComputedRef<boolean>;
93
+ /** Whether the user *preference* is set to 'system'. */
94
+ isSystemPreferred: import('vue').ComputedRef<boolean>;
95
+ /**
96
+ * Whether the page renders dark right now. Writable: setting it stores an
97
+ * explicit `'light'`/`'dark'` preference.
98
+ */
99
+ isDark: import('vue').WritableComputedRef<boolean, boolean>;
100
+ /** Whether the page renders light right now. */
31
101
  isLight: import('vue').ComputedRef<boolean>;
32
102
  /**
33
103
  * Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
34
104
  */
35
105
  lightDark: (color: KdsColor) => KdsColorValue;
36
106
  };
107
+ export {};
37
108
  //# sourceMappingURL=useKdsDarkMode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKdsDarkMode.d.ts","sourceRoot":"","sources":["../../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C,OAAO,yBAAyB,CAAC,CAAC;AACvE,iDAAiD;AACjD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAC5C,OAAO,2BAA2B,CACnC,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,cAAc;IAtGvB,+CAA+C;;IAE/C,gDAAgD;;IAEhD;;OAEG;uBAVqB,QAAQ,KAAG,aAAa;CA+GnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;IA9CjC;;;;OAIG;;IAEH,2IAA2I;;IAE3I,6IAA6I;;IAE7I,wDAAwD;;IAExD;;;OAGG;;IAhFH,gDAAgD;;IAEhD;;OAEG;uBAVqB,QAAQ,KAAG,aAAa;CAkInD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/kds-components",
3
- "version": "10.1.0",
3
+ "version": "11.0.0",
4
4
  "description": "Package containing basic Vue components of the KNIME Design System",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,15 +35,15 @@
35
35
  "vue": "~3.5.0"
36
36
  },
37
37
  "dependencies": {
38
- "@knime/kds-styles": "^10.1.0",
39
- "@knime/utils": "^2.0.2",
38
+ "@knime/kds-styles": "^11.0.0",
39
+ "@knime/utils": "^2.0.3",
40
40
  "consola": "^3.4.2",
41
41
  "motion": "^12.42.2",
42
42
  "temporal-polyfill": "^1.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@knime/kds-code-editor": "^10.1.0",
46
- "@knime/kds-table": "^10.1.0",
45
+ "@knime/kds-code-editor": "^11.0.0",
46
+ "@knime/kds-table": "^11.0.0",
47
47
  "@storybook/vue3-vite": "^10.4.6",
48
48
  "@vitejs/plugin-vue": "^6.0.8",
49
49
  "@vue/test-utils": "^2.4.11",