@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,123 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { GROUP_FIELDS_MAX, SUB_FIELD_ALIAS_MAX, SUB_FIELD_NAME_MAX, isPlainRecord, readGroupSettings, } from "@kardalum/api-schemas";
4
+ import { Button, Checkbox, IconTooltip, Input, PropertyField } from "@kardalum/ui";
5
+ import { NestedField, holdsRichText, isNestableEditor, repeatedByList, 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 { suggestKey, useHandEditedKeys } from "./suggest-key.js";
10
+ // Month 32 D: the Group data type's views. The value is an object keyed by sub-field alias; each
11
+ // sub-field is mounted through the nested field host with its own data type's views.
12
+ // The same classes as the UI package's Input, for a native select.
13
+ export 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
+ export function GroupInputView() {
15
+ const { value, onChange } = usePluginValue();
16
+ const settings = readGroupSettings(usePluginSettings());
17
+ const host = useNestedFieldHost();
18
+ const t = usePluginTranslate();
19
+ const chrome = useAdminChromeProps();
20
+ if (!host) {
21
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-2", children: [_jsx(GroupReadOnlyView, {}), _jsx("p", { className: "text-sm text-text-tertiary", children: t("group.noHost") })] }));
22
+ }
23
+ if (settings.fields.length === 0) {
24
+ return (_jsx("p", { ...chrome, className: "text-sm text-text-tertiary", children: t("group.noFields") }));
25
+ }
26
+ const current = isPlainRecord(value) ? value : {};
27
+ // The base keeps only the aliases the group has now, so a removed sub-field's value is dropped.
28
+ const base = {};
29
+ // Own keys only: an alias such as `constructor` must not read Object.prototype's member.
30
+ for (const field of settings.fields)
31
+ if (Object.hasOwn(current, field.alias))
32
+ base[field.alias] = current[field.alias];
33
+ return (_jsx("div", { ...chrome, className: "flex flex-col gap-4", children: settings.fields.map((field) => {
34
+ const type = host.resolve(field.dataTypeId);
35
+ return (_jsx(PropertyField, { label: field.name, required: field.required, requiredText: t("group.required"), helpText: type?.readOnlyNote, children: type ? (_jsx(NestedField, { type: type, value: base[field.alias], onChange: (next) => onChange({ ...base, [field.alias]: next }) })) : (_jsx("p", { className: "text-sm text-text-tertiary", children: t("group.missingType") })) }, field.alias));
36
+ }) }));
37
+ }
38
+ export function GroupReadOnlyView() {
39
+ const { value } = usePluginValue();
40
+ const settings = readGroupSettings(usePluginSettings());
41
+ const host = useNestedFieldHost();
42
+ const t = usePluginTranslate();
43
+ const chrome = useAdminChromeProps();
44
+ const current = isPlainRecord(value) ? value : {};
45
+ const filled = settings.fields.filter((field) => Object.hasOwn(current, field.alias) && current[field.alias] !== undefined && current[field.alias] !== null);
46
+ if (filled.length === 0) {
47
+ return (_jsx("span", { ...chrome, className: "text-sm text-text-tertiary", children: t("group.empty") }));
48
+ }
49
+ return (_jsx("dl", { ...chrome, className: "flex flex-col gap-3", children: filled.map((field) => {
50
+ const type = host?.resolve(field.dataTypeId) ?? null;
51
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("dt", { className: "text-sm font-medium text-text-secondary", children: field.name }), _jsx("dd", { className: "text-sm text-text-primary", children: !host ? (_jsx(ValueSummary, { value: current[field.alias] })) : type ? (_jsx(NestedField, { type: type, value: current[field.alias], onChange: () => { }, readOnly: true })) : (_jsx("span", { className: "text-text-tertiary", children: t("group.missingType") })) })] }, field.alias));
52
+ }) }));
53
+ }
54
+ /** Without a nested field host (a plugin preview) a sub-value is shown as its JSON, not as missing. */
55
+ export function ValueSummary({ value }) {
56
+ return _jsx("pre", { className: "whitespace-pre-wrap break-words font-mono text-xs text-text-secondary", children: JSON.stringify(value ?? null, null, 2) });
57
+ }
58
+ function rawRows(settings) {
59
+ if (!Array.isArray(settings.fields))
60
+ return [];
61
+ return settings.fields.slice(0, GROUP_FIELDS_MAX).map((entry) => {
62
+ const bag = isPlainRecord(entry) ? entry : {};
63
+ return {
64
+ alias: typeof bag.alias === "string" ? bag.alias : "",
65
+ name: typeof bag.name === "string" ? bag.name : "",
66
+ dataTypeId: typeof bag.dataTypeId === "string" ? bag.dataTypeId : "",
67
+ required: bag.required === true,
68
+ };
69
+ });
70
+ }
71
+ const ALIAS_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]*$/;
72
+ export function GroupSettingsView() {
73
+ const { value: settings, onChange } = usePluginSettingsValue();
74
+ const host = useNestedFieldHost();
75
+ const t = usePluginTranslate();
76
+ const idPrefix = useId();
77
+ const rows = rawRows(settings);
78
+ const write = (next) => onChange({ ...settings, fields: next });
79
+ const update = (index, patch) => write(rows.map((r, i) => (i === index ? { ...r, ...patch } : r)));
80
+ const keys = useHandEditedKeys(rows.map((r) => r.alias));
81
+ const move = (index, by) => {
82
+ keys.moved(index, by);
83
+ const next = [...rows];
84
+ const [row] = next.splice(index, 1);
85
+ next.splice(index + by, 0, row);
86
+ write(next);
87
+ };
88
+ const counts = new Map();
89
+ for (const row of rows)
90
+ if (row.alias !== "")
91
+ counts.set(row.alias, (counts.get(row.alias) ?? 0) + 1);
92
+ // M32 I5 (D10): a Group a Repeatable list repeats may not hold rich text, so its picker leaves out
93
+ // rich text and Groups holding it, as the list view's item picker does.
94
+ const repeated = host?.editingDataTypeId !== undefined && repeatedByList(host, host.editingDataTypeId);
95
+ const choices = host
96
+ ? host.listDataTypes().filter((d) => isNestableEditor(host, d.editorId) && !(repeated && holdsRichText(host, d.id)))
97
+ : [];
98
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [rows.map((row, index) => {
99
+ const label = row.name !== "" ? row.name : String(index + 1);
100
+ // M32 I5 (D9): a blank alias is as bad as a malformed one, and a name needs more than spaces.
101
+ // Hints only: the save is not blocked here, the server judges it.
102
+ const badAlias = row.alias === "" || row.alias.length > SUB_FIELD_ALIAS_MAX || !ALIAS_PATTERN.test(row.alias);
103
+ const noName = row.name.trim() === "";
104
+ const duplicate = row.alias !== "" && (counts.get(row.alias) ?? 0) > 1;
105
+ const known = choices.some((d) => d.id === row.dataTypeId);
106
+ const noType = row.dataTypeId === "" && Boolean(host);
107
+ const base = `${idPrefix}-${index}`;
108
+ const aliasErrorIds = [badAlias && `${base}-alias-bad`, duplicate && `${base}-alias-duplicate`].filter(Boolean).join(" ");
109
+ return (_jsxs("div", { className: "flex flex-col gap-2 rounded-md border border-border-default p-4", children: [_jsxs("div", { className: "flex flex-wrap items-start gap-2", children: [_jsxs("div", { className: "flex min-w-32 flex-1 flex-col gap-1", children: [_jsx("label", { htmlFor: `${base}-name`, className: "text-xs font-medium text-text-secondary", children: t("group.nameColumn") }), _jsx(Input, { id: `${base}-name`, placeholder: t("group.namePlaceholder"), value: row.name, maxLength: SUB_FIELD_NAME_MAX, "aria-invalid": noName || undefined, "aria-describedby": noName ? `${base}-name-error` : undefined, onChange: (event) => {
110
+ const name = event.target.value;
111
+ update(index, keys.follows(index) ? { name, alias: suggestKey(name, SUB_FIELD_ALIAS_MAX, true) } : { name });
112
+ } }), noName && (_jsx("p", { id: `${base}-name-error`, className: "text-xs text-danger-600", children: t("group.nameRequired") }))] }), _jsxs("div", { className: "flex min-w-32 flex-1 flex-col gap-1", children: [_jsx("label", { htmlFor: `${base}-alias`, className: "text-xs font-medium text-text-secondary", children: t("group.aliasColumn") }), _jsx(Input, { id: `${base}-alias`, placeholder: t("group.aliasPlaceholder"), value: row.alias, "aria-invalid": badAlias || duplicate || undefined, "aria-describedby": aliasErrorIds || undefined, onChange: (event) => {
113
+ keys.markByHand(index);
114
+ update(index, { alias: event.target.value });
115
+ } }), badAlias && (_jsx("p", { id: `${base}-alias-bad`, className: "text-xs text-danger-600", children: t("group.badAlias") })), duplicate && (_jsx("p", { id: `${base}-alias-duplicate`, className: "text-xs text-danger-600", children: t("group.duplicateAlias", { alias: row.alias }) }))] })] }), host ? (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: `${base}-type`, className: "text-xs font-medium text-text-secondary", children: t("group.dataTypeColumn") }), _jsxs("select", { id: `${base}-type`, className: SELECT_CLASS, value: row.dataTypeId, "aria-invalid": noType || undefined, "aria-describedby": noType ? `${base}-type-error` : undefined, onChange: (event) => update(index, { dataTypeId: event.target.value }), children: [_jsx("option", { value: "", children: t("group.chooseDataType") }), row.dataTypeId !== "" && !known && (_jsx("option", { value: row.dataTypeId, disabled: true, children: t("group.missingType") })), choices.map((d) => (_jsx("option", { value: d.id, children: d.name }, d.id)))] }), noType && (_jsx("p", { id: `${base}-type-error`, className: "text-xs text-danger-600", children: t("group.typeRequired") }))] })) : (_jsx("p", { className: "text-sm text-text-tertiary", children: t("group.noHost") })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: `group-required-${index}`, checked: row.required, onCheckedChange: (checked) => update(index, { required: checked === true }) }), _jsx("label", { htmlFor: `group-required-${index}`, className: "text-sm text-text-primary", children: t("group.requiredColumn") }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "ms-auto", disabled: index === 0, "aria-label": t("group.moveUp", { name: label }), 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 === rows.length - 1, "aria-label": t("group.moveDown", { name: label }), 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("group.removeField", { name: label }), onClick: () => {
116
+ keys.removed(index);
117
+ write(rows.filter((_, i) => i !== index));
118
+ }, children: _jsx("span", { "aria-hidden": "true", children: "\u2715" }) }) })] })] }, index));
119
+ }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: rows.length >= GROUP_FIELDS_MAX, onClick: () => {
120
+ keys.added();
121
+ write([...rows, { alias: "", name: "", dataTypeId: "", required: false }]);
122
+ }, children: t("group.addField") }), rows.length >= GROUP_FIELDS_MAX && (_jsx("span", { className: "text-sm text-text-tertiary", children: t("group.atMax", { max: GROUP_FIELDS_MAX }) }))] })] }));
123
+ }
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { lazy, Suspense } from "react";
3
3
  import { PropertyField, Switch, usePropertyFieldControl } from "@kardalum/ui";
