@uniai-fe/uds-foundation 0.4.6 → 0.4.7

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/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 UNIAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This project includes third-party software governed by additional licenses,
26
+ including Apache License 2.0. Refer to `THIRD_PARTY_NOTICES.md` for the full
27
+ text of those notices and any required attributions.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @uniai-fe/uds-foundation
2
2
 
3
- UNIAI 서비스 전반에서 공유하는 디자인 토큰과 폰트 자산을 CSS 변수 형태로 제공하는 패키지입니다. 색상·여백·레이아웃·타이포그래피·폰트 정의를 모두 포함하며, 다른 패키지(`@uniai-fe/uds-primitives`, `@uniai-fe/uds-templates`)의 기초가 됩니다.
3
+ UNIAI 서비스 전반에서 공유하는 UDS token/runtime style foundation package입니다. 색상·여백·레이아웃·타이포그래피·폰트 정의를 CSS variables, Sass entry, TypeScript token object, helper/provider/font/type export로 제공하며, 다른 패키지(`@uniai-fe/uds-primitives`, `@uniai-fe/uds-templates`)의 기초가 됩니다.
4
4
 
5
5
  ## 설치
6
6
 
@@ -10,8 +10,89 @@ pnpm add @uniai-fe/uds-foundation
10
10
 
11
11
  ## 사용법 요약
12
12
 
13
+ ### Public import surface
14
+
15
+ `@uniai-fe/uds-foundation`의 public import 기준은 package export map에 명시된 root와 subpath다. root import는 TS API entry이며 style load entry가 아니다.
16
+
17
+ 대표 안정 subpath:
18
+
19
+ ```ts
20
+ import { ThemeProvider } from "@uniai-fe/uds-foundation/provider";
21
+ import { themeTokens } from "@uniai-fe/uds-foundation/data/tokens";
22
+ import { colorPrimitiveVar } from "@uniai-fe/uds-foundation/helpers";
23
+ ```
24
+
25
+ - `@uniai-fe/uds-foundation`: provider, font, token snapshot, type surface를 모은 root TS API entry
26
+ - `@uniai-fe/uds-foundation/data/tokens`: `themeTokens` snapshot
27
+ - `@uniai-fe/uds-foundation/helpers`: token helper 함수
28
+ - `@uniai-fe/uds-foundation/provider`: `ThemeProvider`
29
+ - `@uniai-fe/uds-foundation/typography/fonts`: font option helpers
30
+ - `@uniai-fe/uds-foundation/types/theme-tokens`: theme token type surface
31
+
32
+ root에서 직접 export되는 token snapshot은 현재 API inventory로 취급한다. consumer guide에서는 style entry와 혼동을 줄이기 위해 `data/tokens`, `helpers`, `provider`, `typography/fonts`, `types/theme-tokens`처럼 명시 subpath를 우선 안내한다.
33
+
34
+ ## Foundation token/export contract
35
+
36
+ foundation은 reset/document base style, CSS variables, SCSS/Sass entry, TypeScript token object, generated token snapshot, token helper, `ThemeProvider`, font options, public token types를 함께 제공한다.
37
+
38
+ | 형식 | 역할 |
39
+ | ----------------------- | -------------------------------------------------------------------------------- |
40
+ | CSS variables | runtime style contract. 서비스와 design package style은 `var(--...)`를 소비한다. |
41
+ | SCSS/Sass entry | Sass consumer와 internal style composition을 위한 public style entry다. |
42
+ | TypeScript token object | `themeTokens`와 개별 token const가 제공하는 TS canonical snapshot이다. |
43
+ | JSON snapshot | `docs/theme-tokens.json`에 있는 generated/reference snapshot이다. |
44
+ | Markdown token docs | `docs/theme-tokens.md`에 있는 generated/reference documentation이다. |
45
+ | token map | Figma token -> canonical token -> CSS variable mapping 기준이다. |
46
+ | helper exports | TS에서 token value 또는 CSS variable name 접근을 돕는다. |
47
+ | provider export | root DOM에 `.uds-theme-root` scope class를 부여한다. |
48
+ | font exports | `next/font/local` option과 font family contract를 제공한다. |
49
+ | type exports | 실제 token object에서 파생한 object-first token type contract다. |
50
+
51
+ ### `themeTokens` canonical snapshot
52
+
53
+ `themeTokens`는 TS canonical token snapshot이다. public token type은 별도 수동 schema를 중복 선언하기보다 실제 token object에서 `typeof` 기반으로 파생한다. 이 object-first 구조는 token key와 public type의 drift를 줄이는 것이 목적이다.
54
+
55
+ 현재 구조는 단일 token pipeline이 아니다. SCSS runtime token과 TS canonical snapshot이 수동 병행되므로, 값 추가/변경 시 CSS variables, TS object, JSON/Markdown snapshot 사이 drift check는 후속 설계 대상이다.
56
+
57
+ ### Generated docs boundary
58
+
59
+ `docs/theme-tokens.md`와 `docs/theme-tokens.json`은 token 이해를 돕는 generated/reference snapshot이다. source of truth 자체로 사용하지 않는다.
60
+
61
+ - token source는 package-local `src/data/*.ts`의 TS canonical snapshot과 SCSS token files의 runtime CSS variable source로 나뉜다.
62
+ - generated snapshot 재생성은 `tokens:doc` 등 별도 script/gate를 통해 수행한다.
63
+ - 이 문서 보정 단계에서는 generated content를 재생성하지 않는다.
64
+ - JSON/Markdown snapshot의 package publish 포함 여부는 별도 package contract gate에서 판단한다.
65
+
66
+ ### Source and mapping boundary
67
+
68
+ `_context/design-system/sot/current/**`는 reference/SOT layer이며 package code나 package docs 산출물에서 import하지 않는다. 실제 implementation mapping은 package-local Figma token export와 `docs/theme-token-mapping-guide.md`를 기준으로 확인한다.
69
+
70
+ 역할 분리:
71
+
72
+ - `_context/design-system/sot/current/**`: reference/SOT layer
73
+ - package-local Figma token export: implementation mapping 근거
74
+ - `docs/theme-token-mapping-guide.md`: Figma token -> canonical token -> CSS variable mapping guide
75
+ - `src/data/*.ts`: TS canonical token source
76
+ - SCSS token files: runtime CSS variable source
77
+ - `docs/theme-tokens.{json,md}`: generated/reference snapshot
78
+
79
+ ### Helper / Provider / Font / Types boundary
80
+
81
+ - Helpers: token key와 CSS variable/value 접근을 돕지만 token source를 대체하지 않는다. helper 예시가 실제 key와 맞지 않으면 문서 보정 후보로 본다.
82
+ - Provider: CSS를 import하지 않고 root DOM에 `.uds-theme-root` scope class만 부여한다. foundation CSS가 로드되면 `.uds-theme-root`의 layout/style 책임도 함께 적용될 수 있다.
83
+ - Fonts: `next/font/local` option과 font family contract를 제공한다. SCSS token layer의 `--font-family-*`와 `next/font/local` option의 `--theme-font-family-*`는 다른 변수 체계이며, `--theme-font-family-*`는 Next font class 적용을 전제로 한다.
84
+ - Types: `ThemeTokens` 등 token type은 object-first `typeof` 파생 구조를 따른다. `ThemeColorSemanticSection`, `ThemeSpacingScale`, `ThemeLayoutSizes` 같은 broad compatibility type은 기존 소비자 보호용으로 유지한다.
85
+
86
+ ### Compatibility and Panda boundary
87
+
88
+ compatibility alias와 deprecated token은 기존 소비자 보호 목적이므로 제거하거나 rename하지 않는다. `common_99/common_100`, `state.disabled/static_disabled`, `icon.disable/disabled` 같은 rename bridge와 CSS short alias는 compatibility layer로 유지한다. 제거 여부는 별도 compatibility gate가 필요하다.
89
+
90
+ Panda Foundation PoC는 아직 시작하지 않는다. token source mapping, CSS variable compatibility, SCSS coexistence, alias/deprecated carry-over, validation-first 기준, package export stability가 먼저 고정되어야 한다.
91
+
13
92
  ## 제공 도구 목록
