@moni-labs/moni-ui 0.2.0 → 0.3.0

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 (323) hide show
  1. package/README.md +52 -194
  2. package/custom-elements.json +1636 -350
  3. package/dist/actions/index.d.ts +6 -0
  4. package/dist/actions/index.d.ts.map +1 -1
  5. package/dist/actions/index.js +6 -0
  6. package/dist/components/_base/field-styles.d.ts +51 -16
  7. package/dist/components/_base/field-styles.d.ts.map +1 -1
  8. package/dist/components/_base/field-styles.js +164 -36
  9. package/dist/components/_base/index.d.ts +25 -0
  10. package/dist/components/_base/index.d.ts.map +1 -1
  11. package/dist/components/_base/index.js +25 -0
  12. package/dist/components/_base/interaction-styles.d.ts +39 -12
  13. package/dist/components/_base/interaction-styles.d.ts.map +1 -1
  14. package/dist/components/_base/interaction-styles.js +85 -33
  15. package/dist/components/_base/moni-element.d.ts +43 -8
  16. package/dist/components/_base/moni-element.d.ts.map +1 -1
  17. package/dist/components/_base/moni-element.js +43 -8
  18. package/dist/components/_base/shared-styles.d.ts +41 -17
  19. package/dist/components/_base/shared-styles.d.ts.map +1 -1
  20. package/dist/components/_base/shared-styles.js +113 -21
  21. package/dist/components/index.d.ts +6 -0
  22. package/dist/components/index.d.ts.map +1 -1
  23. package/dist/components/index.js +6 -0
  24. package/dist/components/loading-shapes.d.ts +6 -0
  25. package/dist/components/loading-shapes.d.ts.map +1 -1
  26. package/dist/components/loading-shapes.js +6 -0
  27. package/dist/components/moni-app-bar.d.ts +128 -33
  28. package/dist/components/moni-app-bar.d.ts.map +1 -1
  29. package/dist/components/moni-app-bar.js +121 -26
  30. package/dist/components/moni-badge.d.ts +122 -14
  31. package/dist/components/moni-badge.d.ts.map +1 -1
  32. package/dist/components/moni-badge.js +122 -14
  33. package/dist/components/moni-bottom-sheet.d.ts +120 -15
  34. package/dist/components/moni-bottom-sheet.d.ts.map +1 -1
  35. package/dist/components/moni-bottom-sheet.js +116 -12
  36. package/dist/components/moni-button-group.d.ts +53 -27
  37. package/dist/components/moni-button-group.d.ts.map +1 -1
  38. package/dist/components/moni-button-group.js +49 -23
  39. package/dist/components/moni-button-segment.d.ts +28 -8
  40. package/dist/components/moni-button-segment.d.ts.map +1 -1
  41. package/dist/components/moni-button-segment.js +27 -7
  42. package/dist/components/moni-button.d.ts +51 -32
  43. package/dist/components/moni-button.d.ts.map +1 -1
  44. package/dist/components/moni-button.js +50 -31
  45. package/dist/components/moni-card.d.ts +91 -31
  46. package/dist/components/moni-card.d.ts.map +1 -1
  47. package/dist/components/moni-card.js +86 -26
  48. package/dist/components/moni-carousel.d.ts +67 -17
  49. package/dist/components/moni-carousel.d.ts.map +1 -1
  50. package/dist/components/moni-carousel.js +59 -16
  51. package/dist/components/moni-checkbox.d.ts +122 -17
  52. package/dist/components/moni-checkbox.d.ts.map +1 -1
  53. package/dist/components/moni-checkbox.js +118 -14
  54. package/dist/components/moni-chip.d.ts +56 -30
  55. package/dist/components/moni-chip.d.ts.map +1 -1
  56. package/dist/components/moni-chip.js +51 -25
  57. package/dist/components/moni-color-field.d.ts +44 -6
  58. package/dist/components/moni-color-field.d.ts.map +1 -1
  59. package/dist/components/moni-color-field.js +43 -5
  60. package/dist/components/moni-context-menu.d.ts +44 -22
  61. package/dist/components/moni-context-menu.d.ts.map +1 -1
  62. package/dist/components/moni-context-menu.js +43 -21
  63. package/dist/components/moni-dialog.d.ts +107 -15
  64. package/dist/components/moni-dialog.d.ts.map +1 -1
  65. package/dist/components/moni-dialog.js +105 -14
  66. package/dist/components/moni-divider.d.ts +50 -15
  67. package/dist/components/moni-divider.d.ts.map +1 -1
  68. package/dist/components/moni-divider.js +49 -14
  69. package/dist/components/moni-expansion.d.ts +44 -8
  70. package/dist/components/moni-expansion.d.ts.map +1 -1
  71. package/dist/components/moni-expansion.js +43 -7
  72. package/dist/components/moni-fab-menu.d.ts +39 -20
  73. package/dist/components/moni-fab-menu.d.ts.map +1 -1
  74. package/dist/components/moni-fab-menu.js +38 -19
  75. package/dist/components/moni-fab.d.ts +49 -23
  76. package/dist/components/moni-fab.d.ts.map +1 -1
  77. package/dist/components/moni-fab.js +46 -20
  78. package/dist/components/moni-file-field.d.ts +54 -14
  79. package/dist/components/moni-file-field.d.ts.map +1 -1
  80. package/dist/components/moni-file-field.js +53 -13
  81. package/dist/components/moni-icon.d.ts +78 -11
  82. package/dist/components/moni-icon.d.ts.map +1 -1
  83. package/dist/components/moni-icon.js +77 -10
  84. package/dist/components/moni-list-item.d.ts +61 -30
  85. package/dist/components/moni-list-item.d.ts.map +1 -1
  86. package/dist/components/moni-list-item.js +55 -24
  87. package/dist/components/moni-list.d.ts +37 -13
  88. package/dist/components/moni-list.d.ts.map +1 -1
  89. package/dist/components/moni-list.js +36 -12
  90. package/dist/components/moni-loading-indicator.d.ts +38 -11
  91. package/dist/components/moni-loading-indicator.d.ts.map +1 -1
  92. package/dist/components/moni-loading-indicator.js +37 -10
  93. package/dist/components/moni-menu-item.d.ts +31 -8
  94. package/dist/components/moni-menu-item.d.ts.map +1 -1
  95. package/dist/components/moni-menu-item.js +30 -7
  96. package/dist/components/moni-menu.d.ts +58 -33
  97. package/dist/components/moni-menu.d.ts.map +1 -1
  98. package/dist/components/moni-menu.js +51 -26
  99. package/dist/components/moni-morph-modal.d.ts +7 -1
  100. package/dist/components/moni-morph-modal.d.ts.map +1 -1
  101. package/dist/components/moni-morph-modal.js +46 -24
  102. package/dist/components/moni-nav-item.d.ts +50 -10
  103. package/dist/components/moni-nav-item.d.ts.map +1 -1
  104. package/dist/components/moni-nav-item.js +48 -8
  105. package/dist/components/moni-nav.d.ts +57 -22
  106. package/dist/components/moni-nav.d.ts.map +1 -1
  107. package/dist/components/moni-nav.js +53 -18
  108. package/dist/components/moni-progress.d.ts +108 -20
  109. package/dist/components/moni-progress.d.ts.map +1 -1
  110. package/dist/components/moni-progress.js +104 -16
  111. package/dist/components/moni-radio.d.ts +106 -14
  112. package/dist/components/moni-radio.d.ts.map +1 -1
  113. package/dist/components/moni-radio.js +104 -13
  114. package/dist/components/moni-ripple.d.ts +121 -10
  115. package/dist/components/moni-ripple.d.ts.map +1 -1
  116. package/dist/components/moni-ripple.js +120 -9
  117. package/dist/components/moni-segmented-button.d.ts +31 -11
  118. package/dist/components/moni-segmented-button.d.ts.map +1 -1
  119. package/dist/components/moni-segmented-button.js +30 -10
  120. package/dist/components/moni-select-option.d.ts +43 -9
  121. package/dist/components/moni-select-option.d.ts.map +1 -1
  122. package/dist/components/moni-select-option.js +41 -7
  123. package/dist/components/moni-select.d.ts +59 -2
  124. package/dist/components/moni-select.d.ts.map +1 -1
  125. package/dist/components/moni-select.js +58 -1
  126. package/dist/components/moni-shape.d.ts +1 -1
  127. package/dist/components/moni-side-sheet.d.ts +56 -19
  128. package/dist/components/moni-side-sheet.d.ts.map +1 -1
  129. package/dist/components/moni-side-sheet.js +53 -16
  130. package/dist/components/moni-slider.d.ts +56 -25
  131. package/dist/components/moni-slider.d.ts.map +1 -1
  132. package/dist/components/moni-slider.js +55 -24
  133. package/dist/components/moni-snackbar.d.ts +86 -17
  134. package/dist/components/moni-snackbar.d.ts.map +1 -1
  135. package/dist/components/moni-snackbar.js +85 -16
  136. package/dist/components/moni-split-button.d.ts +38 -9
  137. package/dist/components/moni-split-button.d.ts.map +1 -1
  138. package/dist/components/moni-split-button.js +37 -8
  139. package/dist/components/moni-step.d.ts +42 -9
  140. package/dist/components/moni-step.d.ts.map +1 -1
  141. package/dist/components/moni-step.js +41 -8
  142. package/dist/components/moni-stepper.d.ts +43 -6
  143. package/dist/components/moni-stepper.d.ts.map +1 -1
  144. package/dist/components/moni-stepper.js +42 -5
  145. package/dist/components/moni-switch.d.ts +103 -16
  146. package/dist/components/moni-switch.d.ts.map +1 -1
  147. package/dist/components/moni-switch.js +99 -13
  148. package/dist/components/moni-tab.d.ts +35 -8
  149. package/dist/components/moni-tab.d.ts.map +1 -1
  150. package/dist/components/moni-tab.js +34 -7
  151. package/dist/components/moni-tabs.d.ts +51 -13
  152. package/dist/components/moni-tabs.d.ts.map +1 -1
  153. package/dist/components/moni-tabs.js +48 -10
  154. package/dist/components/moni-text-field.d.ts +55 -10
  155. package/dist/components/moni-text-field.d.ts.map +1 -1
  156. package/dist/components/moni-text-field.js +54 -9
  157. package/dist/components/moni-textarea.d.ts +51 -21
  158. package/dist/components/moni-textarea.d.ts.map +1 -1
  159. package/dist/components/moni-textarea.js +48 -18
  160. package/dist/components/moni-time-picker.d.ts +41 -11
  161. package/dist/components/moni-time-picker.d.ts.map +1 -1
  162. package/dist/components/moni-time-picker.js +40 -10
  163. package/dist/components/moni-toolbar.d.ts +43 -15
  164. package/dist/components/moni-toolbar.d.ts.map +1 -1
  165. package/dist/components/moni-toolbar.js +42 -14
  166. package/dist/components/moni-tooltip.d.ts +55 -25
  167. package/dist/components/moni-tooltip.d.ts.map +1 -1
  168. package/dist/components/moni-tooltip.js +54 -24
  169. package/dist/components/moni-typography.d.ts +43 -18
  170. package/dist/components/moni-typography.d.ts.map +1 -1
  171. package/dist/components/moni-typography.js +42 -17
  172. package/dist/index.d.ts +47 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +59 -2
  175. package/dist/styles/tailwind.css +67 -0
  176. package/dist/styles/tokens.css +111 -99
  177. package/dist/utils/color.d.ts +181 -2
  178. package/dist/utils/color.d.ts.map +1 -1
  179. package/dist/utils/color.js +182 -4
  180. package/dist/utils/theme.svelte.d.ts +305 -2
  181. package/dist/utils/theme.svelte.d.ts.map +1 -1
  182. package/dist/utils/theme.svelte.js +331 -2
  183. package/dist/web-components.d.ts +28 -0
  184. package/dist/web-components.d.ts.map +1 -1
  185. package/dist/web-components.js +29 -2
  186. package/package.json +1 -1
  187. package/src/actions/index.ts +7 -0
  188. package/src/components/_base/field-styles.ts +165 -37
  189. package/src/components/_base/index.ts +27 -0
  190. package/src/components/_base/interaction-styles.ts +86 -33
  191. package/src/components/_base/moni-element.ts +44 -8
  192. package/src/components/_base/shared-styles.ts +114 -21
  193. package/src/components/index.ts +7 -0
  194. package/src/components/loading-shapes.ts +7 -0
  195. package/src/components/moni-app-bar.ts +127 -26
  196. package/src/components/moni-badge.ts +128 -14
  197. package/src/components/moni-bottom-sheet.ts +125 -13
  198. package/src/components/moni-button-group.ts +50 -23
  199. package/src/components/moni-button-segment.ts +28 -7
  200. package/src/components/moni-button.ts +51 -31
  201. package/src/components/moni-card.ts +90 -26
  202. package/src/components/moni-carousel.ts +67 -16
  203. package/src/components/moni-checkbox.ts +125 -14
  204. package/src/components/moni-chip.ts +52 -25
  205. package/src/components/moni-color-field.ts +44 -5
  206. package/src/components/moni-context-menu.ts +44 -21
  207. package/src/components/moni-dialog.ts +111 -14
  208. package/src/components/moni-divider.ts +50 -14
  209. package/src/components/moni-expansion.ts +44 -7
  210. package/src/components/moni-fab-menu.ts +39 -19
  211. package/src/components/moni-fab.ts +47 -20
  212. package/src/components/moni-file-field.ts +54 -13
  213. package/src/components/moni-icon.ts +80 -10
  214. package/src/components/moni-list-item.ts +56 -24
  215. package/src/components/moni-list.ts +37 -12
  216. package/src/components/moni-loading-indicator.ts +38 -10
  217. package/src/components/moni-menu-item.ts +31 -7
  218. package/src/components/moni-menu.ts +52 -26
  219. package/src/components/moni-morph-modal.ts +58 -24
  220. package/src/components/moni-nav-item.ts +49 -8
  221. package/src/components/moni-nav.ts +54 -18
  222. package/src/components/moni-progress.ts +109 -16
  223. package/src/components/moni-radio.ts +111 -13
  224. package/src/components/moni-ripple.ts +126 -9
  225. package/src/components/moni-segmented-button.ts +31 -10
  226. package/src/components/moni-select-option.ts +42 -7
  227. package/src/components/moni-select.ts +79 -1
  228. package/src/components/moni-side-sheet.ts +54 -16
  229. package/src/components/moni-slider.ts +56 -24
  230. package/src/components/moni-snackbar.ts +90 -16
  231. package/src/components/moni-split-button.ts +38 -8
  232. package/src/components/moni-step.ts +42 -8
  233. package/src/components/moni-stepper.ts +43 -5
  234. package/src/components/moni-switch.ts +106 -13
  235. package/src/components/moni-tab.ts +35 -7
  236. package/src/components/moni-tabs.ts +49 -10
  237. package/src/components/moni-text-field.ts +55 -9
  238. package/src/components/moni-textarea.ts +49 -18
  239. package/src/components/moni-time-picker.ts +41 -10
  240. package/src/components/moni-toolbar.ts +43 -14
  241. package/src/components/moni-tooltip.ts +55 -24
  242. package/src/components/moni-typography.ts +43 -17
  243. package/src/index.ts +67 -3
  244. package/src/styles/tailwind.css +67 -0
  245. package/src/styles/tokens.css +111 -99
  246. package/src/types/svelte-runes.d.ts +64 -2
  247. package/src/utils/color.ts +286 -5
  248. package/src/utils/theme.svelte.ts +411 -2
  249. package/src/web-components.ts +31 -2
  250. package/dist/assets/shapes/arch.svg +0 -1
  251. package/dist/assets/shapes/arrow.svg +0 -1
  252. package/dist/assets/shapes/boom.svg +0 -1
  253. package/dist/assets/shapes/burst.svg +0 -1
  254. package/dist/assets/shapes/circle.svg +0 -1
  255. package/dist/assets/shapes/clamshell.svg +0 -1
  256. package/dist/assets/shapes/diamond.svg +0 -1
  257. package/dist/assets/shapes/fan.svg +0 -1
  258. package/dist/assets/shapes/flower.svg +0 -1
  259. package/dist/assets/shapes/gem.svg +0 -1
  260. package/dist/assets/shapes/ghost-ish.svg +0 -1
  261. package/dist/assets/shapes/heart.svg +0 -1
  262. package/dist/assets/shapes/leaf-clover4.svg +0 -1
  263. package/dist/assets/shapes/leaf-clover8.svg +0 -1
  264. package/dist/assets/shapes/loading-indicator.svg +0 -1
  265. package/dist/assets/shapes/oval.svg +0 -1
  266. package/dist/assets/shapes/pentagon.svg +0 -1
  267. package/dist/assets/shapes/pill.svg +0 -1
  268. package/dist/assets/shapes/pixel-circle.svg +0 -1
  269. package/dist/assets/shapes/pixel-triangle.svg +0 -1
  270. package/dist/assets/shapes/puffy-diamond.svg +0 -1
  271. package/dist/assets/shapes/puffy.svg +0 -1
  272. package/dist/assets/shapes/semicircle.svg +0 -1
  273. package/dist/assets/shapes/sided-cookie12.svg +0 -1
  274. package/dist/assets/shapes/sided-cookie4.svg +0 -1
  275. package/dist/assets/shapes/sided-cookie6.svg +0 -1
  276. package/dist/assets/shapes/sided-cookie7.svg +0 -1
  277. package/dist/assets/shapes/sided-cookie9.svg +0 -1
  278. package/dist/assets/shapes/slanted.svg +0 -1
  279. package/dist/assets/shapes/soft-boom.svg +0 -1
  280. package/dist/assets/shapes/soft-burst.svg +0 -1
  281. package/dist/assets/shapes/square.svg +0 -1
  282. package/dist/assets/shapes/sunny.svg +0 -1
  283. package/dist/assets/shapes/triangle.svg +0 -1
  284. package/dist/assets/shapes/very-sunny.svg +0 -1
  285. package/dist/assets/shapes/wavy-circle.svg +0 -1
  286. package/dist/assets/shapes/wavy.svg +0 -1
  287. package/src/assets/shapes/arch.svg +0 -1
  288. package/src/assets/shapes/arrow.svg +0 -1
  289. package/src/assets/shapes/boom.svg +0 -1
  290. package/src/assets/shapes/burst.svg +0 -1
  291. package/src/assets/shapes/circle.svg +0 -1
  292. package/src/assets/shapes/clamshell.svg +0 -1
  293. package/src/assets/shapes/diamond.svg +0 -1
  294. package/src/assets/shapes/fan.svg +0 -1
  295. package/src/assets/shapes/flower.svg +0 -1
  296. package/src/assets/shapes/gem.svg +0 -1
  297. package/src/assets/shapes/ghost-ish.svg +0 -1
  298. package/src/assets/shapes/heart.svg +0 -1
  299. package/src/assets/shapes/leaf-clover4.svg +0 -1
  300. package/src/assets/shapes/leaf-clover8.svg +0 -1
  301. package/src/assets/shapes/loading-indicator.svg +0 -1
  302. package/src/assets/shapes/oval.svg +0 -1
  303. package/src/assets/shapes/pentagon.svg +0 -1
  304. package/src/assets/shapes/pill.svg +0 -1
  305. package/src/assets/shapes/pixel-circle.svg +0 -1
  306. package/src/assets/shapes/pixel-triangle.svg +0 -1
  307. package/src/assets/shapes/puffy-diamond.svg +0 -1
  308. package/src/assets/shapes/puffy.svg +0 -1
  309. package/src/assets/shapes/semicircle.svg +0 -1
  310. package/src/assets/shapes/sided-cookie12.svg +0 -1
  311. package/src/assets/shapes/sided-cookie4.svg +0 -1
  312. package/src/assets/shapes/sided-cookie6.svg +0 -1
  313. package/src/assets/shapes/sided-cookie7.svg +0 -1
  314. package/src/assets/shapes/sided-cookie9.svg +0 -1
  315. package/src/assets/shapes/slanted.svg +0 -1
  316. package/src/assets/shapes/soft-boom.svg +0 -1
  317. package/src/assets/shapes/soft-burst.svg +0 -1
  318. package/src/assets/shapes/square.svg +0 -1
  319. package/src/assets/shapes/sunny.svg +0 -1
  320. package/src/assets/shapes/triangle.svg +0 -1
  321. package/src/assets/shapes/very-sunny.svg +0 -1
  322. package/src/assets/shapes/wavy-circle.svg +0 -1
  323. package/src/assets/shapes/wavy.svg +0 -1
