@wipco/sdui 0.1.0

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/dist/meta.d.ts ADDED
@@ -0,0 +1,343 @@
1
+ import { a as SduiPropValue, h as SduiNode } from './types-D5Tkrynd.js';
2
+
3
+ /**
4
+ * 시각 빌더용 컴포넌트 메타데이터 스키마.
5
+ *
6
+ * 레지스트리(`registry.tsx`)는 `{이름: 컴포넌트}` 맵일 뿐이라, 팔레트에 무엇을 띄울지·
7
+ * 속성 패널에 어떤 입력을 그릴지·이 노드에 저 노드를 떨어뜨려도 되는지를 알 방법이 없다.
8
+ * 그 빠진 정보를 채우는 것이 이 모듈이다.
9
+ *
10
+ * **런타임 번들에 실리면 안 된다.** 렌더러는 스펙을 해석해 컴포넌트에 넘길 뿐이라
11
+ * 이 데이터가 전혀 필요 없다. 그래서 `@wipco/sdui/meta` 별도 진입점으로 나가 있고,
12
+ * 이 디렉터리의 어떤 파일도 컴포넌트 구현이나 렌더러를 **값으로** import하지 않는다
13
+ * (타입만 가져온다 — `import type`은 컴파일 후 완전히 사라진다).
14
+ * 반대로 렌더러 쪽에서 이 모듈을 import해서도 안 된다.
15
+ */
16
+
17
+ /** 팔레트 그룹. 값은 `SDUI_CATEGORIES`에서 한국어 라벨로 풀린다. */
18
+ type SduiCategory = 'layout' | 'input' | 'display' | 'data' | 'feedback' | 'logic';
19
+ /**
20
+ * 속성 패널이 그릴 입력의 종류.
21
+ *
22
+ * `object`/`array`는 과제에 명시된 아홉 종류 밖이지만 뺄 수 없었다 —
23
+ * `Table.columns`, `Select.options`, `Form.rules`처럼 **실제 스펙이 쓰는 프롭의
24
+ * 상당수가 구조체**라서, 이 둘이 없으면 빌더가 그 값을 편집도 보존도 못 한다.
25
+ * 대신 구조를 눈감고 넘기지 않도록 `item`/`fields`로 내부 형태까지 기술한다.
26
+ */
27
+ type SduiPropKind = 'string' | 'number' | 'boolean'
28
+ /** 정해진 후보 중 하나 — `options` 참조 */
29
+ | 'enum'
30
+ /** CSS 색상 문자열 */
31
+ | 'color'
32
+ /** `ICON_PATHS`에 등록된 아이콘 이름 */
33
+ | 'icon'
34
+ /** ReactNode 자리 — 문자열이거나 `slots.<name>`으로 넘긴 노드 트리 */
35
+ | 'node'
36
+ /** `on*` 핸들러 자리 — {@link SduiAction} 또는 액션 배열 */
37
+ | 'action'
38
+ /**
39
+ * 리터럴이 거의 의미 없는 자리 — 편집기는 리터럴 입력 대신
40
+ * 바인딩 선택기($state/$item/$calc)를 기본으로 띄운다. (예: `Show.when`)
41
+ */
42
+ | 'binding'
43
+ /** 키-값 구조체 — `fields`가 있으면 그 필드들로, 없으면 JSON 편집기로 */
44
+ | 'object'
45
+ /** 동형 항목의 배열 — `item`의 필드로 행 편집기를 그린다 */
46
+ | 'array';
47
+ interface SduiEnumOption {
48
+ /** 스펙에 들어가는 값. Grid.columns처럼 숫자 어휘도 있어 number를 허용한다. */
49
+ value: string | number;
50
+ /** 한국어 표시 라벨 */
51
+ label: string;
52
+ description?: string;
53
+ /** 구현에는 없는데 실제 스펙이 쓰고 있는 값 — 지우지 말고 경고만 한다 */
54
+ legacy?: boolean;
55
+ }
56
+ /** 속성 패널의 섹션 구분. */
57
+ type SduiPropGroup = 'content' | 'appearance' | 'behavior' | 'layout' | 'data' | 'validation';
58
+ interface SduiPropMeta {
59
+ name: string;
60
+ kind: SduiPropKind;
61
+ /** 한국어 표시명 */
62
+ label: string;
63
+ /** 한국어 설명 — 속성 패널의 도움말 */
64
+ description?: string;
65
+ required?: boolean;
66
+ /** 컴포넌트 구현의 기본값. 편집기는 이 값과 같으면 스펙에서 프롭을 지워도 된다. */
67
+ default?: SduiPropValue;
68
+ /** kind가 'enum'일 때의 후보 */
69
+ options?: readonly SduiEnumOption[];
70
+ /**
71
+ * `$state`/`$item`/`$calc` 참조를 받아도 되는가.
72
+ *
73
+ * 렌더러의 `resolveValue`는 프롭 값 어디에 참조가 있든 풀어 주므로 기술적으로는
74
+ * 전부 바인딩 가능하다. 이 플래그는 "편집기가 바인딩 선택기를 **권해야 하는가**"를
75
+ * 뜻한다 — 값이 데이터에서 오는 자리는 true, 순수 표현 프롭은 생략한다.
76
+ */
77
+ bindable?: boolean;
78
+ /** kind가 'node'이고 `slots.<name>`으로도 줄 수 있는 프롭 */
79
+ slot?: boolean;
80
+ /** kind가 'action'일 때 핸들러에 들어오는 이벤트 값 설명 */
81
+ eventArg?: string;
82
+ /** kind가 'array'일 때 원소의 필드 정의 */
83
+ item?: readonly SduiPropMeta[];
84
+ /** kind가 'object'일 때 필드 정의. 없으면 자유 형식(JSON 편집기) */
85
+ fields?: readonly SduiPropMeta[];
86
+ group?: SduiPropGroup;
87
+ /** 기본 패널에서 접어 두는 고급 프롭 */
88
+ advanced?: boolean;
89
+ /**
90
+ * 이 라이브러리의 구현에는 없지만 **실제 ERP 스펙이 쓰고 있는** 프롭.
91
+ *
92
+ * 빌더가 모르는 프롭을 만나면 지워 버리는 것이 가장 위험한 실패라서, 구현과
93
+ * 어긋나더라도 메타데이터에는 남긴다. `description`에 어긋난 이유를 적어 둔다.
94
+ */
95
+ legacy?: boolean;
96
+ }
97
+ interface SduiChildrenMeta {
98
+ /** 기본 슬롯(children)을 받는가 */
99
+ accepts: boolean;
100
+ /** 문자열 자식(텍스트)을 받는가 */
101
+ text?: boolean;
102
+ /** 한국어 설명 — 캔버스의 드롭 존 안내 */
103
+ label?: string;
104
+ /** 허용 컴포넌트 화이트리스트. 생략하면 제한 없음 */
105
+ allow?: readonly string[];
106
+ /** 금지 컴포넌트 블랙리스트 */
107
+ deny?: readonly string[];
108
+ }
109
+ interface SduiSlotMeta {
110
+ name: string;
111
+ /** 한국어 표시명 */
112
+ label: string;
113
+ description?: string;
114
+ text?: boolean;
115
+ allow?: readonly string[];
116
+ }
117
+ /** 캔버스의 크기 조정 핸들이 무엇을 건드릴지. */
118
+ interface SduiResizeMeta {
119
+ /**
120
+ * - `none` 크기 조정 불가 (핸들을 그리지 않는다)
121
+ * - `enum` 단계형 `size` 프롭 — 핸들을 끌면 후보 사이를 스냅한다
122
+ * - `numeric` 숫자 프롭 직접 조정 (`height`, `rows` 등)
123
+ * - `style` `style.width` / `style.height`를 직접 쓴다
124
+ */
125
+ kind: 'none' | 'enum' | 'numeric' | 'style';
126
+ /** kind가 'enum'일 때 조정할 프롭 이름 */
127
+ prop?: string;
128
+ /** kind가 'enum'일 때 작은 값 → 큰 값 순서의 후보 */
129
+ values?: readonly string[];
130
+ /** kind가 'numeric'일 때 가로/세로에 대응하는 프롭 */
131
+ widthProp?: string;
132
+ heightProp?: string;
133
+ /** kind가 'numeric'일 때의 단위 — 'row'는 Textarea처럼 줄 수로 세는 경우 */
134
+ unit?: 'px' | 'row';
135
+ axis?: 'x' | 'y' | 'both';
136
+ }
137
+ interface SduiComponentMeta {
138
+ /** 스펙의 `component` 값 — 레지스트리 키와 정확히 같아야 한다 */
139
+ name: string;
140
+ /** 팔레트에 보일 한국어 표시명 */
141
+ label: string;
142
+ category: SduiCategory;
143
+ /** `ICON_PATHS`에 등록된 이름 (없는 이름이면 Icon이 점으로 대체한다) */
144
+ icon: string;
145
+ /** 한국어 한 줄 설명 */
146
+ description: string;
147
+ props: readonly SduiPropMeta[];
148
+ /**
149
+ * 노드 트리를 받는 이름 붙은 슬롯 중, **텍스트로는 채울 수 없는** 것들.
150
+ * `title`처럼 문자열로도 노드로도 줄 수 있는 자리는 props 쪽에 `slot: true`로 있다
151
+ * (한 프롭을 두 곳에 중복해 적지 않으려는 것 — `slotNamesOf`가 둘을 합쳐 준다).
152
+ */
153
+ slots?: readonly SduiSlotMeta[];
154
+ children: SduiChildrenMeta;
155
+ /** 팔레트에서 끌어다 놓을 때 삽입할 조각. 그 자체로 렌더 가능해야 한다. */
156
+ preset: SduiNode;
157
+ resize: SduiResizeMeta;
158
+ /** 특정 부모의 슬롯 안에서만 의미가 있는 컴포넌트 (예: Actions) */
159
+ slotOnly?: boolean;
160
+ /** 팔레트에서 숨긴다 — 어휘에는 있지만 직접 배치할 물건이 아닌 경우 */
161
+ hidden?: boolean;
162
+ }
163
+
164
+ /**
165
+ * 기본 어휘(`defaultRegistry`) 39종의 빌더 메타데이터.
166
+ *
167
+ * 프롭 목록은 `components.tsx`·`primitives.tsx`·`SduiForm.tsx`·`Can.tsx`·
168
+ * `DatePicker.tsx`·`search/SduiSearchResults.tsx`의 **실제 프롭 인터페이스**와,
169
+ * ERP 스펙 85개를 훑어 뽑은 **실사용 프롭 집합**을 합집합으로 덮는다.
170
+ * 구현에 없는데 스펙이 쓰고 있는 프롭은 지우지 않고 `legacy: true`로 남긴다 —
171
+ * 빌더가 모르는 프롭을 지워 버리는 것이 이 작업에서 가장 위험한 실패라서다.
172
+ * 처음 표시해 둔 6건(Alert.bar · Input.trailing · IconButton.variant ·
173
+ * ProgressBar.showValue · ProgressBar.tone="info" · Spacer.size)은 스펙을 고치는 대신
174
+ * 라이브러리 쪽에 구현해서 표시를 뗐다. 지금 남은 `legacy`는 없다.
175
+ *
176
+ * 값 import는 하나도 없다(전부 `import type`). 이 파일이 컴포넌트를 값으로
177
+ * 끌어오는 순간 메타데이터 진입점이 런타임 번들을 통째로 데려온다.
178
+ */
179
+
180
+ declare const ActionsMeta: SduiComponentMeta;
181
+ declare const CardMeta: SduiComponentMeta;
182
+ declare const ColMeta: SduiComponentMeta;
183
+ declare const DividerMeta: SduiComponentMeta;
184
+ declare const GridMeta: SduiComponentMeta;
185
+ declare const PageHeadMeta: SduiComponentMeta;
186
+ declare const RowMeta: SduiComponentMeta;
187
+ declare const SectionMeta: SduiComponentMeta;
188
+ declare const SpacerMeta: SduiComponentMeta;
189
+ declare const TabsMeta: SduiComponentMeta;
190
+ declare const ButtonMeta: SduiComponentMeta;
191
+ declare const CheckboxMeta: SduiComponentMeta;
192
+ declare const DatePickerMeta: SduiComponentMeta;
193
+ declare const DateRangePickerMeta: SduiComponentMeta;
194
+ declare const FieldMeta: SduiComponentMeta;
195
+ declare const FormMeta: SduiComponentMeta;
196
+ declare const IconButtonMeta: SduiComponentMeta;
197
+ declare const InputMeta: SduiComponentMeta;
198
+ declare const SelectMeta: SduiComponentMeta;
199
+ declare const SwitchMeta: SduiComponentMeta;
200
+ declare const TextareaMeta: SduiComponentMeta;
201
+ declare const BadgeMeta: SduiComponentMeta;
202
+ declare const IconMeta: SduiComponentMeta;
203
+ declare const KeyValueListMeta: SduiComponentMeta;
204
+ declare const StatCardMeta: SduiComponentMeta;
205
+ declare const TagMeta: SduiComponentMeta;
206
+ declare const TextMeta: SduiComponentMeta;
207
+ declare const PaginationMeta: SduiComponentMeta;
208
+ declare const TableMeta: SduiComponentMeta;
209
+ declare const SearchResultsMeta: SduiComponentMeta;
210
+ declare const RemoteSearchResultsMeta: SduiComponentMeta;
211
+ declare const AlertMeta: SduiComponentMeta;
212
+ declare const DialogMeta: SduiComponentMeta;
213
+ declare const EmptyStateMeta: SduiComponentMeta;
214
+ declare const ProgressBarMeta: SduiComponentMeta;
215
+ declare const SpinnerMeta: SduiComponentMeta;
216
+ declare const ToastMeta: SduiComponentMeta;
217
+ declare const CanMeta: SduiComponentMeta;
218
+ declare const ShowMeta: SduiComponentMeta;
219
+ /**
220
+ * 기본 어휘의 메타데이터.
221
+ *
222
+ * 타입이 `Record<SduiComponentName, ...>`이라, 레지스트리에 컴포넌트를 넣고 여기를
223
+ * 빠뜨리면 "속성 없음" 에러가, 여기에만 있고 레지스트리에 없으면 초과 프로퍼티 에러가
224
+ * 컴파일 시점에 난다 — 둘이 어긋난 채로는 빌드가 통과하지 않는다.
225
+ *
226
+ * 팔레트처럼 전체가 필요한 곳이 아니면 개별 export(`ButtonMeta` 등)를 쓰는 편이
227
+ * 번들에 유리하다 — 이 객체를 참조하는 순간 39종이 전부 따라온다.
228
+ */
229
+ declare const coreComponentMeta: {
230
+ Actions: SduiComponentMeta;
231
+ Alert: SduiComponentMeta;
232
+ Badge: SduiComponentMeta;
233
+ Button: SduiComponentMeta;
234
+ Can: SduiComponentMeta;
235
+ Card: SduiComponentMeta;
236
+ Checkbox: SduiComponentMeta;
237
+ Col: SduiComponentMeta;
238
+ DatePicker: SduiComponentMeta;
239
+ DateRangePicker: SduiComponentMeta;
240
+ Dialog: SduiComponentMeta;
241
+ Divider: SduiComponentMeta;
242
+ EmptyState: SduiComponentMeta;
243
+ Field: SduiComponentMeta;
244
+ Form: SduiComponentMeta;
245
+ Grid: SduiComponentMeta;
246
+ Icon: SduiComponentMeta;
247
+ IconButton: SduiComponentMeta;
248
+ Input: SduiComponentMeta;
249
+ KeyValueList: SduiComponentMeta;
250
+ PageHead: SduiComponentMeta;
251
+ Pagination: SduiComponentMeta;
252
+ ProgressBar: SduiComponentMeta;
253
+ RemoteSearchResults: SduiComponentMeta;
254
+ Row: SduiComponentMeta;
255
+ SearchResults: SduiComponentMeta;
256
+ Section: SduiComponentMeta;
257
+ Select: SduiComponentMeta;
258
+ Show: SduiComponentMeta;
259
+ Spacer: SduiComponentMeta;
260
+ Spinner: SduiComponentMeta;
261
+ StatCard: SduiComponentMeta;
262
+ Switch: SduiComponentMeta;
263
+ Table: SduiComponentMeta;
264
+ Tabs: SduiComponentMeta;
265
+ Tag: SduiComponentMeta;
266
+ Text: SduiComponentMeta;
267
+ Textarea: SduiComponentMeta;
268
+ Toast: SduiComponentMeta;
269
+ };
270
+
271
+ /**
272
+ * `@wipco/sdui/rich` 어휘(Chart·MapPreview)의 빌더 메타데이터.
273
+ *
274
+ * core 메타데이터와 파일을 나눈 이유는 rich 컴포넌트를 얹지 않은 소비자가
275
+ * 이 데이터를 받지 않게 하려는 것이다 — `rich.ts`가 core에서 분리된 것과 같은 이유.
276
+ * 여기도 값 import는 없다(`import type`만).
277
+ */
278
+
279
+ declare const ChartMeta: SduiComponentMeta;
280
+ declare const MapPreviewMeta: SduiComponentMeta;
281
+ /**
282
+ * rich 어휘의 메타데이터. core와 같은 방식으로 `richComponents`와 키가 어긋나면
283
+ * 컴파일 에러가 난다.
284
+ */
285
+ declare const richComponentMeta: {
286
+ Chart: SduiComponentMeta;
287
+ MapPreview: SduiComponentMeta;
288
+ };
289
+
290
+ /**
291
+ * 렌더러 내장 어휘의 메타데이터.
292
+ *
293
+ * ForEach는 레지스트리에 없다 — `SduiRenderer`가 노드를 보고 직접 반복 스코프를
294
+ * 만든다. 그래서 core/rich처럼 레지스트리 키와 타입으로 대조할 대상이 없고,
295
+ * 대신 여기 한 곳에 모아 둔다. 렌더러에 내장 어휘가 늘면 여기도 늘려야 한다
296
+ * (`scripts/check-meta.mts`가 `SduiRenderer.tsx`를 훑어 누락을 잡는다).
297
+ */
298
+
299
+ declare const ForEachMeta: SduiComponentMeta;
300
+ /** 렌더러 내장 어휘의 메타데이터 묶음. */
301
+ declare const builtinComponentMeta: {
302
+ ForEach: SduiComponentMeta;
303
+ };
304
+
305
+ /**
306
+ * `@wipco/sdui/meta` — 시각 페이지 빌더가 쓰는 컴포넌트 메타데이터.
307
+ *
308
+ * **런타임(`@wipco/sdui`)과 완전히 분리된 진입점이다.** 렌더러는 이 데이터를
309
+ * 전혀 참조하지 않으므로, 스펙만 렌더하는 소비자의 번들에는 한 바이트도 실리지 않는다.
310
+ * 반대로 이 디렉터리는 컴포넌트를 값으로 import하지 않아서, 빌더가 메타데이터만
311
+ * 가져다 팔레트를 그릴 때 컴포넌트 구현을 끌고 오지도 않는다.
312
+ *
313
+ * 팔레트 전체가 필요하지 않다면 개별 export(`ButtonMeta` 등)를 직접 import하는 편이
314
+ * 낫다 — 아래 `allComponentMeta` 같은 묶음은 참조하는 순간 어휘 전체를 데려온다.
315
+ */
316
+
317
+ /** 팔레트 그룹의 표시 순서와 한국어 라벨. */
318
+ declare const SDUI_CATEGORIES: ReadonlyArray<{
319
+ id: SduiCategory;
320
+ label: string;
321
+ }>;
322
+ /**
323
+ * 기본 어휘 + rich 어휘 + 렌더러 내장 어휘 전체.
324
+ * 편집기처럼 어휘 전부를 다뤄야 하는 쪽에서 쓴다.
325
+ */
326
+ declare const allComponentMeta: Record<string, SduiComponentMeta>;
327
+ /** 스펙의 `component` 이름으로 메타데이터를 찾는다. 없으면 undefined. */
328
+ declare function getComponentMeta(name: string, catalog?: Record<string, SduiComponentMeta>): SduiComponentMeta | undefined;
329
+ /**
330
+ * 이 컴포넌트가 받는 슬롯 이름 전부.
331
+ *
332
+ * `slots`(컴포넌트만 넣을 수 있는 자리)와 `props` 중 `slot: true`인 것(문자열로도
333
+ * 노드로도 줄 수 있는 자리)이 나뉘어 있어서, 드롭 대상 목록을 만들 때는 둘을 합쳐야 한다.
334
+ */
335
+ declare function slotNamesOf(meta: SduiComponentMeta): string[];
336
+ /** 팔레트에 실제로 노출할 항목만 분류별로 묶는다(hidden 제외). */
337
+ declare function paletteGroups(catalog?: Record<string, SduiComponentMeta>): Array<{
338
+ id: SduiCategory;
339
+ label: string;
340
+ items: SduiComponentMeta[];
341
+ }>;
342
+
343
+ export { ActionsMeta, AlertMeta, BadgeMeta, ButtonMeta, CanMeta, CardMeta, ChartMeta, CheckboxMeta, ColMeta, DatePickerMeta, DateRangePickerMeta, DialogMeta, DividerMeta, EmptyStateMeta, FieldMeta, ForEachMeta, FormMeta, GridMeta, IconButtonMeta, IconMeta, InputMeta, KeyValueListMeta, MapPreviewMeta, PageHeadMeta, PaginationMeta, ProgressBarMeta, RemoteSearchResultsMeta, RowMeta, SDUI_CATEGORIES, type SduiCategory, type SduiChildrenMeta, type SduiComponentMeta, type SduiEnumOption, type SduiPropGroup, type SduiPropKind, type SduiPropMeta, type SduiResizeMeta, type SduiSlotMeta, SearchResultsMeta, SectionMeta, SelectMeta, ShowMeta, SpacerMeta, SpinnerMeta, StatCardMeta, SwitchMeta, TableMeta, TabsMeta, TagMeta, TextMeta, TextareaMeta, ToastMeta, allComponentMeta, builtinComponentMeta, coreComponentMeta, getComponentMeta, paletteGroups, richComponentMeta, slotNamesOf };