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
@@ -664,6 +664,13 @@ export declare abstract class UIComponent<V extends E.ComponentVocabulary = E.Co
664
664
  * - throws a `TypeError` when a tag defined early no longer matches its root's catalog (`DOMElement.attach()`)
665
665
  */
666
666
  static define(this: E.UIComponentClass, tag?: string, dictionary?: E.Dictionary): CustomElementConstructor | undefined;
667
+ /**
668
+ * Give `Class`'s vocabulary an empty list for each list it leaves out: `events`, `slots`, `parts`, `states`, `texts`.
669
+ * - So a subclass's small vocabulary, written by hand or in JavaScript, defines (epic `from-jarvis` P11):
670
+ * one with no `slots` crashed `Vocabulary.resolve()` ("vocabulary.slots is not iterable").
671
+ * - SIDE EFFECT: fills them in on the vocabulary itself; a frozen one is copied onto `Class` instead.
672
+ */
673
+ private static completeVocabulary;
667
674
  /**
668
675
  * What the DOM element class of `definition`'s tag carries, for component class `Class`:
669
676
  * its definition, shadow root options, whether it's a form control, and how to build its component.
@@ -127,6 +127,12 @@ export type ComponentRegistry = {
127
127
  * `UIComponent.registry.definitions.get(child.localName)?.vocabulary.noun`.
128
128
  */
129
129
  readonly definitions: Map<string, E.ElementDefinition>;
130
+ /**
131
+ * The component class of every defined tag, by tag: `UITree` for `ui-tree`.
132
+ * - What a class built on a tag's component starts from, knowing only its tag:
133
+ * a Spell type built on a Spell UI element (the app's `SpellElement`, epic `from-jarvis` P11).
134
+ */
135
+ readonly components: Map<string, UIComponentClass>;
130
136
  /** The vocabularies already handed to the runtime (`UIComponent.register()`), so each is handed over once. */
131
137
  readonly vocabularies: WeakSet<E.ComponentVocabulary>;
132
138
  };
@@ -72,6 +72,11 @@ export type AttributeSpec = {
72
72
  widthClass?: string;
73
73
  /** `kind: "width"` only: accept `"equal"` => `equal width`. */
74
74
  canEqual?: boolean;
75
+ /**
76
+ * `kind: "string"` only: a number is welcome too (`<ui-statistic value={3}>`), shown as its text.
77
+ * - Its JSX type takes `string | number`; the component still reads text (`"3"`).
78
+ */
79
+ canBeNumber?: boolean;
75
80
  /** Reflect property changes back to the attribute. Default: true for primitives, never for `json`. */
76
81
  reflect?: boolean;
77
82
  /** JS property name, when it isn't `camelCase(name)`. */
@@ -266,6 +271,24 @@ export type TextSpec = {
266
271
  /** Where it shows, for translators and docs. */
267
272
  description?: string;
268
273
  };
274
+ /**
275
+ * A method a subclass overrides to change how the element draws, with the words Spell says it in
276
+ * (epic `from-jarvis` P11, Q11): `<ui-tree>`'s `rowClass(item)`, `to give the row class of (an item)`.
277
+ * - A Spell type built on the element (`a "netlist column" is a ui tree view`) overrides it with a `to` line in
278
+ * those words, as a card overrides `to draw its front`; its element calls the type's method in its place.
279
+ * - A translation gives its own words (`ComponentDictionary.hooks`).
280
+ */
281
+ export type HookSpec = {
282
+ /** The method's name, as the component class has it, e.g. `rowClass`. */
283
+ name: string;
284
+ /**
285
+ * Its words, as a `to` line says them, each argument in brackets with its type:
286
+ * `give the row class of (an item)`.
287
+ */
288
+ words: string;
289
+ /** What it gives back, and when it's called, for docs. */
290
+ description?: string;
291
+ };
269
292
  /**
270
293
  * Everything a component names -- the contents of `UI<Name>.en.ts`.
271
294
  * - Write it as `export const cardVocabulary = { ... } as const satisfies ComponentVocabulary`,
@@ -315,6 +338,8 @@ export type ComponentVocabulary = {
315
338
  states: readonly StateSpec[];
316
339
  /** Text it shows people (`UI.i18n`). */
317
340
  texts: readonly TextSpec[];
341
+ /** The methods a subclass overrides, with their Spell words (`HookSpec`); none: left out. */
342
+ hooks?: readonly HookSpec[];
318
343
  /**
319
344
  * Nouns of the generic content parts this component styles by context, e.g. card:
320
345
  * `header`, `meta`, `description`, `content`, `extra`.
@@ -538,6 +563,8 @@ export type ComponentDictionary = {
538
563
  aka?: readonly string[];
539
564
  /** Text key => text people read, for this component only (`UI.i18n`), e.g. `{ loading: "Cargando…" }`. */
540
565
  texts?: NameMap;
566
+ /** Hook name => its words in this language (`HookSpec`), e.g. `{ rowClass: "dar la clase de fila de (un elemento)" }`. */
567
+ hooks?: NameMap;
541
568
  };
