@omnitron-dev/lumen-ui 0.4.6 → 0.4.9

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.
package/README.md CHANGED
@@ -1,29 +1,20 @@
1
1
  # @omnitron-dev/lumen-ui
2
2
 
3
- React components for Lumen documentation: a shared Prism context, selectively
4
- activated interactive islands, navigation, document blocks, search and sandboxed
5
- code execution. The `@omnitron-dev/lumen` builder bundles this runtime with Vite;
6
- it does not generate a second implementation of these components.
3
+ React components for Lumen documentation: navigation, document blocks, search and interactive islands that share the host's Prism context. Use the Lumen CLI for a complete site, or embed this package in an existing React application.
7
4
 
8
- Requires React/React DOM 19. For a complete site, start with the Lumen CLI. Use
9
- this package directly when embedding documentation in an existing React app.
5
+ ## Capabilities
10
6
 
11
- ## Public entry points
7
+ - A shared document shell and selective island activation.
8
+ - Document tabs preserve labelled sections in static HTML. The shell adds Prism tabs with keyboard selection, fragment navigation and optional same-page synchronization through `syncKey`.
9
+ - Navigation, mathematical blocks, code examples and reference cards.
10
+ - Pagefind and Netron search adapters.
11
+ - Mermaid diagrams and host-controlled API or Netron playgrounds.
12
12
 
13
- | Import | Purpose |
14
- | --- | --- |
15
- | `@omnitron-dev/lumen-ui` | All public components, adapters and types, including `ApiExplorer`, `MermaidDiagram` and `NetronPlayground`. |
16
- | `@omnitron-dev/lumen-ui/runtime` | `LumenShell`, `PortalIslandHost`, `PortalIslandManager`, `useLumen` and activation triggers. |
17
- | `@omnitron-dev/lumen-ui/layout` | `LumenNavbar`, `LumenFooter`, `DocLayout`, `DocSectionNav` and `DocPagination`. |
18
- | `@omnitron-dev/lumen-ui/blocks` | `MathTheoremBlock`, `HoverReferenceCard`, `CodeBlock`, `BacklinksSection` and `PageAgentActions`. |
19
- | `@omnitron-dev/lumen-ui/search` | `LumenSearchDialog`, `PagefindAdapter`, `NetronAdapter` and their contracts. |
13
+ ## Quick start
20
14
 
21
- The layout components expose semantic markup and `lumen-*` CSS classes. The
22
- site builder supplies the default stylesheet; an embedding app owns its layout
23
- styles. `LumenShell` supplies Prism by default. Set `disablePrismProvider` when
24
- the host application already owns that provider, to retain its theme and cache.
25
-
26
- ## One context, selective activation
15
+ ```sh
16
+ pnpm add @omnitron-dev/lumen-ui react react-dom
17
+ ```
27
18
 
28
19
  ```tsx
29
20
  import { useState } from 'react';
@@ -38,7 +29,7 @@ export function Documentation() {
38
29
  return (
39
30
  <LumenShell theme="dark" locale="en" currentPath="/guide" islands={{ Counter }}>
40
31
  <PortalIslandHost
41
- islandId="example-counter"
32
+ islandId="guide-counter"
42
33
  component="Counter"
43
34
  hydrate="visible"
44
35
  props={{ initial: 3 }}
@@ -50,134 +41,60 @@ export function Documentation() {
50
41
  }
51
42
  ```
52
43
 
53
- The host renders static fallback content and serialized props. The manager
54
- mounts the registered React component into that element when its trigger fires;
55
- it retains the shell's context. This is portal mounting, not independent React
56
- roots or hydration of arbitrary third-party HTML. Keep one manager per document.
57
- Use unique island IDs and explicit component names. Props use the shared
58
- `lumen-ast/islands` plain-JSON contract (256 KiB, 64 levels). Cycles, accessors,
59
- BigInt and values JSON cannot preserve are errors; repeated references remain
60
- valid. Invalid DOM metadata displays a local error without mounting the
61
- component with empty props. Corrected metadata can recover; changes to props
62
- and triggers on an existing element are observed. Unknown components retain
63
- their static content until registered; replacing a DOM element creates a new
64
- activation lifecycle, even when it reuses the old ID.
65
-
66
- Triggers are `load`, `visible`, `interaction` and `idle` (the default). A custom
67
- `on<Event>` trigger listens for the lowercased event name. `interaction` includes
68
- pointer, touch and keyboard/focus events. `useLumen()` exposes the current theme,
69
- locale and path, `registerIsland(name, component)`, `getIsland(name)`,
70
- `hydrateIsland(idOrComponentName)` and the active island IDs. The registry
71
- contains application code: do not populate it from untrusted document imports.
72
-
73
- ## Search
44
+ React and React DOM 19 are required. The Lumen builder supplies default layout styles; embedding applications own their styles. `LumenShell` supplies Prism by default. Set `disablePrismProvider` when the host already owns that provider.
45
+
46
+ ## Current section navigation
47
+
48
+ `DocSectionNav` from `/layout` renders native anchor links on the server. Mount it as an island to track the current section of an existing document:
74
49
 
75
50
  ```tsx
76
- import { useState } from 'react';
77
- import { LumenSearchDialog } from '@omnitron-dev/lumen-ui/search';
78
-
79
- export function Search() {
80
- const [open, setOpen] = useState(false);
81
- return <>
82
- <button onClick={() => setOpen(true)}>Search documentation</button>
83
- <LumenSearchDialog
84
- open={open}
85
- onClose={() => setOpen(false)}
86
- pagefindUrl="/pagefind/pagefind.js"
87
- maxResults={10}
88
- />
89
- </>;
90
- }
51
+ <PortalIslandHost islandId="page-toc" component="DocSectionNav" hydrate="load" props={{ headings }}>
52
+ <DocSectionNav headings={headings} />
53
+ </PortalIslandHost>
91
54
  ```
92
55
 
