@kardalum/plugin-sdk 0.18.0 → 0.20.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 (435) hide show
  1. package/CHANGELOG.md +253 -0
  2. package/README.md +20 -1
  3. package/dist/admin-section-registry.d.ts +16 -1
  4. package/dist/admin-section-registry.js +23 -0
  5. package/dist/assets/asset-picker.js +3 -3
  6. package/dist/built-in-editor-ids.d.ts +1 -1
  7. package/dist/built-in-editor-ids.js +2 -20
  8. package/dist/built-in-serializers.js +1 -1
  9. package/dist/built-in-settings-schemas.d.ts +10 -0
  10. package/dist/built-in-settings-schemas.js +90 -4
  11. package/dist/built-in-value-schemas.js +35 -0
  12. package/dist/built-ins.js +48 -17
  13. package/dist/capabilities.d.ts +11 -1
  14. package/dist/capabilities.js +55 -3
  15. package/dist/cli.d.ts +66 -0
  16. package/dist/cli.js +22 -0
  17. package/dist/content-library.d.ts +85 -0
  18. package/dist/content-library.js +15 -0
  19. package/dist/content-picker/page-picker-sheet.d.ts +13 -0
  20. package/dist/content-picker/page-picker-sheet.js +105 -0
  21. package/dist/content-picker/page-tree.d.ts +25 -0
  22. package/dist/content-picker/page-tree.js +132 -0
  23. package/dist/data-type-plugin.d.ts +9 -3
  24. package/dist/datatype-validation.d.ts +6 -11
  25. package/dist/datatype-validation.js +141 -3
  26. package/dist/define-plugin.d.ts +4 -4
  27. package/dist/define-plugin.js +5 -5
  28. package/dist/entitlement-entry.d.ts +1 -1
  29. package/dist/entitlement-entry.js +1 -1
  30. package/dist/entitlement-gate.d.ts +14 -0
  31. package/dist/entitlement-gate.js +64 -7
  32. package/dist/entitlement-plan.d.ts +6 -0
  33. package/dist/entitlement-plan.js +10 -0
  34. package/dist/entitlement-types.d.ts +36 -12
  35. package/dist/entitlement.d.ts +31 -4
  36. package/dist/entitlement.js +58 -17
  37. package/dist/hook-entry.d.ts +5 -0
  38. package/dist/hook-entry.js +30 -0
  39. package/dist/host-entry.d.ts +1 -1
  40. package/dist/host-entry.js +1 -1
  41. package/dist/index.d.ts +38 -4
  42. package/dist/index.js +54 -3
  43. package/dist/mail.d.ts +30 -0
  44. package/dist/mail.js +1 -0
  45. package/dist/manifest-entry.d.ts +29 -4
  46. package/dist/manifest-entry.js +39 -2
  47. package/dist/manifest-schema.d.ts +443 -29
  48. package/dist/manifest-schema.js +292 -24
  49. package/dist/manifest.d.ts +450 -51
  50. package/dist/manifest.js +1 -1
  51. package/dist/media/media-picker.js +33 -20
  52. package/dist/media/upload-error.d.ts +5 -1
  53. package/dist/media/upload-error.js +14 -2
  54. package/dist/media-library.d.ts +32 -0
  55. package/dist/media-library.js +15 -0
  56. package/dist/nested-field-host.d.ts +76 -0
  57. package/dist/nested-field-host.js +90 -0
  58. package/dist/notify.d.ts +12 -4
  59. package/dist/notify.js +1 -1
  60. package/dist/outbound.d.ts +47 -0
  61. package/dist/outbound.js +1 -0
  62. package/dist/plugin-context.d.ts +5 -0
  63. package/dist/plugin-context.js +3 -3
  64. package/dist/plugin-screen-context.d.ts +112 -0
  65. package/dist/plugin-screen-context.js +26 -0
  66. package/dist/providers.d.ts +268 -0
  67. package/dist/providers.js +74 -0
  68. package/dist/read-all-pages.d.ts +5 -0
  69. package/dist/read-all-pages.js +3 -2
  70. package/dist/register-built-ins.js +6 -6
  71. package/dist/registry.js +1 -1
  72. package/dist/richtext/block-panel.js +12 -7
  73. package/dist/richtext/extensions.js +7 -7
  74. package/dist/richtext/insert-menu.js +12 -9
  75. package/dist/richtext/style-listbox.js +7 -5
  76. package/dist/richtext/text-style-class.js +1 -1
  77. package/dist/sdk-strings.d.ts +285 -0
  78. package/dist/sdk-strings.js +347 -0
  79. package/dist/sealing.d.ts +14 -0
  80. package/dist/sealing.js +1 -0
  81. package/dist/simple-storage-value-provider.js +27 -27
  82. package/dist/structured-storage-types.d.ts +309 -9
  83. package/dist/structured-storage-types.js +2 -2
  84. package/dist/text-entry.d.ts +1 -0
  85. package/dist/text-entry.js +6 -0
  86. package/dist/tokens/tailwind-theme.css +5 -0
  87. package/dist/tokens/tokens.css +15 -3
  88. package/dist/tokens/tokens.json +8 -3
  89. package/dist/ui-entry.js +3 -3
  90. package/dist/views/asset-view.js +6 -3
  91. package/dist/views/content-list-preview.js +3 -1
  92. package/dist/views/content-list-settings-view.js +11 -7
  93. package/dist/views/content-list-view.d.ts +5 -3
  94. package/dist/views/content-list-view.js +38 -34
  95. package/dist/views/content-picker-view.d.ts +3 -0
  96. package/dist/views/content-picker-view.js +143 -0
  97. package/dist/views/crop-view.d.ts +4 -6
  98. package/dist/views/crop-view.js +22 -13
  99. package/dist/views/date-range-view.js +9 -6
  100. package/dist/views/file-upload-view.d.ts +5 -7
  101. package/dist/views/file-upload-view.js +16 -7
  102. package/dist/views/group-view.d.ts +8 -0
  103. package/dist/views/group-view.js +123 -0
  104. package/dist/views/html-code-editor.js +2 -2
  105. package/dist/views/html-view.js +12 -11
  106. package/dist/views/image-view.js +40 -22
  107. package/dist/views/link-view.d.ts +3 -0
  108. package/dist/views/link-view.js +150 -0
  109. package/dist/views/options-list-view.d.ts +3 -0
  110. package/dist/views/options-list-view.js +104 -0
  111. package/dist/views/repeatable-list-view.d.ts +3 -0
  112. package/dist/views/repeatable-list-view.js +113 -0
  113. package/dist/views/rich-text-view.js +32 -16
  114. package/dist/views/suggest-key.d.ts +17 -0
  115. package/dist/views/suggest-key.js +55 -0
  116. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
  117. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
  118. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
  119. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
  120. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
  121. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
  122. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
  123. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
  124. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
  125. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
  126. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
  127. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
  128. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
  129. package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
  130. package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
  131. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +116 -3
  132. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +71 -18
  133. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
  134. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
  135. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
  136. package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
  137. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
  138. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
  139. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
  140. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
  141. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
  142. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
  143. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
  144. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
  145. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
  146. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
  147. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
  148. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
  149. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
  150. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
  151. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
  152. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +9 -1
  153. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +4 -4
  154. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
  155. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
  156. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +267 -12
  157. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +54 -8
  158. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
  159. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +98 -13
  160. package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
  161. package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
  162. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
  163. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
  164. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
  165. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
  166. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +122 -43
  167. package/node_modules/@kardalum/api-schemas/dist/index.js +92 -27
  168. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
  169. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
  170. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
  171. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
  172. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
  173. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
  174. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
  175. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
  176. package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
  177. package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
  178. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
  179. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
  180. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
  181. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
  182. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +359 -8
  183. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +85 -11
  184. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
  185. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
  186. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
  187. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
  188. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
  189. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
  190. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
  191. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
  192. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
  193. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
  194. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
  195. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
  196. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
  197. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
  198. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
  199. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +22 -10
  200. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
  201. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
  202. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
  203. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
  204. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
  205. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
  206. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +9 -5
  207. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
  208. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
  209. package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
  210. package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
  211. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
  212. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
  213. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
  214. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
  215. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
  216. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
  217. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
  218. package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
  219. package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
  220. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
  221. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
  222. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
  223. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
  224. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
  225. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
  226. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
  227. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
  228. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
  229. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
  230. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
  231. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
  232. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
  233. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
  234. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
  235. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
  236. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
  237. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
  238. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
  239. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
  240. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
  241. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
  242. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
  243. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
  244. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
  245. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
  246. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
  247. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
  248. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
  249. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
  250. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
  251. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
  252. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
  253. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
  254. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
  255. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
  256. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
  257. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
  258. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
  259. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
  260. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
  261. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
  262. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +357 -4
  263. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +279 -0
  264. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
  265. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
  266. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
  267. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
  268. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
  269. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
  270. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
  271. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
  272. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
  273. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
  274. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
  275. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
  276. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
  277. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
  278. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
  279. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
  280. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
  281. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
  282. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
  283. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
  284. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
  285. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
  286. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
  287. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
  288. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
  289. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
  290. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +50 -7
  291. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
  292. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
  293. package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
  294. package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
  295. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
  296. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
  297. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
  298. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
  299. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  300. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
  301. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
  302. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
  303. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
  304. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
  305. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
  306. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
  307. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
  308. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
  309. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
  310. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
  311. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
  312. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +289 -0
  313. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +205 -0
  314. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +121 -0
  315. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +51 -10
  316. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
  317. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
  318. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  319. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  320. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
  321. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
  322. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
  323. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
  324. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
  325. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +1 -1
  326. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
  327. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
  328. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
  329. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
  330. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
  331. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
  332. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
  333. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
  334. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
  335. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +35 -4
  336. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
  337. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
  338. package/node_modules/@kardalum/api-schemas/package.json +1 -0
  339. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
  340. package/node_modules/@kardalum/design-tokens/dist/build-css.js +8 -2
  341. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
  342. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  343. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
  344. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
  345. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
  346. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
  347. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
  348. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
  349. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
  350. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
  351. package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
  352. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +4 -4
  353. package/node_modules/@kardalum/design-tokens/dist/tokens.js +17 -8
  354. package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
  355. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -2
  356. package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
  357. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
  358. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
  359. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
  360. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
  361. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
  362. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
  363. package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
  364. package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
  365. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
  366. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
  367. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
  368. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
  369. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
  370. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
  371. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
  372. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
  373. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
  374. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
  375. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
  376. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
  377. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
  378. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
  379. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
  380. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
  381. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
  382. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
  383. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
  384. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
  385. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
  386. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +27 -5
  387. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
  388. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
  389. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
  390. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
  391. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
  392. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  393. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
  394. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
  395. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
  396. package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
  397. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
  398. package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
  399. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
  400. package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
  401. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  402. package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
  403. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
  404. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
  405. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
  406. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
  407. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
  408. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
  409. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
  410. package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
  411. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  412. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
  413. package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
  414. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
  415. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
  416. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
  417. package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
  418. package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
  419. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
  420. package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
  421. package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
  422. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  423. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
  424. package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
  425. package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
  426. package/node_modules/@kardalum/ui/dist/components/tooltip.js +81 -0
  427. package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +16 -0
  428. package/node_modules/@kardalum/ui/dist/components/truncated-text.js +95 -0
  429. package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
  430. package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
  431. package/node_modules/@kardalum/ui/dist/index.js +3 -1
  432. package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
  433. package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
  434. package/node_modules/@kardalum/ui/package.json +8 -6
  435. package/package.json +18 -7
