@kardalum/plugin-sdk 0.15.0 → 0.17.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 (204) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +10 -0
  3. package/dist/admin-section-registry.d.ts +14 -5
  4. package/dist/admin-section-registry.js +14 -4
  5. package/dist/built-in-value-schemas.js +1 -1
  6. package/dist/built-ins.js +2 -2
  7. package/dist/capabilities.d.ts +8 -78
  8. package/dist/capabilities.js +23 -322
  9. package/dist/host-entry.d.ts +1 -1
  10. package/dist/host-entry.js +1 -1
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +13 -12
  13. package/dist/license-verdict-keys.d.ts +4 -3
  14. package/dist/license-verdict-keys.js +6 -5
  15. package/dist/manifest-entry.d.ts +3 -3
  16. package/dist/manifest-entry.js +2 -2
  17. package/dist/manifest-schema.d.ts +113 -56
  18. package/dist/manifest-schema.js +192 -295
  19. package/dist/manifest.d.ts +145 -112
  20. package/dist/manifest.js +13 -36
  21. package/dist/media/media-picker.js +21 -12
  22. package/dist/media/upload-error.d.ts +1 -1
  23. package/dist/media/upload-error.js +1 -1
  24. package/dist/plugin-context.d.ts +7 -0
  25. package/dist/plugin-context.js +7 -0
  26. package/dist/plugin-screen-context.d.ts +44 -3
  27. package/dist/plugin-screen-context.js +27 -2
  28. package/dist/read-all-pages.d.ts +23 -0
  29. package/dist/read-all-pages.js +30 -0
  30. package/dist/richtext/block-panel.js +6 -6
  31. package/dist/richtext/insert-menu.js +4 -4
  32. package/dist/richtext/style-listbox.js +4 -4
  33. package/dist/tokens/tokens.css +1 -0
  34. package/dist/tokens/tokens.json +2 -1
  35. package/dist/type-equality.d.ts +2 -0
  36. package/dist/type-equality.js +1 -0
  37. package/dist/views/content-list-view.js +2 -2
  38. package/dist/views/html-view.js +1 -1
  39. package/dist/views/image-view.js +24 -39
  40. package/dist/views/rich-text-view.js +3 -3
  41. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
  42. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
  43. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
  44. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
  45. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  46. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
  47. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
  48. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
  49. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  50. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  51. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
  52. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
  53. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  54. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
  55. package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
  56. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  57. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  58. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
  59. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  60. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
  61. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
  62. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
  63. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
  64. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
  65. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
  66. package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
  67. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  68. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  69. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  70. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  71. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  72. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  73. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
  74. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
  75. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
  76. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
  77. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
  78. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
  79. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  80. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  81. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
  82. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
  83. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
  84. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
  85. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  86. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  87. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  88. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  89. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
  90. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
  91. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  92. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  93. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
  94. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
  95. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
  96. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
  97. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
  98. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
  99. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
  100. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
  101. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  102. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  103. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  104. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  105. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
  106. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
  107. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  108. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  109. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
  110. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
  111. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  112. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
  113. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
  114. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
  115. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
  116. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  117. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  118. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
  119. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
  120. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
  121. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
  122. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
  123. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
  124. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  125. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  126. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  127. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
  128. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
  129. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
  130. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
  131. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  132. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  133. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
  134. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
  135. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
  136. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
  137. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  138. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
  139. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  140. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  141. package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
  142. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  143. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  144. package/node_modules/@kardalum/plugin-package/README.md +4 -1
  145. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
  146. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
  147. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  148. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
  149. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  150. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  151. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  152. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  153. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  154. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  155. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
  156. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
  157. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  158. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  159. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  160. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  161. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  162. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  163. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  164. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  165. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  166. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  167. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  168. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  169. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  170. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  171. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  172. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
  173. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  174. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  175. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  176. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  177. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
  178. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
  179. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  180. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  181. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  182. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  183. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  184. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  185. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
  186. package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
  187. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  188. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  189. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
  190. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
  191. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
  192. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
  193. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  194. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  195. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  196. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  197. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
  198. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
  199. package/node_modules/@kardalum/plugin-package/package.json +9 -2
  200. package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
  201. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  202. package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
  203. package/node_modules/@kardalum/ui/package.json +1 -1
  204. package/package.json +6 -6
