simplestyle-js 5.3.1-beta.2 → 5.3.2

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/README.md CHANGED
@@ -146,8 +146,7 @@ SimpleStyle provides an easy way to "bind" all of the CSS functions it exports t
146
146
  To do this, you would use the same API that's used to bind to a specific sheet registry, but specify the `variables` option:
147
147
 
148
148
  ```typescript
149
- import { makeCssFuncs } from "simplestyle-js";
150
- import { SimpleStyleRegistry } from "simplestyle-js/simpleStyleRegistry";
149
+ import { makeCssFuncs, SimpleStyleRegistry } from "simplestyle-js";
151
150
 
152
151
 
153
152
  export const { createStyles, keyframes } = makeCssFuncs({
@@ -225,33 +224,33 @@ Check out this [Code Sandbox w/Next.js integration to see how it works](https://
225
224
 
226
225
  ### Astro
227
226
 
228
- Create your style registry and scoped CSS functions, then use the official Astro integration here and wrap the `SimpleStyleProvider` around your page's `<head />` contents.
227
+ Due to how Astro processes its front matter sections at build time, and how this also affects local development, each `.astro` file that has its own CSS rules will also need to have its own `SimpleStyleRegistry` instance.
228
+ The overall developer experience is similar to Next.js, but requires a pinch more boilerplate.
229
229
 
230
230
  ```typescript
231
231
  // src/styleRegistry.ts
232
232
 
233
233
  import { makeCssFuncs, setSeed } from "simplestyle-js";
234
- import { SimpleStyleRegistry } from "simplestyle-js/simpleStyleRegistry";
235
234
 
236
235
  // ensures deterministic creation of CSS classnames
237
236
  setSeed(11223344);
238
237
 
239
- export const StyleRegistry = new SimpleStyleRegistry();
240
-
241
- export { createStyles, imports, keyframes, rawStyles } = makeCssFuncs({ registry: StyleRegistry });
238
+ export { createStyles, imports, keyframes, rawStyles } = makeCssFuncs({});
242
239
  ```
243
240
 
244
241
  ```astro
245
242
  ---
243
+ import { SimpleStyleRegistry } from "simplestyle-js";
246
244
  import SimpleStyleProvider from "simplestyle-js/astro/SimpleStyleProvider";
247
245
 
248
246
  import {
249
- StyleRegistry,
250
247
  createStyles,
251
248
  keyframes,
252
249
  rawStyles,
253
250
  } from "../styleRegistry";
254
251
 
252
+ const registry = new SimpleStyleRegistry();
253
+
255
254
  rawStyles("basic-css-reset", () => ({
256
255
  "*": {
257
256
  boxSizing: "border-box",
@@ -261,7 +260,10 @@ rawStyles("basic-css-reset", () => ({
261
260
  fontSize: "16px",
262
261
  padding: 0,
263
262
  },
264
- }));
263
+ }), {
264
+ // provide the registry used for this `.astro` file here
265
+ registry,
266
+ });
265
267
 
266
268
  // make changes to me and I will hot reload!
267
269
  const { keyframe } = keyframes("HomePage", () => ({
@@ -277,7 +279,10 @@ const { keyframe } = keyframes("HomePage", () => ({
277
279
  "100%": {
278
280
  backgroundColor: "#cc2222cc",
279
281
  },
280
- }));
282
+ }), {
283
+ // provide the registry used for this `.astro` file here
284
+ registry,
285
+ });
281
286
 
282
287
  const { classes } = createStyles("HomePage", () => ({
283
288
  background: {
@@ -296,20 +301,14 @@ const { classes } = createStyles("HomePage", () => ({
296
301
  color: "white",
297
302
  padding: "1rem",
298
303
  },
299
- }));
304
+ }), {
305
+ // provide the registry used for this `.astro` file here
306
+ registry,
307
+ });
300
308
  ---
