spell-ui 0.8.15 → 0.8.17

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 (285) hide show
  1. package/README-components.md +4 -2
  2. package/README-runtime.md +26 -1
  3. package/README.md +2 -1
  4. package/dist/SliderScale-DunjyaDW.js +67 -0
  5. package/dist/SliderScale-DunjyaDW.js.map +1 -0
  6. package/dist/{ThemeDraft-CyX3YA_L.js → ThemeDraft-spaNC2dD.js} +2 -2
  7. package/dist/{ThemeDraft-CyX3YA_L.js.map → ThemeDraft-spaNC2dD.js.map} +1 -1
  8. package/dist/{UIInput-B3K0w4ow.js → UIInput-8s1aiaw1.js} +2 -2
  9. package/dist/UIInput-8s1aiaw1.js.map +1 -0
  10. package/dist/{UIRuntime-DCv4sy30.js → UIRuntime-BaokNnwk.js} +900 -158
  11. package/dist/UIRuntime-BaokNnwk.js.map +1 -0
  12. package/dist/_spell-element/UIComponent.d.ts +7 -0
  13. package/dist/_spell-element/elements.types.d.ts +6 -0
  14. package/dist/_spell-element/vocabulary.types.d.ts +27 -0
  15. package/dist/_util/dom.d.ts +7 -0
  16. package/dist/components/components.es.d.ts +1 -0
  17. package/dist/components/ui-dial/DialArc.d.ts +43 -0
  18. package/dist/components/ui-dial/UIDial.d.ts +263 -0
  19. package/dist/components/ui-dial/UIDial.en.d.ts +149 -0
  20. package/dist/components/ui-dial/UIDial.es.d.ts +25 -0
  21. package/dist/components/ui-dial/UIDial.fallback.d.ts +167 -0
  22. package/dist/components/ui-dial/UIDial.types.d.ts +11 -0
  23. package/dist/components/ui-dial/index.d.ts +3 -0
  24. package/dist/components/ui-graph/UIGraph.d.ts +17 -0
  25. package/dist/components/ui-graph/UIGraph.en.d.ts +17 -0
  26. package/dist/components/ui-graph/UIGraph.es.d.ts +6 -0
  27. package/dist/components/ui-input/UIInput.d.ts +46 -3
  28. package/dist/components/ui-input/UIInput.en.d.ts +6 -1
  29. package/dist/components/ui-input/UIInput.es.d.ts +1 -0
  30. package/dist/components/ui-input/UIInput.fallback.d.ts +6 -1
  31. package/dist/components/ui-json/UIJson.d.ts +5 -4
  32. package/dist/components/ui-modal/ChoiceRows.d.ts +61 -0
  33. package/dist/components/ui-modal/ModalDialogs.d.ts +15 -1
  34. package/dist/components/ui-modal/UIModal.d.ts +6 -2
  35. package/dist/components/ui-modal/UIModal.en.d.ts +6 -2
  36. package/dist/components/ui-modal/UIModal.es.d.ts +1 -0
  37. package/dist/components/ui-page-layout/UIPageLayout.d.ts +141 -8
  38. package/dist/components/ui-page-layout/UIPageLayout.en.d.ts +51 -2
  39. package/dist/components/ui-page-layout/UIPageLayout.es.d.ts +3 -0
  40. package/dist/components/ui-property-editor/UIProperty.d.ts +2 -2
  41. package/dist/components/ui-site-links/UISiteLinks.d.ts +124 -0
  42. package/dist/components/ui-site-links/UISiteLinks.en.d.ts +60 -0
  43. package/dist/components/ui-site-links/UISiteLinks.es.d.ts +26 -0
  44. package/dist/components/ui-site-links/index.d.ts +1 -0
  45. package/dist/components/ui-site-nav-button/UISiteNavButton.d.ts +12 -5
  46. package/dist/components/ui-site-nav-button/UISiteNavButton.en.d.ts +32 -12
  47. package/dist/components/ui-site-nav-button/UISiteNavButton.es.d.ts +3 -0
  48. package/dist/components/ui-site-tabs/UISiteTabs.d.ts +13 -0
  49. package/dist/components/ui-site-tabs/UISiteTabs.en.d.ts +9 -0
  50. package/dist/components/ui-slider/SliderScale.d.ts +26 -2
  51. package/dist/components/ui-slider/UISlider.d.ts +0 -2
  52. package/dist/components/ui-statistic/UIStatistic.d.ts +1 -0
  53. package/dist/components/ui-statistic/UIStatistic.en.d.ts +1 -0
  54. package/dist/components/ui-toc/TocIndex.d.ts +16 -1
  55. package/dist/components/ui-toc/UIToc.d.ts +27 -3
  56. package/dist/components/ui-toc/UIToc.en.d.ts +1 -1
  57. package/dist/components/ui-toc/UIToc.types.d.ts +5 -0
  58. package/dist/components/ui-tree/UITree.d.ts +38 -2
  59. package/dist/components/ui-tree/UITree.en.d.ts +9 -0
  60. package/dist/components/ui-tree/UITree.es.d.ts +4 -0
  61. package/dist/components/ui-uploader/UIUploader.d.ts +721 -0
  62. package/dist/components/ui-uploader/UIUploader.en.d.ts +394 -0
  63. package/dist/components/ui-uploader/UIUploader.es.d.ts +112 -0
  64. package/dist/components/ui-uploader/index.d.ts +1 -0
  65. package/dist/{components.es-DilRG1VO.js → components.es-jY2nBwuP.js} +249 -65
  66. package/dist/components.es-jY2nBwuP.js.map +1 -0
  67. package/dist/core.js +605 -571
  68. package/dist/core.js.map +1 -1
  69. package/dist/docs-components/docs-components.types.d.ts +2 -0
  70. package/dist/index.d.ts +3 -0
  71. package/dist/index.js +101 -97
  72. package/dist/jsx.d.ts +1138 -21
  73. package/dist/runtime/DataTooltips.d.ts +10 -0
  74. package/dist/runtime/Modals.d.ts +7 -2
  75. package/dist/runtime/Styles.d.ts +7 -1
  76. package/dist/runtime/UIRuntime.d.ts +6 -0
  77. package/dist/runtime/runtime.types.d.ts +26 -1
  78. package/dist/sound-library/back.ogg +0 -0
  79. package/dist/sound-library/beep.ogg +0 -0
  80. package/dist/sound-library/bell.ogg +0 -0
  81. package/dist/sound-library/big-punch.ogg +0 -0
  82. package/dist/sound-library/bong.ogg +0 -0
  83. package/dist/sound-library/book-close.ogg +0 -0
  84. package/dist/sound-library/book-down.ogg +0 -0
  85. package/dist/sound-library/book-open.ogg +0 -0
  86. package/dist/sound-library/card-fan-2.ogg +0 -0
  87. package/dist/sound-library/card-fan.ogg +0 -0
  88. package/dist/sound-library/card-place-2.ogg +0 -0
  89. package/dist/sound-library/card-place-3.ogg +0 -0
  90. package/dist/sound-library/card-place.ogg +0 -0
  91. package/dist/sound-library/card-shove-2.ogg +0 -0
  92. package/dist/sound-library/card-shove.ogg +0 -0
  93. package/dist/sound-library/card-slide-2.ogg +0 -0
  94. package/dist/sound-library/card-slide-3.ogg +0 -0
  95. package/dist/sound-library/card-slide-4.ogg +0 -0
  96. package/dist/sound-library/card-slide.ogg +0 -0
  97. package/dist/sound-library/chip-down-2.ogg +0 -0
  98. package/dist/sound-library/chip-down.ogg +0 -0
  99. package/dist/sound-library/chips-collide.ogg +0 -0
  100. package/dist/sound-library/chips-handle.ogg +0 -0
  101. package/dist/sound-library/chips-stack-2.ogg +0 -0
  102. package/dist/sound-library/chips-stack.ogg +0 -0
  103. package/dist/sound-library/chop.ogg +0 -0
  104. package/dist/sound-library/click-2.ogg +0 -0
  105. package/dist/sound-library/click-3.ogg +0 -0
  106. package/dist/sound-library/click.ogg +0 -0
  107. package/dist/sound-library/close.ogg +0 -0
  108. package/dist/sound-library/cloth.ogg +0 -0
  109. package/dist/sound-library/coins-2.ogg +0 -0
  110. package/dist/sound-library/coins.ogg +0 -0
  111. package/dist/sound-library/confirm-2.ogg +0 -0
  112. package/dist/sound-library/confirm.ogg +0 -0
  113. package/dist/sound-library/creak.ogg +0 -0
  114. package/dist/sound-library/deck-open.ogg +0 -0
  115. package/dist/sound-library/deck-take-out.ogg +0 -0
  116. package/dist/sound-library/dice-grab.ogg +0 -0
  117. package/dist/sound-library/dice-shake-2.ogg +0 -0
  118. package/dist/sound-library/dice-shake.ogg +0 -0
  119. package/dist/sound-library/dice-throw-2.ogg +0 -0
  120. package/dist/sound-library/dice-throw.ogg +0 -0
  121. package/dist/sound-library/die-throw-2.ogg +0 -0
  122. package/dist/sound-library/die-throw.ogg +0 -0
  123. package/dist/sound-library/door-close.ogg +0 -0
  124. package/dist/sound-library/door-open.ogg +0 -0
  125. package/dist/sound-library/drop.ogg +0 -0
  126. package/dist/sound-library/error-2.ogg +0 -0
  127. package/dist/sound-library/error.ogg +0 -0
  128. package/dist/sound-library/fail.ogg +0 -0
  129. package/dist/sound-library/fall.ogg +0 -0
  130. package/dist/sound-library/glass-break.ogg +0 -0
  131. package/dist/sound-library/glass-clink.ogg +0 -0
  132. package/dist/sound-library/glass-tap.ogg +0 -0
  133. package/dist/sound-library/glass.ogg +0 -0
  134. package/dist/sound-library/glitch.ogg +0 -0
  135. package/dist/sound-library/grow.ogg +0 -0
  136. package/dist/sound-library/high-up.ogg +0 -0
  137. package/dist/sound-library/hover-2.ogg +0 -0
  138. package/dist/sound-library/hover.ogg +0 -0
  139. package/dist/sound-library/jingle-2.ogg +0 -0
  140. package/dist/sound-library/jingle-3.ogg +0 -0
  141. package/dist/sound-library/jingle-4.ogg +0 -0
  142. package/dist/sound-library/jingle.ogg +0 -0
  143. package/dist/sound-library/jump.ogg +0 -0
  144. package/dist/sound-library/knife-draw.ogg +0 -0
  145. package/dist/sound-library/knife-slice.ogg +0 -0
  146. package/dist/sound-library/laser-2.ogg +0 -0
  147. package/dist/sound-library/laser.ogg +0 -0
  148. package/dist/sound-library/latch.ogg +0 -0
  149. package/dist/sound-library/level-up.ogg +0 -0
  150. package/dist/sound-library/lose-2.ogg +0 -0
  151. package/dist/sound-library/lose-3.ogg +0 -0
  152. package/dist/sound-library/lose-4.ogg +0 -0
  153. package/dist/sound-library/lose.ogg +0 -0
  154. package/dist/sound-library/low-down.ogg +0 -0
  155. package/dist/sound-library/metal-clang.ogg +0 -0
  156. package/dist/sound-library/metal-click.ogg +0 -0
  157. package/dist/sound-library/metal-crash.ogg +0 -0
  158. package/dist/sound-library/metal-tap.ogg +0 -0
  159. package/dist/sound-library/mouse-click.ogg +0 -0
  160. package/dist/sound-library/mouse-release.ogg +0 -0
  161. package/dist/sound-library/open.ogg +0 -0
  162. package/dist/sound-library/orchestra-hit-2.ogg +0 -0
  163. package/dist/sound-library/orchestra-hit.ogg +0 -0
  164. package/dist/sound-library/page-turn-2.ogg +0 -0
  165. package/dist/sound-library/page-turn.ogg +0 -0
  166. package/dist/sound-library/pickaxe.ogg +0 -0
  167. package/dist/sound-library/piece-down-2.ogg +0 -0
  168. package/dist/sound-library/piece-down-3.ogg +0 -0
  169. package/dist/sound-library/piece-down.ogg +0 -0
  170. package/dist/sound-library/piece-take-2.ogg +0 -0
  171. package/dist/sound-library/piece-take.ogg +0 -0
  172. package/dist/sound-library/piece-tap-2.ogg +0 -0
  173. package/dist/sound-library/piece-tap.ogg +0 -0
  174. package/dist/sound-library/plank.ogg +0 -0
  175. package/dist/sound-library/plate.ogg +0 -0
  176. package/dist/sound-library/pluck.ogg +0 -0
  177. package/dist/sound-library/pot.ogg +0 -0
  178. package/dist/sound-library/power-up-2.ogg +0 -0
  179. package/dist/sound-library/power-up-3.ogg +0 -0
  180. package/dist/sound-library/power-up.ogg +0 -0
  181. package/dist/sound-library/punch.ogg +0 -0
  182. package/dist/sound-library/question.ogg +0 -0
  183. package/dist/sound-library/rise.ogg +0 -0
  184. package/dist/sound-library/scratch.ogg +0 -0
  185. package/dist/sound-library/scroll.ogg +0 -0
  186. package/dist/sound-library/select-2.ogg +0 -0
  187. package/dist/sound-library/select.ogg +0 -0
  188. package/dist/sound-library/shrink.ogg +0 -0
  189. package/dist/sound-library/shuffle.ogg +0 -0
  190. package/dist/sound-library/soft-thud-2.ogg +0 -0
  191. package/dist/sound-library/soft-thud.ogg +0 -0
  192. package/dist/sound-library/space-junk.ogg +0 -0
  193. package/dist/sound-library/step-2.ogg +0 -0
  194. package/dist/sound-library/step-on-carpet.ogg +0 -0
  195. package/dist/sound-library/step-on-grass.ogg +0 -0
  196. package/dist/sound-library/step-on-snow.ogg +0 -0
  197. package/dist/sound-library/step-on-stone.ogg +0 -0
  198. package/dist/sound-library/step-on-wood.ogg +0 -0
  199. package/dist/sound-library/step.ogg +0 -0
  200. package/dist/sound-library/switch-2.ogg +0 -0
  201. package/dist/sound-library/switch.ogg +0 -0
  202. package/dist/sound-library/tap-2.ogg +0 -0
  203. package/dist/sound-library/tap.ogg +0 -0
  204. package/dist/sound-library/three-tones.ogg +0 -0
  205. package/dist/sound-library/tick-2.ogg +0 -0
  206. package/dist/sound-library/tick.ogg +0 -0
  207. package/dist/sound-library/tin.ogg +0 -0
  208. package/dist/sound-library/toggle-2.ogg +0 -0
  209. package/dist/sound-library/toggle.ogg +0 -0
  210. package/dist/sound-library/two-tones.ogg +0 -0
  211. package/dist/sound-library/win-2.ogg +0 -0
  212. package/dist/sound-library/win-3.ogg +0 -0
  213. package/dist/sound-library/win-4.ogg +0 -0
  214. package/dist/sound-library/win.ogg +0 -0
  215. package/dist/sound-library/wood-thud.ogg +0 -0
  216. package/dist/sound-library/zap.ogg +0 -0
  217. package/dist/sounds/BuiltInSounds.d.ts +41 -0
  218. package/dist/sounds/index.d.ts +9 -0
  219. package/dist/sounds/sounds.types.d.ts +22 -0
  220. package/dist/ui-calendar.js +1 -1
  221. package/dist/ui-dial.editor-CjjdKi5L.js +5 -0
  222. package/dist/ui-dial.editor-CjjdKi5L.js.map +1 -0
  223. package/dist/ui-dial.js +467 -0
  224. package/dist/ui-dial.js.map +1 -0
  225. package/dist/ui-graph.js +22 -0
  226. package/dist/ui-graph.js.map +1 -1
  227. package/dist/{ui-input.editor-budoNoB0.js → ui-input.editor-D11iRgXR.js} +2 -2
  228. package/dist/ui-input.editor-D11iRgXR.js.map +1 -0
  229. package/dist/ui-input.js +84 -54
  230. package/dist/ui-input.js.map +1 -1
  231. package/dist/ui-json.js +8 -8
  232. package/dist/ui-json.js.map +1 -1
  233. package/dist/ui-modal.js +183 -97
  234. package/dist/ui-modal.js.map +1 -1
  235. package/dist/ui-page-layout.editor-IgDEveUY.js +5 -0
  236. package/dist/ui-page-layout.editor-IgDEveUY.js.map +1 -0
  237. package/dist/ui-page-layout.js +217 -72
  238. package/dist/ui-page-layout.js.map +1 -1
  239. package/dist/ui-popup.js +34 -34
  240. package/dist/ui-popup.js.map +1 -1
  241. package/dist/ui-property-editor.js +7 -4
  242. package/dist/ui-property-editor.js.map +1 -1
  243. package/dist/ui-root.js +71 -5
  244. package/dist/ui-root.js.map +1 -1
  245. package/dist/ui-search.js +1 -1
  246. package/dist/ui-section.js +97 -96
  247. package/dist/ui-section.js.map +1 -1
  248. package/dist/ui-site-links.editor-BME3sw5H.js +5 -0
  249. package/dist/ui-site-links.editor-BME3sw5H.js.map +1 -0
  250. package/dist/ui-site-links.js +150 -0
  251. package/dist/ui-site-links.js.map +1 -0
  252. package/dist/ui-site-nav-button.editor-ChY4xe1U.js +5 -0
  253. package/dist/ui-site-nav-button.editor-ChY4xe1U.js.map +1 -0
  254. package/dist/ui-site-nav-button.js +57 -18
  255. package/dist/ui-site-nav-button.js.map +1 -1
  256. package/dist/{ui-site-tabs.editor-DDvQfH6S.js → ui-site-tabs.editor-CdMIw4jw.js} +2 -2
  257. package/dist/ui-site-tabs.editor-CdMIw4jw.js.map +1 -0
  258. package/dist/ui-site-tabs.js +30 -14
  259. package/dist/ui-site-tabs.js.map +1 -1
  260. package/dist/ui-slider.js +75 -124
  261. package/dist/ui-slider.js.map +1 -1
  262. package/dist/ui-statistic.js +1 -0
  263. package/dist/ui-statistic.js.map +1 -1
  264. package/dist/ui-theme-editor.js +2 -2
  265. package/dist/{ui-theme-menu-BZYUMrHe.js → ui-theme-menu-BEBu6dyq.js} +3 -3
  266. package/dist/{ui-theme-menu-BZYUMrHe.js.map → ui-theme-menu-BEBu6dyq.js.map} +1 -1
  267. package/dist/ui-toc.js +159 -122
  268. package/dist/ui-toc.js.map +1 -1
  269. package/dist/ui-tree.js +142 -87
  270. package/dist/ui-tree.js.map +1 -1
  271. package/dist/ui-uploader.editor-DrE80KjL.js +5 -0
  272. package/dist/ui-uploader.editor-DrE80KjL.js.map +1 -0
  273. package/dist/ui-uploader.js +1442 -0
  274. package/dist/ui-uploader.js.map +1 -0
  275. package/dist/vocabulary/hooks.generated.d.ts +7 -0
  276. package/package.json +1 -1
  277. package/dist/UIInput-B3K0w4ow.js.map +0 -1
  278. package/dist/UIRuntime-DCv4sy30.js.map +0 -1
  279. package/dist/components.es-DilRG1VO.js.map +0 -1
  280. package/dist/ui-input.editor-budoNoB0.js.map +0 -1
  281. package/dist/ui-page-layout.editor-xtQW0FZk.js +0 -5
  282. package/dist/ui-page-layout.editor-xtQW0FZk.js.map +0 -1
  283. package/dist/ui-site-nav-button.editor-6J-zJLtZ.js +0 -5
  284. package/dist/ui-site-nav-button.editor-6J-zJLtZ.js.map +0 -1
  285. package/dist/ui-site-tabs.editor-DDvQfH6S.js.map +0 -1