@@ -1,3 +1,28 @@
1
+ /**
2
+ * @file components/_base/index.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+ /**
8
+ * @module _base
9
+ *
10
+ * Re-exports the foundational building blocks shared by all Moni Web Components.
11
+ *
12
+ * **Exports:**
13
+ * - {@link MoniElement} — Abstract LitElement base class every component extends.
14
+ * - {@link sharedStyles} — Baseline CSS: box-sizing, token bridge, utility classes.
15
+ * - {@link fieldStyles} — CSS for field-like input components (text-field, select, etc.).
16
+ *
17
+ * `interactionStyles` is intentionally **not** re-exported from this barrel —
18
+ * it should be imported directly by components that need state layers to avoid
19
+ * adding its CSS to components that don't use `.interactive`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
24
+ * ```
25
+ */
1
26
  export { MoniElement } from './moni-element.js';
2
27
  export { sharedStyles } from './shared-styles.js';
3
28
  export { fieldStyles } from './field-styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/_base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/_base/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,28 @@
1
+ /**
2
+ * @file components/_base/index.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+ /**
8
+ * @module _base
9
+ *
10
+ * Re-exports the foundational building blocks shared by all Moni Web Components.
11
+ *
12
+ * **Exports:**
13
+ * - {@link MoniElement} — Abstract LitElement base class every component extends.
14
+ * - {@link sharedStyles} — Baseline CSS: box-sizing, token bridge, utility classes.
15
+ * - {@link fieldStyles} — CSS for field-like input components (text-field, select, etc.).
16
+ *
17
+ * `interactionStyles` is intentionally **not** re-exported from this barrel —
18
+ * it should be imported directly by components that need state layers to avoid
19
+ * adding its CSS to components that don't use `.interactive`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
24
+ * ```
25
+ */
1
26
  export { MoniElement } from './moni-element.js';
