cssints 0.3.1 → 0.4.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/README.md +1 -1
- package/dist/check.mjs +2 -2
- package/dist/clay-types.d.mts +207 -0
- package/dist/clay.d.mts +40 -0
- package/dist/clay.mjs +550 -0
- package/dist/{contrast-B49XCnVX.mjs → contrast-DLi4pp25.mjs} +2 -2
- package/dist/group-common-3PAVTxpd.d.mts +1 -0
- package/dist/{group-types-9ttphdku.d.mts → group-types-Dn9CIR8J.d.mts} +1 -1
- package/dist/groups/baseline-2015/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2015.d.mts +3 -3
- package/dist/groups/baseline-2016/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2016.d.mts +3 -3
- package/dist/groups/baseline-2017/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2017.d.mts +3 -3
- package/dist/groups/baseline-2018/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2018.d.mts +3 -3
- package/dist/groups/baseline-2019/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2019.d.mts +3 -3
- package/dist/groups/baseline-2020/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2020.d.mts +3 -3
- package/dist/groups/baseline-2021/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2021.d.mts +3 -3
- package/dist/groups/baseline-2022/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2022.d.mts +3 -3
- package/dist/groups/baseline-2023/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2023.d.mts +3 -3
- package/dist/groups/baseline-2024/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2024.d.mts +3 -3
- package/dist/groups/baseline-2025/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2025.d.mts +3 -3
- 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 -3
- package/dist/groups/css-align-3.d.mts +3 -3
- package/dist/groups/css-anchor-position-1.d.mts +3 -3
- package/dist/groups/css-anchor-position-2.d.mts +3 -3
- package/dist/groups/css-animations-1.d.mts +3 -3
- package/dist/groups/css-animations-2.d.mts +3 -3
- package/dist/groups/css-backgrounds-3.d.mts +3 -3
- package/dist/groups/css-backgrounds-4.d.mts +3 -3
- package/dist/groups/css-borders-4.d.mts +3 -3
- package/dist/groups/css-box-4.d.mts +3 -3
- package/dist/groups/css-break-4.d.mts +3 -3
- package/dist/groups/css-cascade-5.d.mts +3 -3
- package/dist/groups/css-cascade-6.d.mts +3 -3
- package/dist/groups/css-color-4.d.mts +3 -3
- package/dist/groups/css-color-5.d.mts +3 -3
- package/dist/groups/css-color-6.d.mts +3 -3
- package/dist/groups/css-color-adjust-1.d.mts +3 -3
- package/dist/groups/css-color-hdr-1.d.mts +3 -3
- package/dist/groups/css-conditional-3.d.mts +3 -3
- package/dist/groups/css-conditional-4.d.mts +3 -3
- package/dist/groups/css-conditional-5.d.mts +3 -3
- package/dist/groups/css-contain-2.d.mts +3 -3
- package/dist/groups/css-content-3.d.mts +3 -3
- package/dist/groups/css-counter-styles-3.d.mts +3 -3
- package/dist/groups/css-display-4.d.mts +3 -3
- package/dist/groups/css-easing-2.d.mts +3 -3
- package/dist/groups/css-env-1.d.mts +3 -3
- package/dist/groups/css-flexbox-1.d.mts +3 -3
- package/dist/groups/css-fonts-4.d.mts +3 -3
- package/dist/groups/css-fonts-5.d.mts +3 -3
- package/dist/groups/css-forms-1.d.mts +3 -3
- package/dist/groups/css-gaps-1.d.mts +3 -3
- package/dist/groups/css-gcpm-3.d.mts +3 -3
- package/dist/groups/css-gcpm-4.d.mts +3 -3
- package/dist/groups/css-grid-2.d.mts +3 -3
- package/dist/groups/css-grid-3.d.mts +3 -3
- package/dist/groups/css-images-3.d.mts +3 -3
- package/dist/groups/css-images-4.d.mts +3 -3
- package/dist/groups/css-images-5.d.mts +3 -3
- package/dist/groups/css-inline-3.d.mts +3 -3
- package/dist/groups/css-lists-3.d.mts +3 -3
- package/dist/groups/css-logical-1.d.mts +3 -3
- package/dist/groups/css-masking-1.d.mts +3 -3
- package/dist/groups/css-multicol-2.d.mts +3 -3
- package/dist/groups/css-overflow-3.d.mts +3 -3
- package/dist/groups/css-overflow-4.d.mts +3 -3
- package/dist/groups/css-overflow-5.d.mts +3 -3
- package/dist/groups/css-overscroll-1.d.mts +3 -3
- package/dist/groups/css-page-3.d.mts +3 -3
- package/dist/groups/css-page-floats-3.d.mts +3 -3
- package/dist/groups/css-position-3.d.mts +3 -3
- package/dist/groups/css-position-4.d.mts +3 -3
- package/dist/groups/css-rhythm-1.d.mts +3 -3
- package/dist/groups/css-round-display-1.d.mts +3 -3
- package/dist/groups/css-ruby-1.d.mts +3 -3
- package/dist/groups/css-scroll-anchoring-1.d.mts +3 -3
- package/dist/groups/css-scroll-snap-1.d.mts +3 -3
- package/dist/groups/css-scroll-snap-2.d.mts +3 -3
- package/dist/groups/css-scrollbars-1.d.mts +3 -3
- package/dist/groups/css-shapes-1.d.mts +3 -3
- package/dist/groups/css-shapes-2.d.mts +3 -3
- package/dist/groups/css-size-adjust-1.d.mts +3 -3
- package/dist/groups/css-sizing-3.d.mts +3 -3
- package/dist/groups/css-sizing-4.d.mts +3 -3
- package/dist/groups/css-speech-1.d.mts +3 -3
- package/dist/groups/css-tables-3.d.mts +3 -3
- package/dist/groups/css-text-3.d.mts +3 -3
- package/dist/groups/css-text-4.d.mts +3 -3
- package/dist/groups/css-text-decor-3.d.mts +3 -3
- package/dist/groups/css-text-decor-4.d.mts +3 -3
- package/dist/groups/css-transforms-1.d.mts +3 -3
- package/dist/groups/css-transforms-2.d.mts +3 -3
- package/dist/groups/css-transitions-1.d.mts +3 -3
- package/dist/groups/css-transitions-2.d.mts +3 -3
- package/dist/groups/css-ui-4.d.mts +3 -3
- package/dist/groups/css-values-4.d.mts +3 -3
- package/dist/groups/css-values-5.d.mts +3 -3
- package/dist/groups/css-variables-2.d.mts +2 -2
- package/dist/groups/css-view-transitions-2.d.mts +3 -3
- package/dist/groups/css-viewport.d.mts +3 -3
- package/dist/groups/css-will-change-1.d.mts +3 -3
- package/dist/groups/css-writing-modes-4.d.mts +3 -3
- package/dist/groups/css2.d.mts +3 -3
- package/dist/groups/fill-stroke-3.d.mts +3 -3
- package/dist/groups/filter-effects-1.d.mts +3 -3
- package/dist/groups/filter-effects-2.d.mts +3 -3
- package/dist/groups/limited-availability.d.mts +1 -1
- package/dist/groups/mediaqueries-4.d.mts +3 -3
- package/dist/groups/mediaqueries-5.d.mts +3 -3
- package/dist/groups/motion-1.d.mts +3 -3
- package/dist/groups/newly-available/with-downstream.d.mts +3 -3
- package/dist/groups/newly-available.d.mts +3 -3
- package/dist/groups/not-discouraged.d.mts +3 -3
- package/dist/groups/scroll-animations-1.d.mts +3 -3
- package/dist/groups/selectors-4.d.mts +2 -2
- package/dist/groups/selectors-5.d.mts +2 -2
- package/dist/groups/widely-available/with-downstream.d.mts +3 -3
- package/dist/groups/widely-available.d.mts +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +12 -5
- package/dist/{instrument-BqIZpbIU.mjs → instrument-C7Am_dJ3.mjs} +1 -1
- package/dist/{lowered-aJVapQT6.mjs → lowered-CKSYUc0i.mjs} +1 -1
- package/dist/{node-OJ_w_Usj.d.mts → node-BABEZ2oF.d.mts} +6 -0
- package/dist/plugin-types.d.mts +1 -1
- package/dist/plugin.d.mts +1 -1
- package/dist/{registry-BUSEO32-.mjs → registry-ByrYF2v5.mjs} +5 -1
- package/dist/{scope-INuJD4RT.d.mts → scope-1R_Np2Mj.d.mts} +5 -6
- package/dist/{sheet-BeHdq4xt.mjs → sheet-BT2R1wk_.mjs} +2 -2
- package/dist/surface.d.mts +1 -1
- package/dist/{theme-SlQ73rFL.mjs → theme-WGcgMD4V.mjs} +7 -5
- package/dist/{theme-types-Bqv0Ggz_.d.mts → theme-types-BY0mRf3K.d.mts} +5 -6
- package/dist/tui-types.d.mts +1 -1
- package/dist/tui.mjs +4 -4
- package/dist/types.d.mts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +4 -4
- package/docs/API.md +100 -1
- package/package.json +6 -2
- package/skills/cssints/references/plugins.md +12 -0
- package/dist/group-common-9zpBxfUF.d.mts +0 -1
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ and Cursor. The skills use it when it is configured and work without it.
|
|
|
191
191
|
bun install
|
|
192
192
|
bun run test # all packages (vp run -r test, cached where possible); includes the type-check of the code in docs/API.md and this file
|
|
193
193
|
bun run bench # type instantiation budgets (tsc and tsgo)
|
|
194
|
-
bun run check # format, lint, type-check (vp check), then the Effect diagnostics (bun run typecheck)
|
|
194
|
+
bun run check # format, lint, type-check (vp check), then tsc 7 with the Effect diagnostics (bun run typecheck)
|
|
195
195
|
bun run diff:check # the added lines against master: anti-slop rules, key-file changes (tools/ai-automation)
|
|
196
196
|
cd apps/demo && bun run dev
|
|
197
197
|
cd apps/docs && bun run dev # the documentation site, on the pages of README.md and docs/API.md
|
package/dist/check.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as ContrastError } from "./registry-
|
|
2
|
-
import { t as fallbackOf } from "./lowered-
|
|
1
|
+
import { s as ContrastError } from "./registry-ByrYF2v5.mjs";
|
|
2
|
+
import { t as fallbackOf } from "./lowered-CKSYUc0i.mjs";
|
|
3
3
|
import { i as shown, r as ratio, t as luminance } from "./color-BYIxVLlS.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/check.ts
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { d as createTokens, om as Part, rm as Check, s as Overrides, t as CheckOverrides } from "./theme-types-BY0mRf3K.mjs";
|
|
2
|
+
//#region src/clay-types.d.ts
|
|
3
|
+
/** A number of pixels, or `"Npx"`. */
|
|
4
|
+
export type Px = number | `${number}px`;
|
|
5
|
+
/** Pixels, `N%` of the parent, `auto` (Clay's FIT) or `stretch` (Clay's GROW). */
|
|
6
|
+
export type Size = Px | `${number}%` | "auto" | "stretch";
|
|
7
|
+
export type Align = "flex-start" | "start" | "center" | "flex-end" | "end";
|
|
8
|
+
/** A point of an element: `"left top"`, `"center center"`, `"right bottom"`, ... (Clay's `CLAY_ATTACH_POINT_LEFT_TOP`). */
|
|
9
|
+
export type AttachPoint = `${"left" | "center" | "right"} ${"top" | "center" | "bottom"}`;
|
|
10
|
+
type AttachPointType = "LEFT_TOP" | "LEFT_CENTER" | "LEFT_BOTTOM" | "CENTER_TOP" | "CENTER_CENTER" | "CENTER_BOTTOM" | "RIGHT_TOP" | "RIGHT_CENTER" | "RIGHT_BOTTOM";
|
|
11
|
+
/** The options of `float()`: every one is optional. */
|
|
12
|
+
export type FloatOptions = {
|
|
13
|
+
/** Which point of the floating element sits on which point of its parent. Default: `left top` on `left top`. */
|
|
14
|
+
attach?: {
|
|
15
|
+
element?: AttachPoint;
|
|
16
|
+
parent?: AttachPoint;
|
|
17
|
+
};
|
|
18
|
+
/** Moves the element from where `attach` puts it, in pixels (a negative one goes left or up). Default: 0, 0. */
|
|
19
|
+
offset?: {
|
|
20
|
+
x?: Px;
|
|
21
|
+
y?: Px;
|
|
22
|
+
};
|
|
23
|
+
/** Grows the element's own box, not its children's, in pixels (not negative). Default: 0, 0. */
|
|
24
|
+
expand?: {
|
|
25
|
+
width?: Px;
|
|
26
|
+
height?: Px;
|
|
27
|
+
};
|
|
28
|
+
/** Drawn in ascending order, with all the element's children. Default: 0. A whole number of `int16_t`. */
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
/** `false` lets the pointer through to what lies under the element. Default: `true`. */
|
|
31
|
+
capture?: boolean;
|
|
32
|
+
/** `"parent"` clips the element to the box its parent is clipped to. Default: `"none"`. */
|
|
33
|
+
clip?: "none" | "parent";
|
|
34
|
+
} & ({
|
|
35
|
+
/** The string of the element's `CLAY_ID("...")`, ASCII. Default: the element the float is a child of. */
|
|
36
|
+
parent?: string;
|
|
37
|
+
root?: never;
|
|
38
|
+
} | {
|
|
39
|
+
/** Attach to the layout's root: absolute positioning, or a dialog centred on the screen. */
|
|
40
|
+
root?: boolean;
|
|
41
|
+
parent?: never;
|
|
42
|
+
});
|
|
43
|
+
interface Rgba {
|
|
44
|
+
r: number;
|
|
45
|
+
g: number;
|
|
46
|
+
b: number;
|
|
47
|
+
a: number;
|
|
48
|
+
}
|
|
49
|
+
interface Axis {
|
|
50
|
+
type: "FIT" | "GROW" | "PERCENT" | "FIXED";
|
|
51
|
+
min?: number;
|
|
52
|
+
max?: number;
|
|
53
|
+
percent?: number;
|
|
54
|
+
}
|
|
55
|
+
interface Sides {
|
|
56
|
+
left: number;
|
|
57
|
+
right: number;
|
|
58
|
+
top: number;
|
|
59
|
+
bottom: number;
|
|
60
|
+
}
|
|
61
|
+
/** The fields of `Clay_ElementDeclaration`, and of `Clay_TextElementConfig` under `text`. */
|
|
62
|
+
export interface ClayFields {
|
|
63
|
+
layout?: {
|
|
64
|
+
sizing?: {
|
|
65
|
+
width?: Axis;
|
|
66
|
+
height?: Axis;
|
|
67
|
+
};
|
|
68
|
+
padding?: Sides;
|
|
69
|
+
childGap?: number;
|
|
70
|
+
childAlignment?: {
|
|
71
|
+
x?: "LEFT" | "CENTER" | "RIGHT";
|
|
72
|
+
y?: "TOP" | "CENTER" | "BOTTOM";
|
|
73
|
+
};
|
|
74
|
+
layoutDirection?: "LEFT_TO_RIGHT" | "TOP_TO_BOTTOM";
|
|
75
|
+
};
|
|
76
|
+
backgroundColor?: Rgba;
|
|
77
|
+
cornerRadius?: {
|
|
78
|
+
topLeft: number;
|
|
79
|
+
topRight: number;
|
|
80
|
+
bottomRight: number;
|
|
81
|
+
bottomLeft: number;
|
|
82
|
+
};
|
|
83
|
+
border?: {
|
|
84
|
+
color?: Rgba;
|
|
85
|
+
width: Sides;
|
|
86
|
+
};
|
|
87
|
+
clip?: {
|
|
88
|
+
horizontal: number;
|
|
89
|
+
vertical: number;
|
|
90
|
+
};
|
|
91
|
+
floating?: {
|
|
92
|
+
offset?: {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number;
|
|
95
|
+
};
|
|
96
|
+
expand?: {
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
};
|
|
100
|
+
parentId?: number;
|
|
101
|
+
zIndex?: number;
|
|
102
|
+
attachPoints?: {
|
|
103
|
+
element: AttachPointType;
|
|
104
|
+
parent: AttachPointType;
|
|
105
|
+
};
|
|
106
|
+
pointerCaptureMode?: "CAPTURE" | "PASSTHROUGH";
|
|
107
|
+
attachTo: "PARENT" | "ELEMENT_WITH_ID" | "ROOT";
|
|
108
|
+
clipTo?: "NONE" | "ATTACHED_PARENT";
|
|
109
|
+
};
|
|
110
|
+
text?: {
|
|
111
|
+
textColor?: Rgba;
|
|
112
|
+
fontId?: number;
|
|
113
|
+
fontSize?: number;
|
|
114
|
+
letterSpacing?: number;
|
|
115
|
+
lineHeight?: number;
|
|
116
|
+
textAlignment?: "LEFT" | "CENTER" | "RIGHT";
|
|
117
|
+
wrapMode?: "WORDS" | "NEWLINES" | "NONE";
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
type Partly<T> = { [K in keyof T]?: T[K] extends Rgba | Axis ? T[K] : Partly<T[K]>; };
|
|
121
|
+
/** What a state sets over the base: the fields it touches, at their values there. */
|
|
122
|
+
export type ClayOverlay = Partly<ClayFields>;
|
|
123
|
+
/** Clay's fields with the overlay of each state. */
|
|
124
|
+
export interface ClayLayer extends ClayFields {
|
|
125
|
+
":hover"?: ClayOverlay;
|
|
126
|
+
":focus"?: ClayOverlay;
|
|
127
|
+
":active"?: ClayOverlay;
|
|
128
|
+
}
|
|
129
|
+
/** What a Clay style compiles to: its fields, its state overlays, and per theme (by name) the colours it changes. */
|
|
130
|
+
export interface ClayShape extends ClayLayer {
|
|
131
|
+
themes?: Record<string, Partly<ClayLayer>>;
|
|
132
|
+
}
|
|
133
|
+
/** What every member of cssints/clay returns. */
|
|
134
|
+
export type ClayStyle = ClayShape & {
|
|
135
|
+
readonly "~clay": true;
|
|
136
|
+
};
|
|
137
|
+
type Colour = <const A extends readonly Part[]>(...parts: Check<"color", A>) => ClayStyle;
|
|
138
|
+
type One<V> = (value: V) => ClayStyle;
|
|
139
|
+
type Four<V> = (...values: [V] | [V, V] | [V, V, V] | [V, V, V, V]) => ClayStyle;
|
|
140
|
+
type Pair<V> = (...values: [V] | [V, V]) => ClayStyle;
|
|
141
|
+
export declare const backgroundColor: Colour;
|
|
142
|
+
/** `background-color`. */
|
|
143
|
+
export declare const bg: Colour;
|
|
144
|
+
/** The colour of the text in the element (Clay's `textColor`). */
|
|
145
|
+
export declare const color: Colour;
|
|
146
|
+
export declare const borderColor: Colour;
|
|
147
|
+
export declare const width: One<Size>;
|
|
148
|
+
export declare const height: One<Size>;
|
|
149
|
+
export declare const padding: Four<Px>;
|
|
150
|
+
export declare const p: Four<Px>;
|
|
151
|
+
export declare const paddingInline: Pair<Px>;
|
|
152
|
+
export declare const paddingBlock: Pair<Px>;
|
|
153
|
+
export declare const paddingTop: One<Px>;
|
|
154
|
+
export declare const paddingRight: One<Px>;
|
|
155
|
+
export declare const paddingBottom: One<Px>;
|
|
156
|
+
export declare const paddingLeft: One<Px>;
|
|
157
|
+
export declare const pt: One<Px>;
|
|
158
|
+
export declare const pr: One<Px>;
|
|
159
|
+
export declare const pb: One<Px>;
|
|
160
|
+
export declare const pl: One<Px>;
|
|
161
|
+
/** Clay's `childGap`. */
|
|
162
|
+
export declare const gap: One<Px>;
|
|
163
|
+
export declare const flexDirection: One<"row" | "column">;
|
|
164
|
+
export declare const justifyContent: One<Align>;
|
|
165
|
+
export declare const alignItems: One<Align>;
|
|
166
|
+
/** 1 to 4 radii: top-left, top-right, bottom-right, bottom-left, as in CSS. */
|
|
167
|
+
export declare const borderRadius: Four<Px>;
|
|
168
|
+
export declare const borderWidth: Four<Px>;
|
|
169
|
+
/** A border of that width and colour on every side. */
|
|
170
|
+
export declare const border: <const A extends readonly Part[]>(width: Px, ...color: Check<"color", A>) => ClayStyle;
|
|
171
|
+
/** `hidden` clips the children (Clay's `clip`). */
|
|
172
|
+
export declare const overflow: One<"visible" | "hidden">;
|
|
173
|
+
export declare const fontSize: One<Px>;
|
|
174
|
+
export declare const letterSpacing: One<Px>;
|
|
175
|
+
export declare const lineHeight: One<Px>;
|
|
176
|
+
export declare const textAlign: One<"left" | "center" | "right">;
|
|
177
|
+
/** `normal` wraps words, `pre-line` only at newlines, `nowrap` never. */
|
|
178
|
+
export declare const whiteSpace: One<"normal" | "pre-line" | "nowrap">;
|
|
179
|
+
/**
|
|
180
|
+
* Makes the element float above the others (Clay's `floating`), and sets `attachTo`: to the element it is a child of, to
|
|
181
|
+
* the one `parent` names, or to the root. A float is out of the flow of its siblings and of its parent's size.
|
|
182
|
+
*/
|
|
183
|
+
export declare const float: (options?: FloatOptions) => ClayStyle;
|
|
184
|
+
/** Merges styles in argument order: a later prop wins. */
|
|
185
|
+
export declare const cn: (...styles: ClayStyle[]) => ClayStyle;
|
|
186
|
+
/** Under the pointer: header() prints the style with it as `<name>_hover`. States do not nest. */
|
|
187
|
+
export declare const hover: (...styles: ClayStyle[]) => ClayStyle;
|
|
188
|
+
/** Focused: `<name>_focus`. */
|
|
189
|
+
export declare const focus: (...styles: ClayStyle[]) => ClayStyle;
|
|
190
|
+
/** Pressed: `<name>_active`. */
|
|
191
|
+
export declare const active: (...styles: ClayStyle[]) => ClayStyle;
|
|
192
|
+
/**
|
|
193
|
+
* The app's fonts in the order of its font array: a style per name that sets Clay's `fontId`, and the list, which
|
|
194
|
+
* header() prints as an enum `<export>_<font>`. Each name is a C identifier.
|
|
195
|
+
*/
|
|
196
|
+
export declare const fonts: <const N extends readonly [string, ...string[]]>(...names: N) => { readonly [K in N[number]]: ClayStyle; } & {
|
|
197
|
+
readonly fonts: N;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* A theme of cssints/clay's tokens, by a name that is a C identifier: header() prints every style again, the name
|
|
201
|
+
* appended (`<style>_<name>`, `<style>_hover_<name>`, `<style>_text_<name>`). It applies to the styles evaluated after it.
|
|
202
|
+
*/
|
|
203
|
+
export declare const createGlobalTheme: <const X extends object, const O extends Overrides<X>>(tokens: X, name: string, overrides: O & CheckOverrides<X, O>) => void;
|
|
204
|
+
/** The styles of a built module as a C header: `CLAY(id, name)` and `CLAY_TEXT(s, name_text)`. */
|
|
205
|
+
export declare const header: (styles: Record<string, unknown>) => string;
|
|
206
|
+
//#endregion
|
|
207
|
+
export { createTokens };
|
package/dist/clay.d.mts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/clay.d.ts
|
|
2
|
+
export declare const createTokens: (...args: unknown[]) => unknown;
|
|
3
|
+
export declare const createGlobalTheme: (...args: unknown[]) => Readonly<{
|
|
4
|
+
__done: true;
|
|
5
|
+
}>;
|
|
6
|
+
type Value = string | number;
|
|
7
|
+
type State = "" | ":hover" | ":focus" | ":active";
|
|
8
|
+
type Entry = [key: string, value: Value, state: State];
|
|
9
|
+
interface ClayNode {
|
|
10
|
+
__clay: Entry[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Merges styles in argument order: a later prop wins.
|
|
14
|
+
*
|
|
15
|
+
* @returns {ClayNode} the merged style
|
|
16
|
+
*/
|
|
17
|
+
export declare const cn: (...styles: unknown[]) => ClayNode;
|
|
18
|
+
export declare const hover: (...styles: unknown[]) => ClayNode;
|
|
19
|
+
export declare const focus: (...styles: unknown[]) => ClayNode;
|
|
20
|
+
export declare const active: (...styles: unknown[]) => ClayNode;
|
|
21
|
+
/**
|
|
22
|
+
* The fonts of the app, in the order of its font array: `fonts("Roboto", "Mono").Mono` is a style that sets Clay's
|
|
23
|
+
* `fontId` to 1, and header() prints the order as an enum, `<name>_Mono`.
|
|
24
|
+
*
|
|
25
|
+
* @returns {Record<string, unknown>} a style per font, by name, and the list
|
|
26
|
+
*/
|
|
27
|
+
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;
|
|
29
|
+
/**
|
|
30
|
+
* The styles of a module as C: a `Clay_ElementDeclaration` per export, and a `Clay_TextElementConfig` named
|
|
31
|
+
* `<name>_text` for one that sets text props, for `CLAY(id, name)` and `CLAY_TEXT(s, name_text)`. A state is a whole
|
|
32
|
+
* declaration of its own, `<name>_hover` (`_focus`, `_active`, and `<name>_hover_text`); a theme is a whole set of
|
|
33
|
+
* them again, its name last (`<name>_<theme>`, `<name>_hover_<theme>`, `<name>_text_<theme>`), for every style once
|
|
34
|
+
* the module has a theme, so a page picks a theme by appending its name. The fonts of `fonts()` are an enum, `<name>_<font>`, in their order.
|
|
35
|
+
*
|
|
36
|
+
* @param {Record<string, unknown>} styles the exports of a built module of cssints/clay styles
|
|
37
|
+
* @returns {string} a C header that includes clay.h
|
|
38
|
+
*/
|
|
39
|
+
export declare const header: (styles: Record<string, unknown>) => string;
|
|
40
|
+
//#endregion
|