@graphrefly/graphrefly 0.25.0 → 0.27.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 +8 -0
- package/dist/ai-CaR_912Q.d.cts +1033 -0
- package/dist/ai-WlRltJV7.d.ts +1033 -0
- package/dist/audit-ClmqGOCx.d.cts +245 -0
- package/dist/audit-DRlSzBu9.d.ts +245 -0
- package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
- package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
- package/dist/chunk-APFNLIRG.js +62 -0
- package/dist/chunk-APFNLIRG.js.map +1 -0
- package/dist/chunk-AT5LKYNL.js +395 -0
- package/dist/chunk-AT5LKYNL.js.map +1 -0
- package/dist/{chunk-IAHGTNOZ.js → chunk-BQ6RQQFF.js} +351 -2095
- package/dist/chunk-BQ6RQQFF.js.map +1 -0
- package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
- package/dist/chunk-BVZYTZ5H.js.map +1 -0
- package/dist/{chunk-EVR6UFUV.js → chunk-DST5DKZS.js} +19 -15
- package/dist/{chunk-EVR6UFUV.js.map → chunk-DST5DKZS.js.map} +1 -1
- package/dist/{chunk-TKE3JGOH.js → chunk-GTE6PWRZ.js} +5 -692
- package/dist/chunk-GTE6PWRZ.js.map +1 -0
- package/dist/chunk-HXZEYDUR.js +94 -0
- package/dist/chunk-HXZEYDUR.js.map +1 -0
- package/dist/chunk-J22W6HV3.js +107 -0
- package/dist/chunk-J22W6HV3.js.map +1 -0
- package/dist/{chunk-PY4XCDLR.js → chunk-J2VBW3DZ.js} +6 -95
- package/dist/chunk-J2VBW3DZ.js.map +1 -0
- package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
- package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
- package/dist/chunk-JWBCY4NC.js +330 -0
- package/dist/chunk-JWBCY4NC.js.map +1 -0
- package/dist/chunk-K2AUJHVP.js +2251 -0
- package/dist/chunk-K2AUJHVP.js.map +1 -0
- package/dist/chunk-MJ2NKQQL.js +119 -0
- package/dist/chunk-MJ2NKQQL.js.map +1 -0
- package/dist/chunk-N6UR7YVY.js +198 -0
- package/dist/chunk-N6UR7YVY.js.map +1 -0
- package/dist/chunk-NC6S43JJ.js +456 -0
- package/dist/chunk-NC6S43JJ.js.map +1 -0
- package/dist/chunk-OFVJBJXR.js +98 -0
- package/dist/chunk-OFVJBJXR.js.map +1 -0
- package/dist/chunk-OHISZPOJ.js +97 -0
- package/dist/chunk-OHISZPOJ.js.map +1 -0
- package/dist/chunk-OU5CQKNW.js +102 -0
- package/dist/chunk-OU5CQKNW.js.map +1 -0
- package/dist/{chunk-XOFWRC73.js → chunk-PF7GRZMW.js} +316 -21
- package/dist/chunk-PF7GRZMW.js.map +1 -0
- package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
- package/dist/chunk-PHOUUNK7.js.map +1 -0
- package/dist/chunk-RNHBMHKA.js +1665 -0
- package/dist/chunk-RNHBMHKA.js.map +1 -0
- package/dist/chunk-SX52TAR4.js +110 -0
- package/dist/chunk-SX52TAR4.js.map +1 -0
- package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
- package/dist/chunk-WBZOVTYK.js +171 -0
- package/dist/chunk-WBZOVTYK.js.map +1 -0
- package/dist/chunk-WKNUIZOY.js +354 -0
- package/dist/chunk-WKNUIZOY.js.map +1 -0
- package/dist/chunk-X3VMZYBT.js +713 -0
- package/dist/chunk-X3VMZYBT.js.map +1 -0
- package/dist/chunk-X5R3GL6H.js +525 -0
- package/dist/chunk-X5R3GL6H.js.map +1 -0
- package/dist/chunk-XGPU467M.js +136 -0
- package/dist/chunk-XGPU467M.js.map +1 -0
- package/dist/compat/index.cjs +7656 -0
- package/dist/compat/index.cjs.map +1 -0
- package/dist/compat/index.d.cts +18 -0
- package/dist/compat/index.d.ts +18 -0
- package/dist/compat/index.js +50 -0
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/jotai/index.cjs +2048 -0
- package/dist/compat/jotai/index.cjs.map +1 -0
- package/dist/compat/jotai/index.d.cts +2 -0
- package/dist/compat/jotai/index.d.ts +2 -0
- package/dist/compat/jotai/index.js +9 -0
- package/dist/compat/jotai/index.js.map +1 -0
- package/dist/compat/nanostores/index.cjs +2175 -0
- package/dist/compat/nanostores/index.cjs.map +1 -0
- package/dist/compat/nanostores/index.d.cts +2 -0
- package/dist/compat/nanostores/index.d.ts +2 -0
- package/dist/compat/nanostores/index.js +23 -0
- package/dist/compat/nanostores/index.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +350 -16
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +6 -6
- package/dist/compat/nestjs/index.d.ts +6 -6
- package/dist/compat/nestjs/index.js +11 -9
- package/dist/compat/react/index.cjs +141 -0
- package/dist/compat/react/index.cjs.map +1 -0
- package/dist/compat/react/index.d.cts +2 -0
- package/dist/compat/react/index.d.ts +2 -0
- package/dist/compat/react/index.js +12 -0
- package/dist/compat/react/index.js.map +1 -0
- package/dist/compat/solid/index.cjs +128 -0
- package/dist/compat/solid/index.cjs.map +1 -0
- package/dist/compat/solid/index.d.cts +2 -0
- package/dist/compat/solid/index.d.ts +2 -0
- package/dist/compat/solid/index.js +12 -0
- package/dist/compat/solid/index.js.map +1 -0
- package/dist/compat/svelte/index.cjs +131 -0
- package/dist/compat/svelte/index.cjs.map +1 -0
- package/dist/compat/svelte/index.d.cts +2 -0
- package/dist/compat/svelte/index.d.ts +2 -0
- package/dist/compat/svelte/index.js +12 -0
- package/dist/compat/svelte/index.js.map +1 -0
- package/dist/compat/vue/index.cjs +146 -0
- package/dist/compat/vue/index.cjs.map +1 -0
- package/dist/compat/vue/index.d.cts +3 -0
- package/dist/compat/vue/index.d.ts +3 -0
- package/dist/compat/vue/index.js +12 -0
- package/dist/compat/vue/index.js.map +1 -0
- package/dist/compat/zustand/index.cjs +4931 -0
- package/dist/compat/zustand/index.cjs.map +1 -0
- package/dist/compat/zustand/index.d.cts +5 -0
- package/dist/compat/zustand/index.d.ts +5 -0
- package/dist/compat/zustand/index.js +12 -0
- package/dist/compat/zustand/index.js.map +1 -0
- package/dist/composite-C7PcQvcs.d.cts +303 -0
- package/dist/composite-aUCvjZVR.d.ts +303 -0
- package/dist/core/index.cjs +53 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js +26 -24
- package/dist/demo-shell-BDkOptd6.d.ts +102 -0
- package/dist/demo-shell-Crid1WdR.d.cts +102 -0
- package/dist/extra/index.cjs +222 -110
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +6 -4
- package/dist/extra/index.d.ts +6 -4
- package/dist/extra/index.js +72 -65
- package/dist/extra/sources.cjs +2486 -0
- package/dist/extra/sources.cjs.map +1 -0
- package/dist/extra/sources.d.cts +465 -0
- package/dist/extra/sources.d.ts +465 -0
- package/dist/extra/sources.js +57 -0
- package/dist/extra/sources.js.map +1 -0
- package/dist/graph/index.cjs +408 -14
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +5 -5
- package/dist/graph/index.d.ts +5 -5
- package/dist/graph/index.js +13 -5
- package/dist/{graph-D-3JIQme.d.cts → graph-CCwGKLCm.d.ts} +195 -4
- package/dist/{graph-B6NFqv3z.d.ts → graph-DNCrvZSn.d.cts} +195 -4
- package/dist/index-3lsddbbS.d.ts +86 -0
- package/dist/index-B1tloyhO.d.cts +34 -0
- package/dist/{index-CYkjxu3s.d.ts → index-B6D3QNSA.d.ts} +33 -4
- package/dist/index-B6EhDnjH.d.cts +37 -0
- package/dist/index-B9B7_HEY.d.ts +37 -0
- package/dist/{index-Ds23Wvou.d.ts → index-BHlKbUwO.d.cts} +131 -883
- package/dist/{index-DiobMNwE.d.ts → index-BPVt8kqc.d.ts} +3 -3
- package/dist/index-BaSM3aYt.d.ts +195 -0
- package/dist/index-BuEoe-Qu.d.ts +121 -0
- package/dist/{index-Ch0IpIO0.d.cts → index-BwfLUNw4.d.ts} +131 -883
- package/dist/index-ByQxazQJ.d.cts +86 -0
- package/dist/index-C0svESO4.d.ts +127 -0
- package/dist/{index-OXImXMq6.d.ts → index-C8oil6M6.d.ts} +18 -196
- package/dist/{index-DKE1EATr.d.cts → index-CI3DprxP.d.cts} +18 -196
- package/dist/{index-AMWewNDe.d.cts → index-CO8uBlUh.d.cts} +33 -4
- package/dist/index-CxFrXH4m.d.ts +45 -0
- package/dist/index-D8wS_PeY.d.cts +121 -0
- package/dist/index-DO_6JN9Z.d.cts +127 -0
- package/dist/index-DVGiGFGT.d.cts +195 -0
- package/dist/index-DYme44FM.d.cts +44 -0
- package/dist/{index-J7Kc0oIQ.d.cts → index-DlLp-2Xn.d.cts} +3 -3
- package/dist/index-Dzk2hrlR.d.ts +44 -0
- package/dist/index-VHqptjhu.d.cts +45 -0
- package/dist/index-VdHQMPy1.d.ts +36 -0
- package/dist/index-Xi3u0HCQ.d.cts +36 -0
- package/dist/index-wEn0eFe8.d.ts +34 -0
- package/dist/index.cjs +1780 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +784 -2082
- package/dist/index.d.ts +784 -2082
- package/dist/index.js +955 -4349
- package/dist/index.js.map +1 -1
- package/dist/memory-C6Z2tGpC.d.cts +139 -0
- package/dist/memory-li6FL5RM.d.ts +139 -0
- package/dist/messaging-Gt4LPbyA.d.cts +269 -0
- package/dist/messaging-XDoYablx.d.ts +269 -0
- package/dist/{meta-DWbkoq1s.d.cts → meta-BxCA7rcr.d.cts} +1 -1
- package/dist/{meta-CnkLA_43.d.ts → meta-CbznRPYJ.d.ts} +1 -1
- package/dist/{node-B-f-Lu-k.d.cts → node-BmerH3kS.d.cts} +26 -1
- package/dist/{node-B-f-Lu-k.d.ts → node-BmerH3kS.d.ts} +26 -1
- package/dist/{observable-uP-wy_uK.d.ts → observable-BgGUwcqp.d.ts} +1 -1
- package/dist/{observable-DBnrwcar.d.cts → observable-DJt_AxzQ.d.cts} +1 -1
- package/dist/patterns/ai.cjs +7930 -0
- package/dist/patterns/ai.cjs.map +1 -0
- package/dist/patterns/ai.d.cts +10 -0
- package/dist/patterns/ai.d.ts +10 -0
- package/dist/patterns/ai.js +71 -0
- package/dist/patterns/ai.js.map +1 -0
- package/dist/patterns/audit.cjs +5805 -0
- package/dist/patterns/audit.cjs.map +1 -0
- package/dist/patterns/audit.d.cts +6 -0
- package/dist/patterns/audit.d.ts +6 -0
- package/dist/patterns/audit.js +29 -0
- package/dist/patterns/audit.js.map +1 -0
- package/dist/patterns/demo-shell.cjs +5604 -0
- package/dist/patterns/demo-shell.cjs.map +1 -0
- package/dist/patterns/demo-shell.d.cts +6 -0
- package/dist/patterns/demo-shell.d.ts +6 -0
- package/dist/patterns/demo-shell.js +15 -0
- package/dist/patterns/demo-shell.js.map +1 -0
- package/dist/patterns/memory.cjs +5283 -0
- package/dist/patterns/memory.cjs.map +1 -0
- package/dist/patterns/memory.d.cts +5 -0
- package/dist/patterns/memory.d.ts +5 -0
- package/dist/patterns/memory.js +20 -0
- package/dist/patterns/memory.js.map +1 -0
- package/dist/patterns/reactive-layout/index.cjs +355 -13
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +6 -5
- package/dist/patterns/reactive-layout/index.d.ts +6 -5
- package/dist/patterns/reactive-layout/index.js +15 -12
- package/dist/reactive-layout-MQP--J3F.d.cts +183 -0
- package/dist/reactive-layout-u5Ulnqag.d.ts +183 -0
- package/dist/{storage-BuTdpCI1.d.cts → storage-CMjUUuxn.d.ts} +10 -2
- package/dist/{storage-F2X1U1x0.d.ts → storage-DdWlZo6U.d.cts} +10 -2
- package/dist/sugar-CCOxXK1e.d.ts +201 -0
- package/dist/sugar-D02n5JjF.d.cts +201 -0
- package/package.json +63 -3
- package/dist/chunk-5DJTTKX3.js.map +0 -1
- package/dist/chunk-IAHGTNOZ.js.map +0 -1
- package/dist/chunk-L2GLW2U7.js.map +0 -1
- package/dist/chunk-MW4VAKAO.js +0 -47
- package/dist/chunk-MW4VAKAO.js.map +0 -1
- package/dist/chunk-PY4XCDLR.js.map +0 -1
- package/dist/chunk-TKE3JGOH.js.map +0 -1
- package/dist/chunk-XOFWRC73.js.map +0 -1
- package/dist/index-BJB7t9gg.d.cts +0 -392
- package/dist/index-C-TXEa7C.d.ts +0 -392
- /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { N as Node } from './node-BmerH3kS.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating an atom.
|
|
5
|
+
*
|
|
6
|
+
* @category compat
|
|
7
|
+
*/
|
|
8
|
+
interface AtomOptions {
|
|
9
|
+
/** Optional identifier for the underlying node. */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Optional companion meta nodes. */
|
|
12
|
+
meta?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A read-only Jotai-compatible atom.
|
|
16
|
+
*
|
|
17
|
+
* @category compat
|
|
18
|
+
*/
|
|
19
|
+
interface ReadableAtom<T> {
|
|
20
|
+
/** Returns the current cached value. */
|
|
21
|
+
get(): T;
|
|
22
|
+
/** Subscribes to value changes. Returns an unsubscribe function. */
|
|
23
|
+
subscribe(callback: (value: T) => void): () => void;
|
|
24
|
+
/** Access to companion meta nodes. */
|
|
25
|
+
readonly meta: Record<string, Node>;
|
|
26
|
+
/** @internal The underlying GraphReFly node. */
|
|
27
|
+
_node: Node<T>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A writable Jotai-compatible atom.
|
|
31
|
+
*
|
|
32
|
+
* @category compat
|
|
33
|
+
*/
|
|
34
|
+
interface WritableAtom<T> extends ReadableAtom<T> {
|
|
35
|
+
/** Sets a new value. */
|
|
36
|
+
set(value: T): void;
|
|
37
|
+
/** Updates the value using a transformation function. */
|
|
38
|
+
update(fn: (current: T) => T): void;
|
|
39
|
+
}
|
|
40
|
+
/** Function type for reading other atoms inside a derived atom. */
|
|
41
|
+
type GetFn = <V>(a: ReadableAtom<V>) => V;
|
|
42
|
+
/** Function type for writing to other atoms inside a writable derived atom. */
|
|
43
|
+
type SetFn = <V>(a: WritableAtom<V>, value: V) => void;
|
|
44
|
+
/** Function that computes the atom's value. */
|
|
45
|
+
type ReadFn<T> = (get: GetFn) => T;
|
|
46
|
+
/** Function that handles writes to the atom. */
|
|
47
|
+
type WriteFn<T> = (get: GetFn, set: SetFn, value: T) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a Jotai-compatible atom built on GraphReFly primitives.
|
|
50
|
+
*
|
|
51
|
+
* Supports three overloads:
|
|
52
|
+
* 1. `atom(initial)` — Writable primitive atom (wraps `state()`).
|
|
53
|
+
* 2. `atom(read)` — Read-only derived atom (wraps `dynamicNode()`).
|
|
54
|
+
* 3. `atom(read, write)` — Writable derived atom.
|
|
55
|
+
*
|
|
56
|
+
* @param initialOrRead - Initial value or a read function.
|
|
57
|
+
* @param writeOrOptions - Write function or options object.
|
|
58
|
+
* @param options - Optional configuration.
|
|
59
|
+
* @returns WritableAtom or ReadableAtom.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const count = atom(0);
|
|
64
|
+
* count.set(1);
|
|
65
|
+
* const doubled = atom((get) => get(count)! * 2);
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @category compat
|
|
69
|
+
*/
|
|
70
|
+
declare function atom<T>(initial: T, options?: AtomOptions): WritableAtom<T>;
|
|
71
|
+
declare function atom<T>(read: ReadFn<T>, options?: AtomOptions): ReadableAtom<T>;
|
|
72
|
+
declare function atom<T>(read: ReadFn<T>, write: WriteFn<T>, options?: AtomOptions): WritableAtom<T>;
|
|
73
|
+
|
|
74
|
+
type index_AtomOptions = AtomOptions;
|
|
75
|
+
type index_GetFn = GetFn;
|
|
76
|
+
type index_ReadFn<T> = ReadFn<T>;
|
|
77
|
+
type index_ReadableAtom<T> = ReadableAtom<T>;
|
|
78
|
+
type index_SetFn = SetFn;
|
|
79
|
+
type index_WritableAtom<T> = WritableAtom<T>;
|
|
80
|
+
type index_WriteFn<T> = WriteFn<T>;
|
|
81
|
+
declare const index_atom: typeof atom;
|
|
82
|
+
declare namespace index {
|
|
83
|
+
export { type index_AtomOptions as AtomOptions, type index_GetFn as GetFn, type index_ReadFn as ReadFn, type index_ReadableAtom as ReadableAtom, type index_SetFn as SetFn, type index_WritableAtom as WritableAtom, type index_WriteFn as WriteFn, index_atom as atom };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { type AtomOptions as A, type GetFn as G, type ReadFn as R, type SetFn as S, type WritableAtom as W, type ReadableAtom as a, type WriteFn as b, atom as c, index as i };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { N as Node } from './node-BmerH3kS.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Nanostores-compatible atom.
|
|
5
|
+
*
|
|
6
|
+
* @category compat
|
|
7
|
+
*/
|
|
8
|
+
interface NanoAtom<T> {
|
|
9
|
+
/** Get current value. */
|
|
10
|
+
get(): T;
|
|
11
|
+
/** Set a new value (writable atoms only). */
|
|
12
|
+
set(value: T): void;
|
|
13
|
+
/** Subscribe to value changes. Callback receives the new value.
|
|
14
|
+
* Returns unsubscribe function. Called immediately with current value. */
|
|
15
|
+
subscribe(cb: (value: T) => void): () => void;
|
|
16
|
+
/** Listen to value changes (no immediate call). Returns unsubscribe. */
|
|
17
|
+
listen(cb: (value: T) => void): () => void;
|
|
18
|
+
/** The underlying GraphReFly node. */
|
|
19
|
+
readonly _node: Node<T>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A Nanostores-compatible computed store.
|
|
23
|
+
*
|
|
24
|
+
* @category compat
|
|
25
|
+
*/
|
|
26
|
+
interface NanoComputed<T> {
|
|
27
|
+
/** Get current value. */
|
|
28
|
+
get(): T;
|
|
29
|
+
/** Subscribe to value changes. Called immediately with current value.
|
|
30
|
+
* Returns unsubscribe function. */
|
|
31
|
+
subscribe(cb: (value: T) => void): () => void;
|
|
32
|
+
/** Listen to value changes (no immediate call). Returns unsubscribe. */
|
|
33
|
+
listen(cb: (value: T) => void): () => void;
|
|
34
|
+
/** The underlying GraphReFly node. */
|
|
35
|
+
readonly _node: Node<T>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A Nanostores-compatible map.
|
|
39
|
+
*
|
|
40
|
+
* @category compat
|
|
41
|
+
*/
|
|
42
|
+
interface NanoMap<T extends Record<string, unknown>> extends NanoAtom<T> {
|
|
43
|
+
/** Set a single key. */
|
|
44
|
+
setKey<K extends keyof T>(key: K, value: T[K]): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a nanostores-compatible atom.
|
|
48
|
+
*
|
|
49
|
+
* @param initial - Initial value.
|
|
50
|
+
* @returns `NanoAtom<T>`
|
|
51
|
+
*
|
|
52
|
+
* @category compat
|
|
53
|
+
*/
|
|
54
|
+
declare function atom<T>(initial: T): NanoAtom<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a nanostores-compatible computed store.
|
|
57
|
+
*
|
|
58
|
+
* @param stores - One or more atoms/computed stores.
|
|
59
|
+
* @param fn - Compute function.
|
|
60
|
+
* @returns `NanoComputed<T>`
|
|
61
|
+
*
|
|
62
|
+
* @category compat
|
|
63
|
+
*/
|
|
64
|
+
declare function computed<T, A>(storeA: NanoAtom<A> | NanoComputed<A>, fn: (a: A) => T): NanoComputed<T>;
|
|
65
|
+
declare function computed<T, A, B>(stores: [NanoAtom<A> | NanoComputed<A>, NanoAtom<B> | NanoComputed<B>], fn: (a: A, b: B) => T): NanoComputed<T>;
|
|
66
|
+
declare function computed<T, A, B, C>(stores: [
|
|
67
|
+
NanoAtom<A> | NanoComputed<A>,
|
|
68
|
+
NanoAtom<B> | NanoComputed<B>,
|
|
69
|
+
NanoAtom<C> | NanoComputed<C>
|
|
70
|
+
], fn: (a: A, b: B, c: C) => T): NanoComputed<T>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a nanostores-compatible map.
|
|
73
|
+
*
|
|
74
|
+
* @param initial - Initial object value.
|
|
75
|
+
* @returns `NanoMap<T>`
|
|
76
|
+
*
|
|
77
|
+
* @category compat
|
|
78
|
+
*/
|
|
79
|
+
declare function map<T extends Record<string, unknown>>(initial: T): NanoMap<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the current value of the store.
|
|
82
|
+
*
|
|
83
|
+
* @category compat
|
|
84
|
+
*/
|
|
85
|
+
declare function getValue<T>(store: NanoAtom<T> | NanoComputed<T>): T;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a listener for the store start (first listener connected).
|
|
88
|
+
*
|
|
89
|
+
* @category compat
|
|
90
|
+
*/
|
|
91
|
+
declare function onStart(store: NanoAtom<any> | NanoComputed<any>, cb: () => void): void;
|
|
92
|
+
/**
|
|
93
|
+
* Adds a listener for the store stop (last listener disconnected).
|
|
94
|
+
*
|
|
95
|
+
* @category compat
|
|
96
|
+
*/
|
|
97
|
+
declare function onStop(store: NanoAtom<any> | NanoComputed<any>, cb: () => void): void;
|
|
98
|
+
/**
|
|
99
|
+
* Adds a listener for the store mount (first listener connected).
|
|
100
|
+
*
|
|
101
|
+
* @returns A cleanup function called when the last listener is removed.
|
|
102
|
+
* @category compat
|
|
103
|
+
*/
|
|
104
|
+
declare function onMount(store: NanoAtom<any> | NanoComputed<any>, cb: () => (() => void) | undefined): void;
|
|
105
|
+
/**
|
|
106
|
+
* Batches multiple store updates.
|
|
107
|
+
*
|
|
108
|
+
* @category compat
|
|
109
|
+
*/
|
|
110
|
+
declare function action<Args extends any[], Return>(_store: NanoAtom<any> | NanoComputed<any>, _name: string, fn: (...args: Args) => Return): (...args: Args) => Return;
|
|
111
|
+
|
|
112
|
+
type index_NanoAtom<T> = NanoAtom<T>;
|
|
113
|
+
type index_NanoComputed<T> = NanoComputed<T>;
|
|
114
|
+
type index_NanoMap<T extends Record<string, unknown>> = NanoMap<T>;
|
|
115
|
+
declare const index_action: typeof action;
|
|
116
|
+
declare const index_atom: typeof atom;
|
|
117
|
+
declare const index_computed: typeof computed;
|
|
118
|
+
declare const index_getValue: typeof getValue;
|
|
119
|
+
declare const index_map: typeof map;
|
|
120
|
+
declare const index_onMount: typeof onMount;
|
|
121
|
+
declare const index_onStart: typeof onStart;
|
|
122
|
+
declare const index_onStop: typeof onStop;
|
|
123
|
+
declare namespace index {
|
|
124
|
+
export { type index_NanoAtom as NanoAtom, type index_NanoComputed as NanoComputed, type index_NanoMap as NanoMap, index_action as action, index_atom as atom, index_computed as computed, index_getValue as getValue, index_map as map, index_onMount as onMount, index_onStart as onStart, index_onStop as onStop };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { type NanoAtom as N, type NanoComputed as a, type NanoMap as b, action as c, atom as d, computed as e, onStart as f, getValue as g, onStop as h, index as i, map as m, onMount as o };
|
|
@@ -1,184 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** Pluggable measurement backend. */
|
|
5
|
-
interface MeasurementAdapter {
|
|
6
|
-
measureSegment(text: string, font: string): {
|
|
7
|
-
width: number;
|
|
8
|
-
};
|
|
9
|
-
/** Optional; adapters may omit for read-only / stateless measurement. */
|
|
10
|
-
clearCache?(): void;
|
|
11
|
-
}
|
|
12
|
-
/** Mutable counters for `analyzeAndMeasure` cache hit ratio (hits / (hits + misses)). */
|
|
13
|
-
type SegmentMeasureStats = {
|
|
14
|
-
hits: number;
|
|
15
|
-
misses: number;
|
|
16
|
-
};
|
|
17
|
-
/** Break kind for each segment (ported from Pretext analysis.ts). */
|
|
18
|
-
type SegmentBreakKind = "text" | "space" | "zero-width-break" | "soft-hyphen" | "hard-break";
|
|
19
|
-
/** A measured text segment ready for line breaking. */
|
|
20
|
-
type PreparedSegment = {
|
|
21
|
-
text: string;
|
|
22
|
-
width: number;
|
|
23
|
-
kind: SegmentBreakKind;
|
|
24
|
-
/** Grapheme widths for overflow-wrap: break-word (null if single grapheme). */
|
|
25
|
-
graphemeWidths: number[] | null;
|
|
26
|
-
};
|
|
27
|
-
/** A laid-out line with start/end cursors. */
|
|
28
|
-
type LayoutLine = {
|
|
29
|
-
text: string;
|
|
30
|
-
width: number;
|
|
31
|
-
startSegment: number;
|
|
32
|
-
startGrapheme: number;
|
|
33
|
-
endSegment: number;
|
|
34
|
-
endGrapheme: number;
|
|
35
|
-
};
|
|
36
|
-
/** Per-character position for hit testing. */
|
|
37
|
-
type CharPosition = {
|
|
38
|
-
x: number;
|
|
39
|
-
y: number;
|
|
40
|
-
width: number;
|
|
41
|
-
height: number;
|
|
42
|
-
line: number;
|
|
43
|
-
};
|
|
44
|
-
/** Full layout result from the line-breaks derived node. */
|
|
45
|
-
type LineBreaksResult = {
|
|
46
|
-
lines: LayoutLine[];
|
|
47
|
-
lineCount: number;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* A position within `PreparedSegment[]` — segment + grapheme offset.
|
|
51
|
-
* `graphemeIndex: 0` at segment boundaries.
|
|
52
|
-
*
|
|
53
|
-
* Used by {@link layoutNextLine} for cursor-based line walking; needed when
|
|
54
|
-
* lines have varying widths (multi-column flow, text wrapping around obstacles).
|
|
55
|
-
*/
|
|
56
|
-
type LayoutCursor = {
|
|
57
|
-
segmentIndex: number;
|
|
58
|
-
graphemeIndex: number;
|
|
59
|
-
};
|
|
60
|
-
/** A horizontal span `[left, right]` in pixels — used by flow-layout slot carving. */
|
|
61
|
-
type Interval = {
|
|
62
|
-
left: number;
|
|
63
|
-
right: number;
|
|
64
|
-
};
|
|
65
|
-
/** Result of a single `layoutNextLine` call. */
|
|
66
|
-
type LayoutNextLineResult = {
|
|
67
|
-
text: string;
|
|
68
|
-
width: number;
|
|
69
|
-
start: LayoutCursor;
|
|
70
|
-
end: LayoutCursor;
|
|
71
|
-
};
|
|
72
|
-
/** Optional context for `layoutNextLine` — enables soft-hyphen visible-hyphen rendering. */
|
|
73
|
-
type LayoutNextLineContext = {
|
|
74
|
-
adapter?: MeasurementAdapter;
|
|
75
|
-
font?: string;
|
|
76
|
-
cache?: Map<string, Map<string, number>>;
|
|
77
|
-
};
|
|
78
|
-
/** Result of the reactive layout graph's describe-accessible state. */
|
|
79
|
-
type ReactiveLayoutBundle = {
|
|
80
|
-
graph: Graph;
|
|
81
|
-
/** Set input text. */
|
|
82
|
-
setText: (text: string) => void;
|
|
83
|
-
/** Set CSS font string. */
|
|
84
|
-
setFont: (font: string) => void;
|
|
85
|
-
/** Set line height (px). */
|
|
86
|
-
setLineHeight: (lineHeight: number) => void;
|
|
87
|
-
/** Set max width constraint (px). */
|
|
88
|
-
setMaxWidth: (maxWidth: number) => void;
|
|
89
|
-
/** Segments node. */
|
|
90
|
-
segments: Node<PreparedSegment[]>;
|
|
91
|
-
/** Line breaks node. */
|
|
92
|
-
lineBreaks: Node<LineBreaksResult>;
|
|
93
|
-
/** Total height node. */
|
|
94
|
-
height: Node<number>;
|
|
95
|
-
/** Per-character positions node. */
|
|
96
|
-
charPositions: Node<CharPosition[]>;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Merge segmentation pieces: sticky punctuation, CJK per-grapheme splitting,
|
|
100
|
-
* and produce the final measured segment list.
|
|
101
|
-
*/
|
|
102
|
-
declare function analyzeAndMeasure(text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, stats?: SegmentMeasureStats): PreparedSegment[];
|
|
103
|
-
/**
|
|
104
|
-
* Greedy line-breaking algorithm.
|
|
105
|
-
*
|
|
106
|
-
* Walks segments left to right, accumulating width. Breaks when a segment would
|
|
107
|
-
* overflow maxWidth. Supports:
|
|
108
|
-
* - Trailing space hang (spaces don't trigger breaks)
|
|
109
|
-
* - overflow-wrap: break-word via grapheme widths
|
|
110
|
-
* - Soft hyphens (break opportunity, adds visible hyphen width)
|
|
111
|
-
* - Hard breaks (forced newline)
|
|
112
|
-
*/
|
|
113
|
-
declare function computeLineBreaks(segments: PreparedSegment[], maxWidth: number, adapter: MeasurementAdapter, font: string, cache: Map<string, Map<string, number>>): LineBreaksResult;
|
|
114
|
-
/**
|
|
115
|
-
* Lay out the next single line starting from `cursor`, fitting into `slotWidth`.
|
|
116
|
-
*
|
|
117
|
-
* Unlike `computeLineBreaks`, which consumes whole text with one `maxWidth`,
|
|
118
|
-
* this is the cursor-based primitive needed when successive lines have different
|
|
119
|
-
* widths (multi-column flow, text wrapping around shape obstacles, mixed
|
|
120
|
-
* column+pullquote layouts).
|
|
121
|
-
*
|
|
122
|
-
* Returns `null` when the cursor is past all segments (text exhausted).
|
|
123
|
-
* At a hard-break with no preceding content, returns an empty line and advances
|
|
124
|
-
* the cursor past the break so the caller can continue.
|
|
125
|
-
*
|
|
126
|
-
* ```ts
|
|
127
|
-
* let cursor: LayoutCursor = { segmentIndex: 0, graphemeIndex: 0 };
|
|
128
|
-
* while (true) {
|
|
129
|
-
* const line = layoutNextLine(segments, cursor, availableWidth);
|
|
130
|
-
* if (line === null) break;
|
|
131
|
-
* render(line);
|
|
132
|
-
* cursor = line.end;
|
|
133
|
-
* }
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
declare function layoutNextLine(segments: PreparedSegment[], cursor: LayoutCursor, slotWidth: number, ctx?: LayoutNextLineContext): LayoutNextLineResult | null;
|
|
137
|
-
/**
|
|
138
|
-
* Subtract blocked horizontal intervals from a base interval, producing
|
|
139
|
-
* remaining ordered, non-overlapping slots wide enough to fit text.
|
|
140
|
-
*
|
|
141
|
-
* Pure geometry — no text dependency. Used by flow-layout to turn obstacle
|
|
142
|
-
* intersections into per-line layout slots.
|
|
143
|
-
*
|
|
144
|
-
* ```ts
|
|
145
|
-
* carveTextLineSlots({left: 0, right: 600}, [{left: 200, right: 280}])
|
|
146
|
-
* // → [{left: 0, right: 200}, {left: 280, right: 600}]
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
declare function carveTextLineSlots(base: Interval, blocked: Interval[], minSlotWidth?: number): Interval[];
|
|
150
|
-
/** Compute per-character x,y positions from line breaks and segments. */
|
|
151
|
-
declare function computeCharPositions(lineBreaks: LineBreaksResult, segments: PreparedSegment[], lineHeight: number): CharPosition[];
|
|
152
|
-
type ReactiveLayoutOptions = {
|
|
153
|
-
/** Measurement backend (required). */
|
|
154
|
-
adapter: MeasurementAdapter;
|
|
155
|
-
/** Graph name (default: "reactive-layout"). */
|
|
156
|
-
name?: string;
|
|
157
|
-
/** Initial text. */
|
|
158
|
-
text?: string;
|
|
159
|
-
/** Initial CSS font string. */
|
|
160
|
-
font?: string;
|
|
161
|
-
/** Initial line height in px. */
|
|
162
|
-
lineHeight?: number;
|
|
163
|
-
/** Initial max width in px (clamped to ≥ 0). */
|
|
164
|
-
maxWidth?: number;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Create a reactive text layout graph.
|
|
168
|
-
*
|
|
169
|
-
* ```
|
|
170
|
-
* Graph("reactive-layout")
|
|
171
|
-
* ├── state("text")
|
|
172
|
-
* ├── state("font")
|
|
173
|
-
* ├── state("line-height")
|
|
174
|
-
* ├── state("max-width")
|
|
175
|
-
* ├── derived("segments") — text + font → PreparedSegment[]
|
|
176
|
-
* ├── derived("line-breaks") — segments + max-width → LineBreaksResult
|
|
177
|
-
* ├── derived("height") — line-breaks → number
|
|
178
|
-
* └── derived("char-positions") — line-breaks + segments → CharPosition[]
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
declare function reactiveLayout(opts: ReactiveLayoutOptions): ReactiveLayoutBundle;
|
|
1
|
+
import { M as MeasurementAdapter, P as PreparedSegment, L as LineBreaksResult, C as CharPosition, a as LayoutCursor, I as Interval, b as LayoutLine, c as LayoutNextLineContext, d as LayoutNextLineResult, R as ReactiveLayoutBundle, e as ReactiveLayoutOptions, S as SegmentBreakKind, f as SegmentMeasureStats, g as analyzeAndMeasure, h as carveTextLineSlots, i as computeCharPositions, j as computeLineBreaks, l as layoutNextLine, r as reactiveLayout } from './reactive-layout-u5Ulnqag.js';
|
|
2
|
+
import { N as Node } from './node-BmerH3kS.js';
|
|
3
|
+
import { a as Graph } from './graph-CCwGKLCm.js';
|
|
182
4
|
|
|
183
5
|
/**
|
|
184
6
|
* MeasurementAdapter implementations (roadmap §7.1 — pluggable backends).
|
|
@@ -606,7 +428,7 @@ type index_CanvasMeasureAdapter = CanvasMeasureAdapter;
|
|
|
606
428
|
declare const index_CanvasMeasureAdapter: typeof CanvasMeasureAdapter;
|
|
607
429
|
type index_CanvasMeasureAdapterOptions = CanvasMeasureAdapterOptions;
|
|
608
430
|
type index_CanvasModule = CanvasModule;
|
|
609
|
-
|
|
431
|
+
declare const index_CharPosition: typeof CharPosition;
|
|
610
432
|
type index_CircleObstacle = CircleObstacle;
|
|
611
433
|
type index_CliMeasureAdapter = CliMeasureAdapter;
|
|
612
434
|
declare const index_CliMeasureAdapter: typeof CliMeasureAdapter;
|
|
@@ -618,14 +440,14 @@ type index_FlowLinesResult = FlowLinesResult;
|
|
|
618
440
|
type index_ImageMeasurer = ImageMeasurer;
|
|
619
441
|
type index_ImageSizeAdapter = ImageSizeAdapter;
|
|
620
442
|
declare const index_ImageSizeAdapter: typeof ImageSizeAdapter;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
443
|
+
declare const index_Interval: typeof Interval;
|
|
444
|
+
declare const index_LayoutCursor: typeof LayoutCursor;
|
|
445
|
+
declare const index_LayoutLine: typeof LayoutLine;
|
|
446
|
+
declare const index_LayoutNextLineContext: typeof LayoutNextLineContext;
|
|
447
|
+
declare const index_LayoutNextLineResult: typeof LayoutNextLineResult;
|
|
448
|
+
declare const index_LineBreaksResult: typeof LineBreaksResult;
|
|
627
449
|
type index_MeasuredBlock = MeasuredBlock;
|
|
628
|
-
|
|
450
|
+
declare const index_MeasurementAdapter: typeof MeasurementAdapter;
|
|
629
451
|
type index_NodeCanvasMeasureAdapter = NodeCanvasMeasureAdapter;
|
|
630
452
|
declare const index_NodeCanvasMeasureAdapter: typeof NodeCanvasMeasureAdapter;
|
|
631
453
|
type index_Obstacle = Obstacle;
|
|
@@ -634,16 +456,16 @@ type index_PositionedLine = PositionedLine;
|
|
|
634
456
|
type index_PrecomputedAdapter = PrecomputedAdapter;
|
|
635
457
|
declare const index_PrecomputedAdapter: typeof PrecomputedAdapter;
|
|
636
458
|
type index_PrecomputedAdapterOptions = PrecomputedAdapterOptions;
|
|
637
|
-
|
|
459
|
+
declare const index_PreparedSegment: typeof PreparedSegment;
|
|
638
460
|
type index_ReactiveBlockLayoutBundle = ReactiveBlockLayoutBundle;
|
|
639
461
|
type index_ReactiveBlockLayoutOptions = ReactiveBlockLayoutOptions;
|
|
640
462
|
type index_ReactiveFlowLayoutBundle = ReactiveFlowLayoutBundle;
|
|
641
463
|
type index_ReactiveFlowLayoutOptions = ReactiveFlowLayoutOptions;
|
|
642
|
-
|
|
643
|
-
|
|
464
|
+
declare const index_ReactiveLayoutBundle: typeof ReactiveLayoutBundle;
|
|
465
|
+
declare const index_ReactiveLayoutOptions: typeof ReactiveLayoutOptions;
|
|
644
466
|
type index_RectObstacle = RectObstacle;
|
|
645
|
-
|
|
646
|
-
|
|
467
|
+
declare const index_SegmentBreakKind: typeof SegmentBreakKind;
|
|
468
|
+
declare const index_SegmentMeasureStats: typeof SegmentMeasureStats;
|
|
647
469
|
type index_SvgBoundsAdapter = SvgBoundsAdapter;
|
|
648
470
|
declare const index_SvgBoundsAdapter: typeof SvgBoundsAdapter;
|
|
649
471
|
type index_SvgMeasurer = SvgMeasurer;
|
|
@@ -663,7 +485,7 @@ declare const index_reactiveFlowLayout: typeof reactiveFlowLayout;
|
|
|
663
485
|
declare const index_reactiveLayout: typeof reactiveLayout;
|
|
664
486
|
declare const index_rectIntervalForBand: typeof rectIntervalForBand;
|
|
665
487
|
declare namespace index {
|
|
666
|
-
export { type index_BlockAdapters as BlockAdapters, index_CanvasMeasureAdapter as CanvasMeasureAdapter, type index_CanvasMeasureAdapterOptions as CanvasMeasureAdapterOptions, type index_CanvasModule as CanvasModule,
|
|
488
|
+
export { type index_BlockAdapters as BlockAdapters, index_CanvasMeasureAdapter as CanvasMeasureAdapter, type index_CanvasMeasureAdapterOptions as CanvasMeasureAdapterOptions, type index_CanvasModule as CanvasModule, index_CharPosition as CharPosition, type index_CircleObstacle as CircleObstacle, index_CliMeasureAdapter as CliMeasureAdapter, type index_CliMeasureAdapterOptions as CliMeasureAdapterOptions, type index_ContentBlock as ContentBlock, type index_FlowColumns as FlowColumns, type index_FlowContainer as FlowContainer, type index_FlowLinesResult as FlowLinesResult, type index_ImageMeasurer as ImageMeasurer, index_ImageSizeAdapter as ImageSizeAdapter, index_Interval as Interval, index_LayoutCursor as LayoutCursor, index_LayoutLine as LayoutLine, index_LayoutNextLineContext as LayoutNextLineContext, index_LayoutNextLineResult as LayoutNextLineResult, index_LineBreaksResult as LineBreaksResult, type index_MeasuredBlock as MeasuredBlock, index_MeasurementAdapter as MeasurementAdapter, index_NodeCanvasMeasureAdapter as NodeCanvasMeasureAdapter, type index_Obstacle as Obstacle, type index_PositionedBlock as PositionedBlock, type index_PositionedLine as PositionedLine, index_PrecomputedAdapter as PrecomputedAdapter, type index_PrecomputedAdapterOptions as PrecomputedAdapterOptions, index_PreparedSegment as PreparedSegment, type index_ReactiveBlockLayoutBundle as ReactiveBlockLayoutBundle, type index_ReactiveBlockLayoutOptions as ReactiveBlockLayoutOptions, type index_ReactiveFlowLayoutBundle as ReactiveFlowLayoutBundle, type index_ReactiveFlowLayoutOptions as ReactiveFlowLayoutOptions, index_ReactiveLayoutBundle as ReactiveLayoutBundle, index_ReactiveLayoutOptions as ReactiveLayoutOptions, type index_RectObstacle as RectObstacle, index_SegmentBreakKind as SegmentBreakKind, index_SegmentMeasureStats as SegmentMeasureStats, index_SvgBoundsAdapter as SvgBoundsAdapter, type index_SvgMeasurer as SvgMeasurer, index_analyzeAndMeasure as analyzeAndMeasure, index_carveTextLineSlots as carveTextLineSlots, index_circleIntervalForBand as circleIntervalForBand, index_computeBlockFlow as computeBlockFlow, index_computeCharPositions as computeCharPositions, index_computeFlowLines as computeFlowLines, index_computeLineBreaks as computeLineBreaks, index_computeTotalHeight as computeTotalHeight, index_layoutNextLine as layoutNextLine, index_measureBlock as measureBlock, index_measureBlocks as measureBlocks, index_reactiveBlockLayout as reactiveBlockLayout, index_reactiveFlowLayout as reactiveFlowLayout, index_reactiveLayout as reactiveLayout, index_rectIntervalForBand as rectIntervalForBand };
|
|
667
489
|
}
|
|
668
490
|
|
|
669
|
-
export {
|
|
491
|
+
export { rectIntervalForBand as A, type BlockAdapters as B, CanvasMeasureAdapter as C, type FlowColumns as F, type ImageMeasurer as I, type MeasuredBlock as M, NodeCanvasMeasureAdapter as N, type Obstacle as O, type PositionedBlock as P, type ReactiveBlockLayoutBundle as R, SvgBoundsAdapter as S, type CanvasMeasureAdapterOptions as a, type CanvasModule as b, type CircleObstacle as c, CliMeasureAdapter as d, type CliMeasureAdapterOptions as e, type ContentBlock as f, type FlowContainer as g, type FlowLinesResult as h, index as i, ImageSizeAdapter as j, type PositionedLine as k, PrecomputedAdapter as l, type PrecomputedAdapterOptions as m, type ReactiveBlockLayoutOptions as n, type ReactiveFlowLayoutBundle as o, type ReactiveFlowLayoutOptions as p, type RectObstacle as q, type SvgMeasurer as r, circleIntervalForBand as s, computeBlockFlow as t, computeFlowLines as u, computeTotalHeight as v, measureBlock as w, measureBlocks as x, reactiveBlockLayout as y, reactiveFlowLayout as z };
|