@arcgis/lumina 4.33.0-next.10 → 4.33.0-next.101
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 +263 -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 +12 -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 +6 -10
- 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-DBdf1Dqp.js} +45 -61
- package/package.json +4 -3
- package/dist/chunk-PGHUBTOM.js +0 -21
- package/dist/wrappersUtils.test.d.ts +0 -1
package/dist/jsx/baseTypes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { DirectiveResult } from 'lit-html/directive.js';
|
|
2
|
+
import { Ref } from 'lit-html/directives/ref.js';
|
|
3
3
|
export type EventHandlerUnion<T, E extends Event> = (e: E & {
|
|
4
4
|
currentTarget: T;
|
|
5
5
|
target: Element;
|
|
@@ -21,15 +21,19 @@ export type EventHandler<E> = {
|
|
|
21
21
|
}["bivarianceHack"];
|
|
22
22
|
export interface CustomAttributes<T = HTMLElement> {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* At build-time it is translated into the `keyed()` directive:
|
|
27
|
-
* https://lit.dev/docs/templates/directives/#keyed
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* Unlike in React or Stencil, any JavaScript value is acceptable as a key
|
|
24
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#key-prop)
|
|
31
25
|
*/
|
|
32
26
|
key?: unknown;
|
|
27
|
+
/**
|
|
28
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#refs)
|
|
29
|
+
*/
|
|
33
30
|
ref?: EventHandler<T | undefined> | Ref<T>;
|
|
31
|
+
/**
|
|
32
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#lit-directives)
|
|
33
|
+
*/
|
|
34
34
|
directives?: readonly DirectiveResult[];
|
|
35
|
+
/**
|
|
36
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
|
|
37
|
+
*/
|
|
38
|
+
deferLoad?: true;
|
|
35
39
|
}
|
package/dist/jsx/directives.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { Nil } from '@arcgis/components-utils';
|
|
2
|
+
import { Properties as CssProperties } from 'csstype';
|
|
3
|
+
import { ClassInfo } from 'lit-html/directives/class-map.js';
|
|
4
|
+
import { DirectiveResult } from 'lit/directive.js';
|
|
5
|
+
import { ClassMapDirective } from 'lit/directives/class-map.js';
|
|
6
|
+
import { StyleMapDirective } from 'lit/directives/style-map.js';
|
|
7
|
+
import { DirectiveClass, ElementPart, Directive } from 'lit-html/directive.js';
|
|
8
|
+
import { noChange } from 'lit';
|
|
8
9
|
/**
|
|
9
10
|
* You likely won't have to import this directly. It will be added during
|
|
10
11
|
* _JSX to lit-html_ conversion.
|
|
@@ -55,6 +56,22 @@ export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => Dir
|
|
|
55
56
|
* @private
|
|
56
57
|
*/
|
|
57
58
|
export declare const safeStyleMap: (parameters: CssProperties | Nil | string) => DirectiveResult<typeof StyleMapDirective> | Nil | string;
|
|
59
|
+
declare class DeferLoad extends Directive {
|
|
60
|
+
update(part: ElementPart): void;
|
|
61
|
+
render(): typeof noChange;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @private
|
|
65
|
+
* Do not use this directive directly. Use the `deferLoad` JSX prop instead.
|
|
66
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
|
|
67
|
+
*/
|
|
68
|
+
export declare const deferLoad: DirectiveResult<typeof DeferLoad>;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* Do not use this directly. Use the `deferLoad` JSX prop instead.
|
|
72
|
+
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
|
|
73
|
+
*/
|
|
74
|
+
export declare const deferredLoaders: Map<string, () => Promise<unknown>>;
|
|
58
75
|
/**
|
|
59
76
|
* Creates a user-facing directive function from a Directive class. This
|
|
60
77
|
* function has the same parameters as the directive's render() method.
|
|
@@ -75,3 +92,4 @@ export declare const directive: <C extends DirectiveClass>(c: C) => (...values:
|
|
|
75
92
|
* "never" to allow it be set as a value for any JSX attribute.
|
|
76
93
|
*/
|
|
77
94
|
export declare const live: (value: unknown) => never;
|
|
95
|
+
export {};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import type { StyleMapDirective } from "lit/directives/style-map.js";
|
|
8
|
-
import type { ChangeEventHandlerUnion, CustomAttributes, EventHandlerUnion, FocusEventHandlerUnion, InputEventHandlerUnion } from "./baseTypes";
|
|
9
|
-
import type { JsxNode } from "./types";
|
|
10
|
-
import type { Properties as CssProperties } from "csstype";
|
|
1
|
+
import { DirectiveResult } from 'lit/directive.js';
|
|
2
|
+
import { ClassInfo, ClassMapDirective } from 'lit/directives/class-map.js';
|
|
3
|
+
import { StyleMapDirective } from 'lit/directives/style-map.js';
|
|
4
|
+
import { ChangeEventHandlerUnion, CustomAttributes, EventHandlerUnion, FocusEventHandlerUnion, InputEventHandlerUnion } from './baseTypes';
|
|
5
|
+
import { JsxNode } from './types';
|
|
6
|
+
import { Properties as CssProperties } from 'csstype';
|
|
11
7
|
/**
|
|
12
8
|
* Some attributes accepts numbers as a number or as a string, while also
|
|
13
9
|
* accepting "inherit". Define the type as `number | string | "inherit"` rather
|
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
|
}
|