@kardalum/plugin-sdk 0.16.0 → 0.18.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 (274) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +4 -3
  3. package/dist/admin-section-registry.d.ts +14 -5
  4. package/dist/admin-section-registry.js +14 -4
  5. package/dist/assets/asset-picker.d.ts +11 -0
  6. package/dist/assets/asset-picker.js +109 -0
  7. package/dist/assets/asset-tree.d.ts +30 -0
  8. package/dist/assets/asset-tree.js +150 -0
  9. package/dist/built-in-editor-ids.d.ts +1 -0
  10. package/dist/built-in-editor-ids.js +20 -0
  11. package/dist/built-in-settings-schemas.d.ts +2 -0
  12. package/dist/built-in-settings-schemas.js +27 -0
  13. package/dist/built-in-value-schemas.js +3 -0
  14. package/dist/built-ins.js +10 -1
  15. package/dist/capabilities.js +5 -3
  16. package/dist/datatype-validation.js +18 -4
  17. package/dist/datatypes-entry.d.ts +1 -0
  18. package/dist/datatypes-entry.js +1 -0
  19. package/dist/entitlement-entry.d.ts +3 -2
  20. package/dist/entitlement-entry.js +13 -1
  21. package/dist/entitlement-gate.d.ts +18 -0
  22. package/dist/entitlement-gate.js +95 -21
  23. package/dist/entitlement-plan.d.ts +21 -0
  24. package/dist/entitlement-plan.js +26 -0
  25. package/dist/entitlement-types.d.ts +21 -4
  26. package/dist/entitlement.d.ts +29 -1
  27. package/dist/entitlement.js +39 -0
  28. package/dist/grid-arrow-step.d.ts +7 -0
  29. package/dist/grid-arrow-step.js +20 -0
  30. package/dist/host-entry.d.ts +1 -1
  31. package/dist/host-entry.js +1 -1
  32. package/dist/index.d.ts +8 -3
  33. package/dist/index.js +13 -18
  34. package/dist/license-verdict-keys.d.ts +4 -3
  35. package/dist/license-verdict-keys.js +4 -7
  36. package/dist/manifest-entry.d.ts +6 -2
  37. package/dist/manifest-entry.js +5 -1
  38. package/dist/manifest-schema.d.ts +56 -63
  39. package/dist/manifest-schema.js +103 -249
  40. package/dist/manifest.d.ts +61 -73
  41. package/dist/manifest.js +13 -36
  42. package/dist/media/media-picker.js +32 -32
  43. package/dist/notify.d.ts +17 -0
  44. package/dist/notify.js +17 -0
  45. package/dist/plugin-screen-context.d.ts +11 -1
  46. package/dist/richtext/block-panel.js +19 -20
  47. package/dist/richtext/extensions.js +10 -1
  48. package/dist/richtext/insert-menu.js +1 -1
  49. package/dist/richtext/kardalum-block.js +17 -17
  50. package/dist/richtext/style-listbox.js +4 -4
  51. package/dist/richtext-html-entry.d.ts +35 -0
  52. package/dist/richtext-html-entry.js +73 -0
  53. package/dist/structured-storage-types.d.ts +11 -0
  54. package/dist/tailwind.js +10 -3
  55. package/dist/tokens/tailwind-theme.css +176 -0
  56. package/dist/tokens/tokens.css +2 -0
  57. package/dist/tokens/tokens.json +4 -2
  58. package/dist/type-equality.d.ts +2 -0
  59. package/dist/type-equality.js +1 -0
  60. package/dist/vendor-check.d.ts +39 -0
  61. package/dist/vendor-check.js +79 -0
  62. package/dist/vendor-entry.d.ts +3 -0
  63. package/dist/vendor-entry.js +9 -0
  64. package/dist/vendor-service.d.ts +20 -0
  65. package/dist/vendor-service.js +20 -0
  66. package/dist/views/asset-view.d.ts +6 -0
  67. package/dist/views/asset-view.js +55 -0
  68. package/dist/views/content-list-settings-view.js +1 -1
  69. package/dist/views/content-list-view.js +1 -1
  70. package/dist/views/html-code-editor.js +0 -1
  71. package/dist/views/html-view.js +1 -1
  72. package/dist/views/image-view.js +1 -1
  73. package/dist/views/rich-text-view.js +30 -30
  74. package/node_modules/@kardalum/api-schemas/README.md +1 -1
  75. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  76. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
  77. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
  78. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
  79. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +23 -1
  80. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
  81. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  82. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  83. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
  84. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
  85. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
  86. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +22 -6
  87. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  88. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  89. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  90. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  91. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
  92. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
  93. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
  94. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
  95. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
  96. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
  97. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
  98. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
  99. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
  100. package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
  101. package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
  102. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +73 -31
  103. package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
  104. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  105. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  106. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  107. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  108. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
  109. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
  110. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +216 -63
  111. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
  112. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
  113. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
  114. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
  115. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
  116. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
  117. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
  118. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
  119. package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
  120. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
  121. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
  122. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
  123. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
  124. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
  125. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  126. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  127. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +8 -18
  128. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
  129. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
  130. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
  131. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  132. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  133. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
  134. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
  135. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
  136. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  137. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  138. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
  139. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
  140. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
  141. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
  142. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
  143. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
  144. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
  145. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
  146. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  147. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  148. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
  149. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
  150. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  151. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +83 -0
  153. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -0
  154. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  155. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  156. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
  157. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
  158. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
  159. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
  160. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
  161. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
  162. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
  163. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
  164. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  165. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  166. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
  167. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
  168. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
  169. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
  170. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
  171. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
  172. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  173. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  174. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +115 -1
  175. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
  176. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
  177. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
  178. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  179. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  180. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +16 -0
  181. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
  182. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
  183. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
  184. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
  185. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
  186. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +32 -0
  187. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
  188. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  189. package/node_modules/@kardalum/design-tokens/README.md +1 -1
  190. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
  191. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
  192. package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
  193. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
  194. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
  195. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  196. package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
  197. package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
  198. package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
  199. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
  200. package/node_modules/@kardalum/design-tokens/package.json +6 -3
  201. package/node_modules/@kardalum/plugin-package/README.md +5 -2
  202. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
  203. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
  204. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  205. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
  206. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  207. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  208. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  209. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  210. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  211. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  212. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +8 -0
  213. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -0
  214. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  215. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  216. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  217. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  218. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  219. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  220. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  221. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  222. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  223. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  224. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  225. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  226. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  227. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  228. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  229. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +137 -0
  230. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  231. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  232. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  233. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  234. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +7 -0
  235. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -0
  236. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  237. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  238. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  239. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  240. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  241. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  242. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -4
  243. package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
  244. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
  245. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
  246. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  247. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  248. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
  249. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
  250. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
  251. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
  252. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  253. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  254. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  255. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  256. package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
  257. package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
  258. package/node_modules/@kardalum/plugin-package/package.json +4 -2
  259. package/node_modules/@kardalum/ui/README.md +1 -1
  260. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  261. package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
  262. package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
  263. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +3 -3
  264. package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
  265. package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
  266. package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
  267. package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
  268. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  269. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
  270. package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
  271. package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
  272. package/node_modules/@kardalum/ui/dist/index.js +1 -0
  273. package/node_modules/@kardalum/ui/package.json +1 -1
  274. package/package.json +19 -6
