@copilotkit/a2ui-renderer 1.53.0 → 1.53.1-next.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.
Files changed (181) hide show
  1. package/dist/A2UIViewer.d.cts +1 -1
  2. package/dist/A2UIViewer.d.mts +1 -1
  3. package/dist/a2ui-types.cjs +9 -0
  4. package/dist/a2ui-types.cjs.map +1 -0
  5. package/dist/a2ui-types.d.cts +9 -0
  6. package/dist/a2ui-types.d.cts.map +1 -0
  7. package/dist/a2ui-types.d.mts +9 -0
  8. package/dist/a2ui-types.d.mts.map +1 -0
  9. package/dist/a2ui-types.mjs +8 -0
  10. package/dist/a2ui-types.mjs.map +1 -0
  11. package/dist/index.cjs +74 -2
  12. package/dist/index.d.cts +35 -2
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +35 -2
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +33 -2
  17. package/dist/index.umd.js +96 -127
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/react-renderer/components/content/AudioPlayer.d.cts +12 -0
  20. package/dist/react-renderer/components/content/AudioPlayer.d.cts.map +1 -0
  21. package/dist/react-renderer/components/content/AudioPlayer.d.mts +12 -0
  22. package/dist/react-renderer/components/content/AudioPlayer.d.mts.map +1 -0
  23. package/dist/react-renderer/components/content/Divider.d.cts +17 -0
  24. package/dist/react-renderer/components/content/Divider.d.cts.map +1 -0
  25. package/dist/react-renderer/components/content/Divider.d.mts +17 -0
  26. package/dist/react-renderer/components/content/Divider.d.mts.map +1 -0
  27. package/dist/react-renderer/components/content/Icon.d.cts +20 -0
  28. package/dist/react-renderer/components/content/Icon.d.cts.map +1 -0
  29. package/dist/react-renderer/components/content/Icon.d.mts +20 -0
  30. package/dist/react-renderer/components/content/Icon.d.mts.map +1 -0
  31. package/dist/react-renderer/components/content/Image.d.cts +15 -0
  32. package/dist/react-renderer/components/content/Image.d.cts.map +1 -0
  33. package/dist/react-renderer/components/content/Image.d.mts +15 -0
  34. package/dist/react-renderer/components/content/Image.d.mts.map +1 -0
  35. package/dist/react-renderer/components/content/Text.d.cts +32 -0
  36. package/dist/react-renderer/components/content/Text.d.cts.map +1 -0
  37. package/dist/react-renderer/components/content/Text.d.mts +32 -0
  38. package/dist/react-renderer/components/content/Text.d.mts.map +1 -0
  39. package/dist/react-renderer/components/content/Video.d.cts +14 -0
  40. package/dist/react-renderer/components/content/Video.d.cts.map +1 -0
  41. package/dist/react-renderer/components/content/Video.d.mts +14 -0
  42. package/dist/react-renderer/components/content/Video.d.mts.map +1 -0
  43. package/dist/react-renderer/components/interactive/Button.d.cts +15 -0
  44. package/dist/react-renderer/components/interactive/Button.d.cts.map +1 -0
  45. package/dist/react-renderer/components/interactive/Button.d.mts +15 -0
  46. package/dist/react-renderer/components/interactive/Button.d.mts.map +1 -0
  47. package/dist/react-renderer/components/interactive/CheckBox.d.cts +14 -0
  48. package/dist/react-renderer/components/interactive/CheckBox.d.cts.map +1 -0
  49. package/dist/react-renderer/components/interactive/CheckBox.d.mts +14 -0
  50. package/dist/react-renderer/components/interactive/CheckBox.d.mts.map +1 -0
  51. package/dist/react-renderer/components/interactive/DateTimeInput.d.cts +14 -0
  52. package/dist/react-renderer/components/interactive/DateTimeInput.d.cts.map +1 -0
  53. package/dist/react-renderer/components/interactive/DateTimeInput.d.mts +14 -0
  54. package/dist/react-renderer/components/interactive/DateTimeInput.d.mts.map +1 -0
  55. package/dist/react-renderer/components/interactive/MultipleChoice.d.cts +15 -0
  56. package/dist/react-renderer/components/interactive/MultipleChoice.d.cts.map +1 -0
  57. package/dist/react-renderer/components/interactive/MultipleChoice.d.mts +15 -0
  58. package/dist/react-renderer/components/interactive/MultipleChoice.d.mts.map +1 -0
  59. package/dist/react-renderer/components/interactive/Slider.d.cts +14 -0
  60. package/dist/react-renderer/components/interactive/Slider.d.cts.map +1 -0
  61. package/dist/react-renderer/components/interactive/Slider.d.mts +14 -0
  62. package/dist/react-renderer/components/interactive/Slider.d.mts.map +1 -0
  63. package/dist/react-renderer/components/interactive/TextField.d.cts +14 -0
  64. package/dist/react-renderer/components/interactive/TextField.d.cts.map +1 -0
  65. package/dist/react-renderer/components/interactive/TextField.d.mts +14 -0
  66. package/dist/react-renderer/components/interactive/TextField.d.mts.map +1 -0
  67. package/dist/react-renderer/components/layout/Card.d.cts +21 -0
  68. package/dist/react-renderer/components/layout/Card.d.cts.map +1 -0
  69. package/dist/react-renderer/components/layout/Card.d.mts +21 -0
  70. package/dist/react-renderer/components/layout/Card.d.mts.map +1 -0
  71. package/dist/react-renderer/components/layout/Column.d.cts +14 -0
  72. package/dist/react-renderer/components/layout/Column.d.cts.map +1 -0
  73. package/dist/react-renderer/components/layout/Column.d.mts +14 -0
  74. package/dist/react-renderer/components/layout/Column.d.mts.map +1 -0
  75. package/dist/react-renderer/components/layout/List.d.cts +14 -0
  76. package/dist/react-renderer/components/layout/List.d.cts.map +1 -0
  77. package/dist/react-renderer/components/layout/List.d.mts +14 -0
  78. package/dist/react-renderer/components/layout/List.d.mts.map +1 -0
  79. package/dist/react-renderer/components/layout/Modal.d.cts +19 -0
  80. package/dist/react-renderer/components/layout/Modal.d.cts.map +1 -0
  81. package/dist/react-renderer/components/layout/Modal.d.mts +19 -0
  82. package/dist/react-renderer/components/layout/Modal.d.mts.map +1 -0
  83. package/dist/react-renderer/components/layout/Row.d.cts +14 -0
  84. package/dist/react-renderer/components/layout/Row.d.cts.map +1 -0
  85. package/dist/react-renderer/components/layout/Row.d.mts +14 -0
  86. package/dist/react-renderer/components/layout/Row.d.mts.map +1 -0
  87. package/dist/react-renderer/components/layout/Tabs.d.cts +12 -0
  88. package/dist/react-renderer/components/layout/Tabs.d.cts.map +1 -0
  89. package/dist/react-renderer/components/layout/Tabs.d.mts +12 -0
  90. package/dist/react-renderer/components/layout/Tabs.d.mts.map +1 -0
  91. package/dist/react-renderer/core/A2UIProvider.cjs +35 -0
  92. package/dist/react-renderer/core/A2UIProvider.cjs.map +1 -1
  93. package/dist/react-renderer/core/A2UIProvider.d.cts +91 -0
  94. package/dist/react-renderer/core/A2UIProvider.d.cts.map +1 -0
  95. package/dist/react-renderer/core/A2UIProvider.d.mts +91 -0
  96. package/dist/react-renderer/core/A2UIProvider.d.mts.map +1 -0
  97. package/dist/react-renderer/core/A2UIProvider.mjs +33 -1
  98. package/dist/react-renderer/core/A2UIProvider.mjs.map +1 -1
  99. package/dist/react-renderer/core/A2UIRenderer.d.cts +40 -0
  100. package/dist/react-renderer/core/A2UIRenderer.d.cts.map +1 -0
  101. package/dist/react-renderer/core/A2UIRenderer.d.mts +40 -0
  102. package/dist/react-renderer/core/A2UIRenderer.d.mts.map +1 -0
  103. package/dist/react-renderer/core/A2UIViewer.cjs +11 -0
  104. package/dist/react-renderer/core/A2UIViewer.d.cts +16 -0
  105. package/dist/react-renderer/core/A2UIViewer.d.cts.map +1 -0
  106. package/dist/react-renderer/core/A2UIViewer.d.mts +16 -0
  107. package/dist/react-renderer/core/A2UIViewer.d.mts.map +1 -0
  108. package/dist/react-renderer/core/A2UIViewer.mjs +11 -0
  109. package/dist/react-renderer/core/ComponentNode.d.cts +29 -0
  110. package/dist/react-renderer/core/ComponentNode.d.cts.map +1 -0
  111. package/dist/react-renderer/core/ComponentNode.d.mts +29 -0
  112. package/dist/react-renderer/core/ComponentNode.d.mts.map +1 -0
  113. package/dist/react-renderer/core/store.d.cts +41 -0
  114. package/dist/react-renderer/core/store.d.cts.map +1 -0
  115. package/dist/react-renderer/core/store.d.mts +41 -0
  116. package/dist/react-renderer/core/store.d.mts.map +1 -0
  117. package/dist/react-renderer/hooks/useA2UI.d.cts +50 -0
  118. package/dist/react-renderer/hooks/useA2UI.d.cts.map +1 -0
  119. package/dist/react-renderer/hooks/useA2UI.d.mts +50 -0
  120. package/dist/react-renderer/hooks/useA2UI.d.mts.map +1 -0
  121. package/dist/react-renderer/hooks/useA2UIComponent.d.cts +56 -0
  122. package/dist/react-renderer/hooks/useA2UIComponent.d.cts.map +1 -0
  123. package/dist/react-renderer/hooks/useA2UIComponent.d.mts +56 -0
  124. package/dist/react-renderer/hooks/useA2UIComponent.d.mts.map +1 -0
  125. package/dist/react-renderer/index.cjs +31 -0
  126. package/dist/react-renderer/index.d.cts +32 -0
  127. package/dist/react-renderer/index.d.mts +32 -0
  128. package/dist/react-renderer/index.mjs +33 -0
  129. package/dist/react-renderer/lib/utils.d.cts +18 -0
  130. package/dist/react-renderer/lib/utils.d.cts.map +1 -0
  131. package/dist/react-renderer/lib/utils.d.mts +18 -0
  132. package/dist/react-renderer/lib/utils.d.mts.map +1 -0
  133. package/dist/react-renderer/registry/ComponentRegistry.d.cts +82 -0
  134. package/dist/react-renderer/registry/ComponentRegistry.d.cts.map +1 -0
  135. package/dist/react-renderer/registry/ComponentRegistry.d.mts +82 -0
  136. package/dist/react-renderer/registry/ComponentRegistry.d.mts.map +1 -0
  137. package/dist/react-renderer/registry/defaultCatalog.cjs +1 -0
  138. package/dist/react-renderer/registry/defaultCatalog.d.cts +17 -0
  139. package/dist/react-renderer/registry/defaultCatalog.d.cts.map +1 -0
  140. package/dist/react-renderer/registry/defaultCatalog.d.mts +17 -0
  141. package/dist/react-renderer/registry/defaultCatalog.d.mts.map +1 -0
  142. package/dist/react-renderer/registry/defaultCatalog.mjs +1 -1
  143. package/dist/react-renderer/styles/index.cjs +10 -0
  144. package/dist/react-renderer/styles/index.cjs.map +1 -1
  145. package/dist/react-renderer/styles/index.d.cts +14 -0
  146. package/dist/react-renderer/styles/index.d.cts.map +1 -0
  147. package/dist/react-renderer/styles/index.d.mts +26 -0
  148. package/dist/react-renderer/styles/index.d.mts.map +1 -0
  149. package/dist/react-renderer/styles/index.mjs +10 -1
  150. package/dist/react-renderer/styles/index.mjs.map +1 -1
  151. package/dist/react-renderer/theme/ThemeContext.cjs +9 -0
  152. package/dist/react-renderer/theme/ThemeContext.cjs.map +1 -1
  153. package/dist/react-renderer/theme/ThemeContext.d.cts +37 -0
  154. package/dist/react-renderer/theme/ThemeContext.d.cts.map +1 -0
  155. package/dist/react-renderer/theme/ThemeContext.d.mts +37 -0
  156. package/dist/react-renderer/theme/ThemeContext.d.mts.map +1 -0
  157. package/dist/react-renderer/theme/ThemeContext.mjs +9 -1
  158. package/dist/react-renderer/theme/ThemeContext.mjs.map +1 -1
  159. package/dist/react-renderer/theme/litTheme.cjs +1 -0
  160. package/dist/react-renderer/theme/litTheme.d.cts +12 -0
  161. package/dist/react-renderer/theme/litTheme.d.cts.map +1 -0
  162. package/dist/react-renderer/theme/litTheme.d.mts +12 -0
  163. package/dist/react-renderer/theme/litTheme.d.mts.map +1 -0
  164. package/dist/react-renderer/theme/litTheme.mjs +1 -1
  165. package/dist/react-renderer/theme/utils.d.cts +26 -0
  166. package/dist/react-renderer/theme/utils.d.cts.map +1 -0
  167. package/dist/react-renderer/theme/utils.d.mts +26 -0
  168. package/dist/react-renderer/theme/utils.d.mts.map +1 -0
  169. package/dist/react-renderer/types.d.cts +50 -0
  170. package/dist/react-renderer/types.d.cts.map +1 -0
  171. package/dist/react-renderer/types.d.mts +50 -0
  172. package/dist/react-renderer/types.d.mts.map +1 -0
  173. package/package.json +2 -3
  174. package/dist/A2UIMessageRenderer.cjs +0 -135
  175. package/dist/A2UIMessageRenderer.cjs.map +0 -1
  176. package/dist/A2UIMessageRenderer.d.cts +0 -11
  177. package/dist/A2UIMessageRenderer.d.cts.map +0 -1
  178. package/dist/A2UIMessageRenderer.d.mts +0 -11
  179. package/dist/A2UIMessageRenderer.d.mts.map +0 -1
  180. package/dist/A2UIMessageRenderer.mjs +0 -134
  181. package/dist/A2UIMessageRenderer.mjs.map +0 -1