@@ -0,0 +1,104 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { OPTIONS_MAX, readOptionValues, readOptionsListSettings } from "@kardalum/api-schemas";
4
+ import { Button, Checkbox, IconTooltip, Input, PropertyField, cn, usePropertyFieldControl } from "@kardalum/ui";
5
+ import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
6
+ import { usePluginTranslate } from "../plugin-screen-context.js";
7
+ import { useAdminChromeProps } from "../sdk-strings.js";
8
+ import { suggestKey, useHandEditedKeys } from "./suggest-key.js";
9
+ // Month 32 C: the Options List data type's views. The field stores the chosen option's value (a
10
+ // string or null) or, when several may be chosen, a list of values in the options' order. A stored
11
+ // value that is no longer an option stays visible with a Remove, so it is never lost silently.
12
+ // The same classes as the UI package's Input, for a native select.
13
+ const SELECT_CLASS = "flex h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary transition-colors duration-fast focus-visible:border-primary-600 focus-visible:outline-hidden focus-visible:ring-4 focus-visible:ring-primary-50 disabled:cursor-not-allowed disabled:opacity-50";
14
+ // A suggested value stays well inside any option value limit.
15
+ const VALUE_SUGGEST_MAX = 100;
16
+ export function OptionsListInputView() {
17
+ const { value, onChange } = usePluginValue();
18
+ const settings = readOptionsListSettings(usePluginSettings());
19
+ const field = usePropertyFieldControl();
20
+ const t = usePluginTranslate();
21
+ const chrome = useAdminChromeProps();
22
+ const groupId = useId();
23
+ const stored = readOptionValues(value);
24
+ const known = new Set(settings.options.map((option) => option.value));
25
+ const unknown = stored.filter((entry) => !known.has(entry));
26
+ const store = (values) => {
27
+ if (settings.multiple)
28
+ onChange(values);
29
+ else
30
+ onChange(values[0] ?? null);
31
+ };
32
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-2", children: [settings.multiple ? (_jsx("div", { ...field, role: "group", className: "flex flex-col gap-2", children: settings.options.map((option, index) => {
33
+ const id = `${groupId}-${index}`;
34
+ return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: id, checked: stored.includes(option.value), onCheckedChange: (checked) => {
35
+ const next = new Set(stored);
36
+ if (checked === true)
37
+ next.add(option.value);
38
+ else
39
+ next.delete(option.value);
40
+ // Values that are no longer options keep their place after the known ones until removed.
41
+ store([
42
+ ...settings.options.map((o) => o.value).filter((v) => next.has(v)),
43
+ ...unknown.filter((v) => next.has(v)),
44
+ ]);
45
+ } }), _jsx("label", { htmlFor: id, className: "text-sm text-text-primary", children: option.label })] }, option.value));
46
+ }) })) : (_jsxs("select", { ...field, className: SELECT_CLASS, value: stored[0] !== undefined && known.has(stored[0]) ? stored[0] : "", onChange: (event) => onChange(event.target.value === "" ? null : event.target.value), children: [_jsx("option", { value: "", children: t("optionsList.none") }), settings.options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] })), unknown.map((entry) => (_jsxs("div", { className: "flex items-center gap-3 text-sm text-text-secondary", children: [_jsx("span", { children: t("optionsList.notAnOption", { value: entry }) }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "ms-auto", onClick: () => store(stored.filter((v) => v !== entry)), children: t("optionsList.remove") })] }, entry)))] }));
47
+ }
48
+ export function OptionsListReadOnlyView() {
49
+ const { value } = usePluginValue();
50
+ const settings = readOptionsListSettings(usePluginSettings());
51
+ const t = usePluginTranslate();
52
+ const chrome = useAdminChromeProps();
53
+ const stored = readOptionValues(value);
54
+ const labels = stored.map((entry) => settings.options.find((option) => option.value === entry)?.label ?? entry);
55
+ return (_jsx("span", { ...chrome, className: cn("text-sm", labels.length === 0 ? "text-text-tertiary" : "text-text-primary"), children: labels.length === 0 ? t("optionsList.none") : labels.join(", ") }));
56
+ }
57
+ function rawOptions(settings) {
58
+ if (!Array.isArray(settings.options))
59
+ return [];
60
+ return settings.options.slice(0, OPTIONS_MAX).map((entry) => {
61
+ const bag = typeof entry === "object" && entry !== null ? entry : {};
62
+ return { label: typeof bag.label === "string" ? bag.label : "", value: typeof bag.value === "string" ? bag.value : "" };
63
+ });
64
+ }
65
+ export function OptionsListSettingsView() {
66
+ const { value: settings, onChange } = usePluginSettingsValue();
67
+ const t = usePluginTranslate();
68
+ const groupName = useId();
69
+ const messageId = useId();
70
+ // Rows are read raw, never through the parsed reader: a row being typed may be empty or a duplicate.
71
+ const options = rawOptions(settings);
72
+ const multiple = settings.multiple === true;
73
+ const write = (next, nextMultiple = multiple) => onChange({ ...settings, options: next, multiple: nextMultiple });
74
+ const update = (index, patch) => write(options.map((o, i) => (i === index ? { ...o, ...patch } : o)));
75
+ const keys = useHandEditedKeys(options.map((o) => o.value));
76
+ const move = (index, by) => {
77
+ keys.moved(index, by);
78
+ const next = [...options];
79
+ const [row] = next.splice(index, 1);
80
+ next.splice(index + by, 0, row);
81
+ write(next);
82
+ };
83
+ const counts = new Map();
84
+ for (const option of options)
85
+ if (option.value !== "")
86
+ counts.set(option.value, (counts.get(option.value) ?? 0) + 1);
87
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: t("optionsList.optionsLabel"), helpText: t("optionsList.optionsHint"), children: _jsxs("div", { className: "flex flex-col gap-3", children: [options.length === 0 && _jsx("p", { className: "text-sm text-text-tertiary", children: t("optionsList.emptyOptions") }), options.map((option, index) => {
88
+ const name = option.label !== "" ? option.label : option.value;
89
+ const duplicate = option.value !== "" && (counts.get(option.value) ?? 0) > 1;
90
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-end gap-2", children: [_jsxs("div", { className: "flex min-w-32 flex-1 flex-col gap-1", children: [_jsx("label", { htmlFor: `${messageId}-label-${index}`, className: "text-xs font-medium text-text-secondary", children: t("optionsList.labelColumn") }), _jsx(Input, { id: `${messageId}-label-${index}`, placeholder: t("optionsList.labelPlaceholder"), value: option.label, onChange: (event) => {
91
+ const label = event.target.value;
92
+ update(index, keys.follows(index) ? { label, value: suggestKey(label, VALUE_SUGGEST_MAX, false) } : { label });
93
+ } })] }), _jsxs("div", { className: "flex min-w-32 flex-1 flex-col gap-1", children: [_jsx("label", { htmlFor: `${messageId}-value-${index}`, className: "text-xs font-medium text-text-secondary", children: t("optionsList.valueColumn") }), _jsx(Input, { id: `${messageId}-value-${index}`, placeholder: t("optionsList.valuePlaceholder"), value: option.value, "aria-invalid": duplicate || undefined, "aria-describedby": duplicate ? `${messageId}-${index}` : undefined, onChange: (event) => {
94
+ keys.markByHand(index);
95
+ update(index, { value: event.target.value });
96
+ } })] }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "ms-auto", disabled: index === 0, "aria-label": t("optionsList.moveUp", { label: name }), onClick: () => move(index, -1), children: _jsx("span", { "aria-hidden": "true", children: "\u2191" }) }) }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: index === options.length - 1, "aria-label": t("optionsList.moveDown", { label: name }), onClick: () => move(index, 1), children: _jsx("span", { "aria-hidden": "true", children: "\u2193" }) }) }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": t("optionsList.removeOption", { label: name }), onClick: () => {
97
+ keys.removed(index);
98
+ write(options.filter((_, i) => i !== index));
99
+ }, children: t("optionsList.remove") })] }), duplicate && (_jsx("p", { id: `${messageId}-${index}`, role: "alert", className: "text-xs text-danger-600", children: t("optionsList.duplicateValue", { value: option.value }) }))] }, index));
100
+ }), _jsx("div", { children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: options.length >= OPTIONS_MAX, onClick: () => {
101
+ keys.added();
102
+ write([...options, { label: "", value: "" }]);
103
+ }, children: t("optionsList.addOption") }) })] }) }), _jsxs("fieldset", { className: "flex flex-col gap-2", children: [_jsx("legend", { className: "text-sm font-medium text-text-primary", children: t("optionsList.modeLabel") }), [false, true].map((mode) => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-text-primary", children: [_jsx("input", { type: "radio", name: groupName, checked: multiple === mode, onChange: () => write(options, mode), className: "accent-primary-600" }), t(mode ? "optionsList.modeMultiple" : "optionsList.modeSingle")] }, String(mode))))] })] }));
104
+ }
@@ -0,0 +1,3 @@
1
+ export declare function RepeatableListInputView(): import("react").JSX.Element;
2
+ export declare function RepeatableListReadOnlyView(): import("react").JSX.Element;
3
+ export declare function RepeatableListSettingsView(): import("react").JSX.Element;
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { LIST_ITEMS_MAX, readRepeatableListSettings } from "@kardalum/api-schemas";
4
+ import { Button, IconTooltip, Input, PropertyField } from "@kardalum/ui";
5
+ import { NestedField, holdsRichText, isNestableEditor, useNestedFieldHost } from "../nested-field-host.js";
6
+ import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
7
+ import { usePluginTranslate } from "../plugin-screen-context.js";
8
+ import { useAdminChromeProps } from "../sdk-strings.js";
9
+ import { SELECT_CLASS, ValueSummary } from "./group-view.js";
10
+ // Month 32 D: the Repeatable List data type's views. The value is a list; every item is the item
11
+ // data type's own value, mounted through the nested field host.
12
+ /**
13
+ * A stable id per list item, kept beside the value so a removed or moved item takes its editor's
14
+ * local state (a Link's draft label, an open picker) with it instead of handing it to a neighbour.
15
+ * The ids move with their items on Move and Remove; a length change from outside keeps the ids it
16
+ * can and gives new items fresh ones.
17
+ */
18
+ function useItemIds(count) {
19
+ const ids = useRef([]);
20
+ const counter = useRef(0);
21
+ const fresh = () => {
22
+ counter.current += 1;
23
+ return `item-${counter.current}`;
24
+ };
25
+ if (ids.current.length !== count) {
26
+ const next = ids.current.slice(0, count);
27
+ while (next.length < count)
28
+ next.push(fresh());
29
+ ids.current = next;
30
+ }
31
+ return { ids: ids.current, fresh, set: (next) => (ids.current = next) };
32
+ }
33
+ export function RepeatableListInputView() {
34
+ const { value, onChange } = usePluginValue();
35
+ const settings = readRepeatableListSettings(usePluginSettings());
36
+ const host = useNestedFieldHost();
37
+ const t = usePluginTranslate();
38
+ const chrome = useAdminChromeProps();
39
+ const items = Array.isArray(value) ? value : [];
40
+ const itemIds = useItemIds(items.length);
41
+ if (!host) {
42
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-2", children: [_jsx(RepeatableListReadOnlyView, {}), _jsx("p", { className: "text-sm text-text-tertiary", children: t("repeatableList.noHost") })] }));
43
+ }
44
+ const type = settings.itemDataTypeId ? host.resolve(settings.itemDataTypeId) : null;
45
+ if (!type) {
46
+ return (_jsx("p", { ...chrome, className: "text-sm text-text-tertiary", children: t("repeatableList.noItemType") }));
47
+ }
48
+ if (type.readOnlyNote) {
49
+ // M32 F4d (D16): the item type's plugin is read-only, so the server keeps the list whole;
50
+ // the items are shown read-only with the note once, and nothing offers to add or remove.
51
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-2", children: [_jsx(RepeatableListReadOnlyView, {}), _jsx("p", { className: "text-sm text-text-tertiary", children: type.readOnlyNote })] }));
52
+ }
53
+ // M32 F4d (D16): an item holds a read-only sub-field, so the server keeps the list whole on a
54
+ // count change: the items stay editable, but nothing offers to add, move or remove one.
55
+ const fixed = type.holdsReadOnly === true;
56
+ const max = settings.max ?? LIST_ITEMS_MAX;
57
+ const move = (index, by) => {
58
+ const next = [...items];
59
+ const [item] = next.splice(index, 1);
60
+ next.splice(index + by, 0, item);
61
+ const ids = [...itemIds.ids];
62
+ const [id] = ids.splice(index, 1);
63
+ ids.splice(index + by, 0, id);
64
+ itemIds.set(ids);
65
+ onChange(next);
66
+ };
67
+ const remove = (index) => {
68
+ itemIds.set(itemIds.ids.filter((_, i) => i !== index));
69
+ onChange(items.filter((_, i) => i !== index));
70
+ };
71
+ const add = () => {
72
+ itemIds.set([...itemIds.ids, itemIds.fresh()]);
73
+ onChange([...items, null]);
74
+ };
75
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-3", children: [items.length === 0 && _jsx("p", { className: "text-sm text-text-tertiary", children: t("repeatableList.empty") }), items.map((item, index) => {
76
+ const n = index + 1;
77
+ return (_jsxs("div", { className: "flex flex-col gap-3 rounded-md border border-border-default p-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-text-primary", children: t("repeatableList.itemLabel", { n }) }), !fixed && (_jsxs(_Fragment, { children: [_jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "ms-auto", disabled: index === 0, "aria-label": t("repeatableList.moveUp", { n }), onClick: () => move(index, -1), children: _jsx("span", { "aria-hidden": "true", children: "\u2191" }) }) }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: index === items.length - 1, "aria-label": t("repeatableList.moveDown", { n }), onClick: () => move(index, 1), children: _jsx("span", { "aria-hidden": "true", children: "\u2193" }) }) }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": t("repeatableList.removeItem", { n }), onClick: () => remove(index), children: _jsx("span", { "aria-hidden": "true", children: "\u2715" }) }) })] }))] }), _jsx(NestedField, { type: type, value: item, onChange: (next) => onChange(items.map((existing, i) => (i === index ? next : existing))) })] }, itemIds.ids[index]));
78
+ }), fixed ? (type.holdsReadOnlyNote ? _jsx("p", { className: "text-sm text-text-tertiary", children: type.holdsReadOnlyNote }) : null) : (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: items.length >= max, onClick: add, children: t("repeatableList.addItem") }), _jsx("span", { className: "text-sm text-text-tertiary", children: t("repeatableList.count", { count: items.length, max }) }), settings.min !== null && settings.min > 0 && (_jsx("span", { className: "text-sm text-text-tertiary", children: t("repeatableList.minHint", { min: settings.min }) }))] }))] }));
79
+ }
80
+ export function RepeatableListReadOnlyView() {
81
+ const { value } = usePluginValue();
82
+ const settings = readRepeatableListSettings(usePluginSettings());
83
+ const host = useNestedFieldHost();
84
+ const t = usePluginTranslate();
85
+ const chrome = useAdminChromeProps();
86
+ const items = Array.isArray(value) ? value : [];
87
+ if (items.length === 0) {
88
+ return (_jsx("span", { ...chrome, className: "text-sm text-text-tertiary", children: t("repeatableList.empty") }));
89
+ }
90
+ const type = host && settings.itemDataTypeId ? host.resolve(settings.itemDataTypeId) : null;
91
+ return (_jsx("ol", { ...chrome, className: "flex flex-col gap-3", children: items.map((item, index) => (_jsxs("li", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium text-text-secondary", children: t("repeatableList.itemLabel", { n: index + 1 }) }), _jsx("div", { className: "text-sm text-text-primary", children: !host ? (_jsx(ValueSummary, { value: item })) : type ? (_jsx(NestedField, { type: type, value: item, onChange: () => { }, readOnly: true })) : (_jsx("span", { className: "text-text-tertiary", children: t("repeatableList.noItemType") })) })] }, index))) }));
92
+ }
93
+ function readLimit(raw) {
94
+ if (raw.trim() === "")
95
+ return null;
96
+ const n = Number(raw);
97
+ return Number.isFinite(n) ? Math.trunc(n) : null;
98
+ }
99
+ export function RepeatableListSettingsView() {
100
+ const { value: settings, onChange } = usePluginSettingsValue();
101
+ const host = useNestedFieldHost();
102
+ const t = usePluginTranslate();
103
+ const itemId = typeof settings.itemDataTypeId === "string" ? settings.itemDataTypeId : "";
104
+ const min = typeof settings.min === "number" ? settings.min : null;
105
+ const max = typeof settings.max === "number" ? settings.max : null;
106
+ const write = (patch) => onChange({ ...settings, itemDataTypeId: itemId === "" ? null : itemId, min, max, ...patch });
107
+ // M32 I2 (A4): rich text, and a Group holding it, cannot be repeated; the server refuses the save.
108
+ const choices = host
109
+ ? host.listDataTypes().filter((d) => isNestableEditor(host, d.editorId) && !holdsRichText(host, d.id))
110
+ : [];
111
+ const known = choices.some((d) => d.id === itemId);
112
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: t("repeatableList.itemTypeLabel"), helpText: t("repeatableList.itemTypeHint"), children: host ? (_jsxs("select", { className: SELECT_CLASS, value: itemId, onChange: (event) => write({ itemDataTypeId: event.target.value === "" ? null : event.target.value }), children: [_jsx("option", { value: "", children: t("group.chooseDataType") }), itemId !== "" && !known && (_jsx("option", { value: itemId, disabled: true, children: t("repeatableList.missingType") })), choices.map((d) => (_jsx("option", { value: d.id, children: d.name }, d.id)))] })) : (_jsx("p", { className: "text-sm text-text-tertiary", children: t("repeatableList.noHost") })) }), _jsx(PropertyField, { label: t("repeatableList.minLabel"), helpText: t("repeatableList.limitsHint", { max: LIST_ITEMS_MAX }), children: _jsx(Input, { type: "number", min: 0, value: min ?? "", onChange: (event) => write({ min: readLimit(event.target.value) }) }) }), _jsx(PropertyField, { label: t("repeatableList.maxLabel"), children: _jsx(Input, { type: "number", min: 1, value: max ?? "", onChange: (event) => write({ max: readLimit(event.target.value) }) }) }), min !== null && max !== null && min > max && (_jsx("p", { className: "text-xs text-danger-600", children: t("repeatableList.minAboveMax") }))] }));
113
+ }
@@ -3,13 +3,15 @@ import { useEffect, useRef, useState } from "react";
3
3
  import { EditorContent, useEditor } from "@tiptap/react";
