rainbowindex 0.5.1 → 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.
Files changed (43) hide show
  1. package/CHANGELOG.md +876 -0
  2. package/LICENSE +16 -17
  3. package/NOTICE.md +106 -0
  4. package/README.md +225 -69
  5. package/dist/browser.d.ts +4 -2
  6. package/dist/browser.mjs +12 -6
  7. package/dist/chunk-2T7V5XLK.mjs +912 -0
  8. package/dist/chunk-6OORICWF.mjs +16 -0
  9. package/dist/{chunk-PDORZSQX.mjs → chunk-FJOZJIKB.mjs} +7814 -5174
  10. package/dist/chunk-L56IRO7A.mjs +491 -0
  11. package/dist/chunk-PZDVDEZJ.mjs +196 -0
  12. package/dist/{chunk-4CTJLMYM.mjs → chunk-RC6DDE4L.mjs} +37 -23
  13. package/dist/chunk-TQJYVQPE.mjs +217 -0
  14. package/dist/chunk-W756NVYI.mjs +33 -0
  15. package/dist/chunk-WBESS2ZD.mjs +598 -0
  16. package/dist/{chunk-3HRMFZGE.mjs → chunk-X66Z2YHT.mjs} +2 -1
  17. package/dist/{chunk-4UKFK2GE.mjs → chunk-XQGSG2HK.mjs} +213 -756
  18. package/dist/cli.mjs +1101 -125
  19. package/dist/{context-B9yhJxd5.d.ts → context-DcBtnnan.d.ts} +55 -108
  20. package/dist/editor.d.ts +82 -421
  21. package/dist/editor.mjs +68 -363
  22. package/dist/eslint.d.ts +16 -0
  23. package/dist/eslint.mjs +32 -0
  24. package/dist/{index-Dx-NpFFx.d.ts → imports-C9esHd5Q.d.ts} +98 -81
  25. package/dist/index-CNqdL5U0.d.ts +56 -0
  26. package/dist/index-Czx-EUwh.d.ts +138 -0
  27. package/dist/index-DW8YSxTz.d.ts +104 -0
  28. package/dist/index.d.ts +49 -5
  29. package/dist/index.mjs +40 -13
  30. package/dist/oxlint.d.ts +21 -3
  31. package/dist/oxlint.mjs +19 -1
  32. package/dist/recipe.d.ts +111 -0
  33. package/dist/recipe.mjs +71 -0
  34. package/dist/safelist-CH3_PywB.d.ts +43 -0
  35. package/dist/session-CMaskdB7.d.ts +543 -0
  36. package/dist/tailwind.css +644 -0
  37. package/dist/theme-CIZiGlce.d.ts +115 -0
  38. package/dist/vite.d.ts +10 -1
  39. package/dist/vite.mjs +273 -113
  40. package/package.json +27 -5
  41. package/dist/chunk-F4VCBISU.mjs +0 -1866
  42. package/dist/chunk-RU4756NG.mjs +0 -243
  43. package/dist/safelist-DAkKuxCk.d.ts +0 -96
