@godxjp/ui 16.8.0 → 16.9.1

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
@@ -120,9 +120,10 @@ separate `@godxjp/ui/data-grid` (`DataGrid`) subpath has been merged in and remo
120
120
 
121
121
  ## Consumer setup — theme is self-contained
122
122
 
123
- The framework ships colors, fonts (M PLUS 2 via `@fontsource`), the type scale, and
124
- the wa-iro palette. A consumer's entire styling surface is **one import + content
125
- sources** — no `:root` overrides, no font `<link>`:
123
+ The framework ships colors, the type scale, the wa-iro palette, and (opt-in)
124
+ bundled fonts (Noto Sans JP + Montserrat via `@fontsource`). A consumer's entire
125
+ styling surface is **one import + content sources** — no `:root` overrides, no
126
+ font `<link>`:
126
127
 
127
128
  ```css
128
129
  /* resources/css/app.css */
@@ -131,6 +132,41 @@ sources** — no `:root` overrides, no font `<link>`:
131
132
  @source '../views';
132
133
  ```
133
134
 
135
+ ### Slim build — ship only the CSS you use
136
+
137
+ `@godxjp/ui/styles` is the zero-config all-in-one (every component's CSS +
138
+ bundled fonts). To ship only what you render, import the foundation plus the
139
+ per-layer files you need (mirrors the JS subpaths — the CSS tree-shakes too):
140
+
141
+ ```css
142
+ @import "@godxjp/ui/styles/base"; /* required: tokens + tailwind + base layer */
143
+ @import "@godxjp/ui/styles/control"; /* Button, Input, Select, Textarea, toggles */
144
+ @import "@godxjp/ui/styles/form-layout"; /* FormField */
145
+ @import "@godxjp/ui/styles/dialog-layout"; /* Dialog */
146
+ /* …only the layers you use. Layer files need `base` first (they use @layer/@apply). */
147
+ ```
148
+
149
+ Skip `@godxjp/ui/styles/fonts` when you manage fonts yourself (next/font, etc.)
150
+ and set the font tokens instead (see below). A marketing site using ~10
151
+ components typically drops component CSS from ~142K → ~26K gzip.
152
+
153
+ ### Fonts — token-driven, per-language, no library hardcoding
154
+
155
+ The base ships NO hardcoded brand face. Supply your own faces and set tokens —
156
+ one face everywhere, or per-language (no `[lang]` selectors to write):
157
+
158
+ ```css
159
+ :root {
160
+ --font-sans-base: var(--my-latin), system-ui, sans-serif; /* default face */
161
+ --font-sans-ja: "Noto Sans JP", var(--font-sans-base); /* lang="ja" */
162
+ --font-sans-vi: "Montserrat", var(--font-sans-base); /* lang="vi" */
163
+ /* also: --font-sans-ko, --font-sans-zh-hans, --font-sans-zh-hant */
164
+ }
165
+ ```
166
+
167
+ `styles/base.css` wires each `[lang]` to its slot (falling back to
168
+ `--font-sans-base`); `styles/fonts` fills these slots for the bundled faces.
169
+
134
170
  ```tsx
135
171
  import { AppProvider } from "@godxjp/ui/app"; // locale, tz, date/time format
136
172
  import { PageContainer } from "@godxjp/ui/layout"; // every page wraps in this
@@ -22,17 +22,30 @@
22
22
  * ───────────────────────────────────────────────────────────────────────── */
23
23
  @import "tailwindcss";
24
24
 
25
- /* Vietnamese locale Montserrat (set by AppProvider via <html lang="vi">). Overrides the
26
- * --font-family-sans token so every body/heading rule that reads it switches automatically.
27
- * Only takes visible effect when the Montserrat face is loaded (@godxjp/ui/styles/fonts, or
28
- * your own); consumers managing their own fonts override this token directly. */
29
- :root:lang(vi),
25
+ /* Per-language font wiring token-only, NO hardcoded faces. Each locale reads
26
+ * an OPTIONAL per-lang slot token (empty by default) and falls back to the
27
+ * base sans. Consumers switch a locale's face by setting its slot, e.g.
28
+ * :root { --font-sans-ja: "Noto Sans JP", var(--font-sans-base); }
29
+ * without writing any [lang] selectors. The opt-in bundle styles/fonts fills
30
+ * these slots for its Noto Sans JP + Montserrat faces. `--font-sans-base` is a
31
+ * separate token (not --font-family-sans) so the fallback can't self-reference. */
32
+ [lang="ja"] {
33
+ --font-family-sans: var(--font-sans-ja, var(--font-sans-base));
34
+ }
35
+ [lang="ko"] {
36
+ --font-family-sans: var(--font-sans-ko, var(--font-sans-base));
37
+ }
30
38
  [lang="vi"] {
31
- /* Montserrat for Latin/Vietnamese; Noto Sans JP kept as the tail so any 日本語 in a vi-locale
32
- * screen still has the bundled JP face (Montserrat has no CJK glyphs). */
33
- --font-family-sans:
34
- "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
35
- system-ui, "Noto Sans JP", sans-serif;
39
+ --font-family-sans: var(--font-sans-vi, var(--font-sans-base));
40
+ }
41
+ [lang="zh"],
42
+ [lang="zh-Hans"],
43
+ [lang="zh-CN"] {
44
+ --font-family-sans: var(--font-sans-zh-hans, var(--font-sans-base));
45
+ }
46
+ [lang="zh-Hant"],
47
+ [lang="zh-TW"] {
48
+ --font-family-sans: var(--font-sans-zh-hant, var(--font-sans-base));
36
49
  }
37
50
 
38
51
  /* Guarantee the full set of semantic color utilities ships in the compiled CSS
@@ -20,3 +20,18 @@
20
20
  @import "@fontsource/montserrat/400.css";
21
21
  @import "@fontsource/montserrat/500.css";
22
22
  @import "@fontsource/montserrat/700.css";
23
+
24
+ /* Fill the font-token slots (see tokens/foundation.css + styles/base.css) with
25
+ * the bundled faces, so the all-in-one `@godxjp/ui/styles` entry stays
26
+ * zero-config: Noto Sans JP is the default face (Japanese + clean Latin), and
27
+ * the Vietnamese locale leads with Montserrat (Noto Sans JP tail keeps CJK
28
+ * glyphs, which Montserrat lacks). Consumers on the per-layer setup who supply
29
+ * their own faces simply DON'T import this file and set the slots themselves. */
30
+ :root {
31
+ --font-sans-base:
32
+ "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
33
+ system-ui, "Hiragino Sans", sans-serif;
34
+ --font-sans-vi:
35
+ "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
36
+ system-ui, "Noto Sans JP", sans-serif;
37
+ }
@@ -145,15 +145,27 @@
145
145
  --gradient-hero: none;
146
146
  --gradient-glow: none;
147
147
 
148
- /* Sans stack — script-aware per the international convention for mixed
149
- * Latin/CJK UI: native Latin system fonts FIRST (clean, familiar English &
150
- * DEFAULT face is the bundled "Noto Sans JP" (Japanese + clean Latin), with system sans as
151
- * the network/loading fallback. The Vietnamese locale swaps this token to Montserrat via
152
- * `:root:lang(vi)` in styles/index.css (set by AppProvider's <html lang>). Browsers resolve
153
- * fonts per-glyph, so 日本語 and Latin both render in Noto Sans JP when it's loaded. */
154
- --font-family-sans:
155
- "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
156
- system-ui, "Hiragino Sans", sans-serif;
148
+ /* Sans stack — FONT-AGNOSTIC by default. The library ships NO hardcoded brand
149
+ * face here: `--font-sans-base` is a pure system stack so godx renders cleanly
150
+ * with zero font setup. Consumers supply their own faces (next/font, @fontsource,
151
+ * self-host) and set the tokens never edit the library.
152
+ *
153
+ * Two ways to theme fonts, both token-only (no [lang] selectors to write):
154
+ * 1. One face everywhere → override `--font-sans-base`.
155
+ * 2. Per-language faces set the per-lang SLOT tokens; styles/base.css wires
156
+ * each `[lang]` to read its slot with `--font-sans-base` as the fallback:
157
+ * --font-sans-ja (lang="ja")
158
+ * --font-sans-ko (lang="ko")
159
+ * --font-sans-vi (lang="vi")
160
+ * --font-sans-zh-hans (lang="zh" | "zh-Hans" | "zh-CN")
161
+ * --font-sans-zh-hant (lang="zh-Hant" | "zh-TW")
162
+ * e.g. `--font-sans-ja: "Noto Sans JP", var(--font-sans-base);`
163
+ * The opt-in bundle `@godxjp/ui/styles/fonts` fills these slots for its bundled
164
+ * Noto Sans JP + Montserrat faces, so the all-in-one entry is zero-config. */
165
+ --font-sans-base:
166
+ -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui,
167
+ sans-serif;
168
+ --font-family-sans: var(--font-sans-base);
157
169
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
158
170
  /* Dual-font split (opt-in) — many brand designs pair a DISPLAY face for headings with a separate
159
171
  * BODY face (e.g. Source Sans 3 display + Inter body). Both default to --font-family-sans, so a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godxjp/ui",
3
- "version": "16.8.0",
3
+ "version": "16.9.1",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@10.29.1",
6
6
  "sideEffects": false,
@@ -276,7 +276,7 @@
276
276
  "test:coverage": "vitest run --coverage",
277
277
  "check:example-imports": "node scripts/check-example-imports.mjs",
278
278
  "verify": "pnpm typecheck && pnpm lint && pnpm format && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:rtl && pnpm check:typography && pnpm check:mcp-token-sync && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm check:audit-sync && pnpm test",
279
- "verify:release": "pnpm typecheck && pnpm typecheck:docs && pnpm lint && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:use-client && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:rtl && pnpm check:typography && pnpm check:mcp-token-sync && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm check:audit-sync && pnpm check:mcp-prop-sync && pnpm check:contrast && pnpm test",
279
+ "verify:release": "pnpm build && pnpm typecheck && pnpm typecheck:docs && pnpm lint && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:use-client && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:rtl && pnpm check:typography && pnpm check:mcp-token-sync && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm check:audit-sync && pnpm check:mcp-prop-sync && pnpm check:contrast && pnpm test",
280
280
  "check:mcp-sync": "node scripts/check-mcp-sync.mjs",
281
281
  "check:mcp-orphans": "node scripts/check-mcp-orphans.mjs",
282
282
  "check:mcp-prop-sync": "node scripts/check-mcp-prop-sync.mjs",
@@ -1,43 +0,0 @@
1
- /* ───────────────────────────────────────────────────────────────
2
- * Famgia service theme — ファムジア株式会社
3
- * Re-themes @godxjp/ui via SEMANTIC TOKENS only (no component CSS).
4
- * Brand: electric blue #2563EB (primary) + violet #7C3AED (accent gradient).
5
- * Import this instead of "@godxjp/ui/styles".
6
- * ─────────────────────────────────────────────────────────────── */
7
-
8
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap");
9
- @import "@godxjp/ui/styles";
10
-
11
- /* ── Light (default) ── */
12
- :root {
13
- /* Brand primary ramp — electric blue */
14
- --primary: 221 83% 53%; /* #2563EB */
15
- --primary-foreground: 0 0% 100%;
16
- --primary-hover: 224 71% 48%; /* #1D4ED8 */
17
- --primary-active: 226 71% 40%; /* #1E40AF */
18
- --ring: 221 83% 53%;
19
-
20
- /* Brand-colored text (AA on tint/white) */
21
- --text-link: 224 76% 45%;
22
- --text-brand: 221 83% 53%;
23
- --text-primary: 224 76% 42%;
24
-
25
- /* Signature brand gradient: blue → violet */
26
- --gradient-brand: linear-gradient(135deg, hsl(221 83% 53%), hsl(262 83% 58%));
27
-
28
- /* Typography — Inter (Latin/VI) + Noto Sans JP (kana/kanji) */
29
- --font-family-sans: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont,
30
- "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
31
- }
32
-
33
- /* ── Dark ── lifted blue for contrast */
34
- .dark {
35
- --primary: 221 90% 66%;
36
- --primary-foreground: 222 47% 11%;
37
- --primary-hover: 221 90% 72%;
38
- --primary-active: 221 90% 60%;
39
- --ring: 221 90% 66%;
40
- --text-link: 221 90% 72%;
41
- --text-brand: 221 90% 70%;
42
- --text-primary: 221 90% 68%;
43
- }