@arcgis/lumina 4.33.0-next.1 → 4.33.0-next.100

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 (53) hide show
  1. package/dist/Controller-CZ8Djohh.js +627 -0
  2. package/dist/LitElement.d.ts +36 -29
  3. package/dist/config.js +13 -6
  4. package/dist/context.d.ts +13 -3
  5. package/dist/controllers/Controller.d.ts +153 -0
  6. package/dist/controllers/ControllerInternals.d.ts +59 -0
  7. package/dist/controllers/ControllerManager.d.ts +83 -0
  8. package/dist/controllers/accessor/index.d.ts +2 -0
  9. package/dist/controllers/accessor/index.js +259 -0
  10. package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
  11. package/dist/controllers/accessor/useAccessor.d.ts +74 -0
  12. package/dist/controllers/functional.d.ts +19 -0
  13. package/dist/controllers/index.d.ts +24 -0
  14. package/dist/controllers/index.js +263 -0
  15. package/dist/controllers/load.d.ts +6 -0
  16. package/dist/controllers/proxyExports.d.ts +27 -0
  17. package/dist/controllers/tests/autoDestroyMock.d.ts +5 -0
  18. package/dist/controllers/tests/utils.d.ts +1 -0
  19. package/dist/controllers/toFunction.d.ts +8 -0
  20. package/dist/controllers/trackKey.d.ts +8 -0
  21. package/dist/controllers/trackPropKey.d.ts +21 -0
  22. package/dist/controllers/trackPropertyKey.d.ts +29 -0
  23. package/dist/controllers/types.d.ts +152 -0
  24. package/dist/controllers/useDirection.d.ts +11 -0
  25. package/dist/controllers/useMedia.d.ts +8 -0
  26. package/dist/controllers/usePropertyChange.d.ts +12 -0
  27. package/dist/controllers/useT9n.d.ts +48 -0
  28. package/dist/controllers/useWatchAttributes.d.ts +7 -0
  29. package/dist/controllers/utils.d.ts +15 -0
  30. package/dist/createEvent.d.ts +7 -2
  31. package/dist/decorators.d.ts +2 -2
  32. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +1 -1
  33. package/dist/hmrSupport.d.ts +1 -1
  34. package/dist/hmrSupport.js +1 -7
  35. package/dist/index.d.ts +17 -16
  36. package/dist/index.js +386 -150
  37. package/dist/jsx/baseTypes.d.ts +13 -9
  38. package/dist/jsx/directives.d.ts +25 -7
  39. package/dist/jsx/generatedTypes.d.ts +6 -10
  40. package/dist/jsx/types.d.ts +5 -32
  41. package/dist/lazyLoad.d.ts +18 -18
  42. package/dist/lifecycleSupport.d.ts +1 -1
  43. package/dist/makeRuntime.d.ts +109 -0
  44. package/dist/proxyExports-CK5BLFLO.js +60 -0
  45. package/dist/render.d.ts +5 -0
  46. package/dist/runtime.d.ts +4 -107
  47. package/dist/stencilSsrCompatibility/index.d.ts +2 -6
  48. package/dist/stencilSsrCompatibility/index.js +2 -3
  49. package/dist/typings/importMeta.d.ts +2 -2
  50. package/dist/{chunk-6HCCSL5F.js → utils-DBdf1Dqp.js} +67 -80
  51. package/package.json +4 -3
  52. package/dist/chunk-PGHUBTOM.js +0 -21
  53. package/dist/wrappersUtils.test.d.ts +0 -1
