uniskin 0.2.0 → 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/README.md +126 -0
- package/dist/coverage.d.ts +17 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +36 -0
- package/dist/coverage.js.map +1 -0
- package/dist/default-theme.d.ts +402 -16
- package/dist/default-theme.d.ts.map +1 -1
- package/dist/default-theme.js +383 -18
- package/dist/default-theme.js.map +1 -1
- package/dist/emit.d.ts +4 -2
- package/dist/emit.d.ts.map +1 -1
- package/dist/emit.js +24 -2
- package/dist/emit.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/merge.d.ts +16 -3
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +73 -12
- package/dist/merge.js.map +1 -1
- package/dist/types.d.ts +18 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# uniskin
|
|
2
|
+
|
|
3
|
+
One semantic class vocabulary, swappable Tailwind CSS v4 UI skins.
|
|
4
|
+
|
|
5
|
+
[Live demo](https://uniskin-css.vercel.app) · [Skin builder](https://uniskin-css.vercel.app/builder/) · [GitHub](https://github.com/Munawarhussain729/uniskin)
|
|
6
|
+
|
|
7
|
+
Write `ui-button ui-primary` once, in plain HTML, React, Vue, PHP or anything
|
|
8
|
+
else. Pick an **adapter** in your CSS to decide how it looks: the built-in
|
|
9
|
+
default, a shadcn/ui look, a daisyUI look, or your own. Switching adapters
|
|
10
|
+
needs **zero markup changes**. The output is CSS only, with no runtime
|
|
11
|
+
JavaScript.
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
@import "tailwindcss";
|
|
15
|
+
@plugin "uniskin" { adapter: "shadcn"; } /* or "daisyui", or "./my-adapter.js" */
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<button class="ui-button ui-primary ui-outline ui-sm">Save</button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
The quickest way is the CLI. It detects your package manager and Tailwind v4
|
|
25
|
+
stylesheet, installs the packages and adds the `@plugin` line for you:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx uniskin init
|
|
29
|
+
# or choose the skin up front
|
|
30
|
+
npx uniskin init --adapter shadcn --yes
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or install by hand:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npm install uniskin # core plugin + built-in default skin
|
|
37
|
+
npm install @uniskin/shadcn # optional: shadcn/ui look
|
|
38
|
+
npm install @uniskin/daisyui daisyui # optional: daisyUI look
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then add the `@plugin` line to your Tailwind entry CSS (see above).
|
|
42
|
+
|
|
43
|
+
Requires **tailwindcss 4.3.3 or newer**.
|
|
44
|
+
|
|
45
|
+
## Plugin options
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
@plugin "uniskin" {
|
|
49
|
+
adapter: "shadcn"; /* "default" | "shadcn" | "daisyui" | package name | "./path.js" */
|
|
50
|
+
prefix: "ui"; /* class prefix: ui-button, or uk-button with prefix "uk" */
|
|
51
|
+
dark: "media"; /* "media" | "class" | false */
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
| Option | Default | What it does |
|
|
56
|
+
|-----------|-------------|--------------|
|
|
57
|
+
| `adapter` | `"default"` | Which skin to use. A relative path or package name resolves from the stylesheet that declared `@plugin`. |
|
|
58
|
+
| `prefix` | `"ui"` | Class prefix for every class and keyframe. |
|
|
59
|
+
| `dark` | `"media"` | `"media"`: `.dark` / `[data-theme="dark"]` plus `prefers-color-scheme: dark`. `"class"`: only the class or attribute. `false`: no dark tokens. |
|
|
60
|
+
| `debug` | `false` | Print the full list of slots an adapter leaves to the default style. Also enabled by `UNISKIN_DEBUG=1`. |
|
|
61
|
+
|
|
62
|
+
## Vocabulary
|
|
63
|
+
|
|
64
|
+
| Kind | Classes |
|
|
65
|
+
|------------|---------|
|
|
66
|
+
| Components | `ui-button`, `ui-input`, `ui-textarea`, `ui-select`, `ui-checkbox`, `ui-radio`, `ui-switch`, `ui-field`, `ui-card`, `ui-badge`, `ui-alert`, `ui-modal`, `ui-tabs` |
|
|
67
|
+
| Parts | `ui-field-label`, `ui-field-hint`, `ui-field-error`, `ui-card-header`, `ui-card-body`, `ui-card-footer`, `ui-modal-box`, `ui-tab` |
|
|
68
|
+
| Intent | `ui-primary`, `ui-secondary`, `ui-success`, `ui-warning`, `ui-danger` |
|
|
69
|
+
| Style | `ui-outline`, `ui-ghost`, `ui-soft` (solid is the default) |
|
|
70
|
+
| Size | `ui-sm`, `ui-lg` (medium is the default) |
|
|
71
|
+
| State | `ui-disabled`, `ui-loading`, `ui-active` |
|
|
72
|
+
|
|
73
|
+
- Intents and styles combine freely: `ui-danger ui-outline`.
|
|
74
|
+
- Modifiers compile to compound selectors (`.ui-button.ui-primary`), so
|
|
75
|
+
`ui-outline` on a button and on a card can look completely different.
|
|
76
|
+
- States also style their native equivalents: `ui-disabled` matches
|
|
77
|
+
`:disabled` and `[aria-disabled="true"]`, `ui-loading` matches
|
|
78
|
+
`[aria-busy="true"]`, `ui-active` matches `[aria-selected="true"]` and
|
|
79
|
+
`[aria-pressed="true"]`.
|
|
80
|
+
- Every interactive component has `:focus-visible` styling, and animations
|
|
81
|
+
respect `prefers-reduced-motion`.
|
|
82
|
+
|
|
83
|
+
Classes are emitted on demand from Tailwind's automatic content detection, the
|
|
84
|
+
same scanning that finds `p-4` finds `ui-button`. Per-component markup,
|
|
85
|
+
modifiers and accessibility notes are in the
|
|
86
|
+
[vocabulary reference](https://github.com/Munawarhussain729/uniskin/blob/main/docs/vocabulary.md).
|
|
87
|
+
|
|
88
|
+
## Write your own adapter
|
|
89
|
+
|
|
90
|
+
An adapter overrides only what it wants; everything else falls back to the
|
|
91
|
+
default skin.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
// my-adapter.ts
|
|
95
|
+
import { defineAdapter } from "uniskin/adapter";
|
|
96
|
+
|
|
97
|
+
export default defineAdapter({
|
|
98
|
+
name: "acme",
|
|
99
|
+
tokens: { "--ui-primary": "rebeccapurple" },
|
|
100
|
+
components: {
|
|
101
|
+
button: {
|
|
102
|
+
base: { "border-radius": "999px" },
|
|
103
|
+
styles: { outline: { "border-width": "2px" } },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
@plugin "uniskin" { adapter: "./my-adapter.ts"; }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`npx uniskin new-adapter <name>` scaffolds one. See the
|
|
114
|
+
[adapter guide](https://github.com/Munawarhussain729/uniskin/blob/main/docs/writing-adapters.md).
|
|
115
|
+
|
|
116
|
+
## Documentation
|
|
117
|
+
|
|
118
|
+
- [Getting started](https://github.com/Munawarhussain729/uniskin/blob/main/docs/getting-started.md)
|
|
119
|
+
- [CLI reference](https://github.com/Munawarhussain729/uniskin/blob/main/docs/cli.md)
|
|
120
|
+
- [Vocabulary reference](https://github.com/Munawarhussain729/uniskin/blob/main/docs/vocabulary.md)
|
|
121
|
+
- [Writing adapters](https://github.com/Munawarhussain729/uniskin/blob/main/docs/writing-adapters.md)
|
|
122
|
+
- [Changelog](https://github.com/Munawarhussain729/uniskin/blob/main/packages/uniskin/CHANGELOG.md)
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComponentName, type Intent, type SizeModifier, type StateModifier, type StyleModifier } from "./types.js";
|
|
2
|
+
/** Which modifiers a component supports. Mirrors the coverage matrix in `docs/vocabulary.md`. */
|
|
3
|
+
export interface Coverage {
|
|
4
|
+
intents: readonly Intent[];
|
|
5
|
+
styles: readonly StyleModifier[];
|
|
6
|
+
sizes: readonly SizeModifier[];
|
|
7
|
+
states: readonly StateModifier[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The documented coverage matrix, keyed by component. `warnUnsupported`
|
|
11
|
+
* checks adapters against this rather than against every modifier, so a
|
|
12
|
+
* fully conforming adapter is not warned about combinations that are not
|
|
13
|
+
* part of the vocabulary. `test/vocabulary-docs.test.ts` keeps it in sync
|
|
14
|
+
* with the table in `docs/vocabulary.md`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COVERAGE: Record<ComponentName, Coverage>;
|
|
17
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,iGAAiG;AACjG,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;CAClC;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,aAAa,EAAE,QAAQ,CAwBpD,CAAC"}
|
package/dist/coverage.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { INTENTS, SIZES, STATES, STYLES, } from "./types.js";
|
|
2
|
+
const NONE = { intents: [], styles: [], sizes: [], states: [] };
|
|
3
|
+
const ALL = { intents: INTENTS, styles: STYLES, sizes: SIZES, states: STATES };
|
|
4
|
+
/**
|
|
5
|
+
* The documented coverage matrix, keyed by component. `warnUnsupported`
|
|
6
|
+
* checks adapters against this rather than against every modifier, so a
|
|
7
|
+
* fully conforming adapter is not warned about combinations that are not
|
|
8
|
+
* part of the vocabulary. `test/vocabulary-docs.test.ts` keeps it in sync
|
|
9
|
+
* with the table in `docs/vocabulary.md`.
|
|
10
|
+
*/
|
|
11
|
+
export const COVERAGE = {
|
|
12
|
+
button: ALL,
|
|
13
|
+
input: ALL,
|
|
14
|
+
textarea: ALL,
|
|
15
|
+
select: ALL,
|
|
16
|
+
checkbox: ALL,
|
|
17
|
+
radio: ALL,
|
|
18
|
+
switch: ALL,
|
|
19
|
+
field: NONE,
|
|
20
|
+
"field-label": NONE,
|
|
21
|
+
"field-hint": NONE,
|
|
22
|
+
"field-error": NONE,
|
|
23
|
+
card: ALL,
|
|
24
|
+
"card-header": NONE,
|
|
25
|
+
"card-body": NONE,
|
|
26
|
+
"card-footer": NONE,
|
|
27
|
+
badge: ALL,
|
|
28
|
+
alert: ALL,
|
|
29
|
+
modal: { ...NONE, styles: ["ghost", "soft"], sizes: SIZES, states: ["active"] },
|
|
30
|
+
"modal-box": { ...NONE, intents: INTENTS, sizes: SIZES },
|
|
31
|
+
tabs: { ...ALL, states: [] },
|
|
32
|
+
tab: { ...NONE, intents: INTENTS, sizes: SIZES, states: STATES },
|
|
33
|
+
table: ALL,
|
|
34
|
+
"table-wrap": NONE,
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,GAMP,MAAM,YAAY,CAAC;AAUpB,MAAM,IAAI,GAAa,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,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