4
4
  import { usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
5
+ import { useSdkString } from "../sdk-strings.js";
5
6
  // The only React.lazy() boundary in this package's views so far, mirrors
6
7
  // apps/admin-ui/src/editor/lazy-code-editor.tsx's split (html-code-editor.js
7
8
  // pulls in the whole @codemirror/* graph, ~six packages' worth, which must
@@ -11,11 +12,10 @@ import { usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
11
12
  // point for the com.kardalum.html editor.
12
13
  const HtmlCodeEditorLazy = lazy(() => import("./html-code-editor.js").then((module) => ({ default: module.HtmlCodeEditor })));
13
14
  // Same role="status" + aria-hidden placeholder pattern as
14
- // lazy-code-editor.tsx's CodeEditorFallback: no react-i18next here (this
15
- // package's views deliberately hardcode English strings today, see
16
- // built-ins.tsx's TextReadOnlyView/ImageInputView precedent).
15
+ // lazy-code-editor.tsx's CodeEditorFallback, named through useSdkString().
17
16
  function HtmlEditorFallback() {
18
- return (_jsx("div", { role: "status", "aria-label": "Loading code editor\u2026", children: _jsx("div", { "aria-hidden": "true", className: "h-44 w-full animate-pulse rounded-md border border-border-default bg-background-subtle" }) }));
17
+ const s = useSdkString();
18
+ return (_jsx("div", { role: "status", "aria-label": s("html.loading"), children: _jsx("div", { "aria-hidden": "true", className: "h-44 w-full animate-pulse rounded-md border border-border-default bg-background-subtle" }) }));
19
19
  }
20
20
  // The Trusted setting has no bearing on how this field is EDITED (both
21
21
  // modes get the same CodeMirror surface), only on how it's RENDERED
@@ -46,8 +46,9 @@ export function HtmlReadOnlyView() {
46
46
  // settings-EDITING view, same usePluginSettingsValue() convention as
47
47
  // TextSettingsView/ImageSettingsView in built-ins.tsx. The help copy is
48
48
  // spec-binding verbatim text (S197 spec §7 / task brief), not a paraphrase,
49
- // so do not reword it.
49
+ // so do not reword it (its English lives in SDK_STRINGS_EN, html.trustedHelp).
50
50
  export function HtmlSettingsView() {
51
51
  const { value: settings, onChange } = usePluginSettingsValue();
52
- return (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(PropertyField, { label: "Trusted", htmlFor: "html-settings-trusted", helpText: "Trusted HTML renders exactly as written: including scripts. Only enable for fields edited by people you'd let deploy code.", children: _jsx(Switch, { id: "html-settings-trusted", checked: settings.trusted === true, onCheckedChange: (checked) => onChange({ ...settings, trusted: checked === true }) }) }) }));
52
+ const s = useSdkString();
53
+ return (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(PropertyField, { label: s("html.trustedLabel"), htmlFor: "html-settings-trusted", helpText: s("html.trustedHelp"), children: _jsx(Switch, { id: "html-settings-trusted", checked: settings.trusted === true, onCheckedChange: (checked) => onChange({ ...settings, trusted: checked === true }) }) }) }));
53
54
  }
