@sandlada/mdc 0.1.0-nightly.14072025

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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/LICENSE-APACHE-2.0.txt +202 -0
  3. package/README.md +43 -0
  4. package/build/all.d.ts +40 -0
  5. package/build/all.d.ts.map +1 -0
  6. package/build/all.js +1 -0
  7. package/build/class-map-DQX-4Y_I.js +11 -0
  8. package/build/color-CigMJnjV.js +1 -0
  9. package/build/component-definitions/badge.definition.d.ts +15 -0
  10. package/build/component-definitions/badge.definition.d.ts.map +1 -0
  11. package/build/component-definitions/badge.definition.js +6 -0
  12. package/build/component-definitions/button.definition.d.ts +1017 -0
  13. package/build/component-definitions/button.definition.d.ts.map +1 -0
  14. package/build/component-definitions/button.definition.js +6 -0
  15. package/build/component-definitions/card.definition.d.ts +99 -0
  16. package/build/component-definitions/card.definition.d.ts.map +1 -0
  17. package/build/component-definitions/card.definition.js +6 -0
  18. package/build/component-definitions/checkbox.definition.d.ts +74 -0
  19. package/build/component-definitions/checkbox.definition.d.ts.map +1 -0
  20. package/build/component-definitions/checkbox.definition.js +6 -0
  21. package/build/component-definitions/dialog.definition.d.ts +74 -0
  22. package/build/component-definitions/dialog.definition.d.ts.map +1 -0
  23. package/build/component-definitions/dialog.definition.js +1 -0
  24. package/build/component-definitions/divider.definition.d.ts +5 -0
  25. package/build/component-definitions/divider.definition.d.ts.map +1 -0
  26. package/build/component-definitions/divider.definition.js +6 -0
  27. package/build/component-definitions/elevation.definition.d.ts +5 -0
  28. package/build/component-definitions/elevation.definition.d.ts.map +1 -0
  29. package/build/component-definitions/elevation.definition.js +6 -0
  30. package/build/component-definitions/fab.definition.d.ts +643 -0
  31. package/build/component-definitions/fab.definition.d.ts.map +1 -0
  32. package/build/component-definitions/fab.definition.js +6 -0
  33. package/build/component-definitions/focus-ring.definition.d.ts +13 -0
  34. package/build/component-definitions/focus-ring.definition.d.ts.map +1 -0
  35. package/build/component-definitions/focus-ring.definition.js +7 -0
  36. package/build/component-definitions/icon-button.definition.d.ts +718 -0
  37. package/build/component-definitions/icon-button.definition.d.ts.map +1 -0
  38. package/build/component-definitions/icon-button.definition.js +6 -0
  39. package/build/component-definitions/icon.definition.d.ts +10 -0
  40. package/build/component-definitions/icon.definition.d.ts.map +1 -0
  41. package/build/component-definitions/icon.definition.js +6 -0
  42. package/build/component-definitions/progress-indicator.definition.d.ts +52 -0
  43. package/build/component-definitions/progress-indicator.definition.d.ts.map +1 -0
  44. package/build/component-definitions/progress-indicator.definition.js +1 -0
  45. package/build/component-definitions/radio-button.definition.d.ts +29 -0
  46. package/build/component-definitions/radio-button.definition.d.ts.map +1 -0
  47. package/build/component-definitions/radio-button.definition.js +6 -0
  48. package/build/component-definitions/ripple.definition.d.ts +7 -0
  49. package/build/component-definitions/ripple.definition.d.ts.map +1 -0
  50. package/build/component-definitions/ripple.definition.js +6 -0
  51. package/build/component-definitions/switch.definition.d.ts +84 -0
  52. package/build/component-definitions/switch.definition.d.ts.map +1 -0
  53. package/build/component-definitions/switch.definition.js +6 -0
  54. package/build/components/button/base-button.d.ts +74 -0
  55. package/build/components/button/base-button.d.ts.map +1 -0
  56. package/build/components/button/base-button.js +6 -0
  57. package/build/components/button/button.d.ts +49 -0
  58. package/build/components/button/button.d.ts.map +1 -0
  59. package/build/components/button/button.js +1 -0
  60. package/build/components/button/button.style.d.ts +6 -0
  61. package/build/components/button/button.style.d.ts.map +1 -0
  62. package/build/components/button/button.style.js +618 -0
  63. package/build/components/button/elevated-button.d.ts +11 -0
  64. package/build/components/button/elevated-button.d.ts.map +1 -0
  65. package/build/components/button/elevated-button.js +1 -0
  66. package/build/components/button/filled-button.d.ts +11 -0
  67. package/build/components/button/filled-button.d.ts.map +1 -0
  68. package/build/components/button/filled-button.js +1 -0
  69. package/build/components/button/filled-tonal-button.d.ts +11 -0
  70. package/build/components/button/filled-tonal-button.d.ts.map +1 -0
  71. package/build/components/button/filled-tonal-button.js +1 -0
  72. package/build/components/button/outlined-button.d.ts +11 -0
  73. package/build/components/button/outlined-button.d.ts.map +1 -0
  74. package/build/components/button/outlined-button.js +1 -0
  75. package/build/components/button/text-button.d.ts +10 -0
  76. package/build/components/button/text-button.d.ts.map +1 -0
  77. package/build/components/button/text-button.js +1 -0
  78. package/build/components/button/togglable-button.d.ts +55 -0
  79. package/build/components/button/togglable-button.d.ts.map +1 -0
  80. package/build/components/button/togglable-button.js +1 -0
  81. package/build/components/button/toggle-elevated-button.d.ts +11 -0
  82. package/build/components/button/toggle-elevated-button.d.ts.map +1 -0
  83. package/build/components/button/toggle-elevated-button.js +1 -0
  84. package/build/components/button/toggle-filled-button.d.ts +11 -0
  85. package/build/components/button/toggle-filled-button.d.ts.map +1 -0
  86. package/build/components/button/toggle-filled-button.js +1 -0
  87. package/build/components/button/toggle-filled-tonal-button.d.ts +11 -0
  88. package/build/components/button/toggle-filled-tonal-button.d.ts.map +1 -0
  89. package/build/components/button/toggle-filled-tonal-button.js +1 -0
  90. package/build/components/button/toggle-outlined-button.d.ts +11 -0
  91. package/build/components/button/toggle-outlined-button.d.ts.map +1 -0
  92. package/build/components/button/toggle-outlined-button.js +1 -0
  93. package/build/components/dialog/base-dialog.d.ts +42 -0
  94. package/build/components/dialog/base-dialog.d.ts.map +1 -0
  95. package/build/components/dialog/base-dialog.js +1 -0
  96. package/build/components/dialog/basic-dialog.d.ts +10 -0
  97. package/build/components/dialog/basic-dialog.d.ts.map +1 -0
  98. package/build/components/dialog/basic-dialog.js +1 -0
  99. package/build/components/dialog/dialog-action.d.ts +62 -0
  100. package/build/components/dialog/dialog-action.d.ts.map +1 -0
  101. package/build/components/dialog/dialog-action.js +1 -0
  102. package/build/components/dialog/dialog-animations.d.ts +48 -0
  103. package/build/components/dialog/dialog-animations.d.ts.map +1 -0
  104. package/build/components/dialog/dialog-animations.js +6 -0
  105. package/build/components/dialog/dialog.style.d.ts +2 -0
  106. package/build/components/dialog/dialog.style.d.ts.map +1 -0
  107. package/build/components/dialog/dialog.style.js +217 -0
  108. package/build/components/divider/divider.d.ts +18 -0
  109. package/build/components/divider/divider.d.ts.map +1 -0
  110. package/build/components/divider/divider.js +1 -0
  111. package/build/components/divider/divider.style.d.ts +2 -0
  112. package/build/components/divider/divider.style.d.ts.map +1 -0
  113. package/build/components/divider/divider.style.js +6 -0
  114. package/build/components/elevation/elevation.d.ts +46 -0
  115. package/build/components/elevation/elevation.d.ts.map +1 -0
  116. package/build/components/elevation/elevation.js +1 -0
  117. package/build/components/elevation/elevation.style.d.ts +2 -0
  118. package/build/components/elevation/elevation.style.d.ts.map +1 -0
  119. package/build/components/elevation/elevation.style.js +6 -0
  120. package/build/components/fab/extended-fab.d.ts +36 -0
  121. package/build/components/fab/extended-fab.d.ts.map +1 -0
  122. package/build/components/fab/extended-fab.js +1 -0
  123. package/build/components/fab/extended-primary-fab.d.ts +10 -0
  124. package/build/components/fab/extended-primary-fab.d.ts.map +1 -0
  125. package/build/components/fab/extended-primary-fab.js +1 -0
  126. package/build/components/fab/extended-secondary-fab.d.ts +10 -0
  127. package/build/components/fab/extended-secondary-fab.d.ts.map +1 -0
  128. package/build/components/fab/extended-secondary-fab.js +1 -0
  129. package/build/components/fab/extended-tertiary-fab.d.ts +10 -0
  130. package/build/components/fab/extended-tertiary-fab.d.ts.map +1 -0
  131. package/build/components/fab/extended-tertiary-fab.js +1 -0
  132. package/build/components/fab/extended-tonal-primary-fab.d.ts +10 -0
  133. package/build/components/fab/extended-tonal-primary-fab.d.ts.map +1 -0
  134. package/build/components/fab/extended-tonal-primary-fab.js +1 -0
  135. package/build/components/fab/extended-tonal-secondary-fab.d.ts +10 -0
  136. package/build/components/fab/extended-tonal-secondary-fab.d.ts.map +1 -0
  137. package/build/components/fab/extended-tonal-secondary-fab.js +1 -0
  138. package/build/components/fab/extended-tonal-tertiary-fab.d.ts +10 -0
  139. package/build/components/fab/extended-tonal-tertiary-fab.d.ts.map +1 -0
  140. package/build/components/fab/extended-tonal-tertiary-fab.js +1 -0
  141. package/build/components/fab/fab.d.ts +45 -0
  142. package/build/components/fab/fab.d.ts.map +1 -0
  143. package/build/components/fab/fab.js +1 -0
  144. package/build/components/fab/fab.style.d.ts +13 -0
  145. package/build/components/fab/fab.style.d.ts.map +1 -0
  146. package/build/components/fab/fab.style.js +6 -0
  147. package/build/components/fab/primary-fab.d.ts +10 -0
  148. package/build/components/fab/primary-fab.d.ts.map +1 -0
  149. package/build/components/fab/primary-fab.js +1 -0
  150. package/build/components/fab/secondary-fab.d.ts +10 -0
  151. package/build/components/fab/secondary-fab.d.ts.map +1 -0
  152. package/build/components/fab/secondary-fab.js +1 -0
  153. package/build/components/fab/tertiary-fab.d.ts +10 -0
  154. package/build/components/fab/tertiary-fab.d.ts.map +1 -0
  155. package/build/components/fab/tertiary-fab.js +1 -0
  156. package/build/components/fab/tonal-primary-fab.d.ts +10 -0
  157. package/build/components/fab/tonal-primary-fab.d.ts.map +1 -0
  158. package/build/components/fab/tonal-primary-fab.js +1 -0
  159. package/build/components/fab/tonal-secondary-fab.d.ts +10 -0
  160. package/build/components/fab/tonal-secondary-fab.d.ts.map +1 -0
  161. package/build/components/fab/tonal-secondary-fab.js +1 -0
  162. package/build/components/fab/tonal-tertiary-fab.d.ts +10 -0
  163. package/build/components/fab/tonal-tertiary-fab.d.ts.map +1 -0
  164. package/build/components/fab/tonal-tertiary-fab.js +1 -0
  165. package/build/components/focus-ring/focus-ring.d.ts +56 -0
  166. package/build/components/focus-ring/focus-ring.d.ts.map +1 -0
  167. package/build/components/focus-ring/focus-ring.js +1 -0
  168. package/build/components/focus-ring/focus-ring.style.d.ts +2 -0
  169. package/build/components/focus-ring/focus-ring.style.d.ts.map +1 -0
  170. package/build/components/focus-ring/focus-ring.style.js +108 -0
  171. package/build/components/icon/icon.d.ts +50 -0
  172. package/build/components/icon/icon.d.ts.map +1 -0
  173. package/build/components/icon/icon.js +1 -0
  174. package/build/components/icon/icon.style.d.ts +2 -0
  175. package/build/components/icon/icon.style.d.ts.map +1 -0
  176. package/build/components/icon/icon.style.js +6 -0
  177. package/build/components/icon-button/base-icon-button.d.ts +62 -0
  178. package/build/components/icon-button/base-icon-button.d.ts.map +1 -0
  179. package/build/components/icon-button/base-icon-button.js +1 -0
  180. package/build/components/icon-button/filled-icon-button.d.ts +10 -0
  181. package/build/components/icon-button/filled-icon-button.d.ts.map +1 -0
  182. package/build/components/icon-button/filled-icon-button.js +1 -0
  183. package/build/components/icon-button/filled-tonal-icon-button.d.ts +10 -0
  184. package/build/components/icon-button/filled-tonal-icon-button.d.ts.map +1 -0
  185. package/build/components/icon-button/filled-tonal-icon-button.js +1 -0
  186. package/build/components/icon-button/icon-button.d.ts +19 -0
  187. package/build/components/icon-button/icon-button.d.ts.map +1 -0
  188. package/build/components/icon-button/icon-button.js +1 -0
  189. package/build/components/icon-button/icon-button.style.d.ts +5 -0
  190. package/build/components/icon-button/icon-button.style.d.ts.map +1 -0
  191. package/build/components/icon-button/icon-button.style.js +411 -0
  192. package/build/components/icon-button/outlined-icon-button.d.ts +11 -0
  193. package/build/components/icon-button/outlined-icon-button.d.ts.map +1 -0
  194. package/build/components/icon-button/outlined-icon-button.js +1 -0
  195. package/build/components/icon-button/standard-icon-button.d.ts +10 -0
  196. package/build/components/icon-button/standard-icon-button.d.ts.map +1 -0
  197. package/build/components/icon-button/standard-icon-button.js +1 -0
  198. package/build/components/icon-button/togglable-icon-button.d.ts +39 -0
  199. package/build/components/icon-button/togglable-icon-button.d.ts.map +1 -0
  200. package/build/components/icon-button/togglable-icon-button.js +1 -0
  201. package/build/components/icon-button/toggle-filled-icon-button.d.ts +10 -0
  202. package/build/components/icon-button/toggle-filled-icon-button.d.ts.map +1 -0
  203. package/build/components/icon-button/toggle-filled-icon-button.js +1 -0
  204. package/build/components/icon-button/toggle-filled-tonal-icon-button.d.ts +10 -0
  205. package/build/components/icon-button/toggle-filled-tonal-icon-button.d.ts.map +1 -0
  206. package/build/components/icon-button/toggle-filled-tonal-icon-button.js +1 -0
  207. package/build/components/icon-button/toggle-outlined-icon-button.d.ts +11 -0
  208. package/build/components/icon-button/toggle-outlined-icon-button.d.ts.map +1 -0
  209. package/build/components/icon-button/toggle-outlined-icon-button.js +1 -0
  210. package/build/components/icon-button/toggle-standard-icon-button.d.ts +10 -0
  211. package/build/components/icon-button/toggle-standard-icon-button.d.ts.map +1 -0
  212. package/build/components/icon-button/toggle-standard-icon-button.js +1 -0
  213. package/build/components/progress-indicator/base-progress-indicator.d.ts +28 -0
  214. package/build/components/progress-indicator/base-progress-indicator.d.ts.map +1 -0
  215. package/build/components/progress-indicator/base-progress-indicator.js +1 -0
  216. package/build/components/progress-indicator/linear-progress-indicator.d.ts +29 -0
  217. package/build/components/progress-indicator/linear-progress-indicator.d.ts.map +1 -0
  218. package/build/components/progress-indicator/linear-progress-indicator.js +1 -0
  219. package/build/components/progress-indicator/progress-indicator.style.d.ts +2 -0
  220. package/build/components/progress-indicator/progress-indicator.style.d.ts.map +1 -0
  221. package/build/components/progress-indicator/progress-indicator.style.js +271 -0
  222. package/build/components/radio-button/radio-button-selection-controller.d.ts +81 -0
  223. package/build/components/radio-button/radio-button-selection-controller.d.ts.map +1 -0
  224. package/build/components/radio-button/radio-button-selection-controller.js +6 -0
  225. package/build/components/radio-button/radio-button.d.ts +50 -0
  226. package/build/components/radio-button/radio-button.d.ts.map +1 -0
  227. package/build/components/radio-button/radio-button.js +1 -0
  228. package/build/components/radio-button/radio-button.style.d.ts +2 -0
  229. package/build/components/radio-button/radio-button.style.d.ts.map +1 -0
  230. package/build/components/radio-button/radio-button.style.js +143 -0
  231. package/build/components/ripple/ripple-action.d.ts +52 -0
  232. package/build/components/ripple/ripple-action.d.ts.map +1 -0
  233. package/build/components/ripple/ripple-action.js +10 -0
  234. package/build/components/ripple/ripple.d.ts +32 -0
  235. package/build/components/ripple/ripple.d.ts.map +1 -0
  236. package/build/components/ripple/ripple.js +1 -0
  237. package/build/components/ripple/ripple.style.d.ts +2 -0
  238. package/build/components/ripple/ripple.style.d.ts.map +1 -0
  239. package/build/components/ripple/ripple.style.js +6 -0
  240. package/build/components/switch/switch.d.ts +45 -0
  241. package/build/components/switch/switch.d.ts.map +1 -0
  242. package/build/components/switch/switch.js +1 -0
  243. package/build/components/switch/switch.style.d.ts +2 -0
  244. package/build/components/switch/switch.style.d.ts.map +1 -0
  245. package/build/components/switch/switch.style.js +329 -0
  246. package/build/components/typography/typography.d.ts +44 -0
  247. package/build/components/typography/typography.d.ts.map +1 -0
  248. package/build/components/typography/typography.js +1 -0
  249. package/build/components/typography/typography.styles.d.ts +3 -0
  250. package/build/components/typography/typography.styles.d.ts.map +1 -0
  251. package/build/components/typography/typography.styles.js +6 -0
  252. package/build/custom-element-Dz3n6kSt.js +6 -0
  253. package/build/definitions.d.ts +15 -0
  254. package/build/definitions.d.ts.map +1 -0
  255. package/build/definitions.js +1 -0
  256. package/build/easing-5hHInU7b.js +1 -0
  257. package/build/elevation-dUQez_WX.js +1 -0
  258. package/build/lit-element-Bf8D1KRw.js +22 -0
  259. package/build/property-CHB_6zYv.js +6 -0
  260. package/build/query-DifSdHBD.js +11 -0
  261. package/build/shape-CrZ0CLVJ.js +1 -0
  262. package/build/state-B54YIR_M.js +6 -0
  263. package/build/state-C-haZXan.js +1 -0
  264. package/build/tslib.es6-CmLYFWVC.js +1 -0
  265. package/build/typescale-Bh1NLwSE.js +1 -0
  266. package/build/utils/aria/aria.d.ts +71 -0
  267. package/build/utils/aria/aria.d.ts.map +1 -0
  268. package/build/utils/aria/aria.js +6 -0
  269. package/build/utils/aria/delegate.d.ts +55 -0
  270. package/build/utils/aria/delegate.d.ts.map +1 -0
  271. package/build/utils/aria/delegate.js +7 -0
  272. package/build/utils/behaviors/constraint-validation.d.ts +134 -0
  273. package/build/utils/behaviors/constraint-validation.d.ts.map +1 -0
  274. package/build/utils/behaviors/constraint-validation.js +6 -0
  275. package/build/utils/behaviors/element-internals.d.ts +46 -0
  276. package/build/utils/behaviors/element-internals.d.ts.map +1 -0
  277. package/build/utils/behaviors/element-internals.js +6 -0
  278. package/build/utils/behaviors/mixin.d.ts +55 -0
  279. package/build/utils/behaviors/mixin.d.ts.map +1 -0
  280. package/build/utils/behaviors/mixin.js +1 -0
  281. package/build/utils/behaviors/validators/checkbox-validator.d.ts +36 -0
  282. package/build/utils/behaviors/validators/checkbox-validator.d.ts.map +1 -0
  283. package/build/utils/behaviors/validators/checkbox-validator.js +6 -0
  284. package/build/utils/behaviors/validators/radio-validator.d.ts +39 -0
  285. package/build/utils/behaviors/validators/radio-validator.d.ts.map +1 -0
  286. package/build/utils/behaviors/validators/radio-validator.js +6 -0
  287. package/build/utils/behaviors/validators/select-validator.d.ts +36 -0
  288. package/build/utils/behaviors/validators/select-validator.d.ts.map +1 -0
  289. package/build/utils/behaviors/validators/select-validator.js +6 -0
  290. package/build/utils/behaviors/validators/text-field-validator.d.ts +111 -0
  291. package/build/utils/behaviors/validators/text-field-validator.d.ts.map +1 -0
  292. package/build/utils/behaviors/validators/text-field-validator.js +6 -0
  293. package/build/utils/behaviors/validators/validator.d.ts +97 -0
  294. package/build/utils/behaviors/validators/validator.d.ts.map +1 -0
  295. package/build/utils/behaviors/validators/validator.js +6 -0
  296. package/build/utils/controller/attachable-controller.d.ts +116 -0
  297. package/build/utils/controller/attachable-controller.d.ts.map +1 -0
  298. package/build/utils/controller/attachable-controller.js +9 -0
  299. package/build/utils/controller/form-submitter.d.ts +71 -0
  300. package/build/utils/controller/form-submitter.d.ts.map +1 -0
  301. package/build/utils/controller/form-submitter.js +6 -0
  302. package/build/utils/event/dispatch-hook.d.ts +86 -0
  303. package/build/utils/event/dispatch-hook.d.ts.map +1 -0
  304. package/build/utils/event/dispatch-hook.js +6 -0
  305. package/build/utils/event/form-label-activation.d.ts +56 -0
  306. package/build/utils/event/form-label-activation.d.ts.map +1 -0
  307. package/build/utils/event/form-label-activation.js +6 -0
  308. package/build/utils/event/redispatch-event.d.ts +28 -0
  309. package/build/utils/event/redispatch-event.d.ts.map +1 -0
  310. package/build/utils/event/redispatch-event.js +6 -0
  311. package/build/utils/form/form-associated.d.ts +200 -0
  312. package/build/utils/form/form-associated.d.ts.map +1 -0
  313. package/build/utils/form/form-associated.js +1 -0
  314. package/build/utils/string/to-kebab-case.d.ts +11 -0
  315. package/build/utils/string/to-kebab-case.d.ts.map +1 -0
  316. package/build/utils/string/to-kebab-case.js +6 -0
  317. package/build/utils/tokens/create-logic-shape-tokens.d.ts +14 -0
  318. package/build/utils/tokens/create-logic-shape-tokens.d.ts.map +1 -0
  319. package/build/utils/tokens/create-logic-shape-tokens.js +6 -0
  320. package/build/utils/tokens/create-var.d.ts +14 -0
  321. package/build/utils/tokens/create-var.d.ts.map +1 -0
  322. package/build/utils/tokens/create-var.js +6 -0
  323. package/build/utils/tokens/create-wrapped-tokens.d.ts +24 -0
  324. package/build/utils/tokens/create-wrapped-tokens.d.ts.map +1 -0
  325. package/build/utils/tokens/create-wrapped-tokens.js +6 -0
  326. package/build/utils/tokens/exclude-tokens.d.ts +7 -0
  327. package/build/utils/tokens/exclude-tokens.d.ts.map +1 -0
  328. package/build/utils/tokens/exclude-tokens.js +6 -0
  329. package/build/utils/tokens/index.d.ts +12 -0
  330. package/build/utils/tokens/index.d.ts.map +1 -0
  331. package/build/utils/tokens/index.js +1 -0
  332. package/build/utils/tokens/override-component-tokens.d.ts +34 -0
  333. package/build/utils/tokens/override-component-tokens.d.ts.map +1 -0
  334. package/build/utils/tokens/override-component-tokens.js +6 -0
  335. package/build/utils/tokens/string-tokens.d.ts +14 -0
  336. package/build/utils/tokens/string-tokens.d.ts.map +1 -0
  337. package/build/utils/tokens/string-tokens.js +6 -0
  338. package/build/utils/uuid/generate-uuid.d.ts +19 -0
  339. package/build/utils/uuid/generate-uuid.d.ts.map +1 -0
  340. package/build/utils/uuid/generate-uuid.js +6 -0
  341. package/build/utils.d.ts +3 -0
  342. package/build/utils.d.ts.map +1 -0
  343. package/build/utils.js +1 -0
  344. package/package.json +74 -0
