@arcgis/lumina 4.33.0-next.16 → 4.33.0-next.161

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 (58) hide show
  1. package/dist/Controller-BQOv8BAL.js +587 -0
  2. package/dist/LitElement.d.ts +56 -45
  3. package/dist/config.d.ts +7 -9
  4. package/dist/config.js +18 -8
  5. package/dist/context.d.ts +14 -4
  6. package/dist/controllers/Controller.d.ts +147 -0
  7. package/dist/controllers/ControllerInternals.d.ts +53 -0
  8. package/dist/controllers/ControllerManager.d.ts +68 -0
  9. package/dist/controllers/accessor/index.d.ts +4 -0
  10. package/dist/controllers/accessor/index.js +245 -0
  11. package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
  12. package/dist/controllers/accessor/store.d.ts +17 -0
  13. package/dist/controllers/accessor/useAccessor.d.ts +76 -0
  14. package/dist/controllers/functional.d.ts +19 -0
  15. package/dist/controllers/index.d.ts +24 -0
  16. package/dist/controllers/index.js +270 -0
  17. package/dist/controllers/load.d.ts +6 -0
  18. package/dist/controllers/proxyExports.d.ts +27 -0
  19. package/dist/controllers/tests/autoDestroyMock.d.ts +5 -0
  20. package/dist/controllers/tests/utils.d.ts +1 -0
  21. package/dist/controllers/toFunction.d.ts +8 -0
  22. package/dist/controllers/trackKey.d.ts +8 -0
  23. package/dist/controllers/trackPropKey.d.ts +21 -0
  24. package/dist/controllers/trackPropertyKey.d.ts +29 -0
  25. package/dist/controllers/types.d.ts +187 -0
  26. package/dist/controllers/useDirection.d.ts +11 -0
  27. package/dist/controllers/useMedia.d.ts +8 -0
  28. package/dist/controllers/usePropertyChange.d.ts +14 -0
  29. package/dist/controllers/useT9n.d.ts +48 -0
  30. package/dist/controllers/useWatchAttributes.d.ts +7 -0
  31. package/dist/controllers/utils.d.ts +12 -0
  32. package/dist/createEvent.d.ts +8 -3
  33. package/dist/decorators.d.ts +2 -2
  34. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +1 -1
  35. package/dist/hmrSupport.d.ts +1 -1
  36. package/dist/hmrSupport.js +22 -28
  37. package/dist/index.d.ts +17 -16
  38. package/dist/index.js +423 -194
  39. package/dist/jsx/baseTypes.d.ts +13 -9
  40. package/dist/jsx/directives.d.ts +25 -7
  41. package/dist/jsx/generatedTypes.d.ts +420 -90
  42. package/dist/jsx/types.d.ts +5 -32
  43. package/dist/lazyLoad-DUvrNd2L.js +406 -0
  44. package/dist/lazyLoad.d.ts +27 -72
  45. package/dist/lifecycleSupport.d.ts +2 -2
  46. package/dist/makeRuntime.d.ts +148 -0
  47. package/dist/proxyExports-Cdzj7WL_.js +60 -0
  48. package/dist/render.d.ts +5 -0
  49. package/dist/runtime.d.ts +4 -107
  50. package/dist/stencilSsrCompatibility/index.d.ts +2 -6
  51. package/dist/stencilSsrCompatibility/index.js +2 -3
  52. package/dist/typings/importMeta.d.ts +2 -2
  53. package/dist/utils.d.ts +8 -0
  54. package/dist/wrappersUtils.d.ts +13 -1
  55. package/package.json +7 -6
  56. package/dist/chunk-NO7HOBNA.js +0 -421
  57. package/dist/chunk-PGHUBTOM.js +0 -21
  58. package/dist/wrappersUtils.test.d.ts +0 -1
