@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,73 @@
1
+ import { type FunctionComponent, type ReactNode } from "@types/react";
2
+ import type { Bundle } from "@yaks/graph";
3
+ import type { Drafts as HostDrafts } from "./host.js";
4
+ import type { Result } from "./completion-state.js";
5
+ import { type Row } from "./completion-state.js";
6
+ /** As much of a front-end graph as a field needs; a @yaks/client `client()`
7
+ * is one. */ export type Front = {
8
+ mutate: (bundles: Bundle[]) => unknown;
9
+ watch: (query: string, opts?: {
10
+ remote?: boolean;
11
+ }) => {
12
+ value: Bundle[];
13
+ subscribe: (fn: (rows: Bundle[]) => void) => () => void;
14
+ close?: () => void;
15
+ };
16
+ ent: (eid: string) => Bundle | undefined;
17
+ };
18
+ /** An element a list floats beside. */ export type Anchor = {
19
+ current: HTMLInputElement | HTMLTextAreaElement | null;
20
+ };
21
+ /** Where the list of candidates floats: beside the element it belongs to,
22
+ * its field or the well around it. */ export type Float = FunctionComponent<{
23
+ anchor: {
24
+ current: HTMLElement | null;
25
+ };
26
+ children?: ReactNode;
27
+ }>;
28
+ /** A person's drafts, by the place they type in: what is typed there ('' for
29
+ * nothing), kept as it is typed, and followed as it changes (host.ts
30
+ * `Drafts`). @yaks/draft's `desk` is one. */ export type Drafts = Pick<HostDrafts, 'text' | 'type' | 'follow'>;
31
+ /** What the host supplies; the domain owns completion, the host owns drafts. */ export type Opts = {
32
+ /** What the domain offers, read anew each time the person types. */ complete: (text: string, caret: number) => Result | Promise<Result>;
33
+ /** The graph component holding the caret and choices (default: Completion). */ component?: string;
34
+ /** where what is typed in each field is kept, by the field's name */ drafts: Drafts;
35
+ /** where the list floats (default: below the field) */ Float?: Float;
36
+ };
37
+ /** What a completion `Field` takes. */ export type FieldProps = {
38
+ /** the field's entity in the front-end graph */ id: string;
39
+ placeholder?: string;
40
+ /** the field's accessible name */ 'aria-label'?: string;
41
+ /** several lines: a newline can be typed (shift+Enter) */ lines?: boolean;
42
+ /** @yaks/ui `Field` variants */ mod?: string;
43
+ className?: string;
44
+ class?: string;
45
+ /** the text a field starts with when nothing is typed in it yet */ initial?: string;
46
+ /** paint the caret, for a terminal, where no element has the focus */ active?: boolean;
47
+ /** take the keyboard on mount */ focus?: boolean;
48
+ /** the element, for a host that measures it or moves the focus */ elRef?: Anchor;
49
+ /** a key the list did not take */ onKey?: (e: KeyboardEvent) => void;
50
+ /** after the field took what was typed */ onInput?: (e: InputEvent) => void;
51
+ onBlur?: (e: FocusEvent) => void;
52
+ };
53
+ /** The fields in one front-end graph. */ export type Controller = {
54
+ /** the completion field */ Field: FunctionComponent<FieldProps>;
55
+ /** Choices for a separately hosted input; reads its row reactively. */ List: FunctionComponent<{
56
+ id: string;
57
+ anchor: Anchor;
58
+ }>;
59
+ /** Wire an imperative input, returning its listener cleanup. */ bind: (id: string, el: HTMLInputElement | HTMLTextAreaElement) => () => void;
60
+ /** Release the controller's graph subscription when its host closes. */ dispose: () => void;
61
+ /** a field's row */ row: (id: string) => Row | undefined;
62
+ /** a field's row, read by a mounted view */ useRow: (id: string) => Row | undefined;
63
+ /** what is typed in a field */ text: (id: string) => string;
64
+ /** the person typed: the text, the caret, and what can come next there */ type: (id: string, text: string, caret?: number) => void;
65
+ /** the host put this text in the field, offering nothing */ set: (id: string, text: string, caret?: number) => void;
66
+ /** move the pick `d` rows */ move: (id: string, d: number) => void;
67
+ /** take the picked candidate (or candidate `i`), and complete on from it */ accept: (id: string, i?: number) => void;
68
+ /** close the list */ dismiss: (id: string) => void;
69
+ /** a key, named as a browser names it: whether the list took it */ press: (id: string, key: string) => boolean;
70
+ };
71
+ /** Bind completion to a front-end graph and to what its host knows. */ export declare let completion: (front: Front, opts: Opts) => Controller;
72
+ export { type Act, act, type Cand, CAP, dismissed, moved, placed, type Result, type Row, taken, typed } from "./completion-state.js";
73
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sources":["../completion.ts"],"names":[],"mappings":"AAQ0C,SAGxC,KAAK,iBAAiB,EAEtB,KAAK,SAAS,uBAIS;AACzB,cAAc,MAAM,2BAAgC;AAOpD,cAAc,UAAU,UAAU,oBAAmB;AACrD,cAAc,MAAM,gCAA+B;AACnD,SAME,KAAK,GAAG,gCAGoB;AAE9B;WACW,GACX,YAAY;EACV,SAAS,SAAS,aAAa,OAAO;EACtC,QAAQ,OAAO,MAAM,EAAE;IAAS,SAAS,OAAO;;IAC9C,OAAO;IACP,YAAY,KAAK,MAAM,aAAa,IAAI,WAAW,IAAI;IACvD,cAAc,IAAI;;EAEpB,MAAM,KAAK,MAAM,KAAK,SAAS,SAAS;;A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AAM,KAAK,MAAM;EAC5B,wEAAwE,GACxE,OAAO,IAAI,MAAM,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAK,IAAI;EACxD,0DAA0D,GAC1D,MAAM,IAAI,MAAM,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAK,IAAI;EACvD,2BAA2B,GAC3B,OAAO,IAAI,MAAM,EAAE,GAAG,MAAM,KAAK,IAAI;EACrC,0EAA0E,GAC1E,SAAS,IAAI,MAAM,EAAE,IAAI,MAAM,KAAK,IAAI;EACxC,mBAAmB,GACnB,UAAU,IAAI,MAAM,KAAK,IAAI;EAC7B,iEAAiE,GACjE,QAAQ,IAAI,MAAM,EAAE,KAAK,MAAM,KAAK,OAAO;;AAS7C,qEAAqE,GACrE,OAAO,YAAI,aAAc,OAAO,OAAO,MAAM,SAAO,WAqRnD;AAED,SACE,KAAK,GAAG,EACR,GAAG,EACH,KAAK,IAAI,EACT,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,EACL,KAAK,gCACuB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=composer-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer-browser.d.ts","sources":[],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * How a composer (@yaks/ui `Composer`) behaves: Enter sends what is typed,
3
+ * Shift+Enter starts a new line, and the Enter that ends a composition (an
4
+ * IME, a phone's keyboard) only ends it. The field grows with its lines by
5
+ * its own CSS (`field-sizing: content`), with no script.
6
+ *
7
+ * A part drawn in the browser asks {@link sends} of its own keys. A page
8
+ * drawn on a server binds every composer it holds, and every one a later
9
+ * page swaps in, once with {@link composing} (`@yaks/ux/composer-browser`).
10
+ *
11
+ * ```ts
12
+ * import { sends } from '@yaks/ux/composer'
13
+ * import { equal } from '@yaks/testing'
14
+ *
15
+ * let key = (key: string, more = {}) =>
16
+ * sends({ key, shiftKey: false, isComposing: false, ...more })
17
+ * equal(key('Enter'), true)
18
+ * equal(key('Enter', { shiftKey: true }), false)
19
+ * equal(key('Enter', { isComposing: true }), false)
20
+ * equal(key('a'), false)
21
+ * ```
22
+ *
23
+ * @module
24
+ */ /** What of a key press decides whether it sends. */ export type Key = Pick<KeyboardEvent, 'key' | 'shiftKey' | 'isComposing'>;
25
+ /** Whether `ev` sends a composer's words rather than typing in it. */ export declare let sends: (ev: Key) => boolean;
26
+ /** The class every composer's field wears. */ export declare let FIELD: string;
27
+ /** Enter in any composer's field in `doc` sends its form, as its button
28
+ * does (`requestSubmit`, so the form checks its fields and its listeners
29
+ * hear it). A field whose own handler took the key (`defaultPrevented`) is
30
+ * left to it. Binding a document twice binds it once. */ export declare let composing: (doc: Document) => void;
31
+ //# sourceMappingURL=composer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.d.ts","sources":["../composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,kDAAkD,GAClD,YAAY,MAAM,KAAK,eAAe,QAAQ,aAAa;AAE3D,oEAAoE,GACpE,OAAO,YAAI,QAAS,IAAI,QAAM,OAAO,CACiB;AAEtD,4CAA4C,GAC5C,OAAO,YAAI,cAAwB;AAInC;;;uDAGuD,GACvD,OAAO,YAAI,YAAa,KAAK,aAAW,IAAI,CAW3C"}
@@ -0,0 +1,4 @@
1
+ /** Run `then` in `ms`; the answer cancels it. */ export type After = (ms: number, then: () => void) => () => void;
2
+ /** Follow every item's menu in `doc`, now and as its pages are drawn anew;
3
+ * `after` keeps time for a long press. */ export declare let contextMenus: (doc: Document, after?: After) => void;
4
+ //# sourceMappingURL=context-menu-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-menu-browser.d.ts","sources":["../context-menu-browser.ts"],"names":[],"mappings":"AAyDA,+CAA+C,GAC/C,YAAY,SAAS,IAAI,MAAM,EAAE,YAAY,IAAI,WAAW,IAAI;AAOhE;wCACwC,GACxC,OAAO,YAAI,eAAgB,KAAK,UAAU,QAAO,UAAgB,IAAI,CAmKpE"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * What can be done with an item, and the menu that offers it. An item's
3
+ * actions are declared once, beside what draws that kind of item (an app's
4
+ * beside its tile, @yaks/platform/app-tile `appActions`), as data: a label
5
+ * and what a press does. The item's menu (`ActionMenu`) and its own buttons
6
+ * (`actionProps`) are drawn from the same declaration, so they cannot drift.
7
+ *
8
+ * An item opens its menu (`menuOf`) by a right-click, a long press on a touch
9
+ * screen, the menu key or Shift+F10 while it holds the focus, and its ⋯
10
+ * (`Menu.More`). The menu is @yaks/ui's `Menu.Context`, a popover: Escape and
11
+ * a press elsewhere close it, the arrow keys walk its items, and the focus
12
+ * goes back to the item. The page's script binds it all once
13
+ * (./context-menu-browser.ts `contextMenus`).
14
+ *
15
+ * A press does one of:
16
+ * - `href`: opens a page, in a new tab with `tab`;
17
+ * - `opens`: opens the dialog (a popover) of that id on the page;
18
+ * - `submits`: sends the form of that id on the page, as its own button
19
+ * would, with the name and value of `sends` where the button carries one;
20
+ * - `copy`: puts the words on the clipboard;
21
+ * - `link`: puts a link on the clipboard, a path made whole against the page;
22
+ * - `share`: hands a link to the device's share sheet, or copies it where
23
+ * there is none;
24
+ * - `data`: marks the press with data attributes the page's own script
25
+ * answers, as it answers the item's own button (the friends dock's
26
+ * `data-dock-friend`).
27
+ *
28
+ * ```ts
29
+ * import { actionProps, moved, opensMenu } from '@yaks/ux/context-menu'
30
+ * import { equal } from '@yaks/testing'
31
+ *
32
+ * equal(opensMenu({ key: 'ContextMenu', shiftKey: false }), true)
33
+ * equal(opensMenu({ key: 'F10', shiftKey: true }), true)
34
+ * equal(opensMenu({ key: 'F10', shiftKey: false }), false)
35
+ * // Three items: down from the last wraps to the first; End to the last.
36
+ * equal(moved('ArrowDown', 2, 3), 0)
37
+ * equal(moved('ArrowUp', 0, 3), 2)
38
+ * equal(moved('End', 0, 3), 2)
39
+ * equal(moved('Enter', 1, 3), undefined)
40
+ * // A press the page's own script answers wears its marks.
41
+ * equal(actionProps({ label: 'Message', data: { 'dock-friend': 'bo' } }), {
42
+ * as: 'button',
43
+ * type: 'button',
44
+ * 'data-dock-friend': 'bo',
45
+ * })
46
+ * ```
47
+ *
48
+ * @module
49
+ */ import { type ReactNode } from "@types/react";
50
+ import type { IconNode } from "lucide";
51
+ /** One thing a person can do with an item. */ export type Action = {
52
+ label: string;
53
+ href?: string;
54
+ /** Whether to open a new tab. Omit to use the page's link behavior. */ tab?: boolean;
55
+ opens?: string;
56
+ submits?: string;
57
+ /** The name and value a press sends with the form it `submits`. */ sends?: [string, string];
58
+ copy?: string;
59
+ link?: string;
60
+ share?: string;
61
+ /** Data attributes, without their `data-`, the page's script answers. */ data?: Record<string, string>;
62
+ /** It loses something: drawn last, after a rule, in the danger ink. */ danger?: boolean;
63
+ icon?: IconNode;
64
+ };
65
+ /** An item's actions by name, in the order its menu offers them; a name
66
+ * whose action the page cannot offer is left undefined. */ export type Actions = Record<string, Action | undefined>;
67
+ /** The attribute naming the menu an item opens. */ export declare let ITEM: string;
68
+ /** How long a finger rests on an item before its menu opens, ms. */ export declare let HOLD: number;
69
+ /** How far a finger may wander and still be holding, px. */ export declare let SLOP: number;
70
+ /** The props an item wears to open the menu `id`. */ export declare let menuOf: (id: string) => Record<string, string>;
71
+ /** The props of a button or link that does `a`: an `href` for a link, the
72
+ * rest for a `button`. A menu's items and an item's own buttons both wear
73
+ * them. */ export declare let actionProps: (a: Action) => Record<string, unknown>;
74
+ /** The item's menu, `id`, offering `actions`: what its right-click, long
75
+ * press and ⋯ open. `label` names it to a screen reader. */ export declare let ActionMenu: ({}: {
76
+ id: string;
77
+ label: string;
78
+ actions: Actions;
79
+ }) => ReactNode;
80
+ /** The item's ⋯, opening its menu `id`; `label` says whose menu it is. */ export declare let MoreButton: ({}: {
81
+ id: string;
82
+ label: string;
83
+ }) => ReactNode;
84
+ /** An item's menu and its ⋯ together, for a row that shows both. */ export declare let MoreMenu: (props: {
85
+ id: string;
86
+ label: string;
87
+ actions: Actions;
88
+ }) => ReactNode;
89
+ /** Whether a key opens the focused item's menu: the menu key, or Shift+F10. */ export declare let opensMenu: (e: {
90
+ key: string;
91
+ shiftKey: boolean;
92
+ }) => boolean;
93
+ /** Where the arrow keys, Home and End move from item `at` of `n`, wrapping
94
+ * at either end, or undefined for a key that does not move. */ export declare let moved: (key: string, at: number, n: number) => number | undefined;
95
+ //# sourceMappingURL=context-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-menu.d.ts","sources":["../context-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDC,GACyC,SAAuC,KAAK,SAAS,uBAA0B;AAGzH,cAAc,QAAQ,iBAA2B;AAIjD,4CAA4C,GAC5C,YAAY;EACV,OAAO,MAAM;EACb,OAAO,MAAM;EACb,qEAAqE,GACrE,MAAM,OAAO;EACb,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,iEAAiE,GACjE,SAAS,MAAM,EAAE,MAAM;EACvB,OAAO,MAAM;EACb,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,uEAAuE,GACvE,OAAO,OAAO,MAAM,EAAE,MAAM;EAC5B,qEAAqE,GACrE,SAAS,OAAO;EAChB,OAAO;;AAGT;yDACyD,GACzD,YAAY,UAAU,OAAO,MAAM,EAAE,SAAS,SAAS;AAEvD,iDAAiD,GACjD,OAAO,YAAI,aAA0B;AAErC,kEAAkE,GAClE,OAAO,YAAI,aAAU;AACrB,0DAA0D,GAC1D,OAAO,YAAI,aAAS;AAEpB,mDAAmD,GACnD,OAAO,YAAI,SAAU,IAAI,MAAM,KAAG,OAAO,MAAM,EAAE,MAAM,EAAqB;AAE5E;;SAES,GACT,OAAO,YAAI,cAAe,GAAG,WAAS,OAAO,MAAM,EAAE,OAAO,EAyBvD;AASL;0DAC0D,GAC1D,OAAO,YAAI,aACT;EAA0B,IAAI,MAAM;EAAE,OAAO,MAAM;EAAE,SAAS;CAAS,KACtE,UAqBF;AAED,wEAAwE,GACxE,OAAO,YAAI,aACT;EAAiB,IAAI,MAAM;EAAE,OAAO,MAAM;CAAE,KAC3C,UAYA;AAEH,kEAAkE,GAClE,OAAO,YAAI,WACT;EAAS,IAAI,MAAM;EAAE,OAAO,MAAM;EAAE,SAAS;MAC5C,UAA0E;AAE7E,6EAA6E,GAC7E,OAAO,YAAI,YAAa;EAAK,KAAK,MAAM;EAAE,UAAU,OAAO;MAAK,OAAO,CACb;AAE1D;6DAC6D,GAC7D,OAAO,YAAI,QACT,KAAK,MAAM,EACX,IAAI,MAAM,EACV,GAAG,MAAM,KACR,MAAM,GAAG,SAAS,CAMb"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * An entity dragged from any place on a page to any other: a row dragged out
3
+ * of one list says which entity it stands for under one type, and the list it
4
+ * is dropped on reads it, whichever package drew either. A drag says which
5
+ * entity it holds only when it is dropped; while it moves, a place can ask
6
+ * only whether it holds one (`drags`), to say it would take it.
7
+ *
8
+ * ```ts
9
+ * import { drag, dragged, drags } from '@yaks/ux'
10
+ * import { equal } from '@yaks/testing'
11
+ *
12
+ * let kept = new Map<string, string>()
13
+ * let dataTransfer = {
14
+ * get types() { return [...kept.keys()] },
15
+ * setData: (type: string, value: string) => kept.set(type, value),
16
+ * getData: (type: string) => kept.get(type) ?? '',
17
+ * }
18
+ * let ev = { dataTransfer } as unknown as DragEvent
19
+ * equal(drags(ev), false)
20
+ * drag(ev, 'M-1')
21
+ * equal([drags(ev), dragged(ev)], [true, 'M-1'])
22
+ * ```
23
+ *
24
+ * @module
25
+ */ /** The type a dragged entity's eid travels under. */ export declare let DRAGGED: string;
26
+ /** Put an entity in a drag, as it starts. */ export declare let drag: (ev: DragEvent, eid: string) => void;
27
+ /** Whether a drag holds an entity: all a place can know before the drop. */ export declare let drags: (ev: DragEvent) => boolean;
28
+ /** The entity a dropped drag holds, or nothing. */ export declare let dragged: (ev: DragEvent) => string;
29
+ //# sourceMappingURL=drag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drag.d.ts","sources":["../drag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,mDAAmD,GACnD,OAAO,YAAI,gBAAqC;AAEhD,2CAA2C,GAC3C,OAAO,YAAI,OAAQ,IAAI,WAAW,KAAK,MAAM,KAAG,IAAI,CAEnD;AAED,0EAA0E,GAC1E,OAAO,YAAI,QAAS,IAAI,cAAY,OAAO,CACU;AAErD,iDAAiD,GACjD,OAAO,YAAI,UAAW,IAAI,cAAY,MAAM,CACH"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The keys of anything typed where it stands: Enter keeps what is typed and
3
+ * Escape cancels it. `Edit.Text` reads its keys here, and so does every
4
+ * editor that is not one property (a line that files a task, a filter, a
5
+ * command line, a note), so each answers the same keys.
6
+ *
7
+ * A line keeps on Enter, and Shift+Enter starts a new line in it. A field of
8
+ * many lines (`multi`) types a new line on Enter and keeps on Ctrl+Enter or
9
+ * ⌘+Enter. The key that ends a composition (an IME, a phone's keyboard) only
10
+ * ends it, and a key another handler took first (`defaultPrevented`: a
11
+ * completion list choosing, the layer in front closing) is left to it.
12
+ *
13
+ * ```ts
14
+ * import { editKey } from '@yaks/ux/edit-keys'
15
+ * import { equal } from '@yaks/testing'
16
+ *
17
+ * let key = (key: string, more = {}, multi = false) =>
18
+ * editKey({ key, ...more }, multi)
19
+ * equal(key('Enter'), 'keep')
20
+ * equal(key('Escape'), 'cancel')
21
+ * equal(key('Enter', { shiftKey: true }), undefined)
22
+ * equal(key('Enter', {}, true), undefined)
23
+ * equal(key('Enter', { metaKey: true }, true), 'keep')
24
+ * equal(key('Escape', { isComposing: true }), undefined)
25
+ * equal(key('a'), undefined)
26
+ * ```
27
+ *
28
+ * @module
29
+ */ /** What of a key press decides what it does to what is typed. */ export type Key = Pick<KeyboardEvent, 'key'> & Partial<Pick<KeyboardEvent, 'isComposing' | 'defaultPrevented' | 'shiftKey' | 'ctrlKey' | 'metaKey'>>;
30
+ /** What a key does to what is typed: keeps it, or cancels it. */ export type Edit = 'keep' | 'cancel';
31
+ /** What `ev` does to what is typed in a line, or in a field of many lines
32
+ * (`multi`); undefined when it types, or is not this editor's. */ export declare let editKey: (ev: Key, multi?: boolean) => Edit | undefined;
33
+ /** What an editor does with what is typed in `field`. */ export type EditKeys = {
34
+ /** Enter: what is typed is kept. Without it, Enter types as it would. */ keep?: (field: HTMLElement) => void;
35
+ /** Escape: what is typed is put back or dropped (default: the field is
36
+ * left, keeping what it holds) */ cancel?: (field: HTMLElement) => void;
37
+ /** Enter types a new line; Ctrl or ⌘ with it keeps */ multi?: boolean;
38
+ };
39
+ /** A field's keydown handler: Enter keeps and Escape cancels, each taking
40
+ * its key. Answers whether it took it, for a handler that reads other keys
41
+ * after it. */ export declare let editKeys: (o: EditKeys) => any;
42
+ //# sourceMappingURL=edit-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-keys.d.ts","sources":["../edit-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GAED,+DAA+D,GAC/D,YAAY,MACR,KAAK,eAAe,SACpB,QACA,KACE,eACA,gBAAgB,qBAAqB,aAAa,YAAY;AASpE,+DAA+D,GAC/D,YAAY,OAAO,SAAS;AAE5B;gEACgE,GAChE,OAAO,YAAI,UAAW,IAAI,KAAK,oBAAgB,OAAO,SAAS,CAK9D;AAED,uDAAuD,GACvD,YAAY;EACV,uEAAuE,GACvE,QAAQ,OAAO,gBAAgB,IAAI;EACnC;kCACgC,GAChC,UAAU,OAAO,gBAAgB,IAAI;EACrC,oDAAoD,GACpD,QAAQ,OAAO;;AAGjB;;aAEa,GACb,OAAO,YAAI,WAAY,GAAG,iBASzB"}
@@ -0,0 +1,7 @@
1
+ import type { Bundle, Host } from "./host.js";
2
+ /** Where an `Edit` sends what it emits: its caller's, or else the host's. */ export type OnChange = (b: Bundle) => unknown;
3
+ /** `input` for `comp.prop` of `e`, as the bundle it becomes: read against the
4
+ * declaration where a client may write the property, and passed as it is to a
5
+ * caller that owns a derived one (a status its caller turns into marks). */ export declare let reading: (host: Pick<Host, 'vocab' | 'editing'>, e: Bundle, comp: string, prop: string, input: unknown) => Bundle;
6
+ /** Emit `input` for `comp.prop` of `e`: the changed bundle, or the refusal. */ export declare let emit: (host: Host, onChange: OnChange | undefined, e: Bundle, comp: string, prop: string, input: unknown) => void;
7
+ //# sourceMappingURL=emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit.d.ts","sources":["../emit.ts"],"names":[],"mappings":"AAWA,cAAc,MAAM,EAAE,IAAI,oBAAmB;AAI7C,2EAA2E,GAC3E,YAAY,YAAY,GAAG,WAAW,OAAO;AAI7C;;0EAE0E,GAC1E,OAAO,YAAI,UACT,MAAM,KAAK,MAAM,UAAU,YAC3B,GAAG,QACH,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,OAAO,OAAO,KACb,OAMgC;AAEnC,6EAA6E,GAC7E,OAAO,YAAI,OACT,MAAM,MACN,UAAU,WAAW,SAAS,EAC9B,GAAG,QACH,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,OAAO,OAAO,KACb,IAAI,CASN"}
@@ -0,0 +1,3 @@
1
+ /** Open an entity detail through the popup already mounted by the page. */ export declare let openEntity: (doc: Document, to: URL) => boolean;
2
+ /** Opens a server-rendered entity detail over the page that linked to it. */ export declare let entityPopups: (doc: Document, read?: typeof fetch) => void;
3
+ //# sourceMappingURL=entity-popup-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-popup-browser.d.ts","sources":["../entity-popup-browser.ts"],"names":[],"mappings":"AAKA,yEAAyE,GACzE,OAAO,YAAI,aAAc,KAAK,UAAU,IAAI,QAAM,OAAO,CAMtD;AAEH,2EAA2E,GAC3E,OAAO,YAAI,eAAgB,KAAK,UAAU,cAAa,UAAgB,IAAI,CAoF1E"}
@@ -0,0 +1,25 @@
1
+ import { type Client } from "@yaks/client";
2
+ import { type Bundle } from "@yaks/graph";
3
+ import { type JSX } from "@types/react";
4
+ import { type Frame, type NameClue, type Portrait, type TagStore } from "./tags.js";
5
+ export type { Face, TagStore } from "./tags.js";
6
+ export { reviewGroups, useReviewFaces, useUnnamedFaces } from "./review.js";
7
+ export { asideFaces, compareFaces, confirmGroup, confirmTags, editFaceTags, faceFinds, faceNote, faces, faceSuggestions, fillPortrait, groupTransfer, lookup, mergeGroup, rejectTag, removeTag } from "./tags.js";
8
+ export type FaceTaggerProps = {
9
+ store: TagStore;
10
+ api: URL;
11
+ photo: Frame;
12
+ /** The component that identifies which of the app's entities are people. */ people: string;
13
+ label?: (person: Bundle) => string;
14
+ portrait?: Portrait;
15
+ createPerson?: (name: string) => Record<string, unknown>;
16
+ suggestNames?: boolean;
17
+ /** Evidence for naming an unnamed group or an untagged face, by its eid. */ nameClues?: (target: string, photo: Frame) => NameClue[] | Promise<NameClue[]>;
18
+ /** Only show faces awaiting identification. */ untagged?: boolean;
19
+ firstFace?: string;
20
+ };
21
+ /** Live face selection, autocomplete and confirmation for one photo. */ export declare let FaceTagger: ({}: FaceTaggerProps & {
22
+ front: Pick<Client, 'watch' | 'mutate'>;
23
+ }) => JSX.Element;
24
+ /** Mount the tagger in a page with a local graph for its controls. */ export declare let bindFaceTagger: (root: HTMLElement, props: FaceTaggerProps) => () => void;
25
+ //# sourceMappingURL=FaceTagger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FaceTagger.d.ts","sources":["../../face/FaceTagger.ts"],"names":[],"mappings":"AAAA,SAAS,KAAK,MAAM,4BAAyC;AAC7D,SAAS,KAAK,MAAM,2BAAkD;AAK5B,SAExC,KAAK,GAAG,uBAKe;AAIzB,SAME,KAAK,KAAK,EAIV,KAAK,QAAQ,EACb,KAAK,QAAQ,EAGb,KAAK,QAAQ,oBACG;AAIlB,cAAc,IAAI,EAAE,QAAQ,oBAAmB;AAC/C,SAAS,YAAY,EAAE,cAAc,EAAE,eAAe,sBAAqB;AAC3E,SACE,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,MAAM,EACN,UAAU,EACV,SAAS,EACT,SAAS,oBACO;AAElB,YAAY;EACV,OAAO;EACP,KAAK;EACL,OAAO;EACP,0EAA0E,GAC1E,QAAQ,MAAM;EACd,SAAS,QAAQ,WAAW,MAAM;EAClC,WAAW;EACX,gBAAgB,MAAM,MAAM,KAAK,OAAO,MAAM,EAAE,OAAO;EACvD,eAAe,OAAO;EACtB,0EAA0E,GAC1E,aAAa,QAAQ,MAAM,EAAE,OAAO,UAAU,aAAa,QAAQ;EACnE,6CAA6C,GAC7C,WAAW,OAAO;EAClB,YAAY,MAAM;;AA4IpB,sEAAsE,GACtE,OAAO,YAAI,aACT,IAcI;EACE,OAAO,KAAK,QAAQ,UAAU;CAAW,KAC9C,IAAI,QAwQN;AAED,oEAAoE,GACpE,OAAO,YAAI,iBACT,MAAM,aACN,OAAO,0BACA,IAAI,CAQZ"}
@@ -0,0 +1,5 @@
1
+ import type { Face, TagStore } from "./tags.js";
2
+ export declare let reviewGroups: string;
3
+ /** Read review candidates, including the local photo edit before sync. */ export declare let useReviewFaces: (store: TagStore, query: string) => Face[];
4
+ /** Keep an unnamed group in review while it has any active members. */ export declare let useUnnamedFaces: (store: TagStore, limit?: number, enabled?: boolean) => Face[];
5
+ //# sourceMappingURL=review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.d.ts","sources":["../../face/review.ts"],"names":[],"mappings":"AAEA,cAAc,IAAI,EAAE,QAAQ,oBAAmB;AAE/C,OAAO,YAAI,qBAC6E;AAExF,wEAAwE,GACxE,OAAO,YAAI,iBAAkB,OAAO,UAAU,OAAO,MAAM,KAAG,OAS7D;AAED,qEAAqE,GACrE,OAAO,YAAI,kBACT,OAAO,UACP,gBACA,sBACC,OAwBF"}
@@ -0,0 +1,99 @@
1
+ import { type Bundle, type Eid } from "@yaks/graph";
2
+ export type Watch = {
3
+ readonly value: Bundle[];
4
+ subscribe: (listener: (rows: Bundle[]) => void) => () => void;
5
+ close?: () => void;
6
+ };
7
+ /** The app store client returned by the platform's client.js. */ export type TagStore = {
8
+ watch: (query: string) => Watch;
9
+ query: (query: string) => Promise<Bundle[]>;
10
+ apply: (bundles: Bundle[]) => unknown;
11
+ };
12
+ export type Tag = {
13
+ face: string;
14
+ person: string;
15
+ };
16
+ export type Match = {
17
+ face: string;
18
+ person?: string;
19
+ score: number;
20
+ };
21
+ export type ReviewMatch = Match & {
22
+ kind: 'person' | 'group' | 'face';
23
+ photo: string;
24
+ };
25
+ export type FaceFind = Match & {
26
+ source: string;
27
+ photo: string;
28
+ };
29
+ export type Frame = {
30
+ eid: string;
31
+ url: string;
32
+ alt?: string;
33
+ };
34
+ export type Portrait = {
35
+ component: string;
36
+ property: string;
37
+ /** The app may also keep a portrait through a related record. */ present?: (person: string) => boolean | Promise<boolean>;
38
+ };
39
+ export type NameClue = {
40
+ label: string;
41
+ text?: string;
42
+ source?: string;
43
+ image?: string;
44
+ };
45
+ export type Face = Bundle & {
46
+ face: {
47
+ photo: string;
48
+ box: {
49
+ x: number;
50
+ y: number;
51
+ w: number;
52
+ h: number;
53
+ };
54
+ score: number;
55
+ };
56
+ portrait?: {
57
+ artifact: string;
58
+ batch?: string;
59
+ };
60
+ identified?: {
61
+ person: string;
62
+ };
63
+ face_embedded?: {
64
+ model: string;
65
+ };
66
+ };
67
+ /** A face row projected with its portrait and confirmed person. */ export declare let faces: (photo: string) => string;
68
+ /** One photo mark governs its current and future detections. */ export declare let asideFaces: (photo: string, setAside: boolean) => Bundle;
69
+ /** Read strong cross-photo matches for a set-aside photo. */ export declare let faceFinds: (url: URL, photo: string, signal?: AbortSignal) => Promise<FaceFind[]>;
70
+ /** Read private, ephemeral similarity suggestions. */ export declare let lookup: (url: URL, face: string, untagged: boolean, signal?: AbortSignal) => Promise<Match[]>;
71
+ /** Read review suggestions for a face or for a person's confirmed examples. */ export declare let faceSuggestions: (url: URL, target: {
72
+ face: string;
73
+ } | {
74
+ person: string;
75
+ grouped?: boolean;
76
+ }, signal?: AbortSignal) => Promise<Match[]>;
77
+ /** One read returns named, grouped and unassigned comparison faces. */ export declare let compareFaces: (url: URL, face: string, signal?: AbortSignal) => Promise<{
78
+ matches: ReviewMatch[];
79
+ enabled: boolean;
80
+ }>;
81
+ /** Write one or more tags in one batch. The store supplies attribution. */ export declare let confirmTags: (store: TagStore, tags: Tag[]) => Promise<void>;
82
+ export type FaceEdit = {
83
+ face: string;
84
+ before?: string;
85
+ after?: string;
86
+ };
87
+ /** Guard a group transfer against a membership change since it was shown. */ export declare let groupTransfer: (group: string, person: string, touched?: string) => {
88
+ patch: Bundle;
89
+ inverse: Bundle;
90
+ };
91
+ /** Compare a value against the store's current field token. */ export declare let faceNote: (id: string, text: string, before?: string) => Bundle;
92
+ /** Save face assignments and return an inverse guarded against later edits. */ export declare let editFaceTags: (store: TagStore, edits: FaceEdit[], accompanying?: Bundle[], inverse?: Bundle[]) => Promise<(extra?: Bundle[]) => Promise<void>>;
93
+ /** Dismiss one suggestion wherever the app presents it. */ export declare let rejectTag: (store: TagStore, tag: Tag) => Promise<void>;
94
+ /** Remove the identified person from a face. */ export declare let removeTag: (store: TagStore, face: string) => Promise<void>;
95
+ /** Confirm the selected faces as one unnamed person, in one write. */ export declare let confirmGroup: (store: TagStore, faces: string[]) => Promise<Eid>;
96
+ /** Transfer a group to a person, creating that person when supplied. */ export declare let mergeGroup: (store: TagStore, group: string, person: string, create?: Record<string, unknown>, visible?: string[]) => Promise<void>;
97
+ /** Fill an empty portrait with the highest-scoring confirmed crop.
98
+ * A concurrent manual selection wins through the graph's precondition. */ export declare let fillPortrait: (store: TagStore, person: string, field: Portrait) => Promise<Bundle | undefined>;
99
+ //# sourceMapping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YV;AAED,sEAAsE,GACtE,OAAO,YAAI,aACT,OAAO,UACP,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,SAAS,OAAO,MAAM,EAAE,OAAO,GAC/B,UAAS,MAAM,OACd,QAAQ,IAAI,EASd;AAKD;wEACwE,GACxE,OAAO,YAAI,eACT,OAAO,UACP,QAAQ,MAAM,EACd,OAAO,aACN,QAAQ,SAAS,SAAS,EA4B5B"}
@@ -0,0 +1,4 @@
1
+ /** Paths and immutable values shared by controlled fields and submissions. @module */ export type Values = Readonly<Record<string, unknown>>;
2
+ export type Path = (string | number)[];
3
+ /** The value at `path`, set to `value`; undefined removes it. */ export declare let put: (values: Values, []: readonly (string | number)[], value: unknown) => Values;
4
+ //# sourceMappingURL=field-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-values.d.ts","sources":["../field-values.ts"],"names":[],"mappings":"AAAA,oFAAoF,GACpF,YAAY,SAAS,SAAS,OAAO,MAAM,EAAE,OAAO;AACpD,YAAY,QAAQ,MAAM,GAAG,MAAM;AAGnC,+DAA+D,GAC/D,OAAO,YAAI,MACT,QAAQ,QACR,cAA0B,MAAM,GAAG,MAAM,GAAG,EAC5C,OAAO,OAAO,KACb,OAcF"}
@@ -0,0 +1,4 @@
1
+ type Browser = Pick<typeof globalThis, 'getComputedStyle' | 'ResizeObserver' | 'requestAnimationFrame' | 'cancelAnimationFrame'>;
2
+ /** Keep whole rows in view, leaving room for the disclosure and everything
3
+ * after the list. Without the browser enhancement, every row is shown. */ export declare let fitList: (list: HTMLElement, win: Browser) => () => void;
4
+ //# sourceMappingURL=fit-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit-list.d.ts","sources":["../fit-list.ts"],"names":[],"mappings":"KAAK,UAAU,YACN,YACL,qBACA,mBACA,0BACA;AAOJ;wEACwE,GACxE,OAAO,YAAI,UAAW,MAAM,aAAa,KAAK,kBAAgB,IAAI,CAuDjE"}
@@ -0,0 +1,27 @@
1
+ import { type Clock } from "@yaks/fp";
2
+ /** A server search: the entities a line answers, at most `limit`. */ export type Find<T> = (line: string, limit: number, signal?: AbortSignal) => Promise<T[]>;
3
+ /**
4
+ * A picker's query line: its standing component filter ANDed with what's
5
+ * typed. `comp` is the component every candidate must wear ('' = any doc); an
6
+ * empty line still lists recent candidates by the presence filter. A doc
7
+ * picker passes '' rather than 'doc' on purpose: with no component filter a
8
+ * typed line stays a SINGLE text predicate, so the server's id addressing
9
+ * still resolves a typed human id (T-3); full-text search returns only
10
+ * documented entities anyway.
11
+ *
12
+ * The typed text leads and the presence filter trails ('ali .person', never
13
+ * '.person ali'): an &-segment that STARTS with a dot-param reads as one
14
+ * token, so a term after it would land inside the value; a leading term puts
15
+ * a ' .' in the segment, the boundary that splits it into a text predicate
16
+ * plus the presence one. An empty line is the bare filter, which parses
17
+ * alone.
18
+ *
19
+ * `*` asks for each candidate whole: a presence filter alone answers only the
20
+ * component it names, and a candidate is labelled by its title.
21
+ */ export declare let pickLine: (q: string, comp?: string) => string;
22
+ /** A live picker's hits, asked of `find`: refetched as the line settles
23
+ * (`settle` ms on `clock` without a change, 150 by default), the last request
24
+ * aborted so a slow answer can't overwrite a newer one. An empty line clears
25
+ * the list without a round trip. The answer is an answer to a query, not a
26
+ * component's own state, so it is held here. */ export declare let useHits: <T>(line: string, limit: number, find: Find<T>, settle?: number, clock?: Clock) => T[];
27
+ //# sourceMappingURL=hits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hits.d.ts","sources":["../hits.ts"],"names":[],"mappings":"AAOA,SAAS,KAAK,KAAK,wBAAqC;AAExD,mEAAmE,GACnE,YAAY,KAAK,MACf,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,SAAS,gBACN,QAAQ;AAMb;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,YAAI,WAAY,GAAG,MAAM,EAAE,kBAAY,MAAM,CAInD;AAED;;;;8CAI8C,GAC9C,OAAO,YAAI,UAAW,GACpB,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,MAAM,KAAK,IACX,iBACA,QAAO,UACN,IAkBF"}
@@ -0,0 +1,91 @@
1
+ import { type FunctionComponent, type JSX, type ReactNode } from "@types/react";
2
+ import type { Bundle } from "@yaks/graph";
3
+ import type { FieldProps } from "./completion.js";
4
+ import type { EditOptions } from "@yaks/render";
5
+ import type { Vocab } from "@yaks/vocab";
6
+ import type { Find } from "./hits.js";
7
+ export type { Bundle };
8
+ /** A page's own graph, as much as a UX component needs of it: a @yaks/client
9
+ * `client()` over this package's vocabulary (./vocab.ts) is one. */ export type Front = {
10
+ mutate: (bundles: Bundle[]) => unknown;
11
+ watch: (query: string) => {
12
+ value: Bundle[];
13
+ /** the first answer has arrived; a watch without it always has */ readonly ready?: boolean;
14
+ /** why the query was refused */ readonly refused?: string;
15
+ subscribe: (fn: (rows: Bundle[]) => void) => () => void;
16
+ close?: () => void;
17
+ };
18
+ ent: (eid: string) => Bundle | undefined;
19
+ };
20
+ /** A person's drafts, by the place they type in: what is typed there and not
21
+ * yet sent ('' for nothing), kept as it is typed, and emptied once it is sent
22
+ * or discarded. Where they are kept is the host's choice; @yaks/draft's `desk`
23
+ * keeps them in the graph, synced to every interface the person uses. */ export type Drafts = {
24
+ text: (place: string) => string;
25
+ type: (place: string, text: string) => void;
26
+ spend: (place: string) => void;
27
+ /** Run `fn` now and again whenever a text it read changes, until the
28
+ * returned function is called: how a component draws again as a draft
29
+ * changes (`useDraft`). */ follow?: (fn: () => void) => () => void;
30
+ };
31
+ /** Where a popout floats: beside `anchor`, on `side` first. @yaks/ui `Float`
32
+ * is a browser's. */ export type Float = FunctionComponent<{
33
+ anchor: {
34
+ current: HTMLElement | null;
35
+ };
36
+ side?: 'above' | 'below';
37
+ children?: ReactNode;
38
+ }>;
39
+ /** What a page supplies. */ export type Host = {
40
+ /** the vocabulary of the values it changes: what a property is, and
41
+ * whether a client may write it */ vocab: Vocab;
42
+ /** the page's own graph, where each component keeps its own state */ front: Front;
43
+ /** where what is typed over a value waits until it is sent or put back */ drafts: Drafts;
44
+ /** where a bundle a component emits goes when its caller names nowhere
45
+ * else: a value to the graph it came from, an event (./vocab.json) to
46
+ * whoever says it */ write: (b: Bundle) => unknown;
47
+ /** what to call the entity an eid names */ name: (eid: string) => string;
48
+ /** the id a person reads: `T-9` */ id: (b: Bundle) => string;
49
+ /** the kind it displays as: `task` */ kind: (b: Bundle) => string;
50
+ /** a moment, in words */ when: (at: string) => string;
51
+ /** the entities a query line answers, asked of the server: a picker's
52
+ * candidates, over the whole graph rather than what this page holds */ find: Find<Bundle>;
53
+ /** how long, in ms, a picker's typed line rests unchanged before `find` is
54
+ * asked; 150 without it */ settle?: number;
55
+ /** how typed input is read (@yaks/render `edit`) */ editing?: EditOptions;
56
+ /** the values seen so far in a well (a property declared `well`): a hook,
57
+ * so the host may hold what it reads while the picker is mounted */ useValues?: (well: string) => string[];
58
+ /** the query fields (@yaks/filter) a saved query is typed in; without
59
+ * them a query is typed as text */ fields?: {
60
+ Filter: FunctionComponent<FieldProps>;
61
+ };
62
+ /** inline markdown, drawn: a value shown `inline` at rest */ markup?: (text: string) => ReactNode;
63
+ /** prose as its reader reads it (@yaks/markdown `drawn`): what a property
64
+ * declaring `prose` (@yaks/vocab) is typed over, so a person edits `T-12`
65
+ * where the store holds its eid, and the store swaps it back on the write;
66
+ * without it, the text as stored */ prose?: (text: string) => string;
67
+ /** what a choice wears beside its word: a status's dot */ wears?: (comp: string, prop: string, value: string) => ReactNode;
68
+ /** where a popout floats; without it, in the flow */ Float?: Float;
69
+ };
70
+ /**
71
+ * `<Ux host={host}>…</Ux>`: every UX component under it reads through
72
+ * `host`. `at` names the consumer that owns what is under it (a card's own
73
+ * eid, a view drawn on it), so the same value drawn in two places keeps two
74
+ * states, and a remount finds its own again. An inner `Ux` names a consumer
75
+ * within the one above it, and keeps its host unless given one.
76
+ */ export declare let Ux: ({}: {
77
+ host?: Host;
78
+ at?: string;
79
+ children?: ReactNode;
80
+ }) => JSX.Element;
81
+ /** The host handed down. */ export declare let useHost: () => Host;
82
+ /** The consumer that owns what is drawn here: every `Ux`'s `at` above it,
83
+ * outermost first. */ export declare let useOwner: () => string;
84
+ /** Drafts supplied directly by a control's caller or inherited from its host. */ export declare let useDrafts: (drafts?: Drafts) => Drafts;
85
+ /** What `read` answers of `drafts`, read again whenever a text it read
86
+ * changes. `deps` are what `read` closes over. */ export declare let useFollowed: <T>(drafts: Pick<Drafts, 'follow'>, read: () => T, deps: unknown[]) => T;
87
+ /** What is typed at `place` in `drafts` (the host's, unless given), drawn
88
+ * again as it changes. */ export declare let useDraft: (place: string, drafts?: Drafts) => string;
89
+ /** Drafts held in this page's memory and lost with it: a specimen's, a
90
+ * test's. A page a person types in keeps theirs in a desk (@yaks/draft). */ export declare let heldDrafts: () => Drafts & Required<Pick<Drafts, 'follow'>>;
91
+ //# sourceMappingURL=host.d.ts.map