vintage-frames 0.2.1 → 0.4.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/custom-elements.json +204 -7
- package/dist/components/vf-button.js +25 -25
- package/dist/components/vf-checkbox.js +15 -15
- package/dist/components/vf-desktop.d.ts +51 -3
- package/dist/components/vf-desktop.js +57 -48
- package/dist/components/vf-icon.d.ts +19 -4
- package/dist/components/vf-icon.js +65 -55
- package/dist/components/vf-list-item.js +16 -16
- package/dist/components/vf-list.js +26 -26
- package/dist/components/vf-menu-bar.d.ts +8 -0
- package/dist/components/vf-menu-bar.js +5 -2
- package/dist/components/vf-menu-item.d.ts +12 -6
- package/dist/components/vf-menu-item.js +47 -29
- package/dist/components/vf-menu.d.ts +14 -1
- package/dist/components/vf-menu.js +85 -65
- package/dist/components/vf-number-field.js +17 -17
- package/dist/components/vf-radio-group.js +13 -13
- package/dist/components/vf-radio.js +16 -16
- package/dist/components/vf-select.js +27 -27
- package/dist/components/vf-slider.js +24 -24
- package/dist/components/vf-window.d.ts +26 -0
- package/dist/components/vf-window.js +105 -56
- package/dist/index.js +29 -29
- package/dist/modal-dialog.js +21 -21
- package/dist/text-control.js +11 -11
- package/dist/toggle-control.js +5 -5
- package/docs/SPEC.md +16 -11
- package/editor/vscode.html-custom-data.json +20 -5
- package/editor/web-types.json +67 -10
- package/package.json +4 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { deferActivation as e, emit as t } from "../events.js";
|
|
2
|
+
import { vfElement as n } from "../define.js";
|
|
3
|
+
import { ScaleController as r } from "../scale.js";
|
|
4
|
+
import i from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
|
+
import { VfPositioned as a } from "../position.js";
|
|
6
|
+
import { vfDisplay as o } from "../styles/recipes/display-face.js";
|
|
7
|
+
import { vfBase as s } from "../styles/recipes/host.js";
|
|
8
|
+
import { vfPanel as c } from "../styles/recipes/surface.js";
|
|
9
|
+
import { vfFocusUnderline as l } from "../styles/recipes/focus.js";
|
|
10
|
+
import { GridSnapController as u } from "../grid-snap.js";
|
|
11
|
+
import { DocumentListenersController as d, releaseAfterGesture as f } from "../document-listeners.js";
|
|
12
|
+
import { runSelectionBlink as p } from "../motion.js";
|
|
13
|
+
import { FocusRuleController as m } from "../focus-modality.js";
|
|
14
|
+
import { TypeAheadBuffer as h } from "../type-ahead.js";
|
|
15
|
+
import { MenuPressController as g } from "../menu-press.js";
|
|
16
|
+
import { LitElement as _, css as v, html as y, nothing as b } from "lit";
|
|
17
|
+
import { property as x, query as S, queryAssignedElements as C, state as w } from "lit/decorators.js";
|
|
17
18
|
//#region src/components/vf-menu.ts
|
|
18
|
-
var
|
|
19
|
+
var T = class extends a(_) {
|
|
19
20
|
constructor(...e) {
|
|
20
|
-
super(...e), this.scale = new
|
|
21
|
+
super(...e), this.scale = new r(this), this.gridSnap = new u(this), this.#e = new m(this), this.label = "", this.open = !1, this.shortcuts = !1, this.barTabIndex = 0, this.#t = new g(this, {
|
|
21
22
|
menus: () => [this],
|
|
22
23
|
open: (e) => {
|
|
23
24
|
e.open = !0;
|
|
@@ -25,11 +26,17 @@ var C = class extends r(g) {
|
|
|
25
26
|
close: () => {
|
|
26
27
|
this.open = !1;
|
|
27
28
|
}
|
|
28
|
-
}), this.#r = this.attachInternals(), this.#i = new
|
|
29
|
+
}), this.#r = this.attachInternals(), this.#i = new h(), this.#a = !1, this.#o = () => {
|
|
29
30
|
this.#n || this.focus(), this.open = !1;
|
|
30
|
-
}, this.#
|
|
31
|
+
}, this._flashOn = !1, this.#c = () => {
|
|
32
|
+
this.open || (this.#l(), this.#s = p((e) => {
|
|
33
|
+
this._flashOn = e;
|
|
34
|
+
}, () => {
|
|
35
|
+
this._flashOn = !1, this.#s = void 0;
|
|
36
|
+
}));
|
|
37
|
+
}, this.#u = (e) => {
|
|
31
38
|
e.composedPath().includes(this) || (this.open = !1);
|
|
32
|
-
}, this.#
|
|
39
|
+
}, this.#d = (e) => {
|
|
33
40
|
if (!e.defaultPrevented) switch (e.key) {
|
|
34
41
|
case "Escape":
|
|
35
42
|
e.preventDefault(), this.open = !1, this.focus();
|
|
@@ -39,7 +46,7 @@ var C = class extends r(g) {
|
|
|
39
46
|
break;
|
|
40
47
|
case "ArrowDown":
|
|
41
48
|
case "ArrowUp":
|
|
42
|
-
e.preventDefault(), this.#
|
|
49
|
+
e.preventDefault(), this.#f(e.key === "ArrowDown" ? 1 : -1);
|
|
43
50
|
break;
|
|
44
51
|
case "Home":
|
|
45
52
|
case "End": {
|
|
@@ -59,30 +66,30 @@ var C = class extends r(g) {
|
|
|
59
66
|
break;
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
|
-
}, this.#
|
|
69
|
+
}, this.#p = new d(this, () => [[
|
|
63
70
|
document,
|
|
64
71
|
"pointerdown",
|
|
65
|
-
this.#
|
|
72
|
+
this.#u,
|
|
66
73
|
!0
|
|
67
74
|
], [
|
|
68
75
|
document,
|
|
69
76
|
"keydown",
|
|
70
|
-
this.#
|
|
77
|
+
this.#d,
|
|
71
78
|
!0
|
|
72
|
-
]]), this.#
|
|
79
|
+
]]), this.#h = (e) => {
|
|
73
80
|
if (!this.open || this.#n) return;
|
|
74
81
|
let t = e.relatedTarget;
|
|
75
82
|
t instanceof Node && (this.contains(t) || this.renderRoot.contains(t)) || (this.open = !1);
|
|
76
|
-
}, this.#
|
|
83
|
+
}, this.#g = (e) => {
|
|
77
84
|
this.#e.suppress(), !this.#n && this.#t.onPointerDown(e);
|
|
78
85
|
};
|
|
79
86
|
}
|
|
80
87
|
static {
|
|
81
88
|
this.styles = [
|
|
82
|
-
|
|
83
|
-
i,
|
|
89
|
+
s,
|
|
84
90
|
o,
|
|
85
|
-
|
|
91
|
+
c,
|
|
92
|
+
v`
|
|
86
93
|
:host {
|
|
87
94
|
display: inline-block;
|
|
88
95
|
position: relative;
|
|
@@ -105,7 +112,12 @@ var C = class extends r(g) {
|
|
|
105
112
|
touch-action: none;
|
|
106
113
|
cursor: var(--vf-cursor, default);
|
|
107
114
|
}
|
|
108
|
-
|
|
115
|
+
/* .flash-on: the key-equivalent acknowledgment — a closed menu whose
|
|
116
|
+
item was activated by its shortcut flashes the title on the item
|
|
117
|
+
blink's own cadence, the way MenuKey() flashed the bar. Shares the
|
|
118
|
+
open inversion so the two can't drift apart. */
|
|
119
|
+
:host([open]) .label,
|
|
120
|
+
.label.flash-on {
|
|
109
121
|
/* Forced colors: exempt the inverted title from the mode's text
|
|
110
122
|
backplate, which would land a Canvas slab on the highlight bar —
|
|
111
123
|
see vf-list-item's forced-colors note. The pair is already the
|
|
@@ -169,7 +181,7 @@ var C = class extends r(g) {
|
|
|
169
181
|
}
|
|
170
182
|
:host(:not([open])) .label.vf-focus-rule .title::after {
|
|
171
183
|
--vf-focus-underline-offset: -2px;
|
|
172
|
-
${
|
|
184
|
+
${l}
|
|
173
185
|
}
|
|
174
186
|
.panel {
|
|
175
187
|
position: absolute;
|
|
@@ -240,30 +252,35 @@ var C = class extends r(g) {
|
|
|
240
252
|
#o;
|
|
241
253
|
#s;
|
|
242
254
|
#c;
|
|
243
|
-
#l(
|
|
255
|
+
#l() {
|
|
256
|
+
this.#s?.cancel(), this.#s = void 0, this._flashOn = !1;
|
|
257
|
+
}
|
|
258
|
+
#u;
|
|
259
|
+
#d;
|
|
260
|
+
#f(e) {
|
|
244
261
|
let t = this.items;
|
|
245
262
|
if (t.length === 0) return;
|
|
246
263
|
let n = t.indexOf(document.activeElement), r;
|
|
247
264
|
r = n < 0 ? e === 1 ? 0 : t.length - 1 : (n + e + t.length) % t.length, t[r]?.focus();
|
|
248
265
|
}
|
|
249
|
-
#
|
|
266
|
+
#p;
|
|
250
267
|
connectedCallback() {
|
|
251
|
-
super.connectedCallback(), this.#
|
|
268
|
+
super.connectedCallback(), this.#m(), this.requestUpdate(), this.addEventListener("vf-menu-close-request", this.#o), this.addEventListener("vf-menu-flash-request", this.#c), this.addEventListener("pointerdown", this.#g), this.addEventListener("focusout", this.#h);
|
|
252
269
|
}
|
|
253
|
-
#
|
|
270
|
+
#m() {
|
|
254
271
|
this.#r.role = this.#n ? "none" : null;
|
|
255
272
|
}
|
|
256
273
|
disconnectedCallback() {
|
|
257
|
-
super.disconnectedCallback(), this.removeEventListener("vf-menu-close-request", this.#o), this.removeEventListener("pointerdown", this.#
|
|
274
|
+
super.disconnectedCallback(), this.removeEventListener("vf-menu-close-request", this.#o), this.removeEventListener("vf-menu-flash-request", this.#c), this.removeEventListener("pointerdown", this.#g), this.removeEventListener("focusout", this.#h), this.#l();
|
|
258
275
|
}
|
|
259
|
-
#
|
|
276
|
+
#h;
|
|
260
277
|
updated(e) {
|
|
261
278
|
if (e.has("open")) {
|
|
262
|
-
if (this.open && !this.#n ? this.#
|
|
279
|
+
if (this.open && this.#l(), this.open && !this.#n ? this.#p.attach() : this.#p.detach(), !this.open) for (let e of this.allItems) e.active = !1;
|
|
263
280
|
this.open || this.#i.reset();
|
|
264
281
|
}
|
|
265
282
|
}
|
|
266
|
-
#
|
|
283
|
+
#g;
|
|
267
284
|
focus(e) {
|
|
268
285
|
this._labelEl?.focus(e);
|
|
269
286
|
}
|
|
@@ -271,19 +288,19 @@ var C = class extends r(g) {
|
|
|
271
288
|
this.focus();
|
|
272
289
|
}
|
|
273
290
|
render() {
|
|
274
|
-
return
|
|
291
|
+
return y`
|
|
275
292
|
<div
|
|
276
|
-
class="label vf-snap ${this.#e.marked ? "vf-focus-rule" : ""}"
|
|
293
|
+
class="label vf-snap ${this.#e.marked ? "vf-focus-rule" : ""} ${this._flashOn ? "flash-on" : ""}"
|
|
277
294
|
part="label"
|
|
278
295
|
role=${this.#n ? "menuitem" : "button"}
|
|
279
296
|
tabindex=${this.barTabIndex}
|
|
280
297
|
aria-haspopup="menu"
|
|
281
298
|
aria-expanded=${this.open ? "true" : "false"}
|
|
282
|
-
aria-label=${this.label ||
|
|
283
|
-
@pointerdown=${this.#
|
|
284
|
-
@click=${this.#
|
|
285
|
-
@pointerenter=${this.#
|
|
286
|
-
@keydown=${this.#
|
|
299
|
+
aria-label=${this.label || b}
|
|
300
|
+
@pointerdown=${this.#v}
|
|
301
|
+
@click=${this.#y}
|
|
302
|
+
@pointerenter=${this.#b}
|
|
303
|
+
@keydown=${this.#x}
|
|
287
304
|
>
|
|
288
305
|
<span class="title"><slot name="label">${this.label}</slot></span>
|
|
289
306
|
</div>
|
|
@@ -291,57 +308,60 @@ var C = class extends r(g) {
|
|
|
291
308
|
class="panel vf-panel"
|
|
292
309
|
part="panel"
|
|
293
310
|
role="menu"
|
|
294
|
-
aria-label=${this.label ||
|
|
311
|
+
aria-label=${this.label || b}
|
|
295
312
|
>
|
|
296
313
|
<slot></slot>
|
|
297
314
|
</div>
|
|
298
315
|
`;
|
|
299
316
|
}
|
|
300
|
-
#
|
|
317
|
+
#_() {
|
|
301
318
|
if (!this.#n) {
|
|
302
319
|
this.open = !this.open;
|
|
303
320
|
return;
|
|
304
321
|
}
|
|
305
|
-
|
|
322
|
+
t(this, "vf-menu-toggle-request", { menu: this }, {
|
|
306
323
|
cancelable: !0,
|
|
307
324
|
composed: !1
|
|
308
325
|
}) && (this.open = !this.open);
|
|
309
326
|
}
|
|
310
|
-
#
|
|
311
|
-
this.#a = !0,
|
|
327
|
+
#v() {
|
|
328
|
+
this.#a = !0, f(() => {
|
|
312
329
|
this.#a = !1;
|
|
313
330
|
});
|
|
314
331
|
}
|
|
315
|
-
#
|
|
332
|
+
#y(t) {
|
|
316
333
|
if (this.#a) {
|
|
317
334
|
this.#a = !1;
|
|
318
335
|
return;
|
|
319
336
|
}
|
|
320
|
-
|
|
337
|
+
e(this, t, () => this.#_());
|
|
321
338
|
}
|
|
322
|
-
#
|
|
323
|
-
|
|
339
|
+
#b() {
|
|
340
|
+
t(this, "vf-menu-hover", { menu: this }, { composed: !1 });
|
|
324
341
|
}
|
|
325
|
-
#
|
|
342
|
+
#x(e) {
|
|
326
343
|
if (e.key === "Enter" || e.key === " ") {
|
|
327
344
|
e.preventDefault();
|
|
328
345
|
let t = this.open;
|
|
329
|
-
this.#
|
|
330
|
-
} else e.key === "ArrowDown" && !this.open && (e.preventDefault(), this.#
|
|
346
|
+
this.#_(), !t && this.open && this.#S();
|
|
347
|
+
} else e.key === "ArrowDown" && !this.open && (e.preventDefault(), this.#_(), this.open && this.#S());
|
|
331
348
|
}
|
|
332
|
-
async #
|
|
349
|
+
async #S() {
|
|
333
350
|
await this.updateComplete, this.items[0]?.focus();
|
|
334
351
|
}
|
|
335
352
|
};
|
|
336
|
-
|
|
353
|
+
i([x()], T.prototype, "label", void 0), i([x({
|
|
354
|
+
type: Boolean,
|
|
355
|
+
reflect: !0
|
|
356
|
+
})], T.prototype, "open", void 0), i([x({
|
|
337
357
|
type: Boolean,
|
|
338
358
|
reflect: !0
|
|
339
|
-
})],
|
|
359
|
+
})], T.prototype, "shortcuts", void 0), i([x({
|
|
340
360
|
type: Number,
|
|
341
361
|
attribute: !1
|
|
342
|
-
})],
|
|
362
|
+
})], T.prototype, "barTabIndex", void 0), i([S(".label")], T.prototype, "_labelEl", void 0), i([C({
|
|
343
363
|
selector: "vf-menu-item",
|
|
344
364
|
flatten: !0
|
|
345
|
-
})],
|
|
365
|
+
})], T.prototype, "_assignedItems", void 0), i([w()], T.prototype, "_flashOn", void 0), T = i([n("vf-menu")], T);
|
|
346
366
|
//#endregion
|
|
347
|
-
export {
|
|
367
|
+
export { T as VfMenu };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { emitNative as e } from "../events.js";
|
|
2
|
+
import { vfElement as t } from "../define.js";
|
|
3
|
+
import n from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
4
|
+
import { VfPositioned as r } from "../position.js";
|
|
5
|
+
import { vfBase as i } from "../styles/recipes/host.js";
|
|
6
|
+
import { vfField as a } from "../styles/recipes/field.js";
|
|
7
7
|
import { STEPPER as o, STEPPER_DOWN_FILL as s, STEPPER_UP_FILL as c } from "../glyphs.js";
|
|
8
8
|
import { VfTextControlBase as l } from "../text-control.js";
|
|
9
9
|
import { decimalsOf as u } from "../number.js";
|
|
@@ -12,9 +12,9 @@ import { property as m, query as h, state as g } from "lit/decorators.js";
|
|
|
12
12
|
import { classMap as _ } from "lit/directives/class-map.js";
|
|
13
13
|
import { live as v } from "lit/directives/live.js";
|
|
14
14
|
//#region src/components/vf-number-field.ts
|
|
15
|
-
var y = class extends
|
|
16
|
-
constructor(...
|
|
17
|
-
super(...
|
|
15
|
+
var y = class extends r(l) {
|
|
16
|
+
constructor(...t) {
|
|
17
|
+
super(...t), this.step = 1, this.pressed = null, this.#l = (e) => {
|
|
18
18
|
if (this.isDisabled || this.readonly) return;
|
|
19
19
|
let t = e.currentTarget.classList.contains("up") ? 1 : -1;
|
|
20
20
|
e.preventDefault();
|
|
@@ -46,15 +46,15 @@ var y = class extends n(l) {
|
|
|
46
46
|
}
|
|
47
47
|
}, this.#f = (e) => {
|
|
48
48
|
this.value = e.target.value, this.#o("vf-input");
|
|
49
|
-
}, this.#p = (
|
|
50
|
-
let
|
|
51
|
-
this.value = Number.isNaN(
|
|
49
|
+
}, this.#p = (t) => {
|
|
50
|
+
let n = t.target.value, r = parseFloat(n);
|
|
51
|
+
this.value = Number.isNaN(r) ? n : String(Number(this.#r(r).toFixed(u(this.step)))), this.#o("vf-change"), e(this, "change");
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
static {
|
|
55
55
|
this.styles = [
|
|
56
|
-
r,
|
|
57
56
|
i,
|
|
57
|
+
a,
|
|
58
58
|
d`
|
|
59
59
|
:host {
|
|
60
60
|
display: inline-flex;
|
|
@@ -151,9 +151,9 @@ var y = class extends n(l) {
|
|
|
151
151
|
#r(e) {
|
|
152
152
|
return this.min != null && e < this.min ? this.min : this.max != null && e > this.max ? this.max : e;
|
|
153
153
|
}
|
|
154
|
-
#i(
|
|
155
|
-
let
|
|
156
|
-
|
|
154
|
+
#i(t) {
|
|
155
|
+
let n = String(Number(this.#r(t).toFixed(u(this.step))));
|
|
156
|
+
n !== this.value && (this.value = n, this.#o("vf-change"), e(this, "input"), e(this, "change"));
|
|
157
157
|
}
|
|
158
158
|
#a(e) {
|
|
159
159
|
if (this.isDisabled || this.readonly) return;
|
|
@@ -243,6 +243,6 @@ var y = class extends n(l) {
|
|
|
243
243
|
`;
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
n([m({ type: Number })], y.prototype, "min", void 0), n([m({ type: Number })], y.prototype, "max", void 0), n([m({ type: Number })], y.prototype, "step", void 0), n([g()], y.prototype, "pressed", void 0), n([h("input")], y.prototype, "input", void 0), y = n([t("vf-number-field")], y);
|
|
247
247
|
//#endregion
|
|
248
248
|
export { y as VfNumberField };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { emit as e, emitNative as t } from "../events.js";
|
|
2
|
+
import { vfElement as n } from "../define.js";
|
|
3
|
+
import { ScaleController as r } from "../scale.js";
|
|
4
|
+
import i from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
|
+
import { VfPositioned as a } from "../position.js";
|
|
6
|
+
import { vfBase as o } from "../styles/recipes/host.js";
|
|
7
7
|
import { VfFormControl as s } from "../form-control.js";
|
|
8
8
|
import { VfRadio as c } from "./vf-radio.js";
|
|
9
9
|
import { css as l, html as u } from "lit";
|
|
10
10
|
import { property as d } from "lit/decorators.js";
|
|
11
11
|
//#region src/components/vf-radio-group.ts
|
|
12
|
-
var f = class extends
|
|
12
|
+
var f = class extends a(s) {
|
|
13
13
|
static {
|
|
14
|
-
this.styles = [
|
|
14
|
+
this.styles = [o, l`
|
|
15
15
|
:host {
|
|
16
16
|
display: block;
|
|
17
17
|
}
|
|
@@ -30,7 +30,7 @@ var f = class extends r(s) {
|
|
|
30
30
|
return "Please select one of these options.";
|
|
31
31
|
}
|
|
32
32
|
constructor() {
|
|
33
|
-
super(), this.value = "", this.name = "", this.label = "", this.scale = new
|
|
33
|
+
super(), this.value = "", this.name = "", this.label = "", this.scale = new r(this), this.mutationObserver = null, this.syncedKey = null, this.handleRadioChange = (e) => {
|
|
34
34
|
let t = e.target;
|
|
35
35
|
t === this || !(t instanceof c) || t.closest("vf-radio-group") === this && (this.isDisabled || t.disabled || this.selectRadio(t, !1));
|
|
36
36
|
}, this.handleKeydown = (e) => {
|
|
@@ -90,9 +90,9 @@ var f = class extends r(s) {
|
|
|
90
90
|
focus(e) {
|
|
91
91
|
this.radios.find((e) => e.tabIndex === 0)?.focus(e);
|
|
92
92
|
}
|
|
93
|
-
selectRadio(
|
|
94
|
-
let
|
|
95
|
-
this.value =
|
|
93
|
+
selectRadio(n, r) {
|
|
94
|
+
let i = this.value !== n.value;
|
|
95
|
+
this.value = n.value, this.syncRadios(), r && n.focus(), i && (e(this, "vf-change", { value: this.value }), t(this, "input"), t(this, "change"));
|
|
96
96
|
}
|
|
97
97
|
adoptPreChecked() {
|
|
98
98
|
if (this.value !== "") return;
|
|
@@ -100,6 +100,6 @@ var f = class extends r(s) {
|
|
|
100
100
|
e && e.value !== "" && (this.value = e.value, this.latchFormDefault(this.value));
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
|
|
103
|
+
i([d()], f.prototype, "value", void 0), i([d({ reflect: !0 })], f.prototype, "name", void 0), i([d()], f.prototype, "label", void 0), f = i([n("vf-radio-group")], f);
|
|
104
104
|
//#endregion
|
|
105
105
|
export { f as VfRadioGroup };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { emit as e } from "../events.js";
|
|
2
|
+
import { vfElement as t } from "../define.js";
|
|
3
|
+
import n from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
4
|
+
import { VfPositioned as r } from "../position.js";
|
|
5
|
+
import { vfDisplay as i } from "../styles/recipes/display-face.js";
|
|
6
|
+
import { vfBase as a } from "../styles/recipes/host.js";
|
|
7
|
+
import { vfFocusUnderline as o } from "../styles/recipes/focus.js";
|
|
8
|
+
import { vfToggle as s } from "../styles/recipes/toggle.js";
|
|
9
9
|
import { RADIO_DOT as c, RADIO_FACE as l, RADIO_RING as u, RADIO_RING_PRESSED as d } from "../glyphs.js";
|
|
10
10
|
import { VfToggleControl as f } from "../toggle-control.js";
|
|
11
11
|
import { LitElement as p, css as m, html as h } from "lit";
|
|
12
12
|
import { property as g, state as _ } from "lit/decorators.js";
|
|
13
13
|
import { classMap as v } from "lit/directives/class-map.js";
|
|
14
14
|
//#region src/components/vf-radio.ts
|
|
15
|
-
var y = class extends
|
|
15
|
+
var y = class extends r(f(p)) {
|
|
16
16
|
static {
|
|
17
17
|
this.styles = [
|
|
18
|
+
a,
|
|
18
19
|
i,
|
|
19
|
-
|
|
20
|
-
o,
|
|
20
|
+
s,
|
|
21
21
|
m`
|
|
22
22
|
/* Keyboard focus underlines the circle itself — not the label, and not a
|
|
23
23
|
ring around either (see vfFocusUnderline). One blank row below the
|
|
@@ -29,7 +29,7 @@ var y = class extends n(f(p)) {
|
|
|
29
29
|
sprite. */
|
|
30
30
|
:host(:focus-visible) .circle::after {
|
|
31
31
|
--vf-focus-underline-offset: -2px;
|
|
32
|
-
${
|
|
32
|
+
${o}
|
|
33
33
|
/* …and narrower than the well, because the shape above it is round:
|
|
34
34
|
a full-width rule reads as wider than the circle it marks. 9 of the
|
|
35
35
|
13px (5 dashes) is the closest to two thirds that still insets by a
|
|
@@ -126,15 +126,15 @@ var y = class extends n(f(p)) {
|
|
|
126
126
|
this._hasLabel = t.assignedNodes({ flatten: !0 }).some((e) => e.nodeType === Node.ELEMENT_NODE || !!e.textContent?.trim());
|
|
127
127
|
}
|
|
128
128
|
activate() {
|
|
129
|
-
this.checked || (this.externallyCoordinated || (this.checked = !0), this.focus(),
|
|
129
|
+
this.checked || (this.externallyCoordinated || (this.checked = !0), this.focus(), e(this, "vf-change", { value: this.value }));
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
|
|
132
|
+
n([g({
|
|
133
133
|
type: Boolean,
|
|
134
134
|
reflect: !0
|
|
135
|
-
})], y.prototype, "checked", void 0),
|
|
135
|
+
})], y.prototype, "checked", void 0), n([g({
|
|
136
136
|
type: Boolean,
|
|
137
137
|
reflect: !0
|
|
138
|
-
})], y.prototype, "disabled", void 0),
|
|
138
|
+
})], y.prototype, "disabled", void 0), n([g()], y.prototype, "value", void 0), n([g({ attribute: !1 })], y.prototype, "groupDisabled", void 0), n([_()], y.prototype, "_hasLabel", void 0), y = n([t("vf-radio")], y);
|
|
139
139
|
//#endregion
|
|
140
140
|
export { y as VfRadio };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import r from "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { emit as e, emitNative as t } from "../events.js";
|
|
2
|
+
import { vfElement as n } from "../define.js";
|
|
3
|
+
import { ScaleController as r, sys as i } from "../scale.js";
|
|
4
|
+
import a from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
|
+
import { VfPositioned as o } from "../position.js";
|
|
6
|
+
import { vfDisplay as s } from "../styles/recipes/display-face.js";
|
|
7
|
+
import { vfBase as c } from "../styles/recipes/host.js";
|
|
8
|
+
import { vfPanel as l } from "../styles/recipes/surface.js";
|
|
9
|
+
import { vfFocusUnderline as u } from "../styles/recipes/focus.js";
|
|
10
|
+
import { GridSnapController as d } from "../grid-snap.js";
|
|
11
|
+
import { DocumentListenersController as f } from "../document-listeners.js";
|
|
12
12
|
import { runSelectionBlink as p } from "../motion.js";
|
|
13
13
|
import { CARET_DOWN as m, CARET_UP as h, glyphSvg as g } from "../glyphs.js";
|
|
14
14
|
import { VfShadowRoleControl as _ } from "../form-control.js";
|
|
@@ -20,7 +20,7 @@ import { css as E, html as D, nothing as O } from "lit";
|
|
|
20
20
|
import { property as k, query as A, queryAssignedElements as j, state as M } from "lit/decorators.js";
|
|
21
21
|
import { classMap as N } from "lit/directives/class-map.js";
|
|
22
22
|
//#region src/components/vf-select.ts
|
|
23
|
-
var P, F = class extends
|
|
23
|
+
var P, F = class extends o(_) {
|
|
24
24
|
static {
|
|
25
25
|
P = this;
|
|
26
26
|
}
|
|
@@ -29,9 +29,9 @@ var P, F = class extends i(_) {
|
|
|
29
29
|
}
|
|
30
30
|
static {
|
|
31
31
|
this.styles = [
|
|
32
|
-
|
|
33
|
-
a,
|
|
32
|
+
c,
|
|
34
33
|
s,
|
|
34
|
+
l,
|
|
35
35
|
E`
|
|
36
36
|
:host {
|
|
37
37
|
/* A popup menu is sized to its widest option — never stretched to fill
|
|
@@ -96,7 +96,7 @@ var P, F = class extends i(_) {
|
|
|
96
96
|
}
|
|
97
97
|
.control.vf-focus-rule::after {
|
|
98
98
|
--vf-focus-underline-offset: -4px;
|
|
99
|
-
${
|
|
99
|
+
${u}
|
|
100
100
|
left: calc(var(--vf-scale, 1) * -1px);
|
|
101
101
|
right: calc(var(--vf-scale, 1) * -1px);
|
|
102
102
|
}
|
|
@@ -242,7 +242,7 @@ var P, F = class extends i(_) {
|
|
|
242
242
|
return this.rowScroll < this.optionItems.length - this.visibleSlots;
|
|
243
243
|
}
|
|
244
244
|
constructor() {
|
|
245
|
-
super(), this.value = "", this.name = "", this.label = "", this.open = !1, this.cachedOptions = [], this.scale = new
|
|
245
|
+
super(), this.value = "", this.name = "", this.label = "", this.open = !1, this.cachedOptions = [], this.scale = new r(this), this.gridSnap = new d(this), this.focusRule = new v(this), this.panelListeners = new f(this, () => [
|
|
246
246
|
[
|
|
247
247
|
document,
|
|
248
248
|
"pointerdown",
|
|
@@ -260,7 +260,7 @@ var P, F = class extends i(_) {
|
|
|
260
260
|
"resize",
|
|
261
261
|
this.handleWindowResize
|
|
262
262
|
]
|
|
263
|
-
]), this.pressListeners = new
|
|
263
|
+
]), this.pressListeners = new f(this, () => [
|
|
264
264
|
[
|
|
265
265
|
document,
|
|
266
266
|
"pointermove",
|
|
@@ -431,17 +431,17 @@ var P, F = class extends i(_) {
|
|
|
431
431
|
e === -1 && (e = this.firstEnabledIndex()), this.positionPanel(Math.max(e, 0)), e !== -1 && this.setActive(e);
|
|
432
432
|
}
|
|
433
433
|
positionPanel(e) {
|
|
434
|
-
let t = this.controlEl,
|
|
435
|
-
if (!t || !
|
|
436
|
-
let
|
|
437
|
-
idealTop:
|
|
434
|
+
let t = this.controlEl, n = this.panelEl;
|
|
435
|
+
if (!t || !n) return;
|
|
436
|
+
let r = t.getBoundingClientRect(), a = this.optionItems[0]?.getBoundingClientRect()?.height || i(P.ITEM_HEIGHT, this), o = getComputedStyle(n), s = parseFloat(o.borderTopWidth) || 0, c = (e) => i(parseFloat(o.getPropertyValue(e)) || 0, this), l = w({
|
|
437
|
+
idealTop: r.top - e * a,
|
|
438
438
|
rowHeight: a,
|
|
439
439
|
border: s,
|
|
440
440
|
rowCount: this.optionItems.length,
|
|
441
441
|
viewTop: c("--vf-popup-clamp-top"),
|
|
442
442
|
viewBottom: window.innerHeight - c("--vf-popup-clamp-bottom")
|
|
443
|
-
}), u =
|
|
444
|
-
|
|
443
|
+
}), u = r.left;
|
|
444
|
+
n.style.minWidth = `${r.width}px`, n.style.top = `${l.panelTop}px`, n.style.left = `${u}px`, n.style.height = `${l.panelHeight}px`, this.rowHeight = a, this.visibleSlots = l.visibleSlots, this.rowScroll = l.initialScroll, this.applyScroll();
|
|
445
445
|
}
|
|
446
446
|
closePanel(e) {
|
|
447
447
|
this.open && (this.open = !1, this.cancelBlink(), this.stopArrowScroll(), this.endPress(), this.clearActive(), this.typeAhead.reset(), this.panelListeners.detach(), e && this.controlEl?.focus());
|
|
@@ -541,10 +541,10 @@ var P, F = class extends i(_) {
|
|
|
541
541
|
cancelBlink() {
|
|
542
542
|
this.blinkHandle?.cancel(), this.blinkHandle = void 0, this.blinking = !1;
|
|
543
543
|
}
|
|
544
|
-
commit(
|
|
544
|
+
commit(n) {
|
|
545
545
|
this.closePanel(!0);
|
|
546
|
-
let
|
|
547
|
-
this.value =
|
|
546
|
+
let r = this.optionValue(n);
|
|
547
|
+
this.value = r, e(this, "vf-change", { value: r }), t(this, "input"), t(this, "change");
|
|
548
548
|
}
|
|
549
549
|
optionFromEvent(e) {
|
|
550
550
|
return e.composedPath().find((e) => e instanceof y);
|
|
@@ -653,6 +653,6 @@ var P, F = class extends i(_) {
|
|
|
653
653
|
`;
|
|
654
654
|
}
|
|
655
655
|
};
|
|
656
|
-
|
|
656
|
+
a([k()], F.prototype, "value", void 0), a([k({ reflect: !0 })], F.prototype, "name", void 0), a([k()], F.prototype, "label", void 0), a([M()], F.prototype, "open", void 0), a([A(".control")], F.prototype, "controlEl", void 0), a([A(".panel")], F.prototype, "panelEl", void 0), a([A(".rows")], F.prototype, "rowsEl", void 0), a([A(".arrow-slot.up")], F.prototype, "upArrowEl", void 0), a([A(".arrow-slot.down")], F.prototype, "downArrowEl", void 0), a([j({ selector: "vf-option" })], F.prototype, "assignedOptions", void 0), a([M()], F.prototype, "cachedOptions", void 0), F = P = a([n("vf-select")], F);
|
|
657
657
|
//#endregion
|
|
658
658
|
export { F as VfSelect };
|