next-yak 9.4.0 → 9.4.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.
Files changed (99) hide show
  1. package/README.md +57 -288
  2. package/dist/context/baseContext.cjs +6 -29
  3. package/dist/context/baseContext.cjs.map +1 -1
  4. package/dist/context/baseContext.d.cts +4 -2
  5. package/dist/context/baseContext.d.ts +4 -2
  6. package/dist/context/baseContext.js +5 -5
  7. package/dist/context/baseContext.js.map +1 -1
  8. package/dist/context/index.cjs +33 -41
  9. package/dist/context/index.cjs.map +1 -1
  10. package/dist/context/index.d.cts +12 -8
  11. package/dist/context/index.d.ts +12 -8
  12. package/dist/context/index.js +10 -13
  13. package/dist/context/index.js.map +1 -1
  14. package/dist/context/index.server.cjs +35 -41
  15. package/dist/context/index.server.cjs.map +1 -1
  16. package/dist/context/index.server.d.cts +13 -0
  17. package/dist/context/index.server.d.ts +13 -0
  18. package/dist/context/index.server.js +12 -14
  19. package/dist/context/index.server.js.map +1 -1
  20. package/dist/index.cjs +1 -4
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +52 -46
  23. package/dist/index.d.ts +52 -46
  24. package/dist/index.js +1 -4
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal.cjs +464 -697
  27. package/dist/internal.cjs.map +1 -1
  28. package/dist/internal.d.cts +368 -0
  29. package/dist/internal.d.ts +368 -0
  30. package/dist/internal.js +297 -532
  31. package/dist/internal.js.map +1 -1
  32. package/dist/isolated-source-eval/index.d.ts +22 -20
  33. package/dist/isolated-source-eval/index.js +284 -298
  34. package/dist/isolated-source-eval/index.js.map +1 -1
  35. package/dist/isolated-source-eval/worker.js +53 -57
  36. package/dist/isolated-source-eval/worker.js.map +1 -1
  37. package/dist/jsx-dev-runtime.cjs +1 -1
  38. package/dist/jsx-dev-runtime.cjs.map +1 -1
  39. package/dist/jsx-dev-runtime.d.cts +9 -0
  40. package/dist/jsx-dev-runtime.d.ts +9 -0
  41. package/dist/jsx-dev-runtime.js +1 -1
  42. package/dist/jsx-dev-runtime.js.map +1 -1
  43. package/dist/jsx-runtime.cjs +1 -1
  44. package/dist/jsx-runtime.cjs.map +1 -1
  45. package/dist/jsx-runtime.d.cts +25 -24
  46. package/dist/jsx-runtime.d.ts +25 -24
  47. package/dist/jsx-runtime.js +1 -1
  48. package/dist/jsx-runtime.js.map +1 -1
  49. package/dist/loaders/turbo-loader.cjs +695 -983
  50. package/dist/loaders/turbo-loader.cjs.map +1 -1
  51. package/dist/loaders/turbo-loader.d.cts +7 -6
  52. package/dist/loaders/vite-plugin.d.ts +15 -13
  53. package/dist/loaders/vite-plugin.js +736 -1060
  54. package/dist/loaders/vite-plugin.js.map +1 -1
  55. package/dist/loaders/webpack-loader.cjs +629 -916
  56. package/dist/loaders/webpack-loader.cjs.map +1 -1
  57. package/dist/loaders/webpack-loader.d.cts +5 -4
  58. package/dist/static/chunk-WfQuXRBF.js +1 -0
  59. package/dist/static/index.cjs +1 -1
  60. package/dist/static/index.cjs.map +1 -1
  61. package/dist/static/index.d.cts +6 -7
  62. package/dist/static/index.d.ts +6 -7
  63. package/dist/static/index.js +1 -1
  64. package/dist/static/index.js.map +1 -1
  65. package/dist/withYak/index.cjs +135 -161
  66. package/dist/withYak/index.cjs.map +1 -1
  67. package/dist/withYak/index.d.cts +42 -40
  68. package/dist/withYak/index.d.ts +42 -40
  69. package/dist/withYak/index.js +114 -133
  70. package/dist/withYak/index.js.map +1 -1
  71. package/loaders/lib/__tests__/debugLogger.test.ts +11 -43
  72. package/loaders/lib/debugLogger.ts +6 -12
  73. package/loaders/lib/extractCss.ts +2 -6
  74. package/loaders/lib/resolveCrossFileSelectors.ts +105 -89
  75. package/loaders/turbo-evaluator.ts +7 -14
  76. package/loaders/turbo-loader.ts +5 -22
  77. package/loaders/vite-plugin.ts +19 -55
  78. package/loaders/webpack-loader.ts +1 -3
  79. package/package.json +131 -71
  80. package/runtime/__tests__/attrs.test.tsx +9 -16
  81. package/runtime/__tests__/cssLiteral.test.tsx +21 -45
  82. package/runtime/__tests__/cssProp.test.tsx +8 -17
  83. package/runtime/__tests__/cssPropTest.tsx +10 -13
  84. package/runtime/__tests__/styled.test.tsx +4 -13
  85. package/runtime/__tests__/tsconfig.json +1 -0
  86. package/runtime/__tests__/typeTest.tsx +7 -15
  87. package/runtime/atoms.tsx +1 -1
  88. package/runtime/context/README.md +11 -16
  89. package/runtime/context/index.server.tsx +2 -9
  90. package/runtime/cssLiteral.tsx +4 -13
  91. package/runtime/index.ts +1 -1
  92. package/runtime/internals/mergeCssProp.ts +1 -3
  93. package/runtime/jsx-runtime.ts +1 -2
  94. package/runtime/keyframes.tsx +1 -1
  95. package/runtime/mocks/cssLiteral.ts +3 -11
  96. package/runtime/mocks/keyframes.ts +1 -1
  97. package/runtime/publicStyledApi.ts +3 -13
  98. package/runtime/styled.tsx +19 -31
  99. package/withYak/index.ts +11 -19
