@runopencode/rx-stencil 0.4.4 → 0.5.0
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/cjs/{index-CbERigo8.js → index-DWhjpI-K.js} +396 -41
- package/dist/{esm/set-property-CpZKE-Xu.js → cjs/index-Dssn3hdS.js} +2 -61
- package/dist/cjs/index.cjs.js +280 -244
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mutation-observable-qY7nC854.js +152 -0
- package/dist/cjs/properties-observable-DXbVBslA.js +23 -0
- package/dist/cjs/property-observable-CPp5WEjC.js +86 -0
- package/dist/cjs/rx-async.cjs.entry.js +21 -14
- package/dist/cjs/rx-stencil.cjs.js +3 -3
- package/dist/cjs/schedule-render-DG4hFv5E.js +53 -0
- package/dist/cjs/set-property-C3KARzdl.js +33 -0
- package/dist/cjs/stencil-uD4ZIy1h.js +75 -0
- package/dist/cjs/test-properties-observable.cjs.entry.js +27 -0
- package/dist/cjs/test-property-observable.cjs.entry.js +31 -0
- package/dist/cjs/test-schedule-render.cjs.entry.js +28 -0
- package/dist/cjs/test-view-child-observable-shadow-dom.cjs.entry.js +40 -0
- package/dist/cjs/until-disconnected-BTCr-3q2.js +27 -0
- package/dist/collection/collection-manifest.json +9 -2
- package/dist/collection/components/async/async.js +42 -10
- package/dist/collection/components/index.js +1 -1
- package/dist/collection/rx/decorator/content-child.js +34 -0
- package/dist/collection/rx/decorator/content-children.js +34 -0
- package/dist/collection/rx/decorator/index.js +6 -2
- package/dist/collection/rx/decorator/query-selector-all.js +6 -38
- package/dist/collection/rx/decorator/query-selector.js +6 -51
- package/dist/collection/rx/decorator/view-child.js +34 -0
- package/dist/collection/rx/decorator/view-children.js +34 -0
- package/dist/collection/rx/index.js +1 -0
- package/dist/collection/rx/observable/connected-observable.js +27 -0
- package/dist/collection/rx/observable/content-child-observable.js +24 -0
- package/dist/collection/rx/observable/content-children-observable.js +15 -0
- package/dist/collection/rx/observable/from-event.js +26 -0
- package/dist/collection/rx/observable/index.js +9 -4
- package/dist/collection/rx/observable/mutation-observable.js +6 -0
- package/dist/collection/rx/observable/properties-observable.js +5 -0
- package/dist/collection/rx/observable/property-observable.js +72 -17
- package/dist/collection/rx/observable/render-observable.js +18 -9
- package/dist/collection/rx/observable/view-child-observable.js +30 -0
- package/dist/collection/rx/observable/view-children-observable.js +21 -0
- package/dist/collection/rx/operator/index.js +4 -3
- package/dist/collection/rx/operator/to-property.js +7 -7
- package/dist/collection/rx/operator/until-disconnected.js +12 -94
- package/dist/collection/rx/operator/while-connected.js +39 -0
- package/dist/collection/rx/subscriber/index.js +1 -1
- package/dist/collection/rx/subscriber/set-property.js +13 -0
- package/dist/collection/rx/types.js +1 -0
- package/dist/collection/tests/rx/observable/from-event/test-from-event.component.js +30 -0
- package/dist/collection/tests/rx/observable/properties-observable/test-properties-observable.component.js +85 -0
- package/dist/collection/tests/rx/observable/property-observable/test-property-observable.component.js +47 -0
- package/dist/collection/tests/rx/observable/render-observable.unit.js +38 -0
- package/dist/collection/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.js +96 -0
- package/dist/collection/tests/rx/operator/schedule-render/test-schedule-render.component.js +42 -0
- package/dist/collection/tests/rx/operator/to-property.unit.js +28 -0
- package/dist/collection/tests/rx/operator/until-disconnected.unit.js +25 -0
- package/dist/collection/tests/rx/operator/while-connected/test-while-connected.component.js +32 -0
- package/dist/collection/tests/rx/subscriber/set-property.unit.js +53 -0
- package/dist/collection/utils/decorator.js +33 -0
- package/dist/collection/utils/index.js +1 -1
- package/dist/collection/utils/rxjs.js +67 -0
- package/dist/collection/utils/stencil.js +66 -0
- package/dist/collection/utils/values-registry.js +40 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -0
- package/dist/components/mutation-observable.js +1 -0
- package/dist/components/properties-observable.js +1 -0
- package/dist/components/property-observable.js +1 -0
- package/dist/components/rx-async.js +1 -1
- package/dist/components/schedule-render.js +1 -0
- package/dist/components/set-property.js +1 -1
- package/dist/components/stencil.js +1 -0
- package/dist/components/test-properties-observable.d.ts +11 -0
- package/dist/components/test-properties-observable.js +1 -0
- package/dist/components/test-property-observable.d.ts +11 -0
- package/dist/components/test-property-observable.js +1 -0
- package/dist/components/test-schedule-render.d.ts +11 -0
- package/dist/components/test-schedule-render.js +1 -0
- package/dist/components/test-view-child-observable-shadow-dom.d.ts +11 -0
- package/dist/components/test-view-child-observable-shadow-dom.js +1 -0
- package/dist/components/until-disconnected.js +1 -0
- package/dist/esm/{index-BIBww8qU.js → index-BCGlW-2C.js} +396 -42
- package/dist/{cjs/set-property-BZHuI0P5.js → esm/index-Bn8mRT4P.js} +1 -67
- package/dist/esm/index.js +266 -240
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mutation-observable-xA7xgk29.js +145 -0
- package/dist/esm/properties-observable-Bzq-rZ4c.js +21 -0
- package/dist/esm/property-observable-BKyQe0OR.js +84 -0
- package/dist/esm/rx-async.entry.js +18 -11
- package/dist/esm/rx-stencil.js +4 -4
- package/dist/esm/schedule-render-BGCI5FMG.js +50 -0
- package/dist/esm/set-property-CgrvJ28c.js +31 -0
- package/dist/esm/stencil-BQCAKjCT.js +68 -0
- package/dist/esm/test-properties-observable.entry.js +25 -0
- package/dist/esm/test-property-observable.entry.js +29 -0
- package/dist/esm/test-schedule-render.entry.js +26 -0
- package/dist/esm/test-view-child-observable-shadow-dom.entry.js +38 -0
- package/dist/esm/until-disconnected-D2pF81SM.js +25 -0
- package/dist/rx-stencil/index.esm.js +1 -1
- package/dist/rx-stencil/p-7c570c65.entry.js +1 -0
- package/dist/rx-stencil/p-BCGlW-2C.js +3 -0
- package/dist/rx-stencil/p-BLLg2g3n.js +1 -0
- package/dist/rx-stencil/p-BQCAKjCT.js +1 -0
- package/dist/rx-stencil/p-Bn8mRT4P.js +1 -0
- package/dist/rx-stencil/p-D1zETqVV.js +1 -0
- package/dist/rx-stencil/p-DHIVm3-O.js +1 -0
- package/dist/rx-stencil/p-J0xLdrjW.js +1 -0
- package/dist/rx-stencil/p-Sf5sf4Pq.js +1 -0
- package/dist/rx-stencil/p-a4c71f45.entry.js +1 -0
- package/dist/rx-stencil/p-b2c6ba01.entry.js +1 -0
- package/dist/rx-stencil/p-dc654207.entry.js +1 -0
- package/dist/rx-stencil/p-e661490a.entry.js +1 -0
- package/dist/rx-stencil/p-wVeMJABH.js +1 -0
- package/dist/rx-stencil/rx-stencil.esm.js +1 -1
- package/dist/types/components/async/async.d.ts +9 -2
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components.d.ts +92 -2
- package/dist/types/rx/decorator/content-child.d.ts +3 -0
- package/dist/types/rx/decorator/content-children.d.ts +3 -0
- package/dist/types/rx/decorator/index.d.ts +6 -2
- package/dist/types/rx/decorator/query-selector-all.d.ts +7 -21
- package/dist/types/rx/decorator/query-selector.d.ts +7 -29
- package/dist/types/rx/decorator/view-child.d.ts +27 -0
- package/dist/types/rx/decorator/view-children.d.ts +11 -0
- package/dist/types/rx/index.d.ts +1 -0
- package/dist/types/rx/observable/connected-observable.d.ts +9 -0
- package/dist/types/rx/observable/content-child-observable.d.ts +5 -0
- package/dist/types/rx/observable/content-children-observable.d.ts +5 -0
- package/dist/types/rx/observable/from-event.d.ts +26 -0
- package/dist/types/rx/observable/index.d.ts +9 -4
- package/dist/types/rx/observable/mutation-observable.d.ts +6 -0
- package/dist/types/rx/observable/properties-observable.d.ts +5 -0
- package/dist/types/rx/observable/property-observable.d.ts +1 -1
- package/dist/types/rx/observable/render-observable.d.ts +6 -1
- package/dist/types/rx/observable/view-child-observable.d.ts +17 -0
- package/dist/types/rx/observable/view-children-observable.d.ts +5 -0
- package/dist/types/rx/operator/index.d.ts +4 -3
- package/dist/types/rx/operator/to-property.d.ts +1 -3
- package/dist/types/rx/operator/while-connected.d.ts +22 -0
- package/dist/types/rx/subscriber/index.d.ts +1 -1
- package/dist/types/rx/subscriber/set-property.d.ts +13 -0
- package/dist/types/rx/types.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +74 -55
- package/dist/types/tests/rx/observable/properties-observable/test-properties-observable.component.d.ts +9 -0
- package/dist/types/tests/rx/observable/property-observable/test-property-observable.component.d.ts +8 -0
- package/dist/types/tests/rx/observable/render-observable.unit.d.ts +1 -0
- package/dist/types/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.d.ts +12 -0
- package/dist/types/tests/rx/operator/schedule-render/test-schedule-render.component.d.ts +7 -0
- package/dist/types/tests/rx/operator/to-property.unit.d.ts +1 -0
- package/dist/types/tests/rx/operator/until-disconnected.unit.d.ts +1 -0
- package/dist/types/tests/rx/subscriber/set-property.unit.d.ts +1 -0
- package/dist/types/utils/decorator.d.ts +11 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/rxjs.d.ts +31 -0
- package/dist/types/utils/stencil.d.ts +54 -0
- package/dist/types/utils/values-registry.d.ts +10 -0
- package/loader/index.d.ts +1 -1
- package/package.json +19 -10
- package/dist/collection/utils/get-property-descriptor.js +0 -17
- package/dist/rx-stencil/p-77100dee.entry.js +0 -1
- package/dist/rx-stencil/p-BIBww8qU.js +0 -2
- package/dist/rx-stencil/p-IbpJ_cRo.js +0 -1
- package/dist/types/utils/get-property-descriptor.d.ts +0 -7
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const NAMESPACE = 'rx-stencil';
|
|
4
|
-
const BUILD = /* rx-stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated",
|
|
4
|
+
const BUILD = /* rx-stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: false, state: true, updatable: true};
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
|
-
Stencil Client Platform v4.
|
|
7
|
+
Stencil Client Platform v4.45.0 | MIT Licensed | https://stenciljs.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
// src/utils/get-prop-descriptor.ts
|
|
12
|
+
function getPropertyDescriptor(obj, memberName, getOnly) {
|
|
13
|
+
const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
|
|
14
|
+
while (obj && obj !== stopAt) {
|
|
15
|
+
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
16
|
+
if (desc && (!getOnly || desc.get)) return desc;
|
|
17
|
+
obj = Object.getPrototypeOf(obj);
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/utils/es2022-rewire-class-members.ts
|
|
10
23
|
var reWireGetterSetter = (instance, hostRef) => {
|
|
11
24
|
var _a;
|
|
12
25
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -14,7 +27,7 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
14
27
|
members.map(([memberName, [memberFlags]]) => {
|
|
15
28
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
16
29
|
const ogValue = instance[memberName];
|
|
17
|
-
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
30
|
+
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
18
31
|
if (ogDescriptor) {
|
|
19
32
|
Object.defineProperty(instance, memberName, {
|
|
20
33
|
get() {
|
|
@@ -27,18 +40,14 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
27
40
|
enumerable: true
|
|
28
41
|
});
|
|
29
42
|
}
|
|
30
|
-
|
|
43
|
+
if (hostRef.$instanceValues$.has(memberName)) {
|
|
44
|
+
instance[memberName] = hostRef.$instanceValues$.get(memberName);
|
|
45
|
+
} else if (ogValue !== void 0) {
|
|
46
|
+
instance[memberName] = ogValue;
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
49
|
});
|
|
33
50
|
};
|
|
34
|
-
function getPropertyDescriptor(obj, memberName) {
|
|
35
|
-
while (obj) {
|
|
36
|
-
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
37
|
-
if (desc == null ? void 0 : desc.get) return desc;
|
|
38
|
-
obj = Object.getPrototypeOf(obj);
|
|
39
|
-
}
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
51
|
|
|
43
52
|
// src/client/client-host-ref.ts
|
|
44
53
|
var getHostRef = (ref) => {
|
|
@@ -51,7 +60,7 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
51
60
|
if (!hostRef) return;
|
|
52
61
|
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
53
62
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
54
|
-
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.
|
|
63
|
+
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
|
|
55
64
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
56
65
|
}
|
|
57
66
|
};
|
|
@@ -63,6 +72,9 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
63
72
|
$instanceValues$: /* @__PURE__ */ new Map(),
|
|
64
73
|
$serializerValues$: /* @__PURE__ */ new Map()
|
|
65
74
|
};
|
|
75
|
+
{
|
|
76
|
+
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
77
|
+
}
|
|
66
78
|
{
|
|
67
79
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
68
80
|
hostElement["s-p"] = [];
|
|
@@ -75,11 +87,14 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
75
87
|
hostElement.__stencil__getHostRef = () => ref;
|
|
76
88
|
return ref;
|
|
77
89
|
};
|
|
90
|
+
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
78
91
|
var consoleError = (e, el) => (0, console.error)(e, el);
|
|
79
92
|
|
|
80
93
|
// src/client/client-load-module.ts
|
|
81
94
|
var cmpModules = /* @__PURE__ */ new Map();
|
|
95
|
+
var failedLoadAttempts = /* @__PURE__ */ new Map();
|
|
82
96
|
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
97
|
+
var _a;
|
|
83
98
|
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
|
|
84
99
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
85
100
|
if (!bundleId) {
|
|
@@ -89,21 +104,28 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
89
104
|
if (module) {
|
|
90
105
|
return module[exportName];
|
|
91
106
|
}
|
|
107
|
+
const retryCount = (_a = failedLoadAttempts.get(bundleId)) != null ? _a : 0;
|
|
108
|
+
const cacheBustParams = [
|
|
109
|
+
retryCount > 0 ? `s-retry=${retryCount}` : "",
|
|
110
|
+
""
|
|
111
|
+
].filter(Boolean).join("&");
|
|
92
112
|
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
93
113
|
return import(
|
|
94
114
|
/* @vite-ignore */
|
|
95
115
|
/* webpackInclude: /\.entry\.js$/ */
|
|
96
116
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
97
117
|
/* webpackMode: "lazy" */
|
|
98
|
-
`./${bundleId}.entry.js${""}`
|
|
118
|
+
`./${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`
|
|
99
119
|
).then(
|
|
100
120
|
(importedModule) => {
|
|
101
121
|
{
|
|
122
|
+
failedLoadAttempts.delete(bundleId);
|
|
102
123
|
cmpModules.set(bundleId, importedModule);
|
|
103
124
|
}
|
|
104
125
|
return importedModule[exportName];
|
|
105
126
|
},
|
|
106
127
|
(e) => {
|
|
128
|
+
failedLoadAttempts.set(bundleId, retryCount + 1);
|
|
107
129
|
consoleError(e, hostRef.$hostElement$);
|
|
108
130
|
}
|
|
109
131
|
);
|
|
@@ -113,6 +135,8 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
113
135
|
var styles = /* @__PURE__ */ new Map();
|
|
114
136
|
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
115
137
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
138
|
+
var MAX_LAZY_LOAD_RETRIES = 3;
|
|
139
|
+
var LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
|
|
116
140
|
var win = typeof window !== "undefined" ? window : {};
|
|
117
141
|
var plt = {
|
|
118
142
|
$flags$: 0,
|
|
@@ -139,6 +163,10 @@ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @_
|
|
|
139
163
|
var queuePending = false;
|
|
140
164
|
var queueDomReads = [];
|
|
141
165
|
var queueDomWrites = [];
|
|
166
|
+
var scheduleFlush = () => {
|
|
167
|
+
var _a;
|
|
168
|
+
return ((_a = win.document) == null ? void 0 : _a.hidden) ? nextTick(flush) : plt.raf(flush);
|
|
169
|
+
};
|
|
142
170
|
var queueTask = (queue, write) => (cb) => {
|
|
143
171
|
queue.push(cb);
|
|
144
172
|
if (!queuePending) {
|
|
@@ -146,7 +174,7 @@ var queueTask = (queue, write) => (cb) => {
|
|
|
146
174
|
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
147
175
|
nextTick(flush);
|
|
148
176
|
} else {
|
|
149
|
-
|
|
177
|
+
scheduleFlush();
|
|
150
178
|
}
|
|
151
179
|
}
|
|
152
180
|
};
|
|
@@ -165,12 +193,33 @@ var flush = () => {
|
|
|
165
193
|
{
|
|
166
194
|
consume(queueDomWrites);
|
|
167
195
|
if (queuePending = queueDomReads.length > 0) {
|
|
168
|
-
|
|
196
|
+
scheduleFlush();
|
|
169
197
|
}
|
|
170
198
|
}
|
|
171
199
|
};
|
|
172
200
|
var nextTick = (cb) => promiseResolve().then(cb);
|
|
173
201
|
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
|
202
|
+
|
|
203
|
+
// src/utils/style.ts
|
|
204
|
+
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/utils/shadow-root.ts
|
|
209
|
+
var globalStyleSheet;
|
|
210
|
+
function createShadowRoot(cmpMeta) {
|
|
211
|
+
var _a;
|
|
212
|
+
const opts = { mode: "open" };
|
|
213
|
+
const shadowRoot = this.attachShadow(opts);
|
|
214
|
+
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
|
|
215
|
+
if (globalStyleSheet) {
|
|
216
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
217
|
+
shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
218
|
+
} else {
|
|
219
|
+
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
174
223
|
var createTime = (fnName, tagName = "") => {
|
|
175
224
|
{
|
|
176
225
|
return () => {
|
|
@@ -301,10 +350,15 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
301
350
|
var attachStyles = (hostRef) => {
|
|
302
351
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
303
352
|
const elm = hostRef.$hostElement$;
|
|
353
|
+
const flags = cmpMeta.$flags$;
|
|
304
354
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
305
|
-
addStyle(
|
|
306
|
-
elm.getRootNode(),
|
|
355
|
+
const scopeId2 = addStyle(
|
|
356
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
307
357
|
cmpMeta);
|
|
358
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
359
|
+
elm["s-sc"] = scopeId2;
|
|
360
|
+
elm.classList.add(scopeId2 + "-h");
|
|
361
|
+
}
|
|
308
362
|
endAttachStyles();
|
|
309
363
|
};
|
|
310
364
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
@@ -331,6 +385,11 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
331
385
|
} else if (child != null && typeof child !== "boolean") {
|
|
332
386
|
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
333
387
|
child = String(child);
|
|
388
|
+
} else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
389
|
+
{
|
|
390
|
+
consoleError("Invalid vNode child");
|
|
391
|
+
}
|
|
392
|
+
continue;
|
|
334
393
|
}
|
|
335
394
|
if (simple && lastSimple) {
|
|
336
395
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -346,6 +405,12 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
346
405
|
if (vnodeData.key) {
|
|
347
406
|
key = vnodeData.key;
|
|
348
407
|
}
|
|
408
|
+
{
|
|
409
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
410
|
+
if (classData) {
|
|
411
|
+
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
349
414
|
}
|
|
350
415
|
const vnode = newVNode(nodeName, null);
|
|
351
416
|
vnode.$attrs$ = vnodeData;
|
|
@@ -377,9 +442,37 @@ var newVNode = (tag, text) => {
|
|
|
377
442
|
var Host = {};
|
|
378
443
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
379
444
|
|
|
445
|
+
// src/runtime/normalize-watchers.ts
|
|
446
|
+
var normalizeWatchers = (raw) => {
|
|
447
|
+
if (!raw) return void 0;
|
|
448
|
+
const keys = Object.keys(raw);
|
|
449
|
+
if (keys.length === 0) return void 0;
|
|
450
|
+
let hasLegacy = false;
|
|
451
|
+
for (const propName of keys) {
|
|
452
|
+
if (hasLegacy) break;
|
|
453
|
+
for (const h2 of raw[propName]) {
|
|
454
|
+
if (typeof h2 === "string") {
|
|
455
|
+
hasLegacy = true;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (!hasLegacy) return raw;
|
|
461
|
+
const out = {};
|
|
462
|
+
for (const propName of keys) {
|
|
463
|
+
out[propName] = raw[propName].map(
|
|
464
|
+
(h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
return out;
|
|
468
|
+
};
|
|
469
|
+
|
|
380
470
|
// src/runtime/parse-property-value.ts
|
|
381
471
|
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
382
472
|
if (propValue != null && !isComplexType(propValue)) {
|
|
473
|
+
if (propType & 1 /* String */) {
|
|
474
|
+
return String(propValue);
|
|
475
|
+
}
|
|
383
476
|
return propValue;
|
|
384
477
|
}
|
|
385
478
|
return propValue;
|
|
@@ -397,7 +490,92 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
397
490
|
if (oldValue === newValue) {
|
|
398
491
|
return;
|
|
399
492
|
}
|
|
493
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
400
494
|
memberName.toLowerCase();
|
|
495
|
+
if (memberName === "class") {
|
|
496
|
+
const classList = elm.classList;
|
|
497
|
+
const oldClasses = parseClassList(oldValue);
|
|
498
|
+
let newClasses = parseClassList(newValue);
|
|
499
|
+
{
|
|
500
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
501
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
502
|
+
}
|
|
503
|
+
} else if (memberName === "key") ; else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
|
|
504
|
+
const propName = memberName.slice(5);
|
|
505
|
+
let attrName;
|
|
506
|
+
{
|
|
507
|
+
const hostRef = getHostRef(elm);
|
|
508
|
+
if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
|
|
509
|
+
const memberMeta = hostRef.$cmpMeta$.$members$[propName];
|
|
510
|
+
if (memberMeta && memberMeta[1]) {
|
|
511
|
+
attrName = memberMeta[1];
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (!attrName) {
|
|
516
|
+
attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
517
|
+
}
|
|
518
|
+
if (newValue == null || newValue === false) {
|
|
519
|
+
if (newValue !== false || elm.getAttribute(attrName) === "") {
|
|
520
|
+
elm.removeAttribute(attrName);
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
elm.setAttribute(attrName, newValue === true ? "" : newValue);
|
|
524
|
+
}
|
|
525
|
+
return;
|
|
526
|
+
} else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
|
|
527
|
+
const propName = memberName.slice(5);
|
|
528
|
+
try {
|
|
529
|
+
elm[propName] = newValue;
|
|
530
|
+
} catch (e) {
|
|
531
|
+
}
|
|
532
|
+
return;
|
|
533
|
+
} else {
|
|
534
|
+
const isComplex = isComplexType(newValue);
|
|
535
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
536
|
+
try {
|
|
537
|
+
if (!elm.tagName.includes("-")) {
|
|
538
|
+
const n = newValue == null ? "" : newValue;
|
|
539
|
+
if (memberName === "list") {
|
|
540
|
+
isProp = false;
|
|
541
|
+
} else if (oldValue == null || elm[memberName] !== n) {
|
|
542
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
543
|
+
elm[memberName] = n;
|
|
544
|
+
} else {
|
|
545
|
+
elm.setAttribute(memberName, n);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
} else if (elm[memberName] !== newValue) {
|
|
549
|
+
elm[memberName] = newValue;
|
|
550
|
+
}
|
|
551
|
+
} catch (e) {
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (newValue == null || newValue === false) {
|
|
555
|
+
if (newValue !== false || elm.getAttribute(memberName) === "" || flags & 4 /* isHost */ && !isEnumeratedAttribute(memberName)) {
|
|
556
|
+
{
|
|
557
|
+
elm.removeAttribute(memberName);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
561
|
+
newValue = newValue === true ? "" : newValue;
|
|
562
|
+
{
|
|
563
|
+
elm.setAttribute(memberName, newValue);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck"]);
|
|
569
|
+
var isEnumeratedAttribute = (attrName) => ENUMERATED_ATTRIBUTES.has(attrName) || attrName.startsWith("aria-");
|
|
570
|
+
var parseClassListRegex = /\s/;
|
|
571
|
+
var parseClassList = (value) => {
|
|
572
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
|
573
|
+
value = value.baseVal;
|
|
574
|
+
}
|
|
575
|
+
if (!value || typeof value !== "string") {
|
|
576
|
+
return [];
|
|
577
|
+
}
|
|
578
|
+
return value.split(parseClassListRegex);
|
|
401
579
|
};
|
|
402
580
|
|
|
403
581
|
// src/runtime/vdom/update-element.ts
|
|
@@ -412,7 +590,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
|
412
590
|
elm,
|
|
413
591
|
memberName,
|
|
414
592
|
oldVnodeAttrs[memberName],
|
|
415
|
-
void 0
|
|
593
|
+
void 0,
|
|
594
|
+
isSvgMode2,
|
|
595
|
+
newVnode.$flags$);
|
|
416
596
|
}
|
|
417
597
|
}
|
|
418
598
|
}
|
|
@@ -421,7 +601,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
|
421
601
|
elm,
|
|
422
602
|
memberName,
|
|
423
603
|
oldVnodeAttrs[memberName],
|
|
424
|
-
newVnodeAttrs[memberName]
|
|
604
|
+
newVnodeAttrs[memberName],
|
|
605
|
+
isSvgMode2,
|
|
606
|
+
newVnode.$flags$);
|
|
425
607
|
}
|
|
426
608
|
};
|
|
427
609
|
function sortedAttrNames(attrNames) {
|
|
@@ -434,6 +616,8 @@ function sortedAttrNames(attrNames) {
|
|
|
434
616
|
);
|
|
435
617
|
}
|
|
436
618
|
var hostTagName;
|
|
619
|
+
var useNativeShadowDom = false;
|
|
620
|
+
var isSvgMode = false;
|
|
437
621
|
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
438
622
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
439
623
|
let i2 = 0;
|
|
@@ -449,7 +633,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
449
633
|
newVNode2.$tag$
|
|
450
634
|
);
|
|
451
635
|
{
|
|
452
|
-
updateElement(null, newVNode2);
|
|
636
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
453
637
|
}
|
|
454
638
|
if (newVNode2.$children$) {
|
|
455
639
|
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
|
|
@@ -464,9 +648,31 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
464
648
|
elm["s-hn"] = hostTagName;
|
|
465
649
|
return elm;
|
|
466
650
|
};
|
|
651
|
+
var relocateToHostRoot = (parentElm) => {
|
|
652
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
653
|
+
const host = parentElm.closest(hostTagName.toLowerCase());
|
|
654
|
+
if (host != null) {
|
|
655
|
+
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
|
|
656
|
+
(ref) => ref["s-cr"]
|
|
657
|
+
);
|
|
658
|
+
const childNodeArray = Array.from(
|
|
659
|
+
parentElm.__childNodes || parentElm.childNodes
|
|
660
|
+
);
|
|
661
|
+
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
662
|
+
if (childNode["s-sh"] != null) {
|
|
663
|
+
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
664
|
+
childNode["s-sh"] = void 0;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
plt.$flags$ &= -2 /* isTmpDisconnected */;
|
|
669
|
+
};
|
|
467
670
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
468
671
|
let containerElm = parentElm;
|
|
469
672
|
let childNode;
|
|
673
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
674
|
+
containerElm = containerElm.shadowRoot;
|
|
675
|
+
}
|
|
470
676
|
if (parentVNode.$tag$ === "template") {
|
|
471
677
|
containerElm = containerElm.content;
|
|
472
678
|
}
|
|
@@ -545,7 +751,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
545
751
|
if (idxInOld >= 0) {
|
|
546
752
|
elmToMove = oldCh[idxInOld];
|
|
547
753
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
548
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2,
|
|
754
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
|
549
755
|
} else {
|
|
550
756
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
551
757
|
oldCh[idxInOld] = void 0;
|
|
@@ -592,10 +798,17 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
592
798
|
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
|
593
799
|
const oldChildren = oldVNode.$children$;
|
|
594
800
|
const newChildren = newVNode2.$children$;
|
|
801
|
+
const tag = newVNode2.$tag$;
|
|
595
802
|
const text = newVNode2.$text$;
|
|
596
803
|
if (text == null) {
|
|
597
804
|
{
|
|
598
|
-
|
|
805
|
+
if (tag === "slot" && !useNativeShadowDom) {
|
|
806
|
+
if (oldVNode.$name$ !== newVNode2.$name$) {
|
|
807
|
+
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
808
|
+
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
599
812
|
}
|
|
600
813
|
if (oldChildren !== null && newChildren !== null) {
|
|
601
814
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -615,14 +828,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
615
828
|
}
|
|
616
829
|
};
|
|
617
830
|
var insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
618
|
-
|
|
619
|
-
return parent.__insertBefore(newNode, reference);
|
|
620
|
-
} else {
|
|
831
|
+
{
|
|
621
832
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
622
833
|
}
|
|
623
834
|
};
|
|
624
835
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
625
836
|
const hostElm = hostRef.$hostElement$;
|
|
837
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
626
838
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
627
839
|
const isHostElement = isHost(renderFnResults);
|
|
628
840
|
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
@@ -637,7 +849,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
637
849
|
rootVnode.$tag$ = null;
|
|
638
850
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
639
851
|
hostRef.$vnode$ = rootVnode;
|
|
640
|
-
rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
|
|
852
|
+
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
|
853
|
+
useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
641
854
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
642
855
|
};
|
|
643
856
|
|
|
@@ -776,6 +989,9 @@ var postUpdateComponent = (hostRef) => {
|
|
|
776
989
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
777
990
|
endPostUpdate();
|
|
778
991
|
}
|
|
992
|
+
{
|
|
993
|
+
hostRef.$onInstanceResolve$(elm);
|
|
994
|
+
}
|
|
779
995
|
{
|
|
780
996
|
if (hostRef.$onRenderResolve$) {
|
|
781
997
|
hostRef.$onRenderResolve$();
|
|
@@ -828,15 +1044,38 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
828
1044
|
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
|
|
829
1045
|
);
|
|
830
1046
|
}
|
|
1047
|
+
const elm = hostRef.$hostElement$ ;
|
|
831
1048
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
832
1049
|
const flags = hostRef.$flags$;
|
|
833
1050
|
const instance = hostRef.$lazyInstance$ ;
|
|
834
1051
|
newVal = parsePropertyValue(
|
|
835
|
-
newVal
|
|
1052
|
+
newVal,
|
|
1053
|
+
cmpMeta.$members$[propName][0]);
|
|
836
1054
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
837
1055
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
838
1056
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
839
1057
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1058
|
+
if (BUILD.propChangeCallback && cmpMeta.$watchers$) {
|
|
1059
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1060
|
+
if (watchMethods) {
|
|
1061
|
+
watchMethods.map((watcher) => {
|
|
1062
|
+
try {
|
|
1063
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
1064
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
1065
|
+
if (!instance) {
|
|
1066
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
1067
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
1068
|
+
});
|
|
1069
|
+
} else {
|
|
1070
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
} catch (e) {
|
|
1074
|
+
consoleError(e, elm);
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
840
1079
|
if (flags & 2 /* hasRendered */) {
|
|
841
1080
|
if (instance.componentShouldUpdate) {
|
|
842
1081
|
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
@@ -850,16 +1089,25 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
850
1089
|
}
|
|
851
1090
|
}
|
|
852
1091
|
};
|
|
853
|
-
|
|
854
|
-
// src/runtime/proxy-component.ts
|
|
855
1092
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
856
|
-
var _a;
|
|
1093
|
+
var _a, _b;
|
|
857
1094
|
const prototype = Cstr.prototype;
|
|
858
1095
|
if (cmpMeta.$members$ || BUILD.propChangeCallback) {
|
|
1096
|
+
if (BUILD.propChangeCallback) {
|
|
1097
|
+
if (Cstr.watchers && !cmpMeta.$watchers$) {
|
|
1098
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1099
|
+
}
|
|
1100
|
+
if (Cstr.deserializers && !cmpMeta.$deserializers$) {
|
|
1101
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
1102
|
+
}
|
|
1103
|
+
if (Cstr.serializers && !cmpMeta.$serializers$) {
|
|
1104
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
859
1107
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
860
1108
|
members.map(([memberName, [memberFlags]]) => {
|
|
861
1109
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
862
|
-
const { get: origGetter, set: origSetter } =
|
|
1110
|
+
const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
|
|
863
1111
|
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
864
1112
|
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
865
1113
|
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
@@ -892,7 +1140,8 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
892
1140
|
}
|
|
893
1141
|
origSetter.apply(this, [
|
|
894
1142
|
parsePropertyValue(
|
|
895
|
-
newValue
|
|
1143
|
+
newValue,
|
|
1144
|
+
memberFlags)
|
|
896
1145
|
]);
|
|
897
1146
|
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
898
1147
|
setValue(this, memberName, newValue, cmpMeta);
|
|
@@ -910,37 +1159,108 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
910
1159
|
}
|
|
911
1160
|
return;
|
|
912
1161
|
}
|
|
913
|
-
const
|
|
1162
|
+
const parsedValue = parsePropertyValue(
|
|
1163
|
+
newValue,
|
|
1164
|
+
memberFlags);
|
|
1165
|
+
const setterSetVal = (val) => {
|
|
914
1166
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
915
1167
|
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
916
1168
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
917
1169
|
}
|
|
918
|
-
ref.$lazyInstance$[memberName] =
|
|
919
|
-
newValue);
|
|
1170
|
+
ref.$lazyInstance$[memberName] = val;
|
|
920
1171
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
921
1172
|
};
|
|
922
1173
|
if (ref.$lazyInstance$) {
|
|
923
|
-
setterSetVal();
|
|
1174
|
+
setterSetVal(parsedValue);
|
|
924
1175
|
} else {
|
|
1176
|
+
ref.$instanceValues$.set(memberName, parsedValue);
|
|
925
1177
|
ref.$fetchedCbList$.push(() => {
|
|
926
|
-
|
|
1178
|
+
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
1179
|
+
if (ref.$lazyInstance$[memberName] !== pendingValue) {
|
|
1180
|
+
setterSetVal(pendingValue);
|
|
1181
|
+
}
|
|
927
1182
|
});
|
|
928
1183
|
}
|
|
929
1184
|
}
|
|
930
1185
|
}
|
|
931
1186
|
});
|
|
1187
|
+
} else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
1188
|
+
Object.defineProperty(prototype, memberName, {
|
|
1189
|
+
value(...args) {
|
|
1190
|
+
var _a2;
|
|
1191
|
+
const ref = getHostRef(this);
|
|
1192
|
+
return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
|
|
1193
|
+
var _a3;
|
|
1194
|
+
return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
932
1198
|
}
|
|
933
1199
|
});
|
|
1200
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1201
|
+
const attrNameToPropName = /* @__PURE__ */ new Map();
|
|
1202
|
+
prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
|
|
1203
|
+
plt.jmp(() => {
|
|
1204
|
+
var _a2;
|
|
1205
|
+
const propName = attrNameToPropName.get(attrName);
|
|
1206
|
+
const hostRef = getHostRef(this);
|
|
1207
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
|
1208
|
+
newValue = this[propName];
|
|
1209
|
+
delete this[propName];
|
|
1210
|
+
}
|
|
1211
|
+
if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
1212
|
+
this[propName] == newValue) {
|
|
1213
|
+
return;
|
|
1214
|
+
} else if (propName == null) {
|
|
1215
|
+
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
1216
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
|
|
1217
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1218
|
+
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
1219
|
+
entry == null ? void 0 : entry.forEach((watcher) => {
|
|
1220
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
1221
|
+
if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
|
|
1222
|
+
instance[watchMethodName].call(instance, newValue, oldValue, attrName);
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
const propFlags = members.find(([m]) => m === propName);
|
|
1229
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
1230
|
+
const isBooleanTarget = propMemberFlags & 4 /* Boolean */;
|
|
1231
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
1232
|
+
if (isBooleanTarget) {
|
|
1233
|
+
newValue = newValue === null || newValue === "false" ? false : true;
|
|
1234
|
+
}
|
|
1235
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
1236
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
1237
|
+
this[propName] = newValue;
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
};
|
|
1241
|
+
Cstr.observedAttributes = Array.from(
|
|
1242
|
+
/* @__PURE__ */ new Set([
|
|
1243
|
+
...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
|
|
1244
|
+
...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
|
|
1245
|
+
const attrName = m[1] || propName;
|
|
1246
|
+
attrNameToPropName.set(attrName, propName);
|
|
1247
|
+
return attrName;
|
|
1248
|
+
})
|
|
1249
|
+
])
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
934
1252
|
}
|
|
935
1253
|
return Cstr;
|
|
936
1254
|
};
|
|
937
1255
|
|
|
938
1256
|
// src/runtime/initialize-component.ts
|
|
939
1257
|
var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1258
|
+
var _a;
|
|
940
1259
|
let Cstr;
|
|
941
1260
|
try {
|
|
942
1261
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
943
1262
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1263
|
+
hostRef.$flags$ &= -1025 /* hasFailedLoad */;
|
|
944
1264
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
945
1265
|
if (bundleId) {
|
|
946
1266
|
const CstrImport = loadModule(cmpMeta, hostRef);
|
|
@@ -952,9 +1272,19 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
952
1272
|
Cstr = CstrImport;
|
|
953
1273
|
}
|
|
954
1274
|
if (!Cstr) {
|
|
1275
|
+
hostRef.$flags$ &= -33 /* hasInitializedComponent */;
|
|
1276
|
+
hostRef.$loadRetryCount$ = ((_a = hostRef.$loadRetryCount$) != null ? _a : 0) + 1;
|
|
1277
|
+
if (hostRef.$loadRetryCount$ < MAX_LAZY_LOAD_RETRIES) {
|
|
1278
|
+
hostRef.$flags$ |= 1024 /* hasFailedLoad */;
|
|
1279
|
+
}
|
|
955
1280
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
956
1281
|
}
|
|
957
1282
|
if (!Cstr.isProxied) {
|
|
1283
|
+
if (BUILD.propChangeCallback) {
|
|
1284
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1285
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
1286
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
1287
|
+
}
|
|
958
1288
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
959
1289
|
Cstr.isProxied = true;
|
|
960
1290
|
}
|
|
@@ -970,6 +1300,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
970
1300
|
{
|
|
971
1301
|
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
972
1302
|
}
|
|
1303
|
+
if (BUILD.propChangeCallback) {
|
|
1304
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1305
|
+
}
|
|
973
1306
|
endNewInstance();
|
|
974
1307
|
{
|
|
975
1308
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
@@ -1005,7 +1338,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1005
1338
|
hostRef.$onRenderResolve$();
|
|
1006
1339
|
hostRef.$onRenderResolve$ = void 0;
|
|
1007
1340
|
}
|
|
1008
|
-
if (hostRef.$onReadyResolve$) {
|
|
1341
|
+
if (hostRef.$onReadyResolve$ && !(hostRef.$flags$ & 1024 /* hasFailedLoad */)) {
|
|
1009
1342
|
hostRef.$onReadyResolve$(elm);
|
|
1010
1343
|
}
|
|
1011
1344
|
}
|
|
@@ -1038,7 +1371,7 @@ var connectedCallback = (elm) => {
|
|
|
1038
1371
|
}
|
|
1039
1372
|
if (cmpMeta.$members$) {
|
|
1040
1373
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1041
|
-
if (memberFlags & 31 /* Prop */ &&
|
|
1374
|
+
if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
|
|
1042
1375
|
const value = elm[memberName];
|
|
1043
1376
|
delete elm[memberName];
|
|
1044
1377
|
elm[memberName] = value;
|
|
@@ -1051,6 +1384,8 @@ var connectedCallback = (elm) => {
|
|
|
1051
1384
|
} else {
|
|
1052
1385
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1053
1386
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1387
|
+
} else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
|
|
1388
|
+
setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
|
|
1054
1389
|
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1055
1390
|
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
1056
1391
|
}
|
|
@@ -1101,6 +1436,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1101
1436
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1102
1437
|
lazyBundles.map((lazyBundle) => {
|
|
1103
1438
|
lazyBundle[1].map((compactMeta) => {
|
|
1439
|
+
var _a2, _b;
|
|
1104
1440
|
const cmpMeta = {
|
|
1105
1441
|
$flags$: compactMeta[0],
|
|
1106
1442
|
$tagName$: compactMeta[1],
|
|
@@ -1110,6 +1446,11 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1110
1446
|
{
|
|
1111
1447
|
cmpMeta.$members$ = compactMeta[2];
|
|
1112
1448
|
}
|
|
1449
|
+
if (BUILD.propChangeCallback) {
|
|
1450
|
+
cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
|
|
1451
|
+
cmpMeta.$serializers$ = (_a2 = compactMeta[5]) != null ? _a2 : {};
|
|
1452
|
+
cmpMeta.$deserializers$ = (_b = compactMeta[6]) != null ? _b : {};
|
|
1453
|
+
}
|
|
1113
1454
|
const tagName = transformTag(cmpMeta.$tagName$);
|
|
1114
1455
|
const HostElement = class extends HTMLElement {
|
|
1115
1456
|
["s-p"];
|
|
@@ -1120,6 +1461,19 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1120
1461
|
super(self);
|
|
1121
1462
|
self = this;
|
|
1122
1463
|
registerHost(self, cmpMeta);
|
|
1464
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1465
|
+
{
|
|
1466
|
+
if (!self.shadowRoot) {
|
|
1467
|
+
createShadowRoot.call(self, cmpMeta);
|
|
1468
|
+
} else {
|
|
1469
|
+
if (self.shadowRoot.mode !== "open") {
|
|
1470
|
+
throw new Error(
|
|
1471
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1123
1477
|
}
|
|
1124
1478
|
connectedCallback() {
|
|
1125
1479
|
const hostRef = getHostRef(this);
|
|
@@ -1141,7 +1495,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1141
1495
|
}
|
|
1142
1496
|
disconnectedCallback() {
|
|
1143
1497
|
plt.jmp(() => disconnectedCallback(this));
|
|
1144
|
-
|
|
1498
|
+
nextTick(() => {
|
|
1145
1499
|
var _a3;
|
|
1146
1500
|
const hostRef = getHostRef(this);
|
|
1147
1501
|
if (!hostRef) {
|
|
@@ -1201,6 +1555,7 @@ function transformTag(tag) {
|
|
|
1201
1555
|
return tag;
|
|
1202
1556
|
}
|
|
1203
1557
|
|
|
1558
|
+
exports.BUILD = BUILD;
|
|
1204
1559
|
exports.Host = Host;
|
|
1205
1560
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1206
1561
|
exports.forceUpdate = forceUpdate;
|