@anyblades/blades 3.0.0 → 3.1.0-alpha.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.
Files changed (57) hide show
  1. package/README.md +79 -12
  2. package/css/blades.css +219 -419
  3. package/css/blades.min.css +41 -30
  4. package/css/pico.conditional.css +219 -419
  5. package/css/pico.conditional.min.css +41 -30
  6. package/css/pico.css +219 -419
  7. package/css/pico.layered.css +2990 -0
  8. package/css/pico.layered.min.css +118 -0
  9. package/css/pico.min.css +41 -30
  10. package/package.json +27 -7
  11. package/src/pico/_index.css +4 -4
  12. package/src/pico/_utilities.css +0 -21
  13. package/src/pico/_variables.css +76 -386
  14. package/src/pico/components/_accordion.css +82 -0
  15. package/src/pico/components/_card.css +45 -0
  16. package/src/pico/components/_dropdown.css +188 -0
  17. package/src/pico/components/_group.css +205 -0
  18. package/src/pico/components/_index.css +9 -0
  19. package/src/pico/components/_loading.css +40 -0
  20. package/src/pico/components/_modal.css +157 -0
  21. package/src/pico/components/_nav.css +114 -0
  22. package/src/pico/components/_progress.css +73 -0
  23. package/src/pico/components/_tooltip.css +173 -0
  24. package/src/pico/content/_button.css +205 -0
  25. package/src/pico/content/_code.css +61 -0
  26. package/src/pico/content/_embedded-content.css +37 -0
  27. package/src/pico/content/_figure.css +12 -0
  28. package/src/pico/content/_index.css +8 -0
  29. package/src/pico/content/_link.css +81 -0
  30. package/src/pico/content/_misc.css +19 -0
  31. package/src/pico/content/_table.css +30 -0
  32. package/src/pico/content/_typography.css +156 -0
  33. package/src/pico/forms/_basics.css +335 -0
  34. package/src/pico/forms/_checkbox-radio-switch.css +161 -0
  35. package/src/pico/forms/_index.css +7 -0
  36. package/src/pico/forms/_input-color.css +17 -0
  37. package/src/pico/forms/_input-datetime.css +54 -0
  38. package/src/pico/forms/_input-file.css +26 -0
  39. package/src/pico/forms/_input-range.css +118 -0
  40. package/src/pico/forms/_input-search.css +63 -0
  41. package/src/pico/layout/_container.css +39 -0
  42. package/src/pico/layout/_document.css +36 -0
  43. package/src/pico/layout/_grid.css +19 -0
  44. package/src/pico/layout/_index.css +6 -0
  45. package/src/pico/layout/_landmarks.css +17 -0
  46. package/src/pico/layout/_overflow-auto.css +6 -0
  47. package/src/pico/layout/_section.css +6 -0
  48. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
  49. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  50. package/CODE_OF_CONDUCT.md +0 -92
  51. package/context7.json +0 -4
  52. package/css/postcss.config.js +0 -23
  53. package/index.html +0 -63
  54. package/src/pico/_components.css +0 -974
  55. package/src/pico/_content.css +0 -608
  56. package/src/pico/_forms.css +0 -747
  57. package/src/pico/_layout.css +0 -128
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  <!--section:summary-->
6
6
 
7
- <h1><b class="mark-brand">Minimal CSS Framework</b> <small>for</small> Semantic HTML</h1>
7
+ <h1><span class="mark-brand">Minimal CSS Framework</span> <small>for</small> Semantic HTML</h1>
8
8
 
