@reykjavik/webtools 0.1.35 → 0.1.36
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/CHANGELOG.md +7 -0
- package/README.md +8 -8
- package/esm/vanillaExtract.d.ts +2 -2
- package/esm/vanillaExtract.js +2 -2
- package/package.json +1 -1
- package/vanillaExtract.d.ts +2 -2
- package/vanillaExtract.js +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -774,11 +774,11 @@ CSS.
|
|
|
774
774
|
Returns a scoped cssClassName styled with free-form CSS. This function is a
|
|
775
775
|
thin wrapper around vanilla-extract's `style` function.
|
|
776
776
|
|
|
777
|
-
When you pass it a string, all
|
|
777
|
+
When you pass it a string, all `&&` tokens are automatically replaced with the
|
|
778
778
|
selector for the auto-generated class-name. Note that in such cases EVERY
|
|
779
779
|
style property must be wrapped in a selector block.
|
|
780
780
|
|
|
781
|
-
To opt out of the
|
|
781
|
+
To opt out of the `&&` replacement, use the callback function signature.
|
|
782
782
|
|
|
783
783
|
```ts
|
|
784
784
|
// someFile.css.ts
|
|
@@ -790,13 +790,13 @@ export const myClass = vanillaClass(`
|
|
|
790
790
|
padding: .5em 1em;
|
|
791
791
|
`);
|
|
792
792
|
|
|
793
|
-
// With
|
|
793
|
+
// With && tokens that get replaced with the generated class-name
|
|
794
794
|
export const myClasWithAmp = vanillaClass(`
|
|
795
|
-
|
|
795
|
+
&& {
|
|
796
796
|
background-color: #ccc;
|
|
797
797
|
padding: .5em 1em;
|
|
798
798
|
}
|
|
799
|
-
|
|
799
|
+
&& > strong {
|
|
800
800
|
color: #c00;
|
|
801
801
|
}
|
|
802
802
|
`);
|
|
@@ -817,8 +817,8 @@ export const myOtherClass = vanillaClass(
|
|
|
817
817
|
background-color: #eee;
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
/*
|
|
821
|
-
|
|
820
|
+
/* NOTE: '&&' tokens returned from a callback function are NOT replaced */
|
|
821
|
+
&& { will-not-be: interpolated; }
|
|
822
822
|
`
|
|
823
823
|
);
|
|
824
824
|
|
|
@@ -832,7 +832,7 @@ export const humanReadableClass = vanillaClass(
|
|
|
832
832
|
);
|
|
833
833
|
```
|
|
834
834
|
|
|
835
|
-
(NOTE: The dot-prefixed
|
|
835
|
+
(NOTE: The dot-prefixed `&&` pattern is chosen to not conflict with the bare
|
|
836
836
|
`&` token in modern nested CSS.)
|
|
837
837
|
|
|
838
838
|
### `vanillaGlobal`
|
package/esm/vanillaExtract.d.ts
CHANGED
|
@@ -21,11 +21,11 @@ classNameSelector: string) => string;
|
|
|
21
21
|
* Returns a scoped cssClassName styled with free-form CSS. This function is a
|
|
22
22
|
* thin wrapper around vanilla-extract's `style` function.
|
|
23
23
|
*
|
|
24
|
-
* When you pass it a string, all
|
|
24
|
+
* When you pass it a string, all `&&` tokens are automatically replaced with the
|
|
25
25
|
* selector for the auto-generated class-name. Note that in such cases EVERY
|
|
26
26
|
* style property must be wrapped in a selector block.
|
|
27
27
|
*
|
|
28
|
-
* To opt out of the
|
|
28
|
+
* To opt out of the `&&` replacement, use the callback function signature.
|
|
29
29
|
*
|
|
30
30
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaclass
|
|
31
31
|
*/
|
package/esm/vanillaExtract.js
CHANGED
|
@@ -16,13 +16,13 @@ export const vanillaProps = (css) => ({ x: `; ${css}` });
|
|
|
16
16
|
export function vanillaClass(cssOrDebugId, css) {
|
|
17
17
|
const debugId = css != null ? cssOrDebugId : undefined;
|
|
18
18
|
css = css != null ? css : cssOrDebugId;
|
|
19
|
-
if (typeof css === 'string' &&
|
|
19
|
+
if (typeof css === 'string' && !/&&/.test(css)) {
|
|
20
20
|
return style(vanillaProps(css), debugId);
|
|
21
21
|
}
|
|
22
22
|
const className = style({}, debugId);
|
|
23
23
|
vanillaGlobal(typeof css === 'function'
|
|
24
24
|
? css('className', `.${className}`)
|
|
25
|
-
: css.replace(
|
|
25
|
+
: css.replace(/&&/g, `.${className}`));
|
|
26
26
|
return className;
|
|
27
27
|
}
|
|
28
28
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
package/vanillaExtract.d.ts
CHANGED
|
@@ -21,11 +21,11 @@ classNameSelector: string) => string;
|
|
|
21
21
|
* Returns a scoped cssClassName styled with free-form CSS. This function is a
|
|
22
22
|
* thin wrapper around vanilla-extract's `style` function.
|
|
23
23
|
*
|
|
24
|
-
* When you pass it a string, all
|
|
24
|
+
* When you pass it a string, all `&&` tokens are automatically replaced with the
|
|
25
25
|
* selector for the auto-generated class-name. Note that in such cases EVERY
|
|
26
26
|
* style property must be wrapped in a selector block.
|
|
27
27
|
*
|
|
28
|
-
* To opt out of the
|
|
28
|
+
* To opt out of the `&&` replacement, use the callback function signature.
|
|
29
29
|
*
|
|
30
30
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaclass
|
|
31
31
|
*/
|
package/vanillaExtract.js
CHANGED
|
@@ -21,13 +21,13 @@ exports.vanillaProps = vanillaProps;
|
|
|
21
21
|
function vanillaClass(cssOrDebugId, css) {
|
|
22
22
|
const debugId = css != null ? cssOrDebugId : undefined;
|
|
23
23
|
css = css != null ? css : cssOrDebugId;
|
|
24
|
-
if (typeof css === 'string' &&
|
|
24
|
+
if (typeof css === 'string' && !/&&/.test(css)) {
|
|
25
25
|
return (0, css_1.style)((0, exports.vanillaProps)(css), debugId);
|
|
26
26
|
}
|
|
27
27
|
const className = (0, css_1.style)({}, debugId);
|
|
28
28
|
(0, exports.vanillaGlobal)(typeof css === 'function'
|
|
29
29
|
? css('className', `.${className}`)
|
|
30
|
-
: css.replace(
|
|
30
|
+
: css.replace(/&&/g, `.${className}`));
|
|
31
31
|
return className;
|
|
32
32
|
}
|
|
33
33
|
exports.vanillaClass = vanillaClass;
|