@godxjp/ui 31.31.2 → 31.31.3
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/agent/START-HERE.md +1 -1
- package/agent/index.json +2 -2
- package/agent/llms.txt +3 -3
- package/dist/app/app-provider.js +39 -3
- package/dist/app/storage.d.ts +7 -0
- package/dist/app/storage.js +3 -1
- package/dist/contracts/measurement.json +1 -1
- package/dist/lib/datetime/sync.js +19 -11
- package/dist/styles/layers.json +1 -1
- package/package.json +2 -2
package/agent/START-HERE.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
You are about to write code against a design system you did not author. This file is the whole
|
|
4
4
|
contract. Read it before you write JSX.
|
|
5
5
|
|
|
6
|
-
**This catalog describes `@godxjp/ui` 31.31.
|
|
6
|
+
**This catalog describes `@godxjp/ui` 31.31.3.** If the project you are editing has a different
|
|
7
7
|
version in its `package.json`, read the pinned catalog for THAT version instead
|
|
8
8
|
(`…/v<their-version>/agent/…`). A catalog newer than the installed package describes props that do
|
|
9
9
|
not exist yet; older, and it hides props that do. Neither failure announces itself.
|
package/agent/index.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"note": "Pin to the tag that matches the @godxjp/ui version you installed. A catalog newer than your package describes props you do not have; older, and it hides props you do.",
|
|
49
49
|
"read": {
|
|
50
50
|
"live": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/main/agent/index.json",
|
|
51
|
-
"pinned": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/v31.31.
|
|
51
|
+
"pinned": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/v31.31.3/agent/index.json"
|
|
52
52
|
},
|
|
53
53
|
"source": "mcp/src/data — the same data @godxjp/ui-mcp serves — plus the foundation and semantic token tiers, read from src/tokens/*.css",
|
|
54
54
|
"start": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/main/agent/START-HERE.md",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"foundation": "the seeds a consumer is invited to set — --primary, --background, --radius",
|
|
63
63
|
"semantic": "named roles that follow the seeds — --ring, --text-link, --overlay-background"
|
|
64
64
|
},
|
|
65
|
-
"version": "31.31.
|
|
65
|
+
"version": "31.31.3"
|
|
66
66
|
}
|
package/agent/llms.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @godxjp/ui
|
|
2
2
|
|
|
3
3
|
> A Japanese-enterprise React design system: 185 components, 2187 design tokens,
|
|
4
|
-
> 50 cardinal rules. This file is the entry point for AI agents. Catalog version 31.31.
|
|
4
|
+
> 50 cardinal rules. This file is the entry point for AI agents. Catalog version 31.31.3.
|
|
5
5
|
|
|
6
6
|
If your client can run a process, do not read these files — run the MCP server instead
|
|
7
|
-
(`npx @godxjp/ui-mcp@31.31.
|
|
7
|
+
(`npx @godxjp/ui-mcp@31.31.3`). It is searchable and version-locked. These files exist for agents
|
|
8
8
|
that can only fetch URLs.
|
|
9
9
|
|
|
10
10
|
## Start
|
|
@@ -26,7 +26,7 @@ that can only fetch URLs.
|
|
|
26
26
|
## Pinning
|
|
27
27
|
|
|
28
28
|
Every URL above tracks `main`. To pin to the release a project actually installed, swap `main` for
|
|
29
|
-
the tag: `.../godx-jp/godxjp-ui/v31.31.
|
|
29
|
+
the tag: `.../godx-jp/godxjp-ui/v31.31.3/agent/...`. A catalog that does not match the installed
|
|
30
30
|
package describes props that are absent, or hides props that are present, and says nothing either way.
|
|
31
31
|
|
|
32
32
|
Pinned catalogs only exist for releases whose tag actually contains `agent/`. If `…/v<version>/agent/index.json` returns 404, that release predates this catalog: read `…/main/…` instead and compare `index.json` → `version` against the package you have, so you at least know which way it drifted.
|
package/dist/app/app-provider.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
import { resolveDefaultTimeFormat } from "./time-format-labels.js";
|
|
30
30
|
import { resolveDefaultTimezone, resolveHydrationSafeTimezone } from "./timezones.js";
|
|
31
31
|
import {
|
|
32
|
+
APP_LOCALES,
|
|
32
33
|
APP_REQUEST_HEADER_DATE_FORMAT,
|
|
33
34
|
APP_REQUEST_HEADER_LOCALE,
|
|
34
35
|
APP_REQUEST_HEADER_TIME_FORMAT,
|
|
@@ -114,12 +115,35 @@ function AppProvider({
|
|
|
114
115
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
116
|
[persistKey]
|
|
116
117
|
);
|
|
118
|
+
const formatChosenRef = React.useRef({ dateFormat: false, timeFormat: false });
|
|
117
119
|
const commitPreferences = React.useCallback(() => {
|
|
118
120
|
if (persistedAxes.size === 0) return;
|
|
119
|
-
|
|
121
|
+
const out = pickPersistedAxes(prefsRef.current, persistedAxes);
|
|
122
|
+
if (out.dateFormat !== void 0) {
|
|
123
|
+
if (formatChosenRef.current.dateFormat) out.dateFormatChosen = true;
|
|
124
|
+
else delete out.dateFormat;
|
|
125
|
+
}
|
|
126
|
+
if (out.timeFormat !== void 0) {
|
|
127
|
+
if (formatChosenRef.current.timeFormat) out.timeFormatChosen = true;
|
|
128
|
+
else delete out.timeFormat;
|
|
129
|
+
}
|
|
130
|
+
writeStoredPreferences(storageKey, out);
|
|
120
131
|
}, [persistedAxes, storageKey]);
|
|
121
132
|
React.useEffect(() => {
|
|
122
|
-
const
|
|
133
|
+
const raw = readStoredPreferences(storageKey);
|
|
134
|
+
const stored = pickPersistedAxes(raw, persistedAxes);
|
|
135
|
+
if (!raw.dateFormatChosen && stored.dateFormat !== void 0) {
|
|
136
|
+
const derivable = APP_LOCALES.some((l) => resolveDefaultDateFormat(l) === stored.dateFormat);
|
|
137
|
+
if (derivable) delete stored.dateFormat;
|
|
138
|
+
}
|
|
139
|
+
if (!raw.timeFormatChosen && stored.timeFormat !== void 0) {
|
|
140
|
+
const derivable = APP_LOCALES.some((l) => resolveDefaultTimeFormat(l) === stored.timeFormat);
|
|
141
|
+
if (derivable) delete stored.timeFormat;
|
|
142
|
+
}
|
|
143
|
+
formatChosenRef.current = {
|
|
144
|
+
dateFormat: stored.dateFormat !== void 0,
|
|
145
|
+
timeFormat: stored.timeFormat !== void 0
|
|
146
|
+
};
|
|
123
147
|
const nextLocale = stored.locale ?? defaultLocale;
|
|
124
148
|
const nextTimezone = stored.timezone ?? resolveDefaultTimezone(defaultTimezone, systemTimezone);
|
|
125
149
|
const nextTimeFormat = resolveInitialTimeFormat(
|
|
@@ -200,10 +224,20 @@ function AppProvider({
|
|
|
200
224
|
(next) => {
|
|
201
225
|
prefsRef.current = { ...prefsRef.current, locale: next };
|
|
202
226
|
setLocaleState(next);
|
|
227
|
+
if (!formatChosenRef.current.dateFormat && defaultDateFormat === "locale") {
|
|
228
|
+
const derived = resolveDefaultDateFormat(next);
|
|
229
|
+
prefsRef.current = { ...prefsRef.current, dateFormat: derived };
|
|
230
|
+
setDateFormatState(derived);
|
|
231
|
+
}
|
|
232
|
+
if (!formatChosenRef.current.timeFormat && defaultTimeFormat === "locale") {
|
|
233
|
+
const derived = resolveDefaultTimeFormat(next);
|
|
234
|
+
prefsRef.current = { ...prefsRef.current, timeFormat: derived };
|
|
235
|
+
setTimeFormatState(derived);
|
|
236
|
+
}
|
|
203
237
|
onLocaleChange?.(next);
|
|
204
238
|
commitPreferences();
|
|
205
239
|
},
|
|
206
|
-
[onLocaleChange, commitPreferences]
|
|
240
|
+
[onLocaleChange, commitPreferences, defaultDateFormat, defaultTimeFormat]
|
|
207
241
|
);
|
|
208
242
|
const setTimezone = React.useCallback(
|
|
209
243
|
(next) => {
|
|
@@ -216,6 +250,7 @@ function AppProvider({
|
|
|
216
250
|
);
|
|
217
251
|
const setTimeFormat = React.useCallback(
|
|
218
252
|
(next) => {
|
|
253
|
+
formatChosenRef.current.timeFormat = true;
|
|
219
254
|
prefsRef.current = { ...prefsRef.current, timeFormat: next };
|
|
220
255
|
setTimeFormatState(next);
|
|
221
256
|
onTimeFormatChange?.(next);
|
|
@@ -225,6 +260,7 @@ function AppProvider({
|
|
|
225
260
|
);
|
|
226
261
|
const setDateFormat = React.useCallback(
|
|
227
262
|
(next) => {
|
|
263
|
+
formatChosenRef.current.dateFormat = true;
|
|
228
264
|
prefsRef.current = { ...prefsRef.current, dateFormat: next };
|
|
229
265
|
setDateFormatState(next);
|
|
230
266
|
onDateFormatChange?.(next);
|
package/dist/app/storage.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ export type StoredAppPreferences = {
|
|
|
13
13
|
fontSize?: AppFontSize;
|
|
14
14
|
/** Continuous global size multiplier; `null` defers to the density preset. */
|
|
15
15
|
scaling?: number | null;
|
|
16
|
+
/**
|
|
17
|
+
* The viewer PICKED the stored date / time format. A format derived from the locale is never
|
|
18
|
+
* stored as a choice, so it follows the next language switch; a value without this flag (written
|
|
19
|
+
* by an older kit) is treated as derived, not chosen.
|
|
20
|
+
*/
|
|
21
|
+
dateFormatChosen?: boolean;
|
|
22
|
+
timeFormatChosen?: boolean;
|
|
16
23
|
};
|
|
17
24
|
/**
|
|
18
25
|
* The axes a viewer's preferences are made of — the keys of {@link StoredAppPreferences}.
|
package/dist/app/storage.js
CHANGED
|
@@ -48,7 +48,9 @@ function readStoredPreferences(storageKey) {
|
|
|
48
48
|
brand: isAppBrand(parsed.brand) ? parsed.brand : void 0,
|
|
49
49
|
density: isAppDensity(parsed.density) ? parsed.density : void 0,
|
|
50
50
|
fontSize: isAppFontSize(parsed.fontSize) ? parsed.fontSize : void 0,
|
|
51
|
-
scaling: typeof parsed.scaling === "number" && Number.isFinite(parsed.scaling) ? parsed.scaling : void 0
|
|
51
|
+
scaling: typeof parsed.scaling === "number" && Number.isFinite(parsed.scaling) ? parsed.scaling : void 0,
|
|
52
|
+
dateFormatChosen: parsed.dateFormatChosen === true ? true : void 0,
|
|
53
|
+
timeFormatChosen: parsed.timeFormatChosen === true ? true : void 0
|
|
52
54
|
};
|
|
53
55
|
} catch {
|
|
54
56
|
return {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "AUTO-GENERATED by scripts/gen-measurement-contract.mjs — do not edit. Read this instead of guessing: docs/MEASUREMENT-CONTRACT.md.",
|
|
3
|
-
"version": "31.31.
|
|
3
|
+
"version": "31.31.3",
|
|
4
4
|
"targetSize": {
|
|
5
5
|
"standard": "WCAG 2.2 SC 2.5.8 Target Size (Minimum), level AA — 24×24 CSS px",
|
|
6
6
|
"min": 24,
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { getDateFnsLocale } from "../../app/locales.js";
|
|
1
|
+
import { getDateFnsLocale, isAppLocale } from "../../app/locales.js";
|
|
2
2
|
import { resolveDefaultDateFormat } from "../../app/date-format-labels.js";
|
|
3
3
|
import { resolveHydrationSafeTimezone } from "../../app/timezones.js";
|
|
4
4
|
const DEFAULT_LOCALE = "vi";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
function pageLocale() {
|
|
6
|
+
if (typeof document === "undefined") return DEFAULT_LOCALE;
|
|
7
|
+
const lang = (document.documentElement.lang || "").toLowerCase().split("-")[0];
|
|
8
|
+
return isAppLocale(lang) ? lang : DEFAULT_LOCALE;
|
|
9
|
+
}
|
|
10
|
+
const defaultContext = () => {
|
|
11
|
+
const locale = pageLocale();
|
|
12
|
+
return {
|
|
13
|
+
locale,
|
|
14
|
+
dateFnsLocale: getDateFnsLocale(locale),
|
|
15
|
+
timezone: resolveHydrationSafeTimezone("browser"),
|
|
16
|
+
timeFormat: "24h",
|
|
17
|
+
dateFormat: resolveDefaultDateFormat(locale)
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
let syncedContext = null;
|
|
13
21
|
let liveRelativeFormattingEnabled = true;
|
|
14
22
|
function syncDatetimeContext(prefs) {
|
|
15
23
|
syncedContext = {
|
|
@@ -21,7 +29,7 @@ function syncDatetimeContext(prefs) {
|
|
|
21
29
|
};
|
|
22
30
|
}
|
|
23
31
|
function getDatetimeContext() {
|
|
24
|
-
return syncedContext;
|
|
32
|
+
return syncedContext ?? defaultContext();
|
|
25
33
|
}
|
|
26
34
|
function enableLiveRelativeFormatting() {
|
|
27
35
|
liveRelativeFormattingEnabled = true;
|
|
@@ -33,7 +41,7 @@ function canUseLiveRelativeFormatting() {
|
|
|
33
41
|
return liveRelativeFormattingEnabled;
|
|
34
42
|
}
|
|
35
43
|
function resetDatetimeContextForTests() {
|
|
36
|
-
syncedContext =
|
|
44
|
+
syncedContext = null;
|
|
37
45
|
liveRelativeFormattingEnabled = true;
|
|
38
46
|
}
|
|
39
47
|
export {
|
package/dist/styles/layers.json
CHANGED