@kanzo-tech/ui 0.0.1-alpha

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 (499) hide show
  1. package/README.md +60 -0
  2. package/dist/analytics.d.ts +36 -0
  3. package/dist/analytics.d.ts.map +1 -0
  4. package/dist/analytics.js +155 -0
  5. package/dist/analytics.js.map +1 -0
  6. package/dist/charts/arrow.d.ts +37 -0
  7. package/dist/charts/arrow.d.ts.map +1 -0
  8. package/dist/charts/arrow.js +29 -0
  9. package/dist/charts/arrow.js.map +1 -0
  10. package/dist/charts/chart-axes.d.ts +59 -0
  11. package/dist/charts/chart-axes.d.ts.map +1 -0
  12. package/dist/charts/chart-axes.js +39 -0
  13. package/dist/charts/chart-axes.js.map +1 -0
  14. package/dist/charts/chart-config.d.ts +52 -0
  15. package/dist/charts/chart-config.d.ts.map +1 -0
  16. package/dist/charts/chart-config.js +43 -0
  17. package/dist/charts/chart-config.js.map +1 -0
  18. package/dist/charts/chart-inputs.d.ts +174 -0
  19. package/dist/charts/chart-inputs.d.ts.map +1 -0
  20. package/dist/charts/chart-inputs.js +382 -0
  21. package/dist/charts/chart-inputs.js.map +1 -0
  22. package/dist/charts/chart-interactors.d.ts +75 -0
  23. package/dist/charts/chart-interactors.d.ts.map +1 -0
  24. package/dist/charts/chart-interactors.js +35 -0
  25. package/dist/charts/chart-interactors.js.map +1 -0
  26. package/dist/charts/chart-legend.d.ts +38 -0
  27. package/dist/charts/chart-legend.d.ts.map +1 -0
  28. package/dist/charts/chart-legend.js +49 -0
  29. package/dist/charts/chart-legend.js.map +1 -0
  30. package/dist/charts/chart-marks.d.ts +124 -0
  31. package/dist/charts/chart-marks.d.ts.map +1 -0
  32. package/dist/charts/chart-marks.js +109 -0
  33. package/dist/charts/chart-marks.js.map +1 -0
  34. package/dist/charts/chart-root.d.ts +90 -0
  35. package/dist/charts/chart-root.d.ts.map +1 -0
  36. package/dist/charts/chart-root.js +162 -0
  37. package/dist/charts/chart-root.js.map +1 -0
  38. package/dist/charts/chart-spec.d.ts +126 -0
  39. package/dist/charts/chart-spec.d.ts.map +1 -0
  40. package/dist/charts/chart-spec.js +133 -0
  41. package/dist/charts/chart-spec.js.map +1 -0
  42. package/dist/charts/chart-stat.d.ts +23 -0
  43. package/dist/charts/chart-stat.d.ts.map +1 -0
  44. package/dist/charts/chart-stat.js +24 -0
  45. package/dist/charts/chart-stat.js.map +1 -0
  46. package/dist/charts/id-set-client.d.ts +42 -0
  47. package/dist/charts/id-set-client.d.ts.map +1 -0
  48. package/dist/charts/id-set-client.js +43 -0
  49. package/dist/charts/id-set-client.js.map +1 -0
  50. package/dist/charts/mosaic-provider.d.ts +70 -0
  51. package/dist/charts/mosaic-provider.d.ts.map +1 -0
  52. package/dist/charts/mosaic-provider.js +53 -0
  53. package/dist/charts/mosaic-provider.js.map +1 -0
  54. package/dist/charts/query-client.d.ts +22 -0
  55. package/dist/charts/query-client.d.ts.map +1 -0
  56. package/dist/charts/query-client.js +26 -0
  57. package/dist/charts/query-client.js.map +1 -0
  58. package/dist/charts/tokenized-plot.d.ts +26 -0
  59. package/dist/charts/tokenized-plot.d.ts.map +1 -0
  60. package/dist/charts/tokenized-plot.js +41 -0
  61. package/dist/charts/tokenized-plot.js.map +1 -0
  62. package/dist/charts/use-chart-query.d.ts +30 -0
  63. package/dist/charts/use-chart-query.d.ts.map +1 -0
  64. package/dist/charts/use-chart-query.js +19 -0
  65. package/dist/charts/use-chart-query.js.map +1 -0
  66. package/dist/composites/CodeEditor.d.ts +64 -0
  67. package/dist/composites/CodeEditor.d.ts.map +1 -0
  68. package/dist/composites/CodeEditor.js +521 -0
  69. package/dist/composites/CodeEditor.js.map +1 -0
  70. package/dist/composites/MadeWith.d.ts +39 -0
  71. package/dist/composites/MadeWith.d.ts.map +1 -0
  72. package/dist/composites/MadeWith.js +30 -0
  73. package/dist/composites/MadeWith.js.map +1 -0
  74. package/dist/composites/Preferences.d.ts +155 -0
  75. package/dist/composites/Preferences.d.ts.map +1 -0
  76. package/dist/composites/Preferences.js +501 -0
  77. package/dist/composites/Preferences.js.map +1 -0
  78. package/dist/composites/Questionnaire.d.ts +215 -0
  79. package/dist/composites/Questionnaire.d.ts.map +1 -0
  80. package/dist/composites/Questionnaire.js +422 -0
  81. package/dist/composites/Questionnaire.js.map +1 -0
  82. package/dist/composites/SidebarIdentity.d.ts +63 -0
  83. package/dist/composites/SidebarIdentity.d.ts.map +1 -0
  84. package/dist/composites/SidebarIdentity.js +103 -0
  85. package/dist/composites/SidebarIdentity.js.map +1 -0
  86. package/dist/composites/code-editor-search.d.ts +40 -0
  87. package/dist/composites/code-editor-search.d.ts.map +1 -0
  88. package/dist/composites/code-editor-search.js +212 -0
  89. package/dist/composites/code-editor-search.js.map +1 -0
  90. package/dist/composites/sidebar.d.ts +129 -0
  91. package/dist/composites/sidebar.d.ts.map +1 -0
  92. package/dist/composites/sidebar.js +671 -0
  93. package/dist/composites/sidebar.js.map +1 -0
  94. package/dist/composites/theme-notice.d.ts +54 -0
  95. package/dist/composites/theme-notice.d.ts.map +1 -0
  96. package/dist/composites/theme-notice.js +19 -0
  97. package/dist/composites/theme-notice.js.map +1 -0
  98. package/dist/editor.d.ts +3 -0
  99. package/dist/editor.d.ts.map +1 -0
  100. package/dist/editor.js +6 -0
  101. package/dist/editor.js.map +1 -0
  102. package/dist/guard-corpus.d.ts +63 -0
  103. package/dist/guard-corpus.d.ts.map +1 -0
  104. package/dist/index.d.ts +112 -0
  105. package/dist/index.d.ts.map +1 -0
  106. package/dist/index.js +696 -0
  107. package/dist/index.js.map +1 -0
  108. package/dist/layouts/section.d.ts +166 -0
  109. package/dist/layouts/section.d.ts.map +1 -0
  110. package/dist/layouts/section.js +153 -0
  111. package/dist/layouts/section.js.map +1 -0
  112. package/dist/layouts/shell.d.ts +128 -0
  113. package/dist/layouts/shell.d.ts.map +1 -0
  114. package/dist/layouts/shell.js +107 -0
  115. package/dist/layouts/shell.js.map +1 -0
  116. package/dist/lib/cn.d.ts +4 -0
  117. package/dist/lib/cn.d.ts.map +1 -0
  118. package/dist/lib/cn.js +9 -0
  119. package/dist/lib/cn.js.map +1 -0
  120. package/dist/lib/is-active-path.d.ts +13 -0
  121. package/dist/lib/is-active-path.d.ts.map +1 -0
  122. package/dist/lib/is-active-path.js +7 -0
  123. package/dist/lib/is-active-path.js.map +1 -0
  124. package/dist/lib/theme-tick.d.ts +37 -0
  125. package/dist/lib/theme-tick.d.ts.map +1 -0
  126. package/dist/lib/theme-tick.js +30 -0
  127. package/dist/lib/theme-tick.js.map +1 -0
  128. package/dist/lib/token-color.d.ts +74 -0
  129. package/dist/lib/token-color.d.ts.map +1 -0
  130. package/dist/lib/token-color.js +35 -0
  131. package/dist/lib/token-color.js.map +1 -0
  132. package/dist/lib/use-is-mobile.d.ts +2 -0
  133. package/dist/lib/use-is-mobile.d.ts.map +1 -0
  134. package/dist/lib/use-is-mobile.js +17 -0
  135. package/dist/lib/use-is-mobile.js.map +1 -0
  136. package/dist/shark-parity.divergences.d.ts +104 -0
  137. package/dist/shark-parity.divergences.d.ts.map +1 -0
  138. package/dist/simples/FacetFilter.d.ts +57 -0
  139. package/dist/simples/FacetFilter.d.ts.map +1 -0
  140. package/dist/simples/FacetFilter.js +167 -0
  141. package/dist/simples/FacetFilter.js.map +1 -0
  142. package/dist/simples/FieldArray.d.ts +42 -0
  143. package/dist/simples/FieldArray.d.ts.map +1 -0
  144. package/dist/simples/FieldArray.js +76 -0
  145. package/dist/simples/FieldArray.js.map +1 -0
  146. package/dist/simples/Link.d.ts +38 -0
  147. package/dist/simples/Link.d.ts.map +1 -0
  148. package/dist/simples/Link.js +24 -0
  149. package/dist/simples/Link.js.map +1 -0
  150. package/dist/simples/accordion.d.ts +8 -0
  151. package/dist/simples/accordion.d.ts.map +1 -0
  152. package/dist/simples/accordion.js +78 -0
  153. package/dist/simples/accordion.js.map +1 -0
  154. package/dist/simples/action-bar.d.ts +101 -0
  155. package/dist/simples/action-bar.d.ts.map +1 -0
  156. package/dist/simples/action-bar.js +195 -0
  157. package/dist/simples/action-bar.js.map +1 -0
  158. package/dist/simples/alert-dialog.d.ts +24 -0
  159. package/dist/simples/alert-dialog.d.ts.map +1 -0
  160. package/dist/simples/alert-dialog.js +43 -0
  161. package/dist/simples/alert-dialog.js.map +1 -0
  162. package/dist/simples/alert.d.ts +36 -0
  163. package/dist/simples/alert.d.ts.map +1 -0
  164. package/dist/simples/alert.js +123 -0
  165. package/dist/simples/alert.js.map +1 -0
  166. package/dist/simples/avatar.d.ts +37 -0
  167. package/dist/simples/avatar.d.ts.map +1 -0
  168. package/dist/simples/avatar.js +133 -0
  169. package/dist/simples/avatar.js.map +1 -0
  170. package/dist/simples/badge.d.ts +66 -0
  171. package/dist/simples/badge.d.ts.map +1 -0
  172. package/dist/simples/badge.js +138 -0
  173. package/dist/simples/badge.js.map +1 -0
  174. package/dist/simples/breadcrumb.d.ts +19 -0
  175. package/dist/simples/breadcrumb.d.ts.map +1 -0
  176. package/dist/simples/breadcrumb.js +107 -0
  177. package/dist/simples/breadcrumb.js.map +1 -0
  178. package/dist/simples/button-group.d.ts +19 -0
  179. package/dist/simples/button-group.d.ts.map +1 -0
  180. package/dist/simples/button-group.js +69 -0
  181. package/dist/simples/button-group.js.map +1 -0
  182. package/dist/simples/button.d.ts +148 -0
  183. package/dist/simples/button.d.ts.map +1 -0
  184. package/dist/simples/button.js +157 -0
  185. package/dist/simples/button.js.map +1 -0
  186. package/dist/simples/calendar.d.ts +45 -0
  187. package/dist/simples/calendar.d.ts.map +1 -0
  188. package/dist/simples/calendar.js +342 -0
  189. package/dist/simples/calendar.js.map +1 -0
  190. package/dist/simples/card.d.ts +43 -0
  191. package/dist/simples/card.d.ts.map +1 -0
  192. package/dist/simples/card.js +151 -0
  193. package/dist/simples/card.js.map +1 -0
  194. package/dist/simples/checkbox.d.ts +25 -0
  195. package/dist/simples/checkbox.d.ts.map +1 -0
  196. package/dist/simples/checkbox.js +103 -0
  197. package/dist/simples/checkbox.js.map +1 -0
  198. package/dist/simples/client-only.d.ts +3 -0
  199. package/dist/simples/client-only.d.ts.map +1 -0
  200. package/dist/simples/client-only.js +7 -0
  201. package/dist/simples/client-only.js.map +1 -0
  202. package/dist/simples/clipboard.d.ts +11 -0
  203. package/dist/simples/clipboard.d.ts.map +1 -0
  204. package/dist/simples/clipboard.js +99 -0
  205. package/dist/simples/clipboard.js.map +1 -0
  206. package/dist/simples/collapsible.d.ts +8 -0
  207. package/dist/simples/collapsible.d.ts.map +1 -0
  208. package/dist/simples/collapsible.js +79 -0
  209. package/dist/simples/collapsible.js.map +1 -0
  210. package/dist/simples/color-picker.d.ts +62 -0
  211. package/dist/simples/color-picker.d.ts.map +1 -0
  212. package/dist/simples/color-picker.js +391 -0
  213. package/dist/simples/color-picker.js.map +1 -0
  214. package/dist/simples/combobox.d.ts +66 -0
  215. package/dist/simples/combobox.d.ts.map +1 -0
  216. package/dist/simples/combobox.js +230 -0
  217. package/dist/simples/combobox.js.map +1 -0
  218. package/dist/simples/command.d.ts +45 -0
  219. package/dist/simples/command.d.ts.map +1 -0
  220. package/dist/simples/command.js +180 -0
  221. package/dist/simples/command.js.map +1 -0
  222. package/dist/simples/data-list.d.ts +25 -0
  223. package/dist/simples/data-list.d.ts.map +1 -0
  224. package/dist/simples/data-list.js +62 -0
  225. package/dist/simples/data-list.js.map +1 -0
  226. package/dist/simples/date-picker.d.ts +16 -0
  227. package/dist/simples/date-picker.d.ts.map +1 -0
  228. package/dist/simples/date-picker.js +117 -0
  229. package/dist/simples/date-picker.js.map +1 -0
  230. package/dist/simples/diagnostic.d.ts +138 -0
  231. package/dist/simples/diagnostic.d.ts.map +1 -0
  232. package/dist/simples/diagnostic.js +288 -0
  233. package/dist/simples/diagnostic.js.map +1 -0
  234. package/dist/simples/dialog.d.ts +100 -0
  235. package/dist/simples/dialog.d.ts.map +1 -0
  236. package/dist/simples/dialog.js +267 -0
  237. package/dist/simples/dialog.js.map +1 -0
  238. package/dist/simples/download-trigger.d.ts +3 -0
  239. package/dist/simples/download-trigger.d.ts.map +1 -0
  240. package/dist/simples/download-trigger.js +7 -0
  241. package/dist/simples/download-trigger.js.map +1 -0
  242. package/dist/simples/editable.d.ts +23 -0
  243. package/dist/simples/editable.d.ts.map +1 -0
  244. package/dist/simples/editable.js +70 -0
  245. package/dist/simples/editable.js.map +1 -0
  246. package/dist/simples/field.d.ts +58 -0
  247. package/dist/simples/field.d.ts.map +1 -0
  248. package/dist/simples/field.js +285 -0
  249. package/dist/simples/field.js.map +1 -0
  250. package/dist/simples/file-upload.d.ts +19 -0
  251. package/dist/simples/file-upload.d.ts.map +1 -0
  252. package/dist/simples/file-upload.js +192 -0
  253. package/dist/simples/file-upload.js.map +1 -0
  254. package/dist/simples/float.d.ts +45 -0
  255. package/dist/simples/float.d.ts.map +1 -0
  256. package/dist/simples/float.js +40 -0
  257. package/dist/simples/float.js.map +1 -0
  258. package/dist/simples/floating-panel.d.ts +25 -0
  259. package/dist/simples/floating-panel.d.ts.map +1 -0
  260. package/dist/simples/floating-panel.js +95 -0
  261. package/dist/simples/floating-panel.js.map +1 -0
  262. package/dist/simples/highlight.d.ts +6 -0
  263. package/dist/simples/highlight.d.ts.map +1 -0
  264. package/dist/simples/highlight.js +24 -0
  265. package/dist/simples/highlight.js.map +1 -0
  266. package/dist/simples/hover-card.d.ts +11 -0
  267. package/dist/simples/hover-card.d.ts.map +1 -0
  268. package/dist/simples/hover-card.js +83 -0
  269. package/dist/simples/hover-card.js.map +1 -0
  270. package/dist/simples/image-cropper.d.ts +17 -0
  271. package/dist/simples/image-cropper.d.ts.map +1 -0
  272. package/dist/simples/image-cropper.js +139 -0
  273. package/dist/simples/image-cropper.js.map +1 -0
  274. package/dist/simples/input-group.d.ts +116 -0
  275. package/dist/simples/input-group.d.ts.map +1 -0
  276. package/dist/simples/input-group.js +245 -0
  277. package/dist/simples/input-group.js.map +1 -0
  278. package/dist/simples/input.d.ts +26 -0
  279. package/dist/simples/input.d.ts.map +1 -0
  280. package/dist/simples/input.js +60 -0
  281. package/dist/simples/input.js.map +1 -0
  282. package/dist/simples/item.d.ts +72 -0
  283. package/dist/simples/item.d.ts.map +1 -0
  284. package/dist/simples/item.js +180 -0
  285. package/dist/simples/item.js.map +1 -0
  286. package/dist/simples/json-tree-view.d.ts +7 -0
  287. package/dist/simples/json-tree-view.d.ts.map +1 -0
  288. package/dist/simples/json-tree-view.js +71 -0
  289. package/dist/simples/json-tree-view.js.map +1 -0
  290. package/dist/simples/kbd.d.ts +25 -0
  291. package/dist/simples/kbd.d.ts.map +1 -0
  292. package/dist/simples/kbd.js +50 -0
  293. package/dist/simples/kbd.js.map +1 -0
  294. package/dist/simples/listbox.d.ts +46 -0
  295. package/dist/simples/listbox.d.ts.map +1 -0
  296. package/dist/simples/listbox.js +218 -0
  297. package/dist/simples/listbox.js.map +1 -0
  298. package/dist/simples/menu.d.ts +60 -0
  299. package/dist/simples/menu.d.ts.map +1 -0
  300. package/dist/simples/menu.js +294 -0
  301. package/dist/simples/menu.js.map +1 -0
  302. package/dist/simples/native-select.d.ts +36 -0
  303. package/dist/simples/native-select.d.ts.map +1 -0
  304. package/dist/simples/native-select.js +77 -0
  305. package/dist/simples/native-select.js.map +1 -0
  306. package/dist/simples/number-input.d.ts +35 -0
  307. package/dist/simples/number-input.d.ts.map +1 -0
  308. package/dist/simples/number-input.js +142 -0
  309. package/dist/simples/number-input.js.map +1 -0
  310. package/dist/simples/pagination.d.ts +11 -0
  311. package/dist/simples/pagination.d.ts.map +1 -0
  312. package/dist/simples/pagination.js +78 -0
  313. package/dist/simples/pagination.js.map +1 -0
  314. package/dist/simples/password-input.d.ts +23 -0
  315. package/dist/simples/password-input.d.ts.map +1 -0
  316. package/dist/simples/password-input.js +90 -0
  317. package/dist/simples/password-input.js.map +1 -0
  318. package/dist/simples/pin-input.d.ts +30 -0
  319. package/dist/simples/pin-input.d.ts.map +1 -0
  320. package/dist/simples/pin-input.js +71 -0
  321. package/dist/simples/pin-input.js.map +1 -0
  322. package/dist/simples/popover.d.ts +42 -0
  323. package/dist/simples/popover.d.ts.map +1 -0
  324. package/dist/simples/popover.js +188 -0
  325. package/dist/simples/popover.js.map +1 -0
  326. package/dist/simples/progress.d.ts +23 -0
  327. package/dist/simples/progress.d.ts.map +1 -0
  328. package/dist/simples/progress.js +82 -0
  329. package/dist/simples/progress.js.map +1 -0
  330. package/dist/simples/prose.d.ts +17 -0
  331. package/dist/simples/prose.d.ts.map +1 -0
  332. package/dist/simples/prose.js +18 -0
  333. package/dist/simples/prose.js.map +1 -0
  334. package/dist/simples/radio-group.d.ts +23 -0
  335. package/dist/simples/radio-group.d.ts.map +1 -0
  336. package/dist/simples/radio-group.js +149 -0
  337. package/dist/simples/radio-group.js.map +1 -0
  338. package/dist/simples/rating.d.ts +10 -0
  339. package/dist/simples/rating.d.ts.map +1 -0
  340. package/dist/simples/rating.js +81 -0
  341. package/dist/simples/rating.js.map +1 -0
  342. package/dist/simples/resizable.d.ts +16 -0
  343. package/dist/simples/resizable.d.ts.map +1 -0
  344. package/dist/simples/resizable.js +57 -0
  345. package/dist/simples/resizable.js.map +1 -0
  346. package/dist/simples/scroll-area.d.ts +23 -0
  347. package/dist/simples/scroll-area.d.ts.map +1 -0
  348. package/dist/simples/scroll-area.js +88 -0
  349. package/dist/simples/scroll-area.js.map +1 -0
  350. package/dist/simples/segment-group.d.ts +27 -0
  351. package/dist/simples/segment-group.d.ts.map +1 -0
  352. package/dist/simples/segment-group.js +129 -0
  353. package/dist/simples/segment-group.js.map +1 -0
  354. package/dist/simples/select.d.ts +34 -0
  355. package/dist/simples/select.d.ts.map +1 -0
  356. package/dist/simples/select.js +258 -0
  357. package/dist/simples/select.js.map +1 -0
  358. package/dist/simples/separator.d.ts +12 -0
  359. package/dist/simples/separator.d.ts.map +1 -0
  360. package/dist/simples/separator.js +27 -0
  361. package/dist/simples/separator.js.map +1 -0
  362. package/dist/simples/sheet.d.ts +94 -0
  363. package/dist/simples/sheet.d.ts.map +1 -0
  364. package/dist/simples/sheet.js +172 -0
  365. package/dist/simples/sheet.js.map +1 -0
  366. package/dist/simples/show.d.ts +10 -0
  367. package/dist/simples/show.d.ts.map +1 -0
  368. package/dist/simples/show.js +9 -0
  369. package/dist/simples/show.js.map +1 -0
  370. package/dist/simples/skeleton.d.ts +3 -0
  371. package/dist/simples/skeleton.d.ts.map +1 -0
  372. package/dist/simples/skeleton.js +23 -0
  373. package/dist/simples/skeleton.js.map +1 -0
  374. package/dist/simples/skip-nav.d.ts +54 -0
  375. package/dist/simples/skip-nav.d.ts.map +1 -0
  376. package/dist/simples/skip-nav.js +42 -0
  377. package/dist/simples/skip-nav.js.map +1 -0
  378. package/dist/simples/slider.d.ts +29 -0
  379. package/dist/simples/slider.d.ts.map +1 -0
  380. package/dist/simples/slider.js +189 -0
  381. package/dist/simples/slider.js.map +1 -0
  382. package/dist/simples/spinner.d.ts +2 -0
  383. package/dist/simples/spinner.d.ts.map +1 -0
  384. package/dist/simples/spinner.js +20 -0
  385. package/dist/simples/spinner.js.map +1 -0
  386. package/dist/simples/stat-tile.d.ts +31 -0
  387. package/dist/simples/stat-tile.d.ts.map +1 -0
  388. package/dist/simples/stat-tile.js +64 -0
  389. package/dist/simples/stat-tile.js.map +1 -0
  390. package/dist/simples/status.d.ts +48 -0
  391. package/dist/simples/status.d.ts.map +1 -0
  392. package/dist/simples/status.js +57 -0
  393. package/dist/simples/status.js.map +1 -0
  394. package/dist/simples/steps.d.ts +20 -0
  395. package/dist/simples/steps.d.ts.map +1 -0
  396. package/dist/simples/steps.js +171 -0
  397. package/dist/simples/steps.js.map +1 -0
  398. package/dist/simples/suggestions.d.ts +43 -0
  399. package/dist/simples/suggestions.d.ts.map +1 -0
  400. package/dist/simples/suggestions.js +38 -0
  401. package/dist/simples/suggestions.js.map +1 -0
  402. package/dist/simples/swatch.d.ts +73 -0
  403. package/dist/simples/swatch.d.ts.map +1 -0
  404. package/dist/simples/swatch.js +35 -0
  405. package/dist/simples/swatch.js.map +1 -0
  406. package/dist/simples/switch.d.ts +5 -0
  407. package/dist/simples/switch.d.ts.map +1 -0
  408. package/dist/simples/switch.js +71 -0
  409. package/dist/simples/switch.js.map +1 -0
  410. package/dist/simples/table.d.ts +55 -0
  411. package/dist/simples/table.d.ts.map +1 -0
  412. package/dist/simples/table.js +166 -0
  413. package/dist/simples/table.js.map +1 -0
  414. package/dist/simples/tabs.d.ts +55 -0
  415. package/dist/simples/tabs.d.ts.map +1 -0
  416. package/dist/simples/tabs.js +133 -0
  417. package/dist/simples/tabs.js.map +1 -0
  418. package/dist/simples/tags-input.d.ts +64 -0
  419. package/dist/simples/tags-input.d.ts.map +1 -0
  420. package/dist/simples/tags-input.js +228 -0
  421. package/dist/simples/tags-input.js.map +1 -0
  422. package/dist/simples/textarea.d.ts +6 -0
  423. package/dist/simples/textarea.d.ts.map +1 -0
  424. package/dist/simples/textarea.js +34 -0
  425. package/dist/simples/textarea.js.map +1 -0
  426. package/dist/simples/toast.d.ts +20 -0
  427. package/dist/simples/toast.d.ts.map +1 -0
  428. package/dist/simples/toast.js +127 -0
  429. package/dist/simples/toast.js.map +1 -0
  430. package/dist/simples/toggle-group.d.ts +20 -0
  431. package/dist/simples/toggle-group.d.ts.map +1 -0
  432. package/dist/simples/toggle-group.js +82 -0
  433. package/dist/simples/toggle-group.js.map +1 -0
  434. package/dist/simples/toggle.d.ts +35 -0
  435. package/dist/simples/toggle.d.ts.map +1 -0
  436. package/dist/simples/toggle.js +57 -0
  437. package/dist/simples/toggle.js.map +1 -0
  438. package/dist/simples/tooltip.d.ts +8 -0
  439. package/dist/simples/tooltip.d.ts.map +1 -0
  440. package/dist/simples/tooltip.js +80 -0
  441. package/dist/simples/tooltip.js.map +1 -0
  442. package/dist/simples/tour.d.ts +81 -0
  443. package/dist/simples/tour.d.ts.map +1 -0
  444. package/dist/simples/tour.js +253 -0
  445. package/dist/simples/tour.js.map +1 -0
  446. package/dist/simples/tree-view.d.ts +64 -0
  447. package/dist/simples/tree-view.d.ts.map +1 -0
  448. package/dist/simples/tree-view.js +300 -0
  449. package/dist/simples/tree-view.js.map +1 -0
  450. package/dist/styles.css +2 -0
  451. package/dist/table/data-table-content.d.ts +18 -0
  452. package/dist/table/data-table-content.d.ts.map +1 -0
  453. package/dist/table/data-table-content.js +53 -0
  454. package/dist/table/data-table-content.js.map +1 -0
  455. package/dist/table/data-table-pagination.d.ts +8 -0
  456. package/dist/table/data-table-pagination.d.ts.map +1 -0
  457. package/dist/table/data-table-pagination.js +65 -0
  458. package/dist/table/data-table-pagination.js.map +1 -0
  459. package/dist/table/data-table-root.d.ts +10 -0
  460. package/dist/table/data-table-root.d.ts.map +1 -0
  461. package/dist/table/data-table-root.js +21 -0
  462. package/dist/table/data-table-root.js.map +1 -0
  463. package/dist/table/data-table-toolbar.d.ts +44 -0
  464. package/dist/table/data-table-toolbar.d.ts.map +1 -0
  465. package/dist/table/data-table-toolbar.js +87 -0
  466. package/dist/table/data-table-toolbar.js.map +1 -0
  467. package/dist/table/select-column.d.ts +16 -0
  468. package/dist/table/select-column.d.ts.map +1 -0
  469. package/dist/table/select-column.js +39 -0
  470. package/dist/table/select-column.js.map +1 -0
  471. package/dist/table/sortableHeader.d.ts +25 -0
  472. package/dist/table/sortableHeader.d.ts.map +1 -0
  473. package/dist/table/sortableHeader.js +43 -0
  474. package/dist/table/sortableHeader.js.map +1 -0
  475. package/dist/table/use-data-table.d.ts +40 -0
  476. package/dist/table/use-data-table.d.ts.map +1 -0
  477. package/dist/table/use-data-table.js +65 -0
  478. package/dist/table/use-data-table.js.map +1 -0
  479. package/dist/table.d.ts +15 -0
  480. package/dist/table.d.ts.map +1 -0
  481. package/dist/table.js +22 -0
  482. package/dist/table.js.map +1 -0
  483. package/dist/theme/KanzoTheme.d.ts +74 -0
  484. package/dist/theme/KanzoTheme.d.ts.map +1 -0
  485. package/dist/theme/KanzoTheme.js +61 -0
  486. package/dist/theme/KanzoTheme.js.map +1 -0
  487. package/dist/theme/KanzoThemeProvider.d.ts +144 -0
  488. package/dist/theme/KanzoThemeProvider.d.ts.map +1 -0
  489. package/dist/theme/KanzoThemeProvider.js +271 -0
  490. package/dist/theme/KanzoThemeProvider.js.map +1 -0
  491. package/dist/theme/theme-context.d.ts +146 -0
  492. package/dist/theme/theme-context.d.ts.map +1 -0
  493. package/dist/theme/theme-context.js +18 -0
  494. package/dist/theme/theme-context.js.map +1 -0
  495. package/dist/theme/theme-script.d.ts +17 -0
  496. package/dist/theme/theme-script.d.ts.map +1 -0
  497. package/dist/theme/theme-script.js +16 -0
  498. package/dist/theme/theme-script.js.map +1 -0
  499. package/package.json +201 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-data-table.js","sources":["../../src/table/use-data-table.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ColumnDef,\n type ColumnFiltersState,\n type OnChangeFn,\n type PaginationState,\n type Row,\n type RowData,\n type RowSelectionState,\n type SortingState,\n type Table,\n type TableOptions,\n type VisibilityState,\n getCoreRowModel,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { type Dispatch, type SetStateAction, useState } from \"react\";\n\n// TanStack ships `ColumnMeta` empty for consumers to augment. `label` is the human name of a\n// column whose `header` is a component (a `sortableHeader`), so `DataTableViewOptions` can list it\n// as something other than its raw id.\ndeclare module \"@tanstack/react-table\" {\n // The two parameters are TanStack's own signature; an augmentation has to repeat it verbatim\n // even though this field uses neither.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ColumnMeta<TData extends RowData, TValue> {\n label?: string;\n }\n}\n\nexport interface UseDataTableOptions<TData, TValue = unknown>\n extends Omit<Partial<TableOptions<TData>>, \"columns\" | \"data\"> {\n columns: ColumnDef<TData, TValue>[];\n data: TData[];\n initialColumnFilters?: ColumnFiltersState;\n initialColumnVisibility?: VisibilityState;\n initialGlobalFilter?: string;\n /** Zero-based first page, for deep-linking into a table. Default 0. */\n initialPage?: number;\n initialRowSelection?: RowSelectionState;\n initialSorting?: SortingState;\n /** Rows per page. Default 20. */\n pageSize?: number;\n}\n\n/** Feeds our own state and, when the caller supplied one, its `onXChange` too. */\nfunction chain<T>(set: Dispatch<SetStateAction<T>>, next?: OnChangeFn<T>): OnChangeFn<T> {\n return (updater) => {\n set(updater);\n next?.(updater);\n };\n}\n\n/**\n * `useReactTable` with every row model wired, the filter/sort/visibility/selection slices\n * held as state, and everything else passed straight through — including `manualPagination`\n * / `manualSorting` / `manualFiltering` + `rowCount` for server-driven tables, where the\n * matching row model steps aside on its own.\n *\n * Every slice lives in `useState` and is never derived during render. That is load-bearing,\n * not style: handing TanStack a fresh `columnFilters` array on each render makes the\n * filtered row model always look stale, recomputing it trips `autoReset*`, which resets the\n * page index → re-render → new identity → an infinite loop that hard-freezes the tab. React\n * never reports it, because the cycle runs through the table's own `onStateChange` rather\n * than a setState during render, so there is no \"maximum update depth\" error to catch.\n */\nexport function useDataTable<TData, TValue = unknown>(\n options: UseDataTableOptions<TData, TValue>,\n): Table<TData> {\n const {\n columns,\n data,\n initialColumnFilters = [],\n initialColumnVisibility = {},\n initialGlobalFilter = \"\",\n initialPage = 0,\n initialRowSelection = {},\n initialSorting = [],\n onColumnFiltersChange,\n onColumnVisibilityChange,\n onGlobalFilterChange,\n onPaginationChange,\n onRowSelectionChange,\n onSortingChange,\n pageSize = 20,\n state: stateOverride,\n ...rest\n } = options;\n\n const [sorting, setSorting] = useState<SortingState>(initialSorting);\n const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>(initialColumnFilters);\n const [columnVisibility, setColumnVisibility] =\n useState<VisibilityState>(initialColumnVisibility);\n const [rowSelection, setRowSelection] = useState<RowSelectionState>(initialRowSelection);\n const [globalFilter, setGlobalFilter] = useState<string>(initialGlobalFilter);\n const [pagination, setPagination] = useState<PaginationState>({ pageIndex: initialPage, pageSize });\n\n return useReactTable({\n getCoreRowModel: getCoreRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n ...rest,\n columns,\n data,\n onColumnFiltersChange: chain(setColumnFilters, onColumnFiltersChange),\n onColumnVisibilityChange: chain(setColumnVisibility, onColumnVisibilityChange),\n onGlobalFilterChange: chain(setGlobalFilter, onGlobalFilterChange),\n onPaginationChange: chain(setPagination, onPaginationChange),\n onRowSelectionChange: chain(setRowSelection, onRowSelectionChange),\n onSortingChange: chain(setSorting, onSortingChange),\n state: {\n columnFilters,\n columnVisibility,\n globalFilter,\n pagination,\n rowSelection,\n sorting,\n ...stateOverride,\n },\n });\n}\n\n/**\n * Column `filterFn` for `DataTableFacetFilter`: keeps rows whose value is one of the\n * selected facets. TanStack's built-in `arrIncludesSome` expects the *cell* to be the\n * array, and on a scalar cell degrades to substring matching (\"inactive\" matches \"active\").\n */\nexport function facetFilterFn<TData>(\n row: Row<TData>,\n columnId: string,\n filterValue: unknown,\n): boolean {\n if (!Array.isArray(filterValue) || filterValue.length === 0) return true;\n const value = String(row.getValue(columnId));\n return filterValue.some((candidate) => String(candidate) === value);\n}\n"],"names":[],"mappings":";;;AAoDA;AACE;AACE;AACO;AAEX;AAeO;AAGL;AAAM;AACJ;AACA;AACuB;AACG;AACJ;AACR;AACQ;AACL;AACjB;AACA;AACA;AACA;AACA;AACA;AACW;AACJ;AACJ;AAWL;AAAqB;AACF;AACG;AACI;AACH;AACE;AACJ;AAChB;AACH;AACA;AACoE;AACS;AACZ;AACN;AACM;AACf;AAC3C;AACL;AACA;AACA;AACA;AACA;AACA;AACG;AAAA;AAGT;AAOO;AAKL;AACA;AACA;AACF;;;;;"}
