@ni/fast-foundation 10.1.3 → 10.1.5

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.
Files changed (41) hide show
  1. package/README.md +3 -2
  2. package/dist/esm/accordion/accordion.js +1 -2
  3. package/dist/esm/anchor/anchor.js +2 -4
  4. package/dist/esm/anchored-region/anchored-region-config.js +32 -6
  5. package/dist/esm/anchored-region/anchored-region.js +1 -1
  6. package/dist/esm/breadcrumb/breadcrumb.js +2 -3
  7. package/dist/esm/button/button.js +5 -10
  8. package/dist/esm/calendar/calendar.template.js +1 -2
  9. package/dist/esm/calendar/date-formatter.js +4 -1
  10. package/dist/esm/combobox/combobox.js +7 -11
  11. package/dist/esm/data-grid/data-grid-cell.js +1 -2
  12. package/dist/esm/data-grid/data-grid.js +11 -11
  13. package/dist/esm/design-system/design-system.js +4 -1
  14. package/dist/esm/design-token/custom-property-manager.js +2 -2
  15. package/dist/esm/design-token/design-token.js +16 -17
  16. package/dist/esm/di/di.js +2 -3
  17. package/dist/esm/dialog/dialog.js +2 -4
  18. package/dist/esm/directives/reflect-attributes.js +1 -1
  19. package/dist/esm/form-associated/form-associated.js +3 -5
  20. package/dist/esm/foundation-element/foundation-element.js +4 -1
  21. package/dist/esm/horizontal-scroll/horizontal-scroll.js +6 -9
  22. package/dist/esm/horizontal-scroll/horizontal-scroll.template.js +8 -11
  23. package/dist/esm/listbox/listbox.element.js +5 -10
  24. package/dist/esm/listbox/listbox.js +21 -28
  25. package/dist/esm/listbox-option/listbox-option.js +4 -7
  26. package/dist/esm/menu/menu.js +1 -1
  27. package/dist/esm/number-field/number-field.js +2 -4
  28. package/dist/esm/picker/picker-list-item.js +3 -4
  29. package/dist/esm/picker/picker-menu-option.js +3 -4
  30. package/dist/esm/picker/picker.js +12 -9
  31. package/dist/esm/radio/radio.js +3 -5
  32. package/dist/esm/radio-group/radio-group.js +4 -8
  33. package/dist/esm/select/select.js +12 -20
  34. package/dist/esm/tabs/tabs.js +2 -4
  35. package/dist/esm/test-utilities/fixture.js +57 -60
  36. package/dist/esm/test-utilities/timeout.js +5 -8
  37. package/dist/esm/toolbar/toolbar.js +7 -9
  38. package/dist/esm/utilities/intersection-service.js +2 -4
  39. package/dist/fast-foundation.js +243 -262
  40. package/dist/fast-foundation.min.js +88 -88
  41. package/package.json +3 -3
package/README.md CHANGED
@@ -6,8 +6,9 @@
6
6
 
