simplestyle-js 5.4.5 → 5.4.7
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/dist/cjs/next/SimpleStyleProvider.cjs +4 -4
- package/dist/cjs/simpleStyleRegistry.cjs +6 -0
- package/dist/cjs/simpleStyleRegistry.d.ts +5 -0
- package/dist/esm/next/SimpleStyleProvider.mjs +4 -4
- package/dist/esm/simpleStyleRegistry.d.ts +5 -0
- package/dist/esm/simpleStyleRegistry.mjs +6 -0
- package/package.json +2 -12
- package/dist/cjs/next/ClientBoundary.cjs +0 -20
- package/dist/cjs/next/ClientBoundary.d.ts +0 -4
- package/dist/esm/next/ClientBoundary.d.ts +0 -4
- package/dist/esm/next/ClientBoundary.mjs +0 -10
|
@@ -9,13 +9,13 @@ Object.defineProperty(exports, "SimpleStyleProvider", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
-
const _ClientBoundary = require("./ClientBoundary.cjs");
|
|
13
12
|
function SimpleStyleProvider({ children, registry }) {
|
|
14
13
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
15
14
|
children: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
|
|
16
|
+
id: ruleId,
|
|
17
|
+
children: css
|
|
18
|
+
}, ruleId)),
|
|
19
19
|
children
|
|
20
20
|
]
|
|
21
21
|
});
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "SimpleStyleRegistry", {
|
|
|
11
11
|
/* eslint-disable unicorn/prefer-query-selector */ const doc = globalThis.document;
|
|
12
12
|
class SimpleStyleRegistry {
|
|
13
13
|
sheets = new Map();
|
|
14
|
+
_id = performance.now().toString();
|
|
14
15
|
add(ruleId, contents) {
|
|
15
16
|
if (this.sheets.has(ruleId) && doc) {
|
|
16
17
|
const tag = doc.getElementById(ruleId);
|
|
@@ -45,4 +46,9 @@ ${contents}`, '');
|
|
|
45
46
|
...this.sheets.entries()
|
|
46
47
|
];
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* unique ID for this registry, based on the time when it was created
|
|
51
|
+
*/ get id() {
|
|
52
|
+
return this._id;
|
|
53
|
+
}
|
|
48
54
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class SimpleStyleRegistry {
|
|
8
8
|
private sheets;
|
|
9
|
+
private _id;
|
|
9
10
|
add(ruleId: string, contents: string): void;
|
|
10
11
|
/**
|
|
11
12
|
* returns the bare CSS to be injected into a <style /> tag
|
|
@@ -25,4 +26,8 @@ export declare class SimpleStyleRegistry {
|
|
|
25
26
|
* won't work during local development
|
|
26
27
|
*/
|
|
27
28
|
getRulesById(): [string, string][];
|
|
29
|
+
/**
|
|
30
|
+
* unique ID for this registry, based on the time when it was created
|
|
31
|
+
*/
|
|
32
|
+
get id(): string;
|
|
28
33
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ClientBoundary } from './ClientBoundary.mjs';
|
|
3
2
|
/**
|
|
4
3
|
* Accumulates all CSS rules and writes
|
|
5
4
|
* them to your layout.
|
|
@@ -8,9 +7,10 @@ import { ClientBoundary } from './ClientBoundary.mjs';
|
|
|
8
7
|
*/ export function SimpleStyleProvider({ children, registry }) {
|
|
9
8
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
10
9
|
children: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ _jsx("style", {
|
|
11
|
+
id: ruleId,
|
|
12
|
+
children: css
|
|
13
|
+
}, ruleId)),
|
|
14
14
|
children
|
|
15
15
|
]
|
|
16
16
|
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class SimpleStyleRegistry {
|
|
8
8
|
private sheets;
|
|
9
|
+
private _id;
|
|
9
10
|
add(ruleId: string, contents: string): void;
|
|
10
11
|
/**
|
|
11
12
|
* returns the bare CSS to be injected into a <style /> tag
|
|
@@ -25,4 +26,8 @@ export declare class SimpleStyleRegistry {
|
|
|
25
26
|
* won't work during local development
|
|
26
27
|
*/
|
|
27
28
|
getRulesById(): [string, string][];
|
|
29
|
+
/**
|
|
30
|
+
* unique ID for this registry, based on the time when it was created
|
|
31
|
+
*/
|
|
32
|
+
get id(): string;
|
|
28
33
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* React variant of this will come after the baseline one is created
|
|
7
7
|
*/ export class SimpleStyleRegistry {
|
|
8
8
|
sheets = new Map();
|
|
9
|
+
_id = performance.now().toString();
|
|
9
10
|
add(ruleId, contents) {
|
|
10
11
|
if (this.sheets.has(ruleId) && doc) {
|
|
11
12
|
const tag = doc.getElementById(ruleId);
|
|
@@ -40,4 +41,9 @@ ${contents}`, '');
|
|
|
40
41
|
...this.sheets.entries()
|
|
41
42
|
];
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* unique ID for this registry, based on the time when it was created
|
|
46
|
+
*/ get id() {
|
|
47
|
+
return this._id;
|
|
48
|
+
}
|
|
43
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simplestyle-js",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.7",
|
|
4
4
|
"description": "An incredibly straightforward and simple CSS-in-JS solution with zero runtime dependencies, and out-of-the-box TypeScript support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"postcss": "^8.5.6",
|
|
54
54
|
"react": ">=18",
|
|
55
55
|
"react-dom": ">=18",
|
|
56
|
-
"@better-builds/ts-duality": "^1.
|
|
56
|
+
"@better-builds/ts-duality": "^1.2.5",
|
|
57
57
|
"typescript": "^5.9.3",
|
|
58
58
|
"vite": "^7.3.0",
|
|
59
59
|
"vitest": "^4.0.16"
|
|
@@ -110,16 +110,6 @@
|
|
|
110
110
|
"default": "./dist/esm/makeStyles.mjs"
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
-
"./next/ClientBoundary": {
|
|
114
|
-
"require": {
|
|
115
|
-
"types": "./dist/cjs/next/ClientBoundary.d.ts",
|
|
116
|
-
"default": "./dist/cjs/next/ClientBoundary.cjs"
|
|
117
|
-
},
|
|
118
|
-
"import": {
|
|
119
|
-
"types": "./dist/esm/next/ClientBoundary.d.ts",
|
|
120
|
-
"default": "./dist/esm/next/ClientBoundary.mjs"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
113
|
"./next/SimpleStyleProvider": {
|
|
124
114
|
"require": {
|
|
125
115
|
"types": "./dist/cjs/next/SimpleStyleProvider.d.ts",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ClientBoundary", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return ClientBoundary;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
13
|
-
function ClientBoundary({ rules }) {
|
|
14
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
15
|
-
children: rules.map(([ruleId, css])=>/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
|
|
16
|
-
id: ruleId,
|
|
17
|
-
children: css
|
|
18
|
-
}, ruleId))
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
export function ClientBoundary({ rules }) {
|
|
4
|
-
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
5
|
-
children: rules.map(([ruleId, css])=>/*#__PURE__*/ _jsx("style", {
|
|
6
|
-
id: ruleId,
|
|
7
|
-
children: css
|
|
8
|
-
}, ruleId))
|
|
9
|
-
});
|
|
10
|
-
}
|