@lynx-js/genui 0.0.1 → 0.0.3
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 +5 -9
- package/a2ui/AGENTS.md +167 -0
- package/a2ui/README.md +76 -780
- package/a2ui/README_zh.md +103 -0
- package/a2ui/dist/catalog/Button/{index.js → index.jsx} +12 -8
- package/a2ui/dist/catalog/Button/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Card/{index.js → index.jsx} +5 -4
- package/a2ui/dist/catalog/Card/index.jsx.map +1 -0
- package/a2ui/dist/catalog/CheckBox/{index.js → index.jsx} +11 -6
- package/a2ui/dist/catalog/CheckBox/index.jsx.map +1 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx +98 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Column/{index.js → index.jsx} +10 -7
- package/a2ui/dist/catalog/Column/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/DateTimeInput/index.jsx +249 -0
- package/a2ui/dist/catalog/DateTimeInput/index.jsx.map +1 -0
- package/a2ui/dist/catalog/DateTimeInput/utils.d.ts +0 -1
- package/a2ui/dist/catalog/DateTimeInput/utils.js +0 -3
- package/a2ui/dist/catalog/DateTimeInput/utils.js.map +1 -1
- package/a2ui/dist/catalog/Divider/index.jsx +7 -0
- package/a2ui/dist/catalog/Divider/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Icon/{index.js → index.jsx} +4 -3
- package/a2ui/dist/catalog/Icon/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Image/{index.js → index.jsx} +2 -3
- package/a2ui/dist/catalog/Image/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/LineChart/{index.js → index.jsx} +50 -13
- package/a2ui/dist/catalog/LineChart/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/List/{index.js → index.jsx} +9 -6
- package/a2ui/dist/catalog/List/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Loading/catalog.json +15 -0
- package/a2ui/dist/catalog/Loading/index.d.ts +10 -0
- package/a2ui/dist/catalog/Loading/index.jsx +11 -0
- package/a2ui/dist/catalog/Loading/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Modal/{index.js → index.jsx} +18 -9
- package/a2ui/dist/catalog/Modal/index.jsx.map +1 -0
- package/a2ui/dist/catalog/PieChart/{index.js → index.jsx} +41 -15
- package/a2ui/dist/catalog/PieChart/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/RadioGroup/{index.js → index.jsx} +18 -5
- package/a2ui/dist/catalog/RadioGroup/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Row/{index.js → index.jsx} +10 -7
- package/a2ui/dist/catalog/Row/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Slider/{index.js → index.jsx} +22 -7
- package/a2ui/dist/catalog/Slider/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Tabs/index.jsx +40 -0
- package/a2ui/dist/catalog/Tabs/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Text/catalog.json +6 -2
- package/a2ui/dist/catalog/Text/index.d.ts +1 -1
- package/a2ui/dist/catalog/Text/index.jsx +16 -0
- package/a2ui/dist/catalog/Text/index.jsx.map +1 -0
- package/a2ui/dist/catalog/TextField/{index.js → index.jsx} +8 -5
- package/a2ui/dist/catalog/TextField/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/defineCatalog.d.ts +0 -4
- package/a2ui/dist/catalog/defineCatalog.js.map +1 -1
- package/a2ui/dist/catalog/index.d.ts +20 -19
- package/a2ui/dist/catalog/index.js +41 -21
- package/a2ui/dist/catalog/index.js.map +1 -1
- package/a2ui/dist/catalog.json +2548 -0
- package/a2ui/dist/index.d.ts +1 -1
- package/a2ui/dist/index.js +2 -2
- package/a2ui/dist/index.js.map +1 -1
- package/a2ui/dist/react/A2UI.d.ts +1 -1
- package/a2ui/dist/react/{A2UI.js → A2UI.jsx} +6 -5
- package/a2ui/dist/react/{A2UI.js.map → A2UI.jsx.map} +1 -1
- package/a2ui/dist/react/{A2UIProvider.js → A2UIProvider.jsx} +2 -3
- package/a2ui/dist/react/{A2UIProvider.js.map → A2UIProvider.jsx.map} +1 -1
- package/a2ui/dist/react/{A2UIRenderer.js → A2UIRenderer.jsx} +32 -32
- package/a2ui/dist/react/A2UIRenderer.jsx.map +1 -0
- package/a2ui/dist/react/index.d.ts +3 -3
- package/a2ui/dist/react/index.js +2 -2
- package/a2ui/dist/react/index.js.map +1 -1
- package/a2ui/dist/react/useA2UIContext.d.ts +1 -1
- package/a2ui/dist/react/useA2UIContext.js +1 -1
- package/a2ui/dist/react/useA2UIContext.js.map +1 -1
- package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui/docs/catalog-guide.md +401 -0
- package/a2ui/docs/catalog-guide_zh.md +373 -0
- package/a2ui/docs/overview.md +312 -0
- package/a2ui/docs/overview_zh.md +289 -0
- package/a2ui/docs/system-prompts.md +187 -0
- package/a2ui/docs/system-prompts_zh.md +187 -0
- package/a2ui/src/catalog/README.md +12 -0
- package/a2ui/src/catalog/index.ts +51 -0
- package/a2ui/src/catalog/readme_zh.md +11 -0
- package/a2ui/src/index.ts +115 -0
- package/a2ui/styles/catalog/Button.css +5 -5
- package/a2ui/styles/catalog/DateTimeInput.css +22 -30
- package/a2ui/styles/catalog/Loading.css +61 -0
- package/a2ui/styles/catalog/Modal.css +1 -0
- package/a2ui/styles/catalog/Text.css +2 -6
- package/a2ui-catalog-extractor/README.md +14 -7
- package/a2ui-catalog-extractor/dist/cli.d.ts +1 -0
- package/a2ui-catalog-extractor/dist/cli.js +15 -6
- package/a2ui-catalog-extractor/dist/cli.js.map +1 -1
- package/a2ui-catalog-extractor/dist/index.d.ts +9 -2
- package/a2ui-catalog-extractor/dist/index.js +52 -6
- package/a2ui-catalog-extractor/dist/index.js.map +1 -1
- package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui-catalog-extractor/skills/a2ui-catalog-extractor/SKILL.md +1 -1
- package/a2ui-prompt/README.md +3 -2
- package/a2ui-prompt/dist/index.d.ts +2 -0
- package/a2ui-prompt/dist/index.js +259 -184
- package/cli/README.md +26 -0
- package/cli/bin/cli.js +7 -265
- package/cli/dist/a2ui/create.d.ts +5 -0
- package/cli/dist/a2ui/create.js +178 -0
- package/cli/dist/a2ui/create.js.map +1 -0
- package/cli/dist/a2ui/index.d.ts +5 -0
- package/cli/dist/a2ui/index.js +170 -0
- package/cli/dist/a2ui/index.js.map +1 -0
- package/cli/dist/cli.d.ts +4 -0
- package/cli/dist/cli.js +40 -0
- package/cli/dist/cli.js.map +1 -0
- package/cli/dist/openui.d.ts +1 -0
- package/cli/dist/openui.js +21 -0
- package/cli/dist/openui.js.map +1 -0
- package/cli/dist/tsconfig.build.tsbuildinfo +1 -0
- package/cli/dist/utils.d.ts +2 -0
- package/cli/dist/utils.js +17 -0
- package/cli/dist/utils.js.map +1 -0
- package/cli/templates/default/lynx.config.ts +13 -0
- package/cli/templates/default/package.json +27 -0
- package/cli/templates/default/src/App.css +88 -0
- package/cli/templates/default/src/App.tsx +100 -0
- package/cli/templates/default/src/index.tsx +10 -0
- package/cli/templates/default/src/messages.ts +158 -0
- package/cli/templates/default/src/rspeedy-env.d.ts +14 -0
- package/cli/templates/default/src/tsconfig.json +17 -0
- package/cli/templates/default/tsconfig.json +15 -0
- package/cli/templates/default/tsconfig.node.json +16 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/openui/README.md +50 -46
- package/openui/dist/catalog/Action/{index.js → index.jsx} +1 -1
- package/openui/dist/catalog/Action/index.jsx.map +1 -0
- package/openui/dist/catalog/Button/index.d.ts +8 -8
- package/openui/dist/catalog/Button/{index.js → index.jsx} +28 -14
- package/openui/dist/catalog/Button/index.jsx.map +1 -0
- package/openui/dist/catalog/Card/index.d.ts +1 -1
- package/openui/dist/catalog/Card/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/Card/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/CardHeader/index.d.ts +1 -1
- package/openui/dist/catalog/CardHeader/index.jsx +20 -0
- package/openui/dist/catalog/CardHeader/index.jsx.map +1 -0
- package/openui/dist/catalog/CheckBox/index.d.ts +16 -0
- package/openui/dist/catalog/CheckBox/index.jsx +82 -0
- package/openui/dist/catalog/CheckBox/index.jsx.map +1 -0
- package/openui/dist/catalog/Icon/index.d.ts +44 -0
- package/openui/dist/catalog/Icon/index.jsx +66 -0
- package/openui/dist/catalog/Icon/index.jsx.map +1 -0
- package/openui/dist/catalog/Image/index.d.ts +19 -0
- package/openui/dist/catalog/Image/index.jsx +40 -0
- package/openui/dist/catalog/Image/index.jsx.map +1 -0
- package/openui/dist/catalog/Loading/index.d.ts +7 -0
- package/openui/dist/catalog/Loading/index.jsx +25 -0
- package/openui/dist/catalog/Loading/index.jsx.map +1 -0
- package/openui/dist/catalog/RadioGroup/index.d.ts +21 -0
- package/openui/dist/catalog/RadioGroup/index.jsx +99 -0
- package/openui/dist/catalog/RadioGroup/index.jsx.map +1 -0
- package/openui/dist/catalog/Separator/index.d.ts +1 -1
- package/openui/dist/catalog/Separator/{index.js → index.jsx} +3 -4
- package/openui/dist/catalog/Separator/index.jsx.map +1 -0
- package/openui/dist/catalog/Slider/index.d.ts +19 -0
- package/openui/dist/catalog/Slider/index.jsx +139 -0
- package/openui/dist/catalog/Slider/index.jsx.map +1 -0
- package/openui/dist/catalog/Stack/index.d.ts +1 -1
- package/openui/dist/catalog/Stack/{index.js → index.jsx} +3 -4
- package/openui/dist/catalog/Stack/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/Tag/index.d.ts +1 -1
- package/openui/dist/catalog/Tag/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/Tag/index.jsx.map +1 -0
- package/openui/dist/catalog/TextContent/index.d.ts +1 -1
- package/openui/dist/catalog/TextContent/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/TextContent/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/TextField/index.d.ts +23 -0
- package/openui/dist/catalog/TextField/index.jsx +132 -0
- package/openui/dist/catalog/TextField/index.jsx.map +1 -0
- package/openui/dist/catalog/index.d.ts +14 -7
- package/openui/dist/catalog/index.js +14 -7
- package/openui/dist/catalog/index.js.map +1 -1
- package/openui/dist/core/context.d.ts +17 -7
- package/openui/dist/core/{context.js → context.jsx} +8 -2
- package/openui/dist/core/context.jsx.map +1 -0
- package/openui/dist/core/createLibrary.d.ts +1 -1
- package/openui/dist/core/{createLibrary.js → createLibrary.jsx} +14 -3
- package/openui/dist/core/createLibrary.jsx.map +1 -0
- package/openui/dist/core/hooks/index.d.ts +1 -0
- package/openui/dist/core/hooks/index.js +1 -0
- package/openui/dist/core/hooks/index.js.map +1 -1
- package/openui/dist/core/hooks/useOpenUIState.d.ts +2 -2
- package/openui/dist/core/hooks/useOpenUIState.js +3 -1
- package/openui/dist/core/hooks/useOpenUIState.js.map +1 -1
- package/openui/dist/core/hooks/useStateField.js +1 -1
- package/openui/dist/core/hooks/useStateField.js.map +1 -1
- package/openui/dist/core/index.d.ts +13 -7
- package/openui/dist/core/index.js +7 -4
- package/openui/dist/core/index.js.map +1 -1
- package/openui/dist/core/{library.js → library.jsx} +1 -1
- package/openui/dist/core/library.jsx.map +1 -0
- package/openui/dist/core/renderer.css +527 -0
- package/openui/dist/core/renderer.d.ts +31 -4
- package/openui/dist/core/renderer.jsx +281 -0
- package/openui/dist/core/renderer.jsx.map +1 -0
- package/openui/dist/core/runtime/index.d.ts +1 -0
- package/openui/dist/core/runtime/index.js +5 -0
- package/openui/dist/core/runtime/index.js.map +1 -0
- package/openui/dist/core/runtime/reactive.d.ts +7 -0
- package/openui/dist/core/runtime/reactive.js +10 -0
- package/openui/dist/core/runtime/reactive.js.map +1 -0
- package/package.json +18 -8
- package/a2ui/dist/catalog/Button/index.js.map +0 -1
- package/a2ui/dist/catalog/Card/index.js.map +0 -1
- package/a2ui/dist/catalog/CheckBox/index.js.map +0 -1
- package/a2ui/dist/catalog/ChoicePicker/index.js +0 -66
- package/a2ui/dist/catalog/ChoicePicker/index.js.map +0 -1
- package/a2ui/dist/catalog/DateTimeInput/index.js +0 -147
- package/a2ui/dist/catalog/DateTimeInput/index.js.map +0 -1
- package/a2ui/dist/catalog/Divider/index.js +0 -8
- package/a2ui/dist/catalog/Divider/index.js.map +0 -1
- package/a2ui/dist/catalog/Modal/index.js.map +0 -1
- package/a2ui/dist/catalog/RadioGroup/index.js.map +0 -1
- package/a2ui/dist/catalog/Row/index.js.map +0 -1
- package/a2ui/dist/catalog/Tabs/index.js +0 -32
- package/a2ui/dist/catalog/Tabs/index.js.map +0 -1
- package/a2ui/dist/catalog/Text/index.js +0 -27
- package/a2ui/dist/catalog/Text/index.js.map +0 -1
- package/a2ui/dist/react/A2UIRenderer.js.map +0 -1
- package/openui/dist/catalog/Action/index.js.map +0 -1
- package/openui/dist/catalog/Button/index.js.map +0 -1
- package/openui/dist/catalog/CardHeader/index.js +0 -18
- package/openui/dist/catalog/CardHeader/index.js.map +0 -1
- package/openui/dist/catalog/Separator/index.js.map +0 -1
- package/openui/dist/catalog/Tag/index.js.map +0 -1
- package/openui/dist/core/context.js.map +0 -1
- package/openui/dist/core/createLibrary.js.map +0 -1
- package/openui/dist/core/library.js.map +0 -1
- package/openui/dist/core/renderer.js +0 -139
- package/openui/dist/core/renderer.js.map +0 -1
package/openui/README.md
CHANGED
|
@@ -9,7 +9,9 @@ This package includes:
|
|
|
9
9
|
- `createOpenUiLibrary`: factory that builds an OpenUI `Library` instance
|
|
10
10
|
with built-in components, fully customizable via options.
|
|
11
11
|
- `defineComponent`: define custom components with Zod-validated props.
|
|
12
|
-
- `OpenUiRenderer`: ReactLynx component that
|
|
12
|
+
- `OpenUiRenderer`: ReactLynx component that parses and renders OpenUI Lang
|
|
13
|
+
v0.5 responses, including `$variables`, `Query()`, `Mutation()`, and
|
|
14
|
+
`Action([@...])` steps.
|
|
13
15
|
- `createParser` / `createStreamingParser`: parse OpenUI DSL text
|
|
14
16
|
(functional notation) into a renderable AST.
|
|
15
17
|
- `catalog/*`: built-in component renderers (Stack, Card, CardHeader,
|
|
@@ -34,48 +36,28 @@ pnpm add @lynx-js/genui
|
|
|
34
36
|
|
|
35
37
|
## Quick Start
|
|
36
38
|
|
|
37
|
-
1. Create a library
|
|
38
|
-
2.
|
|
39
|
-
3.
|
|
40
|
-
4. Render the parse result with `<OpenUiRenderer>`.
|
|
39
|
+
1. Create a library.
|
|
40
|
+
2. Pass raw OpenUI Lang text to `<OpenUiRenderer response={...}>`.
|
|
41
|
+
3. Handle actions from `@ToAssistant()` / `@OpenUrl()` with `onAction`.
|
|
41
42
|
|
|
42
43
|
```tsx
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
createStreamingParser,
|
|
46
|
-
OpenUiRenderer,
|
|
47
|
-
} from '@lynx-js/genui/openui';
|
|
48
|
-
import type { ParseResult } from '@lynx-js/genui/openui';
|
|
49
|
-
import { useEffect, useMemo, useState } from '@lynx-js/react';
|
|
50
|
-
|
|
51
|
-
const library = createOpenUiLibrary();
|
|
52
|
-
const schema = library.toJSONSchema();
|
|
53
|
-
|
|
54
|
-
export function App() {
|
|
55
|
-
const [result, setResult] = useState<ParseResult | null>(null);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const parser = createStreamingParser(schema);
|
|
44
|
+
import { createOpenUiLibrary, OpenUiRenderer } from '@lynx-js/genui/openui';
|
|
45
|
+
import { useMemo } from '@lynx-js/react';
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
const rawText = `
|
|
47
|
+
const rawText = `
|
|
62
48
|
root = Stack([header, card], "column", "l", "center")
|
|
63
49
|
header = TextContent("Hello OpenUI", "large-heavy")
|
|
64
50
|
card = Card([content, btn], "card")
|
|
65
51
|
content = TextContent("Welcome to OpenUI")
|
|
66
52
|
btn = Buttons([Button("Get Started", Action([@ToAssistant("clicked")]), "primary")])
|
|
67
|
-
|
|
53
|
+
`.trim();
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setResult(parsed);
|
|
72
|
-
}, []);
|
|
73
|
-
|
|
74
|
-
if (!result?.root) return null;
|
|
55
|
+
export function App() {
|
|
56
|
+
const library = useMemo(() => createOpenUiLibrary(), []);
|
|
75
57
|
|
|
76
58
|
return (
|
|
77
59
|
<OpenUiRenderer
|
|
78
|
-
|
|
60
|
+
response={rawText}
|
|
79
61
|
library={library}
|
|
80
62
|
onAction={(event) => {
|
|
81
63
|
console.log('Action:', event.humanFriendlyMessage);
|
|
@@ -91,28 +73,21 @@ For real-time streaming scenarios (e.g., LLM output), feed chunks
|
|
|
91
73
|
incrementally:
|
|
92
74
|
|
|
93
75
|
```tsx
|
|
94
|
-
import {
|
|
95
|
-
|
|
96
|
-
createStreamingParser,
|
|
97
|
-
OpenUiRenderer,
|
|
98
|
-
} from '@lynx-js/genui/openui';
|
|
99
|
-
import type { ParseResult } from '@lynx-js/genui/openui';
|
|
100
|
-
import { useEffect, useMemo, useRef, useState } from '@lynx-js/react';
|
|
76
|
+
import { createOpenUiLibrary, OpenUiRenderer } from '@lynx-js/genui/openui';
|
|
77
|
+
import { useEffect, useMemo, useState } from '@lynx-js/react';
|
|
101
78
|
|
|
102
79
|
const CHUNK_SIZE = 8;
|
|
103
80
|
const STREAM_DELAY_MS = 30;
|
|
104
81
|
|
|
105
82
|
export function StreamingApp({ rawText }: { rawText: string }) {
|
|
106
83
|
const library = useMemo(() => createOpenUiLibrary(), []);
|
|
107
|
-
const [
|
|
84
|
+
const [response, setResponse] = useState('');
|
|
108
85
|
const [isStreaming, setIsStreaming] = useState(false);
|
|
109
86
|
|
|
110
87
|
useEffect(() => {
|
|
111
88
|
let cancelled = false;
|
|
112
89
|
setIsStreaming(true);
|
|
113
|
-
|
|
114
|
-
const schema = library.toJSONSchema();
|
|
115
|
-
const parser = createStreamingParser(schema);
|
|
90
|
+
setResponse('');
|
|
116
91
|
let offset = 0;
|
|
117
92
|
|
|
118
93
|
const tick = () => {
|
|
@@ -122,7 +97,7 @@ export function StreamingApp({ rawText }: { rawText: string }) {
|
|
|
122
97
|
}
|
|
123
98
|
const chunk = rawText.slice(offset, offset + CHUNK_SIZE);
|
|
124
99
|
offset += CHUNK_SIZE;
|
|
125
|
-
|
|
100
|
+
setResponse((prev) => prev + chunk);
|
|
126
101
|
setTimeout(tick, STREAM_DELAY_MS);
|
|
127
102
|
};
|
|
128
103
|
|
|
@@ -132,11 +107,9 @@ export function StreamingApp({ rawText }: { rawText: string }) {
|
|
|
132
107
|
};
|
|
133
108
|
}, [library, rawText]);
|
|
134
109
|
|
|
135
|
-
if (!result?.root) return null;
|
|
136
|
-
|
|
137
110
|
return (
|
|
138
111
|
<OpenUiRenderer
|
|
139
|
-
|
|
112
|
+
response={response}
|
|
140
113
|
library={library}
|
|
141
114
|
isStreaming={isStreaming}
|
|
142
115
|
/>
|
|
@@ -144,6 +117,37 @@ export function StreamingApp({ rawText }: { rawText: string }) {
|
|
|
144
117
|
}
|
|
145
118
|
```
|
|
146
119
|
|
|
120
|
+
## v0.5 Runtime
|
|
121
|
+
|
|
122
|
+
Use the `response` renderer entry point for v0.5 features:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
const ui = `
|
|
126
|
+
$title = ""
|
|
127
|
+
data = Query("list_items", { search: $title }, { rows: [] })
|
|
128
|
+
save = Mutation("save_item", { title: $title })
|
|
129
|
+
root = Stack([
|
|
130
|
+
TextContent("Rows: " + @Count(data.rows)),
|
|
131
|
+
Button("Save", Action([@Run(save), @Run(data), @Reset($title)]))
|
|
132
|
+
])
|
|
133
|
+
`.trim();
|
|
134
|
+
|
|
135
|
+
<OpenUiRenderer
|
|
136
|
+
response={ui}
|
|
137
|
+
library={library}
|
|
138
|
+
toolProvider={{
|
|
139
|
+
list_items: async (args) => ({ rows: [] }),
|
|
140
|
+
save_item: async (args) => ({ ok: true }),
|
|
141
|
+
}}
|
|
142
|
+
onStateUpdate={(state) => persist(state)}
|
|
143
|
+
initialState={{ $title: 'Draft' }}
|
|
144
|
+
/>;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`OpenUiRenderer` still accepts `result={parseResult}` for legacy/static
|
|
148
|
+
callers, but `Query()`, `Mutation()`, `$variables`, and runtime expression
|
|
149
|
+
evaluation require the raw `response` path.
|
|
150
|
+
|
|
147
151
|
## Customizing the Library
|
|
148
152
|
|
|
149
153
|
`createOpenUiLibrary` accepts an optional `CreateOpenUiLibraryOptions`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/Action/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAY3B,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC;IACtC,gBAAgB;IAChB,kBAAkB;CACnB,CAAC,CAAC;AACH,WAAW,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
export declare const Button: import("../../core/library.
|
|
2
|
+
export declare const Button: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
3
|
label: z.ZodString;
|
|
4
|
-
action: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
action: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
5
5
|
steps: z.ZodArray<z.ZodObject<{
|
|
6
6
|
type: z.ZodString;
|
|
7
7
|
}, z.core.$loose>>;
|
|
@@ -10,7 +10,7 @@ export declare const Button: import("../../core/library.js").DefinedComponent<z.
|
|
|
10
10
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
11
11
|
url: z.ZodOptional<z.ZodString>;
|
|
12
12
|
context: z.ZodOptional<z.ZodString>;
|
|
13
|
-
}, z.core.$strip>]
|
|
13
|
+
}, z.core.$strip>]>>;
|
|
14
14
|
variant: z.ZodOptional<z.ZodEnum<{
|
|
15
15
|
primary: "primary";
|
|
16
16
|
secondary: "secondary";
|
|
@@ -27,10 +27,10 @@ export declare const Button: import("../../core/library.js").DefinedComponent<z.
|
|
|
27
27
|
large: "large";
|
|
28
28
|
}>>;
|
|
29
29
|
}, z.core.$strip>>;
|
|
30
|
-
export declare const Buttons: import("../../core/library.
|
|
30
|
+
export declare const Buttons: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
31
31
|
buttons: z.ZodArray<z.core.$ZodType<import("@openuidev/lang-core").SubComponentOf<{
|
|
32
32
|
label: string;
|
|
33
|
-
action
|
|
33
|
+
action?: {
|
|
34
34
|
steps: {
|
|
35
35
|
[x: string]: unknown;
|
|
36
36
|
type: string;
|
|
@@ -40,13 +40,13 @@ export declare const Buttons: import("../../core/library.js").DefinedComponent<z
|
|
|
40
40
|
params?: Record<string, any> | undefined;
|
|
41
41
|
url?: string | undefined;
|
|
42
42
|
context?: string | undefined;
|
|
43
|
-
};
|
|
43
|
+
} | undefined;
|
|
44
44
|
variant?: "primary" | "secondary" | "tertiary" | undefined;
|
|
45
45
|
type?: "normal" | "destructive" | undefined;
|
|
46
46
|
size?: "extra-small" | "small" | "medium" | "large" | undefined;
|
|
47
47
|
}>, unknown, z.core.$ZodTypeInternals<import("@openuidev/lang-core").SubComponentOf<{
|
|
48
48
|
label: string;
|
|
49
|
-
action
|
|
49
|
+
action?: {
|
|
50
50
|
steps: {
|
|
51
51
|
[x: string]: unknown;
|
|
52
52
|
type: string;
|
|
@@ -56,7 +56,7 @@ export declare const Buttons: import("../../core/library.js").DefinedComponent<z
|
|
|
56
56
|
params?: Record<string, any> | undefined;
|
|
57
57
|
url?: string | undefined;
|
|
58
58
|
context?: string | undefined;
|
|
59
|
-
};
|
|
59
|
+
} | undefined;
|
|
60
60
|
variant?: "primary" | "secondary" | "tertiary" | undefined;
|
|
61
61
|
type?: "normal" | "destructive" | undefined;
|
|
62
62
|
size?: "extra-small" | "small" | "medium" | "large" | undefined;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@lynx-js/react/jsx-runtime";
|
|
2
1
|
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
3
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
3
|
// LICENSE file in the root directory of this source tree.
|
|
5
|
-
import { BuiltinActionType } from '@openuidev/lang-core';
|
|
4
|
+
import { ACTION_STEPS, BuiltinActionType } from '@openuidev/lang-core';
|
|
6
5
|
import { z } from 'zod/v4';
|
|
7
|
-
import { useFormName, useIsStreaming, useTriggerAction, } from '../../core/context.
|
|
6
|
+
import { useFormName, useIsStreaming, useTriggerAction, } from '../../core/context.jsx';
|
|
8
7
|
import { useFormValidation } from '../../core/hooks/index.js';
|
|
9
|
-
import { defineComponent } from '../../core/library.
|
|
10
|
-
import { actionPropSchema } from '../Action/index.
|
|
8
|
+
import { defineComponent } from '../../core/library.jsx';
|
|
9
|
+
import { actionPropSchema } from '../Action/index.jsx';
|
|
11
10
|
import { asArray } from '../utils.js';
|
|
12
11
|
const CONTINUE_CONVERSATION_ACTION = String(BuiltinActionType.ContinueConversation);
|
|
13
12
|
const OPEN_URL_ACTION = String(BuiltinActionType.OpenUrl);
|
|
14
13
|
const buttonPropsSchema = z.object({
|
|
15
14
|
label: z.string(),
|
|
16
|
-
action: actionPropSchema,
|
|
15
|
+
action: actionPropSchema.optional(),
|
|
17
16
|
variant: z.enum(['primary', 'secondary', 'tertiary']).optional(),
|
|
18
17
|
type: z.enum(['normal', 'destructive']).optional(),
|
|
19
18
|
size: z.enum(['extra-small', 'small', 'medium', 'large']).optional(),
|
|
@@ -36,11 +35,22 @@ function ButtonRenderer({ props }) {
|
|
|
36
35
|
const onTap = () => {
|
|
37
36
|
const legacyAction = action && !('steps' in action) ? action : undefined;
|
|
38
37
|
const actionType = legacyAction?.type ?? CONTINUE_CONVERSATION_ACTION;
|
|
39
|
-
if (formValidation && variant === 'primary'
|
|
40
|
-
&&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
if (formValidation && variant === 'primary') {
|
|
39
|
+
if (action && 'steps' in action) {
|
|
40
|
+
const needsValidation = action.steps.some((step) => step.type === ACTION_STEPS.ToAssistant
|
|
41
|
+
|| (step.type === ACTION_STEPS.Run && step.refType === 'mutation'));
|
|
42
|
+
if (needsValidation && !formValidation.validateForm())
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
else if (actionType === CONTINUE_CONVERSATION_ACTION) {
|
|
46
|
+
const valid = formValidation.validateForm();
|
|
47
|
+
if (!valid)
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (action && 'steps' in action) {
|
|
52
|
+
void triggerAction(label, formName, action);
|
|
53
|
+
return;
|
|
44
54
|
}
|
|
45
55
|
const actionParams = actionType === OPEN_URL_ACTION
|
|
46
56
|
? { url: legacyAction?.url }
|
|
@@ -53,7 +63,9 @@ function ButtonRenderer({ props }) {
|
|
|
53
63
|
params: actionParams,
|
|
54
64
|
});
|
|
55
65
|
};
|
|
56
|
-
return (
|
|
66
|
+
return (<view className={className} {...(isStreaming ? {} : ({ bindtap: onTap }))}>
|
|
67
|
+
<text className='OpenUIButtonText'>{label}</text>
|
|
68
|
+
</view>);
|
|
57
69
|
}
|
|
58
70
|
export const Button = defineComponent({
|
|
59
71
|
name: 'Button',
|
|
@@ -62,7 +74,9 @@ export const Button = defineComponent({
|
|
|
62
74
|
component: ButtonRenderer,
|
|
63
75
|
});
|
|
64
76
|
function ButtonsRenderer({ props, renderNode }) {
|
|
65
|
-
return (
|
|
77
|
+
return (<view className='OpenUIButtonGroup'>
|
|
78
|
+
{renderNode(asArray(props.buttons))}
|
|
79
|
+
</view>);
|
|
66
80
|
}
|
|
67
81
|
export const Buttons = defineComponent({
|
|
68
82
|
name: 'Buttons',
|
|
@@ -72,4 +86,4 @@ export const Buttons = defineComponent({
|
|
|
72
86
|
description: 'Button group',
|
|
73
87
|
component: ButtonsRenderer,
|
|
74
88
|
});
|
|
75
|
-
//# sourceMappingURL=index.
|
|
89
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/Button/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,E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AAC;QACd,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,eAAe;CAC3B,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
export declare const Card: import("../../core/library.
|
|
2
|
+
export declare const Card: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
3
|
children: z.ZodArray<z.ZodAny>;
|
|
4
4
|
variant: z.ZodOptional<z.ZodEnum<{
|
|
5
5
|
card: "card";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@lynx-js/react/jsx-runtime";
|
|
2
1
|
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
3
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
3
|
// LICENSE file in the root directory of this source tree.
|
|
5
4
|
import { z } from 'zod/v4';
|
|
6
|
-
import { defineComponent } from '../../core/library.
|
|
5
|
+
import { defineComponent } from '../../core/library.jsx';
|
|
7
6
|
import { GAP_CLASS, asArray } from '../utils.js';
|
|
8
7
|
function getAlignClass(align) {
|
|
9
8
|
switch (align) {
|
|
@@ -63,7 +62,9 @@ export const Card = defineComponent({
|
|
|
63
62
|
]
|
|
64
63
|
.filter(Boolean)
|
|
65
64
|
.join(' ');
|
|
66
|
-
return (
|
|
65
|
+
return (<view className={`OpenUICard ${variantClass} ${layoutClassName}`}>
|
|
66
|
+
{renderNode(asArray(props.children))}
|
|
67
|
+
</view>);
|
|
67
68
|
},
|
|
68
69
|
});
|
|
69
|
-
//# sourceMappingURL=index.
|
|
70
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/Card/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AAC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ACzB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,YAAY,IAAI,eAAe,EAAE,CAAC,CAC/D;QAAA,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CACtC;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
export declare const CardHeader: import("../../core/library.
|
|
2
|
+
export declare const CardHeader: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
3
|
title: z.ZodString;
|
|
4
4
|
subtitle: z.ZodOptional<z.ZodString>;
|
|
5
5
|
}, z.core.$strip>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { z } from 'zod/v4';
|
|
5
|
+
import { defineComponent } from '../../core/library.jsx';
|
|
6
|
+
export const CardHeader = defineComponent({
|
|
7
|
+
name: 'CardHeader',
|
|
8
|
+
props: z.object({
|
|
9
|
+
title: z.string(),
|
|
10
|
+
subtitle: z.string().optional(),
|
|
11
|
+
}),
|
|
12
|
+
description: 'Card header with title and optional subtitle.',
|
|
13
|
+
component: ({ props }) => (<view className='OpenUICardHeader'>
|
|
14
|
+
<text className='OpenUICardHeaderTitle'>{props.title}</text>
|
|
15
|
+
{props.subtitle
|
|
16
|
+
? <text className='OpenUICardHeaderSubtitle'>{props.subtitle}</text>
|
|
17
|
+
: null}
|
|
18
|
+
</view>),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/CardHeader/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;IACF,WAAW,EAAE,+CAA+C;IAC5D,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAChC;MAAA,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAC3D;MAAA,CAAC,KAAK,CAAC,QAAQ;YACb,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;YACpE,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const CheckBox: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
|
+
label: z.ZodString;
|
|
4
|
+
value: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
action: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
}, z.core.$loose>>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
type: z.ZodOptional<z.ZodString>;
|
|
11
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
+
url: z.ZodOptional<z.ZodString>;
|
|
13
|
+
context: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>]>>;
|
|
15
|
+
name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { BuiltinActionType } from '@openuidev/lang-core';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
import { Checkbox, CheckboxIndicator } from '@lynx-js/lynx-ui';
|
|
4
|
+
import { useEffect, useRef, useState } from '@lynx-js/react';
|
|
5
|
+
import { useFormName, useGetFieldValue, useSetDefaultValue, useSetFieldValue, useTriggerAction, } from '../../core/context.jsx';
|
|
6
|
+
import { defineComponent } from '../../core/library.jsx';
|
|
7
|
+
import { actionPropSchema } from '../Action/index.jsx';
|
|
8
|
+
const CONTINUE_CONVERSATION_ACTION = String(BuiltinActionType.ContinueConversation);
|
|
9
|
+
const OPEN_URL_ACTION = String(BuiltinActionType.OpenUrl);
|
|
10
|
+
export const CheckBox = defineComponent({
|
|
11
|
+
name: 'CheckBox',
|
|
12
|
+
props: z.object({
|
|
13
|
+
label: z.string(),
|
|
14
|
+
value: z.boolean().optional(),
|
|
15
|
+
action: actionPropSchema.optional(),
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
}),
|
|
18
|
+
description: 'Toggleable checkbox. Visual state updates locally on tap; the action fires for the LLM to persist the change.',
|
|
19
|
+
component: ({ props }) => {
|
|
20
|
+
const triggerAction = useTriggerAction();
|
|
21
|
+
const formName = useFormName();
|
|
22
|
+
const getFieldValue = useGetFieldValue();
|
|
23
|
+
const setFieldValue = useSetFieldValue();
|
|
24
|
+
const [checked, setChecked] = useState(props.value === true);
|
|
25
|
+
const dirtyRef = useRef(false);
|
|
26
|
+
const existingValue = props.name
|
|
27
|
+
? getFieldValue(formName, props.name)
|
|
28
|
+
: undefined;
|
|
29
|
+
useSetDefaultValue({
|
|
30
|
+
...(formName ? { formName } : {}),
|
|
31
|
+
componentType: 'CheckBox',
|
|
32
|
+
name: props.name ?? '',
|
|
33
|
+
existingValue,
|
|
34
|
+
defaultValue: props.name && props.value !== undefined
|
|
35
|
+
? props.value === true
|
|
36
|
+
: undefined,
|
|
37
|
+
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!dirtyRef.current) {
|
|
40
|
+
const next = props.value === true;
|
|
41
|
+
setChecked(next);
|
|
42
|
+
if (props.name && props.value !== undefined) {
|
|
43
|
+
setFieldValue(formName, 'CheckBox', props.name, next, false);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, [formName, props.name, props.value, setFieldValue]);
|
|
47
|
+
const onChange = (next) => {
|
|
48
|
+
dirtyRef.current = true;
|
|
49
|
+
setChecked(next);
|
|
50
|
+
if (props.name) {
|
|
51
|
+
setFieldValue(formName, 'CheckBox', props.name, next, true);
|
|
52
|
+
}
|
|
53
|
+
if (!props.action)
|
|
54
|
+
return;
|
|
55
|
+
if ('steps' in props.action) {
|
|
56
|
+
void triggerAction(props.label, formName, props.action);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const legacyAction = props.action;
|
|
60
|
+
const actionType = legacyAction?.type ?? CONTINUE_CONVERSATION_ACTION;
|
|
61
|
+
const actionParams = actionType === OPEN_URL_ACTION
|
|
62
|
+
? { url: legacyAction?.url }
|
|
63
|
+
: {
|
|
64
|
+
...(legacyAction?.params ?? {}),
|
|
65
|
+
...(legacyAction?.context ? { context: legacyAction.context } : {}),
|
|
66
|
+
};
|
|
67
|
+
void triggerAction(props.label, formName, {
|
|
68
|
+
type: actionType,
|
|
69
|
+
params: actionParams,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return (<view className='OpenUICheckBoxRow'>
|
|
73
|
+
<Checkbox checked={checked} onChange={onChange} className='OpenUICheckBoxInput'>
|
|
74
|
+
<CheckboxIndicator>
|
|
75
|
+
<text>✓</text>
|
|
76
|
+
</CheckboxIndicator>
|
|
77
|
+
</Checkbox>
|
|
78
|
+
<text className='OpenUICheckBoxLabel'>{props.label}</text>
|
|
79
|
+
</view>);
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/CheckBox/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,4BAA4B,GAAG,MAAM,CACzC,iBAAiB,CAAC,oBAAoB,CACvC,CAAC;AACF,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QAC7B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,EAAE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QAAQ,EAAE;gBACxC,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,CACjC;QAAA,CAAC,QAAQ,CACP,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,qBAAqB,CAE/B;UAAA,CAAC,iBAAiB,CAChB;YAAA,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CACf;UAAA,EAAE,iBAAiB,CACrB;QAAA,EAAE,QAAQ,CACV;QAAA,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAC3D;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const Icon: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
|
+
name: z.ZodEnum<{
|
|
4
|
+
search: "search";
|
|
5
|
+
account_circle: "account_circle";
|
|
6
|
+
add: "add";
|
|
7
|
+
arrow_back: "arrow_back";
|
|
8
|
+
arrow_forward: "arrow_forward";
|
|
9
|
+
camera: "camera";
|
|
10
|
+
check: "check";
|
|
11
|
+
close: "close";
|
|
12
|
+
delete: "delete";
|
|
13
|
+
edit: "edit";
|
|
14
|
+
error: "error";
|
|
15
|
+
favorite: "favorite";
|
|
16
|
+
help: "help";
|
|
17
|
+
home: "home";
|
|
18
|
+
info: "info";
|
|
19
|
+
location_on: "location_on";
|
|
20
|
+
lock: "lock";
|
|
21
|
+
mail: "mail";
|
|
22
|
+
menu: "menu";
|
|
23
|
+
more_vert: "more_vert";
|
|
24
|
+
pause: "pause";
|
|
25
|
+
person: "person";
|
|
26
|
+
play_arrow: "play_arrow";
|
|
27
|
+
refresh: "refresh";
|
|
28
|
+
send: "send";
|
|
29
|
+
settings: "settings";
|
|
30
|
+
share: "share";
|
|
31
|
+
star: "star";
|
|
32
|
+
warning: "warning";
|
|
33
|
+
}>;
|
|
34
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
sm: "sm";
|
|
36
|
+
md: "md";
|
|
37
|
+
lg: "lg";
|
|
38
|
+
}>>;
|
|
39
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
primary: "primary";
|
|
41
|
+
muted: "muted";
|
|
42
|
+
inherit: "inherit";
|
|
43
|
+
}>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { z } from 'zod/v4';
|
|
5
|
+
import { defineComponent } from '../../core/library.jsx';
|
|
6
|
+
const ICON_NAMES = [
|
|
7
|
+
'account_circle',
|
|
8
|
+
'add',
|
|
9
|
+
'arrow_back',
|
|
10
|
+
'arrow_forward',
|
|
11
|
+
'camera',
|
|
12
|
+
'check',
|
|
13
|
+
'close',
|
|
14
|
+
'delete',
|
|
15
|
+
'edit',
|
|
16
|
+
'error',
|
|
17
|
+
'favorite',
|
|
18
|
+
'help',
|
|
19
|
+
'home',
|
|
20
|
+
'info',
|
|
21
|
+
'location_on',
|
|
22
|
+
'lock',
|
|
23
|
+
'mail',
|
|
24
|
+
'menu',
|
|
25
|
+
'more_vert',
|
|
26
|
+
'pause',
|
|
27
|
+
'person',
|
|
28
|
+
'play_arrow',
|
|
29
|
+
'refresh',
|
|
30
|
+
'search',
|
|
31
|
+
'send',
|
|
32
|
+
'settings',
|
|
33
|
+
'share',
|
|
34
|
+
'star',
|
|
35
|
+
'warning',
|
|
36
|
+
];
|
|
37
|
+
function toMaterialName(name) {
|
|
38
|
+
return name.replace(/[A-Z]/g, (m) => `_${m.toLowerCase()}`);
|
|
39
|
+
}
|
|
40
|
+
export const Icon = defineComponent({
|
|
41
|
+
name: 'Icon',
|
|
42
|
+
props: z.object({
|
|
43
|
+
name: z.enum(ICON_NAMES),
|
|
44
|
+
size: z.enum(['sm', 'md', 'lg']).optional(),
|
|
45
|
+
color: z.enum(['primary', 'muted', 'inherit']).optional(),
|
|
46
|
+
}),
|
|
47
|
+
description: 'Material icon. Font is bundled in renderer.css.',
|
|
48
|
+
component: ({ props }) => {
|
|
49
|
+
const size = props.size ?? 'md';
|
|
50
|
+
const color = props.color ?? 'inherit';
|
|
51
|
+
const sizeClass = size === 'sm'
|
|
52
|
+
? 'OpenUIIconSm'
|
|
53
|
+
: (size === 'lg'
|
|
54
|
+
? 'OpenUIIconLg'
|
|
55
|
+
: 'OpenUIIconMd');
|
|
56
|
+
const colorClass = color === 'primary'
|
|
57
|
+
? 'OpenUIIconColorPrimary'
|
|
58
|
+
: (color === 'muted'
|
|
59
|
+
? 'OpenUIIconColorMuted'
|
|
60
|
+
: 'OpenUIIconColorInherit');
|
|
61
|
+
return (<text className={`OpenUIIcon ${sizeClass} ${colorClass}`}>
|
|
62
|
+
{toMaterialName(props.name)}
|
|
63
|
+
</text>);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../src/catalog/Icon/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,KAAK;IACL,YAAY;IACZ,eAAe;IACf,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MA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AAC,wBAAwB;YAC1B,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO;gBAClB,CAAC,CAAC,sBAAsB;gBACxB,CAAC,CAAC,wBAAwB,CAAC,CAAC;QAChC,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,SAAS,IAAI,UAAU,EAAE,CAAC,CACvD;QAAA,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAC7B;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const Image: import("../../core/library.jsx").DefinedComponent<z.ZodObject<{
|
|
3
|
+
url: z.ZodString;
|
|
4
|
+
fit: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
fill: "fill";
|
|
6
|
+
none: "none";
|
|
7
|
+
contain: "contain";
|
|
8
|
+
cover: "cover";
|
|
9
|
+
"scale-down": "scale-down";
|
|
10
|
+
}>>;
|
|
11
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
icon: "icon";
|
|
13
|
+
avatar: "avatar";
|
|
14
|
+
smallFeature: "smallFeature";
|
|
15
|
+
mediumFeature: "mediumFeature";
|
|
16
|
+
largeFeature: "largeFeature";
|
|
17
|
+
header: "header";
|
|
18
|
+
}>>;
|
|
19
|
+
}, z.core.$strip>>;
|