@vuecs/theme-tailwind 1.0.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 +201 -0
- package/README.md +40 -0
- package/assets/index.css +172 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1397 -0
- package/dist/index.mjs.map +1 -0
- package/dist/palette.d.ts +32 -0
- package/dist/palette.d.ts.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2021-2026 Peter Placzek
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @vuecs/theme-tailwind
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/@vuecs%2Ftheme-tailwind)
|
|
4
|
+
[](https://github.com/Tada5hi/vuecs/actions/workflows/main.yml)
|
|
5
|
+
|
|
6
|
+
Tailwind v4 theme for vuecs components. Class-string mappings + `merge: ClassesMergeFn`
|
|
7
|
+
backed by `twMerge` + the Tailwind palette runtime (`setColorPalette`,
|
|
8
|
+
`renderColorPaletteStyles`). Contributes its renderer via `palette.handle` so
|
|
9
|
+
`useColorPalette()` from `@vuecs/design` dispatches through it. Re-binds
|
|
10
|
+
`--vc-color-*` to Tailwind palette names so runtime swaps work, exposes vuecs
|
|
11
|
+
tokens via `@theme`, and force-includes all 22 Tailwind palettes via
|
|
12
|
+
`@source inline()`.
|
|
13
|
+
|
|
14
|
+
`useColorPalette` / `ColorPaletteConfig` live in `@vuecs/design` since plan 026.
|
|
15
|
+
Deprecated re-exports remain in this package for one release cycle.
|
|
16
|
+
|
|
17
|
+
For Nuxt apps, the cookie-backed `useColorPalette` ships from
|
|
18
|
+
[`@vuecs/nuxt`](../../packages/nuxt) — one theme-agnostic Nuxt module
|
|
19
|
+
handles palette switching for every theme.
|
|
20
|
+
|
|
21
|
+
Full documentation: **[vuecs.dev/themes/tailwind](https://vuecs.dev/themes/tailwind)**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @vuecs/theme-tailwind @vuecs/design
|
|
25
|
+
npm install -D tailwindcss @tailwindcss/vite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
@import "tailwindcss";
|
|
30
|
+
@import "@vuecs/design";
|
|
31
|
+
@import "@vuecs/theme-tailwind";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Requires Tailwind CSS v4+.
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
Made with 💚
|
|
39
|
+
|
|
40
|
+
Published under [Apache 2.0 License](./LICENSE).
|
package/assets/index.css
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @vuecs/theme-tailwind — Tailwind v4 bridge
|
|
3
|
+
*
|
|
4
|
+
* Two jobs, all Tailwind-specific:
|
|
5
|
+
*
|
|
6
|
+
* 1. Expose vuecs tokens as Tailwind v4 color/radius names via an
|
|
7
|
+
* `@theme` block, so component class strings can use
|
|
8
|
+
* `bg-primary-600`, `text-fg`, `rounded-md`, etc.
|
|
9
|
+
*
|
|
10
|
+
* 2. Force-include all 22 Tailwind palettes × 11 shades via
|
|
11
|
+
* `@source inline()`, so any `setColorPalette({ primary: 'emerald' })`
|
|
12
|
+
* call resolves to a real `--color-emerald-*` value (Tailwind
|
|
13
|
+
* v4's JIT only emits palettes referenced by used classes
|
|
14
|
+
* otherwise).
|
|
15
|
+
*
|
|
16
|
+
* The `--vc-color-<scale>-*: var(--color-<palette>-*)` rebind that
|
|
17
|
+
* used to live here moved into `@vuecs/design/assets/index.css`
|
|
18
|
+
* (single source of truth) — design's semantic scales now reference
|
|
19
|
+
* the Tailwind palette catalog directly, and `setColorPalette()`
|
|
20
|
+
* works against the same `--color-<palette>-*` source variables
|
|
21
|
+
* whether Tailwind or `@vuecs/design/standalone` provides them.
|
|
22
|
+
*
|
|
23
|
+
* Consumers (when using the Tailwind theme):
|
|
24
|
+
* @import "tailwindcss";
|
|
25
|
+
* @import "@vuecs/design";
|
|
26
|
+
* @import "@vuecs/theme-tailwind";
|
|
27
|
+
*
|
|
28
|
+
* Consumers using @vuecs/theme-bootstrap or @vuecs/theme-bulma do NOT
|
|
29
|
+
* need this file — `@vuecs/design/standalone` carries the palette
|
|
30
|
+
* catalog those themes need.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/* -----------------------------------------------------------------
|
|
35
|
+
Tailwind v4 @theme block — expose vuecs tokens as Tailwind
|
|
36
|
+
color/radius names so components can write e.g. `bg-primary-600`,
|
|
37
|
+
`text-fg`, `rounded-md` and have them resolve to the vc token
|
|
38
|
+
chain. Non-inline so browser-time swaps (.dark, setColorPalette) work.
|
|
39
|
+
----------------------------------------------------------------- */
|
|
40
|
+
|
|
41
|
+
@theme {
|
|
42
|
+
--color-primary-50: var(--vc-color-primary-50);
|
|
43
|
+
--color-primary-100: var(--vc-color-primary-100);
|
|
44
|
+
--color-primary-200: var(--vc-color-primary-200);
|
|
45
|
+
--color-primary-300: var(--vc-color-primary-300);
|
|
46
|
+
--color-primary-400: var(--vc-color-primary-400);
|
|
47
|
+
--color-primary-500: var(--vc-color-primary-500);
|
|
48
|
+
--color-primary-600: var(--vc-color-primary-600);
|
|
49
|
+
--color-primary-700: var(--vc-color-primary-700);
|
|
50
|
+
--color-primary-800: var(--vc-color-primary-800);
|
|
51
|
+
--color-primary-900: var(--vc-color-primary-900);
|
|
52
|
+
--color-primary-950: var(--vc-color-primary-950);
|
|
53
|
+
|
|
54
|
+
--color-success-50: var(--vc-color-success-50);
|
|
55
|
+
--color-success-100: var(--vc-color-success-100);
|
|
56
|
+
--color-success-200: var(--vc-color-success-200);
|
|
57
|
+
--color-success-300: var(--vc-color-success-300);
|
|
58
|
+
--color-success-400: var(--vc-color-success-400);
|
|
59
|
+
--color-success-500: var(--vc-color-success-500);
|
|
60
|
+
--color-success-600: var(--vc-color-success-600);
|
|
61
|
+
--color-success-700: var(--vc-color-success-700);
|
|
62
|
+
--color-success-800: var(--vc-color-success-800);
|
|
63
|
+
--color-success-900: var(--vc-color-success-900);
|
|
64
|
+
--color-success-950: var(--vc-color-success-950);
|
|
65
|
+
|
|
66
|
+
--color-warning-50: var(--vc-color-warning-50);
|
|
67
|
+
--color-warning-100: var(--vc-color-warning-100);
|
|
68
|
+
--color-warning-200: var(--vc-color-warning-200);
|
|
69
|
+
--color-warning-300: var(--vc-color-warning-300);
|
|
70
|
+
--color-warning-400: var(--vc-color-warning-400);
|
|
71
|
+
--color-warning-500: var(--vc-color-warning-500);
|
|
72
|
+
--color-warning-600: var(--vc-color-warning-600);
|
|
73
|
+
--color-warning-700: var(--vc-color-warning-700);
|
|
74
|
+
--color-warning-800: var(--vc-color-warning-800);
|
|
75
|
+
--color-warning-900: var(--vc-color-warning-900);
|
|
76
|
+
--color-warning-950: var(--vc-color-warning-950);
|
|
77
|
+
|
|
78
|
+
--color-error-50: var(--vc-color-error-50);
|
|
79
|
+
--color-error-100: var(--vc-color-error-100);
|
|
80
|
+
--color-error-200: var(--vc-color-error-200);
|
|
81
|
+
--color-error-300: var(--vc-color-error-300);
|
|
82
|
+
--color-error-400: var(--vc-color-error-400);
|
|
83
|
+
--color-error-500: var(--vc-color-error-500);
|
|
84
|
+
--color-error-600: var(--vc-color-error-600);
|
|
85
|
+
--color-error-700: var(--vc-color-error-700);
|
|
86
|
+
--color-error-800: var(--vc-color-error-800);
|
|
87
|
+
--color-error-900: var(--vc-color-error-900);
|
|
88
|
+
--color-error-950: var(--vc-color-error-950);
|
|
89
|
+
|
|
90
|
+
--color-info-50: var(--vc-color-info-50);
|
|
91
|
+
--color-info-100: var(--vc-color-info-100);
|
|
92
|
+
--color-info-200: var(--vc-color-info-200);
|
|
93
|
+
--color-info-300: var(--vc-color-info-300);
|
|
94
|
+
--color-info-400: var(--vc-color-info-400);
|
|
95
|
+
--color-info-500: var(--vc-color-info-500);
|
|
96
|
+
--color-info-600: var(--vc-color-info-600);
|
|
97
|
+
--color-info-700: var(--vc-color-info-700);
|
|
98
|
+
--color-info-800: var(--vc-color-info-800);
|
|
99
|
+
--color-info-900: var(--vc-color-info-900);
|
|
100
|
+
--color-info-950: var(--vc-color-info-950);
|
|
101
|
+
|
|
102
|
+
/* NOTE: we deliberately do NOT override Tailwind's `--color-neutral-*`
|
|
103
|
+
here. Doing so would create a circular reference because the
|
|
104
|
+
`:root` block above binds `--vc-color-neutral-*: var(--color-neutral-*)`
|
|
105
|
+
(so the semantic scale follows Tailwind's `neutral` palette by
|
|
106
|
+
default). Cycle would resolve invalid for every neutral-based
|
|
107
|
+
token, including the semantic aliases below — breaking the dark
|
|
108
|
+
mode flip entirely.
|
|
109
|
+
|
|
110
|
+
Trade-off: utility classes like `bg-neutral-500` use Tailwind's
|
|
111
|
+
default neutral palette and DO NOT follow `setColorPalette({ neutral })`
|
|
112
|
+
at runtime. The semantic aliases (`bg-bg`, `text-fg`, etc., below)
|
|
113
|
+
DO follow palette swaps because they reference `--vc-color-neutral-*`
|
|
114
|
+
directly, which is overridden by the runtime setColorPalette() output. */
|
|
115
|
+
|
|
116
|
+
/* Semantic aliases (light/dark flip via .dark) */
|
|
117
|
+
--color-bg: var(--vc-color-bg);
|
|
118
|
+
--color-bg-muted: var(--vc-color-bg-muted);
|
|
119
|
+
--color-bg-elevated: var(--vc-color-bg-elevated);
|
|
120
|
+
--color-fg: var(--vc-color-fg);
|
|
121
|
+
--color-fg-muted: var(--vc-color-fg-muted);
|
|
122
|
+
--color-border: var(--vc-color-border);
|
|
123
|
+
--color-border-muted: var(--vc-color-border-muted);
|
|
124
|
+
--color-ring: var(--vc-color-ring);
|
|
125
|
+
|
|
126
|
+
--color-on-primary: var(--vc-color-on-primary);
|
|
127
|
+
--color-on-success: var(--vc-color-on-success);
|
|
128
|
+
--color-on-warning: var(--vc-color-on-warning);
|
|
129
|
+
--color-on-error: var(--vc-color-on-error);
|
|
130
|
+
--color-on-info: var(--vc-color-on-info);
|
|
131
|
+
--color-on-neutral: var(--vc-color-on-neutral);
|
|
132
|
+
|
|
133
|
+
/* Radius */
|
|
134
|
+
--radius-sm: var(--vc-radius-sm);
|
|
135
|
+
--radius-md: var(--vc-radius-md);
|
|
136
|
+
--radius-lg: var(--vc-radius-lg);
|
|
137
|
+
--radius-xl: var(--vc-radius-xl);
|
|
138
|
+
--radius-full: var(--vc-radius-full);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* -----------------------------------------------------------------
|
|
142
|
+
Force-include all 22 Tailwind palettes × 11 shades.
|
|
143
|
+
|
|
144
|
+
Runtime palette switching via `setColorPalette()` rewrites
|
|
145
|
+
`--vc-color-<scale>-*` to `var(--color-<palette>-*)`. Tailwind v4's
|
|
146
|
+
JIT only emits palettes referenced by used classes — so without
|
|
147
|
+
this directive, only the palettes the consumer happens to use in
|
|
148
|
+
utility classes are compiled, and `setColorPalette({ primary: 'emerald' })`
|
|
149
|
+
would silently fail because `--color-emerald-*` was tree-shaken.
|
|
150
|
+
|
|
151
|
+
We include all 22 palettes so any setColorPalette() call resolves to
|
|
152
|
+
real CSS variables. Adds a few KB of unused class definitions to
|
|
153
|
+
the bundle — the cost of "runtime palette switching just works".
|
|
154
|
+
|
|
155
|
+
Why `bg-{palette}-{shade}` and not the underlying var directly?
|
|
156
|
+
Tailwind v4 keeps a `--color-<palette>-<shade>` token in the
|
|
157
|
+
compiled output as a *side effect* of any utility class that
|
|
158
|
+
references that palette/shade pair (`bg-`, `text-`, `border-`,
|
|
159
|
+
`ring-` all work). `bg-` is the most universally used family and
|
|
160
|
+
covers the full shade range. This is a documented Tailwind v4
|
|
161
|
+
behavior, not an internal — see the `@source inline` directive
|
|
162
|
+
docs — but it does couple this file to v4's safelist semantics.
|
|
163
|
+
If a future Tailwind major changes how palette emission works,
|
|
164
|
+
this directive may need to be updated alongside.
|
|
165
|
+
|
|
166
|
+
Consumers who don't need this (e.g. a fixed brand color) can
|
|
167
|
+
override by importing only the @theme + :root portions of this
|
|
168
|
+
file via a fork; or opt into a smaller subset via their own
|
|
169
|
+
`@source inline()` directive after this import.
|
|
170
|
+
----------------------------------------------------------------- */
|
|
171
|
+
|
|
172
|
+
@source inline("bg-{red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose,slate,gray,zinc,stone,neutral}-{50,100,200,300,400,500,600,700,800,900,950}");
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind-theme config keys. Augments the cross-cutting `Config`
|
|
3
|
+
* interface in `@vuecs/core`. Side-effect imported by this package's
|
|
4
|
+
* `index.ts` so the augmentation is loaded whenever consumers depend
|
|
5
|
+
* on `@vuecs/theme-tailwind`.
|
|
6
|
+
*
|
|
7
|
+
* No `withDefaults` registration here — `nonce` has no sensible
|
|
8
|
+
* framework default; it must come from the consumer's CSP setup.
|
|
9
|
+
* `setColorPalette` may read it via `useConfig('nonce')` (returns
|
|
10
|
+
* `undefined` when unset).
|
|
11
|
+
*/
|
|
12
|
+
declare module '@vuecs/core' {
|
|
13
|
+
interface Config {
|
|
14
|
+
/**
|
|
15
|
+
* CSP nonce written onto inline `<style>` tags created at
|
|
16
|
+
* runtime — used by `setColorPalette`'s `<style id="vc-color-palette">`
|
|
17
|
+
* block. When unset, no `nonce` attribute is added (works in
|
|
18
|
+
* non-CSP environments and in CSP environments that allow
|
|
19
|
+
* unsafe-inline for styles).
|
|
20
|
+
*/
|
|
21
|
+
nonce?: string;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,OAAO,QAAQ,aAAa,CAAC;IACzB,UAAU,MAAM;QACZ;;;;;;WAMG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB;CACJ;AAED,OAAO,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ClassesMergeFn, Theme } from '@vuecs/core';
|
|
2
|
+
import './config';
|
|
3
|
+
export { renderColorPaletteStyles, setColorPalette } from './palette';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Import `useColorPalette` from `@vuecs/design` instead.
|
|
6
|
+
*
|
|
7
|
+
* The per-theme wrapper previously auto-wired the CSP nonce via
|
|
8
|
+
* `useConfig('nonce')` from `@vuecs/core`. The design-level composable
|
|
9
|
+
* does not. If you rely on CSP nonces, pass `nonce` explicitly:
|
|
10
|
+
*
|
|
11
|
+
* import { useColorPalette } from '@vuecs/design';
|
|
12
|
+
* import { useConfig } from '@vuecs/core';
|
|
13
|
+
* const { current, set } = useColorPalette({
|
|
14
|
+
* nonce: () => useConfig('nonce').value,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* Will be removed in the next major version of `@vuecs/theme-tailwind`.
|
|
18
|
+
*/
|
|
19
|
+
export { useColorPalette } from '@vuecs/design';
|
|
20
|
+
/** @deprecated Import from `@vuecs/design` instead. */
|
|
21
|
+
export type { UseColorPaletteOptions, UseColorPaletteReturn } from '@vuecs/design';
|
|
22
|
+
export { COLOR_PALETTE_STYLE_ELEMENT_ID, applyColorPaletteCss, bindColorPalette, } from '@vuecs/design';
|
|
23
|
+
/** @deprecated Import from `@vuecs/design` instead — the canonical `ColorPaletteConfig` lives there since plan 026. */
|
|
24
|
+
export type { ColorPaletteConfig } from '@vuecs/design';
|
|
25
|
+
export declare const merge: ClassesMergeFn;
|
|
26
|
+
/**
|
|
27
|
+
* Tailwind theme for vuecs components.
|
|
28
|
+
*
|
|
29
|
+
* Class strings reference **semantic Tailwind colors** that this package
|
|
30
|
+
* exposes via a Tailwind v4 `@theme` block in `assets/index.css` — e.g.
|
|
31
|
+
* `bg-primary-600`, `text-fg`, `border-border`. The `@theme` block maps
|
|
32
|
+
* Tailwind's `--color-*` names onto `--vc-color-*` CSS variables, which
|
|
33
|
+
* `@vuecs/design` defines as concrete OKLCH literals.
|
|
34
|
+
*
|
|
35
|
+
* Consumers must:
|
|
36
|
+
* 1. Use Tailwind CSS v4 (v3 is not supported).
|
|
37
|
+
* 2. Import `@vuecs/design` (concrete tokens) AND `@vuecs/theme-tailwind`
|
|
38
|
+
* (Tailwind rebind + `@theme` block + safelist) alongside their
|
|
39
|
+
* Tailwind stylesheet.
|
|
40
|
+
*
|
|
41
|
+
* Reskinning is done by redefining `--vc-color-*` variables (manually or
|
|
42
|
+
* via `setColorPalette()`, exported from this package). No theme override
|
|
43
|
+
* needed.
|
|
44
|
+
*/
|
|
45
|
+
export default function tailwindTheme(): Theme;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,UAAU,CAAC;AAGlB,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACtE;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,uDAAuD;AACvD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAMnF,OAAO,EACH,8BAA8B,EAC9B,oBAAoB,EACpB,gBAAgB,GACnB,MAAM,eAAe,CAAC;AACvB,uHAAuH;AACvH,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,eAAO,MAAM,KAAK,EAAE,cAA4D,CAAC;AAEjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,KAAK,CAm/B7C"}
|