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
|
@@ -5,8 +5,8 @@ import { VfPositioned as o } from "../position.js";
|
|
|
5
5
|
import { vfBase as s } from "../styles/recipes/host.js";
|
|
6
6
|
import { tileImage as c, tileRects as l, tileSpan as u, vfTileMaskSize as d } from "../styles/recipes/tile.js";
|
|
7
7
|
import { TileRasterCache as f, patternOverride as p, tileGrid as m, vfTileGrid as h } from "../tile-grid.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { TrackWidthController as g } from "../track-width.js";
|
|
9
|
+
import { GridSnapController as _ } from "../grid-snap.js";
|
|
10
10
|
import { LitElement as v, css as y, html as b, unsafeCSS as x } from "lit";
|
|
11
11
|
import { property as S, query as C } from "lit/decorators.js";
|
|
12
12
|
//#region src/components/vf-progress-bar.ts
|
|
@@ -220,7 +220,7 @@ var w = 12, T = [
|
|
|
220
220
|
#e;
|
|
221
221
|
#t;
|
|
222
222
|
constructor() {
|
|
223
|
-
super(), this.scale = new t(this), this.gridSnap = new
|
|
223
|
+
super(), this.scale = new t(this), this.gridSnap = new _(this), this.value = 0, this.max = 100, this.indeterminate = !1, this.label = "", this.trackSize = new g(this, () => this.track), this._pattern = "", this.#e = new f(), this.#t = this.attachInternals(), this.#t.role = "progressbar", this.#t.ariaValueMin = "0";
|
|
224
224
|
}
|
|
225
225
|
get effectiveMax() {
|
|
226
226
|
return this.max > 0 ? this.max : 100;
|
|
@@ -5,12 +5,12 @@ import o from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js
|
|
|
5
5
|
import { VfPositioned as s } from "../position.js";
|
|
6
6
|
import { vfBase as c } from "../styles/recipes/host.js";
|
|
7
7
|
import { vfFocusUnderline as l } from "../styles/recipes/focus.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { TrackWidthController as u } from "../track-width.js";
|
|
9
|
+
import { GridSnapController as d } from "../grid-snap.js";
|
|
10
|
+
import { SLIDER_THUMB as f, SLIDER_THUMB_FACE as p } from "../glyphs.js";
|
|
11
|
+
import { VfFormControl as m } from "../form-control.js";
|
|
12
|
+
import { FocusRuleController as h } from "../focus-modality.js";
|
|
13
|
+
import { decimalsOf as g } from "../number.js";
|
|
14
14
|
import { css as _, html as v } from "lit";
|
|
15
15
|
import { property as y, query as b } from "lit/decorators.js";
|
|
16
16
|
//#region src/components/vf-slider.ts
|
|
@@ -21,7 +21,7 @@ function D(e, t) {
|
|
|
21
21
|
};
|
|
22
22
|
return r(1, 0, e - 2, 1), r(1, 3, e - 2, 1), r(0, 1, 1, 2), r(e - 1, 1, 1, 2), r(1, 1, Math.min(Math.max(t, 0), e - 1) - 1, 2), n.join("");
|
|
23
23
|
}
|
|
24
|
-
var O = class extends s(
|
|
24
|
+
var O = class extends s(m) {
|
|
25
25
|
static {
|
|
26
26
|
this.styles = [c, _`
|
|
27
27
|
:host {
|
|
@@ -110,7 +110,7 @@ var O = class extends s(p) {
|
|
|
110
110
|
#t;
|
|
111
111
|
#n;
|
|
112
112
|
constructor() {
|
|
113
|
-
super(), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.name = "", this.label = "", this.trackSize = new
|
|
113
|
+
super(), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.name = "", this.label = "", this.trackSize = new u(this, () => this.track), this.scale = new r(this), this.gridSnap = new d(this), this.selfManagedTabIndex = !1, this.#e = new h(this), this.#t = 0, this.#n = !1, this.#f = (e) => {
|
|
114
114
|
if (!(this.isDisabled || e.button !== 0)) {
|
|
115
115
|
e.preventDefault(), this.#e.suppress(), this.focus(), this.#n = !0, this.#t = this.value;
|
|
116
116
|
try {
|
|
@@ -181,7 +181,7 @@ var O = class extends s(p) {
|
|
|
181
181
|
}
|
|
182
182
|
#o(e) {
|
|
183
183
|
let t = this.#i, n = Math.round((e - this.min) / t), r = this.#a(this.min + n * t);
|
|
184
|
-
return Number(r.toFixed(
|
|
184
|
+
return Number(r.toFixed(g(t)));
|
|
185
185
|
}
|
|
186
186
|
get #s() {
|
|
187
187
|
let e = Number.isFinite(this.value) ? this.value : this.min;
|
|
@@ -242,8 +242,8 @@ var O = class extends s(p) {
|
|
|
242
242
|
shape-rendering="crispEdges"
|
|
243
243
|
aria-hidden="true"
|
|
244
244
|
>
|
|
245
|
-
<path class="thumb-face" d=${
|
|
246
|
-
<path class="thumb-outline" d=${
|
|
245
|
+
<path class="thumb-face" d=${p.d}></path>
|
|
246
|
+
<path class="thumb-outline" d=${f.d}></path>
|
|
247
247
|
</svg>
|
|
248
248
|
</span>
|
|
249
249
|
</div>
|
|
@@ -4,28 +4,29 @@ import { ScaleController as n, snapSys as r, sysLength as i, toSysExact as a } f
|
|
|
4
4
|
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 { vfBase as u } from "../styles/recipes/host.js";
|
|
7
|
-
import {
|
|
8
|
-
import { vfChromeFrame as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
7
|
+
import { DOT_MOTIF as d, DOT_RECTS as f, DOT_SPAN as p, vfDots as m, vfStripes as h } from "../styles/recipes/pattern.js";
|
|
8
|
+
import { vfChromeFrame as g } from "../styles/recipes/surface.js";
|
|
9
|
+
import { vfRule as _ } from "../styles/recipes/rule.js";
|
|
10
|
+
import { vfTitleBar as v, vfWindowWidgets as y } from "../styles/recipes/title-bar.js";
|
|
11
|
+
import { vfFocus as b } from "../styles/recipes/focus.js";
|
|
12
|
+
import { TileRasterCache as x, patternOverride as S, tileGrid as C, vfTileGrid as w } from "../tile-grid.js";
|
|
13
|
+
import { GridSnapController as T } from "../grid-snap.js";
|
|
14
|
+
import { VfSized as E } from "../size.js";
|
|
15
|
+
import { DragController as D } from "../drag.js";
|
|
16
|
+
import { TitleCenterController as O, chromeTitleBar as k, closeBox as A, widgetLabel as j, zoomBox as M } from "../chrome.js";
|
|
16
17
|
import "./vf-scroll-area.js";
|
|
17
|
-
import { LitElement as
|
|
18
|
-
import { property as
|
|
18
|
+
import { LitElement as N, css as P, html as F, nothing as I } from "lit";
|
|
19
|
+
import { property as L, state as R } from "lit/decorators.js";
|
|
19
20
|
//#region src/components/vf-window.ts
|
|
20
|
-
var
|
|
21
|
+
var z = 80, B = 54, V = 24, H = 8, U = class extends E(c(N)) {
|
|
21
22
|
constructor(...e) {
|
|
22
|
-
super(...e), this.heading = "", this.active = !0, this.closable = !0, this.zoomable = !1, this.movable = !1, this.resizable = !1, this.flush = !1, this._hasStatus = !1, this.scale = new n(this), this.gridSnap = new
|
|
23
|
+
super(...e), this.heading = "", this.active = !0, this.closable = !0, this.zoomable = !1, this.movable = !1, this.resizable = !1, this.flush = !1, this._hasStatus = !1, this.scale = new n(this), this.gridSnap = new T(this), this.titleCenter = new O(this), this._dotsPattern = "", this.#e = new x(), this.#t = (e, t, n) => {
|
|
23
24
|
let r = a(this.offsetWidth, this);
|
|
24
25
|
return {
|
|
25
|
-
x: Math.min(Math.max(e,
|
|
26
|
-
y: Math.min(Math.max(t, 0), Math.max(0, n.height -
|
|
26
|
+
x: Math.min(Math.max(e, V - r), n.width - V),
|
|
27
|
+
y: Math.min(Math.max(t, 0), Math.max(0, n.height - V))
|
|
27
28
|
};
|
|
28
|
-
}, this._placement = new s(this, (e, t, n) => this.#t(e, t, n)), this._drag = new
|
|
29
|
+
}, this._placement = new s(this, (e, t, n) => this.#t(e, t, n)), this._drag = new D(this, {
|
|
29
30
|
onDragStart: (e) => !this.movable || e.button !== 0 || e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("box")) ? null : (this.#i(), this._placement.seed()),
|
|
30
31
|
onDrag: (e, t) => this._placement.moveTo(e, t)
|
|
31
32
|
}), this._resizeState = null, this.#n = !1, this.#r = !1;
|
|
@@ -33,14 +34,15 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
33
34
|
static {
|
|
34
35
|
this.styles = [
|
|
35
36
|
u,
|
|
36
|
-
m,
|
|
37
|
-
p,
|
|
38
|
-
S,
|
|
39
|
-
v,
|
|
40
37
|
h,
|
|
38
|
+
m,
|
|
39
|
+
w,
|
|
40
|
+
b,
|
|
41
41
|
g,
|
|
42
42
|
_,
|
|
43
|
-
|
|
43
|
+
v,
|
|
44
|
+
y,
|
|
45
|
+
P`
|
|
44
46
|
:host {
|
|
45
47
|
display: block;
|
|
46
48
|
position: relative;
|
|
@@ -221,7 +223,7 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
221
223
|
display: flex;
|
|
222
224
|
align-items: center;
|
|
223
225
|
height: calc(var(--vf-scale, 1) * var(--vf-status-bar-height, 15px));
|
|
224
|
-
|
|
226
|
+
/* The rule is vfRule's vf-rule-top on the element. */
|
|
225
227
|
background: var(--vf-white, #ffffff);
|
|
226
228
|
padding-inline: calc(var(--vf-scale, 1) * 6px);
|
|
227
229
|
line-height: calc(var(--vf-scale, 1) * var(--vf-line-height, 12px));
|
|
@@ -281,20 +283,20 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
281
283
|
}
|
|
282
284
|
#e;
|
|
283
285
|
willUpdate(e) {
|
|
284
|
-
super.willUpdate(e), this.variant === "utility" && (this._dotsPattern =
|
|
286
|
+
super.willUpdate(e), this.variant === "utility" && (this._dotsPattern = S(this, "--vf-dots-pattern"));
|
|
285
287
|
}
|
|
286
288
|
_dotsTexture() {
|
|
287
289
|
if (this.width == null) return;
|
|
288
290
|
let e = Math.max(1, this.width - 2);
|
|
289
|
-
if (this._dotsPattern) return
|
|
290
|
-
cols: Math.ceil(e /
|
|
291
|
+
if (this._dotsPattern) return C({
|
|
292
|
+
cols: Math.ceil(e / p),
|
|
291
293
|
rows: 1,
|
|
292
|
-
tile:
|
|
294
|
+
tile: p
|
|
293
295
|
});
|
|
294
|
-
let t = Math.ceil((e +
|
|
295
|
-
return
|
|
296
|
+
let t = Math.ceil((e + d) / p) * p, n = H + d;
|
|
297
|
+
return F`<div
|
|
296
298
|
class="vf-tile-raster"
|
|
297
|
-
style="width:${i(t)};height:${i(n)};background-image:${this.#e.for(
|
|
299
|
+
style="width:${i(t)};height:${i(n)};background-image:${this.#e.for(d, d, f, t, n)}"
|
|
298
300
|
></div>`;
|
|
299
301
|
}
|
|
300
302
|
#t;
|
|
@@ -346,7 +348,7 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
346
348
|
_onGrowPointerMove(e) {
|
|
347
349
|
let t = this._resizeState;
|
|
348
350
|
if (!t || e.pointerId !== t.pointerId) return;
|
|
349
|
-
let n = r(Math.max(
|
|
351
|
+
let n = r(Math.max(z, t.baseWidth + a(e.clientX - t.startX, this)), this), i = r(Math.max(B, t.baseHeight + a(e.clientY - t.startY, this)), this);
|
|
350
352
|
(n !== this.width || i !== this.height) && (t.emitPending = !0, t.resized = !0), this.width = n, this.height = i;
|
|
351
353
|
}
|
|
352
354
|
_onGrowPointerEnd(t) {
|
|
@@ -361,34 +363,34 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
render() {
|
|
364
|
-
return
|
|
366
|
+
return F`
|
|
365
367
|
<div
|
|
366
368
|
class="vf-frame vf-snap"
|
|
367
369
|
part="frame"
|
|
368
370
|
role="group"
|
|
369
|
-
aria-labelledby=${this.heading ? "title" :
|
|
371
|
+
aria-labelledby=${this.heading ? "title" : I}
|
|
370
372
|
>
|
|
371
|
-
${
|
|
372
|
-
${this.closable ?
|
|
373
|
+
${k(this._drag, F`
|
|
374
|
+
${this.closable ? A(j("Close", this.heading), this._onCloseClick) : I}
|
|
373
375
|
<span class="vf-title" part="title" id="title">${this.heading}</span>
|
|
374
|
-
${this.zoomable ?
|
|
376
|
+
${this.zoomable ? M(j("Zoom", this.heading), this._onZoomClick) : I}
|
|
375
377
|
`, this.variant === "utility" ? "vf-dots" : "vf-stripes", this.variant === "utility" ? this._dotsTexture() : void 0)}
|
|
376
378
|
<div class="body" part="body">
|
|
377
|
-
${this.scrollbars ?
|
|
379
|
+
${this.scrollbars ? F`
|
|
378
380
|
<vf-scroll-area
|
|
379
381
|
class="edge-scroll"
|
|
380
382
|
axis=${this.scrollbars}
|
|
381
|
-
label=${this.heading ||
|
|
383
|
+
label=${this.heading || I}
|
|
382
384
|
exportparts="viewport"
|
|
383
385
|
>
|
|
384
386
|
<slot></slot>
|
|
385
387
|
</vf-scroll-area>
|
|
386
|
-
` :
|
|
388
|
+
` : F`<slot></slot>`}
|
|
387
389
|
</div>
|
|
388
|
-
<div class="status ${this._hasStatus ? "" : "empty"}" part="status-bar">
|
|
390
|
+
<div class="status vf-rule-top ${this._hasStatus ? "" : "empty"}" part="status-bar">
|
|
389
391
|
<slot name="status" @slotchange=${this._onStatusSlotChange}></slot>
|
|
390
392
|
</div>
|
|
391
|
-
${this.resizable ?
|
|
393
|
+
${this.resizable ? F`
|
|
392
394
|
<div
|
|
393
395
|
class="grow"
|
|
394
396
|
part="grow-box"
|
|
@@ -398,29 +400,29 @@ var L = 80, R = 54, z = 24, B = 8, V = class extends w(c(j)) {
|
|
|
398
400
|
@pointercancel=${this._onGrowPointerEnd}
|
|
399
401
|
@lostpointercapture=${this._onGrowPointerEnd}
|
|
400
402
|
></div>
|
|
401
|
-
` :
|
|
403
|
+
` : I}
|
|
402
404
|
</div>
|
|
403
405
|
`;
|
|
404
406
|
}
|
|
405
407
|
};
|
|
406
|
-
o([
|
|
408
|
+
o([L({ reflect: !0 })], U.prototype, "variant", void 0), o([L()], U.prototype, "heading", void 0), o([L({
|
|
407
409
|
type: Boolean,
|
|
408
410
|
reflect: !0
|
|
409
|
-
})],
|
|
411
|
+
})], U.prototype, "active", void 0), o([L({
|
|
410
412
|
type: Boolean,
|
|
411
413
|
reflect: !0
|
|
412
|
-
})],
|
|
414
|
+
})], U.prototype, "closable", void 0), o([L({
|
|
413
415
|
type: Boolean,
|
|
414
416
|
reflect: !0
|
|
415
|
-
})],
|
|
417
|
+
})], U.prototype, "zoomable", void 0), o([L({
|
|
416
418
|
type: Boolean,
|
|
417
419
|
reflect: !0
|
|
418
|
-
})],
|
|
420
|
+
})], U.prototype, "movable", void 0), o([L({
|
|
419
421
|
type: Boolean,
|
|
420
422
|
reflect: !0
|
|
421
|
-
})],
|
|
423
|
+
})], U.prototype, "resizable", void 0), o([L({
|
|
422
424
|
type: Boolean,
|
|
423
425
|
reflect: !0
|
|
424
|
-
})],
|
|
426
|
+
})], U.prototype, "flush", void 0), o([L({ reflect: !0 })], U.prototype, "scrollbars", void 0), o([R()], U.prototype, "_hasStatus", void 0), U = o([t("vf-window")], U);
|
|
425
427
|
//#endregion
|
|
426
|
-
export {
|
|
428
|
+
export { U as VfWindow };
|
package/dist/index.d.ts
CHANGED
|
@@ -88,8 +88,15 @@ export { CURSOR_ARROW, CURSOR_I_BEAM, CURSOR_CROSSHAIR, CURSOR_WAIT, } from './c
|
|
|
88
88
|
* `static styles` to inherit the kit's type, panel frame, window chrome, focus
|
|
89
89
|
* ring, field well and System 7 scroll-rail skin.
|
|
90
90
|
*/
|
|
91
|
-
export { vfBase, vfBodyDecls, vfDisplay, vfDisplayDecls, vfStaticText, vfPanel, vfChromeFrame, vfModalFrame, vfTitleBar, vfWindowWidgets, vfHardShadowDecls, vfStripes, vfDots, vfFocus, vfFocusRing, vfFocusUnderline, vfToggle, vfField, vfScrollRail, vfTileSize, vfTileMaskSize, tileImage, tileRaster, tileRects, tileSpan, TILE_LATTICE, } from './styles/base.js';
|
|
91
|
+
export { vfBase, vfBodyDecls, vfDisplay, vfDisplayDecls, vfStaticText, vfPanel, vfChromeFrame, vfModalFrame, vfRule, vfTitleBar, vfWindowWidgets, vfHardShadowDecls, vfStripes, vfDots, vfFocus, vfFocusRing, vfFocusUnderline, vfToggle, vfField, vfScrollRail, vfTileSize, vfTileMaskSize, tileImage, tileRaster, tileRects, tileSpan, TILE_LATTICE, } from './styles/base.js';
|
|
92
92
|
export type { TileRect } from './styles/base.js';
|
|
93
|
+
/**
|
|
94
|
+
* The 1px rule's attribute grammar (`vf-container rule="top bottom"`): the
|
|
95
|
+
* edge names, the parser, and the class list a resolved rule puts on a box
|
|
96
|
+
* styled by `vfRule`.
|
|
97
|
+
*/
|
|
98
|
+
export { RULE_EDGES, parseRule, ruleClasses } from './styles/base.js';
|
|
99
|
+
export type { RuleEdge } from './styles/base.js';
|
|
93
100
|
/**
|
|
94
101
|
* The exact tiled fill (TILE-GRID-PLAN.md): a surface's own art as one
|
|
95
102
|
* whole-surface raster (`tileRaster` + the `vf-tile-raster` rules), and a
|
|
@@ -101,6 +108,20 @@ export type { TileRect } from './styles/base.js';
|
|
|
101
108
|
* memoizes the encoded raster against its size.
|
|
102
109
|
*/
|
|
103
110
|
export { vfTileGrid, tileGrid, patternOverride, TileRasterCache } from './tile-grid.js';
|
|
111
|
+
/**
|
|
112
|
+
* The standard pattern set — the 38 MacPaint fills as 8-byte QuickDraw
|
|
113
|
+
* patterns (`PATTERNS`, named; `PATTERN_NAMES` in palette order), the
|
|
114
|
+
* attribute grammar (`parsePattern` reads a name or sixteen hex digits,
|
|
115
|
+
* `patternHex` writes one back), and the adapters onto the tile machinery
|
|
116
|
+
* (`patternMotif` on the minimal cell, `patternRects` on the full 8×8). The
|
|
117
|
+
* fill itself is `PatternFillController` + `vfPatternFill`: a pattern
|
|
118
|
+
* painted as a box's own background, exact at every density and zoom — what
|
|
119
|
+
* `vf-container pattern="…"` does.
|
|
120
|
+
*/
|
|
121
|
+
export { PATTERNS, PATTERN_NAMES, PATTERN_SIZE, parsePattern, patternHex, patternMotif, patternRects, } from './patterns.js';
|
|
122
|
+
export type { Pattern, PatternMotif, PatternName } from './patterns.js';
|
|
123
|
+
export { PatternFillController, vfPatternFill } from './pattern-fill.js';
|
|
124
|
+
export type { PatternFillOptions } from './pattern-fill.js';
|
|
104
125
|
/** Glyph sprites (`glyphSvg(CHECKMARK, 'check')`) and their pixel geometry. */
|
|
105
126
|
export { glyphSvg, CHECKBOX_X, RADIO_FACE, RADIO_RING, RADIO_RING_PRESSED, RADIO_DOT, CHECKMARK, CARET_DOWN, STEPPER, STEPPER_UP_FILL, STEPPER_DOWN_FILL, SLIDER_THUMB, SLIDER_THUMB_FACE, } from './glyphs.js';
|
|
106
127
|
export type { Glyph } from './glyphs.js';
|
package/dist/index.js
CHANGED
|
@@ -11,61 +11,64 @@ import { vfDisplay as P, vfDisplayDecls as F } from "./styles/recipes/display-fa
|
|
|
11
11
|
import { vfBase as I } from "./styles/recipes/host.js";
|
|
12
12
|
import { vfStaticText as L } from "./styles/recipes/static-text.js";
|
|
13
13
|
import { TILE_LATTICE as R, tileImage as z, tileRaster as B, tileRects as V, tileSpan as H, vfTileMaskSize as U, vfTileSize as W } from "./styles/recipes/tile.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
|
|
14
|
+
import { PATTERNS as G, PATTERN_NAMES as K, PATTERN_SIZE as q, parsePattern as J, patternHex as Y, patternMotif as X, patternRects as Z } from "./patterns.js";
|
|
15
|
+
import { vfDots as Q, vfStripes as $ } from "./styles/recipes/pattern.js";
|
|
16
|
+
import { vfHardShadowDecls as ee } from "./styles/recipes/shadow.js";
|
|
17
|
+
import { vfChromeFrame as te, vfModalFrame as ne, vfPanel as re } from "./styles/recipes/surface.js";
|
|
18
|
+
import { RULE_EDGES as ie, parseRule as ae, ruleClasses as oe, vfRule as se } from "./styles/recipes/rule.js";
|
|
19
|
+
import { vfTitleBar as ce, vfWindowWidgets as le } from "./styles/recipes/title-bar.js";
|
|
20
|
+
import { vfFocus as ue, vfFocusRing as de, vfFocusUnderline as fe } from "./styles/recipes/focus.js";
|
|
21
|
+
import { vfToggle as pe } from "./styles/recipes/toggle.js";
|
|
22
|
+
import { vfField as me } from "./styles/recipes/field.js";
|
|
23
|
+
import { vfScrollRail as he } from "./styles/recipes/scroll-rail.js";
|
|
24
|
+
import { TileRasterCache as ge, patternOverride as _e, tileGrid as ve, vfTileGrid as ye } from "./tile-grid.js";
|
|
25
|
+
import { TrackWidthController as be } from "./track-width.js";
|
|
26
|
+
import { PatternFillController as xe, vfPatternFill as Se } from "./pattern-fill.js";
|
|
27
|
+
import { GridSnapController as Ce, requestGridSnap as we } from "./grid-snap.js";
|
|
28
|
+
import { DocumentListenersController as Te } from "./document-listeners.js";
|
|
29
|
+
import { BUTTON_FACE as Ee, BUTTON_FRAME as De, RING_FRAME as Oe, RING_HOLE as ke, RING_INSET as Ae, SCREEN_CORNER as je, steppedCornerClip as Me, steppedRectClip as Ne, steppedRingClip as Pe } from "./pixel-frame.js";
|
|
30
|
+
import { VfDesktop as Fe } from "./components/vf-desktop.js";
|
|
31
|
+
import { VfSized as Ie } from "./size.js";
|
|
32
|
+
import { DragController as Le } from "./drag.js";
|
|
33
|
+
import { ScrollStateController as Re } from "./scroll-state.js";
|
|
34
|
+
import { BLINK_FLIPS as ze, BLINK_INTERVAL_MS as Be, PRESS_HOLD_MS as Ve, RENAME_DELAY_MS as He, prefersReducedMotion as Ue, runSelectionBlink as We } from "./motion.js";
|
|
35
|
+
import { CARET_DOWN as Ge, CHECKBOX_X as Ke, CHECKMARK as qe, RADIO_DOT as Je, RADIO_FACE as Ye, RADIO_RING as Xe, RADIO_RING_PRESSED as Ze, SLIDER_THUMB as Qe, SLIDER_THUMB_FACE as $e, STEPPER as et, STEPPER_DOWN_FILL as tt, STEPPER_UP_FILL as nt, glyphSvg as rt } from "./glyphs.js";
|
|
36
|
+
import { ScrollRailController as it, renderScrollRail as at } from "./scroll-rail.js";
|
|
37
|
+
import { VfScrollArea as ot } from "./components/vf-scroll-area.js";
|
|
38
|
+
import { VfWindow as st } from "./components/vf-window.js";
|
|
39
|
+
import { VfModalDialog as ct, modalDialogStyles as lt } from "./modal-dialog.js";
|
|
40
|
+
import { VfButtonGroup as ut } from "./components/vf-button-group.js";
|
|
41
|
+
import { VfDialog as dt } from "./components/vf-dialog.js";
|
|
42
|
+
import { VfSeparator as ft } from "./components/vf-separator.js";
|
|
43
|
+
import { VfFormControl as pt } from "./form-control.js";
|
|
44
|
+
import { VfButton as mt } from "./components/vf-button.js";
|
|
45
|
+
import { VfSwatch as ht } from "./components/vf-swatch.js";
|
|
46
|
+
import { VfToggleControl as gt } from "./toggle-control.js";
|
|
47
|
+
import { VfCheckbox as _t } from "./components/vf-checkbox.js";
|
|
48
|
+
import { VfRadio as vt } from "./components/vf-radio.js";
|
|
49
|
+
import { VfRadioGroup as yt } from "./components/vf-radio-group.js";
|
|
50
|
+
import { FocusRuleController as bt, focusModality as xt, trackFocusModality as St } from "./focus-modality.js";
|
|
51
|
+
import { VfTextControlBase as Ct } from "./text-control.js";
|
|
52
|
+
import { VfTextField as wt } from "./components/vf-text-field.js";
|
|
53
|
+
import { VfTextArea as Tt } from "./components/vf-text-area.js";
|
|
54
|
+
import { VfNumberField as Et } from "./components/vf-number-field.js";
|
|
55
|
+
import { VfOption as Dt } from "./components/vf-option.js";
|
|
56
|
+
import { VfSelect as Ot } from "./components/vf-select.js";
|
|
57
|
+
import { VfProgressBar as kt } from "./components/vf-progress-bar.js";
|
|
58
|
+
import { VfSlider as At } from "./components/vf-slider.js";
|
|
59
|
+
import { VfLabel as jt } from "./components/vf-label.js";
|
|
60
|
+
import { VfParagraph as Mt } from "./components/vf-paragraph.js";
|
|
61
|
+
import { VfImg as Nt } from "./components/vf-img.js";
|
|
62
|
+
import { VfIcon as Pt } from "./components/vf-icon.js";
|
|
63
|
+
import { VfMenuBar as Ft } from "./components/vf-menu-bar.js";
|
|
64
|
+
import { VfMenu as It } from "./components/vf-menu.js";
|
|
65
|
+
import { VfMenuItem as Lt } from "./components/vf-menu-item.js";
|
|
66
|
+
import { VfList as Rt } from "./components/vf-list.js";
|
|
67
|
+
import { VfListItem as zt } from "./components/vf-list-item.js";
|
|
68
|
+
import { VfFieldset as Bt } from "./components/vf-fieldset.js";
|
|
69
|
+
import { VfGrid as Vt } from "./components/vf-grid.js";
|
|
70
|
+
import { VfStack as Ht } from "./components/vf-stack.js";
|
|
71
|
+
import { VfContainer as Ut } from "./components/vf-container.js";
|
|
72
|
+
import { CURSOR_ARROW as Wt, CURSOR_CROSSHAIR as Gt, CURSOR_I_BEAM as Kt, CURSOR_WAIT as qt } from "./cursor-art.js";
|
|
73
|
+
import { applyCursor as Jt } from "./cursor.js";
|
|
74
|
+
export { ze as BLINK_FLIPS, Be as BLINK_INTERVAL_MS, Ee as BUTTON_FACE, De as BUTTON_FRAME, Ge as CARET_DOWN, Ke as CHECKBOX_X, qe as CHECKMARK, r as CLASSIC_DPI, i as CSS_REFERENCE_DPI, Wt as CURSOR_ARROW, Gt as CURSOR_CROSSHAIR, Kt as CURSOR_I_BEAM, qt as CURSOR_WAIT, Te as DocumentListenersController, Le as DragController, bt as FocusRuleController, Ce as GridSnapController, G as PATTERNS, K as PATTERN_NAMES, q as PATTERN_SIZE, D as PIXEL_GRID_METRICS, Ve as PRESS_HOLD_MS, xe as PatternFillController, T as PlacementController, Je as RADIO_DOT, Ye as RADIO_FACE, Xe as RADIO_RING, Ze as RADIO_RING_PRESSED, He as RENAME_DELAY_MS, Oe as RING_FRAME, ke as RING_HOLE, Ae as RING_INSET, ie as RULE_EDGES, je as SCREEN_CORNER, Qe as SLIDER_THUMB, $e as SLIDER_THUMB_FACE, et as STEPPER, tt as STEPPER_DOWN_FILL, nt as STEPPER_UP_FILL, a as SYSTEM_PX_IN_CSS_PX, d as ScaleController, it as ScrollRailController, Re as ScrollStateController, R as TILE_LATTICE, ge as TileRasterCache, be as TrackWidthController, k as VF_BODY_FAMILY, M as VF_DISPLAY_FAMILY, mt as VfButton, ut as VfButtonGroup, _t as VfCheckbox, Ut as VfContainer, Fe as VfDesktop, dt as VfDialog, Bt as VfFieldset, pt as VfFormControl, Vt as VfGrid, Pt as VfIcon, Nt as VfImg, jt as VfLabel, Rt as VfList, zt as VfListItem, It as VfMenu, Ft as VfMenuBar, Lt as VfMenuItem, ct as VfModalDialog, Et as VfNumberField, Dt as VfOption, Mt as VfParagraph, E as VfPositioned, kt as VfProgressBar, vt as VfRadio, yt as VfRadioGroup, ot as VfScrollArea, Ot as VfSelect, ft as VfSeparator, Ie as VfSized, At as VfSlider, Ht as VfStack, ht as VfSwatch, Tt as VfTextArea, Ct as VfTextControlBase, wt as VfTextField, gt as VfToggleControl, st as VfWindow, Jt as applyCursor, f as applyScale, t as defineElement, o as devicePxPerSystemPx, p as effectiveScale, e as emit, xt as focusModality, m as getScale, s as getZoom, rt as glyphSvg, lt as modalDialogStyles, h as onScaleChange, c as onZoomChange, J as parsePattern, ae as parseRule, Y as patternHex, X as patternMotif, _e as patternOverride, Z as patternRects, Ue as prefersReducedMotion, A as registerBodyFace, N as registerDisplayFace, O as registerEmbeddedFont, at as renderScrollRail, we as requestGridSnap, l as resetZoomBaseline, oe as ruleClasses, We as runSelectionBlink, g as snapSys, _ as snapToDevicePx, v as snapToSystemPx, Me as steppedCornerClip, Ne as steppedRectClip, Pe as steppedRingClip, y as sys, b as sysLength, x as sysLengths, S as systemPxQuantum, ve as tileGrid, z as tileImage, B as tileRaster, V as tileRects, H as tileSpan, C as toSys, w as toSysExact, St as trackFocusModality, u as truePixelRatio, I as vfBase, j as vfBodyDecls, te as vfChromeFrame, P as vfDisplay, F as vfDisplayDecls, Q as vfDots, n as vfElement, me as vfField, ue as vfFocus, de as vfFocusRing, fe as vfFocusUnderline, ee as vfHardShadowDecls, ne as vfModalFrame, re as vfPanel, Se as vfPatternFill, se as vfRule, he as vfScrollRail, L as vfStaticText, $ as vfStripes, ye as vfTileGrid, U as vfTileMaskSize, W as vfTileSize, ce as vfTitleBar, pe as vfToggle, le as vfWindowWidgets };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type CSSResult, type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { type Pattern } from './patterns.js';
|
|
3
|
+
/** What a component hands the controller. */
|
|
4
|
+
export interface PatternFillOptions {
|
|
5
|
+
/** The element whose background the pattern paints — a component's own
|
|
6
|
+
* snapped box, so the fill rides the grid-snap correction with it. */
|
|
7
|
+
getBox: () => HTMLElement | null | undefined;
|
|
8
|
+
/** The resolved pattern, or null to paint nothing ({@link parsePattern}
|
|
9
|
+
* turns an attribute value into one). */
|
|
10
|
+
getPattern: () => Pattern | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The box's declared size in system px, per axis. A declared axis is used
|
|
13
|
+
* as it is — exact, and free of any measurement; an axis left `null` or
|
|
14
|
+
* `undefined` is measured off the box instead (a `ResizeObserver`,
|
|
15
|
+
* `toSys`-rounded). Omit the whole option to measure both.
|
|
16
|
+
*/
|
|
17
|
+
getSize?: () => {
|
|
18
|
+
width?: number | null;
|
|
19
|
+
height?: number | null;
|
|
20
|
+
} | null | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Paints a {@link Pattern} as a box's own background — the fill behind
|
|
24
|
+
* `vf-container pattern="…"` and `vf-desktop pattern="…"`.
|
|
25
|
+
*
|
|
26
|
+
* It is the exact-fill idiom (src/tile-grid.ts) in its background form: the
|
|
27
|
+
* motif is encoded as one raster at one image px per system px
|
|
28
|
+
* (`tileRaster`, cached by pattern and size), sized in system px to the box
|
|
29
|
+
* ceiled up to whole pattern cells plus one cell of overdraw, and stretched
|
|
30
|
+
* onto that stated size under `image-rendering: pixelated`. Nearest-neighbor
|
|
31
|
+
* sampling can only emit source colors and one image has no interior seams,
|
|
32
|
+
* so the fill is 1-bit at every density and zoom — the same argument the
|
|
33
|
+
* desktop dither rests on. A `background-size` stated in system px is one
|
|
34
|
+
* stored length quantized once over the whole image (≤ 1/128 CSS px), not a
|
|
35
|
+
* repeat, and the box's background painting area crops the overdraw.
|
|
36
|
+
*
|
|
37
|
+
* A background rather than a child element, on purpose: it paints below all
|
|
38
|
+
* content by definition — no `isolation: isolate` + `z-index: -1`, so a
|
|
39
|
+
* patterned box never becomes a stacking context that traps a slotted
|
|
40
|
+
* control's drop-open panel under a later sibling — and it clips itself, so
|
|
41
|
+
* the box keeps `overflow: visible` (a container's outgrowing content
|
|
42
|
+
* overflows by contract). The one thing a background costs is that
|
|
43
|
+
* `image-rendering` is an inherited property: {@link vfPatternFill} sets it
|
|
44
|
+
* on the box only while patterned and hands `auto` back to the slot, so
|
|
45
|
+
* slotted content renders as it did.
|
|
46
|
+
*
|
|
47
|
+
* What it writes, all on the box's inline style and removed together the
|
|
48
|
+
* moment there is nothing to paint: `--_vf-pattern-image` (the raster) and
|
|
49
|
+
* `--_vf-pattern-size` (two live `sysLength`s). Custom-property channels,
|
|
50
|
+
* not `background-image` itself, so the recipe's forced-colors rule can
|
|
51
|
+
* out-cascade them without `!important` — an inline `background-image`
|
|
52
|
+
* could not be overridden from a stylesheet. The paper is the recipe's, a
|
|
53
|
+
* token: `var(--vf-white)` behind ink that is literal black, like every kit
|
|
54
|
+
* raster. Density and zoom re-encode nothing: the raster is keyed on system
|
|
55
|
+
* px, and the stated lengths are live against `--vf-scale`.
|
|
56
|
+
*
|
|
57
|
+
* Phase is anchored at the box's top-left — where the desktop, trough and
|
|
58
|
+
* swatch anchor theirs. Two same-pattern boxes meeting at an offset that is
|
|
59
|
+
* not a multiple of 8 show a phase seam; a port-anchored phase would be a
|
|
60
|
+
* contained follow-up, not a change here.
|
|
61
|
+
*/
|
|
62
|
+
export declare class PatternFillController implements ReactiveController {
|
|
63
|
+
#private;
|
|
64
|
+
constructor(host: ReactiveControllerHost & HTMLElement, opts: PatternFillOptions);
|
|
65
|
+
/** The raster's current box in system px (overdraw included), or null
|
|
66
|
+
* while nothing is painted. */
|
|
67
|
+
get size(): {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
} | null;
|
|
71
|
+
hostUpdated(): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The rules behind {@link PatternFillController}, for the box it paints:
|
|
75
|
+
* give the box the `vf-pattern-fill` class always, and `vf-patterned` while
|
|
76
|
+
* a pattern is resolved (the component's template knows).
|
|
77
|
+
*
|
|
78
|
+
* Painting: the raster the controller wrote, at the size it stated, once
|
|
79
|
+
* (`no-repeat` — the overdraw is the repeat), nearest-neighbor. The paper
|
|
80
|
+
* and the pixelation ride the `vf-patterned` state so an unpatterned box
|
|
81
|
+
* paints exactly nothing and inherits nothing new. `image-rendering`
|
|
82
|
+
* inherits, so the slot hands `auto` back to slotted content: a consumer's
|
|
83
|
+
* own `<img>` renders as it would anywhere else, and a kit element that
|
|
84
|
+
* wants nearest-neighbor (`vf-img`, a `vf-icon`) says so itself. A page
|
|
85
|
+
* that set `pixelated` on an ancestor gets `auto` inside a patterned box —
|
|
86
|
+
* its own declaration on the child still wins, as everywhere.
|
|
87
|
+
*
|
|
88
|
+
* Forced colors: the image goes, the paper is the remapped Canvas — the
|
|
89
|
+
* desktop's posture, a backdrop being decoration.
|
|
90
|
+
*/
|
|
91
|
+
export declare const vfPatternFill: CSSResult;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { sysLength as e, toSys as t } from "./scale.js";
|
|
2
|
+
import { patternHex as n, patternMotif as r } from "./patterns.js";
|
|
3
|
+
import { TileRasterCache as i } from "./tile-grid.js";
|
|
4
|
+
import { TrackWidthController as a } from "./track-width.js";
|
|
5
|
+
import { css as o } from "lit";
|
|
6
|
+
//#region src/pattern-fill.ts
|
|
7
|
+
var s = class {
|
|
8
|
+
#e;
|
|
9
|
+
#t;
|
|
10
|
+
#n = new i();
|
|
11
|
+
#r;
|
|
12
|
+
#i = null;
|
|
13
|
+
#a = "";
|
|
14
|
+
#o = "";
|
|
15
|
+
#s = null;
|
|
16
|
+
constructor(e, t) {
|
|
17
|
+
this.#e = e, this.#t = t, this.#r = new a(e, () => {
|
|
18
|
+
if (!t.getPattern()) return null;
|
|
19
|
+
let e = t.getSize?.();
|
|
20
|
+
return e == null || e.width == null || e.height == null ? t.getBox() : null;
|
|
21
|
+
}), e.addController(this);
|
|
22
|
+
}
|
|
23
|
+
get size() {
|
|
24
|
+
return this.#s;
|
|
25
|
+
}
|
|
26
|
+
hostUpdated() {
|
|
27
|
+
this.#c();
|
|
28
|
+
}
|
|
29
|
+
#c() {
|
|
30
|
+
let t = this.#t.getBox() ?? null;
|
|
31
|
+
t !== this.#i && (this.#u(), this.#i = t);
|
|
32
|
+
let i = this.#t.getPattern() ?? null;
|
|
33
|
+
if (!t || !i) {
|
|
34
|
+
this.#u();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let a = this.#t.getSize?.() ?? null, o = c(a?.width) ?? this.#l(this.#r.width), s = c(a?.height) ?? this.#l(this.#r.height);
|
|
38
|
+
if (!o || !s) {
|
|
39
|
+
this.#u();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let l = (e) => Math.ceil((e + 8) / 8) * 8, u = l(o), d = l(s), f = r(i), p = this.#n.for(f.width, f.height, f.rects, u, d, n(i)), m = `${e(u)} ${e(d)}`;
|
|
43
|
+
this.#s = {
|
|
44
|
+
width: u,
|
|
45
|
+
height: d
|
|
46
|
+
}, (p !== this.#a || m !== this.#o) && (this.#a = p, this.#o = m, t.style.setProperty("--_vf-pattern-image", p), t.style.setProperty("--_vf-pattern-size", m));
|
|
47
|
+
}
|
|
48
|
+
#l(e) {
|
|
49
|
+
return e > 0 ? t(e, this.#e) : 0;
|
|
50
|
+
}
|
|
51
|
+
#u() {
|
|
52
|
+
this.#s = null, !(!this.#a && !this.#o) && (this.#a = "", this.#o = "", this.#i?.style.removeProperty("--_vf-pattern-image"), this.#i?.style.removeProperty("--_vf-pattern-size"));
|
|
53
|
+
}
|
|
54
|
+
}, c = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.trunc(e) : null, l = o`
|
|
55
|
+
.vf-pattern-fill {
|
|
56
|
+
background-image: var(--_vf-pattern-image, none);
|
|
57
|
+
background-size: var(--_vf-pattern-size, auto);
|
|
58
|
+
background-repeat: no-repeat;
|
|
59
|
+
}
|
|
60
|
+
.vf-pattern-fill.vf-patterned {
|
|
61
|
+
background-color: var(--vf-white, #fff);
|
|
62
|
+
image-rendering: pixelated;
|
|
63
|
+
}
|
|
64
|
+
.vf-pattern-fill.vf-patterned > slot {
|
|
65
|
+
image-rendering: auto;
|
|
66
|
+
}
|
|
67
|
+
@media (forced-colors: active) {
|
|
68
|
+
.vf-pattern-fill {
|
|
69
|
+
background-image: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { s as PatternFillController, l as vfPatternFill };
|