301
-
302
- <html lang="en">
303
- <head>
304
- <SimpleStyleProvider registry={StyleRegistry}>
305
- <meta charset="utf-8" />
306
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
307
- <meta name="viewport" content="width=device-width" />
308
- <meta name="generator" content={Astro.generator} />
309
- <title>Astro</title>
310
- </SimpleStyleProvider>
311
- </head>
312
- <body class={classes.background}>
309
+ <!-- wrap your astro content here with the provider and give it the registry you created in your front matter -->
310
+ <SimpleStyleProvider registry={registry}>
311
+ <div class={classes.background}>
313
312
  <div class={classes.content}>
314
313
  <h1>Astro</h1>
315
314
  <p>
@@ -318,8 +317,8 @@ const { classes } = createStyles("HomePage", () => ({
318
317
  </p>
319
318
  <p>Feel free to edit me and I'll hot reload!</p>
320
319
  </div>
321
- </body>
322
- </html>
320
+ </div>
321
+ </SimpleStyleProvider>
323
322
  ```
324
323
 
325
324
  Check out this [Code Sandbox w/Astro integration to see how it works](https://codesandbox.io/p/devbox/mq9twt).
@@ -341,8 +340,7 @@ The core APIs needed to make this work are:
341
340
  For demonstration purposes, we'll locate this at our `src/` root, and name it `styleLib.js`
342
341
 
343
342
  ```javascript
344
- import { makeCssFuncs, setSeed } from "simplestyle-js";
345
- import { SimpleStyleRegistry } from "simplestyle-js/simpleStyleRegistry";
343
+ import { makeCssFuncs, setSeed, SimpleStyleRegistry } from "simplestyle-js";
346
344
 
347
345
  // set the className generation seed to ensure classNames are computed consistently
348
346
  // between the client and the server.
@@ -0,0 +1,16 @@
1
+ ---
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry';
3
+
4
+ interface Props {
5
+ registry: SimpleStyleRegistry;
6
+ }
7
+
8
+ const { registry } = Astro.props;
9
+
10
+ const cssRulesById = registry.getRulesById();
11
+ ---
12
+ {cssRulesById.map(([ruleId, css]) => (
13
+ <style id={ruleId} set:html={css}></style>
14
+ ))}
15
+
16
+ <slot />
@@ -9,6 +9,9 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get SimpleStyleRegistry () {
13
+ return _simpleStyleRegistry.SimpleStyleRegistry;
14
+ },
12
15
  get createStyles () {
13
16
  return _createStyles.default;
14
17
  },
@@ -29,7 +32,7 @@ const _createStyles = /*#__PURE__*/ _interop_require_wildcard(require("./createS
29
32
  const _generateClassName = require("./generateClassName.cjs");
30
33
  _export_star(require("./makeStyles.cjs"), exports);
31
34
  const _plugins = require("./plugins.cjs");
32
- _export_star(require("./simpleStyleRegistry.cjs"), exports);
35
+ const _simpleStyleRegistry = require("./simpleStyleRegistry.cjs");
33
36
  _export_star(require("./types.cjs"), exports);
34
37
  function _export_star(from, to) {
35
38
  Object.keys(from).forEach(function(k) {
@@ -4,5 +4,5 @@ export { setSeed } from './generateClassName.js';
4
4
  export * from './makeStyles.js';
5
5
  export type { PosthookPlugin } from './plugins.js';
6
6
  export { registerPosthook } from './plugins.js';
7
- export * from './simpleStyleRegistry.js';
7
+ export { SimpleStyleRegistry } from './simpleStyleRegistry.js';
8
8
  export * from './types.js';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "SimpleStyleProvider", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return SimpleStyleProvider;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ function SimpleStyleProvider({ children, registry }) {
13
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
14
+ children: [
15
+ registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
16
+ id: ruleId,
17
+ children: css
18
+ }, ruleId)),
19
+ children
20
+ ]
21
+ });
22
+ }
@@ -0,0 +1,12 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
+ export type SimpleStyleProviderProps = PropsWithChildren & {
4
+ registry: SimpleStyleRegistry;
5
+ };
6
+ /**
7
+ * Accumulates all CSS rules and writes
8
+ * them to your layout.
9
+ * Use this for Next.js or other Next.js-like frameworks
10
+ * that leverage React server components
11
+ */
12
+ export declare function SimpleStyleProvider({ children, registry, }: SimpleStyleProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -2,25 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "makeCssFuncs", {
6
- enumerable: true,
7
- get: function() {
8
- return makeCssFuncs;
9
- }
10
- });
11
- const _makeStyles = require("../makeStyles.cjs");
12
- const _SimpleStyleProvider = require("../SimpleStyleProvider.cjs");
13
- const _simpleStyleRegistry = require("../simpleStyleRegistry.cjs");
14
- const makeCssFuncs = (...args)=>{
15
- const [opts, ...rest] = args;
16
- const { registry: providedRegistry } = opts;
17
- const registry = providedRegistry ?? new _simpleStyleRegistry.SimpleStyleRegistry();
18
- const funcs = (0, _makeStyles.makeCssFuncs)({
19
- ...opts,
20
- registry
21
- }, ...rest);
22
- return {
23
- ...funcs,
24
- SimpleStyleProvider: (0, _SimpleStyleProvider.makeSimpleStyleProvider)(registry)
25
- };
26
- };
5
+ _export_star(require("./SimpleStyleProvider.cjs"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
@@ -1,39 +1 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.js';
2
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
- export declare const makeCssFuncs: (...args: Parameters<typeof _makeCssFuncs>) => {
4
- SimpleStyleProvider: ({ children }: import("react").PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
- createStyles: <T extends import("../types.js").SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
6
- flush: boolean;
7
- insertAfter?: HTMLElement;
8
- insertBefore?: HTMLElement;
9
- registry?: SimpleStyleRegistry;
10
- }> | undefined) => {
11
- classes: O;
12
- stylesheet: string;
13
- updateSheet: <T2 extends import("../types.js").SimpleStyleRules>(updatedRulesFnc: () => Partial<T2>) => {
14
- classes: Record<string | number | keyof T2, string>;
15
- stylesheet: string;
16
- } | null;
17
- };
18
- imports: (ruleId: string, rulesFnc: (vars: object) => `@import ${string}`[], overrides?: Partial<{
19
- flush: boolean;
20
- insertAfter?: HTMLElement;
21
- insertBefore?: HTMLElement;
22
- registry?: SimpleStyleRegistry;
23
- }> | undefined) => void;
24
- keyframes: <T extends Record<string, import("csstype").Properties>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
25
- flush: boolean;
26
- insertAfter?: HTMLElement;
27
- insertBefore?: HTMLElement;
28
- registry?: SimpleStyleRegistry;
29
- }> | undefined) => {
30
- keyframe: string;
31
- stylesheet: string;
32
- };
33
- rawStyles: <T extends import("../types.js").SimpleStyleRules>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
34
- flush: boolean;
35
- insertAfter?: HTMLElement;
36
- insertBefore?: HTMLElement;
37
- registry?: SimpleStyleRegistry;
38
- }> | undefined) => string;
39
- };
1
+ export * from './SimpleStyleProvider.js';
@@ -0,0 +1,16 @@
1
+ ---
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry';
3
+
4
+ interface Props {
5
+ registry: SimpleStyleRegistry;
6
+ }
7
+
8
+ const { registry } = Astro.props;
9
+
10
+ const cssRulesById = registry.getRulesById();
11
+ ---
12
+ {cssRulesById.map(([ruleId, css]) => (
13
+ <style id={ruleId} set:html={css}></style>
14
+ ))}
15
+
16
+ <slot />
@@ -4,5 +4,5 @@ export { setSeed } from './generateClassName.js';
4
4
  export * from './makeStyles.js';
