@copilotkit/a2ui-renderer 1.51.4 → 1.51.5-next.1
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/A2UIMessageRenderer.cjs +135 -0
- package/dist/A2UIMessageRenderer.cjs.map +1 -0
- package/dist/A2UIMessageRenderer.d.cts +11 -0
- package/dist/A2UIMessageRenderer.d.cts.map +1 -0
- package/dist/A2UIMessageRenderer.d.mts +11 -0
- package/dist/A2UIMessageRenderer.d.mts.map +1 -0
- package/dist/A2UIMessageRenderer.mjs +134 -0
- package/dist/A2UIMessageRenderer.mjs.map +1 -0
- package/dist/A2UIViewer.cjs +154 -0
- package/dist/A2UIViewer.cjs.map +1 -0
- package/dist/A2UIViewer.d.cts +39 -0
- package/dist/A2UIViewer.d.cts.map +1 -0
- package/dist/A2UIViewer.d.mts +39 -0
- package/dist/A2UIViewer.d.mts.map +1 -0
- package/dist/A2UIViewer.mjs +152 -0
- package/dist/A2UIViewer.mjs.map +1 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.umd.js +3070 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/react-renderer/components/content/AudioPlayer.cjs +34 -0
- package/dist/react-renderer/components/content/AudioPlayer.cjs.map +1 -0
- package/dist/react-renderer/components/content/AudioPlayer.mjs +33 -0
- package/dist/react-renderer/components/content/AudioPlayer.mjs.map +1 -0
- package/dist/react-renderer/components/content/Divider.cjs +31 -0
- package/dist/react-renderer/components/content/Divider.cjs.map +1 -0
- package/dist/react-renderer/components/content/Divider.mjs +30 -0
- package/dist/react-renderer/components/content/Divider.mjs.map +1 -0
- package/dist/react-renderer/components/content/Icon.cjs +50 -0
- package/dist/react-renderer/components/content/Icon.cjs.map +1 -0
- package/dist/react-renderer/components/content/Icon.mjs +49 -0
- package/dist/react-renderer/components/content/Icon.mjs.map +1 -0
- package/dist/react-renderer/components/content/Image.cjs +43 -0
- package/dist/react-renderer/components/content/Image.cjs.map +1 -0
- package/dist/react-renderer/components/content/Image.mjs +42 -0
- package/dist/react-renderer/components/content/Image.mjs.map +1 -0
- package/dist/react-renderer/components/content/Text.cjs +131 -0
- package/dist/react-renderer/components/content/Text.cjs.map +1 -0
- package/dist/react-renderer/components/content/Text.mjs +129 -0
- package/dist/react-renderer/components/content/Text.mjs.map +1 -0
- package/dist/react-renderer/components/content/Video.cjs +56 -0
- package/dist/react-renderer/components/content/Video.cjs.map +1 -0
- package/dist/react-renderer/components/content/Video.mjs +55 -0
- package/dist/react-renderer/components/content/Video.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/Button.cjs +39 -0
- package/dist/react-renderer/components/interactive/Button.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/Button.mjs +38 -0
- package/dist/react-renderer/components/interactive/Button.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/CheckBox.cjs +58 -0
- package/dist/react-renderer/components/interactive/CheckBox.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/CheckBox.mjs +57 -0
- package/dist/react-renderer/components/interactive/CheckBox.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.cjs +65 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.mjs +64 -0
- package/dist/react-renderer/components/interactive/DateTimeInput.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.cjs +54 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.mjs +53 -0
- package/dist/react-renderer/components/interactive/MultipleChoice.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/Slider.cjs +72 -0
- package/dist/react-renderer/components/interactive/Slider.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/Slider.mjs +71 -0
- package/dist/react-renderer/components/interactive/Slider.mjs.map +1 -0
- package/dist/react-renderer/components/interactive/TextField.cjs +74 -0
- package/dist/react-renderer/components/interactive/TextField.cjs.map +1 -0
- package/dist/react-renderer/components/interactive/TextField.mjs +73 -0
- package/dist/react-renderer/components/interactive/TextField.mjs.map +1 -0
- package/dist/react-renderer/components/layout/Card.cjs +46 -0
- package/dist/react-renderer/components/layout/Card.cjs.map +1 -0
- package/dist/react-renderer/components/layout/Card.mjs +45 -0
- package/dist/react-renderer/components/layout/Card.mjs.map +1 -0
- package/dist/react-renderer/components/layout/Column.cjs +43 -0
- package/dist/react-renderer/components/layout/Column.cjs.map +1 -0
- package/dist/react-renderer/components/layout/Column.mjs +42 -0
- package/dist/react-renderer/components/layout/Column.mjs.map +1 -0
- package/dist/react-renderer/components/layout/List.cjs +41 -0
- package/dist/react-renderer/components/layout/List.cjs.map +1 -0
- package/dist/react-renderer/components/layout/List.mjs +40 -0
- package/dist/react-renderer/components/layout/List.mjs.map +1 -0
- package/dist/react-renderer/components/layout/Modal.cjs +92 -0
- package/dist/react-renderer/components/layout/Modal.cjs.map +1 -0
- package/dist/react-renderer/components/layout/Modal.mjs +91 -0
- package/dist/react-renderer/components/layout/Modal.mjs.map +1 -0
- package/dist/react-renderer/components/layout/Row.cjs +43 -0
- package/dist/react-renderer/components/layout/Row.cjs.map +1 -0
- package/dist/react-renderer/components/layout/Row.mjs +42 -0
- package/dist/react-renderer/components/layout/Row.mjs.map +1 -0
- package/dist/react-renderer/components/layout/Tabs.cjs +47 -0
- package/dist/react-renderer/components/layout/Tabs.cjs.map +1 -0
- package/dist/react-renderer/components/layout/Tabs.mjs +46 -0
- package/dist/react-renderer/components/layout/Tabs.mjs.map +1 -0
- package/dist/react-renderer/core/A2UIProvider.cjs +123 -0
- package/dist/react-renderer/core/A2UIProvider.cjs.map +1 -0
- package/dist/react-renderer/core/A2UIProvider.mjs +120 -0
- package/dist/react-renderer/core/A2UIProvider.mjs.map +1 -0
- package/dist/react-renderer/core/A2UIRenderer.cjs +93 -0
- package/dist/react-renderer/core/A2UIRenderer.cjs.map +1 -0
- package/dist/react-renderer/core/A2UIRenderer.mjs +92 -0
- package/dist/react-renderer/core/A2UIRenderer.mjs.map +1 -0
- package/dist/react-renderer/core/ComponentNode.cjs +53 -0
- package/dist/react-renderer/core/ComponentNode.cjs.map +1 -0
- package/dist/react-renderer/core/ComponentNode.mjs +52 -0
- package/dist/react-renderer/core/ComponentNode.mjs.map +1 -0
- package/dist/react-renderer/hooks/useA2UI.cjs +46 -0
- package/dist/react-renderer/hooks/useA2UI.cjs.map +1 -0
- package/dist/react-renderer/hooks/useA2UI.mjs +46 -0
- package/dist/react-renderer/hooks/useA2UI.mjs.map +1 -0
- package/dist/react-renderer/hooks/useA2UIComponent.cjs +173 -0
- package/dist/react-renderer/hooks/useA2UIComponent.cjs.map +1 -0
- package/dist/react-renderer/hooks/useA2UIComponent.mjs +172 -0
- package/dist/react-renderer/hooks/useA2UIComponent.mjs.map +1 -0
- package/dist/react-renderer/lib/utils.cjs +39 -0
- package/dist/react-renderer/lib/utils.cjs.map +1 -0
- package/dist/react-renderer/lib/utils.mjs +37 -0
- package/dist/react-renderer/lib/utils.mjs.map +1 -0
- package/dist/react-renderer/registry/ComponentRegistry.cjs +114 -0
- package/dist/react-renderer/registry/ComponentRegistry.cjs.map +1 -0
- package/dist/react-renderer/registry/ComponentRegistry.mjs +113 -0
- package/dist/react-renderer/registry/ComponentRegistry.mjs.map +1 -0
- package/dist/react-renderer/registry/defaultCatalog.cjs +57 -0
- package/dist/react-renderer/registry/defaultCatalog.cjs.map +1 -0
- package/dist/react-renderer/registry/defaultCatalog.mjs +57 -0
- package/dist/react-renderer/registry/defaultCatalog.mjs.map +1 -0
- package/dist/react-renderer/styles/index.cjs +458 -0
- package/dist/react-renderer/styles/index.cjs.map +1 -0
- package/dist/react-renderer/styles/{index.js → index.mjs} +47 -64
- package/dist/react-renderer/styles/index.mjs.map +1 -0
- package/dist/react-renderer/styles/reset.cjs +29 -0
- package/dist/react-renderer/styles/reset.cjs.map +1 -0
- package/dist/react-renderer/styles/reset.mjs +28 -0
- package/dist/react-renderer/styles/reset.mjs.map +1 -0
- package/dist/react-renderer/theme/ThemeContext.cjs +35 -0
- package/dist/react-renderer/theme/ThemeContext.cjs.map +1 -0
- package/dist/react-renderer/theme/ThemeContext.mjs +33 -0
- package/dist/react-renderer/theme/ThemeContext.mjs.map +1 -0
- package/dist/react-renderer/theme/litTheme.cjs +368 -0
- package/dist/react-renderer/theme/litTheme.cjs.map +1 -0
- package/dist/react-renderer/theme/litTheme.mjs +367 -0
- package/dist/react-renderer/theme/litTheme.mjs.map +1 -0
- package/dist/react-renderer/theme/utils.cjs +41 -0
- package/dist/react-renderer/theme/utils.cjs.map +1 -0
- package/dist/react-renderer/theme/utils.mjs +39 -0
- package/dist/react-renderer/theme/utils.mjs.map +1 -0
- package/dist/theme/viewer-theme.cjs +366 -0
- package/dist/theme/viewer-theme.cjs.map +1 -0
- package/dist/theme/viewer-theme.d.cts +7 -0
- package/dist/theme/viewer-theme.d.cts.map +1 -0
- package/dist/theme/viewer-theme.d.mts +7 -0
- package/dist/theme/viewer-theme.d.mts.map +1 -0
- package/dist/theme/viewer-theme.mjs +365 -0
- package/dist/theme/viewer-theme.mjs.map +1 -0
- package/package.json +14 -9
- package/dist/.tsbuildinfo +0 -1
- package/dist/A2UIMessageRenderer.d.ts +0 -7
- package/dist/A2UIMessageRenderer.d.ts.map +0 -1
- package/dist/A2UIMessageRenderer.js +0 -126
- package/dist/A2UIMessageRenderer.js.map +0 -1
- package/dist/A2UIViewer.d.ts +0 -32
- package/dist/A2UIViewer.d.ts.map +0 -1
- package/dist/A2UIViewer.js +0 -121
- package/dist/A2UIViewer.js.map +0 -1
- package/dist/__tests__/A2UIMessageRenderer.test.d.ts +0 -2
- package/dist/__tests__/A2UIMessageRenderer.test.d.ts.map +0 -1
- package/dist/__tests__/A2UIMessageRenderer.test.js +0 -229
- package/dist/__tests__/A2UIMessageRenderer.test.js.map +0 -1
- package/dist/__tests__/clsx-shim.d.ts +0 -8
- package/dist/__tests__/clsx-shim.d.ts.map +0 -1
- package/dist/__tests__/clsx-shim.js +0 -24
- package/dist/__tests__/clsx-shim.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -2
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -29
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.d.ts +0 -8
- package/dist/react-renderer/components/content/AudioPlayer.d.ts.map +0 -1
- package/dist/react-renderer/components/content/AudioPlayer.js +0 -23
- package/dist/react-renderer/components/content/AudioPlayer.js.map +0 -1
- package/dist/react-renderer/components/content/Divider.d.ts +0 -13
- package/dist/react-renderer/components/content/Divider.d.ts.map +0 -1
- package/dist/react-renderer/components/content/Divider.js +0 -22
- package/dist/react-renderer/components/content/Divider.js.map +0 -1
- package/dist/react-renderer/components/content/Icon.d.ts +0 -16
- package/dist/react-renderer/components/content/Icon.d.ts.map +0 -1
- package/dist/react-renderer/components/content/Icon.js +0 -40
- package/dist/react-renderer/components/content/Icon.js.map +0 -1
- package/dist/react-renderer/components/content/Image.d.ts +0 -11
- package/dist/react-renderer/components/content/Image.d.ts.map +0 -1
- package/dist/react-renderer/components/content/Image.js +0 -34
- package/dist/react-renderer/components/content/Image.js.map +0 -1
- package/dist/react-renderer/components/content/Text.d.ts +0 -28
- package/dist/react-renderer/components/content/Text.d.ts.map +0 -1
- package/dist/react-renderer/components/content/Text.js +0 -134
- package/dist/react-renderer/components/content/Text.js.map +0 -1
- package/dist/react-renderer/components/content/Video.d.ts +0 -10
- package/dist/react-renderer/components/content/Video.d.ts.map +0 -1
- package/dist/react-renderer/components/content/Video.js +0 -41
- package/dist/react-renderer/components/content/Video.js.map +0 -1
- package/dist/react-renderer/components/content/index.d.ts +0 -7
- package/dist/react-renderer/components/content/index.d.ts.map +0 -1
- package/dist/react-renderer/components/content/index.js +0 -7
- package/dist/react-renderer/components/content/index.js.map +0 -1
- package/dist/react-renderer/components/interactive/Button.d.ts +0 -11
- package/dist/react-renderer/components/interactive/Button.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/Button.js +0 -27
- package/dist/react-renderer/components/interactive/Button.js.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.d.ts +0 -10
- package/dist/react-renderer/components/interactive/CheckBox.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/CheckBox.js +0 -55
- package/dist/react-renderer/components/interactive/CheckBox.js.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.d.ts +0 -10
- package/dist/react-renderer/components/interactive/DateTimeInput.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/DateTimeInput.js +0 -68
- package/dist/react-renderer/components/interactive/DateTimeInput.js.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.d.ts +0 -11
- package/dist/react-renderer/components/interactive/MultipleChoice.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/MultipleChoice.js +0 -43
- package/dist/react-renderer/components/interactive/MultipleChoice.js.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.d.ts +0 -10
- package/dist/react-renderer/components/interactive/Slider.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/Slider.js +0 -62
- package/dist/react-renderer/components/interactive/Slider.js.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.d.ts +0 -10
- package/dist/react-renderer/components/interactive/TextField.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/TextField.js +0 -59
- package/dist/react-renderer/components/interactive/TextField.js.map +0 -1
- package/dist/react-renderer/components/interactive/index.d.ts +0 -7
- package/dist/react-renderer/components/interactive/index.d.ts.map +0 -1
- package/dist/react-renderer/components/interactive/index.js +0 -7
- package/dist/react-renderer/components/interactive/index.js.map +0 -1
- package/dist/react-renderer/components/layout/Card.d.ts +0 -17
- package/dist/react-renderer/components/layout/Card.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/Card.js +0 -39
- package/dist/react-renderer/components/layout/Card.js.map +0 -1
- package/dist/react-renderer/components/layout/Column.d.ts +0 -10
- package/dist/react-renderer/components/layout/Column.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/Column.js +0 -33
- package/dist/react-renderer/components/layout/Column.js.map +0 -1
- package/dist/react-renderer/components/layout/List.d.ts +0 -10
- package/dist/react-renderer/components/layout/List.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/List.js +0 -32
- package/dist/react-renderer/components/layout/List.js.map +0 -1
- package/dist/react-renderer/components/layout/Modal.d.ts +0 -15
- package/dist/react-renderer/components/layout/Modal.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/Modal.js +0 -65
- package/dist/react-renderer/components/layout/Modal.js.map +0 -1
- package/dist/react-renderer/components/layout/Row.d.ts +0 -10
- package/dist/react-renderer/components/layout/Row.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/Row.js +0 -33
- package/dist/react-renderer/components/layout/Row.js.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.d.ts +0 -8
- package/dist/react-renderer/components/layout/Tabs.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/Tabs.js +0 -29
- package/dist/react-renderer/components/layout/Tabs.js.map +0 -1
- package/dist/react-renderer/components/layout/index.d.ts +0 -7
- package/dist/react-renderer/components/layout/index.d.ts.map +0 -1
- package/dist/react-renderer/components/layout/index.js +0 -7
- package/dist/react-renderer/components/layout/index.js.map +0 -1
- package/dist/react-renderer/core/A2UIProvider.d.ts +0 -82
- package/dist/react-renderer/core/A2UIProvider.d.ts.map +0 -1
- package/dist/react-renderer/core/A2UIProvider.js +0 -156
- package/dist/react-renderer/core/A2UIProvider.js.map +0 -1
- package/dist/react-renderer/core/A2UIRenderer.d.ts +0 -36
- package/dist/react-renderer/core/A2UIRenderer.d.ts.map +0 -1
- package/dist/react-renderer/core/A2UIRenderer.js +0 -83
- package/dist/react-renderer/core/A2UIRenderer.js.map +0 -1
- package/dist/react-renderer/core/A2UIViewer.d.ts +0 -56
- package/dist/react-renderer/core/A2UIViewer.d.ts.map +0 -1
- package/dist/react-renderer/core/A2UIViewer.js +0 -135
- package/dist/react-renderer/core/A2UIViewer.js.map +0 -1
- package/dist/react-renderer/core/ComponentNode.d.ts +0 -25
- package/dist/react-renderer/core/ComponentNode.d.ts.map +0 -1
- package/dist/react-renderer/core/ComponentNode.js +0 -43
- package/dist/react-renderer/core/ComponentNode.js.map +0 -1
- package/dist/react-renderer/core/store.d.ts +0 -37
- package/dist/react-renderer/core/store.d.ts.map +0 -1
- package/dist/react-renderer/core/store.js +0 -2
- package/dist/react-renderer/core/store.js.map +0 -1
- package/dist/react-renderer/hooks/useA2UI.d.ts +0 -46
- package/dist/react-renderer/hooks/useA2UI.d.ts.map +0 -1
- package/dist/react-renderer/hooks/useA2UI.js +0 -41
- package/dist/react-renderer/hooks/useA2UI.js.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.d.ts +0 -52
- package/dist/react-renderer/hooks/useA2UIComponent.d.ts.map +0 -1
- package/dist/react-renderer/hooks/useA2UIComponent.js +0 -175
- package/dist/react-renderer/hooks/useA2UIComponent.js.map +0 -1
- package/dist/react-renderer/index.d.ts +0 -37
- package/dist/react-renderer/index.d.ts.map +0 -1
- package/dist/react-renderer/index.js +0 -40
- package/dist/react-renderer/index.js.map +0 -1
- package/dist/react-renderer/lib/utils.d.ts +0 -32
- package/dist/react-renderer/lib/utils.d.ts.map +0 -1
- package/dist/react-renderer/lib/utils.js +0 -41
- package/dist/react-renderer/lib/utils.js.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.d.ts +0 -78
- package/dist/react-renderer/registry/ComponentRegistry.d.ts.map +0 -1
- package/dist/react-renderer/registry/ComponentRegistry.js +0 -113
- package/dist/react-renderer/registry/ComponentRegistry.js.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.d.ts +0 -13
- package/dist/react-renderer/registry/defaultCatalog.d.ts.map +0 -1
- package/dist/react-renderer/registry/defaultCatalog.js +0 -59
- package/dist/react-renderer/registry/defaultCatalog.js.map +0 -1
- package/dist/react-renderer/styles/index.d.ts +0 -41
- package/dist/react-renderer/styles/index.d.ts.map +0 -1
- package/dist/react-renderer/styles/index.js.map +0 -1
- package/dist/react-renderer/styles/reset.d.ts +0 -18
- package/dist/react-renderer/styles/reset.d.ts.map +0 -1
- package/dist/react-renderer/styles/reset.js +0 -24
- package/dist/react-renderer/styles/reset.js.map +0 -1
- package/dist/react-renderer/theme/ThemeContext.d.ts +0 -29
- package/dist/react-renderer/theme/ThemeContext.d.ts.map +0 -1
- package/dist/react-renderer/theme/ThemeContext.js +0 -35
- package/dist/react-renderer/theme/ThemeContext.js.map +0 -1
- package/dist/react-renderer/theme/litTheme.d.ts +0 -8
- package/dist/react-renderer/theme/litTheme.d.ts.map +0 -1
- package/dist/react-renderer/theme/litTheme.js +0 -401
- package/dist/react-renderer/theme/litTheme.js.map +0 -1
- package/dist/react-renderer/theme/utils.d.ts +0 -23
- package/dist/react-renderer/theme/utils.d.ts.map +0 -1
- package/dist/react-renderer/theme/utils.js +0 -46
- package/dist/react-renderer/theme/utils.js.map +0 -1
- package/dist/react-renderer/types.d.ts +0 -53
- package/dist/react-renderer/types.d.ts.map +0 -1
- package/dist/react-renderer/types.js +0 -2
- package/dist/react-renderer/types.js.map +0 -1
- package/dist/theme/viewer-theme.d.ts +0 -3
- package/dist/theme/viewer-theme.d.ts.map +0 -1
- package/dist/theme/viewer-theme.js +0 -391
- package/dist/theme/viewer-theme.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ComponentNode from "../../core/ComponentNode.mjs";
|
|
2
|
+
import { classMapToString, stylesToObject } from "../../theme/utils.mjs";
|
|
3
|
+
import "../../lib/utils.mjs";
|
|
4
|
+
import { useA2UIComponent } from "../../hooks/useA2UIComponent.mjs";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-renderer/components/layout/Card.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Card component - a container that visually groups content.
|
|
11
|
+
*
|
|
12
|
+
* Structure mirrors Lit's Card component:
|
|
13
|
+
* <div class="a2ui-card"> ← :host equivalent
|
|
14
|
+
* <section class="..."> ← theme classes (border, padding, background)
|
|
15
|
+
* {children} ← ::slotted(*) equivalent
|
|
16
|
+
* </section>
|
|
17
|
+
* </div>
|
|
18
|
+
*
|
|
19
|
+
* All styles come from componentSpecificStyles CSS, no inline styles needed.
|
|
20
|
+
*/
|
|
21
|
+
const Card = memo(function Card({ node, surfaceId }) {
|
|
22
|
+
const { theme } = useA2UIComponent(node, surfaceId);
|
|
23
|
+
const props = node.properties;
|
|
24
|
+
const rawChildren = props.children ?? (props.child ? [props.child] : []);
|
|
25
|
+
const children = Array.isArray(rawChildren) ? rawChildren : [];
|
|
26
|
+
return /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: "a2ui-card",
|
|
28
|
+
style: node.weight !== void 0 ? { "--weight": node.weight } : {},
|
|
29
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
30
|
+
className: classMapToString(theme.components.Card),
|
|
31
|
+
style: stylesToObject(theme.additionalStyles?.Card),
|
|
32
|
+
children: children.map((child, index) => {
|
|
33
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
34
|
+
return /* @__PURE__ */ jsx(ComponentNode, {
|
|
35
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
36
|
+
surfaceId
|
|
37
|
+
}, childId);
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Card as default };
|
|
45
|
+
//# sourceMappingURL=Card.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.mjs","names":[],"sources":["../../../../src/react-renderer/components/layout/Card.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Card component - a container that visually groups content.\n *\n * Structure mirrors Lit's Card component:\n * <div class=\"a2ui-card\"> ← :host equivalent\n * <section class=\"...\"> ← theme classes (border, padding, background)\n * {children} ← ::slotted(*) equivalent\n * </section>\n * </div>\n *\n * All styles come from componentSpecificStyles CSS, no inline styles needed.\n */\nexport const Card = memo(function Card({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.CardNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Card can have either a single child or multiple children\n const rawChildren = props.children ?? (props.child ? [props.child] : []);\n const children = Array.isArray(rawChildren) ? rawChildren : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div className=\"a2ui-card\" style={hostStyle}>\n <section\n className={classMapToString(theme.components.Card)}\n style={stylesToObject(theme.additionalStyles?.Card)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default Card;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,OAAO,KAAK,SAAS,KAAK,EACrC,MACA,aACqC;CACrC,MAAM,EAAE,UAAU,iBAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,cAAc,MAAM,aAAa,MAAM,QAAQ,CAAC,MAAM,MAAM,GAAG,EAAE;CACvE,MAAM,WAAW,MAAM,QAAQ,YAAY,GAAG,cAAc,EAAE;AAQ9D,QACE,oBAAC;EAAI,WAAU;EAAY,OAL3B,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;YAIJ,oBAAC;GACC,WAAW,iBAAiB,MAAM,WAAW,KAAK;GAClD,OAAO,eAAe,MAAM,kBAAkB,KAAK;aAElD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,oBAAC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ComponentNode = require('../../core/ComponentNode.cjs');
|
|
3
|
+
const require_utils = require('../../theme/utils.cjs');
|
|
4
|
+
require('../../lib/utils.cjs');
|
|
5
|
+
const require_useA2UIComponent = require('../../hooks/useA2UIComponent.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/components/layout/Column.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Column component - arranges children vertically using flexbox.
|
|
12
|
+
*
|
|
13
|
+
* Supports distribution (justify-content) and alignment (align-items) properties.
|
|
14
|
+
*/
|
|
15
|
+
const Column = (0, react.memo)(function Column({ node, surfaceId }) {
|
|
16
|
+
const { theme } = require_useA2UIComponent.useA2UIComponent(node, surfaceId);
|
|
17
|
+
const props = node.properties;
|
|
18
|
+
const alignment = props.alignment ?? "stretch";
|
|
19
|
+
const distribution = props.distribution ?? "start";
|
|
20
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
21
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: "a2ui-column",
|
|
24
|
+
"data-alignment": alignment,
|
|
25
|
+
"data-distribution": distribution,
|
|
26
|
+
style: hostStyle,
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
28
|
+
className: require_utils.classMapToString(theme.components.Column),
|
|
29
|
+
style: require_utils.stylesToObject(theme.additionalStyles?.Column),
|
|
30
|
+
children: children.map((child, index) => {
|
|
31
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
33
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
34
|
+
surfaceId
|
|
35
|
+
}, childId);
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.default = Column;
|
|
43
|
+
//# sourceMappingURL=Column.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Column.cjs","names":["useA2UIComponent","classMapToString","stylesToObject","ComponentNode"],"sources":["../../../../src/react-renderer/components/layout/Column.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Column component - arranges children vertically using flexbox.\n *\n * Supports distribution (justify-content) and alignment (align-items) properties.\n */\nexport const Column = memo(function Column({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ColumnNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default values\n const alignment = props.alignment ?? \"stretch\";\n const distribution = props.distribution ?? \"start\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div\n className=\"a2ui-column\"\n data-alignment={alignment}\n data-distribution={distribution}\n style={hostStyle}\n >\n <section\n className={classMapToString(theme.components.Column)}\n style={stylesToObject(theme.additionalStyles?.Column)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default Column;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,yBAAc,SAAS,OAAO,EACzC,MACA,aACuC;CACvC,MAAM,EAAE,UAAUA,0CAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,eAAe,MAAM,gBAAgB;CAE3C,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,2CAAC;EACC,WAAU;EACV,kBAAgB;EAChB,qBAAmB;EACnB,OAAO;YAEP,2CAAC;GACC,WAAWC,+BAAiB,MAAM,WAAW,OAAO;GACpD,OAAOC,6BAAe,MAAM,kBAAkB,OAAO;aAEpD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,2CAACC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ComponentNode from "../../core/ComponentNode.mjs";
|
|
2
|
+
import { classMapToString, stylesToObject } from "../../theme/utils.mjs";
|
|
3
|
+
import "../../lib/utils.mjs";
|
|
4
|
+
import { useA2UIComponent } from "../../hooks/useA2UIComponent.mjs";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-renderer/components/layout/Column.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Column component - arranges children vertically using flexbox.
|
|
11
|
+
*
|
|
12
|
+
* Supports distribution (justify-content) and alignment (align-items) properties.
|
|
13
|
+
*/
|
|
14
|
+
const Column = memo(function Column({ node, surfaceId }) {
|
|
15
|
+
const { theme } = useA2UIComponent(node, surfaceId);
|
|
16
|
+
const props = node.properties;
|
|
17
|
+
const alignment = props.alignment ?? "stretch";
|
|
18
|
+
const distribution = props.distribution ?? "start";
|
|
19
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
20
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "a2ui-column",
|
|
23
|
+
"data-alignment": alignment,
|
|
24
|
+
"data-distribution": distribution,
|
|
25
|
+
style: hostStyle,
|
|
26
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
27
|
+
className: classMapToString(theme.components.Column),
|
|
28
|
+
style: stylesToObject(theme.additionalStyles?.Column),
|
|
29
|
+
children: children.map((child, index) => {
|
|
30
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
31
|
+
return /* @__PURE__ */ jsx(ComponentNode, {
|
|
32
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
33
|
+
surfaceId
|
|
34
|
+
}, childId);
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Column as default };
|
|
42
|
+
//# sourceMappingURL=Column.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Column.mjs","names":[],"sources":["../../../../src/react-renderer/components/layout/Column.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Column component - arranges children vertically using flexbox.\n *\n * Supports distribution (justify-content) and alignment (align-items) properties.\n */\nexport const Column = memo(function Column({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ColumnNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default values\n const alignment = props.alignment ?? \"stretch\";\n const distribution = props.distribution ?? \"start\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div\n className=\"a2ui-column\"\n data-alignment={alignment}\n data-distribution={distribution}\n style={hostStyle}\n >\n <section\n className={classMapToString(theme.components.Column)}\n style={stylesToObject(theme.additionalStyles?.Column)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default Column;\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,SAAS,KAAK,SAAS,OAAO,EACzC,MACA,aACuC;CACvC,MAAM,EAAE,UAAU,iBAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,eAAe,MAAM,gBAAgB;CAE3C,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,oBAAC;EACC,WAAU;EACV,kBAAgB;EAChB,qBAAmB;EACnB,OAAO;YAEP,oBAAC;GACC,WAAW,iBAAiB,MAAM,WAAW,OAAO;GACpD,OAAO,eAAe,MAAM,kBAAkB,OAAO;aAEpD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,oBAAC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ComponentNode = require('../../core/ComponentNode.cjs');
|
|
3
|
+
const require_utils = require('../../theme/utils.cjs');
|
|
4
|
+
require('../../lib/utils.cjs');
|
|
5
|
+
const require_useA2UIComponent = require('../../hooks/useA2UIComponent.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/components/layout/List.tsx
|
|
10
|
+
/**
|
|
11
|
+
* List component - renders a scrollable list of items.
|
|
12
|
+
*
|
|
13
|
+
* Supports direction (vertical/horizontal) properties.
|
|
14
|
+
*/
|
|
15
|
+
const List = (0, react.memo)(function List({ node, surfaceId }) {
|
|
16
|
+
const { theme } = require_useA2UIComponent.useA2UIComponent(node, surfaceId);
|
|
17
|
+
const props = node.properties;
|
|
18
|
+
const direction = props.direction ?? "vertical";
|
|
19
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
20
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22
|
+
className: "a2ui-list",
|
|
23
|
+
"data-direction": direction,
|
|
24
|
+
style: hostStyle,
|
|
25
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
26
|
+
className: require_utils.classMapToString(theme.components.List),
|
|
27
|
+
style: require_utils.stylesToObject(theme.additionalStyles?.List),
|
|
28
|
+
children: children.map((child, index) => {
|
|
29
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
31
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
32
|
+
surfaceId
|
|
33
|
+
}, childId);
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.default = List;
|
|
41
|
+
//# sourceMappingURL=List.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.cjs","names":["useA2UIComponent","classMapToString","stylesToObject","ComponentNode"],"sources":["../../../../src/react-renderer/components/layout/List.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * List component - renders a scrollable list of items.\n *\n * Supports direction (vertical/horizontal) properties.\n */\nexport const List = memo(function List({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ListNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default value\n const direction = props.direction ?? \"vertical\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div className=\"a2ui-list\" data-direction={direction} style={hostStyle}>\n <section\n className={classMapToString(theme.components.List)}\n style={stylesToObject(theme.additionalStyles?.List)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default List;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,uBAAY,SAAS,KAAK,EACrC,MACA,aACqC;CACrC,MAAM,EAAE,UAAUA,0CAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CAErC,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,2CAAC;EAAI,WAAU;EAAY,kBAAgB;EAAW,OAAO;YAC3D,2CAAC;GACC,WAAWC,+BAAiB,MAAM,WAAW,KAAK;GAClD,OAAOC,6BAAe,MAAM,kBAAkB,KAAK;aAElD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,2CAACC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import ComponentNode from "../../core/ComponentNode.mjs";
|
|
2
|
+
import { classMapToString, stylesToObject } from "../../theme/utils.mjs";
|
|
3
|
+
import "../../lib/utils.mjs";
|
|
4
|
+
import { useA2UIComponent } from "../../hooks/useA2UIComponent.mjs";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-renderer/components/layout/List.tsx
|
|
9
|
+
/**
|
|
10
|
+
* List component - renders a scrollable list of items.
|
|
11
|
+
*
|
|
12
|
+
* Supports direction (vertical/horizontal) properties.
|
|
13
|
+
*/
|
|
14
|
+
const List = memo(function List({ node, surfaceId }) {
|
|
15
|
+
const { theme } = useA2UIComponent(node, surfaceId);
|
|
16
|
+
const props = node.properties;
|
|
17
|
+
const direction = props.direction ?? "vertical";
|
|
18
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
19
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "a2ui-list",
|
|
22
|
+
"data-direction": direction,
|
|
23
|
+
style: hostStyle,
|
|
24
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
25
|
+
className: classMapToString(theme.components.List),
|
|
26
|
+
style: stylesToObject(theme.additionalStyles?.List),
|
|
27
|
+
children: children.map((child, index) => {
|
|
28
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
29
|
+
return /* @__PURE__ */ jsx(ComponentNode, {
|
|
30
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
31
|
+
surfaceId
|
|
32
|
+
}, childId);
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { List as default };
|
|
40
|
+
//# sourceMappingURL=List.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.mjs","names":[],"sources":["../../../../src/react-renderer/components/layout/List.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * List component - renders a scrollable list of items.\n *\n * Supports direction (vertical/horizontal) properties.\n */\nexport const List = memo(function List({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ListNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default value\n const direction = props.direction ?? \"vertical\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div className=\"a2ui-list\" data-direction={direction} style={hostStyle}>\n <section\n className={classMapToString(theme.components.List)}\n style={stylesToObject(theme.additionalStyles?.List)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default List;\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,OAAO,KAAK,SAAS,KAAK,EACrC,MACA,aACqC;CACrC,MAAM,EAAE,UAAU,iBAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CAErC,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,oBAAC;EAAI,WAAU;EAAY,kBAAgB;EAAW,OAAO;YAC3D,oBAAC;GACC,WAAW,iBAAiB,MAAM,WAAW,KAAK;GAClD,OAAO,eAAe,MAAM,kBAAkB,KAAK;aAElD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,oBAAC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ComponentNode = require('../../core/ComponentNode.cjs');
|
|
3
|
+
const require_utils = require('../../theme/utils.cjs');
|
|
4
|
+
require('../../lib/utils.cjs');
|
|
5
|
+
const require_useA2UIComponent = require('../../hooks/useA2UIComponent.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/components/layout/Modal.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Modal component - displays content in a dialog overlay.
|
|
12
|
+
*
|
|
13
|
+
* Matches Lit's rendering approach:
|
|
14
|
+
* - When closed: renders section with entry point child
|
|
15
|
+
* - When open: renders dialog with content child (entry point is replaced)
|
|
16
|
+
*
|
|
17
|
+
* The dialog is rendered in place (no portal) so it stays inside .a2ui-surface
|
|
18
|
+
* and CSS selectors work correctly. showModal() handles the top-layer overlay.
|
|
19
|
+
*/
|
|
20
|
+
const Modal = (0, react.memo)(function Modal({ node, surfaceId }) {
|
|
21
|
+
const { theme } = require_useA2UIComponent.useA2UIComponent(node, surfaceId);
|
|
22
|
+
const props = node.properties;
|
|
23
|
+
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
24
|
+
const dialogRef = (0, react.useRef)(null);
|
|
25
|
+
const openModal = (0, react.useCallback)(() => {
|
|
26
|
+
setIsOpen(true);
|
|
27
|
+
}, []);
|
|
28
|
+
const closeModal = (0, react.useCallback)(() => {
|
|
29
|
+
setIsOpen(false);
|
|
30
|
+
}, []);
|
|
31
|
+
(0, react.useEffect)(() => {
|
|
32
|
+
const dialog = dialogRef.current;
|
|
33
|
+
if (!dialog) return;
|
|
34
|
+
if (isOpen && !dialog.open) dialog.showModal();
|
|
35
|
+
const handleClose = () => {
|
|
36
|
+
setIsOpen(false);
|
|
37
|
+
};
|
|
38
|
+
dialog.addEventListener("close", handleClose);
|
|
39
|
+
return () => dialog.removeEventListener("close", handleClose);
|
|
40
|
+
}, [isOpen]);
|
|
41
|
+
const handleBackdropClick = (0, react.useCallback)((e) => {
|
|
42
|
+
if (e.target === e.currentTarget) closeModal();
|
|
43
|
+
}, [closeModal]);
|
|
44
|
+
const handleKeyDown = (0, react.useCallback)((e) => {
|
|
45
|
+
if (e.key === "Escape") closeModal();
|
|
46
|
+
}, [closeModal]);
|
|
47
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
48
|
+
if (!isOpen) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
49
|
+
className: "a2ui-modal",
|
|
50
|
+
style: hostStyle,
|
|
51
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
52
|
+
onClick: openModal,
|
|
53
|
+
style: { cursor: "pointer" },
|
|
54
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
55
|
+
node: props.entryPointChild,
|
|
56
|
+
surfaceId
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
61
|
+
className: "a2ui-modal",
|
|
62
|
+
style: hostStyle,
|
|
63
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
|
|
64
|
+
ref: dialogRef,
|
|
65
|
+
className: require_utils.classMapToString(theme.components.Modal.backdrop),
|
|
66
|
+
onClick: handleBackdropClick,
|
|
67
|
+
onKeyDown: handleKeyDown,
|
|
68
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
69
|
+
className: require_utils.classMapToString(theme.components.Modal.element),
|
|
70
|
+
style: require_utils.stylesToObject(theme.additionalStyles?.Modal),
|
|
71
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
72
|
+
id: "controls",
|
|
73
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
74
|
+
onClick: closeModal,
|
|
75
|
+
"aria-label": "Close modal",
|
|
76
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77
|
+
className: "g-icon",
|
|
78
|
+
children: "close"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
82
|
+
node: props.contentChild,
|
|
83
|
+
surfaceId
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.default = Modal;
|
|
92
|
+
//# sourceMappingURL=Modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.cjs","names":["useA2UIComponent","ComponentNode","classMapToString","stylesToObject"],"sources":["../../../../src/react-renderer/components/layout/Modal.tsx"],"sourcesContent":["import { useState, useCallback, useRef, useEffect, memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Modal component - displays content in a dialog overlay.\n *\n * Matches Lit's rendering approach:\n * - When closed: renders section with entry point child\n * - When open: renders dialog with content child (entry point is replaced)\n *\n * The dialog is rendered in place (no portal) so it stays inside .a2ui-surface\n * and CSS selectors work correctly. showModal() handles the top-layer overlay.\n */\nexport const Modal = memo(function Modal({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ModalNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n const [isOpen, setIsOpen] = useState(false);\n const dialogRef = useRef<HTMLDialogElement>(null);\n\n const openModal = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const closeModal = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n // Show dialog when isOpen becomes true, and sync state when dialog closes (e.g., via Escape)\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (isOpen && !dialog.open) {\n dialog.showModal();\n }\n\n // Listen for native close event (triggered by Escape key)\n const handleClose = () => {\n setIsOpen(false);\n };\n dialog.addEventListener(\"close\", handleClose);\n return () => dialog.removeEventListener(\"close\", handleClose);\n }, [isOpen]);\n\n // Handle backdrop clicks (only close if clicking directly on dialog, not its content)\n const handleBackdropClick = useCallback(\n (e: React.MouseEvent<HTMLDialogElement>) => {\n if (e.target === e.currentTarget) {\n closeModal();\n }\n },\n [closeModal],\n );\n\n // Handle Escape key (for jsdom test compatibility - real browsers use native dialog behavior)\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDialogElement>) => {\n if (e.key === \"Escape\") {\n closeModal();\n }\n },\n [closeModal],\n );\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n // Match Lit's render approach: closed shows section with entry, open shows dialog\n if (!isOpen) {\n return (\n <div className=\"a2ui-modal\" style={hostStyle}>\n <section onClick={openModal} style={{ cursor: \"pointer\" }}>\n <ComponentNode node={props.entryPointChild} surfaceId={surfaceId} />\n </section>\n </div>\n );\n }\n\n return (\n <div className=\"a2ui-modal\" style={hostStyle}>\n <dialog\n ref={dialogRef}\n className={classMapToString(theme.components.Modal.backdrop)}\n onClick={handleBackdropClick}\n onKeyDown={handleKeyDown}\n >\n <section\n className={classMapToString(theme.components.Modal.element)}\n style={stylesToObject(theme.additionalStyles?.Modal)}\n >\n <div id=\"controls\">\n <button onClick={closeModal} aria-label=\"Close modal\">\n <span className=\"g-icon\">close</span>\n </button>\n </div>\n <ComponentNode node={props.contentChild} surfaceId={surfaceId} />\n </section>\n </dialog>\n </div>\n );\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,wBAAa,SAAS,MAAM,EACvC,MACA,aACsC;CACtC,MAAM,EAAE,UAAUA,0CAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAEnB,MAAM,CAAC,QAAQ,iCAAsB,MAAM;CAC3C,MAAM,8BAAsC,KAAK;CAEjD,MAAM,yCAA8B;AAClC,YAAU,KAAK;IACd,EAAE,CAAC;CAEN,MAAM,0CAA+B;AACnC,YAAU,MAAM;IACf,EAAE,CAAC;AAGN,4BAAgB;EACd,MAAM,SAAS,UAAU;AACzB,MAAI,CAAC,OAAQ;AAEb,MAAI,UAAU,CAAC,OAAO,KACpB,QAAO,WAAW;EAIpB,MAAM,oBAAoB;AACxB,aAAU,MAAM;;AAElB,SAAO,iBAAiB,SAAS,YAAY;AAC7C,eAAa,OAAO,oBAAoB,SAAS,YAAY;IAC5D,CAAC,OAAO,CAAC;CAGZ,MAAM,8CACH,MAA2C;AAC1C,MAAI,EAAE,WAAW,EAAE,cACjB,aAAY;IAGhB,CAAC,WAAW,CACb;CAGD,MAAM,wCACH,MAA8C;AAC7C,MAAI,EAAE,QAAQ,SACZ,aAAY;IAGhB,CAAC,WAAW,CACb;CAGD,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAGR,KAAI,CAAC,OACH,QACE,2CAAC;EAAI,WAAU;EAAa,OAAO;YACjC,2CAAC;GAAQ,SAAS;GAAW,OAAO,EAAE,QAAQ,WAAW;aACvD,2CAACC;IAAc,MAAM,MAAM;IAA4B;KAAa;IAC5D;GACN;AAIV,QACE,2CAAC;EAAI,WAAU;EAAa,OAAO;YACjC,2CAAC;GACC,KAAK;GACL,WAAWC,+BAAiB,MAAM,WAAW,MAAM,SAAS;GAC5D,SAAS;GACT,WAAW;aAEX,4CAAC;IACC,WAAWA,+BAAiB,MAAM,WAAW,MAAM,QAAQ;IAC3D,OAAOC,6BAAe,MAAM,kBAAkB,MAAM;eAEpD,2CAAC;KAAI,IAAG;eACN,2CAAC;MAAO,SAAS;MAAY,cAAW;gBACtC,2CAAC;OAAK,WAAU;iBAAS;QAAY;OAC9B;MACL,EACN,2CAACF;KAAc,MAAM,MAAM;KAAyB;MAAa;KACzD;IACH;GACL;EAER"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import ComponentNode from "../../core/ComponentNode.mjs";
|
|
2
|
+
import { classMapToString, stylesToObject } from "../../theme/utils.mjs";
|
|
3
|
+
import "../../lib/utils.mjs";
|
|
4
|
+
import { useA2UIComponent } from "../../hooks/useA2UIComponent.mjs";
|
|
5
|
+
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-renderer/components/layout/Modal.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Modal component - displays content in a dialog overlay.
|
|
11
|
+
*
|
|
12
|
+
* Matches Lit's rendering approach:
|
|
13
|
+
* - When closed: renders section with entry point child
|
|
14
|
+
* - When open: renders dialog with content child (entry point is replaced)
|
|
15
|
+
*
|
|
16
|
+
* The dialog is rendered in place (no portal) so it stays inside .a2ui-surface
|
|
17
|
+
* and CSS selectors work correctly. showModal() handles the top-layer overlay.
|
|
18
|
+
*/
|
|
19
|
+
const Modal = memo(function Modal({ node, surfaceId }) {
|
|
20
|
+
const { theme } = useA2UIComponent(node, surfaceId);
|
|
21
|
+
const props = node.properties;
|
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
+
const dialogRef = useRef(null);
|
|
24
|
+
const openModal = useCallback(() => {
|
|
25
|
+
setIsOpen(true);
|
|
26
|
+
}, []);
|
|
27
|
+
const closeModal = useCallback(() => {
|
|
28
|
+
setIsOpen(false);
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const dialog = dialogRef.current;
|
|
32
|
+
if (!dialog) return;
|
|
33
|
+
if (isOpen && !dialog.open) dialog.showModal();
|
|
34
|
+
const handleClose = () => {
|
|
35
|
+
setIsOpen(false);
|
|
36
|
+
};
|
|
37
|
+
dialog.addEventListener("close", handleClose);
|
|
38
|
+
return () => dialog.removeEventListener("close", handleClose);
|
|
39
|
+
}, [isOpen]);
|
|
40
|
+
const handleBackdropClick = useCallback((e) => {
|
|
41
|
+
if (e.target === e.currentTarget) closeModal();
|
|
42
|
+
}, [closeModal]);
|
|
43
|
+
const handleKeyDown = useCallback((e) => {
|
|
44
|
+
if (e.key === "Escape") closeModal();
|
|
45
|
+
}, [closeModal]);
|
|
46
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
47
|
+
if (!isOpen) return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "a2ui-modal",
|
|
49
|
+
style: hostStyle,
|
|
50
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
51
|
+
onClick: openModal,
|
|
52
|
+
style: { cursor: "pointer" },
|
|
53
|
+
children: /* @__PURE__ */ jsx(ComponentNode, {
|
|
54
|
+
node: props.entryPointChild,
|
|
55
|
+
surfaceId
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: "a2ui-modal",
|
|
61
|
+
style: hostStyle,
|
|
62
|
+
children: /* @__PURE__ */ jsx("dialog", {
|
|
63
|
+
ref: dialogRef,
|
|
64
|
+
className: classMapToString(theme.components.Modal.backdrop),
|
|
65
|
+
onClick: handleBackdropClick,
|
|
66
|
+
onKeyDown: handleKeyDown,
|
|
67
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
68
|
+
className: classMapToString(theme.components.Modal.element),
|
|
69
|
+
style: stylesToObject(theme.additionalStyles?.Modal),
|
|
70
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
71
|
+
id: "controls",
|
|
72
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
73
|
+
onClick: closeModal,
|
|
74
|
+
"aria-label": "Close modal",
|
|
75
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "g-icon",
|
|
77
|
+
children: "close"
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}), /* @__PURE__ */ jsx(ComponentNode, {
|
|
81
|
+
node: props.contentChild,
|
|
82
|
+
surfaceId
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { Modal as default };
|
|
91
|
+
//# sourceMappingURL=Modal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.mjs","names":[],"sources":["../../../../src/react-renderer/components/layout/Modal.tsx"],"sourcesContent":["import { useState, useCallback, useRef, useEffect, memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Modal component - displays content in a dialog overlay.\n *\n * Matches Lit's rendering approach:\n * - When closed: renders section with entry point child\n * - When open: renders dialog with content child (entry point is replaced)\n *\n * The dialog is rendered in place (no portal) so it stays inside .a2ui-surface\n * and CSS selectors work correctly. showModal() handles the top-layer overlay.\n */\nexport const Modal = memo(function Modal({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.ModalNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n const [isOpen, setIsOpen] = useState(false);\n const dialogRef = useRef<HTMLDialogElement>(null);\n\n const openModal = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const closeModal = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n // Show dialog when isOpen becomes true, and sync state when dialog closes (e.g., via Escape)\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (isOpen && !dialog.open) {\n dialog.showModal();\n }\n\n // Listen for native close event (triggered by Escape key)\n const handleClose = () => {\n setIsOpen(false);\n };\n dialog.addEventListener(\"close\", handleClose);\n return () => dialog.removeEventListener(\"close\", handleClose);\n }, [isOpen]);\n\n // Handle backdrop clicks (only close if clicking directly on dialog, not its content)\n const handleBackdropClick = useCallback(\n (e: React.MouseEvent<HTMLDialogElement>) => {\n if (e.target === e.currentTarget) {\n closeModal();\n }\n },\n [closeModal],\n );\n\n // Handle Escape key (for jsdom test compatibility - real browsers use native dialog behavior)\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDialogElement>) => {\n if (e.key === \"Escape\") {\n closeModal();\n }\n },\n [closeModal],\n );\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n // Match Lit's render approach: closed shows section with entry, open shows dialog\n if (!isOpen) {\n return (\n <div className=\"a2ui-modal\" style={hostStyle}>\n <section onClick={openModal} style={{ cursor: \"pointer\" }}>\n <ComponentNode node={props.entryPointChild} surfaceId={surfaceId} />\n </section>\n </div>\n );\n }\n\n return (\n <div className=\"a2ui-modal\" style={hostStyle}>\n <dialog\n ref={dialogRef}\n className={classMapToString(theme.components.Modal.backdrop)}\n onClick={handleBackdropClick}\n onKeyDown={handleKeyDown}\n >\n <section\n className={classMapToString(theme.components.Modal.element)}\n style={stylesToObject(theme.additionalStyles?.Modal)}\n >\n <div id=\"controls\">\n <button onClick={closeModal} aria-label=\"Close modal\">\n <span className=\"g-icon\">close</span>\n </button>\n </div>\n <ComponentNode node={props.contentChild} surfaceId={surfaceId} />\n </section>\n </dialog>\n </div>\n );\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,QAAQ,KAAK,SAAS,MAAM,EACvC,MACA,aACsC;CACtC,MAAM,EAAE,UAAU,iBAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAEnB,MAAM,CAAC,QAAQ,aAAa,SAAS,MAAM;CAC3C,MAAM,YAAY,OAA0B,KAAK;CAEjD,MAAM,YAAY,kBAAkB;AAClC,YAAU,KAAK;IACd,EAAE,CAAC;CAEN,MAAM,aAAa,kBAAkB;AACnC,YAAU,MAAM;IACf,EAAE,CAAC;AAGN,iBAAgB;EACd,MAAM,SAAS,UAAU;AACzB,MAAI,CAAC,OAAQ;AAEb,MAAI,UAAU,CAAC,OAAO,KACpB,QAAO,WAAW;EAIpB,MAAM,oBAAoB;AACxB,aAAU,MAAM;;AAElB,SAAO,iBAAiB,SAAS,YAAY;AAC7C,eAAa,OAAO,oBAAoB,SAAS,YAAY;IAC5D,CAAC,OAAO,CAAC;CAGZ,MAAM,sBAAsB,aACzB,MAA2C;AAC1C,MAAI,EAAE,WAAW,EAAE,cACjB,aAAY;IAGhB,CAAC,WAAW,CACb;CAGD,MAAM,gBAAgB,aACnB,MAA8C;AAC7C,MAAI,EAAE,QAAQ,SACZ,aAAY;IAGhB,CAAC,WAAW,CACb;CAGD,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAGR,KAAI,CAAC,OACH,QACE,oBAAC;EAAI,WAAU;EAAa,OAAO;YACjC,oBAAC;GAAQ,SAAS;GAAW,OAAO,EAAE,QAAQ,WAAW;aACvD,oBAAC;IAAc,MAAM,MAAM;IAA4B;KAAa;IAC5D;GACN;AAIV,QACE,oBAAC;EAAI,WAAU;EAAa,OAAO;YACjC,oBAAC;GACC,KAAK;GACL,WAAW,iBAAiB,MAAM,WAAW,MAAM,SAAS;GAC5D,SAAS;GACT,WAAW;aAEX,qBAAC;IACC,WAAW,iBAAiB,MAAM,WAAW,MAAM,QAAQ;IAC3D,OAAO,eAAe,MAAM,kBAAkB,MAAM;eAEpD,oBAAC;KAAI,IAAG;eACN,oBAAC;MAAO,SAAS;MAAY,cAAW;gBACtC,oBAAC;OAAK,WAAU;iBAAS;QAAY;OAC9B;MACL,EACN,oBAAC;KAAc,MAAM,MAAM;KAAyB;MAAa;KACzD;IACH;GACL;EAER"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ComponentNode = require('../../core/ComponentNode.cjs');
|
|
3
|
+
const require_utils = require('../../theme/utils.cjs');
|
|
4
|
+
require('../../lib/utils.cjs');
|
|
5
|
+
const require_useA2UIComponent = require('../../hooks/useA2UIComponent.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/components/layout/Row.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Row component - arranges children horizontally using flexbox.
|
|
12
|
+
*
|
|
13
|
+
* Supports distribution (justify-content) and alignment (align-items) properties.
|
|
14
|
+
*/
|
|
15
|
+
const Row = (0, react.memo)(function Row({ node, surfaceId }) {
|
|
16
|
+
const { theme } = require_useA2UIComponent.useA2UIComponent(node, surfaceId);
|
|
17
|
+
const props = node.properties;
|
|
18
|
+
const alignment = props.alignment ?? "stretch";
|
|
19
|
+
const distribution = props.distribution ?? "start";
|
|
20
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
21
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: "a2ui-row",
|
|
24
|
+
"data-alignment": alignment,
|
|
25
|
+
"data-distribution": distribution,
|
|
26
|
+
style: hostStyle,
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
28
|
+
className: require_utils.classMapToString(theme.components.Row),
|
|
29
|
+
style: require_utils.stylesToObject(theme.additionalStyles?.Row),
|
|
30
|
+
children: children.map((child, index) => {
|
|
31
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
33
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
34
|
+
surfaceId
|
|
35
|
+
}, childId);
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.default = Row;
|
|
43
|
+
//# sourceMappingURL=Row.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.cjs","names":["useA2UIComponent","classMapToString","stylesToObject","ComponentNode"],"sources":["../../../../src/react-renderer/components/layout/Row.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Row component - arranges children horizontally using flexbox.\n *\n * Supports distribution (justify-content) and alignment (align-items) properties.\n */\nexport const Row = memo(function Row({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.RowNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default values\n const alignment = props.alignment ?? \"stretch\";\n const distribution = props.distribution ?? \"start\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div\n className=\"a2ui-row\"\n data-alignment={alignment}\n data-distribution={distribution}\n style={hostStyle}\n >\n <section\n className={classMapToString(theme.components.Row)}\n style={stylesToObject(theme.additionalStyles?.Row)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default Row;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,sBAAW,SAAS,IAAI,EACnC,MACA,aACoC;CACpC,MAAM,EAAE,UAAUA,0CAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,eAAe,MAAM,gBAAgB;CAE3C,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,2CAAC;EACC,WAAU;EACV,kBAAgB;EAChB,qBAAmB;EACnB,OAAO;YAEP,2CAAC;GACC,WAAWC,+BAAiB,MAAM,WAAW,IAAI;GACjD,OAAOC,6BAAe,MAAM,kBAAkB,IAAI;aAEjD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,2CAACC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ComponentNode from "../../core/ComponentNode.mjs";
|
|
2
|
+
import { classMapToString, stylesToObject } from "../../theme/utils.mjs";
|
|
3
|
+
import "../../lib/utils.mjs";
|
|
4
|
+
import { useA2UIComponent } from "../../hooks/useA2UIComponent.mjs";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-renderer/components/layout/Row.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Row component - arranges children horizontally using flexbox.
|
|
11
|
+
*
|
|
12
|
+
* Supports distribution (justify-content) and alignment (align-items) properties.
|
|
13
|
+
*/
|
|
14
|
+
const Row = memo(function Row({ node, surfaceId }) {
|
|
15
|
+
const { theme } = useA2UIComponent(node, surfaceId);
|
|
16
|
+
const props = node.properties;
|
|
17
|
+
const alignment = props.alignment ?? "stretch";
|
|
18
|
+
const distribution = props.distribution ?? "start";
|
|
19
|
+
const children = Array.isArray(props.children) ? props.children : [];
|
|
20
|
+
const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "a2ui-row",
|
|
23
|
+
"data-alignment": alignment,
|
|
24
|
+
"data-distribution": distribution,
|
|
25
|
+
style: hostStyle,
|
|
26
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
27
|
+
className: classMapToString(theme.components.Row),
|
|
28
|
+
style: stylesToObject(theme.additionalStyles?.Row),
|
|
29
|
+
children: children.map((child, index) => {
|
|
30
|
+
const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
|
|
31
|
+
return /* @__PURE__ */ jsx(ComponentNode, {
|
|
32
|
+
node: typeof child === "object" && child !== null && "type" in child ? child : null,
|
|
33
|
+
surfaceId
|
|
34
|
+
}, childId);
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Row as default };
|
|
42
|
+
//# sourceMappingURL=Row.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.mjs","names":[],"sources":["../../../../src/react-renderer/components/layout/Row.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport type { Types } from \"@a2ui/lit/0.8\";\nimport type { A2UIComponentProps } from \"../../types\";\nimport { useA2UIComponent } from \"../../hooks/useA2UIComponent\";\nimport { classMapToString, stylesToObject } from \"../../lib/utils\";\nimport { ComponentNode } from \"../../core/ComponentNode\";\n\n/**\n * Row component - arranges children horizontally using flexbox.\n *\n * Supports distribution (justify-content) and alignment (align-items) properties.\n */\nexport const Row = memo(function Row({\n node,\n surfaceId,\n}: A2UIComponentProps<Types.RowNode>) {\n const { theme } = useA2UIComponent(node, surfaceId);\n const props = node.properties;\n\n // Match Lit's default values\n const alignment = props.alignment ?? \"stretch\";\n const distribution = props.distribution ?? \"start\";\n\n const children = Array.isArray(props.children) ? props.children : [];\n\n // Apply --weight CSS variable on root div (:host equivalent) for flex layouts\n const hostStyle: React.CSSProperties =\n node.weight !== undefined\n ? ({ \"--weight\": node.weight } as React.CSSProperties)\n : {};\n\n return (\n <div\n className=\"a2ui-row\"\n data-alignment={alignment}\n data-distribution={distribution}\n style={hostStyle}\n >\n <section\n className={classMapToString(theme.components.Row)}\n style={stylesToObject(theme.additionalStyles?.Row)}\n >\n {children.map((child, index) => {\n const childId =\n typeof child === \"object\" && child !== null && \"id\" in child\n ? (child as Types.AnyComponentNode).id\n : `child-${index}`;\n const childNode =\n typeof child === \"object\" && child !== null && \"type\" in child\n ? (child as Types.AnyComponentNode)\n : null;\n return (\n <ComponentNode\n key={childId}\n node={childNode}\n surfaceId={surfaceId}\n />\n );\n })}\n </section>\n </div>\n );\n});\n\nexport default Row;\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,MAAM,KAAK,SAAS,IAAI,EACnC,MACA,aACoC;CACpC,MAAM,EAAE,UAAU,iBAAiB,MAAM,UAAU;CACnD,MAAM,QAAQ,KAAK;CAGnB,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,eAAe,MAAM,gBAAgB;CAE3C,MAAM,WAAW,MAAM,QAAQ,MAAM,SAAS,GAAG,MAAM,WAAW,EAAE;CAGpE,MAAM,YACJ,KAAK,WAAW,SACX,EAAE,YAAY,KAAK,QAAQ,GAC5B,EAAE;AAER,QACE,oBAAC;EACC,WAAU;EACV,kBAAgB;EAChB,qBAAmB;EACnB,OAAO;YAEP,oBAAC;GACC,WAAW,iBAAiB,MAAM,WAAW,IAAI;GACjD,OAAO,eAAe,MAAM,kBAAkB,IAAI;aAEjD,SAAS,KAAK,OAAO,UAAU;IAC9B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,QAClD,MAAiC,KAClC,SAAS;AAKf,WACE,oBAAC;KAEC,MANF,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACpD,QACD;KAKS;OAFN,QAGL;KAEJ;IACM;GACN;EAER"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ComponentNode = require('../../core/ComponentNode.cjs');
|
|
3
|
+
const require_utils = require('../../theme/utils.cjs');
|
|
4
|
+
const require_utils$1 = require('../../lib/utils.cjs');
|
|
5
|
+
const require_useA2UIComponent = require('../../hooks/useA2UIComponent.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/react-renderer/components/layout/Tabs.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Tabs component - displays content in switchable tabs.
|
|
12
|
+
*/
|
|
13
|
+
const Tabs = (0, react.memo)(function Tabs({ node, surfaceId }) {
|
|
14
|
+
const { theme, resolveString } = require_useA2UIComponent.useA2UIComponent(node, surfaceId);
|
|
15
|
+
const props = node.properties;
|
|
16
|
+
const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
|
|
17
|
+
const tabItems = props.tabItems ?? [];
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
19
|
+
className: "a2ui-tabs",
|
|
20
|
+
style: node.weight !== void 0 ? { "--weight": node.weight } : {},
|
|
21
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
22
|
+
className: require_utils.classMapToString(theme.components.Tabs.container),
|
|
23
|
+
style: require_utils.stylesToObject(theme.additionalStyles?.Tabs),
|
|
24
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
25
|
+
id: "buttons",
|
|
26
|
+
className: require_utils.classMapToString(theme.components.Tabs.element),
|
|
27
|
+
children: tabItems.map((tab, index) => {
|
|
28
|
+
const title = resolveString(tab.title);
|
|
29
|
+
const isSelected = index === selectedIndex;
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
31
|
+
disabled: isSelected,
|
|
32
|
+
className: require_utils.classMapToString(isSelected ? require_utils$1.mergeClassMaps(theme.components.Tabs.controls.all, theme.components.Tabs.controls.selected) : theme.components.Tabs.controls.all),
|
|
33
|
+
onClick: () => setSelectedIndex(index),
|
|
34
|
+
children: title
|
|
35
|
+
}, index);
|
|
36
|
+
})
|
|
37
|
+
}), tabItems[selectedIndex] && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ComponentNode.default, {
|
|
38
|
+
node: tabItems[selectedIndex].child,
|
|
39
|
+
surfaceId
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.default = Tabs;
|
|
47
|
+
//# sourceMappingURL=Tabs.cjs.map
|