rainbowindex 0.2.2 → 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/CHANGELOG.md +70 -14
- package/LICENSE +1 -1
- package/README.md +23 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +1 -1
- package/dist/chunk-3HRMFZGE.mjs +19 -0
- package/dist/{chunk-FHATRQMN.mjs → chunk-4SVFFDS2.mjs} +495 -461
- package/dist/{chunk-SOMDX7V6.mjs → chunk-5Y7EXXLS.mjs} +320 -417
- package/dist/{chunk-W6XIBM4M.mjs → chunk-6DAHUFNU.mjs} +5278 -4928
- package/dist/{chunk-CUUW2K35.mjs → chunk-TLR6RP5L.mjs} +41 -120
- package/dist/chunk-YLB6FGIG.mjs +244 -0
- package/dist/cli.mjs +280 -277
- package/dist/{index-CfDtWufj.d.ts → context-ruu2x_jR.d.ts} +15 -70
- package/dist/editor.d.ts +106 -28
- package/dist/editor.mjs +44 -12
- package/dist/{index-DK6APAGD.d.ts → index-BB2HoeMj.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/safelist-D9-Plqta.d.ts +109 -0
- package/dist/vite.mjs +48 -27
- package/package.json +1 -1
- package/dist/chunk-KYDEHYIE.mjs +0 -691
- package/dist/safelist-CH3_PywB.d.ts +0 -43
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `safelist()` — declare utility classes that must be emitted regardless of
|
|
3
|
-
* whether the consumer's source files reference them directly.
|
|
4
|
-
*
|
|
5
|
-
* At runtime this is a plain identity-join: pass any number of strings (and
|
|
6
|
-
* falsy values, which are filtered) and receive a single space-joined string
|
|
7
|
-
* suitable for `className`. The function performs no global registration, has
|
|
8
|
-
* no side effects, and is tree-shake-safe.
|
|
9
|
-
*
|
|
10
|
-
* The build-time meaning comes from the scanner: when the source-file
|
|
11
|
-
* extractor encounters a `safelist(...)` call, it extracts every literal
|
|
12
|
-
* string argument as a class declaration — so the classes get emitted in the
|
|
13
|
-
* final CSS even though the consumer's source never names them literally.
|
|
14
|
-
*
|
|
15
|
-
* Primary use case is component libraries that ship classNames inside their
|
|
16
|
-
* bundled code (e.g. a curated icon set whose strokes are described by
|
|
17
|
-
* utility classes). The library wraps its declarations in `safelist(...)`,
|
|
18
|
-
* the consumer's setup points the scanner at the library's `dist/`, and the
|
|
19
|
-
* classes flow through unchanged. The Vite plugin auto-discovers libraries
|
|
20
|
-
* that opt in via a `rainbowindex.safelistSources` field in their
|
|
21
|
-
* `package.json`, so consumers typically don't have to add `@source` lines
|
|
22
|
-
* by hand.
|
|
23
|
-
*
|
|
24
|
-
* const ICON_BASE = safelist("stroke-cap-round", "stroke-join-round");
|
|
25
|
-
* const SidebarLeft = defineIcon({
|
|
26
|
-
* primitives: SIDEBAR,
|
|
27
|
-
* className: safelist(ICON_BASE, "-scale-x-100"),
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* Scanner contract:
|
|
31
|
-
* - Only STATIC string literals at the call site are extracted. Values
|
|
32
|
-
* passed through variables (`safelist(ICON_BASE, ...)`) won't be re-read
|
|
33
|
-
* at the outer call site, but the original `safelist("stroke-cap-round",
|
|
34
|
-
* ...)` that produced `ICON_BASE` is itself extracted, so the classes are
|
|
35
|
-
* still covered.
|
|
36
|
-
* - Template literals with no `${…}` interpolation are extracted; templates
|
|
37
|
-
* with interpolation are skipped.
|
|
38
|
-
* - Falsy arguments are dropped at runtime so conditional fragments compose
|
|
39
|
-
* naturally: `safelist("flex", side === "left" && "flex-row-reverse")`.
|
|
40
|
-
*/
|
|
41
|
-
declare function safelist(...parts: ReadonlyArray<string | false | null | undefined>): string;
|
|
42
|
-
|
|
43
|
-
export { safelist as s };
|