@@ -0,0 +1,82 @@
1
+ import { A2UIComponentProps, ComponentRegistration } from "../types.cjs";
2
+ import { ComponentType } from "react";
3
+ import { Types } from "@a2ui/lit/0.8";
4
+
5
+ //#region src/react-renderer/registry/ComponentRegistry.d.ts
6
+ /**
7
+ * Registry for A2UI components. Allows registration of custom components
8
+ * and supports lazy loading for code splitting.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const registry = new ComponentRegistry();
13
+ *
14
+ * // Register a component directly
15
+ * registry.register('Text', { component: Text });
16
+ *
17
+ * // Register with lazy loading
18
+ * registry.register('Modal', {
19
+ * component: () => import('./components/Modal'),
20
+ * lazy: true
21
+ * });
22
+ *
23
+ * // Use with A2UIRenderer
24
+ * <A2UIRenderer surfaceId="main" registry={registry} />
25
+ * ```
26
+ */
27
+ declare class ComponentRegistry {
28
+ private static _instance;
29
+ private registry;
30
+ private lazyCache;
31
+ /**
32
+ * Get the singleton instance of the registry.
33
+ * Use this for the default global registry.
34
+ */
35
+ static getInstance(): ComponentRegistry;
36
+ /**
37
+ * Reset the singleton instance.
38
+ * Useful for testing.
39
+ */
40
+ static resetInstance(): void;
41
+ /**
42
+ * Register a component type.
43
+ *
44
+ * @param type - The A2UI component type name (e.g., 'Text', 'Button')
45
+ * @param registration - The component registration
46
+ */
47
+ register<T extends Types.AnyComponentNode>(type: string, registration: ComponentRegistration<T>): void;
48
+ /**
49
+ * Unregister a component type.
50
+ *
51
+ * @param type - The component type to unregister
52
+ */
53
+ unregister(type: string): void;
54
+ /**
55
+ * Check if a component type is registered.
56
+ *
57
+ * @param type - The component type to check
58
+ * @returns True if the component is registered
59
+ */
60
+ has(type: string): boolean;
61
+ /**
62
+ * Get a component by type. If the component is registered with lazy loading,
63
+ * returns a React.lazy wrapped component.
64
+ *
65
+ * @param type - The component type to get
66
+ * @returns The React component, or null if not found
67
+ */
68
+ get(type: string): ComponentType<A2UIComponentProps> | null;
69
+ /**
70
+ * Get all registered component types.
71
+ *
72
+ * @returns Array of registered type names
73
+ */
74
+ getRegisteredTypes(): string[];
75
+ /**
76
+ * Clear all registrations.
77
+ */
78
+ clear(): void;
79
+ }
80
+ //#endregion
81
+ export { ComponentRegistry };
82
+ //# sourceMappingURL=ComponentRegistry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentRegistry.d.cts","names":[],"sources":["../../../src/react-renderer/registry/ComponentRegistry.ts"],"mappings":";;;;;;;AA6BA;;;;;;;;;;;;;;;;;;;cAAa,iBAAA;EAAA,eACI,SAAA;EAAA,QACP,QAAA;EAAA,QACA,SAAA;EA6B8B;;;;EAAA,OAvB/B,WAAA,CAAA,GAAe,iBAAA;EA4ClB;;;;EAAA,OAjCG,aAAA,CAAA;EAoEP;;;;;;EA1DA,QAAA,WAAmB,KAAA,CAAM,gBAAA,CAAA,CACvB,IAAA,UACA,YAAA,EAAc,qBAAA,CAAsB,CAAA;;;;;;EAUtC,UAAA,CAAW,IAAA;;;;;;;EAWX,GAAA,CAAI,IAAA;;;;;;;;EAWJ,GAAA,CAAI,IAAA,WAAe,aAAA,CAAc,kBAAA;;;;;;EAwBjC,kBAAA,CAAA;;;;EAOA,KAAA,CAAA;AAAA"}
@@ -0,0 +1,82 @@
1
+ import { A2UIComponentProps, ComponentRegistration } from "../types.mjs";
2
+ import { ComponentType } from "react";
3
+ import { Types } from "@a2ui/lit/0.8";
4
+
5
+ //#region src/react-renderer/registry/ComponentRegistry.d.ts
6
+ /**
7
+ * Registry for A2UI components. Allows registration of custom components
8
+ * and supports lazy loading for code splitting.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const registry = new ComponentRegistry();
13
+ *
14
+ * // Register a component directly
15
+ * registry.register('Text', { component: Text });
16
+ *
17
+ * // Register with lazy loading
18
+ * registry.register('Modal', {
19
+ * component: () => import('./components/Modal'),
20
+ * lazy: true
21
+ * });
22
+ *
23
+ * // Use with A2UIRenderer
24
+ * <A2UIRenderer surfaceId="main" registry={registry} />
25
+ * ```
26
+ */
27
+ declare class ComponentRegistry {
28
+ private static _instance;
29
+ private registry;
30
+ private lazyCache;
31
+ /**
32
+ * Get the singleton instance of the registry.
33
+ * Use this for the default global registry.
34
+ */
35
+ static getInstance(): ComponentRegistry;
36
+ /**
37
+ * Reset the singleton instance.
38
+ * Useful for testing.
39
+ */
40
+ static resetInstance(): void;
41
+ /**
42
+ * Register a component type.
43
+ *
44
+ * @param type - The A2UI component type name (e.g., 'Text', 'Button')
45
+ * @param registration - The component registration
46
+ */
47
+ register<T extends Types.AnyComponentNode>(type: string, registration: ComponentRegistration<T>): void;
48
+ /**
49
+ * Unregister a component type.
50
+ *
51
+ * @param type - The component type to unregister
52
+ */
53
+ unregister(type: string): void;
54
+ /**
55
+ * Check if a component type is registered.
56
+ *
57
+ * @param type - The component type to check
58
+ * @returns True if the component is registered
59
+ */
60
+ has(type: string): boolean;
61
+ /**
62
+ * Get a component by type. If the component is registered with lazy loading,
63
+ * returns a React.lazy wrapped component.
64
+ *
65
+ * @param type - The component type to get
66
+ * @returns The React component, or null if not found
67
+ */
68
+ get(type: string): ComponentType<A2UIComponentProps> | null;
69
+ /**
70
+ * Get all registered component types.
71
+ *
72
+ * @returns Array of registered type names
73
+ */
74
+ getRegisteredTypes(): string[];
75
+ /**
76
+ * Clear all registrations.
77
+ */
78
+ clear(): void;
79
+ }
80
+ //#endregion
81
+ export { ComponentRegistry };
82
+ //# sourceMappingURL=ComponentRegistry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentRegistry.d.mts","names":[],"sources":["../../../src/react-renderer/registry/ComponentRegistry.ts"],"mappings":";;;;;;;AA6BA;;;;;;;;;;;;;;;;;;;cAAa,iBAAA;EAAA,eACI,SAAA;EAAA,QACP,QAAA;EAAA,QACA,SAAA;EA6B8B;;;;EAAA,OAvB/B,WAAA,CAAA,GAAe,iBAAA;EA4ClB;;;;EAAA,OAjCG,aAAA,CAAA;EAoEP;;;;;;EA1DA,QAAA,WAAmB,KAAA,CAAM,gBAAA,CAAA,CACvB,IAAA,UACA,YAAA,EAAc,qBAAA,CAAsB,CAAA;;;;;;EAUtC,UAAA,CAAW,IAAA;;;;;;;EAWX,GAAA,CAAI,IAAA;;;;;;;;EAWJ,GAAA,CAAI,IAAA,WAAe,aAAA,CAAc,kBAAA;;;;;;EAwBjC,kBAAA,CAAA;;;;EAOA,KAAA,CAAA;AAAA"}
@@ -54,4 +54,5 @@ function initializeDefaultCatalog() {
54
54
 
55
55
  //#endregion
56
56
  exports.initializeDefaultCatalog = initializeDefaultCatalog;
57
+ exports.registerDefaultCatalog = registerDefaultCatalog;
57
58
  //# sourceMappingURL=defaultCatalog.cjs.map
@@ -0,0 +1,17 @@
1
+ import { ComponentRegistry } from "./ComponentRegistry.cjs";
2
+
3
+ //#region src/react-renderer/registry/defaultCatalog.d.ts
4
+ /**
5
+ * Registers all standard A2UI components in the registry.
6
+ *
7
+ * @param registry - The component registry to populate
8
+ */
9
+ declare function registerDefaultCatalog(registry: ComponentRegistry): void;
10
+ /**
11
+ * Initialize the default catalog in the singleton registry.
12
+ * Call this once at app startup.
13
+ */
14
+ declare function initializeDefaultCatalog(): void;
15
+ //#endregion
16
+ export { initializeDefaultCatalog, registerDefaultCatalog };
17
+ //# sourceMappingURL=defaultCatalog.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultCatalog.d.cts","names":[],"sources":["../../../src/react-renderer/registry/defaultCatalog.ts"],"mappings":";;;;;AA+BA;;;iBAAgB,sBAAA,CAAuB,QAAA,EAAU,iBAAA;;AAgCjD;;;iBAAgB,wBAAA,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { ComponentRegistry } from "./ComponentRegistry.mjs";
2
+
3
+ //#region src/react-renderer/registry/defaultCatalog.d.ts
4
+ /**
5
+ * Registers all standard A2UI components in the registry.
6
+ *
7
+ * @param registry - The component registry to populate
8
+ */
9
+ declare function registerDefaultCatalog(registry: ComponentRegistry): void;
10
+ /**
11
+ * Initialize the default catalog in the singleton registry.
12
+ * Call this once at app startup.
13
+ */
14
+ declare function initializeDefaultCatalog(): void;
15
+ //#endregion
16
+ export { initializeDefaultCatalog, registerDefaultCatalog };
17
+ //# sourceMappingURL=defaultCatalog.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultCatalog.d.mts","names":[],"sources":["../../../src/react-renderer/registry/defaultCatalog.ts"],"mappings":";;;;;AA+BA;;;iBAAgB,sBAAA,CAAuB,QAAA,EAAU,iBAAA;;AAgCjD;;;iBAAgB,wBAAA,CAAA"}
@@ -53,5 +53,5 @@ function initializeDefaultCatalog() {
53
53
  }
54
54
 
55
55
  //#endregion
56
- export { initializeDefaultCatalog };
56
+ export { initializeDefaultCatalog, registerDefaultCatalog };
57
57
  //# sourceMappingURL=defaultCatalog.mjs.map
@@ -452,7 +452,17 @@ function injectStyles() {
452
452
  styleElement.textContent = require_reset.resetStyles + "\n" + structuralStyles + "\n" + componentSpecificStyles;
453
453
  document.head.appendChild(styleElement);
454
454
  }
455
+ /**
456
+ * Removes injected A2UI styles from the document.
457
+ * Useful for cleanup in tests or when unmounting.
458
+ */
459
+ function removeStyles() {
460
+ if (typeof document === "undefined") return;
461
+ const styleElement = document.getElementById("a2ui-structural-styles");
462
+ if (styleElement) styleElement.remove();
463
+ }
455
464
 
456
465
  //#endregion
457
466
  exports.injectStyles = injectStyles;
467
+ exports.removeStyles = removeStyles;
458
468
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Styles","resetStyles"],"sources":["../../../src/react-renderer/styles/index.ts"],"sourcesContent":["import { Styles } from \"@a2ui/lit/0.8\";\nimport { resetStyles } from \"./reset\";\n\n/**\n * Structural CSS styles from the Lit renderer, converted for global DOM use.\n * These styles define all the utility classes (layout-*, typography-*, color-*, etc.)\n * Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.\n */\nexport const structuralStyles: string = Styles.structuralStyles.replace(\n /:host\\s*\\{/g,\n \".a2ui-surface {\",\n);\n\n/**\n * Component-specific styles that replicate Lit's Shadow DOM scoped CSS.\n *\n * Each Lit component has `static styles` with :host, element selectors, and ::slotted().\n * Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.\n *\n * Transformation rules:\n * :host → .a2ui-surface .a2ui-{component}\n * section → .a2ui-surface .a2ui-{component} section\n * ::slotted(*) → .a2ui-surface .a2ui-{component} section > *\n */\nexport const componentSpecificStyles: string = `\n/* =========================================================================\n * Card (from Lit card.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-card {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */\n/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */\n.a2ui-surface .a2ui-card > section {\n height: 100%;\n width: 100%;\n min-height: 0;\n overflow: auto;\n}\n\n/* section ::slotted(*) { height: 100%; width: 100%; } */\n/* Use > section > to only target Card's slotted children, not deeply nested elements */\n.a2ui-surface .a2ui-card > section > * {\n height: 100%;\n width: 100%;\n}\n\n/* =========================================================================\n * Divider (from Lit divider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-divider {\n display: block;\n min-height: 0;\n overflow: auto;\n}\n\n/* hr { height: 1px; background: #ccc; border: none; } */\n/* Use :where() for low specificity (0,0,1) so theme utility classes can override */\n/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */\n:where(.a2ui-surface .a2ui-divider) hr {\n height: 1px;\n background: #ccc;\n border: none;\n}\n\n/* =========================================================================\n * Text (from Lit text.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-text {\n display: block;\n flex: var(--weight);\n}\n\n/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */\n:where(.a2ui-surface .a2ui-text) h1,\n:where(.a2ui-surface .a2ui-text) h2,\n:where(.a2ui-surface .a2ui-text) h3,\n:where(.a2ui-surface .a2ui-text) h4,\n:where(.a2ui-surface .a2ui-text) h5 {\n line-height: inherit;\n font: inherit;\n}\n\n/* Ensure markdown paragraph margins are reset */\n.a2ui-surface .a2ui-text p {\n margin: 0;\n}\n\n/* =========================================================================\n * TextField (from Lit text-field.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-textfield {\n display: flex;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-textfield) input {\n display: block;\n width: 100%;\n}\n\n/* label { display: block; margin-bottom: 4px; } */\n:where(.a2ui-surface .a2ui-textfield) label {\n display: block;\n margin-bottom: 4px;\n}\n\n/* textarea - same styling as input for multiline text fields */\n:where(.a2ui-surface .a2ui-textfield) textarea {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * CheckBox (from Lit checkbox.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-checkbox {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-checkbox) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Slider (from Lit slider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-slider {\n display: block;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-slider) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Button (from Lit button.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; } */\n.a2ui-surface .a2ui-button {\n display: block;\n flex: var(--weight);\n min-height: 0;\n}\n\n/* =========================================================================\n * Icon (from Lit icon.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-icon {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* =========================================================================\n * Tabs (from Lit tabs.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-tabs {\n display: block;\n flex: var(--weight);\n}\n\n/* =========================================================================\n * Modal (from Lit modal.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-modal {\n display: block;\n flex: var(--weight);\n}\n\n/* dialog { padding: 0; border: none; background: none; } */\n:where(.a2ui-surface .a2ui-modal) dialog {\n padding: 0;\n border: none;\n background: none;\n}\n\n/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */\n.a2ui-surface .a2ui-modal dialog section #controls {\n display: flex;\n justify-content: end;\n margin-bottom: 4px;\n}\n\n/* dialog section #controls button { padding: 0; background: none; ... } */\n.a2ui-surface .a2ui-modal dialog section #controls button {\n padding: 0;\n background: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n border: none;\n}\n\n/* =========================================================================\n * Image (from Lit image.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-image {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */\n:where(.a2ui-surface .a2ui-image) img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--object-fit, fill);\n}\n\n/* =========================================================================\n * Video (from Lit video.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-video {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* video { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-video) video {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * AudioPlayer (from Lit audio.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-audio {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* audio { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-audio) audio {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * MultipleChoice (from Lit multiple-choice.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-multiplechoice {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* select { width: 100%; } */\n:where(.a2ui-surface .a2ui-multiplechoice) select {\n width: 100%;\n}\n\n/* =========================================================================\n * Column (from Lit column.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-column {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */\n.a2ui-surface .a2ui-column > section {\n display: flex;\n flex-direction: column;\n min-width: 100%;\n height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */\n.a2ui-surface .a2ui-column[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-column[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-column[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-column[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-column[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-column[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-column[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * Row (from Lit row.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-row {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */\n.a2ui-surface .a2ui-row > section {\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Row's direct section, not nested sections */\n.a2ui-surface .a2ui-row[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-row[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-row[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-row[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-row[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-row[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-row[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * List (from Lit list.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-list {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* :host([direction=\"vertical\"]) section { display: grid; } */\n.a2ui-surface .a2ui-list[data-direction=\"vertical\"] > section {\n display: grid;\n}\n\n/* :host([direction=\"horizontal\"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section {\n display: flex;\n max-width: 100%;\n overflow-x: scroll;\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* :host([direction=\"horizontal\"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section > * {\n flex: 1 0 fit-content;\n max-width: min(80%, 400px);\n}\n\n/* =========================================================================\n * DateTimeInput (from Lit datetime-input.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-datetime-input {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */\n:where(.a2ui-surface .a2ui-datetime-input) input {\n display: block;\n border-radius: 8px;\n padding: 8px;\n border: 1px solid #ccc;\n width: 100%;\n}\n\n/* =========================================================================\n * Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)\n * ========================================================================= */\n\n.a2ui-surface *,\n.a2ui-surface *::before,\n.a2ui-surface *::after {\n box-sizing: border-box;\n}\n`;\n\n/**\n * Injects A2UI structural styles into the document head.\n * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.\n * Call this once at application startup.\n *\n * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,\n * just like in the Lit renderer. This allows full customization of the color palette.\n *\n * @example\n * ```tsx\n * import { injectStyles } from '@a2ui/react/styles';\n *\n * // In your app entry point:\n * injectStyles();\n * ```\n */\nexport function injectStyles(): void {\n if (typeof document === \"undefined\") {\n return; // SSR safety\n }\n\n const styleId = \"a2ui-structural-styles\";\n\n // Avoid duplicate injection\n if (document.getElementById(styleId)) {\n return;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.id = styleId;\n // Include structural (utility classes) and component-specific styles\n // Note: CSS variables (palette) must be defined by the host application on :root,\n // just like in the Lit renderer. This allows full customization.\n styleElement.textContent =\n resetStyles + \"\\n\" + structuralStyles + \"\\n\" + componentSpecificStyles;\n document.head.appendChild(styleElement);\n}\n\n/**\n * Removes injected A2UI styles from the document.\n * Useful for cleanup in tests or when unmounting.\n */\nexport function removeStyles(): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const styleElement = document.getElementById(\"a2ui-structural-styles\");\n if (styleElement) {\n styleElement.remove();\n }\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAa,mBAA2BA,qBAAO,iBAAiB,QAC9D,eACA,kBACD;;;;;;;;;;;;AAaD,MAAa,0BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwa/C,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,UAAU;AAGhB,KAAI,SAAS,eAAe,QAAQ,CAClC;CAGF,MAAM,eAAe,SAAS,cAAc,QAAQ;AACpD,cAAa,KAAK;AAIlB,cAAa,cACXC,4BAAc,OAAO,mBAAmB,OAAO;AACjD,UAAS,KAAK,YAAY,aAAa"}
1
+ {"version":3,"file":"index.cjs","names":["Styles","resetStyles"],"sources":["../../../src/react-renderer/styles/index.ts"],"sourcesContent":["import { Styles } from \"@a2ui/lit/0.8\";\nimport { resetStyles } from \"./reset\";\n\n/**\n * Structural CSS styles from the Lit renderer, converted for global DOM use.\n * These styles define all the utility classes (layout-*, typography-*, color-*, etc.)\n * Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.\n */\nexport const structuralStyles: string = Styles.structuralStyles.replace(\n /:host\\s*\\{/g,\n \".a2ui-surface {\",\n);\n\n/**\n * Component-specific styles that replicate Lit's Shadow DOM scoped CSS.\n *\n * Each Lit component has `static styles` with :host, element selectors, and ::slotted().\n * Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.\n *\n * Transformation rules:\n * :host → .a2ui-surface .a2ui-{component}\n * section → .a2ui-surface .a2ui-{component} section\n * ::slotted(*) → .a2ui-surface .a2ui-{component} section > *\n */\nexport const componentSpecificStyles: string = `\n/* =========================================================================\n * Card (from Lit card.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-card {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */\n/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */\n.a2ui-surface .a2ui-card > section {\n height: 100%;\n width: 100%;\n min-height: 0;\n overflow: auto;\n}\n\n/* section ::slotted(*) { height: 100%; width: 100%; } */\n/* Use > section > to only target Card's slotted children, not deeply nested elements */\n.a2ui-surface .a2ui-card > section > * {\n height: 100%;\n width: 100%;\n}\n\n/* =========================================================================\n * Divider (from Lit divider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-divider {\n display: block;\n min-height: 0;\n overflow: auto;\n}\n\n/* hr { height: 1px; background: #ccc; border: none; } */\n/* Use :where() for low specificity (0,0,1) so theme utility classes can override */\n/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */\n:where(.a2ui-surface .a2ui-divider) hr {\n height: 1px;\n background: #ccc;\n border: none;\n}\n\n/* =========================================================================\n * Text (from Lit text.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-text {\n display: block;\n flex: var(--weight);\n}\n\n/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */\n:where(.a2ui-surface .a2ui-text) h1,\n:where(.a2ui-surface .a2ui-text) h2,\n:where(.a2ui-surface .a2ui-text) h3,\n:where(.a2ui-surface .a2ui-text) h4,\n:where(.a2ui-surface .a2ui-text) h5 {\n line-height: inherit;\n font: inherit;\n}\n\n/* Ensure markdown paragraph margins are reset */\n.a2ui-surface .a2ui-text p {\n margin: 0;\n}\n\n/* =========================================================================\n * TextField (from Lit text-field.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-textfield {\n display: flex;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-textfield) input {\n display: block;\n width: 100%;\n}\n\n/* label { display: block; margin-bottom: 4px; } */\n:where(.a2ui-surface .a2ui-textfield) label {\n display: block;\n margin-bottom: 4px;\n}\n\n/* textarea - same styling as input for multiline text fields */\n:where(.a2ui-surface .a2ui-textfield) textarea {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * CheckBox (from Lit checkbox.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-checkbox {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-checkbox) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Slider (from Lit slider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-slider {\n display: block;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-slider) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Button (from Lit button.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; } */\n.a2ui-surface .a2ui-button {\n display: block;\n flex: var(--weight);\n min-height: 0;\n}\n\n/* =========================================================================\n * Icon (from Lit icon.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-icon {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* =========================================================================\n * Tabs (from Lit tabs.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-tabs {\n display: block;\n flex: var(--weight);\n}\n\n/* =========================================================================\n * Modal (from Lit modal.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-modal {\n display: block;\n flex: var(--weight);\n}\n\n/* dialog { padding: 0; border: none; background: none; } */\n:where(.a2ui-surface .a2ui-modal) dialog {\n padding: 0;\n border: none;\n background: none;\n}\n\n/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */\n.a2ui-surface .a2ui-modal dialog section #controls {\n display: flex;\n justify-content: end;\n margin-bottom: 4px;\n}\n\n/* dialog section #controls button { padding: 0; background: none; ... } */\n.a2ui-surface .a2ui-modal dialog section #controls button {\n padding: 0;\n background: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n border: none;\n}\n\n/* =========================================================================\n * Image (from Lit image.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-image {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */\n:where(.a2ui-surface .a2ui-image) img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--object-fit, fill);\n}\n\n/* =========================================================================\n * Video (from Lit video.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-video {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* video { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-video) video {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * AudioPlayer (from Lit audio.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-audio {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* audio { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-audio) audio {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * MultipleChoice (from Lit multiple-choice.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-multiplechoice {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* select { width: 100%; } */\n:where(.a2ui-surface .a2ui-multiplechoice) select {\n width: 100%;\n}\n\n/* =========================================================================\n * Column (from Lit column.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-column {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */\n.a2ui-surface .a2ui-column > section {\n display: flex;\n flex-direction: column;\n min-width: 100%;\n height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */\n.a2ui-surface .a2ui-column[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-column[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-column[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-column[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-column[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-column[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-column[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * Row (from Lit row.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-row {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */\n.a2ui-surface .a2ui-row > section {\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Row's direct section, not nested sections */\n.a2ui-surface .a2ui-row[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-row[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-row[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-row[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-row[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-row[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-row[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * List (from Lit list.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-list {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* :host([direction=\"vertical\"]) section { display: grid; } */\n.a2ui-surface .a2ui-list[data-direction=\"vertical\"] > section {\n display: grid;\n}\n\n/* :host([direction=\"horizontal\"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section {\n display: flex;\n max-width: 100%;\n overflow-x: scroll;\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* :host([direction=\"horizontal\"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section > * {\n flex: 1 0 fit-content;\n max-width: min(80%, 400px);\n}\n\n/* =========================================================================\n * DateTimeInput (from Lit datetime-input.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-datetime-input {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */\n:where(.a2ui-surface .a2ui-datetime-input) input {\n display: block;\n border-radius: 8px;\n padding: 8px;\n border: 1px solid #ccc;\n width: 100%;\n}\n\n/* =========================================================================\n * Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)\n * ========================================================================= */\n\n.a2ui-surface *,\n.a2ui-surface *::before,\n.a2ui-surface *::after {\n box-sizing: border-box;\n}\n`;\n\n/**\n * Injects A2UI structural styles into the document head.\n * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.\n * Call this once at application startup.\n *\n * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,\n * just like in the Lit renderer. This allows full customization of the color palette.\n *\n * @example\n * ```tsx\n * import { injectStyles } from '@a2ui/react/styles';\n *\n * // In your app entry point:\n * injectStyles();\n * ```\n */\nexport function injectStyles(): void {\n if (typeof document === \"undefined\") {\n return; // SSR safety\n }\n\n const styleId = \"a2ui-structural-styles\";\n\n // Avoid duplicate injection\n if (document.getElementById(styleId)) {\n return;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.id = styleId;\n // Include structural (utility classes) and component-specific styles\n // Note: CSS variables (palette) must be defined by the host application on :root,\n // just like in the Lit renderer. This allows full customization.\n styleElement.textContent =\n resetStyles + \"\\n\" + structuralStyles + \"\\n\" + componentSpecificStyles;\n document.head.appendChild(styleElement);\n}\n\n/**\n * Removes injected A2UI styles from the document.\n * Useful for cleanup in tests or when unmounting.\n */\nexport function removeStyles(): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const styleElement = document.getElementById(\"a2ui-structural-styles\");\n if (styleElement) {\n styleElement.remove();\n }\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAa,mBAA2BA,qBAAO,iBAAiB,QAC9D,eACA,kBACD;;;;;;;;;;;;AAaD,MAAa,0BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwa/C,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,UAAU;AAGhB,KAAI,SAAS,eAAe,QAAQ,CAClC;CAGF,MAAM,eAAe,SAAS,cAAc,QAAQ;AACpD,cAAa,KAAK;AAIlB,cAAa,cACXC,4BAAc,OAAO,mBAAmB,OAAO;AACjD,UAAS,KAAK,YAAY,aAAa;;;;;;AAOzC,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,eAAe,SAAS,eAAe,yBAAyB;AACtE,KAAI,aACF,cAAa,QAAQ"}
@@ -0,0 +1,14 @@
1
+ //#region src/react-renderer/styles/index.d.ts
2
+ /**
3
+ * Injects A2UI structural styles into the document head.
4
+ * Includes utility classes and React-specific overrides.
5
+ * CSS variables (palette) must be defined by the host on :root.
6
+ */
7
+ declare function injectStyles(): void;
8
+ /**
9
+ * Removes the injected A2UI structural styles from the document.
10
+ */
11
+ declare function removeStyles(): void;
12
+ //#endregion
13
+ export { injectStyles, removeStyles };
14
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":["structuralStyles","componentSpecificStyles","injectStyles","removeStyles"],"sources":["../../../src/react-renderer/styles/index.d.ts"],"mappings":";;;;;;iBAiBwBE,YAAAA,CAAAA;;;;iBAKAC,YAAAA,CAAAA"}
@@ -0,0 +1,26 @@
1
+ //#region src/react-renderer/styles/index.d.ts
2
+ /**
3
+ * Injects A2UI structural styles into the document head.
4
+ * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.
5
+ * Call this once at application startup.
6
+ *
7
+ * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,
8
+ * just like in the Lit renderer. This allows full customization of the color palette.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { injectStyles } from '@a2ui/react/styles';
13
+ *
14
+ * // In your app entry point:
15
+ * injectStyles();
16
+ * ```
17
+ */
18
+ declare function injectStyles(): void;
19
+ /**
20
+ * Removes injected A2UI styles from the document.
21
+ * Useful for cleanup in tests or when unmounting.
22
+ */
23
+ declare function removeStyles(): void;
24
+ //#endregion
25
+ export { injectStyles, removeStyles };
26
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/react-renderer/styles/index.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAgcgB,YAAA,CAAA;;;;;iBA0BA,YAAA,CAAA"}
@@ -451,7 +451,16 @@ function injectStyles() {
451
451
  styleElement.textContent = resetStyles + "\n" + structuralStyles + "\n" + componentSpecificStyles;
452
452
  document.head.appendChild(styleElement);
453
453
  }
454
+ /**
455
+ * Removes injected A2UI styles from the document.
456
+ * Useful for cleanup in tests or when unmounting.
457
+ */
458
+ function removeStyles() {
459
+ if (typeof document === "undefined") return;
460
+ const styleElement = document.getElementById("a2ui-structural-styles");
461
+ if (styleElement) styleElement.remove();
462
+ }
454
463
 
455
464
  //#endregion
456
- export { injectStyles };
465
+ export { injectStyles, removeStyles };
457
466
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/react-renderer/styles/index.ts"],"sourcesContent":["import { Styles } from \"@a2ui/lit/0.8\";\nimport { resetStyles } from \"./reset\";\n\n/**\n * Structural CSS styles from the Lit renderer, converted for global DOM use.\n * These styles define all the utility classes (layout-*, typography-*, color-*, etc.)\n * Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.\n */\nexport const structuralStyles: string = Styles.structuralStyles.replace(\n /:host\\s*\\{/g,\n \".a2ui-surface {\",\n);\n\n/**\n * Component-specific styles that replicate Lit's Shadow DOM scoped CSS.\n *\n * Each Lit component has `static styles` with :host, element selectors, and ::slotted().\n * Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.\n *\n * Transformation rules:\n * :host → .a2ui-surface .a2ui-{component}\n * section → .a2ui-surface .a2ui-{component} section\n * ::slotted(*) → .a2ui-surface .a2ui-{component} section > *\n */\nexport const componentSpecificStyles: string = `\n/* =========================================================================\n * Card (from Lit card.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-card {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */\n/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */\n.a2ui-surface .a2ui-card > section {\n height: 100%;\n width: 100%;\n min-height: 0;\n overflow: auto;\n}\n\n/* section ::slotted(*) { height: 100%; width: 100%; } */\n/* Use > section > to only target Card's slotted children, not deeply nested elements */\n.a2ui-surface .a2ui-card > section > * {\n height: 100%;\n width: 100%;\n}\n\n/* =========================================================================\n * Divider (from Lit divider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-divider {\n display: block;\n min-height: 0;\n overflow: auto;\n}\n\n/* hr { height: 1px; background: #ccc; border: none; } */\n/* Use :where() for low specificity (0,0,1) so theme utility classes can override */\n/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */\n:where(.a2ui-surface .a2ui-divider) hr {\n height: 1px;\n background: #ccc;\n border: none;\n}\n\n/* =========================================================================\n * Text (from Lit text.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-text {\n display: block;\n flex: var(--weight);\n}\n\n/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */\n:where(.a2ui-surface .a2ui-text) h1,\n:where(.a2ui-surface .a2ui-text) h2,\n:where(.a2ui-surface .a2ui-text) h3,\n:where(.a2ui-surface .a2ui-text) h4,\n:where(.a2ui-surface .a2ui-text) h5 {\n line-height: inherit;\n font: inherit;\n}\n\n/* Ensure markdown paragraph margins are reset */\n.a2ui-surface .a2ui-text p {\n margin: 0;\n}\n\n/* =========================================================================\n * TextField (from Lit text-field.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-textfield {\n display: flex;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-textfield) input {\n display: block;\n width: 100%;\n}\n\n/* label { display: block; margin-bottom: 4px; } */\n:where(.a2ui-surface .a2ui-textfield) label {\n display: block;\n margin-bottom: 4px;\n}\n\n/* textarea - same styling as input for multiline text fields */\n:where(.a2ui-surface .a2ui-textfield) textarea {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * CheckBox (from Lit checkbox.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-checkbox {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-checkbox) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Slider (from Lit slider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-slider {\n display: block;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-slider) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Button (from Lit button.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; } */\n.a2ui-surface .a2ui-button {\n display: block;\n flex: var(--weight);\n min-height: 0;\n}\n\n/* =========================================================================\n * Icon (from Lit icon.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-icon {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* =========================================================================\n * Tabs (from Lit tabs.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-tabs {\n display: block;\n flex: var(--weight);\n}\n\n/* =========================================================================\n * Modal (from Lit modal.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-modal {\n display: block;\n flex: var(--weight);\n}\n\n/* dialog { padding: 0; border: none; background: none; } */\n:where(.a2ui-surface .a2ui-modal) dialog {\n padding: 0;\n border: none;\n background: none;\n}\n\n/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */\n.a2ui-surface .a2ui-modal dialog section #controls {\n display: flex;\n justify-content: end;\n margin-bottom: 4px;\n}\n\n/* dialog section #controls button { padding: 0; background: none; ... } */\n.a2ui-surface .a2ui-modal dialog section #controls button {\n padding: 0;\n background: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n border: none;\n}\n\n/* =========================================================================\n * Image (from Lit image.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-image {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */\n:where(.a2ui-surface .a2ui-image) img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--object-fit, fill);\n}\n\n/* =========================================================================\n * Video (from Lit video.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-video {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* video { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-video) video {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * AudioPlayer (from Lit audio.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-audio {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* audio { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-audio) audio {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * MultipleChoice (from Lit multiple-choice.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-multiplechoice {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* select { width: 100%; } */\n:where(.a2ui-surface .a2ui-multiplechoice) select {\n width: 100%;\n}\n\n/* =========================================================================\n * Column (from Lit column.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-column {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */\n.a2ui-surface .a2ui-column > section {\n display: flex;\n flex-direction: column;\n min-width: 100%;\n height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */\n.a2ui-surface .a2ui-column[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-column[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-column[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-column[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-column[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-column[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-column[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * Row (from Lit row.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-row {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */\n.a2ui-surface .a2ui-row > section {\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Row's direct section, not nested sections */\n.a2ui-surface .a2ui-row[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-row[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-row[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-row[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-row[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-row[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-row[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * List (from Lit list.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-list {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* :host([direction=\"vertical\"]) section { display: grid; } */\n.a2ui-surface .a2ui-list[data-direction=\"vertical\"] > section {\n display: grid;\n}\n\n/* :host([direction=\"horizontal\"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section {\n display: flex;\n max-width: 100%;\n overflow-x: scroll;\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* :host([direction=\"horizontal\"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section > * {\n flex: 1 0 fit-content;\n max-width: min(80%, 400px);\n}\n\n/* =========================================================================\n * DateTimeInput (from Lit datetime-input.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-datetime-input {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */\n:where(.a2ui-surface .a2ui-datetime-input) input {\n display: block;\n border-radius: 8px;\n padding: 8px;\n border: 1px solid #ccc;\n width: 100%;\n}\n\n/* =========================================================================\n * Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)\n * ========================================================================= */\n\n.a2ui-surface *,\n.a2ui-surface *::before,\n.a2ui-surface *::after {\n box-sizing: border-box;\n}\n`;\n\n/**\n * Injects A2UI structural styles into the document head.\n * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.\n * Call this once at application startup.\n *\n * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,\n * just like in the Lit renderer. This allows full customization of the color palette.\n *\n * @example\n * ```tsx\n * import { injectStyles } from '@a2ui/react/styles';\n *\n * // In your app entry point:\n * injectStyles();\n * ```\n */\nexport function injectStyles(): void {\n if (typeof document === \"undefined\") {\n return; // SSR safety\n }\n\n const styleId = \"a2ui-structural-styles\";\n\n // Avoid duplicate injection\n if (document.getElementById(styleId)) {\n return;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.id = styleId;\n // Include structural (utility classes) and component-specific styles\n // Note: CSS variables (palette) must be defined by the host application on :root,\n // just like in the Lit renderer. This allows full customization.\n styleElement.textContent =\n resetStyles + \"\\n\" + structuralStyles + \"\\n\" + componentSpecificStyles;\n document.head.appendChild(styleElement);\n}\n\n/**\n * Removes injected A2UI styles from the document.\n * Useful for cleanup in tests or when unmounting.\n */\nexport function removeStyles(): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const styleElement = document.getElementById(\"a2ui-structural-styles\");\n if (styleElement) {\n styleElement.remove();\n }\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAA2B,OAAO,iBAAiB,QAC9D,eACA,kBACD;;;;;;;;;;;;AAaD,MAAa,0BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwa/C,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,UAAU;AAGhB,KAAI,SAAS,eAAe,QAAQ,CAClC;CAGF,MAAM,eAAe,SAAS,cAAc,QAAQ;AACpD,cAAa,KAAK;AAIlB,cAAa,cACX,cAAc,OAAO,mBAAmB,OAAO;AACjD,UAAS,KAAK,YAAY,aAAa"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/react-renderer/styles/index.ts"],"sourcesContent":["import { Styles } from \"@a2ui/lit/0.8\";\nimport { resetStyles } from \"./reset\";\n\n/**\n * Structural CSS styles from the Lit renderer, converted for global DOM use.\n * These styles define all the utility classes (layout-*, typography-*, color-*, etc.)\n * Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.\n */\nexport const structuralStyles: string = Styles.structuralStyles.replace(\n /:host\\s*\\{/g,\n \".a2ui-surface {\",\n);\n\n/**\n * Component-specific styles that replicate Lit's Shadow DOM scoped CSS.\n *\n * Each Lit component has `static styles` with :host, element selectors, and ::slotted().\n * Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.\n *\n * Transformation rules:\n * :host → .a2ui-surface .a2ui-{component}\n * section → .a2ui-surface .a2ui-{component} section\n * ::slotted(*) → .a2ui-surface .a2ui-{component} section > *\n */\nexport const componentSpecificStyles: string = `\n/* =========================================================================\n * Card (from Lit card.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-card {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */\n/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */\n.a2ui-surface .a2ui-card > section {\n height: 100%;\n width: 100%;\n min-height: 0;\n overflow: auto;\n}\n\n/* section ::slotted(*) { height: 100%; width: 100%; } */\n/* Use > section > to only target Card's slotted children, not deeply nested elements */\n.a2ui-surface .a2ui-card > section > * {\n height: 100%;\n width: 100%;\n}\n\n/* =========================================================================\n * Divider (from Lit divider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-divider {\n display: block;\n min-height: 0;\n overflow: auto;\n}\n\n/* hr { height: 1px; background: #ccc; border: none; } */\n/* Use :where() for low specificity (0,0,1) so theme utility classes can override */\n/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */\n:where(.a2ui-surface .a2ui-divider) hr {\n height: 1px;\n background: #ccc;\n border: none;\n}\n\n/* =========================================================================\n * Text (from Lit text.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-text {\n display: block;\n flex: var(--weight);\n}\n\n/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */\n:where(.a2ui-surface .a2ui-text) h1,\n:where(.a2ui-surface .a2ui-text) h2,\n:where(.a2ui-surface .a2ui-text) h3,\n:where(.a2ui-surface .a2ui-text) h4,\n:where(.a2ui-surface .a2ui-text) h5 {\n line-height: inherit;\n font: inherit;\n}\n\n/* Ensure markdown paragraph margins are reset */\n.a2ui-surface .a2ui-text p {\n margin: 0;\n}\n\n/* =========================================================================\n * TextField (from Lit text-field.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-textfield {\n display: flex;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-textfield) input {\n display: block;\n width: 100%;\n}\n\n/* label { display: block; margin-bottom: 4px; } */\n:where(.a2ui-surface .a2ui-textfield) label {\n display: block;\n margin-bottom: 4px;\n}\n\n/* textarea - same styling as input for multiline text fields */\n:where(.a2ui-surface .a2ui-textfield) textarea {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * CheckBox (from Lit checkbox.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-checkbox {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-checkbox) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Slider (from Lit slider.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-slider {\n display: block;\n flex: var(--weight);\n}\n\n/* input { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-slider) input {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * Button (from Lit button.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; } */\n.a2ui-surface .a2ui-button {\n display: block;\n flex: var(--weight);\n min-height: 0;\n}\n\n/* =========================================================================\n * Icon (from Lit icon.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-icon {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* =========================================================================\n * Tabs (from Lit tabs.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-tabs {\n display: block;\n flex: var(--weight);\n}\n\n/* =========================================================================\n * Modal (from Lit modal.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); } */\n.a2ui-surface .a2ui-modal {\n display: block;\n flex: var(--weight);\n}\n\n/* dialog { padding: 0; border: none; background: none; } */\n:where(.a2ui-surface .a2ui-modal) dialog {\n padding: 0;\n border: none;\n background: none;\n}\n\n/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */\n.a2ui-surface .a2ui-modal dialog section #controls {\n display: flex;\n justify-content: end;\n margin-bottom: 4px;\n}\n\n/* dialog section #controls button { padding: 0; background: none; ... } */\n.a2ui-surface .a2ui-modal dialog section #controls button {\n padding: 0;\n background: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n border: none;\n}\n\n/* =========================================================================\n * Image (from Lit image.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-image {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */\n:where(.a2ui-surface .a2ui-image) img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--object-fit, fill);\n}\n\n/* =========================================================================\n * Video (from Lit video.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-video {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* video { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-video) video {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * AudioPlayer (from Lit audio.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-audio {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* audio { display: block; width: 100%; } */\n:where(.a2ui-surface .a2ui-audio) audio {\n display: block;\n width: 100%;\n}\n\n/* =========================================================================\n * MultipleChoice (from Lit multiple-choice.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-multiplechoice {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* select { width: 100%; } */\n:where(.a2ui-surface .a2ui-multiplechoice) select {\n width: 100%;\n}\n\n/* =========================================================================\n * Column (from Lit column.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-column {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */\n.a2ui-surface .a2ui-column > section {\n display: flex;\n flex-direction: column;\n min-width: 100%;\n height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */\n.a2ui-surface .a2ui-column[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-column[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-column[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-column[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-column[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-column[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-column[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-column[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * Row (from Lit row.ts static styles)\n * ========================================================================= */\n\n/* :host { display: flex; flex: var(--weight); } */\n.a2ui-surface .a2ui-row {\n display: flex;\n flex: var(--weight);\n}\n\n/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */\n.a2ui-surface .a2ui-row > section {\n display: flex;\n flex-direction: row;\n width: 100%;\n min-height: 100%;\n}\n\n/* :host([alignment=\"...\"]) section { align-items: ...; } */\n/* Use > section to only target Row's direct section, not nested sections */\n.a2ui-surface .a2ui-row[data-alignment=\"start\"] > section { align-items: start; }\n.a2ui-surface .a2ui-row[data-alignment=\"center\"] > section { align-items: center; }\n.a2ui-surface .a2ui-row[data-alignment=\"end\"] > section { align-items: end; }\n.a2ui-surface .a2ui-row[data-alignment=\"stretch\"] > section { align-items: stretch; }\n\n/* :host([distribution=\"...\"]) section { justify-content: ...; } */\n.a2ui-surface .a2ui-row[data-distribution=\"start\"] > section { justify-content: start; }\n.a2ui-surface .a2ui-row[data-distribution=\"center\"] > section { justify-content: center; }\n.a2ui-surface .a2ui-row[data-distribution=\"end\"] > section { justify-content: end; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceBetween\"] > section { justify-content: space-between; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceAround\"] > section { justify-content: space-around; }\n.a2ui-surface .a2ui-row[data-distribution=\"spaceEvenly\"] > section { justify-content: space-evenly; }\n\n/* =========================================================================\n * List (from Lit list.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-list {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* :host([direction=\"vertical\"]) section { display: grid; } */\n.a2ui-surface .a2ui-list[data-direction=\"vertical\"] > section {\n display: grid;\n}\n\n/* :host([direction=\"horizontal\"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section {\n display: flex;\n max-width: 100%;\n overflow-x: scroll;\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* :host([direction=\"horizontal\"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */\n.a2ui-surface .a2ui-list[data-direction=\"horizontal\"] > section > * {\n flex: 1 0 fit-content;\n max-width: min(80%, 400px);\n}\n\n/* =========================================================================\n * DateTimeInput (from Lit datetime-input.ts static styles)\n * ========================================================================= */\n\n/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */\n.a2ui-surface .a2ui-datetime-input {\n display: block;\n flex: var(--weight);\n min-height: 0;\n overflow: auto;\n}\n\n/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */\n/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */\n:where(.a2ui-surface .a2ui-datetime-input) input {\n display: block;\n border-radius: 8px;\n padding: 8px;\n border: 1px solid #ccc;\n width: 100%;\n}\n\n/* =========================================================================\n * Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)\n * ========================================================================= */\n\n.a2ui-surface *,\n.a2ui-surface *::before,\n.a2ui-surface *::after {\n box-sizing: border-box;\n}\n`;\n\n/**\n * Injects A2UI structural styles into the document head.\n * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.\n * Call this once at application startup.\n *\n * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,\n * just like in the Lit renderer. This allows full customization of the color palette.\n *\n * @example\n * ```tsx\n * import { injectStyles } from '@a2ui/react/styles';\n *\n * // In your app entry point:\n * injectStyles();\n * ```\n */\nexport function injectStyles(): void {\n if (typeof document === \"undefined\") {\n return; // SSR safety\n }\n\n const styleId = \"a2ui-structural-styles\";\n\n // Avoid duplicate injection\n if (document.getElementById(styleId)) {\n return;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.id = styleId;\n // Include structural (utility classes) and component-specific styles\n // Note: CSS variables (palette) must be defined by the host application on :root,\n // just like in the Lit renderer. This allows full customization.\n styleElement.textContent =\n resetStyles + \"\\n\" + structuralStyles + \"\\n\" + componentSpecificStyles;\n document.head.appendChild(styleElement);\n}\n\n/**\n * Removes injected A2UI styles from the document.\n * Useful for cleanup in tests or when unmounting.\n */\nexport function removeStyles(): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const styleElement = document.getElementById(\"a2ui-structural-styles\");\n if (styleElement) {\n styleElement.remove();\n }\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAA2B,OAAO,iBAAiB,QAC9D,eACA,kBACD;;;;;;;;;;;;AAaD,MAAa,0BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwa/C,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,UAAU;AAGhB,KAAI,SAAS,eAAe,QAAQ,CAClC;CAGF,MAAM,eAAe,SAAS,cAAc,QAAQ;AACpD,cAAa,KAAK;AAIlB,cAAa,cACX,cAAc,OAAO,mBAAmB,OAAO;AACjD,UAAS,KAAK,YAAY,aAAa;;;;;;AAOzC,SAAgB,eAAqB;AACnC,KAAI,OAAO,aAAa,YACtB;CAGF,MAAM,eAAe,SAAS,eAAe,yBAAyB;AACtE,KAAI,aACF,cAAa,QAAQ"}
@@ -28,8 +28,17 @@ function useTheme() {
28
28
  if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
29
29
  return theme;
30
30
  }
