@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.
Files changed (231) hide show
  1. package/README.md +8 -0
  2. package/dist/ai-CaR_912Q.d.cts +1033 -0
  3. package/dist/ai-WlRltJV7.d.ts +1033 -0
  4. package/dist/audit-ClmqGOCx.d.cts +245 -0
  5. package/dist/audit-DRlSzBu9.d.ts +245 -0
  6. package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
  7. package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
  8. package/dist/chunk-APFNLIRG.js +62 -0
  9. package/dist/chunk-APFNLIRG.js.map +1 -0
  10. package/dist/chunk-AT5LKYNL.js +395 -0
  11. package/dist/chunk-AT5LKYNL.js.map +1 -0
  12. package/dist/{chunk-IAHGTNOZ.js → chunk-BQ6RQQFF.js} +351 -2095
  13. package/dist/chunk-BQ6RQQFF.js.map +1 -0
  14. package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
  15. package/dist/chunk-BVZYTZ5H.js.map +1 -0
  16. package/dist/{chunk-EVR6UFUV.js → chunk-DST5DKZS.js} +19 -15
  17. package/dist/{chunk-EVR6UFUV.js.map → chunk-DST5DKZS.js.map} +1 -1
  18. package/dist/{chunk-TKE3JGOH.js → chunk-GTE6PWRZ.js} +5 -692
  19. package/dist/chunk-GTE6PWRZ.js.map +1 -0
  20. package/dist/chunk-HXZEYDUR.js +94 -0
  21. package/dist/chunk-HXZEYDUR.js.map +1 -0
  22. package/dist/chunk-J22W6HV3.js +107 -0
  23. package/dist/chunk-J22W6HV3.js.map +1 -0
  24. package/dist/{chunk-PY4XCDLR.js → chunk-J2VBW3DZ.js} +6 -95
  25. package/dist/chunk-J2VBW3DZ.js.map +1 -0
  26. package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
  27. package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
  28. package/dist/chunk-JWBCY4NC.js +330 -0
  29. package/dist/chunk-JWBCY4NC.js.map +1 -0
  30. package/dist/chunk-K2AUJHVP.js +2251 -0
  31. package/dist/chunk-K2AUJHVP.js.map +1 -0
  32. package/dist/chunk-MJ2NKQQL.js +119 -0
  33. package/dist/chunk-MJ2NKQQL.js.map +1 -0
  34. package/dist/chunk-N6UR7YVY.js +198 -0
  35. package/dist/chunk-N6UR7YVY.js.map +1 -0
  36. package/dist/chunk-NC6S43JJ.js +456 -0
  37. package/dist/chunk-NC6S43JJ.js.map +1 -0
  38. package/dist/chunk-OFVJBJXR.js +98 -0
  39. package/dist/chunk-OFVJBJXR.js.map +1 -0
  40. package/dist/chunk-OHISZPOJ.js +97 -0
  41. package/dist/chunk-OHISZPOJ.js.map +1 -0
  42. package/dist/chunk-OU5CQKNW.js +102 -0
  43. package/dist/chunk-OU5CQKNW.js.map +1 -0
  44. package/dist/{chunk-XOFWRC73.js → chunk-PF7GRZMW.js} +316 -21
  45. package/dist/chunk-PF7GRZMW.js.map +1 -0
  46. package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
  47. package/dist/chunk-PHOUUNK7.js.map +1 -0
  48. package/dist/chunk-RNHBMHKA.js +1665 -0
  49. package/dist/chunk-RNHBMHKA.js.map +1 -0
  50. package/dist/chunk-SX52TAR4.js +110 -0
  51. package/dist/chunk-SX52TAR4.js.map +1 -0
  52. package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
  53. package/dist/chunk-WBZOVTYK.js +171 -0
  54. package/dist/chunk-WBZOVTYK.js.map +1 -0
  55. package/dist/chunk-WKNUIZOY.js +354 -0
  56. package/dist/chunk-WKNUIZOY.js.map +1 -0
  57. package/dist/chunk-X3VMZYBT.js +713 -0
  58. package/dist/chunk-X3VMZYBT.js.map +1 -0
  59. package/dist/chunk-X5R3GL6H.js +525 -0
  60. package/dist/chunk-X5R3GL6H.js.map +1 -0
  61. package/dist/chunk-XGPU467M.js +136 -0
  62. package/dist/chunk-XGPU467M.js.map +1 -0
  63. package/dist/compat/index.cjs +7656 -0
  64. package/dist/compat/index.cjs.map +1 -0
  65. package/dist/compat/index.d.cts +18 -0
  66. package/dist/compat/index.d.ts +18 -0
  67. package/dist/compat/index.js +50 -0
  68. package/dist/compat/index.js.map +1 -0
  69. package/dist/compat/jotai/index.cjs +2048 -0
  70. package/dist/compat/jotai/index.cjs.map +1 -0
  71. package/dist/compat/jotai/index.d.cts +2 -0
  72. package/dist/compat/jotai/index.d.ts +2 -0
  73. package/dist/compat/jotai/index.js +9 -0
  74. package/dist/compat/jotai/index.js.map +1 -0
  75. package/dist/compat/nanostores/index.cjs +2175 -0
  76. package/dist/compat/nanostores/index.cjs.map +1 -0
  77. package/dist/compat/nanostores/index.d.cts +2 -0
  78. package/dist/compat/nanostores/index.d.ts +2 -0
  79. package/dist/compat/nanostores/index.js +23 -0
  80. package/dist/compat/nanostores/index.js.map +1 -0
  81. package/dist/compat/nestjs/index.cjs +350 -16
  82. package/dist/compat/nestjs/index.cjs.map +1 -1
  83. package/dist/compat/nestjs/index.d.cts +6 -6
  84. package/dist/compat/nestjs/index.d.ts +6 -6
  85. package/dist/compat/nestjs/index.js +11 -9
  86. package/dist/compat/react/index.cjs +141 -0
  87. package/dist/compat/react/index.cjs.map +1 -0
  88. package/dist/compat/react/index.d.cts +2 -0
  89. package/dist/compat/react/index.d.ts +2 -0
  90. package/dist/compat/react/index.js +12 -0
  91. package/dist/compat/react/index.js.map +1 -0
  92. package/dist/compat/solid/index.cjs +128 -0
  93. package/dist/compat/solid/index.cjs.map +1 -0
  94. package/dist/compat/solid/index.d.cts +2 -0
  95. package/dist/compat/solid/index.d.ts +2 -0
  96. package/dist/compat/solid/index.js +12 -0
  97. package/dist/compat/solid/index.js.map +1 -0
  98. package/dist/compat/svelte/index.cjs +131 -0
  99. package/dist/compat/svelte/index.cjs.map +1 -0
  100. package/dist/compat/svelte/index.d.cts +2 -0
  101. package/dist/compat/svelte/index.d.ts +2 -0
  102. package/dist/compat/svelte/index.js +12 -0
  103. package/dist/compat/svelte/index.js.map +1 -0
  104. package/dist/compat/vue/index.cjs +146 -0
  105. package/dist/compat/vue/index.cjs.map +1 -0
  106. package/dist/compat/vue/index.d.cts +3 -0
  107. package/dist/compat/vue/index.d.ts +3 -0
  108. package/dist/compat/vue/index.js +12 -0
  109. package/dist/compat/vue/index.js.map +1 -0
  110. package/dist/compat/zustand/index.cjs +4931 -0
  111. package/dist/compat/zustand/index.cjs.map +1 -0
  112. package/dist/compat/zustand/index.d.cts +5 -0
  113. package/dist/compat/zustand/index.d.ts +5 -0
  114. package/dist/compat/zustand/index.js +12 -0
  115. package/dist/compat/zustand/index.js.map +1 -0
  116. package/dist/composite-C7PcQvcs.d.cts +303 -0
  117. package/dist/composite-aUCvjZVR.d.ts +303 -0
  118. package/dist/core/index.cjs +53 -4
  119. package/dist/core/index.cjs.map +1 -1
  120. package/dist/core/index.d.cts +4 -3
  121. package/dist/core/index.d.ts +4 -3
  122. package/dist/core/index.js +26 -24
  123. package/dist/demo-shell-BDkOptd6.d.ts +102 -0
  124. package/dist/demo-shell-Crid1WdR.d.cts +102 -0
  125. package/dist/extra/index.cjs +222 -110
  126. package/dist/extra/index.cjs.map +1 -1
  127. package/dist/extra/index.d.cts +6 -4
  128. package/dist/extra/index.d.ts +6 -4
  129. package/dist/extra/index.js +72 -65
  130. package/dist/extra/sources.cjs +2486 -0
  131. package/dist/extra/sources.cjs.map +1 -0
  132. package/dist/extra/sources.d.cts +465 -0
  133. package/dist/extra/sources.d.ts +465 -0
  134. package/dist/extra/sources.js +57 -0
  135. package/dist/extra/sources.js.map +1 -0
  136. package/dist/graph/index.cjs +408 -14
  137. package/dist/graph/index.cjs.map +1 -1
  138. package/dist/graph/index.d.cts +5 -5
  139. package/dist/graph/index.d.ts +5 -5
  140. package/dist/graph/index.js +13 -5
  141. package/dist/{graph-D-3JIQme.d.cts → graph-CCwGKLCm.d.ts} +195 -4
  142. package/dist/{graph-B6NFqv3z.d.ts → graph-DNCrvZSn.d.cts} +195 -4
  143. package/dist/index-3lsddbbS.d.ts +86 -0
  144. package/dist/index-B1tloyhO.d.cts +34 -0
  145. package/dist/{index-CYkjxu3s.d.ts → index-B6D3QNSA.d.ts} +33 -4
  146. package/dist/index-B6EhDnjH.d.cts +37 -0
  147. package/dist/index-B9B7_HEY.d.ts +37 -0
  148. package/dist/{index-Ds23Wvou.d.ts → index-BHlKbUwO.d.cts} +131 -883
  149. package/dist/{index-DiobMNwE.d.ts → index-BPVt8kqc.d.ts} +3 -3
  150. package/dist/index-BaSM3aYt.d.ts +195 -0
  151. package/dist/index-BuEoe-Qu.d.ts +121 -0
  152. package/dist/{index-Ch0IpIO0.d.cts → index-BwfLUNw4.d.ts} +131 -883
  153. package/dist/index-ByQxazQJ.d.cts +86 -0
  154. package/dist/index-C0svESO4.d.ts +127 -0
  155. package/dist/{index-OXImXMq6.d.ts → index-C8oil6M6.d.ts} +18 -196
  156. package/dist/{index-DKE1EATr.d.cts → index-CI3DprxP.d.cts} +18 -196
  157. package/dist/{index-AMWewNDe.d.cts → index-CO8uBlUh.d.cts} +33 -4
  158. package/dist/index-CxFrXH4m.d.ts +45 -0
  159. package/dist/index-D8wS_PeY.d.cts +121 -0
  160. package/dist/index-DO_6JN9Z.d.cts +127 -0
  161. package/dist/index-DVGiGFGT.d.cts +195 -0
  162. package/dist/index-DYme44FM.d.cts +44 -0
  163. package/dist/{index-J7Kc0oIQ.d.cts → index-DlLp-2Xn.d.cts} +3 -3
  164. package/dist/index-Dzk2hrlR.d.ts +44 -0
  165. package/dist/index-VHqptjhu.d.cts +45 -0
  166. package/dist/index-VdHQMPy1.d.ts +36 -0
  167. package/dist/index-Xi3u0HCQ.d.cts +36 -0
  168. package/dist/index-wEn0eFe8.d.ts +34 -0
  169. package/dist/index.cjs +1780 -176
  170. package/dist/index.cjs.map +1 -1
  171. package/dist/index.d.cts +784 -2082
  172. package/dist/index.d.ts +784 -2082
  173. package/dist/index.js +955 -4349
  174. package/dist/index.js.map +1 -1
  175. package/dist/memory-C6Z2tGpC.d.cts +139 -0
  176. package/dist/memory-li6FL5RM.d.ts +139 -0
  177. package/dist/messaging-Gt4LPbyA.d.cts +269 -0
  178. package/dist/messaging-XDoYablx.d.ts +269 -0
  179. package/dist/{meta-DWbkoq1s.d.cts → meta-BxCA7rcr.d.cts} +1 -1
  180. package/dist/{meta-CnkLA_43.d.ts → meta-CbznRPYJ.d.ts} +1 -1
  181. package/dist/{node-B-f-Lu-k.d.cts → node-BmerH3kS.d.cts} +26 -1
  182. package/dist/{node-B-f-Lu-k.d.ts → node-BmerH3kS.d.ts} +26 -1
  183. package/dist/{observable-uP-wy_uK.d.ts → observable-BgGUwcqp.d.ts} +1 -1
  184. package/dist/{observable-DBnrwcar.d.cts → observable-DJt_AxzQ.d.cts} +1 -1
  185. package/dist/patterns/ai.cjs +7930 -0
  186. package/dist/patterns/ai.cjs.map +1 -0
  187. package/dist/patterns/ai.d.cts +10 -0
  188. package/dist/patterns/ai.d.ts +10 -0
  189. package/dist/patterns/ai.js +71 -0
  190. package/dist/patterns/ai.js.map +1 -0
  191. package/dist/patterns/audit.cjs +5805 -0
  192. package/dist/patterns/audit.cjs.map +1 -0
  193. package/dist/patterns/audit.d.cts +6 -0
  194. package/dist/patterns/audit.d.ts +6 -0
  195. package/dist/patterns/audit.js +29 -0
  196. package/dist/patterns/audit.js.map +1 -0
  197. package/dist/patterns/demo-shell.cjs +5604 -0
  198. package/dist/patterns/demo-shell.cjs.map +1 -0
  199. package/dist/patterns/demo-shell.d.cts +6 -0
  200. package/dist/patterns/demo-shell.d.ts +6 -0
  201. package/dist/patterns/demo-shell.js +15 -0
  202. package/dist/patterns/demo-shell.js.map +1 -0
  203. package/dist/patterns/memory.cjs +5283 -0
  204. package/dist/patterns/memory.cjs.map +1 -0
  205. package/dist/patterns/memory.d.cts +5 -0
  206. package/dist/patterns/memory.d.ts +5 -0
  207. package/dist/patterns/memory.js +20 -0
  208. package/dist/patterns/memory.js.map +1 -0
  209. package/dist/patterns/reactive-layout/index.cjs +355 -13
  210. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  211. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  212. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  213. package/dist/patterns/reactive-layout/index.js +15 -12
  214. package/dist/reactive-layout-MQP--J3F.d.cts +183 -0
  215. package/dist/reactive-layout-u5Ulnqag.d.ts +183 -0
  216. package/dist/{storage-BuTdpCI1.d.cts → storage-CMjUUuxn.d.ts} +10 -2
  217. package/dist/{storage-F2X1U1x0.d.ts → storage-DdWlZo6U.d.cts} +10 -2
  218. package/dist/sugar-CCOxXK1e.d.ts +201 -0
  219. package/dist/sugar-D02n5JjF.d.cts +201 -0
  220. package/package.json +63 -3
  221. package/dist/chunk-5DJTTKX3.js.map +0 -1
  222. package/dist/chunk-IAHGTNOZ.js.map +0 -1
  223. package/dist/chunk-L2GLW2U7.js.map +0 -1
  224. package/dist/chunk-MW4VAKAO.js +0 -47
  225. package/dist/chunk-MW4VAKAO.js.map +0 -1
  226. package/dist/chunk-PY4XCDLR.js.map +0 -1
  227. package/dist/chunk-TKE3JGOH.js.map +0 -1
  228. package/dist/chunk-XOFWRC73.js.map +0 -1
  229. package/dist/index-BJB7t9gg.d.cts +0 -392
  230. package/dist/index-C-TXEa7C.d.ts +0 -392
  231. /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
