@kardalum/plugin-sdk 0.0.0-stage → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/LICENSE +202 -0
  3. package/README.md +70 -2
  4. package/dist/admin-section-registry.d.ts +34 -0
  5. package/dist/admin-section-registry.js +49 -0
  6. package/dist/built-in-serializers.d.ts +3 -0
  7. package/dist/built-in-serializers.js +18 -0
  8. package/dist/built-in-settings-schemas.d.ts +14 -0
  9. package/dist/built-in-settings-schemas.js +225 -0
  10. package/dist/built-in-value-schemas.d.ts +4 -0
  11. package/dist/built-in-value-schemas.js +47 -0
  12. package/dist/built-ins.d.ts +1 -0
  13. package/dist/built-ins.js +257 -0
  14. package/dist/capabilities.d.ts +99 -0
  15. package/dist/capabilities.js +363 -0
  16. package/dist/data-type-plugin.d.ts +28 -0
  17. package/dist/data-type-plugin.js +1 -0
  18. package/dist/datatype-validation.d.ts +26 -0
  19. package/dist/datatype-validation.js +110 -0
  20. package/dist/datatypes-entry.d.ts +4 -0
  21. package/dist/datatypes-entry.js +18 -0
  22. package/dist/define-plugin.d.ts +25 -0
  23. package/dist/define-plugin.js +51 -0
  24. package/dist/entitlement-entry.d.ts +5 -0
  25. package/dist/entitlement-entry.js +24 -0
  26. package/dist/entitlement-gate.d.ts +36 -0
  27. package/dist/entitlement-gate.js +201 -0
  28. package/dist/entitlement-types.d.ts +39 -0
  29. package/dist/entitlement-types.js +1 -0
  30. package/dist/entitlement.d.ts +57 -0
  31. package/dist/entitlement.js +170 -0
  32. package/dist/host-entry.d.ts +1 -0
  33. package/dist/host-entry.js +11 -0
  34. package/dist/icon-name.d.ts +1 -0
  35. package/dist/icon-name.js +1 -0
  36. package/dist/icons.d.ts +2 -0
  37. package/dist/icons.js +10 -0
  38. package/dist/index.d.ts +28 -0
  39. package/dist/index.js +93 -0
  40. package/dist/license-verdict-keys.d.ts +18 -0
  41. package/dist/license-verdict-keys.js +22 -0
  42. package/dist/local-host.d.ts +3 -0
  43. package/dist/local-host.js +38 -0
  44. package/dist/manifest-entry.d.ts +8 -0
  45. package/dist/manifest-entry.js +13 -0
  46. package/dist/manifest-schema.d.ts +408 -0
  47. package/dist/manifest-schema.js +774 -0
  48. package/dist/manifest.d.ts +546 -0
  49. package/dist/manifest.js +86 -0
  50. package/dist/media/media-picker.d.ts +39 -0
  51. package/dist/media/media-picker.js +438 -0
  52. package/dist/media/upload-error.d.ts +12 -0
  53. package/dist/media/upload-error.js +30 -0
  54. package/dist/plugin-context.d.ts +75 -0
  55. package/dist/plugin-context.js +70 -0
  56. package/dist/plugin-screen-context.d.ts +40 -0
  57. package/dist/plugin-screen-context.js +16 -0
  58. package/dist/register-built-ins.d.ts +1 -0
  59. package/dist/register-built-ins.js +41 -0
  60. package/dist/registry.d.ts +4 -0
  61. package/dist/registry.js +17 -0
  62. package/dist/rendition-eligibility.d.ts +24 -0
  63. package/dist/rendition-eligibility.js +40 -0
  64. package/dist/richtext/block-panel.d.ts +27 -0
  65. package/dist/richtext/block-panel.js +232 -0
  66. package/dist/richtext/extensions.d.ts +19 -0
  67. package/dist/richtext/extensions.js +56 -0
  68. package/dist/richtext/insert-menu.d.ts +24 -0
  69. package/dist/richtext/insert-menu.js +142 -0
  70. package/dist/richtext/kardalum-block.d.ts +33 -0
  71. package/dist/richtext/kardalum-block.js +282 -0
  72. package/dist/richtext/style-listbox.d.ts +10 -0
  73. package/dist/richtext/style-listbox.js +69 -0
  74. package/dist/richtext/text-style-class.d.ts +18 -0
  75. package/dist/richtext/text-style-class.js +36 -0
  76. package/dist/simple-storage-value-provider.d.ts +9 -0
  77. package/dist/simple-storage-value-provider.js +96 -0
  78. package/dist/structured-storage-types.d.ts +61 -0
  79. package/dist/structured-storage-types.js +11 -0
  80. package/dist/tailwind.d.ts +1 -0
  81. package/dist/tailwind.js +5 -0
  82. package/dist/tokens/system-dark.css +75 -0
  83. package/dist/tokens/tokens.css +239 -0
  84. package/dist/tokens/tokens.json +212 -0
  85. package/dist/tokens.d.ts +1 -0
  86. package/dist/tokens.js +11 -0
  87. package/dist/ui-entry.d.ts +5 -0
  88. package/dist/ui-entry.js +42 -0
  89. package/dist/views/content-list-preview.d.ts +1 -0
  90. package/dist/views/content-list-preview.js +14 -0
  91. package/dist/views/content-list-settings-view.d.ts +1 -0
  92. package/dist/views/content-list-settings-view.js +97 -0
  93. package/dist/views/content-list-view.d.ts +19 -0
  94. package/dist/views/content-list-view.js +248 -0
  95. package/dist/views/crop-view.d.ts +55 -0
  96. package/dist/views/crop-view.js +161 -0
  97. package/dist/views/date-range-view.d.ts +6 -0
  98. package/dist/views/date-range-view.js +55 -0
  99. package/dist/views/file-upload-view.d.ts +43 -0
  100. package/dist/views/file-upload-view.js +104 -0
  101. package/dist/views/html-code-editor.d.ts +10 -0
  102. package/dist/views/html-code-editor.js +101 -0
  103. package/dist/views/html-view.d.ts +3 -0
  104. package/dist/views/html-view.js +53 -0
  105. package/dist/views/image-view.d.ts +3 -0
  106. package/dist/views/image-view.js +387 -0
  107. package/dist/views/rich-text-view.d.ts +2 -0
  108. package/dist/views/rich-text-view.js +429 -0
  109. package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
  110. package/node_modules/@kardalum/api-schemas/README.md +56 -0
  111. package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
  112. package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
  113. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +5 -0
  114. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +6 -0
  115. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +75 -0
  116. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +36 -0
  117. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
  118. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
  119. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
  120. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
  121. package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
  122. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +537 -0
  124. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +353 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content-path.js +256 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
  130. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +151 -0
  132. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
  133. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
  134. package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
  136. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
  137. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +302 -0
  138. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +97 -0
  139. package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
  140. package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
  141. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +36 -0
  142. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
  143. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
  144. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
  145. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +296 -0
  146. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
  147. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
  148. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
  149. package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
  150. package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
  151. package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
  152. package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
  153. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +102 -0
  154. package/node_modules/@kardalum/api-schemas/dist/index.js +58 -0
  155. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
  156. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
  157. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +381 -0
  158. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +197 -0
  159. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +167 -0
  160. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +214 -0
  161. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
  162. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
  163. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
  164. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
  165. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
  166. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
  167. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
  168. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
  169. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
  170. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
  171. package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
  172. package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
  173. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
  174. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
  175. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
  176. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
  177. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +169 -0
  178. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +80 -0
  179. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
  180. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
  181. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +89 -0
  182. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +134 -0
  183. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
  184. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
  185. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +369 -0
  186. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +393 -0
  187. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +22 -0
  188. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +87 -0
  189. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
  190. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
  191. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
  192. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
  193. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +306 -0
  194. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +328 -0
  195. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
  196. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
  197. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
  198. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
  199. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
  200. package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
  201. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +90 -0
  202. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +69 -0
  203. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
  204. package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
  205. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +108 -0
  206. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +93 -0
  207. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
  208. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
  209. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +43 -0
  210. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +25 -0
  211. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
  212. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
  213. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
  214. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
  215. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
  216. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
  217. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
  218. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
  219. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +89 -0
  220. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +68 -0
  221. package/node_modules/@kardalum/api-schemas/package.json +35 -0
  222. package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
  223. package/node_modules/@kardalum/design-tokens/README.md +29 -0
  224. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
  225. package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
  226. package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
  227. package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
  228. package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
  229. package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
  230. package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
  231. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
  232. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
  233. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
  234. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
  235. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
  236. package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
  237. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
  238. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
  239. package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
  240. package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
  241. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
  242. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
  243. package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
  244. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
  245. package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
  246. package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
  247. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
  248. package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
  249. package/node_modules/@kardalum/design-tokens/package.json +42 -0
  250. package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
  251. package/node_modules/@kardalum/plugin-package/README.md +71 -0
  252. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
  253. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
  254. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
  255. package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
  256. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
  257. package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
  258. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
  259. package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
  260. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -0
  261. package/node_modules/@kardalum/plugin-package/dist/index.js +7 -0
  262. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
  263. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
  264. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
  265. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
  266. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +1 -0
  267. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +17 -0
  268. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +45 -0
  269. package/node_modules/@kardalum/plugin-package/dist/types.js +1 -0
  270. package/node_modules/@kardalum/plugin-package/package.json +49 -0
  271. package/node_modules/@kardalum/ui/LICENSE +202 -0
  272. package/node_modules/@kardalum/ui/README.md +35 -0
  273. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
  274. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
  275. package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
  276. package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
  277. package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
  278. package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
  279. package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
  280. package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
  281. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
  282. package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
  283. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
  284. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
  285. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
  286. package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
  287. package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
  288. package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
  289. package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
  290. package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
  291. package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
  292. package/node_modules/@kardalum/ui/dist/components/property-field.js +86 -0
  293. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
  294. package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
  295. package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
  296. package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
  297. package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
  298. package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
  299. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
  300. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
  301. package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
  302. package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
  303. package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
  304. package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
  305. package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
  306. package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
  307. package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
  308. package/node_modules/@kardalum/ui/dist/index.js +18 -0
  309. package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
  310. package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
  311. package/node_modules/@kardalum/ui/package.json +63 -0
  312. package/package.json +146 -4