4
4
  import { NodeSelection } from "@tiptap/pm/state";
5
5
  import { Code2, Image as ImageIcon, Link as LinkIcon, List as ListIcon, Quote as QuoteIcon } from "lucide-react";
6
- import { cn, usePropertyFieldControl } from "@kardalum/ui";
6
+ import { cn, IconTooltip, usePropertyFieldControl } from "@kardalum/ui";
7
7
  import { MANAGE_API, usePluginApi, usePluginValue } from "../plugin-context.js";
8
8
  import { buildRichtextExtensions } from "../richtext/extensions.js";
9
9
  import { MediaPicker } from "../media/media-picker.js";
10
10
  import { BlockInsertMenu, defaultBlockParams } from "../richtext/insert-menu.js";
11
11
  import { BlockPanel, BlockPreviewPopover } from "../richtext/block-panel.js";
12
12
  import { StyleListbox } from "../richtext/style-listbox.js";
13
+ import { useInsideNestedField } from "../nested-field-host.js";
14
+ import { useAdminDirection, useAdminLanguage, useSdkString } from "../sdk-strings.js";
13
15
  // The rich content editor (S197 spec §3): one TipTap editor definition
14
16
  // (buildRichtextExtensions), mounted here with a fixed compact toolbar per
15
17
  // the mockup's screen 3: the same commands the on-page bubble toolbar
