@bettercms-ai/kit 0.1.1 → 1.0.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 (947) hide show
  1. package/_virtual/_rolldown/runtime.js +13 -0
  2. package/adapters/icons.d.ts +15 -0
  3. package/adapters/icons.js +27 -0
  4. package/adapters/icons.js.map +1 -0
  5. package/adapters/lossy.d.ts +267 -0
  6. package/adapters/lossy.js +233 -0
  7. package/adapters/lossy.js.map +1 -0
  8. package/adapters/prod-types.d.ts +468 -0
  9. package/adapters/prod-types.js +646 -0
  10. package/adapters/prod-types.js.map +1 -0
  11. package/adapters/schema.d.ts +115 -0
  12. package/adapters/schema.js +2203 -0
  13. package/adapters/schema.js.map +1 -0
  14. package/adapters/values.d.ts +200 -0
  15. package/adapters/values.js +553 -0
  16. package/adapters/values.js.map +1 -0
  17. package/brand/logo.d.ts +17 -0
  18. package/brand/logo.js +9 -0
  19. package/brand/logo.js.map +1 -0
  20. package/context.d.ts +269 -0
  21. package/context.js +214 -0
  22. package/context.js.map +1 -0
  23. package/controls/button.d.ts +58 -0
  24. package/controls/button.js +507 -0
  25. package/controls/button.js.map +1 -0
  26. package/controls/c1.d.ts +11 -0
  27. package/controls/c1.js +24 -0
  28. package/controls/c1.js.map +1 -0
  29. package/controls/c2.d.ts +10 -0
  30. package/controls/c2.js +19 -0
  31. package/controls/c2.js.map +1 -0
  32. package/controls/choice.d.ts +39 -0
  33. package/controls/choice.js +410 -0
  34. package/controls/choice.js.map +1 -0
  35. package/controls/code-register.d.ts +1 -0
  36. package/controls/code-register.js +8 -0
  37. package/controls/code-register.js.map +1 -0
  38. package/controls/code.d.ts +42 -0
  39. package/controls/code.js +396 -0
  40. package/controls/code.js.map +1 -0
  41. package/controls/color.d.ts +5 -0
  42. package/controls/color.js +130 -0
  43. package/controls/color.js.map +1 -0
  44. package/controls/component-services.d.ts +114 -0
  45. package/controls/date-register.d.ts +1 -0
  46. package/controls/date-register.js +9 -0
  47. package/controls/date-register.js.map +1 -0
  48. package/controls/date-zone.d.ts +104 -0
  49. package/controls/date-zone.js +272 -0
  50. package/controls/date-zone.js.map +1 -0
  51. package/controls/date.d.ts +7 -0
  52. package/controls/date.js +458 -0
  53. package/controls/date.js.map +1 -0
  54. package/controls/form-picker-register.d.ts +1 -0
  55. package/controls/form-picker-register.js +19 -0
  56. package/controls/form-picker-register.js.map +1 -0
  57. package/controls/form-picker.d.ts +43 -0
  58. package/controls/form-picker.js +83 -0
  59. package/controls/form-picker.js.map +1 -0
  60. package/controls/icon-register.d.ts +1 -0
  61. package/controls/icon-register.js +8 -0
  62. package/controls/icon-register.js.map +1 -0
  63. package/controls/icon.d.ts +38 -0
  64. package/controls/icon.js +355 -0
  65. package/controls/icon.js.map +1 -0
  66. package/controls/index.d.ts +5 -0
  67. package/controls/index.js +37 -0
  68. package/controls/index.js.map +1 -0
  69. package/controls/json-register.d.ts +1 -0
  70. package/controls/json-register.js +8 -0
  71. package/controls/json-register.js.map +1 -0
  72. package/controls/json.d.ts +2 -0
  73. package/controls/json.js +72 -0
  74. package/controls/json.js.map +1 -0
  75. package/controls/link.d.ts +260 -0
  76. package/controls/link.js +1186 -0
  77. package/controls/link.js.map +1 -0
  78. package/controls/location-register.d.ts +1 -0
  79. package/controls/location-register.js +8 -0
  80. package/controls/location-register.js.map +1 -0
  81. package/controls/location.d.ts +16 -0
  82. package/controls/location.js +197 -0
  83. package/controls/location.js.map +1 -0
  84. package/controls/media-register.d.ts +1 -0
  85. package/controls/media-register.js +12 -0
  86. package/controls/media-register.js.map +1 -0
  87. package/controls/media-services.d.ts +40 -0
  88. package/controls/media.d.ts +73 -0
  89. package/controls/media.js +1076 -0
  90. package/controls/media.js.map +1 -0
  91. package/controls/number.d.ts +22 -0
  92. package/controls/number.js +195 -0
  93. package/controls/number.js.map +1 -0
  94. package/controls/reference-register.d.ts +1 -0
  95. package/controls/reference-register.js +10 -0
  96. package/controls/reference-register.js.map +1 -0
  97. package/controls/reference-services.d.ts +54 -0
  98. package/controls/reference.d.ts +23 -0
  99. package/controls/reference.js +761 -0
  100. package/controls/reference.js.map +1 -0
  101. package/controls/rich-text/blocks.d.ts +28 -0
  102. package/controls/rich-text/blocks.js +1532 -0
  103. package/controls/rich-text/blocks.js.map +1 -0
  104. package/controls/rich-text/catalog.d.ts +98 -0
  105. package/controls/rich-text/catalog.js +613 -0
  106. package/controls/rich-text/catalog.js.map +1 -0
  107. package/controls/rich-text/codec.d.ts +56 -0
  108. package/controls/rich-text/codec.js +32 -0
  109. package/controls/rich-text/codec.js.map +1 -0
  110. package/controls/rich-text/component-card.d.ts +14 -0
  111. package/controls/rich-text/component-card.js +706 -0
  112. package/controls/rich-text/component-card.js.map +1 -0
  113. package/controls/rich-text/control.d.ts +21 -0
  114. package/controls/rich-text/control.js +254 -0
  115. package/controls/rich-text/control.js.map +1 -0
  116. package/controls/rich-text/dom.d.ts +190 -0
  117. package/controls/rich-text/dom.js +690 -0
  118. package/controls/rich-text/dom.js.map +1 -0
  119. package/controls/rich-text/editor.d.ts +50 -0
  120. package/controls/rich-text/editor.js +1530 -0
  121. package/controls/rich-text/editor.js.map +1 -0
  122. package/controls/rich-text/floating.d.ts +23 -0
  123. package/controls/rich-text/floating.js +137 -0
  124. package/controls/rich-text/floating.js.map +1 -0
  125. package/controls/rich-text/index.d.ts +1 -0
  126. package/controls/rich-text/index.js +12 -0
  127. package/controls/rich-text/index.js.map +1 -0
  128. package/controls/rich-text/link-form.d.ts +13 -0
  129. package/controls/rich-text/link-form.js +111 -0
  130. package/controls/rich-text/link-form.js.map +1 -0
  131. package/controls/rich-text/markdown.d.ts +6 -0
  132. package/controls/rich-text/markdown.js +179 -0
  133. package/controls/rich-text/markdown.js.map +1 -0
  134. package/controls/rich-text/ops.d.ts +35 -0
  135. package/controls/rich-text/ops.js +314 -0
  136. package/controls/rich-text/ops.js.map +1 -0
  137. package/controls/rich-text/toolbar.d.ts +85 -0
  138. package/controls/rich-text/toolbar.js +338 -0
  139. package/controls/rich-text/toolbar.js.map +1 -0
  140. package/controls/scale.d.ts +56 -0
  141. package/controls/scale.js +563 -0
  142. package/controls/scale.js.map +1 -0
  143. package/controls/slot-register.d.ts +1 -0
  144. package/controls/slot-register.js +16 -0
  145. package/controls/slot-register.js.map +1 -0
  146. package/controls/slot-services.d.ts +97 -0
  147. package/controls/slot-services.js +38 -0
  148. package/controls/slot-services.js.map +1 -0
  149. package/controls/slot.d.ts +33 -0
  150. package/controls/slot.js +348 -0
  151. package/controls/slot.js.map +1 -0
  152. package/controls/table/index.d.ts +1 -0
  153. package/controls/table/index.js +12 -0
  154. package/controls/table/index.js.map +1 -0
  155. package/controls/table/prod.d.ts +21 -0
  156. package/controls/table/prod.js +79 -0
  157. package/controls/table/prod.js.map +1 -0
  158. package/controls/table/refs.d.ts +50 -0
  159. package/controls/table/refs.js +68 -0
  160. package/controls/table/refs.js.map +1 -0
  161. package/controls/table/stored.d.ts +15 -0
  162. package/controls/table/stored.js +44 -0
  163. package/controls/table/stored.js.map +1 -0
  164. package/controls/table/table-editor.d.ts +103 -0
  165. package/controls/table/table-editor.js +2722 -0
  166. package/controls/table/table-editor.js.map +1 -0
  167. package/controls/table/table-link.d.ts +24 -0
  168. package/controls/table/table-link.js +180 -0
  169. package/controls/table/table-link.js.map +1 -0
  170. package/controls/table/table.d.ts +9 -0
  171. package/controls/table/table.js +103 -0
  172. package/controls/table/table.js.map +1 -0
  173. package/controls/text.d.ts +17 -0
  174. package/controls/text.js +287 -0
  175. package/controls/text.js.map +1 -0
  176. package/engine/array.d.ts +101 -0
  177. package/engine/array.js +893 -0
  178. package/engine/array.js.map +1 -0
  179. package/engine/bits.d.ts +24 -0
  180. package/engine/bits.js +60 -0
  181. package/engine/bits.js.map +1 -0
  182. package/engine/breadcrumb.d.ts +45 -0
  183. package/engine/breadcrumb.js +87 -0
  184. package/engine/breadcrumb.js.map +1 -0
  185. package/engine/expand.d.ts +68 -0
  186. package/engine/expand.js +170 -0
  187. package/engine/expand.js.map +1 -0
  188. package/engine/field-list.d.ts +20 -0
  189. package/engine/field-list.js +19 -0
  190. package/engine/field-list.js.map +1 -0
  191. package/engine/field-shell.d.ts +49 -0
  192. package/engine/field-shell.js +860 -0
  193. package/engine/field-shell.js.map +1 -0
  194. package/engine/frame.d.ts +120 -0
  195. package/engine/frame.js +599 -0
  196. package/engine/frame.js.map +1 -0
  197. package/engine/group-summary.d.ts +4 -0
  198. package/engine/group-summary.js +66 -0
  199. package/engine/group-summary.js.map +1 -0
  200. package/engine/grouping.d.ts +224 -0
  201. package/engine/grouping.js +824 -0
  202. package/engine/grouping.js.map +1 -0
  203. package/engine/item-list.d.ts +89 -0
  204. package/engine/item-list.js +703 -0
  205. package/engine/item-list.js.map +1 -0
  206. package/engine/kit-field.d.ts +72 -0
  207. package/engine/kit-field.js +523 -0
  208. package/engine/kit-field.js.map +1 -0
  209. package/engine/schema-form.d.ts +91 -0
  210. package/engine/schema-form.js +320 -0
  211. package/engine/schema-form.js.map +1 -0
  212. package/engine/slot.d.ts +13 -0
  213. package/engine/slot.js +226 -0
  214. package/engine/slot.js.map +1 -0
  215. package/index.d.ts +46 -0
  216. package/index.js +55 -0
  217. package/index.js.map +1 -0
  218. package/kit.css +56 -0
  219. package/lib/cn.d.ts +4 -0
  220. package/lib/cn.js +53 -0
  221. package/lib/cn.js.map +1 -0
  222. package/lib/columns.d.ts +14 -0
  223. package/lib/columns.js +27 -0
  224. package/lib/columns.js.map +1 -0
  225. package/lib/frames.d.ts +36 -0
  226. package/lib/frames.js +214 -0
  227. package/lib/frames.js.map +1 -0
  228. package/lib/icons.d.ts +16 -0
  229. package/lib/icons.js +172 -0
  230. package/lib/icons.js.map +1 -0
  231. package/lib/path.d.ts +29 -0
  232. package/lib/path.js +64 -0
  233. package/lib/path.js.map +1 -0
  234. package/lib/schema.d.ts +49 -0
  235. package/lib/schema.js +287 -0
  236. package/lib/schema.js.map +1 -0
  237. package/lib/utils.d.ts +7 -0
  238. package/lib/utils.js +37 -0
  239. package/lib/utils.js.map +1 -0
  240. package/lib/validate.d.ts +20 -0
  241. package/lib/validate.js +150 -0
  242. package/lib/validate.js.map +1 -0
  243. package/package.json +31 -59
  244. package/schema/adapters.d.ts +28 -0
  245. package/schema/adapters.js +493 -0
  246. package/schema/adapters.js.map +1 -0
  247. package/schema/help.d.ts +25 -0
  248. package/schema/help.js +54 -0
  249. package/schema/help.js.map +1 -0
  250. package/schema/scale.d.ts +69 -0
  251. package/schema/scale.js +250 -0
  252. package/schema/scale.js.map +1 -0
  253. package/schema/sources.d.ts +103 -0
  254. package/schema/sources.js +65 -0
  255. package/schema/sources.js.map +1 -0
  256. package/schema/table.d.ts +319 -0
  257. package/schema/table.js +1198 -0
  258. package/schema/table.js.map +1 -0
  259. package/schema/types.d.ts +269 -0
  260. package/schema/types.js +14 -0
  261. package/schema/types.js.map +1 -0
  262. package/types.d.ts +17 -0
  263. package/ui/action-tray.d.ts +54 -0
  264. package/ui/action-tray.js +153 -0
  265. package/ui/action-tray.js.map +1 -0
  266. package/ui/button.d.ts +57 -0
  267. package/ui/button.js +202 -0
  268. package/ui/button.js.map +1 -0
  269. package/ui/choice-switch.d.ts +36 -0
  270. package/ui/choice-switch.js +57 -0
  271. package/ui/choice-switch.js.map +1 -0
  272. package/ui/controls.d.ts +83 -0
  273. package/ui/controls.js +319 -0
  274. package/ui/controls.js.map +1 -0
  275. package/ui/display.d.ts +156 -0
  276. package/ui/display.js +444 -0
  277. package/ui/display.js.map +1 -0
  278. package/ui/expanded-editor-modal.d.ts +26 -0
  279. package/ui/expanded-editor-modal.js +140 -0
  280. package/ui/expanded-editor-modal.js.map +1 -0
  281. package/ui/field-context.d.ts +12 -0
  282. package/ui/field-context.js +23 -0
  283. package/ui/field-context.js.map +1 -0
  284. package/ui/floating-panel.d.ts +152 -0
  285. package/ui/floating-panel.js +912 -0
  286. package/ui/floating-panel.js.map +1 -0
  287. package/ui/index.d.ts +12 -0
  288. package/ui/index.js +13 -0
  289. package/ui/input.d.ts +78 -0
  290. package/ui/input.js +250 -0
  291. package/ui/input.js.map +1 -0
  292. package/ui/mode-bar.d.ts +31 -0
  293. package/ui/mode-bar.js +65 -0
  294. package/ui/mode-bar.js.map +1 -0
  295. package/ui/overlay.d.ts +123 -0
  296. package/ui/overlay.js +378 -0
  297. package/ui/overlay.js.map +1 -0
  298. package/ui/path-crumbs.d.ts +90 -0
  299. package/ui/path-crumbs.js +532 -0
  300. package/ui/path-crumbs.js.map +1 -0
  301. package/ui/presence.d.ts +16 -0
  302. package/ui/presence.js +65 -0
  303. package/ui/presence.js.map +1 -0
  304. package/ui/select.d.ts +66 -0
  305. package/ui/select.js +405 -0
  306. package/ui/select.js.map +1 -0
  307. package/ui/shortcut-hint.d.ts +14 -0
  308. package/ui/shortcut-hint.js +35 -0
  309. package/ui/shortcut-hint.js.map +1 -0
  310. package/ui/surfaces.d.ts +23 -0
  311. package/ui/surfaces.js +26 -0
  312. package/ui/surfaces.js.map +1 -0
  313. package/ui/tooltip-root.d.ts +12 -0
  314. package/ui/tooltip-root.js +76 -0
  315. package/ui/tooltip-root.js.map +1 -0
  316. package/ui/variants.d.ts +15 -0
  317. package/ui/variants.js +14 -0
  318. package/ui/variants.js.map +1 -0
  319. package/LICENSE +0 -21
  320. package/README.md +0 -27
  321. package/dist/_chunks-cjs/_visual-editing.js +0 -5898
  322. package/dist/_chunks-cjs/refractor.js +0 -22
  323. package/dist/_chunks-es/_visual-editing.mjs +0 -5904
  324. package/dist/_chunks-es/refractor.mjs +0 -25
  325. package/dist/_color.d.mts +0 -119
  326. package/dist/_color.d.ts +0 -119
  327. package/dist/_color.js +0 -1412
  328. package/dist/_color.mjs +0 -1411
  329. package/dist/_visual-editing.d.mts +0 -1126
  330. package/dist/_visual-editing.d.ts +0 -1126
  331. package/dist/_visual-editing.js +0 -30
  332. package/dist/_visual-editing.mjs +0 -30
  333. package/dist/index.d.mts +0 -3140
  334. package/dist/index.d.ts +0 -3140
  335. package/dist/index.js +0 -2036
  336. package/dist/index.mjs +0 -2044
  337. package/dist/theme.d.mts +0 -1506
  338. package/dist/theme.d.ts +0 -1506
  339. package/dist/theme.js +0 -4126
  340. package/dist/theme.mjs +0 -4126
  341. package/exports/_visual-editing.ts +0 -31
  342. package/exports/index.ts +0 -1
  343. package/exports/theme.ts +0 -1
  344. package/src/color/index.d.mts +0 -119
  345. package/src/color/index.mjs +0 -1411
  346. package/src/core/__workshop__/constants.ts +0 -293
  347. package/src/core/_compat.ts +0 -264
  348. package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
  349. package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
  350. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
  351. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
  352. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
  353. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
  354. package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
  355. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
  356. package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
  357. package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
  358. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -39
  359. package/src/core/components/autocomplete/autocomplete.tsx +0 -767
  360. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -45
  361. package/src/core/components/autocomplete/autocompleteReducer.ts +0 -47
  362. package/src/core/components/autocomplete/constants.ts +0 -28
  363. package/src/core/components/autocomplete/index.ts +0 -2
  364. package/src/core/components/autocomplete/types.ts +0 -108
  365. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
  366. package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
  367. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -18
  368. package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +0 -51
  369. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -133
  370. package/src/core/components/breadcrumbs/index.ts +0 -1
  371. package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
  372. package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
  373. package/src/core/components/dialog/__workshop__/index.ts +0 -19
  374. package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
  375. package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
  376. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
  377. package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
  378. package/src/core/components/dialog/__workshop__/position.tsx +0 -30
  379. package/src/core/components/dialog/__workshop__/props.tsx +0 -75
  380. package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
  381. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
  382. package/src/core/components/dialog/dialog.tsx +0 -430
  383. package/src/core/components/dialog/dialogContext.ts +0 -20
  384. package/src/core/components/dialog/dialogProvider.tsx +0 -35
  385. package/src/core/components/dialog/index.ts +0 -4
  386. package/src/core/components/dialog/styles.ts +0 -77
  387. package/src/core/components/dialog/useDialog.ts +0 -11
  388. package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
  389. package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
  390. package/src/core/components/hotkeys/hotkeys.test.tsx +0 -42
  391. package/src/core/components/hotkeys/hotkeys.tsx +0 -66
  392. package/src/core/components/hotkeys/index.ts +0 -1
  393. package/src/core/components/index.ts +0 -9
  394. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
  395. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
  396. package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
  397. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
  398. package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
  399. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
  400. package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
  401. package/src/core/components/menu/__workshop__/groups.tsx +0 -156
  402. package/src/core/components/menu/__workshop__/index.ts +0 -89
  403. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
  404. package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -58
  405. package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
  406. package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
  407. package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
  408. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
  409. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  410. package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
  411. package/src/core/components/menu/helpers.ts +0 -82
  412. package/src/core/components/menu/index.ts +0 -5
  413. package/src/core/components/menu/menu.spacing.test.tsx +0 -63
  414. package/src/core/components/menu/menu.test.tsx +0 -125
  415. package/src/core/components/menu/menu.tsx +0 -178
  416. package/src/core/components/menu/menuButton.tsx +0 -268
  417. package/src/core/components/menu/menuContext.ts +0 -18
  418. package/src/core/components/menu/menuDivider.ts +0 -23
  419. package/src/core/components/menu/menuGroup.spacing.test.tsx +0 -63
  420. package/src/core/components/menu/menuGroup.tsx +0 -233
  421. package/src/core/components/menu/menuItem.spacing.test.tsx +0 -59
  422. package/src/core/components/menu/menuItem.tsx +0 -197
  423. package/src/core/components/menu/useMenu.ts +0 -21
  424. package/src/core/components/menu/useMenuController.ts +0 -231
  425. package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
  426. package/src/core/components/skeleton/__workshop__/index.ts +0 -11
  427. package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
  428. package/src/core/components/skeleton/index.ts +0 -2
  429. package/src/core/components/skeleton/skeleton.tsx +0 -57
  430. package/src/core/components/skeleton/styles.ts +0 -50
  431. package/src/core/components/skeleton/textSkeleton.tsx +0 -122
  432. package/src/core/components/tab/__workshop__/example.tsx +0 -79
  433. package/src/core/components/tab/__workshop__/index.ts +0 -14
  434. package/src/core/components/tab/index.ts +0 -3
  435. package/src/core/components/tab/tab.tsx +0 -101
  436. package/src/core/components/tab/tabList.test.tsx +0 -48
  437. package/src/core/components/tab/tabList.tsx +0 -70
  438. package/src/core/components/tab/tabPanel.tsx +0 -39
  439. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  440. package/src/core/components/toast/__workshop__/index.ts +0 -19
  441. package/src/core/components/toast/__workshop__/toast.tsx +0 -26
  442. package/src/core/components/toast/index.ts +0 -4
  443. package/src/core/components/toast/styles.ts +0 -77
  444. package/src/core/components/toast/toast.test.tsx +0 -101
  445. package/src/core/components/toast/toast.tsx +0 -198
  446. package/src/core/components/toast/toastContext.ts +0 -7
  447. package/src/core/components/toast/toastLayer.tsx +0 -51
  448. package/src/core/components/toast/toastProvider.tsx +0 -113
  449. package/src/core/components/toast/toastState.ts +0 -6
  450. package/src/core/components/toast/types.ts +0 -26
  451. package/src/core/components/toast/useToast.ts +0 -25
  452. package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
  453. package/src/core/components/tree/__workshop__/basic.tsx +0 -105
  454. package/src/core/components/tree/__workshop__/index.ts +0 -21
  455. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
  456. package/src/core/components/tree/helpers.ts +0 -105
  457. package/src/core/components/tree/index.ts +0 -4
  458. package/src/core/components/tree/style.ts +0 -105
  459. package/src/core/components/tree/tree.test.tsx +0 -55
  460. package/src/core/components/tree/tree.tsx +0 -240
  461. package/src/core/components/tree/treeContext.ts +0 -10
  462. package/src/core/components/tree/treeGroup.tsx +0 -28
  463. package/src/core/components/tree/treeItem.test.tsx +0 -65
  464. package/src/core/components/tree/treeItem.tsx +0 -224
  465. package/src/core/components/tree/types.ts +0 -25
  466. package/src/core/components/tree/useTree.ts +0 -17
  467. package/src/core/constants.ts +0 -79
  468. package/src/core/helpers/animation.ts +0 -27
  469. package/src/core/helpers/element.ts +0 -55
  470. package/src/core/helpers/focus.ts +0 -100
  471. package/src/core/helpers/index.ts +0 -4
  472. package/src/core/helpers/scroll.ts +0 -15
  473. package/src/core/hooks/index.ts +0 -12
  474. package/src/core/hooks/useArrayProp.ts +0 -17
  475. package/src/core/hooks/useClickOutside.test.tsx +0 -482
  476. package/src/core/hooks/useClickOutside.ts +0 -118
  477. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -115
  478. package/src/core/hooks/useClickOutsideEvent.ts +0 -73
  479. package/src/core/hooks/useCustomValidity.ts +0 -13
  480. package/src/core/hooks/useDelayed.test.ts +0 -88
  481. package/src/core/hooks/useDelayedState.ts +0 -36
  482. package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
  483. package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
  484. package/src/core/hooks/useElementRect/index.ts +0 -1
  485. package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
  486. package/src/core/hooks/useElementSize.ts +0 -19
  487. package/src/core/hooks/useForwardedRef.ts +0 -19
  488. package/src/core/hooks/useGlobalKeyDown.ts +0 -24
  489. package/src/core/hooks/useIsomorphicEffect.ts +0 -7
  490. package/src/core/hooks/useMatchMedia.ts +0 -28
  491. package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
  492. package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
  493. package/src/core/hooks/useMediaIndex/index.ts +0 -1
  494. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -36
  495. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -102
  496. package/src/core/hooks/useMounted.ts +0 -15
  497. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -56
  498. package/src/core/hooks/usePrefersDark.test.tsx +0 -19
  499. package/src/core/hooks/usePrefersDark.ts +0 -16
  500. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
  501. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -19
  502. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  503. package/src/core/index.ts +0 -10
  504. package/src/core/lib/createGlobalScopedContext.ts +0 -36
  505. package/src/core/lib/globalScope.ts +0 -19
  506. package/src/core/lib/isRecord.ts +0 -3
  507. package/src/core/middleware/origin.ts +0 -47
  508. package/src/core/observers/elementSizeObserver.ts +0 -116
  509. package/src/core/observers/index.ts +0 -2
  510. package/src/core/observers/resizeObserver.ts +0 -9
  511. package/src/core/primitives/_selectable/index.ts +0 -1
  512. package/src/core/primitives/_selectable/selectable.tsx +0 -15
  513. package/src/core/primitives/_selectable/style.ts +0 -115
  514. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
  515. package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
  516. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
  517. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
  518. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
  519. package/src/core/primitives/avatar/avatar.tsx +0 -200
  520. package/src/core/primitives/avatar/avatarCounter.tsx +0 -91
  521. package/src/core/primitives/avatar/avatarStack.tsx +0 -100
  522. package/src/core/primitives/avatar/index.ts +0 -4
  523. package/src/core/primitives/avatar/styles.ts +0 -167
  524. package/src/core/primitives/avatar/types.ts +0 -17
  525. package/src/core/primitives/badge/__workshop__/index.ts +0 -19
  526. package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
  527. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
  528. package/src/core/primitives/badge/badge.test.tsx +0 -16
  529. package/src/core/primitives/badge/badge.tsx +0 -70
  530. package/src/core/primitives/badge/index.ts +0 -1
  531. package/src/core/primitives/badge/styles.ts +0 -20
  532. package/src/core/primitives/badge/types.ts +0 -8
  533. package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
  534. package/src/core/primitives/box/__workshop__/index.ts +0 -24
  535. package/src/core/primitives/box/__workshop__/props.tsx +0 -20
  536. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
  537. package/src/core/primitives/box/box.test.tsx +0 -142
  538. package/src/core/primitives/box/box.tsx +0 -154
  539. package/src/core/primitives/box/index.ts +0 -1
  540. package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
  541. package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
  542. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
  543. package/src/core/primitives/button/__workshop__/index.ts +0 -59
  544. package/src/core/primitives/button/__workshop__/labelUploadButton.tsx +0 -36
  545. package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
  546. package/src/core/primitives/button/__workshop__/props.tsx +0 -55
  547. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
  548. package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
  549. package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
  550. package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
  551. package/src/core/primitives/button/button.test.tsx +0 -82
  552. package/src/core/primitives/button/button.tsx +0 -210
  553. package/src/core/primitives/button/index.ts +0 -1
  554. package/src/core/primitives/button/styles.ts +0 -117
  555. package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
  556. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
  557. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  558. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
  559. package/src/core/primitives/card/__workshop__/index.ts +0 -18
  560. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
  561. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
  562. package/src/core/primitives/card/__workshop__/props.tsx +0 -53
  563. package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
  564. package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
  565. package/src/core/primitives/card/card.tsx +0 -128
  566. package/src/core/primitives/card/index.ts +0 -2
  567. package/src/core/primitives/card/styles.ts +0 -147
  568. package/src/core/primitives/card/types.ts +0 -11
  569. package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
  570. package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
  571. package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
  572. package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
  573. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
  574. package/src/core/primitives/checkbox/checkbox.tsx +0 -73
  575. package/src/core/primitives/checkbox/index.ts +0 -1
  576. package/src/core/primitives/checkbox/styles.ts +0 -128
  577. package/src/core/primitives/code/__workshop__/index.ts +0 -19
  578. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
  579. package/src/core/primitives/code/__workshop__/props.tsx +0 -21
  580. package/src/core/primitives/code/code.tsx +0 -55
  581. package/src/core/primitives/code/index.ts +0 -1
  582. package/src/core/primitives/code/refractor.tsx +0 -20
  583. package/src/core/primitives/code/styles.ts +0 -77
  584. package/src/core/primitives/container/__workshop__/example.tsx +0 -20
  585. package/src/core/primitives/container/__workshop__/index.ts +0 -8
  586. package/src/core/primitives/container/container.tsx +0 -54
  587. package/src/core/primitives/container/index.ts +0 -2
  588. package/src/core/primitives/container/styles.ts +0 -23
  589. package/src/core/primitives/container/types.ts +0 -6
  590. package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
  591. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  592. package/src/core/primitives/flex/__workshop__/index.ts +0 -11
  593. package/src/core/primitives/flex/flex.tsx +0 -64
  594. package/src/core/primitives/flex/index.ts +0 -1
  595. package/src/core/primitives/grid/__workshop__/index.ts +0 -10
  596. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  597. package/src/core/primitives/grid/grid.test.tsx +0 -80
  598. package/src/core/primitives/grid/grid.tsx +0 -74
  599. package/src/core/primitives/grid/index.ts +0 -1
  600. package/src/core/primitives/heading/__workshop__/index.ts +0 -19
  601. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
  602. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
  603. package/src/core/primitives/heading/heading.tsx +0 -88
  604. package/src/core/primitives/heading/index.ts +0 -1
  605. package/src/core/primitives/heading/styles.ts +0 -64
  606. package/src/core/primitives/heading/types.ts +0 -7
  607. package/src/core/primitives/index.ts +0 -27
  608. package/src/core/primitives/inline/__workshop__/index.ts +0 -8
  609. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
  610. package/src/core/primitives/inline/index.ts +0 -1
  611. package/src/core/primitives/inline/inline.test.tsx +0 -51
  612. package/src/core/primitives/inline/inline.tsx +0 -63
  613. package/src/core/primitives/inline/styles.ts +0 -32
  614. package/src/core/primitives/inline/types.ts +0 -6
  615. package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
  616. package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
  617. package/src/core/primitives/kbd/index.ts +0 -1
  618. package/src/core/primitives/kbd/kbd.tsx +0 -69
  619. package/src/core/primitives/label/__workshop__/index.ts +0 -19
  620. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
  621. package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
  622. package/src/core/primitives/label/index.ts +0 -1
  623. package/src/core/primitives/label/label.tsx +0 -87
  624. package/src/core/primitives/label/styles.ts +0 -45
  625. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
  626. package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
  627. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
  628. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  629. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
  630. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
  631. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
  632. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
  633. package/src/core/primitives/popover/__workshop__/index.ts +0 -49
  634. package/src/core/primitives/popover/constants.ts +0 -22
  635. package/src/core/primitives/popover/floating-ui/size.ts +0 -99
  636. package/src/core/primitives/popover/helpers.ts +0 -31
  637. package/src/core/primitives/popover/index.ts +0 -2
  638. package/src/core/primitives/popover/popover.tsx +0 -511
  639. package/src/core/primitives/popover/popoverCard.tsx +0 -166
  640. package/src/core/primitives/popover/types.ts +0 -7
  641. package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
  642. package/src/core/primitives/radio/__workshop__/index.ts +0 -11
  643. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  644. package/src/core/primitives/radio/index.ts +0 -1
  645. package/src/core/primitives/radio/radio.tsx +0 -51
  646. package/src/core/primitives/radio/styles.ts +0 -117
  647. package/src/core/primitives/select/__workshop__/index.ts +0 -11
  648. package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
  649. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  650. package/src/core/primitives/select/index.ts +0 -1
  651. package/src/core/primitives/select/select.test.tsx +0 -52
  652. package/src/core/primitives/select/select.tsx +0 -94
  653. package/src/core/primitives/select/styles.ts +0 -166
  654. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
  655. package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
  656. package/src/core/primitives/spinner/index.ts +0 -1
  657. package/src/core/primitives/spinner/spinner.tsx +0 -46
  658. package/src/core/primitives/stack/__workshop__/index.ts +0 -14
  659. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
  660. package/src/core/primitives/stack/index.ts +0 -1
  661. package/src/core/primitives/stack/stack.test.tsx +0 -57
  662. package/src/core/primitives/stack/stack.tsx +0 -57
  663. package/src/core/primitives/stack/styles.ts +0 -32
  664. package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
  665. package/src/core/primitives/switch/__workshop__/index.ts +0 -11
  666. package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
  667. package/src/core/primitives/switch/index.ts +0 -1
  668. package/src/core/primitives/switch/styles.ts +0 -173
  669. package/src/core/primitives/switch/switch.tsx +0 -68
  670. package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
  671. package/src/core/primitives/text/__workshop__/example.tsx +0 -39
  672. package/src/core/primitives/text/__workshop__/index.ts +0 -24
  673. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
  674. package/src/core/primitives/text/index.ts +0 -1
  675. package/src/core/primitives/text/styles.ts +0 -74
  676. package/src/core/primitives/text/text.tsx +0 -89
  677. package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
  678. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
  679. package/src/core/primitives/textArea/index.ts +0 -1
  680. package/src/core/primitives/textArea/textArea.tsx +0 -120
  681. package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
  682. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
  683. package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
  684. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
  685. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
  686. package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
  687. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
  688. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
  689. package/src/core/primitives/textInput/index.ts +0 -1
  690. package/src/core/primitives/textInput/textInput.test.tsx +0 -48
  691. package/src/core/primitives/textInput/textInput.tsx +0 -395
  692. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
  693. package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
  694. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
  695. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
  696. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
  697. package/src/core/primitives/tooltip/constants.ts +0 -23
  698. package/src/core/primitives/tooltip/index.ts +0 -2
  699. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -452
  700. package/src/core/primitives/tooltip/tooltip.tsx +0 -495
  701. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -109
  702. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  703. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -11
  704. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
  705. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -10
  706. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
  707. package/src/core/primitives/types.ts +0 -179
  708. package/src/core/styles/border/borderStyle.ts +0 -56
  709. package/src/core/styles/border/index.ts +0 -2
  710. package/src/core/styles/border/types.ts +0 -10
  711. package/src/core/styles/box/boxStyle.ts +0 -69
  712. package/src/core/styles/box/index.ts +0 -2
  713. package/src/core/styles/box/types.ts +0 -11
  714. package/src/core/styles/card/_cardColorStyle.ts +0 -108
  715. package/src/core/styles/card/index.ts +0 -1
  716. package/src/core/styles/flex/flexItemStyle.ts +0 -27
  717. package/src/core/styles/flex/flexStyle.ts +0 -70
  718. package/src/core/styles/flex/index.ts +0 -3
  719. package/src/core/styles/flex/types.ts +0 -25
  720. package/src/core/styles/focusRing/index.ts +0 -25
  721. package/src/core/styles/font/codeFontStyle.ts +0 -13
  722. package/src/core/styles/font/headingFontStyle.ts +0 -13
  723. package/src/core/styles/font/index.ts +0 -6
  724. package/src/core/styles/font/labelFontStyle.ts +0 -13
  725. package/src/core/styles/font/responsiveFont.ts +0 -103
  726. package/src/core/styles/font/textAlignStyle.ts +0 -19
  727. package/src/core/styles/font/textFontStyle.ts +0 -13
  728. package/src/core/styles/font/types.ts +0 -35
  729. package/src/core/styles/grid/gridItemStyle.ts +0 -82
  730. package/src/core/styles/grid/gridStyle.ts +0 -108
  731. package/src/core/styles/grid/index.ts +0 -3
  732. package/src/core/styles/grid/types.ts +0 -37
  733. package/src/core/styles/helpers.ts +0 -72
  734. package/src/core/styles/index.ts +0 -5
  735. package/src/core/styles/input/index.ts +0 -2
  736. package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -78
  737. package/src/core/styles/input/textInputStyle.ts +0 -263
  738. package/src/core/styles/internal.ts +0 -12
  739. package/src/core/styles/margin/index.ts +0 -2
  740. package/src/core/styles/margin/marginStyle.ts +0 -21
  741. package/src/core/styles/margin/marginsStyle.test.ts +0 -33
  742. package/src/core/styles/margin/types.ts +0 -9
  743. package/src/core/styles/padding/index.ts +0 -2
  744. package/src/core/styles/padding/paddingStyle.test.ts +0 -33
  745. package/src/core/styles/padding/paddingStyle.ts +0 -21
  746. package/src/core/styles/padding/types.ts +0 -12
  747. package/src/core/styles/radius/index.ts +0 -2
  748. package/src/core/styles/radius/radiusStyle.ts +0 -23
  749. package/src/core/styles/radius/types.ts +0 -8
  750. package/src/core/styles/shadow/index.ts +0 -2
  751. package/src/core/styles/shadow/shadowStyle.ts +0 -29
  752. package/src/core/styles/shadow/types.ts +0 -6
  753. package/src/core/styles/types.ts +0 -8
  754. package/src/core/theme/__workshop__/build/Root.tsx +0 -367
  755. package/src/core/theme/__workshop__/build/helpers.ts +0 -46
  756. package/src/core/theme/__workshop__/build/story.tsx +0 -465
  757. package/src/core/theme/__workshop__/canvas.tsx +0 -352
  758. package/src/core/theme/__workshop__/color.tsx +0 -62
  759. package/src/core/theme/__workshop__/debug/story.tsx +0 -408
  760. package/src/core/theme/__workshop__/index.ts +0 -39
  761. package/src/core/theme/__workshop__/layer.tsx +0 -78
  762. package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
  763. package/src/core/theme/index.ts +0 -5
  764. package/src/core/theme/theme.test.tsx +0 -73
  765. package/src/core/theme/themeColorProvider.tsx +0 -29
  766. package/src/core/theme/themeContext.ts +0 -10
  767. package/src/core/theme/themeProvider.tsx +0 -62
  768. package/src/core/theme/types.ts +0 -12
  769. package/src/core/theme/useRootTheme.ts +0 -17
  770. package/src/core/theme/useTheme.ts +0 -16
  771. package/src/core/types/avatar.ts +0 -14
  772. package/src/core/types/badge.ts +0 -12
  773. package/src/core/types/box.ts +0 -19
  774. package/src/core/types/button.ts +0 -21
  775. package/src/core/types/card.ts +0 -6
  776. package/src/core/types/component.ts +0 -32
  777. package/src/core/types/dialog.ts +0 -4
  778. package/src/core/types/flex.ts +0 -30
  779. package/src/core/types/grid.ts +0 -14
  780. package/src/core/types/gridItem.ts +0 -29
  781. package/src/core/types/index.ts +0 -15
  782. package/src/core/types/placement.ts +0 -18
  783. package/src/core/types/popover.ts +0 -4
  784. package/src/core/types/radius.ts +0 -4
  785. package/src/core/types/selectable.ts +0 -6
  786. package/src/core/types/text.ts +0 -4
  787. package/src/core/utils/arrow/arrow.tsx +0 -123
  788. package/src/core/utils/arrow/cmds.ts +0 -91
  789. package/src/core/utils/arrow/index.ts +0 -1
  790. package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
  791. package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
  792. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -100
  793. package/src/core/utils/boundaryElement/boundaryElementContext.ts +0 -7
  794. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -24
  795. package/src/core/utils/boundaryElement/index.ts +0 -3
  796. package/src/core/utils/boundaryElement/types.ts +0 -7
  797. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -26
  798. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
  799. package/src/core/utils/conditionalWrapper/index.ts +0 -1
  800. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
  801. package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
  802. package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
  803. package/src/core/utils/elementQuery/helpers.ts +0 -27
  804. package/src/core/utils/elementQuery/index.ts +0 -1
  805. package/src/core/utils/errorBoundary.tsx +0 -48
  806. package/src/core/utils/getElementRef.ts +0 -26
  807. package/src/core/utils/index.ts +0 -9
  808. package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
  809. package/src/core/utils/layer/__workshop__/index.ts +0 -24
  810. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
  811. package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
  812. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
  813. package/src/core/utils/layer/getLayerContext.test.ts +0 -30
  814. package/src/core/utils/layer/getLayerContext.ts +0 -21
  815. package/src/core/utils/layer/index.ts +0 -4
  816. package/src/core/utils/layer/layer.test.tsx +0 -108
  817. package/src/core/utils/layer/layer.tsx +0 -98
  818. package/src/core/utils/layer/layerContext.ts +0 -7
  819. package/src/core/utils/layer/layerProvider.tsx +0 -111
  820. package/src/core/utils/layer/types.ts +0 -9
  821. package/src/core/utils/layer/useLayer.ts +0 -26
  822. package/src/core/utils/portal/__workshop__/index.ts +0 -14
  823. package/src/core/utils/portal/__workshop__/named.tsx +0 -63
  824. package/src/core/utils/portal/index.ts +0 -4
  825. package/src/core/utils/portal/portal.test.tsx +0 -103
  826. package/src/core/utils/portal/portal.ts +0 -32
  827. package/src/core/utils/portal/portalContext.ts +0 -31
  828. package/src/core/utils/portal/portalProvider.tsx +0 -47
  829. package/src/core/utils/portal/types.ts +0 -9
  830. package/src/core/utils/portal/usePortal.ts +0 -25
  831. package/src/core/utils/spanWithTextOverflow.tsx +0 -10
  832. package/src/core/utils/srOnly/index.ts +0 -1
  833. package/src/core/utils/srOnly/srOnly.tsx +0 -36
  834. package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
  835. package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
  836. package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
  837. package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
  838. package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
  839. package/src/core/utils/virtualList/index.ts +0 -1
  840. package/src/core/utils/virtualList/virtualList.tsx +0 -200
  841. package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
  842. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
  843. package/src/theme/build/_deprecated/color/button/createButtonModes.ts +0 -22
  844. package/src/theme/build/_deprecated/color/button/createButtonTones.ts +0 -55
  845. package/src/theme/build/_deprecated/color/card/createCardStates.ts +0 -60
  846. package/src/theme/build/_deprecated/color/color.test.ts +0 -63
  847. package/src/theme/build/_deprecated/color/defaults.ts +0 -390
  848. package/src/theme/build/_deprecated/color/factory.ts +0 -142
  849. package/src/theme/build/_deprecated/color/index.ts +0 -1
  850. package/src/theme/build/_deprecated/color/input/createInputModes.ts +0 -81
  851. package/src/theme/build/_deprecated/color/muted/createMuted.ts +0 -54
  852. package/src/theme/build/_deprecated/color/spot/createSpot.ts +0 -20
  853. package/src/theme/build/buildColorTheme.test.ts +0 -183
  854. package/src/theme/build/buildColorTheme.ts +0 -499
  855. package/src/theme/build/buildTheme.test.ts +0 -87
  856. package/src/theme/build/buildTheme.ts +0 -36
  857. package/src/theme/build/colorToken/colorToken.ts +0 -19
  858. package/src/theme/build/colorToken/compileColorToken.ts +0 -21
  859. package/src/theme/build/colorToken/index.ts +0 -2
  860. package/src/theme/build/colorToken/types.ts +0 -6
  861. package/src/theme/build/index.ts +0 -3
  862. package/src/theme/build/lib/color-fns/blend/index.ts +0 -3
  863. package/src/theme/build/lib/color-fns/blend/mix.ts +0 -21
  864. package/src/theme/build/lib/color-fns/blend/multiply.ts +0 -18
  865. package/src/theme/build/lib/color-fns/blend/screen.ts +0 -18
  866. package/src/theme/build/lib/color-fns/color-fns.test.ts +0 -68
  867. package/src/theme/build/lib/color-fns/contrastRatio.ts +0 -31
  868. package/src/theme/build/lib/color-fns/convert.ts +0 -150
  869. package/src/theme/build/lib/color-fns/index.ts +0 -6
  870. package/src/theme/build/lib/color-fns/parse.ts +0 -60
  871. package/src/theme/build/lib/color-fns/rgba.ts +0 -10
  872. package/src/theme/build/lib/color-fns/types.ts +0 -28
  873. package/src/theme/build/lib/isRecord.ts +0 -3
  874. package/src/theme/build/lib/lazy.ts +0 -30
  875. package/src/theme/build/lib/utils.ts +0 -19
  876. package/src/theme/build/merge.ts +0 -26
  877. package/src/theme/build/mixThemeColor.test.ts +0 -21
  878. package/src/theme/build/mixThemeColor.ts +0 -53
  879. package/src/theme/build/renderColorTheme.ts +0 -532
  880. package/src/theme/build/renderColorValue.ts +0 -85
  881. package/src/theme/build/resolveColorTokens.ts +0 -268
  882. package/src/theme/build/theme.test.ts +0 -27
  883. package/src/theme/config/helpers.ts +0 -55
  884. package/src/theme/config/index.ts +0 -4
  885. package/src/theme/config/system.ts +0 -115
  886. package/src/theme/config/tokens/color/index.ts +0 -1
  887. package/src/theme/config/tokens/color/types.ts +0 -133
  888. package/src/theme/config/tokens/index.ts +0 -4
  889. package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
  890. package/src/theme/config/tokens/parseTokenKey.ts +0 -67
  891. package/src/theme/config/tokens/parseTokenValue.test.ts +0 -42
  892. package/src/theme/config/tokens/parseTokenValue.ts +0 -133
  893. package/src/theme/config/tokens/types.ts +0 -53
  894. package/src/theme/config/types.ts +0 -46
  895. package/src/theme/defaults/colorPalette.ts +0 -5
  896. package/src/theme/defaults/colorTokens.ts +0 -648
  897. package/src/theme/defaults/config.ts +0 -84
  898. package/src/theme/defaults/fonts.ts +0 -227
  899. package/src/theme/getScopedTheme.ts +0 -98
  900. package/src/theme/index.ts +0 -5
  901. package/src/theme/system/avatar.ts +0 -14
  902. package/src/theme/system/color/_constants.ts +0 -45
  903. package/src/theme/system/color/_helpers.ts +0 -24
  904. package/src/theme/system/color/_system.ts +0 -40
  905. package/src/theme/system/color/avatar.ts +0 -15
  906. package/src/theme/system/color/badge.ts +0 -16
  907. package/src/theme/system/color/button.ts +0 -17
  908. package/src/theme/system/color/color.ts +0 -34
  909. package/src/theme/system/color/index.ts +0 -13
  910. package/src/theme/system/color/input.ts +0 -25
  911. package/src/theme/system/color/kbd.ts +0 -8
  912. package/src/theme/system/color/selectable.ts +0 -12
  913. package/src/theme/system/color/shadow.ts +0 -7
  914. package/src/theme/system/color/state.ts +0 -43
  915. package/src/theme/system/color/syntax.ts +0 -41
  916. package/src/theme/system/css.ts +0 -14
  917. package/src/theme/system/focusRing.ts +0 -7
  918. package/src/theme/system/font.ts +0 -52
  919. package/src/theme/system/index.ts +0 -11
  920. package/src/theme/system/input.ts +0 -33
  921. package/src/theme/system/layer.ts +0 -8
  922. package/src/theme/system/shadow.ts +0 -19
  923. package/src/theme/system/styles.ts +0 -13
  924. package/src/theme/system/theme.ts +0 -138
  925. package/src/theme/system/v0/avatar.ts +0 -10
  926. package/src/theme/system/v0/color/_generic.ts +0 -35
  927. package/src/theme/system/v0/color/_system.ts +0 -17
  928. package/src/theme/system/v0/color/base.ts +0 -21
  929. package/src/theme/system/v0/color/button.ts +0 -42
  930. package/src/theme/system/v0/color/card.ts +0 -19
  931. package/src/theme/system/v0/color/color.ts +0 -40
  932. package/src/theme/system/v0/color/index.ts +0 -11
  933. package/src/theme/system/v0/color/input.ts +0 -34
  934. package/src/theme/system/v0/color/muted.ts +0 -26
  935. package/src/theme/system/v0/color/selectable.ts +0 -31
  936. package/src/theme/system/v0/color/solid.ts +0 -26
  937. package/src/theme/system/v0/color/spot.ts +0 -13
  938. package/src/theme/system/v0/index.ts +0 -3
  939. package/src/theme/system/v0/input.ts +0 -23
  940. package/src/theme/versioning/getTheme_v2.ts +0 -57
  941. package/src/theme/versioning/index.ts +0 -5
  942. package/src/theme/versioning/is_v0.ts +0 -6
  943. package/src/theme/versioning/is_v2.ts +0 -6
  944. package/src/theme/versioning/themeColor_v0_v2.ts +0 -243
  945. package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
  946. package/src/theme/versioning/v0_v2.ts +0 -94
  947. package/src/theme/versioning/v2_v0.ts +0 -135
