@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,60 @@
1
+ /**
2
+ * A finger swiping sideways anywhere on the page opens its sidebar: moving
3
+ * right, the one that comes from the left; moving left, the one from the
4
+ * right. Moving back closes the open one. The sidebar follows the finger and,
5
+ * let go, settles open or shut by how far it came and how fast it was moving,
6
+ * with its own motion (@yaks/ui `Layer`).
7
+ *
8
+ * A sidebar is a `Layer-left` or `Layer-right` with an id and `data-swipe`,
9
+ * opened by the address as its link opens it (`#menu`, replacing the
10
+ * fragment, so no history entry). One that stands under the page
11
+ * (`Layer-under`) stays still, and the page over it (its `Layer_Cover`)
12
+ * follows the finger instead, uncovering it. It is one a swipe may open
13
+ * only while the page shows a link to it: where the page lays it beside
14
+ * itself, or has nothing in it, it has none to show.
15
+ *
16
+ * The gesture leaves alone what is not its own:
17
+ * - its axis is locked once the finger has moved `SLOP`, and a mostly
18
+ * upright move scrolls the page as ever;
19
+ * - a touch within `EDGE` of the screen's sides is the browser's (iOS
20
+ * Safari's back and forward);
21
+ * - a field being typed in keeps its touches, to place the caret;
22
+ * - what scrolls sideways under the finger (a carousel, a wide table, a row
23
+ * of tabs) keeps the swipe while it can still scroll that way.
24
+ *
25
+ * ```ts
26
+ * import { axis, placed, settles } from '@yaks/ux/swipe'
27
+ * import { equal } from '@yaks/testing'
28
+ *
29
+ * equal([axis(4, 2), axis(12, 5), axis(5, 12)], [undefined, 'x', 'y'])
30
+ * // A shut sidebar from the left, 300 wide, dragged 120 right.
31
+ * equal(placed('left', 300, false, 120), -180)
32
+ * equal(settles('left', 300, -180, 0), false)
33
+ * equal(settles('left', 300, -180, 0.5), true)
34
+ * ```
35
+ *
36
+ * @module
37
+ */ /** The side a sidebar comes from. */ export type Edge = 'left' | 'right';
38
+ /** How far in from each side of the screen a touch is the browser's, px. */ export declare let EDGE: number;
39
+ /** How far a finger moves before its swipe's axis is locked, px. */ export declare let SLOP: number;
40
+ /** How fast a release settles the way it moves, however far, px/ms. */ export declare let FLING: number;
41
+ /** The axis a move of `dx`, `dy` locks to, or none until it is past `SLOP`. */ export declare let axis: (dx: number, dy: number) => 'x' | 'y' | undefined;
42
+ /** Which of `sidebars` a swipe moving `dx` moves: the open one when it moves
43
+ * toward its edge, or, none open, the one from the side the finger leaves. */ export declare let moves: <S extends {
44
+ edge: Edge;
45
+ open: boolean;
46
+ }>(sidebars: S[], dx: number) => S | undefined;
47
+ /** Where a sidebar from `edge`, `width` wide, stands once the finger has
48
+ * moved `dx` from where it touched: 0 open, `width` off its edge shut. */ export declare let placed: (edge: Edge, width: number, open: boolean, dx: number) => number;
49
+ /** Whether a sidebar let go `at` (as `placed`), moving `speed` px/ms,
50
+ * settles open: the way it was flung, or else open past its middle. */ export declare let settles: (edge: Edge, width: number, at: number, speed: number) => boolean;
51
+ /** Whether what is under the finger, `from` or what holds it, scrolls
52
+ * sideways and can still go the way a finger moving `dx` takes it. */ export declare let kept: (from: Element | null, dx: number, style: (el: Element) => {
53
+ overflowX: string;
54
+ }) => boolean;
55
+ /** What the gesture reads of the window and moves it with. */ export type Window = Pick<typeof globalThis, 'getComputedStyle'> & {
56
+ innerWidth: number;
57
+ location: Pick<Location, 'hash' | 'replace'>;
58
+ };
59
+ /** Open and close `doc`'s sidebars by a finger's swipe. */ export declare let swipe: (doc: Document, win: Window) => () => void;
60
+ //# sourceMappingURL=swipe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swipe.d.ts","sources":["../swipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,GAED,mCAAmC,GACnC,YAAY,OAAO,SAAS;AAE5B,0EAA0E,GAC1E,OAAO,YAAI,aAAS;AACpB,kEAAkE,GAClE,OAAO,YAAI,aAAS;AACpB,qEAAqE,GACrE,OAAO,YAAI,cAAW;AAItB,6EAA6E,GAC7E,OAAO,YAAI,OAAQ,IAAI,MAAM,EAAE,IAAI,MAAM,KAAG,MAAM,MAAM,SAAS,CAKxD;AAET;4EAC4E,GAC5E,OAAO,YAAI,QAAS;EAAY,MAAM;EAAM,MAAM,OAAO;GACvD,UAAU,KACV,IAAI,MAAM,KACT,IAAI,SAAS,CAIf;AAED;wEACwE,GACxE,OAAO,YAAI,SACT,MAAM,MACN,OAAO,MAAM,EACb,MAAM,OAAO,EACb,IAAI,MAAM,KACT,MAAM,CAIR;AAED;qEACqE,GACrE,OAAO,YAAI,UACT,MAAM,MACN,OAAO,MAAM,EACb,IAAI,MAAM,EACV,OAAO,MAAM,KACZ,OAAO,CAGoB;AAE9B;oEACoE,GACpE,OAAO,YAAI,OACT,MAAM,UAAU,IAAI,EACpB,IAAI,MAAM,EACV,QAAQ,IAAI;EAAc,WAAW,MAAM;MAC1C,OAAO,CAcT;AAED,4DAA4D,GAC5D,YAAY,SAAS,YAAY,YAAY;EAC3C,YAAY,MAAM;EAClB,UAAU,KAAK,UAAU,SAAS;;AAoCpC,yDAAyD,GACzD,OAAO,YAAI,QAAS,KAAK,UAAU,KAAK,iBAAe,IAAI,CA2F1D"}
package/_dist/ui.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type Kit } from "./kit.js";
2
+ /** Edit and Text share Edit state; Refused is an event, never stored. */ export declare let kit: Kit;
3
+ /** Installed plugins contribute named kits; a page chooses its composition. */ export declare let ux: {
4
+ base: Kit;
5
+ };
6
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sources":["../ui.ts"],"names":[],"mappings":"AA2BA,SAAoB,KAAK,GAAG,mBAAkB;AAqO9C,uEAAuE,GACvE,OAAO,YAAI,KAAK,IAqHd;AAEF,6EAA6E,GAC7E,OAAO,YAAI;EAAM,MAAM;EAAqB"}
@@ -0,0 +1,13 @@
1
+ import { type UploadQueue } from "@yaks/client/uploads";
2
+ /** File chooser options for a kit drop zone. */ export type UploadZone = {
3
+ /** MIME types or extensions accepted by the file picker. The app's blob
4
+ * settings control which uploads the server takes. */ accept?: string;
5
+ label?: string;
6
+ /** Use the image itself as the picker for a single replaceable image. */ image?: {
7
+ src?: string;
8
+ limit: number;
9
+ };
10
+ };
11
+ /** Mount a drop zone, file and folder pickers, and the queue's live progress.
12
+ * Unmounting the zone leaves the page's queue running. */ export declare let bindUploads: (root: HTMLElement, queue: UploadQueue, _dts_1: never) => () => void;
13
+ //# sourceMappingURL=upload-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-browser.d.ts","sources":["../upload-browser.ts"],"names":[],"mappings":"AAGA,SAIE,KAAK,WAAW,oCACsB;AAGxC,8CAA8C,GAC9C,YAAY;EACV;sDACoD,GACpD,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,uEAAuE,GACvE;IAAU,MAAM,MAAM;IAAE,OAAO,MAAM;;;AAgEvC;wDACwD,GACxD,OAAO,YAAI,cACT,MAAM,aACN,OAAO,aACP,wBACO,IAAI,CAsNZ"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The editors, as the `/views` facet contributes them: `Edit`, a property's
3
+ * control by its type (`.prop.type=enum`), each with the face it gives a
4
+ * value at rest.
5
+ *
6
+ * @module
7
+ */ export { editorViews, views } from "./Edit.js";
8
+ //# sourceMappingURL=views.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.d.ts","sources":["../views.ts"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAED,SAAS,WAAW,EAAE,KAAK,oBAAmB"}
@@ -0,0 +1,6 @@
1
+ import type { VocabDoc } from "@yaks/vocab";
2
+ /** The ux vocabulary, in the form `loadVocab` accepts. */ export declare let uxDoc: VocabDoc;
3
+ /** What this package is: its manifest's description, the one place it is
4
+ * written, which a host stamps on each document here. */ export declare let description: string;
5
+ /** Every document this package declares. */ export declare let docs: VocabDoc[];
6
+ //# sourceMappingURL=vocab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocab.d.ts","sources":["../vocab.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,2BAAgC;AAItD,wDAAwD,GACxD,OAAO,YAAI,OAAO,SAA0B;AAE5C;uDACuD,GACvD,OAAO,YAAI,aAAa,MAAM,CAAuB;AAErD,0CAA0C,GAC1C,OAAO,YAAI,MAAM,WAAoB"}
package/anchor.js ADDED
@@ -0,0 +1,58 @@
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. */ /** The anchor once the list's ids went from `was` to `now`: kept while its
15
+ * item stays, else at the start of the nearest item after it that stayed,
16
+ * else of the nearest before it. Items loaded above or below meanwhile
17
+ * change nothing. */ export let rekey = (anchor, was, now)=>{
18
+ if (!anchor || !now.length) return undefined;
19
+ let kept = new Set(now);
20
+ if (kept.has(anchor.id)) return anchor;
21
+ let at = was.indexOf(anchor.id);
22
+ let after = was.slice(at + 1).find((id)=>kept.has(id));
23
+ let before = was.slice(0, Math.max(0, at)).findLast((id)=>kept.has(id));
24
+ return {
25
+ id: after ?? before ?? now[0],
26
+ offset: 0
27
+ };
28
+ };
29
+ /** The anchor of a view that begins at `top`: the first item that reaches
30
+ * below it, and how far into that item it begins. */ export let anchorAt = (boxes, top = 0)=>{
31
+ let box = boxes.find((b)=>b.top + b.height > top) ?? boxes.at(-1);
32
+ return box && {
33
+ id: box.id,
34
+ offset: top - box.top
35
+ };
36
+ };
37
+ /** Where a view anchored at `anchor` begins, laid out as `boxes`, or
38
+ * undefined when its item is not among them: as far past its item's start
39
+ * as it was. */ export let topOf = (anchor, boxes)=>{
40
+ let box = boxes.find((b)=>b.id == anchor.id);
41
+ return box && box.top + anchor.offset;
42
+ };
43
+ /** The item and offset `by` past `at`, among `count` items of `size(index)`
44
+ * each, measured only as far as the walk goes: it stops at the list's first
45
+ * and last items. */ export let walk = (at, by, size, count)=>{
46
+ let index = at.index;
47
+ let offset = Math.min(at.offset, size(index) - 1) + by;
48
+ while(offset < 0 && index > 0)offset += size(--index);
49
+ offset = Math.max(0, offset);
50
+ while(offset >= size(index) && index < count - 1)offset -= size(index++);
51
+ return {
52
+ index,
53
+ offset: Math.max(0, Math.min(offset, size(index) - 1))
54
+ };
55
+ };
56
+ /** Whether a reader follows the end after their view moved from `was` to
57
+ * `now`: once they are at it, and no longer once they moved up from it. */ export let follows = (follow, { was, now, end })=>end ? true : now < was ? false : follow;
58
+ //# sourceMappingURL=anchor.js.map
package/anchor.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor.js","sources":["./anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED;2CAC2C,GAU3C;;;mBAGmB,GACnB,OAAO,IAAI,QAAQ,CACjB,QACA,KACA;EAEA,IAAI,CAAC,UAAU,CAAC,IAAI,MAAM,EAAE,OAAO;EACnC,IAAI,OAAO,IAAI,IAAI;EACnB,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,GAAG,OAAO;EAChC,IAAI,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE;EAC9B,IAAI,QAAQ,IAAI,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,KAAO,KAAK,GAAG,CAAC;EACpD,IAAI,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,KAAO,KAAK,GAAG,CAAC;EACrE,OAAO;IAAE,IAAI,SAAS,UAAU,GAAG,CAAC,EAAE;IAAE,QAAQ;EAAE;AACpD,EAAC;AAED;mDACmD,GACnD,OAAO,IAAI,WAAW,CACpB,OACA,MAAM,CAAC;EAEP,IAAI,MAAM,MAAM,IAAI,CAAC,CAAC,IAAM,EAAE,GAAG,GAAG,EAAE,MAAM,GAAG,QAAQ,MAAM,EAAE,CAAC,CAAC;EACjE,OAAO,OAAO;IAAE,IAAI,IAAI,EAAE;IAAE,QAAQ,MAAM,IAAI,GAAG;EAAC;AACpD,EAAC;AAED;;cAEc,GACd,OAAO,IAAI,QAAQ,CACjB,QACA;EAEA,IAAI,MAAM,MAAM,IAAI,CAAC,CAAC,IAAM,EAAE,EAAE,IAAI,OAAO,EAAE;EAC7C,OAAO,OAAO,IAAI,GAAG,GAAG,OAAO,MAAM;AACvC,EAAC;AAED;;mBAEmB,GACnB,OAAO,IAAI,OAAO,CAChB,IACA,IACA,MACA;EAEA,IAAI,QAAQ,GAAG,KAAK;EACpB,IAAI,SAAS,KAAK,GAAG,CAAC,GAAG,MAAM,EAAE,KAAK,SAAS,KAAK;EACpD,MAAO,SAAS,KAAK,QAAQ,EAAG,UAAU,KAAK,EAAE;EACjD,SAAS,KAAK,GAAG,CAAC,GAAG;EACrB,MAAO,UAAU,KAAK,UAAU,QAAQ,QAAQ,EAAG,UAAU,KAAK;EAClE,OAAO;IAAE;IAAO,QAAQ,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,KAAK,SAAS;EAAI;AACzE,EAAC;AAED;yEACyE,GACzE,OAAO,IAAI,UAAU,CACnB,QACA,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAA8C,GACjD,MAAM,OAAO,MAAM,MAAM,QAAQ,OAAM"}
package/anchor.ts ADDED
@@ -0,0 +1,87 @@
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
+ */
14
+
15
+ /** An item by its id, and how far past its start the view begins. Negative
16
+ * when the view begins in a gap above it. */
17
+ export type Anchor = { id: string; offset: number }
18
+
19
+ /** Where a reader stands: at an item, or following the end. */
20
+ export type ViewportState = { anchor?: Anchor; 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. */
24
+ export type Box = { id: string; top: number; height: number }
25
+
26
+ /** The anchor once the list's ids went from `was` to `now`: kept while its
27
+ * item stays, else at the start of the nearest item after it that stayed,
28
+ * else of the nearest before it. Items loaded above or below meanwhile
29
+ * change nothing. */
30
+ export let rekey = (
31
+ anchor: Anchor | undefined,
32
+ was: readonly string[],
33
+ now: readonly string[],
34
+ ): Anchor | undefined => {
35
+ if (!anchor || !now.length) return undefined
36
+ let kept = new Set(now)
37
+ if (kept.has(anchor.id)) return anchor
38
+ let at = was.indexOf(anchor.id)
39
+ let after = was.slice(at + 1).find((id) => kept.has(id))
40
+ let before = was.slice(0, Math.max(0, at)).findLast((id) => kept.has(id))
41
+ return { id: after ?? before ?? now[0], offset: 0 }
42
+ }
43
+
44
+ /** The anchor of a view that begins at `top`: the first item that reaches
45
+ * below it, and how far into that item it begins. */
46
+ export let anchorAt = (
47
+ boxes: readonly Box[],
48
+ top = 0,
49
+ ): Anchor | undefined => {
50
+ let box = boxes.find((b) => b.top + b.height > top) ?? boxes.at(-1)
51
+ return box && { id: box.id, offset: top - box.top }
52
+ }
53
+
54
+ /** Where a view anchored at `anchor` begins, laid out as `boxes`, or
55
+ * undefined when its item is not among them: as far past its item's start
56
+ * as it was. */
57
+ export let topOf = (
58
+ anchor: Anchor,
59
+ boxes: readonly Box[],
60
+ ): number | undefined => {
61
+ let box = boxes.find((b) => b.id == anchor.id)
62
+ return box && box.top + anchor.offset
63
+ }
64
+
65
+ /** The item and offset `by` past `at`, among `count` items of `size(index)`
66
+ * each, measured only as far as the walk goes: it stops at the list's first
67
+ * and last items. */
68
+ export let walk = (
69
+ at: { index: number; offset: number },
70
+ by: number,
71
+ size: (index: number) => number,
72
+ count: number,
73
+ ): { index: number; offset: number } => {
74
+ let index = at.index
75
+ let offset = Math.min(at.offset, size(index) - 1) + by
76
+ while (offset < 0 && index > 0) offset += size(--index)
77
+ offset = Math.max(0, offset)
78
+ while (offset >= size(index) && index < count - 1) offset -= size(index++)
79
+ return { index, offset: Math.max(0, Math.min(offset, size(index) - 1)) }
80
+ }
81
+
82
+ /** Whether a reader follows the end after their view moved from `was` to
83
+ * `now`: once they are at it, and no longer once they moved up from it. */
84
+ export let follows = (
85
+ follow: boolean,
86
+ { was, now, end }: { was: number; now: number; end: boolean },
87
+ ): boolean => end ? true : now < was ? false : follow
package/anchored.js ADDED
@@ -0,0 +1,180 @@
1
+ /**
2
+ * A list in a browser that stays where its reader left it while things load:
3
+ * where they are is an item and how far into it their view begins
4
+ * (./anchor.ts), so earlier items put above,
5
+ * an image or a code block above sizing in, a fold opening and items arriving
6
+ * below all leave the item they were reading where it was on the screen. A
7
+ * reader at the end follows it, and stays at it as items arrive and a reply
8
+ * grows, until they scroll up from it. A list whose newest come at its top
9
+ * (`edge: 'start'`) is followed at its top the same way. Items that arrive at
10
+ * the edge while the reader is away from it are unseen until they come back
11
+ * to it, those the owner says count (`counts`): a conversation counts the
12
+ * words written to its reader, not the steps taken meanwhile.
13
+ *
14
+ * It watches what the list holds (`content`) and the place that scrolls it
15
+ * (`pane`), and puts the reader back after every change, before it is
16
+ * painted. The browser's own scroll anchoring is turned off on the pane while
17
+ * it holds it, since the two would both move the reader. It draws nothing,
18
+ * and works on any list drawn into the page, by a renderer or by hand.
19
+ *
20
+ * @module
21
+ */ import { anchorAt, follows, rekey, topOf } from "./anchor.js";
22
+ /** The nearest place around `at` that scrolls, or the page. */ export let scroller = (at)=>{
23
+ let doc = at.ownerDocument;
24
+ let win = doc.defaultView;
25
+ for(let p = at.parentElement; p; p = p.parentElement){
26
+ let y = win?.getComputedStyle?.(p).overflowY;
27
+ if (y == 'auto' || y == 'scroll') return p;
28
+ }
29
+ return doc.scrollingElement ?? doc.documentElement;
30
+ };
31
+ /** Hold `pane`'s reader in place as its list changes. */ export let anchored = (pane, o)=>{
32
+ let doc = pane.ownerDocument;
33
+ let win = doc.defaultView;
34
+ let page = pane == (doc.scrollingElement ?? doc.documentElement);
35
+ let state = {
36
+ follow: o.follow ?? true
37
+ };
38
+ let ids = [];
39
+ let y = pane.scrollTop;
40
+ // Sliding to the edge: the end it slides to moves as the list grows.
41
+ let sliding = false;
42
+ let unseen = false;
43
+ let idle = ()=>o.idle?.() ?? false;
44
+ let key = o.key ?? ((row)=>row.id);
45
+ let start = o.edge == 'start';
46
+ let edge = ()=>!pane.clientHeight || (start ? pane.scrollTop <= 2 : pane.scrollTop + pane.clientHeight >= pane.scrollHeight - 2);
47
+ // Each item where it is, measured from the top of what the pane shows.
48
+ let laid = ()=>{
49
+ let top = page ? 0 : pane.getBoundingClientRect().top + pane.clientTop;
50
+ let boxes = [];
51
+ for (let el of o.rows()){
52
+ let id = key(el);
53
+ if (!id) continue;
54
+ let r = el.getBoundingClientRect();
55
+ boxes.push({
56
+ id,
57
+ top: r.top - top,
58
+ height: r.height
59
+ });
60
+ }
61
+ return boxes;
62
+ };
63
+ let see = (now)=>{
64
+ if (now == unseen) return;
65
+ unseen = now;
66
+ o.onUnseen?.(now);
67
+ };
68
+ // The list's ids are now `now`: any that came at the edge while the reader
69
+ // was away from it, past the ids they knew, may be unseen.
70
+ let known = (now)=>{
71
+ let was = new Set(ids);
72
+ let had = (id)=>was.has(id);
73
+ let first = start ? now.findLastIndex(had) : now.findIndex(had);
74
+ let came = new Set(first < 0 ? [] : now.filter((id, i)=>!had(id) && (start ? i < first : i > first)));
75
+ ids = now;
76
+ if (state.follow || unseen || !came.size) return;
77
+ let counts = o.counts ?? (()=>true);
78
+ for (let el of o.rows()){
79
+ let id = key(el);
80
+ if (id && came.has(id) && counts(el)) return see(true);
81
+ }
82
+ };
83
+ let follow = (now)=>{
84
+ if (!now) sliding = false;
85
+ else see(false);
86
+ if (now == state.follow) return;
87
+ state.follow = now;
88
+ o.onFollow?.(now);
89
+ };
90
+ let read = ()=>{
91
+ let boxes = laid();
92
+ state.anchor = anchorAt(boxes);
93
+ known(boxes.map((b)=>b.id));
94
+ y = pane.scrollTop;
95
+ };
96
+ let toEdge = (slide)=>{
97
+ let top = start ? 0 : pane.scrollHeight;
98
+ if (pane.scrollTo) {
99
+ pane.scrollTo({
100
+ top,
101
+ behavior: slide ? 'smooth' : 'instant'
102
+ });
103
+ } else pane.scrollTop = top;
104
+ sliding = slide;
105
+ y = pane.scrollTop;
106
+ };
107
+ let hold = ()=>{
108
+ if (idle()) return;
109
+ if (state.follow) {
110
+ if (!edge()) toEdge(sliding);
111
+ return;
112
+ }
113
+ if (!state.anchor) return read();
114
+ let boxes = laid();
115
+ let now = boxes.map((b)=>b.id);
116
+ state.anchor = rekey(state.anchor, ids, now);
117
+ known(now);
118
+ let by = state.anchor && topOf(state.anchor, boxes);
119
+ if (by && Math.abs(by) >= 1) pane.scrollTop += by;
120
+ y = pane.scrollTop;
121
+ };
122
+ let scrolled = ()=>{
123
+ if (idle()) return;
124
+ let now = pane.scrollTop;
125
+ let was = y;
126
+ let at = edge();
127
+ if (at) sliding = false;
128
+ // Where they are first: their owner may draw again when told they left
129
+ // the edge. A slide moves toward the edge; any move away leaves it.
130
+ read();
131
+ let way = start ? -1 : 1;
132
+ follow(follows(state.follow, {
133
+ was: was * way,
134
+ now: now * way,
135
+ end: at
136
+ }));
137
+ };
138
+ let heard = page ? doc : pane;
139
+ heard.addEventListener('scroll', scrolled, {
140
+ passive: true
141
+ });
142
+ let anchoring = pane.style.overflowAnchor;
143
+ pane.style.overflowAnchor = 'none';
144
+ let changes = win?.MutationObserver ? new win.MutationObserver(hold) : null;
145
+ changes?.observe(o.content, {
146
+ childList: true,
147
+ subtree: true,
148
+ characterData: true
149
+ });
150
+ let sizes = win?.ResizeObserver ? new win.ResizeObserver(hold) : null;
151
+ sizes?.observe(o.content);
152
+ if (!page) sizes?.observe(pane);
153
+ win?.addEventListener('resize', hold);
154
+ read();
155
+ hold();
156
+ return {
157
+ newest: (slide = false)=>{
158
+ if (idle()) return;
159
+ follow(true);
160
+ let smooth = slide && !!win?.matchMedia?.('(prefers-reduced-motion: no-preference)').matches;
161
+ toEdge(smooth);
162
+ },
163
+ read: (to)=>{
164
+ if (idle()) return;
165
+ read();
166
+ follow(to ?? edge());
167
+ },
168
+ hold,
169
+ follows: ()=>state.follow,
170
+ unseen: ()=>unseen,
171
+ stop: ()=>{
172
+ heard.removeEventListener('scroll', scrolled);
173
+ win?.removeEventListener('resize', hold);
174
+ changes?.disconnect();
175
+ sizes?.disconnect();
176
+ pane.style.overflowAnchor = anchoring;
177
+ }
178
+ };
179
+ };
180
+ //# sourceMappingURL=anchored.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchored.js","sources":["./anchored.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;CAoBC,GAED,SACE,QAAQ,EAER,OAAO,EACP,KAAK,EACL,KAAK,sBAEa;AAgDpB,6DAA6D,GAC7D,OAAO,IAAI,WAAW,CAAC;EACrB,IAAI,MAAM,GAAG,aAAa;EAC1B,IAAI,MAAM,IAAI,WAAW;EACzB,IAAK,IAAI,IAAI,GAAG,aAAa,EAAE,GAAG,IAAI,EAAE,aAAa,CAAE;IACrD,IAAI,IAAI,KAAK,mBAAmB,GAAG;IACnC,IAAI,KAAK,UAAU,KAAK,UAAU,OAAO;EAC3C;EACA,OAAQ,IAAI,gBAAgB,IAAI,IAAI,eAAe;AACrD,EAAC;AAED,uDAAuD,GACvD,OAAO,IAAI,WAAW,CAAC,MAAmB;EACxC,IAAI,MAAM,KAAK,aAAa;EAC5B,IAAI,MAAM,IAAI,WAAW;EACzB,IAAI,OAAO,QAAQ,CAAC,IAAI,gBAAgB,IAAI,IAAI,eAAe;EAC/D,IAAI,QAAuB;IAAE,QAAQ,EAAE,MAAM,IAAI;EAAK;EACtD,IAAI,MAAgB,EAAE;EACtB,IAAI,IAAI,KAAK,SAAS;EACtB,qEAAqE;EACrE,IAAI,UAAU;EACd,IAAI,SAAS;EACb,IAAI,OAAO,IAAM,EAAE,IAAI,QAAQ;EAC/B,IAAI,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,MAAiB,IAAI,EAAE;EAC5C,IAAI,QAAQ,EAAE,IAAI,IAAI;EACtB,IAAI,OAAO,IACT,CAAC,KAAK,YAAY,IAClB,CAAC,QACG,KAAK,SAAS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