93
- The dialog focuses the input, contains keyboard focus, closes on Escape and
94
- restores the prior focus when removed. Requests are debounced and stale results
95
- are ignored. Service/index failures are visible errors, distinct from a valid
96
- query with no matches. Snippets are rendered as escaped text with supported
97
- highlight marks; result links pass URL validation.
98
-
99
- `PagefindAdapter` imports the configured generated Pagefind module, with one
100
- concurrent initialization per adapter. It never substitutes `window.pagefind`
101
- or permanently poisons another adapter after a failure. A subsequent search can
102
- retry failed initialization. `search(query, maxResults)` accepts up to 4 KiB of
103
- UTF-8 text and 0–100 results; empty queries and a zero limit do not load an index.
104
- The module URL is trusted application configuration, not a user-entered URL.
105
- Serve the generated Pagefind JS/WASM/index assets alongside the site, including
106
- the correct base path when hosting under a subdirectory.
107
-
108
- For live search, pass `rpcClient` obtained through the application's existing
109
- Netron query. Its structural contract is `search(query, { limit })`, returning
110
- `{ documentId, title, path, snippet, score }[]`. `NetronAdapter` performs only the
111
- UI mapping; it does not open another transport or authenticate independently.
112
- The live-search tab appears only when this client is present. Authorization and
113
- corpus projection remain in `LumenService`, not in a browser role list. Index
114
- exclusion and UI filtering are not access-control boundaries.
115
-
116
- ## Executable examples
56
+ Each heading has `{ id, title, level }` and must refer to a real document anchor. The default Lumen client registers this component; custom clients add `DocSectionNav` to their existing `LumenShell` island registry. Style `[aria-current="location"]` or `.is-active` in the host stylesheet.
57
+
58
+ `DocPagination` from `/layout` renders native previous and next links with the document titles and directional Prism icons. Pass each available neighbour as `{ href, label }`. Set `labels={{ navigation, previous, next }}` to translate the landmark and directions. The links work before hydration and follow the document's reading direction.
59
+
60
+ The shared Prism scrollspy tracks the last section start above the reading line, including long sections and the final short section at the bottom. CSS `scroll-padding-top` on the scrolling element and `scroll-margin-top` on headings account for fixed headers; an explicit `offset` overrides the reading-line padding. Native links retain keyboard behavior and browser history, with no forced smooth scrolling. An explicit anchor destination near the bottom remains selected until the reader scrolls. Supplying `activeId` instead makes the indicator controlled by the host.
61
+
62
+ ## Live component examples
63
+
64
+ `ComponentExample` from `@omnitron-dev/lumen-ui/blocks` displays a trusted component and the source used to build it. With Vite, import that module normally for its preview and with `?raw` for its source.
117
65
 
118
66
  ```tsx
119
- import { NetronPlayground } from '@omnitron-dev/lumen-ui';
67
+ import { ComponentExample } from '@omnitron-dev/lumen-ui/blocks';
68
+ import Counter from './counter';
69
+ import source from './counter.tsx?raw';
120
70
 
121
- <NetronPlayground code="return [1, 2, 3].map(value => value * 2)" />;
71
+ <ComponentExample title="Counter" code={source} resettable>
72
+ <Counter />
73
+ </ComponentExample>
122
74
  ```
123
75
 
124
- Local runs load the shipped ESM worker and the shared Lumen QuickJS WASM
125
- interpreter. Each run has an independent worker, a bounded deadline (1–5000 ms,
126
- including startup), and a 64 KiB code/output limit. There is no host-window
127
- JavaScript evaluator, network/storage capability or successful fallback after
128
- an execution failure. `snapshot` is optional recorded output, labelled
129
- separately; it never substitutes for execution. `readOnly` prevents editing and
130
- execution, and `onExecute` receives `{ code, result, error?, executionTimeMs }`.
131
-
132
- For server execution, pass `mode="server"` and
133
- `execute={code => lumenService.executePlayground(code)}`, where `lumenService`
134
- is obtained through the existing Netron query. The service result is
135
- `{ code, result, error? }`. Netron enforces authentication and permissions.
136
- The UI deadline stops waiting; the server enforces its own execution limits.
137
- A missing server executor is an error, not a switch to local execution.
138
-
139
- The production bundler must process
140
- `new Worker(new URL(..., import.meta.url), { type: 'module' })` and retain the
141
- emitted worker asset. Lumen's Vite build does this. CSP needs `worker-src 'self'`
142
- and WebAssembly compilation permission
143
- (`script-src 'self' 'wasm-unsafe-eval'`); host JavaScript string evaluation and
144
- Blob workers are not required.
145
-
146
- ## Diagrams
147
-
148
- `MermaidDiagram` accepts `code`, runs the actual Mermaid/ELK browser engine and
149
- uses the current Prism/MUI palette. The default Lumen client registers this
150
- island for Mermaid fences; a custom `LumenShell` registry must register it too.
151
- Loading, syntax errors and the original source are visible. No alternate graph
152
- renderer fabricates a successful result for unsupported syntax. Theme changes
153
- rerender the same source. Without JavaScript the static page retains its source
154
- fallback. See `lumen-ast/diagrams` for admission, source/output limits and the
155
- browser execution boundary.
156
-
157
- ## Navigation and document blocks
158
-
159
- - `DocLayout` accepts document children, sidebar and section-navigation slots.
160
- `LumenNavbar` accepts links, version/locale choices and callbacks for search,
161
- theme and selection. The host owns URL changes and persisted preferences.
162
- - `ApiExplorer` displays supplied symbol/method metadata and emits
163
- `onSelectSymbol`. Arrow keys, Home/End and Page Up/Down navigate the windowed
164
- symbol list; Enter/Space select. `tags` are informational labels. It is a documentation view; it does not fetch an OpenAPI
165
- specification or invoke methods based on an endpoint string.
166
- - `MathTheoremBlock` renders an identified mathematical environment and a proof
167
- terminator. Parsing, numbering, access projection and graph validation belong
168
- to `lumen-ast` and the builder. The block does not prove a theorem.
169
- - `CodeBlock` renders escaped source; `copyable` enables the shared Prism clipboard
170
- action with success/failure feedback. `BacklinksSection` and
171
- `HoverReferenceCard` display supplied references. `PageAgentActions` links to
172
- the clean Markdown mirror for the supplied path; that mirror must be produced
173
- and authorized by the builder/service.
174
-
175
- ## Verification
176
-
177
- Build this package and its dependencies before running `test:browser`.
178
- Production-browser tests execute the bundled module and actual interpreter in
179
- Chromium, including constructor access, host storage/network isolation,
180
- allocation/output limits, worker termination and recovery. Unit tests cover UI
181
- state and lifecycle. The website's separate acceptance covers generated pages,
182
- real Pagefind search, themes and narrow viewports. Passing component tests alone
183
- does not establish accessibility or performance for every consuming application.
76
+ Both the preview and source render on the server. The native source disclosure works with a keyboard and with JavaScript disabled. After hydration, `resettable` restores only the preview while keeping the source open. The frame keeps preview, source disclosure and source actions separate. Code has its own bounded scroll area; the copy icon remains inside the code frame without covering text or moving when its state changes. Controls support keyboard focus and announce copy results. Set `language` for a non-TSX module and translate the controls through `labels.source`, `labels.reset`, `labels.copy`, `labels.copied`, `labels.copyFailed` and `labels.highlightUnavailable`.
77
+
78
+ A client-side preview render error stays inside the preview through Prism's shared error boundary. The source remains available, and Reset remounts the preview and clears its error state.
79
+
80
+ `CodeBlock` progressively adds dual-theme syntax colors through the same tokenizer used by Markdown. It loads only the requested language grammar; the TypeScript compiler and Twoslash do not enter the browser bundle. Literal source, newlines and annotation comments remain unchanged for selection and copying. Unknown languages stay plain text. A failed grammar download shows a visible status while preserving the complete source. Server HTML and JavaScript-disabled pages retain readable, escaped source.
81
+
82
+ Component source and built Markdown fences share `--lumen-code-font-size`, which defaults to `0.875rem`. Set that token on a common ancestor to change their code size together.
83
+
84
+ ## Runtime boundaries
85
+
86
+ Islands mount through portals into static hosts, preserving the shell's context. They do not create independent React roots or hydrate arbitrary third-party HTML. Use one manager per document, unique island IDs and host-owned component registrations. Activation supports `load`, `visible`, `interaction` and `idle`.
87
+
88
+ Props use the shared Lumen AST JSON codec. Invalid metadata reports an error instead of mounting with empty props; unknown components retain their static fallback. Documents cannot register application code or grant network permissions. Live API and Netron playgrounds require explicit host capabilities and server authorization. Mermaid uses strict configuration and sanitized SVG images.
89
+
90
+ A component that throws while rendering shows an alert at its own island with its registered name and the error message. Other islands retain their state. Correcting the failed island's props or replacing its registered component retries that island.
91
+
92
+ ## Documentation
93
+
94
+ [Public API](src/index.ts) · [Package exports](package.json) · [Lumen](../lumen/README.md)
95
+
96
+ The `/runtime`, `/layout`, `/blocks` and `/search` entries expose their corresponding components without requiring a root import.
97
+
98
+ ## License
99
+
100
+ [MIT](../../LICENSE).
@@ -4,6 +4,13 @@ export interface CodeBlockProps {
4
4
  language?: string;
5
5
  copyable?: boolean;
6
6
  className?: string;
7
+ labels?: {
8
+ copy?: string;
9
+ copied?: string;
10
+ copyFailed?: string;
11
+ highlightUnavailable?: string;
12
+ };
7
13
  }
