@lynx-js/genui 0.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +170 -0
- package/a2ui/README.md +140 -0
- package/a2ui/dist/catalog/Button/catalog.json +156 -0
- package/a2ui/dist/catalog/Button/index.d.ts +35 -0
- package/a2ui/dist/catalog/Button/index.js +35 -0
- package/a2ui/dist/catalog/Button/index.js.map +1 -0
- package/a2ui/dist/catalog/Card/catalog.json +24 -0
- package/a2ui/dist/catalog/Card/index.d.ts +11 -0
- package/a2ui/dist/catalog/Card/index.js +19 -0
- package/a2ui/dist/catalog/Card/index.js.map +1 -0
- package/a2ui/dist/catalog/CheckBox/catalog.json +170 -0
- package/a2ui/dist/catalog/CheckBox/index.d.ts +32 -0
- package/a2ui/dist/catalog/CheckBox/index.js +24 -0
- package/a2ui/dist/catalog/CheckBox/index.js.map +1 -0
- package/a2ui/dist/catalog/Column/catalog.json +57 -0
- package/a2ui/dist/catalog/Column/index.d.ts +15 -0
- package/a2ui/dist/catalog/Column/index.js +55 -0
- package/a2ui/dist/catalog/Column/index.js.map +1 -0
- package/a2ui/dist/catalog/Divider/catalog.json +14 -0
- package/a2ui/dist/catalog/Divider/index.d.ts +9 -0
- package/a2ui/dist/catalog/Divider/index.js +8 -0
- package/a2ui/dist/catalog/Divider/index.js.map +1 -0
- package/a2ui/dist/catalog/Icon/catalog.json +45 -0
- package/a2ui/dist/catalog/Icon/index.d.ts +14 -0
- package/a2ui/dist/catalog/Icon/index.js +11 -0
- package/a2ui/dist/catalog/Icon/index.js.map +1 -0
- package/a2ui/dist/catalog/Image/catalog.json +62 -0
- package/a2ui/dist/catalog/Image/index.d.ts +16 -0
- package/a2ui/dist/catalog/Image/index.js +30 -0
- package/a2ui/dist/catalog/Image/index.js.map +1 -0
- package/a2ui/dist/catalog/LineChart/catalog.json +98 -0
- package/a2ui/dist/catalog/LineChart/index.d.ts +31 -0
- package/a2ui/dist/catalog/LineChart/index.js +195 -0
- package/a2ui/dist/catalog/LineChart/index.js.map +1 -0
- package/a2ui/dist/catalog/List/catalog.json +52 -0
- package/a2ui/dist/catalog/List/index.d.ts +15 -0
- package/a2ui/dist/catalog/List/index.js +53 -0
- package/a2ui/dist/catalog/List/index.js.map +1 -0
- package/a2ui/dist/catalog/Modal/catalog.json +18 -0
- package/a2ui/dist/catalog/Modal/index.d.ts +12 -0
- package/a2ui/dist/catalog/Modal/index.js +33 -0
- package/a2ui/dist/catalog/Modal/index.js.map +1 -0
- package/a2ui/dist/catalog/PieChart/catalog.json +87 -0
- package/a2ui/dist/catalog/PieChart/index.d.ts +37 -0
- package/a2ui/dist/catalog/PieChart/index.js +131 -0
- package/a2ui/dist/catalog/PieChart/index.js.map +1 -0
- package/a2ui/dist/catalog/RadioGroup/catalog.json +184 -0
- package/a2ui/dist/catalog/RadioGroup/index.d.ts +36 -0
- package/a2ui/dist/catalog/RadioGroup/index.js +36 -0
- package/a2ui/dist/catalog/RadioGroup/index.js.map +1 -0
- package/a2ui/dist/catalog/Row/catalog.json +57 -0
- package/a2ui/dist/catalog/Row/index.d.ts +15 -0
- package/a2ui/dist/catalog/Row/index.js +28 -0
- package/a2ui/dist/catalog/Row/index.js.map +1 -0
- package/a2ui/dist/catalog/Slider/catalog.json +183 -0
- package/a2ui/dist/catalog/Slider/index.d.ts +41 -0
- package/a2ui/dist/catalog/Slider/index.js +39 -0
- package/a2ui/dist/catalog/Slider/index.js.map +1 -0
- package/a2ui/dist/catalog/Slider/utils.d.ts +11 -0
- package/a2ui/dist/catalog/Slider/utils.js +58 -0
- package/a2ui/dist/catalog/Slider/utils.js.map +1 -0
- package/a2ui/dist/catalog/Tabs/catalog.json +28 -0
- package/a2ui/dist/catalog/Tabs/index.d.ts +12 -0
- package/a2ui/dist/catalog/Tabs/index.js +32 -0
- package/a2ui/dist/catalog/Tabs/index.js.map +1 -0
- package/a2ui/dist/catalog/Text/catalog.json +74 -0
- package/a2ui/dist/catalog/Text/index.d.ts +18 -0
- package/a2ui/dist/catalog/Text/index.js +27 -0
- package/a2ui/dist/catalog/Text/index.js.map +1 -0
- package/a2ui/dist/catalog/TextField/catalog.json +147 -0
- package/a2ui/dist/catalog/TextField/index.d.ts +35 -0
- package/a2ui/dist/catalog/TextField/index.js +43 -0
- package/a2ui/dist/catalog/TextField/index.js.map +1 -0
- package/a2ui/dist/catalog/TextField/utils.d.ts +7 -0
- package/a2ui/dist/catalog/TextField/utils.js +51 -0
- package/a2ui/dist/catalog/TextField/utils.js.map +1 -0
- package/a2ui/dist/catalog/defineCatalog.d.ts +119 -0
- package/a2ui/dist/catalog/defineCatalog.js +196 -0
- package/a2ui/dist/catalog/defineCatalog.js.map +1 -0
- package/a2ui/dist/catalog/index.d.ts +20 -0
- package/a2ui/dist/catalog/index.js +26 -0
- package/a2ui/dist/catalog/index.js.map +1 -0
- package/a2ui/dist/catalog/utils/chart.d.ts +3 -0
- package/a2ui/dist/catalog/utils/chart.js +28 -0
- package/a2ui/dist/catalog/utils/chart.js.map +1 -0
- package/a2ui/dist/functions/index.d.ts +19 -0
- package/a2ui/dist/functions/index.js +87 -0
- package/a2ui/dist/functions/index.js.map +1 -0
- package/a2ui/dist/index.d.ts +11 -0
- package/a2ui/dist/index.js +35 -0
- package/a2ui/dist/index.js.map +1 -0
- package/a2ui/dist/react/A2UI.d.ts +77 -0
- package/a2ui/dist/react/A2UI.js +159 -0
- package/a2ui/dist/react/A2UI.js.map +1 -0
- package/a2ui/dist/react/A2UIProvider.d.ts +25 -0
- package/a2ui/dist/react/A2UIProvider.js +20 -0
- package/a2ui/dist/react/A2UIProvider.js.map +1 -0
- package/a2ui/dist/react/A2UIRenderer.d.ts +34 -0
- package/a2ui/dist/react/A2UIRenderer.js +161 -0
- package/a2ui/dist/react/A2UIRenderer.js.map +1 -0
- package/a2ui/dist/react/FormContext.d.ts +10 -0
- package/a2ui/dist/react/FormContext.js +12 -0
- package/a2ui/dist/react/FormContext.js.map +1 -0
- package/a2ui/dist/react/index.d.ts +8 -0
- package/a2ui/dist/react/index.js +23 -0
- package/a2ui/dist/react/index.js.map +1 -0
- package/a2ui/dist/react/useA2UIContext.d.ts +7 -0
- package/a2ui/dist/react/useA2UIContext.js +19 -0
- package/a2ui/dist/react/useA2UIContext.js.map +1 -0
- package/a2ui/dist/react/useAction.d.ts +9 -0
- package/a2ui/dist/react/useAction.js +38 -0
- package/a2ui/dist/react/useAction.js.map +1 -0
- package/a2ui/dist/react/useCatalog.d.ts +7 -0
- package/a2ui/dist/react/useCatalog.js +13 -0
- package/a2ui/dist/react/useCatalog.js.map +1 -0
- package/a2ui/dist/react/useChecks.d.ts +27 -0
- package/a2ui/dist/react/useChecks.js +76 -0
- package/a2ui/dist/react/useChecks.js.map +1 -0
- package/a2ui/dist/react/useDataBinding.d.ts +10 -0
- package/a2ui/dist/react/useDataBinding.js +175 -0
- package/a2ui/dist/react/useDataBinding.js.map +1 -0
- package/a2ui/dist/store/FormController.d.ts +23 -0
- package/a2ui/dist/store/FormController.js +40 -0
- package/a2ui/dist/store/FormController.js.map +1 -0
- package/a2ui/dist/store/FunctionRegistry.d.ts +47 -0
- package/a2ui/dist/store/FunctionRegistry.js +23 -0
- package/a2ui/dist/store/FunctionRegistry.js.map +1 -0
- package/a2ui/dist/store/MessageProcessor.d.ts +28 -0
- package/a2ui/dist/store/MessageProcessor.js +408 -0
- package/a2ui/dist/store/MessageProcessor.js.map +1 -0
- package/a2ui/dist/store/MessageStore.d.ts +38 -0
- package/a2ui/dist/store/MessageStore.js +37 -0
- package/a2ui/dist/store/MessageStore.js.map +1 -0
- package/a2ui/dist/store/Resource.d.ts +45 -0
- package/a2ui/dist/store/Resource.js +80 -0
- package/a2ui/dist/store/Resource.js.map +1 -0
- package/a2ui/dist/store/SignalStore.d.ts +10 -0
- package/a2ui/dist/store/SignalStore.js +29 -0
- package/a2ui/dist/store/SignalStore.js.map +1 -0
- package/a2ui/dist/store/index.d.ts +14 -0
- package/a2ui/dist/store/index.js +15 -0
- package/a2ui/dist/store/index.js.map +1 -0
- package/a2ui/dist/store/payloadNormalizer.d.ts +27 -0
- package/a2ui/dist/store/payloadNormalizer.js +179 -0
- package/a2ui/dist/store/payloadNormalizer.js.map +1 -0
- package/a2ui/dist/store/resolveFunctionCall.d.ts +18 -0
- package/a2ui/dist/store/resolveFunctionCall.js +131 -0
- package/a2ui/dist/store/resolveFunctionCall.js.map +1 -0
- package/a2ui/dist/store/types.d.ts +68 -0
- package/a2ui/dist/store/types.js +2 -0
- package/a2ui/dist/store/types.js.map +1 -0
- package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -0
- package/a2ui/styles/catalog/Button.css +83 -0
- package/a2ui/styles/catalog/Card.css +49 -0
- package/a2ui/styles/catalog/CheckBox.css +46 -0
- package/a2ui/styles/catalog/Column.css +89 -0
- package/a2ui/styles/catalog/Divider.css +20 -0
- package/a2ui/styles/catalog/Icon.css +39 -0
- package/a2ui/styles/catalog/Image.css +54 -0
- package/a2ui/styles/catalog/LineChart.css +116 -0
- package/a2ui/styles/catalog/List.css +38 -0
- package/a2ui/styles/catalog/Modal.css +60 -0
- package/a2ui/styles/catalog/PieChart.css +109 -0
- package/a2ui/styles/catalog/RadioGroup.css +123 -0
- package/a2ui/styles/catalog/Row.css +83 -0
- package/a2ui/styles/catalog/Slider.css +96 -0
- package/a2ui/styles/catalog/Tabs.css +46 -0
- package/a2ui/styles/catalog/Text.css +121 -0
- package/a2ui/styles/catalog/TextField.css +48 -0
- package/a2ui/styles/theme.css +62 -0
- package/a2ui-catalog-extractor/README.md +605 -0
- package/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.js +6 -0
- package/a2ui-catalog-extractor/dist/cli.d.ts +12 -0
- package/a2ui-catalog-extractor/dist/cli.js +171 -0
- package/a2ui-catalog-extractor/dist/cli.js.map +1 -0
- package/a2ui-catalog-extractor/dist/index.d.ts +140 -0
- package/a2ui-catalog-extractor/dist/index.js +755 -0
- package/a2ui-catalog-extractor/dist/index.js.map +1 -0
- package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -0
- package/a2ui-catalog-extractor/skills/a2ui-catalog-extractor/SKILL.md +30 -0
- package/a2ui-prompt/README.md +65 -0
- package/a2ui-prompt/dist/index.d.ts +91 -0
- package/a2ui-prompt/dist/index.js +767 -0
- package/cli/README.md +88 -0
- package/cli/bin/cli.js +271 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/index.ts +114 -0
- package/openui/README.md +211 -0
- package/openui/dist/catalog/Action/index.d.ts +20 -0
- package/openui/dist/catalog/Action/index.js +23 -0
- package/openui/dist/catalog/Action/index.js.map +1 -0
- package/openui/dist/catalog/Button/index.d.ts +64 -0
- package/openui/dist/catalog/Button/index.js +75 -0
- package/openui/dist/catalog/Button/index.js.map +1 -0
- package/openui/dist/catalog/Card/index.d.ts +34 -0
- package/openui/dist/catalog/Card/index.js +69 -0
- package/openui/dist/catalog/Card/index.js.map +1 -0
- package/openui/dist/catalog/CardHeader/index.d.ts +5 -0
- package/openui/dist/catalog/CardHeader/index.js +18 -0
- package/openui/dist/catalog/CardHeader/index.js.map +1 -0
- package/openui/dist/catalog/Separator/index.d.ts +2 -0
- package/openui/dist/catalog/Separator/index.js +13 -0
- package/openui/dist/catalog/Separator/index.js.map +1 -0
- package/openui/dist/catalog/Stack/index.d.ts +29 -0
- package/openui/dist/catalog/Stack/index.js +61 -0
- package/openui/dist/catalog/Stack/index.js.map +1 -0
- package/openui/dist/catalog/Tag/index.d.ts +4 -0
- package/openui/dist/catalog/Tag/index.js +15 -0
- package/openui/dist/catalog/Tag/index.js.map +1 -0
- package/openui/dist/catalog/TextContent/index.d.ts +11 -0
- package/openui/dist/catalog/TextContent/index.js +33 -0
- package/openui/dist/catalog/TextContent/index.js.map +1 -0
- package/openui/dist/catalog/index.d.ts +7 -0
- package/openui/dist/catalog/index.js +11 -0
- package/openui/dist/catalog/index.js.map +1 -0
- package/openui/dist/catalog/utils.d.ts +2 -0
- package/openui/dist/catalog/utils.js +17 -0
- package/openui/dist/catalog/utils.js.map +1 -0
- package/openui/dist/core/context.d.ts +112 -0
- package/openui/dist/core/context.js +99 -0
- package/openui/dist/core/context.js.map +1 -0
- package/openui/dist/core/createLibrary.d.ts +10 -0
- package/openui/dist/core/createLibrary.js +36 -0
- package/openui/dist/core/createLibrary.js.map +1 -0
- package/openui/dist/core/hooks/index.d.ts +4 -0
- package/openui/dist/core/hooks/index.js +6 -0
- package/openui/dist/core/hooks/index.js.map +1 -0
- package/openui/dist/core/hooks/useFormValidation.d.ts +13 -0
- package/openui/dist/core/hooks/useFormValidation.js +76 -0
- package/openui/dist/core/hooks/useFormValidation.js.map +1 -0
- package/openui/dist/core/hooks/useOpenUIState.d.ts +33 -0
- package/openui/dist/core/hooks/useOpenUIState.js +413 -0
- package/openui/dist/core/hooks/useOpenUIState.js.map +1 -0
- package/openui/dist/core/hooks/useStateField.d.ts +2 -0
- package/openui/dist/core/hooks/useStateField.js +11 -0
- package/openui/dist/core/hooks/useStateField.js.map +1 -0
- package/openui/dist/core/index.d.ts +7 -0
- package/openui/dist/core/index.js +8 -0
- package/openui/dist/core/index.js.map +1 -0
- package/openui/dist/core/library.d.ts +20 -0
- package/openui/dist/core/library.js +13 -0
- package/openui/dist/core/library.js.map +1 -0
- package/openui/dist/core/renderer.css +271 -0
- package/openui/dist/core/renderer.d.ts +9 -0
- package/openui/dist/core/renderer.js +139 -0
- package/openui/dist/core/renderer.js.map +1 -0
- package/openui/dist/core/utils.d.ts +1 -0
- package/openui/dist/core/utils.js +76 -0
- package/openui/dist/core/utils.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Slider": {
|
|
3
|
+
"properties": {
|
|
4
|
+
"label": {
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"path": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"path"
|
|
18
|
+
],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"call": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"args": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": true
|
|
30
|
+
},
|
|
31
|
+
"returnType": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": [
|
|
34
|
+
"string",
|
|
35
|
+
"number",
|
|
36
|
+
"boolean",
|
|
37
|
+
"object",
|
|
38
|
+
"array",
|
|
39
|
+
"any",
|
|
40
|
+
"void"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"call",
|
|
46
|
+
"args"
|
|
47
|
+
],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"description": "The label for the slider."
|
|
52
|
+
},
|
|
53
|
+
"min": {
|
|
54
|
+
"type": "number",
|
|
55
|
+
"description": "The minimum value of the slider."
|
|
56
|
+
},
|
|
57
|
+
"max": {
|
|
58
|
+
"type": "number",
|
|
59
|
+
"description": "The maximum value of the slider."
|
|
60
|
+
},
|
|
61
|
+
"value": {
|
|
62
|
+
"oneOf": [
|
|
63
|
+
{
|
|
64
|
+
"type": "number"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"path": {
|
|
70
|
+
"type": "string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": [
|
|
74
|
+
"path"
|
|
75
|
+
],
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"call": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"args": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"additionalProperties": true
|
|
87
|
+
},
|
|
88
|
+
"returnType": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"enum": [
|
|
91
|
+
"string",
|
|
92
|
+
"number",
|
|
93
|
+
"boolean",
|
|
94
|
+
"object",
|
|
95
|
+
"array",
|
|
96
|
+
"any",
|
|
97
|
+
"void"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"required": [
|
|
102
|
+
"call",
|
|
103
|
+
"args"
|
|
104
|
+
],
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"description": "The current value of the slider."
|
|
109
|
+
},
|
|
110
|
+
"checks": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"properties": {
|
|
115
|
+
"condition": {
|
|
116
|
+
"oneOf": [
|
|
117
|
+
{
|
|
118
|
+
"type": "boolean"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"path": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"required": [
|
|
128
|
+
"path"
|
|
129
|
+
],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"call": {
|
|
136
|
+
"type": "string"
|
|
137
|
+
},
|
|
138
|
+
"args": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"additionalProperties": true
|
|
141
|
+
},
|
|
142
|
+
"returnType": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"enum": [
|
|
145
|
+
"string",
|
|
146
|
+
"number",
|
|
147
|
+
"boolean",
|
|
148
|
+
"object",
|
|
149
|
+
"array",
|
|
150
|
+
"any",
|
|
151
|
+
"void"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"required": [
|
|
156
|
+
"call",
|
|
157
|
+
"args"
|
|
158
|
+
],
|
|
159
|
+
"additionalProperties": false
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"description": "The condition that indicates whether the check passes."
|
|
163
|
+
},
|
|
164
|
+
"message": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "The error message to display if the check fails."
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"condition",
|
|
171
|
+
"message"
|
|
172
|
+
],
|
|
173
|
+
"additionalProperties": false
|
|
174
|
+
},
|
|
175
|
+
"description": "A list of checks to perform."
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"required": [
|
|
179
|
+
"max",
|
|
180
|
+
"value"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { GenericComponentProps } from '../../store/types.js';
|
|
2
|
+
import '../../../styles/catalog/Slider.css';
|
|
3
|
+
/**
|
|
4
|
+
* @a2uiCatalog Slider
|
|
5
|
+
*/
|
|
6
|
+
export interface SliderProps extends GenericComponentProps {
|
|
7
|
+
/** The label for the slider. */
|
|
8
|
+
label?: string | {
|
|
9
|
+
path: string;
|
|
10
|
+
} | {
|
|
11
|
+
call: string;
|
|
12
|
+
args: Record<string, unknown>;
|
|
13
|
+
returnType?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any' | 'void';
|
|
14
|
+
};
|
|
15
|
+
/** The minimum value of the slider. */
|
|
16
|
+
min?: number;
|
|
17
|
+
/** The maximum value of the slider. */
|
|
18
|
+
max: number;
|
|
19
|
+
/** The current value of the slider. */
|
|
20
|
+
value: number | {
|
|
21
|
+
path: string;
|
|
22
|
+
} | {
|
|
23
|
+
call: string;
|
|
24
|
+
args: Record<string, unknown>;
|
|
25
|
+
returnType?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any' | 'void';
|
|
26
|
+
};
|
|
27
|
+
/** A list of checks to perform. */
|
|
28
|
+
checks?: Array<{
|
|
29
|
+
/** The condition that indicates whether the check passes. */
|
|
30
|
+
condition: boolean | {
|
|
31
|
+
path: string;
|
|
32
|
+
} | {
|
|
33
|
+
call: string;
|
|
34
|
+
args: Record<string, unknown>;
|
|
35
|
+
returnType?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any' | 'void';
|
|
36
|
+
};
|
|
37
|
+
/** The error message to display if the check fails. */
|
|
38
|
+
message: string;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
export declare function Slider(props: SliderProps): import('@lynx-js/react').ReactNode;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@lynx-js/react/jsx-runtime";
|
|
2
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
3
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
|
+
// LICENSE file in the root directory of this source tree.
|
|
5
|
+
import { SliderIndicator, SliderRoot, SliderThumb, SliderTrack, } from '@lynx-js/lynx-ui';
|
|
6
|
+
import { useState } from '@lynx-js/react';
|
|
7
|
+
import { fromSliderRatio, normalizeSliderLabel, normalizeSliderNumber, normalizeSliderRange, toSliderRatio, toSliderStepRatio, } from './utils.js';
|
|
8
|
+
import { useChecks } from '../../react/useChecks.js';
|
|
9
|
+
import '../../../styles/catalog/Slider.css';
|
|
10
|
+
export function Slider(props) {
|
|
11
|
+
const { id, label, max, min, setValue, surface, dataContextPath, } = props;
|
|
12
|
+
const minValue = min ?? props['minValue'];
|
|
13
|
+
const maxValue = max ?? props['maxValue'];
|
|
14
|
+
const range = normalizeSliderRange(minValue, maxValue);
|
|
15
|
+
const step = normalizeSliderNumber(props['step'], Number.NaN);
|
|
16
|
+
const stepRatio = toSliderStepRatio(step, range);
|
|
17
|
+
const stepProps = stepRatio === undefined ? {} : { step: stepRatio };
|
|
18
|
+
const ratio = toSliderRatio(props.value, range);
|
|
19
|
+
const [displayValue, setDisplayValue] = useState(Math.round(fromSliderRatio(ratio, range, step)));
|
|
20
|
+
const labelText = normalizeSliderLabel(label);
|
|
21
|
+
const checks = props.checks;
|
|
22
|
+
const { ok, firstFailureMessage } = useChecks({
|
|
23
|
+
checks,
|
|
24
|
+
componentId: id ?? '',
|
|
25
|
+
surface,
|
|
26
|
+
dataContextPath,
|
|
27
|
+
});
|
|
28
|
+
const handleValueChange = (nextRatio) => {
|
|
29
|
+
const nextValue = fromSliderRatio(nextRatio, range, step);
|
|
30
|
+
setValue?.('value', nextValue);
|
|
31
|
+
setDisplayValue(Math.round(nextValue));
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs("view", { className: `slider${ok ? '' : ' slider-invalid'}`, children: [labelText
|
|
34
|
+
? (_jsxs("view", { className: 'slider-header', children: [_jsx("text", { className: 'slider-label', children: labelText }), _jsx("text", { className: 'slider-value', children: String(displayValue) })] }))
|
|
35
|
+
: null, _jsx("view", { className: 'slider-control', children: _jsx(SliderRoot, { ...stepProps, className: 'slider-root', value: ratio, onValueChange: handleValueChange, children: _jsxs(SliderTrack, { className: 'slider-track', children: [_jsx(SliderIndicator, { className: 'slider-indicator' }), _jsx(SliderThumb, { className: 'slider-thumb', children: _jsx("view", { className: 'slider-thumb-dot' }) })] }) }) }), !ok && firstFailureMessage
|
|
36
|
+
? _jsx("text", { className: 'slider-error', children: firstFailureMessage })
|
|
37
|
+
: null] }, id));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/Slider/index.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,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AC,cAAc,YAAE,mBAAmB,GAAQ;gBAC7D,CAAC,CAAC,IAAI,KA5BH,EAAE,CA6BF,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SliderRange {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function normalizeSliderNumber(value: unknown, fallback: number): number;
|
|
6
|
+
export declare function normalizeSliderRange(minValue: unknown, maxValue: unknown): SliderRange;
|
|
7
|
+
export declare function clampSliderValue(value: number, range: SliderRange): number;
|
|
8
|
+
export declare function toSliderRatio(value: unknown, range: SliderRange): number;
|
|
9
|
+
export declare function fromSliderRatio(ratio: number, range: SliderRange, step?: number): number;
|
|
10
|
+
export declare function toSliderStepRatio(step: unknown, range: SliderRange): number | undefined;
|
|
11
|
+
export declare function normalizeSliderLabel(value: unknown): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
const DEFAULT_MIN = 0;
|
|
5
|
+
const DEFAULT_MAX = 100;
|
|
6
|
+
export function normalizeSliderNumber(value, fallback) {
|
|
7
|
+
const numberValue = typeof value === 'number'
|
|
8
|
+
? value
|
|
9
|
+
: (typeof value === 'string'
|
|
10
|
+
? Number(value)
|
|
11
|
+
: Number.NaN);
|
|
12
|
+
return Number.isFinite(numberValue) ? numberValue : fallback;
|
|
13
|
+
}
|
|
14
|
+
export function normalizeSliderRange(minValue, maxValue) {
|
|
15
|
+
const min = normalizeSliderNumber(minValue, DEFAULT_MIN);
|
|
16
|
+
const max = normalizeSliderNumber(maxValue, DEFAULT_MAX);
|
|
17
|
+
if (max > min) {
|
|
18
|
+
return { min, max };
|
|
19
|
+
}
|
|
20
|
+
return { min: DEFAULT_MIN, max: DEFAULT_MAX };
|
|
21
|
+
}
|
|
22
|
+
export function clampSliderValue(value, range) {
|
|
23
|
+
return Math.min(Math.max(value, range.min), range.max);
|
|
24
|
+
}
|
|
25
|
+
export function toSliderRatio(value, range) {
|
|
26
|
+
const numericValue = normalizeSliderNumber(value, range.min);
|
|
27
|
+
return (clampSliderValue(numericValue, range) - range.min)
|
|
28
|
+
/ (range.max - range.min);
|
|
29
|
+
}
|
|
30
|
+
export function fromSliderRatio(ratio, range, step) {
|
|
31
|
+
const value = clampSliderValue(range.min + ratio * (range.max - range.min), range);
|
|
32
|
+
if (!step || step <= 0) {
|
|
33
|
+
return trimFloatingPoint(value);
|
|
34
|
+
}
|
|
35
|
+
const stepped = range.min + Math.round((value - range.min) / step) * step;
|
|
36
|
+
return trimFloatingPoint(clampSliderValue(stepped, range));
|
|
37
|
+
}
|
|
38
|
+
export function toSliderStepRatio(step, range) {
|
|
39
|
+
const stepValue = normalizeSliderNumber(step, Number.NaN);
|
|
40
|
+
if (!Number.isFinite(stepValue) || stepValue <= 0) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return Math.min(stepValue / (range.max - range.min), 1);
|
|
44
|
+
}
|
|
45
|
+
export function normalizeSliderLabel(value) {
|
|
46
|
+
if (value === null || value === undefined)
|
|
47
|
+
return '';
|
|
48
|
+
if (typeof value === 'string'
|
|
49
|
+
|| typeof value === 'number'
|
|
50
|
+
|| typeof value === 'boolean') {
|
|
51
|
+
return String(value);
|
|
52
|
+
}
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
function trimFloatingPoint(value) {
|
|
56
|
+
return Number(value.toFixed(12));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/catalog/Slider/utils.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,M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EAC7B,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Tabs": {
|
|
3
|
+
"properties": {
|
|
4
|
+
"tabs": {
|
|
5
|
+
"type": "array",
|
|
6
|
+
"items": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"title": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"child": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"title",
|
|
18
|
+
"child"
|
|
19
|
+
],
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"tabs"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GenericComponentProps } from '../../store/types.js';
|
|
2
|
+
import '../../../styles/catalog/Tabs.css';
|
|
3
|
+
/**
|
|
4
|
+
* @a2uiCatalog Tabs
|
|
5
|
+
*/
|
|
6
|
+
export interface TabsProps extends GenericComponentProps {
|
|
7
|
+
tabs: Array<{
|
|
8
|
+
title: string;
|
|
9
|
+
child: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare function Tabs(props: TabsProps): import('@lynx-js/react').ReactNode;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@lynx-js/react/jsx-runtime";
|
|
2
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
3
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
|
+
// LICENSE file in the root directory of this source tree.
|
|
5
|
+
import { useState } from '@lynx-js/react';
|
|
6
|
+
import { NodeRenderer } from '../../react/A2UIRenderer.js';
|
|
7
|
+
import '../../../styles/catalog/Tabs.css';
|
|
8
|
+
function TabsHeader(props) {
|
|
9
|
+
return (_jsx("view", { className: `tabs-header${props.active ? ' tabs-header-active' : ''}`, bindtap: props.onSelect, children: _jsx("text", { className: 'tabs-header-text', children: props.tab.title }) }));
|
|
10
|
+
}
|
|
11
|
+
function TabsContent(props) {
|
|
12
|
+
const childId = props.activeTab?.child;
|
|
13
|
+
if (!childId)
|
|
14
|
+
return null;
|
|
15
|
+
const child = props.surface.components.get(childId);
|
|
16
|
+
if (!child)
|
|
17
|
+
return null;
|
|
18
|
+
return _jsx(NodeRenderer, { component: child, surface: props.surface });
|
|
19
|
+
}
|
|
20
|
+
export function Tabs(props) {
|
|
21
|
+
const { surface, tabs } = props;
|
|
22
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
23
|
+
const activeIndex = tabs.length > 0
|
|
24
|
+
? Math.min(selectedIndex, tabs.length - 1)
|
|
25
|
+
: 0;
|
|
26
|
+
const activeTab = tabs[activeIndex];
|
|
27
|
+
if (tabs.length === 0) {
|
|
28
|
+
return _jsx("view", { className: 'tabs' });
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs("view", { className: 'tabs', children: [_jsx("view", { className: 'tabs-headers', children: tabs.map((tab, index) => (_jsx(TabsHeader, { active: index === activeIndex, onSelect: () => setSelectedIndex(index), tab: tab }, `${index}-${tab.child}`))) }), _jsx("view", { className: 'tabs-content', children: _jsx(TabsContent, { activeTab: activeTab, surface: surface }) })] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/Tabs/index.tsx"],"names":[],"mappings":";AAAA,wDAAwD;A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C,CAAC;IAEpC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,eAAM,SAAS,EAAC,MAAM,GAAG,CAAC;IACnC,CAAC;IAED,OAAO,CACL,gBAAM,SAAS,EAAC,MAAM,aACpB,eAAM,SAAS,EAAC,cAAc,YAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACxB,KAAC,UAAU,IAET,MAAM,EAAE,KAAK,KAAK,WAAW,EAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACvC,GAAG,EAAE,GAAG,IAHH,GAAG,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAI5B,CACH,CAAC,GACG,EACP,eAAM,SAAS,EAAC,cAAc,YAC5B,KAAC,WAAW,IACV,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GAChB,GACG,IACF,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Text": {
|
|
3
|
+
"properties": {
|
|
4
|
+
"text": {
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"path": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"path"
|
|
18
|
+
],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"call": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"args": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": true
|
|
30
|
+
},
|
|
31
|
+
"returnType": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": [
|
|
34
|
+
"string",
|
|
35
|
+
"number",
|
|
36
|
+
"boolean",
|
|
37
|
+
"object",
|
|
38
|
+
"array",
|
|
39
|
+
"any",
|
|
40
|
+
"void"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"call",
|
|
46
|
+
"args"
|
|
47
|
+
],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"description": "Literal text, path binding, or function call."
|
|
52
|
+
},
|
|
53
|
+
"variant": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"enum": [
|
|
56
|
+
"h1",
|
|
57
|
+
"h2",
|
|
58
|
+
"h3",
|
|
59
|
+
"h4",
|
|
60
|
+
"h5",
|
|
61
|
+
"caption",
|
|
62
|
+
"body",
|
|
63
|
+
"markdown"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"weight": {
|
|
67
|
+
"type": "number"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"required": [
|
|
71
|
+
"text"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GenericComponentProps } from '../../store/types.js';
|
|
2
|
+
import '../../../styles/catalog/Text.css';
|
|
3
|
+
/**
|
|
4
|
+
* @a2uiCatalog Text
|
|
5
|
+
*/
|
|
6
|
+
export interface TextProps extends GenericComponentProps {
|
|
7
|
+
/** Literal text, path binding, or function call. */
|
|
8
|
+
text: string | {
|
|
9
|
+
path: string;
|
|
10
|
+
} | {
|
|
11
|
+
call: string;
|
|
12
|
+
args: Record<string, unknown>;
|
|
13
|
+
returnType?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any' | 'void';
|
|
14
|
+
};
|
|
15
|
+
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'caption' | 'body' | 'markdown';
|
|
16
|
+
weight?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function Text(props: TextProps): import('@lynx-js/react').ReactNode;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@lynx-js/react/jsx-runtime";
|
|
2
|
+
import '../../../styles/catalog/Text.css';
|
|
3
|
+
export function Text(props) {
|
|
4
|
+
const id = props.id;
|
|
5
|
+
const text = props.text;
|
|
6
|
+
const variant = props.variant ?? 'body';
|
|
7
|
+
const weight = props.weight;
|
|
8
|
+
let weightClass = '';
|
|
9
|
+
if (typeof weight === 'number') {
|
|
10
|
+
if (weight >= 2) {
|
|
11
|
+
weightClass = 'text-weight-2';
|
|
12
|
+
}
|
|
13
|
+
else if (weight >= 1.5) {
|
|
14
|
+
weightClass = 'text-weight-1-5';
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
weightClass = 'text-weight-1';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (variant === 'markdown') {
|
|
21
|
+
return (
|
|
22
|
+
// @ts-expect-error support markdown future
|
|
23
|
+
_jsx("x-markdown", { content: text }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsx("text", { className: `text-${variant} ${weightClass}`, children: text }, id));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/Text/index.tsx"],"names":[],"mappings":";AAIA,OAAO,kCAAkC,CAAC;AAuB1C,MAAM,UAAU,IAAI,CAClB,KAAgB;IAEhB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAc,CAAC;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC;IACxC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YAChB,WAAW,GAAG,eAAe,CAAC;QAChC,CAAC;aAAM,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;YACzB,WAAW,GAAG,iBAAiB,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,WAAW,GAAG,eAAe,CAAC;QAChC,CAAC;IACH,CAAC;IAED,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;QAC3B,OAAO;QACL,2CAA2C;QAC3C,qBAAY,OAAO,EAAE,IAAI,GAAI,CAC9B,CAAC;IACJ,CAAC;IACD,OAAO,CACL,eAAe,SAAS,EAAE,QAAQ,OAAO,IAAI,WAAW,EAAE,YACvD,IAAI,IADI,EAAE,CAEN,CACR,CAAC;AACJ,CAAC"}
|