7
7
  [![NI FAST Foundation NPM version and repo link](https://img.shields.io/npm/v/@ni/fast-foundation.svg?label=@ni/fast-foundation)](https://www.npmjs.com/package/@ni/fast-foundation)
8
8
 
9
- The `fast-foundation` package is a library of Web Component classes, templates, and other utilities intended to be composed into registered Web Components by design systems (e.g. [NI Nimble Design System](https://nimble.ni.dev/), etc.). The exports of this package can generally be thought of as un-styled base components that implement semantic and accessible markup and behavior. This `@ni/fast-foundation` library is a fork of [`@microsoft/fast-foundation`](https://github.com/microsoft/fast/tree/archives/fast-element-1/packages/web-components/fast-foundation).
10
-
9
+ The `fast-foundation` package is a library of Web Component classes, templates, and other utilities intended to be composed into registered Web Components by design systems (e.g. [NI Nimble Design System](https://nimble.ni.dev/), etc.).
10
+ The exports of this package can generally be thought of as un-styled base components that implement semantic and accessible markup and behavior.
11
+ This `@ni/fast-foundation` library is a fork of [`@microsoft/fast-foundation`](https://github.com/microsoft/fast/tree/archives/fast-element-1/packages/web-components/fast-foundation).
11
12
 
12
13
  This package does not export Web Components registered as [custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) - it exports parts and pieces intended to be *composed* into Web Components, allowing you to implement your own design language by simply applying CSS styles and behaviors without having to write all the JavaScript that's involved in building production-quality component implementations.
13
14
 
@@ -45,7 +45,6 @@ export class Accordion extends FoundationElement {
45
45
  this.$emit("change", this.activeid);
46
46
  };
47
47
  this.setItems = () => {
48
- var _a;
49
48
  if (this.accordionItems.length === 0) {
50
49
  return;
51
50
  }
@@ -64,7 +63,7 @@ export class Accordion extends FoundationElement {
64
63
  item.addEventListener("focus", this.handleItemFocus);
65
64
  });
66
65
  if (this.isSingleExpandMode()) {
67
- const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
66
+ const expandedItem = this.findExpandedItem() ?? this.accordionItems[0];
68
67
  expandedItem.setAttribute("aria-disabled", "true");
69
68
  }
70
69
  };
@@ -24,14 +24,12 @@ export class Anchor extends FoundationElement {
24
24
  * Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
25
25
  */
26
26
  this.handleUnsupportedDelegatesFocus = () => {
27
- var _a;
28
27
  // Check to see if delegatesFocus is supported
29
28
  if (window.ShadowRoot &&
30
29
  !window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
31
- ((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
30
+ this.$fastController.definition.shadowOptions?.delegatesFocus) {
32
31
  this.focus = () => {
33
- var _a;
34
- (_a = this.control) === null || _a === void 0 ? void 0 : _a.focus();
32
+ this.control?.focus();
35
33
  };
36
34
  }
37
35
  };
@@ -19,14 +19,26 @@ const horizontalAnchorOverlay = {
19
19
  *
20
20
  * @public
21
21
  */
22
- export const FlyoutPosTop = Object.assign(Object.assign({}, horizontalAnchorOverlay), { verticalDefaultPosition: "top", verticalPositioningMode: "locktodefault", verticalInset: false, verticalScaling: "content" });
22
+ export const FlyoutPosTop = {
23
+ ...horizontalAnchorOverlay,
24
+ verticalDefaultPosition: "top",
25
+ verticalPositioningMode: "locktodefault",
26
+ verticalInset: false,
27
+ verticalScaling: "content",
28
+ };
23
29
  /**
24
30
  * A region that always places itself below the anchor, has
25
31
  * a width to match the anchor, and is sized vertically by content
26
32
  *
27
33
  * @public
28
34
  */
29
- export const FlyoutPosBottom = Object.assign(Object.assign({}, horizontalAnchorOverlay), { verticalDefaultPosition: "bottom", verticalPositioningMode: "locktodefault", verticalInset: false, verticalScaling: "content" });
35
+ export const FlyoutPosBottom = {
36
+ ...horizontalAnchorOverlay,
37
+ verticalDefaultPosition: "bottom",
38
+ verticalPositioningMode: "locktodefault",
39
+ verticalInset: false,
40
+ verticalScaling: "content",
41
+ };
30
42
  /**
31
43
  * A region that places itself above or below the anchor
32
44
  * based on available space, has a width to match the anchor,
@@ -34,21 +46,32 @@ export const FlyoutPosBottom = Object.assign(Object.assign({}, horizontalAnchorO
34
46
  *
35
47
  * @public
36
48
  */
37
- export const FlyoutPosTallest = Object.assign(Object.assign({}, horizontalAnchorOverlay), { verticalPositioningMode: "dynamic", verticalInset: false, verticalScaling: "content" });
49
+ export const FlyoutPosTallest = {
50
+ ...horizontalAnchorOverlay,
51
+ verticalPositioningMode: "dynamic",
52
+ verticalInset: false,
53
+ verticalScaling: "content",
54
+ };
38
55
  /**
39
56
  * A region that always places itself above the anchor, has
40
57
  * a width to match the anchor, and is sized vertically by available space
41
58
  *
42
59
  * @public
43
60
  */
44
- export const FlyoutPosTopFill = Object.assign(Object.assign({}, FlyoutPosTop), { verticalScaling: "fill" });
61
+ export const FlyoutPosTopFill = {
62
+ ...FlyoutPosTop,
63
+ verticalScaling: "fill",
64
+ };
45
65
  /**
46
66
  * A region that always places itself below the anchor, has
47
67
  * a width to match the anchor, and is sized vertically by available space
48
68
  *
49
69
  * @public
50
70
  */
51
- export const FlyoutPosBottomFill = Object.assign(Object.assign({}, FlyoutPosBottom), { verticalScaling: "fill" });
71
+ export const FlyoutPosBottomFill = {
72
+ ...FlyoutPosBottom,
73
+ verticalScaling: "fill",
74
+ };
52
75
  /**
53
76
  * A region that places itself above or below the anchor
54
77
  * based on available space, has a width to match the anchor,
@@ -56,4 +79,7 @@ export const FlyoutPosBottomFill = Object.assign(Object.assign({}, FlyoutPosBott
56
79
  *
57
80
  * @public
58
81
  */
59
- export const FlyoutPosTallestFill = Object.assign(Object.assign({}, FlyoutPosTallest), { verticalScaling: "fill" });
82
+ export const FlyoutPosTallestFill = {
83
+ ...FlyoutPosTallest,
84
+ verticalScaling: "fill",
85
+ };
@@ -807,6 +807,7 @@ export class AnchoredRegion extends FoundationElement {
807
807
  this.initialize();
808
808
  }
809
809
  }
810
+ static { this.intersectionService = new IntersectionService(); }
810
811
  /**
811
812
  * @internal
812
813
  */
@@ -904,7 +905,6 @@ export class AnchoredRegion extends FoundationElement {
904
905
  this.updateRegionStyle();
905
906
  }
906
907
  }
907
- AnchoredRegion.intersectionService = new IntersectionService();
908
908
  __decorate([
909
909
  attr
910
910
  ], AnchoredRegion.prototype, "anchor", void 0);
@@ -34,12 +34,11 @@ export class Breadcrumb extends FoundationElement {
34
34
  * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
35
35
  */
36
36
  findChildWithHref(node) {
37
- var _a, _b;
38
37
  if (node.childElementCount > 0) {
39
38
  return node.querySelector("a[href]");
40
39
  }
41
- else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
42
- return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
40
+ else if (node.shadowRoot?.childElementCount) {
41
+ return node.shadowRoot?.querySelector("a[href]");
43
42
  }
44
43
  else
45
44
  return null;
@@ -23,8 +23,7 @@ export class Button extends FormAssociatedButton {
23
23
  * @internal
24
24
  */
25
25
  this.handleClick = (e) => {
26
- var _a;
27
- if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) {
26
+ if (this.disabled && this.defaultSlottedContent?.length <= 1) {
28
27
  e.stopPropagation();
29
28
  }
30
29
  };
@@ -55,8 +54,7 @@ export class Button extends FormAssociatedButton {
55
54
  * Resets the parent form
56
55
  */
57
56
  this.handleFormReset = () => {
58
- var _a;
59
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
57
+ this.form?.reset();
60
58
  };
61
59
  /**
62
60
  * Overrides the focus call for where delegatesFocus is unsupported.
@@ -64,11 +62,10 @@ export class Button extends FormAssociatedButton {
64
62
  * Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
65
63
  */
66
64
  this.handleUnsupportedDelegatesFocus = () => {
67
- var _a;
68
65
  // Check to see if delegatesFocus is supported
69
66
  if (window.ShadowRoot &&
70
67
  !window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
71
- ((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
68
+ this.$fastController.definition.shadowOptions?.delegatesFocus) {
72
69
  this.focus = () => {
73
70
  this.control.focus();
74
71
  };
@@ -121,11 +118,10 @@ export class Button extends FormAssociatedButton {
121
118
  * @internal
122
119
  */
123
120
  connectedCallback() {
124
- var _a;
125
121
  super.connectedCallback();
126
122
  this.proxy.setAttribute("type", this.type);
127
123
  this.handleUnsupportedDelegatesFocus();
128
- const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
124
+ const elements = Array.from(this.control?.children);
129
125
  if (elements) {
130
126
  elements.forEach((span) => {
131
127
  span.addEventListener("click", this.handleClick);
@@ -136,9 +132,8 @@ export class Button extends FormAssociatedButton {
136
132
  * @internal
137
133
  */
138
134
  disconnectedCallback() {
139
- var _a;
140
135
  super.disconnectedCallback();
141
- const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
136
+ const elements = Array.from(this.control?.children);
142
137
  if (elements) {
143
138
  elements.forEach((span) => {
144
139
  span.removeEventListener("click", this.handleClick);
@@ -174,7 +174,6 @@ export const noninteractiveCalendarTemplate = (todayString) => {
174
174
  * @public
175
175
  */
176
176
  export const calendarTemplate = (context, definition) => {
177
- var _a;
178
177
  const today = new Date();
179
178
  const todayString = `${today.getMonth() + 1}-${today.getDate()}-${today.getFullYear()}`;
180
179
  return html `
@@ -182,7 +181,7 @@ export const calendarTemplate = (context, definition) => {
182
181
  ${startTemplate}
183
182
  ${definition.title instanceof Function
184
183
  ? definition.title(context, definition)
185
- : (_a = definition.title) !== null && _a !== void 0 ? _a : ""}
184
+ : definition.title ?? ""}
186
185
  <slot></slot>
187
186
  ${when(x => x.readonly, noninteractiveCalendarTemplate(todayString), interactiveCalendarGridTemplate(context, todayString))}
188
187
  ${endTemplate}
@@ -81,7 +81,10 @@ export class DateFormatter {
81
81
  if (!dateObj.getTime()) {
82
82
  return "";
83
83
  }
84
- const optionsWithTimeZone = Object.assign({ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }, format);
84
+ const optionsWithTimeZone = {
85
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
86
+ ...format,
87
+ };
85
88
  return new Intl.DateTimeFormat(locale, optionsWithTimeZone).format(dateObj);
86
89
  }
87
90
  /**
@@ -154,17 +154,16 @@ export class Combobox extends FormAssociatedCombobox {
154
154
  return this._value;
155
155
  }
156
156
  set value(next) {
157
- var _a, _b, _c;
158
157
  const prev = `${this._value}`;
159
158
  if (this.$fastController.isConnected && this.options) {
160
159
  const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
161
- const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
162
- const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
160
+ const prevSelectedValue = this.options[this.selectedIndex]?.text;
161
+ const nextSelectedValue = this.options[selectedIndex]?.text;
163
162
  this.selectedIndex =
164
163
  prevSelectedValue !== nextSelectedValue
165
164
  ? selectedIndex
166
165
  : this.selectedIndex;
167
- next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
166
+ next = this.firstSelectedOption?.text || next;
168
167
  }
169
168
  if (prev !== next) {
170
169
  this._value = next;
@@ -180,7 +179,7 @@ export class Combobox extends FormAssociatedCombobox {
180
179
  */
181
180
  clickHandler(e) {
182
181
  const captured = e.target.closest(`option,[role=option]`);
183
- if (this.disabled || (captured === null || captured === void 0 ? void 0 : captured.disabled)) {
182
+ if (this.disabled || captured?.disabled) {
184
183
  return;
185
184
  }
186
185
  if (this.open) {
@@ -253,8 +252,7 @@ export class Combobox extends FormAssociatedCombobox {
253
252
  this.control.focus();
254
253
  if (this.firstSelectedOption) {
255
254
  requestAnimationFrame(() => {
256
- var _a;
257
- (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
255
+ this.firstSelectedOption?.scrollIntoView({ block: "nearest" });
258
256
  });
259
257
  }
260
258
  }
@@ -473,8 +471,7 @@ export class Combobox extends FormAssociatedCombobox {
473
471
  * @internal
474
472
  */
475
473
  syncValue() {
476
- var _a;
477
- const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
474
+ const newValue = this.selectedIndex > -1 ? this.firstSelectedOption?.text : this.control.value;
478
475
  this.updateValue(this.value !== newValue);
479
476
  }
480
477
  /**
@@ -535,9 +532,8 @@ export class Combobox extends FormAssociatedCombobox {
535
532
  * @internal
536
533
  */
537
534
  updateValue(shouldEmit) {
538
- var _a;
539
535
  if (this.$fastController.isConnected) {
540
- this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
536
+ this.value = this.firstSelectedOption?.text || this.control.value;
541
537
  this.control.value = this.value;
542
538
  }
543
539
  if (shouldEmit) {
@@ -77,12 +77,11 @@ export class DataGridCell extends FoundationElement {
77
77
  * @internal
78
78
  */
79
79
  connectedCallback() {
80
- var _a;
81
80
  super.connectedCallback();
82
81
  this.addEventListener(eventFocusIn, this.handleFocusin);
83
82
  this.addEventListener(eventFocusOut, this.handleFocusout);
84
83
  this.addEventListener(eventKeyDown, this.handleKeydown);
85
- this.style.gridColumn = `${((_a = this.columnDefinition) === null || _a === void 0 ? void 0 : _a.gridColumn) === undefined
84
+ this.style.gridColumn = `${this.columnDefinition?.gridColumn === undefined
86
85
  ? 0
87
86
  : this.columnDefinition.gridColumn}`;
88
87
  this.updateCellView();
@@ -11,6 +11,17 @@ export { DataGridRowTypes, GenerateHeaderOptions };
11
11
  * @public
12
12
  */
13
13
  export class DataGrid extends FoundationElement {
14
+ /**
15
+ * generates a basic column definition by examining sample row data
16
+ */
17
+ static { this.generateColumns = (row) => {
18
+ return Object.getOwnPropertyNames(row).map((property, index) => {
19
+ return {
20
+ columnDataKey: property,
21
+ gridColumn: `${index}`,
22
+ };
23
+ });
24
+ }; }
14
25
  /**
15
26
  * generates a gridTemplateColumns based on columndata array
16
27
  */
@@ -388,17 +399,6 @@ export class DataGrid extends FoundationElement {
388
399
  }
389
400
  }
390
401
  }
391
- /**
392
- * generates a basic column definition by examining sample row data
393
- */
394
- DataGrid.generateColumns = (row) => {
395
- return Object.getOwnPropertyNames(row).map((property, index) => {
396
- return {
397
- columnDataKey: property,
398
- gridColumn: `${index}`,
399
- };
400
- });
401
- };
402
402
  __decorate([
403
403
  attr({ attribute: "no-tabbing", mode: "boolean" })
404
404
  ], DataGrid.prototype, "noTabbing", void 0);
@@ -198,7 +198,10 @@ class ElementDefinitionEntry {
198
198
  ComponentPresentation.define(this.name, presentation, this.container);
199
199
  }
200
200
  defineElement(definition) {
201
- this.definition = new FASTElementDefinition(this.type, Object.assign(Object.assign({}, definition), { name: this.name }));
201
+ this.definition = new FASTElementDefinition(this.type, {
202
+ ...definition,
203
+ name: this.name,
204
+ });
202
205
  }
203
206
  tagFor(type) {
204
207
  return DesignSystem.tagFor(type);
@@ -134,6 +134,8 @@ class ElementStyleSheetTarget {
134
134
  * @internal
135
135
  */
136
136
  export class RootStyleSheetTarget {
137
+ static { this.roots = new Set(); }
138
+ static { this.properties = {}; }
137
139
  setProperty(name, value) {
138
140
  RootStyleSheetTarget.properties[name] = value;
139
141
  for (const target of RootStyleSheetTarget.roots.values()) {
@@ -175,8 +177,6 @@ export class RootStyleSheetTarget {
175
177
  return root === defaultElement ? document : root;
176
178
  }
177
179
  }
178
- RootStyleSheetTarget.roots = new Set();
179
- RootStyleSheetTarget.properties = {};
180
180
  // Caches PropertyTarget instances
181
181
  const propertyTargetCache = new WeakMap();
182
182
  // Use Constructable StyleSheets for FAST elements when supported, otherwise use
@@ -27,6 +27,13 @@ class DesignTokenImpl extends CSSDirective {
27
27
  static isDerivedDesignTokenValue(value) {
28
28
  return typeof value === "function";
29
29
  }
30
+ static { this.uniqueId = (() => {
31
+ let id = 0;
32
+ return () => {
33
+ id++;
34
+ return id.toString(16);
35
+ };
36
+ })(); }
30
37
  /**
31
38
  * Gets a token by ID. Returns undefined if the token was not found.
32
39
  * @param id - The ID of the token
@@ -35,6 +42,10 @@ class DesignTokenImpl extends CSSDirective {
35
42
  static getTokenById(id) {
36
43
  return DesignTokenImpl.tokensById.get(id);
37
44
  }
45
+ /**
46
+ * Token storage by token ID
47
+ */
48
+ static { this.tokensById = new Map(); }
38
49
  getOrCreateSubscriberSet(target = this) {
39
50
  return (this.subscribers.get(target) ||
40
51
  (this.subscribers.set(target, new Set()) && this.subscribers.get(target)));
@@ -116,17 +127,6 @@ class DesignTokenImpl extends CSSDirective {
116
127
  return ((target) => token.getValueFor(target));
117
128
  }
118
129
  }
119
- DesignTokenImpl.uniqueId = (() => {
120
- let id = 0;
121
- return () => {
122
- id++;
123
- return id.toString(16);
124
- };
125
- })();
126
- /**
127
- * Token storage by token ID
128
- */
129
- DesignTokenImpl.tokensById = new Map();
130
130
  class CustomPropertyReflector {
131
131
  startReflection(token, target) {
132
132
  token.subscribe(this, target);
@@ -273,6 +273,10 @@ class DesignTokenNode {
273
273
  } while (current !== null);
274
274
  return null;
275
275
  }
276
+ /**
277
+ * Responsible for reflecting tokens to CSS custom properties
278
+ */
279
+ static { this.cssCustomPropertyReflector = new CustomPropertyReflector(); }
276
280
  /**
277
281
  * The parent DesignTokenNode, or null.
278
282
  */
@@ -373,11 +377,10 @@ class DesignTokenNode {
373
377
  * @returns
374
378
  */
375
379
  getRaw(token) {
376
- var _a;
377
380
  if (this.assignedValues.has(token)) {
378
381
  return this.assignedValues.get(token);
379
382
  }
380
- return (_a = DesignTokenNode.findClosestAssignedNode(token, this)) === null || _a === void 0 ? void 0 : _a.getRaw(token);
383
+ return DesignTokenNode.findClosestAssignedNode(token, this)?.getRaw(token);
381
384
  }
382
385
  /**
383
386
  * Sets a token to a value for a node
@@ -578,10 +581,6 @@ class DesignTokenNode {
578
581
  return false;
579
582
  }
580
583
  }
581
- /**
582
- * Responsible for reflecting tokens to CSS custom properties
583
- */
584
- DesignTokenNode.cssCustomPropertyReflector = new CustomPropertyReflector();
585
584
  __decorate([
586
585
  observable
587
586
  ], DesignTokenNode.prototype, "children", void 0);
package/dist/esm/di/di.js CHANGED
@@ -414,7 +414,7 @@ export const DI = Object.freeze({
414
414
  Interface.friendlyName = friendlyName == null ? "(anonymous)" : friendlyName;
415
415
  if (configure != null) {
416
416
  Interface.register = function (container, key) {
417
- return configure(new ResolverBuilder(container, key !== null && key !== void 0 ? key : Interface));
417
+ return configure(new ResolverBuilder(container, key ?? Interface));
418
418
  };
419
419
  }
420
420
  Interface.toString = function toString() {
@@ -758,13 +758,12 @@ export class ResolverImpl {
758
758
  }
759
759
  }
760
760
  getFactory(container) {
761
- var _a, _b, _c;
762
761
  switch (this.strategy) {
763
762
  case 1 /* ResolverStrategy.singleton */:
764
763
  case 2 /* ResolverStrategy.transient */:
765
764
  return container.getFactory(this.state);
766
765
  case 5 /* ResolverStrategy.alias */:
767
- return (_c = (_b = (_a = container.getResolver(this.state)) === null || _a === void 0 ? void 0 : _a.getFactory) === null || _b === void 0 ? void 0 : _b.call(_a, container)) !== null && _c !== void 0 ? _c : null;
766
+ return container.getResolver(this.state)?.getFactory?.(container) ?? null;
768
767
  default:
769
768
  return null;
770
769
  }
@@ -243,8 +243,7 @@ export class Dialog extends FoundationElement {
243
243
  * @internal
244
244
  */
245
245
  static isFocusableFastElement(element) {
246
- var _a, _b;
247
- return !!((_b = (_a = element.$fastController) === null || _a === void 0 ? void 0 : _a.definition.shadowOptions) === null || _b === void 0 ? void 0 : _b.delegatesFocus);
246
+ return !!element.$fastController?.definition.shadowOptions?.delegatesFocus;
248
247
  }
249
248
  /**
250
249
  * Test if the element has a focusable shadow
@@ -254,8 +253,7 @@ export class Dialog extends FoundationElement {
254
253
  * @internal
255
254
  */
256
255
  static hasTabbableShadow(element) {
257
- var _a, _b;
258
- return Array.from((_b = (_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("*")) !== null && _b !== void 0 ? _b : []).some(x => {
256
+ return Array.from(element.shadowRoot?.querySelectorAll("*") ?? []).some(x => {
259
257
  return isTabbable(x);
260
258
  });
261
259
  }
@@ -5,6 +5,7 @@ const observer = new MutationObserver((mutations) => {
5
5
  }
6
6
  });
7
7
  class AttributeReflectionSubscriptionSet extends SubscriberSet {
8
+ static { this.subscriberCache = new WeakMap(); }
8
9
  subscribe(subscriber) {
9
10
  super.subscribe(subscriber);
10
11
  if (!this.watchedAttributes.has(subscriber.attributes)) {
@@ -38,7 +39,6 @@ class AttributeReflectionSubscriptionSet extends SubscriberSet {
38
39
  observer.observe(this.source, { attributeFilter });
39
40
  }
40
41
  }
41
- AttributeReflectionSubscriptionSet.subscriberCache = new WeakMap();
42
42
  class ReflectAttrBehavior {
43
43
  constructor(target, attributes) {
44
44
  this.target = target;
@@ -301,7 +301,6 @@ export function FormAssociated(BaseCtor) {
301
301
  * Attach the proxy element to the DOM
302
302
  */
303
303
  attachProxy() {
304
- var _a;
305
304
  if (!this.proxyInitialized) {
306
305
  this.proxyInitialized = true;
307
306
  this.proxy.style.display = "none";
@@ -322,16 +321,15 @@ export function FormAssociated(BaseCtor) {
322
321
  this.proxySlot = document.createElement("slot");
323
322
  this.proxySlot.setAttribute("name", proxySlotName);
324
323
  }
325
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(this.proxySlot);
324
+ this.shadowRoot?.appendChild(this.proxySlot);
326
325
  this.appendChild(this.proxy);
327
326
  }
328
327
  /**
329
328
  * Detach the proxy element from the DOM
330
329
  */
331
330
  detachProxy() {
332
- var _a;
333
331
  this.removeChild(this.proxy);
334
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.proxySlot);
332
+ this.shadowRoot?.removeChild(this.proxySlot);
335
333
  }
336
334
  /** {@inheritDoc (FormAssociated:interface).validate} */
337
335
  validate(anchor) {
@@ -355,7 +353,7 @@ export function FormAssociated(BaseCtor) {
355
353
  if (this.form instanceof HTMLFormElement) {
356
354
  // Implicit submission
357
355
  const defaultButton = this.form.querySelector("[type=submit]");
358
- defaultButton === null || defaultButton === void 0 ? void 0 : defaultButton.click();
356
+ defaultButton?.click();
359
357
  }
360
358
  break;
361
359
  }
@@ -84,7 +84,10 @@ export class FoundationElementRegistry {
84
84
  this.type = type;
85
85
  this.elementDefinition = elementDefinition;
86
86
  this.overrideDefinition = overrideDefinition;
87
- this.definition = Object.assign(Object.assign({}, this.elementDefinition), this.overrideDefinition);
87
+ this.definition = {
88
+ ...this.elementDefinition,
89
+ ...this.overrideDefinition,
90
+ };
88
91
  }
89
92
  register(container, context) {
90
93
  const definition = this.definition;
@@ -197,12 +197,11 @@ export class HorizontalScroll extends FoundationElement {
197
197
  * @internal
198
198
  */
199
199
  setFlippers() {
200
- var _a, _b;
201
200
  const position = this.scrollContainer.scrollLeft;
202
- (_a = this.previousFlipperContainer) === null || _a === void 0 ? void 0 : _a.classList.toggle("disabled", position === 0);
201
+ this.previousFlipperContainer?.classList.toggle("disabled", position === 0);
203
202
  if (this.scrollStops) {
204
203
  const lastStop = Math.abs(this.scrollStops[this.scrollStops.length - 1]);
205
- (_b = this.nextFlipperContainer) === null || _b === void 0 ? void 0 : _b.classList.toggle("disabled", this.validateStops(false) && Math.abs(position) + this.width >= lastStop);
204
+ this.nextFlipperContainer?.classList.toggle("disabled", this.validateStops(false) && Math.abs(position) + this.width >= lastStop);
206
205
  }
207
206
  }
208
207
  /**
@@ -214,12 +213,11 @@ export class HorizontalScroll extends FoundationElement {
214
213
  * @public
215
214
  */
216
215
  scrollInView(item, padding = 0, rightPadding) {
217
- var _a;
218
216
  if (typeof item !== "number" && item) {
219
217
  item = this.scrollItems.findIndex(scrollItem => scrollItem === item || scrollItem.contains(item));
220
218
  }
221
219
  if (item !== undefined) {
222
- rightPadding = rightPadding !== null && rightPadding !== void 0 ? rightPadding : padding;
220
+ rightPadding = rightPadding ?? padding;
223
221
  const { scrollContainer: container, scrollStops, scrollItems: items } = this;
224
222
  const { scrollLeft } = this.scrollContainer;
225
223
  const { width: containerWidth } = container.getBoundingClientRect();
@@ -229,9 +227,9 @@ export class HorizontalScroll extends FoundationElement {
229
227
  const isBefore = scrollLeft + padding > itemStart;
230
228
  if (isBefore || scrollLeft + containerWidth - rightPadding < itemEnd) {
231
229
  const stops = [...scrollStops].sort((a, b) => (isBefore ? b - a : a - b));
232
- const scrollTo = (_a = stops.find(position => isBefore
230
+ const scrollTo = stops.find(position => isBefore
233
231
  ? position + padding < itemStart
234
- : position + containerWidth - (rightPadding !== null && rightPadding !== void 0 ? rightPadding : 0) > itemEnd)) !== null && _a !== void 0 ? _a : 0;
232
+ : position + containerWidth - (rightPadding ?? 0) > itemEnd) ?? 0;
235
233
  this.scrollToPosition(scrollTo);
236
234
  }
237
235
  }
@@ -295,12 +293,11 @@ export class HorizontalScroll extends FoundationElement {
295
293
  * @public
296
294
  */
297
295
  scrollToPosition(newPosition, position = this.scrollContainer.scrollLeft) {
298
- var _a;
299
296
  if (this.scrolling) {
300
297
  return;
301
298
  }
302
299
  this.scrolling = true;
303
- const seconds = (_a = this.duration) !== null && _a !== void 0 ? _a : `${Math.abs(newPosition - position) / this.speed}s`;
300
+ const seconds = this.duration ?? `${Math.abs(newPosition - position) / this.speed}s`;
304
301
  this.content.style.setProperty("transition-duration", seconds);
305
302
  const computedDuration = parseFloat(getComputedStyle(this.content).getPropertyValue("transition-duration"));
306
303
  const transitionendHandler = (e) => {