cssints 0.0.0-stage → 0.2.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.
Files changed (148) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +188 -2
  3. package/dist/author-types-C1AhsnrT.d.mts +80 -0
  4. package/dist/check.d.mts +22 -0
  5. package/dist/check.mjs +37 -0
  6. package/dist/color-BYIxVLlS.mjs +29 -0
  7. package/dist/color-C8OzjAeg.mjs +2 -0
  8. package/dist/contrast-DhK69Xak.mjs +83 -0
  9. package/dist/derived.d.mts +14 -0
  10. package/dist/derived.mjs +391 -0
  11. package/dist/errors-D4ZbcwRo.d.mts +32 -0
  12. package/dist/frame-BoBKjgBB.mjs +92 -0
  13. package/dist/frame.d.mts +72 -0
  14. package/dist/frame.mjs +2 -0
  15. package/dist/group-common-9zpBxfUF.d.mts +1 -0
  16. package/dist/group-types-9ttphdku.d.mts +55 -0
  17. package/dist/groups/compositing-2.d.mts +20 -0
  18. package/dist/groups/css-align-3.d.mts +29 -0
  19. package/dist/groups/css-anchor-position-1.d.mts +49 -0
  20. package/dist/groups/css-anchor-position-2.d.mts +50 -0
  21. package/dist/groups/css-animations-1.d.mts +28 -0
  22. package/dist/groups/css-animations-2.d.mts +29 -0
  23. package/dist/groups/css-backgrounds-3.d.mts +27 -0
  24. package/dist/groups/css-backgrounds-4.d.mts +29 -0
  25. package/dist/groups/css-borders-4.d.mts +95 -0
  26. package/dist/groups/css-box-4.d.mts +38 -0
  27. package/dist/groups/css-break-4.d.mts +23 -0
  28. package/dist/groups/css-cascade-5.d.mts +18 -0
  29. package/dist/groups/css-cascade-6.d.mts +18 -0
  30. package/dist/groups/css-color-4.d.mts +29 -0
  31. package/dist/groups/css-color-5.d.mts +32 -0
  32. package/dist/groups/css-color-6.d.mts +32 -0
  33. package/dist/groups/css-color-adjust-1.d.mts +20 -0
  34. package/dist/groups/css-color-hdr-1.d.mts +19 -0
  35. package/dist/groups/css-conditional-3.d.mts +17 -0
  36. package/dist/groups/css-conditional-4.d.mts +17 -0
  37. package/dist/groups/css-conditional-5.d.mts +22 -0
  38. package/dist/groups/css-contain-2.d.mts +19 -0
  39. package/dist/groups/css-content-3.d.mts +23 -0
  40. package/dist/groups/css-counter-styles-3.d.mts +16 -0
  41. package/dist/groups/css-display-4.d.mts +22 -0
  42. package/dist/groups/css-easing-2.d.mts +18 -0
  43. package/dist/groups/css-env-1.d.mts +16 -0
  44. package/dist/groups/css-flexbox-1.d.mts +24 -0
  45. package/dist/groups/css-fonts-4.d.mts +46 -0
  46. package/dist/groups/css-fonts-5.d.mts +44 -0
  47. package/dist/groups/css-forms-1.d.mts +19 -0
  48. package/dist/groups/css-gaps-1.d.mts +21 -0
  49. package/dist/groups/css-gcpm-3.d.mts +20 -0
  50. package/dist/groups/css-gcpm-4.d.mts +20 -0
  51. package/dist/groups/css-grid-2.d.mts +34 -0
  52. package/dist/groups/css-grid-3.d.mts +34 -0
  53. package/dist/groups/css-images-3.d.mts +25 -0
  54. package/dist/groups/css-images-4.d.mts +32 -0
  55. package/dist/groups/css-images-5.d.mts +33 -0
  56. package/dist/groups/css-inline-3.d.mts +28 -0
  57. package/dist/groups/css-lists-3.d.mts +26 -0
  58. package/dist/groups/css-logical-1.d.mts +35 -0
  59. package/dist/groups/css-masking-1.d.mts +37 -0
  60. package/dist/groups/css-multicol-2.d.mts +24 -0
  61. package/dist/groups/css-overflow-3.d.mts +28 -0
  62. package/dist/groups/css-overflow-4.d.mts +29 -0
  63. package/dist/groups/css-overflow-5.d.mts +31 -0
  64. package/dist/groups/css-overscroll-1.d.mts +22 -0
  65. package/dist/groups/css-page-3.d.mts +18 -0
  66. package/dist/groups/css-page-floats-3.d.mts +19 -0
  67. package/dist/groups/css-position-3.d.mts +29 -0
  68. package/dist/groups/css-position-4.d.mts +30 -0
  69. package/dist/groups/css-rhythm-1.d.mts +18 -0
  70. package/dist/groups/css-round-display-1.d.mts +16 -0
  71. package/dist/groups/css-ruby-1.d.mts +21 -0
  72. package/dist/groups/css-scroll-anchoring-1.d.mts +18 -0
  73. package/dist/groups/css-scroll-snap-1.d.mts +42 -0
  74. package/dist/groups/css-scroll-snap-2.d.mts +43 -0
  75. package/dist/groups/css-scrollbars-1.d.mts +19 -0
  76. package/dist/groups/css-shapes-1.d.mts +27 -0
  77. package/dist/groups/css-shapes-2.d.mts +27 -0
  78. package/dist/groups/css-size-adjust-1.d.mts +18 -0
  79. package/dist/groups/css-sizing-3.d.mts +34 -0
  80. package/dist/groups/css-sizing-4.d.mts +33 -0
  81. package/dist/groups/css-speech-1.d.mts +18 -0
  82. package/dist/groups/css-tables-3.d.mts +22 -0
  83. package/dist/groups/css-text-3.d.mts +36 -0
  84. package/dist/groups/css-text-4.d.mts +40 -0
  85. package/dist/groups/css-text-decor-3.d.mts +30 -0
  86. package/dist/groups/css-text-decor-4.d.mts +31 -0
  87. package/dist/groups/css-transforms-1.d.mts +31 -0
  88. package/dist/groups/css-transforms-2.d.mts +48 -0
  89. package/dist/groups/css-transitions-1.d.mts +22 -0
  90. package/dist/groups/css-transitions-2.d.mts +23 -0
  91. package/dist/groups/css-ui-4.d.mts +35 -0
  92. package/dist/groups/css-values-4.d.mts +38 -0
  93. package/dist/groups/css-values-5.d.mts +43 -0
  94. package/dist/groups/css-variables-2.d.mts +6 -0
  95. package/dist/groups/css-view-transitions-2.d.mts +20 -0
  96. package/dist/groups/css-viewport.d.mts +18 -0
  97. package/dist/groups/css-will-change-1.d.mts +18 -0
  98. package/dist/groups/css-writing-modes-4.d.mts +22 -0
  99. package/dist/groups/css2.d.mts +19 -0
  100. package/dist/groups/fill-stroke-3.d.mts +27 -0
  101. package/dist/groups/filter-effects-1.d.mts +32 -0
  102. package/dist/groups/filter-effects-2.d.mts +33 -0
  103. package/dist/groups/limited-availability.d.mts +2 -0
  104. package/dist/groups/mediaqueries-4.d.mts +16 -0
  105. package/dist/groups/mediaqueries-5.d.mts +16 -0
  106. package/dist/groups/motion-1.d.mts +24 -0
  107. package/dist/groups/newly-available.d.mts +631 -0
  108. package/dist/groups/not-discouraged.d.mts +727 -0
  109. package/dist/groups/scroll-animations-1.d.mts +30 -0
  110. package/dist/groups/selectors-4.d.mts +54 -0
  111. package/dist/groups/selectors-5.d.mts +54 -0
  112. package/dist/groups/widely-available.d.mts +616 -0
  113. package/dist/index.d.mts +48 -0
  114. package/dist/index.mjs +1269 -0
  115. package/dist/instrument-gCazujmb.mjs +1624 -0
  116. package/dist/lowered-D2KusPLp.mjs +28 -0
  117. package/dist/node-OJ_w_Usj.d.mts +233 -0
  118. package/dist/parent-vars.d.mts +13 -0
  119. package/dist/parent-vars.mjs +65 -0
  120. package/dist/plugin-types.d.mts +377 -0
  121. package/dist/plugin.d.mts +3 -0
  122. package/dist/plugin.mjs +30 -0
  123. package/dist/registry-CTumHB8p.mjs +73 -0
  124. package/dist/runtime-Dt4Tm0Q7.d.mts +19 -0
  125. package/dist/runtime.d.mts +18 -0
  126. package/dist/runtime.mjs +25 -0
  127. package/dist/scope-ZVhUxQH1.d.mts +2101 -0
  128. package/dist/sheet-BKsMTa0c.mjs +757 -0
  129. package/dist/surface.d.mts +228 -0
  130. package/dist/surface.mjs +101 -0
  131. package/dist/theme-BsP2E4LB.mjs +929 -0
  132. package/dist/theme-types-Bqv0Ggz_.d.mts +1808 -0
  133. package/dist/trace-otlp-CbKFDsn9.mjs +14 -0
  134. package/dist/tui-types.d.mts +181 -0
  135. package/dist/tui.d.mts +23 -0
  136. package/dist/tui.mjs +427 -0
  137. package/dist/types.d.mts +2 -0
  138. package/dist/vite.d.mts +134 -0
  139. package/dist/vite.mjs +977 -0
  140. package/docs/API.md +1193 -0
  141. package/package.json +85 -4
  142. package/skills/cssints/SKILL.md +203 -0
  143. package/skills/cssints/references/errors.md +86 -0
  144. package/skills/cssints/references/plugins.md +91 -0
  145. package/skills/cssints/references/tokens.md +91 -0
  146. package/skills/cssints-plugin/SKILL.md +177 -0
  147. package/skills/cssints-plugin/references/table.md +124 -0
  148. package/skills/cssints-plugin/references/testing.md +122 -0
