defuss 3.4.8 → 3.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom-BMM8gF0l.cjs +2691 -0
- package/dist/dom-nGC6cuXP.mjs +2617 -0
- package/dist/index-D5JUP0KJ.d.ts +1339 -0
- package/dist/index.cjs +23 -16
- package/dist/index.mjs +24 -17
- package/dist/mount-BN642QJz.cjs +29 -0
- package/dist/mount-CN-P1rpv.mjs +26 -0
- package/package.json +9 -4
package/dist/index.cjs
CHANGED
|
@@ -52,25 +52,32 @@ const Reactive = ({
|
|
|
52
52
|
cleanup,
|
|
53
53
|
tag = "div",
|
|
54
54
|
className,
|
|
55
|
-
ref
|
|
55
|
+
ref: externalRef,
|
|
56
56
|
...props
|
|
57
57
|
}) => {
|
|
58
|
-
const reactiveRef =
|
|
58
|
+
const reactiveRef = externalRef ?? dom.createRef();
|
|
59
59
|
let cleanupFn;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
let isUnmounted = false;
|
|
61
|
+
const attrs = {
|
|
62
|
+
ref: reactiveRef
|
|
63
|
+
};
|
|
64
|
+
if (className) {
|
|
65
|
+
attrs.class = className;
|
|
66
|
+
}
|
|
67
|
+
Object.assign(attrs, props);
|
|
68
|
+
attrs.onMount = () => {
|
|
69
|
+
cleanupFn = dom.reactive({ store, render, cleanup }, reactiveRef);
|
|
70
|
+
};
|
|
71
|
+
attrs.onUnmount = () => {
|
|
72
|
+
if (isUnmounted) return;
|
|
73
|
+
isUnmounted = true;
|
|
74
|
+
cleanupFn?.();
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
type: tag,
|
|
78
|
+
attributes: attrs,
|
|
79
|
+
children: []
|
|
80
|
+
};
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
const VARIABLE_REGEX = /{([^}]*)}/g;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as createRef,
|
|
1
|
+
import { m as createRef, a0 as reactive, n as createStore, P as jsx, $, N as isRef } from './dom-_OdBXxSy.mjs';
|
|
2
2
|
export { C as CAPTURE_ONLY_EVENTS, a as CLASS_ATTRIBUTE_NAME, b as CallChainImpl, D as DANGEROUSLY_SET_INNER_HTML_ATTRIBUTE, c as DEFAULT_TRANSITION_CONFIG, F as Fragment, R as REF_ATTRIBUTE_NAME, X as XLINK_ATTRIBUTE_NAME, d as XMLNS_ATTRIBUTE_NAME, e as addElementEvent, f as applyStyles, g as areDomNodesEqual, h as checkElementVisibility, i as clearDelegatedEvents, j as clearDelegatedEventsDeep, k as clearElementEvents, l as createInPlaceErrorMessageVNode, o as deepEquals, p as dequery, q as domNodeToVNode, r as emptyImpl, s as getAllFormValues, t as getComponentInstance, u as getDefaultDequeryOptions, v as getEventMap, w as getMimeType, x as getRegisteredEventKeys, y as getRegisteredEventTypes, z as getRenderer, A as getTransitionStyles, B as globalScopeDomApis, E as handleLifecycleEventsForOnMount, G as htmlStringToVNodes, H as isComponentRoot, I as isDequery, J as isDequeryOptionsObject, K as isHTML, L as isJSX, M as isMarkup, O as isSVG, Q as jsxDEV, S as jsxs, T as nsMap, U as observeUnmount, V as parseDOM, W as parseEventPropName, Y as performTransition, Z as processAllFormElements, _ as queueCallback, a1 as registerComponent, a2 as registerDelegatedEvent, a3 as removeDelegatedEvent, a4 as removeDelegatedEventByKey, a5 as removeElementEvent, a6 as render, a7 as renderInto, a8 as renderIsomorphicAsync, a9 as renderIsomorphicSync, aa as renderMarkup, ab as replaceDomWithVdom, ac as scrollHelper, ad as shallowEquals, ae as unregisterComponent, af as updateDom, ag as updateDomWithVdom, ah as waitForDOM, ai as webstorage } from './dom-_OdBXxSy.mjs';
|
|
3
3
|
export { m as mount, u as unmount } from './mount-BcFWqQDc.mjs';
|
|
4
4
|
import 'defuss-runtime';
|
|
@@ -51,25 +51,32 @@ const Reactive = ({
|
|
|
51
51
|
cleanup,
|
|
52
52
|
tag = "div",
|
|
53
53
|
className,
|
|
54
|
-
ref
|
|
54
|
+
ref: externalRef,
|
|
55
55
|
...props
|
|
56
56
|
}) => {
|
|
57
|
-
const reactiveRef =
|
|
57
|
+
const reactiveRef = externalRef ?? createRef();
|
|
58
58
|
let cleanupFn;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
let isUnmounted = false;
|
|
60
|
+
const attrs = {
|
|
61
|
+
ref: reactiveRef
|
|
62
|
+
};
|
|
63
|
+
if (className) {
|
|
64
|
+
attrs.class = className;
|
|
65
|
+
}
|
|
66
|
+
Object.assign(attrs, props);
|
|
67
|
+
attrs.onMount = () => {
|
|
68
|
+
cleanupFn = reactive({ store, render, cleanup }, reactiveRef);
|
|
69
|
+
};
|
|
70
|
+
attrs.onUnmount = () => {
|
|
71
|
+
if (isUnmounted) return;
|
|
72
|
+
isUnmounted = true;
|
|
73
|
+
cleanupFn?.();
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
type: tag,
|
|
77
|
+
attributes: attrs,
|
|
78
|
+
children: []
|
|
79
|
+
};
|
|
73
80
|
};
|
|
74
81
|
|
|
75
82
|
const VARIABLE_REGEX = /{([^}]*)}/g;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dom = require('./dom-BMM8gF0l.cjs');
|
|
4
|
+
|
|
5
|
+
function mount(container, Component, initialProps) {
|
|
6
|
+
while (container.firstChild) {
|
|
7
|
+
container.removeChild(container.firstChild);
|
|
8
|
+
}
|
|
9
|
+
const vnode = Component(initialProps);
|
|
10
|
+
dom.renderIsomorphicSync(vnode, container, globalThis);
|
|
11
|
+
dom.registerComponent(
|
|
12
|
+
container,
|
|
13
|
+
Component,
|
|
14
|
+
{ ...initialProps }
|
|
15
|
+
);
|
|
16
|
+
if (container.parentNode) {
|
|
17
|
+
dom.observeUnmount(container, () => dom.unregisterComponent(container));
|
|
18
|
+
}
|
|
19
|
+
return container;
|
|
20
|
+
}
|
|
21
|
+
function unmount(container) {
|
|
22
|
+
dom.unregisterComponent(container);
|
|
23
|
+
while (container.firstChild) {
|
|
24
|
+
container.removeChild(container.firstChild);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.mount = mount;
|
|
29
|
+
exports.unmount = unmount;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a9 as renderIsomorphicSync, a1 as registerComponent, U as observeUnmount, ae as unregisterComponent } from './dom-nGC6cuXP.mjs';
|
|
2
|
+
|
|
3
|
+
function mount(container, Component, initialProps) {
|
|
4
|
+
while (container.firstChild) {
|
|
5
|
+
container.removeChild(container.firstChild);
|
|
6
|
+
}
|
|
7
|
+
const vnode = Component(initialProps);
|
|
8
|
+
renderIsomorphicSync(vnode, container, globalThis);
|
|
9
|
+
registerComponent(
|
|
10
|
+
container,
|
|
11
|
+
Component,
|
|
12
|
+
{ ...initialProps }
|
|
13
|
+
);
|
|
14
|
+
if (container.parentNode) {
|
|
15
|
+
observeUnmount(container, () => unregisterComponent(container));
|
|
16
|
+
}
|
|
17
|
+
return container;
|
|
18
|
+
}
|
|
19
|
+
function unmount(container) {
|
|
20
|
+
unregisterComponent(container);
|
|
21
|
+
while (container.firstChild) {
|
|
22
|
+
container.removeChild(container.firstChild);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { mount as m, unmount as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "defuss",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -43,13 +43,18 @@
|
|
|
43
43
|
"pretest": "bun run build",
|
|
44
44
|
"test:watch": "vitest --coverage",
|
|
45
45
|
"test": "vitest run --coverage",
|
|
46
|
+
"pretest:browser": "bunx playwright install chromium",
|
|
46
47
|
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
48
|
+
"prebench:chromium": "bunx playwright install chromium",
|
|
47
49
|
"kitchensink": "vitest run --config kitchensink/vitest.config.ts",
|
|
48
|
-
"bench": "vitest bench --config vitest.bench.config.ts",
|
|
49
|
-
"bench:browser": "vitest run --config vitest.browser.config.ts src/__benchmarks__/dom-benchmark.browser.test.tsx",
|
|
50
|
+
"bench": "vitest bench --run --config vitest.bench.config.ts",
|
|
51
|
+
"bench:browser": "vitest run --config vitest.bench-browser.config.ts src/__benchmarks__/dom-benchmark.browser.test.tsx",
|
|
52
|
+
"bench:ssr": "vitest run --config vitest.bench-browser.config.ts src/__benchmarks__/dom-benchmark.ssr.test.tsx",
|
|
53
|
+
"bench:chromium": "vitest run --config vitest.bench-chromium.config.ts src/__benchmarks__/dom-benchmark.browser.test.tsx",
|
|
54
|
+
"test:all": "bun run test && bun run test:browser && bun run bench && bun run bench:browser && bun run bench:ssr && bun run bench:chromium",
|
|
50
55
|
"prebuild": "bun run clean",
|
|
51
56
|
"build": "node scripts/build.mjs",
|
|
52
|
-
"prepublishOnly": "bun run build"
|
|
57
|
+
"prepublishOnly": "bun run build && bun run test:all"
|
|
53
58
|
},
|
|
54
59
|
"author": "Aron Homberg <info@aron-homberg.de>",
|
|
55
60
|
"sideEffects": false,
|