@@ -3,9 +3,10 @@ import { useEffect, useId, useRef, useState } from "react";
3
3
  import { CROP_EDITOR_ID, CropSettingsSchema, renditionName, renditionShape, THUMBNAIL_EDITOR_ID, ThumbnailSettingsSchema, } from "@kardalum/api-schemas";
4
4
  import { Button, cn, Input, PropertyField, TruncatedText, usePropertyFieldControl } from "@kardalum/ui";
5
5
  import { MediaPicker } from "../media/media-picker.js";
6
- import { uploadFailureMessage } from "../media/upload-error.js";
6
+ import { mediaUploadCodeMessage, uploadFailureMessage } from "../media/upload-error.js";
7
7
  import { MANAGE_API, usePluginApi, usePluginSettings, usePluginSettingsValue, usePluginValue, } from "../plugin-context.js";
8
8
  import { readAllPages } from "../read-all-pages.js";
9
+ import { useAdminChromeProps, useSdkString } from "../sdk-strings.js";
9
10
  // downloadUrl is the stable app path for a public item (S186c §1/§3) but
10
11
  // carries a freshly minted, short-lived `?token=` for a private one,
11
12
  // never persisted; refetch GET /api/manage/v1/media/:id whenever the field's value
@@ -22,6 +23,7 @@ import { readAllPages } from "../read-all-pages.js";
22
23
  // just changed. The listing is paged (200 at a time), so every page is read before a miss means "none".
23
24
  function useMediaPreview(mediaId, rendition) {
24
25
  const fetchApi = usePluginApi();
26
+ const s = useSdkString();
25
27
  const [preview, setPreview] = useState(null);
26
28
  const [loading, setLoading] = useState(false);
27
29
  const [error, setError] = useState(null);
@@ -36,7 +38,7 @@ function useMediaPreview(mediaId, rendition) {
36
38
  setError(null);
37
39
  const item = fetchApi(`${MANAGE_API}/media/${mediaId}`).then(async (response) => {
38
40
  if (!response.ok)
39
- throw new Error(`Failed to load media (${response.status})`);
41
+ throw new Error(s("image.loadFailed", { status: response.status }));
40
42
  return (await response.json());
41
43
  });
42
44
  // A failed crop read resolves to "unknown" rather than rejecting: the
@@ -76,7 +78,7 @@ function useMediaPreview(mediaId, rendition) {
76
78
  return () => {
77
79
  cancelled = true;
78
80
  };
79
- }, [mediaId, rendition, fetchApi]);
81
+ }, [mediaId, rendition, fetchApi, s]);
80
82
  return { preview, loading, error };
81
83
  }
82
84
  // Sized by the caller: the read-only view shows the picture on its own and
