dsh-remote-plugin 0.6.14 → 0.6.15
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/apk/dsh-remote.apk +0 -0
- package/gateway.cjs +202 -23
- package/package.json +1 -1
- package/public/app.js +260 -34
- package/public/desktop/desktop.css +22 -7
- package/public/desktop/desktop.html +24 -4
- package/public/desktop/desktop.js +275 -26
- package/public/index.html +25 -8
- package/public/morphicons-init.js +41 -0
- package/public/motion.js +469 -0
- package/public/plugin.html +4 -1
- package/public/plugin.js +1 -0
- package/public/styles.css +20 -6
- package/public/update.json +8 -8
- package/public/vendor/gsap/NOTICE.md +10 -0
- package/public/vendor/gsap/gsap.min.js +11 -0
- package/public/vendor/morphicons/LICENSE +21 -0
- package/public/vendor/morphicons/README.md +10 -0
- package/public/vendor/morphicons/controller-CXZuwJ_M.js +152 -0
- package/public/vendor/morphicons/dom.js +206 -0
- package/public/vendor/morphicons/element.js +261 -0
- package/public/vendor/morphicons/normalize-CYnN3Npw.js +540 -0
- package/public/vendor/morphicons/spring-CFHloqPP.js +623 -0
- package/public/version.json +1 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { n as createController, t as computeInitialD } from "./controller-CXZuwJ_M.js";
|
|
2
|
+
//#region src/element/index.ts
|
|
3
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
4
|
+
const REACTIVE = [
|
|
5
|
+
"icon",
|
|
6
|
+
"from",
|
|
7
|
+
"to",
|
|
8
|
+
"progress",
|
|
9
|
+
"spring",
|
|
10
|
+
"reducedMotion"
|
|
11
|
+
];
|
|
12
|
+
const PRESENTATION = /* @__PURE__ */ new Set([
|
|
13
|
+
"size",
|
|
14
|
+
"color",
|
|
15
|
+
"stroke-width",
|
|
16
|
+
"absolute-stroke-width",
|
|
17
|
+
"label"
|
|
18
|
+
]);
|
|
19
|
+
const Base = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
|
|
20
|
+
var MorphIconElement = class extends Base {
|
|
21
|
+
static observedAttributes = [
|
|
22
|
+
"icon",
|
|
23
|
+
"from",
|
|
24
|
+
"to",
|
|
25
|
+
"progress",
|
|
26
|
+
"spring",
|
|
27
|
+
"reduced-motion",
|
|
28
|
+
"size",
|
|
29
|
+
"color",
|
|
30
|
+
"stroke-width",
|
|
31
|
+
"absolute-stroke-width",
|
|
32
|
+
"label"
|
|
33
|
+
];
|
|
34
|
+
#props = {};
|
|
35
|
+
#ctrl = null;
|
|
36
|
+
#path = null;
|
|
37
|
+
#adopted = false;
|
|
38
|
+
#preConnectDirty = false;
|
|
39
|
+
#size = "24";
|
|
40
|
+
#color = "currentColor";
|
|
41
|
+
#strokeWidth = "2";
|
|
42
|
+
#absoluteStrokeWidth = false;
|
|
43
|
+
#label = null;
|
|
44
|
+
get icon() {
|
|
45
|
+
return this.#props.icon;
|
|
46
|
+
}
|
|
47
|
+
set icon(v) {
|
|
48
|
+
this.#props.icon = v;
|
|
49
|
+
this.#watch();
|
|
50
|
+
}
|
|
51
|
+
get from() {
|
|
52
|
+
return this.#props.from;
|
|
53
|
+
}
|
|
54
|
+
set from(v) {
|
|
55
|
+
this.#props.from = v;
|
|
56
|
+
this.#watch();
|
|
57
|
+
}
|
|
58
|
+
get to() {
|
|
59
|
+
return this.#props.to;
|
|
60
|
+
}
|
|
61
|
+
set to(v) {
|
|
62
|
+
this.#props.to = v;
|
|
63
|
+
this.#watch();
|
|
64
|
+
}
|
|
65
|
+
get progress() {
|
|
66
|
+
return this.#props.progress;
|
|
67
|
+
}
|
|
68
|
+
set progress(v) {
|
|
69
|
+
this.#props.progress = v;
|
|
70
|
+
this.#watch();
|
|
71
|
+
}
|
|
72
|
+
get spring() {
|
|
73
|
+
return this.#props.spring;
|
|
74
|
+
}
|
|
75
|
+
set spring(v) {
|
|
76
|
+
this.#props.spring = v;
|
|
77
|
+
this.#watch();
|
|
78
|
+
}
|
|
79
|
+
get reducedMotion() {
|
|
80
|
+
return this.#props.reducedMotion;
|
|
81
|
+
}
|
|
82
|
+
set reducedMotion(v) {
|
|
83
|
+
this.#props.reducedMotion = v;
|
|
84
|
+
this.#watch();
|
|
85
|
+
}
|
|
86
|
+
morphTo(icon, spring) {
|
|
87
|
+
const ctrl = this.#ctrl;
|
|
88
|
+
if (!ctrl) {
|
|
89
|
+
this.#imperativeBeforeDriver(icon);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
ctrl.morphTo(icon, spring ?? this.#props.spring);
|
|
93
|
+
}
|
|
94
|
+
set(icon) {
|
|
95
|
+
const ctrl = this.#ctrl;
|
|
96
|
+
if (!ctrl) {
|
|
97
|
+
this.#imperativeBeforeDriver(icon);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
ctrl.set(icon);
|
|
101
|
+
}
|
|
102
|
+
connectedCallback() {
|
|
103
|
+
for (const key of REACTIVE) this.#upgradeProperty(key);
|
|
104
|
+
if (!this.#path) this.#adoptOrRender();
|
|
105
|
+
if (this.style.display === "") this.style.display = "contents";
|
|
106
|
+
if (this.#path && !this.#ctrl) {
|
|
107
|
+
const path = this.#path;
|
|
108
|
+
const gate = this.#adopted && !this.#preConnectDirty;
|
|
109
|
+
this.#adopted = false;
|
|
110
|
+
this.#ctrl = createController(this.#props);
|
|
111
|
+
if (gate) {
|
|
112
|
+
let armed = false;
|
|
113
|
+
const gated = { setAttribute(name, value) {
|
|
114
|
+
if (armed) path.setAttribute(name, value);
|
|
115
|
+
} };
|
|
116
|
+
try {
|
|
117
|
+
this.#ctrl.mount(gated, this.#props);
|
|
118
|
+
} finally {
|
|
119
|
+
armed = true;
|
|
120
|
+
}
|
|
121
|
+
} else this.#ctrl.mount(path, this.#props);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
disconnectedCallback() {
|
|
125
|
+
this.#ctrl?.destroy();
|
|
126
|
+
this.#ctrl = null;
|
|
127
|
+
}
|
|
128
|
+
attributeChangedCallback(name, _old, value) {
|
|
129
|
+
switch (name) {
|
|
130
|
+
case "icon":
|
|
131
|
+
this.#props.icon = value ?? void 0;
|
|
132
|
+
break;
|
|
133
|
+
case "from":
|
|
134
|
+
this.#props.from = value ?? void 0;
|
|
135
|
+
break;
|
|
136
|
+
case "to":
|
|
137
|
+
this.#props.to = value ?? void 0;
|
|
138
|
+
break;
|
|
139
|
+
case "progress": {
|
|
140
|
+
const n = value === null ? NaN : Number(value);
|
|
141
|
+
this.#props.progress = Number.isFinite(n) ? n : void 0;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case "spring":
|
|
145
|
+
this.#props.spring = value ?? void 0;
|
|
146
|
+
break;
|
|
147
|
+
case "reduced-motion":
|
|
148
|
+
this.#props.reducedMotion = value ?? void 0;
|
|
149
|
+
break;
|
|
150
|
+
case "size":
|
|
151
|
+
this.#size = value ?? "24";
|
|
152
|
+
break;
|
|
153
|
+
case "color":
|
|
154
|
+
this.#color = value ?? "currentColor";
|
|
155
|
+
break;
|
|
156
|
+
case "stroke-width":
|
|
157
|
+
this.#strokeWidth = value ?? "2";
|
|
158
|
+
break;
|
|
159
|
+
case "absolute-stroke-width":
|
|
160
|
+
this.#absoluteStrokeWidth = value !== null;
|
|
161
|
+
break;
|
|
162
|
+
case "label": this.#label = value;
|
|
163
|
+
}
|
|
164
|
+
if (!this.#path) return;
|
|
165
|
+
if (PRESENTATION.has(name)) {
|
|
166
|
+
const svg = this.querySelector("svg");
|
|
167
|
+
if (svg) this.#applyPresentation(svg);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.#watch();
|
|
171
|
+
}
|
|
172
|
+
/** A property assigned before the element was defined lands as an own
|
|
173
|
+
* value that shadows the accessor; re-route it through the setter. */
|
|
174
|
+
#upgradeProperty(key) {
|
|
175
|
+
if (Object.hasOwn(this, key)) {
|
|
176
|
+
const self = this;
|
|
177
|
+
const v = self[key];
|
|
178
|
+
delete self[key];
|
|
179
|
+
self[key] = v;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
#watch() {
|
|
183
|
+
const ctrl = this.#ctrl;
|
|
184
|
+
if (!ctrl) {
|
|
185
|
+
this.#preConnectDirty = true;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
ctrl.watch(this.#props);
|
|
189
|
+
}
|
|
190
|
+
/** Imperative call before the controller exists: adopt the icon as the
|
|
191
|
+
* mount state AND exit controlled mode — "every imperative call
|
|
192
|
+
* invalidates the frozen pair" must hold pre-connect too, or a pending
|
|
193
|
+
* pair would win the mount and silently discard this call. */
|
|
194
|
+
#imperativeBeforeDriver(icon) {
|
|
195
|
+
this.#props.icon = icon;
|
|
196
|
+
this.#props.from = void 0;
|
|
197
|
+
this.#props.to = void 0;
|
|
198
|
+
this.#preConnectDirty = true;
|
|
199
|
+
}
|
|
200
|
+
/** SSR markup is adopted verbatim (the element never rewrites server bytes
|
|
201
|
+
* at rest); without it, the element renders its own <svg> like the
|
|
202
|
+
* framework shells do. */
|
|
203
|
+
#adoptOrRender() {
|
|
204
|
+
const existing = this.querySelector("path");
|
|
205
|
+
if (existing) {
|
|
206
|
+
this.#path = existing;
|
|
207
|
+
this.#adopted = true;
|
|
208
|
+
const p = this.#props;
|
|
209
|
+
if (p.icon === void 0 && p.from === void 0 && p.to === void 0) {
|
|
210
|
+
const d = existing.getAttribute("d");
|
|
211
|
+
if (d) p.icon = d;
|
|
212
|
+
}
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const doc = this.ownerDocument;
|
|
216
|
+
const svg = doc.createElementNS(SVG_NS, "svg");
|
|
217
|
+
svg.setAttribute("xmlns", SVG_NS);
|
|
218
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
219
|
+
svg.setAttribute("fill", "none");
|
|
220
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
221
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
222
|
+
this.#applyPresentation(svg);
|
|
223
|
+
const path = doc.createElementNS(SVG_NS, "path");
|
|
224
|
+
path.setAttribute("d", computeInitialD(this.#props));
|
|
225
|
+
svg.appendChild(path);
|
|
226
|
+
this.appendChild(svg);
|
|
227
|
+
this.#path = path;
|
|
228
|
+
}
|
|
229
|
+
#applyPresentation(svg) {
|
|
230
|
+
svg.setAttribute("width", this.#size);
|
|
231
|
+
svg.setAttribute("height", this.#size);
|
|
232
|
+
svg.setAttribute("stroke", this.#color);
|
|
233
|
+
const sw = this.#absoluteStrokeWidth ? String(Number(this.#strokeWidth) * 24 / Number(this.#size)) : this.#strokeWidth;
|
|
234
|
+
svg.setAttribute("stroke-width", sw);
|
|
235
|
+
const label = this.#label;
|
|
236
|
+
let title = svg.querySelector("title");
|
|
237
|
+
if (label) {
|
|
238
|
+
svg.setAttribute("role", "img");
|
|
239
|
+
svg.removeAttribute("aria-hidden");
|
|
240
|
+
if (!title) {
|
|
241
|
+
title = this.ownerDocument.createElementNS(SVG_NS, "title");
|
|
242
|
+
svg.insertBefore(title, svg.firstChild);
|
|
243
|
+
}
|
|
244
|
+
title.textContent = label;
|
|
245
|
+
} else {
|
|
246
|
+
svg.removeAttribute("role");
|
|
247
|
+
svg.setAttribute("aria-hidden", "true");
|
|
248
|
+
title?.remove();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
let registered = false;
|
|
253
|
+
/** Defines `<morph-icon>` (or a custom tag). Idempotent per tag; a no-op
|
|
254
|
+
* without a DOM (safe to call from code that also runs during SSR). */
|
|
255
|
+
function defineMorphIcon(tag = "morph-icon") {
|
|
256
|
+
if (typeof customElements === "undefined" || customElements.get(tag)) return;
|
|
257
|
+
customElements.define(tag, registered ? class extends MorphIconElement {} : MorphIconElement);
|
|
258
|
+
registered = true;
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
export { MorphIconElement, computeInitialD, defineMorphIcon };
|