@ihyeon/flow-qa 0.9.12 → 0.9.13
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/THIRD_PARTY_NOTICES.md +2 -2
- package/dist/src/ui/design-system/components.css +787 -0
- package/{node_modules/@hyeonse/design-system/dist → dist/src/ui/design-system}/preferences.js +20 -12
- package/{node_modules/@hyeonse/design-system/src → dist/src/ui/design-system}/tokens.css +56 -0
- package/dist/src/ui/server.js +22 -7
- package/docs/releases.md +6 -0
- package/docs/ui.md +1 -1
- package/package.json +2 -5
- package/node_modules/@hyeonse/design-system/.github/workflows/ci.yml +0 -21
- package/node_modules/@hyeonse/design-system/.npmignore +0 -5
- package/node_modules/@hyeonse/design-system/AGENTS.md +0 -10
- package/node_modules/@hyeonse/design-system/README.md +0 -67
- package/node_modules/@hyeonse/design-system/THIRD_PARTY_NOTICES.md +0 -5
- package/node_modules/@hyeonse/design-system/dist/components.css +0 -105
- package/node_modules/@hyeonse/design-system/dist/preferences.d.ts +0 -21
- package/node_modules/@hyeonse/design-system/dist/react.d.ts +0 -21
- package/node_modules/@hyeonse/design-system/dist/react.js +0 -100
- package/node_modules/@hyeonse/design-system/dist/tokens.css +0 -75
- package/node_modules/@hyeonse/design-system/docs/api.md +0 -33
- package/node_modules/@hyeonse/design-system/docs/assets/fonts/dm-sans.woff2 +0 -0
- package/node_modules/@hyeonse/design-system/docs/assets/fonts/noto-kr-subset.woff2 +0 -0
- package/node_modules/@hyeonse/design-system/docs/audit.md +0 -29
- package/node_modules/@hyeonse/design-system/docs/foundations.md +0 -30
- package/node_modules/@hyeonse/design-system/docs/verification.md +0 -13
- package/node_modules/@hyeonse/design-system/index.html +0 -51
- package/node_modules/@hyeonse/design-system/licenses/DM-Sans-LICENSE.txt +0 -93
- package/node_modules/@hyeonse/design-system/licenses/Noto-Sans-KR-LICENSE.txt +0 -93
- package/node_modules/@hyeonse/design-system/licenses/arla6ka-MIT.txt +0 -21
- package/node_modules/@hyeonse/design-system/package.json +0 -35
- package/node_modules/@hyeonse/design-system/scripts/audit-tokens.mjs +0 -48
- package/node_modules/@hyeonse/design-system/scripts/build.mjs +0 -12
- package/node_modules/@hyeonse/design-system/showcase.css +0 -75
- package/node_modules/@hyeonse/design-system/showcase.mjs +0 -63
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/SKILL.md +0 -18
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/api.md +0 -7
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/build.md +0 -7
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/foundations.md +0 -7
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/mapping.md +0 -7
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/migration.md +0 -5
- package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/review-docs.md +0 -5
- package/node_modules/@hyeonse/design-system/src/components.css +0 -105
- package/node_modules/@hyeonse/design-system/src/preferences.ts +0 -87
- package/node_modules/@hyeonse/design-system/src/react.tsx +0 -161
- package/node_modules/@hyeonse/design-system/tests/audit.test.mjs +0 -30
- package/node_modules/@hyeonse/design-system/tests/preferences.test.mjs +0 -86
- package/node_modules/@hyeonse/design-system/tsconfig.json +0 -16
- /package/{node_modules/@hyeonse → dist/src/ui}/design-system/LICENSE +0 -0
package/{node_modules/@hyeonse/design-system/dist → dist/src/ui/design-system}/preferences.js
RENAMED
|
@@ -13,26 +13,33 @@ const options = {
|
|
|
13
13
|
corners: ['crisp', 'soft'],
|
|
14
14
|
motion: ['full', 'reduced'],
|
|
15
15
|
};
|
|
16
|
-
export function validatePreferences(value) {
|
|
16
|
+
export function validatePreferences(value, defaults) {
|
|
17
17
|
const input = value && typeof value === 'object' && !Array.isArray(value)
|
|
18
18
|
? value
|
|
19
19
|
: {};
|
|
20
|
+
const fallback = {
|
|
21
|
+
theme: options.theme.includes(defaults?.theme) ? defaults.theme : defaultPreferences.theme,
|
|
22
|
+
accent: options.accent.includes(defaults?.accent) ? defaults.accent : defaultPreferences.accent,
|
|
23
|
+
density: options.density.includes(defaults?.density) ? defaults.density : defaultPreferences.density,
|
|
24
|
+
corners: options.corners.includes(defaults?.corners) ? defaults.corners : defaultPreferences.corners,
|
|
25
|
+
motion: options.motion.includes(defaults?.motion) ? defaults.motion : defaultPreferences.motion,
|
|
26
|
+
};
|
|
20
27
|
return {
|
|
21
|
-
theme: options.theme.includes(input.theme) ? input.theme :
|
|
22
|
-
accent: options.accent.includes(input.accent) ? input.accent :
|
|
23
|
-
density: options.density.includes(input.density) ? input.density :
|
|
24
|
-
corners: options.corners.includes(input.corners) ? input.corners :
|
|
25
|
-
motion: options.motion.includes(input.motion) ? input.motion :
|
|
28
|
+
theme: options.theme.includes(input.theme) ? input.theme : fallback.theme,
|
|
29
|
+
accent: options.accent.includes(input.accent) ? input.accent : fallback.accent,
|
|
30
|
+
density: options.density.includes(input.density) ? input.density : fallback.density,
|
|
31
|
+
corners: options.corners.includes(input.corners) ? input.corners : fallback.corners,
|
|
32
|
+
motion: options.motion.includes(input.motion) ? input.motion : fallback.motion,
|
|
26
33
|
};
|
|
27
34
|
}
|
|
28
|
-
export function parsePreferences(raw) {
|
|
35
|
+
export function parsePreferences(raw, defaults) {
|
|
29
36
|
if (!raw)
|
|
30
|
-
return
|
|
37
|
+
return validatePreferences(null, defaults);
|
|
31
38
|
try {
|
|
32
|
-
return validatePreferences(JSON.parse(raw));
|
|
39
|
+
return validatePreferences(JSON.parse(raw), defaults);
|
|
33
40
|
}
|
|
34
41
|
catch {
|
|
35
|
-
return
|
|
42
|
+
return validatePreferences(null, defaults);
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
export function serializePreferences(value) {
|
|
@@ -45,11 +52,12 @@ export function effectiveMotion(motion, systemReduced) {
|
|
|
45
52
|
return systemReduced ? 'reduced' : motion;
|
|
46
53
|
}
|
|
47
54
|
// Root layout inserts this in <head> before CSS paints and suppresses hydration warnings on <html>.
|
|
48
|
-
export function createPreferenceScript(storageKey = preferencesKey) {
|
|
55
|
+
export function createPreferenceScript(storageKey = preferencesKey, defaults) {
|
|
49
56
|
// A JSON string literal is used inside an inline script; escape HTML syntax too.
|
|
50
57
|
const safeKey = JSON.stringify(storageKey).replace(/[<>&\u2028\u2029]/g, character => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
58
|
+
const safeDefaults = JSON.stringify(validatePreferences(null, defaults)).replace(/[<>&\u2028\u2029]/g, character => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
51
59
|
return `(function(){
|
|
52
|
-
var defaults
|
|
60
|
+
var defaults=${safeDefaults};
|
|
53
61
|
var allowed={theme:['system','light','dark'],accent:['cobalt','forest','coral'],density:['comfortable','compact'],corners:['crisp','soft'],motion:['full','reduced']};
|
|
54
62
|
var stored={};
|
|
55
63
|
try { var value=JSON.parse(localStorage.getItem(${safeKey})||'{}'); if(value&&typeof value==='object'&&!Array.isArray(value))stored=value; } catch(e) {}
|
|
@@ -25,6 +25,36 @@
|
|
|
25
25
|
--gutter: clamp(22px, 4.1vw, 72px);
|
|
26
26
|
--control-min-size: 44px;
|
|
27
27
|
--text-control: 12px;
|
|
28
|
+
--control-border: #858d9a;
|
|
29
|
+
--focus-ring: var(--accent-text);
|
|
30
|
+
--disabled-ink: #727987;
|
|
31
|
+
--disabled-surface: #e9ecf1;
|
|
32
|
+
--success-text: #176b4e;
|
|
33
|
+
--success-surface: #edf8f2;
|
|
34
|
+
--success-line: #3c8668;
|
|
35
|
+
--warning-text: #80520c;
|
|
36
|
+
--warning-surface: #fff7e3;
|
|
37
|
+
--warning-line: #ab751f;
|
|
38
|
+
--danger-text: #b42332;
|
|
39
|
+
--danger-surface: #fff1f2;
|
|
40
|
+
--danger-line: #c64a59;
|
|
41
|
+
--space-1: 4px;
|
|
42
|
+
--space-2: 8px;
|
|
43
|
+
--space-3: 12px;
|
|
44
|
+
--space-4: 16px;
|
|
45
|
+
--space-5: 24px;
|
|
46
|
+
--space-6: 32px;
|
|
47
|
+
--space-7: 48px;
|
|
48
|
+
--space-8: 64px;
|
|
49
|
+
--text-xs: 12px;
|
|
50
|
+
--text-sm: 14px;
|
|
51
|
+
--text-base: 16px;
|
|
52
|
+
--text-lg: 20px;
|
|
53
|
+
--leading-body: 1.6;
|
|
54
|
+
--duration-fast: 140ms;
|
|
55
|
+
--overlay-scrim: rgba(0, 0, 0, .48);
|
|
56
|
+
--shadow-popover: 0 8px 28px rgba(0, 0, 0, .16);
|
|
57
|
+
--shadow-dialog: 0 24px 72px rgba(0, 0, 0, .24);
|
|
28
58
|
}
|
|
29
59
|
|
|
30
60
|
@media (max-width: 700px) {
|
|
@@ -50,6 +80,18 @@
|
|
|
50
80
|
--about-muted: #c1c9de;
|
|
51
81
|
--inverse-surface: #f2f4f8;
|
|
52
82
|
--inverse-ink: #101114;
|
|
83
|
+
--control-border: #737e90;
|
|
84
|
+
--disabled-ink: #99a2b2;
|
|
85
|
+
--disabled-surface: #202631;
|
|
86
|
+
--success-text: #8cdeb7;
|
|
87
|
+
--success-surface: #142b23;
|
|
88
|
+
--success-line: #4e9a78;
|
|
89
|
+
--warning-text: #f3cc83;
|
|
90
|
+
--warning-surface: #302719;
|
|
91
|
+
--warning-line: #b28d46;
|
|
92
|
+
--danger-text: #ff9ba5;
|
|
93
|
+
--danger-surface: #351f25;
|
|
94
|
+
--danger-line: #c26b77;
|
|
53
95
|
}
|
|
54
96
|
|
|
55
97
|
:root[data-theme='dark'][data-accent='forest'] { --accent-text: #68dfb1; --about-surface: #173029; --about-muted: #b7e1d1; }
|
|
@@ -71,5 +113,19 @@
|
|
|
71
113
|
--about-muted: #c1c9de;
|
|
72
114
|
--inverse-surface: #f2f4f8;
|
|
73
115
|
--inverse-ink: #101114;
|
|
116
|
+
--control-border: #737e90;
|
|
117
|
+
--disabled-ink: #99a2b2;
|
|
118
|
+
--disabled-surface: #202631;
|
|
119
|
+
--success-text: #8cdeb7;
|
|
120
|
+
--success-surface: #142b23;
|
|
121
|
+
--success-line: #4e9a78;
|
|
122
|
+
--warning-text: #f3cc83;
|
|
123
|
+
--warning-surface: #302719;
|
|
124
|
+
--warning-line: #b28d46;
|
|
125
|
+
--danger-text: #ff9ba5;
|
|
126
|
+
--danger-surface: #351f25;
|
|
127
|
+
--danger-line: #c26b77;
|
|
74
128
|
}
|
|
129
|
+
:root:not([data-theme])[data-accent='forest'] { --accent-text: #68dfb1; --about-surface: #173029; --about-muted: #b7e1d1; }
|
|
130
|
+
:root:not([data-theme])[data-accent='coral'] { --accent-text: #ffa58e; --about-surface: #35231f; --about-muted: #e7c1b8; }
|
|
75
131
|
}
|
package/dist/src/ui/server.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
2
10
|
import { constants } from 'node:fs';
|
|
3
11
|
import { access, chmod, lstat, mkdir, open, readdir, realpath, rename, stat, unlink } from 'node:fs/promises';
|
|
4
12
|
import { createServer } from 'node:http';
|
|
5
13
|
import path from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
15
|
import { z } from 'zod';
|
|
8
|
-
import { createPreferenceScript } from '@hyeonse/design-system/preferences';
|
|
9
16
|
import { chromium } from 'playwright';
|
|
10
17
|
import { compileSuite } from "../compiler.js";
|
|
11
18
|
import { CaseSelectionError, isReportSelectionValid, selectCases } from "../case-selection.js";
|
|
@@ -36,7 +43,15 @@ const runCursorSchema = z.object({
|
|
|
36
43
|
filterHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
37
44
|
}).strict();
|
|
38
45
|
const FILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,159}$/;
|
|
39
|
-
const
|
|
46
|
+
const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
47
|
+
const PUBLIC_DIR = path.join(MODULE_DIR, 'public');
|
|
48
|
+
const IS_BUILT = import.meta.url.endsWith('.js');
|
|
49
|
+
const designSystemAsset = (name) => IS_BUILT
|
|
50
|
+
? path.join(MODULE_DIR, 'design-system', name === 'preferences' ? 'preferences.js' : name)
|
|
51
|
+
: fileURLToPath(import.meta.resolve(`@hyeonse/design-system/${name}`));
|
|
52
|
+
const preferenceModule = (await import(__rewriteRelativeImportExtension(IS_BUILT
|
|
53
|
+
? pathToFileURL(designSystemAsset('preferences')).href
|
|
54
|
+
: '@hyeonse/design-system/preferences')));
|
|
40
55
|
const STATIC_FILES = {
|
|
41
56
|
'/': { file: path.join(PUBLIC_DIR, 'index.html'), type: 'text/html; charset=utf-8' },
|
|
42
57
|
'/index.html': { file: path.join(PUBLIC_DIR, 'index.html'), type: 'text/html; charset=utf-8' },
|
|
@@ -44,13 +59,13 @@ const STATIC_FILES = {
|
|
|
44
59
|
'/display.js': { file: path.join(PUBLIC_DIR, 'display.js'), type: 'application/javascript; charset=utf-8' },
|
|
45
60
|
'/i18n.js': { file: path.join(PUBLIC_DIR, 'i18n.js'), type: 'application/javascript; charset=utf-8' },
|
|
46
61
|
'/style.css': { file: path.join(PUBLIC_DIR, 'style.css'), type: 'text/css; charset=utf-8' },
|
|
47
|
-
'/design-system/tokens.css': { file:
|
|
48
|
-
'/design-system/components.css': { file:
|
|
49
|
-
'/design-system/preferences.js': { file:
|
|
62
|
+
'/design-system/tokens.css': { file: designSystemAsset('tokens.css'), type: 'text/css; charset=utf-8' },
|
|
63
|
+
'/design-system/components.css': { file: designSystemAsset('components.css'), type: 'text/css; charset=utf-8' },
|
|
64
|
+
'/design-system/preferences.js': { file: designSystemAsset('preferences'), type: 'application/javascript; charset=utf-8' },
|
|
50
65
|
'/fonts/dm-sans.woff2': { file: path.join(PUBLIC_DIR, 'fonts', 'dm-sans.woff2'), type: 'font/woff2' },
|
|
51
66
|
'/fonts/noto-kr-subset.woff2': { file: path.join(PUBLIC_DIR, 'fonts', 'noto-kr-subset.woff2'), type: 'font/woff2' },
|
|
52
67
|
};
|
|
53
|
-
const INIT_SCRIPT = createPreferenceScript('flowqa-display-preferences');
|
|
68
|
+
const INIT_SCRIPT = preferenceModule.createPreferenceScript('flowqa-display-preferences');
|
|
54
69
|
class HTTPError extends Error {
|
|
55
70
|
status;
|
|
56
71
|
issues;
|
package/docs/releases.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Releases and verification
|
|
2
2
|
|
|
3
|
+
## 0.9.13 — Hyeonse Design System 0.4.8
|
|
4
|
+
|
|
5
|
+
The local UI now uses Hyeonse Design System 0.4.8 tokens, CSS controls, and preference helpers. The build copies only the two CSS files, the preference module, and the design system's MIT license into the Flow QA npm tarball. Installed consumers do not fetch the design-system archive or need Git for it. The included font files retain their original source and licenses.
|
|
6
|
+
|
|
7
|
+
On 2026-11-19, local Node.js 24.22.3 checks passed: 140 tests, type checking, UI syntax and design-system audit, all eight Chromium UI smoke scripts, and the installed-tarball smoke with three real runs. The package check found 46 files, a 257,876-byte tarball, and no bundled dependency packages. The temporary consumer had Git blocked and no installed design-system package; the local UI served byte-identical copies of the three design-system assets. This does not establish behavior on a physical device or in another service.
|
|
8
|
+
|
|
3
9
|
## 0.9.10 — Archived report comparison
|
|
4
10
|
|
|
5
11
|
`flow-qa compare` rejects an archived case with an unknown status instead of showing it as a normal transition. The English and Korean installation examples use the current public release.
|
package/docs/ui.md
CHANGED
|
@@ -136,7 +136,7 @@ The JSON keeps the case content and source reference. The Markdown retains its e
|
|
|
136
136
|
|
|
137
137
|
## Display and language
|
|
138
138
|
|
|
139
|
-
The UI uses role tokens and preference utilities from `@hyeonse/design-system
|
|
139
|
+
The UI uses role tokens and preference utilities from `@hyeonse/design-system` 0.4.8. The source checkout installs its [public release archive](https://design-system.hyeonse.dev/releases/hyeonse-design-system-0.4.8.tgz); the published Flow QA package contains only the CSS and preference files needed by the local UI, with the design system's MIT license. Flow QA implements its own workflow layout, buttons, and fields with those tokens.
|
|
140
140
|
|
|
141
141
|
The top-bar theme button and **Connections → Display settings** control theme, accent, density, corners, and motion. Preferences are saved under `flowqa-display-preferences` in the browser and shared across tabs. The device's reduced-motion setting takes priority. The saved preferences are applied before the token CSS appears on first load. If browser storage cannot be read or written, Display settings shows a localized warning: changes still apply in the current tab but may reset on reload. A successful later change or reset saves the preferences and clears the warning. Only local-storage events synchronize these settings between tabs.
|
|
142
142
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ihyeon/flow-qa",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Hyeonse Im",
|
|
6
6
|
"repository": {
|
|
@@ -34,9 +34,6 @@
|
|
|
34
34
|
"THIRD_PARTY_NOTICES.md",
|
|
35
35
|
"README.ko.md"
|
|
36
36
|
],
|
|
37
|
-
"bundleDependencies": [
|
|
38
|
-
"@hyeonse/design-system"
|
|
39
|
-
],
|
|
40
37
|
"description": "Turn user flows into repeatable tests and evidence-backed QA reports.",
|
|
41
38
|
"type": "module",
|
|
42
39
|
"engines": {
|
|
@@ -65,7 +62,6 @@
|
|
|
65
62
|
"@ai-sdk/openai-compatible": "3.0.53",
|
|
66
63
|
"@e2e-dev/mobile": "0.12.5",
|
|
67
64
|
"@e2e-dev/web": "0.11.1",
|
|
68
|
-
"@hyeonse/design-system": "https://codeload.github.com/hyeonse-swing/hyeonse-design-system/tar.gz/38978c6a86f422fc0e63e919f600bc2dd3451e5c",
|
|
69
65
|
"agent-device": "0.21.35",
|
|
70
66
|
"ai": "7.0.107",
|
|
71
67
|
"e2e": "0.22.0",
|
|
@@ -73,6 +69,7 @@
|
|
|
73
69
|
"zod": "4.6.7"
|
|
74
70
|
},
|
|
75
71
|
"devDependencies": {
|
|
72
|
+
"@hyeonse/design-system": "https://design-system.hyeonse.dev/releases/hyeonse-design-system-0.4.8.tgz",
|
|
76
73
|
"@types/node": "^24.0.0",
|
|
77
74
|
"typescript": "^5.9.3"
|
|
78
75
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Design system
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
pull_request:
|
|
5
|
-
permissions:
|
|
6
|
-
contents: read
|
|
7
|
-
jobs:
|
|
8
|
-
verify:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v4
|
|
12
|
-
- uses: actions/setup-node@v4
|
|
13
|
-
with:
|
|
14
|
-
node-version: 22
|
|
15
|
-
cache: npm
|
|
16
|
-
- run: npm ci
|
|
17
|
-
- run: npm run check
|
|
18
|
-
- run: npm run build
|
|
19
|
-
- run: npm test
|
|
20
|
-
- run: git diff --exit-code -- dist
|
|
21
|
-
- run: npm pack --dry-run
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Hyeonse Design System 작업 지침
|
|
2
|
-
|
|
3
|
-
이 저장소는 개인 프로젝트용 디자인 시스템입니다. 기존 화면의 목적과 실제 사용 맥락을 먼저 확인하고, 역할 토큰과 검증 가능한 상태를 기준으로 작업합니다.
|
|
4
|
-
|
|
5
|
-
- 공개 계약은 `package.json`의 exports, `src/`, `docs/api.md`를 함께 확인합니다. 문서만 보고 존재하지 않는 컴포넌트를 가정하지 않습니다.
|
|
6
|
-
- 기존 포트폴리오의 디자인 원칙은 `docs/foundations.md`에 요약되어 있습니다. 원본 구현이 필요할 때만 `https://github.com/hyeonse-swing/hyeonse-portfolio/blob/main/DESIGN_SYSTEM.md`를 참고합니다.
|
|
7
|
-
- 새 화면이나 이관은 사용자 범위와 기존 동작을 보존합니다. 토큰 매핑은 색 값의 근접성보다 의미와 대비를 먼저 봅니다.
|
|
8
|
-
- 상태 변경은 키보드, 좁은 화면, 밝음·어두움, 기기 움직임 감소 설정에서 확인합니다. 확인하지 않은 상태를 통과했다고 기록하지 않습니다.
|
|
9
|
-
- 외부 사이트 게시, 커밋·푸시·PR 생성은 별도 요청 없이 진행하지 않습니다.
|
|
10
|
-
- `skills/hyeonse-design-system/SKILL.md`는 이 저장소와 함께 제공하는 개인용 작업 지침입니다. 설치하거나 전역 설정을 바꾸지 않습니다.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Hyeonse Design System
|
|
2
|
-
|
|
3
|
-
개인 프로젝트에서 같은 시각 언어와 화면 설정을 재사용하기 위한 작은 디자인 시스템입니다. 흰 바탕, 짙은 글자, 코발트 강조색을 기본으로 하며 포레스트·코랄 강조색과 다크 화면을 지원합니다. 출발점은 [포트폴리오의 실제 구현](https://github.com/hyeonse-swing/hyeonse-portfolio/blob/main/DESIGN_SYSTEM.md)입니다.
|
|
4
|
-
|
|
5
|
-
## 사용
|
|
6
|
-
|
|
7
|
-
Node.js 22 이상과 npm을 사용합니다. npm 레지스트리에 게시하지 않고 GitHub 버전에서 설치합니다.
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install github:hyeonse-swing/hyeonse-design-system#v0.1.0
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
배포하는 앱에서는 검증한 전체 커밋 SHA로 고정하는 것을 권장합니다. 빌드된 `dist/`가 저장소에 포함되어 설치 시 별도 빌드는 필요하지 않습니다. 저장소를 개발하거나 견본을 확인할 때는 다음을 실행합니다.
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
cd hyeonse-design-system
|
|
17
|
-
npm ci
|
|
18
|
-
npm run build
|
|
19
|
-
npm run check
|
|
20
|
-
npm test
|
|
21
|
-
python3 -m http.server 8000
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
브라우저에서 `http://localhost:8000/`을 열면 [쇼케이스](index.html)를 볼 수 있습니다. 빌드된 `dist/`를 참조하므로 먼저 `npm run build`를 실행해야 합니다.
|
|
25
|
-
|
|
26
|
-
개인용 스킬은 소비 프로젝트에서 다음 명령으로 추가할 수 있습니다.
|
|
27
|
-
|
|
28
|
-
```sh
|
|
29
|
-
npx skills add hyeonse-swing/hyeonse-design-system --skill hyeonse-design-system
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
CSS만 필요한 화면에는 두 파일을 순서대로 불러옵니다.
|
|
33
|
-
|
|
34
|
-
```css
|
|
35
|
-
@import '@hyeonse/design-system/tokens.css';
|
|
36
|
-
@import '@hyeonse/design-system/components.css';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
React 화면에서는 `@hyeonse/design-system/react`의 `PreferencesProvider`, `ThemeToggle`, `PreferencesPanel`, `usePreferences`를 사용합니다. 초기 테마 깜빡임을 줄이려면 `@hyeonse/design-system/preferences`의 `preferenceScript`를 문서 `<head>`에 CSS보다 먼저 삽입하세요. 다른 저장 키가 필요하면 `createPreferenceScript(storageKey)`를 사용하고 Provider에도 같은 `storageKey`를 전달합니다. 기본 저장 키는 `hyeonse-site-preferences`입니다.
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
import { PreferencesProvider, ThemeToggle, PreferencesPanel } from '@hyeonse/design-system/react';
|
|
43
|
-
import { preferenceScript } from '@hyeonse/design-system/preferences';
|
|
44
|
-
import '@hyeonse/design-system/tokens.css';
|
|
45
|
-
import '@hyeonse/design-system/components.css';
|
|
46
|
-
|
|
47
|
-
// 서버 문서의 <head> 안에서 CSS보다 먼저: <script dangerouslySetInnerHTML={{ __html: preferenceScript }} />
|
|
48
|
-
export function DisplaySettings() {
|
|
49
|
-
return <PreferencesProvider><ThemeToggle locale="ko" /><PreferencesPanel locale="ko" /></PreferencesProvider>;
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
설정 키나 이벤트 이름을 바꾸는 경우에는 [API 문서](docs/api.md)의 적용 범위를 확인하세요. 글꼴 파일은 [출처와 라이선스](THIRD_PARTY_NOTICES.md)를 확인한 뒤 제품 자산으로 따로 제공해야 합니다.
|
|
54
|
-
|
|
55
|
-
## 구성
|
|
56
|
-
|
|
57
|
-
- [기초 규칙](docs/foundations.md): 색의 역할, 글자, 밀도, 모서리, 움직임.
|
|
58
|
-
- [API와 통합](docs/api.md): CSS 선택자와 TypeScript·React 공개 API.
|
|
59
|
-
- [개인용 스킬](skills/hyeonse-design-system/SKILL.md): 새 화면 제작, 확장, 토큰 매핑, 이관, 리뷰와 문서화의 작업 기준.
|
|
60
|
-
|
|
61
|
-
`src/`가 배포 코드의 기준이며 쇼케이스는 그 출력을 검토하는 정적 문서입니다. 쇼케이스의 예시 마크업은 CSS 상태 견본입니다. 라이브러리에서 일반 Button·Input React 컴포넌트를 제공한다는 의미는 아닙니다.
|
|
62
|
-
|
|
63
|
-
[실제 통합 검증 기록](docs/verification.md)에는 포트폴리오 이관 전후 비교와 확인 범위를 남겼습니다.
|
|
64
|
-
|
|
65
|
-
## 소비 앱의 CSS 점검
|
|
66
|
-
|
|
67
|
-
패키지 빌드 후 소비 앱 루트에서 `hds-audit <consumer-root> [config-relative-path]`를 실행할 수 있습니다. 기본 설정 파일은 소비 앱 루트의 `design-system.audit.json`입니다. [설정 형식과 한계](docs/audit.md)를 확인하세요. 이 검사는 CSS의 원시 색상 사용과 공유 토큰 재정의를 점검하며, TypeScript·JavaScript·3D 머티리얼까지 검사했다는 뜻은 아닙니다.
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# 제3자 자료
|
|
2
|
-
|
|
3
|
-
이 저장소의 시각 규칙과 구현은 [개인 포트폴리오 디자인 시스템](https://github.com/hyeonse-swing/hyeonse-portfolio/blob/main/DESIGN_SYSTEM.md)을 기반으로 합니다. 작업 흐름의 참고 자료는 [Arlan Marat의 `arla6ka/skills`](https://github.com/arla6ka/skills/tree/e6ca7a5ff640c133ad1290b1271a23324f255155/skills)입니다. 참조한 정확한 리비전은 `e6ca7a5ff640c133ad1290b1271a23324f255155`입니다. 원본은 MIT License이며 저작권 고지 전문은 [licenses/arla6ka-MIT.txt](licenses/arla6ka-MIT.txt)에 보존했습니다. 이 저장소에는 원본의 여러 스킬을 복제하지 않고 개인 작업에 맞춘 하나의 스킬을 작성했습니다.
|
|
4
|
-
|
|
5
|
-
쇼케이스의 DM Sans와 Noto Sans KR 글꼴 파일은 기존 포트폴리오 자산에서 복사했습니다. 각 라이선스 전문은 [DM Sans](licenses/DM-Sans-LICENSE.txt), [Noto Sans KR](licenses/Noto-Sans-KR-LICENSE.txt)에 있습니다. 한국어 서브셋은 기존 포트폴리오의 공개 문구용이므로 새 화면의 전체 한국어 문자 지원을 보장하지 않습니다.
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
.hds-themeToggle {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
gap: 9px;
|
|
6
|
-
min-width: 44px;
|
|
7
|
-
min-height: var(--control-min-size);
|
|
8
|
-
padding: 8px 12px;
|
|
9
|
-
border: 1px solid var(--line);
|
|
10
|
-
border-radius: var(--radius-control);
|
|
11
|
-
color: var(--ink);
|
|
12
|
-
background: var(--paper);
|
|
13
|
-
font: inherit;
|
|
14
|
-
font-size: var(--text-control);
|
|
15
|
-
font-weight: 700;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.hds-themeToggle svg { display: block; width: 19px; height: 19px; flex: none; }
|
|
20
|
-
.hds-themeToggle:hover { border-color: var(--accent-text); color: var(--accent-text); }
|
|
21
|
-
.hds-themeToggle:focus-visible, .hds-panel button:focus-visible, .hds-radioOption input:focus-visible + span {
|
|
22
|
-
outline: 3px solid var(--accent-text);
|
|
23
|
-
outline-offset: 3px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.hds-panel {
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
width: 100%;
|
|
29
|
-
padding: clamp(20px, 4vw, 48px);
|
|
30
|
-
border: 1px solid var(--line);
|
|
31
|
-
border-radius: var(--radius-card);
|
|
32
|
-
color: var(--ink);
|
|
33
|
-
background: var(--surface);
|
|
34
|
-
font-family: var(--font-sans);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.hds-heading {
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: end;
|
|
40
|
-
justify-content: space-between;
|
|
41
|
-
gap: 24px;
|
|
42
|
-
padding-bottom: 26px;
|
|
43
|
-
border-bottom: 1px solid var(--line);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.hds-heading h2 { margin: 10px 0 0; font-size: clamp(30px, 4vw, 54px); line-height: 1.1; letter-spacing: -.06em; }
|
|
47
|
-
.hds-heading p { margin: 0 0 3px; color: var(--muted); font-size: 13px; }
|
|
48
|
-
.hds-kicker { color: var(--accent-text); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
|
|
49
|
-
.hds-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(18px, 4vw, 48px); }
|
|
50
|
-
.hds-group { min-width: 0; margin: 0; padding: 22px 0 26px; border: 0; border-bottom: 1px solid var(--line); }
|
|
51
|
-
.hds-group legend { display: block; float: left; width: 100%; margin: 0 0 13px; padding: 0; font-size: 13px; font-weight: 800; }
|
|
52
|
-
.hds-group legend + * { clear: both; }
|
|
53
|
-
.hds-options, .hds-accents { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
54
|
-
.hds-radioOption { position: relative; display: inline-flex; min-height: var(--control-min-size); cursor: pointer; }
|
|
55
|
-
.hds-radioOption input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
56
|
-
.hds-radioOption span, .hds-accentButton {
|
|
57
|
-
box-sizing: border-box;
|
|
58
|
-
display: inline-flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
min-height: var(--control-min-size);
|
|
62
|
-
padding: 8px 14px;
|
|
63
|
-
border: 1px solid var(--line);
|
|
64
|
-
border-radius: var(--radius-control);
|
|
65
|
-
color: var(--ink);
|
|
66
|
-
background: var(--surface-raised);
|
|
67
|
-
font: inherit;
|
|
68
|
-
font-size: var(--text-control);
|
|
69
|
-
font-weight: 700;
|
|
70
|
-
line-height: 1.3;
|
|
71
|
-
white-space: nowrap;
|
|
72
|
-
}
|
|
73
|
-
.hds-radioOption input:checked + span { border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); color: var(--accent-text); }
|
|
74
|
-
.hds-radioOption:hover span, .hds-accentButton:hover { border-color: var(--accent-text); }
|
|
75
|
-
.hds-accentButton { gap: 9px; cursor: pointer; }
|
|
76
|
-
.hds-accentButton[aria-pressed='true'] { border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
|
|
77
|
-
.hds-swatch { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: var(--on-accent); font-size: 14px; font-weight: 900; }
|
|
78
|
-
.hds-cobalt .hds-swatch { background: var(--palette-cobalt); }
|
|
79
|
-
.hds-forest .hds-swatch { background: var(--palette-forest); }
|
|
80
|
-
.hds-coral .hds-swatch { background: var(--palette-coral); }
|
|
81
|
-
|
|
82
|
-
.hds-footer { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding-top: 28px; }
|
|
83
|
-
.hds-footer p { margin: 0; color: var(--muted); font-size: var(--text-control); line-height: 1.65; }
|
|
84
|
-
.hds-footer button {
|
|
85
|
-
flex: none;
|
|
86
|
-
min-height: var(--control-min-size);
|
|
87
|
-
padding: 8px 0;
|
|
88
|
-
border: 0;
|
|
89
|
-
border-bottom: 1px solid currentColor;
|
|
90
|
-
border-radius: 0;
|
|
91
|
-
color: var(--ink);
|
|
92
|
-
background: transparent;
|
|
93
|
-
font: inherit;
|
|
94
|
-
font-size: var(--text-control);
|
|
95
|
-
font-weight: 800;
|
|
96
|
-
cursor: pointer;
|
|
97
|
-
}
|
|
98
|
-
.hds-footer button:hover { color: var(--accent-text); }
|
|
99
|
-
|
|
100
|
-
@media (max-width: 720px) {
|
|
101
|
-
.hds-heading { display: block; }
|
|
102
|
-
.hds-heading p { margin-top: 16px; }
|
|
103
|
-
.hds-groups { grid-template-columns: 1fr; }
|
|
104
|
-
.hds-footer { align-items: start; flex-direction: column; gap: 14px; }
|
|
105
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type ThemePreference = 'system' | 'light' | 'dark';
|
|
2
|
-
export type AccentPreference = 'cobalt' | 'forest' | 'coral';
|
|
3
|
-
export type DensityPreference = 'comfortable' | 'compact';
|
|
4
|
-
export type CornersPreference = 'crisp' | 'soft';
|
|
5
|
-
export type MotionPreference = 'full' | 'reduced';
|
|
6
|
-
export type Preferences = {
|
|
7
|
-
theme: ThemePreference;
|
|
8
|
-
accent: AccentPreference;
|
|
9
|
-
density: DensityPreference;
|
|
10
|
-
corners: CornersPreference;
|
|
11
|
-
motion: MotionPreference;
|
|
12
|
-
};
|
|
13
|
-
export declare const preferencesKey = "hyeonse-site-preferences";
|
|
14
|
-
export declare const defaultPreferences: Preferences;
|
|
15
|
-
export declare function validatePreferences(value: unknown): Preferences;
|
|
16
|
-
export declare function parsePreferences(raw: string | null): Preferences;
|
|
17
|
-
export declare function serializePreferences(value: Preferences): string;
|
|
18
|
-
export declare function resolvedTheme(theme: ThemePreference, systemDark: boolean): 'light' | 'dark';
|
|
19
|
-
export declare function effectiveMotion(motion: MotionPreference, systemReduced: boolean): MotionPreference;
|
|
20
|
-
export declare function createPreferenceScript(storageKey?: string): string;
|
|
21
|
-
export declare const preferenceScript: string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { Preferences } from './preferences.js';
|
|
3
|
-
export type Locale = 'ko' | 'en';
|
|
4
|
-
type PreferenceContext = {
|
|
5
|
-
preferences: Preferences;
|
|
6
|
-
setPreference: <K extends keyof Preferences>(key: K, value: Preferences[K]) => void;
|
|
7
|
-
resetPreferences: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function PreferencesProvider({ children, storageKey, eventName }: {
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
storageKey?: string;
|
|
12
|
-
eventName?: string;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
14
|
-
export declare function usePreferences(): PreferenceContext;
|
|
15
|
-
export declare function ThemeToggle({ locale }: {
|
|
16
|
-
locale?: Locale;
|
|
17
|
-
}): import("react").JSX.Element;
|
|
18
|
-
export declare function PreferencesPanel({ locale }: {
|
|
19
|
-
locale?: Locale;
|
|
20
|
-
}): import("react").JSX.Element;
|
|
21
|
-
export {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useCallback, useContext, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
import { defaultPreferences, effectiveMotion, parsePreferences, preferencesKey, resolvedTheme, serializePreferences, validatePreferences, } from './preferences.js';
|
|
5
|
-
const defaultEventName = 'hyeonse:preferences';
|
|
6
|
-
const Context = createContext(null);
|
|
7
|
-
function applyPreferences(preferences, eventName) {
|
|
8
|
-
const root = document.documentElement;
|
|
9
|
-
const dark = window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false;
|
|
10
|
-
const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
11
|
-
root.dataset.theme = resolvedTheme(preferences.theme, dark);
|
|
12
|
-
root.dataset.themePreference = preferences.theme;
|
|
13
|
-
root.dataset.accent = preferences.accent;
|
|
14
|
-
root.dataset.density = preferences.density;
|
|
15
|
-
root.dataset.corners = preferences.corners;
|
|
16
|
-
root.dataset.motion = effectiveMotion(preferences.motion, reduced);
|
|
17
|
-
window.dispatchEvent(new CustomEvent(eventName, { detail: preferences }));
|
|
18
|
-
}
|
|
19
|
-
function readPreferences(storageKey) {
|
|
20
|
-
try {
|
|
21
|
-
return parsePreferences(window.localStorage.getItem(storageKey));
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return { ...defaultPreferences };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function PreferencesProvider({ children, storageKey = preferencesKey, eventName = defaultEventName }) {
|
|
28
|
-
const [preferences, setPreferences] = useState(defaultPreferences);
|
|
29
|
-
const preferencesRef = useRef(defaultPreferences);
|
|
30
|
-
useLayoutEffect(() => {
|
|
31
|
-
const stored = readPreferences(storageKey);
|
|
32
|
-
preferencesRef.current = stored;
|
|
33
|
-
setPreferences(stored);
|
|
34
|
-
applyPreferences(stored, eventName);
|
|
35
|
-
const themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
36
|
-
const motionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
37
|
-
const onSystemChange = () => applyPreferences(preferencesRef.current, eventName);
|
|
38
|
-
const onStorage = (event) => {
|
|
39
|
-
if (event.key !== storageKey && event.key !== null)
|
|
40
|
-
return;
|
|
41
|
-
const next = readPreferences(storageKey);
|
|
42
|
-
preferencesRef.current = next;
|
|
43
|
-
setPreferences(next);
|
|
44
|
-
applyPreferences(next, eventName);
|
|
45
|
-
};
|
|
46
|
-
themeQuery.addEventListener('change', onSystemChange);
|
|
47
|
-
motionQuery.addEventListener('change', onSystemChange);
|
|
48
|
-
window.addEventListener('storage', onStorage);
|
|
49
|
-
return () => {
|
|
50
|
-
themeQuery.removeEventListener('change', onSystemChange);
|
|
51
|
-
motionQuery.removeEventListener('change', onSystemChange);
|
|
52
|
-
window.removeEventListener('storage', onStorage);
|
|
53
|
-
};
|
|
54
|
-
}, [storageKey, eventName]);
|
|
55
|
-
const save = useCallback((next) => {
|
|
56
|
-
const safe = validatePreferences(next);
|
|
57
|
-
preferencesRef.current = safe;
|
|
58
|
-
setPreferences(safe);
|
|
59
|
-
applyPreferences(safe, eventName);
|
|
60
|
-
try {
|
|
61
|
-
window.localStorage.setItem(storageKey, serializePreferences(safe));
|
|
62
|
-
}
|
|
63
|
-
catch { /* Settings still work for this tab when storage is unavailable. */ }
|
|
64
|
-
}, [storageKey, eventName]);
|
|
65
|
-
const setPreference = useCallback((key, value) => {
|
|
66
|
-
save({ ...preferencesRef.current, [key]: value });
|
|
67
|
-
}, [save]);
|
|
68
|
-
const resetPreferences = useCallback(() => save({ ...defaultPreferences }), [save]);
|
|
69
|
-
return _jsx(Context.Provider, { value: { preferences, setPreference, resetPreferences }, children: children });
|
|
70
|
-
}
|
|
71
|
-
export function usePreferences() {
|
|
72
|
-
const context = useContext(Context);
|
|
73
|
-
if (!context)
|
|
74
|
-
throw new Error('PreferencesProvider가 필요합니다.');
|
|
75
|
-
return context;
|
|
76
|
-
}
|
|
77
|
-
const themeOptions = {
|
|
78
|
-
ko: [{ value: 'system', label: '기기 설정' }, { value: 'light', label: '밝게' }, { value: 'dark', label: '어둡게' }],
|
|
79
|
-
en: [{ value: 'system', label: 'System' }, { value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }],
|
|
80
|
-
};
|
|
81
|
-
export function ThemeToggle({ locale = 'ko' }) {
|
|
82
|
-
const { preferences, setPreference } = usePreferences();
|
|
83
|
-
const options = themeOptions[locale];
|
|
84
|
-
const current = options.find(option => option.value === preferences.theme);
|
|
85
|
-
const next = options[(options.findIndex(option => option.value === preferences.theme) + 1) % options.length];
|
|
86
|
-
return _jsxs("button", { type: "button", className: 'hds-themeToggle', onClick: () => setPreference('theme', next.value), "aria-label": locale === 'ko' ? `현재 테마 ${current.label}. ${next.label} 모드로 변경` : `Current theme: ${current.label}. Switch to ${next.label} mode`, title: locale === 'ko' ? `현재 ${current.label} · 다음 ${next.label}` : `Current: ${current.label} · Next: ${next.label}`, children: [_jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", children: [preferences.theme === 'system' && _jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "4", width: "18", height: "13", rx: "1" }), _jsx("path", { d: "M8 21h8M12 17v4" })] }), preferences.theme === 'light' && _jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 2v2m0 16v2M2 12h2m16 0h2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4m0-14.2-1.4 1.4M6.3 17.7l-1.4 1.4" })] }), preferences.theme === 'dark' && _jsx("path", { d: "M20.3 15.7A8.5 8.5 0 0 1 8.3 3.7a8.5 8.5 0 1 0 12 12Z" })] }), _jsx("span", { "aria-hidden": "true", children: current.label })] });
|
|
87
|
-
}
|
|
88
|
-
function RadioGroup({ field, legend, choices, name, }) {
|
|
89
|
-
const { preferences, setPreference } = usePreferences();
|
|
90
|
-
return _jsxs("fieldset", { className: 'hds-group', children: [_jsx("legend", { children: legend }), _jsx("div", { className: 'hds-options', children: choices.map(choice => _jsxs("label", { className: 'hds-radioOption', children: [_jsx("input", { type: "radio", name: `${name}-${field}`, value: choice.value, checked: preferences[field] === choice.value, onChange: () => setPreference(field, choice.value) }), _jsx("span", { children: choice.label })] }, choice.value)) })] });
|
|
91
|
-
}
|
|
92
|
-
export function PreferencesPanel({ locale = 'ko' }) {
|
|
93
|
-
const { preferences, setPreference, resetPreferences } = usePreferences();
|
|
94
|
-
const panelId = useId();
|
|
95
|
-
const en = locale === 'en';
|
|
96
|
-
const accentOptions = en
|
|
97
|
-
? [{ value: 'cobalt', label: 'Cobalt' }, { value: 'forest', label: 'Forest' }, { value: 'coral', label: 'Coral' }]
|
|
98
|
-
: [{ value: 'cobalt', label: '코발트' }, { value: 'forest', label: '포레스트' }, { value: 'coral', label: '코랄' }];
|
|
99
|
-
return _jsxs("section", { className: 'hds-panel', "aria-labelledby": `${panelId}-title`, children: [_jsxs("div", { className: 'hds-heading', children: [_jsxs("div", { children: [_jsx("span", { className: 'hds-kicker', children: "DISPLAY / CONTROL" }), _jsx("h2", { id: `${panelId}-title`, children: en ? 'Display settings' : '화면 설정' })] }), _jsx("p", { children: en ? 'Adjust the display for comfortable reading.' : '읽기 편한 화면으로 바꿔 보세요.' })] }), _jsxs("div", { className: 'hds-groups', children: [_jsx(RadioGroup, { field: "theme", legend: en ? 'Theme' : '테마', choices: themeOptions[locale], name: panelId }), _jsxs("fieldset", { className: 'hds-group', children: [_jsx("legend", { children: en ? 'Accent color' : '강조 색상' }), _jsx("div", { className: 'hds-accents', children: accentOptions.map(({ value, label }) => _jsxs("button", { type: "button", className: `${'hds-accentButton'} ${`hds-${value}`}`, "aria-pressed": preferences.accent === value, "aria-label": en ? `${label} accent color${preferences.accent === value ? ', selected' : ''}` : `${label} 강조 색상${preferences.accent === value ? ', 선택됨' : ''}`, onClick: () => setPreference('accent', value), children: [_jsx("span", { className: 'hds-swatch', "aria-hidden": "true", children: preferences.accent === value ? '✓' : '' }), _jsx("span", { children: label })] }, value)) })] }), _jsx(RadioGroup, { field: "density", legend: en ? 'Spacing' : '간격', choices: en ? [{ value: 'comfortable', label: 'Default' }, { value: 'compact', label: 'Compact' }] : [{ value: 'comfortable', label: '기본' }, { value: 'compact', label: '촘촘하게' }], name: panelId }), _jsx(RadioGroup, { field: "corners", legend: en ? 'Corners' : '모서리', choices: en ? [{ value: 'crisp', label: 'Sharp' }, { value: 'soft', label: 'Rounded' }] : [{ value: 'crisp', label: '각지게' }, { value: 'soft', label: '부드럽게' }], name: panelId }), _jsx(RadioGroup, { field: "motion", legend: en ? 'Motion' : '움직임', choices: en ? [{ value: 'full', label: 'Default' }, { value: 'reduced', label: 'Reduced' }] : [{ value: 'full', label: '기본' }, { value: 'reduced', label: '줄이기' }], name: panelId })] }), _jsxs("div", { className: 'hds-footer', children: [_jsxs("p", { role: "status", "aria-live": "polite", children: [en ? 'Current settings: ' : '현재 설정: ', themeOptions[locale].find(option => option.value === preferences.theme)?.label, ", ", accentOptions.find(option => option.value === preferences.accent)?.label, ", ", en ? (preferences.density === 'compact' ? 'compact spacing' : 'default spacing') : (preferences.density === 'compact' ? '촘촘한 간격' : '기본 간격'), ", ", en ? (preferences.corners === 'soft' ? 'rounded corners' : 'sharp corners') : (preferences.corners === 'soft' ? '부드러운 모서리' : '각진 모서리'), ", ", en ? (preferences.motion === 'reduced' ? 'reduced motion' : 'default motion') : (preferences.motion === 'reduced' ? '움직임 줄이기' : '기본 움직임')] }), _jsx("button", { type: "button", onClick: resetPreferences, children: en ? 'Reset to defaults' : '기본값으로 되돌리기' })] })] });
|
|
100
|
-
}
|