@rindo/core 1.17.4 → 2.5.2
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/LICENSE.md +27 -27
- package/bin/cli.ts +20 -0
- package/bin/rindo +51 -56
- package/cli/index.cjs +1263 -0
- package/cli/index.d.ts +1 -1
- package/cli/index.js +1232 -495
- package/cli/package.json +9 -4
- package/compiler/lib.d.ts +24 -0
- package/compiler/lib.dom.d.ts +20230 -0
- package/compiler/lib.dom.iterable.d.ts +351 -0
- package/compiler/lib.es2015.collection.d.ts +89 -0
- package/compiler/lib.es2015.core.d.ts +517 -0
- package/compiler/lib.es2015.d.ts +30 -0
- package/compiler/lib.es2015.generator.d.ts +79 -0
- package/compiler/lib.es2015.iterable.d.ts +505 -0
- package/compiler/lib.es2015.promise.d.ts +150 -0
- package/compiler/lib.es2015.proxy.d.ts +41 -0
- package/compiler/lib.es2015.reflect.d.ts +123 -0
- package/compiler/lib.es2015.symbol.d.ts +48 -0
- package/compiler/lib.es2015.symbol.wellknown.d.ts +324 -0
- package/compiler/lib.es2016.array.include.d.ts +118 -0
- package/compiler/lib.es2016.d.ts +22 -0
- package/compiler/lib.es2016.full.d.ts +25 -0
- package/compiler/lib.es2017.d.ts +26 -0
- package/compiler/lib.es2017.full.d.ts +25 -0
- package/compiler/lib.es2017.intl.d.ts +32 -0
- package/compiler/lib.es2017.object.d.ts +51 -0
- package/compiler/lib.es2017.sharedmemory.d.ts +137 -0
- package/compiler/lib.es2017.string.d.ts +47 -0
- package/compiler/lib.es2017.typedarrays.d.ts +55 -0
- package/compiler/lib.es2018.asyncgenerator.d.ts +79 -0
- package/compiler/lib.es2018.asynciterable.d.ts +45 -0
- package/compiler/lib.es2018.d.ts +26 -0
- package/compiler/lib.es2018.full.d.ts +25 -0
- package/compiler/lib.es2018.intl.d.ts +61 -0
- package/compiler/lib.es2018.promise.d.ts +32 -0
- package/compiler/lib.es2018.regexp.d.ts +39 -0
- package/compiler/lib.es2019.array.d.ts +85 -0
- package/compiler/lib.es2019.d.ts +25 -0
- package/compiler/lib.es2019.full.d.ts +25 -0
- package/compiler/lib.es2019.object.d.ts +35 -0
- package/compiler/lib.es2019.string.d.ts +33 -0
- package/compiler/lib.es2019.symbol.d.ts +26 -0
- package/compiler/lib.es2020.bigint.d.ts +728 -0
- package/compiler/lib.es2020.d.ts +27 -0
- package/compiler/lib.es2020.full.d.ts +25 -0
- package/compiler/lib.es2020.intl.d.ts +310 -0
- package/compiler/lib.es2020.promise.d.ts +50 -0
- package/compiler/lib.es2020.sharedmemory.d.ts +99 -0
- package/compiler/lib.es2020.string.d.ts +30 -0
- package/compiler/lib.es2020.symbol.wellknown.d.ts +39 -0
- package/compiler/lib.es5.d.ts +4435 -0
- package/compiler/lib.es6.d.ts +25 -0
- package/compiler/lib.esnext.d.ts +25 -0
- package/compiler/lib.esnext.full.d.ts +25 -0
- package/compiler/lib.esnext.intl.d.ts +32 -0
- package/compiler/lib.esnext.promise.d.ts +43 -0
- package/compiler/lib.esnext.string.d.ts +35 -0
- package/compiler/lib.esnext.weakref.d.ts +75 -0
- package/compiler/lib.scripthost.d.ts +327 -0
- package/compiler/lib.webworker.d.ts +6042 -0
- package/compiler/lib.webworker.importscripts.d.ts +26 -0
- package/compiler/lib.webworker.iterable.d.ts +166 -0
- package/compiler/package.json +3 -3
- package/compiler/rindo.d.ts +0 -16
- package/compiler/rindo.js +42738 -40541
- package/compiler/rindo.min.js +2 -15
- package/dependencies.json +73 -50
- package/dev-server/client/index.js +33 -10
- package/dev-server/client/package.json +3 -3
- package/dev-server/connector.html +3 -3
- package/dev-server/index.d.ts +3 -6
- package/dev-server/index.js +256 -252
- package/dev-server/package.json +3 -3
- package/dev-server/server-process.js +1738 -0
- package/dev-server/server-worker-thread.js +39 -0
- package/dev-server/templates/initial-load.html +160 -160
- package/dev-server/ws.js +1 -1
- package/internal/app-data/{index.cjs.js → index.cjs} +7 -5
- package/internal/app-data/index.d.ts +1 -0
- package/internal/app-data/index.js +7 -6
- package/internal/app-data/package.json +11 -5
- package/internal/client/css-shim.js +2 -2
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +193 -119
- package/internal/client/package.json +4 -3
- package/internal/client/{patch.js → patch-browser.js} +8 -24
- package/internal/client/patch-esm.js +23 -0
- package/internal/client/polyfills/css-shim.js +1 -1
- package/internal/client/polyfills/index.js +34 -34
- package/internal/client/shadow-css.js +9 -3
- package/internal/hydrate/index.js +305 -281
- package/internal/hydrate/package.json +2 -2
- package/internal/hydrate/runner.d.ts +24 -12
- package/internal/hydrate/runner.js +153 -124
- package/internal/hydrate/shadow-css.js +24 -24
- package/internal/package.json +5 -4
- package/internal/rindo-core/index.cjs +1 -0
- package/internal/rindo-core/index.d.ts +51 -2
- package/internal/rindo-core/index.js +15 -1
- package/internal/rindo-ext-modules.d.ts +41 -39
- package/internal/rindo-private.d.ts +93 -148
- package/internal/rindo-public-compiler.d.ts +231 -155
- package/internal/rindo-public-runtime.d.ts +42 -39
- package/internal/testing/index.js +144 -121
- package/internal/testing/package.json +2 -2
- package/internal/testing/shadow-css.js +24 -24
- package/mock-doc/index.cjs +4610 -0
- package/mock-doc/index.d.ts +12 -1
- package/mock-doc/index.js +177 -67
- package/mock-doc/package.json +11 -5
- package/package.json +132 -133
- package/readme.md +21 -95
- package/screenshot/compare/build/app.js +33 -33
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
- package/screenshot/connector-base.d.ts +1 -1
- package/screenshot/connector-local.d.ts +1 -1
- package/screenshot/index.js +63 -46
- package/screenshot/package.json +10 -3
- package/screenshot/pixel-match.js +54 -57
- package/screenshot/screenshot-compare.d.ts +1 -1
- package/screenshot/screenshot-fs.d.ts +1 -1
- package/sys/deno/index.js +1785 -0
- package/sys/deno/node-compat.js +2654 -0
- package/sys/deno/worker.js +44 -0
- package/sys/node/autoprefixer.js +8 -1
- package/sys/node/glob.js +1 -1
- package/sys/node/graceful-fs.js +1 -1
- package/sys/node/index.d.ts +1 -1
- package/sys/node/index.js +689 -705
- package/sys/node/node-fetch.js +1 -1
- package/sys/node/package.json +3 -3
- package/sys/node/prompts.js +1 -1
- package/sys/node/worker.js +38 -19
- package/testing/index.d.ts +3 -3
- package/testing/index.js +863 -749
- package/testing/jest/jest-config.d.ts +2 -89
- package/testing/jest/jest-environment.d.ts +1 -1
- package/testing/jest/jest-runner.d.ts +1 -1
- package/testing/jest/jest-screenshot.d.ts +1 -1
- package/testing/jest-preset.js +32 -32
- package/testing/matchers/events.d.ts +1 -1
- package/testing/matchers/screenshot.d.ts +1 -1
- package/testing/mock-fetch.d.ts +1 -1
- package/testing/mocks.d.ts +1 -1
- package/testing/package.json +3 -3
- package/testing/puppeteer/index.d.ts +1 -1
- package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
- package/testing/puppeteer/puppeteer-declarations.d.ts +11 -11
- package/testing/puppeteer/puppeteer-element.d.ts +3 -3
- package/testing/puppeteer/puppeteer-emulate.d.ts +1 -1
- package/testing/puppeteer/puppeteer-events.d.ts +3 -3
- package/testing/puppeteer/puppeteer-page.d.ts +1 -1
- package/testing/puppeteer/puppeteer-screenshot.d.ts +2 -2
- package/testing/reset-build-conditionals.d.ts +1 -1
- package/testing/spec-page.d.ts +1 -1
- package/testing/test-transpile.d.ts +1 -1
- package/testing/testing-logger.d.ts +1 -1
- package/testing/testing-utils.d.ts +1 -1
- package/testing/testing.d.ts +1 -1
- package/cli/index.cjs.js +0 -524
- package/dev-server/content-type-db.json +0 -1
- package/dev-server/server-worker.js +0 -1570
- package/mock-doc/index.cjs.js +0 -4500
package/internal/client/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
let scopeId;
|
|
2
2
|
let contentRef;
|
|
3
3
|
let hostTagName;
|
|
4
|
+
let customError;
|
|
4
5
|
let i = 0;
|
|
5
6
|
let useNativeShadowDom = false;
|
|
6
7
|
let checkSlotFallbackVisibility = false;
|
|
@@ -10,7 +11,7 @@ let renderingRef = null;
|
|
|
10
11
|
let queueCongestion = 0;
|
|
11
12
|
let queuePending = false;
|
|
12
13
|
/*
|
|
13
|
-
Rindo Client Platform
|
|
14
|
+
Rindo Client Platform v2.5.2 | MIT Licensed | https://rindojs.web.app
|
|
14
15
|
*/
|
|
15
16
|
import { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
|
|
16
17
|
const win = typeof window !== 'undefined' ? window : {};
|
|
@@ -27,7 +28,9 @@ const plt = {
|
|
|
27
28
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
28
29
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
29
30
|
};
|
|
30
|
-
const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
|
|
31
|
+
const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
|
|
32
|
+
? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
33
|
+
: true;
|
|
31
34
|
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
|
32
35
|
let supportsListenerOptions = false;
|
|
33
36
|
try {
|
|
@@ -45,7 +48,7 @@ const supportsConstructibleStylesheets = BUILD.constructableCSS
|
|
|
45
48
|
? /*@__PURE__*/ (() => {
|
|
46
49
|
try {
|
|
47
50
|
new CSSStyleSheet();
|
|
48
|
-
return
|
|
51
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
49
52
|
}
|
|
50
53
|
catch (e) { }
|
|
51
54
|
return false;
|
|
@@ -64,13 +67,13 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
64
67
|
// this is being ran from within the connectedCallback
|
|
65
68
|
// which is important so that we know the host element actually has a parent element
|
|
66
69
|
// filter out the listeners to only have the ones that ARE being attached to the parent
|
|
67
|
-
listeners = listeners.filter(([flags]) => flags &
|
|
70
|
+
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
68
71
|
}
|
|
69
72
|
else {
|
|
70
73
|
// this is being ran from within the component constructor
|
|
71
74
|
// everything BUT the parent element listeners should be attached at this time
|
|
72
75
|
// filter out the listeners that are NOT being attached to the parent
|
|
73
|
-
listeners = listeners.filter(([flags]) => !(flags &
|
|
76
|
+
listeners = listeners.filter(([flags]) => !(flags & 32 /* TargetParent */));
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
listeners.map(([flags, name, method]) => {
|
|
@@ -83,17 +86,22 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
88
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
try {
|
|
90
|
+
if (BUILD.lazyLoad) {
|
|
91
|
+
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
92
|
+
// instance is ready, let's call it's member method for this event
|
|
93
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
else {
|
|
92
|
-
|
|
100
|
+
hostRef.$hostElement$[methodName](ev);
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
catch (e) {
|
|
104
|
+
consoleError(e);
|
|
97
105
|
}
|
|
98
106
|
};
|
|
99
107
|
const getHostListenerTarget = (elm, flags) => {
|
|
@@ -101,9 +109,9 @@ const getHostListenerTarget = (elm, flags) => {
|
|
|
101
109
|
return doc;
|
|
102
110
|
if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
|
|
103
111
|
return win;
|
|
104
|
-
if (BUILD.hostListenerTargetBody && flags &
|
|
112
|
+
if (BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */)
|
|
105
113
|
return doc.body;
|
|
106
|
-
if (BUILD.hostListenerTargetParent && flags &
|
|
114
|
+
if (BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */)
|
|
107
115
|
return elm.parentElement;
|
|
108
116
|
return elm;
|
|
109
117
|
};
|
|
@@ -239,7 +247,9 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
239
247
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
240
248
|
}
|
|
241
249
|
if (!appliedStyles.has(scopeId)) {
|
|
242
|
-
if (BUILD.hydrateClientSide &&
|
|
250
|
+
if (BUILD.hydrateClientSide &&
|
|
251
|
+
styleContainerNode.host &&
|
|
252
|
+
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
243
253
|
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
244
254
|
styleElm.innerHTML = style;
|
|
245
255
|
}
|
|
@@ -317,8 +327,6 @@ const EMPTY_OBJ = {};
|
|
|
317
327
|
*/
|
|
318
328
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
319
329
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
320
|
-
const getCurrentDirectory = process.cwd;
|
|
321
|
-
const exit = process.exit;
|
|
322
330
|
const isDef = (v) => v != null;
|
|
323
331
|
const isComplexType = (o) => {
|
|
324
332
|
// https://jsperf.com/typeof-fn-object/5
|
|
@@ -354,8 +362,8 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
354
362
|
child = String(child);
|
|
355
363
|
}
|
|
356
364
|
else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
|
|
357
|
-
consoleDevError(`vNode passed as children has unexpected type.
|
|
358
|
-
Make sure it's using the correct h() function.
|
|
365
|
+
consoleDevError(`vNode passed as children has unexpected type.
|
|
366
|
+
Make sure it's using the correct h() function.
|
|
359
367
|
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
360
368
|
}
|
|
361
369
|
if (simple && lastSimple) {
|
|
@@ -395,8 +403,8 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
395
403
|
}
|
|
396
404
|
}
|
|
397
405
|
if (BUILD.isDev && vNodeChildren.some(isHost)) {
|
|
398
|
-
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
399
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
406
|
+
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
407
|
+
- You are NOT using hostData() and <Host> in the same component.
|
|
400
408
|
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
401
409
|
}
|
|
402
410
|
if (BUILD.vdomFunctional && typeof nodeName === 'function') {
|
|
@@ -439,10 +447,7 @@ const Host = {};
|
|
|
439
447
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
440
448
|
const vdomFnUtils = {
|
|
441
449
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
442
|
-
map: (children, cb) => children
|
|
443
|
-
.map(convertToPublic)
|
|
444
|
-
.map(cb)
|
|
445
|
-
.map(convertToPrivate),
|
|
450
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
446
451
|
};
|
|
447
452
|
const convertToPublic = (node) => ({
|
|
448
453
|
vattrs: node.$attrs$,
|
|
@@ -461,7 +466,7 @@ const convertToPrivate = (node) => {
|
|
|
461
466
|
if (node.vname) {
|
|
462
467
|
vnodeData.name = node.vname;
|
|
463
468
|
}
|
|
464
|
-
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
469
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
465
470
|
}
|
|
466
471
|
const vnode = newVNode(node.vtag, node.vtext);
|
|
467
472
|
vnode.$attrs$ = node.vattrs;
|
|
@@ -536,7 +541,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
536
541
|
newValue(elm);
|
|
537
542
|
}
|
|
538
543
|
}
|
|
539
|
-
else if (BUILD.vdomListener &&
|
|
544
|
+
else if (BUILD.vdomListener &&
|
|
545
|
+
(BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
|
|
546
|
+
memberName[0] === 'o' &&
|
|
547
|
+
memberName[1] === 'n') {
|
|
540
548
|
// Event Handlers
|
|
541
549
|
// so if the member name starts with "on" and the 3rd characters is
|
|
542
550
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -637,7 +645,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
637
645
|
// if the element passed in is a shadow root, which is a document fragment
|
|
638
646
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
639
647
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
640
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
648
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
649
|
+
? newVnode.$elm$.host
|
|
650
|
+
: newVnode.$elm$;
|
|
641
651
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
642
652
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
643
653
|
if (BUILD.updatable) {
|
|
@@ -676,7 +686,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
676
686
|
}
|
|
677
687
|
}
|
|
678
688
|
if (BUILD.isDev && newVNode.$elm$) {
|
|
679
|
-
|
|
689
|
+
consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$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`);
|
|
680
690
|
}
|
|
681
691
|
if (BUILD.vdomText && newVNode.$text$ !== null) {
|
|
682
692
|
// create text node
|
|
@@ -684,7 +694,8 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
684
694
|
}
|
|
685
695
|
else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
686
696
|
// create a slot reference node
|
|
687
|
-
elm = newVNode.$elm$ =
|
|
697
|
+
elm = newVNode.$elm$ =
|
|
698
|
+
BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
|
|
688
699
|
}
|
|
689
700
|
else {
|
|
690
701
|
if (BUILD.svg && !isSvgMode) {
|
|
@@ -692,8 +703,12 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
692
703
|
}
|
|
693
704
|
// create element
|
|
694
705
|
elm = newVNode.$elm$ = (BUILD.svg
|
|
695
|
-
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
|
|
696
|
-
|
|
706
|
+
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
|
|
707
|
+
? 'slot-fb'
|
|
708
|
+
: newVNode.$tag$)
|
|
709
|
+
: doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
|
|
710
|
+
? 'slot-fb'
|
|
711
|
+
: newVNode.$tag$));
|
|
697
712
|
if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
698
713
|
isSvgMode = false;
|
|
699
714
|
}
|
|
@@ -1011,24 +1026,22 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
1011
1026
|
// then hide it if there are other slots in the light dom
|
|
1012
1027
|
childNode.hidden = false;
|
|
1013
1028
|
for (j = 0; j < ilen; j++) {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
if (slotNameAttr
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
childNode.hidden = true;
|
|
1021
|
-
break;
|
|
1022
|
-
}
|
|
1029
|
+
nodeType = childNodes[j].nodeType;
|
|
1030
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
1031
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
1032
|
+
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1033
|
+
childNode.hidden = true;
|
|
1034
|
+
break;
|
|
1023
1035
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
// this is a default fallback slot node
|
|
1039
|
+
// any element or text node (with content)
|
|
1040
|
+
// should hide the default fallback slot node
|
|
1041
|
+
if (nodeType === 1 /* ElementNode */ ||
|
|
1042
|
+
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1043
|
+
childNode.hidden = true;
|
|
1044
|
+
break;
|
|
1032
1045
|
}
|
|
1033
1046
|
}
|
|
1034
1047
|
}
|
|
@@ -1052,7 +1065,7 @@ const relocateSlotContent = (elm) => {
|
|
|
1052
1065
|
let ilen = childNodes.length;
|
|
1053
1066
|
for (; i < ilen; i++) {
|
|
1054
1067
|
childNode = childNodes[i];
|
|
1055
|
-
if (childNode['s-sr'] && (node = childNode['s-cr'])) {
|
|
1068
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1056
1069
|
// first got the content reference comment node
|
|
1057
1070
|
// then we got it's parent, which is where all the host content is in now
|
|
1058
1071
|
hostContentNodes = node.parentNode.childNodes;
|
|
@@ -1138,17 +1151,17 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1138
1151
|
hostTagName = hostElm.tagName;
|
|
1139
1152
|
// <Host> runtime check
|
|
1140
1153
|
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1141
|
-
throw new Error(`The <Host> must be the single root component.
|
|
1142
|
-
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1143
|
-
|
|
1144
|
-
The render() function should look like this instead:
|
|
1145
|
-
|
|
1146
|
-
render() {
|
|
1147
|
-
// Do not return an array
|
|
1148
|
-
return (
|
|
1149
|
-
<Host>{content}</Host>
|
|
1150
|
-
);
|
|
1151
|
-
}
|
|
1154
|
+
throw new Error(`The <Host> must be the single root component.
|
|
1155
|
+
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1156
|
+
|
|
1157
|
+
The render() function should look like this instead:
|
|
1158
|
+
|
|
1159
|
+
render() {
|
|
1160
|
+
// Do not return an array
|
|
1161
|
+
return (
|
|
1162
|
+
<Host>{content}</Host>
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1152
1165
|
`);
|
|
1153
1166
|
}
|
|
1154
1167
|
if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
|
@@ -1189,7 +1202,10 @@ render() {
|
|
|
1189
1202
|
if (!nodeToRelocate['s-ol']) {
|
|
1190
1203
|
// add a reference node marking this node's original location
|
|
1191
1204
|
// keep a reference to this node for later lookups
|
|
1192
|
-
orgLocationNode =
|
|
1205
|
+
orgLocationNode =
|
|
1206
|
+
BUILD.isDebug || BUILD.hydrateServerSide
|
|
1207
|
+
? originalLocationDebugNode(nodeToRelocate)
|
|
1208
|
+
: doc.createTextNode('');
|
|
1193
1209
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1194
1210
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1195
1211
|
}
|
|
@@ -1213,7 +1229,8 @@ render() {
|
|
|
1213
1229
|
}
|
|
1214
1230
|
}
|
|
1215
1231
|
}
|
|
1216
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1232
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1233
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1217
1234
|
// we've checked that it's worth while to relocate
|
|
1218
1235
|
// since that the node to relocate
|
|
1219
1236
|
// has a different next sibling or parent relocated
|
|
@@ -1248,7 +1265,10 @@ render() {
|
|
|
1248
1265
|
// slot comment debug nodes only created with the `--debug` flag
|
|
1249
1266
|
// otherwise these nodes are text nodes w/out content
|
|
1250
1267
|
const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
|
|
1251
|
-
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
|
1268
|
+
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
|
1269
|
+
(nodeToRelocate.localName
|
|
1270
|
+
? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
|
|
1271
|
+
: `[${nodeToRelocate.textContent}]`));
|
|
1252
1272
|
const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
|
|
1253
1273
|
const createEvent = (ref, name, flags) => {
|
|
1254
1274
|
const elm = getElement(ref);
|
|
@@ -1285,11 +1305,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1285
1305
|
return;
|
|
1286
1306
|
}
|
|
1287
1307
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
1288
|
-
// there is no
|
|
1308
|
+
// there is no ancestor component or the ancestor component
|
|
1289
1309
|
// has already fired off its lifecycle update then
|
|
1290
1310
|
// fire off the initial update
|
|
1291
1311
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1292
|
-
return BUILD.taskQueue ? writeTask(dispatch) : dispatch;
|
|
1312
|
+
return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
|
|
1293
1313
|
};
|
|
1294
1314
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1295
1315
|
const elm = hostRef.$hostElement$;
|
|
@@ -1322,7 +1342,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1322
1342
|
endSchedule();
|
|
1323
1343
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1324
1344
|
};
|
|
1325
|
-
const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
1345
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1326
1346
|
// updateComponent
|
|
1327
1347
|
const elm = hostRef.$hostElement$;
|
|
1328
1348
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
@@ -1335,16 +1355,11 @@ const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
|
1335
1355
|
if (BUILD.isDev) {
|
|
1336
1356
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1337
1357
|
}
|
|
1338
|
-
if (BUILD.
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
renderVdom(hostRef, callRender(hostRef, instance));
|
|
1344
|
-
}
|
|
1345
|
-
else {
|
|
1346
|
-
elm.textContent = callRender(hostRef, instance);
|
|
1347
|
-
}
|
|
1358
|
+
if (BUILD.hydrateServerSide) {
|
|
1359
|
+
await callRender(hostRef, instance, elm);
|
|
1360
|
+
}
|
|
1361
|
+
else {
|
|
1362
|
+
callRender(hostRef, instance, elm);
|
|
1348
1363
|
}
|
|
1349
1364
|
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
1350
1365
|
plt.$cssShim$.updateHost(elm);
|
|
@@ -1368,7 +1383,7 @@ const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
|
1368
1383
|
}
|
|
1369
1384
|
}
|
|
1370
1385
|
catch (e) {
|
|
1371
|
-
consoleError(e);
|
|
1386
|
+
consoleError(e, elm);
|
|
1372
1387
|
}
|
|
1373
1388
|
}
|
|
1374
1389
|
if (BUILD.asyncLoading && rc) {
|
|
@@ -1396,7 +1411,7 @@ const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
|
1396
1411
|
postUpdateComponent(hostRef);
|
|
1397
1412
|
}
|
|
1398
1413
|
};
|
|
1399
|
-
const callRender = (hostRef, instance) => {
|
|
1414
|
+
const callRender = (hostRef, instance, elm) => {
|
|
1400
1415
|
// in order for bundlers to correctly treeshake the BUILD object
|
|
1401
1416
|
// we need to ensure BUILD is not deoptimized within a try/catch
|
|
1402
1417
|
// https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
|
|
@@ -1413,12 +1428,28 @@ const callRender = (hostRef, instance) => {
|
|
|
1413
1428
|
if (updatable || lazyLoad) {
|
|
1414
1429
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1415
1430
|
}
|
|
1431
|
+
if (BUILD.hasRenderFn || BUILD.reflect) {
|
|
1432
|
+
if (BUILD.vdomRender || BUILD.reflect) {
|
|
1433
|
+
// looks like we've got child nodes to render into this host element
|
|
1434
|
+
// or we need to update the css class/attrs on the host element
|
|
1435
|
+
// DOM WRITE!
|
|
1436
|
+
if (BUILD.hydrateServerSide) {
|
|
1437
|
+
return Promise.resolve(instance).then(value => renderVdom(hostRef, value));
|
|
1438
|
+
}
|
|
1439
|
+
else {
|
|
1440
|
+
renderVdom(hostRef, instance);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
elm.textContent = instance;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1416
1447
|
}
|
|
1417
1448
|
catch (e) {
|
|
1418
|
-
consoleError(e);
|
|
1449
|
+
consoleError(e, hostRef.$hostElement$);
|
|
1419
1450
|
}
|
|
1420
1451
|
renderingRef = null;
|
|
1421
|
-
return
|
|
1452
|
+
return null;
|
|
1422
1453
|
};
|
|
1423
1454
|
const getRenderingRef = () => renderingRef;
|
|
1424
1455
|
const postUpdateComponent = (hostRef) => {
|
|
@@ -1504,7 +1535,8 @@ const forceUpdate = (ref) => {
|
|
|
1504
1535
|
if (BUILD.updatable) {
|
|
1505
1536
|
const hostRef = getHostRef(ref);
|
|
1506
1537
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1507
|
-
if (isConnected &&
|
|
1538
|
+
if (isConnected &&
|
|
1539
|
+
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1508
1540
|
scheduleUpdate(hostRef, false);
|
|
1509
1541
|
}
|
|
1510
1542
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1551,7 +1583,11 @@ const emitLifecycleEvent = (elm, lifecycleName) => {
|
|
|
1551
1583
|
});
|
|
1552
1584
|
}
|
|
1553
1585
|
};
|
|
1554
|
-
const addHydratedFlag = (elm) =>
|
|
1586
|
+
const addHydratedFlag = (elm) => BUILD.hydratedClass
|
|
1587
|
+
? elm.classList.add('hydrated')
|
|
1588
|
+
: BUILD.hydratedAttribute
|
|
1589
|
+
? elm.setAttribute('hydrated', '')
|
|
1590
|
+
: undefined;
|
|
1555
1591
|
const serverSideConnected = (elm) => {
|
|
1556
1592
|
const children = elm.children;
|
|
1557
1593
|
if (children != null) {
|
|
@@ -1826,12 +1862,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1826
1862
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
1827
1863
|
}
|
|
1828
1864
|
catch (e) {
|
|
1829
|
-
consoleError(e);
|
|
1865
|
+
consoleError(e, elm);
|
|
1830
1866
|
}
|
|
1831
1867
|
});
|
|
1832
1868
|
}
|
|
1833
1869
|
}
|
|
1834
|
-
if (BUILD.updatable &&
|
|
1870
|
+
if (BUILD.updatable &&
|
|
1871
|
+
(flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1835
1872
|
if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
1836
1873
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1837
1874
|
return;
|
|
@@ -1855,7 +1892,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1855
1892
|
const members = Object.entries(cmpMeta.$members$);
|
|
1856
1893
|
const prototype = Cstr.prototype;
|
|
1857
1894
|
members.map(([memberName, [memberFlags]]) => {
|
|
1858
|
-
if ((BUILD.prop || BUILD.state) &&
|
|
1895
|
+
if ((BUILD.prop || BUILD.state) &&
|
|
1896
|
+
(memberFlags & 31 /* Prop */ ||
|
|
1897
|
+
((!BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1859
1898
|
// proxyComponent - prop
|
|
1860
1899
|
Object.defineProperty(prototype, memberName, {
|
|
1861
1900
|
get() {
|
|
@@ -1863,14 +1902,20 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1863
1902
|
return getValue(this, memberName);
|
|
1864
1903
|
},
|
|
1865
1904
|
set(newValue) {
|
|
1866
|
-
if (
|
|
1867
1905
|
// only during dev time
|
|
1868
|
-
BUILD.isDev
|
|
1869
|
-
|
|
1906
|
+
if (BUILD.isDev) {
|
|
1907
|
+
const ref = getHostRef(this);
|
|
1908
|
+
if (
|
|
1909
|
+
// we are proxying the instance (not element)
|
|
1870
1910
|
(flags & 1 /* isElementConstructor */) === 0 &&
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1911
|
+
// the element is not constructing
|
|
1912
|
+
(ref.$flags$ & 8 /* isConstructingInstance */) === 0 &&
|
|
1913
|
+
// the member is a prop
|
|
1914
|
+
(memberFlags & 31 /* Prop */) !== 0 &&
|
|
1915
|
+
// the member is not mutable
|
|
1916
|
+
(memberFlags & 1024 /* Mutable */) === 0) {
|
|
1917
|
+
consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://rindojs.web.app/docs/properties#prop-mutability`);
|
|
1918
|
+
}
|
|
1874
1919
|
}
|
|
1875
1920
|
// proxyComponent, set value
|
|
1876
1921
|
setValue(this, memberName, newValue, cmpMeta);
|
|
@@ -1879,7 +1924,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1879
1924
|
enumerable: true,
|
|
1880
1925
|
});
|
|
1881
1926
|
}
|
|
1882
|
-
else if (BUILD.lazyLoad &&
|
|
1927
|
+
else if (BUILD.lazyLoad &&
|
|
1928
|
+
BUILD.method &&
|
|
1929
|
+
flags & 1 /* isElementConstructor */ &&
|
|
1930
|
+
memberFlags & 64 /* Method */) {
|
|
1883
1931
|
// proxyComponent - method
|
|
1884
1932
|
Object.defineProperty(prototype, memberName, {
|
|
1885
1933
|
value(...args) {
|
|
@@ -1915,7 +1963,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1915
1963
|
};
|
|
1916
1964
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1917
1965
|
// initializeComponent
|
|
1918
|
-
if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) &&
|
|
1966
|
+
if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) &&
|
|
1967
|
+
(hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1919
1968
|
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
|
|
1920
1969
|
// we haven't initialized this element yet
|
|
1921
1970
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1985,7 +2034,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1985
2034
|
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1986
2035
|
if (!styles.has(scopeId)) {
|
|
1987
2036
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1988
|
-
if (!BUILD.hydrateServerSide &&
|
|
2037
|
+
if (!BUILD.hydrateServerSide &&
|
|
2038
|
+
BUILD.shadowDom &&
|
|
2039
|
+
BUILD.shadowDomShim &&
|
|
2040
|
+
cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1989
2041
|
style = await import('./shadow-css.js').then(m => m.scopeCss(style, scopeId, false));
|
|
1990
2042
|
}
|
|
1991
2043
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
@@ -2031,7 +2083,9 @@ const connectedCallback = (elm) => {
|
|
|
2031
2083
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2032
2084
|
if (hostId) {
|
|
2033
2085
|
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2034
|
-
const scopeId = BUILD.mode
|
|
2086
|
+
const scopeId = BUILD.mode
|
|
2087
|
+
? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
|
|
2088
|
+
: addStyle(elm.shadowRoot, cmpMeta);
|
|
2035
2089
|
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
2036
2090
|
}
|
|
2037
2091
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
@@ -2042,7 +2096,9 @@ const connectedCallback = (elm) => {
|
|
|
2042
2096
|
// if the slot polyfill is required we'll need to put some nodes
|
|
2043
2097
|
// in here to act as original content anchors as we move nodes around
|
|
2044
2098
|
// host element has been connected to the DOM
|
|
2045
|
-
if (BUILD.hydrateServerSide ||
|
|
2099
|
+
if (BUILD.hydrateServerSide ||
|
|
2100
|
+
((BUILD.slot || BUILD.shadowDom) &&
|
|
2101
|
+
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
2046
2102
|
setContentReference(elm);
|
|
2047
2103
|
}
|
|
2048
2104
|
}
|
|
@@ -2053,7 +2109,10 @@ const connectedCallback = (elm) => {
|
|
|
2053
2109
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
2054
2110
|
// climb up the ancestors looking for the first
|
|
2055
2111
|
// component that hasn't finished its lifecycle update yet
|
|
2056
|
-
if ((BUILD.hydrateClientSide &&
|
|
2112
|
+
if ((BUILD.hydrateClientSide &&
|
|
2113
|
+
ancestorComponent.nodeType === 1 /* ElementNode */ &&
|
|
2114
|
+
ancestorComponent.hasAttribute('s-id') &&
|
|
2115
|
+
ancestorComponent['s-p']) ||
|
|
2057
2116
|
ancestorComponent['s-p']) {
|
|
2058
2117
|
// we found this components first ancestor component
|
|
2059
2118
|
// keep a reference to this component's ancestor component
|
|
@@ -2229,10 +2288,24 @@ const patchCloneNode = (HostElementPrototype) => {
|
|
|
2229
2288
|
if (BUILD.slot && !isShadowDom && deep) {
|
|
2230
2289
|
let i = 0;
|
|
2231
2290
|
let slotted, nonRindoNode;
|
|
2232
|
-
let rindoPrivates = [
|
|
2291
|
+
let rindoPrivates = [
|
|
2292
|
+
's-id',
|
|
2293
|
+
's-cr',
|
|
2294
|
+
's-lr',
|
|
2295
|
+
's-rc',
|
|
2296
|
+
's-sc',
|
|
2297
|
+
's-p',
|
|
2298
|
+
's-cn',
|
|
2299
|
+
's-sr',
|
|
2300
|
+
's-sn',
|
|
2301
|
+
's-hn',
|
|
2302
|
+
's-ol',
|
|
2303
|
+
's-nr',
|
|
2304
|
+
's-si',
|
|
2305
|
+
];
|
|
2233
2306
|
for (; i < srcNode.childNodes.length; i++) {
|
|
2234
2307
|
slotted = srcNode.childNodes[i]['s-nr'];
|
|
2235
|
-
nonRindoNode = rindoPrivates.every(
|
|
2308
|
+
nonRindoNode = rindoPrivates.every(privateField => !srcNode.childNodes[i][privateField]);
|
|
2236
2309
|
if (slotted) {
|
|
2237
2310
|
if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
|
|
2238
2311
|
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
@@ -2283,7 +2356,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
2283
2356
|
Object.defineProperty(elm, 'childNodes', {
|
|
2284
2357
|
get() {
|
|
2285
2358
|
const childNodes = childNodesFn.call(this);
|
|
2286
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
2359
|
+
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
2360
|
+
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
2287
2361
|
const result = new FakeNodeList();
|
|
2288
2362
|
for (let i = 0; i < childNodes.length; i++) {
|
|
2289
2363
|
const slot = childNodes[i]['s-nr'];
|
|
@@ -2377,7 +2451,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2377
2451
|
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2378
2452
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
2379
2453
|
}
|
|
2380
|
-
const tagName = BUILD.transformTagName && options.transformTagName
|
|
2454
|
+
const tagName = BUILD.transformTagName && options.transformTagName
|
|
2455
|
+
? options.transformTagName(cmpMeta.$tagName$)
|
|
2456
|
+
: cmpMeta.$tagName$;
|
|
2381
2457
|
const HostElement = class extends HTMLElement {
|
|
2382
2458
|
// RindoLazyHost
|
|
2383
2459
|
constructor(self) {
|
|
@@ -2425,17 +2501,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2425
2501
|
disconnectedCallback() {
|
|
2426
2502
|
plt.jmp(() => disconnectedCallback(this));
|
|
2427
2503
|
}
|
|
2428
|
-
forceUpdate() {
|
|
2429
|
-
if (BUILD.isDev) {
|
|
2430
|
-
consoleDevWarn(`element.forceUpdate() is deprecated, use the "forceUpdate" function from "@rindo/core" instead:
|
|
2431
|
-
|
|
2432
|
-
import { forceUpdate } from ‘@rindo/core’;
|
|
2433
|
-
|
|
2434
|
-
forceUpdate(this);
|
|
2435
|
-
forceUpdate(element);`);
|
|
2436
|
-
}
|
|
2437
|
-
forceUpdate(this);
|
|
2438
|
-
}
|
|
2439
2504
|
componentOnReady() {
|
|
2440
2505
|
return getHostRef(this).$onReadyPromise$;
|
|
2441
2506
|
}
|
|
@@ -2650,7 +2715,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
|
|
|
2650
2715
|
}
|
|
2651
2716
|
else if (childElm.nodeType === 3 /* TextNode */) {
|
|
2652
2717
|
const parentNode = childElm.parentNode;
|
|
2653
|
-
|
|
2718
|
+
const nodeName = parentNode.nodeName;
|
|
2719
|
+
if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
|
|
2654
2720
|
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
2655
2721
|
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
2656
2722
|
parentNode.insertBefore(commentBeforeTextNode, childElm);
|
|
@@ -2670,6 +2736,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
|
|
|
2670
2736
|
});
|
|
2671
2737
|
}
|
|
2672
2738
|
};
|
|
2739
|
+
const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
2740
|
+
const Fragment = (_, children) => children;
|
|
2673
2741
|
const hostRefs = new WeakMap();
|
|
2674
2742
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2675
2743
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -2695,13 +2763,17 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
2695
2763
|
return hostRefs.set(elm, hostRef);
|
|
2696
2764
|
};
|
|
2697
2765
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
2766
|
+
const consoleError = (e, el) => (customError || console.error)(e, el);
|
|
2698
2767
|
const RINDO_DEV_MODE = BUILD.isTesting
|
|
2699
2768
|
? ['RINDO:'] // E2E testing
|
|
2700
|
-
: [
|
|
2769
|
+
: [
|
|
2770
|
+
'%crindo',
|
|
2771
|
+
'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
|
|
2772
|
+
];
|
|
2701
2773
|
const consoleDevError = (...m) => console.error(...RINDO_DEV_MODE, ...m);
|
|
2702
2774
|
const consoleDevWarn = (...m) => console.warn(...RINDO_DEV_MODE, ...m);
|
|
2703
2775
|
const consoleDevInfo = (...m) => console.info(...RINDO_DEV_MODE, ...m);
|
|
2704
|
-
const
|
|
2776
|
+
const setErrorHandler = (handler) => (customError = handler);
|
|
2705
2777
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
2706
2778
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
2707
2779
|
// loadModuleImport
|
|
@@ -2782,7 +2854,9 @@ const flush = () => {
|
|
|
2782
2854
|
consume(queueDomReads);
|
|
2783
2855
|
// DOM WRITES!!!
|
|
2784
2856
|
if (BUILD.asyncQueue) {
|
|
2785
|
-
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
|
|
2857
|
+
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
|
|
2858
|
+
? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
|
|
2859
|
+
: Infinity;
|
|
2786
2860
|
consumeTimeout(queueDomWrites, timeout);
|
|
2787
2861
|
consumeTimeout(queueDomWritesLow, timeout);
|
|
2788
2862
|
if (queueDomWrites.length > 0) {
|
|
@@ -2816,5 +2890,5 @@ const Build = {
|
|
|
2816
2890
|
isServer: false,
|
|
2817
2891
|
isTesting: BUILD.isTesting ? true : false,
|
|
2818
2892
|
};
|
|
2819
|
-
export { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
|
|
2820
|
-
export { Build, CSS, Context, H, H as HTMLElement, Host, RINDO_DEV_MODE, addHostEventListeners, attachShadow, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, doc, forceModeUpdate, forceUpdate, getAssetPath, getConnect, getContext, getElement, getHostRef, getMode, getRenderingRef, getValue, h, insertVdomAnnotations, isMemberInElement, loadModule, modeResolutionChain, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, renderVdom, setAssetPath, setMode, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadow, win, writeTask };
|
|
2893
|
+
export { BUILD, Env, NAMESPACE } from '@rindo/core/internal/app-data';
|
|
2894
|
+
export { Build, CSS, Context, Fragment, H, H as HTMLElement, Host, RINDO_DEV_MODE, addHostEventListeners, attachShadow, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, doc, forceModeUpdate, forceUpdate, getAssetPath, getConnect, getContext, getElement, getHostRef, getMode, getRenderingRef, getValue, h, insertVdomAnnotations, isMemberInElement, loadModule, modeResolutionChain, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setPlatformOptions, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadow, win, writeTask };
|