@arcgis/lumina 4.33.0-next.12 → 4.33.0-next.120
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/dist/Controller-CZ8Djohh.js +627 -0
- package/dist/LitElement.d.ts +36 -29
- package/dist/config.js +13 -6
- package/dist/context.d.ts +13 -3
- package/dist/controllers/Controller.d.ts +153 -0
- package/dist/controllers/ControllerInternals.d.ts +59 -0
- package/dist/controllers/ControllerManager.d.ts +83 -0
- package/dist/controllers/accessor/index.d.ts +2 -0
- package/dist/controllers/accessor/index.js +259 -0
- package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
- package/dist/controllers/accessor/useAccessor.d.ts +74 -0
- package/dist/controllers/functional.d.ts +19 -0
- package/dist/controllers/index.d.ts +24 -0
- package/dist/controllers/index.js +267 -0
- package/dist/controllers/load.d.ts +6 -0
- package/dist/controllers/proxyExports.d.ts +27 -0
- package/dist/controllers/tests/autoDestroyMock.d.ts +5 -0
- package/dist/controllers/tests/utils.d.ts +1 -0
- package/dist/controllers/toFunction.d.ts +8 -0
- package/dist/controllers/trackKey.d.ts +8 -0
- package/dist/controllers/trackPropKey.d.ts +21 -0
- package/dist/controllers/trackPropertyKey.d.ts +29 -0
- package/dist/controllers/types.d.ts +152 -0
- package/dist/controllers/useDirection.d.ts +11 -0
- package/dist/controllers/useMedia.d.ts +8 -0
- package/dist/controllers/usePropertyChange.d.ts +14 -0
- package/dist/controllers/useT9n.d.ts +48 -0
- package/dist/controllers/useWatchAttributes.d.ts +7 -0
- package/dist/controllers/utils.d.ts +15 -0
- package/dist/createEvent.d.ts +7 -2
- package/dist/decorators.d.ts +2 -2
- package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +1 -1
- package/dist/hmrSupport.d.ts +1 -1
- package/dist/hmrSupport.js +1 -7
- package/dist/index.d.ts +17 -16
- package/dist/index.js +386 -150
- package/dist/jsx/baseTypes.d.ts +13 -9
- package/dist/jsx/directives.d.ts +25 -7
- package/dist/jsx/generatedTypes.d.ts +420 -90
- package/dist/jsx/types.d.ts +5 -32
- package/dist/lazyLoad.d.ts +18 -18
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/makeRuntime.d.ts +109 -0
- package/dist/proxyExports-CK5BLFLO.js +60 -0
- package/dist/render.d.ts +5 -0
- package/dist/runtime.d.ts +4 -107
- package/dist/stencilSsrCompatibility/index.d.ts +2 -6
- package/dist/stencilSsrCompatibility/index.js +2 -3
- package/dist/typings/importMeta.d.ts +2 -2
- package/dist/{chunk-NO7HOBNA.js → utils-CwiifsrO.js} +44 -61
- package/dist/wrappersUtils.d.ts +13 -1
- package/package.json +7 -6
- package/dist/chunk-PGHUBTOM.js +0 -21
- package/dist/wrappersUtils.test.d.ts +0 -1
package/dist/jsx/types.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* ```ts
|
|
6
|
-
* /// <reference types="@arcgis/lumina/typings" />
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
import type { TemplateResult } from "lit-html";
|
|
10
|
-
import type { DirectiveResult } from "lit-html/directive.js";
|
|
11
|
-
import type { HTMLElementTags, HTMLAttributes, GlobalEventHandlersCamelCase, SvgElementTags, DOMAttributes, AriaAttributes } from "./generatedTypes";
|
|
12
|
-
import type { CustomAttributes } from "./baseTypes";
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import { DirectiveResult } from 'lit-html/directive.js';
|
|
3
|
+
import { HTMLElementTags, HTMLAttributes, GlobalEventHandlersCamelCase, SvgElementTags, DOMAttributes, AriaAttributes } from './generatedTypes';
|
|
4
|
+
import { CustomAttributes } from './baseTypes';
|
|
13
5
|
/**
|
|
14
6
|
* The "h" namespace is used to import JSX types for elements and attributes.
|
|
15
7
|
* It is imported in order to avoid conflicting global JSX issues.
|
|
@@ -372,27 +364,8 @@ type FixupStencilEventCasing<PropertyName extends PropertyKey> = PropertyName ex
|
|
|
372
364
|
* https://www.typescriptlang.org/docs/handbook/jsx.html
|
|
373
365
|
*/
|
|
374
366
|
export declare namespace LuminaJsx {
|
|
375
|
-
/**
|
|
376
|
-
* Whether to pick TemplateResult or JsxNode here is a compromise.
|
|
377
|
-
*
|
|
378
|
-
* - If I tell it Lit JSX type is JsxNode, then even <a /> expression will
|
|
379
|
-
* have a very broad JsxNode type (union of template results, null,
|
|
380
|
-
* undefined, false, and more). This may slow down type-checking and may be
|
|
381
|
-
* too-broad for certain use cases.
|
|
382
|
-
* - Since <a /> would be typed very broad, you won't be able to declare
|
|
383
|
-
* your function as receiving just TemplateResult
|
|
384
|
-
* - Also, this makes TypeScript not allow you to return undefined from
|
|
385
|
-
* your functional component
|
|
386
|
-
* - This is what React did and what I am going with
|
|
387
|
-
* - If I tell TypeScript that JSX type is TemplateResult, then my function
|
|
388
|
-
* component is no longer allowed to return undefined or string or etc.
|
|
389
|
-
*
|
|
390
|
-
* This is mainly a TypeScript limitation. Issues tracking this:
|
|
391
|
-
* - https://github.com/microsoft/TypeScript/issues/21699
|
|
392
|
-
* - https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18912
|
|
393
|
-
*
|
|
394
|
-
*/
|
|
395
367
|
export type Element = TemplateResult;
|
|
368
|
+
export type ElementType = JsxNode;
|
|
396
369
|
export interface ElementClass {
|
|
397
370
|
}
|
|
398
371
|
export interface ElementAttributesProperty {
|
package/dist/lazyLoad.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Deferred } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Deferred } from '@arcgis/components-utils';
|
|
2
|
+
import { LitElement } from './LitElement';
|
|
3
|
+
import { Runtime } from './makeRuntime';
|
|
4
|
+
import { ControllerManager } from './controllers/ControllerManager';
|
|
5
5
|
/**
|
|
6
6
|
* Defines lazy-loading proxy components for all web components in this package.
|
|
7
7
|
*
|
|
@@ -47,32 +47,32 @@ declare const HtmlElement: {
|
|
|
47
47
|
* component, so as to have identical DOM structure for lazy vs non-lazy builds
|
|
48
48
|
* (otherwise, css selectors may break)
|
|
49
49
|
*
|
|
50
|
-
* @
|
|
50
|
+
* @private
|
|
51
51
|
*/
|
|
52
52
|
export declare abstract class ProxyComponent extends HtmlElement {
|
|
53
53
|
static observedAttributes?: readonly string[];
|
|
54
|
-
/** @
|
|
54
|
+
/** @private */
|
|
55
55
|
static _loadPromise: Promise<Record<string, typeof LitElement>> | undefined;
|
|
56
|
-
/**
|
|
56
|
+
/** private */
|
|
57
57
|
static _LitConstructor?: typeof LitElement;
|
|
58
58
|
/**
|
|
59
59
|
* A list of instances of this component. This allows hot module replacement
|
|
60
60
|
* to update all proxy component to use a new LitElement instance.
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* private
|
|
63
63
|
*/
|
|
64
64
|
static _hmrInstances: WeakRef<ProxyComponent>[] | undefined;
|
|
65
|
-
/**
|
|
65
|
+
/** private */
|
|
66
66
|
static _hmrIndex: number | undefined;
|
|
67
|
-
/**
|
|
67
|
+
/** private */
|
|
68
68
|
static _properties?: readonly string[];
|
|
69
|
-
/**
|
|
69
|
+
/** private */
|
|
70
70
|
static _asyncMethods?: readonly string[];
|
|
71
|
-
/**
|
|
71
|
+
/** private */
|
|
72
72
|
static _syncMethods?: readonly string[];
|
|
73
73
|
protected static _name: string;
|
|
74
74
|
static readonly lumina = true;
|
|
75
|
-
/**
|
|
75
|
+
/** private */
|
|
76
76
|
static _initializePrototype(): void;
|
|
77
77
|
private static _bindProp;
|
|
78
78
|
private static _bindAsync;
|
|
@@ -81,14 +81,14 @@ export declare abstract class ProxyComponent extends HtmlElement {
|
|
|
81
81
|
* On HMR, preserve the values of all properties that at least once were set
|
|
82
82
|
* by someone other than component itself.
|
|
83
83
|
*
|
|
84
|
-
*
|
|
84
|
+
* private
|
|
85
85
|
*/
|
|
86
86
|
_hmrSetProps: Set<PropertyKey>;
|
|
87
|
-
/**
|
|
87
|
+
/** private */
|
|
88
88
|
_hmrSetAttributes: Set<string>;
|
|
89
|
-
/**
|
|
89
|
+
/** private */
|
|
90
90
|
_litElement: LitElement | undefined;
|
|
91
|
-
/**
|
|
91
|
+
/** private */
|
|
92
92
|
_store: LitElement | Record<string, unknown>;
|
|
93
93
|
/**
|
|
94
94
|
* If attributeChangedCallback() is called before the LitElement is loaded,
|
|
@@ -153,7 +153,7 @@ export declare abstract class ProxyComponent extends HtmlElement {
|
|
|
153
153
|
* Create a promise that resolves once component is fully loaded
|
|
154
154
|
*/
|
|
155
155
|
componentOnReady(): Promise<this>;
|
|
156
|
-
/**
|
|
156
|
+
/** private */
|
|
157
157
|
_initializeComponent(module: Record<string, typeof LitElement>): void;
|
|
158
158
|
/**
|
|
159
159
|
* Implemented on the proxy for compatibility with Lit Context.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { LitElement } from './LitElement';
|
|
3
|
+
/**
|
|
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.
|
|
7
|
+
*/
|
|
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
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { e as setParentController, f as retrieveParentControllers, u as setAmbientChildController, t as trackKey, l as bypassReadOnly } from "./Controller-CZ8Djohh.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._markExports(instance, initialExports);
|
|
9
|
+
instance.watchExports((exports) => manager._markExports(instance, exports));
|
|
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
|
+
function 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._markExports(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._markExports(controller, value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
controller.assignedProperty = 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
|
+
};
|
package/dist/render.d.ts
ADDED
package/dist/runtime.d.ts
CHANGED
|
@@ -1,109 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type { LitElement } from "./LitElement";
|
|
1
|
+
export declare const runtime: import('./makeRuntime').Runtime;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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(
|
|
10
|
+
readonly hot?: import('vite/types/hot.d.ts').ViteHotContext;
|
|
11
11
|
readonly env: ImportMetaEnv;
|
|
12
|
-
glob: import(
|
|
12
|
+
glob: import('vite/types/importGlob.d.ts').ImportGlobFunction;
|
|
13
13
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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.
|
|
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
|
-
|
|
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] =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
130
|
-
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
292
|
+
/** private */
|
|
306
293
|
_initializeComponent(module) {
|
|
307
294
|
const ProxyClass = this.constructor;
|
|
308
295
|
const tagName = ProxyClass._name;
|
|
@@ -330,11 +317,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
330
317
|
const litElement = document.createElement(lazyTagName);
|
|
331
318
|
LitConstructor.lazy = void 0;
|
|
332
319
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
333
|
-
Object.defineProperty(this, "_litElement", {
|
|
334
|
-
value: litElement,
|
|
335
|
-
configurable: true,
|
|
336
|
-
enumerable: false
|
|
337
|
-
});
|
|
320
|
+
Object.defineProperty(this, "_litElement", { value: litElement, configurable: true, enumerable: false });
|
|
338
321
|
} else {
|
|
339
322
|
this._litElement = litElement;
|
|
340
323
|
}
|
|
@@ -384,7 +367,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
384
367
|
requestUpdate() {
|
|
385
368
|
this._litElement?.requestUpdate();
|
|
386
369
|
}
|
|
387
|
-
}
|
|
370
|
+
}
|
|
388
371
|
function syncLitElement([key, value]) {
|
|
389
372
|
this[key] = value;
|
|
390
373
|
}
|
|
@@ -409,13 +392,13 @@ function patchLitElement(parentClass) {
|
|
|
409
392
|
devOnlyDetectIncorrectLazyUsages(parentClass);
|
|
410
393
|
}
|
|
411
394
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
395
|
+
const awaitTopLevelPolyfill = async (module) => await (module.default?.then(
|
|
396
|
+
(module2) => typeof module2 === "function" ? { a: module2 } : module2
|
|
397
|
+
) ?? module);
|
|
398
|
+
const noShadowRoot = {};
|
|
416
399
|
export {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
noShadowRoot
|
|
400
|
+
ProxyComponent as P,
|
|
401
|
+
attachToAncestor as a,
|
|
402
|
+
makeDefineCustomElements as m,
|
|
403
|
+
noShadowRoot as n
|
|
421
404
|
};
|