2
27
  export { sharedStyles } from './shared-styles.js';
3
28
  export { fieldStyles } from './field-styles.js';
@@ -1,21 +1,48 @@
1
1
  /**
2
- * M3 State Layer system — CSS-only implementation.
2
+ * @file components/_base/interaction-styles.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+ /**
8
+ * Material Design 3 State Layer system — CSS-only implementation.
9
+ *
10
+ * Material Design 3 defines **state layers** as semi-transparent color overlays
11
+ * that communicate interactive state visually to the user. They are applied on
12
+ * top of a component's background without altering its base color, allowing
13
+ * correct rendering across all surface and container colors.
3
14
  *
4
- * Material Design 3 defines "state layers" as semi-transparent overlays that
5
- * communicate interactive state: hover, focus, pressed, dragged. These are
6
- * applied via a `::before` pseudo-element so they compose with any background.
15
+ * **M3 state layer opacity values (from the spec):**
16
+ * | State | Opacity |
17
+ * |-----------|---------|
18
+ * | Hover | 8% |
19
+ * | Focus | 12% |
20
+ * | Pressed | 12% |
21
+ * | Dragged | 16% |
7
22
  *
8
- * The host element MUST have:
9
- * position: relative (so the pseudo-element positions inside it)
10
- * overflow: hidden (so the layer clips to the element's shape)
23
+ * **Implementation strategy:**
24
+ * The state layer is rendered as a `::before` pseudo-element whose `opacity`
25
+ * transitions between states. A second `::after` pseudo-element provides a
26
+ * CSS-only center-origin ripple on press. For pointer-origin ripples
27
+ * (where the ripple starts at the tap/click point), use `<moni-ripple>` instead.
11
28
  *
12
- * Usage include in any interactive component's `static styles`:
13
- * static override styles = [sharedStyles, interactionStyles, css`...`];
29
+ * **Host element requirements:**
30
+ * The element bearing the `.interactive` class MUST have:
31
+ * - `position: relative` — so `::before` / `::after` are contained within it.
32
+ * - `overflow: hidden` — so the expanding ripple clips to the element's shape.
33
+ * - `isolation: isolate` — prevents the pseudo-elements from bleeding into
34
+ * stacking contexts created by parent elements.
14
35
  *
15
- * The `.interactive` class activates the state layer. Apply it to the inner
16
- * element (button, anchor, div) that the user interacts with.
36
+ * **Usage:**
37
+ * ```ts
38
+ * static override styles = [sharedStyles, interactionStyles, css`...`];
39
+ * ```
40
+ * Then in the template:
41
+ * ```html
42
+ * <button class="interactive">Click me</button>
43
+ * ```
17
44
  *
18
- * Reference: https://m3.material.io/foundations/interaction/states/overview
45
+ * @see {@link https://m3.material.io/foundations/interaction/states/overview M3 State overview}
19
46
  */