@@ -1,17 +1,9 @@
1
- import {
2
- lazyMetaGroupJoiner,
3
- lazyMetaItemJoiner,
4
- lazyMetaSubItemJoiner
5
- } from "./chunk-PGHUBTOM.js";
6
-
7
- // src/lazyLoad.ts
8
- import { Deferred, camelToKebab, isEsriInternalEnv } from "@arcgis/components-utils";
9
-
10
- // src/devOnlyDetectIncorrectLazyUsages.ts
1
+ import { Deferred, isEsriInternalEnv, camelToKebab } from "@arcgis/components-utils";
2
+ import { lazyMetaSubItemJoiner, lazyMetaGroupJoiner, lazyMetaItemJoiner } from "./config.js";
11
3
  function devOnlyDetectIncorrectLazyUsages(LitClass) {
12
4
  const genericPrototype = LitClass.prototype;
13
5
  const descriptor = Object.getOwnPropertyDescriptor(genericPrototype, "innerText");
14
- if (descriptor !== void 0 && descriptor.get === descriptor.set) {
6
+ if (descriptor !== void 0 && descriptor.set?.name === "setWrapper") {
15
7
  return;
16
8
  }
17
9
  const allowList = /* @__PURE__ */ new Set([
@@ -41,23 +33,40 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
41
33
  if (allowList.has(key)) {
42
34
  return;
43
35
  }
44
- const callback = (...args) => {
36
+ function validateUsage(...args) {
37
+ const isDynamicallyCreatedComponentInTest = this === this.el;
38
+ if (isDynamicallyCreatedComponentInTest) {
39
+ return;
40
+ }
45
41
  if (key === "hasAttribute" && args[0] === "defer-hydration") {
46
42
  return false;
47
43
  }
48
44
  throw new Error(
49
45
  `You should not be trying to access this.${key} directly as it won't work correctly in lazy-builds. Instead, ${customErrorMessages[key] ?? `use this.el.${key}`}`
50
46
  );
51
- };
47
+ }
52
48
  if (typeof value.value === "function") {
53
- genericPrototype[key] = callback;
49
+ genericPrototype[key] = function functionWrapper(...args) {
50
+ return validateUsage.call(this, ...args) ?? value.value.call(this, ...args);
51
+ };
52
+ } else if (typeof value.get === "function") {
53
+ Object.defineProperty(genericPrototype, key, {
54
+ get() {
55
+ validateUsage.call(this);
56
+ return value.get.call(this);
57
+ },
58
+ set: typeof value.set === "function" ? function setWrapper(setValue) {
59
+ validateUsage.call(this);
60
+ value.set.call(this, setValue);
61
+ } : void 0
62
+ });
63
+ } else if (key === key.toUpperCase() && typeof value.value === "number") {
64
+ return;
54
65
  } else {
55
- Object.defineProperty(genericPrototype, key, { get: callback, set: callback });
66
+ throw new Error(`Unexpected value type for ${key}: ${value}`);
56
67
  }
57
68
  });
58
69
  }
59
-
60
- // src/lifecycleSupport.ts
61
70
  function attachToAncestor(child) {
62
71
  let ancestor = child;
63
72
  while (ancestor = ancestor.parentNode ?? ancestor.host) {
@@ -71,9 +80,7 @@ function attachToAncestor(child) {
71
80
  }
72
81
  return false;
73
82
  }
74
-
75
- // src/lazyLoad.ts
76
- var makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
83
+ const makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
77
84
  if (!globalThis.customElements) {
78
85
  return;
79
86
  }
@@ -121,35 +128,19 @@ function createLazyElement([tagName, [load, compactMeta = ""]]) {
121
128
  globalThis.devOnly$ownTagNames?.add(tagName);
122
129
  }
123
130
  }
124
- var defineProperty = Object.defineProperty;
131
+ const defineProperty = Object.defineProperty;
125
132
  function parseCondensedProp(propAndAttribute) {
126
133
  const name = propAndAttribute.split(lazyMetaSubItemJoiner);
127
134
  return name.length === 1 ? [name[0], camelToKebab(name[0])] : name;
128
135
  }
129
- var HtmlElement = globalThis.HTMLElement ?? parseCondensedProp;
130
- var ProxyComponent = class extends HtmlElement {
136
+ const HtmlElement = globalThis.HTMLElement ?? parseCondensedProp;
137
+ class ProxyComponent extends HtmlElement {
131
138
  constructor() {
132
139
  super();
133
- /** @internal */
134
140
  this._store = {};
135
- /**
136
- * If attributeChangedCallback() is called before the LitElement is loaded,
137
- * store the attributes here, and replay later
138
- */
139
141
  this._pendingAttributes = [];
140
- /**
141
- * Resolved once LitElement's load() is complete.
142
- * Not read inside of this class, but needed for LitElement to determine if
143
- * it's closest ancestor finished load()
144
- */
145
142
  this._postLoad = new Deferred();
146
- /**
147
- * Resolved once LitElement's loaded() is complete
148
- */
149
143
  this._postLoaded = new Deferred();
150
- /**
151
- * Direct offspring that should be awaited before loaded() is emitted
152
- */
153
144
  this._offspring = [];
154
145
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
155
146
  this._hmrSetProps = /* @__PURE__ */ new Set();
@@ -162,7 +153,7 @@ var ProxyComponent = class extends HtmlElement {
162
153
  if (ProxyClass._LitConstructor) {
163
154
  this._initializeComponent({ a: ProxyClass._LitConstructor });
164
155
  } else {
165
- void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch((error) => {
156
+ void ProxyClass._loadPromise.then(awaitTopLevelPolyfill).then(this._initializeComponent.bind(this)).catch((error) => {
166
157
  this._postLoaded.reject(error);
167
158
  setTimeout(() => {
168
159
  throw error;
@@ -172,17 +163,13 @@ var ProxyComponent = class extends HtmlElement {
172
163
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
173
164
  ProxyClass._hmrInstances ??= [];
174
165
  ProxyClass._hmrInstances.push(new WeakRef(this));
175
- Object.defineProperty(this, "_store", {
176
- value: this._store,
177
- enumerable: false,
178
- configurable: true
179
- });
166
+ Object.defineProperty(this, "_store", { value: this._store, enumerable: false, configurable: true });
180
167
  }
181
168
  }
182
169
  static {
183
170
  this.lumina = true;
184
171
  }
185
- /** @internal */
172
+ /** private */
186
173
  static _initializePrototype() {
187
174
  this._properties?.forEach(this._bindProp, this);
188
175
  this._asyncMethods?.forEach(this._bindAsync, this);
@@ -302,7 +289,7 @@ var ProxyComponent = class extends HtmlElement {
302
289
  await this._postLoaded.promise;
303
290
  return this;
304
291
  }
305
- /** @internal */
292
+ /** private */
306
293
  _initializeComponent(module) {
307
294
  const ProxyClass = this.constructor;
308
295
  const tagName = ProxyClass._name;
@@ -320,25 +307,7 @@ var ProxyComponent = class extends HtmlElement {
320
307
  while (parentClass && !Object.hasOwn(parentClass, "lumina")) {
321
308
  parentClass = Object.getPrototypeOf(parentClass);
322
309
  }
323
- const litElementPrototype = parentClass.prototype;
324
- const elementPrototype = Element.prototype;
325
- const alreadyPatched = Object.hasOwn(litElementPrototype, "isConnected");
326
- if (!alreadyPatched) {
327
- litElementPrototype.setAttribute = function(qualifiedName, value) {
328
- elementPrototype.setAttribute.call(this.el, qualifiedName, value);
329
- };
330
- litElementPrototype.removeAttribute = function(qualifiedName) {
331
- elementPrototype.removeAttribute.call(this.el, qualifiedName);
332
- };
333
- defineProperty(litElementPrototype, "isConnected", {
334
- get() {
335
- return Reflect.get(elementPrototype, "isConnected", this.el);
336
- }
337
- });
338
- }
339
- if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
340
- devOnlyDetectIncorrectLazyUsages(parentClass);
341
- }
310
+ patchLitElement(parentClass);
342
311
  const isFirstInitialization = !ProxyClass._LitConstructor;
343
312
  if (isFirstInitialization) {
344
313
  ProxyClass._LitConstructor = LitConstructor;
@@ -348,11 +317,7 @@ var ProxyComponent = class extends HtmlElement {
348
317
  const litElement = document.createElement(lazyTagName);
349
318
  LitConstructor.lazy = void 0;
350
319
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
351
- Object.defineProperty(this, "_litElement", {
352
- value: litElement,
353
- configurable: true,
354
- enumerable: false
355
- });
320
+ Object.defineProperty(this, "_litElement", { value: litElement, configurable: true, enumerable: false });
356
321
  } else {
357
322
  this._litElement = litElement;
358
323
  }
@@ -402,17 +367,39 @@ var ProxyComponent = class extends HtmlElement {
402
367
  requestUpdate() {
403
368
  this._litElement?.requestUpdate();
404
369
  }
405
- };
370
+ }
406
371
  function syncLitElement([key, value]) {
407
372
  this[key] = value;
408
373
  }
409
-
410
- // src/utils.ts
411
- var noShadowRoot = {};
412
-
374
+ function patchLitElement(parentClass) {
375
+ const litElementPrototype = parentClass.prototype;
376
+ const elementPrototype = Element.prototype;
377
+ const alreadyPatched = Object.hasOwn(litElementPrototype, "isConnected");
378
+ if (!alreadyPatched) {
379
+ litElementPrototype.setAttribute = function(qualifiedName, value) {
380
+ elementPrototype.setAttribute.call(this.el, qualifiedName, value);
381
+ };
382
+ litElementPrototype.removeAttribute = function(qualifiedName) {
383
+ elementPrototype.removeAttribute.call(this.el, qualifiedName);
384
+ };
385
+ defineProperty(litElementPrototype, "isConnected", {
386
+ get() {
387
+ return Reflect.get(elementPrototype, "isConnected", this.el);
388
+ }
389
+ });
390
+ }
391
+ if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
392
+ devOnlyDetectIncorrectLazyUsages(parentClass);
393
+ }
394
+ }
395
+ const awaitTopLevelPolyfill = async (module) => {
396
+ await module.$$;
397
+ return module;
398
+ };
399
+ const noShadowRoot = {};
413
400
  export {
414
- attachToAncestor,
415
- makeDefineCustomElements,
416
- ProxyComponent,
417
- noShadowRoot
401
+ ProxyComponent as P,
402
+ attachToAncestor as a,
403
+ makeDefineCustomElements as m,
404
+ noShadowRoot as n
418
405
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.33.0-next.1",
3
+ "version": "4.33.0-next.100",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -13,6 +13,8 @@
13
13
  "./typings": {
14
14
  "types": "./dist/typings/index.d.ts"
15
15
  },
16
+ "./controllers": "./dist/controllers/index.js",
17
+ "./controllers/accessor": "./dist/controllers/accessor/index.js",
16
18
  "./package.json": "./package.json"
17
19
  },
18
20
  "files": [
@@ -20,8 +22,7 @@
20
22
  ],
21
23
  "license": "SEE LICENSE IN LICENSE.md",
22
24
  "dependencies": {
23
- "@arcgis/components-controllers": "4.33.0-next.1",
24
- "@arcgis/components-utils": "4.33.0-next.1",
25
+ "@arcgis/components-utils": "4.33.0-next.100",
25
26
  "@lit-labs/ssr": "^3.2.2",
26
27
  "@lit-labs/ssr-client": "^1.1.7",
27
28
  "@lit/context": "^1.1.3",
@@ -1,21 +0,0 @@
1
- // src/config.ts
2
- var lazyMetaGroupJoiner = ";";
3
- var lazyMetaItemJoiner = ",";
4
- var lazyMetaSubItemJoiner = ":";
5
- var PropertyFlags = /* @__PURE__ */ ((PropertyFlags2) => {
6
- PropertyFlags2[PropertyFlags2["ATTRIBUTE"] = 1] = "ATTRIBUTE";
7
- PropertyFlags2[PropertyFlags2["REFLECT"] = 2] = "REFLECT";
8
- PropertyFlags2[PropertyFlags2["BOOLEAN"] = 4] = "BOOLEAN";
9
- PropertyFlags2[PropertyFlags2["NUMBER"] = 8] = "NUMBER";
10
- PropertyFlags2[PropertyFlags2["STATE"] = 16] = "STATE";
11
- PropertyFlags2[PropertyFlags2["READ_ONLY"] = 32] = "READ_ONLY";
12
- PropertyFlags2[PropertyFlags2["NO_ACCESSOR"] = 64] = "NO_ACCESSOR";
13
- return PropertyFlags2;
14
- })(PropertyFlags || {});
15
-
16
- export {
17
- lazyMetaGroupJoiner,
18
- lazyMetaItemJoiner,
19
- lazyMetaSubItemJoiner,
20
- PropertyFlags
21
- };
@@ -1 +0,0 @@
1
- export {};