@@ -49,12 +49,12 @@ function BlockParamField({ spec, value, onChange, error }) {
49
49
  case "text":
50
50
  return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx(Input, { id: fieldId, type: "text", value: value ?? "", onChange: (event) => onChange(event.target.value) }) }));
51
51
  case "textarea":
52
- return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx("textarea", { id: fieldId, rows: 3, value: value ?? "", onChange: (event) => onChange(event.target.value), className: "w-full rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary focus-visible:border-primary-600 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-primary-50" }) }));
52
+ return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx("textarea", { id: fieldId, rows: 3, value: value ?? "", onChange: (event) => onChange(event.target.value), className: "w-full rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary focus-visible:border-primary-600 focus-visible:outline-hidden focus-visible:ring-4 focus-visible:ring-primary-50" }) }));
53
53
  case "number":
54
54
  return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx(Input, { id: fieldId, type: "number", value: value ?? 0, onChange: (event) => {
55
55
  // A `type="number"` input still hands back an empty or
56
56
  // otherwise unparseable string in plenty of real situations
57
- // (cleared entirely, "-", "1e", a paste) — Number() turns
57
+ // (cleared entirely, "-", "1e", a paste): Number() turns
58
58
  // those into NaN, which must never reach the node's attrs.
59
59
  // 0 is the same documented empty-state default this field
60
60
  // (and defaultBlockParams) already uses.
@@ -65,7 +65,7 @@ function BlockParamField({ spec, value, onChange, error }) {
65
65
  case "boolean":
66
66
  return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("label", { htmlFor: fieldId, className: "text-sm font-medium text-text-primary", children: spec.label }), _jsx(Switch, { id: fieldId, checked: Boolean(value), onCheckedChange: (checked) => onChange(checked) })] }), error && (_jsx("p", { role: "alert", className: "text-xs text-danger-600", children: error }))] }));
67
67
  case "choice":
68
- return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx("select", { id: fieldId, value: value ?? "", onChange: (event) => onChange(event.target.value), className: "h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 text-sm text-text-primary focus-visible:border-primary-600 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-primary-50", children: (spec.options ?? []).map((option) => (_jsx("option", { value: option, children: option }, option))) }) }));
68
+ return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx("select", { id: fieldId, value: value ?? "", onChange: (event) => onChange(event.target.value), className: "h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 text-sm text-text-primary focus-visible:border-primary-600 focus-visible:outline-hidden focus-visible:ring-4 focus-visible:ring-primary-50", children: (spec.options ?? []).map((option) => (_jsx("option", { value: option, children: option }, option))) }) }));
69
69
  case "image":