20
47
  export declare const interactionStyles: import("lit").CSSResult;
21
48
  export default interactionStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"interaction-styles.d.ts","sourceRoot":"","sources":["../../../src/components/_base/interaction-styles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,yBAqG7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"interaction-styles.d.ts","sourceRoot":"","sources":["../../../src/components/_base/interaction-styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,iBAAiB,yBA8H7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,106 +1,156 @@
1
+ /**
2
+ * @file components/_base/interaction-styles.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  import { css } from 'lit';
2
8
  /**
3
- * M3 State Layer system — CSS-only implementation.
9
+ * Material Design 3 State Layer system — CSS-only implementation.
10
+ *
11
+ * Material Design 3 defines **state layers** as semi-transparent color overlays
12
+ * that communicate interactive state visually to the user. They are applied on
13
+ * top of a component's background without altering its base color, allowing
14
+ * correct rendering across all surface and container colors.
4
15
  *
5
- * Material Design 3 defines "state layers" as semi-transparent overlays that
6
- * communicate interactive state: hover, focus, pressed, dragged. These are
7
- * applied via a `::before` pseudo-element so they compose with any background.
16
+ * **M3 state layer opacity values (from the spec):**
17
+ * | State | Opacity |
18
+ * |-----------|---------|
19
+ * | Hover | 8% |
20
+ * | Focus | 12% |
21
+ * | Pressed | 12% |
22
+ * | Dragged | 16% |
8
23
  *
9
- * The host element MUST have:
10
- * position: relative (so the pseudo-element positions inside it)
11
- * overflow: hidden (so the layer clips to the element's shape)
24
+ * **Implementation strategy:**
25
+ * The state layer is rendered as a `::before` pseudo-element whose `opacity`
26
+ * transitions between states. A second `::after` pseudo-element provides a
27
+ * CSS-only center-origin ripple on press. For pointer-origin ripples
28
+ * (where the ripple starts at the tap/click point), use `<moni-ripple>` instead.
12
29
  *
13
- * Usage include in any interactive component's `static styles`:
14
- * static override styles = [sharedStyles, interactionStyles, css`...`];
30
+ * **Host element requirements:**
31
+ * The element bearing the `.interactive` class MUST have:
32
+ * - `position: relative` — so `::before` / `::after` are contained within it.
33
+ * - `overflow: hidden` — so the expanding ripple clips to the element's shape.
34
+ * - `isolation: isolate` — prevents the pseudo-elements from bleeding into
35
+ * stacking contexts created by parent elements.
15
36
  *
16
- * The `.interactive` class activates the state layer. Apply it to the inner
17
- * element (button, anchor, div) that the user interacts with.
37
+ * **Usage:**
38
+ * ```ts
39
+ * static override styles = [sharedStyles, interactionStyles, css`...`];
40
+ * ```
41
+ * Then in the template:
42
+ * ```html
43
+ * <button class="interactive">Click me</button>
44
+ * ```
18
45
  *
19
- * Reference: https://m3.material.io/foundations/interaction/states/overview
46
+ * @see {@link https://m3.material.io/foundations/interaction/states/overview M3 State overview}
20
47
  */
21
48
  export const interactionStyles = css `
22
- /* ─── State layer opacity tokens (M3 spec) ─── */
49
+ /* ─── State layer opacity tokens (M3 spec values) ──────────────────────── */
23
50
  :host {
51
+ /** Opacity applied on hover. M3 spec: 8%. */
24
52
  --_state-hover: 0.08;
53
+ /** Opacity applied on keyboard focus. M3 spec: 12%. */
25
54
  --_state-focus: 0.12;
55
+ /** Opacity applied on press/active. M3 spec: 12%. */
26
56
  --_state-pressed: 0.12;
57
+ /** Opacity applied during drag. M3 spec: 16%. */
27
58
  --_state-dragged: 0.16;
59
+ /**
60
+ * Color of the state layer overlay.
61
+ * Defaults to currentColor so it adapts to the element's text color.
62
+ * Override with --_state-color: var(--primary) for selected states.
63
+ */
28
64
  --_state-color: currentColor;
29
65
  }
30
66
 
31
- /* ─── The pseudo-element overlay ─── */
67
+ /* ─── The interactive container ─────────────────────────────────────────── */
32
68
  .interactive {
33
69
  position: relative;
34
70
  overflow: hidden;
35
- /* Needed for ripple containment */
71
+ /* isolation: isolate prevents the pseudo-elements from mixing with
72
+ parent stacking contexts that use opacity or transform. */
36
73
  isolation: isolate;
37
74
  }
38
75
 
76
+ /* ─── State layer pseudo-element (::before) ─────────────────────────────── */
77
+ /* The layer sits above the element's background but below its content. */
39
78
  .interactive::before {
40
79
  content: '';
41
80
  position: absolute;
42
81
  inset: 0;
82
+ /* Inherit the border-radius from the host so the layer clips correctly
83
+ on rounded buttons, chips, and cards. */
43
84
  border-radius: inherit;
44
85
  background-color: var(--_state-color);
45
- opacity: 0;
46
- pointer-events: none;
47
- /* Use the same transition speed as other properties on the element */
86
+ opacity: 0; /* Hidden by default; transitions in on state change. */
87
+ pointer-events: none; /* Never intercept pointer events. */
48
88
  transition: opacity var(--speed2, 200ms) ease;
49
- /* Ensure the layer sits above background but below content */
89
+ /* z-index 0 places the layer above the background (z=-1 would be behind). */
50
90
  z-index: 0;
51
91
  }
52
92
 
53
- /* Hover */
93
+ /* Hover: slight overlay to signal interactivity. */
54
94
  .interactive:hover::before {
55
95
  opacity: var(--_state-hover);
56
96
  }
57
97
 
58
- /* Focus-visible (keyboard / programmatic) */
98
+ /* Focus-visible: stronger overlay for keyboard / programmatic focus.
99
+ :focus-visible is preferred over :focus to avoid showing the indicator
100
+ on mouse clicks (which have their own press state). */
59
101
  .interactive:focus-visible::before {
60
102
  opacity: var(--_state-focus);
61
103
  }
62
104
 
63
- /* Pressed / active */
105
+ /* Pressed / active: same opacity as focus but instant onset — the transition
106
+ handles the fade-out on pointer-up via the inherited duration. */
64
107
  .interactive:active::before {
65
108
  opacity: var(--_state-pressed);
66
- /* Instant on press fade out on release handled by transition */
109
+ /* transition-duration: 0sstate layer appears instantaneously on press. */
67
110
  transition-duration: 0s;
68
111
  }
69
112
 
70
- /* Disabled — no state layer at all */
113
+ /* Disabled — no state layer rendered at all (not just hidden). */
71
114
  .interactive:disabled::before,
72
115
  .interactive[aria-disabled='true']::before,
73
116
  :host([disabled]) .interactive::before {
74
117
  display: none;
75
118
  }
76
119
 
77
- /* ─── Selected/active modifier ─── */
78
- /* When an element is in a "selected" state (e.g. active nav item, checked
79
- chip) the state layer color shifts to match the container color. */
120
+ /* ─── Selected / active modifier ────────────────────────────────────────── */
121
+ /* When a component is in a "selected" state (active nav item, checked chip,
122
+ current tab), the state layer color switches to the primary color so the
123
+ overlay is visually meaningful even on primary-container backgrounds. */
80
124
  .interactive.selected::before,
81
125
  .interactive[aria-selected='true']::before,
82
126
  .interactive[aria-current]::before {
83
127
  --_state-color: var(--primary);
128
+ /* Always show a subtle primary overlay to reinforce the selected state. */
84
129
  opacity: var(--_state-hover);
85
130
  }
86
131
  .interactive.selected:hover::before,
87
132
  .interactive[aria-selected='true']:hover::before {
133
+ /* Increase opacity slightly on hover within a selected element. */
88
134
  opacity: calc(var(--_state-hover) * 1.5);
89
135
  }
90
136
 
91
- /* ─── Ensure content renders above the state layer ─── */
137
+ /* ─── Content z-index ────────────────────────────────────────────────────── */
138
+ /* Ensure all direct children of .interactive render above the state layer
139
+ (z-index: 0) and the ripple pseudo-element (z-index: 0). */
92
140
  .interactive > * {
93
141
  position: relative;
94
142
  z-index: 1;
95
143
  }
96
144
 
97
- /* ─── Ripple (CSS-only expanding circle) ─── */
98
- /* This provides a basic CSS ripple from center on :active.
99
- For a pointer-origin ripple, use <moni-ripple> with JS activation. */
145
+ /* ─── CSS-only center-origin ripple (::after) ───────────────────────────── */
146
+ /* Provides a basic expanding circle animation on :active. The circle always
147
+ originates from the element's center. For a pointer-origin ripple (where
148
+ the ripple starts at the exact tap/click coordinate), use <moni-ripple>
149
+ with JS activation instead. */
100
150
  .interactive::after {
101
151
  content: '';
102
152
  position: absolute;
103
- inset: 50%;
153
+ inset: 50%; /* Collapses to a point at the center. */
104
154
  border-radius: 50%;
105
155
  background-color: var(--_state-color);
106
156
  opacity: 0;
@@ -109,11 +159,13 @@ export const interactionStyles = css `
109
159
  z-index: 0;
110
160
  }
