@copilotkit/a2ui-renderer 1.51.4-next.4 → 1.51.4-next.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/dist/.tsbuildinfo +1 -1
- package/dist/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/A2UIMessageRenderer.js +71 -140
- package/dist/A2UIMessageRenderer.js.map +1 -1
- package/dist/A2UIViewer.d.ts +11 -1
- package/dist/A2UIViewer.d.ts.map +1 -1
- package/dist/A2UIViewer.js +58 -102
- package/dist/A2UIViewer.js.map +1 -1
- package/dist/__tests__/A2UIMessageRenderer.test.js +57 -232
- package/dist/__tests__/A2UIMessageRenderer.test.js.map +1 -1
- package/dist/__tests__/setup.js +0 -13
- package/dist/__tests__/setup.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1000
- package/dist/index.umd.js.map +1 -1
- package/dist/react-renderer/components/content/AudioPlayer.d.ts +8 -0
- package/dist/react-renderer/components/content/AudioPlayer.d.ts.map +1 -0
- package/dist/react-renderer/components/content/AudioPlayer.js +23 -0
- package/dist/react-renderer/components/content/AudioPlayer.js.map +1 -0
- package/dist/react-renderer/components/content/Divider.d.ts +13 -0
- package/dist/react-renderer/components/content/Divider.d.ts.map +1 -0
- package/dist/react-renderer/components/content/Divider.js +22 -0
- package/dist/react-renderer/components/content/Divider.js.map +1 -0
- package/dist/react-renderer/components/content/Icon.d.ts +16 -0
- package/dist/react-renderer/components/content/Icon.d.ts.map +1 -0
- package/dist/react-renderer/components/content/Icon.js +40 -0
- package/dist/react-renderer/components/content/Icon.js.map +1 -0
- package/dist/react-renderer/components/content/Image.d.ts +11 -0
- package/dist/react-renderer/components/content/Image.d.ts.map +1 -0
- package/dist/react-renderer/components/content/Image.js +34 -0
- package/dist/react-renderer/components/content/Image.js.map +1 -0
- package/dist/react-renderer/components/content/Text.d.ts +28 -0
- package/dist/react-renderer/components/content/Text.d.ts.map +1 -0
- package/dist/react-renderer/components/content/Text.js +132 -0
- package/dist/react-renderer/components/content/Text.js.map +1 -0
- package/dist/react-renderer/components/content/Video.d.ts +10 -0
- package/dist/react-renderer/components/content/Video.d.ts.map +1 -0
- package/dist/react-renderer/components/content/Video.js +41 -0
- package/dist/react-renderer/components/content/Video.js.map +1 -0
- package/dist/react-renderer/components/content/index.d.ts +7 -0
- package/dist/react-renderer/components/content/index.d.ts.map +1 -0
- package/dist/react-renderer/components/content/index.js +7 -0
- package/dist/react-renderer/components/content/index.js.map +1 -0
- package/dist/react-renderer/components/interactive/Button.d.ts +11 -0
- package/dist/react-renderer/components/interactive/Button.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/Button.js +27 -0
- package/dist/react-renderer/components/interactive/Button.js.map +1 -0
- package/dist/react-renderer/components/interactive/CheckBox.d.ts +10 -0
- package/dist/react-renderer/components/interactive/CheckBox.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/CheckBox.js +55 -0
- package/dist/react-renderer/components/interactive/CheckBox.js.map +1 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.d.ts +10 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.js +68 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.js.map +1 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.d.ts +11 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.js +43 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.js.map +1 -0
- package/dist/react-renderer/components/interactive/Slider.d.ts +10 -0
- package/dist/react-renderer/components/interactive/Slider.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/Slider.js +62 -0
- package/dist/react-renderer/components/interactive/Slider.js.map +1 -0
- package/dist/react-renderer/components/interactive/TextField.d.ts +10 -0
- package/dist/react-renderer/components/interactive/TextField.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/TextField.js +63 -0
- package/dist/react-renderer/components/interactive/TextField.js.map +1 -0
- package/dist/react-renderer/components/interactive/index.d.ts +7 -0
- package/dist/react-renderer/components/interactive/index.d.ts.map +1 -0
- package/dist/react-renderer/components/interactive/index.js +7 -0
- package/dist/react-renderer/components/interactive/index.js.map +1 -0
- package/dist/react-renderer/components/layout/Card.d.ts +17 -0
- package/dist/react-renderer/components/layout/Card.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/Card.js +39 -0
- package/dist/react-renderer/components/layout/Card.js.map +1 -0
- package/dist/react-renderer/components/layout/Column.d.ts +10 -0
- package/dist/react-renderer/components/layout/Column.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/Column.js +33 -0
- package/dist/react-renderer/components/layout/Column.js.map +1 -0
- package/dist/react-renderer/components/layout/List.d.ts +10 -0
- package/dist/react-renderer/components/layout/List.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/List.js +32 -0
- package/dist/react-renderer/components/layout/List.js.map +1 -0
- package/dist/react-renderer/components/layout/Modal.d.ts +15 -0
- package/dist/react-renderer/components/layout/Modal.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/Modal.js +65 -0
- package/dist/react-renderer/components/layout/Modal.js.map +1 -0
- package/dist/react-renderer/components/layout/Row.d.ts +10 -0
- package/dist/react-renderer/components/layout/Row.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/Row.js +33 -0
- package/dist/react-renderer/components/layout/Row.js.map +1 -0
- package/dist/react-renderer/components/layout/Tabs.d.ts +8 -0
- package/dist/react-renderer/components/layout/Tabs.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/Tabs.js +29 -0
- package/dist/react-renderer/components/layout/Tabs.js.map +1 -0
- package/dist/react-renderer/components/layout/index.d.ts +7 -0
- package/dist/react-renderer/components/layout/index.d.ts.map +1 -0
- package/dist/react-renderer/components/layout/index.js +7 -0
- package/dist/react-renderer/components/layout/index.js.map +1 -0
- package/dist/react-renderer/core/A2UIProvider.d.ts +82 -0
- package/dist/react-renderer/core/A2UIProvider.d.ts.map +1 -0
- package/dist/react-renderer/core/A2UIProvider.js +156 -0
- package/dist/react-renderer/core/A2UIProvider.js.map +1 -0
- package/dist/react-renderer/core/A2UIRenderer.d.ts +36 -0
- package/dist/react-renderer/core/A2UIRenderer.d.ts.map +1 -0
- package/dist/react-renderer/core/A2UIRenderer.js +83 -0
- package/dist/react-renderer/core/A2UIRenderer.js.map +1 -0
- package/dist/react-renderer/core/A2UIViewer.d.ts +56 -0
- package/dist/react-renderer/core/A2UIViewer.d.ts.map +1 -0
- package/dist/react-renderer/core/A2UIViewer.js +135 -0
- package/dist/react-renderer/core/A2UIViewer.js.map +1 -0
- package/dist/react-renderer/core/ComponentNode.d.ts +25 -0
- package/dist/react-renderer/core/ComponentNode.d.ts.map +1 -0
- package/dist/react-renderer/core/ComponentNode.js +43 -0
- package/dist/react-renderer/core/ComponentNode.js.map +1 -0
- package/dist/react-renderer/core/store.d.ts +37 -0
- package/dist/react-renderer/core/store.d.ts.map +1 -0
- package/dist/react-renderer/core/store.js +2 -0
- package/dist/react-renderer/core/store.js.map +1 -0
- package/dist/react-renderer/hooks/useA2UI.d.ts +46 -0
- package/dist/react-renderer/hooks/useA2UI.d.ts.map +1 -0
- package/dist/react-renderer/hooks/useA2UI.js +41 -0
- package/dist/react-renderer/hooks/useA2UI.js.map +1 -0
- package/dist/react-renderer/hooks/useA2UIComponent.d.ts +52 -0
- package/dist/react-renderer/hooks/useA2UIComponent.d.ts.map +1 -0
- package/dist/react-renderer/hooks/useA2UIComponent.js +166 -0
- package/dist/react-renderer/hooks/useA2UIComponent.js.map +1 -0
- package/dist/react-renderer/index.d.ts +37 -0
- package/dist/react-renderer/index.d.ts.map +1 -0
- package/dist/react-renderer/index.js +40 -0
- package/dist/react-renderer/index.js.map +1 -0
- package/dist/react-renderer/lib/utils.d.ts +32 -0
- package/dist/react-renderer/lib/utils.d.ts.map +1 -0
- package/dist/react-renderer/lib/utils.js +41 -0
- package/dist/react-renderer/lib/utils.js.map +1 -0
- package/dist/react-renderer/registry/ComponentRegistry.d.ts +78 -0
- package/dist/react-renderer/registry/ComponentRegistry.d.ts.map +1 -0
- package/dist/react-renderer/registry/ComponentRegistry.js +113 -0
- package/dist/react-renderer/registry/ComponentRegistry.js.map +1 -0
- package/dist/react-renderer/registry/defaultCatalog.d.ts +13 -0
- package/dist/react-renderer/registry/defaultCatalog.d.ts.map +1 -0
- package/dist/react-renderer/registry/defaultCatalog.js +59 -0
- package/dist/react-renderer/registry/defaultCatalog.js.map +1 -0
- package/dist/react-renderer/styles/index.d.ts +41 -0
- package/dist/react-renderer/styles/index.d.ts.map +1 -0
- package/dist/react-renderer/styles/index.js +473 -0
- package/dist/react-renderer/styles/index.js.map +1 -0
- package/dist/react-renderer/styles/reset.d.ts +18 -0
- package/dist/react-renderer/styles/reset.d.ts.map +1 -0
- package/dist/react-renderer/styles/reset.js +24 -0
- package/dist/react-renderer/styles/reset.js.map +1 -0
- package/dist/react-renderer/theme/ThemeContext.d.ts +29 -0
- package/dist/react-renderer/theme/ThemeContext.d.ts.map +1 -0
- package/dist/react-renderer/theme/ThemeContext.js +35 -0
- package/dist/react-renderer/theme/ThemeContext.js.map +1 -0
- package/dist/react-renderer/theme/litTheme.d.ts +8 -0
- package/dist/react-renderer/theme/litTheme.d.ts.map +1 -0
- package/dist/react-renderer/theme/litTheme.js +401 -0
- package/dist/react-renderer/theme/litTheme.js.map +1 -0
- package/dist/react-renderer/theme/utils.d.ts +23 -0
- package/dist/react-renderer/theme/utils.d.ts.map +1 -0
- package/dist/react-renderer/theme/utils.js +46 -0
- package/dist/react-renderer/theme/utils.js.map +1 -0
- package/dist/react-renderer/types.d.ts +53 -0
- package/dist/react-renderer/types.d.ts.map +1 -0
- package/dist/react-renderer/types.js +2 -0
- package/dist/react-renderer/types.js.map +1 -0
- package/package.json +6 -6
- package/dist/styles/components.d.ts +0 -7
- package/dist/styles/components.d.ts.map +0 -1
- package/dist/styles/components.js +0 -7
- package/dist/styles/components.js.map +0 -1
- package/dist/styles/global.d.ts +0 -2
- package/dist/styles/global.d.ts.map +0 -1
- package/dist/styles/global.js +0 -145
- package/dist/styles/global.js.map +0 -1
- package/dist/themed-surface.d.ts +0 -20
- package/dist/themed-surface.d.ts.map +0 -1
- package/dist/themed-surface.js +0 -133
- package/dist/themed-surface.js.map +0 -1
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { Styles } from '@a2ui/lit/0.8';
|
|
2
|
+
import { resetStyles } from './reset';
|
|
3
|
+
/**
|
|
4
|
+
* Structural CSS styles from the Lit renderer, converted for global DOM use.
|
|
5
|
+
* These styles define all the utility classes (layout-*, typography-*, color-*, etc.)
|
|
6
|
+
* Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.
|
|
7
|
+
*/
|
|
8
|
+
export const structuralStyles = Styles.structuralStyles.replace(/:host\s*\{/g, '.a2ui-surface {');
|
|
9
|
+
/**
|
|
10
|
+
* Component-specific styles that replicate Lit's Shadow DOM scoped CSS.
|
|
11
|
+
*
|
|
12
|
+
* Each Lit component has `static styles` with :host, element selectors, and ::slotted().
|
|
13
|
+
* Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.
|
|
14
|
+
*
|
|
15
|
+
* Transformation rules:
|
|
16
|
+
* :host → .a2ui-surface .a2ui-{component}
|
|
17
|
+
* section → .a2ui-surface .a2ui-{component} section
|
|
18
|
+
* ::slotted(*) → .a2ui-surface .a2ui-{component} section > *
|
|
19
|
+
*/
|
|
20
|
+
export const componentSpecificStyles = `
|
|
21
|
+
/* =========================================================================
|
|
22
|
+
* Card (from Lit card.ts static styles)
|
|
23
|
+
* ========================================================================= */
|
|
24
|
+
|
|
25
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
26
|
+
.a2ui-surface .a2ui-card {
|
|
27
|
+
display: block;
|
|
28
|
+
flex: var(--weight);
|
|
29
|
+
min-height: 0;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */
|
|
34
|
+
/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */
|
|
35
|
+
.a2ui-surface .a2ui-card > section {
|
|
36
|
+
height: 100%;
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-height: 0;
|
|
39
|
+
overflow: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* section ::slotted(*) { height: 100%; width: 100%; } */
|
|
43
|
+
/* Use > section > to only target Card's slotted children, not deeply nested elements */
|
|
44
|
+
.a2ui-surface .a2ui-card > section > * {
|
|
45
|
+
height: 100%;
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* =========================================================================
|
|
50
|
+
* Divider (from Lit divider.ts static styles)
|
|
51
|
+
* ========================================================================= */
|
|
52
|
+
|
|
53
|
+
/* :host { display: block; min-height: 0; overflow: auto; } */
|
|
54
|
+
.a2ui-surface .a2ui-divider {
|
|
55
|
+
display: block;
|
|
56
|
+
min-height: 0;
|
|
57
|
+
overflow: auto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* hr { height: 1px; background: #ccc; border: none; } */
|
|
61
|
+
/* Use :where() for low specificity (0,0,1) so theme utility classes can override */
|
|
62
|
+
/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */
|
|
63
|
+
:where(.a2ui-surface .a2ui-divider) hr {
|
|
64
|
+
height: 1px;
|
|
65
|
+
background: #ccc;
|
|
66
|
+
border: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* =========================================================================
|
|
70
|
+
* Text (from Lit text.ts static styles)
|
|
71
|
+
* ========================================================================= */
|
|
72
|
+
|
|
73
|
+
/* :host { display: block; flex: var(--weight); } */
|
|
74
|
+
.a2ui-surface .a2ui-text {
|
|
75
|
+
display: block;
|
|
76
|
+
flex: var(--weight);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */
|
|
80
|
+
/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */
|
|
81
|
+
:where(.a2ui-surface .a2ui-text) h1,
|
|
82
|
+
:where(.a2ui-surface .a2ui-text) h2,
|
|
83
|
+
:where(.a2ui-surface .a2ui-text) h3,
|
|
84
|
+
:where(.a2ui-surface .a2ui-text) h4,
|
|
85
|
+
:where(.a2ui-surface .a2ui-text) h5 {
|
|
86
|
+
line-height: inherit;
|
|
87
|
+
font: inherit;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Ensure markdown paragraph margins are reset */
|
|
91
|
+
.a2ui-surface .a2ui-text p {
|
|
92
|
+
margin: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* =========================================================================
|
|
96
|
+
* TextField (from Lit text-field.ts static styles)
|
|
97
|
+
* ========================================================================= */
|
|
98
|
+
|
|
99
|
+
/* :host { display: flex; flex: var(--weight); } */
|
|
100
|
+
.a2ui-surface .a2ui-textfield {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex: var(--weight);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* input { display: block; width: 100%; } */
|
|
106
|
+
:where(.a2ui-surface .a2ui-textfield) input {
|
|
107
|
+
display: block;
|
|
108
|
+
width: 100%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* label { display: block; margin-bottom: 4px; } */
|
|
112
|
+
:where(.a2ui-surface .a2ui-textfield) label {
|
|
113
|
+
display: block;
|
|
114
|
+
margin-bottom: 4px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* textarea - same styling as input for multiline text fields */
|
|
118
|
+
:where(.a2ui-surface .a2ui-textfield) textarea {
|
|
119
|
+
display: block;
|
|
120
|
+
width: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* =========================================================================
|
|
124
|
+
* CheckBox (from Lit checkbox.ts static styles)
|
|
125
|
+
* ========================================================================= */
|
|
126
|
+
|
|
127
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
128
|
+
.a2ui-surface .a2ui-checkbox {
|
|
129
|
+
display: block;
|
|
130
|
+
flex: var(--weight);
|
|
131
|
+
min-height: 0;
|
|
132
|
+
overflow: auto;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* input { display: block; width: 100%; } */
|
|
136
|
+
:where(.a2ui-surface .a2ui-checkbox) input {
|
|
137
|
+
display: block;
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* =========================================================================
|
|
142
|
+
* Slider (from Lit slider.ts static styles)
|
|
143
|
+
* ========================================================================= */
|
|
144
|
+
|
|
145
|
+
/* :host { display: block; flex: var(--weight); } */
|
|
146
|
+
.a2ui-surface .a2ui-slider {
|
|
147
|
+
display: block;
|
|
148
|
+
flex: var(--weight);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* input { display: block; width: 100%; } */
|
|
152
|
+
:where(.a2ui-surface .a2ui-slider) input {
|
|
153
|
+
display: block;
|
|
154
|
+
width: 100%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* =========================================================================
|
|
158
|
+
* Button (from Lit button.ts static styles)
|
|
159
|
+
* ========================================================================= */
|
|
160
|
+
|
|
161
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; } */
|
|
162
|
+
.a2ui-surface .a2ui-button {
|
|
163
|
+
display: block;
|
|
164
|
+
flex: var(--weight);
|
|
165
|
+
min-height: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* =========================================================================
|
|
169
|
+
* Icon (from Lit icon.ts static styles)
|
|
170
|
+
* ========================================================================= */
|
|
171
|
+
|
|
172
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
173
|
+
.a2ui-surface .a2ui-icon {
|
|
174
|
+
display: block;
|
|
175
|
+
flex: var(--weight);
|
|
176
|
+
min-height: 0;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* =========================================================================
|
|
181
|
+
* Tabs (from Lit tabs.ts static styles)
|
|
182
|
+
* ========================================================================= */
|
|
183
|
+
|
|
184
|
+
/* :host { display: block; flex: var(--weight); } */
|
|
185
|
+
.a2ui-surface .a2ui-tabs {
|
|
186
|
+
display: block;
|
|
187
|
+
flex: var(--weight);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* =========================================================================
|
|
191
|
+
* Modal (from Lit modal.ts static styles)
|
|
192
|
+
* ========================================================================= */
|
|
193
|
+
|
|
194
|
+
/* :host { display: block; flex: var(--weight); } */
|
|
195
|
+
.a2ui-surface .a2ui-modal {
|
|
196
|
+
display: block;
|
|
197
|
+
flex: var(--weight);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* dialog { padding: 0; border: none; background: none; } */
|
|
201
|
+
:where(.a2ui-surface .a2ui-modal) dialog {
|
|
202
|
+
padding: 0;
|
|
203
|
+
border: none;
|
|
204
|
+
background: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */
|
|
208
|
+
.a2ui-surface .a2ui-modal dialog section #controls {
|
|
209
|
+
display: flex;
|
|
210
|
+
justify-content: end;
|
|
211
|
+
margin-bottom: 4px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* dialog section #controls button { padding: 0; background: none; ... } */
|
|
215
|
+
.a2ui-surface .a2ui-modal dialog section #controls button {
|
|
216
|
+
padding: 0;
|
|
217
|
+
background: none;
|
|
218
|
+
width: 20px;
|
|
219
|
+
height: 20px;
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
border: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* =========================================================================
|
|
225
|
+
* Image (from Lit image.ts static styles)
|
|
226
|
+
* ========================================================================= */
|
|
227
|
+
|
|
228
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
229
|
+
.a2ui-surface .a2ui-image {
|
|
230
|
+
display: block;
|
|
231
|
+
flex: var(--weight);
|
|
232
|
+
min-height: 0;
|
|
233
|
+
overflow: auto;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */
|
|
237
|
+
:where(.a2ui-surface .a2ui-image) img {
|
|
238
|
+
display: block;
|
|
239
|
+
width: 100%;
|
|
240
|
+
height: 100%;
|
|
241
|
+
object-fit: var(--object-fit, fill);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* =========================================================================
|
|
245
|
+
* Video (from Lit video.ts static styles)
|
|
246
|
+
* ========================================================================= */
|
|
247
|
+
|
|
248
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
249
|
+
.a2ui-surface .a2ui-video {
|
|
250
|
+
display: block;
|
|
251
|
+
flex: var(--weight);
|
|
252
|
+
min-height: 0;
|
|
253
|
+
overflow: auto;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* video { display: block; width: 100%; } */
|
|
257
|
+
:where(.a2ui-surface .a2ui-video) video {
|
|
258
|
+
display: block;
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* =========================================================================
|
|
263
|
+
* AudioPlayer (from Lit audio.ts static styles)
|
|
264
|
+
* ========================================================================= */
|
|
265
|
+
|
|
266
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
267
|
+
.a2ui-surface .a2ui-audio {
|
|
268
|
+
display: block;
|
|
269
|
+
flex: var(--weight);
|
|
270
|
+
min-height: 0;
|
|
271
|
+
overflow: auto;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* audio { display: block; width: 100%; } */
|
|
275
|
+
:where(.a2ui-surface .a2ui-audio) audio {
|
|
276
|
+
display: block;
|
|
277
|
+
width: 100%;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* =========================================================================
|
|
281
|
+
* MultipleChoice (from Lit multiple-choice.ts static styles)
|
|
282
|
+
* ========================================================================= */
|
|
283
|
+
|
|
284
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
285
|
+
.a2ui-surface .a2ui-multiplechoice {
|
|
286
|
+
display: block;
|
|
287
|
+
flex: var(--weight);
|
|
288
|
+
min-height: 0;
|
|
289
|
+
overflow: auto;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* select { width: 100%; } */
|
|
293
|
+
:where(.a2ui-surface .a2ui-multiplechoice) select {
|
|
294
|
+
width: 100%;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* =========================================================================
|
|
298
|
+
* Column (from Lit column.ts static styles)
|
|
299
|
+
* ========================================================================= */
|
|
300
|
+
|
|
301
|
+
/* :host { display: flex; flex: var(--weight); } */
|
|
302
|
+
.a2ui-surface .a2ui-column {
|
|
303
|
+
display: flex;
|
|
304
|
+
flex: var(--weight);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */
|
|
308
|
+
.a2ui-surface .a2ui-column > section {
|
|
309
|
+
display: flex;
|
|
310
|
+
flex-direction: column;
|
|
311
|
+
min-width: 100%;
|
|
312
|
+
height: 100%;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/* :host([alignment="..."]) section { align-items: ...; } */
|
|
316
|
+
/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */
|
|
317
|
+
.a2ui-surface .a2ui-column[data-alignment="start"] > section { align-items: start; }
|
|
318
|
+
.a2ui-surface .a2ui-column[data-alignment="center"] > section { align-items: center; }
|
|
319
|
+
.a2ui-surface .a2ui-column[data-alignment="end"] > section { align-items: end; }
|
|
320
|
+
.a2ui-surface .a2ui-column[data-alignment="stretch"] > section { align-items: stretch; }
|
|
321
|
+
|
|
322
|
+
/* :host([distribution="..."]) section { justify-content: ...; } */
|
|
323
|
+
.a2ui-surface .a2ui-column[data-distribution="start"] > section { justify-content: start; }
|
|
324
|
+
.a2ui-surface .a2ui-column[data-distribution="center"] > section { justify-content: center; }
|
|
325
|
+
.a2ui-surface .a2ui-column[data-distribution="end"] > section { justify-content: end; }
|
|
326
|
+
.a2ui-surface .a2ui-column[data-distribution="spaceBetween"] > section { justify-content: space-between; }
|
|
327
|
+
.a2ui-surface .a2ui-column[data-distribution="spaceAround"] > section { justify-content: space-around; }
|
|
328
|
+
.a2ui-surface .a2ui-column[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
|
|
329
|
+
|
|
330
|
+
/* =========================================================================
|
|
331
|
+
* Row (from Lit row.ts static styles)
|
|
332
|
+
* ========================================================================= */
|
|
333
|
+
|
|
334
|
+
/* :host { display: flex; flex: var(--weight); } */
|
|
335
|
+
.a2ui-surface .a2ui-row {
|
|
336
|
+
display: flex;
|
|
337
|
+
flex: var(--weight);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */
|
|
341
|
+
.a2ui-surface .a2ui-row > section {
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-direction: row;
|
|
344
|
+
width: 100%;
|
|
345
|
+
min-height: 100%;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* :host([alignment="..."]) section { align-items: ...; } */
|
|
349
|
+
/* Use > section to only target Row's direct section, not nested sections */
|
|
350
|
+
.a2ui-surface .a2ui-row[data-alignment="start"] > section { align-items: start; }
|
|
351
|
+
.a2ui-surface .a2ui-row[data-alignment="center"] > section { align-items: center; }
|
|
352
|
+
.a2ui-surface .a2ui-row[data-alignment="end"] > section { align-items: end; }
|
|
353
|
+
.a2ui-surface .a2ui-row[data-alignment="stretch"] > section { align-items: stretch; }
|
|
354
|
+
|
|
355
|
+
/* :host([distribution="..."]) section { justify-content: ...; } */
|
|
356
|
+
.a2ui-surface .a2ui-row[data-distribution="start"] > section { justify-content: start; }
|
|
357
|
+
.a2ui-surface .a2ui-row[data-distribution="center"] > section { justify-content: center; }
|
|
358
|
+
.a2ui-surface .a2ui-row[data-distribution="end"] > section { justify-content: end; }
|
|
359
|
+
.a2ui-surface .a2ui-row[data-distribution="spaceBetween"] > section { justify-content: space-between; }
|
|
360
|
+
.a2ui-surface .a2ui-row[data-distribution="spaceAround"] > section { justify-content: space-around; }
|
|
361
|
+
.a2ui-surface .a2ui-row[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
|
|
362
|
+
|
|
363
|
+
/* =========================================================================
|
|
364
|
+
* List (from Lit list.ts static styles)
|
|
365
|
+
* ========================================================================= */
|
|
366
|
+
|
|
367
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
368
|
+
.a2ui-surface .a2ui-list {
|
|
369
|
+
display: block;
|
|
370
|
+
flex: var(--weight);
|
|
371
|
+
min-height: 0;
|
|
372
|
+
overflow: auto;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* :host([direction="vertical"]) section { display: grid; } */
|
|
376
|
+
.a2ui-surface .a2ui-list[data-direction="vertical"] > section {
|
|
377
|
+
display: grid;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/* :host([direction="horizontal"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */
|
|
381
|
+
.a2ui-surface .a2ui-list[data-direction="horizontal"] > section {
|
|
382
|
+
display: flex;
|
|
383
|
+
max-width: 100%;
|
|
384
|
+
overflow-x: scroll;
|
|
385
|
+
overflow-y: hidden;
|
|
386
|
+
scrollbar-width: none;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* :host([direction="horizontal"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */
|
|
390
|
+
.a2ui-surface .a2ui-list[data-direction="horizontal"] > section > * {
|
|
391
|
+
flex: 1 0 fit-content;
|
|
392
|
+
max-width: min(80%, 400px);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* =========================================================================
|
|
396
|
+
* DateTimeInput (from Lit datetime-input.ts static styles)
|
|
397
|
+
* ========================================================================= */
|
|
398
|
+
|
|
399
|
+
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
400
|
+
.a2ui-surface .a2ui-datetime-input {
|
|
401
|
+
display: block;
|
|
402
|
+
flex: var(--weight);
|
|
403
|
+
min-height: 0;
|
|
404
|
+
overflow: auto;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */
|
|
408
|
+
/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */
|
|
409
|
+
:where(.a2ui-surface .a2ui-datetime-input) input {
|
|
410
|
+
display: block;
|
|
411
|
+
border-radius: 8px;
|
|
412
|
+
padding: 8px;
|
|
413
|
+
border: 1px solid #ccc;
|
|
414
|
+
width: 100%;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* =========================================================================
|
|
418
|
+
* Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)
|
|
419
|
+
* ========================================================================= */
|
|
420
|
+
|
|
421
|
+
.a2ui-surface *,
|
|
422
|
+
.a2ui-surface *::before,
|
|
423
|
+
.a2ui-surface *::after {
|
|
424
|
+
box-sizing: border-box;
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
/**
|
|
428
|
+
* Injects A2UI structural styles into the document head.
|
|
429
|
+
* Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.
|
|
430
|
+
* Call this once at application startup.
|
|
431
|
+
*
|
|
432
|
+
* NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,
|
|
433
|
+
* just like in the Lit renderer. This allows full customization of the color palette.
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```tsx
|
|
437
|
+
* import { injectStyles } from '@a2ui/react/styles';
|
|
438
|
+
*
|
|
439
|
+
* // In your app entry point:
|
|
440
|
+
* injectStyles();
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
export function injectStyles() {
|
|
444
|
+
if (typeof document === 'undefined') {
|
|
445
|
+
return; // SSR safety
|
|
446
|
+
}
|
|
447
|
+
const styleId = 'a2ui-structural-styles';
|
|
448
|
+
// Avoid duplicate injection
|
|
449
|
+
if (document.getElementById(styleId)) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const styleElement = document.createElement('style');
|
|
453
|
+
styleElement.id = styleId;
|
|
454
|
+
// Include structural (utility classes) and component-specific styles
|
|
455
|
+
// Note: CSS variables (palette) must be defined by the host application on :root,
|
|
456
|
+
// just like in the Lit renderer. This allows full customization.
|
|
457
|
+
styleElement.textContent = resetStyles + '\n' + structuralStyles + '\n' + componentSpecificStyles;
|
|
458
|
+
document.head.appendChild(styleElement);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Removes injected A2UI styles from the document.
|
|
462
|
+
* Useful for cleanup in tests or when unmounting.
|
|
463
|
+
*/
|
|
464
|
+
export function removeStyles() {
|
|
465
|
+
if (typeof document === 'undefined') {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const styleElement = document.getElementById('a2ui-structural-styles');
|
|
469
|
+
if (styleElement) {
|
|
470
|
+
styleElement.remove();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-renderer/styles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAW,MAAM,CAAC,gBAAgB,CAAC,OAAO,CACrE,aAAa,EACb,iBAAiB,CAClB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsZ9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,CAAC,aAAa;IACvB,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC;IAEzC,4BAA4B;IAC5B,IAAI,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,GAAG,OAAO,CAAC;IAC1B,qEAAqE;IACrE,kFAAkF;IAClF,iEAAiE;IACjE,YAAY,CAAC,WAAW,GAAG,WAAW,GAAG,IAAI,GAAG,gBAAgB,GAAG,IAAI,GAAG,uBAAuB,CAAC;IAClG,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;IACvE,IAAI,YAAY,EAAE,CAAC;QACjB,YAAY,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser default reset for A2UI surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The React renderer uses Light DOM, which means host-app CSS resets
|
|
5
|
+
* (e.g. Tailwind preflight, normalize.css) can strip browser defaults
|
|
6
|
+
* like heading margins, list styles, and form element appearance from
|
|
7
|
+
* elements inside the renderer.
|
|
8
|
+
*
|
|
9
|
+
* The Lit renderer avoids this because Shadow DOM isolates its elements
|
|
10
|
+
* from external stylesheets.
|
|
11
|
+
*
|
|
12
|
+
* This reset restores browser defaults inside `.a2ui-surface` by using
|
|
13
|
+
* `all: revert` in a CSS @layer. Layered styles have the lowest author
|
|
14
|
+
* priority, so every other A2UI style (utility classes, component styles,
|
|
15
|
+
* theme classes, inline styles) automatically overrides the reset.
|
|
16
|
+
*/
|
|
17
|
+
export declare const resetStyles: string;
|
|
18
|
+
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/react-renderer/styles/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,EAAE,MAMzB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser default reset for A2UI surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The React renderer uses Light DOM, which means host-app CSS resets
|
|
5
|
+
* (e.g. Tailwind preflight, normalize.css) can strip browser defaults
|
|
6
|
+
* like heading margins, list styles, and form element appearance from
|
|
7
|
+
* elements inside the renderer.
|
|
8
|
+
*
|
|
9
|
+
* The Lit renderer avoids this because Shadow DOM isolates its elements
|
|
10
|
+
* from external stylesheets.
|
|
11
|
+
*
|
|
12
|
+
* This reset restores browser defaults inside `.a2ui-surface` by using
|
|
13
|
+
* `all: revert` in a CSS @layer. Layered styles have the lowest author
|
|
14
|
+
* priority, so every other A2UI style (utility classes, component styles,
|
|
15
|
+
* theme classes, inline styles) automatically overrides the reset.
|
|
16
|
+
*/
|
|
17
|
+
export const resetStyles = `
|
|
18
|
+
@layer a2ui-reset {
|
|
19
|
+
:where(.a2ui-surface) :where(*) {
|
|
20
|
+
all: revert;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
//# sourceMappingURL=reset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/react-renderer/styles/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;;;;;;CAMlC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Types } from '@a2ui/lit/0.8';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the ThemeProvider component.
|
|
5
|
+
*/
|
|
6
|
+
export interface ThemeProviderProps {
|
|
7
|
+
/** The theme to provide. Falls back to defaultTheme if not specified. */
|
|
8
|
+
theme?: Types.Theme;
|
|
9
|
+
/** Child components that will have access to the theme */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provider component that makes the A2UI theme available to descendant components.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ThemeProvider({ theme, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Hook to access the current A2UI theme.
|
|
18
|
+
*
|
|
19
|
+
* @returns The current theme
|
|
20
|
+
* @throws If used outside of a ThemeProvider
|
|
21
|
+
*/
|
|
22
|
+
export declare function useTheme(): Types.Theme;
|
|
23
|
+
/**
|
|
24
|
+
* Hook to optionally access the current A2UI theme.
|
|
25
|
+
*
|
|
26
|
+
* @returns The current theme, or undefined if not within a provider
|
|
27
|
+
*/
|
|
28
|
+
export declare function useThemeOptional(): Types.Theme | undefined;
|
|
29
|
+
//# sourceMappingURL=ThemeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQ3C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAMpE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,KAAK,CAAC,KAAK,CAMtC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,KAAK,GAAG,SAAS,CAE1D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
import { defaultTheme } from './litTheme';
|
|
4
|
+
/**
|
|
5
|
+
* React context for the A2UI theme.
|
|
6
|
+
*/
|
|
7
|
+
const ThemeContext = createContext(undefined);
|
|
8
|
+
/**
|
|
9
|
+
* Provider component that makes the A2UI theme available to descendant components.
|
|
10
|
+
*/
|
|
11
|
+
export function ThemeProvider({ theme, children }) {
|
|
12
|
+
return (_jsx(ThemeContext.Provider, { value: theme ?? defaultTheme, children: children }));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to access the current A2UI theme.
|
|
16
|
+
*
|
|
17
|
+
* @returns The current theme
|
|
18
|
+
* @throws If used outside of a ThemeProvider
|
|
19
|
+
*/
|
|
20
|
+
export function useTheme() {
|
|
21
|
+
const theme = useContext(ThemeContext);
|
|
22
|
+
if (!theme) {
|
|
23
|
+
throw new Error('useTheme must be used within a ThemeProvider or A2UIProvider');
|
|
24
|
+
}
|
|
25
|
+
return theme;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook to optionally access the current A2UI theme.
|
|
29
|
+
*
|
|
30
|
+
* @returns The current theme, or undefined if not within a provider
|
|
31
|
+
*/
|
|
32
|
+
export function useThemeOptional() {
|
|
33
|
+
return useContext(ThemeContext);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ThemeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeContext.js","sourceRoot":"","sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,YAAY,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAYvE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAsB;IACnE,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,YAAY,YAChD,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Types } from '@a2ui/lit/0.8';
|
|
2
|
+
export declare const litTheme: Types.Theme;
|
|
3
|
+
/**
|
|
4
|
+
* Alias for litTheme - the default theme for A2UI React components.
|
|
5
|
+
* @see litTheme
|
|
6
|
+
*/
|
|
7
|
+
export declare const defaultTheme: Types.Theme;
|
|
8
|
+
//# sourceMappingURL=litTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"litTheme.d.ts","sourceRoot":"","sources":["../../../src/react-renderer/theme/litTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAoJ3C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,KAiS5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,aAAW,CAAC"}
|