@graphrefly/graphrefly 0.25.0 → 0.26.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 (184) hide show
  1. package/README.md +8 -0
  2. package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
  3. package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
  4. package/dist/chunk-6LDQFTYS.js +102 -0
  5. package/dist/chunk-6LDQFTYS.js.map +1 -0
  6. package/dist/{chunk-IAHGTNOZ.js → chunk-AMCG74RZ.js} +193 -24
  7. package/dist/chunk-AMCG74RZ.js.map +1 -0
  8. package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
  9. package/dist/chunk-BVZYTZ5H.js.map +1 -0
  10. package/dist/chunk-FQMKGR6L.js +330 -0
  11. package/dist/chunk-FQMKGR6L.js.map +1 -0
  12. package/dist/chunk-HXZEYDUR.js +94 -0
  13. package/dist/chunk-HXZEYDUR.js.map +1 -0
  14. package/dist/{chunk-EVR6UFUV.js → chunk-IZYUSJC7.js} +16 -14
  15. package/dist/{chunk-EVR6UFUV.js.map → chunk-IZYUSJC7.js.map} +1 -1
  16. package/dist/chunk-J22W6HV3.js +107 -0
  17. package/dist/chunk-J22W6HV3.js.map +1 -0
  18. package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
  19. package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
  20. package/dist/chunk-JYXEWPH4.js +62 -0
  21. package/dist/chunk-JYXEWPH4.js.map +1 -0
  22. package/dist/{chunk-TKE3JGOH.js → chunk-LCE3GF5P.js} +5 -692
  23. package/dist/chunk-LCE3GF5P.js.map +1 -0
  24. package/dist/chunk-MJ2NKQQL.js +119 -0
  25. package/dist/chunk-MJ2NKQQL.js.map +1 -0
  26. package/dist/chunk-N6UR7YVY.js +198 -0
  27. package/dist/chunk-N6UR7YVY.js.map +1 -0
  28. package/dist/chunk-OHISZPOJ.js +97 -0
  29. package/dist/chunk-OHISZPOJ.js.map +1 -0
  30. package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
  31. package/dist/chunk-PHOUUNK7.js.map +1 -0
  32. package/dist/{chunk-PY4XCDLR.js → chunk-RB6QPHJ7.js} +8 -6
  33. package/dist/{chunk-PY4XCDLR.js.map → chunk-RB6QPHJ7.js.map} +1 -1
  34. package/dist/chunk-SN4YWWYO.js +171 -0
  35. package/dist/chunk-SN4YWWYO.js.map +1 -0
  36. package/dist/chunk-SX52TAR4.js +110 -0
  37. package/dist/chunk-SX52TAR4.js.map +1 -0
  38. package/dist/{chunk-XOFWRC73.js → chunk-THTWHNU4.js} +319 -24
  39. package/dist/chunk-THTWHNU4.js.map +1 -0
  40. package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
  41. package/dist/chunk-XGPU467M.js +136 -0
  42. package/dist/chunk-XGPU467M.js.map +1 -0
  43. package/dist/chunk-ZQMEI34O.js +713 -0
  44. package/dist/chunk-ZQMEI34O.js.map +1 -0
  45. package/dist/compat/index.cjs +7656 -0
  46. package/dist/compat/index.cjs.map +1 -0
  47. package/dist/compat/index.d.cts +18 -0
  48. package/dist/compat/index.d.ts +18 -0
  49. package/dist/compat/index.js +49 -0
  50. package/dist/compat/index.js.map +1 -0
  51. package/dist/compat/jotai/index.cjs +2048 -0
  52. package/dist/compat/jotai/index.cjs.map +1 -0
  53. package/dist/compat/jotai/index.d.cts +2 -0
  54. package/dist/compat/jotai/index.d.ts +2 -0
  55. package/dist/compat/jotai/index.js +9 -0
  56. package/dist/compat/jotai/index.js.map +1 -0
  57. package/dist/compat/nanostores/index.cjs +2175 -0
  58. package/dist/compat/nanostores/index.cjs.map +1 -0
  59. package/dist/compat/nanostores/index.d.cts +2 -0
  60. package/dist/compat/nanostores/index.d.ts +2 -0
  61. package/dist/compat/nanostores/index.js +23 -0
  62. package/dist/compat/nanostores/index.js.map +1 -0
  63. package/dist/compat/nestjs/index.cjs +350 -16
  64. package/dist/compat/nestjs/index.cjs.map +1 -1
  65. package/dist/compat/nestjs/index.d.cts +6 -6
  66. package/dist/compat/nestjs/index.d.ts +6 -6
  67. package/dist/compat/nestjs/index.js +10 -9
  68. package/dist/compat/react/index.cjs +141 -0
  69. package/dist/compat/react/index.cjs.map +1 -0
  70. package/dist/compat/react/index.d.cts +2 -0
  71. package/dist/compat/react/index.d.ts +2 -0
  72. package/dist/compat/react/index.js +12 -0
  73. package/dist/compat/react/index.js.map +1 -0
  74. package/dist/compat/solid/index.cjs +128 -0
  75. package/dist/compat/solid/index.cjs.map +1 -0
  76. package/dist/compat/solid/index.d.cts +2 -0
  77. package/dist/compat/solid/index.d.ts +2 -0
  78. package/dist/compat/solid/index.js +12 -0
  79. package/dist/compat/solid/index.js.map +1 -0
  80. package/dist/compat/svelte/index.cjs +131 -0
  81. package/dist/compat/svelte/index.cjs.map +1 -0
  82. package/dist/compat/svelte/index.d.cts +2 -0
  83. package/dist/compat/svelte/index.d.ts +2 -0
  84. package/dist/compat/svelte/index.js +12 -0
  85. package/dist/compat/svelte/index.js.map +1 -0
  86. package/dist/compat/vue/index.cjs +146 -0
  87. package/dist/compat/vue/index.cjs.map +1 -0
  88. package/dist/compat/vue/index.d.cts +3 -0
  89. package/dist/compat/vue/index.d.ts +3 -0
  90. package/dist/compat/vue/index.js +12 -0
  91. package/dist/compat/vue/index.js.map +1 -0
  92. package/dist/compat/zustand/index.cjs +4931 -0
  93. package/dist/compat/zustand/index.cjs.map +1 -0
  94. package/dist/compat/zustand/index.d.cts +5 -0
  95. package/dist/compat/zustand/index.d.ts +5 -0
  96. package/dist/compat/zustand/index.js +12 -0
  97. package/dist/compat/zustand/index.js.map +1 -0
  98. package/dist/core/index.cjs +53 -4
  99. package/dist/core/index.cjs.map +1 -1
  100. package/dist/core/index.d.cts +3 -3
  101. package/dist/core/index.d.ts +3 -3
  102. package/dist/core/index.js +26 -24
  103. package/dist/demo-shell-26p5fVxn.d.cts +102 -0
  104. package/dist/demo-shell-DEp-nMTl.d.ts +102 -0
  105. package/dist/extra/index.cjs +222 -110
  106. package/dist/extra/index.cjs.map +1 -1
  107. package/dist/extra/index.d.cts +5 -4
  108. package/dist/extra/index.d.ts +5 -4
  109. package/dist/extra/index.js +6 -5
  110. package/dist/extra/sources.cjs +2486 -0
  111. package/dist/extra/sources.cjs.map +1 -0
  112. package/dist/extra/sources.d.cts +465 -0
  113. package/dist/extra/sources.d.ts +465 -0
  114. package/dist/extra/sources.js +57 -0
  115. package/dist/extra/sources.js.map +1 -0
  116. package/dist/graph/index.cjs +408 -14
  117. package/dist/graph/index.cjs.map +1 -1
  118. package/dist/graph/index.d.cts +5 -5
  119. package/dist/graph/index.d.ts +5 -5
  120. package/dist/graph/index.js +13 -5
  121. package/dist/{graph-B6NFqv3z.d.ts → graph-6tZ5jEzr.d.cts} +195 -4
  122. package/dist/{graph-D-3JIQme.d.cts → graph-DQ69XU0g.d.ts} +195 -4
  123. package/dist/index-B4MP_8V_.d.cts +37 -0
  124. package/dist/index-BEfE8H_G.d.cts +121 -0
  125. package/dist/{index-OXImXMq6.d.ts → index-BW1z3BN9.d.ts} +18 -196
  126. package/dist/index-BYOHF0zP.d.ts +34 -0
  127. package/dist/index-B_IP40nB.d.cts +36 -0
  128. package/dist/index-Bd_fwmLf.d.cts +45 -0
  129. package/dist/{index-Ds23Wvou.d.ts → index-BeIdBfcb.d.cts} +120 -573
  130. package/dist/index-BjI6ty9z.d.ts +121 -0
  131. package/dist/index-Bxb5ZYc9.d.cts +34 -0
  132. package/dist/{index-BJB7t9gg.d.cts → index-C0ZXMaXO.d.cts} +2 -2
  133. package/dist/{index-DKE1EATr.d.cts → index-C8mdwMXc.d.cts} +18 -196
  134. package/dist/index-CDAjUFIv.d.ts +36 -0
  135. package/dist/index-CPgZ5wRl.d.ts +44 -0
  136. package/dist/{index-AMWewNDe.d.cts → index-CUwyr1Kk.d.cts} +33 -4
  137. package/dist/index-CUyrtuOf.d.cts +127 -0
  138. package/dist/{index-C-TXEa7C.d.ts → index-CY2TljO4.d.ts} +2 -2
  139. package/dist/index-CmnuOibw.d.ts +37 -0
  140. package/dist/{index-DiobMNwE.d.ts → index-CuYwdKO-.d.ts} +3 -3
  141. package/dist/index-DFhjO4Gg.d.cts +44 -0
  142. package/dist/{index-Ch0IpIO0.d.cts → index-DdD5MVDL.d.ts} +120 -573
  143. package/dist/index-DrISNAOm.d.ts +45 -0
  144. package/dist/index-QBpffFW-.d.cts +86 -0
  145. package/dist/{index-J7Kc0oIQ.d.cts → index-_oMEWlDq.d.cts} +3 -3
  146. package/dist/{index-CYkjxu3s.d.ts → index-eJ6T_qGM.d.ts} +33 -4
  147. package/dist/index-qldRdbQw.d.ts +86 -0
  148. package/dist/index-xdGjv0nO.d.ts +127 -0
  149. package/dist/index.cjs +1780 -176
  150. package/dist/index.cjs.map +1 -1
  151. package/dist/index.d.cts +1007 -648
  152. package/dist/index.d.ts +1007 -648
  153. package/dist/index.js +1202 -1172
  154. package/dist/index.js.map +1 -1
  155. package/dist/{meta-CnkLA_43.d.ts → meta-BGqSZ7mt.d.ts} +1 -1
  156. package/dist/{meta-DWbkoq1s.d.cts → meta-C0-8XW6Q.d.cts} +1 -1
  157. package/dist/{node-B-f-Lu-k.d.cts → node-C_IBuvX2.d.cts} +26 -1
  158. package/dist/{node-B-f-Lu-k.d.ts → node-C_IBuvX2.d.ts} +26 -1
  159. package/dist/{observable-DBnrwcar.d.cts → observable-Crr1jgzx.d.cts} +1 -1
  160. package/dist/{observable-uP-wy_uK.d.ts → observable-DCk45RH5.d.ts} +1 -1
  161. package/dist/patterns/demo-shell.cjs +5604 -0
  162. package/dist/patterns/demo-shell.cjs.map +1 -0
  163. package/dist/patterns/demo-shell.d.cts +6 -0
  164. package/dist/patterns/demo-shell.d.ts +6 -0
  165. package/dist/patterns/demo-shell.js +15 -0
  166. package/dist/patterns/demo-shell.js.map +1 -0
  167. package/dist/patterns/reactive-layout/index.cjs +355 -13
  168. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  169. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  170. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  171. package/dist/patterns/reactive-layout/index.js +15 -12
  172. package/dist/reactive-layout-BaOQefHu.d.cts +183 -0
  173. package/dist/reactive-layout-D9gejYXE.d.ts +183 -0
  174. package/dist/{storage-BuTdpCI1.d.cts → storage-BMycWEh2.d.ts} +9 -1
  175. package/dist/{storage-F2X1U1x0.d.ts → storage-DiqWHzVI.d.cts} +9 -1
  176. package/package.json +32 -2
  177. package/dist/chunk-5DJTTKX3.js.map +0 -1
  178. package/dist/chunk-IAHGTNOZ.js.map +0 -1
  179. package/dist/chunk-L2GLW2U7.js.map +0 -1
  180. package/dist/chunk-MW4VAKAO.js +0 -47
  181. package/dist/chunk-MW4VAKAO.js.map +0 -1
  182. package/dist/chunk-TKE3JGOH.js.map +0 -1
  183. package/dist/chunk-XOFWRC73.js.map +0 -1
  184. /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
