@copilotkit/a2ui-renderer 1.55.0-next.8 → 1.55.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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_runtime.__toESM(react);
|
|
4
|
+
let _a2ui_web_core_v0_9 = require("@a2ui/web_core/v0_9");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
//#region src/react-renderer/a2ui-react/A2uiSurface.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Copyright 2026 Google LLC
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
const ResolvedChild = (0, react.memo)(({ surface, id, basePath, compImpl, componentModel }) => {
|
|
24
|
+
const ComponentToRender = compImpl.render;
|
|
25
|
+
const context = (0, react.useMemo)(() => new _a2ui_web_core_v0_9.ComponentContext(surface, id, basePath), [
|
|
26
|
+
surface,
|
|
27
|
+
id,
|
|
28
|
+
basePath,
|
|
29
|
+
componentModel
|
|
30
|
+
]);
|
|
31
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentToRender, {
|
|
32
|
+
context,
|
|
33
|
+
buildChild: (0, react.useCallback)((childId, specificPath) => {
|
|
34
|
+
const path = specificPath || context.dataContext.path;
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
|
|
36
|
+
surface,
|
|
37
|
+
id: childId,
|
|
38
|
+
basePath: path
|
|
39
|
+
}, `${childId}-${path}`);
|
|
40
|
+
}, [surface, context.dataContext.path])
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
ResolvedChild.displayName = "ResolvedChild";
|
|
44
|
+
const DeferredChild = (0, react.memo)(({ surface, id, basePath }) => {
|
|
45
|
+
const store = (0, react.useMemo)(() => {
|
|
46
|
+
let version = 0;
|
|
47
|
+
return {
|
|
48
|
+
subscribe: (cb) => {
|
|
49
|
+
const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {
|
|
50
|
+
if (comp.id === id) {
|
|
51
|
+
version++;
|
|
52
|
+
cb();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {
|
|
56
|
+
if (delId === id) {
|
|
57
|
+
version++;
|
|
58
|
+
cb();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return () => {
|
|
62
|
+
unsub1.unsubscribe();
|
|
63
|
+
unsub2.unsubscribe();
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
getSnapshot: () => {
|
|
67
|
+
const comp = surface.componentsModel.get(id);
|
|
68
|
+
return comp ? `${comp.type}-${version}` : `missing-${version}`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, [surface, id]);
|
|
72
|
+
(0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
73
|
+
const componentModel = surface.componentsModel.get(id);
|
|
74
|
+
if (!componentModel) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
75
|
+
style: {
|
|
76
|
+
padding: "12px 16px",
|
|
77
|
+
borderRadius: "8px",
|
|
78
|
+
background: "linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)",
|
|
79
|
+
backgroundSize: "200% 100%",
|
|
80
|
+
animation: "a2ui-shimmer 1.5s ease-in-out infinite",
|
|
81
|
+
minHeight: "2rem"
|
|
82
|
+
},
|
|
83
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: `@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }` })
|
|
84
|
+
});
|
|
85
|
+
const compImpl = surface.catalog.components.get(componentModel.type);
|
|
86
|
+
if (!compImpl) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
87
|
+
style: { color: "red" },
|
|
88
|
+
children: ["Unknown component: ", componentModel.type]
|
|
89
|
+
});
|
|
90
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedChild, {
|
|
91
|
+
surface,
|
|
92
|
+
id,
|
|
93
|
+
basePath,
|
|
94
|
+
componentModel,
|
|
95
|
+
compImpl
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
DeferredChild.displayName = "DeferredChild";
|
|
99
|
+
const A2uiSurface = ({ surface }) => {
|
|
100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
|
|
101
|
+
surface,
|
|
102
|
+
id: "root",
|
|
103
|
+
basePath: "/"
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
exports.A2uiSurface = A2uiSurface;
|
|
109
|
+
exports.DeferredChild = DeferredChild;
|
|
110
|
+
//# sourceMappingURL=A2uiSurface.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2uiSurface.cjs","names":["ComponentContext"],"sources":["../../../src/react-renderer/a2ui-react/A2uiSurface.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useSyncExternalStore, memo, useMemo, useCallback } from \"react\";\nimport {\n type SurfaceModel,\n ComponentContext,\n type ComponentModel,\n} from \"@a2ui/web_core/v0_9\";\nimport type { ReactComponentImplementation } from \"./adapter\";\n\nconst ResolvedChild = memo(\n ({\n surface,\n id,\n basePath,\n compImpl,\n componentModel,\n }: {\n surface: SurfaceModel<ReactComponentImplementation>;\n id: string;\n basePath: string;\n componentModel: ComponentModel;\n compImpl: ReactComponentImplementation;\n }) => {\n const ComponentToRender = compImpl.render;\n\n // Create context. Recreate if the componentModel instance changes (e.g. type change recreation).\n const context = useMemo(\n () => new ComponentContext(surface, id, basePath),\n // componentModel is used as a trigger for recreation even if not in the body\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [surface, id, basePath, componentModel],\n );\n\n const buildChild = useCallback(\n (childId: string, specificPath?: string) => {\n const path = specificPath || context.dataContext.path;\n return (\n <DeferredChild\n key={`${childId}-${path}`}\n surface={surface}\n id={childId}\n basePath={path}\n />\n );\n },\n [surface, context.dataContext.path],\n );\n\n return <ComponentToRender context={context} buildChild={buildChild} />;\n },\n);\nResolvedChild.displayName = \"ResolvedChild\";\n\nexport const DeferredChild: React.FC<{\n surface: SurfaceModel<ReactComponentImplementation>;\n id: string;\n basePath: string;\n}> = memo(({ surface, id, basePath }) => {\n // 1. Subscribe specifically to this component's existence\n const store = useMemo(() => {\n let version = 0;\n return {\n subscribe: (cb: () => void) => {\n const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {\n if (comp.id === id) {\n version++;\n cb();\n }\n });\n const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {\n if (delId === id) {\n version++;\n cb();\n }\n });\n return () => {\n unsub1.unsubscribe();\n unsub2.unsubscribe();\n };\n },\n getSnapshot: () => {\n const comp = surface.componentsModel.get(id);\n // We use instance identity + version as the snapshot to ensure\n // type replacements (e.g. Button -> Text) trigger a re-render.\n return comp ? `${comp.type}-${version}` : `missing-${version}`;\n },\n };\n }, [surface, id]);\n\n useSyncExternalStore(store.subscribe, store.getSnapshot);\n\n const componentModel = surface.componentsModel.get(id);\n\n if (!componentModel) {\n return (\n <div\n style={{\n padding: \"12px 16px\",\n borderRadius: \"8px\",\n background:\n \"linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)\",\n backgroundSize: \"200% 100%\",\n animation: \"a2ui-shimmer 1.5s ease-in-out infinite\",\n minHeight: \"2rem\",\n }}\n >\n <style>{`@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }`}</style>\n </div>\n );\n }\n\n const compImpl = surface.catalog.components.get(componentModel.type);\n\n if (!compImpl) {\n return (\n <div style={{ color: \"red\" }}>\n Unknown component: {componentModel.type}\n </div>\n );\n }\n\n return (\n <ResolvedChild\n surface={surface}\n id={id}\n basePath={basePath}\n componentModel={componentModel}\n compImpl={compImpl}\n />\n );\n});\nDeferredChild.displayName = \"DeferredChild\";\n\nexport const A2uiSurface: React.FC<{\n surface: SurfaceModel<ReactComponentImplementation>;\n}> = ({ surface }) => {\n // The root component always has ID 'root' and base path '/'\n return <DeferredChild surface={surface} id=\"root\" basePath=\"/\" />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,iCACH,EACC,SACA,IACA,UACA,UACA,qBAOI;CACJ,MAAM,oBAAoB,SAAS;CAGnC,MAAM,mCACE,IAAIA,qCAAiB,SAAS,IAAI,SAAS,EAGjD;EAAC;EAAS;EAAI;EAAU;EAAe,CACxC;AAiBD,QAAO,2CAAC;EAA2B;EAAS,oCAdzC,SAAiB,iBAA0B;GAC1C,MAAM,OAAO,gBAAgB,QAAQ,YAAY;AACjD,UACE,2CAAC;IAEU;IACT,IAAI;IACJ,UAAU;MAHL,GAAG,QAAQ,GAAG,OAInB;KAGN,CAAC,SAAS,QAAQ,YAAY,KAAK,CACpC;GAEqE;EAEzE;AACD,cAAc,cAAc;AAE5B,MAAa,iCAIF,EAAE,SAAS,IAAI,eAAe;CAEvC,MAAM,iCAAsB;EAC1B,IAAI,UAAU;AACd,SAAO;GACL,YAAY,OAAmB;IAC7B,MAAM,SAAS,QAAQ,gBAAgB,UAAU,WAAW,SAAS;AACnE,SAAI,KAAK,OAAO,IAAI;AAClB;AACA,UAAI;;MAEN;IACF,MAAM,SAAS,QAAQ,gBAAgB,UAAU,WAAW,UAAU;AACpE,SAAI,UAAU,IAAI;AAChB;AACA,UAAI;;MAEN;AACF,iBAAa;AACX,YAAO,aAAa;AACpB,YAAO,aAAa;;;GAGxB,mBAAmB;IACjB,MAAM,OAAO,QAAQ,gBAAgB,IAAI,GAAG;AAG5C,WAAO,OAAO,GAAG,KAAK,KAAK,GAAG,YAAY,WAAW;;GAExD;IACA,CAAC,SAAS,GAAG,CAAC;AAEjB,iCAAqB,MAAM,WAAW,MAAM,YAAY;CAExD,MAAM,iBAAiB,QAAQ,gBAAgB,IAAI,GAAG;AAEtD,KAAI,CAAC,eACH,QACE,2CAAC;EACC,OAAO;GACL,SAAS;GACT,cAAc;GACd,YACE;GACF,gBAAgB;GAChB,WAAW;GACX,WAAW;GACZ;YAED,2CAAC,qBAAO,2GAAiH;GACrH;CAIV,MAAM,WAAW,QAAQ,QAAQ,WAAW,IAAI,eAAe,KAAK;AAEpE,KAAI,CAAC,SACH,QACE,4CAAC;EAAI,OAAO,EAAE,OAAO,OAAO;aAAE,uBACR,eAAe;GAC/B;AAIV,QACE,2CAAC;EACU;EACL;EACM;EACM;EACN;GACV;EAEJ;AACF,cAAc,cAAc;AAE5B,MAAa,eAEP,EAAE,cAAc;AAEpB,QAAO,2CAAC;EAAuB;EAAS,IAAG;EAAO,UAAS;GAAM"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { memo, useCallback, useMemo, useSyncExternalStore } from "react";
|
|
2
|
+
import { ComponentContext } from "@a2ui/web_core/v0_9";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/react-renderer/a2ui-react/A2uiSurface.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
const ResolvedChild = memo(({ surface, id, basePath, compImpl, componentModel }) => {
|
|
22
|
+
const ComponentToRender = compImpl.render;
|
|
23
|
+
const context = useMemo(() => new ComponentContext(surface, id, basePath), [
|
|
24
|
+
surface,
|
|
25
|
+
id,
|
|
26
|
+
basePath,
|
|
27
|
+
componentModel
|
|
28
|
+
]);
|
|
29
|
+
return /* @__PURE__ */ jsx(ComponentToRender, {
|
|
30
|
+
context,
|
|
31
|
+
buildChild: useCallback((childId, specificPath) => {
|
|
32
|
+
const path = specificPath || context.dataContext.path;
|
|
33
|
+
return /* @__PURE__ */ jsx(DeferredChild, {
|
|
34
|
+
surface,
|
|
35
|
+
id: childId,
|
|
36
|
+
basePath: path
|
|
37
|
+
}, `${childId}-${path}`);
|
|
38
|
+
}, [surface, context.dataContext.path])
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
ResolvedChild.displayName = "ResolvedChild";
|
|
42
|
+
const DeferredChild = memo(({ surface, id, basePath }) => {
|
|
43
|
+
const store = useMemo(() => {
|
|
44
|
+
let version = 0;
|
|
45
|
+
return {
|
|
46
|
+
subscribe: (cb) => {
|
|
47
|
+
const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {
|
|
48
|
+
if (comp.id === id) {
|
|
49
|
+
version++;
|
|
50
|
+
cb();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {
|
|
54
|
+
if (delId === id) {
|
|
55
|
+
version++;
|
|
56
|
+
cb();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
unsub1.unsubscribe();
|
|
61
|
+
unsub2.unsubscribe();
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
getSnapshot: () => {
|
|
65
|
+
const comp = surface.componentsModel.get(id);
|
|
66
|
+
return comp ? `${comp.type}-${version}` : `missing-${version}`;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [surface, id]);
|
|
70
|
+
useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
71
|
+
const componentModel = surface.componentsModel.get(id);
|
|
72
|
+
if (!componentModel) return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
style: {
|
|
74
|
+
padding: "12px 16px",
|
|
75
|
+
borderRadius: "8px",
|
|
76
|
+
background: "linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)",
|
|
77
|
+
backgroundSize: "200% 100%",
|
|
78
|
+
animation: "a2ui-shimmer 1.5s ease-in-out infinite",
|
|
79
|
+
minHeight: "2rem"
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ jsx("style", { children: `@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }` })
|
|
82
|
+
});
|
|
83
|
+
const compImpl = surface.catalog.components.get(componentModel.type);
|
|
84
|
+
if (!compImpl) return /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
style: { color: "red" },
|
|
86
|
+
children: ["Unknown component: ", componentModel.type]
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ jsx(ResolvedChild, {
|
|
89
|
+
surface,
|
|
90
|
+
id,
|
|
91
|
+
basePath,
|
|
92
|
+
componentModel,
|
|
93
|
+
compImpl
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
DeferredChild.displayName = "DeferredChild";
|
|
97
|
+
const A2uiSurface = ({ surface }) => {
|
|
98
|
+
return /* @__PURE__ */ jsx(DeferredChild, {
|
|
99
|
+
surface,
|
|
100
|
+
id: "root",
|
|
101
|
+
basePath: "/"
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { A2uiSurface, DeferredChild };
|
|
107
|
+
//# sourceMappingURL=A2uiSurface.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2uiSurface.mjs","names":[],"sources":["../../../src/react-renderer/a2ui-react/A2uiSurface.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useSyncExternalStore, memo, useMemo, useCallback } from \"react\";\nimport {\n type SurfaceModel,\n ComponentContext,\n type ComponentModel,\n} from \"@a2ui/web_core/v0_9\";\nimport type { ReactComponentImplementation } from \"./adapter\";\n\nconst ResolvedChild = memo(\n ({\n surface,\n id,\n basePath,\n compImpl,\n componentModel,\n }: {\n surface: SurfaceModel<ReactComponentImplementation>;\n id: string;\n basePath: string;\n componentModel: ComponentModel;\n compImpl: ReactComponentImplementation;\n }) => {\n const ComponentToRender = compImpl.render;\n\n // Create context. Recreate if the componentModel instance changes (e.g. type change recreation).\n const context = useMemo(\n () => new ComponentContext(surface, id, basePath),\n // componentModel is used as a trigger for recreation even if not in the body\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [surface, id, basePath, componentModel],\n );\n\n const buildChild = useCallback(\n (childId: string, specificPath?: string) => {\n const path = specificPath || context.dataContext.path;\n return (\n <DeferredChild\n key={`${childId}-${path}`}\n surface={surface}\n id={childId}\n basePath={path}\n />\n );\n },\n [surface, context.dataContext.path],\n );\n\n return <ComponentToRender context={context} buildChild={buildChild} />;\n },\n);\nResolvedChild.displayName = \"ResolvedChild\";\n\nexport const DeferredChild: React.FC<{\n surface: SurfaceModel<ReactComponentImplementation>;\n id: string;\n basePath: string;\n}> = memo(({ surface, id, basePath }) => {\n // 1. Subscribe specifically to this component's existence\n const store = useMemo(() => {\n let version = 0;\n return {\n subscribe: (cb: () => void) => {\n const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {\n if (comp.id === id) {\n version++;\n cb();\n }\n });\n const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {\n if (delId === id) {\n version++;\n cb();\n }\n });\n return () => {\n unsub1.unsubscribe();\n unsub2.unsubscribe();\n };\n },\n getSnapshot: () => {\n const comp = surface.componentsModel.get(id);\n // We use instance identity + version as the snapshot to ensure\n // type replacements (e.g. Button -> Text) trigger a re-render.\n return comp ? `${comp.type}-${version}` : `missing-${version}`;\n },\n };\n }, [surface, id]);\n\n useSyncExternalStore(store.subscribe, store.getSnapshot);\n\n const componentModel = surface.componentsModel.get(id);\n\n if (!componentModel) {\n return (\n <div\n style={{\n padding: \"12px 16px\",\n borderRadius: \"8px\",\n background:\n \"linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)\",\n backgroundSize: \"200% 100%\",\n animation: \"a2ui-shimmer 1.5s ease-in-out infinite\",\n minHeight: \"2rem\",\n }}\n >\n <style>{`@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }`}</style>\n </div>\n );\n }\n\n const compImpl = surface.catalog.components.get(componentModel.type);\n\n if (!compImpl) {\n return (\n <div style={{ color: \"red\" }}>\n Unknown component: {componentModel.type}\n </div>\n );\n }\n\n return (\n <ResolvedChild\n surface={surface}\n id={id}\n basePath={basePath}\n componentModel={componentModel}\n compImpl={compImpl}\n />\n );\n});\nDeferredChild.displayName = \"DeferredChild\";\n\nexport const A2uiSurface: React.FC<{\n surface: SurfaceModel<ReactComponentImplementation>;\n}> = ({ surface }) => {\n // The root component always has ID 'root' and base path '/'\n return <DeferredChild surface={surface} id=\"root\" basePath=\"/\" />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,gBAAgB,MACnB,EACC,SACA,IACA,UACA,UACA,qBAOI;CACJ,MAAM,oBAAoB,SAAS;CAGnC,MAAM,UAAU,cACR,IAAI,iBAAiB,SAAS,IAAI,SAAS,EAGjD;EAAC;EAAS;EAAI;EAAU;EAAe,CACxC;AAiBD,QAAO,oBAAC;EAA2B;EAAS,YAfzB,aAChB,SAAiB,iBAA0B;GAC1C,MAAM,OAAO,gBAAgB,QAAQ,YAAY;AACjD,UACE,oBAAC;IAEU;IACT,IAAI;IACJ,UAAU;MAHL,GAAG,QAAQ,GAAG,OAInB;KAGN,CAAC,SAAS,QAAQ,YAAY,KAAK,CACpC;GAEqE;EAEzE;AACD,cAAc,cAAc;AAE5B,MAAa,gBAIR,MAAM,EAAE,SAAS,IAAI,eAAe;CAEvC,MAAM,QAAQ,cAAc;EAC1B,IAAI,UAAU;AACd,SAAO;GACL,YAAY,OAAmB;IAC7B,MAAM,SAAS,QAAQ,gBAAgB,UAAU,WAAW,SAAS;AACnE,SAAI,KAAK,OAAO,IAAI;AAClB;AACA,UAAI;;MAEN;IACF,MAAM,SAAS,QAAQ,gBAAgB,UAAU,WAAW,UAAU;AACpE,SAAI,UAAU,IAAI;AAChB;AACA,UAAI;;MAEN;AACF,iBAAa;AACX,YAAO,aAAa;AACpB,YAAO,aAAa;;;GAGxB,mBAAmB;IACjB,MAAM,OAAO,QAAQ,gBAAgB,IAAI,GAAG;AAG5C,WAAO,OAAO,GAAG,KAAK,KAAK,GAAG,YAAY,WAAW;;GAExD;IACA,CAAC,SAAS,GAAG,CAAC;AAEjB,sBAAqB,MAAM,WAAW,MAAM,YAAY;CAExD,MAAM,iBAAiB,QAAQ,gBAAgB,IAAI,GAAG;AAEtD,KAAI,CAAC,eACH,QACE,oBAAC;EACC,OAAO;GACL,SAAS;GACT,cAAc;GACd,YACE;GACF,gBAAgB;GAChB,WAAW;GACX,WAAW;GACZ;YAED,oBAAC,qBAAO,2GAAiH;GACrH;CAIV,MAAM,WAAW,QAAQ,QAAQ,WAAW,IAAI,eAAe,KAAK;AAEpE,KAAI,CAAC,SACH,QACE,qBAAC;EAAI,OAAO,EAAE,OAAO,OAAO;aAAE,uBACR,eAAe;GAC/B;AAIV,QACE,oBAAC;EACU;EACL;EACM;EACM;EACN;GACV;EAEJ;AACF,cAAc,cAAc;AAE5B,MAAa,eAEP,EAAE,cAAc;AAEpB,QAAO,oBAAC;EAAuB;EAAS,IAAG;EAAO,UAAS;GAAM"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_runtime.__toESM(react);
|
|
4
|
+
let _a2ui_web_core_v0_9 = require("@a2ui/web_core/v0_9");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
//#region src/react-renderer/a2ui-react/adapter.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Copyright 2026 Google LLC
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Creates a React component implementation using the deep generic binder.
|
|
25
|
+
*/
|
|
26
|
+
function createReactComponent(api, RenderComponent) {
|
|
27
|
+
const MemoizedRender = (0, react.memo)(RenderComponent, (prev, next) => {
|
|
28
|
+
if (prev.props !== next.props) return false;
|
|
29
|
+
if (prev.context.componentModel.id !== next.context.componentModel.id) return false;
|
|
30
|
+
if (prev.context.dataContext.path !== next.context.dataContext.path) return false;
|
|
31
|
+
return true;
|
|
32
|
+
});
|
|
33
|
+
const ReactWrapper = ({ context, buildChild }) => {
|
|
34
|
+
const bindingRef = (0, react.useRef)(null);
|
|
35
|
+
if (!bindingRef.current) bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
|
|
36
|
+
else if (bindingRef.current.context !== context) {
|
|
37
|
+
bindingRef.current.dispose();
|
|
38
|
+
bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
|
|
39
|
+
}
|
|
40
|
+
const binding = bindingRef.current;
|
|
41
|
+
const props = (0, react.useSyncExternalStore)((0, react.useCallback)((callback) => {
|
|
42
|
+
const sub = binding.subscribe(callback);
|
|
43
|
+
return () => sub.unsubscribe();
|
|
44
|
+
}, [binding]), (0, react.useCallback)(() => binding.snapshot, [binding]));
|
|
45
|
+
(0, react.useEffect)(() => {
|
|
46
|
+
return () => binding.dispose();
|
|
47
|
+
}, [binding]);
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedRender, {
|
|
49
|
+
props: props || {},
|
|
50
|
+
buildChild,
|
|
51
|
+
context
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
name: api.name,
|
|
56
|
+
schema: api.schema,
|
|
57
|
+
render: ReactWrapper
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.createReactComponent = createReactComponent;
|
|
63
|
+
//# sourceMappingURL=adapter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.cjs","names":["GenericBinder"],"sources":["../../../src/react-renderer/a2ui-react/adapter.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n useRef,\n useSyncExternalStore,\n useCallback,\n memo,\n useEffect,\n} from \"react\";\nimport { type ComponentContext, GenericBinder } from \"@a2ui/web_core/v0_9\";\nimport type {\n ComponentApi,\n InferredComponentApiSchemaType,\n ResolveA2uiProps,\n} from \"@a2ui/web_core/v0_9\";\n\nexport interface ReactComponentImplementation extends ComponentApi {\n /** The framework-specific rendering wrapper. */\n render: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }>;\n}\n\nexport type ReactA2uiComponentProps<T> = {\n props: T;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n context: ComponentContext;\n};\n\n// --- Component Factories ---\n\n/**\n * Creates a React component implementation using the deep generic binder.\n */\nexport function createReactComponent<Api extends ComponentApi>(\n api: Api,\n RenderComponent: React.FC<\n ReactA2uiComponentProps<\n ResolveA2uiProps<InferredComponentApiSchemaType<Api>>\n >\n >,\n): ReactComponentImplementation {\n type Props = ResolveA2uiProps<InferredComponentApiSchemaType<Api>>;\n\n const MemoizedRender = memo(RenderComponent, (prev, next) => {\n if (prev.props !== next.props) return false;\n if (prev.context.componentModel.id !== next.context.componentModel.id)\n return false;\n if (prev.context.dataContext.path !== next.context.dataContext.path)\n return false;\n return true;\n });\n\n const ReactWrapper: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }> = ({ context, buildChild }) => {\n const bindingRef = useRef<GenericBinder<Props> | null>(null);\n\n // Create or recreate the binder if the context object changes.\n // DeferredChild memoizes `context`, so reference changes strictly correspond\n // to ComponentModel updates (like type changes) or Base Path adjustments.\n if (!bindingRef.current) {\n bindingRef.current = new GenericBinder<Props>(context, api.schema);\n } else if (\n (bindingRef.current as unknown as { context: ComponentContext })\n .context !== context\n ) {\n bindingRef.current.dispose();\n bindingRef.current = new GenericBinder<Props>(context, api.schema);\n }\n const binding = bindingRef.current;\n\n const subscribe = useCallback(\n (callback: () => void) => {\n const sub = binding.subscribe(callback);\n return () => sub.unsubscribe();\n },\n [binding],\n );\n\n const getSnapshot = useCallback(() => binding.snapshot, [binding]);\n const props = useSyncExternalStore(subscribe, getSnapshot);\n\n // Prevent DataModel subscription leaks on unmount\n useEffect(() => {\n return () => binding.dispose();\n }, [binding]);\n\n return (\n <MemoizedRender\n props={props || ({} as Props)}\n buildChild={buildChild}\n context={context}\n />\n );\n };\n\n return {\n name: api.name,\n schema: api.schema,\n render: ReactWrapper,\n };\n}\n\n/**\n * Creates a React component implementation that manages its own context bindings (no generic binder).\n */\nexport function createBinderlessComponent(\n api: ComponentApi,\n RenderComponent: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }>,\n): ReactComponentImplementation {\n return {\n name: api.name,\n schema: api.schema,\n render: RenderComponent,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgB,qBACd,KACA,iBAK8B;CAG9B,MAAM,iCAAsB,kBAAkB,MAAM,SAAS;AAC3D,MAAI,KAAK,UAAU,KAAK,MAAO,QAAO;AACtC,MAAI,KAAK,QAAQ,eAAe,OAAO,KAAK,QAAQ,eAAe,GACjE,QAAO;AACT,MAAI,KAAK,QAAQ,YAAY,SAAS,KAAK,QAAQ,YAAY,KAC7D,QAAO;AACT,SAAO;GACP;CAEF,MAAM,gBAGA,EAAE,SAAS,iBAAiB;EAChC,MAAM,+BAAiD,KAAK;AAK5D,MAAI,CAAC,WAAW,QACd,YAAW,UAAU,IAAIA,kCAAqB,SAAS,IAAI,OAAO;WAEjE,WAAW,QACT,YAAY,SACf;AACA,cAAW,QAAQ,SAAS;AAC5B,cAAW,UAAU,IAAIA,kCAAqB,SAAS,IAAI,OAAO;;EAEpE,MAAM,UAAU,WAAW;EAW3B,MAAM,gEARH,aAAyB;GACxB,MAAM,MAAM,QAAQ,UAAU,SAAS;AACvC,gBAAa,IAAI,aAAa;KAEhC,CAAC,QAAQ,CACV,+BAEqC,QAAQ,UAAU,CAAC,QAAQ,CAAC,CACR;AAG1D,6BAAgB;AACd,gBAAa,QAAQ,SAAS;KAC7B,CAAC,QAAQ,CAAC;AAEb,SACE,2CAAC;GACC,OAAO,SAAU,EAAE;GACP;GACH;IACT;;AAIN,QAAO;EACL,MAAM,IAAI;EACV,QAAQ,IAAI;EACZ,QAAQ;EACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentApi, ComponentContext, InferredComponentApiSchemaType, ResolveA2uiProps } from "@a2ui/web_core/v0_9";
|
|
3
|
+
|
|
4
|
+
//#region src/react-renderer/a2ui-react/adapter.d.ts
|
|
5
|
+
interface ReactComponentImplementation extends ComponentApi {
|
|
6
|
+
/** The framework-specific rendering wrapper. */
|
|
7
|
+
render: React.FC<{
|
|
8
|
+
context: ComponentContext;
|
|
9
|
+
buildChild: (id: string, basePath?: string) => React.ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
type ReactA2uiComponentProps<T> = {
|
|
13
|
+
props: T;
|
|
14
|
+
buildChild: (id: string, basePath?: string) => React.ReactNode;
|
|
15
|
+
context: ComponentContext;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates a React component implementation using the deep generic binder.
|
|
19
|
+
*/
|
|
20
|
+
declare function createReactComponent<Api extends ComponentApi>(api: Api, RenderComponent: React.FC<ReactA2uiComponentProps<ResolveA2uiProps<InferredComponentApiSchemaType<Api>>>>): ReactComponentImplementation;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ReactA2uiComponentProps, ReactComponentImplementation, createReactComponent };
|
|
23
|
+
//# sourceMappingURL=adapter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.cts","names":[],"sources":["../../../src/react-renderer/a2ui-react/adapter.tsx"],"mappings":";;;;UA8BiB,4BAAA,SAAqC,YAAA;EAIlD;EAFF,MAAA,EAAQ,KAAA,CAAM,EAAA;IACZ,OAAA,EAAS,gBAAA;IACT,UAAA,GAAa,EAAA,UAAY,QAAA,cAAsB,KAAA,CAAM,SAAA;EAAA;AAAA;AAAA,KAI7C,uBAAA;EACV,KAAA,EAAO,CAAA;EACP,UAAA,GAAa,EAAA,UAAY,QAAA,cAAsB,KAAA,CAAM,SAAA;EACrD,OAAA,EAAS,gBAAA;AAAA;;;;iBAQK,oBAAA,aAAiC,YAAA,CAAA,CAC/C,GAAA,EAAK,GAAA,EACL,eAAA,EAAiB,KAAA,CAAM,EAAA,CACrB,uBAAA,CACE,gBAAA,CAAiB,8BAAA,CAA+B,GAAA,OAGnD,4BAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentApi, ComponentContext, InferredComponentApiSchemaType, ResolveA2uiProps } from "@a2ui/web_core/v0_9";
|
|
3
|
+
|
|
4
|
+
//#region src/react-renderer/a2ui-react/adapter.d.ts
|
|
5
|
+
interface ReactComponentImplementation extends ComponentApi {
|
|
6
|
+
/** The framework-specific rendering wrapper. */
|
|
7
|
+
render: React.FC<{
|
|
8
|
+
context: ComponentContext;
|
|
9
|
+
buildChild: (id: string, basePath?: string) => React.ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
type ReactA2uiComponentProps<T> = {
|
|
13
|
+
props: T;
|
|
14
|
+
buildChild: (id: string, basePath?: string) => React.ReactNode;
|
|
15
|
+
context: ComponentContext;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates a React component implementation using the deep generic binder.
|
|
19
|
+
*/
|
|
20
|
+
declare function createReactComponent<Api extends ComponentApi>(api: Api, RenderComponent: React.FC<ReactA2uiComponentProps<ResolveA2uiProps<InferredComponentApiSchemaType<Api>>>>): ReactComponentImplementation;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ReactA2uiComponentProps, ReactComponentImplementation, createReactComponent };
|
|
23
|
+
//# sourceMappingURL=adapter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.mts","names":[],"sources":["../../../src/react-renderer/a2ui-react/adapter.tsx"],"mappings":";;;;UA8BiB,4BAAA,SAAqC,YAAA;EAIlD;EAFF,MAAA,EAAQ,KAAA,CAAM,EAAA;IACZ,OAAA,EAAS,gBAAA;IACT,UAAA,GAAa,EAAA,UAAY,QAAA,cAAsB,KAAA,CAAM,SAAA;EAAA;AAAA;AAAA,KAI7C,uBAAA;EACV,KAAA,EAAO,CAAA;EACP,UAAA,GAAa,EAAA,UAAY,QAAA,cAAsB,KAAA,CAAM,SAAA;EACrD,OAAA,EAAS,gBAAA;AAAA;;;;iBAQK,oBAAA,aAAiC,YAAA,CAAA,CAC/C,GAAA,EAAK,GAAA,EACL,eAAA,EAAiB,KAAA,CAAM,EAAA,CACrB,uBAAA,CACE,gBAAA,CAAiB,8BAAA,CAA+B,GAAA,OAGnD,4BAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { memo, useCallback, useEffect, useRef, useSyncExternalStore } from "react";
|
|
2
|
+
import { GenericBinder } from "@a2ui/web_core/v0_9";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/react-renderer/a2ui-react/adapter.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Creates a React component implementation using the deep generic binder.
|
|
23
|
+
*/
|
|
24
|
+
function createReactComponent(api, RenderComponent) {
|
|
25
|
+
const MemoizedRender = memo(RenderComponent, (prev, next) => {
|
|
26
|
+
if (prev.props !== next.props) return false;
|
|
27
|
+
if (prev.context.componentModel.id !== next.context.componentModel.id) return false;
|
|
28
|
+
if (prev.context.dataContext.path !== next.context.dataContext.path) return false;
|
|
29
|
+
return true;
|
|
30
|
+
});
|
|
31
|
+
const ReactWrapper = ({ context, buildChild }) => {
|
|
32
|
+
const bindingRef = useRef(null);
|
|
33
|
+
if (!bindingRef.current) bindingRef.current = new GenericBinder(context, api.schema);
|
|
34
|
+
else if (bindingRef.current.context !== context) {
|
|
35
|
+
bindingRef.current.dispose();
|
|
36
|
+
bindingRef.current = new GenericBinder(context, api.schema);
|
|
37
|
+
}
|
|
38
|
+
const binding = bindingRef.current;
|
|
39
|
+
const props = useSyncExternalStore(useCallback((callback) => {
|
|
40
|
+
const sub = binding.subscribe(callback);
|
|
41
|
+
return () => sub.unsubscribe();
|
|
42
|
+
}, [binding]), useCallback(() => binding.snapshot, [binding]));
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
return () => binding.dispose();
|
|
45
|
+
}, [binding]);
|
|
46
|
+
return /* @__PURE__ */ jsx(MemoizedRender, {
|
|
47
|
+
props: props || {},
|
|
48
|
+
buildChild,
|
|
49
|
+
context
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
name: api.name,
|
|
54
|
+
schema: api.schema,
|
|
55
|
+
render: ReactWrapper
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { createReactComponent };
|
|
61
|
+
//# sourceMappingURL=adapter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.mjs","names":[],"sources":["../../../src/react-renderer/a2ui-react/adapter.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n useRef,\n useSyncExternalStore,\n useCallback,\n memo,\n useEffect,\n} from \"react\";\nimport { type ComponentContext, GenericBinder } from \"@a2ui/web_core/v0_9\";\nimport type {\n ComponentApi,\n InferredComponentApiSchemaType,\n ResolveA2uiProps,\n} from \"@a2ui/web_core/v0_9\";\n\nexport interface ReactComponentImplementation extends ComponentApi {\n /** The framework-specific rendering wrapper. */\n render: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }>;\n}\n\nexport type ReactA2uiComponentProps<T> = {\n props: T;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n context: ComponentContext;\n};\n\n// --- Component Factories ---\n\n/**\n * Creates a React component implementation using the deep generic binder.\n */\nexport function createReactComponent<Api extends ComponentApi>(\n api: Api,\n RenderComponent: React.FC<\n ReactA2uiComponentProps<\n ResolveA2uiProps<InferredComponentApiSchemaType<Api>>\n >\n >,\n): ReactComponentImplementation {\n type Props = ResolveA2uiProps<InferredComponentApiSchemaType<Api>>;\n\n const MemoizedRender = memo(RenderComponent, (prev, next) => {\n if (prev.props !== next.props) return false;\n if (prev.context.componentModel.id !== next.context.componentModel.id)\n return false;\n if (prev.context.dataContext.path !== next.context.dataContext.path)\n return false;\n return true;\n });\n\n const ReactWrapper: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }> = ({ context, buildChild }) => {\n const bindingRef = useRef<GenericBinder<Props> | null>(null);\n\n // Create or recreate the binder if the context object changes.\n // DeferredChild memoizes `context`, so reference changes strictly correspond\n // to ComponentModel updates (like type changes) or Base Path adjustments.\n if (!bindingRef.current) {\n bindingRef.current = new GenericBinder<Props>(context, api.schema);\n } else if (\n (bindingRef.current as unknown as { context: ComponentContext })\n .context !== context\n ) {\n bindingRef.current.dispose();\n bindingRef.current = new GenericBinder<Props>(context, api.schema);\n }\n const binding = bindingRef.current;\n\n const subscribe = useCallback(\n (callback: () => void) => {\n const sub = binding.subscribe(callback);\n return () => sub.unsubscribe();\n },\n [binding],\n );\n\n const getSnapshot = useCallback(() => binding.snapshot, [binding]);\n const props = useSyncExternalStore(subscribe, getSnapshot);\n\n // Prevent DataModel subscription leaks on unmount\n useEffect(() => {\n return () => binding.dispose();\n }, [binding]);\n\n return (\n <MemoizedRender\n props={props || ({} as Props)}\n buildChild={buildChild}\n context={context}\n />\n );\n };\n\n return {\n name: api.name,\n schema: api.schema,\n render: ReactWrapper,\n };\n}\n\n/**\n * Creates a React component implementation that manages its own context bindings (no generic binder).\n */\nexport function createBinderlessComponent(\n api: ComponentApi,\n RenderComponent: React.FC<{\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n }>,\n): ReactComponentImplementation {\n return {\n name: api.name,\n schema: api.schema,\n render: RenderComponent,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgB,qBACd,KACA,iBAK8B;CAG9B,MAAM,iBAAiB,KAAK,kBAAkB,MAAM,SAAS;AAC3D,MAAI,KAAK,UAAU,KAAK,MAAO,QAAO;AACtC,MAAI,KAAK,QAAQ,eAAe,OAAO,KAAK,QAAQ,eAAe,GACjE,QAAO;AACT,MAAI,KAAK,QAAQ,YAAY,SAAS,KAAK,QAAQ,YAAY,KAC7D,QAAO;AACT,SAAO;GACP;CAEF,MAAM,gBAGA,EAAE,SAAS,iBAAiB;EAChC,MAAM,aAAa,OAAoC,KAAK;AAK5D,MAAI,CAAC,WAAW,QACd,YAAW,UAAU,IAAI,cAAqB,SAAS,IAAI,OAAO;WAEjE,WAAW,QACT,YAAY,SACf;AACA,cAAW,QAAQ,SAAS;AAC5B,cAAW,UAAU,IAAI,cAAqB,SAAS,IAAI,OAAO;;EAEpE,MAAM,UAAU,WAAW;EAW3B,MAAM,QAAQ,qBATI,aACf,aAAyB;GACxB,MAAM,MAAM,QAAQ,UAAU,SAAS;AACvC,gBAAa,IAAI,aAAa;KAEhC,CAAC,QAAQ,CACV,EAEmB,kBAAkB,QAAQ,UAAU,CAAC,QAAQ,CAAC,CACR;AAG1D,kBAAgB;AACd,gBAAa,QAAQ,SAAS;KAC7B,CAAC,QAAQ,CAAC;AAEb,SACE,oBAAC;GACC,OAAO,SAAU,EAAE;GACP;GACH;IACT;;AAIN,QAAO;EACL,MAAM,IAAI;EACV,QAAQ,IAAI;EACZ,QAAQ;EACT"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const require_runtime = require('../../../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_adapter = require('../../../adapter.cjs');
|
|
3
|
+
const require_utils = require('../utils.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _a2ui_web_core_v0_9_basic_catalog = require("@a2ui/web_core/v0_9/basic_catalog");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Copyright 2026 Google LLC
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License.
|
|
15
|
+
* You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
const AudioPlayer = require_adapter.createReactComponent(_a2ui_web_core_v0_9_basic_catalog.AudioPlayerApi, ({ props }) => {
|
|
26
|
+
const style = {
|
|
27
|
+
...require_utils.getBaseLeafStyle(),
|
|
28
|
+
width: "100%"
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
31
|
+
style: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
gap: "4px",
|
|
35
|
+
width: "100%"
|
|
36
|
+
},
|
|
37
|
+
children: [props.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
38
|
+
style: {
|
|
39
|
+
fontSize: "12px",
|
|
40
|
+
color: "#666"
|
|
41
|
+
},
|
|
42
|
+
children: props.description
|
|
43
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
|
|
44
|
+
src: props.url,
|
|
45
|
+
controls: true,
|
|
46
|
+
style
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.AudioPlayer = AudioPlayer;
|
|
53
|
+
//# sourceMappingURL=AudioPlayer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioPlayer.cjs","names":["createReactComponent","AudioPlayerApi","getBaseLeafStyle"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport { createReactComponent } from \"../../../adapter\";\nimport { AudioPlayerApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { getBaseLeafStyle } from \"../utils\";\n\nexport const AudioPlayer = createReactComponent(AudioPlayerApi, ({ props }) => {\n const style: React.CSSProperties = {\n ...getBaseLeafStyle(),\n width: \"100%\",\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n }}\n >\n {props.description && (\n <span style={{ fontSize: \"12px\", color: \"#666\" }}>\n {props.description}\n </span>\n )}\n <audio src={props.url} controls style={style} />\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cAAcA,qCAAqBC,mDAAiB,EAAE,YAAY;CAC7E,MAAM,QAA6B;EACjC,GAAGC,gCAAkB;EACrB,OAAO;EACR;AAED,QACE,4CAAC;EACC,OAAO;GACL,SAAS;GACT,eAAe;GACf,KAAK;GACL,OAAO;GACR;aAEA,MAAM,eACL,2CAAC;GAAK,OAAO;IAAE,UAAU;IAAQ,OAAO;IAAQ;aAC7C,MAAM;IACF,EAET,2CAAC;GAAM,KAAK,MAAM;GAAK;GAAgB;IAAS;GAC5C;EAER"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../index.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../index.mjs";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createReactComponent } from "../../../adapter.mjs";
|
|
2
|
+
import { getBaseLeafStyle } from "../utils.mjs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { AudioPlayerApi } from "@a2ui/web_core/v0_9/basic_catalog";
|
|
6
|
+
|
|
7
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx
|
|
8
|
+
const AudioPlayer = createReactComponent(AudioPlayerApi, ({ props }) => {
|
|
9
|
+
const style = {
|
|
10
|
+
...getBaseLeafStyle(),
|
|
11
|
+
width: "100%"
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
style: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
gap: "4px",
|
|
18
|
+
width: "100%"
|
|
19
|
+
},
|
|
20
|
+
children: [props.description && /* @__PURE__ */ jsx("span", {
|
|
21
|
+
style: {
|
|
22
|
+
fontSize: "12px",
|
|
23
|
+
color: "#666"
|
|
24
|
+
},
|
|
25
|
+
children: props.description
|
|
26
|
+
}), /* @__PURE__ */ jsx("audio", {
|
|
27
|
+
src: props.url,
|
|
28
|
+
controls: true,
|
|
29
|
+
style
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AudioPlayer };
|
|
36
|
+
//# sourceMappingURL=AudioPlayer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioPlayer.mjs","names":[],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport { createReactComponent } from \"../../../adapter\";\nimport { AudioPlayerApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { getBaseLeafStyle } from \"../utils\";\n\nexport const AudioPlayer = createReactComponent(AudioPlayerApi, ({ props }) => {\n const style: React.CSSProperties = {\n ...getBaseLeafStyle(),\n width: \"100%\",\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n }}\n >\n {props.description && (\n <span style={{ fontSize: \"12px\", color: \"#666\" }}>\n {props.description}\n </span>\n )}\n <audio src={props.url} controls style={style} />\n </div>\n );\n});\n"],"mappings":";;;;;;;AAqBA,MAAa,cAAc,qBAAqB,iBAAiB,EAAE,YAAY;CAC7E,MAAM,QAA6B;EACjC,GAAG,kBAAkB;EACrB,OAAO;EACR;AAED,QACE,qBAAC;EACC,OAAO;GACL,SAAS;GACT,eAAe;GACf,KAAK;GACL,OAAO;GACR;aAEA,MAAM,eACL,oBAAC;GAAK,OAAO;IAAE,UAAU;IAAQ,OAAO;IAAQ;aAC7C,MAAM;IACF,EAET,oBAAC;GAAM,KAAK,MAAM;GAAK;GAAgB;IAAS;GAC5C;EAER"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const require_runtime = require('../../../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_adapter = require('../../../adapter.cjs');
|
|
3
|
+
const require_utils = require('../utils.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _a2ui_web_core_v0_9_basic_catalog = require("@a2ui/web_core/v0_9/basic_catalog");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/a2ui-react/catalog/basic/components/Button.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Copyright 2026 Google LLC
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License.
|
|
15
|
+
* You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
const Button = require_adapter.createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ButtonApi, ({ props, buildChild }) => {
|
|
26
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
27
|
+
style: {
|
|
28
|
+
margin: require_utils.LEAF_MARGIN,
|
|
29
|
+
padding: "8px 16px",
|
|
30
|
+
cursor: "pointer",
|
|
31
|
+
border: props.variant === "borderless" ? "none" : "1px solid #ccc",
|
|
32
|
+
backgroundColor: props.variant === "primary" ? "var(--a2ui-primary-color, #007bff)" : props.variant === "borderless" ? "transparent" : "#fff",
|
|
33
|
+
color: props.variant === "primary" ? "#fff" : "inherit",
|
|
34
|
+
borderRadius: "4px",
|
|
35
|
+
display: "inline-flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
justifyContent: "center",
|
|
38
|
+
boxSizing: "border-box"
|
|
39
|
+
},
|
|
40
|
+
onClick: props.action,
|
|
41
|
+
disabled: props.isValid === false,
|
|
42
|
+
children: props.child ? buildChild(props.child) : null
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.Button = Button;
|
|
48
|
+
//# sourceMappingURL=Button.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.cjs","names":["createReactComponent","ButtonApi","LEAF_MARGIN"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/Button.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport { createReactComponent } from \"../../../adapter\";\nimport { ButtonApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { LEAF_MARGIN } from \"../utils\";\n\nexport const Button = createReactComponent(\n ButtonApi,\n ({ props, buildChild }) => {\n const style: React.CSSProperties = {\n margin: LEAF_MARGIN,\n padding: \"8px 16px\",\n cursor: \"pointer\",\n border: props.variant === \"borderless\" ? \"none\" : \"1px solid #ccc\",\n backgroundColor:\n props.variant === \"primary\"\n ? \"var(--a2ui-primary-color, #007bff)\"\n : props.variant === \"borderless\"\n ? \"transparent\"\n : \"#fff\",\n color: props.variant === \"primary\" ? \"#fff\" : \"inherit\",\n borderRadius: \"4px\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxSizing: \"border-box\",\n };\n\n return (\n <button\n style={style}\n onClick={props.action}\n disabled={props.isValid === false}\n >\n {props.child ? buildChild(props.child) : null}\n </button>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,SAASA,qCACpBC,8CACC,EAAE,OAAO,iBAAiB;AAoBzB,QACE,2CAAC;EACC,OArB+B;GACjC,QAAQC;GACR,SAAS;GACT,QAAQ;GACR,QAAQ,MAAM,YAAY,eAAe,SAAS;GAClD,iBACE,MAAM,YAAY,YACd,uCACA,MAAM,YAAY,eAChB,gBACA;GACR,OAAO,MAAM,YAAY,YAAY,SAAS;GAC9C,cAAc;GACd,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,WAAW;GACZ;EAKG,SAAS,MAAM;EACf,UAAU,MAAM,YAAY;YAE3B,MAAM,QAAQ,WAAW,MAAM,MAAM,GAAG;GAClC;EAGd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../index.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../index.mjs";
|