@yewdiel21/motion-kit 0.10.0 → 0.15.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 (459) hide show
  1. package/README.md +81 -0
  2. package/bin/motion-kit.mjs +3 -3
  3. package/dist/auto/index.d.ts +56 -3
  4. package/dist/auto/index.js +107 -3
  5. package/dist/auto/index.js.map +1 -1
  6. package/dist/{chunk-XAKC2QY7.js → chunk-6IRJYXJU.js} +3 -28
  7. package/dist/chunk-6IRJYXJU.js.map +1 -0
  8. package/dist/chunk-A6QQCF6V.js +21333 -0
  9. package/dist/chunk-A6QQCF6V.js.map +1 -0
  10. package/dist/chunk-JXRS3OEA.js +3638 -0
  11. package/dist/chunk-JXRS3OEA.js.map +1 -0
  12. package/dist/chunk-QP4QJOEN.js +72 -0
  13. package/dist/chunk-QP4QJOEN.js.map +1 -0
  14. package/dist/css/components/activity-feed.css +240 -0
  15. package/dist/css/components/add-to-cart.css +72 -0
  16. package/dist/css/components/attachment.css +266 -0
  17. package/dist/css/components/bidirectional-slider.css +168 -0
  18. package/dist/css/components/breadcrumb.css +110 -0
  19. package/dist/css/components/chart-tooltip.css +168 -0
  20. package/dist/css/components/chart.css +296 -0
  21. package/dist/css/components/code-block.css +264 -0
  22. package/dist/css/components/color-area.css +82 -0
  23. package/dist/css/components/color-field.css +67 -0
  24. package/dist/css/components/color-picker.css +131 -0
  25. package/dist/css/components/color-slider.css +113 -0
  26. package/dist/css/components/command-search.css +252 -0
  27. package/dist/css/components/context-menu.css +23 -0
  28. package/dist/css/components/credit-card.css +288 -0
  29. package/dist/css/components/data-table.css +686 -0
  30. package/dist/css/components/date-range-picker.css +168 -0
  31. package/dist/css/components/date-time-picker.css +178 -0
  32. package/dist/css/components/drawer.css +58 -0
  33. package/dist/css/components/editable-table.css +201 -0
  34. package/dist/css/components/empty-state.css +61 -0
  35. package/dist/css/components/file-explorer.css +633 -0
  36. package/dist/css/components/filter-builder.css +227 -0
  37. package/dist/css/components/heatmap-chart.css +391 -0
  38. package/dist/css/components/hold-confirm.css +87 -0
  39. package/dist/css/components/hover-card.css +19 -7
  40. package/dist/css/components/image-preview.css +283 -0
  41. package/dist/css/components/json-viewer.css +304 -0
  42. package/dist/css/components/like-button.css +78 -0
  43. package/dist/css/components/link-preview.css +275 -0
  44. package/dist/css/components/loading-button.css +77 -0
  45. package/dist/css/components/multi-select.css +267 -0
  46. package/dist/css/components/nav.css +102 -102
  47. package/dist/css/components/notification-bell.css +127 -0
  48. package/dist/css/components/orbit-menu.css +130 -0
  49. package/dist/css/components/pagination.css +10 -5
  50. package/dist/css/components/password-strength.css +183 -0
  51. package/dist/css/components/pie-chart.css +390 -0
  52. package/dist/css/components/pill-button.css +135 -0
  53. package/dist/css/components/popover.css +25 -0
  54. package/dist/css/components/progress.css +140 -0
  55. package/dist/css/components/questionnaire.css +217 -0
  56. package/dist/css/components/radar-chart.css +370 -0
  57. package/dist/css/components/radial-chart.css +398 -0
  58. package/dist/css/components/range-calendar.css +186 -0
  59. package/dist/css/components/range-slider.css +192 -0
  60. package/dist/css/components/resizable-panel.css +243 -0
  61. package/dist/css/components/rich-text-editor.css +284 -0
  62. package/dist/css/components/sankey-chart.css +358 -0
  63. package/dist/css/components/scratch-card.css +75 -0
  64. package/dist/css/components/scroll-island.css +111 -0
  65. package/dist/css/components/select.css +136 -0
  66. package/dist/css/components/skeleton.css +108 -0
  67. package/dist/css/components/split-view.css +19 -0
  68. package/dist/css/components/star-rating.css +80 -0
  69. package/dist/css/components/stat-card.css +164 -0
  70. package/dist/css/components/swipe-actions.css +105 -0
  71. package/dist/css/components/tag-input.css +244 -0
  72. package/dist/css/components/time-field.css +88 -0
  73. package/dist/css/components/timeline.css +219 -0
  74. package/dist/css/components/toolbar.css +122 -0
  75. package/dist/css/components/tooltip.css +79 -0
  76. package/dist/css/components/tree-view.css +289 -0
  77. package/dist/css/components/virtual-list.css +195 -0
  78. package/dist/css/components/voice-dots.css +70 -0
  79. package/dist/css/tokens.css +185 -181
  80. package/dist/elements/index.d.ts +849 -7
  81. package/dist/elements/index.js +1642 -8
  82. package/dist/elements/index.js.map +1 -1
  83. package/dist/{engine-GDGwQnJE.d.ts → engine-5zRIssTO.d.ts} +11 -1
  84. package/dist/engine-QECQnGz1.d.ts +33 -0
  85. package/dist/index.css +10890 -311
  86. package/dist/index.d.ts +89 -5
  87. package/dist/index.js +273 -9
  88. package/dist/index.js.map +1 -1
  89. package/dist/react/index.d.ts +686 -24
  90. package/dist/react/index.js +2345 -9
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/{reduced-BmBzKH94.d.ts → reduced-6X_bns60.d.ts} +9 -2
  93. package/dist/reveal-BfyKKsw4.d.ts +2474 -0
  94. package/dist/store-CA2Qcun_.d.ts +453 -0
  95. package/package.json +9 -16
  96. package/registry.json +1096 -543
  97. package/src/auto/auto-init.ts +104 -0
  98. package/src/components/activity-feed/README.md +56 -0
  99. package/src/components/activity-feed/activity-feed.css +239 -0
  100. package/src/components/activity-feed/element.ts +36 -0
  101. package/src/components/activity-feed/engine.ts +351 -0
  102. package/src/components/activity-feed/react.tsx +32 -0
  103. package/src/components/add-to-cart/README.md +34 -0
  104. package/src/components/add-to-cart/add-to-cart.css +71 -0
  105. package/src/components/add-to-cart/element.ts +20 -0
  106. package/src/components/add-to-cart/engine.ts +206 -0
  107. package/src/components/add-to-cart/react.tsx +29 -0
  108. package/src/components/attachment/README.md +27 -0
  109. package/src/components/attachment/attachment.css +265 -0
  110. package/src/components/attachment/element.ts +50 -0
  111. package/src/components/attachment/engine.ts +469 -0
  112. package/src/components/attachment/react.tsx +65 -0
  113. package/src/components/bidirectional-slider/README.md +46 -0
  114. package/src/components/bidirectional-slider/bidirectional-slider.css +167 -0
  115. package/src/components/bidirectional-slider/element.ts +42 -0
  116. package/src/components/bidirectional-slider/engine.ts +289 -0
  117. package/src/components/bidirectional-slider/react.tsx +45 -0
  118. package/src/components/breadcrumb/README.md +38 -0
  119. package/src/components/breadcrumb/breadcrumb.css +109 -0
  120. package/src/components/breadcrumb/element.ts +27 -0
  121. package/src/components/breadcrumb/engine.ts +249 -0
  122. package/src/components/breadcrumb/react.tsx +30 -0
  123. package/src/components/chart/README.md +34 -0
  124. package/src/components/chart/chart.css +295 -0
  125. package/src/components/chart/element.ts +43 -0
  126. package/src/components/chart/engine.ts +838 -0
  127. package/src/components/chart/parts.ts +237 -0
  128. package/src/components/chart/react.tsx +50 -0
  129. package/src/components/chart/use-chart.ts +55 -0
  130. package/src/components/chart-tooltip/README.md +53 -0
  131. package/src/components/chart-tooltip/chart-tooltip.css +167 -0
  132. package/src/components/chart-tooltip/element.ts +37 -0
  133. package/src/components/chart-tooltip/engine.ts +442 -0
  134. package/src/components/chart-tooltip/react.tsx +47 -0
  135. package/src/components/code-block/README.md +19 -0
  136. package/src/components/code-block/code-block.css +263 -0
  137. package/src/components/code-block/element.ts +34 -0
  138. package/src/components/code-block/engine.ts +254 -0
  139. package/src/components/code-block/highlight.ts +244 -0
  140. package/src/components/code-block/react.tsx +94 -0
  141. package/src/components/color-area/README.md +50 -0
  142. package/src/components/color-area/color-area.css +81 -0
  143. package/src/components/color-area/element.ts +26 -0
  144. package/src/components/color-area/engine.ts +246 -0
  145. package/src/components/color-area/react.tsx +42 -0
  146. package/src/components/color-field/README.md +43 -0
  147. package/src/components/color-field/color-field.css +66 -0
  148. package/src/components/color-field/element.ts +26 -0
  149. package/src/components/color-field/engine.ts +174 -0
  150. package/src/components/color-field/react.tsx +42 -0
  151. package/src/components/color-picker/README.md +45 -0
  152. package/src/components/color-picker/color-picker.css +130 -0
  153. package/src/components/color-picker/element.ts +45 -0
  154. package/src/components/color-picker/engine.ts +314 -0
  155. package/src/components/color-picker/react.tsx +47 -0
  156. package/src/components/color-slider/README.md +55 -0
  157. package/src/components/color-slider/color-slider.css +112 -0
  158. package/src/components/color-slider/element.ts +26 -0
  159. package/src/components/color-slider/engine.ts +234 -0
  160. package/src/components/color-slider/react.tsx +45 -0
  161. package/src/components/command-search/README.md +15 -0
  162. package/src/components/command-search/command-search.css +251 -0
  163. package/src/components/command-search/element.ts +36 -0
  164. package/src/components/command-search/engine.ts +356 -0
  165. package/src/components/command-search/match.ts +53 -0
  166. package/src/components/command-search/react.tsx +66 -0
  167. package/src/components/context-menu/README.md +31 -0
  168. package/src/components/context-menu/context-menu.css +22 -0
  169. package/src/components/context-menu/element.ts +40 -0
  170. package/src/components/context-menu/engine.ts +153 -0
  171. package/src/components/context-menu/react.tsx +57 -0
  172. package/src/components/credit-card/README.md +20 -0
  173. package/src/components/credit-card/card.ts +77 -0
  174. package/src/components/credit-card/credit-card.css +287 -0
  175. package/src/components/credit-card/element.ts +33 -0
  176. package/src/components/credit-card/engine.ts +410 -0
  177. package/src/components/credit-card/react.tsx +36 -0
  178. package/src/components/data-table/README.md +83 -0
  179. package/src/components/data-table/data-table.css +685 -0
  180. package/src/components/data-table/element.ts +54 -0
  181. package/src/components/data-table/engine.ts +1111 -0
  182. package/src/components/data-table/react.tsx +94 -0
  183. package/src/components/date-range-picker/README.md +51 -0
  184. package/src/components/date-range-picker/date-range-picker.css +167 -0
  185. package/src/components/date-range-picker/element.ts +52 -0
  186. package/src/components/date-range-picker/engine.ts +352 -0
  187. package/src/components/date-range-picker/react.tsx +57 -0
  188. package/src/components/date-time-picker/README.md +48 -0
  189. package/src/components/date-time-picker/date-time-picker.css +177 -0
  190. package/src/components/date-time-picker/element.ts +47 -0
  191. package/src/components/date-time-picker/engine.ts +350 -0
  192. package/src/components/date-time-picker/react.tsx +54 -0
  193. package/src/components/dialog/README.md +103 -102
  194. package/src/components/dialog/element.ts +123 -118
  195. package/src/components/dialog/engine.ts +449 -432
  196. package/src/components/drawer/README.md +28 -0
  197. package/src/components/drawer/drawer.css +57 -0
  198. package/src/components/drawer/element.ts +21 -0
  199. package/src/components/drawer/engine.ts +56 -0
  200. package/src/components/drawer/react.tsx +85 -0
  201. package/src/components/editable-table/README.md +67 -0
  202. package/src/components/editable-table/editable-table.css +200 -0
  203. package/src/components/editable-table/element.ts +45 -0
  204. package/src/components/editable-table/engine.ts +831 -0
  205. package/src/components/editable-table/react.tsx +79 -0
  206. package/src/components/empty-state/README.md +41 -0
  207. package/src/components/empty-state/element.ts +23 -0
  208. package/src/components/empty-state/empty-state.css +60 -0
  209. package/src/components/empty-state/engine.ts +232 -0
  210. package/src/components/empty-state/react.tsx +34 -0
  211. package/src/components/file-explorer/README.md +67 -0
  212. package/src/components/file-explorer/element.ts +39 -0
  213. package/src/components/file-explorer/engine.ts +1307 -0
  214. package/src/components/file-explorer/file-explorer.css +632 -0
  215. package/src/components/file-explorer/react.tsx +77 -0
  216. package/src/components/filter-builder/README.md +47 -0
  217. package/src/components/filter-builder/element.ts +34 -0
  218. package/src/components/filter-builder/engine.ts +396 -0
  219. package/src/components/filter-builder/filter-builder.css +226 -0
  220. package/src/components/filter-builder/react.tsx +36 -0
  221. package/src/components/heatmap-chart/README.md +48 -0
  222. package/src/components/heatmap-chart/element.ts +21 -0
  223. package/src/components/heatmap-chart/engine.ts +281 -0
  224. package/src/components/heatmap-chart/heatmap-chart.css +93 -0
  225. package/src/components/heatmap-chart/react.tsx +14 -0
  226. package/src/components/hold-confirm/README.md +13 -0
  227. package/src/components/hold-confirm/element.ts +24 -0
  228. package/src/components/hold-confirm/engine.ts +216 -0
  229. package/src/components/hold-confirm/hold-confirm.css +86 -0
  230. package/src/components/hold-confirm/react.tsx +28 -0
  231. package/src/components/hover-card/README.md +6 -2
  232. package/src/components/hover-card/engine.ts +98 -7
  233. package/src/components/hover-card/hover-card.css +19 -7
  234. package/src/components/image-preview/README.md +16 -0
  235. package/src/components/image-preview/element.ts +26 -0
  236. package/src/components/image-preview/engine.ts +405 -0
  237. package/src/components/image-preview/image-preview.css +282 -0
  238. package/src/components/image-preview/react.tsx +43 -0
  239. package/src/components/json-viewer/README.md +56 -0
  240. package/src/components/json-viewer/element.ts +37 -0
  241. package/src/components/json-viewer/engine.ts +449 -0
  242. package/src/components/json-viewer/json-viewer.css +303 -0
  243. package/src/components/json-viewer/react.tsx +56 -0
  244. package/src/components/like-button/README.md +13 -0
  245. package/src/components/like-button/element.ts +47 -0
  246. package/src/components/like-button/engine.ts +145 -0
  247. package/src/components/like-button/like-button.css +77 -0
  248. package/src/components/like-button/react.tsx +39 -0
  249. package/src/components/link-preview/README.md +19 -0
  250. package/src/components/link-preview/element.ts +29 -0
  251. package/src/components/link-preview/engine.ts +192 -0
  252. package/src/components/link-preview/link-preview.css +274 -0
  253. package/src/components/link-preview/react.tsx +101 -0
  254. package/src/components/loading-button/README.md +45 -0
  255. package/src/components/loading-button/element.ts +34 -0
  256. package/src/components/loading-button/engine.ts +201 -0
  257. package/src/components/loading-button/loading-button.css +76 -0
  258. package/src/components/loading-button/react.tsx +43 -0
  259. package/src/components/multi-select/README.md +48 -0
  260. package/src/components/multi-select/element.ts +28 -0
  261. package/src/components/multi-select/engine.ts +294 -0
  262. package/src/components/multi-select/multi-select.css +266 -0
  263. package/src/components/multi-select/react.tsx +39 -0
  264. package/src/components/nav/README.md +12 -10
  265. package/src/components/nav/element.ts +5 -5
  266. package/src/components/nav/engine.ts +21 -14
  267. package/src/components/nav/nav.css +102 -102
  268. package/src/components/nav/react.tsx +4 -4
  269. package/src/components/notification-bell/README.md +14 -0
  270. package/src/components/notification-bell/element.ts +48 -0
  271. package/src/components/notification-bell/engine.ts +202 -0
  272. package/src/components/notification-bell/notification-bell.css +126 -0
  273. package/src/components/notification-bell/react.tsx +57 -0
  274. package/src/components/orbit-menu/README.md +46 -0
  275. package/src/components/orbit-menu/element.ts +27 -0
  276. package/src/components/orbit-menu/engine.ts +179 -0
  277. package/src/components/orbit-menu/orbit-menu.css +129 -0
  278. package/src/components/orbit-menu/react.tsx +44 -0
  279. package/src/components/pagination/README.md +1 -1
  280. package/src/components/pagination/engine.ts +50 -4
  281. package/src/components/pagination/pagination.css +10 -5
  282. package/src/components/password-strength/README.md +17 -0
  283. package/src/components/password-strength/element.ts +22 -0
  284. package/src/components/password-strength/engine.ts +212 -0
  285. package/src/components/password-strength/password-strength.css +182 -0
  286. package/src/components/password-strength/react.tsx +36 -0
  287. package/src/components/password-strength/score.ts +62 -0
  288. package/src/components/pie-chart/README.md +48 -0
  289. package/src/components/pie-chart/element.ts +30 -0
  290. package/src/components/pie-chart/engine.ts +283 -0
  291. package/src/components/pie-chart/pie-chart.css +92 -0
  292. package/src/components/pie-chart/react.tsx +14 -0
  293. package/src/components/pill-button/README.md +46 -0
  294. package/src/components/pill-button/element.ts +16 -0
  295. package/src/components/pill-button/engine.ts +77 -0
  296. package/src/components/pill-button/pill-button.css +134 -0
  297. package/src/components/pill-button/react.tsx +32 -0
  298. package/src/components/popover/README.md +44 -0
  299. package/src/components/popover/element.ts +31 -0
  300. package/src/components/popover/engine.ts +114 -0
  301. package/src/components/popover/popover.css +24 -0
  302. package/src/components/popover/react.tsx +50 -0
  303. package/src/components/progress/README.md +17 -0
  304. package/src/components/progress/element.ts +30 -0
  305. package/src/components/progress/engine.ts +173 -0
  306. package/src/components/progress/progress.css +139 -0
  307. package/src/components/progress/react.tsx +35 -0
  308. package/src/components/questionnaire/README.md +32 -0
  309. package/src/components/questionnaire/element.ts +118 -0
  310. package/src/components/questionnaire/engine.ts +255 -0
  311. package/src/components/questionnaire/questionnaire.css +216 -0
  312. package/src/components/questionnaire/react.tsx +140 -0
  313. package/src/components/radar-chart/README.md +48 -0
  314. package/src/components/radar-chart/element.ts +30 -0
  315. package/src/components/radar-chart/engine.ts +327 -0
  316. package/src/components/radar-chart/radar-chart.css +72 -0
  317. package/src/components/radar-chart/react.tsx +14 -0
  318. package/src/components/radial-chart/README.md +48 -0
  319. package/src/components/radial-chart/element.ts +30 -0
  320. package/src/components/radial-chart/engine.ts +290 -0
  321. package/src/components/radial-chart/radial-chart.css +100 -0
  322. package/src/components/radial-chart/react.tsx +14 -0
  323. package/src/components/range-calendar/README.md +58 -0
  324. package/src/components/range-calendar/element.ts +42 -0
  325. package/src/components/range-calendar/engine.ts +390 -0
  326. package/src/components/range-calendar/range-calendar.css +185 -0
  327. package/src/components/range-calendar/react.tsx +56 -0
  328. package/src/components/range-slider/README.md +23 -0
  329. package/src/components/range-slider/element.ts +53 -0
  330. package/src/components/range-slider/engine.ts +316 -0
  331. package/src/components/range-slider/range-slider.css +191 -0
  332. package/src/components/range-slider/react.tsx +66 -0
  333. package/src/components/resizable-panel/README.md +61 -0
  334. package/src/components/resizable-panel/element.ts +36 -0
  335. package/src/components/resizable-panel/engine.ts +551 -0
  336. package/src/components/resizable-panel/react.tsx +74 -0
  337. package/src/components/resizable-panel/resizable-panel.css +242 -0
  338. package/src/components/rich-text-editor/README.md +57 -0
  339. package/src/components/rich-text-editor/element.ts +34 -0
  340. package/src/components/rich-text-editor/engine.ts +673 -0
  341. package/src/components/rich-text-editor/react.tsx +60 -0
  342. package/src/components/rich-text-editor/rich-text-editor.css +283 -0
  343. package/src/components/sankey-chart/README.md +48 -0
  344. package/src/components/sankey-chart/element.ts +31 -0
  345. package/src/components/sankey-chart/engine.ts +401 -0
  346. package/src/components/sankey-chart/react.tsx +14 -0
  347. package/src/components/sankey-chart/sankey-chart.css +60 -0
  348. package/src/components/scratch-card/README.md +15 -0
  349. package/src/components/scratch-card/element.ts +30 -0
  350. package/src/components/scratch-card/engine.ts +257 -0
  351. package/src/components/scratch-card/react.tsx +40 -0
  352. package/src/components/scratch-card/scratch-card.css +74 -0
  353. package/src/components/scroll-island/README.md +34 -0
  354. package/src/components/scroll-island/element.ts +16 -0
  355. package/src/components/scroll-island/engine.ts +252 -0
  356. package/src/components/scroll-island/react.tsx +26 -0
  357. package/src/components/scroll-island/scroll-island.css +110 -0
  358. package/src/components/select/README.md +34 -0
  359. package/src/components/select/element.ts +26 -0
  360. package/src/components/select/engine.ts +267 -0
  361. package/src/components/select/react.tsx +33 -0
  362. package/src/components/select/select.css +135 -0
  363. package/src/components/skeleton/README.md +15 -0
  364. package/src/components/skeleton/element.ts +32 -0
  365. package/src/components/skeleton/engine.ts +104 -0
  366. package/src/components/skeleton/react.tsx +41 -0
  367. package/src/components/skeleton/skeleton.css +107 -0
  368. package/src/components/split-view/README.md +50 -0
  369. package/src/components/split-view/element.ts +34 -0
  370. package/src/components/split-view/engine.ts +114 -0
  371. package/src/components/split-view/react.tsx +63 -0
  372. package/src/components/split-view/split-view.css +18 -0
  373. package/src/components/star-rating/README.md +14 -0
  374. package/src/components/star-rating/element.ts +26 -0
  375. package/src/components/star-rating/engine.ts +217 -0
  376. package/src/components/star-rating/react.tsx +33 -0
  377. package/src/components/star-rating/star-rating.css +79 -0
  378. package/src/components/stat-card/README.md +42 -0
  379. package/src/components/stat-card/element.ts +40 -0
  380. package/src/components/stat-card/engine.ts +283 -0
  381. package/src/components/stat-card/react.tsx +36 -0
  382. package/src/components/stat-card/stat-card.css +163 -0
  383. package/src/components/swipe-actions/README.md +19 -0
  384. package/src/components/swipe-actions/element.ts +26 -0
  385. package/src/components/swipe-actions/engine.ts +260 -0
  386. package/src/components/swipe-actions/react.tsx +80 -0
  387. package/src/components/swipe-actions/swipe-actions.css +104 -0
  388. package/src/components/tag-input/README.md +42 -0
  389. package/src/components/tag-input/element.ts +39 -0
  390. package/src/components/tag-input/engine.ts +313 -0
  391. package/src/components/tag-input/react.tsx +54 -0
  392. package/src/components/tag-input/tag-input.css +243 -0
  393. package/src/components/time-field/README.md +54 -0
  394. package/src/components/time-field/element.ts +38 -0
  395. package/src/components/time-field/engine.ts +110 -0
  396. package/src/components/time-field/react.tsx +45 -0
  397. package/src/components/time-field/time-field.css +87 -0
  398. package/src/components/timeline/README.md +57 -0
  399. package/src/components/timeline/element.ts +31 -0
  400. package/src/components/timeline/engine.ts +300 -0
  401. package/src/components/timeline/react.tsx +59 -0
  402. package/src/components/timeline/timeline.css +218 -0
  403. package/src/components/toolbar/README.md +46 -0
  404. package/src/components/toolbar/element.ts +30 -0
  405. package/src/components/toolbar/engine.ts +230 -0
  406. package/src/components/toolbar/react.tsx +34 -0
  407. package/src/components/toolbar/toolbar.css +121 -0
  408. package/src/components/tooltip/README.md +46 -0
  409. package/src/components/tooltip/element.ts +22 -0
  410. package/src/components/tooltip/engine.ts +288 -0
  411. package/src/components/tooltip/react.tsx +30 -0
  412. package/src/components/tooltip/tooltip.css +78 -0
  413. package/src/components/tree-view/README.md +61 -0
  414. package/src/components/tree-view/element.ts +32 -0
  415. package/src/components/tree-view/engine.ts +743 -0
  416. package/src/components/tree-view/react.tsx +82 -0
  417. package/src/components/tree-view/tree-view.css +288 -0
  418. package/src/components/virtual-list/README.md +81 -0
  419. package/src/components/virtual-list/element.ts +42 -0
  420. package/src/components/virtual-list/engine.ts +678 -0
  421. package/src/components/virtual-list/react.tsx +101 -0
  422. package/src/components/virtual-list/virtual-list.css +194 -0
  423. package/src/components/voice-dots/README.md +48 -0
  424. package/src/components/voice-dots/element.ts +45 -0
  425. package/src/components/voice-dots/engine.ts +243 -0
  426. package/src/components/voice-dots/react.tsx +52 -0
  427. package/src/components/voice-dots/voice-dots.css +69 -0
  428. package/src/core/chips.ts +196 -0
  429. package/src/core/color.ts +304 -0
  430. package/src/core/date-range.ts +67 -0
  431. package/src/core/dates.ts +11 -1
  432. package/src/core/files.ts +107 -0
  433. package/src/core/filter.ts +229 -0
  434. package/src/core/gsap.ts +80 -65
  435. package/src/core/listbox.ts +332 -0
  436. package/src/core/mark.ts +29 -0
  437. package/src/core/position.ts +89 -0
  438. package/src/core/relative-time.ts +77 -0
  439. package/src/core/segment-field.ts +373 -0
  440. package/src/core/segments.ts +153 -0
  441. package/src/core/tree.ts +116 -0
  442. package/src/core/virtual.ts +79 -0
  443. package/src/css/tokens.css +186 -182
  444. package/src/elements/index.ts +186 -0
  445. package/src/index.ts +88 -0
  446. package/src/motion/liquid.ts +14 -4
  447. package/src/motion/micro.ts +248 -0
  448. package/src/motion/sheet.ts +88 -65
  449. package/src/motion/surface.ts +9 -0
  450. package/src/react/index.ts +71 -1
  451. package/dist/chunk-IKQ5FODN.js +0 -1617
  452. package/dist/chunk-IKQ5FODN.js.map +0 -1
  453. package/dist/chunk-J6OCFNGU.js +0 -177
  454. package/dist/chunk-J6OCFNGU.js.map +0 -1
  455. package/dist/chunk-TFNRIZHU.js +0 -3977
  456. package/dist/chunk-TFNRIZHU.js.map +0 -1
  457. package/dist/chunk-XAKC2QY7.js.map +0 -1
  458. package/dist/reveal-jsX-uwUz.d.ts +0 -625
  459. package/dist/store-DYb3tTsZ.d.ts +0 -195
