cssints 0.3.1 → 0.5.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 +3 -2
- package/dist/check.mjs +2 -2
- package/dist/clay-types.d.mts +232 -0
- package/dist/clay.d.mts +40 -0
- package/dist/clay.mjs +577 -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 +134 -2
- 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
|
@@ -148,7 +148,7 @@ export const Row = ({ wide, on }: { wide?: boolean; on?: boolean }) => (
|
|
|
148
148
|
|
|
149
149
|
### In a terminal
|
|
150
150
|
|
|
151
|
-
`import * as css from "cssints/tui" with { type: "cssints" }` gives the members a terminal has (cells, colours, borders, flex, states, `cursor`), and the plugin compiles them to prop objects for [OpenTUI](https://opentui.com) renderables instead of classes; `@cssints/tui` applies their states and themes: [packages/tui](packages/tui/README.md), docs/API.md "TUI".
|
|
151
|
+
`import * as css from "cssints/tui" with { type: "cssints" }` gives the members a terminal has (cells, colours, borders, flex, states, `cursor`), and the plugin compiles them to prop objects for [OpenTUI](https://opentui.com) renderables instead of classes; `@cssints/tui` applies their states and themes: [packages/tui](packages/tui/README.md), docs/API.md "TUI". The package to apply them, `@cssints/tui`, is **deprecated** in favour of [cssints-native](https://github.com/alexeiaccio/cssints-native)'s `terminal/` target (Clay in cells, termbox2); its README says what carries over and how to run the replacement.
|
|
152
152
|
|
|
153
153
|
More in [docs/API.md](docs/API.md): property names and short names, `flex()` and `grid()` chains, conditions and layers, tokens and themes, `cn` and `cv`, and the errors you can get.
|
|
154
154
|
|
|
@@ -181,6 +181,7 @@ and Cursor. The skills use it when it is configured and work without it.
|
|
|
181
181
|
| `packages/css-grammar` | Type-level recognizer and its runtime twin over mdn-data grammars, Typed OM values, browser support and prose rules |
|
|
182
182
|
| `packages/icons` | `@cssints/icons`: icons from iconify JSON collections or SVG folders, a mask style with no runtime |
|
|
183
183
|
| `packages/mise-en-mode` | `@cssints/mise-en-mode`: looks as themes in the layers app < author < viewer, on `data-mode` scopes, checked against the tokens and by `check.contrast` |
|
|
184
|
+
| `packages/tui` | `@cssints/tui` (**deprecated**): the runtime of `cssints/tui` styles on OpenTUI and @bomb.sh/tty; cssints-native's `terminal/` replaces it |
|
|
184
185
|
| `apps/demo` | React demo of every 0.1 feature |
|
|
185
186
|
| `apps/docs` | The documentation site: this file and `docs/API.md` as pages, with search and type hovers (`cd apps/docs && bun run dev`) |
|
|
186
187
|
| `docs/research`, `docs/archive` | Comparisons with other libraries; outdated plans |
|
|
@@ -191,7 +192,7 @@ and Cursor. The skills use it when it is configured and work without it.
|
|
|
191
192
|
bun install
|
|
192
193
|
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
194
|
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)
|
|
195
|
+
bun run check # format, lint, type-check (vp check), then tsc 7 with the Effect diagnostics (bun run typecheck)
|
|
195
196
|
bun run diff:check # the added lines against master: anti-slop rules, key-file changes (tools/ai-automation)
|
|
196
197
|
cd apps/demo && bun run dev
|
|
197
198
|
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,232 @@
|
|
|
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
|
+
/** The options of `image()`: the image's size in pixels, and how it fills its box. */
|
|
44
|
+
export type ImageOptions = {
|
|
45
|
+
/** The image's width in whole pixels: the element's box starts at the image's own size. */
|
|
46
|
+
width: Px;
|
|
47
|
+
/** The image's height in whole pixels. */
|
|
48
|
+
height: Px;
|
|
49
|
+
/**
|
|
50
|
+
* `"fill"` stretches the image into a box another style gives it; `"contain"` sets Clay's `aspectRatio` to the
|
|
51
|
+
* image's, so a box that grows keeps its proportions. Default: `"fill"`, as CSS's `object-fit`.
|
|
52
|
+
*/
|
|
53
|
+
fit?: "fill" | "contain";
|
|
54
|
+
};
|
|
55
|
+
interface Rgba {
|
|
56
|
+
r: number;
|
|
57
|
+
g: number;
|
|
58
|
+
b: number;
|
|
59
|
+
a: number;
|
|
60
|
+
}
|
|
61
|
+
interface Axis {
|
|
62
|
+
type: "FIT" | "GROW" | "PERCENT" | "FIXED";
|
|
63
|
+
min?: number;
|
|
64
|
+
max?: number;
|
|
65
|
+
percent?: number;
|
|
66
|
+
}
|
|
67
|
+
interface Sides {
|
|
68
|
+
left: number;
|
|
69
|
+
right: number;
|
|
70
|
+
top: number;
|
|
71
|
+
bottom: number;
|
|
72
|
+
}
|
|
73
|
+
/** The fields of `Clay_ElementDeclaration`, and of `Clay_TextElementConfig` under `text`. */
|
|
74
|
+
export interface ClayFields {
|
|
75
|
+
layout?: {
|
|
76
|
+
sizing?: {
|
|
77
|
+
width?: Axis;
|
|
78
|
+
height?: Axis;
|
|
79
|
+
};
|
|
80
|
+
padding?: Sides;
|
|
81
|
+
childGap?: number;
|
|
82
|
+
childAlignment?: {
|
|
83
|
+
x?: "LEFT" | "CENTER" | "RIGHT";
|
|
84
|
+
y?: "TOP" | "CENTER" | "BOTTOM";
|
|
85
|
+
};
|
|
86
|
+
layoutDirection?: "LEFT_TO_RIGHT" | "TOP_TO_BOTTOM";
|
|
87
|
+
};
|
|
88
|
+
backgroundColor?: Rgba;
|
|
89
|
+
cornerRadius?: {
|
|
90
|
+
topLeft: number;
|
|
91
|
+
topRight: number;
|
|
92
|
+
bottomRight: number;
|
|
93
|
+
bottomLeft: number;
|
|
94
|
+
};
|
|
95
|
+
border?: {
|
|
96
|
+
color?: Rgba;
|
|
97
|
+
width: Sides;
|
|
98
|
+
};
|
|
99
|
+
clip?: {
|
|
100
|
+
horizontal: number;
|
|
101
|
+
vertical: number;
|
|
102
|
+
};
|
|
103
|
+
/** `Clay_ImageElementConfig`: `imageData` is the path of the image, which the renderer loads. */
|
|
104
|
+
image?: {
|
|
105
|
+
imageData: string;
|
|
106
|
+
};
|
|
107
|
+
aspectRatio?: {
|
|
108
|
+
aspectRatio: number;
|
|
109
|
+
};
|
|
110
|
+
floating?: {
|
|
111
|
+
offset?: {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
};
|
|
115
|
+
expand?: {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
};
|
|
119
|
+
parentId?: number;
|
|
120
|
+
zIndex?: number;
|
|
121
|
+
attachPoints?: {
|
|
122
|
+
element: AttachPointType;
|
|
123
|
+
parent: AttachPointType;
|
|
124
|
+
};
|
|
125
|
+
pointerCaptureMode?: "CAPTURE" | "PASSTHROUGH";
|
|
126
|
+
attachTo: "PARENT" | "ELEMENT_WITH_ID" | "ROOT";
|
|
127
|
+
clipTo?: "NONE" | "ATTACHED_PARENT";
|
|
128
|
+
};
|
|
129
|
+
text?: {
|
|
130
|
+
textColor?: Rgba;
|
|
131
|
+
fontId?: number;
|
|
132
|
+
fontSize?: number;
|
|
133
|
+
letterSpacing?: number;
|
|
134
|
+
lineHeight?: number;
|
|
135
|
+
textAlignment?: "LEFT" | "CENTER" | "RIGHT";
|
|
136
|
+
wrapMode?: "WORDS" | "NEWLINES" | "NONE";
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
type Partly<T> = { [K in keyof T]?: T[K] extends Rgba | Axis ? T[K] : Partly<T[K]>; };
|
|
140
|
+
/** What a state sets over the base: the fields it touches, at their values there. */
|
|
141
|
+
export type ClayOverlay = Partly<ClayFields>;
|
|
142
|
+
/** Clay's fields with the overlay of each state. */
|
|
143
|
+
export interface ClayLayer extends ClayFields {
|
|
144
|
+
":hover"?: ClayOverlay;
|
|
145
|
+
":focus"?: ClayOverlay;
|
|
146
|
+
":active"?: ClayOverlay;
|
|
147
|
+
}
|
|
148
|
+
/** What a Clay style compiles to: its fields, its state overlays, and per theme (by name) the colours it changes. */
|
|
149
|
+
export interface ClayShape extends ClayLayer {
|
|
150
|
+
themes?: Record<string, Partly<ClayLayer>>;
|
|
151
|
+
}
|
|
152
|
+
/** What every member of cssints/clay returns. */
|
|
153
|
+
export type ClayStyle = ClayShape & {
|
|
154
|
+
readonly "~clay": true;
|
|
155
|
+
};
|
|
156
|
+
type Colour = <const A extends readonly Part[]>(...parts: Check<"color", A>) => ClayStyle;
|
|
157
|
+
type One<V> = (value: V) => ClayStyle;
|
|
158
|
+
type Four<V> = (...values: [V] | [V, V] | [V, V, V] | [V, V, V, V]) => ClayStyle;
|
|
159
|
+
type Pair<V> = (...values: [V] | [V, V]) => ClayStyle;
|
|
160
|
+
export declare const backgroundColor: Colour;
|
|
161
|
+
/** `background-color`. */
|
|
162
|
+
export declare const bg: Colour;
|
|
163
|
+
/** The colour of the text in the element (Clay's `textColor`). */
|
|
164
|
+
export declare const color: Colour;
|
|
165
|
+
export declare const borderColor: Colour;
|
|
166
|
+
export declare const width: One<Size>;
|
|
167
|
+
export declare const height: One<Size>;
|
|
168
|
+
export declare const padding: Four<Px>;
|
|
169
|
+
export declare const p: Four<Px>;
|
|
170
|
+
export declare const paddingInline: Pair<Px>;
|
|
171
|
+
export declare const paddingBlock: Pair<Px>;
|
|
172
|
+
export declare const paddingTop: One<Px>;
|
|
173
|
+
export declare const paddingRight: One<Px>;
|
|
174
|
+
export declare const paddingBottom: One<Px>;
|
|
175
|
+
export declare const paddingLeft: One<Px>;
|
|
176
|
+
export declare const pt: One<Px>;
|
|
177
|
+
export declare const pr: One<Px>;
|
|
178
|
+
export declare const pb: One<Px>;
|
|
179
|
+
export declare const pl: One<Px>;
|
|
180
|
+
/** Clay's `childGap`. */
|
|
181
|
+
export declare const gap: One<Px>;
|
|
182
|
+
export declare const flexDirection: One<"row" | "column">;
|
|
183
|
+
export declare const justifyContent: One<Align>;
|
|
184
|
+
export declare const alignItems: One<Align>;
|
|
185
|
+
/** 1 to 4 radii: top-left, top-right, bottom-right, bottom-left, as in CSS. */
|
|
186
|
+
export declare const borderRadius: Four<Px>;
|
|
187
|
+
export declare const borderWidth: Four<Px>;
|
|
188
|
+
/** A border of that width and colour on every side. */
|
|
189
|
+
export declare const border: <const A extends readonly Part[]>(width: Px, ...color: Check<"color", A>) => ClayStyle;
|
|
190
|
+
/** `hidden` clips the children (Clay's `clip`). */
|
|
191
|
+
export declare const overflow: One<"visible" | "hidden">;
|
|
192
|
+
export declare const fontSize: One<Px>;
|
|
193
|
+
export declare const letterSpacing: One<Px>;
|
|
194
|
+
export declare const lineHeight: One<Px>;
|
|
195
|
+
export declare const textAlign: One<"left" | "center" | "right">;
|
|
196
|
+
/** `normal` wraps words, `pre-line` only at newlines, `nowrap` never. */
|
|
197
|
+
export declare const whiteSpace: One<"normal" | "pre-line" | "nowrap">;
|
|
198
|
+
/**
|
|
199
|
+
* Makes the element float above the others (Clay's `floating`), and sets `attachTo`: to the element it is a child of, to
|
|
200
|
+
* the one `parent` names, or to the root. A float is out of the flow of its siblings and of its parent's size.
|
|
201
|
+
*/
|
|
202
|
+
export declare const float: (options?: FloatOptions) => ClayStyle;
|
|
203
|
+
/**
|
|
204
|
+
* An image element: the path it is loaded from, and its size in whole pixels, which is the element's box. `fit`
|
|
205
|
+
* `"contain"` keeps its proportions in a box another style grows (Clay's `aspectRatio`); the path is passed to the
|
|
206
|
+
* renderer as `imageData`.
|
|
207
|
+
*/
|
|
208
|
+
export declare const image: (src: string, options: ImageOptions) => ClayStyle;
|
|
209
|
+
/** Merges styles in argument order: a later prop wins. */
|
|
210
|
+
export declare const cn: (...styles: ClayStyle[]) => ClayStyle;
|
|
211
|
+
/** Under the pointer: header() prints the style with it as `<name>_hover`. States do not nest. */
|
|
212
|
+
export declare const hover: (...styles: ClayStyle[]) => ClayStyle;
|
|
213
|
+
/** Focused: `<name>_focus`. */
|
|
214
|
+
export declare const focus: (...styles: ClayStyle[]) => ClayStyle;
|
|
215
|
+
/** Pressed: `<name>_active`. */
|
|
216
|
+
export declare const active: (...styles: ClayStyle[]) => ClayStyle;
|
|
217
|
+
/**
|
|
218
|
+
* The app's fonts in the order of its font array: a style per name that sets Clay's `fontId`, and the list, which
|
|
219
|
+
* header() prints as an enum `<export>_<font>`. Each name is a C identifier.
|
|
220
|
+
*/
|
|
221
|
+
export declare const fonts: <const N extends readonly [string, ...string[]]>(...names: N) => { readonly [K in N[number]]: ClayStyle; } & {
|
|
222
|
+
readonly fonts: N;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* A theme of cssints/clay's tokens, by a name that is a C identifier: header() prints every style again, the name
|
|
226
|
+
* appended (`<style>_<name>`, `<style>_hover_<name>`, `<style>_text_<name>`). It applies to the styles evaluated after it.
|
|
227
|
+
*/
|
|
228
|
+
export declare const createGlobalTheme: <const X extends object, const O extends Overrides<X>>(tokens: X, name: string, overrides: O & CheckOverrides<X, O>) => void;
|
|
229
|
+
/** The styles of a built module as a C header: `CLAY(id, name)` and `CLAY_TEXT(s, name_text)`. */
|
|
230
|
+
export declare const header: (styles: Record<string, unknown>) => string;
|
|
231
|
+
//#endregion
|
|
232
|
+
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, image: ((...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
|