@kardalum/plugin-sdk 0.19.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 (366) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/README.md +19 -0
  3. package/dist/admin-section-registry.d.ts +16 -1
  4. package/dist/admin-section-registry.js +23 -0
  5. package/dist/built-in-editor-ids.d.ts +1 -1
  6. package/dist/built-in-editor-ids.js +2 -20
  7. package/dist/built-in-settings-schemas.d.ts +10 -0
  8. package/dist/built-in-settings-schemas.js +86 -0
  9. package/dist/built-in-value-schemas.js +35 -0
  10. package/dist/built-ins.js +38 -7
  11. package/dist/capabilities.d.ts +11 -1
  12. package/dist/capabilities.js +55 -3
  13. package/dist/cli.d.ts +66 -0
  14. package/dist/cli.js +22 -0
  15. package/dist/content-library.d.ts +85 -0
  16. package/dist/content-library.js +15 -0
  17. package/dist/content-picker/page-picker-sheet.d.ts +13 -0
  18. package/dist/content-picker/page-picker-sheet.js +105 -0
  19. package/dist/content-picker/page-tree.d.ts +25 -0
  20. package/dist/content-picker/page-tree.js +132 -0
  21. package/dist/data-type-plugin.d.ts +7 -1
  22. package/dist/datatype-validation.d.ts +4 -9
  23. package/dist/datatype-validation.js +139 -1
  24. package/dist/entitlement-entry.d.ts +1 -1
  25. package/dist/entitlement-entry.js +1 -1
  26. package/dist/entitlement-gate.d.ts +14 -0
  27. package/dist/entitlement-gate.js +64 -7
  28. package/dist/entitlement-plan.d.ts +6 -0
  29. package/dist/entitlement-plan.js +10 -0
  30. package/dist/entitlement-types.d.ts +36 -12
  31. package/dist/entitlement.d.ts +31 -4
  32. package/dist/entitlement.js +58 -17
  33. package/dist/hook-entry.d.ts +5 -0
  34. package/dist/hook-entry.js +30 -0
  35. package/dist/host-entry.d.ts +1 -1
  36. package/dist/host-entry.js +1 -1
  37. package/dist/index.d.ts +36 -4
  38. package/dist/index.js +50 -3
  39. package/dist/mail.d.ts +30 -0
  40. package/dist/mail.js +1 -0
  41. package/dist/manifest-entry.d.ts +29 -4
  42. package/dist/manifest-entry.js +39 -2
  43. package/dist/manifest-schema.d.ts +443 -29
  44. package/dist/manifest-schema.js +285 -23
  45. package/dist/manifest.d.ts +450 -51
  46. package/dist/manifest.js +1 -1
  47. package/dist/media/media-picker.js +31 -18
  48. package/dist/media/upload-error.d.ts +5 -1
  49. package/dist/media/upload-error.js +14 -2
  50. package/dist/media-library.d.ts +32 -0
  51. package/dist/media-library.js +15 -0
  52. package/dist/nested-field-host.d.ts +76 -0
  53. package/dist/nested-field-host.js +90 -0
  54. package/dist/notify.d.ts +12 -4
  55. package/dist/notify.js +1 -1
  56. package/dist/outbound.d.ts +47 -0
  57. package/dist/outbound.js +1 -0
  58. package/dist/plugin-context.d.ts +5 -0
  59. package/dist/plugin-screen-context.d.ts +112 -0
  60. package/dist/plugin-screen-context.js +26 -0
  61. package/dist/providers.d.ts +268 -0
  62. package/dist/providers.js +74 -0
  63. package/dist/read-all-pages.d.ts +5 -0
  64. package/dist/read-all-pages.js +3 -2
  65. package/dist/richtext/block-panel.js +11 -6
  66. package/dist/richtext/insert-menu.js +9 -6
  67. package/dist/richtext/style-listbox.js +6 -4
  68. package/dist/sdk-strings.d.ts +285 -0
  69. package/dist/sdk-strings.js +347 -0
  70. package/dist/sealing.d.ts +14 -0
  71. package/dist/sealing.js +1 -0
  72. package/dist/simple-storage-value-provider.js +24 -24
  73. package/dist/structured-storage-types.d.ts +309 -9
  74. package/dist/text-entry.d.ts +1 -0
  75. package/dist/text-entry.js +6 -0
  76. package/dist/tokens/tailwind-theme.css +5 -0
  77. package/dist/tokens/tokens.css +15 -3
  78. package/dist/tokens/tokens.json +8 -3
  79. package/dist/views/asset-view.js +4 -1
  80. package/dist/views/content-list-preview.js +3 -1
  81. package/dist/views/content-list-settings-view.js +11 -7
  82. package/dist/views/content-list-view.d.ts +5 -3
  83. package/dist/views/content-list-view.js +38 -34
  84. package/dist/views/content-picker-view.d.ts +3 -0
  85. package/dist/views/content-picker-view.js +143 -0
  86. package/dist/views/crop-view.d.ts +4 -6
  87. package/dist/views/crop-view.js +22 -13
  88. package/dist/views/date-range-view.js +4 -1
  89. package/dist/views/file-upload-view.d.ts +5 -7
  90. package/dist/views/file-upload-view.js +16 -7
  91. package/dist/views/group-view.d.ts +8 -0
  92. package/dist/views/group-view.js +123 -0
  93. package/dist/views/html-view.js +7 -6
  94. package/dist/views/image-view.js +37 -19
  95. package/dist/views/link-view.d.ts +3 -0
  96. package/dist/views/link-view.js +150 -0
  97. package/dist/views/options-list-view.d.ts +3 -0
  98. package/dist/views/options-list-view.js +104 -0
  99. package/dist/views/repeatable-list-view.d.ts +3 -0
  100. package/dist/views/repeatable-list-view.js +113 -0
  101. package/dist/views/rich-text-view.js +28 -13
  102. package/dist/views/suggest-key.d.ts +17 -0
  103. package/dist/views/suggest-key.js +55 -0
  104. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
  105. package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
  106. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
  107. package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
  108. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
  109. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
  110. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
  111. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
  112. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
  113. package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
  114. package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
  115. package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
  116. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
  117. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
  118. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
  119. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
  120. package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
  121. package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
  122. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
  123. package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
  124. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
  125. package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
  126. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
  127. package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
  128. package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
  129. package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
  130. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
  131. package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
  132. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
  133. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
  134. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
  135. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
  136. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
  137. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
  138. package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
  139. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
  140. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
  141. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
  142. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
  143. package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
  144. package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
  145. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
  146. package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
  147. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
  148. package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
  149. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
  150. package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
  151. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
  152. package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
  153. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
  154. package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
  155. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
  156. package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
  157. package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
  158. package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
  159. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
  160. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
  161. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
  162. package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
  163. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
  164. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
  165. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
  166. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
  167. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
  168. package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
  169. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
  170. package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
  171. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
  172. package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
  173. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
  174. package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
  175. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
  176. package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
  177. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
  178. package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
  179. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
  180. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
  181. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
  182. package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
  183. package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
  184. package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
  185. package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
  186. package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
  187. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
  188. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
  189. package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
  190. package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
  191. package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
  192. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
  193. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
  194. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
  195. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
  196. package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
  197. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
  198. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
  199. package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
  200. package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
  201. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
  202. package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
  203. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
  204. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
  205. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
  206. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
  207. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
  208. package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
  209. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
  210. package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
  211. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
  212. package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
  213. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
  214. package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
  215. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
  216. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
  217. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
  218. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
  219. package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
  220. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
  221. package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
  222. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
  223. package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
  224. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
  225. package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
  226. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
  227. package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
  228. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
  229. package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
  230. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
  231. package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
  232. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
  233. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
  234. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
  235. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
  236. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
  237. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
  238. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
  239. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
  240. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
  241. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
  242. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
  243. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
  244. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
  245. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
  246. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
  247. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
  248. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
  249. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
  250. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
  251. package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
  252. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
  253. package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
  254. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
  255. package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
  256. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
  257. package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
  258. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
  259. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
  260. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
  261. package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
  262. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
  263. package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
  264. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
  265. package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
  266. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
  267. package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
  268. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
  269. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
  270. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
  271. package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
  272. package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
  273. package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
  274. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
  275. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
  276. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
  277. package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
  278. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  279. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
  280. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
  281. package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
  282. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
  283. package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
  284. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
  285. package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
  286. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
  287. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
  288. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
  289. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
  290. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
  291. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
  292. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
  293. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
  294. package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
  295. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  296. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  297. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
  298. package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
  299. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
  300. package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
  301. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
  302. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
  303. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
  304. package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
  305. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
  306. package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
  307. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
  308. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
  309. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
  310. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
  311. package/node_modules/@kardalum/api-schemas/package.json +1 -0
  312. package/node_modules/@kardalum/design-tokens/dist/build-css.js +6 -0
  313. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
  314. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  315. package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
  316. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
  317. package/node_modules/@kardalum/design-tokens/dist/tokens.js +12 -3
  318. package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
  319. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
  320. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
  321. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
  322. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
  323. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
  324. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
  325. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
  326. package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
  327. package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
  328. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
  329. package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
  330. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
  331. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
  332. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
  333. package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
  334. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
  335. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
  336. package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
  337. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
  338. package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
  339. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
  340. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
  341. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
  342. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
  343. package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
  344. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
  345. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
  346. package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
  347. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
  348. package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
  349. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
  350. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
  351. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
  352. package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
  353. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
  354. package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
  355. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  356. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
  357. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
  358. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  359. package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
  360. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
  361. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
  362. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  363. package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
  364. package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
  365. package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
  366. package/package.json +12 -2