@@ -0,0 +1,387 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useId, useRef, useState } from "react";
3
+ import { CROP_EDITOR_ID, CropSettingsSchema, renditionName, renditionShape, THUMBNAIL_EDITOR_ID, ThumbnailSettingsSchema, } from "@kardalum/api-schemas";
4
+ import { Button, cn, Input, PropertyField, usePropertyFieldControl } from "@kardalum/ui";
5
+ import { MediaPicker } from "../media/media-picker.js";
6
+ import { uploadFailureMessage } from "../media/upload-error.js";
7
+ import { usePluginApi, usePluginSettings, usePluginSettingsValue, usePluginValue, } from "../plugin-context.js";
8
+ // downloadUrl is the stable app path for a public item (S186c §1/§3) but
9
+ // carries a freshly minted, short-lived `?token=` for a private one —
10
+ // never persisted; refetch GET /api/media/:id whenever the field's value
11
+ // (media id) changes rather than caching one, so a private item's
12
+ // preview always has a live token.
13
+ //
14
+ // The crop is read from GET /api/media/:id/renditions, and only when the
15
+ // field asks for one. That listing is the renditions of the item's
16
+ // CURRENT version with the version beside them, which is the same
17
+ // question the renderer answers at read time, so what this view names is
18
+ // what the page will really serve. It is a second request, deliberately:
19
+ // the item response says nothing about crops, and naming a file the
20
+ // picture may not have is worse than one more read on a field that has
21
+ // just changed.
22
+ function useMediaPreview(mediaId, rendition) {
23
+ const fetchApi = usePluginApi();
24
+ const [preview, setPreview] = useState(null);
25
+ const [loading, setLoading] = useState(false);
26
+ const [error, setError] = useState(null);
27
+ useEffect(() => {
28
+ if (!mediaId) {
29
+ setPreview(null);
30
+ setError(null);
31
+ return;
32
+ }
33
+ let cancelled = false;
34
+ setLoading(true);
35
+ setError(null);
36
+ const item = fetchApi(`/api/media/${mediaId}`).then(async (response) => {
37
+ if (!response.ok)
38
+ throw new Error(`Failed to load media (${response.status})`);
39
+ return (await response.json());
40
+ });
41
+ // A failed crop read resolves to "unknown" rather than rejecting: the
42
+ // picture is still the picture, and the facts below then name the
43
+ // file's own name, which is what the renderer falls back to anyway.
44
+ // Only the item read can empty this field's preview. What a failure
45
+ // must NOT do is answer the question it failed to ask, which is why
46
+ // "could not ask" and "asked, and there is none" are different states
47
+ // here (see ResolvedCut).
48
+ const cut = rendition === null
49
+ ? Promise.resolve({ state: "unknown" })
50
+ : fetchApi(`/api/media/${mediaId}/renditions`)
51
+ .then(async (response) => {
52
+ if (!response.ok)
53
+ return { state: "unknown" };
54
+ const body = (await response.json());
55
+ const found = body.items.find((item) => item.name === rendition);
56
+ return found ? { state: "found", name: found.name, filename: found.filename } : { state: "absent" };
57
+ })
58
+ .catch(() => ({ state: "unknown" }));
59
+ Promise.all([item, cut])
60
+ .then(([body, found]) => {
61
+ if (!cancelled)
62
+ setPreview({ filename: body.filename, downloadUrl: body.downloadUrl, cut: found });
63
+ })
64
+ .catch((err) => {
65
+ if (!cancelled)
66
+ setError(err instanceof Error ? err.message : String(err));
67
+ })
68
+ .finally(() => {
69
+ if (!cancelled)
70
+ setLoading(false);
71
+ });
72
+ return () => {
73
+ cancelled = true;
74
+ };
75
+ }, [mediaId, rendition, fetchApi]);
76
+ return { preview, loading, error };
77
+ }
78
+ // Sized by the caller: the read-only view shows the picture on its own and
79
+ // keeps the size it has always had, while the input view's sits in a card
80
+ // beside the file's name and the controls (approved mockup, screen 4).
81
+ function PreviewImage({ preview, className }) {
82
+ return (_jsx("img", { src: preview.downloadUrl, alt: preview.filename, className: cn("shrink-0 rounded-md border border-border-default object-cover", className) }));
83
+ }
84
+ function ImageThumbnail({ mediaId }) {
85
+ const { preview, loading, error } = useMediaPreview(mediaId, null);
86
+ if (!mediaId)
87
+ return null;
88
+ if (loading)
89
+ return _jsx("p", { className: "text-xs text-text-secondary", children: "Loading\u2026" });
90
+ if (error)
91
+ return _jsx("p", { className: "text-xs text-danger-600", children: error });
92
+ if (!preview)
93
+ return null;
94
+ return _jsx(PreviewImage, { preview: preview, className: "h-24 w-24" });
95
+ }
96
+ /** The setting as a question: a name the field is asking for, or nothing.
97
+ * An empty string is nothing, the same normalisation `resolveMediaUrl`
98
+ * makes on the server, so the two sides cannot disagree about what was
99
+ * asked. */
100
+ function requestedRendition(settings) {
101
+ return typeof settings.rendition === "string" && settings.rendition.length > 0 ? settings.rendition : null;
102
+ }
103
+ // The picture the field holds, named by what the page will actually show
104
+ // (approved mockup, screen 4). With the crop present that is the crop's
105
+ // own filename plus the line saying where it came from; with the crop
106
+ // genuinely missing the file's own name and the drawer's own "full image"
107
+ // marker, so the same fallback reads the same way on both surfaces. With
108
+ // the question unanswered it is the file's own name and nothing else: a
109
+ // marker we cannot stand behind is worse than no marker.
110
+ //
111
+ // THE "3x4 of espresso-bar.jpg" LINE SAYS THE NAME, not the shape the
112
+ // hint below decodes it to. It is there to explain the `_3x4` in the
113
+ // filename on the line directly above it, and a line that explained it as
114
+ // something the filename does not say would not be an explanation.
115
+ //
116
+ // NEITHER LINE SAYS THE CROP FIELD'S OWN CAPTION ("Portrait"), which the
117
+ // mockup shows. That caption lives on a field of a MEDIA document type.
118
+ // Nothing on this surface can reach it: the field's settings store a name
119
+ // and only a name (ImageSettingsSchema), and two media types may each
120
+ // carry a 3:4 crop under different captions, which makes a derived label
121
+ // confidently wrong. The settings view below, which reads those types to
122
+ // fill its select, is the one place in this file where the caption is
123
+ // known at all.
124
+ function PictureFacts({ preview }) {
125
+ const cut = preview.cut;
126
+ return (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-mono text-xs text-text-primary", dir: "auto", children: cut.state === "found" ? cut.filename : preview.filename }), cut.state === "found" && (_jsx("span", { className: "block truncate text-xs text-text-tertiary", dir: "auto", children: `${cut.name} of ${preview.filename}` })), cut.state === "absent" && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: "full image" }))] }));
127
+ }
128
+ export function ImageInputView() {
129
+ const { value, onChange } = usePluginValue();
130
+ const settings = usePluginSettings();
131
+ const field = usePropertyFieldControl();
132
+ const fetchApi = usePluginApi();
133
+ const [uploading, setUploading] = useState(false);
134
+ const [error, setError] = useState(null);
135
+ const [picking, setPicking] = useState(false);
136
+ const uploadInputRef = useRef(null);
137
+ const hintId = useId();
138
+ const rendition = requestedRendition(settings);
139
+ const { preview, loading, error: previewError } = useMediaPreview(value, rendition);
140
+ // The field's own hint joins whatever the host's PropertyField already
141
+ // pointed the control at, rather than replacing it: the host describes
142
+ // the field, this describes the shape it asks for.
143
+ const describedBy = [field["aria-describedby"], rendition !== null ? hintId : null].filter(Boolean).join(" ") || undefined;
144
+ async function handleFileChange(event) {
145
+ const file = event.target.files?.[0];
146
+ event.target.value = ""; // lets the same file be re-selected later
147
+ if (!file)
148
+ return;
149
+ setError(null);
150
+ // The field's own limit, honoured as a COURTESY and no longer as the
151
+ // rule (S234d Task 8). The rule is the file upload data type's
152
+ // `maxSizeBytes`, kept on the server, because that is where the bytes
153
+ // arrive: this check runs in one browser on one of the several ways
154
+ // into the library, so nothing can depend on it having run. What it
155
+ // buys is that a file this field would refuse anyway never leaves the
156
+ // machine. Both numbers, same as the server's refusal, so a person
157
+ // knows by how much they are over either way.
158
+ if (settings.maxSizeBytes != null && file.size > settings.maxSizeBytes) {
159
+ setError(`File is too large (${file.size} bytes): the configured limit is ${settings.maxSizeBytes} bytes.`);
160
+ return;
161
+ }
162
+ setUploading(true);
163
+ try {
164
+ const formData = new FormData();
165
+ formData.append("file", file);
166
+ const response = await fetchApi("/api/media", { method: "POST", body: formData });
167
+ // The server's own sentence, not a status code: it may be refusing
168
+ // these bytes for the file upload type's limit, which this field
169
+ // knows nothing about, and that refusal names the limit and the
170
+ // size (S234d Task 8).
171
+ if (!response.ok)
172
+ throw new Error(await uploadFailureMessage(response));
173
+ const media = (await response.json());
174
+ onChange(media.id);
175
+ }
176
+ catch (err) {
177
+ setError(err instanceof Error ? err.message : String(err));
178
+ }
179
+ finally {
180
+ setUploading(false);
181
+ }
182
+ }
183
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: cn("flex items-center gap-3", value && "rounded-md border border-border-default bg-background-subtle p-3"), children: [value &&
184
+ (loading ? (_jsx("p", { className: "text-xs text-text-secondary", children: "Loading\u2026" })) : previewError ? (_jsx("p", { className: "text-xs text-danger-600", children: previewError })) : preview ? (_jsxs(_Fragment, { children: [_jsx(PreviewImage, { preview: preview, className: "h-16 w-16" }), _jsx(PictureFacts, { preview: preview })] })) : null), _jsxs("div", { ...field, role: "group", "aria-describedby": describedBy, className: cn("flex shrink-0 items-center gap-2", value && "ms-auto"), children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPicking(true), children: "Choose" }), _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: uploading, onClick: () => uploadInputRef.current?.click(), children: uploading ? "Uploading…" : "Upload" }), value && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: uploading, onClick: () => onChange(null), children: "Remove" }))] })] }), _jsx("input", { ref: uploadInputRef, type: "file", className: "hidden", accept: settings.acceptedTypes && settings.acceptedTypes.length > 0 ? settings.acceptedTypes.join(",") : "image/*", "aria-label": "Upload an image", disabled: uploading, onChange: (e) => void handleFileChange(e) }), rendition !== null && (_jsx("p", { id: hintId, className: "text-xs text-text-tertiary", children: `This field asks for the ${renditionShape(rendition)} rendition. An image without one is shown at full size.` })), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), picking && (_jsx(MediaPicker
185
+ // The field stores one media id and has nowhere to put alt text,
186
+ // so a pick commits and the drawer closes in one gesture. Rich
187
+ // text passes true, because there the alt lives on the node.
188
+ , {
189
+ // The field stores one media id and has nowhere to put alt text,
190
+ // so a pick commits and the drawer closes in one gesture. Rich
191
+ // text passes true, because there the alt lives on the node.
192
+ collectAlt: false, acceptedTypes: settings.acceptedTypes, rendition: rendition ?? undefined, onPick: (item) => onChange(item.id), onClose: () => setPicking(false) }))] }));
193
+ }
194
+ // --- The crops a webmaster can choose from (S234d Task 7b) ---------------
195
+ //
196
+ // A media document type declares its crops as FIELDS, and each field's
197
+ // data type holds the settings the crop's name is derived from. So the
198
+ // list of shapes an image field may ask for is those two listings read
199
+ // together: every media type's fields, resolved against the data types,
200
+ // named by `renditionName`, which is the one thing in the product that
201
+ // derives a rendition name.
202
+ //
203
+ // A VIEW FETCHING IS NOT NEW HERE: media-picker.tsx in this same package
204
+ // reads the media library through the host's fetch, and this follows it,
205
+ // including what it does when a read fails (say so verbatim, and go on
206
+ // showing whatever is still true).
207
+ // The listing endpoints' own maximum page size, so the common case is one
208
+ // request each.
209
+ const TYPE_PAGE_LIMIT = 100;
210
+ // How many pages either listing is followed for. Both are cursor
211
+ // paginated and neither offers a kind filter, so the media types have to
212
+ // be found among all of them. The cap is a guard against a cursor that
213
+ // never ends rather than a real ceiling: it is 2000 document types, and a
214
+ // site with more than that has a list this select could not usefully show
215
+ // anyway. Hitting it is REPORTED rather than swallowed (see
216
+ // ListingPages.complete): a list cut short is still a list of real
217
+ // crops, but it cannot be read as the whole set.
218
+ const TYPE_PAGE_CAP = 20;
219
+ const SELECT_CLASS = "h-10 w-full rounded-md border border-border-strong bg-background-elevated px-2 text-sm text-text-primary " +
220
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600";
221
+ /** Every page of a cursor-paginated listing, up to the cap above. Both
222
+ * listings are small, admin-only and read once when this view mounts.
223
+ *
224
+ * One function for both because both answer in the same shape:
225
+ * DocumentTypeListResponseSchema and DataTypeListResponseSchema are each
226
+ * `{ items, nextCursor }` over the same `{ cursor, limit }` query. */
227
+ async function readAllPages(fetchApi, path, what) {
228
+ const all = [];
229
+ let cursor = null;
230
+ for (let page = 0; page < TYPE_PAGE_CAP; page += 1) {
231
+ const params = new URLSearchParams();
232
+ params.set("limit", String(TYPE_PAGE_LIMIT));
233
+ if (cursor)
234
+ params.set("cursor", cursor);
235
+ const response = await fetchApi(`${path}?${params.toString()}`);
236
+ if (!response.ok)
237
+ throw new Error(`Failed to load ${what} (${response.status})`);
238
+ const body = (await response.json());
239
+ all.push(...body.items);
240
+ cursor = body.nextCursor;
241
+ if (cursor === null)
242
+ return { items: all, complete: true };
243
+ }
244
+ return { items: all, complete: false };
245
+ }
246
+ /** The rendition name a data type produces, or null when it is not a
247
+ * rendition editor at all or its settings do not parse.
248
+ *
249
+ * The settings go through the same Zod schemas the server validates them
250
+ * with rather than being read member by member, exactly as the admin's
251
+ * Crops tab does it: `renditionName` takes a PARSED settings object, and
252
+ * settings that do not parse are a crop nothing can cut, which is not a
253
+ * shape to offer anyone. */
254
+ function renditionNameOf(dataType) {
255
+ if (dataType.editorId === THUMBNAIL_EDITOR_ID) {
256
+ const settings = ThumbnailSettingsSchema.safeParse(dataType.settings);
257
+ return settings.success ? renditionName({ editorId: THUMBNAIL_EDITOR_ID, settings: settings.data }) : null;
258
+ }
259
+ if (dataType.editorId === CROP_EDITOR_ID) {
260
+ const settings = CropSettingsSchema.safeParse(dataType.settings);
261
+ return settings.success ? renditionName({ editorId: CROP_EDITOR_ID, settings: settings.data }) : null;
262
+ }
263
+ return null;
264
+ }
265
+ /** The crops of every media document type, in the order the types and
266
+ * their fields are declared in. A type with no crop field contributes no
267
+ * group at all rather than an empty one. */
268
+ function collectRenditionChoices(documentTypes, dataTypes) {
269
+ const byId = new Map(dataTypes.map((dataType) => [dataType.id, dataType]));
270
+ const groups = [];
271
+ for (const documentType of documentTypes) {
272
+ if (documentType.kind !== "media")
273
+ continue;
274
+ const choices = [];
275
+ for (const field of documentType.fields) {
276
+ const dataType = byId.get(field.datatypeId);
277
+ if (!dataType)
278
+ continue;
279
+ const name = renditionNameOf(dataType);
280
+ if (name === null)
281
+ continue;
282
+ choices.push({ fieldId: field.id, caption: field.name, name });
283
+ }
284
+ if (choices.length > 0)
285
+ groups.push({ typeId: documentType.id, typeName: documentType.name, choices });
286
+ }
287
+ return groups;
288
+ }
289
+ function useRenditionChoices() {
290
+ const fetchApi = usePluginApi();
291
+ const [groups, setGroups] = useState([]);
292
+ const [loading, setLoading] = useState(true);
293
+ const [error, setError] = useState(null);
294
+ // Both listings have to have been read to the end before an absence
295
+ // from the result means anything. Either one stopping at the cap makes
296
+ // the crops found a SUBSET of the crops declared.
297
+ const [complete, setComplete] = useState(true);
298
+ useEffect(() => {
299
+ let cancelled = false;
300
+ setLoading(true);
301
+ setError(null);
302
+ setComplete(true);
303
+ Promise.all([
304
+ readAllPages(fetchApi, "/api/document-types", "document types"),
305
+ readAllPages(fetchApi, "/api/data-types", "data types"),
306
+ ])
307
+ .then(([documentTypes, dataTypes]) => {
308
+ if (cancelled)
309
+ return;
310
+ setGroups(collectRenditionChoices(documentTypes.items, dataTypes.items));
311
+ setComplete(documentTypes.complete && dataTypes.complete);
312
+ })
313
+ .catch((err) => {
314
+ if (!cancelled)
315
+ setError(err instanceof Error ? err.message : String(err));
316
+ })
317
+ .finally(() => {
318
+ if (!cancelled)
319
+ setLoading(false);
320
+ });
321
+ return () => {
322
+ cancelled = true;
323
+ };
324
+ }, [fetchApi]);
325
+ return { groups, loading, error, complete };
326
+ }
327
+ // Rendered by the Data Types editor only — a settings-EDITING view (see
328
+ // TextSettingsView in built-ins.tsx for the same pattern/rationale).
329
+ // acceptedTypes is edited as a comma-separated string (no multi-select
330
+ // widget precedent in this codebase) and parsed to string[] on change.
331
+ //
332
+ // `rendition` IS A SELECT AND NEVER A TEXT BOX. The value is a rendition
333
+ // name a webmaster has never seen: typing "3:4" where the name is "3x4"
334
+ // fails silently, because no rendition answers to that name and the field
335
+ // simply falls back to the full image with nothing to say why. A list of
336
+ // the crops the site actually declares cannot be misspelled.
337
+ export function ImageSettingsView() {
338
+ const { value: settings, onChange } = usePluginSettingsValue();
339
+ const { groups, loading, error, complete } = useRenditionChoices();
340
+ const noticeId = useId();
341
+ const rendition = requestedRendition(settings);
342
+ const listed = groups.some((group) => group.choices.some((choice) => choice.name === rendition));
343
+ // Whether the question has been answered at all. It decides what this
344
+ // view is entitled to say about a stored name it did not find: with
345
+ // both listings read to the end, nothing declares it; with a read
346
+ // failed, still in flight, or stopped at the page cap, we simply do not
347
+ // know yet, because the crop may be declared on a type this view never
348
+ // saw.
349
+ const settled = !loading && error === null && complete;
350
+ // At most one of these is ever showing, so one element carries them all
351
+ // and one id describes the select whichever is up. role="status" is
352
+ // polite and never interrupts; the other two are worth interrupting for
353
+ // (same split as content-list-view.tsx).
354
+ const notice = loading
355
+ ? {
356
+ role: "status",
357
+ className: "text-text-tertiary",
358
+ text: "Loading the crops your media types declare…",
359
+ }
360
+ : error !== null
361
+ ? // Verbatim, the same convention the media picker follows: a list
362
+ // that came back short for a reason should say the reason.
363
+ { role: "alert", className: "text-danger-600", text: error }
364
+ : complete
365
+ ? null
366
+ : {
367
+ role: "alert",
368
+ className: "text-danger-600",
369
+ text: `Only the first ${TYPE_PAGE_CAP * TYPE_PAGE_LIMIT} types could be read, ` +
370
+ "so a crop declared beyond them is missing from this list.",
371
+ };
372
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: "Accepted file types", htmlFor: "image-settings-accepted-types", helpText: "Comma-separated MIME types, e.g. image/png,image/jpeg. Leave blank to accept any image.", children: _jsx(Input, { id: "image-settings-accepted-types", value: settings.acceptedTypes?.join(",") ?? "", onChange: (e) => {
373
+ const types = e.target.value
374
+ .split(",")
375
+ .map((t) => t.trim())
376
+ .filter((t) => t.length > 0);
377
+ onChange({ ...settings, acceptedTypes: types.length > 0 ? types : undefined });
378
+ } }) }), _jsx(PropertyField, { label: "Max file size (bytes)", htmlFor: "image-settings-max-size", helpText: "e.g. 5000000 for ~5MB. Leave blank for no limit.", children: _jsx(Input, { id: "image-settings-max-size", type: "number", min: 1, value: settings.maxSizeBytes ?? "", onChange: (e) => onChange({ ...settings, maxSizeBytes: e.target.value === "" ? undefined : Number(e.target.value) }) }) }), _jsx(PropertyField, { label: "Crop", htmlFor: "image-settings-rendition", helpText: "The shape this field asks its picture for. A page gets that crop when the picture has one, and the full image when it does not.", children: _jsxs("select", { id: "image-settings-rendition", className: SELECT_CLASS, "aria-describedby": notice ? noticeId : undefined, value: rendition ?? "",
379
+ // The empty option is `rendition: null`, which is how
380
+ // ImageSettingsSchema spells "any picture will do", rather than
381
+ // a missing key or an empty string.
382
+ onChange: (event) => onChange({ ...settings, rendition: event.target.value === "" ? null : event.target.value }), children: [_jsx("option", { value: "", children: "No particular crop" }), rendition !== null && !listed && (_jsx("option", { value: rendition, children: settled ? `${renditionShape(rendition)} (no media type declares this crop)` : renditionShape(rendition) })), groups.map((group) => (_jsx("optgroup", { label: group.typeName, children: group.choices.map((choice) => (_jsx("option", { value: choice.name, children: `${choice.caption} ${renditionShape(choice.name)}` }, choice.fieldId))) }, group.typeId)))] }) }), notice && (_jsx("p", { id: noticeId, role: notice.role, className: cn("text-xs", notice.className), children: notice.text }))] }));
383
+ }
384
+ export function ImageReadOnlyView() {
385
+ const { value } = usePluginValue();
386
+ return _jsx(ImageThumbnail, { mediaId: value });
387
+ }
@@ -0,0 +1,2 @@
1
+ export declare function RichTextInputView(): import("react").JSX.Element;
2
+ export declare function RichTextReadOnlyView(): import("react").JSX.Element;