@@ -0,0 +1,391 @@
1
+ //#region src/derived.ts
2
+ /** The custom property of :root that carries the data (derived-data.ts writes it). */
3
+ const KEY = "--_derived";
4
+ const mul = (m, v) => [
5
+ 0,
6
+ 3,
7
+ 6
8
+ ].map((r) => v.reduce((s, x, k) => s + m[r + k] * x, 0));
9
+ const lin = (c) => {
10
+ const a = Math.abs(c);
11
+ return (a <= .04045 ? a / 12.92 : ((a + .055) / 1.055) ** 2.4) * Math.sign(c);
12
+ };
13
+ const gam = (c) => {
14
+ const a = Math.abs(c);
15
+ return (a <= .0031308 ? a * 12.92 : 1.055 * a ** (1 / 2.4) - .055) * Math.sign(c);
16
+ };
17
+ const rad = Math.PI / 180;
18
+ const rect = ([l, c, h]) => [
19
+ l,
20
+ c * Math.cos(h * rad),
21
+ c * Math.sin(h * rad)
22
+ ];
23
+ const polar = ([l, a, b]) => {
24
+ const h = Math.atan2(b, a) / rad;
25
+ return [
26
+ l,
27
+ Math.hypot(a, b),
28
+ h < 0 ? h + 360 : h
29
+ ];
30
+ };
31
+ const LMS = [
32
+ .4122214708,
33
+ .5363325363,
34
+ .0514459929,
35
+ .2119034982,
36
+ .6806995451,
37
+ .1073969566,
38
+ .0883024619,
39
+ .2817188376,
40
+ .6299787005
41
+ ];
42
+ const OK = [
43
+ .2104542553,
44
+ .793617785,
45
+ -.0040720468,
46
+ 1.9779984951,
47
+ -2.428592205,
48
+ .4505937099,
49
+ .0259040371,
50
+ .7827717662,
51
+ -.808675766
52
+ ];
53
+ const LMS_I = [
54
+ 4.0767416621,
55
+ -3.3077115913,
56
+ .2309699292,
57
+ -1.2684380046,
58
+ 2.6097574011,
59
+ -.3413193965,
60
+ -.0041960863,
61
+ -.7034186147,
62
+ 1.707614701
63
+ ];
64
+ const OK_I = [
65
+ 1,
66
+ .3963377774,
67
+ .2158037573,
68
+ 1,
69
+ -.1055613458,
70
+ -.0638541728,
71
+ 1,
72
+ -.0894841775,
73
+ -1.291485548
74
+ ];
75
+ const XYZ = [
76
+ .436065743,
77
+ .385151469,
78
+ .143078454,
79
+ .222493192,
80
+ .716887054,
81
+ .0606197905,
82
+ .0139239045,
83
+ .0970812857,
84
+ .714099358
85
+ ];
86
+ const XYZ_I = [
87
+ 3.13413576,
88
+ -1.61738568,
89
+ -.49066242,
90
+ -.978795456,
91
+ 1.91625419,
92
+ .0334429841,
93
+ .071955413,
94
+ -.228976675,
95
+ 1.40538601
96
+ ];
97
+ const D50 = [
98
+ .9642956764295677,
99
+ 1,
100
+ .8251046025104602
101
+ ];
102
+ const E = 216 / 24389;
103
+ const K = 24389 / 27;
104
+ const to = {
105
+ "srgb-linear": (c) => c,
106
+ srgb: (c) => c.map(lin),
107
+ oklab: (c) => mul(LMS_I, mul(OK_I, c).map((v) => v ** 3)),
108
+ oklch: (c) => to.oklab(rect(c)),
109
+ lab: ([l, a, b]) => {
110
+ const y = (l + 16) / 116;
111
+ const f = [
112
+ a / 500 + y,
113
+ y,
114
+ y - b / 200
115
+ ];
116
+ return mul(XYZ_I, f.map((v, i) => D50[i] * (v ** 3 > E ? v ** 3 : (116 * v - 16) / K)));
117
+ }
118
+ };
119
+ const from = {
120
+ "srgb-linear": (c) => c,
121
+ srgb: (c) => c.map(gam),
122
+ oklab: (c) => mul(OK, mul(LMS, c).map(Math.cbrt)),
123
+ oklch: (c) => polar(from.oklab(c)),
124
+ lab: (c) => {
125
+ const f = mul(XYZ, c).map((v, i) => {
126
+ const x = v / D50[i];
127
+ return x > E ? Math.cbrt(x) : (K * x + 16) / 116;
128
+ });
129
+ return [
130
+ 116 * f[1] - 16,
131
+ 500 * (f[0] - f[1]),
132
+ 200 * (f[1] - f[2])
133
+ ];
134
+ }
135
+ };
136
+ const conv = (c, s) => c.s === s ? c : {
137
+ s,
138
+ c: from[s](to[c.s](c.c)),
139
+ a: c.a
140
+ };
141
+ const SPEC = {
142
+ srgb: ["rgb", [
143
+ 1,
144
+ 1,
145
+ 1
146
+ ]],
147
+ "srgb-linear": ["rgb", [
148
+ 1,
149
+ 1,
150
+ 1
151
+ ]],
152
+ oklab: ["lab", [
153
+ 1,
154
+ .4,
155
+ .4
156
+ ]],
157
+ oklch: ["lch", [
158
+ 1,
159
+ .4,
160
+ 360
161
+ ]],
162
+ lab: ["lab", [
163
+ 100,
164
+ 125,
165
+ 125
166
+ ]]
167
+ };
168
+ const NAMED = {
169
+ black: "#000",
170
+ white: "#fff",
171
+ transparent: "#0000"
172
+ };
173
+ const TOKEN = /[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:%|deg)?|#\w+|(?:--|-?)[a-z_][\w-]*|[^\s]/gi;
174
+ const fail = (x) => {
175
+ throw new Error(x);
176
+ };
177
+ const hex = (x) => {
178
+ const h = x.slice(1);
179
+ if (![
180
+ 3,
181
+ 4,
182
+ 6,
183
+ 8
184
+ ].includes(h.length) || /[^\da-f]/i.test(h)) return fail(x);
185
+ const n = h.length < 5 ? h.replace(/./g, "$&$&") : h;
186
+ const byte = (i) => parseInt(n.slice(i, i + 2), 16) / 255;
187
+ return {
188
+ s: "srgb",
189
+ c: [
190
+ byte(0),
191
+ byte(2),
192
+ byte(4)
193
+ ],
194
+ a: n.length > 6 ? byte(6) : 1
195
+ };
196
+ };
197
+ const evaluate = (text, get = (n) => fail(n)) => {
198
+ const t = text.match(TOKEN) ?? [];
199
+ let i = 0;
200
+ let pct = 1;
201
+ let env = {};
202
+ const next = () => t[i++] ?? fail(t[i - 2]);
203
+ const want = (s) => {
204
+ if (next() !== s) fail(t[i - 1]);
205
+ };
206
+ const input = () => {
207
+ want("(");
208
+ const v = get(next());
209
+ want(")");
210
+ return v;
211
+ };
212
+ const list = () => {
213
+ want("(");
214
+ const out = [sum()];
215
+ while (t[i] === ",") {
216
+ i++;
217
+ out.push(sum());
218
+ }
219
+ want(")");
220
+ return out;
221
+ };
222
+ const atom = () => {
223
+ const x = next();
224
+ if (/^[+-]?[\d.]/.test(x)) return parseFloat(x) * (x.endsWith("%") ? pct / 100 : 1);
225
+ if (x === "(") {
226
+ const v = sum();
227
+ want(")");
228
+ return v;
229
+ }
230
+ if (x === "calc") return atom();
231
+ if (x === "-") return -atom();
232
+ if (x === "clamp") {
233
+ const [lo, v, hi] = list();
234
+ return Math.max(lo, Math.min(v, hi));
235
+ }
236
+ if (x === "min") return Math.min(...list());
237
+ if (x === "max") return Math.max(...list());
238
+ if (x === "var") {
239
+ const v = input();
240
+ return typeof v === "string" && v ? Number(v) : fail(x);
241
+ }
242
+ if (x === "none") return 0;
243
+ return Object.hasOwn(env, x) ? env[x] : fail(x);
244
+ };
245
+ const prod = () => {
246
+ let v = atom();
247
+ for (let o = t[i]; o === "*" || o === "/"; o = t[i]) {
248
+ i++;
249
+ v = o === "*" ? v * atom() : v / atom();
250
+ }
251
+ return v;
252
+ };
253
+ const sum = () => {
254
+ let v = prod();
255
+ for (let o = t[i]; o === "+" || o === "-"; o = t[i]) {
256
+ i++;
257
+ v += o === "+" ? prod() : -prod();
258
+ }
259
+ return v;
260
+ };
261
+ const fn = (f) => {
262
+ want("(");
263
+ const origin = t[i] === "from" ? (i++, col()) : void 0;
264
+ const space = f === "color" ? next() : f === "rgb" || f === "rgba" ? "srgb" : f;
265
+ if (!Object.hasOwn(SPEC, space)) return fail(f === "color" ? space : f);
266
+ const [names, base] = SPEC[space];
267
+ const k = f[0] === "r" ? 255 : 1;
268
+ const src = origin && conv(origin, space);
269
+ env = src ? {
270
+ alpha: src.a,
271
+ ...Object.fromEntries([...names].map((n, j) => [n, src.c[j] * k]))
272
+ } : {};
273
+ const c = base.map((b, j) => {
274
+ if (j && t[i] === ",") i++;
275
+ pct = b * k;
276
+ return atom() / k;
277
+ });
278
+ let a = 1;
279
+ if (t[i] === "/" || t[i] === ",") {
280
+ i++;
281
+ pct = 1;
282
+ a = Math.min(1, Math.max(0, atom()));
283
+ }
284
+ want(")");
285
+ return {
286
+ s: space,
287
+ c,
288
+ a
289
+ };
290
+ };
291
+ const mix = () => {
292
+ want("(");
293
+ want("in");
294
+ const s = next();
295
+ if (s === "oklch" || !Object.hasOwn(SPEC, s)) return fail(s);
296
+ want(",");
297
+ const one = () => {
298
+ return [conv(col(), s), t[i]?.endsWith("%") ? parseFloat(next()) : void 0];
299
+ };
300
+ const [a, p] = one();
301
+ want(",");
302
+ const [b, q] = one();
303
+ want(")");
304
+ const x = p ?? 100 - (q ?? 50);
305
+ const y = q ?? 100 - x;
306
+ if (x + y !== 100) return fail("color-mix");
307
+ const al = (a.a * x + b.a * y) / 100;
308
+ return {
309
+ s,
310
+ c: a.c.map((v, j) => al ? (v * a.a * x + b.c[j] * b.a * y) / 100 / al : 0),
311
+ a: al
312
+ };
313
+ };
314
+ const col = () => {
315
+ const x = next();
316
+ if (x.startsWith("#")) return hex(x);
317
+ if (NAMED[x]) return hex(NAMED[x]);
318
+ if (x === "var") {
319
+ const v = input();
320
+ return typeof v === "string" ? evaluate(v, get) : v;
321
+ }
322
+ return x === "color-mix" ? mix() : fn(x);
323
+ };
324
+ const out = col();
325
+ if (i < t.length) fail(t[i]);
326
+ return out;
327
+ };
328
+ const css = (c) => {
329
+ const [r, g, b] = conv(c, "srgb").c.map((v) => Math.round(Math.min(1, Math.max(0, v)) * 255));
330
+ return `rgb(${r} ${g} ${b}${c.a < 1 ? ` / ${+c.a.toFixed(3)}` : ""})`;
331
+ };
332
+ var derived_default = () => {
333
+ if (typeof document === "undefined") return;
334
+ const root = document.documentElement;
335
+ const cs = getComputedStyle(root);
336
+ const written = /* @__PURE__ */ new Map();
337
+ let observer;
338
+ let raw = "";
339
+ let data;
340
+ let names;
341
+ const read = () => {
342
+ const v = cs.getPropertyValue(KEY).trim();
343
+ if (!v || v === raw) return !!v;
344
+ raw = v;
345
+ data = JSON.parse(v.slice(1, -1).replace(/\\(.)/g, "$1"));
346
+ names = [.../* @__PURE__ */ new Set([...Object.keys(data.b), ...data.t.flatMap(([, x]) => Object.keys(x))])];
347
+ return true;
348
+ };
349
+ const update = () => {
350
+ read();
351
+ const tpl = new Map(Object.entries(data.b));
352
+ for (const [cond, v] of data.t) if (cond.startsWith("@") ? matchMedia(cond.slice(6)).matches : root.matches(cond)) for (const n in v) if (v[n]) tpl.set(n, v[n]);
353
+ else tpl.delete(n);
354
+ for (const n of names) if (!tpl.has(n) && written.delete(n)) root.style.removeProperty(n);
355
+ const done = /* @__PURE__ */ new Map();
356
+ const get = (n) => {
357
+ let v = done.get(n);
358
+ if (v === void 0) {
359
+ const t = tpl.get(n);
360
+ done.set(n, v = t === void 0 ? cs.getPropertyValue(n).trim() || fail(n) : evaluate(t, get));
361
+ }
362
+ return v;
363
+ };
364
+ const next = [...tpl.keys()].map((n) => {
365
+ try {
366
+ return [n, css(get(n))];
367
+ } catch {
368
+ return [n, void 0];
369
+ }
370
+ });
371
+ for (const [n, v] of next) if (v === void 0) {
372
+ if (written.delete(n)) root.style.removeProperty(n);
373
+ } else if (written.get(n) !== v) {
374
+ written.set(n, v);
375
+ root.style.setProperty(n, v);
376
+ }
377
+ observer.takeRecords();
378
+ };
379
+ const go = () => {
380
+ if (!read()) return false;
381
+ if (data.p.every((p) => CSS.supports("color", p))) return true;
382
+ observer = new MutationObserver(update);
383
+ observer.observe(root, { attributes: true });
384
+ for (const [cond] of data.t) if (cond.startsWith("@")) matchMedia(cond.slice(6)).addEventListener("change", update);
385
+ update();
386
+ return true;
387
+ };
388
+ if (!go()) addEventListener("load", go, { once: true });
389
+ };
390
+ //#endregion
391
+ export { KEY, css, derived_default as default, evaluate };
@@ -0,0 +1,32 @@
1
+ //#region src/errors.d.ts
2
+ 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
+ readonly _tag: "MacroError";
4
+ } & Readonly<A>;
5
+ /** A css.* call, cv(), or a value in it is wrong. `file`, `site` (index) and `offset` name the call site, when known. */
6
+ declare class MacroError extends MacroError_base<{
7
+ readonly message: string;
8
+ readonly file?: string;
9
+ readonly site?: number;
10
+ readonly offset?: number;
11
+ readonly cause?: unknown;
12
+ }> {}
13
+ declare const ImportError_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 & {
14
+ readonly _tag: "ImportError";
15
+ } & Readonly<A>;
16
+ /** `import ... from "cssints"` without the attribute names something that only exists at build time. */
17
+ declare class ImportError extends ImportError_base<{
18
+ readonly message: string;
19
+ readonly file: string;
20
+ readonly offset: number;
21
+ }> {}
22
+ declare const ContrastError_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 & {
23
+ readonly _tag: "ContrastError";
24
+ } & Readonly<A>;
25
+ /** cssints/check `contrast`: a colour that has no contrast (one it cannot read, or a translucent one). */
26
+ declare class ContrastError extends ContrastError_base<{
27
+ readonly message: string;
28
+ /** The colour as given. */
29
+ readonly colour: string;
30
+ }> {}
31
+ //#endregion
32
+ export { ImportError as n, MacroError as r, ContrastError as t };
@@ -0,0 +1,92 @@
1
+ import { scope } from "cssints/plugin";
2
+ //#region src/frame.ts
3
+ const registered = (names) => names.map((n) => `@property --_${n} { syntax: "<length>"; inherits: false; initial-value: 0px; }`).join("\n");
4
+ const inner = "max(var(--_x) - var(--_p) - var(--_b), 0px)";
5
+ const outer = (parent) => `max(var(${parent}, calc(var(--_r) + var(--_m))) - var(--_m), 0px)`;
6
+ const css = `
7
+ & {
8
+ padding: var(--_p);
9
+ margin: var(--_m);
10
+ border: var(--_b) solid;
11
+ border-radius: var(--_x);
12
+ }
13
+ @container (style(--_c: e)) or (not style(--_c)) {
14
+ & { --_c: o; --_x: ${outer("--_e")}; --_o: ${inner}; }
15
+ }
16
+ @container style(--_c: o) {
17
+ & { --_c: e; --_x: ${outer("--_o")}; --_e: ${inner}; }
18
+ }`;
19
+ const fallback = `
20
+ :root[data-cssints-poly] & {
21
+ --_u: calc(var(--_r) + var(--_m));
22
+ --_i: max(max(var(--_u) - var(--_m), 0px) - var(--_p) - var(--_b), 0px);
23
+ --_t: var(--_i);
24
+ border-radius: max(var(--_u) - var(--_m), 0px);
25
+ transition: --_t 1ms;
26
+ }`;
27
+ const length = "<length [0,∞]>";
28
+ /**
29
+ * `frame().radius(t.radius.lg).padding(4).border("1px").margin(2)`: a box whose radius follows from the frames around it
30
+ * (`radius` is the radius of the outermost frame; inside, it is the parent's inner radius less the margin). `padding` and
31
+ * `margin` take a step of the spacing scale; each method once. It stands for `padding`, `margin`, `border-radius` and the
32
+ * border widths and styles, so mixing it with them in one `cn()` is a build error (border colours are fine).
33
+ */
34
+ const frameScope = scope("frame", {
35
+ core: {
36
+ css,
37
+ atProperty: registered([
38
+ "r",
39
+ "p",
40
+ "b",
41
+ "m",
42
+ "u",
43
+ "i",
44
+ "t"
45
+ ]),
46
+ requires: ["css.at-rules.property", "css.types.max"]
47
+ },
48
+ fallback: {
49
+ polyfills: ["css.at-rules.container.style_queries_for_custom_properties"],
50
+ parentVars: [{
51
+ marker: "&",
52
+ read: "--_i",
53
+ write: "--_u",
54
+ watch: "--_t"
55
+ }],
56
+ css: fallback
57
+ },
58
+ noBox: {
59
+ props: [/^(padding|margin)(-|$)/, /^border(?!.*color)/],
60
+ message: "frame() sets padding, margin, border-radius and the border: use its methods"
61
+ },
62
+ frame: {
63
+ uses: [
64
+ "core",
65
+ "fallback",
66
+ "noBox"
67
+ ],
68
+ chain: {
69
+ radius: {
70
+ args: length,
71
+ emit: (v) => [["--_r", v]]
72
+ },
73
+ padding: {
74
+ args: length,
75
+ spacing: true,
76
+ emit: (v) => [["--_p", v]]
77
+ },
78
+ border: {
79
+ args: length,
80
+ emit: (v) => [["--_b", v]]
81
+ },
82
+ margin: {
83
+ args: "<length>",
84
+ spacing: true,
85
+ emit: (v) => [["--_m", v]]
86
+ }
87
+ }
88
+ }
89
+ });
90
+ const { frame } = frameScope.export();
91
+ //#endregion
92
+ export { frameScope as n, frame as t };
@@ -0,0 +1,72 @@
1
+ //#region src/frame.d.ts
2
+ /**
3
+ * `frame().radius(t.radius.lg).padding(4).border("1px").margin(2)`: a box whose radius follows from the frames around it
4
+ * (`radius` is the radius of the outermost frame; inside, it is the parent's inner radius less the margin). `padding` and
5
+ * `margin` take a step of the spacing scale; each method once. It stands for `padding`, `margin`, `border-radius` and the
6
+ * border widths and styles, so mixing it with them in one `cn()` is a build error (border colours are fine).
7
+ */
8
+ export declare const frameScope: import("cssints/plugin").Scope<"frame", {
9
+ readonly core: {
10
+ readonly css: string;
11
+ readonly atProperty: string;
12
+ readonly requires: ["css.at-rules.property", "css.types.max"];
13
+ };
14
+ readonly fallback: {
15
+ readonly polyfills: ["css.at-rules.container.style_queries_for_custom_properties"];
16
+ readonly parentVars: [{
17
+ readonly marker: "&";
18
+ readonly read: "--_i";
19
+ readonly write: "--_u";
20
+ readonly watch: "--_t";
21
+ }];
22
+ readonly css: "\n:root[data-cssints-poly] & {\n --_u: calc(var(--_r) + var(--_m));\n --_i: max(max(var(--_u) - var(--_m), 0px) - var(--_p) - var(--_b), 0px);\n --_t: var(--_i);\n border-radius: max(var(--_u) - var(--_m), 0px);\n transition: --_t 1ms;\n}";
23
+ };
24
+ readonly noBox: {
25
+ readonly props: [RegExp, RegExp];
26
+ readonly message: "frame() sets padding, margin, border-radius and the border: use its methods";
27
+ };
28
+ readonly frame: {
29
+ readonly uses: readonly ["core", "fallback", "noBox"];
30
+ readonly chain: {
31
+ readonly radius: {
32
+ readonly args: "<length [0,∞]>";
33
+ readonly emit: (v: string) => [string, string][];
34
+ };
35
+ readonly padding: {
36
+ readonly args: "<length [0,∞]>";
37
+ readonly spacing: true;
38
+ readonly emit: (v: string) => [string, string][];
39
+ };
40
+ readonly border: {
41
+ readonly args: "<length [0,∞]>";
42
+ readonly emit: (v: string) => [string, string][];
43
+ };
44
+ readonly margin: {
45
+ readonly args: "<length>";
46
+ readonly spacing: true;
47
+ readonly emit: (v: string) => [string, string][];
48
+ };
49
+ };
50
+ };
51
+ }>;
52
+ export declare const frame: () => import("cssints/plugin").Chain<"frame", {
53
+ readonly radius: {
54
+ readonly args: "<length [0,∞]>";
55
+ readonly emit: (v: string) => [string, string][];
56
+ };
57
+ readonly padding: {
58
+ readonly args: "<length [0,∞]>";
59
+ readonly spacing: true;
60
+ readonly emit: (v: string) => [string, string][];
61
+ };
62
+ readonly border: {
63
+ readonly args: "<length [0,∞]>";
64
+ readonly emit: (v: string) => [string, string][];
65
+ };
66
+ readonly margin: {
67
+ readonly args: "<length>";
68
+ readonly spacing: true;
69
+ readonly emit: (v: string) => [string, string][];
70
+ };
71
+ }, {}>;
72
+ //#endregion
package/dist/frame.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { n as frameScope, t as frame } from "./frame-BoBKjgBB.mjs";
2
+ export { frame, frameScope };
@@ -0,0 +1 @@
1
+ import "./theme-types-Bqv0Ggz_.mjs";
@@ -0,0 +1,55 @@
1
+ import { $p as Fn, Qp as CheckMath, Xp as Arg, Zp as CheckFn, am as Fallback, cm as Text, em as Result, om as Part, rm as Check, sm as Style, tm as Text$1 } from "./theme-types-Bqv0Ggz_.mjs";
2
+ import { properties } from "@cssints/css-grammar/mdn";
3
+ import { CSSStyleValue } from "@cssints/css-grammar/values";
4
+ import { QueryKind, ValidQuery } from "@cssints/css-grammar/query";
5
+ //#region src/group-types.d.ts
6
+ /**
7
+ * What a group bans. `kw`: by property, its keywords, and `name(` for a function only that property has; `fn`: functions
8
+ * (anywhere); `unit`; `media`, `container`, `supports`: the words of a query (`scroll-state(`).
9
+ */
10
+ interface Ban {
11
+ id: string;
12
+ kw: Record<string, string>;
13
+ fn: string;
14
+ unit: string;
15
+ media: string;
16
+ container: string;
17
+ supports: string;
18
+ }
19
+ type Sep = " " | "," | ")" | "/" | ":" | ";" | '"' | "'" | "<" | ">" | "=" | "+" | "*" | "[" | "]" | "{" | "}" | "!" | "#" | "%" | "." | "⟨" | "⟩" | "&" | "|" | "\n" | "\t";
20
+ type Words<S extends string, W extends string = "", Acc extends string = never> = S extends `${infer C}${infer R}` ? C extends "(" ? Words<R, "", Acc | (W extends "" ? never : `${W}(`)> : C extends Sep ? Words<R, "", Acc | W> : Words<R, `${W}${C}`, Acc> : Acc | W;
21
+ type Banned<B extends Ban, K extends string> = K | `${B["fn"]}(` | `${number}${B["unit"]}`;
22
+ type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
23
+ type Seen<B extends Ban, K extends string> = K | `${B["fn"]}(` | `${Digit}${B["unit"]}`;
24
+ type Hit<B extends Ban, K extends string, S extends string> = S extends `${string}${Seen<B, K>}${string}` ? Extract<Words<S>, Banned<B, K>> : never;
25
+ type Said<T extends string> = T extends `${infer N}(` ? `${N}()` : T;
26
+ type Msg<B extends Ban, L extends string, T extends string> = `${L}: "${Said<T>}" is not in cssints/${B["id"]}`;
27
+ type KwOf<B extends Ban, P extends string> = P extends keyof B["kw"] ? B["kw"][P] : never;
28
+ type Same<A, C> = [A] extends [C] ? ([C] extends [A] ? true : false) : false;
29
+ type PartText<P> = P extends Fallback<infer V> ? Text<V[number]> : Text<P>;
30
+ type Scan<B extends Ban, K extends string, L extends string, A extends readonly Part[]> = { [I in keyof A]: Hit<B, K, PartText<A[I]>> extends (infer T extends string) ? [T] extends [never] ? A[I] : Msg<B, L, T> : never; };
31
+ type Narrow<B extends Ban, P extends string, A extends readonly Part[], C> = Same<A, C> extends true ? Scan<B, KwOf<B, P>, P, A> : C;
32
+ /** A property of a group: `Prop` of types.ts, with the group's banned words refused. */
33
+ type GProp<B extends Ban, P extends keyof typeof properties, R = Style> = <const A extends readonly Part[]>(...parts: Narrow<B, P, A, Check<P, A>>) => R;
34
+ /** `flex` and `grid` of a group: `M` holds the chain methods whose property the group has. */
35
+ interface GLayout<B extends Ban, P extends "flex" | "grid", M extends Record<string, keyof typeof properties>> {
36
+ (): GChain<B, M>;
37
+ <const A extends readonly Part[]>(...parts: Narrow<B, P, A, Check<P, A>>): Style;
38
+ }
39
+ type GChain<B extends Ban, M extends Record<string, keyof typeof properties>> = Style & { readonly [K in keyof M]: GProp<B, M[K], GChain<B, M>>; };
40
+ type ScanArgs<B extends Ban, L extends string, A extends readonly Arg[]> = { [I in keyof A]: Hit<B, never, Text$1<A[I]>> extends (infer T extends string) ? [T] extends [never] ? A[I] : Msg<B, L, T> : never; };
41
+ type NarrowFn<B extends Ban, L extends string, A extends readonly Arg[], C> = Same<A, C> extends true ? ScanArgs<B, L, A> : C;
42
+ /** A css function of a group (`oklch`, `linearGradient`): `Fn` of function-types.ts, its arguments read for banned words. */
43
+ type GFn<B extends Ban, N extends string, Sep extends string> = <const A extends readonly Arg[]>(...parts: NarrowFn<B, `${N}()`, A, CheckFn<N, Sep, A>>) => ReturnType<Fn<N, Sep>>;
44
+ /** A math function of a group (`calc`, `min`). */
45
+ type GMath<B extends Ban, C extends "same" | "number" | "angle"> = <const A extends readonly Arg[]>(...parts: NarrowFn<B, "calc()", A, CheckMath<A>>) => CSSStyleValue<Result<C, A>>;
46
+ type Query<B extends Ban, K extends QueryKind> = K extends "media" ? B["media"] : K extends "container" ? B["container"] : B["supports"];
47
+ type GQ<B extends Ban, K extends QueryKind, Q extends string> = ValidQuery<K, Q> extends (infer V) ? [V] extends [Q] ? Hit<B, Query<B, K>, Q> extends (infer T extends string) ? [T] extends [never] ? Q : Msg<B, `@${K}`, T> : never : V : never;
48
+ /** `media`, `container` and `supports` of a group: `Condition` of css-grammar's query.ts, the media features it bans refused. */
49
+ interface GCondition<B extends Ban, K extends QueryKind, R> {
50
+ <const O extends Record<string, string>>(queries: { [P in keyof O]: GQ<B, K, O[P]>; }): { [P in keyof O]: R; };
51
+ <const Q extends readonly [string, string, ...string[]]>(...queries: { [I in keyof Q]: GQ<B, K, Q[I]>; }): { [I in keyof Q]: R; };
52
+ <const Q extends string>(query: GQ<B, K, Q>): R;
53
+ }
54
+ //#endregion
55
+ export { GProp as a, GMath as i, GFn as n, GLayout as r, GCondition as t };
@@ -0,0 +1,20 @@
1
+ import { A as Wrap, C as Keyframes, D as QueryWrap, F as cv, H as style, I as firstThatWorks, K as within, L as global, M as cn, O as StateWrap, R as group, S as CvValue, T as PositionTry, W as token, _ as CSSStyleValue, a as DtcgUnit, am as Fallback, b as CvConfig, c as Tokens, d as createTokens, f as layers, g as CSSImageValue, h as CSSColorValue, i as DtcgShadow, j as attr, k as Steps, l as check, m as CSS, n as DtcgColor, o as DtcgValue, om as Part, p as AttrOp, q as ClassValue, r as DtcgCubicBezier, s as Overrides, sm as Style, t as CheckOverrides, u as createGlobalTheme, v as CSSUnitValue, x as CvProps } from "../theme-types-Bqv0Ggz_.mjs";
2
+ import { a as GProp } from "../group-types-9ttphdku.mjs";
3
+ import "../group-common-9zpBxfUF.mjs";
4
+ import { properties } from "@cssints/css-grammar/mdn";
5
+ //#region src/groups/compositing-2.d.ts
6
+ type B = {
7
+ id: "compositing-2";
8
+ kw: Record<never, never>;
9
+ fn: never;
10
+ unit: never;
11
+ media: never;
12
+ container: never;
13
+ supports: never;
14
+ };
15
+ type P<K extends keyof typeof properties> = GProp<B, K>;
16
+ export declare const backgroundBlendMode: P<"background-blend-mode">;
17
+ export declare const isolation: P<"isolation">;
18
+ export declare const mixBlendMode: P<"mix-blend-mode">;
19
+ //#endregion
20
+ 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, attr, check, cn, createGlobalTheme, createTokens, cv, firstThatWorks, global, group, layers, style, token, within };