@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
@@ -1,12 +1,15 @@
1
1
  import type { ComponentType } from "react";
2
- import type { CreateDocumentTypeRequest, PluginDocsPage, PluginInstallDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
2
+ import type { CreateDocumentTypeRequest, PluginDocsPage, PluginInstallDeclaration, PluginLabel, PluginVendorServiceDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
3
3
  export type { InstallChoice, InstallOption, InstallStep, PluginInstallDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
4
4
  import type { ThemeTokenOverrides } from "@kardalum/design-tokens";
5
+ import { VIEW_BEARING_CONTRIBUTIONS, declaresClientBundle } from "@kardalum/plugin-package/reference";
5
6
  import type { ZodType } from "zod";
6
7
  import type { DataTypePlugin } from "./data-type-plugin.js";
7
8
  import type { BUILT_IN_RAIL_SECTIONS } from "./manifest-schema.js";
8
9
  import type { PluginApiRouteContext, PublishedContent, ScopedStructuredStorage } from "./structured-storage-types.js";
9
10
  import type { Entitlement, PluginTaskContext } from "./entitlement-types.js";
11
+ import type { PluginNotify } from "./notify.js";
12
+ import type { PluginVendorService } from "./vendor-service.js";
10
13
  /**
11
14
  * The seven plugin types. Since S268 this is a marketplace listing and
12
15
  * filter label only: it does not decide which contributions a plugin may
@@ -19,13 +22,13 @@ export type PluginType = "datatype" | "section" | "template" | "theme" | "integr
19
22
  /**
20
23
  * Databases a plugin can declare support for. Deliberately NOT
21
24
  * db-adapter's DatabaseDialect: that union includes 'mock' (the in-memory
22
- * test adapter), which no plugin may target — and the SDK is a published
25
+ * test adapter), which no plugin may target, and the SDK is a published
23
26
  * package that must not depend on the unpublished adapter internals.
24
27
  */
25
28
  export type DatabaseDialect = "postgresql" | "mysql" | "sqlite" | "mssql" | "mongodb";
26
29
  /**
27
30
  * How the plugin stores data and where it can run. Required on every
28
- * manifest (plugin-sdk.md) — the marketplace pre-filters by the site's
31
+ * manifest (plugin-sdk.md): the marketplace pre-filters by the site's
29
32
  * active database and install is blocked with a clear reason, never a
30
33
  * silent failure.
31
34
  */
@@ -41,7 +44,7 @@ export interface DatabaseCompatibility {
41
44
  storageType: "simple" | "structured";
42
45
  supported: DatabaseDialect[];
43
46
  /** Optional human-readable reason per UNSUPPORTED dialect (shown on the
44
- * blocked-install screen) — hence Partial: supported dialects carry no
47
+ * blocked-install screen), hence Partial: supported dialects carry no
45
48
  * reason. */
46
49
  unsupportedReason?: Partial<Record<DatabaseDialect, string>>;
47
50
  }
@@ -118,8 +121,8 @@ export interface PluginMigrationHooks {
118
121
  validateMigration?: (from: DatabaseDialect, to: DatabaseDialect) => PluginMigrationValidation | Promise<PluginMigrationValidation>;
119
122
  }
120
123
  /** The events a plugin can hook. The hook engine (S159) actually FIRES
121
- * only three of these — content:afterPublish (including rollbacks),
122
- * content:afterTrash, content:afterRestore — with the
124
+ * only three of these: content:afterPublish (including rollbacks),
125
+ * content:afterTrash, content:afterRestore, with the
123
126
  * ContentLifecycleHookPayload shape declared below; every other event in
124
127
  * this catalog is declared for forward compatibility and stays inert. */
125
128
  export type HookEvent = "content:beforeSave" | "content:afterSave" | "content:beforePublish" | "content:afterPublish" | "content:afterTrash" | "content:afterRestore" | "content:beforeDelete" | "media:afterUpload" | "user:afterLogin" | "api:beforeResponse";
@@ -139,13 +142,26 @@ export interface PluginHookContext {
139
142
  * `requireEntitlement` from `@kardalum/plugin-sdk/entitlement`; a hook
140
143
  * that throws its EntitlementError is skipped with one log line. */
141
144
  entitlement: Entitlement;
145
+ /** 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. */
146
+ readOnly?: boolean;
147
+ /** S314n3: sends a notification to people in the admin. Present only for a plugin that
148
+ * declares `contributions.notifications: true` and is active; a refusal throws
149
+ * NotificationRefusedError (check it with `isNotificationRefusedError`). */
150
+ notify?: PluginNotify;
151
+ /** S320: calls the plugin's declared vendor service with a 5-minute licence
152
+ * token. Present only when the manifest declares `vendorService`. */
153
+ vendorService?: PluginVendorService;
142
154
  }
143
155
  export type HookHandler = (payload: unknown, context?: PluginHookContext) => void | Promise<void>;
144
156
  export type PluginHooks = Partial<Record<HookEvent, HookHandler>>;
145
157
  /** A slot's label: a map of language code to text, `en` required (spec D5).
146
158
  * Each key is a language code such as `en`, `de` or `pt-BR`. The admin
147
- * shows the active language's text, else English; `slotLabel` is the one
148
- * place that choice is made. */
159
+ * shows the active language's text, else English; `resolveLabel` in
160
+ * @kardalum/api-schemas is the one place that choice is made (S311), and
161
+ * `slotLabel` is it for a map. Since S311 the display names of the other
162
+ * surfaces (an action's label, a role's, a widget's or a scheduled task's
163
+ * name, and the rest typed `PluginLabel` below) take the same map or a
164
+ * plain string. */
149
165
  export interface SlotLabel {
150
166
  en: string;
151
167
  [locale: string]: string;
@@ -203,7 +219,7 @@ export interface BuiltInRailEntryContribution extends RailEntryContribution {
203
219
  }
204
220
  export interface DashboardWidgetContribution {
205
221
  id: string;
206
- name: string;
222
+ name: PluginLabel;
207
223
  view: ComponentType;
208
224
  /** The named permission action a subject must hold to reach this
209
225
  * (S270, theme G1). Required: a contribution that declares no action
@@ -268,7 +284,7 @@ export interface ApiRouteContribution {
268
284
  * server's OpenAPI documents. */
269
285
  response?: Record<string, ZodType>;
270
286
  };
271
- /** Third argument added Month 8, Session 90 — the first server-side
287
+ /** Third argument added Month 8, Session 90, the first server-side
272
288
  * consumer needing privileged host access. Existing two-argument (or
273
289
  * fewer) handlers remain perfectly valid: TypeScript allows a function
274
290
  * with fewer declared parameters to satisfy a type expecting more. */
@@ -284,7 +300,7 @@ export interface ApiRouteContribution {
284
300
  }
285
301
  export interface ScheduledTaskContribution {
286
302
  id: string;
287
- name: string;
303
+ name: PluginLabel;
288
304
  /** Standard 5-field cron expression. */
289
305
  cron: string;
290
306
  run: (context?: PluginTaskContext) => void | Promise<void>;
@@ -293,55 +309,19 @@ export interface ScheduledTaskContribution {
293
309
  * contract firms up when the BullMQ media pipeline lands. */
294
310
  export interface MediaProcessorContribution {
295
311
  id: string;
296
- name: string;
312
+ name: PluginLabel;
297
313
  process: (file: unknown) => unknown | Promise<unknown>;
298
314
  }
299
- export interface SettingsPageContribution {
300
- id: string;
301
- name: string;
302
- view: ComponentType;
303
- /** The named permission action a subject must hold to reach this
304
- * (S270, theme G1). Required: a contribution that declares no action
305
- * would be a gate nobody chose, and omission is how a permission
306
- * silently loosens. Must be prefixed with this plugin's own id, so one
307
- * plugin cannot declare an action in another's namespace or in core's. */
308
- action: string;
309
- }
310
- export interface ContentTreeActionContribution {
311
- id: string;
312
- label: string;
313
- onSelect: (nodeId: string) => void | Promise<void>;
314
- /** The named permission action a subject must hold to reach this
315
- * (S270, theme G1). Required: a contribution that declares no action
316
- * would be a gate nobody chose, and omission is how a permission
317
- * silently loosens. Must be prefixed with this plugin's own id, so one
318
- * plugin cannot declare an action in another's namespace or in core's. */
319
- action: string;
320
- }
321
- /** A button in the rich-text editor's toolbar. TipTap wiring comes with
322
- * the first consumer. */
323
- export interface EditorToolbarContribution {
324
- id: string;
325
- label: string;
326
- icon: string;
327
- onClick: () => void | Promise<void>;
328
- /** The named permission action a subject must hold to reach this
329
- * (S270, theme G1). Required: a contribution that declares no action
330
- * would be a gate nobody chose, and omission is how a permission
331
- * silently loosens. Must be prefixed with this plugin's own id, so one
332
- * plugin cannot declare an action in another's namespace or in core's. */
333
- action: string;
334
- }
335
315
  /** A service an integration plugin exposes for other plugins to consume
336
316
  * (e.g. a Stripe client). Shape intentionally opaque until the
337
317
  * cross-plugin service registry exists. */
338
318
  export interface ExposedServiceContribution {
339
319
  id: string;
340
- name: string;
320
+ name: PluginLabel;
341
321
  service: unknown;
342
322
  }
343
323
  /** A ready-made frontend starter shipped alongside a plugin (e.g. the
344
- * Commerce plugin's "Online Store" Next.js starter) — one marketplace
324
+ * Commerce plugin's "Online Store" Next.js starter), one marketplace
345
325
  * listing, working site immediately. Packaging lands Month 13. */
346
326
  export interface BundledTemplateContribution {
347
327
  name: string;
@@ -349,14 +329,14 @@ export interface BundledTemplateContribution {
349
329
  /** Where the starter's source lives until marketplace packaging exists. */
350
330
  repository?: string;
351
331
  }
352
- /** One render template a plugin ships under its own `templates/` dir —
353
- * per S192 §8 ("a new `templates` contribution — template files declared
332
+ /** One render template a plugin ships under its own `templates/` dir,
333
+ * per S192 §8 ("a new `templates` contribution: template files declared
354
334
  * with alias/kind and, for pages, which contributed document type they
355
335
  * render"). Any plugin may declare templates (S268): a `page` kind entry
356
336
  * may only name a document type this same manifest declares. */
357
337
  export interface TemplateContribution {
358
338
  /** Relative path under the plugin's `templates/` directory, forward
359
- * slashes, ending in `.liquid` — this is the file S192 §5 says the
339
+ * slashes, ending in `.liquid`: this is the file S192 §5 says the
360
340
  * developer edits and the mirror-on-edit versioning tracks. */
361
341
  file: string;
362
342
  name: string;
@@ -365,7 +345,7 @@ export interface TemplateContribution {
365
345
  alias: string;
366
346
  kind: "page" | "layout" | "partial";
367
347
  /** `page` kind only: a NAME from THIS manifest's own `documentTypes`
368
- * contribution — the document type this page template renders.
348
+ * contribution: the document type this page template renders.
369
349
  * Optional: a catch-all-ish page template with no specific type is
370
350
  * legal (S193 allows a null `documentTypeId`). Forbidden on
371
351
  * `layout`/`partial` entries, which never render a document type. */
@@ -380,7 +360,7 @@ export interface SerializerContext {
380
360
  publishedAt: string | null;
381
361
  version: number;
382
362
  };
383
- /** SERIALIZED field data — contributions run after core serialization. */
363
+ /** SERIALIZED field data: contributions run after core serialization. */
384
364
  data: Record<string, unknown>;
385
365
  documentType: {
386
366
  id: string;
@@ -388,7 +368,7 @@ export interface SerializerContext {
388
368
  };
389
369
  }
390
370
  export interface CustomFormatContribution {
391
- /** Plugin-scoped name, /^[a-z0-9-]+$/ — addressed as `<pluginId>:<name>`. */
371
+ /** Plugin-scoped name, /^[a-z0-9-]+$/, addressed as `<pluginId>:<name>`. */
392
372
  name: string;
393
373
  build: (context: SerializerContext) => unknown | Promise<unknown>;
394
374
  }
@@ -409,9 +389,6 @@ export interface PluginContributions {
409
389
  hooks?: PluginHooks;
410
390
  scheduledTasks?: ScheduledTaskContribution[];
411
391
  mediaProcessors?: MediaProcessorContribution[];
412
- settingsPages?: SettingsPageContribution[];
413
- contentTreeActions?: ContentTreeActionContribution[];
414
- editorToolbar?: EditorToolbarContribution[];
415
392
  exposedServices?: ExposedServiceContribution[];
416
393
  serializers?: SerializerContribution;
417
394
  /** Document types the plugin provisions at install: the creation shape
@@ -435,14 +412,19 @@ export interface PluginContributions {
435
412
  /** Plugin ids installed together, resolved by the marketplace. */
436
413
  bundledPlugins?: string[];
437
414
  bundledTemplate?: BundledTemplateContribution;
415
+ /** S314n3 (D1): the plugin sends notifications to people in the admin through
416
+ * `context.notify` in its hooks and API routes; a plugin that does not declare it
417
+ * gets no `notify`. It derives the `admin.notifications` capability, which
418
+ * is a promised capability, so a reviewer reads it against your code. */
419
+ notifications?: true;
438
420
  }
439
421
  /**
440
422
  * The contributions that put code in the browser, and so the ones that
441
423
  * make a plugin ship a client bundle (S267 section 5, implemented by
442
- * S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280),
443
- * `dashboardWidgets` and `settingsPages` carry React views; `contentTreeActions` and
444
- * `editorToolbar` carry client callbacks (`onSelect`, `onClick`), which
445
- * is just as much browser code even though neither has a `view` key.
424
+ * S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280) and
425
+ * `dashboardWidgets` carry React views. S313b retired `settingsPages`,
426
+ * `contentTreeActions` and `editorToolbar`, which no admin screen hosted;
427
+ * the last two return when a host and an editor-handle API are designed.
446
428
  *
447
429
  * Everything else is absent on purpose: `apiRoutes`, `hooks`,
448
430
  * `scheduledTasks`, `mediaProcessors` and `serializers` run on the
@@ -454,7 +436,7 @@ export interface PluginContributions {
454
436
  * than that list was, not merely equivalent: a plugin listed as
455
437
  * `section` with no views had to ship a remoteEntry.js it did not have.
456
438
  */
457
- export declare const VIEW_BEARING_CONTRIBUTIONS: readonly ["dataTypes", "adminSections", "railEntries", "dashboardWidgets", "settingsPages", "contentTreeActions", "editorToolbar"];
439
+ export { VIEW_BEARING_CONTRIBUTIONS };
458
440
  export type ViewBearingContribution = (typeof VIEW_BEARING_CONTRIBUTIONS)[number];
459
441
  /**
460
442
  * Whether a manifest's declared contributions require a client bundle:
@@ -483,9 +465,9 @@ export type ViewBearingContribution = (typeof VIEW_BEARING_CONTRIBUTIONS)[number
483
465
  * 'hasClientBundle'", before it can decide anything. The old name is
484
466
  * gone rather than aliased: a name that outlives its meaning is how these
485
467
  * get recombined later. A caller passing a string to THIS name is a
486
- * compile error against the signature below.
468
+ * compile error against the signature in plugin-package.
487
469
  */
488
- export declare function declaresClientBundle(contributions: PluginContributions | Record<string, unknown> | null | undefined): boolean;
470
+ export { declaresClientBundle };
489
471
  /** S292: what onInstall is told. */
490
472
  export interface PluginInstallContext {
491
473
  /** The install's answers with every default filled: what the operator
@@ -532,7 +514,7 @@ export interface PluginManifestBase {
532
514
  /**
533
515
  * Marketplace verification hash. Optional BY DESIGN, not oversight:
534
516
  * per the Trust model, sideloaded/local dev plugins are unsigned by
535
- * definition (Tier 2 'unverified') — only marketplace-signed plugins
517
+ * definition (Tier 2 'unverified'): only marketplace-signed plugins
536
518
  * carry one. Signing is authenticity, not a sandbox; the safety layer
537
519
  * is identical for both tiers.
538
520
  */
@@ -543,7 +525,7 @@ export interface PluginManifestBase {
543
525
  pluginDependencies?: string[];
544
526
  databaseCompatibility: DatabaseCompatibility;
545
527
  assertions?: PluginAssertions;
546
- /** DB changes applied on install (through plugin storage — never raw
528
+ /** DB changes applied on install (through plugin storage, never raw
547
529
  * SQL). */
548
530
  migrations?: PluginMigration[];
549
531
  onInstall?: (ctx: PluginInstallContext) => void | Promise<void>;
@@ -561,11 +543,13 @@ export interface PluginManifestBase {
561
543
  * names one of these, and each of these is named by at least one, so the
562
544
  * install screen shows exactly what installing adds to the permission
563
545
  * surface. Ids carry this plugin's prefix and have a label, because
564
- * nothing ever shows an operator a raw action string.
546
+ * nothing ever shows an operator a raw action string. A label is a string
547
+ * or a map of language code to text with `en` required (S311); the install
548
+ * stores the text of the site's default language.
565
549
  */
566
550
  actions?: Array<{
567
551
  id: string;
568
- label: string;
552
+ label: PluginLabel;
569
553
  }>;
570
554
  /**
571
555
  * Roles this plugin offers (S273). An offer is never applied unasked: the
@@ -577,15 +561,15 @@ export interface PluginManifestBase {
577
561
  */
578
562
  roles?: Array<{
579
563
  id: string;
580
- label: string;
564
+ label: PluginLabel;
581
565
  actions: string[];
582
566
  }>;
583
567
  /** S286: the plugin's docs pages, in reading order. Omit it and the
584
568
  * README is the one page (the overview). Which roles the marketplace
585
569
  * requires is derived from what the manifest declares, never listed
586
570
  * here: a "setup" page when the plugin has migrations, dependencies, a
587
- * price or document types; a "configuration" page when it has settings
588
- * pages. */
571
+ * price or document types. The "configuration" role stays declarable
572
+ * but is never required. */
589
573
  docs?: PluginDocsPage[];
590
574
  /** S291: the language the docs pages are written in, as a language code
591
575
  * such as "en", "de" or "pt-BR". Absent means English. The marketplace
@@ -597,6 +581,10 @@ export interface PluginManifestBase {
597
581
  * The built-in questions (the sample content, the offered roles) are never
598
582
  * declared here: they follow from what the package ships. */
599
583
  install?: PluginInstallDeclaration;
584
+ /** S320 (D6): the author's server a paid plugin's server code calls through
585
+ * `context.vendorService.fetch`. The CMS sends it a 5-minute licence token,
586
+ * never the key. Declaring it is declaring outbound network use. */
587
+ vendorService?: PluginVendorServiceDeclaration;
600
588
  }
601
589
  /**
602
590
  * The full plugin manifest. One shape for every plugin: `type` is a
package/dist/manifest.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { resolveLabel } from "@kardalum/api-schemas";
2
+ import { VIEW_BEARING_CONTRIBUTIONS, declaresClientBundle } from "@kardalum/plugin-package/reference";
1
3
  /**
2
4
  * The text of a slot's label for a locale: the locale as given, else its
3
5
  * primary subtag (`de-AT` reads `de`), else `en`, which every label carries.
@@ -5,25 +7,15 @@
5
7
  * case-insensitive and a label written `pt-BR` must answer `pt-br`.
6
8
  */
7
9
  export function slotLabel(label, locale) {
8
- const wanted = locale.toLowerCase();
9
- const primary = wanted.split("-")[0] ?? "";
10
- let primaryText;
11
- for (const [code, text] of Object.entries(label)) {
12
- const lower = code.toLowerCase();
13
- if (lower === wanted)
14
- return text;
15
- if (primaryText === undefined && primary !== "" && lower === primary)
16
- primaryText = text;
17
- }
18
- return primaryText ?? label.en;
10
+ return resolveLabel(label, locale);
19
11
  }
20
12
  /**
21
13
  * The contributions that put code in the browser, and so the ones that
22
14
  * make a plugin ship a client bundle (S267 section 5, implemented by
23
- * S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280),
24
- * `dashboardWidgets` and `settingsPages` carry React views; `contentTreeActions` and
25
- * `editorToolbar` carry client callbacks (`onSelect`, `onClick`), which
26
- * is just as much browser code even though neither has a `view` key.
15
+ * S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280) and
16
+ * `dashboardWidgets` carry React views. S313b retired `settingsPages`,
17
+ * `contentTreeActions` and `editorToolbar`, which no admin screen hosted;
18
+ * the last two return when a host and an editor-handle API are designed.
27
19
  *
28
20
  * Everything else is absent on purpose: `apiRoutes`, `hooks`,
29
21
  * `scheduledTasks`, `mediaProcessors` and `serializers` run on the
@@ -35,15 +27,10 @@ export function slotLabel(label, locale) {
35
27
  * than that list was, not merely equivalent: a plugin listed as
36
28
  * `section` with no views had to ship a remoteEntry.js it did not have.
37
29
  */
38
- export const VIEW_BEARING_CONTRIBUTIONS = [
39
- "dataTypes",
40
- "adminSections",
41
- "railEntries",
42
- "dashboardWidgets",
43
- "settingsPages",
44
- "contentTreeActions",
45
- "editorToolbar",
46
- ];
30
+ // S311: the list and the rule live in @kardalum/plugin-package (browser-safe,
31
+ // shared with the marketplace door and the CLI, imported at the top of this
32
+ // file); the SDK re-exports them.
33
+ export { VIEW_BEARING_CONTRIBUTIONS };
47
34
  /**
48
35
  * Whether a manifest's declared contributions require a client bundle:
49
36
  * whether a built artifact must contain a `remoteEntry.js`, and whether
@@ -71,16 +58,6 @@ export const VIEW_BEARING_CONTRIBUTIONS = [
71
58
  * 'hasClientBundle'", before it can decide anything. The old name is
72
59
  * gone rather than aliased: a name that outlives its meaning is how these
73
60
  * get recombined later. A caller passing a string to THIS name is a
74
- * compile error against the signature below.
61
+ * compile error against the signature in plugin-package.
75
62
  */
76
- export function declaresClientBundle(contributions) {
77
- if (contributions === null || typeof contributions !== "object")
78
- return false;
79
- const declared = contributions;
80
- return VIEW_BEARING_CONTRIBUTIONS.some((key) => {
81
- const value = declared[key];
82
- if (value === null || value === undefined)
83
- return false;
84
- return Array.isArray(value) ? value.length > 0 : true;
85
- });
86
- }
63
+ export { declaresClientBundle };
@@ -4,6 +4,7 @@ import { ChevronRight, Folder as FolderIcon } from "lucide-react";
4
4
  import { renditionShape, } from "@kardalum/api-schemas";
5
5
  import { Button, cn, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, } from "@kardalum/ui";
6
6
  import { MANAGE_API, usePluginApi } from "../plugin-context.js";
7
+ import { gridArrowStep } from "../grid-arrow-step.js";
7
8
  import { readAllPages } from "../read-all-pages.js";
8
9
  import { isRenditionIneligible } from "../rendition-eligibility.js";
9
10
  import { uploadFailureMessage } from "./upload-error.js";
@@ -372,35 +373,34 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
372
373
  function handleGridKeyDown(event) {
373
374
  if (items.length === 0)
374
375
  return;
376
+ // The grid reads in the page's direction (the compose sheet reads it the same way).
377
+ const step = gridArrowStep(event.key, event.currentTarget.closest('[dir="rtl"]') !== null);
375
378
  let next = activeIndex;
376
- switch (event.key) {
377
- case "ArrowRight":
378
- case "ArrowDown":
379
- next = Math.min(activeIndex + 1, items.length - 1);
380
- break;
381
- case "ArrowLeft":
382
- case "ArrowUp":
383
- next = Math.max(activeIndex - 1, 0);
384
- break;
385
- case "Home":
386
- next = 0;
387
- break;
388
- case "End":
389
- next = items.length - 1;
390
- break;
391
- case "Enter":
392
- case " ": {
393
- event.preventDefault();
394
- // Read rather than asserted: `items` is filtered by what the
395
- // field accepts, so it can be shorter than the index a previous
396
- // listing left behind.
397
- const focused = items[activeIndex];
398
- if (focused)
399
- selectItem(focused);
400
- return;
379
+ if (step !== 0) {
380
+ next = Math.min(Math.max(activeIndex + step, 0), items.length - 1);
381
+ }
382
+ else {
383
+ switch (event.key) {
384
+ case "Home":
385
+ next = 0;
386
+ break;
387
+ case "End":
388
+ next = items.length - 1;
389
+ break;
390
+ case "Enter":
391
+ case " ": {
392
+ event.preventDefault();
393
+ // Read rather than asserted: `items` is filtered by what the
394
+ // field accepts, so it can be shorter than the index a previous
395
+ // listing left behind.
396
+ const focused = items[activeIndex];
397
+ if (focused)
398
+ selectItem(focused);
399
+ return;
400
+ }
401
+ default:
402
+ return;
401
403
  }
402
- default:
403
- return;
404
404
  }
405
405
  event.preventDefault();
406
406
  focusIndex(next);
@@ -424,10 +424,10 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
424
424
  event.preventDefault();
425
425
  opener.focus();
426
426
  }
427
- }, children: [_jsxs(SheetHeader, { className: "flex-col items-start gap-1", children: [_jsx(SheetTitle, { children: "Choose an image" }), _jsxs(SheetDescription, { children: ["Showing images from your library.", rendition ? (_jsxs(_Fragment, { children: [" ", "This field asks for a ", _jsx("strong", { className: "font-medium text-text-primary", children: requestedShape }), " crop."] })) : null] })] }), _jsx("nav", { "aria-label": "Folder location", className: "shrink-0 border-b border-border-default px-4 py-2", children: _jsxs("ol", { className: "flex flex-wrap items-center gap-1 text-sm text-text-tertiary", children: [_jsx("li", { children: currentFolderId === null ? (_jsx("span", { "aria-current": "page", className: "font-medium text-text-primary", children: ROOT_LABEL })) : (_jsx("button", { type: "button", onClick: () => openFolder(null), className: "rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600", children: ROOT_LABEL })) }), breadcrumbPath.map((folder, index) => {
427
+ }, children: [_jsxs(SheetHeader, { className: "flex-col items-start gap-1", children: [_jsx(SheetTitle, { children: "Choose an image" }), _jsxs(SheetDescription, { children: ["Showing images from your library.", rendition ? (_jsxs(_Fragment, { children: [" ", "This field asks for a ", _jsx("strong", { className: "font-medium text-text-primary", children: requestedShape }), " crop."] })) : null] })] }), _jsx("nav", { "aria-label": "Folder location", className: "shrink-0 border-b border-border-default px-4 py-2", children: _jsxs("ol", { className: "flex flex-wrap items-center gap-1 text-sm text-text-tertiary", children: [_jsx("li", { children: currentFolderId === null ? (_jsx("span", { "aria-current": "page", className: "font-medium text-text-primary", children: ROOT_LABEL })) : (_jsx("button", { type: "button", onClick: () => openFolder(null), className: "rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: ROOT_LABEL })) }), breadcrumbPath.map((folder, index) => {
428
428
  const isCurrent = index === breadcrumbPath.length - 1;
429
- return (_jsxs("li", { className: "flex min-w-0 items-center gap-1", children: [_jsx(ChevronRight, { "aria-hidden": "true", className: "size-3 shrink-0 rtl:rotate-180" }), isCurrent ? (_jsx("span", { "aria-current": "page", className: "truncate font-medium text-text-primary", children: folder.name })) : (_jsx("button", { type: "button", onClick: () => openFolder(folder.id), className: "truncate rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600", children: folder.name }))] }, folder.id));
430
- })] }) }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [error && _jsx("p", { className: "text-sm text-danger-600", children: error }), visibleFolders.length > 0 && (_jsx("ul", { "aria-label": "Folders", className: "flex flex-wrap gap-2", children: visibleFolders.map((folder) => (_jsx("li", { className: "min-w-0", children: _jsxs("button", { type: "button", onClick: () => openFolder(folder.id), className: "flex max-w-full items-center gap-2 rounded-full border border-border-default bg-background-elevated px-3 py-1 text-xs text-text-secondary hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600", children: [_jsx(FolderIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-text-tertiary" }), _jsx("span", { className: "truncate", children: folder.name })] }) }, folder.id))) })), loading && _jsx("p", { className: "text-sm text-text-secondary", children: "Loading\u2026" }), emptyBecauseFiltered && (_jsx("p", { className: "text-sm text-text-secondary", children: "Nothing here is a kind this field accepts." })), !loading && rawItems.length === 0 && visibleFolders.length === 0 && (_jsx("p", { className: "text-sm text-text-secondary", children: currentFolderId === null ? "No images in the media library yet." : "No images in this folder yet." })), !loading && items.length > 0 && (_jsx("div", { role: "listbox", "aria-label": "Media library", onKeyDown: handleGridKeyDown, className: "grid grid-cols-3 gap-3", children: items.map((item, index) => {
429
+ return (_jsxs("li", { className: "flex min-w-0 items-center gap-1", children: [_jsx(ChevronRight, { "aria-hidden": "true", className: "size-3 shrink-0 rtl:rotate-180" }), isCurrent ? (_jsx("span", { "aria-current": "page", className: "truncate font-medium text-text-primary", children: folder.name })) : (_jsx("button", { type: "button", onClick: () => openFolder(folder.id), className: "truncate rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: folder.name }))] }, folder.id));
430
+ })] }) }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [error && _jsx("p", { className: "text-sm text-danger-600", children: error }), visibleFolders.length > 0 && (_jsx("ul", { "aria-label": "Folders", className: "flex flex-wrap gap-2", children: visibleFolders.map((folder) => (_jsx("li", { className: "min-w-0", children: _jsxs("button", { type: "button", onClick: () => openFolder(folder.id), className: "flex max-w-full items-center gap-2 rounded-full border border-border-default bg-background-elevated px-3 py-1 text-xs text-text-secondary hover:bg-background-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: [_jsx(FolderIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-text-tertiary" }), _jsx("span", { className: "truncate", children: folder.name })] }) }, folder.id))) })), loading && _jsx("p", { className: "text-sm text-text-secondary", children: "Loading\u2026" }), emptyBecauseFiltered && (_jsx("p", { className: "text-sm text-text-secondary", children: "Nothing here is a kind this field accepts." })), !loading && rawItems.length === 0 && visibleFolders.length === 0 && (_jsx("p", { className: "text-sm text-text-secondary", children: currentFolderId === null ? "No images in the media library yet." : "No images in this folder yet." })), !loading && items.length > 0 && (_jsx("div", { role: "listbox", "aria-label": "Media library", onKeyDown: handleGridKeyDown, className: "grid grid-cols-3 gap-3", children: items.map((item, index) => {
431
431
  const selected = pending?.id === item.id;
432
432
  // `hasRendition` is only set when the listing was asked
433
433
  // about a crop, so absent means nothing was asked and
@@ -440,8 +440,8 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
440
440
  : `${item.filename}: no ${requestedShape} crop yet, so this field shows the full image.`;
441
441
  return (_jsxs("button", { type: "button", ref: (el) => {
442
442
  optionRefs.current[index] = el;
443
- }, role: "option", "aria-selected": selected, title: title, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => selectItem(item), className: cn("flex flex-col overflow-hidden rounded-md border text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600", selected
443
+ }, role: "option", "aria-selected": selected, title: title, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => selectItem(item), className: cn("flex flex-col overflow-hidden rounded-md border text-start focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", selected
444
444
  ? "border-primary-600 bg-primary-100"
445
445
  : "border-border-subtle hover:bg-background-elevated"), children: [_jsx("span", { className: "block aspect-square overflow-hidden bg-background-subtle", children: _jsx("img", { src: item.downloadUrl, alt: "", className: "h-full w-full object-cover" }) }), _jsxs("span", { className: "block min-w-0 px-2 py-1", children: [_jsx("span", { className: "block truncate font-mono text-xs text-text-tertiary", children: item.filename }), fallsBack && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: "full image" }))] })] }, item.id));
446
- }) })), !loading && nextCursor && (_jsx("div", { className: "flex justify-center", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: loadingMore, onClick: () => void loadMore(), children: loadingMore ? "Loading…" : "Load more" }) }))] }), pending && (_jsxs("div", { className: "flex shrink-0 items-center gap-3 border-t border-border-default px-4 py-3", children: [_jsx("img", { src: pending.downloadUrl, alt: "", className: "h-12 w-12 shrink-0 rounded-md border border-border-subtle object-cover" }), _jsxs("div", { className: "flex-1", children: [_jsx("label", { htmlFor: "media-picker-alt", className: "mb-1 block text-xs font-medium text-text-secondary", children: "Alt text" }), _jsx("input", { id: "media-picker-alt", ref: altInputRef, type: "text", value: altText, onChange: (event) => setAltText(event.target.value), placeholder: "Describe this image for screen readers (optional)", className: "w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600" })] })] })), _jsxs(SheetFooter, { className: "items-center justify-start", children: [_jsxs("p", { className: "text-sm text-text-tertiary", children: ["Or", " ", _jsx("button", { type: "button", disabled: uploading, onClick: () => uploadInputRef.current?.click(), className: "rounded-md text-primary-600 underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600", children: uploading ? `uploading into ${currentFolderName}…` : `upload into ${currentFolderName}` })] }), _jsx("input", { id: "media-picker-upload", ref: uploadInputRef, type: "file", className: "hidden", accept: acceptAttribute(acceptedTypes), "aria-label": `Upload into ${currentFolderName}`, disabled: uploading, onChange: (event) => void handleUpload(event) }), _jsx("span", { className: "ms-auto flex gap-2", children: pending ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Cancel" }), _jsx(Button, { type: "button", onClick: () => onPick({ id: pending.id, downloadUrl: pending.downloadUrl, alt: altText }), children: "Insert" })] })) : (_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Close" })) })] })] }) }));
446
+ }) })), !loading && nextCursor && (_jsx("div", { className: "flex justify-center", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: loadingMore, onClick: () => void loadMore(), children: loadingMore ? "Loading…" : "Load more" }) }))] }), pending && (_jsxs("div", { className: "flex shrink-0 items-center gap-3 border-t border-border-default px-4 py-3", children: [_jsx("img", { src: pending.downloadUrl, alt: "", className: "h-12 w-12 shrink-0 rounded-md border border-border-subtle object-cover" }), _jsxs("div", { className: "flex-1", children: [_jsx("label", { htmlFor: "media-picker-alt", className: "mb-1 block text-xs font-medium text-text-secondary", children: "Alt text" }), _jsx("input", { id: "media-picker-alt", ref: altInputRef, type: "text", value: altText, onChange: (event) => setAltText(event.target.value), placeholder: "Describe this image for screen readers (optional)", className: "w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600" })] })] })), _jsxs(SheetFooter, { className: "items-center justify-start", children: [_jsxs("p", { className: "text-sm text-text-tertiary", children: ["Or", " ", _jsx("button", { type: "button", disabled: uploading, onClick: () => uploadInputRef.current?.click(), className: "rounded-md text-primary-600 underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: uploading ? `uploading into ${currentFolderName}…` : `upload into ${currentFolderName}` })] }), _jsx("input", { id: "media-picker-upload", ref: uploadInputRef, type: "file", className: "hidden", accept: acceptAttribute(acceptedTypes), "aria-label": `Upload into ${currentFolderName}`, disabled: uploading, onChange: (event) => void handleUpload(event) }), _jsx("span", { className: "ms-auto flex gap-2", children: pending ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Cancel" }), _jsx(Button, { type: "button", onClick: () => onPick({ id: pending.id, downloadUrl: pending.downloadUrl, alt: altText }), children: "Insert" })] })) : (_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Close" })) })] })] }) }));
447
447
  }
@@ -0,0 +1,17 @@
1
+ import type { SendNotificationRequestInput } from "@kardalum/api-schemas";
2
+ /** What `context.notify` takes: `to` (actions, roles, people), a title, an optional text and link. */
3
+ export type PluginNotifyInput = SendNotificationRequestInput;
4
+ export interface PluginNotifyResult {
5
+ /** How many people it reached. */
6
+ recipients: number;
7
+ }
8
+ export type PluginNotify = (input: PluginNotifyInput) => Promise<PluginNotifyResult>;
9
+ /** Why a send was refused. */
10
+ export declare const NOTIFICATION_REFUSAL_REASONS: readonly ["invalid", "unknownTarget", "nobody", "overLimit", "rateLimited", "inactive"];
11
+ export type NotificationRefusalReason = (typeof NOTIFICATION_REFUSAL_REASONS)[number];
12
+ export declare class NotificationRefusedError extends Error {
13
+ readonly reason: NotificationRefusalReason;
14
+ constructor(reason: NotificationRefusalReason, message: string);
15
+ }
16
+ /** True for a NotificationRefusedError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
17
+ export declare function isNotificationRefusedError(value: unknown): value is NotificationRefusedError;
package/dist/notify.js ADDED
@@ -0,0 +1,17 @@
1
+ /** Why a send was refused. */
2
+ export const NOTIFICATION_REFUSAL_REASONS = ["invalid", "unknownTarget", "nobody", "overLimit", "rateLimited", "inactive"];
3
+ export class NotificationRefusedError extends Error {
4
+ reason;
5
+ constructor(reason, message) {
6
+ super(message);
7
+ this.name = "NotificationRefusedError";
8
+ this.reason = reason;
9
+ }
10
+ }
11
+ /** True for a NotificationRefusedError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
12
+ export function isNotificationRefusedError(value) {
13
+ if (!(value instanceof Error) || value.name !== "NotificationRefusedError")
14
+ return false;
15
+ const reason = value.reason;
16
+ return typeof reason === "string" && NOTIFICATION_REFUSAL_REASONS.includes(reason);
17
+ }
@@ -21,6 +21,9 @@ export type PluginTranslate = (key: string, values?: Record<string, string | num
21
21
  * - `kind: "rail"`: an entry the plugin adds to a built-in section's rail
22
22
  * (content, media, settings, users). `sectionId` is null, because the
23
23
  * section is not the plugin's; `entryId` is the entry's id.
24
+ * - `kind: "widget"`: a dashboard widget on the admin's Home page (S313b).
25
+ * `widgetId` is the widget's id; `sectionId` and `entryId` are null,
26
+ * because a widget belongs to no section.
24
27
  */
25
28
  export interface PluginScreenContext {
26
29
  pluginId: string;
@@ -28,6 +31,11 @@ export interface PluginScreenContext {
28
31
  kind: "section" | "sectionRail" | "rail";
29
32
  sectionId: string | null;
30
33
  entryId: string | null;
34
+ } | {
35
+ kind: "widget";
36
+ sectionId: null;
37
+ entryId: null;
38
+ widgetId: string;
31
39
  };
32
40
  /** The admin's active language, for formatting dates and numbers. A
33
41
  * screen's words come from `t`. */
@@ -40,7 +48,9 @@ export interface PluginScreenContext {
40
48
  * section's landing page. Anything else (a path such as `..`, another
41
49
  * plugin's URL, an id the section's rail does not declare) does nothing,
42
50
  * with a console warning in development. Always a no-op for a built-in
43
- * rail entry, whose section is not the plugin's.
51
+ * rail entry and for a dashboard widget, whose place is not the plugin's
52
+ * to move; a widget's navigate also prints a console warning in
53
+ * development, naming the plugin and the target.
44
54
  */
45
55
  navigate: (entryId: string | null) => void;
46
56
  }