@rindo/core 4.23.1 → 4.25.3
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/cli/index.cjs +2 -5
- package/cli/index.js +2 -5
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +2441 -841
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +10 -10
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +2025 -1876
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +2057 -1856
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +111 -42
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +70 -2
- package/internal/rindo-public-compiler.d.ts +9 -11
- package/internal/testing/index.js +1830 -1687
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +69 -5
- package/mock-doc/index.d.ts +9 -0
- package/mock-doc/index.js +69 -5
- package/mock-doc/package.json +1 -1
- package/package.json +3 -3
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/glob.js +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +28 -19
- package/testing/package.json +1 -1
package/internal/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Client Platform v4.
|
|
2
|
+
Rindo Client Platform v4.25.3 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -17,19 +17,46 @@ var Build = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// src/client/client-host-ref.ts
|
|
20
|
+
import { BUILD as BUILD3 } from "@rindo/core/internal/app-data";
|
|
21
|
+
|
|
22
|
+
// src/utils/es2022-rewire-class-members.ts
|
|
20
23
|
import { BUILD as BUILD2 } from "@rindo/core/internal/app-data";
|
|
21
24
|
|
|
22
25
|
// src/utils/constants.ts
|
|
23
|
-
var EMPTY_OBJ = {};
|
|
24
26
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
25
27
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
26
28
|
|
|
29
|
+
// src/utils/es2022-rewire-class-members.ts
|
|
30
|
+
var reWireGetterSetter = (instance, hostRef) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
33
|
+
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
34
|
+
members.map(([memberName, [memberFlags]]) => {
|
|
35
|
+
if ((BUILD2.state || BUILD2.prop) && (memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
36
|
+
const ogValue = instance[memberName];
|
|
37
|
+
const ogDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName);
|
|
38
|
+
Object.defineProperty(instance, memberName, {
|
|
39
|
+
get() {
|
|
40
|
+
return ogDescriptor.get.call(this);
|
|
41
|
+
},
|
|
42
|
+
set(newValue) {
|
|
43
|
+
ogDescriptor.set.call(this, newValue);
|
|
44
|
+
},
|
|
45
|
+
configurable: true,
|
|
46
|
+
enumerable: true
|
|
47
|
+
});
|
|
48
|
+
instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
27
53
|
// src/client/client-host-ref.ts
|
|
28
|
-
var hostRefs =
|
|
54
|
+
var hostRefs = BUILD3.hotModuleReplacement ? window.__RINDO_HOSTREFS__ || (window.__RINDO_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
|
|
55
|
+
var deleteHostRef = (ref) => hostRefs.delete(ref);
|
|
29
56
|
var getHostRef = (ref) => hostRefs.get(ref);
|
|
30
57
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
31
58
|
hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
|
|
32
|
-
if (
|
|
59
|
+
if (BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
|
|
33
60
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
34
61
|
}
|
|
35
62
|
};
|
|
@@ -40,55 +67,33 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
40
67
|
$cmpMeta$: cmpMeta,
|
|
41
68
|
$instanceValues$: /* @__PURE__ */ new Map()
|
|
42
69
|
};
|
|
43
|
-
if (
|
|
70
|
+
if (BUILD3.isDev) {
|
|
44
71
|
hostRef.$renderCount$ = 0;
|
|
45
72
|
}
|
|
46
|
-
if (
|
|
73
|
+
if (BUILD3.method && BUILD3.lazyLoad) {
|
|
47
74
|
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
48
75
|
}
|
|
49
|
-
if (
|
|
76
|
+
if (BUILD3.asyncLoading) {
|
|
50
77
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
51
78
|
hostElement["s-p"] = [];
|
|
52
79
|
hostElement["s-rc"] = [];
|
|
53
80
|
}
|
|
54
81
|
const ref = hostRefs.set(hostElement, hostRef);
|
|
55
|
-
if (!
|
|
82
|
+
if (!BUILD3.lazyLoad && BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
|
|
56
83
|
reWireGetterSetter(hostElement, hostRef);
|
|
57
84
|
}
|
|
58
85
|
return ref;
|
|
59
86
|
};
|
|
60
87
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
61
|
-
var reWireGetterSetter = (instance, hostRef) => {
|
|
62
|
-
var _a;
|
|
63
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
64
|
-
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
65
|
-
members.map(([memberName, [memberFlags]]) => {
|
|
66
|
-
if (BUILD2.state && BUILD2.prop && (memberFlags & 2048 /* Getter */) === 0 && (memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
67
|
-
const ogValue = instance[memberName];
|
|
68
|
-
const lazyDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName);
|
|
69
|
-
Object.defineProperty(instance, memberName, {
|
|
70
|
-
get() {
|
|
71
|
-
return lazyDescriptor.get.call(this);
|
|
72
|
-
},
|
|
73
|
-
set(newValue) {
|
|
74
|
-
lazyDescriptor.set.call(this, newValue);
|
|
75
|
-
},
|
|
76
|
-
configurable: true,
|
|
77
|
-
enumerable: true
|
|
78
|
-
});
|
|
79
|
-
instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
88
|
|
|
84
89
|
// src/client/client-load-module.ts
|
|
85
|
-
import { BUILD as
|
|
90
|
+
import { BUILD as BUILD5 } from "@rindo/core/internal/app-data";
|
|
86
91
|
|
|
87
92
|
// src/client/client-log.ts
|
|
88
|
-
import { BUILD as
|
|
93
|
+
import { BUILD as BUILD4 } from "@rindo/core/internal/app-data";
|
|
89
94
|
var customError;
|
|
90
95
|
var consoleError = (e, el) => (customError || console.error)(e, el);
|
|
91
|
-
var RINDO_DEV_MODE =
|
|
96
|
+
var RINDO_DEV_MODE = BUILD4.isTesting ? ["RINDO:"] : [
|
|
92
97
|
"%crindo",
|
|
93
98
|
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
|
|
94
99
|
];
|
|
@@ -103,7 +108,7 @@ var MODULE_IMPORT_PREFIX = "./";
|
|
|
103
108
|
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
104
109
|
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
|
|
105
110
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
106
|
-
if (
|
|
111
|
+
if (BUILD5.isDev && typeof bundleId !== "string") {
|
|
107
112
|
consoleDevError(
|
|
108
113
|
`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`
|
|
109
114
|
);
|
|
@@ -111,24 +116,28 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
111
116
|
} else if (!bundleId) {
|
|
112
117
|
return void 0;
|
|
113
118
|
}
|
|
114
|
-
const module = !
|
|
119
|
+
const module = !BUILD5.hotModuleReplacement ? cmpModules.get(bundleId) : false;
|
|
115
120
|
if (module) {
|
|
116
121
|
return module[exportName];
|
|
117
122
|
}
|
|
118
123
|
/*!__RINDO_STATIC_IMPORT_SWITCH__*/
|
|
119
124
|
return import(
|
|
120
|
-
/* @wite-ignore */
|
|
121
125
|
/* @lahm-ignore */
|
|
122
126
|
/* webpackInclude: /\.entry\.js$/ */
|
|
123
127
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
124
128
|
/* webpackMode: "lazy" */
|
|
125
|
-
`./${bundleId}.entry.js${
|
|
126
|
-
).then(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
`./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
|
|
130
|
+
).then(
|
|
131
|
+
(importedModule) => {
|
|
132
|
+
if (!BUILD5.hotModuleReplacement) {
|
|
133
|
+
cmpModules.set(bundleId, importedModule);
|
|
134
|
+
}
|
|
135
|
+
return importedModule[exportName];
|
|
136
|
+
},
|
|
137
|
+
(e) => {
|
|
138
|
+
consoleError(e, hostRef.$hostElement$);
|
|
129
139
|
}
|
|
130
|
-
|
|
131
|
-
}, consoleError);
|
|
140
|
+
);
|
|
132
141
|
};
|
|
133
142
|
|
|
134
143
|
// src/client/client-style.ts
|
|
@@ -136,7 +145,7 @@ var styles = /* @__PURE__ */ new Map();
|
|
|
136
145
|
var modeResolutionChain = [];
|
|
137
146
|
|
|
138
147
|
// src/client/client-task-queue.ts
|
|
139
|
-
import { BUILD as
|
|
148
|
+
import { BUILD as BUILD7 } from "@rindo/core/internal/app-data";
|
|
140
149
|
|
|
141
150
|
// src/runtime/runtime-constants.ts
|
|
142
151
|
var CONTENT_REF_ID = "r";
|
|
@@ -164,7 +173,7 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
164
173
|
];
|
|
165
174
|
|
|
166
175
|
// src/client/client-window.ts
|
|
167
|
-
import { BUILD as
|
|
176
|
+
import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
|
|
168
177
|
var win = typeof window !== "undefined" ? window : {};
|
|
169
178
|
var doc = win.document || { head: {} };
|
|
170
179
|
var H = win.HTMLElement || class {
|
|
@@ -181,7 +190,7 @@ var plt = {
|
|
|
181
190
|
var setPlatformHelpers = (helpers) => {
|
|
182
191
|
Object.assign(plt, helpers);
|
|
183
192
|
};
|
|
184
|
-
var supportsShadow =
|
|
193
|
+
var supportsShadow = BUILD6.shadowDom;
|
|
185
194
|
var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
186
195
|
let supportsListenerOptions2 = false;
|
|
187
196
|
try {
|
|
@@ -199,7 +208,7 @@ var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
|
199
208
|
return supportsListenerOptions2;
|
|
200
209
|
})();
|
|
201
210
|
var promiseResolve = (v) => Promise.resolve(v);
|
|
202
|
-
var supportsConstructableStylesheets =
|
|
211
|
+
var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
|
|
203
212
|
try {
|
|
204
213
|
new CSSStyleSheet();
|
|
205
214
|
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
@@ -252,11 +261,11 @@ var consumeTimeout = (queue, timeout) => {
|
|
|
252
261
|
}
|
|
253
262
|
};
|
|
254
263
|
var flush = () => {
|
|
255
|
-
if (
|
|
264
|
+
if (BUILD7.asyncQueue) {
|
|
256
265
|
queueCongestion++;
|
|
257
266
|
}
|
|
258
267
|
consume(queueDomReads);
|
|
259
|
-
if (
|
|
268
|
+
if (BUILD7.asyncQueue) {
|
|
260
269
|
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
|
|
261
270
|
consumeTimeout(queueDomWrites, timeout);
|
|
262
271
|
consumeTimeout(queueDomWritesLow, timeout);
|
|
@@ -281,7 +290,7 @@ var readTask = /* @__PURE__ */ queueTask(queueDomReads, false);
|
|
|
281
290
|
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
|
282
291
|
|
|
283
292
|
// src/client/index.ts
|
|
284
|
-
import { BUILD as
|
|
293
|
+
import { BUILD as BUILD29, Env, NAMESPACE as NAMESPACE2 } from "@rindo/core/internal/app-data";
|
|
285
294
|
|
|
286
295
|
// src/runtime/asset-path.ts
|
|
287
296
|
var getAssetPath = (path) => {
|
|
@@ -291,7 +300,7 @@ var getAssetPath = (path) => {
|
|
|
291
300
|
var setAssetPath = (path) => plt.$resourcesUrl$ = path;
|
|
292
301
|
|
|
293
302
|
// src/runtime/bootstrap-custom-element.ts
|
|
294
|
-
import { BUILD as
|
|
303
|
+
import { BUILD as BUILD26 } from "@rindo/core/internal/app-data";
|
|
295
304
|
|
|
296
305
|
// src/utils/helpers.ts
|
|
297
306
|
var isDef = (v) => v != null && v !== void 0;
|
|
@@ -356,16 +365,16 @@ var unwrapErr = (result) => {
|
|
|
356
365
|
};
|
|
357
366
|
|
|
358
367
|
// src/runtime/connected-callback.ts
|
|
359
|
-
import { BUILD as
|
|
368
|
+
import { BUILD as BUILD24 } from "@rindo/core/internal/app-data";
|
|
360
369
|
|
|
361
370
|
// src/runtime/client-hydrate.ts
|
|
362
|
-
import { BUILD as
|
|
371
|
+
import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
|
|
363
372
|
|
|
364
373
|
// src/runtime/dom-extras.ts
|
|
365
|
-
import { BUILD as
|
|
374
|
+
import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
|
|
366
375
|
|
|
367
376
|
// src/runtime/slot-polyfill-utils.ts
|
|
368
|
-
import { BUILD as
|
|
377
|
+
import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
|
|
369
378
|
var updateFallbackSlotVisibility = (elm) => {
|
|
370
379
|
const childNodes = elm.__childNodes || elm.childNodes;
|
|
371
380
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
@@ -389,27 +398,27 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
389
398
|
var getSlottedChildNodes = (childNodes) => {
|
|
390
399
|
const result = [];
|
|
391
400
|
for (let i2 = 0; i2 < childNodes.length; i2++) {
|
|
392
|
-
const slottedNode = childNodes[i2]["s-nr"];
|
|
401
|
+
const slottedNode = childNodes[i2]["s-nr"] || void 0;
|
|
393
402
|
if (slottedNode && slottedNode.isConnected) {
|
|
394
403
|
result.push(slottedNode);
|
|
395
404
|
}
|
|
396
405
|
}
|
|
397
406
|
return result;
|
|
398
407
|
};
|
|
399
|
-
|
|
408
|
+
function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
400
409
|
let i2 = 0;
|
|
401
410
|
let slottedNodes = [];
|
|
402
411
|
let childNode;
|
|
403
412
|
for (; i2 < childNodes.length; i2++) {
|
|
404
413
|
childNode = childNodes[i2];
|
|
405
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (
|
|
414
|
+
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
|
|
406
415
|
slottedNodes.push(childNode);
|
|
407
416
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
408
417
|
}
|
|
409
418
|
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
|
|
410
419
|
}
|
|
411
420
|
return slottedNodes;
|
|
412
|
-
}
|
|
421
|
+
}
|
|
413
422
|
var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
|
|
414
423
|
const childNodes = [];
|
|
415
424
|
if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
|
|
@@ -445,7 +454,7 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
|
445
454
|
const parent = slotNode["s-cr"].parentNode;
|
|
446
455
|
const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
|
|
447
456
|
if (typeof position !== "undefined") {
|
|
448
|
-
if (
|
|
457
|
+
if (BUILD8.hydrateClientSide) {
|
|
449
458
|
slottedNodeLocation["s-oo"] = position;
|
|
450
459
|
const childNodes = parent.__childNodes || parent.childNodes;
|
|
451
460
|
const slotRelocateNodes = [slottedNodeLocation];
|
|
@@ -467,1819 +476,1913 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
|
467
476
|
};
|
|
468
477
|
var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
|
|
469
478
|
|
|
470
|
-
// src/runtime/
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
479
|
+
// src/runtime/dom-extras.ts
|
|
480
|
+
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
481
|
+
patchCloneNode(hostElementPrototype);
|
|
482
|
+
patchSlotAppendChild(hostElementPrototype);
|
|
483
|
+
patchSlotAppend(hostElementPrototype);
|
|
484
|
+
patchSlotPrepend(hostElementPrototype);
|
|
485
|
+
patchSlotInsertAdjacentElement(hostElementPrototype);
|
|
486
|
+
patchSlotInsertAdjacentHTML(hostElementPrototype);
|
|
487
|
+
patchSlotInsertAdjacentText(hostElementPrototype);
|
|
488
|
+
patchInsertBefore(hostElementPrototype);
|
|
489
|
+
patchTextContent(hostElementPrototype);
|
|
490
|
+
patchChildSlotNodes(hostElementPrototype);
|
|
491
|
+
patchSlotRemoveChild(hostElementPrototype);
|
|
492
|
+
};
|
|
493
|
+
var patchCloneNode = (HostElementPrototype) => {
|
|
494
|
+
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
495
|
+
HostElementPrototype.cloneNode = function(deep) {
|
|
496
|
+
const srcNode = this;
|
|
497
|
+
const isShadowDom = BUILD9.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
498
|
+
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
499
|
+
if (BUILD9.slot && !isShadowDom && deep) {
|
|
500
|
+
let i2 = 0;
|
|
501
|
+
let slotted, nonRindoNode;
|
|
502
|
+
const rindoPrivates = [
|
|
503
|
+
"s-id",
|
|
504
|
+
"s-cr",
|
|
505
|
+
"s-lr",
|
|
506
|
+
"s-rc",
|
|
507
|
+
"s-sc",
|
|
508
|
+
"s-p",
|
|
509
|
+
"s-cn",
|
|
510
|
+
"s-sr",
|
|
511
|
+
"s-sn",
|
|
512
|
+
"s-hn",
|
|
513
|
+
"s-ol",
|
|
514
|
+
"s-nr",
|
|
515
|
+
"s-si",
|
|
516
|
+
"s-rf",
|
|
517
|
+
"s-scs"
|
|
518
|
+
];
|
|
519
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
520
|
+
for (; i2 < childNodes.length; i2++) {
|
|
521
|
+
slotted = childNodes[i2]["s-nr"];
|
|
522
|
+
nonRindoNode = rindoPrivates.every((privateField) => !childNodes[i2][privateField]);
|
|
523
|
+
if (slotted) {
|
|
524
|
+
if (BUILD9.appendChildSlotFix && clonedNode.__appendChild) {
|
|
525
|
+
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
526
|
+
} else {
|
|
527
|
+
clonedNode.appendChild(slotted.cloneNode(true));
|
|
528
|
+
}
|
|
494
529
|
}
|
|
495
|
-
if (
|
|
496
|
-
|
|
497
|
-
} else {
|
|
498
|
-
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
|
530
|
+
if (nonRindoNode) {
|
|
531
|
+
clonedNode.appendChild(childNodes[i2].cloneNode(true));
|
|
499
532
|
}
|
|
500
|
-
lastSimple = simple;
|
|
501
533
|
}
|
|
502
534
|
}
|
|
535
|
+
return clonedNode;
|
|
503
536
|
};
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
537
|
+
};
|
|
538
|
+
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
539
|
+
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
540
|
+
HostElementPrototype.appendChild = function(newChild) {
|
|
541
|
+
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
542
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
543
|
+
if (slotNode) {
|
|
544
|
+
addSlotRelocateNode(newChild, slotNode);
|
|
545
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
546
|
+
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
547
|
+
const parent = intrnlCall(appendAfter, "parentNode");
|
|
548
|
+
let insertedNode;
|
|
549
|
+
if (parent.__insertBefore) {
|
|
550
|
+
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
551
|
+
} else {
|
|
552
|
+
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
553
|
+
}
|
|
554
|
+
updateFallbackSlotVisibility(this);
|
|
555
|
+
return insertedNode;
|
|
514
556
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
557
|
+
return this.__appendChild(newChild);
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
var patchSlotRemoveChild = (ElementPrototype) => {
|
|
561
|
+
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
562
|
+
ElementPrototype.removeChild = function(toRemove) {
|
|
563
|
+
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
564
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
565
|
+
const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
|
|
566
|
+
if (slotNode && toRemove.isConnected) {
|
|
567
|
+
toRemove.remove();
|
|
568
|
+
updateFallbackSlotVisibility(this);
|
|
569
|
+
return;
|
|
519
570
|
}
|
|
520
571
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
524
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
525
|
-
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
526
|
-
}
|
|
527
|
-
if (BUILD8.vdomFunctional && typeof nodeName === "function") {
|
|
528
|
-
return nodeName(
|
|
529
|
-
vnodeData === null ? {} : vnodeData,
|
|
530
|
-
vNodeChildren,
|
|
531
|
-
vdomFnUtils
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
const vnode = newVNode(nodeName, null);
|
|
535
|
-
vnode.$attrs$ = vnodeData;
|
|
536
|
-
if (vNodeChildren.length > 0) {
|
|
537
|
-
vnode.$children$ = vNodeChildren;
|
|
538
|
-
}
|
|
539
|
-
if (BUILD8.vdomKey) {
|
|
540
|
-
vnode.$key$ = key;
|
|
541
|
-
}
|
|
542
|
-
if (BUILD8.slotRelocation) {
|
|
543
|
-
vnode.$name$ = slotName;
|
|
544
|
-
}
|
|
545
|
-
return vnode;
|
|
572
|
+
return this.__removeChild(toRemove);
|
|
573
|
+
};
|
|
546
574
|
};
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
575
|
+
var patchSlotPrepend = (HostElementPrototype) => {
|
|
576
|
+
HostElementPrototype.__prepend = HostElementPrototype.prepend;
|
|
577
|
+
HostElementPrototype.prepend = function(...newChildren) {
|
|
578
|
+
newChildren.forEach((newChild) => {
|
|
579
|
+
if (typeof newChild === "string") {
|
|
580
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
|
581
|
+
}
|
|
582
|
+
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
583
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
584
|
+
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
585
|
+
if (slotNode) {
|
|
586
|
+
addSlotRelocateNode(newChild, slotNode, true);
|
|
587
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
588
|
+
const appendAfter = slotChildNodes[0];
|
|
589
|
+
const parent = intrnlCall(appendAfter, "parentNode");
|
|
590
|
+
if (parent.__insertBefore) {
|
|
591
|
+
return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
592
|
+
} else {
|
|
593
|
+
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
597
|
+
newChild.hidden = true;
|
|
598
|
+
}
|
|
599
|
+
return HostElementPrototype.__prepend(newChild);
|
|
600
|
+
});
|
|
554
601
|
};
|
|
555
|
-
if (BUILD8.vdomAttribute) {
|
|
556
|
-
vnode.$attrs$ = null;
|
|
557
|
-
}
|
|
558
|
-
if (BUILD8.vdomKey) {
|
|
559
|
-
vnode.$key$ = null;
|
|
560
|
-
}
|
|
561
|
-
if (BUILD8.slotRelocation) {
|
|
562
|
-
vnode.$name$ = null;
|
|
563
|
-
}
|
|
564
|
-
return vnode;
|
|
565
602
|
};
|
|
566
|
-
var
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
603
|
+
var patchSlotAppend = (HostElementPrototype) => {
|
|
604
|
+
HostElementPrototype.__append = HostElementPrototype.append;
|
|
605
|
+
HostElementPrototype.append = function(...newChildren) {
|
|
606
|
+
newChildren.forEach((newChild) => {
|
|
607
|
+
if (typeof newChild === "string") {
|
|
608
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
|
609
|
+
}
|
|
610
|
+
this.appendChild(newChild);
|
|
611
|
+
});
|
|
612
|
+
};
|
|
571
613
|
};
|
|
572
|
-
var
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
vtag: node.$tag$,
|
|
578
|
-
vtext: node.$text$
|
|
579
|
-
});
|
|
580
|
-
var convertToPrivate = (node) => {
|
|
581
|
-
if (typeof node.vtag === "function") {
|
|
582
|
-
const vnodeData = { ...node.vattrs };
|
|
583
|
-
if (node.vkey) {
|
|
584
|
-
vnodeData.key = node.vkey;
|
|
614
|
+
var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
|
615
|
+
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
|
|
616
|
+
HostElementPrototype.insertAdjacentHTML = function(position, text) {
|
|
617
|
+
if (position !== "afterbegin" && position !== "beforeend") {
|
|
618
|
+
return originalInsertAdjacentHtml.call(this, position, text);
|
|
585
619
|
}
|
|
586
|
-
|
|
587
|
-
|
|
620
|
+
const container = this.ownerDocument.createElement("_");
|
|
621
|
+
let node;
|
|
622
|
+
container.innerHTML = text;
|
|
623
|
+
if (position === "afterbegin") {
|
|
624
|
+
while (node = container.firstChild) {
|
|
625
|
+
this.prepend(node);
|
|
626
|
+
}
|
|
627
|
+
} else if (position === "beforeend") {
|
|
628
|
+
while (node = container.firstChild) {
|
|
629
|
+
this.append(node);
|
|
630
|
+
}
|
|
588
631
|
}
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
592
|
-
vnode.$attrs$ = node.vattrs;
|
|
593
|
-
vnode.$children$ = node.vchildren;
|
|
594
|
-
vnode.$key$ = node.vkey;
|
|
595
|
-
vnode.$name$ = node.vname;
|
|
596
|
-
return vnode;
|
|
632
|
+
};
|
|
597
633
|
};
|
|
598
|
-
var
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
const typeIndex = props.indexOf("type");
|
|
605
|
-
const minIndex = props.indexOf("min");
|
|
606
|
-
const maxIndex = props.indexOf("max");
|
|
607
|
-
const stepIndex = props.indexOf("step");
|
|
608
|
-
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
|
609
|
-
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
|
610
|
-
}
|
|
634
|
+
var patchSlotInsertAdjacentText = (HostElementPrototype) => {
|
|
635
|
+
HostElementPrototype.insertAdjacentText = function(position, text) {
|
|
636
|
+
this.insertAdjacentHTML(position, text);
|
|
637
|
+
};
|
|
611
638
|
};
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
oldClasses.forEach((c) => {
|
|
629
|
-
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
630
|
-
});
|
|
631
|
-
newClasses = [...new Set(newClasses)];
|
|
632
|
-
classList.add(...newClasses);
|
|
633
|
-
delete elm["s-si"];
|
|
634
|
-
} else {
|
|
635
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
636
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
637
|
-
}
|
|
638
|
-
} else if (BUILD9.vdomStyle && memberName === "style") {
|
|
639
|
-
if (BUILD9.updatable) {
|
|
640
|
-
for (const prop in oldValue) {
|
|
641
|
-
if (!newValue || newValue[prop] == null) {
|
|
642
|
-
if (!BUILD9.hydrateServerSide && prop.includes("-")) {
|
|
643
|
-
elm.style.removeProperty(prop);
|
|
644
|
-
} else {
|
|
645
|
-
elm.style[prop] = "";
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
for (const prop in newValue) {
|
|
651
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
652
|
-
if (!BUILD9.hydrateServerSide && prop.includes("-")) {
|
|
653
|
-
elm.style.setProperty(prop, newValue[prop]);
|
|
654
|
-
} else {
|
|
655
|
-
elm.style[prop] = newValue[prop];
|
|
639
|
+
var patchInsertBefore = (HostElementPrototype) => {
|
|
640
|
+
const eleProto = HostElementPrototype;
|
|
641
|
+
if (eleProto.__insertBefore) return;
|
|
642
|
+
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
643
|
+
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
644
|
+
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
645
|
+
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
646
|
+
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
647
|
+
if (slotNode) {
|
|
648
|
+
let found = false;
|
|
649
|
+
slottedNodes.forEach((childNode) => {
|
|
650
|
+
if (childNode === currentChild || currentChild === null) {
|
|
651
|
+
found = true;
|
|
652
|
+
if (currentChild === null || slotName !== currentChild["s-sn"]) {
|
|
653
|
+
this.appendChild(newChild);
|
|
654
|
+
return;
|
|
656
655
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
} else if (BUILD9.vdomListener && (BUILD9.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
665
|
-
if (memberName[2] === "-") {
|
|
666
|
-
memberName = memberName.slice(3);
|
|
667
|
-
} else if (isMemberInElement(win, ln)) {
|
|
668
|
-
memberName = ln.slice(2);
|
|
669
|
-
} else {
|
|
670
|
-
memberName = ln[2] + memberName.slice(3);
|
|
671
|
-
}
|
|
672
|
-
if (oldValue || newValue) {
|
|
673
|
-
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
674
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
675
|
-
if (oldValue) {
|
|
676
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
677
|
-
}
|
|
678
|
-
if (newValue) {
|
|
679
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
} else if (BUILD9.vdomPropOrAttr) {
|
|
683
|
-
const isComplex = isComplexType(newValue);
|
|
684
|
-
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
685
|
-
try {
|
|
686
|
-
if (!elm.tagName.includes("-")) {
|
|
687
|
-
const n = newValue == null ? "" : newValue;
|
|
688
|
-
if (memberName === "list") {
|
|
689
|
-
isProp = false;
|
|
690
|
-
} else if (oldValue == null || elm[memberName] != n) {
|
|
691
|
-
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
692
|
-
elm[memberName] = n;
|
|
693
|
-
} else {
|
|
694
|
-
elm.setAttribute(memberName, n);
|
|
695
|
-
}
|
|
656
|
+
if (slotName === currentChild["s-sn"]) {
|
|
657
|
+
addSlotRelocateNode(newChild, slotNode);
|
|
658
|
+
const parent = intrnlCall(currentChild, "parentNode");
|
|
659
|
+
if (parent.__insertBefore) {
|
|
660
|
+
parent.__insertBefore(newChild, currentChild);
|
|
661
|
+
} else {
|
|
662
|
+
parent.insertBefore(newChild, currentChild);
|
|
696
663
|
}
|
|
697
|
-
} else {
|
|
698
|
-
elm[memberName] = newValue;
|
|
699
|
-
}
|
|
700
|
-
} catch (e) {
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
let xlink = false;
|
|
704
|
-
if (BUILD9.vdomXlink) {
|
|
705
|
-
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
706
|
-
memberName = ln;
|
|
707
|
-
xlink = true;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
if (newValue == null || newValue === false) {
|
|
711
|
-
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
712
|
-
if (BUILD9.vdomXlink && xlink) {
|
|
713
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
714
|
-
} else {
|
|
715
|
-
elm.removeAttribute(memberName);
|
|
716
664
|
}
|
|
665
|
+
return;
|
|
717
666
|
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
if (BUILD9.vdomXlink && xlink) {
|
|
721
|
-
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
722
|
-
} else {
|
|
723
|
-
elm.setAttribute(memberName, newValue);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
667
|
+
});
|
|
668
|
+
if (found) return newChild;
|
|
726
669
|
}
|
|
727
|
-
|
|
670
|
+
return this.__insertBefore(newChild, currentChild);
|
|
671
|
+
};
|
|
728
672
|
};
|
|
729
|
-
var
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
673
|
+
var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
|
674
|
+
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
|
675
|
+
HostElementPrototype.insertAdjacentElement = function(position, element) {
|
|
676
|
+
if (position !== "afterbegin" && position !== "beforeend") {
|
|
677
|
+
return originalInsertAdjacentElement.call(this, position, element);
|
|
678
|
+
}
|
|
679
|
+
if (position === "afterbegin") {
|
|
680
|
+
this.prepend(element);
|
|
681
|
+
return element;
|
|
682
|
+
} else if (position === "beforeend") {
|
|
683
|
+
this.append(element);
|
|
684
|
+
return element;
|
|
685
|
+
}
|
|
686
|
+
return element;
|
|
687
|
+
};
|
|
738
688
|
};
|
|
739
|
-
var
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
689
|
+
var patchTextContent = (hostElementPrototype) => {
|
|
690
|
+
patchHostOriginalAccessor("textContent", hostElementPrototype);
|
|
691
|
+
Object.defineProperty(hostElementPrototype, "textContent", {
|
|
692
|
+
get: function() {
|
|
693
|
+
let text = "";
|
|
694
|
+
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
695
|
+
childNodes.forEach((node) => text += node.textContent || "");
|
|
696
|
+
return text;
|
|
697
|
+
},
|
|
698
|
+
set: function(value) {
|
|
699
|
+
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
700
|
+
childNodes.forEach((node) => {
|
|
701
|
+
if (node["s-ol"]) node["s-ol"].remove();
|
|
702
|
+
node.remove();
|
|
703
|
+
});
|
|
704
|
+
this.insertAdjacentHTML("beforeend", value);
|
|
752
705
|
}
|
|
753
|
-
}
|
|
754
|
-
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
|
755
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
|
|
756
|
-
}
|
|
706
|
+
});
|
|
757
707
|
};
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
) : (
|
|
763
|
-
// no need to sort, return the original array
|
|
764
|
-
attrNames
|
|
765
|
-
);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// src/runtime/vdom/vdom-render.ts
|
|
769
|
-
var scopeId;
|
|
770
|
-
var contentRef;
|
|
771
|
-
var hostTagName;
|
|
772
|
-
var useNativeShadowDom = false;
|
|
773
|
-
var checkSlotFallbackVisibility = false;
|
|
774
|
-
var checkSlotRelocate = false;
|
|
775
|
-
var isSvgMode = false;
|
|
776
|
-
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
777
|
-
var _a;
|
|
778
|
-
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
779
|
-
let i2 = 0;
|
|
780
|
-
let elm;
|
|
781
|
-
let childNode;
|
|
782
|
-
let oldVNode;
|
|
783
|
-
if (BUILD11.slotRelocation && !useNativeShadowDom) {
|
|
784
|
-
checkSlotRelocate = true;
|
|
785
|
-
if (newVNode2.$tag$ === "slot") {
|
|
786
|
-
newVNode2.$flags$ |= newVNode2.$children$ ? (
|
|
787
|
-
// slot element has fallback content
|
|
788
|
-
// still create an element that "mocks" the slot element
|
|
789
|
-
2 /* isSlotFallback */
|
|
790
|
-
) : (
|
|
791
|
-
// slot element does not have fallback content
|
|
792
|
-
// create an html comment we'll use to always reference
|
|
793
|
-
// where actual slot content should sit next to
|
|
794
|
-
1 /* isSlotReference */
|
|
795
|
-
);
|
|
708
|
+
var patchChildSlotNodes = (elm) => {
|
|
709
|
+
class FakeNodeList extends Array {
|
|
710
|
+
item(n) {
|
|
711
|
+
return this[n];
|
|
796
712
|
}
|
|
797
713
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
if (BUILD11.vdomText && newVNode2.$text$ !== null) {
|
|
804
|
-
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
|
805
|
-
} else if (BUILD11.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
806
|
-
elm = newVNode2.$elm$ = BUILD11.isDebug || BUILD11.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
|
|
807
|
-
} else {
|
|
808
|
-
if (BUILD11.svg && !isSvgMode) {
|
|
809
|
-
isSvgMode = newVNode2.$tag$ === "svg";
|
|
810
|
-
}
|
|
811
|
-
elm = newVNode2.$elm$ = BUILD11.svg ? doc.createElementNS(
|
|
812
|
-
isSvgMode ? SVG_NS : HTML_NS,
|
|
813
|
-
!useNativeShadowDom && BUILD11.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
814
|
-
) : doc.createElement(
|
|
815
|
-
!useNativeShadowDom && BUILD11.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
816
|
-
);
|
|
817
|
-
if (BUILD11.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
818
|
-
isSvgMode = false;
|
|
714
|
+
patchHostOriginalAccessor("children", elm);
|
|
715
|
+
Object.defineProperty(elm, "children", {
|
|
716
|
+
get() {
|
|
717
|
+
return this.childNodes.filter((n) => n.nodeType === 1);
|
|
819
718
|
}
|
|
820
|
-
|
|
821
|
-
|
|
719
|
+
});
|
|
720
|
+
Object.defineProperty(elm, "childElementCount", {
|
|
721
|
+
get() {
|
|
722
|
+
return this.children.length;
|
|
822
723
|
}
|
|
823
|
-
|
|
824
|
-
|
|
724
|
+
});
|
|
725
|
+
patchHostOriginalAccessor("firstChild", elm);
|
|
726
|
+
Object.defineProperty(elm, "firstChild", {
|
|
727
|
+
get() {
|
|
728
|
+
return this.childNodes[0];
|
|
825
729
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
}
|
|
730
|
+
});
|
|
731
|
+
patchHostOriginalAccessor("lastChild", elm);
|
|
732
|
+
Object.defineProperty(elm, "lastChild", {
|
|
733
|
+
get() {
|
|
734
|
+
return this.childNodes[this.childNodes.length - 1];
|
|
833
735
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
736
|
+
});
|
|
737
|
+
patchHostOriginalAccessor("childNodes", elm);
|
|
738
|
+
Object.defineProperty(elm, "childNodes", {
|
|
739
|
+
get() {
|
|
740
|
+
const result = new FakeNodeList();
|
|
741
|
+
result.push(...getSlottedChildNodes(this.__childNodes));
|
|
742
|
+
return result;
|
|
840
743
|
}
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
var patchSlottedNode = (node) => {
|
|
747
|
+
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
748
|
+
patchNextSibling(node);
|
|
749
|
+
patchPreviousSibling(node);
|
|
750
|
+
patchParentNode(node);
|
|
751
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
752
|
+
patchNextElementSibling(node);
|
|
753
|
+
patchPreviousElementSibling(node);
|
|
841
754
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
} else {
|
|
854
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
if (BUILD11.scoped) {
|
|
858
|
-
addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
|
|
755
|
+
};
|
|
756
|
+
var patchNextSibling = (node) => {
|
|
757
|
+
if (!node || node.__nextSibling) return;
|
|
758
|
+
patchHostOriginalAccessor("nextSibling", node);
|
|
759
|
+
Object.defineProperty(node, "nextSibling", {
|
|
760
|
+
get: function() {
|
|
761
|
+
var _a;
|
|
762
|
+
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
|
|
763
|
+
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
|
|
764
|
+
if (parentNodes && index > -1) {
|
|
765
|
+
return parentNodes[index + 1];
|
|
859
766
|
}
|
|
767
|
+
return this.__nextSibling;
|
|
860
768
|
}
|
|
861
|
-
}
|
|
862
|
-
return elm;
|
|
769
|
+
});
|
|
863
770
|
};
|
|
864
|
-
var
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
875
|
-
if (childNode["s-sh"] != null) {
|
|
876
|
-
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
877
|
-
childNode["s-sh"] = void 0;
|
|
878
|
-
checkSlotRelocate = true;
|
|
771
|
+
var patchNextElementSibling = (element) => {
|
|
772
|
+
if (!element || element.__nextElementSibling) return;
|
|
773
|
+
patchHostOriginalAccessor("nextElementSibling", element);
|
|
774
|
+
Object.defineProperty(element, "nextElementSibling", {
|
|
775
|
+
get: function() {
|
|
776
|
+
var _a;
|
|
777
|
+
const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
|
|
778
|
+
const index = parentEles == null ? void 0 : parentEles.indexOf(this);
|
|
779
|
+
if (parentEles && index > -1) {
|
|
780
|
+
return parentEles[index + 1];
|
|
879
781
|
}
|
|
782
|
+
return this.__nextElementSibling;
|
|
880
783
|
}
|
|
881
|
-
}
|
|
882
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
784
|
+
});
|
|
883
785
|
};
|
|
884
|
-
var
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
786
|
+
var patchPreviousSibling = (node) => {
|
|
787
|
+
if (!node || node.__previousSibling) return;
|
|
788
|
+
patchHostOriginalAccessor("previousSibling", node);
|
|
789
|
+
Object.defineProperty(node, "previousSibling", {
|
|
790
|
+
get: function() {
|
|
791
|
+
var _a;
|
|
792
|
+
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
|
|
793
|
+
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
|
|
794
|
+
if (parentNodes && index > -1) {
|
|
795
|
+
return parentNodes[index - 1];
|
|
892
796
|
}
|
|
797
|
+
return this.__previousSibling;
|
|
893
798
|
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
799
|
+
});
|
|
800
|
+
};
|
|
801
|
+
var patchPreviousElementSibling = (element) => {
|
|
802
|
+
if (!element || element.__previousElementSibling) return;
|
|
803
|
+
patchHostOriginalAccessor("previousElementSibling", element);
|
|
804
|
+
Object.defineProperty(element, "previousElementSibling", {
|
|
805
|
+
get: function() {
|
|
806
|
+
var _a;
|
|
807
|
+
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
|
|
808
|
+
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
|
|
809
|
+
if (parentNodes && index > -1) {
|
|
810
|
+
return parentNodes[index - 1];
|
|
811
|
+
}
|
|
812
|
+
return this.__previousElementSibling;
|
|
903
813
|
}
|
|
904
|
-
|
|
905
|
-
|
|
814
|
+
});
|
|
815
|
+
};
|
|
816
|
+
var patchParentNode = (node) => {
|
|
817
|
+
if (!node || node.__parentNode) return;
|
|
818
|
+
patchHostOriginalAccessor("parentNode", node);
|
|
819
|
+
Object.defineProperty(node, "parentNode", {
|
|
820
|
+
get: function() {
|
|
821
|
+
var _a;
|
|
822
|
+
return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
|
|
823
|
+
},
|
|
824
|
+
set: function(value) {
|
|
825
|
+
this.__parentNode = value;
|
|
906
826
|
}
|
|
907
|
-
}
|
|
908
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
827
|
+
});
|
|
909
828
|
};
|
|
910
|
-
var
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
829
|
+
var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
|
|
830
|
+
var validNodesPatches = [
|
|
831
|
+
"childNodes",
|
|
832
|
+
"firstChild",
|
|
833
|
+
"lastChild",
|
|
834
|
+
"nextSibling",
|
|
835
|
+
"previousSibling",
|
|
836
|
+
"textContent",
|
|
837
|
+
"parentNode"
|
|
838
|
+
];
|
|
839
|
+
function patchHostOriginalAccessor(accessorName, node) {
|
|
840
|
+
let accessor;
|
|
841
|
+
if (validElementPatches.includes(accessorName)) {
|
|
842
|
+
accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
|
|
843
|
+
} else if (validNodesPatches.includes(accessorName)) {
|
|
844
|
+
accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
|
|
915
845
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
846
|
+
if (!accessor) {
|
|
847
|
+
accessor = Object.getOwnPropertyDescriptor(node, accessorName);
|
|
848
|
+
}
|
|
849
|
+
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
850
|
+
}
|
|
851
|
+
function intrnlCall(node, method) {
|
|
852
|
+
if ("__" + method in node) {
|
|
853
|
+
return node["__" + method];
|
|
854
|
+
} else {
|
|
855
|
+
return node[method];
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// src/runtime/profile.ts
|
|
860
|
+
import { BUILD as BUILD10 } from "@rindo/core/internal/app-data";
|
|
861
|
+
var i = 0;
|
|
862
|
+
var createTime = (fnName, tagName = "") => {
|
|
863
|
+
if (BUILD10.profile && performance.mark) {
|
|
864
|
+
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
865
|
+
performance.mark(key);
|
|
866
|
+
return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
|
|
867
|
+
} else {
|
|
868
|
+
return () => {
|
|
869
|
+
return;
|
|
870
|
+
};
|
|
924
871
|
}
|
|
925
872
|
};
|
|
926
|
-
var
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
const elm = vnode.$elm$;
|
|
931
|
-
nullifyVNodeRefs(vnode);
|
|
932
|
-
if (elm) {
|
|
933
|
-
if (BUILD11.slotRelocation) {
|
|
934
|
-
checkSlotFallbackVisibility = true;
|
|
935
|
-
if (elm["s-ol"]) {
|
|
936
|
-
elm["s-ol"].remove();
|
|
937
|
-
} else {
|
|
938
|
-
putBackInOriginalLocation(elm, true);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
elm.remove();
|
|
942
|
-
}
|
|
873
|
+
var uniqueTime = (key, measureText) => {
|
|
874
|
+
if (BUILD10.profile && performance.mark) {
|
|
875
|
+
if (performance.getEntriesByName(key, "mark").length === 0) {
|
|
876
|
+
performance.mark(key);
|
|
943
877
|
}
|
|
878
|
+
return () => {
|
|
879
|
+
if (performance.getEntriesByName(measureText, "measure").length === 0) {
|
|
880
|
+
performance.measure(measureText, key);
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
} else {
|
|
884
|
+
return () => {
|
|
885
|
+
return;
|
|
886
|
+
};
|
|
944
887
|
}
|
|
945
888
|
};
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
889
|
+
var inspect = (ref) => {
|
|
890
|
+
const hostRef = getHostRef(ref);
|
|
891
|
+
if (!hostRef) {
|
|
892
|
+
return void 0;
|
|
893
|
+
}
|
|
894
|
+
const flags = hostRef.$flags$;
|
|
895
|
+
const hostElement = hostRef.$hostElement$;
|
|
896
|
+
return {
|
|
897
|
+
renderCount: hostRef.$renderCount$,
|
|
898
|
+
flags: {
|
|
899
|
+
hasRendered: !!(flags & 2 /* hasRendered */),
|
|
900
|
+
hasConnected: !!(flags & 1 /* hasConnected */),
|
|
901
|
+
isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
|
|
902
|
+
isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
|
|
903
|
+
isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
|
|
904
|
+
hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
|
|
905
|
+
hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
|
|
906
|
+
isWatchReady: !!(flags & 128 /* isWatchReady */),
|
|
907
|
+
isListenReady: !!(flags & 256 /* isListenReady */),
|
|
908
|
+
needsRerender: !!(flags & 512 /* needsRerender */)
|
|
909
|
+
},
|
|
910
|
+
instanceValues: hostRef.$instanceValues$,
|
|
911
|
+
ancestorComponent: hostRef.$ancestorComponent$,
|
|
912
|
+
hostElement,
|
|
913
|
+
lazyInstance: hostRef.$lazyInstance$,
|
|
914
|
+
vnode: hostRef.$vnode$,
|
|
915
|
+
modeName: hostRef.$modeName$,
|
|
916
|
+
onReadyPromise: hostRef.$onReadyPromise$,
|
|
917
|
+
onReadyResolve: hostRef.$onReadyResolve$,
|
|
918
|
+
onInstancePromise: hostRef.$onInstancePromise$,
|
|
919
|
+
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
920
|
+
onRenderResolve: hostRef.$onRenderResolve$,
|
|
921
|
+
queuedListeners: hostRef.$queuedListeners$,
|
|
922
|
+
rmListeners: hostRef.$rmListeners$,
|
|
923
|
+
["s-id"]: hostElement["s-id"],
|
|
924
|
+
["s-cr"]: hostElement["s-cr"],
|
|
925
|
+
["s-lr"]: hostElement["s-lr"],
|
|
926
|
+
["s-p"]: hostElement["s-p"],
|
|
927
|
+
["s-rc"]: hostElement["s-rc"],
|
|
928
|
+
["s-sc"]: hostElement["s-sc"]
|
|
929
|
+
};
|
|
930
|
+
};
|
|
931
|
+
var installDevTools = () => {
|
|
932
|
+
if (BUILD10.devTools) {
|
|
933
|
+
const rindo = win.rindo = win.rindo || {};
|
|
934
|
+
const originalInspect = rindo.inspect;
|
|
935
|
+
rindo.inspect = (ref) => {
|
|
936
|
+
let result = inspect(ref);
|
|
937
|
+
if (!result && typeof originalInspect === "function") {
|
|
938
|
+
result = originalInspect(ref);
|
|
987
939
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
940
|
+
return result;
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
// src/runtime/vdom/h.ts
|
|
946
|
+
import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
|
|
947
|
+
var h = (nodeName, vnodeData, ...children) => {
|
|
948
|
+
let child = null;
|
|
949
|
+
let key = null;
|
|
950
|
+
let slotName = null;
|
|
951
|
+
let simple = false;
|
|
952
|
+
let lastSimple = false;
|
|
953
|
+
const vNodeChildren = [];
|
|
954
|
+
const walk = (c) => {
|
|
955
|
+
for (let i2 = 0; i2 < c.length; i2++) {
|
|
956
|
+
child = c[i2];
|
|
957
|
+
if (Array.isArray(child)) {
|
|
958
|
+
walk(child);
|
|
959
|
+
} else if (child != null && typeof child !== "boolean") {
|
|
960
|
+
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
961
|
+
child = String(child);
|
|
962
|
+
} else if (BUILD11.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
963
|
+
consoleDevError(`vNode passed as children has unexpected type.
|
|
964
|
+
Make sure it's using the correct h() function.
|
|
965
|
+
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
1000
966
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
elmToMove = oldCh[idxInOld];
|
|
1004
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
1005
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
|
|
967
|
+
if (simple && lastSimple) {
|
|
968
|
+
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
1006
969
|
} else {
|
|
1007
|
-
|
|
1008
|
-
oldCh[idxInOld] = void 0;
|
|
1009
|
-
node = elmToMove.$elm$;
|
|
970
|
+
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
|
1010
971
|
}
|
|
1011
|
-
|
|
1012
|
-
} else {
|
|
1013
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
|
1014
|
-
newStartVnode = newCh[++newStartIdx];
|
|
972
|
+
lastSimple = simple;
|
|
1015
973
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
walk(children);
|
|
977
|
+
if (vnodeData) {
|
|
978
|
+
if (BUILD11.isDev && nodeName === "input") {
|
|
979
|
+
validateInputProperties(vnodeData);
|
|
980
|
+
}
|
|
981
|
+
if (BUILD11.vdomKey && vnodeData.key) {
|
|
982
|
+
key = vnodeData.key;
|
|
983
|
+
}
|
|
984
|
+
if (BUILD11.slotRelocation && vnodeData.name) {
|
|
985
|
+
slotName = vnodeData.name;
|
|
986
|
+
}
|
|
987
|
+
if (BUILD11.vdomClass) {
|
|
988
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
989
|
+
if (classData) {
|
|
990
|
+
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
1026
991
|
}
|
|
1027
992
|
}
|
|
1028
993
|
}
|
|
1029
|
-
if (
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
994
|
+
if (BUILD11.isDev && vNodeChildren.some(isHost)) {
|
|
995
|
+
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
996
|
+
- You are NOT using hostData() and <Host> in the same component.
|
|
997
|
+
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
998
|
+
}
|
|
999
|
+
if (BUILD11.vdomFunctional && typeof nodeName === "function") {
|
|
1000
|
+
return nodeName(
|
|
1001
|
+
vnodeData === null ? {} : vnodeData,
|
|
1002
|
+
vNodeChildren,
|
|
1003
|
+
vdomFnUtils
|
|
1037
1004
|
);
|
|
1038
|
-
} else if (BUILD11.updatable && newStartIdx > newEndIdx) {
|
|
1039
|
-
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
1040
1005
|
}
|
|
1006
|
+
const vnode = newVNode(nodeName, null);
|
|
1007
|
+
vnode.$attrs$ = vnodeData;
|
|
1008
|
+
if (vNodeChildren.length > 0) {
|
|
1009
|
+
vnode.$children$ = vNodeChildren;
|
|
1010
|
+
}
|
|
1011
|
+
if (BUILD11.vdomKey) {
|
|
1012
|
+
vnode.$key$ = key;
|
|
1013
|
+
}
|
|
1014
|
+
if (BUILD11.slotRelocation) {
|
|
1015
|
+
vnode.$name$ = slotName;
|
|
1016
|
+
}
|
|
1017
|
+
return vnode;
|
|
1041
1018
|
};
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
return true;
|
|
1019
|
+
var newVNode = (tag, text) => {
|
|
1020
|
+
const vnode = {
|
|
1021
|
+
$flags$: 0,
|
|
1022
|
+
$tag$: tag,
|
|
1023
|
+
$text$: text,
|
|
1024
|
+
$elm$: null,
|
|
1025
|
+
$children$: null
|
|
1026
|
+
};
|
|
1027
|
+
if (BUILD11.vdomAttribute) {
|
|
1028
|
+
vnode.$attrs$ = null;
|
|
1054
1029
|
}
|
|
1055
|
-
|
|
1030
|
+
if (BUILD11.vdomKey) {
|
|
1031
|
+
vnode.$key$ = null;
|
|
1032
|
+
}
|
|
1033
|
+
if (BUILD11.slotRelocation) {
|
|
1034
|
+
vnode.$name$ = null;
|
|
1035
|
+
}
|
|
1036
|
+
return vnode;
|
|
1056
1037
|
};
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
if (BUILD11.updatable && oldChildren !== null && newChildren !== null) {
|
|
1080
|
-
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
1081
|
-
} else if (newChildren !== null) {
|
|
1082
|
-
if (BUILD11.updatable && BUILD11.vdomText && oldVNode.$text$ !== null) {
|
|
1083
|
-
elm.textContent = "";
|
|
1084
|
-
}
|
|
1085
|
-
addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
|
|
1086
|
-
} else if (
|
|
1087
|
-
// don't do this on initial render as it can cause non-hydrated content to be removed
|
|
1088
|
-
!isInitialRender && BUILD11.updatable && oldChildren !== null
|
|
1089
|
-
) {
|
|
1090
|
-
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1038
|
+
var Host = {};
|
|
1039
|
+
var isHost = (node) => node && node.$tag$ === Host;
|
|
1040
|
+
var vdomFnUtils = {
|
|
1041
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
1042
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
|
|
1043
|
+
};
|
|
1044
|
+
var convertToPublic = (node) => ({
|
|
1045
|
+
vattrs: node.$attrs$,
|
|
1046
|
+
vchildren: node.$children$,
|
|
1047
|
+
vkey: node.$key$,
|
|
1048
|
+
vname: node.$name$,
|
|
1049
|
+
vtag: node.$tag$,
|
|
1050
|
+
vtext: node.$text$
|
|
1051
|
+
});
|
|
1052
|
+
var convertToPrivate = (node) => {
|
|
1053
|
+
if (typeof node.vtag === "function") {
|
|
1054
|
+
const vnodeData = { ...node.vattrs };
|
|
1055
|
+
if (node.vkey) {
|
|
1056
|
+
vnodeData.key = node.vkey;
|
|
1091
1057
|
}
|
|
1092
|
-
if (
|
|
1093
|
-
|
|
1058
|
+
if (node.vname) {
|
|
1059
|
+
vnodeData.name = node.vname;
|
|
1094
1060
|
}
|
|
1095
|
-
|
|
1096
|
-
defaultHolder.parentNode.textContent = text;
|
|
1097
|
-
} else if (BUILD11.vdomText && oldVNode.$text$ !== text) {
|
|
1098
|
-
elm.data = text;
|
|
1061
|
+
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
1099
1062
|
}
|
|
1063
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
1064
|
+
vnode.$attrs$ = node.vattrs;
|
|
1065
|
+
vnode.$children$ = node.vchildren;
|
|
1066
|
+
vnode.$key$ = node.vkey;
|
|
1067
|
+
vnode.$name$ = node.vname;
|
|
1068
|
+
return vnode;
|
|
1100
1069
|
};
|
|
1101
|
-
var
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
const children = elm.__childNodes || elm.childNodes;
|
|
1107
|
-
for (const childNode of children) {
|
|
1108
|
-
if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
|
|
1109
|
-
hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
|
|
1110
|
-
const slotName = childNode["s-sn"];
|
|
1111
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1112
|
-
node = hostContentNodes[j];
|
|
1113
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD11.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
|
|
1114
|
-
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1115
|
-
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1116
|
-
checkSlotFallbackVisibility = true;
|
|
1117
|
-
node["s-sn"] = node["s-sn"] || slotName;
|
|
1118
|
-
if (relocateNodeData) {
|
|
1119
|
-
relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
|
|
1120
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
|
1121
|
-
} else {
|
|
1122
|
-
node["s-sh"] = childNode["s-hn"];
|
|
1123
|
-
relocateNodes.push({
|
|
1124
|
-
$slotRefNode$: childNode,
|
|
1125
|
-
$nodeToRelocate$: node
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
if (node["s-sr"]) {
|
|
1129
|
-
relocateNodes.map((relocateNode) => {
|
|
1130
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
|
|
1131
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1132
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1133
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
} else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1139
|
-
relocateNodes.push({
|
|
1140
|
-
$nodeToRelocate$: node
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1147
|
-
markSlotContentForRelocation(childNode);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
var nullifyVNodeRefs = (vNode) => {
|
|
1152
|
-
if (BUILD11.vdomRef) {
|
|
1153
|
-
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1154
|
-
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
1070
|
+
var validateInputProperties = (inputElm) => {
|
|
1071
|
+
const props = Object.keys(inputElm);
|
|
1072
|
+
const value = props.indexOf("value");
|
|
1073
|
+
if (value === -1) {
|
|
1074
|
+
return;
|
|
1155
1075
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1076
|
+
const typeIndex = props.indexOf("type");
|
|
1077
|
+
const minIndex = props.indexOf("min");
|
|
1078
|
+
const maxIndex = props.indexOf("max");
|
|
1079
|
+
const stepIndex = props.indexOf("step");
|
|
1080
|
+
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
|
1081
|
+
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
|
1160
1082
|
}
|
|
1161
|
-
const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
1162
|
-
return inserted;
|
|
1163
1083
|
};
|
|
1164
|
-
|
|
1165
|
-
|
|
1084
|
+
|
|
1085
|
+
// src/runtime/client-hydrate.ts
|
|
1086
|
+
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1087
|
+
const endHydrate = createTime("hydrateClient", tagName);
|
|
1088
|
+
const shadowRoot = hostElm.shadowRoot;
|
|
1089
|
+
const childRenderNodes = [];
|
|
1090
|
+
const slotNodes = [];
|
|
1091
|
+
const slottedNodes = [];
|
|
1092
|
+
const shadowRootNodes = BUILD12.shadowDom && shadowRoot ? [] : null;
|
|
1093
|
+
const vnode = newVNode(tagName, null);
|
|
1094
|
+
vnode.$elm$ = hostElm;
|
|
1166
1095
|
let scopeId2;
|
|
1167
|
-
if (
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
while (child) {
|
|
1175
|
-
if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
|
|
1176
|
-
found = true;
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
child = child.nextSibling;
|
|
1180
|
-
}
|
|
1181
|
-
if (!found) oldParent.classList.remove(scopeId2 + "-s");
|
|
1096
|
+
if (BUILD12.scoped) {
|
|
1097
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
1098
|
+
if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
|
|
1099
|
+
scopeId2 = hostElm["s-sc"];
|
|
1100
|
+
hostElm.classList.add(scopeId2 + "-h");
|
|
1101
|
+
} else if (hostElm["s-sc"]) {
|
|
1102
|
+
delete hostElm["s-sc"];
|
|
1182
1103
|
}
|
|
1183
1104
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
var _a, _b, _c, _d, _e;
|
|
1187
|
-
const hostElm = hostRef.$hostElement$;
|
|
1188
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
1189
|
-
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1190
|
-
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1191
|
-
hostTagName = hostElm.tagName;
|
|
1192
|
-
if (BUILD11.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1193
|
-
throw new Error(`The <Host> must be the single root component.
|
|
1194
|
-
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1195
|
-
|
|
1196
|
-
The render() function should look like this instead:
|
|
1197
|
-
|
|
1198
|
-
render() {
|
|
1199
|
-
// Do not return an array
|
|
1200
|
-
return (
|
|
1201
|
-
<Host>{content}</Host>
|
|
1202
|
-
);
|
|
1203
|
-
}
|
|
1204
|
-
`);
|
|
1205
|
-
}
|
|
1206
|
-
if (BUILD11.reflect && cmpMeta.$attrsToReflect$) {
|
|
1207
|
-
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1208
|
-
cmpMeta.$attrsToReflect$.map(
|
|
1209
|
-
([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
|
|
1210
|
-
);
|
|
1105
|
+
if (!plt.$orgLocNodes$) {
|
|
1106
|
+
initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1211
1107
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1108
|
+
hostElm[HYDRATE_ID] = hostId;
|
|
1109
|
+
hostElm.removeAttribute(HYDRATE_ID);
|
|
1110
|
+
hostRef.$vnode$ = clientHydrate(
|
|
1111
|
+
vnode,
|
|
1112
|
+
childRenderNodes,
|
|
1113
|
+
slotNodes,
|
|
1114
|
+
shadowRootNodes,
|
|
1115
|
+
hostElm,
|
|
1116
|
+
hostElm,
|
|
1117
|
+
hostId,
|
|
1118
|
+
slottedNodes
|
|
1119
|
+
);
|
|
1120
|
+
let crIndex = 0;
|
|
1121
|
+
const crLength = childRenderNodes.length;
|
|
1122
|
+
let childRenderNode;
|
|
1123
|
+
for (crIndex; crIndex < crLength; crIndex++) {
|
|
1124
|
+
childRenderNode = childRenderNodes[crIndex];
|
|
1125
|
+
const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
|
|
1126
|
+
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1127
|
+
const node = childRenderNode.$elm$;
|
|
1128
|
+
if (!shadowRoot) {
|
|
1129
|
+
node["s-hn"] = tagName.toUpperCase();
|
|
1130
|
+
if (childRenderNode.$tag$ === "slot") {
|
|
1131
|
+
node["s-cr"] = hostElm["s-cr"];
|
|
1216
1132
|
}
|
|
1217
1133
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1227
|
-
if (BUILD11.slotRelocation) {
|
|
1228
|
-
contentRef = hostElm["s-cr"];
|
|
1229
|
-
checkSlotFallbackVisibility = false;
|
|
1230
|
-
}
|
|
1231
|
-
patch(oldVNode, rootVnode, isInitialLoad);
|
|
1232
|
-
if (BUILD11.slotRelocation) {
|
|
1233
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1234
|
-
if (checkSlotRelocate) {
|
|
1235
|
-
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1236
|
-
for (const relocateData of relocateNodes) {
|
|
1237
|
-
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1238
|
-
if (!nodeToRelocate["s-ol"]) {
|
|
1239
|
-
const orgLocationNode = BUILD11.isDebug || BUILD11.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
|
|
1240
|
-
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
1241
|
-
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
1134
|
+
if (childRenderNode.$tag$ === "slot") {
|
|
1135
|
+
childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
|
|
1136
|
+
if (childRenderNode.$children$) {
|
|
1137
|
+
childRenderNode.$flags$ |= 2 /* isSlotFallback */;
|
|
1138
|
+
if (!childRenderNode.$elm$.childNodes.length) {
|
|
1139
|
+
childRenderNode.$children$.forEach((c) => {
|
|
1140
|
+
childRenderNode.$elm$.appendChild(c.$elm$);
|
|
1141
|
+
});
|
|
1242
1142
|
}
|
|
1143
|
+
} else {
|
|
1144
|
+
childRenderNode.$flags$ |= 1 /* isSlotReference */;
|
|
1243
1145
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1146
|
+
}
|
|
1147
|
+
if (orgLocationNode && orgLocationNode.isConnected) {
|
|
1148
|
+
if (shadowRoot && orgLocationNode["s-en"] === "") {
|
|
1149
|
+
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1150
|
+
}
|
|
1151
|
+
orgLocationNode.parentNode.removeChild(orgLocationNode);
|
|
1152
|
+
if (!shadowRoot) {
|
|
1153
|
+
node["s-oo"] = parseInt(childRenderNode.$nodeId$);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1157
|
+
}
|
|
1158
|
+
const hosts = [];
|
|
1159
|
+
const snLen = slottedNodes.length;
|
|
1160
|
+
let snIndex = 0;
|
|
1161
|
+
let slotGroup;
|
|
1162
|
+
let snGroupIdx;
|
|
1163
|
+
let snGroupLen;
|
|
1164
|
+
let slottedItem;
|
|
1165
|
+
for (snIndex; snIndex < snLen; snIndex++) {
|
|
1166
|
+
slotGroup = slottedNodes[snIndex];
|
|
1167
|
+
if (!slotGroup || !slotGroup.length) continue;
|
|
1168
|
+
snGroupLen = slotGroup.length;
|
|
1169
|
+
snGroupIdx = 0;
|
|
1170
|
+
for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
|
|
1171
|
+
slottedItem = slotGroup[snGroupIdx];
|
|
1172
|
+
if (!hosts[slottedItem.hostId]) {
|
|
1173
|
+
hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
|
|
1174
|
+
}
|
|
1175
|
+
if (!hosts[slottedItem.hostId]) continue;
|
|
1176
|
+
const hostEle = hosts[slottedItem.hostId];
|
|
1177
|
+
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1178
|
+
slottedItem.slot["s-cr"] = hostEle["s-cr"];
|
|
1179
|
+
if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
|
|
1180
|
+
slottedItem.slot["s-cr"] = hostEle;
|
|
1279
1181
|
} else {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
}
|
|
1182
|
+
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
|
|
1183
|
+
}
|
|
1184
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1185
|
+
if (BUILD12.experimentalSlotFixes) {
|
|
1186
|
+
patchSlottedNode(slottedItem.node);
|
|
1286
1187
|
}
|
|
1287
1188
|
}
|
|
1189
|
+
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
|
|
1190
|
+
hostEle.appendChild(slottedItem.node);
|
|
1191
|
+
}
|
|
1288
1192
|
}
|
|
1289
|
-
if (checkSlotFallbackVisibility) {
|
|
1290
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1291
|
-
}
|
|
1292
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1293
|
-
relocateNodes.length = 0;
|
|
1294
1193
|
}
|
|
1295
|
-
if (
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1194
|
+
if (BUILD12.scoped && scopeId2 && slotNodes.length) {
|
|
1195
|
+
slotNodes.forEach((slot) => {
|
|
1196
|
+
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
if (BUILD12.shadowDom && shadowRoot) {
|
|
1200
|
+
let rnIdex = 0;
|
|
1201
|
+
const rnLen = shadowRootNodes.length;
|
|
1202
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
|
1203
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
|
1304
1204
|
}
|
|
1305
1205
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
var slotReferenceDebugNode = (slotVNode) => doc.createComment(
|
|
1309
|
-
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
1310
|
-
);
|
|
1311
|
-
var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
|
|
1312
|
-
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
1313
|
-
);
|
|
1314
|
-
|
|
1315
|
-
// src/runtime/dom-extras.ts
|
|
1316
|
-
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
1317
|
-
patchCloneNode(hostElementPrototype);
|
|
1318
|
-
patchSlotAppendChild(hostElementPrototype);
|
|
1319
|
-
patchSlotAppend(hostElementPrototype);
|
|
1320
|
-
patchSlotPrepend(hostElementPrototype);
|
|
1321
|
-
patchSlotInsertAdjacentElement(hostElementPrototype);
|
|
1322
|
-
patchSlotInsertAdjacentHTML(hostElementPrototype);
|
|
1323
|
-
patchSlotInsertAdjacentText(hostElementPrototype);
|
|
1324
|
-
patchTextContent(hostElementPrototype);
|
|
1325
|
-
patchChildSlotNodes(hostElementPrototype);
|
|
1326
|
-
patchSlotRemoveChild(hostElementPrototype);
|
|
1206
|
+
hostRef.$hostElement$ = hostElm;
|
|
1207
|
+
endHydrate();
|
|
1327
1208
|
};
|
|
1328
|
-
var
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1209
|
+
var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
|
|
1210
|
+
let childNodeType;
|
|
1211
|
+
let childIdSplt;
|
|
1212
|
+
let childVNode;
|
|
1213
|
+
let i2;
|
|
1214
|
+
const scopeId2 = hostElm["s-sc"];
|
|
1215
|
+
if (node.nodeType === 1 /* ElementNode */) {
|
|
1216
|
+
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1217
|
+
if (childNodeType) {
|
|
1218
|
+
childIdSplt = childNodeType.split(".");
|
|
1219
|
+
if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
|
|
1220
|
+
childVNode = createSimpleVNode({
|
|
1221
|
+
$flags$: 0,
|
|
1222
|
+
$hostId$: childIdSplt[0],
|
|
1223
|
+
$nodeId$: childIdSplt[1],
|
|
1224
|
+
$depth$: childIdSplt[2],
|
|
1225
|
+
$index$: childIdSplt[3],
|
|
1226
|
+
$tag$: node.tagName.toLowerCase(),
|
|
1227
|
+
$elm$: node,
|
|
1228
|
+
// If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
|
|
1229
|
+
// won't try to reconcile them. Classes set on the node will be blown away.
|
|
1230
|
+
$attrs$: { class: node.className || "" }
|
|
1231
|
+
});
|
|
1232
|
+
childRenderNodes.push(childVNode);
|
|
1233
|
+
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1234
|
+
if (!parentVNode.$children$) {
|
|
1235
|
+
parentVNode.$children$ = [];
|
|
1236
|
+
}
|
|
1237
|
+
if (BUILD12.scoped && scopeId2) {
|
|
1238
|
+
node["s-si"] = scopeId2;
|
|
1239
|
+
childVNode.$attrs$.class += " " + scopeId2;
|
|
1240
|
+
}
|
|
1241
|
+
const slotName = childVNode.$elm$.getAttribute("s-sn");
|
|
1242
|
+
if (typeof slotName === "string") {
|
|
1243
|
+
if (childVNode.$tag$ === "slot-fb") {
|
|
1244
|
+
addSlot(
|
|
1245
|
+
slotName,
|
|
1246
|
+
childIdSplt[2],
|
|
1247
|
+
childVNode,
|
|
1248
|
+
node,
|
|
1249
|
+
parentVNode,
|
|
1250
|
+
childRenderNodes,
|
|
1251
|
+
slotNodes,
|
|
1252
|
+
shadowRootNodes,
|
|
1253
|
+
slottedNodes
|
|
1254
|
+
);
|
|
1255
|
+
if (BUILD12.scoped && scopeId2) {
|
|
1256
|
+
node.classList.add(scopeId2);
|
|
1257
|
+
}
|
|
1363
1258
|
}
|
|
1259
|
+
childVNode.$elm$["s-sn"] = slotName;
|
|
1260
|
+
childVNode.$elm$.removeAttribute("s-sn");
|
|
1364
1261
|
}
|
|
1365
|
-
if (
|
|
1366
|
-
|
|
1262
|
+
if (childVNode.$index$ !== void 0) {
|
|
1263
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1264
|
+
}
|
|
1265
|
+
parentVNode = childVNode;
|
|
1266
|
+
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1267
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1367
1268
|
}
|
|
1368
1269
|
}
|
|
1369
1270
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
updateFallbackSlotVisibility(this);
|
|
1384
|
-
return insertedNode;
|
|
1271
|
+
if (node.shadowRoot) {
|
|
1272
|
+
for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
|
|
1273
|
+
clientHydrate(
|
|
1274
|
+
parentVNode,
|
|
1275
|
+
childRenderNodes,
|
|
1276
|
+
slotNodes,
|
|
1277
|
+
shadowRootNodes,
|
|
1278
|
+
hostElm,
|
|
1279
|
+
node.shadowRoot.childNodes[i2],
|
|
1280
|
+
hostId,
|
|
1281
|
+
slottedNodes
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1385
1284
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1285
|
+
const nonShadowNodes = node.__childNodes || node.childNodes;
|
|
1286
|
+
for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
|
|
1287
|
+
clientHydrate(
|
|
1288
|
+
parentVNode,
|
|
1289
|
+
childRenderNodes,
|
|
1290
|
+
slotNodes,
|
|
1291
|
+
shadowRootNodes,
|
|
1292
|
+
hostElm,
|
|
1293
|
+
nonShadowNodes[i2],
|
|
1294
|
+
hostId,
|
|
1295
|
+
slottedNodes
|
|
1296
|
+
);
|
|
1297
|
+
}
|
|
1298
|
+
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
1299
|
+
childIdSplt = node.nodeValue.split(".");
|
|
1300
|
+
if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
|
|
1301
|
+
childNodeType = childIdSplt[0];
|
|
1302
|
+
childVNode = createSimpleVNode({
|
|
1303
|
+
$hostId$: childIdSplt[1],
|
|
1304
|
+
$nodeId$: childIdSplt[2],
|
|
1305
|
+
$depth$: childIdSplt[3],
|
|
1306
|
+
$index$: childIdSplt[4] || "0",
|
|
1307
|
+
$elm$: node,
|
|
1308
|
+
$attrs$: null,
|
|
1309
|
+
$children$: null,
|
|
1310
|
+
$key$: null,
|
|
1311
|
+
$name$: null,
|
|
1312
|
+
$tag$: null,
|
|
1313
|
+
$text$: null
|
|
1314
|
+
});
|
|
1315
|
+
if (childNodeType === TEXT_NODE_ID) {
|
|
1316
|
+
childVNode.$elm$ = node.nextSibling;
|
|
1317
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1318
|
+
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1319
|
+
childRenderNodes.push(childVNode);
|
|
1320
|
+
node.remove();
|
|
1321
|
+
if (hostId === childVNode.$hostId$) {
|
|
1322
|
+
if (!parentVNode.$children$) {
|
|
1323
|
+
parentVNode.$children$ = [];
|
|
1324
|
+
}
|
|
1325
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1326
|
+
}
|
|
1327
|
+
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1328
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
} else if (childNodeType === COMMENT_NODE_ID) {
|
|
1332
|
+
childVNode.$elm$ = node.nextSibling;
|
|
1333
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
|
|
1334
|
+
childRenderNodes.push(childVNode);
|
|
1335
|
+
node.remove();
|
|
1336
|
+
}
|
|
1337
|
+
} else if (childVNode.$hostId$ === hostId) {
|
|
1338
|
+
if (childNodeType === SLOT_NODE_ID) {
|
|
1339
|
+
const slotName = node["s-sn"] = childIdSplt[5] || "";
|
|
1340
|
+
addSlot(
|
|
1341
|
+
slotName,
|
|
1342
|
+
childIdSplt[2],
|
|
1343
|
+
childVNode,
|
|
1344
|
+
node,
|
|
1345
|
+
parentVNode,
|
|
1346
|
+
childRenderNodes,
|
|
1347
|
+
slotNodes,
|
|
1348
|
+
shadowRootNodes,
|
|
1349
|
+
slottedNodes
|
|
1350
|
+
);
|
|
1351
|
+
} else if (childNodeType === CONTENT_REF_ID) {
|
|
1352
|
+
if (BUILD12.shadowDom && shadowRootNodes) {
|
|
1353
|
+
node.remove();
|
|
1354
|
+
} else if (BUILD12.slotRelocation) {
|
|
1355
|
+
hostElm["s-cr"] = node;
|
|
1356
|
+
node["s-cn"] = true;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1399
1359
|
}
|
|
1400
1360
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1361
|
+
} else if (parentVNode && parentVNode.$tag$ === "style") {
|
|
1362
|
+
const vnode = newVNode(null, node.textContent);
|
|
1363
|
+
vnode.$elm$ = node;
|
|
1364
|
+
vnode.$index$ = "0";
|
|
1365
|
+
parentVNode.$children$ = [vnode];
|
|
1366
|
+
}
|
|
1367
|
+
return parentVNode;
|
|
1403
1368
|
};
|
|
1404
|
-
var
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
newChild = this.ownerDocument.createTextNode(newChild);
|
|
1410
|
-
}
|
|
1411
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
1412
|
-
const childNodes = this.__childNodes || this.childNodes;
|
|
1413
|
-
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
1414
|
-
if (slotNode) {
|
|
1415
|
-
addSlotRelocateNode(newChild, slotNode, true);
|
|
1416
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
1417
|
-
const appendAfter = slotChildNodes[0];
|
|
1418
|
-
return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
1419
|
-
}
|
|
1420
|
-
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
1421
|
-
newChild.hidden = true;
|
|
1422
|
-
}
|
|
1423
|
-
return HostElementPrototype.__prepend(newChild);
|
|
1424
|
-
});
|
|
1425
|
-
};
|
|
1426
|
-
};
|
|
1427
|
-
var patchSlotAppend = (HostElementPrototype) => {
|
|
1428
|
-
HostElementPrototype.__append = HostElementPrototype.append;
|
|
1429
|
-
HostElementPrototype.append = function(...newChildren) {
|
|
1430
|
-
newChildren.forEach((newChild) => {
|
|
1431
|
-
if (typeof newChild === "string") {
|
|
1432
|
-
newChild = this.ownerDocument.createTextNode(newChild);
|
|
1433
|
-
}
|
|
1434
|
-
this.appendChild(newChild);
|
|
1435
|
-
});
|
|
1436
|
-
};
|
|
1437
|
-
};
|
|
1438
|
-
var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
|
1439
|
-
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
|
|
1440
|
-
HostElementPrototype.insertAdjacentHTML = function(position, text) {
|
|
1441
|
-
if (position !== "afterbegin" && position !== "beforeend") {
|
|
1442
|
-
return originalInsertAdjacentHtml.call(this, position, text);
|
|
1369
|
+
var initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
1370
|
+
if (node.nodeType === 1 /* ElementNode */) {
|
|
1371
|
+
const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
|
|
1372
|
+
if (componentId) {
|
|
1373
|
+
orgLocNodes.set(componentId, node);
|
|
1443
1374
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
while (node = container.firstChild) {
|
|
1449
|
-
this.prepend(node);
|
|
1450
|
-
}
|
|
1451
|
-
} else if (position === "beforeend") {
|
|
1452
|
-
while (node = container.firstChild) {
|
|
1453
|
-
this.append(node);
|
|
1375
|
+
let i2 = 0;
|
|
1376
|
+
if (node.shadowRoot) {
|
|
1377
|
+
for (; i2 < node.shadowRoot.childNodes.length; i2++) {
|
|
1378
|
+
initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
|
|
1454
1379
|
}
|
|
1455
1380
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
HostElementPrototype.insertAdjacentText = function(position, text) {
|
|
1460
|
-
this.insertAdjacentHTML(position, text);
|
|
1461
|
-
};
|
|
1462
|
-
};
|
|
1463
|
-
var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
|
1464
|
-
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
|
1465
|
-
HostElementPrototype.insertAdjacentElement = function(position, element) {
|
|
1466
|
-
if (position !== "afterbegin" && position !== "beforeend") {
|
|
1467
|
-
return originalInsertAdjacentElement.call(this, position, element);
|
|
1381
|
+
const nonShadowNodes = node.__childNodes || node.childNodes;
|
|
1382
|
+
for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
|
|
1383
|
+
initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
|
|
1468
1384
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1385
|
+
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
1386
|
+
const childIdSplt = node.nodeValue.split(".");
|
|
1387
|
+
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
1388
|
+
orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
|
|
1389
|
+
node.nodeValue = "";
|
|
1390
|
+
node["s-en"] = childIdSplt[3];
|
|
1475
1391
|
}
|
|
1476
|
-
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
var createSimpleVNode = (vnode) => {
|
|
1395
|
+
const defaultVNode = {
|
|
1396
|
+
$flags$: 0,
|
|
1397
|
+
$hostId$: null,
|
|
1398
|
+
$nodeId$: null,
|
|
1399
|
+
$depth$: null,
|
|
1400
|
+
$index$: "0",
|
|
1401
|
+
$elm$: null,
|
|
1402
|
+
$attrs$: null,
|
|
1403
|
+
$children$: null,
|
|
1404
|
+
$key$: null,
|
|
1405
|
+
$name$: null,
|
|
1406
|
+
$tag$: null,
|
|
1407
|
+
$text$: null
|
|
1477
1408
|
};
|
|
1409
|
+
return { ...defaultVNode, ...vnode };
|
|
1478
1410
|
};
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
set: function(value) {
|
|
1489
|
-
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
1490
|
-
childNodes.forEach((node) => {
|
|
1491
|
-
if (node["s-ol"]) node["s-ol"].remove();
|
|
1492
|
-
node.remove();
|
|
1493
|
-
});
|
|
1494
|
-
this.insertAdjacentHTML("beforeend", value);
|
|
1411
|
+
function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
|
|
1412
|
+
node["s-sr"] = true;
|
|
1413
|
+
childVNode.$name$ = slotName || null;
|
|
1414
|
+
childVNode.$tag$ = "slot";
|
|
1415
|
+
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1416
|
+
if (BUILD12.shadowDom && shadowRootNodes) {
|
|
1417
|
+
const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1418
|
+
if (childVNode.$name$) {
|
|
1419
|
+
childVNode.$elm$.setAttribute("name", slotName);
|
|
1495
1420
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
item(n) {
|
|
1501
|
-
return this[n];
|
|
1421
|
+
if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
|
|
1422
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1423
|
+
} else {
|
|
1424
|
+
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1502
1425
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
return this.childNodes.filter((n) => n.nodeType === 1);
|
|
1426
|
+
addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
|
|
1427
|
+
node.remove();
|
|
1428
|
+
if (childVNode.$depth$ === "0") {
|
|
1429
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1508
1430
|
}
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1431
|
+
} else {
|
|
1432
|
+
const slot = childVNode.$elm$;
|
|
1433
|
+
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1434
|
+
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1435
|
+
if (shouldMove) {
|
|
1436
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1513
1437
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1438
|
+
childRenderNodes.push(childVNode);
|
|
1439
|
+
}
|
|
1440
|
+
slotNodes.push(childVNode);
|
|
1441
|
+
if (!parentVNode.$children$) {
|
|
1442
|
+
parentVNode.$children$ = [];
|
|
1443
|
+
}
|
|
1444
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1445
|
+
}
|
|
1446
|
+
var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
|
|
1447
|
+
let slottedNode = slotNode.nextSibling;
|
|
1448
|
+
slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
|
|
1449
|
+
while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
|
|
1450
|
+
slottedNode["s-sn"] = slotName;
|
|
1451
|
+
slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
|
|
1452
|
+
slottedNode = slottedNode.nextSibling;
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
// src/runtime/initialize-component.ts
|
|
1457
|
+
import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
|
|
1458
|
+
|
|
1459
|
+
// src/runtime/mode.ts
|
|
1460
|
+
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
1461
|
+
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
1462
|
+
var getMode = (ref) => getHostRef(ref).$modeName$;
|
|
1463
|
+
|
|
1464
|
+
// src/runtime/proxy-component.ts
|
|
1465
|
+
import { BUILD as BUILD22 } from "@rindo/core/internal/app-data";
|
|
1466
|
+
|
|
1467
|
+
// src/runtime/set-value.ts
|
|
1468
|
+
import { BUILD as BUILD21 } from "@rindo/core/internal/app-data";
|
|
1469
|
+
|
|
1470
|
+
// src/runtime/parse-property-value.ts
|
|
1471
|
+
import { BUILD as BUILD13 } from "@rindo/core/internal/app-data";
|
|
1472
|
+
var parsePropertyValue = (propValue, propType) => {
|
|
1473
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
1474
|
+
if (BUILD13.propBoolean && propType & 4 /* Boolean */) {
|
|
1475
|
+
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
1519
1476
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
Object.defineProperty(elm, "lastChild", {
|
|
1523
|
-
get() {
|
|
1524
|
-
return this.childNodes[this.childNodes.length - 1];
|
|
1477
|
+
if (BUILD13.propNumber && propType & 2 /* Number */) {
|
|
1478
|
+
return parseFloat(propValue);
|
|
1525
1479
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
Object.defineProperty(elm, "childNodes", {
|
|
1529
|
-
get() {
|
|
1530
|
-
var _a, _b;
|
|
1531
|
-
if (!plt.$flags$ || !((_a = getHostRef(this)) == null ? void 0 : _a.$flags$) || (plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && ((_b = getHostRef(this)) == null ? void 0 : _b.$flags$) & 2 /* hasRendered */) {
|
|
1532
|
-
const result = new FakeNodeList();
|
|
1533
|
-
const nodes = getSlottedChildNodes(this.__childNodes);
|
|
1534
|
-
result.push(...nodes);
|
|
1535
|
-
return result;
|
|
1536
|
-
}
|
|
1537
|
-
return FakeNodeList.from(this.__childNodes);
|
|
1480
|
+
if (BUILD13.propString && propType & 1 /* String */) {
|
|
1481
|
+
return String(propValue);
|
|
1538
1482
|
}
|
|
1539
|
-
|
|
1540
|
-
};
|
|
1541
|
-
var patchNextPrev = (node) => {
|
|
1542
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
1543
|
-
patchNextSibling(node);
|
|
1544
|
-
patchPreviousSibling(node);
|
|
1545
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1546
|
-
patchNextElementSibling(node);
|
|
1547
|
-
patchPreviousElementSibling(node);
|
|
1483
|
+
return propValue;
|
|
1548
1484
|
}
|
|
1485
|
+
return propValue;
|
|
1549
1486
|
};
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1487
|
+
|
|
1488
|
+
// src/runtime/update-component.ts
|
|
1489
|
+
import { BUILD as BUILD20, NAMESPACE } from "@rindo/core/internal/app-data";
|
|
1490
|
+
|
|
1491
|
+
// src/runtime/event-emitter.ts
|
|
1492
|
+
import { BUILD as BUILD15 } from "@rindo/core/internal/app-data";
|
|
1493
|
+
|
|
1494
|
+
// src/runtime/element.ts
|
|
1495
|
+
import { BUILD as BUILD14 } from "@rindo/core/internal/app-data";
|
|
1496
|
+
var getElement = (ref) => BUILD14.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
|
|
1497
|
+
|
|
1498
|
+
// src/runtime/event-emitter.ts
|
|
1499
|
+
var createEvent = (ref, name, flags) => {
|
|
1500
|
+
const elm = getElement(ref);
|
|
1501
|
+
return {
|
|
1502
|
+
emit: (detail) => {
|
|
1503
|
+
if (BUILD15.isDev && !elm.isConnected) {
|
|
1504
|
+
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
1560
1505
|
}
|
|
1561
|
-
return
|
|
1506
|
+
return emitEvent(elm, name, {
|
|
1507
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1508
|
+
composed: !!(flags & 2 /* Composed */),
|
|
1509
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1510
|
+
detail
|
|
1511
|
+
});
|
|
1562
1512
|
}
|
|
1563
|
-
}
|
|
1513
|
+
};
|
|
1564
1514
|
};
|
|
1565
|
-
var
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
get: function() {
|
|
1570
|
-
var _a;
|
|
1571
|
-
const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
|
|
1572
|
-
const index = parentEles == null ? void 0 : parentEles.indexOf(this);
|
|
1573
|
-
if (parentEles && index > -1) {
|
|
1574
|
-
return parentEles[index + 1];
|
|
1575
|
-
}
|
|
1576
|
-
return this.__nextElementSibling;
|
|
1577
|
-
}
|
|
1578
|
-
});
|
|
1515
|
+
var emitEvent = (elm, name, opts) => {
|
|
1516
|
+
const ev = plt.ce(name, opts);
|
|
1517
|
+
elm.dispatchEvent(ev);
|
|
1518
|
+
return ev;
|
|
1579
1519
|
};
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1520
|
+
|
|
1521
|
+
// src/runtime/styles.ts
|
|
1522
|
+
import { BUILD as BUILD16 } from "@rindo/core/internal/app-data";
|
|
1523
|
+
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
1524
|
+
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
1525
|
+
let style = styles.get(scopeId2);
|
|
1526
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
1527
|
+
style = style || new CSSStyleSheet();
|
|
1528
|
+
if (typeof style === "string") {
|
|
1529
|
+
style = cssText;
|
|
1530
|
+
} else {
|
|
1531
|
+
style.replaceSync(cssText);
|
|
1592
1532
|
}
|
|
1593
|
-
}
|
|
1533
|
+
} else {
|
|
1534
|
+
style = cssText;
|
|
1535
|
+
}
|
|
1536
|
+
styles.set(scopeId2, style);
|
|
1594
1537
|
};
|
|
1595
|
-
var
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1538
|
+
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
1539
|
+
var _a;
|
|
1540
|
+
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1541
|
+
const style = styles.get(scopeId2);
|
|
1542
|
+
if (!BUILD16.attachStyles) {
|
|
1543
|
+
return scopeId2;
|
|
1544
|
+
}
|
|
1545
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
1546
|
+
if (style) {
|
|
1547
|
+
if (typeof style === "string") {
|
|
1548
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
1549
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
1550
|
+
let styleElm;
|
|
1551
|
+
if (!appliedStyles) {
|
|
1552
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
1605
1553
|
}
|
|
1606
|
-
|
|
1554
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
1555
|
+
if (BUILD16.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
1556
|
+
styleElm.innerHTML = style;
|
|
1557
|
+
} else {
|
|
1558
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
|
1559
|
+
styleElm.innerHTML = style;
|
|
1560
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
1561
|
+
if (nonce != null) {
|
|
1562
|
+
styleElm.setAttribute("nonce", nonce);
|
|
1563
|
+
}
|
|
1564
|
+
if ((BUILD16.hydrateServerSide || BUILD16.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
1565
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1566
|
+
}
|
|
1567
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
1568
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
1569
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
1570
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
1571
|
+
styleContainerNode.insertBefore(
|
|
1572
|
+
styleElm,
|
|
1573
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
1574
|
+
);
|
|
1575
|
+
} else if ("host" in styleContainerNode) {
|
|
1576
|
+
if (supportsConstructableStylesheets) {
|
|
1577
|
+
const stylesheet = new CSSStyleSheet();
|
|
1578
|
+
stylesheet.replaceSync(style);
|
|
1579
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1580
|
+
} else {
|
|
1581
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
1582
|
+
if (existingStyleContainer) {
|
|
1583
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
1584
|
+
} else {
|
|
1585
|
+
styleContainerNode.prepend(styleElm);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
} else {
|
|
1589
|
+
styleContainerNode.append(styleElm);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
|
|
1593
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
1597
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
|
1598
|
+
}
|
|
1599
|
+
if (appliedStyles) {
|
|
1600
|
+
appliedStyles.add(scopeId2);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
} else if (BUILD16.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
1604
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
1607
1605
|
}
|
|
1608
|
-
});
|
|
1609
|
-
};
|
|
1610
|
-
var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
|
|
1611
|
-
var validNodesPatches = [
|
|
1612
|
-
"childNodes",
|
|
1613
|
-
"firstChild",
|
|
1614
|
-
"lastChild",
|
|
1615
|
-
"nextSibling",
|
|
1616
|
-
"previousSibling",
|
|
1617
|
-
"textContent"
|
|
1618
|
-
];
|
|
1619
|
-
function patchHostOriginalAccessor(accessorName, node) {
|
|
1620
|
-
let accessor;
|
|
1621
|
-
if (validElementPatches.includes(accessorName)) {
|
|
1622
|
-
accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
|
|
1623
|
-
} else if (validNodesPatches.includes(accessorName)) {
|
|
1624
|
-
accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
|
|
1625
1606
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
return () => {
|
|
1642
|
-
return;
|
|
1643
|
-
};
|
|
1607
|
+
return scopeId2;
|
|
1608
|
+
};
|
|
1609
|
+
var attachStyles = (hostRef) => {
|
|
1610
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
1611
|
+
const elm = hostRef.$hostElement$;
|
|
1612
|
+
const flags = cmpMeta.$flags$;
|
|
1613
|
+
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1614
|
+
const scopeId2 = addStyle(
|
|
1615
|
+
BUILD16.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
1616
|
+
cmpMeta,
|
|
1617
|
+
hostRef.$modeName$
|
|
1618
|
+
);
|
|
1619
|
+
if ((BUILD16.shadowDom || BUILD16.scoped) && BUILD16.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
1620
|
+
elm["s-sc"] = scopeId2;
|
|
1621
|
+
elm.classList.add(scopeId2 + "-h");
|
|
1644
1622
|
}
|
|
1623
|
+
endAttachStyles();
|
|
1645
1624
|
};
|
|
1646
|
-
var
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1625
|
+
var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
1626
|
+
|
|
1627
|
+
// src/runtime/vdom/vdom-render.ts
|
|
1628
|
+
import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
|
|
1629
|
+
|
|
1630
|
+
// src/runtime/vdom/update-element.ts
|
|
1631
|
+
import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
|
|
1632
|
+
|
|
1633
|
+
// src/runtime/vdom/set-accessor.ts
|
|
1634
|
+
import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
|
|
1635
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
1636
|
+
if (oldValue !== newValue) {
|
|
1637
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
1638
|
+
let ln = memberName.toLowerCase();
|
|
1639
|
+
if (BUILD17.vdomClass && memberName === "class") {
|
|
1640
|
+
const classList = elm.classList;
|
|
1641
|
+
const oldClasses = parseClassList(oldValue);
|
|
1642
|
+
let newClasses = parseClassList(newValue);
|
|
1643
|
+
if (BUILD17.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
1644
|
+
newClasses.push(elm["s-si"]);
|
|
1645
|
+
oldClasses.forEach((c) => {
|
|
1646
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
1647
|
+
});
|
|
1648
|
+
newClasses = [...new Set(newClasses)];
|
|
1649
|
+
classList.add(...newClasses);
|
|
1650
|
+
} else {
|
|
1651
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
1652
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
1653
|
+
}
|
|
1654
|
+
} else if (BUILD17.vdomStyle && memberName === "style") {
|
|
1655
|
+
if (BUILD17.updatable) {
|
|
1656
|
+
for (const prop in oldValue) {
|
|
1657
|
+
if (!newValue || newValue[prop] == null) {
|
|
1658
|
+
if (!BUILD17.hydrateServerSide && prop.includes("-")) {
|
|
1659
|
+
elm.style.removeProperty(prop);
|
|
1660
|
+
} else {
|
|
1661
|
+
elm.style[prop] = "";
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
for (const prop in newValue) {
|
|
1667
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
1668
|
+
if (!BUILD17.hydrateServerSide && prop.includes("-")) {
|
|
1669
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
1670
|
+
} else {
|
|
1671
|
+
elm.style[prop] = newValue[prop];
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
} else if (BUILD17.vdomKey && memberName === "key") {
|
|
1676
|
+
} else if (BUILD17.vdomRef && memberName === "ref") {
|
|
1677
|
+
if (newValue) {
|
|
1678
|
+
newValue(elm);
|
|
1679
|
+
}
|
|
1680
|
+
} else if (BUILD17.vdomListener && (BUILD17.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
1681
|
+
if (memberName[2] === "-") {
|
|
1682
|
+
memberName = memberName.slice(3);
|
|
1683
|
+
} else if (isMemberInElement(win, ln)) {
|
|
1684
|
+
memberName = ln.slice(2);
|
|
1685
|
+
} else {
|
|
1686
|
+
memberName = ln[2] + memberName.slice(3);
|
|
1687
|
+
}
|
|
1688
|
+
if (oldValue || newValue) {
|
|
1689
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
1690
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
1691
|
+
if (oldValue) {
|
|
1692
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
1693
|
+
}
|
|
1694
|
+
if (newValue) {
|
|
1695
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
} else if (BUILD17.vdomPropOrAttr) {
|
|
1699
|
+
const isComplex = isComplexType(newValue);
|
|
1700
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
1701
|
+
try {
|
|
1702
|
+
if (!elm.tagName.includes("-")) {
|
|
1703
|
+
const n = newValue == null ? "" : newValue;
|
|
1704
|
+
if (memberName === "list") {
|
|
1705
|
+
isProp = false;
|
|
1706
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
1707
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1708
|
+
elm[memberName] = n;
|
|
1709
|
+
} else {
|
|
1710
|
+
elm.setAttribute(memberName, n);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
} else if (elm[memberName] !== newValue) {
|
|
1714
|
+
elm[memberName] = newValue;
|
|
1715
|
+
}
|
|
1716
|
+
} catch (e) {
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
let xlink = false;
|
|
1720
|
+
if (BUILD17.vdomXlink) {
|
|
1721
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
1722
|
+
memberName = ln;
|
|
1723
|
+
xlink = true;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (newValue == null || newValue === false) {
|
|
1727
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
1728
|
+
if (BUILD17.vdomXlink && xlink) {
|
|
1729
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1730
|
+
} else {
|
|
1731
|
+
elm.removeAttribute(memberName);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
1735
|
+
newValue = newValue === true ? "" : newValue;
|
|
1736
|
+
if (BUILD17.vdomXlink && xlink) {
|
|
1737
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
1738
|
+
} else {
|
|
1739
|
+
elm.setAttribute(memberName, newValue);
|
|
1740
|
+
}
|
|
1654
1741
|
}
|
|
1655
|
-
}
|
|
1656
|
-
} else {
|
|
1657
|
-
return () => {
|
|
1658
|
-
return;
|
|
1659
|
-
};
|
|
1742
|
+
}
|
|
1660
1743
|
}
|
|
1661
1744
|
};
|
|
1662
|
-
var
|
|
1663
|
-
|
|
1664
|
-
if (
|
|
1665
|
-
|
|
1745
|
+
var parseClassListRegex = /\s/;
|
|
1746
|
+
var parseClassList = (value) => {
|
|
1747
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
|
1748
|
+
value = value.baseVal;
|
|
1666
1749
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
flags: {
|
|
1672
|
-
hasRendered: !!(flags & 2 /* hasRendered */),
|
|
1673
|
-
hasConnected: !!(flags & 1 /* hasConnected */),
|
|
1674
|
-
isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
|
|
1675
|
-
isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
|
|
1676
|
-
isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
|
|
1677
|
-
hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
|
|
1678
|
-
hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
|
|
1679
|
-
isWatchReady: !!(flags & 128 /* isWatchReady */),
|
|
1680
|
-
isListenReady: !!(flags & 256 /* isListenReady */),
|
|
1681
|
-
needsRerender: !!(flags & 512 /* needsRerender */)
|
|
1682
|
-
},
|
|
1683
|
-
instanceValues: hostRef.$instanceValues$,
|
|
1684
|
-
ancestorComponent: hostRef.$ancestorComponent$,
|
|
1685
|
-
hostElement,
|
|
1686
|
-
lazyInstance: hostRef.$lazyInstance$,
|
|
1687
|
-
vnode: hostRef.$vnode$,
|
|
1688
|
-
modeName: hostRef.$modeName$,
|
|
1689
|
-
onReadyPromise: hostRef.$onReadyPromise$,
|
|
1690
|
-
onReadyResolve: hostRef.$onReadyResolve$,
|
|
1691
|
-
onInstancePromise: hostRef.$onInstancePromise$,
|
|
1692
|
-
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
1693
|
-
onRenderResolve: hostRef.$onRenderResolve$,
|
|
1694
|
-
queuedListeners: hostRef.$queuedListeners$,
|
|
1695
|
-
rmListeners: hostRef.$rmListeners$,
|
|
1696
|
-
["s-id"]: hostElement["s-id"],
|
|
1697
|
-
["s-cr"]: hostElement["s-cr"],
|
|
1698
|
-
["s-lr"]: hostElement["s-lr"],
|
|
1699
|
-
["s-p"]: hostElement["s-p"],
|
|
1700
|
-
["s-rc"]: hostElement["s-rc"],
|
|
1701
|
-
["s-sc"]: hostElement["s-sc"]
|
|
1702
|
-
};
|
|
1750
|
+
if (!value || typeof value !== "string") {
|
|
1751
|
+
return [];
|
|
1752
|
+
}
|
|
1753
|
+
return value.split(parseClassListRegex);
|
|
1703
1754
|
};
|
|
1704
|
-
var
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1755
|
+
var CAPTURE_EVENT_SUFFIX = "Capture";
|
|
1756
|
+
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
|
1757
|
+
|
|
1758
|
+
// src/runtime/vdom/update-element.ts
|
|
1759
|
+
var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
1760
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
|
1761
|
+
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
|
1762
|
+
const newVnodeAttrs = newVnode.$attrs$ || {};
|
|
1763
|
+
if (BUILD18.updatable) {
|
|
1764
|
+
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
|
1765
|
+
if (!(memberName in newVnodeAttrs)) {
|
|
1766
|
+
setAccessor(
|
|
1767
|
+
elm,
|
|
1768
|
+
memberName,
|
|
1769
|
+
oldVnodeAttrs[memberName],
|
|
1770
|
+
void 0,
|
|
1771
|
+
isSvgMode2,
|
|
1772
|
+
newVnode.$flags$,
|
|
1773
|
+
isInitialRender
|
|
1774
|
+
);
|
|
1712
1775
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
|
1779
|
+
setAccessor(
|
|
1780
|
+
elm,
|
|
1781
|
+
memberName,
|
|
1782
|
+
oldVnodeAttrs[memberName],
|
|
1783
|
+
newVnodeAttrs[memberName],
|
|
1784
|
+
isSvgMode2,
|
|
1785
|
+
newVnode.$flags$,
|
|
1786
|
+
isInitialRender
|
|
1787
|
+
);
|
|
1715
1788
|
}
|
|
1716
1789
|
};
|
|
1790
|
+
function sortedAttrNames(attrNames) {
|
|
1791
|
+
return attrNames.includes("ref") ? (
|
|
1792
|
+
// we need to sort these to ensure that `'ref'` is the last attr
|
|
1793
|
+
[...attrNames.filter((attr) => attr !== "ref"), "ref"]
|
|
1794
|
+
) : (
|
|
1795
|
+
// no need to sort, return the original array
|
|
1796
|
+
attrNames
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1717
1799
|
|
|
1718
|
-
// src/runtime/
|
|
1719
|
-
var
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1800
|
+
// src/runtime/vdom/vdom-render.ts
|
|
1801
|
+
var scopeId;
|
|
1802
|
+
var contentRef;
|
|
1803
|
+
var hostTagName;
|
|
1804
|
+
var useNativeShadowDom = false;
|
|
1805
|
+
var checkSlotFallbackVisibility = false;
|
|
1806
|
+
var checkSlotRelocate = false;
|
|
1807
|
+
var isSvgMode = false;
|
|
1808
|
+
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
1809
|
+
var _a;
|
|
1810
|
+
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
1811
|
+
let i2 = 0;
|
|
1812
|
+
let elm;
|
|
1813
|
+
let childNode;
|
|
1814
|
+
let oldVNode;
|
|
1815
|
+
if (BUILD19.slotRelocation && !useNativeShadowDom) {
|
|
1816
|
+
checkSlotRelocate = true;
|
|
1817
|
+
if (newVNode2.$tag$ === "slot") {
|
|
1818
|
+
newVNode2.$flags$ |= newVNode2.$children$ ? (
|
|
1819
|
+
// slot element has fallback content
|
|
1820
|
+
// still create an element that "mocks" the slot element
|
|
1821
|
+
2 /* isSlotFallback */
|
|
1822
|
+
) : (
|
|
1823
|
+
// slot element does not have fallback content
|
|
1824
|
+
// create an html comment we'll use to always reference
|
|
1825
|
+
// where actual slot content should sit next to
|
|
1826
|
+
1 /* isSlotReference */
|
|
1827
|
+
);
|
|
1736
1828
|
}
|
|
1737
1829
|
}
|
|
1738
|
-
if (
|
|
1739
|
-
|
|
1830
|
+
if (BUILD19.isDev && newVNode2.$elm$) {
|
|
1831
|
+
consoleDevError(
|
|
1832
|
+
`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`
|
|
1833
|
+
);
|
|
1740
1834
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
hostElm,
|
|
1749
|
-
hostElm,
|
|
1750
|
-
hostId,
|
|
1751
|
-
slottedNodes
|
|
1752
|
-
);
|
|
1753
|
-
let crIndex = 0;
|
|
1754
|
-
const crLength = childRenderNodes.length;
|
|
1755
|
-
let childRenderNode;
|
|
1756
|
-
for (crIndex; crIndex < crLength; crIndex++) {
|
|
1757
|
-
childRenderNode = childRenderNodes[crIndex];
|
|
1758
|
-
const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
|
|
1759
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1760
|
-
const node = childRenderNode.$elm$;
|
|
1761
|
-
if (!shadowRoot) {
|
|
1762
|
-
node["s-hn"] = tagName.toUpperCase();
|
|
1763
|
-
if (childRenderNode.$tag$ === "slot") {
|
|
1764
|
-
node["s-cr"] = hostElm["s-cr"];
|
|
1765
|
-
}
|
|
1835
|
+
if (BUILD19.vdomText && newVNode2.$text$ !== null) {
|
|
1836
|
+
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
|
1837
|
+
} else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
1838
|
+
elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
|
|
1839
|
+
} else {
|
|
1840
|
+
if (BUILD19.svg && !isSvgMode) {
|
|
1841
|
+
isSvgMode = newVNode2.$tag$ === "svg";
|
|
1766
1842
|
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1843
|
+
elm = newVNode2.$elm$ = BUILD19.svg ? doc.createElementNS(
|
|
1844
|
+
isSvgMode ? SVG_NS : HTML_NS,
|
|
1845
|
+
!useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
1846
|
+
) : doc.createElement(
|
|
1847
|
+
!useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
1848
|
+
);
|
|
1849
|
+
if (BUILD19.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
1850
|
+
isSvgMode = false;
|
|
1851
|
+
}
|
|
1852
|
+
if (BUILD19.vdomAttribute) {
|
|
1853
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
1854
|
+
}
|
|
1855
|
+
if (BUILD19.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
|
1856
|
+
elm.classList.add(elm["s-si"] = scopeId);
|
|
1857
|
+
}
|
|
1858
|
+
if (newVNode2.$children$) {
|
|
1859
|
+
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
1860
|
+
childNode = createElm(oldParentVNode, newVNode2, i2);
|
|
1861
|
+
if (childNode) {
|
|
1862
|
+
elm.appendChild(childNode);
|
|
1774
1863
|
}
|
|
1775
|
-
} else {
|
|
1776
|
-
childRenderNode.$flags$ |= 1 /* isSlotReference */;
|
|
1777
1864
|
}
|
|
1778
1865
|
}
|
|
1779
|
-
if (
|
|
1780
|
-
if (
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
if (!shadowRoot) {
|
|
1785
|
-
node["s-oo"] = parseInt(childRenderNode.$nodeId$);
|
|
1866
|
+
if (BUILD19.svg) {
|
|
1867
|
+
if (newVNode2.$tag$ === "svg") {
|
|
1868
|
+
isSvgMode = false;
|
|
1869
|
+
} else if (elm.tagName === "foreignObject") {
|
|
1870
|
+
isSvgMode = true;
|
|
1786
1871
|
}
|
|
1787
1872
|
}
|
|
1788
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1789
1873
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
snGroupIdx = 0;
|
|
1802
|
-
for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
|
|
1803
|
-
slottedItem = slotGroup[snGroupIdx];
|
|
1804
|
-
if (!hosts[slottedItem.hostId]) {
|
|
1805
|
-
hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
|
|
1806
|
-
}
|
|
1807
|
-
if (!hosts[slottedItem.hostId]) continue;
|
|
1808
|
-
const hostEle = hosts[slottedItem.hostId];
|
|
1809
|
-
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1810
|
-
slottedItem.slot["s-cr"] = hostEle["s-cr"];
|
|
1811
|
-
if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
|
|
1812
|
-
slottedItem.slot["s-cr"] = hostEle;
|
|
1874
|
+
elm["s-hn"] = hostTagName;
|
|
1875
|
+
if (BUILD19.slotRelocation) {
|
|
1876
|
+
if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
1877
|
+
elm["s-sr"] = true;
|
|
1878
|
+
elm["s-cr"] = contentRef;
|
|
1879
|
+
elm["s-sn"] = newVNode2.$name$ || "";
|
|
1880
|
+
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
1881
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
1882
|
+
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
1883
|
+
if (BUILD19.experimentalSlotFixes) {
|
|
1884
|
+
relocateToHostRoot(oldParentVNode.$elm$);
|
|
1813
1885
|
} else {
|
|
1814
|
-
|
|
1815
|
-
}
|
|
1816
|
-
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1817
|
-
if (BUILD14.experimentalSlotFixes) {
|
|
1818
|
-
patchNextPrev(slottedItem.node);
|
|
1886
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
1819
1887
|
}
|
|
1820
1888
|
}
|
|
1821
|
-
if (
|
|
1822
|
-
|
|
1889
|
+
if (BUILD19.scoped) {
|
|
1890
|
+
addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
return elm;
|
|
1895
|
+
};
|
|
1896
|
+
var relocateToHostRoot = (parentElm) => {
|
|
1897
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1898
|
+
const host = parentElm.closest(hostTagName.toLowerCase());
|
|
1899
|
+
if (host != null) {
|
|
1900
|
+
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
|
|
1901
|
+
(ref) => ref["s-cr"]
|
|
1902
|
+
);
|
|
1903
|
+
const childNodeArray = Array.from(
|
|
1904
|
+
parentElm.__childNodes || parentElm.childNodes
|
|
1905
|
+
);
|
|
1906
|
+
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
1907
|
+
if (childNode["s-sh"] != null) {
|
|
1908
|
+
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
1909
|
+
childNode["s-sh"] = void 0;
|
|
1910
|
+
checkSlotRelocate = true;
|
|
1823
1911
|
}
|
|
1824
1912
|
}
|
|
1825
1913
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1914
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1915
|
+
};
|
|
1916
|
+
var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
1917
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1918
|
+
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
|
|
1919
|
+
if (parentElm["s-sr"] && BUILD19.experimentalSlotFixes) {
|
|
1920
|
+
let node = parentElm;
|
|
1921
|
+
while (node = node.nextSibling) {
|
|
1922
|
+
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
|
1923
|
+
oldSlotChildNodes.push(node);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1830
1926
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1927
|
+
for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
|
|
1928
|
+
const childNode = oldSlotChildNodes[i2];
|
|
1929
|
+
if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
|
|
1930
|
+
insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
|
|
1931
|
+
childNode["s-ol"].remove();
|
|
1932
|
+
childNode["s-ol"] = void 0;
|
|
1933
|
+
childNode["s-sh"] = void 0;
|
|
1934
|
+
checkSlotRelocate = true;
|
|
1935
|
+
}
|
|
1936
|
+
if (recursive) {
|
|
1937
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
1836
1938
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1939
|
+
}
|
|
1940
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1941
|
+
};
|
|
1942
|
+
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
1943
|
+
let containerElm = BUILD19.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
1944
|
+
let childNode;
|
|
1945
|
+
if (BUILD19.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
1946
|
+
containerElm = containerElm.shadowRoot;
|
|
1947
|
+
}
|
|
1948
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
1949
|
+
if (vnodes[startIdx]) {
|
|
1950
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
1951
|
+
if (childNode) {
|
|
1952
|
+
vnodes[startIdx].$elm$ = childNode;
|
|
1953
|
+
insertBefore(containerElm, childNode, BUILD19.slotRelocation ? referenceNode(before) : before);
|
|
1840
1954
|
}
|
|
1841
|
-
}
|
|
1955
|
+
}
|
|
1842
1956
|
}
|
|
1843
|
-
hostRef.$hostElement$ = hostElm;
|
|
1844
|
-
endHydrate();
|
|
1845
1957
|
};
|
|
1846
|
-
var
|
|
1847
|
-
let
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
$hostId$: childIdSplt[0],
|
|
1860
|
-
$nodeId$: childIdSplt[1],
|
|
1861
|
-
$depth$: childIdSplt[2],
|
|
1862
|
-
$index$: childIdSplt[3],
|
|
1863
|
-
$tag$: node.tagName.toLowerCase(),
|
|
1864
|
-
$elm$: node,
|
|
1865
|
-
// If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
|
|
1866
|
-
// won't try to reconcile them. Classes set on the node will be blown away.
|
|
1867
|
-
$attrs$: { class: node.className || "" }
|
|
1868
|
-
});
|
|
1869
|
-
childRenderNodes.push(childVNode);
|
|
1870
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1871
|
-
if (!parentVNode.$children$) {
|
|
1872
|
-
parentVNode.$children$ = [];
|
|
1873
|
-
}
|
|
1874
|
-
if (BUILD14.scoped && scopeId2) {
|
|
1875
|
-
node["s-si"] = scopeId2;
|
|
1876
|
-
childVNode.$attrs$.class += " " + scopeId2;
|
|
1877
|
-
}
|
|
1878
|
-
const slotName = childVNode.$elm$.getAttribute("s-sn");
|
|
1879
|
-
if (typeof slotName === "string") {
|
|
1880
|
-
if (childVNode.$tag$ === "slot-fb") {
|
|
1881
|
-
addSlot(
|
|
1882
|
-
slotName,
|
|
1883
|
-
childIdSplt[2],
|
|
1884
|
-
childVNode,
|
|
1885
|
-
node,
|
|
1886
|
-
parentVNode,
|
|
1887
|
-
childRenderNodes,
|
|
1888
|
-
slotNodes,
|
|
1889
|
-
shadowRootNodes,
|
|
1890
|
-
slottedNodes
|
|
1891
|
-
);
|
|
1892
|
-
if (BUILD14.scoped && scopeId2) {
|
|
1893
|
-
node.classList.add(scopeId2);
|
|
1894
|
-
}
|
|
1958
|
+
var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
1959
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
|
1960
|
+
const vnode = vnodes[index];
|
|
1961
|
+
if (vnode) {
|
|
1962
|
+
const elm = vnode.$elm$;
|
|
1963
|
+
nullifyVNodeRefs(vnode);
|
|
1964
|
+
if (elm) {
|
|
1965
|
+
if (BUILD19.slotRelocation) {
|
|
1966
|
+
checkSlotFallbackVisibility = true;
|
|
1967
|
+
if (elm["s-ol"]) {
|
|
1968
|
+
elm["s-ol"].remove();
|
|
1969
|
+
} else {
|
|
1970
|
+
putBackInOriginalLocation(elm, true);
|
|
1895
1971
|
}
|
|
1896
|
-
childVNode.$elm$["s-sn"] = slotName;
|
|
1897
|
-
childVNode.$elm$.removeAttribute("s-sn");
|
|
1898
|
-
}
|
|
1899
|
-
if (childVNode.$index$ !== void 0) {
|
|
1900
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1901
|
-
}
|
|
1902
|
-
parentVNode = childVNode;
|
|
1903
|
-
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1904
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1905
1972
|
}
|
|
1973
|
+
elm.remove();
|
|
1906
1974
|
}
|
|
1907
1975
|
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
|
|
1979
|
+
let oldStartIdx = 0;
|
|
1980
|
+
let newStartIdx = 0;
|
|
1981
|
+
let idxInOld = 0;
|
|
1982
|
+
let i2 = 0;
|
|
1983
|
+
let oldEndIdx = oldCh.length - 1;
|
|
1984
|
+
let oldStartVnode = oldCh[0];
|
|
1985
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
1986
|
+
let newEndIdx = newCh.length - 1;
|
|
1987
|
+
let newStartVnode = newCh[0];
|
|
1988
|
+
let newEndVnode = newCh[newEndIdx];
|
|
1989
|
+
let node;
|
|
1990
|
+
let elmToMove;
|
|
1991
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1992
|
+
if (oldStartVnode == null) {
|
|
1993
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
1994
|
+
} else if (oldEndVnode == null) {
|
|
1995
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1996
|
+
} else if (newStartVnode == null) {
|
|
1997
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1998
|
+
} else if (newEndVnode == null) {
|
|
1999
|
+
newEndVnode = newCh[--newEndIdx];
|
|
2000
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
|
|
2001
|
+
patch(oldStartVnode, newStartVnode, isInitialRender);
|
|
2002
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
2003
|
+
newStartVnode = newCh[++newStartIdx];
|
|
2004
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
|
|
2005
|
+
patch(oldEndVnode, newEndVnode, isInitialRender);
|
|
2006
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
2007
|
+
newEndVnode = newCh[--newEndIdx];
|
|
2008
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
|
2009
|
+
if (BUILD19.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
2010
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1920
2011
|
}
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
$hostId$: childIdSplt[1],
|
|
1941
|
-
$nodeId$: childIdSplt[2],
|
|
1942
|
-
$depth$: childIdSplt[3],
|
|
1943
|
-
$index$: childIdSplt[4] || "0",
|
|
1944
|
-
$elm$: node,
|
|
1945
|
-
$attrs$: null,
|
|
1946
|
-
$children$: null,
|
|
1947
|
-
$key$: null,
|
|
1948
|
-
$name$: null,
|
|
1949
|
-
$tag$: null,
|
|
1950
|
-
$text$: null
|
|
1951
|
-
});
|
|
1952
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
1953
|
-
childVNode.$elm$ = node.nextSibling;
|
|
1954
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1955
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1956
|
-
childRenderNodes.push(childVNode);
|
|
1957
|
-
node.remove();
|
|
1958
|
-
if (hostId === childVNode.$hostId$) {
|
|
1959
|
-
if (!parentVNode.$children$) {
|
|
1960
|
-
parentVNode.$children$ = [];
|
|
1961
|
-
}
|
|
1962
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1963
|
-
}
|
|
1964
|
-
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1965
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
2012
|
+
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
2013
|
+
insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
2014
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
2015
|
+
newEndVnode = newCh[--newEndIdx];
|
|
2016
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
2017
|
+
if (BUILD19.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
2018
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
2019
|
+
}
|
|
2020
|
+
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
2021
|
+
insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
2022
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
2023
|
+
newStartVnode = newCh[++newStartIdx];
|
|
2024
|
+
} else {
|
|
2025
|
+
idxInOld = -1;
|
|
2026
|
+
if (BUILD19.vdomKey) {
|
|
2027
|
+
for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
|
|
2028
|
+
if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
|
|
2029
|
+
idxInOld = i2;
|
|
2030
|
+
break;
|
|
1966
2031
|
}
|
|
1967
2032
|
}
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
node
|
|
2033
|
+
}
|
|
2034
|
+
if (BUILD19.vdomKey && idxInOld >= 0) {
|
|
2035
|
+
elmToMove = oldCh[idxInOld];
|
|
2036
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
2037
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
|
|
2038
|
+
} else {
|
|
2039
|
+
patch(elmToMove, newStartVnode, isInitialRender);
|
|
2040
|
+
oldCh[idxInOld] = void 0;
|
|
2041
|
+
node = elmToMove.$elm$;
|
|
1973
2042
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2043
|
+
newStartVnode = newCh[++newStartIdx];
|
|
2044
|
+
} else {
|
|
2045
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
|
2046
|
+
newStartVnode = newCh[++newStartIdx];
|
|
2047
|
+
}
|
|
2048
|
+
if (node) {
|
|
2049
|
+
if (BUILD19.slotRelocation) {
|
|
2050
|
+
insertBefore(
|
|
2051
|
+
referenceNode(oldStartVnode.$elm$).parentNode,
|
|
1981
2052
|
node,
|
|
1982
|
-
|
|
1983
|
-
childRenderNodes,
|
|
1984
|
-
slotNodes,
|
|
1985
|
-
shadowRootNodes,
|
|
1986
|
-
slottedNodes
|
|
2053
|
+
referenceNode(oldStartVnode.$elm$)
|
|
1987
2054
|
);
|
|
1988
|
-
} else
|
|
1989
|
-
|
|
1990
|
-
node.remove();
|
|
1991
|
-
} else if (BUILD14.slotRelocation) {
|
|
1992
|
-
hostElm["s-cr"] = node;
|
|
1993
|
-
node["s-cn"] = true;
|
|
1994
|
-
}
|
|
2055
|
+
} else {
|
|
2056
|
+
insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
|
|
1995
2057
|
}
|
|
1996
2058
|
}
|
|
1997
2059
|
}
|
|
1998
|
-
} else if (parentVNode && parentVNode.$tag$ === "style") {
|
|
1999
|
-
const vnode = newVNode(null, node.textContent);
|
|
2000
|
-
vnode.$elm$ = node;
|
|
2001
|
-
vnode.$index$ = "0";
|
|
2002
|
-
parentVNode.$children$ = [vnode];
|
|
2003
2060
|
}
|
|
2004
|
-
|
|
2061
|
+
if (oldStartIdx > oldEndIdx) {
|
|
2062
|
+
addVnodes(
|
|
2063
|
+
parentElm,
|
|
2064
|
+
newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
|
|
2065
|
+
newVNode2,
|
|
2066
|
+
newCh,
|
|
2067
|
+
newStartIdx,
|
|
2068
|
+
newEndIdx
|
|
2069
|
+
);
|
|
2070
|
+
} else if (BUILD19.updatable && newStartIdx > newEndIdx) {
|
|
2071
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
2072
|
+
}
|
|
2005
2073
|
};
|
|
2006
|
-
var
|
|
2007
|
-
if (
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
orgLocNodes.set(componentId, node);
|
|
2011
|
-
}
|
|
2012
|
-
let i2 = 0;
|
|
2013
|
-
if (node.shadowRoot) {
|
|
2014
|
-
for (; i2 < node.shadowRoot.childNodes.length; i2++) {
|
|
2015
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
|
|
2016
|
-
}
|
|
2074
|
+
var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
2075
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
2076
|
+
if (BUILD19.slotRelocation && leftVNode.$tag$ === "slot") {
|
|
2077
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
2017
2078
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
|
|
2079
|
+
if (BUILD19.vdomKey && !isInitialRender) {
|
|
2080
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
2021
2081
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
2025
|
-
orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
|
|
2026
|
-
node.nodeValue = "";
|
|
2027
|
-
node["s-en"] = childIdSplt[3];
|
|
2082
|
+
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
|
2083
|
+
leftVNode.$key$ = rightVNode.$key$;
|
|
2028
2084
|
}
|
|
2085
|
+
return true;
|
|
2029
2086
|
}
|
|
2087
|
+
return false;
|
|
2030
2088
|
};
|
|
2031
|
-
var
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
$name$: null,
|
|
2043
|
-
$tag$: null,
|
|
2044
|
-
$text$: null
|
|
2045
|
-
};
|
|
2046
|
-
return { ...defaultVNode, ...vnode };
|
|
2047
|
-
};
|
|
2048
|
-
function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
|
|
2049
|
-
node["s-sr"] = true;
|
|
2050
|
-
childVNode.$name$ = slotName || null;
|
|
2051
|
-
childVNode.$tag$ = "slot";
|
|
2052
|
-
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
2053
|
-
if (BUILD14.shadowDom && shadowRootNodes) {
|
|
2054
|
-
const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
2055
|
-
if (childVNode.$name$) {
|
|
2056
|
-
childVNode.$elm$.setAttribute("name", slotName);
|
|
2089
|
+
var referenceNode = (node) => node && node["s-ol"] || node;
|
|
2090
|
+
var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
2091
|
+
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
|
2092
|
+
const oldChildren = oldVNode.$children$;
|
|
2093
|
+
const newChildren = newVNode2.$children$;
|
|
2094
|
+
const tag = newVNode2.$tag$;
|
|
2095
|
+
const text = newVNode2.$text$;
|
|
2096
|
+
let defaultHolder;
|
|
2097
|
+
if (!BUILD19.vdomText || text === null) {
|
|
2098
|
+
if (BUILD19.svg) {
|
|
2099
|
+
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
2057
2100
|
}
|
|
2058
|
-
if (
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2101
|
+
if (BUILD19.vdomAttribute || BUILD19.reflect) {
|
|
2102
|
+
if (BUILD19.slot && tag === "slot" && !useNativeShadowDom) {
|
|
2103
|
+
if (BUILD19.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
|
|
2104
|
+
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2105
|
+
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2106
|
+
}
|
|
2107
|
+
} else {
|
|
2108
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2109
|
+
}
|
|
2062
2110
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
if (
|
|
2066
|
-
|
|
2111
|
+
if (BUILD19.updatable && oldChildren !== null && newChildren !== null) {
|
|
2112
|
+
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
2113
|
+
} else if (newChildren !== null) {
|
|
2114
|
+
if (BUILD19.updatable && BUILD19.vdomText && oldVNode.$text$ !== null) {
|
|
2115
|
+
elm.textContent = "";
|
|
2116
|
+
}
|
|
2117
|
+
addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
|
|
2118
|
+
} else if (
|
|
2119
|
+
// don't do this on initial render as it can cause non-hydrated content to be removed
|
|
2120
|
+
!isInitialRender && BUILD19.updatable && oldChildren !== null
|
|
2121
|
+
) {
|
|
2122
|
+
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
2067
2123
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
2071
|
-
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
2072
|
-
if (shouldMove) {
|
|
2073
|
-
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
2124
|
+
if (BUILD19.svg && isSvgMode && tag === "svg") {
|
|
2125
|
+
isSvgMode = false;
|
|
2074
2126
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
parentVNode.$children$ = [];
|
|
2080
|
-
}
|
|
2081
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
2082
|
-
}
|
|
2083
|
-
var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
|
|
2084
|
-
let slottedNode = slotNode.nextSibling;
|
|
2085
|
-
slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
|
|
2086
|
-
while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
|
|
2087
|
-
slottedNode["s-sn"] = slotName;
|
|
2088
|
-
slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
|
|
2089
|
-
slottedNode = slottedNode.nextSibling;
|
|
2127
|
+
} else if (BUILD19.vdomText && BUILD19.slotRelocation && (defaultHolder = elm["s-cr"])) {
|
|
2128
|
+
defaultHolder.parentNode.textContent = text;
|
|
2129
|
+
} else if (BUILD19.vdomText && oldVNode.$text$ !== text) {
|
|
2130
|
+
elm.data = text;
|
|
2090
2131
|
}
|
|
2091
2132
|
};
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2133
|
+
var relocateNodes = [];
|
|
2134
|
+
var markSlotContentForRelocation = (elm) => {
|
|
2135
|
+
let node;
|
|
2136
|
+
let hostContentNodes;
|
|
2137
|
+
let j;
|
|
2138
|
+
const children = elm.__childNodes || elm.childNodes;
|
|
2139
|
+
for (const childNode of children) {
|
|
2140
|
+
if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
|
|
2141
|
+
hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
|
|
2142
|
+
const slotName = childNode["s-sn"];
|
|
2143
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
2144
|
+
node = hostContentNodes[j];
|
|
2145
|
+
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD19.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
|
|
2146
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
|
2147
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
2148
|
+
checkSlotFallbackVisibility = true;
|
|
2149
|
+
node["s-sn"] = node["s-sn"] || slotName;
|
|
2150
|
+
if (relocateNodeData) {
|
|
2151
|
+
relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
|
|
2152
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
2153
|
+
} else {
|
|
2154
|
+
node["s-sh"] = childNode["s-hn"];
|
|
2155
|
+
relocateNodes.push({
|
|
2156
|
+
$slotRefNode$: childNode,
|
|
2157
|
+
$nodeToRelocate$: node
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
if (node["s-sr"]) {
|
|
2161
|
+
relocateNodes.map((relocateNode) => {
|
|
2162
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
|
|
2163
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
2164
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
2165
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
} else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
2171
|
+
relocateNodes.push({
|
|
2172
|
+
$nodeToRelocate$: node
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2113
2177
|
}
|
|
2114
|
-
if (
|
|
2115
|
-
|
|
2178
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
2179
|
+
markSlotContentForRelocation(childNode);
|
|
2116
2180
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
var nullifyVNodeRefs = (vNode) => {
|
|
2184
|
+
if (BUILD19.vdomRef) {
|
|
2185
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
2186
|
+
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
2187
|
+
}
|
|
2188
|
+
};
|
|
2189
|
+
var insertBefore = (parent, newNode, reference) => {
|
|
2190
|
+
if (BUILD19.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
|
|
2191
|
+
addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2192
|
+
} else if (BUILD19.experimentalSlotFixes && typeof newNode["s-sn"] === "string") {
|
|
2193
|
+
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2194
|
+
patchParentNode(newNode);
|
|
2119
2195
|
}
|
|
2120
|
-
return
|
|
2196
|
+
return parent.insertBefore(newNode, reference);
|
|
2197
|
+
}
|
|
2198
|
+
if (BUILD19.experimentalSlotFixes && parent.__insertBefore) {
|
|
2199
|
+
return parent.__insertBefore(newNode, reference);
|
|
2200
|
+
} else {
|
|
2201
|
+
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
2121
2202
|
}
|
|
2122
|
-
return propValue;
|
|
2123
2203
|
};
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
if (BUILD17.isDev && !elm.isConnected) {
|
|
2141
|
-
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
2204
|
+
function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
|
|
2205
|
+
var _a, _b;
|
|
2206
|
+
let scopeId2;
|
|
2207
|
+
if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
|
|
2208
|
+
const scopeName = slotNode["s-sn"];
|
|
2209
|
+
const hostName = slotNode["s-hn"];
|
|
2210
|
+
(_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
|
|
2211
|
+
if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + "-s"))) {
|
|
2212
|
+
let child = (oldParent.__childNodes || oldParent.childNodes)[0];
|
|
2213
|
+
let found = false;
|
|
2214
|
+
while (child) {
|
|
2215
|
+
if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
|
|
2216
|
+
found = true;
|
|
2217
|
+
break;
|
|
2218
|
+
}
|
|
2219
|
+
child = child.nextSibling;
|
|
2142
2220
|
}
|
|
2143
|
-
|
|
2144
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
2145
|
-
composed: !!(flags & 2 /* Composed */),
|
|
2146
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
2147
|
-
detail
|
|
2148
|
-
});
|
|
2221
|
+
if (!found) oldParent.classList.remove(scopeId2 + "-s");
|
|
2149
2222
|
}
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
var
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
2226
|
+
var _a, _b, _c, _d, _e;
|
|
2227
|
+
const hostElm = hostRef.$hostElement$;
|
|
2228
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
2229
|
+
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
2230
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
2231
|
+
hostTagName = hostElm.tagName;
|
|
2232
|
+
if (BUILD19.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
2233
|
+
throw new Error(`The <Host> must be the single root component.
|
|
2234
|
+
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
2157
2235
|
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2236
|
+
The render() function should look like this instead:
|
|
2237
|
+
|
|
2238
|
+
render() {
|
|
2239
|
+
// Do not return an array
|
|
2240
|
+
return (
|
|
2241
|
+
<Host>{content}</Host>
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
`);
|
|
2245
|
+
}
|
|
2246
|
+
if (BUILD19.reflect && cmpMeta.$attrsToReflect$) {
|
|
2247
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
2248
|
+
cmpMeta.$attrsToReflect$.map(
|
|
2249
|
+
([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
if (isInitialLoad && rootVnode.$attrs$) {
|
|
2253
|
+
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
2254
|
+
if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
|
|
2255
|
+
rootVnode.$attrs$[key] = hostElm[key];
|
|
2256
|
+
}
|
|
2169
2257
|
}
|
|
2170
|
-
} else {
|
|
2171
|
-
style = cssText;
|
|
2172
2258
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
if (!BUILD18.attachStyles) {
|
|
2180
|
-
return scopeId2;
|
|
2259
|
+
rootVnode.$tag$ = null;
|
|
2260
|
+
rootVnode.$flags$ |= 4 /* isHost */;
|
|
2261
|
+
hostRef.$vnode$ = rootVnode;
|
|
2262
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD19.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
|
|
2263
|
+
if (BUILD19.scoped || BUILD19.shadowDom) {
|
|
2264
|
+
scopeId = hostElm["s-sc"];
|
|
2181
2265
|
}
|
|
2182
|
-
|
|
2183
|
-
if (
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2266
|
+
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
2267
|
+
if (BUILD19.slotRelocation) {
|
|
2268
|
+
contentRef = hostElm["s-cr"];
|
|
2269
|
+
checkSlotFallbackVisibility = false;
|
|
2270
|
+
}
|
|
2271
|
+
patch(oldVNode, rootVnode, isInitialLoad);
|
|
2272
|
+
if (BUILD19.slotRelocation) {
|
|
2273
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
2274
|
+
if (checkSlotRelocate) {
|
|
2275
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
|
2276
|
+
for (const relocateData of relocateNodes) {
|
|
2277
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2278
|
+
if (!nodeToRelocate["s-ol"]) {
|
|
2279
|
+
const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
|
|
2280
|
+
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2281
|
+
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
2282
|
+
}
|
|
2190
2283
|
}
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
} else if ("host" in styleContainerNode) {
|
|
2210
|
-
if (supportsConstructableStylesheets) {
|
|
2211
|
-
const stylesheet = new CSSStyleSheet();
|
|
2212
|
-
stylesheet.replaceSync(style);
|
|
2213
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
2214
|
-
} else {
|
|
2215
|
-
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
2216
|
-
if (existingStyleContainer) {
|
|
2217
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
2218
|
-
} else {
|
|
2219
|
-
styleContainerNode.prepend(styleElm);
|
|
2284
|
+
for (const relocateData of relocateNodes) {
|
|
2285
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2286
|
+
const slotRefNode = relocateData.$slotRefNode$;
|
|
2287
|
+
if (slotRefNode) {
|
|
2288
|
+
const parentNodeRef = slotRefNode.parentNode;
|
|
2289
|
+
let insertBeforeNode = slotRefNode.nextSibling;
|
|
2290
|
+
if (!BUILD19.hydrateServerSide && (!BUILD19.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
|
|
2291
|
+
let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
|
|
2292
|
+
while (orgLocationNode) {
|
|
2293
|
+
let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
|
|
2294
|
+
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
|
|
2295
|
+
refNode = refNode.nextSibling;
|
|
2296
|
+
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
|
2297
|
+
refNode = refNode == null ? void 0 : refNode.nextSibling;
|
|
2298
|
+
}
|
|
2299
|
+
if (!refNode || !refNode["s-nr"]) {
|
|
2300
|
+
insertBeforeNode = refNode;
|
|
2301
|
+
break;
|
|
2220
2302
|
}
|
|
2221
2303
|
}
|
|
2222
|
-
|
|
2223
|
-
styleContainerNode.append(styleElm);
|
|
2304
|
+
orgLocationNode = orgLocationNode.previousSibling;
|
|
2224
2305
|
}
|
|
2225
2306
|
}
|
|
2226
|
-
|
|
2227
|
-
|
|
2307
|
+
const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
|
|
2308
|
+
const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
|
|
2309
|
+
if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
|
|
2310
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
2311
|
+
if (!BUILD19.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
|
2312
|
+
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
|
2313
|
+
}
|
|
2314
|
+
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
2315
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
|
|
2316
|
+
nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
|
|
2321
|
+
} else {
|
|
2322
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2323
|
+
if (isInitialLoad) {
|
|
2324
|
+
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
|
2325
|
+
}
|
|
2326
|
+
nodeToRelocate.hidden = true;
|
|
2228
2327
|
}
|
|
2229
|
-
}
|
|
2230
|
-
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
2231
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
|
2232
|
-
}
|
|
2233
|
-
if (appliedStyles) {
|
|
2234
|
-
appliedStyles.add(scopeId2);
|
|
2235
2328
|
}
|
|
2236
2329
|
}
|
|
2237
|
-
} else if (BUILD18.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
2238
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
2239
2330
|
}
|
|
2331
|
+
if (checkSlotFallbackVisibility) {
|
|
2332
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2333
|
+
}
|
|
2334
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
2335
|
+
relocateNodes.length = 0;
|
|
2240
2336
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
hostRef.$modeName$
|
|
2252
|
-
);
|
|
2253
|
-
if ((BUILD18.shadowDom || BUILD18.scoped) && BUILD18.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
2254
|
-
elm["s-sc"] = scopeId2;
|
|
2255
|
-
elm.classList.add(scopeId2 + "-h");
|
|
2337
|
+
if (BUILD19.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2338
|
+
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
2339
|
+
for (const childNode of children) {
|
|
2340
|
+
if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
|
|
2341
|
+
if (isInitialLoad && childNode["s-ih"] == null) {
|
|
2342
|
+
childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
|
|
2343
|
+
}
|
|
2344
|
+
childNode.hidden = true;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2256
2347
|
}
|
|
2257
|
-
|
|
2348
|
+
contentRef = void 0;
|
|
2258
2349
|
};
|
|
2259
|
-
var
|
|
2350
|
+
var slotReferenceDebugNode = (slotVNode) => doc.createComment(
|
|
2351
|
+
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
2352
|
+
);
|
|
2353
|
+
var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
|
|
2354
|
+
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
2355
|
+
);
|
|
2260
2356
|
|
|
2261
2357
|
// src/runtime/update-component.ts
|
|
2262
2358
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
|
2263
|
-
if (
|
|
2264
|
-
ancestorComponent["s-p"].push(
|
|
2359
|
+
if (BUILD20.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
2360
|
+
const index = ancestorComponent["s-p"].push(
|
|
2361
|
+
new Promise(
|
|
2362
|
+
(r) => hostRef.$onRenderResolve$ = () => {
|
|
2363
|
+
ancestorComponent["s-p"].splice(index - 1, 1);
|
|
2364
|
+
r();
|
|
2365
|
+
}
|
|
2366
|
+
)
|
|
2367
|
+
);
|
|
2265
2368
|
}
|
|
2266
2369
|
};
|
|
2267
2370
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
2268
|
-
if (
|
|
2371
|
+
if (BUILD20.taskQueue && BUILD20.updatable) {
|
|
2269
2372
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
2270
2373
|
}
|
|
2271
|
-
if (
|
|
2374
|
+
if (BUILD20.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
2272
2375
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
2273
2376
|
return;
|
|
2274
2377
|
}
|
|
2275
2378
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
2276
2379
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
2277
|
-
return
|
|
2380
|
+
return BUILD20.taskQueue ? writeTask(dispatch) : dispatch();
|
|
2278
2381
|
};
|
|
2279
2382
|
var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
2280
2383
|
const elm = hostRef.$hostElement$;
|
|
2281
2384
|
const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
|
|
2282
|
-
const instance =
|
|
2385
|
+
const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2283
2386
|
if (!instance) {
|
|
2284
2387
|
throw new Error(
|
|
2285
2388
|
`Can't render component <${elm.tagName.toLowerCase()} /> with invalid Rindo runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://rindojs.web.app/docs/custom-elements#externalruntime`
|
|
@@ -2287,26 +2390,26 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2287
2390
|
}
|
|
2288
2391
|
let maybePromise;
|
|
2289
2392
|
if (isInitialLoad) {
|
|
2290
|
-
if (
|
|
2393
|
+
if (BUILD20.lazyLoad && BUILD20.hostListener) {
|
|
2291
2394
|
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
2292
2395
|
if (hostRef.$queuedListeners$) {
|
|
2293
|
-
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
2396
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
|
|
2294
2397
|
hostRef.$queuedListeners$ = void 0;
|
|
2295
2398
|
}
|
|
2296
2399
|
}
|
|
2297
2400
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2298
|
-
if (
|
|
2299
|
-
maybePromise = safeCall(instance, "componentWillLoad");
|
|
2401
|
+
if (BUILD20.cmpWillLoad) {
|
|
2402
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2300
2403
|
}
|
|
2301
2404
|
} else {
|
|
2302
2405
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2303
|
-
if (
|
|
2304
|
-
maybePromise = safeCall(instance, "componentWillUpdate");
|
|
2406
|
+
if (BUILD20.cmpWillUpdate) {
|
|
2407
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2305
2408
|
}
|
|
2306
2409
|
}
|
|
2307
2410
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2308
|
-
if (
|
|
2309
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender"));
|
|
2411
|
+
if (BUILD20.cmpWillRender) {
|
|
2412
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2310
2413
|
}
|
|
2311
2414
|
endSchedule();
|
|
2312
2415
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -2321,23 +2424,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2321
2424
|
const elm = hostRef.$hostElement$;
|
|
2322
2425
|
const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
|
|
2323
2426
|
const rc = elm["s-rc"];
|
|
2324
|
-
if (
|
|
2427
|
+
if (BUILD20.style && isInitialLoad) {
|
|
2325
2428
|
attachStyles(hostRef);
|
|
2326
2429
|
}
|
|
2327
2430
|
const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
|
|
2328
|
-
if (
|
|
2431
|
+
if (BUILD20.isDev) {
|
|
2329
2432
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2330
2433
|
}
|
|
2331
|
-
if (
|
|
2434
|
+
if (BUILD20.hydrateServerSide) {
|
|
2332
2435
|
await callRender(hostRef, instance, elm, isInitialLoad);
|
|
2333
2436
|
} else {
|
|
2334
2437
|
callRender(hostRef, instance, elm, isInitialLoad);
|
|
2335
2438
|
}
|
|
2336
|
-
if (
|
|
2439
|
+
if (BUILD20.isDev) {
|
|
2337
2440
|
hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
|
|
2338
2441
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2339
2442
|
}
|
|
2340
|
-
if (
|
|
2443
|
+
if (BUILD20.hydrateServerSide) {
|
|
2341
2444
|
try {
|
|
2342
2445
|
serverSideConnected(elm);
|
|
2343
2446
|
if (isInitialLoad) {
|
|
@@ -2351,13 +2454,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2351
2454
|
consoleError(e, elm);
|
|
2352
2455
|
}
|
|
2353
2456
|
}
|
|
2354
|
-
if (
|
|
2457
|
+
if (BUILD20.asyncLoading && rc) {
|
|
2355
2458
|
rc.map((cb) => cb());
|
|
2356
2459
|
elm["s-rc"] = void 0;
|
|
2357
2460
|
}
|
|
2358
2461
|
endRender();
|
|
2359
2462
|
endUpdate();
|
|
2360
|
-
if (
|
|
2463
|
+
if (BUILD20.asyncLoading) {
|
|
2361
2464
|
const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
|
|
2362
2465
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
2363
2466
|
if (childrenPromises.length === 0) {
|
|
@@ -2373,10 +2476,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2373
2476
|
};
|
|
2374
2477
|
var renderingRef = null;
|
|
2375
2478
|
var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
2376
|
-
const allRenderFn =
|
|
2377
|
-
const lazyLoad =
|
|
2378
|
-
const taskQueue =
|
|
2379
|
-
const updatable =
|
|
2479
|
+
const allRenderFn = BUILD20.allRenderFn ? true : false;
|
|
2480
|
+
const lazyLoad = BUILD20.lazyLoad ? true : false;
|
|
2481
|
+
const taskQueue = BUILD20.taskQueue ? true : false;
|
|
2482
|
+
const updatable = BUILD20.updatable ? true : false;
|
|
2380
2483
|
try {
|
|
2381
2484
|
renderingRef = instance;
|
|
2382
2485
|
instance = allRenderFn ? instance.render() : instance.render && instance.render();
|
|
@@ -2386,9 +2489,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
2386
2489
|
if (updatable || lazyLoad) {
|
|
2387
2490
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
2388
2491
|
}
|
|
2389
|
-
if (
|
|
2390
|
-
if (
|
|
2391
|
-
if (
|
|
2492
|
+
if (BUILD20.hasRenderFn || BUILD20.reflect) {
|
|
2493
|
+
if (BUILD20.vdomRender || BUILD20.reflect) {
|
|
2494
|
+
if (BUILD20.hydrateServerSide) {
|
|
2392
2495
|
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
|
|
2393
2496
|
} else {
|
|
2394
2497
|
renderVdom(hostRef, instance, isInitialLoad);
|
|
@@ -2413,57 +2516,57 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2413
2516
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
2414
2517
|
const elm = hostRef.$hostElement$;
|
|
2415
2518
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2416
|
-
const instance =
|
|
2519
|
+
const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2417
2520
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2418
|
-
if (
|
|
2419
|
-
if (
|
|
2521
|
+
if (BUILD20.cmpDidRender) {
|
|
2522
|
+
if (BUILD20.isDev) {
|
|
2420
2523
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2421
2524
|
}
|
|
2422
|
-
safeCall(instance, "componentDidRender");
|
|
2423
|
-
if (
|
|
2525
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
2526
|
+
if (BUILD20.isDev) {
|
|
2424
2527
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2425
2528
|
}
|
|
2426
2529
|
}
|
|
2427
2530
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2428
2531
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
2429
2532
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
2430
|
-
if (
|
|
2533
|
+
if (BUILD20.asyncLoading && BUILD20.cssAnnotations) {
|
|
2431
2534
|
addHydratedFlag(elm);
|
|
2432
2535
|
}
|
|
2433
|
-
if (
|
|
2434
|
-
if (
|
|
2536
|
+
if (BUILD20.cmpDidLoad) {
|
|
2537
|
+
if (BUILD20.isDev) {
|
|
2435
2538
|
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
2436
2539
|
}
|
|
2437
|
-
safeCall(instance, "componentDidLoad");
|
|
2438
|
-
if (
|
|
2540
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
2541
|
+
if (BUILD20.isDev) {
|
|
2439
2542
|
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2440
2543
|
}
|
|
2441
2544
|
}
|
|
2442
2545
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2443
2546
|
endPostUpdate();
|
|
2444
|
-
if (
|
|
2547
|
+
if (BUILD20.asyncLoading) {
|
|
2445
2548
|
hostRef.$onReadyResolve$(elm);
|
|
2446
2549
|
if (!ancestorComponent) {
|
|
2447
2550
|
appDidLoad(tagName);
|
|
2448
2551
|
}
|
|
2449
2552
|
}
|
|
2450
2553
|
} else {
|
|
2451
|
-
if (
|
|
2452
|
-
if (
|
|
2554
|
+
if (BUILD20.cmpDidUpdate) {
|
|
2555
|
+
if (BUILD20.isDev) {
|
|
2453
2556
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2454
2557
|
}
|
|
2455
|
-
safeCall(instance, "componentDidUpdate");
|
|
2456
|
-
if (
|
|
2558
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
2559
|
+
if (BUILD20.isDev) {
|
|
2457
2560
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2458
2561
|
}
|
|
2459
2562
|
}
|
|
2460
2563
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2461
2564
|
endPostUpdate();
|
|
2462
2565
|
}
|
|
2463
|
-
if (
|
|
2566
|
+
if (BUILD20.method && BUILD20.lazyLoad) {
|
|
2464
2567
|
hostRef.$onInstanceResolve$(elm);
|
|
2465
2568
|
}
|
|
2466
|
-
if (
|
|
2569
|
+
if (BUILD20.asyncLoading) {
|
|
2467
2570
|
if (hostRef.$onRenderResolve$) {
|
|
2468
2571
|
hostRef.$onRenderResolve$();
|
|
2469
2572
|
hostRef.$onRenderResolve$ = void 0;
|
|
@@ -2475,7 +2578,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2475
2578
|
}
|
|
2476
2579
|
};
|
|
2477
2580
|
var forceUpdate = (ref) => {
|
|
2478
|
-
if (
|
|
2581
|
+
if (BUILD20.updatable && (Build.isBrowser || Build.isTesting)) {
|
|
2479
2582
|
const hostRef = getHostRef(ref);
|
|
2480
2583
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
2481
2584
|
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
@@ -2486,29 +2589,26 @@ var forceUpdate = (ref) => {
|
|
|
2486
2589
|
return false;
|
|
2487
2590
|
};
|
|
2488
2591
|
var appDidLoad = (who) => {
|
|
2489
|
-
if (
|
|
2490
|
-
addHydratedFlag(doc.documentElement);
|
|
2491
|
-
}
|
|
2492
|
-
if (BUILD19.asyncQueue) {
|
|
2592
|
+
if (BUILD20.asyncQueue) {
|
|
2493
2593
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
2494
2594
|
}
|
|
2495
2595
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
2496
|
-
if (
|
|
2596
|
+
if (BUILD20.profile && performance.measure) {
|
|
2497
2597
|
performance.measure(`[Rindo] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
|
|
2498
2598
|
}
|
|
2499
2599
|
};
|
|
2500
|
-
var safeCall = (instance, method, arg) => {
|
|
2600
|
+
var safeCall = (instance, method, arg, elm) => {
|
|
2501
2601
|
if (instance && instance[method]) {
|
|
2502
2602
|
try {
|
|
2503
2603
|
return instance[method](arg);
|
|
2504
2604
|
} catch (e) {
|
|
2505
|
-
consoleError(e);
|
|
2605
|
+
consoleError(e, elm);
|
|
2506
2606
|
}
|
|
2507
2607
|
}
|
|
2508
2608
|
return void 0;
|
|
2509
2609
|
};
|
|
2510
2610
|
var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
2511
|
-
if (
|
|
2611
|
+
if (BUILD20.lifecycleDOMEvents) {
|
|
2512
2612
|
emitEvent(elm, "rindo_" + lifecycleName, {
|
|
2513
2613
|
bubbles: true,
|
|
2514
2614
|
composed: true,
|
|
@@ -2520,7 +2620,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
|
2520
2620
|
};
|
|
2521
2621
|
var addHydratedFlag = (elm) => {
|
|
2522
2622
|
var _a, _b;
|
|
2523
|
-
return
|
|
2623
|
+
return BUILD20.hydratedClass ? elm.classList.add((_a = BUILD20.hydratedSelectorName) != null ? _a : "hydrated") : BUILD20.hydratedAttribute ? elm.setAttribute((_b = BUILD20.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
|
|
2524
2624
|
};
|
|
2525
2625
|
var serverSideConnected = (elm) => {
|
|
2526
2626
|
const children = elm.children;
|
|
@@ -2539,21 +2639,21 @@ var serverSideConnected = (elm) => {
|
|
|
2539
2639
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
2540
2640
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
2541
2641
|
const hostRef = getHostRef(ref);
|
|
2542
|
-
if (
|
|
2642
|
+
if (BUILD21.lazyLoad && !hostRef) {
|
|
2543
2643
|
throw new Error(
|
|
2544
2644
|
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Rindo runtime. This usually happens when integrating a 3rd party Rindo component with another Rindo component or application.`
|
|
2545
2645
|
);
|
|
2546
2646
|
}
|
|
2547
|
-
const elm =
|
|
2647
|
+
const elm = BUILD21.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
2548
2648
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
2549
2649
|
const flags = hostRef.$flags$;
|
|
2550
|
-
const instance =
|
|
2650
|
+
const instance = BUILD21.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2551
2651
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
2552
2652
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
2553
2653
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
2554
|
-
if ((!
|
|
2654
|
+
if ((!BUILD21.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
2555
2655
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
2556
|
-
if (
|
|
2656
|
+
if (BUILD21.isDev) {
|
|
2557
2657
|
if (hostRef.$flags$ & 1024 /* devOnRender */) {
|
|
2558
2658
|
consoleDevWarn(
|
|
2559
2659
|
`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
|
|
@@ -2576,8 +2676,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2576
2676
|
);
|
|
2577
2677
|
}
|
|
2578
2678
|
}
|
|
2579
|
-
if (!
|
|
2580
|
-
if (
|
|
2679
|
+
if (!BUILD21.lazyLoad || instance) {
|
|
2680
|
+
if (BUILD21.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
2581
2681
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
2582
2682
|
if (watchMethods) {
|
|
2583
2683
|
watchMethods.map((watchMethodName) => {
|
|
@@ -2589,8 +2689,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2589
2689
|
});
|
|
2590
2690
|
}
|
|
2591
2691
|
}
|
|
2592
|
-
if (
|
|
2593
|
-
if (
|
|
2692
|
+
if (BUILD21.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
2693
|
+
if (BUILD21.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
2594
2694
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2595
2695
|
return;
|
|
2596
2696
|
}
|
|
@@ -2605,105 +2705,125 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2605
2705
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2606
2706
|
var _a, _b;
|
|
2607
2707
|
const prototype = Cstr.prototype;
|
|
2608
|
-
if (
|
|
2708
|
+
if (BUILD22.isTesting) {
|
|
2709
|
+
if (prototype.__rindoAugmented) {
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
prototype.__rindoAugmented = true;
|
|
2713
|
+
}
|
|
2714
|
+
if (BUILD22.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
|
|
2609
2715
|
FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
|
|
2610
2716
|
const originalFormAssociatedCallback = prototype[cbName];
|
|
2611
2717
|
Object.defineProperty(prototype, cbName, {
|
|
2612
2718
|
value(...args) {
|
|
2613
2719
|
const hostRef = getHostRef(this);
|
|
2614
|
-
const instance =
|
|
2720
|
+
const instance = BUILD22.lazyLoad ? hostRef.$lazyInstance$ : this;
|
|
2615
2721
|
if (!instance) {
|
|
2616
2722
|
hostRef.$onReadyPromise$.then((asyncInstance) => {
|
|
2617
2723
|
const cb = asyncInstance[cbName];
|
|
2618
2724
|
typeof cb === "function" && cb.call(asyncInstance, ...args);
|
|
2619
2725
|
});
|
|
2620
2726
|
} else {
|
|
2621
|
-
const cb =
|
|
2727
|
+
const cb = BUILD22.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
|
|
2622
2728
|
typeof cb === "function" && cb.call(instance, ...args);
|
|
2623
2729
|
}
|
|
2624
2730
|
}
|
|
2625
2731
|
});
|
|
2626
2732
|
});
|
|
2627
2733
|
}
|
|
2628
|
-
if (
|
|
2629
|
-
if (
|
|
2734
|
+
if (BUILD22.member && cmpMeta.$members$ || BUILD22.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
|
|
2735
|
+
if (BUILD22.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
|
|
2630
2736
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2631
2737
|
}
|
|
2632
2738
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
2633
2739
|
members.map(([memberName, [memberFlags]]) => {
|
|
2634
|
-
if ((
|
|
2635
|
-
|
|
2740
|
+
if ((BUILD22.prop || BUILD22.state) && (memberFlags & 31 /* Prop */ || (!BUILD22.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
2741
|
+
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
|
2742
|
+
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
2743
|
+
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
2744
|
+
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
2636
2745
|
Object.defineProperty(prototype, memberName, {
|
|
2637
2746
|
get() {
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
if (BUILD21.isDev) {
|
|
2642
|
-
const ref = getHostRef(this);
|
|
2643
|
-
if (
|
|
2644
|
-
// we are proxying the instance (not element)
|
|
2645
|
-
(flags & 1 /* isElementConstructor */) === 0 && // the element is not constructing
|
|
2646
|
-
(ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
|
|
2647
|
-
(memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
|
|
2648
|
-
(memberFlags & 1024 /* Mutable */) === 0
|
|
2649
|
-
) {
|
|
2650
|
-
consoleDevWarn(
|
|
2651
|
-
`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
|
|
2652
|
-
More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
2653
|
-
);
|
|
2747
|
+
if (BUILD22.lazyLoad) {
|
|
2748
|
+
if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
|
|
2749
|
+
return getValue(this, memberName);
|
|
2654
2750
|
}
|
|
2751
|
+
const ref = getHostRef(this);
|
|
2752
|
+
const instance = ref ? ref.$lazyInstance$ : prototype;
|
|
2753
|
+
if (!instance) return;
|
|
2754
|
+
return instance[memberName];
|
|
2755
|
+
}
|
|
2756
|
+
if (!BUILD22.lazyLoad) {
|
|
2757
|
+
return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
2655
2758
|
}
|
|
2656
|
-
setValue(this, memberName, newValue, cmpMeta);
|
|
2657
2759
|
},
|
|
2658
2760
|
configurable: true,
|
|
2659
2761
|
enumerable: true
|
|
2660
2762
|
});
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2763
|
+
}
|
|
2764
|
+
Object.defineProperty(prototype, memberName, {
|
|
2765
|
+
set(newValue) {
|
|
2766
|
+
const ref = getHostRef(this);
|
|
2767
|
+
if (BUILD22.isDev) {
|
|
2768
|
+
if (
|
|
2769
|
+
// we are proxying the instance (not element)
|
|
2770
|
+
(flags & 1 /* isElementConstructor */) === 0 && // if the class has a setter, then the Element can update instance values, so ignore
|
|
2771
|
+
(cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0 && // the element is not constructing
|
|
2772
|
+
(ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
|
|
2773
|
+
(memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
|
|
2774
|
+
(memberFlags & 1024 /* Mutable */) === 0
|
|
2775
|
+
) {
|
|
2776
|
+
consoleDevWarn(
|
|
2777
|
+
`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
|
|
2778
|
+
More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
if (origSetter) {
|
|
2783
|
+
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
2784
|
+
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
|
2785
|
+
newValue = ref.$instanceValues$.get(memberName);
|
|
2786
|
+
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
2787
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
2788
|
+
}
|
|
2789
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
2790
|
+
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
2791
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
2792
|
+
return;
|
|
2793
|
+
}
|
|
2794
|
+
if (!BUILD22.lazyLoad) {
|
|
2795
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
2796
|
+
return;
|
|
2797
|
+
}
|
|
2798
|
+
if (BUILD22.lazyLoad) {
|
|
2799
|
+
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
|
2800
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
2801
|
+
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
|
2802
|
+
ref.$onReadyPromise$.then(() => {
|
|
2803
|
+
if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
|
|
2804
|
+
ref.$lazyInstance$[memberName] = newValue;
|
|
2805
|
+
}
|
|
2806
|
+
});
|
|
2687
2807
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
|
|
2695
|
-
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
2696
|
-
};
|
|
2697
|
-
if (ref.$lazyInstance$) {
|
|
2698
|
-
setterSetVal();
|
|
2699
|
-
} else {
|
|
2700
|
-
ref.$onReadyPromise$.then(() => setterSetVal());
|
|
2808
|
+
return;
|
|
2809
|
+
}
|
|
2810
|
+
const setterSetVal = () => {
|
|
2811
|
+
const currentValue = ref.$lazyInstance$[memberName];
|
|
2812
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
2813
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
2701
2814
|
}
|
|
2815
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
|
|
2816
|
+
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
2817
|
+
};
|
|
2818
|
+
if (ref.$lazyInstance$) {
|
|
2819
|
+
setterSetVal();
|
|
2820
|
+
} else {
|
|
2821
|
+
ref.$onReadyPromise$.then(() => setterSetVal());
|
|
2702
2822
|
}
|
|
2703
|
-
}
|
|
2823
|
+
}
|
|
2704
2824
|
}
|
|
2705
|
-
}
|
|
2706
|
-
} else if (
|
|
2825
|
+
});
|
|
2826
|
+
} else if (BUILD22.lazyLoad && BUILD22.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
2707
2827
|
Object.defineProperty(prototype, memberName, {
|
|
2708
2828
|
value(...args) {
|
|
2709
2829
|
var _a2;
|
|
@@ -2716,13 +2836,13 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
|
2716
2836
|
});
|
|
2717
2837
|
}
|
|
2718
2838
|
});
|
|
2719
|
-
if (
|
|
2839
|
+
if (BUILD22.observeAttribute && (!BUILD22.lazyLoad || flags & 1 /* isElementConstructor */)) {
|
|
2720
2840
|
const attrNameToPropName = /* @__PURE__ */ new Map();
|
|
2721
2841
|
prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
|
|
2722
2842
|
plt.jmp(() => {
|
|
2723
2843
|
var _a2;
|
|
2724
2844
|
const propName = attrNameToPropName.get(attrName);
|
|
2725
|
-
if (this.hasOwnProperty(propName) &&
|
|
2845
|
+
if (this.hasOwnProperty(propName) && BUILD22.lazyLoad) {
|
|
2726
2846
|
newValue = this[propName];
|
|
2727
2847
|
delete this[propName];
|
|
2728
2848
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
@@ -2732,8 +2852,8 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
|
2732
2852
|
const hostRef = getHostRef(this);
|
|
2733
2853
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
2734
2854
|
if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
2735
|
-
const elm =
|
|
2736
|
-
const instance =
|
|
2855
|
+
const elm = BUILD22.lazyLoad ? hostRef.$hostElement$ : this;
|
|
2856
|
+
const instance = BUILD22.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2737
2857
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
2738
2858
|
entry == null ? void 0 : entry.forEach((callbackName) => {
|
|
2739
2859
|
if (instance[callbackName] != null) {
|
|
@@ -2744,8 +2864,9 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
|
2744
2864
|
return;
|
|
2745
2865
|
}
|
|
2746
2866
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
2747
|
-
|
|
2748
|
-
|
|
2867
|
+
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
|
2868
|
+
if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
2869
|
+
this[propName] = newValue;
|
|
2749
2870
|
}
|
|
2750
2871
|
});
|
|
2751
2872
|
};
|
|
@@ -2756,7 +2877,7 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
|
|
|
2756
2877
|
var _a2;
|
|
2757
2878
|
const attrName = m[1] || propName;
|
|
2758
2879
|
attrNameToPropName.set(attrName, propName);
|
|
2759
|
-
if (
|
|
2880
|
+
if (BUILD22.reflect && m[0] & 512 /* ReflectAttr */) {
|
|
2760
2881
|
(_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
|
|
2761
2882
|
}
|
|
2762
2883
|
return attrName;
|
|
@@ -2774,7 +2895,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2774
2895
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
2775
2896
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
2776
2897
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
2777
|
-
if (
|
|
2898
|
+
if (BUILD23.lazyLoad && bundleId) {
|
|
2778
2899
|
const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
|
|
2779
2900
|
if (CstrImport && "then" in CstrImport) {
|
|
2780
2901
|
const endLoad = uniqueTime(
|
|
@@ -2789,53 +2910,53 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2789
2910
|
if (!Cstr) {
|
|
2790
2911
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2791
2912
|
}
|
|
2792
|
-
if (
|
|
2793
|
-
if (
|
|
2913
|
+
if (BUILD23.member && !Cstr.isProxied) {
|
|
2914
|
+
if (BUILD23.watchCallback) {
|
|
2794
2915
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2795
2916
|
}
|
|
2796
2917
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
2797
2918
|
Cstr.isProxied = true;
|
|
2798
2919
|
}
|
|
2799
2920
|
const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
|
|
2800
|
-
if (
|
|
2921
|
+
if (BUILD23.member) {
|
|
2801
2922
|
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
2802
2923
|
}
|
|
2803
2924
|
try {
|
|
2804
2925
|
new Cstr(hostRef);
|
|
2805
2926
|
} catch (e) {
|
|
2806
|
-
consoleError(e);
|
|
2927
|
+
consoleError(e, elm);
|
|
2807
2928
|
}
|
|
2808
|
-
if (
|
|
2929
|
+
if (BUILD23.member) {
|
|
2809
2930
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
2810
2931
|
}
|
|
2811
|
-
if (
|
|
2932
|
+
if (BUILD23.watchCallback) {
|
|
2812
2933
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
2813
2934
|
}
|
|
2814
2935
|
endNewInstance();
|
|
2815
|
-
fireConnectedCallback(hostRef.$lazyInstance
|
|
2936
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
2816
2937
|
} else {
|
|
2817
2938
|
Cstr = elm.constructor;
|
|
2818
2939
|
const cmpTag = elm.localName;
|
|
2819
2940
|
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
|
2820
2941
|
}
|
|
2821
|
-
if (
|
|
2942
|
+
if (BUILD23.style && Cstr && Cstr.style) {
|
|
2822
2943
|
let style;
|
|
2823
2944
|
if (typeof Cstr.style === "string") {
|
|
2824
2945
|
style = Cstr.style;
|
|
2825
|
-
} else if (
|
|
2946
|
+
} else if (BUILD23.mode && typeof Cstr.style !== "string") {
|
|
2826
2947
|
hostRef.$modeName$ = computeMode(elm);
|
|
2827
2948
|
if (hostRef.$modeName$) {
|
|
2828
2949
|
style = Cstr.style[hostRef.$modeName$];
|
|
2829
2950
|
}
|
|
2830
|
-
if (
|
|
2951
|
+
if (BUILD23.hydrateServerSide && hostRef.$modeName$) {
|
|
2831
2952
|
elm.setAttribute("s-mode", hostRef.$modeName$);
|
|
2832
2953
|
}
|
|
2833
2954
|
}
|
|
2834
2955
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
2835
2956
|
if (!styles.has(scopeId2)) {
|
|
2836
2957
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
2837
|
-
if (!
|
|
2838
|
-
|
|
2958
|
+
if (!BUILD23.hydrateServerSide && BUILD23.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
|
|
2959
|
+
BUILD23.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
2839
2960
|
style = await import("./shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
|
|
2840
2961
|
}
|
|
2841
2962
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
@@ -2845,15 +2966,15 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2845
2966
|
}
|
|
2846
2967
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2847
2968
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
2848
|
-
if (
|
|
2969
|
+
if (BUILD23.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
|
|
2849
2970
|
ancestorComponent["s-rc"].push(schedule);
|
|
2850
2971
|
} else {
|
|
2851
2972
|
schedule();
|
|
2852
2973
|
}
|
|
2853
2974
|
};
|
|
2854
|
-
var fireConnectedCallback = (instance) => {
|
|
2855
|
-
if (
|
|
2856
|
-
safeCall(instance, "connectedCallback");
|
|
2975
|
+
var fireConnectedCallback = (instance, elm) => {
|
|
2976
|
+
if (BUILD23.lazyLoad && BUILD23.connectedCallback) {
|
|
2977
|
+
safeCall(instance, "connectedCallback", void 0, elm);
|
|
2857
2978
|
}
|
|
2858
2979
|
};
|
|
2859
2980
|
|
|
@@ -2863,41 +2984,41 @@ var connectedCallback = (elm) => {
|
|
|
2863
2984
|
const hostRef = getHostRef(elm);
|
|
2864
2985
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2865
2986
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
2866
|
-
if (
|
|
2987
|
+
if (BUILD24.hostListenerTargetParent) {
|
|
2867
2988
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
2868
2989
|
}
|
|
2869
2990
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
2870
2991
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
2871
2992
|
let hostId;
|
|
2872
|
-
if (
|
|
2993
|
+
if (BUILD24.hydrateClientSide) {
|
|
2873
2994
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2874
2995
|
if (hostId) {
|
|
2875
|
-
if (
|
|
2876
|
-
const scopeId2 =
|
|
2996
|
+
if (BUILD24.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2997
|
+
const scopeId2 = BUILD24.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
|
|
2877
2998
|
elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
|
|
2878
|
-
} else if (
|
|
2879
|
-
const scopeId2 = getScopeId(cmpMeta,
|
|
2999
|
+
} else if (BUILD24.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3000
|
+
const scopeId2 = getScopeId(cmpMeta, BUILD24.mode ? elm.getAttribute("s-mode") : void 0);
|
|
2880
3001
|
elm["s-sc"] = scopeId2;
|
|
2881
3002
|
}
|
|
2882
3003
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2883
3004
|
}
|
|
2884
3005
|
}
|
|
2885
|
-
if (
|
|
2886
|
-
if (
|
|
3006
|
+
if (BUILD24.slotRelocation && !hostId) {
|
|
3007
|
+
if (BUILD24.hydrateServerSide || (BUILD24.slot || BUILD24.shadowDom) && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
|
|
2887
3008
|
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
|
|
2888
3009
|
setContentReference(elm);
|
|
2889
3010
|
}
|
|
2890
3011
|
}
|
|
2891
|
-
if (
|
|
3012
|
+
if (BUILD24.asyncLoading) {
|
|
2892
3013
|
let ancestorComponent = elm;
|
|
2893
3014
|
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
2894
|
-
if (
|
|
3015
|
+
if (BUILD24.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
|
|
2895
3016
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
2896
3017
|
break;
|
|
2897
3018
|
}
|
|
2898
3019
|
}
|
|
2899
3020
|
}
|
|
2900
|
-
if (
|
|
3021
|
+
if (BUILD24.prop && !BUILD24.hydrateServerSide && cmpMeta.$members$) {
|
|
2901
3022
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
2902
3023
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
2903
3024
|
const value = elm[memberName];
|
|
@@ -2906,7 +3027,7 @@ var connectedCallback = (elm) => {
|
|
|
2906
3027
|
}
|
|
2907
3028
|
});
|
|
2908
3029
|
}
|
|
2909
|
-
if (
|
|
3030
|
+
if (BUILD24.initializeNextTick) {
|
|
2910
3031
|
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
2911
3032
|
} else {
|
|
2912
3033
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
@@ -2914,9 +3035,9 @@ var connectedCallback = (elm) => {
|
|
|
2914
3035
|
} else {
|
|
2915
3036
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
|
|
2916
3037
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2917
|
-
fireConnectedCallback(hostRef.$lazyInstance
|
|
3038
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
2918
3039
|
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
2919
|
-
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance
|
|
3040
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
2920
3041
|
}
|
|
2921
3042
|
}
|
|
2922
3043
|
endConnected();
|
|
@@ -2924,39 +3045,45 @@ var connectedCallback = (elm) => {
|
|
|
2924
3045
|
};
|
|
2925
3046
|
var setContentReference = (elm) => {
|
|
2926
3047
|
const contentRefElm = elm["s-cr"] = doc.createComment(
|
|
2927
|
-
|
|
3048
|
+
BUILD24.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
2928
3049
|
);
|
|
2929
3050
|
contentRefElm["s-cn"] = true;
|
|
2930
3051
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2931
3052
|
};
|
|
2932
3053
|
|
|
2933
3054
|
// src/runtime/disconnected-callback.ts
|
|
2934
|
-
import { BUILD as
|
|
2935
|
-
var disconnectInstance = (instance) => {
|
|
2936
|
-
if (
|
|
2937
|
-
safeCall(instance, "disconnectedCallback");
|
|
3055
|
+
import { BUILD as BUILD25 } from "@rindo/core/internal/app-data";
|
|
3056
|
+
var disconnectInstance = (instance, elm) => {
|
|
3057
|
+
if (BUILD25.lazyLoad && BUILD25.disconnectedCallback) {
|
|
3058
|
+
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
2938
3059
|
}
|
|
2939
|
-
if (
|
|
2940
|
-
safeCall(instance, "componentDidUnload");
|
|
3060
|
+
if (BUILD25.cmpDidUnload) {
|
|
3061
|
+
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
2941
3062
|
}
|
|
2942
3063
|
};
|
|
2943
3064
|
var disconnectedCallback = async (elm) => {
|
|
2944
3065
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
2945
3066
|
const hostRef = getHostRef(elm);
|
|
2946
|
-
if (
|
|
3067
|
+
if (BUILD25.hostListener) {
|
|
2947
3068
|
if (hostRef.$rmListeners$) {
|
|
2948
3069
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2949
3070
|
hostRef.$rmListeners$ = void 0;
|
|
2950
3071
|
}
|
|
2951
3072
|
}
|
|
2952
|
-
if (!
|
|
3073
|
+
if (!BUILD25.lazyLoad) {
|
|
2953
3074
|
disconnectInstance(elm);
|
|
2954
3075
|
} else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2955
|
-
disconnectInstance(hostRef.$lazyInstance
|
|
3076
|
+
disconnectInstance(hostRef.$lazyInstance$, elm);
|
|
2956
3077
|
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
2957
|
-
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance
|
|
3078
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
|
|
2958
3079
|
}
|
|
2959
3080
|
}
|
|
3081
|
+
if (rootAppliedStyles.has(elm)) {
|
|
3082
|
+
rootAppliedStyles.delete(elm);
|
|
3083
|
+
}
|
|
3084
|
+
if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
|
|
3085
|
+
rootAppliedStyles.delete(elm.shadowRoot);
|
|
3086
|
+
}
|
|
2960
3087
|
};
|
|
2961
3088
|
|
|
2962
3089
|
// src/runtime/bootstrap-custom-element.ts
|
|
@@ -2968,36 +3095,36 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2968
3095
|
$flags$: compactMeta[0],
|
|
2969
3096
|
$tagName$: compactMeta[1]
|
|
2970
3097
|
};
|
|
2971
|
-
if (
|
|
3098
|
+
if (BUILD26.member) {
|
|
2972
3099
|
cmpMeta.$members$ = compactMeta[2];
|
|
2973
3100
|
}
|
|
2974
|
-
if (
|
|
3101
|
+
if (BUILD26.hostListener) {
|
|
2975
3102
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
2976
3103
|
}
|
|
2977
|
-
if (
|
|
3104
|
+
if (BUILD26.watchCallback) {
|
|
2978
3105
|
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
2979
3106
|
}
|
|
2980
|
-
if (
|
|
3107
|
+
if (BUILD26.reflect) {
|
|
2981
3108
|
cmpMeta.$attrsToReflect$ = [];
|
|
2982
3109
|
}
|
|
2983
|
-
if (
|
|
3110
|
+
if (BUILD26.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2984
3111
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
2985
3112
|
}
|
|
2986
|
-
if (
|
|
2987
|
-
if (
|
|
3113
|
+
if (BUILD26.experimentalSlotFixes) {
|
|
3114
|
+
if (BUILD26.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2988
3115
|
patchPseudoShadowDom(Cstr.prototype);
|
|
2989
3116
|
}
|
|
2990
3117
|
} else {
|
|
2991
|
-
if (
|
|
3118
|
+
if (BUILD26.slotChildNodesFix) {
|
|
2992
3119
|
patchChildSlotNodes(Cstr.prototype);
|
|
2993
3120
|
}
|
|
2994
|
-
if (
|
|
3121
|
+
if (BUILD26.cloneNodeFix) {
|
|
2995
3122
|
patchCloneNode(Cstr.prototype);
|
|
2996
3123
|
}
|
|
2997
|
-
if (
|
|
3124
|
+
if (BUILD26.appendChildSlotFix) {
|
|
2998
3125
|
patchSlotAppendChild(Cstr.prototype);
|
|
2999
3126
|
}
|
|
3000
|
-
if (
|
|
3127
|
+
if (BUILD26.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3001
3128
|
patchTextContent(Cstr.prototype);
|
|
3002
3129
|
}
|
|
3003
3130
|
}
|
|
@@ -3015,20 +3142,30 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3015
3142
|
this.__hasHostListenerAttached = true;
|
|
3016
3143
|
}
|
|
3017
3144
|
connectedCallback(this);
|
|
3018
|
-
if (
|
|
3145
|
+
if (BUILD26.connectedCallback && originalConnectedCallback) {
|
|
3019
3146
|
originalConnectedCallback.call(this);
|
|
3020
3147
|
}
|
|
3021
3148
|
},
|
|
3022
3149
|
disconnectedCallback() {
|
|
3023
3150
|
disconnectedCallback(this);
|
|
3024
|
-
if (
|
|
3151
|
+
if (BUILD26.disconnectedCallback && originalDisconnectedCallback) {
|
|
3025
3152
|
originalDisconnectedCallback.call(this);
|
|
3026
3153
|
}
|
|
3154
|
+
plt.raf(() => {
|
|
3155
|
+
var _a;
|
|
3156
|
+
const hostRef = getHostRef(this);
|
|
3157
|
+
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3158
|
+
delete hostRef.$vnode$;
|
|
3159
|
+
}
|
|
3160
|
+
if (this instanceof Node && !this.isConnected) {
|
|
3161
|
+
deleteHostRef(this);
|
|
3162
|
+
}
|
|
3163
|
+
});
|
|
3027
3164
|
},
|
|
3028
3165
|
__attachShadow() {
|
|
3029
3166
|
if (supportsShadow) {
|
|
3030
3167
|
if (!this.shadowRoot) {
|
|
3031
|
-
if (
|
|
3168
|
+
if (BUILD26.shadowDelegatesFocus) {
|
|
3032
3169
|
this.attachShadow({
|
|
3033
3170
|
mode: "open",
|
|
3034
3171
|
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
@@ -3052,7 +3189,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3052
3189
|
return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
|
|
3053
3190
|
};
|
|
3054
3191
|
var forceModeUpdate = (elm) => {
|
|
3055
|
-
if (
|
|
3192
|
+
if (BUILD26.style && BUILD26.mode && !BUILD26.lazyLoad) {
|
|
3056
3193
|
const mode = computeMode(elm);
|
|
3057
3194
|
const hostRef = getHostRef(elm);
|
|
3058
3195
|
if (hostRef.$modeName$ !== mode) {
|
|
@@ -3075,7 +3212,7 @@ var forceModeUpdate = (elm) => {
|
|
|
3075
3212
|
};
|
|
3076
3213
|
|
|
3077
3214
|
// src/runtime/bootstrap-lazy.ts
|
|
3078
|
-
import { BUILD as
|
|
3215
|
+
import { BUILD as BUILD27 } from "@rindo/core/internal/app-data";
|
|
3079
3216
|
|
|
3080
3217
|
// src/runtime/hmr-component.ts
|
|
3081
3218
|
var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
|
|
@@ -3087,7 +3224,7 @@ var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
3087
3224
|
// src/runtime/bootstrap-lazy.ts
|
|
3088
3225
|
var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
3089
3226
|
var _a;
|
|
3090
|
-
if (
|
|
3227
|
+
if (BUILD27.profile && performance.mark) {
|
|
3091
3228
|
performance.mark("st:app:start");
|
|
3092
3229
|
}
|
|
3093
3230
|
installDevTools();
|
|
@@ -3103,12 +3240,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3103
3240
|
let isBootstrapping = true;
|
|
3104
3241
|
Object.assign(plt, options);
|
|
3105
3242
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
|
|
3106
|
-
if (
|
|
3243
|
+
if (BUILD27.asyncQueue) {
|
|
3107
3244
|
if (options.syncQueue) {
|
|
3108
3245
|
plt.$flags$ |= 4 /* queueSync */;
|
|
3109
3246
|
}
|
|
3110
3247
|
}
|
|
3111
|
-
if (
|
|
3248
|
+
if (BUILD27.hydrateClientSide) {
|
|
3112
3249
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
3113
3250
|
}
|
|
3114
3251
|
let hasSlotRelocation = false;
|
|
@@ -3124,22 +3261,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3124
3261
|
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
3125
3262
|
hasSlotRelocation = true;
|
|
3126
3263
|
}
|
|
3127
|
-
if (
|
|
3264
|
+
if (BUILD27.member) {
|
|
3128
3265
|
cmpMeta.$members$ = compactMeta[2];
|
|
3129
3266
|
}
|
|
3130
|
-
if (
|
|
3267
|
+
if (BUILD27.hostListener) {
|
|
3131
3268
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
3132
3269
|
}
|
|
3133
|
-
if (
|
|
3270
|
+
if (BUILD27.reflect) {
|
|
3134
3271
|
cmpMeta.$attrsToReflect$ = [];
|
|
3135
3272
|
}
|
|
3136
|
-
if (
|
|
3273
|
+
if (BUILD27.watchCallback) {
|
|
3137
3274
|
cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
|
|
3138
3275
|
}
|
|
3139
|
-
if (
|
|
3276
|
+
if (BUILD27.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3140
3277
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
3141
3278
|
}
|
|
3142
|
-
const tagName =
|
|
3279
|
+
const tagName = BUILD27.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
|
|
3143
3280
|
const HostElement = class extends HTMLElement {
|
|
3144
3281
|
// RindoLazyHost
|
|
3145
3282
|
constructor(self) {
|
|
@@ -3147,10 +3284,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3147
3284
|
this.hasRegisteredEventListeners = false;
|
|
3148
3285
|
self = this;
|
|
3149
3286
|
registerHost(self, cmpMeta);
|
|
3150
|
-
if (
|
|
3287
|
+
if (BUILD27.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3151
3288
|
if (supportsShadow) {
|
|
3152
3289
|
if (!self.shadowRoot) {
|
|
3153
|
-
if (
|
|
3290
|
+
if (BUILD27.shadowDelegatesFocus) {
|
|
3154
3291
|
self.attachShadow({
|
|
3155
3292
|
mode: "open",
|
|
3156
3293
|
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
@@ -3165,7 +3302,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3165
3302
|
);
|
|
3166
3303
|
}
|
|
3167
3304
|
}
|
|
3168
|
-
} else if (!
|
|
3305
|
+
} else if (!BUILD27.hydrateServerSide && !("shadowRoot" in self)) {
|
|
3169
3306
|
self.shadowRoot = self;
|
|
3170
3307
|
}
|
|
3171
3308
|
}
|
|
@@ -3188,33 +3325,44 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3188
3325
|
}
|
|
3189
3326
|
disconnectedCallback() {
|
|
3190
3327
|
plt.jmp(() => disconnectedCallback(this));
|
|
3328
|
+
plt.raf(() => {
|
|
3329
|
+
var _a3;
|
|
3330
|
+
const hostRef = getHostRef(this);
|
|
3331
|
+
const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
|
|
3332
|
+
if (i2 > -1) {
|
|
3333
|
+
deferredConnectedCallbacks.splice(i2, 1);
|
|
3334
|
+
}
|
|
3335
|
+
if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3336
|
+
delete hostRef.$vnode$.$elm$;
|
|
3337
|
+
}
|
|
3338
|
+
});
|
|
3191
3339
|
}
|
|
3192
3340
|
componentOnReady() {
|
|
3193
3341
|
return getHostRef(this).$onReadyPromise$;
|
|
3194
3342
|
}
|
|
3195
3343
|
};
|
|
3196
|
-
if (
|
|
3197
|
-
if (
|
|
3344
|
+
if (BUILD27.experimentalSlotFixes) {
|
|
3345
|
+
if (BUILD27.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3198
3346
|
patchPseudoShadowDom(HostElement.prototype);
|
|
3199
3347
|
}
|
|
3200
3348
|
} else {
|
|
3201
|
-
if (
|
|
3349
|
+
if (BUILD27.slotChildNodesFix) {
|
|
3202
3350
|
patchChildSlotNodes(HostElement.prototype);
|
|
3203
3351
|
}
|
|
3204
|
-
if (
|
|
3352
|
+
if (BUILD27.cloneNodeFix) {
|
|
3205
3353
|
patchCloneNode(HostElement.prototype);
|
|
3206
3354
|
}
|
|
3207
|
-
if (
|
|
3355
|
+
if (BUILD27.appendChildSlotFix) {
|
|
3208
3356
|
patchSlotAppendChild(HostElement.prototype);
|
|
3209
3357
|
}
|
|
3210
|
-
if (
|
|
3358
|
+
if (BUILD27.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3211
3359
|
patchTextContent(HostElement.prototype);
|
|
3212
3360
|
}
|
|
3213
3361
|
}
|
|
3214
|
-
if (
|
|
3362
|
+
if (BUILD27.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
|
|
3215
3363
|
HostElement.formAssociated = true;
|
|
3216
3364
|
}
|
|
3217
|
-
if (
|
|
3365
|
+
if (BUILD27.hotModuleReplacement) {
|
|
3218
3366
|
HostElement.prototype["s-hmr"] = function(hmrVersionId) {
|
|
3219
3367
|
hmrStart(this, cmpMeta, hmrVersionId);
|
|
3220
3368
|
};
|
|
@@ -3233,7 +3381,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3233
3381
|
if (hasSlotRelocation) {
|
|
3234
3382
|
dataStyles.textContent += SLOT_FB_CSS;
|
|
3235
3383
|
}
|
|
3236
|
-
if (
|
|
3384
|
+
if (BUILD27.invisiblePrehydration && (BUILD27.hydratedClass || BUILD27.hydratedAttribute)) {
|
|
3237
3385
|
dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
|
|
3238
3386
|
}
|
|
3239
3387
|
if (dataStyles.innerHTML.length) {
|
|
@@ -3249,7 +3397,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3249
3397
|
if (deferredConnectedCallbacks.length) {
|
|
3250
3398
|
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
3251
3399
|
} else {
|
|
3252
|
-
if (
|
|
3400
|
+
if (BUILD27.profile) {
|
|
3253
3401
|
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, "timeout"));
|
|
3254
3402
|
} else {
|
|
3255
3403
|
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
|
|
@@ -3262,10 +3410,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3262
3410
|
var Fragment = (_, children) => children;
|
|
3263
3411
|
|
|
3264
3412
|
// src/runtime/host-listener.ts
|
|
3265
|
-
import { BUILD as
|
|
3413
|
+
import { BUILD as BUILD28 } from "@rindo/core/internal/app-data";
|
|
3266
3414
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3267
|
-
if (
|
|
3268
|
-
if (
|
|
3415
|
+
if (BUILD28.hostListener && listeners) {
|
|
3416
|
+
if (BUILD28.hostListenerTargetParent) {
|
|
3269
3417
|
if (attachParentListeners) {
|
|
3270
3418
|
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
3271
3419
|
} else {
|
|
@@ -3273,7 +3421,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3273
3421
|
}
|
|
3274
3422
|
}
|
|
3275
3423
|
listeners.map(([flags, name, method]) => {
|
|
3276
|
-
const target =
|
|
3424
|
+
const target = BUILD28.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
|
|
3277
3425
|
const handler = hostListenerProxy(hostRef, method);
|
|
3278
3426
|
const opts = hostListenerOpts(flags);
|
|
3279
3427
|
plt.ael(target, name, handler, opts);
|
|
@@ -3284,7 +3432,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3284
3432
|
var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
3285
3433
|
var _a;
|
|
3286
3434
|
try {
|
|
3287
|
-
if (
|
|
3435
|
+
if (BUILD28.lazyLoad) {
|
|
3288
3436
|
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
3289
3437
|
(_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
|
|
3290
3438
|
} else {
|
|
@@ -3294,14 +3442,14 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
3294
3442
|
hostRef.$hostElement$[methodName](ev);
|
|
3295
3443
|
}
|
|
3296
3444
|
} catch (e) {
|
|
3297
|
-
consoleError(e);
|
|
3445
|
+
consoleError(e, hostRef.$hostElement$);
|
|
3298
3446
|
}
|
|
3299
3447
|
};
|
|
3300
3448
|
var getHostListenerTarget = (elm, flags) => {
|
|
3301
|
-
if (
|
|
3302
|
-
if (
|
|
3303
|
-
if (
|
|
3304
|
-
if (
|
|
3449
|
+
if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
|
|
3450
|
+
if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
|
|
3451
|
+
if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
|
|
3452
|
+
if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
|
|
3305
3453
|
return elm.parentElement;
|
|
3306
3454
|
return elm;
|
|
3307
3455
|
};
|
|
@@ -3461,7 +3609,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3461
3609
|
}
|
|
3462
3610
|
};
|
|
3463
3611
|
export {
|
|
3464
|
-
|
|
3612
|
+
BUILD29 as BUILD,
|
|
3465
3613
|
Build,
|
|
3466
3614
|
Env,
|
|
3467
3615
|
Fragment,
|
|
@@ -3480,6 +3628,7 @@ export {
|
|
|
3480
3628
|
consoleError,
|
|
3481
3629
|
createEvent,
|
|
3482
3630
|
defineCustomElement,
|
|
3631
|
+
deleteHostRef,
|
|
3483
3632
|
disconnectedCallback,
|
|
3484
3633
|
doc,
|
|
3485
3634
|
forceModeUpdate,
|