@kardalum/plugin-sdk 0.18.0 → 0.19.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 (122) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/assets/asset-picker.js +3 -3
  4. package/dist/built-in-serializers.js +1 -1
  5. package/dist/built-in-settings-schemas.js +4 -4
  6. package/dist/built-ins.js +10 -10
  7. package/dist/data-type-plugin.d.ts +2 -2
  8. package/dist/datatype-validation.d.ts +2 -2
  9. package/dist/datatype-validation.js +2 -2
  10. package/dist/define-plugin.d.ts +4 -4
  11. package/dist/define-plugin.js +5 -5
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.js +4 -0
  14. package/dist/manifest-schema.js +7 -1
  15. package/dist/media/media-picker.js +4 -4
  16. package/dist/plugin-context.js +3 -3
  17. package/dist/register-built-ins.js +6 -6
  18. package/dist/registry.js +1 -1
  19. package/dist/richtext/block-panel.js +2 -2
  20. package/dist/richtext/extensions.js +7 -7
  21. package/dist/richtext/insert-menu.js +3 -3
  22. package/dist/richtext/style-listbox.js +1 -1
  23. package/dist/richtext/text-style-class.js +1 -1
  24. package/dist/simple-storage-value-provider.js +3 -3
  25. package/dist/structured-storage-types.d.ts +1 -1
  26. package/dist/structured-storage-types.js +2 -2
  27. package/dist/ui-entry.js +3 -3
  28. package/dist/views/asset-view.js +3 -3
  29. package/dist/views/date-range-view.js +5 -5
  30. package/dist/views/html-code-editor.js +2 -2
  31. package/dist/views/html-view.js +7 -7
  32. package/dist/views/image-view.js +4 -4
  33. package/dist/views/rich-text-view.js +4 -3
  34. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
  35. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
  36. package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
  37. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +1 -0
  38. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +14 -8
  39. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
  40. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
  41. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +2 -2
  42. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +2 -2
  43. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +1 -1
  44. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -3
  45. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
  46. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +14 -4
  47. package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
  48. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +11 -8
  49. package/node_modules/@kardalum/api-schemas/dist/index.js +6 -4
  50. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
  51. package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
  52. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +47 -0
  53. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +42 -8
  54. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +9 -9
  55. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
  56. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
  57. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +24 -0
  58. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +39 -0
  59. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
  60. package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
  61. package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
  62. package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
  63. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
  64. package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
  65. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
  66. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
  67. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
  68. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +1 -1
  69. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
  70. package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
  71. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +1 -1
  72. package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
  73. package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
  74. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
  75. package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
  76. package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
  77. package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
  78. package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
  79. package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
  80. package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
  81. package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
  82. package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
  83. package/node_modules/@kardalum/design-tokens/dist/tokens.js +5 -5
  84. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
  85. package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
  86. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +2 -1
  87. package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
  88. package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
  89. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
  90. package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
  91. package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
  92. package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
  93. package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
  94. package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
  95. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
  96. package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
  97. package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
  98. package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
  99. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  100. package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
  101. package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
  102. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
  103. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
  104. package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
  105. package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
  106. package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
  107. package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
  108. package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
  109. package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
  110. package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
  111. package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
  112. package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
  113. package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
  114. package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
  115. package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
  116. package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
  117. package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
  118. package/node_modules/@kardalum/ui/dist/index.js +3 -1
  119. package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
  120. package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
  121. package/node_modules/@kardalum/ui/package.json +8 -6
  122. package/package.json +7 -6
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Light needs no overrides — the base token set generated to :root
2
+ * Light needs no overrides: the base token set generated to :root
3
3
  * (tokens.ts) already IS the light theme. Still modeled as a real
4
4
  * BuiltInTheme, not a special case: applying any theme is always
5
5
  * "set data-theme to this id," whether or not that theme happens to
@@ -6,12 +6,12 @@ import type { KardalumDesignTokens } from './types.js';
6
6
  *
7
7
  * Colour roles: the primary scale runs sky (50–300, atmosphere:
8
8
  * selection, focus, the version rail) into cerulean (600–800, action:
9
- * buttons, links). THE ACTION COLOUR IS primary-600 — this supersedes the
9
+ * buttons, links). THE ACTION COLOUR IS primary-600. This supersedes the
10
10
  * Session-27 "brand = 500 step" convention for primary; 500 is a
11
11
  * mid-step used for nothing in particular. Status scales pair a 100-step
12
12
  * soft fill with the lightest text step that clears 4.5:1 on that fill
13
13
  * (success/danger 700, warning 800). Neutrals are warm stone, not grey. The
14
- * dark set (themes/dark.ts) overrides colour only — themes never touch
14
+ * dark set (themes/dark.ts) overrides colour only, and themes never touch
15
15
  * typography/spacing/shadow/motion.
16
16
  */
17
17
  export declare const tokens: KardalumDesignTokens;
@@ -19,7 +19,7 @@ export declare const tokens: KardalumDesignTokens;
19
19
  * Under an Arabic document language the SAME sans token leads with Plex
20
20
  * Sans Arabic (its Latin glyphs are Plex-compatible), so RTL locales get a
21
21
  * native UI face without any component knowing. Emitted by build-css.ts
