@nmnmcc/standard 0.0.0-stage → 0.4.1

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 (260) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +516 -2
  3. package/dist/Extend.d.ts +15 -0
  4. package/dist/Extend.d.ts.map +1 -0
  5. package/dist/Extend.js +1 -0
  6. package/dist/Node.d.ts +71 -0
  7. package/dist/Node.d.ts.map +1 -0
  8. package/dist/Palette-BIJ96BEh.js +84 -0
  9. package/dist/Palette.d.ts +8 -0
  10. package/dist/Palette.d.ts.map +1 -0
  11. package/dist/Palette.js +1 -0
  12. package/dist/Standard-BPpzr5SM.js +488 -0
  13. package/dist/Standard.d.ts +249 -0
  14. package/dist/Standard.d.ts.map +1 -0
  15. package/dist/Standard.js +1 -0
  16. package/dist/Ui-B9xQqqNT.js +468 -0
  17. package/dist/Ui.d.ts +500 -0
  18. package/dist/Ui.d.ts.map +1 -0
  19. package/dist/Ui.js +1 -0
  20. package/dist/index.d.ts +25 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +4 -0
  23. package/dist/rolldown-runtime-BMBA7GOT.js +10 -0
  24. package/dist/standard/button/button.d.ts +21 -0
  25. package/dist/standard/button/button.d.ts.map +1 -0
  26. package/dist/standard/colour/colour.d.ts +93 -0
  27. package/dist/standard/colour/colour.d.ts.map +1 -0
  28. package/dist/standard/field/field.d.ts +91 -0
  29. package/dist/standard/field/field.d.ts.map +1 -0
  30. package/dist/standard/form/form.d.ts +16 -0
  31. package/dist/standard/form/form.d.ts.map +1 -0
  32. package/dist/standard/icon/icon.d.ts +31 -0
  33. package/dist/standard/icon/icon.d.ts.map +1 -0
  34. package/dist/standard/image/image.d.ts +21 -0
  35. package/dist/standard/image/image.d.ts.map +1 -0
  36. package/dist/standard/layout/layout.d.ts +73 -0
  37. package/dist/standard/layout/layout.d.ts.map +1 -0
  38. package/dist/standard/list/list.d.ts +26 -0
  39. package/dist/standard/list/list.d.ts.map +1 -0
  40. package/dist/standard/page/page.d.ts +20 -0
  41. package/dist/standard/page/page.d.ts.map +1 -0
  42. package/dist/standard/table/table.d.ts +18 -0
  43. package/dist/standard/table/table.d.ts.map +1 -0
  44. package/dist/standard/text/text.d.ts +39 -0
  45. package/dist/standard/text/text.d.ts.map +1 -0
  46. package/dist/standard/tokens/classes.d.ts +16 -0
  47. package/dist/standard/tokens/classes.d.ts.map +1 -0
  48. package/dist/standard/tokens/tokens.d.ts +162 -0
  49. package/dist/standard/tokens/tokens.d.ts.map +1 -0
  50. package/dist/standard.css +2 -0
  51. package/dist/ui/arrow/arrow.d.ts +18 -0
  52. package/dist/ui/arrow/arrow.d.ts.map +1 -0
  53. package/dist/ui/avatar/avatar.d.ts +15 -0
  54. package/dist/ui/avatar/avatar.d.ts.map +1 -0
  55. package/dist/ui/board/board.d.ts +34 -0
  56. package/dist/ui/board/board.d.ts.map +1 -0
  57. package/dist/ui/bullet/bullet.d.ts +15 -0
  58. package/dist/ui/bullet/bullet.d.ts.map +1 -0
  59. package/dist/ui/card/card.d.ts +24 -0
  60. package/dist/ui/card/card.d.ts.map +1 -0
  61. package/dist/ui/carousel/carousel.d.ts +17 -0
  62. package/dist/ui/carousel/carousel.d.ts.map +1 -0
  63. package/dist/ui/check/check.d.ts +20 -0
  64. package/dist/ui/check/check.d.ts.map +1 -0
  65. package/dist/ui/choice/choice.d.ts +19 -0
  66. package/dist/ui/choice/choice.d.ts.map +1 -0
  67. package/dist/ui/control/control.d.ts +57 -0
  68. package/dist/ui/control/control.d.ts.map +1 -0
  69. package/dist/ui/dialog/dialog.d.ts +30 -0
  70. package/dist/ui/dialog/dialog.d.ts.map +1 -0
  71. package/dist/ui/disclosure/disclosure.d.ts +20 -0
  72. package/dist/ui/disclosure/disclosure.d.ts.map +1 -0
  73. package/dist/ui/flap/flap.d.ts +18 -0
  74. package/dist/ui/flap/flap.d.ts.map +1 -0
  75. package/dist/ui/item/item.d.ts +21 -0
  76. package/dist/ui/item/item.d.ts.map +1 -0
  77. package/dist/ui/key/key.d.ts +12 -0
  78. package/dist/ui/key/key.d.ts.map +1 -0
  79. package/dist/ui/menu/menu.d.ts +26 -0
  80. package/dist/ui/menu/menu.d.ts.map +1 -0
  81. package/dist/ui/modal/modal.d.ts +22 -0
  82. package/dist/ui/modal/modal.d.ts.map +1 -0
  83. package/dist/ui/navigator/navigator.d.ts +137 -0
  84. package/dist/ui/navigator/navigator.d.ts.map +1 -0
  85. package/dist/ui/notice/notice.d.ts +34 -0
  86. package/dist/ui/notice/notice.d.ts.map +1 -0
  87. package/dist/ui/options/options.d.ts +19 -0
  88. package/dist/ui/options/options.d.ts.map +1 -0
  89. package/dist/ui/pager/pager.d.ts +29 -0
  90. package/dist/ui/pager/pager.d.ts.map +1 -0
  91. package/dist/ui/pagination/pagination.d.ts +14 -0
  92. package/dist/ui/pagination/pagination.d.ts.map +1 -0
  93. package/dist/ui/popover/popover.d.ts +20 -0
  94. package/dist/ui/popover/popover.d.ts.map +1 -0
  95. package/dist/ui/progress/progress.d.ts +17 -0
  96. package/dist/ui/progress/progress.d.ts.map +1 -0
  97. package/dist/ui/route/route.d.ts +27 -0
  98. package/dist/ui/route/route.d.ts.map +1 -0
  99. package/dist/ui/sheet/sheet.d.ts +35 -0
  100. package/dist/ui/sheet/sheet.d.ts.map +1 -0
  101. package/dist/ui/skeleton/skeleton.d.ts +15 -0
  102. package/dist/ui/skeleton/skeleton.d.ts.map +1 -0
  103. package/dist/ui/slider/slider.d.ts +23 -0
  104. package/dist/ui/slider/slider.d.ts.map +1 -0
  105. package/dist/ui/stepper/stepper.d.ts +32 -0
  106. package/dist/ui/stepper/stepper.d.ts.map +1 -0
  107. package/dist/ui/tabs/tabs.d.ts +22 -0
  108. package/dist/ui/tabs/tabs.d.ts.map +1 -0
  109. package/dist/ui/tag/tag.d.ts +17 -0
  110. package/dist/ui/tag/tag.d.ts.map +1 -0
  111. package/dist/ui/tile/tile.d.ts +38 -0
  112. package/dist/ui/tile/tile.d.ts.map +1 -0
  113. package/dist/ui/toasts/toasts.d.ts +17 -0
  114. package/dist/ui/toasts/toasts.d.ts.map +1 -0
  115. package/dist/ui/toggle/toggle.d.ts +17 -0
  116. package/dist/ui/toggle/toggle.d.ts.map +1 -0
  117. package/dist/ui/trail/trail.d.ts +22 -0
  118. package/dist/ui/trail/trail.d.ts.map +1 -0
  119. package/package.json +70 -3
  120. package/src/Extend.ts +14 -0
  121. package/src/Node.ts +44 -0
  122. package/src/Palette.ts +7 -0
  123. package/src/Standard.ts +109 -0
  124. package/src/Ui.ts +156 -0
  125. package/src/index.ts +27 -0
  126. package/src/standard/button/button.module.css +43 -0
  127. package/src/standard/button/button.module.d.css.ts +6 -0
  128. package/src/standard/button/button.ts +38 -0
  129. package/src/standard/colour/colour.ts +197 -0
  130. package/src/standard/field/field.module.css +222 -0
  131. package/src/standard/field/field.module.d.css.ts +13 -0
  132. package/src/standard/field/field.ts +266 -0
  133. package/src/standard/form/form.ts +25 -0
  134. package/src/standard/icon/icon.module.css +349 -0
  135. package/src/standard/icon/icon.module.d.css.ts +112 -0
  136. package/src/standard/icon/icon.ts +148 -0
  137. package/src/standard/image/image.module.css +42 -0
  138. package/src/standard/image/image.module.d.css.ts +12 -0
  139. package/src/standard/image/image.ts +39 -0
  140. package/src/standard/layout/layout.module.css +224 -0
  141. package/src/standard/layout/layout.module.d.css.ts +41 -0
  142. package/src/standard/layout/layout.ts +133 -0
  143. package/src/standard/list/list.module.css +71 -0
  144. package/src/standard/list/list.module.d.css.ts +10 -0
  145. package/src/standard/list/list.ts +53 -0
  146. package/src/standard/page/page.module.css +244 -0
  147. package/src/standard/page/page.module.d.css.ts +9 -0
  148. package/src/standard/page/page.ts +32 -0
  149. package/src/standard/table/table.module.css +40 -0
  150. package/src/standard/table/table.module.d.css.ts +6 -0
  151. package/src/standard/table/table.ts +36 -0
  152. package/src/standard/text/text.module.css +149 -0
  153. package/src/standard/text/text.module.d.css.ts +19 -0
  154. package/src/standard/text/text.ts +77 -0
  155. package/src/standard/tokens/classes.ts +31 -0
  156. package/src/standard/tokens/tokens.module.css +294 -0
  157. package/src/standard/tokens/tokens.module.d.css.ts +40 -0
  158. package/src/standard/tokens/tokens.ts +339 -0
  159. package/src/ui/arrow/arrow.module.css +38 -0
  160. package/src/ui/arrow/arrow.module.d.css.ts +13 -0
  161. package/src/ui/arrow/arrow.ts +35 -0
  162. package/src/ui/avatar/avatar.module.css +25 -0
  163. package/src/ui/avatar/avatar.module.d.css.ts +5 -0
  164. package/src/ui/avatar/avatar.ts +28 -0
  165. package/src/ui/board/board.module.css +94 -0
  166. package/src/ui/board/board.module.d.css.ts +10 -0
  167. package/src/ui/board/board.ts +84 -0
  168. package/src/ui/bullet/bullet.module.css +28 -0
  169. package/src/ui/bullet/bullet.module.d.css.ts +5 -0
  170. package/src/ui/bullet/bullet.ts +16 -0
  171. package/src/ui/card/card.module.css +80 -0
  172. package/src/ui/card/card.module.d.css.ts +6 -0
  173. package/src/ui/card/card.ts +42 -0
  174. package/src/ui/carousel/carousel.module.css +24 -0
  175. package/src/ui/carousel/carousel.module.d.css.ts +5 -0
  176. package/src/ui/carousel/carousel.ts +30 -0
  177. package/src/ui/check/check.module.css +53 -0
  178. package/src/ui/check/check.module.d.css.ts +8 -0
  179. package/src/ui/check/check.ts +46 -0
  180. package/src/ui/choice/choice.module.css +32 -0
  181. package/src/ui/choice/choice.module.d.css.ts +6 -0
  182. package/src/ui/choice/choice.ts +31 -0
  183. package/src/ui/control/control.module.css +127 -0
  184. package/src/ui/control/control.module.d.css.ts +12 -0
  185. package/src/ui/control/control.ts +97 -0
  186. package/src/ui/dialog/dialog.module.css +42 -0
  187. package/src/ui/dialog/dialog.module.d.css.ts +6 -0
  188. package/src/ui/dialog/dialog.ts +44 -0
  189. package/src/ui/disclosure/disclosure.module.css +57 -0
  190. package/src/ui/disclosure/disclosure.module.d.css.ts +7 -0
  191. package/src/ui/disclosure/disclosure.ts +32 -0
  192. package/src/ui/flap/flap.module.css +161 -0
  193. package/src/ui/flap/flap.module.d.css.ts +48 -0
  194. package/src/ui/flap/flap.ts +78 -0
  195. package/src/ui/item/item.module.css +39 -0
  196. package/src/ui/item/item.module.d.css.ts +7 -0
  197. package/src/ui/item/item.ts +33 -0
  198. package/src/ui/key/key.module.css +15 -0
  199. package/src/ui/key/key.module.d.css.ts +5 -0
  200. package/src/ui/key/key.ts +13 -0
  201. package/src/ui/menu/menu.module.css +11 -0
  202. package/src/ui/menu/menu.module.d.css.ts +5 -0
  203. package/src/ui/menu/menu.ts +48 -0
  204. package/src/ui/modal/modal.module.css +66 -0
  205. package/src/ui/modal/modal.module.d.css.ts +8 -0
  206. package/src/ui/modal/modal.ts +55 -0
  207. package/src/ui/navigator/navigator.module.css +658 -0
  208. package/src/ui/navigator/navigator.module.d.css.ts +39 -0
  209. package/src/ui/navigator/navigator.ts +337 -0
  210. package/src/ui/notice/notice.module.css +80 -0
  211. package/src/ui/notice/notice.module.d.css.ts +10 -0
  212. package/src/ui/notice/notice.ts +57 -0
  213. package/src/ui/options/options.module.css +30 -0
  214. package/src/ui/options/options.module.d.css.ts +6 -0
  215. package/src/ui/options/options.ts +31 -0
  216. package/src/ui/pager/pager.module.css +38 -0
  217. package/src/ui/pager/pager.module.d.css.ts +8 -0
  218. package/src/ui/pager/pager.ts +48 -0
  219. package/src/ui/pagination/pagination.module.css +38 -0
  220. package/src/ui/pagination/pagination.module.d.css.ts +7 -0
  221. package/src/ui/pagination/pagination.ts +52 -0
  222. package/src/ui/popover/popover.module.css +94 -0
  223. package/src/ui/popover/popover.module.d.css.ts +8 -0
  224. package/src/ui/popover/popover.ts +139 -0
  225. package/src/ui/progress/progress.module.css +69 -0
  226. package/src/ui/progress/progress.module.d.css.ts +6 -0
  227. package/src/ui/progress/progress.ts +26 -0
  228. package/src/ui/route/route.module.css +116 -0
  229. package/src/ui/route/route.module.d.css.ts +11 -0
  230. package/src/ui/route/route.ts +58 -0
  231. package/src/ui/sheet/sheet.module.css +194 -0
  232. package/src/ui/sheet/sheet.module.d.css.ts +7 -0
  233. package/src/ui/sheet/sheet.ts +47 -0
  234. package/src/ui/skeleton/skeleton.module.css +44 -0
  235. package/src/ui/skeleton/skeleton.module.d.css.ts +6 -0
  236. package/src/ui/skeleton/skeleton.ts +20 -0
  237. package/src/ui/slider/slider.module.css +56 -0
  238. package/src/ui/slider/slider.module.d.css.ts +6 -0
  239. package/src/ui/slider/slider.ts +48 -0
  240. package/src/ui/stepper/stepper.module.css +32 -0
  241. package/src/ui/stepper/stepper.module.d.css.ts +7 -0
  242. package/src/ui/stepper/stepper.ts +62 -0
  243. package/src/ui/tabs/tabs.module.css +38 -0
  244. package/src/ui/tabs/tabs.module.d.css.ts +6 -0
  245. package/src/ui/tabs/tabs.ts +24 -0
  246. package/src/ui/tag/tag.module.css +23 -0
  247. package/src/ui/tag/tag.module.d.css.ts +5 -0
  248. package/src/ui/tag/tag.ts +17 -0
  249. package/src/ui/tile/tile.module.css +137 -0
  250. package/src/ui/tile/tile.module.d.css.ts +13 -0
  251. package/src/ui/tile/tile.ts +69 -0
  252. package/src/ui/toasts/toasts.module.css +38 -0
  253. package/src/ui/toasts/toasts.module.d.css.ts +6 -0
  254. package/src/ui/toasts/toasts.ts +26 -0
  255. package/src/ui/toggle/toggle.module.css +46 -0
  256. package/src/ui/toggle/toggle.module.d.css.ts +6 -0
  257. package/src/ui/toggle/toggle.ts +29 -0
  258. package/src/ui/trail/trail.module.css +42 -0
  259. package/src/ui/trail/trail.module.d.css.ts +5 -0
  260. package/src/ui/trail/trail.ts +28 -0