8
- export declare function CodeBlock({ code, language, copyable, className }: CodeBlockProps): React.JSX.Element;
14
+ /** Literal SSR source, progressively highlighted with one lazily loaded grammar. */
15
+ export declare function CodeBlock({ code, language, copyable, className, labels }: CodeBlockProps): React.JSX.Element;
9
16
  //# sourceMappingURL=code-block.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/blocks/code-block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,wBAAgB,SAAS,CAAC,EAAE,IAAS,EAAE,QAAe,EAAE,QAAgB,EAAE,SAAS,EAAE,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAOxH"}
1
+ {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/blocks/code-block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjG;AA2BD,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,EAAE,IAAS,EAAE,QAAe,EAAE,QAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAmDhI"}
@@ -0,0 +1,17 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type CodeBlockProps } from './code-block.js';
3
+ export interface ComponentExampleProps {
4
+ title: string;
5
+ /** The build-time source of the trusted component supplied as children. */
6
+ code: string;
7
+ children: ReactNode;
8
+ language?: string;
9
+ resettable?: boolean;
10
+ labels?: {
11
+ source?: string;
12
+ reset?: string;
13
+ } & CodeBlockProps['labels'];
14
+ }
15
+ /** One preview frame with a native source disclosure; readable before hydration. */
16
+ export declare function ComponentExample({ title, code, children, language, resettable, labels, }: ComponentExampleProps): React.JSX.Element;
17
+ //# sourceMappingURL=component-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-example.d.ts","sourceRoot":"","sources":["../../src/blocks/component-example.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK/D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;CACzE;AAED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAgB,EAAE,UAAkB,EAAE,MAAM,GACpE,EAAE,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA2C3C"}
@@ -1,6 +1,7 @@
1
1
  export * from './theorem-block.js';
2
2
  export * from './hover-reference-card.js';
3
3
  export * from './code-block.js';
4
+ export * from './component-example.js';
4
5
  export * from './backlinks.js';
5
6
  export * from './page-agent-actions.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  "use client";
2
- export { BacklinksSection, CodeBlock, HoverReferenceCard, MathTheoremBlock, PageAgentActions } from '../chunk-BUM4MVKF.js';
2
+ export { BacklinksSection, CodeBlock, ComponentExample, HoverReferenceCard, MathTheoremBlock, PageAgentActions } from '../chunk-TQNHJCU2.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -350,14 +350,14 @@ function MermaidDiagram({ code }) {
350
350
  "Diagram unavailable: ",
351
351
  state.message
352
352
  ] }),
353
- state.status === "ready" && /* @__PURE__ */ jsx("div", { className: "lumen-diagram-content", style: { overflowX: "auto" }, dangerouslySetInnerHTML: { __html: state.svg } }),
353
+ state.status === "ready" && /* @__PURE__ */ jsx("div", { className: "lumen-diagram-content", tabIndex: 0, role: "group", "aria-label": "Diagram", style: { overflowX: "auto" }, dangerouslySetInnerHTML: { __html: state.svg } }),
354
354
  /* @__PURE__ */ jsxs("details", { open: state.status === "error", className: "lumen-diagram-source", children: [
355
355
  /* @__PURE__ */ jsx("summary", { children: "Diagram source" }),
356
- /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: code }) })
356
+ /* @__PURE__ */ jsx("pre", { className: "lumen-code-block", tabIndex: 0, children: /* @__PURE__ */ jsx("code", { children: code }) })
357
357
  ] })
358
358
  ] });
359
359
  }
360
360
 
361
361
  export { ApiExplorer, MermaidDiagram, NetronPlayground, executeSandboxedCode };