14
93
 
94
+ 아래 목록은 현재 API inventory다. 실제 import 가능 경로는 package export map의 root와 명시 subpath를 기준으로 확인한다.
95
+
15
96
  - `ThemeProvider`
16
97
  - `ThemeProviderProps`
17
98
  - `themeTokens`
@@ -53,27 +134,31 @@ pnpm add @uniai-fe/uds-foundation
53
134
  - Figma 토큰 매핑 기준은 `docs/theme-token-mapping-guide.md`를 단일 참조로 사용한다.
54
135
  - `Sementic.Button.*`은 foundation이 아닌 `@uniai-fe/uds-primitives` 버튼 변수 토큰(`components/button/styles/variables.scss`)에서 운영한다.
55
136
  - `Sementic.Opacity.*`은 foundation semantic 토큰으로 별도 편입하지 않고, Figma node `{opacity}` source value를 `opacity` 속성에 직접 적용한다. (예: `30%`/`0.3` -> `opacity: 0.3;`)
56
- - Sass 소비자는 `@use "@uniai-fe/uds-foundation/css.scss";` 경로를 사용해야 하며, CSS-only 프로젝트는 기존대로 `import "@uniai-fe/uds-foundation/css";`로 토큰을 주입한다.
137
+ - Sass 소비자는 public entry인 `@use "@uniai-fe/uds-foundation/scss";`를 사용한다. package root의 `css.scss` 파일은 해당 entry가 가리키는 내부 forward 파일이며, consumer-facing 사용 예시에서는 직접 경로로 안내하지 않는다.
57
138
 
