simplestyle-js 5.4.4-beta.1 → 5.4.4-beta.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.
@@ -10,18 +10,11 @@ Object.defineProperty(exports, "ClientBoundary", {
10
10
  }
11
11
  });
12
12
  const _jsxruntime = require("react/jsx-runtime");
13
- const _react = require("react");
14
- const _IHateNextJsContext = require("./IHateNextJsContext.cjs");
15
- function ClientBoundary({ children }) {
16
- const ctx = (0, _react.use)(_IHateNextJsContext.IHateNextJSContext);
17
- if (!ctx) return null;
18
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
19
- children: [
20
- ctx.registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
21
- id: ruleId,
22
- children: css
23
- }, ruleId)),
24
- children
25
- ]
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))
26
19
  });
27
20
  }
@@ -1,2 +1,4 @@
1
- import { type PropsWithChildren } from 'react';
2
- export declare function ClientBoundary({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
1
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
2
+ export declare function ClientBoundary({ rules, }: {
3
+ rules: ReturnType<SimpleStyleRegistry['getRulesById']>;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -10,12 +10,13 @@ Object.defineProperty(exports, "SimpleStyleProvider", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _ClientBoundary = require("./ClientBoundary.cjs");
13
- const _IHateNextJsContext = require("./IHateNextJsContext.cjs");
14
- function SimpleStyleProvider({ children, ...rest }) {
15
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_IHateNextJsContext.IHateNextJSContext, {
16
- value: rest,
17
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ClientBoundary.ClientBoundary, {
18
- children: children
19
- })
13
+ function SimpleStyleProvider({ children, registry }) {
14
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
15
+ children: [
16
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_ClientBoundary.ClientBoundary, {
17
+ rules: registry.getRulesById()
18
+ }),
19
+ children
20
+ ]
20
21
  });
21
22
  }
@@ -1,9 +1,11 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- import { type IHateNextJSProps } from './IHateNextJsContext.js';
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
3
  /**
4
4
  * Accumulates all CSS rules and writes
5
5
  * them to your layout.
6
6
  * Use this for Next.js or other Next.js-like frameworks
7
7
  * that leverage React server components
8
8
  */
9
- export declare function SimpleStyleProvider({ children, ...rest }: PropsWithChildren & IHateNextJSProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SimpleStyleProvider({ children, registry, }: PropsWithChildren & {
10
+ registry: SimpleStyleRegistry;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,4 @@
1
- import { type PropsWithChildren } from 'react';
2
- export declare function ClientBoundary({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
1
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
2
+ export declare function ClientBoundary({ rules, }: {
3
+ rules: ReturnType<SimpleStyleRegistry['getRulesById']>;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,10 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- // this client boundary is required to allow
4
- // Next.js to collect the styles on the server
5
- // but allow flushing them to the DOM at runtime
6
- import { use } from 'react';
7
- import { IHateNextJSContext } from './IHateNextJsContext.mjs';
8
- export function ClientBoundary({ children }) {
9
- const ctx = use(IHateNextJSContext);
10
- if (!ctx) return null;
11
- return /*#__PURE__*/ _jsxs(_Fragment, {
12
- children: [
13
- ctx.registry.getRulesById().map(([ruleId, css])=>/*#__PURE__*/ _jsx("style", {
14
- id: ruleId,
15
- children: css
16
- }, ruleId)),
17
- children
18
- ]
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))
19
9
  });
20
10
  }
@@ -1,9 +1,11 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- import { type IHateNextJSProps } from './IHateNextJsContext.js';
2
+ import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
3
3
  /**
4
4
  * Accumulates all CSS rules and writes
5
5
  * them to your layout.
6
6
  * Use this for Next.js or other Next.js-like frameworks
7
7
  * that leverage React server components
8
8
  */
9
- export declare function SimpleStyleProvider({ children, ...rest }: PropsWithChildren & IHateNextJSProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SimpleStyleProvider({ children, registry, }: PropsWithChildren & {
10
+ registry: SimpleStyleRegistry;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { ClientBoundary } from './ClientBoundary.mjs';
3
- import { IHateNextJSContext } from './IHateNextJsContext.mjs';
4
3
  /**
5
4
  * Accumulates all CSS rules and writes
6
5
  * them to your layout.
7
6
  * Use this for Next.js or other Next.js-like frameworks
8
7
  * that leverage React server components
9
- */ export function SimpleStyleProvider({ children, ...rest }) {
10
- return /*#__PURE__*/ _jsx(IHateNextJSContext, {
11
- value: rest,
12
- children: /*#__PURE__*/ _jsx(ClientBoundary, {
13
- children: children
14
- })
8
+ */ export function SimpleStyleProvider({ children, registry }) {
9
+ return /*#__PURE__*/ _jsxs(_Fragment, {
10
+ children: [
11
+ /*#__PURE__*/ _jsx(ClientBoundary, {
12
+ rules: registry.getRulesById()
13
+ }),
14
+ children
15
+ ]
15
16
  });
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplestyle-js",
3
- "version": "5.4.4-beta.1",
3
+ "version": "5.4.4-beta.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": {
@@ -120,16 +120,6 @@
120
120
  "default": "./dist/esm/next/ClientBoundary.mjs"
121
121
  }
122
122
  },
123
- "./next/IHateNextJsContext": {
124
- "require": {
125
- "types": "./dist/cjs/next/IHateNextJsContext.d.ts",
126
- "default": "./dist/cjs/next/IHateNextJsContext.cjs"
127
- },
128
- "import": {
129
- "types": "./dist/esm/next/IHateNextJsContext.d.ts",
130
- "default": "./dist/esm/next/IHateNextJsContext.mjs"
131
- }
132
- },
133
123
  "./next/SimpleStyleProvider": {
134
124
  "require": {
135
125
  "types": "./dist/cjs/next/SimpleStyleProvider.d.ts",
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "IHateNextJSContext", {
6
- enumerable: true,
7
- get: function() {
8
- return IHateNextJSContext;
9
- }
10
- });
11
- const _react = require("react");
12
- const IHateNextJSContext = /*#__PURE__*/ (0, _react.createContext)(null);
@@ -1,5 +0,0 @@
1
- import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
2
- export type IHateNextJSProps = {
3
- registry: SimpleStyleRegistry;
4
- };
5
- export declare const IHateNextJSContext: import("react").Context<IHateNextJSProps | null>;
@@ -1,5 +0,0 @@
1
- import type { SimpleStyleRegistry } from '../simpleStyleRegistry.js';
2
- export type IHateNextJSProps = {
3
- registry: SimpleStyleRegistry;
4
- };
5
- export declare const IHateNextJSContext: import("react").Context<IHateNextJSProps | null>;
@@ -1,2 +0,0 @@
1
- import { createContext } from 'react';
2
- export const IHateNextJSContext = /*#__PURE__*/ createContext(null);