@omnitron-dev/lumen-ui 0.0.0-stage → 0.4.6
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/LICENSE +21 -0
- package/README.md +182 -2
- package/dist/blocks/backlinks.d.ts +7 -0
- package/dist/blocks/backlinks.d.ts.map +1 -0
- package/dist/blocks/code-block.d.ts +9 -0
- package/dist/blocks/code-block.d.ts.map +1 -0
- package/dist/blocks/hover-reference-card.d.ts +11 -0
- package/dist/blocks/hover-reference-card.d.ts.map +1 -0
- package/dist/blocks/index.d.ts +6 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +4 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/page-agent-actions.d.ts +7 -0
- package/dist/blocks/page-agent-actions.d.ts.map +1 -0
- package/dist/blocks/theorem-block.d.ts +15 -0
- package/dist/blocks/theorem-block.d.ts.map +1 -0
- package/dist/chunk-BUM4MVKF.js +72 -0
- package/dist/chunk-BUM4MVKF.js.map +1 -0
- package/dist/chunk-HLB7FMNG.js +536 -0
- package/dist/chunk-HLB7FMNG.js.map +1 -0
- package/dist/chunk-L2KGVOK3.js +21 -0
- package/dist/chunk-L2KGVOK3.js.map +1 -0
- package/dist/chunk-QYBWNZMV.js +159 -0
- package/dist/chunk-QYBWNZMV.js.map +1 -0
- package/dist/chunk-T2RHHJAM.js +363 -0
- package/dist/chunk-T2RHHJAM.js.map +1 -0
- package/dist/chunk-XUNS2BMG.js +470 -0
- package/dist/chunk-XUNS2BMG.js.map +1 -0
- package/dist/hydration/context.d.ts +17 -0
- package/dist/hydration/context.d.ts.map +1 -0
- package/dist/hydration/host.d.ts +13 -0
- package/dist/hydration/host.d.ts.map +1 -0
- package/dist/hydration/index.d.ts +5 -0
- package/dist/hydration/index.d.ts.map +1 -0
- package/dist/hydration/index.js +5 -0
- package/dist/hydration/index.js.map +1 -0
- package/dist/hydration/shell.d.ts +19 -0
- package/dist/hydration/shell.d.ts.map +1 -0
- package/dist/hydration/triggers.d.ts +25 -0
- package/dist/hydration/triggers.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive/api-explorer.d.ts +34 -0
- package/dist/interactive/api-explorer.d.ts.map +1 -0
- package/dist/interactive/index.d.ts +5 -0
- package/dist/interactive/index.d.ts.map +1 -0
- package/dist/interactive/index.js +5 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive/mermaid-diagram.d.ts +7 -0
- package/dist/interactive/mermaid-diagram.d.ts.map +1 -0
- package/dist/interactive/playground-execution.d.ts +14 -0
- package/dist/interactive/playground-execution.d.ts.map +1 -0
- package/dist/interactive/playground-worker.d.ts +2 -0
- package/dist/interactive/playground-worker.d.ts.map +1 -0
- package/dist/interactive/playground.d.ts +32 -0
- package/dist/interactive/playground.d.ts.map +1 -0
- package/dist/navigation/doc-layout.d.ts +9 -0
- package/dist/navigation/doc-layout.d.ts.map +1 -0
- package/dist/navigation/footer.d.ts +30 -0
- package/dist/navigation/footer.d.ts.map +1 -0
- package/dist/navigation/index.d.ts +6 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +4 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/navbar.d.ts +30 -0
- package/dist/navigation/navbar.d.ts.map +1 -0
- package/dist/navigation/pagination.d.ts +12 -0
- package/dist/navigation/pagination.d.ts.map +1 -0
- package/dist/navigation/section-nav.d.ts +15 -0
- package/dist/navigation/section-nav.d.ts.map +1 -0
- package/dist/playground-worker.js +15 -0
- package/dist/playground-worker.js.map +1 -0
- package/dist/search/index.d.ts +4 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +4 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/netron-adapter.d.ts +25 -0
- package/dist/search/netron-adapter.d.ts.map +1 -0
- package/dist/search/pagefind-adapter.d.ts +20 -0
- package/dist/search/pagefind-adapter.d.ts.map +1 -0
- package/dist/search/search-dialog.d.ts +40 -0
- package/dist/search/search-dialog.d.ts.map +1 -0
- package/package.json +83 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LuxQuant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,183 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @omnitron-dev/lumen-ui
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
7
|
+
|
|
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.
|
|
10
|
+
|
|
11
|
+
## Public entry points
|
|
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. |
|
|
20
|
+
|
|
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
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { useState } from 'react';
|
|
30
|
+
import { LumenShell, PortalIslandHost } from '@omnitron-dev/lumen-ui/runtime';
|
|
31
|
+
|
|
32
|
+
function Counter({ initial = 0 }: { initial?: number }) {
|
|
33
|
+
const [count, setCount] = useState(initial);
|
|
34
|
+
return <button onClick={() => setCount(value => value + 1)}>{count}</button>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function Documentation() {
|
|
38
|
+
return (
|
|
39
|
+
<LumenShell theme="dark" locale="en" currentPath="/guide" islands={{ Counter }}>
|
|
40
|
+
<PortalIslandHost
|
|
41
|
+
islandId="example-counter"
|
|
42
|
+
component="Counter"
|
|
43
|
+
hydrate="visible"
|
|
44
|
+
props={{ initial: 3 }}
|
|
45
|
+
>
|
|
46
|
+
<span>Counter starts at 3.</span>
|
|
47
|
+
</PortalIslandHost>
|
|
48
|
+
</LumenShell>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
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
|
|
74
|
+
|
|
75
|
+
```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
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
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
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { NetronPlayground } from '@omnitron-dev/lumen-ui';
|
|
120
|
+
|
|
121
|
+
<NetronPlayground code="return [1, 2, 3].map(value => value * 2)" />;
|
|
122
|
+
```
|
|
123
|
+
|
|
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.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BacklinksSectionProps {
|
|
3
|
+
backlinks?: string[];
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BacklinksSection({ backlinks, className }: BacklinksSectionProps): React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=backlinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backlinks.d.ts","sourceRoot":"","sources":["../../src/blocks/backlinks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,SAAc,EAAE,SAAS,EAAE,EAAE,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAOxG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CodeBlockProps {
|
|
3
|
+
code?: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
copyable?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function CodeBlock({ code, language, copyable, className }: CodeBlockProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=code-block.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export interface HoverReferenceCardProps {
|
|
3
|
+
id: string;
|
|
4
|
+
targetTitle?: string;
|
|
5
|
+
refKind?: 'thm' | 'def' | 'ax' | 'api' | 'doc' | string;
|
|
6
|
+
excerpt?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function HoverReferenceCard({ id, targetTitle, className }: HoverReferenceCardProps): React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=hover-reference-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-reference-card.d.ts","sourceRoot":"","sources":["../../src/blocks/hover-reference-card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9C,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,uBAAuB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAM7G"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":";","file":"index.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PageAgentActionsProps {
|
|
3
|
+
path: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function PageAgentActions({ path, className }: PageAgentActionsProps): React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=page-agent-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-agent-actions.d.ts","sourceRoot":"","sources":["../../src/blocks/page-agent-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAM9F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export type MathEnvironmentType = 'axiom' | 'definition' | 'theorem' | 'lemma' | 'proposition' | 'corollary' | 'proof' | 'remark' | 'example' | 'hypothesis';
|
|
3
|
+
export interface MathTheoremBlockProps {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
envType?: MathEnvironmentType;
|
|
7
|
+
status?: string;
|
|
8
|
+
number?: string;
|
|
9
|
+
dependsOn?: string[];
|
|
10
|
+
proves?: string[];
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function MathTheoremBlock({ id, title, envType, status, number, dependsOn, proves, children, className, }: MathTheoremBlockProps): React.JSX.Element;
|
|
15
|
+
//# sourceMappingURL=theorem-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theorem-block.d.ts","sourceRoot":"","sources":["../../src/blocks/theorem-block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9C,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,YAAY,GACZ,SAAS,GACT,OAAO,GACP,aAAa,GACb,WAAW,GACX,OAAO,GACP,QAAQ,GACR,SAAS,GACT,YAAY,CAAC;AAEjB,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,OAAmB,EACnB,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAwB3C"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React2 from 'react';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import { useCopyToClipboard } from '@omnitron-dev/prism/core';
|
|
6
|
+
|
|
7
|
+
// src/blocks/theorem-block.tsx
|
|
8
|
+
function MathTheoremBlock({
|
|
9
|
+
id,
|
|
10
|
+
title,
|
|
11
|
+
envType = "theorem",
|
|
12
|
+
status,
|
|
13
|
+
number,
|
|
14
|
+
dependsOn,
|
|
15
|
+
proves,
|
|
16
|
+
children,
|
|
17
|
+
className
|
|
18
|
+
}) {
|
|
19
|
+
const upperType = envType.toUpperCase();
|
|
20
|
+
const isProof = envType === "proof";
|
|
21
|
+
return /* @__PURE__ */ jsxs("section", { id, className: clsx("lumen-math-block", `lumen-math-${envType}`, className), "data-status": status, children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("header", { className: "lumen-math-header", children: [
|
|
23
|
+
/* @__PURE__ */ jsx("span", { className: "lumen-math-type", children: upperType }),
|
|
24
|
+
number && /* @__PURE__ */ jsx("span", { className: "lumen-math-number", children: number }),
|
|
25
|
+
title ? /* @__PURE__ */ jsx("span", { className: "lumen-math-title", children: title }) : null,
|
|
26
|
+
/* @__PURE__ */ jsxs("a", { href: `#${id}`, className: "lumen-math-id", children: [
|
|
27
|
+
"#",
|
|
28
|
+
id
|
|
29
|
+
] })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "lumen-math-body", children: [
|
|
32
|
+
children,
|
|
33
|
+
isProof && /* @__PURE__ */ jsx("span", { className: "lumen-math-qed", "aria-label": "End of proof", children: "\u220E" })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
function HoverReferenceCard({ id, targetTitle, className }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("lumen-hover-reference-card", className), "data-reference-id": id, children: targetTitle ?? id });
|
|
39
|
+
}
|
|
40
|
+
function CopyCode({ code }) {
|
|
41
|
+
const { state, copy, reset } = useCopyToClipboard();
|
|
42
|
+
React2.useEffect(reset, [code, reset]);
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: "lumen-code-copy", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Button, { size: "small", onClick: () => {
|
|
45
|
+
void copy(code);
|
|
46
|
+
}, "aria-label": "Copy code", children: "Copy" }),
|
|
47
|
+
state === "success" && /* @__PURE__ */ jsx("span", { role: "status", children: "Copied" }),
|
|
48
|
+
state === "error" && /* @__PURE__ */ jsx("span", { role: "alert", children: "Copy failed. Select the code and copy it manually." })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
function CodeBlock({ code = "", language = "ts", copyable = false, className }) {
|
|
52
|
+
const source = /* @__PURE__ */ jsx("pre", { className: clsx(`lumen-code-block language-${language}`, className), children: /* @__PURE__ */ jsx("code", { children: code }) });
|
|
53
|
+
return copyable ? /* @__PURE__ */ jsxs("div", { className: "lumen-code-frame", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(CopyCode, { code }),
|
|
55
|
+
source
|
|
56
|
+
] }) : source;
|
|
57
|
+
}
|
|
58
|
+
function BacklinksSection({ backlinks = [], className }) {
|
|
59
|
+
return React2.createElement(
|
|
60
|
+
"section",
|
|
61
|
+
{ className: clsx("lumen-backlinks", className) },
|
|
62
|
+
React2.createElement("h4", null, "Backlinks"),
|
|
63
|
+
React2.createElement("ul", null, ...backlinks.map((link) => React2.createElement("li", { key: link }, link)))
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function PageAgentActions({ path, className }) {
|
|
67
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("lumen-page-agent-actions", className), "data-path": path, children: /* @__PURE__ */ jsx("a", { href: `${path}.md`, children: "View Clean Markdown" }) });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { BacklinksSection, CodeBlock, HoverReferenceCard, MathTheoremBlock, PageAgentActions };
|
|
71
|
+
//# sourceMappingURL=chunk-BUM4MVKF.js.map
|
|
72
|
+
//# sourceMappingURL=chunk-BUM4MVKF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blocks/theorem-block.tsx","../src/blocks/hover-reference-card.tsx","../src/blocks/code-block.tsx","../src/blocks/backlinks.tsx","../src/blocks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sourcesContent":["import React, { type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport type MathEnvironmentType =\n | 'axiom'\n | 'definition'\n | 'theorem'\n | 'lemma'\n | 'proposition'\n | 'corollary'\n | 'proof'\n | 'remark'\n | 'example'\n | 'hypothesis';\n\nexport interface MathTheoremBlockProps {\n id: string;\n title?: string;\n envType?: MathEnvironmentType;\n status?: string;\n number?: string;\n dependsOn?: string[];\n proves?: string[];\n children?: ReactNode;\n className?: string;\n}\n\nexport function MathTheoremBlock({\n id,\n title,\n envType = 'theorem',\n status,\n number,\n dependsOn,\n proves,\n children,\n className,\n}: MathTheoremBlockProps): React.JSX.Element {\n const upperType = envType.toUpperCase();\n const isProof = envType === 'proof';\n\n return (\n <section id={id} className={clsx('lumen-math-block', `lumen-math-${envType}`, className)} data-status={status}>\n <header className=\"lumen-math-header\">\n <span className=\"lumen-math-type\">{upperType}</span>\n {number && <span className=\"lumen-math-number\">{number}</span>}\n {title ? <span className=\"lumen-math-title\">{title}</span> : null}\n <a href={`#${id}`} className=\"lumen-math-id\">\n #{id}\n </a>\n </header>\n <div className=\"lumen-math-body\">\n {children}\n {isProof && (\n <span className=\"lumen-math-qed\" aria-label=\"End of proof\">\n ∎\n </span>\n )}\n </div>\n </section>\n );\n}\n","import React, { type ReactNode } from 'react';\nimport clsx from 'clsx';\n\nexport interface HoverReferenceCardProps {\n id: string;\n targetTitle?: string;\n refKind?: 'thm' | 'def' | 'ax' | 'api' | 'doc' | string;\n excerpt?: string;\n children?: ReactNode;\n className?: string;\n}\n\nexport function HoverReferenceCard({ id, targetTitle, className }: HoverReferenceCardProps): React.JSX.Element {\n return (\n <div className={clsx('lumen-hover-reference-card', className)} data-reference-id={id}>\n {targetTitle ?? id}\n </div>\n );\n}\n","import React from 'react';\nimport clsx from 'clsx';\nimport Button from '@mui/material/Button';\nimport { useCopyToClipboard } from '@omnitron-dev/prism/core';\n\nexport interface CodeBlockProps {\n code?: string;\n language?: string;\n copyable?: boolean;\n className?: string;\n}\n\nfunction CopyCode({ code }: { code: string }): React.JSX.Element {\n const { state, copy, reset } = useCopyToClipboard();\n React.useEffect(reset, [code, reset]);\n return <div className=\"lumen-code-copy\">\n <Button size=\"small\" onClick={() => { void copy(code); }} aria-label=\"Copy code\">Copy</Button>\n {state === 'success' && <span role=\"status\">Copied</span>}\n {state === 'error' && <span role=\"alert\">Copy failed. Select the code and copy it manually.</span>}\n </div>;\n}\n\nexport function CodeBlock({ code = '', language = 'ts', copyable = false, className }: CodeBlockProps): React.JSX.Element {\n const source = (\n <pre className={clsx(`lumen-code-block language-${language}`, className)}>\n <code>{code}</code>\n </pre>\n );\n return copyable ? <div className=\"lumen-code-frame\"><CopyCode code={code} />{source}</div> : source;\n}\n","import React from 'react';\nimport clsx from 'clsx';\n\nexport interface BacklinksSectionProps {\n backlinks?: string[];\n className?: string;\n}\n\nexport function BacklinksSection({ backlinks = [], className }: BacklinksSectionProps): React.JSX.Element {\n return React.createElement(\n 'section',\n { className: clsx('lumen-backlinks', className) },\n React.createElement('h4', null, 'Backlinks'),\n React.createElement('ul', null, ...backlinks.map((link) => React.createElement('li', { key: link }, link)))\n );\n}\n","import React from 'react';\nimport clsx from 'clsx';\n\nexport interface PageAgentActionsProps {\n path: string;\n className?: string;\n}\n\nexport function PageAgentActions({ path, className }: PageAgentActionsProps): React.JSX.Element {\n return (\n <div className={clsx('lumen-page-agent-actions', className)} data-path={path}>\n <a href={`${path}.md`}>View Clean Markdown</a>\n </div>\n );\n}\n"]}
|