@monospaced/set-core 0.26.0 → 0.28.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/dist/components/alert/alert.d.ts +3 -3
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/avatar/avatar.d.ts +3 -3
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/badge/badge.d.ts +2 -2
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/banner/banner.d.ts +2 -2
- package/dist/components/banner/banner.d.ts.map +1 -1
- package/dist/components/blockquote/blockquote.d.ts +3 -3
- package/dist/components/blockquote/blockquote.d.ts.map +1 -1
- package/dist/components/box/box.d.ts +3 -3
- package/dist/components/box/box.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +3 -3
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +4 -4
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/container/container.d.ts +2 -2
- package/dist/components/container/container.d.ts.map +1 -1
- package/dist/components/details/details.d.ts +3 -3
- package/dist/components/details/details.d.ts.map +1 -1
- package/dist/components/dither/dither.d.ts +3 -3
- package/dist/components/dither/dither.d.ts.map +1 -1
- package/dist/components/divider/divider.d.ts +2 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/expander/expander.d.ts +2 -2
- package/dist/components/expander/expander.d.ts.map +1 -1
- package/dist/components/fieldset/fieldset.d.ts +3 -3
- package/dist/components/fieldset/fieldset.d.ts.map +1 -1
- package/dist/components/figure/figure.d.ts +3 -3
- package/dist/components/figure/figure.d.ts.map +1 -1
- package/dist/components/grid/grid.d.ts +3 -3
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/heading/heading.d.ts +3 -3
- package/dist/components/heading/heading.d.ts.map +1 -1
- package/dist/components/icon/icon.d.ts +2 -2
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/image/image.d.ts +3 -3
- package/dist/components/image/image.d.ts.map +1 -1
- package/dist/components/inline/inline.d.ts +3 -3
- package/dist/components/inline/inline.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +3 -3
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/lightswitch/lightswitch.d.ts +2 -2
- package/dist/components/lightswitch/lightswitch.d.ts.map +1 -1
- package/dist/components/link/link.d.ts +2 -2
- package/dist/components/link/link.d.ts.map +1 -1
- package/dist/components/logo/logo.d.ts +2 -2
- package/dist/components/logo/logo.d.ts.map +1 -1
- package/dist/components/logo/logos-animated.d.ts +1 -1
- package/dist/components/logo/logos-animated.d.ts.map +1 -1
- package/dist/components/menu/menu.d.ts +5 -5
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/nav/nav.d.ts.map +1 -1
- package/dist/components/page/page.d.ts +4 -4
- package/dist/components/page/page.d.ts.map +1 -1
- package/dist/components/pattern/pattern.d.ts +3 -3
- package/dist/components/pattern/pattern.d.ts.map +1 -1
- package/dist/components/poster/poster.d.ts +5 -5
- package/dist/components/poster/poster.d.ts.map +1 -1
- package/dist/components/prose/prose.d.ts +3 -3
- package/dist/components/prose/prose.d.ts.map +1 -1
- package/dist/components/radios/radios.d.ts +3 -3
- package/dist/components/radios/radios.d.ts.map +1 -1
- package/dist/components/range/range.d.ts +3 -3
- package/dist/components/range/range.d.ts.map +1 -1
- package/dist/components/root/root.d.ts +2 -2
- package/dist/components/root/root.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar.d.ts +4 -4
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/spinner/spinner.d.ts +2 -2
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/stack/stack.d.ts +2 -2
- package/dist/components/stack/stack.d.ts.map +1 -1
- package/dist/components/surface/surface.d.ts +3 -3
- package/dist/components/surface/surface.d.ts.map +1 -1
- package/dist/components/switch/switch.d.ts +3 -3
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/text/text.d.ts +3 -3
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/textarea/textarea.d.ts +3 -3
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/video/video.d.ts +2 -2
- package/dist/components/video/video.d.ts.map +1 -1
- package/dist/core-mnsp.css +1 -1
- package/dist/core-wrfr.css +1 -1
- package/dist/core.css +1 -1
- package/dist/helpers/scheme.d.ts +11 -0
- package/dist/helpers/scheme.d.ts.map +1 -0
- package/dist/index.d.ts +51 -47
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +576 -332
- package/dist/index.js.map +1 -1
- package/dist/runtime/canvas.d.ts +41 -0
- package/dist/runtime/canvas.d.ts.map +1 -0
- package/dist/runtime/dither.d.ts +68 -0
- package/dist/runtime/dither.d.ts.map +1 -0
- package/dist/runtime/easing.d.ts +13 -0
- package/dist/runtime/easing.d.ts.map +1 -0
- package/dist/runtime/frames.d.ts +22 -0
- package/dist/runtime/frames.d.ts.map +1 -0
- package/dist/runtime/tokens.d.ts +86 -0
- package/dist/runtime/tokens.d.ts.map +1 -0
- package/package.json +12 -7
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/test/spec.d.ts +0 -14
- package/dist/test/spec.d.ts.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas sizing at device resolution: one canvas pixel to one device pixel,
|
|
3
|
+
* so pixel graphics and dithers stay crisp at any size and pixel ratio.
|
|
4
|
+
*/
|
|
5
|
+
export interface SetCanvasSize {
|
|
6
|
+
/** The pixel buffer's height. */
|
|
7
|
+
height: number;
|
|
8
|
+
/** Canvas pixels per CSS pixel: the device pixel ratio, or less past `maxWidth`. */
|
|
9
|
+
ratio: number;
|
|
10
|
+
/** The pixel buffer's width. */
|
|
11
|
+
width: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SetCanvasSizeOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Width over height. Sets the buffer's height from its width, so the
|
|
16
|
+
* picture keeps an exact ratio; without it, the height is measured too.
|
|
17
|
+
*/
|
|
18
|
+
aspectRatio?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The widest buffer to draw, in pixels. Past it the ratio drops to a whole
|
|
21
|
+
* number of canvas pixels per CSS pixel (never below 1), so cells stay
|
|
22
|
+
* whole. @default 4096
|
|
23
|
+
*/
|
|
24
|
+
maxWidth?: number;
|
|
25
|
+
/** Called after the buffer is resized: redraw here. */
|
|
26
|
+
onResize: (size: SetCanvasSize) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Sizes a canvas's pixel buffer to the device pixels it covers, now and
|
|
30
|
+
* whenever its box or the pixel ratio changes, and calls back to redraw.
|
|
31
|
+
*
|
|
32
|
+
* At the display's own ratio it uses the exact device-pixel size the browser
|
|
33
|
+
* reports, so no canvas pixel straddles two device pixels. Style the canvas's
|
|
34
|
+
* box with CSS; this sets only `width` and `height`, its pixel buffer.
|
|
35
|
+
*
|
|
36
|
+
* @param canvas - The canvas to size.
|
|
37
|
+
* @param options - The aspect ratio, maximum width and resize callback.
|
|
38
|
+
* @returns A function that stops sizing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function sizeSetCanvas(canvas: HTMLCanvasElement, { aspectRatio, maxWidth, onResize }: SetCanvasSizeOptions): () => void;
|
|
41
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/runtime/canvas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,EACzB,EAAE,WAAW,EAAE,QAAe,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAC/D,MAAM,IAAI,CAqCZ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordered dither for canvas: tone as a pattern of whole square cells, the
|
|
3
|
+
* third layer after the Dither component and the dither tokens.
|
|
4
|
+
*
|
|
5
|
+
* Draw it on a canvas whose pixel buffer matches the device pixels it covers
|
|
6
|
+
* (see `sizeSetCanvas`), with cells a whole number of those pixels. Then no
|
|
7
|
+
* cell is ever split or resampled, at any size or pixel ratio, without
|
|
8
|
+
* `image-rendering: pixelated`, which only hides an upscale and leaves cells
|
|
9
|
+
* uneven at fractional ratios.
|
|
10
|
+
*/
|
|
11
|
+
/** The side of a Bayer matrix: 2, 4 or 8, for 4, 16 or 64 tones. */
|
|
12
|
+
export type SetBayerSize = 2 | 4 | 8;
|
|
13
|
+
/** A 2D context that can make patterns: on screen or offscreen. */
|
|
14
|
+
export type SetDitherContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
15
|
+
export interface SetDitherOptions {
|
|
16
|
+
/** The side of each cell, in canvas pixels. A whole number. @default 1 */
|
|
17
|
+
cell?: number;
|
|
18
|
+
/** The fill of the cells that are on; the rest stay clear. */
|
|
19
|
+
color: string;
|
|
20
|
+
/** The Bayer matrix's side. @default 4 */
|
|
21
|
+
size?: SetBayerSize;
|
|
22
|
+
/** Share of cells on, from 0 (none) to 1 (all). */
|
|
23
|
+
tone: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A Bayer matrix as thresholds from 0 to 1, row by row: a cell is on where
|
|
27
|
+
* the tone is above its threshold. Tones nest, so a denser tone keeps every
|
|
28
|
+
* cell a sparser one has.
|
|
29
|
+
*
|
|
30
|
+
* @param size - The matrix's side. @default 4
|
|
31
|
+
*/
|
|
32
|
+
export declare function getSetBayerMatrix(size?: SetBayerSize): number[];
|
|
33
|
+
/**
|
|
34
|
+
* The cells of one tile that a tone switches on, as `[column, row]` pairs:
|
|
35
|
+
* for drawing a dither cell by cell, such as into pixel art.
|
|
36
|
+
*
|
|
37
|
+
* @param tone - Share of cells on, from 0 to 1.
|
|
38
|
+
* @param size - The matrix's side. @default 4
|
|
39
|
+
*/
|
|
40
|
+
export declare function getSetDitherCells(tone: number, size?: SetBayerSize): Array<[number, number]>;
|
|
41
|
+
/**
|
|
42
|
+
* A repeating dither tile as a canvas pattern, `size` × `size` cells.
|
|
43
|
+
*
|
|
44
|
+
* The pattern repeats from the canvas origin. To line a dither up with a
|
|
45
|
+
* shape, so its edges don't cut a cell, use `fillSetDither`, or move the
|
|
46
|
+
* pattern with its `setTransform`.
|
|
47
|
+
*
|
|
48
|
+
* @param context - The context the pattern is for.
|
|
49
|
+
* @param options - Tone, color, cell size and matrix size.
|
|
50
|
+
* @returns The pattern, or null if the context can't make one.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createSetDitherPattern(context: SetDitherContext, { cell, color, size, tone }: SetDitherOptions): CanvasPattern | null;
|
|
53
|
+
/**
|
|
54
|
+
* Fills a rectangle with a dither, its tiles counted from the rectangle's
|
|
55
|
+
* own corner (or `origin`), so the pattern sits the same way in every shape.
|
|
56
|
+
*
|
|
57
|
+
* @param context - The context to draw on.
|
|
58
|
+
* @param x - The rectangle's left edge, in canvas pixels.
|
|
59
|
+
* @param y - The rectangle's top edge.
|
|
60
|
+
* @param width - The rectangle's width.
|
|
61
|
+
* @param height - The rectangle's height.
|
|
62
|
+
* @param options - Tone, color, cell and matrix size, and an optional
|
|
63
|
+
* `origin` to count the tiles from instead of the corner.
|
|
64
|
+
*/
|
|
65
|
+
export declare function fillSetDither(context: SetDitherContext, x: number, y: number, width: number, height: number, options: SetDitherOptions & {
|
|
66
|
+
origin?: [number, number];
|
|
67
|
+
}): void;
|
|
68
|
+
//# sourceMappingURL=dither.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dither.d.ts","sourceRoot":"","sources":["../../src/runtime/dither.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAErC,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GAC1B,wBAAwB,GAAG,iCAAiC,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AA4BD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,YAAgB,GAAG,MAAM,EAAE,CAGlE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,YAAgB,GACrB,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAMzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,gBAAgB,EACzB,EAAE,IAAQ,EAAE,KAAK,EAAE,IAAQ,EAAE,IAAI,EAAE,EAAE,gBAAgB,GACpD,aAAa,GAAG,IAAI,CAWtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACxD,IAAI,CAUN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS timing functions as progress functions, for `resolveSetEasing`: the
|
|
3
|
+
* computed value of `transition-timing-function` in, `(time) => progress`
|
|
4
|
+
* out, over 0 to 1.
|
|
5
|
+
*/
|
|
6
|
+
/** Progress for a time, both from 0 to 1. */
|
|
7
|
+
export type SetEasing = (time: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* A progress function for a computed timing function, or undefined for one
|
|
10
|
+
* it can't follow, such as `linear()` with stops.
|
|
11
|
+
*/
|
|
12
|
+
export declare const easingFrom: (value: string) => SetEasing | undefined;
|
|
13
|
+
//# sourceMappingURL=easing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easing.d.ts","sourceRoot":"","sources":["../../src/runtime/easing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAyDjD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,SAAS,GAAG,SA0BtD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SetFramesOptions {
|
|
2
|
+
/** Called when the frame changes: draw frame `frame` here. */
|
|
3
|
+
onFrame: (frame: number) => void;
|
|
4
|
+
/** Milliseconds per frame, e.g. from `resolveSetTime`. */
|
|
5
|
+
period: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Steps a graphic through its frames, calling back only when the frame
|
|
9
|
+
* changes, so a slow frame rate costs a redraw per frame, not per display
|
|
10
|
+
* refresh.
|
|
11
|
+
*
|
|
12
|
+
* Frame 0 is the designed still: draw it yourself before the clock starts.
|
|
13
|
+
* The clock runs only while the element is on screen, the page is visible
|
|
14
|
+
* and motion is allowed. A pause resumes where it stopped. Under reduced
|
|
15
|
+
* motion it returns to frame 0 and holds there.
|
|
16
|
+
*
|
|
17
|
+
* @param element - The element whose visibility gates the clock.
|
|
18
|
+
* @param options - The period and frame callback.
|
|
19
|
+
* @returns A function that stops the clock for good.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runSetFrames(element: Element, { onFrame, period }: SetFramesOptions): () => void;
|
|
22
|
+
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/runtime/frames.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,gBAAgB,GACpC,MAAM,IAAI,CAoDZ"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type SetEasing } from "./easing.js";
|
|
2
|
+
/** A color resolved to sRGB: channels from 0 to 1, and a canvas-ready string. */
|
|
3
|
+
export interface SetResolvedColor {
|
|
4
|
+
alpha: number;
|
|
5
|
+
b: number;
|
|
6
|
+
/** For a canvas `fillStyle` or `strokeStyle`. */
|
|
7
|
+
css: string;
|
|
8
|
+
g: number;
|
|
9
|
+
r: number;
|
|
10
|
+
}
|
|
11
|
+
/** A length unit `resolveSetLength` can return. */
|
|
12
|
+
export type SetLengthUnit = "px" | "rem";
|
|
13
|
+
/**
|
|
14
|
+
* Resolves a color token at the element, in sRGB.
|
|
15
|
+
*
|
|
16
|
+
* The computed color is painted to a pixel and read back, so any color
|
|
17
|
+
* syntax the browser understands comes out as sRGB channels, clamped where
|
|
18
|
+
* the color is outside sRGB, with no color parser of our own.
|
|
19
|
+
*
|
|
20
|
+
* @param element - Where the token is resolved: its theme, surface and brand.
|
|
21
|
+
* @param token - The custom property, e.g. `--set-color-foreground-default`.
|
|
22
|
+
* @returns The color, or undefined if the token isn't set at the element.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveSetColor(element: Element, token: string): SetResolvedColor | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves an easing token at the element to a progress function, for
|
|
27
|
+
* animating in canvas or WebGL on Set's curves.
|
|
28
|
+
*
|
|
29
|
+
* It follows `cubic-bezier()`, `steps()` and the CSS keywords, such as
|
|
30
|
+
* `ease-in-out` and `linear`.
|
|
31
|
+
*
|
|
32
|
+
* @param element - Where the token is resolved.
|
|
33
|
+
* @param token - The custom property, e.g. `--set-motion-easing-ease-in-out`.
|
|
34
|
+
* @returns Progress for a time, both from 0 to 1, or undefined if the token
|
|
35
|
+
* isn't set at the element or isn't a timing function it can follow.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveSetEasing(element: Element, token: string): SetEasing | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves a duration token at the element.
|
|
40
|
+
*
|
|
41
|
+
* @param element - Where the token is resolved.
|
|
42
|
+
* @param token - The custom property, e.g. `--set-motion-duration-5000`.
|
|
43
|
+
* @returns Milliseconds, or undefined if the token isn't set at the element.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveSetTime(element: Element, token: string): number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Resolves a length token at the element.
|
|
48
|
+
*
|
|
49
|
+
* `rem` divides by the root's font size. Breakpoints are the exception to
|
|
50
|
+
* watch: in a media query, `rem` is the browser's default font size, which
|
|
51
|
+
* matches the root's unless the page sets its own.
|
|
52
|
+
*
|
|
53
|
+
* @param element - Where the token is resolved: responsive tokens resolve
|
|
54
|
+
* at the current viewport size.
|
|
55
|
+
* @param token - The custom property, e.g. `--set-spacing-horizontal-400`.
|
|
56
|
+
* @param unit - `px` (the default) or `rem`.
|
|
57
|
+
* @returns The length, or undefined if the token isn't set at the element.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveSetLength(element: Element, token: string, unit?: SetLengthUnit): number | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Resolves a token to its value at the element, as a string: for keywords
|
|
62
|
+
* and other values the other helpers don't cover, such as a blend mode or an
|
|
63
|
+
* easing curve.
|
|
64
|
+
*
|
|
65
|
+
* @param element - Where the token is resolved.
|
|
66
|
+
* @param token - The custom property, e.g. `--set-effect-blend-overprint`.
|
|
67
|
+
* @returns The value, or undefined if the token isn't set at the element.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveSetString(element: Element, token: string): string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Calls back when a change may have moved the tokens that apply at the
|
|
72
|
+
* element: a brand, theme, surface or content-theme attribute on the element
|
|
73
|
+
* or any ancestor, the OS color scheme, or forced colors.
|
|
74
|
+
*
|
|
75
|
+
* Changes are batched to one call per animation frame, so a theme switch
|
|
76
|
+
* that touches several attributes resolves once. The callback doesn't say
|
|
77
|
+
* what changed: resolve the tokens again, and compare if a redraw is costly.
|
|
78
|
+
* Responsive tokens change with the viewport, not with these, so resolve
|
|
79
|
+
* those again on resize.
|
|
80
|
+
*
|
|
81
|
+
* @param element - The element whose tokens to watch.
|
|
82
|
+
* @param onChange - Called after a change, at most once a frame.
|
|
83
|
+
* @returns A function that stops watching.
|
|
84
|
+
*/
|
|
85
|
+
export declare function watchSetTokens(element: Element, onChange: () => void): () => void;
|
|
86
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/runtime/tokens.ts"],"names":[],"mappings":"AAWA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzD,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,KAAK,CAAC;AA+DzC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,gBAAgB,GAAG,SAAS,CAkB9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,SAAS,GAAG,SAAS,CAIvB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,aAAoB,GACzB,MAAM,GAAG,SAAS,CAapB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,IAAI,GACnB,MAAM,IAAI,CAiCZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monospaced/set-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "SSR-first component library for Set. Native HTML output via custom elements, with a co-located CSS contract.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"directory": "packages/core"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22.12"
|
|
13
|
+
},
|
|
11
14
|
"style": "./dist/core.css",
|
|
12
15
|
"files": [
|
|
13
16
|
"dist",
|
|
@@ -16,25 +19,27 @@
|
|
|
16
19
|
"exports": {
|
|
17
20
|
".": {
|
|
18
21
|
"types": "./dist/index.d.ts",
|
|
19
|
-
"
|
|
20
|
-
"require": "./dist/index.cjs"
|
|
22
|
+
"default": "./dist/index.js"
|
|
21
23
|
},
|
|
22
24
|
"./styles.css": "./dist/core.css",
|
|
23
25
|
"./styles/mnsp.css": "./dist/core-mnsp.css",
|
|
24
26
|
"./styles/wrfr.css": "./dist/core-wrfr.css"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@monospaced/set-icons": "0.
|
|
29
|
+
"@monospaced/set-icons": "0.28.0"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
|
-
"@monospaced/set-config": "0.
|
|
31
|
-
"@monospaced/set-markdown": "0.
|
|
32
|
-
"@monospaced/set-system": "0.
|
|
32
|
+
"@monospaced/set-config": "0.28.0",
|
|
33
|
+
"@monospaced/set-markdown": "0.28.0",
|
|
34
|
+
"@monospaced/set-system": "0.28.0",
|
|
33
35
|
"@testing-library/dom": "^10.4.2",
|
|
34
36
|
"@testing-library/user-event": "^14.6.8",
|
|
35
37
|
"@types/node": "^26.6.6",
|
|
38
|
+
"@vitest/browser": "^5.1.0",
|
|
39
|
+
"@vitest/browser-playwright": "^5.1.0",
|
|
36
40
|
"autoprefixer": "^10.6.2",
|
|
37
41
|
"jsdom": "^31.0.0",
|
|
42
|
+
"playwright": "^1.65.0",
|
|
38
43
|
"postcss": "^8.5.32",
|
|
39
44
|
"prettier": "^3.9.10",
|
|
40
45
|
"typescript": "^5.9.3",
|