@@ -0,0 +1,133 @@
1
+ import { lstatSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ // S311 fix wave (W1): what a plugin's own folders put into its package, defined
4
+ // once. The CLI's build copies templates/, public/ and media/ through
5
+ // walkShipped, and every check that asks whether a declared file is there (a
6
+ // template, an asset, a sample's media file) asks whyNotShipped, at both gates.
7
+ // Before this the copy left out links and the folders below while the checks
8
+ // asked existsSync, which follows a link and sees those folders: a declared
9
+ // `dist/theme.css` passed `validate`, `build` and `pack`, and the marketplace
10
+ // then refused the package because the file was not in it.
11
+ /** Names a package never carries, at any depth, a folder with everything under
12
+ * it: vendored and build folders, and env files (they can hold live secrets),
13
+ * `.env.example` excepted (placeholder values a reader copies). A bare file
14
+ * of one of these names is left out too. */
15
+ export const EXCLUDED_NAMES = ["node_modules", "dist", ".git", ".next", ".astro"];
16
+ const EXCLUDED = new Set(EXCLUDED_NAMES);
17
+ const ENV_FILE = /^\.env(\..*)?$/;
18
+ /** How the rule reads in a message. */
19
+ const EXCLUDED_RULE = "node_modules, dist, .git, .next, .astro and env files are left out of the build";
20
+ const LINK_RULE = "the build copies files and folders, never links";
21
+ export function isExcludedSegment(segment) {
22
+ return EXCLUDED.has(segment) || (ENV_FILE.test(segment) && segment !== ".env.example");
23
+ }
24
+ function lstatOrNull(path) {
25
+ try {
26
+ return lstatSync(path);
27
+ }
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ /** Every file and folder under `folder` that ships, parents before children,
33
+ * each folder's entries in name order. A link is never followed and never
34
+ * listed, a left-out name is skipped with everything under it, and a folder
35
+ * that is absent, a file or a link ships nothing. Iterative, so a deep tree
36
+ * costs no stack. */
37
+ export function walkShipped(folder) {
38
+ if (!lstatOrNull(folder)?.isDirectory())
39
+ return [];
40
+ const shipped = [];
41
+ // A queue read by index: every folder is read once, in the order it was found.
42
+ const pending = [""];
43
+ for (let next = 0; next < pending.length; next++) {
44
+ const relative = pending[next];
45
+ const children = readdirSync(relative === "" ? folder : join(folder, ...relative.split("/")), { withFileTypes: true })
46
+ .filter((entry) => !entry.isSymbolicLink() && !isExcludedSegment(entry.name) && (entry.isDirectory() || entry.isFile()))
47
+ .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
48
+ if (relative !== "")
49
+ shipped.push({ path: relative, isDirectory: true, empty: children.length === 0 });
50
+ for (const child of children) {
51
+ const path = relative === "" ? child.name : `${relative}/${child.name}`;
52
+ if (child.isDirectory())
53
+ pending.push(path);
54
+ else
55
+ shipped.push({ path, isDirectory: false, empty: false });
56
+ }
57
+ }
58
+ return shipped;
59
+ }
60
+ const CASE_RULE = "names are matched exactly, as the marketplace and a Linux install read them";
61
+ /** Why a file is not one the build carries into the package, for any number
62
+ * of paths under one package root, each folder read once (S311 second code
63
+ * fix). A path is relative to `root`, with "/"; the answer is null for a
64
+ * regular file reached through real folders only, none of them a left-out
65
+ * name, or the reason, which reads after the path: "public/dist/theme.css is
66
+ * inside public/dist/, which ...".
67
+ *
68
+ * The first segment is the folder the build opens by its own name
69
+ * (templates, public or media), which a case-insensitive host resolves in any
70
+ * case, as the build's copy does, and writes into the package under that
71
+ * name. Every segment below it must be spelled as its folder lists it: the
72
+ * build copies the names it reads, so on Windows or macOS a declared
73
+ * `Styles/Site.css` the file system would find as `styles/site.css` is not in
74
+ * the package under the declared name, and the marketplace (and any Linux
75
+ * install) reads names exactly. */
76
+ export function createShippedLookup(root) {
77
+ const listings = new Map();
78
+ const namesIn = (folder) => {
79
+ if (listings.has(folder))
80
+ return listings.get(folder);
81
+ let names = null;
82
+ try {
83
+ const listed = readdirSync(folder);
84
+ names = { exact: new Set(listed), folded: new Map(listed.map((name) => [name.toLowerCase(), name])) };
85
+ }
86
+ catch {
87
+ // Not a folder that can be read: the lstat below says what it is.
88
+ }
89
+ listings.set(folder, names);
90
+ return names;
91
+ };
92
+ return (path) => {
93
+ const segments = path.split("/");
94
+ if (segments.some((segment) => segment === "" || segment === "." || segment === ".."))
95
+ return "is not a path inside the package";
96
+ let current = root;
97
+ for (let i = 0; i < segments.length; i++) {
98
+ const segment = segments[i];
99
+ const last = i === segments.length - 1;
100
+ const folder = `${segments.slice(0, i + 1).join("/")}/`;
101
+ if (isExcludedSegment(segment)) {
102
+ return last ? `is a name a package never carries: ${EXCLUDED_RULE}` : `is inside ${folder}, which a package never carries: ${EXCLUDED_RULE}`;
103
+ }
104
+ if (i > 0) {
105
+ const names = namesIn(current);
106
+ if (names !== null && !names.exact.has(segment)) {
107
+ const held = names.folded.get(segment.toLowerCase());
108
+ if (held === undefined)
109
+ return "does not exist";
110
+ return `differs in case from ${[...segments.slice(0, i), held].join("/")}, the name the folder holds: ${CASE_RULE}`;
111
+ }
112
+ }
113
+ current = join(current, segment);
114
+ const stats = lstatOrNull(current);
115
+ if (stats === null)
116
+ return "does not exist";
117
+ if (stats.isSymbolicLink())
118
+ return last ? `is a link: ${LINK_RULE}` : `is inside ${folder}, a link: ${LINK_RULE}`;
119
+ if (!last && !stats.isDirectory())
120
+ return "does not exist";
121
+ if (last && stats.isDirectory())
122
+ return "is a folder, not a file";
123
+ if (last && !stats.isFile())
124
+ return "is not a regular file";
125
+ }
126
+ return null;
127
+ };
128
+ }
129
+ /** createShippedLookup's answer for one path. A caller with many paths under
130
+ * one root makes one lookup and asks it each. */
131
+ export function whyNotShipped(root, path) {
132
+ return createShippedLookup(root)(path);
133
+ }
@@ -0,0 +1,7 @@
1
+ /** At most this many codes are read from one package's locales/ folder. */
2
+ export declare const MAX_SHIPPED_LOCALES = 100;
3
+ /** S314c2 (D9): the language codes of the locale files a package (or a plugin project) ships,
4
+ * locales/<code>.json, by file name alone (the admin parses each file when it loads it), sorted
5
+ * and at most MAX_SHIPPED_LOCALES. Never throws: no folder ships none. The registry row keeps
6
+ * them, so the admin asks only for files that exist. */
7
+ export declare function readShippedLocales(dir: string): string[];
@@ -0,0 +1,27 @@
1
+ import { readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { pluginLocaleFileLanguage } from "@kardalum/api-schemas";
4
+ /** At most this many codes are read from one package's locales/ folder. */
5
+ export const MAX_SHIPPED_LOCALES = 100;
6
+ /** S314c2 (D9): the language codes of the locale files a package (or a plugin project) ships,
7
+ * locales/<code>.json, by file name alone (the admin parses each file when it loads it), sorted
8
+ * and at most MAX_SHIPPED_LOCALES. Never throws: no folder ships none. The registry row keeps
9
+ * them, so the admin asks only for files that exist. */
10
+ export function readShippedLocales(dir) {
11
+ let names;
12
+ try {
13
+ names = readdirSync(join(dir, "locales"));
14
+ }
15
+ catch {
16
+ return [];
17
+ }
18
+ const codes = [];
19
+ for (const name of names.sort()) {
20
+ const code = pluginLocaleFileLanguage(name);
21
+ if (code !== null && !codes.includes(code))
22
+ codes.push(code);
23
+ if (codes.length >= MAX_SHIPPED_LOCALES)
24
+ break;
25
+ }
26
+ return codes;
27
+ }
@@ -26,12 +26,10 @@ export interface TrustedKey {
26
26
  keyId: string;
27
27
  publicKey: string;
28
28
  }
29
- export type VerifyFailureReason = "malformed-sidecar" | "no-trusted-keys" | "unknown-key" | "bad-signature" | "hash-mismatch" | "identity-mismatch"
30
- /** The artifact itself could not be read (missing, unreadable, permission
31
- * denied, or a mid-read failure) — nothing could be verified about it,
32
- * since hashing never completed. Distinct from hash-mismatch, which
33
- * requires a hash to have actually been computed and compared. */
34
- | "artifact-unreadable";
29
+ /** Every reason a verification can fail for, at runtime (S289: the manual's
30
+ * enum test checks the reasons it quotes against this list). */
31
+ export declare const VERIFY_FAILURE_REASONS: readonly ["malformed-sidecar", "no-trusted-keys", "unknown-key", "bad-signature", "hash-mismatch", "identity-mismatch", "artifact-unreadable"];
32
+ export type VerifyFailureReason = (typeof VERIFY_FAILURE_REASONS)[number];
35
33
  export type VerifyResult = {
36
34
  status: "verified";
37
35
  keyId: string;
@@ -1 +1,15 @@
1
- export {};
1
+ /** Every reason a verification can fail for, at runtime (S289: the manual's
2
+ * enum test checks the reasons it quotes against this list). */
3
+ export const VERIFY_FAILURE_REASONS = [
4
+ "malformed-sidecar",
5
+ "no-trusted-keys",
6
+ "unknown-key",
7
+ "bad-signature",
8
+ "hash-mismatch",
9
+ "identity-mismatch",
10
+ /** The artifact itself could not be read (missing, unreadable, permission
11
+ * denied, or a mid-read failure): nothing could be verified about it,
12
+ * since hashing never completed. Distinct from hash-mismatch, which
13
+ * requires a hash to have actually been computed and compared. */
14
+ "artifact-unreadable",
15
+ ];
@@ -15,6 +15,11 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "import": "./dist/index.js",
17
17
  "default": "./dist/index.js"
18
+ },
19
+ "./reference": {
20
+ "types": "./dist/reference-entry.d.ts",
21
+ "import": "./dist/reference-entry.js",
22
+ "default": "./dist/reference-entry.js"
18
23
  }
19
24
  },
20
25
  "files": [
@@ -36,14 +41,16 @@
36
41
  "@types/node": "22.20.1",
37
42
  "@types/yauzl": "^3.4.0",
38
43
  "@types/yazl": "^3.3.1",
44
+ "lucide-react": "1.38.0",
39
45
  "typescript": "6.0.3",
40
- "vitest": "3.2.6",
46
+ "vitest": "4.1.12",
41
47
  "yauzl": "3.4.0",
42
48
  "yazl": "^3.3.1",
43
49
  "@kardalum/api-schemas": "0.14.0"
44
50
  },
45
51
  "scripts": {
46
52
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p .",
47
- "test": "vitest run"
53
+ "test": "vitest run",
54
+ "generate:icon-names": "node scripts/generate-icon-names.mjs"
48
55
  }
49
56
  }
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
3
  import { cn } from '../lib/cn.js';
4
4
  function Checkbox({ className, ...props }) {
5
- return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer h-4 w-4 shrink-0 rounded-sm border border-border-default bg-background-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary-600 data-[state=checked]:bg-primary-600 data-[state=checked]:text-text-inverse', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", className: "h-3.5 w-3.5", "aria-hidden": "true", children: _jsx("path", { d: "M3.5 8.5L6.5 11.5L12.5 4.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) }));
5
+ return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer h-4 w-4 shrink-0 rounded-sm border border-neutral-500 bg-background-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary-600 data-[state=checked]:bg-primary-600 data-[state=checked]:text-text-inverse data-[state=indeterminate]:border-primary-600 data-[state=indeterminate]:text-primary-600', className), ...props, children: _jsxs(CheckboxPrimitive.Indicator, { className: "group flex items-center justify-center text-current", children: [_jsx("svg", { viewBox: "0 0 16 16", fill: "none", className: "h-3 w-3 group-data-[state=indeterminate]:hidden", "aria-hidden": "true", children: _jsx("path", { d: "M3.5 8.5L6.5 11.5L12.5 4.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }), _jsx("svg", { viewBox: "0 0 16 16", fill: "none", className: "hidden h-3 w-3 group-data-[state=indeterminate]:block", "aria-hidden": "true", children: _jsx("path", { d: "M4 8h8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })] }) }));
6
6
  }
7
7
  export { Checkbox };
@@ -40,12 +40,12 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
40
40
  return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { sideOffset: sideOffset, className: cn('z-50 min-w-[10rem] overflow-hidden rounded-lg border border-border-default bg-background-elevated p-1 text-text-primary shadow-lg', className), ...props }) }));