5
5
  export type { PosthookPlugin } from './plugins.js';
6
6
  export { registerPosthook } from './plugins.js';
7
- export * from './simpleStyleRegistry.js';
7
+ export { SimpleStyleRegistry } from './simpleStyleRegistry.js';
8
8
  export * from './types.js';
@@ -2,5 +2,5 @@ export { default as createStyles, keyframes, rawStyles } from './createStyles.mj
2
2
  export { setSeed } from './generateClassName.mjs';
3
3
  export * from './makeStyles.mjs';
4
4
  export { registerPosthook } from './plugins.mjs';
5
- export * from './simpleStyleRegistry.mjs';
5
+ export { SimpleStyleRegistry } from './simpleStyleRegistry.mjs';
6
6
  export * from './types.mjs';
@@ -0,0 +1,12 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
+ export type SimpleStyleProviderProps = PropsWithChildren & {
4
+ registry: SimpleStyleRegistry;
5
+ };
6
+ /**
7
+ * Accumulates all CSS rules and writes
8
+ * them to your layout.
9
+ * Use this for Next.js or other Next.js-like frameworks
10
+ * that leverage React server components
11
+ */
12
+ export declare function SimpleStyleProvider({ children, registry, }: SimpleStyleProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Accumulates all CSS rules and writes
4
+ * them to your layout.
5
+ * Use this for Next.js or other Next.js-like frameworks
6
+ * that leverage React server components
7
+ */ export function SimpleStyleProvider({ children, registry }) {
8
+ return /*#__PURE__*/ _jsxs(_Fragment, {
9
+ children: [
10
+ registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ _jsx("style", {
11
+ id: ruleId,
12
+ children: css
13
+ }, ruleId)),
14
+ children
15
+ ]
16
+ });
17
+ }
@@ -1,39 +1 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.js';
2
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
- export declare const makeCssFuncs: (...args: Parameters<typeof _makeCssFuncs>) => {
4
- SimpleStyleProvider: ({ children }: import("react").PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
- createStyles: <T extends import("../types.js").SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
6
- flush: boolean;
7
- insertAfter?: HTMLElement;
8
- insertBefore?: HTMLElement;
9
- registry?: SimpleStyleRegistry;
10
- }> | undefined) => {
11
- classes: O;
12
- stylesheet: string;
13
- updateSheet: <T2 extends import("../types.js").SimpleStyleRules>(updatedRulesFnc: () => Partial<T2>) => {
14
- classes: Record<string | number | keyof T2, string>;
15
- stylesheet: string;
16
- } | null;
17
- };
18
- imports: (ruleId: string, rulesFnc: (vars: object) => `@import ${string}`[], overrides?: Partial<{
19
- flush: boolean;
20
- insertAfter?: HTMLElement;
21
- insertBefore?: HTMLElement;
22
- registry?: SimpleStyleRegistry;
23
- }> | undefined) => void;
24
- keyframes: <T extends Record<string, import("csstype").Properties>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
25
- flush: boolean;
26
- insertAfter?: HTMLElement;
27
- insertBefore?: HTMLElement;
28
- registry?: SimpleStyleRegistry;
29
- }> | undefined) => {
30
- keyframe: string;
31
- stylesheet: string;
32
- };
33
- rawStyles: <T extends import("../types.js").SimpleStyleRules>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
34
- flush: boolean;
35
- insertAfter?: HTMLElement;
36
- insertBefore?: HTMLElement;
37
- registry?: SimpleStyleRegistry;
38
- }> | undefined) => string;
39
- };
1
+ export * from './SimpleStyleProvider.js';
@@ -1,16 +1 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.mjs';
2
- import { makeSimpleStyleProvider } from '../SimpleStyleProvider.mjs';
3
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.mjs';
4
- export const makeCssFuncs = (...args)=>{
5
- const [opts, ...rest] = args;
6
- const { registry: providedRegistry } = opts;
7
- const registry = providedRegistry ?? new SimpleStyleRegistry();
8
- const funcs = _makeCssFuncs({
9
- ...opts,
10
- registry
11
- }, ...rest);
12
- return {
13
- ...funcs,
14
- SimpleStyleProvider: makeSimpleStyleProvider(registry)
15
- };
16
- };
1
+ export * from './SimpleStyleProvider.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplestyle-js",
3
- "version": "5.3.1-beta.2",
3
+ "version": "5.3.2",
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": {
@@ -70,26 +70,6 @@
70
70
  "react": ">=16.8"
