vintage-frames 0.3.0 → 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 +48 -3
- 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.js +56 -56
- package/dist/components/vf-list-item.js +16 -16
- package/dist/components/vf-list.js +26 -26
- package/dist/components/vf-menu-item.js +24 -24
- package/dist/components/vf-menu.js +27 -27
- 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.js +54 -54
- 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 +3 -1
- package/editor/vscode.html-custom-data.json +1 -1
- package/editor/web-types.json +19 -4
- package/package.json +2 -1
|
@@ -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 };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import i from "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
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, toSys as a } from "../scale.js";
|
|
4
|
+
import o from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
|
+
import { VfPositioned as s } from "../position.js";
|
|
6
|
+
import { vfBase as c } from "../styles/recipes/host.js";
|
|
7
|
+
import { vfFocusUnderline as l } from "../styles/recipes/focus.js";
|
|
8
|
+
import { GridSnapController as u } from "../grid-snap.js";
|
|
9
9
|
import { SLIDER_THUMB as d, SLIDER_THUMB_FACE as f } from "../glyphs.js";
|
|
10
10
|
import { VfFormControl as p } from "../form-control.js";
|
|
11
11
|
import { FocusRuleController as m } from "../focus-modality.js";
|
|
@@ -21,9 +21,9 @@ function D(e, t) {
|
|
|
21
21
|
};
|
|
22
22
|
return r(1, 0, e - 2, 1), r(1, 3, e - 2, 1), r(0, 1, 1, 2), r(e - 1, 1, 1, 2), r(1, 1, Math.min(Math.max(t, 0), e - 1) - 1, 2), n.join("");
|
|
23
23
|
}
|
|
24
|
-
var O = class extends
|
|
24
|
+
var O = class extends s(p) {
|
|
25
25
|
static {
|
|
26
|
-
this.styles = [
|
|
26
|
+
this.styles = [c, _`
|
|
27
27
|
:host {
|
|
28
28
|
/* Padding just leaves room for the thumb's focus ring; the thumb itself
|
|
29
29
|
stays within the rail (its travel is inset by half its width). */
|
|
@@ -102,7 +102,7 @@ var O = class extends a(p) {
|
|
|
102
102
|
}
|
|
103
103
|
.track.vf-focus-rule::after {
|
|
104
104
|
--vf-focus-underline-offset: ${3}px;
|
|
105
|
-
${
|
|
105
|
+
${l}
|
|
106
106
|
}
|
|
107
107
|
`];
|
|
108
108
|
}
|
|
@@ -110,7 +110,7 @@ var O = class extends a(p) {
|
|
|
110
110
|
#t;
|
|
111
111
|
#n;
|
|
112
112
|
constructor() {
|
|
113
|
-
super(), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.name = "", this.label = "", this.trackSize = new g(this, () => this.track), this.scale = new
|
|
113
|
+
super(), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.name = "", this.label = "", this.trackSize = new g(this, () => this.track), this.scale = new r(this), this.gridSnap = new u(this), this.selfManagedTabIndex = !1, this.#e = new m(this), this.#t = 0, this.#n = !1, this.#f = (e) => {
|
|
114
114
|
if (!(this.isDisabled || e.button !== 0)) {
|
|
115
115
|
e.preventDefault(), this.#e.suppress(), this.focus(), this.#n = !0, this.#t = this.value;
|
|
116
116
|
try {
|
|
@@ -193,16 +193,16 @@ var O = class extends a(p) {
|
|
|
193
193
|
#l(e) {
|
|
194
194
|
e !== this.value && (this.value = e, this.#u("vf-input"));
|
|
195
195
|
}
|
|
196
|
-
#u(
|
|
197
|
-
|
|
196
|
+
#u(n) {
|
|
197
|
+
e(this, n, { value: this.value }), t(this, n === "vf-input" ? "input" : "change");
|
|
198
198
|
}
|
|
199
199
|
#d(e) {
|
|
200
200
|
let t = this.track?.getBoundingClientRect();
|
|
201
201
|
if (!t) return this.value;
|
|
202
|
-
let
|
|
203
|
-
if (
|
|
204
|
-
let
|
|
205
|
-
return this.#o(this.min +
|
|
202
|
+
let n = t.width - i(x, this);
|
|
203
|
+
if (n <= 0) return this.value;
|
|
204
|
+
let r = Math.min(Math.max((e - t.left - i(w, this)) / n, 0), 1);
|
|
205
|
+
return this.#o(this.min + r * this.#r);
|
|
206
206
|
}
|
|
207
207
|
#f;
|
|
208
208
|
#p;
|
|
@@ -213,7 +213,7 @@ var O = class extends a(p) {
|
|
|
213
213
|
(n || t) && this.syncFormValue(String(this.#s)), e.has("min") && (this.internals.ariaValueMin = String(this.min)), e.has("max") && (this.internals.ariaValueMax = String(this.max)), n && (this.internals.ariaValueNow = String(this.#s)), e.has("label") && (this.internals.ariaLabel = this.label || null), t && (this.internals.ariaDisabled = this.isDisabled ? "true" : "false", this.selfManagedTabIndex && (this.tabIndex = this.isDisabled ? -1 : 0));
|
|
214
214
|
}
|
|
215
215
|
render() {
|
|
216
|
-
let e =
|
|
216
|
+
let e = a(this.trackSize.width, this), t = Math.round(this.#c * Math.max(0, e - x)), n = i(t, this), r = t + C;
|
|
217
217
|
return v`
|
|
218
218
|
<div
|
|
219
219
|
class="track vf-snap ${this.#e.marked ? "vf-focus-rule" : ""} ${this.isDisabled ? "disabled" : ""}"
|
|
@@ -227,15 +227,15 @@ var O = class extends a(p) {
|
|
|
227
227
|
${e >= 2 ? v`<svg
|
|
228
228
|
class="rail"
|
|
229
229
|
part="rail"
|
|
230
|
-
width=${
|
|
231
|
-
height=${
|
|
230
|
+
width=${i(e, this)}
|
|
231
|
+
height=${i(T, this)}
|
|
232
232
|
viewBox="0 0 ${e} ${T}"
|
|
233
233
|
shape-rendering="crispEdges"
|
|
234
234
|
aria-hidden="true"
|
|
235
235
|
>
|
|
236
|
-
<path d=${D(e,
|
|
236
|
+
<path d=${D(e, r)}></path>
|
|
237
237
|
</svg>` : null}
|
|
238
|
-
<span class="thumb" part="thumb" style="left: ${
|
|
238
|
+
<span class="thumb" part="thumb" style="left: ${n}px">
|
|
239
239
|
<svg
|
|
240
240
|
class="thumb-glyph"
|
|
241
241
|
viewBox="0 0 ${x} ${S}"
|
|
@@ -250,6 +250,6 @@ var O = class extends a(p) {
|
|
|
250
250
|
`;
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
|
-
|
|
253
|
+
o([y({ type: Number })], O.prototype, "value", void 0), o([y({ type: Number })], O.prototype, "min", void 0), o([y({ type: Number })], O.prototype, "max", void 0), o([y({ type: Number })], O.prototype, "step", void 0), o([y({ reflect: !0 })], O.prototype, "name", void 0), o([y()], O.prototype, "label", void 0), o([b(".track")], O.prototype, "track", void 0), O = o([n("vf-slider")], O);
|
|
254
254
|
//#endregion
|
|
255
255
|
export { O as VfSlider };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import a from "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
1
|
+
import { emit as e } from "../events.js";
|
|
2
|
+
import { vfElement as t } from "../define.js";
|
|
3
|
+
import { ScaleController as n, snapSys as r, sysLength as i, toSysExact as a } from "../scale.js";
|
|
4
|
+
import o from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
|
+
import { PlacementController as s, VfPositioned as c, warnMovableContract as l } from "../position.js";
|
|
6
|
+
import { vfBase as u } from "../styles/recipes/host.js";
|
|
7
|
+
import { DOT_RECTS as d, DOT_SPAN as f, vfDots as p, vfStripes as m } from "../styles/recipes/pattern.js";
|
|
8
|
+
import { vfChromeFrame as h } from "../styles/recipes/surface.js";
|
|
9
|
+
import { vfTitleBar as g, vfWindowWidgets as _ } from "../styles/recipes/title-bar.js";
|
|
10
|
+
import { vfFocus as v } from "../styles/recipes/focus.js";
|
|
11
|
+
import { TileRasterCache as y, patternOverride as b, tileGrid as x, vfTileGrid as S } from "../tile-grid.js";
|
|
12
|
+
import { GridSnapController as C } from "../grid-snap.js";
|
|
13
|
+
import { VfSized as w } from "../size.js";
|
|
14
|
+
import { DragController as T } from "../drag.js";
|
|
15
|
+
import { TitleCenterController as E, chromeTitleBar as D, closeBox as O, widgetLabel as k, zoomBox as A } from "../chrome.js";
|
|
16
16
|
import "./vf-scroll-area.js";
|
|
17
17
|
import { LitElement as j, css as M, html as N, nothing as P } from "lit";
|
|
18
18
|
import { property as F, state as I } from "lit/decorators.js";
|
|
19
19
|
//#region src/components/vf-window.ts
|
|
20
|
-
var L = 80, R = 54, z = 24, B = 8, V = class extends
|
|
20
|
+
var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
21
21
|
constructor(...e) {
|
|
22
|
-
super(...e), this.heading = "", this.active = !0, this.closable = !0, this.zoomable = !1, this.movable = !1, this.resizable = !1, this.flush = !1, this._hasStatus = !1, this.scale = new
|
|
23
|
-
let r =
|
|
22
|
+
super(...e), this.heading = "", this.active = !0, this.closable = !0, this.zoomable = !1, this.movable = !1, this.resizable = !1, this.flush = !1, this._hasStatus = !1, this.scale = new n(this), this.gridSnap = new C(this), this.titleCenter = new E(this), this._dotsPattern = "", this.#e = new y(), this.#t = (e, t, n) => {
|
|
23
|
+
let r = a(this.offsetWidth, this);
|
|
24
24
|
return {
|
|
25
25
|
x: Math.min(Math.max(e, z - r), n.width - z),
|
|
26
26
|
y: Math.min(Math.max(t, 0), Math.max(0, n.height - z))
|
|
27
27
|
};
|
|
28
|
-
}, this._placement = new
|
|
28
|
+
}, this._placement = new s(this, (e, t, n) => this.#t(e, t, n)), this._drag = new T(this, {
|
|
29
29
|
onDragStart: (e) => !this.movable || e.button !== 0 || e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("box")) ? null : (this.#i(), this._placement.seed()),
|
|
30
30
|
onDrag: (e, t) => this._placement.moveTo(e, t)
|
|
31
31
|
}), this._resizeState = null, this.#n = !1, this.#r = !1;
|
|
32
32
|
}
|
|
33
33
|
static {
|
|
34
34
|
this.styles = [
|
|
35
|
-
|
|
36
|
-
p,
|
|
37
|
-
f,
|
|
38
|
-
x,
|
|
39
|
-
_,
|
|
35
|
+
u,
|
|
40
36
|
m,
|
|
37
|
+
p,
|
|
38
|
+
S,
|
|
39
|
+
v,
|
|
41
40
|
h,
|
|
42
41
|
g,
|
|
42
|
+
_,
|
|
43
43
|
M`
|
|
44
44
|
:host {
|
|
45
45
|
display: block;
|
|
@@ -281,27 +281,27 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
281
281
|
}
|
|
282
282
|
#e;
|
|
283
283
|
willUpdate(e) {
|
|
284
|
-
super.willUpdate(e), this.variant === "utility" && (this._dotsPattern =
|
|
284
|
+
super.willUpdate(e), this.variant === "utility" && (this._dotsPattern = b(this, "--vf-dots-pattern"));
|
|
285
285
|
}
|
|
286
286
|
_dotsTexture() {
|
|
287
287
|
if (this.width == null) return;
|
|
288
288
|
let e = Math.max(1, this.width - 2);
|
|
289
|
-
if (this._dotsPattern) return
|
|
290
|
-
cols: Math.ceil(e /
|
|
289
|
+
if (this._dotsPattern) return x({
|
|
290
|
+
cols: Math.ceil(e / f),
|
|
291
291
|
rows: 1,
|
|
292
|
-
tile:
|
|
292
|
+
tile: f
|
|
293
293
|
});
|
|
294
|
-
let t = Math.ceil((e + 2) /
|
|
294
|
+
let t = Math.ceil((e + 2) / f) * f, n = B + 2;
|
|
295
295
|
return N`<div
|
|
296
296
|
class="vf-tile-raster"
|
|
297
|
-
style="width:${
|
|
297
|
+
style="width:${i(t)};height:${i(n)};background-image:${this.#e.for(2, 2, d, t, n)}"
|
|
298
298
|
></div>`;
|
|
299
299
|
}
|
|
300
300
|
#t;
|
|
301
301
|
updated() {
|
|
302
302
|
this.#a();
|
|
303
|
-
let
|
|
304
|
-
|
|
303
|
+
let t = this._resizeState;
|
|
304
|
+
t?.emitPending && (t.emitPending = !1, e(this, "vf-resize", {
|
|
305
305
|
width: this.width,
|
|
306
306
|
height: this.height,
|
|
307
307
|
commit: !1
|
|
@@ -310,7 +310,7 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
310
310
|
#n;
|
|
311
311
|
#r;
|
|
312
312
|
#i() {
|
|
313
|
-
this.#r ||=
|
|
313
|
+
this.#r ||= l(this, `vf-window${this.heading ? ` ("${this.heading}")` : ""}`, "<vf-window movable top=\"30\" left=\"40\" width=\"240\" height=\"176\">");
|
|
314
314
|
}
|
|
315
315
|
#a() {
|
|
316
316
|
if (this.#n) return;
|
|
@@ -325,10 +325,10 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
325
325
|
this._hasStatus = t.assignedElements().length > 0;
|
|
326
326
|
}
|
|
327
327
|
_onCloseClick() {
|
|
328
|
-
|
|
328
|
+
e(this, "vf-close", { reason: "close" });
|
|
329
329
|
}
|
|
330
330
|
_onZoomClick() {
|
|
331
|
-
|
|
331
|
+
e(this, "vf-zoom", {});
|
|
332
332
|
}
|
|
333
333
|
_onGrowPointerDown(e) {
|
|
334
334
|
if (!this.resizable || e.button !== 0) return;
|
|
@@ -337,8 +337,8 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
337
337
|
pointerId: e.pointerId,
|
|
338
338
|
startX: e.clientX,
|
|
339
339
|
startY: e.clientY,
|
|
340
|
-
baseWidth:
|
|
341
|
-
baseHeight:
|
|
340
|
+
baseWidth: a(t.width, this),
|
|
341
|
+
baseHeight: a(t.height, this),
|
|
342
342
|
emitPending: !1,
|
|
343
343
|
resized: !1
|
|
344
344
|
}, e.currentTarget.setPointerCapture(e.pointerId), e.preventDefault();
|
|
@@ -346,15 +346,15 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
346
346
|
_onGrowPointerMove(e) {
|
|
347
347
|
let t = this._resizeState;
|
|
348
348
|
if (!t || e.pointerId !== t.pointerId) return;
|
|
349
|
-
let
|
|
350
|
-
(
|
|
349
|
+
let n = r(Math.max(L, t.baseWidth + a(e.clientX - t.startX, this)), this), i = r(Math.max(R, t.baseHeight + a(e.clientY - t.startY, this)), this);
|
|
350
|
+
(n !== this.width || i !== this.height) && (t.emitPending = !0, t.resized = !0), this.width = n, this.height = i;
|
|
351
351
|
}
|
|
352
|
-
_onGrowPointerEnd(
|
|
353
|
-
let
|
|
354
|
-
if (!
|
|
352
|
+
_onGrowPointerEnd(t) {
|
|
353
|
+
let n = this._resizeState;
|
|
354
|
+
if (!n || t.pointerId !== n.pointerId) return;
|
|
355
355
|
this._resizeState = null;
|
|
356
|
-
let
|
|
357
|
-
|
|
356
|
+
let r = t.currentTarget;
|
|
357
|
+
r.hasPointerCapture(t.pointerId) && r.releasePointerCapture(t.pointerId), n.resized && e(this, "vf-resize", {
|
|
358
358
|
width: this.width,
|
|
359
359
|
height: this.height,
|
|
360
360
|
commit: !0
|
|
@@ -368,10 +368,10 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
368
368
|
role="group"
|
|
369
369
|
aria-labelledby=${this.heading ? "title" : P}
|
|
370
370
|
>
|
|
371
|
-
${
|
|
372
|
-
${this.closable ?
|
|
371
|
+
${D(this._drag, N`
|
|
372
|
+
${this.closable ? O(k("Close", this.heading), this._onCloseClick) : P}
|
|
373
373
|
<span class="vf-title" part="title" id="title">${this.heading}</span>
|
|
374
|
-
${this.zoomable ? k(
|
|
374
|
+
${this.zoomable ? A(k("Zoom", this.heading), this._onZoomClick) : P}
|
|
375
375
|
`, this.variant === "utility" ? "vf-dots" : "vf-stripes", this.variant === "utility" ? this._dotsTexture() : void 0)}
|
|
376
376
|
<div class="body" part="body">
|
|
377
377
|
${this.scrollbars ? N`
|
|
@@ -403,24 +403,24 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends C(s(j)) {
|
|
|
403
403
|
`;
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
|
-
|
|
406
|
+
o([F({ reflect: !0 })], V.prototype, "variant", void 0), o([F()], V.prototype, "heading", void 0), o([F({
|
|
407
407
|
type: Boolean,
|
|
408
408
|
reflect: !0
|
|
409
|
-
})], V.prototype, "active", void 0),
|
|
409
|
+
})], V.prototype, "active", void 0), o([F({
|
|
410
410
|
type: Boolean,
|
|
411
411
|
reflect: !0
|
|
412
|
-
})], V.prototype, "closable", void 0),
|
|
412
|
+
})], V.prototype, "closable", void 0), o([F({
|
|
413
413
|
type: Boolean,
|
|
414
414
|
reflect: !0
|
|
415
|
-
})], V.prototype, "zoomable", void 0),
|
|
415
|
+
})], V.prototype, "zoomable", void 0), o([F({
|
|
416
416
|
type: Boolean,
|
|
417
417
|
reflect: !0
|
|
418
|
-
})], V.prototype, "movable", void 0),
|
|
418
|
+
})], V.prototype, "movable", void 0), o([F({
|
|
419
419
|
type: Boolean,
|
|
420
420
|
reflect: !0
|
|
421
|
-
})], V.prototype, "resizable", void 0),
|
|
421
|
+
})], V.prototype, "resizable", void 0), o([F({
|
|
422
422
|
type: Boolean,
|
|
423
423
|
reflect: !0
|
|
424
|
-
})], V.prototype, "flush", void 0),
|
|
424
|
+
})], V.prototype, "flush", void 0), o([F({ reflect: !0 })], V.prototype, "scrollbars", void 0), o([I()], V.prototype, "_hasStatus", void 0), V = o([t("vf-window")], V);
|
|
425
425
|
//#endregion
|
|
426
426
|
export { V as VfWindow };
|