@@ -1,320 +1,15 @@
1
1
  import {
2
2
  emitToMeta
3
- } from "./chunk-HWPIFSW2.js";
3
+ } from "./chunk-JSCT3CR4.js";
4
4
  import {
5
5
  Graph
6
- } from "./chunk-XOFWRC73.js";
6
+ } from "./chunk-PF7GRZMW.js";
7
7
  import {
8
- __export,
9
8
  derived,
10
9
  monotonicNs,
11
10
  node,
12
11
  state
13
- } from "./chunk-5DJTTKX3.js";
14
-
15
- // src/patterns/reactive-layout/index.ts
16
- var reactive_layout_exports = {};
17
- __export(reactive_layout_exports, {
18
- CanvasMeasureAdapter: () => CanvasMeasureAdapter,
19
- CliMeasureAdapter: () => CliMeasureAdapter,
20
- ImageSizeAdapter: () => ImageSizeAdapter,
21
- NodeCanvasMeasureAdapter: () => NodeCanvasMeasureAdapter,
22
- PrecomputedAdapter: () => PrecomputedAdapter,
23
- SvgBoundsAdapter: () => SvgBoundsAdapter,
24
- analyzeAndMeasure: () => analyzeAndMeasure,
25
- carveTextLineSlots: () => carveTextLineSlots,
26
- circleIntervalForBand: () => circleIntervalForBand,
27
- computeBlockFlow: () => computeBlockFlow,
28
- computeCharPositions: () => computeCharPositions,
29
- computeFlowLines: () => computeFlowLines,
30
- computeLineBreaks: () => computeLineBreaks,
31
- computeTotalHeight: () => computeTotalHeight,
32
- layoutNextLine: () => layoutNextLine,
33
- measureBlock: () => measureBlock,
34
- measureBlocks: () => measureBlocks,
35
- reactiveBlockLayout: () => reactiveBlockLayout,
36
- reactiveFlowLayout: () => reactiveFlowLayout,
37
- reactiveLayout: () => reactiveLayout,
38
- rectIntervalForBand: () => rectIntervalForBand
39
- });
40
-
41
- // src/patterns/reactive-layout/measurement-adapters.ts
42
- function cellWidth(code) {
43
- if (code >= 768 && code <= 879 || // Combining Diacritical Marks
44
- code >= 1155 && code <= 1161 || // Cyrillic combining marks
45
- code >= 1425 && code <= 1469 || // Hebrew combining marks
46
- code >= 1552 && code <= 1562 || // Arabic combining marks
47
- code >= 1611 && code <= 1631 || // Arabic combining marks
48
- code >= 1648 && code === 1648 || // Arabic superscript alef
49
- code >= 1750 && code <= 1756 || // Arabic combining marks
50
- code >= 1759 && code <= 1764 || // Arabic combining marks
51
- code >= 1767 && code <= 1768 || // Arabic combining marks
52
- code >= 1770 && code <= 1773 || // Arabic combining marks
53
- code >= 1840 && code <= 1866 || // Syriac combining marks
54
- code >= 1958 && code <= 1968 || // Thaana combining marks
55
- code >= 2304 && code <= 2307 || // Devanagari combining marks
56
- code >= 2362 && code <= 2383 || // Devanagari combining marks
57
- code >= 2385 && code <= 2391 || // Devanagari combining marks
58
- code >= 2402 && code <= 2403 || // Devanagari combining marks
59
- code >= 2433 && code <= 2435 || // Bengali combining marks
60
- code >= 2492 && code <= 2509 || // Bengali combining marks
61
- code >= 2561 && code <= 2563 || // Gurmukhi combining marks
62
- code >= 2620 && code <= 2641 || // Gurmukhi combining marks
63
- code >= 2672 && code <= 2673 || // Gurmukhi combining marks
64
- code >= 2677 && code === 2677 || // Gurmukhi combining mark
65
- code >= 3633 && code === 3633 || // Thai combining mark
66
- code >= 3636 && code <= 3642 || // Thai combining marks
67
- code >= 3655 && code <= 3662 || // Thai combining marks
68
- code >= 3761 && code === 3761 || // Lao combining mark
69
- code >= 3764 && code <= 3772 || // Lao combining marks
70
- code >= 3784 && code <= 3790 || // Lao combining marks
71
- code >= 7616 && code <= 7679 || // Combining Diacritical Marks Supplement
72
- code >= 8400 && code <= 8447 || // Combining Diacritical Marks for Symbols
73
- code >= 65024 && code <= 65039 || // Variation Selectors
74
- code >= 65056 && code <= 65071 || // Combining Half Marks
75
- code === 8205) {
76
- return 0;
77
- }
78
- if (code >= 4352 && code <= 4447 || // Hangul Jamo
79
- code >= 8986 && code <= 8987 || // Watch, Hourglass
80
- code >= 9001 && code <= 9002 || // Angle brackets
81
- code >= 9193 && code <= 9203 || // Media control symbols
82
- code >= 9208 && code <= 9210 || // Media control symbols
83
- code >= 9725 && code <= 9726 || // Medium squares
84
- code >= 9748 && code <= 9749 || // Umbrella, Hot Beverage
85
- code >= 9800 && code <= 9811 || // Zodiac symbols
86
- code === 9855 || // Wheelchair
87
- code === 9875 || // Anchor
88
- code === 9889 || // High Voltage
89
- code >= 9898 && code <= 9899 || // Medium circles
90
- code >= 9917 && code <= 9918 || // Soccer, Baseball
91
- code >= 9924 && code <= 9925 || // Snowman, Sun behind cloud
92
- code === 9934 || // Ophiuchus
93
- code === 9940 || // No Entry
94
- code === 9962 || // Church
95
- code >= 9970 && code <= 9971 || // Fountain, Golf
96
- code === 9973 || // Sailboat
97
- code === 9978 || // Tent
98
- code === 9981 || // Fuel Pump
99
- code === 9986 || // Scissors
100
- code === 9989 || // Check Mark
101
- code >= 9992 && code <= 9997 || // Airplane...Writing Hand
102
- code === 9999 || // Pencil
103
- code >= 10067 && code <= 10069 || // Question marks
104
- code === 10071 || // Exclamation
105
- code >= 10133 && code <= 10135 || // Plus, Minus, Divide
106
- code === 10160 || // Curly Loop
107
- code === 10175 || // Double Curly Loop
108
- code >= 10548 && code <= 10549 || // Arrows
109
- code >= 11013 && code <= 11015 || // Arrows
110
- code >= 11035 && code <= 11036 || // Squares
111
- code === 11088 || // Star
112
- code === 11093 || // Circle
113
- code >= 11904 && code <= 12350 || // CJK Radicals, Symbols, Punctuation
114
- code >= 12352 && code <= 12447 || // Hiragana
115
- code >= 12448 && code <= 12543 || // Katakana
116
- code >= 12549 && code <= 12591 || // Bopomofo
117
- code >= 12593 && code <= 12686 || // Hangul Compatibility Jamo
118
- code >= 12688 && code <= 12771 || // Kanbun, CJK Strokes
119
- code >= 12784 && code <= 12830 || // Katakana Phonetic Extensions
120
- code >= 12832 && code <= 12871 || // Enclosed CJK
121
- code >= 12880 && code <= 19903 || // CJK Extensions + Unified block
122
- code >= 19968 && code <= 40959 || // CJK Unified Ideographs
123
- code >= 43360 && code <= 43388 || // Hangul Jamo Extended-A
124
- code >= 44032 && code <= 55203 || // Hangul Syllables
125
- code >= 63744 && code <= 64255 || // CJK Compatibility Ideographs
126
- code >= 65040 && code <= 65049 || // Vertical forms
127
- code >= 65072 && code <= 65131 || // CJK Compatibility Forms
128
- code >= 65281 && code <= 65376 || // Fullwidth Forms (excl. halfwidth)
129
- code >= 65504 && code <= 65510 || // Fullwidth Signs
130
- code >= 126980 && code === 126980 || // Mahjong Red Dragon
131
- code === 127183 || // Joker
132
- code >= 127344 && code <= 127345 || // A/B buttons
133
- code === 127358 || // O button
134
- code === 127359 || // P button
135
- code === 127374 || // AB button
136
- code >= 127377 && code <= 127386 || // Squared symbols
137
- code >= 127456 && code <= 127487 || // Regional Indicator Symbols
138
- code >= 127488 && code <= 127490 || // Enclosed ideographic
139
- code === 127514 || // Squared CJK
140
- code === 127535 || // Squared CJK
141
- code >= 127538 && code <= 127546 || // Squared CJK
142
- code >= 127568 && code <= 127569 || // Circled ideographic
143
- code >= 127744 && code <= 129535 || // Misc Symbols / Emoticons / Emoji
144
- code >= 129536 && code <= 129791 || // Chess, Symbols Extended-A
145
- code >= 129792 && code <= 130047 || // Symbols for Legacy Computing
146
- code >= 131072 && code <= 196605 || // CJK Extension B-F (excl. nonchars)
147
- code >= 196608 && code <= 262141) {
148
- return 2;
149
- }
150
- return 1;
151
- }
152
- function countCells(text) {
153
- let cells = 0;
154
- for (const ch of text) {
155
- cells += cellWidth(ch.codePointAt(0));
156
- }
157
- return cells;
158
- }
159
- var CliMeasureAdapter = class {
160
- cellPx;
161
- constructor(opts) {
162
- this.cellPx = opts?.cellPx ?? 8;
163
- }
164
- measureSegment(text, _font) {
165
- return { width: countCells(text) * this.cellPx };
166
- }
167
- };
168
- var PrecomputedAdapterKeyError = class extends Error {
169
- name = "KeyError";
170
- };
171
- var PrecomputedAdapter = class {
172
- metrics;
173
- fallback;
174
- constructor(opts) {
175
- this.metrics = opts.metrics;
176
- const fb = opts.fallback ?? "per-char";
177
- if (fb !== "per-char" && fb !== "error") {
178
- throw new Error(
179
- `fallback must be 'per-char' or 'error', got ${JSON.stringify(opts.fallback)}`
180
- );
181
- }
182
- this.fallback = fb;
183
- }
184
- measureSegment(text, font) {
185
- const fontMap = this.metrics[font];
186
- if (fontMap) {
187
- const w = fontMap[text];
188
- if (w !== void 0) return { width: w };
189
- }
190
- if (this.fallback === "error") {
191
- throw new PrecomputedAdapterKeyError(
192
- `PrecomputedAdapter: no metrics for segment ${JSON.stringify(text)} in font ${JSON.stringify(font)}`
193
- );
194
- }
195
- let total = 0;
196
- if (fontMap) {
197
- for (const ch of text) {
198
- const cw = fontMap[ch];
199
- if (cw !== void 0) {
200
- total += cw;
201
- }
202
- }
203
- }
204
- return { width: total };
205
- }
206
- };
207
- var CanvasMeasureAdapter = class {
208
- ctx = null;
209
- currentFont = "";
210
- emojiCorrection;
211
- constructor(opts) {
212
- this.emojiCorrection = opts?.emojiCorrection ?? 1;
213
- }
214
- getContext() {
215
- if (!this.ctx) {
216
- if (typeof OffscreenCanvas === "undefined") {
217
- throw new Error(
218
- "CanvasMeasureAdapter requires a browser environment with OffscreenCanvas support. Use CliMeasureAdapter or NodeCanvasMeasureAdapter for Node.js."
219
- );
220
- }
221
- const canvas = new OffscreenCanvas(0, 0);
222
- const ctx = canvas.getContext("2d");
223
- if (!ctx) throw new Error("CanvasMeasureAdapter: failed to get 2d context");
224
- this.ctx = ctx;
225
- }
226
- return this.ctx;
227
- }
228
- measureSegment(text, font) {
229
- const ctx = this.getContext();
230
- if (font !== this.currentFont) {
231
- ctx.font = font;
232
- this.currentFont = font;
233
- }
234
- let width = ctx.measureText(text).width;
235
- if (this.emojiCorrection !== 1 && /\p{Emoji_Presentation}/u.test(text)) {
236
- width *= this.emojiCorrection;
237
- }
238
- return { width };
239
- }
240
- clearCache() {
241
- this.currentFont = "";
242
- }
243
- };
244
- var NodeCanvasMeasureAdapter = class {
245
- ctx = null;
246
- currentFont = "";
247
- canvasModule;
248
- constructor(canvasModule) {
249
- this.canvasModule = canvasModule;
250
- }
251
- getContext() {
252
- if (!this.ctx) {
253
- const canvas = this.canvasModule.createCanvas(0, 0);
254
- const ctx = canvas.getContext("2d");
255
- if (!ctx) throw new Error("NodeCanvasMeasureAdapter: failed to get 2d context");
256
- this.ctx = ctx;
257
- }
258
- return this.ctx;
259
- }
260
- measureSegment(text, font) {
261
- const ctx = this.getContext();
262
- if (font !== this.currentFont) {
263
- ctx.font = font;
264
- this.currentFont = font;
265
- }
266
- return { width: ctx.measureText(text).width };
267
- }
268
- clearCache() {
269
- this.currentFont = "";
270
- }
271
- };
272
- var SvgBoundsAdapter = class {
273
- measureSvg(content) {
274
- const viewBoxMatch = content.match(/viewBox\s*=\s*["']([^"']+)["']/);
275
- if (viewBoxMatch) {
276
- const parts = viewBoxMatch[1].trim().split(/[\s,]+/);
277
- if (parts.length >= 4) {
278
- const w = Number.parseFloat(parts[2]);
279
- const h = Number.parseFloat(parts[3]);
280
- if (Number.isFinite(w) && Number.isFinite(h) && w > 0 && h > 0) {
281
- return { width: w, height: h };
282
- }
283
- throw new Error(
284
- "SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive"
285
- );
286
- }
287
- }
288
- const widthMatch = content.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/);
289
- const heightMatch = content.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);
290
- if (widthMatch && heightMatch) {
291
- const w = Number.parseFloat(widthMatch[1]);
292
- const h = Number.parseFloat(heightMatch[1]);
293
- if (Number.isFinite(w) && Number.isFinite(h) && w > 0 && h > 0) {
294
- return { width: w, height: h };
295
- }
296
- throw new Error(
297
- "SvgBoundsAdapter: svg width/height attributes are non-finite or not positive"
298
- );
299
- }
300
- throw new Error(
301
- "SvgBoundsAdapter: cannot determine dimensions \u2014 SVG has no viewBox or width/height attributes"
302
- );
303
- }
304
- };
305
- var ImageSizeAdapter = class {
306
- sizes;
307
- constructor(sizes) {
308
- this.sizes = new Map(Object.entries(sizes));
309
- }
310
- measureImage(src) {
311
- const dims = this.sizes.get(src);
312
- if (!dims) {
313
- throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(src)}`);
314
- }
315
- return { width: dims.width, height: dims.height };
316
- }
317
- };
12
+ } from "./chunk-PHOUUNK7.js";
318
13
 
319
14
  // src/patterns/reactive-layout/reactive-layout.ts
320
15
  function isCJK(s) {
@@ -1160,394 +855,12 @@ function reactiveLayout(opts) {
1160
855
  };
1161
856
  }
1162
857
 
1163
- // src/patterns/reactive-layout/reactive-block-layout.ts
1164
- function measureBlock(block, maxWidth, adapters, measureCache, defaultFont, defaultLineHeight, index) {
1165
- switch (block.type) {
1166
- case "text": {
1167
- const font = block.font ?? defaultFont;
1168
- const lineHeight = block.lineHeight ?? defaultLineHeight;
1169
- const segments = analyzeAndMeasure(block.text, font, adapters.text, measureCache);
1170
- const lineBreaks = computeLineBreaks(segments, maxWidth, adapters.text, font, measureCache);
1171
- const charPositions = computeCharPositions(lineBreaks, segments, lineHeight);
1172
- const height = lineBreaks.lineCount * lineHeight;
1173
- let width = 0;
1174
- for (const line of lineBreaks.lines) {
1175
- if (line.width > width) width = line.width;
1176
- }
1177
- return {
1178
- index,
1179
- type: "text",
1180
- width: Math.min(width, maxWidth),
1181
- height,
1182
- textSegments: segments,
1183
- textLineBreaks: lineBreaks,
1184
- textCharPositions: charPositions
1185
- };
1186
- }
1187
- case "image": {
1188
- let w;
1189
- let h;
1190
- if (block.naturalWidth != null && block.naturalHeight != null) {
1191
- w = block.naturalWidth;
1192
- h = block.naturalHeight;
1193
- } else if (adapters.image) {
1194
- const dims = adapters.image.measureImage(block.src);
1195
- w = dims.width;
1196
- h = dims.height;
1197
- } else {
1198
- throw new Error(
1199
- `Image block at index ${index} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`
1200
- );
1201
- }
1202
- if (w > maxWidth) {
1203
- h = h * maxWidth / w;
1204
- w = maxWidth;
1205
- }
1206
- return { index, type: "image", width: w, height: h };
1207
- }
1208
- case "svg": {
1209
- let w;
1210
- let h;
1211
- if (block.viewBox) {
1212
- w = block.viewBox.width;
1213
- h = block.viewBox.height;
1214
- } else if (adapters.svg) {
1215
- const dims = adapters.svg.measureSvg(block.content);
1216
- w = dims.width;
1217
- h = dims.height;
1218
- } else {
1219
- throw new Error(`SVG block at index ${index} has no viewBox and no SvgMeasurer adapter`);
1220
- }
1221
- if (w > maxWidth) {
1222
- h = h * maxWidth / w;
1223
- w = maxWidth;
1224
- }
1225
- return { index, type: "svg", width: w, height: h };
1226
- }
1227
- }
1228
- }
1229
- function measureBlocks(blocks, maxWidth, adapters, measureCache, defaultFont, defaultLineHeight) {
1230
- return blocks.map(
1231
- (block, i) => measureBlock(block, maxWidth, adapters, measureCache, defaultFont, defaultLineHeight, i)
1232
- );
1233
- }
1234
- function computeBlockFlow(measured, gap) {
1235
- const result = [];
1236
- let y = 0;
1237
- for (let i = 0; i < measured.length; i++) {
1238
- const m = measured[i];
1239
- result.push({ ...m, x: 0, y });
1240
- y += m.height + (i < measured.length - 1 ? gap : 0);
1241
- }
1242
- return result;
1243
- }
1244
- function computeTotalHeight(flow) {
1245
- if (flow.length === 0) return 0;
1246
- const last = flow[flow.length - 1];
1247
- return last.y + last.height;
1248
- }
1249
- function reactiveBlockLayout(opts) {
1250
- const {
1251
- adapters,
1252
- name = "reactive-block-layout",
1253
- defaultFont = "16px sans-serif",
1254
- defaultLineHeight = 20
1255
- } = opts;
1256
- const g = new Graph(name);
1257
- const measureCache = /* @__PURE__ */ new Map();
1258
- const blocksNode = state(opts.blocks ?? [], { name: "blocks" });
1259
- const maxWidthNode = state(Math.max(0, opts.maxWidth ?? 800), { name: "max-width" });
1260
- const gapNode = state(opts.gap ?? 0, { name: "gap" });
1261
- const measuredBlocksNode = node(
1262
- [blocksNode, maxWidthNode],
1263
- (data, actions, ctx) => {
1264
- const blocksVal = data[0] != null && data[0].length > 0 ? data[0].at(-1) : ctx.prevData[0];
1265
- const mwVal = data[1] != null && data[1].length > 0 ? data[1].at(-1) : ctx.prevData[1];
1266
- const t0 = monotonicNs();
1267
- const result = measureBlocks(
1268
- blocksVal,
1269
- mwVal,
1270
- adapters,
1271
- measureCache,
1272
- defaultFont,
1273
- defaultLineHeight
1274
- );
1275
- const elapsed = monotonicNs() - t0;
1276
- const meta = measuredBlocksNode.meta;
1277
- if (meta) {
1278
- emitToMeta(meta["block-count"], result.length);
1279
- emitToMeta(meta["layout-time-ns"], elapsed);
1280
- }
1281
- actions.emit(result);
1282
- return () => {
1283
- measureCache.clear();
1284
- adapters.text.clearCache?.();
1285
- };
1286
- },
1287
- {
1288
- name: "measured-blocks",
1289
- describeKind: "derived",
1290
- meta: { "block-count": 0, "layout-time-ns": 0 },
1291
- equals: (a, b) => {
1292
- const ma = a;
1293
- const mb = b;
1294
- if (ma == null || mb == null) return ma === mb;
1295
- if (ma.length !== mb.length) return false;
1296
- for (let i = 0; i < ma.length; i++) {
1297
- const ba = ma[i];
1298
- const bb = mb[i];
1299
- if (ba.type !== bb.type || ba.width !== bb.width || ba.height !== bb.height || ba.index !== bb.index)
1300
- return false;
1301
- }
1302
- return true;
1303
- }
1304
- }
1305
- );
1306
- const blockFlowNode = derived(
1307
- [measuredBlocksNode, gapNode],
1308
- ([measured, gapVal]) => {
1309
- return computeBlockFlow(measured, gapVal);
1310
- },
1311
- {
1312
- name: "block-flow",
1313
- equals: (a, b) => {
1314
- const fa = a;
1315
- const fb = b;
1316
- if (fa == null || fb == null) return fa === fb;
1317
- if (fa.length !== fb.length) return false;
1318
- for (let i = 0; i < fa.length; i++) {
1319
- const pa = fa[i];
1320
- const pb = fb[i];
1321
- if (pa.x !== pb.x || pa.y !== pb.y || pa.width !== pb.width || pa.height !== pb.height)
1322
- return false;
1323
- }
1324
- return true;
1325
- }
1326
- }
1327
- );
1328
- const totalHeightNode = derived(
1329
- [blockFlowNode],
1330
- ([flow]) => computeTotalHeight(flow),
1331
- { name: "total-height" }
1332
- );
1333
- g.add("blocks", blocksNode);
1334
- g.add("max-width", maxWidthNode);
1335
- g.add("gap", gapNode);
1336
- g.add("measured-blocks", measuredBlocksNode);
1337
- g.add("block-flow", blockFlowNode);
1338
- g.add("total-height", totalHeightNode);
1339
- return {
1340
- graph: g,
1341
- setBlocks: (blocks) => g.set("blocks", blocks),
1342
- setMaxWidth: (mw) => g.set("max-width", Math.max(0, mw)),
1343
- setGap: (gap) => g.set("gap", gap),
1344
- measuredBlocks: measuredBlocksNode,
1345
- blockFlow: blockFlowNode,
1346
- totalHeight: totalHeightNode
1347
- };
1348
- }
1349
-
1350
- // src/patterns/reactive-layout/reactive-flow-layout.ts
1351
- function circleIntervalForBand(o, bandTop, bandBottom) {
1352
- const hPad = o.hPad ?? 0;
1353
- const vPad = o.vPad ?? 0;
1354
- const top = bandTop - vPad;
1355
- const bottom = bandBottom + vPad;
1356
- if (top >= o.cy + o.r || bottom <= o.cy - o.r) return null;
1357
- const minDy = o.cy >= top && o.cy <= bottom ? 0 : o.cy < top ? top - o.cy : o.cy - bottom;
1358
- if (minDy >= o.r) return null;
1359
- const maxDx = Math.sqrt(o.r * o.r - minDy * minDy);
1360
- return { left: o.cx - maxDx - hPad, right: o.cx + maxDx + hPad };
1361
- }
1362
- function rectIntervalForBand(o, bandTop, bandBottom) {
1363
- const hPad = o.hPad ?? 0;
1364
- const vPad = o.vPad ?? 0;
1365
- if (bandBottom <= o.y - vPad) return null;
1366
- if (bandTop >= o.y + o.h + vPad) return null;
1367
- return { left: o.x - hPad, right: o.x + o.w + hPad };
1368
- }
1369
- function obstacleIntervalForBand(o, bandTop, bandBottom) {
1370
- return o.kind === "circle" ? circleIntervalForBand(o, bandTop, bandBottom) : rectIntervalForBand(o, bandTop, bandBottom);
1371
- }
1372
- function computeFlowLines(segments, container, columns, obstacles, lineHeight, minSlotWidth) {
1373
- const lines = [];
1374
- let cursor = { segmentIndex: 0, graphemeIndex: 0 };
1375
- if (segments.length === 0 || columns.count <= 0 || lineHeight <= 0) {
1376
- return { lines, cursor };
1377
- }
1378
- const padX = container.paddingX ?? 0;
1379
- const padY = container.paddingY ?? 0;
1380
- const availWidth = Math.max(0, container.width - padX * 2);
1381
- const availHeight = Math.max(0, container.height - padY * 2);
1382
- const gapTotal = columns.gap * Math.max(0, columns.count - 1);
1383
- const colWidth = Math.max(0, (availWidth - gapTotal) / columns.count);
1384
- if (colWidth <= 0) return { lines, cursor };
1385
- outerCol: for (let col = 0; col < columns.count; col++) {
1386
- const colLeft = padX + col * (colWidth + columns.gap);
1387
- const colRight = colLeft + colWidth;
1388
- let bandTop = padY;
1389
- while (bandTop + lineHeight <= padY + availHeight) {
1390
- const bandBottom = bandTop + lineHeight;
1391
- const blocked = [];
1392
- for (let oi = 0; oi < obstacles.length; oi++) {
1393
- const iv = obstacleIntervalForBand(obstacles[oi], bandTop, bandBottom);
1394
- if (iv !== null) blocked.push(iv);
1395
- }
1396
- const slots = carveTextLineSlots({ left: colLeft, right: colRight }, blocked, minSlotWidth);
1397
- if (slots.length === 0) {
1398
- bandTop += lineHeight;
1399
- continue;
1400
- }
1401
- let hardBreakThisBand = false;
1402
- for (let si = 0; si < slots.length; si++) {
1403
- const slot = slots[si];
1404
- const slotW = slot.right - slot.left;
1405
- const line = layoutNextLine(segments, cursor, slotW);
1406
- if (line === null) {
1407
- return { lines, cursor };
1408
- }
1409
- if (line.text.length === 0 && line.width === 0) {
1410
- cursor = line.end;
1411
- hardBreakThisBand = true;
1412
- break;
1413
- }
1414
- lines.push({
1415
- x: slot.left,
1416
- y: bandTop,
1417
- width: line.width,
1418
- slotWidth: slotW,
1419
- text: line.text,
1420
- columnIndex: col,
1421
- flushToRight: slot.right < colRight - 0.5
1422
- });
1423
- cursor = line.end;
1424
- }
1425
- bandTop += lineHeight;
1426
- if (hardBreakThisBand) continue;
1427
- if (cursor.segmentIndex >= segments.length) break outerCol;
1428
- }
1429
- if (cursor.segmentIndex >= segments.length) break;
1430
- }
1431
- return { lines, cursor };
1432
- }
1433
- function reactiveFlowLayout(opts) {
1434
- const { adapter, name = "reactive-flow-layout", minSlotWidth = 20 } = opts;
1435
- const g = new Graph(name);
1436
- const measureCache = /* @__PURE__ */ new Map();
1437
- const textNode = state(opts.text ?? "", { name: "text" });
1438
- const fontNode = state(opts.font ?? "16px sans-serif", { name: "font" });
1439
- const lineHeightNode = state(opts.lineHeight ?? 20, { name: "line-height" });
1440
- const containerNode = state(
1441
- opts.container ?? { width: 800, height: 600, paddingX: 0, paddingY: 0 },
1442
- { name: "container" }
1443
- );
1444
- const columnsNode = state(opts.columns ?? { count: 1, gap: 0 }, {
1445
- name: "columns"
1446
- });
1447
- const obstaclesNode = state(opts.obstacles ?? [], { name: "obstacles" });
1448
- const segmentsNode = node(
1449
- [textNode, fontNode],
1450
- (data, actions, ctx) => {
1451
- const b0 = data[0];
1452
- const textVal = b0 != null && b0.length > 0 ? b0.at(-1) : ctx.prevData[0];
1453
- const b1 = data[1];
1454
- const fontVal = b1 != null && b1.length > 0 ? b1.at(-1) : ctx.prevData[1];
1455
- const result = analyzeAndMeasure(textVal, fontVal, adapter, measureCache);
1456
- actions.emit(result);
1457
- return () => {
1458
- measureCache.clear();
1459
- adapter.clearCache?.();
1460
- };
1461
- },
1462
- { name: "segments", describeKind: "derived" }
1463
- );
1464
- const flowLinesNode = derived(
1465
- [segmentsNode, containerNode, columnsNode, obstaclesNode, lineHeightNode],
1466
- ([segs, cont, cols, obs, lh]) => {
1467
- const segments = segs;
1468
- const t0 = monotonicNs();
1469
- const { lines: result, cursor } = computeFlowLines(
1470
- segments,
1471
- cont,
1472
- cols,
1473
- obs,
1474
- lh,
1475
- minSlotWidth
1476
- );
1477
- const elapsed = monotonicNs() - t0;
1478
- const overflow = Math.max(0, segments.length - cursor.segmentIndex);
1479
- const meta = flowLinesNode.meta;
1480
- if (meta) {
1481
- emitToMeta(meta["line-count"], result.length);
1482
- emitToMeta(meta["layout-time-ns"], elapsed);
1483
- emitToMeta(meta["overflow-segments"], overflow);
1484
- }
1485
- return result;
1486
- },
1487
- {
1488
- name: "flow-lines",
1489
- meta: {
1490
- "line-count": 0,
1491
- "layout-time-ns": 0,
1492
- "overflow-segments": 0
1493
- },
1494
- equals: (a, b) => {
1495
- const la = a;
1496
- const lb = b;
1497
- if (la.length !== lb.length) return false;
1498
- for (let i = 0; i < la.length; i++) {
1499
- const pa = la[i];
1500
- const pb = lb[i];
1501
- if (pa.x !== pb.x || pa.y !== pb.y || pa.width !== pb.width || pa.slotWidth !== pb.slotWidth || pa.text !== pb.text || pa.columnIndex !== pb.columnIndex || pa.flushToRight !== pb.flushToRight)
1502
- return false;
1503
- }
1504
- return true;
1505
- }
1506
- }
1507
- );
1508
- g.add("text", textNode);
1509
- g.add("font", fontNode);
1510
- g.add("line-height", lineHeightNode);
1511
- g.add("container", containerNode);
1512
- g.add("columns", columnsNode);
1513
- g.add("obstacles", obstaclesNode);
1514
- g.add("segments", segmentsNode);
1515
- g.add("flow-lines", flowLinesNode);
1516
- return {
1517
- graph: g,
1518
- setText: (t) => g.set("text", t),
1519
- setFont: (f) => g.set("font", f),
1520
- setLineHeight: (lh) => g.set("line-height", lh),
1521
- setContainer: (c) => g.set("container", c),
1522
- setColumns: (c) => g.set("columns", c),
1523
- setObstacles: (o) => g.set("obstacles", o),
1524
- segments: segmentsNode,
1525
- flowLines: flowLinesNode
1526
- };
1527
- }
1528
-
1529
858
  export {
1530
859
  analyzeAndMeasure,
1531
860
  computeLineBreaks,
1532
861
  layoutNextLine,
1533
862
  carveTextLineSlots,
1534
863
  computeCharPositions,
1535
- reactiveLayout,
1536
- CliMeasureAdapter,
1537
- PrecomputedAdapter,
1538
- CanvasMeasureAdapter,
1539
- NodeCanvasMeasureAdapter,
1540
- SvgBoundsAdapter,
1541
- ImageSizeAdapter,
1542
- measureBlock,
1543
- measureBlocks,
1544
- computeBlockFlow,
1545
- computeTotalHeight,
1546
- reactiveBlockLayout,
1547
- circleIntervalForBand,
1548
- rectIntervalForBand,
1549
- computeFlowLines,
1550
- reactiveFlowLayout,
1551
- reactive_layout_exports
864
+ reactiveLayout
1552
865
  };
1553
- //# sourceMappingURL=chunk-TKE3JGOH.js.map
866
+ //# sourceMappingURL=chunk-GTE6PWRZ.js.map