sibujs 1.0.9 → 1.2.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.
Files changed (62) hide show
  1. package/dist/browser.cjs +1 -1
  2. package/dist/browser.js +4 -4
  3. package/dist/build.cjs +53 -18
  4. package/dist/build.js +17 -10
  5. package/dist/cdn.global.js +6 -6
  6. package/dist/chunk-23VV7YD3.js +107 -0
  7. package/dist/chunk-3ARAQO7B.js +398 -0
  8. package/dist/chunk-6SA3QQES.js +61 -0
  9. package/dist/chunk-7BF6TK55.js +1097 -0
  10. package/dist/chunk-B7SWRFUT.js +332 -0
  11. package/dist/chunk-BW3WT46K.js +937 -0
  12. package/dist/chunk-C6KFWOFV.js +616 -0
  13. package/dist/chunk-EVCZO745.js +365 -0
  14. package/dist/chunk-GCOK2LC3.js +282 -0
  15. package/dist/chunk-L6JRBDNS.js +60 -0
  16. package/dist/chunk-LA6KQEDU.js +712 -0
  17. package/dist/chunk-MK4ERFYL.js +2249 -0
  18. package/dist/chunk-NHUC2QWH.js +282 -0
  19. package/dist/chunk-OUZZEE4S.js +365 -0
  20. package/dist/chunk-P6W3STU4.js +2249 -0
  21. package/dist/chunk-RQGQSLQK.js +725 -0
  22. package/dist/chunk-TNQWPPE6.js +37 -0
  23. package/dist/chunk-UNXCEF6S.js +21 -0
  24. package/dist/chunk-V2XTI523.js +347 -0
  25. package/dist/chunk-VMVDTCXB.js +712 -0
  26. package/dist/chunk-WADYRCO2.js +304 -0
  27. package/dist/chunk-WILQZRO4.js +282 -0
  28. package/dist/chunk-WR5D4EGH.js +26 -0
  29. package/dist/chunk-WUHJISPP.js +298 -0
  30. package/dist/chunk-YUTWTI4B.js +654 -0
  31. package/dist/chunk-Z6POF5YC.js +975 -0
  32. package/dist/chunk-ZBJP6WFL.js +482 -0
  33. package/dist/data.cjs +1 -1
  34. package/dist/data.js +6 -6
  35. package/dist/devtools.cjs +1 -1
  36. package/dist/devtools.js +4 -4
  37. package/dist/ecosystem.cjs +46 -18
  38. package/dist/ecosystem.js +7 -7
  39. package/dist/extras.cjs +53 -19
  40. package/dist/extras.js +21 -21
  41. package/dist/index.cjs +46 -18
  42. package/dist/index.d.cts +24 -8
  43. package/dist/index.d.ts +24 -8
  44. package/dist/index.js +10 -10
  45. package/dist/motion.cjs +1 -1
  46. package/dist/motion.js +3 -3
  47. package/dist/patterns.cjs +8 -2
  48. package/dist/patterns.js +5 -5
  49. package/dist/performance.cjs +1 -1
  50. package/dist/performance.js +3 -3
  51. package/dist/plugins.cjs +46 -18
  52. package/dist/plugins.js +9 -9
  53. package/dist/ssr-3RXHP5ES.js +38 -0
  54. package/dist/ssr.cjs +46 -18
  55. package/dist/ssr.d.cts +9 -0
  56. package/dist/ssr.d.ts +9 -0
  57. package/dist/ssr.js +8 -8
  58. package/dist/ui.cjs +1 -1
  59. package/dist/ui.js +6 -6
  60. package/dist/widgets.cjs +1 -1
  61. package/dist/widgets.js +5 -5
  62. package/package.json +1 -1