@@ -1,5 +1,6 @@
1
- export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CharPosition, d as CircleObstacle, e as CliMeasureAdapter, f as CliMeasureAdapterOptions, g as ContentBlock, F as FlowColumns, h as FlowContainer, j as FlowLinesResult, I as ImageMeasurer, k as ImageSizeAdapter, l as Interval, L as LayoutCursor, m as LayoutLine, n as LayoutNextLineContext, o as LayoutNextLineResult, p as LineBreaksResult, q as MeasuredBlock, M as MeasurementAdapter, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, r as PositionedLine, s as PrecomputedAdapter, t as PrecomputedAdapterOptions, u as PreparedSegment, R as ReactiveBlockLayoutBundle, v as ReactiveBlockLayoutOptions, w as ReactiveFlowLayoutBundle, x as ReactiveFlowLayoutOptions, y as ReactiveLayoutBundle, z as ReactiveLayoutOptions, A as RectObstacle, S as SegmentBreakKind, D as SegmentMeasureStats, E as SvgBoundsAdapter, G as SvgMeasurer, H as analyzeAndMeasure, J as carveTextLineSlots, K as circleIntervalForBand, Q as computeBlockFlow, T as computeCharPositions, U as computeFlowLines, V as computeLineBreaks, W as computeTotalHeight, X as layoutNextLine, Y as measureBlock, Z as measureBlocks, _ as reactiveBlockLayout, $ as reactiveFlowLayout, a0 as reactiveLayout, a1 as rectIntervalForBand } from '../../index-DKE1EATr.cjs';
2
- import '../../node-B-f-Lu-k.cjs';
3
- import '../../graph-D-3JIQme.cjs';
4
- import '../../meta-DWbkoq1s.cjs';
5
- import '../../storage-BuTdpCI1.cjs';
1
+ export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CircleObstacle, d as CliMeasureAdapter, e as CliMeasureAdapterOptions, f as ContentBlock, F as FlowColumns, g as FlowContainer, h as FlowLinesResult, I as ImageMeasurer, j as ImageSizeAdapter, M as MeasuredBlock, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, k as PositionedLine, l as PrecomputedAdapter, m as PrecomputedAdapterOptions, R as ReactiveBlockLayoutBundle, n as ReactiveBlockLayoutOptions, o as ReactiveFlowLayoutBundle, p as ReactiveFlowLayoutOptions, q as RectObstacle, S as SvgBoundsAdapter, r as SvgMeasurer, s as circleIntervalForBand, t as computeBlockFlow, u as computeFlowLines, v as computeTotalHeight, w as measureBlock, x as measureBlocks, y as reactiveBlockLayout, z as reactiveFlowLayout, A as rectIntervalForBand } from '../../index-C8mdwMXc.cjs';
2
+ export { C as CharPosition, I as Interval, a as LayoutCursor, b as LayoutLine, c as LayoutNextLineContext, d as LayoutNextLineResult, L as LineBreaksResult, M as MeasurementAdapter, P as PreparedSegment, 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-BaOQefHu.cjs';
3
+ import '../../node-C_IBuvX2.cjs';
4
+ import '../../graph-6tZ5jEzr.cjs';
5
+ import '../../meta-C0-8XW6Q.cjs';
6
+ import '../../storage-DiqWHzVI.cjs';
@@ -1,5 +1,6 @@
1
- export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CharPosition, d as CircleObstacle, e as CliMeasureAdapter, f as CliMeasureAdapterOptions, g as ContentBlock, F as FlowColumns, h as FlowContainer, j as FlowLinesResult, I as ImageMeasurer, k as ImageSizeAdapter, l as Interval, L as LayoutCursor, m as LayoutLine, n as LayoutNextLineContext, o as LayoutNextLineResult, p as LineBreaksResult, q as MeasuredBlock, M as MeasurementAdapter, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, r as PositionedLine, s as PrecomputedAdapter, t as PrecomputedAdapterOptions, u as PreparedSegment, R as ReactiveBlockLayoutBundle, v as ReactiveBlockLayoutOptions, w as ReactiveFlowLayoutBundle, x as ReactiveFlowLayoutOptions, y as ReactiveLayoutBundle, z as ReactiveLayoutOptions, A as RectObstacle, S as SegmentBreakKind, D as SegmentMeasureStats, E as SvgBoundsAdapter, G as SvgMeasurer, H as analyzeAndMeasure, J as carveTextLineSlots, K as circleIntervalForBand, Q as computeBlockFlow, T as computeCharPositions, U as computeFlowLines, V as computeLineBreaks, W as computeTotalHeight, X as layoutNextLine, Y as measureBlock, Z as measureBlocks, _ as reactiveBlockLayout, $ as reactiveFlowLayout, a0 as reactiveLayout, a1 as rectIntervalForBand } from '../../index-OXImXMq6.js';
2
- import '../../node-B-f-Lu-k.js';
3
- import '../../graph-B6NFqv3z.js';
4
- import '../../meta-CnkLA_43.js';
5
- import '../../storage-F2X1U1x0.js';
1
+ export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CircleObstacle, d as CliMeasureAdapter, e as CliMeasureAdapterOptions, f as ContentBlock, F as FlowColumns, g as FlowContainer, h as FlowLinesResult, I as ImageMeasurer, j as ImageSizeAdapter, M as MeasuredBlock, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, k as PositionedLine, l as PrecomputedAdapter, m as PrecomputedAdapterOptions, R as ReactiveBlockLayoutBundle, n as ReactiveBlockLayoutOptions, o as ReactiveFlowLayoutBundle, p as ReactiveFlowLayoutOptions, q as RectObstacle, S as SvgBoundsAdapter, r as SvgMeasurer, s as circleIntervalForBand, t as computeBlockFlow, u as computeFlowLines, v as computeTotalHeight, w as measureBlock, x as measureBlocks, y as reactiveBlockLayout, z as reactiveFlowLayout, A as rectIntervalForBand } from '../../index-BW1z3BN9.js';
2
+ export { C as CharPosition, I as Interval, a as LayoutCursor, b as LayoutLine, c as LayoutNextLineContext, d as LayoutNextLineResult, L as LineBreaksResult, M as MeasurementAdapter, P as PreparedSegment, 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-D9gejYXE.js';
3
+ import '../../node-C_IBuvX2.js';
4
+ import '../../graph-DQ69XU0g.js';
5
+ import '../../meta-BGqSZ7mt.js';
6
+ import '../../storage-BMycWEh2.js';
@@ -5,28 +5,31 @@ import {
5
5
  NodeCanvasMeasureAdapter,
6
6
  PrecomputedAdapter,
7
7
  SvgBoundsAdapter,
8
- analyzeAndMeasure,
9
- carveTextLineSlots,
10
8
  circleIntervalForBand,
11
9
  computeBlockFlow,
12
- computeCharPositions,
13
10
  computeFlowLines,
14
- computeLineBreaks,
15
11
  computeTotalHeight,
16
- layoutNextLine,
17
12
  measureBlock,
18
13
  measureBlocks,
19
14
  reactiveBlockLayout,
20
15
  reactiveFlowLayout,
21
- reactiveLayout,
22
16
  rectIntervalForBand
23
- } from "../../chunk-TKE3JGOH.js";
24
- import "../../chunk-HWPIFSW2.js";
25
- import "../../chunk-L2GLW2U7.js";
26
- import "../../chunk-XOFWRC73.js";
27
- import "../../chunk-H4RVA4VE.js";
17
+ } from "../../chunk-ZQMEI34O.js";
18
+ import {
19
+ analyzeAndMeasure,
20
+ carveTextLineSlots,
21
+ computeCharPositions,
22
+ computeLineBreaks,
23
+ layoutNextLine,
24
+ reactiveLayout
25
+ } from "../../chunk-LCE3GF5P.js";
26
+ import "../../chunk-JSCT3CR4.js";
27
+ import "../../chunk-BVZYTZ5H.js";
28
+ import "../../chunk-THTWHNU4.js";
28
29
  import "../../chunk-7TAQJHQV.js";
