@genesislcap/foundation-utils 15.6.0 → 15.6.1-ts7-migration.1

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 (45) hide show
  1. package/dist/custom-elements.json +758 -758
  2. package/dist/dts/data/inMemoryDatabase.d.ts.map +1 -1
  3. package/dist/dts/encoding/base64/decode.d.ts.map +1 -1
  4. package/dist/dts/encoding/base64/encode.d.ts.map +1 -1
  5. package/dist/dts/error/errorMap.d.ts.map +1 -1
  6. package/dist/dts/feature-flags/featureFlags.d.ts.map +1 -1
  7. package/dist/dts/formatters/datetime.d.ts.map +1 -1
  8. package/dist/dts/formatters/localeNumberParser.d.ts.map +1 -1
  9. package/dist/dts/formatters/number.d.ts.map +1 -1
  10. package/dist/dts/inactivity/inactivity-dialog.d.ts.map +1 -1
  11. package/dist/dts/inactivity/inactivity-manager.d.ts.map +1 -1
  12. package/dist/dts/inactivity/inactivity-service.d.ts.map +1 -1
  13. package/dist/dts/mappers/dto/serverRow.d.ts.map +1 -1
  14. package/dist/dts/mappers/genesis-json-schema/types.d.ts +1 -1
  15. package/dist/dts/mappers/genesis-json-schema/types.d.ts.map +1 -1
  16. package/dist/dts/mixins/lifecycle/lifecycle.d.ts +16 -434
  17. package/dist/dts/mixins/lifecycle/lifecycle.d.ts.map +1 -1
  18. package/dist/dts/mixins/pendingState/pendingState.d.ts +165 -159
  19. package/dist/dts/mixins/pendingState/pendingState.d.ts.map +1 -1
  20. package/dist/dts/observer/observer.d.ts.map +1 -1
  21. package/dist/dts/promise/resolveAfter.d.ts.map +1 -1
  22. package/dist/dts/resource/types.d.ts +2 -2
  23. package/dist/dts/resource/types.d.ts.map +1 -1
  24. package/dist/dts/route/route.d.ts.map +1 -1
  25. package/dist/dts/serializers/json/json.d.ts.map +1 -1
  26. package/dist/dts/serializers/json/types.d.ts.map +1 -1
  27. package/dist/dts/shortcut-manager/shortcut-listener.d.ts.map +1 -1
  28. package/dist/dts/shortcut-manager/shortcut-manager.d.ts.map +1 -1
  29. package/dist/dts/styles/slotted-styles.d.ts.map +1 -1
  30. package/dist/dts/styles/typography.d.ts.map +1 -1
  31. package/dist/dts/tsdoc-metadata.json +1 -1
  32. package/dist/dts/utils/deepMerge.d.ts.map +1 -1
  33. package/dist/dts/utils/delay.d.ts.map +1 -1
  34. package/dist/dts/utils/dom.d.ts.map +1 -1
  35. package/dist/dts/utils/noop.d.ts.map +1 -1
  36. package/dist/dts/utils/os-platform.d.ts.map +1 -1
  37. package/dist/dts/window/window.d.ts.map +1 -1
  38. package/dist/esm/mappers/dto/serverRow.js +12 -18
  39. package/dist/esm/mappers/genesis-json-schema/index.js +5 -4
  40. package/dist/esm/mixins/lifecycle/lifecycle.js +52 -55
  41. package/dist/esm/shortcut-manager/shortcut-listener.js +6 -4
  42. package/dist/esm/shortcut-manager/shortcut-manager.js +4 -7
  43. package/dist/foundation-utils.api.json +1007 -4179
  44. package/dist/foundation-utils.d.ts +398 -810
  45. package/package.json +13 -12
@@ -8,25 +8,29 @@ const CLEANUP_TIMEOUT_MS = 10000;
8
8
  * @remarks These can be used to control what lifecycle functionality is ran when the elements
9
9
  * are part of a custom layout. The class itself handles all events
10
10
  * @privateRemarks
11
- * #_ syntax is used for a javascript private method/variable
12
- * we can't use private/protected from typescript in an anonymous class like this
11
+ * #_ syntax is used for a javascript private method/variable.
12
+ * The return type is annotated explicitly (rather than inferred) because TypeScript's
13
+ * declaration emit can't represent private members of an anonymous mixin class - the
14
+ * annotation limits the emitted public surface to {@link LifecycleMixinInstance}.
13
15
  */