@@ -0,0 +1,482 @@
1
+ import {
2
+ effect
3
+ } from "./chunk-6SA3QQES.js";
4
+ import {
5
+ batch,
6
+ signal
7
+ } from "./chunk-V2XTI523.js";
8
+
9
+ // src/browser/media.ts
10
+ function media(query) {
11
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
12
+ const [matches2] = signal(false);
13
+ return { matches: matches2, dispose: () => {
14
+ } };
15
+ }
16
+ const mql = window.matchMedia(query);
17
+ const [matches, setMatches] = signal(mql.matches);
18
+ const handler = (event) => {
19
+ setMatches(event.matches);
20
+ };
21
+ mql.addEventListener("change", handler);
22
+ function dispose() {
23
+ mql.removeEventListener("change", handler);
24
+ }
25
+ return { matches, dispose };
26
+ }
27
+
28
+ // src/browser/resize.ts
29
+ function resolveTarget(target) {
30
+ return typeof target === "function" ? target : () => target.current;
31
+ }
32
+ function resize(target) {
33
+ const [width, setWidth] = signal(0);
34
+ const [height, setHeight] = signal(0);
35
+ let observer = null;
36
+ if (typeof window === "undefined" || typeof ResizeObserver === "undefined") {
37
+ return { width, height, dispose: () => {
38
+ } };
39
+ }
40
+ const getter = resolveTarget(target);
41
+ const cleanup = effect(() => {
42
+ const el = getter();
43
+ if (observer) {
44
+ observer.disconnect();
45
+ observer = null;
46
+ }
47
+ if (!el) return;
48
+ observer = new ResizeObserver((entries) => {
49
+ const entry = entries[0];
50
+ if (entry) {
51
+ batch(() => {
52
+ setWidth(entry.contentRect.width);
53
+ setHeight(entry.contentRect.height);
54
+ });
55
+ }
56
+ });
57
+ observer.observe(el);
58
+ });
59
+ function dispose() {
60
+ cleanup();
61
+ if (observer) {
62
+ observer.disconnect();
63
+ observer = null;
64
+ }
65
+ }
66
+ return { width, height, dispose };
67
+ }
68
+
69
+ // src/browser/scroll.ts
70
+ function scroll(target) {
71
+ const [x, setX] = signal(0);
72
+ const [y, setY] = signal(0);
73
+ const [isScrolling, setIsScrolling] = signal(false);
74
+ let scrollTimer = null;
75
+ if (typeof window === "undefined") {
76
+ return { x, y, isScrolling, dispose: () => {
77
+ } };
78
+ }
79
+ const handler = () => {
80
+ const el = target ? target() : null;
81
+ batch(() => {
82
+ if (el) {
83
+ setX(el.scrollLeft);
84
+ setY(el.scrollTop);
85
+ } else {
86
+ setX(window.scrollX ?? window.pageXOffset ?? 0);
87
+ setY(window.scrollY ?? window.pageYOffset ?? 0);
88
+ }
89
+ setIsScrolling(true);
90
+ });
91
+ if (scrollTimer !== null) clearTimeout(scrollTimer);
92
+ scrollTimer = setTimeout(() => {
93
+ setIsScrolling(false);
94
+ scrollTimer = null;
95
+ }, 150);
96
+ };
97
+ const scrollTarget = target ? target() : null;
98
+ const eventTarget = scrollTarget || window;
99
+ eventTarget.addEventListener("scroll", handler, { passive: true });
100
+ function dispose() {
101
+ eventTarget.removeEventListener("scroll", handler);
102
+ if (scrollTimer !== null) {
103
+ clearTimeout(scrollTimer);
104
+ scrollTimer = null;
105
+ }
106
+ }
107
+ return { x, y, isScrolling, dispose };
108
+ }
109
+
110
+ // src/browser/online.ts
111
+ function online() {
112
+ if (typeof window === "undefined" || typeof navigator === "undefined") {
113
+ const [online3] = signal(true);
114
+ return { online: online3, dispose: () => {
115
+ } };
116
+ }
117
+ const [online2, setOnline] = signal(navigator.onLine);
118
+ const onOnline = () => setOnline(true);
119
+ const onOffline = () => setOnline(false);
120
+ window.addEventListener("online", onOnline);
121
+ window.addEventListener("offline", onOffline);
122
+ function dispose() {
123
+ window.removeEventListener("online", onOnline);
124
+ window.removeEventListener("offline", onOffline);
125
+ }
126
+ return { online: online2, dispose };
127
+ }
128
+
129
+ // src/browser/geo.ts
130
+ function geo(options) {
131
+ const [latitude, setLatitude] = signal(null);
132
+ const [longitude, setLongitude] = signal(null);
133
+ const [accuracy, setAccuracy] = signal(null);
134
+ const [error, setError] = signal(null);
135
+ let watchId = null;
136
+ if (typeof navigator !== "undefined" && navigator.geolocation) {
137
+ watchId = navigator.geolocation.watchPosition(
138
+ (position) => {
139
+ batch(() => {
140
+ setLatitude(position.coords.latitude);
141
+ setLongitude(position.coords.longitude);
142
+ setAccuracy(position.coords.accuracy);
143
+ setError(null);
144
+ });
145
+ },
146
+ (err) => {
147
+ setError(err);
148
+ },
149
+ options
150
+ );
151
+ }
152
+ function dispose() {
153
+ if (watchId !== null && typeof navigator !== "undefined" && navigator.geolocation) {
154
+ navigator.geolocation.clearWatch(watchId);
155
+ watchId = null;
156
+ }
157
+ }
158
+ return { latitude, longitude, accuracy, error, dispose };
159
+ }
160
+
161
+ // src/browser/battery.ts
162
+ function battery() {
163
+ const [level, setLevel] = signal(null);
164
+ const [charging, setCharging] = signal(null);
165
+ const [chargingTime, setChargingTime] = signal(null);
166
+ const [dischargingTime, setDischargingTime] = signal(null);
167
+ const [supported, setSupported] = signal(false);
168
+ let battery2 = null;
169
+ let onLevelChange = null;
170
+ let onChargingChange = null;
171
+ let onChargingTimeChange = null;
172
+ let onDischargingTimeChange = null;
173
+ let disposed = false;
174
+ if (typeof navigator !== "undefined" && "getBattery" in navigator) {
175
+ setSupported(true);
176
+ navigator.getBattery().then((bm) => {
177
+ if (disposed) return;
178
+ battery2 = bm;
179
+ batch(() => {
180
+ setLevel(bm.level);
181
+ setCharging(bm.charging);
182
+ setChargingTime(bm.chargingTime);
183
+ setDischargingTime(bm.dischargingTime);
184
+ });
185
+ onLevelChange = () => setLevel(bm.level);
186
+ onChargingChange = () => setCharging(bm.charging);
187
+ onChargingTimeChange = () => setChargingTime(bm.chargingTime);
188
+ onDischargingTimeChange = () => setDischargingTime(bm.dischargingTime);
189
+ bm.addEventListener("levelchange", onLevelChange);
190
+ bm.addEventListener("chargingchange", onChargingChange);
191
+ bm.addEventListener("chargingtimechange", onChargingTimeChange);
192
+ bm.addEventListener("dischargingtimechange", onDischargingTimeChange);
193
+ });
194
+ }
195
+ function dispose() {
196
+ disposed = true;
197
+ if (battery2) {
198
+ if (onLevelChange) battery2.removeEventListener("levelchange", onLevelChange);
199
+ if (onChargingChange) battery2.removeEventListener("chargingchange", onChargingChange);
200
+ if (onChargingTimeChange) battery2.removeEventListener("chargingtimechange", onChargingTimeChange);
201
+ if (onDischargingTimeChange) battery2.removeEventListener("dischargingtimechange", onDischargingTimeChange);
202
+ battery2 = null;
203
+ }
204
+ }
205
+ return { level, charging, chargingTime, dischargingTime, supported, dispose };
206
+ }
207
+
208
+ // src/browser/idle.ts
209
+ var ACTIVITY_EVENTS = ["mousemove", "mousedown", "keydown", "touchstart", "scroll"];
210
+ function idle(timeout = 6e4) {
211
+ const [idle2, setIdle] = signal(false);
212
+ if (typeof window === "undefined" || typeof document === "undefined") {
213
+ return { idle: idle2, dispose: () => {
214
+ } };
215
+ }
216
+ let timer = null;
217
+ function resetTimer() {
218
+ setIdle(false);
219
+ if (timer !== null) clearTimeout(timer);
220
+ timer = setTimeout(() => {
221
+ setIdle(true);
222
+ }, timeout);
223
+ }
224
+ for (const event of ACTIVITY_EVENTS) {
225
+ document.addEventListener(event, resetTimer, { passive: true });
226
+ }
227
+ resetTimer();
228
+ function dispose() {
229
+ if (timer !== null) {
230
+ clearTimeout(timer);
231
+ timer = null;
232
+ }
233
+ for (const event of ACTIVITY_EVENTS) {
234
+ document.removeEventListener(event, resetTimer);
235
+ }
236
+ }
237
+ return { idle: idle2, dispose };
238
+ }
239
+
240
+ // src/browser/permissions.ts
241
+ function permissions(name) {
242
+ const [state, setState] = signal("prompt");
243
+ let permissionStatus = null;
244
+ let onChange = null;
245
+ let disposed = false;
246
+ if (typeof navigator === "undefined" || !navigator.permissions) {
247
+ setState("unsupported");
248
+ return { state, dispose: () => {
249
+ } };
250
+ }
251
+ navigator.permissions.query({ name }).then((status) => {
252
+ if (disposed) return;
253
+ permissionStatus = status;
254
+ setState(status.state);
255
+ onChange = () => {
256
+ setState(status.state);
257
+ };
258
+ status.addEventListener("change", onChange);
259
+ }).catch(() => {
260
+ setState("unsupported");
261
+ });
262
+ function dispose() {
263
+ disposed = true;
264
+ if (permissionStatus && onChange) {
265
+ permissionStatus.removeEventListener("change", onChange);
266
+ permissionStatus = null;
267
+ onChange = null;
268
+ }
269
+ }
270
+ return { state, dispose };
271
+ }
272
+
273
+ // src/browser/clipboard.ts
274
+ function clipboard() {
275
+ const [text, setText] = signal("");
276
+ const [copied, setCopied] = signal(false);
277
+ let copiedTimer = null;
278
+ async function copy(value) {
279
+ if (typeof navigator === "undefined" || !navigator.clipboard) {
280
+ return;
281
+ }
282
+ await navigator.clipboard.writeText(value);
283
+ setText(value);
284
+ setCopied(true);
285
+ if (copiedTimer !== null) clearTimeout(copiedTimer);
286
+ copiedTimer = setTimeout(() => {
287
+ setCopied(false);
288
+ copiedTimer = null;
289
+ }, 2e3);
290
+ }
291
+ function dispose() {
292
+ if (copiedTimer !== null) {
293
+ clearTimeout(copiedTimer);
294
+ copiedTimer = null;
295
+ }
296
+ }
297
+ return { text, copy, copied, dispose };
298
+ }
299
+
300
+ // src/browser/dragDrop.ts
301
+ function resolveTarget2(target) {
302
+ return typeof target === "function" ? target : () => target.current;
303
+ }
304
+ function draggable(element, data) {
305
+ const [isDragging, setIsDragging] = signal(false);
306
+ if (typeof window === "undefined") {
307
+ return { isDragging, dispose: () => {
308
+ } };
309
+ }
310
+ let currentEl = null;
311
+ let onDragStart = null;
312
+ let onDragEnd = null;
313
+ const getter = resolveTarget2(element);
314
+ const cleanup = effect(() => {
315
+ if (currentEl && onDragStart && onDragEnd) {
316
+ currentEl.removeEventListener("dragstart", onDragStart);
317
+ currentEl.removeEventListener("dragend", onDragEnd);
318
+ }
319
+ const el = getter();
320
+ currentEl = el;
321
+ if (!el) return;
322
+ el.draggable = true;
323
+ onDragStart = (e) => {
324
+ setIsDragging(true);
325
+ if (e.dataTransfer && data !== void 0) {
326
+ e.dataTransfer.setData("application/json", JSON.stringify(data));
327
+ }
328
+ };
329
+ onDragEnd = () => {
330
+ setIsDragging(false);
331
+ };
332
+ el.addEventListener("dragstart", onDragStart);
333
+ el.addEventListener("dragend", onDragEnd);
334
+ });
335
+ function dispose() {
336
+ cleanup();
337
+ if (currentEl && onDragStart && onDragEnd) {
338
+ currentEl.removeEventListener("dragstart", onDragStart);
339
+ currentEl.removeEventListener("dragend", onDragEnd);
340
+ currentEl = null;
341
+ }
342
+ }
343
+ return { isDragging, dispose };
344
+ }
345
+ function dropZone(element, options) {
346
+ const [isOver, setIsOver] = signal(false);
347
+ if (typeof window === "undefined") {
348
+ return { isOver, dispose: () => {
349
+ } };
350
+ }
351
+ let currentEl = null;
352
+ let onDragOver = null;
353
+ let onDragEnter = null;
354
+ let onDragLeave = null;
355
+ let onDrop = null;
356
+ const getter = resolveTarget2(element);
357
+ const cleanup = effect(() => {
358
+ if (currentEl && onDragOver && onDragEnter && onDragLeave && onDrop) {
359
+ currentEl.removeEventListener("dragover", onDragOver);
360
+ currentEl.removeEventListener("dragenter", onDragEnter);
361
+ currentEl.removeEventListener("dragleave", onDragLeave);
362
+ currentEl.removeEventListener("drop", onDrop);
363
+ }
364
+ const el = getter();
365
+ currentEl = el;
366
+ if (!el) return;
367
+ onDragOver = (e) => {
368
+ e.preventDefault();
369
+ };
370
+ onDragEnter = (e) => {
371
+ e.preventDefault();
372
+ setIsOver(true);
373
+ };
374
+ onDragLeave = () => {
375
+ setIsOver(false);
376
+ };
377
+ onDrop = (e) => {
378
+ e.preventDefault();
379
+ setIsOver(false);
380
+ let transferData = null;
381
+ if (e.dataTransfer) {
382
+ const raw = e.dataTransfer.getData("application/json");
383
+ if (raw) {
384
+ try {
385
+ transferData = JSON.parse(raw);
386
+ } catch {
387
+ transferData = raw;
388
+ }
389
+ }
390
+ }
391
+ options.onDrop(transferData, e);
392
+ };
393
+ el.addEventListener("dragover", onDragOver);
394
+ el.addEventListener("dragenter", onDragEnter);
395
+ el.addEventListener("dragleave", onDragLeave);
396
+ el.addEventListener("drop", onDrop);
397
+ });
398
+ function dispose() {
399
+ cleanup();
400
+ if (currentEl && onDragOver && onDragEnter && onDragLeave && onDrop) {
401
+ currentEl.removeEventListener("dragover", onDragOver);
402
+ currentEl.removeEventListener("dragenter", onDragEnter);
403
+ currentEl.removeEventListener("dragleave", onDragLeave);
404
+ currentEl.removeEventListener("drop", onDrop);
405
+ currentEl = null;
406
+ }
407
+ }
408
+ return { isOver, dispose };
409
+ }
410
+
411
+ // src/browser/title.ts
412
+ function title(value) {
413
+ if (typeof document === "undefined") {
414
+ return () => {
415
+ };
416
+ }
417
+ const previousTitle = document.title;
418
+ if (typeof value === "function") {
419
+ const cleanup = effect(() => {
420
+ document.title = value();
421
+ });
422
+ return () => {
423
+ cleanup();
424
+ document.title = previousTitle;
425
+ };
426
+ }
427
+ document.title = value;
428
+ return () => {
429
+ document.title = previousTitle;
430
+ };
431
+ }
432
+
433
+ // src/browser/colorScheme.ts
434
+ function colorScheme() {
435
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
436
+ const [scheme2] = signal("light");
437
+ return { scheme: scheme2, dispose: () => {
438
+ } };
439
+ }
440
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
441
+ const [scheme, setScheme] = signal(mql.matches ? "dark" : "light");
442
+ const handler = (event) => {
443
+ setScheme(event.matches ? "dark" : "light");
444
+ };
445
+ mql.addEventListener("change", handler);
446
+ function dispose() {
447
+ mql.removeEventListener("change", handler);
448
+ }
449
+ return { scheme, dispose };
450
+ }
451
+
452
+ // src/browser/format.ts
453
+ function formatNumber(value, options) {
454
+ const { locale, ...formatOptions } = options ?? {};
455
+ return new Intl.NumberFormat(locale, formatOptions).format(value);
456
+ }
457
+ function formatCurrency(value, currency, options) {
458
+ const { locale, ...formatOptions } = options ?? {};
459
+ return new Intl.NumberFormat(locale, {
460
+ style: "currency",
461
+ currency,
462
+ ...formatOptions
463
+ }).format(value);
464
+ }
465
+
466
+ export {
467
+ media,
468
+ resize,
469
+ scroll,
470
+ online,
471
+ geo,
472
+ battery,
473
+ idle,
474
+ permissions,
475
+ clipboard,
476
+ draggable,
477
+ dropZone,
478
+ title,
479
+ colorScheme,
480
+ formatNumber,
481
+ formatCurrency
482
+ };
package/dist/data.cjs CHANGED
@@ -45,7 +45,7 @@ module.exports = __toCommonJS(data_exports);
45
45
 
