@reykjavik/webtools 0.1.33 → 0.1.34
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 +8 -0
- package/README.md +7 -7
- package/esm/next/http.d.ts +1 -1
- package/esm/vanillaExtract.d.ts +4 -2
- package/esm/vanillaExtract.js +1 -1
- package/next/http.d.ts +1 -1
- package/package.json +1 -1
- package/vanillaExtract.d.ts +4 -2
- package/vanillaExtract.js +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -767,9 +767,9 @@ CSS.
|
|
|
767
767
|
### `vanillaClass`
|
|
768
768
|
|
|
769
769
|
**Syntax:**
|
|
770
|
-
`vanillaClass(css: string | ((className: string) => string)): string`
|
|
770
|
+
`vanillaClass(css: string | ((className: string, classNameSelector: string) => string)): string`
|
|
771
771
|
**Syntax:**
|
|
772
|
-
`vanillaClass(debugId: string, css: string | ((className: string) => string)): string`
|
|
772
|
+
`vanillaClass(debugId: string, css: string | ((className: string, classNameSelector: string) => string)): string`
|
|
773
773
|
|
|
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.
|
|
@@ -783,19 +783,19 @@ export const myClass = vanillaClass(`
|
|
|
783
783
|
padding: .5em 1em;
|
|
784
784
|
`);
|
|
785
785
|
|
|
786
|
-
// Passing a function to get the generated class
|
|
786
|
+
// Passing a function to get the generated class-name for
|
|
787
787
|
// more complex styles.
|
|
788
788
|
export const myOtherClass = vanillaClass(
|
|
789
|
-
(className) => `
|
|
790
|
-
|
|
789
|
+
(className, classNameSelector) => `
|
|
790
|
+
${classNameSelector} {
|
|
791
791
|
background-color: #ccc;
|
|
792
792
|
padding: .5em 1em;
|
|
793
793
|
}
|
|
794
|
-
|
|
794
|
+
[class="${className}"] > strong {
|
|
795
795
|
color: #c00;
|
|
796
796
|
}
|
|
797
797
|
@media (min-width: 800px) {
|
|
798
|
-
|
|
798
|
+
${classNameSelector} {
|
|
799
799
|
background-color: #eee;
|
|
800
800
|
}
|
|
801
801
|
}
|
package/esm/next/http.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import React, { FunctionComponent } from 'react';
|
|
3
3
|
import type { Cleanup } from '@reykjavik/hanna-utils';
|
|
4
|
-
import type { ServerResponse } from 'http';
|
|
5
4
|
import type { AppType } from 'next/app.js';
|
|
5
|
+
import type { ServerResponse } from 'node:http';
|
|
6
6
|
import type { HTTP_ERROR_ALL, TTLConfig } from '../http.js';
|
|
7
7
|
export * from '../http.js';
|
|
8
8
|
type NextContextLike = {
|
package/esm/vanillaExtract.d.ts
CHANGED
|
@@ -12,13 +12,14 @@ export declare const vanillaGlobal: (css: string) => void;
|
|
|
12
12
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaprops
|
|
13
13
|
*/
|
|
14
14
|
export declare const vanillaProps: (css: string) => GlobalStyleRule;
|
|
15
|
+
type ClassNameCallback = (className: string, classNameSelector: string) => string;
|
|
15
16
|
/**
|
|
16
17
|
* Returns a scoped cssClassName styled with free-form CSS
|
|
17
18
|
*
|
|
18
19
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaclass
|
|
19
20
|
*/
|
|
20
|
-
export declare function vanillaClass(css: string |
|
|
21
|
-
export declare function vanillaClass(debugId: string, css: string |
|
|
21
|
+
export declare function vanillaClass(css: string | ClassNameCallback): string;
|
|
22
|
+
export declare function vanillaClass(debugId: string, css: string | ClassNameCallback): string;
|
|
22
23
|
/**
|
|
23
24
|
* @deprecated (Will be removed in v0.2)
|
|
24
25
|
*
|
|
@@ -148,3 +149,4 @@ export declare function vanillaClassNested(css: string): string;
|
|
|
148
149
|
* `postcss` config.
|
|
149
150
|
*/
|
|
150
151
|
export declare function vanillaClassNested(debugId: string, css: string): string;
|
|
152
|
+
export {};
|
package/esm/vanillaExtract.js
CHANGED
|
@@ -18,7 +18,7 @@ export function vanillaClass(cssOrDebugId, css) {
|
|
|
18
18
|
css = css != null ? css : cssOrDebugId;
|
|
19
19
|
if (typeof css === 'function') {
|
|
20
20
|
const className = style({}, debugId);
|
|
21
|
-
vanillaGlobal(css(className));
|
|
21
|
+
vanillaGlobal(css(className, `.${className}`));
|
|
22
22
|
return className;
|
|
23
23
|
}
|
|
24
24
|
return style(vanillaProps(css), debugId);
|
package/next/http.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import React, { FunctionComponent } from 'react';
|
|
3
3
|
import type { Cleanup } from '@reykjavik/hanna-utils';
|
|
4
|
-
import type { ServerResponse } from 'http';
|
|
5
4
|
import type { AppType } from 'next/app.js';
|
|
5
|
+
import type { ServerResponse } from 'node:http';
|
|
6
6
|
import type { HTTP_ERROR_ALL, TTLConfig } from '../http.js';
|
|
7
7
|
export * from '../http.js';
|
|
8
8
|
type NextContextLike = {
|
package/package.json
CHANGED
package/vanillaExtract.d.ts
CHANGED
|
@@ -12,13 +12,14 @@ export declare const vanillaGlobal: (css: string) => void;
|
|
|
12
12
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaprops
|
|
13
13
|
*/
|
|
14
14
|
export declare const vanillaProps: (css: string) => GlobalStyleRule;
|
|
15
|
+
type ClassNameCallback = (className: string, classNameSelector: string) => string;
|
|
15
16
|
/**
|
|
16
17
|
* Returns a scoped cssClassName styled with free-form CSS
|
|
17
18
|
*
|
|
18
19
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#vanillaclass
|
|
19
20
|
*/
|
|
20
|
-
export declare function vanillaClass(css: string |
|
|
21
|
-
export declare function vanillaClass(debugId: string, css: string |
|
|
21
|
+
export declare function vanillaClass(css: string | ClassNameCallback): string;
|
|
22
|
+
export declare function vanillaClass(debugId: string, css: string | ClassNameCallback): string;
|
|
22
23
|
/**
|
|
23
24
|
* @deprecated (Will be removed in v0.2)
|
|
24
25
|
*
|
|
@@ -148,3 +149,4 @@ export declare function vanillaClassNested(css: string): string;
|
|
|
148
149
|
* `postcss` config.
|
|
149
150
|
*/
|
|
150
151
|
export declare function vanillaClassNested(debugId: string, css: string): string;
|
|
152
|
+
export {};
|
package/vanillaExtract.js
CHANGED
|
@@ -23,7 +23,7 @@ function vanillaClass(cssOrDebugId, css) {
|
|
|
23
23
|
css = css != null ? css : cssOrDebugId;
|
|
24
24
|
if (typeof css === 'function') {
|
|
25
25
|
const className = (0, css_1.style)({}, debugId);
|
|
26
|
-
(0, exports.vanillaGlobal)(css(className));
|
|
26
|
+
(0, exports.vanillaGlobal)(css(className, `.${className}`));
|
|
27
27
|
return className;
|
|
28
28
|
}
|
|
29
29
|
return (0, css_1.style)((0, exports.vanillaProps)(css), debugId);
|