@cloudflare/realtimekit-ui 2.0.2 → 2.0.3-staging.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/dist/browser.js +1 -1
- package/dist/cjs/rtk-transcript.cjs.entry.js +4 -1
- package/dist/cjs/rtk-transcripts.cjs.entry.js +59 -28
- package/dist/collection/components/rtk-transcript/rtk-transcript.js +4 -1
- package/dist/collection/components/rtk-transcripts/rtk-transcripts.js +59 -28
- package/dist/components/p-DnGHVpK1.js +1 -0
- package/dist/components/rtk-transcript.js +1 -1
- package/dist/components/rtk-transcripts.js +1 -1
- package/dist/docs/docs-components.json +1 -1
- package/dist/esm/loader.js +63 -29
- package/dist/esm/rtk-transcript.entry.js +4 -1
- package/dist/esm/rtk-transcripts.entry.js +59 -28
- package/dist/realtimekit-ui/p-b1da05d3.entry.js +1 -0
- package/dist/realtimekit-ui/p-ec9d4173.entry.js +1 -0
- package/dist/realtimekit-ui/realtimekit-ui.esm.js +1 -1
- package/dist/types/components/rtk-transcript/rtk-transcript.d.ts +1 -0
- package/dist/types/components/rtk-transcripts/rtk-transcripts.d.ts +14 -0
- package/package.json +2 -3
- package/dist/components/p-Dr2k6gxY.js +0 -1
- package/dist/realtimekit-ui/p-6454c955.entry.js +0 -1
- package/dist/realtimekit-ui/p-8b08fbc0.entry.js +0 -1
|
@@ -26,6 +26,9 @@ const RtkTranscript = class {
|
|
|
26
26
|
connectedCallback() {
|
|
27
27
|
this.transcriptChanged(this.transcript);
|
|
28
28
|
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
clearTimeout(this.timeout);
|
|
31
|
+
}
|
|
29
32
|
transcriptChanged(transcript, oldTranscript) {
|
|
30
33
|
if ((oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.renderedId) === transcript.renderedId &&
|
|
31
34
|
(oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.transcript) === transcript.transcript) {
|
|
@@ -41,7 +44,7 @@ const RtkTranscript = class {
|
|
|
41
44
|
}, 10000);
|
|
42
45
|
}
|
|
43
46
|
render() {
|
|
44
|
-
return (index$1.h(index$1.Host, { key: '
|
|
47
|
+
return (index$1.h(index$1.Host, { key: 'c9f584259f21f759133ea5d6f4e07bac1524b5fb' }, index$1.h("div", { key: 'd25914df1db61994cfe8a5f0fc42af79c2823ece', class: "ctr" }, index$1.h("p", { key: '06fefba0bca0a253a9140a9f2a86c2230b83f049', class: "message" }, index$1.h("span", { key: '5f833c6901ab4f246e06d8a82c47a3d49616e44c', class: "name" }, this.transcript.name), ": ", this.transcript.transcript))));
|
|
45
48
|
}
|
|
46
49
|
static get watchers() { return {
|
|
47
50
|
"transcript": [{
|
|
@@ -19,6 +19,8 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
19
19
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
20
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
21
|
};
|
|
22
|
+
/** Maximum character length of a single rendered caption group. */
|
|
23
|
+
const MAX_GROUP_LENGTH = 400;
|
|
22
24
|
const RtkTranscripts = class {
|
|
23
25
|
constructor(hostRef) {
|
|
24
26
|
index$1.registerInstance(this, hostRef);
|
|
@@ -90,9 +92,50 @@ const RtkTranscripts = class {
|
|
|
90
92
|
return acc.concat(t);
|
|
91
93
|
}
|
|
92
94
|
add(transcript) {
|
|
93
|
-
// show transcripts only if tab is in focus and a maximum of 3 at a time
|
|
94
|
-
// this.transcripts.splice(0, this.transcripts.length - 2);
|
|
95
95
|
this.transcripts = this.transcriptionsReducer(this.transcripts, transcript);
|
|
96
|
+
this.pruneToLatestTwoGroups();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Groups raw transcript entries using the same merging rules as the renderer:
|
|
100
|
+
* consecutive entries from the same peer are combined with a separator space
|
|
101
|
+
* until the accumulated text exceeds MAX_GROUP_LENGTH, at which point a new
|
|
102
|
+
* group begins. Assigns renderedId on each entry as a side effect so that
|
|
103
|
+
* pruning and rendering stay in sync.
|
|
104
|
+
*/
|
|
105
|
+
buildGroups() {
|
|
106
|
+
const groups = [];
|
|
107
|
+
this.transcripts.forEach((transcript) => {
|
|
108
|
+
const last = groups[groups.length - 1];
|
|
109
|
+
if (!last ||
|
|
110
|
+
last.peerId !== transcript.peerId ||
|
|
111
|
+
last.combinedText.length + transcript.transcript.length > MAX_GROUP_LENGTH) {
|
|
112
|
+
groups.push({
|
|
113
|
+
renderedId: transcript.id,
|
|
114
|
+
peerId: transcript.peerId,
|
|
115
|
+
combinedText: transcript.transcript,
|
|
116
|
+
entries: [transcript],
|
|
117
|
+
});
|
|
118
|
+
transcript.renderedId = transcript.id;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
last.combinedText += ' ' + transcript.transcript;
|
|
122
|
+
transcript.renderedId = last.renderedId;
|
|
123
|
+
last.entries.push(transcript);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return groups;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Keeps only the raw entries that belong to the latest two rendered groups.
|
|
130
|
+
* Entries that fall outside the visible two groups are removed immediately
|
|
131
|
+
* so they cannot resurface after current captions expire.
|
|
132
|
+
*/
|
|
133
|
+
pruneToLatestTwoGroups() {
|
|
134
|
+
const groups = this.buildGroups();
|
|
135
|
+
if (groups.length <= 2)
|
|
136
|
+
return;
|
|
137
|
+
const visible = new Set(groups.slice(-2).flatMap((g) => g.entries));
|
|
138
|
+
this.transcripts = this.transcripts.filter((t) => visible.has(t));
|
|
96
139
|
}
|
|
97
140
|
remove(renderedId) {
|
|
98
141
|
this.transcripts = this.transcripts.filter((transcript) => transcript.renderedId !== renderedId);
|
|
@@ -110,34 +153,22 @@ const RtkTranscripts = class {
|
|
|
110
153
|
}, 400);
|
|
111
154
|
}
|
|
112
155
|
renderTranscripts() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
156
|
+
return this.buildGroups()
|
|
157
|
+
.slice(-2)
|
|
158
|
+
.map((group) => {
|
|
159
|
+
const first = group.entries[0];
|
|
160
|
+
const transcript = {
|
|
161
|
+
name: first.name,
|
|
162
|
+
date: first.date,
|
|
163
|
+
peerId: group.peerId,
|
|
164
|
+
userId: first.userId,
|
|
165
|
+
customParticipantId: first.customParticipantId,
|
|
166
|
+
transcript: group.combinedText,
|
|
167
|
+
id: first.id,
|
|
168
|
+
renderedId: group.renderedId,
|
|
122
169
|
};
|
|
123
|
-
|
|
124
|
-
transcript.renderedId = t.renderedId;
|
|
125
|
-
renderedTranscripts.push(t);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const lastTranscript = renderedTranscripts[renderedTranscripts.length - 1];
|
|
129
|
-
const maxTranscriptLength = 400;
|
|
130
|
-
if (lastTranscript.transcript.length + t.transcript.length > maxTranscriptLength ||
|
|
131
|
-
lastTranscript.peerId !== transcript.peerId) {
|
|
132
|
-
transcript.renderedId = t.renderedId;
|
|
133
|
-
renderedTranscripts.push(t);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
lastTranscript.transcript += ' ' + transcript.transcript;
|
|
137
|
-
transcript.renderedId = lastTranscript.renderedId;
|
|
170
|
+
return (index$1.h("rtk-transcript", { key: first.id, "data-id": first.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t }));
|
|
138
171
|
});
|
|
139
|
-
renderedTranscripts.splice(0, renderedTranscripts.length - 2);
|
|
140
|
-
return renderedTranscripts === null || renderedTranscripts === void 0 ? void 0 : renderedTranscripts.map((transcript) => (index$1.h("rtk-transcript", { key: transcript.id, "data-id": transcript.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t })));
|
|
141
172
|
}
|
|
142
173
|
render() {
|
|
143
174
|
if (!this.states.activeCaptions)
|
|
@@ -25,6 +25,9 @@ export class RtkTranscript {
|
|
|
25
25
|
connectedCallback() {
|
|
26
26
|
this.transcriptChanged(this.transcript);
|
|
27
27
|
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
clearTimeout(this.timeout);
|
|
30
|
+
}
|
|
28
31
|
transcriptChanged(transcript, oldTranscript) {
|
|
29
32
|
if ((oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.renderedId) === transcript.renderedId &&
|
|
30
33
|
(oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.transcript) === transcript.transcript) {
|
|
@@ -40,7 +43,7 @@ export class RtkTranscript {
|
|
|
40
43
|
}, 10000);
|
|
41
44
|
}
|
|
42
45
|
render() {
|
|
43
|
-
return (h(Host, { key: '
|
|
46
|
+
return (h(Host, { key: 'c9f584259f21f759133ea5d6f4e07bac1524b5fb' }, h("div", { key: 'd25914df1db61994cfe8a5f0fc42af79c2823ece', class: "ctr" }, h("p", { key: '06fefba0bca0a253a9140a9f2a86c2230b83f049', class: "message" }, h("span", { key: '5f833c6901ab4f246e06d8a82c47a3d49616e44c', class: "name" }, this.transcript.name), ": ", this.transcript.transcript))));
|
|
44
47
|
}
|
|
45
48
|
static get is() { return "rtk-transcript"; }
|
|
46
49
|
static get encapsulation() { return "shadow"; }
|
|
@@ -13,6 +13,8 @@ import { useLanguage } from "../../lib/lang";
|
|
|
13
13
|
import { createDefaultConfig } from "../../exports";
|
|
14
14
|
import { SyncWithStore } from "../../utils/sync-with-store";
|
|
15
15
|
import clone from "../../utils/clone";
|
|
16
|
+
/** Maximum character length of a single rendered caption group. */
|
|
17
|
+
const MAX_GROUP_LENGTH = 400;
|
|
16
18
|
/**
|
|
17
19
|
* A component which handles transcripts.
|
|
18
20
|
*
|
|
@@ -89,9 +91,50 @@ export class RtkTranscripts {
|
|
|
89
91
|
return acc.concat(t);
|
|
90
92
|
}
|
|
91
93
|
add(transcript) {
|
|
92
|
-
// show transcripts only if tab is in focus and a maximum of 3 at a time
|
|
93
|
-
// this.transcripts.splice(0, this.transcripts.length - 2);
|
|
94
94
|
this.transcripts = this.transcriptionsReducer(this.transcripts, transcript);
|
|
95
|
+
this.pruneToLatestTwoGroups();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Groups raw transcript entries using the same merging rules as the renderer:
|
|
99
|
+
* consecutive entries from the same peer are combined with a separator space
|
|
100
|
+
* until the accumulated text exceeds MAX_GROUP_LENGTH, at which point a new
|
|
101
|
+
* group begins. Assigns renderedId on each entry as a side effect so that
|
|
102
|
+
* pruning and rendering stay in sync.
|
|
103
|
+
*/
|
|
104
|
+
buildGroups() {
|
|
105
|
+
const groups = [];
|
|
106
|
+
this.transcripts.forEach((transcript) => {
|
|
107
|
+
const last = groups[groups.length - 1];
|
|
108
|
+
if (!last ||
|
|
109
|
+
last.peerId !== transcript.peerId ||
|
|
110
|
+
last.combinedText.length + transcript.transcript.length > MAX_GROUP_LENGTH) {
|
|
111
|
+
groups.push({
|
|
112
|
+
renderedId: transcript.id,
|
|
113
|
+
peerId: transcript.peerId,
|
|
114
|
+
combinedText: transcript.transcript,
|
|
115
|
+
entries: [transcript],
|
|
116
|
+
});
|
|
117
|
+
transcript.renderedId = transcript.id;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
last.combinedText += ' ' + transcript.transcript;
|
|
121
|
+
transcript.renderedId = last.renderedId;
|
|
122
|
+
last.entries.push(transcript);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return groups;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Keeps only the raw entries that belong to the latest two rendered groups.
|
|
129
|
+
* Entries that fall outside the visible two groups are removed immediately
|
|
130
|
+
* so they cannot resurface after current captions expire.
|
|
131
|
+
*/
|
|
132
|
+
pruneToLatestTwoGroups() {
|
|
133
|
+
const groups = this.buildGroups();
|
|
134
|
+
if (groups.length <= 2)
|
|
135
|
+
return;
|
|
136
|
+
const visible = new Set(groups.slice(-2).flatMap((g) => g.entries));
|
|
137
|
+
this.transcripts = this.transcripts.filter((t) => visible.has(t));
|
|
95
138
|
}
|
|
96
139
|
remove(renderedId) {
|
|
97
140
|
this.transcripts = this.transcripts.filter((transcript) => transcript.renderedId !== renderedId);
|
|
@@ -109,34 +152,22 @@ export class RtkTranscripts {
|
|
|
109
152
|
}, 400);
|
|
110
153
|
}
|
|
111
154
|
renderTranscripts() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
155
|
+
return this.buildGroups()
|
|
156
|
+
.slice(-2)
|
|
157
|
+
.map((group) => {
|
|
158
|
+
const first = group.entries[0];
|
|
159
|
+
const transcript = {
|
|
160
|
+
name: first.name,
|
|
161
|
+
date: first.date,
|
|
162
|
+
peerId: group.peerId,
|
|
163
|
+
userId: first.userId,
|
|
164
|
+
customParticipantId: first.customParticipantId,
|
|
165
|
+
transcript: group.combinedText,
|
|
166
|
+
id: first.id,
|
|
167
|
+
renderedId: group.renderedId,
|
|
121
168
|
};
|
|
122
|
-
|
|
123
|
-
transcript.renderedId = t.renderedId;
|
|
124
|
-
renderedTranscripts.push(t);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const lastTranscript = renderedTranscripts[renderedTranscripts.length - 1];
|
|
128
|
-
const maxTranscriptLength = 400;
|
|
129
|
-
if (lastTranscript.transcript.length + t.transcript.length > maxTranscriptLength ||
|
|
130
|
-
lastTranscript.peerId !== transcript.peerId) {
|
|
131
|
-
transcript.renderedId = t.renderedId;
|
|
132
|
-
renderedTranscripts.push(t);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
lastTranscript.transcript += ' ' + transcript.transcript;
|
|
136
|
-
transcript.renderedId = lastTranscript.renderedId;
|
|
169
|
+
return (h("rtk-transcript", { key: first.id, "data-id": first.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t }));
|
|
137
170
|
});
|
|
138
|
-
renderedTranscripts.splice(0, renderedTranscripts.length - 2);
|
|
139
|
-
return renderedTranscripts === null || renderedTranscripts === void 0 ? void 0 : renderedTranscripts.map((transcript) => (h("rtk-transcript", { key: transcript.id, "data-id": transcript.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t })));
|
|
140
171
|
}
|
|
141
172
|
render() {
|
|
142
173
|
if (!this.states.activeCaptions)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as e,c as r,h as a,d as s,t as i}from"./p-BBHQOrFK.js";import{i as o}from"./p-BthnOddY.js";import{S as n}from"./p-DL4GSZ2e.js";const c=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.dismiss=r(this,"rtkTranscriptDismiss",7),this.t=o()}connectedCallback(){this.transcriptChanged(this.transcript)}disconnectedCallback(){clearTimeout(this.timeout)}transcriptChanged(t,e){if((null==e?void 0:e.renderedId)===t.renderedId&&(null==e?void 0:e.transcript)===t.transcript)return;if(clearTimeout(this.timeout),!(null==t?void 0:t.name)||!(null==t?void 0:t.transcript))return;const{id:r,renderedId:a}=t;this.timeout=setTimeout((()=>{this.dismiss.emit({id:r,renderedId:a})}),1e4)}render(){return a(s,{key:"c9f584259f21f759133ea5d6f4e07bac1524b5fb"},a("div",{key:"d25914df1db61994cfe8a5f0fc42af79c2823ece",class:"ctr"},a("p",{key:"06fefba0bca0a253a9140a9f2a86c2230b83f049",class:"message"},a("span",{key:"5f833c6901ab4f246e06d8a82c47a3d49616e44c",class:"name"},this.transcript.name),": ",this.transcript.transcript)))}static get watchers(){return{transcript:[{transcriptChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;color:rgb(var(--rtk-colors-text-1000, 255 255 255));display:flex;justify-content:center;vertical-align:middle;animation:show 0.4s ease;transition:0.4s;z-index:5;width:100%}.ctr{box-sizing:border-box;display:inline-flex;height:100%;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto;padding:var(--rtk-space-3, 12px);overflow:auto;max-width:50%}.message{margin:var(--rtk-space-0, 0px);display:inline-block;justify-content:center;max-width:100%;text-wrap:wrap;line-height:1.5rem}.message .name{font-weight:bold}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateY(120px)}100%{opacity:1;transform:translateY(0px)}}@keyframes exit{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-120px)}}:host([size='sm']){font-size:14px}"}},[1,"rtk-transcript",{transcript:[16],t:[16],timeout:[32]},void 0,{transcript:[{transcriptChanged:0}]}]);function d(){"undefined"!=typeof customElements&&["rtk-transcript"].forEach((t=>{"rtk-transcript"===t&&(customElements.get(i(t))||customElements.define(i(t),c))}))}(function(t,e,r,a){var s,i=arguments.length,o=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,a);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);i>3&&o&&Object.defineProperty(e,r,o)})([n()],c.prototype,"t",void 0),d();export{c as R,d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as
|
|
1
|
+
import{R as o,d as p}from"./p-DnGHVpK1.js";const s=o,r=p;export{s as RtkTranscript,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,w as e,h as i,d as r,t as n}from"./p-BBHQOrFK.js";import{c as a,i as o,D as c}from"./p-BthnOddY.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import"./p-Dguuxuf6.js";import{S as h}from"./p-DL4GSZ2e.js";import{d as p}from"./p-
|
|
1
|
+
import{p as t,H as s,w as e,h as i,d as r,t as n}from"./p-BBHQOrFK.js";import{c as a,i as o,D as c}from"./p-BthnOddY.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import"./p-Dguuxuf6.js";import{S as h}from"./p-DL4GSZ2e.js";import{d as p}from"./p-DnGHVpK1.js";var d=function(t,s,e,i){var r,n=arguments.length,a=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,s,e,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(s,e,a):r(s,e))||a);return n>3&&a&&Object.defineProperty(s,e,a),a};const l=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.config=a(),this.t=o(),this.transcripts=[],this.listenerAttached=!1,this.onTranscript=t=>{t.transcript&&this.add(t)}}connectedCallback(){this.meetingChanged(this.meeting)}addListener(t){var s;null===(s=null==t?void 0:t.ai)||void 0===s||s.addListener("transcript",this.onTranscript),this.listenerAttached=!0}clearListeners(t){var s;this.onTranscript&&(null===(s=null==t?void 0:t.ai)||void 0===s||s.removeListener("transcript",this.onTranscript)),this.listenerAttached=!1,clearTimeout(this.disconnectTimeout),this.transcripts=[]}disconnectedCallback(){this.meeting&&this.clearListeners(this.meeting)}meetingChanged(t,s){clearTimeout(this.disconnectTimeout),s&&this.clearListeners(s),t&&this.states.activeCaptions&&this.addListener(t)}statesChanged(t){t&&(t.activeCaptions&&!this.listenerAttached&&this.addListener(this.meeting),!t.activeCaptions&&this.listenerAttached&&this.clearListeners(this.meeting))}transcriptionsReducer(t,s){if(!t.length)return[s];let e=t[t.length-1];return e.peerId!==s.peerId?t.concat(s):e.id===s.id?(e.transcript=s.transcript,t.pop(),t.concat(c(e))):t.concat(s)}add(t){this.transcripts=this.transcriptionsReducer(this.transcripts,t),this.pruneToLatestTwoGroups()}buildGroups(){const t=[];return this.transcripts.forEach((s=>{const e=t[t.length-1];!e||e.peerId!==s.peerId||e.combinedText.length+s.transcript.length>400?(t.push({renderedId:s.id,peerId:s.peerId,combinedText:s.transcript,entries:[s]}),s.renderedId=s.id):(e.combinedText+=" "+s.transcript,s.renderedId=e.renderedId,e.entries.push(s))})),t}pruneToLatestTwoGroups(){const t=this.buildGroups();if(t.length<=2)return;const s=new Set(t.slice(-2).flatMap((t=>t.entries)));this.transcripts=this.transcripts.filter((t=>s.has(t)))}remove(t){this.transcripts=this.transcripts.filter((s=>s.renderedId!==t))}handleDismiss(t){t.stopPropagation();const{id:s,renderedId:i}=t.detail,r=this.host.shadowRoot.querySelector(`[data-id="${s}"]`);null==r||r.classList.add("exit"),setTimeout((()=>{e((()=>{this.remove(i)}))}),400)}renderTranscripts(){return this.buildGroups().slice(-2).map((t=>{const s=t.entries[0];return i("rtk-transcript",{key:s.id,"data-id":s.id,transcript:{name:s.name,date:s.date,peerId:t.peerId,userId:s.userId,customParticipantId:s.customParticipantId,transcript:t.combinedText,id:s.id,renderedId:t.renderedId},onRtkTranscriptDismiss:t=>this.handleDismiss(t),t:this.t})}))}render(){if(this.states.activeCaptions)return i(r,null,this.renderTranscripts())}get host(){return this}static get watchers(){return{meeting:[{meetingChanged:0}],states:[{statesChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;justify-content:center;width:100%;z-index:5}rtk-transcript{margin-top:var(--rtk-space-2, 8px)}"}},[1,"rtk-transcripts",{meeting:[16],states:[16],config:[16],t:[16],transcripts:[32],listenerAttached:[32]},void 0,{meeting:[{meetingChanged:0}],states:[{statesChanged:0}]}]);function u(){"undefined"!=typeof customElements&&["rtk-transcripts","rtk-transcript"].forEach((t=>{switch(t){case"rtk-transcripts":customElements.get(n(t))||customElements.define(n(t),l);break;case"rtk-transcript":customElements.get(n(t))||p()}}))}d([h()],l.prototype,"meeting",void 0),d([h()],l.prototype,"states",void 0),d([h()],l.prototype,"config",void 0),d([h()],l.prototype,"t",void 0),u();const m=l,f=u;export{m as RtkTranscripts,f as defineCustomElement}
|
package/dist/esm/loader.js
CHANGED
|
@@ -24327,6 +24327,8 @@ var __decorate$p = function (decorators, target, key, desc) {
|
|
|
24327
24327
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24328
24328
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24329
24329
|
};
|
|
24330
|
+
/** Maximum character length of a single rendered caption group. */
|
|
24331
|
+
const MAX_GROUP_LENGTH = 400;
|
|
24330
24332
|
const RtkTranscripts = class {
|
|
24331
24333
|
constructor(hostRef) {
|
|
24332
24334
|
registerInstance(this, hostRef);
|
|
@@ -24398,9 +24400,50 @@ const RtkTranscripts = class {
|
|
|
24398
24400
|
return acc.concat(t);
|
|
24399
24401
|
}
|
|
24400
24402
|
add(transcript) {
|
|
24401
|
-
// show transcripts only if tab is in focus and a maximum of 3 at a time
|
|
24402
|
-
// this.transcripts.splice(0, this.transcripts.length - 2);
|
|
24403
24403
|
this.transcripts = this.transcriptionsReducer(this.transcripts, transcript);
|
|
24404
|
+
this.pruneToLatestTwoGroups();
|
|
24405
|
+
}
|
|
24406
|
+
/**
|
|
24407
|
+
* Groups raw transcript entries using the same merging rules as the renderer:
|
|
24408
|
+
* consecutive entries from the same peer are combined with a separator space
|
|
24409
|
+
* until the accumulated text exceeds MAX_GROUP_LENGTH, at which point a new
|
|
24410
|
+
* group begins. Assigns renderedId on each entry as a side effect so that
|
|
24411
|
+
* pruning and rendering stay in sync.
|
|
24412
|
+
*/
|
|
24413
|
+
buildGroups() {
|
|
24414
|
+
const groups = [];
|
|
24415
|
+
this.transcripts.forEach((transcript) => {
|
|
24416
|
+
const last = groups[groups.length - 1];
|
|
24417
|
+
if (!last ||
|
|
24418
|
+
last.peerId !== transcript.peerId ||
|
|
24419
|
+
last.combinedText.length + transcript.transcript.length > MAX_GROUP_LENGTH) {
|
|
24420
|
+
groups.push({
|
|
24421
|
+
renderedId: transcript.id,
|
|
24422
|
+
peerId: transcript.peerId,
|
|
24423
|
+
combinedText: transcript.transcript,
|
|
24424
|
+
entries: [transcript],
|
|
24425
|
+
});
|
|
24426
|
+
transcript.renderedId = transcript.id;
|
|
24427
|
+
}
|
|
24428
|
+
else {
|
|
24429
|
+
last.combinedText += ' ' + transcript.transcript;
|
|
24430
|
+
transcript.renderedId = last.renderedId;
|
|
24431
|
+
last.entries.push(transcript);
|
|
24432
|
+
}
|
|
24433
|
+
});
|
|
24434
|
+
return groups;
|
|
24435
|
+
}
|
|
24436
|
+
/**
|
|
24437
|
+
* Keeps only the raw entries that belong to the latest two rendered groups.
|
|
24438
|
+
* Entries that fall outside the visible two groups are removed immediately
|
|
24439
|
+
* so they cannot resurface after current captions expire.
|
|
24440
|
+
*/
|
|
24441
|
+
pruneToLatestTwoGroups() {
|
|
24442
|
+
const groups = this.buildGroups();
|
|
24443
|
+
if (groups.length <= 2)
|
|
24444
|
+
return;
|
|
24445
|
+
const visible = new Set(groups.slice(-2).flatMap((g) => g.entries));
|
|
24446
|
+
this.transcripts = this.transcripts.filter((t) => visible.has(t));
|
|
24404
24447
|
}
|
|
24405
24448
|
remove(renderedId) {
|
|
24406
24449
|
this.transcripts = this.transcripts.filter((transcript) => transcript.renderedId !== renderedId);
|
|
@@ -24418,34 +24461,22 @@ const RtkTranscripts = class {
|
|
|
24418
24461
|
}, 400);
|
|
24419
24462
|
}
|
|
24420
24463
|
renderTranscripts() {
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24464
|
+
return this.buildGroups()
|
|
24465
|
+
.slice(-2)
|
|
24466
|
+
.map((group) => {
|
|
24467
|
+
const first = group.entries[0];
|
|
24468
|
+
const transcript = {
|
|
24469
|
+
name: first.name,
|
|
24470
|
+
date: first.date,
|
|
24471
|
+
peerId: group.peerId,
|
|
24472
|
+
userId: first.userId,
|
|
24473
|
+
customParticipantId: first.customParticipantId,
|
|
24474
|
+
transcript: group.combinedText,
|
|
24475
|
+
id: first.id,
|
|
24476
|
+
renderedId: group.renderedId,
|
|
24430
24477
|
};
|
|
24431
|
-
|
|
24432
|
-
transcript.renderedId = t.renderedId;
|
|
24433
|
-
renderedTranscripts.push(t);
|
|
24434
|
-
return;
|
|
24435
|
-
}
|
|
24436
|
-
const lastTranscript = renderedTranscripts[renderedTranscripts.length - 1];
|
|
24437
|
-
const maxTranscriptLength = 400;
|
|
24438
|
-
if (lastTranscript.transcript.length + t.transcript.length > maxTranscriptLength ||
|
|
24439
|
-
lastTranscript.peerId !== transcript.peerId) {
|
|
24440
|
-
transcript.renderedId = t.renderedId;
|
|
24441
|
-
renderedTranscripts.push(t);
|
|
24442
|
-
return;
|
|
24443
|
-
}
|
|
24444
|
-
lastTranscript.transcript += ' ' + transcript.transcript;
|
|
24445
|
-
transcript.renderedId = lastTranscript.renderedId;
|
|
24478
|
+
return (h("rtk-transcript", { key: first.id, "data-id": first.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t }));
|
|
24446
24479
|
});
|
|
24447
|
-
renderedTranscripts.splice(0, renderedTranscripts.length - 2);
|
|
24448
|
-
return renderedTranscripts === null || renderedTranscripts === void 0 ? void 0 : renderedTranscripts.map((transcript) => (h("rtk-transcript", { key: transcript.id, "data-id": transcript.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t })));
|
|
24449
24480
|
}
|
|
24450
24481
|
render() {
|
|
24451
24482
|
if (!this.states.activeCaptions)
|
|
@@ -64343,6 +64374,9 @@ const RtkTranscript = class {
|
|
|
64343
64374
|
connectedCallback() {
|
|
64344
64375
|
this.transcriptChanged(this.transcript);
|
|
64345
64376
|
}
|
|
64377
|
+
disconnectedCallback() {
|
|
64378
|
+
clearTimeout(this.timeout);
|
|
64379
|
+
}
|
|
64346
64380
|
transcriptChanged(transcript, oldTranscript) {
|
|
64347
64381
|
if ((oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.renderedId) === transcript.renderedId &&
|
|
64348
64382
|
(oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.transcript) === transcript.transcript) {
|
|
@@ -64358,7 +64392,7 @@ const RtkTranscript = class {
|
|
|
64358
64392
|
}, 10000);
|
|
64359
64393
|
}
|
|
64360
64394
|
render() {
|
|
64361
|
-
return (h(Host, { key: '
|
|
64395
|
+
return (h(Host, { key: 'c9f584259f21f759133ea5d6f4e07bac1524b5fb' }, h("div", { key: 'd25914df1db61994cfe8a5f0fc42af79c2823ece', class: "ctr" }, h("p", { key: '06fefba0bca0a253a9140a9f2a86c2230b83f049', class: "message" }, h("span", { key: '5f833c6901ab4f246e06d8a82c47a3d49616e44c', class: "name" }, this.transcript.name), ": ", this.transcript.transcript))));
|
|
64362
64396
|
}
|
|
64363
64397
|
static get watchers() { return {
|
|
64364
64398
|
"transcript": [{
|
|
@@ -24,6 +24,9 @@ const RtkTranscript = class {
|
|
|
24
24
|
connectedCallback() {
|
|
25
25
|
this.transcriptChanged(this.transcript);
|
|
26
26
|
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
clearTimeout(this.timeout);
|
|
29
|
+
}
|
|
27
30
|
transcriptChanged(transcript, oldTranscript) {
|
|
28
31
|
if ((oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.renderedId) === transcript.renderedId &&
|
|
29
32
|
(oldTranscript === null || oldTranscript === void 0 ? void 0 : oldTranscript.transcript) === transcript.transcript) {
|
|
@@ -39,7 +42,7 @@ const RtkTranscript = class {
|
|
|
39
42
|
}, 10000);
|
|
40
43
|
}
|
|
41
44
|
render() {
|
|
42
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: 'c9f584259f21f759133ea5d6f4e07bac1524b5fb' }, h("div", { key: 'd25914df1db61994cfe8a5f0fc42af79c2823ece', class: "ctr" }, h("p", { key: '06fefba0bca0a253a9140a9f2a86c2230b83f049', class: "message" }, h("span", { key: '5f833c6901ab4f246e06d8a82c47a3d49616e44c', class: "name" }, this.transcript.name), ": ", this.transcript.transcript))));
|
|
43
46
|
}
|
|
44
47
|
static get watchers() { return {
|
|
45
48
|
"transcript": [{
|
|
@@ -17,6 +17,8 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
17
17
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
|
+
/** Maximum character length of a single rendered caption group. */
|
|
21
|
+
const MAX_GROUP_LENGTH = 400;
|
|
20
22
|
const RtkTranscripts = class {
|
|
21
23
|
constructor(hostRef) {
|
|
22
24
|
registerInstance(this, hostRef);
|
|
@@ -88,9 +90,50 @@ const RtkTranscripts = class {
|
|
|
88
90
|
return acc.concat(t);
|
|
89
91
|
}
|
|
90
92
|
add(transcript) {
|
|
91
|
-
// show transcripts only if tab is in focus and a maximum of 3 at a time
|
|
92
|
-
// this.transcripts.splice(0, this.transcripts.length - 2);
|
|
93
93
|
this.transcripts = this.transcriptionsReducer(this.transcripts, transcript);
|
|
94
|
+
this.pruneToLatestTwoGroups();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Groups raw transcript entries using the same merging rules as the renderer:
|
|
98
|
+
* consecutive entries from the same peer are combined with a separator space
|
|
99
|
+
* until the accumulated text exceeds MAX_GROUP_LENGTH, at which point a new
|
|
100
|
+
* group begins. Assigns renderedId on each entry as a side effect so that
|
|
101
|
+
* pruning and rendering stay in sync.
|
|
102
|
+
*/
|
|
103
|
+
buildGroups() {
|
|
104
|
+
const groups = [];
|
|
105
|
+
this.transcripts.forEach((transcript) => {
|
|
106
|
+
const last = groups[groups.length - 1];
|
|
107
|
+
if (!last ||
|
|
108
|
+
last.peerId !== transcript.peerId ||
|
|
109
|
+
last.combinedText.length + transcript.transcript.length > MAX_GROUP_LENGTH) {
|
|
110
|
+
groups.push({
|
|
111
|
+
renderedId: transcript.id,
|
|
112
|
+
peerId: transcript.peerId,
|
|
113
|
+
combinedText: transcript.transcript,
|
|
114
|
+
entries: [transcript],
|
|
115
|
+
});
|
|
116
|
+
transcript.renderedId = transcript.id;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
last.combinedText += ' ' + transcript.transcript;
|
|
120
|
+
transcript.renderedId = last.renderedId;
|
|
121
|
+
last.entries.push(transcript);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return groups;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Keeps only the raw entries that belong to the latest two rendered groups.
|
|
128
|
+
* Entries that fall outside the visible two groups are removed immediately
|
|
129
|
+
* so they cannot resurface after current captions expire.
|
|
130
|
+
*/
|
|
131
|
+
pruneToLatestTwoGroups() {
|
|
132
|
+
const groups = this.buildGroups();
|
|
133
|
+
if (groups.length <= 2)
|
|
134
|
+
return;
|
|
135
|
+
const visible = new Set(groups.slice(-2).flatMap((g) => g.entries));
|
|
136
|
+
this.transcripts = this.transcripts.filter((t) => visible.has(t));
|
|
94
137
|
}
|
|
95
138
|
remove(renderedId) {
|
|
96
139
|
this.transcripts = this.transcripts.filter((transcript) => transcript.renderedId !== renderedId);
|
|
@@ -108,34 +151,22 @@ const RtkTranscripts = class {
|
|
|
108
151
|
}, 400);
|
|
109
152
|
}
|
|
110
153
|
renderTranscripts() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
154
|
+
return this.buildGroups()
|
|
155
|
+
.slice(-2)
|
|
156
|
+
.map((group) => {
|
|
157
|
+
const first = group.entries[0];
|
|
158
|
+
const transcript = {
|
|
159
|
+
name: first.name,
|
|
160
|
+
date: first.date,
|
|
161
|
+
peerId: group.peerId,
|
|
162
|
+
userId: first.userId,
|
|
163
|
+
customParticipantId: first.customParticipantId,
|
|
164
|
+
transcript: group.combinedText,
|
|
165
|
+
id: first.id,
|
|
166
|
+
renderedId: group.renderedId,
|
|
120
167
|
};
|
|
121
|
-
|
|
122
|
-
transcript.renderedId = t.renderedId;
|
|
123
|
-
renderedTranscripts.push(t);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const lastTranscript = renderedTranscripts[renderedTranscripts.length - 1];
|
|
127
|
-
const maxTranscriptLength = 400;
|
|
128
|
-
if (lastTranscript.transcript.length + t.transcript.length > maxTranscriptLength ||
|
|
129
|
-
lastTranscript.peerId !== transcript.peerId) {
|
|
130
|
-
transcript.renderedId = t.renderedId;
|
|
131
|
-
renderedTranscripts.push(t);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
lastTranscript.transcript += ' ' + transcript.transcript;
|
|
135
|
-
transcript.renderedId = lastTranscript.renderedId;
|
|
168
|
+
return (h("rtk-transcript", { key: first.id, "data-id": first.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t }));
|
|
136
169
|
});
|
|
137
|
-
renderedTranscripts.splice(0, renderedTranscripts.length - 2);
|
|
138
|
-
return renderedTranscripts === null || renderedTranscripts === void 0 ? void 0 : renderedTranscripts.map((transcript) => (h("rtk-transcript", { key: transcript.id, "data-id": transcript.id, transcript: transcript, onRtkTranscriptDismiss: (e) => this.handleDismiss(e), t: this.t })));
|
|
139
170
|
}
|
|
140
171
|
render() {
|
|
141
172
|
if (!this.states.activeCaptions)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,e as s,h as i,a as e,g as r}from"./p-gJCRRBX0.js";import{c as n,i as a,J as o}from"./p-D9rFUUCb.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import{S as h}from"./p-Dy41dnX2.js";import"./p-Daj_55_i.js";var c=function(t,s,i,e){var r,n=arguments.length,a=n<3?s:null===e?e=Object.getOwnPropertyDescriptor(s,i):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,s,i,e);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(s,i,a):r(s,i))||a);return n>3&&a&&Object.defineProperty(s,i,a),a};const p=class{constructor(s){t(this,s),this.config=n(),this.t=a(),this.transcripts=[],this.listenerAttached=!1,this.onTranscript=t=>{t.transcript&&this.add(t)}}connectedCallback(){this.meetingChanged(this.meeting)}addListener(t){var s;null===(s=null==t?void 0:t.ai)||void 0===s||s.addListener("transcript",this.onTranscript),this.listenerAttached=!0}clearListeners(t){var s;this.onTranscript&&(null===(s=null==t?void 0:t.ai)||void 0===s||s.removeListener("transcript",this.onTranscript)),this.listenerAttached=!1,clearTimeout(this.disconnectTimeout),this.transcripts=[]}disconnectedCallback(){this.meeting&&this.clearListeners(this.meeting)}meetingChanged(t,s){clearTimeout(this.disconnectTimeout),s&&this.clearListeners(s),t&&this.states.activeCaptions&&this.addListener(t)}statesChanged(t){t&&(t.activeCaptions&&!this.listenerAttached&&this.addListener(this.meeting),!t.activeCaptions&&this.listenerAttached&&this.clearListeners(this.meeting))}transcriptionsReducer(t,s){if(!t.length)return[s];let i=t[t.length-1];return i.peerId!==s.peerId?t.concat(s):i.id===s.id?(i.transcript=s.transcript,t.pop(),t.concat(o(i))):t.concat(s)}add(t){this.transcripts=this.transcriptionsReducer(this.transcripts,t),this.pruneToLatestTwoGroups()}buildGroups(){const t=[];return this.transcripts.forEach((s=>{const i=t[t.length-1];!i||i.peerId!==s.peerId||i.combinedText.length+s.transcript.length>400?(t.push({renderedId:s.id,peerId:s.peerId,combinedText:s.transcript,entries:[s]}),s.renderedId=s.id):(i.combinedText+=" "+s.transcript,s.renderedId=i.renderedId,i.entries.push(s))})),t}pruneToLatestTwoGroups(){const t=this.buildGroups();if(t.length<=2)return;const s=new Set(t.slice(-2).flatMap((t=>t.entries)));this.transcripts=this.transcripts.filter((t=>s.has(t)))}remove(t){this.transcripts=this.transcripts.filter((s=>s.renderedId!==t))}handleDismiss(t){t.stopPropagation();const{id:i,renderedId:e}=t.detail,r=this.host.shadowRoot.querySelector(`[data-id="${i}"]`);null==r||r.classList.add("exit"),setTimeout((()=>{s((()=>{this.remove(e)}))}),400)}renderTranscripts(){return this.buildGroups().slice(-2).map((t=>{const s=t.entries[0];return i("rtk-transcript",{key:s.id,"data-id":s.id,transcript:{name:s.name,date:s.date,peerId:t.peerId,userId:s.userId,customParticipantId:s.customParticipantId,transcript:t.combinedText,id:s.id,renderedId:t.renderedId},onRtkTranscriptDismiss:t=>this.handleDismiss(t),t:this.t})}))}render(){if(this.states.activeCaptions)return i(e,null,this.renderTranscripts())}get host(){return r(this)}static get watchers(){return{meeting:[{meetingChanged:0}],states:[{statesChanged:0}]}}};c([h()],p.prototype,"meeting",void 0),c([h()],p.prototype,"states",void 0),c([h()],p.prototype,"config",void 0),c([h()],p.prototype,"t",void 0),p.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;justify-content:center;width:100%;z-index:5}rtk-transcript{margin-top:var(--rtk-space-2, 8px)}";export{p as rtk_transcripts}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,d as a,h as e,a as r}from"./p-gJCRRBX0.js";import{i as s}from"./p-D9rFUUCb.js";import{S as o}from"./p-Dy41dnX2.js";const i=class{constructor(e){t(this,e),this.dismiss=a(this,"rtkTranscriptDismiss",7),this.t=s()}connectedCallback(){this.transcriptChanged(this.transcript)}disconnectedCallback(){clearTimeout(this.timeout)}transcriptChanged(t,a){if((null==a?void 0:a.renderedId)===t.renderedId&&(null==a?void 0:a.transcript)===t.transcript)return;if(clearTimeout(this.timeout),!(null==t?void 0:t.name)||!(null==t?void 0:t.transcript))return;const{id:e,renderedId:r}=t;this.timeout=setTimeout((()=>{this.dismiss.emit({id:e,renderedId:r})}),1e4)}render(){return e(r,{key:"c9f584259f21f759133ea5d6f4e07bac1524b5fb"},e("div",{key:"d25914df1db61994cfe8a5f0fc42af79c2823ece",class:"ctr"},e("p",{key:"06fefba0bca0a253a9140a9f2a86c2230b83f049",class:"message"},e("span",{key:"5f833c6901ab4f246e06d8a82c47a3d49616e44c",class:"name"},this.transcript.name),": ",this.transcript.transcript)))}static get watchers(){return{transcript:[{transcriptChanged:0}]}}};(function(t,a,e,r){var s,o=arguments.length,i=o<3?a:null===r?r=Object.getOwnPropertyDescriptor(a,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,a,e,r);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(i=(o<3?s(i):o>3?s(a,e,i):s(a,e))||i);o>3&&i&&Object.defineProperty(a,e,i)})([o()],i.prototype,"t",void 0),i.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;color:rgb(var(--rtk-colors-text-1000, 255 255 255));display:flex;justify-content:center;vertical-align:middle;animation:show 0.4s ease;transition:0.4s;z-index:5;width:100%}.ctr{box-sizing:border-box;display:inline-flex;height:100%;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto;padding:var(--rtk-space-3, 12px);overflow:auto;max-width:50%}.message{margin:var(--rtk-space-0, 0px);display:inline-block;justify-content:center;max-width:100%;text-wrap:wrap;line-height:1.5rem}.message .name{font-weight:bold}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateY(120px)}100%{opacity:1;transform:translateY(0px)}}@keyframes exit{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-120px)}}:host([size='sm']){font-size:14px}";export{i as rtk_transcript}
|