@rindo/core 3.3.0 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +15 -75
- package/compiler/rindo.min.js +2 -2
- 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 +2 -2
- package/internal/app-data/index.cjs +0 -6
- package/internal/app-data/index.js +0 -6
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +7 -37
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +4 -102
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +18 -23
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +0 -13
- package/internal/rindo-public-compiler.d.ts +0 -24
- package/internal/testing/index.js +18 -24
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/package.json +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 +8 -8
- package/testing/package.json +1 -1
- package/internal/client/css-shim.js +0 -4
- package/internal/client/dom.js +0 -73
- package/internal/client/patch-esm.js +0 -25
- package/internal/client/polyfills/css-shim.js +0 -1
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Client Patch Browser
|
|
2
|
+
Rindo Client Patch Browser v4.0.0-beta.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
import { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
|
|
5
|
-
import { consoleDevInfo,
|
|
6
|
-
/**
|
|
7
|
-
* Helper method for querying a `meta` tag that contains a nonce value
|
|
8
|
-
* out of a DOM's head.
|
|
9
|
-
*
|
|
10
|
-
* @param doc The DOM containing the `head` to query against
|
|
11
|
-
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
12
|
-
* exists or the tag has no content.
|
|
13
|
-
*/
|
|
14
|
-
function queryNonceMetaTagContent(doc) {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
17
|
-
}
|
|
18
|
-
// TODO: Remove code related to the dynamic import shim
|
|
19
|
-
const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
|
5
|
+
import { consoleDevInfo, doc, promiseResolve, H } from '@rindo/core';
|
|
20
6
|
const patchBrowser = () => {
|
|
21
7
|
// NOTE!! This fn cannot use async/await!
|
|
22
8
|
if (BUILD.isDev && !BUILD.isTesting) {
|
|
23
9
|
consoleDevInfo('Running in development mode.');
|
|
24
10
|
}
|
|
25
|
-
// TODO: Remove code implementing the CSS variable shim
|
|
26
|
-
if (BUILD.cssVarShim) {
|
|
27
|
-
// shim css vars
|
|
28
|
-
// TODO: Remove code implementing the CSS variable shim
|
|
29
|
-
plt.$cssShim$ = win.__cssshim;
|
|
30
|
-
}
|
|
31
11
|
if (BUILD.cloneNodeFix) {
|
|
32
12
|
// opted-in to polyfill cloneNode() for slot polyfilled components
|
|
33
13
|
patchCloneNodeFix(H.prototype);
|
|
@@ -44,95 +24,17 @@ const patchBrowser = () => {
|
|
|
44
24
|
performance.getEntriesByName = () => [];
|
|
45
25
|
}
|
|
46
26
|
// @ts-ignore
|
|
47
|
-
const scriptElm =
|
|
48
|
-
// TODO: Remove code related to the dynamic import shim
|
|
49
|
-
// TODO: Remove code related to deprecated `safari10` field.
|
|
50
|
-
BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
|
|
27
|
+
const scriptElm = BUILD.scriptDataOpts
|
|
51
28
|
? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
|
|
52
29
|
s.getAttribute('data-rindo-namespace') === NAMESPACE)
|
|
53
30
|
: null;
|
|
54
31
|
const importMeta = import.meta.url;
|
|
55
32
|
const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};
|
|
56
|
-
|
|
57
|
-
if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
|
|
58
|
-
// Safari < v11 support: This IF is true if it's Safari below v11.
|
|
59
|
-
// This fn cannot use async/await since Safari didn't support it until v11,
|
|
60
|
-
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
|
|
61
|
-
// so both the ESM file and nomodule file would get downloaded. Only Safari
|
|
62
|
-
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
|
|
63
|
-
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
|
|
64
|
-
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
|
|
65
|
-
return {
|
|
66
|
-
then() {
|
|
67
|
-
/* promise noop */
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// TODO: Remove code related to deprecated `safari10` field.
|
|
72
|
-
if (!BUILD.safari10 && importMeta !== '') {
|
|
33
|
+
if (importMeta !== '') {
|
|
73
34
|
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
74
|
-
// TODO: Remove code related to the dynamic import shim
|
|
75
|
-
// TODO: Remove code related to deprecated `safari10` field.
|
|
76
|
-
}
|
|
77
|
-
else if (BUILD.dynamicImportShim || BUILD.safari10) {
|
|
78
|
-
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
|
|
79
|
-
// TODO: Remove code related to the dynamic import shim
|
|
80
|
-
if (BUILD.dynamicImportShim) {
|
|
81
|
-
patchDynamicImport(opts.resourcesUrl, scriptElm);
|
|
82
|
-
}
|
|
83
|
-
// TODO: Remove code related to the dynamic import shim
|
|
84
|
-
if (BUILD.dynamicImportShim && !win.customElements) {
|
|
85
|
-
// module support, but no custom elements support (Old Edge)
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
return import(/* webpackChunkName: "polyfills-dom" */ './dom.js').then(() => opts);
|
|
88
|
-
}
|
|
89
35
|
}
|
|
90
36
|
return promiseResolve(opts);
|
|
91
37
|
};
|
|
92
|
-
// TODO: Remove code related to the dynamic import shim
|
|
93
|
-
const patchDynamicImport = (base, orgScriptElm) => {
|
|
94
|
-
const importFunctionName = getDynamicImportFunction(NAMESPACE);
|
|
95
|
-
try {
|
|
96
|
-
// test if this browser supports dynamic imports
|
|
97
|
-
// There is a caching issue in V8, that breaks using import() in Function
|
|
98
|
-
// By generating a random string, we can workaround it
|
|
99
|
-
// Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
|
|
100
|
-
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
// this shim is specifically for browsers that do support "esm" imports
|
|
104
|
-
// however, they do NOT support "dynamic" imports
|
|
105
|
-
// basically this code is for old Edge, v18 and below
|
|
106
|
-
const moduleMap = new Map();
|
|
107
|
-
win[importFunctionName] = (src) => {
|
|
108
|
-
var _a;
|
|
109
|
-
const url = new URL(src, base).href;
|
|
110
|
-
let mod = moduleMap.get(url);
|
|
111
|
-
if (!mod) {
|
|
112
|
-
const script = doc.createElement('script');
|
|
113
|
-
script.type = 'module';
|
|
114
|
-
script.crossOrigin = orgScriptElm.crossOrigin;
|
|
115
|
-
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
|
|
116
|
-
type: 'application/javascript',
|
|
117
|
-
}));
|
|
118
|
-
// Apply CSP nonce to the script tag if it exists
|
|
119
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
120
|
-
if (nonce != null) {
|
|
121
|
-
script.setAttribute('nonce', nonce);
|
|
122
|
-
}
|
|
123
|
-
mod = new Promise((resolve) => {
|
|
124
|
-
script.onload = () => {
|
|
125
|
-
resolve(win[importFunctionName].m);
|
|
126
|
-
script.remove();
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
moduleMap.set(url, mod);
|
|
130
|
-
doc.head.appendChild(script);
|
|
131
|
-
}
|
|
132
|
-
return mod;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
38
|
const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
137
39
|
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
138
40
|
HTMLElementPrototype.cloneNode = function (deep) {
|
|
@@ -320,31 +320,26 @@ const createTime = (e, t = "") => {
|
|
|
320
320
|
}, rootAppliedStyles = new WeakMap, registerStyle = (e, t, o) => {
|
|
321
321
|
let n = styles.get(e);
|
|
322
322
|
n = t, styles.set(e, n);
|
|
323
|
-
}, addStyle = (e, t, o
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
if (e = 11 === e.nodeType ? e : doc, a) if ("string" == typeof a) {
|
|
323
|
+
}, addStyle = (e, t, o) => {
|
|
324
|
+
var n;
|
|
325
|
+
const s = getScopeId(t, o), l = styles.get(s);
|
|
326
|
+
if (!BUILD.attachStyles) return s;
|
|
327
|
+
if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
|
|
329
328
|
e = e.head || e;
|
|
330
|
-
let
|
|
331
|
-
if (
|
|
332
|
-
if (BUILD.hydrateClientSide && e.host && (
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
} else o = doc.createElement("style"), o.innerHTML = a;
|
|
338
|
-
const i = null !== (s = plt.$nonce$) && void 0 !== s ? s : queryNonceMetaTagContent(doc);
|
|
339
|
-
null != i && o.setAttribute("nonce", i), (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) && o.setAttribute("sty-id", l),
|
|
340
|
-
e.insertBefore(o, e.querySelector("link"));
|
|
329
|
+
let t, o = rootAppliedStyles.get(e);
|
|
330
|
+
if (o || rootAppliedStyles.set(e, o = new Set), !o.has(s)) {
|
|
331
|
+
if (BUILD.hydrateClientSide && e.host && (t = e.querySelector(`[sty-id="${s}"]`))) t.innerHTML = l; else {
|
|
332
|
+
t = doc.createElement("style"), t.innerHTML = l;
|
|
333
|
+
const o = null !== (n = plt.$nonce$) && void 0 !== n ? n : queryNonceMetaTagContent(doc);
|
|
334
|
+
null != o && t.setAttribute("nonce", o), (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) && t.setAttribute("sty-id", s),
|
|
335
|
+
e.insertBefore(t, e.querySelector("link"));
|
|
341
336
|
}
|
|
342
|
-
|
|
337
|
+
o && o.add(s);
|
|
343
338
|
}
|
|
344
|
-
} else BUILD.constructableCSS && !e.adoptedStyleSheets.includes(
|
|
345
|
-
return
|
|
339
|
+
} else BUILD.constructableCSS && !e.adoptedStyleSheets.includes(l) && (e.adoptedStyleSheets = [ ...e.adoptedStyleSheets, l ]);
|
|
340
|
+
return s;
|
|
346
341
|
}, attachStyles = e => {
|
|
347
|
-
const t = e.$cmpMeta$, o = e.$hostElement$, n = t.$flags$, s = createTime("attachStyles", t.$tagName$), l = addStyle(BUILD.shadowDom && supportsShadow && o.shadowRoot ? o.shadowRoot : o.getRootNode(), t, e.$modeName
|
|
342
|
+
const t = e.$cmpMeta$, o = e.$hostElement$, n = t.$flags$, s = createTime("attachStyles", t.$tagName$), l = addStyle(BUILD.shadowDom && supportsShadow && o.shadowRoot ? o.shadowRoot : o.getRootNode(), t, e.$modeName$);
|
|
348
343
|
(BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && 10 & n && (o["s-sc"] = l,
|
|
349
344
|
o.classList.add(l + "-h"), BUILD.scoped && 2 & n && o.classList.add(l + "-s")),
|
|
350
345
|
s();
|
|
@@ -528,7 +523,7 @@ const createElm = (e, t, o, n) => {
|
|
|
528
523
|
BUILD.style && o && attachStyles(e);
|
|
529
524
|
const r = createTime("render", e.$cmpMeta$.$tagName$);
|
|
530
525
|
if (BUILD.isDev && (e.$flags$ |= 1024), BUILD.hydrateServerSide ? await callRender(e, t, s) : callRender(e, t, s),
|
|
531
|
-
BUILD.
|
|
526
|
+
BUILD.isDev && (e.$renderCount$ = void 0 === e.$renderCount$ ? 1 : e.$renderCount$ + 1,
|
|
532
527
|
e.$flags$ &= -1025), BUILD.hydrateServerSide) try {
|
|
533
528
|
serverSideConnected(s), o && (1 & e.$cmpMeta$.$flags$ ? s["s-en"] = "" : 2 & e.$cmpMeta$.$flags$ && (s["s-en"] = "c"));
|
|
534
529
|
} catch (e) {
|
|
@@ -749,7 +744,7 @@ const callRender = (e, t, o) => {
|
|
|
749
744
|
if (0 == (1 & plt.$flags$)) {
|
|
750
745
|
const t = getHostRef(e), o = BUILD.lazyLoad ? t.$lazyInstance$ : e;
|
|
751
746
|
BUILD.hostListener && t.$rmListeners$ && (t.$rmListeners$.map((e => e())), t.$rmListeners$ = void 0),
|
|
752
|
-
BUILD.
|
|
747
|
+
BUILD.lazyLoad && BUILD.disconnectedCallback && safeCall(o, "disconnectedCallback"),
|
|
753
748
|
BUILD.cmpDidUnload && safeCall(o, "componentDidUnload");
|
|
754
749
|
}
|
|
755
750
|
}, defineCustomElement = (e, t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/hydrate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "Rindo internal hydrate platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
package/internal/package.json
CHANGED
|
@@ -115,17 +115,14 @@ export interface BuildConditionals extends Partial<BuildFeatures> {
|
|
|
115
115
|
cssAnnotations?: boolean;
|
|
116
116
|
lazyLoad?: boolean;
|
|
117
117
|
profile?: boolean;
|
|
118
|
-
cssVarShim?: boolean;
|
|
119
118
|
constructableCSS?: boolean;
|
|
120
119
|
appendChildSlotFix?: boolean;
|
|
121
120
|
slotChildNodesFix?: boolean;
|
|
122
121
|
scopedSlotTextContentFix?: boolean;
|
|
123
122
|
cloneNodeFix?: boolean;
|
|
124
|
-
dynamicImportShim?: boolean;
|
|
125
123
|
hydratedAttribute?: boolean;
|
|
126
124
|
hydratedClass?: boolean;
|
|
127
125
|
initializeNextTick?: boolean;
|
|
128
|
-
safari10?: boolean;
|
|
129
126
|
scriptDataOpts?: boolean;
|
|
130
127
|
shadowDomShim?: boolean;
|
|
131
128
|
asyncQueue?: boolean;
|
|
@@ -933,15 +930,6 @@ export interface HostRuleHeader {
|
|
|
933
930
|
name?: string;
|
|
934
931
|
value?: string;
|
|
935
932
|
}
|
|
936
|
-
export interface CssVarShim {
|
|
937
|
-
i(): Promise<any>;
|
|
938
|
-
addLink(linkEl: HTMLLinkElement): Promise<any>;
|
|
939
|
-
addGlobalStyle(styleEl: HTMLStyleElement): void;
|
|
940
|
-
createHostStyle(hostEl: HTMLElement, templateName: string, cssText: string, isScoped: boolean): HTMLStyleElement;
|
|
941
|
-
removeHost(hostEl: HTMLElement): void;
|
|
942
|
-
updateHost(hostEl: HTMLElement): void;
|
|
943
|
-
updateGlobal(): void;
|
|
944
|
-
}
|
|
945
933
|
export interface DevClientWindow extends Window {
|
|
946
934
|
['s-dev-server']: boolean;
|
|
947
935
|
['s-initial-load']: boolean;
|
|
@@ -1486,7 +1474,6 @@ export interface HostRef {
|
|
|
1486
1474
|
$renderCount$?: number;
|
|
1487
1475
|
}
|
|
1488
1476
|
export interface PlatformRuntime {
|
|
1489
|
-
$cssShim$?: CssVarShim;
|
|
1490
1477
|
$flags$: number;
|
|
1491
1478
|
$orgLocNodes$?: Map<string, RenderNode>;
|
|
1492
1479
|
$resourcesUrl$: string;
|
|
@@ -252,21 +252,6 @@ export interface ConfigExtras {
|
|
|
252
252
|
* simulating shadow dom. Defaults to `false`.
|
|
253
253
|
*/
|
|
254
254
|
cloneNodeFix?: boolean;
|
|
255
|
-
/**
|
|
256
|
-
* Include the CSS Custom Property polyfill/shim for legacy browsers. ESM builds will
|
|
257
|
-
* not include the css vars shim. Defaults to `false`
|
|
258
|
-
*
|
|
259
|
-
* @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
|
|
260
|
-
* versions are no longer supported.
|
|
261
|
-
*/
|
|
262
|
-
__deprecated__cssVarsShim?: boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Dynamic `import()` shim. This is only needed for Edge 18 and below, and
|
|
265
|
-
* Firefox 67 and below. Defaults to `false`.
|
|
266
|
-
* @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
|
|
267
|
-
* versions are no longer supported.
|
|
268
|
-
*/
|
|
269
|
-
__deprecated__dynamicImportShim?: boolean;
|
|
270
255
|
/**
|
|
271
256
|
* Experimental flag. Projects that use a Rindo library built using the `dist` output target may have trouble lazily
|
|
272
257
|
* loading components when using a bundler such as Wite or Parcel. Setting this flag to `true` will change how Rindo
|
|
@@ -287,15 +272,6 @@ export interface ConfigExtras {
|
|
|
287
272
|
* Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
|
|
288
273
|
*/
|
|
289
274
|
lifecycleDOMEvents?: boolean;
|
|
290
|
-
/**
|
|
291
|
-
* Safari 10 supports ES modules with `<script type="module">`, however, it did not implement
|
|
292
|
-
* `<script nomodule>`. When set to `true`, the runtime will patch support for Safari 10
|
|
293
|
-
* due to its lack of `nomodule` support.
|
|
294
|
-
* Defaults to `false`.
|
|
295
|
-
*
|
|
296
|
-
* @deprecated Since Rindo v3.0.0, Safari 10 is no longer supported.
|
|
297
|
-
*/
|
|
298
|
-
__deprecated__safari10?: boolean;
|
|
299
275
|
/**
|
|
300
276
|
* It is possible to assign data to the actual `<script>` element's `data-opts` property,
|
|
301
277
|
* which then gets passed to Rindo's initial bootstrap. This feature is only required
|
|
@@ -221,31 +221,26 @@ const createTime = (e, t = "") => {
|
|
|
221
221
|
}, rootAppliedStyles = new WeakMap, registerStyle = (e, t, a) => {
|
|
222
222
|
let o = styles.get(e);
|
|
223
223
|
o = t, styles.set(e, o);
|
|
224
|
-
}, addStyle = (e, t, a
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (
|
|
229
|
-
if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
|
|
224
|
+
}, addStyle = (e, t, a) => {
|
|
225
|
+
var o;
|
|
226
|
+
const s = getScopeId(t, a), n = styles.get(s);
|
|
227
|
+
if (!appData.BUILD.attachStyles) return s;
|
|
228
|
+
if (e = 11 === e.nodeType ? e : doc, n) if ("string" == typeof n) {
|
|
230
229
|
e = e.head || e;
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
if (appData.BUILD.hydrateClientSide && e.host && (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
} else a = doc.createElement("style"), a.innerHTML = l;
|
|
239
|
-
const p = null !== (s = plt.$nonce$) && void 0 !== s ? s : queryNonceMetaTagContent(doc);
|
|
240
|
-
null != p && a.setAttribute("nonce", p), (appData.BUILD.hydrateServerSide || appData.BUILD.hotModuleReplacement) && a.setAttribute("sty-id", n),
|
|
241
|
-
e.insertBefore(a, e.querySelector("link"));
|
|
230
|
+
let t, a = rootAppliedStyles.get(e);
|
|
231
|
+
if (a || rootAppliedStyles.set(e, a = new Set), !a.has(s)) {
|
|
232
|
+
if (appData.BUILD.hydrateClientSide && e.host && (t = e.querySelector(`[sty-id="${s}"]`))) t.innerHTML = n; else {
|
|
233
|
+
t = doc.createElement("style"), t.innerHTML = n;
|
|
234
|
+
const a = null !== (o = plt.$nonce$) && void 0 !== o ? o : queryNonceMetaTagContent(doc);
|
|
235
|
+
null != a && t.setAttribute("nonce", a), (appData.BUILD.hydrateServerSide || appData.BUILD.hotModuleReplacement) && t.setAttribute("sty-id", s),
|
|
236
|
+
e.insertBefore(t, e.querySelector("link"));
|
|
242
237
|
}
|
|
243
|
-
|
|
238
|
+
a && a.add(s);
|
|
244
239
|
}
|
|
245
|
-
} else appData.BUILD.constructableCSS && !e.adoptedStyleSheets.includes(
|
|
246
|
-
return
|
|
240
|
+
} else appData.BUILD.constructableCSS && !e.adoptedStyleSheets.includes(n) && (e.adoptedStyleSheets = [ ...e.adoptedStyleSheets, n ]);
|
|
241
|
+
return s;
|
|
247
242
|
}, attachStyles = e => {
|
|
248
|
-
const t = e.$cmpMeta$, a = e.$hostElement$, o = t.$flags$, s = createTime("attachStyles", t.$tagName$), n = addStyle(appData.BUILD.shadowDom && exports.supportsShadow && a.shadowRoot ? a.shadowRoot : a.getRootNode(), t, e.$modeName
|
|
243
|
+
const t = e.$cmpMeta$, a = e.$hostElement$, o = t.$flags$, s = createTime("attachStyles", t.$tagName$), n = addStyle(appData.BUILD.shadowDom && exports.supportsShadow && a.shadowRoot ? a.shadowRoot : a.getRootNode(), t, e.$modeName$);
|
|
249
244
|
(appData.BUILD.shadowDom || appData.BUILD.scoped) && appData.BUILD.cssAnnotations && 10 & o && (a["s-sc"] = n,
|
|
250
245
|
a.classList.add(n + "-h"), appData.BUILD.scoped && 2 & o && a.classList.add(n + "-s")),
|
|
251
246
|
s();
|
|
@@ -433,7 +428,7 @@ const createElm = (e, t, a, o) => {
|
|
|
433
428
|
appData.BUILD.style && a && attachStyles(e);
|
|
434
429
|
const r = createTime("render", e.$cmpMeta$.$tagName$);
|
|
435
430
|
if (appData.BUILD.isDev && (e.$flags$ |= 1024), appData.BUILD.hydrateServerSide ? await callRender(e, t, s) : callRender(e, t, s),
|
|
436
|
-
appData.BUILD.
|
|
431
|
+
appData.BUILD.isDev && (e.$renderCount$ = void 0 === e.$renderCount$ ? 1 : e.$renderCount$ + 1,
|
|
437
432
|
e.$flags$ &= -1025), appData.BUILD.hydrateServerSide) try {
|
|
438
433
|
serverSideConnected(s), a && (1 & e.$cmpMeta$.$flags$ ? s["s-en"] = "" : 2 & e.$cmpMeta$.$flags$ && (s["s-en"] = "c"));
|
|
439
434
|
} catch (e) {
|
|
@@ -658,8 +653,7 @@ const callRender = (e, t, a) => {
|
|
|
658
653
|
if (0 == (1 & plt.$flags$)) {
|
|
659
654
|
const t = getHostRef(e), a = appData.BUILD.lazyLoad ? t.$lazyInstance$ : e;
|
|
660
655
|
appData.BUILD.hostListener && t.$rmListeners$ && (t.$rmListeners$.map((e => e())),
|
|
661
|
-
t.$rmListeners$ = void 0), appData.BUILD.
|
|
662
|
-
appData.BUILD.lazyLoad && appData.BUILD.disconnectedCallback && safeCall(a, "disconnectedCallback"),
|
|
656
|
+
t.$rmListeners$ = void 0), appData.BUILD.lazyLoad && appData.BUILD.disconnectedCallback && safeCall(a, "disconnectedCallback"),
|
|
663
657
|
appData.BUILD.cmpDidUnload && safeCall(a, "componentDidUnload");
|
|
664
658
|
}
|
|
665
659
|
}, proxyCustomElement = (e, t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "Rindo internal testing platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
package/mock-doc/index.cjs
CHANGED
package/mock-doc/index.js
CHANGED
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
111
111
|
"semver": "^7.3.7",
|
|
112
112
|
"sizzle": "^2.3.6",
|
|
113
|
-
"terser": "5.17.
|
|
113
|
+
"terser": "5.17.6",
|
|
114
114
|
"typescript": "~5.0.4",
|
|
115
115
|
"webpack": "^5.75.0",
|
|
116
116
|
"ws": "8.13.0"
|
package/screenshot/package.json
CHANGED
package/sys/node/index.js
CHANGED
package/sys/node/package.json
CHANGED
package/sys/node/worker.js
CHANGED
package/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Testing
|
|
2
|
+
Rindo Testing v4.0.0-beta.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
function _lazyRequire(e) {
|
|
5
5
|
return new Proxy({}, {
|
|
@@ -59,9 +59,9 @@ async function startPuppeteerBrowser(e) {
|
|
|
59
59
|
console.error(`An error occurred determining the version of Puppeteer installed:\n${e}`),
|
|
60
60
|
t.__RINDO_PUPPETEER_VERSION__ = void 0;
|
|
61
61
|
}
|
|
62
|
-
t.__RINDO_BROWSER_WAIT_UNTIL = e.testing.browserWaitUntil, e.flags.devtools && (
|
|
63
|
-
e.
|
|
64
|
-
|
|
62
|
+
t.__RINDO_BROWSER_WAIT_UNTIL = e.testing.browserWaitUntil, e.flags.devtools && (t.__RINDO_E2E_DEVTOOLS__ = "true"),
|
|
63
|
+
e.logger.debug(`puppeteer: ${s}`), e.logger.debug(`puppeteer headless: ${e.testing.browserHeadless}`),
|
|
64
|
+
Array.isArray(e.testing.browserArgs) && e.logger.debug(`puppeteer args: ${e.testing.browserArgs.join(" ")}`),
|
|
65
65
|
"boolean" == typeof e.testing.browserDevtools && e.logger.debug(`puppeteer devtools: ${e.testing.browserDevtools}`),
|
|
66
66
|
"number" == typeof e.testing.browserSlowMo && e.logger.debug(`puppeteer slowMo: ${e.testing.browserSlowMo}`);
|
|
67
67
|
const i = {
|
|
@@ -372,8 +372,8 @@ function resetBuildConditionals(e) {
|
|
|
372
372
|
e.vdomText = !0, e.vdomXlink = !0, e.allRenderFn = !1, e.devTools = !1, e.hydrateClientSide = !1,
|
|
373
373
|
e.hydrateServerSide = !1, e.cssAnnotations = !1, e.style = !1, e.hydratedAttribute = !1,
|
|
374
374
|
e.hydratedClass = !0, e.invisiblePrehydration = !0, e.appendChildSlotFix = !1, e.cloneNodeFix = !1,
|
|
375
|
-
e.
|
|
376
|
-
e.
|
|
375
|
+
e.hotModuleReplacement = !1, e.scriptDataOpts = !1, e.scopedSlotTextContentFix = !1,
|
|
376
|
+
e.slotChildNodesFix = !1;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
function removeDomNodes(e) {
|
|
@@ -3176,7 +3176,7 @@ const COMMON_DIR_MODULE_EXTS = [ ".tsx", ".ts", ".mjs", ".js", ".jsx", ".json",
|
|
|
3176
3176
|
d("/");
|
|
3177
3177
|
const D = {
|
|
3178
3178
|
name: "in-memory",
|
|
3179
|
-
version: "
|
|
3179
|
+
version: "4.0.0-beta.0",
|
|
3180
3180
|
events: a,
|
|
3181
3181
|
access: async e => u(e),
|
|
3182
3182
|
accessSync: u,
|
|
@@ -4337,7 +4337,7 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
4337
4337
|
})), appData.BUILD.asyncLoading = !0, e.hydrateClientSide ? (appData.BUILD.hydrateClientSide = !0,
|
|
4338
4338
|
appData.BUILD.hydrateServerSide = !1) : e.hydrateServerSide && (appData.BUILD.hydrateServerSide = !0,
|
|
4339
4339
|
appData.BUILD.hydrateClientSide = !1), appData.BUILD.cloneNodeFix = !1, appData.BUILD.shadowDomShim = !1,
|
|
4340
|
-
appData.BUILD.
|
|
4340
|
+
appData.BUILD.attachStyles = !!e.attachStyles, "string" == typeof e.url && (n.win.location.href = e.url),
|
|
4341
4341
|
"string" == typeof e.direction && n.doc.documentElement.setAttribute("dir", e.direction),
|
|
4342
4342
|
"string" == typeof e.language && n.doc.documentElement.setAttribute("lang", e.language),
|
|
4343
4343
|
"string" == typeof e.cookie) try {
|
package/testing/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Rindo Client Patch Esm v3.3.0 | MIT Licensed | https://rindojs.web.app
|
|
3
|
-
*/
|
|
4
|
-
var __assign=undefined&&undefined.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector="";};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r);}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE;}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return "\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@",VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return {start:s,end:s+n[0].length}}return null}function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return {start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t);}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else {if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s);}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value;}));}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0);})),!t)return "break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return [];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t});})),t++;})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o});}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement;}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors);})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return ":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return {original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return !1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t));}));}function reScope(e,t){var r=e.template.map((function(r){return "string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t);}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t);})).observe(document.head,{childList:!0});}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove();}})).catch((function(e){console.error(e);}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1;}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}));}));})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal();}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal();},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e);},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n);}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes);},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document));}("undefined"!=typeof window&&window);
|