gerillass 2.1.0 → 2.2.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.
Files changed (34) hide show
  1. package/README.md +23 -0
  2. package/SKILL.md +57 -5
  3. package/gerillass.json +315 -66
  4. package/package.json +1 -1
  5. package/scss/library/_after.scss +15 -0
  6. package/scss/library/_all-text-inputs.scss +1 -1
  7. package/scss/library/_background-dots.scss +55 -9
  8. package/scss/library/_background-image.scss +31 -5
  9. package/scss/library/_background-stripes.scss +43 -4
  10. package/scss/library/_before.scss +15 -0
  11. package/scss/library/_border-radius.scss +25 -1
  12. package/scss/library/_brand-logo.scss +24 -1
  13. package/scss/library/_breakpoint.scss +34 -0
  14. package/scss/library/_container-query.scss +73 -1
  15. package/scss/library/_counter.scss +24 -2
  16. package/scss/library/_focus-ring.scss +34 -0
  17. package/scss/library/_font-face.scss +61 -3
  18. package/scss/library/_index.scss +3 -0
  19. package/scss/library/_line-clamp.scss +14 -1
  20. package/scss/library/_loadify.scss +7 -0
  21. package/scss/library/_motion-safe.scss +28 -0
  22. package/scss/library/_remove.scss +4 -1
  23. package/scss/library/_reset-css.scss +7 -5
  24. package/scss/library/_screen-agent.scss +27 -0
  25. package/scss/library/_text-image.scss +24 -1
  26. package/scss/library/_tokens.scss +111 -0
  27. package/scss/library/_triangle.scss +109 -9
  28. package/scss/utilities/_clear-unit.scss +4 -0
  29. package/scss/utilities/_convert-to-em.scss +6 -0
  30. package/scss/utilities/_convert-to-number.scss +15 -0
  31. package/scss/utilities/_font-sizer.scss +14 -0
  32. package/scss/utilities/_remify.scss +7 -0
  33. package/scss/utilities/_validate-length.scss +7 -0
  34. package/scss/utilities/_validate-ratio.scss +25 -2
