@reykjavik/webtools 0.1.37 → 0.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 (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/CookieHubConsent.d.ts +2 -2
  3. package/CookieHubConsent.js +2 -2
  4. package/README.md +9 -5
  5. package/SiteImprove.d.ts +3 -3
  6. package/SiteImprove.js +3 -3
  7. package/async.d.ts +2 -2
  8. package/async.js +1 -1
  9. package/errorhandling.d.ts +10 -10
  10. package/errorhandling.js +7 -7
  11. package/esm/CookieHubConsent.d.ts +2 -2
  12. package/esm/CookieHubConsent.js +2 -2
  13. package/esm/SiteImprove.d.ts +3 -3
  14. package/esm/SiteImprove.js +3 -3
  15. package/esm/async.d.ts +2 -2
  16. package/esm/async.js +1 -1
  17. package/esm/errorhandling.d.ts +10 -10
  18. package/esm/errorhandling.js +7 -7
  19. package/esm/http.d.ts +5 -5
  20. package/esm/http.js +4 -4
  21. package/esm/index.d.ts +2 -3
  22. package/esm/next/http.d.ts +2 -2
  23. package/esm/next/http.js +3 -3
  24. package/{remix → esm/react-router}/Wait.d.ts +2 -2
  25. package/esm/{remix → react-router}/Wait.js +2 -2
  26. package/esm/{remix → react-router}/http.d.ts +1 -1
  27. package/esm/{remix → react-router}/http.js +1 -1
  28. package/esm/vanillaExtract.d.ts +3 -132
  29. package/esm/vanillaExtract.js +2 -67
  30. package/http.d.ts +5 -5
  31. package/http.js +4 -4
  32. package/index.d.ts +2 -3
  33. package/next/http.d.ts +2 -2
  34. package/next/http.js +3 -3
  35. package/package.json +13 -17
  36. package/{esm/remix → react-router}/Wait.d.ts +2 -2
  37. package/{remix → react-router}/Wait.js +3 -3
  38. package/{remix → react-router}/http.d.ts +1 -1
  39. package/{remix → react-router}/http.js +1 -1
  40. package/vanillaExtract.d.ts +3 -132
  41. package/vanillaExtract.js +3 -70
  42. package/esm/next/SiteImprove.d.ts +0 -9
  43. package/esm/next/SiteImprove.js +0 -7
  44. package/next/SiteImprove.d.ts +0 -9
  45. package/next/SiteImprove.js +0 -10
@@ -5,7 +5,7 @@ exports.isClientFetch = void 0;
5
5
  * Detects if the request is a client fetch, or an initial/full-page load.
6
6
  * Useful for deciding whether to defer data fetching or not.
7
7
  *
8
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README-remix.md#isclientfetch
8
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README-rr.md#isclientfetch
9
9
  */
10
10
  const isClientFetch = (request) =>
11
11
  // For info about this detection method:
@@ -2,14 +2,14 @@ import { GlobalStyleRule } from '@vanilla-extract/css';
2
2
  /**
3
3
  * Adds free-form CSS as a globalStyle
4
4
  *
5
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaglobal
5
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README.md#vanillaglobal
6
6
  */
7
7
  export declare const vanillaGlobal: (css: string) => void;
8
8
  /**
9
9
  * Spreads the return value into a style object, to inject free-form CSS
10
10
  * properties (or nested blocks)
11
11
  *
12
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaprops
12
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README.md#vanillaprops
13
13
  */
14
14
  export declare const vanillaProps: (css: string) => GlobalStyleRule;
15
15
  type ClassNameCallback = (
@@ -27,137 +27,8 @@ classNameSelector: string) => string;
27
27
  *
28
28
  * To opt out of the `&&` replacement, use the callback function signature.
29
29
  *
30
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaclass
30
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README.md#vanillaclass
31
31
  */
32
32
  export declare function vanillaClass(css: string | ClassNameCallback): string;
33
33
  export declare function vanillaClass(debugId: string, css: string | ClassNameCallback): string;
34
- /**
35
- * @deprecated (Will be removed in v0.2)
36
- *
37
- * Replaces all `&` tokens with the given selector string, in a direct
38
- * (read. "dumb") way. It's mainly useful when used with style-mixins, etc.
39
- *
40
- * **NOTE:** `vanillaNest` does NOT support deeply nested blocks, or anything
41
- * so fancy. It will also replace `&` characters inside values, comments, etc.
42
- * If you need something more sophisticated, use a custom `postcss` config.
43
- *
44
- * ```ts
45
- * // someCssHelper.ts
46
- * import { vanillaNest } from '@reykjavik/webtools/vanillaExtract';
47
- *
48
- * export const hoverGlow = (
49
- * ampSelector: string,
50
- * glowiness?: 'normal' | 'insane'
51
- * ) =>
52
- * vanillaNest(
53
- * ampSelector,
54
- * `
55
- * &:hover {
56
- * box-shadow: 0 0 20px 5px ${
57
- * glowiness === 'insane' ? 'hotpink' : 'salmon'
58
- * };
59
- * }
60
- * `
61
- * );
62
- *
63
- * // ...then, somewhere else in a *.css.ts file:
64
- *
65
- * import { hoverGlow } from '~/someCssHelper.js';
66
- * import { vanillaGlobal } from '@reykjavik/webtools/vanillaExtract';
67
- *
68
- * vanillaGlobal(`
69
- * .MyComponent {
70
- * border: 1px solid #ccc;
71
- * padding: 1em;
72
- * }
73
- * ${hoverGlow('.MyComponent')}
74
- *
75
- * .MyOtherComponent {
76
- * border: 1px solid #ccc;
77
- * padding: 1em;
78
- * }
79
- * ${hoverGlow('.MyOtherComponent', 'insane')}
80
- * `);
81
- * ```
82
- *
83
- * (This low-level utility function is used internally by `vanillaClassNested`.
84
- */
85
- export declare const vanillaNest: (ampSelector: string, css: string) => string;
86
- /**
87
- * @deprecated (Will be removed in v0.2)
88
- *
89
- * Returns a scoped cssClassName styled with free-form CSS.
90
- *
91
- * It also automatically replaces all `&`-tokens with
92
- * the selector for the auto-generated class-name.
93
- *
94
- * ```ts
95
- * // someFile.css.ts
96
- * import { vanillaClassNested } from '@reykjavik/webtools/vanillaExtract';
97
- *
98
- * export const myClass = vanillaClassNested(`
99
- * background-color: #ccc;
100
- * padding: .5em 1em;
101
- *
102
- * /* Nested blocks begin: *​​/
103
- * &:hover {
104
- * background-color: #666;
105
- * color: white;
106
- * }
107
- * & > strong {
108
- * color: maroon;
109
- * }
110
- * html[data-color-theme="unicorn"] & {
111
- * background-color: pink;
112
- * }
113
- * `);
114
- * ```
115
- *
116
- * **NOTE:** All "bare" (un-nested) style properties **must come first**,
117
- * before any nested blocks.
118
- *
119
- * **NOTE 2:** `vanillaClassNested` does NOT support deeply nested blocks, or
120
- * anything so fancy. It will also replace `&` characters inside values,
121
- * comments, etc. If you need something more sophisticated, use a custom
122
- * `postcss` config.
123
- */
124
- export declare function vanillaClassNested(css: string): string;
125
- /** @deprecated (Will be removed in v0.2) */
126
- /**
127
- * Returns a scoped cssClassName styled with free-form CSS.
128
- *
129
- * It also automatically replaces all `&`-tokens with
130
- * the selector for the auto-generated class-name.
131
- *
132
- * ```ts
133
- * // someFile.css.ts
134
- * import { vanillaClassNested } from '@reykjavik/webtools/vanillaExtract';
135
- *
136
- * export const myClass = vanillaClassNested(`
137
- * background-color: #ccc;
138
- * padding: .5em 1em;
139
- *
140
- * /* Nested blocks begin: *​​/
141
- * &:hover {
142
- * background-color: #666;
143
- * color: white;
144
- * }
145
- * & > strong {
146
- * color: maroon;
147
- * }
148
- * html[data-color-theme="unicorn"] & {
149
- * background-color: pink;
150
- * }
151
- * `);
152
- * ```
153
- *
154
- * **NOTE:** All "bare" (un-nested) style properties **must come first**,
155
- * before any nested blocks.
156
- *
157
- * **NOTE 2:** `vanillaClassNested` does NOT support deeply nested blocks, or
158
- * anything so fancy. It will also replace `&` characters inside values,
159
- * comments, etc. If you need something more sophisticated, use a custom
160
- * `postcss` config.
161
- */
162
- export declare function vanillaClassNested(debugId: string, css: string): string;
163
34
  export {};
package/vanillaExtract.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.vanillaClassNested = exports.vanillaNest = exports.vanillaClass = exports.vanillaProps = exports.vanillaGlobal = void 0;
3
+ exports.vanillaClass = exports.vanillaProps = exports.vanillaGlobal = void 0;
4
4
  const css_1 = require("@vanilla-extract/css");
5
5
  /**
6
6
  * Adds free-form CSS as a globalStyle
7
7
  *
8
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaglobal
8
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README.md#vanillaglobal
9
9
  */
10
10
  const vanillaGlobal = (css) => (0, css_1.globalStyle)('x', { x: `} ${css} x{x:` });
11
11
  exports.vanillaGlobal = vanillaGlobal;
@@ -14,7 +14,7 @@ exports.vanillaGlobal = vanillaGlobal;
14
14
  * Spreads the return value into a style object, to inject free-form CSS
15
15
  * properties (or nested blocks)
16
16
  *
17
- * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaprops
17
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.2/README.md#vanillaprops
18
18
  */
19
19
  const vanillaProps = (css) => ({ x: `; ${css}` });
20
20
  exports.vanillaProps = vanillaProps;
@@ -31,70 +31,3 @@ function vanillaClass(cssOrDebugId, css) {
31
31
  return className;
32
32
  }
33
33
  exports.vanillaClass = vanillaClass;
34
- // ---------------------------------------------------------------------------
35
- /**
36
- * @deprecated (Will be removed in v0.2)
37
- *
38
- * Replaces all `&` tokens with the given selector string, in a direct
39
- * (read. "dumb") way. It's mainly useful when used with style-mixins, etc.
40
- *
41
- * **NOTE:** `vanillaNest` does NOT support deeply nested blocks, or anything
42
- * so fancy. It will also replace `&` characters inside values, comments, etc.
43
- * If you need something more sophisticated, use a custom `postcss` config.
44
- *
45
- * ```ts
46
- * // someCssHelper.ts
47
- * import { vanillaNest } from '@reykjavik/webtools/vanillaExtract';
48
- *
49
- * export const hoverGlow = (
50
- * ampSelector: string,
51
- * glowiness?: 'normal' | 'insane'
52
- * ) =>
53
- * vanillaNest(
54
- * ampSelector,
55
- * `
56
- * &:hover {
57
- * box-shadow: 0 0 20px 5px ${
58
- * glowiness === 'insane' ? 'hotpink' : 'salmon'
59
- * };
60
- * }
61
- * `
62
- * );
63
- *
64
- * // ...then, somewhere else in a *.css.ts file:
65
- *
66
- * import { hoverGlow } from '~/someCssHelper.js';
67
- * import { vanillaGlobal } from '@reykjavik/webtools/vanillaExtract';
68
- *
69
- * vanillaGlobal(`
70
- * .MyComponent {
71
- * border: 1px solid #ccc;
72
- * padding: 1em;
73
- * }
74
- * ${hoverGlow('.MyComponent')}
75
- *
76
- * .MyOtherComponent {
77
- * border: 1px solid #ccc;
78
- * padding: 1em;
79
- * }
80
- * ${hoverGlow('.MyOtherComponent', 'insane')}
81
- * `);
82
- * ```
83
- *
84
- * (This low-level utility function is used internally by `vanillaClassNested`.
85
- */
86
- const vanillaNest = (ampSelector, css) => css.replace(/&/g, ampSelector);
87
- exports.vanillaNest = vanillaNest;
88
- function vanillaClassNested(cssOrDebugId, css) {
89
- const debugId = css != null ? cssOrDebugId : undefined;
90
- css = css != null ? css : cssOrDebugId;
91
- const nestPoint = css.indexOf('&');
92
- const bareStyles = nestPoint > -1 ? css.slice(0, nestPoint) : css;
93
- const nestedStyles = nestPoint > -1 ? css.slice(nestPoint) : undefined;
94
- const className = (0, css_1.style)((0, exports.vanillaProps)(bareStyles), debugId);
95
- if (nestedStyles) {
96
- (0, exports.vanillaGlobal)((0, exports.vanillaNest)(`.${className}`, nestedStyles));
97
- }
98
- return className;
99
- }
100
- exports.vanillaClassNested = vanillaClassNested;
@@ -1,9 +0,0 @@
1
- import { SiteImproveProps as _SiteImproveProps } from '../SiteImprove.js';
2
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
3
- export type SiteImproveProps = _SiteImproveProps;
4
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
5
- export declare const SiteImprove: (props: _SiteImproveProps) => null;
6
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
7
- export declare const pingSiteImprove: (category: string, action: string, label?: string | undefined) => void;
8
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
9
- export declare const pingSiteImproveOutbound: (ourl: string) => void;
@@ -1,7 +0,0 @@
1
- import { pingSiteImprove as _pingSiteImprove, pingSiteImproveOutbound as _pingSiteImproveOutbound, SiteImprove as _SiteImprove, } from '../SiteImprove.js';
2
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
3
- export const SiteImprove = _SiteImprove;
4
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
5
- export const pingSiteImprove = _pingSiteImprove;
6
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
7
- export const pingSiteImproveOutbound = _pingSiteImproveOutbound;
@@ -1,9 +0,0 @@
1
- import { SiteImproveProps as _SiteImproveProps } from '../SiteImprove.js';
2
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
3
- export type SiteImproveProps = _SiteImproveProps;
4
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
5
- export declare const SiteImprove: (props: _SiteImproveProps) => null;
6
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
7
- export declare const pingSiteImprove: (category: string, action: string, label?: string | undefined) => void;
8
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
9
- export declare const pingSiteImproveOutbound: (ourl: string) => void;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pingSiteImproveOutbound = exports.pingSiteImprove = exports.SiteImprove = void 0;
4
- const SiteImprove_js_1 = require("../SiteImprove.js");
5
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
6
- exports.SiteImprove = SiteImprove_js_1.SiteImprove;
7
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
8
- exports.pingSiteImprove = SiteImprove_js_1.pingSiteImprove;
9
- /** @deprecated Instead import from `@reykjavik/webtools/SiteImprove` (Will be removed in v0.2) */
10
- exports.pingSiteImproveOutbound = SiteImprove_js_1.pingSiteImproveOutbound;