create-salty-css 0.1.0-alpha.21 → 0.1.0-alpha.23

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 (2) hide show
  1. package/README.md +0 -83
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -57,7 +57,6 @@ To get help with problems, [Join Salty CSS Discord server](https://discord.gg/R6
57
57
  - [defineVariables](#variables) - create CSS variables (tokens) that can be used in any styling function
58
58
  - [defineMediaQuery](#media-queries) - create CSS media queries and use them in any styling function
59
59
  - [defineTemplates](#templates) - create reusable templates that can be applied when same styles are used over and over again
60
- - [defineFont](#custom-fonts) - register custom fonts via `@font-face` (or a remote stylesheet) and expose them as a CSS variable
61
60
  - [keyframes](#keyframes-animations) - create CSS keyframes animation that can be used and imported in any styling function
62
61
 
63
62
  ### Styling helpers & utility
@@ -320,88 +319,6 @@ Example usage:
320
319
  styled('div', { base: { textStyle: 'headline.large', card: '20px' } });
321
320
  ```
322
321
 
323
- ## Custom fonts
324
-
325
- Register custom fonts that will be emitted as `@font-face` declarations and exposed as a CSS variable. Mirrors the developer experience of Next.js / Astro font loaders, but generated at build time alongside the rest of your Salty CSS output.
326
-
327
- The returned object stringifies to its `font-family` value and exposes helpers for explicit usage:
328
-
329
- - `Font.variable` → CSS variable name (e.g. `--font-inter`)
330
- - `Font.fontFamily` → final `font-family` string with fallbacks
331
- - `Font.className` → class that sets the variable + applies the font on a subtree
332
- - `Font.style` → object you can spread on a React `style` prop
333
-
334
- ```ts
335
- // /styles/fonts.css.ts
336
- import { defineFont } from '@salty-css/core/factories';
337
-
338
- // 1. Local or self-hosted @font-face sources.
339
- // URLs are passed through as-is (use a public-folder path or a CDN URL).
340
- export const Inter = defineFont({
341
- name: 'Inter', // CSS font-family value
342
- variable: '--font-inter', // Optional — accepts 'font-inter' too; if omitted we derive `--font-<name>-<hash>` from the inputs
343
- display: 'swap', // Optional default applied to variants without their own `display`
344
- fallback: ['system-ui', 'sans-serif'], // Optional family fallbacks appended after `name`
345
- variants: [
346
- {
347
- weight: 400,
348
- style: 'normal',
349
- // Shorthand: pass a string and the `format()` descriptor is auto-detected
350
- // from the file extension (woff2, woff, ttf, otf, eot, svg, ttc).
351
- src: '/fonts/inter-400.woff2',
352
- },
353
- {
354
- weight: 700,
355
- style: 'normal',
356
- // Multiple sources can be a string array — first entry is preferred;
357
- // the browser picks the first format it supports.
358
- src: ['/fonts/inter-700.woff2', '/fonts/inter-700.ttf'],
359
- },
360
- {
361
- weight: 400,
362
- style: 'italic',
363
- // Use the `{ url, format }` object form when the URL has no recognisable
364
- // extension (signed CDN URLs, query-only endpoints, etc.). You can also
365
- // mix strings and objects in the same array.
366
- src: ['/fonts/inter-400-italic.woff2', { url: 'https://cdn.example.com/inter-italic', format: 'woff' }],
367
- },
368
- ],
369
- });
370
-
371
- // 2. Remote stylesheet (Google Fonts, etc.). Emits `@import url(...)` and still
372
- // registers the CSS variable so usage stays the same as the @font-face flow.
373
- export const InterCdn = defineFont({
374
- name: 'Inter',
375
- variable: '--font-inter',
376
- import: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap',
377
- });
378
- ```
379
-
380
- Example usage:
381
-
382
- ```tsx
383
- import { Inter } from './fonts.css';
384
- import { styled } from '@salty-css/react/styled';
385
-
386
- // Apply the font globally by attaching its className high up in the tree.
387
- // This sets `--font-inter` on the subtree and applies `font-family: var(--font-inter)`.
388
- export const App = ({ children }) => <div className={Inter.className}>{children}</div>;
389
-
390
- // `Inter` stringifies to its font-family value (with fallbacks), so it can be used directly.
391
- export const Heading = styled('h1', {
392
- base: {
393
- fontFamily: `${Inter}`,
394
- },
395
- });
396
-
397
- // Or reference the CSS variable explicitly.
398
- export const Body = styled('p', {
399
- base: {
400
- fontFamily: `var(${Inter.variable})`,
401
- },
402
- });
403
- ```
404
-
405
322
  ## Keyframes animations
406
323
 
407
324
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-salty-css",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.23",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -25,7 +25,7 @@
25
25
  "name": "npm-create"
26
26
  },
27
27
  "dependencies": {
28
- "@salty-css/core": "^0.1.0-alpha.21"
28
+ "@salty-css/core": "^0.1.0-alpha.23"
29
29
  },
30
30
  "bin": {
31
31
  "create-salty-css": "./index.js"