58
- ### 1) CSS 변수 주입
139
+ ### 1) 스타일 엔트리
59
140
 
60
- ```ts
61
- import "@uniai-fe/uds-foundation";
62
- ```
141
+ `@uniai-fe/uds-foundation` root import는 TS API, token data, helpers, provider, font, type surface를 소비하기 위한 entry다. CSS variable 주입 방법으로 안내하지 않는다.
63
142
 
64
- CSS 파일만 직접 사용하려면:
143
+ CSS-only 소비자는 루트 또는 global stylesheet에서 foundation CSS를 먼저 로드한다.
65
144
 
66
145
  ```ts
67
146
  import "@uniai-fe/uds-foundation/css";
68
147
  ```
69
148
 
149
+ Sass 소비자는 foundation Sass public entry를 사용한다.
150
+
151
+ ```scss
152
+ @use "@uniai-fe/uds-foundation/scss";
153
+ ```
154
+
70
155
  ```css
71
156
  .button-primary {
72
157
  color: var(--color-primary-default);
73
158
  padding: var(--spacing-padding-6);
74
159
  border-radius: var(--theme-radius-medium-1);
75
160
  font: var(--font-body-medium-weight) var(--font-body-medium-size) /
76
- var(--font-body-medium-line-height) var(--theme-font-family-pretendard);
161
+ var(--font-body-medium-line-height) var(--font-family-pretendard);
77
162
  }
78
163
  ```
79
164
 
@@ -98,7 +183,13 @@ Sass 소비자는 `@use "@uniai-fe/uds-foundation/scss";`로 전체 토큰을, `
98
183
  }
99
184
  ```
100
185
 
101
- ### 2) 토큰 데이터(JSON)
186
+ ### ThemeProvider와 CSS load 책임
187
+
188
+ `ThemeProvider`는 CSS를 import하지 않는다. Provider는 루트 DOM에 `.uds-theme-root` scope class를 부여하고, CSS load 책임은 service app root, global stylesheet, 또는 consumer setup이 가진다.
189
+
190
+ foundation CSS가 로드된 상태에서는 `.uds-theme-root`에 연결된 foundation scope/layout 스타일도 함께 적용되므로, Provider 책임을 CSS load 책임으로 축소해 설명하지 않는다.
191
+
192
+ ### 2) 토큰 데이터(TS object)
102
193
 
103
194
  ```ts
104
195
  import { themeTokens } from "@uniai-fe/uds-foundation/data/tokens";
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ export { spacing_gap, spacing_padding } from './data/spacing.js';
8
8
  export { layout_breakpoint, layout_radius, layout_size } from './data/layout.js';
9
9
  export { typography_tokens } from './data/typography.js';
10
10
  export { ThemeColorPrimitive, ThemeColorSemantic, ThemeColorSemanticSection, ThemeLayoutBreakpoint, ThemeLayoutRadius, ThemeLayoutSize, ThemeLayoutSizes, ThemeSpacingGap, ThemeSpacingPadding, ThemeSpacingScale, ThemeTokens, ThemeTypography, ThemeTypographyCategory, ThemeTypographyVariant } from './types/theme-tokens.js';
11
- import 'react/jsx-runtime';
12
11
  import 'react';
13
12
 
14
13
  /**
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { PropsWithChildren } from 'react';
3
3
 
4
4
  /**
@@ -20,6 +20,6 @@ type FoundationThemeProviderProps = {
20
20
  * @example
21
21
  * <ThemeProvider><App /></ThemeProvider>
22
22
  */
23
- declare function ThemeProvider({ children, className, }: PropsWithChildren<FoundationThemeProviderProps>): react_jsx_runtime.JSX.Element;
23
+ declare function ThemeProvider({ children, className, }: PropsWithChildren<FoundationThemeProviderProps>): react.JSX.Element;
24
24
 
25
25
  export { type FoundationThemeProviderProps, ThemeProvider };
@@ -1,3 +1,2 @@
1
1
  export { ThemeProvider, FoundationThemeProviderProps as ThemeProviderProps } from './ThemeProvider.js';
2
- import 'react/jsx-runtime';
3
2
  import 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-foundation",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "UNIAI Design System; Design Foundation Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -104,14 +104,14 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@types/node": "^24.12.3",
107
- "@types/react": "^19.2.14",
108
- "react": "^19.2.6",
107
+ "@types/react": "^19.2.16",
108
+ "react": "^19.2.7",
109
109
  "@uniai-fe/tsconfig": "workspace:*",
110
110
  "autoprefixer": "^10.5.0",
111
- "postcss": "^8.5.14",
111
+ "postcss": "^8.5.15",
112
112
  "postcss-cli": "^11.0.1",
113
113
  "prettier": "^3.8.3",
114
- "sass": "^1.99.0",
114
+ "sass": "^1.100.0",
115
115
  "tsup": "^8.5.1",
116
116
  "typescript": "5.9.3"
117
117
  }