@livepeer-frameworks/streamcrafter-wc 0.1.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/dist/cjs/components/fw-sc-advanced.js +198 -0
- package/dist/cjs/components/fw-sc-advanced.js.map +1 -0
- package/dist/cjs/components/fw-sc-compositor.js +116 -0
- package/dist/cjs/components/fw-sc-compositor.js.map +1 -0
- package/dist/cjs/components/fw-sc-layer-list.js +253 -0
- package/dist/cjs/components/fw-sc-layer-list.js.map +1 -0
- package/dist/cjs/components/fw-sc-scene-switcher.js +164 -0
- package/dist/cjs/components/fw-sc-scene-switcher.js.map +1 -0
- package/dist/cjs/components/fw-sc-volume.js +183 -0
- package/dist/cjs/components/fw-sc-volume.js.map +1 -0
- package/dist/cjs/components/fw-streamcrafter.js +508 -0
- package/dist/cjs/components/fw-streamcrafter.js.map +1 -0
- package/dist/cjs/controllers/ingest-controller-host.js +236 -0
- package/dist/cjs/controllers/ingest-controller-host.js.map +1 -0
- package/dist/cjs/define.js +25 -0
- package/dist/cjs/define.js.map +1 -0
- package/dist/cjs/icons/index.js +283 -0
- package/dist/cjs/icons/index.js.map +1 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +33 -0
- package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/cjs/styles/shared-styles.js +2019 -0
- package/dist/cjs/styles/shared-styles.js.map +1 -0
- package/dist/cjs/styles/utility-styles.js +182 -0
- package/dist/cjs/styles/utility-styles.js.map +1 -0
- package/dist/esm/components/fw-sc-advanced.js +198 -0
- package/dist/esm/components/fw-sc-advanced.js.map +1 -0
- package/dist/esm/components/fw-sc-compositor.js +116 -0
- package/dist/esm/components/fw-sc-compositor.js.map +1 -0
- package/dist/esm/components/fw-sc-layer-list.js +253 -0
- package/dist/esm/components/fw-sc-layer-list.js.map +1 -0
- package/dist/esm/components/fw-sc-scene-switcher.js +164 -0
- package/dist/esm/components/fw-sc-scene-switcher.js.map +1 -0
- package/dist/esm/components/fw-sc-volume.js +183 -0
- package/dist/esm/components/fw-sc-volume.js.map +1 -0
- package/dist/esm/components/fw-streamcrafter.js +508 -0
- package/dist/esm/components/fw-streamcrafter.js.map +1 -0
- package/dist/esm/controllers/ingest-controller-host.js +234 -0
- package/dist/esm/controllers/ingest-controller-host.js.map +1 -0
- package/dist/esm/define.js +23 -0
- package/dist/esm/define.js.map +1 -0
- package/dist/esm/icons/index.js +253 -0
- package/dist/esm/icons/index.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/esm/styles/shared-styles.js +2017 -0
- package/dist/esm/styles/shared-styles.js.map +1 -0
- package/dist/esm/styles/utility-styles.js +180 -0
- package/dist/esm/styles/utility-styles.js.map +1 -0
- package/dist/fw-streamcrafter.iife.js +3121 -0
- package/dist/fw-streamcrafter.iife.js.map +1 -0
- package/dist/types/components/fw-sc-advanced.d.ts +20 -0
- package/dist/types/components/fw-sc-compositor.d.ts +19 -0
- package/dist/types/components/fw-sc-layer-list.d.ts +30 -0
- package/dist/types/components/fw-sc-scene-switcher.d.ts +23 -0
- package/dist/types/components/fw-sc-volume.d.ts +30 -0
- package/dist/types/components/fw-streamcrafter.d.ts +49 -0
- package/dist/types/controllers/ingest-controller-host.d.ts +77 -0
- package/dist/types/define.d.ts +1 -0
- package/dist/types/icons/index.d.ts +29 -0
- package/dist/types/iife-entry.d.ts +11 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/styles/shared-styles.d.ts +1 -0
- package/dist/types/styles/utility-styles.d.ts +1 -0
- package/package.json +55 -0
- package/src/components/fw-sc-advanced.ts +221 -0
- package/src/components/fw-sc-compositor.ts +162 -0
- package/src/components/fw-sc-layer-list.ts +251 -0
- package/src/components/fw-sc-scene-switcher.ts +163 -0
- package/src/components/fw-sc-volume.ts +171 -0
- package/src/components/fw-streamcrafter.ts +515 -0
- package/src/controllers/ingest-controller-host.ts +358 -0
- package/src/define.ts +23 -0
- package/src/icons/index.ts +291 -0
- package/src/iife-entry.ts +11 -0
- package/src/index.ts +15 -0
- package/src/styles/shared-styles.ts +2014 -0
- package/src/styles/utility-styles.ts +177 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
7
|
+
var sharedStyles = require('../styles/shared-styles.js');
|
|
8
|
+
var utilityStyles = require('../styles/utility-styles.js');
|
|
9
|
+
var index = require('../icons/index.js');
|
|
10
|
+
|
|
11
|
+
exports.FwScAdvanced = class FwScAdvanced extends lit.LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this._activeTab = "stats";
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return lit.html `
|
|
18
|
+
<div class="panel">
|
|
19
|
+
<div class="header">
|
|
20
|
+
<div class="tabs">
|
|
21
|
+
<button
|
|
22
|
+
class=${classMap_js.classMap({ tab: true, "tab--active": this._activeTab === "stats" })}
|
|
23
|
+
@click=${() => {
|
|
24
|
+
this._activeTab = "stats";
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
Stats
|
|
28
|
+
</button>
|
|
29
|
+
<button
|
|
30
|
+
class=${classMap_js.classMap({ tab: true, "tab--active": this._activeTab === "info" })}
|
|
31
|
+
@click=${() => {
|
|
32
|
+
this._activeTab = "info";
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
Info
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
<button
|
|
39
|
+
class="close"
|
|
40
|
+
@click=${() => this.dispatchEvent(new CustomEvent("fw-close", { bubbles: true, composed: true }))}
|
|
41
|
+
aria-label="Close panel"
|
|
42
|
+
>
|
|
43
|
+
${index.xIcon(14)}
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="body">
|
|
47
|
+
${this._activeTab === "stats" ? this._renderStats() : this._renderInfo()}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
_renderStats() {
|
|
53
|
+
const s = this.ic.s;
|
|
54
|
+
const stats = s.stats;
|
|
55
|
+
return lit.html `
|
|
56
|
+
<div class="section">
|
|
57
|
+
<div class="label">Connection</div>
|
|
58
|
+
${this._row("State", s.state)}
|
|
59
|
+
${this._row("WebCodecs", s.isWebCodecsActive ? "Active" : s.useWebCodecs ? "Pending" : "Off")}
|
|
60
|
+
</div>
|
|
61
|
+
${stats
|
|
62
|
+
? lit.html `
|
|
63
|
+
<div class="section">
|
|
64
|
+
<div class="label">WebRTC Stats</div>
|
|
65
|
+
${this._row("Video bitrate", stats.video.bitrate ? `${Math.round(stats.video.bitrate / 1000)} kbps` : "—")}
|
|
66
|
+
${this._row("Audio bitrate", stats.audio.bitrate ? `${Math.round(stats.audio.bitrate / 1000)} kbps` : "—")}
|
|
67
|
+
${this._row("RTT", stats.connection.rtt ? `${(stats.connection.rtt * 1000).toFixed(0)} ms` : "—")}
|
|
68
|
+
${this._row("FPS", stats.video.framesPerSecond ? String(stats.video.framesPerSecond) : "—")}
|
|
69
|
+
${this._row("Packets sent", String(stats.video.packetsSent))}
|
|
70
|
+
${this._row("Packets lost", String(stats.video.packetsLost))}
|
|
71
|
+
</div>
|
|
72
|
+
`
|
|
73
|
+
: lit.nothing}
|
|
74
|
+
${s.encoderStats
|
|
75
|
+
? lit.html `
|
|
76
|
+
<div class="section">
|
|
77
|
+
<div class="label">Encoder</div>
|
|
78
|
+
${this._row("Video frames", String(s.encoderStats.video.framesEncoded))}
|
|
79
|
+
${this._row("Video pending", String(s.encoderStats.video.framesPending))}
|
|
80
|
+
${this._row("Audio samples", String(s.encoderStats.audio.samplesEncoded))}
|
|
81
|
+
</div>
|
|
82
|
+
`
|
|
83
|
+
: lit.nothing}
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
_renderInfo() {
|
|
87
|
+
const s = this.ic.s;
|
|
88
|
+
return lit.html `
|
|
89
|
+
<div class="section">
|
|
90
|
+
<div class="label">Configuration</div>
|
|
91
|
+
${this._row("Profile", s.qualityProfile)} ${this._row("Sources", String(s.sources.length))}
|
|
92
|
+
${this._row("WebCodecs Available", s.isWebCodecsAvailable ? "Yes" : "No")}
|
|
93
|
+
</div>
|
|
94
|
+
<div class="section">
|
|
95
|
+
<div class="label">Sources</div>
|
|
96
|
+
${s.sources.map((source) => lit.html `
|
|
97
|
+
${this._row(source.label, `${source.type} ${source.muted ? "(muted)" : ""}`)}
|
|
98
|
+
`)}
|
|
99
|
+
</div>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
_row(label, value) {
|
|
103
|
+
return lit.html `<div class="row">
|
|
104
|
+
<span class="row-label">${label}</span><span class="row-value">${value}</span>
|
|
105
|
+
</div>`;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.FwScAdvanced.styles = [
|
|
109
|
+
sharedStyles.sharedStyles,
|
|
110
|
+
utilityStyles.utilityStyles,
|
|
111
|
+
lit.css `
|
|
112
|
+
:host {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
.panel {
|
|
116
|
+
width: 320px;
|
|
117
|
+
height: 100%;
|
|
118
|
+
border-left: 1px solid rgba(90, 96, 127, 0.3);
|
|
119
|
+
background: #1a1b26;
|
|
120
|
+
overflow: auto;
|
|
121
|
+
font-size: 0.75rem;
|
|
122
|
+
color: #a9b1d6;
|
|
123
|
+
}
|
|
124
|
+
.header {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: space-between;
|
|
128
|
+
padding: 0.5rem 0.75rem;
|
|
129
|
+
border-bottom: 1px solid rgba(90, 96, 127, 0.3);
|
|
130
|
+
}
|
|
131
|
+
.tabs {
|
|
132
|
+
display: flex;
|
|
133
|
+
gap: 0.5rem;
|
|
134
|
+
}
|
|
135
|
+
.tab {
|
|
136
|
+
padding: 0.25rem 0.5rem;
|
|
137
|
+
border: none;
|
|
138
|
+
background: none;
|
|
139
|
+
color: #565f89;
|
|
140
|
+
font-size: 0.6875rem;
|
|
141
|
+
font-weight: 600;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
border-radius: 0.25rem;
|
|
144
|
+
}
|
|
145
|
+
.tab--active {
|
|
146
|
+
color: #c0caf5;
|
|
147
|
+
background: rgba(90, 96, 127, 0.2);
|
|
148
|
+
}
|
|
149
|
+
.close {
|
|
150
|
+
display: flex;
|
|
151
|
+
background: none;
|
|
152
|
+
border: none;
|
|
153
|
+
color: #565f89;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
padding: 0;
|
|
156
|
+
}
|
|
157
|
+
.close:hover {
|
|
158
|
+
color: #c0caf5;
|
|
159
|
+
}
|
|
160
|
+
.body {
|
|
161
|
+
padding: 0.75rem;
|
|
162
|
+
}
|
|
163
|
+
.section {
|
|
164
|
+
margin-bottom: 0.75rem;
|
|
165
|
+
}
|
|
166
|
+
.label {
|
|
167
|
+
font-size: 0.625rem;
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
text-transform: uppercase;
|
|
170
|
+
letter-spacing: 0.05em;
|
|
171
|
+
color: #565f89;
|
|
172
|
+
margin-bottom: 0.375rem;
|
|
173
|
+
}
|
|
174
|
+
.row {
|
|
175
|
+
display: flex;
|
|
176
|
+
justify-content: space-between;
|
|
177
|
+
padding: 0.125rem 0;
|
|
178
|
+
}
|
|
179
|
+
.row-label {
|
|
180
|
+
color: #565f89;
|
|
181
|
+
}
|
|
182
|
+
.row-value {
|
|
183
|
+
color: #c0caf5;
|
|
184
|
+
font-family: ui-monospace, monospace;
|
|
185
|
+
font-variant-numeric: tabular-nums;
|
|
186
|
+
}
|
|
187
|
+
`,
|
|
188
|
+
];
|
|
189
|
+
tslib_es6.__decorate([
|
|
190
|
+
decorators_js.property({ attribute: false })
|
|
191
|
+
], exports.FwScAdvanced.prototype, "ic", void 0);
|
|
192
|
+
tslib_es6.__decorate([
|
|
193
|
+
decorators_js.state()
|
|
194
|
+
], exports.FwScAdvanced.prototype, "_activeTab", void 0);
|
|
195
|
+
exports.FwScAdvanced = tslib_es6.__decorate([
|
|
196
|
+
decorators_js.customElement("fw-sc-advanced")
|
|
197
|
+
], exports.FwScAdvanced);
|
|
198
|
+
//# sourceMappingURL=fw-sc-advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-sc-advanced.js","sources":["../../../../src/components/fw-sc-advanced.ts"],"sourcesContent":[null],"names":["FwScAdvanced","LitElement","html","classMap","xIcon","nothing","sharedStyles","utilityStyles","css","__decorate","property","state","customElement"],"mappings":";;;;;;;;;;AAeaA,oBAAY,GAAlB,MAAM,YAAa,SAAQC,cAAU,CAAA;AAArC,IAAA,WAAA,GAAA;;QAGY,IAAA,CAAA,UAAU,GAAU,OAAO;IAoM9C;IAhHY,MAAM,GAAA;AACd,QAAA,OAAOC,QAAI,CAAA;;;;;AAKO,oBAAA,EAAAC,oBAAQ,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE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uC,CAAA,EAAAX,oBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAHlCA,oBAAY,GAAAS,oBAAA,CAAA;IADxBG,2BAAa,CAAC,gBAAgB;AAClB,CAAA,EAAAZ,oBAAY,CAuMxB;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var sharedStyles = require('../styles/shared-styles.js');
|
|
7
|
+
var utilityStyles = require('../styles/utility-styles.js');
|
|
8
|
+
var index = require('../icons/index.js');
|
|
9
|
+
var streamcrafterCore = require('@livepeer-frameworks/streamcrafter-core');
|
|
10
|
+
|
|
11
|
+
const LAYOUT_PRESETS_UI = [
|
|
12
|
+
{ mode: "solo", label: "Solo", icon: index.soloIcon, minSources: 1 },
|
|
13
|
+
{ mode: "pip-br", label: "PiP ↘", icon: index.pipBRIcon, minSources: 2 },
|
|
14
|
+
{ mode: "pip-bl", label: "PiP ↙", icon: index.pipBLIcon, minSources: 2 },
|
|
15
|
+
{ mode: "pip-tr", label: "PiP ↗", icon: index.pipTRIcon, minSources: 2 },
|
|
16
|
+
{ mode: "pip-tl", label: "PiP ↖", icon: index.pipTLIcon, minSources: 2 },
|
|
17
|
+
{ mode: "split-h", label: "Split ⬌", icon: index.splitHIcon, minSources: 2 },
|
|
18
|
+
{ mode: "split-v", label: "Split ⬍", icon: index.splitVIcon, minSources: 2 },
|
|
19
|
+
{ mode: "focus-l", label: "Focus ◀", icon: index.focusLIcon, minSources: 2 },
|
|
20
|
+
{ mode: "focus-r", label: "Focus ▶", icon: index.focusRIcon, minSources: 2 },
|
|
21
|
+
{ mode: "pip-dual-br", label: "Main+2 PiP", icon: index.dualPipIcon, minSources: 3 },
|
|
22
|
+
{ mode: "split-pip-r", label: "Split+PiP", icon: index.splitPipIcon, minSources: 3 },
|
|
23
|
+
{ mode: "featured", label: "Featured", icon: index.featuredIcon, minSources: 3 },
|
|
24
|
+
{ mode: "featured-r", label: "Featured ▶", icon: index.featuredRIcon, minSources: 3 },
|
|
25
|
+
{ mode: "grid", label: "Grid", icon: index.gridIcon, minSources: 2 },
|
|
26
|
+
{ mode: "stack", label: "Stack", icon: index.stackIcon, minSources: 2 },
|
|
27
|
+
];
|
|
28
|
+
const SCALING_MODES = [
|
|
29
|
+
{ mode: "letterbox", icon: index.letterboxIcon, label: "Letterbox (fit)" },
|
|
30
|
+
{ mode: "crop", icon: index.cropIcon, label: "Crop (fill)" },
|
|
31
|
+
{ mode: "stretch", icon: index.stretchIcon, label: "Stretch" },
|
|
32
|
+
];
|
|
33
|
+
exports.FwScCompositor = class FwScCompositor extends lit.LitElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this._tooltipText = "";
|
|
37
|
+
this._tooltipTarget = null;
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
// Compositor uses controller compositor API — for now render layout bar from CSS classes
|
|
41
|
+
const sources = this.ic.s.sources;
|
|
42
|
+
const visibleSourceCount = sources.length;
|
|
43
|
+
const availableLayouts = LAYOUT_PRESETS_UI.filter((preset) => streamcrafterCore.isLayoutAvailable(preset.mode, visibleSourceCount));
|
|
44
|
+
return lit.html `
|
|
45
|
+
<div class="fw-sc-layout-overlay">
|
|
46
|
+
<div class="fw-sc-layout-bar">
|
|
47
|
+
<div class="fw-sc-layout-section">
|
|
48
|
+
<span class="fw-sc-layout-label">Layout</span>
|
|
49
|
+
<div class="fw-sc-layout-icons">
|
|
50
|
+
${availableLayouts.map((preset) => lit.html `
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
class="fw-sc-layout-icon"
|
|
54
|
+
@click=${(e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
this._handleLayoutSelect(preset.mode);
|
|
57
|
+
}}
|
|
58
|
+
title=${preset.label}
|
|
59
|
+
>
|
|
60
|
+
${preset.icon()}
|
|
61
|
+
</button>
|
|
62
|
+
`)}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="fw-sc-layout-separator"></div>
|
|
66
|
+
<div class="fw-sc-layout-section">
|
|
67
|
+
<span class="fw-sc-layout-label">Display</span>
|
|
68
|
+
<div class="fw-sc-scaling-icons">
|
|
69
|
+
${SCALING_MODES.map((sm) => lit.html `
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
class="fw-sc-layout-icon"
|
|
73
|
+
@click=${(e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
}}
|
|
76
|
+
title=${sm.label}
|
|
77
|
+
>
|
|
78
|
+
${sm.icon()}
|
|
79
|
+
</button>
|
|
80
|
+
`)}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
_handleLayoutSelect(mode) {
|
|
88
|
+
this.dispatchEvent(new CustomEvent("fw-sc-layout-select", {
|
|
89
|
+
detail: { mode },
|
|
90
|
+
bubbles: true,
|
|
91
|
+
composed: true,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.FwScCompositor.styles = [
|
|
96
|
+
sharedStyles.sharedStyles,
|
|
97
|
+
utilityStyles.utilityStyles,
|
|
98
|
+
lit.css `
|
|
99
|
+
:host {
|
|
100
|
+
display: contents;
|
|
101
|
+
}
|
|
102
|
+
`,
|
|
103
|
+
];
|
|
104
|
+
tslib_es6.__decorate([
|
|
105
|
+
decorators_js.property({ attribute: false })
|
|
106
|
+
], exports.FwScCompositor.prototype, "ic", void 0);
|
|
107
|
+
tslib_es6.__decorate([
|
|
108
|
+
decorators_js.state()
|
|
109
|
+
], exports.FwScCompositor.prototype, "_tooltipText", void 0);
|
|
110
|
+
tslib_es6.__decorate([
|
|
111
|
+
decorators_js.state()
|
|
112
|
+
], exports.FwScCompositor.prototype, "_tooltipTarget", void 0);
|
|
113
|
+
exports.FwScCompositor = tslib_es6.__decorate([
|
|
114
|
+
decorators_js.customElement("fw-sc-compositor")
|
|
115
|
+
], exports.FwScCompositor);
|
|
116
|
+
//# sourceMappingURL=fw-sc-compositor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-sc-compositor.js","sources":["../../../../src/components/fw-sc-compositor.ts"],"sourcesContent":[null],"names":["soloIcon","pipBRIcon","pipBLIcon","pipTRIcon","pipTLIcon","splitHIcon","splitVIcon","focusLIcon","focusRIcon","dualPipIcon","splitPipIcon","featuredIcon","featuredRIcon","gridIcon","stackIcon","letterboxIcon","cropIcon","stretchIcon","FwScCompositor","LitElement","isLayoutAvailable","html","sharedStyles","utilityStyles","css","__decorate","property","state","customElement"],"mappings":";;;;;;;;;;AA4CA,MAAM,iBAAiB,GAAqB;AAC1C,IAAA,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAEA,cAAQ,EAAE,UAAU,EAAE,CAAC,EAAE;AAC9D,IAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAEC,eAAS,EAAE,UAAU,EAAE,CAAC,EAAE;AAClE,IAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAEC,eAAS,EAAE,UAAU,EAAE,CAAC,EAAE;AAClE,IAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAEC,eAAS,EAAE,UAAU,EAAE,CAAC,EAAE;AAClE,IAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAEC,eAAS,EAAE,UAAU,EAAE,CA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AEQ,IAAA,mBAAmB,CAAC,IAAgB,EAAA;AAC1C,QAAA,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,qBAAqB,EAAE;YACrC,MAAM,EAAE,EAAE,IAAI,EAAE;AAChB,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC,CACH;IACH;;AA3EOH,sBAAA,CAAA,MAAM,GAAG;IACdI,yBAAY;IACZC,2BAAa;AACb,IAAAC,OAAG,CAAA;;;;AAIF,IAAA,CAAA;AACF,CARY;AALmBC,oBAAA,CAAA;AAA/B,IAAAC,sBAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AAA4B,CAAA,EAAAR,sBAAA,CAAA,SAAA,EAAA,IAAA,EAAA,MAAA,CAAA;AAEzCO,oBAAA,CAAA;AAAhB,IAAAE,mBAAK;AAA6B,CAAA,EAAAT,sBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAClBO,oBAAA,CAAA;AAAhB,IAAAE,mBAAK;AAAiD,CAAA,EAAAT,sBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAJ5CA,sBAAc,GAAAO,oBAAA,CAAA;IAD1BG,2BAAa,CAAC,kBAAkB;AACpB,CAAA,EAAAV,sBAAc,CAkF1B;;"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
7
|
+
var sharedStyles = require('../styles/shared-styles.js');
|
|
8
|
+
var utilityStyles = require('../styles/utility-styles.js');
|
|
9
|
+
var index = require('../icons/index.js');
|
|
10
|
+
|
|
11
|
+
exports.FwScLayerList = class FwScLayerList extends lit.LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.layers = [];
|
|
15
|
+
this.sources = [];
|
|
16
|
+
this.selectedLayerId = null;
|
|
17
|
+
this._draggedId = null;
|
|
18
|
+
this._dragOverId = null;
|
|
19
|
+
this._editingLayerId = null;
|
|
20
|
+
}
|
|
21
|
+
get _sortedLayers() {
|
|
22
|
+
return [...this.layers].sort((a, b) => b.zIndex - a.zIndex);
|
|
23
|
+
}
|
|
24
|
+
_getSourceLabel(sourceId) {
|
|
25
|
+
const source = this.sources.find((s) => s.id === sourceId);
|
|
26
|
+
return source?.label || sourceId;
|
|
27
|
+
}
|
|
28
|
+
_getSourceIcon(sourceId) {
|
|
29
|
+
const source = this.sources.find((s) => s.id === sourceId);
|
|
30
|
+
switch (source?.type) {
|
|
31
|
+
case "camera":
|
|
32
|
+
return index.cameraIcon(14);
|
|
33
|
+
case "screen":
|
|
34
|
+
return index.monitorIcon(14);
|
|
35
|
+
default:
|
|
36
|
+
return index.videoIcon(14);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
const sorted = this._sortedLayers;
|
|
41
|
+
return lit.html `
|
|
42
|
+
<div class="fw-sc-layer-list">
|
|
43
|
+
<div class="fw-sc-layer-list-header">
|
|
44
|
+
<span class="fw-sc-layer-list-title">Layers</span>
|
|
45
|
+
<span class="fw-sc-layer-count">${this.layers.length}</span>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="fw-sc-layer-items">
|
|
49
|
+
${sorted.length === 0
|
|
50
|
+
? lit.html ` <div class="fw-sc-layer-empty">No layers. Add a source to get started.</div> `
|
|
51
|
+
: sorted.map((layer, index$1) => lit.html `
|
|
52
|
+
<div
|
|
53
|
+
class=${classMap_js.classMap({
|
|
54
|
+
"fw-sc-layer-item": true,
|
|
55
|
+
"fw-sc-layer-item--selected": layer.id === this.selectedLayerId,
|
|
56
|
+
"fw-sc-layer-item--dragging": layer.id === this._draggedId,
|
|
57
|
+
"fw-sc-layer-item--drag-over": layer.id === this._dragOverId,
|
|
58
|
+
"fw-sc-layer-item--hidden": !layer.visible,
|
|
59
|
+
})}
|
|
60
|
+
draggable="true"
|
|
61
|
+
@dragstart=${(e) => this._handleDragStart(e, layer.id)}
|
|
62
|
+
@dragover=${(e) => this._handleDragOver(e, layer.id)}
|
|
63
|
+
@dragleave=${() => {
|
|
64
|
+
this._dragOverId = null;
|
|
65
|
+
}}
|
|
66
|
+
@drop=${(e) => this._handleDrop(e, layer.id)}
|
|
67
|
+
@dragend=${() => {
|
|
68
|
+
this._draggedId = null;
|
|
69
|
+
this._dragOverId = null;
|
|
70
|
+
}}
|
|
71
|
+
@click=${() => this._dispatch("fw-sc-layer-select", {
|
|
72
|
+
layerId: layer.id === this.selectedLayerId ? null : layer.id,
|
|
73
|
+
})}
|
|
74
|
+
>
|
|
75
|
+
<button
|
|
76
|
+
class=${classMap_js.classMap({
|
|
77
|
+
"fw-sc-layer-visibility": true,
|
|
78
|
+
"fw-sc-layer-visibility--visible": layer.visible,
|
|
79
|
+
})}
|
|
80
|
+
@click=${(e) => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
this._dispatch("fw-sc-visibility-toggle", {
|
|
83
|
+
layerId: layer.id,
|
|
84
|
+
visible: !layer.visible,
|
|
85
|
+
});
|
|
86
|
+
}}
|
|
87
|
+
title=${layer.visible ? "Hide layer" : "Show layer"}
|
|
88
|
+
>
|
|
89
|
+
${layer.visible ? index.eyeIcon(14) : index.eyeOffIcon(14)}
|
|
90
|
+
</button>
|
|
91
|
+
<span class="fw-sc-layer-icon">${this._getSourceIcon(layer.sourceId)}</span>
|
|
92
|
+
<span class="fw-sc-layer-name">${this._getSourceLabel(layer.sourceId)}</span>
|
|
93
|
+
|
|
94
|
+
${this._editingLayerId === layer.id
|
|
95
|
+
? lit.html `
|
|
96
|
+
<div class="fw-sc-layer-opacity">
|
|
97
|
+
<input
|
|
98
|
+
type="range"
|
|
99
|
+
min="0"
|
|
100
|
+
max="1"
|
|
101
|
+
step="0.1"
|
|
102
|
+
.value=${String(layer.transform.opacity)}
|
|
103
|
+
@input=${(e) => this._dispatch("fw-sc-transform-edit", {
|
|
104
|
+
layerId: layer.id,
|
|
105
|
+
transform: {
|
|
106
|
+
opacity: Number(e.target.value),
|
|
107
|
+
},
|
|
108
|
+
})}
|
|
109
|
+
@click=${(e) => e.stopPropagation()}
|
|
110
|
+
/>
|
|
111
|
+
<span>${Math.round(layer.transform.opacity * 100)}%</span>
|
|
112
|
+
</div>
|
|
113
|
+
`
|
|
114
|
+
: lit.nothing}
|
|
115
|
+
|
|
116
|
+
<div class="fw-sc-layer-controls">
|
|
117
|
+
<button
|
|
118
|
+
class="fw-sc-layer-btn"
|
|
119
|
+
@click=${(e) => {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
this._moveUp(layer.id);
|
|
122
|
+
}}
|
|
123
|
+
?disabled=${index$1 === 0}
|
|
124
|
+
title="Move up"
|
|
125
|
+
>
|
|
126
|
+
↑
|
|
127
|
+
</button>
|
|
128
|
+
<button
|
|
129
|
+
class="fw-sc-layer-btn"
|
|
130
|
+
@click=${(e) => {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
this._moveDown(layer.id);
|
|
133
|
+
}}
|
|
134
|
+
?disabled=${index$1 === sorted.length - 1}
|
|
135
|
+
title="Move down"
|
|
136
|
+
>
|
|
137
|
+
↓
|
|
138
|
+
</button>
|
|
139
|
+
<button
|
|
140
|
+
class=${classMap_js.classMap({
|
|
141
|
+
"fw-sc-layer-btn": true,
|
|
142
|
+
"fw-sc-layer-btn--active": this._editingLayerId === layer.id,
|
|
143
|
+
})}
|
|
144
|
+
@click=${(e) => {
|
|
145
|
+
e.stopPropagation();
|
|
146
|
+
this._editingLayerId =
|
|
147
|
+
this._editingLayerId === layer.id ? null : layer.id;
|
|
148
|
+
}}
|
|
149
|
+
title="Edit opacity"
|
|
150
|
+
>
|
|
151
|
+
⚙
|
|
152
|
+
</button>
|
|
153
|
+
<button
|
|
154
|
+
class="fw-sc-layer-btn fw-sc-layer-btn--danger"
|
|
155
|
+
@click=${(e) => {
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
this._dispatch("fw-sc-layer-remove", { layerId: layer.id });
|
|
158
|
+
}}
|
|
159
|
+
title="Remove layer"
|
|
160
|
+
>
|
|
161
|
+
×
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
`)}
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
_dispatch(name, detail) {
|
|
171
|
+
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
172
|
+
}
|
|
173
|
+
_handleDragStart(e, layerId) {
|
|
174
|
+
this._draggedId = layerId;
|
|
175
|
+
e.dataTransfer.effectAllowed = "move";
|
|
176
|
+
e.dataTransfer.setData("text/plain", layerId);
|
|
177
|
+
}
|
|
178
|
+
_handleDragOver(e, layerId) {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
e.dataTransfer.dropEffect = "move";
|
|
181
|
+
this._dragOverId = layerId;
|
|
182
|
+
}
|
|
183
|
+
_handleDrop(e, targetLayerId) {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
this._dragOverId = null;
|
|
186
|
+
if (!this._draggedId || this._draggedId === targetLayerId) {
|
|
187
|
+
this._draggedId = null;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const sorted = this._sortedLayers;
|
|
191
|
+
const currentIds = sorted.map((l) => l.id);
|
|
192
|
+
const fromIndex = currentIds.indexOf(this._draggedId);
|
|
193
|
+
const toIndex = currentIds.indexOf(targetLayerId);
|
|
194
|
+
if (fromIndex === -1 || toIndex === -1) {
|
|
195
|
+
this._draggedId = null;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const newOrder = [...currentIds];
|
|
199
|
+
newOrder.splice(fromIndex, 1);
|
|
200
|
+
newOrder.splice(toIndex, 0, this._draggedId);
|
|
201
|
+
this._dispatch("fw-sc-reorder", { layerIds: newOrder });
|
|
202
|
+
this._draggedId = null;
|
|
203
|
+
}
|
|
204
|
+
_moveUp(layerId) {
|
|
205
|
+
const sorted = this._sortedLayers;
|
|
206
|
+
const ids = sorted.map((l) => l.id);
|
|
207
|
+
const idx = ids.indexOf(layerId);
|
|
208
|
+
if (idx <= 0)
|
|
209
|
+
return;
|
|
210
|
+
[ids[idx - 1], ids[idx]] = [ids[idx], ids[idx - 1]];
|
|
211
|
+
this._dispatch("fw-sc-reorder", { layerIds: ids });
|
|
212
|
+
}
|
|
213
|
+
_moveDown(layerId) {
|
|
214
|
+
const sorted = this._sortedLayers;
|
|
215
|
+
const ids = sorted.map((l) => l.id);
|
|
216
|
+
const idx = ids.indexOf(layerId);
|
|
217
|
+
if (idx >= ids.length - 1)
|
|
218
|
+
return;
|
|
219
|
+
[ids[idx], ids[idx + 1]] = [ids[idx + 1], ids[idx]];
|
|
220
|
+
this._dispatch("fw-sc-reorder", { layerIds: ids });
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
exports.FwScLayerList.styles = [
|
|
224
|
+
sharedStyles.sharedStyles,
|
|
225
|
+
utilityStyles.utilityStyles,
|
|
226
|
+
lit.css `
|
|
227
|
+
:host {
|
|
228
|
+
display: block;
|
|
229
|
+
}
|
|
230
|
+
`,
|
|
231
|
+
];
|
|
232
|
+
tslib_es6.__decorate([
|
|
233
|
+
decorators_js.property({ attribute: false })
|
|
234
|
+
], exports.FwScLayerList.prototype, "layers", void 0);
|
|
235
|
+
tslib_es6.__decorate([
|
|
236
|
+
decorators_js.property({ attribute: false })
|
|
237
|
+
], exports.FwScLayerList.prototype, "sources", void 0);
|
|
238
|
+
tslib_es6.__decorate([
|
|
239
|
+
decorators_js.property({ type: String, attribute: "selected-layer-id" })
|
|
240
|
+
], exports.FwScLayerList.prototype, "selectedLayerId", void 0);
|
|
241
|
+
tslib_es6.__decorate([
|
|
242
|
+
decorators_js.state()
|
|
243
|
+
], exports.FwScLayerList.prototype, "_draggedId", void 0);
|
|
244
|
+
tslib_es6.__decorate([
|
|
245
|
+
decorators_js.state()
|
|
246
|
+
], exports.FwScLayerList.prototype, "_dragOverId", void 0);
|
|
247
|
+
tslib_es6.__decorate([
|
|
248
|
+
decorators_js.state()
|
|
249
|
+
], exports.FwScLayerList.prototype, "_editingLayerId", void 0);
|
|
250
|
+
exports.FwScLayerList = tslib_es6.__decorate([
|
|
251
|
+
decorators_js.customElement("fw-sc-layer-list")
|
|
252
|
+
], exports.FwScLayerList);
|
|
253
|
+
//# sourceMappingURL=fw-sc-layer-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-sc-layer-list.js","sources":["../../../../src/components/fw-sc-layer-list.ts"],"sourcesContent":[null],"names":["FwScLayerList","LitElement","cameraIcon","monitorIcon","videoIcon","html","index","classMap","eyeIcon","eyeOffIcon","nothing","sharedStyles","utilityStyles","css","__decorate","property","state","customElement"],"mappings":";;;;;;;;;;AAaaA,qBAAa,GAAnB,MAAM,aAAc,SAAQC,cAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;QAC2B,IAAA,CAAA,MAAM,GAAY,EAAE;QACpB,IAAA,CAAA,OAAO,GAAkB,EAAE;QACC,IAAA,CAAA,eAAe,GAAkB,IAAI;QAEhF,IAAA,CAAA,UAAU,GAAkB,IAAI;QAChC,IAAA,CAAA,WAAW,GAAkB,IAAI;QACjC,IAAA,CAAA,eAAe,GAAkB,IAAI;IAgOxD;AApNE,IAAA,IAAY,aAAa,GAAA;QACvB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D;AAEQ,IAAA,eAAe,CAAC,QAAgB,EAAA;A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