@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
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from "@types/react";
2
+ /** The moment an item entered a conversation. */ export type Timed = {
3
+ at?: string;
4
+ };
5
+ export type DatedRow<L extends Timed> = (line: L, divider?: ReactNode) => ReactNode;
6
+ /** Draw a divider at the start of each run with the same displayed age. */ export declare let datedRows: <L extends Timed>(lines: L[], row: DatedRow<L>, now: number, after?: string) => ReactNode[];
7
+ /** A nested transcript uses the same clock and dividers as the conversation. */ export declare let DatedRows: <L extends Timed>({}: {
8
+ lines: L[];
9
+ row: DatedRow<L>;
10
+ after?: string;
11
+ }) => ReactNode[];
12
+ /** Adjacent activity can share one fold, with other lines as boundaries. */ export declare let activityRuns: <L>(lines: L[], activity: (line: L) => boolean) => L[][];
13
+ //# sourceMappingURL=ConversationLines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationLines.d.ts","sources":["../ConversationLines.ts"],"names":[],"mappings":"AAA0C,SAA6B,KAAK,SAAS,uBAA0B;AAK/G,+CAA+C,GAC/C,YAAY;EAAU,KAAK,MAAM;;AACjC,YAAY,SAAS,UAAU,UAC7B,MAAM,GACN,UAAU,cACP;AAEL,yEAAyE,GACzE,OAAO,YAAI,YAAa,UAAU,OAChC,OAAO,KACP,KAAK,SAAS,IACd,KAAK,MAAM,EACX,QAAQ,MAAM,KACb,YAUF;AAED,8EAA8E,GAC9E,OAAO,YAAI,YAAa,UAAU,OAChC;EAAyB,OAAO;EAAK,KAAK,SAAS;EAAI,QAAQ,MAAM;CAAE,KACtE,YAAqD;AAExD,0EAA0E,GAC1E,OAAO,YAAI,eAAgB,GACzB,OAAO,KACP,WAAW,MAAM,MAAM,OAAO,KAC7B,MAQF"}
@@ -0,0 +1,36 @@
1
+ /** A controlled disclosure is the kit's fold, `More`: a `details` whose
2
+ * summary opens what it holds. The consumer names its page entity and keeps
3
+ * emitted Disclosure{open} bundles, so the same state is found across
4
+ * remounts, and `DisclosureMark` is a second way to open it.
5
+ * @module
6
+ */ import { type JSX, type ReactNode } from "@types/react";
7
+ import type { Bundle } from "@yaks/graph";
8
+ /** The page entity carrying this owner's disclosure state. */ export declare let disclosureAt: (owner: string) => string;
9
+ /** Missing disclosure state is closed. */ export declare let isOpen: (e?: Bundle) => boolean;
10
+ /** The bundle emitted when this disclosure is opened or closed. */ export declare let disclosed: (e: Bundle, open: boolean) => Bundle;
11
+ /** Where a disclosure's state is, and where what it emits goes. Without a
12
+ * page entity (`e`) it is a plain `details`, which its host opens itself. */ export type Disclosed = {
13
+ e?: Bundle;
14
+ onChange?: (b: Bundle) => void;
15
+ };
16
+ /** State and presentation supplied by the disclosure's consumer. */ export type DisclosureProps = Disclosed & {
17
+ summary: ReactNode;
18
+ /** its summary's own attributes: a `class`, a `data-` name to find it by */ summaryProps?: Record<string, unknown>;
19
+ /** the fold's look: `quiet` for a step, `on` running, `no` failed */ mod?: string | (string | false | null | undefined)[];
20
+ className?: string;
21
+ class?: string;
22
+ /** what it holds is drawn only while open, for content that asks for
23
+ * rows; closed, it holds only `Loading…`, which a page that holds the
24
+ * server's drawing shows as it opens until what it fetches replaces it */ lazy?: boolean;
25
+ children?: ReactNode;
26
+ };
27
+ /** The mark on what a lazy disclosure holds until it is opened and drawn. */ export declare let UNFETCHED: string;
28
+ /** What a lazy disclosure holds until it is opened and drawn. */ export declare let Loading: () => JSX.Element;
29
+ /** Open as its state says; what it holds is drawn whether open or not, so a
30
+ * page drawn on a server opens it with no script, unless it is `lazy`. */ export declare let Disclosure: ({}: DisclosureProps) => JSX.Element;
31
+ /** A second way to open a disclosure, drawn outside it: a button over the
32
+ * same state, its own words in `children`. */ export declare let DisclosureMark: ({}: Disclosed & {
33
+ children?: ReactNode;
34
+ [attribute: string]: unknown;
35
+ }) => JSX.Element;
36
+ //# sourceMappingURL=Disclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Disclosure.d.ts","sources":["../Disclosure.ts"],"names":[],"mappings":"AAAA;;;;;CAKC,GAEyC,SAA6B,KAAK,GAAG,EAAE,KAAK,SAAS,uBAA0B;AACzH,cAAc,MAAM,2BAAgC;AAIpD,4DAA4D,GAC5D,OAAO,YAAI,eAAgB,OAAO,MAAM,KAAG,MAAM,CACJ;AAE7C,wCAAwC,GACxC,OAAO,YAAI,SAAU,IAAI,WAAS,OAAO,CACyB;AAElE,iEAAiE,GACjE,OAAO,YAAI,YAAa,GAAG,QAAQ,MAAM,OAAO,KAAG,OAGjD;AAEF;2EAC2E,GAC3E,YAAY;EACV,IAAI;EACJ,YAAY,GAAG,WAAW,IAAI;;AAGhC,kEAAkE,GAClE,YAAY,kBAAkB;EAC5B,SAAS;EACT,0EAA0E,GAC1E,eAAe,OAAO,MAAM,EAAE,OAAO;EACrC,mEAAmE,GACnE,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS;EACjD,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd;;0EAEwE,GACxE,OAAO,OAAO;EACd,WAAW;;AAgBb,2EAA2E,GAC3E,OAAO,YAAI,kBAA4B;AAEvC,+DAA+D,GAC/D,OAAO,YAAI,eAAc,IAAI,QAK1B;AAEH;wEACwE,GACxE,OAAO,YAAI,aACT,IAUG,eAAe,KACjB,IAAI,QAwBN;AAED;4CAC4C,GAC5C,OAAO,YAAI,iBACT,IAAqC;EACnC,WAAW;GACV,WAAW,MAAM,GAAG,OAAO;CAC7B,KACA,IAAI,QASO"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * `Edit`: a property's value, changed where it stands. It is controlled by a
3
+ * bundle and emits a bundle of the same shape, the way `<input value
4
+ * onChange>` does: handed `{entity: {eid}, doc: {title: 'Draft'}}`, it emits
5
+ * `{entity: {eid}, doc: {title: 'Ship it'}}`. Presses and typing are how it
6
+ * gets there, never its interface. Its own state is the `Edit` component in
7
+ * the page's graph (./live.ts), so whoever owns it can read it and open it.
8
+ *
9
+ * Its face and its control are selected by the property's type through a
10
+ * registry (`views`): a type's face at rest (a reference as what it is
11
+ * called, a time in words), and pressed, a control that is either typed over
12
+ * in place (`Edit.Text`) or floats beside the face (a closed set's choices, a
13
+ * reference's search of the graph). `Edit.Control` is the control alone,
14
+ * anchored where its caller says.
15
+ *
16
+ * @module
17
+ */ import { type JSX, type ReactNode } from "@types/react";
18
+ import { type Registry } from "@yaks/render";
19
+ import type { ComponentRenderer } from "@yaks/react";
20
+ import { type Bundle } from "./host.js";
21
+ import { type OnChange } from "./emit.js";
22
+ import { type Editing } from "./live.js";
23
+ import { Text } from "./Text.js";
24
+ /** What a control is drawn with: the value it changes, where it emits, its
25
+ * state, the element it anchors on, and the face it may keep painting
26
+ * (popout) or take the place of (inline). */ export type ControlProps = {
27
+ e: Bundle;
28
+ comp: string;
29
+ prop: string;
30
+ onChange?: OnChange;
31
+ edit: Editing;
32
+ anchor: {
33
+ current: HTMLElement | null;
34
+ };
35
+ face?: ReactNode;
36
+ side?: 'above' | 'below';
37
+ };
38
+ /** One editor registration: a control, and the face it gives a value at
39
+ * rest, from its text as `formatProp` says it. */ export type Editor = ComponentRenderer<Bundle> & {
40
+ show?: (face: string | null) => JSX.Element | null;
41
+ };
42
+ /** A timestamp's face: the host's words for it, the full stamp on hover. */ export declare let TimeVal: ({}: {
43
+ v: string;
44
+ }) => JSX.Element;
45
+ /** A url's face: a link out. Following it is the face's own click. */ export declare let UrlVal: (v: unknown) => JSX.Element | null;
46
+ /** The editors, as registrations: `Edit`, a property's control by its type
47
+ * (`.prop.type=enum`), drawn with its `ControlProps`. */ export declare let editorViews: () => Editor[];
48
+ /** The editors as a registry: the `./views` facet. */ export declare let views: Registry<Editor>;
49
+ /** What an `Edit.Control` is drawn with. */ export type ControlOwnProps = {
50
+ e: Bundle;
51
+ comp: string;
52
+ prop: string;
53
+ onChange?: OnChange;
54
+ at?: string;
55
+ anchor: {
56
+ current: HTMLElement | null;
57
+ };
58
+ side?: 'above' | 'below';
59
+ };
60
+ /** A property's control alone, anchored where its caller says, drawn while
61
+ * its `Edit` state is open. The status pip opens one: a derived enum its
62
+ * caller turns into marks, with the same picker as every other enum. */ declare let Control: (p: ControlOwnProps) => ReactNode;
63
+ /** What an `Edit` is drawn with. */ export type EditProps = {
64
+ /** what controls it: the value is `e[comp][prop]` */ e: Bundle;
65
+ comp: string;
66
+ prop: string;
67
+ /** where what it emits goes (default: the host's `write`) */ onChange?: OnChange;
68
+ /** its state's eid, when its caller names it (default: derived from the
69
+ * owner above and the value, host.ts `Ux`) */ at?: string;
70
+ /** a press opens its control, where a client may write the value */ editable?: boolean;
71
+ /** the ghost label when empty */ name?: string;
72
+ /** paint a custom face (a badge, a chip, a link) from the formatted text
73
+ * and the value; the registry still selects the control */ show?: (face: string | null, value: unknown) => JSX.Element | null;
74
+ /** a face that is a link gets a separate handle to press, so following
75
+ * the link stays the link's */ handle?: boolean;
76
+ };
77
+ /**
78
+ * `<Edit e comp prop editable/>`: the registry supplies the type's face and,
79
+ * editable, the control a press opens; the control's wrapper owns the layout,
80
+ * `Edit` only hands it the anchor and the face. A flag is its own toggle.
81
+ */ declare let EditValue: ({}: EditProps) => JSX.Element;
82
+ /** A value changed where it stands (`Edit`), typed over in place
83
+ * (`Edit.Text`), or its control alone (`Edit.Control`). */ export declare let Edit: typeof EditValue & {
84
+ Text: typeof Text;
85
+ Control: typeof Control;
86
+ };
87
+ //# sourceMappingURL=Edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Edit.d.ts","sources":["../Edit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GAEyC,SAGxC,KAAK,GAAG,EACR,KAAK,SAAS,uBAGS;AACzB,SAAiB,KAAK,QAAQ,4BAA0C;AACxE,cAAc,iBAAiB,2BAAgC;AAG/D,SAAS,KAAK,MAAM,oBAAuC;AAC3D,SAAe,KAAK,QAAQ,oBAAmB;AAC/C,SAAS,KAAK,OAAO,oBAA4B;AAEjD,SAAS,IAAI,oBAAmB;AAahC;;2CAE2C,GAC3C,YAAY;EACV,GAAG;EACH,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,WAAW;EACX,MAAM;EACN;IAAU,SAAS,cAAc,IAAI;;EACrC,OAAO;EACP,OAAO,UAAU;;AAInB;gDACgD,GAChD,YAAY,SAAS,kBAAkB;EACrC,QAAQ,MAAM,MAAM,GAAG,IAAI,KAAK,IAAI,UAAU,IAAI;;AA0NpD,0EAA0E,GAC1E,OAAO,YAAI,UAAW;EAAS,GAAG,MAAM;CAAE,KAAG,IAAI,QAA6B;AAE9E,oEAAoE,GACpE,OAAO,YAAI,SAAU,GAAG,OAAO,KAAG,IAAI,UAAU,IAAI,CAG1C;AAkBV;uDACuD,GACvD,OAAO,YAAI,mBAAkB,SA0B5B;AAED,oDAAoD,GACpD,OAAO,YAAI,OAAO,SAAS,QAA+B;AAU1D,0CAA0C,GAC1C,YAAY;EACV,GAAG;EACH,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,WAAW;EACX,KAAK,MAAM;EACX;IAAU,SAAS,cAAc,IAAI;;EACrC,OAAO,UAAU;;AAGnB;;sEAEsE,GACtE,YAAI,UAAW,GAAG,oBAAkB;AAcpC,kCAAkC,GAClC,YAAY;EACV,mDAAmD,GACnD,GAAG;EACH,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,2DAA2D,GAC3D,WAAW;EACX;8CAC4C,GAC5C,KAAK,MAAM;EACX,kEAAkE,GAClE,WAAW,OAAO;EAClB,+BAA+B,GAC/B,OAAO,MAAM;EACb;2DACyD,GACzD,QAAQ,MAAM,MAAM,GAAG,IAAI,EAAE,OAAO,OAAO,KAAK,IAAI,UAAU,IAAI;EAClE;+BAC6B,GAC7B,SAAS,OAAO;;AAGlB;;;;CAIC,GACD,YAAI,YACF,IACE,SAAS,KACV,IAAI;AA0EP;yDACyD,GACzD,OAAO,YAAI,aAAa;EACtB,aAAa;EACb,gBAAgB;EAC6B"}
@@ -0,0 +1,12 @@
1
+ import { type ReactElement, type ReactNode } from "@types/react";
2
+ /** A link that opens an entity over the current page when enhanced. */ export declare let entityLink: (href: string) => {
3
+ href: string;
4
+ 'data-entity-popup': string;
5
+ 'aria-haspopup': 'dialog';
6
+ };
7
+ /** The markup an entity's detail route returns to the popup. */ export declare let EntityDetail: ({}: {
8
+ title: string;
9
+ children: ReactNode;
10
+ }) => ReactElement;
11
+ /** The popup shell shared by all entity links in a document. */ export declare let EntityPopup: () => ReactElement;
12
+ //# sourceMappingURL=EntityPopup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityPopup.d.ts","sources":["../EntityPopup.ts"],"names":[],"mappings":"AAA0C,SAA6B,KAAK,YAAY,EAAE,KAAK,SAAS,uBAA0B;AAGlI,qEAAqE,GACrE,OAAO,YAAI,aAAc,MAAM,MAAM;EACnC,MAAM,MAAM;EACZ,qBAAqB,MAAM;EAC3B,iBAAiB;EAKjB;AAEF,8DAA8D,GAC9D,OAAO,YAAI,eAAgB;EACzB,OAAO,MAAM;EACb,UAAU;CACX,KAAG,aAMH;AAED,8DAA8D,GAC9D,OAAO,YAAI,mBAAkB,aAwB1B"}
@@ -0,0 +1,29 @@
1
+ /** Controlled fields and repeat groups, composed from the UI kit's controls.
2
+ * The caller supplies visible fields, values and validation feedback. @module */ import { type JSX } from "@types/react";
3
+ import { type Path, type Values } from "./field-values.js";
4
+ /** One visible input, or a repeat group containing visible inputs per entry. */ export type FieldSpec = {
5
+ path: Path;
6
+ label: string;
7
+ kind: 'text' | 'lines' | 'choice' | 'check' | 'file' | 'repeat';
8
+ required?: boolean;
9
+ hint?: string;
10
+ placeholder?: string;
11
+ options?: readonly string[];
12
+ multiple?: boolean;
13
+ type?: string;
14
+ autocomplete?: string;
15
+ inputMode?: string;
16
+ entries?: FieldSpec[][];
17
+ blank?: Values;
18
+ };
19
+ /** Values and feedback are supplied by the caller; edits name their path. */ export type FieldsProps = {
20
+ at: string;
21
+ fields: FieldSpec[];
22
+ values: Values;
23
+ disabled?: boolean;
24
+ owed?: ReadonlySet<string>;
25
+ onChange: (path: Path, value: unknown) => void;
26
+ onFile?: (path: Path, chosen: File) => void;
27
+ };
28
+ /** Renders typed controls, choice lists and repeat groups. */ export declare let Fields: ({}: FieldsProps) => JSX.Element;
29
+ //# sourceMappingURL=Fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fields.d.ts","sources":["../Fields.ts"],"names":[],"mappings":"AAAA;+EAC+E,GACrC,SAA6B,KAAK,GAAG,uBAA0C;AAWzH,SAAgB,KAAK,IAAI,EAAW,KAAK,MAAM,4BAA2B;AAE1E,8EAA8E,GAC9E,YAAY;EACV,MAAM;EACN,OAAO,MAAM;EACb,MAAM,SAAS,UAAU,WAAW,UAAU,SAAS;EACvD,WAAW,OAAO;EAClB,OAAO,MAAM;EACb,cAAc,MAAM;EACpB,mBAAmB,MAAM;EACzB,WAAW,OAAO;EAClB,OAAO,MAAM;EACb,eAAe,MAAM;EACrB,YAAY,MAAM;EAClB,UAAU;EACV,QAAQ;;AAGV,2EAA2E,GAC3E,YAAY;EACV,IAAI,MAAM;EACV,QAAQ;EACR,QAAQ;EACR,WAAW,OAAO;EAClB,OAAO,YAAY,MAAM;EACzB,WAAW,MAAM,MAAM,OAAO,OAAO,KAAK,IAAI;EAC9C,UAAU,MAAM,MAAM,QAAQ,SAAS,IAAI;;AAO7C,4DAA4D,GAC5D,OAAO,YAAI,SACT,IACE,WAAW,KACZ,IAAI,QAgON"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * A list put in order by dragging its rows: `Order`. Each row drags the
3
+ * entity it stands for (`drag`), so it can be dropped on another list as
4
+ * well, and the list takes any dragged entity: dropped between two rows, it
5
+ * is put there (`onPlace`), whether it was one of the list's rows or came
6
+ * from elsewhere. While one is dragged over the list, a line shows where it
7
+ * would land. That is its state, `Order{at}`, the index of the row it would
8
+ * land before, on the consumer-named page entity (`orderAt`), kept by its
9
+ * consumer as a disclosure's is. What each row says, and what opens beneath
10
+ * it, is the consumer's. A row opened for reading and typing (`open`) is no
11
+ * drag handle: selecting its text, clicking into it and typing never pick it
12
+ * up.
13
+ *
14
+ * @module
15
+ */ import { type JSX, type ReactNode } from "@types/react";
16
+ import type { Bundle } from "@yaks/graph";
17
+ /** The page entity holding this owner's order state. */ export declare let orderAt: (owner: string) => string;
18
+ /** Where a dragged entity would land, or nothing while none is dragged over
19
+ * the list. */ export declare let landing: (e?: Bundle) => number | undefined;
20
+ /** The bundle saying where a dragged entity would land; `null`, nowhere. */ export declare let landed: (e: Bundle, at: number | null) => Bundle;
21
+ /** Where a drop at height `y` lands among rows drawn in these boxes: before
22
+ * the first whose middle is below it, or after them all. */ export declare let among: (boxes: {
23
+ top: number;
24
+ height: number;
25
+ }[], y: number) => number;
26
+ /** Where among the others a row lands when it is dropped before the row at
27
+ * `at`, or nothing when that leaves it where it is. One from elsewhere lands
28
+ * at `at`. */ export declare let placing: (ids: string[], eid: string, at: number) => number | undefined;
29
+ /** State and rows supplied by the order's consumer. */ export type OrderProps = {
30
+ /** its state: `Order{at}` while an entity is dragged over it */ e: Bundle;
31
+ /** where its state bundles go */ onChange: (b: Bundle) => void;
32
+ /** the entities its rows stand for, in order */ ids: string[];
33
+ /** what a row says, and what opens beneath it */ row: (id: string) => ReactNode;
34
+ /** an entity put at `at` among the other rows; without it, the rows are
35
+ * neither picked up nor put in order */ onPlace?: (eid: string, at: number) => void;
36
+ /** whether a row is open for reading and typing, and so not picked up */ open?: (id: string) => boolean;
37
+ /** what a list with no rows says */ empty?: ReactNode;
38
+ };
39
+ /** A list put in order by dragging its rows. */ export declare let Order: ({}: OrderProps) => JSX.Element;
40
+ //# sourceMappingURL=Order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Order.d.ts","sources":["../Order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GAEyC,SAA6B,KAAK,GAAG,EAAE,KAAK,SAAS,uBAA0B;AACzH,cAAc,MAAM,2BAAgC;AAKpD,sDAAsD,GACtD,OAAO,YAAI,UAAW,OAAO,MAAM,KAAG,MAAM,CACJ;AAExC;aACa,GAGb,OAAO,YAAI,UAAW,IAAI,WAAS,MAAM,GAAG,SAAS,CAGpD;AAED,0EAA0E,GAG1E,OAAO,YAAI,SAAU,GAAG,QAAQ,IAAI,MAAM,GAAG,IAAI,KAAG,OAGlD;AAEF;0DAC0D,GAG1D,OAAO,YAAI,QACT;EAAS,KAAK,MAAM;EAAE,QAAQ,MAAM;KACpC,GAAG,MAAM,KACR,MAAM,CAGR;AAED;;YAEY,GAKZ,OAAO,YAAI,UACT,KAAK,MAAM,IACX,KAAK,MAAM,EACX,IAAI,MAAM,KACT,MAAM,GAAG,SAAS,CAKpB;AAED,qDAAqD,GACrD,YAAY;EACV,8DAA8D,GAC9D,GAAG;EACH,+BAA+B,GAC/B,WAAW,GAAG,WAAW,IAAI;EAC7B,8CAA8C,GAC9C,KAAK,MAAM;EACX,+CAA+C,GAC/C,MAAM,IAAI,MAAM,KAAK;EACrB;wCACsC,GACtC,WAAW,KAAK,MAAM,EAAE,IAAI,MAAM,KAAK,IAAI;EAC3C,uEAAuE,GACvE,QAAQ,IAAI,MAAM,KAAK,OAAO;EAC9B,kCAAkC,GAClC,QAAQ;;AAWV,8CAA8C,GAC9C,OAAO,YAAI,QACT,IAAiD,UAAU,KAC1D,IAAI,QAuDN"}
@@ -0,0 +1,28 @@
1
+ /** Controlled pending changes; persistence and writes belong to the host. */ import { type JSX, type ReactNode } from "@types/react";
2
+ import { type Props } from "@yaks/ui/parts";
3
+ export type SaveProps = {
4
+ count: number;
5
+ busy?: boolean;
6
+ /** The pending write's label when the edit is already shown as saved. */ busyLabel?: string;
7
+ /** why the last save did not work; it stays until the next */ message?: string;
8
+ /** what the last save said, such as "Saved", shown while it fades */ done?: string;
9
+ inline?: boolean;
10
+ label?: string;
11
+ mod?: Props['mod'];
12
+ onSave: () => unknown;
13
+ onDiscard: () => unknown;
14
+ };
15
+ /** The place beside a field where bindSave draws the form's actions. */ declare let Slot: ({}: {
16
+ label?: string;
17
+ }) => JSX.Element;
18
+ export type SaveFieldProps = Props & {
19
+ changed: boolean;
20
+ children?: ReactNode;
21
+ };
22
+ declare let Field: ({}: SaveFieldProps) => JSX.Element;
23
+ /** The one place to save or discard all the host's pending changes, saying
24
+ * "Saving…" while it saves, then what the save said until it fades. */ export declare let Save: ((props: SaveProps) => JSX.Element | null) & {
25
+ Field: typeof Field;
26
+ Slot: typeof Slot;
27
+ };
28
+ //# sourceMappingURL=Save.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Save.d.ts","sources":["../Save.ts"],"names":[],"mappings":"AAAA,2EAA2E,GACjC,SAA6B,KAAK,GAAG,EAAE,KAAK,SAAS,uBAA0B;AACzH,SAAiB,KAAK,KAAK,8BAAkD;AAE7E,YAAY;EACV,OAAO,MAAM;EACb,OAAO,OAAO;EACd,uEAAuE,GACvE,YAAY,MAAM;EAClB,4DAA4D,GAC5D,UAAU,MAAM;EAChB,mEAAmE,GACnE,OAAO,MAAM;EACb,SAAS,OAAO;EAChB,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,cAAc,OAAO;EACrB,iBAAiB,OAAO;;AAG1B,sEAAsE,GACtE,YAAI,OAAQ;EAAsB,QAAQ,MAAM;CAAE,KAAG,IAAI;AAOzD,YAAY,iBAAiB;EAC3B,SAAS,OAAO;EAChB,WAAW;;AAGb,YAAI,QACF,IAAsC,cAAc,KACnD,IAAI;AAWP;qEACqE,GACrE,OAAO,YAAI,QAAQ,OAAO,cAAc,IAAI,UAAU,IAAI;EACxD,cAAc;EACd,aAAa;EAgEd"}
@@ -0,0 +1,28 @@
1
+ /** A controlled table sorted by raw values, keeping each row's detail rows
2
+ * together. Server-rendered tables use the same transitions through bindSort.
3
+ * @module
4
+ */ import { type JSX, type ReactNode } from "@types/react";
5
+ import type { Bundle } from "@yaks/graph";
6
+ import { type Col } from "@yaks/ui/parts";
7
+ /** Numbers include money and timestamps; null values follow known values. */ export type SortValue = string | number | null;
8
+ /** One sortable item, which may draw several related table rows. */ export type SortRow = {
9
+ values: SortValue[];
10
+ content: ReactNode;
11
+ };
12
+ /** The column and direction the reader chose. */ export type SortState = {
13
+ column: number;
14
+ direction: 'asc' | 'desc';
15
+ };
16
+ /** The page entity for one owner's table. */ export declare let sortAt: (owner: string) => string;
17
+ /** The sort choice supplied by the table's owner. */ export declare let sortOf: (e?: Bundle) => SortState | undefined;
18
+ /** Pressing the same column reverses it; a new column starts ascending. */ export declare let sorted: (e: Bundle, column: number) => Bundle;
19
+ /** A stable copy ordered by values, with missing values last either way. */ export declare let sortRows: <T>(rows: T[], values: (row: T) => SortValue[], state?: SortState) => T[];
20
+ /** State, column labels, layout and items supplied by the table's owner. */ export type SortProps = {
21
+ e: Bundle;
22
+ onChange: (b: Bundle) => void;
23
+ cols: Col[];
24
+ heads: string[];
25
+ rows: SortRow[];
26
+ };
27
+ /** A table whose column headers can be pressed by pointer or keyboard. */ export declare let Sort: ({}: SortProps) => JSX.Element;
28
+ //# sourceMappingURL=Sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sort.d.ts","sources":["../Sort.ts"],"names":[],"mappings":"AAAA;;;CAGC,GACyC,SAA6B,KAAK,GAAG,EAAE,KAAK,SAAS,uBAA0B;AACzH,cAAc,MAAM,2BAAgC;AAEpD,SAAS,KAAK,GAAG,8BAA0C;AAE3D,2EAA2E,GAC3E,YAAY,YAAY,MAAM,GAAG,MAAM,GAAG,IAAI;AAC9C,kEAAkE,GAClE,YAAY;EAAY,QAAQ;EAAa,SAAS;;AACtD,+CAA+C,GAC/C,YAAY;EAAc,QAAQ,MAAM;EAAE,WAAW,QAAQ;;AAC7D,2CAA2C,GAC3C,OAAO,YAAI,SAAU,OAAO,MAAM,KAAG,MAAM,CAA+B;AAC1E,mDAAmD,GACnD,OAAO,YAAI,SAAU,IAAI,WAAS,YAAY,SAAS,CACrB;AAClC,yEAAyE,GACzE,OAAO,YAAI,SAAU,GAAG,QAAQ,QAAQ,MAAM,KAAG,OAQ/C;AAMF,0EAA0E,GAC1E,OAAO,YAAI,WAAY,GACrB,MAAM,KACN,SAAS,KAAK,MAAM,aACpB,QAAQ,cACP,IASC;AAEJ,0EAA0E,GAC1E,YAAY;EACV,GAAG;EACH,WAAW,GAAG,WAAW,IAAI;EAC7B,MAAM;EACN,OAAO,MAAM;EACb,MAAM;;AAGR,wEAAwE,GACxE,OAAO,YAAI,OACT,IAAoC,SAAS,KAC5C,IAAI,QAkCN"}
@@ -0,0 +1,48 @@
1
+ /** Controlled loading and submission with durable drafts. Domain data and
2
+ * transport are supplied through callbacks. @module */ import { type JSX } from "@types/react";
3
+ import type { Bundle } from "@yaks/graph";
4
+ import { type Drafts } from "./host.js";
5
+ import { type Path, type Values } from "./field-values.js";
6
+ /** Page state; the durable draft is the source of values. */ export type SubmitState<T = unknown> = {
7
+ content?: T;
8
+ unread?: string;
9
+ values?: Values;
10
+ tried?: boolean;
11
+ sending?: boolean;
12
+ sent?: boolean;
13
+ said?: string;
14
+ /** When the content arrived, in epoch milliseconds: how long a sending took
15
+ * is counted from it. */ shown?: number;
16
+ };
17
+ /** Sends `values`, and `signs`, what the page saw of the sending beside them,
18
+ * such as how long it took; answers what refused it, if anything did. */ export type Send = (at: string, values: Values, signs?: Values) => Promise<string | undefined>;
19
+ export type Read<T> = (at: string) => Promise<T | string>;
20
+ export type Upload = (at: string, path: Path, file: File) => Promise<{
21
+ value: unknown;
22
+ } | string>;
23
+ export type Feedback = Pick<SubmitState, 'sent' | 'said'>;
24
+ export type SubmitView<T> = {
25
+ content: T;
26
+ state: SubmitState<T>;
27
+ change: (next: SubmitState<T>) => void;
28
+ send: Send;
29
+ file: (path: Path, chosen: File) => Promise<void>;
30
+ };
31
+ export type SubmitProps<T> = {
32
+ at: string;
33
+ place: string;
34
+ drafts?: Drafts;
35
+ e?: Bundle;
36
+ onChange: (b: Bundle) => void;
37
+ read: Read<T>;
38
+ send: Send;
39
+ upload?: Upload;
40
+ initial?: (content: T) => Values;
41
+ feedback?: () => Feedback | undefined;
42
+ loading?: string;
43
+ render: (view: SubmitView<T>) => JSX.Element;
44
+ };
45
+ /** Stable page state identity, separate from the caller's durable draft place. */ export declare let submitAt: (at: string) => string;
46
+ export declare let submitOf: <T = unknown>(e?: Bundle) => SubmitState<T>;
47
+ /** Loads content and keeps edits until their submission succeeds. */ export declare let Submit: <T>({}: SubmitProps<T>) => JSX.Element;
48
+ //# sourceMappingURL=Submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Submit.d.ts","sources":["../Submit.ts"],"names":[],"mappings":"AAAA;qDACqD,GACX,SAA6B,KAAK,GAAG,uBAA6C;AAC5H,cAAc,MAAM,2BAAgC;AAGpD,SAAS,KAAK,MAAM,oBAAwC;AAC5D,SAAS,KAAK,IAAI,EAAO,KAAK,MAAM,4BAA2B;AAE/D,2DAA2D,GAC3D,YAAY,YAAY,IAAI,OAAO;EACjC,UAAU;EACV,SAAS,MAAM;EACf,SAAS;EACT,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,OAAO,OAAO;EACd,OAAO,MAAM;EACb;yBACuB,GACvB,QAAQ,MAAM;;AAEhB;uEACuE,GACvE,YAAY,QACV,IAAI,MAAM,EACV,QAAQ,QACR,QAAQ,WACL,QAAQ,MAAM,GAAG,SAAS;AAC/B,YAAY,KAAK,MAAM,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM;AACxD,YAAY,UACV,IAAI,MAAM,EACV,MAAM,MACN,MAAM,SACH;EAAU,OAAO,OAAO;IAAK,MAAM;AACxC,YAAY,WAAW,KAAK,aAAa,SAAS;AAClD,YAAY,WAAW;EACrB,SAAS;EACT,OAAO,YAAY;EACnB,SAAS,MAAM,YAAY,OAAO,IAAI;EACtC,MAAM;EACN,OAAO,MAAM,MAAM,QAAQ,SAAS,QAAQ,IAAI;;AAElD,YAAY,YAAY;EACtB,IAAI,MAAM;EACV,OAAO,MAAM;EACb,SAAS;EACT,IAAI;EACJ,WAAW,GAAG,WAAW,IAAI;EAC7B,MAAM,KAAK;EACX,MAAM;EACN,SAAS;EACT,WAAW,SAAS,MAAM;EAC1B,iBAAiB,WAAW,SAAS;EACrC,UAAU,MAAM;EAChB,SAAS,MAAM,WAAW,OAAO,IAAI;;AAEvC,gFAAgF,GAChF,OAAO,YAAI,WAAY,IAAI,MAAM,KAAG,MAAM,CAA8B;AACxE,OAAO,YAAI,WAAY,IAAI,OAAO,EAAE,IAAI,WAAS,YAAY,GACZ;AAEjD,mEAAmE,GACnE,OAAO,YAAI,SAAU,GACnB,IAaG,YAAY,EAAE,KAChB,IAAI,QA+FN"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A value typed over where it stands: `Edit.Text`. At rest it is the value's
3
+ * text (or its inline markdown); opened, by a double-click or by whoever holds
4
+ * its `Edit` state, the element becomes plaintext-editable in place, the same
5
+ * face, font and box, so nothing on the page moves. Enter (a body: Ctrl+Enter,
6
+ * or leaving it) emits what was typed, Escape puts the value back
7
+ * (`@yaks/ux/edit-keys`), and what is typed is the
8
+ * person's draft (the host's `drafts`) as it is typed: a remount, a reload,
9
+ * another view or another interface types on from it, and a value with a
10
+ * draft shows it, open, wherever it is drawn, until it is sent or put back.
11
+ *
12
+ * @module
13
+ */ import { type JSX } from "@types/react";
14
+ import { type Bundle } from "./host.js";
15
+ import { type OnChange } from "./emit.js";
16
+ /** What an `Edit.Text` is drawn with. */ export type TextProps = {
17
+ /** what controls it: the value is `e[comp][prop]` */ e: Bundle;
18
+ comp: string;
19
+ prop: string;
20
+ /** where what it emits goes (default: the host's `write`) */ onChange?: OnChange;
21
+ /** its `Edit` state's eid, when its caller names it */ at?: string;
22
+ /** Enter types a new line; Ctrl+Enter or leaving it is what emits */ multi?: boolean;
23
+ /** inline markdown at rest (the host's `markup`); its source typed over */ inline?: boolean;
24
+ /** shown, never opened; an open one closes, emitting nothing */ readOnly?: boolean;
25
+ };
26
+ /** A value typed over where it stands. */ export declare let Text: ({}: TextProps) => JSX.Element;
27
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.d.ts","sources":["../Text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAEyC,SAA6B,KAAK,GAAG,uBAAmD;AAElI,SAAS,KAAK,MAAM,oBAA4B;AAChD,SAAe,KAAK,QAAQ,oBAAmB;AAM/C,uCAAuC,GACvC,YAAY;EACV,mDAAmD,GACnD,GAAG;EACH,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,2DAA2D,GAC3D,WAAW;EACX,qDAAqD,GACrD,KAAK,MAAM;EACX,mEAAmE,GACnE,QAAQ,OAAO;EACf,yEAAyE,GACzE,SAAS,OAAO;EAChB,8DAA8D,GAC9D,WAAW,OAAO;;AAGpB,wCAAwC,GACxC,OAAO,YAAI,OACT,IAA0D,SAAS,KAClE,IAAI,QA+FN"}
@@ -0,0 +1,19 @@
1
+ import { type ReactElement } from "@types/react";
2
+ export type Token = {
3
+ value: string;
4
+ label: string;
5
+ note?: string;
6
+ };
7
+ type Props = {
8
+ id: string;
9
+ name?: string;
10
+ initial?: string;
11
+ placeholder: string;
12
+ choices: readonly Token[];
13
+ find?: (text: string) => readonly Token[];
14
+ tokens: readonly Token[];
15
+ onTokens: (tokens: Token[]) => void;
16
+ typed: (text: string) => Token | undefined;
17
+ };
18
+ /** A multi-select with keyboard navigation and optional type-in choices. */ export declare let TokenPicker: ({}: Props) => ReactElement;
19
+ //# sourceMappingURL=TokenPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenPicker.d.ts","sources":["../TokenPicker.ts"],"names":[],"mappings":"AAU0C,SAIxC,KAAK,YAAY,uBAGM;AAEzB,YAAY;EAAU,OAAO,MAAM;EAAE,OAAO,MAAM;EAAE,OAAO,MAAM;;KAE5D;EACH,IAAI,MAAM;EACV,OAAO,MAAM;EACb,UAAU,MAAM;EAChB,aAAa,MAAM;EACnB,kBAAkB;EAClB,QAAQ,MAAM,MAAM,cAAc;EAClC,iBAAiB;EACjB,WAAW,QAAQ,YAAY,IAAI;EACnC,QAAQ,MAAM,MAAM,KAAK,QAAQ,SAAS;;AAG5C,0EAA0E,GAC1E,OAAO,YAAI,cACT,IAUG,KAAK,KACP,aAsEF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Where a reader stands in a list that changes under them: an item, by its
3
+ * id, and how far into it their view begins, rather than a distance from the
4
+ * list's start. Items loading above, an item above growing, and items
5
+ * arriving below all leave that item where it was on the screen; an item
6
+ * removed hands its place to the item after it. A reader at the list's end
7
+ * follows it instead, and stays at the end as items arrive.
8
+ *
9
+ * Pure: the terminal's list (@yaks/tui VirtualList) measures in rows and the
10
+ * browser's (@yaks/ux anchored) in pixels, and both keep their reader here.
11
+ *
12
+ * @module
13
+ */ /** An item by its id, and how far past its start the view begins. Negative
14
+ * when the view begins in a gap above it. */ export type Anchor = {
15
+ id: string;
16
+ offset: number;
17
+ };
18
+ /** Where a reader stands: at an item, or following the end. */ export type ViewportState = {
19
+ anchor?: Anchor;
20
+ follow: boolean;
21
+ };
22
+ /** An item as it is laid out: where it starts, measured from the view's
23
+ * start (or any origin, the same for every box), and how tall it is. */ export type Box = {
24
+ id: string;
25
+ top: number;
26
+ height: number;
27
+ };
28
+ /** The anchor once the list's ids went from `was` to `now`: kept while its
29
+ * item stays, else at the start of the nearest item after it that stayed,
30
+ * else of the nearest before it. Items loaded above or below meanwhile
31
+ * change nothing. */ export declare let rekey: (anchor: Anchor | undefined, was: readonly string[], now: readonly string[]) => Anchor | undefined;
32
+ /** The anchor of a view that begins at `top`: the first item that reaches
33
+ * below it, and how far into that item it begins. */ export declare let anchorAt: (boxes: readonly Box[], top?: number) => Anchor | undefined;
34
+ /** Where a view anchored at `anchor` begins, laid out as `boxes`, or
35
+ * undefined when its item is not among them: as far past its item's start
36
+ * as it was. */ export declare let topOf: (anchor: Anchor, boxes: readonly Box[]) => number | undefined;
37
+ /** The item and offset `by` past `at`, among `count` items of `size(index)`
38
+ * each, measured only as far as the walk goes: it stops at the list's first
39
+ * and last items. */ export declare let walk: (at: {
40
+ index: number;
41
+ offset: number;
42
+ }, by: number, size: (index: number) => number, count: number) => {
43
+ index: number;
44
+ offset: number;
45
+ };
46
+ /** Whether a reader follows the end after their view moved from `was` to
47
+ * `now`: once they are at it, and no longer once they moved up from it. */ export declare let follows: (follow: boolean, {}: {
48
+ was: number;
49
+ now: number;
50
+ end: boolean;
51
+ }) => boolean;
52
+ //# sourceMappingURL=anchor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor.d.ts","sources":["../anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED;2CAC2C,GAC3C,YAAY;EAAW,IAAI,MAAM;EAAE,QAAQ,MAAM;;AAEjD,6DAA6D,GAC7D,YAAY;EAAkB,SAAS;EAAQ,QAAQ,OAAO;;AAE9D;sEACsE,GACtE,YAAY;EAAQ,IAAI,MAAM;EAAE,KAAK,MAAM;EAAE,QAAQ,MAAM;;AAE3D;;;mBAGmB,GACnB,OAAO,YAAI,QACT,QAAQ,SAAS,SAAS,EAC1B,cAAc,MAAM,IACpB,cAAc,MAAM,OACnB,SAAS,SAAS,CAQpB;AAED;mDACmD,GACnD,OAAO,YAAI,WACT,gBAAgB,OAChB,iBACC,SAAS,SAAS,CAGpB;AAED;;cAEc,GACd,OAAO,YAAI,QACT,QAAQ,QACR,gBAAgB,UACf,MAAM,GAAG,SAAS,CAGpB;AAED;;mBAEmB,GACnB,OAAO,YAAI,OACT;EAAM,OAAO,MAAM;EAAE,QAAQ,MAAM;GACnC,IAAI,MAAM,EACV,OAAO,OAAO,MAAM,KAAK,MAAM,EAC/B,OAAO,MAAM;EACV,OAAO,MAAM;EAAE,QAAQ,MAAM;EAOjC;AAED;yEACyE,GACzE,OAAO,YAAI,UACT,QAAQ,OAAO,EACf;EAAqB,KAAK,MAAM;EAAE,KAAK,MAAM;EAAE,KAAK,OAAO;CAAE,KAC5D,OAAO,CAA2C"}
@@ -0,0 +1,30 @@
1
+ /** What it holds the reader in. */ export type AnchoredOptions = {
2
+ /** What holds the list: its changes and its size are watched. */ content: Element;
3
+ /** The list's items in order. */ rows: () => Iterable<Element>;
4
+ /** What an item is known by: its `id`, unless told otherwise. */ key?: (row: Element) => string | null;
5
+ /** The edge its newest items come at, which a reader standing there
6
+ * follows: its end (a conversation), unless told its start. */ edge?: 'start' | 'end';
7
+ /** Whether it starts following that edge (it does). */ follow?: boolean;
8
+ /** Told when the reader comes to the edge, or leaves it. */ onFollow?: (follow: boolean) => void;
9
+ /** Whether an item arriving at the edge the reader is away from is one
10
+ * they haven't seen: every one, unless told. */ counts?: (row: Element) => boolean;
11
+ /** Told when an item that counts arrives at the edge the reader is away
12
+ * from, and when they come back to it. */ onUnseen?: (unseen: boolean) => void;
13
+ /** While true it neither moves the reader nor reads where they are: the
14
+ * list is hidden, or something is shown over it. */ idle?: () => boolean;
15
+ };
16
+ /** A list holding its reader. */ export type Anchored = {
17
+ /** Take the reader to the edge, to follow it; sliding there, unless they
18
+ * asked for less motion. */ newest: (slide?: boolean) => void;
19
+ /** Take where the reader is now as their place, after something else moved
20
+ * them: following the edge if they are at it, unless told otherwise. */ read: (follow?: boolean) => void;
21
+ /** Put the reader back where they were, after the list changed. Changes it
22
+ * can see are held at once; this is for one it can't. */ hold: () => void;
23
+ /** Whether the reader follows the edge. */ follows: () => boolean;
24
+ /** Whether an item that counts arrived at the edge since the reader left
25
+ * it. */ unseen: () => boolean;
26
+ /** Let the reader go. */ stop: () => void;
27
+ };
28
+ /** The nearest place around `at` that scrolls, or the page. */ export declare let scroller: (at: Element) => HTMLElement;
29
+ /** Hold `pane`'s reader in place as its list changes. */ export declare let anchored: (pane: HTMLElement, o: AnchoredOptions) => Anchored;
30
+ //# sourceMappingURL=anchored.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchored.d.ts","sources":["../anchored.ts"],"names":[],"mappings":"AA+BA,iCAAiC,GACjC,YAAY;EACV,+DAA+D,GAC/D,SAAS;EACT,+BAA+B,GAC/B,YAAY,SAAS;EACrB,+DAA+D,GAC/D,OAAO,KAAK,YAAY,MAAM,GAAG,IAAI;EACrC;+DAC6D,GAC7D,OAAO,UAAU;EACjB,qDAAqD,GACrD,SAAS,OAAO;EAChB,0DAA0D,GAC1D,YAAY,QAAQ,OAAO,KAAK,IAAI;EACpC;gDAC8C,GAC9C,UAAU,KAAK,YAAY,OAAO;EAClC;0CACwC,GACxC,YAAY,QAAQ,OAAO,KAAK,IAAI;EACpC;oDACkD,GAClD,aAAa,OAAO;;AAGtB,+BAA+B,GAC/B,YAAY;EACV;4BAC0B,GAC1B,SAAS,QAAQ,OAAO,KAAK,IAAI;EACjC;wEACsE,GACtE,OAAO,SAAS,OAAO,KAAK,IAAI;EAChC;yDACuD,GACvD,YAAY,IAAI;EAChB,yCAAyC,GACzC,eAAe,OAAO;EACtB;SACO,GACP,cAAc,OAAO;EACrB,uBAAuB,GACvB,YAAY,IAAI;;AAGlB,6DAA6D,GAC7D,OAAO,YAAI,WAAY,IAAI,YAAU,YAQpC;AAED,uDAAuD,GACvD,OAAO,YAAI,WAAY,MAAM,aAAa,GAAG,oBAAkB,SA8I9D"}
@@ -0,0 +1,65 @@
1
+ /** Pure completion transitions; text is supplied by the host's draft. @module */ /** A candidate's replacement text and the note shown beside it. */ export type Cand = {
2
+ text: string;
3
+ kind: string;
4
+ };
5
+ /** What the domain offers at the caret. Offsets span the text to replace. */ export type Result = {
6
+ from: number;
7
+ to: number;
8
+ cands: Cand[];
9
+ whole: boolean;
10
+ };
11
+ /** What the `Completion` component holds. */ export type Row = {
12
+ text: string;
13
+ caret: number;
14
+ /** where the word being completed starts */ from: number;
15
+ /** where it ends */ to: number;
16
+ /** what can replace it */ cands: Cand[];
17
+ /** which of `cands` is picked, -1 for none */ pick: number;
18
+ };
19
+ /** The most candidates the list shows. */ export declare let CAP: number;
20
+ /** The field as the person left it: the text, the caret, and what can come
21
+ * next there, the first picked unless what is typed already reads whole.
22
+ *
23
+ * ```ts
24
+ * import { assertEquals } from '@std/assert'
25
+ * import { typed } from '@yaks/ux/completion'
26
+ *
27
+ * let cands = [{ text: '.task.status', kind: 'prop' }]
28
+ * let found = { from: 0, to: 2, cands, whole: false }
29
+ * assertEquals(typed('.s', 2, found).cands, found.cands)
30
+ * ```
31
+ */ export declare let typed: (text: string, caret: number, found: Result) => Row;
32
+ /** The field as its host put it: the text, and nothing offered. */ export declare let placed: (text: string) => Row;
33
+ /** The pick `d` rows on, held to the list. */ export declare let moved: (r: Row, d: number) => Partial<Row>;
34
+ /** The text with candidate `i` (the pick, or else the first) in place of the
35
+ * word being completed, and the caret after it.
36
+ *
37
+ * ```ts
38
+ * import { assertEquals } from '@std/assert'
39
+ * import { taken, typed } from '@yaks/ux/completion'
40
+ *
41
+ * let cands = [{ text: '.task.status=', kind: 'is' }]
42
+ * let found = { from: 6, to: 8, cands, whole: false }
43
+ * assertEquals(taken(typed('.task .s x', 8, found)), {
44
+ * text: '.task .task.status= x',
45
+ * caret: 19,
46
+ * })
47
+ * ```
48
+ */ export declare let taken: (r: Row, i?: number) => {
49
+ text: string;
50
+ caret: number;
51
+ };
52
+ /** The list closed. */ export declare let dismissed: Partial<Row>;
53
+ /** What a key does while the list is open. */ export type Act = 'accept' | 'up' | 'down' | 'dismiss';
54
+ /** The act a key is on this row: one of the list's while it is open, and none
55
+ * otherwise, so the key is its host's. Enter takes only a pick, so with
56
+ * nothing picked it is the host's too.
57
+ *
58
+ * ```ts
59
+ * import { assertEquals } from '@std/assert'
60
+ * import { act, placed } from '@yaks/ux/completion'
61
+ *
62
+ * assertEquals(act(placed('.s'), 'Enter'), undefined)
63
+ * ```
64
+ */ export declare let act: (r: Row | undefined, key: string) => Act | undefined;
65
+ //# sourceMappingURL=completion-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion-state.d.ts","sources":["../completion-state.ts"],"names":[],"mappings":"AAAA,+EAA+E,GAE/E,iEAAiE,GACjE,YAAY;EAAS,MAAM,MAAM;EAAE,MAAM,MAAM;;AAE/C,2EAA2E,GAC3E,YAAY;EACV,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,OAAO;EACP,OAAO,OAAO;;AAGhB,2CAA2C,GAC3C,YAAY;EACV,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,0CAA0C,GAC1C,MAAM,MAAM;EACZ,kBAAkB,GAClB,IAAI,MAAM;EACV,wBAAwB,GACxB,OAAO;EACP,4CAA4C,GAC5C,MAAM,MAAM;;AAGd,wCAAwC,GACxC,OAAO,YAAI,YAAO;AAElB;;;;;;;;;;;CAWC,GACD,OAAO,YAAI,QAAS,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,WAAS,IAO/D;AAEF,iEAAiE,GACjE,OAAO,YAAI,SAAU,MAAM,MAAM,KAAwB,IAOvD;AAEF,4CAA4C,GAC5C,OAAO,YAAI,QAAS,GAAG,KAAK,GAAG,MAAM,KAAG,QAAQ,KAE9C;AAEF;;;;;;;;;;;;;;CAcC,GACD,OAAO,YAAI,QACT,GAAG,KACH,IAAG,MAAM;EACN,MAAM,MAAM;EAAE,OAAO,MAAM;EAM/B;AAED,qBAAqB,GACrB,OAAO,YAAI,WAAW,QAAQ,KAA6B;AAE3D,4CAA4C,GAC5C,YAAY,MAAM,WAAW,OAAO,SAAS;AAW7C;;;;;;;;;;CAUC,GACD,OAAO,YAAI,MAAO,GAAG,MAAM,SAAS,EAAE,KAAK,MAAM,KAAG,MAAM,SAAS,CACO"}