@@ -0,0 +1,15 @@
1
+ export { useDataTable, facetFilterFn } from './table/use-data-table.js';
2
+ export type { UseDataTableOptions } from './table/use-data-table.js';
3
+ export { DataTableRoot, useDataTableContext } from './table/data-table-root.js';
4
+ export type { DataTableRootProps } from './table/data-table-root.js';
5
+ export { DataTableToolbar, DataTableSearch, DataTableFacetFilter, DataTableViewOptions, } from './table/data-table-toolbar.js';
6
+ export type { DataTableSearchProps, DataTableFacetOption, DataTableFacetFilterProps, DataTableViewOptionsProps, } from './table/data-table-toolbar.js';
7
+ export { DataTableContent } from './table/data-table-content.js';
8
+ export type { DataTableContentProps } from './table/data-table-content.js';
9
+ export { DataTablePagination } from './table/data-table-pagination.js';
10
+ export type { DataTablePaginationProps } from './table/data-table-pagination.js';
11
+ export { selectColumn } from './table/select-column.js';
12
+ export type { SelectColumnOptions } from './table/select-column.js';
13
+ export { sortableHeader } from './table/sortableHeader.js';
14
+ export type { CellContext, ColumnDef, HeaderContext, Row, Table, } from '@tanstack/react-table';
15
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAIpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D,YAAY,EACV,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,GAClD,MAAM,uBAAuB,CAAC"}
package/dist/table.js ADDED
@@ -0,0 +1,22 @@
1
+ import { facetFilterFn as t, useDataTable as o } from "./table/use-data-table.js";
2
+ import { DataTableRoot as l, useDataTableContext as b } from "./table/data-table-root.js";
3
+ import { DataTableFacetFilter as D, DataTableSearch as f, DataTableToolbar as m, DataTableViewOptions as n } from "./table/data-table-toolbar.js";
4
+ import { DataTableContent as x } from "./table/data-table-content.js";
5
+ import { DataTablePagination as s } from "./table/data-table-pagination.js";
6
+ import { selectColumn as F } from "./table/select-column.js";
7
+ import { sortableHeader as C } from "./table/sortableHeader.js";
8
+ export {
9
+ x as DataTableContent,
10
+ D as DataTableFacetFilter,
11
+ s as DataTablePagination,
12
+ l as DataTableRoot,
13
+ f as DataTableSearch,
14
+ m as DataTableToolbar,
15
+ n as DataTableViewOptions,
16
+ t as facetFilterFn,
17
+ F as selectColumn,
18
+ C as sortableHeader,
19
+ o as useDataTable,
20
+ b as useDataTableContext
21
+ };
22
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,74 @@
1
+ import { Appearance } from '@kanzo-tech/theme';
2
+ import * as React from "react";
3
+ /**
4
+ * A theme scoped to a subtree — Radix Themes' nested `<Theme>`, and daisyUI's nestable `data-theme`.
5
+ *
6
+ * The same attributes {@link KanzoThemeProvider} writes to `<html>`, written to a `<div>` instead,
7
+ * so one page can paint two palettes at once. It became possible when a document stopped being a
8
+ * stylesheet the server serves: `compile(doc, { scope })` emits a two-member selector list whose
9
+ * unqualified member exists precisely so it can match an element that is not `<html>`.
10
+ *
11
+ * ```tsx
12
+ * {palettes.map((p) => (
13
+ * <KanzoTheme key={p.id} palette={p.id}>
14
+ * <PaletteCard />
15
+ * </KanzoTheme>
16
+ * ))}
17
+ * ```
18
+ *
19
+ * ## What this is for, and what it is not for
20
+ *
21
+ * **Previews.** A palette picker showing five documents side by side, a docs page demonstrating a
22
+ * brand, an onboarding screen putting a client's colours next to the default.
23
+ *
24
+ * **Not the chrome of an app.** Ark's overlays — Dialog, Popover, Menu, Select, Tooltip, Toast —
25
+ * portal to `document.body`, which is outside any wrapper, so they inherit `<html>`'s theme and not
26
+ * this one. A Select inside a scoped preview opens its listbox in the *page's* palette. That is not
27
+ * a bug to be fixed here — it is why `KanzoThemeProvider` writes to `document.documentElement` in
28
+ * the first place — and `KanzoTheme.test.tsx` asserts it, so the limit stays written down rather
29
+ * than rediscovered by whoever ships the first scoped dropdown.
30
+ *
31
+ * ## `appearance` works in both directions
32
+ *
33
+ * A first version of this component refused the prop, because forcing *light* inside a dark page was
34
+ * impossible: `compile` emitted `.dark [data-palette="x"]` as a descendant, so a scope carrying
35
+ * `.light` tied with it at (0,2,0) and lost or won on emit order. Offering a prop that worked one way
36
+ * only — with the failing direction looking exactly like the working one — was worse than offering
37
+ * none.
38
+ *
39
+ * The fix was in `compile`, not here: appearance is now a class on the element that carries the
40
+ * theme, never on an ancestor, which is what Radix Themes does and what makes every case resolve on
41
+ * specificity with no pair tied. So the prop exists, and both directions are asserted.
42
+ *
43
+ * **The class is always written**, not only when the prop is given: a scope that named a palette but
44
+ * left the side to inheritance would match the light block on a dark page — an island of light
45
+ * Dracula nobody asked for. Absent a prop it is the appearance the context reports, so a scope
46
+ * follows the page unless told otherwise.
47
+ *
48
+ * ## What it inherits
49
+ *
50
+ * Everything not named. A scope that gives only `palette` keeps the surrounding radius, fonts and
51
+ * density: the attributes for axes it does not override are not written at all, so the cascade
52
+ * reaches whatever `<html>` carries.
53
+ *
54
+ * `set` is **not** re-pointed: a control rendered inside a scope still edits the real preferences. A
55
+ * preview has no controls in it, and a scope that silently swallowed writes would be a worse
56
+ * surprise than one that does not.
57
+ */
58
+ export interface KanzoThemeProps extends React.ComponentPropsWithoutRef<"div"> {
59
+ /** Which published theme paints this subtree. Omit to inherit. */
60
+ theme?: string;
61
+ /**
62
+ * Which side paints here — a *side*, never `null`.
63
+ *
64
+ * There is no "ask the OS" at this level and its absence is deliberate: the OS question is answered
65
+ * once, by the provider, and a scope either pins a side or follows the answer.
66
+ */
67
+ appearance?: Appearance;
68
+ radius?: string;
69
+ font?: string;
70
+ monoFont?: string;
71
+ density?: string;
72
+ }
73
+ export declare function KanzoTheme({ theme, appearance, radius, font, monoFont, density, children, className, ...rest }: KanzoThemeProps): React.JSX.Element;
74
+ //# sourceMappingURL=KanzoTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanzoTheme.d.ts","sourceRoot":"","sources":["../../src/theme/KanzoTheme.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC5E,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAWD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,eAAe,qBAmEjB"}
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import * as u from "react";
4
+ import { AXES as y } from "@kanzo-tech/theme";
5
+ import { useKanzoThemeOptional as z, ThemeContext as B } from "./theme-context.js";
6
+ const b = y.filter(({ attr: o }) => !!o);
7
+ function K({
8
+ theme: o,
9
+ appearance: a,
10
+ radius: c,
11
+ font: l,
12
+ monoFont: p,
13
+ density: i,
14
+ children: A,
15
+ className: h,
16
+ ...T
17
+ }) {
18
+ const e = z(), r = a ?? (e == null ? void 0 : e.resolvedAppearance), n = u.useMemo(
19
+ () => ({
20
+ // A scope names ONE theme for its whole subtree, so both sides carry it: the axis is keyed
21
+ // by appearance because a *user* may want a different theme by day and by night, and a
22
+ // preview forcing one is not that user making a choice. `{}` when the prop is absent, which
23
+ // is what "inherit the page's" spells one level up.
24
+ themeByAppearance: o ? { light: o, dark: o } : {},
25
+ radius: c,
26
+ font: l,
27
+ monoFont: p,
28
+ density: i
29
+ }),
30
+ [o, c, l, p, i]
31
+ ), m = {};
32
+ for (const { attr: x, byAppearance: g, key: k } of b) {
33
+ const t = n[k], s = g ? t == null ? void 0 : t[r ?? "light"] : t;
34
+ typeof s == "string" && s !== "" && (m[x] = s);
35
+ }
36
+ const v = u.useMemo(() => e ? {
37
+ ...e,
38
+ ...n,
39
+ appearance: a ?? e.appearance,
40
+ resolvedAppearance: r ?? e.resolvedAppearance,
41
+ // A scope reports what it PAINTS, and this is the line that matters most: `useThemeTick` reads
42
+ // `resolvedTheme` during render, so a chart inside a scoped preview re-resolves its colours
43
+ // against the scope. Without it the chart would hold the page's theme in its buffers and
44
+ // quietly paint the wrong brand — the same defect a swapped stylesheet caused before.
45
+ resolvedTheme: o || e.resolvedTheme
46
+ } : null, [e, n, o, a, r]), d = /* @__PURE__ */ f(
47
+ "div",
48
+ {
49
+ ...T,
50
+ ...m,
51
+ className: [h, r].filter(Boolean).join(" ") || void 0,
52
+ "data-slot": "kanzo-theme",
53
+ children: A
54
+ }
55
+ );
56
+ return v ? /* @__PURE__ */ f(B.Provider, { value: v, children: d }) : d;
57
+ }
58
+ export {
59
+ K as KanzoTheme
60
+ };
61
+ //# sourceMappingURL=KanzoTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanzoTheme.js","sources":["../../src/theme/KanzoTheme.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport type { Appearance } from \"@kanzo-tech/theme\";\n// Straight from the theme package: `prefs-config.ts` was a re-export of exactly this and\n// nothing else, and it went the way shims go here.\nimport { AXES, type ThemePrefs } from \"@kanzo-tech/theme\";\nimport { ThemeContext, useKanzoThemeOptional, type ThemeContextValue } from \"./theme-context.js\";\n\n/**\n * A theme scoped to a subtree — Radix Themes' nested `<Theme>`, and daisyUI's nestable `data-theme`.\n *\n * The same attributes {@link KanzoThemeProvider} writes to `<html>`, written to a `<div>` instead,\n * so one page can paint two palettes at once. It became possible when a document stopped being a\n * stylesheet the server serves: `compile(doc, { scope })` emits a two-member selector list whose\n * unqualified member exists precisely so it can match an element that is not `<html>`.\n *\n * ```tsx\n * {palettes.map((p) => (\n * <KanzoTheme key={p.id} palette={p.id}>\n * <PaletteCard />\n * </KanzoTheme>\n * ))}\n * ```\n *\n * ## What this is for, and what it is not for\n *\n * **Previews.** A palette picker showing five documents side by side, a docs page demonstrating a\n * brand, an onboarding screen putting a client's colours next to the default.\n *\n * **Not the chrome of an app.** Ark's overlays — Dialog, Popover, Menu, Select, Tooltip, Toast —\n * portal to `document.body`, which is outside any wrapper, so they inherit `<html>`'s theme and not\n * this one. A Select inside a scoped preview opens its listbox in the *page's* palette. That is not\n * a bug to be fixed here — it is why `KanzoThemeProvider` writes to `document.documentElement` in\n * the first place — and `KanzoTheme.test.tsx` asserts it, so the limit stays written down rather\n * than rediscovered by whoever ships the first scoped dropdown.\n *\n * ## `appearance` works in both directions\n *\n * A first version of this component refused the prop, because forcing *light* inside a dark page was\n * impossible: `compile` emitted `.dark [data-palette=\"x\"]` as a descendant, so a scope carrying\n * `.light` tied with it at (0,2,0) and lost or won on emit order. Offering a prop that worked one way\n * only — with the failing direction looking exactly like the working one — was worse than offering\n * none.\n *\n * The fix was in `compile`, not here: appearance is now a class on the element that carries the\n * theme, never on an ancestor, which is what Radix Themes does and what makes every case resolve on\n * specificity with no pair tied. So the prop exists, and both directions are asserted.\n *\n * **The class is always written**, not only when the prop is given: a scope that named a palette but\n * left the side to inheritance would match the light block on a dark page — an island of light\n * Dracula nobody asked for. Absent a prop it is the appearance the context reports, so a scope\n * follows the page unless told otherwise.\n *\n * ## What it inherits\n *\n * Everything not named. A scope that gives only `palette` keeps the surrounding radius, fonts and\n * density: the attributes for axes it does not override are not written at all, so the cascade\n * reaches whatever `<html>` carries.\n *\n * `set` is **not** re-pointed: a control rendered inside a scope still edits the real preferences. A\n * preview has no controls in it, and a scope that silently swallowed writes would be a worse\n * surprise than one that does not.\n */\nexport interface KanzoThemeProps extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Which published theme paints this subtree. Omit to inherit. */\n theme?: string;\n /**\n * Which side paints here — a *side*, never `null`.\n *\n * There is no \"ask the OS\" at this level and its absence is deliberate: the OS question is answered\n * once, by the provider, and a scope either pins a side or follows the answer.\n */\n appearance?: Appearance;\n radius?: string;\n font?: string;\n monoFont?: string;\n density?: string;\n}\n\n/**\n * The axes a scope may override.\n *\n * Read off `AXES` rather than listed here, so an axis added to the table is scopable the same day it\n * is applicable — the drift this whole table exists to prevent. `identityByPalette` is not an axis\n * (it is the memory behind one) and carries no attribute, so it never appears.\n */\nconst SCOPED = AXES.filter(({ attr }) => Boolean(attr));\n\nexport function KanzoTheme({\n theme,\n appearance,\n radius,\n font,\n monoFont,\n density,\n children,\n className,\n ...rest\n}: KanzoThemeProps) {\n const parent = useKanzoThemeOptional();\n const resolvedAppearance = appearance ?? parent?.resolvedAppearance;\n\n const overrides = React.useMemo(\n () =>\n ({\n // A scope names ONE theme for its whole subtree, so both sides carry it: the axis is keyed\n // by appearance because a *user* may want a different theme by day and by night, and a\n // preview forcing one is not that user making a choice. `{}` when the prop is absent, which\n // is what \"inherit the page's\" spells one level up.\n themeByAppearance: theme ? { light: theme, dark: theme } : {},\n radius,\n font,\n monoFont,\n density,\n }) as Partial<ThemePrefs>,\n [theme, radius, font, monoFont, density],\n );\n\n // Rendered as props rather than written in an effect: a scope is declarative and has no OS to\n // consult, so there is nothing to resolve after mount — and rendering them means the server emits\n // them too, which is what stops a scoped preview from painting the page's palette on first paint\n // and then correcting itself.\n const attributes: Record<string, string> = {};\n for (const { attr, byAppearance, key } of SCOPED) {\n // A keyed axis holds a map, indexed by the side this scope is about to paint — the same\n // expression the provider and the pre-hydration script run, off the same row.\n const stored = overrides[key];\n // `resolvedAppearance` is undefined outside a provider with no `appearance` prop — the scope\n // paints, inherits the page's side and writes no class. Either key answers the same here,\n // because a scope writes both, so the fallback picks one rather than inventing a side.\n const value = byAppearance\n ? (stored as Record<string, string> | undefined)?.[resolvedAppearance ?? \"light\"]\n : stored;\n if (typeof value === \"string\" && value !== \"\") attributes[attr] = value;\n }\n\n const ctx = React.useMemo<ThemeContextValue | null>(() => {\n if (!parent) return null;\n return {\n ...parent,\n ...overrides,\n appearance: appearance ?? parent.appearance,\n resolvedAppearance: resolvedAppearance ?? parent.resolvedAppearance,\n // A scope reports what it PAINTS, and this is the line that matters most: `useThemeTick` reads\n // `resolvedTheme` during render, so a chart inside a scoped preview re-resolves its colours\n // against the scope. Without it the chart would hold the page's theme in its buffers and\n // quietly paint the wrong brand — the same defect a swapped stylesheet caused before.\n resolvedTheme: theme || parent.resolvedTheme,\n };\n }, [parent, overrides, theme, appearance, resolvedAppearance]);\n\n const scoped = (\n <div\n {...rest}\n {...attributes}\n className={[className, resolvedAppearance].filter(Boolean).join(\" \") || undefined}\n data-slot=\"kanzo-theme\"\n >\n {children}\n </div>\n );\n\n // Outside a provider there is nothing to inherit into context — but the attributes still paint,\n // because the cascade does not need React to work.\n return ctx ? <ThemeContext.Provider value={ctx}>{scoped}</ThemeContext.Provider> : scoped;\n}\n"],"names":[],"mappings":";;;;;AAuFA;AAEO;AAAoB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEF;AACE;AAGwB;AAEnB;AAAA;AAAA;AAAA;AAAA;AAK4D;AAC3D;AACA;AACA;AACA;AAAA;AAEmC;AAQzC;AAGE;AAOA;AAAkE;AAGpE;AAES;AACF;AACA;AAC8B;AACgB;AAAA;AAAA;AAAA;AAAA;AAKlB;AAKjC;AAAC;AAAA;AACK;AACA;AACoE;AAC9D;AAET;AAAA;AAML;AACF;;;;"}
@@ -0,0 +1,144 @@
1
+ import { Appearance, ThemeOption, SectionManifest, SectionPolicy, ThemePrefs } from '@kanzo-tech/theme';
2
+ import { FontOption } from './theme-context.js';
3
+ import * as React from "react";
4
+ export { useKanzoTheme, useKanzoThemeOptional, type FontOption, type ThemeContextValue, } from './theme-context.js';
5
+ export type { ThemePrefs } from '@kanzo-tech/theme';
6
+ /**
7
+ * KanzoThemeProvider — owns the runtime theme PREFERENCES and applies them as `data-*`
8
+ * attributes on `<html>`. It exposes the state via {@link useKanzoTheme} so a `Preferences`
9
+ * selector drives the whole app live.
10
+ *
11
+ * It is framework-agnostic and works in two modes:
12
+ * · **Controlled** — pass `value` + `onChange` (e.g. keasy bridges its server-persisted prefs).
13
+ * · **Uncontrolled** — internal state persisted via a pluggable `storage` (default localStorage).
14
+ *
15
+ * **Colour is not a free preference.** A tenant's identity is a palette DOCUMENT, compiled to one
16
+ * stylesheet the server inlines. Nothing here writes a colour VALUE: the six preferences are the
17
+ * four non-colour axes, `appearance` (which of the document's two blocks applies) and `identity`
18
+ * (which of the blocks the TENANT published applies). A user who has never been given a second
19
+ * identity has the same five preferences they had before, and the same `<html>`.
20
+ *
21
+ * `.dark` therefore follows the PREFERENCE directly. It used to be derived from the applied
22
+ * palette, so a partnerless palette could overrule the user; a document carries both modes, so
23
+ * there is nothing left to contradict them. A host theme manager may supply the preference (see
24
+ * {@link AppearanceController}) — if it also writes the class (next-themes with
25
+ * `attribute: "class"`) it must be disabled, or the two fight over the same class.
26
+ *
27
+ * Attributes are written to `document.documentElement` (NOT a wrapper `<div>`): Ark overlays
28
+ * (Dialog, Popover, Menu, Select, Tooltip…) portal to `document.body`, OUTSIDE any wrapper, so
29
+ * the tokens must live on `<html>` for portaled surfaces to inherit them.
30
+ */
31
+ /**
32
+ * A host theme manager (next-themes) as the source of the appearance PREFERENCE.
33
+ *
34
+ * A host that also writes `.dark` must be turned off (`RootProvider theme={{ enabled: false }}`
35
+ * in fumadocs, `enableColorScheme: false` + no `attribute: "class"` elsewhere), or two owners
36
+ * write the same class. What the controller provides is the preference and the OS resolution,
37
+ * which is all this provider reads from it. Shape matches next-themes.
38
+ */
39
+ export interface AppearanceController {
40
+ /**
41
+ * The host's preference, in the HOST's vocabulary; next-themes exposes this as `theme`.
42
+ *
43
+ * `string`, not `Appearance`, because this is where a foreign model enters. next-themes' third
44
+ * value is the string `"system"`, ours is `""`, and the translation happens once, below — no
45
+ * other line in this package knows that `"system"` is a word.
46
+ */
47
+ theme?: string;
48
+ /** The applied value (`light` | `dark`), already resolved against the OS by the host. */
49
+ resolvedTheme?: string;
50
+ setTheme: (theme: string) => void;
51
+ }
52
+ /** Pluggable persistence for the uncontrolled mode. */
53
+ export interface ThemeStorage {
54
+ get: () => Partial<ThemePrefs> | null;
55
+ /** What the user chose — sparse. A key is absent because nobody has written it. */
56
+ set: (prefs: Partial<ThemePrefs>) => void;
57
+ }
58
+ /**
59
+ * Cookie-backed persistence — use this in SSR apps so the SAME source the {@link themeScript}
60
+ * reads before hydration is also written by the client, and the server can read it from the
61
+ * request `Cookie` header to render the correct theme. Pair with `themeScript({ storageKey })`.
62
+ */
63
+ export declare const cookieStorageAdapter: (key?: string, { maxAgeDays, path, sameSite }?: {
64
+ maxAgeDays?: number | undefined;
65
+ path?: string | undefined;
66
+ sameSite?: "Lax" | undefined;
67
+ }) => ThemeStorage;
68
+ export interface KanzoThemeProviderProps {
69
+ children: React.ReactNode;
70
+ /** Override the built-in defaults (unpinned / md / system / system / default / the document's). */
71
+ defaults?: Partial<ThemePrefs>;
72
+ /** Controlled mode: supply value + onChange (host owns persistence). */
73
+ value?: Partial<ThemePrefs>;
74
+ onChange?: (next: Partial<ThemePrefs>) => void;
75
+ /** Uncontrolled persistence. `undefined` = localStorage; `null` = no persistence. */
76
+ storage?: ThemeStorage | null;
77
+ storageKey?: string;
78
+ /** Host-configurable option lists surfaced by the Preferences panel. */
79
+ fonts?: FontOption[];
80
+ monoFonts?: FontOption[];
81
+ /**
82
+ * The themes the TENANT published. Usually `themeIndex` from `@kanzo-tech/theme`, or a tenant's
83
+ * own list mapped on the server.
84
+ *
85
+ * **Wiring this applies it.** A theme is a flat block of CSS that travels in the page under its
86
+ * own `[data-theme]`, so this provider writes the attribute like any other axis. A host still has
87
+ * to *load* the themes — import the sheets, or inline them — but it never chooses one per request,
88
+ * and a user switching theme never needs a round trip.
89
+ *
90
+ * **It is one prop where there were two.** `palettes` carried documents and each document carried
91
+ * its brands as `children`, so a host published a tree and the panel flattened it. A brand is a
92
+ * theme, so the tree is a list.
93
+ */
94
+ themes?: ThemeOption[];
95
+ /**
96
+ * The name applied when the preference is empty. Defaults to the first published one.
97
+ *
98
+ * **A pair, when the two sides differ.** A theme carries its own light or dark palette, so one
99
+ * name cannot answer for both sides: naming a night theme here paints it in daylight too, with
100
+ * `.dark` off. Pass `{ light, dark }` to say which theme each side defers to — the same shape the
101
+ * preference already stores, and the same reason it is a map there.
102
+ */
103
+ defaultTheme?: string | Partial<Record<Appearance, string>>;
104
+ /** Called once, at most, when the stored theme is no longer published — somebody chose gold and is
105
+ * about to be looking at blue, and silence makes that read as a bug in our product rather than a
106
+ * change in their client's. The provider renders no notice itself; say it where the app says
107
+ * things. */
108
+ onThemeRetired?: (theme: string) => void;
109
+ /**
110
+ * The section manifests of the packages this host installed.
111
+ *
112
+ * **The host registers, and that is what keeps the one-way door shut.** Nothing in
113
+ * `@kanzo-tech/theme` or in this file names an optional package, so the arrow points host → core:
114
+ * a host that never installed the graph literally cannot pass its manifest, and
115
+ * `packages/theme/src/boundary.test.ts` keeps passing because there is nothing to import.
116
+ * Registration by import into the core would be the same mechanism with the dependency inverted.
117
+ */
118
+ sections?: SectionManifest[];
119
+ /**
120
+ * What the TENANT says about every choice — pinned, withheld, or merely started elsewhere.
121
+ *
122
+ * Keyed by namespace, and **the core is the namespace `theme`** ({@link CORE_NAMESPACE}):
123
+ *
124
+ * ```ts
125
+ * policy={{ theme: { density: { default: "compact" }, radius: { pinned: "sm" } },
126
+ * graph: { look: { hidden: true } } }}
127
+ * ```
128
+ *
129
+ * This is the white-label half, and it used to reach only half the product: a tenant could pin the
130
+ * graph's look and could not pin the radius, because the newer mechanism had a resolution chain
131
+ * and the older one had a whitelist read. Now a client ships *our product is compact and square*
132
+ * as the starting point their users move from — which is daisyUI's theme-carries-the-geometry,
133
+ * expressed as a policy over declarations rather than as a second document format.
134
+ *
135
+ * It selects among the options a declaration published; it cannot author one. That line is the
136
+ * same one the colour layer holds, and it is why this is not the retired runtime palette coming
137
+ * back under a new name.
138
+ */
139
+ policy?: Record<string, SectionPolicy>;
140
+ /** Delegate dark to a host theme manager (e.g. next-themes). Omit to use the built-in fallback. */
141
+ appearance?: AppearanceController;
142
+ }
143
+ export declare function KanzoThemeProvider({ children, defaults, value, onChange, storage, storageKey, fonts, monoFonts, themes, defaultTheme, onThemeRetired, sections, policy, appearance, }: KanzoThemeProviderProps): React.JSX.Element;
144
+ //# sourceMappingURL=KanzoThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanzoThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/KanzoThemeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,UAAU,EAGV,WAAW,EAGX,eAAe,EACf,aAAa,EAGd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAgB,KAAK,UAAU,EAA0B,MAAM,oBAAoB,CAAC;AAE3F,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACtC,mFAAmF;IACnF,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC3C;AAqBD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAK,MAAoB,EACzB;;;;CAAgE,KAC/D,YAmBD,CAAC;AA6FH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC/C,qFAAqF;IACrF,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC;IACzB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D;;;kBAGc;IACd,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvC,mGAAmG;IACnG,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAwB,EACxB,KAAqB,EACrB,SAA8B,EAC9B,MAAkB,EAIlB,YAAqC,EACrC,cAAc,EACd,QAAsB,EACtB,MAAkB,EAClB,UAAU,GACX,EAAE,uBAAuB,qBAoazB"}
@@ -0,0 +1,271 @@
1
+ "use client";
2
+ import { jsx as ne } from "react/jsx-runtime";
3
+ import * as o from "react";
4
+ import { STORAGE_KEY as G, DEFAULT_PREFS as H, CORE_NAMESPACE as se, CORE_PREFS as P, resolvePref as D, AXES as U, themeData as X, prefOptions as ce } from "@kanzo-tech/theme";
5
+ import { ThemeContext as re } from "./theme-context.js";
6
+ import { useKanzoTheme as Te, useKanzoThemeOptional as Pe } from "./theme-context.js";
7
+ const ue = (r) => ({
8
+ get: () => {
9
+ if (typeof localStorage > "u") return null;
10
+ try {
11
+ const n = localStorage.getItem(r);
12
+ return n ? JSON.parse(n) : null;
13
+ } catch {
14
+ return null;
15
+ }
16
+ },
17
+ set: (n) => {
18
+ try {
19
+ localStorage.setItem(r, JSON.stringify(n));
20
+ } catch {
21
+ }
22
+ }
23
+ }), ke = (r = G, { maxAgeDays: n = 365, path: u = "/", sameSite: f = "Lax" } = {}) => ({
24
+ get: () => {
25
+ if (typeof document > "u") return null;
26
+ try {
27
+ const a = document.cookie.match(new RegExp("(?:^|; )" + r + "=([^;]*)"));
28
+ return a != null && a[1] ? JSON.parse(decodeURIComponent(a[1])) : null;
29
+ } catch {
30
+ return null;
31
+ }
32
+ },
33
+ set: (a) => {
34
+ if (!(typeof document > "u"))
35
+ try {
36
+ const y = encodeURIComponent(JSON.stringify(a));
37
+ document.cookie = `${r}=${y}; Max-Age=${n * 86400}; Path=${u}; SameSite=${f}`;
38
+ } catch {
39
+ }
40
+ }
41
+ }), fe = Object.keys(H);
42
+ function ie(r) {
43
+ const n = {};
44
+ for (const u of fe) r[u] !== void 0 && (n[u] = r[u]);
45
+ return n;
46
+ }
47
+ const Q = (r, n) => (ce(P[r]) ?? []).map((u) => ({
48
+ ...u,
49
+ preview: n[u.value]
50
+ })), le = Q("font", X.fonts), me = Q("monoFont", X.monoFonts), ae = [], de = [], ve = {}, q = {}, pe = {};
51
+ function Ee(r, n, u, f) {
52
+ const [a, y] = o.useState(null), A = o.useRef(!1);
53
+ return o.useEffect(() => {
54
+ A.current || !r || n.length === 0 || n.some((w) => w.value === r) || (A.current = !0, y(r), u(), f == null || f(r));
55
+ }, [u, r, n, f]), a;
56
+ }
57
+ function he({
58
+ children: r,
59
+ defaults: n,
60
+ value: u,
61
+ onChange: f,
62
+ storage: a,
63
+ storageKey: y = G,
64
+ fonts: A = le,
65
+ monoFonts: w = me,
66
+ themes: S = ae,
67
+ // The first published one. `themeIndex` carries no `isDefault`
68
+ // flag, but it belongs to the host's mapper: a `ThemeOption` is what a CONTROL needs, and a
69
+ // control has no use for which one the server would have served anyway.
70
+ defaultTheme: M = ((W) => (W = S[0]) == null ? void 0 : W.value)() ?? "",
71
+ onThemeRetired: V,
72
+ sections: N = de,
73
+ policy: _ = ve,
74
+ appearance: i
75
+ }) {
76
+ var z;
77
+ const k = u !== void 0, v = o.useMemo(
78
+ () => a === void 0 ? ue(y) : a,
79
+ [a, y]
80
+ ), [Z, $] = o.useState(() => {
81
+ if (k) return { ...u };
82
+ const e = (v == null ? void 0 : v.get()) ?? null;
83
+ return e ? ie(e) : {};
84
+ }), d = k ? u ?? pe : Z, p = o.useMemo(
85
+ () => ({ ...H, ...n, ...d }),
86
+ [n, d]
87
+ ), F = o.useRef(d);
88
+ F.current = d;
89
+ const O = o.useCallback(
90
+ (e) => {
91
+ const t = { ...F.current, ...e };
92
+ F.current = t, k ? f == null || f(t) : ($(t), v == null || v.set(t));
93
+ },
94
+ [k, f, v]
95
+ ), g = o.useCallback(() => {
96
+ F.current = {}, k ? f == null || f({}) : ($({}), v == null || v.set({}));
97
+ }, [k, f, v]), R = o.useMemo(() => {
98
+ var c;
99
+ const e = _[se] ?? q;
100
+ if (!n) return e;
101
+ const t = { ...e };
102
+ for (const s of Object.keys(P)) {
103
+ const l = n[s];
104
+ typeof l != "string" || ((c = t[s]) == null ? void 0 : c.default) !== void 0 || (t[s] = { ...t[s], default: l });
105
+ }
106
+ return t;
107
+ }, [n, _]), [ee, te] = o.useState(
108
+ () => {
109
+ var e;
110
+ return typeof window < "u" && !!((e = window.matchMedia) != null && e.call(window, "(prefers-color-scheme: dark)").matches);
111
+ }
112
+ ), B = o.useMemo(
113
+ () => D(
114
+ P.appearance,
115
+ i ? i.theme ?? i.resolvedTheme : d.appearance,
116
+ R.appearance
117
+ ),
118
+ [i, R, d.appearance]
119
+ ), T = B.value;
120
+ o.useEffect(() => {
121
+ if (i || T || typeof window > "u" || !window.matchMedia) return;
122
+ const e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => te(e.matches);
123
+ return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
124
+ }, [i, T]);
125
+ const E = T || ((i == null ? void 0 : i.resolvedTheme) === "dark" || !(i != null && i.resolvedTheme) && ee ? "dark" : "light"), j = o.useCallback(
126
+ (e) => typeof M == "string" ? M : M[e] ?? "",
127
+ [M]
128
+ ), h = o.useMemo(() => {
129
+ const e = { appearance: { ...B, decl: P.appearance } };
130
+ for (const { key: t } of U) {
131
+ const c = P[t], s = d[t], l = c.byAppearance ? s == null ? void 0 : s[E] : s;
132
+ e[t] = { ...D(c, l, R[t]), decl: c };
133
+ }
134
+ return e;
135
+ }, [
136
+ B,
137
+ R,
138
+ E,
139
+ d.radius,
140
+ d.font,
141
+ d.monoFont,
142
+ d.density,
143
+ d.themeByAppearance
144
+ ]), C = ((z = h.themeByAppearance) == null ? void 0 : z.value) || j(E), I = o.useCallback(
145
+ (e, t = {}) => {
146
+ const c = t.appearance ?? E;
147
+ O({ themeByAppearance: { ...p.themeByAppearance, [c]: e } });
148
+ },
149
+ [p.themeByAppearance, E, O]
150
+ ), L = o.useMemo(
151
+ () => ({ themes: S.map(({ label: e, value: t }) => ({ label: e, value: t })) }),
152
+ [S]
153
+ ), J = Ee(
154
+ C,
155
+ S,
156
+ o.useCallback(() => I(""), [I]),
157
+ V
158
+ );
159
+ o.useEffect(() => {
160
+ var t;
161
+ const e = document.documentElement;
162
+ for (const { attr: c, def: s, key: l } of U) {
163
+ const m = (t = h[l]) == null ? void 0 : t.value;
164
+ m === void 0 || m === s ? e.removeAttribute(c) : e.setAttribute(c, m);
165
+ }
166
+ e.classList.toggle("dark", E === "dark");
167
+ }, [h, E]), o.useEffect(
168
+ () => () => {
169
+ const e = document.documentElement;
170
+ for (const { attr: t } of U) e.removeAttribute(t);
171
+ },
172
+ []
173
+ );
174
+ const K = o.useCallback(
175
+ (e) => {
176
+ i ? i.setTheme(e || "system") : O({ appearance: e });
177
+ },
178
+ [i, O]
179
+ ), x = o.useMemo(() => {
180
+ const e = {};
181
+ for (const t of N) {
182
+ const c = p.sections[t.namespace] ?? {}, s = _[t.namespace] ?? q, l = {};
183
+ for (const [m, b] of Object.entries(t.prefs ?? {}))
184
+ l[m] = { ...D(b, c[m], s[m], L), decl: b };
185
+ Object.keys(l).length > 0 && (e[t.namespace] = l);
186
+ }
187
+ return e;
188
+ }, [p.sections, _, N, L]), Y = o.useCallback(
189
+ (e, t) => {
190
+ const c = { ...p.sections[e] ?? {} };
191
+ for (const [s, l] of Object.entries(t))
192
+ l === void 0 ? delete c[s] : c[s] = l;
193
+ O({ sections: { ...p.sections, [e]: c } });
194
+ },
195
+ [p.sections, O]
196
+ );
197
+ o.useEffect(() => {
198
+ var c;
199
+ const e = document.documentElement, t = [];
200
+ for (const s of N)
201
+ for (const [l, m] of Object.entries(s.prefs ?? {})) {
202
+ if (!m.attr) continue;
203
+ t.push(m.attr);
204
+ const b = (c = x[s.namespace]) == null ? void 0 : c[l];
205
+ !b || b.value === m.default ? e.removeAttribute(m.attr) : e.setAttribute(m.attr, b.value);
206
+ }
207
+ return () => {
208
+ for (const s of t) e.removeAttribute(s);
209
+ };
210
+ }, [x, N]);
211
+ const oe = o.useMemo(
212
+ () => ({
213
+ ...p,
214
+ // The resolved values overwrite the stored ones, and that is the point of this phase: what a
215
+ // control shows and what the page is painted with are the same number. A tenant pinning
216
+ // `density` means every reader sees `"compact"`, while storage keeps whatever this user chose
217
+ // and hands it back the day the tenant stops pinning it.
218
+ ...Object.fromEntries(Object.entries(h).map(([e, { value: t }]) => [e, t])),
219
+ // …except the one that is a map. `themeByAppearance` stores a side→theme map and the chain
220
+ // answers for ONE side, so writing the resolved string over it would change the field's shape
221
+ // under every reader. `resolvedTheme` is where the answer belongs, and it is below.
222
+ themeByAppearance: p.themeByAppearance,
223
+ corePrefs: h,
224
+ sources: L,
225
+ set: O,
226
+ reset: g,
227
+ fonts: A,
228
+ monoFonts: w,
229
+ sectionPrefs: x,
230
+ setSectionPref: Y,
231
+ appearance: T,
232
+ resolvedAppearance: E,
233
+ setAppearance: K,
234
+ themes: S,
235
+ // The applied side's default. The pair is behind `defaultThemeFor`, because a panel drawing
236
+ // the OTHER side needs that side's answer and a single string cannot give it.
237
+ defaultTheme: j(E),
238
+ defaultThemeFor: j,
239
+ resolvedTheme: C,
240
+ setTheme: I,
241
+ retiredTheme: J
242
+ }),
243
+ [
244
+ p,
245
+ O,
246
+ A,
247
+ w,
248
+ T,
249
+ E,
250
+ K,
251
+ S,
252
+ j,
253
+ C,
254
+ I,
255
+ J,
256
+ x,
257
+ Y,
258
+ h,
259
+ L,
260
+ g
261
+ ]
262
+ );
263
+ return /* @__PURE__ */ ne(re.Provider, { value: oe, children: r });
264
+ }
265
+ export {
266
+ he as KanzoThemeProvider,
267
+ ke as cookieStorageAdapter,
268
+ Te as useKanzoTheme,
269
+ Pe as useKanzoThemeOptional
270
+ };
271
+ //# sourceMappingURL=KanzoThemeProvider.js.map