@@ -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
+ }
@@ -10,6 +10,8 @@ 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":
@@ -140,6 +146,7 @@ function ToolbarSeparator() {
140
146
  function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
141
147
  const [href, setHref] = useState(initialHref);
142
148
  const inputRef = useRef(null);
149
+ const s = useSdkString();
143
150
  useEffect(() => {
144
151
  inputRef.current?.focus();
145
152
  inputRef.current?.select();
@@ -149,13 +156,13 @@ function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
149
156
  event.preventDefault();
150
157
  onClose();
151
158
  }
152
- }, 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) => {
153
160
  if (event.key === "Enter") {
154
161
  event.preventDefault();
155
162
  if (href.trim())
156
163
  onApply(href.trim());
157
164
  }
158
- }, 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") })] })] }));
159
166
  }
160
167
  // S197 Task 12: bubbles up so a mount that HAS routing (content-editor.tsx,
161
168
  // admin-ui) can navigate to /content/:id/edit-on-page, the same "plain DOM
@@ -170,6 +177,13 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
170
177
  const { styles: textStyles, loading: textStylesLoading } = useTextStyles();
171
178
  const [openPopover, setOpenPopover] = useState(null);
172
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();
173
187
  const activeStyleKey = editor.getAttributes("textStyleClass").styleKey ?? null;
