@dxos/plugin-automation 0.7.5-labs.8a82073 → 0.7.5-labs.a8b535d
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/lib/browser/AutomationPanel-ITYXSN5Z.mjs +132 -0
- package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DQ7ZSYJJ.mjs → chunk-OFDNNRLE.mjs} +3 -6
- package/dist/lib/browser/{chunk-DQ7ZSYJJ.mjs.map → chunk-OFDNNRLE.mjs.map} +3 -3
- package/dist/lib/browser/chunk-U7QLNY2S.mjs +8 -0
- package/dist/lib/browser/chunk-U7QLNY2S.mjs.map +7 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs +119 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs.map +7 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +56 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +21 -373
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs +27 -0
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs.map +7 -0
- package/dist/lib/node/{chunk-IPCNJYQL.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -132
- package/dist/lib/node/AutomationPanel-X33HHDMQ.cjs.map +7 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs +148 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs.map +7 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs +40 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs.map +7 -0
- package/dist/lib/node/{chunk-TQEDPRY5.cjs → chunk-ORMEYEBE.cjs} +6 -9
- package/dist/lib/node/{chunk-TQEDPRY5.cjs.map → chunk-ORMEYEBE.cjs.map} +3 -3
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +72 -0
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +36 -374
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-BVZ63QP4.cjs → react-surface-2WRVAPGR.cjs} +9 -28
- package/dist/lib/node/react-surface-2WRVAPGR.cjs.map +7 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs +133 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JFHI22MF.mjs → chunk-6MUUH67V.mjs} +3 -6
- package/dist/lib/node-esm/{chunk-JFHI22MF.mjs.map → chunk-6MUUH67V.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs +10 -0
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs +120 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs.map +7 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +57 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +21 -373
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs +28 -0
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/{ai-client.d.ts → complementary-panel.d.ts} +2 -3
- package/dist/types/src/capabilities/complementary-panel.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -180
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -11
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -94
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +23 -73
- package/src/AutomationPlugin.tsx +9 -64
- package/src/capabilities/complementary-panel.ts +56 -0
- package/src/capabilities/index.ts +1 -5
- package/src/capabilities/react-surface.tsx +2 -16
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
- package/src/components/index.ts +0 -7
- package/src/index.ts +2 -3
- package/src/meta.ts +1 -2
- package/src/testing/index.ts +0 -1
- package/src/testing/test-functions.ts +0 -7
- package/src/translations.ts +1 -29
- package/dist/lib/browser/AutomationPanel-CL2TWZT5.mjs +0 -8
- package/dist/lib/browser/AutomationPanel-CL2TWZT5.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-EJ3IWL7Y.mjs +0 -12
- package/dist/lib/browser/ChatContainer-EJ3IWL7Y.mjs.map +0 -7
- package/dist/lib/browser/ai-client-UJLNYP7B.mjs +0 -22
- package/dist/lib/browser/ai-client-UJLNYP7B.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-3H5TCRG4.mjs +0 -162
- package/dist/lib/browser/app-graph-builder-3H5TCRG4.mjs.map +0 -7
- package/dist/lib/browser/chunk-43WRHV2L.mjs +0 -150
- package/dist/lib/browser/chunk-43WRHV2L.mjs.map +0 -7
- package/dist/lib/browser/chunk-4M74P6YW.mjs +0 -284
- package/dist/lib/browser/chunk-4M74P6YW.mjs.map +0 -7
- package/dist/lib/browser/chunk-6KJRL5KV.mjs +0 -243
- package/dist/lib/browser/chunk-6KJRL5KV.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQHXJZ4K.mjs +0 -15
- package/dist/lib/browser/chunk-BQHXJZ4K.mjs.map +0 -7
- package/dist/lib/browser/chunk-N4SSCQ7P.mjs +0 -1602
- package/dist/lib/browser/chunk-N4SSCQ7P.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5YVZJFS3.mjs +0 -29
- package/dist/lib/browser/intent-resolver-5YVZJFS3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RRTZFTKR.mjs +0 -50
- package/dist/lib/browser/react-surface-RRTZFTKR.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -24
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-BCEY3YXO.cjs +0 -26
- package/dist/lib/node/AutomationPanel-BCEY3YXO.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-QUWFEBTI.cjs +0 -33
- package/dist/lib/node/ChatContainer-QUWFEBTI.cjs.map +0 -7
- package/dist/lib/node/ai-client-AOB6TLNW.cjs +0 -38
- package/dist/lib/node/ai-client-AOB6TLNW.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-CDEQJEHY.cjs +0 -178
- package/dist/lib/node/app-graph-builder-CDEQJEHY.cjs.map +0 -7
- package/dist/lib/node/chunk-AWZVJZ2I.cjs +0 -34
- package/dist/lib/node/chunk-AWZVJZ2I.cjs.map +0 -7
- package/dist/lib/node/chunk-DKGNORZK.cjs +0 -1586
- package/dist/lib/node/chunk-DKGNORZK.cjs.map +0 -7
- package/dist/lib/node/chunk-H3RSMGJG.cjs +0 -173
- package/dist/lib/node/chunk-H3RSMGJG.cjs.map +0 -7
- package/dist/lib/node/chunk-IPCNJYQL.cjs.map +0 -7
- package/dist/lib/node/chunk-LC6KNDPQ.cjs +0 -302
- package/dist/lib/node/chunk-LC6KNDPQ.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-MJFZT5IU.cjs +0 -44
- package/dist/lib/node/intent-resolver-MJFZT5IU.cjs.map +0 -7
- package/dist/lib/node/react-surface-BVZ63QP4.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -46
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-YTIZ74RI.mjs +0 -9
- package/dist/lib/node-esm/AutomationPanel-YTIZ74RI.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-QSMDZRDU.mjs +0 -13
- package/dist/lib/node-esm/ChatContainer-QSMDZRDU.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-RUCCJ7JZ.mjs +0 -23
- package/dist/lib/node-esm/ai-client-RUCCJ7JZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-GR3URVNX.mjs +0 -163
- package/dist/lib/node-esm/app-graph-builder-GR3URVNX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7JO77AAS.mjs +0 -151
- package/dist/lib/node-esm/chunk-7JO77AAS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CQPQXIJP.mjs +0 -285
- package/dist/lib/node-esm/chunk-CQPQXIJP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CZXU4CFK.mjs +0 -244
- package/dist/lib/node-esm/chunk-CZXU4CFK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D7RARVTS.mjs +0 -1603
- package/dist/lib/node-esm/chunk-D7RARVTS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LSSWQIQD.mjs +0 -16
- package/dist/lib/node-esm/chunk-LSSWQIQD.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FCKNRTKQ.mjs +0 -30
- package/dist/lib/node-esm/intent-resolver-FCKNRTKQ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-Y5LQHUQN.mjs +0 -51
- package/dist/lib/node-esm/react-surface-Y5LQHUQN.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -25
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/artifacts.stories.d.ts +0 -16
- package/dist/types/src/artifacts.stories.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -180
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.d.ts +0 -11
- package/dist/types/src/components/Box/StatusLine.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.stories.d.ts +0 -9
- package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.d.ts +0 -15
- package/dist/types/src/components/Box/Tabbed.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.stories.d.ts +0 -8
- package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.d.ts +0 -13
- package/dist/types/src/components/Box/ToggleContainer.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts +0 -9
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/index.d.ts +0 -4
- package/dist/types/src/components/Box/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -7
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/index.d.ts +0 -4
- package/dist/types/src/components/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +0 -14
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +0 -8
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownViewer/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -7
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -8
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -2
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +0 -20
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -10
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
- package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
- package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -12
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -2
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/hooks/email.d.ts +0 -4
- package/dist/types/src/hooks/email.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -6
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
- package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts +0 -70
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +0 -7
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +0 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -41
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/presets.d.ts +0 -9
- package/dist/types/src/presets.d.ts.map +0 -1
- package/dist/types/src/testing/test-services.d.ts +0 -5
- package/dist/types/src/testing/test-services.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -4
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/registry.d.ts +0 -10
- package/dist/types/src/types/registry.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -221
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -18
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/artifacts.stories.tsx +0 -241
- package/src/capabilities/ai-client.ts +0 -19
- package/src/capabilities/app-graph-builder.ts +0 -156
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/Box/StatusLine.stories.tsx +0 -52
- package/src/components/Box/StatusLine.tsx +0 -76
- package/src/components/Box/Tabbed.stories.tsx +0 -51
- package/src/components/Box/Tabbed.tsx +0 -89
- package/src/components/Box/ToggleContainer.stories.tsx +0 -110
- package/src/components/Box/ToggleContainer.tsx +0 -108
- package/src/components/Box/index.ts +0 -7
- package/src/components/ChatContainer/ChatContainer.tsx +0 -52
- package/src/components/ChatContainer/index.ts +0 -8
- package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +0 -56
- package/src/components/MarkdownViewer/MarkdownViewer.tsx +0 -79
- package/src/components/MarkdownViewer/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -50
- package/src/components/Prompt/Prompt.tsx +0 -36
- package/src/components/Prompt/index.ts +0 -5
- package/src/components/Prompt/prompt-autocomplete.ts +0 -200
- package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
- package/src/components/PromptEditor/PromptEditor.tsx +0 -222
- package/src/components/PromptEditor/index.ts +0 -5
- package/src/components/PromptEditor/prompt-extension.ts +0 -43
- package/src/components/PromptEditor/types.tsx +0 -28
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -75
- package/src/components/ServiceRegistry/index.ts +0 -5
- package/src/components/Thread/Thread.stories.tsx +0 -197
- package/src/components/Thread/Thread.tsx +0 -156
- package/src/components/Thread/ThreadMessage.tsx +0 -225
- package/src/components/Thread/index.ts +0 -5
- package/src/hooks/email.ts +0 -49
- package/src/hooks/index.ts +0 -10
- package/src/hooks/invocation-handler.ts +0 -109
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -210
- package/src/hooks/useChatProcessor.tsx +0 -86
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- package/src/hooks/useMessageQueue.ts +0 -23
- package/src/hooks/useServices.ts +0 -28
- package/src/presets.ts +0 -248
- package/src/testing/test-services.ts +0 -131
- package/src/tools/function.ts +0 -47
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -227
- package/src/tools/openapi.ts +0 -331
- package/src/types/index.ts +0 -7
- package/src/types/registry.ts +0 -26
- package/src/types/schema.ts +0 -132
- package/src/types/types.ts +0 -21
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
|
|
10
|
-
const numbers = [
|
|
11
|
-
{ regular: 'ph--number-circle-zero--thin', active: 'ph--number-circle-zero--duotone' },
|
|
12
|
-
{ regular: 'ph--number-circle-one--thin', active: 'ph--number-circle-one--duotone' },
|
|
13
|
-
{ regular: 'ph--number-circle-two--thin', active: 'ph--number-circle-two--duotone' },
|
|
14
|
-
{ regular: 'ph--number-circle-three--thin', active: 'ph--number-circle-three--duotone' },
|
|
15
|
-
{ regular: 'ph--number-circle-four--thin', active: 'ph--number-circle-four--duotone' },
|
|
16
|
-
{ regular: 'ph--number-circle-five--thin', active: 'ph--number-circle-five--duotone' },
|
|
17
|
-
{ regular: 'ph--number-circle-six--thin', active: 'ph--number-circle-six--duotone' },
|
|
18
|
-
{ regular: 'ph--number-circle-seven--thin', active: 'ph--number-circle-seven--duotone' },
|
|
19
|
-
{ regular: 'ph--number-circle-eight--thin', active: 'ph--number-circle-eight--duotone' },
|
|
20
|
-
{ regular: 'ph--number-circle-nine--thin', active: 'ph--number-circle-nine--duotone' },
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export type TabsProps = ThemedClassName<{
|
|
24
|
-
length: number;
|
|
25
|
-
selected?: number;
|
|
26
|
-
onSelect?: (index: number) => void;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(
|
|
30
|
-
({ classNames, length, selected = 0, onSelect }, forwardedRef) => {
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
ref={forwardedRef}
|
|
34
|
-
className={mx('flex flex-col overflow-hidden outline-none', classNames)}
|
|
35
|
-
tabIndex={-1}
|
|
36
|
-
onKeyDown={(ev) => {
|
|
37
|
-
// TODO(burdon): Focus when open Toggle.
|
|
38
|
-
switch (ev.key) {
|
|
39
|
-
case 'ArrowDown':
|
|
40
|
-
case 'ArrowRight': {
|
|
41
|
-
ev.preventDefault();
|
|
42
|
-
ev.stopPropagation();
|
|
43
|
-
if (selected < length - 1) {
|
|
44
|
-
onSelect?.(selected + 1);
|
|
45
|
-
}
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case 'ArrowUp':
|
|
49
|
-
case 'ArrowLeft': {
|
|
50
|
-
ev.preventDefault();
|
|
51
|
-
ev.stopPropagation();
|
|
52
|
-
if (selected > 0) {
|
|
53
|
-
onSelect?.(selected - 1);
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case 'Enter': {
|
|
59
|
-
ev.preventDefault();
|
|
60
|
-
ev.stopPropagation();
|
|
61
|
-
onSelect?.(selected);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
{Array.from({ length }).map((_, i) => {
|
|
68
|
-
const icon = numbers[i + 1];
|
|
69
|
-
return (
|
|
70
|
-
<div
|
|
71
|
-
key={i}
|
|
72
|
-
className={mx(
|
|
73
|
-
'relative flex w-[24px] h-[28px] justify-center cursor-pointer text-subdued',
|
|
74
|
-
selected === i && '!text-cyan-550 !dark:text-cyan-300',
|
|
75
|
-
)}
|
|
76
|
-
>
|
|
77
|
-
{i < length - 1 && <div className='absolute left-[11.5px] top-[21px] w-[1px] h-[10px] bg-neutral-400' />}
|
|
78
|
-
<Icon
|
|
79
|
-
icon={selected === i ? icon.regular : icon.regular}
|
|
80
|
-
classNames='z-10 !p-0 !w-[24px] !h-[24px] outline-none'
|
|
81
|
-
onClick={() => onSelect?.(i)}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
})}
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
},
|
|
89
|
-
);
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { computed, type ReadonlySignal, signal } from '@preact/signals-core';
|
|
8
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
9
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
|
-
|
|
11
|
-
import { faker } from '@dxos/random';
|
|
12
|
-
import { Icon, Input, Toolbar } from '@dxos/react-ui';
|
|
13
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
-
import { withLayout, withTheme, withSignals } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { ToggleContainer, type ToggleContainerProps } from './ToggleContainer';
|
|
17
|
-
import { MarkdownViewer } from '../MarkdownViewer';
|
|
18
|
-
|
|
19
|
-
class Generator {
|
|
20
|
-
private readonly _current = signal<string>(faker.lorem.sentence(5));
|
|
21
|
-
private readonly _lines = signal<string[]>([]);
|
|
22
|
-
private _running: NodeJS.Timeout | undefined;
|
|
23
|
-
|
|
24
|
-
readonly count = computed(() => this._lines.value.length);
|
|
25
|
-
readonly text: ReadonlySignal<string[]> = computed(() => [...this._lines.value, this._current.value]);
|
|
26
|
-
|
|
27
|
-
start() {
|
|
28
|
-
this.stop();
|
|
29
|
-
this._running = setInterval(() => {
|
|
30
|
-
if (this._current.value.length > 0) {
|
|
31
|
-
this._current.value += ' ';
|
|
32
|
-
}
|
|
33
|
-
this._current.value += faker.lorem.words(Math.ceil(Math.random() * 2));
|
|
34
|
-
if (Math.random() > 0.95) {
|
|
35
|
-
this._lines.value = [...this._lines.value, this._current.value + '.'];
|
|
36
|
-
this._current.value = '';
|
|
37
|
-
}
|
|
38
|
-
}, 100);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
stop() {
|
|
42
|
-
if (this._running) {
|
|
43
|
-
clearInterval(this._running);
|
|
44
|
-
this._running = undefined;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Render = ({ shrinkX, ...props }: ToggleContainerProps) => {
|
|
50
|
-
const generator = useMemo(() => new Generator(), []);
|
|
51
|
-
const [running, setRunning] = useState(false);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (running) {
|
|
54
|
-
generator.start();
|
|
55
|
-
} else {
|
|
56
|
-
generator.stop();
|
|
57
|
-
}
|
|
58
|
-
}, [running]);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div className='flex flex-col w-[500px]'>
|
|
62
|
-
<Toolbar.Root classNames='p-4'>
|
|
63
|
-
<Input.Root>
|
|
64
|
-
<Input.Switch checked={running} onCheckedChange={(checked) => setRunning(checked)} />
|
|
65
|
-
</Input.Root>
|
|
66
|
-
<div className='grow' />
|
|
67
|
-
<div>{generator.count.value}</div>
|
|
68
|
-
</Toolbar.Root>
|
|
69
|
-
<div className='flex p-4'>
|
|
70
|
-
<div className={mx('border border-border rounded-md p-2', !shrinkX && 'w-full')}>
|
|
71
|
-
<ToggleContainer
|
|
72
|
-
{...props}
|
|
73
|
-
shrinkX={shrinkX}
|
|
74
|
-
icon={
|
|
75
|
-
running ? (
|
|
76
|
-
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
|
|
77
|
-
) : undefined
|
|
78
|
-
}
|
|
79
|
-
>
|
|
80
|
-
<MarkdownViewer classNames='text-sm' content={generator.text.value.join('\n\n')} />
|
|
81
|
-
</ToggleContainer>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const meta: Meta<typeof ToggleContainer> = {
|
|
89
|
-
title: 'plugins/plugin-automation/ToggleContainer',
|
|
90
|
-
component: ToggleContainer,
|
|
91
|
-
render: Render,
|
|
92
|
-
decorators: [withSignals, withTheme, withLayout({ fullscreen: true, classNames: 'justify-center bg-baseSurface' })],
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export default meta;
|
|
96
|
-
|
|
97
|
-
type Story = StoryObj<typeof ToggleContainer>;
|
|
98
|
-
|
|
99
|
-
export const Default: Story = {
|
|
100
|
-
args: {
|
|
101
|
-
title: 'Markdown',
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const Shrink: Story = {
|
|
106
|
-
args: {
|
|
107
|
-
title: 'Markdown',
|
|
108
|
-
shrinkX: true,
|
|
109
|
-
},
|
|
110
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, useControlledState, type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
|
|
10
|
-
export type ToggleContainerProps = ThemedClassName<
|
|
11
|
-
PropsWithChildren<{
|
|
12
|
-
title?: string | JSX.Element;
|
|
13
|
-
icon?: JSX.Element;
|
|
14
|
-
open?: boolean;
|
|
15
|
-
duration?: number;
|
|
16
|
-
/** Should shrink the width when closed. */
|
|
17
|
-
shrinkX?: boolean;
|
|
18
|
-
onChangeOpen?: (open: boolean) => void;
|
|
19
|
-
}>
|
|
20
|
-
>;
|
|
21
|
-
|
|
22
|
-
export const ToggleContainer = ({
|
|
23
|
-
classNames,
|
|
24
|
-
title,
|
|
25
|
-
icon,
|
|
26
|
-
open: _open,
|
|
27
|
-
duration = 400,
|
|
28
|
-
shrinkX = false,
|
|
29
|
-
children,
|
|
30
|
-
onChangeOpen,
|
|
31
|
-
}: ToggleContainerProps) => {
|
|
32
|
-
const [open, setOpen] = useControlledState(_open);
|
|
33
|
-
const [expandX, setExpandX] = useState(shrinkX ? open : true);
|
|
34
|
-
const [expandY, setExpandY] = useState(open);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
let t: NodeJS.Timeout;
|
|
38
|
-
if (open) {
|
|
39
|
-
if (shrinkX) {
|
|
40
|
-
setExpandX(true);
|
|
41
|
-
}
|
|
42
|
-
t = setTimeout(
|
|
43
|
-
() => {
|
|
44
|
-
setExpandY(true);
|
|
45
|
-
},
|
|
46
|
-
shrinkX ? duration : 0,
|
|
47
|
-
);
|
|
48
|
-
} else {
|
|
49
|
-
setExpandY(false);
|
|
50
|
-
if (shrinkX) {
|
|
51
|
-
t = setTimeout(() => {
|
|
52
|
-
setExpandX(false);
|
|
53
|
-
}, duration);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return () => clearTimeout(t);
|
|
58
|
-
}, [open]);
|
|
59
|
-
|
|
60
|
-
const handleToggle = () => {
|
|
61
|
-
if (onChangeOpen) {
|
|
62
|
-
onChangeOpen(!open);
|
|
63
|
-
} else {
|
|
64
|
-
setOpen((open) => !open);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className={mx('overflow-hidden', classNames)}>
|
|
70
|
-
{title && (
|
|
71
|
-
<div
|
|
72
|
-
className='flex gap-1 py-1 items-center text-sm text-subdued cursor-pointer select-none'
|
|
73
|
-
onClick={handleToggle}
|
|
74
|
-
>
|
|
75
|
-
<div className='flex w-[24px] h-[24px] items-center justify-center'>
|
|
76
|
-
<Icon
|
|
77
|
-
size={4}
|
|
78
|
-
icon={'ph--caret-right--regular'}
|
|
79
|
-
style={{ transitionDuration: `${shrinkX ? duration * 2 : duration}ms` }}
|
|
80
|
-
classNames={['transition transition-transform ease-in-out', open ? 'rotate-90' : 'transform-none']}
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
<div className='flex-1 pis-1 pie-1 truncate'>{title}</div>
|
|
84
|
-
{icon}
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
|
-
<div
|
|
88
|
-
style={{ transitionDuration: `${duration}ms` }}
|
|
89
|
-
className={mx(
|
|
90
|
-
'grid transition-[grid-template-columns] ease-in-out',
|
|
91
|
-
expandX ? 'grid-cols-[1fr]' : 'grid-cols-[0fr]',
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
<div className='overflow-hidden'>
|
|
95
|
-
<div
|
|
96
|
-
style={{ transitionDuration: `${duration}ms` }}
|
|
97
|
-
className={mx(
|
|
98
|
-
'grid transition-[grid-template-rows] ease-in-out',
|
|
99
|
-
expandY ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',
|
|
100
|
-
)}
|
|
101
|
-
>
|
|
102
|
-
<div className={mx('flex overflow-hidden transition-opacity')}>{children}</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
|
-
|
|
10
|
-
import { useChatProcessor, useMessageQueue } from '../../hooks';
|
|
11
|
-
import { type AIChatType } from '../../types';
|
|
12
|
-
import { Thread } from '../Thread';
|
|
13
|
-
|
|
14
|
-
export const ChatContainer = ({ chat, role }: { chat: AIChatType; role: string }) => {
|
|
15
|
-
const processor = useChatProcessor(chat);
|
|
16
|
-
const messageQueue = useMessageQueue(chat);
|
|
17
|
-
const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
|
|
18
|
-
|
|
19
|
-
const handleSubmit = useCallback(
|
|
20
|
-
async (text: string) => {
|
|
21
|
-
if (processor.streaming.value) {
|
|
22
|
-
await processor.cancel();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
invariant(messageQueue);
|
|
26
|
-
await processor.request(text, {
|
|
27
|
-
history: messageQueue.items,
|
|
28
|
-
onComplete: (messages) => messageQueue.append(messages),
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
[processor, messageQueue],
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const handleStop = useCallback(() => {
|
|
35
|
-
if (processor.streaming.value) {
|
|
36
|
-
void processor.cancel();
|
|
37
|
-
}
|
|
38
|
-
}, [processor]);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<StackItem.Content toolbar={false} role={role}>
|
|
42
|
-
<Thread
|
|
43
|
-
messages={messages}
|
|
44
|
-
streaming={processor.streaming.value}
|
|
45
|
-
collapse={true}
|
|
46
|
-
onSubmit={handleSubmit}
|
|
47
|
-
onSuggest={handleSubmit}
|
|
48
|
-
onStop={handleStop}
|
|
49
|
-
/>
|
|
50
|
-
</StackItem.Content>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
11
|
-
|
|
12
|
-
import { MarkdownViewer } from './MarkdownViewer';
|
|
13
|
-
|
|
14
|
-
faker.seed(0);
|
|
15
|
-
|
|
16
|
-
const meta: Meta<typeof MarkdownViewer> = {
|
|
17
|
-
title: 'plugins/plugin-automation/MarkdownViewer',
|
|
18
|
-
component: MarkdownViewer,
|
|
19
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof MarkdownViewer>;
|
|
25
|
-
|
|
26
|
-
const content = `
|
|
27
|
-
# Hello, world!
|
|
28
|
-
|
|
29
|
-
${faker.lorem.paragraphs(1)}
|
|
30
|
-
|
|
31
|
-
Here's a JSON block:
|
|
32
|
-
|
|
33
|
-
~~~json
|
|
34
|
-
{
|
|
35
|
-
"hello": "world"
|
|
36
|
-
}
|
|
37
|
-
~~~
|
|
38
|
-
|
|
39
|
-
And some code:
|
|
40
|
-
|
|
41
|
-
~~~ts
|
|
42
|
-
const App = () => {
|
|
43
|
-
const title = 'Hello, world!';
|
|
44
|
-
return <div>{title}</div>;
|
|
45
|
-
};
|
|
46
|
-
~~~
|
|
47
|
-
|
|
48
|
-
${faker.lorem.paragraphs(1)}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
export const Default: Story = {
|
|
52
|
-
args: {
|
|
53
|
-
classNames: 'w-[500px] border border-border rounded-md p-4',
|
|
54
|
-
content,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
import ReactMarkdown from 'react-markdown';
|
|
7
|
-
|
|
8
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
-
import { omit } from '@dxos/util';
|
|
12
|
-
|
|
13
|
-
type MarkdownViewerProps = ThemedClassName<{
|
|
14
|
-
content?: string;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Transform text into react elements.
|
|
19
|
-
*
|
|
20
|
-
* https://github.com/remarkjs/react-markdown
|
|
21
|
-
* markdown -> remark -> [mdast -> remark plugins] -> [hast -> rehype plugins] -> components -> react elements.
|
|
22
|
-
*/
|
|
23
|
-
// TODO(burdon): Styles.
|
|
24
|
-
// TODO(burdon): Factor out (react-ui-syntax-highlighter).
|
|
25
|
-
export const MarkdownViewer: FC<MarkdownViewerProps> = ({ classNames, content = '' }) => {
|
|
26
|
-
return (
|
|
27
|
-
<div className={mx('space-y-2', classNames)}>
|
|
28
|
-
<ReactMarkdown
|
|
29
|
-
components={{
|
|
30
|
-
a: ({ node, children, href, ...props }) => (
|
|
31
|
-
<a
|
|
32
|
-
href={href}
|
|
33
|
-
className='text-primary-500 hover:text-primary-500'
|
|
34
|
-
target='_blank'
|
|
35
|
-
rel='noopener noreferrer'
|
|
36
|
-
{...props}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</a>
|
|
40
|
-
),
|
|
41
|
-
ol: ({ node, children, ...props }) => (
|
|
42
|
-
<ol className='leading-tight list-decimal pl-6' {...omit(props, ['ordered'])}>
|
|
43
|
-
{children}
|
|
44
|
-
</ol>
|
|
45
|
-
),
|
|
46
|
-
ul: ({ node, children, ...props }) => (
|
|
47
|
-
<ul className='leading-tight list-disc pl-6' {...omit(props, ['ordered'])}>
|
|
48
|
-
{children}
|
|
49
|
-
</ul>
|
|
50
|
-
),
|
|
51
|
-
li: ({ node, children, ...props }) => (
|
|
52
|
-
<li className='' {...omit(props, ['ordered'])}>
|
|
53
|
-
{children}
|
|
54
|
-
</li>
|
|
55
|
-
),
|
|
56
|
-
blockquote: ({ node, children, ...props }) => (
|
|
57
|
-
<blockquote className='border-l-4 border-primary-500 pl-4 my-4 text-primary-500' {...props}>
|
|
58
|
-
{children}
|
|
59
|
-
</blockquote>
|
|
60
|
-
),
|
|
61
|
-
code: ({ children, className }) => {
|
|
62
|
-
const [_, language] = /language-(\w+)/.exec(className || '') || [];
|
|
63
|
-
return (
|
|
64
|
-
<SyntaxHighlighter PreTag='div' language={language} className='p-0'>
|
|
65
|
-
{children}
|
|
66
|
-
</SyntaxHighlighter>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{content}
|
|
72
|
-
</ReactMarkdown>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// const Cursor = () => {
|
|
78
|
-
// return <span className='animate-[pulse_1s_steps(1)_infinite] text-primary-500'>▊</span>;
|
|
79
|
-
// };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
10
|
-
|
|
11
|
-
import { Prompt } from './Prompt';
|
|
12
|
-
|
|
13
|
-
const meta: Meta<typeof Prompt> = {
|
|
14
|
-
title: 'plugins/plugin-automation/Prompt',
|
|
15
|
-
component: Prompt,
|
|
16
|
-
decorators: [withTheme],
|
|
17
|
-
parameters: {
|
|
18
|
-
layout: 'centered',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof Prompt>;
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
29
|
-
autoFocus: true,
|
|
30
|
-
onEnter: (text) => {
|
|
31
|
-
console.log('onEnter', text);
|
|
32
|
-
},
|
|
33
|
-
onSuggest: (text) => {
|
|
34
|
-
const trimmed = text.trim().toLowerCase();
|
|
35
|
-
if (trimmed.length < 2) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const suggestions = [
|
|
40
|
-
'Create a CRM',
|
|
41
|
-
'Create a new project',
|
|
42
|
-
'Find flights to Tokyo',
|
|
43
|
-
"Let's play chess",
|
|
44
|
-
'Show me Paris on a map',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
return suggestions.filter((s) => s.toLowerCase().startsWith(text));
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
9
|
-
createBasicExtensions,
|
|
10
|
-
createThemeExtensions,
|
|
11
|
-
useTextEditor,
|
|
12
|
-
type UseTextEditorProps,
|
|
13
|
-
} from '@dxos/react-ui-editor';
|
|
14
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
15
|
-
|
|
16
|
-
import { createAutocompleteExtension, type AutocompleteOptions } from './prompt-autocomplete';
|
|
17
|
-
|
|
18
|
-
export type PromptProps = ThemedClassName<AutocompleteOptions & Pick<UseTextEditorProps, 'autoFocus'>>;
|
|
19
|
-
|
|
20
|
-
export const Prompt = ({ classNames, autoFocus, onEnter, onSuggest }: PromptProps) => {
|
|
21
|
-
const { themeMode } = useThemeContext();
|
|
22
|
-
const { parentRef } = useTextEditor({
|
|
23
|
-
autoFocus,
|
|
24
|
-
extensions: [
|
|
25
|
-
createBasicExtensions({
|
|
26
|
-
bracketMatching: false,
|
|
27
|
-
lineWrapping: false,
|
|
28
|
-
placeholder: 'Ask a question...',
|
|
29
|
-
}),
|
|
30
|
-
createThemeExtensions({ themeMode }),
|
|
31
|
-
createAutocompleteExtension({ onEnter, onSuggest }),
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return <div ref={parentRef} className={mx(classNames)} />;
|
|
36
|
-
};
|