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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { TileRect } from './styles/recipes/tile.js';
|
|
2
|
+
/**
|
|
3
|
+
* The standard Macintosh pattern set — the 38 fills of MacPaint's pattern
|
|
4
|
+
* bar and the System file's `PAT#` 0 — as 8-byte bitmaps, with the helpers
|
|
5
|
+
* that turn one into the art the kit's exact-fill machinery draws
|
|
6
|
+
* (src/pattern-fill.ts paints one as a box's background; src/tile-grid.ts
|
|
7
|
+
* is the raster mechanism under it).
|
|
8
|
+
*
|
|
9
|
+
* A {@link Pattern} is the QuickDraw type: eight rows, top row first, each a
|
|
10
|
+
* byte whose bit 7 is the leftmost pixel and whose set bits are ink. That is
|
|
11
|
+
* also what a `pattern` attribute spells as a custom value — sixteen hex
|
|
12
|
+
* digits, the way a PAT resource read in ResEdit — so the library, the
|
|
13
|
+
* attribute and the data model are one representation.
|
|
14
|
+
*
|
|
15
|
+
* Transcribed 2026-08-22 from a 2× capture of the tear-off pattern palette
|
|
16
|
+
* (a windoid over a 5×8 grid of 19×16 cells on a 20×17 pitch, the first two
|
|
17
|
+
* merged into the current-pattern well; native pixel (x, y) at image
|
|
18
|
+
* (2x+1, 2y+1), cell (c, r) at (5 + 20c, 15 + 17r)) and normalized to the
|
|
19
|
+
* palette window's port origin (5, 4) — the phase QuickDraw drew them at.
|
|
20
|
+
* Under it the three toolbox constants come out byte-for-byte (`gray` AA55,
|
|
21
|
+
* `ltGray` 8822, `dkGray` DD77), and so do the kit's own desktop dither,
|
|
22
|
+
* scroll trough and windoid dots, which are those three patterns. Designed
|
|
23
|
+
* at Apple for MacPaint and the System; stated here as data, the way
|
|
24
|
+
* `fonts/VF-*.glyphs.txt` states the strikes. The capture is not in the
|
|
25
|
+
* repo. docs/PATTERNS.md is the consumer table.
|
|
26
|
+
*/
|
|
27
|
+
export type Pattern = readonly [
|
|
28
|
+
number,
|
|
29
|
+
number,
|
|
30
|
+
number,
|
|
31
|
+
number,
|
|
32
|
+
number,
|
|
33
|
+
number,
|
|
34
|
+
number,
|
|
35
|
+
number
|
|
36
|
+
];
|
|
37
|
+
/** The library's names, in palette order. */
|
|
38
|
+
export type PatternName = 'black' | 'gray-50' | 'white' | 'gray-88' | 'gray-75' | 'gray-75-striped' | 'gray-75-diagonal' | 'dots' | 'pinpoint' | 'dots-sparse' | 'speckle' | 'gray-12' | 'gray-25' | 'stripes-vertical' | 'stripes-horizontal' | 'diagonal' | 'grid' | 'weave' | 'lines-vertical' | 'lines-horizontal' | 'diagonal-wide' | 'grid-wide' | 'zigzag' | 'arrows' | 'chevrons' | 'shingles' | 'dotted-grid' | 'birds' | 'waves' | 'bricks' | 'scales' | 'basket-weave' | 'lattice' | 'twigs' | 'hexagons' | 'pyramids' | 'mesh' | 'stones';
|
|
39
|
+
/**
|
|
40
|
+
* The 38 standard patterns, in palette order (row-major from the cell after
|
|
41
|
+
* the well — insertion order is the order). The ordered-dither ramp is named
|
|
42
|
+
* `gray-N` by ink percentage; everything else for what it reads as.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PATTERNS: Readonly<Record<PatternName, Pattern>>;
|
|
45
|
+
/** The names in palette order — a chooser's iteration order. */
|
|
46
|
+
export declare const PATTERN_NAMES: readonly PatternName[];
|
|
47
|
+
/** A pattern's side in system px — what a custom literal states. */
|
|
48
|
+
export declare const PATTERN_SIZE = 8;
|
|
49
|
+
/**
|
|
50
|
+
* The value a `pattern` attribute takes, resolved: a library name, or
|
|
51
|
+
* sixteen hex digits (two per row, top row first; whitespace between bytes
|
|
52
|
+
* and either case allowed — `"DD 77 DD 77 DD 77 DD 77"`). Anything else,
|
|
53
|
+
* including an empty string, is `null`: the caller paints nothing.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parsePattern(value: string | null | undefined): Pattern | null;
|
|
56
|
+
/** The attribute form of a pattern: sixteen upper-case hex digits, no spaces. */
|
|
57
|
+
export declare function patternHex(pattern: Pattern): string;
|
|
58
|
+
/**
|
|
59
|
+
* A pattern's art as the rect data the tile machinery takes
|
|
60
|
+
* (`tileRaster`, `tileImage` via `tileRects`): `width × height` is the cell
|
|
61
|
+
* the rects cover and tile at.
|
|
62
|
+
*/
|
|
63
|
+
export interface PatternMotif {
|
|
64
|
+
readonly width: number;
|
|
65
|
+
readonly height: number;
|
|
66
|
+
readonly rects: readonly TileRect[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A pattern's art on its **minimal** cell — the smallest period along each
|
|
70
|
+
* axis — as ink runs over a transparent ground, or over an opaque `paper`
|
|
71
|
+
* rect when one is given. This is how the kit's own surfaces state their
|
|
72
|
+
* dithers from the library: `gray-50` comes back as the 2×2 cell with two
|
|
73
|
+
* black pixels the desktop always had.
|
|
74
|
+
*/
|
|
75
|
+
export declare function patternMotif(pattern: Pattern, ink?: string, paper?: string): PatternMotif;
|
|
76
|
+
/**
|
|
77
|
+
* A pattern's art on the full 8×8 cell, as {@link patternMotif}'s rects —
|
|
78
|
+
* for a caller that wants the literal QuickDraw cell regardless of period.
|
|
79
|
+
*/
|
|
80
|
+
export declare function patternRects(pattern: Pattern, ink?: string, paper?: string): TileRect[];
|
package/dist/patterns.js
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
//#region src/patterns.ts
|
|
2
|
+
var e = {
|
|
3
|
+
black: [
|
|
4
|
+
255,
|
|
5
|
+
255,
|
|
6
|
+
255,
|
|
7
|
+
255,
|
|
8
|
+
255,
|
|
9
|
+
255,
|
|
10
|
+
255,
|
|
11
|
+
255
|
|
12
|
+
],
|
|
13
|
+
"gray-50": [
|
|
14
|
+
170,
|
|
15
|
+
85,
|
|
16
|
+
170,
|
|
17
|
+
85,
|
|
18
|
+
170,
|
|
19
|
+
85,
|
|
20
|
+
170,
|
|
21
|
+
85
|
|
22
|
+
],
|
|
23
|
+
white: [
|
|
24
|
+
0,
|
|
25
|
+
0,
|
|
26
|
+
0,
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
0,
|
|
30
|
+
0,
|
|
31
|
+
0
|
|
32
|
+
],
|
|
33
|
+
"gray-88": [
|
|
34
|
+
119,
|
|
35
|
+
255,
|
|
36
|
+
221,
|
|
37
|
+
255,
|
|
38
|
+
119,
|
|
39
|
+
255,
|
|
40
|
+
221,
|
|
41
|
+
255
|
|
42
|
+
],
|
|
43
|
+
"gray-75": [
|
|
44
|
+
221,
|
|
45
|
+
119,
|
|
46
|
+
221,
|
|
47
|
+
119,
|
|
48
|
+
221,
|
|
49
|
+
119,
|
|
50
|
+
221,
|
|
51
|
+
119
|
|
52
|
+
],
|
|
53
|
+
"gray-75-striped": [
|
|
54
|
+
85,
|
|
55
|
+
255,
|
|
56
|
+
85,
|
|
57
|
+
255,
|
|
58
|
+
85,
|
|
59
|
+
255,
|
|
60
|
+
85,
|
|
61
|
+
255
|
|
62
|
+
],
|
|
63
|
+
"gray-75-diagonal": [
|
|
64
|
+
187,
|
|
65
|
+
119,
|
|
66
|
+
238,
|
|
67
|
+
221,
|
|
68
|
+
187,
|
|
69
|
+
119,
|
|
70
|
+
238,
|
|
71
|
+
221
|
|
72
|
+
],
|
|
73
|
+
dots: [
|
|
74
|
+
170,
|
|
75
|
+
0,
|
|
76
|
+
170,
|
|
77
|
+
0,
|
|
78
|
+
170,
|
|
79
|
+
0,
|
|
80
|
+
170,
|
|
81
|
+
0
|
|
82
|
+
],
|
|
83
|
+
pinpoint: [
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
128,
|
|
87
|
+
0,
|
|
88
|
+
0,
|
|
89
|
+
0,
|
|
90
|
+
0,
|
|
91
|
+
0
|
|
92
|
+
],
|
|
93
|
+
"dots-sparse": [
|
|
94
|
+
8,
|
|
95
|
+
0,
|
|
96
|
+
128,
|
|
97
|
+
0,
|
|
98
|
+
8,
|
|
99
|
+
0,
|
|
100
|
+
128,
|
|
101
|
+
0
|
|
102
|
+
],
|
|
103
|
+
speckle: [
|
|
104
|
+
64,
|
|
105
|
+
4,
|
|
106
|
+
128,
|
|
107
|
+
16,
|
|
108
|
+
2,
|
|
109
|
+
32,
|
|
110
|
+
1,
|
|
111
|
+
8
|
|
112
|
+
],
|
|
113
|
+
"gray-12": [
|
|
114
|
+
34,
|
|
115
|
+
0,
|
|
116
|
+
136,
|
|
117
|
+
0,
|
|
118
|
+
34,
|
|
119
|
+
0,
|
|
120
|
+
136,
|
|
121
|
+
0
|
|
122
|
+
],
|
|
123
|
+
"gray-25": [
|
|
124
|
+
136,
|
|
125
|
+
34,
|
|
126
|
+
136,
|
|
127
|
+
34,
|
|
128
|
+
136,
|
|
129
|
+
34,
|
|
130
|
+
136,
|
|
131
|
+
34
|
|
132
|
+
],
|
|
133
|
+
"stripes-vertical": [
|
|
134
|
+
170,
|
|
135
|
+
170,
|
|
136
|
+
170,
|
|
137
|
+
170,
|
|
138
|
+
170,
|
|
139
|
+
170,
|
|
140
|
+
170,
|
|
141
|
+
170
|
|
142
|
+
],
|
|
143
|
+
"stripes-horizontal": [
|
|
144
|
+
255,
|
|
145
|
+
0,
|
|
146
|
+
255,
|
|
147
|
+
0,
|
|
148
|
+
255,
|
|
149
|
+
0,
|
|
150
|
+
255,
|
|
151
|
+
0
|
|
152
|
+
],
|
|
153
|
+
diagonal: [
|
|
154
|
+
68,
|
|
155
|
+
136,
|
|
156
|
+
17,
|
|
157
|
+
34,
|
|
158
|
+
68,
|
|
159
|
+
136,
|
|
160
|
+
17,
|
|
161
|
+
34
|
|
162
|
+
],
|
|
163
|
+
grid: [
|
|
164
|
+
136,
|
|
165
|
+
136,
|
|
166
|
+
255,
|
|
167
|
+
136,
|
|
168
|
+
136,
|
|
169
|
+
136,
|
|
170
|
+
255,
|
|
171
|
+
136
|
|
172
|
+
],
|
|
173
|
+
weave: [
|
|
174
|
+
12,
|
|
175
|
+
141,
|
|
176
|
+
177,
|
|
177
|
+
48,
|
|
178
|
+
3,
|
|
179
|
+
27,
|
|
180
|
+
216,
|
|
181
|
+
192
|
|
182
|
+
],
|
|
183
|
+
"lines-vertical": [
|
|
184
|
+
136,
|
|
185
|
+
136,
|
|
186
|
+
136,
|
|
187
|
+
136,
|
|
188
|
+
136,
|
|
189
|
+
136,
|
|
190
|
+
136,
|
|
191
|
+
136
|
|
192
|
+
],
|
|
193
|
+
"lines-horizontal": [
|
|
194
|
+
0,
|
|
195
|
+
0,
|
|
196
|
+
255,
|
|
197
|
+
0,
|
|
198
|
+
0,
|
|
199
|
+
0,
|
|
200
|
+
255,
|
|
201
|
+
0
|
|
202
|
+
],
|
|
203
|
+
"diagonal-wide": [
|
|
204
|
+
64,
|
|
205
|
+
128,
|
|
206
|
+
1,
|
|
207
|
+
2,
|
|
208
|
+
4,
|
|
209
|
+
8,
|
|
210
|
+
16,
|
|
211
|
+
32
|
|
212
|
+
],
|
|
213
|
+
"grid-wide": [
|
|
214
|
+
128,
|
|
215
|
+
128,
|
|
216
|
+
255,
|
|
217
|
+
128,
|
|
218
|
+
128,
|
|
219
|
+
128,
|
|
220
|
+
128,
|
|
221
|
+
128
|
|
222
|
+
],
|
|
223
|
+
zigzag: [
|
|
224
|
+
8,
|
|
225
|
+
0,
|
|
226
|
+
128,
|
|
227
|
+
64,
|
|
228
|
+
32,
|
|
229
|
+
0,
|
|
230
|
+
2,
|
|
231
|
+
4
|
|
232
|
+
],
|
|
233
|
+
arrows: [
|
|
234
|
+
5,
|
|
235
|
+
2,
|
|
236
|
+
32,
|
|
237
|
+
80,
|
|
238
|
+
136,
|
|
239
|
+
136,
|
|
240
|
+
136,
|
|
241
|
+
136
|
|
242
|
+
],
|
|
243
|
+
chevrons: [
|
|
244
|
+
170,
|
|
245
|
+
0,
|
|
246
|
+
136,
|
|
247
|
+
20,
|
|
248
|
+
34,
|
|
249
|
+
65,
|
|
250
|
+
136,
|
|
251
|
+
0
|
|
252
|
+
],
|
|
253
|
+
shingles: [
|
|
254
|
+
4,
|
|
255
|
+
8,
|
|
256
|
+
16,
|
|
257
|
+
32,
|
|
258
|
+
84,
|
|
259
|
+
170,
|
|
260
|
+
255,
|
|
261
|
+
2
|
|
262
|
+
],
|
|
263
|
+
"dotted-grid": [
|
|
264
|
+
128,
|
|
265
|
+
0,
|
|
266
|
+
170,
|
|
267
|
+
0,
|
|
268
|
+
128,
|
|
269
|
+
0,
|
|
270
|
+
136,
|
|
271
|
+
0
|
|
272
|
+
],
|
|
273
|
+
birds: [
|
|
274
|
+
0,
|
|
275
|
+
0,
|
|
276
|
+
64,
|
|
277
|
+
160,
|
|
278
|
+
0,
|
|
279
|
+
0,
|
|
280
|
+
4,
|
|
281
|
+
10
|
|
282
|
+
],
|
|
283
|
+
waves: [
|
|
284
|
+
1,
|
|
285
|
+
1,
|
|
286
|
+
3,
|
|
287
|
+
132,
|
|
288
|
+
72,
|
|
289
|
+
48,
|
|
290
|
+
12,
|
|
291
|
+
2
|
|
292
|
+
],
|
|
293
|
+
bricks: [
|
|
294
|
+
8,
|
|
295
|
+
8,
|
|
296
|
+
255,
|
|
297
|
+
128,
|
|
298
|
+
128,
|
|
299
|
+
128,
|
|
300
|
+
255,
|
|
301
|
+
8
|
|
302
|
+
],
|
|
303
|
+
scales: [
|
|
304
|
+
2,
|
|
305
|
+
4,
|
|
306
|
+
8,
|
|
307
|
+
28,
|
|
308
|
+
34,
|
|
309
|
+
193,
|
|
310
|
+
128,
|
|
311
|
+
1
|
|
312
|
+
],
|
|
313
|
+
"basket-weave": [
|
|
314
|
+
176,
|
|
315
|
+
176,
|
|
316
|
+
191,
|
|
317
|
+
0,
|
|
318
|
+
191,
|
|
319
|
+
191,
|
|
320
|
+
176,
|
|
321
|
+
176
|
|
322
|
+
],
|
|
323
|
+
lattice: [
|
|
324
|
+
1,
|
|
325
|
+
1,
|
|
326
|
+
130,
|
|
327
|
+
68,
|
|
328
|
+
57,
|
|
329
|
+
68,
|
|
330
|
+
130,
|
|
331
|
+
1
|
|
332
|
+
],
|
|
333
|
+
twigs: [
|
|
334
|
+
16,
|
|
335
|
+
16,
|
|
336
|
+
85,
|
|
337
|
+
130,
|
|
338
|
+
1,
|
|
339
|
+
1,
|
|
340
|
+
85,
|
|
341
|
+
40
|
|
342
|
+
],
|
|
343
|
+
hexagons: [
|
|
344
|
+
20,
|
|
345
|
+
227,
|
|
346
|
+
128,
|
|
347
|
+
128,
|
|
348
|
+
65,
|
|
349
|
+
62,
|
|
350
|
+
8,
|
|
351
|
+
8
|
|
352
|
+
],
|
|
353
|
+
pyramids: [
|
|
354
|
+
34,
|
|
355
|
+
113,
|
|
356
|
+
248,
|
|
357
|
+
116,
|
|
358
|
+
34,
|
|
359
|
+
71,
|
|
360
|
+
143,
|
|
361
|
+
23
|
|
362
|
+
],
|
|
363
|
+
mesh: [
|
|
364
|
+
20,
|
|
365
|
+
8,
|
|
366
|
+
0,
|
|
367
|
+
8,
|
|
368
|
+
20,
|
|
369
|
+
42,
|
|
370
|
+
85,
|
|
371
|
+
42
|
|
372
|
+
],
|
|
373
|
+
stones: [
|
|
374
|
+
248,
|
|
375
|
+
248,
|
|
376
|
+
119,
|
|
377
|
+
137,
|
|
378
|
+
143,
|
|
379
|
+
143,
|
|
380
|
+
119,
|
|
381
|
+
152
|
|
382
|
+
]
|
|
383
|
+
}, t = Object.keys(e), n = 8;
|
|
384
|
+
function r(t) {
|
|
385
|
+
if (t == null) return null;
|
|
386
|
+
let n = t.trim();
|
|
387
|
+
if (n === "") return null;
|
|
388
|
+
if (Object.prototype.hasOwnProperty.call(e, n)) return e[n];
|
|
389
|
+
let r = n.replace(/\s+/g, "");
|
|
390
|
+
if (!/^[0-9a-f]{16}$/i.test(r)) return null;
|
|
391
|
+
let i = [];
|
|
392
|
+
for (let e = 0; e < 8; e++) i.push(parseInt(r.slice(2 * e, 2 * e + 2), 16));
|
|
393
|
+
return i;
|
|
394
|
+
}
|
|
395
|
+
function i(e) {
|
|
396
|
+
return e.map((e) => e.toString(16).padStart(2, "0").toUpperCase()).join("");
|
|
397
|
+
}
|
|
398
|
+
var a = (e, t, n) => !!((e[n % 8] ?? 0) & 128 >> t % 8);
|
|
399
|
+
function o(e) {
|
|
400
|
+
let t = 8, n = 8;
|
|
401
|
+
for (let n of [
|
|
402
|
+
1,
|
|
403
|
+
2,
|
|
404
|
+
4
|
|
405
|
+
]) {
|
|
406
|
+
let r = !0;
|
|
407
|
+
for (let t = 0; t < 8 && r; t++) for (let i = 0; i < 8 - n; i++) if (a(e, i, t) !== a(e, i + n, t)) {
|
|
408
|
+
r = !1;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
if (r) {
|
|
412
|
+
t = n;
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
for (let t of [
|
|
417
|
+
1,
|
|
418
|
+
2,
|
|
419
|
+
4
|
|
420
|
+
]) {
|
|
421
|
+
let r = !0;
|
|
422
|
+
for (let n = 0; n < 8 - t; n++) if (e[n] !== e[n + t]) {
|
|
423
|
+
r = !1;
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
if (r) {
|
|
427
|
+
n = t;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
x: t,
|
|
433
|
+
y: n
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function s(e, t, n, r, i) {
|
|
437
|
+
let o = [];
|
|
438
|
+
i !== void 0 && o.push([
|
|
439
|
+
0,
|
|
440
|
+
0,
|
|
441
|
+
t,
|
|
442
|
+
n,
|
|
443
|
+
i
|
|
444
|
+
]);
|
|
445
|
+
for (let i = 0; i < n; i++) {
|
|
446
|
+
let n = 0;
|
|
447
|
+
for (; n < t;) {
|
|
448
|
+
if (!a(e, n, i)) {
|
|
449
|
+
n++;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
let s = 1;
|
|
453
|
+
for (; n + s < t && a(e, n + s, i);) s++;
|
|
454
|
+
o.push([
|
|
455
|
+
n,
|
|
456
|
+
i,
|
|
457
|
+
s,
|
|
458
|
+
1,
|
|
459
|
+
r
|
|
460
|
+
]), n += s;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return o;
|
|
464
|
+
}
|
|
465
|
+
function c(e, t = "#000000", n) {
|
|
466
|
+
let { x: r, y: i } = o(e);
|
|
467
|
+
return {
|
|
468
|
+
width: r,
|
|
469
|
+
height: i,
|
|
470
|
+
rects: s(e, r, i, t, n)
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function l(e, t = "#000000", n) {
|
|
474
|
+
return s(e, 8, 8, t, n);
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
export { e as PATTERNS, t as PATTERN_NAMES, n as PATTERN_SIZE, r as parsePattern, i as patternHex, c as patternMotif, l as patternRects };
|
package/dist/scroll-rail.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { effectiveScale as e, sysLength as t } from "./scale.js";
|
|
2
|
-
import {
|
|
3
|
-
import { TileRasterCache as
|
|
2
|
+
import { TROUGH_MOTIF_X as n, TROUGH_MOTIF_Y as r, TROUGH_RECTS as i } from "./styles/recipes/scroll-rail.js";
|
|
3
|
+
import { TileRasterCache as a } from "./tile-grid.js";
|
|
4
4
|
import "./motion.js";
|
|
5
|
-
import { SCROLL_ARROW_DOWN as
|
|
6
|
-
import { html as
|
|
5
|
+
import { SCROLL_ARROW_DOWN as o, SCROLL_ARROW_DOWN_FILL as s, SCROLL_ARROW_LEFT as c, SCROLL_ARROW_LEFT_FILL as l, SCROLL_ARROW_RIGHT as u, SCROLL_ARROW_RIGHT_FILL as d, SCROLL_ARROW_UP as f, SCROLL_ARROW_UP_FILL as p } from "./glyphs.js";
|
|
6
|
+
import { html as m } from "lit";
|
|
7
7
|
//#region src/scroll-rail.ts
|
|
8
|
-
var
|
|
8
|
+
var h = 16, g = 16, _ = 14, v = 66, y = class {
|
|
9
9
|
constructor(t, n) {
|
|
10
10
|
this.host = t, this.opts = n, this.scroller = null, this.press = null, this.troughCache = {
|
|
11
|
-
vertical: new
|
|
12
|
-
horizontal: new
|
|
11
|
+
vertical: new a(),
|
|
12
|
+
horizontal: new a()
|
|
13
13
|
}, this.onScroll = () => this.sync(), this.onPointerDown = (t) => {
|
|
14
14
|
if (t.button !== 0 || this.press !== null) return;
|
|
15
15
|
let n = t.currentTarget, r = this.opts.getScroll();
|
|
16
16
|
if (!r) return;
|
|
17
|
-
let i =
|
|
17
|
+
let i = b(n), a = i === "vertical" ? "data-overflow-y" : "data-overflow-x";
|
|
18
18
|
if (r.getAttribute(a) === "false" || r.hasAttribute("data-window-inactive") || n.getAttribute("data-degenerate") === "rail") return;
|
|
19
19
|
let o = t.target, s = i === "vertical" ? t.clientY : t.clientX, c = e(this.host) || 1, l = o.closest(".vf-rail-thumb"), u = o.closest(".vf-rail-button--decrement"), d = o.closest(".vf-rail-button--increment");
|
|
20
20
|
if (l) {
|
|
@@ -30,7 +30,7 @@ var p = 16, m = 16, h = 14, g = 66, _ = class {
|
|
|
30
30
|
button: null,
|
|
31
31
|
startCoord: s,
|
|
32
32
|
startScroll: i === "vertical" ? r.scrollTop : r.scrollLeft,
|
|
33
|
-
travelCss: o -
|
|
33
|
+
travelCss: o - g * c,
|
|
34
34
|
lastCoord: s
|
|
35
35
|
};
|
|
36
36
|
} else if (u || d) {
|
|
@@ -98,17 +98,17 @@ var p = 16, m = 16, h = 14, g = 66, _ = class {
|
|
|
98
98
|
let e = this.scroller ?? this.opts.getScroll(), t = this.host.renderRoot;
|
|
99
99
|
if (!(!e || !t)) for (let n of t.querySelectorAll(".vf-rail")) this.syncRail(n, e);
|
|
100
100
|
}
|
|
101
|
-
syncRail(
|
|
102
|
-
let
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
105
|
-
if (
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
let e = Math.ceil((
|
|
111
|
-
|
|
101
|
+
syncRail(a, o) {
|
|
102
|
+
let s = b(a), c = a.querySelector(".vf-rail-track"), l = a.querySelector(".vf-rail-thumb");
|
|
103
|
+
if (!c || !l) return;
|
|
104
|
+
let u = e(this.host) || 1, d = c.getBoundingClientRect(), f = (s === "vertical" ? d.height : d.width) / u, p = f < 1 ? "rail" : f < g ? "thumb" : null;
|
|
105
|
+
if (p ? a.setAttribute("data-degenerate", p) : a.removeAttribute("data-degenerate"), p === "rail") return;
|
|
106
|
+
let m = this.scrollRange(o, s), h = s === "vertical" ? o.scrollTop : o.scrollLeft, v = f - g, y = m > 0 && v > 0 ? Math.max(0, Math.min(Math.floor(v), Math.round(h / m * v))) : 0;
|
|
107
|
+
l.style.translate = s === "vertical" ? `0 ${t(y)}` : `${t(y)} 0`;
|
|
108
|
+
let x = a.querySelector(".vf-rail-trough-art");
|
|
109
|
+
if (x) {
|
|
110
|
+
let e = Math.ceil((f + (s === "vertical" ? r : n)) / (s === "vertical" ? r : n)) * (s === "vertical" ? r : n), a = s === "vertical" ? _ : e, o = s === "vertical" ? e : _;
|
|
111
|
+
x.style.width = t(a), x.style.height = t(o), x.style.backgroundImage = this.troughCache[s].for(n, r, i, a, o);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
scrollRange(e, t) {
|
|
@@ -117,13 +117,13 @@ var p = 16, m = 16, h = 14, g = 66, _ = class {
|
|
|
117
117
|
stepBy(t, n) {
|
|
118
118
|
let r = this.opts.getScroll();
|
|
119
119
|
if (!r) return;
|
|
120
|
-
let i = t *
|
|
120
|
+
let i = t * h * (e(this.host) || 1);
|
|
121
121
|
n === "vertical" ? r.scrollTop += i : r.scrollLeft += i;
|
|
122
122
|
}
|
|
123
123
|
pageBy(t, n) {
|
|
124
124
|
let r = this.opts.getScroll();
|
|
125
125
|
if (!r) return;
|
|
126
|
-
let i =
|
|
126
|
+
let i = h * (e(this.host) || 1), a = n === "vertical" ? r.clientHeight : r.clientWidth, o = Math.max(i, a - i);
|
|
127
127
|
n === "vertical" ? r.scrollTop += t * o : r.scrollLeft += t * o;
|
|
128
128
|
}
|
|
129
129
|
pageTowardPointer() {
|
|
@@ -138,13 +138,13 @@ var p = 16, m = 16, h = 14, g = 66, _ = class {
|
|
|
138
138
|
}
|
|
139
139
|
armRepeat(e) {
|
|
140
140
|
this.clearRepeat(), this.holdTimer = window.setTimeout(() => {
|
|
141
|
-
this.repeatTimer = window.setInterval(e,
|
|
141
|
+
this.repeatTimer = window.setInterval(e, v);
|
|
142
142
|
}, 200);
|
|
143
143
|
}
|
|
144
144
|
clearRepeat() {
|
|
145
145
|
this.holdTimer !== void 0 && window.clearTimeout(this.holdTimer), this.repeatTimer !== void 0 && window.clearInterval(this.repeatTimer), this.holdTimer = void 0, this.repeatTimer = void 0;
|
|
146
146
|
}
|
|
147
|
-
},
|
|
147
|
+
}, b = (e) => e.classList.contains("vf-rail--horizontal") ? "horizontal" : "vertical", x = (e, t) => m`<svg
|
|
148
148
|
class="vf-rail-arrow vf-rail-arrow--${t}"
|
|
149
149
|
viewBox="1 1 14 14"
|
|
150
150
|
fill="currentColor"
|
|
@@ -153,19 +153,19 @@ var p = 16, m = 16, h = 14, g = 66, _ = class {
|
|
|
153
153
|
>
|
|
154
154
|
<path d=${e.d}></path>
|
|
155
155
|
</svg>`;
|
|
156
|
-
function
|
|
157
|
-
let [n, r,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
i,
|
|
161
|
-
a
|
|
162
|
-
] : [
|
|
156
|
+
function S(e, t) {
|
|
157
|
+
let [n, r, i, a] = t === "vertical" ? [
|
|
158
|
+
f,
|
|
159
|
+
p,
|
|
163
160
|
o,
|
|
164
|
-
s
|
|
161
|
+
s
|
|
162
|
+
] : [
|
|
165
163
|
c,
|
|
166
|
-
l
|
|
164
|
+
l,
|
|
165
|
+
u,
|
|
166
|
+
d
|
|
167
167
|
];
|
|
168
|
-
return
|
|
168
|
+
return m`
|
|
169
169
|
<div
|
|
170
170
|
class="vf-rail vf-rail--${t}"
|
|
171
171
|
aria-hidden="true"
|
|
@@ -176,7 +176,7 @@ function b(e, t) {
|
|
|
176
176
|
@lostpointercapture=${e.onPointerUp}
|
|
177
177
|
>
|
|
178
178
|
<div class="vf-rail-button vf-rail-button--decrement">
|
|
179
|
-
${
|
|
179
|
+
${x(n, "rest")}${x(r, "fill")}
|
|
180
180
|
</div>
|
|
181
181
|
<div class="vf-rail-track">
|
|
182
182
|
<div class="vf-rail-trough">
|
|
@@ -185,10 +185,10 @@ function b(e, t) {
|
|
|
185
185
|
<div class="vf-rail-thumb"></div>
|
|
186
186
|
</div>
|
|
187
187
|
<div class="vf-rail-button vf-rail-button--increment">
|
|
188
|
-
${
|
|
188
|
+
${x(i, "rest")}${x(a, "fill")}
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
|
191
191
|
`;
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
|
-
export {
|
|
194
|
+
export { y as ScrollRailController, S as renderScrollRail };
|
package/dist/styles/base.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export { vfStaticText } from './recipes/static-text.js';
|
|
|
29
29
|
export { vfDots, vfStripes } from './recipes/pattern.js';
|
|
30
30
|
export { vfHardShadowDecls } from './recipes/shadow.js';
|
|
31
31
|
export { vfChromeFrame, vfModalFrame, vfPanel } from './recipes/surface.js';
|
|
32
|
+
export { RULE_EDGES, parseRule, ruleClasses, vfRule } from './recipes/rule.js';
|
|
33
|
+
export type { RuleEdge } from './recipes/rule.js';
|
|
32
34
|
export { vfTitleBar, vfWindowWidgets } from './recipes/title-bar.js';
|
|
33
35
|
export { vfFocus, vfFocusRing, vfFocusUnderline } from './recipes/focus.js';
|
|
34
36
|
export { vfToggle } from './recipes/toggle.js';
|