111
161
 
162
+ /* Trigger the ripple keyframe animation on active/press. */
112
163
  .interactive:active::after {
113
164
  animation: to-ripple var(--speed3, 300ms) cubic-bezier(0.2, 0, 0, 1) forwards;
114
165
  }
115
166
 
116
- /* Disable ripple animation when motion is reduced */
167
+ /* Respect the user's reduced-motion preference by disabling the ripple.
168
+ The ::before state layer still functions, providing a static visual cue. */
117
169
  @media (prefers-reduced-motion: reduce) {
118
170
  .interactive::after {
119
171
  display: none;
@@ -1,17 +1,52 @@
1
+ /**
2
+ * @file components/_base/moni-element.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  import { LitElement } from 'lit';
2
8
  /**
3
- * Base class for every Moni UI Web Component.
9
+ * Abstract base class for every Moni UI Web Component.
10
+ *
11
+ * **Design philosophy — visual shells, no behavior:**
12
+ * All Moni components are intentionally "dumb" — they encapsulate only
13
+ * visual structure, styling, and attribute-to-DOM mapping. Consumers own
14
+ * interaction logic, validation, async data fetching, and state management.
15
+ * This keeps components framework-agnostic and composable with any
16
+ * state management solution (Svelte stores, Vue reactive, vanilla JS, etc.).
17
+ *
18
+ * **Shadow DOM:**
19
+ * The default `LitElement.createRenderRoot()` returns an open shadow root,
20
+ * which is preserved here unchanged. Shadow DOM encapsulation ensures that
21
+ * internal CSS class names (`.button`, `.field`, `.slider`, etc.) do not leak
22
+ * into or collide with the consumer's global stylesheet.
23
+ *
24
+ * **Extension contract:**
25
+ * Every subclass must:
26
+ * 1. Be decorated with `@customElement('moni-<name>')`.
27
+ * 2. Define `static override styles = [sharedStyles, css`...`]`.
28
+ * 3. Implement `override render(): TemplateResult`.
4
29
  *
5
- * This class intentionally adds **no behavior**: components are visual-only
6
- * shells. All styling, slots, and attribute-to-DOM mapping are owned by each
7
- * individual element. Consumers wire up interaction, validation, async logic,
8
- * and state management themselves.
30
+ * Subclasses MUST NOT add behavior (event handling, timers, fetch calls) that
31
+ * is not directly related to rendering the shadow DOM. See CONTRIBUTING.md
32
+ * for the full component authoring guide.
9
33
  *
10
- * The default LitElement `createRenderRoot` returns a standard open shadow
11
- * root, which is what we want — BeerCSS class names like `.button`, `.field`,
12
- * `.slider`, etc. live inside the shadow root and stay encapsulated.
34
+ * @see {@link https://lit.dev/docs/components/overview/ Lit component overview}
13
35
  */
14
36
  export declare class MoniElement extends LitElement {
37
+ /**
38
+ * Returns the component's render root.
39
+ *
40
+ * Delegates to `LitElement.createRenderRoot()` which attaches an **open**
41
+ * shadow root (`{ mode: 'open' }`). Open mode allows external tools (browser
42
+ * devtools, testing frameworks) to traverse the shadow tree.
43
+ *
44
+ * This override exists explicitly to document the shadow root mode and to
45
+ * provide a hook for subclasses that may need to change the root in the future
46
+ * (e.g. to support `adoptedStyleSheets` in a specific environment).
47
+ *
48
+ * @returns The shadow root that Lit will render templates into.
49
+ */
15
50
  protected createRenderRoot(): HTMLElement | DocumentFragment;
16
51
  }
17
52
  export default MoniElement;
@@ -1 +1 @@
1
- {"version":3,"file":"moni-element.d.ts","sourceRoot":"","sources":["../../../src/components/_base/moni-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,UAAU;cACvB,gBAAgB;CAGnC;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"moni-element.d.ts","sourceRoot":"","sources":["../../../src/components/_base/moni-element.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,WAAY,SAAQ,UAAU;IAC1C;;;;;;;;;;;;OAYG;cACgB,gBAAgB;CAGnC;AAED,eAAe,WAAW,CAAC"}
@@ -1,17 +1,52 @@
1
+ /**
2
+ * @file components/_base/moni-element.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  import { LitElement } from 'lit';
2
8
  /**
3
- * Base class for every Moni UI Web Component.
9
+ * Abstract base class for every Moni UI Web Component.
10
+ *
11
+ * **Design philosophy — visual shells, no behavior:**
12
+ * All Moni components are intentionally "dumb" — they encapsulate only
13
+ * visual structure, styling, and attribute-to-DOM mapping. Consumers own
14
+ * interaction logic, validation, async data fetching, and state management.
15
+ * This keeps components framework-agnostic and composable with any
16
+ * state management solution (Svelte stores, Vue reactive, vanilla JS, etc.).
17
+ *
18
+ * **Shadow DOM:**
19
+ * The default `LitElement.createRenderRoot()` returns an open shadow root,
20
+ * which is preserved here unchanged. Shadow DOM encapsulation ensures that
21
+ * internal CSS class names (`.button`, `.field`, `.slider`, etc.) do not leak
22
+ * into or collide with the consumer's global stylesheet.
23
+ *
24
+ * **Extension contract:**
25
+ * Every subclass must:
26
+ * 1. Be decorated with `@customElement('moni-<name>')`.
27
+ * 2. Define `static override styles = [sharedStyles, css`...`]`.
28
+ * 3. Implement `override render(): TemplateResult`.
4
29
  *
5
- * This class intentionally adds **no behavior**: components are visual-only
6
- * shells. All styling, slots, and attribute-to-DOM mapping are owned by each
7
- * individual element. Consumers wire up interaction, validation, async logic,
8
- * and state management themselves.
30
+ * Subclasses MUST NOT add behavior (event handling, timers, fetch calls) that
31
+ * is not directly related to rendering the shadow DOM. See CONTRIBUTING.md
32
+ * for the full component authoring guide.
9
33
  *
10
- * The default LitElement `createRenderRoot` returns a standard open shadow
11
- * root, which is what we want — BeerCSS class names like `.button`, `.field`,
12
- * `.slider`, etc. live inside the shadow root and stay encapsulated.
34
+ * @see {@link https://lit.dev/docs/components/overview/ Lit component overview}
13
35
  */
14
36
  export class MoniElement extends LitElement {
37
+ /**
38
+ * Returns the component's render root.
39
+ *
40
+ * Delegates to `LitElement.createRenderRoot()` which attaches an **open**
41
+ * shadow root (`{ mode: 'open' }`). Open mode allows external tools (browser
42
+ * devtools, testing frameworks) to traverse the shadow tree.
43
+ *
44
+ * This override exists explicitly to document the shadow root mode and to
45
+ * provide a hook for subclasses that may need to change the root in the future
46
+ * (e.g. to support `adoptedStyleSheets` in a specific environment).
47
+ *
48
+ * @returns The shadow root that Lit will render templates into.
49
+ */
15
50
  createRenderRoot() {
16
51
  return super.createRenderRoot();
17
52
  }
@@ -1,21 +1,45 @@
1
1
  /**
2
- * Shared baseline injected into every Moni Web Component shadow root.
3
- *
4
- * Provides:
5
- * 1. Box-sizing reset on the host and its descendants.
6
- * 2. CSS custom property bridge: exposes the **BeerCSS token namespace**
7
- * (`--primary`, `--on-primary`, `--surface`, `--elevate1`, …) inside the
8
- * shadow root, falling back to sensible Material 3 defaults if the host
9
- * document has not provided the alias yet.
10
- * 3. The `--md-sys-color-*` and `--color-*` aliases kept for backward
11
- * compatibility with the MD3 theme engine that the rest of the Moni apps
12
- * (MoniAuth-Client, MoniAuth-Yo, Moni-Labs) still rely on.
13
- * 4. Helper utility classes (`.truncate`, `.visually-hidden`).
14
- *
15
- * The MD3 BeerCSS mapping is intentionally *inverted* with respect to the
16
- * previous design: BeerCSS variables are the primary, MD3 ones are aliases.
17
- * Components authored against `var(--primary)` will work in any environment
18
- * that ships the MD3 scheme because the alias resolves upstream.
2
+ * @file components/_base/shared-styles.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+ /**
8
+ * Baseline CSS injected into the shadow root of **every** Moni Web Component.
9
+ *
10
+ * This stylesheet is the foundational layer of the Moni design system. It serves
11
+ * four distinct responsibilities:
12
+ *
13
+ * **1. Box-sizing reset**
14
+ * Applies `box-sizing: border-box` to `:host`, all descendants, and slotted
15
+ * elements so every component has predictable sizing without override surprises.
16
+ *
17
+ * **2. CSS custom property bridge (Token namespace)**
18
+ * The component library uses short "bare" variable names internally (e.g.
19
+ * `var(--primary)`) for concise CSS. Because shadow DOM isolates custom
20
+ * properties by default, this sheet creates a bridge that resolves these
21
+ * internal names from the global token namespaces in the following priority:
22
+ *
23
+ * `--moni-*` (Moni namespace) → `--md-sys-color-*` (MD3 spec) → hardcoded M3 default
24
+ *
25
+ * This lets a host document use any of the three namespaces to theme components.
26
+ *
27
+ * **3. MD3 `--color-*` aliases**
28
+ * A second `:host` block maps the older `--color-<role>` prefix to the primary
29
+ * bare tokens. These aliases ensure backward compatibility with Moni apps
30
+ * (MoniAuth-Client, MoniAuth-Yo) that still reference `--color-primary`, etc.
31
+ *
32
+ * **4. Utility classes**
33
+ * Provides `.truncate` (single-line text clipping) and `.visually-hidden`
34
+ * (screen-reader-only content) for use inside component shadow trees.
35
+ *
36
+ * **Usage:**
37
+ * ```ts
38
+ * static override styles = [sharedStyles, css`/* component-specific styles *\/`];
39
+ * ```
40
+ *
41
+ * @see {@link fieldStyles} — Additional styles for input field components.
42
+ * @see {@link interactionStyles} — M3 state layer system for interactive elements.
19
43
  */
20
44
  export declare const sharedStyles: import("lit").CSSResult;
21
45
  export default sharedStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"shared-styles.d.ts","sourceRoot":"","sources":["../../../src/components/_base/shared-styles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,yBA4HxB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"shared-styles.d.ts","sourceRoot":"","sources":["../../../src/components/_base/shared-styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,YAAY,yBAgMxB,CAAC;AAEF,eAAe,YAAY,CAAC"}