package/README.md CHANGED
@@ -27,6 +27,7 @@ Hope you’ll enjoy using it!
27
27
  - [Installation](#installation)
28
28
  - [Using with Vite](#using-with-vite)
29
29
  - [Using with webpack](#using-with-webpack)
30
+ - [Using with Parcel](#using-with-parcel)
30
31
  - [Using with Next.js](#using-with-nextjs)
31
32
  - [Using with Angular](#using-with-angular)
32
33
  - [Using with Gulp](#using-with-gulp)
@@ -94,6 +95,27 @@ Vite resolves the package by name, so there is nothing to configure. This covers
94
95
 
95
96
  @use 'gerillass' as *;
96
97
 
98
+ ### Using with Parcel
99
+
100
+ Parcel resolves the package by name too, so the usual line needs no configuration:
101
+
102
+ @use 'gerillass' as *;
103
+
104
+ **Remove `main` from your project's own `package.json`.** `npm init -y` writes `"main": "index.js"`, and Parcel reads that field as a library build target. With it present an app build fails, and the error names the stylesheet rather than the field: `Can't find stylesheet to import`. No Sass option gets around it. If you need to keep the field, turn that target off instead:
105
+
106
+ "targets": { "main": false }
107
+
108
+ To use a `pkg:` URL, create the importer in a `.sassrc.js`. Setting `pkgImporter` in `.sassrc.json` does not work: Parcel switches Sass to its legacy API for that option, and the import is not found.
109
+
110
+ // .sassrc.js
111
+ const { NodePackageImporter } = require("sass");
112
+ module.exports = { importers: [new NodePackageImporter()] };
113
+
114
+ Two more things worth knowing:
115
+
116
+ - **Pass the font formats you actually have to `font-face`.** It lists five by default, and Parcel resolves every `url()` in the output, so a folder holding only `.woff2` fails with `Failed to resolve './fonts/inter.eot'`. `$file-formats: woff2` fixes it.
117
+ - **`quietDeps` hides the library's own deprecation warnings.** Dart Sass reports its `if()` deprecation from inside the package on every build. A `.sassrc.json` of `{ "quietDeps": true }` silences those and still reports the ones in your own files.
118
+
97
119
  ### Using with Next.js
98
120
 
99
121
  Next.js needs to be told where the library lives. In `next.config.mjs`:
@@ -187,6 +209,7 @@ Including to the project:
187
209
  | Angular CLI | 20.3.36 |
188
210
  | Gulp / gulp-sass | 5.0.1 / 6.0.1 |
189
211
  | Grunt / grunt-sass | 1.6.3 / 4.1.0 |
212
+ | Parcel / @parcel/transformer-sass | 2.16.4 / 2.16.4, with Dart Sass 1.104.1 and Gerillass 2.1.0 |
190
213
 
191
214
  ## Using Gerillass with an AI coding agent
192
215
 
package/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: Use the Gerillass Sass mixin library — loading it, the mixin cata
5
5
 
6
6
  # Gerillass
7
7
 
8
- A Sass mixin library: 53 mixins and 23 functions that emit CSS from
8
+ A Sass mixin library: 56 mixins and 23 functions that emit CSS from
9
9
  semantic declarations. It is Sass source only — there is no runtime and no
10
10
  utility classes, so styles live in your stylesheet and your markup stays clean.
11
11
 
@@ -76,6 +76,7 @@ a dropped declaration rather than an error.
76
76
  | `before` | `.a { @include before(42) { color: red; } }` |
77
77
  | `border-box` | `@include border-box(only);` |
78
78
  | `border-radius` | `.a { @include border-radius(1px, 2px, 3px); }` |
79
+ | `breakpoint` | `.a { @include breakpoint("between", "medium", "large") { color: red; } }` |
79
80
  | `breakpointer` | `.a { @include breakpointer(42); }` |
80
81
  | `center` | `.modal { @include center(diagonal); }` |
81
82
  | `columnizer` | `.grid { @include columnizer(3, 20px, true, 9); }` |
@@ -83,16 +84,19 @@ a dropped declaration rather than an error.
83
84
  | `container` | `.card { @include container("card", sideways); }` |
84
85
  | `escape-to-parent` | `.a { @include escape-to-parent(42) { color: red; } }` |
85
86
  | `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
87
+ | `focus-ring` | `@include focus-ring;` |
86
88
  | `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
87
89
  | `hide` | `.a { @include hide(nonsense); }` |
88
90
  | `line-clamp` | `.a { @include line-clamp(0); }` |
89
91
  | `linear-gradient` | `.a { @include linear-gradient(sideways, (red, blue)); }` |
90
92
  | `loadify` | `@include loadify(nonsense);` |
93
+ | `motion-safe` | `.card { @include motion-safe; }` |
91
94
  | `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
92
95
  | `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
93
96
  | `remove` | `.a { @include remove(a, b, c); }` |
94
97
  | `reset-css` | `.a { @include reset-css; }` |
95
98
  | `scissors` | `.a { @include scissors(5px 10px); }` |
99
+ | `screen-agent` | `.a { @include screen-agent(var(--density)) { color: red; } }` |
96
100
  | `smartphone` | `.a { @include smartphone(Nokia3310) { display: none; } }` |
97
101
  | `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
98
102
  | `stretched-link` | `.card a { @include stretched-link(middle); }` |
@@ -100,8 +104,53 @@ a dropped declaration rather than an error.
100
104
  | `text-gradient` | `.a { @include text-gradient(sideways, (red, blue)); }` |
101
105
  | `text-selection` | `.a { @include text-selection(bogus) { background: yellow; } }` |
102
106
  | `text-shadow` | `.a { @include text-shadow(42); }` |
107
+ | `tokens` | `:root { @include tokens(#fff); }` |
103
108
  | `triangle` | `.caret { @include triangle(sideways); }` |
104
109
 
110
+ ## Traps a signature does not show
111
+
112
+ **`after`**
113
+
114
+ - With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
115
+
116
+ **`aspect-ratio`**
117
+
118
+ - On an element with a `height` attribute, such as `<img width="1600" height="900">` or an embed code's `<iframe>`, the attribute height wins and the ratio is ignored. Write `height: auto` after the include.
119
+
120
+ **`before`**
121
+
122
+ - With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
123
+
124
+ **`breakpoint`**
125
+
126
+ - With one argument the query matches exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
127
+ - Declarations written after the include, in the same rule, are emitted after the `@media` block and win over it. Write them before the include.
128
+
129
+ **`container-query`**
130
+
131
+ - A size on its own matches exactly that width, `(width: 400px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
132
+
133
+ **`container`**
134
+
135
+ - An element does not match a `@container` query that reads its own container, and nothing warns. Put the `container-query` on a descendant.
136
+
137
+ **`counter`**
138
+
139
+ - Numbering restarts on every item, each showing the first number, when the items are size containers (`container-type: inline-size`): containment scopes counters to each item.
140
+
141
+ **`loadify`**
142
+
143
+ - `init` and every call must be in the same module, or the module with the call must `@use` the one that calls `init`. Otherwise Sass fails with "The target selector was not found".
144
+
145
+ **`motion-safe`**
146
+
147
+ - Keep the resting state outside the block. An element hidden in its base rule and revealed by an animation inside the block stays hidden for a user who asked for less motion; put the start state in the keyframes instead.
148
+
149
+ **`remove`**
150
+
151
+ - With one argument the element is hidden at exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
152
+ - A `display` written after the include, in the same rule, is emitted after the `@media` block and wins over it. Write it before the include.
153
+
105
154
  ## Mixins
106
155
 
107
156
  | Signature | What it does |
@@ -112,7 +161,7 @@ a dropped declaration rather than an error.
112
161
  | `all-text-inputs($pseudo: null)` | Targets every text-like input at once, optionally in one pseudo-class state. |
113
162
  | `antialias($value: null)` | Turns on subpixel-antialiased text smoothing. |
114
163
  | `aspect-ratio($ratio: null, $fit: cover)` | Holds an element to a ratio and adds what CSS aspect-ratio alone leaves out: object-fit so an image is cropped rather than stretched, and border: 0 so an iframe does not overflow its container by 4px. Apply it to the element itself, not to a wrapper. |
115
- | `background-dots($color: null, $size: 1em, $gutter: $size * 5, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
164
+ | `background-dots($color: null, $size: 1em, $gutter: null, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
116
165
  | `background-image($image-url: null, $filter-color: null, $filter-direction: null)` | Background image with an optional colour or gradient filter laid over it. |
117
166
  | `background-stripes($color: null, $thickness: 1em, $rotation: -45deg, $image: null)` | Repeating stripe pattern as a background, optionally over an image. |
118
167
  | `before($content: null)` | Styles the ::before pseudo-element. A `data-` argument becomes an attr() content value. |
@@ -131,17 +180,19 @@ a dropped declaration rather than an error.
131
180
  | `ellipsis($width: 100%, $display: inline-block)` | Truncates a single line of text with an ellipsis. |
132
181
  | `escape-to-parent($selector: null)` | Re-roots the current selector under another one using @at-root. |
133
182
  | `except($params...)` | Selects every sibling except the ones named. |
134
- | `font-face($font-family, $file-path, $font-style: normal, $font-weight: 400, $file-formats: eot woff2 woff ttf svg)` | Emits an @font-face rule for one family across several file formats. Must be called at the root. |
183
+ | `focus-ring($width: 2px, $offset: 2px, $color: currentColor)` | Draws a keyboard focus ring with outline on :focus-visible, which survives forced-colors mode where a box-shadow ring disappears. |
184
+ | `font-face($font-family, $file-path, $font-style: normal, $font-weight: 400, $file-formats: eot woff2 woff ttf svg, $font-display: null)` | Emits an @font-face rule for one family across several file formats. Must be called at the root. |
135
185
  | `hide($toggle: "hide")` | Visually hides an element while keeping it available to screen readers, or reverses that. |
136
186
  | `line-clamp($lines: 3)` | Truncates text after a number of lines, where ellipsis truncates one. It emits five declarations rather than one because -webkit-line-clamp does nothing on its own: without display: -webkit-box or without -webkit-box-orient: vertical the text is not clamped at all and nothing warns you, and without overflow: hidden the clamped text spills out below the box. The unprefixed line-clamp is emitted too, for when it becomes Baseline. |
137
187
  | `linear-gradient($direction, $colors)` | Linear gradient background from a direction name or an angle. |
138
188
  | `loadify($params...)` | Fades elements in on page load. Call once at the root to set up, then on each element. Under prefers-reduced-motion: reduce the end state is applied directly and no animation runs. Switching the animation off alone would not do, because the element starts invisible and the animation is what reveals it, so the content would stay hidden for good. |
189
+ | `motion-safe` | Wraps its content in @media (prefers-reduced-motion: no-preference), so motion is opt-in: a user who asked their system for less motion gets none of it. |
139
190
  | `only($params...)` | Selects only the siblings named. |
140
191
  | `placeholder-shown` | Styles an input while its placeholder is visible. |
141
192
  | `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
142
193
  | `position($position: absolute, $offsets: 0)` | Sets position and offsets in one call, using shorthand order. |
143
194
  | `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
144
- | `remove($params...)` | Hides an element outright, or only within a breakpoint range. |
195
+ | `remove($params...)` | Hides an element outright, or within a media query: from a breakpoint up with min, up to it with max, or between two breakpoints. One breakpoint on its own hides the element at exactly that width, a single pixel, and prints a warning: pass only for that. |
145
196
  | `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
146
197
  | `reset-figure` | Removes default figure margins and makes the image inside responsive. |
147
198
  | `resizable($direction: both, $overflow: auto)` | Makes an element user-resizable. |
@@ -158,6 +209,7 @@ a dropped declaration rather than an error.
158
209
  | `text-selection($value: null)` | Styles the ::selection pseudo-element. |
159
210
  | `text-shadow($params...)` | Layered text shadows built from a direction, a colour and an offset. |
160
211
  | `text-stroke($fallback-color: black, $color: transparent, $stroke-color: black, $stroke-width: 1px)` | Outlines text using the webkit text-stroke properties. |
212
+ | `tokens($map, $prefix: null)` | Writes a Sass map out as CSS custom properties, for any kind of token: colours, spacing, sizes, radii, type, shadows, durations. With the prefix space, (4: 1rem) becomes --space-4: 1rem. A null value is skipped, and a quoted string keeps its quotes. |
161
213
  | `triangle($direction: "bottom", $color: black, $size: 10px 8px)` | Draws a CSS triangle out of borders, pointing in a given direction. |
162
214
 
163
215
  ## Functions
@@ -187,7 +239,7 @@ and camelCase is what tells them apart from the kebab-case mixins above.
187
239
  | `shorthandProperty($value)` | Expands one to four values into the four-value CSS shorthand order. |
188
240
  | `tint($color, $percentage)` | Mixes a colour towards white by a percentage. |
189
241
  | `validateBreakpoint($value)` | Resolves a breakpoint name to its width, passing other values through. |
190
- | `validateLength($value)` | Returns the value if it is a length or one of auto, inherit, initial, 0. |
242
+ | `validateLength($value)` | Returns the value if it is a length or one of auto, inherit, initial, 0. Returns null quietly for null, so a caller can skip a value. |
191
243
  | `validateRatio($ratio)` | Turns an aspect ratio into a value for the CSS aspect-ratio property. |
192
244
  | `validateScissors($value)` | Normalises corner values for the scissors mixin, adding px where missing. |
193
245