@yaks/ux 0.0.0-stage → 0.2.36

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 (286) hide show
  1. package/Answer.js +43 -0
  2. package/Answer.js.map +1 -0
  3. package/Answer.ts +84 -0
  4. package/Conversation.js +520 -0
  5. package/Conversation.js.map +1 -0
  6. package/Conversation.ts +649 -0
  7. package/ConversationBox.js +106 -0
  8. package/ConversationBox.js.map +1 -0
  9. package/ConversationBox.ts +198 -0
  10. package/ConversationLines.js +29 -0
  11. package/ConversationLines.js.map +1 -0
  12. package/ConversationLines.ts +48 -0
  13. package/Disclosure.js +79 -0
  14. package/Disclosure.js.map +1 -0
  15. package/Disclosure.ts +130 -0
  16. package/Edit.js +330 -0
  17. package/Edit.js.map +1 -0
  18. package/Edit.ts +488 -0
  19. package/EntityPopup.js +35 -0
  20. package/EntityPopup.js.map +1 -0
  21. package/EntityPopup.ts +52 -0
  22. package/Fields.js +161 -0
  23. package/Fields.js.map +1 -0
  24. package/Fields.ts +276 -0
  25. package/LICENSE +202 -0
  26. package/Order.js +105 -0
  27. package/Order.js.map +1 -0
  28. package/Order.ts +159 -0
  29. package/README.md +1023 -2
  30. package/Save.js +50 -0
  31. package/Save.js.map +1 -0
  32. package/Save.ts +115 -0
  33. package/Sort.js +49 -0
  34. package/Sort.js.map +1 -0
  35. package/Sort.ts +98 -0
  36. package/Submit.js +115 -0
  37. package/Submit.js.map +1 -0
  38. package/Submit.ts +174 -0
  39. package/Text.js +114 -0
  40. package/Text.js.map +1 -0
  41. package/Text.ts +140 -0
  42. package/TokenPicker.js +65 -0
  43. package/TokenPicker.js.map +1 -0
  44. package/TokenPicker.ts +117 -0
  45. package/_dist/Answer.d.ts +39 -0
  46. package/_dist/Answer.d.ts.map +1 -0
  47. package/_dist/Conversation.d.ts +131 -0
  48. package/_dist/Conversation.d.ts.map +1 -0
  49. package/_dist/ConversationBox.d.ts +29 -0
  50. package/_dist/ConversationBox.d.ts.map +1 -0
  51. package/_dist/ConversationLines.d.ts +13 -0
  52. package/_dist/ConversationLines.d.ts.map +1 -0
  53. package/_dist/Disclosure.d.ts +36 -0
  54. package/_dist/Disclosure.d.ts.map +1 -0
  55. package/_dist/Edit.d.ts +87 -0
  56. package/_dist/Edit.d.ts.map +1 -0
  57. package/_dist/EntityPopup.d.ts +12 -0
  58. package/_dist/EntityPopup.d.ts.map +1 -0
  59. package/_dist/Fields.d.ts +29 -0
  60. package/_dist/Fields.d.ts.map +1 -0
  61. package/_dist/Order.d.ts +40 -0
  62. package/_dist/Order.d.ts.map +1 -0
  63. package/_dist/Save.d.ts +28 -0
  64. package/_dist/Save.d.ts.map +1 -0
  65. package/_dist/Sort.d.ts +28 -0
  66. package/_dist/Sort.d.ts.map +1 -0
  67. package/_dist/Submit.d.ts +48 -0
  68. package/_dist/Submit.d.ts.map +1 -0
  69. package/_dist/Text.d.ts +27 -0
  70. package/_dist/Text.d.ts.map +1 -0
  71. package/_dist/TokenPicker.d.ts +19 -0
  72. package/_dist/TokenPicker.d.ts.map +1 -0
  73. package/_dist/anchor.d.ts +52 -0
  74. package/_dist/anchor.d.ts.map +1 -0
  75. package/_dist/anchored.d.ts +30 -0
  76. package/_dist/anchored.d.ts.map +1 -0
  77. package/_dist/completion-state.d.ts +65 -0
  78. package/_dist/completion-state.d.ts.map +1 -0
  79. package/_dist/completion.d.ts +73 -0
  80. package/_dist/completion.d.ts.map +1 -0
  81. package/_dist/composer-browser.d.ts +1 -0
  82. package/_dist/composer-browser.d.ts.map +1 -0
  83. package/_dist/composer.d.ts +31 -0
  84. package/_dist/composer.d.ts.map +1 -0
  85. package/_dist/context-menu-browser.d.ts +4 -0
  86. package/_dist/context-menu-browser.d.ts.map +1 -0
  87. package/_dist/context-menu.d.ts +95 -0
  88. package/_dist/context-menu.d.ts.map +1 -0
  89. package/_dist/drag.d.ts +29 -0
  90. package/_dist/drag.d.ts.map +1 -0
  91. package/_dist/edit-keys.d.ts +42 -0
  92. package/_dist/edit-keys.d.ts.map +1 -0
  93. package/_dist/emit.d.ts +7 -0
  94. package/_dist/emit.d.ts.map +1 -0
  95. package/_dist/entity-popup-browser.d.ts +3 -0
  96. package/_dist/entity-popup-browser.d.ts.map +1 -0
  97. package/_dist/face/FaceTagger.d.ts +25 -0
  98. package/_dist/face/FaceTagger.d.ts.map +1 -0
  99. package/_dist/face/review.d.ts +5 -0
  100. package/_dist/face/review.d.ts.map +1 -0
  101. package/_dist/face/tags.d.ts +99 -0
  102. package/_dist/face/tags.d.ts.map +1 -0
  103. package/_dist/field-values.d.ts +4 -0
  104. package/_dist/field-values.d.ts.map +1 -0
  105. package/_dist/fit-list.d.ts +4 -0
  106. package/_dist/fit-list.d.ts.map +1 -0
  107. package/_dist/hits.d.ts +27 -0
  108. package/_dist/hits.d.ts.map +1 -0
  109. package/_dist/host.d.ts +91 -0
  110. package/_dist/host.d.ts.map +1 -0
  111. package/_dist/image-fallback.d.ts +5 -0
  112. package/_dist/image-fallback.d.ts.map +1 -0
  113. package/_dist/keys.d.ts +95 -0
  114. package/_dist/keys.d.ts.map +1 -0
  115. package/_dist/kit.d.ts +23 -0
  116. package/_dist/kit.d.ts.map +1 -0
  117. package/_dist/lightbox-browser.d.ts +2 -0
  118. package/_dist/lightbox-browser.d.ts.map +1 -0
  119. package/_dist/lightbox.d.ts +42 -0
  120. package/_dist/lightbox.d.ts.map +1 -0
  121. package/_dist/live.d.ts +21 -0
  122. package/_dist/live.d.ts.map +1 -0
  123. package/_dist/mod.d.ts +67 -0
  124. package/_dist/mod.d.ts.map +1 -0
  125. package/_dist/read.d.ts +12 -0
  126. package/_dist/read.d.ts.map +1 -0
  127. package/_dist/resize.d.ts +43 -0
  128. package/_dist/resize.d.ts.map +1 -0
  129. package/_dist/rows.d.ts +31 -0
  130. package/_dist/rows.d.ts.map +1 -0
  131. package/_dist/save-browser.d.ts +29 -0
  132. package/_dist/save-browser.d.ts.map +1 -0
  133. package/_dist/select-browser.d.ts +1 -0
  134. package/_dist/select-browser.d.ts.map +1 -0
  135. package/_dist/select.d.ts +12 -0
  136. package/_dist/select.d.ts.map +1 -0
  137. package/_dist/sending.d.ts +10 -0
  138. package/_dist/sending.d.ts.map +1 -0
  139. package/_dist/sort-browser.d.ts +11 -0
  140. package/_dist/sort-browser.d.ts.map +1 -0
  141. package/_dist/state.d.ts +74 -0
  142. package/_dist/state.d.ts.map +1 -0
  143. package/_dist/suggest.d.ts +18 -0
  144. package/_dist/suggest.d.ts.map +1 -0
  145. package/_dist/swipe.d.ts +60 -0
  146. package/_dist/swipe.d.ts.map +1 -0
  147. package/_dist/ui.d.ts +6 -0
  148. package/_dist/ui.d.ts.map +1 -0
  149. package/_dist/upload-browser.d.ts +13 -0
  150. package/_dist/upload-browser.d.ts.map +1 -0
  151. package/_dist/views.d.ts +8 -0
  152. package/_dist/views.d.ts.map +1 -0
  153. package/_dist/vocab.d.ts +6 -0
  154. package/_dist/vocab.d.ts.map +1 -0
  155. package/anchor.js +58 -0
  156. package/anchor.js.map +1 -0
  157. package/anchor.ts +87 -0
  158. package/anchored.js +180 -0
  159. package/anchored.js.map +1 -0
  160. package/anchored.ts +232 -0
  161. package/completion-state.js +76 -0
  162. package/completion-state.js.map +1 -0
  163. package/completion-state.ts +120 -0
  164. package/completion.js +301 -0
  165. package/completion.js.map +1 -0
  166. package/completion.ts +433 -0
  167. package/composer-browser.js +4 -0
  168. package/composer-browser.js.map +1 -0
  169. package/composer-browser.ts +5 -0
  170. package/composer.js +42 -0
  171. package/composer.js.map +1 -0
  172. package/composer.ts +53 -0
  173. package/context-menu-browser.js +221 -0
  174. package/context-menu-browser.js.map +1 -0
  175. package/context-menu-browser.ts +231 -0
  176. package/context-menu.js +146 -0
  177. package/context-menu.js.map +1 -0
  178. package/context-menu.ts +194 -0
  179. package/deno.json +1 -0
  180. package/drag.js +33 -0
  181. package/drag.js.map +1 -0
  182. package/drag.ts +41 -0
  183. package/edit-keys.js +51 -0
  184. package/edit-keys.js.map +1 -0
  185. package/edit-keys.ts +81 -0
  186. package/emit.js +34 -0
  187. package/emit.js.map +1 -0
  188. package/emit.ts +55 -0
  189. package/entity-popup-browser.js +94 -0
  190. package/entity-popup-browser.js.map +1 -0
  191. package/entity-popup-browser.ts +100 -0
  192. package/face/FaceTagger.js +361 -0
  193. package/face/FaceTagger.js.map +1 -0
  194. package/face/FaceTagger.ts +507 -0
  195. package/face/NameProposal.js +61 -0
  196. package/face/NameProposal.js.map +1 -0
  197. package/face/NameProposal.ts +100 -0
  198. package/face/review.js +33 -0
  199. package/face/review.js.map +1 -0
  200. package/face/review.ts +49 -0
  201. package/face/tags.js +344 -0
  202. package/face/tags.js.map +1 -0
  203. package/face/tags.ts +357 -0
  204. package/field-values.js +20 -0
  205. package/field-values.js.map +1 -0
  206. package/field-values.ts +35 -0
  207. package/fit-list.js +66 -0
  208. package/fit-list.js.map +1 -0
  209. package/fit-list.ts +81 -0
  210. package/hits.js +65 -0
  211. package/hits.js.map +1 -0
  212. package/hits.ts +75 -0
  213. package/host.js +88 -0
  214. package/host.js.map +1 -0
  215. package/host.ts +212 -0
  216. package/image-fallback.js +32 -0
  217. package/image-fallback.js.map +1 -0
  218. package/image-fallback.ts +37 -0
  219. package/keys.js +418 -0
  220. package/keys.js.map +1 -0
  221. package/keys.ts +444 -0
  222. package/kit.js +41 -0
  223. package/kit.js.map +1 -0
  224. package/kit.ts +71 -0
  225. package/lightbox-browser.js +248 -0
  226. package/lightbox-browser.js.map +1 -0
  227. package/lightbox-browser.ts +232 -0
  228. package/lightbox.js +84 -0
  229. package/lightbox.js.map +1 -0
  230. package/lightbox.ts +103 -0
  231. package/live.js +111 -0
  232. package/live.js.map +1 -0
  233. package/live.ts +139 -0
  234. package/mod.js +67 -0
  235. package/mod.js.map +1 -0
  236. package/mod.ts +180 -0
  237. package/package.json +143 -4
  238. package/read.js +33 -0
  239. package/read.js.map +1 -0
  240. package/read.ts +56 -0
  241. package/resize.js +159 -0
  242. package/resize.js.map +1 -0
  243. package/resize.ts +203 -0
  244. package/rows.js +73 -0
  245. package/rows.js.map +1 -0
  246. package/rows.ts +97 -0
  247. package/save-browser.js +469 -0
  248. package/save-browser.js.map +1 -0
  249. package/save-browser.ts +530 -0
  250. package/select-browser.js +4 -0
  251. package/select-browser.js.map +1 -0
  252. package/select-browser.ts +5 -0
  253. package/select.js +296 -0
  254. package/select.js.map +1 -0
  255. package/select.ts +343 -0
  256. package/sending.js +36 -0
  257. package/sending.js.map +1 -0
  258. package/sending.ts +44 -0
  259. package/sort-browser.js +51 -0
  260. package/sort-browser.js.map +1 -0
  261. package/sort-browser.ts +70 -0
  262. package/state.js +99 -0
  263. package/state.js.map +1 -0
  264. package/state.ts +121 -0
  265. package/suggest.js +28 -0
  266. package/suggest.js.map +1 -0
  267. package/suggest.ts +32 -0
  268. package/swipe.js +186 -0
  269. package/swipe.js.map +1 -0
  270. package/swipe.ts +250 -0
  271. package/ui.js +507 -0
  272. package/ui.js.map +1 -0
  273. package/ui.ts +378 -0
  274. package/upload-browser.js +195 -0
  275. package/upload-browser.js.map +1 -0
  276. package/upload-browser.ts +303 -0
  277. package/upload-files.js +41 -0
  278. package/upload-files.js.map +1 -0
  279. package/upload-files.ts +49 -0
  280. package/views.js +8 -0
  281. package/views.js.map +1 -0
  282. package/views.ts +9 -0
  283. package/vocab.js +16 -0
  284. package/vocab.js.map +1 -0
  285. package/vocab.json +287 -0
  286. package/vocab.ts +17 -0