@@ -77,8 +79,10 @@ function useTextStyles() {
77
79
  // pattern): one stop in the page Tab order, arrow keys move focus among
78
80
  // buttons, Home/End jump to the ends. Disabled buttons (Block, Edit on
79
81
  // page, both placeholders this task) are skipped entirely, matching
80
- // native disabled-control behavior, so they can never hold focus.
81
- function useToolbarRovingTabIndex(focusableKeys) {
82
+ // native disabled-control behavior, so they can never hold focus. The
83
+ // toolbar reads in the admin's direction (S366f D10), so Right moves on in a
84
+ // left-to-right admin and back in a right-to-left one.
85
+ function useToolbarRovingTabIndex(focusableKeys, dir) {
82
86
  const [activeKey, setActiveKey] = useState(focusableKeys[0] ?? null);
83
87
  const refs = useRef(new Map());
84
88
  useEffect(() => {
@@ -106,11 +110,13 @@ function useToolbarRovingTabIndex(focusableKeys) {
106
110
  return;
107
111
  const currentIndex = activeKey !== null ? focusableKeys.indexOf(activeKey) : 0;
108
112
  let nextIndex = currentIndex;
113
+ const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
114
+ const back = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
109
115
  switch (event.key) {
110
- case "ArrowRight":
116
+ case forward:
111
117
  nextIndex = (currentIndex + 1) % focusableKeys.length;
112
118
  break;
113
- case "ArrowLeft":
119
+ case back:
114
120
  nextIndex = (currentIndex - 1 + focusableKeys.length) % focusableKeys.length;
115
121
  break;
116
122
  case "Home":
@@ -127,8 +133,9 @@ function useToolbarRovingTabIndex(focusableKeys) {
127
133
  }
128
134
  return { activeKey, setActiveKey, registerRef, handleKeyDown };
129
135
  }
130
- function ToolbarButton({ itemKey, label, ariaLabel, title, active, disabled, expanded, hasPopup, isRovingActive, registerRef, onFocus, onClick, }) {
131
- return (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, title: title, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", active && "bg-primary-100 text-primary-800"), children: label }));
136
+ function ToolbarButton({ itemKey, label, ariaLabel, active, disabled, expanded, hasPopup, isRovingActive, registerRef, onFocus, onClick, }) {
137
+ const button = (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", active && "bg-primary-100 text-primary-800"), children: label }));
138
+ return ariaLabel ? _jsx(IconTooltip, { children: button }) : button;
132
139
  }
133
140
  function ToolbarSeparator() {
134
141
  return _jsx("span", { "aria-hidden": "true", className: "mx-1 inline-block h-4 w-px bg-border-default" });
@@ -139,6 +146,7 @@ function ToolbarSeparator() {
139
146
  function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
140
147
  const [href, setHref] = useState(initialHref);
141
148
  const inputRef = useRef(null);
149
+ const s = useSdkString();
142
150
  useEffect(() => {
143
151
  inputRef.current?.focus();
144
152
  inputRef.current?.select();
@@ -148,13 +156,13 @@ function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
148
156
  event.preventDefault();
149
157
  onClose();
150
158
  }
151
- }, children: [_jsx("label", { htmlFor: "rt-link-href", className: "mb-1 block text-xs font-medium text-text-secondary", children: "Link URL" }), _jsx("input", { ref: inputRef, id: "rt-link-href", type: "url", value: href, placeholder: "https://", onChange: (event) => setHref(event.target.value), onKeyDown: (event) => {
159
+ }, children: [_jsx("label", { htmlFor: "rt-link-href", className: "mb-1 block text-xs font-medium text-text-secondary", children: s("richText.linkUrl") }), _jsx("input", { ref: inputRef, id: "rt-link-href", type: "url", value: href, placeholder: "https://", onChange: (event) => setHref(event.target.value), onKeyDown: (event) => {
152
160
  if (event.key === "Enter") {
153
161
  event.preventDefault();
154
162
  if (href.trim())
155
163
  onApply(href.trim());
156
164
  }
157
- }, className: "mb-2 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("div", { className: "flex justify-end gap-2", children: [hasLink && (_jsx("button", { type: "button", onClick: onRemove, className: "rounded-md px-2 py-1 text-xs text-danger-600 hover:bg-background-hover", children: "Remove link" })), _jsx("button", { type: "button", disabled: !href.trim(), onClick: () => onApply(href.trim()), className: "rounded-md bg-primary-600 px-2 py-1 text-xs font-medium text-text-inverse hover:bg-primary-700 disabled:opacity-50", children: "Apply" })] })] }));
165
+ }, className: "mb-2 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("div", { className: "flex justify-end gap-2", children: [hasLink && (_jsx("button", { type: "button", onClick: onRemove, className: "rounded-md px-2 py-1 text-xs text-danger-600 hover:bg-background-hover", children: s("richText.removeLink") })), _jsx("button", { type: "button", disabled: !href.trim(), onClick: () => onApply(href.trim()), className: "rounded-md bg-primary-600 px-2 py-1 text-xs font-medium text-text-inverse hover:bg-primary-700 disabled:opacity-50", children: s("richText.apply") })] })] }));
158
166
  }
159
167
  // S197 Task 12: bubbles up so a mount that HAS routing (content-editor.tsx,
160
168
  // admin-ui) can navigate to /content/:id/edit-on-page, the same "plain DOM
@@ -169,6 +177,13 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
169
177
  const { styles: textStyles, loading: textStylesLoading } = useTextStyles();
170
178
  const [openPopover, setOpenPopover] = useState(null);
171
179
  const [pickerOpen, setPickerOpen] = useState(false);
180
+ const s = useSdkString();
181
+ // M32 I2 (A4): inside a Group there is no page to edit on.
182
+ const nested = useInsideNestedField();
183
+ // The toolbar is the admin's chrome, so it takes the admin's direction;
184
+ // the editable surface below keeps the content's (S366f D10).
185
+ const dir = useAdminDirection();
186
+ const lang = useAdminLanguage();
172
187
  const activeStyleKey = editor.getAttributes("textStyleClass").styleKey ?? null;
173
188
  const allItemKeys = [
174
189
  "bold",
@@ -182,14 +197,14 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
182
197
  "image",
183
198
  "block",
184
199
  "source",
185
- "editOnPage",
200
+ ...(nested ? [] : ["editOnPage"]),
186
201
  ];
187
202
  // Every other command is disabled in source mode (editing raw HTML has no
188
203
  // "toggle bold" equivalent); Source itself is the only tab stop then, so
189
204
  // the roving tabindex's own focusable set shrinks to match, same as the
190
205
  // doc comment above useToolbarRovingTabIndex describes for disabled items.
191
206
  const focusableKeys = sourceMode ? ["source"] : allItemKeys;
192
- const { activeKey, setActiveKey, registerRef, handleKeyDown } = useToolbarRovingTabIndex(focusableKeys);
207
+ const { activeKey, setActiveKey, registerRef, handleKeyDown } = useToolbarRovingTabIndex(focusableKeys, dir);
193
208
  function closePopover() {
194
209
  setOpenPopover(null);
195
210
  }
@@ -210,17 +225,17 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
210
225
  setPickerOpen(false);
211
226
  }
212
227
  const linkAttrs = editor.getAttributes("link");
213
- return (_jsxs("div", { role: "toolbar", "aria-label": "Formatting", "aria-orientation": "horizontal", onKeyDown: handleKeyDown,
228
+ return (_jsxs("div", { role: "toolbar", dir: dir, lang: lang, "aria-label": s("richText.toolbar"), "aria-orientation": "horizontal", onKeyDown: handleKeyDown,
214
229
  // gap-1/p-2 (not the mockup's literal .15rem/.4rem: the token scale's
215
230
  // nearest whole steps; gap-0.5/p-1.5 generate no CSS at all under this
216
231
  // project's replaced spacing scale, see the admin UI conventions).
217
- className: "relative flex flex-wrap items-center gap-1 border-b border-border-default bg-background-subtle p-2", children: [_jsx(ToolbarButton, { itemKey: "bold", label: _jsx("span", { className: "font-bold", children: "B" }), ariaLabel: "Bold", active: editor.isActive("bold"), disabled: sourceMode, isRovingActive: activeKey === "bold", registerRef: registerRef("bold"), onFocus: () => setActiveKey("bold"), onClick: () => editor.chain().focus().toggleBold().run() }), _jsx(ToolbarButton, { itemKey: "italic", label: _jsx("span", { className: "italic", children: "I" }), ariaLabel: "Italic", active: editor.isActive("italic"), disabled: sourceMode, isRovingActive: activeKey === "italic", registerRef: registerRef("italic"), onFocus: () => setActiveKey("italic"), onClick: () => editor.chain().focus().toggleItalic().run() }), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "link", label: _jsxs(_Fragment, { children: [_jsx(LinkIcon, { "aria-hidden": "true", className: "size-4" }), "Link"] }), active: editor.isActive("link"), disabled: sourceMode, hasPopup: "dialog", expanded: openPopover === "link", isRovingActive: activeKey === "link", registerRef: registerRef("link"), onFocus: () => setActiveKey("link"), onClick: () => setOpenPopover((current) => (current === "link" ? null : "link")) }), openPopover === "link" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(LinkPopover, { initialHref: linkAttrs.href ?? "", hasLink: editor.isActive("link"), onApply: (href) => {
232
+ className: "relative flex flex-wrap items-center gap-1 border-b border-border-default bg-background-subtle p-2", children: [_jsx(ToolbarButton, { itemKey: "bold", label: _jsx("span", { className: "font-bold", children: s("richText.boldMark") }), ariaLabel: s("richText.bold"), active: editor.isActive("bold"), disabled: sourceMode, isRovingActive: activeKey === "bold", registerRef: registerRef("bold"), onFocus: () => setActiveKey("bold"), onClick: () => editor.chain().focus().toggleBold().run() }), _jsx(ToolbarButton, { itemKey: "italic", label: _jsx("span", { className: "italic", children: s("richText.italicMark") }), ariaLabel: s("richText.italic"), active: editor.isActive("italic"), disabled: sourceMode, isRovingActive: activeKey === "italic", registerRef: registerRef("italic"), onFocus: () => setActiveKey("italic"), onClick: () => editor.chain().focus().toggleItalic().run() }), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "link", label: _jsxs(_Fragment, { children: [_jsx(LinkIcon, { "aria-hidden": "true", className: "size-4" }), s("richText.link")] }), active: editor.isActive("link"), disabled: sourceMode, hasPopup: "dialog", expanded: openPopover === "link", isRovingActive: activeKey === "link", registerRef: registerRef("link"), onFocus: () => setActiveKey("link"), onClick: () => setOpenPopover((current) => (current === "link" ? null : "link")) }), openPopover === "link" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(LinkPopover, { initialHref: linkAttrs.href ?? "", hasLink: editor.isActive("link"), onApply: (href) => {
218
233
  editor.chain().focus().extendMarkRange("link").setLink({ href }).run();
219
234
  closePopover();
220
235
  }, onRemove: () => {
221
236
  editor.chain().focus().unsetLink().run();
222
237
  closePopover();
223
- }, onClose: closePopover }) }))] }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "h2", label: "H2", ariaLabel: "Heading 2", active: editor.isActive("heading", { level: 2 }), disabled: sourceMode, isRovingActive: activeKey === "h2", registerRef: registerRef("h2"), onFocus: () => setActiveKey("h2"), onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run() }), _jsx(ToolbarButton, { itemKey: "h3", label: "H3", ariaLabel: "Heading 3", active: editor.isActive("heading", { level: 3 }), disabled: sourceMode, isRovingActive: activeKey === "h3", registerRef: registerRef("h3"), onFocus: () => setActiveKey("h3"), onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run() }), _jsx(ToolbarButton, { itemKey: "blockquote", label: _jsx(QuoteIcon, { "aria-hidden": "true", className: "size-4" }), ariaLabel: "Quote", active: editor.isActive("blockquote"), disabled: sourceMode, isRovingActive: activeKey === "blockquote", registerRef: registerRef("blockquote"), onFocus: () => setActiveKey("blockquote"), onClick: () => editor.chain().focus().toggleBlockquote().run() }), _jsx(ToolbarButton, { itemKey: "bulletList", label: _jsxs(_Fragment, { children: [_jsx(ListIcon, { "aria-hidden": "true", className: "size-4" }), "List"] }), ariaLabel: "Bulleted list", active: editor.isActive("bulletList"), disabled: sourceMode, isRovingActive: activeKey === "bulletList", registerRef: registerRef("bulletList"), onFocus: () => setActiveKey("bulletList"), onClick: () => editor.chain().focus().toggleBulletList().run() }), _jsx(ToolbarSeparator, {}), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "style", label: "Aa Style \u25BE", disabled: sourceMode, hasPopup: "listbox", expanded: openPopover === "style", isRovingActive: activeKey === "style", registerRef: registerRef("style"), onFocus: () => setActiveKey("style"), onClick: () => setOpenPopover((current) => (current === "style" ? null : "style")) }), openPopover === "style" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(StyleListbox, { styles: textStyles, loading: textStylesLoading, activeStyleKey: activeStyleKey, onSelect: (styleKey) => editor.chain().focus().setTextStyle(styleKey).run(), onClear: () => editor.chain().focus().unsetTextStyle().run(), onClose: closePopover }) }))] }), _jsx(ToolbarButton, { itemKey: "image", label: _jsxs(_Fragment, { children: [_jsx(ImageIcon, { "aria-hidden": "true", className: "size-4" }), "Image"] }), disabled: sourceMode, hasPopup: "dialog", expanded: pickerOpen, isRovingActive: activeKey === "image", registerRef: registerRef("image"), onFocus: () => setActiveKey("image"), onClick: () => setPickerOpen(true) }), pickerOpen && _jsx(MediaPicker, { collectAlt: true, onPick: handleMediaPick, onClose: () => setPickerOpen(false) }), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "block", label: "\u25EB Block \u25BE", disabled: sourceMode, hasPopup: "listbox", expanded: openPopover === "block", isRovingActive: activeKey === "block", registerRef: registerRef("block"), onFocus: () => setActiveKey("block"), onClick: () => setOpenPopover((current) => (current === "block" ? null : "block")) }), openPopover === "block" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(BlockInsertMenu, { onInsert: (listing) => {
238
+ }, onClose: closePopover }) }))] }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "h2", label: s("richText.h2Mark"), ariaLabel: s("richText.heading2"), active: editor.isActive("heading", { level: 2 }), disabled: sourceMode, isRovingActive: activeKey === "h2", registerRef: registerRef("h2"), onFocus: () => setActiveKey("h2"), onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run() }), _jsx(ToolbarButton, { itemKey: "h3", label: s("richText.h3Mark"), ariaLabel: s("richText.heading3"), active: editor.isActive("heading", { level: 3 }), disabled: sourceMode, isRovingActive: activeKey === "h3", registerRef: registerRef("h3"), onFocus: () => setActiveKey("h3"), onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run() }), _jsx(ToolbarButton, { itemKey: "blockquote", label: _jsx(QuoteIcon, { "aria-hidden": "true", className: "size-4" }), ariaLabel: s("richText.quote"), active: editor.isActive("blockquote"), disabled: sourceMode, isRovingActive: activeKey === "blockquote", registerRef: registerRef("blockquote"), onFocus: () => setActiveKey("blockquote"), onClick: () => editor.chain().focus().toggleBlockquote().run() }), _jsx(ToolbarButton, { itemKey: "bulletList", label: _jsxs(_Fragment, { children: [_jsx(ListIcon, { "aria-hidden": "true", className: "size-4" }), s("richText.list")] }), ariaLabel: s("richText.bulletedList"), active: editor.isActive("bulletList"), disabled: sourceMode, isRovingActive: activeKey === "bulletList", registerRef: registerRef("bulletList"), onFocus: () => setActiveKey("bulletList"), onClick: () => editor.chain().focus().toggleBulletList().run() }), _jsx(ToolbarSeparator, {}), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "style", label: `Aa ${s("richText.style")} ▾`, disabled: sourceMode, hasPopup: "listbox", expanded: openPopover === "style", isRovingActive: activeKey === "style", registerRef: registerRef("style"), onFocus: () => setActiveKey("style"), onClick: () => setOpenPopover((current) => (current === "style" ? null : "style")) }), openPopover === "style" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(StyleListbox, { styles: textStyles, loading: textStylesLoading, activeStyleKey: activeStyleKey, onSelect: (styleKey) => editor.chain().focus().setTextStyle(styleKey).run(), onClear: () => editor.chain().focus().unsetTextStyle().run(), onClose: closePopover }) }))] }), _jsx(ToolbarButton, { itemKey: "image", label: _jsxs(_Fragment, { children: [_jsx(ImageIcon, { "aria-hidden": "true", className: "size-4" }), s("richText.image")] }), disabled: sourceMode, hasPopup: "dialog", expanded: pickerOpen, isRovingActive: activeKey === "image", registerRef: registerRef("image"), onFocus: () => setActiveKey("image"), onClick: () => setPickerOpen(true) }), pickerOpen && _jsx(MediaPicker, { collectAlt: true, onPick: handleMediaPick, onClose: () => setPickerOpen(false) }), _jsxs("div", { className: "relative", children: [_jsx(ToolbarButton, { itemKey: "block", label: `◫ ${s("richText.block")} ▾`, disabled: sourceMode, hasPopup: "listbox", expanded: openPopover === "block", isRovingActive: activeKey === "block", registerRef: registerRef("block"), onFocus: () => setActiveKey("block"), onClick: () => setOpenPopover((current) => (current === "block" ? null : "block")) }), openPopover === "block" && (_jsx("div", { className: "absolute start-0 top-full z-10 mt-1 rounded-md border border-border-default bg-background-elevated shadow-lg", children: _jsx(BlockInsertMenu, { onInsert: (listing) => {
224
239
  editor
225
240
  .chain()
226
241
  .focus()
@@ -229,7 +244,7 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
229
244
  attrs: { partial: listing.alias, params: defaultBlockParams(listing.params) },
230
245
  })
231
246
  .run();
232
- }, onClose: closePopover }) }))] }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "source", label: _jsxs(_Fragment, { children: [_jsx(Code2, { "aria-hidden": "true", className: "size-4" }), "Source"] }), ariaLabel: "Toggle HTML source view", active: sourceMode, isRovingActive: activeKey === "source", registerRef: registerRef("source"), onFocus: () => setActiveKey("source"), onClick: onToggleSource }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "editOnPage", label: _jsx("span", { className: "text-primary-700", children: "\u2922 Edit on page" }), disabled: sourceMode, isRovingActive: activeKey === "editOnPage", registerRef: registerRef("editOnPage"), onFocus: () => setActiveKey("editOnPage"), onClick: () => containerRef.current?.dispatchEvent(new CustomEvent(EDIT_ON_PAGE_EVENT, { bubbles: true })) })] }));
247
+ }, onClose: closePopover }) }))] }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "source", label: _jsxs(_Fragment, { children: [_jsx(Code2, { "aria-hidden": "true", className: "size-4" }), s("richText.source")] }), ariaLabel: s("richText.toggleSource"), active: sourceMode, isRovingActive: activeKey === "source", registerRef: registerRef("source"), onFocus: () => setActiveKey("source"), onClick: onToggleSource }), !nested && (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "editOnPage", label: _jsx("span", { className: "text-primary-700", children: `⤢ ${s("richText.editOnPage")}` }), disabled: sourceMode, isRovingActive: activeKey === "editOnPage", registerRef: registerRef("editOnPage"), onFocus: () => setActiveKey("editOnPage"), onClick: () => containerRef.current?.dispatchEvent(new CustomEvent(EDIT_ON_PAGE_EVENT, { bubbles: true })) })] }))] }));
233
248
  }
