@crewlethq/ui 0.190.2 → 0.191.0
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 +9 -1
- package/dist/AgentHandoffPanel/index.js +11 -7
- package/dist/AgentIdentity/index.js +8 -7
- package/dist/Announcer/index.js +2 -1
- package/dist/AppShell/index.js +4 -3
- package/dist/ArrangeFrame/index.js +3 -2
- package/dist/ArrangeList/index.js +7 -6
- package/dist/ArtifactBar/index.js +6 -5
- package/dist/ArtifactCard/index.js +6 -5
- package/dist/AvatarPicker/index.js +6 -6
- package/dist/Canvas/index.js +3 -2
- package/dist/CanvasBoard/index.js +5 -4
- package/dist/CanvasToolbar/index.js +4 -3
- package/dist/CharacterCount/index.js +3 -2
- package/dist/CheckGrid/index.js +6 -5
- package/dist/Checkbox/index.js +5 -4
- package/dist/ChipField/index.js +3 -2
- package/dist/ColorField/index.js +5 -4
- package/dist/Combobox/index.js +5 -4
- package/dist/CommandPalette/index.js +11 -9
- package/dist/CommentThread/index.js +12 -8
- package/dist/Composer/Composer.d.ts +7 -0
- package/dist/Composer/index.d.ts +1 -0
- package/dist/Composer/index.js +12 -6
- package/dist/{Composer-YO275MFX.css → Composer-YCD6UPMO.css} +3 -2
- package/dist/ConfirmField/index.js +5 -4
- package/dist/ConsequenceList/index.js +6 -5
- package/dist/DataGrid/index.js +8 -7
- package/dist/DataTable/index.js +9 -8
- package/dist/DataView/index.js +13 -11
- package/dist/DatasetSource/index.js +2 -2
- package/dist/Dictation/fake.d.ts +59 -0
- package/dist/Dictation/index.d.ts +8 -0
- package/dist/Dictation/index.js +17 -0
- package/dist/Dictation/labels.d.ts +4 -0
- package/dist/Dictation/machine.d.ts +126 -0
- package/dist/Dictation/microphone.d.ts +5 -0
- package/dist/Dictation/session.d.ts +31 -0
- package/dist/Dictation/slot.d.ts +69 -0
- package/dist/Dictation/types.d.ts +158 -0
- package/dist/Dictation/webSpeech.d.ts +13 -0
- package/dist/Dictation/webSpeechLocal.d.ts +9 -0
- package/dist/Dictation-MGLRANB4.css +141 -0
- package/dist/DocTabsEditor/index.js +6 -5
- package/dist/DurationField/index.js +10 -9
- package/dist/{Editor-FZOUNP6V.js → Editor-ZQUOI3WV.js} +5 -4
- package/dist/EmojiPicker/index.js +5 -4
- package/dist/GraphCanvas/index.js +4 -3
- package/dist/HuePicker/index.js +4 -4
- package/dist/InboxList/index.js +1 -1
- package/dist/InlineEditor/index.js +3 -2
- package/dist/Input/index.js +4 -3
- package/dist/Kbd/index.js +2 -1
- package/dist/KeyValueRows/index.js +5 -4
- package/dist/LinkInterstitial/index.js +8 -7
- package/dist/ListInput/index.js +8 -6
- package/dist/MarkdownEditor/index.js +4 -4
- package/dist/MemberPicker/index.js +6 -5
- package/dist/MergeConflicts/index.js +4 -4
- package/dist/MessageActions/index.js +6 -5
- package/dist/Modal/index.js +7 -6
- package/dist/MoneyField/index.js +5 -4
- package/dist/NewItemsNotice/index.js +3 -2
- package/dist/NumberField/index.js +9 -8
- package/dist/OrgTable/index.js +10 -9
- package/dist/PresenterView/index.js +2 -2
- package/dist/PresetChips/index.js +4 -4
- package/dist/PrincipalPicker/index.js +7 -6
- package/dist/ProposalCard/index.js +9 -8
- package/dist/RailList/index.js +2 -2
- package/dist/ReactionBar/index.js +6 -5
- package/dist/Reorder/index.js +3 -2
- package/dist/RichEditor/index.js +1 -1
- package/dist/ScopeList/index.js +6 -5
- package/dist/SegmentedControl/index.js +3 -3
- package/dist/SelectionBar/index.js +3 -2
- package/dist/SendKeys/index.js +3 -2
- package/dist/SettingForm/index.js +5 -4
- package/dist/SetupWizard/index.js +3 -3
- package/dist/ShareDialog/index.js +11 -10
- package/dist/SheetColumnEditor/index.js +12 -10
- package/dist/SheetGrid/index.js +5 -4
- package/dist/SlideFilmstrip/index.js +6 -4
- package/dist/Switcher/index.js +10 -9
- package/dist/Tabs/index.js +2 -2
- package/dist/TagGroup/index.js +3 -2
- package/dist/TagsInput/index.js +3 -2
- package/dist/ThemeSwitcher/index.js +4 -4
- package/dist/TimeRangePicker/index.js +12 -11
- package/dist/TimeWindowPicker/index.js +5 -4
- package/dist/ToolCallLog/index.js +2 -2
- package/dist/TreeCanvas/index.js +4 -3
- package/dist/TreeGrid/index.js +9 -8
- package/dist/ValueField/index.js +6 -5
- package/dist/VersionCompare/index.js +5 -5
- package/dist/VersionTimeline/index.js +1 -1
- package/dist/{chunk-VBBLHS2Y.js → chunk-25LIX6UI.js} +0 -1
- package/dist/{chunk-XKC7EJGR.js → chunk-2DFB7NHX.js} +39 -13
- package/dist/{chunk-YHLLBQJA.js → chunk-2EALNWKD.js} +1 -1
- package/dist/{chunk-TDRWUWGV.js → chunk-2SSTJDRV.js} +1 -1
- package/dist/{chunk-ZLHVKPAQ.js → chunk-4ODGBPYT.js} +2 -2
- package/dist/{chunk-EK5NJV6K.js → chunk-4P24HLY3.js} +2 -2
- package/dist/{chunk-ERNIXJMN.js → chunk-4RQTYNJB.js} +1 -1
- package/dist/{chunk-BE5NESX4.js → chunk-4X33B7RC.js} +1 -1
- package/dist/{chunk-LR56IYSL.js → chunk-5V52XBVL.js} +2 -2
- package/dist/{chunk-CUQN6WSD.js → chunk-6AU73W3Y.js} +2 -2
- package/dist/{chunk-S6ES6MMW.js → chunk-6EJS374X.js} +2 -2
- package/dist/{chunk-C4BENQB3.js → chunk-A24SEWF7.js} +2 -2
- package/dist/{chunk-5F62NQON.js → chunk-A4XJHBMM.js} +1 -1
- package/dist/{chunk-2XC4MYBB.js → chunk-AWBLC4KR.js} +1 -1
- package/dist/{chunk-OAWECVU2.js → chunk-B4TAERAM.js} +1 -1
- package/dist/{chunk-TEXK4RK6.js → chunk-BGVJBX7E.js} +1 -1
- package/dist/{chunk-HWJVQFXQ.js → chunk-BNI2532M.js} +3 -3
- package/dist/chunk-CB6MUWCA.js +206 -0
- package/dist/chunk-CI4HUVNI.js +197 -0
- package/dist/{chunk-FOJ3TVKJ.js → chunk-DON7AM43.js} +1 -1
- package/dist/{chunk-WLYNWP34.js → chunk-DZSDUUH6.js} +1 -1
- package/dist/{chunk-WASYD3IL.js → chunk-E266WLN7.js} +1 -1
- package/dist/{chunk-DDVUPYJW.js → chunk-EDHRJQZT.js} +1 -1
- package/dist/{chunk-2OYEVTF4.js → chunk-ESP65SIP.js} +2 -2
- package/dist/{chunk-H77NQVS7.js → chunk-ETWGKTMC.js} +1 -1
- package/dist/{chunk-237WBIAN.js → chunk-EZO5MYII.js} +1 -1
- package/dist/{chunk-SQPT4UZ4.js → chunk-GEFO45DZ.js} +1 -1
- package/dist/{chunk-2SGJAD7O.js → chunk-HC5Y4ZVY.js} +1 -1
- package/dist/{chunk-WLYAGMZA.js → chunk-HI3AFP34.js} +1 -1
- package/dist/{chunk-IF5RMDDV.js → chunk-HQTBYW7G.js} +4 -4
- package/dist/{chunk-U7AHXPYA.js → chunk-HWFUKEVT.js} +4 -4
- package/dist/{chunk-HUZ27VZ7.js → chunk-IFL6DM5K.js} +1 -1
- package/dist/chunk-JNTOZ5LE.js +49 -0
- package/dist/{chunk-NJBKJF3Q.js → chunk-JXVDEPBK.js} +3 -3
- package/dist/{chunk-YUVQUJND.js → chunk-K657TVMA.js} +1 -1
- package/dist/{chunk-NCQC5Y4E.js → chunk-LIOO7OMN.js} +1 -1
- package/dist/{chunk-R72QM6WV.js → chunk-LJSW7NWJ.js} +1 -1
- package/dist/{chunk-BD2HPIZ2.js → chunk-LN7IMSCU.js} +1 -1
- package/dist/{chunk-QR4LRVWK.js → chunk-MI6QDL4N.js} +2 -2
- package/dist/{chunk-KIPEB2UV.js → chunk-MKOWEHDH.js} +1 -1
- package/dist/{chunk-U2TENSNB.js → chunk-MZAMX65M.js} +1 -1
- package/dist/chunk-MZP5A3NQ.js +1 -0
- package/dist/{chunk-IAOROOL6.js → chunk-N6LUM6AG.js} +4 -4
- package/dist/{chunk-MSKRVYGH.js → chunk-N72QMEEA.js} +1 -1
- package/dist/{chunk-Y5GBXHA6.js → chunk-NB5HDW7O.js} +2 -2
- package/dist/{chunk-NIII72XP.js → chunk-NCXSYDWQ.js} +2 -2
- package/dist/{chunk-ZR276S44.js → chunk-NLYURJUF.js} +2 -2
- package/dist/{chunk-R5UTN5QB.js → chunk-NPKNO4RL.js} +3 -3
- package/dist/chunk-NQ7LG6BU.js +1 -0
- package/dist/{chunk-VNEUVMUR.js → chunk-NXTELLHC.js} +3 -3
- package/dist/{chunk-YSYORPVE.js → chunk-OOKLFQMR.js} +2 -2
- package/dist/{chunk-J6QNUNZD.js → chunk-ORX3PYX3.js} +1 -1
- package/dist/{chunk-QVSG3XSW.js → chunk-QGZPXZHE.js} +2 -2
- package/dist/{chunk-2FWNVZSX.js → chunk-QJEC2XZH.js} +2 -2
- package/dist/{chunk-4RVDOEJR.js → chunk-RTLBWYVV.js} +2 -2
- package/dist/{chunk-7UYWPNFG.js → chunk-RZEUVQJ7.js} +1 -1
- package/dist/{chunk-FTOKCN4I.js → chunk-SFBIOHM3.js} +2 -2
- package/dist/{chunk-2KQGMYAQ.js → chunk-SHU6ZR7Z.js} +1 -1
- package/dist/{chunk-PDQPSTK2.js → chunk-SW7BVEOI.js} +1 -1
- package/dist/{chunk-H7V4QAOV.js → chunk-SXCUNON2.js} +1 -1
- package/dist/{chunk-ZDENBTBY.js → chunk-SXUKSA6U.js} +1 -1
- package/dist/{chunk-G5UBUODG.js → chunk-T2DGBIFD.js} +1 -1
- package/dist/{chunk-MFJYXWN5.js → chunk-UN5BTYDI.js} +5 -5
- package/dist/{chunk-ZQTEBONP.js → chunk-VNCKUYYT.js} +1 -1
- package/dist/{chunk-TN5RHSI5.js → chunk-WM2CPCBH.js} +1 -1
- package/dist/{chunk-SETK4FN5.js → chunk-WXMSQOBV.js} +1 -1
- package/dist/{chunk-MFRXKQAF.js → chunk-XHQ6BRGS.js} +1 -1
- package/dist/{chunk-RYS3SN7J.js → chunk-XTT2XWVQ.js} +1 -1
- package/dist/{chunk-ZCKC7ENV.js → chunk-Y22OHIVL.js} +2 -2
- package/dist/{chunk-2DESFB7K.js → chunk-YER6BEBM.js} +1 -1
- package/dist/{chunk-M4XBRBZL.js → chunk-YNPIGUJF.js} +1 -1
- package/dist/{chunk-KQTWO46B.js → chunk-YOGPQDXA.js} +1 -1
- package/dist/{chunk-4TLKCRE4.js → chunk-YW3IH3EU.js} +1 -1
- package/dist/{chunk-EPVQ4OZ3.js → chunk-YXRMGI4B.js} +1 -1
- package/dist/{chunk-NHQ3CXFN.js → chunk-ZUTLS4HX.js} +2 -2
- package/dist/generated/index.d.ts +1 -0
- package/dist/generated/index.js +120 -115
- package/dist/index.js +120 -115
- package/dist/session-XDRRVFVE.js +789 -0
- package/dist/styles.css +148 -3
- package/dist/webSpeech-CJNDQU3D.js +165 -0
- package/package.json +3 -3
- package/dist/{chunk-UIRMNARM.js → chunk-7RFF2FUG.js} +1 -1
- package/dist/{chunk-WGMKERCR.js → chunk-AZQBGKPR.js} +0 -0
- package/dist/{chunk-DKE2QLXX.js → chunk-EHEM4QDV.js} +1 -1
- package/dist/{chunk-LE7SVMCB.js → chunk-JJEGPEV7.js} +0 -0
- package/dist/{chunk-MENY4GKL.js → chunk-N2I2WGZN.js} +1 -1
- package/dist/{chunk-Y4A7AYX4.js → chunk-XSJNLTA6.js} +1 -1
package/dist/styles.css
CHANGED
|
@@ -15578,7 +15578,7 @@ button.crewlet-histogram__bar[data-empty]:focus-visible > .crewlet-histogram__fi
|
|
|
15578
15578
|
}
|
|
15579
15579
|
|
|
15580
15580
|
|
|
15581
|
-
/* Composer-
|
|
15581
|
+
/* Composer-YCD6UPMO.css */
|
|
15582
15582
|
/*
|
|
15583
15583
|
* A message written in place: the field and its footer strip in one box. The
|
|
15584
15584
|
* BOX takes the focus ring every field in the package draws (see Input.css):
|
|
@@ -15807,9 +15807,10 @@ button.crewlet-histogram__bar[data-empty]:focus-visible > .crewlet-histogram__fi
|
|
|
15807
15807
|
flex: 1;
|
|
15808
15808
|
}
|
|
15809
15809
|
|
|
15810
|
-
/* On a phone the hint goes, and a footer that held only the hint goes with it.
|
|
15810
|
+
/* On a phone the hint goes, and a footer that held only the hint goes with it.
|
|
15811
|
+
On two classes, so SendKeys' own display cannot win on sheet order. */
|
|
15811
15812
|
@media (width < 640px) {
|
|
15812
|
-
.crewlet-composer__hint,
|
|
15813
|
+
.crewlet-composer .crewlet-composer__hint,
|
|
15813
15814
|
.crewlet-composer__footer[data-hint-only] {
|
|
15814
15815
|
display: none;
|
|
15815
15816
|
}
|
|
@@ -21176,6 +21177,150 @@ svg.crewlet-datetime__chevron {
|
|
|
21176
21177
|
}
|
|
21177
21178
|
|
|
21178
21179
|
|
|
21180
|
+
/* Dictation-MGLRANB4.css */
|
|
21181
|
+
/* Dictation in a composer: the mic and its chevron before the send slot. */
|
|
21182
|
+
.crewlet-dictation {
|
|
21183
|
+
display: inline-flex;
|
|
21184
|
+
align-items: center;
|
|
21185
|
+
}
|
|
21186
|
+
|
|
21187
|
+
/* The chevron is a narrow companion to the mic, not a second tool. */
|
|
21188
|
+
.crewlet-dictation .crewlet-dictation__more {
|
|
21189
|
+
width: calc(var(--size-control-sm) * 0.6);
|
|
21190
|
+
color: var(--color-text-tertiary);
|
|
21191
|
+
}
|
|
21192
|
+
|
|
21193
|
+
/* Waiting on the browser's permission prompt: an accent ring, not the danger red. */
|
|
21194
|
+
.crewlet-dictation__mic.is-pending {
|
|
21195
|
+
box-shadow: 0 0 0 2px var(--color-brand-accent);
|
|
21196
|
+
animation: crewlet-dictation-wait var(--motion-duration-slow) var(--motion-easing-default) infinite alternate;
|
|
21197
|
+
}
|
|
21198
|
+
|
|
21199
|
+
@keyframes crewlet-dictation-wait {
|
|
21200
|
+
to {
|
|
21201
|
+
box-shadow: 0 0 0 2px var(--color-brand-accent-soft);
|
|
21202
|
+
}
|
|
21203
|
+
}
|
|
21204
|
+
|
|
21205
|
+
/* While dictating, the field's own text hides under the layer that draws the provisional words. */
|
|
21206
|
+
.crewlet-composer.is-dictating .crewlet-composer__row {
|
|
21207
|
+
position: relative;
|
|
21208
|
+
}
|
|
21209
|
+
|
|
21210
|
+
.crewlet-composer.is-dictating .crewlet-composer__field {
|
|
21211
|
+
color: transparent;
|
|
21212
|
+
caret-color: transparent;
|
|
21213
|
+
}
|
|
21214
|
+
|
|
21215
|
+
.crewlet-composer.is-dictating .crewlet-composer__field::selection {
|
|
21216
|
+
background: transparent;
|
|
21217
|
+
}
|
|
21218
|
+
|
|
21219
|
+
.crewlet-dictation__layer {
|
|
21220
|
+
position: absolute;
|
|
21221
|
+
overflow: hidden;
|
|
21222
|
+
white-space: pre-wrap;
|
|
21223
|
+
overflow-wrap: break-word;
|
|
21224
|
+
color: var(--color-text-primary);
|
|
21225
|
+
pointer-events: none;
|
|
21226
|
+
}
|
|
21227
|
+
|
|
21228
|
+
.crewlet-dictation__provisional {
|
|
21229
|
+
color: var(--color-text-tertiary);
|
|
21230
|
+
font-style: italic;
|
|
21231
|
+
}
|
|
21232
|
+
|
|
21233
|
+
/* The live level: a row of dots that rise with the voice, in the accent. */
|
|
21234
|
+
.crewlet-dictation__wave {
|
|
21235
|
+
display: inline-flex;
|
|
21236
|
+
align-items: center;
|
|
21237
|
+
gap: 2px;
|
|
21238
|
+
height: var(--font-size-md);
|
|
21239
|
+
padding-inline: var(--spacing-1);
|
|
21240
|
+
color: var(--color-brand-accent);
|
|
21241
|
+
}
|
|
21242
|
+
|
|
21243
|
+
.crewlet-dictation__bar {
|
|
21244
|
+
width: 2px;
|
|
21245
|
+
height: 100%;
|
|
21246
|
+
border-radius: var(--radius-pill);
|
|
21247
|
+
background: currentColor;
|
|
21248
|
+
transform: scaleY(0.15);
|
|
21249
|
+
}
|
|
21250
|
+
|
|
21251
|
+
/* Beside an inline field the level keeps only its newest bars, so the row barely grows. */
|
|
21252
|
+
.crewlet-composer--inline .crewlet-dictation__bar:nth-child(-n + 10) {
|
|
21253
|
+
display: none;
|
|
21254
|
+
}
|
|
21255
|
+
|
|
21256
|
+
.crewlet-dictation__note {
|
|
21257
|
+
padding: 0 var(--spacing-3) var(--spacing-1);
|
|
21258
|
+
font-size: var(--font-size-xs);
|
|
21259
|
+
color: var(--color-text-secondary);
|
|
21260
|
+
}
|
|
21261
|
+
|
|
21262
|
+
/* The microphone menu's head: the level of the chosen device, or why there is none. */
|
|
21263
|
+
.crewlet-dictation__head {
|
|
21264
|
+
display: grid;
|
|
21265
|
+
gap: var(--spacing-1);
|
|
21266
|
+
max-width: 280px;
|
|
21267
|
+
}
|
|
21268
|
+
|
|
21269
|
+
.crewlet-dictation__meter {
|
|
21270
|
+
display: flex;
|
|
21271
|
+
align-items: center;
|
|
21272
|
+
gap: var(--spacing-2);
|
|
21273
|
+
min-width: 200px;
|
|
21274
|
+
color: var(--color-text-tertiary);
|
|
21275
|
+
}
|
|
21276
|
+
|
|
21277
|
+
.crewlet-dictation__track {
|
|
21278
|
+
flex: 1;
|
|
21279
|
+
height: var(--spacing-1);
|
|
21280
|
+
overflow: hidden;
|
|
21281
|
+
border-radius: var(--radius-pill);
|
|
21282
|
+
background: var(--color-surface-inset);
|
|
21283
|
+
}
|
|
21284
|
+
|
|
21285
|
+
.crewlet-dictation__fill {
|
|
21286
|
+
display: block;
|
|
21287
|
+
height: 100%;
|
|
21288
|
+
background: var(--color-brand-accent);
|
|
21289
|
+
transform: scaleX(0);
|
|
21290
|
+
transform-origin: left;
|
|
21291
|
+
}
|
|
21292
|
+
|
|
21293
|
+
.crewlet-dictation__help {
|
|
21294
|
+
margin: 0;
|
|
21295
|
+
font-size: var(--font-size-xs);
|
|
21296
|
+
color: var(--color-text-secondary);
|
|
21297
|
+
}
|
|
21298
|
+
|
|
21299
|
+
/* On a phone the chevron folds into the mic (hold it, or Down arrow), and each target is 44px. */
|
|
21300
|
+
@media (width < 640px) {
|
|
21301
|
+
.crewlet-dictation .crewlet-dictation__more {
|
|
21302
|
+
display: none;
|
|
21303
|
+
}
|
|
21304
|
+
|
|
21305
|
+
.crewlet-composer :is(.crewlet-dictation__mic, .crewlet-dictation__cancel, .crewlet-dictation__accept) {
|
|
21306
|
+
position: relative;
|
|
21307
|
+
margin-inline: var(--spacing-1);
|
|
21308
|
+
}
|
|
21309
|
+
|
|
21310
|
+
.crewlet-composer :is(.crewlet-dictation__mic, .crewlet-dictation__cancel, .crewlet-dictation__accept)::after {
|
|
21311
|
+
content: '';
|
|
21312
|
+
position: absolute;
|
|
21313
|
+
inset: calc((100% - 44px) / 2);
|
|
21314
|
+
}
|
|
21315
|
+
}
|
|
21316
|
+
|
|
21317
|
+
@media (prefers-reduced-motion: reduce) {
|
|
21318
|
+
.crewlet-dictation__mic.is-pending {
|
|
21319
|
+
animation: none;
|
|
21320
|
+
}
|
|
21321
|
+
}
|
|
21322
|
+
|
|
21323
|
+
|
|
21179
21324
|
/* DiffList-57M6YCNS.css */
|
|
21180
21325
|
/* DiffList: one path per row, with its mark, its word and its tint.
|
|
21181
21326
|
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// src/Dictation/webSpeech.ts
|
|
2
|
+
var RESTARTS = 5;
|
|
3
|
+
var RESTART_WINDOW_MS = 4e3;
|
|
4
|
+
var INSTALL_MS = 6e4;
|
|
5
|
+
var UNAVAILABLE = /* @__PURE__ */ new Set(["language-not-supported", "service-not-allowed", "not-allowed", "network"]);
|
|
6
|
+
var QUIET = /* @__PURE__ */ new Set(["no-speech", "aborted", "phrases-not-supported"]);
|
|
7
|
+
function recognitionClass() {
|
|
8
|
+
if (typeof window === "undefined") return void 0;
|
|
9
|
+
const w = window;
|
|
10
|
+
const found = w.SpeechRecognition ?? w.webkitSpeechRecognition;
|
|
11
|
+
return found && typeof found.available === "function" && "processLocally" in found.prototype ? found : void 0;
|
|
12
|
+
}
|
|
13
|
+
function createWebSpeechLocal(options = {}) {
|
|
14
|
+
const lang = options.lang ?? (typeof navigator === "undefined" ? "en-US" : navigator.language || "en-US");
|
|
15
|
+
const local = { langs: [lang], processLocally: true };
|
|
16
|
+
let recognition = null;
|
|
17
|
+
let events = null;
|
|
18
|
+
let track;
|
|
19
|
+
let started = false;
|
|
20
|
+
let stopping = false;
|
|
21
|
+
let switching = false;
|
|
22
|
+
let done = true;
|
|
23
|
+
let settled = null;
|
|
24
|
+
let restarts = [];
|
|
25
|
+
let finished = 0;
|
|
26
|
+
let interim = "";
|
|
27
|
+
const fail = (code) => {
|
|
28
|
+
if (done) return;
|
|
29
|
+
done = true;
|
|
30
|
+
const out = events;
|
|
31
|
+
events = null;
|
|
32
|
+
recognition?.abort();
|
|
33
|
+
out?.error(code);
|
|
34
|
+
};
|
|
35
|
+
const run = () => {
|
|
36
|
+
finished = 0;
|
|
37
|
+
interim = "";
|
|
38
|
+
try {
|
|
39
|
+
if (track && track.readyState !== "ended") recognition.start(track);
|
|
40
|
+
else recognition.start();
|
|
41
|
+
} catch {
|
|
42
|
+
fail("dropped");
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const keepInterim = () => {
|
|
46
|
+
if (interim) events?.final(interim);
|
|
47
|
+
interim = "";
|
|
48
|
+
};
|
|
49
|
+
const wire = (r) => {
|
|
50
|
+
r.onstart = () => {
|
|
51
|
+
if (started) return;
|
|
52
|
+
started = true;
|
|
53
|
+
events?.ready?.();
|
|
54
|
+
};
|
|
55
|
+
r.onresult = (event) => {
|
|
56
|
+
if (done) return;
|
|
57
|
+
const { results } = event;
|
|
58
|
+
while (finished < results.length && results[finished].isFinal) {
|
|
59
|
+
const text = results[finished][0]?.transcript.trim();
|
|
60
|
+
finished += 1;
|
|
61
|
+
if (text) events?.final(text);
|
|
62
|
+
}
|
|
63
|
+
const words = [];
|
|
64
|
+
for (let i = finished; i < results.length; i++) {
|
|
65
|
+
const text = results[i][0]?.transcript.trim();
|
|
66
|
+
if (text) words.push(text);
|
|
67
|
+
}
|
|
68
|
+
interim = words.join(" ");
|
|
69
|
+
events?.partial(interim);
|
|
70
|
+
};
|
|
71
|
+
r.onerror = ({ error }) => {
|
|
72
|
+
if (QUIET.has(error)) return;
|
|
73
|
+
fail(UNAVAILABLE.has(error) ? "unavailable" : "dropped");
|
|
74
|
+
};
|
|
75
|
+
r.onend = () => {
|
|
76
|
+
if (done && !stopping) return;
|
|
77
|
+
keepInterim();
|
|
78
|
+
if (stopping) {
|
|
79
|
+
done = true;
|
|
80
|
+
settled?.();
|
|
81
|
+
settled = null;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (switching) switching = false;
|
|
85
|
+
else {
|
|
86
|
+
const now = Date.now();
|
|
87
|
+
restarts = [...restarts.filter((at) => now - at < RESTART_WINDOW_MS), now];
|
|
88
|
+
if (restarts.length > RESTARTS) return fail("dropped");
|
|
89
|
+
}
|
|
90
|
+
run();
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
get picksDevice() {
|
|
95
|
+
return track === void 0;
|
|
96
|
+
},
|
|
97
|
+
async available() {
|
|
98
|
+
const Recognizer = recognitionClass();
|
|
99
|
+
if (!Recognizer) return false;
|
|
100
|
+
try {
|
|
101
|
+
return await Recognizer.available(local) !== "unavailable";
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
async start(_deviceId, next, stream) {
|
|
107
|
+
events = next;
|
|
108
|
+
track = stream?.getAudioTracks()[0];
|
|
109
|
+
done = false;
|
|
110
|
+
started = false;
|
|
111
|
+
stopping = false;
|
|
112
|
+
switching = false;
|
|
113
|
+
restarts = [];
|
|
114
|
+
const Recognizer = recognitionClass();
|
|
115
|
+
if (!Recognizer) return fail("unavailable");
|
|
116
|
+
const state = await Recognizer.available(local).catch(() => "unavailable");
|
|
117
|
+
if (done) return;
|
|
118
|
+
if (state === "unavailable") return fail("unavailable");
|
|
119
|
+
if (state !== "available") {
|
|
120
|
+
next.preparing?.();
|
|
121
|
+
let timer;
|
|
122
|
+
const installed = await Promise.race([
|
|
123
|
+
Promise.resolve().then(() => Recognizer.install?.(local)).then((ok) => ok === true, () => false),
|
|
124
|
+
new Promise((resolve) => {
|
|
125
|
+
timer = setTimeout(() => resolve(false), INSTALL_MS);
|
|
126
|
+
})
|
|
127
|
+
]);
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
if (done) return;
|
|
130
|
+
if (!installed) return fail("unavailable");
|
|
131
|
+
}
|
|
132
|
+
const r = new Recognizer();
|
|
133
|
+
r.lang = lang;
|
|
134
|
+
r.processLocally = true;
|
|
135
|
+
r.continuous = true;
|
|
136
|
+
r.interimResults = true;
|
|
137
|
+
if ("unspokenPunctuation" in r) r.unspokenPunctuation = true;
|
|
138
|
+
if (r.processLocally !== true) return fail("unavailable");
|
|
139
|
+
recognition = r;
|
|
140
|
+
wire(r);
|
|
141
|
+
run();
|
|
142
|
+
},
|
|
143
|
+
switchStream(stream) {
|
|
144
|
+
track = stream?.getAudioTracks()[0];
|
|
145
|
+
if (!recognition || done) return;
|
|
146
|
+
switching = true;
|
|
147
|
+
recognition.stop();
|
|
148
|
+
},
|
|
149
|
+
flush() {
|
|
150
|
+
if (!recognition || done) return Promise.resolve();
|
|
151
|
+
stopping = true;
|
|
152
|
+
return new Promise((resolve) => {
|
|
153
|
+
settled = resolve;
|
|
154
|
+
recognition.stop();
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
cancel() {
|
|
158
|
+
done = true;
|
|
159
|
+
events = null;
|
|
160
|
+
recognition?.abort();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { INSTALL_MS, createWebSpeechLocal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewlethq/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.191.0",
|
|
4
4
|
"description": "Crewlet shared React components built on @crewlethq/tokens and @crewlethq/icons.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"clean": "rm -rf dist src/generated"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@crewlethq/icons": "0.
|
|
47
|
-
"@crewlethq/tokens": "0.
|
|
46
|
+
"@crewlethq/icons": "0.191.0",
|
|
47
|
+
"@crewlethq/tokens": "0.191.0",
|
|
48
48
|
"prosemirror-commands": "1.7.2",
|
|
49
49
|
"prosemirror-gapcursor": "1.4.1",
|
|
50
50
|
"prosemirror-history": "1.5.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RelativeTime } from './chunk-5ZL3PXEL.js';
|
|
2
|
-
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
3
2
|
import { Tag } from './chunk-ASBBB5AJ.js';
|
|
3
|
+
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
4
4
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
6
|
import './HitArea-QUOS6ZDJ.css';
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SlideStage, SLIDE_WIDTH, SLIDE_HEIGHT } from './chunk-7O53SWKI.js';
|
|
2
1
|
import { SlideNav } from './chunk-QGLNLBRN.js';
|
|
2
|
+
import { SlideStage, SLIDE_WIDTH, SLIDE_HEIGHT } from './chunk-7O53SWKI.js';
|
|
3
3
|
import { Eyebrow } from './chunk-RK4XPHVG.js';
|
|
4
4
|
import { Button } from './chunk-YVMIT2OW.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageHeader } from './chunk-FPDIHEM4.js';
|
|
2
|
-
import { useMediaMatch } from './chunk-COS6LJ4K.js';
|
|
3
2
|
import { Stepper } from './chunk-2MN3RNRM.js';
|
|
3
|
+
import { useMediaMatch } from './chunk-COS6LJ4K.js';
|
|
4
4
|
import { Disclosure } from './chunk-RUROK3EU.js';
|
|
5
5
|
import { useHeadingLevel, nextHeadingLevel, headingTag, HeadingLevelProvider } from './chunk-PQADV6P6.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRoving, tabStop, revealInRow } from './chunk-7F3OPUM5.js';
|
|
2
|
+
import { StatusDot } from './chunk-QRE6JCHS.js';
|
|
2
3
|
import { Menu } from './chunk-43N4EHFR.js';
|
|
3
4
|
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
4
|
-
import { StatusDot } from './chunk-QRE6JCHS.js';
|
|
5
5
|
import { Count } from './chunk-6YKTRAWI.js';
|
|
6
6
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
7
7
|
import { cx } from './chunk-ODEQTPFM.js';
|