@dxos/plugin-transcription 0.8.3 → 0.8.4-main.1c7ec43d41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/blueprints/index.mjs +31 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-3L623EVL.mjs +17 -0
- package/dist/lib/browser/chunk-3L623EVL.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-KAEXRX3Y.mjs +35 -0
- package/dist/lib/browser/chunk-KAEXRX3Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-L4HW35L6.mjs +111 -0
- package/dist/lib/browser/chunk-L4HW35L6.mjs.map +7 -0
- package/dist/lib/browser/chunk-MLRJWAQH.mjs +179 -0
- package/dist/lib/browser/chunk-MLRJWAQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQQK7UZQ.mjs +244 -0
- package/dist/lib/browser/chunk-NQQK7UZQ.mjs.map +7 -0
- package/dist/lib/browser/components/index.mjs +207 -0
- package/dist/lib/browser/components/index.mjs.map +7 -0
- package/dist/lib/browser/create-ULR5DPJZ.mjs +21 -0
- package/dist/lib/browser/create-ULR5DPJZ.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +17 -0
- package/dist/lib/browser/index.mjs +442 -94
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-SFMPLZVW.mjs +27 -0
- package/dist/lib/browser/open-SFMPLZVW.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/summarize-BDFX4APN.mjs +78 -0
- package/dist/lib/browser/summarize-BDFX4APN.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -8
- package/dist/lib/node-esm/blueprints/index.mjs +32 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs +112 -0
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs +181 -0
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs +19 -0
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs +245 -0
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O533NBMK.mjs +37 -0
- package/dist/lib/node-esm/chunk-O533NBMK.mjs.map +7 -0
- package/dist/lib/node-esm/components/index.mjs +208 -0
- package/dist/lib/node-esm/components/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-A5QHNWRF.mjs +22 -0
- package/dist/lib/node-esm/create-A5QHNWRF.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +18 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +442 -94
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-OI24QNTO.mjs +28 -0
- package/dist/lib/node-esm/open-OI24QNTO.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs +79 -0
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -8
- package/dist/types/src/TranscriptionPlugin.d.ts +3 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +10 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/text-content.d.ts +8 -0
- package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber.d.ts +4 -3
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.d.ts +18 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/index.d.ts +2 -0
- package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +4 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/model.d.ts +2 -2
- package/dist/types/src/model/model.d.ts.map +1 -1
- package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
- package/dist/types/src/normalization/index.d.ts.map +1 -0
- package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +5 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.d.ts +364 -0
- package/dist/types/src/normalization/normalization.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
- package/dist/types/src/normalization/utils.d.ts +3 -0
- package/dist/types/src/normalization/utils.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +917 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/summarize.d.ts +8 -0
- package/dist/types/src/operations/summarize.d.ts.map +1 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts +18 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts +14 -0
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts +20 -0
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +10 -10
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +60 -5
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
- package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
- package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +19 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +5 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +127 -82
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +22 -61
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +29 -0
- package/src/capabilities/blueprint-definition.ts +19 -0
- package/src/capabilities/index.ts +11 -6
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/transcriber.ts +54 -42
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +78 -73
- package/src/components/Transcription/Transcription.tsx +64 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +15 -48
- package/src/components/index.ts +1 -6
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
- package/src/containers/TranscriptionContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useAudioFile.ts +49 -53
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +15 -7
- package/src/hooks/useVoiceInput.ts +3 -3
- package/src/index.ts +10 -5
- package/src/meta.ts +9 -6
- package/src/model/model.test.ts +27 -21
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +20 -19
- package/src/{segments-normalization → normalization}/normalization.test.ts +26 -33
- package/src/normalization/normalization.ts +77 -0
- package/src/{segments-normalization → normalization}/utils.ts +2 -2
- package/src/operations/create.ts +24 -0
- package/src/operations/definitions.ts +101 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/open.ts +28 -0
- package/src/operations/summarize.ts +101 -0
- package/src/{components/stories → stories}/FileTranscription.stories.tsx +99 -72
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +46 -40
- package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +85 -101
- package/src/stories/TranscriptionStory.tsx +93 -0
- package/src/testing/testing.ts +41 -41
- package/src/transcriber/media-stream-recorder.ts +4 -4
- package/src/transcriber/transcriber.browser.test.ts +5 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +101 -62
- package/src/transcriber/transcription-manager.ts +37 -52
- package/src/translations.ts +12 -10
- package/src/types/capabilities.ts +39 -0
- package/src/types/defs.ts +9 -0
- package/src/types/index.ts +2 -2
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
- package/dist/lib/browser/chunk-53AXUEIQ.mjs +0 -764
- package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
- package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs +0 -495
- package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
- package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
- package/dist/lib/browser/chunk-UDCCT32F.mjs +0 -8
- package/dist/lib/browser/chunk-UDCCT32F.mjs.map +0 -7
- package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
- package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
- package/dist/lib/browser/transcriber-OYPLZFG5.mjs +0 -56
- package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
- package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
- package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
- package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
- package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
- package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
- package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
- package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
- package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
- package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
- package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
- package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
- package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -133
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
- package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -36
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-G75LDEO5.mjs +0 -12
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs +0 -765
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs +0 -10
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs +0 -496
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs +0 -57
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -24
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/index.d.ts +0 -2
- package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -8
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -17
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +0 -10
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +0 -19
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -11
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +0 -329
- package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/utils.d.ts +0 -3
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -31
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -24
- package/src/components/Transcript/Transcript.tsx +0 -100
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -30
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/segments-normalization/normalization.ts +0 -105
- package/src/types/schema.ts +0 -41
- package/src/types/types.ts +0 -32
- package/dist/lib/browser/{TranscriptContainer-H3AZQ4CQ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → browser/hooks/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
9
|
+
|
|
10
|
+
import { TranscriptionCapabilities } from '#types';
|
|
7
11
|
|
|
8
|
-
import { TranscriptionCapabilities } from './capabilities';
|
|
9
12
|
import { MediaStreamRecorder, Transcriber, TranscriptionManager } from '../transcriber';
|
|
10
13
|
|
|
11
14
|
// TODO(burdon): Move to config?
|
|
@@ -29,48 +32,57 @@ const TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
|
29
32
|
/**
|
|
30
33
|
* Records audio while user is speaking and transcribes it after user is done speaking.
|
|
31
34
|
*/
|
|
32
|
-
export default (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
mediaStreamTrack: audioStreamTrack,
|
|
35
|
+
export default Capability.makeModule(
|
|
36
|
+
Effect.fnUntraced(function* () {
|
|
37
|
+
// Get context for lazy capability access in callbacks.
|
|
38
|
+
const capabilities = yield* Capability.Service;
|
|
39
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
40
|
+
|
|
41
|
+
const getTranscriber: TranscriptionCapabilities.GetTranscriber = ({
|
|
42
|
+
audioStreamTrack,
|
|
43
|
+
onSegments,
|
|
44
|
+
transcriberConfig,
|
|
45
|
+
recorderConfig,
|
|
46
|
+
transcribe,
|
|
47
|
+
}) => {
|
|
48
|
+
// Initialize audio transcription.
|
|
49
|
+
return new Transcriber({
|
|
48
50
|
config: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
transcribeAfterChunksAmount: TRANSCRIBE_AFTER_CHUNKS_AMOUNT,
|
|
52
|
+
prefixBufferChunksAmount: PREFIXED_CHUNKS_AMOUNT,
|
|
53
|
+
...transcriberConfig,
|
|
51
54
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
recorder: new MediaStreamRecorder({
|
|
56
|
+
mediaStreamTrack: audioStreamTrack,
|
|
57
|
+
config: {
|
|
58
|
+
interval: RECORD_INTERVAL,
|
|
59
|
+
...recorderConfig,
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
onSegments,
|
|
63
|
+
transcribe,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
const getTranscriptionManager: TranscriptionCapabilities.GetTranscriptionManager = ({ messageEnricher }) => {
|
|
68
|
+
const client = capabilities.get(ClientCapabilities.Client);
|
|
69
|
+
const transcriptionManager = new TranscriptionManager({
|
|
70
|
+
edgeClient: client.edge.http,
|
|
71
|
+
messageEnricher,
|
|
72
|
+
registry,
|
|
73
|
+
});
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
const identity = client.halo.identity.get();
|
|
76
|
+
if (identity) {
|
|
77
|
+
transcriptionManager.setIdentityDid(identity.did);
|
|
78
|
+
}
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
return transcriptionManager;
|
|
81
|
+
};
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
83
|
+
return [
|
|
84
|
+
Capability.contributes(TranscriptionCapabilities.Transcriber, getTranscriber),
|
|
85
|
+
Capability.contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager),
|
|
86
|
+
];
|
|
87
|
+
}),
|
|
88
|
+
);
|
package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx}
RENAMED
|
@@ -2,59 +2,56 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import type * as Types from 'effect/Types';
|
|
8
8
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
11
|
import { Key } from '@dxos/echo';
|
|
13
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
14
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { faker } from '@dxos/random';
|
|
19
|
-
import { useMembers, useSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
+
import { random } from '@dxos/random';
|
|
17
|
+
import { useMembers, useSpaces } from '@dxos/react-client/echo';
|
|
20
18
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import { renderMarkdown, Transcript, type TranscriptProps } from './Transcript';
|
|
28
|
-
import { useQueueModelAdapter } from '../../hooks';
|
|
29
|
-
import { SerializationModel } from '../../model';
|
|
19
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
21
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
22
|
+
import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
|
|
23
|
+
|
|
24
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
30
25
|
import {
|
|
31
26
|
MessageBuilder,
|
|
32
27
|
TestItem,
|
|
33
28
|
useTestTranscriptionQueue,
|
|
34
29
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
35
|
-
} from '
|
|
36
|
-
import translations from '
|
|
30
|
+
} from '#testing';
|
|
31
|
+
import { translations } from '#translations';
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
import { SerializationModel } from '../../model';
|
|
34
|
+
import { renderByline } from '../../util';
|
|
35
|
+
import { Transcription, type TranscriptionProps } from './Transcription';
|
|
36
|
+
|
|
37
|
+
random.seed(1);
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* Story wrapper with test controls.
|
|
42
41
|
*/
|
|
43
42
|
const TranscriptContainer: FC<
|
|
44
|
-
|
|
43
|
+
TranscriptionProps & {
|
|
45
44
|
running: boolean;
|
|
46
45
|
onRunningChange: (running: boolean) => void;
|
|
47
46
|
onReset?: () => void;
|
|
48
47
|
}
|
|
49
|
-
> = ({
|
|
48
|
+
> = ({ model, running, onRunningChange, onReset }) => {
|
|
50
49
|
return (
|
|
51
50
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
52
|
-
<
|
|
51
|
+
<Transcription model={model} />
|
|
53
52
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
54
53
|
<div className='flex items-center'>
|
|
55
|
-
<
|
|
56
|
-
{JSON.stringify(model.toJSON())}
|
|
57
|
-
</SyntaxHighlighter>
|
|
54
|
+
<JsonHighlighter data={model.toJSON()} indent={0} classNames='text-sm' />
|
|
58
55
|
</div>
|
|
59
56
|
<Toolbar.Root classNames='justify-end'>
|
|
60
57
|
<IconButton
|
|
@@ -69,20 +66,24 @@ const TranscriptContainer: FC<
|
|
|
69
66
|
);
|
|
70
67
|
};
|
|
71
68
|
|
|
72
|
-
type
|
|
69
|
+
type DefaultStoryProps = { messages?: Message.Message[] } & Pick<
|
|
70
|
+
TranscriptionProps,
|
|
71
|
+
'ignoreAttention' | 'attendableId'
|
|
72
|
+
>;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Basic story mutates array of messages.
|
|
76
76
|
*/
|
|
77
|
-
const BasicStory = ({ messages: initialMessages = [], ...props }:
|
|
77
|
+
const BasicStory = ({ messages: initialMessages = [], ...props }: DefaultStoryProps) => {
|
|
78
78
|
const [reset, setReset] = useState({});
|
|
79
79
|
const builder = useMemo(() => new MessageBuilder(), []);
|
|
80
80
|
const model = useMemo(
|
|
81
|
-
() => new SerializationModel<
|
|
81
|
+
() => new SerializationModel<Message.Message>(renderByline([]), initialMessages),
|
|
82
82
|
[initialMessages, reset],
|
|
83
83
|
);
|
|
84
84
|
const [running, setRunning] = useState(true);
|
|
85
|
-
|
|
85
|
+
// Use mutable type for local message building (not ECHO-managed).
|
|
86
|
+
const [currentMessage, setCurrentMessage] = useState<Types.Mutable<Message.Message> | null>(null);
|
|
86
87
|
useEffect(() => {
|
|
87
88
|
if (!running) {
|
|
88
89
|
return;
|
|
@@ -103,7 +104,7 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
|
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
currentMessage.blocks.push(builder.createBlock());
|
|
107
|
+
(currentMessage.blocks as ContentBlock.Any[]).push(builder.createBlock());
|
|
107
108
|
model.updateChunk(currentMessage);
|
|
108
109
|
}, 3_000);
|
|
109
110
|
|
|
@@ -135,34 +136,27 @@ const QueueStory = ({
|
|
|
135
136
|
queueId,
|
|
136
137
|
onReset,
|
|
137
138
|
...props
|
|
138
|
-
}:
|
|
139
|
+
}: DefaultStoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
139
140
|
const [running, setRunning] = useState(true);
|
|
140
|
-
const space =
|
|
141
|
-
const members = useMembers(space?.
|
|
141
|
+
const [space] = useSpaces();
|
|
142
|
+
const members = useMembers(space?.id).map((member) => member.identity);
|
|
142
143
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
143
|
-
const model = useQueueModelAdapter(
|
|
144
|
+
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
144
145
|
|
|
145
146
|
return (
|
|
146
|
-
<TranscriptContainer
|
|
147
|
-
space={space}
|
|
148
|
-
model={model}
|
|
149
|
-
running={running}
|
|
150
|
-
onRunningChange={setRunning}
|
|
151
|
-
onReset={onReset}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
147
|
+
<TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
|
|
154
148
|
);
|
|
155
149
|
};
|
|
156
150
|
|
|
157
151
|
// TODO(burdon): Reconcile with QueueStory.
|
|
158
152
|
const EntityExtractionQueueStory = () => {
|
|
159
153
|
const [running, setRunning] = useState(true);
|
|
160
|
-
const space =
|
|
154
|
+
const [space] = useSpaces();
|
|
161
155
|
const members = useMembers(space?.key).map((member) => member.identity);
|
|
162
156
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
163
|
-
const model = useQueueModelAdapter(
|
|
157
|
+
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
164
158
|
|
|
165
|
-
return <TranscriptContainer
|
|
159
|
+
return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
|
|
166
160
|
};
|
|
167
161
|
|
|
168
162
|
/**
|
|
@@ -178,46 +172,54 @@ const QueueStoryWrapper = () => {
|
|
|
178
172
|
return <QueueStory key={key} queueId={queueId} onReset={handleReset} />;
|
|
179
173
|
};
|
|
180
174
|
|
|
181
|
-
const meta
|
|
182
|
-
title: 'plugins/plugin-transcription/
|
|
175
|
+
const meta = {
|
|
176
|
+
title: 'plugins/plugin-transcription/components/Transcription',
|
|
183
177
|
decorators: [
|
|
178
|
+
withLayout({ layout: 'fullscreen' }),
|
|
184
179
|
withPluginManager({
|
|
185
180
|
plugins: [
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
...corePlugins(),
|
|
182
|
+
StorybookPlugin({}),
|
|
188
183
|
ClientPlugin({
|
|
189
|
-
types: [TestItem,
|
|
190
|
-
onClientInitialized:
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
185
|
+
onClientInitialized: ({ client }) =>
|
|
186
|
+
Effect.gen(function* () {
|
|
187
|
+
yield* initializeIdentity(client);
|
|
188
|
+
}),
|
|
193
189
|
}),
|
|
190
|
+
|
|
194
191
|
PreviewPlugin(),
|
|
195
|
-
SpacePlugin(),
|
|
196
|
-
SettingsPlugin(),
|
|
197
|
-
IntentPlugin(),
|
|
198
192
|
],
|
|
199
193
|
}),
|
|
200
|
-
withLayout({ fullscreen: true }),
|
|
201
194
|
],
|
|
202
195
|
parameters: {
|
|
196
|
+
layout: 'fullscreen',
|
|
203
197
|
translations,
|
|
204
198
|
},
|
|
205
|
-
};
|
|
199
|
+
} satisfies Meta;
|
|
206
200
|
|
|
207
201
|
export default meta;
|
|
208
202
|
|
|
209
|
-
|
|
203
|
+
const DefaultStory = (props: DefaultStoryProps) => {
|
|
204
|
+
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
|
|
207
|
+
}, []);
|
|
208
|
+
if (messages.length === 0) {
|
|
209
|
+
return <div>Loading messages...</div>;
|
|
210
|
+
}
|
|
211
|
+
return <BasicStory {...props} messages={messages} />;
|
|
212
|
+
};
|
|
210
213
|
|
|
211
|
-
export const Default:
|
|
212
|
-
render:
|
|
214
|
+
export const Default: StoryObj<typeof DefaultStory> = {
|
|
215
|
+
render: DefaultStory,
|
|
213
216
|
args: {
|
|
214
217
|
ignoreAttention: true,
|
|
215
218
|
attendableId: 'story',
|
|
216
|
-
messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
|
|
217
219
|
},
|
|
218
220
|
};
|
|
219
221
|
|
|
220
|
-
export const Empty:
|
|
222
|
+
export const Empty: StoryObj<typeof BasicStory> = {
|
|
221
223
|
render: BasicStory,
|
|
222
224
|
args: {
|
|
223
225
|
ignoreAttention: true,
|
|
@@ -225,7 +227,7 @@ export const Empty: Story = {
|
|
|
225
227
|
},
|
|
226
228
|
};
|
|
227
229
|
|
|
228
|
-
export const WithQueue:
|
|
230
|
+
export const WithQueue: StoryObj<typeof QueueStoryWrapper> = {
|
|
229
231
|
render: QueueStoryWrapper,
|
|
230
232
|
args: {
|
|
231
233
|
ignoreAttention: true,
|
|
@@ -233,10 +235,13 @@ export const WithQueue: Story = {
|
|
|
233
235
|
},
|
|
234
236
|
};
|
|
235
237
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
// NOTE: We are running out of free quota on hugging face entity extraction.
|
|
239
|
+
// TODO(mykola): Fix AI service in entity extraction function.
|
|
240
|
+
// TODO(mykola): Fix hugging face quota issues.
|
|
241
|
+
// export const WithEntityExtractionQueue: StoryObj<typeof EntityExtractionQueueStory> = {
|
|
242
|
+
// render: EntityExtractionQueueStory,
|
|
243
|
+
// args: {
|
|
244
|
+
// ignoreAttention: true,
|
|
245
|
+
// attendableId: 'story',
|
|
246
|
+
// },
|
|
247
|
+
// };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useThemeContext } from '@dxos/react-ui';
|
|
8
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
9
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
10
|
+
import {
|
|
11
|
+
autoScroll,
|
|
12
|
+
createBasicExtensions,
|
|
13
|
+
createMarkdownExtensions,
|
|
14
|
+
createThemeExtensions,
|
|
15
|
+
decorateMarkdown,
|
|
16
|
+
documentSlots,
|
|
17
|
+
preview,
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
20
|
+
import { isTruthy } from '@dxos/util';
|
|
21
|
+
|
|
22
|
+
import { type SerializationModel } from '../../model';
|
|
23
|
+
import { renderByline } from '../../util';
|
|
24
|
+
import { transcription } from './transcription-extension';
|
|
25
|
+
|
|
26
|
+
export { renderByline };
|
|
27
|
+
|
|
28
|
+
export type TranscriptionProps = {
|
|
29
|
+
transcript?: Transcript.Transcript;
|
|
30
|
+
model: SerializationModel<Message.Message>;
|
|
31
|
+
// TODO(burdon): Are these still in use?
|
|
32
|
+
attendableId?: string;
|
|
33
|
+
ignoreAttention?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Transcript component implemented using the editor.
|
|
38
|
+
*/
|
|
39
|
+
export const Transcription = composable<HTMLDivElement, TranscriptionProps>(
|
|
40
|
+
({ transcript: object, model, children, ...props }, forwardedRef) => {
|
|
41
|
+
const { themeMode } = useThemeContext();
|
|
42
|
+
const { parentRef } = useTextEditor(() => {
|
|
43
|
+
return {
|
|
44
|
+
extensions: [
|
|
45
|
+
createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
|
|
46
|
+
createMarkdownExtensions(),
|
|
47
|
+
createThemeExtensions({ themeMode, slots: documentSlots }),
|
|
48
|
+
decorateMarkdown(),
|
|
49
|
+
preview(),
|
|
50
|
+
transcription({ model, started: object?.started ? new Date(object.started) : undefined }),
|
|
51
|
+
autoScroll(),
|
|
52
|
+
].filter(isTruthy),
|
|
53
|
+
};
|
|
54
|
+
}, [model]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
{...composableProps(props, { classNames: 'dx-container' })}
|
|
59
|
+
ref={parentRef}
|
|
60
|
+
data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
@@ -8,24 +8,22 @@ import { format } from 'date-fns/format';
|
|
|
8
8
|
import { intervalToDuration } from 'date-fns/intervalToDuration';
|
|
9
9
|
|
|
10
10
|
import { type CleanupFn, addEventListener, combine } from '@dxos/async';
|
|
11
|
-
import { type
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
13
12
|
|
|
14
13
|
import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Data structure that maps Chunks queue to lines with transcript state.
|
|
18
17
|
*/
|
|
19
|
-
export type
|
|
20
|
-
model: SerializationModel<
|
|
18
|
+
export type TranscriptionOptions = {
|
|
19
|
+
model: SerializationModel<Message.Message>;
|
|
21
20
|
started?: Date;
|
|
22
|
-
renderButton?: RenderCallback<{ onClick: () => void }>;
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* Scrolling transcript with timestamps.
|
|
27
25
|
*/
|
|
28
|
-
export const
|
|
26
|
+
export const transcription = ({ model, started }: TranscriptionOptions): Extension => {
|
|
29
27
|
return [
|
|
30
28
|
// Show timestamps in the gutter.
|
|
31
29
|
gutter({
|
|
@@ -38,7 +36,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
38
36
|
let line = view.state.doc.lineAt(from);
|
|
39
37
|
while (line.from <= to) {
|
|
40
38
|
const block = model.getChunkAtLine(line.number)?.blocks[0];
|
|
41
|
-
const timestamp = block?.
|
|
39
|
+
const timestamp = block?._tag === 'transcript' && block.started;
|
|
42
40
|
if (timestamp) {
|
|
43
41
|
builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
|
|
44
42
|
}
|
|
@@ -90,22 +88,6 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
90
88
|
});
|
|
91
89
|
};
|
|
92
90
|
|
|
93
|
-
// Scroll button.
|
|
94
|
-
if (renderButton) {
|
|
95
|
-
this._controls = document.createElement('div');
|
|
96
|
-
this._controls.classList.add('cm-controls', 'transition-opacity', 'duration-300', 'opacity-0');
|
|
97
|
-
view.dom.appendChild(this._controls);
|
|
98
|
-
renderButton(
|
|
99
|
-
this._controls,
|
|
100
|
-
{
|
|
101
|
-
onClick: () => {
|
|
102
|
-
scrollToBottom(false);
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
view,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
91
|
// Event listeners.
|
|
110
92
|
this._cleanup = combine(
|
|
111
93
|
addEventListener(view.scrollDOM, 'scroll', () => {
|
|
@@ -131,7 +113,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
131
113
|
);
|
|
132
114
|
}
|
|
133
115
|
|
|
134
|
-
update(
|
|
116
|
+
update(_update: ViewUpdate) {
|
|
135
117
|
// Initial sync.
|
|
136
118
|
if (!this._initialized) {
|
|
137
119
|
this._initialized = true;
|
|
@@ -149,27 +131,12 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
149
131
|
),
|
|
150
132
|
|
|
151
133
|
EditorView.theme({
|
|
152
|
-
'.cm-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
'.cm-hide-scrollbar': {
|
|
156
|
-
scrollbarWidth: 'none',
|
|
157
|
-
'-ms-overflow-style': 'none',
|
|
158
|
-
},
|
|
159
|
-
'.cm-hide-scrollbar::-webkit-scrollbar': {
|
|
160
|
-
display: 'none',
|
|
161
|
-
},
|
|
162
|
-
'.cm-controls': {
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
bottom: '0.5rem',
|
|
165
|
-
right: '0.5rem',
|
|
166
|
-
zIndex: 1000,
|
|
167
|
-
},
|
|
168
|
-
'.cm-line': {
|
|
169
|
-
paddingRight: '1rem',
|
|
134
|
+
'.cm-gutters': {
|
|
135
|
+
backgroundColor: 'var(--color-base-surface)',
|
|
170
136
|
},
|
|
171
137
|
'.cm-timestamp-gutter': {
|
|
172
138
|
width: '6rem',
|
|
139
|
+
paddingLeft: '0.5rem',
|
|
173
140
|
paddingRight: '1rem',
|
|
174
141
|
},
|
|
175
142
|
'.cm-timestamp-gutter > .cm-gutterElement > div': {
|
|
@@ -193,13 +160,13 @@ class TimestampMarker extends GutterMarker {
|
|
|
193
160
|
super();
|
|
194
161
|
}
|
|
195
162
|
|
|
196
|
-
override eq(other: this)
|
|
197
|
-
return
|
|
163
|
+
override eq(other: this) {
|
|
164
|
+
return this._timestamp === other._timestamp;
|
|
198
165
|
}
|
|
199
166
|
|
|
200
|
-
override toDOM(view: EditorView)
|
|
167
|
+
override toDOM(view: EditorView) {
|
|
201
168
|
const el = document.createElement('div');
|
|
202
|
-
el.className = 'text-sm text-subdued hover:bg-
|
|
169
|
+
el.className = 'text-sm text-subdued hover:bg-hover-surface cursor-pointer';
|
|
203
170
|
el.textContent = formatTimestamp(this._timestamp, this._started);
|
|
204
171
|
// TODO(burdon): Click to bookmark or copy hyperlink.
|
|
205
172
|
el.onclick = () => {
|
|
@@ -213,12 +180,12 @@ class TimestampMarker extends GutterMarker {
|
|
|
213
180
|
}
|
|
214
181
|
}
|
|
215
182
|
|
|
216
|
-
const getStartTime = (started?: Date, message?:
|
|
183
|
+
const getStartTime = (started?: Date, message?: Message.Message): Date | undefined => {
|
|
217
184
|
if (started) {
|
|
218
185
|
return started;
|
|
219
186
|
}
|
|
220
187
|
|
|
221
|
-
if (message?.blocks[0]?.
|
|
188
|
+
if (message?.blocks[0]?._tag === 'transcript' && message.blocks[0].started) {
|
|
222
189
|
return new Date(message.blocks[0].started);
|
|
223
190
|
}
|
|
224
191
|
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Feed, Obj } from '@dxos/echo';
|
|
9
|
+
import { useMembers, useQueue } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { Transcription } from '#components';
|
|
14
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
15
|
+
|
|
16
|
+
import { renderByline } from '../../util';
|
|
17
|
+
|
|
18
|
+
export type TranscriptionContainerProps = AppSurface.ObjectArticleProps<Transcript.Transcript>;
|
|
19
|
+
|
|
20
|
+
export const TranscriptionContainer = ({ role, subject: transcript, attendableId }: TranscriptionContainerProps) => {
|
|
21
|
+
const db = Obj.getDatabase(transcript);
|
|
22
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
23
|
+
const feed = transcript.feed.target;
|
|
24
|
+
const queueDxn = feed ? Feed.getQueueDxn(feed) : undefined;
|
|
25
|
+
const queue = useQueue<Message.Message>(queueDxn, { pollInterval: 1_000 });
|
|
26
|
+
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Panel.Root role={role}>
|
|
30
|
+
<Panel.Content asChild>
|
|
31
|
+
<Transcription attendableId={attendableId} model={model} transcript={transcript} />
|
|
32
|
+
</Panel.Content>
|
|
33
|
+
</Panel.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|