vintage-frames 0.4.0 → 0.5.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/custom-elements.json +170 -29
- package/dist/components/vf-container.d.ts +57 -3
- package/dist/components/vf-container.js +39 -10
- package/dist/components/vf-desktop.d.ts +52 -19
- package/dist/components/vf-desktop.js +74 -104
- package/dist/components/vf-dialog.d.ts +19 -15
- package/dist/components/vf-dialog.js +45 -53
- package/dist/components/vf-menu-bar.js +30 -25
- package/dist/components/vf-progress-bar.js +3 -3
- package/dist/components/vf-slider.js +11 -11
- package/dist/components/vf-window.js +51 -49
- package/dist/index.d.ts +22 -1
- package/dist/index.js +61 -58
- package/dist/pattern-fill.d.ts +91 -0
- package/dist/pattern-fill.js +74 -0
- package/dist/patterns.d.ts +80 -0
- package/dist/patterns.js +477 -0
- package/dist/scroll-rail.js +37 -37
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/recipes/pattern.d.ts +2 -12
- package/dist/styles/recipes/pattern.js +11 -15
- package/dist/styles/recipes/rule.d.ts +41 -0
- package/dist/styles/recipes/rule.js +32 -0
- package/dist/styles/recipes/scroll-rail.d.ts +3 -12
- package/dist/styles/recipes/scroll-rail.js +7 -15
- package/dist/styles/recipes/surface.d.ts +18 -7
- package/dist/styles/recipes/surface.js +15 -0
- package/dist/tile-grid.d.ts +4 -2
- package/dist/tile-grid.js +3 -3
- package/dist/track-width.d.ts +7 -0
- package/dist/track-width.js +6 -3
- package/docs/SPEC.md +15 -12
- package/editor/vscode.html-custom-data.json +19 -4
- package/editor/web-types.json +39 -6
- package/package.json +4 -1
|
@@ -4,39 +4,26 @@ import { ScaleController as n, effectiveScale as r, sysLength as i } from "../sc
|
|
|
4
4
|
import a from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js";
|
|
5
5
|
import { VfPositioned as o } from "../position.js";
|
|
6
6
|
import { vfBase as s } from "../styles/recipes/host.js";
|
|
7
|
-
import { tileImage as c,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { tileImage as c, tileRects as l, tileSpan as u } from "../styles/recipes/tile.js";
|
|
8
|
+
import { PATTERNS as d, parsePattern as f, patternMotif as p } from "../patterns.js";
|
|
9
|
+
import { patternOverride as m, tileGrid as h, vfTileGrid as g } from "../tile-grid.js";
|
|
10
|
+
import { PatternFillController as _, vfPatternFill as v } from "../pattern-fill.js";
|
|
11
|
+
import { GridSnapController as y } from "../grid-snap.js";
|
|
12
|
+
import { DocumentListenersController as b } from "../document-listeners.js";
|
|
13
|
+
import { SCREEN_CORNER as x, steppedCornerClip as S } from "../pixel-frame.js";
|
|
14
|
+
import { LitElement as C, css as w, html as T, unsafeCSS as E } from "lit";
|
|
15
|
+
import { property as D, query as O, queryAssignedElements as k } from "lit/decorators.js";
|
|
14
16
|
//#region src/components/vf-desktop.ts
|
|
15
|
-
var
|
|
16
|
-
[
|
|
17
|
-
0,
|
|
18
|
-
0,
|
|
19
|
-
2,
|
|
20
|
-
2,
|
|
21
|
-
"#ffffff"
|
|
22
|
-
],
|
|
23
|
-
[
|
|
24
|
-
0,
|
|
25
|
-
0,
|
|
26
|
-
1,
|
|
27
|
-
1,
|
|
28
|
-
"#000000"
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
1,
|
|
32
|
-
1,
|
|
33
|
-
1,
|
|
34
|
-
1,
|
|
35
|
-
"#000000"
|
|
36
|
-
]
|
|
37
|
-
], M = c(A, A, u(j)), N = l(A, A, j), P = d(A), F = class extends o(x) {
|
|
17
|
+
var A = 1e6, j = 512, M = 342, N = "gray-50", P = p(d[N], "#000000", "#ffffff"), F = c(P.width, P.height, l(P.rects)), I = u(P.width), L = class extends o(C) {
|
|
38
18
|
constructor(...e) {
|
|
39
|
-
super(...e), this.width =
|
|
19
|
+
super(...e), this.width = j, this.height = M, this.bezel = 0, this.pattern = N, this.scale = new n(this), this.gridSnap = new y(this), this._token = "", this._desktopPattern = d[N], this.#e = !1, this.patternFill = new _(this, {
|
|
20
|
+
getBox: () => this.screen,
|
|
21
|
+
getPattern: () => this._token ? null : this._desktopPattern,
|
|
22
|
+
getSize: () => ({
|
|
23
|
+
width: this.width ?? j,
|
|
24
|
+
height: this.height ?? M
|
|
25
|
+
})
|
|
26
|
+
}), this._zCounter = 0, this._activeWindow = null, this._deactivated = !1, this._awaitingUpgrade = !1, this._pointerGesture = !1, this._restoringFocus = !1, this._gestureEnd = new b(this, () => [[
|
|
40
27
|
document,
|
|
41
28
|
"pointerup",
|
|
42
29
|
this._onGestureEnd,
|
|
@@ -62,7 +49,8 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
62
49
|
this.styles = [
|
|
63
50
|
s,
|
|
64
51
|
g,
|
|
65
|
-
|
|
52
|
+
v,
|
|
53
|
+
w`
|
|
66
54
|
:host {
|
|
67
55
|
display: block;
|
|
68
56
|
position: relative;
|
|
@@ -88,69 +76,48 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
88
76
|
raster's corrected edge, not the host's possibly-fractional one. */
|
|
89
77
|
overflow: hidden;
|
|
90
78
|
/* An isolated stacking context, so the tile grid's z-index: -1 below
|
|
91
|
-
resolves HERE — above this element's own
|
|
92
|
-
|
|
79
|
+
resolves HERE — above this element's own background, under every
|
|
80
|
+
slotted child. Without it the negative z-index would resolve
|
|
93
81
|
against some ancestor stacking context and paint the tiles beneath
|
|
94
82
|
this background. */
|
|
95
83
|
isolation: isolate;
|
|
84
|
+
/* The base color. Under the kit pattern it is covered by the fill's
|
|
85
|
+
opaque white paper (vfPatternFill) — the authentic black-on-white
|
|
86
|
+
dither — and shows only through a consumer token's translucent
|
|
87
|
+
tile (see the --vf-desktop note in the class doc). The pattern
|
|
88
|
+
itself is this element's own background, written by the
|
|
89
|
+
PatternFillController: one whole-surface raster at one image px
|
|
90
|
+
per system px, magnified nearest-neighbor, which is what keeps it
|
|
91
|
+
1-bit at the zoom-minted scales a repeating fill cannot hold
|
|
92
|
+
(src/tile-grid.ts, src/pattern-fill.ts). */
|
|
96
93
|
background-color: var(--vf-desktop, #808080);
|
|
97
|
-
/*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
This CSS-repeated layer is the UNDERLAY: what actually shows is the
|
|
107
|
-
whole-surface raster (or, under a consumer pattern token, the
|
|
108
|
-
placed tile grid) rendered over it — see src/tile-grid.ts — which
|
|
109
|
-
is what keeps the dither 1-bit at the zoom-minted scales a
|
|
110
|
-
repeating fill cannot hold. The declaration stays as
|
|
111
|
-
belt-and-braces paint beneath the (opaque) kit fill. Override the
|
|
112
|
-
whole tile via --vf-desktop-pattern — the tile grid renders the
|
|
113
|
-
same token at the same documented geometry. */
|
|
114
|
-
background-image: var(--vf-desktop-pattern, ${w(M)});
|
|
115
|
-
${f(A)}
|
|
116
|
-
/* Forced colors: the checker is opaque literal white-and-black (a
|
|
117
|
-
preserved url() tile), which ignores a dark theme entirely. A
|
|
118
|
-
backdrop is decoration, and high-contrast mode is a request for
|
|
119
|
-
less of that — so the desktop goes flat Canvas (the forced
|
|
120
|
-
background-color) rather than re-dithering in the user's pair.
|
|
121
|
-
Deliberate; the windoid dot bar, which carries meaning, IS
|
|
122
|
-
re-inked (see vfDots). */
|
|
94
|
+
/* Forced colors: the pattern is literal black ink on white, which
|
|
95
|
+
ignores a dark theme entirely. A backdrop is decoration, and
|
|
96
|
+
high-contrast mode is a request for less of that — so the desktop
|
|
97
|
+
goes flat Canvas (the forced background-color) rather than
|
|
98
|
+
re-dithering in the user's pair. Deliberate; the windoid dot bar,
|
|
99
|
+
which carries meaning, IS re-inked (see vfDots). The recipe drops
|
|
100
|
+
the image too; stated here as well so the posture lives with the
|
|
101
|
+
surface. */
|
|
123
102
|
@media (forced-colors: active) {
|
|
124
103
|
background-image: none;
|
|
125
104
|
}
|
|
126
105
|
}
|
|
127
|
-
/*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.screen.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/* The dither's exact fill — the whole-surface raster (kit art) or the
|
|
136
|
-
placed tile grid (consumer art) — kept under every slotted child
|
|
137
|
-
(menu bar, windows) by the negative z-index the .screen isolation
|
|
138
|
-
scopes. The grid's tiles resolve the pattern token stated once here
|
|
139
|
-
rather than per tile. */
|
|
140
|
-
.screen > .vf-tile-grid,
|
|
141
|
-
.screen > .vf-tile-raster {
|
|
106
|
+
/* A consumer token's exact fill — the placed tile grid — kept under
|
|
107
|
+
every slotted child (menu bar, windows) by the negative z-index the
|
|
108
|
+
.screen isolation scopes. The grid's tiles resolve the token stated
|
|
109
|
+
once here rather than per tile; the fallback is the kit dither for
|
|
110
|
+
the record, never reached (the grid renders only under a set token). */
|
|
111
|
+
.screen > .vf-tile-grid {
|
|
112
|
+
position: absolute;
|
|
113
|
+
inset: 0;
|
|
142
114
|
z-index: -1;
|
|
143
|
-
|
|
144
|
-
|
|
115
|
+
--_vf-tile-image: var(--vf-desktop-pattern, ${E(F)});
|
|
116
|
+
/* Forced colors: hidden with the pattern, same posture. */
|
|
145
117
|
@media (forced-colors: active) {
|
|
146
118
|
display: none;
|
|
147
119
|
}
|
|
148
120
|
}
|
|
149
|
-
.screen > .vf-tile-grid {
|
|
150
|
-
position: absolute;
|
|
151
|
-
inset: 0;
|
|
152
|
-
--_vf-tile-image: var(--vf-desktop-pattern, ${w(N)});
|
|
153
|
-
}
|
|
154
121
|
/* Bezeled, the screen is inset by exactly one bezel width. The host
|
|
155
122
|
is always the declared screen + 2×bezel (written in updated()), so
|
|
156
123
|
this subtraction is exact and the raster is whole by construction —
|
|
@@ -176,19 +143,19 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
176
143
|
.corner {
|
|
177
144
|
position: absolute;
|
|
178
145
|
top: 0;
|
|
179
|
-
width: calc(var(--vf-scale, 1) * ${
|
|
180
|
-
height: calc(var(--vf-scale, 1) * ${
|
|
146
|
+
width: calc(var(--vf-scale, 1) * ${x[0]}px);
|
|
147
|
+
height: calc(var(--vf-scale, 1) * ${x.length}px);
|
|
181
148
|
background: var(--vf-black, #000);
|
|
182
149
|
pointer-events: none;
|
|
183
150
|
z-index: 2147483647;
|
|
184
151
|
}
|
|
185
152
|
.corner.tl {
|
|
186
153
|
left: 0;
|
|
187
|
-
clip-path: ${
|
|
154
|
+
clip-path: ${E(S(x, "left"))};
|
|
188
155
|
}
|
|
189
156
|
.corner.tr {
|
|
190
157
|
right: 0;
|
|
191
|
-
clip-path: ${
|
|
158
|
+
clip-path: ${E(S(x, "right"))};
|
|
192
159
|
}
|
|
193
160
|
`
|
|
194
161
|
];
|
|
@@ -221,7 +188,7 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
221
188
|
}
|
|
222
189
|
_restack(e) {
|
|
223
190
|
let t = this._isUtility(e);
|
|
224
|
-
e.style.zIndex = String(++this._zCounter + (t ?
|
|
191
|
+
e.style.zIndex = String(++this._zCounter + (t ? A : 0)), t || this._setActive(e);
|
|
225
192
|
}
|
|
226
193
|
_requestDomSync() {
|
|
227
194
|
this._pointerGesture || this._syncDomOrder();
|
|
@@ -238,7 +205,7 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
238
205
|
let e = this._windows, t = null;
|
|
239
206
|
for (let n of e) if (!n.style.zIndex) {
|
|
240
207
|
let e = this._isUtility(n);
|
|
241
|
-
n.style.zIndex = String(++this._zCounter + (e ?
|
|
208
|
+
n.style.zIndex = String(++this._zCounter + (e ? A : 0)), e || (t = n);
|
|
242
209
|
}
|
|
243
210
|
let n = e.filter((e) => !this._isUtility(e)), r = this._activeWindow && n.includes(this._activeWindow) ? this._activeWindow : null;
|
|
244
211
|
this._setActive(t ?? r ?? (this._deactivated ? null : this._topmost(n))), customElements.get("vf-window") || this._normalizeAfterUpgrade();
|
|
@@ -283,37 +250,40 @@ var D = 1e6, O = 512, k = 342, A = 2, j = [
|
|
|
283
250
|
r && n instanceof HTMLElement && n.isConnected && this._deepActiveElement() !== n && (this._restoringFocus = !0, n.focus({ preventScroll: !0 }), this._restoringFocus = !1);
|
|
284
251
|
}
|
|
285
252
|
willUpdate(e) {
|
|
286
|
-
super.willUpdate(e), this.
|
|
253
|
+
if (super.willUpdate(e), this._token = m(this, "--vf-desktop-pattern"), e.has("pattern")) {
|
|
254
|
+
let e = f(this.pattern);
|
|
255
|
+
e === null && this.pattern?.trim() && !this.#e && (this.#e = !0, console.warn(`vf-desktop: unknown pattern "${this.pattern}" — a library name (docs/PATTERNS.md) or sixteen hex digits. Keeping ${N}.`)), this._desktopPattern = e ?? d[N];
|
|
256
|
+
}
|
|
287
257
|
}
|
|
288
258
|
updated(e) {
|
|
289
259
|
if (e.has("bezel") && (this.bezel > 0 ? this.style.setProperty("--vf-desktop-bezel", i(this.bezel)) : this.style.removeProperty("--vf-desktop-bezel")), e.has("width") || e.has("height") || e.has("bezel")) {
|
|
290
|
-
let e = this.width ??
|
|
260
|
+
let e = this.width ?? j, t = this.height ?? M;
|
|
291
261
|
this.style.width = i(e + 2 * this.bezel), this.style.height = i(t + 2 * this.bezel);
|
|
292
262
|
}
|
|
293
263
|
}
|
|
294
264
|
render() {
|
|
295
|
-
let e = this.width ??
|
|
265
|
+
let e = this.width ?? j, t = this.height ?? M, n = this._token ? T`<div class="vf-tile-grid">
|
|
296
266
|
${h({
|
|
297
|
-
cols:
|
|
298
|
-
rows:
|
|
299
|
-
tile:
|
|
267
|
+
cols: Math.ceil(e / I),
|
|
268
|
+
rows: Math.ceil(t / I),
|
|
269
|
+
tile: I
|
|
300
270
|
})}
|
|
301
|
-
</div>` :
|
|
302
|
-
|
|
303
|
-
style="width:${i(n * P)};height:${i(r * P)};background-image:${this.#e.for(A, A, j, n * P, r * P)}"
|
|
304
|
-
></div>`;
|
|
305
|
-
return C`
|
|
271
|
+
</div>` : null;
|
|
272
|
+
return T`
|
|
306
273
|
<div class=${this.bezel > 0 ? "desktop vf-snap bezeled" : "desktop vf-snap"}>
|
|
307
|
-
<div
|
|
308
|
-
${
|
|
274
|
+
<div
|
|
275
|
+
class="screen vf-pattern-fill${this._token ? "" : " vf-patterned"}"
|
|
276
|
+
part="desktop"
|
|
277
|
+
>
|
|
278
|
+
${n}
|
|
309
279
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
310
|
-
${this.bezel > 0 ?
|
|
280
|
+
${this.bezel > 0 ? T`<div class="corner tl"></div>
|
|
311
281
|
<div class="corner tr"></div>` : null}
|
|
312
282
|
</div>
|
|
313
283
|
</div>
|
|
314
284
|
`;
|
|
315
285
|
}
|
|
316
286
|
};
|
|
317
|
-
a([
|
|
287
|
+
a([D({ type: Number })], L.prototype, "width", void 0), a([D({ type: Number })], L.prototype, "height", void 0), a([D({ type: Number })], L.prototype, "bezel", void 0), a([D()], L.prototype, "pattern", void 0), a([k({ selector: "vf-window" })], L.prototype, "_windows", void 0), a([O(".screen")], L.prototype, "screen", void 0), L = a([t("vf-desktop")], L);
|
|
318
288
|
//#endregion
|
|
319
|
-
export {
|
|
289
|
+
export { L as VfDesktop };
|
|
@@ -4,19 +4,21 @@ import './vf-button-group.js';
|
|
|
4
4
|
* `<vf-dialog>` — the System 7 modal dialog shell.
|
|
5
5
|
*
|
|
6
6
|
* Two chromes, one modal lifecycle (native `<dialog>` for top-layer rendering
|
|
7
|
-
* and focus trapping, with a fully transparent backdrop — no dimming)
|
|
7
|
+
* and focus trapping, with a fully transparent backdrop — no dimming). Both
|
|
8
|
+
* are the same dBoxProc double frame — 1px outer rule, 2px gap, 2px inner
|
|
9
|
+
* band, no shadow ({@link vfModalFrame}):
|
|
8
10
|
*
|
|
9
|
-
* - **Default:**
|
|
10
|
-
* the
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* than enforcing
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* like the original. A `heading` renders as a centered
|
|
18
|
-
* at the top of the body (the reference art's "Dialog
|
|
19
|
-
* ignored, there being no bar to carry the widget.
|
|
11
|
+
* - **Default:** the movable modal (movableDBoxProc) — the striped title bar
|
|
12
|
+
* set into the top of that frame, with a centered title over a white body.
|
|
13
|
+
* Drag the title bar to move it. `closable` adds the standard close box
|
|
14
|
+
* (left of the bar) — the HIG's own figures disagree on whether a movable
|
|
15
|
+
* modal carries one (Figure 5-1 says yes, Figure 6-1 and the Chapter 6 text
|
|
16
|
+
* say no), so the component enables either reading rather than enforcing
|
|
17
|
+
* one.
|
|
18
|
+
* - **`frame="plain"`:** the modal dialog box — the bare frame, no title bar —
|
|
19
|
+
* and immovable, like the original. A `heading` renders as a centered
|
|
20
|
+
* display-face heading at the top of the body (the reference art's "Dialog
|
|
21
|
+
* title"); `closable` is ignored, there being no bar to carry the widget.
|
|
20
22
|
*
|
|
21
23
|
* Open it with `show()` (or set the `open` attribute/property); close with
|
|
22
24
|
* `close()`. Escape closes it and fires `vf-close` with
|
|
@@ -27,7 +29,8 @@ import './vf-button-group.js';
|
|
|
27
29
|
* @slot buttons - Optional action buttons. Rendered as a bottom-right
|
|
28
30
|
* `vf-button-group` (equal-width, faces aligned); the footer only takes
|
|
29
31
|
* space when the slot is populated.
|
|
30
|
-
* @csspart frame - The outer
|
|
32
|
+
* @csspart frame - The outer frame (the double frame's 1px rule; the bar and
|
|
33
|
+
* the inner band sit inside it).
|
|
31
34
|
* @csspart title-bar - The striped title bar (default chrome only).
|
|
32
35
|
* @csspart title - The centered title patch (or the plain-frame heading).
|
|
33
36
|
* @csspart close-box - The close widget (`closable`, default chrome only).
|
|
@@ -76,8 +79,9 @@ export declare class VfDialog extends VfModalDialog {
|
|
|
76
79
|
*/
|
|
77
80
|
closable: boolean;
|
|
78
81
|
/**
|
|
79
|
-
* Frame chrome. Omit for the
|
|
80
|
-
*
|
|
82
|
+
* Frame chrome. Omit for the movable modal (the double frame with the
|
|
83
|
+
* striped title bar set into it); `'plain'` for the immovable modal dialog
|
|
84
|
+
* box (the bare double frame, no bar).
|
|
81
85
|
*/
|
|
82
86
|
frame?: 'plain';
|
|
83
87
|
/** Whether the `buttons` slot has assigned content (drives the footer). */
|
|
@@ -4,23 +4,23 @@ import r from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js
|
|
|
4
4
|
import { vfDisplayDecls as i } from "../styles/recipes/display-face.js";
|
|
5
5
|
import { vfBase as a } from "../styles/recipes/host.js";
|
|
6
6
|
import { vfStripes as o } from "../styles/recipes/pattern.js";
|
|
7
|
-
import {
|
|
8
|
-
import { vfTitleBar as
|
|
9
|
-
import { vfFocus as
|
|
10
|
-
import { vfScrollRail as
|
|
11
|
-
import { DragController as
|
|
12
|
-
import { TitleCenterController as
|
|
13
|
-
import { ScrollStateController as
|
|
14
|
-
import { ScrollRailController as
|
|
15
|
-
import { VfModalDialog as
|
|
7
|
+
import { vfModalFrame as s } from "../styles/recipes/surface.js";
|
|
8
|
+
import { vfTitleBar as c, vfWindowWidgets as l } from "../styles/recipes/title-bar.js";
|
|
9
|
+
import { vfFocus as u, vfFocusRing as d } from "../styles/recipes/focus.js";
|
|
10
|
+
import { vfScrollRail as f } from "../styles/recipes/scroll-rail.js";
|
|
11
|
+
import { DragController as p } from "../drag.js";
|
|
12
|
+
import { TitleCenterController as m, chromeTitleBar as h, closeBox as g, widgetLabel as _ } from "../chrome.js";
|
|
13
|
+
import { ScrollStateController as v } from "../scroll-state.js";
|
|
14
|
+
import { ScrollRailController as y, renderScrollRail as b } from "../scroll-rail.js";
|
|
15
|
+
import { VfModalDialog as x, modalDialogStyles as S } from "../modal-dialog.js";
|
|
16
16
|
import "./vf-button-group.js";
|
|
17
|
-
import { css as
|
|
18
|
-
import { property as
|
|
19
|
-
import { styleMap as
|
|
17
|
+
import { css as C, html as w, nothing as T } from "lit";
|
|
18
|
+
import { property as E, query as D, state as O } from "lit/decorators.js";
|
|
19
|
+
import { styleMap as k } from "lit/directives/style-map.js";
|
|
20
20
|
//#region src/components/vf-dialog.ts
|
|
21
|
-
var
|
|
21
|
+
var A = class extends x {
|
|
22
22
|
constructor(...e) {
|
|
23
|
-
super(...e), this._drag = new
|
|
23
|
+
super(...e), this._drag = new p(this, {
|
|
24
24
|
onDragStart: (e) => {
|
|
25
25
|
if (e.button !== 0 || e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("box"))) return null;
|
|
26
26
|
let r = this._dialog;
|
|
@@ -36,34 +36,32 @@ var j = class extends S {
|
|
|
36
36
|
};
|
|
37
37
|
},
|
|
38
38
|
onDrag: (e, t) => this.placeAt(e, t)
|
|
39
|
-
}), this._titleCenter = new
|
|
39
|
+
}), this._titleCenter = new m(this), this.heading = "", this.label = "", this.closable = !1, this._hasButtons = !1, this._scrollable = !1, this._scrollState = new v(this, () => this._content, void 0, (e) => {
|
|
40
40
|
this._scrollable = e.y;
|
|
41
|
-
}), this._rail = new
|
|
41
|
+
}), this._rail = new y(this, { getScroll: () => this._content });
|
|
42
42
|
}
|
|
43
43
|
static {
|
|
44
44
|
this.styles = [
|
|
45
45
|
a,
|
|
46
46
|
o,
|
|
47
|
-
|
|
47
|
+
u,
|
|
48
48
|
s,
|
|
49
49
|
c,
|
|
50
50
|
l,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
C
|
|
54
|
-
w`
|
|
51
|
+
f,
|
|
52
|
+
S,
|
|
53
|
+
C`
|
|
55
54
|
:host {
|
|
56
55
|
display: contents;
|
|
57
56
|
}
|
|
58
57
|
/* A declared height lands on the <dialog> (dialogSize), so the frame has
|
|
59
|
-
to be told to fill it —
|
|
60
|
-
full-height flex
|
|
58
|
+
to be told to fill it — vfModalFrame is skin only. The frame is a
|
|
59
|
+
full-height flex column for the same reason vf-window's is: the body
|
|
61
60
|
takes the slack the title bar doesn't. The frame is the flex child of
|
|
62
61
|
the <dialog> itself (modalDialogStyles), not a height: 100% block —
|
|
63
62
|
a percentage can't resolve against the undeclared-height dialog that
|
|
64
63
|
only the UA's dialog:modal max-height caps, and that spill was
|
|
65
64
|
exactly how a tall modal used to strand its buttons off-screen. */
|
|
66
|
-
.vf-frame,
|
|
67
65
|
.vf-modal-frame {
|
|
68
66
|
display: flex;
|
|
69
67
|
flex-direction: column;
|
|
@@ -182,7 +180,7 @@ var j = class extends S {
|
|
|
182
180
|
treatment as vf-scroll-area's viewport. */
|
|
183
181
|
.content:focus-visible {
|
|
184
182
|
--vf-focus-offset: -2px;
|
|
185
|
-
${
|
|
183
|
+
${d}
|
|
186
184
|
}
|
|
187
185
|
/* The plain frame's heading: centered chrome type at the top of the
|
|
188
186
|
body, the way dBoxProc dialogs drew their title in content (see
|
|
@@ -214,21 +212,21 @@ var j = class extends S {
|
|
|
214
212
|
this.close();
|
|
215
213
|
}
|
|
216
214
|
render() {
|
|
217
|
-
let e = !this.label && this.heading !== "", t = this.frame === "plain", n =
|
|
215
|
+
let e = !this.label && this.heading !== "", t = this.frame === "plain", n = w`
|
|
218
216
|
<div class="body" part="body">
|
|
219
217
|
<div class="content-wrap">
|
|
220
218
|
<div
|
|
221
219
|
class="content vf-scroll"
|
|
222
220
|
part="content"
|
|
223
|
-
tabindex=${this._scrollable ? "0" :
|
|
224
|
-
role=${this._scrollable ? "group" :
|
|
221
|
+
tabindex=${this._scrollable ? "0" : T}
|
|
222
|
+
role=${this._scrollable ? "group" : T}
|
|
225
223
|
>
|
|
226
|
-
${t && this.heading !== "" ?
|
|
224
|
+
${t && this.heading !== "" ? w`<span class="plain-heading" part="title" id="title"
|
|
227
225
|
>${this.heading}</span
|
|
228
|
-
>` :
|
|
226
|
+
>` : T}
|
|
229
227
|
<slot @slotchange=${this._onBodySlotChange}></slot>
|
|
230
228
|
</div>
|
|
231
|
-
${
|
|
229
|
+
${b(this._rail, "vertical")}
|
|
232
230
|
<div class="scroll-frame" aria-hidden="true"></div>
|
|
233
231
|
</div>
|
|
234
232
|
<div class="footer ${this._hasButtons ? "" : "empty"}" part="footer">
|
|
@@ -241,29 +239,23 @@ var j = class extends S {
|
|
|
241
239
|
</div>
|
|
242
240
|
</div>
|
|
243
241
|
`;
|
|
244
|
-
return
|
|
242
|
+
return w`
|
|
245
243
|
<dialog
|
|
246
|
-
style=${
|
|
247
|
-
aria-labelledby=${e ? "title" :
|
|
248
|
-
aria-label=${e ?
|
|
244
|
+
style=${k(this.dialogSize)}
|
|
245
|
+
aria-labelledby=${e ? "title" : T}
|
|
246
|
+
aria-label=${e ? T : this.label || "Dialog"}
|
|
249
247
|
@cancel=${this._onNativeCancel}
|
|
250
248
|
@close=${this._onNativeClose}
|
|
251
249
|
>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
>${this.heading}</span
|
|
262
|
-
>
|
|
263
|
-
`)}
|
|
264
|
-
${n}
|
|
265
|
-
</div>
|
|
266
|
-
`}
|
|
250
|
+
<div class="vf-modal-frame" part="frame">
|
|
251
|
+
${t ? T : h(this._drag, w`
|
|
252
|
+
${this.closable ? g(_("Close", this.heading), this._onCloseClick) : T}
|
|
253
|
+
<span class="vf-title" part="title" id="title"
|
|
254
|
+
>${this.heading}</span
|
|
255
|
+
>
|
|
256
|
+
`)}
|
|
257
|
+
<div class="vf-modal-frame-inner">${n}</div>
|
|
258
|
+
</div>
|
|
267
259
|
</dialog>
|
|
268
260
|
`;
|
|
269
261
|
}
|
|
@@ -272,9 +264,9 @@ var j = class extends S {
|
|
|
272
264
|
this._hasButtons = t.assignedElements().length > 0;
|
|
273
265
|
}
|
|
274
266
|
};
|
|
275
|
-
r([
|
|
267
|
+
r([E()], A.prototype, "heading", void 0), r([E()], A.prototype, "label", void 0), r([E({
|
|
276
268
|
type: Boolean,
|
|
277
269
|
reflect: !0
|
|
278
|
-
})],
|
|
270
|
+
})], A.prototype, "closable", void 0), r([E({ reflect: !0 })], A.prototype, "frame", void 0), r([O()], A.prototype, "_hasButtons", void 0), r([D(".content")], A.prototype, "_content", void 0), r([O()], A.prototype, "_scrollable", void 0), A = r([e("vf-dialog")], A);
|
|
279
271
|
//#endregion
|
|
280
|
-
export {
|
|
272
|
+
export { A as VfDialog };
|
|
@@ -3,17 +3,18 @@ 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 } 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 {
|
|
6
|
+
import { vfRule as a } from "../styles/recipes/rule.js";
|
|
7
|
+
import { GridSnapController as o } from "../grid-snap.js";
|
|
8
|
+
import { DocumentListenersController as s } from "../document-listeners.js";
|
|
9
|
+
import { SCREEN_CORNER as c, steppedCornerClip as l } from "../pixel-frame.js";
|
|
10
|
+
import { TypeAheadBuffer as u } from "../type-ahead.js";
|
|
11
|
+
import { MenuPressController as d } from "../menu-press.js";
|
|
12
|
+
import { LitElement as f, css as p, html as m, unsafeCSS as h } from "lit";
|
|
13
|
+
import { property as g, queryAssignedElements as _ } from "lit/decorators.js";
|
|
13
14
|
//#region src/components/vf-menu-bar.ts
|
|
14
|
-
var
|
|
15
|
+
var v = class extends r(f) {
|
|
15
16
|
constructor(...e) {
|
|
16
|
-
super(...e), this.scale = new t(this), this.gridSnap = new
|
|
17
|
+
super(...e), this.scale = new t(this), this.gridSnap = new o(this), this.label = "", this.rounded = !1, this.shortcuts = !1, this.#e = null, this.#t = this.attachInternals(), this.#n = new u(), this.#r = null, this.#i = new s(this, () => [[
|
|
17
18
|
document,
|
|
18
19
|
"pointerdown",
|
|
19
20
|
this.#h,
|
|
@@ -23,7 +24,7 @@ var _ = class extends r(d) {
|
|
|
23
24
|
"keydown",
|
|
24
25
|
this.#g,
|
|
25
26
|
!0
|
|
26
|
-
]]), this.#a = new
|
|
27
|
+
]]), this.#a = new d(this, {
|
|
27
28
|
menus: () => this._menus,
|
|
28
29
|
open: (e) => this.#p(e),
|
|
29
30
|
close: () => this.#m()
|
|
@@ -101,7 +102,10 @@ var _ = class extends r(d) {
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
static {
|
|
104
|
-
this.styles = [
|
|
105
|
+
this.styles = [
|
|
106
|
+
i,
|
|
107
|
+
a,
|
|
108
|
+
p`
|
|
105
109
|
:host {
|
|
106
110
|
display: block;
|
|
107
111
|
/* 19 white system px over the 1px black rule — Menus.png's bar strip
|
|
@@ -112,9 +116,9 @@ var _ = class extends r(d) {
|
|
|
112
116
|
}
|
|
113
117
|
.bar {
|
|
114
118
|
/* Paint lives here rather than on the host so it rides the snap offset
|
|
115
|
-
(see .vf-snap in base.ts); border-box sizing keeps the geometry.
|
|
119
|
+
(see .vf-snap in base.ts); border-box sizing keeps the geometry. The
|
|
120
|
+
rule is vfRule's vf-rule-bottom on the element. */
|
|
116
121
|
background: var(--vf-white, #fff);
|
|
117
|
-
border-bottom: calc(var(--vf-scale, 1) * 1px) solid var(--vf-black, #000);
|
|
118
122
|
display: flex;
|
|
119
123
|
align-items: stretch;
|
|
120
124
|
height: 100%;
|
|
@@ -146,20 +150,21 @@ var _ = class extends r(d) {
|
|
|
146
150
|
content: '';
|
|
147
151
|
position: absolute;
|
|
148
152
|
top: 0;
|
|
149
|
-
width: calc(var(--vf-scale, 1) * ${
|
|
150
|
-
height: calc(var(--vf-scale, 1) * ${
|
|
153
|
+
width: calc(var(--vf-scale, 1) * ${c[0]}px);
|
|
154
|
+
height: calc(var(--vf-scale, 1) * ${c.length}px);
|
|
151
155
|
background: var(--vf-black, #000);
|
|
152
156
|
pointer-events: none;
|
|
153
157
|
}
|
|
154
158
|
:host([rounded]) .bar::before {
|
|
155
159
|
left: 0;
|
|
156
|
-
clip-path: ${
|
|
160
|
+
clip-path: ${h(l(c, "left"))};
|
|
157
161
|
}
|
|
158
162
|
:host([rounded]) .bar::after {
|
|
159
163
|
right: 0;
|
|
160
|
-
clip-path: ${
|
|
164
|
+
clip-path: ${h(l(c, "right"))};
|
|
161
165
|
}
|
|
162
|
-
`
|
|
166
|
+
`
|
|
167
|
+
];
|
|
163
168
|
}
|
|
164
169
|
#e;
|
|
165
170
|
#t;
|
|
@@ -181,8 +186,8 @@ var _ = class extends r(d) {
|
|
|
181
186
|
e.has("label") && (this.#t.ariaLabel = this.label || null);
|
|
182
187
|
}
|
|
183
188
|
render() {
|
|
184
|
-
return
|
|
185
|
-
<div class="bar vf-snap" part="bar" role="presentation">
|
|
189
|
+
return m`
|
|
190
|
+
<div class="bar vf-snap vf-rule-bottom" part="bar" role="presentation">
|
|
186
191
|
<slot @slotchange=${this.#s}></slot>
|
|
187
192
|
</div>
|
|
188
193
|
`;
|
|
@@ -225,15 +230,15 @@ var _ = class extends r(d) {
|
|
|
225
230
|
r = n < 0 ? e === 1 ? 0 : t.length - 1 : (n + e + t.length) % t.length, t[r]?.focus();
|
|
226
231
|
}
|
|
227
232
|
};
|
|
228
|
-
n([
|
|
233
|
+
n([g()], v.prototype, "label", void 0), n([g({
|
|
229
234
|
type: Boolean,
|
|
230
235
|
reflect: !0
|
|
231
|
-
})],
|
|
236
|
+
})], v.prototype, "rounded", void 0), n([g({
|
|
232
237
|
type: Boolean,
|
|
233
238
|
reflect: !0
|
|
234
|
-
})],
|
|
239
|
+
})], v.prototype, "shortcuts", void 0), n([_({
|
|
235
240
|
selector: "vf-menu",
|
|
236
241
|
flatten: !0
|
|
237
|
-
})],
|
|
242
|
+
})], v.prototype, "_menus", void 0), v = n([e("vf-menu-bar")], v);
|
|
238
243
|
//#endregion
|
|
239
|
-
export {
|
|
244
|
+
export { v as VfMenuBar };
|