@@ -0,0 +1,148 @@
1
+ import { CSSResult } from 'lit';
2
+ import { LitElement } from './LitElement';
3
+ import { AccessorObservableLike, ReactiveTrackingTarget } from './controllers/types';
4
+ /**
5
+ * `@arcgis/lumina` package may be bundled once but used by multiple packages with
6
+ * different configuration options. For that reason, the configuration options
7
+ * cannot be a global object, but has to be an object that you pass around.
8
+ */
9
+ export type Runtime = RuntimeOptions & {
10
+ /**
11
+ * Get the base path to where the package assets can be found.
12
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
13
+ * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
14
+ * It is CORS-enabled, so you can load the assets from any domain.
15
+ * Use "setAssetPath(path)" if the path needs to be customized.
16
+ */
17
+ readonly getAssetPath: (suffix: string) => string;
18
+ /**
19
+ * Used to manually set the base path where package assets (like localization
20
+ * and icons) can be found.
21
+ *
22
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
23
+ * For example, `https://js.arcgis.com/map-components/4.30/`.
24
+ * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
25
+ * It is CORS-enabled, so you can load the assets from any domain.
26
+ * This is the recommended way to load the assets and avoid bundling them with your application.
27
+ * It means that by default, you don't need to use "setAssetPath" since the path is already set.
28
+ *
29
+ * However, if you need to host the assets locally, you can use "setAssetPath" to set the base path.
30
+ * If the script is used as "module", it's recommended to use "import.meta.url",
31
+ * such as "setAssetPath(import.meta.url)". Other options include
32
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
33
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
34
+ * But do note that this configuration depends on how your script is bundled, or lack of
35
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
36
+ * will have to ensure the static assets are copied to its build directory.
37
+ */
38
+ readonly setAssetPath: (path: URL | string) => void;
39
+ /**
40
+ * The customElement decorator. Unlike default Lit's decorator this one
41
+ * provides runtime instance to the LitElement class
42
+ *
43
+ * @remarks
44
+ * You do not need to call this decorator in your component.
45
+ * It will be added automatically at build time.
46
+ *
47
+ * Instead, make sure your component file has the following:
48
+ * ```ts
49
+ * declare global {
50
+ * interface DeclareElements {
51
+ * "arcgis-your-component": ArcgisYourComponent;
52
+ * }
53
+ * }
54
+ * ```
55
+ */
56
+ readonly customElement: (tagName: string, component: typeof LitElement) => void;
57
+ /**
58
+ * Short for trackAccess. A reference to JS API's accessor's trackAccess
59
+ * function to mark an observable as accessed.
60
+ * Used in the getter for each property in component packages that use @arcgis/core.
61
+ *
62
+ * @private
63
+ */
64
+ t?: (observable: AccessorObservableLike) => void;
65
+ /**
66
+ * Short for createObservable. A callback to create a JS API Accessor's
67
+ * SimpleObservable. Such observable will be created for each property in
68
+ * component packages that use @arcgis/core to bring reactiveUtils integration.
69
+ * @private
70
+ */
71
+ o?: () => AccessorObservableLike;
72
+ /**
73
+ * In CDN build, we can only import @arcgis/core async, so the lazy loader will need
74
+ * to await this promise before beginning hydration so that the reactiveUtils
75
+ * integration modules had time to load.
76
+ *
77
+ * @private
78
+ */
79
+ p?: Promise<void>;
80
+ /**
81
+ * A possible reference to JS API's createTrackingTarget() function to create
82
+ * an observer that will keep track of what properties were accessed during
83
+ * render().
84
+ *
85
+ * @private
86
+ */
87
+ c?: (callback: () => void) => ReactiveTrackingTarget;
88
+ /**
89
+ * A possible reference to JS API's runTracked() function to run update() with
90
+ * property accesses tracking enabled.
91
+ *
92
+ * @private
93
+ */
94
+ r?: (target: ReactiveTrackingTarget, callback: () => void) => void;
95
+ };
96
+ export type RuntimeOptions = {
97
+ /**
98
+ * The default asset path to use in NPM and CDN builds.
99
+ *
100
+ * This option will be set by Lumina compiler based on the value of the
101
+ * `assets.defaultPath` option in the `useLumina()` plugin.
102
+ */
103
+ readonly defaultAssetPath: string;
104
+ /**
105
+ * The attribute that indicates a component has rendered it's content.
106
+ * Usually this attribute is added after your component's `loaded()` lifecycle
107
+ * happened. However, during SSR, "hydrated" is added right away on the
108
+ * server.
109
+ *
110
+ * Until element has this attribute, it will have `visibility:hidden` style
111
+ * applied.
112
+ *
113
+ * This option will be set by the Lumina compiler based on the value of
114
+ * the `css.hydratedAttribute` option in the `useLumina()` plugin.
115
+ */
116
+ readonly hydratedAttribute: string;
117
+ /**
118
+ * Styles that you wish to make available in each component's shadow root, but
119
+ * to not apply outside the shadow root
120
+ *
121
+ * This option will be set by Lumina compiler based on the value of the
122
+ * `css.commonStylesPath` option in the `useLumina()` plugin.
123
+ */
124
+ readonly commonStyles?: CSSResult;
125
+ };
126
+ /**
127
+ * The options object will be provided by Lumina compiler at build-time.
128
+ * It should not be specified in the source code.
129
+ */
130
+ export declare const makeRuntime: (options?: RuntimeOptions) => Runtime;
131
+ /**
132
+ * Exposing the reference to the runtime globally when in tests or development.
133
+ * This is primarily for usage by dynamically created components in tests
134
+ *
135
+ * @private
136
+ */
137
+ export type DevOnlyGlobalRuntime = typeof globalThis & {
138
+ devOnly$luminaRuntime?: Runtime;
139
+ };
140
+ /**
141
+ * Called from the component constructor when in development or test mode.
142
+ * Used primarily by mount to get a reference to the rendered component.
143
+ *
144
+ * @private
145
+ */
146
+ export type DevOnlyGlobalComponentRefCallback = typeof globalThis & {
147
+ devOnly$luminaComponentRefCallback?: (component: LitElement) => void;
148
+ };
@@ -0,0 +1,60 @@
1
+ import { d as setParentController, e as retrieveParentControllers, o as setAmbientChildController, t as trackKey, h as bypassReadOnly } from "./Controller-BQOv8BAL.js";
2
+ const proxyExports = (Class) => (...args) => {
3
+ const ambientControllers = retrieveParentControllers();
4
+ const instance = new Class(...args);
5
+ const initialExports = instance.exports;
6
+ setParentController(ambientControllers.at(-1));
7
+ const manager = instance.component.manager;
8
+ manager.W(instance, initialExports);
9
+ instance.watchExports(manager.W.bind(manager, instance));
10
+ setAmbientChildController(instance);
11
+ const hostCandidates = [instance.component, ...ambientControllers].reverse();
12
+ return trackKey(
13
+ hostCandidates,
14
+ (resolution) => resolution === void 0 ? void 0 : setProxy(instance, resolution, initialExports),
15
+ initialExports
16
+ );
17
+ };
18
+ const setProxy = (controller, { host, key, isReactive: assignedToProp }, initialExports) => {
19
+ const genericHost = host;
20
+ const controllerValueChanged = genericHost[key] !== controller.exports;
21
+ const hostValueChanged = genericHost[key] !== initialExports;
22
+ const controllerUpdatedExports = initialExports !== controller.exports;
23
+ if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports) {
24
+ genericHost[key] = controller.exports;
25
+ }
26
+ const isProxyExportsOnComponent = host === controller.component;
27
+ if (isProxyExportsOnComponent) {
28
+ if (assignedToProp) {
29
+ const manager = controller.component.manager;
30
+ if (hostValueChanged) {
31
+ manager.W(controller, genericHost[key]);
32
+ }
33
+ controller.onUpdate((changes) => {
34
+ if (changes.has(key)) {
35
+ const value = genericHost[key];
36
+ if (value !== controller.exports) {
37
+ manager.W(controller, value);
38
+ }
39
+ }
40
+ });
41
+ }
42
+ controller.O = assignedToProp ? void 0 : key;
43
+ }
44
+ const isReadOnly = controller.component.constructor.elementProperties.get(key)?.readOnly;
45
+ controller.watchExports(() => {
46
+ if (genericHost[key] === controller.exports) {
47
+ return;
48
+ }
49
+ if (isReadOnly) {
50
+ bypassReadOnly(() => {
51
+ genericHost[key] = controller.exports;
52
+ });
53
+ } else {
54
+ genericHost[key] = controller.exports;
55
+ }
56
+ });
57
+ };
58
+ export {
59
+ proxyExports as p
60
+ };
@@ -0,0 +1,5 @@
1
+ import { JsxNode } from './jsx/types';
2
+ /**
3
+ * Retrieve an HTML element to be manually appended to an existing component.
4
+ */
5
+ export declare const renderElement: <Element extends HTMLElement = HTMLElement>(element: JsxNode) => Element;
package/dist/runtime.d.ts CHANGED
@@ -1,109 +1,6 @@
1
- import type { CSSResult } from "lit";
2
- import type { LitElement } from "./LitElement";
1
+ export declare const runtime: import('./makeRuntime').Runtime;
3
2
  /**
4
- * `@arcgis/lumina` package may be bundled once but used by multiple packages with
5
- * different configuration options. For that reason, the configuration options
6
- * cannot be a global object, but has to be an object that you pass around.
3
+ * "customElement" needs to be exported - it will be used by the build system.
4
+ * You should not call it directly.
7
5
  */