@@ -87,10 +89,11 @@ function PreviewImage({ preview, className }) {
87
89
  }
88
90
  function ImageThumbnail({ mediaId }) {
89
91
  const { preview, loading, error } = useMediaPreview(mediaId, null);
92
+ const s = useSdkString();
90
93
  if (!mediaId)
91
94
  return null;
92
95
  if (loading)
93
- return _jsx("p", { className: "text-xs text-text-secondary", children: "Loading\u2026" });
96
+ return _jsx("p", { className: "text-xs text-text-secondary", children: s("image.loading") });
94
97
  if (error)
95
98
  return _jsx("p", { className: "text-xs text-danger-600", children: error });
96
99
  if (!preview)
@@ -127,7 +130,8 @@ function requestedRendition(settings) {
127
130
  // known at all.
128
131
  function PictureFacts({ preview }) {
129
132
  const cut = preview.cut;
130
- return (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(TruncatedText, { className: "block truncate font-mono text-xs text-text-primary", dir: "auto", children: cut.state === "found" ? cut.filename : preview.filename }), cut.state === "found" && (_jsx(TruncatedText, { className: "block truncate text-xs text-text-tertiary", dir: "auto", children: `${cut.name} of ${preview.filename}` })), cut.state === "absent" && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: "full image" }))] }));
133
+ const s = useSdkString();
134
+ return (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(TruncatedText, { className: "block truncate font-mono text-xs text-text-primary", dir: "auto", children: cut.state === "found" ? cut.filename : preview.filename }), cut.state === "found" && (_jsx(TruncatedText, { className: "block truncate text-xs text-text-tertiary", dir: "auto", children: s("image.cropOf", { crop: cut.name, file: preview.filename }) })), cut.state === "absent" && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: s("image.fullImage") }))] }));
131
135
  }