9
- <big>Fully compatible and actively maintained successor to [Pico CSS](//blades.ninja/css/pico/).</big>
9
+ <big>Fully compatible and actively maintained successor to [Pico CSS](https://picocss.com/).</big>
10
10
 
11
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
12
  Simply switch `pico.css` to `blades.css` OR use `blades.standalone.css` with other frameworks.
@@ -37,7 +37,7 @@ Simply switch `pico.css` to `blades.css` OR use `blades.standalone.css` with oth
37
37
  <link rel="stylesheet" href="css/blades.css" />
38
38
  ```
39
39
 
40
- ### <mark>B.</mark> Usage from CDN
40
+ ### <mark>B.</mark> Usage from CDN <!--{#cdn}-->
41
41
 
42
42
  <!--prettier-ignore-->
43
43
  ```html
@@ -50,6 +50,8 @@ Live example: https://github.com/pallets/website/blob/main/src/pallets/templates
50
50
 
51
51
  Full list of CSS files available on CDN: https://cdn.jsdelivr.net/npm/@anyblades/blades@3/css/
52
52
 
53
+ `pico.layered.min.css` is Pico wrapped in `@layer pico { }`, so any unlayered styles of yours win over it without specificity fights. Note that inside a layer Pico's own `!important` declarations (form validation, reduced motion) beat your unlayered `!important`, and your `@keyframes` of the same name as Pico's win regardless of load order. When you can use `@import`, `@import url("…/pico.min.css") layer(pico);` does the same without this file.
54
+
53
55
  ### <mark>C.</mark> Install with NPM
54
56
 
55
57
  ```sh
@@ -72,6 +74,44 @@ Alternatively, import [standalone](//blades.ninja/css/standalone/) Blades CSS so
72
74
 
73
75
  Live example using <i class="fa-brands fa-tailwind-css"></i> Tailwind: https://github.com/anyblades/buildawesome-micro-starters/blob/main/tailwind/styles.css
74
76
 
77
+ <div><hr></div>
78
+
79
+ Or import only the [Pico CSS](//blades.ninja/css/pico/) parts you need, e.g. per page or per component:
80
+
81
+ ```css
82
+ @import "@anyblades/blades/pico/variables";
83
+ @import "@anyblades/blades/pico/layout/document";
84
+ @import "@anyblades/blades/pico/content/typography";
85
+ @import "@anyblades/blades/pico/components/modal";
86
+ ```
87
+
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
+ - Some parts build on others, e.g. `components/group` and `components/dropdown` expect `forms/basics` and `content/button`.
90
+ - 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
+ #### With bundlers and component frameworks (SvelteKit, Next.js, Nuxt, Astro, …)
93
+
94
+ 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:
95
+
96
+ ```js
97
+ // root layout, once
98
+ import "@anyblades/blades/pico/variables";
99
+ import "@anyblades/blades/pico/layout/document";
100
+
101
+ // in the component that renders a <dialog>
102
+ import "@anyblades/blades/pico/components/modal";
103
+ ```
104
+
105
+ - 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.
106
+ - 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.
107
+ - Pico's landmark padding uses `body > header`, `body > main` and `body > footer`. These don't match when the framework wraps the page in an element: SvelteKit's `<div style="display: contents">`, Next.js pages router `#__next`, Nuxt `#__nuxt`, or a SPA's `#root` / `#app`. Next.js App Router doesn't wrap the page. If you rely on the padding, add it for your wrapper, e.g.:
108
+
109
+ ```css
110
+ #__next > :is(header, main, footer) {
111
+ padding-block: var(--pico-block-spacing-vertical);
112
+ }
113
+ ```
114
+
75
115
  ### <mark>D.</mark> Official starters
76
116
 
77
117
  - https://github.com/buildawesome-one/starter
@@ -109,6 +149,26 @@ Live example using <i class="fa-brands fa-tailwind-css"></i> Tailwind: https://g
109
149
 
110
150
  ---
111
151
 
152
+ ## Dark mode without a flash
153
+
154
+ 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);`.
155
+
156
+ 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`:
157
+
158
+ ```html
159
+ <script>
160
+ try {
161
+ const theme = localStorage.getItem("theme");
162
+ if (theme === "light" || theme === "dark") document.documentElement.dataset.theme = theme;
163
+ } catch {}
164
+ </script>
165
+ ```
166
+
167
+ - Setting it later, e.g. in `onMount` or `useEffect`, renders the OS theme first and then switches.
168
+ - 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.
169
+
170
+ ---
171
+
112
172
  ## Documentation
113
173
 
114
174
  <!-- ToC as is from https://blades.ninja/#docs -->
@@ -191,23 +251,30 @@ Live example using <i class="fa-brands fa-tailwind-css"></i> Tailwind: https://g
191
251
  ## <sup style>Trusted by</sup>
192
252
 
193
253
  - 🐍 [Flask & Jinja](https://palletsprojects.com/) community website
194
- - 🪐 [Grav CMS v2](https://getgrav.org/migrate-to-2#:~:text=blades) default theme
254
+ - 🪐 [Grav CMS v2](https://getgrav.org/migrate-to-2#:~:text=blades) default theme [↗](https://www.followthatcar.com/)
255
+
256
+ <!--https://pulsar-wildlife.club/-->
195
257
 
196
258
  <!--section:info-->
197
259
 
198
- ## <sup style>Featured by</sup> <!-- Z-A after 11ty -->
260
+ ## <sup style>Featured by</sup> <!-- [1] big projects [2] awesome [3] smaller projects [4] blogs/social -->
199
261
 
200
262
  - [getgrav.org](https://getgrav.org/migrate-to-2#:~:text=blades)
201
263
  - [@11ty/buildawesome](https://bsky.app/profile/11ty.dev/post/3mp75r53ccv2b) [↗](https://mastodon.social/@11ty@neighborhood.11ty.dev/116816881367741413)
202
264
  - [<i class="fa-brands fa-build-awesome mark-brand"></i> buildawesome.one](https://buildawesome.one/#:~:text=blades)
203
- - [libhunt.com](https://www.libhunt.com/r/blades)
204
- - [context7.com](https://context7.com/anyblades/blades)
205
- - [awesome-css](https://github.com/uhub/awesome-css)
206
- - [awesome-css-frameworks](https://github.com/gabrielizalo/awesome-css-frameworks-and-ui-libraries/tree/master/Lightweight)
207
- - [@pauleveritt](https://fosstodon.org/@pauleveritt/116387278969347700)
208
- - [@daviding](https://www.reddit.com/r/Wordpress/comments/1vnfhkr/comment/p3k9z1c/#:~:text=blades)
265
+ - https://github.com/dbohdan/classless-css
266
+ - https://github.com/uhub/awesome-css
267
+ - [/gabrielizalo/awesome-css-frameworks](https://github.com/gabrielizalo/awesome-css-frameworks-and-ui-libraries/tree/master/Lightweight)
268
+ - https://github.com/eggplantpasta/greenroom
269
+ - [/adamdjbrett/11ty-wisp](https://github.com/adamdjbrett/11ty-wisp#features:~:text=blades) [↗](https://github.com/adamdjbrett/000000076#:~:text=blades)
270
+ - [doany.io](https://doany.io/en/posts/svelte-bun-sqlite/#on-biome-and-css)
271
+ - [@draupnerdata](https://www.youtube.com/watch?v=yDjArj9HSjs&t=180s)
209
272
  - [@cantdutchthis](https://news.ycombinator.com/item?id=48729467)
210
- - [@adamdjbrett](https://github.com/adamdjbrett/11ty-wisp#features:~:text=blades)
273
+ - [@daviding](https://www.reddit.com/r/Wordpress/comments/1vnfhkr/comment/p3k9z1c/#:~:text=blades)
274
+ - [@infotexture](https://mastodon.social/@infotexture@indieweb.social/117294194740314396)
275
+ - [@lazarus](https://fosstodon.org/@lazarus/117384358792615667)
276
+ - [@matthewmorete](https://bsky.app/profile/matthewmorete.com/post/3mx5wvywixc2l)
277
+ - [@pauleveritt](https://fosstodon.org/@pauleveritt/116387278969347700)
211
278
 
212
279
  <!--{.markerless .columns}-->
213
280
  <!--[hostfurl.com, @johnheenan]-->