31
+ /**
32
+ * Hook to optionally access the current A2UI theme.
33
+ *
34
+ * @returns The current theme, or undefined if not within a provider
35
+ */
36
+ function useThemeOptional() {
37
+ return (0, react.useContext)(ThemeContext);
38
+ }
31
39
 
32
40
  //#endregion
33
41
  exports.ThemeProvider = ThemeProvider;
34
42
  exports.useTheme = useTheme;
43
+ exports.useThemeOptional = useThemeOptional;
35
44
  //# sourceMappingURL=ThemeContext.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeContext.cjs","names":["defaultTheme"],"sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport { defaultTheme } from \"./litTheme\";\n\n/**\n * React context for the A2UI theme.\n */\nconst ThemeContext = createContext<Types.Theme | undefined>(undefined);\n\n/**\n * Props for the ThemeProvider component.\n */\nexport interface ThemeProviderProps {\n /** The theme to provide. Falls back to defaultTheme if not specified. */\n theme?: Types.Theme;\n /** Child components that will have access to the theme */\n children: ReactNode;\n}\n\n/**\n * Provider component that makes the A2UI theme available to descendant components.\n */\nexport function ThemeProvider({ theme, children }: ThemeProviderProps) {\n return (\n <ThemeContext.Provider value={theme ?? defaultTheme}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n/**\n * Hook to access the current A2UI theme.\n *\n * @returns The current theme\n * @throws If used outside of a ThemeProvider\n */\nexport function useTheme(): Types.Theme {\n const theme = useContext(ThemeContext);\n if (!theme) {\n throw new Error(\n \"useTheme must be used within a ThemeProvider or A2UIProvider\",\n );\n }\n return theme;\n}\n\n/**\n * Hook to optionally access the current A2UI theme.\n *\n * @returns The current theme, or undefined if not within a provider\n */\nexport function useThemeOptional(): Types.Theme | undefined {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,wCAAsD,OAAU;;;;AAetE,SAAgB,cAAc,EAAE,OAAO,YAAgC;AACrE,QACE,2CAAC,aAAa;EAAS,OAAO,SAASA;EACpC;GACqB;;;;;;;;AAU5B,SAAgB,WAAwB;CACtC,MAAM,8BAAmB,aAAa;AACtC,KAAI,CAAC,MACH,OAAM,IAAI,MACR,+DACD;AAEH,QAAO"}
