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,12 +5,13 @@ import { VfPositioned as a } from "../position.js";
|
|
|
5
5
|
import { vfBase as o } from "../styles/recipes/host.js";
|
|
6
6
|
import { tileImage as s, tileRects as c, tileSpan as l, vfTileMaskSize as u } from "../styles/recipes/tile.js";
|
|
7
7
|
import { RepeatTileController as d, patternOverride as f, tileGrid as p, vfRepeatTileSize as m, vfTileGrid as h } from "../tile-grid.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { vfStrokeDecls as g } from "../styles/recipes/stroke.js";
|
|
9
|
+
import { GridSnapController as _ } from "../grid-snap.js";
|
|
10
|
+
import { TrackWidthController as v } from "../track-width.js";
|
|
11
|
+
import { LitElement as y, css as b, html as x, unsafeCSS as S } from "lit";
|
|
12
|
+
import { property as C, query as w } from "lit/decorators.js";
|
|
12
13
|
//#region src/components/vf-progress-bar.ts
|
|
13
|
-
var
|
|
14
|
+
var T = 12, E = [
|
|
14
15
|
[
|
|
15
16
|
0,
|
|
16
17
|
0,
|
|
@@ -113,16 +114,16 @@ var w = 12, T = [
|
|
|
113
114
|
1,
|
|
114
115
|
1
|
|
115
116
|
]
|
|
116
|
-
],
|
|
117
|
-
width:
|
|
118
|
-
height:
|
|
119
|
-
rects:
|
|
120
|
-
},
|
|
117
|
+
], D = {
|
|
118
|
+
width: T,
|
|
119
|
+
height: T,
|
|
120
|
+
rects: E
|
|
121
|
+
}, O = s(T, T, c(E)), k = l(T), A = class extends a(y) {
|
|
121
122
|
static {
|
|
122
123
|
this.styles = [
|
|
123
124
|
o,
|
|
124
125
|
h,
|
|
125
|
-
|
|
126
|
+
b`
|
|
126
127
|
:host {
|
|
127
128
|
display: block;
|
|
128
129
|
height: calc(var(--vf-scale, 1) * 14px);
|
|
@@ -131,22 +132,20 @@ var w = 12, T = [
|
|
|
131
132
|
position: relative;
|
|
132
133
|
height: 100%;
|
|
133
134
|
background: var(--vf-progress-track, #ffffff);
|
|
134
|
-
border: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
135
135
|
border-radius: 0;
|
|
136
136
|
overflow: hidden;
|
|
137
|
+
${g()}
|
|
137
138
|
}
|
|
138
139
|
.fill {
|
|
139
140
|
height: 100%;
|
|
140
141
|
background: var(--vf-progress-fill, #000000);
|
|
141
|
-
/* The classic 1px black leading edge. */
|
|
142
|
-
border-right: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
143
142
|
}
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/* The classic 1px black leading edge, on a fill with any width. */
|
|
144
|
+
.fill:not(.empty):not(.stripes) {
|
|
145
|
+
${g({ edges: ["right"] })}
|
|
146
146
|
}
|
|
147
147
|
.fill.stripes {
|
|
148
148
|
width: 100%;
|
|
149
|
-
border-right: none;
|
|
150
149
|
/* Chunky 45° barber stripes: a 12×12 system-px cell whose two black
|
|
151
150
|
\ bands are a staircase of axis-aligned 1px rects (genuine pixel
|
|
152
151
|
art — a *diagonal* edge would blur where these stay pixel-exact)
|
|
@@ -157,7 +156,7 @@ var w = 12, T = [
|
|
|
157
156
|
strip's containing block and its clip. */
|
|
158
157
|
position: relative;
|
|
159
158
|
background-color: var(--vf-white, #fff);
|
|
160
|
-
--_vf-tile-image: var(--vf-progress-stripes, ${
|
|
159
|
+
--_vf-tile-image: var(--vf-progress-stripes, ${S(O)});
|
|
161
160
|
}
|
|
162
161
|
/* The animated strip: the fill's width plus one 12px cell, resting
|
|
163
162
|
that cell to the left (fully covering the fill), and each cycle
|
|
@@ -201,8 +200,8 @@ var w = 12, T = [
|
|
|
201
200
|
}
|
|
202
201
|
.fill.stripes {
|
|
203
202
|
background-color: var(--vf-progress-fill, CanvasText);
|
|
204
|
-
mask-image: var(--vf-progress-stripes, ${
|
|
205
|
-
${u(
|
|
203
|
+
mask-image: var(--vf-progress-stripes, ${S(O)});
|
|
204
|
+
${u(T)}
|
|
206
205
|
animation: vf-barber-mask 0.4s steps(4, end) infinite;
|
|
207
206
|
}
|
|
208
207
|
.fill.stripes .vf-tile-strip {
|
|
@@ -229,9 +228,9 @@ var w = 12, T = [
|
|
|
229
228
|
#e;
|
|
230
229
|
#t;
|
|
231
230
|
constructor() {
|
|
232
|
-
super(), this.scale = new t(this), this.gridSnap = new
|
|
231
|
+
super(), this.scale = new t(this), this.gridSnap = new _(this), this.value = 0, this.max = 100, this.indeterminate = !1, this.label = "", this.trackSize = new v(this, () => this.track), this._pattern = "", this.#e = new d(this, {
|
|
233
232
|
getBox: () => this.renderRoot?.querySelector(".vf-tile-strip"),
|
|
234
|
-
getArt: () => this.indeterminate && !this._pattern ?
|
|
233
|
+
getArt: () => this.indeterminate && !this._pattern ? D : null,
|
|
235
234
|
property: "--_vf-barber-tile"
|
|
236
235
|
}), this.#t = this.attachInternals(), this.#t.role = "progressbar", this.#t.ariaValueMin = "0";
|
|
237
236
|
}
|
|
@@ -251,14 +250,14 @@ var w = 12, T = [
|
|
|
251
250
|
if (this.indeterminate) {
|
|
252
251
|
let e = null;
|
|
253
252
|
if (this._pattern) {
|
|
254
|
-
let t = r(this.trackSize.width, this), n = Math.max(1, Math.ceil((t +
|
|
253
|
+
let t = r(this.trackSize.width, this), n = Math.max(1, Math.ceil((t + T) / k));
|
|
255
254
|
e = p({
|
|
256
255
|
cols: n,
|
|
257
256
|
rows: 1,
|
|
258
|
-
tile:
|
|
257
|
+
tile: k
|
|
259
258
|
});
|
|
260
259
|
}
|
|
261
|
-
return
|
|
260
|
+
return x`
|
|
262
261
|
<div class="track vf-snap" part="track">
|
|
263
262
|
<div class="fill stripes vf-tile-grid" part="fill">
|
|
264
263
|
<div class="vf-tile-strip">${e}</div>
|
|
@@ -267,7 +266,7 @@ var w = 12, T = [
|
|
|
267
266
|
`;
|
|
268
267
|
}
|
|
269
268
|
let e = this.clampedValue / this.effectiveMax, t = r(this.trackSize.width, this), i = t > 0 ? `${n(Math.round(e * t), this)}px` : `${e * 100}%`;
|
|
270
|
-
return
|
|
269
|
+
return x`
|
|
271
270
|
<div class="track vf-snap" part="track">
|
|
272
271
|
<div
|
|
273
272
|
class="fill ${e <= 0 ? "empty" : ""}"
|
|
@@ -278,9 +277,9 @@ var w = 12, T = [
|
|
|
278
277
|
`;
|
|
279
278
|
}
|
|
280
279
|
};
|
|
281
|
-
i([
|
|
280
|
+
i([C({ type: Number })], A.prototype, "value", void 0), i([C({ type: Number })], A.prototype, "max", void 0), i([C({
|
|
282
281
|
type: Boolean,
|
|
283
282
|
reflect: !0
|
|
284
|
-
})],
|
|
283
|
+
})], A.prototype, "indeterminate", void 0), i([C()], A.prototype, "label", void 0), i([w(".track")], A.prototype, "track", void 0), A = i([e("vf-progress-bar")], A);
|
|
285
284
|
//#endregion
|
|
286
|
-
export {
|
|
285
|
+
export { A as VfProgressBar };
|
|
@@ -21,10 +21,9 @@ var y = class extends r(f(p)) {
|
|
|
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
|
|
24
|
-
well, which
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pixel proud of the 13px well, so the gap reads as one row or two
|
|
24
|
+
well, which ends on the same row as vf-checkbox's box, so the two
|
|
25
|
+
rules land on the same row of a mixed list. The 12px sprite sits half
|
|
26
|
+
a pixel proud of the 13px well, so the gap reads as one row or two
|
|
28
27
|
depending on which way that rounds — the well is the anchor, not the
|
|
29
28
|
sprite. */
|
|
30
29
|
:host(:focus-visible) .circle::after {
|
|
@@ -3,19 +3,20 @@ import { ScaleController as t } from "../scale.js";
|
|
|
3
3
|
import n from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
4
4
|
import { VfPositioned as r, placementIn as i } from "../position.js";
|
|
5
5
|
import { vfBase as a } from "../styles/recipes/host.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import { vfStrokeDecls as o } from "../styles/recipes/stroke.js";
|
|
7
|
+
import { vfFocusRing as s } from "../styles/recipes/focus.js";
|
|
8
|
+
import { vfScrollRail as c } from "../styles/recipes/scroll-rail.js";
|
|
9
|
+
import { GridSnapController as l } from "../grid-snap.js";
|
|
10
|
+
import { ScrollStateController as u } from "../scroll-state.js";
|
|
11
|
+
import { ScrollRailController as d, renderScrollRail as f } from "../scroll-rail.js";
|
|
12
|
+
import { LitElement as p, css as m, html as h, nothing as g } from "lit";
|
|
13
|
+
import { property as _, query as v, state as y } from "lit/decorators.js";
|
|
13
14
|
//#region src/components/vf-scroll-area.ts
|
|
14
|
-
var
|
|
15
|
+
var b = class extends r(p) {
|
|
15
16
|
constructor() {
|
|
16
|
-
super(), this.scale = new t(this), this.gridSnap = new
|
|
17
|
+
super(), this.scale = new t(this), this.gridSnap = new l(this), this.axis = "vertical", this.corner = !1, this.label = "", this.scrollState = new u(this, () => this.viewport, () => this.content, (e) => {
|
|
17
18
|
this._scrollable = e.x || e.y;
|
|
18
|
-
}), this.rail = new
|
|
19
|
+
}), this.rail = new d(this, {
|
|
19
20
|
getScroll: () => this.viewport,
|
|
20
21
|
getContent: () => this.content
|
|
21
22
|
}), this._scrollable = !1, this.#e = () => {
|
|
@@ -38,13 +39,13 @@ var y = class extends r(f) {
|
|
|
38
39
|
static {
|
|
39
40
|
this.styles = [
|
|
40
41
|
a,
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
c,
|
|
43
|
+
m`
|
|
43
44
|
:host {
|
|
44
45
|
display: block;
|
|
45
46
|
}
|
|
46
|
-
/* The snapped wrapper:
|
|
47
|
-
|
|
47
|
+
/* The snapped wrapper: the 1px frame (the rails' outer line is this
|
|
48
|
+
stroke), a grid that reserves each rail as its own edge column/row —
|
|
48
49
|
the rails size themselves to the 15px inside the frame — and the
|
|
49
50
|
scroller and rails riding the grid-snap offset as one. */
|
|
50
51
|
.box {
|
|
@@ -53,8 +54,8 @@ var y = class extends r(f) {
|
|
|
53
54
|
display: grid;
|
|
54
55
|
grid-template-columns: 1fr;
|
|
55
56
|
grid-template-rows: 1fr;
|
|
56
|
-
border: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
57
57
|
background: var(--vf-white, #fff);
|
|
58
|
+
${o()}
|
|
58
59
|
}
|
|
59
60
|
:host(:not([axis])) .box,
|
|
60
61
|
:host([axis='vertical']) .box,
|
|
@@ -134,36 +135,36 @@ var y = class extends r(f) {
|
|
|
134
135
|
/* Focusable so keyboard users can scroll; inset ring to stay in-box. */
|
|
135
136
|
.viewport:focus-visible {
|
|
136
137
|
--vf-focus-offset: -2px;
|
|
137
|
-
${
|
|
138
|
+
${s}
|
|
138
139
|
}
|
|
139
140
|
`
|
|
140
141
|
];
|
|
141
142
|
}
|
|
142
143
|
render() {
|
|
143
144
|
let e = this.axis !== "horizontal", t = this.axis === "horizontal" || this.axis === "both", n = e && t || this.corner;
|
|
144
|
-
return
|
|
145
|
+
return h`
|
|
145
146
|
<div class="box vf-snap">
|
|
146
147
|
<div
|
|
147
148
|
class="viewport vf-scroll"
|
|
148
149
|
part="viewport"
|
|
149
|
-
tabindex=${this._scrollable ? "0" :
|
|
150
|
-
role=${this.label ? "region" : this._scrollable ? "group" :
|
|
151
|
-
aria-label=${this.label ||
|
|
150
|
+
tabindex=${this._scrollable ? "0" : g}
|
|
151
|
+
role=${this.label ? "region" : this._scrollable ? "group" : g}
|
|
152
|
+
aria-label=${this.label || g}
|
|
152
153
|
>
|
|
153
154
|
<div class="content">
|
|
154
155
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
155
156
|
</div>
|
|
156
157
|
</div>
|
|
157
|
-
${e ?
|
|
158
|
-
${t ?
|
|
159
|
-
${n ?
|
|
158
|
+
${e ? f(this.rail, "vertical") : g}
|
|
159
|
+
${t ? f(this.rail, "horizontal") : g}
|
|
160
|
+
${n ? h`<div class="vf-rail-corner" aria-hidden="true"></div>` : g}
|
|
160
161
|
</div>
|
|
161
162
|
`;
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
|
-
n([
|
|
165
|
+
n([_({ reflect: !0 })], b.prototype, "axis", void 0), n([_({
|
|
165
166
|
type: Boolean,
|
|
166
167
|
reflect: !0
|
|
167
|
-
})],
|
|
168
|
+
})], b.prototype, "corner", void 0), n([_()], b.prototype, "label", void 0), n([v(".viewport")], b.prototype, "viewport", void 0), n([v(".content")], b.prototype, "content", void 0), n([y()], b.prototype, "_scrollable", void 0), b = n([e("vf-scroll-area")], b);
|
|
168
169
|
//#endregion
|
|
169
|
-
export {
|
|
170
|
+
export { b as VfScrollArea };
|
|
@@ -6,28 +6,29 @@ import { VfPositioned as o } from "../position.js";
|
|
|
6
6
|
import { vfBodyDecls as s } from "../styles/recipes/body-face.js";
|
|
7
7
|
import { vfDisplay as c } from "../styles/recipes/display-face.js";
|
|
8
8
|
import { vfBase as l } from "../styles/recipes/host.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
9
|
+
import { vfStrokeDecls as u, vfStrokeInset as d } from "../styles/recipes/stroke.js";
|
|
10
|
+
import { vfPanel as f } from "../styles/recipes/surface.js";
|
|
11
|
+
import { vfFocusUnderline as p } from "../styles/recipes/focus.js";
|
|
12
|
+
import { GridSnapController as m } from "../grid-snap.js";
|
|
13
|
+
import { DocumentListenersController as h } from "../document-listeners.js";
|
|
14
|
+
import { runSelectionBlink as g } from "../motion.js";
|
|
15
|
+
import { CARET_DOWN as _, CARET_DOWN_SMALL as v, CARET_UP as y, CARET_UP_SMALL as b, glyphSvg as x } from "../glyphs.js";
|
|
16
|
+
import { VfShadowRoleControl as S } from "../form-control.js";
|
|
17
|
+
import { FocusRuleController as C } from "../focus-modality.js";
|
|
18
|
+
import { VfOption as w } from "./vf-option.js";
|
|
19
|
+
import { clampScroll as T, ensureVisibleScroll as E, firstPickableRow as D, lastPickableRow as O, layoutClampedPopup as k } from "../popup-overflow.js";
|
|
20
|
+
import { TypeAheadBuffer as A } from "../type-ahead.js";
|
|
21
|
+
import { css as j, html as M, nothing as N } from "lit";
|
|
22
|
+
import { property as P, query as F, queryAssignedElements as I, state as L } from "lit/decorators.js";
|
|
23
|
+
import { classMap as R } from "lit/directives/class-map.js";
|
|
23
24
|
//#region src/components/vf-select.ts
|
|
24
|
-
var
|
|
25
|
+
var z = class extends o(S) {
|
|
25
26
|
static {
|
|
26
27
|
this.styles = [
|
|
27
28
|
l,
|
|
28
29
|
c,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
f,
|
|
31
|
+
j`
|
|
31
32
|
:host {
|
|
32
33
|
/* A popup menu is sized to its widest option — never stretched to fill
|
|
33
34
|
its container. fit-content holds that intrinsic width even inside a
|
|
@@ -65,22 +66,28 @@ var L = class extends o(b) {
|
|
|
65
66
|
/* 18px, not the 22px fields: the reference pill measures 156×18 plus
|
|
66
67
|
its 1px hard shadow (the 157×19 ink box on the sheet). */
|
|
67
68
|
height: calc(var(--vf-scale, 1) * var(--vf-popup-height, 18px));
|
|
68
|
-
/* Left inset = the checkmark gutter (--vf-select-gutter), so the selected
|
|
69
|
-
label sits at the SAME x it will occupy in the open list (where the ✓
|
|
70
|
-
fills that gutter). The right inset stays the small 8px. */
|
|
71
|
-
padding: 0 calc(var(--vf-scale, 1) * 8px) 0
|
|
72
|
-
calc(var(--vf-scale, 1) * var(--vf-select-gutter, 16px));
|
|
73
69
|
background: var(--vf-white, #fff);
|
|
74
|
-
border: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
75
70
|
border-radius: 0;
|
|
76
|
-
/* At depth 0 the shadow is the border box itself, which paints nothing. */
|
|
77
|
-
box-shadow: calc(var(--vf-scale, 1) * var(--_shadow-depth))
|
|
78
|
-
calc(var(--vf-scale, 1) * var(--_shadow-depth)) 0 0 var(--vf-black, #000);
|
|
79
71
|
/* The press-drag gesture owns pointer moves while the button is held;
|
|
80
72
|
suppress the browser's own touch panning/scrolling so a touch drag
|
|
81
73
|
tracks the list instead of scrolling the page. */
|
|
82
74
|
touch-action: none;
|
|
83
75
|
cursor: var(--vf-cursor, default);
|
|
76
|
+
/* The 1px frame is a stroke, the hard shadow after it in the list —
|
|
77
|
+
at depth 0 the shadow is the border box itself, which paints
|
|
78
|
+
nothing. Left inset = the checkmark gutter (--vf-select-gutter), so
|
|
79
|
+
the selected label sits at the SAME x it will occupy in the open
|
|
80
|
+
list (where the ✓ fills that gutter). The right inset stays the
|
|
81
|
+
small 8px. */
|
|
82
|
+
${u({
|
|
83
|
+
padding: [
|
|
84
|
+
0,
|
|
85
|
+
8,
|
|
86
|
+
0,
|
|
87
|
+
"var(--vf-select-gutter, 16px)"
|
|
88
|
+
],
|
|
89
|
+
shadows: "calc(var(--vf-scale, 1) * var(--_shadow-depth)) calc(var(--vf-scale, 1) * var(--_shadow-depth)) 0 0 var(--vf-black, #000)"
|
|
90
|
+
})}
|
|
84
91
|
}
|
|
85
92
|
/* Keyboard focus is the kit's dashed rule under the pill, not a ring
|
|
86
93
|
around it (see vfFocusUnderline). It goes BELOW the whole box rather
|
|
@@ -88,11 +95,12 @@ var L = class extends o(b) {
|
|
|
88
95
|
has one line and the label already shares it with the ▼.
|
|
89
96
|
|
|
90
97
|
The offset counts every row of ink below the pseudo-element's padding
|
|
91
|
-
box
|
|
92
|
-
the hard shadow (1px, or none under no-shadow):
|
|
93
|
-
The
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
box, which runs under the pill's stroke, before the blank row and the
|
|
99
|
+
rule itself — the hard shadow (1px, or none under no-shadow):
|
|
100
|
+
−(depth + 1 + 1). The rule spans that same box, which is the shape
|
|
101
|
+
the pill reads as (the shadow is a depth cue, not part of the
|
|
102
|
+
silhouette). Under forced colors the stroke is a border and the
|
|
103
|
+
padding box sits inside it, so the insets grow by it there.
|
|
96
104
|
|
|
97
105
|
Gated on a class, not :focus-visible — the same problem the editable
|
|
98
106
|
fields have, arrived at from the other direction. The pill suppresses
|
|
@@ -107,10 +115,10 @@ var L = class extends o(b) {
|
|
|
107
115
|
outline: none;
|
|
108
116
|
}
|
|
109
117
|
.control.vf-focus-rule::after {
|
|
110
|
-
|
|
111
|
-
${d}
|
|
112
|
-
left:
|
|
113
|
-
right:
|
|
118
|
+
${p}
|
|
119
|
+
bottom: ${d("(-3px - var(--_shadow-depth))")};
|
|
120
|
+
left: ${d(-1)};
|
|
121
|
+
right: ${d(-1)};
|
|
114
122
|
}
|
|
115
123
|
/* The label is a 1×1 grid: the visible value and an invisible stack of
|
|
116
124
|
every option's text share the one cell, so the cell — and thus the
|
|
@@ -194,16 +202,10 @@ var L = class extends o(b) {
|
|
|
194
202
|
position: fixed;
|
|
195
203
|
z-index: 10000;
|
|
196
204
|
margin: 0;
|
|
197
|
-
padding: 0;
|
|
198
205
|
/* Match the closed pill's 1px hard shadow — the shared .vf-panel recipe
|
|
199
206
|
defaults to the 2px menu shadow, which would overhang the pill's shadow
|
|
200
207
|
by 1px on the right and bottom. */
|
|
201
208
|
--vf-shadow-offset: 1px;
|
|
202
|
-
/* A CLIP, never a scroll surface: positionPanel gives the panel a whole
|
|
203
|
-
number of row slots and the rows are rolled by transform inside it.
|
|
204
|
-
System 7 put no scrollbar on a menu, and an un-quantized native scroll
|
|
205
|
-
would break the row lattice the pill overlay is built on. */
|
|
206
|
-
overflow: hidden;
|
|
207
209
|
/* The screen-edge reserve, resolved here and read back by
|
|
208
210
|
positionPanel: the clamp is JS geometry, so the tokens can't be spent
|
|
209
211
|
in a declaration, but their defaults and the cascade still belong in
|
|
@@ -216,6 +218,18 @@ var L = class extends o(b) {
|
|
|
216
218
|
.panel.open {
|
|
217
219
|
display: block;
|
|
218
220
|
}
|
|
221
|
+
/* A CLIP, never a scroll surface: positionPanel gives the panel a whole
|
|
222
|
+
number of row slots and the rows are rolled by transform inside it.
|
|
223
|
+
System 7 put no scrollbar on a menu, and an un-quantized native scroll
|
|
224
|
+
would break the row lattice the pill overlay is built on. An element
|
|
225
|
+
inside the panel rather than the panel itself, whose frame is a
|
|
226
|
+
stroke: the panel would clip at its outer edge and let rolled rows
|
|
227
|
+
paint over the frame. The arrow slots place against it. */
|
|
228
|
+
.clip {
|
|
229
|
+
position: relative;
|
|
230
|
+
height: 100%;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
}
|
|
219
233
|
/* The rolling strip — a box for the options to ride, whose translateY
|
|
220
234
|
positionPanel and the arrow timer write. Transform rather than
|
|
221
235
|
scrollTop: both keep
|
|
@@ -290,7 +304,7 @@ var L = class extends o(b) {
|
|
|
290
304
|
return this.rowScroll < this.optionItems.length - this.visibleSlots;
|
|
291
305
|
}
|
|
292
306
|
constructor() {
|
|
293
|
-
super(), this.value = "", this.name = "", this.size = "regular", this.noShadow = !1, this.label = "", this.open = !1, this.cachedOptions = [], this.scale = new r(this), this.gridSnap = new
|
|
307
|
+
super(), this.value = "", this.name = "", this.size = "regular", this.noShadow = !1, this.label = "", this.open = !1, this.cachedOptions = [], this.scale = new r(this), this.gridSnap = new m(this), this.focusRule = new C(this), this.panelListeners = new h(this, () => [
|
|
294
308
|
[
|
|
295
309
|
document,
|
|
296
310
|
"pointerdown",
|
|
@@ -308,7 +322,7 @@ var L = class extends o(b) {
|
|
|
308
322
|
"resize",
|
|
309
323
|
this.handleWindowResize
|
|
310
324
|
]
|
|
311
|
-
]), this.pressListeners = new
|
|
325
|
+
]), this.pressListeners = new h(this, () => [
|
|
312
326
|
[
|
|
313
327
|
document,
|
|
314
328
|
"pointermove",
|
|
@@ -327,7 +341,7 @@ var L = class extends o(b) {
|
|
|
327
341
|
this.handlePressCancel,
|
|
328
342
|
!0
|
|
329
343
|
]
|
|
330
|
-
]), this.activeIndex = -1, this.rowScroll = 0, this.visibleSlots = 0, this.rowHeight = 0, this.arrowScroll = null, this.pressStartArrow = null, this.pressing = !1, this.pressOpenedPanel = !1, this.pressMoved = !1, this.pressStartOption = null, this.pressDownTime = 0, this.pressDownX = 0, this.pressDownY = 0, this.swallowClick = !1, this.blinking = !1, this.typeAhead = new
|
|
344
|
+
]), this.activeIndex = -1, this.rowScroll = 0, this.visibleSlots = 0, this.rowHeight = 0, this.arrowScroll = null, this.pressStartArrow = null, this.pressing = !1, this.pressOpenedPanel = !1, this.pressMoved = !1, this.pressStartOption = null, this.pressDownTime = 0, this.pressDownX = 0, this.pressDownY = 0, this.swallowClick = !1, this.blinking = !1, this.typeAhead = new A(), this.handleSlotChange = () => {
|
|
331
345
|
if (this.cachedOptions = this.assignedOptions ?? [], this.applySize(), this.value === "") {
|
|
332
346
|
let e = this.optionItems.find((e) => !e.disabled);
|
|
333
347
|
e && (this.value = this.optionValue(e));
|
|
@@ -485,7 +499,7 @@ var L = class extends o(b) {
|
|
|
485
499
|
positionPanel(e) {
|
|
486
500
|
let t = this.controlEl, n = this.panelEl;
|
|
487
501
|
if (!t || !n) return;
|
|
488
|
-
let r = t.getBoundingClientRect(), a = getComputedStyle(n), o = parseFloat(a.borderTopWidth) || 0, s = this.optionItems[0]?.getBoundingClientRect()?.height || r.height - 2 * o, c = (e) => i(parseFloat(a.getPropertyValue(e)) || 0, this), l =
|
|
502
|
+
let r = t.getBoundingClientRect(), a = getComputedStyle(n), o = (parseFloat(a.borderTopWidth) || 0) + (parseFloat(a.paddingTop) || 0), s = this.optionItems[0]?.getBoundingClientRect()?.height || r.height - 2 * o, c = (e) => i(parseFloat(a.getPropertyValue(e)) || 0, this), l = k({
|
|
489
503
|
idealTop: r.top - e * s,
|
|
490
504
|
rowHeight: s,
|
|
491
505
|
border: o,
|
|
@@ -503,11 +517,11 @@ var L = class extends o(b) {
|
|
|
503
517
|
this.rowsEl && (this.rowsEl.style.transform = e ? `translateY(${-e}px)` : ""), this.upArrowEl?.classList.toggle("shown", this.showUpArrow), this.downArrowEl?.classList.toggle("shown", this.showDownArrow);
|
|
504
518
|
}
|
|
505
519
|
revealRow(e) {
|
|
506
|
-
let t =
|
|
520
|
+
let t = E(e, this.rowScroll, this.optionItems.length, this.visibleSlots);
|
|
507
521
|
t !== this.rowScroll && (this.rowScroll = t, this.applyScroll());
|
|
508
522
|
}
|
|
509
523
|
stepArrowScroll(e) {
|
|
510
|
-
let t =
|
|
524
|
+
let t = T(this.rowScroll + e, this.rowScroll, this.optionItems.length, this.visibleSlots);
|
|
511
525
|
return t !== this.rowScroll && (this.rowScroll = t, this.applyScroll(), !0);
|
|
512
526
|
}
|
|
513
527
|
startArrowScroll(e) {
|
|
@@ -583,7 +597,7 @@ var L = class extends o(b) {
|
|
|
583
597
|
if (e.disabled || this.blinking) return;
|
|
584
598
|
let t = this.optionItems.indexOf(e);
|
|
585
599
|
this.setActive(t, !1), this.blinking = !0;
|
|
586
|
-
let n =
|
|
600
|
+
let n = g((t) => {
|
|
587
601
|
e.active = t;
|
|
588
602
|
}, () => {
|
|
589
603
|
this.commit(e);
|
|
@@ -599,7 +613,7 @@ var L = class extends o(b) {
|
|
|
599
613
|
this.value = r, e(this, "vf-change", { value: r }), t(this, "input"), t(this, "change");
|
|
600
614
|
}
|
|
601
615
|
optionFromEvent(e) {
|
|
602
|
-
return e.composedPath().find((e) => e instanceof
|
|
616
|
+
return e.composedPath().find((e) => e instanceof w);
|
|
603
617
|
}
|
|
604
618
|
endPress() {
|
|
605
619
|
this.pressing && (this.pressing = !1, this.pressStartOption = null, this.pressStartArrow = null, this.pressListeners.detach());
|
|
@@ -609,7 +623,7 @@ var L = class extends o(b) {
|
|
|
609
623
|
if (!this.open || !n) return null;
|
|
610
624
|
let r = n.getBoundingClientRect();
|
|
611
625
|
if (e < r.left || e >= r.right || t < r.top || t >= r.bottom) return null;
|
|
612
|
-
let i =
|
|
626
|
+
let i = D(this.rowScroll), a = O(this.rowScroll, this.optionItems.length, this.visibleSlots);
|
|
613
627
|
for (let n = i; n <= a; n += 1) {
|
|
614
628
|
let r = this.optionItems[n];
|
|
615
629
|
if (!r) continue;
|
|
@@ -632,10 +646,10 @@ var L = class extends o(b) {
|
|
|
632
646
|
this.selectOption(e);
|
|
633
647
|
}
|
|
634
648
|
render() {
|
|
635
|
-
let e = this.optionItems.find((e) => this.optionValue(e) === this.value), t = e ? (e.textContent ?? "").trim() : "", n = this.isDisabled, r = this.size === "small", i = r ?
|
|
636
|
-
return
|
|
649
|
+
let e = this.optionItems.find((e) => this.optionValue(e) === this.value), t = e ? (e.textContent ?? "").trim() : "", n = this.isDisabled, r = this.size === "small", i = r ? v : _, a = r ? b : y;
|
|
650
|
+
return M`
|
|
637
651
|
<div
|
|
638
|
-
class=${
|
|
652
|
+
class=${R({
|
|
639
653
|
control: !0,
|
|
640
654
|
"vf-snap": !0,
|
|
641
655
|
"vf-focus-rule": this.focusRule.marked && !this.open,
|
|
@@ -647,20 +661,20 @@ var L = class extends o(b) {
|
|
|
647
661
|
aria-expanded=${this.open ? "true" : "false"}
|
|
648
662
|
aria-disabled=${n ? "true" : "false"}
|
|
649
663
|
aria-controls="listbox"
|
|
650
|
-
aria-label=${this.label || this.hostLabel ||
|
|
664
|
+
aria-label=${this.label || this.hostLabel || N}
|
|
651
665
|
aria-describedby=${this.describedBy}
|
|
652
|
-
aria-required=${this.required ? "true" :
|
|
653
|
-
aria-invalid=${this.validity.valid ?
|
|
666
|
+
aria-required=${this.required ? "true" : N}
|
|
667
|
+
aria-invalid=${this.validity.valid ? N : "true"}
|
|
654
668
|
tabindex=${n ? "-1" : "0"}
|
|
655
669
|
>
|
|
656
670
|
<span class="label" part="label">
|
|
657
671
|
<span class="value">${t}</span>
|
|
658
672
|
<span class="sizer" aria-hidden="true">
|
|
659
|
-
${this.optionItems.map((e) =>
|
|
673
|
+
${this.optionItems.map((e) => M`<span>${(e.textContent ?? "").trim()}</span>`)}
|
|
660
674
|
</span>
|
|
661
675
|
</span>
|
|
662
676
|
<span class="arrow" part="arrow" aria-hidden="true"
|
|
663
|
-
>${
|
|
677
|
+
>${x(i, "caret")}</span
|
|
664
678
|
>
|
|
665
679
|
</div>
|
|
666
680
|
<div
|
|
@@ -668,47 +682,51 @@ var L = class extends o(b) {
|
|
|
668
682
|
class="panel vf-panel ${this.open ? "open" : ""}"
|
|
669
683
|
part="panel"
|
|
670
684
|
role="listbox"
|
|
671
|
-
aria-label=${this.label || this.hostLabel ||
|
|
685
|
+
aria-label=${this.label || this.hostLabel || N}
|
|
672
686
|
aria-hidden=${this.open ? "false" : "true"}
|
|
673
687
|
>
|
|
674
|
-
<!-- role="presentation"
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
688
|
+
<!-- role="presentation" on the clip and the strip that carries the
|
|
689
|
+
roll, so neither stands between the listbox and the options it
|
|
690
|
+
owns. -->
|
|
691
|
+
<div class="clip" role="presentation">
|
|
692
|
+
<div class="rows" role="presentation">
|
|
693
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
694
|
+
</div>
|
|
695
|
+
<!-- Pointer affordances only, hence aria-hidden: the clipped options
|
|
696
|
+
stay in the accessibility tree un-hidden (clipping is
|
|
697
|
+
presentation, and a native <select> exposes its whole list too),
|
|
698
|
+
and keyboard and AT users reach every row with the arrows,
|
|
699
|
+
Home/End and type-ahead. -->
|
|
700
|
+
<div
|
|
701
|
+
class="arrow-slot up"
|
|
702
|
+
part="scroll-arrow"
|
|
703
|
+
aria-hidden="true"
|
|
704
|
+
@pointerenter=${this.handleArrowEnter}
|
|
705
|
+
@pointermove=${this.handleArrowEnter}
|
|
706
|
+
@pointerleave=${this.handleArrowLeave}
|
|
707
|
+
>
|
|
708
|
+
${x(a, "caret")}
|
|
709
|
+
</div>
|
|
710
|
+
<div
|
|
711
|
+
class="arrow-slot down"
|
|
712
|
+
part="scroll-arrow"
|
|
713
|
+
aria-hidden="true"
|
|
714
|
+
@pointerenter=${this.handleArrowEnter}
|
|
715
|
+
@pointermove=${this.handleArrowEnter}
|
|
716
|
+
@pointerleave=${this.handleArrowLeave}
|
|
717
|
+
>
|
|
718
|
+
${x(i, "caret")}
|
|
719
|
+
</div>
|
|
702
720
|
</div>
|
|
703
721
|
</div>
|
|
704
722
|
${this.renderDescription()}
|
|
705
723
|
`;
|
|
706
724
|
}
|
|
707
725
|
};
|
|
708
|
-
a([
|
|
726
|
+
a([P()], z.prototype, "value", void 0), a([P({ reflect: !0 })], z.prototype, "name", void 0), a([P({ reflect: !0 })], z.prototype, "size", void 0), a([P({
|
|
709
727
|
type: Boolean,
|
|
710
728
|
reflect: !0,
|
|
711
729
|
attribute: "no-shadow"
|
|
712
|
-
})],
|
|
730
|
+
})], z.prototype, "noShadow", void 0), a([P()], z.prototype, "label", void 0), a([L()], z.prototype, "open", void 0), a([F(".control")], z.prototype, "controlEl", void 0), a([F(".panel")], z.prototype, "panelEl", void 0), a([F(".rows")], z.prototype, "rowsEl", void 0), a([F(".arrow-slot.up")], z.prototype, "upArrowEl", void 0), a([F(".arrow-slot.down")], z.prototype, "downArrowEl", void 0), a([I({ selector: "vf-option" })], z.prototype, "assignedOptions", void 0), a([L()], z.prototype, "cachedOptions", void 0), z = a([n("vf-select")], z);
|
|
713
731
|
//#endregion
|
|
714
|
-
export {
|
|
732
|
+
export { z as VfSelect };
|
|
@@ -10,13 +10,13 @@ declare const VfSeparator_base: (new (...args: any[]) => import("../position.js"
|
|
|
10
10
|
*
|
|
11
11
|
* Containers may restyle it via custom properties:
|
|
12
12
|
* - `--vf-separator-color` — line color (default `var(--vf-black, #000)`).
|
|
13
|
-
* - `--vf-separator-style` —
|
|
14
|
-
* `vf-menu` sets these so slotted separators render as the
|
|
15
|
-
* dotted menu rule (see Menus.png).
|
|
13
|
+
* - `--vf-separator-style` — `solid` (the default) or `dotted`, one system px
|
|
14
|
+
* on and one off. `vf-menu` sets these so slotted separators render as the
|
|
15
|
+
* classic dimmed dotted menu rule (see Menus.png).
|
|
16
16
|
* @cssprop --vf-separator-color - `vf-separator` rule color — `vf-menu` sets it
|
|
17
17
|
* to `--vf-disabled` for the dimmed menu rule
|
|
18
|
-
* @cssprop [--vf-separator-style=solid] - `vf-separator` rule style
|
|
19
|
-
* sets `dotted` (see `Menus.png`)
|
|
18
|
+
* @cssprop [--vf-separator-style=solid] - `vf-separator` rule style: `solid`
|
|
19
|
+
* or `dotted` — `vf-menu` sets `dotted` (see `Menus.png`)
|
|
20
20
|
*/
|
|
21
21
|
export declare class VfSeparator extends VfSeparator_base {
|
|
22
22
|
#private;
|