@arcgis/lumina 4.34.0-next.9 → 4.34.0-next.90
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-BQOv8BAL.js → Controller-ftAEcdmI.js} +11 -137
- package/dist/ControllerInternals-CWQrfEA8.js +133 -0
- package/dist/context.js +18 -0
- package/dist/controllers/Controller.d.ts +1 -3
- package/dist/controllers/ControllerInternals.d.ts +1 -1
- package/dist/controllers/accessor/index.js +23 -17
- package/dist/controllers/accessor/store.d.ts +2 -2
- package/dist/controllers/accessor/useAccessor.d.ts +8 -3
- package/dist/controllers/index.d.ts +5 -1
- package/dist/controllers/index.js +20 -14
- package/dist/controllers/trackPropertyKey.d.ts +1 -1
- package/dist/controllers/types.d.ts +1 -1
- package/dist/controllers/useT9n.d.ts +3 -3
- package/dist/hmrSupport.js +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +37 -27
- package/dist/jsx/directives.d.ts +33 -4
- package/dist/jsx/generatedTypes.d.ts +13 -5
- package/dist/{lazyLoad-DUvrNd2L.js → lazyLoad-B6Te7FRR.js} +7 -2
- package/dist/lazyLoad.d.ts +1 -1
- package/dist/makeRuntime.d.ts +1 -1
- package/dist/{proxyExports-Cdzj7WL_.js → proxyExports-D906TEtL.js} +2 -1
- package/dist/render.d.ts +6 -0
- package/package.json +12 -7
- package/dist/stencilSsrCompatibility/index.d.ts +0 -73
- package/dist/stencilSsrCompatibility/index.js +0 -87
|
@@ -1,126 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { safeCall, isEsriInternalEnv, safeAsyncCall } from "@arcgis/toolkit/error";
|
|
2
|
+
import { r as retrieveComponent, d as retrieveParentControllers, b as setParentController, s as setAmbientComponent, u as use, k as useRef, l as useRefSync, c as controllerSymbol } from "./ControllerInternals-CWQrfEA8.js";
|
|
2
3
|
import { nothing } from "lit";
|
|
3
|
-
|
|
4
|
-
const isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
|
|
5
|
-
const isPromise = (arg) => typeof arg?.then === "function";
|
|
6
|
-
const getControllersCount = (component) => component.M.length;
|
|
7
|
-
let ambientComponent;
|
|
8
|
-
const setAmbientComponent = (component) => {
|
|
9
|
-
if (ambientComponent === component) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
ambientComponent = component;
|
|
13
|
-
queueMicrotask(() => ambientComponent === component ? ambientComponent = void 0 : 0);
|
|
14
|
-
};
|
|
15
|
-
const retrieveComponent = (name) => {
|
|
16
|
-
if (process.env.NODE_ENV !== "production" && ambientComponent === void 0) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
[
|
|
19
|
-
`Unable to find out which component ${name || "this"} controller `,
|
|
20
|
-
"belongs to. Possible causes:\n",
|
|
21
|
-
"- You might have multiple versions of ",
|
|
22
|
-
"@arcgis/lumina package installed\n",
|
|
23
|
-
...isEsriInternalEnv() ? [
|
|
24
|
-
"- You tried to create controller outside the component. If so, ",
|
|
25
|
-
"please wrap your controller definition in an arrow function (like",
|
|
26
|
-
"`const myController = ()=>makeController(...);`) and call that",
|
|
27
|
-
"function inside the component (`my = myController();`), or ",
|
|
28
|
-
"define your controller using makeGenericController/GenericController ",
|
|
29
|
-
"instead.\n",
|
|
30
|
-
"- You tried to create a controller inside an async function. ",
|
|
31
|
-
"This is allowed without calling controller.use(). Make sure you ",
|
|
32
|
-
"use it like `await controller.use(useController())`."
|
|
33
|
-
] : []
|
|
34
|
-
].join("")
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
return ambientComponent;
|
|
38
|
-
};
|
|
39
|
-
let ambientControllers = [];
|
|
40
|
-
const setParentController = (controller) => {
|
|
41
|
-
if (controller === void 0) {
|
|
42
|
-
ambientControllers = [];
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const index = ambientControllers.indexOf(controller);
|
|
46
|
-
ambientControllers = index === -1 ? [...ambientControllers, controller] : ambientControllers.slice(0, index + 1);
|
|
47
|
-
queueMicrotask(() => ambientControllers = []);
|
|
48
|
-
};
|
|
49
|
-
const retrieveParentControllers = () => ambientControllers;
|
|
50
|
-
let ambientChildController;
|
|
51
|
-
const setAmbientChildController = (controller) => {
|
|
52
|
-
if (ambientChildController === controller) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
ambientChildController = controller;
|
|
56
|
-
queueMicrotask(() => ambientChildController === controller ? ambientChildController = void 0 : 0);
|
|
57
|
-
};
|
|
58
|
-
const retrieveAmbientChildController = () => {
|
|
59
|
-
const controller = ambientChildController;
|
|
60
|
-
ambientChildController = void 0;
|
|
61
|
-
return controller;
|
|
62
|
-
};
|
|
63
|
-
const use = async (value, watchExports) => {
|
|
64
|
-
const controller = useRefSync(value);
|
|
65
|
-
if (controller === void 0) {
|
|
66
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && typeof watchExports === "function") {
|
|
67
|
-
throw new Error(
|
|
68
|
-
`Unable to resolve a controller from the provided value, so can't watch it's exports. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
await controller.ready;
|
|
74
|
-
if (typeof watchExports === "function") {
|
|
75
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && controller.watchExports === void 0) {
|
|
76
|
-
throw new Error(`The controller must implement watchExports method to support watching exports`);
|
|
77
|
-
}
|
|
78
|
-
const unsubscribe = controller.watchExports(
|
|
79
|
-
(exports) => watchExports(exports, unsubscribe)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
return controller.exports;
|
|
83
|
-
};
|
|
84
|
-
const useRef = async (value) => {
|
|
85
|
-
const controller = useRefSync(value);
|
|
86
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && controller === void 0) {
|
|
87
|
-
throw new Error(
|
|
88
|
-
`Unable to resolve a controller from the provided value. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
await controller.ready;
|
|
92
|
-
return controller;
|
|
93
|
-
};
|
|
94
|
-
const useRefSync = (value) => {
|
|
95
|
-
const component = retrieveComponent();
|
|
96
|
-
const controller = component.manager.X(value);
|
|
97
|
-
if (controller !== void 0) {
|
|
98
|
-
return controller;
|
|
99
|
-
}
|
|
100
|
-
if (isController(value)) {
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
const ambientChildController2 = retrieveAmbientChildController();
|
|
104
|
-
if (ambientChildController2 !== void 0) {
|
|
105
|
-
return ambientChildController2;
|
|
106
|
-
}
|
|
107
|
-
return void 0;
|
|
108
|
-
};
|
|
109
|
-
let shouldBypassReadOnly = false;
|
|
110
|
-
const bypassReadOnly = (callback) => {
|
|
111
|
-
shouldBypassReadOnly = true;
|
|
112
|
-
try {
|
|
113
|
-
return callback();
|
|
114
|
-
} finally {
|
|
115
|
-
shouldBypassReadOnly = false;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const bypassSetter = bypassReadOnly;
|
|
4
|
+
import { Deferred } from "@arcgis/toolkit/promise";
|
|
119
5
|
const trackPropertyKey = (object, onResolved, defaultValue) => {
|
|
120
6
|
const keys = Object.keys(object);
|
|
121
7
|
const keyCount = keys.length;
|
|
122
8
|
if (keyTrackMap === void 0) {
|
|
123
|
-
queueMicrotask(
|
|
9
|
+
queueMicrotask(propertyTrackResolve);
|
|
124
10
|
}
|
|
125
11
|
keyTrackMap ??= /* @__PURE__ */ new Map();
|
|
126
12
|
let pendingTrackers = keyTrackMap.get(object);
|
|
@@ -147,7 +33,7 @@ const trackPropertyKey = (object, onResolved, defaultValue) => {
|
|
|
147
33
|
return defaultValue;
|
|
148
34
|
};
|
|
149
35
|
let keyTrackMap = void 0;
|
|
150
|
-
const
|
|
36
|
+
const propertyTrackResolve = () => {
|
|
151
37
|
keyTrackMap?.forEach(({ callbacks }, object) => {
|
|
152
38
|
const keys = Object.keys(object);
|
|
153
39
|
callbacks.forEach((commit) => commit(keys));
|
|
@@ -207,7 +93,7 @@ const createEventFactory = (eventName = "", options = {}, component = retrieveCo
|
|
|
207
93
|
console.warn(`Trying to emit an ${eventName} event on a disconnected element ${component.el.localName}`);
|
|
208
94
|
}
|
|
209
95
|
if (eventName === "") {
|
|
210
|
-
|
|
96
|
+
propertyTrackResolve();
|
|
211
97
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && eventName === "") {
|
|
212
98
|
throw new Error("Unable to resolve event name from property name");
|
|
213
99
|
}
|
|
@@ -566,22 +452,10 @@ const accessBeforeLoad = process.env.NODE_ENV !== "production" && isEsriInternal
|
|
|
566
452
|
export {
|
|
567
453
|
Controller as C,
|
|
568
454
|
GenericController as G,
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
createEventFactory as f,
|
|
575
|
-
bypassSetter as g,
|
|
576
|
-
bypassReadOnly as h,
|
|
577
|
-
isPromise as i,
|
|
578
|
-
trackPropertyKey as j,
|
|
579
|
-
keyTrackResolve as k,
|
|
580
|
-
trackPropKey as l,
|
|
581
|
-
isController as m,
|
|
582
|
-
getControllersCount as n,
|
|
583
|
-
setAmbientChildController as o,
|
|
584
|
-
retrieveComponent as r,
|
|
585
|
-
setAmbientComponent as s,
|
|
455
|
+
createEventFactory as a,
|
|
456
|
+
trackPropertyKey as b,
|
|
457
|
+
createEvent as c,
|
|
458
|
+
trackPropKey as d,
|
|
459
|
+
propertyTrackResolve as p,
|
|
586
460
|
trackKey as t
|
|
587
461
|
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
+
const controllerSymbol = Symbol.for("controller");
|
|
3
|
+
const isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
|
|
4
|
+
const isPromise = (arg) => typeof arg?.then === "function";
|
|
5
|
+
const getControllersCount = (component) => component.M.length;
|
|
6
|
+
let ambientComponent;
|
|
7
|
+
const setAmbientComponent = (component) => {
|
|
8
|
+
if (ambientComponent === component) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
ambientComponent = component;
|
|
12
|
+
queueMicrotask(() => ambientComponent === component ? ambientComponent = void 0 : 0);
|
|
13
|
+
};
|
|
14
|
+
const retrieveComponent = (name) => {
|
|
15
|
+
if (process.env.NODE_ENV !== "production" && ambientComponent === void 0) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
[
|
|
18
|
+
`Unable to find out which component ${name || "this"} controller `,
|
|
19
|
+
"belongs to. Possible causes:\n",
|
|
20
|
+
"- You might have multiple versions of ",
|
|
21
|
+
"@arcgis/lumina package installed\n",
|
|
22
|
+
...isEsriInternalEnv() ? [
|
|
23
|
+
"- You tried to create controller outside the component (in ",
|
|
24
|
+
"non-component class or in global scope).",
|
|
25
|
+
"- You accidentally defined the controller using const a = ",
|
|
26
|
+
"makeController(...); rather than const a = () => ",
|
|
27
|
+
"makeController(...);",
|
|
28
|
+
"- You tried to create a controller inside an async function. ",
|
|
29
|
+
"This is not allowed without calling controller.use(). Make ",
|
|
30
|
+
"sure you use it like `await controller.use(useController())`."
|
|
31
|
+
] : []
|
|
32
|
+
].join("")
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return ambientComponent;
|
|
36
|
+
};
|
|
37
|
+
let ambientControllers = [];
|
|
38
|
+
const setParentController = (controller) => {
|
|
39
|
+
if (controller === void 0) {
|
|
40
|
+
ambientControllers = [];
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const index = ambientControllers.indexOf(controller);
|
|
44
|
+
ambientControllers = index === -1 ? [...ambientControllers, controller] : ambientControllers.slice(0, index + 1);
|
|
45
|
+
queueMicrotask(() => ambientControllers = []);
|
|
46
|
+
};
|
|
47
|
+
const retrieveParentControllers = () => ambientControllers;
|
|
48
|
+
let ambientChildController;
|
|
49
|
+
const setAmbientChildController = (controller) => {
|
|
50
|
+
if (ambientChildController === controller) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
ambientChildController = controller;
|
|
54
|
+
queueMicrotask(() => ambientChildController === controller ? ambientChildController = void 0 : 0);
|
|
55
|
+
};
|
|
56
|
+
const retrieveAmbientChildController = () => {
|
|
57
|
+
const controller = ambientChildController;
|
|
58
|
+
ambientChildController = void 0;
|
|
59
|
+
return controller;
|
|
60
|
+
};
|
|
61
|
+
const use = async (value, watchExports) => {
|
|
62
|
+
const controller = useRefSync(value);
|
|
63
|
+
if (controller === void 0) {
|
|
64
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && typeof watchExports === "function") {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Unable to resolve a controller from the provided value, so can't watch it's exports. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
await controller.ready;
|
|
72
|
+
if (typeof watchExports === "function") {
|
|
73
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && controller.watchExports === void 0) {
|
|
74
|
+
throw new Error(`The controller must implement watchExports method to support watching exports`);
|
|
75
|
+
}
|
|
76
|
+
const unsubscribe = controller.watchExports(
|
|
77
|
+
(exports) => watchExports(exports, unsubscribe)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return controller.exports;
|
|
81
|
+
};
|
|
82
|
+
const useRef = async (value) => {
|
|
83
|
+
const controller = useRefSync(value);
|
|
84
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && controller === void 0) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Unable to resolve a controller from the provided value. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
await controller.ready;
|
|
90
|
+
return controller;
|
|
91
|
+
};
|
|
92
|
+
const useRefSync = (value) => {
|
|
93
|
+
const component = retrieveComponent();
|
|
94
|
+
const controller = component.manager.X(value);
|
|
95
|
+
if (controller !== void 0) {
|
|
96
|
+
return controller;
|
|
97
|
+
}
|
|
98
|
+
if (isController(value)) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
const ambientChildController2 = retrieveAmbientChildController();
|
|
102
|
+
if (ambientChildController2 !== void 0) {
|
|
103
|
+
return ambientChildController2;
|
|
104
|
+
}
|
|
105
|
+
return void 0;
|
|
106
|
+
};
|
|
107
|
+
let shouldBypassReadOnly = false;
|
|
108
|
+
const bypassReadOnly = (callback) => {
|
|
109
|
+
shouldBypassReadOnly = true;
|
|
110
|
+
try {
|
|
111
|
+
return callback();
|
|
112
|
+
} finally {
|
|
113
|
+
shouldBypassReadOnly = false;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const bypassSetter = bypassReadOnly;
|
|
117
|
+
export {
|
|
118
|
+
shouldBypassReadOnly as a,
|
|
119
|
+
setParentController as b,
|
|
120
|
+
controllerSymbol as c,
|
|
121
|
+
retrieveParentControllers as d,
|
|
122
|
+
bypassSetter as e,
|
|
123
|
+
bypassReadOnly as f,
|
|
124
|
+
isController as g,
|
|
125
|
+
getControllersCount as h,
|
|
126
|
+
isPromise as i,
|
|
127
|
+
setAmbientChildController as j,
|
|
128
|
+
useRef as k,
|
|
129
|
+
useRefSync as l,
|
|
130
|
+
retrieveComponent as r,
|
|
131
|
+
setAmbientComponent as s,
|
|
132
|
+
use as u
|
|
133
|
+
};
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContextProvider, ContextConsumer } from "@lit/context";
|
|
2
|
+
import { r as retrieveComponent } from "./ControllerInternals-CWQrfEA8.js";
|
|
3
|
+
const useContextProvider = (options) => {
|
|
4
|
+
const component = retrieveComponent();
|
|
5
|
+
const controller = new ContextProvider(component.el, options);
|
|
6
|
+
component.addController(controller);
|
|
7
|
+
return controller;
|
|
8
|
+
};
|
|
9
|
+
const useContextConsumer = (options) => {
|
|
10
|
+
const component = retrieveComponent();
|
|
11
|
+
const controller = new ContextConsumer(component.el, options);
|
|
12
|
+
component.addController(controller);
|
|
13
|
+
return controller;
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
useContextConsumer,
|
|
17
|
+
useContextProvider
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Deferred } from '@arcgis/
|
|
1
|
+
import { Deferred } from '@arcgis/toolkit/promise';
|
|
2
2
|
import { BaseController, ControllerLifecycleMethods, controllerSymbol } from './types';
|
|
3
3
|
import { use, useRef, useRefSync } from './ControllerInternals';
|
|
4
4
|
import { PropertyValues } from 'lit';
|
|
@@ -8,8 +8,6 @@ import { LitElement } from '../LitElement';
|
|
|
8
8
|
* Defining controller using makeController() function is more succinct for smaller
|
|
9
9
|
* controllers. For controllers that need to declare several methods, or need
|
|
10
10
|
* more flexibility, this class may be used
|
|
11
|
-
*
|
|
12
|
-
* See ./examples.tsx for many example controllers and their usages.
|
|
13
11
|
*/
|
|
14
12
|
export declare abstract class Controller<Exports = never> implements BaseController {
|
|
15
13
|
#private;
|
|
@@ -42,7 +42,7 @@ type InferController<ControllerOrExports> = ControllerOrExports extends BaseCont
|
|
|
42
42
|
watchExports?: Controller["watchExports"];
|
|
43
43
|
} : Controller<ControllerOrExports>;
|
|
44
44
|
/**
|
|
45
|
-
* If controller never sets
|
|
45
|
+
* If controller never sets its exports, then its default exports is "this".
|
|
46
46
|
* This allows usage of controller.use with controllers that don't have exports
|
|
47
47
|
*/
|
|
48
48
|
type NotNever<T extends {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isEsriInternalEnv } from "@arcgis/
|
|
2
|
-
import { r as retrieveComponent
|
|
1
|
+
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
+
import { r as retrieveComponent } from "../../ControllerInternals-CWQrfEA8.js";
|
|
3
3
|
import { on, watch } from "@arcgis/core/core/reactiveUtils.js";
|
|
4
|
-
import {
|
|
4
|
+
import { a as createEventFactory, G as GenericController, d as trackPropKey, t as trackKey } from "../../Controller-ftAEcdmI.js";
|
|
5
|
+
import { p as proxyExports } from "../../proxyExports-D906TEtL.js";
|
|
5
6
|
import { createObservable, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
|
|
6
7
|
import { property, subclass } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
7
8
|
import Accessor from "@arcgis/core/core/Accessor.js";
|
|
@@ -22,6 +23,7 @@ class AccessorController extends GenericController {
|
|
|
22
23
|
constructor(component, createInstance) {
|
|
23
24
|
super(component);
|
|
24
25
|
this.Y = /* @__PURE__ */ new Map();
|
|
26
|
+
this.A = void 0;
|
|
25
27
|
this.#exportsObservable = createObservable();
|
|
26
28
|
const that = this;
|
|
27
29
|
that.#createInstance = createInstance;
|
|
@@ -107,9 +109,12 @@ const makeBinderProxy = (component, accessorControllerRef, accessorControllerInd
|
|
|
107
109
|
) {
|
|
108
110
|
return value;
|
|
109
111
|
}
|
|
112
|
+
const accessorController = component.M[accessorControllerIndex];
|
|
113
|
+
accessorController.A = propertyName;
|
|
110
114
|
return trackKey(
|
|
111
115
|
component,
|
|
112
116
|
(resolved) => {
|
|
117
|
+
accessorController.A = void 0;
|
|
113
118
|
if (resolved !== void 0) {
|
|
114
119
|
const propName = resolved.key;
|
|
115
120
|
boundProperties.set(propertyName, propName);
|
|
@@ -120,15 +125,15 @@ const makeBinderProxy = (component, accessorControllerRef, accessorControllerInd
|
|
|
120
125
|
if (!(propertyName in instance)) {
|
|
121
126
|
throw new Error(`"${propertyName}" does not exist on the accessor instance`);
|
|
122
127
|
}
|
|
123
|
-
const
|
|
128
|
+
const accessorController2 = component.M[accessorControllerIndex];
|
|
124
129
|
if (descriptor.i !== void 0 && descriptor.i !== accessorControllerIndex) {
|
|
125
|
-
console.error(component.M[descriptor.i],
|
|
130
|
+
console.error(component.M[descriptor.i], accessorController2);
|
|
126
131
|
throw Error(
|
|
127
132
|
`Expected property "${propName}" to be bound to the controller at index ${descriptor.i}, but tried to bind it to a controller at index ${accessorControllerIndex}. Double check whether you are calling useAccessor() conditionally in a way that is not supported.`
|
|
128
133
|
);
|
|
129
134
|
}
|
|
130
|
-
if (
|
|
131
|
-
console.error(
|
|
135
|
+
if (accessorController2 !== accessorControllerRef.deref()) {
|
|
136
|
+
console.error(accessorController2);
|
|
132
137
|
throw Error(
|
|
133
138
|
`Expected controller at index ${accessorControllerIndex} to be instance of useAccessor but it is not.`
|
|
134
139
|
);
|
|
@@ -156,13 +161,6 @@ const makeBinderProxy = (component, accessorControllerRef, accessorControllerInd
|
|
|
156
161
|
},
|
|
157
162
|
value
|
|
158
163
|
);
|
|
159
|
-
},
|
|
160
|
-
set(_target, propertyName, newValue) {
|
|
161
|
-
if (boundProperties.has(propertyName) || // But some properties may be never bound, yet set in the constructor - let them through
|
|
162
|
-
newValue !== (instance[propertyName] ?? void 0)) {
|
|
163
|
-
instance[propertyName] = newValue;
|
|
164
|
-
}
|
|
165
|
-
return true;
|
|
166
164
|
}
|
|
167
165
|
});
|
|
168
166
|
const watchBoundProperty = (controllerRef, descriptor, propertyName, propName, shouldFlipBoolean, _handle) => _handle = watch(
|
|
@@ -199,7 +197,10 @@ const bindPropToProperty = (descriptor, accessorControllerIndex, propertyName, s
|
|
|
199
197
|
return shouldFlipBoolean ? !value : value;
|
|
200
198
|
};
|
|
201
199
|
descriptor.d.set = function(newValue) {
|
|
202
|
-
this.M[accessorControllerIndex]
|
|
200
|
+
const accessorController = this.M[accessorControllerIndex];
|
|
201
|
+
if (accessorController.A !== propertyName) {
|
|
202
|
+
accessorController.exports[propertyName] = shouldFlipBoolean ? !newValue : newValue;
|
|
203
|
+
}
|
|
203
204
|
};
|
|
204
205
|
};
|
|
205
206
|
const getAccessorControllerBoundProperties = (controller) => controller.Y;
|
|
@@ -212,10 +213,15 @@ const reCreateAccessor = (instance, component) => {
|
|
|
212
213
|
console.error("Unable to resolve the useAccessor controller from the provided value");
|
|
213
214
|
}
|
|
214
215
|
};
|
|
215
|
-
const createStore = (
|
|
216
|
+
const createStore = (initializer) => {
|
|
216
217
|
const SubClass = class extends Accessor {
|
|
217
218
|
};
|
|
218
|
-
|
|
219
|
+
const defaultValues = typeof initializer === "function" ? initializer() : initializer;
|
|
220
|
+
const descriptors = Object.getOwnPropertyDescriptors(defaultValues);
|
|
221
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
222
|
+
Object.defineProperty(SubClass.prototype, key, descriptor);
|
|
223
|
+
property()(SubClass.prototype, key);
|
|
224
|
+
}
|
|
219
225
|
const State = subclass()(SubClass);
|
|
220
226
|
return new State();
|
|
221
227
|
};
|
|
@@ -2,9 +2,9 @@ import { default as Accessor } from '@arcgis/core/core/Accessor.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* See https://qawebgis.esri.com/components/lumina/controllers/useAccessor#createstore-utility
|
|
4
4
|
*/
|
|
5
|
-
export declare const createStore: <T extends
|
|
5
|
+
export declare const createStore: <T extends object>(initializer: T | (() => T)) => __esri.Accessor & T;
|
|
6
6
|
/** @deprecated Use {@link createStore} instead */
|
|
7
|
-
export declare const createLegacyStore: <T extends
|
|
7
|
+
export declare const createLegacyStore: <T extends object>(defaultState: T | (() => T)) => ObservableMap<T>;
|
|
8
8
|
/** @deprecated Use {@link createStore} instead */
|
|
9
9
|
export type ObservableMap<T> = {
|
|
10
10
|
state: Accessor & T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GenericController } from '../Controller';
|
|
2
2
|
import { LitElement } from '../../LitElement';
|
|
3
3
|
type Requires<Props, Accessor extends __esri.Accessor, OmitProps extends string = never> = LitElement & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps> & {
|
|
4
4
|
autoDestroyDisabled: boolean;
|
|
@@ -46,6 +46,8 @@ export declare class AccessorController<Props, Accessor extends __esri.Accessor,
|
|
|
46
46
|
* @private
|
|
47
47
|
*/
|
|
48
48
|
_boundAccessorProperties: Map<string & keyof Accessor, string>;
|
|
49
|
+
/** @private */
|
|
50
|
+
_currentlyBindingPropertyName?: string;
|
|
49
51
|
/**
|
|
50
52
|
* (development only) Allow these props to mismatch the name of the Accessor's
|
|
51
53
|
* property to avoid collisions
|
|
@@ -61,8 +63,11 @@ export declare class AccessorController<Props, Accessor extends __esri.Accessor,
|
|
|
61
63
|
hostConnected(): void;
|
|
62
64
|
hostDestroy(): void;
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
type MinimalAccessorController = Pick<AccessorController<never, __esri.Accessor>, "_currentlyBindingPropertyName" | "exports"> & {
|
|
67
|
+
component: LitElement;
|
|
68
|
+
};
|
|
69
|
+
export declare const makeBinderProxy: (component: LitElement, accessorControllerRef: WeakRef<MinimalAccessorController & {
|
|
70
|
+
constructor: MinimalAccessorController["constructor"] & {
|
|
66
71
|
devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
|
|
67
72
|
};
|
|
68
73
|
}>, accessorControllerIndex: number, instance: __esri.Accessor, boundProperties: Map<string, string>) => unknown;
|
|
@@ -3,7 +3,7 @@ export type { GenericControllerType } from './Controller';
|
|
|
3
3
|
export { Controller, GenericController } from './Controller';
|
|
4
4
|
export type { ControllerManager } from './ControllerManager';
|
|
5
5
|
export { retrieveComponent, bypassSetter, bypassReadOnly } from './ControllerInternals';
|
|
6
|
-
export { trackPropertyKey,
|
|
6
|
+
export { trackPropertyKey, propertyTrackResolve } from './trackPropertyKey';
|
|
7
7
|
export { trackPropKey } from './trackPropKey';
|
|
8
8
|
export { trackKey } from './trackKey';
|
|
9
9
|
export { makeController, makeGenericController } from './functional';
|
|
@@ -22,3 +22,7 @@ export { isController, getControllersCount } from './utils';
|
|
|
22
22
|
* @deprecated import from "@arcgis/lumina" instead
|
|
23
23
|
*/
|
|
24
24
|
export type EventEmitter<T = undefined> = _EventEmitter<T>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Let us know if someone is using this
|
|
27
|
+
*/
|
|
28
|
+
export declare const keyTrackResolve: () => void;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { C as Controller,
|
|
2
|
-
import { G,
|
|
3
|
-
import {
|
|
1
|
+
import { C as Controller, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-ftAEcdmI.js";
|
|
2
|
+
import { G, d, b } from "../Controller-ftAEcdmI.js";
|
|
3
|
+
import { s as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-CWQrfEA8.js";
|
|
4
|
+
import { f, e, c, h, g } from "../ControllerInternals-CWQrfEA8.js";
|
|
5
|
+
import { p as proxyExports } from "../proxyExports-D906TEtL.js";
|
|
4
6
|
import { isServer } from "lit";
|
|
5
|
-
import {
|
|
7
|
+
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
8
|
+
import { observeAncestorsMutation, getElementAttribute } from "@arcgis/toolkit/dom";
|
|
9
|
+
import { getElementLocale, startLocaleObserver } from "@arcgis/toolkit/intl";
|
|
6
10
|
const makeController = (constructor) => proxy(void 0, constructor);
|
|
7
11
|
const makeGenericController = (constructor) => (component) => proxy(
|
|
8
12
|
component,
|
|
9
13
|
/**
|
|
10
14
|
* GenericController is identical to Controller, in all except for typing.
|
|
11
|
-
* So
|
|
15
|
+
* So doing a type-cast here so as not to needlessly add one more object
|
|
12
16
|
* to the prototype chain
|
|
13
17
|
*/
|
|
14
18
|
constructor
|
|
@@ -127,7 +131,7 @@ const useDirection = () => makeController((component, controller) => {
|
|
|
127
131
|
(resolved) => {
|
|
128
132
|
if (resolved?.key === "dir") {
|
|
129
133
|
throw new Error(
|
|
130
|
-
|
|
134
|
+
"Do not assign this controller to a prop called `dir` as that will overwrite the HTMLElement's built-in `dir` attribute - component should not be setting the `dir` attribute on itself. Instead, assign this controller to a property called `direction`."
|
|
131
135
|
);
|
|
132
136
|
}
|
|
133
137
|
},
|
|
@@ -139,7 +143,7 @@ const useDirection = () => makeController((component, controller) => {
|
|
|
139
143
|
const makeT9nController = (getAssetPath) => (options = {}) => (
|
|
140
144
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
141
145
|
makeController((component, controller) => {
|
|
142
|
-
const locale =
|
|
146
|
+
const locale = getElementLocale(component.el);
|
|
143
147
|
const pending = { ["_lang"]: locale.lang, ["_t9nLocale"]: locale.t9nLocale, ["_loading"]: true };
|
|
144
148
|
const componentWithOverrides = component;
|
|
145
149
|
controller.onLifecycle(
|
|
@@ -244,25 +248,27 @@ const propertyChangeController = (...toWatch) => {
|
|
|
244
248
|
}
|
|
245
249
|
return eventEmitter;
|
|
246
250
|
};
|
|
251
|
+
const keyTrackResolve = propertyTrackResolve;
|
|
247
252
|
export {
|
|
248
253
|
Controller,
|
|
249
254
|
G as GenericController,
|
|
250
|
-
|
|
251
|
-
|
|
255
|
+
f as bypassReadOnly,
|
|
256
|
+
e as bypassSetter,
|
|
252
257
|
c as controllerSymbol,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
258
|
+
h as getControllersCount,
|
|
259
|
+
g as isController,
|
|
260
|
+
keyTrackResolve,
|
|
256
261
|
load,
|
|
257
262
|
makeController,
|
|
258
263
|
makeGenericController,
|
|
259
264
|
makeT9nController,
|
|
265
|
+
propertyTrackResolve,
|
|
260
266
|
proxyExports,
|
|
261
267
|
retrieveComponent,
|
|
262
268
|
toFunction,
|
|
263
269
|
trackKey,
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
d as trackPropKey,
|
|
271
|
+
b as trackPropertyKey,
|
|
266
272
|
useDirection,
|
|
267
273
|
useMedia,
|
|
268
274
|
usePropertyChange,
|
|
@@ -26,4 +26,4 @@ export declare const trackPropertyKey: <T>(object: BaseController | LitElement,
|
|
|
26
26
|
* property you are trying to resolve had it's default value set, thus after
|
|
27
27
|
* constructor. At the start of connectedCallback is a perfect place.
|
|
28
28
|
*/
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const propertyTrackResolve: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHandle } from '@arcgis/
|
|
1
|
+
import { IHandle } from '@arcgis/toolkit/type';
|
|
2
2
|
import { ReactiveControllerHost, ReactiveController, PropertyDeclaration, PropertyValues } from 'lit';
|
|
3
3
|
import { LitElement } from '../LitElement';
|
|
4
4
|
export type TrackKeyResolution = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GenericT9nStrings,
|
|
1
|
+
import { GenericT9nStrings, LocaleObserverResult } from '@arcgis/toolkit/intl';
|
|
2
2
|
export type T9nMeta<T9nStrings extends GenericT9nStrings> = {
|
|
3
|
-
_lang:
|
|
4
|
-
_t9nLocale:
|
|
3
|
+
_lang: LocaleObserverResult["lang"];
|
|
4
|
+
_t9nLocale: LocaleObserverResult["t9nLocale"];
|
|
5
5
|
_loading: boolean;
|
|
6
6
|
/**
|
|
7
7
|
* The "_overrides" property won't actually exist at runtime and exists only
|
package/dist/hmrSupport.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-
|
|
2
|
-
import { camelToKebab } from "@arcgis/
|
|
1
|
+
import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-B6Te7FRR.js";
|
|
2
|
+
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
3
3
|
function handleHmrUpdate(newModules) {
|
|
4
4
|
newModules.forEach((newModule) => {
|
|
5
5
|
if (newModule === void 0) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { useContextProvider, useContextConsumer } from './context';
|
|
2
1
|
export type { EventEmitter, EventOptions } from './createEvent';
|
|
3
2
|
export { createEvent } from './createEvent';
|
|
4
3
|
export { state, property, method } from './decorators';
|
|
@@ -10,7 +9,7 @@ export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalCompon
|
|
|
10
9
|
export { makeRuntime } from './makeRuntime';
|
|
11
10
|
export type { EventHandler } from './jsx/baseTypes';
|
|
12
11
|
export * from './jsx/types';
|
|
13
|
-
export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
|
|
12
|
+
export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, stabilizedRef, directive, live, } from './jsx/directives';
|
|
14
13
|
export { nothing, noChange, setAttribute, stringOrBoolean } from './jsx/utils';
|
|
15
14
|
export { noShadowRoot, devOnly$getLitElementTagNameAndRuntime } from './utils';
|
|
16
15
|
export { makeReactWrapperFactory, getReactWrapperOptions } from './wrappersUtils';
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { b } from "./Controller-BQOv8BAL.js";
|
|
1
|
+
import { G as GenericController, p as propertyTrackResolve } from "./Controller-ftAEcdmI.js";
|
|
2
|
+
import { c } from "./Controller-ftAEcdmI.js";
|
|
4
3
|
import { state } from "@lit/reactive-element/decorators/state.js";
|
|
5
4
|
import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
|
|
6
|
-
import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-
|
|
7
|
-
import { d, m } from "./lazyLoad-
|
|
8
|
-
import { isEsriInternalEnv, safeCall,
|
|
5
|
+
import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-B6Te7FRR.js";
|
|
6
|
+
import { d, m } from "./lazyLoad-B6Te7FRR.js";
|
|
7
|
+
import { isEsriInternalEnv, safeCall, safeAsyncCall } from "@arcgis/toolkit/error";
|
|
8
|
+
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
9
|
+
import { devToolsAwareTimeout, Deferred } from "@arcgis/toolkit/promise";
|
|
9
10
|
import { nothing as nothing$1, LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1 } from "lit";
|
|
11
|
+
import { s as setAmbientComponent, c as controllerSymbol, a as shouldBypassReadOnly } from "./ControllerInternals-CWQrfEA8.js";
|
|
10
12
|
import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
|
|
11
13
|
import { classMap } from "lit-html/directives/class-map.js";
|
|
12
14
|
import { styleMap } from "lit/directives/style-map.js";
|
|
13
15
|
import { directive as directive$1, Directive } from "lit-html/directive.js";
|
|
14
16
|
import { live as live$1 } from "lit-html/directives/live.js";
|
|
17
|
+
import { ref } from "lit/directives/ref.js";
|
|
15
18
|
import { nothing as nothing$2, noChange as noChange$2, render } from "lit-html";
|
|
16
|
-
const useContextProvider = (options) => {
|
|
17
|
-
const component = retrieveComponent();
|
|
18
|
-
const controller = new ContextProvider(component.el, options);
|
|
19
|
-
component.addController(controller);
|
|
20
|
-
return controller;
|
|
21
|
-
};
|
|
22
|
-
const useContextConsumer = (options) => {
|
|
23
|
-
const component = retrieveComponent();
|
|
24
|
-
const controller = new ContextConsumer(component.el, options);
|
|
25
|
-
component.addController(controller);
|
|
26
|
-
return controller;
|
|
27
|
-
};
|
|
28
19
|
const property = property$1;
|
|
29
20
|
const method = void 0;
|
|
30
21
|
class ControllerManager extends GenericController {
|
|
@@ -57,7 +48,7 @@ class ControllerManager extends GenericController {
|
|
|
57
48
|
if (this.#autoDestroyTimeout !== void 0) {
|
|
58
49
|
clearTimeout(this.#autoDestroyTimeout);
|
|
59
50
|
}
|
|
60
|
-
|
|
51
|
+
propertyTrackResolve();
|
|
61
52
|
for (const controller of component.M) {
|
|
62
53
|
if ("triggerConnected" in controller) {
|
|
63
54
|
controller.triggerConnected();
|
|
@@ -331,6 +322,7 @@ class LitElement extends LitElement$1 {
|
|
|
331
322
|
this.#observables?.get(name)?.notify();
|
|
332
323
|
}
|
|
333
324
|
if (manager.T.length > 0) {
|
|
325
|
+
propertyTrackResolve();
|
|
334
326
|
manager?.S(name, rawNewValue);
|
|
335
327
|
}
|
|
336
328
|
}
|
|
@@ -401,10 +393,10 @@ class LitElement extends LitElement$1 {
|
|
|
401
393
|
const options = Class.shadowRootOptions;
|
|
402
394
|
const useLightDom = options === noShadowRoot;
|
|
403
395
|
const renderRoot = existingShadowRoot ?? (useLightDom ? this.el : this.el.attachShadow(options));
|
|
404
|
-
if (existingShadowRoot
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
396
|
+
if (existingShadowRoot && // The shadow root may already exist if we are doing HMR - such case is not
|
|
397
|
+
// SSR so ignore it
|
|
398
|
+
process.env.NODE_ENV !== "production" && (this.el.constructor.devOnly$hmrIndex ?? 0) === 0) {
|
|
399
|
+
LitElement$1.prototype.createRenderRoot.call(this);
|
|
408
400
|
return existingShadowRoot;
|
|
409
401
|
}
|
|
410
402
|
if (this.isConnected) {
|
|
@@ -593,6 +585,25 @@ class DeferLoad extends Directive {
|
|
|
593
585
|
}
|
|
594
586
|
const deferLoad = /* @__PURE__ */ directive$1(DeferLoad)();
|
|
595
587
|
const deferredLoaders = /* @__PURE__ */ new Map();
|
|
588
|
+
class StabilizedRef extends Directive {
|
|
589
|
+
#refValue;
|
|
590
|
+
#callback;
|
|
591
|
+
constructor(partInfo) {
|
|
592
|
+
super(partInfo);
|
|
593
|
+
const that = this;
|
|
594
|
+
this.#callback = function ref2(element) {
|
|
595
|
+
return that.#refValue.call(this, element);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
render(refValue) {
|
|
599
|
+
if (typeof refValue === "function") {
|
|
600
|
+
this.#refValue = refValue;
|
|
601
|
+
return ref(this.#callback);
|
|
602
|
+
}
|
|
603
|
+
return ref(refValue);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
const stabilizedRef = directive$1(StabilizedRef);
|
|
596
607
|
const directive = directive$1;
|
|
597
608
|
const live = live$1;
|
|
598
609
|
const nothing = nothing$2;
|
|
@@ -662,7 +673,7 @@ export {
|
|
|
662
673
|
bindBooleanAttribute,
|
|
663
674
|
bindEvent,
|
|
664
675
|
bindProperty,
|
|
665
|
-
|
|
676
|
+
c as createEvent,
|
|
666
677
|
deferLoad,
|
|
667
678
|
deferredLoaders,
|
|
668
679
|
d as devOnly$getLitElementTagNameAndRuntime,
|
|
@@ -681,8 +692,7 @@ export {
|
|
|
681
692
|
safeClassMap,
|
|
682
693
|
safeStyleMap,
|
|
683
694
|
setAttribute,
|
|
695
|
+
stabilizedRef,
|
|
684
696
|
state,
|
|
685
|
-
stringOrBoolean
|
|
686
|
-
useContextConsumer,
|
|
687
|
-
useContextProvider
|
|
697
|
+
stringOrBoolean
|
|
688
698
|
};
|
package/dist/jsx/directives.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nil } from '@arcgis/toolkit/type';
|
|
2
2
|
import { Properties as CssProperties } from 'csstype';
|
|
3
3
|
import { ClassInfo } from 'lit-html/directives/class-map.js';
|
|
4
4
|
import { DirectiveResult } from 'lit/directive.js';
|
|
5
5
|
import { ClassMapDirective } from 'lit/directives/class-map.js';
|
|
6
6
|
import { StyleMapDirective } from 'lit/directives/style-map.js';
|
|
7
|
-
import { DirectiveClass, ElementPart, Directive } from 'lit-html/directive.js';
|
|
7
|
+
import { DirectiveClass, ElementPart, PartInfo, Directive } from 'lit-html/directive.js';
|
|
8
8
|
import { noChange } from 'lit';
|
|
9
|
+
import { CustomAttributes } from './baseTypes';
|
|
10
|
+
import { RefDirective } from 'lit/directives/ref.js';
|
|
9
11
|
/**
|
|
10
12
|
* You likely won't have to import this directly. It will be added during
|
|
11
13
|
* _JSX to lit-html_ conversion.
|
|
@@ -30,7 +32,7 @@ import { noChange } from 'lit';
|
|
|
30
32
|
*
|
|
31
33
|
* @private
|
|
32
34
|
*/
|
|
33
|
-
export declare const safeClassMap: (parameters: ClassInfo |
|
|
35
|
+
export declare const safeClassMap: (parameters: ClassInfo | nil | string) => DirectiveResult<typeof ClassMapDirective> | nil | string;
|
|
34
36
|
/**
|
|
35
37
|
* You likely won't have to import this directly. It will be added during
|
|
36
38
|
* _JSX to lit-html_ conversion.
|
|
@@ -55,7 +57,7 @@ export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => Dir
|
|
|
55
57
|
*
|
|
56
58
|
* @private
|
|
57
59
|
*/
|
|
58
|
-
export declare const safeStyleMap: (parameters: CssProperties |
|
|
60
|
+
export declare const safeStyleMap: (parameters: CssProperties | nil | string) => DirectiveResult<typeof StyleMapDirective> | nil | string;
|
|
59
61
|
declare class DeferLoad extends Directive {
|
|
60
62
|
update(part: ElementPart): void;
|
|
61
63
|
render(): typeof noChange;
|
|
@@ -72,6 +74,33 @@ export declare const deferLoad: DirectiveResult<typeof DeferLoad>;
|
|
|
72
74
|
* [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
|
|
73
75
|
*/
|
|
74
76
|
export declare const deferredLoaders: Map<string, () => Promise<unknown>>;
|
|
77
|
+
declare class StabilizedRef extends Directive {
|
|
78
|
+
#private;
|
|
79
|
+
constructor(partInfo: PartInfo);
|
|
80
|
+
render(refValue: CustomAttributes<Element>["ref"]): DirectiveResult<typeof RefDirective>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Because of how Lit's ref() works, there are two requirements on ref
|
|
84
|
+
* function:
|
|
85
|
+
* - It must be stable between re-renders (else Lit will call it twice on each
|
|
86
|
+
* render() - with undefined and then with element)
|
|
87
|
+
* - Each element must have a unique instance of this function - if two
|
|
88
|
+
* elements share the same ref function, on each render Lit will call
|
|
89
|
+
* it multiple times (undefined, element1, undefined, element2)
|
|
90
|
+
*
|
|
91
|
+
* The `stabilizedRef` directive resolves both of these requirements by creating
|
|
92
|
+
* a stable wrapper function for the ref callback.
|
|
93
|
+
*
|
|
94
|
+
* @private
|
|
95
|
+
* Lumina will insert this directive automatically when the `ref` JSX prop is
|
|
96
|
+
* authored in a way that clearly creates a new function on each render:
|
|
97
|
+
* ```tsx
|
|
98
|
+
* <my-component ref={(el) => this.myComponent = el} />
|
|
99
|
+
* <my-component ref={this.callback.bind(this, index)} />
|
|
100
|
+
* ```
|
|
101
|
+
* @deprecated See https://discord.com/channels/1012791295170859069/1047015641225371718
|
|
102
|
+
*/
|
|
103
|
+
export declare const stabilizedRef: <T extends Element>(refValue: CustomAttributes<T>["ref"]) => DirectiveResult<typeof StabilizedRef>;
|
|
75
104
|
/**
|
|
76
105
|
* Creates a user-facing directive function from a Directive class. This
|
|
77
106
|
* function has the same parameters as the directive's render() method.
|
|
@@ -511,6 +511,7 @@ export interface AriaAttributes {
|
|
|
511
511
|
* @see aria-controls
|
|
512
512
|
*/
|
|
513
513
|
["aria-owns"]?: string;
|
|
514
|
+
ariaActiveDescendantElement?: Element;
|
|
514
515
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */
|
|
515
516
|
ariaAtomic?: boolean | "false" | "true";
|
|
516
517
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */
|
|
@@ -529,14 +530,19 @@ export interface AriaAttributes {
|
|
|
529
530
|
ariaColIndex?: number | string;
|
|
530
531
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */
|
|
531
532
|
ariaColSpan?: number | string;
|
|
533
|
+
ariaControlsElements?: Element[];
|
|
532
534
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */
|
|
533
535
|
ariaCurrent?: boolean | "date" | "false" | "location" | "page" | "step" | "time" | "true";
|
|
536
|
+
ariaDescribedByElements?: Element[];
|
|
534
537
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */
|
|
535
538
|
ariaDescription?: string;
|
|
539
|
+
ariaDetailsElements?: Element[];
|
|
536
540
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */
|
|
537
541
|
ariaDisabled?: boolean | "false" | "true";
|
|
542
|
+
ariaErrorMessageElement?: Element;
|
|
538
543
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */
|
|
539
544
|
ariaExpanded?: boolean | "false" | "true";
|
|
545
|
+
ariaFlowToElements?: Element[];
|
|
540
546
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */
|
|
541
547
|
ariaHasPopup?: boolean | "dialog" | "false" | "grid" | "listbox" | "menu" | "tree" | "true";
|
|
542
548
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */
|
|
@@ -550,6 +556,7 @@ export interface AriaAttributes {
|
|
|
550
556
|
ariaKeyShortcuts?: string;
|
|
551
557
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */
|
|
552
558
|
ariaLabel?: string;
|
|
559
|
+
ariaLabelledByElements?: Element[];
|
|
553
560
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */
|
|
554
561
|
ariaLevel?: number | string;
|
|
555
562
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */
|
|
@@ -562,6 +569,7 @@ export interface AriaAttributes {
|
|
|
562
569
|
ariaMultiSelectable?: boolean | "false" | "true";
|
|
563
570
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */
|
|
564
571
|
ariaOrientation?: "horizontal" | "vertical";
|
|
572
|
+
ariaOwnsElements?: Element[];
|
|
565
573
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */
|
|
566
574
|
ariaPlaceholder?: string;
|
|
567
575
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */
|
|
@@ -635,11 +643,11 @@ export interface HTMLAttributes<T = HTMLElement> extends AriaAttributes, DOMAttr
|
|
|
635
643
|
inert?: boolean;
|
|
636
644
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/inputMode) */
|
|
637
645
|
inputMode?: "decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url";
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
646
|
+
itemid?: string;
|
|
647
|
+
itemprop?: string;
|
|
648
|
+
itemref?: string;
|
|
649
|
+
itemscope?: boolean;
|
|
650
|
+
itemtype?: string;
|
|
643
651
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/lang) */
|
|
644
652
|
lang?: string;
|
|
645
653
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/nonce) */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { isEsriInternalEnv
|
|
1
|
+
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
+
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
3
|
+
import { Deferred } from "@arcgis/toolkit/promise";
|
|
2
4
|
import { lazyMetaGroupJoiner, lazyMetaItemJoiner, lazyMetaSubItemJoiner } from "./config.js";
|
|
3
5
|
function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
4
6
|
const genericPrototype = LitClass.prototype;
|
|
@@ -276,7 +278,10 @@ class ProxyComponent extends HtmlElement {
|
|
|
276
278
|
this.#pendingAttributes.push(name);
|
|
277
279
|
}
|
|
278
280
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
279
|
-
this
|
|
281
|
+
const isReflecting = this.#litElement?.["__reflectingProperty"] === name;
|
|
282
|
+
if (!isReflecting) {
|
|
283
|
+
this.devOnly$hmrSetAttributes.add(name);
|
|
284
|
+
}
|
|
280
285
|
}
|
|
281
286
|
}
|
|
282
287
|
connectedCallback() {
|
package/dist/lazyLoad.d.ts
CHANGED
package/dist/makeRuntime.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export type RuntimeOptions = {
|
|
|
102
102
|
*/
|
|
103
103
|
readonly defaultAssetPath: string;
|
|
104
104
|
/**
|
|
105
|
-
* The attribute that indicates a component has rendered
|
|
105
|
+
* The attribute that indicates a component has rendered its content.
|
|
106
106
|
* Usually this attribute is added after your component's `loaded()` lifecycle
|
|
107
107
|
* happened. However, during SSR, "hydrated" is added right away on the
|
|
108
108
|
* server.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as setParentController, d as retrieveParentControllers, j as setAmbientChildController, f as bypassReadOnly } from "./ControllerInternals-CWQrfEA8.js";
|
|
2
|
+
import { t as trackKey } from "./Controller-ftAEcdmI.js";
|
|
2
3
|
const proxyExports = (Class) => (...args) => {
|
|
3
4
|
const ambientControllers = retrieveParentControllers();
|
|
4
5
|
const instance = new Class(...args);
|
package/dist/render.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { JsxNode } from './jsx/types';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieve an HTML element to be manually appended to an existing component.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const fullScreen = renderElement(<arcgis-fullscreen />);
|
|
8
|
+
* document.body.appendChild(fullScreen);
|
|
9
|
+
* ```
|
|
4
10
|
*/
|
|
5
11
|
export declare const renderElement: <Element extends HTMLElement = HTMLElement>(element: JsxNode) => Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/lumina",
|
|
3
|
-
"version": "4.34.0-next.
|
|
3
|
+
"version": "4.34.0-next.90",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
10
10
|
"./config": "./dist/config.js",
|
|
11
|
+
"./context": "./dist/context.js",
|
|
11
12
|
"./hmrSupport": "./dist/hmrSupport.js",
|
|
12
|
-
"./stencilSsrCompatibility": "./dist/stencilSsrCompatibility/index.js",
|
|
13
13
|
"./typings": {
|
|
14
14
|
"types": "./dist/typings/index.d.ts"
|
|
15
15
|
},
|
|
@@ -22,12 +22,17 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@arcgis/
|
|
26
|
-
"@lit-labs/ssr": "^3.2.2",
|
|
27
|
-
"@lit-labs/ssr-client": "^1.1.7",
|
|
28
|
-
"@lit/context": "^1.1.5",
|
|
25
|
+
"@arcgis/toolkit": "4.34.0-next.90",
|
|
29
26
|
"csstype": "^3.1.3",
|
|
30
|
-
"lit": "^3.3.0",
|
|
31
27
|
"tslib": "^2.8.1"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@lit/context": "^1.1.5",
|
|
31
|
+
"lit": "^3.3.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@lit/context": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { RenderInfo } from '@lit-labs/ssr/lib/render.js';
|
|
2
|
-
import { Readable } from 'node:stream';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
* Use `render` from `@lit-labs/ssr` instead.
|
|
6
|
-
*
|
|
7
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
8
|
-
*/
|
|
9
|
-
export interface HydrateResults {
|
|
10
|
-
buildId: string;
|
|
11
|
-
diagnostics: any[];
|
|
12
|
-
url: string;
|
|
13
|
-
host: string;
|
|
14
|
-
hostname: string;
|
|
15
|
-
href: string;
|
|
16
|
-
port: string;
|
|
17
|
-
pathname: string;
|
|
18
|
-
search: string;
|
|
19
|
-
hash: string;
|
|
20
|
-
html: string;
|
|
21
|
-
components: HydrateComponent[];
|
|
22
|
-
anchors: any[];
|
|
23
|
-
imgs: any[];
|
|
24
|
-
scripts: any[];
|
|
25
|
-
styles: any[];
|
|
26
|
-
staticData: any[];
|
|
27
|
-
title: string;
|
|
28
|
-
hydratedCount: number;
|
|
29
|
-
httpStatus: number;
|
|
30
|
-
}
|
|
31
|
-
export interface HydrateComponent {
|
|
32
|
-
tag: string;
|
|
33
|
-
mode: string;
|
|
34
|
-
count: number;
|
|
35
|
-
depth: number;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated
|
|
39
|
-
* Use `getWindow` from `@lit-labs/ssr/lib/dom-shim` instead.
|
|
40
|
-
*
|
|
41
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
42
|
-
*/
|
|
43
|
-
export declare function createWindowFromHtml(templateHtml: string, uniqueId?: string): any;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated
|
|
46
|
-
* Use `RenderResultReadable` from `@lit-labs/ssr` instead.
|
|
47
|
-
*
|
|
48
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
49
|
-
*/
|
|
50
|
-
export declare function streamToString(html: any, options?: Partial<RenderInfo>): Readable;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated
|
|
53
|
-
* Use `render` from `@lit-labs/ssr` instead.
|
|
54
|
-
*
|
|
55
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
56
|
-
*/
|
|
57
|
-
export declare function renderToString(html: any, options?: Partial<RenderInfo>): Promise<HydrateResults>;
|
|
58
|
-
export declare function renderToString(html: any, options: Partial<RenderInfo> | undefined, asStream: true): Readable;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated
|
|
61
|
-
* Use `render` from `@lit-labs/ssr` instead.
|
|
62
|
-
*
|
|
63
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
64
|
-
*/
|
|
65
|
-
export declare function hydrateDocument(doc: any, options?: Partial<RenderInfo>): Promise<HydrateResults>;
|
|
66
|
-
export declare function hydrateDocument(doc: any, options: Partial<RenderInfo> | undefined, asStream: true): Readable;
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated
|
|
69
|
-
* Use `render` from `@lit-labs/ssr` instead.
|
|
70
|
-
*
|
|
71
|
-
* @see https://lit.dev/docs/ssr/server-usage/
|
|
72
|
-
*/
|
|
73
|
-
export declare function serializeDocumentToString(doc: any, _unused?: unknown): string;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { getWindow } from "@lit-labs/ssr/lib/dom-shim.js";
|
|
2
|
-
import { render } from "@lit-labs/ssr/lib/render.js";
|
|
3
|
-
import { html } from "@lit-labs/ssr/lib/server-template.js";
|
|
4
|
-
import { withStatic, unsafeStatic } from "lit-html/static.js";
|
|
5
|
-
import { collectResult } from "@lit-labs/ssr/lib/render-result.js";
|
|
6
|
-
import { RenderResultReadable } from "@lit-labs/ssr/lib/render-result-readable.js";
|
|
7
|
-
const staticHtml = withStatic(html);
|
|
8
|
-
function createWindowFromHtml(templateHtml, uniqueId = Math.random().toString()) {
|
|
9
|
-
const window = getWindow({ includeJSBuiltIns: true });
|
|
10
|
-
window.document.defaultView = window;
|
|
11
|
-
window.document.templateHtml = templateHtml;
|
|
12
|
-
window.document.buildId = uniqueId;
|
|
13
|
-
return window;
|
|
14
|
-
}
|
|
15
|
-
function streamToString(html2, options) {
|
|
16
|
-
const { result } = getRenderResult(html2, options);
|
|
17
|
-
return new RenderResultReadable(result);
|
|
18
|
-
}
|
|
19
|
-
function getRenderResult(rawSource, options) {
|
|
20
|
-
const maybeDocument = typeof rawSource === "object" && rawSource !== null ? "document" in rawSource ? rawSource.document : rawSource : void 0;
|
|
21
|
-
const source = maybeDocument && "templateHtml" in maybeDocument ? maybeDocument.templateHtml : maybeDocument && "documentElement" in maybeDocument ? maybeDocument.documentElement?.outerHTML ?? maybeDocument : rawSource;
|
|
22
|
-
const renderTemplate = typeof source === "string" ? staticHtml`${unsafeStatic(source)}` : source;
|
|
23
|
-
const tagNames = [];
|
|
24
|
-
const result = render(renderTemplate, {
|
|
25
|
-
customElementRendered(tagName) {
|
|
26
|
-
tagNames.push(tagName);
|
|
27
|
-
},
|
|
28
|
-
...options
|
|
29
|
-
});
|
|
30
|
-
return { result, maybeDocument, tagNames };
|
|
31
|
-
}
|
|
32
|
-
function renderToString(html2, options, asStream = false) {
|
|
33
|
-
if (asStream) {
|
|
34
|
-
return streamToString(html2, options);
|
|
35
|
-
} else {
|
|
36
|
-
return resultsToString(html2, options);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async function resultsToString(html2, options) {
|
|
40
|
-
const { result, tagNames, maybeDocument } = getRenderResult(html2, options);
|
|
41
|
-
const collected = await collectResult(result);
|
|
42
|
-
const renderResult = {
|
|
43
|
-
buildId: maybeDocument?.buildId ?? Math.random().toString(),
|
|
44
|
-
diagnostics: [],
|
|
45
|
-
url: globalThis?.location?.href ?? "https://hydrate.stenciljs.com/",
|
|
46
|
-
host: globalThis?.location?.host ?? "hydrate.stenciljs.com",
|
|
47
|
-
hostname: globalThis?.location?.hostname ?? "hydrate.stenciljs.com",
|
|
48
|
-
href: globalThis?.location?.href ?? "https://hydrate.stenciljs.com/",
|
|
49
|
-
port: globalThis?.location?.port ?? "",
|
|
50
|
-
pathname: globalThis?.location?.pathname ?? "/",
|
|
51
|
-
search: globalThis?.location?.search ?? "",
|
|
52
|
-
hash: globalThis?.location?.hash ?? "",
|
|
53
|
-
html: collected,
|
|
54
|
-
httpStatus: 200,
|
|
55
|
-
hydratedCount: tagNames.length,
|
|
56
|
-
anchors: [],
|
|
57
|
-
components: tagNames.map((tag) => ({
|
|
58
|
-
tag,
|
|
59
|
-
mode: "$",
|
|
60
|
-
count: 1,
|
|
61
|
-
depth: 1
|
|
62
|
-
})),
|
|
63
|
-
imgs: [],
|
|
64
|
-
scripts: [],
|
|
65
|
-
staticData: [],
|
|
66
|
-
styles: [],
|
|
67
|
-
title: globalThis?.document?.title ?? "Vite + TS"
|
|
68
|
-
};
|
|
69
|
-
if (maybeDocument && "templateHtml" in maybeDocument) {
|
|
70
|
-
maybeDocument.outerHtml = collected;
|
|
71
|
-
}
|
|
72
|
-
return renderResult;
|
|
73
|
-
}
|
|
74
|
-
function hydrateDocument(doc, options, asStream) {
|
|
75
|
-
return renderToString(doc, options, asStream);
|
|
76
|
-
}
|
|
77
|
-
function serializeDocumentToString(doc, _unused) {
|
|
78
|
-
const maybeDocument = doc;
|
|
79
|
-
return maybeDocument.outerHtml ?? maybeDocument.templateHtml ?? String(maybeDocument);
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
createWindowFromHtml,
|
|
83
|
-
hydrateDocument,
|
|
84
|
-
renderToString,
|
|
85
|
-
serializeDocumentToString,
|
|
86
|
-
streamToString
|
|
87
|
-
};
|