1
+ {"version":3,"file":"ThemeContext.cjs","names":["defaultTheme"],"sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport { defaultTheme } from \"./litTheme\";\n\n/**\n * React context for the A2UI theme.\n */\nconst ThemeContext = createContext<Types.Theme | undefined>(undefined);\n\n/**\n * Props for the ThemeProvider component.\n */\nexport interface ThemeProviderProps {\n /** The theme to provide. Falls back to defaultTheme if not specified. */\n theme?: Types.Theme;\n /** Child components that will have access to the theme */\n children: ReactNode;\n}\n\n/**\n * Provider component that makes the A2UI theme available to descendant components.\n */\nexport function ThemeProvider({ theme, children }: ThemeProviderProps) {\n return (\n <ThemeContext.Provider value={theme ?? defaultTheme}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n/**\n * Hook to access the current A2UI theme.\n *\n * @returns The current theme\n * @throws If used outside of a ThemeProvider\n */\nexport function useTheme(): Types.Theme {\n const theme = useContext(ThemeContext);\n if (!theme) {\n throw new Error(\n \"useTheme must be used within a ThemeProvider or A2UIProvider\",\n );\n }\n return theme;\n}\n\n/**\n * Hook to optionally access the current A2UI theme.\n *\n * @returns The current theme, or undefined if not within a provider\n */\nexport function useThemeOptional(): Types.Theme | undefined {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,wCAAsD,OAAU;;;;AAetE,SAAgB,cAAc,EAAE,OAAO,YAAgC;AACrE,QACE,2CAAC,aAAa;EAAS,OAAO,SAASA;EACpC;GACqB;;;;;;;;AAU5B,SAAgB,WAAwB;CACtC,MAAM,8BAAmB,aAAa;AACtC,KAAI,CAAC,MACH,OAAM,IAAI,MACR,+DACD;AAEH,QAAO;;;;;;;AAQT,SAAgB,mBAA4C;AAC1D,8BAAkB,aAAa"}
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { ReactNode } from "react";
3
+ import { Types } from "@a2ui/lit/0.8";
4
+
5
+ //#region src/react-renderer/theme/ThemeContext.d.ts
6
+ /**
7
+ * Props for the ThemeProvider component.
8
+ */
9
+ interface ThemeProviderProps {
10
+ /** The theme to provide. Falls back to defaultTheme if not specified. */
11
+ theme?: Types.Theme;
12
+ /** Child components that will have access to the theme */
13
+ children: ReactNode;
14
+ }
15
+ /**
16
+ * Provider component that makes the A2UI theme available to descendant components.
17
+ */
18
+ declare function ThemeProvider({
19
+ theme,
20
+ children
21
+ }: ThemeProviderProps): react_jsx_runtime0.JSX.Element;
22
+ /**
23
+ * Hook to access the current A2UI theme.
24
+ *
25
+ * @returns The current theme
26
+ * @throws If used outside of a ThemeProvider
27
+ */
28
+ declare function useTheme(): Types.Theme;
29
+ /**
30
+ * Hook to optionally access the current A2UI theme.
31
+ *
32
+ * @returns The current theme, or undefined if not within a provider
33
+ */
34
+ declare function useThemeOptional(): Types.Theme | undefined;
35
+ //#endregion
36
+ export { ThemeProvider, useTheme, useThemeOptional };
37
+ //# sourceMappingURL=ThemeContext.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.d.cts","names":[],"sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"mappings":";;;;;;;;UAYiB,kBAAA;EAAkB;EAEjC,KAAA,GAAQ,KAAA,CAAM,KAAA;EAEK;EAAnB,QAAA,EAAU,SAAA;AAAA;;;;iBAMI,aAAA,CAAA;EAAgB,KAAA;EAAO;AAAA,GAAY,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AAArE;;;;;iBAcgB,QAAA,CAAA,GAAY,KAAA,CAAM,KAAA;;;;;;iBAelB,gBAAA,CAAA,GAAoB,KAAA,CAAM,KAAA"}
@@ -0,0 +1,37 @@
1
+ import { ReactNode } from "react";
2
+ import { Types } from "@a2ui/lit/0.8";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/react-renderer/theme/ThemeContext.d.ts
6
+ /**
7
+ * Props for the ThemeProvider component.
8
+ */
9
+ interface ThemeProviderProps {
10
+ /** The theme to provide. Falls back to defaultTheme if not specified. */
11
+ theme?: Types.Theme;
12
+ /** Child components that will have access to the theme */
13
+ children: ReactNode;
14
+ }
15
+ /**
16
+ * Provider component that makes the A2UI theme available to descendant components.
17
+ */
18
+ declare function ThemeProvider({
19
+ theme,
20
+ children
21
+ }: ThemeProviderProps): react_jsx_runtime0.JSX.Element;
22
+ /**
23
+ * Hook to access the current A2UI theme.
24
+ *
25
+ * @returns The current theme
26
+ * @throws If used outside of a ThemeProvider
27
+ */
28
+ declare function useTheme(): Types.Theme;
29
+ /**
30
+ * Hook to optionally access the current A2UI theme.
31
+ *
32
+ * @returns The current theme, or undefined if not within a provider
33
+ */
34
+ declare function useThemeOptional(): Types.Theme | undefined;
35
+ //#endregion
36
+ export { ThemeProvider, useTheme, useThemeOptional };
37
+ //# sourceMappingURL=ThemeContext.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.d.mts","names":[],"sources":["../../../src/react-renderer/theme/ThemeContext.tsx"],"mappings":";;;;;;;;UAYiB,kBAAA;EAAkB;EAEjC,KAAA,GAAQ,KAAA,CAAM,KAAA;EAEK;EAAnB,QAAA,EAAU,SAAA;AAAA;;;;iBAMI,aAAA,CAAA;EAAgB,KAAA;EAAO;AAAA,GAAY,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AAArE;;;;;iBAcgB,QAAA,CAAA,GAAY,KAAA,CAAM,KAAA;;;;;;iBAelB,gBAAA,CAAA,GAAoB,KAAA,CAAM,KAAA"}
@@ -27,7 +27,15 @@ function useTheme() {
27
27
  if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
28
28
  return theme;
29
29
  }
30
+ /**
31
+ * Hook to optionally access the current A2UI theme.
32
+ *
33
+ * @returns The current theme, or undefined if not within a provider
34
+ */
35
+ function useThemeOptional() {
36
+ return useContext(ThemeContext);
37
+ }
30
38
 
31
39
  //#endregion
32
- export { ThemeProvider, useTheme };
40
+ export { ThemeProvider, useTheme, useThemeOptional };
33
41
  //# sourceMappingURL=ThemeContext.mjs.map