@umoa/saascfm-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,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,134 @@
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`, `app.colors.js` 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/assets/css/app.colors'
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 a template and rename anything. Pick `ts` or `js`.
47
+
48
+ ```bash
49
+ cp -r node_modules/@umoa/saascfm-css/templates/ts/sectioned/. src/assets/css/
50
+ ```
51
+
52
+ | Template | |
53
+ | --- | --- |
54
+ | `single/` | one `app.colors` file with everything |
55
+ | `minimal/` | one file, 8 primitives and 12 tokens |
56
+ | `sectioned/` | `app.colors` plus `primitives.colors`, `surface.colors`, `border.colors`, `status.colors`, `navigation.colors` |
57
+
58
+ In `sectioned/`, each section file exports one object, and `app.colors` imports them and spreads them into `TOKENS`. Add a section by creating `shadow.colors.ts` and adding one import and one spread line. Sections do not import each other, because tokens refer to primitives by name. Keep `.colors.` in section file names so the scanner skips them.
59
+
60
+ ## Colors
61
+
62
+ One file exports two objects.
63
+
64
+ ```ts
65
+ export const PRIMITIVES = { 'brand-500': '#3B6FF0', 'white': '#FFFFFF' }
66
+ export const TOKENS = { 'text-brand': 'brand-500', 'bg-card': 'white' }
67
+ ```
68
+
69
+ - `PRIMITIVES`: name → color. Each generates `name` (color), `bg-name`, `border-name`. `rgba`/`hsla` values generate the color class only.
70
+ - `TOKENS`: name → primitive name, or any CSS color. Each becomes `--name` on `:root`.
71
+ - 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.
72
+ - Unknown primitive names print a warning and are skipped.
73
+ - `hl`, `hl-muted`, `vl` read `--border-default` / `--border-muted`, falling back to `currentColor`.
74
+
75
+ ## Numeric classes
76
+
77
+ `{prefix}-{n?}{number}{suffix?}`
78
+
79
+ | Prefix | Property |
80
+ | --- | --- |
81
+ | `w` `h` | width, height |
82
+ | `mw` `mh` `minw` `minh` | max/min width/height |
83
+ | `mt` `mr` `mb` `ml` `mtb` `mrl` | margin |
84
+ | `p` `pt` `pr` `pb` `pl` `ptb` `prl` | padding |
85
+ | `g` `gc` `gr` | gap, column-gap, row-gap (no negatives) |
86
+ | `bdrd` | border-radius |
87
+ | `bdw` | border-width, also sets `border-style: solid` |
88
+ | `zdex` | z-index (unitless) |
89
+
90
+ 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%).
91
+
92
+ ## Static classes
93
+
94
+ | Class | |
95
+ | --- | --- |
96
+ | `bn` | border: none |
97
+ | `auto` | margin: 0 auto |
98
+ | `hl` `hl-muted` `vl` | divider lines |
99
+ | `mcon-480` `640` `768` `1080` `1280` `1440` | max-width container, centered |
100
+ | `bds-solid` `dashed` `dotted` `double` `none` | border-style (emitted last so it overrides `bdw-*`) |
101
+
102
+ ## Layout
103
+
104
+ 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`.
105
+
106
+ Grid: `grid-jist` `jie` `jic` `jistr`, `grid-aist` `aie` `aic` `aistr`.
107
+
108
+ Other: `align-l` `align-c` `align-r` (text-align), `float-l` `float-r`, `float-c` (position: fixed, centered).
109
+
110
+ ## Typography
111
+
112
+ | Class | |
113
+ | --- | --- |
114
+ | `nb` `b` `bx` | normal / bold / bolder |
115
+ | `b-100` … `b-900` | font-weight |
116
+ | `light` `lighter` (`b-light` `b-lighter`) | 300 / 100 |
117
+ | `uppercase` `lowercase` `capitalize` `text-none` | text-transform |
118
+ | `i` `underline` | italic, underline |
119
+ | `ow` `ww` | overflow-wrap + hyphens |
120
+ | `fs-1em` `fs-1d5em` `fs-d5em` | font-size, `d` = decimal point |
121
+
122
+ `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`).
123
+
124
+ ## Cursor
125
+
126
+ `cursor-pointer`, `cursor-grab`, `cursor-not-allowed`, and every standard CSS cursor value with the `cursor-` prefix.
127
+
128
+ ## Rules
129
+
130
+ - Classes must appear as literal text. `` `w-${n}` `` is not detected; `cond ? 'w-10' : 'w-20'` is.
131
+ - Generated classes have normal specificity (one class), so your component CSS wins over them. Set `important: true` to make every class win instead.
132
+ - Add `!` at the end of any class to make just that class `!important`: `mt-12!`, `mt-12d5p!`, `bg-page!`.
133
+ - Output order is fixed so the more specific class wins: `p` before `pt`, `mtb` before `mt`, `mrl` before `ml`. `bds-*` is always last.
134
+ - Dev server regenerates on save and reloads the page.
package/client.d.ts ADDED
@@ -0,0 +1 @@
1
+ declare module 'virtual:css-module.css'