8
- export type Runtime = RuntimeOptions & {
9
- /**
10
- * Get the base path to where the package assets can be found.
11
- * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
12
- * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
13
- * It is CORS-enabled, so you can load the assets from any domain.
14
- * Use "setAssetPath(path)" if the path needs to be customized.
15
- */
16
- readonly getAssetPath: (suffix: string) => string;
17
- /**
18
- * Used to manually set the base path where package assets (like localization
19
- * and icons) can be found.
20
- *
21
- * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
22
- * For example, `https://js.arcgis.com/map-components/4.30/`.
23
- * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
24
- * It is CORS-enabled, so you can load the assets from any domain.
25
- * This is the recommended way to load the assets and avoid bundling them with your application.
26
- * It means that by default, you don't need to use "setAssetPath" since the path is already set.
27
- *
28
- * However, if you need to host the assets locally, you can use "setAssetPath" to set the base path.
29
- * If the script is used as "module", it's recommended to use "import.meta.url",
30
- * such as "setAssetPath(import.meta.url)". Other options include
31
- * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
32
- * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
33
- * But do note that this configuration depends on how your script is bundled, or lack of
34
- * bundling, and where your assets can be loaded from. Additionally custom bundling
35
- * will have to ensure the static assets are copied to its build directory.
36
- */
37
- readonly setAssetPath: (path: URL | string) => void;
38
- /**
39
- * The customElement decorator. Unlike default Lit's decorator this one
40
- * provides runtime instance to the LitElement class
41
- *
42
- * @remarks
43
- * You do not need to call this decorator in your component.
44
- * It will be added automatically at build time.
45
- *
46
- * Instead, make sure your component file has the following:
47
- * ```ts
48
- * declare global {
49
- * interface DeclareElements {
50
- * "arcgis-your-component": ArcgisYourComponent;
51
- * }
52
- * }
53
- * ```
54
- */
55
- readonly customElement: (tagName: string, component: typeof LitElement) => void;
56
- };
57
- export type RuntimeOptions = {
58
- /**
59
- * The default asset path to use in NPM and CDN builds.
60
- *
61
- * This option will be set by Lumina compiler based on the value of the
62
- * `assets.defaultPath` option in the `useLumina()` plugin.
63
- */
64
- readonly defaultAssetPath: string;
65
- /**
66
- * The attribute that indicates a component has rendered it's content.
67
- * Usually this attribute is added after your component's `loaded()` lifecycle
68
- * happened. However, during SSR, "hydrated" is added right away on the
69
- * server.
70
- *
71
- * Until element has this attribute, it will have `visibility:hidden` style
72
- * applied.
73
- *
74
- * This option will be set by the Lumina compiler based on the value of
75
- * the `css.hydratedAttribute` option in the `useLumina()` plugin.
76
- */
77
- readonly hydratedAttribute: string;
78
- /**
79
- * Styles that you wish to make available in each component's shadow root, but
80
- * to not apply outside the shadow root
81
- *
82
- * This option will be set by Lumina compiler based on the value of the
83
- * `css.commonStylesPath` option in the `useLumina()` plugin.
84
- */
85
- readonly commonStyles?: CSSResult;
86
- };
87
- /**
88
- * The options object will be provided by Lumina compiler at build-time.
89
- * It should not be specified in the source code.
90
- */
91
- export declare function makeRuntime(options?: RuntimeOptions): Runtime;
92
- /**
93
- * Exposing the reference to the runtime globally when in tests or development.
94
- * This is primarily for usage by dynamically created components in tests
95
- *
96
- * @private
97
- */
98
- export type DevOnlyGlobalRuntime = typeof globalThis & {
99
- devOnly$luminaRuntime?: Runtime;
100
- };
101
- /**
102
- * Called from the component constructor when in development or test mode.
103
- * Used primarily by mount to get a reference to the rendered component.
104
- *
105
- * @private
106
- */
107
- export type DevOnlyGlobalComponentRefCallback = typeof globalThis & {
108
- devOnly$luminaComponentRefCallback?: (component: LitElement) => void;
109
- };
6
+ export declare const customElement: (tagName: string, component: typeof import('./LitElement').LitElement) => void;
@@ -1,9 +1,5 @@
1
- /**
2
- * Lots of silencing of ESLint in this file to be compatible with Stencil's
3
- * unsafe typings.
4
- */
5
- import { type RenderInfo } from "@lit-labs/ssr/lib/render.js";
6
- import type { Readable } from "node:stream";
1
+ import { RenderInfo } from '@lit-labs/ssr/lib/render.js';
2
+ import { Readable } from 'node:stream';
7
3
  /**
8
4
  * @deprecated
9
5
  * Use `render` from `@lit-labs/ssr` instead.
@@ -1,11 +1,10 @@
1
- // src/stencilSsrCompatibility/index.ts
2
1
  import { getWindow } from "@lit-labs/ssr/lib/dom-shim.js";
3
2
  import { render } from "@lit-labs/ssr/lib/render.js";
4
3
  import { html } from "@lit-labs/ssr/lib/server-template.js";
5
- import { unsafeStatic, withStatic } from "lit-html/static.js";
4
+ import { withStatic, unsafeStatic } from "lit-html/static.js";
6
5
  import { collectResult } from "@lit-labs/ssr/lib/render-result.js";
7
6
  import { RenderResultReadable } from "@lit-labs/ssr/lib/render-result-readable.js";
8
- var staticHtml = withStatic(html);
7
+ const staticHtml = withStatic(html);
9
8
  function createWindowFromHtml(templateHtml, uniqueId = Math.random().toString()) {
10
9
  const window = getWindow({ includeJSBuiltIns: true });
11
10
  window.document.defaultView = window;
@@ -7,7 +7,7 @@ interface ImportMetaEnv {
7
7
  }
8
8
  interface ImportMeta {
9
9
  url: string;
10
- readonly hot?: import("vite/types/hot.d.ts").ViteHotContext;
10
+ readonly hot?: import('vite/types/hot.d.ts').ViteHotContext;
11
11
  readonly env: ImportMetaEnv;
12
- glob: import("vite/types/importGlob.d.ts").ImportGlobFunction;
12
+ glob: import('vite/types/importGlob.d.ts').ImportGlobFunction;
13
13
  }
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { LitElement } from './LitElement';
2
+ import { Runtime } from './makeRuntime';
1
3
  /**
2
4
  * Add this static property to your component to disable shadow root.
3
5
  *
@@ -18,3 +20,9 @@ export declare const noShadowRoot: ShadowRootInit;
18
20
  * attachShadow() since we use this exact empty object as a magic value to opt
19
21
  * out of shadow root.
20
22
  */