@@ -1,108 +1,3 @@
1
- /**
2
- * Generative color system — color domain model, OKLCH ramp generation,
3
- * and light-dark() pairing.
4
- *
5
- * 2 numbers (chroma + hue) → 19-stop palette with automatic dark mode.
6
- *
7
- * The ramp is sampled from a fixed reference profile (`L_PROFILE` / `C_SHAPE` /
8
- * `H_DRIFT`, captured from the reference palette): lightness is a curved,
9
- * compressed scale (low suffix → light, high → dark), chroma is an asymmetric
10
- * bell peaking at stop 500, and hue is near-flat. Dark mode is a simple ramp
11
- * reversal — the dark value is the stop the ramp reaches at the mirror position
12
- * (`1000 - suffix`), so stop 500 pivots to itself.
13
- */
14
- /** Per-color dark mode override strategy. */
15
- type ColorDarkOverride = {
16
- strategy: "mirror";
17
- } | {
18
- strategy: "fixed";
19
- } | {
20
- strategy: "shift";
21
- chromaDelta: number;
22
- hueDelta: number;
23
- };
24
- /**
25
- * Color definition — discriminated union supporting:
26
- * - Generative: `brand: 0.18 330;` → 19-stop palette with auto dark mode
27
- * - Explicit: `accent: oklch(0.72 0.21 330);` → single color value
28
- * - Pair: `surface: oklch(0.98 0.01 260) / oklch(0.15 0.01 260);` → light/dark pair
29
- * - Alias: `theme: brand;` → references another color's palette via var()
30
- */
31
- type ColorDefinition = {
32
- type: "generative";
33
- chroma: number;
34
- hue: number;
35
- dark?: ColorDarkOverride;
36
- inline?: boolean;
37
- parabolic?: boolean;
38
- chromaBoost?: boolean;
39
- } | {
40
- type: "explicit";
41
- value: string;
42
- } | {
43
- type: "keyword";
44
- value: string;
45
- } | {
46
- type: "pair";
47
- light: string;
48
- dark: string;
49
- } | {
50
- type: "alias";
51
- source: string;
52
- };
53
- interface DarkModeConfig {
54
- mode: "auto" | "off";
55
- chromaBoost: number;
56
- hueShift: number;
57
- }
58
-
59
- /**
60
- * Default theme values — the static data that ships if the user writes no directives.
61
- * `directives.ts` (Phase 5) parses user overrides and merges them with these defaults.
62
- */
63
-
64
- interface TextSize {
65
- fontSize: string;
66
- lineHeight: string;
67
- }
68
- type FluidUnit = "vw" | "vi" | "vmin" | "vmax";
69
- interface FluidConfig {
70
- min: string;
71
- max: string;
72
- unit?: FluidUnit;
73
- multiplier?: number;
74
- }
75
- interface AnimationDefinition {
76
- shorthand: string;
77
- keyframes: string;
78
- }
79
- interface Theme {
80
- spacing: {
81
- base: string;
82
- };
83
- colors: Record<string, ColorDefinition>;
84
- text: Record<string, TextSize>;
85
- breakpoints: Record<string, string>;
86
- shadows: Record<string, string>;
87
- weights: Record<string, number>;
88
- easing: Record<string, string>;
89
- fluid: FluidConfig;
90
- animations: Record<string, AnimationDefinition>;
91
- blur: Record<string, string>;
92
- }
93
- /**
94
- * Keyword corner-shape values. `superellipse(N)` is represented separately
95
- * as `{ superellipse: N }` since the numeric parameter isn't a keyword.
96
- * Single source for the type, the scale table below, and the @rounded
97
- * modifier parser (directives/parsers.ts).
98
- */
99
- declare const CORNER_SHAPE_KEYWORDS: readonly ["round", "scoop", "bevel", "notch", "square", "squircle"];
100
- type CornerShapeKeyword = (typeof CORNER_SHAPE_KEYWORDS)[number];
101
- type CornerShape = CornerShapeKeyword | {
102
- superellipse: number;
103
- };
104
- declare const defaultTheme: Theme;
105
-
106
1
  /**
107
2
  * Claim resolution for ri() — utility name → CSS properties it sets.
108
3
  *
@@ -118,7 +13,6 @@ declare const defaultTheme: Theme;
118
13
  * here rather than in context.ts so this layer keeps taking its state as
119
14
  * parameters instead of importing the context module. */
120
15
  type CustomFunctionalEntry = readonly [root: string, properties: readonly string[]];
121
- declare const DEFAULT_TEXT_SIZES: readonly ["xs", "sm", "base", "lg", "xl", "2xl", "3xl", "4xl", "5xl"];
122
16
 
