@typestyles/next 0.0.0-unstable.f7b9ed22e456 → 0.3.0

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
@@ -221,7 +221,7 @@ import { TypestylesStylesheet } from '@typestyles/next';
221
221
  // app/page.tsx
222
222
  import { styles } from 'typestyles';
223
223
 
224
- const button = styles.create('button', {
224
+ const button = styles.component('button', {
225
225
  base: {
226
226
  padding: '12px 24px',
227
227
  backgroundColor: '#0066ff',
@@ -235,7 +235,7 @@ const button = styles.create('button', {
235
235
  export default function Home() {
236
236
  return (
237
237
  <main>
238
- <button className={button('base')}>Click me</button>
238
+ <button className={button()}>Click me</button>
239
239
  </main>
240
240
  );
241
241
  }
@@ -262,7 +262,7 @@ export const spacing = tokens.create('space', {
262
262
  import { styles } from 'typestyles';
263
263
  import { colors, spacing } from './tokens';
264
264
 
265
- const card = styles.create('card', {
265
+ const card = styles.component('card', {
266
266
  base: {
267
267
  padding: spacing.md,
268
268
  backgroundColor: colors.primary,
@@ -271,7 +271,7 @@ const card = styles.create('card', {
271
271
  });
272
272
 
273
273
  export default function Page() {
274
- return <div className={card('base')}>Hello World</div>;
274
+ return <div className={card()}>Hello World</div>;
275
275
  }
276
276
  ```
277
277
 
@@ -303,6 +303,14 @@ export default function RootLayout({ children }) {
303
303
  }
304
304
  ```
305
305
 
306
+ ## Fonts and local files
307
+
308
+ `global.fontFace()` registers `@font-face` like any other TypeStyles global. For **Next’s pre-build extraction** (`buildTypestylesForNext`), prefer fonts under **`public/fonts/`** and a root-relative `url('/fonts/…')` in `src` so Node does not need to resolve binary imports.
309
+
310
+ For **Vite**, you can use `import file from './font.woff2?url'` and `url(\`${file}\`) format('woff2')` so production CSS points at hashed assets.
311
+
312
+ See the **Fonts** guide in the TypeStyles docs (`docs/content/docs/fonts.md`, route `/docs/fonts` on the docs site).
313
+
306
314
  ## Troubleshooting
307
315
 
308
316
  ### Flash of Unstyled Content (FOUC)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/next",
3
- "version": "0.0.0-unstable.f7b9ed22e456",
3
+ "version": "0.3.0",
4
4
  "description": "Next.js integration for typestyles SSR",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -77,9 +77,9 @@
77
77
  "react": "^18.0.0",
78
78
  "react-dom": "^18.0.0",
79
79
  "tsup": "^8.0.0",
80
- "typestyles": "0.0.0-unstable.f7b9ed22e456",
81
80
  "typescript": "^5.4.0",
82
- "webpack": "^5.97.1"
81
+ "webpack": "^5.97.1",
82
+ "typestyles": "0.5.0"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "tsup",
package/src/build.test.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
2
  import type { NextConfig } from 'next';
3
3
  import type { Configuration } from 'webpack';
4
- import { withTypestylesExtract } from './build.js';
4
+ import { withTypestylesExtract } from './build';
5
5
 
6
6
  type WebpackContext = Parameters<NonNullable<NextConfig['webpack']>>[1];
7
7