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
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NodeChild, a as NodeChildren, T as TagProps } from './tagFactory-
|
|
2
|
-
export {
|
|
1
|
+
import { N as NodeChild, a as NodeChildren, T as TagProps, A as Accessor, D as DerivedAccessor } from './tagFactory-DVoDpHye.js';
|
|
2
|
+
export { b as Dispose, E as ExternalSource, S as SVG_NS, c as SignalOptions, d as derived, e as external, s as signal, t as tagFactory } from './tagFactory-DVoDpHye.js';
|
|
3
3
|
export { T as TrustedHTML, t as trustHTML } from './ssr-BiPRdZ6n.js';
|
|
4
4
|
import { R as ReactiveSignal } from './signal-BnWpq6WB.js';
|
|
5
5
|
|
|
@@ -667,12 +667,22 @@ declare function DynamicComponent(is: () => string | Component$1): HTMLElement;
|
|
|
667
667
|
* assigns that row a new item or position.
|
|
668
668
|
*
|
|
669
669
|
* Identity is not value freshness: a row keeps its DOM node when its key is
|
|
670
|
-
* unchanged, and
|
|
671
|
-
* replaced
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
*
|
|
670
|
+
* unchanged, and its bindings still update when the item behind that key is
|
|
671
|
+
* replaced — provided they read the getter rather than a value captured when
|
|
672
|
+
* `render` ran.
|
|
673
|
+
*
|
|
674
|
+
* `render` runs untracked, whether the row appears in the first pass or in a
|
|
675
|
+
* later update: a signal read directly in its body — `item()` and `index()`
|
|
676
|
+
* included — is a one-time read that never subscribes anything and goes stale
|
|
677
|
+
* when the key later receives a replacement item or moves. Pass the getters
|
|
678
|
+
* down (`Row({ item, index })`) or read them inside bindings
|
|
679
|
+
* (`() => item().name`) and effects created by the row.
|
|
680
|
+
*
|
|
681
|
+
* A binding that reads `item()` subscribes to the ROW's cell, not to the
|
|
682
|
+
* whole-array signal. `render` never re-runs for an existing key; only the
|
|
683
|
+
* bindings and effects that read that row's `item()` / `index()` re-run, and
|
|
684
|
+
* only when its own item or position actually changes — mutating an unrelated
|
|
685
|
+
* row does not disturb it.
|
|
676
686
|
*
|
|
677
687
|
* @param getArray A reactive getter returning an array.
|
|
678
688
|
* @param render A function that receives reactive item and index getters and returns a NodeChild.
|
|
@@ -1199,106 +1209,6 @@ type Slots = Record<string, SlotFn>;
|
|
|
1199
1209
|
*/
|
|
1200
1210
|
declare function getSlot(slots: Slots | undefined, name?: string): SlotFn | undefined;
|
|
1201
1211
|
|
|
1202
|
-
declare const __accessor: unique symbol;
|
|
1203
|
-
/**
|
|
1204
|
-
* A reactive signal getter returned by signal(), derived(), and similar primitives.
|
|
1205
|
-
*
|
|
1206
|
-
* Pass an Accessor directly into reactive prop positions — never call it there:
|
|
1207
|
-
* ```ts
|
|
1208
|
-
* const [count, setCount] = signal(0);
|
|
1209
|
-
*
|
|
1210
|
-
* div(count) // ✓ reactive — Accessor passed directly
|
|
1211
|
-
* div(() => count()) // ✓ reactive — explicit arrow wrapper
|
|
1212
|
-
* div(count()) // ✗ static — evaluated once, not reactive
|
|
1213
|
-
* ```
|
|
1214
|
-
*/
|
|
1215
|
-
type Accessor<T> = (() => T) & {
|
|
1216
|
-
readonly [__accessor]?: never;
|
|
1217
|
-
};
|
|
1218
|
-
type SetState<T> = (next: T | ((prev: T) => T)) => void;
|
|
1219
|
-
type StateTuple<T> = [Accessor<T>, SetState<T>];
|
|
1220
|
-
/** Options for signal */
|
|
1221
|
-
interface SignalOptions<T = unknown> {
|
|
1222
|
-
/** Debug name for devtools inspection. Only used in development. */
|
|
1223
|
-
name?: string;
|
|
1224
|
-
/** Custom equality function. Defaults to Object.is(). */
|
|
1225
|
-
equals?: (prev: T, next: T) => boolean;
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* signal creates a reactive signal that holds a value of type T.
|
|
1229
|
-
* Returns a tuple: [getter, setter].
|
|
1230
|
-
*
|
|
1231
|
-
* @param initial Initial value
|
|
1232
|
-
* @param options Optional config: `{ name: "count" }` for devtools labeling
|
|
1233
|
-
* @returns A `[getter, setter]` tuple. Calling the getter inside a reactive
|
|
1234
|
-
* context subscribes to the signal; the setter accepts a value or an updater.
|
|
1235
|
-
*/
|
|
1236
|
-
declare function signal<T>(initial: T, options?: SignalOptions<T>): StateTuple<T>;
|
|
1237
|
-
/**
|
|
1238
|
-
* A valueless reactive token standing in for state SibuJS does not own.
|
|
1239
|
-
*
|
|
1240
|
-
* See {@link external}.
|
|
1241
|
-
*/
|
|
1242
|
-
interface ExternalSource {
|
|
1243
|
-
/**
|
|
1244
|
-
* Declare, from inside a reactive computation, that it reads the external
|
|
1245
|
-
* state this source represents. Call it in the same places you would read a
|
|
1246
|
-
* signal — the top of a binding getter, a `derived()` body, an `effect()`.
|
|
1247
|
-
*
|
|
1248
|
-
* Outside a tracking context it is a no-op, exactly like reading a signal.
|
|
1249
|
-
*/
|
|
1250
|
-
track(): void;
|
|
1251
|
-
/**
|
|
1252
|
-
* Declare that the external state changed. Every consumer that called
|
|
1253
|
-
* {@link ExternalSource.track} is invalidated.
|
|
1254
|
-
*
|
|
1255
|
-
* Participates in `batch()` like any signal write: inside a batch, consumers
|
|
1256
|
-
* are notified once when the outermost batch flushes.
|
|
1257
|
-
*/
|
|
1258
|
-
invalidate(): void;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Create a reactive source for state that lives outside SibuJS — a domain
|
|
1262
|
-
* engine, a media element, a canvas scene, an editor document, a cache a
|
|
1263
|
-
* socket writes into.
|
|
1264
|
-
*
|
|
1265
|
-
* The pattern is two lines: `track()` where you read, `invalidate()` after you
|
|
1266
|
-
* mutate.
|
|
1267
|
-
*
|
|
1268
|
-
* ```ts
|
|
1269
|
-
* import { Chess } from "chess.js";
|
|
1270
|
-
* import { external } from "sibujs";
|
|
1271
|
-
*
|
|
1272
|
-
* const game = new Chess(); // owns the rules and the mutable state
|
|
1273
|
-
* const moved = external(); // owns "something changed"
|
|
1274
|
-
*
|
|
1275
|
-
* ctx.text("@status", () => {
|
|
1276
|
-
* moved.track(); // this binding reads the engine
|
|
1277
|
-
* return game.isCheckmate() ? "Checkmate" : `${game.turn()} to move`;
|
|
1278
|
-
* });
|
|
1279
|
-
*
|
|
1280
|
-
* game.move({ from: "e2", to: "e4" });
|
|
1281
|
-
* moved.invalidate(); // every consumer above re-reads
|
|
1282
|
-
* ```
|
|
1283
|
-
*
|
|
1284
|
-
* **One source is one invalidation domain.** Every consumer of a source
|
|
1285
|
-
* re-runs on every `invalidate()`, so the granularity of your updates is
|
|
1286
|
-
* exactly the granularity of your sources: one for a whole engine is the
|
|
1287
|
-
* cheapest to write, several (`board`, `clock`, `history`) let an update touch
|
|
1288
|
-
* only what it affects. See `docs/architecture/external-state.md` for the
|
|
1289
|
-
* trade-offs and when subdividing is worth it.
|
|
1290
|
-
*
|
|
1291
|
-
* Ownership, disposal and error routing are the consumer's, not the source's:
|
|
1292
|
-
* a disposed binding or effect is never invalidated, and a consumer that
|
|
1293
|
-
* throws is reported through the normal runtime error pipeline with its own
|
|
1294
|
-
* phase and node.
|
|
1295
|
-
*
|
|
1296
|
-
* @param options `name` labels the source in devtools (development only).
|
|
1297
|
-
*/
|
|
1298
|
-
declare function external(options?: {
|
|
1299
|
-
name?: string;
|
|
1300
|
-
}): ExternalSource;
|
|
1301
|
-
|
|
1302
1212
|
/**
|
|
1303
1213
|
* Reactive array hook. Provides common array operations that
|
|
1304
1214
|
* automatically trigger reactive updates.
|
|
@@ -1498,45 +1408,6 @@ declare function deepEqual(a: unknown, b: unknown, seen?: Map<object, Set<object
|
|
|
1498
1408
|
*/
|
|
1499
1409
|
declare function deepSignal<T>(initial: T): [Accessor<T>, (next: T | ((prev: T) => T)) => void];
|
|
1500
1410
|
|
|
1501
|
-
/**
|
|
1502
|
-
* derived creates a derived reactive signal whose value updates when dependencies change.
|
|
1503
|
-
*
|
|
1504
|
-
* Uses lazy pull-based evaluation with a single dirty flag:
|
|
1505
|
-
* - When a dependency changes, the computed is marked dirty (no re-evaluation).
|
|
1506
|
-
* - Dirtiness propagates downstream via propagateDirty.
|
|
1507
|
-
* - The getter only re-evaluates when actually read (pull-based).
|
|
1508
|
-
* - On re-evaluation, dependencies are re-tracked via retrack() so that
|
|
1509
|
-
* derived-of-derived chains propagate correctly without paying the full
|
|
1510
|
-
* Set-delete + re-add cost of track()'s cleanup phase.
|
|
1511
|
-
*
|
|
1512
|
-
* STABILIZATION — why a dirty flag is enough:
|
|
1513
|
-
*
|
|
1514
|
-
* A dirty computed does NOT imply a changed value. Downstream effects are
|
|
1515
|
-
* enqueued by `propagateDirty` at write time, before this computed has had a
|
|
1516
|
-
* chance to recompute and compare. Rather than adding a three-color
|
|
1517
|
-
* (CLEAN/CHECK/DIRTY) propagation pass — which an earlier revision measured as
|
|
1518
|
-
* a regression on every benchmark, because the extra state has nothing to skip
|
|
1519
|
-
* when values genuinely change — the engine settles the question lazily at
|
|
1520
|
-
* DRAIN time: `cs._validate` recomputes a dirty computed and `cs.__v` is bumped
|
|
1521
|
-
* ONLY when the new value differs under this computed's comparator. The
|
|
1522
|
-
* scheduler compares that version against what each subscriber last observed
|
|
1523
|
-
* and suppresses the run when nothing changed (see `depsChanged` in
|
|
1524
|
-
* ../../reactivity/track-core.ts).
|
|
1525
|
-
*
|
|
1526
|
-
* That keeps the cheap boolean dirty flag AND makes `equals` actually stop
|
|
1527
|
-
* propagation, with recomputation still fully lazy: `_validate` only ever runs
|
|
1528
|
-
* when an effect is genuinely about to observe the value.
|
|
1529
|
-
*
|
|
1530
|
-
* @returns An accessor for the computed value. It recomputes lazily on read
|
|
1531
|
-
* after any dependency changes.
|
|
1532
|
-
*/
|
|
1533
|
-
declare function derived<T>(getter: () => T, options?: {
|
|
1534
|
-
name?: string;
|
|
1535
|
-
/** Custom equality — when the recomputed value equals the previous,
|
|
1536
|
-
* downstream subscribers are not notified. Defaults to `Object.is`. */
|
|
1537
|
-
equals?: (a: T, b: T) => boolean;
|
|
1538
|
-
}): Accessor<T>;
|
|
1539
|
-
|
|
1540
1411
|
/** Options for effect */
|
|
1541
1412
|
interface EffectOptions {
|
|
1542
1413
|
/** Error handler for exceptions thrown during effect execution. */
|
|
@@ -1668,7 +1539,9 @@ declare function watch<T>(getter: () => T, callback: (value: T, prev: T | undefi
|
|
|
1668
1539
|
* dependency-tracked). The setter typically updates upstream signals,
|
|
1669
1540
|
* and the derived value recomputes on the next read.
|
|
1670
1541
|
*
|
|
1671
|
-
* Returns a `[getter, setter]` tuple, matching the `signal()` API.
|
|
1542
|
+
* Returns a `[getter, setter]` tuple, matching the `signal()` API. The getter
|
|
1543
|
+
* is the underlying `derived()` accessor, so `getter.dispose()` releases its
|
|
1544
|
+
* upstream subscriptions when the writable is discarded before its sources.
|
|
1672
1545
|
*
|
|
1673
1546
|
* @param get Computed getter — reads reactive dependencies
|
|
1674
1547
|
* @param set Setter — called with the new value, typically updates upstream signals
|
|
@@ -1695,11 +1568,11 @@ declare function watch<T>(getter: () => T, callback: (value: T, prev: T | undefi
|
|
|
1695
1568
|
* fullName(); // "Jane Smith"
|
|
1696
1569
|
* ```
|
|
1697
1570
|
*
|
|
1698
|
-
* @returns A
|
|
1571
|
+
* @returns A `[getter, setter]` tuple; the getter carries `dispose()`.
|
|
1699
1572
|
*/
|
|
1700
1573
|
declare function writable<T>(get: () => T, set: (value: T) => void, options?: {
|
|
1701
1574
|
name?: string;
|
|
1702
|
-
}): [
|
|
1575
|
+
}): [DerivedAccessor<T>, (value: T) => void];
|
|
1703
1576
|
|
|
1704
1577
|
/**
|
|
1705
1578
|
* SSR context for SibuJS.
|
|
@@ -2306,4 +2179,4 @@ declare const untracked: ReactiveApi["untracked"];
|
|
|
2306
2179
|
declare const retrack: ReactiveApi["retrack"];
|
|
2307
2180
|
declare const setMaxDrainIterations: ReactiveApi["setMaxDrainIterations"];
|
|
2308
2181
|
|
|
2309
|
-
export {
|
|
2182
|
+
export { Accessor, type ActionFn, type AnchorProps, type ArrayActions, type AsyncDerivedContext, type AsyncDerivedState, type AudioProps, type ButtonProps, type Context, DerivedAccessor, DynamicComponent, type EachBindings, type EachEventBindings, type EffectBody, type EffectOptions, type EnhanceContext, type EnhanceSetup, ErrorBoundary, type ErrorBoundaryOptions, type ErrorBoundaryProps, ErrorDisplay, type ErrorDisplayProps, type ErrorSeverity, type FormProps, Fragment, type ImgProps, type InputProps, type InputType, type IslandLoader, type IslandRegistration, type IslandStrategy, KeepAlive, type KeepAliveOptions, type LabelProps, type LazyIslandLoader, Loading, type LoadingProps, type LongPressOptions, MAX_DRAIN_TEARDOWNS, type MediaProps, type MountIslandsOptions, NodeChild, NodeChildren, type OnCleanup, type OptionProps, Portal, type Ref, type RuntimeErrorContext, type RuntimeErrorHandler, type RuntimeErrorPhase, type SSRStore, type SelectProps, type SlotFn, type Slots, type StoreActions, Suspense, type SuspenseProps, TagProps, type TextareaProps, type TypedTagFunction, type VideoProps, __resetIdCounter, a, abbr, action, address, area, array, article, aside, asyncDerived, audio, autoResize, b, base, batch, bdi, bdo, bindDynamic, blockquote, body, br, button, canvas, caption, catchError, catchErrorAsync, center, checkLeaks, circle, cite, clickOutside, clipPath, code, col, colgroup, context, copyOnClick, createId, customElement, data, datalist, dd, deepEqual, deepSignal, defer, defs, del, details, dfn, dialog, disableSSR, dispose, div, dl, dt, each, effect, ellipse, em, embed, enableSSR, enhance, enhanceAll, enqueueBatchedSignal, fieldset, figcaption, figure, font, footer, form, g, getAction, getRequestScopedCache, getRuntimeErrorHandler, getSSRStore, getSlot, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, isBatching, isSSR, kbd, label, lazy, lazyIsland, legend, li, line, linearGradient, link, longPress, main, map, mark, marker, marquee, mask, match, math, menu, meta, meter, mount, mountIslands, nav, nextTick, noscript, object, ol, on, onCleanup, onMount, onUnmount, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, portal, pre, progress, q, radialGradient, reactiveArray, rect, ref, registerAction, registerComponent, registerDisposer, registerIsland, replaceChildrenSafely, reportDrainRunaway, reportError, resolveComponent, retrack, rp, rt, ruby, runInSSRContext, s, samp, script, section, select, setGlobalErrorHandler, setMaxDrainIterations, setRuntimeErrorHandler, show, slot, small, source, span, stop, store, strict, strictEffect, strong, style, sub, summary, sup, svg, symbol, table, takePendingError, tbody, td, template, text, textarea, tfoot, th, thead, time, title, tr, track$1 as track, transition, trapFocus, tspan, u, ul, unregisterComponent, unregisterDisposer, unregisterIsland, untracked, use, var_, video, watch, when, withSSR, writable };
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
unregisterIsland,
|
|
53
53
|
when,
|
|
54
54
|
writable
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-S373NSMK.js";
|
|
56
56
|
import {
|
|
57
57
|
a,
|
|
58
58
|
abbr,
|
|
@@ -190,36 +190,36 @@ import {
|
|
|
190
190
|
use,
|
|
191
191
|
var_,
|
|
192
192
|
video
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-PCT43HW3.js";
|
|
194
194
|
import {
|
|
195
195
|
trustHTML
|
|
196
196
|
} from "./chunk-NIOYEGBQ.js";
|
|
197
197
|
import {
|
|
198
198
|
watch
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-7LN645I6.js";
|
|
200
200
|
import {
|
|
201
201
|
__resetIdCounter,
|
|
202
202
|
createId
|
|
203
203
|
} from "./chunk-CCSJMTRN.js";
|
|
204
204
|
import {
|
|
205
205
|
context
|
|
206
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-VUF4ALSW.js";
|
|
207
207
|
import {
|
|
208
208
|
SVG_NS,
|
|
209
209
|
tagFactory
|
|
210
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-KEISJXBU.js";
|
|
211
211
|
import {
|
|
212
212
|
bindDynamic
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-ONOHFDLG.js";
|
|
214
214
|
import {
|
|
215
215
|
derived
|
|
216
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-RBTPLM32.js";
|
|
217
217
|
import "./chunk-IXKSNWV5.js";
|
|
218
218
|
import "./chunk-7ZHH77QA.js";
|
|
219
219
|
import {
|
|
220
220
|
effect,
|
|
221
221
|
on
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-RIXRAYIU.js";
|
|
223
223
|
import {
|
|
224
224
|
disableSSR,
|
|
225
225
|
enableSSR,
|
|
@@ -244,12 +244,12 @@ import {
|
|
|
244
244
|
external,
|
|
245
245
|
isBatching,
|
|
246
246
|
signal
|
|
247
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-XZZOBQAY.js";
|
|
248
248
|
import {
|
|
249
249
|
retrack,
|
|
250
250
|
setMaxDrainIterations,
|
|
251
251
|
untracked
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-UGRX3S57.js";
|
|
253
253
|
import {
|
|
254
254
|
getRuntimeErrorHandler,
|
|
255
255
|
reportError,
|
package/dist/motion.cjs
CHANGED
|
@@ -391,6 +391,15 @@ function untracked(fn) {
|
|
|
391
391
|
var subscriberEpochCounter = 0;
|
|
392
392
|
function retrack(effectFn, subscriber) {
|
|
393
393
|
const prev = currentSubscriber;
|
|
394
|
+
let savedDepth = 0;
|
|
395
|
+
let savedSuspendSub = null;
|
|
396
|
+
if (trackingSuspended) {
|
|
397
|
+
savedDepth = suspendDepth;
|
|
398
|
+
savedSuspendSub = suspendSavedSub;
|
|
399
|
+
suspendDepth = 0;
|
|
400
|
+
suspendSavedSub = null;
|
|
401
|
+
trackingSuspended = false;
|
|
402
|
+
}
|
|
394
403
|
currentSubscriber = subscriber;
|
|
395
404
|
const sub = subscriber;
|
|
396
405
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -405,6 +414,11 @@ function retrack(effectFn, subscriber) {
|
|
|
405
414
|
effectFn();
|
|
406
415
|
} finally {
|
|
407
416
|
currentSubscriber = prev;
|
|
417
|
+
if (savedDepth !== 0) {
|
|
418
|
+
suspendDepth = savedDepth;
|
|
419
|
+
suspendSavedSub = savedSuspendSub;
|
|
420
|
+
trackingSuspended = true;
|
|
421
|
+
}
|
|
408
422
|
let node = sub.depsHead ?? null;
|
|
409
423
|
while (node !== null) {
|
|
410
424
|
const next = node.subNext;
|
|
@@ -424,11 +438,25 @@ function track(effectFn, subscriber) {
|
|
|
424
438
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
425
439
|
cleanup(subscriber);
|
|
426
440
|
const prev = currentSubscriber;
|
|
441
|
+
let savedDepth = 0;
|
|
442
|
+
let savedSuspendSub = null;
|
|
443
|
+
if (trackingSuspended) {
|
|
444
|
+
savedDepth = suspendDepth;
|
|
445
|
+
savedSuspendSub = suspendSavedSub;
|
|
446
|
+
suspendDepth = 0;
|
|
447
|
+
suspendSavedSub = null;
|
|
448
|
+
trackingSuspended = false;
|
|
449
|
+
}
|
|
427
450
|
currentSubscriber = subscriber;
|
|
428
451
|
try {
|
|
429
452
|
effectFn();
|
|
430
453
|
} finally {
|
|
431
454
|
currentSubscriber = prev;
|
|
455
|
+
if (savedDepth !== 0) {
|
|
456
|
+
suspendDepth = savedDepth;
|
|
457
|
+
suspendSavedSub = savedSuspendSub;
|
|
458
|
+
trackingSuspended = true;
|
|
459
|
+
}
|
|
432
460
|
const sub2 = subscriber;
|
|
433
461
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
434
462
|
const sig = n.sig;
|
|
@@ -599,8 +627,9 @@ function propagateDirty(sub) {
|
|
|
599
627
|
if (s._c) {
|
|
600
628
|
const nSig = s._sig;
|
|
601
629
|
if (nSig) {
|
|
602
|
-
if (!nSig._d) {
|
|
630
|
+
if (!nSig._d || nSig._f === true) {
|
|
603
631
|
nSig._d = true;
|
|
632
|
+
nSig._f = false;
|
|
604
633
|
stack.push(nSig);
|
|
605
634
|
}
|
|
606
635
|
} else {
|
|
@@ -700,7 +729,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
700
729
|
}
|
|
701
730
|
|
|
702
731
|
// src/reactivity/track.ts
|
|
703
|
-
var _runtimeVersion = true ? "4.
|
|
732
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
704
733
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
705
734
|
function resolveReactiveApi() {
|
|
706
735
|
const g = globalThis;
|
package/dist/motion.js
CHANGED
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
stagger,
|
|
21
21
|
transition,
|
|
22
22
|
viewTransition
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-B3WHI2QA.js";
|
|
24
24
|
import "./chunk-QKRPLZ2V.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-XZZOBQAY.js";
|
|
26
|
+
import "./chunk-UGRX3S57.js";
|
|
27
27
|
import "./chunk-2WLZ6757.js";
|
|
28
28
|
export {
|
|
29
29
|
TransitionGroup,
|
package/dist/patterns.cjs
CHANGED
|
@@ -294,6 +294,15 @@ function untracked(fn) {
|
|
|
294
294
|
var subscriberEpochCounter = 0;
|
|
295
295
|
function retrack(effectFn, subscriber) {
|
|
296
296
|
const prev = currentSubscriber;
|
|
297
|
+
let savedDepth = 0;
|
|
298
|
+
let savedSuspendSub = null;
|
|
299
|
+
if (trackingSuspended) {
|
|
300
|
+
savedDepth = suspendDepth;
|
|
301
|
+
savedSuspendSub = suspendSavedSub;
|
|
302
|
+
suspendDepth = 0;
|
|
303
|
+
suspendSavedSub = null;
|
|
304
|
+
trackingSuspended = false;
|
|
305
|
+
}
|
|
297
306
|
currentSubscriber = subscriber;
|
|
298
307
|
const sub = subscriber;
|
|
299
308
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -308,6 +317,11 @@ function retrack(effectFn, subscriber) {
|
|
|
308
317
|
effectFn();
|
|
309
318
|
} finally {
|
|
310
319
|
currentSubscriber = prev;
|
|
320
|
+
if (savedDepth !== 0) {
|
|
321
|
+
suspendDepth = savedDepth;
|
|
322
|
+
suspendSavedSub = savedSuspendSub;
|
|
323
|
+
trackingSuspended = true;
|
|
324
|
+
}
|
|
311
325
|
let node = sub.depsHead ?? null;
|
|
312
326
|
while (node !== null) {
|
|
313
327
|
const next = node.subNext;
|
|
@@ -327,11 +341,25 @@ function track(effectFn, subscriber) {
|
|
|
327
341
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
328
342
|
cleanup(subscriber);
|
|
329
343
|
const prev = currentSubscriber;
|
|
344
|
+
let savedDepth = 0;
|
|
345
|
+
let savedSuspendSub = null;
|
|
346
|
+
if (trackingSuspended) {
|
|
347
|
+
savedDepth = suspendDepth;
|
|
348
|
+
savedSuspendSub = suspendSavedSub;
|
|
349
|
+
suspendDepth = 0;
|
|
350
|
+
suspendSavedSub = null;
|
|
351
|
+
trackingSuspended = false;
|
|
352
|
+
}
|
|
330
353
|
currentSubscriber = subscriber;
|
|
331
354
|
try {
|
|
332
355
|
effectFn();
|
|
333
356
|
} finally {
|
|
334
357
|
currentSubscriber = prev;
|
|
358
|
+
if (savedDepth !== 0) {
|
|
359
|
+
suspendDepth = savedDepth;
|
|
360
|
+
suspendSavedSub = savedSuspendSub;
|
|
361
|
+
trackingSuspended = true;
|
|
362
|
+
}
|
|
335
363
|
const sub2 = subscriber;
|
|
336
364
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
337
365
|
const sig = n.sig;
|
|
@@ -502,8 +530,9 @@ function propagateDirty(sub) {
|
|
|
502
530
|
if (s._c) {
|
|
503
531
|
const nSig = s._sig;
|
|
504
532
|
if (nSig) {
|
|
505
|
-
if (!nSig._d) {
|
|
533
|
+
if (!nSig._d || nSig._f === true) {
|
|
506
534
|
nSig._d = true;
|
|
535
|
+
nSig._f = false;
|
|
507
536
|
stack.push(nSig);
|
|
508
537
|
}
|
|
509
538
|
} else {
|
|
@@ -603,7 +632,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
603
632
|
}
|
|
604
633
|
|
|
605
634
|
// src/reactivity/track.ts
|
|
606
|
-
var _runtimeVersion = true ? "4.
|
|
635
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
607
636
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
608
637
|
function resolveReactiveApi() {
|
|
609
638
|
const g = globalThis;
|
|
@@ -1390,10 +1419,14 @@ function derived(getter, options) {
|
|
|
1390
1419
|
const cs = {};
|
|
1391
1420
|
cs._d = false;
|
|
1392
1421
|
cs._init = false;
|
|
1422
|
+
cs._f = false;
|
|
1393
1423
|
cs._g = getter;
|
|
1394
1424
|
cs.__v = 0;
|
|
1425
|
+
let evaluating = false;
|
|
1426
|
+
let disposed = false;
|
|
1427
|
+
let pendingError;
|
|
1395
1428
|
const markDirty = () => {
|
|
1396
|
-
if (cs._d) return;
|
|
1429
|
+
if (cs._d || disposed) return;
|
|
1397
1430
|
cs._d = true;
|
|
1398
1431
|
};
|
|
1399
1432
|
markDirty._c = 1;
|
|
@@ -1416,33 +1449,53 @@ function derived(getter, options) {
|
|
|
1416
1449
|
}
|
|
1417
1450
|
}, markDirty);
|
|
1418
1451
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1419
|
-
let evaluating = false;
|
|
1420
1452
|
const validate = () => {
|
|
1421
|
-
if (!cs._d) return;
|
|
1453
|
+
if (!cs._d || disposed || pendingError !== void 0) return;
|
|
1422
1454
|
const oldValue = cs._v;
|
|
1423
1455
|
evaluating = true;
|
|
1424
1456
|
try {
|
|
1425
1457
|
retrack2(recompute, markDirty);
|
|
1426
1458
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
1459
|
+
} catch (err) {
|
|
1460
|
+
pendingError = { error: err };
|
|
1461
|
+
cs.__v++;
|
|
1462
|
+
if (disposed) cs._d = true;
|
|
1463
|
+
else cs._f = true;
|
|
1427
1464
|
} finally {
|
|
1428
1465
|
evaluating = false;
|
|
1466
|
+
if (disposed) cleanup2(markDirty);
|
|
1429
1467
|
}
|
|
1430
|
-
if (hook && !Object.is(oldValue, cs._v)) {
|
|
1468
|
+
if (hook && !disposed && !Object.is(oldValue, cs._v)) {
|
|
1431
1469
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
1432
1470
|
}
|
|
1433
1471
|
};
|
|
1434
1472
|
cs._validate = validate;
|
|
1473
|
+
const throwPending = () => {
|
|
1474
|
+
const { error } = pendingError;
|
|
1475
|
+
pendingError = void 0;
|
|
1476
|
+
if (disposed) cs._d = false;
|
|
1477
|
+
throw error;
|
|
1478
|
+
};
|
|
1435
1479
|
function computedGetter() {
|
|
1436
1480
|
if (evaluating) {
|
|
1437
1481
|
throw new Error(
|
|
1438
1482
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
1439
1483
|
);
|
|
1440
1484
|
}
|
|
1441
|
-
if (isTrackingSuspended2()) {
|
|
1442
|
-
if (cs._d)
|
|
1485
|
+
if (isTrackingSuspended2() || disposed) {
|
|
1486
|
+
if (cs._d) {
|
|
1487
|
+
validate();
|
|
1488
|
+
if (pendingError !== void 0) throwPending();
|
|
1489
|
+
}
|
|
1443
1490
|
return cs._v;
|
|
1444
1491
|
}
|
|
1445
|
-
if (cs._d)
|
|
1492
|
+
if (cs._d) {
|
|
1493
|
+
validate();
|
|
1494
|
+
if (pendingError !== void 0) {
|
|
1495
|
+
recordDependency2(cs);
|
|
1496
|
+
throwPending();
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1446
1499
|
recordDependency2(cs);
|
|
1447
1500
|
return cs._v;
|
|
1448
1501
|
}
|
|
@@ -1451,6 +1504,19 @@ function derived(getter, options) {
|
|
|
1451
1504
|
cs.__name = debugName;
|
|
1452
1505
|
}
|
|
1453
1506
|
computedGetter.__signal = cs;
|
|
1507
|
+
computedGetter.dispose = () => {
|
|
1508
|
+
if (disposed) return;
|
|
1509
|
+
disposed = true;
|
|
1510
|
+
cs._d = pendingError !== void 0;
|
|
1511
|
+
cleanup2(markDirty);
|
|
1512
|
+
const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1513
|
+
if (h) {
|
|
1514
|
+
try {
|
|
1515
|
+
h.emit("computed:destroy", { signal: cs, getter: computedGetter });
|
|
1516
|
+
} catch {
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1454
1520
|
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
1455
1521
|
return computedGetter;
|
|
1456
1522
|
}
|
|
@@ -1503,7 +1569,12 @@ function timeline(initial, maxHistory = 100) {
|
|
|
1503
1569
|
setIndex(targetIndex);
|
|
1504
1570
|
}
|
|
1505
1571
|
}
|
|
1506
|
-
|
|
1572
|
+
function dispose() {
|
|
1573
|
+
value.dispose();
|
|
1574
|
+
canUndo.dispose();
|
|
1575
|
+
canRedo.dispose();
|
|
1576
|
+
}
|
|
1577
|
+
return { value, set, undo, redo, canUndo, canRedo, history, index, reset, jumpTo, dispose };
|
|
1507
1578
|
}
|
|
1508
1579
|
|
|
1509
1580
|
// src/patterns/globalStore.ts
|
|
@@ -1701,31 +1772,39 @@ var validators = {
|
|
|
1701
1772
|
};
|
|
1702
1773
|
function validateProps(props, schema) {
|
|
1703
1774
|
const result = { ...props };
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1775
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
1776
|
+
const errors = [];
|
|
1777
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
1778
|
+
const propDef = typeof def === "function" ? { type: def } : def;
|
|
1779
|
+
if (result[key] == null && propDef.default !== void 0) {
|
|
1780
|
+
result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
|
|
1781
|
+
}
|
|
1782
|
+
if (propDef.required && result[key] == null) {
|
|
1783
|
+
errors.push(`Prop '${key}' is required`);
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
if (result[key] == null) continue;
|
|
1787
|
+
if (propDef.type) {
|
|
1788
|
+
const typeResult = propDef.type(result[key], key);
|
|
1789
|
+
if (typeResult !== true) errors.push(typeResult);
|
|
1790
|
+
}
|
|
1791
|
+
if (propDef.validator) {
|
|
1792
|
+
const validResult = propDef.validator(result[key], key);
|
|
1793
|
+
if (validResult !== true) errors.push(validResult);
|
|
1794
|
+
}
|
|
1720
1795
|
}
|
|
1721
|
-
if (
|
|
1722
|
-
|
|
1723
|
-
|
|
1796
|
+
if (errors.length > 0) {
|
|
1797
|
+
devWarn(`Prop validation errors:
|
|
1798
|
+
${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
1724
1799
|
}
|
|
1800
|
+
return result;
|
|
1725
1801
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1802
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
1803
|
+
if (typeof def === "function") continue;
|
|
1804
|
+
const fallback = def.default;
|
|
1805
|
+
if (result[key] == null && fallback !== void 0) {
|
|
1806
|
+
result[key] = typeof fallback === "function" ? fallback() : fallback;
|
|
1807
|
+
}
|
|
1729
1808
|
}
|
|
1730
1809
|
return result;
|
|
1731
1810
|
}
|
|
@@ -1736,10 +1815,11 @@ function defineStrictComponent(config) {
|
|
|
1736
1815
|
};
|
|
1737
1816
|
}
|
|
1738
1817
|
function assertType(value, validator, label) {
|
|
1739
|
-
if (typeof
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1818
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
1819
|
+
const result = validator(value, label || "value");
|
|
1820
|
+
if (result !== true) {
|
|
1821
|
+
throw new TypeError(`[SibuJS Contract] ${result}`);
|
|
1822
|
+
}
|
|
1743
1823
|
}
|
|
1744
1824
|
}
|
|
1745
1825
|
function createGuard(validator) {
|
package/dist/patterns.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-
|
|
1
|
+
export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-DBdg9J_a.cjs';
|
|
2
2
|
|
|
3
3
|
interface MachineConfig<S extends string, E extends string, C extends object = Record<string, unknown>> {
|
|
4
4
|
initial: S;
|
|
@@ -202,6 +202,11 @@ interface TimeTravelReturn<T> {
|
|
|
202
202
|
index: () => number;
|
|
203
203
|
reset: () => void;
|
|
204
204
|
jumpTo: (index: number) => void;
|
|
205
|
+
/**
|
|
206
|
+
* Dispose the internal `value`, `canUndo` and `canRedo` deriveds and remove
|
|
207
|
+
* them from DevTools. Afterwards they return their last values. Idempotent.
|
|
208
|
+
*/
|
|
209
|
+
dispose: () => void;
|
|
205
210
|
}
|
|
206
211
|
/**
|
|
207
212
|
* timeline wraps a state value with undo/redo history.
|