@pyreon/runtime-dom 0.12.10 → 0.12.12
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/lib/analysis/index.js.html +1 -1
- package/lib/index.js +34 -9
- package/lib/index.js.map +1 -1
- package/lib/types/index.d.ts +15 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/hydration-debug.ts +4 -1
- package/src/index.ts +5 -2
- package/src/mount.ts +9 -3
- package/src/nodes.ts +10 -6
- package/src/props.ts +17 -1
- package/src/template.ts +29 -1
- package/src/tests/coverage-gaps.test.ts +10 -7
- package/src/tests/mount.test.ts +69 -0
- package/src/tests/template.test.ts +55 -0
- package/src/transition.ts +7 -1
|
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
|
|
|
5386
5386
|
</script>
|
|
5387
5387
|
<script>
|
|
5388
5388
|
/*<!--*/
|
|
5389
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"
|
|
5389
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"da7828a2-1","name":"delegate.ts"},{"uid":"da7828a2-3","name":"hydration-debug.ts"},{"uid":"da7828a2-5","name":"devtools.ts"},{"uid":"da7828a2-7","name":"nodes.ts"},{"uid":"da7828a2-9","name":"props.ts"},{"uid":"da7828a2-11","name":"mount.ts"},{"uid":"da7828a2-13","name":"hydrate.ts"},{"uid":"da7828a2-15","name":"keep-alive.ts"},{"uid":"da7828a2-17","name":"template.ts"},{"uid":"da7828a2-19","name":"transition.ts"},{"uid":"da7828a2-21","name":"transition-group.ts"},{"uid":"da7828a2-23","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"da7828a2-1":{"renderedLength":1990,"gzipLength":976,"brotliLength":0,"metaUid":"da7828a2-0"},"da7828a2-3":{"renderedLength":662,"gzipLength":370,"brotliLength":0,"metaUid":"da7828a2-2"},"da7828a2-5":{"renderedLength":6803,"gzipLength":2095,"brotliLength":0,"metaUid":"da7828a2-4"},"da7828a2-7":{"renderedLength":16207,"gzipLength":4334,"brotliLength":0,"metaUid":"da7828a2-6"},"da7828a2-9":{"renderedLength":6310,"gzipLength":2403,"brotliLength":0,"metaUid":"da7828a2-8"},"da7828a2-11":{"renderedLength":11597,"gzipLength":3709,"brotliLength":0,"metaUid":"da7828a2-10"},"da7828a2-13":{"renderedLength":7694,"gzipLength":2333,"brotliLength":0,"metaUid":"da7828a2-12"},"da7828a2-15":{"renderedLength":1473,"gzipLength":701,"brotliLength":0,"metaUid":"da7828a2-14"},"da7828a2-17":{"renderedLength":5319,"gzipLength":2069,"brotliLength":0,"metaUid":"da7828a2-16"},"da7828a2-19":{"renderedLength":4017,"gzipLength":1311,"brotliLength":0,"metaUid":"da7828a2-18"},"da7828a2-21":{"renderedLength":6362,"gzipLength":1937,"brotliLength":0,"metaUid":"da7828a2-20"},"da7828a2-23":{"renderedLength":769,"gzipLength":474,"brotliLength":0,"metaUid":"da7828a2-22"}},"nodeMetas":{"da7828a2-0":{"id":"/src/delegate.ts","moduleParts":{"index.js":"da7828a2-1"},"imported":[{"uid":"da7828a2-24"}],"importedBy":[{"uid":"da7828a2-22"},{"uid":"da7828a2-12"},{"uid":"da7828a2-8"}]},"da7828a2-2":{"id":"/src/hydration-debug.ts","moduleParts":{"index.js":"da7828a2-3"},"imported":[],"importedBy":[{"uid":"da7828a2-22"},{"uid":"da7828a2-12"}]},"da7828a2-4":{"id":"/src/devtools.ts","moduleParts":{"index.js":"da7828a2-5"},"imported":[],"importedBy":[{"uid":"da7828a2-22"},{"uid":"da7828a2-10"}]},"da7828a2-6":{"id":"/src/nodes.ts","moduleParts":{"index.js":"da7828a2-7"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"}],"importedBy":[{"uid":"da7828a2-12"},{"uid":"da7828a2-10"}]},"da7828a2-8":{"id":"/src/props.ts","moduleParts":{"index.js":"da7828a2-9"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"},{"uid":"da7828a2-0"}],"importedBy":[{"uid":"da7828a2-22"},{"uid":"da7828a2-12"},{"uid":"da7828a2-10"}]},"da7828a2-10":{"id":"/src/mount.ts","moduleParts":{"index.js":"da7828a2-11"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"},{"uid":"da7828a2-4"},{"uid":"da7828a2-6"},{"uid":"da7828a2-8"}],"importedBy":[{"uid":"da7828a2-22"},{"uid":"da7828a2-12"},{"uid":"da7828a2-14"},{"uid":"da7828a2-16"},{"uid":"da7828a2-20"}]},"da7828a2-12":{"id":"/src/hydrate.ts","moduleParts":{"index.js":"da7828a2-13"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"},{"uid":"da7828a2-0"},{"uid":"da7828a2-2"},{"uid":"da7828a2-10"},{"uid":"da7828a2-6"},{"uid":"da7828a2-8"}],"importedBy":[{"uid":"da7828a2-22"}]},"da7828a2-14":{"id":"/src/keep-alive.ts","moduleParts":{"index.js":"da7828a2-15"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"},{"uid":"da7828a2-10"}],"importedBy":[{"uid":"da7828a2-22"}]},"da7828a2-16":{"id":"/src/template.ts","moduleParts":{"index.js":"da7828a2-17"},"imported":[{"uid":"da7828a2-24"},{"uid":"da7828a2-10"}],"importedBy":[{"uid":"da7828a2-22"}]},"da7828a2-18":{"id":"/src/transition.ts","moduleParts":{"index.js":"da7828a2-19"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"}],"importedBy":[{"uid":"da7828a2-22"}]},"da7828a2-20":{"id":"/src/transition-group.ts","moduleParts":{"index.js":"da7828a2-21"},"imported":[{"uid":"da7828a2-25"},{"uid":"da7828a2-24"},{"uid":"da7828a2-10"}],"importedBy":[{"uid":"da7828a2-22"}]},"da7828a2-22":{"id":"/src/index.ts","moduleParts":{"index.js":"da7828a2-23"},"imported":[{"uid":"da7828a2-0"},{"uid":"da7828a2-12"},{"uid":"da7828a2-2"},{"uid":"da7828a2-14"},{"uid":"da7828a2-10"},{"uid":"da7828a2-8"},{"uid":"da7828a2-16"},{"uid":"da7828a2-18"},{"uid":"da7828a2-20"},{"uid":"da7828a2-4"}],"importedBy":[],"isEntry":true},"da7828a2-24":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"da7828a2-0"},{"uid":"da7828a2-12"},{"uid":"da7828a2-14"},{"uid":"da7828a2-10"},{"uid":"da7828a2-8"},{"uid":"da7828a2-16"},{"uid":"da7828a2-18"},{"uid":"da7828a2-20"},{"uid":"da7828a2-6"}]},"da7828a2-25":{"id":"@pyreon/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"da7828a2-12"},{"uid":"da7828a2-14"},{"uid":"da7828a2-10"},{"uid":"da7828a2-8"},{"uid":"da7828a2-18"},{"uid":"da7828a2-20"},{"uid":"da7828a2-6"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
5390
5390
|
|
|
5391
5391
|
const run = () => {
|
|
5392
5392
|
const width = window.innerWidth;
|
package/lib/index.js
CHANGED
|
@@ -77,7 +77,7 @@ function setupDelegation(container) {
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/hydration-debug.ts
|
|
80
|
-
let _enabled =
|
|
80
|
+
let _enabled = import.meta.env?.DEV === true;
|
|
81
81
|
function enableHydrationWarnings() {
|
|
82
82
|
_enabled = true;
|
|
83
83
|
}
|
|
@@ -303,7 +303,7 @@ function installDevTools() {
|
|
|
303
303
|
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/nodes.ts
|
|
306
|
-
const __DEV__$4 =
|
|
306
|
+
const __DEV__$4 = import.meta.env?.DEV === true;
|
|
307
307
|
/**
|
|
308
308
|
* Move all nodes strictly between `start` and `end` into a throwaway
|
|
309
309
|
* DocumentFragment, detaching them from the live DOM in O(n) top-level moves.
|
|
@@ -342,7 +342,6 @@ function mountReactive(accessor, parent, anchor, mount) {
|
|
|
342
342
|
runUntracked(() => currentCleanup());
|
|
343
343
|
currentCleanup = () => {};
|
|
344
344
|
const value = accessor();
|
|
345
|
-
if (__DEV__$4 && typeof value === "function") console.warn("[Pyreon] Reactive accessor returned a function instead of a value. Did you forget to call the signal?");
|
|
346
345
|
if (value != null && value !== false) {
|
|
347
346
|
const cleanup = runUntracked(() => restoreContextStack(contextSnapshot, () => mount(value, parent, marker)));
|
|
348
347
|
if (myGen === generation) currentCleanup = cleanup;
|
|
@@ -814,7 +813,7 @@ function moveEntryBefore(parent, startNode, before) {
|
|
|
814
813
|
|
|
815
814
|
//#endregion
|
|
816
815
|
//#region src/props.ts
|
|
817
|
-
const __DEV__$3 =
|
|
816
|
+
const __DEV__$3 = import.meta.env?.DEV === true;
|
|
818
817
|
let _customSanitizer = null;
|
|
819
818
|
/**
|
|
820
819
|
* Set a custom HTML sanitizer used by `innerHTML` and `sanitizeHtml()`.
|
|
@@ -1058,6 +1057,10 @@ function setStaticProp(el, key, value) {
|
|
|
1058
1057
|
else el.removeAttribute(key);
|
|
1059
1058
|
return;
|
|
1060
1059
|
}
|
|
1060
|
+
if (el.namespaceURI && el.namespaceURI !== "http://www.w3.org/1999/xhtml") {
|
|
1061
|
+
el.setAttribute(key, String(value));
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1061
1064
|
if (key in el) {
|
|
1062
1065
|
el[key] = value;
|
|
1063
1066
|
return;
|
|
@@ -1071,7 +1074,7 @@ function setStaticProp(el, key, value) {
|
|
|
1071
1074
|
|
|
1072
1075
|
//#endregion
|
|
1073
1076
|
//#region src/mount.ts
|
|
1074
|
-
const __DEV__$2 =
|
|
1077
|
+
const __DEV__$2 = import.meta.env?.DEV === true;
|
|
1075
1078
|
const noop$1 = () => {};
|
|
1076
1079
|
let _elementDepth = 0;
|
|
1077
1080
|
const _mountingStack = [];
|
|
@@ -1356,7 +1359,7 @@ function mountComponent(vnode, parent, anchor) {
|
|
|
1356
1359
|
}
|
|
1357
1360
|
if (__DEV__$2 && output != null && typeof output === "object") {
|
|
1358
1361
|
if (output instanceof Promise) console.warn(`[Pyreon] Component <${componentName}> returned a Promise. Components must be synchronous — use lazy() + Suspense for async loading, or fetch data in onMount and store it in a signal.`);
|
|
1359
|
-
else if (!("type" in output)) console.warn(`[Pyreon] Component <${componentName}> returned an invalid value. Components must return a VNode, string, null, or
|
|
1362
|
+
else if (!("type" in output) && !Array.isArray(output) && !output.__isNative) console.warn(`[Pyreon] Component <${componentName}> returned an invalid value. Components must return a VNode, string, null, function, or array.`);
|
|
1360
1363
|
}
|
|
1361
1364
|
for (const fn of hooks.update) scope.addUpdateHook(fn);
|
|
1362
1365
|
let subtreeCleanup = noop$1;
|
|
@@ -1844,10 +1847,32 @@ function _tpl(html, bind) {
|
|
|
1844
1847
|
cleanup: bind(el)
|
|
1845
1848
|
};
|
|
1846
1849
|
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Mount a children slot inside a template.
|
|
1852
|
+
*
|
|
1853
|
+
* Compiler emits this instead of `createTextNode()` when it detects a
|
|
1854
|
+
* children expression (`props.children`, `own.children`). Unlike text nodes,
|
|
1855
|
+
* children can be VNodes, arrays, or reactive accessors — all handled by
|
|
1856
|
+
* `mountChild()`.
|
|
1857
|
+
*
|
|
1858
|
+
* @param children - The children value (VNode, string, array, or accessor)
|
|
1859
|
+
* @param parent - The parent element in the cloned template
|
|
1860
|
+
* @param placeholder - The comment placeholder node to replace
|
|
1861
|
+
* @returns Cleanup function
|
|
1862
|
+
*/
|
|
1863
|
+
function _mountSlot(children, parent, placeholder) {
|
|
1864
|
+
if (children == null || children === false || children === true) {
|
|
1865
|
+
parent.removeChild(placeholder);
|
|
1866
|
+
return null;
|
|
1867
|
+
}
|
|
1868
|
+
const cleanup = mountChild(children, parent, placeholder);
|
|
1869
|
+
parent.removeChild(placeholder);
|
|
1870
|
+
return cleanup;
|
|
1871
|
+
}
|
|
1847
1872
|
|
|
1848
1873
|
//#endregion
|
|
1849
1874
|
//#region src/transition.ts
|
|
1850
|
-
const __DEV__$1 =
|
|
1875
|
+
const __DEV__$1 = import.meta.env?.DEV === true;
|
|
1851
1876
|
/**
|
|
1852
1877
|
* Transition — adds CSS enter/leave animation classes to a single child element,
|
|
1853
1878
|
* controlled by the reactive `show` prop.
|
|
@@ -2178,7 +2203,7 @@ function TransitionGroup(props) {
|
|
|
2178
2203
|
|
|
2179
2204
|
//#endregion
|
|
2180
2205
|
//#region src/index.ts
|
|
2181
|
-
const __DEV__ =
|
|
2206
|
+
const __DEV__ = import.meta.env?.DEV === true;
|
|
2182
2207
|
/**
|
|
2183
2208
|
* Mount a VNode tree into a container element.
|
|
2184
2209
|
* Clears the container first, then mounts the given child.
|
|
@@ -2198,5 +2223,5 @@ function mount(root, container) {
|
|
|
2198
2223
|
const render = mount;
|
|
2199
2224
|
|
|
2200
2225
|
//#endregion
|
|
2201
|
-
export { DELEGATED_EVENTS, KeepAlive, Transition, TransitionGroup, applyProps as _applyProps, applyProps, _bindDirect, _bindText, _tpl, applyProp, createTemplate, delegatedPropName, disableHydrationWarnings, enableHydrationWarnings, hydrateRoot, mount, mountChild, render, sanitizeHtml, setSanitizer, setupDelegation };
|
|
2226
|
+
export { DELEGATED_EVENTS, KeepAlive, Transition, TransitionGroup, applyProps as _applyProps, applyProps, _bindDirect, _bindText, _mountSlot, _tpl, applyProp, createTemplate, delegatedPropName, disableHydrationWarnings, enableHydrationWarnings, hydrateRoot, mount, mountChild, render, sanitizeHtml, setSanitizer, setupDelegation };
|
|
2202
2227
|
//# sourceMappingURL=index.js.map
|