123
17
  /**
124
18
  * Compilation-context lifecycle — all mutable state behind ri().
@@ -143,7 +37,10 @@ interface CompilationContext {
143
37
  fontFamilies: Set<string>;
144
38
  colorNames: Set<string>;
145
39
  }
146
-
40
+ /**
41
+ * Frozen snapshot of compilation state for SSR-safe ri() instances.
42
+ * Created by finalizeCompilationContext() and consumed by createRi().
43
+ */
147
44
  interface CompilationSnapshot {
148
45
  readonly customStaticProps: Readonly<Record<string, string[]>>;
149
46
  /** Longest root first, so `glow-outer-*` wins over `glow-*` for `glow-outer-4`. */
@@ -179,10 +76,60 @@ declare function registerCustomFontFamilies(ctx: CompilationContext, families: s
179
76
  * match the shade pattern and need no registration.
180
77
  */
181
78
  declare function registerColorNames(ctx: CompilationContext, names: string[]): void;
79
+ /**
80
+ * Publish a snapshot as the module-level state the default ri() reads.
81
+ *
82
+ * Split out of finalizeCompilationContext so a client bundle — which never runs
83
+ * a compile — can reach the same state through hydrateSnapshot(). Everything
84
+ * assigned here is already frozen-by-convention: the snapshot's arrays and Sets
85
+ * are the compile's own copies, never the mutable context's.
86
+ */
87
+ declare function publishSnapshot(snapshot: CompilationSnapshot): void;
182
88
  /**
183
89
  * Snapshot compilation context into module-level state that ri() reads from.
184
90
  * Called at the end of compile() to atomically publish the new state.
185
91
  */
186
92
  declare function finalizeCompilationContext(ctx: CompilationContext): CompilationSnapshot;
93
+ /**
94
+ * A CompilationSnapshot with its Sets flattened to sorted arrays.
95
+ *
96
+ * A snapshot is built on the server and read on the client, so it has to cross
97
+ * a boundary that only carries JSON. `JSON.stringify` turns a Set into `{}`,
98
+ * silently — the class merge would then run against an empty theme and drop
99
+ * every project-defined size, weight, font slot, and color. Sorting is for
100
+ * build determinism: the same theme must produce byte-identical output, or the
101
+ * emitted module churns on every build.
102
+ */
103
+ interface SerializedSnapshot {
104
+ /** See {@link SNAPSHOT_FORMAT}. */
105
+ format: typeof SNAPSHOT_FORMAT;
106
+ customStaticProps: Readonly<Record<string, string[]>>;
107
+ customFunctionalProps: readonly CustomFunctionalEntry[];
108
+ textSizes: readonly string[];
109
+ fontFamilies: readonly string[];
110
+ colorNames: readonly string[];
111
+ }
112
+ /**
113
+ * The wire shape's version. Bump it when a change would make a module written
114
+ * by an older version unreadable.
115
+ *
116
+ * This is the whole of the runtime validation. Producer and consumer are two
117
+ * functions in this file, joined by one `JSON.stringify`, so the only way the
118
+ * shapes can disagree is a *stale generated module* — one committed or cached
119
+ * from an older release. That is one failure with one fix, and checking a
120
+ * number catches it; checking every field of every array, as this used to,
121
+ * caught nothing else and left the declared type unenforced.
122
+ */
123
+ declare const SNAPSHOT_FORMAT = 1;
124
+ declare function serializeSnapshot(snapshot: CompilationSnapshot): SerializedSnapshot;
125
+ /**
126
+ * Rebuild a snapshot from its wire form.
127
+ *
128
+ * A wrong or missing {@link SNAPSHOT_FORMAT} means a generated module written
129
+ * by another release. That warns and yields the built-in defaults rather than
130
+ * throwing, because throwing here happens at import time inside someone's
131
+ * client bundle; the warning says which command puts it right.
132
+ */
133
+ declare function hydrateSnapshot(data: SerializedSnapshot): CompilationSnapshot;
187
134
 
188
- export { type AnimationDefinition as A, type ColorDefinition as C, DEFAULT_TEXT_SIZES as D, type FluidConfig as F, type TextSize as T, type CompilationContext as a, type CompilationSnapshot as b, type Theme as c, createCompilationContext as d, defaultTheme as e, finalizeCompilationContext as f, registerCustomFontFamilies as g, registerCustomTextSizes as h, registerCustomUtility as i, type DarkModeConfig as j, type CornerShape as k, registerColorNames as r };
135
+ export { type CompilationContext as C, type SerializedSnapshot as S, type CompilationSnapshot as a, registerCustomFontFamilies as b, createCompilationContext as c, registerCustomTextSizes as d, registerCustomUtility as e, finalizeCompilationContext as f, hydrateSnapshot as h, publishSnapshot as p, registerColorNames as r, serializeSnapshot as s };