71
71
  },
72
72
  "exports": {
73
- "./SimpleStyleProvider": {
74
- "require": {
75
- "types": "./dist/cjs/SimpleStyleProvider.d.ts",
76
- "default": "./dist/cjs/SimpleStyleProvider.cjs"
77
- },
78
- "import": {
79
- "types": "./dist/esm/SimpleStyleProvider.d.ts",
80
- "default": "./dist/esm/SimpleStyleProvider.mjs"
81
- }
82
- },
83
- "./astro": {
84
- "require": {
85
- "types": "./dist/cjs/astro/index.d.ts",
86
- "default": "./dist/cjs/astro/index.cjs"
87
- },
88
- "import": {
89
- "types": "./dist/esm/astro/index.d.ts",
90
- "default": "./dist/esm/astro/index.mjs"
91
- }
92
- },
93
73
  "./createStyles": {
94
74
  "require": {
95
75
  "types": "./dist/cjs/createStyles.d.ts",
@@ -130,6 +110,16 @@
130
110
  "default": "./dist/esm/makeStyles.mjs"
131
111
  }
132
112
  },
113
+ "./next/SimpleStyleProvider": {
114
+ "require": {
115
+ "types": "./dist/cjs/next/SimpleStyleProvider.d.ts",
116
+ "default": "./dist/cjs/next/SimpleStyleProvider.cjs"
117
+ },
118
+ "import": {
119
+ "types": "./dist/esm/next/SimpleStyleProvider.d.ts",
120
+ "default": "./dist/esm/next/SimpleStyleProvider.mjs"
121
+ }
122
+ },
133
123
  "./next": {
134
124
  "require": {
135
125
  "types": "./dist/cjs/next/index.d.ts",
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "makeSimpleStyleProvider", {
6
- enumerable: true,
7
- get: function() {
8
- return makeSimpleStyleProvider;
9
- }
10
- });
11
- const _jsxruntime = require("react/jsx-runtime");
12
- function makeSimpleStyleProvider(registry) {
13
- /**
14
- * Accumulates all CSS rules and writes
15
- * them to your layout.
16
- * Use this for Next.js or other Next.js-like frameworks
17
- * that leverage React server components
18
- */ return function SimpleStyleProvider({ children }) {
19
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
20
- children: [
21
- registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
22
- id: ruleId,
23
- children: css
24
- }, ruleId)),
25
- children
26
- ]
27
- });
28
- };
29
- }
@@ -1,3 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- import type { SimpleStyleRegistry } from './simpleStyleRegistry.js';
3
- export declare function makeSimpleStyleProvider(registry: SimpleStyleRegistry): ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "makeCssFuncs", {
6
- enumerable: true,
7
- get: function() {
8
- return makeCssFuncs;
9
- }
10
- });
11
- const _makeStyles = require("../makeStyles.cjs");
12
- const _SimpleStyleProvider = require("../SimpleStyleProvider.cjs");
13
- const _simpleStyleRegistry = require("../simpleStyleRegistry.cjs");
14
- const makeCssFuncs = (...args)=>{
15
- const [opts, ...rest] = args;
16
- const { registry: providedRegistry } = opts;
17
- const registry = providedRegistry ?? new _simpleStyleRegistry.SimpleStyleRegistry();
18
- const funcs = (0, _makeStyles.makeCssFuncs)({
19
- ...opts,
20
- registry
21
- }, ...rest);
22
- return {
23
- ...funcs,
24
- SimpleStyleProvider: (0, _SimpleStyleProvider.makeSimpleStyleProvider)(registry)
25
- };
26
- };
@@ -1,39 +0,0 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.js';
2
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
- export declare const makeCssFuncs: (...args: Parameters<typeof _makeCssFuncs>) => {
4
- SimpleStyleProvider: ({ children }: import("react").PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
- createStyles: <T extends import("../types.js").SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
6
- flush: boolean;
7
- insertAfter?: HTMLElement;
8
- insertBefore?: HTMLElement;
9
- registry?: SimpleStyleRegistry;
10
- }> | undefined) => {
11
- classes: O;
12
- stylesheet: string;
13
- updateSheet: <T2 extends import("../types.js").SimpleStyleRules>(updatedRulesFnc: () => Partial<T2>) => {
14
- classes: Record<string | number | keyof T2, string>;
15
- stylesheet: string;
16
- } | null;
17
- };
18
- imports: (ruleId: string, rulesFnc: (vars: object) => `@import ${string}`[], overrides?: Partial<{
19
- flush: boolean;
20
- insertAfter?: HTMLElement;
21
- insertBefore?: HTMLElement;
22
- registry?: SimpleStyleRegistry;
23
- }> | undefined) => void;
24
- keyframes: <T extends Record<string, import("csstype").Properties>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
25
- flush: boolean;
26
- insertAfter?: HTMLElement;
27
- insertBefore?: HTMLElement;
28
- registry?: SimpleStyleRegistry;
29
- }> | undefined) => {
30
- keyframe: string;
31
- stylesheet: string;
32
- };
33
- rawStyles: <T extends import("../types.js").SimpleStyleRules>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
34
- flush: boolean;
35
- insertAfter?: HTMLElement;
36
- insertBefore?: HTMLElement;
37
- registry?: SimpleStyleRegistry;
38
- }> | undefined) => string;
39
- };
@@ -1,3 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- import type { SimpleStyleRegistry } from './simpleStyleRegistry.js';
3
- export declare function makeSimpleStyleProvider(registry: SimpleStyleRegistry): ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- export function makeSimpleStyleProvider(registry) {
3
- /**
4
- * Accumulates all CSS rules and writes
5
- * them to your layout.
6
- * Use this for Next.js or other Next.js-like frameworks
7
- * that leverage React server components
8
- */ return function SimpleStyleProvider({ children }) {
9
- return /*#__PURE__*/ _jsxs(_Fragment, {
10
- children: [
11
- registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ _jsx("style", {
12
- id: ruleId,
13
- children: css
14
- }, ruleId)),
15
- children
16
- ]
17
- });
18
- };
19
- }
@@ -1,39 +0,0 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.js';
2
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
- export declare const makeCssFuncs: (...args: Parameters<typeof _makeCssFuncs>) => {
4
- SimpleStyleProvider: ({ children }: import("react").PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
- createStyles: <T extends import("../types.js").SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
6
- flush: boolean;
7
- insertAfter?: HTMLElement;
8
- insertBefore?: HTMLElement;
9
- registry?: SimpleStyleRegistry;
10
- }> | undefined) => {
11
- classes: O;
12
- stylesheet: string;
13
- updateSheet: <T2 extends import("../types.js").SimpleStyleRules>(updatedRulesFnc: () => Partial<T2>) => {
14
- classes: Record<string | number | keyof T2, string>;
15
- stylesheet: string;
16
- } | null;
17
- };
18
- imports: (ruleId: string, rulesFnc: (vars: object) => `@import ${string}`[], overrides?: Partial<{
19
- flush: boolean;
20
- insertAfter?: HTMLElement;
21
- insertBefore?: HTMLElement;
22
- registry?: SimpleStyleRegistry;
23
- }> | undefined) => void;
24
- keyframes: <T extends Record<string, import("csstype").Properties>>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
25
- flush: boolean;
26
- insertAfter?: HTMLElement;
27
- insertBefore?: HTMLElement;
28
- registry?: SimpleStyleRegistry;
29
- }> | undefined) => {
30
- keyframe: string;
31
- stylesheet: string;
32
- };
33
- rawStyles: <T extends import("../types.js").SimpleStyleRules>(ruleId: string, rulesFnc: (vars: object) => T, overrides?: Partial<{
34
- flush: boolean;
35
- insertAfter?: HTMLElement;
36
- insertBefore?: HTMLElement;
37
- registry?: SimpleStyleRegistry;
38
- }> | undefined) => string;
39
- };
@@ -1,16 +0,0 @@
1
- import { makeCssFuncs as _makeCssFuncs } from '../makeStyles.mjs';
2
- import { makeSimpleStyleProvider } from '../SimpleStyleProvider.mjs';
3
- import { SimpleStyleRegistry } from '../simpleStyleRegistry.mjs';
4
- export const makeCssFuncs = (...args)=>{
5
- const [opts, ...rest] = args;
6
- const { registry: providedRegistry } = opts;
7
- const registry = providedRegistry ?? new SimpleStyleRegistry();
8
- const funcs = _makeCssFuncs({
9
- ...opts,
10
- registry
11
- }, ...rest);
12
- return {
13
- ...funcs,
14
- SimpleStyleProvider: makeSimpleStyleProvider(registry)
15
- };
16
- };