46
46
  // src/core/dev.ts
47
47
  function isDev() {
48
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
48
+ return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
49
49
  }
50
50
  var _isDev = isDev();
51
51
  function devAssert(condition, message) {
package/dist/data.js CHANGED
@@ -19,13 +19,13 @@ import {
19
19
  syncAdapter,
20
20
  throttle,
21
21
  withRetry
22
- } from "./chunk-QBMDLBU2.js";
23
- import "./chunk-Z65KYU7I.js";
24
- import "./chunk-FGOEVHY3.js";
25
- import "./chunk-PZEGYCF5.js";
22
+ } from "./chunk-Z6POF5YC.js";
23
+ import "./chunk-WR5D4EGH.js";
24
+ import "./chunk-L6JRBDNS.js";
25
+ import "./chunk-6SA3QQES.js";
26
26
  import "./chunk-CHJ27IGK.js";
27
- import "./chunk-YECR7UIA.js";
28
- import "./chunk-4MYMUBRS.js";
27
+ import "./chunk-V2XTI523.js";
28
+ import "./chunk-UNXCEF6S.js";
29
29
  import "./chunk-MLKGABMK.js";
30
30
  export {
31
31
  calculateDelay,
package/dist/devtools.cjs CHANGED
@@ -160,7 +160,7 @@ function checkLeaks() {
160
160
 
161
161
  // src/core/dev.ts
162
162
  function isDev() {
163
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
163
+ return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
164
164
  }
165
165
  var _isDev = isDev();
166
166
  function devAssert(condition, message) {
package/dist/devtools.js CHANGED
@@ -33,11 +33,11 @@ import {
33
33
  trackCleanup,
34
34
  walkDependencyGraph,
35
35
  withErrorTracking
36
- } from "./chunk-NMRUZALC.js";
37
- import "./chunk-PZEGYCF5.js";
36
+ } from "./chunk-7BF6TK55.js";
37
+ import "./chunk-6SA3QQES.js";
38
38
  import "./chunk-CHJ27IGK.js";
39
- import "./chunk-YECR7UIA.js";
40
- import "./chunk-4MYMUBRS.js";
39
+ import "./chunk-V2XTI523.js";
40
+ import "./chunk-UNXCEF6S.js";
41
41
  import "./chunk-MLKGABMK.js";
42
42
  export {
43
43
  SibuError,
@@ -33,7 +33,7 @@ module.exports = __toCommonJS(ecosystem_exports);
33
33
 
34
34
  // src/core/dev.ts
35
35
  function isDev() {
36
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
36
+ return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
37
37
  }
38
38
  var _isDev = isDev();
39
39
  function devAssert(condition, message) {
@@ -582,11 +582,11 @@ function bindChildNode(placeholder, getter) {
582
582
  if (_isDev5) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
583
583
  return;
584
584
  }
585
- for (let i = 0; i < lastNodes.length; i++) {
586
- const node = lastNodes[i];
587
- if (node.parentNode) node.parentNode.removeChild(node);
588
- }
589
585
  if (result == null || typeof result === "boolean") {
586
+ for (let i = 0; i < lastNodes.length; i++) {
587
+ const node = lastNodes[i];
588
+ if (node.parentNode) node.parentNode.removeChild(node);
589
+ }
590
590
  lastNodes.length = 0;
591
591
  return;
592
592
  }
@@ -595,24 +595,46 @@ function bindChildNode(placeholder, getter) {
595
595
  lastNodes.length = 0;
596
596
  return;
597
597
  }
598
- const anchor = placeholder.nextSibling;
599
- let count = 0;
598
+ let newNodes;
600
599
  if (Array.isArray(result)) {
601
- if (lastNodes.length < result.length) lastNodes = new Array(result.length);
600
+ newNodes = [];
602
601
  for (let i = 0; i < result.length; i++) {
603
602
  const item = result[i];
604
603
  if (item == null || typeof item === "boolean") continue;
605
- const node = item instanceof Node ? item : document.createTextNode(String(item));
606
- parent.insertBefore(node, anchor);
607
- lastNodes[count++] = node;
604
+ newNodes.push(item instanceof Node ? item : document.createTextNode(String(item)));
608
605
  }
609
606
  } else {
610
- if (lastNodes.length < 1) lastNodes = [null];
611
607
  const node = result instanceof Node ? result : document.createTextNode(String(result));
612
- parent.insertBefore(node, anchor);
613
- lastNodes[count++] = node;
608
+ newNodes = [node];
609
+ }
610
+ const reused = lastNodes.length > 0 && newNodes.length > 0 ? /* @__PURE__ */ new Set() : void 0;
611
+ if (reused) {
612
+ for (let i = 0; i < newNodes.length; i++) {
613
+ for (let j = 0; j < lastNodes.length; j++) {
614
+ if (newNodes[i] === lastNodes[j]) {
615
+ reused.add(newNodes[i]);
616
+ break;
617
+ }
618
+ }
619
+ }
614
620
  }
615
- lastNodes.length = count;
621
+ for (let i = 0; i < lastNodes.length; i++) {
622
+ const node = lastNodes[i];
623
+ if (reused?.has(node)) continue;
624
+ if (node.parentNode) node.parentNode.removeChild(node);
625
+ }
626
+ const anchor = placeholder.nextSibling;
627
+ for (let i = 0; i < newNodes.length; i++) {
628
+ const node = newNodes[i];
629
+ if (reused?.has(node) && node.parentNode === parent) {
630
+ if (node.nextSibling !== anchor) {
631
+ parent.insertBefore(node, anchor);
632
+ }
633
+ } else {
634
+ parent.insertBefore(node, anchor);
635
+ }
636
+ }
637
+ lastNodes = newNodes;
616
638
  }
617
639
  return track(commit);
618
640
  }
@@ -802,12 +824,18 @@ var tagFactory = (tag, ns) => (first, second) => {
802
824
  // already handled above / below
803
825
  default: {
804
826
  const value = props[key];
805
- if (value == null || value === false) continue;
827
+ if (value == null) continue;
806
828
  if (key[0] === "o" && key[1] === "n") continue;
807
829
  if (typeof value === "function") {
808
830
  registerDisposer(el, bindAttribute(el, key, value));
809
- } else if (value === true) {
810
- el.setAttribute(key, "");
831
+ } else if (typeof value === "boolean") {
832
+ if (key in el && (key === "checked" || key === "disabled" || key === "selected")) {
833
+ el[key] = value;
834
+ } else if (value) {
835
+ el.setAttribute(key, "");
836
+ } else {
837
+ el.removeAttribute(key);
838
+ }
811
839
  } else {
812
840
  const str = String(value);
813
841
  el.setAttribute(key, isUrlAttribute(key) ? sanitizeUrl(str) : str);
package/dist/ecosystem.js CHANGED
@@ -7,15 +7,15 @@ import {
7
7
  mobXAdapter,
8
8
  reduxAdapter,
9
9
  zustandAdapter
10
- } from "./chunk-G3BOQPVO.js";
10
+ } from "./chunk-OUZZEE4S.js";
11
11
  import "./chunk-K5ZUMYVS.js";
12
- import "./chunk-MDVXJWFN.js";
13
- import "./chunk-SDLZDHKP.js";
14
- import "./chunk-FGOEVHY3.js";
15
- import "./chunk-PZEGYCF5.js";
12
+ import "./chunk-B7SWRFUT.js";
13
+ import "./chunk-23VV7YD3.js";
14
+ import "./chunk-L6JRBDNS.js";
15
+ import "./chunk-6SA3QQES.js";
16
16
  import "./chunk-CHJ27IGK.js";
17
- import "./chunk-YECR7UIA.js";
18
- import "./chunk-4MYMUBRS.js";
17
+ import "./chunk-V2XTI523.js";
18
+ import "./chunk-UNXCEF6S.js";
19
19
  import "./chunk-MLKGABMK.js";
20
20
  export {
21
21
  antdAdapter,