14
- export const LifecycleMixin = (Base) => { var _instances, __container, __latestTokenCode, __hasFirstLoaded, __cleanupTimeout, __shouldForceLifecycle, __blockedDisconnectSurvivedGracePeriod, __blockLifecycleDueToTokenChange, __tryFindContainingLayout, _a; return _a = class extends Base {
16
+ export const LifecycleMixin = (Base) => {
17
+ var _Mixin_instances, _Mixin__container, _Mixin__latestTokenCode, _Mixin__hasFirstLoaded, _Mixin__cleanupTimeout, _Mixin__shouldForceLifecycle, _Mixin__blockedDisconnectSurvivedGracePeriod, _Mixin__blockLifecycleDueToTokenChange, _Mixin__tryFindContainingLayout;
18
+ class Mixin extends Base {
15
19
  constructor(...args) {
16
20
  super(args);
17
- _instances.add(this);
21
+ _Mixin_instances.add(this);
18
22
  /** @internal **/
19
- __container.set(this, { _key: 'dom' });
23
+ _Mixin__container.set(this, { _key: 'dom' });
20
24
  /**
21
25
  * If the token changes we suggest blocking the lifecycle methods
22
26
  * @internal
23
27
  **/
24
- __latestTokenCode.set(this, '');
28
+ _Mixin__latestTokenCode.set(this, '');
25
29
  /**
26
30
  * Track first loaded to allow us to always run the connect lifecycle on the first load
27
31
  * @internal
28
32
  **/
29
- __hasFirstLoaded.set(this, false);
33
+ _Mixin__hasFirstLoaded.set(this, false);
30
34
  /**
31
35
  * When you request to delete an item from the layout it will be removed from the DOM,
32
36
  * but the lifecycle might be blocked due to the same mechanism that we block the other
@@ -35,13 +39,13 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
35
39
  * if this item hasn't reconnected within `CLEANUP_TIMEOUT_MS`.
36
40
  * @internal
37
41
  **/
38
- __cleanupTimeout.set(this, void 0);
42
+ _Mixin__cleanupTimeout.set(this, void 0);
39
43
  /**
40
44
  * Used to force lifecycle to run even if the token has changed, such as in instances where
41
45
  * we are forcing a disconnection due to this item being remove from the layout.
42
46
  * @internal
43
47
  **/
44
- __shouldForceLifecycle.set(this, false);
48
+ _Mixin__shouldForceLifecycle.set(this, false);
45
49
  /**
46
50
  * Set once a short grace period (`setTimeout`) has elapsed since a blocked ('reflow')
47
51
  * disconnect. Some consumers run defensive cleanup after the block via schedulers that can
@@ -50,7 +54,7 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
50
54
  * never re-initializes.
51
55
  * @internal
52
56
  **/
53
- __blockedDisconnectSurvivedGracePeriod.set(this, false);
57
+ _Mixin__blockedDisconnectSurvivedGracePeriod.set(this, false);
54
58
  }
55
59
  /**
56
60
  * @privateRemarks
@@ -84,19 +88,19 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
84
88
  * @returns - boolean controlling whether to run all disconnectedCallback lifecycle functionality
85
89
  */
86
90
  get shouldRunDisconnect() {
87
- if (__classPrivateFieldGet(this, __shouldForceLifecycle, "f")) {
91
+ if (__classPrivateFieldGet(this, _Mixin__shouldForceLifecycle, "f")) {
88
92
  return true;
89
93
  }
90
- if (__classPrivateFieldGet(this, __container, "f")._key === 'dom') {
94
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key === 'dom') {
91
95
  return true;
92
96
  }
93
- if (__classPrivateFieldGet(this, __container, "f")._key === 'foundation-layout-cache') {
97
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key === 'foundation-layout-cache') {
94
98
  return false;
95
99
  }
96
100
  // _key === 'foundation-layout'
97
- return !(__classPrivateFieldGet(this, __container, "f").dragging ||
98
- !__classPrivateFieldGet(this, __container, "f").hasFirstLoaded ||
99
- __classPrivateFieldGet(this, _instances, "m", __blockLifecycleDueToTokenChange).call(this, 'disconnect'));
101
+ return !(__classPrivateFieldGet(this, _Mixin__container, "f").dragging ||
102
+ !__classPrivateFieldGet(this, _Mixin__container, "f").hasFirstLoaded ||
103
+ __classPrivateFieldGet(this, _Mixin_instances, "m", _Mixin__blockLifecycleDueToTokenChange).call(this, 'disconnect'));
100
104
  }
101
105
  /**
102
106
  * @beta
@@ -105,81 +109,73 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
105
109
  * For now its just the same logic as shouldRunDisconnect
106
110
  */
107
111
  get shouldRunConnect() {
108
- if (__classPrivateFieldGet(this, __shouldForceLifecycle, "f")) {
112
+ if (__classPrivateFieldGet(this, _Mixin__shouldForceLifecycle, "f")) {
109
113
  return true;
110
114
  }
111
- if (__classPrivateFieldGet(this, __container, "f")._key === 'dom') {
115
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key === 'dom') {
112
116
  return true;
113
117
  }
114
- if (__classPrivateFieldGet(this, __container, "f")._key === 'foundation-layout-cache') {
118
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key === 'foundation-layout-cache') {
115
119
  return false;
116
120
  }
117
121
  // _key === 'foundation-layout'
118
122
  let connectionType = 'reconnect';
119
- if (__classPrivateFieldGet(this, __hasFirstLoaded, "f") === false) {
120
- __classPrivateFieldSet(this, __hasFirstLoaded, true, "f");
123
+ if (__classPrivateFieldGet(this, _Mixin__hasFirstLoaded, "f") === false) {
124
+ __classPrivateFieldSet(this, _Mixin__hasFirstLoaded, true, "f");
121
125
  connectionType = 'connect';
122
126
  }
123
- return !(__classPrivateFieldGet(this, __container, "f").dragging ||
124
- !__classPrivateFieldGet(this, __container, "f").hasFirstLoaded ||
125
- __classPrivateFieldGet(this, _instances, "m", __blockLifecycleDueToTokenChange).call(this, connectionType));
127
+ return !(__classPrivateFieldGet(this, _Mixin__container, "f").dragging ||
128
+ !__classPrivateFieldGet(this, _Mixin__container, "f").hasFirstLoaded ||
129
+ __classPrivateFieldGet(this, _Mixin_instances, "m", _Mixin__blockLifecycleDueToTokenChange).call(this, connectionType));
126
130
  }
127
131
  connectedCallback() {
128
132
  super.connectedCallback();
129
- if (__classPrivateFieldGet(this, __container, "f")._key !== 'foundation-layout') {
130
- __classPrivateFieldSet(this, __container, __classPrivateFieldGet(this, _instances, "m", __tryFindContainingLayout).call(this, this), "f");
133
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key !== 'foundation-layout') {
134
+ __classPrivateFieldSet(this, _Mixin__container, __classPrivateFieldGet(this, _Mixin_instances, "m", _Mixin__tryFindContainingLayout).call(this, this), "f");
131
135
  }
132
136
  }
133
- },
134
- __container = new WeakMap(),
135
- __latestTokenCode = new WeakMap(),
136
- __hasFirstLoaded = new WeakMap(),
137
- __cleanupTimeout = new WeakMap(),
138
- __shouldForceLifecycle = new WeakMap(),
139
- __blockedDisconnectSurvivedGracePeriod = new WeakMap(),
140
- _instances = new WeakSet(),
141
- __blockLifecycleDueToTokenChange = function __blockLifecycleDueToTokenChange(lifecycleType) {
142
- var _b, _c;
143
- if (__classPrivateFieldGet(this, __container, "f")._key !== 'foundation-layout') {
137
+ }
138
+ _Mixin__container = new WeakMap(), _Mixin__latestTokenCode = new WeakMap(), _Mixin__hasFirstLoaded = new WeakMap(), _Mixin__cleanupTimeout = new WeakMap(), _Mixin__shouldForceLifecycle = new WeakMap(), _Mixin__blockedDisconnectSurvivedGracePeriod = new WeakMap(), _Mixin_instances = new WeakSet(), _Mixin__blockLifecycleDueToTokenChange = function _Mixin__blockLifecycleDueToTokenChange(lifecycleType) {
139
+ var _a, _b;
140
+ if (__classPrivateFieldGet(this, _Mixin__container, "f")._key !== 'foundation-layout') {
144
141
  throw new Error('LifecycleMixin: should not be checking a token change if container not in the layout');
145
142
  }
146
- const tokensDifferent = __classPrivateFieldGet(this, __latestTokenCode, "f") !== __classPrivateFieldGet(this, __container, "f").lifecycleUpdateToken;
143
+ const tokensDifferent = __classPrivateFieldGet(this, _Mixin__latestTokenCode, "f") !== __classPrivateFieldGet(this, _Mixin__container, "f").lifecycleUpdateToken;
147
144
  let result = false;
148
145
  if (lifecycleType === 'connect') {
149
146
  // We always want to allow a first connection in the layout
150
- __classPrivateFieldSet(this, __latestTokenCode, (_b = __classPrivateFieldGet(this, __container, "f").lifecycleUpdateToken) !== null && _b !== void 0 ? _b : '', "f");
147
+ __classPrivateFieldSet(this, _Mixin__latestTokenCode, (_a = __classPrivateFieldGet(this, _Mixin__container, "f").lifecycleUpdateToken) !== null && _a !== void 0 ? _a : '', "f");
151
148
  }
152
149
  else if (lifecycleType === 'disconnect') {
153
150
  result = tokensDifferent;
154
151
  if (!result) {
155
152
  // Real disconnect: reset so the next connect is a fresh 'connect', not a token-gated
156
153
  // 'reconnect' - otherwise unrelated layout changes while disconnected can block it forever.
157
- __classPrivateFieldSet(this, __hasFirstLoaded, false, "f");
154
+ __classPrivateFieldSet(this, _Mixin__hasFirstLoaded, false, "f");
158
155
  }
159
156
  else {
160
157
  // Blocked disconnect: track whether a grace period elapses before the paired reconnect
161
158
  // arrives. See `#_blockedDisconnectSurvivedGracePeriod` for why this matters.
162
- __classPrivateFieldSet(this, __blockedDisconnectSurvivedGracePeriod, false, "f");
159
+ __classPrivateFieldSet(this, _Mixin__blockedDisconnectSurvivedGracePeriod, false, "f");
163
160
  setTimeout(() => {
164
- __classPrivateFieldSet(this, __blockedDisconnectSurvivedGracePeriod, true, "f");
161
+ __classPrivateFieldSet(this, _Mixin__blockedDisconnectSurvivedGracePeriod, true, "f");
165
162
  }, 0);
166
163
  }
167
- __classPrivateFieldSet(this, __cleanupTimeout, setTimeout(() => {
168
- __classPrivateFieldSet(this, __shouldForceLifecycle, result, "f");
169
- if (__classPrivateFieldGet(this, __shouldForceLifecycle, "f")) {
164
+ __classPrivateFieldSet(this, _Mixin__cleanupTimeout, setTimeout(() => {
165
+ __classPrivateFieldSet(this, _Mixin__shouldForceLifecycle, result, "f");
166
+ if (__classPrivateFieldGet(this, _Mixin__shouldForceLifecycle, "f")) {
170
167
  this.disconnectedCallback();
171
168
  }
172
169
  }, CLEANUP_TIMEOUT_MS), "f");
173
170
  }
174
171
  else if (lifecycleType === 'reconnect') {
175
- result = tokensDifferent && !__classPrivateFieldGet(this, __blockedDisconnectSurvivedGracePeriod, "f");
176
- __classPrivateFieldSet(this, __latestTokenCode, (_c = __classPrivateFieldGet(this, __container, "f").lifecycleUpdateToken) !== null && _c !== void 0 ? _c : '', "f");
177
- clearTimeout(__classPrivateFieldGet(this, __cleanupTimeout, "f"));
172
+ result = tokensDifferent && !__classPrivateFieldGet(this, _Mixin__blockedDisconnectSurvivedGracePeriod, "f");
173
+ __classPrivateFieldSet(this, _Mixin__latestTokenCode, (_b = __classPrivateFieldGet(this, _Mixin__container, "f").lifecycleUpdateToken) !== null && _b !== void 0 ? _b : '', "f");
174
+ clearTimeout(__classPrivateFieldGet(this, _Mixin__cleanupTimeout, "f"));
178
175
  }
179
176
  return result;
180
- },
181
- __tryFindContainingLayout = function __tryFindContainingLayout(e) {
182
- var _b;
177
+ }, _Mixin__tryFindContainingLayout = function _Mixin__tryFindContainingLayout(e) {
178
+ var _a;
183
179
  /**
184
180
  * This is a special case where the element is part of the layout cache
185
181
  * signified by a symbol put on the document cache root
@@ -192,7 +188,7 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
192
188
  * without finding a containing FoundationLayout
193
189
  * hence, this item is not in a custom layout
194
190
  */
195
- if (e.getRootNode() instanceof Document || !((_b = e.getRootNode()) === null || _b === void 0 ? void 0 : _b.host)) {
191
+ if (e.getRootNode() instanceof Document || !((_a = e.getRootNode()) === null || _a === void 0 ? void 0 : _a.host)) {
196
192
  return { _key: 'dom' };
197
193
  }
198
194
  const shadowHost = e.getRootNode().host;
@@ -201,9 +197,10 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
201
197
  layoutHost._key = 'foundation-layout';
202
198
  return layoutHost;
203
199
  }
204
- return __classPrivateFieldGet(this, _instances, "m", __tryFindContainingLayout).call(this, shadowHost);
205
- },
206
- _a; };
200
+ return __classPrivateFieldGet(this, _Mixin_instances, "m", _Mixin__tryFindContainingLayout).call(this, shadowHost);
201
+ };
202
+ return Mixin;
203
+ };
207
204
  /**
208
205
  * Stored on the layout's internal cache to signify that the document is not part of the DOM
209
206
  * @public
@@ -109,15 +109,17 @@ let FoundationShortcutListener = class FoundationShortcutListener extends FASTEl
109
109
  return specialKeyMap[code] || code.toLowerCase();
110
110
  }
111
111
  getDeepActiveElement() {
112
- var _a, _b;
113
- let active = (_a = document.activeElement) !== null && _a !== void 0 ? _a : null;
114
- while ((_b = active === null || active === void 0 ? void 0 : active.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement) {
112
+ var _a;
113
+ var _b;
114
+ let active = (_b = document.activeElement) !== null && _b !== void 0 ? _b : null;
115
+ while ((_a = active === null || active === void 0 ? void 0 : active.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) {
115
116
  active = active.shadowRoot.activeElement;
116
117
  }
117
118
  return active;
118
119
  }
119
120
  getEventElement(event) {
120
- var _a, _b, _c;
121
+ var _a;
122
+ var _b, _c;
121
123
  const path = (_b = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event)) !== null && _b !== void 0 ? _b : [];
122
124
  const fromPath = path.find((entry) => entry instanceof Element);
123
125
  return (_c = fromPath !== null && fromPath !== void 0 ? fromPath : event.target) !== null && _c !== void 0 ? _c : null;
@@ -325,13 +325,10 @@ export class DefaultShortcutManager {
325
325
  }
326
326
  configureBlockedMessages(config = {}) {
327
327
  var _a;
328
- const normalizeBlockedMessage = (message, fallback) => {
329
- var _a, _b, _c, _d;
330
- return ({
331
- title: (_b = (_a = message === null || message === void 0 ? void 0 : message.title) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : fallback.title,
332
- text: (_d = (_c = message === null || message === void 0 ? void 0 : message.text) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : fallback.text,
333
- });
334
- };
328
+ const normalizeBlockedMessage = (message, fallback) => { var _a, _b; var _c, _d; return ({
329
+ title: (_c = (_a = message === null || message === void 0 ? void 0 : message.title) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _c !== void 0 ? _c : fallback.title,
330
+ text: (_d = (_b = message === null || message === void 0 ? void 0 : message.text) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _d !== void 0 ? _d : fallback.text,
331
+ }); };
335
332
  this.blockedMessageConfig = {
336
333
  defaultMessage: normalizeBlockedMessage(config.defaultMessage, DEFAULT_SHORTCUT_BLOCKED_MESSAGE_CONFIG.defaultMessage),
337
334
  inputMessage: normalizeBlockedMessage(config.inputMessage, DEFAULT_SHORTCUT_BLOCKED_MESSAGE_CONFIG.inputMessage),