@signalcore/ui 0.1.0 → 1.0.0-beta.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/README.md +896 -513
- package/dist/AgentAbout.d.ts +186 -0
- package/dist/AgentAbout.js +1020 -0
- package/dist/AgentAbout.js.map +1 -0
- package/dist/AgentCard.d.ts +49 -0
- package/dist/AgentCard.js +77 -0
- package/dist/AgentCard.js.map +1 -0
- package/dist/AgentChat.d.ts +233 -0
- package/dist/AgentChat.js +1127 -0
- package/dist/AgentChat.js.map +1 -0
- package/dist/AgentSpace.d.ts +112 -0
- package/dist/AgentSpace.js +339 -0
- package/dist/AgentSpace.js.map +1 -0
- package/dist/AgentTasks.d.ts +48 -0
- package/dist/AgentTasks.js +120 -0
- package/dist/AgentTasks.js.map +1 -0
- package/dist/BrowserView.d.ts +52 -0
- package/dist/BrowserView.js +328 -0
- package/dist/BrowserView.js.map +1 -0
- package/dist/FileView.d.ts +63 -0
- package/dist/FileView.js +449 -0
- package/dist/FileView.js.map +1 -0
- package/dist/Modes.d.ts +13 -0
- package/dist/Modes.js +75 -0
- package/dist/Modes.js.map +1 -0
- package/dist/VoiceCall.d.ts +91 -0
- package/dist/VoiceCall.js +302 -0
- package/dist/VoiceCall.js.map +1 -0
- package/dist/about.d.ts +212 -0
- package/dist/about.js +136 -0
- package/dist/about.js.map +1 -0
- package/dist/agentIcons.d.ts +33 -0
- package/dist/agentIcons.js +36 -0
- package/dist/agentIcons.js.map +1 -0
- package/dist/automation/Automation.d.ts +35 -0
- package/dist/automation/Automation.js +268 -0
- package/dist/automation/Automation.js.map +1 -0
- package/dist/automation/RunView.d.ts +25 -0
- package/dist/automation/RunView.js +187 -0
- package/dist/automation/RunView.js.map +1 -0
- package/dist/automation/cron.d.ts +41 -0
- package/dist/automation/cron.js +169 -0
- package/dist/automation/cron.js.map +1 -0
- package/dist/automation/marks.js +121 -0
- package/dist/automation/marks.js.map +1 -0
- package/dist/automation/messages.d.ts +113 -0
- package/dist/automation/messages.js +113 -0
- package/dist/automation/messages.js.map +1 -0
- package/dist/automation/record.d.ts +47 -0
- package/dist/automation/record.js +177 -0
- package/dist/automation/record.js.map +1 -0
- package/dist/automation/types.d.ts +143 -0
- package/dist/automation/when.d.ts +36 -0
- package/dist/automation/when.js +168 -0
- package/dist/automation/when.js.map +1 -0
- package/dist/blocks.d.ts +185 -0
- package/dist/browser.js +292 -0
- package/dist/browser.js.map +1 -0
- package/dist/call.d.ts +89 -0
- package/dist/call.js +218 -0
- package/dist/call.js.map +1 -0
- package/dist/channelParts.js +26 -0
- package/dist/channelParts.js.map +1 -0
- package/dist/classes.js +8 -3
- package/dist/classes.js.map +1 -0
- package/dist/client.d.ts +146 -54
- package/dist/client.js +204 -1
- package/dist/client.js.map +1 -0
- package/dist/conversationFiles.js +46 -0
- package/dist/conversationFiles.js.map +1 -0
- package/dist/credentials.d.ts +45 -0
- package/dist/credentials.js +98 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dev.js +17 -0
- package/dist/dev.js.map +1 -0
- package/dist/es.d.ts +17 -0
- package/dist/es.js +382 -0
- package/dist/es.js.map +1 -0
- package/dist/files.d.ts +21 -0
- package/dist/files.js +214 -0
- package/dist/files.js.map +1 -0
- package/dist/frames.d.ts +115 -0
- package/dist/frames.js +219 -0
- package/dist/frames.js.map +1 -0
- package/dist/icons.js +29 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +63 -60
- package/dist/index.js +59 -45
- package/dist/kit/AudioPlayer.d.ts +20 -0
- package/dist/kit/AudioPlayer.js +116 -0
- package/dist/kit/AudioPlayer.js.map +1 -0
- package/dist/kit/Button.d.ts +29 -0
- package/dist/kit/Button.js +59 -0
- package/dist/kit/Button.js.map +1 -0
- package/dist/kit/Card.d.ts +16 -0
- package/dist/kit/Card.js +36 -0
- package/dist/kit/Card.js.map +1 -0
- package/dist/kit/Chart.js +152 -0
- package/dist/kit/Chart.js.map +1 -0
- package/dist/kit/Choices.d.ts +21 -0
- package/dist/kit/Choices.js +99 -0
- package/dist/kit/Choices.js.map +1 -0
- package/dist/kit/Combobox.d.ts +26 -0
- package/dist/kit/Combobox.js +190 -0
- package/dist/kit/Combobox.js.map +1 -0
- package/dist/kit/DateField.d.ts +17 -0
- package/dist/kit/DateField.js +133 -0
- package/dist/kit/DateField.js.map +1 -0
- package/dist/kit/Field.d.ts +40 -0
- package/dist/kit/Field.js +98 -0
- package/dist/kit/Field.js.map +1 -0
- package/dist/kit/FileField.d.ts +113 -0
- package/dist/kit/FileField.js +341 -0
- package/dist/kit/FileField.js.map +1 -0
- package/dist/kit/FileMark.d.ts +15 -0
- package/dist/kit/FileMark.js +39 -0
- package/dist/kit/FileMark.js.map +1 -0
- package/dist/kit/Inputs.d.ts +59 -0
- package/dist/kit/Inputs.js +205 -0
- package/dist/kit/Inputs.js.map +1 -0
- package/dist/kit/List.d.ts +47 -0
- package/dist/kit/List.js +85 -0
- package/dist/kit/List.js.map +1 -0
- package/dist/kit/Mark.d.ts +30 -0
- package/dist/kit/Mark.js +27 -0
- package/dist/kit/Mark.js.map +1 -0
- package/dist/kit/MarkStack.d.ts +15 -0
- package/dist/kit/MarkStack.js +26 -0
- package/dist/kit/MarkStack.js.map +1 -0
- package/dist/kit/Note.d.ts +11 -0
- package/dist/kit/Note.js +31 -0
- package/dist/kit/Note.js.map +1 -0
- package/dist/kit/Popover.js +90 -0
- package/dist/kit/Popover.js.map +1 -0
- package/dist/kit/RangeField.d.ts +14 -0
- package/dist/kit/RangeField.js +47 -0
- package/dist/kit/RangeField.js.map +1 -0
- package/dist/kit/RatingField.d.ts +14 -0
- package/dist/kit/RatingField.js +50 -0
- package/dist/kit/RatingField.js.map +1 -0
- package/dist/kit/Stat.d.ts +26 -0
- package/dist/kit/Stat.js +46 -0
- package/dist/kit/Stat.js.map +1 -0
- package/dist/kit/Switch.d.ts +14 -0
- package/dist/kit/Switch.js +21 -0
- package/dist/kit/Switch.js.map +1 -0
- package/dist/kit/Tag.d.ts +16 -0
- package/dist/kit/Tag.js +20 -0
- package/dist/kit/Tag.js.map +1 -0
- package/dist/kit/Tile.d.ts +34 -0
- package/dist/kit/Tile.js +52 -0
- package/dist/kit/Tile.js.map +1 -0
- package/dist/kit/TimeField.d.ts +31 -0
- package/dist/kit/TimeField.js +109 -0
- package/dist/kit/TimeField.js.map +1 -0
- package/dist/kit/context.d.ts +22 -0
- package/dist/kit/context.js +46 -0
- package/dist/kit/context.js.map +1 -0
- package/dist/kit/dates.d.ts +14 -0
- package/dist/kit/dates.js +129 -0
- package/dist/kit/dates.js.map +1 -0
- package/dist/kit/messages.d.ts +99 -0
- package/dist/kit/messages.js +66 -0
- package/dist/kit/messages.js.map +1 -0
- package/dist/kit/numbers.d.ts +12 -0
- package/dist/kit/numbers.js +40 -0
- package/dist/kit/numbers.js.map +1 -0
- package/dist/kit/options.d.ts +10 -0
- package/dist/kit/options.js +23 -0
- package/dist/kit/options.js.map +1 -0
- package/dist/kit/uploads.d.ts +42 -0
- package/dist/kit/uploads.js +165 -0
- package/dist/kit/uploads.js.map +1 -0
- package/dist/kit/waveform.js +76 -0
- package/dist/kit/waveform.js.map +1 -0
- package/dist/locale.d.ts +1 -0
- package/dist/locale.js +1 -0
- package/dist/markdown.js +84 -0
- package/dist/markdown.js.map +1 -0
- package/dist/marks.js +217 -0
- package/dist/marks.js.map +1 -0
- package/dist/reveal.js +48 -0
- package/dist/reveal.js.map +1 -0
- package/dist/stepGlyphs.js +62 -0
- package/dist/stepGlyphs.js.map +1 -0
- package/dist/surface/Form.js +264 -0
- package/dist/surface/Form.js.map +1 -0
- package/dist/surface/Markdown.js +42 -0
- package/dist/surface/Markdown.js.map +1 -0
- package/dist/surface/Surface.d.ts +31 -17
- package/dist/surface/Surface.js +480 -57
- package/dist/surface/Surface.js.map +1 -0
- package/dist/surface/scope.d.ts +32 -0
- package/dist/surface/scope.js +23 -0
- package/dist/surface/scope.js.map +1 -0
- package/dist/surface/values.d.ts +44 -0
- package/dist/surface/values.js +237 -0
- package/dist/surface/values.js.map +1 -0
- package/dist/tint.d.ts +10 -0
- package/dist/tint.js +19 -0
- package/dist/tint.js.map +1 -0
- package/dist/types.d.ts +541 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/useAgentFace.d.ts +18 -0
- package/dist/useAgentFace.js +45 -0
- package/dist/useAgentFace.js.map +1 -0
- package/dist/useCall.d.ts +39 -0
- package/dist/useCall.js +273 -0
- package/dist/useCall.js.map +1 -0
- package/dist/useConversation.d.ts +77 -0
- package/dist/useConversation.js +523 -0
- package/dist/useConversation.js.map +1 -0
- package/dist/useDictation.d.ts +17 -0
- package/dist/useDictation.js +68 -0
- package/dist/useDictation.js.map +1 -0
- package/dist/useLive.d.ts +26 -0
- package/dist/useLive.js +88 -0
- package/dist/useLive.js.map +1 -0
- package/dist/usePolled.js +68 -0
- package/dist/usePolled.js.map +1 -0
- package/dist/voice/Orb.d.ts +10 -9
- package/dist/voice/Orb.js +43 -39
- package/dist/voice/Orb.js.map +1 -0
- package/dist/voice/StillOrb.js +33 -0
- package/dist/voice/StillOrb.js.map +1 -0
- package/dist/voice/WebGLOrb.js +98 -0
- package/dist/voice/WebGLOrb.js.map +1 -0
- package/dist/voice/fluidDots.js +161 -0
- package/dist/voice/fluidDots.js.map +1 -0
- package/dist/voice/motion.js +84 -0
- package/dist/voice/motion.js.map +1 -0
- package/dist/voice/orbs.d.ts +32 -0
- package/dist/voice/orbs.js +16 -0
- package/dist/voice/orbs.js.map +1 -0
- package/dist/voice/useReducedMotion.js +16 -16
- package/dist/voice/useReducedMotion.js.map +1 -0
- package/dist/voice/wave.js +116 -0
- package/dist/voice/wave.js.map +1 -0
- package/dist/voice/webgl.js +177 -0
- package/dist/voice/webgl.js.map +1 -0
- package/dist/widget.js +284 -8
- package/package.json +49 -39
- package/src/AgentAbout.tsx +1621 -0
- package/src/AgentCard.tsx +123 -0
- package/src/AgentChat.tsx +1812 -0
- package/src/AgentSpace.tsx +540 -0
- package/src/AgentTasks.tsx +163 -0
- package/src/BrowserView.tsx +442 -0
- package/src/FileView.tsx +620 -0
- package/src/Modes.tsx +112 -0
- package/src/VoiceCall.tsx +411 -0
- package/src/about.ts +355 -0
- package/src/agentIcons.ts +56 -0
- package/src/automation/Automation.tsx +308 -0
- package/src/automation/RunView.tsx +213 -0
- package/src/automation/cron.ts +196 -0
- package/src/automation/marks.tsx +144 -0
- package/src/automation/messages.ts +231 -0
- package/src/automation/record.ts +206 -0
- package/src/automation/types.ts +146 -0
- package/src/automation/when.ts +195 -0
- package/src/blocks.ts +249 -0
- package/src/browser.ts +334 -0
- package/src/call.ts +300 -0
- package/src/channelParts.ts +17 -0
- package/src/classes.ts +10 -0
- package/src/client.ts +397 -0
- package/src/conversationFiles.ts +54 -0
- package/src/credentials.ts +158 -0
- package/src/dev.ts +20 -0
- package/src/es.ts +423 -0
- package/src/files.ts +238 -0
- package/src/frames.ts +291 -0
- package/src/icons.tsx +49 -0
- package/src/index.ts +271 -0
- package/src/kit/AudioPlayer.tsx +129 -0
- package/src/kit/Button.tsx +97 -0
- package/src/kit/Card.tsx +47 -0
- package/src/kit/Chart.tsx +129 -0
- package/src/kit/Choices.tsx +131 -0
- package/src/kit/Combobox.tsx +247 -0
- package/src/kit/DateField.tsx +156 -0
- package/src/kit/Field.tsx +137 -0
- package/src/kit/FileField.tsx +492 -0
- package/src/kit/FileMark.tsx +56 -0
- package/src/kit/Inputs.tsx +250 -0
- package/src/kit/List.tsx +135 -0
- package/src/kit/Mark.tsx +64 -0
- package/src/kit/MarkStack.tsx +29 -0
- package/src/kit/Note.tsx +42 -0
- package/src/kit/Popover.tsx +121 -0
- package/src/kit/RangeField.tsx +53 -0
- package/src/kit/RatingField.tsx +62 -0
- package/src/kit/Stat.tsx +60 -0
- package/src/kit/Switch.tsx +28 -0
- package/src/kit/Tag.tsx +32 -0
- package/src/kit/Tile.tsx +74 -0
- package/src/kit/TimeField.tsx +157 -0
- package/src/kit/context.tsx +246 -0
- package/src/kit/dates.ts +150 -0
- package/src/kit/messages.ts +160 -0
- package/src/kit/numbers.ts +44 -0
- package/src/kit/options.ts +30 -0
- package/src/kit/uploads.ts +244 -0
- package/src/kit/waveform.ts +84 -0
- package/src/locale.ts +6 -0
- package/src/markdown.ts +69 -0
- package/src/marks.tsx +328 -0
- package/src/reveal.ts +52 -0
- package/src/stepGlyphs.ts +83 -0
- package/src/styles.css +6970 -0
- package/src/surface/Form.tsx +299 -0
- package/src/surface/Markdown.tsx +55 -0
- package/src/surface/Surface.tsx +605 -0
- package/src/surface/scope.ts +82 -0
- package/src/surface/values.ts +361 -0
- package/src/tint.ts +14 -0
- package/src/types.ts +604 -0
- package/src/useAgentFace.ts +47 -0
- package/src/useCall.ts +292 -0
- package/src/useConversation.ts +627 -0
- package/src/useDictation.ts +83 -0
- package/src/useLive.ts +115 -0
- package/src/usePolled.ts +60 -0
- package/src/voice/Orb.tsx +45 -0
- package/src/voice/StillOrb.tsx +29 -0
- package/src/voice/WebGLOrb.tsx +98 -0
- package/src/voice/fluidDots.tsx +171 -0
- package/src/voice/motion.ts +112 -0
- package/src/voice/orbs.ts +39 -0
- package/src/voice/useReducedMotion.ts +24 -0
- package/src/voice/wave.tsx +129 -0
- package/src/voice/webgl.ts +209 -0
- package/src/widget/css.d.ts +5 -0
- package/src/widget/element.tsx +535 -0
- package/src/widget/index.ts +10 -0
- package/src/widget/mount.ts +27 -0
- package/src/widget/widget.css +253 -0
- package/dist/SignalcoreProvider.d.ts +0 -113
- package/dist/SignalcoreProvider.js +0 -84
- package/dist/automations/AppMarks.d.ts +0 -11
- package/dist/automations/AppMarks.js +0 -18
- package/dist/automations/AutomationCard.d.ts +0 -27
- package/dist/automations/AutomationCard.js +0 -53
- package/dist/automations/AutomationsWindow.d.ts +0 -38
- package/dist/automations/AutomationsWindow.js +0 -57
- package/dist/automations/Card.d.ts +0 -46
- package/dist/automations/Card.js +0 -45
- package/dist/automations/ScheduleMarks.d.ts +0 -13
- package/dist/automations/ScheduleMarks.js +0 -24
- package/dist/automations/presentationIcons.d.ts +0 -7
- package/dist/automations/presentationIcons.js +0 -67
- package/dist/automations/schedule.d.ts +0 -25
- package/dist/automations/schedule.js +0 -59
- package/dist/automations/time.d.ts +0 -3
- package/dist/automations/time.js +0 -25
- package/dist/browser/BrowserView.d.ts +0 -43
- package/dist/browser/BrowserView.js +0 -94
- package/dist/browser/room.d.ts +0 -21
- package/dist/browser/room.js +0 -33
- package/dist/browser/useBrowserSession.d.ts +0 -17
- package/dist/browser/useBrowserSession.js +0 -67
- package/dist/builder/BuilderChat.d.ts +0 -32
- package/dist/builder/BuilderChat.js +0 -41
- package/dist/builder/BuilderTranscript.d.ts +0 -49
- package/dist/builder/BuilderTranscript.js +0 -62
- package/dist/builder/StatusLine.d.ts +0 -8
- package/dist/builder/StatusLine.js +0 -17
- package/dist/builder/answer.d.ts +0 -7
- package/dist/builder/answer.js +0 -8
- package/dist/builder/blocks.d.ts +0 -31
- package/dist/builder/blocks.js +0 -74
- package/dist/builder/items.d.ts +0 -15
- package/dist/builder/items.js +0 -21
- package/dist/builder/steps.d.ts +0 -20
- package/dist/builder/steps.js +0 -120
- package/dist/builder/time.d.ts +0 -4
- package/dist/builder/time.js +0 -24
- package/dist/builder/useBuildSession.d.ts +0 -36
- package/dist/builder/useBuildSession.js +0 -130
- package/dist/builder/workingOn.d.ts +0 -7
- package/dist/builder/workingOn.js +0 -15
- package/dist/chat/AgentChat.d.ts +0 -37
- package/dist/chat/AgentChat.js +0 -21
- package/dist/chat/ChatView.d.ts +0 -25
- package/dist/chat/ChatView.js +0 -34
- package/dist/chat/Composer.d.ts +0 -20
- package/dist/chat/Composer.js +0 -22
- package/dist/chat/MessageRow.d.ts +0 -22
- package/dist/chat/MessageRow.js +0 -32
- package/dist/chat/arrival.d.ts +0 -15
- package/dist/chat/arrival.js +0 -25
- package/dist/chat/history.d.ts +0 -24
- package/dist/chat/history.js +0 -45
- package/dist/chat/moments.d.ts +0 -25
- package/dist/chat/moments.js +0 -72
- package/dist/chat/types.d.ts +0 -12
- package/dist/chat/types.js +0 -1
- package/dist/chat/useComposer.d.ts +0 -46
- package/dist/chat/useComposer.js +0 -62
- package/dist/chat/useConversation.d.ts +0 -35
- package/dist/chat/useConversation.js +0 -71
- package/dist/chat/useStickToBottom.d.ts +0 -9
- package/dist/chat/useStickToBottom.js +0 -33
- package/dist/chat/useTurns.d.ts +0 -49
- package/dist/chat/useTurns.js +0 -111
- package/dist/classes.d.ts +0 -2
- package/dist/development.d.ts +0 -5
- package/dist/development.js +0 -8
- package/dist/flow/FlowWindow.d.ts +0 -42
- package/dist/flow/FlowWindow.js +0 -126
- package/dist/flow/index.d.ts +0 -16
- package/dist/flow/index.js +0 -16
- package/dist/flow/kinds.d.ts +0 -23
- package/dist/flow/kinds.js +0 -48
- package/dist/flow/map.d.ts +0 -44
- package/dist/flow/map.js +0 -225
- package/dist/flow/nodePaths.d.ts +0 -7
- package/dist/flow/nodePaths.js +0 -17
- package/dist/flow/relations.d.ts +0 -42
- package/dist/flow/relations.js +0 -174
- package/dist/host.d.ts +0 -124
- package/dist/host.js +0 -1
- package/dist/live/LiveView.d.ts +0 -28
- package/dist/live/LiveView.js +0 -55
- package/dist/live/capture.d.ts +0 -20
- package/dist/live/capture.js +0 -100
- package/dist/live/follow.d.ts +0 -26
- package/dist/live/follow.js +0 -72
- package/dist/live/paint.d.ts +0 -13
- package/dist/live/paint.js +0 -77
- package/dist/live/useLiveStream.d.ts +0 -16
- package/dist/live/useLiveStream.js +0 -57
- package/dist/look.d.ts +0 -33
- package/dist/look.js +0 -241
- package/dist/messages/en.d.ts +0 -3
- package/dist/messages/en.js +0 -251
- package/dist/messages/es.d.ts +0 -3
- package/dist/messages/es.js +0 -251
- package/dist/messages/index.d.ts +0 -16
- package/dist/messages/index.js +0 -33
- package/dist/messages/types.d.ts +0 -246
- package/dist/messages/types.js +0 -1
- package/dist/parts/Button.d.ts +0 -18
- package/dist/parts/Button.js +0 -17
- package/dist/parts/Icon.d.ts +0 -39
- package/dist/parts/Icon.js +0 -37
- package/dist/parts/Input.d.ts +0 -6
- package/dist/parts/Input.js +0 -11
- package/dist/parts/Spinner.d.ts +0 -2
- package/dist/parts/Spinner.js +0 -7
- package/dist/patterns.d.ts +0 -15
- package/dist/patterns.js +0 -5
- package/dist/presets.d.ts +0 -82
- package/dist/presets.js +0 -81
- package/dist/primitives.d.ts +0 -22
- package/dist/primitives.js +0 -58
- package/dist/request/RequestCard.d.ts +0 -34
- package/dist/request/RequestCard.js +0 -101
- package/dist/request/approval/ApprovalPreview.d.ts +0 -5
- package/dist/request/approval/ApprovalPreview.js +0 -27
- package/dist/request/approval/shapes.d.ts +0 -32
- package/dist/request/approval/shapes.js +0 -68
- package/dist/request/apps.d.ts +0 -11
- package/dist/request/apps.js +0 -27
- package/dist/request/cards.d.ts +0 -12
- package/dist/request/cards.js +0 -24
- package/dist/request/deliver.d.ts +0 -12
- package/dist/request/deliver.js +0 -21
- package/dist/request/handOver.d.ts +0 -18
- package/dist/request/handOver.js +0 -33
- package/dist/request/kinds/Approval.d.ts +0 -3
- package/dist/request/kinds/Approval.js +0 -9
- package/dist/request/kinds/Choice.d.ts +0 -3
- package/dist/request/kinds/Choice.js +0 -8
- package/dist/request/kinds/Connect.d.ts +0 -9
- package/dist/request/kinds/Connect.js +0 -119
- package/dist/request/kinds/FreeText.d.ts +0 -3
- package/dist/request/kinds/FreeText.js +0 -20
- package/dist/request/kinds/HandOver.d.ts +0 -13
- package/dist/request/kinds/HandOver.js +0 -20
- package/dist/request/kinds/Secret.d.ts +0 -7
- package/dist/request/kinds/Secret.js +0 -49
- package/dist/request/kinds/Upload.d.ts +0 -6
- package/dist/request/kinds/Upload.js +0 -47
- package/dist/request/types.d.ts +0 -83
- package/dist/request/types.js +0 -1
- package/dist/safeUrl.d.ts +0 -6
- package/dist/safeUrl.js +0 -8
- package/dist/stream/builder.d.ts +0 -176
- package/dist/stream/builder.js +0 -202
- package/dist/stream/reduce.d.ts +0 -51
- package/dist/stream/reduce.js +0 -58
- package/dist/stream/untilAborted.d.ts +0 -7
- package/dist/stream/untilAborted.js +0 -32
- package/dist/stream/useRunStream.d.ts +0 -26
- package/dist/stream/useRunStream.js +0 -137
- package/dist/styles.css +0 -2318
- package/dist/surface/HostNode.d.ts +0 -14
- package/dist/surface/HostNode.js +0 -30
- package/dist/surface/Node.d.ts +0 -7
- package/dist/surface/Node.js +0 -49
- package/dist/surface/SurfaceBoundary.d.ts +0 -26
- package/dist/surface/SurfaceBoundary.js +0 -20
- package/dist/surface/bindings.d.ts +0 -14
- package/dist/surface/bindings.js +0 -37
- package/dist/surface/check.d.ts +0 -27
- package/dist/surface/check.js +0 -102
- package/dist/surface/format.d.ts +0 -10
- package/dist/surface/format.js +0 -32
- package/dist/surface/hosts.d.ts +0 -6
- package/dist/surface/hosts.js +0 -11
- package/dist/surface/scene.d.ts +0 -21
- package/dist/surface/scene.js +0 -8
- package/dist/surface/templates/Browser.d.ts +0 -6
- package/dist/surface/templates/Browser.js +0 -11
- package/dist/surface/templates/Chart.d.ts +0 -6
- package/dist/surface/templates/Chart.js +0 -13
- package/dist/surface/templates/Choices.d.ts +0 -3
- package/dist/surface/templates/Choices.js +0 -12
- package/dist/surface/templates/Form.d.ts +0 -3
- package/dist/surface/templates/Form.js +0 -44
- package/dist/surface/templates/KeyValue.d.ts +0 -3
- package/dist/surface/templates/KeyValue.js +0 -7
- package/dist/surface/templates/Layout.d.ts +0 -5
- package/dist/surface/templates/Layout.js +0 -16
- package/dist/surface/templates/Live.d.ts +0 -6
- package/dist/surface/templates/Live.js +0 -9
- package/dist/surface/templates/Media.d.ts +0 -5
- package/dist/surface/templates/Media.js +0 -13
- package/dist/surface/templates/Slots.d.ts +0 -3
- package/dist/surface/templates/Slots.js +0 -19
- package/dist/surface/templates/Table.d.ts +0 -3
- package/dist/surface/templates/Table.js +0 -12
- package/dist/surface/templates/Text.d.ts +0 -4
- package/dist/surface/templates/Text.js +0 -15
- package/dist/surface/templates/index.d.ts +0 -7
- package/dist/surface/templates/index.js +0 -32
- package/dist/surface/types.d.ts +0 -68
- package/dist/surface/types.js +0 -6
- package/dist/theme.d.ts +0 -62
- package/dist/theme.js +0 -9
- package/dist/useTokens.d.ts +0 -7
- package/dist/useTokens.js +0 -41
- package/dist/voice/VoiceWindow.d.ts +0 -18
- package/dist/voice/VoiceWindow.js +0 -35
- package/dist/voice/index.d.ts +0 -13
- package/dist/voice/index.js +0 -12
- package/dist/voice/meter.d.ts +0 -16
- package/dist/voice/meter.js +0 -52
- package/dist/voice/orbColors.d.ts +0 -16
- package/dist/voice/orbColors.js +0 -75
- package/dist/voice/pushable.d.ts +0 -16
- package/dist/voice/pushable.js +0 -56
- package/dist/voice/useDictation.d.ts +0 -24
- package/dist/voice/useDictation.js +0 -60
- package/dist/voice/useReducedMotion.d.ts +0 -5
- package/dist/voice/useVoice.d.ts +0 -70
- package/dist/voice/useVoice.js +0 -197
- package/dist/voice/useVoicePrimitives.d.ts +0 -7
- package/dist/voice/useVoicePrimitives.js +0 -11
- package/dist/voice/voice.d.ts +0 -55
- package/dist/voice/voice.js +0 -9
- package/dist/voice/webSpeech.d.ts +0 -33
- package/dist/voice/webSpeech.js +0 -258
- package/dist/widget.js.map +0 -1
- package/dist/windows/AgentSpace.d.ts +0 -78
- package/dist/windows/AgentSpace.js +0 -135
- package/dist/windows/Captions.d.ts +0 -13
- package/dist/windows/Captions.js +0 -22
- package/dist/windows/Dock.d.ts +0 -37
- package/dist/windows/Dock.js +0 -22
- package/dist/windows/Journal.d.ts +0 -15
- package/dist/windows/Journal.js +0 -19
- package/dist/windows/KindMark.d.ts +0 -7
- package/dist/windows/KindMark.js +0 -31
- package/dist/windows/Pending.d.ts +0 -8
- package/dist/windows/Pending.js +0 -17
- package/dist/windows/Stage.d.ts +0 -18
- package/dist/windows/Stage.js +0 -21
- package/dist/windows/StatusLabel.d.ts +0 -9
- package/dist/windows/StatusLabel.js +0 -7
- package/dist/windows/Strip.d.ts +0 -17
- package/dist/windows/Strip.js +0 -42
- package/dist/windows/SurfaceWindow.d.ts +0 -20
- package/dist/windows/SurfaceWindow.js +0 -12
- package/dist/windows/WindowFrame.d.ts +0 -23
- package/dist/windows/WindowFrame.js +0 -22
- package/dist/windows/hearing.d.ts +0 -11
- package/dist/windows/hearing.js +0 -26
- package/dist/windows/kinds.d.ts +0 -47
- package/dist/windows/kinds.js +0 -28
- package/dist/windows/reduce.d.ts +0 -98
- package/dist/windows/reduce.js +0 -151
- package/dist/windows/registry.d.ts +0 -18
- package/dist/windows/registry.js +0 -61
- package/dist/windows/reveal.d.ts +0 -9
- package/dist/windows/reveal.js +0 -6
- package/dist/windows/space.d.ts +0 -21
- package/dist/windows/space.js +0 -6
- package/dist/windows/status.d.ts +0 -11
- package/dist/windows/status.js +0 -30
- package/dist/windows/types.d.ts +0 -15
- package/dist/windows/types.js +0 -1
- package/dist/windows/useLoaded.d.ts +0 -44
- package/dist/windows/useLoaded.js +0 -58
- package/dist/windows/useUnread.d.ts +0 -7
- package/dist/windows/useUnread.js +0 -21
- package/dist/windows/useWindows.d.ts +0 -70
- package/dist/windows/useWindows.js +0 -60
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { classes } from "./classes.js";
|
|
2
|
+
import { Button } from "./kit/Button.js";
|
|
3
|
+
import { capture, handOverWaiting, painterOn, siteOf } from "./browser.js";
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { ArrowsInSimpleIcon, ArrowsOutSimpleIcon, HandIcon, LockSimpleIcon, XIcon } from "@phosphor-icons/react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/BrowserView.tsx
|
|
8
|
+
const BROWSER_MESSAGES = {
|
|
9
|
+
agent: (name) => `${name} is browsing`,
|
|
10
|
+
agentMine: (name) => `${name}, in your Chrome`,
|
|
11
|
+
person: "You're in control",
|
|
12
|
+
take: "Take control",
|
|
13
|
+
giveBack: "Give it back",
|
|
14
|
+
handedOver: (name) => `${name} hands you the browser`,
|
|
15
|
+
done: "Done, go on",
|
|
16
|
+
closed: "The browser closed while it waited for you.",
|
|
17
|
+
expand: "Enlarge",
|
|
18
|
+
shrink: "Shrink",
|
|
19
|
+
close: "Close the browser",
|
|
20
|
+
blank: "Blank page",
|
|
21
|
+
screen: (where) => `Browser: ${where}`
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The browser the agent drives, live, while the conversation has one: a compact tile while the
|
|
25
|
+
* agent works (its screen small, where it is, who holds it), which the person can enlarge or
|
|
26
|
+
* take over. Taken, or handed over by the agent, it glides open large and the person's pointer
|
|
27
|
+
* and keys go to the page; a hand-over says why, ringed in the accent, and "done" gives the
|
|
28
|
+
* browser back, the panel gliding small again, and lets the agent go on. Draws nothing when
|
|
29
|
+
* there is no browser, unless a hand-over still waits for one that closed: then the person can
|
|
30
|
+
* go on without it.
|
|
31
|
+
*/
|
|
32
|
+
function BrowserView({ live, name, messages, classNames }) {
|
|
33
|
+
const words = {
|
|
34
|
+
...BROWSER_MESSAGES,
|
|
35
|
+
...messages
|
|
36
|
+
};
|
|
37
|
+
const { browser } = live;
|
|
38
|
+
const [answered, setAnswered] = useState(null);
|
|
39
|
+
const answer = (wait) => {
|
|
40
|
+
if (answered === wait) return;
|
|
41
|
+
if (live.act({
|
|
42
|
+
surface: wait,
|
|
43
|
+
name: "done",
|
|
44
|
+
data: {},
|
|
45
|
+
label: words.done
|
|
46
|
+
})) setAnswered(wait);
|
|
47
|
+
};
|
|
48
|
+
if (browser === null) {
|
|
49
|
+
const waiting = handOverWaiting(live.messages, live.awaiting);
|
|
50
|
+
if (waiting === null || waiting === answered) return null;
|
|
51
|
+
return /* @__PURE__ */ jsx("section", {
|
|
52
|
+
className: classes(classNames, "sc-browser", "sc-browser--closed"),
|
|
53
|
+
children: /* @__PURE__ */ jsxs("p", {
|
|
54
|
+
className: classes(classNames, "sc-browser__handover"),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(HandIcon, {
|
|
57
|
+
"aria-hidden": true,
|
|
58
|
+
weight: "fill"
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { children: words.closed }),
|
|
61
|
+
/* @__PURE__ */ jsx(Button, {
|
|
62
|
+
tone: "primary",
|
|
63
|
+
size: "sm",
|
|
64
|
+
onClick: () => answer(waiting),
|
|
65
|
+
children: words.done
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return /* @__PURE__ */ jsx(Panel, {
|
|
72
|
+
live,
|
|
73
|
+
browser,
|
|
74
|
+
name,
|
|
75
|
+
words,
|
|
76
|
+
classNames,
|
|
77
|
+
answered,
|
|
78
|
+
onDone: answer
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function Panel({ live, browser, name, words, classNames, answered, onDone }) {
|
|
82
|
+
const [expanded, setExpanded] = useState(false);
|
|
83
|
+
const settling = browser.wait !== null && browser.wait === answered;
|
|
84
|
+
const yours = browser.control === "person" && !settling;
|
|
85
|
+
const panel = useRef(null);
|
|
86
|
+
const bar = useRef(null);
|
|
87
|
+
const canvas = useRef(null);
|
|
88
|
+
const look = useGlide(browser.wait !== null && !settling ? {
|
|
89
|
+
shape: "handed",
|
|
90
|
+
wait: browser.wait,
|
|
91
|
+
reason: browser.reason
|
|
92
|
+
} : { shape: yours || expanded ? "large" : "small" }, panel, bar, canvas);
|
|
93
|
+
const large = look.shape !== "small";
|
|
94
|
+
const { host, rest } = siteOf(browser.url);
|
|
95
|
+
const where = browser.title || host || words.blank;
|
|
96
|
+
const looks = [];
|
|
97
|
+
if (large) looks.push("sc-browser--large");
|
|
98
|
+
if (yours) looks.push("sc-browser--yours");
|
|
99
|
+
if (look.shape === "handed") looks.push("sc-browser--handed");
|
|
100
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
101
|
+
ref: panel,
|
|
102
|
+
"aria-label": words.screen(where),
|
|
103
|
+
className: classes(classNames, "sc-browser", ...looks),
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("header", {
|
|
106
|
+
ref: bar,
|
|
107
|
+
className: classes(classNames, "sc-browser__bar"),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsxs("p", {
|
|
110
|
+
className: classes(classNames, "sc-browser__who"),
|
|
111
|
+
children: [/* @__PURE__ */ jsx("i", { "aria-hidden": true }), /* @__PURE__ */ jsx("span", { children: yours ? words.person : browser.where === "mine" ? words.agentMine(name) : words.agent(name) })]
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("p", {
|
|
114
|
+
title: browser.url,
|
|
115
|
+
className: classes(classNames, "sc-browser__address"),
|
|
116
|
+
children: host ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
117
|
+
/* @__PURE__ */ jsx(LockSimpleIcon, {
|
|
118
|
+
"aria-hidden": true,
|
|
119
|
+
weight: "bold"
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("strong", { children: host }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { children: rest })
|
|
123
|
+
] }) : /* @__PURE__ */ jsx("span", { children: words.blank })
|
|
124
|
+
}),
|
|
125
|
+
!large && browser.title !== "" && /* @__PURE__ */ jsx("p", {
|
|
126
|
+
className: classes(classNames, "sc-browser__title"),
|
|
127
|
+
children: browser.title
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ jsxs("div", {
|
|
130
|
+
className: classes(classNames, "sc-browser__controls"),
|
|
131
|
+
children: [
|
|
132
|
+
look.shape !== "handed" && !settling && (yours ? /* @__PURE__ */ jsx(Button, {
|
|
133
|
+
size: "sm",
|
|
134
|
+
onClick: () => live.control("agent"),
|
|
135
|
+
children: words.giveBack
|
|
136
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
137
|
+
size: "sm",
|
|
138
|
+
onClick: () => live.control("person"),
|
|
139
|
+
children: words.take
|
|
140
|
+
})),
|
|
141
|
+
!yours && /* @__PURE__ */ jsx(Button, {
|
|
142
|
+
size: "sm",
|
|
143
|
+
tone: "ghost",
|
|
144
|
+
icon: expanded ? ArrowsInSimpleIcon : ArrowsOutSimpleIcon,
|
|
145
|
+
"aria-label": expanded ? words.shrink : words.expand,
|
|
146
|
+
title: expanded ? words.shrink : words.expand,
|
|
147
|
+
onClick: () => setExpanded((open) => !open)
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsx(Button, {
|
|
150
|
+
size: "sm",
|
|
151
|
+
tone: "ghost",
|
|
152
|
+
icon: XIcon,
|
|
153
|
+
"aria-label": words.close,
|
|
154
|
+
title: words.close,
|
|
155
|
+
onClick: () => live.closeBrowser()
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
look.shape === "handed" && /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
className: classes(classNames, "sc-browser__handover"),
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx(HandIcon, {
|
|
165
|
+
"aria-hidden": true,
|
|
166
|
+
weight: "fill"
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("strong", { children: words.handedOver(name) }), look.reason && /* @__PURE__ */ jsx("span", { children: look.reason })] }),
|
|
169
|
+
/* @__PURE__ */ jsx(Button, {
|
|
170
|
+
tone: "primary",
|
|
171
|
+
size: "sm",
|
|
172
|
+
onClick: () => onDone(look.wait),
|
|
173
|
+
children: words.done
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsx(Screen, {
|
|
178
|
+
live,
|
|
179
|
+
browser,
|
|
180
|
+
canvas,
|
|
181
|
+
interactive: yours,
|
|
182
|
+
label: words.screen(where),
|
|
183
|
+
classNames,
|
|
184
|
+
onOpen: large ? void 0 : () => setExpanded(true)
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** v2's expand: half a second, quick to leave and slow to land. */
|
|
190
|
+
const GLIDE = {
|
|
191
|
+
duration: 500,
|
|
192
|
+
easing: "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
193
|
+
};
|
|
194
|
+
/** The words around the screen, laid out anew, come in once it is under way. */
|
|
195
|
+
const ARRIVE = {
|
|
196
|
+
duration: 240,
|
|
197
|
+
delay: 140,
|
|
198
|
+
easing: "ease-out",
|
|
199
|
+
fill: "backwards"
|
|
200
|
+
};
|
|
201
|
+
function layoutOf(panel, screen) {
|
|
202
|
+
const outer = panel.getBoundingClientRect();
|
|
203
|
+
const inner = screen.getBoundingClientRect();
|
|
204
|
+
return {
|
|
205
|
+
height: outer.height,
|
|
206
|
+
x: inner.left - outer.left,
|
|
207
|
+
y: inner.top - outer.top,
|
|
208
|
+
width: inner.width,
|
|
209
|
+
tall: inner.height
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/** Whoever asked their system for less motion gets none. */
|
|
213
|
+
function still() {
|
|
214
|
+
return typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The look the panel shows: `wanted`, one layout later when its shape changes, so the panel is
|
|
218
|
+
* measured as it stands before it changes and glides from there to where it lands (its height,
|
|
219
|
+
* so the conversation above gives way smoothly, and its screen's place and size, by a
|
|
220
|
+
* transform) instead of jumping; its words come in over the move. A change midway starts from
|
|
221
|
+
* wherever the glide had got to. The same shape shows what is wanted at once.
|
|
222
|
+
*/
|
|
223
|
+
function useGlide(wanted, panel, bar, canvas) {
|
|
224
|
+
const [shown, setShown] = useState(wanted);
|
|
225
|
+
const from = useRef(null);
|
|
226
|
+
const moving = useRef([]);
|
|
227
|
+
const changing = shown.shape !== wanted.shape;
|
|
228
|
+
useLayoutEffect(() => {
|
|
229
|
+
if (!changing) return;
|
|
230
|
+
const outer = panel.current;
|
|
231
|
+
const screen = canvas.current;
|
|
232
|
+
const glides = outer !== null && screen !== null && typeof outer.animate === "function";
|
|
233
|
+
from.current = glides && !still() ? layoutOf(outer, screen) : null;
|
|
234
|
+
for (const animation of moving.current) animation.cancel();
|
|
235
|
+
moving.current = [];
|
|
236
|
+
setShown(wanted);
|
|
237
|
+
});
|
|
238
|
+
useLayoutEffect(() => {
|
|
239
|
+
const first = from.current;
|
|
240
|
+
from.current = null;
|
|
241
|
+
const outer = panel.current;
|
|
242
|
+
const screen = canvas.current;
|
|
243
|
+
if (first === null || outer === null || screen === null) return;
|
|
244
|
+
const last = layoutOf(outer, screen);
|
|
245
|
+
if (last.width === 0 || last.tall === 0) return;
|
|
246
|
+
const shift = `translate(${first.x - last.x}px, ${first.y - last.y}px)`;
|
|
247
|
+
const scale = `scale(${first.width / last.width}, ${first.tall / last.tall})`;
|
|
248
|
+
moving.current = [outer.animate([{ height: `${first.height}px` }, { height: `${last.height}px` }], GLIDE), screen.animate([{ transform: `${shift} ${scale}` }, { transform: "none" }], GLIDE)];
|
|
249
|
+
if (bar.current) moving.current.push(bar.current.animate([{ opacity: 0 }, { opacity: 1 }], ARRIVE));
|
|
250
|
+
}, [
|
|
251
|
+
shown.shape,
|
|
252
|
+
panel,
|
|
253
|
+
bar,
|
|
254
|
+
canvas
|
|
255
|
+
]);
|
|
256
|
+
return changing ? shown : wanted;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The screen: the browser's pictures painted on a canvas as they come, the latest only. While
|
|
260
|
+
* the person holds the browser it takes their pointer and keys (and the focus, so they can type
|
|
261
|
+
* at once); otherwise it is only watched, and the small one opens large on a click. Until the
|
|
262
|
+
* first picture lands, a quiet light sweeps where it will be.
|
|
263
|
+
*/
|
|
264
|
+
function Screen({ live, browser, canvas, interactive, label, classNames, onOpen }) {
|
|
265
|
+
const { watchScreen, input } = live;
|
|
266
|
+
const { width, height } = browser;
|
|
267
|
+
const [painted, setPainted] = useState(false);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
const element = canvas.current;
|
|
270
|
+
if (!element) return void 0;
|
|
271
|
+
let first = true;
|
|
272
|
+
const painter = painterOn(element, () => {
|
|
273
|
+
if (!first) return;
|
|
274
|
+
first = false;
|
|
275
|
+
setPainted(true);
|
|
276
|
+
});
|
|
277
|
+
const stop = watchScreen((frame) => {
|
|
278
|
+
painter.paint(frame.jpeg);
|
|
279
|
+
});
|
|
280
|
+
return () => {
|
|
281
|
+
stop();
|
|
282
|
+
painter.dispose();
|
|
283
|
+
};
|
|
284
|
+
}, [
|
|
285
|
+
watchScreen,
|
|
286
|
+
width,
|
|
287
|
+
height,
|
|
288
|
+
canvas
|
|
289
|
+
]);
|
|
290
|
+
const send = useRef(input);
|
|
291
|
+
useLayoutEffect(() => {
|
|
292
|
+
send.current = input;
|
|
293
|
+
});
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
const element = canvas.current;
|
|
296
|
+
if (!element || !interactive) return void 0;
|
|
297
|
+
element.focus({ preventScroll: true });
|
|
298
|
+
return capture(element, {
|
|
299
|
+
width,
|
|
300
|
+
height
|
|
301
|
+
}, (event) => send.current(event));
|
|
302
|
+
}, [
|
|
303
|
+
interactive,
|
|
304
|
+
width,
|
|
305
|
+
height,
|
|
306
|
+
canvas
|
|
307
|
+
]);
|
|
308
|
+
const parts = ["sc-browser__screen"];
|
|
309
|
+
if (!painted) parts.push("sc-browser__screen--waiting");
|
|
310
|
+
return /* @__PURE__ */ jsx("div", {
|
|
311
|
+
className: classes(classNames, ...parts),
|
|
312
|
+
children: /* @__PURE__ */ jsx("canvas", {
|
|
313
|
+
ref: canvas,
|
|
314
|
+
role: "img",
|
|
315
|
+
"aria-label": label,
|
|
316
|
+
width,
|
|
317
|
+
height,
|
|
318
|
+
tabIndex: interactive ? 0 : void 0,
|
|
319
|
+
style: { "--_ratio": String(width / height) },
|
|
320
|
+
onClick: onOpen,
|
|
321
|
+
className: classes(classNames, "sc-browser__canvas")
|
|
322
|
+
})
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
export { BROWSER_MESSAGES, BrowserView };
|
|
327
|
+
|
|
328
|
+
//# sourceMappingURL=BrowserView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserView.js","names":[],"sources":["../src/BrowserView.tsx"],"sourcesContent":["import {\n ArrowsInSimpleIcon,\n ArrowsOutSimpleIcon,\n HandIcon,\n LockSimpleIcon,\n XIcon,\n} from \"@phosphor-icons/react\";\nimport {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type RefObject,\n} from \"react\";\n\nimport { capture, handOverWaiting, painterOn, siteOf } from \"./browser\";\nimport { classes } from \"./classes\";\nimport { Button } from \"./kit/Button\";\nimport type { BrowserState } from \"./types\";\nimport type { LiveConversation } from \"./useConversation\";\n\n/** The words the browser says; a host gives its own, in its language. */\nexport interface BrowserMessages {\n /** Who holds it: the agent, by its name. */\n agent: (name: string) => string;\n /** Who holds it: the agent, in the owner's own Chrome. */\n agentMine: (name: string) => string;\n /** Who holds it: the person. */\n person: string;\n /** Take it from the agent. */\n take: string;\n /** Give it back to the agent, after taking it. */\n giveBack: string;\n /** The agent handed it over: what heads its reason. */\n handedOver: (name: string) => string;\n /** The person is done with what the agent handed over: the agent goes on. */\n done: string;\n /** A hand-over waits, but the browser closed meanwhile (nobody used it for a while). */\n closed: string;\n expand: string;\n shrink: string;\n /** The way to close it now: it stops running, and being billed. */\n close: string;\n /** Where the browser is when it shows no web page. */\n blank: string;\n /** The screen's name, for those who cannot see it. */\n screen: (where: string) => string;\n}\n\nexport const BROWSER_MESSAGES: BrowserMessages = {\n agent: (name) => `${name} is browsing`,\n agentMine: (name) => `${name}, in your Chrome`,\n person: \"You're in control\",\n take: \"Take control\",\n giveBack: \"Give it back\",\n handedOver: (name) => `${name} hands you the browser`,\n done: \"Done, go on\",\n closed: \"The browser closed while it waited for you.\",\n expand: \"Enlarge\",\n shrink: \"Shrink\",\n close: \"Close the browser\",\n blank: \"Blank page\",\n screen: (where) => `Browser: ${where}`,\n};\n\n/** The browser's parts, by the class each carries; `classNames` adds a host's own under the same keys. */\nexport type BrowserPart =\n | \"sc-browser\"\n | \"sc-browser--large\"\n | \"sc-browser--yours\"\n | \"sc-browser--handed\"\n | \"sc-browser--closed\"\n | \"sc-browser__bar\"\n | \"sc-browser__who\"\n | \"sc-browser__address\"\n | \"sc-browser__title\"\n | \"sc-browser__controls\"\n | \"sc-browser__handover\"\n | \"sc-browser__screen\"\n | \"sc-browser__screen--waiting\"\n | \"sc-browser__canvas\";\n\nexport interface BrowserViewProps {\n /** The conversation the browser is of (`useConversation`). */\n live: LiveConversation;\n /** The agent's name, for the words that say it holds the browser. */\n name: string;\n messages?: Partial<BrowserMessages> | undefined;\n classNames?: Partial<Record<BrowserPart, string>> | undefined;\n}\n\n/**\n * The browser the agent drives, live, while the conversation has one: a compact tile while the\n * agent works (its screen small, where it is, who holds it), which the person can enlarge or\n * take over. Taken, or handed over by the agent, it glides open large and the person's pointer\n * and keys go to the page; a hand-over says why, ringed in the accent, and \"done\" gives the\n * browser back, the panel gliding small again, and lets the agent go on. Draws nothing when\n * there is no browser, unless a hand-over still waits for one that closed: then the person can\n * go on without it.\n */\nexport function BrowserView({ live, name, messages, classNames }: BrowserViewProps) {\n const words = { ...BROWSER_MESSAGES, ...messages };\n const { browser } = live;\n // The hand-over answered here, so it is never answered twice while its echo is on its way.\n const [answered, setAnswered] = useState<string | null>(null);\n const answer = (wait: string) => {\n if (answered === wait) return;\n if (live.act({ surface: wait, name: \"done\", data: {}, label: words.done })) setAnswered(wait);\n };\n\n if (browser === null) {\n const waiting = handOverWaiting(live.messages, live.awaiting);\n if (waiting === null || waiting === answered) return null;\n return (\n <section className={classes(classNames, \"sc-browser\", \"sc-browser--closed\")}>\n <p className={classes(classNames, \"sc-browser__handover\")}>\n <HandIcon aria-hidden weight=\"fill\" />\n <span>{words.closed}</span>\n <Button tone=\"primary\" size=\"sm\" onClick={() => answer(waiting)}>\n {words.done}\n </Button>\n </p>\n </section>\n );\n }\n return (\n <Panel\n live={live}\n browser={browser}\n name={name}\n words={words}\n classNames={classNames}\n answered={answered}\n onDone={answer}\n />\n );\n}\n\n/**\n * How the panel is laid out: small, its screen beside its words; large, under them; or handed\n * over, large with why the agent stopped and the way to go on.\n */\ntype Look = { shape: \"small\" | \"large\" } | { shape: \"handed\"; wait: string; reason: string | null };\n\nfunction Panel({\n live,\n browser,\n name,\n words,\n classNames,\n answered,\n onDone,\n}: {\n live: LiveConversation;\n browser: BrowserState;\n name: string;\n words: BrowserMessages;\n classNames: Partial<Record<BrowserPart, string>> | undefined;\n answered: string | null;\n onDone: (wait: string) => void;\n}) {\n const [expanded, setExpanded] = useState(false);\n // A hand-over the person answered here is over for them at once: the panel goes back while\n // the word that the agent holds the browser again is on its way.\n const settling = browser.wait !== null && browser.wait === answered;\n const yours = browser.control === \"person\" && !settling;\n const panel = useRef<HTMLElement>(null);\n const bar = useRef<HTMLElement>(null);\n const canvas = useRef<HTMLCanvasElement>(null);\n const look = useGlide(\n browser.wait !== null && !settling\n ? { shape: \"handed\", wait: browser.wait, reason: browser.reason }\n : { shape: yours || expanded ? \"large\" : \"small\" },\n panel,\n bar,\n canvas,\n );\n const large = look.shape !== \"small\";\n const { host, rest } = siteOf(browser.url);\n const where = browser.title || host || words.blank;\n const looks: BrowserPart[] = [];\n if (large) looks.push(\"sc-browser--large\");\n if (yours) looks.push(\"sc-browser--yours\");\n if (look.shape === \"handed\") looks.push(\"sc-browser--handed\");\n\n return (\n <section\n ref={panel}\n aria-label={words.screen(where)}\n className={classes(classNames, \"sc-browser\", ...looks)}\n >\n <header ref={bar} className={classes(classNames, \"sc-browser__bar\")}>\n <p className={classes(classNames, \"sc-browser__who\")}>\n <i aria-hidden />\n <span>\n {yours\n ? words.person\n : browser.where === \"mine\"\n ? words.agentMine(name)\n : words.agent(name)}\n </span>\n </p>\n <p title={browser.url} className={classes(classNames, \"sc-browser__address\")}>\n {host ? (\n <>\n <LockSimpleIcon aria-hidden weight=\"bold\" />\n <strong>{host}</strong>\n <span>{rest}</span>\n </>\n ) : (\n <span>{words.blank}</span>\n )}\n </p>\n {!large && browser.title !== \"\" && (\n <p className={classes(classNames, \"sc-browser__title\")}>{browser.title}</p>\n )}\n <div className={classes(classNames, \"sc-browser__controls\")}>\n {look.shape !== \"handed\" &&\n !settling &&\n (yours ? (\n <Button size=\"sm\" onClick={() => live.control(\"agent\")}>\n {words.giveBack}\n </Button>\n ) : (\n <Button size=\"sm\" onClick={() => live.control(\"person\")}>\n {words.take}\n </Button>\n ))}\n {!yours && (\n <Button\n size=\"sm\"\n tone=\"ghost\"\n icon={expanded ? ArrowsInSimpleIcon : ArrowsOutSimpleIcon}\n aria-label={expanded ? words.shrink : words.expand}\n title={expanded ? words.shrink : words.expand}\n onClick={() => setExpanded((open) => !open)}\n />\n )}\n <Button\n size=\"sm\"\n tone=\"ghost\"\n icon={XIcon}\n aria-label={words.close}\n title={words.close}\n onClick={() => live.closeBrowser()}\n />\n </div>\n </header>\n {look.shape === \"handed\" && (\n <div className={classes(classNames, \"sc-browser__handover\")}>\n <HandIcon aria-hidden weight=\"fill\" />\n <p>\n <strong>{words.handedOver(name)}</strong>\n {look.reason && <span>{look.reason}</span>}\n </p>\n <Button tone=\"primary\" size=\"sm\" onClick={() => onDone(look.wait)}>\n {words.done}\n </Button>\n </div>\n )}\n <Screen\n live={live}\n browser={browser}\n canvas={canvas}\n interactive={yours}\n label={words.screen(where)}\n classNames={classNames}\n onOpen={large ? undefined : () => setExpanded(true)}\n />\n </section>\n );\n}\n\n/** v2's expand: half a second, quick to leave and slow to land. */\nconst GLIDE: KeyframeAnimationOptions = {\n duration: 500,\n easing: \"cubic-bezier(0.22, 1, 0.36, 1)\",\n};\n/** The words around the screen, laid out anew, come in once it is under way. */\nconst ARRIVE: KeyframeAnimationOptions = {\n duration: 240,\n delay: 140,\n easing: \"ease-out\",\n fill: \"backwards\",\n};\n\n/** How tall the panel stands, and where its screen is within it, as shown. */\ninterface Layout {\n height: number;\n x: number;\n y: number;\n width: number;\n tall: number;\n}\n\nfunction layoutOf(panel: HTMLElement, screen: HTMLElement): Layout {\n const outer = panel.getBoundingClientRect();\n const inner = screen.getBoundingClientRect();\n return {\n height: outer.height,\n x: inner.left - outer.left,\n y: inner.top - outer.top,\n width: inner.width,\n tall: inner.height,\n };\n}\n\n/** Whoever asked their system for less motion gets none. */\nfunction still(): boolean {\n return (\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n );\n}\n\n/**\n * The look the panel shows: `wanted`, one layout later when its shape changes, so the panel is\n * measured as it stands before it changes and glides from there to where it lands (its height,\n * so the conversation above gives way smoothly, and its screen's place and size, by a\n * transform) instead of jumping; its words come in over the move. A change midway starts from\n * wherever the glide had got to. The same shape shows what is wanted at once.\n */\nfunction useGlide(\n wanted: Look,\n panel: RefObject<HTMLElement | null>,\n bar: RefObject<HTMLElement | null>,\n canvas: RefObject<HTMLCanvasElement | null>,\n): Look {\n const [shown, setShown] = useState(wanted);\n const from = useRef<Layout | null>(null);\n const moving = useRef<Animation[]>([]);\n const changing = shown.shape !== wanted.shape;\n\n useLayoutEffect(() => {\n if (!changing) return;\n const outer = panel.current;\n const screen = canvas.current;\n const glides = outer !== null && screen !== null && typeof outer.animate === \"function\";\n from.current = glides && !still() ? layoutOf(outer, screen) : null;\n for (const animation of moving.current) animation.cancel();\n moving.current = [];\n setShown(wanted);\n });\n\n useLayoutEffect(() => {\n const first = from.current;\n from.current = null;\n const outer = panel.current;\n const screen = canvas.current;\n if (first === null || outer === null || screen === null) return;\n const last = layoutOf(outer, screen);\n if (last.width === 0 || last.tall === 0) return;\n const shift = `translate(${first.x - last.x}px, ${first.y - last.y}px)`;\n const scale = `scale(${first.width / last.width}, ${first.tall / last.tall})`;\n moving.current = [\n outer.animate([{ height: `${first.height}px` }, { height: `${last.height}px` }], GLIDE),\n screen.animate([{ transform: `${shift} ${scale}` }, { transform: \"none\" }], GLIDE),\n ];\n if (bar.current) {\n moving.current.push(bar.current.animate([{ opacity: 0 }, { opacity: 1 }], ARRIVE));\n }\n }, [shown.shape, panel, bar, canvas]);\n\n return changing ? shown : wanted;\n}\n\n/**\n * The screen: the browser's pictures painted on a canvas as they come, the latest only. While\n * the person holds the browser it takes their pointer and keys (and the focus, so they can type\n * at once); otherwise it is only watched, and the small one opens large on a click. Until the\n * first picture lands, a quiet light sweeps where it will be.\n */\nfunction Screen({\n live,\n browser,\n canvas,\n interactive,\n label,\n classNames,\n onOpen,\n}: {\n live: LiveConversation;\n browser: BrowserState;\n canvas: RefObject<HTMLCanvasElement | null>;\n interactive: boolean;\n label: string;\n classNames: Partial<Record<BrowserPart, string>> | undefined;\n onOpen: (() => void) | undefined;\n}) {\n const { watchScreen, input } = live;\n const { width, height } = browser;\n const [painted, setPainted] = useState(false);\n\n useEffect(() => {\n const element = canvas.current;\n if (!element) return undefined;\n let first = true;\n const painter = painterOn(element, () => {\n if (!first) return;\n first = false;\n setPainted(true);\n });\n const stop = watchScreen((frame) => {\n painter.paint(frame.jpeg);\n });\n return () => {\n stop();\n painter.dispose();\n };\n }, [watchScreen, width, height, canvas]);\n\n // `input` is new each render; the capture reads the latest without starting over.\n const send = useRef(input);\n useLayoutEffect(() => {\n send.current = input;\n });\n useEffect(() => {\n const element = canvas.current;\n if (!element || !interactive) return undefined;\n element.focus({ preventScroll: true });\n return capture(element, { width, height }, (event) => send.current(event));\n }, [interactive, width, height, canvas]);\n\n const parts: BrowserPart[] = [\"sc-browser__screen\"];\n if (!painted) parts.push(\"sc-browser__screen--waiting\");\n return (\n <div className={classes(classNames, ...parts)}>\n <canvas\n ref={canvas}\n role=\"img\"\n aria-label={label}\n width={width}\n height={height}\n tabIndex={interactive ? 0 : undefined}\n style={{ \"--_ratio\": String(width / height) } as CSSProperties}\n onClick={onOpen}\n className={classes(classNames, \"sc-browser__can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AAe;GACvC,IAAI,CAAC,OAAO;GACZ,QAAQ;GACR,WAAW,IAAI;EACjB,CAAC;EACD,MAAM,OAAO,aAAa,UAAU;GAClC,QAAQ,MAAM,MAAM,IAAI;EAC1B,CAAC;EACD,aAAa;GACX,KAAK;GACL,QAAQ,QAAQ;EAClB;CACF,GAAG;EAAC;EAAa;EAAO;EAAQ;CAAM,CAAC;CAGvC,MAAM,OAAO,OAAO,KAAK;CACzB,sBAAsB;EACpB,KAAK,UAAU;CACjB,CAAC;CACD,gBAAgB;EACd,MAAM,UAAU,OAAO;EACvB,IAAI,CAAC,WAAW,CAAC,aAAa,OAAO,KAAA;EACrC,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;EACrC,OAAO,QAAQ,SAAS;GAAE;GAAO;EAAO,IAAI,UAAU,KAAK,QAAQ,KAAK,CAAC;CAC3E,GAAG;EAAC;EAAa;EAAO;EAAQ;CAAM,CAAC;CAEvC,MAAM,QAAuB,CAAC,oBAAoB;CAClD,IAAI,CAAC,SAAS,MAAM,KAAK,6BAA6B;CACtD,OACE,oBAAC,OAAD;EAAK,WAAW,QAAQ,YAAY,GAAG,KAAK;EAC1C,UAAA,oBAAC,UAAD;GACE,KAAK;GACL,MAAK;GACL,cAAY;GACL;GACC;GACR,UAAU,cAAc,IAAI,KAAA;GAC5B,OAAO,EAAE,YAAY,OAAO,QAAQ,MAAM,EAAE;GAC5C,SAAS;GACT,WAAW,QAAQ,YAAY,oBAAoB;EACpD,CAAA;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FilePreview } from "./types.js";
|
|
2
|
+
import { KitPart } from "./kit/context.js";
|
|
3
|
+
//#region src/FileView.d.ts
|
|
4
|
+
/** The words a file's view says; a host gives its own, in its language. */
|
|
5
|
+
export interface FileMessages {
|
|
6
|
+
/** The button that saves the file under its name. */
|
|
7
|
+
download: string;
|
|
8
|
+
/** In the preview's place, for a kind that can't be shown here. */
|
|
9
|
+
noPreview: string;
|
|
10
|
+
/** Under it: what to do instead. */
|
|
11
|
+
noPreviewHint: string;
|
|
12
|
+
/** Under a long file shown only in part. */
|
|
13
|
+
truncated: string;
|
|
14
|
+
/** In the bar, for a file whose name has no extension. */
|
|
15
|
+
file: string;
|
|
16
|
+
/** A file's size, as the host's people read it. */
|
|
17
|
+
size: (bytes: number) => string;
|
|
18
|
+
/** A PDF's pages, in the bar. */
|
|
19
|
+
pages: (count: number) => string;
|
|
20
|
+
/** The tabs of a spreadsheet's sheets, for screen readers. */
|
|
21
|
+
sheets: string;
|
|
22
|
+
/** Under a sheet shown in part: its first rows of how many. */
|
|
23
|
+
rows: (shown: number, total: number) => string;
|
|
24
|
+
/** In place of a sheet with nothing in it. */
|
|
25
|
+
emptySheet: string;
|
|
26
|
+
/** Over a slide: its number. */
|
|
27
|
+
slide: (number: number) => string;
|
|
28
|
+
/** Over a slide's speaker notes. */
|
|
29
|
+
notes: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const FILE_MESSAGES: FileMessages;
|
|
32
|
+
/** The parts, by the class each carries; `classNames` adds a host's own under the same keys. */
|
|
33
|
+
export type FilePart = "sc-file" | "sc-file__bar" | "sc-file__meta" | "sc-file__body" | "sc-file__text" | "sc-file__plain" | "sc-file__code" | "sc-file__table" | "sc-file__sheet" | "sc-file__tabs" | "sc-file__tab" | "sc-file__document" | "sc-file__slides" | "sc-file__slide" | "sc-file__notes" | "sc-file__frame" | "sc-file__image" | "sc-file__media" | "sc-file__none" | "sc-file__note";
|
|
34
|
+
type ClassNames = Partial<Record<FilePart | KitPart, string>> | undefined;
|
|
35
|
+
export interface FileViewProps {
|
|
36
|
+
/** The file's bytes, as the API answers them (`Response.blob()`). */
|
|
37
|
+
blob: Blob;
|
|
38
|
+
/** Its name or path, with its extension: how it is read, and what it is saved as. */
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* What the API made of it to draw (`client.files.preview`): a spreadsheet's sheets, a Word
|
|
42
|
+
* file as a document, a deck's slides, the words of a text, how a picture, a video or a sound
|
|
43
|
+
* is typed. Without it, what the browser can read of the bytes alone.
|
|
44
|
+
*/
|
|
45
|
+
preview?: FilePreview | undefined;
|
|
46
|
+
messages?: Partial<FileMessages> | undefined;
|
|
47
|
+
classNames?: ClassNames;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One file, to see and to save, whatever its kind: a bar with its kind, its size (a PDF's pages)
|
|
51
|
+
* and the button that saves it under its name, over the file as it reads. A PDF in the browser's
|
|
52
|
+
* own viewer; a spreadsheet as a grid, its header kept in view, its sheets as tabs at its foot; a
|
|
53
|
+
* Word file as a document at a reading measure; a deck as its slides one under another, their
|
|
54
|
+
* notes under each; Markdown drawn, plain words as written, a source in the mono face, wrapped,
|
|
55
|
+
* never run; a picture whole, a video and a sound in the browser's own players; any other kind
|
|
56
|
+
* says it can't be shown, and is saved. What it can't read alone (a sheet, a document, slides)
|
|
57
|
+
* it draws from `preview`. It fills the height it is given (a dialog's body), and scrolls inside.
|
|
58
|
+
* The addresses it makes for the bytes are let go when it goes.
|
|
59
|
+
*/
|
|
60
|
+
export declare function FileView(props: FileViewProps): import("react").JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=FileView.d.ts.map
|