70
70
  return (_jsxs(PropertyField, { label: spec.label, error: error, children: [_jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border-default bg-background-subtle p-2", children: [preview ? (_jsx("img", { src: preview.downloadUrl, alt: "", className: "h-10 w-10 shrink-0 rounded-md object-cover" })) : (_jsx("div", { "aria-hidden": "true", className: "h-10 w-10 shrink-0 rounded-md bg-background-hover" })), _jsx("span", { className: "flex-1 truncate text-sm text-text-secondary", children: preview?.filename ?? "No image selected" }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPickerOpen(true), children: "Change" })] }), pickerOpen && (_jsx(MediaPicker
71
71
  // A block param stores the media id and nothing else, so
@@ -83,22 +83,22 @@ function BlockParamField({ spec, value, onChange, error }) {
83
83
  return null;
84
84
  }
85
85
  }
86
- // The typed param field list, extracted out of BlockPanel (S197 Task 12 —
86
+ // The typed param field list, extracted out of BlockPanel (S197 Task 12:
87
87
  // same reasoning as StyleListbox's own extraction) so the on-page side
88
88
  // panel (apps/admin-ui's block-overlay.tsx) can render the exact same
89
- // fields inside its OWN chrome (a slide-in side panel, not this Dialog) —
90
- // the form-view/on-page distinction is only ever about the surrounding
89
+ // fields inside its OWN chrome (a slide-in side panel, not this Dialog).
90
+ // The form-view/on-page distinction is only ever about the surrounding
91
91
  // panel shell, never about how a param is edited.
92
92
  export function BlockParamFields({ listing, listingsError, params, onChange, fieldErrors }) {
93
93
  return (_jsxs(_Fragment, { children: [!listing && listingsError && _jsx("p", { className: "text-sm text-danger-600", children: listingsError }), !listing && !listingsError && (_jsx("p", { className: "text-sm text-text-secondary", children: "This block's fields couldn't be loaded. Its template declaration may be missing or the render service is unavailable." })), listing?.params.map((spec) => (_jsx(BlockParamField, { spec: spec, value: params[spec.key], onChange: (next) => onChange(spec.key, next), error: fieldErrors?.[spec.key] }, spec.key)))] }));
94
94
  }
95
95
  // The mockup's right-hand settings panel (screen 1) for the form view: a
96
- // modal over the editor (Dialog, per packages/ui — MediaPicker moved to
96
+ // modal over the editor (Dialog, per packages/ui: MediaPicker moved to
97
97
  // the newer Sheet side-drawer for its own modal in S197 QA-wave C Item 5,
98
98
  // but this panel's own content is a centered param form, not a browsing
99
99
  // UI, so Dialog is still the right shape here), focus-trapped by Radix.
100
100
  // Rendered by rich-text-view.tsx exactly
101
- // while the current selection is a NodeSelection on this block — see that
101
+ // while the current selection is a NodeSelection on this block. See that
102
102
  // file for why: the same click that selects the atom node (default
103
103
  // ProseMirror behavior for an atom+selectable node, nothing bespoke) is
104
104
  // what the mockup calls "click the block to open its settings panel", so
@@ -108,8 +108,8 @@ export function BlockPanel({ editor, pos, partial, params }) {
108
108
  const { listings, error: listingsError } = useBlockListings();
109
109
  const listing = listings.find((entry) => entry.alias === partial) ?? null;
110
110
  // "at the node's position" (S197 Task 3 brief): setNodeSelection(pos)
111
- // first so updateAttributes — which otherwise acts on whatever the
112
- // CURRENT selection happens to be — is guaranteed to target this exact
111
+ // first so updateAttributes (which otherwise acts on whatever the
112
+ // CURRENT selection happens to be) is guaranteed to target this exact
113
113
  // node, never whatever the user last clicked elsewhere. No .focus(): a
114
114
  // focus() here would yank keyboard focus out of the panel's own input
115
115
  // on every keystroke.
@@ -129,7 +129,7 @@ export function BlockPanel({ editor, pos, partial, params }) {
129
129
  // TextSelection there unconditionally (ProseMirror warns and the
130
130
  // resulting selection is unreliable). Selection.near finds the
131
131
  // nearest position that's actually valid instead.
132
- // .focus() here IS wanted — Done/Remove/Escape are all "I'm finished
132
+ // .focus() here IS wanted: Done/Remove/Escape are all "I'm finished
133
133
  // editing this block," and returning keyboard focus to the document is
134
134
  // the expected outcome, unlike updateParam's keystroke-time writes.
135
135
  editor
@@ -150,25 +150,25 @@ export function BlockPanel({ editor, pos, partial, params }) {
150
150
  if (!next)
151
151
  moveSelectionPastBlock();
152
152
  }, children: _jsxs(DialogContent, { onCloseAutoFocus: (event) => {
153
- // Radix's default is to refocus whatever triggered the dialog —
154
- // there is no trigger button here (the panel opens off a
153
+ // Radix's default is to refocus whatever triggered the dialog.
154
+ // There is no trigger button here (the panel opens off a
155
155
  // NodeSelection, not a click on some menu item), so without this
156
156
  // focus lands on <body> (admin-ui.md's dialog-focus rule).
157
157
  event.preventDefault();
158
158
  // This callback runs on a rAF after the close, by which point the
159
159
  // whole editor can already be gone (e.g. the page navigated away
160
- // while the panel was open) — commands throws on a destroyed
160
+ // while the panel was open): commands throws on a destroyed
161
161
  // editor, so this is a real guard, not defensive-for-its-own-sake.
162
162
  if (!editor.isDestroyed)
163
163
  editor.commands.focus();
164
- }, className: "flex max-h-[80vh] max-w-sm flex-col gap-0 p-0", children: [_jsxs(DialogHeader, { className: "border-b border-border-default px-4 py-3", children: [_jsxs("div", { className: "flex flex-col gap-0.5", children: [_jsx(DialogTitle, { children: listing?.name ?? partial }), _jsxs("span", { className: "font-mono text-xs text-text-tertiary", children: ["partial: ", partial, ".liquid"] })] }), _jsx(DialogCloseButton, { "aria-label": "Close" })] }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [_jsx(BlockParamFields, { listing: listing, listingsError: listingsError, params: params, onChange: updateParam }), _jsxs("p", { className: "rounded-md border border-border-default bg-background-subtle p-2 text-xs text-text-secondary", children: [_jsx("b", { className: "font-semibold text-text-primary", children: "Live preview." }), " This block is rendered by your own template on the server. What you see on the page is exactly what visitors will get."] })] }), _jsxs(DialogFooter, { className: "mt-0 justify-start border-t border-border-default p-4", children: [_jsx(Button, { type: "button", variant: "ghost", className: "text-danger-600 hover:text-danger-700", onClick: handleRemove, children: "Remove block" }), _jsx(Button, { type: "button", className: "ms-auto", onClick: moveSelectionPastBlock, children: "Done" })] })] }) }));
164
+ }, className: "flex max-h-[80vh] max-w-sm flex-col gap-0 p-0", children: [_jsxs(DialogHeader, { className: "border-b border-border-default px-4 py-3", children: [_jsxs("div", { className: "flex flex-col gap-px", children: [_jsx(DialogTitle, { children: listing?.name ?? partial }), _jsxs("span", { className: "font-mono text-xs text-text-tertiary", children: ["partial: ", partial, ".liquid"] })] }), _jsx(DialogCloseButton, { "aria-label": "Close" })] }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [_jsx(BlockParamFields, { listing: listing, listingsError: listingsError, params: params, onChange: updateParam }), _jsxs("p", { className: "rounded-md border border-border-default bg-background-subtle p-2 text-xs text-text-secondary", children: [_jsx("b", { className: "font-semibold text-text-primary", children: "Live preview." }), " This block is rendered by your own template on the server. What you see on the page is exactly what visitors will get."] })] }), _jsxs(DialogFooter, { className: "mt-0 justify-start border-t border-border-default p-4", children: [_jsx(Button, { type: "button", variant: "ghost", className: "text-danger-600 hover:text-danger-700", onClick: handleRemove, children: "Remove block" }), _jsx(Button, { type: "button", className: "ms-auto", onClick: moveSelectionPastBlock, children: "Done" })] })] }) }));
165
165
  }