package/README.md CHANGED
@@ -5,328 +5,97 @@
5
5
  [![npm version](https://badge.fury.io/js/next-yak.svg)](https://www.npmjs.com/package/next-yak)
6
6
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/DigitecGalaxus/next-yak/blob/main/LICENSE)
7
7
 
8
- **next-yak** is a CSS-in-JS solution tailored for [Next.js](https://nextjs.org/) that seamlessly combines the expressive power of styled-components syntax with efficient build-time extraction of CSS using Next.js's built-in CSS configuration.
8
+ **next-yak** is a build-time CSS-in-JS library powered by a Rust SWC plugin. Write styled-components syntax, get zero-runtime CSS extraction and full React Server Components compatibility.
9
9
 
10
+ Works with **Next.js** (Webpack & Turbopack), **Vite** (7+, including Vite 8 with OXC), and **Storybook**. Any Vite-based framework works out of the box, including react-router, TanStack Start, and more.
11
+
12
+ > **Production-proven:** next-yak is sponsored and used in production by [Digitec Galaxus](https://www.galaxus.ch), the largest e-commerce platform in Switzerland, across thousands of styled components, delivering measurable improvements in Core Web Vitals.
10
13
 
11
14
  ## Features
12
15
 
13
- - **NextJs Compatibility**: Works smoothly with both React Server and Client Components
14
- - **Build-time CSS**: Reduces load time by handling CSS during the build phase, using Next.js built-in CSS Modules features
15
- - **Lightweight Runtime**: Operates with minimal impact, simply changing CSS classes without modifying the CSSOM
16
- - **Standard CSS Syntax**: Write styles in familiar, easy-to-use CSS
17
- - **Integrates with Atomic CSS**: Easily combines with atomic CSS frameworks like Tailwind CSS for more design options
16
+ - **Multi-Framework**: First-class support for Next.js (Webpack & Turbopack), Vite 7+ (react-router, TanStack Start, ...), and Storybook
17
+ - **Build-Time CSS**: Extracts CSS at compile time with zero runtime overhead
18
+ - **React Server Components**: Works seamlessly with both Server and Client Components
19
+ - **Cross-File Imports**: Import constants, mixins, and selectors from `.yak` files and other modules, works across all bundlers
20
+ - **Standard CSS Syntax**: Write familiar CSS with full nesting, keyframes, and media query support
21
+ - **Integrates with Atomic CSS**: Combines with utility-first frameworks like Tailwind CSS
22
+ - **TypeScript First**: Fully typed props, theme context, and cross-file selectors
23
+ - **Lightweight Runtime**: Minimal footprint, just swaps CSS class names based on props
24
+ - **Minimal Dependencies**: Only 8 dependencies in total (including transitive ones)
25
+
26
+ ## Documentation
27
+
28
+ Full documentation, guides, and a live playground are available at **[yak.js.org](https://yak.js.org/)**.
18
29
 
19
- [Preview (Video)](https://github.com/DigitecGalaxus/next-yak/assets/4113649/f5a220fc-2a0f-46be-a8e7-c855f7faa337
20
- )
30
+ - [Getting Started (Next.js)](https://yak.js.org/docs/getting-started)
31
+ - [Vite Setup](https://yak.js.org/docs/vite)
32
+ - [Storybook Setup](https://yak.js.org/docs/storybook)
33
+ - [Migration from styled-components](https://yak.js.org/docs/migration-from-styled-components)
34
+ - [Features](https://yak.js.org/docs/features)
35
+ - [Playground](https://yak.js.org/playground)
21
36
 
22
37
  ## Compatibility
23
38
 
24
- | next-yak | Next.js | react | swc_core |
25
- |------------------|-----------------|------------------|------------------|
26
- | 9.x | >= 16.1.0 | 19.x | 50.2.3 |
27
- | 8.x | >= 16.0.0 | 19.x | 45.0.1 |
28
- | 7.x | >= 15.4.4 | 19.x | 38.0.1 |
29
- | 6.x | >= 15.4.1 | 19.x | 27.0.6 |
30
- | 5.x | >= 15.2.1 | 19.x | 16.0.0 |
31
- | 4.x | >= 15.0.4 | 19.x | 5.0.1 |
32
- | 3.x | 15.x | 18.x / 19.x | 3.0.2 |
33
- | 2.x | 14.x | 18.x / 19.x | 0.279.0 |
39
+ | next-yak | Next.js | Vite | react | swc_core |
40
+ | -------- | --------- | --------------- | ----------- | -------- |
41
+ | 9.x | >= 16.1.0 | >= 7.0.0 (9.1+) | 19.x | 56.0.0 |
42
+ | 8.x | >= 16.0.0 | - | 19.x | 45.0.1 |
43
+ | 7.x | >= 15.4.4 | - | 19.x | 38.0.1 |
44
+ | 6.x | >= 15.4.1 | - | 19.x | 27.0.6 |
45
+ | 5.x | >= 15.2.1 | - | 19.x | 16.0.0 |
46
+ | 4.x | >= 15.0.4 | - | 19.x | 5.0.1 |
47
+ | 3.x | 15.x | - | 18.x / 19.x | 3.0.2 |
48
+ | 2.x | 14.x | - | 18.x / 19.x | 0.279.0 |
34
49
 
35
50
  ## Installation
36
51
 
37
52
  ```bash
38
- # For Next.js >= 15.2.1
39
53
  npm install next-yak
40
-
41
- # For Next.js 14.x
42
- npm install next-yak@2
43
54
  ```
44
55
 
45
- ## Getting Started
46
-
47
- See a live [stackblitz demo](https://stackblitz.com/edit/stackblitz-starters-dfykqy?file=app%2Fpage.tsx) or try our **[stackblitz starter kit](https://stackblitz.com/fork/next-yak-starter?file=app%2Fpage.tsx)**
48
-
49
- ### Locally
56
+ ## Quick Start
50
57
 
51
- 1. Install **next-yak** in your Next.js project.
52
-
53
- 2. Add next-yak to your `next.config.mjs`:
58
+ ### Next.js
54
59
 
55
60
  ```js
56
- // next.config.js
61
+ // next.config.ts
57
62
  import { withYak } from "next-yak/withYak";
58
63
 
59
- const nextConfig = {
64
+ export default withYak({
60
65
  // your next.js config
61
- };
62
-
63
- export default withYak(nextConfig);
64
- ```
65
-
66
- 3. Ready to go:
67
-
68
- ```jsx
69
- // pages/index.js
70
- import { styled } from 'next-yak';
71
-
72
- const StyledDiv = styled.div`
73
- color: #333;
74
- padding: 16px;
75
- background-color: #f0f0f0;
76
- `;
77
-
78
- function HomePage() {
79
- return <StyledDiv>Hello, next-yak!</StyledDiv>;
80
- }
81
-
82
- export default HomePage;
83
- ```
84
-
85
- ## More Examples
86
-
87
- ### Dynamic Styles
88
-
89
- Dynamic Styles will only toggle the css class during runtime:
90
-
91
- ```jsx
92
- import { styled, css } from 'next-yak';
93
-
94
- const ToggleButton = styled.button`
95
- ${props => props.$active
96
- ? css`background-color: green`
97
- : css`background-color: lime`
98
- };
99
- color: white;
100
- padding: 10px 20px;
101
- `;
102
- ```
103
-
104
- [Dynamic Styles (Video)](https://github.com/DigitecGalaxus/next-yak/assets/4113649/c5f52846-33e4-4058-9c78-efd98197d75f)
105
-
106
- ### Dynamic Properties
107
-
108
- Dynamic Properties use custom properties ([aka css variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)) under the hood to extract the CSS at built time but modify properties at runtime:
109
-
110
- ```jsx
111
- import { styled } from 'next-yak';
112
-
113
- const ProgressBar = styled.div`
114
- width: ${props => `${props.$percent}%`};
115
- height: 20px;
116
- background-color: #3498db;
117
- transition: width 0.3s ease-in-out;
118
- `;
119
-
120
- const ProgressBarContainer = styled.div`
121
- border: 1px solid #ccc;
122
- `;
123
-
124
- const ExampleComponent = () => {
125
- const progress = 75; // You can dynamically set this value
126
-
127
- return (
128
- <ProgressBarContainer>
129
- <ProgressBar $percent={progress} />
130
- </ProgressBarContainer>
131
- );
132
- };
133
- ```
134
-
135
- [Dynamic Props (video)](https://github.com/DigitecGalaxus/next-yak/assets/4113649/2fa78f82-382c-465f-b294-2504739ea168)
136
-
137
-
138
- ### Targeting Components
139
-
140
- In next-yak, you can target other components directly using CSS selectors as long as they are **in the same file**:
141
-
142
- ```jsx
143
- import { styled, keyframes } from 'next-yak';
144
-
145
- const flip = keyframes`
146
- from { transform: rotateY(0deg); }
147
- to { transform: rotateY(360deg); }
148
- `;
149
-
150
- const Glow = styled.div`
151
- /* Add your Glow component styles here */
152
- `;
153
-
154
- const Text = styled.span`
155
- display: inline-block;
156
- ${Glow}:hover & {
157
- animation: 1.5s ${flip} ease-out;
158
- }
159
- `;
160
-
161
- const ExampleComponent = () => {
162
- return (
163
- <Glow>
164
- <Text>This text will flip on hover.</Text>
165
- </Glow>
166
- );
167
- };
66
+ });
168
67
  ```
169
68
 
170
- ## Nesting
171
-
172
- `next-yak` supports nesting out of the box.
173
- [For now](https://github.com/css-modules/postcss-modules-local-by-default/pull/64) Next.js 13 supports nesting only with the `postcss-nested` plugin.
174
- Therefore you have to create a `postcss.config.js` file in your project root:
69
+ ### Vite
175
70
 
176
71
  ```js
177
- // postcss.config.js
178
- module.exports = {
179
- plugins: {
180
- 'postcss-nested': {},
181
- }
182
- };
183
- ```
184
-
185
- [Nesting Example (video)](https://github.com/DigitecGalaxus/next-yak/assets/4113649/33eeeb13-b0cf-499f-a1d3-ba6f51cf4308)
186
-
187
- ## Motivation
188
-
189
- Most of the existing CSS-in-JS libraries are either slow or have a complex api. This project tries to find a middle ground between speed and api complexity.
190
-
191
- The goal of this project is to create a proof of concept for a CSS-in-JS library that has the following properties:
192
-
193
- - fast
194
- - no runtime
195
- - can be statically extracted
196
- - can be optimized by postcss
197
- - no processing during hydration
198
- - can make use of [103 early hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103)
199
- - api
200
- - ui colocation (mixing css and jsx)
201
- - familiar `styled.div` api
202
- - composable `styled(Component)`
203
- - allows conditional styles
204
- - allow to use props in styles
205
- - allow to use a context based theme in styles
206
- - typescript support
207
-
208
- Optimizations are done by postcss. This allows to use the full power of postcss and its plugins. It also allows to use the same optimizations for css files and css-in-js.
209
-
210
- ## Performance Gains
211
-
212
- [![CSS Extract](https://raw.githubusercontent.com/DigitecGalaxus/next-yak/main/css-extract.gif)](https://raw.githubusercontent.com/DigitecGalaxus/next-yak/main/css-extract.gif)
213
-
214
- ## How it works
215
-
216
- next-yak converts css-in-js into css modules. This allows to use the full power of postcss and its plugins. It also allows to use the same optimizations for css files and css-in-js.
217
-
218
- [![Compile Flow](https://raw.githubusercontent.com/DigitecGalaxus/next-yak/main/compile-flow.webp)](https://raw.githubusercontent.com/DigitecGalaxus/next-yak/main/compile-flow.webp)
219
-
220
-
221
- ## Atomic CSS
222
-
223
- `next-yak` ships with atomic css support
224
- So you can use [tailwind](https://tailwindcss.com/) out of the box without additional configuration.
225
-
226
- ```tsx
227
- import { styled, atoms } from "next-yak";
228
-
229
- // Mixing tailwind with custom styles
230
- const Icon = styled.p`
231
- ${atoms("font-bold")}
232
- @supports (initial-letter: 2) {
233
- initial-letter: 2;
234
- }
235
- `;
236
-
237
- // Apply tailwind classes conditionally
238
- const Button = styled.button`
239
- ${({ $primary }) =>
240
- $primary
241
- ? atoms(
242
- 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded'
243
- )
244
- : atoms(
245
- 'bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded'
246
- )}
247
- `;
72
+ // vite.config.ts
73
+ import { defineConfig } from "vite";
74
+ import react from "@vitejs/plugin-react-swc";
75
+ import { viteYak } from "next-yak/vite";
76
+
77
+ export default defineConfig({
78
+ plugins: [viteYak(), react()],
79
+ });
248
80
  ```
249
81
 
250
-
251
- ## Build Time Constants
252
-
253
- The downside of dynamic properties is that they require inline style attributes.
254
- While this is not a problem for most cases, we can't use them for media queries.
255
-
256
- `next-yak` allows you to define build time constants which can be used in your styles:
82
+ ### Usage
257
83
 
258
84
  ```jsx
259
- import { styled } from 'next-yak';
260
- import { breakpoints, spacings } from './constants.yak';
85
+ import { styled } from "next-yak";
261
86
 
262
- const Container = styled.div`
263
- padding: ${spacings.md};
264
- ${breakpoints.md} {
265
- padding: ${spacings.lg};
266
- }
87
+ const Button = styled.button`
88
+ background: #bf4f74;
89
+ color: white;
90
+ padding: 0.5rem 1rem;
91
+ border-radius: 4px;
267
92
  `;
268
93
  ```
269
94
 
270
- | Feature | Code | Yak Constant files |
271
- |:-----------------|:------------------------------------------------|:-----------------------------------------------|
272
- | File Extension | `.js`, `.jsx`, `.tsx`, etc. | `.yak.js`, `.yak.jsx`, `.yak.tsx`, etc. |
273
- | Runs at | Runtime (Node or Browser) | Compile time (Bundler) |
274
- | Side effects | ✅ | 🚫 |
275
- | Yak Features | All (`styled`, `css`, ...) | 🚫 |
276
-
277
-
278
- [Build time constants (video)](https://github.com/DigitecGalaxus/next-yak/assets/4113649/2c83246c-a03b-4c57-8814-32a7248983ac)
279
-
280
- ## Yak shaving
281
-
282
- While trying to get next-yak to work properly we stumbled across several bugs.
283
- Thanks for merging our prs fixes in next.js, webpack, postcss and qwik ❤️
284
-
285
- <details>
286
- <summary>PRS</summary>
287
-
288
- - https://github.com/vercel/next.js/pull/51115
289
- - https://github.com/vercel/next.js/pull/53796
290
- - https://github.com/css-modules/postcss-modules-local-by-default/pull/64
291
- - https://github.com/css-modules/postcss-modules-local-by-default/pull/72
292
- - https://github.com/vercel/next.js/pull/62644
293
- - https://github.com/vercel/next.js/pull/62639
294
- - https://github.com/webpack-contrib/mini-css-extract-plugin/pull/1084
295
- - https://github.com/vercel/next.js/pull/62733
296
- - https://github.com/vercel/next.js/pull/64551
297
- - https://github.com/QwikDev/qwik/pull/8351
298
- - https://github.com/vercel/next.js/pull/89600
299
- - https://github.com/vercel/next.js/pull/89901
300
-
301
- </details>
302
-
303
- <details>
304
- <summary>Experiments</summary>
305
- Incomplete work in progress experiments to test the features and performance of next-yak:
306
-
307
- - https://next-yak-benchmark.vercel.app/
308
- - https://yacijs.vercel.app/
309
- </details>
310
-
311
- ## Acknowledgments
312
-
313
- Massive kudos to:
314
-
315
- - @sokra: For guiding us through webpacks module and loader APIs
316
- - @kdy1: For his support while rewriting our Babel plugin as a blazing fast SWC Rust WASM plugin
317
-
318
- Special thanks to the contributors and the inspiring projects that influenced next-yak:
319
-
320
- - Styled-Components 💅: For pioneering the styled syntax and redefining styling in the React ecosystem.
321
- - Linaria: For its innovative approach to zero-runtime CSS in JS and efficient styling solutions.
322
- - Emotion: For pushing the boundaries of CSS-in-JS and providing a high-performance styling experience.
323
- - Vanilla Extract: For its focus on type-safe, zero-runtime CSS and contributing to the evolution of styling techniques.
324
- - Tailwind CSS: For its exceptional atomic CSS approach, enabling efficient and customizable styling solutions.
325
-
326
95
  ## License
327
96
 
328
- **next-yak** is licensed under the [MIT License](link/to/LICENSE).
97
+ **next-yak** is licensed under the [MIT License](https://github.com/DigitecGalaxus/next-yak/blob/main/LICENSE).
329
98
 
330
- ---
99
+ ## Contributing
331
100
 
332
- Feel free to reach out with any questions, issues, or suggestions!
101
+ Contributions are welcome! The [contributing guide](https://github.com/DigitecGalaxus/next-yak/blob/main/CONTRIBUTION.md) helps you get started.
@@ -1,33 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
19
2
 
20
- // runtime/context/baseContext.tsx
21
- var baseContext_exports = {};
22
- __export(baseContext_exports, {
23
- getYakThemeContext: () => getYakThemeContext
24
- });
25
- module.exports = __toCommonJS(baseContext_exports);
3
+ //#region runtime/context/baseContext.tsx
26
4
  function getYakThemeContext() {
27
- return {};
5
+ return {};
28
6
  }
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- getYakThemeContext
32
- });
7
+
8
+ //#endregion
9
+ exports.getYakThemeContext = getYakThemeContext;
33
10
  //# sourceMappingURL=baseContext.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../runtime/context/baseContext.tsx"],"sourcesContent":["import type { YakTheme } from \"next-yak\";\n\nexport function getYakThemeContext() {\n return {} as YakTheme | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,qBAAqB;AACnC,SAAO,CAAC;AACV;","names":[]}
1
+ {"version":3,"file":"baseContext.cjs","names":[],"sources":["../../runtime/context/baseContext.tsx"],"sourcesContent":["import type { YakTheme } from \"next-yak\";\n\nexport function getYakThemeContext() {\n return {} as YakTheme | undefined;\n}\n"],"mappings":";;;AAEA,SAAgB,qBAAqB;AACnC,QAAO,EAAE"}
@@ -1,5 +1,7 @@
1
- import { YakTheme } from 'next-yak';
1
+ import { YakTheme } from "next-yak";
2
2
 
3
+ //#region runtime/context/baseContext.d.ts
3
4
  declare function getYakThemeContext(): YakTheme | undefined;
4
-
5
+ //#endregion
5
6
  export { getYakThemeContext };
7
+ //# sourceMappingURL=baseContext.d.cts.map
@@ -1,5 +1,7 @@
1
- import { YakTheme } from 'next-yak';
1
+ import { YakTheme } from "next-yak";
2
2
 
3
+ //#region runtime/context/baseContext.d.ts
3
4
  declare function getYakThemeContext(): YakTheme | undefined;
4
-
5
+ //#endregion
5
6
  export { getYakThemeContext };
7
+ //# sourceMappingURL=baseContext.d.ts.map
@@ -1,8 +1,8 @@
1
- // runtime/context/baseContext.tsx
1
+ //#region runtime/context/baseContext.tsx
2
2
  function getYakThemeContext() {
3
- return {};
3
+ return {};
4
4
  }
5
- export {
6
- getYakThemeContext
7
- };
5
+
6
+ //#endregion
7
+ export { getYakThemeContext };
8
8
  //# sourceMappingURL=baseContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../runtime/context/baseContext.tsx"],"sourcesContent":["import type { YakTheme } from \"next-yak\";\n\nexport function getYakThemeContext() {\n return {} as YakTheme | undefined;\n}\n"],"mappings":";AAEO,SAAS,qBAAqB;AACnC,SAAO,CAAC;AACV;","names":[]}
1
+ {"version":3,"file":"baseContext.js","names":[],"sources":["../../runtime/context/baseContext.tsx"],"sourcesContent":["import type { YakTheme } from \"next-yak\";\n\nexport function getYakThemeContext() {\n return {} as YakTheme | undefined;\n}\n"],"mappings":";AAEA,SAAgB,qBAAqB;AACnC,QAAO,EAAE"}
@@ -1,53 +1,45 @@
1
- "use strict";
2
1
  "use client";
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ //#region \0rolldown/runtime.js
3
5
  var __create = Object.create;
4
6
  var __defProp = Object.defineProperty;
5
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
8
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
9
  var __getProtoOf = Object.getPrototypeOf;
8
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
11
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ }
22
+ }
23
+ return to;
20
24
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
30
29
 
31
- // runtime/context/index.tsx
32
- var index_exports = {};
33
- __export(index_exports, {
34
- YakThemeProvider: () => YakThemeProvider,
35
- useTheme: () => useTheme
36
- });
37
- module.exports = __toCommonJS(index_exports);
38
- var import_react = __toESM(require("react"), 1);
39
- var YakContext = (0, import_react.createContext)({});
40
- var useTheme = () => {
41
- const context = (0, import_react.use)(YakContext);
42
- return context instanceof Promise ? (0, import_react.use)(context) : context;
30
+ //#endregion
31
+ let react = require("react");
32
+ react = __toESM(react);
33
+
34
+ //#region runtime/context/index.tsx
35
+ const YakContext = (0, react.createContext)({});
36
+ const useTheme = () => {
37
+ const context = (0, react.use)(YakContext);
38
+ return context instanceof Promise ? (0, react.use)(context) : context;
43
39
  };
44
- var YakThemeProvider = ({
45
- children,
46
- theme = {}
47
- }) => /* @__PURE__ */ import_react.default.createElement(YakContext.Provider, { value: theme }, children);
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- YakThemeProvider,
51
- useTheme
52
- });
40
+ const YakThemeProvider = ({ children, theme = {} }) => /* @__PURE__ */ react.default.createElement(YakContext.Provider, { value: theme }, children);
41
+
42
+ //#endregion
43
+ exports.YakThemeProvider = YakThemeProvider;
44
+ exports.useTheme = useTheme;
53
45
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../runtime/context/index.tsx"],"sourcesContent":["\"use client\";\n//\n// This file is the client component (browser & ssr) version of index.server.tsx\n//\nimport React, { ReactNode, createContext, use } from \"react\";\n\nexport interface YakTheme {}\n\n/**\n * The yak theme context\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nconst YakContext = createContext<YakTheme>({});\n\n/**\n * Returns the current yak theme context\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const useTheme = (): YakTheme => {\n const context = use(YakContext);\n return context instanceof Promise ? use(context) : context;\n};\n\n/**\n * Yak theme context provider\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const YakThemeProvider = ({\n children,\n theme = {},\n}: {\n children: ReactNode;\n theme?: YakTheme;\n}) => <YakContext.Provider value={theme}>{children}</YakContext.Provider>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAAqD;AAQrD,IAAM,iBAAa,4BAAwB,CAAC,CAAC;AAOtC,IAAM,WAAW,MAAgB;AACtC,QAAM,cAAU,kBAAI,UAAU;AAC9B,SAAO,mBAAmB,cAAU,kBAAI,OAAO,IAAI;AACrD;AAOO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,QAAQ,CAAC;AACX,MAGM,6BAAAA,QAAA,cAAC,WAAW,UAAX,EAAoB,OAAO,SAAQ,QAAS;","names":["React"]}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../runtime/context/index.tsx"],"sourcesContent":["\"use client\";\n//\n// This file is the client component (browser & ssr) version of index.server.tsx\n//\nimport React, { ReactNode, createContext, use } from \"react\";\n\nexport interface YakTheme {}\n\n/**\n * The yak theme context\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nconst YakContext = createContext<YakTheme>({});\n\n/**\n * Returns the current yak theme context\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const useTheme = (): YakTheme => {\n const context = use(YakContext);\n return context instanceof Promise ? use(context) : context;\n};\n\n/**\n * Yak theme context provider\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const YakThemeProvider = ({\n children,\n theme = {},\n}: {\n children: ReactNode;\n theme?: YakTheme;\n}) => <YakContext.Provider value={theme}>{children}</YakContext.Provider>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,sCAAqC,EAAE,CAAC;AAO9C,MAAa,iBAA2B;CACtC,MAAM,yBAAc,WAAW;AAC/B,QAAO,mBAAmB,yBAAc,QAAQ,GAAG;;AAQrD,MAAa,oBAAoB,EAC/B,UACA,QAAQ,EAAE,OAIN,4CAAC,WAAW,UAAZ,EAAqB,OAAO,OAAuC,EAA/B,SAA+B"}
@@ -1,7 +1,7 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
 
3
- interface YakTheme {
4
- }
3
+ //#region runtime/context/index.d.ts
4
+ interface YakTheme {}
5
5
  /**
6
6
  * Returns the current yak theme context
7
7
  *
@@ -13,9 +13,13 @@ declare const useTheme: () => YakTheme;
13
13
  *
14
14
  * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md
15
15
  */
16
- declare const YakThemeProvider: ({ children, theme, }: {
17
- children: ReactNode;
18
- theme?: YakTheme;
16
+ declare const YakThemeProvider: ({
17
+ children,
18
+ theme
19
+ }: {
20
+ children: ReactNode;
21
+ theme?: YakTheme;
19
22
  }) => React.JSX.Element;
20
-
21
- export { type YakTheme, YakThemeProvider, useTheme };
23
+ //#endregion
24
+ export { YakTheme, YakThemeProvider, useTheme };
25
+ //# sourceMappingURL=index.d.cts.map
@@ -1,7 +1,7 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
 
3
- interface YakTheme {
4
- }
3
+ //#region runtime/context/index.d.ts
4
+ interface YakTheme {}
5
5
  /**
6
6
  * Returns the current yak theme context
7
7
  *
@@ -13,9 +13,13 @@ declare const useTheme: () => YakTheme;
13
13
  *
14
14
  * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md
15
15
  */
16
- declare const YakThemeProvider: ({ children, theme, }: {
17
- children: ReactNode;
18
- theme?: YakTheme;
16
+ declare const YakThemeProvider: ({
17
+ children,
18
+ theme
19
+ }: {
20
+ children: ReactNode;
21
+ theme?: YakTheme;
19
22
  }) => React.JSX.Element;
20
-
21
- export { type YakTheme, YakThemeProvider, useTheme };
23
+ //#endregion
24
+ export { YakTheme, YakThemeProvider, useTheme };
25
+ //# sourceMappingURL=index.d.ts.map