362
- //# sourceMappingURL=chunk-T2RHHJAM.js.map
363
- //# sourceMappingURL=chunk-T2RHHJAM.js.map
362
+ //# sourceMappingURL=chunk-6NFMKJAX.js.map
363
+ //# sourceMappingURL=chunk-6NFMKJAX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactive/api-explorer.tsx","../src/interactive/playground-execution.ts","../src/interactive/playground.tsx","../src/interactive/mermaid-diagram.tsx"],"names":["PLAYGROUND_LIMITS","useId","useState","useRef","useEffect","execution","jsxs","clsx","jsx"],"mappings":";;;;;;;;AAqCO,SAAS,WAAA,CAAY;AAAA,EAC1B,MAAA,GAAS,IAAA;AAAA,EACT,MAAA,GAAS,EAAA;AAAA,EACT,UAAU,EAAC;AAAA,EACX,OAAO,EAAC;AAAA,EACR,UAAU,EAAC;AAAA,EACX,WAAA,GAAc,EAAA;AAAA,EACd,WAAA,GAAc,EAAA;AAAA,EACd,cAAA;AAAA,EACA,UAAA,GAAa,EAAA;AAAA,EACb,aAAA,GAAgB,GAAA;AAAA,EAChB;AACF,CAAA,GAAsB,EAAC,EAAsB;AAC3C,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,WAAW,CAAA;AAChD,EAAA,MAAM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,EAAA,EAAE,MAAK,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,uBAAA;AAAA,MAAsB,KAAA,CAAM;AAAA,KAAA,EAAQ,CAAA;AAAA,IAChF,KAAA,CAAM,MAAA,KAAW,OAAA,oBAAWE,GAAAA,CAAC,SAAI,SAAA,EAAU,uBAAA,EAAwB,QAAA,EAAU,CAAA,EAAG,IAAA,EAAK,OAAA,EAAQ,cAAW,SAAA,EAAU,KAAA,EAAO,EAAE,SAAA,EAAW,MAAA,EAAO,EAAG,yBAAyB,EAAE,MAAA,EAAQ,KAAA,CAAM,GAAA,EAAI,EAAG,CAAA;AAAA,oBACjMF,KAAC,SAAA,EAAA,EAAQ,IAAA,EAAM,MAAM,MAAA,KAAW,OAAA,EAAS,WAAU,sBAAA,EACjD,QAAA,EAAA;AAAA,sBAAAE,GAAAA,CAAC,aAAQ,QAAA,EAAA,gBAAA,EAAc,CAAA;AAAA,sBACvBA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,kBAAA,EAAmB,QAAA,EAAU,CAAA,EAAG,QAAA,kBAAAA,GAAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,IAAA,EAAK,CAAA,EAAO;AAAA,KAAA,EACpE;AAAA,GAAA,EACF,CAAA;AACF","file":"chunk-6NFMKJAX.js","sourcesContent":["import React, { useState, useMemo, useEffect, useRef, useId, useTransition } from 'react';\nimport clsx from 'clsx';\n\nexport interface ApiExplorerMethod {\n name: string;\n signature?: string;\n description?: string;\n visibility?: 'public' | 'protected' | 'private';\n isStatic?: boolean;\n isAsync?: boolean;\n}\n\nexport interface ApiSymbolItem {\n id?: string;\n name: string;\n kind?: string;\n module?: string;\n description?: string;\n signature?: string;\n [key: string]: unknown;\n}\n\nexport interface ApiExplorerProps {\n symbol?: string | null;\n module?: string;\n symbols?: ApiSymbolItem[];\n /** Informational tags; filtering is driven by the symbol search input. */\n tags?: string[];\n methods?: ApiExplorerMethod[];\n description?: string;\n searchQuery?: string;\n onSelectSymbol?: (symbol: ApiSymbolItem | string) => void;\n itemHeight?: number;\n maxListHeight?: number;\n className?: string;\n}\n\nexport function ApiExplorer({\n symbol = null,\n module = '',\n symbols = [],\n tags = [],\n methods = [],\n description = '',\n searchQuery = '',\n onSelectSymbol,\n itemHeight = 36,\n maxListHeight = 400,\n className,\n}: ApiExplorerProps = {}): React.JSX.Element {\n const [filter, setFilter] = useState(searchQuery);\n const [selectedSymbol, setSelectedSymbol] = useState<string | null>(symbol);\n const [scrollTop, setScrollTop] = useState(0);\n const [focusedIndex, setFocusedIndex] = useState(0);\n const listRef = useRef<HTMLDivElement>(null);\n const listId = useId();\n if (!Number.isFinite(itemHeight) || itemHeight <= 0 || !Number.isFinite(maxListHeight) || maxListHeight <= 0) {\n throw new RangeError('API explorer row and viewport heights must be positive finite numbers');\n }\n useEffect(() => setFilter(searchQuery), [searchQuery]);\n useEffect(() => setSelectedSymbol(symbol), [symbol]);\n useEffect(() => {\n setFocusedIndex(0);\n setScrollTop(0);\n if (listRef.current) listRef.current.scrollTop = 0;\n }, [filter, symbols]);\n const [, startTransition] = useTransition();\n\n const filteredSymbols = useMemo(() => {\n if (!filter.trim()) return symbols;\n const lower = filter.toLowerCase();\n return symbols.filter(\n (s) =>\n s.name.toLowerCase().includes(lower) ||\n s.kind?.toLowerCase().includes(lower) ||\n s.module?.toLowerCase().includes(lower)\n );\n }, [symbols, filter]);\n\n const totalItems = filteredSymbols.length;\n const totalHeight = totalItems * itemHeight;\n const startIndex = Math.min(Math.max(0, totalItems - 1), Math.max(0, Math.floor(scrollTop / itemHeight) - 2));\n const visibleCount = Math.ceil(maxListHeight / itemHeight) + 4;\n const endIndex = Math.min(totalItems, startIndex + visibleCount);\n const visibleItems = useMemo(\n () => filteredSymbols.slice(startIndex, endIndex),\n [filteredSymbols, startIndex, endIndex]\n );\n const offsetY = startIndex * itemHeight;\n const selectSymbol = (index: number) => {\n const selected = filteredSymbols[index];\n if (!selected) return;\n setFocusedIndex(index);\n setSelectedSymbol(selected.name);\n onSelectSymbol?.(selected);\n };\n const navigateSymbols = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!totalItems) return;\n const origin = focusedIndex >= startIndex && focusedIndex < endIndex ? focusedIndex : startIndex;\n let next: number;\n switch (event.key) {\n case 'ArrowDown': next = Math.min(totalItems - 1, origin + 1); break;\n case 'ArrowUp': next = Math.max(0, origin - 1); break;\n case 'Home': next = 0; break;\n case 'End': next = totalItems - 1; break;\n case 'PageDown': next = Math.min(totalItems - 1, origin + Math.max(1, Math.floor(maxListHeight / itemHeight))); break;\n case 'PageUp': next = Math.max(0, origin - Math.max(1, Math.floor(maxListHeight / itemHeight))); break;\n case 'Enter': case ' ': event.preventDefault(); event.stopPropagation(); selectSymbol(origin); return;\n default: return;\n }\n event.preventDefault();\n event.stopPropagation();\n setFocusedIndex(next);\n const top = next * itemHeight;\n const bottom = top + itemHeight;\n const position = top < scrollTop ? top : bottom > scrollTop + maxListHeight ? bottom - maxListHeight : scrollTop;\n if (listRef.current) listRef.current.scrollTop = position;\n setScrollTop(position);\n };\n\n return (\n <div\n className={clsx('lumen-api-explorer', className)}\n data-module={module || undefined}\n data-symbol={symbol ?? undefined}\n >\n <header className=\"lumen-api-explorer-header\">\n <div className=\"lumen-api-explorer-title-row\">\n <span className=\"lumen-api-explorer-badge\">API EXPLORER</span>\n {module && <span className=\"lumen-api-explorer-module\">{module}</span>}\n {selectedSymbol && <h3 className=\"lumen-api-explorer-symbol-title\">{selectedSymbol}</h3>}\n </div>\n {description && <p className=\"lumen-api-explorer-desc\">{description}</p>}\n </header>\n\n {symbols.length > 0 && (\n <div className=\"lumen-api-explorer-search\">\n <input\n type=\"search\"\n className=\"lumen-api-explorer-filter-input\"\n placeholder=\"Filter symbols...\"\n aria-label=\"Filter API symbols\"\n aria-controls={listId}\n value={filter}\n onChange={(e) => {\n const val = e.target.value;\n startTransition(() => setFilter(val));\n }}\n />\n </div>\n )}\n\n {symbols.length > 0 && (\n <div\n ref={listRef}\n id={listId}\n role=\"listbox\"\n tabIndex={0}\n aria-label=\"API symbols\"\n aria-activedescendant={focusedIndex >= startIndex && focusedIndex < endIndex ? `${listId}-${focusedIndex}` : undefined}\n onKeyDown={navigateSymbols}\n className=\"lumen-api-explorer-list-container\"\n style={{ maxHeight: maxListHeight, overflowY: 'auto', position: 'relative' }}\n onScroll={(e) => setScrollTop(e.currentTarget.scrollTop)}\n >\n <div style={{ height: totalHeight, position: 'relative', width: '100%' }}>\n <div style={{ transform: `translateY(${offsetY}px)`, position: 'absolute', width: '100%' }}>\n {visibleItems.map((sym, idx) => (\n <div\n key={sym.id || sym.name || idx}\n id={`${listId}-${startIndex + idx}`}\n role=\"option\"\n aria-selected={selectedSymbol === sym.name}\n aria-posinset={startIndex + idx + 1}\n aria-setsize={totalItems}\n className={`lumen-api-symbol-item ${selectedSymbol === sym.name ? 'active' : ''}`}\n data-focused={focusedIndex === startIndex + idx || undefined}\n style={{ height: itemHeight, display: 'flex', alignItems: 'center' }}\n onClick={() => {\n selectSymbol(startIndex + idx);\n listRef.current?.focus();\n }}\n >\n {sym.kind && <span className={`lumen-kind-badge kind-${sym.kind}`}>{sym.kind}</span>}\n <span className=\"lumen-symbol-name\">{sym.name}</span>\n </div>\n ))}\n </div>\n </div>\n </div>\n )}\n\n {symbols.length > 0 && totalItems === 0 && <p role=\"status\">No matching symbols</p>}\n\n {methods.length > 0 && (\n <div className=\"lumen-api-explorer-methods\">\n <h4 className=\"lumen-api-section-title\">Methods</h4>\n <ul className=\"lumen-api-methods-list\">\n {methods.map((m, idx) => (\n <li key={idx} className=\"lumen-api-method-item\">\n <code className=\"lumen-api-method-signature\">{m.signature || m.name}</code>\n {m.description && <p className=\"lumen-api-method-desc\">{m.description}</p>}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {tags.length > 0 && (\n <footer className=\"lumen-api-explorer-footer\">\n <div className=\"lumen-api-tags\">\n {tags.map((tag) => (\n <span key={tag} className=\"lumen-api-tag\">\n #{tag}\n </span>\n ))}\n </div>\n </footer>\n )}\n </div>\n );\n}\n","import { PLAYGROUND_LIMITS } from '@omnitron-dev/lumen-ast/execution/limits';\n\nexport interface PlaygroundWorkerRequest { code: string; timeoutMs: number }\nexport type PlaygroundWorkerResponse = { ok: true; result: unknown } | { ok: false; error: string };\n\n/** One interpreter worker per run, with a host-owned deadline and no host evaluation path. */\nexport function executeSandboxedCode(code: string, timeoutMs: number = PLAYGROUND_LIMITS.timeoutMs, signal?: AbortSignal): Promise<unknown> {\n return new Promise((resolve, reject) => {\n if (typeof code !== 'string' || new TextEncoder().encode(code).length > PLAYGROUND_LIMITS.codeBytes) {\n reject(new Error(`Playground code exceeds ${PLAYGROUND_LIMITS.codeBytes} bytes`));\n return;\n }\n if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > PLAYGROUND_LIMITS.maxTimeoutMs) {\n reject(new Error(`Execution timeout must be between 1 and ${PLAYGROUND_LIMITS.maxTimeoutMs} ms`));\n return;\n }\n if (typeof Worker === 'undefined') {\n reject(new Error('Isolated Web Worker runtime is unavailable'));\n return;\n }\n if (signal?.aborted) { reject(new DOMException('Execution cancelled', 'AbortError')); return; }\n\n let worker: Worker | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let settled = false;\n const finish = (response: PlaygroundWorkerResponse) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n signal?.removeEventListener('abort', abort);\n worker?.terminate();\n if (response.ok) resolve(response.result);\n else reject(new Error(response.error));\n };\n const abort = () => finish({ ok: false, error: 'Execution cancelled' });\n try {\n // tsup emits this worker beside its shared chunks. Vite then resolves and\n // bundles this standard module-worker URL in the final website build.\n worker = new Worker(new URL('./playground-worker.js', import.meta.url), { type: 'module', name: 'lumen-playground' });\n timer = setTimeout(() => finish({ ok: false, error: `Execution timed out after ${timeoutMs}ms` }), timeoutMs);\n signal?.addEventListener('abort', abort, { once: true });\n worker.onmessage = ({ data }: MessageEvent<PlaygroundWorkerResponse>) => {\n if (!data || typeof data !== 'object' || typeof data.ok !== 'boolean') {\n finish({ ok: false, error: 'Invalid interpreter response' });\n } else finish(data);\n };\n worker.onerror = event => {\n event.preventDefault();\n finish({ ok: false, error: event.message || 'Unable to initialize the interpreter worker' });\n };\n worker.onmessageerror = () => finish({ ok: false, error: 'Unable to read the interpreter result' });\n worker.postMessage({ code, timeoutMs } satisfies PlaygroundWorkerRequest);\n } catch (error) {\n finish({ ok: false, error: error instanceof Error ? error.message : String(error) });\n }\n });\n}\n","import React, { useState, useEffect, useRef, useId, useCallback } from 'react';\nimport clsx from 'clsx';\nimport { PLAYGROUND_LIMITS } from '@omnitron-dev/lumen-ast/execution/limits';\nimport { executeSandboxedCode } from './playground-execution.js';\n\nexport interface PlaygroundSnapshot { result: unknown; code: string; timestamp?: number }\n/** Matches the result of the canonical queried LumenService.executePlayground method. */\nexport interface PlaygroundServiceResult { code: string; result: unknown; error?: string }\nexport type PlaygroundExecutor = (code: string) => Promise<PlaygroundServiceResult>;\nexport interface PlaygroundExecutionResult extends PlaygroundServiceResult { executionTimeMs: number }\n\nexport interface NetronPlaygroundProps {\n /** The editable snippet. A changed prop resets the editor and cancels active execution. */\n code?: string;\n mode?: 'local' | 'server';\n /** Bind the executePlayground method from a service queried through Netron. */\n execute?: PlaygroundExecutor;\n /** Includes worker startup; the worker is terminated when this deadline expires. */\n timeoutMs?: number;\n readOnly?: boolean;\n /** Recorded output is labelled separately and is never substituted for a failed run. */\n snapshot?: PlaygroundSnapshot;\n onExecute?: (result: PlaygroundExecutionResult) => void;\n className?: string;\n}\n\ntype RunState = { status: 'idle' | 'running' } | { status: 'complete'; execution: PlaygroundExecutionResult };\n\nfunction formatResult(value: unknown): string {\n return typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value);\n}\n\nexport function NetronPlayground({ code = '', mode, execute, timeoutMs = PLAYGROUND_LIMITS.timeoutMs, readOnly = false, snapshot, onExecute, className }: NetronPlaygroundProps = {}): React.JSX.Element {\n const editorId = useId();\n const [currentCode, setCurrentCode] = useState(code);\n const [run, setRun] = useState<RunState>({ status: 'idle' });\n const active = useRef<AbortController | null>(null);\n const executionMode = mode ?? (execute ? 'server' : 'local');\n\n useEffect(() => {\n active.current?.abort();\n active.current = null;\n setCurrentCode(code);\n setRun({ status: 'idle' });\n }, [code]);\n useEffect(() => () => { active.current?.abort(); }, []);\n\n const executeCode = useCallback(async () => {\n if (readOnly || active.current) return;\n const controller = new AbortController();\n active.current = controller;\n setRun({ status: 'running' });\n const start = performance.now();\n let timer: ReturnType<typeof setTimeout> | undefined;\n let onAbort: (() => void) | undefined;\n let execution: PlaygroundExecutionResult;\n try {\n if (new TextEncoder().encode(currentCode).length > PLAYGROUND_LIMITS.codeBytes)\n throw new Error(`Playground code exceeds ${PLAYGROUND_LIMITS.codeBytes} bytes`);\n let result: unknown;\n if (executionMode === 'server') {\n if (!execute) throw new Error('A Netron executePlayground method is required for server execution');\n if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > PLAYGROUND_LIMITS.maxTimeoutMs)\n throw new Error(`Execution timeout must be between 1 and ${PLAYGROUND_LIMITS.maxTimeoutMs} ms`);\n const remote = await Promise.race([\n execute(currentCode),\n new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error(`Execution timed out after ${timeoutMs}ms`)), timeoutMs);\n onAbort = () => reject(new Error('Execution cancelled'));\n controller.signal.addEventListener('abort', onAbort, { once: true });\n }),\n ]);\n if (!remote || remote.code !== currentCode) throw new Error('The remote result does not match this snippet');\n if (remote.error) throw new Error(remote.error);\n result = remote.result;\n if (new TextEncoder().encode(formatResult(result)).length > PLAYGROUND_LIMITS.resultBytes)\n throw new Error('Result size limit exceeded');\n } else result = await executeSandboxedCode(currentCode, timeoutMs, controller.signal);\n if (controller.signal.aborted) return;\n execution = { code: currentCode, result, executionTimeMs: Math.round(performance.now() - start) };\n } catch (error) {\n if (controller.signal.aborted) return;\n execution = { code: currentCode, result: undefined, error: error instanceof Error ? error.message : String(error), executionTimeMs: Math.round(performance.now() - start) };\n } finally {\n clearTimeout(timer);\n if (onAbort) controller.signal.removeEventListener('abort', onAbort);\n if (active.current === controller) active.current = null;\n }\n setRun({ status: 'complete', execution });\n onExecute?.(execution);\n }, [currentCode, executionMode, execute, timeoutMs, readOnly, onExecute]);\n\n const execution = run.status === 'complete' ? run.execution : undefined;\n return (\n <div className={clsx('lumen-netron-playground', className)} data-runtime={executionMode}>\n <header className=\"lumen-playground-header\">\n <div className=\"lumen-playground-title\">\n <label className=\"lumen-playground-badge\" htmlFor={editorId}>JavaScript playground</label>\n <span className=\"lumen-playground-runtime\">{executionMode === 'server' ? 'Server' : 'Local'}</span>\n </div>\n {!readOnly && <button type=\"button\" className=\"lumen-playground-run-btn\" onClick={executeCode} disabled={run.status === 'running'}>Run code</button>}\n </header>\n <div className=\"lumen-playground-editor\">\n <textarea id={editorId} className=\"lumen-playground-textarea\" value={currentCode} onChange={event => setCurrentCode(event.target.value)} readOnly={readOnly || run.status === 'running'} rows={Math.min(16, Math.max(4, currentCode.split('\\n').length + 1))} placeholder=\"Enter JavaScript to execute\" spellCheck={false} />\n </div>\n {run.status === 'running' && <p role=\"status\">Running code…</p>}\n {execution && (\n <section className=\"lumen-playground-console\" aria-label=\"Execution result\">\n <div className=\"lumen-playground-console-header\"><span>Output</span><span className=\"lumen-playground-duration\">{execution.executionTimeMs}ms</span></div>\n {execution.error\n ? <pre className=\"lumen-playground-error\" role=\"alert\">{execution.error}</pre>\n : <pre className=\"lumen-playground-result\" role=\"status\">{formatResult(execution.result)}</pre>}\n </section>\n )}\n {snapshot?.code === currentCode && (\n <details className=\"lumen-playground-snapshot\"><summary>Recorded output</summary><pre>{formatResult(snapshot.result)}</pre></details>\n )}\n </div>\n );\n}\n","import React, { useEffect, useId, useState } from 'react';\nimport { renderDiagramSvg } from '@omnitron-dev/lumen-ast/diagrams';\nimport { useTheme } from '@mui/material/styles';\nimport { useLumen } from '../hydration/context.js';\n\nexport interface MermaidDiagramProps {\n code: string;\n}\n\ntype DiagramState = { status: 'loading' } | { status: 'ready'; svg: string } | { status: 'error'; message: string };\n\n/** Uses the actual Mermaid engine; invalid diagrams retain their source and error. */\nexport function MermaidDiagram({ code }: MermaidDiagramProps): React.JSX.Element {\n const { theme } = useLumen();\n const { palette, typography } = useTheme();\n const id = `lumen-mermaid-${useId().replace(/[^A-Za-z0-9_-]/g, '')}`;\n const [state, setState] = useState<DiagramState>({ status: 'loading' });\n useEffect(() => {\n const abort = new AbortController();\n setState({ status: 'loading' });\n void renderDiagramSvg(code, id, {\n theme: theme === 'dark' ? 'dark' : 'light', signal: abort.signal,\n colors: { surface: palette.background.paper, foreground: palette.text.primary, muted: palette.text.secondary, accent: palette.primary.main, border: palette.text.secondary },\n fontFamily: typography.fontFamily,\n })\n .then(svg => { if (!abort.signal.aborted) setState({ status: 'ready', svg }); })\n .catch(error => { if (!abort.signal.aborted) setState({ status: 'error', message: error instanceof Error ? error.message : 'Diagram rendering failed' }); });\n return () => abort.abort();\n }, [code, id, theme, palette, typography.fontFamily]);\n\n return <>\n {state.status === 'loading' && <p role=\"status\">Rendering diagram…</p>}\n {state.status === 'error' && <p role=\"alert\">Diagram unavailable: {state.message}</p>}\n {state.status === 'ready' && <div className=\"lumen-diagram-content\" tabIndex={0} role=\"group\" aria-label=\"Diagram\" style={{ overflowX: 'auto' }} dangerouslySetInnerHTML={{ __html: state.svg }} />}\n <details open={state.status === 'error'} className=\"lumen-diagram-source\">\n <summary>Diagram source</summary>\n <pre className=\"lumen-code-block\" tabIndex={0}><code>{code}</code></pre>\n </details>\n </>;\n}\n"]}
@@ -1,9 +1,11 @@
1
1
  import { LumenContext } from './chunk-L2KGVOK3.js';
