sibujs 3.3.1 → 3.3.3
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/browser.cjs +41 -18
- package/dist/browser.js +5 -5
- package/dist/build.cjs +57 -22
- package/dist/build.js +14 -14
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-MHBCEJQO.js → chunk-23VT3KZB.js} +2 -2
- package/dist/{chunk-WL7BIR6O.js → chunk-25LY5SRH.js} +31 -24
- package/dist/{chunk-37BUKSLH.js → chunk-5K6RVA2S.js} +1 -1
- package/dist/{chunk-AMIKDMLP.js → chunk-5Y34FWED.js} +17 -6
- package/dist/chunk-7ZHH77QA.js +9 -0
- package/dist/chunk-CCSJMTRN.js +15 -0
- package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
- package/dist/{chunk-WW6DAGGR.js → chunk-F3HO2MP7.js} +1 -1
- package/dist/{chunk-ZUVLC7TM.js → chunk-F7HW2NI5.js} +2 -4
- package/dist/{chunk-ULLTNDRA.js → chunk-IEYFHN5V.js} +72 -25
- package/dist/{chunk-Z37APKBV.js → chunk-IQN5W7GE.js} +73 -16
- package/dist/{chunk-WZG2SZOT.js → chunk-IWFE4AHO.js} +1 -1
- package/dist/{chunk-IKLYI3RF.js → chunk-MYXEBADX.js} +53 -23
- package/dist/{chunk-6LTFHJQG.js → chunk-QCQQ2N5H.js} +41 -20
- package/dist/{chunk-VOVVTOEA.js → chunk-QTOOBABV.js} +22 -5
- package/dist/{chunk-LU2MQXQQ.js → chunk-RZKGMHH4.js} +6 -6
- package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
- package/dist/{chunk-NHKQKKZU.js → chunk-SBPUXWCE.js} +1 -1
- package/dist/{chunk-SLMFA3ZZ.js → chunk-TBDTU7UO.js} +2 -2
- package/dist/{chunk-4UUMSLSL.js → chunk-TVCCXPU2.js} +5 -5
- package/dist/{chunk-TEFZT5PJ.js → chunk-UOMYIAG6.js} +1 -1
- package/dist/{chunk-XH2RTYEQ.js → chunk-WFUUT6TG.js} +15 -8
- package/dist/{chunk-M5KBNOSJ.js → chunk-WTFMV2RU.js} +70 -59
- package/dist/{chunk-3JHCYHWN.js → chunk-WWV3SJ3L.js} +19 -13
- package/dist/{chunk-RYMOSG5B.js → chunk-Y35NQNLG.js} +90 -60
- package/dist/{chunk-F7FXQ3QS.js → chunk-ZXCZWMZT.js} +1 -1
- package/dist/data.cjs +36 -16
- package/dist/data.js +8 -7
- package/dist/devtools.cjs +91 -35
- package/dist/devtools.d.cts +12 -5
- package/dist/devtools.d.ts +12 -5
- package/dist/devtools.js +7 -6
- package/dist/ecosystem.cjs +31 -16
- package/dist/ecosystem.js +11 -10
- package/dist/extras.cjs +485 -280
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +28 -24
- package/dist/index.cjs +59 -22
- package/dist/index.d.cts +24 -8
- package/dist/index.d.ts +24 -8
- package/dist/index.js +25 -21
- package/dist/motion.cjs +223 -204
- package/dist/motion.d.cts +8 -1
- package/dist/motion.d.ts +8 -1
- package/dist/motion.js +6 -3
- package/dist/patterns.cjs +33 -20
- package/dist/patterns.d.cts +4 -1
- package/dist/patterns.d.ts +4 -1
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +90 -70
- package/dist/performance.js +8 -7
- package/dist/plugins.cjs +207 -144
- package/dist/plugins.d.cts +2 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.js +178 -124
- package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
- package/dist/ssr.cjs +132 -105
- package/dist/ssr.d.cts +8 -1
- package/dist/ssr.d.ts +8 -1
- package/dist/ssr.js +11 -10
- package/dist/testing.cjs +38 -18
- package/dist/testing.js +19 -8
- package/dist/ui.cjs +337 -294
- package/dist/ui.d.cts +0 -20
- package/dist/ui.d.ts +0 -20
- package/dist/ui.js +30 -24
- package/dist/widgets.cjs +95 -27
- package/dist/widgets.d.cts +6 -1
- package/dist/widgets.d.ts +6 -1
- package/dist/widgets.js +8 -7
- package/package.json +1 -1
- package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/patterns.cjs
CHANGED
|
@@ -481,7 +481,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
481
481
|
|
|
482
482
|
// src/reactivity/track.ts
|
|
483
483
|
var _isDev3 = isDev();
|
|
484
|
-
var _runtimeVersion =
|
|
484
|
+
var _runtimeVersion = true ? "3.3.3" : "dev";
|
|
485
485
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
486
486
|
function resolveReactiveApi() {
|
|
487
487
|
const g = globalThis;
|
|
@@ -729,23 +729,29 @@ function machine(config) {
|
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
// src/core/ssr-context.ts
|
|
732
|
-
var
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
732
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
733
|
+
function detectSSRShared() {
|
|
734
|
+
let detected = null;
|
|
735
|
+
try {
|
|
736
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
737
|
+
let mod = null;
|
|
738
|
+
const getBuiltin = process.getBuiltinModule;
|
|
739
|
+
if (typeof getBuiltin === "function") {
|
|
740
|
+
mod = getBuiltin("node:async_hooks");
|
|
741
|
+
} else {
|
|
742
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
743
|
+
if (req) mod = req("node:async_hooks");
|
|
744
|
+
}
|
|
745
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
742
746
|
}
|
|
743
|
-
|
|
747
|
+
} catch {
|
|
748
|
+
detected = null;
|
|
744
749
|
}
|
|
745
|
-
|
|
746
|
-
als = null;
|
|
750
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
747
751
|
}
|
|
748
|
-
var
|
|
752
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
753
|
+
var als = _shared.als;
|
|
754
|
+
var fallbackStore = _shared.fallbackStore;
|
|
749
755
|
function getSSRStore() {
|
|
750
756
|
if (als) {
|
|
751
757
|
const s = als.getStore();
|
|
@@ -880,7 +886,14 @@ function effect(effectFn, options) {
|
|
|
880
886
|
|
|
881
887
|
// src/patterns/persist.ts
|
|
882
888
|
function persisted(key, initial, options = {}) {
|
|
883
|
-
const storage =
|
|
889
|
+
const storage = (() => {
|
|
890
|
+
try {
|
|
891
|
+
if (options.session) return typeof sessionStorage !== "undefined" ? sessionStorage : null;
|
|
892
|
+
return typeof localStorage !== "undefined" ? localStorage : null;
|
|
893
|
+
} catch {
|
|
894
|
+
return null;
|
|
895
|
+
}
|
|
896
|
+
})();
|
|
884
897
|
const serialize = options.serialize || JSON.stringify;
|
|
885
898
|
const safeReviver = (k, v) => isUnsafeKey(k) ? void 0 : v;
|
|
886
899
|
const deserialize = options.deserialize || ((raw) => JSON.parse(raw, safeReviver));
|
|
@@ -889,7 +902,7 @@ function persisted(key, initial, options = {}) {
|
|
|
889
902
|
const syncTabs = options.session ? false : options.syncTabs ?? true;
|
|
890
903
|
let restored = initial;
|
|
891
904
|
try {
|
|
892
|
-
let raw = storage.getItem(key);
|
|
905
|
+
let raw = storage ? storage.getItem(key) : null;
|
|
893
906
|
if (raw !== null) {
|
|
894
907
|
if (decrypt) raw = decrypt(raw);
|
|
895
908
|
const parsed = deserialize(raw);
|
|
@@ -905,12 +918,12 @@ function persisted(key, initial, options = {}) {
|
|
|
905
918
|
try {
|
|
906
919
|
let serialized = serialize(current);
|
|
907
920
|
if (encrypt) serialized = encrypt(serialized);
|
|
908
|
-
storage
|
|
921
|
+
storage?.setItem(key, serialized);
|
|
909
922
|
} catch {
|
|
910
923
|
}
|
|
911
924
|
});
|
|
912
925
|
let storageListener = null;
|
|
913
|
-
if (syncTabs && typeof window !== "undefined") {
|
|
926
|
+
if (syncTabs && storage && typeof window !== "undefined") {
|
|
914
927
|
storageListener = (e) => {
|
|
915
928
|
if (e.storageArea !== storage || e.key !== key) return;
|
|
916
929
|
if (e.newValue === null) {
|
|
@@ -1292,7 +1305,7 @@ function globalStore(config) {
|
|
|
1292
1305
|
next();
|
|
1293
1306
|
}
|
|
1294
1307
|
function select(selector) {
|
|
1295
|
-
return
|
|
1308
|
+
return () => selector(getState());
|
|
1296
1309
|
}
|
|
1297
1310
|
function subscribe(callback) {
|
|
1298
1311
|
listeners.add(callback);
|
package/dist/patterns.d.cts
CHANGED
|
@@ -36,7 +36,10 @@ declare function machine<S extends string, E extends string, C extends Record<st
|
|
|
36
36
|
* @param key Storage key
|
|
37
37
|
* @param initial Default value when no persisted value exists
|
|
38
38
|
* @param options Storage options
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns The same `[getter, setter]` tuple as `signal()`. For localStorage
|
|
40
|
+
* (cross-tab sync on), the setter additionally carries a non-enumerable
|
|
41
|
+
* `dispose()` method — call `setter.dispose()` on unmount to remove the
|
|
42
|
+
* `storage` event listener; otherwise it lives for the page's lifetime.
|
|
40
43
|
*
|
|
41
44
|
* @example
|
|
42
45
|
* ```ts
|
package/dist/patterns.d.ts
CHANGED
|
@@ -36,7 +36,10 @@ declare function machine<S extends string, E extends string, C extends Record<st
|
|
|
36
36
|
* @param key Storage key
|
|
37
37
|
* @param initial Default value when no persisted value exists
|
|
38
38
|
* @param options Storage options
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns The same `[getter, setter]` tuple as `signal()`. For localStorage
|
|
40
|
+
* (cross-tab sync on), the setter additionally carries a non-enumerable
|
|
41
|
+
* `dispose()` method — call `setter.dispose()` on unmount to remove the
|
|
42
|
+
* `storage` event listener; otherwise it lives for the page's lifetime.
|
|
40
43
|
*
|
|
41
44
|
* @example
|
|
42
45
|
* ```ts
|
package/dist/patterns.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
optimisticList,
|
|
6
6
|
persisted,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFUUT6TG.js";
|
|
9
9
|
import {
|
|
10
10
|
RenderProp,
|
|
11
11
|
assertType,
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
withWrapper
|
|
24
24
|
} from "./chunk-VJE6DDYM.js";
|
|
25
25
|
import "./chunk-H3SRKIYX.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-F3HO2MP7.js";
|
|
27
|
+
import "./chunk-23VT3KZB.js";
|
|
28
|
+
import "./chunk-S3NFJO6L.js";
|
|
29
|
+
import "./chunk-IWFE4AHO.js";
|
|
30
|
+
import "./chunk-UOMYIAG6.js";
|
|
31
31
|
import "./chunk-COY6PUD2.js";
|
|
32
32
|
export {
|
|
33
33
|
RenderProp,
|
package/dist/performance.cjs
CHANGED
|
@@ -58,6 +58,12 @@ __export(performance_exports, {
|
|
|
58
58
|
});
|
|
59
59
|
module.exports = __toCommonJS(performance_exports);
|
|
60
60
|
|
|
61
|
+
// src/utils/globalSingleton.ts
|
|
62
|
+
function globalSingleton(key, create) {
|
|
63
|
+
const g = globalThis;
|
|
64
|
+
return g[key] ?? (g[key] = create());
|
|
65
|
+
}
|
|
66
|
+
|
|
61
67
|
// src/performance/scheduler.ts
|
|
62
68
|
var Priority = {
|
|
63
69
|
IMMEDIATE: 0,
|
|
@@ -66,12 +72,15 @@ var Priority = {
|
|
|
66
72
|
LOW: 3,
|
|
67
73
|
IDLE: 4
|
|
68
74
|
};
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
var _sched = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.scheduler.v1"), () => ({
|
|
76
|
+
taskIdCounter: 0,
|
|
77
|
+
taskQueue: [],
|
|
78
|
+
isProcessing: false,
|
|
79
|
+
scheduledKind: null,
|
|
80
|
+
scheduledHandle: null,
|
|
81
|
+
microtaskScheduled: false
|
|
82
|
+
}));
|
|
83
|
+
var taskQueue = _sched.taskQueue;
|
|
75
84
|
function insertTask(task) {
|
|
76
85
|
let i = taskQueue.length;
|
|
77
86
|
while (i > 0 && taskQueue[i - 1].priority > task.priority) {
|
|
@@ -80,8 +89,8 @@ function insertTask(task) {
|
|
|
80
89
|
taskQueue.splice(i, 0, task);
|
|
81
90
|
}
|
|
82
91
|
function processQueue() {
|
|
83
|
-
if (isProcessing || taskQueue.length === 0) return;
|
|
84
|
-
isProcessing = true;
|
|
92
|
+
if (_sched.isProcessing || taskQueue.length === 0) return;
|
|
93
|
+
_sched.isProcessing = true;
|
|
85
94
|
const startTime = performance.now();
|
|
86
95
|
const timeSlice = 5;
|
|
87
96
|
while (taskQueue.length > 0) {
|
|
@@ -100,64 +109,69 @@ function processQueue() {
|
|
|
100
109
|
console.error("[Scheduler] Task error:", e);
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
|
-
isProcessing = false;
|
|
112
|
+
_sched.isProcessing = false;
|
|
104
113
|
if (taskQueue.length > 0) {
|
|
105
114
|
scheduleFrame();
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
var TIER_SPEED = { microtask: 0, frame: 1, timeout: 2, idle: 3 };
|
|
109
118
|
function cancelScheduled() {
|
|
110
|
-
if (scheduledHandle !== null) {
|
|
111
|
-
if (scheduledKind === "frame") cancelAnimationFrame(scheduledHandle);
|
|
112
|
-
else if (scheduledKind === "idle" && typeof cancelIdleCallback !== "undefined")
|
|
113
|
-
|
|
119
|
+
if (_sched.scheduledHandle !== null) {
|
|
120
|
+
if (_sched.scheduledKind === "frame") cancelAnimationFrame(_sched.scheduledHandle);
|
|
121
|
+
else if (_sched.scheduledKind === "idle" && typeof cancelIdleCallback !== "undefined")
|
|
122
|
+
cancelIdleCallback(_sched.scheduledHandle);
|
|
123
|
+
else if (_sched.scheduledKind === "timeout") clearTimeout(_sched.scheduledHandle);
|
|
114
124
|
}
|
|
115
|
-
scheduledHandle = null;
|
|
116
|
-
scheduledKind = null;
|
|
125
|
+
_sched.scheduledHandle = null;
|
|
126
|
+
_sched.scheduledKind = null;
|
|
117
127
|
}
|
|
118
128
|
function scheduleFrame() {
|
|
119
129
|
const nextTask = taskQueue.find((t) => !t.cancelled);
|
|
120
130
|
if (!nextTask) return;
|
|
121
|
-
const desired = nextTask.priority <= Priority.USER_BLOCKING ? "microtask" : nextTask.priority === Priority.IDLE ? typeof requestIdleCallback !== "undefined" ? "idle" : "timeout" :
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
const desired = nextTask.priority <= Priority.USER_BLOCKING ? "microtask" : nextTask.priority === Priority.IDLE ? typeof requestIdleCallback !== "undefined" ? "idle" : "timeout" : (
|
|
132
|
+
// NORMAL/LOW prefer a frame, but rAF is absent under SSR — fall back
|
|
133
|
+
// to a timeout so startTransition()/deferredValue() don't throw.
|
|
134
|
+
typeof requestAnimationFrame !== "undefined" ? "frame" : "timeout"
|
|
135
|
+
);
|
|
136
|
+
if (_sched.microtaskScheduled) return;
|
|
137
|
+
if (_sched.scheduledKind !== null) {
|
|
138
|
+
if (TIER_SPEED[_sched.scheduledKind] <= TIER_SPEED[desired]) return;
|
|
125
139
|
cancelScheduled();
|
|
126
140
|
}
|
|
127
141
|
if (desired === "microtask") {
|
|
128
|
-
microtaskScheduled = true;
|
|
129
|
-
scheduledKind = "microtask";
|
|
142
|
+
_sched.microtaskScheduled = true;
|
|
143
|
+
_sched.scheduledKind = "microtask";
|
|
130
144
|
queueMicrotask(() => {
|
|
131
|
-
microtaskScheduled = false;
|
|
132
|
-
scheduledKind = null;
|
|
145
|
+
_sched.microtaskScheduled = false;
|
|
146
|
+
_sched.scheduledKind = null;
|
|
133
147
|
processQueue();
|
|
134
148
|
});
|
|
135
149
|
} else if (desired === "idle") {
|
|
136
|
-
scheduledKind = "idle";
|
|
137
|
-
scheduledHandle = requestIdleCallback(() => {
|
|
138
|
-
scheduledKind = null;
|
|
139
|
-
scheduledHandle = null;
|
|
150
|
+
_sched.scheduledKind = "idle";
|
|
151
|
+
_sched.scheduledHandle = requestIdleCallback(() => {
|
|
152
|
+
_sched.scheduledKind = null;
|
|
153
|
+
_sched.scheduledHandle = null;
|
|
140
154
|
processQueue();
|
|
141
155
|
});
|
|
142
156
|
} else if (desired === "timeout") {
|
|
143
|
-
scheduledKind = "timeout";
|
|
144
|
-
scheduledHandle = setTimeout(() => {
|
|
145
|
-
scheduledKind = null;
|
|
146
|
-
scheduledHandle = null;
|
|
157
|
+
_sched.scheduledKind = "timeout";
|
|
158
|
+
_sched.scheduledHandle = setTimeout(() => {
|
|
159
|
+
_sched.scheduledKind = null;
|
|
160
|
+
_sched.scheduledHandle = null;
|
|
147
161
|
processQueue();
|
|
148
162
|
}, 50);
|
|
149
163
|
} else {
|
|
150
|
-
scheduledKind = "frame";
|
|
151
|
-
scheduledHandle = requestAnimationFrame(() => {
|
|
152
|
-
scheduledKind = null;
|
|
153
|
-
scheduledHandle = null;
|
|
164
|
+
_sched.scheduledKind = "frame";
|
|
165
|
+
_sched.scheduledHandle = requestAnimationFrame(() => {
|
|
166
|
+
_sched.scheduledKind = null;
|
|
167
|
+
_sched.scheduledHandle = null;
|
|
154
168
|
processQueue();
|
|
155
169
|
});
|
|
156
170
|
}
|
|
157
171
|
}
|
|
158
172
|
function scheduleUpdate(priority, callback) {
|
|
159
173
|
const task = {
|
|
160
|
-
id: taskIdCounter++,
|
|
174
|
+
id: _sched.taskIdCounter++,
|
|
161
175
|
priority,
|
|
162
176
|
callback,
|
|
163
177
|
cancelled: false
|
|
@@ -178,15 +192,15 @@ function scheduleUpdate(priority, callback) {
|
|
|
178
192
|
};
|
|
179
193
|
}
|
|
180
194
|
function flushScheduler() {
|
|
181
|
-
if (scheduledHandle !== null) {
|
|
182
|
-
if (scheduledKind === "frame") cancelAnimationFrame(scheduledHandle);
|
|
183
|
-
else if (scheduledKind === "idle" && typeof cancelIdleCallback !== "undefined") {
|
|
184
|
-
cancelIdleCallback(scheduledHandle);
|
|
185
|
-
} else if (scheduledKind === "timeout") clearTimeout(scheduledHandle);
|
|
186
|
-
}
|
|
187
|
-
scheduledHandle = null;
|
|
188
|
-
scheduledKind = null;
|
|
189
|
-
microtaskScheduled = false;
|
|
195
|
+
if (_sched.scheduledHandle !== null) {
|
|
196
|
+
if (_sched.scheduledKind === "frame") cancelAnimationFrame(_sched.scheduledHandle);
|
|
197
|
+
else if (_sched.scheduledKind === "idle" && typeof cancelIdleCallback !== "undefined") {
|
|
198
|
+
cancelIdleCallback(_sched.scheduledHandle);
|
|
199
|
+
} else if (_sched.scheduledKind === "timeout") clearTimeout(_sched.scheduledHandle);
|
|
200
|
+
}
|
|
201
|
+
_sched.scheduledHandle = null;
|
|
202
|
+
_sched.scheduledKind = null;
|
|
203
|
+
_sched.microtaskScheduled = false;
|
|
190
204
|
while (taskQueue.length > 0) {
|
|
191
205
|
const task = taskQueue.shift();
|
|
192
206
|
if (!task) break;
|
|
@@ -194,7 +208,7 @@ function flushScheduler() {
|
|
|
194
208
|
task.callback();
|
|
195
209
|
}
|
|
196
210
|
}
|
|
197
|
-
isProcessing = false;
|
|
211
|
+
_sched.isProcessing = false;
|
|
198
212
|
}
|
|
199
213
|
function pendingTasks() {
|
|
200
214
|
return taskQueue.filter((t) => !t.cancelled).length;
|
|
@@ -654,7 +668,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
654
668
|
|
|
655
669
|
// src/reactivity/track.ts
|
|
656
670
|
var _isDev3 = isDev();
|
|
657
|
-
var _runtimeVersion =
|
|
671
|
+
var _runtimeVersion = true ? "3.3.3" : "dev";
|
|
658
672
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
659
673
|
function resolveReactiveApi() {
|
|
660
674
|
const g = globalThis;
|
|
@@ -711,23 +725,29 @@ var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
|
711
725
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
712
726
|
|
|
713
727
|
// src/core/ssr-context.ts
|
|
714
|
-
var
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
728
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
729
|
+
function detectSSRShared() {
|
|
730
|
+
let detected = null;
|
|
731
|
+
try {
|
|
732
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
733
|
+
let mod = null;
|
|
734
|
+
const getBuiltin = process.getBuiltinModule;
|
|
735
|
+
if (typeof getBuiltin === "function") {
|
|
736
|
+
mod = getBuiltin("node:async_hooks");
|
|
737
|
+
} else {
|
|
738
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
739
|
+
if (req) mod = req("node:async_hooks");
|
|
740
|
+
}
|
|
741
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
724
742
|
}
|
|
725
|
-
|
|
743
|
+
} catch {
|
|
744
|
+
detected = null;
|
|
726
745
|
}
|
|
727
|
-
|
|
728
|
-
als = null;
|
|
746
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
729
747
|
}
|
|
730
|
-
var
|
|
748
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
749
|
+
var als = _shared.als;
|
|
750
|
+
var fallbackStore = _shared.fallbackStore;
|
|
731
751
|
function getSSRStore() {
|
|
732
752
|
if (als) {
|
|
733
753
|
const s = als.getStore();
|
|
@@ -1006,16 +1026,18 @@ function transitionState() {
|
|
|
1006
1026
|
}
|
|
1007
1027
|
return [isPending, transition];
|
|
1008
1028
|
}
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1029
|
+
var _ids = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.uniqueId.v1"), () => ({
|
|
1030
|
+
counter: 0,
|
|
1031
|
+
prefix: "sibu"
|
|
1032
|
+
}));
|
|
1011
1033
|
function resetIdCounter() {
|
|
1012
|
-
|
|
1034
|
+
_ids.counter = 0;
|
|
1013
1035
|
}
|
|
1014
1036
|
function setIdPrefix(prefix) {
|
|
1015
|
-
|
|
1037
|
+
_ids.prefix = prefix;
|
|
1016
1038
|
}
|
|
1017
1039
|
function uniqueId(suffix) {
|
|
1018
|
-
const id = `${
|
|
1040
|
+
const id = `${_ids.prefix}-${_ids.counter++}`;
|
|
1019
1041
|
return suffix ? `${id}-${suffix}` : id;
|
|
1020
1042
|
}
|
|
1021
1043
|
|
|
@@ -1285,7 +1307,6 @@ function normalizedStore(schema) {
|
|
|
1285
1307
|
}
|
|
1286
1308
|
function normalize(data, schema) {
|
|
1287
1309
|
const entities = {};
|
|
1288
|
-
const idKey = schema.idKey || "id";
|
|
1289
1310
|
function ensureTable(name) {
|
|
1290
1311
|
if (!entities[name]) {
|
|
1291
1312
|
entities[name] = {};
|
|
@@ -1301,7 +1322,7 @@ function normalize(data, schema) {
|
|
|
1301
1322
|
for (const [field, relationType] of Object.entries(entitySchema.relations)) {
|
|
1302
1323
|
const value = entity[field];
|
|
1303
1324
|
if (value == null) continue;
|
|
1304
|
-
const relSchema = { name: relationType
|
|
1325
|
+
const relSchema = { name: relationType };
|
|
1305
1326
|
if (Array.isArray(value)) {
|
|
1306
1327
|
flat[field] = value.map((item) => normalizeEntity(item, relSchema));
|
|
1307
1328
|
} else if (typeof value === "object") {
|
|
@@ -1324,13 +1345,12 @@ function denormalize(id, entities, schema) {
|
|
|
1324
1345
|
if (!table) return void 0;
|
|
1325
1346
|
const entity = table[id];
|
|
1326
1347
|
if (!entity) return void 0;
|
|
1327
|
-
const idKey = schema.idKey || "id";
|
|
1328
1348
|
const result = { ...entity };
|
|
1329
1349
|
if (schema.relations) {
|
|
1330
1350
|
for (const [field, relationType] of Object.entries(schema.relations)) {
|
|
1331
1351
|
const value = entity[field];
|
|
1332
1352
|
if (value == null) continue;
|
|
1333
|
-
const relSchema = { name: relationType
|
|
1353
|
+
const relSchema = { name: relationType };
|
|
1334
1354
|
if (Array.isArray(value)) {
|
|
1335
1355
|
result[field] = value.map((relId) => denormalize(relId, entities, relSchema));
|
|
1336
1356
|
} else if (typeof value === "string") {
|
package/dist/performance.js
CHANGED
|
@@ -33,16 +33,17 @@ import {
|
|
|
33
33
|
transitionState,
|
|
34
34
|
uniqueId,
|
|
35
35
|
yieldToMain
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WTFMV2RU.js";
|
|
37
|
+
import "./chunk-7ZHH77QA.js";
|
|
37
38
|
import {
|
|
38
39
|
trustHTML
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-5VGSK6D2.js";
|
|
40
|
+
} from "./chunk-EX77FXTT.js";
|
|
41
41
|
import "./chunk-L3GAGWCC.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-23VT3KZB.js";
|
|
43
|
+
import "./chunk-S3NFJO6L.js";
|
|
44
|
+
import "./chunk-5VGSK6D2.js";
|
|
45
|
+
import "./chunk-IWFE4AHO.js";
|
|
46
|
+
import "./chunk-UOMYIAG6.js";
|
|
46
47
|
import "./chunk-COY6PUD2.js";
|
|
47
48
|
export {
|
|
48
49
|
DOMPool,
|