sibujs 4.3.0 → 4.5.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/README.md +34 -4
- package/dist/browser.cjs +31 -2
- package/dist/browser.d.cts +15 -2
- package/dist/browser.d.ts +15 -2
- package/dist/browser.js +4 -4
- package/dist/build.cjs +92 -13
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +400 -0
- package/dist/cdn.full.global.js +398 -0
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-GZYQNIPS.js → chunk-2DCGACUU.js} +16 -9
- package/dist/{chunk-7BPN4MXR.js → chunk-3JZ4L5TJ.js} +10 -4
- package/dist/{chunk-R4EF7V3K.js → chunk-4PMLNECI.js} +4 -4
- package/dist/{chunk-IYHM4FWD.js → chunk-7LN645I6.js} +1 -1
- package/dist/{chunk-RE6KLGMV.js → chunk-B3WHI2QA.js} +1 -1
- package/dist/{chunk-ZVYNIUOG.js → chunk-FTIR4QW2.js} +13 -3
- package/dist/{chunk-G7GPNB6N.js → chunk-GW3SCCZG.js} +4 -4
- package/dist/{chunk-XGCZ45NH.js → chunk-KEISJXBU.js} +2 -2
- package/dist/{chunk-UD6YE2GW.js → chunk-OMJJM3KM.js} +2 -2
- package/dist/{chunk-7UBG6LDP.js → chunk-ONOHFDLG.js} +9 -1
- package/dist/{chunk-7UK6BSAT.js → chunk-PCT43HW3.js} +1 -1
- package/dist/{chunk-VJE6DDYM.js → chunk-R25EFXXC.js} +40 -26
- package/dist/{chunk-3E5YNK2F.js → chunk-RBTPLM32.js} +46 -8
- package/dist/{chunk-7BJLKDBI.js → chunk-RIXRAYIU.js} +1 -1
- package/dist/{chunk-7GQIRV27.js → chunk-RJE2BNI4.js} +3 -3
- package/dist/{chunk-2LSY4WDM.js → chunk-S373NSMK.js} +18 -13
- package/dist/{chunk-AAHT6AKT.js → chunk-TBYTO6BS.js} +2 -2
- package/dist/{chunk-TSL64O5L.js → chunk-UGRX3S57.js} +31 -2
- package/dist/{chunk-L4B3Y3OM.js → chunk-VUF4ALSW.js} +1 -1
- package/dist/{chunk-USS5ENJ2.js → chunk-VZKNK2V7.js} +9 -4
- package/dist/{chunk-MYA5HEK5.js → chunk-XZZOBQAY.js} +1 -1
- package/dist/{contracts-Hg6ITAEF.d.cts → contracts-DBdg9J_a.d.cts} +25 -4
- package/dist/{contracts-Hg6ITAEF.d.ts → contracts-DBdg9J_a.d.ts} +25 -4
- package/dist/{customElement-CNZxEB9G.d.ts → customElement-OB9CIsc5.d.cts} +38 -10
- package/dist/{customElement-CNZxEB9G.d.cts → customElement-OB9CIsc5.d.ts} +38 -10
- package/dist/data.cjs +81 -9
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +41 -2
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +83 -9
- package/dist/ecosystem.d.cts +13 -5
- package/dist/ecosystem.d.ts +13 -5
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +150 -40
- package/dist/extras.d.cts +3 -3
- package/dist/extras.d.ts +3 -3
- package/dist/extras.js +20 -20
- package/dist/index.cjs +92 -13
- package/dist/index.d.cts +24 -151
- package/dist/index.d.ts +24 -151
- package/dist/index.js +10 -10
- package/dist/motion.cjs +31 -2
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +116 -36
- package/dist/patterns.d.cts +6 -1
- package/dist/patterns.d.ts +6 -1
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +31 -2
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +39 -2
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +39 -2
- package/dist/ssr.js +7 -7
- package/dist/tagFactory-DVoDpHye.d.cts +215 -0
- package/dist/tagFactory-DVoDpHye.d.ts +215 -0
- package/dist/testing.cjs +31 -2
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +128 -39
- package/dist/ui.d.cts +2 -2
- package/dist/ui.d.ts +2 -2
- package/dist/ui.js +7 -7
- package/dist/widgets.cjs +75 -9
- package/dist/widgets.js +6 -6
- package/package.json +8 -2
- package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
- package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RIXRAYIU.js";
|
|
10
10
|
import {
|
|
11
11
|
dispose
|
|
12
12
|
} from "./chunk-QKRPLZ2V.js";
|
|
13
13
|
import {
|
|
14
14
|
signal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XZZOBQAY.js";
|
|
16
16
|
import {
|
|
17
17
|
forEachSubscriber,
|
|
18
18
|
getSubscriberCount,
|
|
19
19
|
getSubscriberDeps
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UGRX3S57.js";
|
|
21
21
|
import {
|
|
22
22
|
isDev
|
|
23
23
|
} from "./chunk-2WLZ6757.js";
|
|
@@ -296,6 +296,16 @@ function initDevTools(config) {
|
|
|
296
296
|
});
|
|
297
297
|
emit();
|
|
298
298
|
});
|
|
299
|
+
hook.on("computed:destroy", (payload) => {
|
|
300
|
+
const p = payload;
|
|
301
|
+
for (const [id, node] of hook.nodes) {
|
|
302
|
+
if (node.ref === p.signal) {
|
|
303
|
+
hook.nodes.delete(id);
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
emit();
|
|
308
|
+
});
|
|
299
309
|
hook.on("effect:create", (payload) => {
|
|
300
310
|
_dt.nextNodeId++;
|
|
301
311
|
const name = inferName();
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7LN645I6.js";
|
|
4
4
|
import {
|
|
5
5
|
createId
|
|
6
6
|
} from "./chunk-CCSJMTRN.js";
|
|
7
7
|
import {
|
|
8
8
|
derived
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RBTPLM32.js";
|
|
10
10
|
import {
|
|
11
11
|
stripHtml
|
|
12
12
|
} from "./chunk-IXKSNWV5.js";
|
|
13
13
|
import {
|
|
14
14
|
effect
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RIXRAYIU.js";
|
|
16
16
|
import {
|
|
17
17
|
batch,
|
|
18
18
|
signal
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XZZOBQAY.js";
|
|
20
20
|
|
|
21
21
|
// src/widgets/Combobox.ts
|
|
22
22
|
var boundComboboxes = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bindAttribute,
|
|
3
3
|
setSafeAttribute
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ONOHFDLG.js";
|
|
5
5
|
import {
|
|
6
6
|
isEventHandlerAttr,
|
|
7
7
|
sanitizeCSSValue,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-QKRPLZ2V.js";
|
|
14
14
|
import {
|
|
15
15
|
reactiveBinding
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UGRX3S57.js";
|
|
17
17
|
import {
|
|
18
18
|
DEV,
|
|
19
19
|
devWarn,
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
} from "./chunk-52XFPGSN.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RIXRAYIU.js";
|
|
10
10
|
import {
|
|
11
11
|
batch,
|
|
12
12
|
signal
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XZZOBQAY.js";
|
|
14
14
|
import {
|
|
15
15
|
reportError
|
|
16
16
|
} from "./chunk-2WLZ6757.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-IXKSNWV5.js";
|
|
6
6
|
import {
|
|
7
7
|
reactiveBinding
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UGRX3S57.js";
|
|
9
9
|
import {
|
|
10
10
|
DEV,
|
|
11
11
|
devWarn,
|
|
@@ -62,6 +62,14 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
62
62
|
const html = isHtmlElement(el);
|
|
63
63
|
const idlName = html ? name.toLowerCase() : name;
|
|
64
64
|
if (typeof value === "boolean") {
|
|
65
|
+
if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
|
|
66
|
+
const token = value ? "true" : "false";
|
|
67
|
+
if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
|
|
68
|
+
if (ns) el.setAttributeNS(ns, name, token);
|
|
69
|
+
else el.setAttribute(name, token);
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
65
73
|
if (html && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
|
|
66
74
|
setProp(el, idlName, value);
|
|
67
75
|
} else if (value) {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEV,
|
|
3
|
+
devWarn
|
|
4
|
+
} from "./chunk-2WLZ6757.js";
|
|
5
|
+
|
|
1
6
|
// src/patterns/hoc.ts
|
|
2
7
|
function withWrapper(WrappedComponent, wrapper) {
|
|
3
8
|
return (props) => wrapper(WrappedComponent, props);
|
|
@@ -113,31 +118,39 @@ var validators = {
|
|
|
113
118
|
};
|
|
114
119
|
function validateProps(props, schema) {
|
|
115
120
|
const result = { ...props };
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
122
|
+
const errors = [];
|
|
123
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
124
|
+
const propDef = typeof def === "function" ? { type: def } : def;
|
|
125
|
+
if (result[key] == null && propDef.default !== void 0) {
|
|
126
|
+
result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
|
|
127
|
+
}
|
|
128
|
+
if (propDef.required && result[key] == null) {
|
|
129
|
+
errors.push(`Prop '${key}' is required`);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (result[key] == null) continue;
|
|
133
|
+
if (propDef.type) {
|
|
134
|
+
const typeResult = propDef.type(result[key], key);
|
|
135
|
+
if (typeResult !== true) errors.push(typeResult);
|
|
136
|
+
}
|
|
137
|
+
if (propDef.validator) {
|
|
138
|
+
const validResult = propDef.validator(result[key], key);
|
|
139
|
+
if (validResult !== true) errors.push(validResult);
|
|
140
|
+
}
|
|
132
141
|
}
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
if (errors.length > 0) {
|
|
143
|
+
devWarn(`Prop validation errors:
|
|
144
|
+
${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
136
145
|
}
|
|
146
|
+
return result;
|
|
137
147
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
148
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
149
|
+
if (typeof def === "function") continue;
|
|
150
|
+
const fallback = def.default;
|
|
151
|
+
if (result[key] == null && fallback !== void 0) {
|
|
152
|
+
result[key] = typeof fallback === "function" ? fallback() : fallback;
|
|
153
|
+
}
|
|
141
154
|
}
|
|
142
155
|
return result;
|
|
143
156
|
}
|
|
@@ -148,10 +161,11 @@ function defineStrictComponent(config) {
|
|
|
148
161
|
};
|
|
149
162
|
}
|
|
150
163
|
function assertType(value, validator, label) {
|
|
151
|
-
if (typeof
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
165
|
+
const result = validator(value, label || "value");
|
|
166
|
+
if (result !== true) {
|
|
167
|
+
throw new TypeError(`[SibuJS Contract] ${result}`);
|
|
168
|
+
}
|
|
155
169
|
}
|
|
156
170
|
}
|
|
157
171
|
function createGuard(validator) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
cleanup,
|
|
2
3
|
isTrackingSuspended,
|
|
3
4
|
recordDependency,
|
|
4
5
|
retrack,
|
|
5
6
|
track
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UGRX3S57.js";
|
|
7
8
|
import {
|
|
8
9
|
devAssert
|
|
9
10
|
} from "./chunk-2WLZ6757.js";
|
|
@@ -16,10 +17,14 @@ function derived(getter, options) {
|
|
|
16
17
|
const cs = {};
|
|
17
18
|
cs._d = false;
|
|
18
19
|
cs._init = false;
|
|
20
|
+
cs._f = false;
|
|
19
21
|
cs._g = getter;
|
|
20
22
|
cs.__v = 0;
|
|
23
|
+
let evaluating = false;
|
|
24
|
+
let disposed = false;
|
|
25
|
+
let pendingError;
|
|
21
26
|
const markDirty = () => {
|
|
22
|
-
if (cs._d) return;
|
|
27
|
+
if (cs._d || disposed) return;
|
|
23
28
|
cs._d = true;
|
|
24
29
|
};
|
|
25
30
|
markDirty._c = 1;
|
|
@@ -42,33 +47,53 @@ function derived(getter, options) {
|
|
|
42
47
|
}
|
|
43
48
|
}, markDirty);
|
|
44
49
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
45
|
-
let evaluating = false;
|
|
46
50
|
const validate = () => {
|
|
47
|
-
if (!cs._d) return;
|
|
51
|
+
if (!cs._d || disposed || pendingError !== void 0) return;
|
|
48
52
|
const oldValue = cs._v;
|
|
49
53
|
evaluating = true;
|
|
50
54
|
try {
|
|
51
55
|
retrack(recompute, markDirty);
|
|
52
56
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
57
|
+
} catch (err) {
|
|
58
|
+
pendingError = { error: err };
|
|
59
|
+
cs.__v++;
|
|
60
|
+
if (disposed) cs._d = true;
|
|
61
|
+
else cs._f = true;
|
|
53
62
|
} finally {
|
|
54
63
|
evaluating = false;
|
|
64
|
+
if (disposed) cleanup(markDirty);
|
|
55
65
|
}
|
|
56
|
-
if (hook && !Object.is(oldValue, cs._v)) {
|
|
66
|
+
if (hook && !disposed && !Object.is(oldValue, cs._v)) {
|
|
57
67
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
58
68
|
}
|
|
59
69
|
};
|
|
60
70
|
cs._validate = validate;
|
|
71
|
+
const throwPending = () => {
|
|
72
|
+
const { error } = pendingError;
|
|
73
|
+
pendingError = void 0;
|
|
74
|
+
if (disposed) cs._d = false;
|
|
75
|
+
throw error;
|
|
76
|
+
};
|
|
61
77
|
function computedGetter() {
|
|
62
78
|
if (evaluating) {
|
|
63
79
|
throw new Error(
|
|
64
80
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
65
81
|
);
|
|
66
82
|
}
|
|
67
|
-
if (isTrackingSuspended()) {
|
|
68
|
-
if (cs._d)
|
|
83
|
+
if (isTrackingSuspended() || disposed) {
|
|
84
|
+
if (cs._d) {
|
|
85
|
+
validate();
|
|
86
|
+
if (pendingError !== void 0) throwPending();
|
|
87
|
+
}
|
|
69
88
|
return cs._v;
|
|
70
89
|
}
|
|
71
|
-
if (cs._d)
|
|
90
|
+
if (cs._d) {
|
|
91
|
+
validate();
|
|
92
|
+
if (pendingError !== void 0) {
|
|
93
|
+
recordDependency(cs);
|
|
94
|
+
throwPending();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
72
97
|
recordDependency(cs);
|
|
73
98
|
return cs._v;
|
|
74
99
|
}
|
|
@@ -77,6 +102,19 @@ function derived(getter, options) {
|
|
|
77
102
|
cs.__name = debugName;
|
|
78
103
|
}
|
|
79
104
|
computedGetter.__signal = cs;
|
|
105
|
+
computedGetter.dispose = () => {
|
|
106
|
+
if (disposed) return;
|
|
107
|
+
disposed = true;
|
|
108
|
+
cs._d = pendingError !== void 0;
|
|
109
|
+
cleanup(markDirty);
|
|
110
|
+
const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
111
|
+
if (h) {
|
|
112
|
+
try {
|
|
113
|
+
h.emit("computed:destroy", { signal: cs, getter: computedGetter });
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
80
118
|
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
81
119
|
return computedGetter;
|
|
82
120
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
div,
|
|
8
8
|
span
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PCT43HW3.js";
|
|
10
10
|
import {
|
|
11
11
|
STATIC_VALUE_RESOLVER,
|
|
12
12
|
planHeadElementEntry,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-7ZHH77QA.js";
|
|
21
21
|
import {
|
|
22
22
|
effect
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-RIXRAYIU.js";
|
|
24
24
|
import {
|
|
25
25
|
registerDisposer,
|
|
26
26
|
replaceChildrenSafely
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
batch,
|
|
30
30
|
signal
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-XZZOBQAY.js";
|
|
32
32
|
|
|
33
33
|
// src/platform/head.ts
|
|
34
34
|
function escapeScriptJsonLocal(json) {
|
|
@@ -135,42 +135,42 @@ import {
|
|
|
135
135
|
use,
|
|
136
136
|
var_,
|
|
137
137
|
video
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-PCT43HW3.js";
|
|
139
139
|
import {
|
|
140
140
|
trustHTML
|
|
141
141
|
} from "./chunk-NIOYEGBQ.js";
|
|
142
142
|
import {
|
|
143
143
|
watch
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-7LN645I6.js";
|
|
145
145
|
import {
|
|
146
146
|
__resetIdCounter,
|
|
147
147
|
createId
|
|
148
148
|
} from "./chunk-CCSJMTRN.js";
|
|
149
149
|
import {
|
|
150
150
|
context
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-VUF4ALSW.js";
|
|
152
152
|
import {
|
|
153
153
|
SVG_NS,
|
|
154
154
|
bindChildNode,
|
|
155
155
|
captureFocusWithin,
|
|
156
156
|
restoreFocusWithin,
|
|
157
157
|
tagFactory
|
|
158
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-KEISJXBU.js";
|
|
159
159
|
import {
|
|
160
160
|
bindAttribute,
|
|
161
161
|
bindDynamic,
|
|
162
162
|
setSafeAttribute
|
|
163
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-ONOHFDLG.js";
|
|
164
164
|
import {
|
|
165
165
|
derived
|
|
166
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-RBTPLM32.js";
|
|
167
167
|
import {
|
|
168
168
|
globalSingleton
|
|
169
169
|
} from "./chunk-7ZHH77QA.js";
|
|
170
170
|
import {
|
|
171
171
|
effect,
|
|
172
172
|
on
|
|
173
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-RIXRAYIU.js";
|
|
174
174
|
import {
|
|
175
175
|
disableSSR,
|
|
176
176
|
enableSSR,
|
|
@@ -195,7 +195,7 @@ import {
|
|
|
195
195
|
external,
|
|
196
196
|
isBatching,
|
|
197
197
|
signal
|
|
198
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-XZZOBQAY.js";
|
|
199
199
|
import {
|
|
200
200
|
notifySubscribers,
|
|
201
201
|
reactiveBinding,
|
|
@@ -206,7 +206,7 @@ import {
|
|
|
206
206
|
suspendTracking,
|
|
207
207
|
track,
|
|
208
208
|
untracked
|
|
209
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-UGRX3S57.js";
|
|
210
210
|
import {
|
|
211
211
|
DEV,
|
|
212
212
|
__export,
|
|
@@ -1757,7 +1757,7 @@ function show(condition, element) {
|
|
|
1757
1757
|
const update = () => {
|
|
1758
1758
|
resolved.style.display = condition() ? "" : "none";
|
|
1759
1759
|
};
|
|
1760
|
-
registerDisposer(resolved,
|
|
1760
|
+
registerDisposer(resolved, reactiveBinding(update, resolved));
|
|
1761
1761
|
return resolved;
|
|
1762
1762
|
}
|
|
1763
1763
|
function attachBranch(parent, anchor, branch, attachedOnce, where) {
|
|
@@ -1802,7 +1802,7 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
1802
1802
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
|
|
1803
1803
|
initialized = true;
|
|
1804
1804
|
};
|
|
1805
|
-
registerDisposer(anchor,
|
|
1805
|
+
registerDisposer(anchor, reactiveBinding(update, anchor));
|
|
1806
1806
|
if (!initialized) {
|
|
1807
1807
|
queueMicrotask(() => {
|
|
1808
1808
|
if (!initialized && anchor.parentNode) update();
|
|
@@ -1836,7 +1836,7 @@ function match(value, cases, fallback) {
|
|
|
1836
1836
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
|
|
1837
1837
|
initialized = true;
|
|
1838
1838
|
};
|
|
1839
|
-
registerDisposer(anchor,
|
|
1839
|
+
registerDisposer(anchor, reactiveBinding(update, anchor));
|
|
1840
1840
|
if (!initialized) {
|
|
1841
1841
|
queueMicrotask(() => {
|
|
1842
1842
|
if (!initialized && anchor.parentNode) update();
|
|
@@ -1991,7 +1991,12 @@ function each(getArray, render, options) {
|
|
|
1991
1991
|
const [indexGetter, setIndex] = signal(i2);
|
|
1992
1992
|
let node;
|
|
1993
1993
|
try {
|
|
1994
|
-
|
|
1994
|
+
suspendTracking();
|
|
1995
|
+
try {
|
|
1996
|
+
node = resolveNodeChild(render(itemGetter, indexGetter));
|
|
1997
|
+
} finally {
|
|
1998
|
+
resumeTracking();
|
|
1999
|
+
}
|
|
1995
2000
|
} catch (err) {
|
|
1996
2001
|
const key2 = newKeys[i2];
|
|
1997
2002
|
node = document.createComment(`each:error:${i2}`);
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RIXRAYIU.js";
|
|
10
10
|
import {
|
|
11
11
|
dispose,
|
|
12
12
|
replaceChildrenSafely
|
|
13
13
|
} from "./chunk-QKRPLZ2V.js";
|
|
14
14
|
import {
|
|
15
15
|
signal
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XZZOBQAY.js";
|
|
17
17
|
import {
|
|
18
18
|
DEV,
|
|
19
19
|
devWarn,
|
|
@@ -151,6 +151,15 @@ function untracked(fn) {
|
|
|
151
151
|
var subscriberEpochCounter = 0;
|
|
152
152
|
function retrack(effectFn, subscriber) {
|
|
153
153
|
const prev = currentSubscriber;
|
|
154
|
+
let savedDepth = 0;
|
|
155
|
+
let savedSuspendSub = null;
|
|
156
|
+
if (trackingSuspended) {
|
|
157
|
+
savedDepth = suspendDepth;
|
|
158
|
+
savedSuspendSub = suspendSavedSub;
|
|
159
|
+
suspendDepth = 0;
|
|
160
|
+
suspendSavedSub = null;
|
|
161
|
+
trackingSuspended = false;
|
|
162
|
+
}
|
|
154
163
|
currentSubscriber = subscriber;
|
|
155
164
|
const sub = subscriber;
|
|
156
165
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -165,6 +174,11 @@ function retrack(effectFn, subscriber) {
|
|
|
165
174
|
effectFn();
|
|
166
175
|
} finally {
|
|
167
176
|
currentSubscriber = prev;
|
|
177
|
+
if (savedDepth !== 0) {
|
|
178
|
+
suspendDepth = savedDepth;
|
|
179
|
+
suspendSavedSub = savedSuspendSub;
|
|
180
|
+
trackingSuspended = true;
|
|
181
|
+
}
|
|
168
182
|
let node = sub.depsHead ?? null;
|
|
169
183
|
while (node !== null) {
|
|
170
184
|
const next = node.subNext;
|
|
@@ -184,11 +198,25 @@ function track(effectFn, subscriber) {
|
|
|
184
198
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
185
199
|
cleanup(subscriber);
|
|
186
200
|
const prev = currentSubscriber;
|
|
201
|
+
let savedDepth = 0;
|
|
202
|
+
let savedSuspendSub = null;
|
|
203
|
+
if (trackingSuspended) {
|
|
204
|
+
savedDepth = suspendDepth;
|
|
205
|
+
savedSuspendSub = suspendSavedSub;
|
|
206
|
+
suspendDepth = 0;
|
|
207
|
+
suspendSavedSub = null;
|
|
208
|
+
trackingSuspended = false;
|
|
209
|
+
}
|
|
187
210
|
currentSubscriber = subscriber;
|
|
188
211
|
try {
|
|
189
212
|
effectFn();
|
|
190
213
|
} finally {
|
|
191
214
|
currentSubscriber = prev;
|
|
215
|
+
if (savedDepth !== 0) {
|
|
216
|
+
suspendDepth = savedDepth;
|
|
217
|
+
suspendSavedSub = savedSuspendSub;
|
|
218
|
+
trackingSuspended = true;
|
|
219
|
+
}
|
|
192
220
|
const sub2 = subscriber;
|
|
193
221
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
194
222
|
const sig = n.sig;
|
|
@@ -359,8 +387,9 @@ function propagateDirty(sub) {
|
|
|
359
387
|
if (s._c) {
|
|
360
388
|
const nSig = s._sig;
|
|
361
389
|
if (nSig) {
|
|
362
|
-
if (!nSig._d) {
|
|
390
|
+
if (!nSig._d || nSig._f === true) {
|
|
363
391
|
nSig._d = true;
|
|
392
|
+
nSig._f = false;
|
|
364
393
|
stack.push(nSig);
|
|
365
394
|
}
|
|
366
395
|
} else {
|
|
@@ -460,7 +489,7 @@ function forEachSubscriber(signal, visit) {
|
|
|
460
489
|
}
|
|
461
490
|
|
|
462
491
|
// src/reactivity/track.ts
|
|
463
|
-
var _runtimeVersion = true ? "4.
|
|
492
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
464
493
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
465
494
|
function resolveReactiveApi() {
|
|
466
495
|
const g = globalThis;
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-H3SRKIYX.js";
|
|
5
5
|
import {
|
|
6
6
|
derived
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RBTPLM32.js";
|
|
8
8
|
import {
|
|
9
9
|
effect
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RIXRAYIU.js";
|
|
11
11
|
import {
|
|
12
12
|
batch,
|
|
13
13
|
signal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XZZOBQAY.js";
|
|
15
15
|
|
|
16
16
|
// src/patterns/machine.ts
|
|
17
17
|
function machine(config) {
|
|
@@ -487,7 +487,12 @@ function timeline(initial, maxHistory = 100) {
|
|
|
487
487
|
setIndex(targetIndex);
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
function dispose() {
|
|
491
|
+
value.dispose();
|
|
492
|
+
canUndo.dispose();
|
|
493
|
+
canRedo.dispose();
|
|
494
|
+
}
|
|
495
|
+
return { value, set, undo, redo, canUndo, canRedo, history, index, reset, jumpTo, dispose };
|
|
491
496
|
}
|
|
492
497
|
|
|
493
498
|
// src/patterns/globalStore.ts
|
|
@@ -182,6 +182,15 @@ declare function withProps<OuterProps extends object, InnerProps extends object>
|
|
|
182
182
|
/**
|
|
183
183
|
* Runtime prop validation and strict typing contracts for SibuJS.
|
|
184
184
|
* Provides runtime type checking for component props in development mode.
|
|
185
|
+
*
|
|
186
|
+
* Both diagnostics here gate on `DEV`, the same foldable flag the rest of the
|
|
187
|
+
* framework uses, so a `__SIBU_DEV__: false` define removes them and their
|
|
188
|
+
* message text entirely. They used to test `process.env.NODE_ENV` directly,
|
|
189
|
+
* which is not a `define` target and does not exist in a browser at all — so
|
|
190
|
+
* every browser build treated itself as development: `validateProps` ran and
|
|
191
|
+
* warned, `assertType` threw, and the strings shipped. That went unnoticed
|
|
192
|
+
* while these functions were reachable only through a bundler; putting
|
|
193
|
+
* `patterns` on the CDN made them a production artifact.
|
|
185
194
|
*/
|
|
186
195
|
/** Validator function: returns true if valid, or an error message string. */
|
|
187
196
|
type Validator<T = unknown> = (value: T, propName: string) => true | string;
|
|
@@ -212,9 +221,19 @@ type PropSchema<Props> = {
|
|
|
212
221
|
[K in keyof Props]: PropDef<Props[K]> | Validator<Props[K]>;
|
|
213
222
|
};
|
|
214
223
|
/**
|
|
215
|
-
* Validate props against a schema
|
|
216
|
-
*
|
|
217
|
-
*
|
|
224
|
+
* Validate props against a schema, returning the props with defaults applied.
|
|
225
|
+
*
|
|
226
|
+
* Defaults are production behaviour; the checking is development-only and is
|
|
227
|
+
* compiled out of production builds. The two are not interchangeable when the
|
|
228
|
+
* schema's callbacks touch outside state: a validator that runs in development
|
|
229
|
+
* and not in production can leave a later property's default factory reading
|
|
230
|
+
* different state. Keep defaults and validators free of side effects if the
|
|
231
|
+
* two modes must agree exactly.
|
|
232
|
+
*
|
|
233
|
+
* @param props - The props to validate. Not mutated.
|
|
234
|
+
* @param schema - Per-property definitions, in either the shorthand
|
|
235
|
+
* (a bare {@link Validator}) or object form.
|
|
236
|
+
* @returns A new object: the props, plus any defaults that applied.
|
|
218
237
|
*/
|
|
219
238
|
declare function validateProps<Props extends object>(props: Partial<Props>, schema: PropSchema<Props>): Props;
|
|
220
239
|
/**
|
|
@@ -228,7 +247,9 @@ declare function defineStrictComponent<Props extends object>(config: {
|
|
|
228
247
|
}): (props: Partial<Props>) => HTMLElement;
|
|
229
248
|
/**
|
|
230
249
|
* Assert that a value satisfies a contract at runtime.
|
|
231
|
-
*
|
|
250
|
+
*
|
|
251
|
+
* No-op in production builds — genuinely, now. The previous guard returned early
|
|
252
|
+
* only when `process` existed, so in a browser it fell through and threw.
|
|
232
253
|
*/
|
|
233
254
|
declare function assertType<T>(value: unknown, validator: Validator<T>, label?: string): asserts value is T;
|
|
234
255
|
/**
|