cssints 0.6.0 → 0.7.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/{author-types-C1AhsnrT.d.mts → author-types-D9IjEXwn.d.mts} +0 -2
- package/dist/check.d.mts +1 -3
- package/dist/check.mjs +4 -5
- package/dist/clay-types.d.mts +87 -3
- package/dist/clay.d.mts +2 -3
- package/dist/clay.mjs +152 -12
- package/dist/{color-BYIxVLlS.mjs → color-BB8ipynT.mjs} +1 -2
- package/dist/color-DNL0XuEi.mjs +1 -0
- package/dist/{contrast-DLi4pp25.mjs → contrast-Dw6gXoO3.mjs} +4 -5
- package/dist/derived.d.mts +0 -2
- package/dist/derived.mjs +1 -2
- package/dist/{devtools-link-D2YxsJKZ.mjs → devtools-link-DN91p7g5.mjs} +1 -2
- package/dist/devtools-link.d.mts +1 -3
- package/dist/devtools-link.mjs +1 -2
- package/dist/{errors-D4ZbcwRo.d.mts → errors-jNEiB3ye.d.mts} +0 -2
- package/dist/{frame-BoBKjgBB.mjs → frame-DqwCA4OH.mjs} +1 -2
- package/dist/frame.d.mts +1 -3
- package/dist/frame.mjs +1 -2
- package/dist/group-common-CTUs5yym.d.mts +1 -0
- package/dist/{group-types-Dn9CIR8J.d.mts → group-types-BBaZ8dwy.d.mts} +1 -3
- package/dist/groups/baseline-2015/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2015.d.mts +3 -5
- package/dist/groups/baseline-2016/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2016.d.mts +3 -5
- package/dist/groups/baseline-2017/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2017.d.mts +3 -5
- package/dist/groups/baseline-2018/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2018.d.mts +3 -5
- package/dist/groups/baseline-2019/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2019.d.mts +3 -5
- package/dist/groups/baseline-2020/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2020.d.mts +3 -5
- package/dist/groups/baseline-2021/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2021.d.mts +3 -5
- package/dist/groups/baseline-2022/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2022.d.mts +3 -5
- package/dist/groups/baseline-2023/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2023.d.mts +3 -5
- package/dist/groups/baseline-2024/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2024.d.mts +3 -5
- package/dist/groups/baseline-2025/with-downstream.d.mts +3 -5
- package/dist/groups/baseline-2025.d.mts +3 -5
- package/dist/groups/baseline-2026/with-downstream.d.mts +1 -1
- package/dist/groups/baseline-2026.d.mts +1 -1
- package/dist/groups/compositing-2.d.mts +3 -5
- package/dist/groups/css-align-3.d.mts +3 -5
- package/dist/groups/css-anchor-position-1.d.mts +3 -5
- package/dist/groups/css-anchor-position-2.d.mts +3 -5
- package/dist/groups/css-animations-1.d.mts +3 -5
- package/dist/groups/css-animations-2.d.mts +3 -5
- package/dist/groups/css-backgrounds-3.d.mts +3 -5
- package/dist/groups/css-backgrounds-4.d.mts +3 -5
- package/dist/groups/css-borders-4.d.mts +3 -5
- package/dist/groups/css-box-4.d.mts +3 -5
- package/dist/groups/css-break-4.d.mts +3 -5
- package/dist/groups/css-cascade-5.d.mts +3 -5
- package/dist/groups/css-cascade-6.d.mts +3 -5
- package/dist/groups/css-color-4.d.mts +3 -5
- package/dist/groups/css-color-5.d.mts +3 -5
- package/dist/groups/css-color-6.d.mts +3 -5
- package/dist/groups/css-color-adjust-1.d.mts +3 -5
- package/dist/groups/css-color-hdr-1.d.mts +3 -5
- package/dist/groups/css-conditional-3.d.mts +3 -5
- package/dist/groups/css-conditional-4.d.mts +3 -5
- package/dist/groups/css-conditional-5.d.mts +3 -5
- package/dist/groups/css-contain-2.d.mts +3 -5
- package/dist/groups/css-content-3.d.mts +3 -5
- package/dist/groups/css-counter-styles-3.d.mts +3 -5
- package/dist/groups/css-display-4.d.mts +3 -5
- package/dist/groups/css-easing-2.d.mts +3 -5
- package/dist/groups/css-env-1.d.mts +3 -5
- package/dist/groups/css-flexbox-1.d.mts +3 -5
- package/dist/groups/css-fonts-4.d.mts +3 -5
- package/dist/groups/css-fonts-5.d.mts +3 -5
- package/dist/groups/css-forms-1.d.mts +3 -5
- package/dist/groups/css-gaps-1.d.mts +3 -5
- package/dist/groups/css-gcpm-3.d.mts +3 -5
- package/dist/groups/css-gcpm-4.d.mts +3 -5
- package/dist/groups/css-grid-2.d.mts +3 -5
- package/dist/groups/css-grid-3.d.mts +3 -5
- package/dist/groups/css-images-3.d.mts +3 -5
- package/dist/groups/css-images-4.d.mts +3 -5
- package/dist/groups/css-images-5.d.mts +3 -5
- package/dist/groups/css-inline-3.d.mts +3 -5
- package/dist/groups/css-lists-3.d.mts +3 -5
- package/dist/groups/css-logical-1.d.mts +3 -5
- package/dist/groups/css-masking-1.d.mts +3 -5
- package/dist/groups/css-multicol-2.d.mts +3 -5
- package/dist/groups/css-overflow-3.d.mts +3 -5
- package/dist/groups/css-overflow-4.d.mts +3 -5
- package/dist/groups/css-overflow-5.d.mts +3 -5
- package/dist/groups/css-overscroll-1.d.mts +3 -5
- package/dist/groups/css-page-3.d.mts +3 -5
- package/dist/groups/css-page-floats-3.d.mts +3 -5
- package/dist/groups/css-position-3.d.mts +3 -5
- package/dist/groups/css-position-4.d.mts +3 -5
- package/dist/groups/css-rhythm-1.d.mts +3 -5
- package/dist/groups/css-round-display-1.d.mts +3 -5
- package/dist/groups/css-ruby-1.d.mts +3 -5
- package/dist/groups/css-scroll-anchoring-1.d.mts +3 -5
- package/dist/groups/css-scroll-snap-1.d.mts +3 -5
- package/dist/groups/css-scroll-snap-2.d.mts +3 -5
- package/dist/groups/css-scrollbars-1.d.mts +3 -5
- package/dist/groups/css-shapes-1.d.mts +3 -5
- package/dist/groups/css-shapes-2.d.mts +3 -5
- package/dist/groups/css-size-adjust-1.d.mts +3 -5
- package/dist/groups/css-sizing-3.d.mts +3 -5
- package/dist/groups/css-sizing-4.d.mts +3 -5
- package/dist/groups/css-speech-1.d.mts +3 -5
- package/dist/groups/css-tables-3.d.mts +3 -5
- package/dist/groups/css-text-3.d.mts +3 -5
- package/dist/groups/css-text-4.d.mts +3 -5
- package/dist/groups/css-text-decor-3.d.mts +3 -5
- package/dist/groups/css-text-decor-4.d.mts +3 -5
- package/dist/groups/css-transforms-1.d.mts +3 -5
- package/dist/groups/css-transforms-2.d.mts +3 -5
- package/dist/groups/css-transitions-1.d.mts +3 -5
- package/dist/groups/css-transitions-2.d.mts +3 -5
- package/dist/groups/css-ui-4.d.mts +3 -5
- package/dist/groups/css-values-4.d.mts +3 -5
- package/dist/groups/css-values-5.d.mts +3 -5
- package/dist/groups/css-variables-2.d.mts +2 -4
- package/dist/groups/css-view-transitions-2.d.mts +3 -5
- package/dist/groups/css-viewport.d.mts +3 -5
- package/dist/groups/css-will-change-1.d.mts +3 -5
- package/dist/groups/css-writing-modes-4.d.mts +3 -5
- package/dist/groups/css2.d.mts +3 -5
- package/dist/groups/fill-stroke-3.d.mts +3 -5
- package/dist/groups/filter-effects-1.d.mts +3 -5
- package/dist/groups/filter-effects-2.d.mts +3 -5
- package/dist/groups/limited-availability.d.mts +2 -2
- package/dist/groups/mediaqueries-4.d.mts +3 -5
- package/dist/groups/mediaqueries-5.d.mts +3 -5
- package/dist/groups/motion-1.d.mts +3 -5
- package/dist/groups/newly-available/with-downstream.d.mts +3 -5
- package/dist/groups/newly-available.d.mts +3 -5
- package/dist/groups/not-discouraged.d.mts +3 -5
- package/dist/groups/scroll-animations-1.d.mts +3 -5
- package/dist/groups/selectors-4.d.mts +2 -4
- package/dist/groups/selectors-5.d.mts +2 -4
- package/dist/groups/widely-available/with-downstream.d.mts +3 -5
- package/dist/groups/widely-available.d.mts +3 -5
- package/dist/index.d.mts +5 -8
- package/dist/index.mjs +18 -16
- package/dist/{instrument-C7Am_dJ3.mjs → instrument-BN47aTEW.mjs} +3 -5
- package/dist/{lowered-CKSYUc0i.mjs → lowered-DOJEDRFM.mjs} +2 -3
- package/dist/{node-BABEZ2oF.d.mts → node-CnkQisiV.d.mts} +1 -5
- package/dist/parent-vars.d.mts +0 -2
- package/dist/parent-vars.mjs +1 -2
- package/dist/plugin-types.d.mts +1 -5
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.mjs +1 -2
- package/dist/{registry-ByrYF2v5.mjs → registry-8sYvlzyn.mjs} +2 -4
- package/dist/{runtime-Dt4Tm0Q7.d.mts → runtime-Cv7hGrWf.d.mts} +0 -2
- package/dist/runtime.d.mts +1 -3
- package/dist/runtime.mjs +1 -2
- package/dist/{scope-1R_Np2Mj.d.mts → scope-5A3kbBoQ.d.mts} +1685 -12
- package/dist/{sheet-BT2R1wk_.mjs → sheet-qCuMvyUo.mjs} +7 -13
- package/dist/surface.d.mts +2 -4
- package/dist/surface.mjs +2 -3
- package/dist/{theme-WGcgMD4V.mjs → theme-DBCyDih4.mjs} +7 -11
- package/dist/{theme-types-BY0mRf3K.d.mts → theme-types-CplLnGgG.d.mts} +1684 -11
- package/dist/{trace-otlp-CbKFDsn9.mjs → trace-otlp-DP2syBvD.mjs} +1 -2
- package/dist/tui-types.d.mts +1 -3
- package/dist/tui.d.mts +1 -2
- package/dist/tui.mjs +6 -7
- package/dist/types.d.mts +2 -2
- package/dist/vite.d.mts +3 -11
- package/dist/vite.mjs +11 -16
- package/docs/API.md +135 -4
- package/package.json +3 -3
- package/dist/color-C8OzjAeg.mjs +0 -2
- package/dist/group-common-3PAVTxpd.d.mts +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/author-types.d.ts
|
|
2
1
|
/** A declaration a member emits: property and value (a custom property, `--_r`, is allowed). */
|
|
3
2
|
type Decl = readonly [prop: string, value: string];
|
|
4
3
|
/** A feature of `@mdn/browser-compat-data`: `css.at-rules.container.style_queries_for_custom_properties`. */
|
|
@@ -76,5 +75,4 @@ interface Conflict {
|
|
|
76
75
|
props: (string | RegExp)[];
|
|
77
76
|
message: string;
|
|
78
77
|
}
|
|
79
|
-
//#endregion
|
|
80
78
|
export { Kernel as a, GlobalRule as i, Conflict as n, Runtime as o, Decl as r, ThemeRule as s, BcdKey as t };
|
package/dist/check.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as ContrastError } from "./errors-
|
|
1
|
+
import { t as ContrastError } from "./errors-jNEiB3ye.mjs";
|
|
2
2
|
import { Warning } from "@cssints/css-grammar/support";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
|
-
//#region src/check.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The WCAG 2.x contrast ratio of two CSS colours, as `css.check.contrast` computes it: culori reads the colour, one
|
|
7
6
|
* outside sRGB is clipped to it, a translucent one has no contrast. `text` is the ratio cut (not rounded) at two places,
|
|
@@ -18,5 +17,4 @@ export declare const contrast: (foreground: string, background: string) => Effec
|
|
|
18
17
|
* never goes through it and keeps the warning. A custom property is `--name`.
|
|
19
18
|
*/
|
|
20
19
|
export declare const loweredOf: (property: string, value: string, warning: Warning) => Effect.Effect<string | undefined, never, never>;
|
|
21
|
-
//#endregion
|
|
22
20
|
export { ContrastError };
|
package/dist/check.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { s as ContrastError } from "./registry-
|
|
2
|
-
import { t as fallbackOf } from "./lowered-
|
|
3
|
-
import { i as shown, r as ratio, t as luminance } from "./color-
|
|
1
|
+
import { s as ContrastError } from "./registry-8sYvlzyn.mjs";
|
|
2
|
+
import { t as fallbackOf } from "./lowered-DOJEDRFM.mjs";
|
|
3
|
+
import { i as shown, r as ratio, t as luminance } from "./color-BB8ipynT.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
|
|
5
|
+
// src/check.ts
|
|
6
6
|
/**
|
|
7
7
|
* The WCAG 2.x contrast ratio of two CSS colours, as `css.check.contrast` computes it: culori reads the colour, one
|
|
8
8
|
* outside sRGB is clipped to it, a translucent one has no contrast. `text` is the ratio cut (not rounded) at two places,
|
|
@@ -33,5 +33,4 @@ const contrast = Effect.fn("cssints.contrast")(function* (foreground, background
|
|
|
33
33
|
const loweredOf = Effect.fn("cssints.loweredOf")(function* (property, value, warning) {
|
|
34
34
|
return yield* Effect.sync(() => fallbackOf(property, value, warning));
|
|
35
35
|
});
|
|
36
|
-
//#endregion
|
|
37
36
|
export { ContrastError, contrast, loweredOf };
|
package/dist/clay-types.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/clay-types.d.ts
|
|
1
|
+
import { am as Check, cm as Part, d as createTokens, s as Overrides, t as CheckOverrides } from "./theme-types-CplLnGgG.mjs";
|
|
3
2
|
/** A number of pixels, or `"Npx"`. */
|
|
4
3
|
export type Px = number | `${number}px`;
|
|
5
4
|
/** Pixels, `N%` of the parent, `auto` (Clay's FIT) or `stretch` (Clay's GROW). */
|
|
@@ -40,6 +39,28 @@ export type FloatOptions = {
|
|
|
40
39
|
root?: boolean;
|
|
41
40
|
parent?: never;
|
|
42
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* The options of `shadow()`: one object, all optional, lengths in pixels. No options at all is the default shadow
|
|
44
|
+
* (`{ x: 0, y: 2, blur: 12, color: "rgb(0 0 0 / 0.4)" }`); the fields a state names are the ones it changes.
|
|
45
|
+
*/
|
|
46
|
+
export type ShadowOptions = {
|
|
47
|
+
/** Moves the shadow from the element's box, in pixels (a negative one goes left or up). Default: 0. */
|
|
48
|
+
x?: Px;
|
|
49
|
+
/** Moves the shadow down (or up, negative). Default: 2. */
|
|
50
|
+
y?: Px;
|
|
51
|
+
/** The blur radius in pixels: the width of the soft edge, not negative. Default: 12. */
|
|
52
|
+
blur?: Px;
|
|
53
|
+
/** The colour of the shadow, as any colour a Clay page can draw. Default: `rgb(0 0 0 / 0.4)`. */
|
|
54
|
+
color?: string;
|
|
55
|
+
};
|
|
56
|
+
/** The options of `backdrop()`: the element is glass over the content behind it. */
|
|
57
|
+
export type BackdropOptions = {
|
|
58
|
+
/**
|
|
59
|
+
* The blur radius in pixels, as CSS's `backdrop-filter` reads one: about twice the gaussian's standard deviation.
|
|
60
|
+
* Not negative. Default: 12.
|
|
61
|
+
*/
|
|
62
|
+
blur?: Px;
|
|
63
|
+
};
|
|
43
64
|
/** The options of `image()`: the image's size in pixels, and how it fills its box. */
|
|
44
65
|
export type ImageOptions = {
|
|
45
66
|
/** The image's width in whole pixels: the element's box starts at the image's own size. */
|
|
@@ -58,6 +79,33 @@ interface Rgba {
|
|
|
58
79
|
b: number;
|
|
59
80
|
a: number;
|
|
60
81
|
}
|
|
82
|
+
/** A shadow the renderer draws: the element's box, offset and blurred, in that colour. */
|
|
83
|
+
export interface Shadow {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
blur: number;
|
|
87
|
+
color: Rgba;
|
|
88
|
+
}
|
|
89
|
+
/** A backdrop the renderer blurs: the content under the element's box, before the element's own commands. */
|
|
90
|
+
export interface Backdrop {
|
|
91
|
+
blur: number;
|
|
92
|
+
}
|
|
93
|
+
/** A gradient stop: where it sits up the gradient line (0..1) and its colour. */
|
|
94
|
+
export interface GradientStop {
|
|
95
|
+
offset: number;
|
|
96
|
+
color: Rgba;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A linear gradient the renderer draws instead of the solid fill (`css.backgroundImage`): CSS's gradient line of `angle`
|
|
100
|
+
* across the element's box, `stops` from its start to its end.
|
|
101
|
+
*/
|
|
102
|
+
export interface BackgroundImage {
|
|
103
|
+
kind: "linear";
|
|
104
|
+
/** CSS's angle in degrees: 0 up, 90 right, 180 down (the default), 270 left. */
|
|
105
|
+
angle: number;
|
|
106
|
+
/** Two or more, in order (a later one is at or past an earlier one). */
|
|
107
|
+
stops: GradientStop[];
|
|
108
|
+
}
|
|
61
109
|
interface Axis {
|
|
62
110
|
type: "FIT" | "GROW" | "PERCENT" | "FIXED";
|
|
63
111
|
min?: number;
|
|
@@ -104,6 +152,21 @@ export interface ClayFields {
|
|
|
104
152
|
image?: {
|
|
105
153
|
imageData: string;
|
|
106
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* A shadow (`css.shadow`): not a field of `Clay_ElementDeclaration` (Clay 1.0 has none) — the declaration keeps its
|
|
157
|
+
* layout and the renderer draws the shadow before the element's own command, keyed by its id.
|
|
158
|
+
*/
|
|
159
|
+
shadow?: Shadow;
|
|
160
|
+
/**
|
|
161
|
+
* A backdrop (`css.backdrop`): not a field of `Clay_ElementDeclaration` either — the renderer blurs the pixels under
|
|
162
|
+
* the element's box before the element's own command, keyed by its id.
|
|
163
|
+
*/
|
|
164
|
+
backdrop?: Backdrop;
|
|
165
|
+
/**
|
|
166
|
+
* A gradient (`css.backgroundImage`): not a field of `Clay_ElementDeclaration` either — the renderer fills the element's
|
|
167
|
+
* box with it instead of `backgroundColor`, keyed by its id.
|
|
168
|
+
*/
|
|
169
|
+
backgroundImage?: BackgroundImage;
|
|
107
170
|
aspectRatio?: {
|
|
108
171
|
aspectRatio: number;
|
|
109
172
|
};
|
|
@@ -206,6 +269,28 @@ export declare const float: (options?: FloatOptions) => ClayStyle;
|
|
|
206
269
|
* renderer as `imageData`.
|
|
207
270
|
*/
|
|
208
271
|
export declare const image: (src: string, options: ImageOptions) => ClayStyle;
|
|
272
|
+
/**
|
|
273
|
+
* A shadow of the element: a renderer effect, not a Clay field (Clay 1.0 has none), so `header()` prints nothing for it
|
|
274
|
+
* and the C targets ignore it until a page draws it themselves. The declaration keeps the layout; the renderer draws the
|
|
275
|
+
* element's own box, offset by `x`/`y` and blurred by `blur`, in `color`, before the element's command. The element needs
|
|
276
|
+
* an `id`: the renderer keys the shadow by Clay's element id.
|
|
277
|
+
*/
|
|
278
|
+
export declare const shadow: (options?: ShadowOptions) => ClayStyle;
|
|
279
|
+
/**
|
|
280
|
+
* A backdrop of the element: the content under it is blurred, then the element is drawn over it, so a translucent fill
|
|
281
|
+
* is glass over our own page (the desktop behind the window is out of reach). A renderer effect, not a Clay field, as
|
|
282
|
+
* `shadow` is: `header()` prints nothing for it and only a renderer that reads it draws one. The element needs an `id`.
|
|
283
|
+
* Today `native/solid`'s ThorVG renderer is the one that blurs.
|
|
284
|
+
*/
|
|
285
|
+
export declare const backdrop: (options?: BackdropOptions) => ClayStyle;
|
|
286
|
+
/**
|
|
287
|
+
* A background image of the element, as CSS's `linear-gradient()` in one string: an optional direction (`<number>deg`, or
|
|
288
|
+
* `to top | to bottom | to left | to right`) and two or more colour stops with an optional `<number>%` each. Only a linear
|
|
289
|
+
* gradient is drawn. It is a renderer effect, not a Clay field, as `shadow` is: `header()` prints nothing for it and only
|
|
290
|
+
* a renderer that reads it draws one; the C targets keep their solid fill. `header()` and the C pages ignore it, the
|
|
291
|
+
* desktop renderer fills the element's box instead of `backgroundColor`, and the element needs an `id`.
|
|
292
|
+
*/
|
|
293
|
+
export declare const backgroundImage: (gradient: string) => ClayStyle;
|
|
209
294
|
/** Merges styles in argument order: a later prop wins. */
|
|
210
295
|
export declare const cn: (...styles: ClayStyle[]) => ClayStyle;
|
|
211
296
|
/** Under the pointer: header() prints the style with it as `<name>_hover`. States do not nest. */
|
|
@@ -228,5 +313,4 @@ export declare const fonts: <const N extends readonly [string, ...string[]]>(...
|
|
|
228
313
|
export declare const createGlobalTheme: <const X extends object, const O extends Overrides<X>>(tokens: X, name: string, overrides: O & CheckOverrides<X, O>) => void;
|
|
229
314
|
/** The styles of a built module as a C header: `CLAY(id, name)` and `CLAY_TEXT(s, name_text)`. */
|
|
230
315
|
export declare const header: (styles: Record<string, unknown>) => string;
|
|
231
|
-
//#endregion
|
|
232
316
|
export { createTokens };
|
package/dist/clay.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/clay.d.ts
|
|
2
1
|
export declare const createTokens: (...args: unknown[]) => unknown;
|
|
3
2
|
export declare const createGlobalTheme: (...args: unknown[]) => Readonly<{
|
|
4
3
|
__done: true;
|
|
@@ -25,7 +24,7 @@ export declare const active: (...styles: unknown[]) => ClayNode;
|
|
|
25
24
|
* @returns {Record<string, unknown>} a style per font, by name, and the list
|
|
26
25
|
*/
|
|
27
26
|
export declare const fonts: (...names: unknown[]) => Record<string, unknown>;
|
|
28
|
-
export declare const backgroundColor: ((...parts: unknown[]) => ClayNode) | undefined, bg: ((...parts: unknown[]) => ClayNode) | undefined, color: ((...parts: unknown[]) => ClayNode) | undefined, borderColor: ((...parts: unknown[]) => ClayNode) | undefined, width: ((...parts: unknown[]) => ClayNode) | undefined, height: ((...parts: unknown[]) => ClayNode) | undefined, padding: ((...parts: unknown[]) => ClayNode) | undefined, p: ((...parts: unknown[]) => ClayNode) | undefined, paddingInline: ((...parts: unknown[]) => ClayNode) | undefined, paddingBlock: ((...parts: unknown[]) => ClayNode) | undefined, paddingTop: ((...parts: unknown[]) => ClayNode) | undefined, paddingRight: ((...parts: unknown[]) => ClayNode) | undefined, paddingBottom: ((...parts: unknown[]) => ClayNode) | undefined, paddingLeft: ((...parts: unknown[]) => ClayNode) | undefined, pt: ((...parts: unknown[]) => ClayNode) | undefined, pr: ((...parts: unknown[]) => ClayNode) | undefined, pb: ((...parts: unknown[]) => ClayNode) | undefined, pl: ((...parts: unknown[]) => ClayNode) | undefined, gap: ((...parts: unknown[]) => ClayNode) | undefined, flexDirection: ((...parts: unknown[]) => ClayNode) | undefined, justifyContent: ((...parts: unknown[]) => ClayNode) | undefined, alignItems: ((...parts: unknown[]) => ClayNode) | undefined, borderRadius: ((...parts: unknown[]) => ClayNode) | undefined, borderWidth: ((...parts: unknown[]) => ClayNode) | undefined, border: ((...parts: unknown[]) => ClayNode) | undefined, overflow: ((...parts: unknown[]) => ClayNode) | undefined, fontSize: ((...parts: unknown[]) => ClayNode) | undefined, letterSpacing: ((...parts: unknown[]) => ClayNode) | undefined, lineHeight: ((...parts: unknown[]) => ClayNode) | undefined, textAlign: ((...parts: unknown[]) => ClayNode) | undefined, whiteSpace: ((...parts: unknown[]) => ClayNode) | undefined, float: ((...parts: unknown[]) => ClayNode) | undefined, image: ((...parts: unknown[]) => ClayNode) | undefined;
|
|
27
|
+
export declare const backgroundColor: ((...parts: unknown[]) => ClayNode) | undefined, bg: ((...parts: unknown[]) => ClayNode) | undefined, color: ((...parts: unknown[]) => ClayNode) | undefined, borderColor: ((...parts: unknown[]) => ClayNode) | undefined, width: ((...parts: unknown[]) => ClayNode) | undefined, height: ((...parts: unknown[]) => ClayNode) | undefined, padding: ((...parts: unknown[]) => ClayNode) | undefined, p: ((...parts: unknown[]) => ClayNode) | undefined, paddingInline: ((...parts: unknown[]) => ClayNode) | undefined, paddingBlock: ((...parts: unknown[]) => ClayNode) | undefined, paddingTop: ((...parts: unknown[]) => ClayNode) | undefined, paddingRight: ((...parts: unknown[]) => ClayNode) | undefined, paddingBottom: ((...parts: unknown[]) => ClayNode) | undefined, paddingLeft: ((...parts: unknown[]) => ClayNode) | undefined, pt: ((...parts: unknown[]) => ClayNode) | undefined, pr: ((...parts: unknown[]) => ClayNode) | undefined, pb: ((...parts: unknown[]) => ClayNode) | undefined, pl: ((...parts: unknown[]) => ClayNode) | undefined, gap: ((...parts: unknown[]) => ClayNode) | undefined, flexDirection: ((...parts: unknown[]) => ClayNode) | undefined, justifyContent: ((...parts: unknown[]) => ClayNode) | undefined, alignItems: ((...parts: unknown[]) => ClayNode) | undefined, borderRadius: ((...parts: unknown[]) => ClayNode) | undefined, borderWidth: ((...parts: unknown[]) => ClayNode) | undefined, border: ((...parts: unknown[]) => ClayNode) | undefined, overflow: ((...parts: unknown[]) => ClayNode) | undefined, fontSize: ((...parts: unknown[]) => ClayNode) | undefined, letterSpacing: ((...parts: unknown[]) => ClayNode) | undefined, lineHeight: ((...parts: unknown[]) => ClayNode) | undefined, textAlign: ((...parts: unknown[]) => ClayNode) | undefined, whiteSpace: ((...parts: unknown[]) => ClayNode) | undefined, float: ((...parts: unknown[]) => ClayNode) | undefined, image: ((...parts: unknown[]) => ClayNode) | undefined, backgroundImage: ((...parts: unknown[]) => ClayNode) | undefined, shadow: ((...parts: unknown[]) => ClayNode) | undefined, backdrop: ((...parts: unknown[]) => ClayNode) | undefined;
|
|
29
28
|
/**
|
|
30
29
|
* The styles of a module as C: a `Clay_ElementDeclaration` per export, and a `Clay_TextElementConfig` named
|
|
31
30
|
* `<name>_text` for one that sets text props, for `CLAY(id, name)` and `CLAY_TEXT(s, name_text)`. A state is a whole
|
|
@@ -37,4 +36,4 @@ export declare const backgroundColor: ((...parts: unknown[]) => ClayNode) | unde
|
|
|
37
36
|
* @returns {string} a C header that includes clay.h
|
|
38
37
|
*/
|
|
39
38
|
export declare const header: (styles: Record<string, unknown>) => string;
|
|
40
|
-
|
|
39
|
+
export {};
|
package/dist/clay.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as registry } from "./registry-
|
|
2
|
-
import { a as createTokens$1, i as createGlobalTheme$1, j as fail, s as sets } from "./theme-
|
|
3
|
-
import { n as valueOf, t as together } from "./contrast-
|
|
4
|
-
import { n as parseColor } from "./color-
|
|
1
|
+
import { a as registry } from "./registry-8sYvlzyn.mjs";
|
|
2
|
+
import { a as createTokens$1, i as createGlobalTheme$1, j as fail, s as sets } from "./theme-DBCyDih4.mjs";
|
|
3
|
+
import { n as valueOf, t as together } from "./contrast-Dw6gXoO3.mjs";
|
|
4
|
+
import { n as parseColor } from "./color-BB8ipynT.mjs";
|
|
5
5
|
import { Formatter, Predicate } from "effect";
|
|
6
6
|
import { clampRgb, formatHex } from "culori/fn";
|
|
7
|
-
|
|
7
|
+
// src/clay.ts
|
|
8
8
|
const tables = registry.clayTokens ??= {
|
|
9
9
|
properties: /* @__PURE__ */ new Map(),
|
|
10
10
|
defs: /* @__PURE__ */ new Map(),
|
|
@@ -82,7 +82,8 @@ const one = (key, read) => (prop, parts) => {
|
|
|
82
82
|
const COLOURS = /* @__PURE__ */ new Set([
|
|
83
83
|
"backgroundColor",
|
|
84
84
|
"color",
|
|
85
|
-
"borderColor"
|
|
85
|
+
"borderColor",
|
|
86
|
+
"shadowColor"
|
|
86
87
|
]);
|
|
87
88
|
const sides = (keys, read) => (prop, parts) => {
|
|
88
89
|
if (parts.length < 1 || parts.length > 4) throw fail(`cssints: ${prop} takes 1 to 4 values, got ${parts.length}`);
|
|
@@ -197,6 +198,119 @@ const imageOf = (prop, parts) => {
|
|
|
197
198
|
["aspectRatio", keyword("fill", "contain")(`${prop}.fit`, o.fit ?? "fill") === "contain" ? w / h : 0]
|
|
198
199
|
];
|
|
199
200
|
};
|
|
201
|
+
const SHADOW_OPTIONS = [
|
|
202
|
+
"x",
|
|
203
|
+
"y",
|
|
204
|
+
"blur",
|
|
205
|
+
"color"
|
|
206
|
+
];
|
|
207
|
+
const SHADOW_FIELDS = [
|
|
208
|
+
"shadowX",
|
|
209
|
+
"shadowY",
|
|
210
|
+
"shadowBlur",
|
|
211
|
+
"shadowColor"
|
|
212
|
+
];
|
|
213
|
+
const SHADOW_COLOUR = "rgb(0 0 0 / 0.4)";
|
|
214
|
+
const SHADOW_DEFAULT = {
|
|
215
|
+
x: 0,
|
|
216
|
+
y: 2,
|
|
217
|
+
blur: 12,
|
|
218
|
+
color: SHADOW_COLOUR
|
|
219
|
+
};
|
|
220
|
+
const shadowOf = (prop, parts) => {
|
|
221
|
+
if (parts.length > 1) throw fail(`cssints: ${prop} takes one object of options, got ${parts.length} values`);
|
|
222
|
+
const o = options(prop, parts[0] ?? {}, SHADOW_OPTIONS);
|
|
223
|
+
const given = Object.keys(o).length ? o : SHADOW_DEFAULT;
|
|
224
|
+
const out = [];
|
|
225
|
+
if (given.x !== void 0) out.push(["shadowX", offset(`${prop}.x`, given.x)]);
|
|
226
|
+
if (given.y !== void 0) out.push(["shadowY", offset(`${prop}.y`, given.y)]);
|
|
227
|
+
if (given.blur !== void 0) out.push(["shadowBlur", px(`${prop}.blur`, given.blur)]);
|
|
228
|
+
if (given.color !== void 0) out.push(["shadowColor", colour(`${prop}.color`, given.color)]);
|
|
229
|
+
return out;
|
|
230
|
+
};
|
|
231
|
+
const GRADIENT = "a linear-gradient() as one string: an optional direction (<number>deg, or to top | to bottom | to left | to right; 180deg by default) and two or more colour stops with an optional <number>% each";
|
|
232
|
+
const DEGREES = /^(-?(?:\d+\.?\d*|\.\d+))deg$/;
|
|
233
|
+
const PLAIN_NUMBER = /^-?(?:\d+\.?\d*|\.\d+)$/;
|
|
234
|
+
const OTHER_ANGLE = /^-?(?:\d+\.?\d*|\.\d+)(?:turn|rad|grad)$/;
|
|
235
|
+
const PERCENT_ONLY = /^-?(?:\d+\.?\d*|\.\d+)%$/;
|
|
236
|
+
const OFFSET_AT_END = /^(.*\S)\s+(-?(?:\d+\.?\d*|\.\d+)%)$/;
|
|
237
|
+
const LENGTH_AT_END = /^(.*\S)\s+(-?(?:\d+\.?\d*|\.\d+)(?:px|em|rem|vh|vw|pt))$/;
|
|
238
|
+
const TO = {
|
|
239
|
+
"to top": 0,
|
|
240
|
+
"to right": 90,
|
|
241
|
+
"to bottom": 180,
|
|
242
|
+
"to left": 270
|
|
243
|
+
};
|
|
244
|
+
const splitStops = (text) => text.trim() ? text.split(/,(?![^(]*\))/).map((stop) => stop.trim()) : [];
|
|
245
|
+
const directionOf = (prop, first) => {
|
|
246
|
+
const deg = DEGREES.exec(first);
|
|
247
|
+
if (deg) return {
|
|
248
|
+
angle: Number(deg[1]),
|
|
249
|
+
skip: true
|
|
250
|
+
};
|
|
251
|
+
if (Object.hasOwn(TO, first)) return {
|
|
252
|
+
angle: TO[first],
|
|
253
|
+
skip: true
|
|
254
|
+
};
|
|
255
|
+
if (OTHER_ANGLE.test(first) || PLAIN_NUMBER.test(first) || first.startsWith("to ")) throw fail(`cssints: ${prop}: unexpected ${say(first)} as a direction, expected <number>deg or ${Object.keys(TO).join(" | ")}`);
|
|
256
|
+
return {
|
|
257
|
+
angle: 180,
|
|
258
|
+
skip: false
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
const gradientOf = (prop, text) => {
|
|
262
|
+
const m = /^linear-gradient\((.*)\)$/s.exec(text.trim());
|
|
263
|
+
if (!m) throw fail(`cssints: ${prop}: unexpected ${say(text)}, expected ${GRADIENT}`);
|
|
264
|
+
const parts = splitStops(m[1]);
|
|
265
|
+
const { angle, skip } = directionOf(prop, parts[0] ?? "");
|
|
266
|
+
const stops = parts.slice(skip ? 1 : 0).map((token) => {
|
|
267
|
+
const end = OFFSET_AT_END.exec(token);
|
|
268
|
+
const text = end ? end[1] : token;
|
|
269
|
+
const length = end ? null : LENGTH_AT_END.exec(token);
|
|
270
|
+
if (length) throw fail(`cssints: ${prop}: unexpected ${say(length[2])} as a stop, expected a percentage ("50%", or no offset)`);
|
|
271
|
+
if (!end && PERCENT_ONLY.test(token)) throw fail(`cssints: ${prop}: unexpected ${say(token)}, expected a colour (colour hints are not drawn)`);
|
|
272
|
+
colour(prop, text);
|
|
273
|
+
return {
|
|
274
|
+
text,
|
|
275
|
+
percent: end ? Number.parseFloat(end[2]) : void 0
|
|
276
|
+
};
|
|
277
|
+
});
|
|
278
|
+
if (stops.length < 2) throw fail(`cssints: ${prop}: a gradient needs two or more colour stops, got ${stops.length}`);
|
|
279
|
+
const numbers = stops.map((s) => s.percent);
|
|
280
|
+
const edges = numbers.map((p, i) => p !== void 0 ? p : i === 0 ? 0 : i === numbers.length - 1 ? 100 : void 0);
|
|
281
|
+
const at = edges.map((percent, i) => {
|
|
282
|
+
if (percent !== void 0) return percent;
|
|
283
|
+
const before = edges.findLastIndex((p, k) => k < i && p !== void 0);
|
|
284
|
+
const after = edges.findIndex((p, k) => k > i && p !== void 0);
|
|
285
|
+
const [from, to] = [edges[before], edges[after]];
|
|
286
|
+
return from + (to - from) * (i - before) / (after - before);
|
|
287
|
+
});
|
|
288
|
+
return {
|
|
289
|
+
angle,
|
|
290
|
+
stops: stops.map((s, i) => {
|
|
291
|
+
const percent = at[i];
|
|
292
|
+
if (percent < 0 || percent > 100) throw fail(`cssints: ${prop}: unexpected ${say(`${percent}%`)} as an offset, expected 0% to 100%`);
|
|
293
|
+
if (i && percent < at[i - 1]) throw fail(`cssints: ${prop}: the stops go backwards: ${say(`${at[i - 1]}%`)} then ${say(`${percent}%`)}`);
|
|
294
|
+
return {
|
|
295
|
+
text: s.text,
|
|
296
|
+
offset: percent / 100
|
|
297
|
+
};
|
|
298
|
+
})
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
const backgroundImageOf = (prop, parts) => {
|
|
302
|
+
if (parts.length !== 1) throw fail(`cssints: ${prop} takes one string, got ${parts.length} values`);
|
|
303
|
+
if (typeof parts[0] !== "string") throw fail(`cssints: ${prop}: unexpected ${say(parts[0])}, expected ${GRADIENT}`);
|
|
304
|
+
gradientOf(prop, parts[0]);
|
|
305
|
+
return [["backgroundImage", parts[0]]];
|
|
306
|
+
};
|
|
307
|
+
const BACKDROP_OPTIONS = ["blur"];
|
|
308
|
+
const BACKDROP_DEFAULT = 12;
|
|
309
|
+
const backdropOf = (prop, parts) => {
|
|
310
|
+
if (parts.length > 1) throw fail(`cssints: ${prop} takes one object of options, got ${parts.length} values`);
|
|
311
|
+
const o = options(prop, parts[0] ?? {}, BACKDROP_OPTIONS);
|
|
312
|
+
return [["backdropBlur", px(`${prop}.blur`, o.blur ?? BACKDROP_DEFAULT)]];
|
|
313
|
+
};
|
|
200
314
|
const PADDING = [
|
|
201
315
|
"paddingTop",
|
|
202
316
|
"paddingRight",
|
|
@@ -257,7 +371,10 @@ const MEMBERS = {
|
|
|
257
371
|
textAlign: one("textAlign", keyword("left", "center", "right")),
|
|
258
372
|
whiteSpace: one("whiteSpace", keyword("normal", "pre-line", "nowrap")),
|
|
259
373
|
float: floating,
|
|
260
|
-
image: imageOf
|
|
374
|
+
image: imageOf,
|
|
375
|
+
backgroundImage: backgroundImageOf,
|
|
376
|
+
shadow: shadowOf,
|
|
377
|
+
backdrop: backdropOf
|
|
261
378
|
};
|
|
262
379
|
const member = (name, build) => (...parts) => {
|
|
263
380
|
if (parts.some(isClay)) throw fail(`cssints: ${name}: a style is not a value`);
|
|
@@ -310,7 +427,7 @@ const fonts = (...names) => {
|
|
|
310
427
|
]])]))
|
|
311
428
|
};
|
|
312
429
|
};
|
|
313
|
-
const { backgroundColor, bg, color, borderColor, width, height, padding, p, paddingInline, paddingBlock, paddingTop, paddingRight, paddingBottom, paddingLeft, pt, pr, pb, pl, gap, flexDirection, justifyContent, alignItems, borderRadius, borderWidth, border, overflow, fontSize, letterSpacing, lineHeight, textAlign, whiteSpace, float, image } = Object.fromEntries(Object.entries(MEMBERS).map(([k, b]) => [k, member(k, b)]));
|
|
430
|
+
const { backgroundColor, bg, color, borderColor, width, height, padding, p, paddingInline, paddingBlock, paddingTop, paddingRight, paddingBottom, paddingLeft, pt, pr, pb, pl, gap, flexDirection, justifyContent, alignItems, borderRadius, borderWidth, border, overflow, fontSize, letterSpacing, lineHeight, textAlign, whiteSpace, float, image, backgroundImage, shadow, backdrop } = Object.fromEntries(Object.entries(MEMBERS).map(([k, b]) => [k, member(k, b)]));
|
|
314
431
|
const rgba = (prop, text, values) => {
|
|
315
432
|
const flat = text.replace(VAR, (m, n) => valueOf(tables, n, values) ?? m);
|
|
316
433
|
const c = flat.includes("var(") ? void 0 : parseColor(flat);
|
|
@@ -428,6 +545,24 @@ const shapeOf = (entries, values) => {
|
|
|
428
545
|
if (FLOATING.some((k) => p.has(k))) out.floating = floatingOf(p);
|
|
429
546
|
if (p.has("imageSrc")) out.image = { imageData: get("imageSrc") };
|
|
430
547
|
if (p.get("aspectRatio")) out.aspectRatio = { aspectRatio: get("aspectRatio") };
|
|
548
|
+
if (p.has("backgroundImage")) {
|
|
549
|
+
const g = gradientOf("backgroundImage", String(p.get("backgroundImage")));
|
|
550
|
+
out.backgroundImage = {
|
|
551
|
+
kind: "linear",
|
|
552
|
+
angle: g.angle,
|
|
553
|
+
stops: g.stops.map((s) => ({
|
|
554
|
+
offset: s.offset,
|
|
555
|
+
color: rgba("backgroundImage", s.text, values)
|
|
556
|
+
}))
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
if (SHADOW_FIELDS.some((k) => p.has(k))) out.shadow = {
|
|
560
|
+
x: get("shadowX") ?? SHADOW_DEFAULT.x,
|
|
561
|
+
y: get("shadowY") ?? SHADOW_DEFAULT.y,
|
|
562
|
+
blur: get("shadowBlur") ?? SHADOW_DEFAULT.blur,
|
|
563
|
+
color: rgba("shadow.color", String(get("shadowColor") ?? SHADOW_COLOUR), values)
|
|
564
|
+
};
|
|
565
|
+
if (p.has("backdropBlur")) out.backdrop = { blur: get("backdropBlur") };
|
|
431
566
|
const text = {};
|
|
432
567
|
if (p.has("color")) text.textColor = colourOf("color");
|
|
433
568
|
for (const k of [
|
|
@@ -450,7 +585,7 @@ const VISIBLE = {
|
|
|
450
585
|
horizontal: 0,
|
|
451
586
|
vertical: 0
|
|
452
587
|
};
|
|
453
|
-
const isLeaf = (v) => typeof v !== "object" || Object.hasOwn(v, "r") || Object.hasOwn(v, "type");
|
|
588
|
+
const isLeaf = (v) => typeof v !== "object" || Array.isArray(v) || Object.hasOwn(v, "r") || Object.hasOwn(v, "type");
|
|
454
589
|
const pick = (full, mask) => Object.fromEntries(Object.keys(mask).map((k) => [k, isLeaf(mask[k]) ? full[k] : pick(full[k], mask[k])]));
|
|
455
590
|
const diff = (a, b) => {
|
|
456
591
|
const out = {};
|
|
@@ -486,7 +621,7 @@ const literalOf = (n, values) => {
|
|
|
486
621
|
};
|
|
487
622
|
const replacement = (n) => {
|
|
488
623
|
const out = literalOf(n);
|
|
489
|
-
if (!n.__clay.some(([k, v]) => COLOURS.has(k) && String(v).includes("var("))) return out;
|
|
624
|
+
if (!n.__clay.some(([k, v]) => (COLOURS.has(k) || k === "backgroundImage") && String(v).includes("var("))) return out;
|
|
490
625
|
const themes = {};
|
|
491
626
|
for (const { label, values } of together({
|
|
492
627
|
themed: tables.themed,
|
|
@@ -530,6 +665,9 @@ const SHAPE = /* @__PURE__ */ new Set([
|
|
|
530
665
|
"clip",
|
|
531
666
|
"floating",
|
|
532
667
|
"image",
|
|
668
|
+
"backgroundImage",
|
|
669
|
+
"shadow",
|
|
670
|
+
"backdrop",
|
|
533
671
|
"aspectRatio",
|
|
534
672
|
"text",
|
|
535
673
|
"themes",
|
|
@@ -559,6 +697,9 @@ const header = (styles) => {
|
|
|
559
697
|
const base = Object.fromEntries(Object.entries(v).filter(([k]) => !STATES.includes(k)));
|
|
560
698
|
for (const [suffix, shape] of [["", base], ...STATES.flatMap((s) => v[s] ? [[`_${s.slice(1)}`, merge(base, v[s])]] : [])]) {
|
|
561
699
|
const { text, ...decl } = shape;
|
|
700
|
+
delete decl.shadow;
|
|
701
|
+
delete decl.backdrop;
|
|
702
|
+
delete decl.backgroundImage;
|
|
562
703
|
if (Object.keys(decl).length) lines.push(`static const Clay_ElementDeclaration ${name}${suffix}${theme} = ${c("", decl)};`);
|
|
563
704
|
if (text) lines.push(`static const Clay_TextElementConfig ${name}${suffix}_text${theme} = ${c("", text)};`);
|
|
564
705
|
}
|
|
@@ -573,5 +714,4 @@ const header = (styles) => {
|
|
|
573
714
|
}
|
|
574
715
|
return `${lines.join("\n")}\n`;
|
|
575
716
|
};
|
|
576
|
-
|
|
577
|
-
export { active, alignItems, backgroundColor, bg, border, borderColor, borderRadius, borderWidth, cn, color, createGlobalTheme, createTokens, flexDirection, float, focus, fontSize, fonts, gap, header, height, hover, image, justifyContent, letterSpacing, lineHeight, overflow, p, padding, paddingBlock, paddingBottom, paddingInline, paddingLeft, paddingRight, paddingTop, pb, pl, pr, pt, textAlign, whiteSpace, width };
|
|
717
|
+
export { active, alignItems, backdrop, backgroundColor, backgroundImage, bg, border, borderColor, borderRadius, borderWidth, cn, color, createGlobalTheme, createTokens, flexDirection, float, focus, fontSize, fonts, gap, header, height, hover, image, justifyContent, letterSpacing, lineHeight, overflow, p, padding, paddingBlock, paddingBottom, paddingInline, paddingLeft, paddingRight, paddingTop, pb, pl, pr, pt, shadow, textAlign, whiteSpace, width };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clampRgb, modeA98, modeHsl, modeHwb, modeLab, modeLch, modeLrgb, modeOklab, modeOklch, modeP3, modeProphoto, modeRec2020, modeRgb, modeXyz50, modeXyz65, parse, useMode, wcagLuminance } from "culori/fn";
|
|
2
|
-
|
|
2
|
+
// src/color.ts
|
|
3
3
|
for (const mode of [
|
|
4
4
|
modeRgb,
|
|
5
5
|
modeHsl,
|
|
@@ -25,5 +25,4 @@ const luminance = (text) => {
|
|
|
25
25
|
};
|
|
26
26
|
const ratio = (a, b) => (Math.max(a, b) + .05) / (Math.min(a, b) + .05);
|
|
27
27
|
const shown = (r) => (Math.floor(r * 100) / 100).toFixed(2);
|
|
28
|
-
//#endregion
|
|
29
28
|
export { shown as i, parseColor as n, ratio as r, luminance as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as luminance, n as parseColor, r as ratio, i as shown } from "./color-BB8ipynT.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as registry, d as MacroError, o as warn } from "./registry-
|
|
2
|
-
import { l as layerStatements } from "./sheet-
|
|
1
|
+
import { a as registry, d as MacroError, o as warn } from "./registry-8sYvlzyn.mjs";
|
|
2
|
+
import { l as layerStatements } from "./sheet-qCuMvyUo.mjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
|
-
|
|
4
|
+
// src/contrast.ts
|
|
5
5
|
const VAR = /var\((--[^\s,)]+)\)/g;
|
|
6
6
|
const valueOf = (state, name, values) => {
|
|
7
7
|
const def = state.defs.get(name);
|
|
@@ -70,7 +70,7 @@ const verify = (check, state, { luminance, ratio, shown }) => {
|
|
|
70
70
|
const verifyChecks = Effect.fnUntraced(function* (select) {
|
|
71
71
|
const checks = [...registry.checks.values()].filter(select);
|
|
72
72
|
if (!checks.length) return;
|
|
73
|
-
const colours = yield* Effect.promise(() => import("./color-
|
|
73
|
+
const colours = yield* Effect.promise(() => import("./color-DNL0XuEi.mjs"));
|
|
74
74
|
for (const check of checks) {
|
|
75
75
|
const errors = verify(check, registry, colours);
|
|
76
76
|
if (errors.length) return yield* new MacroError({
|
|
@@ -79,5 +79,4 @@ const verifyChecks = Effect.fnUntraced(function* (select) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
//#endregion
|
|
83
82
|
export { valueOf as n, verifyChecks as r, together as t };
|
package/dist/derived.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/derived.d.ts
|
|
2
1
|
type Space = "srgb" | "srgb-linear" | "oklab" | "oklch" | "lab";
|
|
3
2
|
export interface Color {
|
|
4
3
|
s: Space;
|
|
@@ -10,5 +9,4 @@ export declare const KEY = "--_derived";
|
|
|
10
9
|
export declare const evaluate: (text: string, get?: (name: string) => string | Color) => Color;
|
|
11
10
|
export declare const css: (c: Color) => string;
|
|
12
11
|
declare const _default: () => void;
|
|
13
|
-
//#endregion
|
|
14
12
|
export { _default as default };
|
package/dist/derived.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/derived.ts
|
|
2
2
|
/** The custom property of :root that carries the data (derived-data.ts writes it). */
|
|
3
3
|
const KEY = "--_derived";
|
|
4
4
|
const mul = (m, v) => [
|
|
@@ -387,5 +387,4 @@ var derived_default = () => {
|
|
|
387
387
|
};
|
|
388
388
|
if (!go()) addEventListener("load", go, { once: true });
|
|
389
389
|
};
|
|
390
|
-
//#endregion
|
|
391
390
|
export { KEY, css, derived_default as default, evaluate };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, relative, sep } from "node:path";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
-
|
|
3
|
+
// src/devtools-link.ts
|
|
4
4
|
/**
|
|
5
5
|
* The repository of an app is the workspace of its sessions: the nearest folder up with a `.git` (a file in a worktree).
|
|
6
6
|
* @param {string} from a folder
|
|
@@ -90,5 +90,4 @@ const attach = (git, id, sessionID) => {
|
|
|
90
90
|
writeFileSync(file, JSON.stringify({ sessionID }));
|
|
91
91
|
} else rmSync(file, { force: true });
|
|
92
92
|
};
|
|
93
|
-
//#endregion
|
|
94
93
|
export { servers as a, serverId as i, gitRoot as n, sessionOf as o, register as r, attach as t };
|
package/dist/devtools-link.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/devtools-link.d.ts
|
|
2
1
|
/** A running dev server, as it announced itself. */
|
|
3
2
|
export interface DevServer {
|
|
4
3
|
id: string;
|
|
@@ -51,5 +50,4 @@ export declare const sessionOf: (git: string, id: string) => string | undefined;
|
|
|
51
50
|
* @param {string} [sessionID] the session; none detaches
|
|
52
51
|
* @returns {void}
|
|
53
52
|
*/
|
|
54
|
-
export declare const attach: (git: string, id: string, sessionID?: string) => void;
|
|
55
|
-
//#endregion
|
|
53
|
+
export declare const attach: (git: string, id: string, sessionID?: string) => void;
|
package/dist/devtools-link.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { attach, gitRoot, register, serverId, servers, sessionOf };
|
|
1
|
+
export { t as attach, n as gitRoot, r as register, i as serverId, a as servers, o as sessionOf } from "./devtools-link-DN91p7g5.mjs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/errors.d.ts
|
|
2
1
|
declare const MacroError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
2
|
readonly _tag: "MacroError";
|
|
4
3
|
} & Readonly<A>;
|
|
@@ -28,5 +27,4 @@ declare class ContrastError extends ContrastError_base<{
|
|
|
28
27
|
/** The colour as given. */
|
|
29
28
|
readonly colour: string;
|
|
30
29
|
}> {}
|
|
31
|
-
//#endregion
|
|
32
30
|
export { ImportError as n, MacroError as r, ContrastError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { scope } from "cssints/plugin";
|
|
2
|
-
|
|
2
|
+
// src/frame.ts
|
|
3
3
|
const registered = (names) => names.map((n) => `@property --_${n} { syntax: "<length>"; inherits: false; initial-value: 0px; }`).join("\n");
|
|
4
4
|
const inner = "max(var(--_x) - var(--_p) - var(--_b), 0px)";
|
|
5
5
|
const outer = (parent) => `max(var(${parent}, calc(var(--_r) + var(--_m))) - var(--_m), 0px)`;
|
|
@@ -88,5 +88,4 @@ const frameScope = scope("frame", {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
const { frame } = frameScope.export();
|
|
91
|
-
//#endregion
|
|
92
91
|
export { frameScope as n, frame as t };
|
package/dist/frame.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/frame.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* `frame().radius(t.radius.lg).padding(4).border("1px").margin(2)`: a box whose radius follows from the frames around it
|
|
4
3
|
* (`radius` is the radius of the outermost frame; inside, it is the parent's inner radius less the margin). `padding` and
|
|
@@ -68,5 +67,4 @@ export declare const frame: () => import("cssints/plugin").Chain<"frame", {
|
|
|
68
67
|
readonly spacing: true;
|
|
69
68
|
readonly emit: (v: string) => [string, string][];
|
|
70
69
|
};
|
|
71
|
-
}, {}>;
|
|
72
|
-
//#endregion
|
|
70
|
+
}, {}>;
|
package/dist/frame.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { frame, frameScope };
|
|
1
|
+
export { t as frame, n as frameScope } from "./frame-DqwCA4OH.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./theme-types-CplLnGgG.mjs";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { $p as
|
|
1
|
+
import { $p as CheckFn, Qp as Arg, am as Check, cm as Part, em as CheckMath, lm as Style, nm as Result, rm as Text$1, sm as Fallback, tm as Fn, um as Text } from "./theme-types-CplLnGgG.mjs";
|
|
2
2
|
import { properties } from "@cssints/css-grammar/mdn";
|
|
3
3
|
import { CSSStyleValue } from "@cssints/css-grammar/values";
|
|
4
4
|
import { QueryKind, ValidQuery } from "@cssints/css-grammar/query";
|
|
5
|
-
//#region src/group-types.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* What a group bans. `kw`: by property, its keywords, and `name(` for a function only that property has; `fn`: functions
|
|
8
7
|
* (anywhere); `unit`; `media`, `container`, `supports`: the words of a query (`scroll-state(`).
|
|
@@ -51,5 +50,4 @@ interface GCondition<B extends Ban, K extends QueryKind, R> {
|
|
|
51
50
|
<const Q extends readonly [string, string, ...string[]]>(...queries: { [I in keyof Q]: GQ<B, K, Q[I]>; }): { [I in keyof Q]: R; };
|
|
52
51
|
<const Q extends string>(query: GQ<B, K, Q>): R;
|
|
53
52
|
}
|
|
54
|
-
//#endregion
|
|
55
53
|
export { GProp as a, GMath as i, GFn as n, GLayout as r, GCondition as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as GProp, r as GLayout, t as GCondition } from "../../group-types-
|
|
3
|
-
import "../../group-common-
|
|
1
|
+
import { A as Steps, B as keyframes, C as CvValue, E as PositionTry, I as cv, J as within, K as token, L as firstThatWorks, M as attr, N as cn, O as QueryWrap, R as global, S as CvProps, U as style, X as FlexMethods, Y as ClassValue, _ as CSSStyleValue, a as DtcgUnit, c as Tokens, cm as Part, d as createTokens, f as layers, g as CSSImageValue, h as CSSColorValue, i as DtcgShadow, j as Wrap, k as StateWrap, l as check, lm as Style, m as CSS, n as DtcgColor, o as DtcgValue, p as AttrOp, r as DtcgCubicBezier, s as Overrides, sm as Fallback, t as CheckOverrides, u as createGlobalTheme, v as CSSUnitValue, w as Keyframes, x as CvConfig, z as group } from "../../theme-types-CplLnGgG.mjs";
|
|
2
|
+
import { a as GProp, r as GLayout, t as GCondition } from "../../group-types-BBaZ8dwy.mjs";
|
|
3
|
+
import "../../group-common-CTUs5yym.mjs";
|
|
4
4
|
import { active, alignContent, alignItems, alignSelf, animation, animationDelay, animationDirection, animationDuration, animationFillMode, animationIterationCount, animationName, animationPlayState, animationTimingFunction, attrFn, backgroundAttachment, backgroundClip, backgroundColor, backgroundImage, backgroundOrigin, backgroundPosition, backgroundRepeat, backgroundSize, bg, border, borderBottom, borderBottomColor, borderBottomLeftRadius, borderBottomRightRadius, borderBottomStyle, borderBottomWidth, borderCollapse, borderColor, borderImage, borderImageOutset, borderImageSlice, borderImageSource, borderImageWidth, borderLeft, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRadius, borderRight, borderRightColor, borderRightStyle, borderRightWidth, borderSpacing, borderStyle, borderTop, borderTopColor, borderTopLeftRadius, borderTopRightRadius, borderTopStyle, borderTopWidth, borderWidth, bottom, boxShadow, boxSizing, calc, captionSide, checked, clear, color, colorFn, columnGap, content, counter, counterIncrement, counterReset, counters, cubicBezier, direction, disabled, display, empty, emptyCells, enabled, firstChild, firstOfType, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, float, floodColor, floodOpacity, focus, font, fontFamily, fontSize, fontStyle, fontWeight, height, hover, hsl, hsla, image, inRange, indeterminate, invalid, justifyContent, lastChild, lastOfType, left, letterSpacing, lightingColor, lineHeight, linearGradient, link, listStyle, listStyleImage, listStylePosition, listStyleType, m, margin, marginBottom, marginLeft, marginRight, marginTop, matrix, matrix3d, maxHeight, maxWidth, mb, minHeight, minWidth, ml, mr, mt, onlyChild, onlyOfType, opacity, optional, order, outOfRange, outlineColor, outlineStyle, outlineWidth, overflow, overflowX, overflowY, p, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, pb, perspective, perspectiveFn, perspectiveOrigin, pl, pointerEvents, position, pr, pt, quotes, radialGradient, repeatingLinearGradient, repeatingRadialGradient, required, rgb, rgba, right, root, rotate3d, rotateFn, rotateX, rotateY, rotateZ, scale3d, scaleFn, scaleX, scaleY, scaleZ, skew, skewX, skewY, steps, supports, tableLayout, target, textAlign, textIndent, textOverflow, textShadow, textTransform, top, transform, transformOrigin, transformStyle, transition, transitionDelay, transitionDuration, transitionProperty, transitionTimingFunction, translate3d, translateFn, translateX, translateY, translateZ, unicodeBidi, url, valid, verticalAlign, visibility, visited, width, wordBreak, wordSpacing, zIndex } from "../baseline-2015.mjs";
|
|
5
5
|
import { properties } from "@cssints/css-grammar/mdn";
|
|
6
|
-
//#region src/groups/baseline-2015/with-downstream.d.ts
|
|
7
6
|
type B = {
|
|
8
7
|
id: "baseline-2015/with-downstream";
|
|
9
8
|
kw: {
|
|
@@ -77,5 +76,4 @@ export declare const textDecoration: P<"text-decoration">;
|
|
|
77
76
|
export declare const whiteSpace: P<"white-space">;
|
|
78
77
|
export declare const media: GCondition<B, "media", QueryWrap>;
|
|
79
78
|
export declare const flex: GLayout<B, "flex", Pick<FlexMethods, "direction" | "wrap" | "flow" | "alignItems" | "alignContent" | "justifyContent" | "columnGap">>;
|
|
80
|
-
//#endregion
|
|
81
79
|
export { type AttrOp, type CSS, type CSSColorValue, type CSSImageValue, type CSSStyleValue, type CSSUnitValue, CheckOverrides, type ClassValue, type CvConfig, type CvProps, type CvValue, DtcgColor, DtcgCubicBezier, DtcgShadow, DtcgUnit, DtcgValue, type Fallback, type Keyframes, Overrides, type Part, type PositionTry, type QueryWrap, type StateWrap, type Steps, type Style, Tokens, type Wrap, active, alignContent, alignItems, alignSelf, animation, animationDelay, animationDirection, animationDuration, animationFillMode, animationIterationCount, animationName, animationPlayState, animationTimingFunction, attr, attrFn, backgroundAttachment, backgroundClip, backgroundColor, backgroundImage, backgroundOrigin, backgroundPosition, backgroundRepeat, backgroundSize, bg, border, borderBottom, borderBottomColor, borderBottomLeftRadius, borderBottomRightRadius, borderBottomStyle, borderBottomWidth, borderCollapse, borderColor, borderImage, borderImageOutset, borderImageSlice, borderImageSource, borderImageWidth, borderLeft, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRadius, borderRight, borderRightColor, borderRightStyle, borderRightWidth, borderSpacing, borderStyle, borderTop, borderTopColor, borderTopLeftRadius, borderTopRightRadius, borderTopStyle, borderTopWidth, borderWidth, bottom, boxShadow, boxSizing, calc, captionSide, check, checked, clear, cn, color, colorFn, columnGap, content, counter, counterIncrement, counterReset, counters, createGlobalTheme, createTokens, cubicBezier, cv, direction, disabled, display, empty, emptyCells, enabled, firstChild, firstOfType, firstThatWorks, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, float, floodColor, floodOpacity, focus, font, fontFamily, fontSize, fontStyle, fontWeight, global, group, height, hover, hsl, hsla, image, inRange, indeterminate, invalid, justifyContent, keyframes, lastChild, lastOfType, layers, left, letterSpacing, lightingColor, lineHeight, linearGradient, link, listStyle, listStyleImage, listStylePosition, listStyleType, m, margin, marginBottom, marginLeft, marginRight, marginTop, matrix, matrix3d, maxHeight, maxWidth, mb, minHeight, minWidth, ml, mr, mt, onlyChild, onlyOfType, opacity, optional, order, outOfRange, outlineColor, outlineStyle, outlineWidth, overflow, overflowX, overflowY, p, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, pb, perspective, perspectiveFn, perspectiveOrigin, pl, pointerEvents, position, pr, pt, quotes, radialGradient, repeatingLinearGradient, repeatingRadialGradient, required, rgb, rgba, right, root, rotate3d, rotateFn, rotateX, rotateY, rotateZ, scale3d, scaleFn, scaleX, scaleY, scaleZ, skew, skewX, skewY, steps, style, supports, tableLayout, target, textAlign, textIndent, textOverflow, textShadow, textTransform, token, top, transform, transformOrigin, transformStyle, transition, transitionDelay, transitionDuration, transitionProperty, transitionTimingFunction, translate3d, translateFn, translateX, translateY, translateZ, unicodeBidi, url, valid, verticalAlign, visibility, visited, width, within, wordBreak, wordSpacing, zIndex };
|