166
166
  // The chip's "preview ⤢" affordance (S197 mockup screen 3): fetches
167
167
  // POST /api/manage/v1/render/block for the block's CURRENT params and shows the
168
- // returned HTML in a sandboxed iframe — sandbox="" (no tokens granted) so
168
+ // returned HTML in a sandboxed iframe (sandbox="", no tokens granted) so
169
169
  // arbitrary template markup can never run script in the admin UI.
170
170
  // Position is computed from a live viewport rect (getBoundingClientRect),
171
- // which is inherently a physical measurement — plain `top`/`left` here,
171
+ // which is inherently a physical measurement: plain `top`/`left` here,
172
172
  // not logical properties, matches how that rect is expressed.
173
173
  export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
174
174
  const fetchApi = usePluginApi();
@@ -204,9 +204,8 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
204
204
  cancelled = true;
205
205
  };
206
206
  // params is a fresh object per render (rich-text-view.tsx reads it off
207
- // node attrs each time) — comparing it by reference would refetch on
207
+ // node attrs each time): comparing it by reference would refetch on
208
208
  // every unrelated re-render, so key on its serialized form instead.
209
- // eslint-disable-next-line react-hooks/exhaustive-deps
210
209
  }, [partial, JSON.stringify(params), fetchApi]);
211
210
  useEffect(() => {
212
211
  function handlePointerDown(event) {
@@ -228,5 +227,5 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
228
227
  if (event.key === "Escape")
229
228
  onClose();
230
229
  }
231
- return (_jsxs("div", { ref: popoverRef, role: "dialog", "aria-label": `Preview: ${partial}`, onKeyDown: handleKeyDownCapture, style: { position: "fixed", top: anchorRect.bottom + 4, left: anchorRect.left }, className: "z-20 w-80 rounded-md border border-border-default bg-background-elevated p-2 shadow-xl", children: [loading && _jsx("p", { className: "text-xs text-text-secondary", children: "Loading preview\u2026" }), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), !loading && !error && (_jsx("iframe", { title: `Preview: ${partial}`, srcDoc: html ?? "", sandbox: "", className: "h-40 w-full rounded-sm border border-border-subtle bg-white" }))] }));
230
+ return (_jsxs("div", { ref: popoverRef, role: "dialog", "aria-label": `Preview: ${partial}`, onKeyDown: handleKeyDownCapture, style: { position: "fixed", top: anchorRect.bottom + 4, left: anchorRect.left }, className: "z-20 w-72 rounded-md border border-border-default bg-background-elevated p-2 shadow-xl", children: [loading && _jsx("p", { className: "text-xs text-text-secondary", children: "Loading preview\u2026" }), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), !loading && !error && (_jsx("iframe", { title: `Preview: ${partial}`, srcDoc: html ?? "", sandbox: "", className: "h-44 w-full rounded-sm border border-border-subtle bg-background-elevated" }))] }));
232
231
  }
@@ -19,7 +19,16 @@ const KardalumImage = Image.extend({
19
19
  addAttributes() {
20
20
  return {
21
21
  ...this.parent?.(),
22
- mediaId: { default: null },
22
+ // S314p (D1): read and written as data-media-id, the attribute a script's HTML carries and
23
+ // the server's conversion reads (richtext-html-entry.ts), so the editor and the conversion
24
+ // spell it one way.
25
+ mediaId: {
26
+ default: null,
27
+ parseHTML: (element) => element.getAttribute("data-media-id"),
28
+ renderHTML: (attributes) => typeof attributes.mediaId === "string" && attributes.mediaId.length > 0
29
+ ? { "data-media-id": attributes.mediaId }
30
+ : {},
31
+ },
23
32
  };
24
33
  },
25
34
  });
