@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,46 @@
|
|
|
1
|
+
import { classes } from "../classes.js";
|
|
2
|
+
import { KIT_MESSAGES } from "./messages.js";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/kit/context.tsx
|
|
6
|
+
const KitContext = createContext({
|
|
7
|
+
classNames: void 0,
|
|
8
|
+
messages: KIT_MESSAGES,
|
|
9
|
+
locale: void 0,
|
|
10
|
+
code: "en-US"
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Gives the primitives under it the host's classes, words and language; without it they are
|
|
14
|
+
* the package's, in English.
|
|
15
|
+
*/
|
|
16
|
+
function KitProvider({ classNames, messages, locale, children }) {
|
|
17
|
+
const scope = {
|
|
18
|
+
classNames,
|
|
19
|
+
messages: {
|
|
20
|
+
...KIT_MESSAGES,
|
|
21
|
+
...messages
|
|
22
|
+
},
|
|
23
|
+
locale,
|
|
24
|
+
code: locale?.code ?? "en-US"
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(KitContext, {
|
|
27
|
+
value: scope,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function useKit() {
|
|
32
|
+
return useContext(KitContext);
|
|
33
|
+
}
|
|
34
|
+
/** The classes of the kit's parts, each with the host's own under it. */
|
|
35
|
+
function useParts() {
|
|
36
|
+
const { classNames } = useKit();
|
|
37
|
+
return (...parts) => classes(classNames, ...parts);
|
|
38
|
+
}
|
|
39
|
+
/** A part's classes and the caller's own, as one `className`. */
|
|
40
|
+
function joined(...names) {
|
|
41
|
+
return names.filter(Boolean).join(" ");
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { KitProvider, joined, useKit, useParts };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../src/kit/context.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\nimport { classes } from \"../classes\";\nimport { KIT_MESSAGES, type KitLocale, type KitMessages } from \"./messages\";\n\n/**\n * The kit's parts, by the class each carries: one BEM family per primitive. `classNames` adds a\n * host's own under the same keys, so a host styles every place a primitive appears at once.\n * (`sc-card` is the Ficha's; the kit's card is `sc-panel`.)\n */\nexport type KitPart =\n | \"sc-panel\"\n | \"sc-panel__head\"\n | \"sc-panel__head--image\"\n | \"sc-panel__heading\"\n | \"sc-panel__title\"\n | \"sc-panel__subtitle\"\n | \"sc-list\"\n | \"sc-row\"\n | \"sc-row--quiet\"\n | \"sc-row--pressed\"\n | \"sc-row__main\"\n | \"sc-row__text\"\n | \"sc-row__title\"\n | \"sc-row__subtitle\"\n | \"sc-row__error\"\n | \"sc-row__meta\"\n | \"sc-row__trailing\"\n | \"sc-mark\"\n | \"sc-mark--logo\"\n | \"sc-mark--photo\"\n | \"sc-mark--round\"\n | \"sc-tiles\"\n | \"sc-tiles__grid\"\n | \"sc-tile\"\n | \"sc-tile--quiet\"\n | \"sc-tile__main\"\n | \"sc-tile__count\"\n | \"sc-tile__title\"\n | \"sc-stack\"\n | \"sc-stack__item\"\n | \"sc-stack__more\"\n | \"sc-tag\"\n | \"sc-tag--info\"\n | \"sc-tag--success\"\n | \"sc-tag--warning\"\n | \"sc-tag--danger\"\n | \"sc-stat\"\n | \"sc-stat--info\"\n | \"sc-stat--success\"\n | \"sc-stat--warning\"\n | \"sc-stat--danger\"\n | \"sc-stat__label\"\n | \"sc-stat__value\"\n | \"sc-stat__hint\"\n | \"sc-stats\"\n | \"sc-stats__grid\"\n | \"sc-chart\"\n | \"sc-chart--bar\"\n | \"sc-chart--line\"\n | \"sc-chart__row\"\n | \"sc-chart__label\"\n | \"sc-chart__track\"\n | \"sc-chart__bar\"\n | \"sc-chart__value\"\n | \"sc-chart__top\"\n | \"sc-chart__plot\"\n | \"sc-chart__wash\"\n | \"sc-chart__axis\"\n | \"sc-chart__line\"\n | \"sc-chart__dot\"\n | \"sc-chart__tip\"\n | \"sc-chart__ends\"\n | \"sc-chart__data\"\n | \"sc-note\"\n | \"sc-note--info\"\n | \"sc-note--success\"\n | \"sc-note--warning\"\n | \"sc-note--danger\"\n | \"sc-note__body\"\n | \"sc-button\"\n | \"sc-button--primary\"\n | \"sc-button--neutral\"\n | \"sc-button--danger\"\n | \"sc-button--ghost\"\n | \"sc-button--sm\"\n | \"sc-button--icon\"\n | \"sc-switch\"\n | \"sc-audio\"\n | \"sc-audio--compact\"\n | \"sc-audio__play\"\n | \"sc-audio__wave\"\n | \"sc-audio__time\"\n | \"sc-field\"\n | \"sc-field__label\"\n | \"sc-field__optional\"\n | \"sc-field__help\"\n | \"sc-field__error\"\n | \"sc-control\"\n | \"sc-control--trigger\"\n | \"sc-control__input\"\n | \"sc-control__unit\"\n | \"sc-control__steppers\"\n | \"sc-control__reveal\"\n | \"sc-control__tag\"\n | \"sc-check\"\n | \"sc-popover\"\n | \"sc-listbox\"\n | \"sc-listbox__item\"\n | \"sc-listbox__empty\"\n | \"sc-calendar\"\n | \"sc-picks\"\n | \"sc-segments\"\n | \"sc-pick\"\n | \"sc-chips\"\n | \"sc-chip\"\n | \"sc-slots\"\n | \"sc-moment\"\n | \"sc-range\"\n | \"sc-rating\"\n | \"sc-upload\"\n | \"sc-upload__zone\"\n | \"sc-upload__icon\"\n | \"sc-upload__text\"\n | \"sc-attachments\"\n | \"sc-attachment\"\n | \"sc-attachment--failed\"\n | \"sc-attachment__main\"\n | \"sc-attachment__text\"\n | \"sc-attachment__name\"\n | \"sc-attachment__meta\"\n | \"sc-attachment__action\"\n | \"sc-attachment__bar\"\n | \"sc-orb\"\n | \"sc-orb--idle\"\n | \"sc-orb--listening\"\n | \"sc-orb--thinking\"\n | \"sc-orb--speaking\"\n | \"sc-orb--still\"\n | \"sc-orb--loading\"\n | \"sc-orb__ring\"\n | \"sc-orb__core\"\n | \"sc-automation\"\n | \"sc-automation--gone\"\n | \"sc-automation__head\"\n | \"sc-automation__heading\"\n | \"sc-automation__title\"\n | \"sc-automation__when\"\n | \"sc-automation__end\"\n | \"sc-automation__dot\"\n | \"sc-automation__summary\"\n | \"sc-automation__section\"\n | \"sc-automation__label\"\n | \"sc-automation__steps\"\n | \"sc-automation__step\"\n | \"sc-automation__number\"\n | \"sc-automation__name\"\n | \"sc-automation__uses\"\n | \"sc-automation__use\"\n | \"sc-automation__board\"\n | \"sc-automation__more\"\n | \"sc-automation__runs\"\n | \"sc-automation__run--open\"\n | \"sc-automation__status\"\n | \"sc-automation__empty\"\n | \"sc-run\"\n | \"sc-run__head\"\n | \"sc-run__by\"\n | \"sc-run__end\"\n | \"sc-run__took\"\n | \"sc-run__heading\"\n | \"sc-run__title\"\n | \"sc-run__meta\"\n | \"sc-run__summary\"\n | \"sc-run__section\"\n | \"sc-run__label\"\n | \"sc-run__steps\"\n | \"sc-run__step\"\n | \"sc-run__number\"\n | \"sc-run__name\"\n | \"sc-run__calls\"\n | \"sc-run__call\"\n | \"sc-run__call--would\"\n | \"sc-run__call--failed\"\n | \"sc-run__count\"\n | \"sc-run__error\"\n | \"sc-run__live\"\n | \"sc-run__links\"\n | \"sc-run__empty\";\n\nexport type KitClassNames = Partial<Record<KitPart, string>> | undefined;\n\n/** What every primitive under one host shares: its classes, its words, its language. */\ninterface KitScope {\n classNames: KitClassNames;\n messages: KitMessages;\n locale: KitLocale | undefined;\n /** The locale's code, for Intl: \"es\", \"en-US\". */\n code: string;\n}\n\nconst KitContext = createContext<KitScope>({\n classNames: undefined,\n messages: KIT_MESSAGES,\n locale: undefined,\n code: \"en-US\",\n});\n\n/**\n * Gives the primitives under it the host's classes, words and language; without it they are\n * the package's, in English.\n */\nexport function KitProvider({\n classNames,\n messages,\n locale,\n children,\n}: {\n classNames?: KitClassNames;\n messages?: Partial<KitMessages> | undefined;\n locale?: KitLocale | undefined;\n children: ReactNode;\n}) {\n const scope: KitScope = {\n classNames,\n messages: { ...KIT_MESSAGES, ...messages },\n locale,\n code: locale?.code ?? \"en-US\",\n };\n return <KitContext value={scope}>{children}</KitContext>;\n}\n\nexport function useKit(): KitScope {\n return useContext(KitContext);\n}\n\n/** The classes of the kit's parts, each with the host's own under it. */\nexport function useParts(): (...parts: KitPart[]) => string {\n const { classNames } = useKit();\n return (...parts) => classes(classNames, ...parts);\n}\n\n/** A part's classes and the caller's own, as one `className`. */\nexport function joined(...names: (string | false | undefined)[]): string {\n return names.filter(Boolean).join(\" \");\n}\n"],"mappings":";;;;;AAyMA,MAAM,aAAa,cAAwB;CACzC,YAAY,KAAA;CACZ,UAAU;CACV,QAAQ,KAAA;CACR,MAAM;AACR,CAAC;;;;;AAMD,SAAgB,YAAY,EAC1B,YACA,UACA,QACA,YAMC;CACD,MAAM,QAAkB;EACtB;EACA,UAAU;GAAE,GAAG;GAAc,GAAG;EAAS;EACzC;EACA,MAAM,QAAQ,QAAQ;CACxB;CACA,OAAO,oBAAC,YAAD;EAAY,OAAO;EAAQ;CAAqB,CAAA;AACzD;AAEA,SAAgB,SAAmB;CACjC,OAAO,WAAW,UAAU;AAC9B;;AAGA,SAAgB,WAA4C;CAC1D,MAAM,EAAE,eAAe,OAAO;CAC9B,QAAQ,GAAG,UAAU,QAAQ,YAAY,GAAG,KAAK;AACnD;;AAGA,SAAgB,OAAO,GAAG,OAA+C;CACvE,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/kit/dates.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Days and times as the kit's controls hold them, "YYYY-MM-DD", "HH:MM" and
|
|
4
|
+
* "YYYY-MM-DDTHH:MM", as pure functions: reading them, writing them in a language, and which
|
|
5
|
+
* of them a control offers.
|
|
6
|
+
*/
|
|
7
|
+
/** What bounds a day: the only days to pick, and the first and last. */
|
|
8
|
+
export interface DayBounds {
|
|
9
|
+
dates?: string[] | undefined;
|
|
10
|
+
earliest?: string | undefined;
|
|
11
|
+
latest?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//#region src/kit/dates.ts
|
|
2
|
+
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
3
|
+
const TIME = /^([01]\d|2[0-3]):[0-5]\d$/;
|
|
4
|
+
const MOMENT = /^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d$/;
|
|
5
|
+
/** A day "YYYY-MM-DD" as a local date, or null. */
|
|
6
|
+
function dayOf(iso) {
|
|
7
|
+
if (!DAY.test(iso)) return null;
|
|
8
|
+
const [year = 0, month = 1, day = 1] = iso.split("-").map(Number);
|
|
9
|
+
const date = new Date(year, month - 1, day);
|
|
10
|
+
return date.getMonth() === month - 1 ? date : null;
|
|
11
|
+
}
|
|
12
|
+
/** A local date as "YYYY-MM-DD". */
|
|
13
|
+
function isoDay(date) {
|
|
14
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
15
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
16
|
+
}
|
|
17
|
+
/** A day in words: its weekday, day and month, and its year when not this one. */
|
|
18
|
+
function formatDay(iso, code, today = /* @__PURE__ */ new Date()) {
|
|
19
|
+
const day = dayOf(iso);
|
|
20
|
+
if (!day) return iso;
|
|
21
|
+
return new Intl.DateTimeFormat(code, {
|
|
22
|
+
weekday: "long",
|
|
23
|
+
day: "numeric",
|
|
24
|
+
month: "long",
|
|
25
|
+
...day.getFullYear() !== today.getFullYear() && { year: "numeric" }
|
|
26
|
+
}).format(day);
|
|
27
|
+
}
|
|
28
|
+
/** A time "HH:MM" as the language writes it: "10:30", or "10:30 AM". */
|
|
29
|
+
function formatTime(time, code) {
|
|
30
|
+
const [hours = 0, minutes = 0] = time.split(":").map(Number);
|
|
31
|
+
const at = new Date(2e3, 0, 1, hours, minutes);
|
|
32
|
+
const clock = new Intl.DateTimeFormat(code, {
|
|
33
|
+
hour: "numeric",
|
|
34
|
+
minute: "2-digit"
|
|
35
|
+
});
|
|
36
|
+
if (hours === 24 && clock.resolvedOptions().hourCycle === "h23") return new Intl.DateTimeFormat(code, {
|
|
37
|
+
hour: "numeric",
|
|
38
|
+
minute: "2-digit",
|
|
39
|
+
hourCycle: "h24"
|
|
40
|
+
}).format(at);
|
|
41
|
+
return clock.format(at);
|
|
42
|
+
}
|
|
43
|
+
/** A moment in words; a half-picked one reads as the half there is. */
|
|
44
|
+
function formatMoment(moment, code, today = /* @__PURE__ */ new Date()) {
|
|
45
|
+
const [date, time] = momentParts(moment);
|
|
46
|
+
if (!date || !TIME.test(time)) return date ? formatDay(date, code, today) : time;
|
|
47
|
+
const day = dayOf(date);
|
|
48
|
+
if (!day) return moment;
|
|
49
|
+
const [hours = 0, minutes = 0] = time.split(":").map(Number);
|
|
50
|
+
day.setHours(hours, minutes);
|
|
51
|
+
return new Intl.DateTimeFormat(code, {
|
|
52
|
+
weekday: "long",
|
|
53
|
+
day: "numeric",
|
|
54
|
+
month: "long",
|
|
55
|
+
...day.getFullYear() !== today.getFullYear() && { year: "numeric" },
|
|
56
|
+
hour: "numeric",
|
|
57
|
+
minute: "2-digit"
|
|
58
|
+
}).format(day);
|
|
59
|
+
}
|
|
60
|
+
/** Whether a day is offered: one of the `dates` when there are, within the bounds. */
|
|
61
|
+
function dayAllowed(bounds, iso) {
|
|
62
|
+
if (!DAY.test(iso)) return false;
|
|
63
|
+
if (bounds.dates && !bounds.dates.includes(iso)) return false;
|
|
64
|
+
if (bounds.earliest !== void 0 && iso < bounds.earliest) return false;
|
|
65
|
+
if (bounds.latest !== void 0 && iso > bounds.latest) return false;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
/** Whether a time is offered: one of the `times` when there are. */
|
|
69
|
+
function slotAllowed(times, time) {
|
|
70
|
+
return times === void 0 || times.includes(time);
|
|
71
|
+
}
|
|
72
|
+
/** The day a calendar opens on: the one picked, else the first offered, else today. */
|
|
73
|
+
function openingDay(bounds, picked, today) {
|
|
74
|
+
if (picked && DAY.test(picked)) return picked;
|
|
75
|
+
const first = bounds.dates?.toSorted()[0] ?? bounds.earliest;
|
|
76
|
+
const now = isoDay(today);
|
|
77
|
+
if (first !== void 0 && (bounds.dates || first > now)) return first;
|
|
78
|
+
return bounds.latest !== void 0 && bounds.latest < now ? bounds.latest : now;
|
|
79
|
+
}
|
|
80
|
+
/** The first and last days a calendar can go to, when they are bounded. */
|
|
81
|
+
function daySpan(bounds) {
|
|
82
|
+
const sorted = bounds.dates?.toSorted();
|
|
83
|
+
const first = sorted?.[0] ?? bounds.earliest;
|
|
84
|
+
const last = sorted?.at(-1) ?? bounds.latest;
|
|
85
|
+
return {
|
|
86
|
+
...first !== void 0 && { first },
|
|
87
|
+
...last !== void 0 && { last }
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** A moment's day and time, either "" while not picked: "2026-10-14T" is a day alone. */
|
|
91
|
+
function momentParts(moment) {
|
|
92
|
+
if (!moment) return ["", ""];
|
|
93
|
+
const at = moment.indexOf("T");
|
|
94
|
+
return at < 0 ? [moment, ""] : [moment.slice(0, at), moment.slice(at + 1, at + 6)];
|
|
95
|
+
}
|
|
96
|
+
/** A moment from its parts, held while half picked; null when neither is. */
|
|
97
|
+
function momentOf(date, time) {
|
|
98
|
+
return date === "" && time === "" ? null : `${date}T${time}`;
|
|
99
|
+
}
|
|
100
|
+
/** Every half hour of a day, "00:00" to "23:30": what a time offers without its own slots. */
|
|
101
|
+
function halfHours() {
|
|
102
|
+
return Array.from({ length: 48 }, (_, index) => {
|
|
103
|
+
return `${String(Math.floor(index / 2)).padStart(2, "0")}:${index % 2 === 0 ? "00" : "30"}`;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** The day's end, where a stretch of it can end: midnight at its close. */
|
|
107
|
+
const DAY_END = "24:00";
|
|
108
|
+
/** A time a stretch of the day ends at, as typed: any time, or the day's end ("24", "24:00"). */
|
|
109
|
+
function parseEndTime(typed) {
|
|
110
|
+
return /^24(?:[:.h]?00)?$/i.test(typed.trim()) ? DAY_END : parseTime(typed);
|
|
111
|
+
}
|
|
112
|
+
/** A time as a person types it, as "HH:MM", or null: "9", "930", "9:30", "21.30", "9:30 pm". */
|
|
113
|
+
function parseTime(typed) {
|
|
114
|
+
const match = /^(\d{1,2})(?:[:.h]?(\d{2}))?\s*([ap])?\.?\s*m?\.?$/i.exec(typed.trim());
|
|
115
|
+
if (!match) return null;
|
|
116
|
+
let hours = Number(match[1]);
|
|
117
|
+
const minutes = Number(match[2] ?? "0");
|
|
118
|
+
const half = match[3]?.toLowerCase();
|
|
119
|
+
if (half) {
|
|
120
|
+
if (hours < 1 || hours > 12) return null;
|
|
121
|
+
hours = hours % 12 + (half === "p" ? 12 : 0);
|
|
122
|
+
}
|
|
123
|
+
if (hours > 23 || minutes > 59) return null;
|
|
124
|
+
return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { DAY, DAY_END, MOMENT, TIME, dayAllowed, dayOf, daySpan, formatDay, formatMoment, formatTime, halfHours, isoDay, momentOf, momentParts, openingDay, parseEndTime, parseTime, slotAllowed };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=dates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.js","names":[],"sources":["../../src/kit/dates.ts"],"sourcesContent":["/**\n * Days and times as the kit's controls hold them, \"YYYY-MM-DD\", \"HH:MM\" and\n * \"YYYY-MM-DDTHH:MM\", as pure functions: reading them, writing them in a language, and which\n * of them a control offers.\n */\n\n/** What bounds a day: the only days to pick, and the first and last. */\nexport interface DayBounds {\n dates?: string[] | undefined;\n earliest?: string | undefined;\n latest?: string | undefined;\n}\n\nexport const DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\nexport const TIME = /^([01]\\d|2[0-3]):[0-5]\\d$/;\nexport const MOMENT = /^\\d{4}-\\d{2}-\\d{2}T([01]\\d|2[0-3]):[0-5]\\d$/;\n\n/** A day \"YYYY-MM-DD\" as a local date, or null. */\nexport function dayOf(iso: string): Date | null {\n if (!DAY.test(iso)) return null;\n const [year = 0, month = 1, day = 1] = iso.split(\"-\").map(Number);\n const date = new Date(year, month - 1, day);\n return date.getMonth() === month - 1 ? date : null;\n}\n\n/** A local date as \"YYYY-MM-DD\". */\nexport function isoDay(date: Date): string {\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/** A day in words: its weekday, day and month, and its year when not this one. */\nexport function formatDay(iso: string, code: string, today: Date = new Date()): string {\n const day = dayOf(iso);\n if (!day) return iso;\n return new Intl.DateTimeFormat(code, {\n weekday: \"long\",\n day: \"numeric\",\n month: \"long\",\n ...(day.getFullYear() !== today.getFullYear() && { year: \"numeric\" }),\n }).format(day);\n}\n\n/** A time \"HH:MM\" as the language writes it: \"10:30\", or \"10:30 AM\". */\nexport function formatTime(time: string, code: string): string {\n const [hours = 0, minutes = 0] = time.split(\":\").map(Number);\n const at = new Date(2000, 0, 1, hours, minutes);\n const clock = new Intl.DateTimeFormat(code, { hour: \"numeric\", minute: \"2-digit\" });\n // The day's end, as a 24-hour clock writes it (\"24:00\"), not as the next day's start.\n if (hours === 24 && clock.resolvedOptions().hourCycle === \"h23\") {\n return new Intl.DateTimeFormat(code, {\n hour: \"numeric\",\n minute: \"2-digit\",\n hourCycle: \"h24\",\n }).format(at);\n }\n return clock.format(at);\n}\n\n/** A moment in words; a half-picked one reads as the half there is. */\nexport function formatMoment(moment: string, code: string, today: Date = new Date()): string {\n const [date, time] = momentParts(moment);\n if (!date || !TIME.test(time)) return date ? formatDay(date, code, today) : time;\n const day = dayOf(date);\n if (!day) return moment;\n const [hours = 0, minutes = 0] = time.split(\":\").map(Number);\n day.setHours(hours, minutes);\n return new Intl.DateTimeFormat(code, {\n weekday: \"long\",\n day: \"numeric\",\n month: \"long\",\n ...(day.getFullYear() !== today.getFullYear() && { year: \"numeric\" }),\n hour: \"numeric\",\n minute: \"2-digit\",\n }).format(day);\n}\n\n/** Whether a day is offered: one of the `dates` when there are, within the bounds. */\nexport function dayAllowed(bounds: DayBounds, iso: string): boolean {\n if (!DAY.test(iso)) return false;\n if (bounds.dates && !bounds.dates.includes(iso)) return false;\n if (bounds.earliest !== undefined && iso < bounds.earliest) return false;\n if (bounds.latest !== undefined && iso > bounds.latest) return false;\n return true;\n}\n\n/** Whether a time is offered: one of the `times` when there are. */\nexport function slotAllowed(times: string[] | undefined, time: string): boolean {\n return times === undefined || times.includes(time);\n}\n\n/** The day a calendar opens on: the one picked, else the first offered, else today. */\nexport function openingDay(bounds: DayBounds, picked: string | null, today: Date): string {\n if (picked && DAY.test(picked)) return picked;\n const first = bounds.dates?.toSorted()[0] ?? bounds.earliest;\n const now = isoDay(today);\n if (first !== undefined && (bounds.dates || first > now)) return first;\n return bounds.latest !== undefined && bounds.latest < now ? bounds.latest : now;\n}\n\n/** The first and last days a calendar can go to, when they are bounded. */\nexport function daySpan(bounds: DayBounds): { first?: string; last?: string } {\n const sorted = bounds.dates?.toSorted();\n const first = sorted?.[0] ?? bounds.earliest;\n const last = sorted?.at(-1) ?? bounds.latest;\n return { ...(first !== undefined && { first }), ...(last !== undefined && { last }) };\n}\n\n/** A moment's day and time, either \"\" while not picked: \"2026-10-14T\" is a day alone. */\nexport function momentParts(moment: string | null): [date: string, time: string] {\n if (!moment) return [\"\", \"\"];\n const at = moment.indexOf(\"T\");\n return at < 0 ? [moment, \"\"] : [moment.slice(0, at), moment.slice(at + 1, at + 6)];\n}\n\n/** A moment from its parts, held while half picked; null when neither is. */\nexport function momentOf(date: string, time: string): string | null {\n return date === \"\" && time === \"\" ? null : `${date}T${time}`;\n}\n\n/** Every half hour of a day, \"00:00\" to \"23:30\": what a time offers without its own slots. */\nexport function halfHours(): string[] {\n return Array.from({ length: 48 }, (_, index) => {\n const hours = String(Math.floor(index / 2)).padStart(2, \"0\");\n return `${hours}:${index % 2 === 0 ? \"00\" : \"30\"}`;\n });\n}\n\n/** The day's end, where a stretch of it can end: midnight at its close. */\nexport const DAY_END = \"24:00\";\n\n/** A time a stretch of the day ends at, as typed: any time, or the day's end (\"24\", \"24:00\"). */\nexport function parseEndTime(typed: string): string | null {\n return /^24(?:[:.h]?00)?$/i.test(typed.trim()) ? DAY_END : parseTime(typed);\n}\n\n/** A time as a person types it, as \"HH:MM\", or null: \"9\", \"930\", \"9:30\", \"21.30\", \"9:30 pm\". */\nexport function parseTime(typed: string): string | null {\n const match = /^(\\d{1,2})(?:[:.h]?(\\d{2}))?\\s*([ap])?\\.?\\s*m?\\.?$/i.exec(typed.trim());\n if (!match) return null;\n let hours = Number(match[1]);\n const minutes = Number(match[2] ?? \"0\");\n const half = match[3]?.toLowerCase();\n if (half) {\n if (hours < 1 || hours > 12) return null;\n hours = (hours % 12) + (half === \"p\" ? 12 : 0);\n }\n if (hours > 23 || minutes > 59) return null;\n return `${String(hours).padStart(2, \"0\")}:${String(minutes).padStart(2, \"0\")}`;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AutomationMessages } from "../automation/messages.js";
|
|
2
|
+
import { DayPickerLocale } from "react-day-picker";
|
|
3
|
+
//#region src/kit/messages.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The language the kit's dates are read in: a locale from `@signalcore/ui/locale` (the
|
|
6
|
+
* calendar's, with its words), whose `code` also formats days, times, numbers and lists.
|
|
7
|
+
*/
|
|
8
|
+
export type KitLocale = DayPickerLocale;
|
|
9
|
+
/** The words the kit's controls say; a host gives its own, in its language. */
|
|
10
|
+
export interface KitMessages {
|
|
11
|
+
/** A field left empty that must be filled. */
|
|
12
|
+
required: string;
|
|
13
|
+
/** A day, a time, both, an option, a rating still to pick; also an empty picker's invitation. */
|
|
14
|
+
chooseDate: string;
|
|
15
|
+
chooseTime: string;
|
|
16
|
+
chooseMoment: string;
|
|
17
|
+
chooseOption: string;
|
|
18
|
+
chooseRating: string;
|
|
19
|
+
/** A box that must be ticked to go on. */
|
|
20
|
+
check: string;
|
|
21
|
+
invalidEmail: string;
|
|
22
|
+
invalidPhone: string;
|
|
23
|
+
invalidUrl: string;
|
|
24
|
+
invalidNumber: string;
|
|
25
|
+
/** A time typed in a shape that is not one. */
|
|
26
|
+
invalidTime: string;
|
|
27
|
+
/** A number under its least, or over its most, given formatted. */
|
|
28
|
+
atLeast: (min: string) => string;
|
|
29
|
+
atMost: (max: string) => string;
|
|
30
|
+
/** A day or a time that is not offered. */
|
|
31
|
+
unavailableDate: string;
|
|
32
|
+
unavailableTime: string;
|
|
33
|
+
/** Beside the label of a field that may stay empty. */
|
|
34
|
+
optional: string;
|
|
35
|
+
/** In a long list's box while nothing is picked. */
|
|
36
|
+
pick: string;
|
|
37
|
+
/** In that box while the person types. */
|
|
38
|
+
search: string;
|
|
39
|
+
noResults: string;
|
|
40
|
+
/** The button that shows or hides a secret as it is typed. */
|
|
41
|
+
show: string;
|
|
42
|
+
hide: string;
|
|
43
|
+
/** A number's steppers, for screen readers. */
|
|
44
|
+
increase: string;
|
|
45
|
+
decrease: string;
|
|
46
|
+
/** A picked tag's remove button, for screen readers. */
|
|
47
|
+
remove: (label: string) => string;
|
|
48
|
+
/** A box ticked or not, as an answer reads. */
|
|
49
|
+
yes: string;
|
|
50
|
+
no: string;
|
|
51
|
+
/** A rating, as an answer reads. */
|
|
52
|
+
rated: (value: number, max: number) => string;
|
|
53
|
+
/** One star of a rating, for screen readers. */
|
|
54
|
+
stars: (count: number) => string;
|
|
55
|
+
/** A choice's last row, to answer in one's own words, and its box while empty. */
|
|
56
|
+
other: string;
|
|
57
|
+
otherPlaceholder: string;
|
|
58
|
+
/** A form's submit when the agent gave it no words. */
|
|
59
|
+
send: string;
|
|
60
|
+
/** Where a form's submit was, once it is sent. */
|
|
61
|
+
sent: string;
|
|
62
|
+
/** A file field left empty that must be filled. */
|
|
63
|
+
chooseFile: string;
|
|
64
|
+
/** A file field's drop zone: what it asks, and how. */
|
|
65
|
+
upload: (multiple: boolean) => string;
|
|
66
|
+
drop: string;
|
|
67
|
+
/**
|
|
68
|
+
* Under them, what it takes: the kinds (named and joined, "" when anything) and the most a
|
|
69
|
+
* file may weigh, formatted.
|
|
70
|
+
*/
|
|
71
|
+
limits: (kinds: string, size: string) => string;
|
|
72
|
+
/** A family of kinds as the limits name it: "image" for any image, "video", "audio", "text". */
|
|
73
|
+
anyOf: (family: string) => string;
|
|
74
|
+
/** A file on its way, beside how much has gone. */
|
|
75
|
+
uploading: string;
|
|
76
|
+
/** A file that was not sent: heavier than the most (formatted), a kind not taken, one too many. */
|
|
77
|
+
tooBig: (size: string) => string;
|
|
78
|
+
wrongType: string;
|
|
79
|
+
tooMany: (max: number) => string;
|
|
80
|
+
/** A file whose upload failed, and the button that tries it again. */
|
|
81
|
+
uploadFailed: string;
|
|
82
|
+
retry: string;
|
|
83
|
+
/** A form sent while a file is still on its way, or one failed. */
|
|
84
|
+
stillUploading: string;
|
|
85
|
+
fixFiles: string;
|
|
86
|
+
/** A file's chip, opened on a click, for screen readers. */
|
|
87
|
+
open: (name: string) => string;
|
|
88
|
+
/** A file whose name is not known yet. */
|
|
89
|
+
file: string;
|
|
90
|
+
/** An audio player's button, and its way through, for screen readers. */
|
|
91
|
+
play: string;
|
|
92
|
+
pause: string;
|
|
93
|
+
position: string;
|
|
94
|
+
/** An automation and its runs: when it runs, how it stands, what each run did. */
|
|
95
|
+
automation: AutomationMessages;
|
|
96
|
+
}
|
|
97
|
+
export declare const KIT_MESSAGES: KitMessages;
|
|
98
|
+
//#endregion
|
|
99
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AUTOMATION_MESSAGES } from "../automation/messages.js";
|
|
2
|
+
//#region src/kit/messages.ts
|
|
3
|
+
const FAMILIES = {
|
|
4
|
+
image: "images",
|
|
5
|
+
video: "videos",
|
|
6
|
+
audio: "audio",
|
|
7
|
+
text: "text"
|
|
8
|
+
};
|
|
9
|
+
const KIT_MESSAGES = {
|
|
10
|
+
required: "This field is required",
|
|
11
|
+
chooseDate: "Choose a day",
|
|
12
|
+
chooseTime: "Choose a time",
|
|
13
|
+
chooseMoment: "Choose a day and a time",
|
|
14
|
+
chooseOption: "Choose an option",
|
|
15
|
+
other: "Another answer",
|
|
16
|
+
otherPlaceholder: "Write your answer",
|
|
17
|
+
chooseRating: "Choose a rating",
|
|
18
|
+
check: "Tick the box to go on",
|
|
19
|
+
invalidEmail: "Enter a valid email",
|
|
20
|
+
invalidPhone: "Enter a valid phone number",
|
|
21
|
+
invalidUrl: "Enter a valid address",
|
|
22
|
+
invalidNumber: "Enter a number",
|
|
23
|
+
invalidTime: "Write a time like 9:30",
|
|
24
|
+
atLeast: (min) => `At least ${min}`,
|
|
25
|
+
atMost: (max) => `At most ${max}`,
|
|
26
|
+
unavailableDate: "That day is not available",
|
|
27
|
+
unavailableTime: "That time is not available",
|
|
28
|
+
optional: "Optional",
|
|
29
|
+
pick: "Choose…",
|
|
30
|
+
search: "Search…",
|
|
31
|
+
noResults: "No results",
|
|
32
|
+
show: "Show",
|
|
33
|
+
hide: "Hide",
|
|
34
|
+
increase: "Increase",
|
|
35
|
+
decrease: "Decrease",
|
|
36
|
+
remove: (label) => `Remove ${label}`,
|
|
37
|
+
yes: "Yes",
|
|
38
|
+
no: "No",
|
|
39
|
+
rated: (value, max) => `${value} of ${max}`,
|
|
40
|
+
stars: (count) => count === 1 ? "1 star" : `${count} stars`,
|
|
41
|
+
send: "Send",
|
|
42
|
+
sent: "Sent",
|
|
43
|
+
chooseFile: "Add a file",
|
|
44
|
+
upload: (multiple) => multiple ? "Upload files" : "Upload a file",
|
|
45
|
+
drop: "Drop it here or choose",
|
|
46
|
+
limits: (kinds, size) => kinds ? `${kinds}, up to ${size}` : `Up to ${size}`,
|
|
47
|
+
anyOf: (family) => FAMILIES[family] ?? family,
|
|
48
|
+
uploading: "Uploading",
|
|
49
|
+
tooBig: (size) => `Over ${size}`,
|
|
50
|
+
wrongType: "This kind of file isn't taken here",
|
|
51
|
+
tooMany: (max) => `At most ${max} files`,
|
|
52
|
+
uploadFailed: "Couldn't upload it",
|
|
53
|
+
retry: "Retry",
|
|
54
|
+
stillUploading: "Wait for the upload to finish",
|
|
55
|
+
fixFiles: "Remove or retry the files that failed",
|
|
56
|
+
open: (name) => `Open ${name}`,
|
|
57
|
+
file: "File",
|
|
58
|
+
play: "Play",
|
|
59
|
+
pause: "Pause",
|
|
60
|
+
position: "Position",
|
|
61
|
+
automation: AUTOMATION_MESSAGES
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { KIT_MESSAGES };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":[],"sources":["../../src/kit/messages.ts"],"sourcesContent":["import type { DayPickerLocale } from \"react-day-picker\";\n\nimport { AUTOMATION_MESSAGES, type AutomationMessages } from \"../automation/messages\";\n\n/**\n * The language the kit's dates are read in: a locale from `@signalcore/ui/locale` (the\n * calendar's, with its words), whose `code` also formats days, times, numbers and lists.\n */\nexport type KitLocale = DayPickerLocale;\n\n/** The words the kit's controls say; a host gives its own, in its language. */\nexport interface KitMessages {\n /** A field left empty that must be filled. */\n required: string;\n /** A day, a time, both, an option, a rating still to pick; also an empty picker's invitation. */\n chooseDate: string;\n chooseTime: string;\n chooseMoment: string;\n chooseOption: string;\n chooseRating: string;\n /** A box that must be ticked to go on. */\n check: string;\n invalidEmail: string;\n invalidPhone: string;\n invalidUrl: string;\n invalidNumber: string;\n /** A time typed in a shape that is not one. */\n invalidTime: string;\n /** A number under its least, or over its most, given formatted. */\n atLeast: (min: string) => string;\n atMost: (max: string) => string;\n /** A day or a time that is not offered. */\n unavailableDate: string;\n unavailableTime: string;\n /** Beside the label of a field that may stay empty. */\n optional: string;\n /** In a long list's box while nothing is picked. */\n pick: string;\n /** In that box while the person types. */\n search: string;\n noResults: string;\n /** The button that shows or hides a secret as it is typed. */\n show: string;\n hide: string;\n /** A number's steppers, for screen readers. */\n increase: string;\n decrease: string;\n /** A picked tag's remove button, for screen readers. */\n remove: (label: string) => string;\n /** A box ticked or not, as an answer reads. */\n yes: string;\n no: string;\n /** A rating, as an answer reads. */\n rated: (value: number, max: number) => string;\n /** One star of a rating, for screen readers. */\n stars: (count: number) => string;\n /** A choice's last row, to answer in one's own words, and its box while empty. */\n other: string;\n otherPlaceholder: string;\n /** A form's submit when the agent gave it no words. */\n send: string;\n /** Where a form's submit was, once it is sent. */\n sent: string;\n /** A file field left empty that must be filled. */\n chooseFile: string;\n /** A file field's drop zone: what it asks, and how. */\n upload: (multiple: boolean) => string;\n drop: string;\n /**\n * Under them, what it takes: the kinds (named and joined, \"\" when anything) and the most a\n * file may weigh, formatted.\n */\n limits: (kinds: string, size: string) => string;\n /** A family of kinds as the limits name it: \"image\" for any image, \"video\", \"audio\", \"text\". */\n anyOf: (family: string) => string;\n /** A file on its way, beside how much has gone. */\n uploading: string;\n /** A file that was not sent: heavier than the most (formatted), a kind not taken, one too many. */\n tooBig: (size: string) => string;\n wrongType: string;\n tooMany: (max: number) => string;\n /** A file whose upload failed, and the button that tries it again. */\n uploadFailed: string;\n retry: string;\n /** A form sent while a file is still on its way, or one failed. */\n stillUploading: string;\n fixFiles: string;\n /** A file's chip, opened on a click, for screen readers. */\n open: (name: string) => string;\n /** A file whose name is not known yet. */\n file: string;\n /** An audio player's button, and its way through, for screen readers. */\n play: string;\n pause: string;\n position: string;\n /** An automation and its runs: when it runs, how it stands, what each run did. */\n automation: AutomationMessages;\n}\n\nconst FAMILIES: Readonly<Record<string, string>> = {\n image: \"images\",\n video: \"videos\",\n audio: \"audio\",\n text: \"text\",\n};\n\nexport const KIT_MESSAGES: KitMessages = {\n required: \"This field is required\",\n chooseDate: \"Choose a day\",\n chooseTime: \"Choose a time\",\n chooseMoment: \"Choose a day and a time\",\n chooseOption: \"Choose an option\",\n other: \"Another answer\",\n otherPlaceholder: \"Write your answer\",\n chooseRating: \"Choose a rating\",\n check: \"Tick the box to go on\",\n invalidEmail: \"Enter a valid email\",\n invalidPhone: \"Enter a valid phone number\",\n invalidUrl: \"Enter a valid address\",\n invalidNumber: \"Enter a number\",\n invalidTime: \"Write a time like 9:30\",\n atLeast: (min) => `At least ${min}`,\n atMost: (max) => `At most ${max}`,\n unavailableDate: \"That day is not available\",\n unavailableTime: \"That time is not available\",\n optional: \"Optional\",\n pick: \"Choose…\",\n search: \"Search…\",\n noResults: \"No results\",\n show: \"Show\",\n hide: \"Hide\",\n increase: \"Increase\",\n decrease: \"Decrease\",\n remove: (label) => `Remove ${label}`,\n yes: \"Yes\",\n no: \"No\",\n rated: (value, max) => `${value} of ${max}`,\n stars: (count) => (count === 1 ? \"1 star\" : `${count} stars`),\n send: \"Send\",\n sent: \"Sent\",\n chooseFile: \"Add a file\",\n upload: (multiple) => (multiple ? \"Upload files\" : \"Upload a file\"),\n drop: \"Drop it here or choose\",\n limits: (kinds, size) => (kinds ? `${kinds}, up to ${size}` : `Up to ${size}`),\n anyOf: (family) => FAMILIES[family] ?? family,\n uploading: \"Uploading\",\n tooBig: (size) => `Over ${size}`,\n wrongType: \"This kind of file isn't taken here\",\n tooMany: (max) => `At most ${max} files`,\n uploadFailed: \"Couldn't upload it\",\n retry: \"Retry\",\n stillUploading: \"Wait for the upload to finish\",\n fixFiles: \"Remove or retry the files that failed\",\n open: (name) => `Open ${name}`,\n file: \"File\",\n play: \"Play\",\n pause: \"Pause\",\n position: \"Position\",\n automation: AUTOMATION_MESSAGES,\n};\n"],"mappings":";;AAmGA,MAAM,WAA6C;CACjD,OAAO;CACP,OAAO;CACP,OAAO;CACP,MAAM;AACR;AAEA,MAAa,eAA4B;CACvC,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,cAAc;CACd,OAAO;CACP,kBAAkB;CAClB,cAAc;CACd,OAAO;CACP,cAAc;CACd,cAAc;CACd,YAAY;CACZ,eAAe;CACf,aAAa;CACb,UAAU,QAAQ,YAAY;CAC9B,SAAS,QAAQ,WAAW;CAC5B,iBAAiB;CACjB,iBAAiB;CACjB,UAAU;CACV,MAAM;CACN,QAAQ;CACR,WAAW;CACX,MAAM;CACN,MAAM;CACN,UAAU;CACV,UAAU;CACV,SAAS,UAAU,UAAU;CAC7B,KAAK;CACL,IAAI;CACJ,QAAQ,OAAO,QAAQ,GAAG,MAAM,MAAM;CACtC,QAAQ,UAAW,UAAU,IAAI,WAAW,GAAG,MAAM;CACrD,MAAM;CACN,MAAM;CACN,YAAY;CACZ,SAAS,aAAc,WAAW,iBAAiB;CACnD,MAAM;CACN,SAAS,OAAO,SAAU,QAAQ,GAAG,MAAM,UAAU,SAAS,SAAS;CACvE,QAAQ,WAAW,SAAS,WAAW;CACvC,WAAW;CACX,SAAS,SAAS,QAAQ;CAC1B,WAAW;CACX,UAAU,QAAQ,WAAW,IAAI;CACjC,cAAc;CACd,OAAO;CACP,gBAAgB;CAChB,UAAU;CACV,OAAO,SAAS,QAAQ;CACxB,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;CACV,YAAY;AACd"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/kit/numbers.d.ts
|
|
2
|
+
/** Numbers as the kit's controls hold and write them, as pure functions. */
|
|
3
|
+
/** What bounds a number: its least, its most, the step between values. */
|
|
4
|
+
export interface NumberBounds {
|
|
5
|
+
min?: number | undefined;
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
step?: number | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** A file's size as people read it: whole bytes, one decimal under ten of a larger unit. */
|
|
10
|
+
export declare function formatSize(bytes: number, locale?: string): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/kit/numbers.ts
|
|
2
|
+
function formatNumber(value, code) {
|
|
3
|
+
return new Intl.NumberFormat(code, { maximumFractionDigits: 6 }).format(value);
|
|
4
|
+
}
|
|
5
|
+
/** A number with its unit after it: "3 personas", "25 €". */
|
|
6
|
+
function withUnit(text, unit) {
|
|
7
|
+
return unit ? `${text} ${unit}` : text;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A number one step up or down (`direction` 1 or -1), kept within its bounds and on its step's
|
|
11
|
+
* decimals; from nothing, it starts at its least, or 0.
|
|
12
|
+
*/
|
|
13
|
+
function stepped(bounds, value, direction) {
|
|
14
|
+
const step = bounds.step ?? 1;
|
|
15
|
+
const next = value === null ? bounds.min ?? 0 : value + direction * step;
|
|
16
|
+
const decimals = (String(step).split(".")[1] ?? "").length;
|
|
17
|
+
const rounded = Number(next.toFixed(decimals));
|
|
18
|
+
return Math.min(bounds.max ?? Infinity, Math.max(bounds.min ?? -Infinity, rounded));
|
|
19
|
+
}
|
|
20
|
+
const UNITS = [
|
|
21
|
+
"B",
|
|
22
|
+
"KB",
|
|
23
|
+
"MB",
|
|
24
|
+
"GB"
|
|
25
|
+
];
|
|
26
|
+
/** A file's size as people read it: whole bytes, one decimal under ten of a larger unit. */
|
|
27
|
+
function formatSize(bytes, locale) {
|
|
28
|
+
let size = Math.max(0, bytes);
|
|
29
|
+
let unit = 0;
|
|
30
|
+
while (size >= 1024 && unit < UNITS.length - 1) {
|
|
31
|
+
size /= 1024;
|
|
32
|
+
unit += 1;
|
|
33
|
+
}
|
|
34
|
+
const digits = unit === 0 || size >= 10 ? 0 : 1;
|
|
35
|
+
return `${new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(size)} ${UNITS[unit]}`;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { formatNumber, formatSize, stepped, withUnit };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=numbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.js","names":[],"sources":["../../src/kit/numbers.ts"],"sourcesContent":["/** Numbers as the kit's controls hold and write them, as pure functions. */\n\n/** What bounds a number: its least, its most, the step between values. */\nexport interface NumberBounds {\n min?: number | undefined;\n max?: number | undefined;\n step?: number | undefined;\n}\n\nexport function formatNumber(value: number, code: string): string {\n return new Intl.NumberFormat(code, { maximumFractionDigits: 6 }).format(value);\n}\n\n/** A number with its unit after it: \"3 personas\", \"25 €\". */\nexport function withUnit(text: string, unit: string | undefined): string {\n return unit ? `${text} ${unit}` : text;\n}\n\n/**\n * A number one step up or down (`direction` 1 or -1), kept within its bounds and on its step's\n * decimals; from nothing, it starts at its least, or 0.\n */\nexport function stepped(bounds: NumberBounds, value: number | null, direction: 1 | -1): number {\n const step = bounds.step ?? 1;\n const next = value === null ? (bounds.min ?? 0) : value + direction * step;\n const decimals = (String(step).split(\".\")[1] ?? \"\").length;\n const rounded = Number(next.toFixed(decimals));\n return Math.min(bounds.max ?? Infinity, Math.max(bounds.min ?? -Infinity, rounded));\n}\n\nconst UNITS = [\"B\", \"KB\", \"MB\", \"GB\"] as const;\n\n/** A file's size as people read it: whole bytes, one decimal under ten of a larger unit. */\nexport function formatSize(bytes: number, locale?: string): string {\n let size = Math.max(0, bytes);\n let unit = 0;\n while (size >= 1024 && unit < UNITS.length - 1) {\n size /= 1024;\n unit += 1;\n }\n const digits = unit === 0 || size >= 10 ? 0 : 1;\n const number = new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(size);\n return `${number} ${UNITS[unit]}`;\n}\n"],"mappings":";AASA,SAAgB,aAAa,OAAe,MAAsB;CAChE,OAAO,IAAI,KAAK,aAAa,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK;AAC/E;;AAGA,SAAgB,SAAS,MAAc,MAAkC;CACvE,OAAO,OAAO,GAAG,KAAK,GAAG,SAAS;AACpC;;;;;AAMA,SAAgB,QAAQ,QAAsB,OAAsB,WAA2B;CAC7F,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,OAAO,UAAU,OAAQ,OAAO,OAAO,IAAK,QAAQ,YAAY;CACtE,MAAM,YAAY,OAAO,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI;CACpD,MAAM,UAAU,OAAO,KAAK,QAAQ,QAAQ,CAAC;CAC7C,OAAO,KAAK,IAAI,OAAO,OAAO,UAAU,KAAK,IAAI,OAAO,OAAO,WAAW,OAAO,CAAC;AACpF;AAEA,MAAM,QAAQ;CAAC;CAAK;CAAM;CAAM;AAAI;;AAGpC,SAAgB,WAAW,OAAe,QAAyB;CACjE,IAAI,OAAO,KAAK,IAAI,GAAG,KAAK;CAC5B,IAAI,OAAO;CACX,OAAO,QAAQ,QAAQ,OAAO,MAAM,SAAS,GAAG;EAC9C,QAAQ;EACR,QAAQ;CACV;CACA,MAAM,SAAS,SAAS,KAAK,QAAQ,KAAK,IAAI;CAE9C,OAAO,GADQ,IAAI,KAAK,aAAa,QAAQ,EAAE,uBAAuB,OAAO,CAAC,CAAC,CAAC,OAAO,IACxE,EAAE,GAAG,MAAM;AAC5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/kit/options.d.ts
|
|
2
|
+
/** The options a control offers, as pure functions: finding one, ticking one on and off. */
|
|
3
|
+
/** One thing to pick: its id (what comes back), its label, and a quiet line under it. */
|
|
4
|
+
export interface Option {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
hint?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/kit/options.ts
|
|
2
|
+
/** Whether an option is what the person is looking for: in its label, hint or id, any case or accent. */
|
|
3
|
+
function matches(option, query) {
|
|
4
|
+
const wanted = fold(query.trim());
|
|
5
|
+
if (wanted === "") return true;
|
|
6
|
+
return [
|
|
7
|
+
option.label,
|
|
8
|
+
option.hint ?? "",
|
|
9
|
+
option.id
|
|
10
|
+
].some((text) => fold(text).includes(wanted));
|
|
11
|
+
}
|
|
12
|
+
function fold(text) {
|
|
13
|
+
return text.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
/** The ids picked once the person ticks one on or off, in the options' order. */
|
|
16
|
+
function toggled(options, picked, id) {
|
|
17
|
+
const on = !picked.includes(id);
|
|
18
|
+
return options.filter((option) => option.id === id ? on : picked.includes(option.id)).map((option) => option.id);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { matches, toggled };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","names":[],"sources":["../../src/kit/options.ts"],"sourcesContent":["/** The options a control offers, as pure functions: finding one, ticking one on and off. */\n\n/** One thing to pick: its id (what comes back), its label, and a quiet line under it. */\nexport interface Option {\n id: string;\n label: string;\n hint?: string | undefined;\n}\n\n/** Whether an option is what the person is looking for: in its label, hint or id, any case or accent. */\nexport function matches(option: Option, query: string): boolean {\n const wanted = fold(query.trim());\n if (wanted === \"\") return true;\n return [option.label, option.hint ?? \"\", option.id].some((text) => fold(text).includes(wanted));\n}\n\nfunction fold(text: string): string {\n return text\n .normalize(\"NFD\")\n .replace(/\\p{Diacritic}/gu, \"\")\n .toLowerCase();\n}\n\n/** The ids picked once the person ticks one on or off, in the options' order. */\nexport function toggled(options: Option[], picked: readonly string[], id: string): string[] {\n const on = !picked.includes(id);\n return options\n .filter((option) => (option.id === id ? on : picked.includes(option.id)))\n .map((option) => option.id);\n}\n"],"mappings":";;AAUA,SAAgB,QAAQ,QAAgB,OAAwB;CAC9D,MAAM,SAAS,KAAK,MAAM,KAAK,CAAC;CAChC,IAAI,WAAW,IAAI,OAAO;CAC1B,OAAO;EAAC,OAAO;EAAO,OAAO,QAAQ;EAAI,OAAO;CAAE,CAAC,CAAC,MAAM,SAAS,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC;AAChG;AAEA,SAAS,KAAK,MAAsB;CAClC,OAAO,KACJ,UAAU,KAAK,CAAC,CAChB,QAAQ,mBAAmB,EAAE,CAAC,CAC9B,YAAY;AACjB;;AAGA,SAAgB,QAAQ,SAAmB,QAA2B,IAAsB;CAC1F,MAAM,KAAK,CAAC,OAAO,SAAS,EAAE;CAC9B,OAAO,QACJ,QAAQ,WAAY,OAAO,OAAO,KAAK,KAAK,OAAO,SAAS,OAAO,EAAE,CAAE,CAAC,CACxE,KAAK,WAAW,OAAO,EAAE;AAC9B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Attachment } from "../types.js";
|
|
2
|
+
import "./messages.js";
|
|
3
|
+
//#region src/kit/uploads.d.ts
|
|
4
|
+
/** The most a file may weigh anywhere, in MB: the API's ceiling. */
|
|
5
|
+
export declare const MAX_MB = 50;
|
|
6
|
+
/**
|
|
7
|
+
* Sends one file where it belongs, telling how much of it has gone (0 to 1) as it goes; aborting
|
|
8
|
+
* `signal` lets it go. Resolves to the file as stored.
|
|
9
|
+
*/
|
|
10
|
+
export type Uploader = (file: File, progress: (share: number) => void, signal: AbortSignal) => Promise<Attachment>;
|
|
11
|
+
/** Where a field's files go and how the ones already sent are found: the conversation's. */
|
|
12
|
+
export interface FileHost {
|
|
13
|
+
upload: Uploader;
|
|
14
|
+
/** The files known by id: said in the conversation, uploaded to it. */
|
|
15
|
+
known: ReadonlyMap<string, Attachment>;
|
|
16
|
+
/** Asks for files it does not know yet, by id: read back from the conversation. */
|
|
17
|
+
find?: ((ids: readonly string[]) => void) | undefined;
|
|
18
|
+
/** Opens one, when the host shows files. */
|
|
19
|
+
open?: ((file: Attachment) => void) | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Where a picture, a video or a sound plays from in the page's own player: an address the
|
|
22
|
+
* player streams with no credential, for a while.
|
|
23
|
+
*/
|
|
24
|
+
play?: ((file: Attachment) => Promise<string>) | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** A file as picked: its name, its type as the browser gave it ("" when none), its weight. */
|
|
27
|
+
export interface Picked {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
size: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether a file is of a kind `accept` lists, read as an <input accept> reads it: a type
|
|
34
|
+
* ("application/pdf"), a family ("image/*") or an extension (".xlsx"); none takes anything.
|
|
35
|
+
*/
|
|
36
|
+
export declare function accepts(accept: readonly string[] | undefined, file: Pick<Picked, "name" | "type">): boolean;
|
|
37
|
+
/** The families a file's glyph tells apart. */
|
|
38
|
+
export type FileFamily = "image" | "pdf" | "sheet" | "doc" | "slides" | "text" | "archive" | "audio" | "video" | "other";
|
|
39
|
+
/** A file's family, by its name's extension first, then by its type. */
|
|
40
|
+
export declare function familyOf(name: string, type: string): FileFamily;
|
|
41
|
+
//#endregion
|
|
42
|
+
//# sourceMappingURL=uploads.d.ts.map
|