vintage-frames 0.13.0 → 0.14.1
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/README.md +16 -0
- package/custom-elements.json +184 -20
- package/dist/components/vf-checkbox.d.ts +6 -5
- package/dist/components/vf-checkbox.js +41 -37
- package/dist/components/vf-container.d.ts +14 -14
- package/dist/components/vf-container.js +58 -28
- package/dist/components/vf-desktop.d.ts +114 -12
- package/dist/components/vf-desktop.js +119 -58
- package/dist/components/vf-fieldset.js +30 -22
- package/dist/components/vf-icon-field.d.ts +1 -1
- package/dist/components/vf-icon.js +111 -104
- package/dist/components/vf-list.js +30 -29
- package/dist/components/vf-menu-bar.d.ts +5 -0
- package/dist/components/vf-menu-bar.js +67 -43
- 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.d.ts +13 -0
- package/dist/components/vf-window.js +101 -72
- package/dist/index.d.ts +12 -1
- package/dist/index.js +61 -59
- package/dist/pattern-fill.d.ts +11 -8
- package/dist/pattern-fill.js +2 -4
- package/dist/position.d.ts +25 -7
- package/dist/position.js +6 -3
- package/dist/shell/alert.d.ts +32 -0
- package/dist/shell/alert.js +44 -0
- package/dist/shell/catalog.d.ts +168 -0
- package/dist/shell/catalog.js +278 -0
- package/dist/shell/clock.d.ts +16 -0
- package/dist/shell/clock.js +36 -0
- package/dist/shell/filing.d.ts +39 -0
- package/dist/shell/filing.js +68 -0
- package/dist/shell/finder.d.ts +116 -0
- package/dist/shell/finder.js +564 -0
- package/dist/shell/geometry.d.ts +196 -0
- package/dist/shell/geometry.js +241 -0
- package/dist/shell/index.d.ts +29 -0
- package/dist/shell/index.js +11 -0
- package/dist/shell/shell.d.ts +150 -0
- package/dist/shell/shell.js +213 -0
- package/dist/shell/state.d.ts +88 -0
- package/dist/shell/state.js +103 -0
- package/dist/shell/storage.d.ts +14 -0
- package/dist/shell/storage.js +41 -0
- package/dist/shell/windows.d.ts +215 -0
- package/dist/shell/windows.js +343 -0
- 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/window-chrome.d.ts +43 -0
- package/dist/window-chrome.js +13 -0
- package/dist/zoom.d.ts +9 -9
- package/docs/SPEC.md +34 -32
- package/editor/vscode.html-custom-data.json +12 -7
- package/editor/web-types.json +50 -14
- package/package.json +10 -2
|
@@ -5,36 +5,37 @@ 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, n) => n <= t ? Math.max(e, t) : Math.min(Math.max(e, t), n), L = "vf-icon-field, [role=\"listbox\"]", R = (e) => e instanceof Element && e.matches(L), z = 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
|
-
this.#
|
|
30
|
+
this.#ne,
|
|
30
31
|
!0
|
|
31
32
|
]]), this.#m = (e, t, n) => this.#h() ? {
|
|
32
33
|
x: Math.max(e, 0),
|
|
33
|
-
y: Math.max(t,
|
|
34
|
+
y: Math.max(t, n.top)
|
|
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, 0, n.width - a(this.offsetWidth, this)),
|
|
37
|
+
y: I(t, n.top, 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,
|
|
@@ -85,10 +86,16 @@ var j, M = {
|
|
|
85
86
|
}, this.#w = (e) => {
|
|
86
87
|
e.key !== "Escape" || !this.#x || (e.preventDefault(), e.stopPropagation(), this.#x.finish());
|
|
87
88
|
}, this.#I = !1, this.#B = () => {
|
|
88
|
-
this.#H(), this.#
|
|
89
|
+
this.#H(), this.#q();
|
|
89
90
|
}, this.#V = () => {
|
|
90
91
|
this.#U();
|
|
91
|
-
}, this.#
|
|
92
|
+
}, this.#K = () => {
|
|
93
|
+
queueMicrotask(() => {
|
|
94
|
+
if (!this._editing) return;
|
|
95
|
+
let e = this.renderRoot.querySelector("input");
|
|
96
|
+
e && this.renderRoot.activeElement === e || this.commitEditing();
|
|
97
|
+
});
|
|
98
|
+
}, this.#Q = (e) => {
|
|
92
99
|
if (e.button !== 0 || this._editing) return;
|
|
93
100
|
let t = e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("label")), n = this.selected, r = e.timeStamp - this.#l < 800;
|
|
94
101
|
this.#l = e.timeStamp, this.#G();
|
|
@@ -101,43 +108,43 @@ var j, M = {
|
|
|
101
108
|
second: i !== null && e.timeStamp - i.time <= 500 && Math.hypot(e.clientX - i.x, e.clientY - i.y) <= 24
|
|
102
109
|
} : null;
|
|
103
110
|
let a = !e.shiftKey && !e.metaKey;
|
|
104
|
-
this.selectable && (a ? this.#
|
|
105
|
-
}, this
|
|
111
|
+
this.selectable && (a ? this.#Z(!0) : this.#Z(!this.selected)), this.#a = a && n && this.#i !== null, this.editable && t && n && !r && !e.shiftKey && !e.metaKey && this.#W(), this.#Y && (this.focus({ preventScroll: !0 }), this.focusRule.suppress()), this.#v.onPointerDown(e);
|
|
112
|
+
}, this.#$ = () => {
|
|
106
113
|
this._editing || this.#u || e(this, "vf-open", {});
|
|
107
|
-
}, this
|
|
114
|
+
}, this.#ee = (t) => {
|
|
108
115
|
let n = this.#_?.proposal != null;
|
|
109
116
|
this.#v.onPointerUp(t);
|
|
110
|
-
let r = this.#
|
|
117
|
+
let r = this.#te(t, n);
|
|
111
118
|
if (this.#a) {
|
|
112
119
|
this.#a = !1;
|
|
113
120
|
let e = t.type === "pointercancel" ? null : this.#i;
|
|
114
121
|
for (let t of e?.querySelectorAll("vf-icon") ?? []) t !== this && t.selected && t.setSelected(!1);
|
|
115
122
|
}
|
|
116
123
|
r && e(this, "vf-open", {});
|
|
117
|
-
}, this.#
|
|
124
|
+
}, this.#ne = (e) => {
|
|
118
125
|
let t = e.composedPath();
|
|
119
126
|
if (t.includes(this) || (this.#G(), this.#f = null, e.shiftKey || e.metaKey)) return;
|
|
120
127
|
let n = this.#i;
|
|
121
128
|
if (n !== null) {
|
|
122
|
-
let e = t.find((e) => e instanceof
|
|
123
|
-
if (e?.selected && e.#i === n) return;
|
|
129
|
+
let e = t.find((e) => e instanceof M);
|
|
130
|
+
if (!e && !t.some(R) || e?.selected && e.#i === n) return;
|
|
124
131
|
}
|
|
125
|
-
this.#
|
|
126
|
-
}, this.#
|
|
132
|
+
this.#Z(!1);
|
|
133
|
+
}, this.#re = (e) => {
|
|
127
134
|
let t = e.target, n = e.data ?? e.dataTransfer?.getData("text") ?? "";
|
|
128
135
|
if (n === "") return;
|
|
129
136
|
let r = t.selectionStart ?? t.value.length, i = t.selectionEnd ?? r, a = t.value.slice(0, r) + n + t.value.slice(i);
|
|
130
|
-
a.length > this.maxlength && this.#
|
|
131
|
-
}, this.#
|
|
137
|
+
a.length > this.maxlength && this.#ae(a);
|
|
138
|
+
}, this.#ie = (e) => {
|
|
132
139
|
let t = e.target;
|
|
133
140
|
if (t.value.length > this.maxlength) {
|
|
134
141
|
let e = t.value, n = Math.min(t.selectionStart ?? this.maxlength, this.maxlength);
|
|
135
|
-
t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#
|
|
142
|
+
t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#ae(e);
|
|
136
143
|
}
|
|
137
144
|
this._draft = t.value;
|
|
138
|
-
}, this.#
|
|
145
|
+
}, this.#oe = (e) => {
|
|
139
146
|
e.key === "Enter" ? (e.preventDefault(), this.commitEditing(), this.focus()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.cancelEditing(), this.focus());
|
|
140
|
-
}, this.#
|
|
147
|
+
}, this.#se = (t) => {
|
|
141
148
|
if (this.#G(), !(this._editing || t.defaultPrevented)) {
|
|
142
149
|
if ((t.metaKey || t.ctrlKey) && !t.altKey && (t.key.toLowerCase() === "o" || t.key === "ArrowDown")) {
|
|
143
150
|
t.preventDefault(), e(this, "vf-open", {});
|
|
@@ -150,7 +157,7 @@ var j, M = {
|
|
|
150
157
|
return;
|
|
151
158
|
case " ":
|
|
152
159
|
if (!this.selectable) return;
|
|
153
|
-
t.preventDefault(), this.focusRule.reveal(), this.#
|
|
160
|
+
t.preventDefault(), this.focusRule.reveal(), this.#Z(!this.selected);
|
|
154
161
|
return;
|
|
155
162
|
case "ArrowLeft":
|
|
156
163
|
case "ArrowRight":
|
|
@@ -158,7 +165,7 @@ var j, M = {
|
|
|
158
165
|
case "ArrowDown": {
|
|
159
166
|
if (!this.movable) return;
|
|
160
167
|
t.preventDefault(), this.focusRule.reveal();
|
|
161
|
-
let e = t.shiftKey ?
|
|
168
|
+
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
169
|
this.#L();
|
|
163
170
|
let i = this.#g.seed();
|
|
164
171
|
this.#g.moveTo(i.x + n, i.y + r);
|
|
@@ -168,7 +175,7 @@ var j, M = {
|
|
|
168
175
|
};
|
|
169
176
|
}
|
|
170
177
|
static {
|
|
171
|
-
this.styles = [d,
|
|
178
|
+
this.styles = [d, D`
|
|
172
179
|
:host {
|
|
173
180
|
display: inline-block;
|
|
174
181
|
cursor: var(--vf-cursor, default);
|
|
@@ -333,8 +340,7 @@ var j, M = {
|
|
|
333
340
|
position: absolute;
|
|
334
341
|
inset: calc(var(--vf-scale, 1) * -2px) calc(var(--vf-scale, 1) * -1px);
|
|
335
342
|
background: var(--vf-white, #fff);
|
|
336
|
-
|
|
337
|
-
padding: calc(var(--vf-scale, 1) * 1px);
|
|
343
|
+
${f({ padding: 1 })}
|
|
338
344
|
}
|
|
339
345
|
.rename {
|
|
340
346
|
display: block;
|
|
@@ -386,12 +392,12 @@ var j, M = {
|
|
|
386
392
|
as a visible focus (see focus-modality.ts). */
|
|
387
393
|
.caption.focus-rule .label::after {
|
|
388
394
|
--vf-focus-underline-offset: -2px;
|
|
389
|
-
${
|
|
395
|
+
${p}
|
|
390
396
|
}
|
|
391
397
|
/* No name, no plate — the rule falls back to the art cell. */
|
|
392
398
|
.art.focus-rule::after {
|
|
393
399
|
--vf-focus-underline-offset: -2px;
|
|
394
|
-
${
|
|
400
|
+
${p}
|
|
395
401
|
}
|
|
396
402
|
:host(:focus) {
|
|
397
403
|
outline: none;
|
|
@@ -405,7 +411,7 @@ var j, M = {
|
|
|
405
411
|
return this.#i !== null;
|
|
406
412
|
}
|
|
407
413
|
get #i() {
|
|
408
|
-
return this.closest(
|
|
414
|
+
return this.closest(L);
|
|
409
415
|
}
|
|
410
416
|
#a;
|
|
411
417
|
#o;
|
|
@@ -533,11 +539,11 @@ var j, M = {
|
|
|
533
539
|
}, ...e.followers.map((e) => ({
|
|
534
540
|
corner: r(e.origin, e.offset),
|
|
535
541
|
size: e.size
|
|
536
|
-
}))], a = this.#h(), o = (e, t, n, r) => {
|
|
537
|
-
let
|
|
538
|
-
for (let e of i)
|
|
539
|
-
return
|
|
540
|
-
}, s = o(t.left - e.origin.x, (e) => e.corner.x, (e) => e.size.width, n.width), c = o(t.top - e.origin.y, (e) => e.corner.y, (e) => e.size.height, n.height);
|
|
542
|
+
}))], a = this.#h(), o = (e, t, n, r, o) => {
|
|
543
|
+
let s = -Infinity, c = Infinity;
|
|
544
|
+
for (let e of i) s = Math.max(s, r - t(e)), a || (c = Math.min(c, o - n(e) - t(e)));
|
|
545
|
+
return c < s && (c = Infinity), Math.min(Math.max(e, s), c);
|
|
546
|
+
}, s = o(t.left - e.origin.x, (e) => e.corner.x, (e) => e.size.width, 0, n.width), c = o(t.top - e.origin.y, (e) => e.corner.y, (e) => e.size.height, n.top, n.height);
|
|
541
547
|
this.#g.moveTo(e.origin.x + s, e.origin.y + c);
|
|
542
548
|
for (let t of e.followers) t.drop(s, c);
|
|
543
549
|
}
|
|
@@ -553,7 +559,7 @@ var j, M = {
|
|
|
553
559
|
y: Math.round((e.top - u) / o),
|
|
554
560
|
width: Math.round(e.width / o),
|
|
555
561
|
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,
|
|
562
|
+
}), 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
563
|
width: m,
|
|
558
564
|
height: h,
|
|
559
565
|
art: v && v.width > 0 ? p(v) : null,
|
|
@@ -565,15 +571,15 @@ var j, M = {
|
|
|
565
571
|
},
|
|
566
572
|
plate: c ? p(c) : null
|
|
567
573
|
});
|
|
568
|
-
if (!
|
|
569
|
-
let x =
|
|
570
|
-
S.position = "absolute", S.width = i(
|
|
571
|
-
let
|
|
574
|
+
if (!y) return null;
|
|
575
|
+
let x = w("drag-outline"), S = x.style;
|
|
576
|
+
S.position = "absolute", S.width = i(y.width), S.height = i(y.height);
|
|
577
|
+
let C = t ?? a, T = t ? t.getBoundingClientRect() : e, E = {
|
|
572
578
|
x: Math.round((l - T.left) / o),
|
|
573
579
|
y: Math.round((u - T.top) / o)
|
|
574
580
|
};
|
|
575
|
-
return
|
|
576
|
-
ring:
|
|
581
|
+
return C.append(x), {
|
|
582
|
+
ring: y,
|
|
577
583
|
canvas: x,
|
|
578
584
|
base: E,
|
|
579
585
|
phase: -1
|
|
@@ -582,8 +588,8 @@ var j, M = {
|
|
|
582
588
|
#P(e, t, n) {
|
|
583
589
|
let r = e.base.x + t, a = e.base.y + n;
|
|
584
590
|
e.canvas.style.left = i(r), e.canvas.style.top = i(a);
|
|
585
|
-
let o =
|
|
586
|
-
o !== e.phase && (e.phase = o,
|
|
591
|
+
let o = C(r, a);
|
|
592
|
+
o !== e.phase && (e.phase = o, S(e.ring, e.canvas, o));
|
|
587
593
|
}
|
|
588
594
|
#F(e) {
|
|
589
595
|
let { left: t, top: n } = e.proposal ?? {
|
|
@@ -601,15 +607,15 @@ var j, M = {
|
|
|
601
607
|
};
|
|
602
608
|
}
|
|
603
609
|
connectedCallback() {
|
|
604
|
-
super.connectedCallback(), this.#
|
|
610
|
+
super.connectedCallback(), this.#X(), this.#q(), this.selectable && this.selected && this.#p.attach(), this.addEventListener("keydown", this.#se);
|
|
605
611
|
}
|
|
606
612
|
disconnectedCallback() {
|
|
607
|
-
super.disconnectedCallback(), this.removeEventListener("keydown", this.#
|
|
613
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.#se), this.#G(), this.#_?.outline?.canvas.remove();
|
|
608
614
|
for (let e of this.#_?.followers ?? []) e.end();
|
|
609
615
|
this.#_ = null, this.#x?.finish();
|
|
610
616
|
}
|
|
611
617
|
updated(e) {
|
|
612
|
-
if (e.has("selectable") && this.#
|
|
618
|
+
if (e.has("selectable") && this.#X(), (e.has("selectable") || e.has("selected") || e.has("label")) && this.#q(), (e.has("selected") || e.has("selectable")) && (this.selectable && this.selected ? this.#p.attach() : this.#p.detach()), e.has("_editing") && this._editing) {
|
|
613
619
|
let e = this.renderRoot.querySelector("input");
|
|
614
620
|
e?.focus(), e?.select();
|
|
615
621
|
}
|
|
@@ -634,7 +640,7 @@ var j, M = {
|
|
|
634
640
|
n.selectNodeContents(e), t = n.getBoundingClientRect().width, n.detach();
|
|
635
641
|
}
|
|
636
642
|
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,
|
|
643
|
+
this.#e = this._editing && t === 0 ? Math.max(i, N[this.size]) : i, e.style.width = this.#z;
|
|
638
644
|
}
|
|
639
645
|
get #z() {
|
|
640
646
|
return this.#e ? `calc(var(--vf-scale, 1) * ${this.#e}px)` : "";
|
|
@@ -660,7 +666,7 @@ var j, M = {
|
|
|
660
666
|
}
|
|
661
667
|
let n = e instanceof HTMLImageElement ? `${this.size} ${e.currentSrc}` : "";
|
|
662
668
|
if (n !== "" && n === this.#o && this._ghost) return;
|
|
663
|
-
let r =
|
|
669
|
+
let r = x(e);
|
|
664
670
|
if (r) {
|
|
665
671
|
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
672
|
let t = e instanceof HTMLImageElement ? e.alt : "";
|
|
@@ -696,26 +702,27 @@ var j, M = {
|
|
|
696
702
|
previous: t
|
|
697
703
|
}));
|
|
698
704
|
}
|
|
705
|
+
#K;
|
|
699
706
|
cancelEditing() {
|
|
700
707
|
this._editing && (this._editing = !1, this._draft = this.#s);
|
|
701
708
|
}
|
|
702
709
|
render() {
|
|
703
710
|
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
|
|
711
|
+
return O`<div
|
|
705
712
|
class="frame vf-snap"
|
|
706
713
|
part="frame"
|
|
707
714
|
style=${o}
|
|
708
|
-
@pointerdown=${this.#
|
|
715
|
+
@pointerdown=${this.#Q}
|
|
709
716
|
@pointermove=${this.#v.onPointerMove}
|
|
710
|
-
@pointerup=${this
|
|
711
|
-
@pointercancel=${this
|
|
712
|
-
@lostpointercapture=${this
|
|
713
|
-
@dblclick=${this
|
|
717
|
+
@pointerup=${this.#ee}
|
|
718
|
+
@pointercancel=${this.#ee}
|
|
719
|
+
@lostpointercapture=${this.#ee}
|
|
720
|
+
@dblclick=${this.#$}
|
|
714
721
|
>
|
|
715
722
|
<div class=${a} part="icon">
|
|
716
|
-
${this.size === "small" ?
|
|
723
|
+
${this.size === "small" ? O`<slot name="small" @slotchange=${this.#B}></slot>` : O`<slot name="large" @slotchange=${this.#B}></slot>`}${this._ghost ?? k}
|
|
717
724
|
</div>
|
|
718
|
-
${r ?
|
|
725
|
+
${r ? O`<div class=${i}>
|
|
719
726
|
<!-- No whitespace around the span: it is the measured run, and a
|
|
720
727
|
stray space would widen it. -->
|
|
721
728
|
<div class="label" part="label"><span
|
|
@@ -724,23 +731,23 @@ var j, M = {
|
|
|
724
731
|
style=${this.#e ? `width: ${this.#z}` : ""}
|
|
725
732
|
>${t}</span
|
|
726
733
|
></div>
|
|
727
|
-
${e ?
|
|
734
|
+
${e ? O`<div class="rename-box">
|
|
728
735
|
<input
|
|
729
736
|
class="rename"
|
|
730
737
|
part="input"
|
|
731
738
|
type="text"
|
|
732
739
|
maxlength=${this.maxlength}
|
|
733
740
|
.value=${this._draft}
|
|
734
|
-
@beforeinput=${this.#
|
|
735
|
-
@input=${this.#
|
|
736
|
-
@keydown=${this.#
|
|
737
|
-
@blur=${this
|
|
741
|
+
@beforeinput=${this.#re}
|
|
742
|
+
@input=${this.#ie}
|
|
743
|
+
@keydown=${this.#oe}
|
|
744
|
+
@blur=${this.#K}
|
|
738
745
|
/>
|
|
739
|
-
</div>` :
|
|
740
|
-
</div>` :
|
|
746
|
+
</div>` : k}
|
|
747
|
+
</div>` : k}
|
|
741
748
|
</div>`;
|
|
742
749
|
}
|
|
743
|
-
#
|
|
750
|
+
#q() {
|
|
744
751
|
if (!this.selectable) {
|
|
745
752
|
this.#n.role = null, this.#n.ariaSelected = null, this.#n.ariaLabel = null;
|
|
746
753
|
return;
|
|
@@ -749,22 +756,22 @@ var j, M = {
|
|
|
749
756
|
this.#n.role = "option", this.#n.ariaSelected = this.selected ? "true" : "false", this.#n.ariaLabel = null;
|
|
750
757
|
return;
|
|
751
758
|
}
|
|
752
|
-
this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#
|
|
759
|
+
this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#J || null;
|
|
753
760
|
}
|
|
754
|
-
get #
|
|
761
|
+
get #J() {
|
|
755
762
|
return this.#t instanceof HTMLImageElement ? this.#t.alt : "";
|
|
756
763
|
}
|
|
757
|
-
get #
|
|
764
|
+
get #Y() {
|
|
758
765
|
return this.selectable;
|
|
759
766
|
}
|
|
760
|
-
#
|
|
761
|
-
this.hasAttribute("tabindex") || (this.#
|
|
767
|
+
#X() {
|
|
768
|
+
this.hasAttribute("tabindex") || (this.#Y ? this.tabIndex = 0 : this.removeAttribute("tabindex"));
|
|
762
769
|
}
|
|
763
|
-
#
|
|
770
|
+
#Z(t) {
|
|
764
771
|
t !== this.selected && (this.selected = t, e(this, "vf-select", { selected: t }));
|
|
765
772
|
}
|
|
766
773
|
setSelected(e) {
|
|
767
|
-
this.#
|
|
774
|
+
this.#Z(e);
|
|
768
775
|
}
|
|
769
776
|
touches(e) {
|
|
770
777
|
let t = this.renderRoot;
|
|
@@ -786,59 +793,59 @@ var j, M = {
|
|
|
786
793
|
async dragTo(e, t) {
|
|
787
794
|
if (this.#x?.finish(), await this.updateComplete, this.#x?.finish(), !this.isConnected) return !1;
|
|
788
795
|
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 ||
|
|
796
|
+
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
797
|
return o ? (this.#P(o, 0, 0), new Promise((e) => {
|
|
791
798
|
let t = null;
|
|
792
|
-
t =
|
|
799
|
+
t = y(Math.hypot(i, a), (e) => this.#P(o, Math.round(i * e), Math.round(a * e)), () => {
|
|
793
800
|
this.#x === t && (this.#x = null, this.#S.detach()), o.canvas.remove(), this.isConnected && this.#g.moveTo(r.x, r.y), e(!0);
|
|
794
801
|
}), this.#x = t, this.#S.attach();
|
|
795
802
|
})) : (this.#g.moveTo(r.x, r.y), !1);
|
|
796
803
|
}
|
|
797
|
-
#Z;
|
|
798
804
|
#Q;
|
|
799
805
|
#$;
|
|
800
|
-
#ee
|
|
806
|
+
#ee;
|
|
807
|
+
#te(e, t) {
|
|
801
808
|
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) <
|
|
809
|
+
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
810
|
time: n.time,
|
|
804
811
|
x: n.x,
|
|
805
812
|
y: n.y
|
|
806
813
|
}, !1);
|
|
807
814
|
}
|
|
808
|
-
#te;
|
|
809
815
|
#ne;
|
|
810
816
|
#re;
|
|
811
|
-
#ie
|
|
817
|
+
#ie;
|
|
818
|
+
#ae(t) {
|
|
812
819
|
e(this, "vf-name-too-long", {
|
|
813
820
|
attempted: t,
|
|
814
821
|
accepted: t.slice(0, this.maxlength),
|
|
815
822
|
limit: this.maxlength
|
|
816
823
|
});
|
|
817
824
|
}
|
|
818
|
-
#ae;
|
|
819
825
|
#oe;
|
|
826
|
+
#se;
|
|
820
827
|
};
|
|
821
|
-
o([
|
|
828
|
+
o([A()], z.prototype, "label", void 0), o([A({ reflect: !0 })], z.prototype, "size", void 0), o([A({
|
|
822
829
|
type: Boolean,
|
|
823
830
|
reflect: !0
|
|
824
|
-
})],
|
|
831
|
+
})], z.prototype, "selectable", void 0), o([A({
|
|
825
832
|
type: Boolean,
|
|
826
833
|
reflect: !0
|
|
827
|
-
})],
|
|
834
|
+
})], z.prototype, "selected", void 0), o([A({
|
|
828
835
|
type: Boolean,
|
|
829
836
|
reflect: !0
|
|
830
|
-
})],
|
|
837
|
+
})], z.prototype, "target", void 0), o([A({
|
|
831
838
|
type: Boolean,
|
|
832
839
|
reflect: !0
|
|
833
|
-
})],
|
|
840
|
+
})], z.prototype, "color", void 0), o([A({
|
|
834
841
|
type: Boolean,
|
|
835
842
|
reflect: !0
|
|
836
|
-
})],
|
|
843
|
+
})], z.prototype, "open", void 0), o([A({
|
|
837
844
|
type: Boolean,
|
|
838
845
|
reflect: !0
|
|
839
|
-
})],
|
|
846
|
+
})], z.prototype, "movable", void 0), o([A({
|
|
840
847
|
type: Boolean,
|
|
841
848
|
reflect: !0
|
|
842
|
-
})],
|
|
849
|
+
})], z.prototype, "editable", void 0), o([A({ type: Number })], z.prototype, "width", void 0), o([A({ type: Number })], z.prototype, "maxlength", void 0), o([j()], z.prototype, "_editing", void 0), o([j()], z.prototype, "_draft", void 0), o([j()], z.prototype, "_ghost", void 0), z = M = o([t("vf-icon")], z);
|
|
843
850
|
//#endregion
|
|
844
|
-
export {
|
|
851
|
+
export { z 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 };
|
|
@@ -18,6 +18,9 @@ declare const VfMenuBar_base: (new (...args: any[]) => import("../position.js").
|
|
|
18
18
|
* same mechanic.
|
|
19
19
|
*
|
|
20
20
|
* @slot - `vf-menu` elements.
|
|
21
|
+
* @slot end - The bar's right end: a clock, say. Held 9px in from the end,
|
|
22
|
+
* and a `vf-label` there rides the bar's line, so its baseline is the
|
|
23
|
+
* menu titles'.
|
|
21
24
|
* @csspart bar - The horizontal layout container.
|
|
22
25
|
* @cssprop [--vf-menubar-height=20px] - `vf-menu-bar`
|
|
23
26
|
*/
|
|
@@ -52,6 +55,8 @@ export declare class VfMenuBar extends VfMenuBar_base {
|
|
|
52
55
|
*/
|
|
53
56
|
shortcuts: boolean;
|
|
54
57
|
private _menus;
|
|
58
|
+
/** Whether the `end` slot has assigned content (drives its `.empty` gate). */
|
|
59
|
+
private _hasEnd;
|
|
55
60
|
connectedCallback(): void;
|
|
56
61
|
disconnectedCallback(): void;
|
|
57
62
|
/**
|