@@ -0,0 +1,721 @@
1
+ import { JSX } from '@solidjs/web';
2
+ import { E } from 'spell/ui/core';
3
+ import { uploaderVocabulary } from './UIUploader.en';
4
+ /****************
5
+ * ### `DOMUploaderElement`
6
+ * The `<ui-uploader>` in the page: a few members of script API over its component.
7
+ ****************/
8
+ export declare class DOMUploaderElement extends E.DOMElement<UIUploader> {
9
+ /** The files it holds now, kept or turned away, in the order they came. */
10
+ get files(): File[];
11
+ /** Open the file dialog, as its button does. The browser opens it only from a person's click or key. */
12
+ open(): void;
13
+ /** Forget every file it holds, stopping any post still going. */
14
+ clear(): void;
15
+ }
16
+ /****************
17
+ * ### `<ui-uploader>`
18
+ * The component behind `<ui-uploader>`: takes files someone picks or drops, or whole folders,
19
+ * then posts them to its `destination`, or hands them to its `action` (epic `from-jarvis` P9).
20
+ *
21
+ * - What happens when files come in, picked in the file dialog or dropped (`take()`):
22
+ * 1. Each is checked: a kind it doesn't take, too big, or past the count is turned away, with its reason.
23
+ * 2. `ui-file-dropping` (cancel to leave it out), then `ui-file-dropped`, for each;
24
+ * a `folder` uploader sends `ui-folder-dropping` / `-dropped` for each folder first, then its files'.
25
+ * 3. `ui-uploading`, with the files kept: a handler that cancels it takes the upload over.
26
+ * 4. `action` set: it's called with them. Else `destination` set: each file is posted there, one request each,
27
+ * so each row shows its own progress and failure. Neither: it only holds them.
28
+ * - The events are the same for a pick as for a drop: their detail's `via` says which.
29
+ * - Four looks, `appearance`, each drawn from Spell UI's own elements:
30
+ * - `hero`: a placeholder `<ui-segment>` as its drop area, a row per file under it
31
+ * (a `<ui-list>`, a `<ui-item>` per file)
32
+ * - `button`: a `<ui-button>`, its file rows in a `<ui-popup>`: a glimpse as an upload starts,
33
+ * then on hover or focus
34
+ * - `input`: a read-only `<ui-input>` with a Browse `<ui-button>` joined to it, its rows under it
35
+ * - `compact`: a one-line drop area, a line of status and one `<ui-progress>` for every file
36
+ * - `drop-zone`: a drop elsewhere counts too (`page`, a selector, an element); `DropZones` decides which uploader.
37
+ * - The file dialog is the browser's: a hidden `<ui-input type="file">` opens it (`openDialog()`),
38
+ * for every look, with its `showPicker()`; its `folder` picks folders.
39
+ * - Posting is `XMLHttpRequest`'s: `fetch()` can't tell how far an upload has got.
40
+ * A failure is an `ApiError`, the same shape `UI.api` throws.
41
+ * - NEVER imports Spell's own words: the bridge into Spell's events is the parser's core's (Q14).
42
+ ****************/
43
+ export declare class UIUploader extends E.UIComponent<typeof uploaderVocabulary> {
44
+ static vocabulary: {
45
+ readonly tag: "ui-uploader";
46
+ readonly icon: "cloud upload";
47
+ readonly snippet: "<ui-uploader extensions=\"json\" multiple></ui-uploader>";
48
+ readonly topics: readonly ["forms", "inputs", "controls", "progress"];
49
+ readonly aka: readonly ["file upload", "file uploader", "upload", "dropzone", "drop zone", "file drop", "file picker", "drag and drop", "attachment"];
50
+ readonly noun: "uploader";
51
+ readonly partOfSpeech: "action";
52
+ readonly description: string;
53
+ readonly skeleton: "18 x 9";
54
+ readonly attributes: readonly [{
55
+ readonly name: "appearance";
56
+ readonly group: "appearance";
57
+ readonly kind: "enum";
58
+ readonly values: readonly ["hero", "button", "input", "compact"];
59
+ readonly default: "hero";
60
+ readonly description: string;
61
+ }, {
62
+ readonly name: "destination";
63
+ readonly group: "behaviour";
64
+ readonly kind: "string";
65
+ readonly description: string;
66
+ }, {
67
+ readonly name: "action";
68
+ readonly group: "behaviour";
69
+ readonly kind: "json";
70
+ readonly description: string;
71
+ }, {
72
+ readonly name: "extensions";
73
+ readonly group: "behaviour";
74
+ readonly kind: "string";
75
+ readonly description: string;
76
+ }, {
77
+ readonly name: "multiple";
78
+ readonly group: "behaviour";
79
+ readonly kind: "boolean";
80
+ readonly description: "Takes more than one file at a time.";
81
+ }, {
82
+ readonly name: "folder";
83
+ readonly group: "behaviour";
84
+ readonly kind: "boolean";
85
+ readonly description: string;
86
+ }, {
87
+ readonly name: "max-size";
88
+ readonly group: "behaviour";
89
+ readonly kind: "string";
90
+ readonly description: "The largest file it takes: `2 MB`, `500 KB`, `1.5 GB`, or a number of bytes.";
91
+ }, {
92
+ readonly name: "max-files";
93
+ readonly group: "behaviour";
94
+ readonly kind: "number";
95
+ readonly description: "The most files it takes in one go; the rest are turned away.";
96
+ }, {
97
+ readonly name: "drop-zone";
98
+ readonly group: "behaviour";
99
+ readonly kind: "json";
100
+ readonly description: string;
101
+ }, {
102
+ readonly name: "message";
103
+ readonly group: "content";
104
+ readonly kind: "string";
105
+ readonly description: string;
106
+ }, {
107
+ readonly name: "drop-message";
108
+ readonly group: "content";
109
+ readonly kind: "string";
110
+ readonly description: "What it says while files are dragged over it: `{count}` is how many. None: `Drop to add {count} files`.";
111
+ }, {
112
+ readonly name: "uploading-message";
113
+ readonly group: "content";
114
+ readonly kind: "string";
115
+ readonly description: string;
116
+ }, {
117
+ readonly name: "done-message";
118
+ readonly group: "content";
119
+ readonly kind: "string";
120
+ readonly description: "What it says once they're all posted: `{count}` is how many. None: `{count} files uploaded`.";
121
+ }];
122
+ readonly events: readonly [{
123
+ readonly name: "ui-file-dragged-over";
124
+ readonly detail: "{ count: number, kinds: string[], via: \"drop\" | \"zone\" }";
125
+ readonly description: "Files are dragged over it, or over its `drop-zone`: how many, and their kinds.";
126
+ }, {
127
+ readonly name: "ui-file-dragged-out";
128
+ readonly detail: "{ count: number, kinds: string[], via: \"drop\" | \"zone\" }";
129
+ readonly description: "The files dragged over it left without being dropped.";
130
+ }, {
131
+ readonly name: "ui-folder-dragged-over";
132
+ readonly detail: "{ count: number, kinds: string[], via: \"drop\" | \"zone\" }";
133
+ readonly description: "With `folder`: `ui-file-dragged-over`'s twin. While dragging, a browser can't tell a folder from a file.";
134
+ }, {
135
+ readonly name: "ui-folder-dragged-out";
136
+ readonly detail: "{ count: number, kinds: string[], via: \"drop\" | \"zone\" }";
137
+ readonly description: "With `folder`: `ui-file-dragged-out`'s twin.";
138
+ }, {
139
+ readonly name: "ui-file-dropping";
140
+ readonly cancelable: true;
141
+ readonly detail: string;
142
+ readonly description: string;
143
+ }, {
144
+ readonly name: "ui-file-dropped";
145
+ readonly detail: string;
146
+ readonly description: string;
147
+ }, {
148
+ readonly name: "ui-folder-dropping";
149
+ readonly cancelable: true;
150
+ readonly detail: string;
151
+ readonly description: "With `folder`: a folder is about to be taken, with its files: cancel it to leave it all out.";
152
+ }, {
153
+ readonly name: "ui-folder-dropped";
154
+ readonly detail: string;
155
+ readonly description: "With `folder`: a folder was taken; a `ui-file-dropped` follows for each file in it.";
156
+ }, {
157
+ readonly name: "ui-uploading";
158
+ readonly cancelable: true;
159
+ readonly detail: "{ files: File[] }";
160
+ readonly description: string;
161
+ }, {
162
+ readonly name: "ui-upload-progress";
163
+ readonly detail: "{ file: File, sent: number, size: number }";
164
+ readonly description: "While a file posts: how many bytes have gone, of its size.";
165
+ }, {
166
+ readonly name: "ui-uploaded";
167
+ readonly detail: "{ file: File, response: unknown }";
168
+ readonly description: string;
169
+ }, {
170
+ readonly name: "ui-upload-failed";
171
+ readonly detail: "{ file: File, error: Error }";
172
+ readonly description: "A file couldn't be posted, or the `action` threw: `error` says why.";
173
+ }];
174
+ readonly slots: readonly [{
175
+ readonly name: "icon";
176
+ readonly description: "Its icon, in place of its own cloud.";
177
+ }, {
178
+ readonly name: "message";
179
+ readonly description: "Its line of help, in place of `message`.";
180
+ }, {
181
+ readonly name: "button";
182
+ readonly description: "Its button (Choose files, Browse), in place of its own: a click opens the file dialog.";
183
+ }];
184
+ readonly parts: readonly [{
185
+ readonly name: "drop-area";
186
+ readonly description: "The area files are dropped on: the hero's and compact's dashed box.";
187
+ }, {
188
+ readonly name: "button";
189
+ readonly description: "The button that opens the file dialog: a `<ui-button>`.";
190
+ }, {
191
+ readonly name: "input";
192
+ readonly description: "With `appearance=\"input\"`: the field, a `<ui-input>`.";
193
+ }, {
194
+ readonly name: "files";
195
+ readonly description: "The list of files taken.";
196
+ }, {
197
+ readonly name: "file";
198
+ readonly description: "A file's row.";
199
+ }, {
200
+ readonly name: "name";
201
+ readonly description: "A file's name.";
202
+ }, {
203
+ readonly name: "size";
204
+ readonly description: "A file's size.";
205
+ }, {
206
+ readonly name: "progress";
207
+ readonly description: "A file's progress bar, a `<ui-progress>`; compact's one bar for all.";
208
+ }, {
209
+ readonly name: "status";
210
+ readonly description: "A file's status: a tick, or the reason it failed; compact's line of status.";
211
+ }, {
212
+ readonly name: "remove";
213
+ readonly description: "A file's Remove button.";
214
+ }, {
215
+ readonly name: "popup";
216
+ readonly description: "With `appearance=\"button\"`: the popup of file rows, a `<ui-popup>`.";
217
+ }, {
218
+ readonly name: "zone";
219
+ readonly description: "The light overlay over its `drop-zone` while files are dragged over it.";
220
+ }];
221
+ readonly states: readonly [{
222
+ readonly name: "dragged-over";
223
+ readonly description: "Files are dragged over it, or its `drop-zone`.";
224
+ }, {
225
+ readonly name: "uploading";
226
+ readonly description: "It's posting files, or its `action` is running.";
227
+ }, {
228
+ readonly name: "hero";
229
+ readonly description: "It's `appearance=\"hero\"`.";
230
+ }, {
231
+ readonly name: "button";
232
+ readonly description: "It's `appearance=\"button\"`.";
233
+ }, {
234
+ readonly name: "input";
235
+ readonly description: "It's `appearance=\"input\"`.";
236
+ }, {
237
+ readonly name: "compact";
238
+ readonly description: "It's `appearance=\"compact\"`.";
239
+ }];
240
+ readonly texts: readonly [{
241
+ readonly key: "message";
242
+ readonly text: "Drop {kinds} files here, or";
243
+ readonly description: "The hero's line of help: `{kinds}`, `.json`.";
244
+ }, {
245
+ readonly key: "messageAny";
246
+ readonly text: "Drop files here, or";
247
+ readonly description: "The hero's line of help, taking any file.";
248
+ }, {
249
+ readonly key: "messageFolders";
250
+ readonly text: "Drop folders here, or";
251
+ readonly description: "The hero's line of help, with `folder`.";
252
+ }, {
253
+ readonly key: "compactMessage";
254
+ readonly text: "Drop {kinds} files, or";
255
+ readonly description: "compact's line of help.";
256
+ }, {
257
+ readonly key: "compactMessageAny";
258
+ readonly text: "Drop files, or";
259
+ readonly description: "compact's line of help, taking any file.";
260
+ }, {
261
+ readonly key: "compactMessageFolders";
262
+ readonly text: "Drop folders, or";
263
+ readonly description: "compact's line of help, with `folder`.";
264
+ }, {
265
+ readonly key: "buttonLabel";
266
+ readonly text: "Upload {kinds} files";
267
+ readonly description: "A `button` uploader's label.";
268
+ }, {
269
+ readonly key: "buttonLabelAny";
270
+ readonly text: "Upload files";
271
+ readonly description: "A `button` uploader's label, taking any file.";
272
+ }, {
273
+ readonly key: "buttonLabelFolders";
274
+ readonly text: "Upload folders";
275
+ readonly description: "A `button` uploader's label, with `folder`.";
276
+ }, {
277
+ readonly key: "choose";
278
+ readonly text: "Choose files…";
279
+ readonly description: "The hero's button.";
280
+ }, {
281
+ readonly key: "chooseFolders";
282
+ readonly text: "Choose folders…";
283
+ readonly description: "The hero's button, with `folder`.";
284
+ }, {
285
+ readonly key: "chooseShort";
286
+ readonly text: "Choose";
287
+ readonly description: "compact's small button.";
288
+ }, {
289
+ readonly key: "browse";
290
+ readonly text: "Browse…";
291
+ readonly description: "The `input` look's button.";
292
+ }, {
293
+ readonly key: "noFiles";
294
+ readonly text: "No files chosen";
295
+ readonly description: "The `input` look's field, empty.";
296
+ }, {
297
+ readonly key: "fileCount";
298
+ readonly text: "{count} files";
299
+ readonly description: "The `input` look's field: how many files.";
300
+ }, {
301
+ readonly key: "fileCountDone";
302
+ readonly text: "{count} files: {done} uploaded";
303
+ readonly description: "The `input` look's field, once some are up.";
304
+ }, {
305
+ readonly key: "dropMessage";
306
+ readonly text: "Drop to add {count} files";
307
+ readonly description: "While files are dragged over it.";
308
+ }, {
309
+ readonly key: "dropMessageOne";
310
+ readonly text: "Drop to add 1 file";
311
+ readonly description: "While one file is dragged over it.";
312
+ }, {
313
+ readonly key: "uploadingMessage";
314
+ readonly text: "Uploading {done} of {count}";
315
+ readonly description: "While it posts.";
316
+ }, {
317
+ readonly key: "doneMessage";
318
+ readonly text: "{count} files uploaded";
319
+ readonly description: "Once they're all posted.";
320
+ }, {
321
+ readonly key: "doneMessageOne";
322
+ readonly text: "1 file uploaded";
323
+ readonly description: "Once the one file is posted.";
324
+ }, {
325
+ readonly key: "limitsFiles";
326
+ readonly text: "Up to {count} files";
327
+ readonly description: "Its limits: the count.";
328
+ }, {
329
+ readonly key: "limitsBoth";
330
+ readonly text: "Up to {count} files, {size} each";
331
+ readonly description: "Its limits: the count and the size.";
332
+ }, {
333
+ readonly key: "limitsSizeOnly";
334
+ readonly text: "Up to {size}";
335
+ readonly description: "Its limits: the size alone.";
336
+ }, {
337
+ readonly key: "turnedAway";
338
+ readonly text: "{count} files not added";
339
+ readonly description: "How many were turned away.";
340
+ }, {
341
+ readonly key: "turnedAwayOne";
342
+ readonly text: "1 file not added";
343
+ readonly description: "One was turned away.";
344
+ }, {
345
+ readonly key: "uploaded";
346
+ readonly text: "Uploaded";
347
+ readonly description: "A row's status, posted.";
348
+ }, {
349
+ readonly key: "taken";
350
+ readonly text: "Done";
351
+ readonly description: "A row's status, handed to the `action`.";
352
+ }, {
353
+ readonly key: "held";
354
+ readonly text: "Ready";
355
+ readonly description: "A row's status, held: no `destination` or `action`.";
356
+ }, {
357
+ readonly key: "uploading";
358
+ readonly text: "Uploading";
359
+ readonly description: "What a screen reader calls a row's progress bar.";
360
+ }, {
361
+ readonly key: "failed";
362
+ readonly text: "Failed: {reason}";
363
+ readonly description: "A row's status, failed.";
364
+ }, {
365
+ readonly key: "serverError";
366
+ readonly text: "server error {status}";
367
+ readonly description: "Why a post failed: the server's answer.";
368
+ }, {
369
+ readonly key: "noConnection";
370
+ readonly text: "no connection";
371
+ readonly description: "Why a post failed: nothing answered.";
372
+ }, {
373
+ readonly key: "tooBig";
374
+ readonly text: "Too big";
375
+ readonly description: "Why a file was turned away: its size, in its row.";
376
+ }, {
377
+ readonly key: "tooBigLong";
378
+ readonly text: "This file is too big, so it wasn't added. Choose a file that's {size} or smaller.";
379
+ readonly description: "Why a file was turned away: its size, in full (its row's tooltip).";
380
+ }, {
381
+ readonly key: "wrongKind";
382
+ readonly text: "Not a {kinds} file";
383
+ readonly description: "Why a file was turned away: its kind, in its row.";
384
+ }, {
385
+ readonly key: "wrongKindLong";
386
+ readonly text: "Only {kinds} files can be uploaded. Choose a file that ends in {kinds}.";
387
+ readonly description: "Why a file was turned away: its kind, in full (its row's tooltip).";
388
+ }, {
389
+ readonly key: "tooMany";
390
+ readonly text: "Too many files";
391
+ readonly description: "Why a file was turned away: the count, in its row.";
392
+ }, {
393
+ readonly key: "tooManyLong";
394
+ readonly text: "This file wasn't added: up to {count} files can be added at once. Remove one, then add this file again.";
395
+ readonly description: "Why a file was turned away: the count, in full (its row's tooltip).";
396
+ }, {
397
+ readonly key: "oneOnly";
398
+ readonly text: "Only one file";
399
+ readonly description: "Why a second file was turned away, without `multiple`, in its row.";
400
+ }, {
401
+ readonly key: "oneOnlyLong";
402
+ readonly text: "This file wasn't added: one file can be added at a time. Remove the other file, then add this one again.";
403
+ readonly description: "Why a second file was turned away, without `multiple`, in full (its row's tooltip).";
404
+ }, {
405
+ readonly key: "notAFolder";
406
+ readonly text: "Not a folder";
407
+ readonly description: "Why a plain file was turned away by a `folder` uploader, in its row.";
408
+ }, {
409
+ readonly key: "notAFolderLong";
410
+ readonly text: "Only folders can be added here. Choose a folder.";
411
+ readonly description: "Why a plain file was turned away by a `folder` uploader, in full (its row's tooltip).";
412
+ }, {
413
+ readonly key: "aFolder";
414
+ readonly text: "A folder";
415
+ readonly description: "Why a folder was turned away by a plain uploader, in its row.";
416
+ }, {
417
+ readonly key: "aFolderLong";
418
+ readonly text: "Folders can't be added here. Choose files instead.";
419
+ readonly description: "Why a folder was turned away by a plain uploader, in full (its row's tooltip).";
420
+ }, {
421
+ readonly key: "remove";
422
+ readonly text: "Remove";
423
+ readonly description: "A row's Remove button's name and tooltip.";
424
+ }, {
425
+ readonly key: "files";
426
+ readonly text: "Files";
427
+ readonly description: "What a screen reader calls the list of files.";
428
+ }];
429
+ };
430
+ static elementSetup: {
431
+ styleSheets: {
432
+ uploader: string;
433
+ };
434
+ DOMElement: typeof DOMUploaderElement;
435
+ };
436
+ /** Its look: `hero` unless it says otherwise. */
437
+ get look(): Appearance;
438
+ /** Its states: its look, a drag over it, a post going on. */
439
+ protected cssStates(): {
440
+ hero: boolean;
441
+ button: boolean;
442
+ input: boolean;
443
+ compact: boolean;
444
+ "dragged-over": boolean;
445
+ uploading: boolean;
446
+ };
447
+ /** The extensions it takes, without their dots: `["json", "csv"]`; empty, any. */
448
+ get kinds(): string[];
449
+ /** The kinds for people: `.json`, `.json, .csv`. */
450
+ get kindsText(): string;
451
+ /** The file input's `accept`: `.json,.csv`. */
452
+ private get accept();
453
+ /** The largest file it takes, in bytes; `undefined`, any size. */
454
+ get largest(): number | undefined;
455
+ /** Why `file` would be turned away, before the count: its kind or its size; `undefined`, it's fine. */
456
+ private reasonFor;
457
+ /** Why a file is turned away: its row's short words, and the full sentence for its tooltip. */
458
+ private refusal;
459
+ /** `max-size` for people: `2 MB`. */
460
+ private get maxSizeText();
461
+ /** Its limits, under the hero's button: `Up to 5 files, 2 MB each`; empty for none. */
462
+ get limitsText(): string;
463
+ /** `bytes` for people: `96 KB`, `1.2 MB`. */
464
+ sizeText(bytes: number): string;
465
+ /** A row per file taken, kept or turned away, in the order they came. */
466
+ accessor rows: readonly FileRow[];
467
+ /** The rows of the files kept: not turned away. */
468
+ get keptRows(): FileRow[];
469
+ /** How many are posted, or handed to the action. */
470
+ get doneCount(): number;
471
+ /** How many were turned away. */
472
+ get turnedAwayCount(): number;
473
+ /** Is a post going on, or the action running? */
474
+ get isUploading(): boolean;
475
+ /** How far every file kept has got, 0 to 100: compact's one bar. */
476
+ get overallPercent(): number;
477
+ /** Change the row `id` (a new record, so its `<For>` row redraws). */
478
+ private changeRow;
479
+ /** The row `id`, as it is now. */
480
+ private rowFor;
481
+ /** Remove a row, stopping its post if it's still going. */
482
+ remove(id: number): void;
483
+ /** Forget every file, stopping every post still going. */
484
+ clear(): void;
485
+ /**
486
+ * Take what came in: check each file, send the events before and after, add the rows, then upload.
487
+ * - SIDE EFFECT: without `multiple`, what it held before is replaced.
488
+ * - NEVER throws: a post that fails shows on its row.
489
+ */
490
+ take(arrival: Arrival): Promise<void>;
491
+ /** A folder turned away by a plain uploader, as a file for its row. */
492
+ private static folderAsFile;
493
+ /** A file's events' detail. */
494
+ private static fileDetail;
495
+ /** A folder's events' detail. */
496
+ private static folderDetail;
497
+ /** The posts going on, by row id: each one's request, to stop it. */
498
+ private readonly requests;
499
+ /** Have both `action` and `destination` been warned about? */
500
+ private warnedBoth;
501
+ /**
502
+ * `ui-uploading`, then the action, the posts, or nothing.
503
+ * - A cancelled `ui-uploading`, or neither set: the rows are held.
504
+ */
505
+ private upload;
506
+ /** Hand the files to the action: every row done when it's done, or failed with what it threw. */
507
+ private callAction;
508
+ /**
509
+ * Post one file to `destination`, as form data: its row follows how far it's got.
510
+ * - NEVER throws: a failure shows on its row, and in `ui-upload-failed`.
511
+ */
512
+ private post;
513
+ /** A post answered: OK, `ui-uploaded` with the answer; else failed, an `ApiError` as `UI.api` throws. */
514
+ private posted;
515
+ /** A post failed: its row says why, and `ui-upload-failed`. */
516
+ private failed;
517
+ /** A server's answer: JSON when it says so (and parses), else its text. */
518
+ private static answerOf;
519
+ /** The hidden `<ui-input type="file">` that opens the browser's file dialog. */
520
+ private fileInput;
521
+ /** The file input drawn: it tells us what was picked. */
522
+ private readonly fileInputDrawn;
523
+ /**
524
+ * Open the file dialog. The browser opens it only from a person's click or key.
525
+ * - NEVER throws: a dialog the browser won't open (no click) is warned about.
526
+ */
527
+ openDialog(): void;
528
+ /** A click on its button, or on a page's own in the `button` slot: the file dialog. */
529
+ private readonly onButtonClick;
530
+ /**
531
+ * Files picked in the dialog: taken, then the input emptied, so the same file can be picked again.
532
+ * - Its `ui-changed` stops here: it's composed, and the page hears the uploader's own events instead.
533
+ */
534
+ private readonly onPicked;
535
+ /** What a dialog gave: files, or with `folder`, folders, by each file's path in it (`webkitRelativePath`). */
536
+ private static arrivalFromDialog;
537
+ /** Are files dragged over it, or its zone? */
538
+ accessor isDraggedOver: boolean;
539
+ /** How many files are dragged over it, while they are. */
540
+ accessor draggedCount: number;
541
+ /** Is the drag over its zone, not itself? Its zone's overlay shows. */
542
+ accessor isOverZone: boolean;
543
+ /** Ends the drag when no `dragover` comes for a moment: the files left without a drop. */
544
+ private dragEnd;
545
+ /** Files are dragged over it: allow the drop, and say so. */
546
+ protected onDragOver(event: DragEvent): void;
547
+ /** Files dropped on it. */
548
+ protected onDrop(event: DragEvent): void;
549
+ /**
550
+ * Files are dragged over it (`drop`) or its zone (`zone`): the drop is allowed,
551
+ * and the first `dragover` sends `ui-file-dragged-over` (a `folder` uploader's `ui-folder-dragged-over`).
552
+ */
553
+ draggedOver(event: DragEvent, via: typeof DROP | typeof ZONE): void;
554
+ /** The drag is over: dropped, or gone without a drop (`ui-file-dragged-out`). */
555
+ private dragOver;
556
+ /** Files dropped on it or its zone: read what the drop holds (folders walked), then take it. */
557
+ dropped(event: DragEvent, via: typeof DROP | typeof ZONE): void;
558
+ /** Does the drag hold files? */
559
+ static hasFiles(event: DragEvent): boolean;
560
+ /** A drag's detail: how many files, and their kinds; a browser shows no names or sizes until the drop. */
561
+ private static dragDetail;
562
+ /**
563
+ * The drop's items, read while its event lasts: each one's file, entry and handle (the handle a promise).
564
+ * - `getAsFileSystemHandle()` is Chrome's and Edge's only; `webkitGetAsEntry()` every browser's.
565
+ */
566
+ private static itemsOf;
567
+ /** What a drop gave: its files, and its folders walked, each file with its path in its folder. */
568
+ private static arrivalFromDrop;
569
+ /** Every file in a dropped folder, and its folders, each with its path from the folder dropped. */
570
+ private static filesIn;
571
+ /** The element its `drop-zone` names, as it is now: the page's root for `page`. */
572
+ get zoneElement(): Element | undefined;
573
+ /** While connected: its zone hands it the drops on it (`DropZones`). */
574
+ protected onZoneChanged(isConnected: boolean): (() => void) | undefined;
575
+ /** Where its zone's overlay goes: over the zone's box, in the window. */
576
+ private get zoneBox();
577
+ /**
578
+ * `element`'s box in the window; for a host with no box of its own (`display: contents`, as many `<ui-*>` are),
579
+ * the box round what it draws.
580
+ */
581
+ private static boxOf;
582
+ /** Show or hide the zone's overlay, in the top layer, as the drag comes and goes. */
583
+ private zoneOverlayDrawn;
584
+ /** Follows the zone's drag: its overlay shows or hides. */
585
+ protected onOverZoneChanged(): void;
586
+ /** The zone's overlay, once drawn. */
587
+ private zoneOverlay;
588
+ /** Fill `{name}`s in a page's own message. */
589
+ private static filled;
590
+ /** Its line of help: `message`, else its own for its look, naming the kinds it takes. */
591
+ get messageText(): string;
592
+ /** What it says while files are dragged over it. */
593
+ get dropText(): string;
594
+ /** What it says while it posts, and once they're all done; empty before. */
595
+ get statusText(): string;
596
+ /** How many were turned away, for people; empty for none. */
597
+ get turnedAwayText(): string;
598
+ /** A row's status, for people. */
599
+ private statusOf;
600
+ /** The `button` look's label: what it's doing, else its line of help. */
601
+ private get buttonText();
602
+ /** The `input` look's field: how many files, and how many are up. */
603
+ private get fieldText();
604
+ /** The popup of file rows, once drawn. */
605
+ private popupElement;
606
+ /** Hides the popup at the end of its glimpse. */
607
+ private popupHide;
608
+ /** The popup was drawn: aimed at the button, and a glimpse of it if it's posting. */
609
+ private popupDrawn;
610
+ /**
611
+ * The `button` look shows its popup for a moment as an upload starts, then only on hover or focus,
612
+ * so it never sits over the page while files post (epic `from-jarvis` P9).
613
+ */
614
+ protected onUploadingChanged(isUploading: boolean): void;
615
+ /** Show the popup, then hide it after `POPUP_GLIMPSE`, unless the pointer or the focus is on it, or its button. */
616
+ private glimpse;
617
+ render(): JSX.Element;
618
+ /** The overlay over its zone while files are dragged over it, in the top layer. */
619
+ private zoneOverlayBox;
620
+ /** The hero: a big drop area, then a row per file. */
621
+ private heroLook;
622
+ /** The compact look: a one-line drop area, then one line of status and one bar. */
623
+ private compactLook;
624
+ /** The button look: a button, and its file rows in a popup from it. */
625
+ private buttonLook;
626
+ /** The input look: a read-only field with a Browse button joined to it, then the rows. */
627
+ private inputLook;
628
+ /** The button that opens the file dialog, in the `button` slot: a page's own, else ours. */
629
+ private chooseButton;
630
+ /** A row per file, an item of a `<ui-list>`: its glyph, name, size, then its progress or status, and Remove. */
631
+ private fileRows;
632
+ /** `max-size`'s text in bytes: `2 MB`, `500 KB`, `1.5 GB`, `2048`; `undefined` for none, or text it can't read. */
633
+ static bytesFor(text: string | undefined): number | undefined;
634
+ }
635
+ /** The vocabulary's attribute getters, typed (see "Attributes" in `UIComponent`). */
636
+ export interface UIUploader extends E.AttributeValues<typeof uploaderVocabulary> {
637
+ }
638
+ /** Its looks, `appearance`. */
639
+ export type Appearance = (typeof APPEARANCES)[number];
640
+ /** How files came in: the file dialog, a drop on it, or a drop on its zone. */
641
+ export type Via = typeof DIALOG | typeof DROP | typeof ZONE;
642
+ /** What `action` is: called with the files kept; what it returns (or resolves to) is `ui-uploaded`'s `response`. */
643
+ export type UploadAction = (files: File[]) => unknown;
644
+ /** Where a file's row has got. */
645
+ export type UploadStatus = (typeof UPLOAD_STATUSES)[number];
646
+ /** A file's row. */
647
+ export type FileRow = {
648
+ /** its own number, for `<For>` and removing it */
649
+ id: number;
650
+ /** the file */
651
+ file: File;
652
+ /** its path in its folder; its name, for a file on its own */
653
+ path: string;
654
+ /** where it's got */
655
+ status: UploadStatus;
656
+ /** bytes posted so far */
657
+ sent: number;
658
+ /** why it was turned away, or failed: short, for its row */
659
+ reason?: string;
660
+ /** why it was turned away, in a full sentence: its row's tooltip */
661
+ why?: string;
662
+ };
663
+ /** A file taken in, before it's checked. */
664
+ type Taken = {
665
+ file: File;
666
+ path: string;
667
+ entry?: FileSystemEntry;
668
+ handle?: FileSystemHandle;
669
+ /** why it's turned away, once checked: short, for its row */
670
+ reason?: string;
671
+ /** why it's turned away, in a full sentence */
672
+ why?: string;
673
+ };
674
+ /** A folder taken in, with its files. */
675
+ type TakenFolder = {
676
+ name: string;
677
+ path: string;
678
+ files: Taken[];
679
+ entry?: FileSystemEntry;
680
+ handle?: FileSystemHandle;
681
+ };
682
+ /** Everything that came in at once. */
683
+ type Arrival = {
684
+ via: Via;
685
+ files: Taken[];
686
+ folders: TakenFolder[];
687
+ };
688
+ /** `appearance`'s values. */
689
+ declare const APPEARANCES: readonly ["hero", "button", "input", "compact"];
690
+ /** How files came in. */
691
+ declare const DIALOG = "dialog";
692
+ declare const DROP = "drop";
693
+ declare const ZONE = "zone";
694
+ /** Where a row has got. */
695
+ declare const UPLOAD_STATUSES: readonly ["waiting", "uploading", "uploaded", "taken", "held", "failed", "turned away"];
696
+ /****************
697
+ * ### `DropZones`
698
+ * Which uploader a drop on a `drop-zone` goes to: one set of document listeners for every zone on the page.
699
+ * - A drop on an uploader's own drop area always goes to that uploader (it handles it first: `HANDLED`).
700
+ * - A drop elsewhere goes to the uploader whose zone is the closest around where it landed;
701
+ * `page` (the page's root) is the farthest.
702
+ * - Two uploaders with the same zone: the first on the page takes the drops, and the second logs one warning.
703
+ * - Static and page-wide: `reset()` for tests.
704
+ ****************/
705
+ export declare class DropZones {
706
+ /** Each zone's uploaders, in the order they joined. */
707
+ private static readonly zones;
708
+ /** Are the document's listeners on? */
709
+ private static isListening;
710
+ /** `uploader` takes the drops on `zone`. */
711
+ static add(zone: Element, uploader: UIUploader): void;
712
+ /** `uploader` no longer takes the drops on `zone`. */
713
+ static remove(zone: Element, uploader: UIUploader): void;
714
+ /** Forget every zone: for tests. */
715
+ static reset(): void;
716
+ /** The uploader a drag event over the page goes to: the closest zone round where it is. */
717
+ private static uploaderFor;
718
+ /** The document's listeners, on once a zone joins, for the life of the page. */
719
+ private static listen;
720
+ }
721
+ export {};