174
188
  const allItemKeys = [
175
189
  "bold",
@@ -183,14 +197,14 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
183
197
  "image",
184
198
  "block",
185
199
  "source",
186
- "editOnPage",
200
+ ...(nested ? [] : ["editOnPage"]),
187
201
  ];
188
202
  // Every other command is disabled in source mode (editing raw HTML has no
189
203
  // "toggle bold" equivalent); Source itself is the only tab stop then, so
190
204
  // the roving tabindex's own focusable set shrinks to match, same as the
191
205
  // doc comment above useToolbarRovingTabIndex describes for disabled items.
192
206
  const focusableKeys = sourceMode ? ["source"] : allItemKeys;
193
- const { activeKey, setActiveKey, registerRef, handleKeyDown } = useToolbarRovingTabIndex(focusableKeys);
207
+ const { activeKey, setActiveKey, registerRef, handleKeyDown } = useToolbarRovingTabIndex(focusableKeys, dir);
194
208
  function closePopover() {
195
209
  setOpenPopover(null);
196
210
  }
@@ -211,17 +225,17 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
211
225
  setPickerOpen(false);
212
226
  }
213
227
  const linkAttrs = editor.getAttributes("link");
214
- 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,
215
229
  // gap-1/p-2 (not the mockup's literal .15rem/.4rem: the token scale's
216
230
  // nearest whole steps; gap-0.5/p-1.5 generate no CSS at all under this
217
231
  // project's replaced spacing scale, see the admin UI conventions).
218
- 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) => {
219
233
  editor.chain().focus().extendMarkRange("link").setLink({ href }).run();
220
234
  closePopover();
221
235
  }, onRemove: () => {
222
236
  editor.chain().focus().unsetLink().run();
223
237
  closePopover();
224
- }, 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) => {
225
239
  editor
226
240
  .chain()
227
241
  .focus()
@@ -230,7 +244,7 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
230
244
  attrs: { partial: listing.alias, params: defaultBlockParams(listing.params) },
231
245
  })
232
246
  .run();
233
- }, 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 })) })] }))] }));
234
248
  }
235
249
  function RichTextEditor({ editable }) {
236
250
  const { value, onChange } = usePluginValue();
@@ -245,6 +259,7 @@ function RichTextEditor({ editable }) {
245
259
  // field's identity is stamped there instead (WCAG 4.1.2; axe reports
246
260
  // the gap as `aria-input-field-name`).
247
261
  const field = usePropertyFieldControl();
262
+ const s = useSdkString();
248
263
  const editor = useEditor({
249
264
  extensions: buildRichtextExtensions(),
250
265
  content: value ?? "",
@@ -414,7 +429,7 @@ function RichTextEditor({ editable }) {
414
429
  // right signal rather than separate open/close state.
415
430
  const selection = editor?.state.selection;
416
431
  const blockSelection = editor && selection instanceof NodeSelection && selection.node.type.name === "kardalumBlock" ? selection : null;
417
- 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 &&
418
433
  // min-h-72 (18rem) matches the mockup's .rtbody proportions (S197
419
434
  // screen 3): the editor grows with content past that floor, it
420
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
+ }