@@ -0,0 +1,1532 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { useKitServices } from "../../context.js";
3
+ import { Button, IconButton } from "../../ui/button.js";
4
+ import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
5
+ import { Input, Textarea } from "../../ui/input.js";
6
+ import { TableEditor } from "../table/table-editor.js";
7
+ import { SchemaForm } from "../../engine/schema-form.js";
8
+ import { CALLOUT_TONES, placeCaret } from "./dom.js";
9
+ import { FloatingPanel } from "../../ui/floating-panel.js";
10
+ import { LinkForm } from "./link-form.js";
11
+ import { ComponentCard } from "./component-card.js";
12
+ import * as React from "react";
13
+ import { IconAlertTriangle, IconAlt, IconArrowsHorizontal, IconArrowsMove, IconBulb, IconCheck, IconChevronDown, IconChevronRight, IconComponents, IconCopy, IconDimensions, IconDots, IconFileText, IconInfoCircle, IconLayoutAlignCenter, IconLayoutAlignLeft, IconLayoutAlignRight, IconLayoutSidebar, IconLayoutSidebarRight, IconLibraryPhoto, IconLink, IconPhoto, IconQuote, IconReplace, IconSettings, IconTrash, IconVideo, IconWorld, IconX } from "@tabler/icons-react";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ //#region src/kit/controls/rich-text/blocks.tsx
16
+ /**
17
+ * RICH TEXT · rich blocks ("islands", V2 HEAD controls/rich-text/blocks.tsx). Each renders through a portal into a
18
+ * contenteditable=false element inside the editor surface; its model lives on that element (`el.__rt`) so serialize()
19
+ * can write it back as static HTML.
20
+ *
21
+ * The image block is V2's: the toolbar (Replace · Align · Size S/M/L/Full · Link · Alt text · Remove) and the caption
22
+ * under it, each stored on production's image block (see dom.ts). The callout (tone · title · message), toggle, video,
23
+ * file and embedded component blocks are V2's too, limited to what their stored blocks keep: a callout's message and a
24
+ * toggle's body are plain text (production stores them as text), a component is a linked card (its fields are edited
25
+ * on the component itself).
26
+ *
27
+ * The table block is V2's TableBlock: the kit's table editor on the island's table value. The pull quote is V2's article
28
+ * block (article-blocks.tsx ArticleBlock + PullQuotePreview): drawn as the reader sees it, edited in the floating
29
+ * properties panel (4 settings → panel, CPO D54) through the kit SchemaForm. Key takeaways are V2's article block too,
30
+ * written in the text itself (article-blocks.tsx TakeawaysEditor, surface "inline"): a title line and a line per point.
31
+ */
32
+ function Island({ el, ctx }) {
33
+ const kind = el.getAttribute("data-rt-island");
34
+ const [model, setModel] = React.useState(() => el.__rt);
35
+ const [autoFocus] = React.useState(() => !!el.__rtFocus);
36
+ React.useEffect(() => {
37
+ el.__rtFocus = false;
38
+ }, [el]);
39
+ const set = React.useCallback((patch, label = "Edit block", record = true) => {
40
+ const prev = el.__rt;
41
+ const next = typeof patch === "function" ? patch(prev) : {
42
+ ...prev,
43
+ ...patch
44
+ };
45
+ if (record) ctx.record?.(el, prev, label, typeof patch !== "function");
46
+ el.__rt = next;
47
+ setModel(next);
48
+ ctx.emit();
49
+ }, [el, ctx]);
50
+ React.useEffect(() => {
51
+ el.__rtSet = (m) => {
52
+ el.__rt = m;
53
+ setModel(m);
54
+ ctx.emit();
55
+ };
56
+ return () => {
57
+ if (el.__rtSet) delete el.__rtSet;
58
+ };
59
+ }, [el, ctx]);
60
+ const onKeyDown = (e) => {
61
+ if (!e.currentTarget.contains(e.target)) return;
62
+ if (e.key === "Escape" && e.target.isContentEditable) {
63
+ e.preventDefault();
64
+ e.stopPropagation();
65
+ ctx.exit(el);
66
+ }
67
+ };
68
+ return /* @__PURE__ */ jsx("div", {
69
+ className: "relative select-text",
70
+ onKeyDown,
71
+ "data-island-kind": kind,
72
+ children: kind === "image" ? /* @__PURE__ */ jsx(ImageBlock, {
73
+ el,
74
+ ctx,
75
+ autoFocus,
76
+ m: model,
77
+ set
78
+ }) : kind === "table" ? /* @__PURE__ */ jsx(TableBlock, {
79
+ el,
80
+ ctx,
81
+ autoFocus,
82
+ m: model,
83
+ set
84
+ }) : kind === "pullquote" ? /* @__PURE__ */ jsx(PullQuoteBlock, {
85
+ el,
86
+ ctx,
87
+ autoFocus,
88
+ m: model,
89
+ set
90
+ }) : kind === "takeaways" ? /* @__PURE__ */ jsx(TakeawaysBlock, {
91
+ el,
92
+ ctx,
93
+ autoFocus,
94
+ m: model,
95
+ set
96
+ }) : kind === "callout" ? /* @__PURE__ */ jsx(CalloutBlock, {
97
+ el,
98
+ ctx,
99
+ autoFocus,
100
+ m: model,
101
+ set
102
+ }) : kind === "toggle" ? /* @__PURE__ */ jsx(ToggleBlock, {
103
+ el,
104
+ ctx,
105
+ autoFocus,
106
+ m: model,
107
+ set
108
+ }) : kind === "video" ? /* @__PURE__ */ jsx(VideoBlock, {
109
+ el,
110
+ ctx,
111
+ autoFocus,
112
+ m: model,
113
+ set
114
+ }) : kind === "file" ? /* @__PURE__ */ jsx(FileBlock, {
115
+ el,
116
+ ctx,
117
+ autoFocus,
118
+ m: model,
119
+ set
120
+ }) : kind === "component" ? /* @__PURE__ */ jsx(ComponentBlock, {
121
+ el,
122
+ ctx,
123
+ autoFocus,
124
+ m: model,
125
+ set
126
+ }) : null
127
+ });
128
+ }
129
+ var Sep = () => /* @__PURE__ */ jsx("span", {
130
+ "aria-hidden": true,
131
+ className: "mx-0.5 h-4 w-px shrink-0 bg-kit-line"
132
+ });
133
+ /** An address an image can be shown from: http(s) or a site path. */
134
+ var imageUrlOk = (u) => /^(https?:)?\/\/[^\s]+$/i.test(u) || /^\/(?!\/)\S*$/.test(u);
135
+ function PlainEditable({ value, onChange, label, placeholder, readOnly, autoFocus, multiline, onEnter, onBackspaceEmpty, className }) {
136
+ const ref = React.useRef(null);
137
+ React.useLayoutEffect(() => {
138
+ const el = ref.current;
139
+ if (!el || document.activeElement === el) return;
140
+ if (el.textContent !== value) el.textContent = value;
141
+ }, [value]);
142
+ React.useEffect(() => {
143
+ if (!autoFocus || !ref.current || readOnly) return;
144
+ ref.current.focus({ preventScroll: false });
145
+ placeCaret(ref.current);
146
+ }, []);
147
+ return /* @__PURE__ */ jsx("div", {
148
+ ref,
149
+ role: "textbox",
150
+ "aria-label": label,
151
+ "aria-multiline": multiline || void 0,
152
+ "aria-readonly": readOnly || void 0,
153
+ tabIndex: readOnly ? -1 : 0,
154
+ contentEditable: readOnly ? false : "plaintext-only",
155
+ suppressContentEditableWarning: true,
156
+ spellCheck: true,
157
+ "data-placeholder": placeholder,
158
+ onInput: (e) => onChange((e.currentTarget.textContent ?? "").replace(/\u200b/g, "")),
159
+ onPaste: (e) => {
160
+ e.preventDefault();
161
+ const t = e.clipboardData.getData("text/plain");
162
+ document.execCommand("insertText", false, multiline ? t : t.replace(/\s*\n\s*/g, " "));
163
+ },
164
+ onKeyDown: (e) => {
165
+ if (e.key === "Backspace" && onBackspaceEmpty && !(e.currentTarget.textContent ?? "").replace(/\u200b/g, "")) {
166
+ e.preventDefault();
167
+ onBackspaceEmpty();
168
+ return;
169
+ }
170
+ if (e.key !== "Enter") return;
171
+ if (multiline && !(e.metaKey || e.ctrlKey)) return;
172
+ e.preventDefault();
173
+ onEnter?.();
174
+ },
175
+ className: cn("min-w-0 cursor-text whitespace-pre-wrap break-words outline-none empty:before:pointer-events-none empty:before:text-kit-fg-4 empty:before:content-[attr(data-placeholder)]", className)
176
+ });
177
+ }
178
+ var RemoveBtn = ({ onClick, label }) => /* @__PURE__ */ jsx(IconButton, {
179
+ size: "xs",
180
+ label,
181
+ onClick,
182
+ className: "hover:text-kit-danger-fg",
183
+ children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
184
+ });
185
+ /** Production's image layout (lib/richtext/imageLayout.ts): a size sets the column share; with none, the alignment does. */
186
+ var SIZES = [
187
+ {
188
+ v: "s",
189
+ label: "S",
190
+ w: "33%"
191
+ },
192
+ {
193
+ v: "m",
194
+ label: "M",
195
+ w: "50%"
196
+ },
197
+ {
198
+ v: "l",
199
+ label: "L",
200
+ w: "75%"
201
+ },
202
+ {
203
+ v: "full",
204
+ label: "Full",
205
+ w: "100%"
206
+ }
207
+ ];
208
+ var ALIGN_WIDTH = {
209
+ full: "100%",
210
+ center: "78%",
211
+ left: "62%",
212
+ right: "62%"
213
+ };
214
+ var ALIGNS = [
215
+ {
216
+ v: "full",
217
+ label: "Full width",
218
+ icon: /* @__PURE__ */ jsx(IconArrowsHorizontal, { stroke: 1.5 })
219
+ },
220
+ {
221
+ v: "center",
222
+ label: "Center",
223
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignCenter, { stroke: 1.5 })
224
+ },
225
+ {
226
+ v: "left",
227
+ label: "Left",
228
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignLeft, { stroke: 1.5 })
229
+ },
230
+ {
231
+ v: "right",
232
+ label: "Right",
233
+ icon: /* @__PURE__ */ jsx(IconLayoutAlignRight, { stroke: 1.5 })
234
+ }
235
+ ];
236
+ function ImageBlock({ m, set, el, ctx }) {
237
+ const { MediaPicker } = useKitServices();
238
+ const [picker, setPicker] = React.useState(false);
239
+ const [urlMode, setUrlMode] = React.useState(false);
240
+ const [url, setUrl] = React.useState("");
241
+ const [busy, setBusy] = React.useState(false);
242
+ const [linkOpen, setLinkOpen] = React.useState(false);
243
+ const ro = ctx.readOnly;
244
+ const pickerEl = MediaPicker ? /* @__PURE__ */ jsx(MediaPicker, {
245
+ open: picker,
246
+ onOpenChange: setPicker,
247
+ accept: ["image", "svg"],
248
+ onPick: (a) => a[0] && set({
249
+ src: a[0].url,
250
+ alt: a[0].alt || m.alt || ""
251
+ }, "Replace image")
252
+ }) : null;
253
+ if (!m.src) return /* @__PURE__ */ jsxs("div", {
254
+ className: "group/blk rounded-kit-lg border border-dashed border-kit-line-strong bg-kit-subtle px-4 py-4",
255
+ children: [
256
+ /* @__PURE__ */ jsxs("div", {
257
+ className: "flex items-start gap-3",
258
+ children: [
259
+ /* @__PURE__ */ jsx("span", {
260
+ className: "flex size-8 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-2",
261
+ children: /* @__PURE__ */ jsx(IconPhoto, {
262
+ className: "size-4",
263
+ stroke: 1.5,
264
+ "aria-hidden": true
265
+ })
266
+ }),
267
+ /* @__PURE__ */ jsxs("div", {
268
+ className: "min-w-0 flex-1",
269
+ children: [/* @__PURE__ */ jsx("div", {
270
+ className: "text-kit-sm font-medium text-kit-fg",
271
+ children: "Add an image"
272
+ }), /* @__PURE__ */ jsx("p", {
273
+ className: "text-kit-xs text-kit-fg-3",
274
+ children: MediaPicker ? "Pick one from the media library or paste a link." : "Paste a link to the image."
275
+ })]
276
+ }),
277
+ ro ? null : /* @__PURE__ */ jsx(Tooltip, {
278
+ content: "Remove image",
279
+ children: /* @__PURE__ */ jsx("button", {
280
+ type: "button",
281
+ "aria-label": "Remove image",
282
+ onClick: () => ctx.remove(el),
283
+ className: "flex size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-danger-fg",
284
+ children: /* @__PURE__ */ jsx(IconTrash, {
285
+ className: "size-3.5",
286
+ stroke: 1.5,
287
+ "aria-hidden": true
288
+ })
289
+ })
290
+ })
291
+ ]
292
+ }),
293
+ ro ? null : urlMode || !MediaPicker ? /* @__PURE__ */ jsxs("form", {
294
+ className: "mt-3 flex items-center gap-2",
295
+ onSubmit: (e) => {
296
+ e.preventDefault();
297
+ const u = url.trim();
298
+ if (!imageUrlOk(u)) return ctx.notify("Paste a full image link that starts with https://", "Or a path on this site, like /images/hero.jpg.");
299
+ set({
300
+ src: u,
301
+ alt: m.alt ?? ""
302
+ }, "Add image");
303
+ ctx.exit(el);
304
+ },
305
+ children: [
306
+ /* @__PURE__ */ jsx(Input, {
307
+ autoFocus: true,
308
+ size: "sm",
309
+ value: url,
310
+ onChange: (e) => setUrl(e.target.value),
311
+ placeholder: "https://…",
312
+ "aria-label": "Image URL",
313
+ leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
314
+ className: "flex-1"
315
+ }),
316
+ /* @__PURE__ */ jsx(Button, {
317
+ size: "sm",
318
+ variant: "primary",
319
+ type: "submit",
320
+ disabled: !url.trim(),
321
+ children: "Add"
322
+ }),
323
+ MediaPicker ? /* @__PURE__ */ jsx(Button, {
324
+ size: "sm",
325
+ variant: "ghost",
326
+ onClick: () => setUrlMode(false),
327
+ children: "Cancel"
328
+ }) : null
329
+ ]
330
+ }) : /* @__PURE__ */ jsxs("div", {
331
+ className: "mt-3 flex flex-wrap gap-2",
332
+ children: [/* @__PURE__ */ jsx(Button, {
333
+ size: "sm",
334
+ leftIcon: /* @__PURE__ */ jsx(IconLibraryPhoto, { stroke: 1.5 }),
335
+ onClick: () => setPicker(true),
336
+ children: "Media library"
337
+ }), /* @__PURE__ */ jsx(Button, {
338
+ size: "sm",
339
+ variant: "ghost",
340
+ leftIcon: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
341
+ onClick: () => setUrlMode(true),
342
+ children: "Paste URL"
343
+ })]
344
+ }),
345
+ pickerEl
346
+ ]
347
+ });
348
+ const align = m.align ?? "full";
349
+ const size = m.size;
350
+ const width = size ? SIZES.find((x) => x.v === size)?.w ?? "100%" : ALIGN_WIDTH[align];
351
+ const justify = align === "left" ? "justify-start" : align === "right" ? "justify-end" : "justify-center";
352
+ const alignItem = ALIGNS.find((a) => a.v === align);
353
+ const toolBtn = "flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5";
354
+ return /* @__PURE__ */ jsxs("figure", {
355
+ className: "group/blk relative m-0",
356
+ children: [
357
+ ro ? null : /* @__PURE__ */ jsxs("div", {
358
+ role: "toolbar",
359
+ "aria-label": "Image tools",
360
+ "data-kit-scope": "",
361
+ className: cn("absolute left-1/2 top-2 z-[3] flex h-8 max-w-[calc(100%-16px)] -translate-x-1/2 items-center gap-0.5 overflow-x-auto rounded-kit-lg border border-kit-line bg-kit-surface px-1 opacity-0 shadow-kit-sm transition-opacity duration-150 motion-reduce:transition-none", "group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100", busy && "opacity-100"),
362
+ children: [
363
+ MediaPicker ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
364
+ content: "Replace image",
365
+ children: /* @__PURE__ */ jsxs("button", {
366
+ type: "button",
367
+ "aria-label": "Replace image",
368
+ className: toolBtn,
369
+ onClick: () => setPicker(true),
370
+ children: [/* @__PURE__ */ jsx(IconReplace, {
371
+ stroke: 1.5,
372
+ "aria-hidden": true
373
+ }), ctx.dense ? null : "Replace"]
374
+ })
375
+ }), /* @__PURE__ */ jsx(Sep, {})] }) : null,
376
+ /* @__PURE__ */ jsxs(Menu, {
377
+ onOpenChange: setBusy,
378
+ children: [/* @__PURE__ */ jsx(MenuTrigger, { render: /* @__PURE__ */ jsxs("button", {
379
+ type: "button",
380
+ "aria-label": `Align: ${alignItem.label}`,
381
+ className: toolBtn,
382
+ children: [alignItem.icon, /* @__PURE__ */ jsx(IconChevronDown, {
383
+ className: "!size-3 text-kit-fg-3",
384
+ stroke: 1.5,
385
+ "aria-hidden": true
386
+ })]
387
+ }) }), /* @__PURE__ */ jsx(MenuContent, {
388
+ className: "w-40",
389
+ children: ALIGNS.map((a) => /* @__PURE__ */ jsx(MenuItem, {
390
+ icon: a.icon,
391
+ onClick: () => set({
392
+ align: a.v,
393
+ ...a.v === "full" ? { size: "full" } : size === "full" || !size ? { size: "l" } : {}
394
+ }, "Align image"),
395
+ children: /* @__PURE__ */ jsxs("span", {
396
+ className: "flex w-full items-center justify-between",
397
+ children: [a.label, align === a.v ? /* @__PURE__ */ jsx(IconCheck, {
398
+ className: "size-3.5 text-kit-fg-2",
399
+ stroke: 2,
400
+ "aria-hidden": true
401
+ }) : null]
402
+ })
403
+ }, a.v))
404
+ })]
405
+ }),
406
+ /* @__PURE__ */ jsx("div", {
407
+ role: "group",
408
+ "aria-label": "Size",
409
+ className: "flex items-center",
410
+ children: SIZES.map((x) => {
411
+ const on = (size ?? (align === "full" ? "full" : null)) === x.v;
412
+ return /* @__PURE__ */ jsx("button", {
413
+ type: "button",
414
+ "aria-pressed": on,
415
+ "aria-label": `Size ${x.label}`,
416
+ onClick: () => set({
417
+ size: x.v,
418
+ ...x.v === "full" ? { align: "full" } : align === "full" ? { align: "center" } : {}
419
+ }, "Resize image"),
420
+ className: cn("h-7 min-w-6 rounded-kit-md px-1 text-kit-xs text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg", on && "bg-kit-selected font-medium text-kit-fg"),
421
+ children: x.label
422
+ }, x.v);
423
+ })
424
+ }),
425
+ /* @__PURE__ */ jsx(Sep, {}),
426
+ /* @__PURE__ */ jsxs(Popover, {
427
+ open: linkOpen,
428
+ onOpenChange: (o) => {
429
+ setLinkOpen(o);
430
+ setBusy(o);
431
+ },
432
+ children: [/* @__PURE__ */ jsx(Tooltip, {
433
+ content: m.href ? `Links to ${m.href}` : "Link the image",
434
+ children: /* @__PURE__ */ jsx(PopoverTrigger, {
435
+ "aria-label": "Link the image",
436
+ className: cn(toolBtn, m.href && "text-kit-accent-fg"),
437
+ children: /* @__PURE__ */ jsx(IconLink, {
438
+ stroke: 1.5,
439
+ "aria-hidden": true
440
+ })
441
+ })
442
+ }), /* @__PURE__ */ jsxs(PopoverContent, {
443
+ className: "w-[340px] p-3",
444
+ finalFocus: false,
445
+ children: [/* @__PURE__ */ jsx("p", {
446
+ className: "mb-2 text-kit-xs font-medium text-kit-fg-2",
447
+ children: "Link the image to"
448
+ }), /* @__PURE__ */ jsx(LinkForm, {
449
+ initial: { href: m.href ?? "" },
450
+ allowNewTab: false,
451
+ onSave: (v) => {
452
+ set({ href: v.href }, "Link image");
453
+ setLinkOpen(false);
454
+ setBusy(false);
455
+ },
456
+ onCancel: () => {
457
+ setLinkOpen(false);
458
+ setBusy(false);
459
+ },
460
+ onDetach: m.href ? () => {
461
+ set((x) => {
462
+ const { href: _gone, ...rest } = x;
463
+ return rest;
464
+ }, "Unlink image");
465
+ setLinkOpen(false);
466
+ setBusy(false);
467
+ } : void 0
468
+ })]
469
+ })]
470
+ }),
471
+ /* @__PURE__ */ jsx(AltPopover, {
472
+ alt: m.alt ?? "",
473
+ onSave: (alt) => set({ alt }, "Edit alt text"),
474
+ onOpen: setBusy,
475
+ btnClass: toolBtn
476
+ }),
477
+ /* @__PURE__ */ jsx(Sep, {}),
478
+ /* @__PURE__ */ jsx(Tooltip, {
479
+ content: "Remove image",
480
+ children: /* @__PURE__ */ jsx("button", {
481
+ type: "button",
482
+ "aria-label": "Remove image",
483
+ className: cn(toolBtn, "hover:text-kit-danger-fg"),
484
+ onClick: () => ctx.remove(el),
485
+ children: /* @__PURE__ */ jsx(IconTrash, {
486
+ stroke: 1.5,
487
+ "aria-hidden": true
488
+ })
489
+ })
490
+ })
491
+ ]
492
+ }),
493
+ /* @__PURE__ */ jsx("div", {
494
+ className: cn("flex", justify),
495
+ children: /* @__PURE__ */ jsx("img", {
496
+ src: m.src,
497
+ alt: m.alt ?? "",
498
+ style: { width },
499
+ className: "block h-auto max-w-full rounded-kit-lg border border-kit-line",
500
+ draggable: false
501
+ })
502
+ }),
503
+ ro && !m.caption ? null : /* @__PURE__ */ jsx(PlainEditable, {
504
+ value: m.caption ?? "",
505
+ label: "Image caption",
506
+ readOnly: ro,
507
+ placeholder: ro ? "" : "Add a caption…",
508
+ onChange: (caption) => set({ caption }, "Edit caption"),
509
+ onEnter: () => ctx.exit(el),
510
+ className: "mt-1.5 text-center text-kit-sm text-kit-fg-3"
511
+ }),
512
+ pickerEl
513
+ ]
514
+ });
515
+ }
516
+ function AltPopover({ alt, onSave, onOpen, btnClass }) {
517
+ const [open, setOpen] = React.useState(false);
518
+ const [v, setV] = React.useState(alt);
519
+ const id = React.useId();
520
+ return /* @__PURE__ */ jsxs(Popover, {
521
+ open,
522
+ onOpenChange: (o) => {
523
+ setOpen(o);
524
+ onOpen(o);
525
+ if (o) setV(alt);
526
+ },
527
+ children: [/* @__PURE__ */ jsx(Tooltip, {
528
+ content: alt ? "Alt text" : "Add alt text",
529
+ children: /* @__PURE__ */ jsx(PopoverTrigger, {
530
+ "aria-label": "Alt text",
531
+ className: cn(btnClass, !alt && "text-kit-warning-fg"),
532
+ children: /* @__PURE__ */ jsx(IconAlt, {
533
+ stroke: 1.5,
534
+ "aria-hidden": true
535
+ })
536
+ })
537
+ }), /* @__PURE__ */ jsx(PopoverContent, {
538
+ className: "w-72",
539
+ finalFocus: false,
540
+ children: /* @__PURE__ */ jsxs("form", {
541
+ onSubmit: (e) => {
542
+ e.preventDefault();
543
+ onSave(v.trim());
544
+ setOpen(false);
545
+ onOpen(false);
546
+ },
547
+ className: "flex flex-col gap-2",
548
+ children: [
549
+ /* @__PURE__ */ jsx("label", {
550
+ className: "text-kit-xs font-medium text-kit-fg-2",
551
+ htmlFor: id,
552
+ children: "Alt text"
553
+ }),
554
+ /* @__PURE__ */ jsx(Textarea, {
555
+ id,
556
+ autoFocus: true,
557
+ value: v,
558
+ onChange: (e) => setV(e.target.value),
559
+ placeholder: "Describe the image",
560
+ rows: 2
561
+ }),
562
+ /* @__PURE__ */ jsx("p", {
563
+ className: "text-kit-2xs text-kit-fg-3",
564
+ children: "Read aloud by screen readers and used by search engines."
565
+ }),
566
+ /* @__PURE__ */ jsx("div", {
567
+ className: "flex justify-end",
568
+ children: /* @__PURE__ */ jsx(Button, {
569
+ size: "xs",
570
+ variant: "primary",
571
+ type: "submit",
572
+ children: "Done"
573
+ })
574
+ })
575
+ ]
576
+ })
577
+ })]
578
+ });
579
+ }
580
+ var TONES = {
581
+ info: {
582
+ label: "Info",
583
+ icon: /* @__PURE__ */ jsx(IconInfoCircle, { stroke: 1.5 }),
584
+ box: "border-kit-info-line bg-kit-info-soft",
585
+ chip: "text-kit-info-fg"
586
+ },
587
+ tip: {
588
+ label: "Tip",
589
+ icon: /* @__PURE__ */ jsx(IconBulb, { stroke: 1.5 }),
590
+ box: "border-kit-success-line bg-kit-success-soft",
591
+ chip: "text-kit-success-fg"
592
+ },
593
+ warning: {
594
+ label: "Warning",
595
+ icon: /* @__PURE__ */ jsx(IconAlertTriangle, { stroke: 1.5 }),
596
+ box: "border-kit-warning-line bg-kit-warning-soft",
597
+ chip: "text-kit-warning-fg"
598
+ }
599
+ };
600
+ function CalloutBlock({ m, set, el, ctx, autoFocus }) {
601
+ const tone = CALLOUT_TONES.includes(m.tone ?? "") ? m.tone : "info";
602
+ const t = TONES[tone];
603
+ const body = React.useRef(null);
604
+ const ro = ctx.readOnly;
605
+ return /* @__PURE__ */ jsxs("div", {
606
+ className: cn("group/blk relative rounded-kit-lg border px-3.5 py-3", t.box),
607
+ "data-rt-isolate": "",
608
+ children: [
609
+ /* @__PURE__ */ jsxs("div", {
610
+ className: "flex items-center gap-1",
611
+ children: [
612
+ /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
613
+ disabled: ro,
614
+ render: /* @__PURE__ */ jsxs("button", {
615
+ type: "button",
616
+ "aria-label": `Callout tone: ${t.label}`,
617
+ className: cn("-ml-1 flex h-6 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs font-medium hover:bg-kit-hover data-[popup-open]:bg-kit-hover [&_svg]:size-3.5", t.chip),
618
+ children: [
619
+ t.icon,
620
+ t.label,
621
+ ro ? null : /* @__PURE__ */ jsx(IconChevronDown, {
622
+ className: "!size-3 opacity-70",
623
+ stroke: 1.5,
624
+ "aria-hidden": true
625
+ })
626
+ ]
627
+ })
628
+ }), /* @__PURE__ */ jsx(MenuContent, {
629
+ className: "w-36",
630
+ children: CALLOUT_TONES.map((k) => /* @__PURE__ */ jsx(MenuItem, {
631
+ icon: TONES[k].icon,
632
+ onClick: () => set({ tone: k }, "Change callout tone"),
633
+ children: /* @__PURE__ */ jsxs("span", {
634
+ className: "flex w-full items-center justify-between",
635
+ children: [TONES[k].label, tone === k ? /* @__PURE__ */ jsx(IconCheck, {
636
+ className: "size-3.5 text-kit-fg-2",
637
+ stroke: 2,
638
+ "aria-hidden": true
639
+ }) : null]
640
+ })
641
+ }, k))
642
+ })] }),
643
+ /* @__PURE__ */ jsx("span", { className: "flex-1" }),
644
+ ro ? null : /* @__PURE__ */ jsx("div", {
645
+ className: "opacity-0 transition-opacity motion-reduce:transition-none group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
646
+ children: /* @__PURE__ */ jsx(RemoveBtn, {
647
+ onClick: () => ctx.remove(el),
648
+ label: "Remove callout"
649
+ })
650
+ })
651
+ ]
652
+ }),
653
+ /* @__PURE__ */ jsx(PlainEditable, {
654
+ value: m.title ?? "",
655
+ label: "Callout title",
656
+ readOnly: ro,
657
+ autoFocus,
658
+ placeholder: "Title",
659
+ onChange: (title) => set({ title }, "Edit callout title"),
660
+ onEnter: () => {
661
+ const b = body.current?.querySelector("[role=textbox]");
662
+ b?.focus();
663
+ if (b) placeCaret(b, false);
664
+ },
665
+ className: "mt-1 font-medium text-kit-fg"
666
+ }),
667
+ /* @__PURE__ */ jsx("div", {
668
+ ref: body,
669
+ children: /* @__PURE__ */ jsx(PlainEditable, {
670
+ multiline: true,
671
+ value: m.body ?? "",
672
+ label: "Callout message",
673
+ readOnly: ro,
674
+ placeholder: "Write a message…",
675
+ onChange: (b) => set({ body: b }, "Edit callout message"),
676
+ className: "mt-0.5 text-kit-fg-2"
677
+ })
678
+ })
679
+ ]
680
+ });
681
+ }
682
+ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
683
+ const [open, setOpen] = React.useState(!!autoFocus);
684
+ const body = React.useRef(null);
685
+ const bodyId = React.useId();
686
+ const ro = ctx.readOnly;
687
+ return /* @__PURE__ */ jsxs("div", {
688
+ className: "group/blk relative rounded-kit-md",
689
+ "data-rt-isolate": "",
690
+ children: [/* @__PURE__ */ jsxs("div", {
691
+ className: "flex items-start gap-1",
692
+ children: [
693
+ /* @__PURE__ */ jsx("button", {
694
+ type: "button",
695
+ "aria-expanded": open,
696
+ "aria-controls": bodyId,
697
+ "aria-label": open ? "Collapse toggle" : "Expand toggle",
698
+ onClick: () => setOpen((o) => !o),
699
+ className: "mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg",
700
+ children: /* @__PURE__ */ jsx(IconChevronRight, {
701
+ className: cn("size-4 transition-transform duration-150 motion-reduce:transition-none", open && "rotate-90"),
702
+ stroke: 1.5,
703
+ "aria-hidden": true
704
+ })
705
+ }),
706
+ /* @__PURE__ */ jsx(PlainEditable, {
707
+ value: m.title ?? "",
708
+ label: "Toggle title",
709
+ readOnly: ro,
710
+ autoFocus,
711
+ placeholder: "Toggle title",
712
+ onChange: (title) => set({ title }, "Edit toggle title"),
713
+ onEnter: () => {
714
+ setOpen(true);
715
+ requestAnimationFrame(() => {
716
+ const b = body.current?.querySelector("[role=textbox]");
717
+ b?.focus();
718
+ if (b) placeCaret(b, false);
719
+ });
720
+ },
721
+ className: "flex-1 py-0.5 font-medium text-kit-fg"
722
+ }),
723
+ ro ? null : /* @__PURE__ */ jsx("div", {
724
+ className: "opacity-0 transition-opacity motion-reduce:transition-none group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
725
+ children: /* @__PURE__ */ jsx(RemoveBtn, {
726
+ onClick: () => ctx.remove(el),
727
+ label: "Remove toggle"
728
+ })
729
+ })
730
+ ]
731
+ }), /* @__PURE__ */ jsx("div", {
732
+ ref: body,
733
+ id: bodyId,
734
+ hidden: !open,
735
+ className: "ml-3 mt-1 border-l border-kit-line pl-4",
736
+ children: /* @__PURE__ */ jsx(PlainEditable, {
737
+ multiline: true,
738
+ value: m.body ?? "",
739
+ label: "Toggle body",
740
+ readOnly: ro,
741
+ placeholder: "Hidden content. Click to write…",
742
+ onChange: (b) => set({ body: b }, "Edit toggle body"),
743
+ className: "py-0.5 text-kit-fg-2"
744
+ })
745
+ })]
746
+ });
747
+ }
748
+ var videoUrlOk = (u) => /^https?:\/\/\S+$/i.test(u) || /^\/(?!\/)\S*$/.test(u);
749
+ function videoEmbedSrc(url) {
750
+ const yt = /(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{6,})/i.exec(url);
751
+ if (yt) return `https://www.youtube-nocookie.com/embed/${yt[1]}`;
752
+ const vimeo = /vimeo\.com\/(?:video\/)?(\d+)/i.exec(url);
753
+ if (vimeo) return `https://player.vimeo.com/video/${vimeo[1]}`;
754
+ return null;
755
+ }
756
+ function VideoBlock({ m, set, el, ctx, autoFocus }) {
757
+ const [draft, setDraft] = React.useState(m.url ?? "");
758
+ React.useEffect(() => setDraft(m.url ?? ""), [m.url]);
759
+ const [error, setError] = React.useState(null);
760
+ const errId = React.useId();
761
+ const commit = () => {
762
+ const u = draft.trim();
763
+ if (u === (m.url ?? "")) return setError(null);
764
+ if (u && !videoUrlOk(u)) return setError("Paste a full link that starts with https://, or a path on this site.");
765
+ setError(null);
766
+ set({ url: u }, "Set video link");
767
+ };
768
+ const ro = ctx.readOnly;
769
+ const frame = m.url ? videoEmbedSrc(m.url) : null;
770
+ return /* @__PURE__ */ jsxs("div", {
771
+ className: "group/blk rounded-kit-lg border border-kit-line bg-kit-subtle p-2.5",
772
+ "data-rt-isolate": "",
773
+ children: [
774
+ ro ? null : /* @__PURE__ */ jsxs("div", {
775
+ className: "mb-2 flex items-center gap-1.5",
776
+ children: [/* @__PURE__ */ jsx(Input, {
777
+ size: "sm",
778
+ autoFocus,
779
+ value: draft,
780
+ onChange: (e) => setDraft(e.target.value),
781
+ onBlur: commit,
782
+ onKeyDown: (e) => {
783
+ if (e.key === "Enter") {
784
+ e.preventDefault();
785
+ commit();
786
+ }
787
+ },
788
+ placeholder: "Paste a YouTube, Vimeo or video file link",
789
+ "aria-label": "Video URL",
790
+ "aria-invalid": !!error || void 0,
791
+ "aria-describedby": error ? errId : void 0,
792
+ spellCheck: false,
793
+ autoComplete: "off",
794
+ leading: /* @__PURE__ */ jsx(IconWorld, { stroke: 1.5 }),
795
+ className: "min-w-0 flex-1"
796
+ }), /* @__PURE__ */ jsx(RemoveBtn, {
797
+ onClick: () => ctx.remove(el),
798
+ label: "Remove video"
799
+ })]
800
+ }),
801
+ error ? /* @__PURE__ */ jsx("p", {
802
+ id: errId,
803
+ role: "alert",
804
+ className: "mb-2 px-1 text-kit-xs text-kit-danger-fg",
805
+ children: error
806
+ }) : null,
807
+ frame ? /* @__PURE__ */ jsx("iframe", {
808
+ src: frame,
809
+ title: m.title || "Video preview",
810
+ loading: "lazy",
811
+ tabIndex: -1,
812
+ sandbox: "allow-scripts allow-same-origin allow-presentation",
813
+ referrerPolicy: "strict-origin-when-cross-origin",
814
+ className: "pointer-events-none aspect-video w-full rounded-kit-md border-0 bg-kit-muted"
815
+ }) : m.url ? /* @__PURE__ */ jsx("video", {
816
+ src: m.url,
817
+ title: m.title || "Video preview",
818
+ controls: true,
819
+ preload: "metadata",
820
+ className: "aspect-video w-full rounded-kit-md bg-kit-muted"
821
+ }) : /* @__PURE__ */ jsxs("p", {
822
+ className: "flex items-center gap-1.5 px-1 pb-0.5 text-kit-xs text-kit-fg-3",
823
+ children: [/* @__PURE__ */ jsx(IconVideo, {
824
+ className: "size-3.5",
825
+ stroke: 1.5,
826
+ "aria-hidden": true
827
+ }), "No video yet."]
828
+ })
829
+ ]
830
+ });
831
+ }
832
+ var formatBytes = (n) => n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${(n / 1024).toFixed(0)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
833
+ function FileBlock({ m, set, el, ctx, autoFocus }) {
834
+ const { MediaPicker } = useKitServices();
835
+ const [picker, setPicker] = React.useState(false);
836
+ const [url, setUrl] = React.useState("");
837
+ const [name, setName] = React.useState("");
838
+ const ro = ctx.readOnly;
839
+ const has = !!(m.url && m.name);
840
+ const pickerEl = MediaPicker ? /* @__PURE__ */ jsx(MediaPicker, {
841
+ open: picker,
842
+ onOpenChange: setPicker,
843
+ accept: ["file"],
844
+ onPick: (a) => a[0] && set({
845
+ url: a[0].url,
846
+ name: a[0].name ?? a[0].url.split("/").pop() ?? "Download",
847
+ ...a[0].size ? { size: a[0].size } : {}
848
+ }, "Choose file")
849
+ }) : null;
850
+ if (has) return /* @__PURE__ */ jsxs("div", {
851
+ className: "group/blk flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-surface px-3 py-2.5",
852
+ "data-rt-isolate": "",
853
+ children: [
854
+ /* @__PURE__ */ jsx("span", {
855
+ className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2",
856
+ children: /* @__PURE__ */ jsx(IconFileText, {
857
+ className: "size-[18px]",
858
+ stroke: 1.5,
859
+ "aria-hidden": true
860
+ })
861
+ }),
862
+ /* @__PURE__ */ jsxs("div", {
863
+ className: "min-w-0 flex-1",
864
+ children: [/* @__PURE__ */ jsx("div", {
865
+ className: "truncate text-kit-sm font-medium text-kit-fg",
866
+ children: m.name
867
+ }), /* @__PURE__ */ jsxs("div", {
868
+ className: "truncate text-kit-xs text-kit-fg-3",
869
+ children: [m.size ? `${formatBytes(m.size)} · ` : "", (m.name.includes(".") ? m.name.split(".").pop() : "file").toUpperCase()]
870
+ })]
871
+ }),
872
+ ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
873
+ size: "xs",
874
+ variant: "ghost",
875
+ onClick: () => setPicker(true),
876
+ children: "Replace"
877
+ }) : null, /* @__PURE__ */ jsx(RemoveBtn, {
878
+ onClick: () => ctx.remove(el),
879
+ label: "Remove file"
880
+ })] }),
881
+ pickerEl
882
+ ]
883
+ });
884
+ return /* @__PURE__ */ jsxs("div", {
885
+ className: "group/blk rounded-kit-lg border border-dashed border-kit-line-strong bg-kit-subtle px-3 py-2.5",
886
+ "data-rt-isolate": "",
887
+ children: [
888
+ /* @__PURE__ */ jsxs("div", {
889
+ className: "flex items-center gap-3",
890
+ children: [
891
+ /* @__PURE__ */ jsx("span", {
892
+ className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-3",
893
+ children: /* @__PURE__ */ jsx(IconFileText, {
894
+ className: "size-[18px]",
895
+ stroke: 1.5,
896
+ "aria-hidden": true
897
+ })
898
+ }),
899
+ /* @__PURE__ */ jsxs("div", {
900
+ className: "min-w-0 flex-1",
901
+ children: [/* @__PURE__ */ jsx("div", {
902
+ className: "text-kit-sm font-medium text-kit-fg",
903
+ children: "File"
904
+ }), /* @__PURE__ */ jsx("p", {
905
+ className: "text-kit-xs text-kit-fg-3",
906
+ children: "No file yet."
907
+ })]
908
+ }),
909
+ ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
910
+ size: "sm",
911
+ leftIcon: /* @__PURE__ */ jsx(IconLibraryPhoto, { stroke: 1.5 }),
912
+ onClick: () => setPicker(true),
913
+ children: "Choose file"
914
+ }) : null, /* @__PURE__ */ jsx(RemoveBtn, {
915
+ onClick: () => ctx.remove(el),
916
+ label: "Remove file"
917
+ })] })
918
+ ]
919
+ }),
920
+ ro ? null : /* @__PURE__ */ jsxs("form", {
921
+ className: "mt-2.5 flex flex-wrap items-center gap-2",
922
+ onSubmit: (e) => {
923
+ e.preventDefault();
924
+ const u = url.trim();
925
+ if (!/^https?:\/\/\S+$/i.test(u) && !/^\/(?!\/)\S*$/.test(u)) return ctx.notify("Paste a full file link that starts with https://", "Or a path on this site, like /files/spec.pdf.");
926
+ set({
927
+ url: u,
928
+ name: name.trim() || u.split("/").pop() || "Download"
929
+ }, "Add file");
930
+ ctx.exit(el);
931
+ },
932
+ children: [
933
+ /* @__PURE__ */ jsx(Input, {
934
+ autoFocus: autoFocus && !MediaPicker,
935
+ size: "sm",
936
+ value: url,
937
+ onChange: (e) => setUrl(e.target.value),
938
+ placeholder: "https://…/guide.pdf",
939
+ "aria-label": "File URL",
940
+ spellCheck: false,
941
+ autoComplete: "off",
942
+ leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
943
+ className: "min-w-40 flex-1"
944
+ }),
945
+ /* @__PURE__ */ jsx(Input, {
946
+ size: "sm",
947
+ value: name,
948
+ onChange: (e) => setName(e.target.value),
949
+ placeholder: "Link text",
950
+ "aria-label": "File name shown to readers",
951
+ className: "min-w-28 flex-1"
952
+ }),
953
+ /* @__PURE__ */ jsx(Button, {
954
+ size: "sm",
955
+ variant: "primary",
956
+ type: "submit",
957
+ disabled: !url.trim(),
958
+ children: "Add"
959
+ })
960
+ ]
961
+ }),
962
+ pickerEl
963
+ ]
964
+ });
965
+ }
966
+ function ComponentBlock({ m, el, ctx, set }) {
967
+ const { useComponentInfo } = useKitServices();
968
+ const overrides = React.useMemo(() => {
969
+ try {
970
+ const v = m.overrides ? JSON.parse(m.overrides) : {};
971
+ return v && typeof v === "object" && !Array.isArray(v) ? v : {};
972
+ } catch {
973
+ return {};
974
+ }
975
+ }, [m.overrides]);
976
+ if (useComponentInfo) return /* @__PURE__ */ jsx(ComponentCard, {
977
+ m,
978
+ el,
979
+ ctx,
980
+ use: useComponentInfo,
981
+ overrides,
982
+ set
983
+ });
984
+ const count = Object.keys(overrides).length;
985
+ const name = m.name || "Component";
986
+ return /* @__PURE__ */ jsxs("div", {
987
+ role: "group",
988
+ "aria-label": `${name}, ${m.detached ? "separate copy" : "linked component"}`,
989
+ className: "group/blk flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-surface px-3 py-2.5",
990
+ "data-rt-isolate": "",
991
+ children: [
992
+ /* @__PURE__ */ jsx("span", {
993
+ className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2",
994
+ children: /* @__PURE__ */ jsx(IconComponents, {
995
+ className: "size-[18px]",
996
+ stroke: 1.5,
997
+ "aria-hidden": true
998
+ })
999
+ }),
1000
+ /* @__PURE__ */ jsxs("div", {
1001
+ className: "min-w-0 flex-1",
1002
+ children: [/* @__PURE__ */ jsx("div", {
1003
+ className: "truncate text-kit-sm font-medium text-kit-fg",
1004
+ children: name
1005
+ }), /* @__PURE__ */ jsx("div", {
1006
+ className: "truncate text-kit-xs text-kit-fg-3",
1007
+ children: m.detached ? "Separate copy · edits to the component don't reach it" : /* @__PURE__ */ jsxs(Fragment, { children: [
1008
+ m.ref ? "Linked component" : "Component with no source",
1009
+ count ? ` · ${count} ${count === 1 ? "override" : "overrides"}` : "",
1010
+ " · edits to the component show here too"
1011
+ ] })
1012
+ })]
1013
+ }),
1014
+ ctx.readOnly ? null : /* @__PURE__ */ jsxs("div", {
1015
+ className: "flex items-center gap-0.5 opacity-0 transition-opacity motion-reduce:transition-none group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
1016
+ children: [ctx.duplicate ? /* @__PURE__ */ jsx(IconButton, {
1017
+ size: "xs",
1018
+ label: `Duplicate ${name}`,
1019
+ onClick: () => ctx.duplicate?.(el),
1020
+ children: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 })
1021
+ }) : null, /* @__PURE__ */ jsx(RemoveBtn, {
1022
+ onClick: () => ctx.remove(el),
1023
+ label: `Remove ${name}`
1024
+ })]
1025
+ })
1026
+ ]
1027
+ });
1028
+ }
1029
+ /**
1030
+ * What production's rich-text table keeps: text and link cells, the header row and row headers, an optional caption,
1031
+ * the note under the table and row groups (`caption`, `notes`, `rowGroups`). Footnotes have no place there.
1032
+ */
1033
+ var STORED_TABLE = {
1034
+ columnTypes: ["text", "link"],
1035
+ requireCaption: false,
1036
+ allowGroups: true,
1037
+ allowFootnotes: false,
1038
+ allowNote: true,
1039
+ settings: {
1040
+ headers: true,
1041
+ totals: false,
1042
+ phones: [],
1043
+ highlight: false,
1044
+ sticky: false,
1045
+ sort: false,
1046
+ search: false
1047
+ }
1048
+ };
1049
+ function TableBlock({ m, set, el, ctx }) {
1050
+ return /* @__PURE__ */ jsx("div", {
1051
+ className: "group/blk",
1052
+ "data-rt-isolate": "",
1053
+ children: /* @__PURE__ */ jsx(TableEditor, {
1054
+ value: m,
1055
+ onChange: (next) => set(() => next, "Edit table"),
1056
+ readOnly: ctx.readOnly,
1057
+ options: STORED_TABLE,
1058
+ label: "Table",
1059
+ actions: ctx.readOnly ? null : /* @__PURE__ */ jsx(RemoveBtn, {
1060
+ onClick: () => ctx.remove(el),
1061
+ label: "Remove table"
1062
+ })
1063
+ })
1064
+ });
1065
+ }
1066
+ var PULL_QUOTE_LABEL = "Pull quote";
1067
+ /** V2 article.ts ARTICLE_SCHEMAS.pullquote: the properties panel is built from it. */
1068
+ var PULL_QUOTE_SCHEMA = {
1069
+ name: "pullQuote",
1070
+ title: PULL_QUOTE_LABEL,
1071
+ kind: "object",
1072
+ icon: "quote",
1073
+ fields: [
1074
+ {
1075
+ name: "quote",
1076
+ title: "Quote",
1077
+ type: "text",
1078
+ rows: 3,
1079
+ validation: {
1080
+ required: true,
1081
+ recommendedMax: 200
1082
+ }
1083
+ },
1084
+ {
1085
+ name: "name",
1086
+ title: "Name",
1087
+ type: "string",
1088
+ validation: { max: 60 }
1089
+ },
1090
+ {
1091
+ name: "role",
1092
+ title: "Role or source",
1093
+ type: "string",
1094
+ validation: { max: 80 }
1095
+ },
1096
+ {
1097
+ name: "link",
1098
+ title: "Source link",
1099
+ type: "url",
1100
+ description: "The name links here."
1101
+ }
1102
+ ]
1103
+ };
1104
+ var openArticle = null;
1105
+ var articleSubs = /* @__PURE__ */ new Set();
1106
+ var setOpenArticle = (next) => {
1107
+ openArticle = next;
1108
+ articleSubs.forEach((f) => f());
1109
+ };
1110
+ function useOpenArticle() {
1111
+ return React.useSyncExternalStore((cb) => (articleSubs.add(cb), () => void articleSubs.delete(cb)), () => openArticle, () => openArticle);
1112
+ }
1113
+ var controlOf = (el) => Array.from(el.querySelectorAll("textarea, input:not([type=hidden]), [contenteditable=true], [role=combobox]")).find((n) => n.getClientRects().length) ?? Array.from(el.querySelectorAll(":scope > :not(:first-child) button")).find((n) => n.getClientRects().length);
1114
+ function focusField(root, key) {
1115
+ if (!root) return;
1116
+ const rows = Array.from(root.querySelectorAll("[data-field-key]"));
1117
+ const row = key && rows.find((r) => r.getAttribute("data-field-key") === key) || rows[0];
1118
+ if (!row) return;
1119
+ row.scrollIntoView({ block: "nearest" });
1120
+ controlOf(row)?.focus({ preventScroll: true });
1121
+ }
1122
+ function PullQuoteBlock({ m, set, el, ctx, autoFocus }) {
1123
+ const label = PULL_QUOTE_LABEL;
1124
+ const uid = React.useId();
1125
+ const card = React.useRef(null);
1126
+ const [cardEl, setCardEl] = React.useState(null);
1127
+ const open = useOpenArticle();
1128
+ const editing = open?.id === uid;
1129
+ const cardRef = React.useCallback((n) => {
1130
+ card.current = n;
1131
+ if (n) setCardEl(n);
1132
+ }, []);
1133
+ const ro = !!ctx.readOnly;
1134
+ const modelRef = React.useRef(m);
1135
+ modelRef.current = m;
1136
+ const openPanel = React.useCallback((k) => {
1137
+ if (!ro) setOpenArticle({
1138
+ id: uid,
1139
+ focusKey: k ?? null,
1140
+ nonce: (openArticle?.nonce ?? 0) + 1
1141
+ });
1142
+ }, [uid, ro]);
1143
+ const close = React.useCallback(() => {
1144
+ if (openArticle?.id === uid) setOpenArticle(null);
1145
+ }, [uid]);
1146
+ const focusCard = React.useCallback(() => requestAnimationFrame(() => card.current?.focus({ preventScroll: true })), []);
1147
+ React.useEffect(() => () => {
1148
+ if (openArticle?.id === uid) setOpenArticle(null);
1149
+ }, [uid]);
1150
+ React.useEffect(() => {
1151
+ if (autoFocus && !ro) openPanel();
1152
+ }, []);
1153
+ /** a form edit joins the body's one undo history (D54); typing coalesces per field */
1154
+ const commit = (next) => {
1155
+ const prev = modelRef.current;
1156
+ const field = Object.keys(next).find((k) => next[k] !== prev[k]) ?? "";
1157
+ set(() => next, `Edit ${label.toLowerCase()} ${field}`);
1158
+ };
1159
+ const onKeyDown = (e) => {
1160
+ if (e.defaultPrevented || e.target !== card.current) return;
1161
+ const mod = e.metaKey || e.ctrlKey;
1162
+ const k = e.key.toLowerCase();
1163
+ if (mod && k === "z") {
1164
+ e.preventDefault();
1165
+ e.stopPropagation();
1166
+ if (e.shiftKey) ctx.redo?.();
1167
+ else ctx.undo?.();
1168
+ return;
1169
+ }
1170
+ if (e.key === "Enter" || e.key === " ") {
1171
+ e.preventDefault();
1172
+ openPanel();
1173
+ return;
1174
+ }
1175
+ if (e.key === "Escape") {
1176
+ e.preventDefault();
1177
+ e.stopPropagation();
1178
+ if (editing) close();
1179
+ else ctx.exit(el);
1180
+ return;
1181
+ }
1182
+ if (ro) return;
1183
+ if (mod && k === "d" && ctx.duplicate) {
1184
+ e.preventDefault();
1185
+ e.stopPropagation();
1186
+ ctx.duplicate(el);
1187
+ } else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown") && ctx.move) {
1188
+ e.preventDefault();
1189
+ ctx.move(el, e.key === "ArrowUp" ? -1 : 1);
1190
+ focusCard();
1191
+ } else if (e.key === "Backspace" || e.key === "Delete") {
1192
+ e.preventDefault();
1193
+ ctx.remove(el);
1194
+ }
1195
+ };
1196
+ const actions = ro ? null : /* @__PURE__ */ jsxs("div", {
1197
+ className: cn("absolute -top-3.5 right-2 z-[2] flex items-center gap-0.5 rounded-kit-md border border-kit-line bg-kit-surface-raised p-0.5 opacity-0 shadow-kit-sm transition-opacity", "group-hover/art:opacity-100 group-focus-within/art:opacity-100 pointer-coarse:opacity-100", editing && "opacity-100"),
1198
+ children: [/* @__PURE__ */ jsx(IconButton, {
1199
+ size: "xs",
1200
+ label: `Edit ${label.toLowerCase()}`,
1201
+ onClick: () => editing ? close() : openPanel(),
1202
+ children: /* @__PURE__ */ jsx(IconSettings, { stroke: 1.5 })
1203
+ }), /* @__PURE__ */ jsx(IconButton, {
1204
+ size: "xs",
1205
+ label: `Remove ${label.toLowerCase()}`,
1206
+ onClick: () => ctx.remove(el),
1207
+ className: "hover:text-kit-danger-fg",
1208
+ children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
1209
+ })]
1210
+ });
1211
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
1212
+ ref: cardRef,
1213
+ role: "group",
1214
+ tabIndex: 0,
1215
+ "aria-label": `${label}${editing ? ", editing" : ""}`,
1216
+ "aria-roledescription": "block",
1217
+ "aria-haspopup": "dialog",
1218
+ "aria-expanded": editing,
1219
+ "data-rt-isolate": "",
1220
+ "data-article-block": "pullquote",
1221
+ onKeyDown,
1222
+ onClick: (e) => {
1223
+ if (ro || !e.currentTarget.contains(e.target)) return;
1224
+ const t = e.target;
1225
+ if (t.closest("button,a,[role=menuitem]")) return;
1226
+ openPanel(t.closest("[data-field]")?.getAttribute("data-field") ?? null);
1227
+ },
1228
+ className: cn("group/art relative rounded-kit-lg outline-none transition-shadow duration-150", !ro && "cursor-pointer", "focus-visible:shadow-[0_0_0_1px_var(--kit-line-strong)]", editing ? "shadow-[0_0_0_2px_var(--kit-accent)] focus-visible:shadow-[0_0_0_2px_var(--kit-accent)]" : !ro && "hover:shadow-[0_0_0_1px_var(--kit-line)]"),
1229
+ children: [/* @__PURE__ */ jsx(PullQuotePreview, { m }), actions]
1230
+ }), editing ? /* @__PURE__ */ jsx(ArticlePanel, {
1231
+ label,
1232
+ anchor: cardEl,
1233
+ nonce: open.nonce,
1234
+ focusKey: open.focusKey,
1235
+ onClose: close,
1236
+ focusBack: focusCard,
1237
+ ctx,
1238
+ el,
1239
+ children: /* @__PURE__ */ jsxs("div", {
1240
+ "data-article-form": "",
1241
+ className: "min-w-0",
1242
+ children: [/* @__PURE__ */ jsx(SchemaForm, {
1243
+ schema: PULL_QUOTE_SCHEMA,
1244
+ value: m,
1245
+ onChange: (v) => commit(v),
1246
+ variant: "panel",
1247
+ scroll: false,
1248
+ readOnly: ro,
1249
+ rootLabel: label,
1250
+ env: {
1251
+ docId: `article:${PULL_QUOTE_SCHEMA.name}`,
1252
+ docTitle: label
1253
+ }
1254
+ }), /* @__PURE__ */ jsx("style", { children: `[data-article-form] [data-kit-form] section:first-of-type { border-top-width: 0; margin-top: 0; padding-top: 0; }` })]
1255
+ })
1256
+ }) : null] });
1257
+ }
1258
+ var TAKEAWAYS_LABEL = "Key takeaways";
1259
+ /** V2 article.ts ARTICLE_SCHEMAS.takeaways `points` max (the stored block's limit, key_takeaways_limit_exceeded) */
1260
+ var MAX_POINTS = 8;
1261
+ /** V2 article.ts ARTICLE_SCHEMAS.takeaways `title` max */
1262
+ var MAX_TITLE = 40;
1263
+ function TakeawaysBlock({ m, set, el, ctx, autoFocus }) {
1264
+ const label = TAKEAWAYS_LABEL;
1265
+ const card = React.useRef(null);
1266
+ const box = React.useRef(null);
1267
+ const ro = !!ctx.readOnly;
1268
+ const focusCard = () => requestAnimationFrame(() => card.current?.focus({ preventScroll: true }));
1269
+ const focusPoint = (i, atEnd = true) => requestAnimationFrame(() => {
1270
+ const t = box.current?.querySelectorAll("[role=textbox]")[i];
1271
+ if (!t) return;
1272
+ t.focus();
1273
+ placeCaret(t, atEnd);
1274
+ });
1275
+ const setPoint = (i, v) => set({ points: m.points.map((p, j) => j === i ? v : p) }, `Edit key takeaways point ${i + 1}`);
1276
+ /** V2 ArticleBlock onKeyDown, on the block itself (its lines handle their own keys) */
1277
+ const onKeyDown = (e) => {
1278
+ if (e.defaultPrevented || e.target !== card.current) return;
1279
+ const mod = e.metaKey || e.ctrlKey;
1280
+ const k = e.key.toLowerCase();
1281
+ if (mod && k === "z") {
1282
+ e.preventDefault();
1283
+ e.stopPropagation();
1284
+ if (e.shiftKey) ctx.redo?.();
1285
+ else ctx.undo?.();
1286
+ return;
1287
+ }
1288
+ if (e.key === "Escape") {
1289
+ e.preventDefault();
1290
+ e.stopPropagation();
1291
+ ctx.exit(el);
1292
+ return;
1293
+ }
1294
+ if (ro) return;
1295
+ if (mod && k === "d" && ctx.duplicate) {
1296
+ e.preventDefault();
1297
+ e.stopPropagation();
1298
+ ctx.duplicate(el);
1299
+ } else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown") && ctx.move) {
1300
+ e.preventDefault();
1301
+ ctx.move(el, e.key === "ArrowUp" ? -1 : 1);
1302
+ focusCard();
1303
+ } else if (e.key === "Backspace" || e.key === "Delete") {
1304
+ e.preventDefault();
1305
+ ctx.remove(el);
1306
+ }
1307
+ };
1308
+ return /* @__PURE__ */ jsxs("div", {
1309
+ ref: card,
1310
+ role: "group",
1311
+ tabIndex: 0,
1312
+ "aria-label": label,
1313
+ "aria-roledescription": "block",
1314
+ "data-rt-isolate": "",
1315
+ "data-article-block": "takeaways",
1316
+ onKeyDown,
1317
+ className: "group/art relative rounded-kit-lg outline-none transition-shadow duration-150 focus-visible:shadow-[0_0_0_1px_var(--kit-line-strong)]",
1318
+ children: [/* @__PURE__ */ jsxs("aside", {
1319
+ className: "rounded-kit-lg border border-kit-line bg-kit-subtle px-4 py-3",
1320
+ "aria-label": m.title || label,
1321
+ children: [/* @__PURE__ */ jsx(PlainEditable, {
1322
+ label: "Key takeaways title",
1323
+ value: m.title,
1324
+ placeholder: "Key takeaways",
1325
+ readOnly: ro,
1326
+ onChange: (title) => {
1327
+ if (title.length > MAX_TITLE && m.title.length <= MAX_TITLE) ctx.notify(`A key takeaways title holds at most ${MAX_TITLE} characters.`, "Shorten it, or the change will not save.");
1328
+ set({ title }, "Edit key takeaways title");
1329
+ },
1330
+ onEnter: () => focusPoint(0, false),
1331
+ className: "text-kit-sm font-semibold text-kit-fg"
1332
+ }), /* @__PURE__ */ jsx("ul", {
1333
+ ref: box,
1334
+ className: "m-0 mt-1.5 flex flex-col gap-1 p-0",
1335
+ children: m.points.map((p, i) => /* @__PURE__ */ jsxs("li", {
1336
+ className: "flex list-none items-baseline gap-2 text-[15px] leading-relaxed text-kit-fg",
1337
+ children: [/* @__PURE__ */ jsx("span", {
1338
+ "aria-hidden": true,
1339
+ className: "mt-[0.55em] size-1.5 shrink-0 self-start rounded-full bg-kit-accent"
1340
+ }), /* @__PURE__ */ jsx(PlainEditable, {
1341
+ label: `Point ${i + 1}`,
1342
+ value: p,
1343
+ placeholder: i === 0 ? "The first thing to remember" : "Another point",
1344
+ readOnly: ro,
1345
+ autoFocus: autoFocus && i === 0,
1346
+ onChange: (v) => setPoint(i, v),
1347
+ onEnter: () => {
1348
+ if (m.points.length >= MAX_POINTS) {
1349
+ ctx.notify(`Key takeaways hold at most ${MAX_POINTS} points.`, "Merge two points, or move this one into the text.");
1350
+ return;
1351
+ }
1352
+ set((x) => ({
1353
+ ...x,
1354
+ points: [
1355
+ ...x.points.slice(0, i + 1),
1356
+ "",
1357
+ ...x.points.slice(i + 1)
1358
+ ]
1359
+ }), "Add a key takeaways point");
1360
+ focusPoint(i + 1);
1361
+ },
1362
+ onBackspaceEmpty: m.points.length > 1 ? () => {
1363
+ set((x) => ({
1364
+ ...x,
1365
+ points: x.points.filter((_, j) => j !== i)
1366
+ }), "Remove a key takeaways point");
1367
+ focusPoint(Math.max(0, i - 1));
1368
+ } : void 0,
1369
+ className: "flex-1"
1370
+ })]
1371
+ }, i))
1372
+ })]
1373
+ }), ro ? null : /* @__PURE__ */ jsx("div", {
1374
+ className: cn("absolute -top-3.5 right-2 z-[2] flex items-center gap-0.5 rounded-kit-md border border-kit-line bg-kit-surface-raised p-0.5 opacity-0 shadow-kit-sm transition-opacity", "group-hover/art:opacity-100 group-focus-within/art:opacity-100 pointer-coarse:opacity-100"),
1375
+ children: /* @__PURE__ */ jsx(IconButton, {
1376
+ size: "xs",
1377
+ label: `Remove ${label.toLowerCase()}`,
1378
+ onClick: () => ctx.remove(el),
1379
+ className: "hover:text-kit-danger-fg",
1380
+ children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
1381
+ })
1382
+ })]
1383
+ });
1384
+ }
1385
+ function ArticlePanel({ label, anchor, nonce, focusKey, onClose, focusBack, ctx, el, children }) {
1386
+ const panel = React.useRef(null);
1387
+ const titleId = React.useId();
1388
+ const container = anchor?.closest("[data-expanded-editor]") ?? null;
1389
+ React.useEffect(() => {
1390
+ const timers = [];
1391
+ let landed = false;
1392
+ for (const ms of [
1393
+ 40,
1394
+ 90,
1395
+ 160,
1396
+ 260,
1397
+ 420,
1398
+ 640
1399
+ ]) timers.push(window.setTimeout(() => {
1400
+ const root = panel.current?.el() ?? null;
1401
+ if (!root?.querySelector("[data-field-key]")) return;
1402
+ const a = document.activeElement;
1403
+ const lost = !a || a === document.body || a.hasAttribute("data-expanded-editor") || a.hasAttribute("data-article-block");
1404
+ if (root.contains(a)) return void (landed = true);
1405
+ if (!landed || lost) focusField(root, focusKey);
1406
+ if (root.contains(document.activeElement)) landed = true;
1407
+ }, ms));
1408
+ return () => timers.forEach((t) => window.clearTimeout(t));
1409
+ }, [nonce]);
1410
+ React.useEffect(() => panel.current?.announce(`${label} properties.`), [label]);
1411
+ return /* @__PURE__ */ jsx(FloatingPanel, {
1412
+ ref: panel,
1413
+ id: "article-properties",
1414
+ labelledBy: titleId,
1415
+ anchor,
1416
+ container,
1417
+ header: /* @__PURE__ */ jsxs(Fragment, { children: [
1418
+ /* @__PURE__ */ jsx("span", {
1419
+ id: titleId,
1420
+ className: "min-w-0 flex-1 truncate text-kit-sm font-medium text-kit-fg",
1421
+ children: label
1422
+ }),
1423
+ /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, { render: /* @__PURE__ */ jsx(IconButton, {
1424
+ size: "sm",
1425
+ label: `${label} actions`,
1426
+ children: /* @__PURE__ */ jsx(IconDots, { stroke: 1.5 })
1427
+ }) }), /* @__PURE__ */ jsxs(MenuContent, {
1428
+ align: "end",
1429
+ className: "w-52",
1430
+ children: [
1431
+ ctx.readOnly || !ctx.duplicate ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuItem, {
1432
+ icon: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 }),
1433
+ onClick: () => ctx.duplicate?.(el),
1434
+ children: "Duplicate"
1435
+ }), /* @__PURE__ */ jsx(MenuSeparator, {})] }),
1436
+ /* @__PURE__ */ jsx(MenuItem, {
1437
+ icon: /* @__PURE__ */ jsx(IconArrowsMove, { stroke: 1.5 }),
1438
+ onClick: () => panel.current?.keyboard("move"),
1439
+ children: "Move panel"
1440
+ }),
1441
+ /* @__PURE__ */ jsx(MenuItem, {
1442
+ icon: /* @__PURE__ */ jsx(IconDimensions, { stroke: 1.5 }),
1443
+ onClick: () => panel.current?.keyboard("resize"),
1444
+ children: "Resize panel"
1445
+ }),
1446
+ /* @__PURE__ */ jsx(MenuItem, {
1447
+ icon: /* @__PURE__ */ jsx(IconLayoutSidebar, { stroke: 1.5 }),
1448
+ onClick: () => panel.current?.dock("left"),
1449
+ children: "Dock left"
1450
+ }),
1451
+ /* @__PURE__ */ jsx(MenuItem, {
1452
+ icon: /* @__PURE__ */ jsx(IconLayoutSidebarRight, { stroke: 1.5 }),
1453
+ onClick: () => panel.current?.dock("right"),
1454
+ children: "Dock right"
1455
+ }),
1456
+ ctx.readOnly ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(MenuItem, {
1457
+ danger: true,
1458
+ icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
1459
+ onClick: () => ctx.remove(el),
1460
+ children: "Remove"
1461
+ })] })
1462
+ ]
1463
+ })] }),
1464
+ /* @__PURE__ */ jsx(IconButton, {
1465
+ size: "sm",
1466
+ label: "Close properties",
1467
+ tooltip: "Close",
1468
+ onClick: () => (onClose(), focusBack()),
1469
+ children: /* @__PURE__ */ jsx(IconX, { stroke: 1.5 })
1470
+ })
1471
+ ] }),
1472
+ onClose,
1473
+ focusBack,
1474
+ onPanelKeyDown: (e) => {
1475
+ if ((e.metaKey || e.ctrlKey) && !e.altKey && e.key.toLowerCase() === "z" && !e.defaultPrevented) {
1476
+ e.preventDefault();
1477
+ if (e.shiftKey) ctx.redo?.();
1478
+ else ctx.undo?.();
1479
+ }
1480
+ },
1481
+ sheetFooter: /* @__PURE__ */ jsx(Button, {
1482
+ size: "sm",
1483
+ variant: "primary",
1484
+ onClick: () => (onClose(), focusBack()),
1485
+ children: "Done"
1486
+ }),
1487
+ children: /* @__PURE__ */ jsx("div", {
1488
+ className: "pb-3 pt-1",
1489
+ children
1490
+ })
1491
+ });
1492
+ }
1493
+ function PullQuotePreview({ m }) {
1494
+ return /* @__PURE__ */ jsxs("figure", {
1495
+ className: "m-0 py-2 pl-5 pr-10",
1496
+ children: [
1497
+ /* @__PURE__ */ jsx(IconQuote, {
1498
+ className: "mb-1 size-6 text-kit-accent-fg",
1499
+ stroke: 1.5,
1500
+ "aria-hidden": true
1501
+ }),
1502
+ /* @__PURE__ */ jsx("blockquote", {
1503
+ "data-field": "quote",
1504
+ className: cn("m-0 text-[22px] font-medium leading-snug tracking-[-0.01em]", m.quote ? "text-kit-fg" : "text-kit-fg-4"),
1505
+ children: m.quote || "Write the quote"
1506
+ }),
1507
+ m.name || m.role ? /* @__PURE__ */ jsxs("figcaption", {
1508
+ className: "mt-3 text-kit-sm text-kit-fg-2",
1509
+ children: [
1510
+ m.name ? /* @__PURE__ */ jsx("span", {
1511
+ "data-field": "name",
1512
+ className: cn("font-medium text-kit-fg", m.link && "underline decoration-kit-line-strong underline-offset-2"),
1513
+ children: m.name
1514
+ }) : null,
1515
+ m.name && m.role ? ", " : null,
1516
+ m.role ? /* @__PURE__ */ jsx("span", {
1517
+ "data-field": "role",
1518
+ children: m.role
1519
+ }) : null
1520
+ ]
1521
+ }) : /* @__PURE__ */ jsx("figcaption", {
1522
+ "data-field": "name",
1523
+ className: "mt-3 text-kit-sm text-kit-fg-4",
1524
+ children: "Who said it"
1525
+ })
1526
+ ]
1527
+ });
1528
+ }
1529
+ //#endregion
1530
+ export { Island };
1531
+
1532
+ //# sourceMappingURL=blocks.js.map