@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 CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.1.36
8
+
9
+ _2024-10-18_
10
+
11
+ - `@reykjavik/webtools/next/vanillaExtract`:
12
+ - fix: Change `vanillaClass` replacement token to be `&&`
13
+
7
14
  ## 0.1.35
8
15
 
9
16
  _2024-10-18_
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 `.&` tokens are automatically replaced with the
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 `.&` replacement, use the callback function signature.
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 .& tokens that get replaced with the generated class-name
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
- .& > strong {
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
- /* ".&" tokens in CSS returned from a callback are not replaced */
821
- .& { will-not-be: interpolated; }
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 `.&` pattern is chosen to not conflict with the bare
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`
@@ -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 `.&` tokens are automatically replaced with the
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 `.&` replacement, use the callback function signature.
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
  */
@@ -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' && !/.&/.test(css)) {
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(/.&/g, `.${className}`));
25
+ : css.replace(/&&/g, `.${className}`));
26
26
  return className;
27
27
  }
28
28
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/webtools",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Misc. JS/TS helpers used by Reykjavík City's web dev teams.",
5
5
  "main": "index.js",
6
6
  "repository": "ssh://git@github.com:reykjavikcity/webtools.git",
@@ -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 `.&` tokens are automatically replaced with the
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 `.&` replacement, use the callback function signature.
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' && !/.&/.test(css)) {
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(/.&/g, `.${className}`));
30
+ : css.replace(/&&/g, `.${className}`));
31
31
  return className;
32
32
  }
33
33
  exports.vanillaClass = vanillaClass;