@softure-ai/theme-kit 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  Newest first. Each version lists what changed for an app or a theme package that uses the kit.
4
4
 
5
+ ## 0.1.2
6
+
7
+ - `base.css` (#718): the page base for an app on the scoped `preflight.css`: `body` without the browser's margin, on
8
+ the theme's `background`, `foreground` and sans font, in `@layer base`. Radix portals on `body` inherit it.
9
+ - `maplibre.css` (#718): the theme's sans font on MapLibre maps, unlayered and more specific than `maplibre-gl.css`,
10
+ so it wins in any load order.
11
+ - Both read only contract tokens and go through the app's Tailwind (`--theme()`), after the theme's `theme.css`.
12
+
13
+ ## 0.1.1
14
+
15
+ - No change to the package itself: the first version published through the npm trusted publisher (OIDC) with
16
+ provenance, without a token.
17
+
5
18
  ## 0.1.0
6
19
 
7
20
  - First version: `ThemeDefinition` and `SHADCN_COLOR_ROLES` (the token contract), `buildThemeCss` (tokens on
package/README.md CHANGED
@@ -6,7 +6,8 @@ the token contract, the way a theme is declared, the CSS generator, the build co
6
6
  theme is a new `themes/theme-<name>` folder that follows the contract below; nothing in the kit changes.
7
7
 
8
8
  Apps install a theme package (e.g. [`@softure-ai/theme-notion`](../theme-notion/README.md)), which depends on the kit.
9
- An app imports the kit directly only for `preflight.css`, `useIsMobile`, or to build its own variant of a theme.
9
+ An app imports the kit directly only for its stylesheets (`preflight.css`, `base.css`, `maplibre.css`), `useIsMobile`,
10
+ or to build its own variant of a theme.
10
11
 
11
12
  ## Design
12
13
 
@@ -44,9 +45,14 @@ ThemeDefinition (data) ──defineTheme──▶ theme (checked) ──build
44
45
  | `createCn(options)`, `createThemeCn(definition)` | shadcn/ui's `cn`, with tailwind-merge told the theme's named text styles and shadows (`text-body` and `text-muted-foreground` both stay) |
45
46
  | `useIsMobile()`, `MOBILE_BREAKPOINT` (`/react`) | The sidebar's breakpoint (768 px), on `useSyncExternalStore`; the server renders the desktop layout |
46
47
  | `preflight.css` | Tailwind's preflight scoped to `[data-slot]` elements, in `@layer base` with zero specificity, plus `prefers-reduced-motion` |
48
+ | `base.css` | The page base: `body` without the browser's margin, on the theme's `background`, `foreground` and sans font, in `@layer base` (Radix portals on `body` inherit it) |
49
+ | `maplibre.css` | The theme's sans font on MapLibre maps (`body .maplibregl-map`, unlayered, so it beats `maplibre-gl.css` in any load order) |
47
50
  | `softure-theme-css [packageDir]` | Builds a theme package's stylesheets after `tsc` (the contract below) |
48
51
  | `/build`: `parseThemePackageConfig`, `buildThemeStylesheet`, `writeThemeStylesheets`, `buildThemePackage` | The code behind the command, for tests and tools (Node only) |
49
52
 
53
+ `base.css` and `maplibre.css` read the font with `--theme()`, so they are imported through the app's Tailwind, after
54
+ the theme's `theme.css`. They read only contract tokens, so they work with every theme.
55
+
50
56
  ## The theme package contract
51
57
 
52
58
  Every `themes/theme-<name>` package (named `@softure-ai/theme-<name>` by its folder):
package/dist/base.css ADDED
@@ -0,0 +1,16 @@
1
+ /*
2
+ * The page base for an app that takes the scoped `preflight.css`: nothing else styles `body` then, so the page keeps
3
+ * the browser's 8 px margin, serif font, black text and white background, and Radix portals mounted on `body`
4
+ * (select lists, menus, sheets) inherit them. In `@layer base`, so every component and utility overrides it.
5
+ *
6
+ * Reads `--background` and `--foreground` (colour roles every theme defines) and the theme's `--font-sans`. Import it
7
+ * after the theme's `theme.css`, through the app's Tailwind (it reads the font with `--theme()`).
8
+ */
9
+ @layer base {
10
+ body {
11
+ margin: 0;
12
+ background: var(--background);
13
+ color: var(--foreground);
14
+ font-family: --theme(--font-sans);
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * The theme's sans font on MapLibre maps: `maplibre-gl.css` is unlayered and sets its own font family on
3
+ * `.maplibregl-map`, so markers, popups and the attribution render in Helvetica. Unlayered too, since an unlayered
4
+ * rule beats every layered one, and one type selector more specific, so it wins whatever order the sheets load in.
5
+ * Only the family changes; MapLibre's size and line height stay.
6
+ *
7
+ * Import it if the app shows MapLibre maps, through the app's Tailwind (it reads the font with `--theme()`).
8
+ */
9
+ body .maplibregl-map {
10
+ font-family: --theme(--font-sans);
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/theme-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "SOFTURE AI theme kit: the theme contract (defineTheme), the theme CSS generator and build command, cn and the scoped preflight every shadcn/ui theme package shares.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,7 +46,9 @@
46
46
  "types": "./dist/build/index.d.ts",
47
47
  "default": "./dist/build/index.js"
48
48
  },
49
- "./preflight.css": "./dist/preflight.css"
49
+ "./preflight.css": "./dist/preflight.css",
50
+ "./base.css": "./dist/base.css",
51
+ "./maplibre.css": "./dist/maplibre.css"
50
52
  },
51
53
  "scripts": {
52
54
  "build": "tsc -p tsconfig.build.json && node scripts/copy-css.mjs"
package/src/base.css ADDED
@@ -0,0 +1,16 @@
1
+ /*
2
+ * The page base for an app that takes the scoped `preflight.css`: nothing else styles `body` then, so the page keeps
3
+ * the browser's 8 px margin, serif font, black text and white background, and Radix portals mounted on `body`
4
+ * (select lists, menus, sheets) inherit them. In `@layer base`, so every component and utility overrides it.
5
+ *
6
+ * Reads `--background` and `--foreground` (colour roles every theme defines) and the theme's `--font-sans`. Import it
7
+ * after the theme's `theme.css`, through the app's Tailwind (it reads the font with `--theme()`).
8
+ */
9
+ @layer base {
10
+ body {
11
+ margin: 0;
12
+ background: var(--background);
13
+ color: var(--foreground);
14
+ font-family: --theme(--font-sans);
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * The theme's sans font on MapLibre maps: `maplibre-gl.css` is unlayered and sets its own font family on
3
+ * `.maplibregl-map`, so markers, popups and the attribution render in Helvetica. Unlayered too, since an unlayered
4
+ * rule beats every layered one, and one type selector more specific, so it wins whatever order the sheets load in.
5
+ * Only the family changes; MapLibre's size and line height stay.
6
+ *
7
+ * Import it if the app shows MapLibre maps, through the app's Tailwind (it reads the font with `--theme()`).
8
+ */
9
+ body .maplibregl-map {
10
+ font-family: --theme(--font-sans);
11
+ }