vintage-frames 0.13.0 → 0.14.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 +8 -8
- package/dist/components/vf-checkbox.d.ts +6 -5
- package/dist/components/vf-checkbox.js +41 -37
- package/dist/components/vf-container.d.ts +11 -13
- package/dist/components/vf-container.js +24 -12
- package/dist/components/vf-fieldset.js +30 -22
- package/dist/components/vf-icon.js +55 -55
- package/dist/components/vf-list.js +30 -29
- package/dist/components/vf-menu.js +24 -22
- package/dist/components/vf-number-field.js +32 -30
- package/dist/components/vf-progress-bar.js +28 -29
- package/dist/components/vf-radio.js +3 -4
- package/dist/components/vf-scroll-area.js +27 -26
- package/dist/components/vf-select.js +108 -90
- package/dist/components/vf-separator.d.ts +5 -5
- package/dist/components/vf-separator.js +36 -10
- package/dist/components/vf-swatch.js +47 -45
- package/dist/components/vf-text-area.js +37 -35
- package/dist/components/vf-text-field.js +20 -18
- package/dist/components/vf-window.js +92 -72
- package/dist/index.d.ts +10 -1
- package/dist/index.js +60 -59
- package/dist/styles/base.d.ts +3 -1
- package/dist/styles/recipes/field.d.ts +10 -6
- package/dist/styles/recipes/field.js +8 -7
- package/dist/styles/recipes/focus.d.ts +7 -3
- package/dist/styles/recipes/rule.d.ts +11 -8
- package/dist/styles/recipes/rule.js +31 -13
- package/dist/styles/recipes/scroll-rail.d.ts +7 -6
- package/dist/styles/recipes/scroll-rail.js +18 -18
- package/dist/styles/recipes/shadow.d.ts +10 -6
- package/dist/styles/recipes/shadow.js +4 -2
- package/dist/styles/recipes/stroke.d.ts +85 -0
- package/dist/styles/recipes/stroke.js +53 -0
- package/dist/styles/recipes/surface.d.ts +8 -4
- package/dist/styles/recipes/surface.js +23 -17
- package/dist/styles/recipes/title-bar.d.ts +7 -0
- package/dist/styles/recipes/title-bar.js +25 -22
- package/dist/styles/recipes/toggle.js +3 -3
- package/dist/zoom.d.ts +9 -9
- package/docs/SPEC.md +23 -22
- package/editor/vscode.html-custom-data.json +4 -4
- package/editor/web-types.json +7 -7
- package/package.json +1 -1
|
@@ -5,25 +5,26 @@ import o from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js
|
|
|
5
5
|
import { PlacementController as s, VfPositioned as c, warnMovableContract as l } from "../position.js";
|
|
6
6
|
import { vfBodyDecls as u } from "../styles/recipes/body-face.js";
|
|
7
7
|
import { vfBase as d } from "../styles/recipes/host.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
8
|
+
import { vfStrokeDecls as f } from "../styles/recipes/stroke.js";
|
|
9
|
+
import { vfFocusUnderline as p } from "../styles/recipes/focus.js";
|
|
10
|
+
import { GridSnapController as m } from "../grid-snap.js";
|
|
11
|
+
import { DocumentListenersController as h } from "../document-listeners.js";
|
|
12
|
+
import { DragController as g } from "../drag.js";
|
|
13
|
+
import { dragSlop as _, prefersReducedMotion as v, runOutlineTravel as y } from "../motion.js";
|
|
14
|
+
import { deriveDragOutline as b, deriveOpenArt as x, dotOutline as S, penPhase as C, xorPenCanvas as w } from "../open-art.js";
|
|
15
|
+
import { FocusRuleController as T } from "../focus-modality.js";
|
|
16
|
+
import { LitElement as E, css as D, html as O, nothing as k } from "lit";
|
|
17
|
+
import { property as A, state as j } from "lit/decorators.js";
|
|
17
18
|
//#region src/components/vf-icon.ts
|
|
18
|
-
var
|
|
19
|
+
var M, N = {
|
|
19
20
|
large: 32,
|
|
20
21
|
small: 16
|
|
21
|
-
},
|
|
22
|
+
}, P = 1, F = 8, I = (e, t) => t <= 0 ? Math.max(e, 0) : Math.min(Math.max(e, 0), t), L = class extends c(E) {
|
|
22
23
|
static {
|
|
23
|
-
|
|
24
|
+
M = this;
|
|
24
25
|
}
|
|
25
26
|
constructor(...t) {
|
|
26
|
-
super(...t), this.label = "", this.size = "large", this.selectable = !1, this.selected = !1, this.target = !1, this.color = !1, this.open = !1, this.movable = !1, this.editable = !1, this.maxlength = 31, this.scale = new n(this), this.gridSnap = new
|
|
27
|
+
super(...t), this.label = "", this.size = "large", this.selectable = !1, this.selected = !1, this.target = !1, this.color = !1, this.open = !1, this.movable = !1, this.editable = !1, this.maxlength = 31, this.scale = new n(this), this.gridSnap = new m(this), this.focusRule = new T(this), this._editing = !1, this._draft = "", this.#e = 0, this._ghost = null, this.#t = null, this.#n = this.attachInternals(), this.#a = !1, this.#o = "", this.#s = "", this.#c = 0, this.#l = -Infinity, this.#u = !1, this.#d = null, this.#f = null, this.#p = new h(this, () => [[
|
|
27
28
|
document,
|
|
28
29
|
"pointerdown",
|
|
29
30
|
this.#te,
|
|
@@ -32,9 +33,9 @@ var j, M = {
|
|
|
32
33
|
x: Math.max(e, 0),
|
|
33
34
|
y: Math.max(t, 0)
|
|
34
35
|
} : {
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
37
|
-
}, this.#g = new s(this, (e, t, n) => this.#m(e, t, n)), this.#_ = null, this.#v = new
|
|
36
|
+
x: I(e, n.width - a(this.offsetWidth, this)),
|
|
37
|
+
y: I(t, n.height - a(this.offsetHeight, this))
|
|
38
|
+
}, this.#g = new s(this, (e, t, n) => this.#m(e, t, n)), this.#_ = null, this.#v = new g(this, {
|
|
38
39
|
onDragStart: (e) => {
|
|
39
40
|
if (!this.movable || e.button !== 0 || this._editing) return null;
|
|
40
41
|
this.#L();
|
|
@@ -50,7 +51,7 @@ var j, M = {
|
|
|
50
51
|
clientX: e.clientX,
|
|
51
52
|
clientY: e.clientY
|
|
52
53
|
},
|
|
53
|
-
slop:
|
|
54
|
+
slop: _(e),
|
|
54
55
|
proposal: null,
|
|
55
56
|
outline: null,
|
|
56
57
|
followers: [],
|
|
@@ -63,14 +64,14 @@ var j, M = {
|
|
|
63
64
|
onDragEnd: (e, t) => {
|
|
64
65
|
this.#A(e, t);
|
|
65
66
|
}
|
|
66
|
-
}), this.#y = new
|
|
67
|
+
}), this.#y = new h(this, () => [[
|
|
67
68
|
document,
|
|
68
69
|
"keydown",
|
|
69
70
|
this.#b,
|
|
70
71
|
!0
|
|
71
72
|
]]), this.#b = (e) => {
|
|
72
73
|
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.#v.cancel());
|
|
73
|
-
}, this.#x = null, this.#S = new
|
|
74
|
+
}, this.#x = null, this.#S = new h(this, () => [[
|
|
74
75
|
document,
|
|
75
76
|
"pointerdown",
|
|
76
77
|
this.#C,
|
|
@@ -119,7 +120,7 @@ var j, M = {
|
|
|
119
120
|
if (t.includes(this) || (this.#G(), this.#f = null, e.shiftKey || e.metaKey)) return;
|
|
120
121
|
let n = this.#i;
|
|
121
122
|
if (n !== null) {
|
|
122
|
-
let e = t.find((e) => e instanceof
|
|
123
|
+
let e = t.find((e) => e instanceof M);
|
|
123
124
|
if (e?.selected && e.#i === n) return;
|
|
124
125
|
}
|
|
125
126
|
this.#X(!1);
|
|
@@ -158,7 +159,7 @@ var j, M = {
|
|
|
158
159
|
case "ArrowDown": {
|
|
159
160
|
if (!this.movable) return;
|
|
160
161
|
t.preventDefault(), this.focusRule.reveal();
|
|
161
|
-
let e = t.shiftKey ?
|
|
162
|
+
let e = t.shiftKey ? F : P, n = t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0, r = t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0;
|
|
162
163
|
this.#L();
|
|
163
164
|
let i = this.#g.seed();
|
|
164
165
|
this.#g.moveTo(i.x + n, i.y + r);
|
|
@@ -168,7 +169,7 @@ var j, M = {
|
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
171
|
static {
|
|
171
|
-
this.styles = [d,
|
|
172
|
+
this.styles = [d, D`
|
|
172
173
|
:host {
|
|
173
174
|
display: inline-block;
|
|
174
175
|
cursor: var(--vf-cursor, default);
|
|
@@ -333,8 +334,7 @@ var j, M = {
|
|
|
333
334
|
position: absolute;
|
|
334
335
|
inset: calc(var(--vf-scale, 1) * -2px) calc(var(--vf-scale, 1) * -1px);
|
|
335
336
|
background: var(--vf-white, #fff);
|
|
336
|
-
|
|
337
|
-
padding: calc(var(--vf-scale, 1) * 1px);
|
|
337
|
+
${f({ padding: 1 })}
|
|
338
338
|
}
|
|
339
339
|
.rename {
|
|
340
340
|
display: block;
|
|
@@ -386,12 +386,12 @@ var j, M = {
|
|
|
386
386
|
as a visible focus (see focus-modality.ts). */
|
|
387
387
|
.caption.focus-rule .label::after {
|
|
388
388
|
--vf-focus-underline-offset: -2px;
|
|
389
|
-
${
|
|
389
|
+
${p}
|
|
390
390
|
}
|
|
391
391
|
/* No name, no plate — the rule falls back to the art cell. */
|
|
392
392
|
.art.focus-rule::after {
|
|
393
393
|
--vf-focus-underline-offset: -2px;
|
|
394
|
-
${
|
|
394
|
+
${p}
|
|
395
395
|
}
|
|
396
396
|
:host(:focus) {
|
|
397
397
|
outline: none;
|
|
@@ -553,7 +553,7 @@ var j, M = {
|
|
|
553
553
|
y: Math.round((e.top - u) / o),
|
|
554
554
|
width: Math.round(e.width / o),
|
|
555
555
|
height: Math.round(e.height / o)
|
|
556
|
-
}), m = Math.round((d - l) / o), h = Math.round((f - u) / o), g = this.open && this._ghost ? this._ghost : this.#t, _ = g != null && (g instanceof HTMLCanvasElement ? g.width > 0 : g.complete && g.naturalWidth > 0), v = _ ? g.getBoundingClientRect() : null,
|
|
556
|
+
}), m = Math.round((d - l) / o), h = Math.round((f - u) / o), g = this.open && this._ghost ? this._ghost : this.#t, _ = g != null && (g instanceof HTMLCanvasElement ? g.width > 0 : g.complete && g.naturalWidth > 0), v = _ ? g.getBoundingClientRect() : null, y = b(_ ? g : null, {
|
|
557
557
|
width: m,
|
|
558
558
|
height: h,
|
|
559
559
|
art: v && v.width > 0 ? p(v) : null,
|
|
@@ -565,15 +565,15 @@ var j, M = {
|
|
|
565
565
|
},
|
|
566
566
|
plate: c ? p(c) : null
|
|
567
567
|
});
|
|
568
|
-
if (!
|
|
569
|
-
let x =
|
|
570
|
-
S.position = "absolute", S.width = i(
|
|
571
|
-
let
|
|
568
|
+
if (!y) return null;
|
|
569
|
+
let x = w("drag-outline"), S = x.style;
|
|
570
|
+
S.position = "absolute", S.width = i(y.width), S.height = i(y.height);
|
|
571
|
+
let C = t ?? a, T = t ? t.getBoundingClientRect() : e, E = {
|
|
572
572
|
x: Math.round((l - T.left) / o),
|
|
573
573
|
y: Math.round((u - T.top) / o)
|
|
574
574
|
};
|
|
575
|
-
return
|
|
576
|
-
ring:
|
|
575
|
+
return C.append(x), {
|
|
576
|
+
ring: y,
|
|
577
577
|
canvas: x,
|
|
578
578
|
base: E,
|
|
579
579
|
phase: -1
|
|
@@ -582,8 +582,8 @@ var j, M = {
|
|
|
582
582
|
#P(e, t, n) {
|
|
583
583
|
let r = e.base.x + t, a = e.base.y + n;
|
|
584
584
|
e.canvas.style.left = i(r), e.canvas.style.top = i(a);
|
|
585
|
-
let o =
|
|
586
|
-
o !== e.phase && (e.phase = o,
|
|
585
|
+
let o = C(r, a);
|
|
586
|
+
o !== e.phase && (e.phase = o, S(e.ring, e.canvas, o));
|
|
587
587
|
}
|
|
588
588
|
#F(e) {
|
|
589
589
|
let { left: t, top: n } = e.proposal ?? {
|
|
@@ -634,7 +634,7 @@ var j, M = {
|
|
|
634
634
|
n.selectNodeContents(e), t = n.getBoundingClientRect().width, n.detach();
|
|
635
635
|
}
|
|
636
636
|
let n = t / r(this) + 2, i = Math.max(2, Math.ceil(n / 2) * 2);
|
|
637
|
-
this.#e = this._editing && t === 0 ? Math.max(i,
|
|
637
|
+
this.#e = this._editing && t === 0 ? Math.max(i, N[this.size]) : i, e.style.width = this.#z;
|
|
638
638
|
}
|
|
639
639
|
get #z() {
|
|
640
640
|
return this.#e ? `calc(var(--vf-scale, 1) * ${this.#e}px)` : "";
|
|
@@ -660,7 +660,7 @@ var j, M = {
|
|
|
660
660
|
}
|
|
661
661
|
let n = e instanceof HTMLImageElement ? `${this.size} ${e.currentSrc}` : "";
|
|
662
662
|
if (n !== "" && n === this.#o && this._ghost) return;
|
|
663
|
-
let r =
|
|
663
|
+
let r = x(e);
|
|
664
664
|
if (r) {
|
|
665
665
|
r.className = "ghost", r.style.width = `calc(var(--vf-scale, 1) * ${r.width}px)`, r.style.height = `calc(var(--vf-scale, 1) * ${r.height}px)`;
|
|
666
666
|
let t = e instanceof HTMLImageElement ? e.alt : "";
|
|
@@ -701,7 +701,7 @@ var j, M = {
|
|
|
701
701
|
}
|
|
702
702
|
render() {
|
|
703
703
|
let e = this._editing, t = e ? this._draft : this.label, n = this.focusRule.marked && !e, r = t !== "" || e, i = `caption${e ? " editing" : ""}${n && t ? " focus-rule" : ""}`, a = `art${this.open && this._ghost ? " open" : ""}${n && !t ? " focus-rule" : ""}`, o = this.width ? `width: calc(var(--vf-scale, 1) * ${this.width}px)` : "";
|
|
704
|
-
return
|
|
704
|
+
return O`<div
|
|
705
705
|
class="frame vf-snap"
|
|
706
706
|
part="frame"
|
|
707
707
|
style=${o}
|
|
@@ -713,9 +713,9 @@ var j, M = {
|
|
|
713
713
|
@dblclick=${this.#Q}
|
|
714
714
|
>
|
|
715
715
|
<div class=${a} part="icon">
|
|
716
|
-
${this.size === "small" ?
|
|
716
|
+
${this.size === "small" ? O`<slot name="small" @slotchange=${this.#B}></slot>` : O`<slot name="large" @slotchange=${this.#B}></slot>`}${this._ghost ?? k}
|
|
717
717
|
</div>
|
|
718
|
-
${r ?
|
|
718
|
+
${r ? O`<div class=${i}>
|
|
719
719
|
<!-- No whitespace around the span: it is the measured run, and a
|
|
720
720
|
stray space would widen it. -->
|
|
721
721
|
<div class="label" part="label"><span
|
|
@@ -724,7 +724,7 @@ var j, M = {
|
|
|
724
724
|
style=${this.#e ? `width: ${this.#z}` : ""}
|
|
725
725
|
>${t}</span
|
|
726
726
|
></div>
|
|
727
|
-
${e ?
|
|
727
|
+
${e ? O`<div class="rename-box">
|
|
728
728
|
<input
|
|
729
729
|
class="rename"
|
|
730
730
|
part="input"
|
|
@@ -736,8 +736,8 @@ var j, M = {
|
|
|
736
736
|
@keydown=${this.#ae}
|
|
737
737
|
@blur=${this.commitEditing}
|
|
738
738
|
/>
|
|
739
|
-
</div>` :
|
|
740
|
-
</div>` :
|
|
739
|
+
</div>` : k}
|
|
740
|
+
</div>` : k}
|
|
741
741
|
</div>`;
|
|
742
742
|
}
|
|
743
743
|
#K() {
|
|
@@ -786,10 +786,10 @@ var j, M = {
|
|
|
786
786
|
async dragTo(e, t) {
|
|
787
787
|
if (this.#x?.finish(), await this.updateComplete, this.#x?.finish(), !this.isConnected) return !1;
|
|
788
788
|
this.#L();
|
|
789
|
-
let n = this.#g.seed(), r = this.#g.resolve(e, t), i = r.x - n.x, a = r.y - n.y, o = i === 0 && a === 0 ||
|
|
789
|
+
let n = this.#g.seed(), r = this.#g.resolve(e, t), i = r.x - n.x, a = r.y - n.y, o = i === 0 && a === 0 || v() || this._editing || this.#_ !== null ? null : this.#N(this.#T(), this.#M());
|
|
790
790
|
return o ? (this.#P(o, 0, 0), new Promise((e) => {
|
|
791
791
|
let t = null;
|
|
792
|
-
t =
|
|
792
|
+
t = y(Math.hypot(i, a), (e) => this.#P(o, Math.round(i * e), Math.round(a * e)), () => {
|
|
793
793
|
this.#x === t && (this.#x = null, this.#S.detach()), o.canvas.remove(), this.isConnected && this.#g.moveTo(r.x, r.y), e(!0);
|
|
794
794
|
}), this.#x = t, this.#S.attach();
|
|
795
795
|
})) : (this.#g.moveTo(r.x, r.y), !1);
|
|
@@ -799,7 +799,7 @@ var j, M = {
|
|
|
799
799
|
#$;
|
|
800
800
|
#ee(e, t) {
|
|
801
801
|
let n = this.#d;
|
|
802
|
-
return !n || n.pointerId !== e.pointerId || (this.#d = null, !(e.type !== "pointercancel" && !t && !this._editing && Math.hypot(e.clientX - n.x, e.clientY - n.y) <
|
|
802
|
+
return !n || n.pointerId !== e.pointerId || (this.#d = null, !(e.type !== "pointercancel" && !t && !this._editing && Math.hypot(e.clientX - n.x, e.clientY - n.y) < _(e))) ? !1 : n.second ? !0 : (this.#f = {
|
|
803
803
|
time: n.time,
|
|
804
804
|
x: n.x,
|
|
805
805
|
y: n.y
|
|
@@ -818,27 +818,27 @@ var j, M = {
|
|
|
818
818
|
#ae;
|
|
819
819
|
#oe;
|
|
820
820
|
};
|
|
821
|
-
o([
|
|
821
|
+
o([A()], L.prototype, "label", void 0), o([A({ reflect: !0 })], L.prototype, "size", void 0), o([A({
|
|
822
822
|
type: Boolean,
|
|
823
823
|
reflect: !0
|
|
824
|
-
})],
|
|
824
|
+
})], L.prototype, "selectable", void 0), o([A({
|
|
825
825
|
type: Boolean,
|
|
826
826
|
reflect: !0
|
|
827
|
-
})],
|
|
827
|
+
})], L.prototype, "selected", void 0), o([A({
|
|
828
828
|
type: Boolean,
|
|
829
829
|
reflect: !0
|
|
830
|
-
})],
|
|
830
|
+
})], L.prototype, "target", void 0), o([A({
|
|
831
831
|
type: Boolean,
|
|
832
832
|
reflect: !0
|
|
833
|
-
})],
|
|
833
|
+
})], L.prototype, "color", void 0), o([A({
|
|
834
834
|
type: Boolean,
|
|
835
835
|
reflect: !0
|
|
836
|
-
})],
|
|
836
|
+
})], L.prototype, "open", void 0), o([A({
|
|
837
837
|
type: Boolean,
|
|
838
838
|
reflect: !0
|
|
839
|
-
})],
|
|
839
|
+
})], L.prototype, "movable", void 0), o([A({
|
|
840
840
|
type: Boolean,
|
|
841
841
|
reflect: !0
|
|
842
|
-
})],
|
|
842
|
+
})], L.prototype, "editable", void 0), o([A({ type: Number })], L.prototype, "width", void 0), o([A({ type: Number })], L.prototype, "maxlength", void 0), o([j()], L.prototype, "_editing", void 0), o([j()], L.prototype, "_draft", void 0), o([j()], L.prototype, "_ghost", void 0), L = M = o([t("vf-icon")], L);
|
|
843
843
|
//#endregion
|
|
844
|
-
export {
|
|
844
|
+
export { L as VfIcon };
|
|
@@ -4,21 +4,22 @@ import { ScaleController as n } from "../scale.js";
|
|
|
4
4
|
import r from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
5
|
import { VfPositioned as i } from "../position.js";
|
|
6
6
|
import { vfBase as a } from "../styles/recipes/host.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { vfStrokeDecls as o } from "../styles/recipes/stroke.js";
|
|
8
|
+
import { vfFocusRing as s } from "../styles/recipes/focus.js";
|
|
9
|
+
import { vfScrollRail as c } from "../styles/recipes/scroll-rail.js";
|
|
10
|
+
import { GridSnapController as l } from "../grid-snap.js";
|
|
11
|
+
import { ScrollStateController as u } from "../scroll-state.js";
|
|
12
|
+
import { ScrollRailController as d, renderScrollRail as f } from "../scroll-rail.js";
|
|
13
|
+
import { TypeAheadBuffer as p } from "../type-ahead.js";
|
|
14
|
+
import { LitElement as m, css as h, html as g, nothing as _ } from "lit";
|
|
15
|
+
import { property as v, query as y, queryAssignedElements as b, state as x } from "lit/decorators.js";
|
|
15
16
|
//#region src/components/vf-list.ts
|
|
16
|
-
var
|
|
17
|
+
var S = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), C = class extends i(m) {
|
|
17
18
|
static {
|
|
18
19
|
this.styles = [
|
|
19
20
|
a,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
c,
|
|
22
|
+
h`
|
|
22
23
|
:host {
|
|
23
24
|
display: block;
|
|
24
25
|
}
|
|
@@ -26,21 +27,21 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
26
27
|
:host([disabled]) {
|
|
27
28
|
color: var(--vf-disabled, #c0c0c0);
|
|
28
29
|
}
|
|
29
|
-
/* The snapped wrapper:
|
|
30
|
+
/* The snapped wrapper: the 1px frame (the rail's outer line), the
|
|
30
31
|
[rows | rail] grid — the rail sizes itself to the 15px inside the
|
|
31
32
|
frame — and everything riding the grid-snap offset as one. */
|
|
32
33
|
.box {
|
|
33
|
-
border: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
34
34
|
background: var(--vf-white, #fff);
|
|
35
35
|
display: grid;
|
|
36
36
|
grid-template-columns: 1fr auto;
|
|
37
|
+
${o()}
|
|
37
38
|
}
|
|
38
39
|
.list {
|
|
39
40
|
grid-area: 1 / 1;
|
|
40
41
|
min-width: 0;
|
|
41
42
|
background: var(--vf-white, #fff);
|
|
42
|
-
/* The clamp is the content box's — the .box
|
|
43
|
-
|
|
43
|
+
/* The clamp is the content box's — the .box frame adds its 2px on
|
|
44
|
+
top, keeping the clamped total where it always was. */
|
|
44
45
|
max-height: calc(var(--vf-scale, 1) * var(--vf-list-max-height, 200px));
|
|
45
46
|
/* Native scrolling; the bar itself is hidden by the recipe
|
|
46
47
|
(.vf-scroll) and the reservation is the rail element, not a native
|
|
@@ -55,7 +56,7 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
55
56
|
render()); the ring keeps that stop visible, inset to stay in-box. */
|
|
56
57
|
.list:focus-visible {
|
|
57
58
|
--vf-focus-offset: -2px;
|
|
58
|
-
${
|
|
59
|
+
${s}
|
|
59
60
|
}
|
|
60
61
|
`
|
|
61
62
|
];
|
|
@@ -66,12 +67,12 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
66
67
|
#r;
|
|
67
68
|
#i;
|
|
68
69
|
constructor() {
|
|
69
|
-
super(), this.scale = new n(this), this.gridSnap = new
|
|
70
|
+
super(), this.scale = new n(this), this.gridSnap = new l(this), this.scrollState = new u(this, () => this.viewport, () => this.content, (e) => {
|
|
70
71
|
this._scrollable = e.x || e.y;
|
|
71
|
-
}), this.rail = new
|
|
72
|
+
}), this.rail = new d(this, {
|
|
72
73
|
getScroll: () => this.viewport,
|
|
73
74
|
getContent: () => this.content
|
|
74
|
-
}), this._scrollable = !1, this.multiple = !1, this.value = "", this.values = [], this.disabled = !1, this.label = "", this.#e = -1, this.#t = -1, this.#n = new
|
|
75
|
+
}), this._scrollable = !1, this.multiple = !1, this.value = "", this.values = [], this.disabled = !1, this.label = "", this.#e = -1, this.#t = -1, this.#n = new p(), this.#r = [], this.#i = this.attachInternals(), this.#l = (e) => {
|
|
75
76
|
if (this.disabled) return;
|
|
76
77
|
let t = e.target?.closest("vf-list-item") ?? null;
|
|
77
78
|
if (!t || t.disabled) return;
|
|
@@ -156,21 +157,21 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
156
157
|
e.has("multiple") && (this.#i.ariaMultiSelectable = this.multiple ? "true" : null), e.has("disabled") && (this.#i.ariaDisabled = this.disabled ? "true" : null, this.#c()), e.has("label") && (this.#i.ariaLabel = this.label || null), e.has("values") ? (e.get("values") !== void 0 || this.values.length > 0) && this.#a(this.values) : e.has("value") && (e.get("value") !== void 0 || this.value !== "") && this.#a(this.value ? [this.value] : []);
|
|
157
158
|
}
|
|
158
159
|
#a(e) {
|
|
159
|
-
|
|
160
|
+
S(e, this.#r) || this.#s(e, !1);
|
|
160
161
|
}
|
|
161
162
|
render() {
|
|
162
|
-
return
|
|
163
|
+
return g`
|
|
163
164
|
<div class="box vf-snap">
|
|
164
165
|
<div
|
|
165
166
|
class="list vf-scroll"
|
|
166
167
|
part="list"
|
|
167
|
-
tabindex=${this.disabled && this._scrollable ? "0" :
|
|
168
|
+
tabindex=${this.disabled && this._scrollable ? "0" : _}
|
|
168
169
|
>
|
|
169
170
|
<div class="list-content">
|
|
170
171
|
<slot @slotchange=${this.#o}></slot>
|
|
171
172
|
</div>
|
|
172
173
|
</div>
|
|
173
|
-
${
|
|
174
|
+
${f(this.rail, "vertical")}
|
|
174
175
|
</div>
|
|
175
176
|
`;
|
|
176
177
|
}
|
|
@@ -187,7 +188,7 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
187
188
|
let o = r.filter((e) => e.selected).map((e) => e.value);
|
|
188
189
|
this.#r = [...o];
|
|
189
190
|
let s = o[0] ?? "";
|
|
190
|
-
this.value !== s && (this.value = s),
|
|
191
|
+
this.value !== s && (this.value = s), S(this.values, o) || (this.values = o), this.#c(), n && !S(a, o) && e(this, "vf-change", {
|
|
191
192
|
value: this.value,
|
|
192
193
|
values: [...o]
|
|
193
194
|
});
|
|
@@ -231,15 +232,15 @@ var x = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), S = cl
|
|
|
231
232
|
!t || t.disabled || (t.focus(), t.scrollIntoView({ block: "nearest" }));
|
|
232
233
|
}
|
|
233
234
|
};
|
|
234
|
-
r([
|
|
235
|
+
r([y(".list")], C.prototype, "viewport", void 0), r([y(".list-content")], C.prototype, "content", void 0), r([x()], C.prototype, "_scrollable", void 0), r([v({
|
|
235
236
|
type: Boolean,
|
|
236
237
|
reflect: !0
|
|
237
|
-
})],
|
|
238
|
+
})], C.prototype, "multiple", void 0), r([v()], C.prototype, "value", void 0), r([v({ attribute: !1 })], C.prototype, "values", void 0), r([v({
|
|
238
239
|
type: Boolean,
|
|
239
240
|
reflect: !0
|
|
240
|
-
})],
|
|
241
|
+
})], C.prototype, "disabled", void 0), r([v()], C.prototype, "label", void 0), r([b({
|
|
241
242
|
selector: "vf-list-item",
|
|
242
243
|
flatten: !0
|
|
243
|
-
})],
|
|
244
|
+
})], C.prototype, "_items", void 0), C = r([t("vf-list")], C);
|
|
244
245
|
//#endregion
|
|
245
|
-
export {
|
|
246
|
+
export { C as VfList };
|
|
@@ -125,22 +125,23 @@ var T = class extends a(_) {
|
|
|
125
125
|
@media (forced-colors: active) {
|
|
126
126
|
forced-color-adjust: none;
|
|
127
127
|
}
|
|
128
|
-
background: var(--vf-highlight, #000);
|
|
129
128
|
color: var(--vf-highlight-text, #fff);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
}
|
|
130
|
+
/* The hilite leaves the bar's top row white: System 7's plate is rows
|
|
131
|
+
1..18 of the 20px bar (the Label specimen in Menus.png is 18px of
|
|
132
|
+
plate, and InfiniteMac shows the white row above it). So the plate is
|
|
133
|
+
a layer inset a row top and bottom rather than the label's own
|
|
134
|
+
background: the top row shows the bar's white through, the bottom row
|
|
135
|
+
the bar's own black rule, and the hit rect stays the full bar height
|
|
136
|
+
so a click slammed against the screen top still opens the menu. The
|
|
137
|
+
title doesn't move. The label is positioned (vf-snap), and the title
|
|
138
|
+
is too, so the plate paints under it in tree order. */
|
|
139
|
+
:host([open]) .label::before,
|
|
140
|
+
.label.flash-on::before {
|
|
141
|
+
content: '';
|
|
142
|
+
position: absolute;
|
|
143
|
+
inset: calc(var(--vf-scale, 1) * 1px) 0;
|
|
144
|
+
background: var(--vf-highlight, #000);
|
|
144
145
|
}
|
|
145
146
|
/* The title rides in its own box so the focus rule spans the title and
|
|
146
147
|
not the bar cell's 10px padding — the same reason vf-button wraps its
|
|
@@ -198,13 +199,14 @@ var T = class extends a(_) {
|
|
|
198
199
|
from. (The nowrap rows make min-content the widest row, so the
|
|
199
200
|
shrink-to-fit abspos width IS the MDEF width.) */
|
|
200
201
|
min-width: 100%;
|
|
201
|
-
/* No
|
|
202
|
-
|
|
203
|
-
the
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
202
|
+
/* No inset of its own beyond the frame, whose 1px stroke is the
|
|
203
|
+
panel's padding (vfPanel): every panel in Menus.png — both
|
|
204
|
+
pulldowns, the open popup and the closed pill — puts its first
|
|
205
|
+
row's ink at +4 from the border box, which is the 1px frame plus
|
|
206
|
+
the row's own 3px ✓ bias. The bottom line likewise sits
|
|
207
|
+
immediately after the last row. A 2px inset here displaced every
|
|
208
|
+
row by 2px against the art; it was invisible while the rows
|
|
209
|
+
themselves were 6px too tall. */
|
|
208
210
|
z-index: 1000;
|
|
209
211
|
/* As on the title: the held press, not the browser, owns touch moves
|
|
210
212
|
over the dropped panel. */
|
|
@@ -3,16 +3,17 @@ import { vfElement as t } from "../define.js";
|
|
|
3
3
|
import n from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
4
4
|
import { VfPositioned as r } from "../position.js";
|
|
5
5
|
import { vfBase as i } from "../styles/recipes/host.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { vfStrokeInset as a } from "../styles/recipes/stroke.js";
|
|
7
|
+
import { vfField as o } from "../styles/recipes/field.js";
|
|
8
|
+
import { STEPPER as s, STEPPER_DOWN_FILL as c, STEPPER_UP_FILL as l } from "../glyphs.js";
|
|
9
|
+
import { VfTextControlBase as u } from "../text-control.js";
|
|
10
|
+
import { decimalsOf as d } from "../number.js";
|
|
11
|
+
import { css as f, html as p, nothing as m } from "lit";
|
|
12
|
+
import { property as h, query as g, state as _ } from "lit/decorators.js";
|
|
13
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
14
|
+
import { live as y } from "lit/directives/live.js";
|
|
14
15
|
//#region src/components/vf-number-field.ts
|
|
15
|
-
var
|
|
16
|
+
var b = class extends r(u) {
|
|
16
17
|
constructor(...t) {
|
|
17
18
|
super(...t), this.step = 1, this.pressed = null, this.#l = (e) => {
|
|
18
19
|
if (this.isDisabled || this.readonly) return;
|
|
@@ -48,14 +49,14 @@ var y = class extends r(l) {
|
|
|
48
49
|
this.value = e.target.value, this.#o("vf-input");
|
|
49
50
|
}, this.#p = (t) => {
|
|
50
51
|
let n = t.target.value, r = parseFloat(n);
|
|
51
|
-
this.value = Number.isNaN(r) ? n : String(Number(this.#r(r).toFixed(
|
|
52
|
+
this.value = Number.isNaN(r) ? n : String(Number(this.#r(r).toFixed(d(this.step)))), this.#o("vf-change"), e(this, "change");
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
static {
|
|
55
56
|
this.styles = [
|
|
56
57
|
i,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
o,
|
|
59
|
+
f`
|
|
59
60
|
:host {
|
|
60
61
|
display: inline-flex;
|
|
61
62
|
/* NOT stretch: that sized the well to the stepper's 25px, making this
|
|
@@ -82,7 +83,7 @@ var y = class extends r(l) {
|
|
|
82
83
|
(1 above / 2 below) — optically centered, still on the device grid. */
|
|
83
84
|
margin-top: calc(var(--vf-scale, 1) * 1px);
|
|
84
85
|
}
|
|
85
|
-
input {
|
|
86
|
+
input.vf-field {
|
|
86
87
|
flex: 1 1 auto;
|
|
87
88
|
width: var(--vf-number-field-width, 4em);
|
|
88
89
|
min-width: 2em;
|
|
@@ -94,7 +95,8 @@ var y = class extends r(l) {
|
|
|
94
95
|
fills it, and a user stylesheet raising line-height grows the well
|
|
95
96
|
instead of clipping the digits. */
|
|
96
97
|
min-height: calc(var(--vf-scale, 1) * var(--vf-control-height, 22px));
|
|
97
|
-
|
|
98
|
+
/* The 6px text inset, inside the well's stroke (vfField). */
|
|
99
|
+
padding: ${a(0)} ${a(6)};
|
|
98
100
|
text-align: right;
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -152,7 +154,7 @@ var y = class extends r(l) {
|
|
|
152
154
|
return this.min != null && e < this.min ? this.min : this.max != null && e > this.max ? this.max : e;
|
|
153
155
|
}
|
|
154
156
|
#i(t) {
|
|
155
|
-
let n = String(Number(this.#r(t).toFixed(
|
|
157
|
+
let n = String(Number(this.#r(t).toFixed(d(this.step))));
|
|
156
158
|
n !== this.value && (this.value = n, this.#o("vf-change"), e(this, "input"), e(this, "change"));
|
|
157
159
|
}
|
|
158
160
|
#a(e) {
|
|
@@ -181,7 +183,7 @@ var y = class extends r(l) {
|
|
|
181
183
|
#p;
|
|
182
184
|
render() {
|
|
183
185
|
let e = this.isDisabled, t = this.#n();
|
|
184
|
-
return
|
|
186
|
+
return p`
|
|
185
187
|
<div class=${this.wellClass}>
|
|
186
188
|
<input
|
|
187
189
|
part="input"
|
|
@@ -194,14 +196,14 @@ var y = class extends r(l) {
|
|
|
194
196
|
maxlength=${this.forwardedAttr("maxlength")}
|
|
195
197
|
spellcheck=${this.forwardedAttr("spellcheck")}
|
|
196
198
|
autocapitalize=${this.forwardedAttr("autocapitalize")}
|
|
197
|
-
aria-label=${this.label || this.hostLabel ||
|
|
199
|
+
aria-label=${this.label || this.hostLabel || m}
|
|
198
200
|
aria-describedby=${this.describedBy}
|
|
199
|
-
aria-required=${this.required ? "true" :
|
|
200
|
-
aria-invalid=${this.validity.valid ?
|
|
201
|
-
aria-valuenow=${Number.isNaN(t) ?
|
|
202
|
-
aria-valuemin=${this.min ??
|
|
203
|
-
aria-valuemax=${this.max ??
|
|
204
|
-
.value=${
|
|
201
|
+
aria-required=${this.required ? "true" : m}
|
|
202
|
+
aria-invalid=${this.validity.valid ? m : "true"}
|
|
203
|
+
aria-valuenow=${Number.isNaN(t) ? m : t}
|
|
204
|
+
aria-valuemin=${this.min ?? m}
|
|
205
|
+
aria-valuemax=${this.max ?? m}
|
|
206
|
+
.value=${y(this.value)}
|
|
205
207
|
placeholder=${this.placeholder}
|
|
206
208
|
?disabled=${e}
|
|
207
209
|
?readonly=${this.readonly}
|
|
@@ -212,15 +214,15 @@ var y = class extends r(l) {
|
|
|
212
214
|
</div>
|
|
213
215
|
<span class="stepper vf-snap" part="stepper">
|
|
214
216
|
<svg viewBox="0 0 15 25" shape-rendering="crispEdges" fill="currentColor" aria-hidden="true">
|
|
215
|
-
<path d=${
|
|
216
|
-
<path class=${
|
|
217
|
+
<path d=${s.d}></path>
|
|
218
|
+
<path class=${v({
|
|
217
219
|
fill: !0,
|
|
218
220
|
on: this.pressed === "up"
|
|
219
|
-
})} d=${
|
|
220
|
-
<path class=${
|
|
221
|
+
})} d=${l.d}></path>
|
|
222
|
+
<path class=${v({
|
|
221
223
|
fill: !0,
|
|
222
224
|
on: this.pressed === "down"
|
|
223
|
-
})} d=${
|
|
225
|
+
})} d=${c.d}></path>
|
|
224
226
|
</svg>
|
|
225
227
|
<span
|
|
226
228
|
class="hit up"
|
|
@@ -243,6 +245,6 @@ var y = class extends r(l) {
|
|
|
243
245
|
`;
|
|
244
246
|
}
|
|
245
247
|
};
|
|
246
|
-
n([
|
|
248
|
+
n([h({ type: Number })], b.prototype, "min", void 0), n([h({ type: Number })], b.prototype, "max", void 0), n([h({ type: Number })], b.prototype, "step", void 0), n([_()], b.prototype, "pressed", void 0), n([g("input")], b.prototype, "input", void 0), b = n([t("vf-number-field")], b);
|
|
247
249
|
//#endregion
|
|
248
|
-
export {
|
|
250
|
+
export { b as VfNumberField };
|