2
2
  import { parseHydrationTrigger, serializeIslandProps, parseIslandProps } from '@omnitron-dev/lumen-ast/islands';
3
- import React2, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
3
+ import React3, { useState, useRef, useEffect, useMemo, useCallback, useId, useLayoutEffect } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { PrismProvider } from '@omnitron-dev/prism/core';
6
- import { jsx } from 'react/jsx-runtime';
6
+ import { ErrorBoundary } from '@omnitron-dev/prism/components/error-boundary';
7
+ import { Tabs } from '@omnitron-dev/prism/components/tabs';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
9
 
8
10
  function setupTrigger(element, trigger, onTrigger, options) {
9
11
  switch (parseHydrationTrigger(trigger)) {
@@ -111,7 +113,7 @@ function PortalIslandHost({
111
113
  className = "lumen-portal-island",
112
114
  style
113
115
  }) {
114
- return React2.createElement(
116
+ return React3.createElement(
115
117
  "div",
116
118
  {
117
119
  className,
@@ -124,6 +126,109 @@ function PortalIslandHost({
124
126
  children
125
127
  );
126
128
  }
129
+ var syncEvent = "lumen:document-tab-change";
130
+ function fragmentTarget(doc) {
131
+ const hash = doc.defaultView?.location.hash;
132
+ if (!hash) return null;
133
+ try {
134
+ return doc.getElementById(decodeURIComponent(hash.slice(1)));
135
+ } catch {
136
+ return null;
137
+ }
138
+ }
139
+ function DocumentTabs() {
140
+ const strip = useRef(null);
141
+ const instance = useId();
142
+ const [panels, setPanels] = useState([]);
143
+ const [selected, setSelected] = useState(0);
144
+ const group = strip.current?.closest(".lumen-tabs");
145
+ const syncKey = group?.dataset.syncKey;
146
+ useLayoutEffect(() => {
147
+ const container = strip.current?.closest(".lumen-tabs");
148
+ if (!container) return;
149
+ const sections = Array.from(container.querySelectorAll(":scope > .lumen-tab-item"));
150
+ const items = [];
151
+ for (const section of sections) {
152
+ const heading = section.querySelector(":scope > .lumen-tab-label");
153
+ if (!heading) return;
154
+ items.push({ section, heading, value: section.dataset.value ?? heading.textContent ?? "" });
155
+ }
156
+ const doc = container.ownerDocument;
157
+ const anchor = fragmentTarget(doc);
158
+ const peer = container.dataset.syncKey && Array.from(doc.querySelectorAll(".lumen-tabs[data-active-value]")).find((item) => item !== container && item.dataset.syncKey === container.dataset.syncKey);
159
+ const anchored = items.findIndex((item) => anchor && item.section.contains(anchor));
160
+ const anchorPanel = anchor?.closest(".lumen-tab-item");
161
+ const anchorGroup = anchorPanel?.parentElement;
162
+ const anchorValue = container.dataset.syncKey && anchorGroup?.dataset.syncKey === container.dataset.syncKey ? anchorPanel?.dataset.value : void 0;
163
+ const synced = items.findIndex((item) => item.value === (anchorValue ?? (peer && peer.dataset.activeValue)));
164
+ setSelected(anchored >= 0 ? anchored : Math.max(0, synced));
165
+ setPanels(items);
166
+ }, []);
167
+ useLayoutEffect(() => {
168
+ const tabs = strip.current?.querySelectorAll('[role="tab"]');
169
+ if (!group || !panels.length || tabs?.length !== panels.length) return void 0;
170
+ panels.forEach(({ section, heading }, index) => {
171
+ const tab = tabs[index];
172
+ section.id = `${instance}-panel-${index}`;
173
+ section.setAttribute("role", "tabpanel");
174
+ section.setAttribute("aria-labelledby", tab.id);
175
+ section.tabIndex = 0;
176
+ tab.setAttribute("aria-controls", section.id);
177
+ heading.hidden = true;
178
+ section.hidden = index !== selected;
179
+ });
180
+ group.dataset.activeValue = panels[selected].value;
181
+ return () => {
182
+ delete group.dataset.activeValue;
183
+ for (const { section, heading } of panels) {
184
+ section.hidden = false;
185
+ heading.hidden = false;
186
+ for (const attribute of ["id", "role", "aria-labelledby", "tabindex"]) section.removeAttribute(attribute);
187
+ }
188
+ };
189
+ }, [group, instance, panels, selected]);
190
+ useEffect(() => {
191
+ if (!group || !panels.length) return void 0;
192
+ const doc = group.ownerDocument;
193
+ const onSync = (event) => {
194
+ const choice = event.detail;
195
+ if (!choice || choice.key !== syncKey) return;
196
+ const index = panels.findIndex((item) => item.value === choice.value);
197
+ if (index >= 0) setSelected(index);
198
+ };
199
+ const onHashChange = () => {
200
+ const anchor = fragmentTarget(doc);
201
+ const index = panels.findIndex((item) => anchor && item.section.contains(anchor));
202
+ if (index >= 0) {
203
+ setSelected(index);
204
+ if (syncKey) doc.dispatchEvent(new CustomEvent(syncEvent, { detail: { key: syncKey, value: panels[index].value } }));
205
+ }
206
+ };
207
+ if (syncKey) doc.addEventListener(syncEvent, onSync);
208
+ doc.defaultView?.addEventListener("hashchange", onHashChange);
209
+ return () => {
210
+ if (syncKey) doc.removeEventListener(syncEvent, onSync);
211
+ doc.defaultView?.removeEventListener("hashchange", onHashChange);
212
+ };
213
+ }, [group, panels, syncKey]);
214
+ function select(value) {
215
+ const index = Number(value);
216
+ setSelected(index);
217
+ if (syncKey) group?.ownerDocument.dispatchEvent(new CustomEvent(syncEvent, { detail: { key: syncKey, value: panels[index].value } }));
218
+ }
219
+ return /* @__PURE__ */ jsx("div", { ref: strip, children: panels.length > 0 && /* @__PURE__ */ jsx(
220
+ Tabs,
221
+ {
222
+ "aria-label": group?.dataset.label || panels.map((item) => item.heading.textContent).join(" / "),
223
+ tabs: panels.map((item, index) => ({ label: item.heading.textContent ?? item.value, value: String(index) })),
224
+ value: String(selected),
225
+ onChange: select,
226
+ selectionFollowsFocus: true,
227
+ variant: "scrollable",
228
+ scrollButtons: "auto"
229
+ }
230
+ ) });
231
+ }
127
232
  var ISLAND_SELECTOR = ".lumen-portal-island, [data-lumen-island], [data-widget]";
128
233
  var globalElementInstanceCounter = 0;
129
234
  var elementInstanceKeys = /* @__PURE__ */ new WeakMap();
@@ -360,11 +465,26 @@ function PortalIslandManager({
360
465
  clearedSsrElementsRef.current.add(item.element);
361
466
  item.element.replaceChildren();
362
467
  }
363
- portals.push(createPortal(React2.createElement(Component, item.props), item.element, item.instanceKey));
468
+ portals.push(createPortal(
469
+ /* @__PURE__ */ jsx(
470
+ ErrorBoundary,
471
+ {
472
+ resetKeys: [Component, item.islandId, item.rawProps],
473
+ fallback: ({ error }) => /* @__PURE__ */ jsxs("p", { className: "lumen-island-error", role: "alert", children: [
474
+ item.componentName,
475
+ " could not render. ",
476
+ error.message
477
+ ] }),
478
+ children: React3.createElement(Component, item.props)
479
+ }
480
+ ),
481
+ item.element,
482
+ item.instanceKey
483
+ ));
364
484
  }
365
485
  }
366
486
  }
367
- return portals.length > 0 ? React2.createElement(React2.Fragment, null, ...portals) : null;
487
+ return portals.length > 0 ? React3.createElement(React3.Fragment, null, ...portals) : null;
368
488
  }
369
489
  function LumenShellProvider({
370
490
  children,
@@ -375,7 +495,7 @@ function LumenShellProvider({
375
495
  }) {
376
496
  const [dynamicIslands, setDynamicIslands] = useState({});
377
497
  const [activeIslands, setActiveIslands] = useState(() => /* @__PURE__ */ new Set());
378
- const mergedIslands = useMemo(() => ({ ...islands, ...dynamicIslands }), [islands, dynamicIslands]);
498
+ const mergedIslands = useMemo(() => ({ LumenDocumentTabs: DocumentTabs, ...islands, ...dynamicIslands }), [islands, dynamicIslands]);
379
499
  const latestRegistryRef = useRef(mergedIslands);
380
500
  latestRegistryRef.current = mergedIslands;
381
501
  const hydrateHandlerRef = useRef(null);
@@ -418,18 +538,18 @@ function LumenShellProvider({
418
538
  }),
419
539
  [theme, locale, currentPath, mergedIslands, registerIsland, getIsland, activeIslands, hydrateIsland]
420
540
  );
421
- const shellDiv = React2.createElement(
541
+ const shellDiv = React3.createElement(
422
542
  "div",
423
543
  { className: "lumen-shell", "data-theme": theme, "data-locale": locale },
424
544
  children,
425
- React2.createElement(PortalIslandManager, {
545
+ React3.createElement(PortalIslandManager, {
426
546
  registry: mergedIslands,
427
547
  onActiveIslandsChange: handleActiveIslandsChange,
428
548
  hydrateHandlerRef,
429
549
  pendingHydrateIdsRef
430
550
  })
431
551
  );
432
- return React2.createElement(LumenContext.Provider, { value: contextValue }, shellDiv);
552
+ return React3.createElement(LumenContext.Provider, { value: contextValue }, shellDiv);
433
553
  }
434
554
  function LumenShell({
435
555
  children,
@@ -440,7 +560,7 @@ function LumenShell({
440
560
  disablePrismProvider = false
441
561
  }) {
442
562
  const resolvedMode = theme === "light" ? "light" : "dark";
443
- const providerElement = React2.createElement(LumenShellProvider, {
563
+ const providerElement = React3.createElement(LumenShellProvider, {
444
564
  theme,
445
565
  locale,
446
566
  currentPath,
@@ -466,5 +586,5 @@ function LumenShell({
466
586
  }
467
587
 
468
588
  export { LumenShell, PortalIslandHost, PortalIslandManager, setupEventTrigger, setupIdleTrigger, setupInteractionTrigger, setupLoadTrigger, setupTrigger, setupVisibleTrigger };
469
- //# sourceMappingURL=chunk-XUNS2BMG.js.map
470
- //# sourceMappingURL=chunk-XUNS2BMG.js.map
589
+ //# sourceMappingURL=chunk-AQ5PPDEV.js.map
590
+ //# sourceMappingURL=chunk-AQ5PPDEV.js.map