From bd71b03f64fd89557fe8573db5ed8f7e3e3d4863 Mon Sep 17 00:00:00 2001
From: Cagatay Civici
Date: Tue, 26 Dec 2023 11:13:55 +0300
Subject: [PATCH] Add CSS layer docs
---
assets/menu/menu.json | 41 ++++++-----
doc/{ => guides}/accessibility/ColorsDoc.vue | 0
.../accessibility/FormControlsDoc.vue | 0
.../accessibility/IntroductionDoc.vue | 0
.../accessibility/SemanticHTMLDoc.vue | 0
doc/{ => guides}/accessibility/WAIAriaDoc.vue | 0
doc/{ => guides}/accessibility/WCAGDoc.vue | 0
doc/guides/csslayer/BootstrapDoc.vue | 23 +++++++
doc/guides/csslayer/NormalizeDoc.vue | 23 +++++++
doc/guides/csslayer/ResetDoc.vue | 45 ++++++++++++
doc/guides/csslayer/SpecificityDoc.vue | 63 +++++++++++++++++
doc/guides/csslayer/TailwindDoc.vue | 33 +++++++++
doc/installation/StyledModeDoc.vue | 24 ++++++-
doc/nuxt/configuration/CSSLayerOrderDoc.vue | 2 +-
pages/{ => guides}/accessibility/index.vue | 12 ++--
pages/guides/csslayer/index.vue | 68 +++++++++++++++++++
pages/roadmap/index.vue | 12 +++-
17 files changed, 318 insertions(+), 28 deletions(-)
rename doc/{ => guides}/accessibility/ColorsDoc.vue (100%)
rename doc/{ => guides}/accessibility/FormControlsDoc.vue (100%)
rename doc/{ => guides}/accessibility/IntroductionDoc.vue (100%)
rename doc/{ => guides}/accessibility/SemanticHTMLDoc.vue (100%)
rename doc/{ => guides}/accessibility/WAIAriaDoc.vue (100%)
rename doc/{ => guides}/accessibility/WCAGDoc.vue (100%)
create mode 100644 doc/guides/csslayer/BootstrapDoc.vue
create mode 100644 doc/guides/csslayer/NormalizeDoc.vue
create mode 100644 doc/guides/csslayer/ResetDoc.vue
create mode 100644 doc/guides/csslayer/SpecificityDoc.vue
create mode 100644 doc/guides/csslayer/TailwindDoc.vue
rename pages/{ => guides}/accessibility/index.vue (80%)
create mode 100644 pages/guides/csslayer/index.vue
diff --git a/assets/menu/menu.json b/assets/menu/menu.json
index 747343581..f597c2e68 100644
--- a/assets/menu/menu.json
+++ b/assets/menu/menu.json
@@ -14,13 +14,11 @@
},
{
"name": "Nuxt",
- "to": "/nuxt",
- "badge": "NEW"
+ "to": "/nuxt"
},
{
"name": "Playground",
- "to": "/playground",
- "badge": "NEW"
+ "to": "/playground"
}
]
},
@@ -522,14 +520,23 @@
"href": "https://blocks.primevue.org"
},
{
- "name": "PrimeFlex CSS",
- "icon": "pi pi-table",
- "href": "https://primeflex.org"
- },
- {
- "name": "Accessibility",
- "icon": "pi pi-users",
- "to": "/accessibility"
+ "name": "Guides",
+ "icon": "pi pi-book",
+ "children": [
+ {
+ "name": "Accessibility",
+ "to": "/guides/accessibility"
+ },
+ {
+ "name": "CSS Layer",
+ "to": "/guides/csslayer"
+ },
+ {
+ "name": "PrimeTV",
+ "icon": "pi pi-youtube",
+ "href": "https://www.youtube.com/channel/UCTgmp69aBOlLnPEqlUyetWw"
+ }
+ ]
},
{
"name": "Support",
@@ -549,11 +556,6 @@
}
]
},
- {
- "name": "PrimeTV",
- "icon": "pi pi-youtube",
- "href": "https://www.youtube.com/channel/UCTgmp69aBOlLnPEqlUyetWw"
- },
{
"name": "Discover",
"icon": "pi pi-search",
@@ -589,6 +591,11 @@
{
"name": "PrimeGear",
"href": "https://gear.primefaces.org"
+ },
+ {
+ "name": "PrimeFlex CSS",
+ "icon": "pi pi-table",
+ "href": "https://primeflex.org"
}
]
}
diff --git a/doc/accessibility/ColorsDoc.vue b/doc/guides/accessibility/ColorsDoc.vue
similarity index 100%
rename from doc/accessibility/ColorsDoc.vue
rename to doc/guides/accessibility/ColorsDoc.vue
diff --git a/doc/accessibility/FormControlsDoc.vue b/doc/guides/accessibility/FormControlsDoc.vue
similarity index 100%
rename from doc/accessibility/FormControlsDoc.vue
rename to doc/guides/accessibility/FormControlsDoc.vue
diff --git a/doc/accessibility/IntroductionDoc.vue b/doc/guides/accessibility/IntroductionDoc.vue
similarity index 100%
rename from doc/accessibility/IntroductionDoc.vue
rename to doc/guides/accessibility/IntroductionDoc.vue
diff --git a/doc/accessibility/SemanticHTMLDoc.vue b/doc/guides/accessibility/SemanticHTMLDoc.vue
similarity index 100%
rename from doc/accessibility/SemanticHTMLDoc.vue
rename to doc/guides/accessibility/SemanticHTMLDoc.vue
diff --git a/doc/accessibility/WAIAriaDoc.vue b/doc/guides/accessibility/WAIAriaDoc.vue
similarity index 100%
rename from doc/accessibility/WAIAriaDoc.vue
rename to doc/guides/accessibility/WAIAriaDoc.vue
diff --git a/doc/accessibility/WCAGDoc.vue b/doc/guides/accessibility/WCAGDoc.vue
similarity index 100%
rename from doc/accessibility/WCAGDoc.vue
rename to doc/guides/accessibility/WCAGDoc.vue
diff --git a/doc/guides/csslayer/BootstrapDoc.vue b/doc/guides/csslayer/BootstrapDoc.vue
new file mode 100644
index 000000000..58c76a568
--- /dev/null
+++ b/doc/guides/csslayer/BootstrapDoc.vue
@@ -0,0 +1,23 @@
+
+
+ Bootstrap has a reboot utility to reset the CSS of the standard elements. If you are including this utility, you may give it a layer while importing it.
+
+
+
+
+
diff --git a/doc/guides/csslayer/NormalizeDoc.vue b/doc/guides/csslayer/NormalizeDoc.vue
new file mode 100644
index 000000000..d158c8505
--- /dev/null
+++ b/doc/guides/csslayer/NormalizeDoc.vue
@@ -0,0 +1,23 @@
+
+
+ Normalize is another utility to reset CSS of the standard elements. While importing the CSS file, assign it to a layer and define the layer order with primevue coming after the normalized layer.
+
+
+
+
+
diff --git a/doc/guides/csslayer/ResetDoc.vue b/doc/guides/csslayer/ResetDoc.vue
new file mode 100644
index 000000000..8026d6a1e
--- /dev/null
+++ b/doc/guides/csslayer/ResetDoc.vue
@@ -0,0 +1,45 @@
+
+
+
+ Ease of customization may present an issue if you have global styles on HTML elements like inputs and buttons that are also utilized by PrimeVue because global styles with a broader scope e.g. button { } and no layer always
+ override the PrimeVue components leading to unexpected results. A common use case for global styles applying to standard HTML elements is CSS reset utilities to remove the default styling of the browsers. In this case, best practice is
+ wrapping your CSS in a layer like reset and make sure primevue comes after your layer since layers defined after has higher precedence. This way, your Reset CSS does not get in the way of PrimeVue components.
+
+
+ If you are using Nuxt, use the built-in cssLayerOrder property of the PrimeVue nuxt module instead.
+
+
+
+
+
+
diff --git a/doc/guides/csslayer/SpecificityDoc.vue b/doc/guides/csslayer/SpecificityDoc.vue
new file mode 100644
index 000000000..aa343cf39
--- /dev/null
+++ b/doc/guides/csslayer/SpecificityDoc.vue
@@ -0,0 +1,63 @@
+
+
+ A CSS layer is utilized in styled mode only, in unstyled mode the built-in CSS classes are not included and as a result no layer is defined. This documentation only applies to styled mode.
+
+ The @layer is a standard CSS feature to define cascade layers for a customizable order of precedence. If you need to become more familiar with layers, visit the documentation at
+ MDN to begin with. In styled mode, PrimeVue wraps the built-in style classes under the primevue cascade layer to make the library styles easy to override. CSS in
+ your app without a layer has the highest CSS specificity, so you'll be able to override styles regardless of the location or how strong a class is written.
+
+
+ For example, let's assume you need to remove the rounded borders of the InputSwitch component defined by the theme in use. In order to achieve this, .p-inputswitch .p-inputswitch-slider selector needs to be overriden. Without the
+ layers, we'd have to write a stronger css or use !important however, with layers, this does not present an issue as your CSS can always override PrimeVue with a more straightforward class name such as my-switch-slider.
+ Another advantage of this approach is that it does not force you to figure out the built-in class names of the components.
+
+
+
+
+
+ Layers also make it possible to use CSS Modules, view the CSS Modules guide for examples.
+
+
+
+
+
+
diff --git a/doc/guides/csslayer/TailwindDoc.vue b/doc/guides/csslayer/TailwindDoc.vue
new file mode 100644
index 000000000..dda77ddf2
--- /dev/null
+++ b/doc/guides/csslayer/TailwindDoc.vue
@@ -0,0 +1,33 @@
+
+
+
+ Tailwind CSS includes a reset utility in base called preflight. If you are using this feature, wrap the base and utilities in separate layers
+ and make sure primevue layer comes after the base.
+
+
+
+
+
+
diff --git a/doc/installation/StyledModeDoc.vue b/doc/installation/StyledModeDoc.vue
index d87b40aae..49c9af453 100644
--- a/doc/installation/StyledModeDoc.vue
+++ b/doc/installation/StyledModeDoc.vue
@@ -4,7 +4,13 @@
Styled mode is based on pre-skinned components with opinionated themes like Material, Bootstrap or PrimeOne themes. Theme is the required css file to be imported, visit the
Themes section for the complete list of available themes to choose from.
-
+
+
+ The classes of PrimeVue is defined under the primevue CSS layer to be easier to customize by having low specificity. If you are using a CSS library that styles default HTML elements such as Tailwind Preflight, Bootstrap, Normalize
+ or similar a custom CSS layer configuration might be necessary. Note that this only applies to Styled Mode as Unstyled Mode does not use any default styles or layers. Here is an example with Tailwind, visit the
+ CSS Layer for more information.
+
+
@@ -12,8 +18,22 @@
export default {
data() {
return {
- code: {
+ code1: {
basic: "\nimport 'primevue/resources/themes/lara-light-green/theme.css'\n"
+ },
+ code2: {
+ basic: `
+@layer tailwind-base, primereact, tailwind-utilities;
+
+@layer tailwind-base {
+ @tailwind base;
+}
+
+@layer tailwind-utilities {
+ @tailwind components;
+ @tailwind utilities;
+}
+`
}
};
}
diff --git a/doc/nuxt/configuration/CSSLayerOrderDoc.vue b/doc/nuxt/configuration/CSSLayerOrderDoc.vue
index 4d1b81a57..240c10431 100644
--- a/doc/nuxt/configuration/CSSLayerOrderDoc.vue
+++ b/doc/nuxt/configuration/CSSLayerOrderDoc.vue
@@ -1,6 +1,6 @@
- Defines the CSS layer order setting for compatibility with libraries like Tailwind.
+ Defines the CSS layer order setting for compatibility with libraries like Tailwind and Bootstrap in styled mode. Visit the CSS Layer guide for detailed information.
diff --git a/pages/accessibility/index.vue b/pages/guides/accessibility/index.vue
similarity index 80%
rename from pages/accessibility/index.vue
rename to pages/guides/accessibility/index.vue
index 4368e620d..2eac2d9ef 100644
--- a/pages/accessibility/index.vue
+++ b/pages/guides/accessibility/index.vue
@@ -19,12 +19,12 @@
diff --git a/pages/roadmap/index.vue b/pages/roadmap/index.vue
index f075ad043..f6da98c82 100644
--- a/pages/roadmap/index.vue
+++ b/pages/roadmap/index.vue
@@ -165,8 +165,16 @@
-
Designer
-
+
Design
+
+
+
New UI Theme
+
Brand new default theme with a modern and attractive design.
+
+
+
New UI Based Theme Editor