@@ -137,6 +137,6 @@ export function BlockInsertMenu({ onInsert, onClose }) {
137
137
  const selected = index === activeIndex;
138
138
  return (_jsxs("div", { ref: (el) => {
139
139
  optionRefs.current[index] = el;
140
- }, role: "option", "aria-selected": selected, tabIndex: selected ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => commit(index), className: cn("flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 text-sm outline-none", "focus-visible:ring-2 focus-visible:ring-primary-600", selected ? "bg-primary-100" : "text-text-primary hover:bg-background-hover"), children: [_jsx("span", { "aria-hidden": "true", className: "mt-0.5 text-text-secondary", children: "\u25EB" }), _jsxs("span", { className: "flex flex-col", children: [_jsx("span", { className: "font-medium text-text-primary", children: listing.name }), _jsxs("span", { className: "text-xs text-text-secondary", children: [listing.alias, ".liquid", listing.params.length > 0 ? ` · ${listing.params.map((param) => param.key).join(", ")}` : ""] })] })] }, listing.alias));
140
+ }, role: "option", "aria-selected": selected, tabIndex: selected ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => commit(index), className: cn("flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1 text-sm outline-hidden", "focus-visible:ring-2 focus-visible:ring-primary-600", selected ? "bg-primary-100" : "text-text-primary hover:bg-background-hover"), children: [_jsx("span", { "aria-hidden": "true", className: "mt-px text-text-secondary", children: "\u25EB" }), _jsxs("span", { className: "flex flex-col", children: [_jsx("span", { className: "font-medium text-text-primary", children: listing.name }), _jsxs("span", { className: "text-xs text-text-secondary", children: [listing.alias, ".liquid", listing.params.length > 0 ? ` · ${listing.params.map((param) => param.key).join(", ")}` : ""] })] })] }, listing.alias));
141
141
  })] }));
142
142
  }
