@fluentui/web-components 3.0.0-beta.25 → 3.0.0-beta.26

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 CHANGED
@@ -1,12 +1,23 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Fri, 07 Jun 2024 04:06:23 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 10 Jun 2024 04:07:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [3.0.0-beta.26](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.26)
8
+
9
+ Mon, 10 Jun 2024 04:07:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.25..@fluentui/web-components_v3.0.0-beta.26)
11
+
12
+ ### Changes
13
+
14
+ - feat: refactor Switch to use ElementInternals by extending BaseCheckbox ([PR #31613](https://github.com/microsoft/fluentui/pull/31613) by 13071055+chrisdholt@users.noreply.github.com)
15
+ - fixes the border-color for switch when in the checked state on rest ([PR #31628](https://github.com/microsoft/fluentui/pull/31628) by 13071055+chrisdholt@users.noreply.github.com)
16
+ - add try-catch block to ensure that registered properties can be updated dynamically ([PR #31629](https://github.com/microsoft/fluentui/pull/31629) by 13071055+chrisdholt@users.noreply.github.com)
17
+
7
18
  ## [3.0.0-beta.25](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.25)
8
19
 
9
- Fri, 07 Jun 2024 04:06:23 GMT
20
+ Fri, 07 Jun 2024 04:06:31 GMT
10
21
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.24..@fluentui/web-components_v3.0.0-beta.25)
11
22
 
12
23
  ### Changes
@@ -11,7 +11,7 @@ import { CheckboxShape, CheckboxSize } from './checkbox.options.js';
11
11
  *
12
12
  * @public
13
13
  */
14
- export declare class Checkbox extends FASTElement {
14
+ export declare class BaseCheckbox extends FASTElement {
15
15
  /**
16
16
  * Indicates that the element should get focus after the page finishes loading.
17
17
  * @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#autofocus | `autofocus`} attribute
@@ -110,22 +110,6 @@ export declare class Checkbox extends FASTElement {
110
110
  * @internal
111
111
  */
112
112
  requiredChanged(prev: boolean, next: boolean): void;
113
- /**
114
- * Indicates the shape of the checkbox.
115
- *
116
- * @public
117
- * @remarks
118
- * HTML Attribute: `shape`
119
- */
120
- shape: CheckboxShape;
121
- /**
122
- * Indicates the size of the checkbox.
123
- *
124
- * @public
125
- * @remarks
126
- * HTML Attribute: `size`
127
- */
128
- size?: CheckboxSize;
129
113
  /**
130
114
  * The internal checked state of the control.
131
115
  *
@@ -297,3 +281,21 @@ export declare class Checkbox extends FASTElement {
297
281
  */
298
282
  private toggleChecked;
299
283
  }
284
+ export declare class Checkbox extends BaseCheckbox {
285
+ /**
286
+ * Indicates the shape of the checkbox.
287
+ *
288
+ * @public
289
+ * @remarks
290
+ * HTML Attribute: `shape`
291
+ */
292
+ shape: CheckboxShape;
293
+ /**
294
+ * Indicates the size of the checkbox.
295
+ *
296
+ * @public
297
+ * @remarks
298
+ * HTML Attribute: `size`
299
+ */
300
+ size?: CheckboxSize;
301
+ }
@@ -1,44 +1,7 @@
1
1
  import type { StaticallyComposableHTML } from '../utils/index.js';
2
- import { SwitchLabelPosition } from './switch.options.js';
3
- import { FormAssociatedSwitch } from './switch.form-associated.js';
2
+ import { BaseCheckbox } from '../checkbox/checkbox.js';
4
3
  export type SwitchOptions = {
5
4
  switch?: StaticallyComposableHTML<Switch>;
6
5
  };
7
- export declare class Switch extends FormAssociatedSwitch {
8
- /**
9
- * The label position of the switch
10
- *
11
- * @public
12
- * @remarks
13
- * HTML Attribute: labelposition
14
- */
15
- labelPosition: SwitchLabelPosition | undefined;
16
- /**
17
- * When true, the control will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute} for more information.
18
- * @public
19
- * @remarks
20
- * HTML Attribute: readonly
21
- */
22
- readOnly: boolean;
23
- protected readOnlyChanged(): void;
24
- /**
25
- * The element's value to be included in form submission when checked.
26
- * Default to "on" to reach parity with input[type="checkbox"]
27
- *
28
- * @internal
29
- */
30
- initialValue: string;
31
- /**
32
- * @internal
33
- */
34
- defaultSlottedNodes: Node[];
35
- constructor();
36
- /**
37
- * @internal
38
- */
39
- keypressHandler: (e: KeyboardEvent) => void;
40
- /**
41
- * @internal
42
- */
43
- clickHandler: (e: MouseEvent) => void;
6
+ export declare class Switch extends BaseCheckbox {
44
7
  }
@@ -12,7 +12,7 @@ import { toggleState } from '../utils/element-internals.js';
12
12
  *
13
13
  * @public
14
14
  */
15
- export class Checkbox extends FASTElement {
15
+ export class BaseCheckbox extends FASTElement {
16
16
  /**
17
17
  * The element's current checked state.
18
18
  *
@@ -346,31 +346,33 @@ export class Checkbox extends FASTElement {
346
346
  *
347
347
  * @public
348
348
  */
349
- Checkbox.formAssociated = true;
349
+ BaseCheckbox.formAssociated = true;
350
350
  __decorate([
351
351
  attr({ mode: 'boolean' })
352
- ], Checkbox.prototype, "autofocus", void 0);
352
+ ], BaseCheckbox.prototype, "autofocus", void 0);
353
353
  __decorate([
354
354
  attr({ mode: 'boolean' })
355
- ], Checkbox.prototype, "disabled", void 0);
355
+ ], BaseCheckbox.prototype, "disabled", void 0);
356
356
  __decorate([
357
357
  attr({ attribute: 'form' })
358
- ], Checkbox.prototype, "formAttribute", void 0);
358
+ ], BaseCheckbox.prototype, "formAttribute", void 0);
359
359
  __decorate([
360
360
  observable
361
- ], Checkbox.prototype, "indeterminate", void 0);
361
+ ], BaseCheckbox.prototype, "indeterminate", void 0);
362
362
  __decorate([
363
363
  attr({ attribute: 'checked', mode: 'boolean' })
364
- ], Checkbox.prototype, "initialChecked", void 0);
364
+ ], BaseCheckbox.prototype, "initialChecked", void 0);
365
365
  __decorate([
366
366
  attr({ attribute: 'value', mode: 'fromView' })
367
- ], Checkbox.prototype, "initialValue", void 0);
367
+ ], BaseCheckbox.prototype, "initialValue", void 0);
368
368
  __decorate([
369
369
  attr
370
- ], Checkbox.prototype, "name", void 0);
370
+ ], BaseCheckbox.prototype, "name", void 0);
371
371
  __decorate([
372
372
  attr({ mode: 'boolean' })
373
- ], Checkbox.prototype, "required", void 0);
373
+ ], BaseCheckbox.prototype, "required", void 0);
374
+ export class Checkbox extends BaseCheckbox {
375
+ }
374
376
  __decorate([
375
377
  attr
376
378
  ], Checkbox.prototype, "shape", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/checkbox/checkbox.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IAYvC;;;;OAIG;IACH,IAAW,OAAO;QAChB,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,OAAO,CAAC,KAAc;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAErD,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;IA8BD;;;;OAIG;IACI,oBAAoB,CAAC,IAAa,EAAE,IAAa;QACtD,IA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AS,SAAQ,YAAY;CAoBzC;AAXC;IADC,IAAI;uCACwB;AAU7B;IADC,IAAI;sCACsB"}
@@ -1,54 +1,4 @@
1
- import { __decorate } from "tslib";
2
- import { attr, observable } from '@microsoft/fast-element';
3
- import { keyEnter, keySpace } from '@microsoft/fast-web-utilities';
4
- import { FormAssociatedSwitch } from './switch.form-associated.js';
5
- export class Switch extends FormAssociatedSwitch {
6
- readOnlyChanged() {
7
- if (this.proxy instanceof HTMLInputElement) {
8
- this.proxy.readOnly = this.readOnly;
9
- }
10
- }
11
- constructor() {
12
- super();
13
- /**
14
- * The element's value to be included in form submission when checked.
15
- * Default to "on" to reach parity with input[type="checkbox"]
16
- *
17
- * @internal
18
- */
19
- this.initialValue = 'on';
20
- /**
21
- * @internal
22
- */
23
- this.keypressHandler = (e) => {
24
- if (this.readOnly) {
25
- return;
26
- }
27
- switch (e.key) {
28
- case keyEnter:
29
- case keySpace:
30
- this.checked = !this.checked;
31
- break;
32
- }
33
- };
34
- /**
35
- * @internal
36
- */
37
- this.clickHandler = (e) => {
38
- if (!this.disabled && !this.readOnly) {
39
- this.checked = !this.checked;
40
- }
41
- };
42
- this.proxy.setAttribute('type', 'checkbox');
43
- }
1
+ import { BaseCheckbox } from '../checkbox/checkbox.js';
2
+ export class Switch extends BaseCheckbox {
44
3
  }
45
- __decorate([
46
- attr({ attribute: 'label-position' })
47
- ], Switch.prototype, "labelPosition", void 0);
48
- __decorate([
49
- attr({ attribute: 'readonly', mode: 'boolean' })
50
- ], Switch.prototype, "readOnly", void 0);
51
- __decorate([
52
- observable
53
- ], Switch.prototype, "defaultSlottedNodes", void 0);
54
4
  //# sourceMappingURL=switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/switch/switch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM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,yBAAyB,CAAC;AAMvD,MAAM,OAAO,MAAO,SAAQ,YAAY;CAAG"}
@@ -1,81 +1,56 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
3
- import { borderRadiusCircular, colorCompoundBrandBackground, colorCompoundBrandBackgroundHover, colorCompoundBrandBackgroundPressed, colorNeutralBackgroundDisabled, colorNeutralForeground1, colorNeutralForeground3, colorNeutralForeground3Hover, colorNeutralForeground3Pressed, colorNeutralForegroundDisabled, colorNeutralForegroundInverted, colorNeutralForegroundInvertedHover, colorNeutralForegroundInvertedPressed, colorNeutralStrokeAccessible, colorNeutralStrokeAccessibleHover, colorNeutralStrokeAccessiblePressed, colorNeutralStrokeDisabled, colorStrokeFocus2, colorTransparentBackground, colorTransparentStroke, curveEasyEase, durationNormal, fontFamilyBase, fontSizeBase300, fontWeightRegular, lineHeightBase300, shadow4, spacingHorizontalS, spacingHorizontalXS, spacingHorizontalXXS, spacingVerticalS, spacingVerticalXS, strokeWidthThick, } from '../theme/design-tokens.js';
3
+ import { borderRadiusCircular, colorCompoundBrandBackground, colorCompoundBrandBackgroundHover, colorCompoundBrandBackgroundPressed, colorNeutralBackgroundDisabled, colorNeutralForeground3, colorNeutralForeground3Hover, colorNeutralForeground3Pressed, colorNeutralForegroundDisabled, colorNeutralForegroundInverted, colorNeutralForegroundInvertedHover, colorNeutralForegroundInvertedPressed, colorNeutralStrokeAccessible, colorNeutralStrokeAccessibleHover, colorNeutralStrokeAccessiblePressed, colorNeutralStrokeDisabled, colorStrokeFocus2, colorTransparentBackground, colorTransparentStroke, curveEasyEase, durationNormal, shadow4, spacingHorizontalXXS, strokeWidthThick, } from '../theme/design-tokens.js';
4
+ /**
5
+ * Selector for the `checked` state.
6
+ * @public
7
+ */
8
+ const checkedState = css.partial `:is([state--checked], :state(checked))`;
4
9
  export const styles = css `
5
10
  ${display('inline-flex')}
6
11
 
7
12
  :host {
13
+ box-sizing: border-box;
8
14
  align-items: center;
9
- flex-direction: row-reverse;
15
+ flex-direction: row;
10
16
  outline: none;
11
17
  user-select: none;
12
18
  contain: content;
13
- }
14
- :host([label-position='before']) {
15
- flex-direction: row;
16
- }
17
- :host([label-position='above']) {
18
- flex-direction: column;
19
- align-items: flex-start;
20
- }
21
- :host([disabled]) .label,
22
- :host([readonly]) .label,
23
- :host([readonly]) .switch,
24
- :host([disabled]) .switch {
25
- cursor: not-allowed;
26
- }
27
- .label {
28
- position: relative;
29
- color: ${colorNeutralForeground1};
30
- line-height: ${lineHeightBase300};
31
- font-size: ${fontSizeBase300};
32
- font-weight: ${fontWeightRegular};
33
- font-family: ${fontFamilyBase};
34
- padding: ${spacingVerticalXS} ${spacingHorizontalXS};
35
- cursor: pointer;
36
- }
37
- .label__hidden {
38
- display: none;
39
- }
40
- .switch {
41
- display: flex;
42
- align-items: center;
43
19
  padding: 0 ${spacingHorizontalXXS};
44
- box-sizing: border-box;
45
20
  width: 40px;
46
21
  height: 20px;
47
22
  background-color: ${colorTransparentBackground};
48
23
  border: 1px solid ${colorNeutralStrokeAccessible};
49
24
  border-radius: ${borderRadiusCircular};
50
- outline: none;
51
25
  cursor: pointer;
52
- margin: ${spacingVerticalS} ${spacingHorizontalS};
53
26
  }
54
- :host(:hover) .switch {
27
+
28
+ :host(:hover) {
55
29
  background: none;
56
30
  border-color: ${colorNeutralStrokeAccessibleHover};
57
31
  }
58
- :host(:active) .switch {
32
+ :host(:active) {
59
33
  border-color: ${colorNeutralStrokeAccessiblePressed};
60
34
  }
61
- :host([disabled]) .switch,
62
- :host([readonly]) .switch {
35
+ :host(:disabled),
36
+ :host([readonly]) {
63
37
  border: 1px solid ${colorNeutralStrokeDisabled};
64
38
  background-color: none;
65
39
  pointer: default;
66
40
  }
67
- :host([aria-checked='true']) .switch {
41
+ :host(${checkedState}) {
68
42
  background: ${colorCompoundBrandBackground};
43
+ border-color: ${colorCompoundBrandBackground};
69
44
  }
70
- :host([aria-checked='true']:hover) .switch {
45
+ :host(${checkedState}:hover) {
71
46
  background: ${colorCompoundBrandBackgroundHover};
72
47
  border-color: ${colorCompoundBrandBackgroundHover};
73
48
  }
74
- :host([aria-checked='true']:active) .switch {
49
+ :host(${checkedState}:active) {
75
50
  background: ${colorCompoundBrandBackgroundPressed};
76
51
  border-color: ${colorCompoundBrandBackgroundPressed};
77
52
  }
78
- :host([aria-checked='true'][disabled]) .switch {
53
+ :host(${checkedState}:disabled) {
79
54
  background: ${colorNeutralBackgroundDisabled};
80
55
  border-color: ${colorNeutralStrokeDisabled};
81
56
  }
@@ -89,14 +64,14 @@ export const styles = css `
89
64
  transition-timing-function: ${curveEasyEase};
90
65
  transition-property: margin-inline-start;
91
66
  }
92
- :host([aria-checked='true']) .checked-indicator {
67
+ :host(${checkedState}) .checked-indicator {
93
68
  background-color: ${colorNeutralForegroundInverted};
94
69
  margin-inline-start: calc(100% - 14px);
95
70
  }
96
- :host([aria-checked='true']:hover) .checked-indicator {
71
+ :host(${checkedState}:hover) .checked-indicator {
97
72
  background: ${colorNeutralForegroundInvertedHover};
98
73
  }
99
- :host([aria-checked='true']:active) .checked-indicator {
74
+ :host(${checkedState}:active) .checked-indicator {
100
75
  background: ${colorNeutralForegroundInvertedPressed};
101
76
  }
102
77
  :host(:hover) .checked-indicator {
@@ -105,26 +80,30 @@ export const styles = css `
105
80
  :host(:active) .checked-indicator {
106
81
  background-color: ${colorNeutralForeground3Pressed};
107
82
  }
108
- :host([disabled]) .checked-indicator,
83
+ :host(:disabled) .checked-indicator,
109
84
  :host([readonly]) .checked-indicator {
110
85
  background: ${colorNeutralForegroundDisabled};
111
86
  }
112
- :host([aria-checked='true'][disabled]) .checked-indicator {
87
+ :host(${checkedState}:disabled) .checked-indicator {
113
88
  background: ${colorNeutralForegroundDisabled};
114
89
  }
115
90
 
116
91
  :host(:focus-visible) {
92
+ outline: none;
93
+ }
94
+
95
+ :host(:not([slot='input']):focus-visible) {
117
96
  border-color: ${colorTransparentStroke};
118
97
  outline: ${strokeWidthThick} solid ${colorTransparentStroke};
119
98
  box-shadow: ${shadow4}, 0 0 0 2px ${colorStrokeFocus2};
120
99
  }
121
100
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
122
- .switch {
101
+ :host {
123
102
  border-color: InactiveBorder;
124
103
  }
125
- :host([aria-checked='true']) .switch,
126
- :host([aria-checked='true']:active) .switch,
127
- :host([aria-checked='true']:hover) .switch {
104
+ :host(${checkedState}),
105
+ :host(${checkedState}:active),
106
+ :host(${checkedState}:hover) {
128
107
  background: Highlight;
129
108
  border-color: Highlight;
130
109
  }
@@ -133,9 +112,9 @@ export const styles = css `
133
112
  :host(:active) .checked-indicator {
134
113
  background-color: ActiveCaption;
135
114
  }
136
- :host([aria-checked='true']) .checked-indicator,
137
- :host([aria-checked='true']:hover) .checked-indicator,
138
- :host([aria-checked='true']:active) .checked-indicator {
115
+ :host(${checkedState}) .checked-indicator,
116
+ :host(${checkedState}:hover) .checked-indicator,
117
+ :host(${checkedState}:active) .checked-indicator {
139
118
  background-color: ButtonFace;
140
119
  }
141
120
  `));
@@ -1 +1 @@
1
- {"version":3,"file":"switch.styles.js","sourceRoot":"","sources":["../../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,mCAAmC,EACnC,qCAAqC,EACrC,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACnC,0BAA0B,EAC1B,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB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,YAAY;YACZ,YAAY;;;;;;;;;YASZ,YAAY;YACZ,YAAY;YACZ,YAAY;;;GAGrB,CAAC,CACH,CAAC"}
@@ -1,25 +1,15 @@
1
- import { html, slotted } from '@microsoft/fast-element';
1
+ import { html } from '@microsoft/fast-element';
2
2
  import { staticallyCompose } from '../utils/index.js';
3
3
  export function switchTemplate(options = {}) {
4
4
  return html `
5
5
  <template
6
- role="switch"
7
- aria-checked="${x => x.checked}"
8
- aria-disabled="${x => x.disabled}"
9
- aria-readonly="${x => x.readOnly}"
10
- tabindex="${x => (x.disabled ? null : 0)}"
11
- @keypress="${(x, c) => x.keypressHandler(c.event)}"
6
+ tabindex="${x => (!x.disabled ? 0 : void 0)}"
12
7
  @click="${(x, c) => x.clickHandler(c.event)}"
8
+ @input="${(x, c) => x.inputHandler(c.event)}"
9
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
10
+ @keyup="${(x, c) => x.keyupHandler(c.event)}"
13
11
  >
14
- <label
15
- part="label"
16
- class="${x => (x.defaultSlottedNodes && x.defaultSlottedNodes.length ? 'label' : 'label label__hidden')}"
17
- >
18
- <slot ${slotted('defaultSlottedNodes')}></slot>
19
- </label>
20
- <div part="switch" class="switch">
21
- <slot name="switch">${staticallyCompose(options.switch)}</slot>
22
- </div>
12
+ <slot name="switch">${staticallyCompose(options.switch)}</slot>
23
13
  </template>
24
14
  `;
25
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"switch.template.js","sourceRoot":"","sources":["../../../src/switch/switch.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,UAAU,cAAc,CAAmB,UAAyB,EAAE;IAC1E,OAAO,IAAI,CAAG;;;sBAGM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;uBACb,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC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E,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAc,CAAC;kBACxC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAsB,CAAC;gBACtD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAsB,CAAC;;4BAEtC,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC;;GAE1D,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAgC,cAAc,CAAC;IAClE,MAAM,EAAE,kEAAkE;CAC3E,CAAC,CAAC"}
@@ -8,11 +8,16 @@ const tokenNames = Object.keys(tokens);
8
8
  export const setTheme = (theme) => {
9
9
  for (const t of tokenNames) {
10
10
  if ('registerProperty' in CSS) {
11
- CSS.registerProperty({
12
- name: `--${t}`,
13
- inherits: true,
14
- initialValue: theme[t],
15
- });
11
+ try {
12
+ CSS.registerProperty({
13
+ name: `--${t}`,
14
+ inherits: true,
15
+ initialValue: theme[t],
16
+ });
17
+ }
18
+ catch {
19
+ document.body.style.setProperty(`--${t}`, theme[t]);
20
+ }
16
21
  }
17
22
  else {
18
23
  document.body.style.setProperty(`--${t}`, theme[t]);
@@ -1 +1 @@
1
- {"version":3,"file":"set-theme.js","sourceRoot":"","sources":["../../../src/theme/set-theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAoB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,EAAE;IACvC,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE;QAC1B,IAAI,kBAAkB,IAAI,GAAG,EAAE;YAC7B,GAAG,CAAC,gBAAgB,CAAC;gBACnB,IAAI,EAAE,KAA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