@wirebound/theme-gallery 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 장병현
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.
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
- # Temporary Holding Version
1
+ # @wirebound/theme-gallery
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ wirebound 컴포넌트 카탈로그 × variant 표본 갤러리와 이어진 예제 페이지다. `wb-theme dev` 와 wirebound 에디터의 테마 미리보기가 이것을 그린다 — 테마 작성자는 보통 직접 깔지 않고 [`@wirebound/theme-kit`](https://github.com/jang2162/wirebound/tree/main/packages/theme-kit) 를 쓴다.
4
+
5
+ ## 설치
6
+
7
+ ```bash
8
+ npm install @wirebound/theme-gallery react
9
+ ```
10
+
11
+ - 저장소: https://github.com/jang2162/wirebound
12
+ - 라이선스: MIT
@@ -0,0 +1,157 @@
1
+ import { ComponentGroup, LayoutNavMenu, PageDocument, WbNode } from "@wirebound/schema";
2
+ import { PopupArea } from "@wirebound/renderer";
3
+ import { ThemeDefinition } from "@wirebound/theme-sdk";
4
+ import { ReactElement, RefObject } from "react";
5
+ //#region src/samples.d.ts
6
+ interface GallerySample {
7
+ /** 무엇을 보이는 표본인지. «DataGrid — 흔한 목록» 꼴. */
8
+ label: string;
9
+ node: WbNode;
10
+ /**
11
+ * 표본이 설 자리가 정해진 타입(`TabPanel` — 탭 몸통에만 선다)이면 그 부모 — 표본을 그 몸통에 넣어 그린다(`galleryItemDocument`). variant 는
12
+ * 표본 노드에 붙는다.
13
+ */
14
+ within?: WbNode;
15
+ /** 설 자리가 몸통이 아니거나 두 단 밑이면(그리드의 행 구역 · 행 안의 칸) 표본을 품은 부모를 짓는다 — `within` 대신. */
16
+ place?: (own: WbNode) => WbNode;
17
+ /**
18
+ * 격자(`ThemeGallery` 의 `layout="grid"`)에서 한 줄을 통째로 쓴다 — 표 · 검색 폼 · 폼 표처럼 넓어야 제대로 보이는 표본. 좁은 칸에 두면 테마가
19
+ * 아니라 칸 폭 탓에 깨져 보인다. 목록 판 · `wb-theme check` · `shots` 는 이 값을 안 본다.
20
+ */
21
+ wide?: boolean;
22
+ }
23
+ /**
24
+ * 갤러리 표본 그림 하나 — 16×9 PNG(324 바이트). `id` 는 그 바이트의 sha256 이다(그림 id 의 꼴 그대로). 갤러리 · `wb-theme check` · 축소판은 이 id 만
25
+ * `data:` 로 푼다(`galleryAssetUrl`) — 테마 작성자가 그림 든 자리표시자를 본다. 저장소 밖 주소를 싣지 않는다(오프라인 · 바깥 요청 없음).
26
+ */
27
+ declare const GALLERY_SAMPLE_IMAGE: {
28
+ readonly id: "e3e75095bf6b2a07389e46d9167ce506d6d76a6a6706ae3aa9c8f435b95a8709";
29
+ readonly url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAIAAAC0SDtlAAABC0lEQVR42g3LoY0FIRRA0W3mezyeAvAoDJIETfCgJ0GOweEQWIJ/ldwmdo4/fz+P8miP8ViP8wRP8hRP9Tye1zM923M94vn7RVRER0zERlwkRFKkRGrkibyRGdmRG5H4hYzK6IzJ2IzLhEzKlEzNPJk3MzM7czOSv9BQDd0wDdtwjdBIjdKojafxNmZjN25D2hc6qqM7pmM7rhM6qVM6tfN03s7s7M7tSP/CQA30wAzswA3CIA3KoA6ewTuYgz24AxlfWKiFXpiFXbhFWKRFWdTFs3gXc7EXdyHrCwd10AdzsAd3CId0KId6eA7vYR724R7kfEFQghaMYAUnBCEJRajCI7zCFLZwBRH+AdBrHdCHpvOyAAAAAElFTkSuQmCC";
30
+ readonly width: 16;
31
+ readonly height: 9;
32
+ };
33
+ /** 갤러리가 그리는 그림 주소 — 표본 그림만 푼다. 그 밖의 id 는 못 읽는 그림(`null`)이다. */
34
+ declare function galleryAssetUrl(id: string): string | null;
35
+ /** 그리기 값을 정한 자리표시자 표본의 이름 — 테마가 그 값을 따르는지 재는 자가 이 이름으로 칸을 고른다. */
36
+ declare const PLACEHOLDER_SET_SAMPLE = "Placeholder — 정한 색 · 모서리 · 여백";
37
+ /** 그 표본의 props. 색은 테마 기본값과 겹치지 않게 골랐다 — 겹치면 테마가 변수를 무시해도 같은 색이 나와 자가 못 가른다. */
38
+ declare const PLACEHOLDER_SET_PROPS: {
39
+ readonly label: "정한 값";
40
+ readonly width: 240;
41
+ readonly height: 64;
42
+ readonly background: "#fde047";
43
+ readonly border: "solid";
44
+ readonly borderColor: "#dc2626";
45
+ readonly radius: 12;
46
+ readonly color: "#7c2d12";
47
+ readonly fontSize: 15;
48
+ readonly padding: 6;
49
+ };
50
+ /**
51
+ * 카탈로그 컴포넌트마다 표본 노드. 갤러리가 manifest 가 선언한 variant 마다 한 번씩 그린다(`galleryItems`).
52
+ *
53
+ * **`variant` 를 적지 않는다** — 갤러리가 선언된 variant 를 붙인다. `variantFrom` 컴포넌트(`Text` · `Divider`)는
54
+ * 변형이 prop 에서 오므로 그 prop 을 바꾼 표본을 여럿 둔다. 표본은 스키마 검증을 지난다(`test/gallery.test.tsx`).
55
+ */
56
+ declare const GALLERY_SAMPLES: Readonly<Record<string, readonly GallerySample[]>>;
57
+ //#endregion
58
+ //#region src/gallery.d.ts
59
+ interface GalleryItem {
60
+ type: string;
61
+ /** 그린 variant. manifest 가 그 컴포넌트에 variant 를 선언하지 않았으면 `undefined`. */
62
+ variant: string | undefined;
63
+ sample: GallerySample;
64
+ }
65
+ /** 카탈로그 차례로, 컴포넌트마다 선언된 variant × 표본. 선언이 없으면 표본마다 한 번. */
66
+ declare function galleryItems(theme: ThemeDefinition): GalleryItem[];
67
+ /**
68
+ * 갤러리를 늘어놓는 꼴. `grid` — 카탈로그 그룹마다 머리를 두고 폭에 맞춘 격자(사람이 보는 미리보기). `list` — 한 줄에 칸 하나씩
69
+ * `galleryItems` 차례(`wb-theme shots` · `check` 가 연다 — 칸 폭이 창 폭이어야 창 폭 넘침을 재는 관문의 뜻이 선다).
70
+ */
71
+ type GalleryLayout = 'list' | 'grid';
72
+ interface GalleryGroup {
73
+ group: ComponentGroup;
74
+ label: string;
75
+ items: GalleryItem[];
76
+ }
77
+ /** `galleryItems` 를 카탈로그 그룹(`COMPONENT_GROUPS` 차례)으로 묶는다. 그룹 안은 `galleryItems` 차례 · 빈 그룹은 뺀다. */
78
+ declare function galleryGroups(theme: ThemeDefinition): GalleryGroup[];
79
+ /**
80
+ * 칸 하나의 문서 — 표본을 Page 뿌리 아래 둔다(표본이 뿌리 타입(Page · Popup)이면 그대로 · 설 자리가 정해진 표본은 그 부모의 몸통에 · 몸통 밖 자리면 `place` 가 지은 부모 안에). 갤러리와 `wb-theme check`
81
+ * (`@wirebound/theme-kit` 의 `checkTheme`)가 같은 문서를 그리게 이 함수 하나를 쓴다.
82
+ */
83
+ declare function galleryItemDocument(item: GalleryItem): PageDocument;
84
+ /**
85
+ * 카탈로그 × variant 표본을 늘어놓은 갤러리(spec 「`wb-theme dev`」 · 「토큰 편집」). kit dev 의 프레임 · `wb-theme shots`, 웹의 테마 미리보기
86
+ * (프로젝트 설정 › 테마 · 관리자 › 테마)가 이 컴포넌트를 쓴다. 뷰 하나가 던져도 그 칸만 폴백이 된다 — 렌더러가 노드마다 경계를 둔다.
87
+ */
88
+ declare function ThemeGallery(props: {
89
+ theme: ThemeDefinition;
90
+ tokens: Readonly<Record<string, string | number>>;
91
+ window?: Window;
92
+ showOverlay?: boolean;
93
+ /** 없으면 `grid`. */
94
+ layout?: GalleryLayout;
95
+ }): ReactElement;
96
+ //#endregion
97
+ //#region src/overlay.d.ts
98
+ /**
99
+ * 한 칸의 포커스 · 마커 겹쳐 보기 — 에디터가 그 노드를 골랐을 때의 외곽선과 코멘트 번호 자리. 좌표는 렌더러의
100
+ * `focusElement` · `markerPoint` 가 짓는다(에디터 · HTML 뷰어 · PPTX 와 같은 함수 — 여기서 따로 셈하면 작성자가 본 자리와
101
+ * 실제 자리가 갈린다). 칸(`position: relative`)의 왼쪽 위를 원점으로 옮겨 그린다.
102
+ */
103
+ declare function GalleryOverlay(props: {
104
+ stage: RefObject<HTMLDivElement | null>;
105
+ nodeId: string;
106
+ }): ReactElement | null;
107
+ //#endregion
108
+ //#region src/examples/documents.d.ts
109
+ type ExamplePageId = 'dashboard' | 'orders' | 'order' | 'order-form';
110
+ interface ExamplePage {
111
+ id: ExamplePageId;
112
+ title: string;
113
+ target: string;
114
+ document: PageDocument;
115
+ }
116
+ interface ExamplePopup {
117
+ target: string;
118
+ document: PageDocument;
119
+ }
120
+ /** 장 넷 — 이 차례가 장 이름 줄의 차례다. 처음 여는 장은 첫째(대시보드). */
121
+ declare const EXAMPLE_PAGES: readonly ExamplePage[];
122
+ /** 팝업 — 장 이름 줄에 없고 주문 상세의 «삭제» 가 연다. */
123
+ declare const EXAMPLE_POPUPS: readonly ExamplePopup[];
124
+ /** 팝업의 페이지 id — 메뉴 트리에 들되 내비(GNB · LNB · 브레드크럼브)에는 안 선다(팝업 레이아웃). */
125
+ declare const EXAMPLE_POPUP_ID = "order-delete";
126
+ /**
127
+ * **예제의 메뉴 트리** — 서브페이지 장의 틀(GNB · LNB · 브레드크럼브)을 `buildLayoutNav` 가 이것으로 짓는다(테마의 레이아웃 뷰가 그린다). 뿌리 메뉴
128
+ * 둘(«주문 관리» 와 페이지 없는 «회원 관리») · 하위 메뉴 하나 · 팝업 페이지 하나를 둬 내비의 갈래(하위 메뉴 · `pageId: null` · 팝업 거르기)가
129
+ * 갤러리 판에서도 선다. id 는 장 id 와 같다.
130
+ */
131
+ declare const EXAMPLE_MENU: readonly LayoutNavMenu[];
132
+ //#endregion
133
+ //#region src/examples/theme-examples.d.ts
134
+ /** 이 예제에 없는 페이지를 가리킨 이음 — 문서가 검증을 지나면 안 생긴다(케이스가 죽은 이음 0 을 잰다). */
135
+ declare function missingExample(target: string): string;
136
+ /**
137
+ * 예제 페이지 하나를 그리고(`renderDocument` 를 `LayoutFrame` 으로 감싼다 — 내비는 `EXAMPLE_MENU`) 이음 · 틀 링크를 받아 장을 바꾼다. 장 이름 줄 · 보기 전환은 호스트가 그린다(웹 미리보기 머리 ·
138
+ * kit 셸) — `page` 는 호스트가 든다.
139
+ *
140
+ * **미리보기 안의 누름은 바깥 화면을 안 움직인다.** 이동은 `onPageChange` 로만 알리고, `Link` 기본 뷰의 `<a href="#…">` 와 폼 제출의 기본 동작은
141
+ * 뿌리에서 막는다 — 렌더러는 submit 규칙이 걸린 노드만 막아(`packages/renderer/src/render.tsx` 의 `handlersFor`), 그대로 두면 iframe 해시가 바뀌어
142
+ * 브라우저 기록이 쌓이고 «뒤로» 가 미리보기 안을 돈다. 가운데 단추 누름(`auxclick`)도 막는다 — 안 막으면 그 이음을 새 탭으로 연다.
143
+ */
144
+ declare function ThemeExamples(props: {
145
+ theme: ThemeDefinition;
146
+ tokens: Readonly<Record<string, string | number>>;
147
+ window?: Window;
148
+ page: ExamplePageId;
149
+ onPageChange: (page: ExamplePageId) => void;
150
+ /** 팝업을 세울 구간 — 없으면 창 전체(`PopupLayer` 의 `area`). */
151
+ popupArea?: PopupArea;
152
+ /** 끈 틀 영역(`LayoutFrame` 의 `hiddenRegions`) — `wb-theme dev` 가 작성자가 끄는 판을 보인다. 없으면 다 켬. */
153
+ hiddenRegions?: readonly string[];
154
+ }): ReactElement;
155
+ //#endregion
156
+ export { EXAMPLE_MENU, EXAMPLE_PAGES, EXAMPLE_POPUPS, EXAMPLE_POPUP_ID, type ExamplePage, type ExamplePageId, type ExamplePopup, GALLERY_SAMPLES, GALLERY_SAMPLE_IMAGE, type GalleryGroup, type GalleryItem, type GalleryLayout, GalleryOverlay, type GallerySample, PLACEHOLDER_SET_PROPS, PLACEHOLDER_SET_SAMPLE, ThemeExamples, ThemeGallery, galleryAssetUrl, galleryGroups, galleryItemDocument, galleryItems, missingExample };
157
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/samples.ts","../src/gallery.tsx","../src/overlay.tsx","../src/examples/documents.ts","../src/examples/theme-examples.tsx"],"mappings":";;;;;UAEiB;;EAEf;EACA,MAAM;;;;;EAKN,SAAS;;EAET,SAAS,KAAK,WAAW;;;;;EAKzB;;;;;;cA4FW;;;;;;;iBAQG,gBAAgB;;cAKnB;;cAGA;;;;;;;;;;;;;;;;;;cAmBA,iBAAiB,SAAS,wBAAwB;;;UC/H9C;EACf;;EAEA;EACA,QAAQ;;;iBAIM,aAAa,OAAO,kBAAkB;;;;;KAc1C;UAEK;EACf,OAAO;EACP;EACA,OAAO;;;iBAIO,cAAc,OAAO,kBAAkB;;;;;iBAavC,oBAAoB,MAAM,cAAc;;;;;iBA4ExC,aAAa;EAC3B,OAAO;EACP,QAAQ,SAAS;EACjB,SAAS;EACT;;EAEA,SAAS;IACP;;;;;;;;iBCjIY,eAAe;EAAS,OAAO,UAAU;EAAwB;IAAmB;;;KCAxF;UAEK;EACf,IAAI;EACJ;EACA;EACA,UAAU;;UAGK;EACf;EACA,UAAU;;;cAqXC,wBAAwB;;cAQxB,yBAAyB;;cAGzB;;;;;;cAOA,uBAAuB;;;;iBC5YpB,eAAe;;;;;;;;;iBA8Bf,cAAc;EAC5B,OAAO;EACP,QAAQ,SAAS;EACjB,SAAS;EACT,MAAM;EACN,eAAe,MAAM;;EAErB,YAAY;;EAEZ;IACE"}