@@ -14,7 +14,7 @@ export const KardalumBlock = Node.create({
14
14
  partial: {
15
15
  default: "",
16
16
  // The shell attribute is `data-kardalum-block`, not a bare `partial`
17
- // — parse/render both go through that one attribute so the two
17
+ // so parse/render both go through that one attribute so the two
18
18
  // never drift apart.
19
19
  parseHTML: (element) => element.getAttribute("data-kardalum-block") ?? "",
20
20
  renderHTML: () => ({}),
@@ -58,7 +58,7 @@ export const KardalumBlock = Node.create({
58
58
  return ({ node, view, getPos }) => {
59
59
  // Reassigned in `update` below so the preview button always reads
60
60
  // the block's CURRENT params (the param panel writes them back via
61
- // updateAttributes — this closure must not keep serving the params
61
+ // updateAttributes, so this closure must not keep serving the params
62
62
  // it was constructed with).
63
63
  let currentNode = node;
64
64
  const dom = document.createElement("div");
@@ -71,7 +71,7 @@ export const KardalumBlock = Node.create({
71
71
  "flex items-center gap-2 rounded-md border border-dashed border-border-default bg-background-subtle " +
72
72
  "px-3 py-2 my-3 text-xs text-text-secondary";
73
73
  // A click anywhere on the chip (other than "preview", which stops
74
- // its own mousedown below) drops a NodeSelection here explicitly —
74
+ // its own mousedown below) drops a NodeSelection here explicitly,
75
75
  // dispatched straight from the position this view already knows via
76
76
  // getPos(), rather than counting on ProseMirror's own coordinate-based
77
77
  // click-to-select for a leaf. The form-view mount (rich-text-view.tsx)
@@ -94,15 +94,15 @@ export const KardalumBlock = Node.create({
94
94
  preview.textContent = "preview ⤢";
95
95
  // mousedown (not just click) must stop here, BEFORE ProseMirror's own
96
96
  // mousedown listener on the editable root sees it (bubble phase,
97
- // target-first) — otherwise clicking "preview" would also drop a
97
+ // target-first); otherwise clicking "preview" would also drop a
98
98
  // NodeSelection on this block and pop the param panel at the same
99
99
  // time, when the mockup treats preview and "open settings" as two
100
100
  // separate affordances.
101
101
  preview.addEventListener("mousedown", (event) => event.stopPropagation());
102
102
  preview.addEventListener("click", (event) => {
103
103
  event.stopPropagation();
104
- // Plain DOM APIs only (this view has no React tree of its own —
105
- // see the file-level doc comment) — a bubbling CustomEvent is how
104
+ // Plain DOM APIs only (this view has no React tree of its own;
105
+ // see the file-level doc comment); a bubbling CustomEvent is how
106
106
  // the mount that DOES have React (rich-text-view.tsx's fetchApi,
107
107
  // its popover state) hears about the request. Any mount can listen
108
108
  // for "kardalum:preview-block" the same way, vanilla or not.
@@ -155,11 +155,11 @@ export function findKardalumBlocks(editor) {
155
155
  return found;
156
156
  }
157
157
  // Patches a single on-page block's rendered content WITHOUT touching node
158
- // attrs — html is never stored in content (S197 spec §8), this only updates
158
+ // attrs: html is never stored in content (S197 spec §8); this only updates
159
159
  // the NodeView's own DOM. A no-op if `pos` doesn't currently resolve to a
160
160
  // mounted on-page NodeView (the block may have been removed or the editor
161
161
  // destroyed between when the caller read `pos`/started its fetch and this
162
- // call landing — a real race an async fetch can hit, not defensive-for-its-
162
+ // call landing, a real race an async fetch can hit, not defensive-for-its-
163
163
  // own-sake).
164
164
  export function setBlockHtml(editor, pos, html) {
165
165
  if (editor.isDestroyed)
@@ -179,13 +179,13 @@ function escapeHtml(value) {
179
179
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
180
180
  }
181
181
  // Moves the selection to just past a block at `pos` (Task 12's on-page
182
- // panel Done/Remove/Escape actions — mirrors block-panel.tsx's own
182
+ // panel Done/Remove/Escape actions; mirrors block-panel.tsx's own
183
183
  // moveSelectionPastBlock exactly, centralized here so BOTH mounts share one
184
184
  // implementation). Selection.near, not a direct setTextSelection: when the
185
185
  // block is the document's only content, the position just past it doesn't
186
186
  // resolve into any inline content at all, and TipTap's setTextSelection
187
187
  // constructs an unreliable TextSelection there regardless (ProseMirror
188
- // warns) — Selection.near finds the nearest position that's actually valid.
188
+ // warns), so Selection.near finds the nearest position that's actually valid.
189
189
  export function moveSelectionPastBlock(editor, pos) {
190
190
  if (editor.isDestroyed)
191
191
  return;
@@ -203,7 +203,7 @@ export function moveSelectionPastBlock(editor, pos) {
203
203
  }
204
204
  // The on-page warning state (spec: a block whose params/partial fail server-
205
205
  // side validation renders as an HTML comment on the public page and "the
206
- // admin editor shows the same state as a warning chip") — fed into
206
+ // admin editor shows the same state as a warning chip"), fed into
207
207
  // setBlockHtml the same way a successful render's HTML is, so the NodeView
208
208
  // itself needs no separate notion of "unavailable," only "here is the
209
209
  // content to show."
@@ -211,17 +211,17 @@ export function unavailableBlockHtml(reason) {
211
211
  return `<div class="kardalum-block-unavailable" role="alert">Block unavailable: ${escapeHtml(reason)}</div>`;
212
212
  }
213
213
  // The on-page render mode (S197 Task 12): extends the form-view chip's node
214
- // definition unchanged (same name/attrs/parseHTML/renderHTML — a document
214
+ // definition unchanged (same name/attrs/parseHTML/renderHTML, so a document
215
215
  // authored in one mount round-trips through the other with no data loss,
216
216
  // per the brief's "ONE source of truth for the node schema"), overriding
217
217
  // only addNodeView. Where the chip shows an icon + partial name + a preview
218
218
  // affordance (there is no page here to render INTO), this NodeView shows the
219
- // block's actual fetched HTML directly in the page — initially empty until
219
+ // block's actual fetched HTML directly in the page, initially empty until
220
220
  // the caller (apps/admin-ui's BlockOverlay) fetches it and calls
221
221
  // setBlockHtml. Selecting it (click-to-open-panel, same mousedown-dispatched
222
222
  // NodeSelection idiom as the chip) is surfaced visually via the NodeView
223
223
  // lifecycle's own selectNode/deselectNode hooks (ProseMirror calls these
224
- // automatically for a selectable atom — the chip doesn't need them since it
224
+ // automatically for a selectable atom; the chip doesn't need them since it
225
225
  // has no visual "selected" state of its own beyond the panel opening).
226
226
  export const KardalumBlockOnPage = KardalumBlock.extend({
227
227
  name: "kardalumBlock",
@@ -241,8 +241,8 @@ export const KardalumBlockOnPage = KardalumBlock.extend({
241
241
  content.innerHTML = html;
242
242
  };
243
243
  // Blocks are atomic in edit mode (this file's own top comment: "a
244
- // block's internals are the template's, not the editor's, to edit") —
245
- // a click anywhere on the rendered HTML (including a real <a>/<button>
244
+ // block's internals are the template's, not the editor's, to edit"),
245
+ // so a click anywhere on the rendered HTML (including a real <a>/<button>
246
246
  // the template itself emits) opens the settings panel instead of
247
247
  // acting like a normal page. `click` is captured (not just mousedown)
248
248
  // specifically to preventDefault a real link's navigation, which
@@ -260,7 +260,7 @@ export const KardalumBlockOnPage = KardalumBlock.extend({
260
260
  return {
261
261
  dom,
262
262
  // ProseMirror calls these automatically for a selectable atom node
263
- // whenever its own NodeSelection is set/cleared — the mockup's
263
+ // whenever its own NodeSelection is set/cleared; the mockup's
264
264
  // dashed (hover) vs solid (active/selected) outline is driven by
265
265
  // this class from CSS (edit-mode.css), not by re-deriving selection
266
266
  // state by hand on every transaction.
@@ -10,10 +10,10 @@ export function StyleListbox({ styles, loading, activeStyleKey, onSelect, onClea
10
10
  const [activeIndex, setActiveIndex] = useState(0);
11
11
  const optionRefs = useRef([]);
12
12
  if (loading) {
13
- return (_jsx("div", { role: "listbox", "aria-label": "Text styles", className: "min-w-40 p-2 text-xs text-text-secondary", children: "Loading\u2026" }));
13
+ return (_jsx("div", { role: "listbox", "aria-label": "Text styles", className: "min-w-44 p-2 text-xs text-text-secondary", children: "Loading\u2026" }));
14
14
  }
15
15
  if (styles.length === 0) {
16
- return (_jsx("div", { role: "listbox", "aria-label": "Text styles", className: "min-w-40 p-2 text-xs text-text-secondary", children: "No theme styles declared" }));
16
+ return (_jsx("div", { role: "listbox", "aria-label": "Text styles", className: "min-w-44 p-2 text-xs text-text-secondary", children: "No theme styles declared" }));
17
17
  }
18
18
  function focusIndex(index) {
19
19
  setActiveIndex(index);
@@ -60,10 +60,10 @@ export function StyleListbox({ styles, loading, activeStyleKey, onSelect, onClea
60
60
  return;
61
61
  }
62
62
  }
63
- return (_jsx("div", { role: "listbox", "aria-label": "Text styles", onKeyDown: handleKeyDown, className: "min-w-40 p-1", children: options.map((option, index) => {
63
+ return (_jsx("div", { role: "listbox", "aria-label": "Text styles", onKeyDown: handleKeyDown, className: "min-w-44 p-1", children: options.map((option, index) => {
64
64
  const selected = option.kind === "style" && option.style.key === activeStyleKey;
65
65
  return (_jsx("div", { ref: (el) => {
66
66
  optionRefs.current[index] = el;
67
- }, role: "option", "aria-selected": selected, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => commit(index), className: cn("cursor-pointer rounded-sm px-2 py-1.5 text-sm outline-none", "focus-visible:ring-2 focus-visible:ring-primary-600", selected ? "bg-primary-100 text-primary-800" : "text-text-primary hover:bg-background-hover", option.kind === "clear" && "mt-1 border-t border-border-default pt-1.5 text-text-secondary"), children: option.kind === "style" ? option.style.label : "Clear style" }, option.kind === "style" ? option.style.key : "__clear__"));
67
+ }, role: "option", "aria-selected": selected, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => commit(index), className: cn("cursor-pointer rounded-sm px-2 py-1 text-sm outline-hidden", "focus-visible:ring-2 focus-visible:ring-primary-600", selected ? "bg-primary-100 text-primary-800" : "text-text-primary hover:bg-background-hover", option.kind === "clear" && "mt-1 border-t border-border-default pt-1 text-text-secondary"), children: option.kind === "style" ? option.style.label : "Clear style" }, option.kind === "style" ? option.style.key : "__clear__"));
68
68
  }) }));
69
69
  }
@@ -0,0 +1,35 @@
1
+ /** The most a rich text value given as HTML may be, in UTF-8 bytes (1 MiB). */
2
+ export declare const MAX_RICHTEXT_HTML_BYTES = 1048576;
3
+ export interface RichtextNode {
4
+ type: string;
5
+ attrs?: Record<string, unknown>;
6
+ content?: RichtextNode[];
7
+ marks?: Array<{
8
+ type: string;
9
+ attrs?: Record<string, unknown>;
10
+ }>;
11
+ text?: string;
12
+ }
13
+ export interface RichtextDocument extends RichtextNode {
14
+ type: "doc";
15
+ }
16
+ export type RichtextHtmlRefusal = "tooLarge" | "imageWithoutMedia" | "unparseable";
17
+ /**
18
+ * Why a value given as HTML cannot be stored. A plugin bundles its own copy of the SDK, so a
19
+ * caller tells it apart with isRichtextHtmlError rather than `instanceof`.
20
+ */
21
+ export declare class RichtextHtmlError extends Error {
22
+ readonly reason: RichtextHtmlRefusal;
23
+ constructor(reason: RichtextHtmlRefusal, message: string, options?: {
24
+ cause?: unknown;
25
+ });
26
+ }
27
+ export declare function isRichtextHtmlError(value: unknown): value is RichtextHtmlError;
28
+ /**
29
+ * The editor's document for `html`. Refuses (RichtextHtmlError) a value over
30
+ * MAX_RICHTEXT_HTML_BYTES, checked before anything is parsed, and an image that names no media
31
+ * item: the editor's image node carries a media id, which cannot be guessed from a `src`, and
32
+ * dropping the image would lose content without a word (spec C3). Whether the id names a real
33
+ * item is the caller's question: this package holds no media library.
34
+ */
35
+ export declare function richtextFromHtml(html: string): RichtextDocument;
@@ -0,0 +1,73 @@
1
+ // S314p (D1): a rich text value written as HTML, turned into the editor's stored JSON. The server
2
+ // imports this subpath (in plain Node, lazily), so it parses with TipTap's own HTML parser over a
3
+ // real DOM implementation and the editor's own extension list: the conversion can never hold a
4
+ // node or mark the editor cannot, and never runs a regular expression over untrusted text.
5
+ //
6
+ // Node-safe: @tiptap/html's server entry builds a happy-dom Window with script evaluation, script
7
+ // and CSS loading and iframes switched off, and closes it after every call. Nothing here imports
8
+ // React, and the extensions' node views are never called by a parser.
9
+ import { generateJSON } from "@tiptap/html/server";
10
+ import { buildRichtextExtensions } from "./richtext/extensions.js";
11
+ /** The most a rich text value given as HTML may be, in UTF-8 bytes (1 MiB). */
12
+ export const MAX_RICHTEXT_HTML_BYTES = 1_048_576;
13
+ /**
14
+ * Why a value given as HTML cannot be stored. A plugin bundles its own copy of the SDK, so a
15
+ * caller tells it apart with isRichtextHtmlError rather than `instanceof`.
16
+ */
17
+ export class RichtextHtmlError extends Error {
18
+ reason;
19
+ constructor(reason, message, options) {
20
+ super(message, options);
21
+ this.name = "RichtextHtmlError";
22
+ this.reason = reason;
23
+ }
24
+ }
25
+ export function isRichtextHtmlError(value) {
26
+ if (typeof value !== "object" || value === null)
27
+ return false;
28
+ const candidate = value;
29
+ return (candidate.name === "RichtextHtmlError" &&
30
+ (candidate.reason === "tooLarge" || candidate.reason === "imageWithoutMedia" || candidate.reason === "unparseable") &&
31
+ typeof candidate.message === "string");
32
+ }
33
+ let extensions = null;
34
+ /**
35
+ * The editor's document for `html`. Refuses (RichtextHtmlError) a value over
36
+ * MAX_RICHTEXT_HTML_BYTES, checked before anything is parsed, and an image that names no media
37
+ * item: the editor's image node carries a media id, which cannot be guessed from a `src`, and
38
+ * dropping the image would lose content without a word (spec C3). Whether the id names a real
39
+ * item is the caller's question: this package holds no media library.
40
+ */
41
+ export function richtextFromHtml(html) {
42
+ const bytes = new TextEncoder().encode(html).length;
43
+ if (bytes > MAX_RICHTEXT_HTML_BYTES) {
44
+ throw new RichtextHtmlError("tooLarge", `The HTML is ${bytes} bytes; a rich text value takes at most ${MAX_RICHTEXT_HTML_BYTES} bytes (1 MiB).`);
45
+ }
46
+ extensions ??= buildRichtextExtensions();
47
+ let doc;
48
+ try {
49
+ doc = generateJSON(html, extensions);
50
+ }
51
+ catch (error) {
52
+ // The parser recurses over the HTML's depth, so deeply nested input under the size cap can
53
+ // overflow the stack. Any parse failure is a refusal of the value, never an untyped throw.
54
+ if (isRichtextHtmlError(error))
55
+ throw error;
56
+ throw new RichtextHtmlError("unparseable", "The HTML could not be read: it nests too deeply or is malformed.", { cause: error });
57
+ }
58
+ // The walk below is iterative (an explicit stack), so it has no depth limit of its own; the
59
+ // parser's own depth limit is caught above as "unparseable".
60
+ const pending = [doc];
61
+ while (pending.length > 0) {
62
+ const node = pending.pop();
63
+ if (node.type === "image") {
64
+ const mediaId = node.attrs?.mediaId;
65
+ if (typeof mediaId !== "string" || mediaId.length === 0) {
66
+ throw new RichtextHtmlError("imageWithoutMedia", "An image in rich text comes from the media library: give the <img> a data-media-id that names a media item.");
67
+ }
68
+ }
69
+ if (Array.isArray(node.content))
70
+ pending.push(...node.content);
71
+ }
72
+ return doc;
73
+ }
@@ -39,6 +39,8 @@ export interface ScopedStructuredStorage {
39
39
  transaction(fn: (tx: StructuredStorageTransaction) => Promise<void>): Promise<void>;
40
40
  }
41
41
  import type { Entitlement } from "./entitlement-types.js";
42
+ import type { PluginNotify } from "./notify.js";
43
+ import type { PluginVendorService } from "./vendor-service.js";
42
44
  export interface PublishedContent {
43
45
  id: string;
44
46
  documentTypeId: string;
@@ -58,4 +60,13 @@ export interface PluginApiRouteContext {
58
60
  * `@kardalum/plugin-sdk/entitlement`; a thrown EntitlementError
59
61
  * answers 403 `{ code: "entitlement", reason }`. */
60
62
  entitlement: Entitlement;
63
+ /** S318: true while the plugin's licence term is lapsed: the host refuses its writes (403 plugin_read_only), so a route or hook can skip them. Set by the host; absent reads as false. */
64
+ readOnly?: boolean;
65
+ /** S314n3: sends a notification to people in the admin. Present only for a plugin that
66
+ * declares `contributions.notifications: true` and is active; a refusal throws
67
+ * NotificationRefusedError (check it with `isNotificationRefusedError`). */
68
+ notify?: PluginNotify;
69
+ /** S320: calls the plugin's declared vendor service with a 5-minute licence
70
+ * token. Present only when the manifest declares `vendorService`. */
71
+ vendorService?: PluginVendorService;
61
72
  }
package/dist/tailwind.js CHANGED
@@ -1,5 +1,12 @@
1
- // The `@kardalum/plugin-sdk/tailwind` subpath: the Tailwind theme preset
1
+ // The `@kardalum/plugin-sdk/tailwind` subpath: the Tailwind 3 theme
2
2
  // generated from the design tokens, for a plugin whose UI is styled with
3
- // Tailwind. Use it as `theme` in the plugin's tailwind.config, the way the
4
- // admin does, so the plugin's classes map to the same CSS variables.
3
+ // Tailwind 3. Use it as `theme` in the plugin's tailwind.config, so the
4
+ // plugin's classes map to the same CSS variables as the admin's.
5
+ //
6
+ // On Tailwind 4, import `@kardalum/plugin-sdk/tailwind/theme.css` between
7
+ // `@import "tailwindcss/theme.css" layer(theme);` and
8
+ // `@import "tailwindcss/utilities.css" layer(utilities);` (never the whole
9
+ // `@import "tailwindcss"`, whose base reset would leak into the admin): the
10
+ // same scales as an `@theme` block, generated from the same source. It only
11
+ // references variables, so a standalone preview also needs `tokens.css`.
5
12
  export { tailwindTheme } from "@kardalum/design-tokens";