@@ -0,0 +1,6 @@
1
+ import{Validator as e}from"./validator.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */class c extends e{computeValidity(e){return this.checkboxControl||(this.checkboxControl=document.createElement("input"),this.checkboxControl.type="checkbox"),this.checkboxControl.checked=e.checked,this.checkboxControl.required=e.required,{validity:this.checkboxControl.validity,validationMessage:this.checkboxControl.validationMessage}}equals(e,c){return e.checked===c.checked&&e.required===c.required}copy({checked:e,required:c}){return{checked:e,required:c}}}export{c as CheckboxValidator};
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Validator } from './validator.js';
7
+ /**
8
+ * Constraint validation properties for a radio.
9
+ */
10
+ export interface RadioState {
11
+ /**
12
+ * Whether the radio is checked.
13
+ */
14
+ readonly checked: boolean;
15
+ /**
16
+ * Whether the radio is required.
17
+ */
18
+ readonly required: boolean;
19
+ }
20
+ /**
21
+ * Radio constraint validation properties for a single radio and its siblings.
22
+ */
23
+ export type RadioGroupState = readonly [RadioState, ...RadioState[]];
24
+ /**
25
+ * A validator that provides constraint validation that emulates
26
+ * `<input type="radio">` validation.
27
+ */
28
+ export declare class RadioValidator extends Validator<RadioGroupState> {
29
+ private radioElement?;
30
+ protected computeValidity(states: RadioGroupState): {
31
+ validity: {
32
+ valueMissing: boolean;
33
+ };
34
+ validationMessage: string;
35
+ };
36
+ protected equals(prevGroup: RadioGroupState, nextGroup: RadioGroupState): boolean;
37
+ protected copy(states: RadioGroupState): RadioGroupState;
38
+ }
39
+ //# sourceMappingURL=radio-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-validator.d.ts","sourceRoot":"","sources":["../../../../src/utils/behaviors/validators/radio-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;AAErE;;;GAGG;AACH,qBAAa,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,OAAO,CAAC,YAAY,CAAC,CAAmB;cAErB,eAAe,CAAC,MAAM,EAAE,eAAe;;;;;;cAmCvC,MAAM,CACvB,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,eAAe;cAiBT,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe;CAQlE"}
@@ -0,0 +1,6 @@
1
+ import{Validator as e}from"./validator.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */class t extends e{computeValidity(e){this.radioElement||(this.radioElement=document.createElement("input"),this.radioElement.type="radio",this.radioElement.name="group");let t=!1,r=!1;for(const{checked:i,required:d}of e)d&&(t=!0),i&&(r=!0);return this.radioElement.checked=r,this.radioElement.required=t,{validity:{valueMissing:t&&!r},validationMessage:this.radioElement.validationMessage}}equals(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],d=t[r];if(i.checked!==d.checked||i.required!==d.required)return!1}return!0}copy(e){return e.map(({checked:e,required:t})=>({checked:e,required:t}))}}export{t as RadioValidator};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Validator } from './validator.js';
7
+ /**
8
+ * Constraint validation properties for a select dropdown.
9
+ */
10
+ export interface SelectState {
11
+ /**
12
+ * The current selected value.
13
+ */
14
+ readonly value: string;
15
+ /**
16
+ * Whether the select is required.
17
+ */
18
+ readonly required: boolean;
19
+ }
20
+ /**
21
+ * A validator that provides constraint validation that emulates `<select>`
22
+ * validation.
23
+ */
24
+ export declare class SelectValidator extends Validator<SelectState> {
25
+ private selectControl?;
26
+ protected computeValidity(state: SelectState): {
27
+ validity: ValidityState;
28
+ validationMessage: string;
29
+ };
30
+ protected equals(prev: SelectState, next: SelectState): boolean;
31
+ protected copy({ value, required }: SelectState): {
32
+ value: string;
33
+ required: boolean;
34
+ };
35
+ }
36
+ //# sourceMappingURL=select-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-validator.d.ts","sourceRoot":"","sources":["../../../../src/utils/behaviors/validators/select-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,SAAS,CAAC,WAAW,CAAC;IACzD,OAAO,CAAC,aAAa,CAAC,CAAoB;cAEvB,eAAe,CAAC,KAAK,EAAE,WAAW;;;;cAgBlC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW;cAI3C,IAAI,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,WAAW;;;;CAGvD"}
@@ -0,0 +1,6 @@
1
+ import{B as e,x as t}from"../../../lit-element-Bf8D1KRw.js";import{Validator as l}from"./validator.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */class r extends l{computeValidity(l){return this.selectControl||(this.selectControl=document.createElement("select")),e(t`<option value="${l.value}"></option>`,this.selectControl),this.selectControl.value=l.value,this.selectControl.required=l.required,{validity:this.selectControl.validity,validationMessage:this.selectControl.validationMessage}}equals(e,t){return e.value===t.value&&e.required===t.required}copy({value:e,required:t}){return{value:e,required:t}}}export{r as SelectValidator};
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Validator } from './validator.js';
7
+ /**
8
+ * Constraint validation for a text field.
9
+ */
10
+ export interface TextFieldState {
11
+ /**
12
+ * The input or textarea state to validate.
13
+ */
14
+ state: InputState | TextAreaState;
15
+ /**
16
+ * The `<input>` or `<textarea>` that is rendered on the page.
17
+ *
18
+ * `minlength` and `maxlength` validation do not apply until a user has
19
+ * interacted with the control and the element is internally marked as dirty.
20
+ * This is a spec quirk, the two properties behave differently from other
21
+ * constraint validation.
22
+ *
23
+ * This means we need an actual rendered element instead of a virtual one,
24
+ * since the virtual element will never be marked as dirty.
25
+ *
26
+ * This can be `null` if the element has not yet rendered, and the validator
27
+ * will fall back to virtual elements for other constraint validation
28
+ * properties, which do apply even if the control is not dirty.
29
+ */
30
+ renderedControl: HTMLInputElement | HTMLTextAreaElement | null;
31
+ }
32
+ /**
33
+ * Constraint validation properties for an `<input>`.
34
+ */
35
+ export interface InputState extends SharedInputAndTextAreaState {
36
+ /**
37
+ * The `<input>` type.
38
+ *
39
+ * Not all constraint validation properties apply to every type. See
40
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#validation-related_attributes
41
+ * for which properties will apply to which types.
42
+ */
43
+ readonly type: string;
44
+ /**
45
+ * The regex pattern a value must match.
46
+ */
47
+ readonly pattern: string;
48
+ /**
49
+ * The minimum value.
50
+ */
51
+ readonly min: string;
52
+ /**
53
+ * The maximum value.
54
+ */
55
+ readonly max: string;
56
+ /**
57
+ * The step interval of the value.
58
+ */
59
+ readonly step: string;
60
+ }
61
+ /**
62
+ * Constraint validation properties for a `<textarea>`.
63
+ */
64
+ export interface TextAreaState extends SharedInputAndTextAreaState {
65
+ /**
66
+ * The type, must be "textarea" to inform the validator to use `<textarea>`
67
+ * instead of `<input>`.
68
+ */
69
+ readonly type: 'textarea';
70
+ }
71
+ /**
72
+ * Constraint validation properties shared between an `<input>` and
73
+ * `<textarea>`.
74
+ */
75
+ interface SharedInputAndTextAreaState {
76
+ /**
77
+ * The current value.
78
+ */
79
+ readonly value: string;
80
+ /**
81
+ * Whether the textarea is required.
82
+ */
83
+ readonly required: boolean;
84
+ /**
85
+ * The minimum length of the value.
86
+ */
87
+ readonly minLength: number;
88
+ /**
89
+ * The maximum length of the value.
90
+ */
91
+ readonly maxLength: number;
92
+ }
93
+ /**
94
+ * A validator that provides constraint validation that emulates `<input>` and
95
+ * `<textarea>` validation.
96
+ */
97
+ export declare class TextFieldValidator extends Validator<TextFieldState> {
98
+ private inputControl?;
99
+ private textAreaControl?;
100
+ protected computeValidity({ state, renderedControl }: TextFieldState): {
101
+ validity: ValidityState;
102
+ validationMessage: string;
103
+ };
104
+ protected equals({ state: prev }: TextFieldState, { state: next }: TextFieldState): boolean;
105
+ protected copy({ state }: TextFieldState): TextFieldState;
106
+ private copyInput;
107
+ private copyTextArea;
108
+ private copySharedState;
109
+ }
110
+ export {};
111
+ //# sourceMappingURL=text-field-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field-validator.d.ts","sourceRoot":"","sources":["../../../../src/utils/behaviors/validators/text-field-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,UAAU,GAAG,aAAa,CAAC;IAElC;;;;;;;;;;;;;;OAcG;IACH,eAAe,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,2BAA2B;IAC7D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,2BAA2B;IAChE;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;;GAGG;AACH,UAAU,2BAA2B;IACnC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,OAAO,CAAC,YAAY,CAAC,CAAmB;IACxC,OAAO,CAAC,eAAe,CAAC,CAAsB;cAE3B,eAAe,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,EAAE,cAAc;;;;cA+FxD,MAAM,CACvB,EAAC,KAAK,EAAE,IAAI,EAAC,EAAE,cAAc,EAC7B,EAAC,KAAK,EAAE,IAAI,EAAC,EAAE,cAAc;cAyBZ,IAAI,CAAC,EAAC,KAAK,EAAC,EAAE,cAAc,GAAG,cAAc;IAWhE,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;CAQxB"}
@@ -0,0 +1,6 @@
1
+ import{Validator as t}from"./validator.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */class e extends t{computeValidity({state:t,renderedControl:e}){let r=e;n(t)&&!r?(r=this.inputControl||document.createElement("input"),this.inputControl=r):r||(r=this.textAreaControl||document.createElement("textarea"),this.textAreaControl=r);const a=n(t)?r:null;if(a&&(a.type=t.type),r.value!==t.value&&(r.value=t.value),r.required=t.required,a){const e=t;e.pattern?a.pattern=e.pattern:a.removeAttribute("pattern"),e.min?a.min=e.min:a.removeAttribute("min"),e.max?a.max=e.max:a.removeAttribute("max"),e.step?a.step=e.step:a.removeAttribute("step")}return(t.minLength??-1)>-1?r.setAttribute("minlength",String(t.minLength)):r.removeAttribute("minlength"),(t.maxLength??-1)>-1?r.setAttribute("maxlength",String(t.maxLength)):r.removeAttribute("maxlength"),{validity:r.validity,validationMessage:r.validationMessage}}equals({state:t},{state:e}){const r=t.type===e.type&&t.value===e.value&&t.required===e.required&&t.minLength===e.minLength&&t.maxLength===e.maxLength;return n(t)&&n(e)?r&&t.pattern===e.pattern&&t.min===e.min&&t.max===e.max&&t.step===e.step:r}copy({state:t}){return{state:n(t)?this.copyInput(t):this.copyTextArea(t),renderedControl:null}}copyInput(t){const{type:e,pattern:n,min:r,max:a,step:i}=t;return{...this.copySharedState(t),type:e,pattern:n,min:r,max:a,step:i}}copyTextArea(t){return{...this.copySharedState(t),type:t.type}}copySharedState({value:t,required:e,minLength:n,maxLength:r}){return{value:t,required:e,minLength:n,maxLength:r}}}function n(t){return"textarea"!==t.type}export{e as TextFieldValidator};
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * A class that computes and caches `ValidityStateFlags` for a component with
8
+ * a given `State` interface.
9
+ *
10
+ * Cached performance before computing validity is important since constraint
11
+ * validation must be checked frequently and synchronously when properties
12
+ * change.
13
+ *
14
+ * @template State The expected interface of properties relevant to constraint
15
+ * validation.
16
+ */
17
+ export declare abstract class Validator<State> {
18
+ /**
19
+ * The previous state, used to determine if state changed and validation needs
20
+ * to be re-computed.
21
+ */
22
+ private prevState?;
23
+ /**
24
+ * The current validity state and message. This is cached and returns if
25
+ * constraint validation state does not change.
26
+ */
27
+ private currentValidity;
28
+ private readonly getCurrentState;
29
+ /**
30
+ * Creates a new validator.
31
+ *
32
+ * @param getCurrentState A callback that returns the current state of
33
+ * constraint validation-related properties.
34
+ */
35
+ constructor(getCurrentState: () => State);
36
+ /**
37
+ * Returns the current `ValidityStateFlags` and validation message for the
38
+ * validator.
39
+ *
40
+ * If the constraint validation state has not changed, this will return a
41
+ * cached result. This is important since `getValidity()` can be called
42
+ * frequently in response to synchronous property changes.
43
+ *
44
+ * @return The current validity and validation message.
45
+ */
46
+ getValidity(): IValidityAndMessage;
47
+ /**
48
+ * Computes the `ValidityStateFlags` and validation message for a given set
49
+ * of constraint validation properties.
50
+ *
51
+ * Implementations can use platform elements like `<input>` and `<select>` to
52
+ * sync state and compute validation along with i18n'd messages. This function
53
+ * may be expensive, and is only called when state changes.
54
+ *
55
+ * @param state The new state of constraint validation properties.
56
+ * @return An object containing a `validity` property with
57
+ * `ValidityStateFlags` and a `validationMessage` property.
58
+ */
59
+ protected abstract computeValidity(state: State): IValidityAndMessage;
60
+ /**
61
+ * Checks if two states are equal. This is used to check against cached state
62
+ * to see if validity needs to be re-computed.
63
+ *
64
+ * @param prev The previous state.
65
+ * @param next The next state.
66
+ * @return True if the states are equal, or false if not.
67
+ */
68
+ protected abstract equals(prev: State, next: State): boolean;
69
+ /**
70
+ * Creates a copy of a state. This is used to cache state and check if it
71
+ * changes.
72
+ *
73
+ * Note: do NOT spread the {...state} to copy it. The actual state object is
74
+ * a web component, and trying to spread its getter/setter properties won't
75
+ * work.
76
+ *
77
+ * @param state The state to copy.
78
+ * @return A copy of the state.
79
+ */
80
+ protected abstract copy(state: State): State;
81
+ }
82
+ /**
83
+ * An object containing `ValidityStateFlags` and a corresponding validation
84
+ * message.
85
+ */
86
+ export interface IValidityAndMessage {
87
+ /**
88
+ * Validity flags.
89
+ */
90
+ validity: ValidityStateFlags;
91
+ /**
92
+ * The validation message for the associated flags. It may not be an empty
93
+ * string if any of the validity flags are `true`.
94
+ */
95
+ validationMessage: string;
96
+ }
97
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/utils/behaviors/validators/validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,8BAAsB,SAAS,CAAC,KAAK;IACjC;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,CAAO;IAEzB;;;OAGG;IACH,OAAO,CAAC,eAAe,CAGrB;IAEF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAa;IAE7C;;;;;OAKG;gBACS,eAAe,EAAE,MAAM,KAAK;IAIxC;;;;;;;;;OASG;IACH,WAAW,IAAI,mBAAmB;IA+BlC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB;IAErE;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO;IAE5D;;;;;;;;;;OAUG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,QAAQ,EAAE,kBAAkB,CAAA;IAE5B;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAA;CAC5B"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ class t{constructor(t){this.currentValidity={validity:{},validationMessage:""},this.getCurrentState=t}getValidity(){const t=this.getCurrentState();if(!(!this.prevState||!this.equals(this.prevState,t)))return this.currentValidity;const{validity:i,validationMessage:e}=this.computeValidity(t);return this.prevState=this.copy(t),this.currentValidity={validationMessage:e,validity:{badInput:i.badInput,customError:i.customError,patternMismatch:i.patternMismatch,rangeOverflow:i.rangeOverflow,rangeUnderflow:i.rangeUnderflow,stepMismatch:i.stepMismatch,tooLong:i.tooLong,tooShort:i.tooShort,typeMismatch:i.typeMismatch,valueMissing:i.valueMissing}},this.currentValidity}}export{t as Validator};
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * @link
7
+ * https://github.com/material-components/material-web/blob/main/internal/controller/attachable-controller.ts
8
+ */
9
+ import { type ReactiveController, type ReactiveControllerHost } from 'lit';
10
+ /**
11
+ * An element that can be attached to an associated controlling element.
12
+ */
13
+ export interface IAttachable {
14
+ /**
15
+ * Reflects the value of the `for` attribute, which is the ID of the element's
16
+ * associated control.
17
+ *
18
+ * Use this when the elements's associated control is not its parent.
19
+ *
20
+ * To manually control an element, set its `for` attribute to `""`.
21
+ *
22
+ * @example
23
+ * ```html
24
+ * <div class="container">
25
+ * <md-attachable for="interactive"></md-attachable>
26
+ * <button id="interactive">Action</button>
27
+ * </div>
28
+ * ```
29
+ *
30
+ * @example
31
+ * ```html
32
+ * <button class="manually-controlled">
33
+ * <md-attachable for=""></md-attachable>
34
+ * </button>
35
+ * ```
36
+ */
37
+ htmlFor: string | null;
38
+ /**
39
+ * Gets or sets the element that controls the visibility of the attachable
40
+ * element. It is one of:
41
+ *
42
+ * - The control referenced by the `for` attribute.
43
+ * - The control provided to `element.attach(control)`
44
+ * - The element's parent.
45
+ * - `null` if the element is not controlled.
46
+ */
47
+ control: HTMLElement | null;
48
+ /**
49
+ * Attaches the element to an interactive control.
50
+ *
51
+ * @param control The element that controls the attachable element.
52
+ */
53
+ attach(control: HTMLElement): void;
54
+ /**
55
+ * Detaches the element from its current control.
56
+ */
57
+ detach(): void;
58
+ }
59
+ /**
60
+ * A key to retrieve an `IAttachable` element's `AttachableController` from a
61
+ * global `MutationObserver`.
62
+ */
63
+ declare const ATTACHABLE_CONTROLLER: unique symbol;
64
+ /**
65
+ * The host of an `AttachableController`. The controller will add itself to
66
+ * the host so it can be retrieved in a global `MutationObserver`.
67
+ */
68
+ export interface IAttachableControllerHost extends ReactiveControllerHost, HTMLElement {
69
+ [ATTACHABLE_CONTROLLER]?: AttachableController;
70
+ }
71
+ /**
72
+ * A controller that provides an implementation for `IAttachable` elements.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * class MyElement extends LitElement implements IAttachable {
77
+ * get control() { return this.attachableController.control; }
78
+ *
79
+ * private readonly attachableController = new AttachableController(
80
+ * this,
81
+ * (previousControl, newControl) => {
82
+ * previousControl?.removeEventListener('click', this.handleClick);
83
+ * newControl?.addEventListener('click', this.handleClick);
84
+ * }
85
+ * );
86
+ *
87
+ * // Implement remaining `IAttachable` properties/methods that call the
88
+ * // controller's properties/methods.
89
+ * }
90
+ * ```
91
+ */
92
+ export declare class AttachableController implements ReactiveController, IAttachable {
93
+ private readonly host;
94
+ private readonly onControlChange;
95
+ get htmlFor(): string | null;
96
+ set htmlFor(htmlFor: string | null);
97
+ get control(): HTMLElement | null;
98
+ set control(control: HTMLElement | null);
99
+ private currentControl;
100
+ /**
101
+ * Creates a new controller for an `IAttachable` element.
102
+ *
103
+ * @param host The `IAttachable` element.
104
+ * @param onControlChange A callback with two parameters for the previous and
105
+ * next control. An `IAttachable` element may perform setup or teardown
106
+ * logic whenever the control changes.
107
+ */
108
+ constructor(host: IAttachableControllerHost, onControlChange: (prev: HTMLElement | null, next: HTMLElement | null) => void);
109
+ attach(control: HTMLElement): void;
110
+ detach(): void;
111
+ hostConnected(): void;
112
+ hostDisconnected(): void;
113
+ private setCurrentControl;
114
+ }
115
+ export {};
116
+ //# sourceMappingURL=attachable-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachable-controller.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/attachable-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAY,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;;;;;OAQG;IACH,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,qBAAqB,eAAiC,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB,EAAE,WAAW;IAClF,CAAC,qBAAqB,CAAC,CAAC,EAAE,oBAAoB,CAAC;CAClD;AAqBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB,EAAE,WAAW;IACxE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;IAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAGvB;IAET,IAAW,OAAO,IAIU,MAAM,GAAG,IAAI,CAFxC;IAED,IAAW,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAMxC;IAED,IAAW,OAAO,IAaU,WAAW,GAAG,IAAI,CAD7C;IACD,IAAW,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAM7C;IAED,OAAO,CAAC,cAAc,CAA4B;IAElD;;;;;;;OAOG;gBAEC,IAAI,EAAE,yBAAyB,EAC/B,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IAU1E,MAAM,CAAC,OAAO,EAAE,WAAW;IAW3B,MAAM;IAON,aAAa;IAIb,gBAAgB;IAIvB,OAAO,CAAC,iBAAiB;CAI5B"}
@@ -0,0 +1,9 @@
1
+ import"../../lit-element-Bf8D1KRw.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ *
7
+ * @link
8
+ * https://github.com/material-components/material-web/blob/main/internal/controller/attachable-controller.ts
9
+ */const t=Symbol("attachableController");let o;o=new MutationObserver(o=>{for(const r of o)r.target[t]?.hostConnected()});class r{get htmlFor(){return this.host.getAttribute("for")}set htmlFor(t){null===t?this.host.removeAttribute("for"):this.host.setAttribute("for",t)}get control(){return this.host.hasAttribute("for")?this.htmlFor&&this.host.isConnected?this.host.getRootNode().querySelector(`#${this.htmlFor}`):null:this.currentControl||this.host.parentElement}set control(t){t?this.attach(t):this.detach()}constructor(r,e){this.currentControl=null,this.host=r,this.onControlChange=e,r.addController(this),r[t]=this,o?.observe(r,{attributeFilter:["for"]})}attach(t){t!==this.currentControl&&(this.setCurrentControl(t),this.host.removeAttribute("for"))}detach(){this.setCurrentControl(null),this.host.setAttribute("for","")}hostConnected(){this.setCurrentControl(this.control)}hostDisconnected(){this.setCurrentControl(null)}setCurrentControl(t){this.onControlChange(this.currentControl,t),this.currentControl=t}}export{r as AttachableController};
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ReactiveElement } from 'lit';
7
+ import { type WithElementInternals } from '../behaviors/element-internals';
8
+ /**
9
+ * A string indicating the form submission behavior of the element.
10
+ *
11
+ * - submit: The element submits the form. This is the default value if the
12
+ * attribute is not specified, or if it is dynamically changed to an empty or
13
+ * invalid value.
14
+ * - reset: The element resets the form.
15
+ * - button: The element does nothing.
16
+ */
17
+ export type FormSubmitterType = 'button' | 'submit' | 'reset';
18
+ /**
19
+ * An element that can submit or reset a `<form>`, similar to
20
+ * `<button type="submit">`.
21
+ */
22
+ export interface FormSubmitter extends ReactiveElement, WithElementInternals {
23
+ /**
24
+ * A string indicating the form submission behavior of the element.
25
+ *
26
+ * - submit: The element submits the form. This is the default value if the
27
+ * attribute is not specified, or if it is dynamically changed to an empty or
28
+ * invalid value.
29
+ * - reset: The element resets the form.
30
+ * - button: The element does nothing.
31
+ */
32
+ type: FormSubmitterType;
33
+ /**
34
+ * The HTML name to use in form submission. When combined with a `value`, the
35
+ * submitting button's name/value will be added to the form.
36
+ *
37
+ * Names must reflect to a `name` attribute for form integration.
38
+ */
39
+ name: string;
40
+ /**
41
+ * The value of the button. When combined with a `name`, the submitting
42
+ * button's name/value will be added to the form.
43
+ */
44
+ value: string;
45
+ }
46
+ type FormSubmitterConstructor = (new () => FormSubmitter) | (abstract new () => FormSubmitter);
47
+ /**
48
+ * Sets up an element's constructor to enable form submission. The element
49
+ * instance should be form associated and have a `type` property.
50
+ *
51
+ * A click listener is added to each element instance. If the click is not
52
+ * default prevented, it will submit the element's form, if any.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * class MyElement extends mixinElementInternals(LitElement) {
57
+ * static {
58
+ * setupFormSubmitter(MyElement);
59
+ * }
60
+ *
61
+ * static formAssociated = true;
62
+ *
63
+ * type: FormSubmitterType = 'submit';
64
+ * }
65
+ * ```
66
+ *
67
+ * @param ctor The form submitter element's constructor.
68
+ */
69
+ export declare function setupFormSubmitter(ctor: FormSubmitterConstructor): void;
70
+ export {};
71
+ //# sourceMappingURL=form-submitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-submitter.d.ts","sourceRoot":"","sources":["../../../src/utils/controller/form-submitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAY,eAAe,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,gCAAgC,CAAA;AAErF;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7D;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,eAAe,EAAE,oBAAoB;IACxE;;;;;;;;OAQG;IACH,IAAI,EAAE,iBAAiB,CAAA;IAEvB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,KAAK,wBAAwB,GACvB,CAAC,UAAU,aAAa,CAAC,GACzB,CAAC,QAAQ,WAAW,aAAa,CAAC,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,wBAAwB,QAgDhE"}
@@ -0,0 +1,6 @@
1
+ import"../../lit-element-Bf8D1KRw.js";import{internals as e}from"../behaviors/element-internals.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */function t(t){t.addInitializer(t=>{const r=t;r.addEventListener("click",async t=>{const{type:n,[e]:i}=r,{form:s}=i;s&&"button"!==n&&(await new Promise(e=>{setTimeout(e)}),t.defaultPrevented||("reset"!==n?(s.addEventListener("submit",e=>{Object.defineProperty(e,"submitter",{configurable:!0,enumerable:!0,get:()=>r})},{capture:!0,once:!0}),i.setFormValue(r.value),s.requestSubmit()):s.reset()))})})}export{t as setupFormSubmitter};
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Add a hook for an event that is called after the event is dispatched and
8
+ * propagates to other event listeners.
9
+ *
10
+ * This is useful for behaviors that need to check if an event is canceled.
11
+ *
12
+ * The callback is invoked synchronously, which allows for better integration
13
+ * with synchronous platform APIs (like `<form>` or `<label>` clicking).
14
+ *
15
+ * Note: `setupDispatchHooks()` must be called on the element before adding any
16
+ * other event listeners. Call it in the constructor of an element or
17
+ * controller.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * class MyControl extends LitElement {
22
+ * constructor() {
23
+ * super();
24
+ * setupDispatchHooks(this, 'click');
25
+ * this.addEventListener('click', event => {
26
+ * afterDispatch(event, () => {
27
+ * if (event.defaultPrevented) {
28
+ * return
29
+ * }
30
+ *
31
+ * // ... perform logic
32
+ * });
33
+ * });
34
+ * }
35
+ * }
36
+ * ```
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * class MyController implements ReactiveController {
41
+ * constructor(host: ReactiveElement) {
42
+ * // setupDispatchHooks() may be called multiple times for the same
43
+ * // element and events, making it safe for multiple controllers to use it.
44
+ * setupDispatchHooks(host, 'click');
45
+ * host.addEventListener('click', event => {
46
+ * afterDispatch(event, () => {
47
+ * if (event.defaultPrevented) {
48
+ * return;
49
+ * }
50
+ *
51
+ * // ... perform logic
52
+ * });
53
+ * });
54
+ * }
55
+ * }
56
+ * ```
57
+ *
58
+ * @param event The event to add a hook to.
59
+ * @param callback A hook that is called after the event finishes dispatching.
60
+ */
61
+ export declare function afterDispatch(event: Event, callback: () => void): void;
62
+ /**
63
+ * Sets up an element to add dispatch hooks to given event types. This must be
64
+ * called before adding any event listeners that need to use dispatch hooks
65
+ * like `afterDispatch()`.
66
+ *
67
+ * This function is safe to call multiple times with the same element or event
68
+ * types. Call it in the constructor of elements, mixins, and controllers to
69
+ * ensure it is set up before external listeners.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * class MyControl extends LitElement {
74
+ * constructor() {
75
+ * super();
76
+ * setupDispatchHooks(this, 'click');
77
+ * this.addEventListener('click', this.listenerUsingAfterDispatch);
78
+ * }
79
+ * }
80
+ * ```
81
+ *
82
+ * @param element The element to set up event dispatch hooks for.
83
+ * @param eventTypes The event types to add dispatch hooks to.
84
+ */
85
+ export declare function setupDispatchHooks(element: Element, ...eventTypes: [string, ...string[]]): void;
86
+ //# sourceMappingURL=dispatch-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/event/dispatch-hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,QAO/D;AASD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,GAAG,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,QA6DrC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ const t=Symbol("dispatchHooks");function e(e,n){const o=e[t];if(!o)throw new Error(`'${e.type}' event needs setupDispatchHooks().`);o.addEventListener("after",n)}const n=new WeakMap;function o(e,...o){let s=n.get(e);s||(s=new Set,n.set(e,s));for(const n of o){if(s.has(n))continue;let o=!1;e.addEventListener(n,n=>{if(o)return;n.stopImmediatePropagation();const s=Reflect.construct(n.constructor,[n.type,n]),c=new EventTarget;s[t]=c,o=!0;const r=e.dispatchEvent(s);o=!1,r||n.preventDefault(),c.dispatchEvent(new Event("after"))},{capture:!0}),s.add(n)}}export{e as afterDispatch,o as setupDispatchHooks};