132
136
  export function ImageInputView() {
133
137
  const { value, onChange } = usePluginValue();
@@ -139,6 +143,10 @@ export function ImageInputView() {
139
143
  const [picking, setPicking] = useState(false);
140
144
  const uploadInputRef = useRef(null);
141
145
  const hintId = useId();
146
+ const s = useSdkString();
147
+ // The field's controls are the admin's words, so they take the admin's
148
+ // direction and language, not the content's around the field (S366f D10).
149
+ const chrome = useAdminChromeProps();
142
150
  const rendition = requestedRendition(settings);
143
151
  const { preview, loading, error: previewError } = useMediaPreview(value, rendition);
144
152
  // The field's own hint joins whatever the host's PropertyField already
@@ -160,7 +168,7 @@ export function ImageInputView() {
160
168
  // machine. Both numbers, same as the server's refusal, so a person
161
169
  // knows by how much they are over either way.
162
170
  if (settings.maxSizeBytes != null && file.size > settings.maxSizeBytes) {
163
- setError(`File is too large (${file.size} bytes): the configured limit is ${settings.maxSizeBytes} bytes.`);
171
+ setError(s("image.tooLarge", { size: file.size, limit: settings.maxSizeBytes }));
164
172
  return;
165
173
  }
166
174
  setUploading(true);
@@ -172,8 +180,9 @@ export function ImageInputView() {
172
180
  // these bytes for the file upload type's limit, which this field
173
181
  // knows nothing about, and that refusal names the limit and the
174
182
  // size (S234d Task 8).
175
- if (!response.ok)
176
- throw new Error(await uploadFailureMessage(response));
183
+ if (!response.ok) {
184
+ throw new Error(await uploadFailureMessage(response, (status) => s("shared.uploadFailed", { status }), (code) => mediaUploadCodeMessage(code, () => s("shared.mediaStoreSwitchedOff"))));
185
+ }
177
186
  const media = (await response.json());
178
187
  onChange(media.id);
179
188
  }
@@ -184,8 +193,8 @@ export function ImageInputView() {
184
193
  setUploading(false);
185
194
  }
186
195
  }
187
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: cn("flex items-center gap-3", value && "rounded-md border border-border-default bg-background-subtle p-3"), children: [value &&
188
- (loading ? (_jsx("p", { className: "text-xs text-text-secondary", children: "Loading\u2026" })) : previewError ? (_jsx("p", { className: "text-xs text-danger-600", children: previewError })) : preview ? (_jsxs(_Fragment, { children: [_jsx(PreviewImage, { preview: preview, className: "h-16 w-16" }), _jsx(PictureFacts, { preview: preview })] })) : null), _jsxs("div", { ...field, role: "group", "aria-describedby": describedBy, className: cn("flex shrink-0 items-center gap-2", value && "ms-auto"), children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPicking(true), children: "Choose" }), _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: uploading, onClick: () => uploadInputRef.current?.click(), children: uploading ? "Uploading…" : "Upload" }), value && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: uploading, onClick: () => onChange(null), children: "Remove" }))] })] }), _jsx("input", { ref: uploadInputRef, type: "file", className: "hidden", accept: settings.acceptedTypes && settings.acceptedTypes.length > 0 ? settings.acceptedTypes.join(",") : "image/*", "aria-label": "Upload an image", disabled: uploading, onChange: (e) => void handleFileChange(e) }), rendition !== null && (_jsx("p", { id: hintId, className: "text-xs text-text-tertiary", children: `This field asks for the ${renditionShape(rendition)} rendition. An image without one is shown at full size.` })), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), picking && (_jsx(MediaPicker
196
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-2", children: [_jsxs("div", { className: cn("flex items-center gap-3", value && "rounded-md border border-border-default bg-background-subtle p-3"), children: [value &&
197
+ (loading ? (_jsx("p", { className: "text-xs text-text-secondary", children: s("image.loading") })) : previewError ? (_jsx("p", { className: "text-xs text-danger-600", children: previewError })) : preview ? (_jsxs(_Fragment, { children: [_jsx(PreviewImage, { preview: preview, className: "h-16 w-16" }), _jsx(PictureFacts, { preview: preview })] })) : null), _jsxs("div", { ...field, role: "group", "aria-describedby": describedBy, className: cn("flex shrink-0 items-center gap-2", value && "ms-auto"), children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPicking(true), children: s("image.choose") }), _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: uploading, onClick: () => uploadInputRef.current?.click(), children: uploading ? s("image.uploading") : s("image.upload") }), value && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: uploading, onClick: () => onChange(null), children: s("image.remove") }))] })] }), _jsx("input", { ref: uploadInputRef, type: "file", className: "hidden", accept: settings.acceptedTypes && settings.acceptedTypes.length > 0 ? settings.acceptedTypes.join(",") : "image/*", "aria-label": s("image.uploadAria"), disabled: uploading, onChange: (e) => void handleFileChange(e) }), rendition !== null && (_jsx("p", { id: hintId, className: "text-xs text-text-tertiary", children: s("image.asksFor", { shape: renditionShape(rendition) }) })), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), picking && (_jsx(MediaPicker
189
198
  // The field stores one media id and has nowhere to put alt text,
190
199
  // so a pick commits and the drawer closes in one gesture. Rich
191
200
  // text passes true, because there the alt lives on the node.
@@ -273,6 +282,7 @@ function collectRenditionChoices(documentTypes, dataTypes) {
273
282
  }
274
283
  function useRenditionChoices() {
275
284
  const fetchApi = usePluginApi();
285
+ const s = useSdkString();
276
286
  const [groups, setGroups] = useState([]);
277
287
  const [loading, setLoading] = useState(true);
278
288
  const [error, setError] = useState(null);
@@ -286,8 +296,16 @@ function useRenditionChoices() {
286
296
  setError(null);
287
297
  setComplete(true);
288
298
  Promise.all([
289
- readAllPages(fetchApi, `${MANAGE_API}/document-types`, "document types", { limit: TYPE_PAGE_LIMIT, cap: TYPE_PAGE_CAP }),
290
- readAllPages(fetchApi, `${MANAGE_API}/data-types`, "data types", { limit: TYPE_PAGE_LIMIT, cap: TYPE_PAGE_CAP }),
299
+ readAllPages(fetchApi, `${MANAGE_API}/document-types`, "document types", {
300
+ limit: TYPE_PAGE_LIMIT,
301
+ cap: TYPE_PAGE_CAP,
302
+ failure: ({ status }) => s("image.documentTypesFailed", { detail: status ?? s("shared.unexpectedAnswer") }),
303
+ }),
304
+ readAllPages(fetchApi, `${MANAGE_API}/data-types`, "data types", {
305
+ limit: TYPE_PAGE_LIMIT,
306
+ cap: TYPE_PAGE_CAP,
307
+ failure: ({ status }) => s("image.dataTypesFailed", { detail: status ?? s("shared.unexpectedAnswer") }),
308
+ }),
291
309
  ])
292
310
  .then(([documentTypes, dataTypes]) => {
293
311
  if (cancelled)
@@ -306,7 +324,7 @@ function useRenditionChoices() {
306
324
  return () => {
307
325
  cancelled = true;
308
326
  };
309
- }, [fetchApi]);
327
+ }, [fetchApi, s]);
310
328
  return { groups, loading, error, complete };
311
329
  }
312
330
  // Rendered by the Data Types editor only, a settings-EDITING view (see
@@ -323,6 +341,7 @@ export function ImageSettingsView() {
323
341
  const { value: settings, onChange } = usePluginSettingsValue();
324
342
  const { groups, loading, error, complete } = useRenditionChoices();
325
343
  const noticeId = useId();
344
+ const s = useSdkString();
326
345
  const rendition = requestedRendition(settings);
327
346
  const listed = groups.some((group) => group.choices.some((choice) => choice.name === rendition));
328
347
  // Whether the question has been answered at all. It decides what this
@@ -340,7 +359,7 @@ export function ImageSettingsView() {
340
359
  ? {
341
360
  role: "status",
342
361
  className: "text-text-tertiary",
343
- text: "Loading the crops your media types declare…",
362
+ text: s("image.loadingCrops"),
344
363
  }
345
364
  : error !== null
346
365
  ? // Verbatim, the same convention the media picker follows: a list
@@ -351,20 +370,19 @@ export function ImageSettingsView() {
351
370
  : {
352
371
  role: "alert",
353
372
  className: "text-danger-600",
354
- text: `Only the first ${TYPE_PAGE_CAP * TYPE_PAGE_LIMIT} types could be read, ` +
355
- "so a crop declared beyond them is missing from this list.",
373
+ text: s("image.typesTruncated", { limit: TYPE_PAGE_CAP * TYPE_PAGE_LIMIT }),
356
374
  };
357
- return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: "Accepted file types", htmlFor: "image-settings-accepted-types", helpText: "Comma-separated MIME types, e.g. image/png,image/jpeg. Leave blank to accept any image.", children: _jsx(Input, { id: "image-settings-accepted-types", value: settings.acceptedTypes?.join(",") ?? "", onChange: (e) => {
375
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: s("image.acceptedTypesLabel"), htmlFor: "image-settings-accepted-types", helpText: s("image.acceptedTypesHelp"), children: _jsx(Input, { id: "image-settings-accepted-types", value: settings.acceptedTypes?.join(",") ?? "", onChange: (e) => {
358
376
  const types = e.target.value
359
377
  .split(",")
360
378
  .map((t) => t.trim())
361
379
  .filter((t) => t.length > 0);
362
380
  onChange({ ...settings, acceptedTypes: types.length > 0 ? types : undefined });
363
- } }) }), _jsx(PropertyField, { label: "Max file size (bytes)", htmlFor: "image-settings-max-size", helpText: "e.g. 5000000 for ~5MB. Leave blank for no limit.", children: _jsx(Input, { id: "image-settings-max-size", type: "number", min: 1, value: settings.maxSizeBytes ?? "", onChange: (e) => onChange({ ...settings, maxSizeBytes: e.target.value === "" ? undefined : Number(e.target.value) }) }) }), _jsx(PropertyField, { label: "Crop", htmlFor: "image-settings-rendition", helpText: "The shape this field asks its picture for. A page gets that crop when the picture has one, and the full image when it does not.", children: _jsxs("select", { id: "image-settings-rendition", className: SELECT_CLASS, "aria-describedby": notice ? noticeId : undefined, value: rendition ?? "",
381
+ } }) }), _jsx(PropertyField, { label: s("image.maxSizeLabel"), htmlFor: "image-settings-max-size", helpText: s("image.maxSizeHelp"), children: _jsx(Input, { id: "image-settings-max-size", type: "number", min: 1, value: settings.maxSizeBytes ?? "", onChange: (e) => onChange({ ...settings, maxSizeBytes: e.target.value === "" ? undefined : Number(e.target.value) }) }) }), _jsx(PropertyField, { label: s("image.cropLabel"), htmlFor: "image-settings-rendition", helpText: s("image.cropHelp"), children: _jsxs("select", { id: "image-settings-rendition", className: SELECT_CLASS, "aria-describedby": notice ? noticeId : undefined, value: rendition ?? "",
364
382
  // The empty option is `rendition: null`, which is how
365
383
  // ImageSettingsSchema spells "any picture will do", rather than
366
384
  // a missing key or an empty string.
367
- onChange: (event) => onChange({ ...settings, rendition: event.target.value === "" ? null : event.target.value }), children: [_jsx("option", { value: "", children: "No particular crop" }), rendition !== null && !listed && (_jsx("option", { value: rendition, children: settled ? `${renditionShape(rendition)} (no media type declares this crop)` : renditionShape(rendition) })), groups.map((group) => (_jsx("optgroup", { label: group.typeName, children: group.choices.map((choice) => (_jsx("option", { value: choice.name, children: `${choice.caption} ${renditionShape(choice.name)}` }, choice.fieldId))) }, group.typeId)))] }) }), notice && (_jsx("p", { id: noticeId, role: notice.role, className: cn("text-xs", notice.className), children: notice.text }))] }));
385
+ onChange: (event) => onChange({ ...settings, rendition: event.target.value === "" ? null : event.target.value }), children: [_jsx("option", { value: "", children: s("image.noCrop") }), rendition !== null && !listed && (_jsx("option", { value: rendition, children: settled ? s("image.undeclaredCrop", { shape: renditionShape(rendition) }) : renditionShape(rendition) })), groups.map((group) => (_jsx("optgroup", { label: group.typeName, children: group.choices.map((choice) => (_jsx("option", { value: choice.name, children: s("image.cropChoice", { caption: choice.caption, shape: renditionShape(choice.name) }) }, choice.fieldId))) }, group.typeId)))] }) }), notice && (_jsx("p", { id: noticeId, role: notice.role, className: cn("text-xs", notice.className), children: notice.text }))] }));
368
386
  }