542
569
  /**
543
570
  * One tag's names in one language, in a file of its own beside its vocabulary: `UIButton.es.ts`.
@@ -32,6 +32,13 @@ export declare function isBrowser(): boolean;
32
32
  * (an element drawn on a microtask, then rendered on the next frame: `nextFrame(2)`).
33
33
  */
34
34
  export declare function nextFrame(count?: number): Promise<number>;
35
+ /**
36
+ * The first of `properties` set on `element`, as a CSS time in seconds: `800ms` => `0.8`, `1.5s` => `1.5`.
37
+ * - `undefined` when none is set, or what's set isn't a time.
38
+ * - The wait a hover reads, as it starts: `cssSecondsFor(target, "--ui-tooltip-delay", "--ui-hover-delay")`.
39
+ * - Read live, each call: so a page that changes the property (Settings… › "Delay before showing help") is followed at once.
40
+ */
41
+ export declare function cssSecondsFor(element: Element, ...properties: string[]): number | undefined;
35
42
  /**
36
43
  * Put `text` on the clipboard; true when it got there.
37
44
  * - the browser's clipboard call first
@@ -478,6 +478,7 @@ export declare const sharedEs: {
478
478
  readonly start: "inicio";
479
479
  readonly end: "fin";
480
480
  readonly full: "completo";
481
+ readonly hidden: "oculto";
481
482
  readonly filling: "llenando";
482
483
  readonly sliding: "deslizando";
483
484
  readonly swinging: "balanceando";
@@ -0,0 +1,43 @@
1
+ /****************
2
+ * ### `DialArc`
3
+ * The geometry of a dial's ring: an open circle of 270°, its gap at the bottom, drawn clockwise from bottom left.
4
+ * - Angles are in degrees, clockwise from 12 o'clock: the ring runs `START` (-135°) ... `END` (135°).
5
+ * - Lengths are in the dial's drawing units: a 100 by 100 box, centred on `CENTRE`.
6
+ * - Pure arithmetic (no DOM; of the core, only `E.clamp()`), so it's tested on its own.
7
+ * - The value maths (snapping, steps, keys) is `SliderScale`'s: a dial is a slider's number line, bent round.
8
+ * - STATIC and instance-free on purpose: every dial has the same ring; only its ratio differs.
9
+ ****************/
10
+ export declare class DialArc {
11
+ /** Where the ring starts (`min`): bottom left. */
12
+ static readonly START = -135;
13
+ /** How far round the ring runs. */
14
+ static readonly SWEEP = 270;
15
+ /** Where the ring ends (`max`): bottom right. */
16
+ static readonly END: number;
17
+ /** The centre of the drawing, both ways. */
18
+ static readonly CENTRE = 50;
19
+ /** The angle at `ratio` (`0` ... `1`) along the ring. */
20
+ static angleAt(ratio: number): number;
21
+ /** Where along the ring (`0` ... `1`) `angle` lies; an angle in the gap goes to the nearer end. */
22
+ static ratioAt(angle: number): number;
23
+ /** The point at `ratio` along a circle of `radius` round the centre. */
24
+ static pointAt(ratio: number, radius: number): {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ /**
29
+ * An SVG path along a circle of `radius`, from ratio `from` to `to`; `""` when it would be empty.
30
+ * - One arc command: the ring is never a full circle, so its ends never meet.
31
+ */
32
+ static path(from: number, to: number, radius: number): string;
33
+ /** The angle of the point `dx`, `dy` from the centre, `-180` ... `180` (screen axes: `dy` grows downward). */
34
+ static angleOf(dx: number, dy: number): number;
35
+ /**
36
+ * Follow a dragging pointer from `previous` to `angle` the short way round, winding on past the ring's ends:
37
+ * so the value never jumps across the gap (`ratioAt()` holds a wound angle at the nearer end).
38
+ * - A pointer dragged past `max`, on round the gap to the start, stays at `max` until it comes back.
39
+ * - Held within half a turn past either end (`-360` ... `360`): winding further loses no more than that,
40
+ * and the short way round from there still lands past the end, so it can't jump either.
41
+ */
42
+ static follow(previous: number, angle: number): number;
43
+ }
@@ -0,0 +1,263 @@
1
+ import { JSX } from '@solidjs/web';
2
+ import { E } from 'spell/ui/core';
3
+ import { F } from 'spell/ui/forms';
4
+ import { SliderScale } from 'spell/ui/components/ui-slider/SliderScale';
5
+ import { dialVocabulary } from './UIDial.en';
6
+ import { DialFallback } from './UIDial.fallback';
7
+ /****************
8
+ * ### `UIDial`
9
+ * The component behind `<ui-dial>`: a dial, to pick a number by turning a handle round an open ring.
10
+ *
11
+ * - Its shadow DOM:
12
+ * `<div class="ui … dial" part="dial">` around the control (`part="control"`, `role=slider`) and, with `label`,
13
+ * the words under it (`part="label"`).
14
+ * - The control holds an SVG drawing (the ring, its coloured arc, the disc, the tick dots, the handle)
15
+ * and the value, written over the disc in the page's font.
16
+ * - The drawing is a 100 by 100 box; its geometry is `DialArc`'s, the ring 270° with its gap at the bottom.
17
+ *
18
+ * - The control is an APG slider (`role=slider`, `aria-value*`): it takes focus, and draws its focus ring round
19
+ * the handle.
20
+ * - Named by `aria-label`, a `<label for>` (`labels`), else by its own `label`.
21
+ * - `aria-valuetext` is the value as shown, `unit` included.
22
+ *
23
+ * - Keys (on the control), as `<ui-slider>`'s (`SliderScale.valueForKey()`):
24
+ * - Right / Up step up, Left / Down step down
25
+ * - PageUp / PageDown take 2 steps
26
+ * - Home / End go to `min` / `max`
27
+ * - each key sends `ui-moved`, then `ui-changed`.
28
+ * - Wheel: only while the control has focus (so the page still scrolls past it), a step a notch.
29
+ * - Pointer: pressing the ring moves the handle there, and dragging turns it (pointer capture).
30
+ * - The drag follows the pointer round, never across the gap: `DialArc.follow()`.
31
+ * - A press on the disc's middle only focuses it: its angle means nothing there.
32
+ * - `ui-moved` for each new value, `ui-changed` once when the drag ends somewhere new.
33
+ *
34
+ * - `value` is controlled (`@controlled`): a `ui-moved` handler that sets it again wins.
35
+ * The ATTRIBUTE is the starting (and reset) value.
36
+ * - The value maths is `<ui-slider>`'s `SliderScale`: a dial is a slider's number line, bent round.
37
+ * - A form control: it submits `value`, restores a saved state, and takes `required` as a slider does.
38
+ ****************/
39
+ export declare class UIDial extends F.FormComponent<typeof dialVocabulary> {
40
+ static vocabulary: {
41
+ readonly tag: "ui-dial";
42
+ readonly icon: "gauge";
43
+ readonly snippet: "<ui-dial label=\"Volume\"></ui-dial>";
44
+ readonly formControl: true;
45
+ readonly topics: readonly ["inputs", "forms", "controls", "modules"];
46
+ readonly aka: readonly ["knob", "rotary knob", "radial slider", "circular slider", "gauge", "arc slider"];
47
+ readonly skeleton: "inline 10 x 11.5";
48
+ readonly noun: "dial";
49
+ readonly partOfSpeech: "action";
50
+ readonly description: "A dial lets people pick a number by turning it, with its value in the middle and its label under it.";
51
+ readonly attributes: readonly [{
52
+ readonly name: "label";
53
+ readonly group: "name";
54
+ readonly kind: "string";
55
+ readonly description: "The words under the dial; also its name for screen readers, unless `aria-label` or a `<label for>` names it.";
56
+ }, {
57
+ readonly name: "size";
58
+ readonly group: "appearance";
59
+ readonly kind: "size";
60
+ readonly description: "Size of the whole dial, `mini` ... `massive`.";
61
+ }, {
62
+ readonly name: "color";
63
+ readonly group: "appearance";
64
+ readonly kind: "color";
65
+ readonly description: "Hue of the arc and the handle; uncoloured, the theme's primary colour.";
66
+ }, {
67
+ readonly name: "ticks";
68
+ readonly group: "appearance";
69
+ readonly kind: "string";
70
+ readonly description: string;
71
+ }, {
72
+ readonly name: "unit";
73
+ readonly group: "appearance";
74
+ readonly kind: "string";
75
+ readonly description: "Written right after the number: `unit=\"%\"` shows `98%`, `unit=\" px\"` shows `16 px`.";
76
+ }, {
77
+ readonly name: "disabled";
78
+ readonly group: "states";
79
+ readonly kind: "keyOnly";
80
+ readonly description: "Can't be used: dimmed, not focusable, left out of the form.";
81
+ }, {
82
+ readonly description: "Shows its value but can't be changed; still focusable and submitted.";
83
+ readonly name: "readonly";
84
+ readonly group: "form";
85
+ readonly kind: "keyOnly";
86
+ readonly property: "readOnly";
87
+ readonly key: "read-only";
88
+ }, {
89
+ readonly name: "min";
90
+ readonly group: "form";
91
+ readonly kind: "number";
92
+ readonly default: 0;
93
+ readonly description: "Lowest value, at the ring's start.";
94
+ }, {
95
+ readonly name: "max";
96
+ readonly group: "form";
97
+ readonly kind: "number";
98
+ readonly default: 100;
99
+ readonly description: "Highest value, at the ring's end.";
100
+ }, {
101
+ readonly name: "step";
102
+ readonly group: "form";
103
+ readonly kind: "number";
104
+ readonly default: 1;
105
+ readonly description: "Values snap to multiples of it from `min`; `0`: any.";
106
+ }, {
107
+ readonly name: "value";
108
+ readonly group: "form";
109
+ readonly kind: "number";
110
+ readonly reflect: false;
111
+ readonly description: "The value, default `min`. Attribute: the starting (and reset) value; property: the live one.";
112
+ }, {
113
+ readonly name: "name";
114
+ readonly group: "name";
115
+ readonly kind: "string";
116
+ readonly description: "Form field name.";
117
+ }, {
118
+ readonly name: "parameter";
119
+ readonly group: "form";
120
+ readonly kind: "string";
121
+ readonly description: string;
122
+ }, {
123
+ readonly description: string;
124
+ readonly name: "required";
125
+ readonly group: "form";
126
+ readonly kind: "boolean";
127
+ }];
128
+ readonly events: readonly [{
129
+ readonly name: "ui-moved";
130
+ readonly detail: "{ value: number, originalEvent?: Event }";
131
+ readonly description: "The handle moved (each drag step, key or wheel turn). A handler that re-sets `value` wins.";
132
+ }, {
133
+ readonly name: "ui-changed";
134
+ readonly detail: "{ value: number, originalEvent?: Event }";
135
+ readonly description: "A change was committed: on a key or wheel turn, or when a drag ends somewhere new.";
136
+ }];
137
+ readonly slots: readonly [];
138
+ readonly parts: readonly [{
139
+ readonly name: "dial";
140
+ readonly description: "The root box: the ring, then the label.";
141
+ }, {
142
+ readonly name: "control";
143
+ readonly description: "The round control itself (`role=slider`), which takes focus.";
144
+ }, {
145
+ readonly name: "track";
146
+ readonly description: "The empty ring.";
147
+ }, {
148
+ readonly name: "track-fill";
149
+ readonly description: "The coloured arc, from the start to the value.";
150
+ }, {
151
+ readonly name: "handle";
152
+ readonly description: "The round handle, at the arc's end.";
153
+ }, {
154
+ readonly name: "disc";
155
+ readonly description: "The disc in the middle.";
156
+ }, {
157
+ readonly name: "ticks";
158
+ readonly description: "The tick dots (`ticks`).";
159
+ }, {
160
+ readonly name: "value";
161
+ readonly description: "The value, written in the disc.";
162
+ }, {
163
+ readonly name: "label";
164
+ readonly description: "The words under the dial (`label`).";
165
+ }];
166
+ readonly states: readonly [{
167
+ readonly name: "disabled";
168
+ readonly description: "Can't be used.";
169
+ }, {
170
+ readonly name: "dragging";
171
+ readonly description: "The handle is being dragged.";
172
+ }, {
173
+ readonly description: "Fails validation (`required`), once a person has interacted.";
174
+ readonly name: "invalid";
175
+ }];
176
+ readonly texts: readonly [];
177
+ };
178
+ static elementSetup: {
179
+ styleSheets: {
180
+ dial: string;
181
+ };
182
+ Fallback: typeof DialFallback;
183
+ };
184
+ /** The control: the drawing and the value, `role=slider`. */
185
+ private control?;
186
+ /** `value`: set by the page, or turned; `min` until either. */
187
+ accessor value: number | undefined;
188
+ /** The number line. */
189
+ get scale(): SliderScale;
190
+ /** The value, snapped. */
191
+ get snappedValue(): number;
192
+ /** Text for `value`: the number in the page's format, then `unit`. */
193
+ valueText(value: number): string;
194
+ /**
195
+ * Turn the dial to `value` as a person would: send `ui-moved`, then set the DOM element's property,
196
+ * unless a handler set it first.
197
+ * - Returns true when the value changed.
198
+ */
199
+ private turnTo;
200
+ /** Can a person change it? */
201
+ get isInteractive(): boolean;
202
+ get formValue(): E.FieldValue;
203
+ /**
204
+ * Empty while no value was ever set: `required` then fails.
205
+ * - The handle resting at `min` is a default, not a choice; `formValue` still submits it.
206
+ */
207
+ protected get validationValue(): E.FieldValue;
208
+ /** Back to the `value` ATTRIBUTE. */
209
+ onFormReset(): void;
210
+ /** A saved state: its value. `null`: DOM API `formStateRestoreCallback()`'s. */
211
+ onFormStateRestore(state: File | string | FormData | null): void;
212
+ /**
213
+ * Number of gaps between tick dots: `0` for none.
214
+ * - `ticks` alone (or `true` / `yes`): `DEFAULT_TICK_GAPS`; a number: that many; `false` / `no`: none.
215
+ */
216
+ get tickGaps(): number;
217
+ /** Where the handle is drawn, `0` ... `1` along the ring. */
218
+ get ratio(): number;
219
+ render(): JSX.Element;
220
+ /** The SVG drawing: ring, arc, disc, ticks, focus ring, handle. */
221
+ private drawing;
222
+ /** The ratio of each tick dot, both ends included. */
223
+ private get tickRatios();
224
+ /**
225
+ * Server render only (`spell/ui/static`): the value as a hidden input, so a static form submits it without script.
226
+ * - In a browser the DOM element submits (`ElementInternals`).
227
+ */
228
+ private staticValue;
229
+ /** The handle is being dragged. */
230
+ accessor isDragging: boolean;
231
+ /** The dragged angle, wound on past the ring's ends (`DialArc.follow()`); `undefined` between drags. */
232
+ private dragAngle?;
233
+ /** The value when the current drag began, to tell whether it changed anything. */
234
+ private valueAtDragStart?;
235
+ /** Keep the control, and listen for the wheel on it: not passive, so a turn can stop the page scrolling. */
236
+ private attach;
237
+ /** Press: on the ring, the handle jumps there and is dragged; on the disc's middle, only focus. */
238
+ private readonly onPointerDown;
239
+ /** Drag: follow the pointer round. */
240
+ private readonly onPointerMove;
241
+ /** Release: `ui-changed` when the drag moved anything. */
242
+ private readonly onPointerUp;
243
+ /** Wheel, while focused: a step a notch (up turns up); else the page scrolls as usual. */
244
+ private readonly onWheel;
245
+ /**
246
+ * Route pointer `id`'s moves to the control until release.
247
+ * - A pointer with no pressed button (a synthetic event) can't be captured: moves then only arrive while over it.
248
+ */
249
+ private capture;
250
+ /** The pointer's angle round the drawing's centre, and its distance from it in drawing units. */
251
+ private pointerAt;
252
+ /** The snapped value at `angle` round the ring. */
253
+ private valueAtAngle;
254
+ /** Keys on the control, see the class doc. */
255
+ private readonly onKeyDown;
256
+ /** Turn to `value` and, when it moved, send `ui-changed` at once: a key or a wheel notch is a whole change. */
257
+ private commit;
258
+ /** A click aimed at the DOM element itself (its `<label for>`) focuses the control. */
259
+ protected activateControl(): void;
260
+ }
261
+ /** The vocabulary's attribute getters, typed (see "Attributes" in `UIComponent`). */
262
+ export interface UIDial extends E.AttributeValues<typeof dialVocabulary> {
263
+ }
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Every name `<ui-dial>` uses: tag, attributes (kind + allowed values), events, parts, states.
3
+ * Schema: `E.ComponentVocabulary` (`spell/ui/vocabulary`).
4
+ * - Class words come out through `ClassBuilder`:
5
+ * `<ui-dial size="small" color="orange" ticks readonly>` => `ui small orange ticked read-only dial`.
6
+ * - `min` / `max` / `step` / `value` are a slider's: a dial is the same number line, bent round.
7
+ */
8
+ /****************
9
+ * ### `<ui-dial>`
10
+ * A dial: a round control that picks a number, by dragging its handle round an open ring.
11
+ ****************/
12
+ export declare const dialVocabulary: {
13
+ readonly tag: "ui-dial";
14
+ readonly icon: "gauge";
15
+ readonly snippet: "<ui-dial label=\"Volume\"></ui-dial>";
16
+ readonly formControl: true;
17
+ readonly topics: readonly ["inputs", "forms", "controls", "modules"];
18
+ readonly aka: readonly ["knob", "rotary knob", "radial slider", "circular slider", "gauge", "arc slider"];
19
+ readonly skeleton: "inline 10 x 11.5";
20
+ readonly noun: "dial";
21
+ readonly partOfSpeech: "action";
22
+ readonly description: "A dial lets people pick a number by turning it, with its value in the middle and its label under it.";
23
+ readonly attributes: readonly [{
24
+ readonly name: "label";
25
+ readonly group: "name";
26
+ readonly kind: "string";
27
+ readonly description: "The words under the dial; also its name for screen readers, unless `aria-label` or a `<label for>` names it.";
28
+ }, {
29
+ readonly name: "size";
30
+ readonly group: "appearance";
31
+ readonly kind: "size";
32
+ readonly description: "Size of the whole dial, `mini` ... `massive`.";
33
+ }, {
34
+ readonly name: "color";
35
+ readonly group: "appearance";
36
+ readonly kind: "color";
37
+ readonly description: "Hue of the arc and the handle; uncoloured, the theme's primary colour.";
38
+ }, {
39
+ readonly name: "ticks";
40
+ readonly group: "appearance";
41
+ readonly kind: "string";
42
+ readonly description: string;
43
+ }, {
44
+ readonly name: "unit";
45
+ readonly group: "appearance";
46
+ readonly kind: "string";
47
+ readonly description: "Written right after the number: `unit=\"%\"` shows `98%`, `unit=\" px\"` shows `16 px`.";
48
+ }, {
49
+ readonly name: "disabled";
50
+ readonly group: "states";
51
+ readonly kind: "keyOnly";
52
+ readonly description: "Can't be used: dimmed, not focusable, left out of the form.";
53
+ }, {
54
+ readonly description: "Shows its value but can't be changed; still focusable and submitted.";
55
+ readonly name: "readonly";
56
+ readonly group: "form";
57
+ readonly kind: "keyOnly";
58
+ readonly property: "readOnly";
59
+ readonly key: "read-only";
60
+ }, {
61
+ readonly name: "min";
62
+ readonly group: "form";
63
+ readonly kind: "number";
64
+ readonly default: 0;
65
+ readonly description: "Lowest value, at the ring's start.";
66
+ }, {
67
+ readonly name: "max";
68
+ readonly group: "form";
69
+ readonly kind: "number";
70
+ readonly default: 100;
71
+ readonly description: "Highest value, at the ring's end.";
72
+ }, {
73
+ readonly name: "step";
74
+ readonly group: "form";
75
+ readonly kind: "number";
76
+ readonly default: 1;
77
+ readonly description: "Values snap to multiples of it from `min`; `0`: any.";
78
+ }, {
79
+ readonly name: "value";
80
+ readonly group: "form";
81
+ readonly kind: "number";
82
+ readonly reflect: false;
83
+ readonly description: "The value, default `min`. Attribute: the starting (and reset) value; property: the live one.";
84
+ }, {
85
+ readonly name: "name";
86
+ readonly group: "name";
87
+ readonly kind: "string";
88
+ readonly description: "Form field name.";
89
+ }, {
90
+ readonly name: "parameter";
91
+ readonly group: "form";
92
+ readonly kind: "string";
93
+ readonly description: string;
94
+ }, {
95
+ readonly description: string;
96
+ readonly name: "required";
97
+ readonly group: "form";
98
+ readonly kind: "boolean";
99
+ }];
100
+ readonly events: readonly [{
101
+ readonly name: "ui-moved";
102
+ readonly detail: "{ value: number, originalEvent?: Event }";
103
+ readonly description: "The handle moved (each drag step, key or wheel turn). A handler that re-sets `value` wins.";
104
+ }, {
105
+ readonly name: "ui-changed";
106
+ readonly detail: "{ value: number, originalEvent?: Event }";
107
+ readonly description: "A change was committed: on a key or wheel turn, or when a drag ends somewhere new.";
108
+ }];
109
+ readonly slots: readonly [];
110
+ readonly parts: readonly [{
111
+ readonly name: "dial";
112
+ readonly description: "The root box: the ring, then the label.";
113
+ }, {
114
+ readonly name: "control";
115
+ readonly description: "The round control itself (`role=slider`), which takes focus.";
116
+ }, {
117
+ readonly name: "track";
118
+ readonly description: "The empty ring.";
119
+ }, {
120
+ readonly name: "track-fill";
121
+ readonly description: "The coloured arc, from the start to the value.";
122
+ }, {
123
+ readonly name: "handle";
124
+ readonly description: "The round handle, at the arc's end.";
125
+ }, {
126
+ readonly name: "disc";
127
+ readonly description: "The disc in the middle.";
128
+ }, {
129
+ readonly name: "ticks";
130
+ readonly description: "The tick dots (`ticks`).";
131
+ }, {
132
+ readonly name: "value";
133
+ readonly description: "The value, written in the disc.";
134
+ }, {
135
+ readonly name: "label";
136
+ readonly description: "The words under the dial (`label`).";
137
+ }];
138
+ readonly states: readonly [{
139
+ readonly name: "disabled";
140
+ readonly description: "Can't be used.";
141
+ }, {
142
+ readonly name: "dragging";
143
+ readonly description: "The handle is being dragged.";
144
+ }, {
145
+ readonly description: "Fails validation (`required`), once a person has interacted.";
146
+ readonly name: "invalid";
147
+ }];
148
+ readonly texts: readonly [];
149
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `<ui-dial>` in Spanish: `<es-perilla>`, with the names only it uses (from `UIDial.en.ts`).
3
+ * - The names it shares with other tags (`label`, `size`, `color`, `ui-changed` ...) are translated once, for every
4
+ * tag: in `components.es.ts`, with the values every tag shares.
5
+ * - Names stay ASCII (no accents): tags and attributes are typed, and a tag can't hold every letter safely.
6
+ */
7
+ export declare const dialEs: {
8
+ readonly lang: "es";
9
+ readonly tag: "ui-dial";
10
+ readonly name: "perilla";
11
+ readonly snippet: "<es-perilla etiqueta=\"Volumen\"></es-perilla>";
12
+ readonly aka: readonly ["perilla", "dial", "mando giratorio", "control circular", "deslizador circular", "indicador"];
13
+ readonly attributes: {
14
+ readonly ticks: "marcas";
15
+ readonly unit: "unidad";
16
+ };
17
+ readonly parts: {
18
+ readonly dial: "perilla";
19
+ readonly track: "carril";
20
+ readonly "track-fill": "relleno-carril";
21
+ readonly handle: "tirador";
22
+ readonly disc: "disco";
23
+ readonly ticks: "marcas";
24
+ };
25
+ };