@wwtdev/bsds-components-vue3 2.6.0 → 2.7.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 +56 -0
- package/lib/bsds-components.js +1167 -1040
- package/lib/components.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -138,6 +138,62 @@ export default defineNuxtConfig({
|
|
|
138
138
|
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
#### Using CSS Layers with Tailwind
|
|
142
|
+
|
|
143
|
+
You can optionally leverage native CSS `@layer` to ensure TW utilities will always trump the component styles for easier overrides.
|
|
144
|
+
|
|
145
|
+
```css
|
|
146
|
+
/* src/styles/index.css (or wherever your app styles live) */
|
|
147
|
+
|
|
148
|
+
@layer app-base, external, app, utils;
|
|
149
|
+
|
|
150
|
+
/* -- BASE -- */
|
|
151
|
+
@import "@wwtdev/bsds-components-vue3/components.css" layer(app-base);
|
|
152
|
+
|
|
153
|
+
/* -- EXTERNAL: any external stylesheets, e.g. from other 3d party libs -- */
|
|
154
|
+
@import "some-other-pkg/dist/style.css" layer(external);
|
|
155
|
+
|
|
156
|
+
/* -- APP / INTERNAL STYLES, e.g. your site's base styles --
|
|
157
|
+
All .vue <style> code will automatically be added to this layer (see "vueWrapCssWithLayerPlugin" in vite.config.js)
|
|
158
|
+
*/
|
|
159
|
+
@import "some-content.css" layer(app);
|
|
160
|
+
|
|
161
|
+
/* -- UTILITY CLASSES --
|
|
162
|
+
Due to how native CSS @layer works, and our defined layer order at the top of this file, utility classes will always trump any other styles in the app (as long as those styles are in one of our defined layers)
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
@layer utils {
|
|
166
|
+
@tailwind base;
|
|
167
|
+
@tailwind utilities;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
And then in your vite config:
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
/* vite.config.js */
|
|
176
|
+
|
|
177
|
+
// We'll need a plugin to pick up styles from our app's Vue SFCs and add them to the app layer
|
|
178
|
+
const vueWrapCssWithLayerPlugin = {
|
|
179
|
+
name: 'vue-wrap-css-with-layer',
|
|
180
|
+
transform(code, id) {
|
|
181
|
+
// if not a .vue <style> block, do nothing
|
|
182
|
+
if (!/vue&type=style/.test(id)) return
|
|
183
|
+
|
|
184
|
+
// wrap the <style> code in our "app" css layer (ensures utility classes always trump other styles, see index.css)
|
|
185
|
+
return { code: `@layer app { ${code} }`, map: null }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default defineConfig({
|
|
190
|
+
plugins: [ ...yourOtherPlugins, vueWrapCssWithLayerPlugin ],
|
|
191
|
+
/*
|
|
192
|
+
*** other configs **
|
|
193
|
+
*/
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
141
197
|
### 4. Dark Mode-compatible "semantic" color utilities
|
|
142
198
|
|
|
143
199
|
We've extended the TW theme with color utilities that will automatically adjust when using dark mode. These classes require the CSS custom properties defined in the global stylesheet (`wwt-bsds.css`). If you're not bringing that stylesheet in, either disregard these classes or manually include the properties from [tokens.css](https://github.wwt.com/custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/tokens.css) and [global.css](https://github.wwt.com/custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/global.css) in your project.
|