@copilotkit/a2ui-renderer 1.55.0-next.9 → 1.55.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.
- package/dist/a2ui-types.cjs +2 -3
- package/dist/a2ui-types.cjs.map +1 -1
- package/dist/a2ui-types.d.cts +21 -5
- package/dist/a2ui-types.d.cts.map +1 -1
- package/dist/a2ui-types.d.mts +21 -5
- package/dist/a2ui-types.d.mts.map +1 -1
- package/dist/a2ui-types.mjs +2 -3
- package/dist/a2ui-types.mjs.map +1 -1
- package/dist/index.cjs +40 -61
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -39
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -29
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +1743 -2783
- package/dist/index.umd.js.map +1 -1
- package/dist/react-renderer/a2ui-react/A2uiSurface.cjs +110 -0
- package/dist/react-renderer/a2ui-react/A2uiSurface.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/A2uiSurface.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/A2uiSurface.d.mts +3 -0
- package/dist/react-renderer/a2ui-react/A2uiSurface.mjs +107 -0
- package/dist/react-renderer/a2ui-react/A2uiSurface.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/adapter.cjs +63 -0
- package/dist/react-renderer/a2ui-react/adapter.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/adapter.d.cts +23 -0
- package/dist/react-renderer/a2ui-react/adapter.d.cts.map +1 -0
- package/dist/react-renderer/a2ui-react/adapter.d.mts +23 -0
- package/dist/react-renderer/a2ui-react/adapter.d.mts.map +1 -0
- package/dist/react-renderer/a2ui-react/adapter.mjs +61 -0
- package/dist/react-renderer/a2ui-react/adapter.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs +53 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs +36 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs +48 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs +31 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs +39 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs +22 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs +73 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs +71 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs +36 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs +34 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs +110 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs +108 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs +45 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs +69 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs +67 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs +27 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs +27 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs +59 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs +42 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs +49 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs +32 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs +81 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs +80 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs +45 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs +74 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs +72 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs +63 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs +62 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs +69 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs +52 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs +88 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs +86 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs +40 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.d.cts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.d.mts +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs +23 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.cjs +63 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.d.cts +26 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.d.cts.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.d.mts +26 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.d.mts.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.mjs +62 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/index.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs +52 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs +45 -0
- package/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs +51 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.d.mts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs +34 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs +36 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs +34 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs +85 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.d.mts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs +84 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs +84 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.d.mts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs +83 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs +54 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.d.mts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs +53 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs +85 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.d.cts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.d.mts +2 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs +68 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs.map +1 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.d.cts +7 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.d.mts +7 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs +44 -0
- package/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs.map +1 -0
- package/dist/react-renderer/a2ui-react/index.cjs +22 -0
- package/dist/react-renderer/a2ui-react/index.d.cts +4 -0
- package/dist/react-renderer/a2ui-react/index.d.mts +4 -0
- package/dist/react-renderer/a2ui-react/index.mjs +24 -0
- package/dist/react-renderer/catalog-utils.cjs +84 -0
- package/dist/react-renderer/catalog-utils.cjs.map +1 -0
- package/dist/react-renderer/catalog-utils.d.cts +39 -0
- package/dist/react-renderer/catalog-utils.d.cts.map +1 -0
- package/dist/react-renderer/catalog-utils.d.mts +39 -0
- package/dist/react-renderer/catalog-utils.d.mts.map +1 -0
- package/dist/react-renderer/catalog-utils.mjs +79 -0
- package/dist/react-renderer/catalog-utils.mjs.map +1 -0
- package/dist/react-renderer/core/A2UIProvider.cjs +48 -70
- package/dist/react-renderer/core/A2UIProvider.cjs.map +1 -1
- package/dist/react-renderer/core/A2UIProvider.d.cts +13 -47
- package/dist/react-renderer/core/A2UIProvider.d.cts.map +1 -1
- package/dist/react-renderer/core/A2UIProvider.d.mts +13 -47
- package/dist/react-renderer/core/A2UIProvider.d.mts.map +1 -1
- package/dist/react-renderer/core/A2UIProvider.mjs +48 -71
- package/dist/react-renderer/core/A2UIProvider.mjs.map +1 -1
- package/dist/react-renderer/core/A2UIRenderer.cjs +8 -56
- package/dist/react-renderer/core/A2UIRenderer.cjs.map +1 -1
- package/dist/react-renderer/core/A2UIRenderer.d.cts +5 -19
- package/dist/react-renderer/core/A2UIRenderer.d.cts.map +1 -1
- package/dist/react-renderer/core/A2UIRenderer.d.mts +5 -19
- package/dist/react-renderer/core/A2UIRenderer.d.mts.map +1 -1
- package/dist/react-renderer/core/A2UIRenderer.mjs +9 -57
- package/dist/react-renderer/core/A2UIRenderer.mjs.map +1 -1
- package/dist/react-renderer/core/store.d.cts +6 -17
- package/dist/react-renderer/core/store.d.cts.map +1 -1
- package/dist/react-renderer/core/store.d.mts +6 -17
- package/dist/react-renderer/core/store.d.mts.map +1 -1
- package/dist/react-renderer/create-catalog.cjs +115 -0
- package/dist/react-renderer/create-catalog.cjs.map +1 -0
- package/dist/react-renderer/create-catalog.d.cts +107 -0
- package/dist/react-renderer/create-catalog.d.cts.map +1 -0
- package/dist/react-renderer/create-catalog.d.mts +107 -0
- package/dist/react-renderer/create-catalog.d.mts.map +1 -0
- package/dist/react-renderer/create-catalog.mjs +111 -0
- package/dist/react-renderer/create-catalog.mjs.map +1 -0
- package/dist/react-renderer/hooks/useA2UI.cjs +1 -26
- package/dist/react-renderer/hooks/useA2UI.cjs.map +1 -1
- package/dist/react-renderer/hooks/useA2UI.d.cts +5 -33
- package/dist/react-renderer/hooks/useA2UI.d.cts.map +1 -1
- package/dist/react-renderer/hooks/useA2UI.d.mts +5 -33
- package/dist/react-renderer/hooks/useA2UI.d.mts.map +1 -1
- package/dist/react-renderer/hooks/useA2UI.mjs +1 -26
- package/dist/react-renderer/hooks/useA2UI.mjs.map +1 -1
- package/dist/react-renderer/index.cjs +21 -27
- package/dist/react-renderer/index.cjs.map +1 -0
- package/dist/react-renderer/index.d.cts +17 -27
- package/dist/react-renderer/index.d.cts.map +1 -0
- package/dist/react-renderer/index.d.mts +17 -27
- package/dist/react-renderer/index.d.mts.map +1 -0
- package/dist/react-renderer/index.mjs +15 -27
- package/dist/react-renderer/index.mjs.map +1 -0
- package/dist/react-renderer/lib/utils.cjs +0 -25
- package/dist/react-renderer/lib/utils.cjs.map +1 -1
- package/dist/react-renderer/lib/utils.d.cts +0 -8
- package/dist/react-renderer/lib/utils.d.cts.map +1 -1
- package/dist/react-renderer/lib/utils.d.mts +0 -8
- package/dist/react-renderer/lib/utils.d.mts.map +1 -1
- package/dist/react-renderer/lib/utils.mjs +1 -25
- package/dist/react-renderer/lib/utils.mjs.map +1 -1
- package/dist/react-renderer/styles/index.cjs +4 -459
- package/dist/react-renderer/styles/index.cjs.map +1 -1
- package/dist/react-renderer/styles/index.d.mts +2 -18
- package/dist/react-renderer/styles/index.d.mts.map +1 -1
- package/dist/react-renderer/styles/index.mjs +4 -459
- package/dist/react-renderer/styles/index.mjs.map +1 -1
- package/dist/react-renderer/theme/ThemeContext.cjs +2 -19
- package/dist/react-renderer/theme/ThemeContext.cjs.map +1 -1
- package/dist/react-renderer/theme/ThemeContext.d.cts +4 -23
- package/dist/react-renderer/theme/ThemeContext.d.cts.map +1 -1
- package/dist/react-renderer/theme/ThemeContext.d.mts +4 -23
- package/dist/react-renderer/theme/ThemeContext.d.mts.map +1 -1
- package/dist/react-renderer/theme/ThemeContext.mjs +2 -19
- package/dist/react-renderer/theme/ThemeContext.mjs.map +1 -1
- package/dist/react-renderer/types.d.cts +24 -29
- package/dist/react-renderer/types.d.cts.map +1 -1
- package/dist/react-renderer/types.d.mts +24 -29
- package/dist/react-renderer/types.d.mts.map +1 -1
- package/package.json +29 -29
- package/dist/A2UIViewer.cjs +0 -154
- package/dist/A2UIViewer.cjs.map +0 -1
- package/dist/A2UIViewer.d.cts +0 -39
- package/dist/A2UIViewer.d.cts.map +0 -1
- package/dist/A2UIViewer.d.mts +0 -39
- package/dist/A2UIViewer.d.mts.map +0 -1
- package/dist/A2UIViewer.mjs +0 -152
- package/dist/A2UIViewer.mjs.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.cjs +0 -34
- package/dist/react-renderer/components/content/AudioPlayer.cjs.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.d.cts +0 -12
- package/dist/react-renderer/components/content/AudioPlayer.d.cts.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.d.mts +0 -12
- package/dist/react-renderer/components/content/AudioPlayer.d.mts.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.mjs +0 -33
- package/dist/react-renderer/components/content/AudioPlayer.mjs.map +0 -1
- package/dist/react-renderer/components/content/Divider.cjs +0 -31
- package/dist/react-renderer/components/content/Divider.cjs.map +0 -1
- package/dist/react-renderer/components/content/Divider.d.cts +0 -17
- package/dist/react-renderer/components/content/Divider.d.cts.map +0 -1
- package/dist/react-renderer/components/content/Divider.d.mts +0 -17
- package/dist/react-renderer/components/content/Divider.d.mts.map +0 -1
- package/dist/react-renderer/components/content/Divider.mjs +0 -30
- package/dist/react-renderer/components/content/Divider.mjs.map +0 -1
- package/dist/react-renderer/components/content/Icon.cjs +0 -50
- package/dist/react-renderer/components/content/Icon.cjs.map +0 -1
- package/dist/react-renderer/components/content/Icon.d.cts +0 -20
- package/dist/react-renderer/components/content/Icon.d.cts.map +0 -1
- package/dist/react-renderer/components/content/Icon.d.mts +0 -20
- package/dist/react-renderer/components/content/Icon.d.mts.map +0 -1
- package/dist/react-renderer/components/content/Icon.mjs +0 -49
- package/dist/react-renderer/components/content/Icon.mjs.map +0 -1
- package/dist/react-renderer/components/content/Image.cjs +0 -43
- package/dist/react-renderer/components/content/Image.cjs.map +0 -1
- package/dist/react-renderer/components/content/Image.d.cts +0 -15
- package/dist/react-renderer/components/content/Image.d.cts.map +0 -1
- package/dist/react-renderer/components/content/Image.d.mts +0 -15
- package/dist/react-renderer/components/content/Image.d.mts.map +0 -1
- package/dist/react-renderer/components/content/Image.mjs +0 -42
- package/dist/react-renderer/components/content/Image.mjs.map +0 -1
- package/dist/react-renderer/components/content/Text.cjs +0 -131
- package/dist/react-renderer/components/content/Text.cjs.map +0 -1
- package/dist/react-renderer/components/content/Text.d.cts +0 -32
- package/dist/react-renderer/components/content/Text.d.cts.map +0 -1
- package/dist/react-renderer/components/content/Text.d.mts +0 -32
- package/dist/react-renderer/components/content/Text.d.mts.map +0 -1
- package/dist/react-renderer/components/content/Text.mjs +0 -129
- package/dist/react-renderer/components/content/Text.mjs.map +0 -1
- package/dist/react-renderer/components/content/Video.cjs +0 -56
- package/dist/react-renderer/components/content/Video.cjs.map +0 -1
- package/dist/react-renderer/components/content/Video.d.cts +0 -14
- package/dist/react-renderer/components/content/Video.d.cts.map +0 -1
- package/dist/react-renderer/components/content/Video.d.mts +0 -14
- package/dist/react-renderer/components/content/Video.d.mts.map +0 -1
- package/dist/react-renderer/components/content/Video.mjs +0 -55
- package/dist/react-renderer/components/content/Video.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/Button.cjs +0 -39
- package/dist/react-renderer/components/interactive/Button.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/Button.d.cts +0 -15
- package/dist/react-renderer/components/interactive/Button.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/Button.d.mts +0 -15
- package/dist/react-renderer/components/interactive/Button.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/Button.mjs +0 -38
- package/dist/react-renderer/components/interactive/Button.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.cjs +0 -58
- package/dist/react-renderer/components/interactive/CheckBox.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.d.cts +0 -14
- package/dist/react-renderer/components/interactive/CheckBox.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.d.mts +0 -14
- package/dist/react-renderer/components/interactive/CheckBox.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.mjs +0 -57
- package/dist/react-renderer/components/interactive/CheckBox.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.cjs +0 -65
- package/dist/react-renderer/components/interactive/DateTimeInput.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.d.cts +0 -14
- package/dist/react-renderer/components/interactive/DateTimeInput.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.d.mts +0 -14
- package/dist/react-renderer/components/interactive/DateTimeInput.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.mjs +0 -64
- package/dist/react-renderer/components/interactive/DateTimeInput.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.cjs +0 -54
- package/dist/react-renderer/components/interactive/MultipleChoice.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.d.cts +0 -15
- package/dist/react-renderer/components/interactive/MultipleChoice.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.d.mts +0 -15
- package/dist/react-renderer/components/interactive/MultipleChoice.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.mjs +0 -53
- package/dist/react-renderer/components/interactive/MultipleChoice.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.cjs +0 -72
- package/dist/react-renderer/components/interactive/Slider.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.d.cts +0 -14
- package/dist/react-renderer/components/interactive/Slider.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.d.mts +0 -14
- package/dist/react-renderer/components/interactive/Slider.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.mjs +0 -71
- package/dist/react-renderer/components/interactive/Slider.mjs.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.cjs +0 -74
- package/dist/react-renderer/components/interactive/TextField.cjs.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.d.cts +0 -14
- package/dist/react-renderer/components/interactive/TextField.d.cts.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.d.mts +0 -14
- package/dist/react-renderer/components/interactive/TextField.d.mts.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.mjs +0 -73
- package/dist/react-renderer/components/interactive/TextField.mjs.map +0 -1
- package/dist/react-renderer/components/layout/Card.cjs +0 -46
- package/dist/react-renderer/components/layout/Card.cjs.map +0 -1
- package/dist/react-renderer/components/layout/Card.d.cts +0 -21
- package/dist/react-renderer/components/layout/Card.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/Card.d.mts +0 -21
- package/dist/react-renderer/components/layout/Card.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/Card.mjs +0 -45
- package/dist/react-renderer/components/layout/Card.mjs.map +0 -1
- package/dist/react-renderer/components/layout/Column.cjs +0 -43
- package/dist/react-renderer/components/layout/Column.cjs.map +0 -1
- package/dist/react-renderer/components/layout/Column.d.cts +0 -14
- package/dist/react-renderer/components/layout/Column.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/Column.d.mts +0 -14
- package/dist/react-renderer/components/layout/Column.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/Column.mjs +0 -42
- package/dist/react-renderer/components/layout/Column.mjs.map +0 -1
- package/dist/react-renderer/components/layout/List.cjs +0 -41
- package/dist/react-renderer/components/layout/List.cjs.map +0 -1
- package/dist/react-renderer/components/layout/List.d.cts +0 -14
- package/dist/react-renderer/components/layout/List.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/List.d.mts +0 -14
- package/dist/react-renderer/components/layout/List.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/List.mjs +0 -40
- package/dist/react-renderer/components/layout/List.mjs.map +0 -1
- package/dist/react-renderer/components/layout/Modal.cjs +0 -92
- package/dist/react-renderer/components/layout/Modal.cjs.map +0 -1
- package/dist/react-renderer/components/layout/Modal.d.cts +0 -19
- package/dist/react-renderer/components/layout/Modal.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/Modal.d.mts +0 -19
- package/dist/react-renderer/components/layout/Modal.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/Modal.mjs +0 -91
- package/dist/react-renderer/components/layout/Modal.mjs.map +0 -1
- package/dist/react-renderer/components/layout/Row.cjs +0 -43
- package/dist/react-renderer/components/layout/Row.cjs.map +0 -1
- package/dist/react-renderer/components/layout/Row.d.cts +0 -14
- package/dist/react-renderer/components/layout/Row.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/Row.d.mts +0 -14
- package/dist/react-renderer/components/layout/Row.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/Row.mjs +0 -42
- package/dist/react-renderer/components/layout/Row.mjs.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.cjs +0 -47
- package/dist/react-renderer/components/layout/Tabs.cjs.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.d.cts +0 -12
- package/dist/react-renderer/components/layout/Tabs.d.cts.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.d.mts +0 -12
- package/dist/react-renderer/components/layout/Tabs.d.mts.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.mjs +0 -46
- package/dist/react-renderer/components/layout/Tabs.mjs.map +0 -1
- package/dist/react-renderer/core/A2UIViewer.cjs +0 -11
- package/dist/react-renderer/core/A2UIViewer.d.cts +0 -16
- package/dist/react-renderer/core/A2UIViewer.d.cts.map +0 -1
- package/dist/react-renderer/core/A2UIViewer.d.mts +0 -16
- package/dist/react-renderer/core/A2UIViewer.d.mts.map +0 -1
- package/dist/react-renderer/core/A2UIViewer.mjs +0 -11
- package/dist/react-renderer/core/ComponentNode.cjs +0 -53
- package/dist/react-renderer/core/ComponentNode.cjs.map +0 -1
- package/dist/react-renderer/core/ComponentNode.d.cts +0 -29
- package/dist/react-renderer/core/ComponentNode.d.cts.map +0 -1
- package/dist/react-renderer/core/ComponentNode.d.mts +0 -29
- package/dist/react-renderer/core/ComponentNode.d.mts.map +0 -1
- package/dist/react-renderer/core/ComponentNode.mjs +0 -52
- package/dist/react-renderer/core/ComponentNode.mjs.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.cjs +0 -173
- package/dist/react-renderer/hooks/useA2UIComponent.cjs.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.d.cts +0 -56
- package/dist/react-renderer/hooks/useA2UIComponent.d.cts.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.d.mts +0 -56
- package/dist/react-renderer/hooks/useA2UIComponent.d.mts.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.mjs +0 -172
- package/dist/react-renderer/hooks/useA2UIComponent.mjs.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.cjs +0 -114
- package/dist/react-renderer/registry/ComponentRegistry.cjs.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.d.cts +0 -82
- package/dist/react-renderer/registry/ComponentRegistry.d.cts.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.d.mts +0 -82
- package/dist/react-renderer/registry/ComponentRegistry.d.mts.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.mjs +0 -113
- package/dist/react-renderer/registry/ComponentRegistry.mjs.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.cjs +0 -58
- package/dist/react-renderer/registry/defaultCatalog.cjs.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.d.cts +0 -17
- package/dist/react-renderer/registry/defaultCatalog.d.cts.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.d.mts +0 -17
- package/dist/react-renderer/registry/defaultCatalog.d.mts.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.mjs +0 -57
- package/dist/react-renderer/registry/defaultCatalog.mjs.map +0 -1
- package/dist/react-renderer/styles/reset.cjs +0 -29
- package/dist/react-renderer/styles/reset.cjs.map +0 -1
- package/dist/react-renderer/styles/reset.mjs +0 -28
- package/dist/react-renderer/styles/reset.mjs.map +0 -1
- package/dist/react-renderer/theme/litTheme.cjs +0 -386
- package/dist/react-renderer/theme/litTheme.cjs.map +0 -1
- package/dist/react-renderer/theme/litTheme.d.cts +0 -12
- package/dist/react-renderer/theme/litTheme.d.cts.map +0 -1
- package/dist/react-renderer/theme/litTheme.d.mts +0 -12
- package/dist/react-renderer/theme/litTheme.d.mts.map +0 -1
- package/dist/react-renderer/theme/litTheme.mjs +0 -384
- package/dist/react-renderer/theme/litTheme.mjs.map +0 -1
- package/dist/react-renderer/theme/utils.cjs +0 -41
- package/dist/react-renderer/theme/utils.cjs.map +0 -1
- package/dist/react-renderer/theme/utils.d.cts +0 -26
- package/dist/react-renderer/theme/utils.d.cts.map +0 -1
- package/dist/react-renderer/theme/utils.d.mts +0 -26
- package/dist/react-renderer/theme/utils.d.mts.map +0 -1
- package/dist/react-renderer/theme/utils.mjs +0 -39
- package/dist/react-renderer/theme/utils.mjs.map +0 -1
- package/dist/theme/viewer-theme.cjs +0 -395
- package/dist/theme/viewer-theme.cjs.map +0 -1
- package/dist/theme/viewer-theme.d.cts +0 -7
- package/dist/theme/viewer-theme.d.cts.map +0 -1
- package/dist/theme/viewer-theme.d.mts +0 -7
- package/dist/theme/viewer-theme.d.mts.map +0 -1
- package/dist/theme/viewer-theme.mjs +0 -394
- package/dist/theme/viewer-theme.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@a2ui/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@a2ui/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitA2UIRenderer = {}), global.React,global.
|
|
5
|
-
})(this, function(exports, react,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@a2ui/web_core/v0_9'), require('react/jsx-runtime'), require('@a2ui/web_core/v0_9/basic_catalog'), require('zod'), require('clsx'), require('zod-to-json-schema')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@a2ui/web_core/v0_9', 'react/jsx-runtime', '@a2ui/web_core/v0_9/basic_catalog', 'zod', 'clsx', 'zod-to-json-schema'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitA2UIRenderer = {}), global.React,global._a2ui_web_core_v0_9,global.React,global._a2ui_web_core_v0_9_basic_catalog,global.Zod,global.clsx,global.zod_to_json_schema));
|
|
5
|
+
})(this, function(exports, react, _a2ui_web_core_v0_9, react_jsx_runtime, _a2ui_web_core_v0_9_basic_catalog, zod, clsx, zod_to_json_schema) {
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
8
|
var __create = Object.create;
|
|
@@ -32,3055 +32,2015 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
react = __toESM(react);
|
|
35
|
-
markdown_it = __toESM(markdown_it);
|
|
36
35
|
|
|
37
|
-
//#region src/react-renderer/
|
|
36
|
+
//#region src/react-renderer/a2ui-react/A2uiSurface.tsx
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* Copyright 2026 Google LLC
|
|
40
39
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
41
|
+
* you may not use this file except in compliance with the License.
|
|
42
|
+
* You may obtain a copy of the License at
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
* styling. If Lit components change their class maps, this file must be updated
|
|
46
|
-
* to match. Ideally, Lit would export its default theme for direct import.
|
|
44
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
47
45
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* // Inject structural CSS at app startup
|
|
55
|
-
* injectStyles();
|
|
56
|
-
*
|
|
57
|
-
* function App() {
|
|
58
|
-
* return (
|
|
59
|
-
* <A2UIProvider>
|
|
60
|
-
* <A2UIRenderer surfaceId="main" />
|
|
61
|
-
* </A2UIProvider>
|
|
62
|
-
* );
|
|
63
|
-
* }
|
|
64
|
-
* ```
|
|
46
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
47
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
48
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
49
|
+
* See the License for the specific language governing permissions and
|
|
50
|
+
* limitations under the License.
|
|
65
51
|
*/
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
const elementIframe = { "behavior-sw-n": true };
|
|
110
|
-
const elementInput = {
|
|
111
|
-
"typography-f-sf": true,
|
|
112
|
-
"typography-fs-n": true,
|
|
113
|
-
"typography-w-400": true,
|
|
114
|
-
"layout-pl-4": true,
|
|
115
|
-
"layout-pr-4": true,
|
|
116
|
-
"layout-pt-2": true,
|
|
117
|
-
"layout-pb-2": true,
|
|
118
|
-
"border-br-6": true,
|
|
119
|
-
"border-bw-1": true,
|
|
120
|
-
"color-bc-s70": true,
|
|
121
|
-
"border-bs-s": true,
|
|
122
|
-
"layout-as-n": true,
|
|
123
|
-
"color-c-n10": true
|
|
124
|
-
};
|
|
125
|
-
const elementP = {
|
|
126
|
-
"typography-f-s": true,
|
|
127
|
-
"typography-fs-n": true,
|
|
128
|
-
"typography-w-400": true,
|
|
129
|
-
"layout-m-0": true,
|
|
130
|
-
"typography-sz-bm": true,
|
|
131
|
-
"layout-as-n": true,
|
|
132
|
-
"color-c-n10": true
|
|
133
|
-
};
|
|
134
|
-
const elementList = {
|
|
135
|
-
"typography-f-s": true,
|
|
136
|
-
"typography-fs-n": true,
|
|
137
|
-
"typography-w-400": true,
|
|
138
|
-
"layout-m-0": true,
|
|
139
|
-
"typography-sz-bm": true,
|
|
140
|
-
"layout-as-n": true,
|
|
141
|
-
"color-c-n10": true
|
|
142
|
-
};
|
|
143
|
-
const elementPre = {
|
|
144
|
-
"typography-f-c": true,
|
|
145
|
-
"typography-fs-n": true,
|
|
146
|
-
"typography-w-400": true,
|
|
147
|
-
"typography-sz-bm": true,
|
|
148
|
-
"typography-ws-p": true,
|
|
149
|
-
"layout-as-n": true
|
|
150
|
-
};
|
|
151
|
-
const elementTextarea = {
|
|
152
|
-
...elementInput,
|
|
153
|
-
"layout-r-none": true,
|
|
154
|
-
"layout-fs-c": true
|
|
155
|
-
};
|
|
156
|
-
const elementVideo = { "layout-el-cv": true };
|
|
157
|
-
const litTheme = {
|
|
158
|
-
additionalStyles: {
|
|
159
|
-
Button: {
|
|
160
|
-
background: "var(--primary, oklch(0.205 0 0))",
|
|
161
|
-
color: "var(--primary-foreground, oklch(0.985 0 0))",
|
|
162
|
-
"border-radius": "calc(var(--radius, 0.625rem) - 2px)",
|
|
163
|
-
cursor: "pointer",
|
|
164
|
-
width: "100%",
|
|
165
|
-
"--n-10": "var(--primary-foreground, oklch(0.985 0 0))",
|
|
166
|
-
"--n-35": "var(--primary-foreground, oklch(0.985 0 0))",
|
|
167
|
-
"--n-60": "var(--primary-foreground, oklch(0.985 0 0))"
|
|
168
|
-
},
|
|
169
|
-
Card: {
|
|
170
|
-
background: "var(--card, oklch(1 0 0))",
|
|
171
|
-
border: "1px solid var(--border, oklch(0.922 0 0))",
|
|
172
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
173
|
-
},
|
|
174
|
-
TextField: {
|
|
175
|
-
"background-color": "var(--background, oklch(1 0 0))",
|
|
176
|
-
"border-color": "var(--input, oklch(0.922 0 0))",
|
|
177
|
-
color: "var(--foreground, oklch(0.145 0 0))",
|
|
178
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
179
|
-
},
|
|
180
|
-
CheckBox: {
|
|
181
|
-
"--p-100": "var(--background, oklch(1 0 0))",
|
|
182
|
-
"--p-60": "var(--input, oklch(0.922 0 0))",
|
|
183
|
-
"--n-30": "var(--foreground, oklch(0.145 0 0))"
|
|
184
|
-
},
|
|
185
|
-
DateTimeInput: {
|
|
186
|
-
"background-color": "var(--background, oklch(1 0 0))",
|
|
187
|
-
"border-color": "var(--input, oklch(0.922 0 0))",
|
|
188
|
-
color: "var(--foreground, oklch(0.145 0 0))",
|
|
189
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
190
|
-
},
|
|
191
|
-
Modal: {
|
|
192
|
-
"--p-100": "var(--card, oklch(1 0 0))",
|
|
193
|
-
"--p-80": "var(--border, oklch(0.922 0 0))",
|
|
194
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
195
|
-
},
|
|
196
|
-
Text: { color: "var(--foreground, oklch(0.145 0 0))" }
|
|
197
|
-
},
|
|
198
|
-
components: {
|
|
199
|
-
AudioPlayer: {},
|
|
200
|
-
Divider: {},
|
|
201
|
-
Icon: {},
|
|
202
|
-
Image: {
|
|
203
|
-
all: {
|
|
204
|
-
"border-br-5": true,
|
|
205
|
-
"layout-el-cv": true,
|
|
206
|
-
"layout-w-100": true,
|
|
207
|
-
"layout-h-100": true
|
|
208
|
-
},
|
|
209
|
-
avatar: { "is-avatar": true },
|
|
210
|
-
header: {},
|
|
211
|
-
icon: {},
|
|
212
|
-
largeFeature: {},
|
|
213
|
-
mediumFeature: {},
|
|
214
|
-
smallFeature: {}
|
|
215
|
-
},
|
|
216
|
-
Text: {
|
|
217
|
-
all: {
|
|
218
|
-
"layout-w-100": true,
|
|
219
|
-
"layout-g-2": true
|
|
220
|
-
},
|
|
221
|
-
h1: {
|
|
222
|
-
"typography-f-sf": true,
|
|
223
|
-
"typography-v-r": true,
|
|
224
|
-
"typography-w-400": true,
|
|
225
|
-
"layout-m-0": true,
|
|
226
|
-
"layout-p-0": true,
|
|
227
|
-
"typography-sz-hs": true
|
|
228
|
-
},
|
|
229
|
-
h2: {
|
|
230
|
-
"typography-f-sf": true,
|
|
231
|
-
"typography-v-r": true,
|
|
232
|
-
"typography-w-400": true,
|
|
233
|
-
"layout-m-0": true,
|
|
234
|
-
"layout-p-0": true,
|
|
235
|
-
"typography-sz-tl": true
|
|
236
|
-
},
|
|
237
|
-
h3: {
|
|
238
|
-
"typography-f-sf": true,
|
|
239
|
-
"typography-v-r": true,
|
|
240
|
-
"typography-w-400": true,
|
|
241
|
-
"layout-m-0": true,
|
|
242
|
-
"layout-p-0": true,
|
|
243
|
-
"typography-sz-tl": true
|
|
244
|
-
},
|
|
245
|
-
h4: {
|
|
246
|
-
"typography-f-sf": true,
|
|
247
|
-
"typography-v-r": true,
|
|
248
|
-
"typography-w-400": true,
|
|
249
|
-
"layout-m-0": true,
|
|
250
|
-
"layout-p-0": true,
|
|
251
|
-
"typography-sz-bl": true
|
|
252
|
-
},
|
|
253
|
-
h5: {
|
|
254
|
-
"typography-f-sf": true,
|
|
255
|
-
"typography-v-r": true,
|
|
256
|
-
"typography-w-400": true,
|
|
257
|
-
"layout-m-0": true,
|
|
258
|
-
"layout-p-0": true,
|
|
259
|
-
"typography-sz-bm": true
|
|
260
|
-
},
|
|
261
|
-
body: {},
|
|
262
|
-
caption: {}
|
|
263
|
-
},
|
|
264
|
-
Video: {
|
|
265
|
-
"border-br-5": true,
|
|
266
|
-
"layout-el-cv": true
|
|
267
|
-
},
|
|
268
|
-
Card: {
|
|
269
|
-
"border-br-9": true,
|
|
270
|
-
"layout-p-4": true,
|
|
271
|
-
"color-bgc-n100": true
|
|
272
|
-
},
|
|
273
|
-
Column: { "layout-g-2": true },
|
|
274
|
-
List: {
|
|
275
|
-
"layout-g-4": true,
|
|
276
|
-
"layout-p-2": true
|
|
277
|
-
},
|
|
278
|
-
Modal: {
|
|
279
|
-
backdrop: { "color-bbgc-p60_20": true },
|
|
280
|
-
element: {
|
|
281
|
-
"border-br-2": true,
|
|
282
|
-
"color-bgc-p100": true,
|
|
283
|
-
"layout-p-4": true,
|
|
284
|
-
"border-bw-1": true,
|
|
285
|
-
"border-bs-s": true,
|
|
286
|
-
"color-bc-p80": true
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
Row: { "layout-g-4": true },
|
|
290
|
-
Tabs: {
|
|
291
|
-
container: {},
|
|
292
|
-
controls: {
|
|
293
|
-
all: {},
|
|
294
|
-
selected: {}
|
|
295
|
-
},
|
|
296
|
-
element: {}
|
|
297
|
-
},
|
|
298
|
-
Button: {
|
|
299
|
-
"layout-pt-2": true,
|
|
300
|
-
"layout-pb-2": true,
|
|
301
|
-
"layout-pl-3": true,
|
|
302
|
-
"layout-pr-3": true,
|
|
303
|
-
"border-bw-0": true,
|
|
304
|
-
"border-bs-s": true,
|
|
305
|
-
"typography-w-400": true
|
|
306
|
-
},
|
|
307
|
-
CheckBox: {
|
|
308
|
-
container: {
|
|
309
|
-
"layout-dsp-iflex": true,
|
|
310
|
-
"layout-al-c": true
|
|
311
|
-
},
|
|
312
|
-
element: {
|
|
313
|
-
"layout-m-0": true,
|
|
314
|
-
"layout-mr-2": true,
|
|
315
|
-
"layout-p-2": true,
|
|
316
|
-
"border-br-2": true,
|
|
317
|
-
"border-bw-1": true,
|
|
318
|
-
"border-bs-s": true,
|
|
319
|
-
"color-bgc-p100": true,
|
|
320
|
-
"color-bc-p60": true,
|
|
321
|
-
"color-c-n30": true
|
|
322
|
-
},
|
|
323
|
-
label: {
|
|
324
|
-
"typography-f-sf": true,
|
|
325
|
-
"typography-v-r": true,
|
|
326
|
-
"typography-w-400": true,
|
|
327
|
-
"layout-flx-1": true,
|
|
328
|
-
"typography-sz-ll": true
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
DateTimeInput: {
|
|
332
|
-
container: {
|
|
333
|
-
"typography-sz-bm": true,
|
|
334
|
-
"layout-w-100": true,
|
|
335
|
-
"layout-g-2": true,
|
|
336
|
-
"layout-dsp-flexvert": true
|
|
337
|
-
},
|
|
338
|
-
label: {
|
|
339
|
-
"color-c-p30": true,
|
|
340
|
-
"typography-sz-bm": true
|
|
52
|
+
const ResolvedChild = (0, react.memo)(({ surface, id, basePath, compImpl, componentModel }) => {
|
|
53
|
+
const ComponentToRender = compImpl.render;
|
|
54
|
+
const context = (0, react.useMemo)(() => new _a2ui_web_core_v0_9.ComponentContext(surface, id, basePath), [
|
|
55
|
+
surface,
|
|
56
|
+
id,
|
|
57
|
+
basePath,
|
|
58
|
+
componentModel
|
|
59
|
+
]);
|
|
60
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentToRender, {
|
|
61
|
+
context,
|
|
62
|
+
buildChild: (0, react.useCallback)((childId, specificPath) => {
|
|
63
|
+
const path = specificPath || context.dataContext.path;
|
|
64
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
|
|
65
|
+
surface,
|
|
66
|
+
id: childId,
|
|
67
|
+
basePath: path
|
|
68
|
+
}, `${childId}-${path}`);
|
|
69
|
+
}, [surface, context.dataContext.path])
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
ResolvedChild.displayName = "ResolvedChild";
|
|
73
|
+
const DeferredChild = (0, react.memo)(({ surface, id, basePath }) => {
|
|
74
|
+
const store = (0, react.useMemo)(() => {
|
|
75
|
+
let version = 0;
|
|
76
|
+
return {
|
|
77
|
+
subscribe: (cb) => {
|
|
78
|
+
const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {
|
|
79
|
+
if (comp.id === id) {
|
|
80
|
+
version++;
|
|
81
|
+
cb();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {
|
|
85
|
+
if (delId === id) {
|
|
86
|
+
version++;
|
|
87
|
+
cb();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return () => {
|
|
91
|
+
unsub1.unsubscribe();
|
|
92
|
+
unsub2.unsubscribe();
|
|
93
|
+
};
|
|
341
94
|
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
"layout-pl-3": true,
|
|
346
|
-
"layout-pr-3": true,
|
|
347
|
-
"border-bw-1": true,
|
|
348
|
-
"border-bs-s": true
|
|
95
|
+
getSnapshot: () => {
|
|
96
|
+
const comp = surface.componentsModel.get(id);
|
|
97
|
+
return comp ? `${comp.type}-${version}` : `missing-${version}`;
|
|
349
98
|
}
|
|
99
|
+
};
|
|
100
|
+
}, [surface, id]);
|
|
101
|
+
(0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
102
|
+
const componentModel = surface.componentsModel.get(id);
|
|
103
|
+
if (!componentModel) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
104
|
+
style: {
|
|
105
|
+
padding: "12px 16px",
|
|
106
|
+
borderRadius: "8px",
|
|
107
|
+
background: "linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)",
|
|
108
|
+
backgroundSize: "200% 100%",
|
|
109
|
+
animation: "a2ui-shimmer 1.5s ease-in-out infinite",
|
|
110
|
+
minHeight: "2rem"
|
|
350
111
|
},
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
"layout-pl-3": true,
|
|
374
|
-
"layout-pr-3": true,
|
|
375
|
-
"border-bw-1": true,
|
|
376
|
-
"border-bs-s": true
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
elements: {
|
|
381
|
-
a: elementA,
|
|
382
|
-
audio: elementAudio,
|
|
383
|
-
body: elementBody,
|
|
384
|
-
button: elementButton,
|
|
385
|
-
h1: elementHeading,
|
|
386
|
-
h2: elementHeading,
|
|
387
|
-
h3: elementHeading,
|
|
388
|
-
h4: elementHeading,
|
|
389
|
-
h5: elementHeading,
|
|
390
|
-
iframe: elementIframe,
|
|
391
|
-
input: elementInput,
|
|
392
|
-
p: elementP,
|
|
393
|
-
pre: elementPre,
|
|
394
|
-
textarea: elementTextarea,
|
|
395
|
-
video: elementVideo
|
|
396
|
-
},
|
|
397
|
-
markdown: {
|
|
398
|
-
p: Object.keys(elementP),
|
|
399
|
-
h1: Object.keys(elementHeading),
|
|
400
|
-
h2: Object.keys(elementHeading),
|
|
401
|
-
h3: Object.keys(elementHeading),
|
|
402
|
-
h4: Object.keys(elementHeading),
|
|
403
|
-
h5: Object.keys(elementHeading),
|
|
404
|
-
ul: Object.keys(elementList),
|
|
405
|
-
ol: Object.keys(elementList),
|
|
406
|
-
li: Object.keys(elementList),
|
|
407
|
-
a: Object.keys(elementA),
|
|
408
|
-
strong: [],
|
|
409
|
-
em: ["typography-fs-n"]
|
|
410
|
-
}
|
|
112
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: `@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }` })
|
|
113
|
+
});
|
|
114
|
+
const compImpl = surface.catalog.components.get(componentModel.type);
|
|
115
|
+
if (!compImpl) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
116
|
+
style: { color: "red" },
|
|
117
|
+
children: ["Unknown component: ", componentModel.type]
|
|
118
|
+
});
|
|
119
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedChild, {
|
|
120
|
+
surface,
|
|
121
|
+
id,
|
|
122
|
+
basePath,
|
|
123
|
+
componentModel,
|
|
124
|
+
compImpl
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
DeferredChild.displayName = "DeferredChild";
|
|
128
|
+
const A2uiSurface = ({ surface }) => {
|
|
129
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
|
|
130
|
+
surface,
|
|
131
|
+
id: "root",
|
|
132
|
+
basePath: "/"
|
|
133
|
+
});
|
|
411
134
|
};
|
|
412
|
-
/**
|
|
413
|
-
* Alias for litTheme - the default theme for A2UI React components.
|
|
414
|
-
* @see litTheme
|
|
415
|
-
*/
|
|
416
|
-
const defaultTheme = litTheme;
|
|
417
135
|
|
|
418
136
|
//#endregion
|
|
419
|
-
//#region src/react-renderer/
|
|
137
|
+
//#region src/react-renderer/a2ui-react/adapter.tsx
|
|
420
138
|
/**
|
|
421
|
-
*
|
|
139
|
+
* Copyright 2026 Google LLC
|
|
140
|
+
*
|
|
141
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
142
|
+
* you may not use this file except in compliance with the License.
|
|
143
|
+
* You may obtain a copy of the License at
|
|
144
|
+
*
|
|
145
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
146
|
+
*
|
|
147
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
148
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
149
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
150
|
+
* See the License for the specific language governing permissions and
|
|
151
|
+
* limitations under the License.
|
|
422
152
|
*/
|
|
423
|
-
const ThemeContext = (0, react.createContext)(void 0);
|
|
424
153
|
/**
|
|
425
|
-
*
|
|
154
|
+
* Creates a React component implementation using the deep generic binder.
|
|
426
155
|
*/
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
156
|
+
function createReactComponent(api, RenderComponent) {
|
|
157
|
+
const MemoizedRender = (0, react.memo)(RenderComponent, (prev, next) => {
|
|
158
|
+
if (prev.props !== next.props) return false;
|
|
159
|
+
if (prev.context.componentModel.id !== next.context.componentModel.id) return false;
|
|
160
|
+
if (prev.context.dataContext.path !== next.context.dataContext.path) return false;
|
|
161
|
+
return true;
|
|
431
162
|
});
|
|
163
|
+
const ReactWrapper = ({ context, buildChild }) => {
|
|
164
|
+
const bindingRef = (0, react.useRef)(null);
|
|
165
|
+
if (!bindingRef.current) bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
|
|
166
|
+
else if (bindingRef.current.context !== context) {
|
|
167
|
+
bindingRef.current.dispose();
|
|
168
|
+
bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
|
|
169
|
+
}
|
|
170
|
+
const binding = bindingRef.current;
|
|
171
|
+
const props = (0, react.useSyncExternalStore)((0, react.useCallback)((callback) => {
|
|
172
|
+
const sub = binding.subscribe(callback);
|
|
173
|
+
return () => sub.unsubscribe();
|
|
174
|
+
}, [binding]), (0, react.useCallback)(() => binding.snapshot, [binding]));
|
|
175
|
+
(0, react.useEffect)(() => {
|
|
176
|
+
return () => binding.dispose();
|
|
177
|
+
}, [binding]);
|
|
178
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedRender, {
|
|
179
|
+
props: props || {},
|
|
180
|
+
buildChild,
|
|
181
|
+
context
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
return {
|
|
185
|
+
name: api.name,
|
|
186
|
+
schema: api.schema,
|
|
187
|
+
render: ReactWrapper
|
|
188
|
+
};
|
|
432
189
|
}
|
|
433
|
-
|
|
434
|
-
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/utils.ts
|
|
193
|
+
/** Standard leaf margin from the implementation guide. */
|
|
194
|
+
const LEAF_MARGIN = "8px";
|
|
195
|
+
/** Standard internal padding for visually bounded containers. */
|
|
196
|
+
const CONTAINER_PADDING = "16px";
|
|
197
|
+
/** Standard border for cards and inputs. */
|
|
198
|
+
const STANDARD_BORDER = "1px solid #ccc";
|
|
199
|
+
/** Standard border radius. */
|
|
200
|
+
const STANDARD_RADIUS = "8px";
|
|
201
|
+
const mapJustify$2 = (j) => {
|
|
202
|
+
switch (j) {
|
|
203
|
+
case "center": return "center";
|
|
204
|
+
case "end": return "flex-end";
|
|
205
|
+
case "spaceAround": return "space-around";
|
|
206
|
+
case "spaceBetween": return "space-between";
|
|
207
|
+
case "spaceEvenly": return "space-evenly";
|
|
208
|
+
case "start": return "flex-start";
|
|
209
|
+
case "stretch": return "stretch";
|
|
210
|
+
default: return "flex-start";
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const mapAlign$2 = (a) => {
|
|
214
|
+
switch (a) {
|
|
215
|
+
case "start": return "flex-start";
|
|
216
|
+
case "center": return "center";
|
|
217
|
+
case "end": return "flex-end";
|
|
218
|
+
case "stretch": return "stretch";
|
|
219
|
+
default: return "stretch";
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const getBaseLeafStyle = () => ({
|
|
223
|
+
margin: LEAF_MARGIN,
|
|
224
|
+
boxSizing: "border-box"
|
|
225
|
+
});
|
|
226
|
+
const getBaseContainerStyle = () => ({
|
|
227
|
+
margin: LEAF_MARGIN,
|
|
228
|
+
padding: CONTAINER_PADDING,
|
|
229
|
+
border: STANDARD_BORDER,
|
|
230
|
+
borderRadius: STANDARD_RADIUS,
|
|
231
|
+
boxSizing: "border-box"
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Text.tsx
|
|
236
|
+
/**
|
|
237
|
+
* Copyright 2026 Google LLC
|
|
435
238
|
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
|
|
439
|
-
function useTheme() {
|
|
440
|
-
const theme = (0, react.useContext)(ThemeContext);
|
|
441
|
-
if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
|
|
442
|
-
return theme;
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Hook to optionally access the current A2UI theme.
|
|
239
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
240
|
+
* you may not use this file except in compliance with the License.
|
|
241
|
+
* You may obtain a copy of the License at
|
|
446
242
|
*
|
|
447
|
-
*
|
|
243
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
244
|
+
*
|
|
245
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
246
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
247
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
248
|
+
* See the License for the specific language governing permissions and
|
|
249
|
+
* limitations under the License.
|
|
448
250
|
*/
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
251
|
+
const Text$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TextApi, ({ props }) => {
|
|
252
|
+
var _props$text;
|
|
253
|
+
const text = (_props$text = props.text) !== null && _props$text !== void 0 ? _props$text : "";
|
|
254
|
+
const style = {
|
|
255
|
+
...getBaseLeafStyle(),
|
|
256
|
+
display: "inline-block"
|
|
257
|
+
};
|
|
258
|
+
switch (props.variant) {
|
|
259
|
+
case "h1": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
260
|
+
style,
|
|
261
|
+
children: text
|
|
262
|
+
});
|
|
263
|
+
case "h2": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
264
|
+
style,
|
|
265
|
+
children: text
|
|
266
|
+
});
|
|
267
|
+
case "h3": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
268
|
+
style,
|
|
269
|
+
children: text
|
|
270
|
+
});
|
|
271
|
+
case "h4": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
272
|
+
style,
|
|
273
|
+
children: text
|
|
274
|
+
});
|
|
275
|
+
case "h5": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
|
|
276
|
+
style,
|
|
277
|
+
children: text
|
|
278
|
+
});
|
|
279
|
+
case "caption": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
280
|
+
style: {
|
|
281
|
+
...style,
|
|
282
|
+
color: "#666",
|
|
283
|
+
textAlign: "left"
|
|
284
|
+
},
|
|
285
|
+
children: text
|
|
286
|
+
});
|
|
287
|
+
default: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
288
|
+
style,
|
|
289
|
+
children: text
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
452
293
|
|
|
453
294
|
//#endregion
|
|
454
|
-
//#region src/react-renderer/
|
|
295
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Image.tsx
|
|
455
296
|
/**
|
|
456
|
-
*
|
|
457
|
-
* Components that only need to dispatch actions or read data won't re-render.
|
|
458
|
-
*/
|
|
459
|
-
const A2UIActionsContext = (0, react.createContext)(null);
|
|
460
|
-
/**
|
|
461
|
-
* Context for reactive state (changes trigger re-renders).
|
|
462
|
-
* Only components that need to react to state changes subscribe to this.
|
|
463
|
-
*/
|
|
464
|
-
const A2UIStateContext = (0, react.createContext)(null);
|
|
465
|
-
/**
|
|
466
|
-
* Provider component that sets up the A2UI context for descendant components.
|
|
297
|
+
* Copyright 2026 Google LLC
|
|
467
298
|
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
299
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
300
|
+
* you may not use this file except in compliance with the License.
|
|
301
|
+
* You may obtain a copy of the License at
|
|
471
302
|
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
* });
|
|
480
|
-
* const newMessages = await response.json();
|
|
481
|
-
* };
|
|
482
|
-
*
|
|
483
|
-
* return (
|
|
484
|
-
* <A2UIProvider onAction={handleAction}>
|
|
485
|
-
* <A2UIRenderer surfaceId="main" />
|
|
486
|
-
* </A2UIProvider>
|
|
487
|
-
* );
|
|
488
|
-
* }
|
|
489
|
-
* ```
|
|
303
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
304
|
+
*
|
|
305
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
306
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
307
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
308
|
+
* See the License for the specific language governing permissions and
|
|
309
|
+
* limitations under the License.
|
|
490
310
|
*/
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
const [version, setVersion] = (0, react.useState)(0);
|
|
496
|
-
const onActionRef = (0, react.useRef)(onAction !== null && onAction !== void 0 ? onAction : null);
|
|
497
|
-
onActionRef.current = onAction !== null && onAction !== void 0 ? onAction : null;
|
|
498
|
-
const actionsRef = (0, react.useRef)(null);
|
|
499
|
-
if (!actionsRef.current) actionsRef.current = {
|
|
500
|
-
processMessages: (messages) => {
|
|
501
|
-
processor.processMessages(messages);
|
|
502
|
-
setVersion((v) => v + 1);
|
|
503
|
-
},
|
|
504
|
-
setData: (node, path, value, surfaceId) => {
|
|
505
|
-
processor.setData(node, path, value, surfaceId);
|
|
506
|
-
setVersion((v) => v + 1);
|
|
507
|
-
},
|
|
508
|
-
dispatch: (message) => {
|
|
509
|
-
if (onActionRef.current) onActionRef.current(message);
|
|
510
|
-
},
|
|
511
|
-
clearSurfaces: () => {
|
|
512
|
-
processor.clearSurfaces();
|
|
513
|
-
setVersion((v) => v + 1);
|
|
514
|
-
},
|
|
515
|
-
getSurface: (surfaceId) => {
|
|
516
|
-
return processor.getSurfaces().get(surfaceId);
|
|
517
|
-
},
|
|
518
|
-
getSurfaces: () => {
|
|
519
|
-
return processor.getSurfaces();
|
|
520
|
-
},
|
|
521
|
-
getData: (node, path, surfaceId) => {
|
|
522
|
-
return processor.getData(node, path, surfaceId);
|
|
523
|
-
},
|
|
524
|
-
resolvePath: (path, dataContextPath) => {
|
|
525
|
-
return processor.resolvePath(path, dataContextPath);
|
|
526
|
-
}
|
|
311
|
+
const Image = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ImageApi, ({ props }) => {
|
|
312
|
+
const mapFit = (fit) => {
|
|
313
|
+
if (fit === "scaleDown") return "scale-down";
|
|
314
|
+
return fit || "fill";
|
|
527
315
|
};
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
316
|
+
const style = {
|
|
317
|
+
...getBaseLeafStyle(),
|
|
318
|
+
objectFit: mapFit(props.fit),
|
|
319
|
+
width: "100%",
|
|
320
|
+
height: "auto",
|
|
321
|
+
display: "block"
|
|
322
|
+
};
|
|
323
|
+
if (props.variant === "icon") {
|
|
324
|
+
style.width = "24px";
|
|
325
|
+
style.height = "24px";
|
|
326
|
+
} else if (props.variant === "avatar") {
|
|
327
|
+
style.width = "40px";
|
|
328
|
+
style.height = "40px";
|
|
329
|
+
style.borderRadius = "50%";
|
|
330
|
+
} else if (props.variant === "smallFeature") style.maxWidth = "100px";
|
|
331
|
+
else if (props.variant === "largeFeature") style.maxHeight = "400px";
|
|
332
|
+
else if (props.variant === "header") {
|
|
333
|
+
style.height = "200px";
|
|
334
|
+
style.objectFit = "cover";
|
|
335
|
+
}
|
|
336
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
337
|
+
src: props.url,
|
|
338
|
+
alt: props.description || "",
|
|
339
|
+
style
|
|
539
340
|
});
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Icon.tsx
|
|
345
|
+
/**
|
|
346
|
+
* Copyright 2026 Google LLC
|
|
544
347
|
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
|
|
548
|
-
function useA2UIActions() {
|
|
549
|
-
const actions = (0, react.useContext)(A2UIActionsContext);
|
|
550
|
-
if (!actions) throw new Error("useA2UIActions must be used within an A2UIProvider");
|
|
551
|
-
return actions;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Hook to subscribe to A2UI state changes.
|
|
555
|
-
* Components using this will re-render when state changes.
|
|
348
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
349
|
+
* you may not use this file except in compliance with the License.
|
|
350
|
+
* You may obtain a copy of the License at
|
|
556
351
|
*
|
|
557
|
-
*
|
|
558
|
-
* @throws If used outside of an A2UIProvider
|
|
559
|
-
*/
|
|
560
|
-
function useA2UIState() {
|
|
561
|
-
const state = (0, react.useContext)(A2UIStateContext);
|
|
562
|
-
if (!state) throw new Error("useA2UIState must be used within an A2UIProvider");
|
|
563
|
-
return state;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Hook to access the full A2UI context (actions + state).
|
|
567
|
-
* Components using this will re-render when state changes.
|
|
352
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
568
353
|
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
354
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
355
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
356
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
357
|
+
* See the License for the specific language governing permissions and
|
|
358
|
+
* limitations under the License.
|
|
571
359
|
*/
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
const
|
|
575
|
-
return (0,
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
360
|
+
const Icon = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.IconApi, ({ props }) => {
|
|
361
|
+
var _props$name;
|
|
362
|
+
const iconName = typeof props.name === "string" ? props.name : (_props$name = props.name) === null || _props$name === void 0 ? void 0 : _props$name.path;
|
|
363
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
364
|
+
className: "material-symbols-outlined",
|
|
365
|
+
style: {
|
|
366
|
+
...getBaseLeafStyle(),
|
|
367
|
+
fontSize: "24px",
|
|
368
|
+
width: "24px",
|
|
369
|
+
height: "24px",
|
|
370
|
+
display: "inline-flex",
|
|
371
|
+
alignItems: "center",
|
|
372
|
+
justifyContent: "center"
|
|
373
|
+
},
|
|
374
|
+
children: iconName
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Video.tsx
|
|
380
|
+
/**
|
|
381
|
+
* Copyright 2026 Google LLC
|
|
590
382
|
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
383
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
384
|
+
* you may not use this file except in compliance with the License.
|
|
385
|
+
* You may obtain a copy of the License at
|
|
386
|
+
*
|
|
387
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
388
|
+
*
|
|
389
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
390
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
391
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
392
|
+
* See the License for the specific language governing permissions and
|
|
393
|
+
* limitations under the License.
|
|
593
394
|
*/
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
395
|
+
const Video = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.VideoApi, ({ props }) => {
|
|
396
|
+
const style = {
|
|
397
|
+
...getBaseLeafStyle(),
|
|
398
|
+
width: "100%",
|
|
399
|
+
aspectRatio: "16/9"
|
|
400
|
+
};
|
|
401
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("video", {
|
|
402
|
+
src: props.url,
|
|
403
|
+
controls: true,
|
|
404
|
+
style
|
|
405
|
+
});
|
|
406
|
+
});
|
|
597
407
|
|
|
598
408
|
//#endregion
|
|
599
|
-
//#region src/react-renderer/
|
|
409
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx
|
|
600
410
|
/**
|
|
601
|
-
*
|
|
602
|
-
* and access surface state.
|
|
411
|
+
* Copyright 2026 Google LLC
|
|
603
412
|
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
413
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
414
|
+
* you may not use this file except in compliance with the License.
|
|
415
|
+
* You may obtain a copy of the License at
|
|
607
416
|
*
|
|
608
|
-
*
|
|
417
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
609
418
|
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
* useEffect(() => {
|
|
616
|
-
* const ws = new WebSocket('wss://agent.example.com');
|
|
617
|
-
* ws.onmessage = (event) => {
|
|
618
|
-
* const messages = JSON.parse(event.data);
|
|
619
|
-
* processMessages(messages);
|
|
620
|
-
* };
|
|
621
|
-
* return () => ws.close();
|
|
622
|
-
* }, [processMessages]);
|
|
623
|
-
*
|
|
624
|
-
* return <A2UIRenderer surfaceId="main" />;
|
|
625
|
-
* }
|
|
626
|
-
* ```
|
|
419
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
420
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
421
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
422
|
+
* See the License for the specific language governing permissions and
|
|
423
|
+
* limitations under the License.
|
|
627
424
|
*/
|
|
628
|
-
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
processMessages: actions.processMessages,
|
|
633
|
-
getSurface: actions.getSurface,
|
|
634
|
-
getSurfaces: actions.getSurfaces,
|
|
635
|
-
clearSurfaces: actions.clearSurfaces,
|
|
636
|
-
version: state.version
|
|
425
|
+
const AudioPlayer = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.AudioPlayerApi, ({ props }) => {
|
|
426
|
+
const style = {
|
|
427
|
+
...getBaseLeafStyle(),
|
|
428
|
+
width: "100%"
|
|
637
429
|
};
|
|
638
|
-
|
|
430
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
431
|
+
style: {
|
|
432
|
+
display: "flex",
|
|
433
|
+
flexDirection: "column",
|
|
434
|
+
gap: "4px",
|
|
435
|
+
width: "100%"
|
|
436
|
+
},
|
|
437
|
+
children: [props.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
438
|
+
style: {
|
|
439
|
+
fontSize: "12px",
|
|
440
|
+
color: "#666"
|
|
441
|
+
},
|
|
442
|
+
children: props.description
|
|
443
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
|
|
444
|
+
src: props.url,
|
|
445
|
+
controls: true,
|
|
446
|
+
style
|
|
447
|
+
})]
|
|
448
|
+
});
|
|
449
|
+
});
|
|
639
450
|
|
|
640
451
|
//#endregion
|
|
641
|
-
//#region src/react-renderer/
|
|
452
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/ChildList.tsx
|
|
642
453
|
/**
|
|
643
|
-
*
|
|
644
|
-
* and supports lazy loading for code splitting.
|
|
645
|
-
*
|
|
646
|
-
* @example
|
|
647
|
-
* ```tsx
|
|
648
|
-
* const registry = new ComponentRegistry();
|
|
454
|
+
* Copyright 2026 Google LLC
|
|
649
455
|
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
456
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
457
|
+
* you may not use this file except in compliance with the License.
|
|
458
|
+
* You may obtain a copy of the License at
|
|
652
459
|
*
|
|
653
|
-
*
|
|
654
|
-
* registry.register('Modal', {
|
|
655
|
-
* component: () => import('./components/Modal'),
|
|
656
|
-
* lazy: true
|
|
657
|
-
* });
|
|
460
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
658
461
|
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
462
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
463
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
464
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
465
|
+
* See the License for the specific language governing permissions and
|
|
466
|
+
* limitations under the License.
|
|
662
467
|
*/
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* Get the singleton instance of the registry.
|
|
670
|
-
* Use this for the default global registry.
|
|
671
|
-
*/
|
|
672
|
-
static getInstance() {
|
|
673
|
-
if (!ComponentRegistry._instance) ComponentRegistry._instance = new ComponentRegistry();
|
|
674
|
-
return ComponentRegistry._instance;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Reset the singleton instance.
|
|
678
|
-
* Useful for testing.
|
|
679
|
-
*/
|
|
680
|
-
static resetInstance() {
|
|
681
|
-
ComponentRegistry._instance = null;
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Register a component type.
|
|
685
|
-
*
|
|
686
|
-
* @param type - The A2UI component type name (e.g., 'Text', 'Button')
|
|
687
|
-
* @param registration - The component registration
|
|
688
|
-
*/
|
|
689
|
-
register(type, registration) {
|
|
690
|
-
this.registry.set(type, registration);
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Unregister a component type.
|
|
694
|
-
*
|
|
695
|
-
* @param type - The component type to unregister
|
|
696
|
-
*/
|
|
697
|
-
unregister(type) {
|
|
698
|
-
this.registry.delete(type);
|
|
699
|
-
this.lazyCache.delete(type);
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Check if a component type is registered.
|
|
703
|
-
*
|
|
704
|
-
* @param type - The component type to check
|
|
705
|
-
* @returns True if the component is registered
|
|
706
|
-
*/
|
|
707
|
-
has(type) {
|
|
708
|
-
return this.registry.has(type);
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Get a component by type. If the component is registered with lazy loading,
|
|
712
|
-
* returns a React.lazy wrapped component.
|
|
713
|
-
*
|
|
714
|
-
* @param type - The component type to get
|
|
715
|
-
* @returns The React component, or null if not found
|
|
716
|
-
*/
|
|
717
|
-
get(type) {
|
|
718
|
-
const registration = this.registry.get(type);
|
|
719
|
-
if (!registration) return null;
|
|
720
|
-
if (registration.lazy && typeof registration.component === "function") {
|
|
721
|
-
const cached = this.lazyCache.get(type);
|
|
722
|
-
if (cached) return cached;
|
|
723
|
-
const lazyComponent = (0, react.lazy)(registration.component);
|
|
724
|
-
this.lazyCache.set(type, lazyComponent);
|
|
725
|
-
return lazyComponent;
|
|
468
|
+
const ChildList$1 = ({ childList, buildChild }) => {
|
|
469
|
+
if (Array.isArray(childList)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: childList.map((item, i) => {
|
|
470
|
+
if (item && typeof item === "object" && "id" in item) {
|
|
471
|
+
const node = item;
|
|
472
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(node.id, node.basePath) }, `${node.id}-${i}`);
|
|
726
473
|
}
|
|
727
|
-
return
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
*
|
|
732
|
-
* @returns Array of registered type names
|
|
733
|
-
*/
|
|
734
|
-
getRegisteredTypes() {
|
|
735
|
-
return Array.from(this.registry.keys());
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Clear all registrations.
|
|
739
|
-
*/
|
|
740
|
-
clear() {
|
|
741
|
-
this.registry.clear();
|
|
742
|
-
this.lazyCache.clear();
|
|
743
|
-
}
|
|
474
|
+
if (typeof item === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(item) }, `${item}-${i}`);
|
|
475
|
+
return null;
|
|
476
|
+
}) });
|
|
477
|
+
return null;
|
|
744
478
|
};
|
|
745
|
-
ComponentRegistry._instance = null;
|
|
746
479
|
|
|
747
480
|
//#endregion
|
|
748
|
-
//#region src/react-renderer/
|
|
749
|
-
/**
|
|
750
|
-
|
|
481
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Row.tsx
|
|
482
|
+
/**
|
|
483
|
+
* Copyright 2026 Google LLC
|
|
484
|
+
*
|
|
485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
486
|
+
* you may not use this file except in compliance with the License.
|
|
487
|
+
* You may obtain a copy of the License at
|
|
488
|
+
*
|
|
489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
490
|
+
*
|
|
491
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
494
|
+
* See the License for the specific language governing permissions and
|
|
495
|
+
* limitations under the License.
|
|
496
|
+
*/
|
|
497
|
+
const Row$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.RowApi, ({ props, buildChild, context }) => {
|
|
751
498
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
752
|
-
className: "a2ui-loading",
|
|
753
499
|
style: {
|
|
754
|
-
|
|
755
|
-
|
|
500
|
+
display: "flex",
|
|
501
|
+
flexDirection: "row",
|
|
502
|
+
justifyContent: mapJustify$2(props.justify),
|
|
503
|
+
alignItems: mapAlign$2(props.align),
|
|
504
|
+
width: "100%",
|
|
505
|
+
margin: 0,
|
|
506
|
+
padding: 0
|
|
756
507
|
},
|
|
757
|
-
children:
|
|
508
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
|
|
509
|
+
childList: props.children,
|
|
510
|
+
buildChild,
|
|
511
|
+
context
|
|
512
|
+
})
|
|
758
513
|
});
|
|
759
514
|
});
|
|
760
|
-
|
|
761
|
-
|
|
515
|
+
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Column.tsx
|
|
518
|
+
/**
|
|
519
|
+
* Copyright 2026 Google LLC
|
|
762
520
|
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
521
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
522
|
+
* you may not use this file except in compliance with the License.
|
|
523
|
+
* You may obtain a copy of the License at
|
|
765
524
|
*
|
|
766
|
-
*
|
|
767
|
-
* direct flex child, exactly matching Lit's structure where the :host element IS
|
|
768
|
-
* the flex item. Each component handles --weight CSS variable on its root div.
|
|
525
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
769
526
|
*
|
|
770
|
-
*
|
|
527
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
528
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
529
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
530
|
+
* See the License for the specific language governing permissions and
|
|
531
|
+
* limitations under the License.
|
|
771
532
|
*/
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
node,
|
|
788
|
-
surfaceId
|
|
533
|
+
const Column$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ColumnApi, ({ props, buildChild, context }) => {
|
|
534
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
535
|
+
style: {
|
|
536
|
+
display: "flex",
|
|
537
|
+
flexDirection: "column",
|
|
538
|
+
justifyContent: mapJustify$2(props.justify),
|
|
539
|
+
alignItems: mapAlign$2(props.align),
|
|
540
|
+
width: "100%",
|
|
541
|
+
margin: 0,
|
|
542
|
+
padding: 0
|
|
543
|
+
},
|
|
544
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
|
|
545
|
+
childList: props.children,
|
|
546
|
+
buildChild,
|
|
547
|
+
context
|
|
789
548
|
})
|
|
790
549
|
});
|
|
791
550
|
});
|
|
792
551
|
|
|
793
552
|
//#endregion
|
|
794
|
-
//#region src/react-renderer/
|
|
553
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/List.tsx
|
|
795
554
|
/**
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
* @param classMap - An object where keys are class names and values are booleans
|
|
799
|
-
* @returns A space-separated string of class names where the value is true
|
|
555
|
+
* Copyright 2026 Google LLC
|
|
800
556
|
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*/
|
|
805
|
-
function classMapToString(classMap) {
|
|
806
|
-
if (!classMap) return "";
|
|
807
|
-
return Object.entries(classMap).filter(([, enabled]) => enabled).map(([className]) => className).join(" ");
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Converts an additional styles object (Record<string, string>) to a React style object.
|
|
557
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
558
|
+
* you may not use this file except in compliance with the License.
|
|
559
|
+
* You may obtain a copy of the License at
|
|
811
560
|
*
|
|
812
|
-
*
|
|
813
|
-
* @returns A React-compatible style object, or undefined if no styles
|
|
561
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
814
562
|
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
563
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
564
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
565
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
566
|
+
* See the License for the specific language governing permissions and
|
|
567
|
+
* limitations under the License.
|
|
818
568
|
*/
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
569
|
+
const List = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ListApi, ({ props, buildChild, context }) => {
|
|
570
|
+
const isHorizontal = props.direction === "horizontal";
|
|
571
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
572
|
+
style: {
|
|
573
|
+
display: "flex",
|
|
574
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
575
|
+
alignItems: mapAlign$2(props.align),
|
|
576
|
+
overflowX: isHorizontal ? "auto" : "hidden",
|
|
577
|
+
overflowY: isHorizontal ? "hidden" : "auto",
|
|
578
|
+
width: "100%",
|
|
579
|
+
margin: 0,
|
|
580
|
+
padding: 0
|
|
581
|
+
},
|
|
582
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
|
|
583
|
+
childList: props.children,
|
|
584
|
+
buildChild,
|
|
585
|
+
context
|
|
586
|
+
})
|
|
587
|
+
});
|
|
588
|
+
});
|
|
829
589
|
|
|
830
590
|
//#endregion
|
|
831
|
-
//#region src/react-renderer/
|
|
591
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Card.tsx
|
|
832
592
|
/**
|
|
833
|
-
*
|
|
834
|
-
* Combines clsx for conditional classes.
|
|
593
|
+
* Copyright 2026 Google LLC
|
|
835
594
|
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
595
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
596
|
+
* you may not use this file except in compliance with the License.
|
|
597
|
+
* You may obtain a copy of the License at
|
|
838
598
|
*
|
|
839
|
-
*
|
|
840
|
-
* cn('base-class', condition && 'conditional-class', { 'object-class': true })
|
|
841
|
-
*/
|
|
842
|
-
function cn(...inputs) {
|
|
843
|
-
return (0, clsx.clsx)(inputs);
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* Merges multiple class maps into a single class map.
|
|
847
|
-
* Uses Lit's Styles.merge() function directly for consistency.
|
|
599
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
848
600
|
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
601
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
602
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
603
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
604
|
+
* See the License for the specific language governing permissions and
|
|
605
|
+
* limitations under the License.
|
|
854
606
|
*/
|
|
855
|
-
|
|
856
|
-
const validMaps = maps.filter((m) => m !== void 0);
|
|
857
|
-
if (validMaps.length === 0) return {};
|
|
858
|
-
return _a2ui_lit_0_8.Styles.merge(...validMaps);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
//#endregion
|
|
862
|
-
//#region src/react-renderer/core/A2UIRenderer.tsx
|
|
863
|
-
/** Default loading fallback - memoized to prevent recreation */
|
|
864
|
-
const DefaultLoadingFallback = (0, react.memo)(function DefaultLoadingFallback() {
|
|
607
|
+
const Card = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.CardApi, ({ props, buildChild }) => {
|
|
865
608
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
866
|
-
className: "a2ui-loading",
|
|
867
609
|
style: {
|
|
868
|
-
|
|
869
|
-
|
|
610
|
+
...getBaseContainerStyle(),
|
|
611
|
+
backgroundColor: "#fff",
|
|
612
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
613
|
+
width: "100%"
|
|
870
614
|
},
|
|
871
|
-
children:
|
|
615
|
+
children: props.child ? buildChild(props.child) : null
|
|
872
616
|
});
|
|
873
617
|
});
|
|
874
|
-
|
|
875
|
-
|
|
618
|
+
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Tabs.tsx
|
|
621
|
+
/**
|
|
622
|
+
* Copyright 2026 Google LLC
|
|
876
623
|
*
|
|
877
|
-
*
|
|
878
|
-
*
|
|
624
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
625
|
+
* you may not use this file except in compliance with the License.
|
|
626
|
+
* You may obtain a copy of the License at
|
|
879
627
|
*
|
|
880
|
-
*
|
|
628
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
881
629
|
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
*
|
|
887
|
-
* <A2UIRenderer surfaceId="main" />
|
|
888
|
-
* </A2UIProvider>
|
|
889
|
-
* );
|
|
890
|
-
* }
|
|
891
|
-
* ```
|
|
630
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
631
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
632
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
633
|
+
* See the License for the specific language governing permissions and
|
|
634
|
+
* limitations under the License.
|
|
892
635
|
*/
|
|
893
|
-
const
|
|
894
|
-
const
|
|
895
|
-
const
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
if (!surface || !surface.componentTree) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
|
|
928
|
-
const actualLoadingFallback = loadingFallback !== null && loadingFallback !== void 0 ? loadingFallback : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {});
|
|
929
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
930
|
-
className: cn("a2ui-surface", className),
|
|
931
|
-
style: surfaceStyles,
|
|
932
|
-
"data-surface-id": surfaceId,
|
|
933
|
-
"data-version": version,
|
|
934
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
935
|
-
fallback: actualLoadingFallback,
|
|
936
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
|
|
937
|
-
node: surface.componentTree,
|
|
938
|
-
surfaceId,
|
|
939
|
-
registry
|
|
940
|
-
})
|
|
941
|
-
})
|
|
636
|
+
const Tabs = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TabsApi, ({ props, buildChild }) => {
|
|
637
|
+
const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
|
|
638
|
+
const tabs = props.tabs || [];
|
|
639
|
+
const activeTab = tabs[selectedIndex];
|
|
640
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
641
|
+
style: {
|
|
642
|
+
display: "flex",
|
|
643
|
+
flexDirection: "column",
|
|
644
|
+
width: "100%",
|
|
645
|
+
margin: LEAF_MARGIN
|
|
646
|
+
},
|
|
647
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
648
|
+
style: {
|
|
649
|
+
display: "flex",
|
|
650
|
+
borderBottom: "1px solid #ccc",
|
|
651
|
+
marginBottom: "8px"
|
|
652
|
+
},
|
|
653
|
+
children: tabs.map((tab, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
654
|
+
onClick: () => setSelectedIndex(i),
|
|
655
|
+
style: {
|
|
656
|
+
padding: "8px 16px",
|
|
657
|
+
border: "none",
|
|
658
|
+
background: "none",
|
|
659
|
+
borderBottom: selectedIndex === i ? "2px solid var(--a2ui-primary-color, #007bff)" : "none",
|
|
660
|
+
fontWeight: selectedIndex === i ? "bold" : "normal",
|
|
661
|
+
cursor: "pointer",
|
|
662
|
+
color: selectedIndex === i ? "var(--a2ui-primary-color, #007bff)" : "inherit"
|
|
663
|
+
},
|
|
664
|
+
children: tab.title
|
|
665
|
+
}, i))
|
|
666
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
667
|
+
style: { flex: 1 },
|
|
668
|
+
children: activeTab ? buildChild(activeTab.child) : null
|
|
669
|
+
})]
|
|
942
670
|
});
|
|
943
671
|
});
|
|
944
672
|
|
|
945
673
|
//#endregion
|
|
946
|
-
//#region src/react-renderer/
|
|
674
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Divider.tsx
|
|
947
675
|
/**
|
|
948
|
-
*
|
|
949
|
-
* and action dispatching.
|
|
676
|
+
* Copyright 2026 Google LLC
|
|
950
677
|
*
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
678
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
679
|
+
* you may not use this file except in compliance with the License.
|
|
680
|
+
* You may obtain a copy of the License at
|
|
954
681
|
*
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
* return (
|
|
964
|
-
* <div className={classMapToString(theme.components.TextField.container)}>
|
|
965
|
-
* <label>{label}</label>
|
|
966
|
-
* <input
|
|
967
|
-
* value={value}
|
|
968
|
-
* onChange={(e) => setValue(node.properties.text?.path!, e.target.value)}
|
|
969
|
-
* />
|
|
970
|
-
* </div>
|
|
971
|
-
* );
|
|
972
|
-
* }
|
|
973
|
-
* ```
|
|
682
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
683
|
+
*
|
|
684
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
685
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
686
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
687
|
+
* See the License for the specific language governing permissions and
|
|
688
|
+
* limitations under the License.
|
|
974
689
|
*/
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
const data = actions.getData(node, value.path, surfaceId);
|
|
992
|
-
return data !== null ? String(data) : null;
|
|
993
|
-
}
|
|
994
|
-
return null;
|
|
995
|
-
}, [
|
|
996
|
-
actions,
|
|
997
|
-
node,
|
|
998
|
-
surfaceId
|
|
999
|
-
]);
|
|
1000
|
-
/**
|
|
1001
|
-
* Resolve a NumberValue to its actual number value.
|
|
1002
|
-
*/
|
|
1003
|
-
const resolveNumber = (0, react.useCallback)((value) => {
|
|
1004
|
-
if (!value) return null;
|
|
1005
|
-
if (typeof value !== "object") return null;
|
|
1006
|
-
if (value.literalNumber !== void 0) return value.literalNumber;
|
|
1007
|
-
if (value.literal !== void 0) return Number(value.literal);
|
|
1008
|
-
if (value.path) {
|
|
1009
|
-
const data = actions.getData(node, value.path, surfaceId);
|
|
1010
|
-
return data !== null ? Number(data) : null;
|
|
1011
|
-
}
|
|
1012
|
-
return null;
|
|
1013
|
-
}, [
|
|
1014
|
-
actions,
|
|
1015
|
-
node,
|
|
1016
|
-
surfaceId
|
|
1017
|
-
]);
|
|
1018
|
-
/**
|
|
1019
|
-
* Resolve a BooleanValue to its actual boolean value.
|
|
1020
|
-
*/
|
|
1021
|
-
const resolveBoolean = (0, react.useCallback)((value) => {
|
|
1022
|
-
if (!value) return null;
|
|
1023
|
-
if (typeof value !== "object") return null;
|
|
1024
|
-
if (value.literalBoolean !== void 0) return value.literalBoolean;
|
|
1025
|
-
if (value.literal !== void 0) return Boolean(value.literal);
|
|
1026
|
-
if (value.path) {
|
|
1027
|
-
const data = actions.getData(node, value.path, surfaceId);
|
|
1028
|
-
return data !== null ? Boolean(data) : null;
|
|
1029
|
-
}
|
|
1030
|
-
return null;
|
|
1031
|
-
}, [
|
|
1032
|
-
actions,
|
|
1033
|
-
node,
|
|
1034
|
-
surfaceId
|
|
1035
|
-
]);
|
|
1036
|
-
/**
|
|
1037
|
-
* Set a value in the data model for two-way binding.
|
|
1038
|
-
*/
|
|
1039
|
-
const setValue = (0, react.useCallback)((path, value) => {
|
|
1040
|
-
actions.setData(node, path, value, surfaceId);
|
|
1041
|
-
}, [
|
|
1042
|
-
actions,
|
|
1043
|
-
node,
|
|
1044
|
-
surfaceId
|
|
1045
|
-
]);
|
|
1046
|
-
/**
|
|
1047
|
-
* Get a value from the data model.
|
|
1048
|
-
*/
|
|
1049
|
-
const getValue = (0, react.useCallback)((path) => {
|
|
1050
|
-
return actions.getData(node, path, surfaceId);
|
|
1051
|
-
}, [
|
|
1052
|
-
actions,
|
|
1053
|
-
node,
|
|
1054
|
-
surfaceId
|
|
1055
|
-
]);
|
|
1056
|
-
/**
|
|
1057
|
-
* Dispatch a user action to the server.
|
|
1058
|
-
* Resolves all context bindings before dispatching.
|
|
1059
|
-
*/
|
|
1060
|
-
const sendAction = (0, react.useCallback)((action) => {
|
|
1061
|
-
const actionContext = {};
|
|
1062
|
-
if (action.context) {
|
|
1063
|
-
for (const item of action.context) if (item.value.literalString !== void 0) actionContext[item.key] = item.value.literalString;
|
|
1064
|
-
else if (item.value.literalNumber !== void 0) actionContext[item.key] = item.value.literalNumber;
|
|
1065
|
-
else if (item.value.literalBoolean !== void 0) actionContext[item.key] = item.value.literalBoolean;
|
|
1066
|
-
else if (item.value.path) {
|
|
1067
|
-
const resolvedPath = actions.resolvePath(item.value.path, node.dataContextPath);
|
|
1068
|
-
actionContext[item.key] = actions.getData(node, resolvedPath, surfaceId);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
actions.dispatch({ userAction: {
|
|
1072
|
-
name: action.name,
|
|
1073
|
-
sourceComponentId: node.id,
|
|
1074
|
-
surfaceId,
|
|
1075
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1076
|
-
context: actionContext
|
|
1077
|
-
} });
|
|
1078
|
-
}, [
|
|
1079
|
-
actions,
|
|
1080
|
-
node,
|
|
1081
|
-
surfaceId
|
|
1082
|
-
]);
|
|
1083
|
-
/**
|
|
1084
|
-
* Generate a unique ID for accessibility purposes.
|
|
1085
|
-
* Uses React's useId() for SSR and Concurrent Mode compatibility.
|
|
1086
|
-
*/
|
|
1087
|
-
const getUniqueId = (0, react.useCallback)((prefix) => {
|
|
1088
|
-
return `${prefix}${baseId}`;
|
|
1089
|
-
}, [baseId]);
|
|
1090
|
-
return (0, react.useMemo)(() => ({
|
|
1091
|
-
theme,
|
|
1092
|
-
resolveString,
|
|
1093
|
-
resolveNumber,
|
|
1094
|
-
resolveBoolean,
|
|
1095
|
-
setValue,
|
|
1096
|
-
getValue,
|
|
1097
|
-
sendAction,
|
|
1098
|
-
getUniqueId
|
|
1099
|
-
}), [
|
|
1100
|
-
theme,
|
|
1101
|
-
resolveString,
|
|
1102
|
-
resolveNumber,
|
|
1103
|
-
resolveBoolean,
|
|
1104
|
-
setValue,
|
|
1105
|
-
getValue,
|
|
1106
|
-
sendAction,
|
|
1107
|
-
getUniqueId
|
|
1108
|
-
]);
|
|
1109
|
-
}
|
|
690
|
+
const Divider = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.DividerApi, ({ props }) => {
|
|
691
|
+
const isVertical = props.axis === "vertical";
|
|
692
|
+
const style = {
|
|
693
|
+
margin: LEAF_MARGIN,
|
|
694
|
+
border: "none",
|
|
695
|
+
backgroundColor: "#ccc"
|
|
696
|
+
};
|
|
697
|
+
if (isVertical) {
|
|
698
|
+
style.width = "1px";
|
|
699
|
+
style.height = "100%";
|
|
700
|
+
} else {
|
|
701
|
+
style.width = "100%";
|
|
702
|
+
style.height = "1px";
|
|
703
|
+
}
|
|
704
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style });
|
|
705
|
+
});
|
|
1110
706
|
|
|
1111
707
|
//#endregion
|
|
1112
|
-
//#region src/react-renderer/components/
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
*
|
|
1127
|
-
* Uses synchronous import to ensure availability at first render (matches Lit renderer).
|
|
1128
|
-
*
|
|
1129
|
-
* Configuration matches Lit's markdown directive (uses MarkdownIt defaults):
|
|
1130
|
-
* - html: false (default) - Security: disable raw HTML
|
|
1131
|
-
* - linkify: false (default) - Don't auto-convert URLs/emails to links
|
|
1132
|
-
* - breaks: false (default) - Don't convert \n to <br>
|
|
1133
|
-
* - typographer: false (default) - Don't use smart quotes/dashes
|
|
708
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Modal.tsx
|
|
709
|
+
/**
|
|
710
|
+
* Copyright 2026 Google LLC
|
|
711
|
+
*
|
|
712
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
713
|
+
* you may not use this file except in compliance with the License.
|
|
714
|
+
* You may obtain a copy of the License at
|
|
715
|
+
*
|
|
716
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
717
|
+
*
|
|
718
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
719
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
720
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
721
|
+
* See the License for the specific language governing permissions and
|
|
722
|
+
* limitations under the License.
|
|
1134
723
|
*/
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
724
|
+
const Modal = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ModalApi, ({ props, buildChild }) => {
|
|
725
|
+
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
726
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
727
|
+
onClick: () => setIsOpen(true),
|
|
728
|
+
style: { display: "inline-block" },
|
|
729
|
+
children: props.trigger ? buildChild(props.trigger) : null
|
|
730
|
+
}), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
731
|
+
style: {
|
|
732
|
+
position: "fixed",
|
|
733
|
+
top: 0,
|
|
734
|
+
left: 0,
|
|
735
|
+
right: 0,
|
|
736
|
+
bottom: 0,
|
|
737
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
738
|
+
display: "flex",
|
|
739
|
+
alignItems: "center",
|
|
740
|
+
justifyContent: "center",
|
|
741
|
+
zIndex: 1e3
|
|
742
|
+
},
|
|
743
|
+
onClick: () => setIsOpen(false),
|
|
744
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
745
|
+
style: {
|
|
746
|
+
backgroundColor: "#fff",
|
|
747
|
+
padding: "24px",
|
|
748
|
+
borderRadius: "8px",
|
|
749
|
+
maxWidth: "90%",
|
|
750
|
+
maxHeight: "90%",
|
|
751
|
+
overflow: "auto",
|
|
752
|
+
display: "flex",
|
|
753
|
+
flexDirection: "column"
|
|
754
|
+
},
|
|
755
|
+
onClick: (e) => e.stopPropagation(),
|
|
756
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
757
|
+
style: {
|
|
758
|
+
display: "flex",
|
|
759
|
+
justifyContent: "flex-end"
|
|
760
|
+
},
|
|
761
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
762
|
+
onClick: () => setIsOpen(false),
|
|
763
|
+
style: {
|
|
764
|
+
border: "none",
|
|
765
|
+
background: "none",
|
|
766
|
+
fontSize: "20px",
|
|
767
|
+
cursor: "pointer",
|
|
768
|
+
padding: "4px"
|
|
769
|
+
},
|
|
770
|
+
children: "×"
|
|
771
|
+
})
|
|
772
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
773
|
+
style: { flex: 1 },
|
|
774
|
+
children: props.content ? buildChild(props.content) : null
|
|
775
|
+
})]
|
|
776
|
+
})
|
|
777
|
+
})] });
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
//#endregion
|
|
781
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Button.tsx
|
|
782
|
+
/**
|
|
783
|
+
* Copyright 2026 Google LLC
|
|
784
|
+
*
|
|
785
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
786
|
+
* you may not use this file except in compliance with the License.
|
|
787
|
+
* You may obtain a copy of the License at
|
|
788
|
+
*
|
|
789
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
790
|
+
*
|
|
791
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
792
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
793
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
794
|
+
* See the License for the specific language governing permissions and
|
|
795
|
+
* limitations under the License.
|
|
1139
796
|
*/
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
797
|
+
const Button$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ButtonApi, ({ props, buildChild }) => {
|
|
798
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
799
|
+
style: {
|
|
800
|
+
margin: LEAF_MARGIN,
|
|
801
|
+
padding: "8px 16px",
|
|
802
|
+
cursor: "pointer",
|
|
803
|
+
border: props.variant === "borderless" ? "none" : "1px solid #ccc",
|
|
804
|
+
backgroundColor: props.variant === "primary" ? "var(--a2ui-primary-color, #007bff)" : props.variant === "borderless" ? "transparent" : "#fff",
|
|
805
|
+
color: props.variant === "primary" ? "#fff" : "inherit",
|
|
806
|
+
borderRadius: "4px",
|
|
807
|
+
display: "inline-flex",
|
|
808
|
+
alignItems: "center",
|
|
809
|
+
justifyContent: "center",
|
|
810
|
+
boxSizing: "border-box"
|
|
811
|
+
},
|
|
812
|
+
onClick: props.action,
|
|
813
|
+
disabled: props.isValid === false,
|
|
814
|
+
children: props.child ? buildChild(props.child) : null
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/TextField.tsx
|
|
820
|
+
/**
|
|
821
|
+
* Copyright 2026 Google LLC
|
|
822
|
+
*
|
|
823
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
824
|
+
* you may not use this file except in compliance with the License.
|
|
825
|
+
* You may obtain a copy of the License at
|
|
826
|
+
*
|
|
827
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
828
|
+
*
|
|
829
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
830
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
831
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
832
|
+
* See the License for the specific language governing permissions and
|
|
833
|
+
* limitations under the License.
|
|
1176
834
|
*/
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1182
|
-
const
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
835
|
+
const TextField$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TextFieldApi, ({ props }) => {
|
|
836
|
+
const onChange = (e) => {
|
|
837
|
+
props.setValue(e.target.value);
|
|
838
|
+
};
|
|
839
|
+
const isLong = props.variant === "longText";
|
|
840
|
+
const type = props.variant === "number" ? "number" : props.variant === "obscured" ? "password" : "text";
|
|
841
|
+
const style = {
|
|
842
|
+
padding: "8px",
|
|
843
|
+
width: "100%",
|
|
844
|
+
border: STANDARD_BORDER,
|
|
845
|
+
borderRadius: STANDARD_RADIUS,
|
|
846
|
+
boxSizing: "border-box"
|
|
847
|
+
};
|
|
848
|
+
const uniqueId = react.default.useId();
|
|
849
|
+
const hasError = props.validationErrors && props.validationErrors.length > 0;
|
|
850
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
851
|
+
style: {
|
|
852
|
+
display: "flex",
|
|
853
|
+
flexDirection: "column",
|
|
854
|
+
gap: "4px",
|
|
855
|
+
width: "100%",
|
|
856
|
+
margin: LEAF_MARGIN
|
|
857
|
+
},
|
|
858
|
+
children: [
|
|
859
|
+
props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
860
|
+
htmlFor: uniqueId,
|
|
861
|
+
style: {
|
|
862
|
+
fontSize: "14px",
|
|
863
|
+
fontWeight: "bold"
|
|
864
|
+
},
|
|
865
|
+
children: props.label
|
|
866
|
+
}),
|
|
867
|
+
isLong ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
868
|
+
id: uniqueId,
|
|
869
|
+
style: {
|
|
870
|
+
...style,
|
|
871
|
+
border: hasError ? "1px solid red" : STANDARD_BORDER
|
|
872
|
+
},
|
|
873
|
+
value: props.value || "",
|
|
874
|
+
onChange
|
|
875
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
876
|
+
id: uniqueId,
|
|
877
|
+
type,
|
|
878
|
+
style: {
|
|
879
|
+
...style,
|
|
880
|
+
border: hasError ? "1px solid red" : STANDARD_BORDER
|
|
881
|
+
},
|
|
882
|
+
value: props.value || "",
|
|
883
|
+
onChange
|
|
884
|
+
}),
|
|
885
|
+
hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
886
|
+
style: {
|
|
887
|
+
fontSize: "12px",
|
|
888
|
+
color: "red"
|
|
889
|
+
},
|
|
890
|
+
children: props.validationErrors[0]
|
|
891
|
+
})
|
|
892
|
+
]
|
|
1230
893
|
});
|
|
1231
894
|
});
|
|
1232
895
|
|
|
1233
896
|
//#endregion
|
|
1234
|
-
//#region src/react-renderer/components/
|
|
897
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/CheckBox.tsx
|
|
1235
898
|
/**
|
|
1236
|
-
*
|
|
899
|
+
* Copyright 2026 Google LLC
|
|
1237
900
|
*
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
901
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
902
|
+
* you may not use this file except in compliance with the License.
|
|
903
|
+
* You may obtain a copy of the License at
|
|
904
|
+
*
|
|
905
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
906
|
+
*
|
|
907
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
908
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
909
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
910
|
+
* See the License for the specific language governing permissions and
|
|
911
|
+
* limitations under the License.
|
|
1240
912
|
*/
|
|
1241
|
-
const
|
|
1242
|
-
var
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
const rawUrl = resolveString(props.url);
|
|
1246
|
-
const url = rawUrl === null || rawUrl === void 0 ? void 0 : rawUrl.replace("//via.placeholder.com/", "//placehold.co/");
|
|
1247
|
-
const usageHint = props.usageHint;
|
|
1248
|
-
const fit = (_ref = props.fit) !== null && _ref !== void 0 ? _ref : "fill";
|
|
1249
|
-
const classes = mergeClassMaps(theme.components.Image.all, usageHint ? theme.components.Image[usageHint] : {});
|
|
1250
|
-
const style = {
|
|
1251
|
-
...stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Image),
|
|
1252
|
-
"--object-fit": fit
|
|
913
|
+
const CheckBox = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.CheckBoxApi, ({ props }) => {
|
|
914
|
+
var _props$validationErro;
|
|
915
|
+
const onChange = (e) => {
|
|
916
|
+
props.setValue(e.target.checked);
|
|
1253
917
|
};
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
style:
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
918
|
+
const uniqueId = react.default.useId();
|
|
919
|
+
const hasError = props.validationErrors && props.validationErrors.length > 0;
|
|
920
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
921
|
+
style: {
|
|
922
|
+
display: "flex",
|
|
923
|
+
flexDirection: "column",
|
|
924
|
+
margin: LEAF_MARGIN
|
|
925
|
+
},
|
|
926
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
927
|
+
style: {
|
|
928
|
+
display: "flex",
|
|
929
|
+
alignItems: "center",
|
|
930
|
+
gap: "8px"
|
|
931
|
+
},
|
|
932
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
933
|
+
id: uniqueId,
|
|
934
|
+
type: "checkbox",
|
|
935
|
+
checked: !!props.value,
|
|
936
|
+
onChange,
|
|
937
|
+
style: {
|
|
938
|
+
cursor: "pointer",
|
|
939
|
+
outline: hasError ? "1px solid red" : "none"
|
|
940
|
+
}
|
|
941
|
+
}), props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
942
|
+
htmlFor: uniqueId,
|
|
943
|
+
style: {
|
|
944
|
+
cursor: "pointer",
|
|
945
|
+
color: hasError ? "red" : "inherit"
|
|
946
|
+
},
|
|
947
|
+
children: props.label
|
|
948
|
+
})]
|
|
949
|
+
}), hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
950
|
+
style: {
|
|
951
|
+
fontSize: "12px",
|
|
952
|
+
color: "red",
|
|
953
|
+
marginTop: "4px"
|
|
954
|
+
},
|
|
955
|
+
children: (_props$validationErro = props.validationErrors) === null || _props$validationErro === void 0 ? void 0 : _props$validationErro[0]
|
|
956
|
+
})]
|
|
1266
957
|
});
|
|
1267
958
|
});
|
|
1268
959
|
|
|
1269
960
|
//#endregion
|
|
1270
|
-
//#region src/react-renderer/components/
|
|
961
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.tsx
|
|
1271
962
|
/**
|
|
1272
|
-
*
|
|
1273
|
-
* e.g., "shoppingCart" -> "shopping_cart"
|
|
1274
|
-
* This matches the Lit renderer's approach.
|
|
1275
|
-
*/
|
|
1276
|
-
function toSnakeCase(str) {
|
|
1277
|
-
return str.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
1278
|
-
}
|
|
1279
|
-
/**
|
|
1280
|
-
* Icon component - renders an icon using Material Symbols Outlined font.
|
|
963
|
+
* Copyright 2026 Google LLC
|
|
1281
964
|
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
965
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
966
|
+
* you may not use this file except in compliance with the License.
|
|
967
|
+
* You may obtain a copy of the License at
|
|
1284
968
|
*
|
|
1285
|
-
*
|
|
1286
|
-
*
|
|
1287
|
-
*
|
|
1288
|
-
*
|
|
969
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
970
|
+
*
|
|
971
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
972
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
973
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
|
+
* See the License for the specific language governing permissions and
|
|
975
|
+
* limitations under the License.
|
|
1289
976
|
*/
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
const
|
|
1293
|
-
const
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
977
|
+
const ChoicePicker = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ChoicePickerApi, ({ props, context }) => {
|
|
978
|
+
const [filter, setFilter] = (0, react.useState)("");
|
|
979
|
+
const values = Array.isArray(props.value) ? props.value : [];
|
|
980
|
+
const isMutuallyExclusive = props.variant === "mutuallyExclusive";
|
|
981
|
+
const onToggle = (val) => {
|
|
982
|
+
if (isMutuallyExclusive) props.setValue([val]);
|
|
983
|
+
else {
|
|
984
|
+
const newValues = values.includes(val) ? values.filter((v) => v !== val) : [...values, val];
|
|
985
|
+
props.setValue(newValues);
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
const options = (props.options || []).filter((opt) => !props.filterable || filter === "" || String(opt.label).toLowerCase().includes(filter.toLowerCase()));
|
|
989
|
+
const containerStyle = {
|
|
990
|
+
display: "flex",
|
|
991
|
+
flexDirection: "column",
|
|
992
|
+
gap: "8px",
|
|
993
|
+
margin: LEAF_MARGIN,
|
|
994
|
+
width: "100%"
|
|
995
|
+
};
|
|
996
|
+
const listStyle = {
|
|
997
|
+
display: "flex",
|
|
998
|
+
flexDirection: props.displayStyle === "chips" ? "row" : "column",
|
|
999
|
+
flexWrap: props.displayStyle === "chips" ? "wrap" : "nowrap",
|
|
1000
|
+
gap: "8px"
|
|
1001
|
+
};
|
|
1002
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1003
|
+
style: containerStyle,
|
|
1004
|
+
children: [
|
|
1005
|
+
props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
1006
|
+
style: { fontSize: "14px" },
|
|
1007
|
+
children: props.label
|
|
1008
|
+
}),
|
|
1009
|
+
props.filterable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1010
|
+
type: "text",
|
|
1011
|
+
placeholder: "Filter options...",
|
|
1012
|
+
value: filter,
|
|
1013
|
+
onChange: (e) => setFilter(e.target.value),
|
|
1014
|
+
style: {
|
|
1015
|
+
padding: "4px 8px",
|
|
1016
|
+
border: STANDARD_BORDER,
|
|
1017
|
+
borderRadius: STANDARD_RADIUS
|
|
1018
|
+
}
|
|
1019
|
+
}),
|
|
1020
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1021
|
+
style: listStyle,
|
|
1022
|
+
children: options.map((opt, i) => {
|
|
1023
|
+
const isSelected = values.includes(opt.value);
|
|
1024
|
+
if (props.displayStyle === "chips") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1025
|
+
onClick: () => onToggle(opt.value),
|
|
1026
|
+
style: {
|
|
1027
|
+
padding: "4px 12px",
|
|
1028
|
+
borderRadius: "16px",
|
|
1029
|
+
border: isSelected ? "1px solid var(--a2ui-primary-color, #007bff)" : STANDARD_BORDER,
|
|
1030
|
+
backgroundColor: isSelected ? "var(--a2ui-primary-color, #007bff)" : "#fff",
|
|
1031
|
+
color: isSelected ? "#fff" : "inherit",
|
|
1032
|
+
cursor: "pointer",
|
|
1033
|
+
fontSize: "12px"
|
|
1034
|
+
},
|
|
1035
|
+
children: opt.label
|
|
1036
|
+
}, i);
|
|
1037
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1038
|
+
style: {
|
|
1039
|
+
display: "flex",
|
|
1040
|
+
alignItems: "center",
|
|
1041
|
+
gap: "8px",
|
|
1042
|
+
cursor: "pointer"
|
|
1043
|
+
},
|
|
1044
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1045
|
+
type: isMutuallyExclusive ? "radio" : "checkbox",
|
|
1046
|
+
checked: isSelected,
|
|
1047
|
+
onChange: () => onToggle(opt.value),
|
|
1048
|
+
name: isMutuallyExclusive ? `choice-${context.componentModel.id}` : void 0
|
|
1049
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1050
|
+
style: { fontSize: "14px" },
|
|
1051
|
+
children: opt.label
|
|
1052
|
+
})]
|
|
1053
|
+
}, i);
|
|
1054
|
+
})
|
|
1306
1055
|
})
|
|
1307
|
-
|
|
1056
|
+
]
|
|
1308
1057
|
});
|
|
1309
1058
|
});
|
|
1310
1059
|
|
|
1311
1060
|
//#endregion
|
|
1312
|
-
//#region src/react-renderer/components/
|
|
1061
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Slider.tsx
|
|
1313
1062
|
/**
|
|
1314
|
-
*
|
|
1063
|
+
* Copyright 2026 Google LLC
|
|
1064
|
+
*
|
|
1065
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1066
|
+
* you may not use this file except in compliance with the License.
|
|
1067
|
+
* You may obtain a copy of the License at
|
|
1315
1068
|
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1069
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1070
|
+
*
|
|
1071
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1072
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1073
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1074
|
+
* See the License for the specific language governing permissions and
|
|
1075
|
+
* limitations under the License.
|
|
1320
1076
|
*/
|
|
1321
|
-
const
|
|
1322
|
-
var
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1077
|
+
const Slider = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.SliderApi, ({ props }) => {
|
|
1078
|
+
var _props$min, _props$value;
|
|
1079
|
+
const onChange = (e) => {
|
|
1080
|
+
props.setValue(Number(e.target.value));
|
|
1081
|
+
};
|
|
1082
|
+
const uniqueId = react.default.useId();
|
|
1083
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1084
|
+
style: {
|
|
1085
|
+
display: "flex",
|
|
1086
|
+
flexDirection: "column",
|
|
1087
|
+
gap: "4px",
|
|
1088
|
+
margin: LEAF_MARGIN,
|
|
1089
|
+
width: "100%"
|
|
1090
|
+
},
|
|
1091
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1092
|
+
style: {
|
|
1093
|
+
display: "flex",
|
|
1094
|
+
justifyContent: "space-between"
|
|
1095
|
+
},
|
|
1096
|
+
children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1097
|
+
htmlFor: uniqueId,
|
|
1098
|
+
style: {
|
|
1099
|
+
fontSize: "14px",
|
|
1100
|
+
fontWeight: "bold"
|
|
1101
|
+
},
|
|
1102
|
+
children: props.label
|
|
1103
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1104
|
+
style: {
|
|
1105
|
+
fontSize: "12px",
|
|
1106
|
+
color: "#666"
|
|
1107
|
+
},
|
|
1108
|
+
children: props.value
|
|
1109
|
+
})]
|
|
1110
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1111
|
+
id: uniqueId,
|
|
1112
|
+
type: "range",
|
|
1113
|
+
min: (_props$min = props.min) !== null && _props$min !== void 0 ? _props$min : 0,
|
|
1114
|
+
max: props.max,
|
|
1115
|
+
value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : 0,
|
|
1116
|
+
onChange,
|
|
1117
|
+
style: {
|
|
1118
|
+
width: "100%",
|
|
1119
|
+
cursor: "pointer"
|
|
1120
|
+
}
|
|
1121
|
+
})]
|
|
1331
1122
|
});
|
|
1332
1123
|
});
|
|
1333
1124
|
|
|
1334
1125
|
//#endregion
|
|
1335
|
-
//#region src/react-renderer/components/
|
|
1126
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.tsx
|
|
1336
1127
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
*/
|
|
1339
|
-
function getYouTubeVideoId(url) {
|
|
1340
|
-
for (const pattern of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\s?]+)/]) {
|
|
1341
|
-
const match = url.match(pattern);
|
|
1342
|
-
if (match && match.length > 1) return match[1];
|
|
1343
|
-
}
|
|
1344
|
-
return null;
|
|
1345
|
-
}
|
|
1346
|
-
/**
|
|
1347
|
-
* Video component - renders a video player.
|
|
1128
|
+
* Copyright 2026 Google LLC
|
|
1348
1129
|
*
|
|
1349
|
-
*
|
|
1130
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1131
|
+
* you may not use this file except in compliance with the License.
|
|
1132
|
+
* You may obtain a copy of the License at
|
|
1133
|
+
*
|
|
1134
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1135
|
+
*
|
|
1136
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
|
+
* See the License for the specific language governing permissions and
|
|
1140
|
+
* limitations under the License.
|
|
1350
1141
|
*/
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1142
|
+
const DateTimeInput = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.DateTimeInputApi, ({ props }) => {
|
|
1143
|
+
const onChange = (e) => {
|
|
1144
|
+
props.setValue(e.target.value);
|
|
1145
|
+
};
|
|
1146
|
+
const uniqueId = react.default.useId();
|
|
1147
|
+
let type = "datetime-local";
|
|
1148
|
+
if (props.enableDate && !props.enableTime) type = "date";
|
|
1149
|
+
if (!props.enableDate && props.enableTime) type = "time";
|
|
1150
|
+
const style = {
|
|
1151
|
+
padding: "8px",
|
|
1152
|
+
width: "100%",
|
|
1153
|
+
border: STANDARD_BORDER,
|
|
1154
|
+
borderRadius: STANDARD_RADIUS,
|
|
1155
|
+
boxSizing: "border-box"
|
|
1156
|
+
};
|
|
1157
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1158
|
+
style: {
|
|
1159
|
+
display: "flex",
|
|
1160
|
+
flexDirection: "column",
|
|
1161
|
+
gap: "4px",
|
|
1162
|
+
width: "100%",
|
|
1163
|
+
margin: LEAF_MARGIN
|
|
1164
|
+
},
|
|
1165
|
+
children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1166
|
+
htmlFor: uniqueId,
|
|
1167
|
+
style: {
|
|
1168
|
+
fontSize: "14px",
|
|
1169
|
+
fontWeight: "bold"
|
|
1170
|
+
},
|
|
1171
|
+
children: props.label
|
|
1172
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1173
|
+
id: uniqueId,
|
|
1174
|
+
type,
|
|
1175
|
+
style,
|
|
1176
|
+
value: props.value || "",
|
|
1177
|
+
onChange,
|
|
1178
|
+
min: typeof props.min === "string" ? props.min : void 0,
|
|
1179
|
+
max: typeof props.max === "string" ? props.max : void 0
|
|
1180
|
+
})]
|
|
1379
1181
|
});
|
|
1380
1182
|
});
|
|
1381
1183
|
|
|
1382
1184
|
//#endregion
|
|
1383
|
-
//#region src/react-renderer/
|
|
1185
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/index.ts
|
|
1384
1186
|
/**
|
|
1385
|
-
*
|
|
1187
|
+
* Copyright 2026 Google LLC
|
|
1188
|
+
*
|
|
1189
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1190
|
+
* you may not use this file except in compliance with the License.
|
|
1191
|
+
* You may obtain a copy of the License at
|
|
1192
|
+
*
|
|
1193
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1194
|
+
*
|
|
1195
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1196
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1197
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1198
|
+
* See the License for the specific language governing permissions and
|
|
1199
|
+
* limitations under the License.
|
|
1386
1200
|
*/
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1201
|
+
const basicComponents = [
|
|
1202
|
+
Text$1,
|
|
1203
|
+
Image,
|
|
1204
|
+
Icon,
|
|
1205
|
+
Video,
|
|
1206
|
+
AudioPlayer,
|
|
1207
|
+
Row$1,
|
|
1208
|
+
Column$1,
|
|
1209
|
+
List,
|
|
1210
|
+
Card,
|
|
1211
|
+
Tabs,
|
|
1212
|
+
Divider,
|
|
1213
|
+
Modal,
|
|
1214
|
+
Button$1,
|
|
1215
|
+
TextField$1,
|
|
1216
|
+
CheckBox,
|
|
1217
|
+
ChoicePicker,
|
|
1218
|
+
Slider,
|
|
1219
|
+
DateTimeInput
|
|
1220
|
+
];
|
|
1221
|
+
const basicCatalog = new _a2ui_web_core_v0_9.Catalog("https://a2ui.org/specification/v0_9/basic_catalog.json", basicComponents, _a2ui_web_core_v0_9_basic_catalog.BASIC_FUNCTIONS);
|
|
1407
1222
|
|
|
1408
1223
|
//#endregion
|
|
1409
|
-
//#region src/react-renderer/components/
|
|
1224
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/Text.tsx
|
|
1410
1225
|
/**
|
|
1411
|
-
*
|
|
1226
|
+
* Copyright 2026 Google LLC
|
|
1412
1227
|
*
|
|
1413
|
-
*
|
|
1228
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1229
|
+
* you may not use this file except in compliance with the License.
|
|
1230
|
+
* You may obtain a copy of the License at
|
|
1231
|
+
*
|
|
1232
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1233
|
+
*
|
|
1234
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1235
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1236
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1237
|
+
* See the License for the specific language governing permissions and
|
|
1238
|
+
* limitations under the License.
|
|
1414
1239
|
*/
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
})
|
|
1439
|
-
|
|
1240
|
+
const TextSchema = zod.z.object({
|
|
1241
|
+
text: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
|
|
1242
|
+
variant: zod.z.enum([
|
|
1243
|
+
"h1",
|
|
1244
|
+
"h2",
|
|
1245
|
+
"h3",
|
|
1246
|
+
"h4",
|
|
1247
|
+
"h5",
|
|
1248
|
+
"caption",
|
|
1249
|
+
"body"
|
|
1250
|
+
]).optional()
|
|
1251
|
+
});
|
|
1252
|
+
const TextApiDef = {
|
|
1253
|
+
name: "Text",
|
|
1254
|
+
schema: TextSchema
|
|
1255
|
+
};
|
|
1256
|
+
const Text = createReactComponent(TextApiDef, ({ props }) => {
|
|
1257
|
+
var _props$text;
|
|
1258
|
+
const text = (_props$text = props.text) !== null && _props$text !== void 0 ? _props$text : "";
|
|
1259
|
+
switch (props.variant) {
|
|
1260
|
+
case "h1": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", { children: text });
|
|
1261
|
+
case "h2": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: text });
|
|
1262
|
+
case "h3": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: text });
|
|
1263
|
+
case "h4": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", { children: text });
|
|
1264
|
+
case "h5": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: text });
|
|
1265
|
+
case "caption": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: text });
|
|
1266
|
+
default: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text });
|
|
1267
|
+
}
|
|
1440
1268
|
});
|
|
1441
1269
|
|
|
1442
1270
|
//#endregion
|
|
1443
|
-
//#region src/react-renderer/components/
|
|
1271
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/Button.tsx
|
|
1444
1272
|
/**
|
|
1445
|
-
*
|
|
1273
|
+
* Copyright 2026 Google LLC
|
|
1446
1274
|
*
|
|
1447
|
-
*
|
|
1275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1276
|
+
* you may not use this file except in compliance with the License.
|
|
1277
|
+
* You may obtain a copy of the License at
|
|
1278
|
+
*
|
|
1279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1280
|
+
*
|
|
1281
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1284
|
+
* See the License for the specific language governing permissions and
|
|
1285
|
+
* limitations under the License.
|
|
1448
1286
|
*/
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
}, childId);
|
|
1471
|
-
})
|
|
1472
|
-
})
|
|
1287
|
+
const ButtonSchema = zod.z.object({
|
|
1288
|
+
child: _a2ui_web_core_v0_9.CommonSchemas.ComponentId,
|
|
1289
|
+
action: _a2ui_web_core_v0_9.CommonSchemas.Action,
|
|
1290
|
+
variant: zod.z.enum(["primary", "borderless"]).optional()
|
|
1291
|
+
});
|
|
1292
|
+
const ButtonApiDef = {
|
|
1293
|
+
name: "Button",
|
|
1294
|
+
schema: ButtonSchema
|
|
1295
|
+
};
|
|
1296
|
+
const Button = createReactComponent(ButtonApiDef, ({ props, buildChild }) => {
|
|
1297
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1298
|
+
style: {
|
|
1299
|
+
padding: "8px 16px",
|
|
1300
|
+
cursor: "pointer",
|
|
1301
|
+
border: props.variant === "borderless" ? "none" : "1px solid #ccc",
|
|
1302
|
+
backgroundColor: props.variant === "primary" ? "#007bff" : "transparent",
|
|
1303
|
+
color: props.variant === "primary" ? "#fff" : "inherit",
|
|
1304
|
+
borderRadius: "4px"
|
|
1305
|
+
},
|
|
1306
|
+
onClick: props.action,
|
|
1307
|
+
children: props.child ? buildChild(props.child) : null
|
|
1473
1308
|
});
|
|
1474
1309
|
});
|
|
1475
1310
|
|
|
1476
1311
|
//#endregion
|
|
1477
|
-
//#region src/react-renderer/components/
|
|
1312
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/ChildList.tsx
|
|
1478
1313
|
/**
|
|
1479
|
-
*
|
|
1314
|
+
* Copyright 2026 Google LLC
|
|
1315
|
+
*
|
|
1316
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1317
|
+
* you may not use this file except in compliance with the License.
|
|
1318
|
+
* You may obtain a copy of the License at
|
|
1319
|
+
*
|
|
1320
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1480
1321
|
*
|
|
1481
|
-
*
|
|
1322
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1323
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1324
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1325
|
+
* See the License for the specific language governing permissions and
|
|
1326
|
+
* limitations under the License.
|
|
1482
1327
|
*/
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
1495
|
-
className: classMapToString(theme.components.List),
|
|
1496
|
-
style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.List),
|
|
1497
|
-
children: children.map((child, index) => {
|
|
1498
|
-
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
1499
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
|
|
1500
|
-
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
1501
|
-
surfaceId
|
|
1502
|
-
}, childId);
|
|
1503
|
-
})
|
|
1504
|
-
})
|
|
1505
|
-
});
|
|
1506
|
-
});
|
|
1328
|
+
const ChildList = ({ childList, buildChild }) => {
|
|
1329
|
+
if (Array.isArray(childList)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: childList.map((item, i) => {
|
|
1330
|
+
if (item && typeof item === "object" && "id" in item) {
|
|
1331
|
+
const node = item;
|
|
1332
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(node.id, node.basePath) }, `${node.id}-${i}`);
|
|
1333
|
+
}
|
|
1334
|
+
if (typeof item === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(item) }, `${item}-${i}`);
|
|
1335
|
+
return null;
|
|
1336
|
+
}) });
|
|
1337
|
+
return null;
|
|
1338
|
+
};
|
|
1507
1339
|
|
|
1508
1340
|
//#endregion
|
|
1509
|
-
//#region src/react-renderer/components/
|
|
1341
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/Row.tsx
|
|
1510
1342
|
/**
|
|
1511
|
-
*
|
|
1343
|
+
* Copyright 2026 Google LLC
|
|
1344
|
+
*
|
|
1345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1346
|
+
* you may not use this file except in compliance with the License.
|
|
1347
|
+
* You may obtain a copy of the License at
|
|
1512
1348
|
*
|
|
1513
|
-
*
|
|
1514
|
-
* <div class="a2ui-card"> ← :host equivalent
|
|
1515
|
-
* <section class="..."> ← theme classes (border, padding, background)
|
|
1516
|
-
* {children} ← ::slotted(*) equivalent
|
|
1517
|
-
* </section>
|
|
1518
|
-
* </div>
|
|
1349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1519
1350
|
*
|
|
1520
|
-
*
|
|
1351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1354
|
+
* See the License for the specific language governing permissions and
|
|
1355
|
+
* limitations under the License.
|
|
1521
1356
|
*/
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1357
|
+
const RowSchema = zod.z.object({
|
|
1358
|
+
children: _a2ui_web_core_v0_9.CommonSchemas.ChildList,
|
|
1359
|
+
justify: zod.z.enum([
|
|
1360
|
+
"center",
|
|
1361
|
+
"end",
|
|
1362
|
+
"spaceAround",
|
|
1363
|
+
"spaceBetween",
|
|
1364
|
+
"spaceEvenly",
|
|
1365
|
+
"start",
|
|
1366
|
+
"stretch"
|
|
1367
|
+
]).optional(),
|
|
1368
|
+
align: zod.z.enum([
|
|
1369
|
+
"start",
|
|
1370
|
+
"center",
|
|
1371
|
+
"end",
|
|
1372
|
+
"stretch"
|
|
1373
|
+
]).optional()
|
|
1374
|
+
});
|
|
1375
|
+
const mapJustify$1 = (j) => {
|
|
1376
|
+
switch (j) {
|
|
1377
|
+
case "center": return "center";
|
|
1378
|
+
case "end": return "flex-end";
|
|
1379
|
+
case "spaceAround": return "space-around";
|
|
1380
|
+
case "spaceBetween": return "space-between";
|
|
1381
|
+
case "spaceEvenly": return "space-evenly";
|
|
1382
|
+
case "start": return "flex-start";
|
|
1383
|
+
case "stretch": return "stretch";
|
|
1384
|
+
default: return "flex-start";
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
const mapAlign$1 = (a) => {
|
|
1388
|
+
switch (a) {
|
|
1389
|
+
case "start": return "flex-start";
|
|
1390
|
+
case "center": return "center";
|
|
1391
|
+
case "end": return "flex-end";
|
|
1392
|
+
case "stretch": return "stretch";
|
|
1393
|
+
default: return "stretch";
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
const RowApiDef = {
|
|
1397
|
+
name: "Row",
|
|
1398
|
+
schema: RowSchema
|
|
1399
|
+
};
|
|
1400
|
+
const Row = createReactComponent(RowApiDef, ({ props, buildChild }) => {
|
|
1528
1401
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
surfaceId
|
|
1539
|
-
}, childId);
|
|
1540
|
-
})
|
|
1402
|
+
style: {
|
|
1403
|
+
display: "flex",
|
|
1404
|
+
flexDirection: "row",
|
|
1405
|
+
justifyContent: mapJustify$1(props.justify),
|
|
1406
|
+
alignItems: mapAlign$1(props.align)
|
|
1407
|
+
},
|
|
1408
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList, {
|
|
1409
|
+
childList: props.children,
|
|
1410
|
+
buildChild
|
|
1541
1411
|
})
|
|
1542
1412
|
});
|
|
1543
1413
|
});
|
|
1544
1414
|
|
|
1545
1415
|
//#endregion
|
|
1546
|
-
//#region src/react-renderer/components/
|
|
1416
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/Column.tsx
|
|
1547
1417
|
/**
|
|
1548
|
-
*
|
|
1418
|
+
* Copyright 2026 Google LLC
|
|
1419
|
+
*
|
|
1420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1421
|
+
* you may not use this file except in compliance with the License.
|
|
1422
|
+
* You may obtain a copy of the License at
|
|
1423
|
+
*
|
|
1424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1425
|
+
*
|
|
1426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1429
|
+
* See the License for the specific language governing permissions and
|
|
1430
|
+
* limitations under the License.
|
|
1549
1431
|
*/
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1432
|
+
const ColumnSchema = zod.z.object({
|
|
1433
|
+
children: _a2ui_web_core_v0_9.CommonSchemas.ChildList,
|
|
1434
|
+
justify: zod.z.enum([
|
|
1435
|
+
"start",
|
|
1436
|
+
"center",
|
|
1437
|
+
"end",
|
|
1438
|
+
"spaceBetween",
|
|
1439
|
+
"spaceAround",
|
|
1440
|
+
"spaceEvenly",
|
|
1441
|
+
"stretch"
|
|
1442
|
+
]).optional(),
|
|
1443
|
+
align: zod.z.enum([
|
|
1444
|
+
"center",
|
|
1445
|
+
"end",
|
|
1446
|
+
"start",
|
|
1447
|
+
"stretch"
|
|
1448
|
+
]).optional()
|
|
1449
|
+
});
|
|
1450
|
+
const mapJustify = (j) => {
|
|
1451
|
+
switch (j) {
|
|
1452
|
+
case "center": return "center";
|
|
1453
|
+
case "end": return "flex-end";
|
|
1454
|
+
case "spaceAround": return "space-around";
|
|
1455
|
+
case "spaceBetween": return "space-between";
|
|
1456
|
+
case "spaceEvenly": return "space-evenly";
|
|
1457
|
+
case "start": return "flex-start";
|
|
1458
|
+
case "stretch": return "stretch";
|
|
1459
|
+
default: return "flex-start";
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
const mapAlign = (a) => {
|
|
1463
|
+
switch (a) {
|
|
1464
|
+
case "start": return "flex-start";
|
|
1465
|
+
case "center": return "center";
|
|
1466
|
+
case "end": return "flex-end";
|
|
1467
|
+
case "stretch": return "stretch";
|
|
1468
|
+
default: return "stretch";
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
const ColumnApiDef = {
|
|
1472
|
+
name: "Column",
|
|
1473
|
+
schema: ColumnSchema
|
|
1474
|
+
};
|
|
1475
|
+
const Column = createReactComponent(ColumnApiDef, ({ props, buildChild }) => {
|
|
1556
1476
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
const isSelected = index === selectedIndex;
|
|
1568
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1569
|
-
disabled: isSelected,
|
|
1570
|
-
className: classMapToString(isSelected ? mergeClassMaps(theme.components.Tabs.controls.all, theme.components.Tabs.controls.selected) : theme.components.Tabs.controls.all),
|
|
1571
|
-
onClick: () => setSelectedIndex(index),
|
|
1572
|
-
children: title
|
|
1573
|
-
}, index);
|
|
1574
|
-
})
|
|
1575
|
-
}), tabItems[selectedIndex] && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
|
|
1576
|
-
node: tabItems[selectedIndex].child,
|
|
1577
|
-
surfaceId
|
|
1578
|
-
})]
|
|
1477
|
+
style: {
|
|
1478
|
+
display: "flex",
|
|
1479
|
+
flexDirection: "column",
|
|
1480
|
+
justifyContent: mapJustify(props.justify),
|
|
1481
|
+
alignItems: mapAlign(props.align),
|
|
1482
|
+
gap: "8px"
|
|
1483
|
+
},
|
|
1484
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList, {
|
|
1485
|
+
childList: props.children,
|
|
1486
|
+
buildChild
|
|
1579
1487
|
})
|
|
1580
1488
|
});
|
|
1581
1489
|
});
|
|
1582
1490
|
|
|
1583
1491
|
//#endregion
|
|
1584
|
-
//#region src/react-renderer/components/
|
|
1492
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/components/TextField.tsx
|
|
1585
1493
|
/**
|
|
1586
|
-
*
|
|
1494
|
+
* Copyright 2026 Google LLC
|
|
1587
1495
|
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1496
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1497
|
+
* you may not use this file except in compliance with the License.
|
|
1498
|
+
* You may obtain a copy of the License at
|
|
1591
1499
|
*
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1500
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1501
|
+
*
|
|
1502
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1503
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1504
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1505
|
+
* See the License for the specific language governing permissions and
|
|
1506
|
+
* limitations under the License.
|
|
1594
1507
|
*/
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
}
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
onClick: closeModal,
|
|
1651
|
-
"aria-label": "Close modal",
|
|
1652
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1653
|
-
className: "g-icon",
|
|
1654
|
-
children: "close"
|
|
1655
|
-
})
|
|
1656
|
-
})
|
|
1657
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
|
|
1658
|
-
node: props.contentChild,
|
|
1659
|
-
surfaceId
|
|
1660
|
-
})]
|
|
1661
|
-
})
|
|
1662
|
-
})
|
|
1508
|
+
const TextFieldSchema = zod.z.object({
|
|
1509
|
+
label: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
|
|
1510
|
+
value: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
|
|
1511
|
+
variant: zod.z.enum([
|
|
1512
|
+
"longText",
|
|
1513
|
+
"number",
|
|
1514
|
+
"shortText",
|
|
1515
|
+
"obscured"
|
|
1516
|
+
]).optional(),
|
|
1517
|
+
validationRegexp: zod.z.string().optional()
|
|
1518
|
+
});
|
|
1519
|
+
const TextFieldApiDef = {
|
|
1520
|
+
name: "TextField",
|
|
1521
|
+
schema: TextFieldSchema
|
|
1522
|
+
};
|
|
1523
|
+
const TextField = createReactComponent(TextFieldApiDef, ({ props, context }) => {
|
|
1524
|
+
const onChange = (e) => {
|
|
1525
|
+
if (props.setValue) props.setValue(e.target.value);
|
|
1526
|
+
};
|
|
1527
|
+
const isLong = props.variant === "longText";
|
|
1528
|
+
const type = props.variant === "number" ? "number" : props.variant === "obscured" ? "password" : "text";
|
|
1529
|
+
const style = {
|
|
1530
|
+
padding: "8px",
|
|
1531
|
+
width: "100%",
|
|
1532
|
+
border: "1px solid #ccc",
|
|
1533
|
+
borderRadius: "4px",
|
|
1534
|
+
boxSizing: "border-box"
|
|
1535
|
+
};
|
|
1536
|
+
const id = `textfield-${context.componentModel.id}`;
|
|
1537
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1538
|
+
style: {
|
|
1539
|
+
display: "flex",
|
|
1540
|
+
flexDirection: "column",
|
|
1541
|
+
gap: "4px",
|
|
1542
|
+
width: "100%"
|
|
1543
|
+
},
|
|
1544
|
+
children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1545
|
+
htmlFor: id,
|
|
1546
|
+
style: {
|
|
1547
|
+
fontSize: "14px",
|
|
1548
|
+
fontWeight: "bold"
|
|
1549
|
+
},
|
|
1550
|
+
children: props.label
|
|
1551
|
+
}), isLong ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1552
|
+
id,
|
|
1553
|
+
style,
|
|
1554
|
+
value: props.value || "",
|
|
1555
|
+
onChange
|
|
1556
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1557
|
+
id,
|
|
1558
|
+
type,
|
|
1559
|
+
style,
|
|
1560
|
+
value: props.value || "",
|
|
1561
|
+
onChange
|
|
1562
|
+
})]
|
|
1663
1563
|
});
|
|
1664
1564
|
});
|
|
1665
1565
|
|
|
1666
1566
|
//#endregion
|
|
1667
|
-
//#region src/react-renderer/
|
|
1567
|
+
//#region src/react-renderer/a2ui-react/catalog/minimal/index.ts
|
|
1668
1568
|
/**
|
|
1669
|
-
*
|
|
1569
|
+
* Copyright 2026 Google LLC
|
|
1570
|
+
*
|
|
1571
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1572
|
+
* you may not use this file except in compliance with the License.
|
|
1573
|
+
* You may obtain a copy of the License at
|
|
1670
1574
|
*
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1575
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1576
|
+
*
|
|
1577
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1578
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1579
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1580
|
+
* See the License for the specific language governing permissions and
|
|
1581
|
+
* limitations under the License.
|
|
1673
1582
|
*/
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1583
|
+
const minimalComponents = [
|
|
1584
|
+
Text,
|
|
1585
|
+
Button,
|
|
1586
|
+
Row,
|
|
1587
|
+
Column,
|
|
1588
|
+
TextField
|
|
1589
|
+
];
|
|
1590
|
+
const minimalCatalog = new _a2ui_web_core_v0_9.Catalog("https://a2ui.org/specification/v0_9/catalogs/minimal/minimal_catalog.json", minimalComponents, [(0, _a2ui_web_core_v0_9.createFunctionImplementation)({
|
|
1591
|
+
name: "capitalize",
|
|
1592
|
+
returnType: "string",
|
|
1593
|
+
schema: zod.z.object({ value: zod.z.unknown() })
|
|
1594
|
+
}, (args) => {
|
|
1595
|
+
const val = args.value;
|
|
1596
|
+
if (typeof val === "string") return val.toUpperCase();
|
|
1597
|
+
return val;
|
|
1598
|
+
})]);
|
|
1599
|
+
|
|
1600
|
+
//#endregion
|
|
1601
|
+
//#region src/react-renderer/theme/ThemeContext.tsx
|
|
1602
|
+
/** React context for the A2UI theme. */
|
|
1603
|
+
const ThemeContext = (0, react.createContext)(void 0);
|
|
1604
|
+
function ThemeProvider({ theme, children }) {
|
|
1605
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
|
|
1606
|
+
value: theme !== null && theme !== void 0 ? theme : {},
|
|
1607
|
+
children
|
|
1693
1608
|
});
|
|
1694
|
-
}
|
|
1609
|
+
}
|
|
1610
|
+
function useTheme() {
|
|
1611
|
+
const theme = (0, react.useContext)(ThemeContext);
|
|
1612
|
+
if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
|
|
1613
|
+
return theme;
|
|
1614
|
+
}
|
|
1615
|
+
function useThemeOptional() {
|
|
1616
|
+
return (0, react.useContext)(ThemeContext);
|
|
1617
|
+
}
|
|
1695
1618
|
|
|
1696
1619
|
//#endregion
|
|
1697
|
-
//#region src/react-renderer/
|
|
1620
|
+
//#region src/react-renderer/core/A2UIProvider.tsx
|
|
1698
1621
|
/**
|
|
1699
|
-
*
|
|
1700
|
-
|
|
1701
|
-
|
|
1622
|
+
* Context for stable actions (never changes reference, prevents re-renders).
|
|
1623
|
+
*/
|
|
1624
|
+
const A2UIActionsContext = (0, react.createContext)(null);
|
|
1625
|
+
/**
|
|
1626
|
+
* Context for reactive state (changes trigger re-renders).
|
|
1627
|
+
*/
|
|
1628
|
+
const A2UIStateContext = (0, react.createContext)(null);
|
|
1629
|
+
/**
|
|
1630
|
+
* Provider component that sets up the A2UI v0.9 context for descendant components.
|
|
1631
|
+
* Uses a two-context architecture for performance:
|
|
1632
|
+
* - A2UIActionsContext: Stable actions that never change (no re-renders)
|
|
1633
|
+
* - A2UIStateContext: Reactive state that triggers re-renders when needed
|
|
1702
1634
|
*/
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
if (externalValue !== null && String(externalValue) !== value) setLocalValue(String(externalValue));
|
|
1635
|
+
function A2UIProvider({ onAction, theme, catalog, children }) {
|
|
1636
|
+
const onActionRef = (0, react.useRef)(onAction !== null && onAction !== void 0 ? onAction : null);
|
|
1637
|
+
onActionRef.current = onAction !== null && onAction !== void 0 ? onAction : null;
|
|
1638
|
+
const processorRef = (0, react.useRef)(null);
|
|
1639
|
+
if (!processorRef.current) processorRef.current = new _a2ui_web_core_v0_9.MessageProcessor([catalog !== null && catalog !== void 0 ? catalog : basicCatalog], (action) => {
|
|
1640
|
+
if (onActionRef.current) {
|
|
1641
|
+
var _action$name, _action$surfaceId, _action$timestamp;
|
|
1642
|
+
const message = { userAction: {
|
|
1643
|
+
name: (_action$name = action === null || action === void 0 ? void 0 : action.name) !== null && _action$name !== void 0 ? _action$name : "unknown",
|
|
1644
|
+
surfaceId: (_action$surfaceId = action === null || action === void 0 ? void 0 : action.surfaceId) !== null && _action$surfaceId !== void 0 ? _action$surfaceId : "default",
|
|
1645
|
+
sourceComponentId: action === null || action === void 0 ? void 0 : action.sourceComponentId,
|
|
1646
|
+
context: action === null || action === void 0 ? void 0 : action.context,
|
|
1647
|
+
timestamp: (_action$timestamp = action === null || action === void 0 ? void 0 : action.timestamp) !== null && _action$timestamp !== void 0 ? _action$timestamp : (/* @__PURE__ */ new Date()).toISOString()
|
|
1648
|
+
} };
|
|
1649
|
+
onActionRef.current(message);
|
|
1719
1650
|
}
|
|
1720
|
-
}
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1651
|
+
});
|
|
1652
|
+
const processor = processorRef.current;
|
|
1653
|
+
const [version, setVersion] = (0, react.useState)(0);
|
|
1654
|
+
const [error, setError] = (0, react.useState)(null);
|
|
1655
|
+
const actionsRef = (0, react.useRef)(null);
|
|
1656
|
+
if (!actionsRef.current) actionsRef.current = {
|
|
1657
|
+
processMessages: (messages) => {
|
|
1658
|
+
try {
|
|
1659
|
+
processor.processMessages(messages);
|
|
1660
|
+
} catch (err) {
|
|
1661
|
+
console.warn("[A2UI] processMessages error:", err);
|
|
1662
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
setError(null);
|
|
1666
|
+
setVersion((v) => v + 1);
|
|
1667
|
+
},
|
|
1668
|
+
dispatch: (message) => {
|
|
1669
|
+
if (onActionRef.current) onActionRef.current(message);
|
|
1670
|
+
},
|
|
1671
|
+
getSurface: (surfaceId) => {
|
|
1672
|
+
return processor.model.getSurface(surfaceId);
|
|
1673
|
+
},
|
|
1674
|
+
clearSurfaces: () => {
|
|
1675
|
+
const surfaces = processor.model.surfacesMap;
|
|
1676
|
+
for (const [id] of surfaces) processor.processMessages([{
|
|
1677
|
+
version: "v0.9",
|
|
1678
|
+
deleteSurface: { surfaceId: id }
|
|
1679
|
+
}]);
|
|
1680
|
+
setVersion((v) => v + 1);
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
const actions = actionsRef.current;
|
|
1684
|
+
const stateValue = (0, react.useMemo)(() => ({
|
|
1685
|
+
version,
|
|
1686
|
+
error
|
|
1687
|
+
}), [version, error]);
|
|
1688
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIActionsContext.Provider, {
|
|
1689
|
+
value: actions,
|
|
1690
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIStateContext.Provider, {
|
|
1691
|
+
value: stateValue,
|
|
1692
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeProvider, {
|
|
1693
|
+
theme,
|
|
1694
|
+
children
|
|
1695
|
+
})
|
|
1758
1696
|
})
|
|
1759
1697
|
});
|
|
1760
|
-
}
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Hook to access stable A2UI actions (won't cause re-renders).
|
|
1701
|
+
*/
|
|
1702
|
+
function useA2UIActions() {
|
|
1703
|
+
const actions = (0, react.useContext)(A2UIActionsContext);
|
|
1704
|
+
if (!actions) throw new Error("useA2UIActions must be used within an A2UIProvider");
|
|
1705
|
+
return actions;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Hook to subscribe to A2UI state changes.
|
|
1709
|
+
*/
|
|
1710
|
+
function useA2UIState() {
|
|
1711
|
+
const state = (0, react.useContext)(A2UIStateContext);
|
|
1712
|
+
if (!state) throw new Error("useA2UIState must be used within an A2UIProvider");
|
|
1713
|
+
return state;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Hook to access the full A2UI context (actions + state).
|
|
1717
|
+
*/
|
|
1718
|
+
function useA2UIContext() {
|
|
1719
|
+
const actions = useA2UIActions();
|
|
1720
|
+
const state = useA2UIState();
|
|
1721
|
+
return (0, react.useMemo)(() => ({
|
|
1722
|
+
...actions,
|
|
1723
|
+
version: state.version,
|
|
1724
|
+
onAction: null
|
|
1725
|
+
}), [actions, state.version]);
|
|
1726
|
+
}
|
|
1727
|
+
/** @deprecated Use useA2UIContext instead. */
|
|
1728
|
+
const useA2UIStore = useA2UIContext;
|
|
1729
|
+
/**
|
|
1730
|
+
* Hook to access the current A2UI error state.
|
|
1731
|
+
*/
|
|
1732
|
+
function useA2UIError() {
|
|
1733
|
+
var _state$error;
|
|
1734
|
+
const state = (0, react.useContext)(A2UIStateContext);
|
|
1735
|
+
return (_state$error = state === null || state === void 0 ? void 0 : state.error) !== null && _state$error !== void 0 ? _state$error : null;
|
|
1736
|
+
}
|
|
1737
|
+
/** @deprecated Use useA2UIContext() or useA2UI() directly instead. */
|
|
1738
|
+
function useA2UIStoreSelector(selector) {
|
|
1739
|
+
return selector(useA2UIContext());
|
|
1740
|
+
}
|
|
1761
1741
|
|
|
1762
1742
|
//#endregion
|
|
1763
|
-
//#region src/react-renderer/
|
|
1743
|
+
//#region src/react-renderer/hooks/useA2UI.ts
|
|
1764
1744
|
/**
|
|
1765
|
-
*
|
|
1766
|
-
*
|
|
1767
|
-
* Supports two-way data binding for the checked state.
|
|
1745
|
+
* Main API hook for A2UI v0.9. Provides methods to process messages
|
|
1746
|
+
* and access surface state.
|
|
1768
1747
|
*/
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
const externalValue = getValue(valuePath);
|
|
1780
|
-
if (externalValue !== null && Boolean(externalValue) !== checked) setChecked(Boolean(externalValue));
|
|
1781
|
-
}
|
|
1782
|
-
}, [valuePath, getValue]);
|
|
1783
|
-
(0, react.useEffect)(() => {
|
|
1784
|
-
var _props$value2;
|
|
1785
|
-
if (((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.literalBoolean) !== void 0) setChecked(props.value.literalBoolean);
|
|
1786
|
-
}, [(_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.literalBoolean]);
|
|
1787
|
-
const handleChange = (0, react.useCallback)((e) => {
|
|
1788
|
-
const newValue = e.target.checked;
|
|
1789
|
-
setChecked(newValue);
|
|
1790
|
-
if (valuePath) setValue(valuePath, newValue);
|
|
1791
|
-
}, [valuePath, setValue]);
|
|
1792
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1793
|
-
className: "a2ui-checkbox",
|
|
1794
|
-
style: node.weight !== void 0 ? { "--weight": node.weight } : {},
|
|
1795
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1796
|
-
className: classMapToString(theme.components.CheckBox.container),
|
|
1797
|
-
style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.CheckBox),
|
|
1798
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1799
|
-
type: "checkbox",
|
|
1800
|
-
id,
|
|
1801
|
-
checked,
|
|
1802
|
-
onChange: handleChange,
|
|
1803
|
-
className: classMapToString(theme.components.CheckBox.element)
|
|
1804
|
-
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1805
|
-
htmlFor: id,
|
|
1806
|
-
className: classMapToString(theme.components.CheckBox.label),
|
|
1807
|
-
children: label
|
|
1808
|
-
})]
|
|
1809
|
-
})
|
|
1810
|
-
});
|
|
1811
|
-
});
|
|
1748
|
+
function useA2UI() {
|
|
1749
|
+
const actions = useA2UIActions();
|
|
1750
|
+
const state = useA2UIState();
|
|
1751
|
+
return {
|
|
1752
|
+
processMessages: actions.processMessages,
|
|
1753
|
+
getSurface: actions.getSurface,
|
|
1754
|
+
clearSurfaces: actions.clearSurfaces,
|
|
1755
|
+
version: state.version
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1812
1758
|
|
|
1813
1759
|
//#endregion
|
|
1814
|
-
//#region src/react-renderer/
|
|
1760
|
+
//#region src/react-renderer/lib/utils.ts
|
|
1815
1761
|
/**
|
|
1816
|
-
*
|
|
1817
|
-
*
|
|
1818
|
-
* Supports two-way data binding for the value.
|
|
1762
|
+
* Utility function to merge class names.
|
|
1819
1763
|
*/
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
const props = node.properties;
|
|
1824
|
-
const id = (0, react.useId)();
|
|
1825
|
-
const valuePath = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.path;
|
|
1826
|
-
const initialValue = (_resolveNumber = resolveNumber(props.value)) !== null && _resolveNumber !== void 0 ? _resolveNumber : 0;
|
|
1827
|
-
const minValue = (_props$minValue = props.minValue) !== null && _props$minValue !== void 0 ? _props$minValue : 0;
|
|
1828
|
-
const maxValue = (_props$maxValue = props.maxValue) !== null && _props$maxValue !== void 0 ? _props$maxValue : 0;
|
|
1829
|
-
const [value, setLocalValue] = (0, react.useState)(initialValue);
|
|
1830
|
-
(0, react.useEffect)(() => {
|
|
1831
|
-
if (valuePath) {
|
|
1832
|
-
const externalValue = getValue(valuePath);
|
|
1833
|
-
if (externalValue !== null && Number(externalValue) !== value) setLocalValue(Number(externalValue));
|
|
1834
|
-
}
|
|
1835
|
-
}, [valuePath, getValue]);
|
|
1836
|
-
(0, react.useEffect)(() => {
|
|
1837
|
-
var _props$value2;
|
|
1838
|
-
if (((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.literalNumber) !== void 0) setLocalValue(props.value.literalNumber);
|
|
1839
|
-
}, [(_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.literalNumber]);
|
|
1840
|
-
const handleChange = (0, react.useCallback)((e) => {
|
|
1841
|
-
const newValue = Number(e.target.value);
|
|
1842
|
-
setLocalValue(newValue);
|
|
1843
|
-
if (valuePath) setValue(valuePath, newValue);
|
|
1844
|
-
}, [valuePath, setValue]);
|
|
1845
|
-
const labelValue = props.label;
|
|
1846
|
-
const label = labelValue ? resolveString(labelValue) : "";
|
|
1847
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1848
|
-
className: "a2ui-slider",
|
|
1849
|
-
style: node.weight !== void 0 ? { "--weight": node.weight } : {},
|
|
1850
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1851
|
-
className: classMapToString(theme.components.Slider.container),
|
|
1852
|
-
children: [
|
|
1853
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1854
|
-
htmlFor: id,
|
|
1855
|
-
className: classMapToString(theme.components.Slider.label),
|
|
1856
|
-
children: label
|
|
1857
|
-
}),
|
|
1858
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1859
|
-
type: "range",
|
|
1860
|
-
id,
|
|
1861
|
-
name: "data",
|
|
1862
|
-
value,
|
|
1863
|
-
min: minValue,
|
|
1864
|
-
max: maxValue,
|
|
1865
|
-
onChange: handleChange,
|
|
1866
|
-
className: classMapToString(theme.components.Slider.element),
|
|
1867
|
-
style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Slider)
|
|
1868
|
-
}),
|
|
1869
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1870
|
-
className: classMapToString(theme.components.Slider.label),
|
|
1871
|
-
children: value
|
|
1872
|
-
})
|
|
1873
|
-
]
|
|
1874
|
-
})
|
|
1875
|
-
});
|
|
1876
|
-
});
|
|
1764
|
+
function cn(...inputs) {
|
|
1765
|
+
return (0, clsx.clsx)(inputs);
|
|
1766
|
+
}
|
|
1877
1767
|
|
|
1878
1768
|
//#endregion
|
|
1879
|
-
//#region src/react-renderer/
|
|
1880
|
-
/**
|
|
1881
|
-
|
|
1882
|
-
*
|
|
1883
|
-
* Supports enabling date, time, or both. Uses native HTML5 date/time inputs.
|
|
1884
|
-
*/
|
|
1885
|
-
const DateTimeInput = (0, react.memo)(function DateTimeInput({ node, surfaceId }) {
|
|
1886
|
-
var _props$value, _resolveString, _props$enableDate, _props$enableTime, _theme$additionalStyl;
|
|
1887
|
-
const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
|
|
1888
|
-
const props = node.properties;
|
|
1889
|
-
const id = (0, react.useId)();
|
|
1890
|
-
const valuePath = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.path;
|
|
1891
|
-
const initialValue = (_resolveString = resolveString(props.value)) !== null && _resolveString !== void 0 ? _resolveString : "";
|
|
1892
|
-
const enableDate = (_props$enableDate = props.enableDate) !== null && _props$enableDate !== void 0 ? _props$enableDate : true;
|
|
1893
|
-
const enableTime = (_props$enableTime = props.enableTime) !== null && _props$enableTime !== void 0 ? _props$enableTime : false;
|
|
1894
|
-
const [value, setLocalValue] = (0, react.useState)(initialValue);
|
|
1895
|
-
(0, react.useEffect)(() => {
|
|
1896
|
-
if (valuePath) {
|
|
1897
|
-
const externalValue = getValue(valuePath);
|
|
1898
|
-
if (externalValue !== null && String(externalValue) !== value) setLocalValue(String(externalValue));
|
|
1899
|
-
}
|
|
1900
|
-
}, [valuePath, getValue]);
|
|
1901
|
-
const handleChange = (0, react.useCallback)((e) => {
|
|
1902
|
-
const newValue = e.target.value;
|
|
1903
|
-
setLocalValue(newValue);
|
|
1904
|
-
if (valuePath) setValue(valuePath, newValue);
|
|
1905
|
-
}, [valuePath, setValue]);
|
|
1906
|
-
let inputType = "date";
|
|
1907
|
-
if (enableDate && enableTime) inputType = "datetime-local";
|
|
1908
|
-
else if (enableTime && !enableDate) inputType = "time";
|
|
1909
|
-
const getPlaceholderText = () => {
|
|
1910
|
-
if (enableDate && enableTime) return "Date & Time";
|
|
1911
|
-
else if (enableTime) return "Time";
|
|
1912
|
-
return "Date";
|
|
1913
|
-
};
|
|
1769
|
+
//#region src/react-renderer/core/A2UIRenderer.tsx
|
|
1770
|
+
/** Default loading fallback - memoized to prevent recreation */
|
|
1771
|
+
const DefaultLoadingFallback = (0, react.memo)(function DefaultLoadingFallback() {
|
|
1914
1772
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1915
|
-
className: "a2ui-
|
|
1916
|
-
style:
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
className: classMapToString(theme.components.DateTimeInput.label),
|
|
1922
|
-
children: getPlaceholderText()
|
|
1923
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1924
|
-
type: inputType,
|
|
1925
|
-
id,
|
|
1926
|
-
value,
|
|
1927
|
-
onChange: handleChange,
|
|
1928
|
-
className: classMapToString(theme.components.DateTimeInput.element),
|
|
1929
|
-
style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.DateTimeInput)
|
|
1930
|
-
})]
|
|
1931
|
-
})
|
|
1773
|
+
className: "a2ui-loading",
|
|
1774
|
+
style: {
|
|
1775
|
+
padding: "16px",
|
|
1776
|
+
opacity: .5
|
|
1777
|
+
},
|
|
1778
|
+
children: "Loading..."
|
|
1932
1779
|
});
|
|
1933
1780
|
});
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
//#region src/react-renderer/components/interactive/MultipleChoice.tsx
|
|
1937
|
-
/**
|
|
1938
|
-
* MultipleChoice component - a selection component using a dropdown.
|
|
1781
|
+
/**
|
|
1782
|
+
* A2UIRenderer - renders an A2UI surface using the v0.9 renderer.
|
|
1939
1783
|
*
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1784
|
+
* Uses A2uiSurface from a2ui-react which handles all component
|
|
1785
|
+
* rendering internally via the catalog system.
|
|
1942
1786
|
*/
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1947
|
-
const
|
|
1948
|
-
const options = (_ref = props.options) !== null && _ref !== void 0 ? _ref : [];
|
|
1949
|
-
const selectionsPath = (_props$selections = props.selections) === null || _props$selections === void 0 ? void 0 : _props$selections.path;
|
|
1950
|
-
const description = (_resolveString = resolveString(props.description)) !== null && _resolveString !== void 0 ? _resolveString : "Select an item";
|
|
1951
|
-
const handleChange = (0, react.useCallback)((e) => {
|
|
1952
|
-
if (selectionsPath) setValue(selectionsPath, [e.target.value]);
|
|
1953
|
-
}, [selectionsPath, setValue]);
|
|
1787
|
+
const A2UIRenderer = (0, react.memo)(function A2UIRenderer({ surfaceId, className, fallback = null, loadingFallback }) {
|
|
1788
|
+
const { getSurface, version } = useA2UI();
|
|
1789
|
+
const surface = getSurface(surfaceId);
|
|
1790
|
+
if (!surface) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
|
|
1791
|
+
const actualLoadingFallback = loadingFallback !== null && loadingFallback !== void 0 ? loadingFallback : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {});
|
|
1954
1792
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1955
|
-
className: "a2ui-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
className: classMapToString(theme.components.MultipleChoice.label),
|
|
1962
|
-
children: description
|
|
1963
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
1964
|
-
name: "data",
|
|
1965
|
-
id,
|
|
1966
|
-
className: classMapToString(theme.components.MultipleChoice.element),
|
|
1967
|
-
style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.MultipleChoice),
|
|
1968
|
-
onChange: handleChange,
|
|
1969
|
-
children: options.map((option) => {
|
|
1970
|
-
const label = resolveString(option.label);
|
|
1971
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1972
|
-
value: option.value,
|
|
1973
|
-
children: label
|
|
1974
|
-
}, option.value);
|
|
1975
|
-
})
|
|
1976
|
-
})]
|
|
1793
|
+
className: cn("a2ui-surface", className),
|
|
1794
|
+
"data-surface-id": surfaceId,
|
|
1795
|
+
"data-version": version,
|
|
1796
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
1797
|
+
fallback: actualLoadingFallback,
|
|
1798
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2uiSurface, { surface })
|
|
1977
1799
|
})
|
|
1978
1800
|
});
|
|
1979
1801
|
});
|
|
1980
1802
|
|
|
1981
1803
|
//#endregion
|
|
1982
|
-
//#region src/react-renderer/
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
*
|
|
1986
|
-
*
|
|
1804
|
+
//#region src/react-renderer/catalog-utils.ts
|
|
1805
|
+
const BASIC_CATALOG_ID = "https://a2ui.org/specification/v0_9/basic_catalog.json";
|
|
1806
|
+
/**
|
|
1807
|
+
* Context description used to identify the A2UI component schema in RunAgentInput.context.
|
|
1808
|
+
* Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
|
|
1809
|
+
* a frontend-provided schema with a server-side one.
|
|
1987
1810
|
*/
|
|
1988
|
-
|
|
1989
|
-
registry.register("Text", { component: Text });
|
|
1990
|
-
registry.register("Image", { component: Image });
|
|
1991
|
-
registry.register("Icon", { component: Icon });
|
|
1992
|
-
registry.register("Divider", { component: Divider });
|
|
1993
|
-
registry.register("Video", { component: Video });
|
|
1994
|
-
registry.register("AudioPlayer", { component: AudioPlayer });
|
|
1995
|
-
registry.register("Row", { component: Row });
|
|
1996
|
-
registry.register("Column", { component: Column });
|
|
1997
|
-
registry.register("List", { component: List });
|
|
1998
|
-
registry.register("Card", { component: Card });
|
|
1999
|
-
registry.register("Tabs", { component: Tabs });
|
|
2000
|
-
registry.register("Modal", { component: Modal });
|
|
2001
|
-
registry.register("Button", { component: Button });
|
|
2002
|
-
registry.register("TextField", { component: TextField });
|
|
2003
|
-
registry.register("CheckBox", { component: CheckBox });
|
|
2004
|
-
registry.register("Slider", { component: Slider });
|
|
2005
|
-
registry.register("DateTimeInput", { component: DateTimeInput });
|
|
2006
|
-
registry.register("MultipleChoice", { component: MultipleChoice });
|
|
2007
|
-
}
|
|
1811
|
+
const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema — available components for generating UI surfaces. Use these component names and props when creating A2UI operations.";
|
|
2008
1812
|
/**
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
1813
|
+
* Check whether a catalog is a superset of the basic catalog
|
|
1814
|
+
* (i.e., it contains all basic components by name).
|
|
2011
1815
|
*/
|
|
2012
|
-
function
|
|
2013
|
-
|
|
1816
|
+
function extendsBasicCatalog(catalog) {
|
|
1817
|
+
for (const name of basicCatalog.components.keys()) if (!catalog.components.has(name)) return false;
|
|
1818
|
+
return true;
|
|
2014
1819
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
//#region src/react-renderer/styles/reset.ts
|
|
2018
|
-
/**
|
|
2019
|
-
* Browser default reset for A2UI surfaces.
|
|
2020
|
-
*
|
|
2021
|
-
* The React renderer uses Light DOM, which means host-app CSS resets
|
|
2022
|
-
* (e.g. Tailwind preflight, normalize.css) can strip browser defaults
|
|
2023
|
-
* like heading margins, list styles, and form element appearance from
|
|
2024
|
-
* elements inside the renderer.
|
|
2025
|
-
*
|
|
2026
|
-
* The Lit renderer avoids this because Shadow DOM isolates its elements
|
|
2027
|
-
* from external stylesheets.
|
|
2028
|
-
*
|
|
2029
|
-
* This reset restores browser defaults inside `.a2ui-surface` by using
|
|
2030
|
-
* `all: revert` in a CSS @layer. Layered styles have the lowest author
|
|
2031
|
-
* priority, so every other A2UI style (utility classes, component styles,
|
|
2032
|
-
* theme classes, inline styles) automatically overrides the reset.
|
|
1820
|
+
/**
|
|
1821
|
+
* Return the names of components in a catalog that are not in the basic catalog.
|
|
2033
1822
|
*/
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
//#region src/react-renderer/styles/index.ts
|
|
2044
|
-
/**
|
|
2045
|
-
* Structural CSS styles from the Lit renderer, converted for global DOM use.
|
|
2046
|
-
* These styles define all the utility classes (layout-*, typography-*, color-*, etc.)
|
|
2047
|
-
* Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.
|
|
1823
|
+
function getCustomComponentNames(catalog) {
|
|
1824
|
+
const custom = [];
|
|
1825
|
+
for (const name of catalog.components.keys()) if (!basicCatalog.components.has(name)) custom.push(name);
|
|
1826
|
+
return custom;
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Build a context string describing the available A2UI catalog and custom components.
|
|
1830
|
+
* Custom components (those not in the basic catalog) are described using their
|
|
1831
|
+
* JSON Schema representation, matching the canonical A2UI catalog format.
|
|
2048
1832
|
*/
|
|
2049
|
-
|
|
1833
|
+
function buildCatalogContextValue(catalog) {
|
|
1834
|
+
const resolved = catalog !== null && catalog !== void 0 ? catalog : basicCatalog;
|
|
1835
|
+
const lines = [];
|
|
1836
|
+
lines.push("Available A2UI catalog:");
|
|
1837
|
+
if (resolved.id === BASIC_CATALOG_ID) {
|
|
1838
|
+
lines.push(`- ${resolved.id} (basic catalog)`);
|
|
1839
|
+
return lines.join("\n");
|
|
1840
|
+
}
|
|
1841
|
+
const isSuperset = extendsBasicCatalog(resolved);
|
|
1842
|
+
const customNames = getCustomComponentNames(resolved);
|
|
1843
|
+
lines.push(`- ${resolved.id}`);
|
|
1844
|
+
if (isSuperset) lines.push(" Extends the basic catalog with all standard components plus:");
|
|
1845
|
+
else {
|
|
1846
|
+
lines.push(" Custom catalog (does NOT include all basic components).");
|
|
1847
|
+
lines.push(" Custom components:");
|
|
1848
|
+
}
|
|
1849
|
+
for (const name of customNames) {
|
|
1850
|
+
const comp = resolved.components.get(name);
|
|
1851
|
+
if (!comp) continue;
|
|
1852
|
+
const jsonSchema = (0, zod_to_json_schema.zodToJsonSchema)(comp.schema);
|
|
1853
|
+
lines.push(` - ${name}:`);
|
|
1854
|
+
lines.push(` ${JSON.stringify(jsonSchema, null, 2).split("\n").join("\n ")}`);
|
|
1855
|
+
}
|
|
1856
|
+
return lines.join("\n");
|
|
1857
|
+
}
|
|
2050
1858
|
/**
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
* Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.
|
|
1859
|
+
* Extract component schemas from a catalog in the same format used by
|
|
1860
|
+
* the A2UI middleware (`A2UIComponentSchema[]`). Each component's Zod
|
|
1861
|
+
* schema is converted to JSON Schema via zod-to-json-schema.
|
|
2055
1862
|
*
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
* section → .a2ui-surface .a2ui-{component} section
|
|
2059
|
-
* ::slotted(*) → .a2ui-surface .a2ui-{component} section > *
|
|
1863
|
+
* When sent via `useAgentContext` with `A2UI_SCHEMA_CONTEXT_DESCRIPTION`,
|
|
1864
|
+
* the middleware can optionally overwrite it with a server-side schema.
|
|
2060
1865
|
*/
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
min-height: 0;
|
|
2071
|
-
overflow: auto;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
/* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */
|
|
2075
|
-
/* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */
|
|
2076
|
-
.a2ui-surface .a2ui-card > section {
|
|
2077
|
-
height: 100%;
|
|
2078
|
-
width: 100%;
|
|
2079
|
-
min-height: 0;
|
|
2080
|
-
overflow: auto;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
/* section ::slotted(*) { height: 100%; width: 100%; } */
|
|
2084
|
-
/* Use > section > to only target Card's slotted children, not deeply nested elements */
|
|
2085
|
-
.a2ui-surface .a2ui-card > section > * {
|
|
2086
|
-
height: 100%;
|
|
2087
|
-
width: 100%;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
/* =========================================================================
|
|
2091
|
-
* Divider (from Lit divider.ts static styles)
|
|
2092
|
-
* ========================================================================= */
|
|
2093
|
-
|
|
2094
|
-
/* :host { display: block; min-height: 0; overflow: auto; } */
|
|
2095
|
-
.a2ui-surface .a2ui-divider {
|
|
2096
|
-
display: block;
|
|
2097
|
-
min-height: 0;
|
|
2098
|
-
overflow: auto;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
/* hr { height: 1px; background: #ccc; border: none; } */
|
|
2102
|
-
/* Use :where() for low specificity (0,0,1) so theme utility classes can override */
|
|
2103
|
-
/* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */
|
|
2104
|
-
:where(.a2ui-surface .a2ui-divider) hr {
|
|
2105
|
-
height: 1px;
|
|
2106
|
-
background: #ccc;
|
|
2107
|
-
border: none;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
|
-
/* =========================================================================
|
|
2111
|
-
* Text (from Lit text.ts static styles)
|
|
2112
|
-
* ========================================================================= */
|
|
2113
|
-
|
|
2114
|
-
/* :host { display: block; flex: var(--weight); } */
|
|
2115
|
-
.a2ui-surface .a2ui-text {
|
|
2116
|
-
display: block;
|
|
2117
|
-
flex: var(--weight);
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
/* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */
|
|
2121
|
-
/* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */
|
|
2122
|
-
:where(.a2ui-surface .a2ui-text) h1,
|
|
2123
|
-
:where(.a2ui-surface .a2ui-text) h2,
|
|
2124
|
-
:where(.a2ui-surface .a2ui-text) h3,
|
|
2125
|
-
:where(.a2ui-surface .a2ui-text) h4,
|
|
2126
|
-
:where(.a2ui-surface .a2ui-text) h5 {
|
|
2127
|
-
line-height: inherit;
|
|
2128
|
-
font: inherit;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
/* Ensure markdown paragraph margins are reset */
|
|
2132
|
-
.a2ui-surface .a2ui-text p {
|
|
2133
|
-
margin: 0;
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
/* =========================================================================
|
|
2137
|
-
* TextField (from Lit text-field.ts static styles)
|
|
2138
|
-
* ========================================================================= */
|
|
2139
|
-
|
|
2140
|
-
/* :host { display: flex; flex: var(--weight); } */
|
|
2141
|
-
.a2ui-surface .a2ui-textfield {
|
|
2142
|
-
display: flex;
|
|
2143
|
-
flex: var(--weight);
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
/* input { display: block; width: 100%; } */
|
|
2147
|
-
:where(.a2ui-surface .a2ui-textfield) input {
|
|
2148
|
-
display: block;
|
|
2149
|
-
width: 100%;
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
/* label { display: block; margin-bottom: 4px; } */
|
|
2153
|
-
:where(.a2ui-surface .a2ui-textfield) label {
|
|
2154
|
-
display: block;
|
|
2155
|
-
margin-bottom: 4px;
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
/* textarea - same styling as input for multiline text fields */
|
|
2159
|
-
:where(.a2ui-surface .a2ui-textfield) textarea {
|
|
2160
|
-
display: block;
|
|
2161
|
-
width: 100%;
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
/* =========================================================================
|
|
2165
|
-
* CheckBox (from Lit checkbox.ts static styles)
|
|
2166
|
-
* ========================================================================= */
|
|
2167
|
-
|
|
2168
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2169
|
-
.a2ui-surface .a2ui-checkbox {
|
|
2170
|
-
display: block;
|
|
2171
|
-
flex: var(--weight);
|
|
2172
|
-
min-height: 0;
|
|
2173
|
-
overflow: auto;
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
/* input { display: block; width: 100%; } */
|
|
2177
|
-
:where(.a2ui-surface .a2ui-checkbox) input {
|
|
2178
|
-
display: block;
|
|
2179
|
-
width: 100%;
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
/* =========================================================================
|
|
2183
|
-
* Slider (from Lit slider.ts static styles)
|
|
2184
|
-
* ========================================================================= */
|
|
2185
|
-
|
|
2186
|
-
/* :host { display: block; flex: var(--weight); } */
|
|
2187
|
-
.a2ui-surface .a2ui-slider {
|
|
2188
|
-
display: block;
|
|
2189
|
-
flex: var(--weight);
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
/* input { display: block; width: 100%; } */
|
|
2193
|
-
:where(.a2ui-surface .a2ui-slider) input {
|
|
2194
|
-
display: block;
|
|
2195
|
-
width: 100%;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
/* =========================================================================
|
|
2199
|
-
* Button (from Lit button.ts static styles)
|
|
2200
|
-
* ========================================================================= */
|
|
2201
|
-
|
|
2202
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; } */
|
|
2203
|
-
.a2ui-surface .a2ui-button {
|
|
2204
|
-
display: block;
|
|
2205
|
-
flex: var(--weight);
|
|
2206
|
-
min-height: 0;
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
/* =========================================================================
|
|
2210
|
-
* Icon (from Lit icon.ts static styles)
|
|
2211
|
-
* ========================================================================= */
|
|
2212
|
-
|
|
2213
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2214
|
-
.a2ui-surface .a2ui-icon {
|
|
2215
|
-
display: block;
|
|
2216
|
-
flex: var(--weight);
|
|
2217
|
-
min-height: 0;
|
|
2218
|
-
overflow: auto;
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
/* =========================================================================
|
|
2222
|
-
* Tabs (from Lit tabs.ts static styles)
|
|
2223
|
-
* ========================================================================= */
|
|
2224
|
-
|
|
2225
|
-
/* :host { display: block; flex: var(--weight); } */
|
|
2226
|
-
.a2ui-surface .a2ui-tabs {
|
|
2227
|
-
display: block;
|
|
2228
|
-
flex: var(--weight);
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
/* =========================================================================
|
|
2232
|
-
* Modal (from Lit modal.ts static styles)
|
|
2233
|
-
* ========================================================================= */
|
|
2234
|
-
|
|
2235
|
-
/* :host { display: block; flex: var(--weight); } */
|
|
2236
|
-
.a2ui-surface .a2ui-modal {
|
|
2237
|
-
display: block;
|
|
2238
|
-
flex: var(--weight);
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
/* dialog { padding: 0; border: none; background: none; } */
|
|
2242
|
-
:where(.a2ui-surface .a2ui-modal) dialog {
|
|
2243
|
-
padding: 0;
|
|
2244
|
-
border: none;
|
|
2245
|
-
background: none;
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
/* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */
|
|
2249
|
-
.a2ui-surface .a2ui-modal dialog section #controls {
|
|
2250
|
-
display: flex;
|
|
2251
|
-
justify-content: end;
|
|
2252
|
-
margin-bottom: 4px;
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
/* dialog section #controls button { padding: 0; background: none; ... } */
|
|
2256
|
-
.a2ui-surface .a2ui-modal dialog section #controls button {
|
|
2257
|
-
padding: 0;
|
|
2258
|
-
background: none;
|
|
2259
|
-
width: 20px;
|
|
2260
|
-
height: 20px;
|
|
2261
|
-
cursor: pointer;
|
|
2262
|
-
border: none;
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
/* =========================================================================
|
|
2266
|
-
* Image (from Lit image.ts static styles)
|
|
2267
|
-
* ========================================================================= */
|
|
2268
|
-
|
|
2269
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2270
|
-
.a2ui-surface .a2ui-image {
|
|
2271
|
-
display: block;
|
|
2272
|
-
flex: var(--weight);
|
|
2273
|
-
min-height: 0;
|
|
2274
|
-
overflow: auto;
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
/* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */
|
|
2278
|
-
:where(.a2ui-surface .a2ui-image) img {
|
|
2279
|
-
display: block;
|
|
2280
|
-
width: 100%;
|
|
2281
|
-
height: 100%;
|
|
2282
|
-
object-fit: var(--object-fit, fill);
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
/* =========================================================================
|
|
2286
|
-
* Video (from Lit video.ts static styles)
|
|
2287
|
-
* ========================================================================= */
|
|
2288
|
-
|
|
2289
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2290
|
-
.a2ui-surface .a2ui-video {
|
|
2291
|
-
display: block;
|
|
2292
|
-
flex: var(--weight);
|
|
2293
|
-
min-height: 0;
|
|
2294
|
-
overflow: auto;
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
/* video { display: block; width: 100%; } */
|
|
2298
|
-
:where(.a2ui-surface .a2ui-video) video {
|
|
2299
|
-
display: block;
|
|
2300
|
-
width: 100%;
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
/* =========================================================================
|
|
2304
|
-
* AudioPlayer (from Lit audio.ts static styles)
|
|
2305
|
-
* ========================================================================= */
|
|
2306
|
-
|
|
2307
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2308
|
-
.a2ui-surface .a2ui-audio {
|
|
2309
|
-
display: block;
|
|
2310
|
-
flex: var(--weight);
|
|
2311
|
-
min-height: 0;
|
|
2312
|
-
overflow: auto;
|
|
2313
|
-
}
|
|
2314
|
-
|
|
2315
|
-
/* audio { display: block; width: 100%; } */
|
|
2316
|
-
:where(.a2ui-surface .a2ui-audio) audio {
|
|
2317
|
-
display: block;
|
|
2318
|
-
width: 100%;
|
|
2319
|
-
}
|
|
2320
|
-
|
|
2321
|
-
/* =========================================================================
|
|
2322
|
-
* MultipleChoice (from Lit multiple-choice.ts static styles)
|
|
2323
|
-
* ========================================================================= */
|
|
2324
|
-
|
|
2325
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2326
|
-
.a2ui-surface .a2ui-multiplechoice {
|
|
2327
|
-
display: block;
|
|
2328
|
-
flex: var(--weight);
|
|
2329
|
-
min-height: 0;
|
|
2330
|
-
overflow: auto;
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
/* select { width: 100%; } */
|
|
2334
|
-
:where(.a2ui-surface .a2ui-multiplechoice) select {
|
|
2335
|
-
width: 100%;
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
/* =========================================================================
|
|
2339
|
-
* Column (from Lit column.ts static styles)
|
|
2340
|
-
* ========================================================================= */
|
|
2341
|
-
|
|
2342
|
-
/* :host { display: flex; flex: var(--weight); } */
|
|
2343
|
-
.a2ui-surface .a2ui-column {
|
|
2344
|
-
display: flex;
|
|
2345
|
-
flex: var(--weight);
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
/* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */
|
|
2349
|
-
.a2ui-surface .a2ui-column > section {
|
|
2350
|
-
display: flex;
|
|
2351
|
-
flex-direction: column;
|
|
2352
|
-
min-width: 100%;
|
|
2353
|
-
height: 100%;
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
/* :host([alignment="..."]) section { align-items: ...; } */
|
|
2357
|
-
/* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */
|
|
2358
|
-
.a2ui-surface .a2ui-column[data-alignment="start"] > section { align-items: start; }
|
|
2359
|
-
.a2ui-surface .a2ui-column[data-alignment="center"] > section { align-items: center; }
|
|
2360
|
-
.a2ui-surface .a2ui-column[data-alignment="end"] > section { align-items: end; }
|
|
2361
|
-
.a2ui-surface .a2ui-column[data-alignment="stretch"] > section { align-items: stretch; }
|
|
2362
|
-
|
|
2363
|
-
/* :host([distribution="..."]) section { justify-content: ...; } */
|
|
2364
|
-
.a2ui-surface .a2ui-column[data-distribution="start"] > section { justify-content: start; }
|
|
2365
|
-
.a2ui-surface .a2ui-column[data-distribution="center"] > section { justify-content: center; }
|
|
2366
|
-
.a2ui-surface .a2ui-column[data-distribution="end"] > section { justify-content: end; }
|
|
2367
|
-
.a2ui-surface .a2ui-column[data-distribution="spaceBetween"] > section { justify-content: space-between; }
|
|
2368
|
-
.a2ui-surface .a2ui-column[data-distribution="spaceAround"] > section { justify-content: space-around; }
|
|
2369
|
-
.a2ui-surface .a2ui-column[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
|
|
2370
|
-
|
|
2371
|
-
/* =========================================================================
|
|
2372
|
-
* Row (from Lit row.ts static styles)
|
|
2373
|
-
* ========================================================================= */
|
|
2374
|
-
|
|
2375
|
-
/* :host { display: flex; flex: var(--weight); } */
|
|
2376
|
-
.a2ui-surface .a2ui-row {
|
|
2377
|
-
display: flex;
|
|
2378
|
-
flex: var(--weight);
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
/* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */
|
|
2382
|
-
.a2ui-surface .a2ui-row > section {
|
|
2383
|
-
display: flex;
|
|
2384
|
-
flex-direction: row;
|
|
2385
|
-
width: 100%;
|
|
2386
|
-
min-height: 100%;
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
/* :host([alignment="..."]) section { align-items: ...; } */
|
|
2390
|
-
/* Use > section to only target Row's direct section, not nested sections */
|
|
2391
|
-
.a2ui-surface .a2ui-row[data-alignment="start"] > section { align-items: start; }
|
|
2392
|
-
.a2ui-surface .a2ui-row[data-alignment="center"] > section { align-items: center; }
|
|
2393
|
-
.a2ui-surface .a2ui-row[data-alignment="end"] > section { align-items: end; }
|
|
2394
|
-
.a2ui-surface .a2ui-row[data-alignment="stretch"] > section { align-items: stretch; }
|
|
2395
|
-
|
|
2396
|
-
/* :host([distribution="..."]) section { justify-content: ...; } */
|
|
2397
|
-
.a2ui-surface .a2ui-row[data-distribution="start"] > section { justify-content: start; }
|
|
2398
|
-
.a2ui-surface .a2ui-row[data-distribution="center"] > section { justify-content: center; }
|
|
2399
|
-
.a2ui-surface .a2ui-row[data-distribution="end"] > section { justify-content: end; }
|
|
2400
|
-
.a2ui-surface .a2ui-row[data-distribution="spaceBetween"] > section { justify-content: space-between; }
|
|
2401
|
-
.a2ui-surface .a2ui-row[data-distribution="spaceAround"] > section { justify-content: space-around; }
|
|
2402
|
-
.a2ui-surface .a2ui-row[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
|
|
2403
|
-
|
|
2404
|
-
/* =========================================================================
|
|
2405
|
-
* List (from Lit list.ts static styles)
|
|
2406
|
-
* ========================================================================= */
|
|
2407
|
-
|
|
2408
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2409
|
-
.a2ui-surface .a2ui-list {
|
|
2410
|
-
display: block;
|
|
2411
|
-
flex: var(--weight);
|
|
2412
|
-
min-height: 0;
|
|
2413
|
-
overflow: auto;
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
/* :host([direction="vertical"]) section { display: grid; } */
|
|
2417
|
-
.a2ui-surface .a2ui-list[data-direction="vertical"] > section {
|
|
2418
|
-
display: grid;
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
/* :host([direction="horizontal"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */
|
|
2422
|
-
.a2ui-surface .a2ui-list[data-direction="horizontal"] > section {
|
|
2423
|
-
display: flex;
|
|
2424
|
-
max-width: 100%;
|
|
2425
|
-
overflow-x: scroll;
|
|
2426
|
-
overflow-y: hidden;
|
|
2427
|
-
scrollbar-width: none;
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
/* :host([direction="horizontal"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */
|
|
2431
|
-
.a2ui-surface .a2ui-list[data-direction="horizontal"] > section > * {
|
|
2432
|
-
flex: 1 0 fit-content;
|
|
2433
|
-
max-width: min(80%, 400px);
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
/* =========================================================================
|
|
2437
|
-
* DateTimeInput (from Lit datetime-input.ts static styles)
|
|
2438
|
-
* ========================================================================= */
|
|
2439
|
-
|
|
2440
|
-
/* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
|
|
2441
|
-
.a2ui-surface .a2ui-datetime-input {
|
|
2442
|
-
display: block;
|
|
2443
|
-
flex: var(--weight);
|
|
2444
|
-
min-height: 0;
|
|
2445
|
-
overflow: auto;
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
|
-
/* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */
|
|
2449
|
-
/* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */
|
|
2450
|
-
:where(.a2ui-surface .a2ui-datetime-input) input {
|
|
2451
|
-
display: block;
|
|
2452
|
-
border-radius: 8px;
|
|
2453
|
-
padding: 8px;
|
|
2454
|
-
border: 1px solid #ccc;
|
|
2455
|
-
width: 100%;
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
/* =========================================================================
|
|
2459
|
-
* Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)
|
|
2460
|
-
* ========================================================================= */
|
|
1866
|
+
function extractCatalogComponentSchemas(catalog) {
|
|
1867
|
+
const resolved = catalog !== null && catalog !== void 0 ? catalog : basicCatalog;
|
|
1868
|
+
const schemas = [];
|
|
1869
|
+
for (const [name, comp] of resolved.components) schemas.push({
|
|
1870
|
+
name,
|
|
1871
|
+
props: (0, zod_to_json_schema.zodToJsonSchema)(comp.schema, { target: "openApi3" })
|
|
1872
|
+
});
|
|
1873
|
+
return schemas;
|
|
1874
|
+
}
|
|
2461
1875
|
|
|
2462
|
-
|
|
2463
|
-
.
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
}
|
|
2467
|
-
`;
|
|
2468
|
-
/**
|
|
2469
|
-
* Injects A2UI structural styles into the document head.
|
|
2470
|
-
* Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.
|
|
2471
|
-
* Call this once at application startup.
|
|
1876
|
+
//#endregion
|
|
1877
|
+
//#region src/react-renderer/create-catalog.tsx
|
|
1878
|
+
/**
|
|
1879
|
+
* Create an A2UI catalog from definitions and renderers.
|
|
2472
1880
|
*
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
1881
|
+
* Definitions are platform-agnostic (Zod schemas + descriptions).
|
|
1882
|
+
* Renderers are platform-specific (React components).
|
|
1883
|
+
* TypeScript enforces that renderers match definitions exactly.
|
|
2475
1884
|
*
|
|
2476
1885
|
* @example
|
|
2477
1886
|
* ```tsx
|
|
2478
|
-
*
|
|
2479
|
-
*
|
|
2480
|
-
*
|
|
2481
|
-
*
|
|
1887
|
+
* // schema.ts (platform-agnostic)
|
|
1888
|
+
* export const demoCatalogDefinitions = {
|
|
1889
|
+
* Card: {
|
|
1890
|
+
* description: "A card container",
|
|
1891
|
+
* props: z.object({ title: z.string(), child: z.string().optional() }),
|
|
1892
|
+
* },
|
|
1893
|
+
* } satisfies CatalogDefinitions;
|
|
1894
|
+
*
|
|
1895
|
+
* // catalog.tsx (React renderers)
|
|
1896
|
+
* export const demoCatalog = createCatalog(demoCatalogDefinitions, {
|
|
1897
|
+
* Card: ({ props, children }) => (
|
|
1898
|
+
* <div>{props.title}{props.child && children(props.child)}</div>
|
|
1899
|
+
* ),
|
|
1900
|
+
* });
|
|
2482
1901
|
* ```
|
|
2483
1902
|
*/
|
|
2484
|
-
function
|
|
2485
|
-
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2488
|
-
const
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
1903
|
+
function createCatalog(definitions, renderers, options) {
|
|
1904
|
+
var _options$catalogId;
|
|
1905
|
+
const catalogId = (_options$catalogId = options === null || options === void 0 ? void 0 : options.catalogId) !== null && _options$catalogId !== void 0 ? _options$catalogId : "copilotkit://custom-catalog";
|
|
1906
|
+
const includeBasic = (options === null || options === void 0 ? void 0 : options.includeBasicCatalog) === true;
|
|
1907
|
+
const customComponents = [];
|
|
1908
|
+
for (const [name, def] of Object.entries(definitions)) {
|
|
1909
|
+
const api = {
|
|
1910
|
+
name,
|
|
1911
|
+
schema: def.props
|
|
1912
|
+
};
|
|
1913
|
+
const renderer = renderers[name];
|
|
1914
|
+
const wrapped = createReactComponent(api, ({ props, buildChild, context }) => {
|
|
1915
|
+
const Render = renderer;
|
|
1916
|
+
const dispatch = (action) => context.dispatchAction(action);
|
|
1917
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Render, {
|
|
1918
|
+
props,
|
|
1919
|
+
children: buildChild,
|
|
1920
|
+
dispatch
|
|
1921
|
+
});
|
|
1922
|
+
});
|
|
1923
|
+
customComponents.push(wrapped);
|
|
1924
|
+
}
|
|
1925
|
+
return new _a2ui_web_core_v0_9.Catalog(catalogId, includeBasic ? [...Array.from(basicCatalog.components.values()), ...customComponents] : customComponents, includeBasic ? Array.from(basicCatalog.functions.values()) : []);
|
|
2492
1926
|
}
|
|
2493
1927
|
/**
|
|
2494
|
-
*
|
|
2495
|
-
*
|
|
1928
|
+
* Extract a JSON-serializable schema from catalog definitions.
|
|
1929
|
+
* Suitable for passing to the runtime's `a2ui.schema` config.
|
|
2496
1930
|
*/
|
|
2497
|
-
function
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
1931
|
+
function extractSchema(definitions) {
|
|
1932
|
+
return Object.entries(definitions).map(([name, def]) => ({
|
|
1933
|
+
name,
|
|
1934
|
+
description: def.description,
|
|
1935
|
+
props: zodSchemaToSimpleObject(def.props)
|
|
1936
|
+
}));
|
|
2501
1937
|
}
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
"layout-al-c": true
|
|
2513
|
-
};
|
|
2514
|
-
const audio = { "layout-w-100": true };
|
|
2515
|
-
const body = {
|
|
2516
|
-
"typography-f-s": true,
|
|
2517
|
-
"typography-fs-n": true,
|
|
2518
|
-
"typography-w-400": true,
|
|
2519
|
-
"layout-mt-0": true,
|
|
2520
|
-
"layout-mb-2": true,
|
|
2521
|
-
"typography-sz-bm": true,
|
|
2522
|
-
"color-c-n10": true
|
|
2523
|
-
};
|
|
2524
|
-
const button = {
|
|
2525
|
-
"typography-f-sf": true,
|
|
2526
|
-
"typography-fs-n": true,
|
|
2527
|
-
"typography-w-500": true,
|
|
2528
|
-
"layout-pt-3": true,
|
|
2529
|
-
"layout-pb-3": true,
|
|
2530
|
-
"layout-pl-5": true,
|
|
2531
|
-
"layout-pr-5": true,
|
|
2532
|
-
"layout-mb-1": true,
|
|
2533
|
-
"border-br-16": true,
|
|
2534
|
-
"border-bw-0": true,
|
|
2535
|
-
"border-c-n70": true,
|
|
2536
|
-
"border-bs-s": true,
|
|
2537
|
-
"color-bgc-s30": true,
|
|
2538
|
-
"color-c-n100": true,
|
|
2539
|
-
"behavior-ho-80": true
|
|
2540
|
-
};
|
|
2541
|
-
const heading = {
|
|
2542
|
-
"typography-f-sf": true,
|
|
2543
|
-
"typography-fs-n": true,
|
|
2544
|
-
"typography-w-500": true,
|
|
2545
|
-
"layout-mt-0": true,
|
|
2546
|
-
"layout-mb-2": true,
|
|
2547
|
-
"color-c-n10": true
|
|
2548
|
-
};
|
|
2549
|
-
const h1 = {
|
|
2550
|
-
...heading,
|
|
2551
|
-
"typography-sz-tl": true
|
|
2552
|
-
};
|
|
2553
|
-
const h2 = {
|
|
2554
|
-
...heading,
|
|
2555
|
-
"typography-sz-tm": true
|
|
2556
|
-
};
|
|
2557
|
-
const h3 = {
|
|
2558
|
-
...heading,
|
|
2559
|
-
"typography-sz-ts": true
|
|
2560
|
-
};
|
|
2561
|
-
const iframe = { "behavior-sw-n": true };
|
|
2562
|
-
const input = {
|
|
2563
|
-
"typography-f-sf": true,
|
|
2564
|
-
"typography-fs-n": true,
|
|
2565
|
-
"typography-w-400": true,
|
|
2566
|
-
"layout-pl-4": true,
|
|
2567
|
-
"layout-pr-4": true,
|
|
2568
|
-
"layout-pt-2": true,
|
|
2569
|
-
"layout-pb-2": true,
|
|
2570
|
-
"border-br-6": true,
|
|
2571
|
-
"border-bw-1": true,
|
|
2572
|
-
"color-bc-s70": true,
|
|
2573
|
-
"border-bs-s": true,
|
|
2574
|
-
"layout-as-n": true,
|
|
2575
|
-
"color-c-n10": true
|
|
2576
|
-
};
|
|
2577
|
-
const p = {
|
|
2578
|
-
"typography-f-s": true,
|
|
2579
|
-
"typography-fs-n": true,
|
|
2580
|
-
"typography-w-400": true,
|
|
2581
|
-
"layout-m-0": true,
|
|
2582
|
-
"typography-sz-bm": true,
|
|
2583
|
-
"layout-as-n": true,
|
|
2584
|
-
"color-c-n10": true
|
|
2585
|
-
};
|
|
2586
|
-
const orderedList = {
|
|
2587
|
-
"typography-f-s": true,
|
|
2588
|
-
"typography-fs-n": true,
|
|
2589
|
-
"typography-w-400": true,
|
|
2590
|
-
"layout-m-0": true,
|
|
2591
|
-
"typography-sz-bm": true,
|
|
2592
|
-
"layout-as-n": true
|
|
2593
|
-
};
|
|
2594
|
-
const unorderedList = {
|
|
2595
|
-
"typography-f-s": true,
|
|
2596
|
-
"typography-fs-n": true,
|
|
2597
|
-
"typography-w-400": true,
|
|
2598
|
-
"layout-m-0": true,
|
|
2599
|
-
"typography-sz-bm": true,
|
|
2600
|
-
"layout-as-n": true
|
|
2601
|
-
};
|
|
2602
|
-
const listItem = {
|
|
2603
|
-
"typography-f-s": true,
|
|
2604
|
-
"typography-fs-n": true,
|
|
2605
|
-
"typography-w-400": true,
|
|
2606
|
-
"layout-m-0": true,
|
|
2607
|
-
"typography-sz-bm": true,
|
|
2608
|
-
"layout-as-n": true
|
|
2609
|
-
};
|
|
2610
|
-
const pre = {
|
|
2611
|
-
"typography-f-c": true,
|
|
2612
|
-
"typography-fs-n": true,
|
|
2613
|
-
"typography-w-400": true,
|
|
2614
|
-
"typography-sz-bm": true,
|
|
2615
|
-
"typography-ws-p": true,
|
|
2616
|
-
"layout-as-n": true
|
|
2617
|
-
};
|
|
2618
|
-
const textarea = {
|
|
2619
|
-
...input,
|
|
2620
|
-
"layout-r-none": true,
|
|
2621
|
-
"layout-fs-c": true
|
|
2622
|
-
};
|
|
2623
|
-
const video = { "layout-el-cv": true };
|
|
2624
|
-
const aLight = _a2ui_lit.v0_8.Styles.merge(a, { "color-c-n5": true });
|
|
2625
|
-
const inputLight = _a2ui_lit.v0_8.Styles.merge(input, { "color-c-n5": true });
|
|
2626
|
-
const textareaLight = _a2ui_lit.v0_8.Styles.merge(textarea, { "color-c-n5": true });
|
|
2627
|
-
const buttonLight = _a2ui_lit.v0_8.Styles.merge(button, { "color-c-n100": true });
|
|
2628
|
-
const h1Light = _a2ui_lit.v0_8.Styles.merge(h1, { "color-c-n5": true });
|
|
2629
|
-
const h2Light = _a2ui_lit.v0_8.Styles.merge(h2, { "color-c-n5": true });
|
|
2630
|
-
const h3Light = _a2ui_lit.v0_8.Styles.merge(h3, { "color-c-n5": true });
|
|
2631
|
-
const bodyLight = _a2ui_lit.v0_8.Styles.merge(body, { "color-c-n5": true });
|
|
2632
|
-
const pLight = _a2ui_lit.v0_8.Styles.merge(p, { "color-c-n35": true });
|
|
2633
|
-
const preLight = _a2ui_lit.v0_8.Styles.merge(pre, { "color-c-n35": true });
|
|
2634
|
-
const orderedListLight = _a2ui_lit.v0_8.Styles.merge(orderedList, { "color-c-n35": true });
|
|
2635
|
-
const unorderedListLight = _a2ui_lit.v0_8.Styles.merge(unorderedList, { "color-c-n35": true });
|
|
2636
|
-
const listItemLight = _a2ui_lit.v0_8.Styles.merge(listItem, { "color-c-n35": true });
|
|
2637
|
-
const theme = {
|
|
2638
|
-
additionalStyles: {
|
|
2639
|
-
Button: {
|
|
2640
|
-
background: "var(--primary, oklch(0.205 0 0))",
|
|
2641
|
-
color: "var(--primary-foreground, oklch(0.985 0 0))",
|
|
2642
|
-
"border-radius": "calc(var(--radius, 0.625rem) - 2px)",
|
|
2643
|
-
cursor: "pointer",
|
|
2644
|
-
width: "100%",
|
|
2645
|
-
"--n-10": "var(--primary-foreground, oklch(0.985 0 0))",
|
|
2646
|
-
"--n-35": "var(--primary-foreground, oklch(0.985 0 0))",
|
|
2647
|
-
"--n-60": "var(--primary-foreground, oklch(0.985 0 0))"
|
|
2648
|
-
},
|
|
2649
|
-
Card: {
|
|
2650
|
-
background: "var(--card, oklch(1 0 0))",
|
|
2651
|
-
border: "1px solid var(--border, oklch(0.922 0 0))",
|
|
2652
|
-
"border-radius": "var(--radius, 0.625rem)",
|
|
2653
|
-
padding: "16px"
|
|
2654
|
-
},
|
|
2655
|
-
TextField: {
|
|
2656
|
-
"background-color": "var(--background, oklch(1 0 0))",
|
|
2657
|
-
"border-color": "var(--input, oklch(0.922 0 0))",
|
|
2658
|
-
color: "var(--foreground, oklch(0.145 0 0))",
|
|
2659
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
2660
|
-
},
|
|
2661
|
-
CheckBox: {
|
|
2662
|
-
"--n-100": "var(--background, oklch(1 0 0))",
|
|
2663
|
-
"--n-70": "var(--border, oklch(0.922 0 0))",
|
|
2664
|
-
"--n-30": "var(--foreground, oklch(0.145 0 0))"
|
|
2665
|
-
},
|
|
2666
|
-
DateTimeInput: {
|
|
2667
|
-
"background-color": "var(--background, oklch(1 0 0))",
|
|
2668
|
-
"border-color": "var(--input, oklch(0.922 0 0))",
|
|
2669
|
-
color: "var(--foreground, oklch(0.145 0 0))",
|
|
2670
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
2671
|
-
},
|
|
2672
|
-
Modal: {
|
|
2673
|
-
"--p-100": "var(--card, oklch(1 0 0))",
|
|
2674
|
-
"--p-80": "var(--border, oklch(0.922 0 0))",
|
|
2675
|
-
"border-radius": "var(--radius, 0.625rem)"
|
|
2676
|
-
},
|
|
2677
|
-
Text: { color: "var(--foreground, oklch(0.145 0 0))" }
|
|
2678
|
-
},
|
|
2679
|
-
components: {
|
|
2680
|
-
AudioPlayer: {},
|
|
2681
|
-
Button: {
|
|
2682
|
-
"layout-pt-2": true,
|
|
2683
|
-
"layout-pb-2": true,
|
|
2684
|
-
"layout-pl-3": true,
|
|
2685
|
-
"layout-pr-3": true,
|
|
2686
|
-
"border-bw-0": true,
|
|
2687
|
-
"border-bs-s": true
|
|
2688
|
-
},
|
|
2689
|
-
Card: {
|
|
2690
|
-
"border-br-9": true,
|
|
2691
|
-
"color-bgc-n100": true
|
|
2692
|
-
},
|
|
2693
|
-
CheckBox: {
|
|
2694
|
-
element: {
|
|
2695
|
-
"layout-m-0": true,
|
|
2696
|
-
"layout-mr-2": true,
|
|
2697
|
-
"layout-p-2": true,
|
|
2698
|
-
"border-br-2": true,
|
|
2699
|
-
"border-bw-1": true,
|
|
2700
|
-
"border-bs-s": true,
|
|
2701
|
-
"color-bgc-n100": true,
|
|
2702
|
-
"color-bc-n70": true,
|
|
2703
|
-
"color-c-n30": true
|
|
2704
|
-
},
|
|
2705
|
-
label: {
|
|
2706
|
-
"typography-f-sf": true,
|
|
2707
|
-
"typography-v-r": true,
|
|
2708
|
-
"typography-w-400": true,
|
|
2709
|
-
"layout-flx-1": true,
|
|
2710
|
-
"typography-sz-ll": true
|
|
2711
|
-
},
|
|
2712
|
-
container: {
|
|
2713
|
-
"layout-dsp-iflex": true,
|
|
2714
|
-
"layout-al-c": true
|
|
2715
|
-
}
|
|
2716
|
-
},
|
|
2717
|
-
Column: { "layout-g-2": true },
|
|
2718
|
-
DateTimeInput: {
|
|
2719
|
-
container: {},
|
|
2720
|
-
label: {},
|
|
2721
|
-
element: {
|
|
2722
|
-
"layout-pt-2": true,
|
|
2723
|
-
"layout-pb-2": true,
|
|
2724
|
-
"layout-pl-3": true,
|
|
2725
|
-
"layout-pr-3": true,
|
|
2726
|
-
"border-br-2": true,
|
|
2727
|
-
"border-bw-1": true,
|
|
2728
|
-
"border-bs-s": true,
|
|
2729
|
-
"color-bgc-n100": true,
|
|
2730
|
-
"color-bc-n70": true,
|
|
2731
|
-
"color-c-n30": true
|
|
2732
|
-
}
|
|
2733
|
-
},
|
|
2734
|
-
Divider: {},
|
|
2735
|
-
Image: {
|
|
2736
|
-
all: {
|
|
2737
|
-
"border-br-5": true,
|
|
2738
|
-
"layout-el-cv": true,
|
|
2739
|
-
"layout-w-100": true,
|
|
2740
|
-
"layout-h-100": true
|
|
2741
|
-
},
|
|
2742
|
-
avatar: { "is-avatar": true },
|
|
2743
|
-
header: {},
|
|
2744
|
-
icon: {},
|
|
2745
|
-
largeFeature: {},
|
|
2746
|
-
mediumFeature: {},
|
|
2747
|
-
smallFeature: {}
|
|
2748
|
-
},
|
|
2749
|
-
Icon: {},
|
|
2750
|
-
List: {
|
|
2751
|
-
"layout-g-4": true,
|
|
2752
|
-
"layout-p-2": true
|
|
2753
|
-
},
|
|
2754
|
-
Modal: {
|
|
2755
|
-
backdrop: { "color-bbgc-n10_20": true },
|
|
2756
|
-
element: {
|
|
2757
|
-
"border-br-2": true,
|
|
2758
|
-
"color-bgc-n100": true,
|
|
2759
|
-
"layout-p-4": true,
|
|
2760
|
-
"border-bw-1": true,
|
|
2761
|
-
"border-bs-s": true,
|
|
2762
|
-
"color-bc-n80": true
|
|
2763
|
-
}
|
|
2764
|
-
},
|
|
2765
|
-
MultipleChoice: {
|
|
2766
|
-
container: {},
|
|
2767
|
-
label: {},
|
|
2768
|
-
element: {}
|
|
2769
|
-
},
|
|
2770
|
-
Row: { "layout-g-4": true },
|
|
2771
|
-
Slider: {
|
|
2772
|
-
container: {},
|
|
2773
|
-
label: {},
|
|
2774
|
-
element: {}
|
|
2775
|
-
},
|
|
2776
|
-
Tabs: {
|
|
2777
|
-
container: {},
|
|
2778
|
-
controls: {
|
|
2779
|
-
all: {},
|
|
2780
|
-
selected: {}
|
|
2781
|
-
},
|
|
2782
|
-
element: {}
|
|
2783
|
-
},
|
|
2784
|
-
Text: {
|
|
2785
|
-
all: {
|
|
2786
|
-
"layout-w-100": true,
|
|
2787
|
-
"layout-g-2": true
|
|
2788
|
-
},
|
|
2789
|
-
h1: {
|
|
2790
|
-
"typography-f-sf": true,
|
|
2791
|
-
"typography-v-r": true,
|
|
2792
|
-
"typography-w-400": true,
|
|
2793
|
-
"layout-m-0": true,
|
|
2794
|
-
"layout-p-0": true,
|
|
2795
|
-
"typography-sz-tl": true
|
|
2796
|
-
},
|
|
2797
|
-
h2: {
|
|
2798
|
-
"typography-f-sf": true,
|
|
2799
|
-
"typography-v-r": true,
|
|
2800
|
-
"typography-w-400": true,
|
|
2801
|
-
"layout-m-0": true,
|
|
2802
|
-
"layout-p-0": true,
|
|
2803
|
-
"typography-sz-tm": true
|
|
2804
|
-
},
|
|
2805
|
-
h3: {
|
|
2806
|
-
"typography-f-sf": true,
|
|
2807
|
-
"typography-v-r": true,
|
|
2808
|
-
"typography-w-400": true,
|
|
2809
|
-
"layout-m-0": true,
|
|
2810
|
-
"layout-p-0": true,
|
|
2811
|
-
"typography-sz-ts": true
|
|
2812
|
-
},
|
|
2813
|
-
h4: {
|
|
2814
|
-
"typography-f-sf": true,
|
|
2815
|
-
"typography-v-r": true,
|
|
2816
|
-
"typography-w-400": true,
|
|
2817
|
-
"layout-m-0": true,
|
|
2818
|
-
"layout-p-0": true,
|
|
2819
|
-
"typography-sz-bl": true
|
|
2820
|
-
},
|
|
2821
|
-
h5: {
|
|
2822
|
-
"typography-f-sf": true,
|
|
2823
|
-
"typography-v-r": true,
|
|
2824
|
-
"typography-w-400": true,
|
|
2825
|
-
"layout-m-0": true,
|
|
2826
|
-
"layout-p-0": true,
|
|
2827
|
-
"typography-sz-bm": true
|
|
2828
|
-
},
|
|
2829
|
-
body: {},
|
|
2830
|
-
caption: {}
|
|
2831
|
-
},
|
|
2832
|
-
TextField: {
|
|
2833
|
-
container: {
|
|
2834
|
-
"typography-sz-bm": true,
|
|
2835
|
-
"layout-w-100": true,
|
|
2836
|
-
"layout-g-2": true,
|
|
2837
|
-
"layout-dsp-flexvert": true
|
|
2838
|
-
},
|
|
2839
|
-
label: { "layout-flx-0": true },
|
|
2840
|
-
element: {
|
|
2841
|
-
"typography-sz-bm": true,
|
|
2842
|
-
"layout-pt-2": true,
|
|
2843
|
-
"layout-pb-2": true,
|
|
2844
|
-
"layout-pl-3": true,
|
|
2845
|
-
"layout-pr-3": true,
|
|
2846
|
-
"border-br-2": true,
|
|
2847
|
-
"border-bw-1": true,
|
|
2848
|
-
"border-bs-s": true,
|
|
2849
|
-
"color-bgc-n100": true,
|
|
2850
|
-
"color-bc-n70": true,
|
|
2851
|
-
"color-c-n30": true
|
|
2852
|
-
}
|
|
2853
|
-
},
|
|
2854
|
-
Video: {
|
|
2855
|
-
"border-br-5": true,
|
|
2856
|
-
"layout-el-cv": true
|
|
2857
|
-
}
|
|
2858
|
-
},
|
|
2859
|
-
elements: {
|
|
2860
|
-
a: aLight,
|
|
2861
|
-
audio,
|
|
2862
|
-
body: bodyLight,
|
|
2863
|
-
button: buttonLight,
|
|
2864
|
-
em: { "typography-fs-n": true },
|
|
2865
|
-
h1: h1Light,
|
|
2866
|
-
h2: h2Light,
|
|
2867
|
-
h3: h3Light,
|
|
2868
|
-
h4: {},
|
|
2869
|
-
h5: {},
|
|
2870
|
-
iframe,
|
|
2871
|
-
input: inputLight,
|
|
2872
|
-
p: pLight,
|
|
2873
|
-
pre: preLight,
|
|
2874
|
-
textarea: textareaLight,
|
|
2875
|
-
video
|
|
2876
|
-
},
|
|
2877
|
-
markdown: {
|
|
2878
|
-
p: [...Object.keys(pLight)],
|
|
2879
|
-
h1: [...Object.keys(h1Light)],
|
|
2880
|
-
h2: [...Object.keys(h2Light)],
|
|
2881
|
-
h3: [...Object.keys(h3Light)],
|
|
2882
|
-
h4: [],
|
|
2883
|
-
h5: [],
|
|
2884
|
-
ul: [...Object.keys(unorderedListLight)],
|
|
2885
|
-
ol: [...Object.keys(orderedListLight)],
|
|
2886
|
-
li: [...Object.keys(listItemLight)],
|
|
2887
|
-
a: [...Object.keys(aLight)],
|
|
2888
|
-
strong: [],
|
|
2889
|
-
em: ["typography-fs-n"]
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
|
-
//#endregion
|
|
2894
|
-
//#region src/A2UIViewer.tsx
|
|
2895
|
-
let initialized = false;
|
|
2896
|
-
function ensureInitialized() {
|
|
2897
|
-
if (!initialized) {
|
|
2898
|
-
initializeDefaultCatalog();
|
|
2899
|
-
injectStyles();
|
|
2900
|
-
initialized = true;
|
|
1938
|
+
function zodSchemaToSimpleObject(schema) {
|
|
1939
|
+
const shape = schema.shape;
|
|
1940
|
+
const properties = {};
|
|
1941
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
1942
|
+
var _zodValue$_def$typeNa, _zodValue$_def;
|
|
1943
|
+
const zodValue = value;
|
|
1944
|
+
properties[key] = {
|
|
1945
|
+
type: (_zodValue$_def$typeNa = (_zodValue$_def = zodValue._def) === null || _zodValue$_def === void 0 ? void 0 : _zodValue$_def.typeName) !== null && _zodValue$_def$typeNa !== void 0 ? _zodValue$_def$typeNa : "unknown",
|
|
1946
|
+
...zodValue.description ? { description: zodValue.description } : {}
|
|
1947
|
+
};
|
|
2901
1948
|
}
|
|
1949
|
+
return {
|
|
1950
|
+
type: "object",
|
|
1951
|
+
properties
|
|
1952
|
+
};
|
|
2902
1953
|
}
|
|
2903
1954
|
/**
|
|
2904
|
-
*
|
|
2905
|
-
* It re-renders cleanly when props change, discarding previous state.
|
|
1955
|
+
* @deprecated Use `createCatalog(definitions, renderers)` instead.
|
|
2906
1956
|
*/
|
|
2907
|
-
function
|
|
2908
|
-
|
|
2909
|
-
const
|
|
2910
|
-
const
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
const char = definitionKey.charCodeAt(i);
|
|
2915
|
-
hash = (hash << 5) - hash + char;
|
|
2916
|
-
hash = hash & hash;
|
|
2917
|
-
}
|
|
2918
|
-
return `surface${baseId.replace(/:/g, "-")}${hash}`;
|
|
2919
|
-
}, [
|
|
2920
|
-
baseId,
|
|
2921
|
-
root,
|
|
2922
|
-
components
|
|
2923
|
-
]);
|
|
2924
|
-
const handleAction = (0, react.useMemo)(() => {
|
|
2925
|
-
if (!onAction) return void 0;
|
|
2926
|
-
return (message) => {
|
|
2927
|
-
const userAction = message.userAction;
|
|
2928
|
-
if (userAction) {
|
|
2929
|
-
var _userAction$context;
|
|
2930
|
-
onAction({
|
|
2931
|
-
actionName: userAction.name,
|
|
2932
|
-
sourceComponentId: userAction.sourceComponentId,
|
|
2933
|
-
timestamp: userAction.timestamp,
|
|
2934
|
-
context: (_userAction$context = userAction.context) !== null && _userAction$context !== void 0 ? _userAction$context : {}
|
|
2935
|
-
});
|
|
2936
|
-
}
|
|
1957
|
+
function createA2UICatalog(components, options) {
|
|
1958
|
+
const definitions = {};
|
|
1959
|
+
const renderers = {};
|
|
1960
|
+
for (const [name, def] of Object.entries(components)) {
|
|
1961
|
+
definitions[name] = {
|
|
1962
|
+
props: def.props,
|
|
1963
|
+
description: def.description
|
|
2937
1964
|
};
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
style: {
|
|
2942
|
-
padding: 16,
|
|
2943
|
-
color: "#666",
|
|
2944
|
-
fontFamily: "system-ui"
|
|
2945
|
-
},
|
|
2946
|
-
children: "No content to display"
|
|
2947
|
-
});
|
|
2948
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIProvider, {
|
|
2949
|
-
onAction: handleAction,
|
|
2950
|
-
theme,
|
|
2951
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIViewerInner, {
|
|
2952
|
-
surfaceId,
|
|
2953
|
-
root,
|
|
2954
|
-
components,
|
|
2955
|
-
data: data !== null && data !== void 0 ? data : {},
|
|
2956
|
-
styles,
|
|
2957
|
-
className
|
|
2958
|
-
})
|
|
2959
|
-
});
|
|
2960
|
-
}
|
|
2961
|
-
/**
|
|
2962
|
-
* Inner component that processes messages within the provider context.
|
|
2963
|
-
*/
|
|
2964
|
-
function A2UIViewerInner({ surfaceId, root, components, data, styles, className }) {
|
|
2965
|
-
const { processMessages } = useA2UIActions();
|
|
2966
|
-
const lastProcessedRef = (0, react.useRef)("");
|
|
2967
|
-
(0, react.useEffect)(() => {
|
|
2968
|
-
const key = `${surfaceId}-${JSON.stringify(components)}-${JSON.stringify(data)}`;
|
|
2969
|
-
if (key === lastProcessedRef.current) return;
|
|
2970
|
-
lastProcessedRef.current = key;
|
|
2971
|
-
const messages = [{ beginRendering: {
|
|
2972
|
-
surfaceId,
|
|
2973
|
-
root,
|
|
2974
|
-
styles: styles !== null && styles !== void 0 ? styles : {}
|
|
2975
|
-
} }, { surfaceUpdate: {
|
|
2976
|
-
surfaceId,
|
|
2977
|
-
components
|
|
2978
|
-
} }];
|
|
2979
|
-
if (data && Object.keys(data).length > 0) {
|
|
2980
|
-
const contents = objectToValueMaps(data);
|
|
2981
|
-
if (contents.length > 0) messages.push({ dataModelUpdate: {
|
|
2982
|
-
surfaceId,
|
|
2983
|
-
path: "/",
|
|
2984
|
-
contents
|
|
2985
|
-
} });
|
|
2986
|
-
}
|
|
2987
|
-
processMessages(messages);
|
|
2988
|
-
}, [
|
|
2989
|
-
processMessages,
|
|
2990
|
-
surfaceId,
|
|
2991
|
-
root,
|
|
2992
|
-
components,
|
|
2993
|
-
data,
|
|
2994
|
-
styles
|
|
2995
|
-
]);
|
|
2996
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2997
|
-
className,
|
|
2998
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIRenderer, { surfaceId })
|
|
2999
|
-
});
|
|
3000
|
-
}
|
|
3001
|
-
/**
|
|
3002
|
-
* Converts a nested JavaScript object to the ValueMap[] format
|
|
3003
|
-
* expected by A2UI's dataModelUpdate message.
|
|
3004
|
-
*/
|
|
3005
|
-
function objectToValueMaps(obj) {
|
|
3006
|
-
return Object.entries(obj).map(([key, value]) => valueToValueMap(key, value));
|
|
1965
|
+
renderers[name] = def.render;
|
|
1966
|
+
}
|
|
1967
|
+
return createCatalog(definitions, renderers, options);
|
|
3007
1968
|
}
|
|
3008
1969
|
/**
|
|
3009
|
-
*
|
|
1970
|
+
* @deprecated Use `extractSchema(definitions)` instead.
|
|
3010
1971
|
*/
|
|
3011
|
-
function
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
if (typeof value === "number") return {
|
|
3017
|
-
key,
|
|
3018
|
-
valueNumber: value
|
|
3019
|
-
};
|
|
3020
|
-
if (typeof value === "boolean") return {
|
|
3021
|
-
key,
|
|
3022
|
-
valueBoolean: value
|
|
3023
|
-
};
|
|
3024
|
-
if (value === null || value === void 0) return { key };
|
|
3025
|
-
if (Array.isArray(value)) return {
|
|
3026
|
-
key,
|
|
3027
|
-
valueMap: value.map((item, index) => valueToValueMap(String(index), item))
|
|
1972
|
+
function extractA2UISchema(components) {
|
|
1973
|
+
const definitions = {};
|
|
1974
|
+
for (const [name, def] of Object.entries(components)) definitions[name] = {
|
|
1975
|
+
props: def.props,
|
|
1976
|
+
description: def.description
|
|
3028
1977
|
};
|
|
3029
|
-
|
|
3030
|
-
key,
|
|
3031
|
-
valueMap: objectToValueMaps(value)
|
|
3032
|
-
};
|
|
3033
|
-
return { key };
|
|
1978
|
+
return extractSchema(definitions);
|
|
3034
1979
|
}
|
|
3035
1980
|
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region src/react-renderer/styles/index.ts
|
|
1983
|
+
/**
|
|
1984
|
+
* v0.9: Styles are now handled by a2ui-react components internally.
|
|
1985
|
+
* These functions are kept as no-ops for backward compatibility.
|
|
1986
|
+
*/
|
|
1987
|
+
function injectStyles() {}
|
|
1988
|
+
function removeStyles() {}
|
|
1989
|
+
|
|
1990
|
+
//#endregion
|
|
1991
|
+
//#region src/react-renderer/index.ts
|
|
1992
|
+
function registerDefaultCatalog() {}
|
|
1993
|
+
function initializeDefaultCatalog() {}
|
|
1994
|
+
const defaultTheme = {};
|
|
1995
|
+
const litTheme = defaultTheme;
|
|
1996
|
+
|
|
3036
1997
|
//#endregion
|
|
3037
1998
|
//#region src/a2ui-types.ts
|
|
3038
|
-
|
|
1999
|
+
/** Default surface ID when none is specified */
|
|
2000
|
+
const DEFAULT_SURFACE_ID = "default";
|
|
2001
|
+
|
|
2002
|
+
//#endregion
|
|
2003
|
+
//#region src/index.ts
|
|
2004
|
+
const viewerTheme = {};
|
|
3039
2005
|
|
|
3040
2006
|
//#endregion
|
|
3041
2007
|
exports.A2UIProvider = A2UIProvider;
|
|
3042
2008
|
exports.A2UIRenderer = A2UIRenderer;
|
|
3043
|
-
exports.
|
|
3044
|
-
exports
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
exports.ComponentRegistry = ComponentRegistry;
|
|
2009
|
+
exports.A2UI_SCHEMA_CONTEXT_DESCRIPTION = A2UI_SCHEMA_CONTEXT_DESCRIPTION;
|
|
2010
|
+
Object.defineProperty(exports, 'Catalog', {
|
|
2011
|
+
enumerable: true,
|
|
2012
|
+
get: function () {
|
|
2013
|
+
return _a2ui_web_core_v0_9.Catalog;
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
3051
2016
|
exports.DEFAULT_SURFACE_ID = DEFAULT_SURFACE_ID;
|
|
3052
|
-
exports.DateTimeInput = DateTimeInput;
|
|
3053
|
-
exports.Divider = Divider;
|
|
3054
|
-
exports.Icon = Icon;
|
|
3055
|
-
exports.Image = Image;
|
|
3056
|
-
exports.List = List;
|
|
3057
|
-
exports.Modal = Modal;
|
|
3058
|
-
exports.MultipleChoice = MultipleChoice;
|
|
3059
|
-
exports.Row = Row;
|
|
3060
|
-
exports.Slider = Slider;
|
|
3061
|
-
exports.Tabs = Tabs;
|
|
3062
|
-
exports.Text = Text;
|
|
3063
|
-
exports.TextField = TextField;
|
|
3064
2017
|
exports.ThemeProvider = ThemeProvider;
|
|
3065
|
-
exports.
|
|
3066
|
-
exports.
|
|
2018
|
+
exports.basicCatalog = basicCatalog;
|
|
2019
|
+
exports.buildCatalogContextValue = buildCatalogContextValue;
|
|
3067
2020
|
exports.cn = cn;
|
|
2021
|
+
exports.createA2UICatalog = createA2UICatalog;
|
|
2022
|
+
exports.createCatalog = createCatalog;
|
|
2023
|
+
exports.createReactComponent = createReactComponent;
|
|
3068
2024
|
exports.defaultTheme = defaultTheme;
|
|
2025
|
+
exports.extendsBasicCatalog = extendsBasicCatalog;
|
|
2026
|
+
exports.extractA2UISchema = extractA2UISchema;
|
|
2027
|
+
exports.extractCatalogComponentSchemas = extractCatalogComponentSchemas;
|
|
2028
|
+
exports.extractSchema = extractSchema;
|
|
2029
|
+
exports.getCustomComponentNames = getCustomComponentNames;
|
|
3069
2030
|
exports.initializeDefaultCatalog = initializeDefaultCatalog;
|
|
3070
2031
|
exports.injectStyles = injectStyles;
|
|
3071
2032
|
exports.litTheme = litTheme;
|
|
3072
2033
|
exports.registerDefaultCatalog = registerDefaultCatalog;
|
|
3073
2034
|
exports.removeStyles = removeStyles;
|
|
3074
|
-
exports.stylesToObject = stylesToObject;
|
|
3075
2035
|
exports.useA2UI = useA2UI;
|
|
3076
2036
|
exports.useA2UIActions = useA2UIActions;
|
|
3077
|
-
exports.useA2UIComponent = useA2UIComponent;
|
|
3078
2037
|
exports.useA2UIContext = useA2UIContext;
|
|
2038
|
+
exports.useA2UIError = useA2UIError;
|
|
3079
2039
|
exports.useA2UIState = useA2UIState;
|
|
3080
2040
|
exports.useA2UIStore = useA2UIStore;
|
|
3081
2041
|
exports.useA2UIStoreSelector = useA2UIStoreSelector;
|
|
3082
2042
|
exports.useTheme = useTheme;
|
|
3083
2043
|
exports.useThemeOptional = useThemeOptional;
|
|
3084
|
-
exports.viewerTheme =
|
|
2044
|
+
exports.viewerTheme = viewerTheme;
|
|
3085
2045
|
});
|
|
3086
2046
|
//# sourceMappingURL=index.umd.js.map
|