@@ -0,0 +1,244 @@
1
+ /*
2
+ * A small syntax highlighter for code blocks: no dependency, no HTML parsing.
3
+ * It splits code into typed tokens whose texts concatenate back to the exact
4
+ * input, then builds one [data-mk-code-line] per line with spans created
5
+ * through textContent, so markup in the code is always shown, never run.
6
+ * Languages: ts, js, tsx, jsx, json, css, html (also xml, svg, astro, vue), bash (sh, shell, zsh).
7
+ */
8
+
9
+ export type TokenType = 'plain' | 'keyword' | 'string' | 'comment' | 'number' | 'tag' | 'attr' | 'property' | 'function' | 'punctuation' | 'operator';
10
+
11
+ export interface Token {
12
+ type: TokenType;
13
+ text: string;
14
+ }
15
+
16
+ type Family = 'script' | 'markup' | 'css' | 'shell' | 'json' | 'plain';
17
+
18
+ const ALIASES: Record<string, Family> = {
19
+ ts: 'script',
20
+ typescript: 'script',
21
+ js: 'script',
22
+ javascript: 'script',
23
+ mjs: 'script',
24
+ cjs: 'script',
25
+ tsx: 'script',
26
+ jsx: 'script',
27
+ json: 'json',
28
+ css: 'css',
29
+ scss: 'css',
30
+ html: 'markup',
31
+ xml: 'markup',
32
+ svg: 'markup',
33
+ astro: 'markup',
34
+ vue: 'markup',
35
+ bash: 'shell',
36
+ sh: 'shell',
37
+ shell: 'shell',
38
+ zsh: 'shell',
39
+ console: 'shell',
40
+ };
41
+
42
+ const JSX = new Set(['tsx', 'jsx', 'astro', 'vue']);
43
+
44
+ const SCRIPT_KEYWORDS = new Set(
45
+ 'import export from as default const let var function return if else for while do switch case break continue new class extends super this typeof instanceof in of await async yield try catch finally throw delete void interface type enum implements public private protected readonly static declare namespace keyof satisfies true false null undefined'.split(
46
+ ' ',
47
+ ),
48
+ );
49
+ const SHELL_KEYWORDS = new Set('if then else elif fi for in do done while until case esac function return export local set unset echo cd source'.split(' '));
50
+
51
+ /** The language a code block uses, or 'plain'. */
52
+ export function languageFamily(language: string | undefined): Family {
53
+ return ALIASES[(language ?? '').trim().toLowerCase()] ?? 'plain';
54
+ }
55
+
56
+ interface Rule {
57
+ type: TokenType;
58
+ re: RegExp;
59
+ }
60
+
61
+ const sticky = (source: string) => new RegExp(source, 'y');
62
+
63
+ const RULES: Record<Exclude<Family, 'plain'>, Rule[]> = {
64
+ script: [
65
+ { type: 'comment', re: sticky(String.raw`\/\/[^\n]*|\/\*[\s\S]*?(?:\*\/|$)`) },
66
+ { type: 'string', re: sticky(String.raw`"(?:\\.|[^"\\\n])*"?|'(?:\\.|[^'\\\n])*'?|\`(?:\\[\s\S]|[^\`\\])*\`?`) },
67
+ { type: 'number', re: sticky(String.raw`\b(?:0[xX][\da-fA-F_]+|\d[\d_]*(?:\.\d+)?(?:[eE][+-]?\d+)?n?)\b`) },
68
+ { type: 'punctuation', re: sticky(String.raw`[{}()[\];,.]`) },
69
+ { type: 'operator', re: sticky(String.raw`=>|[=!<>]=?=?|&&|\|\||\?\??|[+\-*/%&|^~:]`) },
70
+ ],
71
+ json: [
72
+ { type: 'property', re: sticky(String.raw`"(?:\\.|[^"\\\n])*"(?=\s*:)`) },
73
+ { type: 'string', re: sticky(String.raw`"(?:\\.|[^"\\\n])*"?`) },
74
+ { type: 'number', re: sticky(String.raw`-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b`) },
75
+ { type: 'keyword', re: sticky(String.raw`\b(?:true|false|null)\b`) },
76
+ { type: 'punctuation', re: sticky(String.raw`[{}[\],:]`) },
77
+ ],
78
+ css: [
79
+ { type: 'comment', re: sticky(String.raw`\/\*[\s\S]*?(?:\*\/|$)`) },
80
+ { type: 'string', re: sticky(String.raw`"(?:\\.|[^"\\\n])*"?|'(?:\\.|[^'\\\n])*'?`) },
81
+ { type: 'keyword', re: sticky(String.raw`@[\w-]+|!important`) },
82
+ { type: 'property', re: sticky(String.raw`--[\w-]+|[a-zA-Z-]+(?=\s*:(?!:))`) },
83
+ { type: 'number', re: sticky(String.raw`#[\da-fA-F]{3,8}\b|-?\d*\.?\d+(?:%|[a-zA-Z]+)?`) },
84
+ { type: 'function', re: sticky(String.raw`[\w-]+(?=\()`) },
85
+ { type: 'punctuation', re: sticky(String.raw`[{}()[\];,:]`) },
86
+ ],
87
+ markup: [
88
+ { type: 'comment', re: sticky(String.raw`<!--[\s\S]*?(?:-->|$)`) },
89
+ { type: 'tag', re: sticky(String.raw`<\/?[A-Za-z][\w.:-]*|\/?>`) },
90
+ { type: 'string', re: sticky(String.raw`"[^"\n]*"?|'[^'\n]*'?`) },
91
+ { type: 'attr', re: sticky(String.raw`[\w:@.-]+(?==)`) },
92
+ { type: 'punctuation', re: sticky(String.raw`[{}=]`) },
93
+ ],
94
+ shell: [
95
+ { type: 'comment', re: sticky(String.raw`(?:^|(?<=\s))#[^\n]*`) },
96
+ { type: 'string', re: sticky(String.raw`"(?:\\.|[^"\\])*"?|'[^']*'?`) },
97
+ { type: 'property', re: sticky(String.raw`\$\{?[\w@#?*]+\}?`) },
98
+ { type: 'attr', re: sticky(String.raw`(?<=\s)--?[\w-]+(?:=[^\s]*)?`) },
99
+ { type: 'number', re: sticky(String.raw`\b\d+\b`) },
100
+ { type: 'operator', re: sticky(String.raw`&&|\|\||[|>&;]`) },
101
+ ],
102
+ };
103
+
104
+ const IDENT = /[A-Za-z_$][\w$-]*/y;
105
+ const JSX_OPEN = /<\/?(?:[A-Za-z][\w.:-]*(?=[\s/>])|(?=>))/y;
106
+ const JSX_CLOSE = /\/?>/y;
107
+ const JSX_ATTR = /[A-Za-z_:][\w:-]*(?==)/y;
108
+
109
+ const lastMeaningful = (tokens: Token[]) => {
110
+ for (let i = tokens.length - 1; i >= 0; i--) if (tokens[i]!.text.trim()) return tokens[i]!;
111
+ return null;
112
+ };
113
+
114
+ /** Typed tokens whose texts join back to `code` exactly. */
115
+ export function tokenize(code: string, language?: string): Token[] {
116
+ const text = String(code ?? '');
117
+ const family = languageFamily(language);
118
+ if (family === 'plain') return text ? [{ type: 'plain', text }] : [];
119
+ const rules = RULES[family];
120
+ const jsx = family === 'script' && JSX.has((language ?? '').trim().toLowerCase());
121
+ const tokens: Token[] = [];
122
+ const push = (type: TokenType, value: string) => {
123
+ const last = tokens[tokens.length - 1];
124
+ if (last && last.type === 'plain' && type === 'plain') last.text += value;
125
+ else tokens.push({ type, text: value });
126
+ };
127
+ const take = (re: RegExp, at: number) => {
128
+ re.lastIndex = at;
129
+ const match = re.exec(text);
130
+ return match && match[0] ? match[0] : null;
131
+ };
132
+ let i = 0;
133
+ // Inside `<…>` (markup and JSX), and how deep in JSX children we are.
134
+ let inTag = false;
135
+ let closing = false;
136
+ let depth = 0;
137
+ scan: while (i < text.length) {
138
+ if (jsx) {
139
+ if (!inTag) {
140
+ const open = take(JSX_OPEN, i);
141
+ const before = lastMeaningful(tokens);
142
+ // `a < b` is a comparison; a tag follows `(`, `{`, `=`, `return`, another tag or JSX children.
143
+ if (open && (depth > 0 || !before || /[({>=,?:;[]$/.test(before.text) || before.text === 'return')) {
144
+ push('tag', open);
145
+ inTag = true;
146
+ closing = open.startsWith('</');
147
+ i += open.length;
148
+ continue;
149
+ }
150
+ } else {
151
+ const close = take(JSX_CLOSE, i);
152
+ if (close) {
153
+ push('tag', close);
154
+ inTag = false;
155
+ if (closing) depth = Math.max(0, depth - 1);
156
+ else if (close === '>') depth += 1;
157
+ i += close.length;
158
+ continue;
159
+ }
160
+ const attr = take(JSX_ATTR, i);
161
+ if (attr) {
162
+ push('attr', attr);
163
+ i += attr.length;
164
+ continue;
165
+ }
166
+ }
167
+ }
168
+ // Markup outside tags: only comments and tags count; the rest is text.
169
+ const usable = family === 'markup' && !inTag ? rules.slice(0, 2) : rules;
170
+ for (const rule of usable) {
171
+ const match = take(rule.re, i);
172
+ if (!match) continue;
173
+ if (family === 'markup' && rule.type === 'tag') inTag = !match.endsWith('>');
174
+ push(rule.type, match);
175
+ i += match.length;
176
+ continue scan;
177
+ }
178
+ if (family === 'script' || family === 'shell') {
179
+ const found = take(IDENT, i);
180
+ if (found) {
181
+ const word = family === 'script' ? found.replace(/-.*$/, '') : found;
182
+ const after = text.slice(i + word.length).match(/^\s*(\S)/)?.[1];
183
+ const before = lastMeaningful(tokens);
184
+ let type: TokenType = 'plain';
185
+ if ((family === 'script' ? SCRIPT_KEYWORDS : SHELL_KEYWORDS).has(word)) type = 'keyword';
186
+ else if (after === '(') type = 'function';
187
+ else if (family === 'script' && before?.text === '.') type = 'property';
188
+ else if (family === 'shell' && /(?:^|[\n|;&])[ \t]*$/.test(text.slice(0, i))) type = 'function';
189
+ else if (family === 'script' && /^[A-Z]/.test(word)) type = 'function';
190
+ push(type, word);
191
+ i += word.length;
192
+ continue;
193
+ }
194
+ }
195
+ push('plain', text[i]!);
196
+ i += 1;
197
+ }
198
+ return tokens;
199
+ }
200
+
201
+ /** Tokens split into lines (a token spanning lines is cut at each newline). */
202
+ export function tokenLines(tokens: Token[]): Token[][] {
203
+ const lines: Token[][] = [[]];
204
+ for (const token of tokens) {
205
+ const parts = token.text.split('\n');
206
+ parts.forEach((part, index) => {
207
+ if (index) lines.push([]);
208
+ if (part) lines[lines.length - 1]!.push({ type: token.type, text: part });
209
+ });
210
+ }
211
+ return lines;
212
+ }
213
+
214
+ /**
215
+ * Write highlighted code into `target`: one [data-mk-code-line] per line, joined
216
+ * by newline text nodes, so `target.textContent` is the code itself.
217
+ */
218
+ export function renderCode(target: Element, code: string, language?: string, highlight: number[] = []) {
219
+ const marked = new Set(highlight);
220
+ const lines = tokenLines(tokenize(code, language));
221
+ // A final newline ends the last line; it does not open an empty one (the text node stays).
222
+ const trailing = lines.length > 1 && !lines[lines.length - 1]!.length;
223
+ if (trailing) lines.pop();
224
+ const nodes: Node[] = [];
225
+ lines.forEach((line, index) => {
226
+ if (index) nodes.push(document.createTextNode('\n'));
227
+ const row = document.createElement('span');
228
+ row.dataset.mkCodeLine = '';
229
+ if (marked.has(index + 1)) row.dataset.mkHighlight = '';
230
+ for (const token of line) {
231
+ if (token.type === 'plain') {
232
+ row.append(token.text);
233
+ continue;
234
+ }
235
+ const span = document.createElement('span');
236
+ span.dataset.mkToken = token.type;
237
+ span.textContent = token.text;
238
+ row.append(span);
239
+ }
240
+ nodes.push(row);
241
+ });
242
+ if (trailing) nodes.push(document.createTextNode('\n'));
243
+ target.replaceChildren(...nodes);
244
+ }
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+ import { Fragment, useMemo, useRef, type HTMLAttributes } from 'react';
3
+ import { useIsomorphicLayoutEffect, useLatest } from '../../react/use-recipe';
4
+ import { createCodeBlock, flowLines, type CodeBlockInstance, type CodeBlockOptions } from './engine';
5
+ import { languageFamily, tokenLines, tokenize } from './highlight';
6
+
7
+ /** `onCopy` is the copy result (not the DOM clipboard event). */
8
+ export interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title' | 'onCopy'>, Omit<CodeBlockOptions, 'code'> {
9
+ code: string;
10
+ }
11
+
12
+ /**
13
+ * <CodeBlock code={source} language="ts" title="main.ts" lineNumbers />.
14
+ * React renders the highlighted lines (text only); the engine copies the current text and owns the feedback.
15
+ */
16
+ export function CodeBlock({ code, language, title, lineNumbers, highlight, highlightLines, copyLabel = 'Copiar', copiedLabel, errorLabel, onCopy, className, ...props }: CodeBlockProps) {
17
+ const ref = useRef<HTMLDivElement>(null);
18
+ const instance = useRef<CodeBlockInstance | null>(null);
19
+ const copied = useLatest(onCopy);
20
+ const latest = useLatest(code);
21
+ useIsomorphicLayoutEffect(() => {
22
+ const created = createCodeBlock(ref.current, { copyLabel, copiedLabel, errorLabel, onCopy: (ok) => copied.current?.(ok) });
23
+ // The engine copies the exact string, not the rendered DOM.
24
+ created.setCode(latest.current);
25
+ instance.current = created;
26
+ return () => {
27
+ created.destroy();
28
+ instance.current = null;
29
+ };
30
+ }, [copyLabel, copiedLabel, errorLabel]);
31
+ useIsomorphicLayoutEffect(() => {
32
+ instance.current?.setCode(code);
33
+ }, [code]);
34
+ // New code flows in line by line (not on the first render).
35
+ const first = useRef(true);
36
+ useIsomorphicLayoutEffect(() => {
37
+ if (first.current) {
38
+ first.current = false;
39
+ return;
40
+ }
41
+ const animation = flowLines(ref.current?.querySelector('code') ?? null);
42
+ return () => {
43
+ animation?.progress(1).kill();
44
+ };
45
+ }, [code, language]);
46
+ const colour = highlight ?? languageFamily(language) !== 'plain';
47
+ const lines = useMemo(() => tokenLines(tokenize(code, colour ? language : undefined)), [code, language, colour]);
48
+ // A final newline ends the last line; it does not open an empty one.
49
+ const trailing = lines.length > 1 && !lines[lines.length - 1]!.length;
50
+ const shown = trailing ? lines.slice(0, -1) : lines;
51
+ const marked = new Set(highlightLines ?? []);
52
+ return (
53
+ <div {...props} ref={ref} className={['mk-code-block', className].filter(Boolean).join(' ')} data-mk-language={language} data-mk-line-numbers={lineNumbers ? '' : undefined}>
54
+ <div data-mk-code-header="">
55
+ <span data-mk-code-dots="" aria-hidden="true">
56
+ <i />
57
+ <i />
58
+ <i />
59
+ </span>
60
+ <span data-mk-code-title="">{title}</span>
61
+ {language && <span data-mk-code-language="">{language}</span>}
62
+ <button type="button" data-mk-code-copy="">
63
+ <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
64
+ <rect x="9" y="9" width="11" height="11" rx="2.5" />
65
+ <path d="M5 15V6a2 2 0 0 1 2-2h8" />
66
+ </svg>
67
+ <span data-mk-code-copy-text="">{copyLabel}</span>
68
+ </button>
69
+ </div>
70
+ <pre tabIndex={0}>
71
+ <code>
72
+ {shown.map((line, i) => (
73
+ <Fragment key={i}>
74
+ {i ? '\n' : null}
75
+ <span data-mk-code-line="" data-mk-highlight={marked.has(i + 1) ? '' : undefined}>
76
+ {line.map((token, k) =>
77
+ token.type === 'plain' ? (
78
+ <Fragment key={k}>{token.text}</Fragment>
79
+ ) : (
80
+ <span key={k} data-mk-token={token.type}>
81
+ {token.text}
82
+ </span>
83
+ ),
84
+ )}
85
+ </span>
86
+ </Fragment>
87
+ ))}
88
+ {trailing ? '\n' : null}
89
+ </code>
90
+ </pre>
91
+ <span data-mk-code-status="" className="mk-sr-only" role="status" />
92
+ </div>
93
+ );
94
+ }
@@ -0,0 +1,50 @@
1
+ # color-area
2
+
3
+ Área de saturación (horizontal) × brillo (vertical) en el tono actual. Al pulsar, el pulgar salta a ese punto (deslizamiento swing de 0,35 s) y luego sigue al puntero de cerca (0,1 s); al soltar se confirma el color. Al agarrarlo crece con la curva click y aparece encima una lupa con el color, como en `color-slider`; cerca del borde superior la lupa pasa debajo del pulgar (`data-mk-loupe-below`), para que un panel que recorta su contenido (el popover de `color-picker`) no la corte.
4
+
5
+ Dos inputs range ocultos a la vista («Saturación» y «Brillo», `aria-roledescription="selector de color 2D"`) llevan el valor para el teclado y los lectores de pantalla, con un `aria-valuetext` que dice los dos («Saturación 64 %, brillo 80 %»).
6
+
7
+ ## HTML / Astro
8
+
9
+ ```html
10
+ <mk-color-area class="mk-color-area" value="#ff8800"></mk-color-area>
11
+ <mk-color-slider class="mk-color-slider" channel="hue" value="#ff8800"></mk-color-slider>
12
+ ```
13
+
14
+ ## React
15
+
16
+ ```tsx
17
+ const [color, setColor] = useState('#ff8800');
18
+ <ColorArea value={color} onInput={setColor} />
19
+ <ColorSlider channel="hue" value={color} onInput={setColor} />
20
+ ```
21
+
22
+ ## Opciones
23
+
24
+ | Opción | Atributo | Por defecto | Qué hace |
25
+ |---|---|---|---|
26
+ | `value` | `value` | `'hsl(0 100% 50%)'` | Color: hex, `rgb()`, `hsl()` o HSVA. El tono pinta el área. |
27
+ | `label` | `label` | `'Color'` | Nombre accesible del grupo. |
28
+ | `step` | `step` | `1` | Paso de saturación y brillo. |
29
+ | `name` | `name` | — | Un input oculto envía el hex. |
30
+ | `disabled` | `disabled` | `false` | Sin arrastre ni teclado. |
31
+ | `onInput(hex, hsva)` | — | — | Cada movimiento. |
32
+ | `onChange(hex, hsva)` | — | — | Al soltar y con cada tecla. |
33
+
34
+ ## Teclado
35
+
36
+ | Tecla | Acción |
37
+ |---|---|
38
+ | ← / → | Saturación −/+ paso |
39
+ | ↑ / ↓ | Brillo +/− paso |
40
+ | Mayús + flecha | Paso × 10 |
41
+ | RePág / AvPág | Brillo ± 10 |
42
+ | Inicio / Fin | Saturación mínima / máxima |
43
+
44
+ ## API y eventos
45
+
46
+ `setColor(color, notify = true)`, `value` (hex), `color` (HSVA), `destroy()`. Eventos `mk:input` y `mk:change` con `{ value, color }`.
47
+
48
+ ## Variables CSS
49
+
50
+ `--mk-color-area-height` (11rem), `--mk-color-checker`. El motor escribe `--mk-color-area`, `--mk-color-thumb`, `--mk-color-x` y `--mk-color-y`. Las esquinas son de 12 px; deja aire alrededor para que el pulgar y la lupa no se corten. Con movimiento reducido no hay escalas ni deslizamientos y la lupa aparece sin animar mientras se arrastra.
@@ -0,0 +1,81 @@
1
+ /* color-area — saturation (x) × brightness (y) at the current hue; 12 px corners; the thumb is a ringed circle that
2
+ grows when grabbed and pops a loupe. The thumb may stand half outside the square: leave room around it. */
3
+ .mk-color-area,
4
+ mk-color-area {
5
+ --mk-color-area-height: 11rem;
6
+ --mk-color-checker: repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 10px 10px;
7
+ display: block;
8
+ position: relative;
9
+ }
10
+
11
+ :is(.mk-color-area, mk-color-area) [data-mk-color-area-surface] {
12
+ position: relative;
13
+ height: var(--mk-color-area-height);
14
+ border-radius: 12px;
15
+ background: var(--mk-color-area);
16
+ box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
17
+ cursor: crosshair;
18
+ touch-action: none;
19
+ }
20
+
21
+ :is(.mk-color-area, mk-color-area) [data-mk-color-thumb] {
22
+ position: absolute;
23
+ left: calc(clamp(0, var(--mk-color-x, 0), 1) * 100%);
24
+ top: calc(clamp(0, var(--mk-color-y, 0), 1) * 100%);
25
+ width: 1.5rem;
26
+ height: 1.5rem;
27
+ margin: -0.75rem 0 0 -0.75rem;
28
+ border-radius: 50%;
29
+ background: linear-gradient(var(--mk-color-thumb), var(--mk-color-thumb)), var(--mk-color-checker);
30
+ box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgb(0 0 0 / 0.14), 0 4px 12px rgb(0 0 0 / 0.3);
31
+ pointer-events: none;
32
+ }
33
+
34
+ :is(.mk-color-area, mk-color-area):has(input:focus-visible) [data-mk-color-thumb] {
35
+ box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--mk-accent), 0 4px 12px rgb(0 0 0 / 0.3);
36
+ }
37
+
38
+ :is(.mk-color-area, mk-color-area) [data-mk-color-loupe] {
39
+ position: absolute;
40
+ bottom: calc(100% + 10px);
41
+ left: 50%;
42
+ width: 2.75rem;
43
+ height: 2.75rem;
44
+ margin-left: -1.375rem;
45
+ border-radius: 50%;
46
+ background: linear-gradient(var(--mk-color-thumb), var(--mk-color-thumb)), var(--mk-color-checker);
47
+ box-shadow: 0 0 0 3px #fff, 0 8px 20px rgb(0 0 0 / 0.25);
48
+ opacity: 0;
49
+ transform-origin: 50% 100%;
50
+ }
51
+
52
+ /* Near the top edge the loupe flips below the thumb, so a panel or card that clips its content never cuts it. */
53
+ :is(.mk-color-area, mk-color-area)[data-mk-loupe-below] [data-mk-color-loupe] {
54
+ top: calc(100% + 10px);
55
+ bottom: auto;
56
+ transform-origin: 50% 0;
57
+ }
58
+
59
+ @media (prefers-reduced-motion: reduce) {
60
+ :is(.mk-color-area, mk-color-area)[data-mk-grabbing] [data-mk-color-loupe] {
61
+ opacity: 1;
62
+ }
63
+ }
64
+
65
+ :is(.mk-color-area, mk-color-area):has(input:disabled) [data-mk-color-area-surface] {
66
+ opacity: 0.45;
67
+ cursor: not-allowed;
68
+ }
69
+
70
+ /* The two ranges stay readable to assistive tech but take no room (the per-component file does not need base.css). */
71
+ :is(.mk-color-area, mk-color-area) [data-mk-color-input] {
72
+ position: absolute;
73
+ width: 1px;
74
+ height: 1px;
75
+ margin: -1px;
76
+ padding: 0;
77
+ overflow: hidden;
78
+ clip-path: inset(50%);
79
+ white-space: nowrap;
80
+ border: 0;
81
+ }
@@ -0,0 +1,26 @@
1
+ import { MkElement, defineElement, type OptionType } from '../../elements/base';
2
+ import { createColorArea, type ColorAreaInstance } from './engine';
3
+
4
+ /**
5
+ * <mk-color-area class="mk-color-area" value="#ff8800"></mk-color-area>
6
+ * Emits mk:input / mk:change ({value, color}). Changing `value` glides the thumb.
7
+ */
8
+ export class MkColorAreaElement extends MkElement<ColorAreaInstance> {
9
+ static options: Record<string, OptionType> = { value: 'string', label: 'string', step: 'number', name: 'string', disabled: 'boolean' };
10
+
11
+ protected create(options: Record<string, unknown>) {
12
+ return createColorArea(this, options);
13
+ }
14
+
15
+ attributeChangedCallback(name: string, previous: string | null, next: string | null) {
16
+ if (previous === next || !this.instance) return;
17
+ if (name === 'value' && next) this.instance.setColor(next, false);
18
+ else super.attributeChangedCallback(name, previous, next);
19
+ }
20
+
21
+ get value() {
22
+ return this.instance?.value ?? '';
23
+ }
24
+ }
25
+
26
+ export const defineColorArea = () => defineElement('mk-color-area', MkColorAreaElement);