234
249
  function RichTextEditor({ editable }) {
235
250
  const { value, onChange } = usePluginValue();
@@ -244,6 +259,7 @@ function RichTextEditor({ editable }) {
244
259
  // field's identity is stamped there instead (WCAG 4.1.2; axe reports
245
260
  // the gap as `aria-input-field-name`).
246
261
  const field = usePropertyFieldControl();
262
+ const s = useSdkString();
247
263
  const editor = useEditor({
248
264
  extensions: buildRichtextExtensions(),
249
265
  content: value ?? "",
@@ -413,7 +429,7 @@ function RichTextEditor({ editable }) {
413
429
  // right signal rather than separate open/close state.
414
430
  const selection = editor?.state.selection;
415
431
  const blockSelection = editor && selection instanceof NodeSelection && selection.node.type.name === "kardalumBlock" ? selection : null;
416
- return (_jsxs("div", { ref: wrapperRef, className: cn(editable && "overflow-hidden rounded-md border border-border-default bg-background-elevated"), children: [_jsxs("div", { inert: editable && Boolean(blockSelection) ? true : undefined, children: [editable && editor && (_jsx(RichTextToolbar, { editor: editor, containerRef: wrapperRef, sourceMode: sourceMode, onToggleSource: handleToggleSource })), sourceMode ? (_jsxs(_Fragment, { children: [sourceStale && (_jsx("div", { role: "alert", "data-testid": "rt-source-stale-notice", className: "border-b border-warning-100 bg-warning-100 px-5 py-2 text-xs text-warning-800", children: "Content changed elsewhere. Leaving source view will overwrite it." })), _jsx("textarea", { "data-testid": "rt-source-textarea", "aria-label": "HTML source", value: sourceHtml, onChange: (event) => setSourceHtml(event.target.value), spellCheck: false, className: "block min-h-72 w-full resize-y border-0 bg-background-elevated px-5 py-4 font-mono text-xs text-text-primary focus-visible:outline-hidden" })] })) : (_jsx(EditorContent, { editor: editor, className: cn(CONTENT_CLASSES, editable &&
432
+ return (_jsxs("div", { ref: wrapperRef, className: cn(editable && "overflow-hidden rounded-md border border-border-default bg-background-elevated"), children: [_jsxs("div", { inert: editable && Boolean(blockSelection) ? true : undefined, children: [editable && editor && (_jsx(RichTextToolbar, { editor: editor, containerRef: wrapperRef, sourceMode: sourceMode, onToggleSource: handleToggleSource })), sourceMode ? (_jsxs(_Fragment, { children: [sourceStale && (_jsx("div", { role: "alert", "data-testid": "rt-source-stale-notice", className: "border-b border-warning-100 bg-warning-100 px-5 py-2 text-xs text-warning-800", children: s("richText.sourceStale") })), _jsx("textarea", { "data-testid": "rt-source-textarea", "aria-label": s("richText.sourceLabel"), value: sourceHtml, onChange: (event) => setSourceHtml(event.target.value), spellCheck: false, className: "block min-h-72 w-full resize-y border-0 bg-background-elevated px-5 py-4 font-mono text-xs text-text-primary focus-visible:outline-hidden" })] })) : (_jsx(EditorContent, { editor: editor, className: cn(CONTENT_CLASSES, editable &&
417
433
  // min-h-72 (18rem) matches the mockup's .rtbody proportions (S197
418
434
  // screen 3): the editor grows with content past that floor, it
419
435
  // never shrinks below a real working height. px-5/py-4 are the
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A key suggested from a name: lower-case, spaces and dashes to `_`, other characters dropped.
3
+ * A linear loop over the characters, never a pattern. With `leadingLetter` a result that would
4
+ * start with a digit or `_` (or is empty) gives no suggestion.
5
+ */
6
+ export declare function suggestKey(name: string, max: number, leadingLetter: boolean): string;
7
+ /**
8
+ * Remembers per row whether its key was set by hand. A row loaded with a key counts as by hand, so
9
+ * a stored key is never overwritten; a row added here follows its name until the key is edited.
10
+ */
11
+ export declare function useHandEditedKeys(keys: string[]): {
12
+ follows: (index: number) => boolean;
13
+ markByHand: (index: number) => void;
14
+ added: () => void;
15
+ moved: (index: number, by: number) => void;
16
+ removed: (index: number) => void;
17
+ };
@@ -0,0 +1,55 @@
1
+ import { useRef } from "react";
2
+ /**
3
+ * A key suggested from a name: lower-case, spaces and dashes to `_`, other characters dropped.
4
+ * A linear loop over the characters, never a pattern. With `leadingLetter` a result that would
5
+ * start with a digit or `_` (or is empty) gives no suggestion.
6
+ */
7
+ export function suggestKey(name, max, leadingLetter) {
8
+ let out = "";
9
+ for (const ch of name.trim()) {
10
+ const c = ch.toLowerCase();
11
+ const letter = c >= "a" && c <= "z";
12
+ const digit = c >= "0" && c <= "9";
13
+ if (letter || digit)
14
+ out += c;
15
+ else if ((c === " " || c === "-" || c === "_") && out !== "" && !out.endsWith("_"))
16
+ out += "_";
17
+ if (out.length >= max)
18
+ break;
19
+ }
20
+ while (out.endsWith("_"))
21
+ out = out.slice(0, -1);
22
+ if (out === "")
23
+ return "";
24
+ if (leadingLetter && !(out[0] >= "a" && out[0] <= "z"))
25
+ return "";
26
+ return out;
27
+ }
28
+ /**
29
+ * Remembers per row whether its key was set by hand. A row loaded with a key counts as by hand, so
30
+ * a stored key is never overwritten; a row added here follows its name until the key is edited.
31
+ */
32
+ export function useHandEditedKeys(keys) {
33
+ const flags = useRef([]);
34
+ const read = () => keys.map((key, i) => flags.current[i] ?? key !== "");
35
+ return {
36
+ follows: (index) => !read()[index],
37
+ markByHand: (index) => {
38
+ const all = read();
39
+ all[index] = true;
40
+ flags.current = all;
41
+ },
42
+ added: () => {
43
+ flags.current = [...read(), false];
44
+ },
45
+ moved: (index, by) => {
46
+ const all = read();
47
+ const [flag] = all.splice(index, 1);
48
+ all.splice(index + by, 0, flag);
49
+ flags.current = all;
50
+ },
51
+ removed: (index) => {
52
+ flags.current = read().filter((_, i) => i !== index);
53
+ },
54
+ };
55
+ }