@anyblades/blades 3.1.0-alpha.1 → 3.1.0-beta.2
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 +78 -3
- package/css/blades.css +371 -978
- package/css/blades.min.css +74 -37
- package/css/blades.ninja.css +4057 -0
- package/css/blades.ninja.min.css +190 -0
- package/css/float-label.css +207 -0
- package/css/float-label.min.css +55 -0
- package/css/{pico.layered.css → layered/blades.layered.css} +654 -397
- package/css/layered/blades.layered.min.css +184 -0
- package/css/layered/compact.css +54 -0
- package/css/layered/components/accordion.css +85 -0
- package/css/layered/components/card.css +48 -0
- package/css/layered/components/dropdown.css +191 -0
- package/css/layered/components/group.css +208 -0
- package/css/layered/components/loading.css +43 -0
- package/css/layered/components/modal.css +158 -0
- package/css/layered/components/nav.css +117 -0
- package/css/layered/components/progress.css +76 -0
- package/css/layered/components/tooltip.css +176 -0
- package/css/layered/components.css +1082 -0
- package/css/layered/content/button.css +208 -0
- package/css/layered/content/code.css +64 -0
- package/css/layered/content/embedded-content.css +41 -0
- package/css/layered/content/figure.css +15 -0
- package/css/layered/content/link.css +84 -0
- package/css/layered/content/misc.css +22 -0
- package/css/layered/content/table.css +33 -0
- package/css/layered/content/typography.css +159 -0
- package/css/layered/content.css +611 -0
- package/css/layered/forms/basics.css +338 -0
- package/css/layered/forms/checkbox-radio-switch.css +164 -0
- package/css/layered/forms/input-color.css +20 -0
- package/css/layered/forms/input-datetime.css +57 -0
- package/css/layered/forms/input-file.css +29 -0
- package/css/layered/forms/input-range.css +121 -0
- package/css/layered/forms/input-search.css +66 -0
- package/css/layered/forms.css +778 -0
- package/css/layered/layout/container.css +42 -0
- package/css/layered/layout/document.css +48 -0
- package/css/layered/layout/grid.css +22 -0
- package/css/layered/layout/landmarks.css +12 -0
- package/css/layered/layout/overflow-auto.css +9 -0
- package/css/layered/layout/section.css +9 -0
- package/css/layered/layout.css +119 -0
- package/css/layered/utilities.css +35 -0
- package/css/layered/variables.css +365 -0
- package/css/pico.conditional.css +229 -396
- package/css/pico.conditional.min.css +42 -31
- package/css/pico.css +229 -396
- package/css/pico.min.css +42 -31
- package/package.json +24 -11
- package/src/_compact.css +51 -0
- package/src/blades/_index.css +23 -0
- package/src/blades/float-label/_index.css +2 -0
- package/src/{standalone/forms/_float-label.theme.css → blades/float-label/_theme.css} +5 -1
- package/src/blades.css +3 -2
- package/src/blades.ninja.css +3 -0
- package/src/float-label.css +1 -0
- package/src/ninja/_index.css +19 -0
- package/src/{standalone → ninja}/_theme.css +0 -2
- package/src/{ninja.css → ninja/_utilities.css} +55 -6
- package/src/pico/_variables.css +77 -386
- package/src/pico/components/_accordion.css +8 -0
- package/src/pico/components/_card.css +14 -0
- package/src/pico/components/_dropdown.css +9 -0
- package/src/pico/components/_group.css +38 -0
- package/src/pico/components/_loading.css +9 -0
- package/src/pico/components/_modal.css +13 -0
- package/src/pico/components/_nav.css +6 -0
- package/src/pico/components/_progress.css +6 -0
- package/src/pico/components/_tooltip.css +6 -0
- package/src/pico/content/_button.css +1 -1
- package/src/pico/forms/_checkbox-radio-switch.css +13 -0
- package/src/pico/forms/_input-datetime.css +6 -0
- package/src/pico/forms/_input-range.css +9 -0
- package/src/pico/forms/_input-search.css +5 -0
- package/src/pico/layout/_document.css +9 -0
- package/src/pico/layout/_index.css +0 -1
- package/src/pico/layout/_landmarks.css +1 -9
- package/src/pico.css +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.prettierignore +0 -3
- package/CODE_OF_CONDUCT.md +0 -92
- package/context7.json +0 -4
- package/css/blades.standalone.css +0 -860
- package/css/blades.standalone.min.css +0 -37
- package/css/ninja.css +0 -83
- package/css/ninja.min.css +0 -5
- package/css/pico.layered.min.css +0 -107
- package/css/postcss.config.js +0 -23
- package/index.html +0 -63
- package/src/blades.standalone.css +0 -2
- package/src/standalone/_core.css +0 -32
- package/src/standalone/_utilities.css +0 -55
- package/src/standalone/forms/_float-label.css +0 -2
- /package/src/{standalone/content → blades}/_code.css +0 -0
- /package/src/{standalone/layout → blades}/_columns.css +0 -0
- /package/src/{standalone/components/_icon-helper.css → blades/_icon.css} +0 -0
- /package/src/{standalone/components → blades}/_timeline.css +0 -0
- /package/src/{standalone → blades}/_variables.css +0 -0
- /package/src/{standalone/forms/_float-label.core.css → blades/float-label/_core.css} +0 -0
- /package/src/{standalone/layout/_breakout.css → ninja/_container-breakout.css} +0 -0
- /package/src/{standalone/content/_typography.css → ninja/_heading-anchor.css} +0 -0
- /package/src/{standalone/content/_list.css → ninja/_list-helpers.css} +0 -0
- /package/src/{standalone/layout/_scroller.css → ninja/_page-anchors.css} +0 -0
- /package/src/{standalone/content/_table.css → ninja/_table-helpers.css} +0 -0
- /package/src/{standalone/content → ninja}/_table-responsive.css +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<big>Fully compatible and actively maintained successor to [Pico CSS](https://picocss.com/).</big>
|
|
10
10
|
|
|
11
|
-
Introduces [float labels](//blades.ninja/css/float-label/), [breakout container](//blades.ninja/css/breakout/) and other modern, opt-out [helpers](//blades.ninja/#docs).
|
|
12
11
|
Simply switch `pico.css` to `blades.css` OR use `blades.standalone.css` with other frameworks.
|
|
13
12
|
|
|
14
13
|
<nav>
|
|
@@ -50,7 +49,7 @@ Live example: https://github.com/pallets/website/blob/main/src/pallets/templates
|
|
|
50
49
|
|
|
51
50
|
Full list of CSS files available on CDN: https://cdn.jsdelivr.net/npm/@anyblades/blades@3/css/
|
|
52
51
|
|
|
53
|
-
`
|
|
52
|
+
`blades.layered.min.css` is Blades wrapped in `@layer blades { }`, so any unlayered styles of yours win over it without specificity fights. Note that inside a layer Blades' own `!important` declarations (form validation, reduced motion) beat your unlayered `!important`, and your `@keyframes` of the same name as Blades' win regardless of load order. When you can use `@import`, `@import url("…/blades.min.css") layer(blades);` does the same without this file.
|
|
54
53
|
|
|
55
54
|
### <mark>C.</mark> Install with NPM
|
|
56
55
|
|
|
@@ -82,13 +81,47 @@ Or import only the [Pico CSS](//blades.ninja/css/pico/) parts you need, e.g. per
|
|
|
82
81
|
@import "@anyblades/blades/pico/variables";
|
|
83
82
|
@import "@anyblades/blades/pico/layout/document";
|
|
84
83
|
@import "@anyblades/blades/pico/content/typography";
|
|
84
|
+
@import "@anyblades/blades/pico/components/card";
|
|
85
85
|
@import "@anyblades/blades/pico/components/modal";
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
- `variables` and `layout/document` are the minimum; keep the same order as [`src/pico/_index.css`](https://github.com/anyblades/blades/blob/main/src/pico/_index.css) (variables → layout → content → forms → components → utilities).
|
|
89
|
-
-
|
|
89
|
+
- `layout` doesn't pad `body > header/main/footer`. Add `layout/landmarks` for Pico's behaviour.
|
|
90
|
+
- Some parts build on others, e.g. `components/modal` expects `components/card`, and `components/group` and `components/dropdown` expect `forms/basics` and `content/button`.
|
|
90
91
|
- Available parts are the files under [`src/pico/`](https://github.com/anyblades/blades/tree/main/src/pico): `layout/*`, `content/*`, `forms/*`, `components/*` (or a whole category, e.g. `@anyblades/blades/pico/components`) and `utilities`.
|
|
91
92
|
|
|
93
|
+
#### With bundlers and component frameworks (SvelteKit, Next.js, Nuxt, Astro, …)
|
|
94
|
+
|
|
95
|
+
Import the parts from JavaScript, i.e. the root layout and the components that use them, rather than with `@import` inside a component's `<style>` block. Use the layered parts, `@anyblades/blades/layered/*`: they are the same parts wrapped in `@layer blades`, which a JS `import` can't add by itself.
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
// root layout, once: the base and every part that others build on
|
|
99
|
+
import "@anyblades/blades/layered/variables";
|
|
100
|
+
import "@anyblades/blades/layered/layout/document";
|
|
101
|
+
import "@anyblades/blades/layered/content/typography";
|
|
102
|
+
import "@anyblades/blades/layered/content/button";
|
|
103
|
+
import "@anyblades/blades/layered/forms/basics";
|
|
104
|
+
|
|
105
|
+
// in the component that renders a <dialog>
|
|
106
|
+
import "@anyblades/blades/layered/components/card";
|
|
107
|
+
import "@anyblades/blades/layered/components/modal";
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<style>
|
|
112
|
+
/* unlayered, so it wins over Blades whatever the specificity (except Blades' !important) */
|
|
113
|
+
article {
|
|
114
|
+
max-width: 40rem;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- Bundlers dedupe JS-side CSS imports and split them per route, so each part is downloaded and cached once and only where it's used.
|
|
120
|
+
- Override in your component's `<style>` or `app.css`, or set `--pico-*` variables on `:root` or on an element. Unlayered CSS always wins over `@layer blades`. The usual layer caveats apply: Blades' own `!important` declarations beat yours, and if you use other layered CSS, declare the order once, before anything else is loaded. For Tailwind v4 that is `@layer theme, base, blades, components, utilities;` at the top of the CSS file you import first (before `@import "tailwindcss"`), and that file has to be imported before any `layered/*` part, because the first `@layer` the browser sees fixes the order.
|
|
121
|
+
- Parts don't `@import` the parts they build on (e.g. `components/modal` expects `components/card`, `components/group` and `components/dropdown` expect `content/button` and `forms/basics`, and the `forms/*` extras expect `forms/basics`). If they did, every route chunk would carry its own copy. Import those shared parts once, at the root or next to the part that needs them; bundlers dedupe the imports.
|
|
122
|
+
- An `@import` inside a scoped `<style>` (Svelte, Astro, Vue `scoped`) is processed as that component's own styles. The rules get scoped to the component's markup (Svelte also prunes the unused ones) and are duplicated in every component that imports them.
|
|
123
|
+
- Landmark padding: `pico.css` and `blades.ninja.css` pad `body > header`, `body > main` and `body > footer` like Pico, which doesn't match when the framework wraps the page in an element (SvelteKit's `<div style="display: contents">`, Next.js pages router `#__next`, Nuxt `#__nuxt`, a SPA's `#root` / `#app`). `blades.css` doesn't pad them; with per-part imports, add `layout/landmarks` (or `layered/layout/landmarks`) for Pico's `body >` padding.
|
|
124
|
+
|
|
92
125
|
### <mark>D.</mark> Official starters
|
|
93
126
|
|
|
94
127
|
- https://github.com/buildawesome-one/starter
|
|
@@ -126,6 +159,46 @@ Or import only the [Pico CSS](//blades.ninja/css/pico/) parts you need, e.g. per
|
|
|
126
159
|
|
|
127
160
|
---
|
|
128
161
|
|
|
162
|
+
## Dark mode without a flash
|
|
163
|
+
|
|
164
|
+
With the Pico-based builds, Blades follows the OS setting by default, with no JavaScript and no flash (see [Dark scheme](//blades.ninja/css/color-schemes/)). To force a theme, set `data-theme="light"` or `"dark"` on `<html>`. On a nested element it works when the element paints its own background, such as `<article>`; otherwise add `background-color: var(--pico-background-color); color: var(--pico-color);`.
|
|
165
|
+
|
|
166
|
+
If you persist the user's choice, e.g. under the `localStorage` key `theme`, set the attribute **before the first paint** with a small inline script in `<head>`, e.g. in SvelteKit's `src/app.html`:
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<script>
|
|
170
|
+
try {
|
|
171
|
+
const theme = localStorage.getItem("theme");
|
|
172
|
+
if (theme === "light" || theme === "dark") document.documentElement.dataset.theme = theme;
|
|
173
|
+
} catch {}
|
|
174
|
+
</script>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
- Setting it later, e.g. in `onMount` or `useEffect`, renders the OS theme first and then switches.
|
|
178
|
+
- In a Next.js App Router layout, pass the same code as a template literal, ``<script dangerouslySetInnerHTML={{ __html: `try { … } catch {}` }} />``, and add `suppressHydrationWarning` to `<html>`, because the attribute changes before hydration.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Compact sizing (opt-in)
|
|
183
|
+
|
|
184
|
+
Add `<html data-compact>` for the whole page, or put the attribute on a single element, e.g. `<form data-compact>` for one form. Without the attribute nothing changes.
|
|
185
|
+
|
|
186
|
+
- **Where it ships:**
|
|
187
|
+
- included in `blades.css`
|
|
188
|
+
- also in `blades.layered.css`
|
|
189
|
+
- with per-part imports, add `@import "@anyblades/blades/compact";` after the other parts, or `import "@anyblades/blades/layered/compact";` with the layered parts
|
|
190
|
+
- with `pico.conditional.css`, add `@anyblades/blades/compact` after it
|
|
191
|
+
- **What changes:**
|
|
192
|
+
- smaller control padding and 1.5rem block spacing
|
|
193
|
+
- a 0.5rem radius and a 3px focus ring
|
|
194
|
+
- 500-weight labels and buttons, 600-weight headings
|
|
195
|
+
- a white field background in light mode
|
|
196
|
+
- a 1px card ring instead of the blurred shadow, with no grey card header/footer bands
|
|
197
|
+
- **Root font size:** on `<html>`, it also keeps the root font size at 100% instead of growing with the viewport. At 1280px wide, controls are then 38px instead of 62px. On a single element they are about 48px, because everything is sized in `rem` and the root stays as it is.
|
|
198
|
+
- **Field text size:** form controls stay at 16px, because below that iOS Safari zooms in on focus.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
129
202
|
## Documentation
|
|
130
203
|
|
|
131
204
|
<!-- ToC as is from https://blades.ninja/#docs -->
|
|
@@ -209,6 +282,7 @@ Or import only the [Pico CSS](//blades.ninja/css/pico/) parts you need, e.g. per
|
|
|
209
282
|
|
|
210
283
|
- 🐍 [Flask & Jinja](https://palletsprojects.com/) community website
|
|
211
284
|
- 🪐 [Grav CMS v2](https://getgrav.org/migrate-to-2#:~:text=blades) default theme [↗](https://www.followthatcar.com/)
|
|
285
|
+
|
|
212
286
|
<!--https://pulsar-wildlife.club/-->
|
|
213
287
|
|
|
214
288
|
<!--section:info-->
|
|
@@ -224,6 +298,7 @@ Or import only the [Pico CSS](//blades.ninja/css/pico/) parts you need, e.g. per
|
|
|
224
298
|
- https://github.com/eggplantpasta/greenroom
|
|
225
299
|
- [/adamdjbrett/11ty-wisp](https://github.com/adamdjbrett/11ty-wisp#features:~:text=blades) [↗](https://github.com/adamdjbrett/000000076#:~:text=blades)
|
|
226
300
|
- [doany.io](https://doany.io/en/posts/svelte-bun-sqlite/#on-biome-and-css)
|
|
301
|
+
- [@box464](https://mastodon.social/@box464/117442493473921346)
|
|
227
302
|
- [@draupnerdata](https://www.youtube.com/watch?v=yDjArj9HSjs&t=180s)
|
|
228
303
|
- [@cantdutchthis](https://news.ycombinator.com/item?id=48729467)
|
|
229
304
|
- [@daviding](https://www.reddit.com/r/Wordpress/comments/1vnfhkr/comment/p3k9z1c/#:~:text=blades)
|