@hjmds/react 1.33.1 → 1.33.2

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.
@@ -34,7 +34,7 @@ export type ReactRendererEvidenceManifest = Readonly<{
34
34
  export declare const reactRendererEvidence: {
35
35
  readonly schemaVersion: 2;
36
36
  readonly packageName: "@hjmds/react";
37
- readonly packageVersion: "1.33.1";
37
+ readonly packageVersion: "1.33.2";
38
38
  readonly surface: "web";
39
39
  readonly components: Readonly<{
40
40
  /** Canonical component id from the design-contracts catalog. */
package/dist/evidence.js CHANGED
@@ -134,7 +134,7 @@ const activeWebEntries = componentCatalog.filter((entry) => {
134
134
  export const reactRendererEvidence = {
135
135
  schemaVersion: reactRendererEvidenceSchemaVersion,
136
136
  packageName: "@hjmds/react",
137
- packageVersion: "1.33.1",
137
+ packageVersion: "1.33.2",
138
138
  surface: "web",
139
139
  components: activeWebEntries.map(derivedClaim),
140
140
  };
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,yBAAyB,EAA8B,MAAM,iCAAiC,CAAC;AACzI,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAU,CAAC;AA6B7D,MAAM,gBAAgB,GAAG,kCAA2C,CAAC;AACrE,MAAM,eAAe,GAAG,uCAAgD,CAAC;AACzE,MAAM,mBAAmB,GAAG,mCAA4C,CAAC;AAIzE;;;;;GAKG;AACH,MAAM,eAAe,GAAuE,EAAE,CAAC;AAc/F,MAAM,QAAQ,GAAG,CAAC,OAAkB,mBAAmB,EAAe,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,I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,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;QACnG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;KACnE,CAAC;IACF,OAAO;QACL,WAAW;QACX,WAAW;QACX,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;QACrD,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,gBAAgB,GAAqC,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3F,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,MAAM,CAAC;AAClD,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,aAAa,EAAE,kCAAkC;IACjD,WAAW,EAAE,cAAc;IAC3B,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,YAAY,CAAC;CACE,CAAC","sourcesContent":["import type { ShowcaseScenarioId } from \"@hjmds/design-contracts/showcase\";\nimport { getRequiredShowcaseEvidence } from \"@hjmds/design-contracts/showcase\";\nimport { componentCatalog, componentIdOf, getComponentSurfaceStatus, type ComponentCatalogEntry } from \"@hjmds/design-contracts/catalog\";\nimport { publicExportEntries } from \"./public-exports.generated.js\";\n\nexport const reactRendererEvidenceSchemaVersion = 2 as const;\n\nexport type ReactRendererEvidenceScenario = Exclude<ShowcaseScenarioId, \"contract\" | \"native-actions\">;\n\nexport type ReactRendererEvidenceComponent = Readonly<{\n /** Canonical component id from the design-contracts catalog. */\n componentId: string;\n /** Public symbols that implement this contract on the declared subpath. */\n exportNames: readonly string[];\n /** Granular @hjmds/react export used by consumers. */\n subpath: `./${string}`;\n /** Scenarios supported by automated first-party renderer evidence. */\n scenarios: readonly ReactRendererEvidenceScenario[];\n /** Repository-local executable proof for every claimed scenario. */\n proofs: readonly Readonly<{\n scenarios: readonly ReactRendererEvidenceScenario[];\n file: `test/${string}.test.tsx`;\n caseId: string;\n }>[];\n}>;\n\nexport type ReactRendererEvidenceManifest = Readonly<{\n schemaVersion: typeof reactRendererEvidenceSchemaVersion;\n packageName: \"@hjmds/react\";\n packageVersion: string;\n surface: \"web\";\n components: readonly ReactRendererEvidenceComponent[];\n}>;\n\nconst defaultProofFile = \"test/default-render.ssr.test.tsx\" as const;\nconst matrixProofFile = \"test/scenario-matrix.browser.test.tsx\" as const;\nconst stableCoreProofFile = \"test/stable-core.browser.test.tsx\" as const;\n\ntype ProofFile = `test/${string}.test.tsx`;\n\n/**\n * Scenarios a component does not pass yet. Each entry is promotion debt that\n * the generated evidence projection reports; remove it when the component is\n * fixed and the matrix case passes. Stable surfaces cannot carry a gap\n * (scripts/check-workspace-sync.mjs).\n */\nconst webScenarioGaps: Readonly<Record<string, readonly ReactRendererEvidenceScenario[]>> = {};\n\n/**\n * Proofs that live outside the shared default/matrix files: keyboard behavior in a dedicated browser test,\n * long copy proven inside a portal by the component's own test, or a whole matrix run in a component file.\n * Everything else about a claim derives from the catalog row (2026-10-18 registration input).\n */\ntype ClaimExtras = Readonly<{\n /** Extra proofs; their scenarios are removed from the shared matrix proof. */\n proofs?: readonly Readonly<{ scenarios: readonly ReactRendererEvidenceScenario[]; file: ProofFile }>[];\n /** Hooks or helpers published beside the component symbols on the same subpath. */\n exportNames?: readonly string[];\n}>;\n\nconst keyboard = (file: ProofFile = stableCoreProofFile): ClaimExtras => ({ proofs: [{ scenarios: [\"keyboard\"], file }] });\nconst keyboardAndLongCopy = (file: ProofFile): ClaimExtras => ({ proofs: [{ scenarios: [\"keyboard\", \"long-copy\"], file }] });\n\nconst claimExtras: Readonly<Record<string, ClaimExtras>> = {\n \"design-system-provider\": { exportNames: [\"useHjmTheme\"] },\n layout: keyboard(),\n link: keyboard(),\n field: keyboard(),\n \"search-field\": keyboard(),\n \"password-field\": keyboard(),\n \"otp-field\": keyboard(),\n \"number-field\": keyboard(),\n slider: keyboard(),\n form: keyboard(\"test/form.keyboard.browser.test.tsx\"),\n \"date-picker\": keyboard(),\n calendar: keyboard(\"test/calendar.browser.test.tsx\"),\n \"file-picker\": keyboard(\"test/file-picker.keyboard.browser.test.tsx\"),\n checkbox: keyboard(),\n \"checkbox-group\": keyboard(),\n \"radio-group\": keyboard(),\n switch: keyboard(),\n \"segmented-control\": keyboard(),\n chip: keyboard(),\n tabs: keyboard(\"test/tabs.keyboard.browser.test.tsx\"),\n breadcrumb: keyboard(\"test/page-navigation.browser.test.tsx\"),\n pagination: keyboard(\"test/pagination.keyboard.browser.test.tsx\"),\n popover: keyboardAndLongCopy(\"test/popover.browser.test.tsx\"),\n \"side-panel\": keyboardAndLongCopy(\"test/side-panel.browser.test.tsx\"),\n splitter: keyboard(\"test/splitter.browser.test.tsx\"),\n tour: keyboardAndLongCopy(\"test/tour.browser.test.tsx\"),\n tree: keyboard(\"test/tree.browser.test.tsx\"),\n \"transfer-list\": keyboard(\"test/transfer-list.browser.test.tsx\"),\n mentions: keyboard(\"test/mentions.browser.test.tsx\"),\n \"command-palette\": keyboardAndLongCopy(\"test/command-palette.browser.test.tsx\"),\n agreement: keyboard(\"test/agreement.keyboard.browser.test.tsx\"),\n \"toggle-group\": keyboard(),\n \"tags-input\": keyboard(),\n \"skip-nav\": keyboardAndLongCopy(\"test/skip-nav.browser.test.tsx\"),\n sidebar: keyboard(\"test/sidebar.browser.test.tsx\"),\n \"date-range-picker\": keyboard(\"test/date-range.keyboard.browser.test.tsx\"),\n \"auth-provider-button\": keyboard(),\n \"data-table\": keyboard(\"test/data-table.keyboard.browser.test.tsx\"),\n collapsible: keyboard(\"test/collapsible.keyboard.browser.test.tsx\"),\n \"context-menu\": keyboardAndLongCopy(\"test/context-menu.interactions.browser.test.tsx\"),\n menubar: keyboard(\"test/menubar.keyboard.browser.test.tsx\"),\n anchor: keyboard(\"test/anchor.browser.test.tsx\"),\n \"bottom-navigation\": keyboard(\"test/bottom-navigation.keyboard.browser.test.tsx\"),\n \"load-more\": keyboard(\"test/load-more.interactions.browser.test.tsx\"),\n carousel: keyboard(\"test/carousel.browser.test.tsx\"),\n \"floating-action-button\": keyboard(),\n accordion: keyboard(\"test/accordion.keyboard.browser.test.tsx\"),\n \"upload-item\": keyboard(\"test/upload-item.browser.test.tsx\"),\n // ThinkingOrb runs its whole environment matrix in its own file (canvas timing), not in scenario-matrix.\n \"thinking-orb\": { proofs: [{ scenarios: [\"dark\", \"large-text\", \"rtl\", \"reduced-motion\", \"accessibility\"], file: \"test/thinking-orb.browser.test.tsx\" }] },\n \"color-picker\": keyboard(\"test/web-additions.browser.test.tsx\"),\n // SSR proves semantics but cannot catch the close-only row seen in BurnTok.\n // Keep real geometry evidence attached without promoting catalog maturity.\n toast: {\n exportNames: [\"useToast\"],\n proofs: [\n { scenarios: [\"keyboard\"], file: stableCoreProofFile },\n { scenarios: [\"dark\", \"long-copy\", \"large-text\", \"rtl\"], file: \"test/toast-layout.browser.test.tsx\" },\n ],\n },\n select: keyboard(),\n combobox: keyboard(),\n dialog: keyboard(\"test/advanced.browser.test.tsx\"),\n \"alert-dialog\": keyboardAndLongCopy(\"test/alert-dialog.keyboard.browser.test.tsx\"),\n sheet: keyboardAndLongCopy(\"test/sheet-layout.browser.test.tsx\"),\n tooltip: keyboard(\"test/tooltip.browser.test.tsx\"),\n menu: keyboardAndLongCopy(\"test/menu.keyboard.browser.test.tsx\"),\n};\n\nconst exportEntries: Readonly<Record<string, readonly `./${string}`[] | undefined>> = publicExportEntries;\n\n/**\n * One claim per active Web row of the catalog. The subpath is the symbol's canonical granular entry, the export\n * names are the row's own symbol plus the companions published on that entry, and the scenarios are the row's\n * required Web evidence minus recorded gaps. Keyboard is never implied: it comes only from a dedicated proof.\n */\nfunction derivedClaim(entry: ComponentCatalogEntry): ReactRendererEvidenceComponent {\n const componentId = componentIdOf(entry);\n const extras = claimExtras[componentId] ?? {};\n const symbols = entry.name === \"DesignSystemProvider\" ? [\"HjmProvider\"] : [entry.name, ...(entry.companions ?? [])];\n // A row whose own name is not a symbol (Chart) claims through its first published companion.\n const subpath = symbols.map((symbol) => exportEntries[symbol]?.[0]).find((entry) => entry !== undefined);\n if (!subpath) throw new Error(`${entry.name} has no granular @hjmds/react export to claim evidence on`);\n const exportNames = [\n ...symbols.filter((symbol) => exportEntries[symbol]?.includes(subpath)),\n ...(extras.exportNames ?? []),\n ];\n const required = getRequiredShowcaseEvidence(entry).find((evidence) => evidence.surface === \"web\")?.scenarios ?? [];\n const gaps = webScenarioGaps[componentId] ?? [];\n const extraProofs = extras.proofs ?? [];\n const proven = new Set(extraProofs.flatMap((proof) => proof.scenarios));\n const matrix = required.filter((scenario): scenario is ReactRendererEvidenceScenario =>\n scenario !== \"default\" && scenario !== \"keyboard\" && scenario !== \"native-actions\" && scenario !== \"contract\"\n && !gaps.includes(scenario as ReactRendererEvidenceScenario) && !proven.has(scenario as ReactRendererEvidenceScenario));\n const proofs = [\n { scenarios: [\"default\" as const], file: defaultProofFile, caseId: componentId },\n ...(matrix.length === 0 ? [] : [{ scenarios: matrix, file: matrixProofFile, caseId: componentId }]),\n ...extraProofs.map((proof) => ({ ...proof, caseId: componentId })),\n ];\n return {\n componentId,\n exportNames,\n subpath,\n scenarios: proofs.flatMap((proof) => proof.scenarios),\n proofs,\n };\n}\n\nconst activeWebEntries: readonly ComponentCatalogEntry[] = componentCatalog.filter((entry) => {\n const status = getComponentSurfaceStatus(entry, \"web\");\n return status === \"stable\" || status === \"beta\";\n});\n\n/**\n * First-party Web renderer claims. Scenario axes remain fail-closed: the\n * default scenario is an SSR render, the environment and accessibility\n * scenarios are computed-style assertions in scenario-matrix.browser.\n * Keyboard and cross-platform parity remain fail-closed until dedicated\n * interaction or paired-renderer proofs are mapped one-to-one.\n */\nexport const reactRendererEvidence = {\n schemaVersion: reactRendererEvidenceSchemaVersion,\n packageName: \"@hjmds/react\",\n packageVersion: \"1.33.1\",\n surface: \"web\",\n components: activeWebEntries.map(derivedClaim),\n} as const satisfies ReactRendererEvidenceManifest;\n"]}
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,yBAAyB,EAA8B,MAAM,iCAAiC,CAAC;AACzI,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAU,CAAC;AA6B7D,MAAM,gBAAgB,GAAG,kCAA2C,CAAC;AACrE,MAAM,eAAe,GAAG,uCAAgD,CAAC;AACzE,MAAM,mBAAmB,GAAG,mCAA4C,CAAC;AAIzE;;;;;GAKG;AACH,MAAM,eAAe,GAAuE,EAAE,CAAC;AAc/F,MAAM,QAAQ,GAAG,CAAC,OAAkB,mBAAmB,EAAe,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3H,MAAM,mBAAmB,GAAG,CAAC,IAAe,EAAe,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AAE7H,MAAM,WAAW,GAA0C;IACzD,wBAAwB,EAAE,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE;IAC1D,MAAM,EAAE,QAAQ,EAAE;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AC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;QACrD,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,gBAAgB,GAAqC,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3F,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,MAAM,CAAC;AAClD,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,aAAa,EAAE,kCAAkC;IACjD,WAAW,EAAE,cAAc;IAC3B,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,YAAY,CAAC;CACE,CAAC","sourcesContent":["import type { ShowcaseScenarioId } from \"@hjmds/design-contracts/showcase\";\nimport { getRequiredShowcaseEvidence } from \"@hjmds/design-contracts/showcase\";\nimport { componentCatalog, componentIdOf, getComponentSurfaceStatus, type ComponentCatalogEntry } from \"@hjmds/design-contracts/catalog\";\nimport { publicExportEntries } from \"./public-exports.generated.js\";\n\nexport const reactRendererEvidenceSchemaVersion = 2 as const;\n\nexport type ReactRendererEvidenceScenario = Exclude<ShowcaseScenarioId, \"contract\" | \"native-actions\">;\n\nexport type ReactRendererEvidenceComponent = Readonly<{\n /** Canonical component id from the design-contracts catalog. */\n componentId: string;\n /** Public symbols that implement this contract on the declared subpath. */\n exportNames: readonly string[];\n /** Granular @hjmds/react export used by consumers. */\n subpath: `./${string}`;\n /** Scenarios supported by automated first-party renderer evidence. */\n scenarios: readonly ReactRendererEvidenceScenario[];\n /** Repository-local executable proof for every claimed scenario. */\n proofs: readonly Readonly<{\n scenarios: readonly ReactRendererEvidenceScenario[];\n file: `test/${string}.test.tsx`;\n caseId: string;\n }>[];\n}>;\n\nexport type ReactRendererEvidenceManifest = Readonly<{\n schemaVersion: typeof reactRendererEvidenceSchemaVersion;\n packageName: \"@hjmds/react\";\n packageVersion: string;\n surface: \"web\";\n components: readonly ReactRendererEvidenceComponent[];\n}>;\n\nconst defaultProofFile = \"test/default-render.ssr.test.tsx\" as const;\nconst matrixProofFile = \"test/scenario-matrix.browser.test.tsx\" as const;\nconst stableCoreProofFile = \"test/stable-core.browser.test.tsx\" as const;\n\ntype ProofFile = `test/${string}.test.tsx`;\n\n/**\n * Scenarios a component does not pass yet. Each entry is promotion debt that\n * the generated evidence projection reports; remove it when the component is\n * fixed and the matrix case passes. Stable surfaces cannot carry a gap\n * (scripts/check-workspace-sync.mjs).\n */\nconst webScenarioGaps: Readonly<Record<string, readonly ReactRendererEvidenceScenario[]>> = {};\n\n/**\n * Proofs that live outside the shared default/matrix files: keyboard behavior in a dedicated browser test,\n * long copy proven inside a portal by the component's own test, or a whole matrix run in a component file.\n * Everything else about a claim derives from the catalog row (2026-10-18 registration input).\n */\ntype ClaimExtras = Readonly<{\n /** Extra proofs; their scenarios are removed from the shared matrix proof. */\n proofs?: readonly Readonly<{ scenarios: readonly ReactRendererEvidenceScenario[]; file: ProofFile }>[];\n /** Hooks or helpers published beside the component symbols on the same subpath. */\n exportNames?: readonly string[];\n}>;\n\nconst keyboard = (file: ProofFile = stableCoreProofFile): ClaimExtras => ({ proofs: [{ scenarios: [\"keyboard\"], file }] });\nconst keyboardAndLongCopy = (file: ProofFile): ClaimExtras => ({ proofs: [{ scenarios: [\"keyboard\", \"long-copy\"], file }] });\n\nconst claimExtras: Readonly<Record<string, ClaimExtras>> = {\n \"design-system-provider\": { exportNames: [\"useHjmTheme\"] },\n layout: keyboard(),\n link: keyboard(),\n field: keyboard(),\n \"search-field\": keyboard(),\n \"password-field\": keyboard(),\n \"otp-field\": keyboard(),\n \"number-field\": keyboard(),\n slider: keyboard(),\n form: keyboard(\"test/form.keyboard.browser.test.tsx\"),\n \"date-picker\": keyboard(),\n calendar: keyboard(\"test/calendar.browser.test.tsx\"),\n \"file-picker\": keyboard(\"test/file-picker.keyboard.browser.test.tsx\"),\n checkbox: keyboard(),\n \"checkbox-group\": keyboard(),\n \"radio-group\": keyboard(),\n switch: keyboard(),\n \"segmented-control\": keyboard(),\n chip: keyboard(),\n tabs: keyboard(\"test/tabs.keyboard.browser.test.tsx\"),\n breadcrumb: keyboard(\"test/page-navigation.browser.test.tsx\"),\n pagination: keyboard(\"test/pagination.keyboard.browser.test.tsx\"),\n popover: keyboardAndLongCopy(\"test/popover.browser.test.tsx\"),\n \"side-panel\": keyboardAndLongCopy(\"test/side-panel.browser.test.tsx\"),\n splitter: keyboard(\"test/splitter.browser.test.tsx\"),\n tour: keyboardAndLongCopy(\"test/tour.browser.test.tsx\"),\n tree: keyboard(\"test/tree.browser.test.tsx\"),\n \"transfer-list\": keyboard(\"test/transfer-list.browser.test.tsx\"),\n mentions: keyboard(\"test/mentions.browser.test.tsx\"),\n \"command-palette\": keyboardAndLongCopy(\"test/command-palette.browser.test.tsx\"),\n agreement: keyboard(\"test/agreement.keyboard.browser.test.tsx\"),\n \"toggle-group\": keyboard(),\n \"tags-input\": keyboard(),\n \"skip-nav\": keyboardAndLongCopy(\"test/skip-nav.browser.test.tsx\"),\n sidebar: keyboard(\"test/sidebar.browser.test.tsx\"),\n \"date-range-picker\": keyboard(\"test/date-range.keyboard.browser.test.tsx\"),\n \"auth-provider-button\": keyboard(),\n \"data-table\": keyboard(\"test/data-table.keyboard.browser.test.tsx\"),\n collapsible: keyboard(\"test/collapsible.keyboard.browser.test.tsx\"),\n \"context-menu\": keyboardAndLongCopy(\"test/context-menu.interactions.browser.test.tsx\"),\n menubar: keyboard(\"test/menubar.keyboard.browser.test.tsx\"),\n anchor: keyboard(\"test/anchor.browser.test.tsx\"),\n \"bottom-navigation\": keyboard(\"test/bottom-navigation.keyboard.browser.test.tsx\"),\n \"load-more\": keyboard(\"test/load-more.interactions.browser.test.tsx\"),\n carousel: keyboard(\"test/carousel.browser.test.tsx\"),\n \"floating-action-button\": keyboard(),\n accordion: keyboard(\"test/accordion.keyboard.browser.test.tsx\"),\n \"upload-item\": keyboard(\"test/upload-item.browser.test.tsx\"),\n // ThinkingOrb runs its whole environment matrix in its own file (canvas timing), not in scenario-matrix.\n \"thinking-orb\": { proofs: [{ scenarios: [\"dark\", \"large-text\", \"rtl\", \"reduced-motion\", \"accessibility\"], file: \"test/thinking-orb.browser.test.tsx\" }] },\n \"color-picker\": keyboard(\"test/web-additions.browser.test.tsx\"),\n // SSR proves semantics but cannot catch the close-only row seen in BurnTok.\n // Keep real geometry evidence attached without promoting catalog maturity.\n toast: {\n exportNames: [\"useToast\"],\n proofs: [\n { scenarios: [\"keyboard\"], file: stableCoreProofFile },\n { scenarios: [\"dark\", \"long-copy\", \"large-text\", \"rtl\"], file: \"test/toast-layout.browser.test.tsx\" },\n ],\n },\n select: keyboard(),\n combobox: keyboard(),\n dialog: keyboard(\"test/advanced.browser.test.tsx\"),\n \"alert-dialog\": keyboardAndLongCopy(\"test/alert-dialog.keyboard.browser.test.tsx\"),\n sheet: keyboardAndLongCopy(\"test/sheet-layout.browser.test.tsx\"),\n tooltip: keyboard(\"test/tooltip.browser.test.tsx\"),\n menu: keyboardAndLongCopy(\"test/menu.keyboard.browser.test.tsx\"),\n};\n\nconst exportEntries: Readonly<Record<string, readonly `./${string}`[] | undefined>> = publicExportEntries;\n\n/**\n * One claim per active Web row of the catalog. The subpath is the symbol's canonical granular entry, the export\n * names are the row's own symbol plus the companions published on that entry, and the scenarios are the row's\n * required Web evidence minus recorded gaps. Keyboard is never implied: it comes only from a dedicated proof.\n */\nfunction derivedClaim(entry: ComponentCatalogEntry): ReactRendererEvidenceComponent {\n const componentId = componentIdOf(entry);\n const extras = claimExtras[componentId] ?? {};\n const symbols = entry.name === \"DesignSystemProvider\" ? [\"HjmProvider\"] : [entry.name, ...(entry.companions ?? [])];\n // A row whose own name is not a symbol (Chart) claims through its first published companion.\n const subpath = symbols.map((symbol) => exportEntries[symbol]?.[0]).find((entry) => entry !== undefined);\n if (!subpath) throw new Error(`${entry.name} has no granular @hjmds/react export to claim evidence on`);\n const exportNames = [\n ...symbols.filter((symbol) => exportEntries[symbol]?.includes(subpath)),\n ...(extras.exportNames ?? []),\n ];\n const required = getRequiredShowcaseEvidence(entry).find((evidence) => evidence.surface === \"web\")?.scenarios ?? [];\n const gaps = webScenarioGaps[componentId] ?? [];\n const extraProofs = extras.proofs ?? [];\n const proven = new Set(extraProofs.flatMap((proof) => proof.scenarios));\n const matrix = required.filter((scenario): scenario is ReactRendererEvidenceScenario =>\n scenario !== \"default\" && scenario !== \"keyboard\" && scenario !== \"native-actions\" && scenario !== \"contract\"\n && !gaps.includes(scenario as ReactRendererEvidenceScenario) && !proven.has(scenario as ReactRendererEvidenceScenario));\n const proofs = [\n { scenarios: [\"default\" as const], file: defaultProofFile, caseId: componentId },\n ...(matrix.length === 0 ? [] : [{ scenarios: matrix, file: matrixProofFile, caseId: componentId }]),\n ...extraProofs.map((proof) => ({ ...proof, caseId: componentId })),\n ];\n return {\n componentId,\n exportNames,\n subpath,\n scenarios: proofs.flatMap((proof) => proof.scenarios),\n proofs,\n };\n}\n\nconst activeWebEntries: readonly ComponentCatalogEntry[] = componentCatalog.filter((entry) => {\n const status = getComponentSurfaceStatus(entry, \"web\");\n return status === \"stable\" || status === \"beta\";\n});\n\n/**\n * First-party Web renderer claims. Scenario axes remain fail-closed: the\n * default scenario is an SSR render, the environment and accessibility\n * scenarios are computed-style assertions in scenario-matrix.browser.\n * Keyboard and cross-platform parity remain fail-closed until dedicated\n * interaction or paired-renderer proofs are mapped one-to-one.\n */\nexport const reactRendererEvidence = {\n schemaVersion: reactRendererEvidenceSchemaVersion,\n packageName: \"@hjmds/react\",\n packageVersion: \"1.33.2\",\n surface: \"web\",\n components: activeWebEntries.map(derivedClaim),\n} as const satisfies ReactRendererEvidenceManifest;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initial-focus.d.ts","sourceRoot":"","sources":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CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC;CAC9C,CAAC,CAAC;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,MAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAc,EAAE,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,uBAAuB,CAkG9M;AAED,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,uBAAuB,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAEhH;AAED,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAGpG;AAED,8GAA8G;AAC9G,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,UAAU,EAAE,OAAO,GAAG,SAAS,QAe5G"}
@@ -100,7 +100,6 @@ export function useInitialFocusScope({ mode, active = true, layer: ownLayer, ena
100
100
  const settle = () => { s.phase = "settled"; };
101
101
  const enter = (explicit) => {
102
102
  s.fresh.clear();
103
- dispatch({ kind: "activate" });
104
103
  const nested = overlay && layer ? [...(nestedScopes.get(layer) ?? [])] : [];
105
104
  if (explicit) {
106
105
  settle();
@@ -108,7 +107,12 @@ export function useInitialFocusScope({ mode, active = true, layer: ownLayer, ena
108
107
  scope.settle();
109
108
  return null;
110
109
  }
111
- const own = dispatch({ kind: "enter" });
110
+ // A user can open a menu before the deferred entry runs. Never reset their settled entry window.
111
+ if (s.phase === "settled")
112
+ return null;
113
+ if (s.phase === "inactive")
114
+ dispatch({ kind: "activate" });
115
+ const own = dispatch({ kind: s.phase === "open" ? "unblock" : "enter" });
112
116
  if (own)
113
117
  return own;
114
118
  for (const scope of nested) {
@@ -125,6 +129,8 @@ export function useInitialFocusScope({ mode, active = true, layer: ownLayer, ena
125
129
  scope.dispatch({ kind: "deactivate" });
126
130
  return undefined;
127
131
  }
132
+ // Observe interaction immediately; deferring activation too would lose a click before the entry microtask.
133
+ scope.dispatch({ kind: "activate" });
128
134
  // After every effect of this commit, so a modal opening in the same commit (an app-root consent dialog) is
129
135
  // already on the stack and blocks entry instead of taking focus away and handing it back later.
130
136
  let cancelled = false;
@@ -140,7 +146,7 @@ export function useInitialFocusScope({ mode, active = true, layer: ownLayer, ena
140
146
  nested.add(nestedEntry);
141
147
  }
142
148
  const interact = () => { scope.dispatch({ kind: "interact" }); };
143
- const events = ["pointerdown", "keydown", "wheel", "touchstart"];
149
+ const events = ["pointerdown", "click", "contextmenu", "keydown", "wheel", "touchstart"];
144
150
  for (const type of events)
145
151
  document.addEventListener(type, interact, true);
146
152
  // A modal above closed (after its return focus ran): retry a pending entry.
@@ -1 +1 @@
1
- {"version":3,"file":"initial-focus.js","sourceRoot":"","sources":["../../src/internal/initial-focus.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAiG,MAAM,yCAAyC,CAAC;AAC3K,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAkC,MAAM,OAAO,CAAC;AAC/H,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAoB,MAAM,aAAa,CAAC;AAOjF;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAC;AACjE,kGAAkG;AAClG,MAAM,wBAAwB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AACrD,mHAAmH;AACnH,MA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IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChC,iHAAiH;QACjH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC;QACvC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;QACvC,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO;YAChE,4DAA4D;YAC5D,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,OAA0D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SACzJ,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { resolveEntryFocus, type EntryFocusEvent, type EntryFocusPhase, type InitialFocusCandidate, type InitialFocusMode } from \"@hjmds/design-contracts/screen-patterns\";\nimport { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, type ReactNode, type RefObject } from \"react\";\nimport { getTopModal, subscribeModalClose, type ActiveModal } from \"../modal.js\";\n\ntype Entry = { order: number; preference: boolean | undefined; element(): HTMLElement | null; focusable(): boolean };\ntype Registry = { nextOrder(): number; register(entry: Entry, mounted: boolean): () => void };\n/** The overlay's own entry on the shared modal stack while it is active (set by `useModalFocus`). */\nexport type ModalLayerRef = { current: ActiveModal | null };\n\n/**\n * Nearest screen/overlay scope that chooses the field focused on entry (rules: screen-patterns `resolveEntryFocus`,\n * shared with Native). Fields register by context, the same model as Native, instead of the scope querying the DOM; a\n * scope with mode \"none\" still owns its fields so they never reach an outer scope.\n */\nconst InitialFocusContext = createContext<Registry | null>(null);\n// A bottom sheet owns this boundary, including ScreenLayout/marked fields nested inside its body.\nconst EntryFocusEnabledContext = createContext(true);\n/** Layer of the enclosing HJM overlay; null on the page itself. A ScreenLayout inside a sheet uses the sheet's. */\nconst ModalLayerContext = createContext<ModalLayerRef | null>(null);\n\ntype NestedScope = { enter(): HTMLElement | null; settle(): void };\n/**\n * Screen scopes rendered inside an HJM overlay, keyed by that overlay's layer. Their fields register with the screen,\n * not the overlay, so the overlay's activation asks them for the entry field instead of focusing its first control\n * over them (BurnTok search: a ScreenLayout in a Sheet left focus on the close button, 2026-10-18).\n */\nconst nestedScopes = new WeakMap<ModalLayerRef, Set<NestedScope>>();\n\n/**\n * Product modals (not on the HJM stack) layered above the scope. A product modal that contains the scope's own fields\n * wraps the screen rather than covering it, so it does not block (BurnTok search overlay, 2026-10-18).\n */\nfunction productModalAbove(fields: readonly HTMLElement[]): boolean {\n return [...document.querySelectorAll('[aria-modal=\"true\"], dialog[open]')]\n .some(modal => !fields.some(field => modal.contains(field)));\n}\n\nfunction isEditable(element: Element | null): boolean {\n return element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement\n || (element instanceof HTMLElement && element.isContentEditable);\n}\n\ntype Candidate = InitialFocusCandidate & { entry: Entry };\nexport type InitialFocusScopeHandle = Readonly<{\n registry: Registry;\n layer: ModalLayerRef | null;\n enabled: boolean;\n /**\n * Overlays only: runs entry when the modal activates and returns the field for `useModalFocus` to focus. `explicit`\n * means the overlay already has an `initialFocusRef`, so entry settles without choosing a field.\n */\n enter(explicit: boolean): HTMLElement | null;\n}>;\n\n/**\n * Screen scopes enter on mount (Web has no enter transition to wait for); overlays pass `layer` and enter through\n * `useModalFocus`. User pointer, key, wheel or touch input while no modal is above the scope ends the entry window.\n */\nexport function useInitialFocusScope({ mode, active = true, layer: ownLayer, enabled = true }: { mode: InitialFocusMode; active?: boolean; layer?: ModalLayerRef; enabled?: boolean }): InitialFocusScopeHandle {\n const inherited = useContext(ModalLayerContext);\n const inheritedEnabled = useContext(EntryFocusEnabledContext);\n // A separate overlay owns its policy; ordinary nested screens inherit their enclosing sheet's policy.\n const entryFocusEnabled = enabled && (ownLayer !== undefined || inheritedEnabled);\n const enabledRef = useRef(entryFocusEnabled); enabledRef.current = entryFocusEnabled;\n const layer = ownLayer ?? inherited;\n const overlay = ownLayer !== undefined;\n const modeRef = useRef(mode); modeRef.current = mode;\n const state = useRef({ phase: \"inactive\" as EntryFocusPhase, entries: new Set<Entry>(), fresh: new Set<Entry>(), counter: 0, flushQueued: false });\n\n const scope = useMemo(() => {\n const s = state.current;\n const blocked = () => {\n const own = layer?.current ?? null;\n // Inside an HJM overlay that is not on the stack yet: its activation runs this scope's entry (`nestedScopes`).\n if (layer !== null && own === null) return true;\n const top = getTopModal();\n if (top) return top !== own;\n // A product's own modal above the page still covers it; overlay content is portaled outside product markup.\n if (layer !== null) return false;\n const fields = [...s.entries].map(entry => entry.element()).filter((element): element is HTMLElement => element !== null);\n return productModalAbove(fields);\n };\n const dispatch = (event: EntryFocusEvent<Candidate> | { kind: \"register\"; entry: Entry }): HTMLElement | null => {\n if (!enabledRef.current) return null;\n const candidates: Candidate[] = [...s.entries].map(entry => ({ entry, order: entry.order, preference: entry.preference, focusable: entry.focusable() }));\n const resolved = event.kind === \"register\" && \"entry\" in event\n ? { kind: \"register\" as const, field: candidates.find(candidate => candidate.entry === event.entry)! }\n : event as EntryFocusEvent<Candidate>;\n const result = resolveEntryFocus(s.phase, resolved, { mode: modeRef.current, candidates, blocked: blocked(), textEntryFocused: isEditable(document.activeElement) });\n s.phase = result.phase;\n return result.target?.entry.element() ?? null;\n };\n const focus = (target: HTMLElement | null) => target?.focus({ preventScroll: true });\n // Fields mounting in one commit are judged together.\n const flush = () => {\n s.flushQueued = false;\n const fresh = [...s.fresh].filter(entry => s.entries.has(entry)).sort((a, b) => a.order - b.order);\n s.fresh.clear();\n const field = fresh.find(entry => entry.preference === true) ?? fresh[0];\n if (field) focus(dispatch({ kind: \"register\", entry: field }));\n };\n const registry: Registry = {\n nextOrder: () => s.counter++,\n register(entry, mounted) {\n s.entries.add(entry);\n if (mounted) { s.fresh.add(entry); if (!s.flushQueued) { s.flushQueued = true; queueMicrotask(flush); } }\n return () => { s.entries.delete(entry); s.fresh.delete(entry); };\n },\n };\n const settle = () => { s.phase = \"settled\"; };\n const enter = (explicit: boolean) => {\n s.fresh.clear();\n dispatch({ kind: \"activate\" });\n const nested = overlay && layer ? [...(nestedScopes.get(layer) ?? [])] : [];\n if (explicit) { settle(); for (const scope of nested) scope.settle(); return null; }\n const own = dispatch({ kind: \"enter\" });\n if (own) return own;\n for (const scope of nested) { const target = scope.enter(); if (target) return target; }\n return null;\n };\n return { registry, layer, dispatch, focus, enter, settle };\n }, [layer, overlay]);\n\n useEffect(() => {\n if (!active) { scope.dispatch({ kind: \"deactivate\" }); return undefined; }\n // After every effect of this commit, so a modal opening in the same commit (an app-root consent dialog) is\n // already on the stack and blocks entry instead of taking focus away and handing it back later.\n let cancelled = false;\n if (!overlay) queueMicrotask(() => { if (!cancelled) scope.focus(scope.enter(false)); });\n // A screen inside an overlay that activates later enters when the overlay does (see `enter`).\n let nested: Set<NestedScope> | undefined;\n const nestedEntry: NestedScope = { enter: () => scope.enter(false), settle: scope.settle };\n if (!overlay && scope.layer) {\n nested = nestedScopes.get(scope.layer) ?? new Set();\n nestedScopes.set(scope.layer, nested);\n nested.add(nestedEntry);\n }\n const interact = () => { scope.dispatch({ kind: \"interact\" }); };\n const events = [\"pointerdown\", \"keydown\", \"wheel\", \"touchstart\"] as const;\n for (const type of events) document.addEventListener(type, interact, true);\n // A modal above closed (after its return focus ran): retry a pending entry.\n const unsubscribe = subscribeModalClose(() => scope.focus(scope.dispatch({ kind: \"unblock\" })));\n return () => {\n cancelled = true;\n nested?.delete(nestedEntry);\n for (const type of events) document.removeEventListener(type, interact, true);\n unsubscribe();\n scope.dispatch({ kind: \"deactivate\" });\n };\n }, [active, overlay, scope, entryFocusEnabled]);\n\n return useMemo(() => ({ registry: scope.registry, layer: scope.layer, enter: scope.enter, enabled: entryFocusEnabled }), [scope, entryFocusEnabled]);\n}\n\nexport function InitialFocusProvider({ scope, children }: { scope: InitialFocusScopeHandle; children: ReactNode }) {\n return <EntryFocusEnabledContext.Provider value={scope.enabled}><ModalLayerContext.Provider value={scope.layer}><InitialFocusContext.Provider value={scope.registry}>{children}</InitialFocusContext.Provider></ModalLayerContext.Provider></EntryFocusEnabledContext.Provider>;\n}\n\n/** Screen scope: focuses the chosen field on mount, never over a field the user is in or under an open modal. */\nexport function InitialFocusScope({ mode, children }: { mode: InitialFocusMode; children: ReactNode }) {\n const scope = useInitialFocusScope({ mode });\n return <InitialFocusProvider scope={scope}>{children}</InitialFocusProvider>;\n}\n\n/** Registers a text field with the nearest scope. `preference` is the field's public `initialFocusTarget`. */\nexport function useInitialFocusTarget(element: RefObject<HTMLElement | null>, preference: boolean | undefined) {\n const registry = useContext(InitialFocusContext);\n // Tree order is fixed at first registration, so changing `preference` later does not move the field to the end.\n const order = useRef<number | null>(null);\n useLayoutEffect(() => {\n if (!registry) return undefined;\n // Only the first registration of this field instance counts as \"appeared\"; a later `preference` change does not.\n const mounted = order.current === null;\n order.current ??= registry.nextOrder();\n return registry.register({\n order: order.current, preference, element: () => element.current,\n // Disabled and read-only fields are never focused on entry.\n focusable: () => { const node = element.current as (HTMLInputElement | HTMLTextAreaElement | null); return !!node && !node.disabled && !node.readOnly; },\n }, mounted);\n }, [registry, preference, element]);\n}\n"]}
1
+ {"version":3,"file":"initial-focus.js","sourceRoot":"","sources":["../../src/internal/initial-focus.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAiG,MAAM,yCAAyC,CAAC;AAC3K,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAkC,MAAM,OAAO,CAAC;AAC/H,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAoB,MAAM,aAAa,CAAC;AAOjF;;;;G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AAiH;AACjH,MAAM,UAAU,iBAAiB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAmD;IACnG,MAAM,KAAK,GAAG,oBAAoB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,OAAO,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAwB,CAAC;AAC/E,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,qBAAqB,CAAC,OAAsC,EAAE,UAA+B;IAC3G,MAAM,QAAQ,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACjD,gHAAgH;IAChH,MAAM,KAAK,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC1C,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChC,iHAAiH;QACjH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC;QACvC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;QACvC,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO;YAChE,4DAA4D;YAC5D,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,OAA0D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SACzJ,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { resolveEntryFocus, type EntryFocusEvent, type EntryFocusPhase, type InitialFocusCandidate, type InitialFocusMode } from \"@hjmds/design-contracts/screen-patterns\";\nimport { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, type ReactNode, type RefObject } from \"react\";\nimport { getTopModal, subscribeModalClose, type ActiveModal } from \"../modal.js\";\n\ntype Entry = { order: number; preference: boolean | undefined; element(): HTMLElement | null; focusable(): boolean };\ntype Registry = { nextOrder(): number; register(entry: Entry, mounted: boolean): () => void };\n/** The overlay's own entry on the shared modal stack while it is active (set by `useModalFocus`). */\nexport type ModalLayerRef = { current: ActiveModal | null };\n\n/**\n * Nearest screen/overlay scope that chooses the field focused on entry (rules: screen-patterns `resolveEntryFocus`,\n * shared with Native). Fields register by context, the same model as Native, instead of the scope querying the DOM; a\n * scope with mode \"none\" still owns its fields so they never reach an outer scope.\n */\nconst InitialFocusContext = createContext<Registry | null>(null);\n// A bottom sheet owns this boundary, including ScreenLayout/marked fields nested inside its body.\nconst EntryFocusEnabledContext = createContext(true);\n/** Layer of the enclosing HJM overlay; null on the page itself. A ScreenLayout inside a sheet uses the sheet's. */\nconst ModalLayerContext = createContext<ModalLayerRef | null>(null);\n\ntype NestedScope = { enter(): HTMLElement | null; settle(): void };\n/**\n * Screen scopes rendered inside an HJM overlay, keyed by that overlay's layer. Their fields register with the screen,\n * not the overlay, so the overlay's activation asks them for the entry field instead of focusing its first control\n * over them (BurnTok search: a ScreenLayout in a Sheet left focus on the close button, 2026-10-18).\n */\nconst nestedScopes = new WeakMap<ModalLayerRef, Set<NestedScope>>();\n\n/**\n * Product modals (not on the HJM stack) layered above the scope. A product modal that contains the scope's own fields\n * wraps the screen rather than covering it, so it does not block (BurnTok search overlay, 2026-10-18).\n */\nfunction productModalAbove(fields: readonly HTMLElement[]): boolean {\n return [...document.querySelectorAll('[aria-modal=\"true\"], dialog[open]')]\n .some(modal => !fields.some(field => modal.contains(field)));\n}\n\nfunction isEditable(element: Element | null): boolean {\n return element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement\n || (element instanceof HTMLElement && element.isContentEditable);\n}\n\ntype Candidate = InitialFocusCandidate & { entry: Entry };\nexport type InitialFocusScopeHandle = Readonly<{\n registry: Registry;\n layer: ModalLayerRef | null;\n enabled: boolean;\n /**\n * Overlays only: runs entry when the modal activates and returns the field for `useModalFocus` to focus. `explicit`\n * means the overlay already has an `initialFocusRef`, so entry settles without choosing a field.\n */\n enter(explicit: boolean): HTMLElement | null;\n}>;\n\n/**\n * Screen scopes enter on mount (Web has no enter transition to wait for); overlays pass `layer` and enter through\n * `useModalFocus`. User pointer, key, wheel or touch input while no modal is above the scope ends the entry window.\n */\nexport function useInitialFocusScope({ mode, active = true, layer: ownLayer, enabled = true }: { mode: InitialFocusMode; active?: boolean; layer?: ModalLayerRef; enabled?: boolean }): InitialFocusScopeHandle {\n const inherited = useContext(ModalLayerContext);\n const inheritedEnabled = useContext(EntryFocusEnabledContext);\n // A separate overlay owns its policy; ordinary nested screens inherit their enclosing sheet's policy.\n const entryFocusEnabled = enabled && (ownLayer !== undefined || inheritedEnabled);\n const enabledRef = useRef(entryFocusEnabled); enabledRef.current = entryFocusEnabled;\n const layer = ownLayer ?? inherited;\n const overlay = ownLayer !== undefined;\n const modeRef = useRef(mode); modeRef.current = mode;\n const state = useRef({ phase: \"inactive\" as EntryFocusPhase, entries: new Set<Entry>(), fresh: new Set<Entry>(), counter: 0, flushQueued: false });\n\n const scope = useMemo(() => {\n const s = state.current;\n const blocked = () => {\n const own = layer?.current ?? null;\n // Inside an HJM overlay that is not on the stack yet: its activation runs this scope's entry (`nestedScopes`).\n if (layer !== null && own === null) return true;\n const top = getTopModal();\n if (top) return top !== own;\n // A product's own modal above the page still covers it; overlay content is portaled outside product markup.\n if (layer !== null) return false;\n const fields = [...s.entries].map(entry => entry.element()).filter((element): element is HTMLElement => element !== null);\n return productModalAbove(fields);\n };\n const dispatch = (event: EntryFocusEvent<Candidate> | { kind: \"register\"; entry: Entry }): HTMLElement | null => {\n if (!enabledRef.current) return null;\n const candidates: Candidate[] = [...s.entries].map(entry => ({ entry, order: entry.order, preference: entry.preference, focusable: entry.focusable() }));\n const resolved = event.kind === \"register\" && \"entry\" in event\n ? { kind: \"register\" as const, field: candidates.find(candidate => candidate.entry === event.entry)! }\n : event as EntryFocusEvent<Candidate>;\n const result = resolveEntryFocus(s.phase, resolved, { mode: modeRef.current, candidates, blocked: blocked(), textEntryFocused: isEditable(document.activeElement) });\n s.phase = result.phase;\n return result.target?.entry.element() ?? null;\n };\n const focus = (target: HTMLElement | null) => target?.focus({ preventScroll: true });\n // Fields mounting in one commit are judged together.\n const flush = () => {\n s.flushQueued = false;\n const fresh = [...s.fresh].filter(entry => s.entries.has(entry)).sort((a, b) => a.order - b.order);\n s.fresh.clear();\n const field = fresh.find(entry => entry.preference === true) ?? fresh[0];\n if (field) focus(dispatch({ kind: \"register\", entry: field }));\n };\n const registry: Registry = {\n nextOrder: () => s.counter++,\n register(entry, mounted) {\n s.entries.add(entry);\n if (mounted) { s.fresh.add(entry); if (!s.flushQueued) { s.flushQueued = true; queueMicrotask(flush); } }\n return () => { s.entries.delete(entry); s.fresh.delete(entry); };\n },\n };\n const settle = () => { s.phase = \"settled\"; };\n const enter = (explicit: boolean) => {\n s.fresh.clear();\n const nested = overlay && layer ? [...(nestedScopes.get(layer) ?? [])] : [];\n if (explicit) { settle(); for (const scope of nested) scope.settle(); return null; }\n // A user can open a menu before the deferred entry runs. Never reset their settled entry window.\n if (s.phase === \"settled\") return null;\n if (s.phase === \"inactive\") dispatch({ kind: \"activate\" });\n const own = dispatch({ kind: s.phase === \"open\" ? \"unblock\" : \"enter\" });\n if (own) return own;\n for (const scope of nested) { const target = scope.enter(); if (target) return target; }\n return null;\n };\n return { registry, layer, dispatch, focus, enter, settle };\n }, [layer, overlay]);\n\n useEffect(() => {\n if (!active) { scope.dispatch({ kind: \"deactivate\" }); return undefined; }\n // Observe interaction immediately; deferring activation too would lose a click before the entry microtask.\n scope.dispatch({ kind: \"activate\" });\n // After every effect of this commit, so a modal opening in the same commit (an app-root consent dialog) is\n // already on the stack and blocks entry instead of taking focus away and handing it back later.\n let cancelled = false;\n if (!overlay) queueMicrotask(() => { if (!cancelled) scope.focus(scope.enter(false)); });\n // A screen inside an overlay that activates later enters when the overlay does (see `enter`).\n let nested: Set<NestedScope> | undefined;\n const nestedEntry: NestedScope = { enter: () => scope.enter(false), settle: scope.settle };\n if (!overlay && scope.layer) {\n nested = nestedScopes.get(scope.layer) ?? new Set();\n nestedScopes.set(scope.layer, nested);\n nested.add(nestedEntry);\n }\n const interact = () => { scope.dispatch({ kind: \"interact\" }); };\n const events = [\"pointerdown\", \"click\", \"contextmenu\", \"keydown\", \"wheel\", \"touchstart\"] as const;\n for (const type of events) document.addEventListener(type, interact, true);\n // A modal above closed (after its return focus ran): retry a pending entry.\n const unsubscribe = subscribeModalClose(() => scope.focus(scope.dispatch({ kind: \"unblock\" })));\n return () => {\n cancelled = true;\n nested?.delete(nestedEntry);\n for (const type of events) document.removeEventListener(type, interact, true);\n unsubscribe();\n scope.dispatch({ kind: \"deactivate\" });\n };\n }, [active, overlay, scope, entryFocusEnabled]);\n\n return useMemo(() => ({ registry: scope.registry, layer: scope.layer, enter: scope.enter, enabled: entryFocusEnabled }), [scope, entryFocusEnabled]);\n}\n\nexport function InitialFocusProvider({ scope, children }: { scope: InitialFocusScopeHandle; children: ReactNode }) {\n return <EntryFocusEnabledContext.Provider value={scope.enabled}><ModalLayerContext.Provider value={scope.layer}><InitialFocusContext.Provider value={scope.registry}>{children}</InitialFocusContext.Provider></ModalLayerContext.Provider></EntryFocusEnabledContext.Provider>;\n}\n\n/** Screen scope: focuses the chosen field on mount, never over a field the user is in or under an open modal. */\nexport function InitialFocusScope({ mode, children }: { mode: InitialFocusMode; children: ReactNode }) {\n const scope = useInitialFocusScope({ mode });\n return <InitialFocusProvider scope={scope}>{children}</InitialFocusProvider>;\n}\n\n/** Registers a text field with the nearest scope. `preference` is the field's public `initialFocusTarget`. */\nexport function useInitialFocusTarget(element: RefObject<HTMLElement | null>, preference: boolean | undefined) {\n const registry = useContext(InitialFocusContext);\n // Tree order is fixed at first registration, so changing `preference` later does not move the field to the end.\n const order = useRef<number | null>(null);\n useLayoutEffect(() => {\n if (!registry) return undefined;\n // Only the first registration of this field instance counts as \"appeared\"; a later `preference` change does not.\n const mounted = order.current === null;\n order.current ??= registry.nextOrder();\n return registry.register({\n order: order.current, preference, element: () => element.current,\n // Disabled and read-only fields are never focused on entry.\n focusable: () => { const node = element.current as (HTMLInputElement | HTMLTextAreaElement | null); return !!node && !node.disabled && !node.readOnly; },\n }, mounted);\n }, [registry, preference, element]);\n}\n"]}
package/dist/styles.css CHANGED
@@ -1125,7 +1125,8 @@ button.hjm-list-row, a.hjm-list-row { cursor: pointer; }
1125
1125
 
1126
1126
  /* emptyStateRecipe.density.regular paddingVertical xxxl 40 (2026-10-06; Web had xxl 32, Native read the recipe). */
1127
1127
  /* Like Native, a regular empty state fills the rest of a flex host and centers in it; compact (cards, sheets) stays content-high. */
1128
- .hjm-empty-state { display: grid; flex-grow: 1; align-content: center; justify-items: center; gap: var(--hjm-space-xs); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); color: var(--hjm-color-text-muted); text-align: center; }
1128
+ /* Empty copy uses body size even inside a title-sized host (2026-10-18 user rule). */
1129
+ .hjm-empty-state { font-size: var(--hjm-type-body-size); line-height: var(--hjm-type-body-line-height); display: grid; flex-grow: 1; align-content: center; justify-items: center; gap: var(--hjm-space-xs); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); color: var(--hjm-color-text-muted); text-align: center; }
1129
1130
  .hjm-empty-state[data-density="compact"] { flex-grow: 0; padding-block: var(--hjm-space-xl); }
1130
1131
  .hjm-empty-state__title { color: var(--hjm-color-text); font-weight: var(--hjm-type-title-weight); }
1131
1132
  .hjm-result { display: grid; justify-items: center; gap: var(--hjm-space-sm); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); text-align: center; }
@@ -1126,7 +1126,8 @@ button.hjm-list-row, a.hjm-list-row { cursor: pointer; }
1126
1126
 
1127
1127
  /* emptyStateRecipe.density.regular paddingVertical xxxl 40 (2026-10-06; Web had xxl 32, Native read the recipe). */
1128
1128
  /* Like Native, a regular empty state fills the rest of a flex host and centers in it; compact (cards, sheets) stays content-high. */
1129
- .hjm-empty-state { display: grid; flex-grow: 1; align-content: center; justify-items: center; gap: var(--hjm-space-xs); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); color: var(--hjm-color-text-muted); text-align: center; }
1129
+ /* Empty copy uses body size even inside a title-sized host (2026-10-18 user rule). */
1130
+ .hjm-empty-state { font-size: var(--hjm-type-body-size); line-height: var(--hjm-type-body-line-height); display: grid; flex-grow: 1; align-content: center; justify-items: center; gap: var(--hjm-space-xs); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); color: var(--hjm-color-text-muted); text-align: center; }
1130
1131
  .hjm-empty-state[data-density="compact"] { flex-grow: 0; padding-block: var(--hjm-space-xl); }
1131
1132
  .hjm-empty-state__title { color: var(--hjm-color-text); font-weight: var(--hjm-type-title-weight); }
1132
1133
  .hjm-result { display: grid; justify-items: center; gap: var(--hjm-space-sm); padding: var(--hjm-space-xxxl) var(--hjm-space-xl); text-align: center; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hjmds/react",
3
- "version": "1.33.1",
3
+ "version": "1.33.2",
4
4
  "description": "Accessible React 19 renderers for HJM design contracts.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -635,7 +635,7 @@
635
635
  "blobatar": "2.7.0",
636
636
  "@blobatar/react": "2.7.0",
637
637
  "lucide-react": "1.49.0",
638
- "@hjmds/design-contracts": "1.33.1"
638
+ "@hjmds/design-contracts": "1.33.2"
639
639
  },
640
640
  "peerDependenciesMeta": {
641
641
  "@number-flow/react": {