369
387
  export function ImageReadOnlyView() {
370
388
  const { value } = usePluginValue();
@@ -0,0 +1,3 @@
1
+ export declare function LinkInputView(): import("react").JSX.Element;
2
+ export declare function LinkReadOnlyView(): import("react").JSX.Element;
3
+ export declare function LinkSettingsView(): import("react").JSX.Element;
@@ -0,0 +1,150 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId, useState } from "react";
3
+ import { LINK_LABEL_MAX, LINK_URL_MAX, isOutsideLinkAddress, readLinkSettings, readLinkValue, } from "@kardalum/api-schemas";
4
+ import { Button, Checkbox, Input, PropertyField, TruncatedText, cn, usePropertyFieldControl } from "@kardalum/ui";
5
+ import { PagePickerSheet } from "../content-picker/page-picker-sheet.js";
6
+ import { summaryMark, usePageSummaries } from "../content-picker/page-tree.js";
7
+ import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
8
+ import { usePluginTranslate } from "../plugin-screen-context.js";
9
+ import { useAdminChromeProps } from "../sdk-strings.js";
10
+ function kindOf(link) {
11
+ if (link === null)
12
+ return null;
13
+ return link.page !== undefined ? "page" : "url";
14
+ }
15
+ function kindAllowed(kind, allow) {
16
+ return allow === "both" || (allow === "internal" ? kind === "page" : kind === "url");
17
+ }
18
+ /** The words for a page that is gone, trashed, a draft or unreadable; no mark for a plain page. */
19
+ function usePageLine(id) {
20
+ const t = usePluginTranslate();
21
+ const summaries = usePageSummaries(id === null ? [] : [id]);
22
+ const summary = id === null ? undefined : summaries.byId.get(id);
23
+ // Only a read in flight is "loading"; a failed read or an id the read did not return is a mark, never the id.
24
+ const loading = id !== null && (summaries.status === "loading" || summaries.status === "idle");
25
+ const mark = summary !== undefined ? summaryMark(summary) : id === null || loading ? null : summaries.status === "failed" ? "noAccess" : "missing";
26
+ const markText = mark === null ? null : t(`contentPicker.${mark}`);
27
+ return {
28
+ loading,
29
+ name: summary?.name ?? null,
30
+ path: summary?.path ?? null,
31
+ markText,
32
+ };
33
+ }
34
+ export function LinkInputView() {
35
+ const { value, onChange } = usePluginValue();
36
+ const { allow } = readLinkSettings(usePluginSettings());
37
+ const link = readLinkValue(value);
38
+ const field = usePropertyFieldControl();
39
+ // M32 I2: in page mode the group is named and described by the field, and the label's `for`
40
+ // (the control id) names the page button, which keeps its own name; aria-invalid stays off the
41
+ // group. M32 I5: aria-invalid sits on the button the label names, with the error description.
42
+ // In address mode the input takes the whole wiring.
43
+ // The error description sits on the page button only (not the group too), so it is read once.
44
+ const { id: controlId, "aria-invalid": invalid, "aria-describedby": describedBy, ...groupWiring } = field;
45
+ const t = usePluginTranslate();
46
+ const chrome = useAdminChromeProps();
47
+ const groupId = useId();
48
+ const labelInputId = useId();
49
+ const storedKind = kindOf(link);
50
+ const defaultKind = allow === "external" ? "url" : "page";
51
+ const [chosenKind, setChosenKind] = useState(null);
52
+ const [draft, setDraft] = useState({ label: "", newTab: false });
53
+ const [open, setOpen] = useState(false);
54
+ // A whitespace-only entry stays in the field but is never stored.
55
+ const [blankText, setBlankText] = useState(null);
56
+ // A value changed from outside (an undo, a panel's proposal) ends a blank entry in progress.
57
+ const [seenValue, setSeenValue] = useState(value);
58
+ if (seenValue !== value) {
59
+ setSeenValue(value);
60
+ if (blankText !== null)
61
+ setBlankText(null);
62
+ }
63
+ const notAllowed = storedKind !== null && !kindAllowed(storedKind, allow);
64
+ // A stored kind the settings no longer allow keeps its value, but the editor works in an allowed kind.
65
+ const kind = allow === "internal"
66
+ ? "page"
67
+ : allow === "external"
68
+ ? "url"
69
+ : (chosenKind ?? (notAllowed ? defaultKind : (storedKind ?? defaultKind)));
70
+ const label = link?.label ?? draft.label;
71
+ const newTab = link?.newTab ?? draft.newTab;
72
+ const page = kind === "page" ? (link?.page ?? null) : null;
73
+ const url = kind === "url" ? (link?.url ?? "") : "";
74
+ const pageLine = usePageLine(page);
75
+ const needsTarget = link === null && (label !== "" || newTab);
76
+ const needsTargetId = `${groupId}-needs`;
77
+ const badAddress = url.trim() !== "" && !isOutsideLinkAddress(url);
78
+ const store = (target, nextLabel, nextNewTab) => {
79
+ setDraft({ label: nextLabel, newTab: nextNewTab });
80
+ if (target === null)
81
+ return onChange(null);
82
+ onChange({ ...target, label: nextLabel, newTab: nextNewTab });
83
+ };
84
+ const current = () => link === null ? null : link.page !== undefined ? { page: link.page } : { url: link.url };
85
+ // The label and the tab choice sit beside the target; with no target they wait in the draft.
86
+ const setLabel = (next) => store(current(), next, newTab);
87
+ const setNewTab = (next) => store(current(), label, next);
88
+ const switchKind = (next) => {
89
+ setChosenKind(next);
90
+ setBlankText(null);
91
+ if (storedKind !== null && storedKind !== next)
92
+ store(null, label, newTab);
93
+ };
94
+ return (_jsxs("div", { ...chrome, className: "flex flex-col gap-3", children: [allow === "both" && (_jsxs("div", { role: "radiogroup", "aria-labelledby": `${groupId}-kind`, className: "flex flex-col gap-1", children: [_jsx("span", { id: `${groupId}-kind`, className: "text-sm font-medium text-text-primary", children: t("link.kindLabel") }), ["page", "url"].map((entry) => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-text-primary", children: [_jsx("input", { type: "radio", name: groupId, checked: kind === entry, onChange: () => switchKind(entry), className: "size-4 accent-primary-600" }), t(entry === "page" ? "link.kindPage" : "link.kindUrl")] }, entry)))] })), notAllowed && (_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: t("link.kindNotAllowed") })), notAllowed && link !== null && _jsx(LinkTargetLine, { link: link }), kind === "page" && (_jsxs("div", { ...groupWiring, role: "group", className: "flex flex-col gap-2", children: [page !== null ? (_jsxs("div", { className: "flex min-w-0 flex-col rounded-md border border-border-default px-3 py-2", children: [pageLine.loading && _jsx(TruncatedText, { className: "truncate text-sm text-text-tertiary", children: t("contentPicker.loading") }), pageLine.name !== null && _jsx(TruncatedText, { className: "truncate text-sm text-text-primary", children: pageLine.name }), pageLine.path !== null && _jsx(TruncatedText, { className: "truncate font-mono text-xs text-text-tertiary", children: pageLine.path }), pageLine.markText !== null && (_jsx("span", { className: cn("text-xs", pageLine.name !== null ? "text-text-secondary" : "text-sm text-text-primary"), children: pageLine.markText }))] })) : (_jsx("p", { className: "text-sm text-text-tertiary", children: t("link.noPage") })), _jsx("div", { children: _jsx(Button, { id: controlId, "aria-invalid": invalid, "aria-describedby": describedBy, "aria-label": t(page === null ? "link.choosePage" : "link.changePage"), type: "button", variant: "outline", size: "sm", onClick: () => setOpen(true), children: t(page === null ? "link.choosePage" : "link.changePage") }) }), _jsx(PagePickerSheet, { open: open, onOpenChange: setOpen, startNode: null, documentTypes: [], multiple: false, remaining: 1, chosen: [], onChoose: (picked) => {
95
+ const id = picked[0];
96
+ if (id !== undefined)
97
+ store({ page: id }, label, newTab);
98
+ } })] })), kind === "url" && (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Input, { ...field, type: "text", inputMode: "url", dir: "ltr", maxLength: LINK_URL_MAX, "aria-label": t("link.urlLabel"), "aria-invalid": badAddress || field["aria-invalid"] || undefined, "aria-describedby": [
99
+ ...new Set([...(field["aria-describedby"] ?? "").split(" "), `${groupId}-hint`, badAddress ? `${groupId}-bad` : ""].filter((id) => id !== "")),
100
+ ].join(" "), value: blankText ?? url, onChange: (event) => {
101
+ const raw = event.target.value;
102
+ if (raw === "") {
103
+ setBlankText(null);
104
+ store(null, label, newTab);
105
+ return;
106
+ }
107
+ const text = raw.trim();
108
+ if (text === "") {
109
+ setBlankText(raw);
110
+ return;
111
+ }
112
+ setBlankText(null);
113
+ store({ url: text }, label, newTab);
114
+ } }), _jsx("p", { id: `${groupId}-hint`, className: "text-xs text-text-tertiary", children: t("link.urlHint") }), badAddress && (_jsx("p", { id: `${groupId}-bad`, role: "alert", className: "text-sm text-danger-600", children: t("link.badAddress") }))] })), _jsx(PropertyField, { label: t("link.labelLabel"), htmlFor: labelInputId, helpText: t("link.labelHint"), children: _jsx(Input, { id: labelInputId, maxLength: LINK_LABEL_MAX, value: label, "aria-describedby": needsTarget ? needsTargetId : undefined, onChange: (event) => setLabel(event.target.value) }) }), needsTarget && (_jsx("p", { id: needsTargetId, className: "text-xs text-text-secondary", children: t("link.labelNeedsTarget") })), _jsxs("label", { className: "flex items-center gap-2 text-sm text-text-primary", children: [_jsx(Checkbox, { checked: newTab, "aria-describedby": needsTarget ? needsTargetId : undefined, onCheckedChange: (checked) => setNewTab(checked === true) }), t("link.newTab")] }), link !== null && (_jsx("div", { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => store(null, "", false), children: t("link.clear") }) }))] }));
115
+ }
116
+ /** The stored target as plain text. An address is never an href; one that is not an outside address says so. */
117
+ function LinkTargetLine({ link }) {
118
+ const t = usePluginTranslate();
119
+ const pageLine = usePageLine(link.page ?? null);
120
+ if (link.page !== undefined) {
121
+ return (_jsx("span", { className: "font-mono text-xs text-text-secondary", children: pageLine.path ?? pageLine.markText ?? t("contentPicker.loading") }));
122
+ }
123
+ return (_jsxs("span", { className: "flex flex-col", children: [_jsx("span", { className: "break-all font-mono text-xs text-text-secondary", children: link.url }), !isOutsideLinkAddress(link.url) && _jsx("span", { className: "text-xs text-danger-600", children: t("link.badAddress") })] }));
124
+ }
125
+ export function LinkReadOnlyView() {
126
+ const { value } = usePluginValue();
127
+ const link = readLinkValue(value);
128
+ const t = usePluginTranslate();
129
+ const chrome = useAdminChromeProps();
130
+ const pageLine = usePageLine(link?.page ?? null);
131
+ if (link === null) {
132
+ return (_jsx("span", { ...chrome, className: "text-sm text-text-tertiary", children: t("link.none") }));
133
+ }
134
+ // A page that is missing or unreadable shows its mark, never its id.
135
+ const pageName = pageLine.name ?? (pageLine.loading ? t("contentPicker.loading") : null);
136
+ const shown = link.label !== "" ? link.label : link.page !== undefined ? pageName : link.url;
137
+ return (_jsxs("span", { ...chrome, className: "flex min-w-0 flex-col text-sm", children: [_jsxs("span", { className: "text-text-primary", children: [shown, link.newTab && _jsxs("span", { className: "text-text-secondary", children: [" ", t("link.newTabShort")] })] }), link.page !== undefined ? (_jsxs(_Fragment, { children: [pageLine.path !== null && _jsx("span", { className: "font-mono text-xs text-text-tertiary", children: pageLine.path }), pageLine.markText !== null && (_jsx("span", { className: cn("text-xs", pageLine.name !== null ? "text-text-secondary" : "text-sm text-text-primary"), children: pageLine.markText }))] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "break-all font-mono text-xs text-text-tertiary", children: link.url }), !isOutsideLinkAddress(link.url) && _jsx("span", { className: "text-xs text-danger-600", children: t("link.badAddress") })] }))] }));
138
+ }
139
+ export function LinkSettingsView() {
140
+ const { value: stored, onChange } = usePluginSettingsValue();
141
+ const { allow } = readLinkSettings(stored);
142
+ const t = usePluginTranslate();
143
+ const groupName = useId();
144
+ const options = [
145
+ { value: "both", key: "link.allowBoth" },
146
+ { value: "internal", key: "link.allowInternal" },
147
+ { value: "external", key: "link.allowExternal" },
148
+ ];
149
+ return (_jsxs("fieldset", { className: "flex flex-col gap-2", children: [_jsx("legend", { className: "text-sm font-medium text-text-primary", children: t("link.allowLabel") }), options.map((option) => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-text-primary", children: [_jsx("input", { type: "radio", name: groupName, checked: allow === option.value, onChange: () => onChange({ ...stored, allow: option.value }), className: "size-4 accent-primary-600" }), t(option.key)] }, option.value)))] }));
150
+ }
@@ -0,0 +1,3 @@
1
+ export declare function OptionsListInputView(): import("react").JSX.Element;
2
+ export declare function OptionsListReadOnlyView(): import("react").JSX.Element;
3
+ export declare function OptionsListSettingsView(): import("react").JSX.Element;