29
- import "../../chunk-5DJTTKX3.js";
30
+ import "../../chunk-VYPWMZ6H.js";
31
+ import "../../chunk-PHOUUNK7.js";
32
+ import "../../chunk-SX52TAR4.js";
30
33
  export {
31
34
  CanvasMeasureAdapter,
32
35
  CliMeasureAdapter,
@@ -0,0 +1,183 @@
1
+ import { N as Node } from './node-C_IBuvX2.cjs';
2
+ import { G as Graph } from './graph-6tZ5jEzr.cjs';
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;
182
+
183
+ export { type CharPosition as C, type Interval as I, type LineBreaksResult as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type SegmentBreakKind as S, type LayoutCursor as a, type LayoutLine as b, type LayoutNextLineContext as c, type LayoutNextLineResult as d, type ReactiveLayoutOptions as e, type SegmentMeasureStats as f, analyzeAndMeasure as g, carveTextLineSlots as h, computeCharPositions as i, computeLineBreaks as j, layoutNextLine as l, reactiveLayout as r };
@@ -0,0 +1,183 @@
1
+ import { N as Node } from './node-C_IBuvX2.js';
2
+ import { G as Graph } from './graph-DQ69XU0g.js';
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;
182
+
183
+ export { type CharPosition as C, type Interval as I, type LineBreaksResult as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type SegmentBreakKind as S, type LayoutCursor as a, type LayoutLine as b, type LayoutNextLineContext as c, type LayoutNextLineResult as d, type ReactiveLayoutOptions as e, type SegmentMeasureStats as f, analyzeAndMeasure as g, carveTextLineSlots as h, computeCharPositions as i, computeLineBreaks as j, layoutNextLine as l, reactiveLayout as r };
@@ -1,4 +1,4 @@
1
- import { N as Node } from './node-B-f-Lu-k.cjs';
1
+ import { N as Node } from './node-C_IBuvX2.js';
2
2
 
3
3
  /**
4
4
  * Storage tier primitive — unified persistence surface (roadmap §3.1).
@@ -28,6 +28,14 @@ interface StorageTier {
28
28
  save(key: string, data: unknown): void | Promise<void>;
29
29
  /** Delete a value. Optional — tiers without `clear` are append/overwrite-only. */
30
30
  clear?(key: string): void | Promise<void>;
31
+ /**
32
+ * Enumerate known keys. Optional — tiers that only address a single record
33
+ * (e.g. `indexedDbStorage`) or that can't cheaply enumerate (e.g. a remote
34
+ * write-only sink) may omit it. Callers that require enumeration (the
35
+ * surface `snapshot.list()` helper, MCP `graphrefly_snapshot_list`, CLI
36
+ * `graphrefly snapshot list`) should check before calling.
37
+ */
38
+ list?(): readonly string[] | Promise<readonly string[]>;
31
39
  /**
32
40
  * Debounce saves on this tier (ms). Hot tier: `0` (sync-through).
33
41
  * Warm: `1000`. Cold: `60000`. Each tier holds its own last-save baseline,
@@ -1,4 +1,4 @@
1
- import { N as Node } from './node-B-f-Lu-k.js';
1
+ import { N as Node } from './node-C_IBuvX2.cjs';
2
2
 
3
3
  /**
4
4
  * Storage tier primitive — unified persistence surface (roadmap §3.1).
@@ -28,6 +28,14 @@ interface StorageTier {
28
28
  save(key: string, data: unknown): void | Promise<void>;
29
29
  /** Delete a value. Optional — tiers without `clear` are append/overwrite-only. */
30
30
  clear?(key: string): void | Promise<void>;
31
+ /**
32
+ * Enumerate known keys. Optional — tiers that only address a single record
33
+ * (e.g. `indexedDbStorage`) or that can't cheaply enumerate (e.g. a remote
34
+ * write-only sink) may omit it. Callers that require enumeration (the
35
+ * surface `snapshot.list()` helper, MCP `graphrefly_snapshot_list`, CLI
36
+ * `graphrefly snapshot list`) should check before calling.
37
+ */
38
+ list?(): readonly string[] | Promise<readonly string[]>;
31
39
  /**
32
40
  * Debounce saves on this tier (ms). Hot tier: `0` (sync-through).
33
41
  * Warm: `1000`. Cold: `60000`. Each tier holds its own last-save baseline,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphrefly/graphrefly",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
5
5
  "description": "Reactive harness layer for agent workflows. Describe automations in plain language, trace every decision, enforce policies, persist checkpoints. Zero dependencies.",
6
6
  "repository": {
@@ -47,6 +47,16 @@
47
47
  "default": "./dist/extra/index.cjs"
48
48
  }
49
49
  },
50
+ "./extra/sources": {
51
+ "import": {
52
+ "types": "./dist/extra/sources.d.ts",
53
+ "default": "./dist/extra/sources.js"
54
+ },
55
+ "require": {
56
+ "types": "./dist/extra/sources.d.cts",
57
+ "default": "./dist/extra/sources.cjs"
58
+ }
59
+ },
50
60
  "./graph": {
51
61
  "import": {
52
62
  "types": "./dist/graph/index.d.ts",
@@ -77,6 +87,16 @@
77
87
  "default": "./dist/compat/jotai/index.cjs"
78
88
  }
79
89
  },
90
+ "./compat/nanostores": {
91
+ "import": {
92
+ "types": "./dist/compat/nanostores/index.d.ts",
93
+ "default": "./dist/compat/nanostores/index.js"
94
+ },
95
+ "require": {
96
+ "types": "./dist/compat/nanostores/index.d.cts",
97
+ "default": "./dist/compat/nanostores/index.cjs"
98
+ }
99
+ },
80
100
  "./compat/zustand": {
81
101
  "import": {
82
102
  "types": "./dist/compat/zustand/index.d.ts",
@@ -137,7 +157,7 @@
137
157
  "default": "./dist/compat/nestjs/index.cjs"
138
158
  }
139
159
  },
140
- "./reactive-layout": {
160
+ "./patterns/reactive-layout": {
141
161
  "import": {
142
162
  "types": "./dist/patterns/reactive-layout/index.d.ts",
143
163
  "default": "./dist/patterns/reactive-layout/index.js"
@@ -146,6 +166,16 @@
146
166
  "types": "./dist/patterns/reactive-layout/index.d.cts",
147
167
  "default": "./dist/patterns/reactive-layout/index.cjs"
148
168
  }
169
+ },
170
+ "./patterns/demo-shell": {
171
+ "import": {
172
+ "types": "./dist/patterns/demo-shell.d.ts",
173
+ "default": "./dist/patterns/demo-shell.js"
174
+ },
175
+ "require": {
176
+ "types": "./dist/patterns/demo-shell.d.cts",
177
+ "default": "./dist/patterns/demo-shell.cjs"
178
+ }
149
179
  }
150
180
  },
151
181
  "files": [