22
- * as a `[lang="ar"]` block — a language-conditional value of an existing
22
+ * as a `[lang="ar"]` block, a language-conditional value of an existing
23
23
  * token, not a new one.
24
24
  */
25
25
  export declare const ARABIC_SANS_FONT_FAMILY = "'IBM Plex Sans Arabic', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif";
@@ -5,12 +5,12 @@
5
5
  *
6
6
  * Colour roles: the primary scale runs sky (50–300, atmosphere:
7
7
  * selection, focus, the version rail) into cerulean (600–800, action:
8
- * buttons, links). THE ACTION COLOUR IS primary-600 — this supersedes the
8
+ * buttons, links). THE ACTION COLOUR IS primary-600. This supersedes the
9
9
  * Session-27 "brand = 500 step" convention for primary; 500 is a
10
10
  * mid-step used for nothing in particular. Status scales pair a 100-step
11
11
  * soft fill with the lightest text step that clears 4.5:1 on that fill
12
12
  * (success/danger 700, warning 800). Neutrals are warm stone, not grey. The
13
- * dark set (themes/dark.ts) overrides colour only — themes never touch
13
+ * dark set (themes/dark.ts) overrides colour only, and themes never touch
14
14
  * typography/spacing/shadow/motion.
15
15
  */
16
16
  export const tokens = {
@@ -100,7 +100,7 @@ export const tokens = {
100
100
  subtle: '#FAF9F5',
101
101
  overlay: 'rgba(27, 35, 33, 0.5)',
102
102
  // Nudged from #ECEAE3 (S179): the original wash put primary-600 text
103
- // at 4.48:1 against it, just under AA — #F0EEE7 clears 4.5:1 while
103
+ // at 4.48:1 against it, just under AA; #F0EEE7 clears 4.5:1 while
104
104
  // staying the darkest of the four light surfaces (the hover-wash
105
105
  // hierarchy is unchanged).
106
106
  hover: '#F0EEE7',
@@ -237,7 +237,7 @@ export const tokens = {
237
237
  '44': '11rem',
238
238
  '64': '16rem',
239
239
  // 72 (18rem): the persistent tree panel's width (S49 structure, S177 spec
240
- // 284px) — Tailwind's `w-72` resolves only through this scale.
240
+ // 284px), and Tailwind's `w-72` resolves only through this scale.
241
241
  '72': '18rem',
242
242
  },
243
243
  // 6 small · 8 controls · 12 cards · 16 dialogs
@@ -274,7 +274,7 @@ export const tokens = {
274
274
  * Under an Arabic document language the SAME sans token leads with Plex
275
275
  * Sans Arabic (its Latin glyphs are Plex-compatible), so RTL locales get a
276
276
  * native UI face without any component knowing. Emitted by build-css.ts
277
- * as a `[lang="ar"]` block — a language-conditional value of an existing
277
+ * as a `[lang="ar"]` block, a language-conditional value of an existing
278
278
  * token, not a new one.
279
279
  */
280
280
  export const ARABIC_SANS_FONT_FAMILY = "'IBM Plex Sans Arabic', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Design token type definitions — the shape every theme (built-in or
2
+ * Design token type definitions: the shape every theme (built-in or
3
3
  * plugin) targets.
4
4
  */
5
5
  export type ColorScaleStep = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Design token type definitions — the shape every theme (built-in or
2
+ * Design token type definitions: the shape every theme (built-in or
3
3
  * plugin) targets.
4
4
  */
5
5
  export {};
@@ -75,12 +75,13 @@ export const GATE_ONLY_CHECKS = [
75
75
  { name: "template references resolve", gate: "cli", rule: "Every `render` and `layout` target names a declared alias; the marketplace does not read template text and reports it skipped.", skippedAtDoor: true },
76
76
  { name: "reference", gate: "cli", rule: "The manifest yields a valid `reference.json`, which the build writes and the marketplace reads.", skippedAtDoor: false },
77
77
  { name: "plugin SDK federation share key correct", gate: "cli", rule: "The federation config shares the SDK under its package name, and react, react-dom and the SDK each set `singleton: true` and `import: false`, so the bundle carries no fallback copy of what the host provides. The check reads the literal `shared: { ... }` in `vite.config.ts`, so write every entry out in it: it cannot follow a spread, a variable or a helper.", skippedAtDoor: false },
78
+ { name: "federation type declarations off", gate: "cli", rule: "Advisory: the `federation()` options in `vite.config.ts` set `dts: false`. No Kardalum host reads federated type declarations, so generating them only costs build time, and the build leaves them out of the package either way. The check reads the options with the TypeScript parser and warns, never fails, when it cannot find `dts: false` there.", skippedAtDoor: false },
78
79
  { name: "archive-safety", gate: "door", rule: "The archive extracts safely: no unsafe path, no entry that carries a second name for itself, no path twice in any spelling, within the entry and byte ceilings; a link is extracted as a plain file, never as a link. The upload's reader applies the same rules.", skippedAtDoor: false },
79
80
  { name: "manifest-schema", gate: "door", rule: `\`manifest.json\` is at most ${formatBinarySize(MANIFEST_MAX_BYTES)}, parses, and matches the shape rule built from the shared vocabularies, declaration rules and field limits.`, skippedAtDoor: false },
80
81
  { name: "required-files", gate: "door", rule: "`manifest.json`, `server/plugin.js` and `server/package.json` (declaring the ESM marker) are present, plus `remoteEntry.js` when a view-bearing contribution is declared.", skippedAtDoor: false },
81
82
  { name: "manifest-consistency", gate: "door", rule: "The manifest's id and version match the submission record, and the extracted `manifest.json` is byte for byte the one read at upload.", skippedAtDoor: false },
82
83
  { name: "reserved-names", gate: "door", rule: "Nothing at the package root is named `kardalum-license.json`, in any case: the marketplace writes that file into every licensed download.", skippedAtDoor: false },
83
- { name: "bundle-members", gate: "door", rule: "Bundles only: every member id is a published listing, and a paid member belongs to the bundle's author.", skippedAtDoor: false },
84
+ { name: "bundle-members", gate: "door", rule: "Every plugin that declares bundledPlugins: each member id is a published listing, and a paid member belongs to the bundle's author; a listing labelled bundle must declare at least one member.", skippedAtDoor: false },
84
85
  { name: "internal-validation-error", gate: "door", rule: "Not a rule a package breaks: the marketplace could not read the stored package, or could not finish checking it in time. Submit again under a new version number and every check runs afresh.", skippedAtDoor: false },
85
86
  ];
86
87
  export function runDeliveryChecks(context, gate) {
@@ -5,7 +5,7 @@ export declare function generateSigningKeyPair(): {
5
5
  publicKey: string;
6
6
  keyId: string;
7
7
  };
8
- /** Deterministic serialization. Deliberately NOT full JCS — we own both
8
+ /** Deterministic serialization. Deliberately NOT full JCS, since we own both
9
9
  * ends, and a fixed-order literal is the entire requirement. */
10
10
  export declare function canonicalizeEnvelope(envelope: SignatureEnvelope): Buffer;
11
11
  export declare function signEnvelope(envelope: SignatureEnvelope, privateKeyBase64: string): string;
@@ -13,7 +13,7 @@ export declare function signEnvelope(envelope: SignatureEnvelope, privateKeyBase
13
13
  * Check order is deliberate and produces better diagnostics than the
14
14
  * reverse: authenticate the envelope FIRST (bad-signature = forged or
15
15
  * corrupt), then compare it to the artifact we actually have
16
- * (hash-mismatch = authentic envelope, tampered bytes — the flipped-byte
16
+ * (hash-mismatch = authentic envelope, tampered bytes: the flipped-byte
17
17
  * case). Never throws.
18
18
  */
19
19
  export declare function verifyEnvelope(sidecar: unknown, tarballSha256: string, trustedKeys: TrustedKey[]): VerifyResult;
@@ -20,7 +20,7 @@ export function generateSigningKeyPair() {
20
20
  const publicKey = pair.publicKey.export({ format: "der", type: "spki" }).toString("base64");
21
21
  return { privateKey, publicKey, keyId: deriveKeyId(publicKey) };
22
22
  }
23
- /** Deterministic serialization. Deliberately NOT full JCS — we own both
23
+ /** Deterministic serialization. Deliberately NOT full JCS, since we own both
24
24
  * ends, and a fixed-order literal is the entire requirement. */
25
25
  export function canonicalizeEnvelope(envelope) {
26
26
  return Buffer.from(JSON.stringify({
@@ -60,7 +60,7 @@ function isSidecar(value) {
60
60
  * Check order is deliberate and produces better diagnostics than the
61
61
  * reverse: authenticate the envelope FIRST (bad-signature = forged or
62
62
  * corrupt), then compare it to the artifact we actually have
63
- * (hash-mismatch = authentic envelope, tampered bytes — the flipped-byte
63
+ * (hash-mismatch = authentic envelope, tampered bytes: the flipped-byte
64
64
  * case). Never throws.
65
65
  */
66
66
  export function verifyEnvelope(sidecar, tarballSha256, trustedKeys) {
@@ -14,7 +14,7 @@ export declare const ENTRY_NAME_MAX = 260;
14
14
  /** The most segments, folders and a file, one name may have. */
15
15
  export declare const ENTRY_SEGMENTS_MAX = 32;
16
16
  /** Pure gate over one entry's (path, type, declaredSize). Returns the
17
- * violation message or null. Exported for direct unit testing — a
17
+ * violation message or null. Exported for direct unit testing: a
18
18
  * well-formed writer can't produce hostile names, but attackers hand-craft
19
19
  * archives directly. The path rules are nameViolation's: what a Linux
20
20
  * extraction and a Windows or macOS one would read as different files is
@@ -24,7 +24,7 @@ export declare const ENTRY_SEGMENTS_MAX = 32;
24
24
  * "OldFile" and "ContiguousFile" are accepted alongside "File" for
25
25
  * historical (tar-era) compatibility with entries this gate has always
26
26
  * allowed; the ZIP reader below only ever derives "File" or "Directory"
27
- * for an entry, so those two never occur in practice post-migration — the
27
+ * for an entry, so those two never occur in practice post-migration: the
28
28
  * allow-list simply isn't narrowed, since narrowing it wouldn't change zip
29
29
  * behavior and would only risk breaking direct callers of this exported
30
30
  * function. */
@@ -114,7 +114,7 @@ export declare function plannedEntryRefusal(entries: readonly PlannedEntry[]): s
114
114
  * written to disk incrementally as the archive streams in, so anything
115
115
  * admitted before the violation was detected is already sitting under
116
116
  * `targetDir`. Callers MUST treat `{ ok: false }` as fatal and delete
117
- * `targetDir` themselves — this function does not roll back a partial
117
+ * `targetDir` themselves. This function does not roll back a partial
118
118
  * extraction.
119
119
  */
120
120
  export declare function extractArtifact(archivePath: string, targetDir: string): Promise<{
@@ -81,7 +81,7 @@ function nameViolation(path) {
81
81
  return null;
82
82
  }
83
83
  /** Pure gate over one entry's (path, type, declaredSize). Returns the
84
- * violation message or null. Exported for direct unit testing — a
84
+ * violation message or null. Exported for direct unit testing: a
85
85
  * well-formed writer can't produce hostile names, but attackers hand-craft
86
86
  * archives directly. The path rules are nameViolation's: what a Linux
87
87
  * extraction and a Windows or macOS one would read as different files is
@@ -91,7 +91,7 @@ function nameViolation(path) {
91
91
  * "OldFile" and "ContiguousFile" are accepted alongside "File" for
92
92
  * historical (tar-era) compatibility with entries this gate has always
93
93
  * allowed; the ZIP reader below only ever derives "File" or "Directory"
94
- * for an entry, so those two never occur in practice post-migration — the
94
+ * for an entry, so those two never occur in practice post-migration: the
95
95
  * allow-list simply isn't narrowed, since narrowing it wouldn't change zip
96
96
  * behavior and would only risk breaking direct callers of this exported
97
97
  * function. */
@@ -268,14 +268,14 @@ export function plannedEntryRefusal(entries) {
268
268
  * written to disk incrementally as the archive streams in, so anything
269
269
  * admitted before the violation was detected is already sitting under
270
270
  * `targetDir`. Callers MUST treat `{ ok: false }` as fatal and delete
271
- * `targetDir` themselves — this function does not roll back a partial
271
+ * `targetDir` themselves. This function does not roll back a partial
272
272
  * extraction.
273
273
  */
274
274
  export function extractArtifact(archivePath, targetDir) {
275
275
  return new Promise((resolve) => {
276
276
  // Guards resolve() against firing twice (e.g. a stray 'readEntry'
277
- // continuation racing an already-settled violation). Harmless —
278
- // Promise settlement is idempotent regardless — but noted since it's
277
+ // continuation racing an already-settled violation). Harmless:
278
+ // Promise settlement is idempotent regardless, but noted since it's
279
279
  // not load-bearing for the contract, just defensive.
280
280
  let settled = false;
281
281
  const settle = (value) => {
@@ -292,7 +292,7 @@ export function extractArtifact(archivePath, targetDir) {
292
292
  return;
293
293
  }
294
294
  const resolvedTargetDir = resolvePath(targetDir);
295
- // decodeStrings: false — yauzl's own string decoding path runs its own
295
+ // decodeStrings: false: yauzl's own string decoding path runs its own
296
296
  // absolute-path/".."/backslash filename validation before ever emitting
297
297
  // an 'entry' event, and rejects by emitting 'error' on the whole
298
298
  // zipfile with its own message text. That would make yauzl's built-in
@@ -308,7 +308,7 @@ export function extractArtifact(archivePath, targetDir) {
308
308
  }
309
309
  // Fast upfront rejection: ZIP's central directory declares its entry
310
310
  // count in the end-of-central-directory record, read during open()
311
- // itself — unlike tar's PAX/meta-entry bypass, there is no way for a
311
+ // itself, unlike tar's PAX/meta-entry bypass, there is no way for a
312
312
  // zip to hide entries from this count (yauzl only ever iterates
313
313
  // exactly this many central directory records). Checking it here
314
314
  // means a too-many-entries archive is rejected before writing a
@@ -342,7 +342,7 @@ export function extractArtifact(archivePath, targetDir) {
342
342
  // This is an assertion, not a second gate: entryViolation (inside the
343
343
  // gate) already rejects a leading "/" or "\\", a drive letter, and any
344
344
  // ".." segment, so resolving fileName against targetDir can never
345
- // land outside it — this branch must be unreachable. It stays
345
+ // land outside it: this branch must be unreachable. It stays
346
346
  // because it is a two-line check against the one failure mode
347
347
  // (zip-slip) that would actually write files outside targetDir, so
348
348
  // the cost of keeping it is negligible next to what a silent
@@ -352,7 +352,7 @@ export function extractArtifact(archivePath, targetDir) {
352
352
  fail(`unsafe entry path ${quoteEntryName(fileName)}`);
353
353
  return;
354
354
  }
355
- // The filesystem calls below can throw — most concretely EEXIST
355
+ // The filesystem calls below can throw, most concretely EEXIST
356
356
  // from mkdirSync when a hostile or malformed archive declares a
357
357
  // file entry and a directory entry at the same path (e.g. "a" then
358
358
  // "a/b", or a directory entry "a/" arriving after a file "a"). An
@@ -1,4 +1,4 @@
1
- /** One definition of "the artifact's hash" for signer and verifier alike —
1
+ /** One definition of "the artifact's hash" for signer and verifier alike:
2
2
  * the same value S126 records as PluginVersion.artifactSha256. */
3
3
  export declare function hashBuffer(buffer: Buffer): string;
4
4
  export declare function hashArchive(path: string): Promise<string>;
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { createReadStream } from "node:fs";
3
3
  import { readdir, readFile, stat } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
- /** One definition of "the artifact's hash" for signer and verifier alike —
5
+ /** One definition of "the artifact's hash" for signer and verifier alike:
6
6
  * the same value S126 records as PluginVersion.artifactSha256. */
7
7
  export function hashBuffer(buffer) {
8
8
  return createHash("sha256").update(buffer).digest("hex");
@@ -21,14 +21,14 @@ export type PackageContractResult = PackageContractCheck & {
21
21
  warnings: string[];
22
22
  };
23
23
  /**
24
- * <dir>/README.md must exist and contain something other than whitespace —
24
+ * <dir>/README.md must exist and contain something other than whitespace:
25
25
  * a file that exists but says nothing is worse than none: it would render
26
26
  * as a blank listing description in the marketplace.
27
27
  */
28
28
  export declare function checkReadmeContract(dir: string): PackageContractCheck;
29
29
  /**
30
30
  * <dir>/marketplace/cover.png must exist, be a real PNG, and be exactly
31
- * COVER_WIDTH x COVER_HEIGHT — the marketplace grid renders every listing's
31
+ * COVER_WIDTH x COVER_HEIGHT: the marketplace grid renders every listing's
32
32
  * cover at a fixed aspect, so anything else would be cropped or distorted.
33
33
  * The failure reason names both the required size and the size found,
34
34
  * since "wrong size" without the numbers makes a developer guess.
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { capViolations, checkDocsContract, isFile, readDocsContractInput } from "./docs-contract.js";
4
- // S206 Task 4: the marketplace-listing contract — a non-empty README.md
4
+ // S206 Task 4: the marketplace-listing contract: a non-empty README.md
5
5
  // plus a fixed-size cover image: used to live only in kardalum plugin's CLI
6
6
  // (packages/cli/src/plugin/checks/package-contract.ts), a dev-machine
7
7
  // package apps/server can't import from. Moved here because
@@ -9,13 +9,13 @@ import { capViolations, checkDocsContract, isFile, readDocsContractInput } from
9
9
  // AND kardalum plugin all already depend on: one implementation, no second
10
10
  // place to keep in sync. kardalum plugin's checks/package-contract.ts now
11
11
  // delegates to checkReadmeContract/checkCoverContract below rather than
12
- // keeping its own copy — see that file for why its two exports keep their
12
+ // keeping its own copy; see that file for why its two exports keep their
13
13
  // original names, CheckResult shape, and exact failure messages (its own
14
14
  // tests, and `kardalum plugin validate`'s output, depend on them).
15
15
  //
16
16
  // checkPackageContract is the door-level gate: the server's upload route
17
17
  // (apps/server/src/routes/plugin-upload.ts) just needs "does this package
18
- // qualify, and if not, why" — it has no use for which of the two rules
18
+ // qualify, and if not, why"; it has no use for which of the two rules
19
19
  // failed independently the way kardalum plugin's per-check report does.
20
20
  export const COVER_PATH = "marketplace/cover.png";
21
21
  export const COVER_WIDTH = 1200;
@@ -33,7 +33,7 @@ function fail(reasons) {
33
33
  return { ok: false, reason: reasons[0], reasons };
34
34
  }
35
35
  /**
36
- * <dir>/README.md must exist and contain something other than whitespace —
36
+ * <dir>/README.md must exist and contain something other than whitespace:
37
37
  * a file that exists but says nothing is worse than none: it would render
38
38
  * as a blank listing description in the marketplace.
39
39
  */
@@ -54,7 +54,7 @@ export function checkReadmeContract(dir) {
54
54
  }
55
55
  /**
56
56
  * <dir>/marketplace/cover.png must exist, be a real PNG, and be exactly
57
- * COVER_WIDTH x COVER_HEIGHT — the marketplace grid renders every listing's
57
+ * COVER_WIDTH x COVER_HEIGHT: the marketplace grid renders every listing's
58
58
  * cover at a fixed aspect, so anything else would be cropped or distorted.
59
59
  * The failure reason names both the required size and the size found,
60
60
  * since "wrong size" without the numbers makes a developer guess.
@@ -1,4 +1,4 @@
1
- /** The signed payload. Field order here is normative — canonicalizeEnvelope
1
+ /** The signed payload. Field order here is normative: canonicalizeEnvelope
2
2
  * serializes in exactly this order, and signer and verifier must agree byte
3
3
  * for byte. */
4
4
  export interface SignatureEnvelope {
@@ -4,7 +4,7 @@ declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
4
4
  declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
5
  declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
6
6
  declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
7
- declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
7
+ declare function AlertDialogContent({ className, children, ref, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
8
8
  declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
9
9
  declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
10
10
  declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
3
  import { cn } from '../lib/cn.js';
4
+ import { useMenuHost } from '../lib/menu-host.js';
5
+ import { DropdownMenuContainer } from './dropdown-menu.js';
4
6
  import { buttonVariants } from './button.js';
5
7
  // Ported from shadcn/ui's AlertDialog (Radix under the hood), retargeted
6
8
  // to @kardalum/design-tokens classes, no tailwindcss-animate dependency,
7
- // and no owned strings — title/description/action labels all come from
9
+ // and no owned strings: title/description/action labels all come from
8
10
  // the caller. For consequential confirmations (snapshot restore, future
9
11
  // destructive flows); Radix provides the focus trap, escape handling,
10
12
  // and aria wiring.
@@ -14,8 +16,11 @@ const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
16
  function AlertDialogOverlay({ className, ...props }) {
15
17
  return (_jsx(AlertDialogPrimitive.Overlay, { className: cn('fixed inset-0 z-50 bg-background-overlay', className), ...props }));
16
18
  }
17
- function AlertDialogContent({ className, ...props }) {
18
- return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { className: cn('fixed start-1/2 top-1/2 z-50 w-full max-w-lg -translate-y-1/2 ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl', className), ...props })] }));
19
+ // S356: each modal surface hosts its own menus (see lib/menu-host.ts).
20
+ function AlertDialogContent({ className, children, ref, ...props }) {
21
+ const menuHost = useMenuHost(ref);
22
+ const host = menuHost.host;
23
+ return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { className: cn('fixed start-1/2 top-1/2 z-50 w-full max-w-lg -translate-y-1/2 ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl', className), ...props, ref: menuHost.ref, children: _jsx(DropdownMenuContainer, { container: host, children: children }) })] }));
19
24
  }
20
25
  function AlertDialogHeader({ className, ...props }) {
21
26
  return _jsx("div", { className: cn('flex flex-col gap-2 text-start', className), ...props });
@@ -3,7 +3,7 @@ import { cva } from 'class-variance-authority';
3
3
  import { cn } from '../lib/cn.js';
4
4
  // Status pill (Draft/Published/…). Soft style: 100-step fill + the
5
5
  // lightest text step that clears AA on that fill (S179: success/danger
6
- // 700, warning 800 — plain 600 measured 3.1–4.3:1, below the 4.5:1
6
+ // 700, warning 800; plain 600 measured 3.1–4.3:1, below the 4.5:1
7
7
  // minimum). Both steps are theme-remapped by the dark set, so the pill
8
8
  // stays readable in both themes without per-variant juggling. The
9
9
  // `primary` variant is the exception: it's an identity chip (role badges,
@@ -10,7 +10,7 @@ const buttonVariants = cva('inline-flex items-center justify-center gap-2 whites
10
10
  variants: {
11
11
  variant: {
12
12
  // Action = primary-600 (S177): cerulean in light, the light blue
13
- // itself in dark — text.inverse flips with it.
13
+ // itself in dark, text.inverse flips with it.
14
14
  default: 'bg-primary-600 text-text-inverse hover:bg-primary-700',
15
15
  secondary: 'bg-secondary-500 text-text-inverse hover:bg-secondary-600',
16
16
  destructive: 'bg-danger-600 text-text-inverse hover:bg-danger-700',
@@ -5,7 +5,7 @@ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.Dia
5
5
  declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
6
  declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
7
7
  declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
8
- declare function DialogContent({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>): React.JSX.Element;
8
+ declare function DialogContent({ className, children, ref, onOpenAutoFocus, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>): React.JSX.Element;
9
9
  declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
10
10
  declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
11
  declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
@@ -1,9 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as DialogPrimitive from '@radix-ui/react-dialog';
3
3
  import { cn } from '../lib/cn.js';
4
+ import { IconTooltip } from './tooltip.js';
5
+ import { useMenuHost } from '../lib/menu-host.js';
6
+ import { DropdownMenuContainer } from './dropdown-menu.js';
4
7
  // Hand-ported from shadcn/ui's Dialog (Radix under the hood), retargeted to
5
8
  // @kardalum/design-tokens classes, no tailwindcss-animate dependency, and
6
- // no owned strings — title/description/close labels all come from the
9
+ // no owned strings: title/description/close labels all come from the
7
10
  // caller, same convention as AlertDialog. Radix supplies the focus trap,
8
11
  // Escape handling, and aria wiring; `onCloseAutoFocus` on DialogContent is
9
12
  // how a caller returns focus to its trigger (see the admin UI conventions).
@@ -30,8 +33,50 @@ function DialogOverlay({ className, ...props }) {
30
33
  // and never reaches this scrollbar, while a caller that does nothing still
31
34
  // gets a reachable footer. 460px, the height a 920px screen gives at 200%
32
35
  // browser zoom, is the case this is measured against (WCAG 1.4.4).
33
- function DialogContent({ className, ...props }) {
34
- return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogPrimitive.Content, { "aria-modal": "true", className: cn('fixed start-1/2 top-1/2 z-50 max-h-[calc(100dvh_-_var(--spacing-8))] w-full max-w-lg -translate-y-1/2 overflow-y-auto ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl', className), ...props })] }));
36
+ // S356: each modal surface hosts its own menus (see lib/menu-host.ts).
37
+ //
38
+ // S366c spec D6: a dialog opens on its first field (an input, select,
39
+ // textarea or editable region that takes focus), where the person's task
40
+ // starts. A dialog with none opens on the content itself (tabIndex -1), so no
41
+ // control, and no Close tooltip, is announced on every open. A caller's own
42
+ // onOpenAutoFocus runs first; one that prevents the default keeps control.
43
+ const FIRST_FIELD = 'input, select, textarea, [contenteditable="true"], [contenteditable=""]';
44
+ function fieldCandidates(content) {
45
+ const found = [];
46
+ for (const element of content.querySelectorAll(FIRST_FIELD)) {
47
+ if (element instanceof HTMLInputElement && element.type === 'hidden')
48
+ continue;
49
+ if (element.disabled === true)
50
+ continue;
51
+ if (element.closest('[hidden], [inert], [aria-hidden="true"]') !== null)
52
+ continue;
53
+ found.push(element);
54
+ }
55
+ return found;
56
+ }
57
+ // A field hidden by CSS cannot take focus, so each candidate is tried in order
58
+ // and the first that holds it wins; none, and the dialog itself takes it.
59
+ function focusFirstField(content) {
60
+ for (const element of fieldCandidates(content)) {
61
+ element.focus({ preventScroll: true });
62
+ if (document.activeElement === element)
63
+ return;
64
+ }
65
+ content.focus({ preventScroll: true });
66
+ }
67
+ function DialogContent({ className, children, ref, onOpenAutoFocus, ...props }) {
68
+ const menuHost = useMenuHost(ref);
69
+ const host = menuHost.host;
70
+ return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogPrimitive.Content, { "aria-modal": "true", tabIndex: -1, onOpenAutoFocus: (event) => {
71
+ onOpenAutoFocus?.(event);
72
+ if (event.defaultPrevented)
73
+ return;
74
+ const content = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;
75
+ if (content === null)
76
+ return;
77
+ event.preventDefault();
78
+ focusFirstField(content);
79
+ }, className: cn('fixed start-1/2 top-1/2 z-50 max-h-[calc(100dvh_-_var(--spacing-8))] w-full max-w-lg focus:outline-hidden -translate-y-1/2 overflow-y-auto ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl', className), ...props, ref: menuHost.ref, children: _jsx(DropdownMenuContainer, { container: host, children: children }) })] }));
35
80
  }
36
81
  function DialogHeader({ className, ...props }) {
37
82
  return (_jsx("div", { className: cn('flex items-center gap-2 text-start', className), ...props }));
@@ -46,6 +91,6 @@ function DialogDescription({ className, ...props }) {
46
91
  return (_jsx(DialogPrimitive.Description, { className: cn('text-sm text-text-secondary', className), ...props }));
47
92
  }
48
93
  function DialogCloseButton({ className, ...props }) {
49
- return (_jsx(DialogPrimitive.Close, { className: cn('ms-auto shrink-0 rounded-md p-1 text-text-secondary opacity-70 transition-colors duration-fast hover:bg-background-hover hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600', className), ...props, children: _jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "h-4 w-4", children: [_jsx("path", { d: "M18 6 6 18" }), _jsx("path", { d: "m6 6 12 12" })] }) }));
94
+ return (_jsx(IconTooltip, { children: _jsx(DialogPrimitive.Close, { className: cn('ms-auto shrink-0 rounded-md p-1 text-text-secondary opacity-70 transition-colors duration-fast hover:bg-background-hover hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600', className), ...props, children: _jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "h-4 w-4", children: [_jsx("path", { d: "M18 6 6 18" }), _jsx("path", { d: "m6 6 12 12" })] }) }) }));
50
95
  }
51
96
  export { Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogClose, DialogCloseButton, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
3
  declare function DropdownMenu({ modal, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
4
+ declare function DropdownMenuContainer({ container, children, }: {
5
+ container: HTMLElement | null;
6
+ children: React.ReactNode;
7
+ }): React.JSX.Element;
4
8
  declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
9
  declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
6
10
  declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
@@ -15,4 +19,4 @@ declare function DropdownMenuLabel({ className, inset, ...props }: React.Compone
15
19
  inset?: boolean;
16
20
  }): React.JSX.Element;
17
21
  declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
18
- export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
22
+ export { DropdownMenu, DropdownMenuContainer, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
2
3
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
4
  import { cn } from '../lib/cn.js';
4
5
  // Ported from shadcn/ui's DropdownMenu (Radix under the hood), retargeted
@@ -12,13 +13,13 @@ import { cn } from '../lib/cn.js';
12
13
  //
13
14
  // 1. It marks the rest of the page `aria-hidden="true"` while the menu is
14
15
  // open, leaving every focusable control on the screen inside an
15
- // aria-hidden subtree — a genuine 4.1.2 failure, which axe reports as
16
+ // aria-hidden subtree, which is a genuine 4.1.2 failure that axe reports as
16
17
  // `aria-hidden-focus`.
17
18
  // 2. It locks `pointer-events: none` onto <body>. When a menu item opens
18
19
  // a dialog (the tree row's ⋯ → Delete), the menu's layer and the
19
20
  // dialog's layer both own that lock; the menu unmounts first, the
20
21
  // dialog restores the value the menu had already set, and closing the
21
- // dialog leaves `pointer-events: none` on <body> permanently — the
22
+ // dialog leaves `pointer-events: none` on <body> permanently: the
22
23
  // entire admin stops responding to the mouse until a page reload.
23
24
  //
24
25
  // Non-modal is also what the WAI-ARIA menu button pattern describes: Tab
@@ -27,17 +28,29 @@ import { cn } from '../lib/cn.js';
27
28
  function DropdownMenu({ modal = false, ...props }) {
28
29
  return _jsx(DropdownMenuPrimitive.Root, { modal: modal, ...props });
29
30
  }
31
+ // S356 (D5): where a menu's content mounts. A surface that traps focus (the
32
+ // admin's phone tree sheet, a modal Radix Dialog) keeps focus inside its own
33
+ // DOM, so a menu portalled to <body> from inside it has its focus pulled back
34
+ // and dismisses itself at once. Such a surface names its element here, and
35
+ // every menu rendered inside it mounts there instead; outside one, menus
36
+ // mount on <body> as before. Non-modal is unchanged: this is about where the
37
+ // content lives, not about the menu's own modality.
38
+ const DropdownMenuContainerContext = React.createContext(null);
39
+ function DropdownMenuContainer({ container, children, }) {
40
+ return _jsx(DropdownMenuContainerContext.Provider, { value: container, children: children });
41
+ }
30
42
  const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
31
43
  const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
32
44
  const DropdownMenuGroup = DropdownMenuPrimitive.Group;
33
45
  const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
34
- // Radio item with a check indicator at the inline start — the shape a
46
+ // Radio item with a check indicator at the inline start: the shape a
35
47
  // "pick one" preference (theme mode, language) takes inside a menu.
36
48
  function DropdownMenuRadioItem({ className, children, ...props }) {
37
49
  return (_jsxs(DropdownMenuPrimitive.RadioItem, { className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm py-2 pe-2 ps-8 text-sm text-text-primary outline-hidden transition-colors data-[highlighted]:bg-background-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), ...props, children: [_jsx("span", { className: "absolute start-2 flex size-4 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "size-4 text-primary-600", children: _jsx("path", { d: "M20 6 9 17l-5-5" }) }) }) }), children] }));
38
50
  }
39
51
  function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
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 }) }));
52
+ const container = React.useContext(DropdownMenuContainerContext);
53
+ return (_jsx(DropdownMenuPrimitive.Portal, { container: container ?? undefined, 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
54
  }
42
55
  function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
43
56
  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-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50', variant === 'destructive'
@@ -50,4 +63,4 @@ function DropdownMenuLabel({ className, inset, ...props }) {
50
63
  function DropdownMenuSeparator({ className, ...props }) {
51
64
  return (_jsx(DropdownMenuPrimitive.Separator, { className: cn('-mx-1 my-1 h-px bg-border-default', className), ...props }));
52
65
  }
53
- export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
66
+ export { DropdownMenu, DropdownMenuContainer, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
@@ -1,15 +1,15 @@
1
1
  import * as React from 'react';
2
2
  export interface EmptyStateProps extends React.ComponentProps<'div'> {
3
- /** Icon element (e.g. a lucide icon) — sized/colored by the caller. */
3
+ /** Icon element (e.g. a lucide icon), sized/colored by the caller. */
4
4
  icon?: React.ReactNode;
5
- /** Translated title — this component owns no strings. */
5
+ /** Translated title: this component owns no strings. */
6
6
  title: string;
7
7
  /** Optional translated supporting text. */
8
8
  description?: string;
9
9
  /** Optional primary action (usually a Button). */
10
10
  action?: React.ReactNode;
11
11
  /**
12
- * Element used for the title — a paragraph by default, because most
12
+ * Element used for the title, a paragraph by default, because most
13
13
  * empty states sit *inside* a screen that already owns its <h1>.
14
14
  * Where the empty state IS the whole screen (the unmatched-route view,
15
15
  * a section's "nothing selected yet" landing), pass a heading so the
@@ -17,7 +17,7 @@ export interface EmptyStateProps extends React.ComponentProps<'div'> {
17
17
  */
18
18
  titleAs?: 'p' | 'h1' | 'h2' | 'h3';
19
19
  /**
20
- * Extra props for the title element — the host app uses this to mark a
20
+ * Extra props for the title element: the host app uses this to mark a
21
21
  * screen-level title as its focus target on navigation. Kept as a
22
22
  * pass-through so this primitive stays ignorant of the shell's
23
23
  * conventions.
@@ -1,6 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from '../lib/cn.js';
3
3
  function Input({ className, type, ...props }) {
4
- return (_jsx("input", { type: type, "data-slot": "input", className: cn('flex h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-disabled file:border-0 file:bg-transparent file:text-sm file:font-medium file: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', className), ...props }));
4
+ return (_jsx("input", { type: type, "data-slot": "input", className: cn(
5
+ // S354 (D1): the placeholder is text-tertiary on background-elevated,
6
+ // 5.64:1 light (#616966 on #FFFFFF) and 5.46:1 dark (#969C99 on
7
+ // #232625), above AA's 4.5:1. It was text-disabled, 3.11:1 and
8
+ // 3.25:1; the site's Input (packages/site-ui) moved the same way in S256.
9
+ 'flex h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary file:border-0 file:bg-transparent file:text-sm file:font-medium file: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', className), ...props }));
5
10
  }
6
11
  export { Input };