@notseeyou/icons-css 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Not See You
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,127 @@
1
- # Temporary Holding Version
1
+ # @notseeyou/icons-css
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ NSY Icons as CSS classes: a **Tailwind CSS v4 plugin** that emits CSS only for the icons
4
+ you use, and **plain CSS files** for sites without Tailwind. 2111 icons × line, solid,
5
+ duotone.
6
+
7
+ ```html
8
+ <span class="nsy-home"></span> <!-- line -->
9
+ <span class="nsy-home-solid"></span> <!-- solid -->
10
+ <span class="nsy-home-duotone"></span> <!-- duotone -->
11
+ ```
12
+
13
+ Each class draws the icon in `currentColor` through a CSS mask (the icon is an SVG data
14
+ URI used as `mask-image`; the element's `background-color` shows through). Duotone's
15
+ secondary layer is drawn at 35 % alpha inside that mask, so it shows as 35 % of the color.
16
+ Default size is `1em` (follows `font-size`); `display: inline-block`, `flex-shrink: 0`.
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ npm i -D @notseeyou/icons-css
22
+ ```
23
+
24
+ ## Tailwind CSS 4
25
+
26
+ ```css
27
+ /* app/globals.css */
28
+ @import "tailwindcss";
29
+ @plugin "@notseeyou/icons-css/tailwind";
30
+ ```
31
+
32
+ ```tsx
33
+ <button className="inline-flex items-center gap-2">
34
+ <span className="nsy-shield-check size-5 text-emerald-600" aria-hidden="true" />
35
+ Protected
36
+ </button>
37
+ <span className="nsy-bell text-2xl" /> {/* 1em of text-2xl */}
38
+ <span className="nsy-heart hover:nsy-heart-solid" /> {/* variants work */}
39
+ ```
40
+
41
+ - Only classes Tailwind finds in your sources produce CSS (~1.2 KB per icon raw,
42
+ ~0.4 KB gzipped); `nsy-typo` and `nsy-[…]` produce nothing.
43
+ - Icon rules sort before Tailwind's own utilities, so `size-*`, `w-*`/`h-*`, `hidden`,
44
+ `block`, `shrink` on the same element win.
45
+ - Color: `text-*` (it's `currentColor`). Size: `size-*` or `text-*`.
46
+ - Own prefix: `@plugin "@notseeyou/icons-css/tailwind" { prefix: icon; }` → `icon-home`.
47
+ - Class names must appear whole in source (`nsy-${name}` built at runtime is invisible to
48
+ Tailwind — same rule as every utility). For names from data, use `@source inline("nsy-home nsy-lock")`.
49
+
50
+ Works with any Tailwind 4 integration (`@tailwindcss/postcss`, `/vite`, `/turbopack`
51
+ — Next 16's loader — and the CLI); `tailwindcss` ≥ 4 is a peer dependency.
52
+
53
+ ## Plain CSS
54
+
55
+ ```html
56
+ <link rel="stylesheet" href="/css/nsy-icons/line.css"> <!-- all 2111 line icons -->
57
+ <span class="nsy-home"></span>
58
+ ```
59
+
60
+ | File | Classes | raw | gzip |
61
+ | --- | --- | --- | --- |
62
+ | `line.css` | `nsy-home` … | 2.4 MB | 488 KB |
63
+ | `solid.css` | `nsy-home-solid` … | 2.1 MB | 414 KB |
64
+ | `duotone.css` | `nsy-home-duotone` … | 3.2 MB | 651 KB |
65
+ | `categories/<category>.css` | all three styles of one category (arrows, security, …) | 0.36–0.53 MB | — |
66
+
67
+ Import from a bundler: `import '@notseeyou/icons-css/line.css'`.
68
+ The shared declarations sit in one `:where(.nsy-…, …)` rule with **zero specificity**, so
69
+ any class of yours (`.icon { width: 2rem }`) overrides size, display or color.
70
+
71
+ These files are big — they hold every icon. For a site that uses a few icons, generate a
72
+ file with exactly those (build time, Node):
73
+
74
+ ```js
75
+ import { getIconsCSS } from '@notseeyou/icons-css';
76
+ await writeFile('public/icons.css', getIconsCSS(['home', 'lock-solid', 'ghost-duotone']));
77
+ // 3 icons: 2.8 KB (1.2 KB gzipped); { prefix: 'icon' } for .icon-home …; unknown names throw
78
+ ```
79
+
80
+ ## Accessibility
81
+
82
+ A mask icon is an empty element: screen readers ignore it, which is right for decorative
83
+ icons. Mark them explicitly anyway (`aria-hidden="true"`). When the icon carries meaning:
84
+
85
+ ```html
86
+ <button aria-label="Close"><span class="nsy-close" aria-hidden="true"></span></button>
87
+ <span class="nsy-alert-triangle" role="img" aria-label="Warning"></span>
88
+ ```
89
+
90
+ **Windows High Contrast / `forced-colors`:** browsers may replace `background-color`, so
91
+ mask icons can disappear or change color there — a known limit of every CSS-mask icon set.
92
+ Where that matters, use inline SVG (`@notseeyou/icons-svg` / `-react`).
93
+
94
+ ## Limits
95
+
96
+ - One color per icon: duotone's secondary layer is always the same color at 35 %
97
+ (`secondaryColor` / `secondaryOpacity` need inline SVG — the React or web-component packages).
98
+ - `mask-image` needs Chrome/Edge 120+, Safari 15.4+, Firefox 53+ (the `-webkit-` prefixed
99
+ properties are emitted too).
100
+
101
+ ## How it was verified
102
+
103
+ `node scripts/export/verify/all.mjs css` runs `packages/css/verify/run.mjs` (no browser):
104
+
105
+ - **Tailwind 4.3.3** (`@tailwindcss/node` compile, sources scanned by `@tailwindcss/oxide`)
106
+ in a consumer project with the package installed by name: a sample page using 3 icons
107
+ plus `size-6`, `hidden`, `block`, `shrink`, `text-2xl` emits exactly those 3 icon rules
108
+ (they add 3.5 KB, 1.2 KB gzipped), each with the documented declarations, sorted before
109
+ the utilities that must override them; Lightning CSS minify keeps the masks; `prefix`
110
+ option; `hover:`/`dark:`/`md:` variants; `nsy-nope`, `nsy-[home]`, `-nsy-home`,
111
+ `nsy-home/50`, `nsy-constructor` emit nothing;
112
+ - all 6333 classes compiled by Tailwind; every mask data URI decoded and rendered by
113
+ **resvg** (independent Rust renderer), compared with exact path coverage (`compareDump`):
114
+ 6333 bitmaps, worst 3.8 % of ink;
115
+ - plain CSS files: complete (style files and category files each hold all 6333, identical
116
+ rules), shared `:where()` rule lists exactly the file's classes, parsed by Lightning CSS
117
+ without losing rules, every icon rendered — pixel-identical to the Tailwind output;
118
+ - `getIconsCSS` output, prefix, unknown names; types under `tsc --strict`.
119
+
120
+ **Not verified:** how browsers composite the mask (no browser here) — resvg checks the mask
121
+ *image* alpha, the `mask-image`/`background-color` combination is standard CSS but untested
122
+ on screen; forced-colors behaviour; Tailwind IntelliSense.
123
+
124
+ ## Source
125
+
126
+ `lib/` is hand-written; `dist/` is generated by `npm run export` in `nsyicon`
127
+ (`scripts/export/targets/css.mjs`) — don't edit it.