@@ -0,0 +1,161 @@
1
+ /* flap: a split-flap readout. */
2
+
3
+ @layer standard.ui {
4
+ /*
5
+ * A split-flap readout, as on a departure board. Each cell holds a reel of
6
+ * every glyph and shows one of them; a new value rolls the reel past all
7
+ * the glyphs between, so a number is seen to count, not just to change.
8
+ */
9
+ .flap {
10
+ display: inline-flex;
11
+ column-gap: 1px;
12
+ font-weight: 700;
13
+ font-variant-numeric: tabular-nums;
14
+ letter-spacing: 0;
15
+ line-height: 1.5;
16
+ vertical-align: bottom;
17
+ }
18
+
19
+ .flap-cell {
20
+ inline-size: 0.82em;
21
+ block-size: 1lh;
22
+ background: var(--s-fg);
23
+ color: var(--s-bg);
24
+ overflow: clip;
25
+ }
26
+
27
+ .flap-reel {
28
+ display: grid;
29
+ justify-items: center;
30
+ translate: 0 calc(var(--s-ui-glyph, 0) * -1lh);
31
+ transition: translate calc(2 * var(--s-travel)) var(--s-glide);
32
+
33
+ & > span {
34
+ block-size: 1lh;
35
+ }
36
+ }
37
+
38
+ .g-0 {
39
+ --s-ui-glyph: 0;
40
+ }
41
+ .g-1 {
42
+ --s-ui-glyph: 1;
43
+ }
44
+ .g-2 {
45
+ --s-ui-glyph: 2;
46
+ }
47
+ .g-3 {
48
+ --s-ui-glyph: 3;
49
+ }
50
+ .g-4 {
51
+ --s-ui-glyph: 4;
52
+ }
53
+ .g-5 {
54
+ --s-ui-glyph: 5;
55
+ }
56
+ .g-6 {
57
+ --s-ui-glyph: 6;
58
+ }
59
+ .g-7 {
60
+ --s-ui-glyph: 7;
61
+ }
62
+ .g-8 {
63
+ --s-ui-glyph: 8;
64
+ }
65
+ .g-9 {
66
+ --s-ui-glyph: 9;
67
+ }
68
+ .g-10 {
69
+ --s-ui-glyph: 10;
70
+ }
71
+ .g-11 {
72
+ --s-ui-glyph: 11;
73
+ }
74
+ .g-12 {
75
+ --s-ui-glyph: 12;
76
+ }
77
+ .g-13 {
78
+ --s-ui-glyph: 13;
79
+ }
80
+ .g-14 {
81
+ --s-ui-glyph: 14;
82
+ }
83
+ .g-15 {
84
+ --s-ui-glyph: 15;
85
+ }
86
+ .g-16 {
87
+ --s-ui-glyph: 16;
88
+ }
89
+ .g-17 {
90
+ --s-ui-glyph: 17;
91
+ }
92
+ .g-18 {
93
+ --s-ui-glyph: 18;
94
+ }
95
+ .g-19 {
96
+ --s-ui-glyph: 19;
97
+ }
98
+ .g-20 {
99
+ --s-ui-glyph: 20;
100
+ }
101
+ .g-21 {
102
+ --s-ui-glyph: 21;
103
+ }
104
+ .g-22 {
105
+ --s-ui-glyph: 22;
106
+ }
107
+ .g-23 {
108
+ --s-ui-glyph: 23;
109
+ }
110
+ .g-24 {
111
+ --s-ui-glyph: 24;
112
+ }
113
+ .g-25 {
114
+ --s-ui-glyph: 25;
115
+ }
116
+ .g-26 {
117
+ --s-ui-glyph: 26;
118
+ }
119
+ .g-27 {
120
+ --s-ui-glyph: 27;
121
+ }
122
+ .g-28 {
123
+ --s-ui-glyph: 28;
124
+ }
125
+ .g-29 {
126
+ --s-ui-glyph: 29;
127
+ }
128
+ .g-30 {
129
+ --s-ui-glyph: 30;
130
+ }
131
+ .g-31 {
132
+ --s-ui-glyph: 31;
133
+ }
134
+ .g-32 {
135
+ --s-ui-glyph: 32;
136
+ }
137
+ .g-33 {
138
+ --s-ui-glyph: 33;
139
+ }
140
+ .g-34 {
141
+ --s-ui-glyph: 34;
142
+ }
143
+ .g-35 {
144
+ --s-ui-glyph: 35;
145
+ }
146
+ .g-36 {
147
+ --s-ui-glyph: 36;
148
+ }
149
+ .g-37 {
150
+ --s-ui-glyph: 37;
151
+ }
152
+ .g-38 {
153
+ --s-ui-glyph: 38;
154
+ }
155
+ .g-39 {
156
+ --s-ui-glyph: 39;
157
+ }
158
+ .g-40 {
159
+ --s-ui-glyph: 40;
160
+ }
161
+ }
@@ -0,0 +1,48 @@
1
+ declare const styles: {
2
+ readonly "flap": string;
3
+ readonly "flap-cell": string;
4
+ readonly "flap-reel": string;
5
+ readonly "g-0": string;
6
+ readonly "g-1": string;
7
+ readonly "g-10": string;
8
+ readonly "g-11": string;
9
+ readonly "g-12": string;
10
+ readonly "g-13": string;
11
+ readonly "g-14": string;
12
+ readonly "g-15": string;
13
+ readonly "g-16": string;
14
+ readonly "g-17": string;
15
+ readonly "g-18": string;
16
+ readonly "g-19": string;
17
+ readonly "g-2": string;
18
+ readonly "g-20": string;
19
+ readonly "g-21": string;
20
+ readonly "g-22": string;
21
+ readonly "g-23": string;
22
+ readonly "g-24": string;
23
+ readonly "g-25": string;
24
+ readonly "g-26": string;
25
+ readonly "g-27": string;
26
+ readonly "g-28": string;
27
+ readonly "g-29": string;
28
+ readonly "g-3": string;
29
+ readonly "g-30": string;
30
+ readonly "g-31": string;
31
+ readonly "g-32": string;
32
+ readonly "g-33": string;
33
+ readonly "g-34": string;
34
+ readonly "g-35": string;
35
+ readonly "g-36": string;
36
+ readonly "g-37": string;
37
+ readonly "g-38": string;
38
+ readonly "g-39": string;
39
+ readonly "g-4": string;
40
+ readonly "g-40": string;
41
+ readonly "g-5": string;
42
+ readonly "g-6": string;
43
+ readonly "g-7": string;
44
+ readonly "g-8": string;
45
+ readonly "g-9": string;
46
+ };
47
+ export = styles;
48
+
@@ -0,0 +1,78 @@
1
+ /**
2
+ * `flap`: a readout that rolls to a new value.
3
+ *
4
+ * @since 0.4.0
5
+ */
6
+ import type { Html } from "effect/ui/html"
7
+ import { node, type Node } from "../../Node.ts"
8
+ import styles from "./flap.module.css"
9
+
10
+ /** The glyphs on the reel of a split-flap cell, in the order it rolls through them, each with its class. */
11
+ const reel = [
12
+ ["\u00a0", styles["g-0"]],
13
+ ["0", styles["g-1"]],
14
+ ["1", styles["g-2"]],
15
+ ["2", styles["g-3"]],
16
+ ["3", styles["g-4"]],
17
+ ["4", styles["g-5"]],
18
+ ["5", styles["g-6"]],
19
+ ["6", styles["g-7"]],
20
+ ["7", styles["g-8"]],
21
+ ["8", styles["g-9"]],
22
+ ["9", styles["g-10"]],
23
+ ["A", styles["g-11"]],
24
+ ["B", styles["g-12"]],
25
+ ["C", styles["g-13"]],
26
+ ["D", styles["g-14"]],
27
+ ["E", styles["g-15"]],
28
+ ["F", styles["g-16"]],
29
+ ["G", styles["g-17"]],
30
+ ["H", styles["g-18"]],
31
+ ["I", styles["g-19"]],
32
+ ["J", styles["g-20"]],
33
+ ["K", styles["g-21"]],
34
+ ["L", styles["g-22"]],
35
+ ["M", styles["g-23"]],
36
+ ["N", styles["g-24"]],
37
+ ["O", styles["g-25"]],
38
+ ["P", styles["g-26"]],
39
+ ["Q", styles["g-27"]],
40
+ ["R", styles["g-28"]],
41
+ ["S", styles["g-29"]],
42
+ ["T", styles["g-30"]],
43
+ ["U", styles["g-31"]],
44
+ ["V", styles["g-32"]],
45
+ ["W", styles["g-33"]],
46
+ ["X", styles["g-34"]],
47
+ ["Y", styles["g-35"]],
48
+ ["Z", styles["g-36"]],
49
+ ["/", styles["g-37"]],
50
+ [":", styles["g-38"]],
51
+ ["-", styles["g-39"]],
52
+ [".", styles["g-40"]]
53
+ ] as const
54
+
55
+ export const flap = <Msg>(h: Html.H<Msg>) => ({
56
+ /**
57
+ * A readout of the kind a split-flap board gives: numbers and capital
58
+ * letters that roll to a new value through every glyph between. For a
59
+ * value that changes while it is watched, such as minutes, a count, or
60
+ * where the window is. Keep the text the same length, so each cell keeps
61
+ * its place. Anything not on the reel shows as a blank.
62
+ */
63
+ flap: (text: string): Node<"inline", Msg> =>
64
+ node(
65
+ h.span
66
+ .class(styles.flap)
67
+ .attr("role", "img")
68
+ .attr("aria-label", text)
69
+ .children(
70
+ [...text.toUpperCase().replaceAll(" ", "\u00a0")].map((glyph) =>
71
+ h.span
72
+ .class(styles["flap-cell"], reel.find(([on]) => on === glyph)?.[1] ?? reel[0][1])
73
+ .attr("aria-hidden", "true")
74
+ .children(h.span.class(styles["flap-reel"]).children(reel.map(([on]) => h.span.children(on))))
75
+ )
76
+ )
77
+ )
78
+ })
@@ -0,0 +1,39 @@
1
+ /* item: one thing in a list, and what can be done to it. */
2
+
3
+ @layer standard.ui {
4
+ /* Its actions are across its foot, edge to edge. */
5
+ .item {
6
+ display: grid;
7
+ grid-template-columns: minmax(0, 1fr);
8
+ }
9
+
10
+ /* What it says keeps the margin a row of a ruled list has. */
11
+ .item-body {
12
+ display: grid;
13
+ grid-template-columns: minmax(0, 1fr);
14
+ align-content: start;
15
+ row-gap: var(--s-unit);
16
+ padding: calc(1.5 * var(--s-unit)) calc(2 * var(--s-unit));
17
+ }
18
+
19
+ /* A row is a tint of its text, so its actions step on towards the text. Smaller than a dialog's, as the row is. */
20
+ .item-actions {
21
+ --s-ui-step: var(--s-fg);
22
+
23
+ & > button {
24
+ min-block-size: var(--s-target);
25
+ padding: calc(1.5 * var(--s-unit)) calc(2 * var(--s-unit));
26
+ }
27
+ }
28
+
29
+ /* Where there is room they are at the end of the row instead: as high as it, each as wide as its label needs, and the last out to the row's edge. */
30
+ @container s-page (inline-size >= 48rem) {
31
+ .item {
32
+ grid-template-columns: minmax(0, 1fr) auto;
33
+ }
34
+
35
+ .item > .item-actions {
36
+ grid-auto-columns: minmax(calc(14 * var(--s-unit)), auto);
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,7 @@
1
+ declare const styles: {
2
+ readonly "item": string;
3
+ readonly "item-actions": string;
4
+ readonly "item-body": string;
5
+ };
6
+ export = styles;
7
+
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `item`: one thing in a list, and what can be done to it.
3
+ *
4
+ * @since 0.4.0
5
+ */
6
+ import type { Html } from "effect/ui/html"
7
+ import { type Child, contents as inner, type Kind, node, type Node } from "../../Node.ts"
8
+ import { type Actions, actions } from "../control/control.ts"
9
+ import styles from "./item.module.css"
10
+
11
+ export const item = <Msg>(h: Html.H<Msg>) => ({
12
+ /**
13
+ * One thing in a ruled `list`, and what can be done to it. The actions are
14
+ * large buttons at the end of its row, as high as the row and out to its
15
+ * edge, as the answers of a `dialog` are across its bottom; where the page
16
+ * is narrow they are across the row's foot. They are part of the row's
17
+ * block, so there is no doubt which thing they act on.
18
+ */
19
+ item: <R = never>(
20
+ options: { readonly actions?: Actions<Msg> },
21
+ ...children: ReadonlyArray<Child<Kind, Msg, R>>
22
+ ): Node<"block", Msg, R> => {
23
+ const list = options.actions ?? []
24
+ return node(
25
+ h.div
26
+ .class(styles.item)
27
+ .children(
28
+ h.div.class(styles["item-body"]).children(inner(children)),
29
+ list.length > 0 && actions(h, styles["item-actions"], list)
30
+ )
31
+ )
32
+ }
33
+ })
@@ -0,0 +1,15 @@
1
+ /* key: a key of the keyboard. */
2
+
3
+ @layer standard.ui {
4
+ .key {
5
+ display: inline-block;
6
+ min-inline-size: 1.75em;
7
+ padding: 0 0.5em;
8
+ background: color-mix(in oklch, var(--s-fg) 16%, transparent);
9
+ font-size: 0.8em;
10
+ font-weight: 700;
11
+ line-height: 1.5;
12
+ text-align: start;
13
+ white-space: nowrap;
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ declare const styles: {
2
+ readonly "key": string;
3
+ };
4
+ export = styles;
5
+
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `key`: a key of the keyboard.
3
+ *
4
+ * @since 0.4.0
5
+ */
6
+ import type { Html } from "effect/ui/html"
7
+ import { node, type Node } from "../../Node.ts"
8
+ import styles from "./key.module.css"
9
+
10
+ export const key = <Msg>(h: Html.H<Msg>) => ({
11
+ /** A key of the keyboard. */
12
+ key: (label: string): Node<"inline", Msg> => node(h.kbd.class(styles.key).children(label))
13
+ })
@@ -0,0 +1,11 @@
1
+ /* menu: a few things to do, in a popover. */
2
+
3
+ @layer standard.ui {
4
+ .menu-item {
5
+ padding: calc((var(--s-target) - 1.5rem) / 2) calc(2 * var(--s-unit));
6
+ background: color-mix(in oklch, var(--s-fg) var(--s-ui-press), transparent);
7
+ line-height: 1.5rem;
8
+ font-weight: 700;
9
+ white-space: nowrap;
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ declare const styles: {
2
+ readonly "menu-item": string;
3
+ };
4
+ export = styles;
5
+
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `menu`: a few things to do, behind one button.
3
+ *
4
+ * @since 0.4.0
5
+ */
6
+ import type { Html } from "effect/ui/html"
7
+ import { node, type Node } from "../../Node.ts"
8
+ import control from "../control/control.module.css"
9
+ import { type Icon, leading } from "../../standard/icon/icon.ts"
10
+ import styles from "./menu.module.css"
11
+ import { anchored } from "../popover/popover.ts"
12
+
13
+ export const menu = <Msg>(h: Html.H<Msg>) => ({
14
+ /**
15
+ * A few things to do, behind one button. It opens against the button,
16
+ * closes on Escape, on a press anywhere else and on a choice, and gives
17
+ * the focus back.
18
+ */
19
+ menu: (options: {
20
+ readonly name: string
21
+ readonly label: string
22
+ readonly items: ReadonlyArray<{
23
+ readonly label: string
24
+ readonly onPress: Msg
25
+ readonly icon?: Icon
26
+ readonly disabled?: boolean
27
+ }>
28
+ }): Node<"block", Msg> => {
29
+ const id = h.id(`s-ui-popover-${options.name}`)
30
+ return node(
31
+ anchored(
32
+ h,
33
+ { name: options.name, label: options.label, role: "menu" },
34
+ options.items.map((item) =>
35
+ h.button
36
+ .class(control.control, styles["menu-item"])
37
+ .attr("type", "button")
38
+ .attr("role", "menuitem")
39
+ .attr("popovertarget", id)
40
+ .attr("popovertargetaction", "hide")
41
+ .disabled(item.disabled === true)
42
+ .on("click", item.onPress)
43
+ .children(leading(h, item.icon), item.label)
44
+ )
45
+ ).content
46
+ )
47
+ }
48
+ })
@@ -0,0 +1,66 @@
1
+ /* What a sheet and a dialog share. */
2
+
3
+ @layer standard.ui {
4
+ /*
5
+ * Neither is a layer over the page. A sheet is the place next to this one
6
+ * on the canvas: the window moves over to it, so the page slides out by
7
+ * exactly as much as the sheet slides in, and back again when the sheet
8
+ * closes. A dialog comes down into the window from above. Behind a sheet
9
+ * nothing is dimmed: the page has moved aside. Behind a dialog the page
10
+ * steps back, under a veil of its own ground. And nothing fades: where
11
+ * things are says what is going on. Each is told apart from the page by
12
+ * its ground: a sheet is a step from the page's, a dialog is the accent.
13
+ */
14
+
15
+ .modal {
16
+ position: fixed;
17
+ max-inline-size: none;
18
+ max-block-size: none;
19
+ padding: calc(3 * var(--s-unit));
20
+ background: var(--s-bg);
21
+ color: var(--s-fg);
22
+ overflow-y: auto;
23
+ overscroll-behavior: contain;
24
+ transition:
25
+ translate var(--s-travel) var(--s-glide),
26
+ display var(--s-travel) allow-discrete,
27
+ overlay var(--s-travel) allow-discrete;
28
+
29
+ &[open] {
30
+ display: grid;
31
+ grid-template-columns: minmax(0, 1fr);
32
+ align-content: start;
33
+ row-gap: calc(3 * var(--s-unit));
34
+ translate: 0 0;
35
+ }
36
+
37
+ /* It takes presses meant for the page, and shows nothing. */
38
+ &::backdrop {
39
+ background: transparent;
40
+ }
41
+ }
42
+
43
+ .modal-head {
44
+ display: grid;
45
+ grid-template-columns: minmax(0, 1fr) auto;
46
+ column-gap: var(--s-gutter);
47
+ align-items: start;
48
+ }
49
+
50
+ .modal-body {
51
+ display: contents;
52
+ }
53
+
54
+ .modal-title {
55
+ font-size: 1.5rem;
56
+ line-height: 2rem;
57
+ font-weight: 700;
58
+ letter-spacing: -0.015em;
59
+ }
60
+ }
61
+
62
+ @media print {
63
+ .modal {
64
+ display: none;
65
+ }
66
+ }
@@ -0,0 +1,8 @@
1
+ declare const styles: {
2
+ readonly "modal": string;
3
+ readonly "modal-body": string;
4
+ readonly "modal-head": string;
5
+ readonly "modal-title": string;
6
+ };
7
+ export = styles;
8
+
@@ -0,0 +1,55 @@
1
+ /**
2
+ * What a `sheet` and a `dialog` share: a modal `dialog` element with a
3
+ * title and the button that closes it.
4
+ *
5
+ * @since 0.4.0
6
+ */
7
+ import type { View } from "effect/ui"
8
+ import type { Html } from "effect/ui/html"
9
+ import { type Child, content, contents as inner, type Kind } from "../../Node.ts"
10
+ import { button } from "../../standard/button/button.ts"
11
+ import styles from "./modal.module.css"
12
+
13
+ /** The Model decides when it is open. */
14
+ export const modal = <Msg, R>(
15
+ h: Html.H<Msg>,
16
+ name: "sheet" | "dialog",
17
+ look: ReadonlyArray<string | false>,
18
+ options: {
19
+ readonly open: boolean
20
+ readonly title: string
21
+ readonly close: { readonly label: string; readonly onPress: Msg }
22
+ readonly alert?: boolean
23
+ },
24
+ children: ReadonlyArray<Child<Kind, Msg, R>>,
25
+ /** What comes after its children, at its bottom. */
26
+ foot?: View.Input<Msg>
27
+ ) => {
28
+ const id = h.id(`s-ui-${name}-title`)
29
+ return (
30
+ h.dialog
31
+ .class(styles.modal, ...look)
32
+ .attr("role", options.alert === true ? "alertdialog" : undefined)
33
+ .attr("aria-labelledby", id)
34
+ // A question that must be answered isn't dismissed by a press outside it.
35
+ .attr("closedby", options.alert === true ? "closerequest" : "any")
36
+ .modal(options.open)
37
+ .on("cancel", options.close.onPress)
38
+ .children(
39
+ h.div
40
+ .class(styles["modal-head"])
41
+ .children(
42
+ h.h2.class(styles["modal-title"]).attr("id", id).children(options.title),
43
+ content(
44
+ button(h).button(
45
+ { kind: "secondary", icon: "close", onClick: options.close.onPress },
46
+ options.close.label
47
+ )
48
+ )
49
+ ),
50
+ // Its own box only where a sheet needs one to scroll in; everywhere else its children are laid out as the dialog's own.
51
+ h.div.class(styles["modal-body"]).children(inner(children)),
52
+ foot
53
+ )
54
+ )
55
+ }