41
41
  }
42
42
  function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
43
- return (_jsx(DropdownMenuPrimitive.Item, { className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50', variant === 'destructive'
43
+ return (_jsx(DropdownMenuPrimitive.Item, { className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50', variant === 'destructive'
44
44
  ? 'text-danger-600 data-[highlighted]:bg-danger-100 data-[highlighted]:text-danger-700'
45
45
  : 'text-text-primary data-[highlighted]:bg-background-hover', inset && 'ps-8', className), ...props }));
46
46
  }
47
47
  function DropdownMenuLabel({ className, inset, ...props }) {
48
- return (_jsx(DropdownMenuPrimitive.Label, { className: cn('px-2 py-1.5 text-xs font-semibold text-text-secondary', inset && 'ps-8', className), ...props }));
48
+ return (_jsx(DropdownMenuPrimitive.Label, { className: cn('px-2 py-1 text-xs font-semibold text-text-secondary', inset && 'ps-8', className), ...props }));
49
49
  }
50
50
  function DropdownMenuSeparator({ className, ...props }) {
51
51
  return (_jsx(DropdownMenuPrimitive.Separator, { className: cn('-mx-1 my-1 h-px bg-border-default', className), ...props }));
@@ -81,6 +81,9 @@ function PropertyField({ label, htmlFor, required, requiredText, helpText, error
81
81
  // wired. With neither there is no labelable control to name, and a `for`
82
82
  // that resolves to a <div> (or to nothing) is worse than none at all.
83
83
  const labelFor = htmlFor ?? (wiredChild ? controlId : undefined);
84
- return (_jsxs("div", { "data-slot": "property-field", className: cn('flex flex-col gap-1.5', className), ...props, children: [_jsxs("label", { id: labelId, htmlFor: labelFor, className: "text-sm font-medium text-text-primary", children: [label, required && (_jsxs(_Fragment, { children: [_jsxs("span", { "aria-hidden": "true", className: "text-danger-600", children: [' ', "*"] }), requiredText && _jsxs("span", { className: "sr-only", children: [" (", requiredText, ")"] })] }))] }), _jsx(PropertyFieldContext.Provider, { value: controlProps, children: control }), error ? (_jsx("p", { id: errorId, role: "alert", className: "text-xs text-danger-600", children: error })) : (helpText && (_jsx("p", { id: helpId, className: "text-xs text-text-tertiary", children: helpText })))] }));
84
+ // gap-2 (8px) between the label, the control and the help text: a half step
85
+ // such as gap-1.5 emits no rule under the token preset, which replaces
86
+ // Tailwind's spacing scale, so the label sat flush against its field.
87
+ return (_jsxs("div", { "data-slot": "property-field", className: cn('flex flex-col gap-2', className), ...props, children: [_jsxs("label", { id: labelId, htmlFor: labelFor, className: "text-sm font-medium text-text-primary", children: [label, required && (_jsxs(_Fragment, { children: [_jsxs("span", { "aria-hidden": "true", className: "text-danger-600", children: [' ', "*"] }), requiredText && _jsxs("span", { className: "sr-only", children: [" (", requiredText, ")"] })] }))] }), _jsx(PropertyFieldContext.Provider, { value: controlProps, children: control }), error ? (_jsx("p", { id: errorId, role: "alert", className: "text-xs text-danger-600", children: error })) : (helpText && (_jsx("p", { id: helpId, className: "text-xs text-text-tertiary", children: helpText })))] }));
85
88
  }
86
89
  export { PropertyField };
@@ -53,7 +53,7 @@
53
53
  "react": "19.2.7",
54
54
  "react-dom": "19.2.7",
55
55
  "tailwind-merge": "3.6.0",
56
- "vitest": "3.2.6",
56
+ "vitest": "4.1.12",
57
57
  "@kardalum/test-utils": "0.0.0"
58
58
  },
59
59
  "scripts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kardalum/plugin-sdk",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The SDK for building Kardalum plugins: manifest declaration, data type and admin section registries, storage-value providers, and shared UI components.",
6
6
  "engines": {
@@ -113,11 +113,11 @@
113
113
  "lucide-react": "1.38.0",
114
114
  "tailwind-merge": "3.6.0",
115
115
  "yauzl": "3.4.0",
116
- "zod": "4.4.3",
117
- "@kardalum/api-schemas": "0.14.0",
116
+ "zod": "4.6.6",
118
117
  "@kardalum/plugin-package": "0.14.0",
119
- "@kardalum/design-tokens": "0.14.0",
120
- "@kardalum/ui": "0.14.0"
118
+ "@kardalum/ui": "0.14.0",
119
+ "@kardalum/api-schemas": "0.14.0",
120
+ "@kardalum/design-tokens": "0.14.0"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "react": "^19.0.0",
@@ -131,7 +131,7 @@
131
131
  "react": "19.2.7",
132
132
  "react-dom": "19.2.7",
133
133
  "typescript": "6.0.3",
134
- "vitest": "3.2.6",
134
+ "vitest": "4.1.12",
135
135
  "@kardalum/test-utils": "0.0.0"
136
136
  },
137
137
  "scripts": {