package/live.js ADDED
@@ -0,0 +1,111 @@
1
+ /**
2
+ * An `Edit`'s state, read live from the page's graph and changed there, and
3
+ * the person's draft of its value, read and kept through the host's drafts.
4
+ * One watch per graph; each instance reads its own row of it, so opening
5
+ * one repaints it and whoever reads that one, nothing else. An `Edit` is open
6
+ * while its state says so, or while the value has a draft that says
7
+ * something else, so a draft typed anywhere shows wherever the value does.
8
+ *
9
+ * @module
10
+ */ import { useStore } from "@yaks/ui/store";
11
+ /* @ts-types="npm:@types/react@19.3.0" */ import { useMemo } from "react";
12
+ import { useHost, useOwner } from "./host.js";
13
+ import { at, place, put, source } from "./state.js";
14
+ let held = new WeakMap();
15
+ // The `Edit` rows of one graph, watched once.
16
+ let editsOf = (front)=>{
17
+ let edits = held.get(front);
18
+ if (edits) return edits;
19
+ let seen = front.watch('.Edit');
20
+ edits = {
21
+ read: ()=>seen.value,
22
+ subscribe: (wake)=>seen.subscribe(wake)
23
+ };
24
+ held.set(front, edits);
25
+ return edits;
26
+ };
27
+ // One snapshot for the two inputs that open an editor. Keep its identity
28
+ // while neither input changes, even when a different Edit row wakes the watch.
29
+ let editingAt = (edits, drafts, address, place)=>{
30
+ let text = ()=>drafts.text(place);
31
+ let snapshot;
32
+ let read = ()=>{
33
+ let rows = edits.read();
34
+ let eid = rows.length ? address() : undefined;
35
+ let row = rows.find((b)=>b.entity.eid == eid)?.Edit;
36
+ let next = text();
37
+ if (snapshot && snapshot.row === row && snapshot.text === next) {
38
+ return snapshot;
39
+ }
40
+ return snapshot = {
41
+ row,
42
+ text: next
43
+ };
44
+ };
45
+ let subscribe = (wake)=>{
46
+ let offDraft = drafts.follow?.(()=>{
47
+ text();
48
+ wake();
49
+ });
50
+ let offEdit = edits.subscribe(wake);
51
+ return ()=>{
52
+ offEdit();
53
+ offDraft?.();
54
+ };
55
+ };
56
+ return {
57
+ read,
58
+ subscribe
59
+ };
60
+ };
61
+ /** The `Edit` that changes `comp.prop` of `eid` here: its state the one its
62
+ * caller names (`at`), or the one derived from the owner above (host.ts
63
+ * `Ux`); `value` is what the value holds now, which a draft saying the same
64
+ * does not open. */ export let useEdit = (eid, comp, prop, { at: named, value } = {})=>{
65
+ let { front, drafts } = useHost();
66
+ let owner = useOwner();
67
+ let where = place(eid, comp, prop);
68
+ let { read, subscribe, address, ...acts } = useMemo(()=>{
69
+ // Resolve the edit's id when a row can exist or an action needs it.
70
+ let key = named;
71
+ let address = ()=>key ??= at(owner, eid, comp, prop);
72
+ let set = (patch)=>void front.mutate(put(address(), patch));
73
+ let now = ()=>front.ent(address())?.Edit;
74
+ return {
75
+ ...editingAt(editsOf(front), drafts, address, where),
76
+ address,
77
+ now,
78
+ begin: ()=>set({
79
+ open: true
80
+ }),
81
+ end: ()=>now() && set(null),
82
+ type: (text)=>drafts.type(where, text),
83
+ spend: ()=>drafts.spend(where),
84
+ search: (query)=>set({
85
+ query
86
+ })
87
+ };
88
+ }, [
89
+ front,
90
+ drafts,
91
+ named,
92
+ owner,
93
+ eid,
94
+ comp,
95
+ prop,
96
+ where
97
+ ]);
98
+ let { row, text } = useStore(subscribe, read);
99
+ let open = !!row?.open || !!text && text != source(value);
100
+ return {
101
+ get at () {
102
+ return address();
103
+ },
104
+ row,
105
+ place: where,
106
+ text,
107
+ open,
108
+ ...acts
109
+ };
110
+ };
111
+ //# sourceMappingURL=live.js.map
package/live.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.js","sources":["./live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;CASC,GAED,SAAS,QAAQ,8BAAmC;AACpD,uCAAuC,GAAG,SAAS,OAAO,gBAA0B;AAEpF,SAAsB,OAAO,EAAE,QAAQ,oBAAmB;AAC1D,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAY,MAAM,qBAAoB;AAO7D,IAAI,OAAO,IAAI;AAEf,8CAA8C;AAC9C,IAAI,UAAU,CAAC;EACb,IAAI,QAAQ,KAAK,GAAG,CAAC;EACrB,IAAI,OAAO,OAAO;EAClB,IAAI,OAAO,MAAM,KAAK,CAAC;EACvB,QAAQ;IAAE,MAAM,IAAM,KAAK,KAAK;IAAE,WAAW,CAAC,OAAS,KAAK,SAAS,CAAC;EAAM;EAC5E,KAAK,GAAG,CAAC,OAAO;EAChB,OAAO;AACT;AAEA,yEAAyE;AACzE,+EAA+E;AAC/E,IAAI,YAAY,CACd,OACA,QACA,SACA;EAEA,IAAI,OAAO,IAAM,OAAO,IAAI,CAAC;EAC7B,IAAI;EACJ,IAAI,OAAO;IACT,IAAI,OAAO,MAAM,IAAI;IACrB,IAAI,MAAM,KAAK,MAAM,GAAG,YAAY;IACpC,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,IAAM,EAAE,MAAM,CAAC,GAAG,IAAI,MAAM;IACjD,IAAI,OAAO;IACX,IAAI,YAAY,SAAS,GAAG,KAAK,OAAO,SAAS,IAAI,KAAK,MAAM;MAC9D,OAAO;IACT;IACA,OAAO,WAAW;MAAE;MAAK,MAAM;IAAK;EACtC;EACA,IAAI,YAAY,CAAC;IACf,IAAI,WAAW,OAAO,MAAM,GAAG;MAC7B;MACA;IACF;IACA,IAAI,UAAU,MAAM,SAAS,CAAC;IAC9B,OAAO;MACL;MACA;IACF;EACF;EACA,OAAO;IAAE;IAAM;EAAU;AAC3B;AA8BA;;;kBAGkB,GAClB,OAAO,IAAI,UAAU,CACnB,KACA,MACA,MACA,EAAE,IAAI,KAAK,EAAE,KAAK,EAAoC,GAAG,CAAC,CAAC;EAE3D,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG;EACxB,IAAI,QAAQ;EACZ,IAAI,QAAQ,MAAM,KAAK,MAAM;EAC7B,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,QAAQ;IAClD,oEAAoE;IACpE,IAAI,MAAM;IACV,IAAI,UAAU,IAAM,QAAQ,GAAG,OAAO,KAAK,MAAM;IACjD,IAAI,MAAM,CAAC,QAAsB,KAAK,MAAM,MAAM,CAAC,IAAI,WAAW;IAClE,IAAI,MAAM,IAAM,MAAM,GAAG,CAAC,YAAY;IACtC,OAAO;MACL,GAAG,UAAU,QAAQ,QAAQ,QAAQ,SAAS,MAAM;MACpD;MACA;MACA,OAAO,IAAM,IAAI;UAAE,MAAM;QAAK;MAC9B,KAAK,IAAM,SAAS,IAAI;MACxB,MAAM,CAAC,OAAiB,OAAO,IAAI,CAAC,OAAO;MAC3C,OAAO,IAAM,OAAO,KAAK,CAAC;MAC1B,QAAQ,CAAC,QAAkB,IAAI;UAAE;QAAM;IACzC;EACF,GAAG;IAAC;IAAO;IAAQ;IAAO;IAAO;IAAK;IAAM;IAAM;GAAM;EACxD,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,SAAS,WAAW;EACxC,IAAI,OAAO,CAAC,CAAC,KAAK,QAAS,CAAC,CAAC,QAAQ,QAAQ,OAAO;EACpD,OAAO;IACL,IAAI,MAAK;MACP,OAAO;IACT;IACA;IACA,OAAO;IACP;IACA;IACA,GAAG,IAAI;EACT;AACF,EAAC"}
package/live.ts ADDED
@@ -0,0 +1,139 @@
1
+ /**
2
+ * An `Edit`'s state, read live from the page's graph and changed there, and
3
+ * the person's draft of its value, read and kept through the host's drafts.
4
+ * One watch per graph; each instance reads its own row of it, so opening
5
+ * one repaints it and whoever reads that one, nothing else. An `Edit` is open
6
+ * while its state says so, or while the value has a draft that says
7
+ * something else, so a draft typed anywhere shows wherever the value does.
8
+ *
9
+ * @module
10
+ */
11
+
12
+ import { useStore } from '@yaks/ui/store'
13
+ /* @ts-types="npm:@types/react@19.3.0" */ import { useMemo } from 'react'
14
+ import type { Front } from './host.js'
15
+ import { type Drafts, useHost, useOwner } from './host.js'
16
+ import { at, place, put, type Row, source } from './state.js'
17
+
18
+ type Edits = {
19
+ read: () => ReturnType<Front['watch']>['value']
20
+ subscribe: (wake: () => void) => () => void
21
+ }
22
+
23
+ let held = new WeakMap<Front, Edits>()
24
+
25
+ // The `Edit` rows of one graph, watched once.
26
+ let editsOf = (front: Front): Edits => {
27
+ let edits = held.get(front)
28
+ if (edits) return edits
29
+ let seen = front.watch('.Edit')
30
+ edits = { read: () => seen.value, subscribe: (wake) => seen.subscribe(wake) }
31
+ held.set(front, edits)
32
+ return edits
33
+ }
34
+
35
+ // One snapshot for the two inputs that open an editor. Keep its identity
36
+ // while neither input changes, even when a different Edit row wakes the watch.
37
+ let editingAt = (
38
+ edits: Edits,
39
+ drafts: Drafts,
40
+ address: () => string,
41
+ place: string,
42
+ ) => {
43
+ let text = () => drafts.text(place)
44
+ let snapshot: { row: Row | undefined; text: string } | undefined
45
+ let read = () => {
46
+ let rows = edits.read()
47
+ let eid = rows.length ? address() : undefined
48
+ let row = rows.find((b) => b.entity.eid == eid)?.Edit as Row | undefined
49
+ let next = text()
50
+ if (snapshot && snapshot.row === row && snapshot.text === next) {
51
+ return snapshot
52
+ }
53
+ return snapshot = { row, text: next }
54
+ }
55
+ let subscribe = (wake: () => void) => {
56
+ let offDraft = drafts.follow?.(() => {
57
+ text()
58
+ wake()
59
+ })
60
+ let offEdit = edits.subscribe(wake)
61
+ return () => {
62
+ offEdit()
63
+ offDraft?.()
64
+ }
65
+ }
66
+ return { read, subscribe }
67
+ }
68
+
69
+ /** One `Edit`, as its owner and the component itself hold it: its eid, its
70
+ * row, the draft of its value, and the acts on them. */
71
+ export type Editing = {
72
+ /** its eid in the page's graph */
73
+ at: string
74
+ /** its state, read live */
75
+ row: Row | undefined
76
+ /** the place its value's draft is typed in */
77
+ place: string
78
+ /** what is typed over the value and not yet sent ('' for nothing) */
79
+ text: string
80
+ /** being changed: its state says so, or its value's draft says something */
81
+ open: boolean
82
+ /** its state as the graph holds it now, for a handler that runs between
83
+ * paints */
84
+ now: () => Row | undefined
85
+ /** open it */
86
+ begin: () => void
87
+ /** close it; the draft stays */
88
+ end: () => void
89
+ /** what is typed over the value: the draft */
90
+ type: (text: string) => void
91
+ /** the draft was sent, or put back: empty it */
92
+ spend: () => void
93
+ /** what is typed in its picker's search */
94
+ search: (query: string) => void
95
+ }
96
+
97
+ /** The `Edit` that changes `comp.prop` of `eid` here: its state the one its
98
+ * caller names (`at`), or the one derived from the owner above (host.ts
99
+ * `Ux`); `value` is what the value holds now, which a draft saying the same
100
+ * does not open. */
101
+ export let useEdit = (
102
+ eid: string,
103
+ comp: string,
104
+ prop: string,
105
+ { at: named, value }: { at?: string; value?: unknown } = {},
106
+ ): Editing => {
107
+ let { front, drafts } = useHost()
108
+ let owner = useOwner()
109
+ let where = place(eid, comp, prop)
110
+ let { read, subscribe, address, ...acts } = useMemo(() => {
111
+ // Resolve the edit's id when a row can exist or an action needs it.
112
+ let key = named
113
+ let address = () => key ??= at(owner, eid, comp, prop)
114
+ let set = (patch: Row | null) => void front.mutate(put(address(), patch))
115
+ let now = () => front.ent(address())?.Edit as Row | undefined
116
+ return {
117
+ ...editingAt(editsOf(front), drafts, address, where),
118
+ address,
119
+ now,
120
+ begin: () => set({ open: true }),
121
+ end: () => now() && set(null),
122
+ type: (text: string) => drafts.type(where, text),
123
+ spend: () => drafts.spend(where),
124
+ search: (query: string) => set({ query }),
125
+ }
126
+ }, [front, drafts, named, owner, eid, comp, prop, where])
127
+ let { row, text } = useStore(subscribe, read)
128
+ let open = !!row?.open || (!!text && text != source(value))
129
+ return {
130
+ get at() {
131
+ return address()
132
+ },
133
+ row,
134
+ place: where,
135
+ text,
136
+ open,
137
+ ...acts,
138
+ }
139
+ }
package/mod.js ADDED
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @yaks/ux: UX components, between UI components (@yaks/ui: a look, no
3
+ * behavior) and domain components (meaning: queries, server data). A UX
4
+ * component prescribes behavior and holds no state of its own in memory: it
5
+ * is controlled by a bundle and emits a bundle of the same shape, the way
6
+ * `<input value onChange>` does, and an event bundle only when it has
7
+ * something to say that is not a new value. Its own state is one component
8
+ * named after it, in CamelCase, on an entity of its own in the page's graph
9
+ * (./vocab.json), so its owner can read it and a remount finds it again.
10
+ *
11
+ * - `Edit`, `Edit.Text`, `Edit.Control`: a property's value changed where it
12
+ * stands, typed over in place, or its control alone (./Edit.ts, ./Text.ts).
13
+ * - `Disclosure`: the kit's fold, its summary opening what it holds, and
14
+ * `DisclosureMark`, a second way to open it; `Loading`, what a lazy one
15
+ * holds until opened; `disclosureAt`, `isOpen`,
16
+ * `disclosed`, its page eid and bundles, pure (./Disclosure.ts).
17
+ * - `Answer`: a query's rows, or that it is loading, empty or could not
18
+ * load, from its `Answered` state (`useAnswered`); `Refused`, a read of
19
+ * one entity that could not load (./Answer.ts).
20
+ * - `Fields`: controlled inputs and repeat groups (./Fields.ts).
21
+ * - `Submit`: loading, durable drafts and submission lifecycle (./Submit.ts).
22
+ * - `Ux`, `useHost`, `Host`: what a page hands down, once per tree
23
+ * (./host.ts).
24
+ * - `drag`, `drags`, `dragged`: an entity dragged from one place to
25
+ * another, whoever drew either (./drag.ts).
26
+ * - `Order`: a list put in order by dragging its rows, taking a dragged
27
+ * entity between two of them; `orderAt`, `landing`, `landed`, `among`,
28
+ * `placing`, its page eid, bundles and arithmetic, pure (./Order.ts).
29
+ * - `useEdit`, `Editing`: an `Edit`'s state, read and changed by whoever
30
+ * owns it (./live.ts).
31
+ * - `at`, `place`, `put`, `changed`, `refused`, `valueOf`: the bundles and
32
+ * names, pure (./state.ts).
33
+ * - `editorViews`, `views`: the editors as registrations (the `/views`
34
+ * facet); `TimeVal`, `UrlVal`: faces.
35
+ * - `pickLine`, `useHits`, `label`: a picker's candidates, asked of the
36
+ * graph.
37
+ * - `canEdit`, `formatProp`, `reading`: what a value is, pure.
38
+ *
39
+ * What binds the DOM is a `-browser` module, at a subpath of its own
40
+ * (`./save`, `./sort`) and never here: a server imports this front door, and
41
+ * the Workers program checks what it reaches with the runtime's globals,
42
+ * which have no DOM.
43
+ *
44
+ * @module
45
+ */ export { heldDrafts, useDraft, useDrafts, useFollowed, useHost, useOwner, Ux } from "./host.js";
46
+ export { Edit, editorViews, TimeVal, UrlVal, views } from "./Edit.js";
47
+ export { Text } from "./Text.js";
48
+ export { Save } from "./Save.js";
49
+ export { disclosed, Disclosure, disclosureAt, DisclosureMark, isOpen, Loading } from "./Disclosure.js";
50
+ export { Conversation, conversationAt, conversed, conversingOf, Fold, Folds, NEAR, shown, stopped, TAKE, useFold } from "./Conversation.js";
51
+ export { useAnswered, useObserved, useRows, useStoreEdit, useWatch } from "./rows.js";
52
+ export { Answer, Refused } from "./Answer.js";
53
+ export { Fields } from "./Fields.js";
54
+ export { Submit, submitAt, submitOf } from "./Submit.js";
55
+ export { put as putValue } from "./field-values.js";
56
+ export { drag, DRAGGED, dragged, drags } from "./drag.js";
57
+ export { among, landed, landing, Order, orderAt, placing } from "./Order.js";
58
+ export { useEdit } from "./live.js";
59
+ export { at, changed, place, put, refused, source, valueOf } from "./state.js";
60
+ export { emit, reading } from "./emit.js";
61
+ export { canEdit, formatProp, isBody, wellOf } from "./read.js";
62
+ export { pickLine, useHits } from "./hits.js";
63
+ export { label } from "./suggest.js";
64
+ export { defineKit, kitDocs } from "./kit.js";
65
+ export { completion } from "./completion.js";
66
+ export { Sort, sortAt, sorted, sortOf, sortRows } from "./Sort.js";
67
+ //# sourceMappingURL=mod.js.map
package/mod.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CC,GAED,SAKE,UAAU,EAEV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,QAAQ,EACR,EAAE,oBACc;AAClB,SAGE,IAAI,EAEJ,WAAW,EAEX,OAAO,EACP,MAAM,EACN,KAAK,oBACW;AAClB,SAAS,IAAI,oBAAmC;AAChD,SAAS,IAAI,oBAAwD;AACrE,SAEE,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,EAEd,MAAM,EACN,OAAO,0BACe;AACxB,SAEE,YAAY,EACZ,cAAc,EAEd,SAAS,EAET,YAAY,EACZ,IAAI,EACJ,KAAK,EAEL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,IAAI,EACJ,OAAO,4BACiB;AAC1B,SACE,WAAW,EACX,WAAW,EACX,OAAO,EACP,YAAY,EACZ,QAAQ,oBACQ;AAClB,SACE,MAAM,EAGN,OAAO,sBAEW;AACpB,SAAS,MAAM,sBAAuD;AACtE,SAIE,MAAM,EACN,QAAQ,EACR,QAAQ,sBAKU;AACpB,SAAoB,OAAO,QAAQ,4BAAwC;AAE3E,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,oBAAmB;AACzD,SACE,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EAEP,OAAO,qBACU;AACnB,SAAuB,OAAO,oBAAmB;AACjD,SACE,EAAE,EACF,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,EAEP,MAAM,EACN,OAAO,qBACU;AACnB,SAAS,IAAI,EAAiB,OAAO,oBAAmB;AACxD,SAAS,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAmB;AAC/D,SAAoB,QAAQ,EAAE,OAAO,oBAAmB;AACxD,SAAS,KAAK,uBAAsB;AAEpC,SACE,SAAS,EAET,OAAO,mBAGQ;AAEjB,SACE,UAAU,0BAGY;AAExB,SACE,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EAGN,QAAQ,oBAGQ"}
package/mod.ts ADDED
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @yaks/ux: UX components, between UI components (@yaks/ui: a look, no
3
+ * behavior) and domain components (meaning: queries, server data). A UX
4
+ * component prescribes behavior and holds no state of its own in memory: it
5
+ * is controlled by a bundle and emits a bundle of the same shape, the way
6
+ * `<input value onChange>` does, and an event bundle only when it has
7
+ * something to say that is not a new value. Its own state is one component
8
+ * named after it, in CamelCase, on an entity of its own in the page's graph
9
+ * (./vocab.json), so its owner can read it and a remount finds it again.
10
+ *
11
+ * - `Edit`, `Edit.Text`, `Edit.Control`: a property's value changed where it
12
+ * stands, typed over in place, or its control alone (./Edit.ts, ./Text.ts).
13
+ * - `Disclosure`: the kit's fold, its summary opening what it holds, and
14
+ * `DisclosureMark`, a second way to open it; `Loading`, what a lazy one
15
+ * holds until opened; `disclosureAt`, `isOpen`,
16
+ * `disclosed`, its page eid and bundles, pure (./Disclosure.ts).
17
+ * - `Answer`: a query's rows, or that it is loading, empty or could not
18
+ * load, from its `Answered` state (`useAnswered`); `Refused`, a read of
19
+ * one entity that could not load (./Answer.ts).
20
+ * - `Fields`: controlled inputs and repeat groups (./Fields.ts).
21
+ * - `Submit`: loading, durable drafts and submission lifecycle (./Submit.ts).
22
+ * - `Ux`, `useHost`, `Host`: what a page hands down, once per tree
23
+ * (./host.ts).
24
+ * - `drag`, `drags`, `dragged`: an entity dragged from one place to
25
+ * another, whoever drew either (./drag.ts).
26
+ * - `Order`: a list put in order by dragging its rows, taking a dragged
27
+ * entity between two of them; `orderAt`, `landing`, `landed`, `among`,
28
+ * `placing`, its page eid, bundles and arithmetic, pure (./Order.ts).
29
+ * - `useEdit`, `Editing`: an `Edit`'s state, read and changed by whoever
30
+ * owns it (./live.ts).
31
+ * - `at`, `place`, `put`, `changed`, `refused`, `valueOf`: the bundles and
32
+ * names, pure (./state.ts).
33
+ * - `editorViews`, `views`: the editors as registrations (the `/views`
34
+ * facet); `TimeVal`, `UrlVal`: faces.
35
+ * - `pickLine`, `useHits`, `label`: a picker's candidates, asked of the
36
+ * graph.
37
+ * - `canEdit`, `formatProp`, `reading`: what a value is, pure.
38
+ *
39
+ * What binds the DOM is a `-browser` module, at a subpath of its own
40
+ * (`./save`, `./sort`) and never here: a server imports this front door, and
41
+ * the Workers program checks what it reaches with the runtime's globals,
42
+ * which have no DOM.
43
+ *
44
+ * @module
45
+ */
46
+
47
+ export {
48
+ type Bundle,
49
+ type Drafts,
50
+ type Float,
51
+ type Front,
52
+ heldDrafts,
53
+ type Host,
54
+ useDraft,
55
+ useDrafts,
56
+ useFollowed,
57
+ useHost,
58
+ useOwner,
59
+ Ux,
60
+ } from './host.js'
61
+ export {
62
+ type ControlOwnProps,
63
+ type ControlProps,
64
+ Edit,
65
+ type Editor,
66
+ editorViews,
67
+ type EditProps,
68
+ TimeVal,
69
+ UrlVal,
70
+ views,
71
+ } from './Edit.js'
72
+ export { Text, type TextProps } from './Text.js'
73
+ export { Save, type SaveFieldProps, type SaveProps } from './Save.js'
74
+ export {
75
+ type Disclosed,
76
+ disclosed,
77
+ Disclosure,
78
+ disclosureAt,
79
+ DisclosureMark,
80
+ type DisclosureProps,
81
+ isOpen,
82
+ Loading,
83
+ } from './Disclosure.js'
84
+ export {
85
+ type BoxProps,
86
+ Conversation,
87
+ conversationAt,
88
+ type ConversationProps,
89
+ conversed,
90
+ type Conversing,
91
+ conversingOf,
92
+ Fold,
93
+ Folds,
94
+ type Line,
95
+ NEAR,
96
+ shown,
97
+ stopped,
98
+ TAKE,
99
+ useFold,
100
+ } from './Conversation.js'
101
+ export {
102
+ useAnswered,
103
+ useObserved,
104
+ useRows,
105
+ useStoreEdit,
106
+ useWatch,
107
+ } from './rows.js'
108
+ export {
109
+ Answer,
110
+ type Answered,
111
+ type AnswerProps,
112
+ Refused,
113
+ type RefusedProps,
114
+ } from './Answer.js'
115
+ export { Fields, type FieldSpec, type FieldsProps } from './Fields.js'
116
+ export {
117
+ type Feedback,
118
+ type Read,
119
+ type Send,
120
+ Submit,
121
+ submitAt,
122
+ submitOf,
123
+ type SubmitProps,
124
+ type SubmitState,
125
+ type SubmitView,
126
+ type Upload,
127
+ } from './Submit.js'
128
+ export { type Path, put as putValue, type Values } from './field-values.js'
129
+
130
+ export { drag, DRAGGED, dragged, drags } from './drag.js'
131
+ export {
132
+ among,
133
+ landed,
134
+ landing,
135
+ Order,
136
+ orderAt,
137
+ type OrderProps,
138
+ placing,
139
+ } from './Order.js'
140
+ export { type Editing, useEdit } from './live.js'
141
+ export {
142
+ at,
143
+ changed,
144
+ place,
145
+ put,
146
+ refused,
147
+ type Row,
148
+ source,
149
+ valueOf,
150
+ } from './state.js'
151
+ export { emit, type OnChange, reading } from './emit.js'
152
+ export { canEdit, formatProp, isBody, wellOf } from './read.js'
153
+ export { type Find, pickLine, useHits } from './hits.js'
154
+ export { label } from './suggest.js'
155
+
156
+ export {
157
+ defineKit,
158
+ type Kit,
159
+ kitDocs,
160
+ type Piece,
161
+ type Specimen,
162
+ } from './kit.js'
163
+
164
+ export {
165
+ completion,
166
+ type Controller as CompletionController,
167
+ type FieldProps,
168
+ } from './completion.js'
169
+
170
+ export {
171
+ Sort,
172
+ sortAt,
173
+ sorted,
174
+ sortOf,
175
+ type SortProps,
176
+ type SortRow,
177
+ sortRows,
178
+ type SortState,
179
+ type SortValue,
180
+ } from './Sort.js'
package/package.json CHANGED
@@ -1,6 +1,145 @@
1
1
  {
2
2
  "name": "@yaks/ux",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.36",
4
+ "homepage": "https://jsr.io/@yaks/ux",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./_dist/mod.d.ts",
9
+ "default": "./mod.js"
10
+ },
11
+ "./views": {
12
+ "types": "./_dist/views.d.ts",
13
+ "default": "./views.js"
14
+ },
15
+ "./vocab": {
16
+ "types": "./_dist/vocab.d.ts",
17
+ "default": "./vocab.js"
18
+ },
19
+ "./ui": {
20
+ "types": "./_dist/ui.d.ts",
21
+ "default": "./ui.js"
22
+ },
23
+ "./conversation": {
24
+ "types": "./_dist/Conversation.d.ts",
25
+ "default": "./Conversation.js"
26
+ },
27
+ "./anchor": {
28
+ "types": "./_dist/anchor.d.ts",
29
+ "default": "./anchor.js"
30
+ },
31
+ "./anchored": {
32
+ "types": "./_dist/anchored.d.ts",
33
+ "default": "./anchored.js"
34
+ },
35
+ "./completion": {
36
+ "types": "./_dist/completion.d.ts",
37
+ "default": "./completion.js"
38
+ },
39
+ "./entity-popup": {
40
+ "types": "./_dist/EntityPopup.d.ts",
41
+ "default": "./EntityPopup.js"
42
+ },
43
+ "./entity-popup-browser": {
44
+ "types": "./_dist/entity-popup-browser.d.ts",
45
+ "default": "./entity-popup-browser.js"
46
+ },
47
+ "./lightbox": {
48
+ "types": "./_dist/lightbox.d.ts",
49
+ "default": "./lightbox.js"
50
+ },
51
+ "./lightbox-browser": {
52
+ "types": "./_dist/lightbox-browser.d.ts",
53
+ "default": "./lightbox-browser.js"
54
+ },
55
+ "./keys": {
56
+ "types": "./_dist/keys.d.ts",
57
+ "default": "./keys.js"
58
+ },
59
+ "./edit-keys": {
60
+ "types": "./_dist/edit-keys.d.ts",
61
+ "default": "./edit-keys.js"
62
+ },
63
+ "./save": {
64
+ "types": "./_dist/save-browser.d.ts",
65
+ "default": "./save-browser.js"
66
+ },
67
+ "./sort": {
68
+ "types": "./_dist/sort-browser.d.ts",
69
+ "default": "./sort-browser.js"
70
+ },
71
+ "./sending": {
72
+ "types": "./_dist/sending.d.ts",
73
+ "default": "./sending.js"
74
+ },
75
+ "./composer": {
76
+ "types": "./_dist/composer.d.ts",
77
+ "default": "./composer.js"
78
+ },
79
+ "./composer-browser": {
80
+ "types": "./_dist/composer-browser.d.ts",
81
+ "default": "./composer-browser.js"
82
+ },
83
+ "./select": {
84
+ "types": "./_dist/select.d.ts",
85
+ "default": "./select.js"
86
+ },
87
+ "./select-browser": {
88
+ "types": "./_dist/select-browser.d.ts",
89
+ "default": "./select-browser.js"
90
+ },
91
+ "./context-menu": {
92
+ "types": "./_dist/context-menu.d.ts",
93
+ "default": "./context-menu.js"
94
+ },
95
+ "./context-menu-browser": {
96
+ "types": "./_dist/context-menu-browser.d.ts",
97
+ "default": "./context-menu-browser.js"
98
+ },
99
+ "./fit-list": {
100
+ "types": "./_dist/fit-list.d.ts",
101
+ "default": "./fit-list.js"
102
+ },
103
+ "./swipe": {
104
+ "types": "./_dist/swipe.d.ts",
105
+ "default": "./swipe.js"
106
+ },
107
+ "./resize": {
108
+ "types": "./_dist/resize.d.ts",
109
+ "default": "./resize.js"
110
+ },
111
+ "./image-fallback": {
112
+ "types": "./_dist/image-fallback.d.ts",
113
+ "default": "./image-fallback.js"
114
+ },
115
+ "./upload": {
116
+ "types": "./_dist/upload-browser.d.ts",
117
+ "default": "./upload-browser.js"
118
+ },
119
+ "./token-picker": {
120
+ "types": "./_dist/TokenPicker.d.ts",
121
+ "default": "./TokenPicker.js"
122
+ },
123
+ "./face-tagger": {
124
+ "types": "./_dist/face/FaceTagger.d.ts",
125
+ "default": "./face/FaceTagger.js"
126
+ }
127
+ },
128
+ "license": "Apache-2.0",
129
+ "dependencies": {
130
+ "@yaks/client": "0.2.36",
131
+ "@yaks/fp": "0.2.36",
132
+ "@yaks/graph": "0.2.36",
133
+ "@yaks/id": "0.2.36",
134
+ "@yaks/query": "0.2.36",
135
+ "@yaks/react": "0.2.36",
136
+ "@yaks/render": "0.2.36",
137
+ "@yaks/ui": "0.2.36",
138
+ "@yaks/vocab": "0.2.36",
139
+ "@types/react": "19.3.0",
140
+ "lucide": "1.31.0",
141
+ "react": "19.3.0"
142
+ },
143
+ "description": "Controlled components for editing, navigation, fields and submissions. Page state lives in graph bundles; durable drafts belong to the host.",
144
+ "repository": "https://github.com/yak-sh/yak.git"
145
+ }
package/read.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * What an `Edit` reads off the vocabulary: pure functions. Whether a property
3
+ * may be written, whether it is a body, the well its suggestions come from, a
4
+ * value as its face says it.
5
+ *
6
+ * @module
7
+ */ import { short } from "@yaks/id";
8
+ /** Whether a client may write this property: its component is on the wire and
9
+ * the property is neither stamped nor computed. */ export let canEdit = (vocab, comp, prop)=>{
10
+ let info = vocab.comp(comp);
11
+ return !!info?.wire && info.writable.includes(prop);
12
+ };
13
+ // A property's declaration as written, for the keywords only some packages
14
+ // read (@yaks/blob's `store`, a `well`).
15
+ let raw = (vocab, comp, prop)=>vocab.def(comp)?.properties?.[prop] ?? {};
16
+ /** Whether a property is a body: long text kept apart (`store: 'blob'`),
17
+ * typed over on many lines. */ export let isBody = (vocab, comp, prop)=>raw(vocab, comp, prop).store == 'blob';
18
+ /** The well a property's suggestions come from, or '' for none. */ export let wellOf = (vocab, comp, prop)=>raw(vocab, comp, prop).well ?? '';
19
+ /**
20
+ * A value as its face says it, or null for nothing to show: a priority with
21
+ * its P, a flag as true or false, a reference as what it is called, a JSON
22
+ * value as its text.
23
+ */ export let formatProp = (vocab, comp, prop, value, name = ()=>undefined)=>{
24
+ if (value == null || value === '') return null;
25
+ let p = vocab.prop(comp, prop);
26
+ let type = p?.category == 'scalar' ? p.scalar : p?.category;
27
+ if (type == 'priority') return `P${Number(value)}`;
28
+ if (type == 'bool') return value ? 'true' : 'false';
29
+ if (type == 'ref') return name(String(value)) ?? short(String(value));
30
+ if (typeof value == 'object') return JSON.stringify(value);
31
+ return String(value);
32
+ };
33
+ //# sourceMappingURL=read.js.map