@odx/foundation 1.0.0-beta.245 → 1.0.0-beta.246

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,8 +1,6 @@
1
1
  import { OdxIconName } from '@odx/icons';
2
2
  export declare const userPrefersDarkMode: boolean;
3
- export declare const darkModeClass = "odx-dark-mode";
4
3
  export declare const darkModeIcon = "core::night-mode";
5
- export declare const lightModeClass = "odx-light-mode";
6
4
  export declare const lightModeIcon = "core::brightness";
7
5
  export declare function isDarkModeEnabled(): boolean;
8
6
  export declare function toggleDarkMode(enabled?: boolean | 'auto', root?: HTMLElement): void;
package/dist/main.js CHANGED
@@ -4,6 +4,7 @@ import { toAriaBooleanAttribute, booleanAttributeDirective, getKeyInfo, setFocus
4
4
  import { unsafeCSS, LitElement, html, isServer, render } from 'lit';
5
5
  import { u as uniqBy, R as RovingTabindexController, p as pick, m as minBy } from './vendor.js';
6
6
  export { e as SignalWatcher } from './vendor.js';
7
+ import { applyDarkMode } from '@odx/design-tokens';
7
8
  import { signal, effect } from '@preact/signals-core';
8
9
  export { computed, effect, signal } from '@preact/signals-core';
9
10
 
@@ -1091,9 +1092,7 @@ class ExpandableItemManager {
1091
1092
  }
1092
1093
 
1093
1094
  const { matches: userPrefersDarkMode = false } = globalThis.matchMedia?.("(prefers-color-scheme: dark)") ?? {};
1094
- const darkModeClass = "odx-dark-mode";
1095
1095
  const darkModeIcon = "core::night-mode";
1096
- const lightModeClass = "odx-light-mode";
1097
1096
  const lightModeIcon = "core::brightness";
1098
1097
  let unobserveMedia;
1099
1098
  const darkModeEnabled = signal(userPrefersDarkMode, {
@@ -1113,12 +1112,10 @@ function isDarkModeEnabled() {
1113
1112
  function toggleDarkMode(enabled, root = document.documentElement) {
1114
1113
  if (enabled === "auto") {
1115
1114
  darkModeEnabled.value = userPrefersDarkMode;
1116
- root.classList.remove(darkModeClass);
1117
- root.classList.remove(lightModeClass);
1115
+ applyDarkMode(root, "auto");
1118
1116
  } else {
1119
1117
  darkModeEnabled.value = enabled ?? !darkModeEnabled.value;
1120
- root.classList.toggle(darkModeClass, darkModeEnabled.value);
1121
- root.classList.toggle(lightModeClass, !darkModeEnabled.value);
1118
+ applyDarkMode(root, darkModeEnabled.value);
1122
1119
  }
1123
1120
  }
1124
1121
  function attachDarkModeToggle(host, options) {
@@ -1423,4 +1420,4 @@ const Variant = {
1423
1420
  GHOST: "ghost"
1424
1421
  };
1425
1422
 
1426
- export { ActiveDescendantsController, Alignment, CanBeCollapsed, CanBeDisabled, CanBeExpanded, CheckboxControl, CheckboxControlGroup, CollapseEvent, ControlElement, ControlSize, CustomElement, DialogCloseCommand, DialogCloseEvent, DialogElement, DialogLayer, DialogShowCommand, DialogShowEvent, DialogSize, DragController, DragControllerOptions, ExpandEvent, ExpandableItemManager, FormAssociated, InteractiveControlElement, IsDraggable, Justify, LinkControlElement, ListboxControl, NumberFormControl, OptionControl, OptionType, Placement, RadioGroupControl, Shape, Size, Spacing, Variant, WithPresets, activeDirective, attachDarkModeToggle, checkboxControlDirective, controlDirective, customElement, darkModeClass, darkModeIcon, dialogDirective, dragActiveDirective, isDarkModeEnabled, lightModeClass, lightModeIcon, loadCustomElements, optionControlDirection, toggleDarkMode, userPrefersDarkMode };
1423
+ export { ActiveDescendantsController, Alignment, CanBeCollapsed, CanBeDisabled, CanBeExpanded, CheckboxControl, CheckboxControlGroup, CollapseEvent, ControlElement, ControlSize, CustomElement, DialogCloseCommand, DialogCloseEvent, DialogElement, DialogLayer, DialogShowCommand, DialogShowEvent, DialogSize, DragController, DragControllerOptions, ExpandEvent, ExpandableItemManager, FormAssociated, InteractiveControlElement, IsDraggable, Justify, LinkControlElement, ListboxControl, NumberFormControl, OptionControl, OptionType, Placement, RadioGroupControl, Shape, Size, Spacing, Variant, WithPresets, activeDirective, attachDarkModeToggle, checkboxControlDirective, controlDirective, customElement, darkModeIcon, dialogDirective, dragActiveDirective, isDarkModeEnabled, lightModeIcon, loadCustomElements, optionControlDirection, toggleDarkMode, userPrefersDarkMode };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@odx/foundation",
3
3
  "displayName": "ODX Design System Foundation",
4
4
  "description": "A library of Web Component building blocks for ODX",
5
- "version": "1.0.0-beta.245",
5
+ "version": "1.0.0-beta.246",
6
6
  "author": "Drägerwerk AG & Co.KGaA",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "homepage": "https://odx.draeger.com",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@odx/icons": "^4.0.0-rc.49",
24
- "@odx/design-tokens": "^2.3.0"
24
+ "@odx/design-tokens": "^2.4.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@lit-labs/preact-signals": "1.0.3",
@@ -33,10 +33,10 @@
33
33
  "stylelint": "16.25.0",
34
34
  "tinyglobby": "0.2.15",
35
35
  "@odx-internal/config-stylelint": "0.0.0",
36
- "@odx-internal/utils-storybook": "0.0.0",
37
- "@odx-internal/config-vite": "0.0.0",
38
36
  "@odx-internal/config-typescript": "0.0.0",
39
- "@odx/design-tokens": "2.3.0"
37
+ "@odx-internal/config-vite": "0.0.0",
38
+ "@odx-internal/utils-storybook": "0.0.0",
39
+ "@odx/design-tokens": "2.4.0"
40
40
  },
41
41
  "sideEffects": [
42
42
  "dist/components-loader.js",