@umoa/saascfm-css 0.0.0-stage → 0.1.1

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,12 @@
1
+ Copyright (c) 2026 UMOA. All rights reserved.
2
+
3
+ This software and its documentation are proprietary to UMOA. No license is
4
+ granted to copy, modify, merge, publish, distribute, sublicense, or sell
5
+ copies of this software, or to use it, except as expressly authorized in
6
+ writing by UMOA.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL UMOA
11
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM THE USE OF
12
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,153 @@
1
- # Temporary Holding Version
1
+ # @umoa/saascfm-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
+ Vite plugin that scans your source and generates only the utility classes you use. `w-54`, `mt-12`, `g-8`, `flex-jcc`, `text-primary`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -D @umoa/saascfm-css
9
+ ```
10
+
11
+ Works with TypeScript or plain JavaScript. Use `vite.config.js`, the `js` template and `main.js` if you are not on TypeScript. The package ships ESM and CommonJS, so it loads whether or not your `package.json` has `"type": "module"`.
12
+
13
+ ```js
14
+ // vite.config.js (or .ts)
15
+ import cssModule from '@umoa/saascfm-css'
16
+ import * as colors from './src/saascfm-css/_component.tokens'
17
+
18
+ export default defineConfig({
19
+ plugins: [cssModule({ colorsModule: colors })],
20
+ })
21
+ ```
22
+
23
+ ```js
24
+ // main.js (or .ts)
25
+ import 'virtual:css-module.css'
26
+ ```
27
+
28
+ TypeScript only: add `"types": ["@umoa/saascfm-css/client"]` to `tsconfig.json`.
29
+
30
+ ## Options
31
+
32
+ | Option | Default | |
33
+ | --- | --- | --- |
34
+ | `srcDir` | `'src'` | folder scanned (plus root `index.html`) |
35
+ | `extensions` | `.vue .js .jsx .ts .tsx .html` | file types scanned |
36
+ | `spacing` `layout` `typography` `cursor` `border` | `true` | turn a module off with `false` |
37
+ | `colorsModule` | none | your `PRIMITIVES` and `TOKENS` |
38
+ | `primitiveClasses` | `true` | `false` removes the `blue-500` / `bg-blue-500` classes |
39
+ | `important` | `false` | `true` adds `!important` to every generated declaration |
40
+ | `exclude` | `[".colors.", ".tokens.", "primitives."]` | file paths containing these are not scanned, so your color definitions do not generate every class |
41
+
42
+ ## What is fixed vs. what is yours
43
+
44
+ Fixed (ships in the package): spacing, gap, layout, typography, cursor, border-style.
45
+
46
+ Yours (lives in your app): colors. Copy the template folder into your app and rename anything. Pick `ts` or `js`.
47
+
48
+ ```bash
49
+ cp -r node_modules/@umoa/saascfm-css/templates/ts/saascfm-css src/
50
+ ```
51
+
52
+ That creates:
53
+
54
+ ```
55
+ src/saascfm-css/
56
+ primitives.ts raw color scale
57
+ _component.tokens.ts aggregator: pass this to the plugin
58
+ tokens/
59
+ surface.tokens.ts
60
+ border.tokens.ts
61
+ status.tokens.ts
62
+ navigation.tokens.ts
63
+ CHEATSHEET.md every class and token
64
+ RULES.md how the folder works, adding tokens, migrating
65
+ ```
66
+
67
+ Then point the plugin at it:
68
+
69
+ ```ts
70
+ import * as colors from './src/saascfm-css/_component.tokens'
71
+
72
+ plugins: [cssModule({ colorsModule: colors })]
73
+ ```
74
+
75
+ A smaller starter, `templates/ts/minimal/` (one `app.colors` file, 8 primitives, 12 tokens), is also included. Use one or the other, not both.
76
+
77
+ Keep `.tokens.` in token file names and `primitives.` in the primitives file name. The scanner skips paths containing `.colors.`, `.tokens.` or `primitives.`, so your color definitions do not generate every class.
78
+
79
+ ## Colors
80
+
81
+ One file exports two objects.
82
+
83
+ ```ts
84
+ export const PRIMITIVES = { 'brand-500': '#3B6FF0', 'white': '#FFFFFF' }
85
+ export const TOKENS = { 'text-brand': 'brand-500', 'bg-card': 'white' }
86
+ ```
87
+
88
+ - `PRIMITIVES`: name → color. Each generates `name` (color), `bg-name`, `border-name`. `rgba`/`hsla` values generate the color class only.
89
+ - `TOKENS`: name → primitive name, or any CSS color. Each becomes `--name` on `:root`.
90
+ - Token names are yours. The first word decides the class: `text-*` → `color`, `bg-*` → `background-color`, `border-*` → `border-color`. Any other prefix (`nav-*`, `tabb-*`, `shadow-*`) is a CSS var only.
91
+ - Unknown primitive names print a warning and are skipped.
92
+ - `hl`, `hl-muted`, `vl` read `--border-default` / `--border-muted`, falling back to `currentColor`.
93
+
94
+ ## Numeric classes
95
+
96
+ `{prefix}-{n?}{number}{suffix?}`
97
+
98
+ | Prefix | Property |
99
+ | --- | --- |
100
+ | `w` `h` | width, height |
101
+ | `mw` `mh` `minw` `minh` | max/min width/height |
102
+ | `mt` `mr` `mb` `ml` `mtb` `mrl` | margin |
103
+ | `p` `pt` `pr` `pb` `pl` `ptb` `prl` | padding |
104
+ | `g` `gc` `gr` | gap, column-gap, row-gap (no negatives) |
105
+ | `bdrd` | border-radius |
106
+ | `bdw` | border-width, also sets `border-style: solid` |
107
+ | `zdex` | z-index (unitless) |
108
+
109
+ Suffixes: `p` percent (`w-10p`), `vw` / `vh` (`w` and `h` only: `h-50vh`), `n` negative (`mt-n10`), `d` decimal point (`mt-12d5` = 12.5px, `mt-12d5p` = 12.5%).
110
+
111
+ ## Static classes
112
+
113
+ | Class | |
114
+ | --- | --- |
115
+ | `bn` | border: none |
116
+ | `auto` | margin: 0 auto |
117
+ | `hl` `hl-muted` `vl` | divider lines |
118
+ | `mcon-480` `640` `768` `1080` `1280` `1440` | max-width container, centered |
119
+ | `bds-solid` `dashed` `dotted` `double` `none` | border-style (emitted last so it overrides `bdw-*`) |
120
+
121
+ ## Layout
122
+
123
+ Flex: `flex`, `flex-fdr` `fdrr` `fdc` `fdcr`, `flex-wrap` `flex-nowrap`, justify `flex-jcfs` `jcfe` `jcc` `jcsb` `jcsa` `jcse`, align-items `flex-aifs` `aife` `aic` `aist` `aib`, align-content `flex-acfs` `acfe` `acc` `acst` `acsb` `acsa`, align-self `flex-assr` `asc` `ass` `ase`.
124
+
125
+ Grid: `grid-jist` `jie` `jic` `jistr`, `grid-aist` `aie` `aic` `aistr`.
126
+
127
+ Other: `align-l` `align-c` `align-r` (text-align), `float-l` `float-r`, `float-c` (position: fixed, centered).
128
+
129
+ ## Typography
130
+
131
+ | Class | |
132
+ | --- | --- |
133
+ | `nb` `b` `bx` | normal / bold / bolder |
134
+ | `b-100` … `b-900` | font-weight |
135
+ | `light` `lighter` (`b-light` `b-lighter`) | 300 / 100 |
136
+ | `uppercase` `lowercase` `capitalize` `text-none` | text-transform |
137
+ | `i` `underline` | italic, underline |
138
+ | `ow` `ww` | overflow-wrap + hyphens |
139
+ | `fs-1em` `fs-1d5em` `fs-d5em` | font-size, `d` = decimal point |
140
+
141
+ `ls-0d1em` is letter-spacing (`ls-n0d05em` = -0.05em). `d` is the decimal point; `p` still works there for older apps. In spacing, `p` means percent (`w-10p`).
142
+
143
+ ## Cursor
144
+
145
+ `cursor-pointer`, `cursor-grab`, `cursor-not-allowed`, and every standard CSS cursor value with the `cursor-` prefix.
146
+
147
+ ## Rules
148
+
149
+ - Classes must appear as literal text. `` `w-${n}` `` is not detected; `cond ? 'w-10' : 'w-20'` is.
150
+ - Generated classes have normal specificity (one class), so your component CSS wins over them. Set `important: true` to make every class win instead.
151
+ - Add `!` at the end of any class to make just that class `!important`: `mt-12!`, `mt-12d5p!`, `bg-page!`.
152
+ - Output order is fixed so the more specific class wins: `p` before `pt`, `mtb` before `mt`, `mrl` before `ml`. `bds-*` is always last.
153
+ - Dev server regenerates on save and reloads the page.
package/client.d.ts ADDED
@@ -0,0 +1 @@
1
+ declare module 'virtual:css-module.css'