23
+ export declare function emptyFunction(): undefined;
24
+ /** @private */
25
+ export declare const devOnly$getLitElementTagNameAndRuntime: ((componentClass: typeof LitElement) => {
26
+ tagName: string;
27
+ runtime: Runtime;
28
+ }) | undefined;
@@ -27,7 +27,19 @@ export declare const makeReactWrapperFactory: (react: unknown, createComponent:
27
27
  *
28
28
  * @private
29
29
  */
30
- export declare const getReactWrapperOptions: <Element extends HTMLElement, Events extends EventNames>(tagNameAndElement: Element, events: Events) => Options<Element & {
30
+ export declare const getReactWrapperOptions: <Element extends HTMLElement, Events extends EventNames>(
31
+ /**
32
+ * We want "Events" type argument to be inferred, but Element type
33
+ * argument to be explicitly specified. That isn't possible until
34
+ * https://github.com/microsoft/TypeScript/issues/26242.
35
+ *
36
+ * As a workaround we are making Element inferred by passing Element type as
37
+ * a tag name:
38
+ * ```ts
39
+ * getReactWrapperOptions("te-st" as HTMLTeStElement, {});
40
+ * ```
41
+ */
42
+ tagNameAndElement: Element, events: Events) => Options<Element & {
31
43
  class?: string;
32
44
  }, Events>;
33
45
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.33.0-next.16",
3
+ "version": "4.33.0-next.161",
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,13 +22,12 @@
20
22
  ],
21
23
  "license": "SEE LICENSE IN LICENSE.md",
22
24
  "dependencies": {
23
- "@arcgis/components-controllers": "4.33.0-next.16",
24
- "@arcgis/components-utils": "4.33.0-next.16",
25
+ "@arcgis/components-utils": "4.33.0-next.161",
25
26
  "@lit-labs/ssr": "^3.2.2",
26
27
  "@lit-labs/ssr-client": "^1.1.7",
27
- "@lit/context": "^1.1.3",
28
+ "@lit/context": "^1.1.5",
28
29
  "csstype": "^3.1.3",
29
- "lit": "^3.2.0",
30
- "tslib": "^2.7.0"
30
+ "lit": "^3.3.0",
31
+ "tslib": "^2.8.1"
31
32
  }
32
33
  }