@ezpg/app-ui 0.16.0 → 0.18.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.
Files changed (194) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/module/blocks/cover-photos/cover-photos.js +165 -0
  3. package/lib/module/blocks/cover-photos/cover-photos.js.map +1 -0
  4. package/lib/module/blocks/cover-photos/index.js +4 -0
  5. package/lib/module/blocks/cover-photos/index.js.map +1 -0
  6. package/lib/module/blocks/detail-editor/compare-slider.js +117 -0
  7. package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -0
  8. package/lib/module/blocks/detail-editor/detail-canvas.js +339 -0
  9. package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -0
  10. package/lib/module/blocks/detail-editor/detail-composer.js +254 -0
  11. package/lib/module/blocks/detail-editor/detail-composer.js.map +1 -0
  12. package/lib/module/blocks/detail-editor/detail-editor-template.js +102 -0
  13. package/lib/module/blocks/detail-editor/detail-editor-template.js.map +1 -0
  14. package/lib/module/blocks/detail-editor/detail-types.js +64 -0
  15. package/lib/module/blocks/detail-editor/detail-types.js.map +1 -0
  16. package/lib/module/blocks/detail-editor/draft-preview.js +39 -0
  17. package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -0
  18. package/lib/module/blocks/detail-editor/draft-strip.js +97 -0
  19. package/lib/module/blocks/detail-editor/draft-strip.js.map +1 -0
  20. package/lib/module/blocks/detail-editor/editor-bar.js +96 -0
  21. package/lib/module/blocks/detail-editor/editor-bar.js.map +1 -0
  22. package/lib/module/blocks/detail-editor/focus-context.js +5 -0
  23. package/lib/module/blocks/detail-editor/focus-context.js.map +1 -0
  24. package/lib/module/blocks/detail-editor/font-picker.js +74 -0
  25. package/lib/module/blocks/detail-editor/font-picker.js.map +1 -0
  26. package/lib/module/blocks/detail-editor/index.js +16 -0
  27. package/lib/module/blocks/detail-editor/index.js.map +1 -0
  28. package/lib/module/blocks/detail-editor/layout-picker.js +173 -0
  29. package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -0
  30. package/lib/module/blocks/detail-editor/photo-tray.js +144 -0
  31. package/lib/module/blocks/detail-editor/photo-tray.js.map +1 -0
  32. package/lib/module/blocks/detail-editor/structure-picker.js +75 -0
  33. package/lib/module/blocks/detail-editor/structure-picker.js.map +1 -0
  34. package/lib/module/blocks/detail-editor/tool-row.js +63 -0
  35. package/lib/module/blocks/detail-editor/tool-row.js.map +1 -0
  36. package/lib/module/blocks/index.js +3 -0
  37. package/lib/module/blocks/index.js.map +1 -1
  38. package/lib/module/blocks/slider-list/index.js +4 -0
  39. package/lib/module/blocks/slider-list/index.js.map +1 -0
  40. package/lib/module/blocks/slider-list/slider-list.js +45 -0
  41. package/lib/module/blocks/slider-list/slider-list.js.map +1 -0
  42. package/lib/module/blocks/task-tiles/task-tiles.js +1 -1
  43. package/lib/module/blocks/task-tiles/task-tiles.js.map +1 -1
  44. package/lib/module/charts/mini-bars.js +1 -1
  45. package/lib/module/charts/mini-bars.js.map +1 -1
  46. package/lib/module/components/button/button.js +10 -3
  47. package/lib/module/components/button/button.js.map +1 -1
  48. package/lib/module/components/floating-tab-bar/floating-tab-bar.js +103 -0
  49. package/lib/module/components/floating-tab-bar/floating-tab-bar.js.map +1 -0
  50. package/lib/module/components/floating-tab-bar/index.js +4 -0
  51. package/lib/module/components/floating-tab-bar/index.js.map +1 -0
  52. package/lib/module/components/list-row/list-row.js +9 -3
  53. package/lib/module/components/list-row/list-row.js.map +1 -1
  54. package/lib/module/components/section-tabs/index.js +4 -0
  55. package/lib/module/components/section-tabs/index.js.map +1 -0
  56. package/lib/module/components/section-tabs/section-tabs.js +73 -0
  57. package/lib/module/components/section-tabs/section-tabs.js.map +1 -0
  58. package/lib/module/components/slider/index.js +4 -0
  59. package/lib/module/components/slider/index.js.map +1 -0
  60. package/lib/module/components/slider/slider.js +151 -0
  61. package/lib/module/components/slider/slider.js.map +1 -0
  62. package/lib/module/index.js +3 -0
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/internal/flush-row.js +5 -0
  65. package/lib/module/internal/flush-row.js.map +1 -0
  66. package/lib/module/internal/pressable-base.js +3 -2
  67. package/lib/module/internal/pressable-base.js.map +1 -1
  68. package/lib/module/internal/tab-icon-pairs.js +25 -0
  69. package/lib/module/internal/tab-icon-pairs.js.map +1 -0
  70. package/lib/module/sortable/block-strip.js +151 -0
  71. package/lib/module/sortable/block-strip.js.map +1 -0
  72. package/lib/module/sortable/index.js +1 -0
  73. package/lib/module/sortable/index.js.map +1 -1
  74. package/lib/module/templates/index.js +1 -0
  75. package/lib/module/templates/index.js.map +1 -1
  76. package/lib/module/templates/parts.js +42 -2
  77. package/lib/module/templates/parts.js.map +1 -1
  78. package/lib/module/templates/sheet-form-template.js +174 -0
  79. package/lib/module/templates/sheet-form-template.js.map +1 -0
  80. package/lib/module/theme/base.js +4 -4
  81. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts +16 -0
  82. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts.map +1 -0
  83. package/lib/typescript/src/blocks/cover-photos/index.d.ts +2 -0
  84. package/lib/typescript/src/blocks/cover-photos/index.d.ts.map +1 -0
  85. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +8 -0
  86. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -0
  87. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +13 -0
  88. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -0
  89. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts +25 -0
  90. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts.map +1 -0
  91. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts +13 -0
  92. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts.map +1 -0
  93. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +55 -0
  94. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -0
  95. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +8 -0
  96. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -0
  97. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts +16 -0
  98. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts.map +1 -0
  99. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts +18 -0
  100. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts.map +1 -0
  101. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +6 -0
  102. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -0
  103. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts +8 -0
  104. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts.map +1 -0
  105. package/lib/typescript/src/blocks/detail-editor/index.d.ts +14 -0
  106. package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -0
  107. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +11 -0
  108. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -0
  109. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts +15 -0
  110. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts.map +1 -0
  111. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts +13 -0
  112. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts.map +1 -0
  113. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts +13 -0
  114. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts.map +1 -0
  115. package/lib/typescript/src/blocks/index.d.ts +3 -0
  116. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  117. package/lib/typescript/src/blocks/slider-list/index.d.ts +2 -0
  118. package/lib/typescript/src/blocks/slider-list/index.d.ts.map +1 -0
  119. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts +17 -0
  120. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts.map +1 -0
  121. package/lib/typescript/src/components/button/button.d.ts.map +1 -1
  122. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts +20 -0
  123. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts.map +1 -0
  124. package/lib/typescript/src/components/floating-tab-bar/index.d.ts +2 -0
  125. package/lib/typescript/src/components/floating-tab-bar/index.d.ts.map +1 -0
  126. package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
  127. package/lib/typescript/src/components/section-tabs/index.d.ts +2 -0
  128. package/lib/typescript/src/components/section-tabs/index.d.ts.map +1 -0
  129. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts +14 -0
  130. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts.map +1 -0
  131. package/lib/typescript/src/components/slider/index.d.ts +2 -0
  132. package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
  133. package/lib/typescript/src/components/slider/slider.d.ts +14 -0
  134. package/lib/typescript/src/components/slider/slider.d.ts.map +1 -0
  135. package/lib/typescript/src/index.d.ts +3 -0
  136. package/lib/typescript/src/index.d.ts.map +1 -1
  137. package/lib/typescript/src/internal/flush-row.d.ts +2 -0
  138. package/lib/typescript/src/internal/flush-row.d.ts.map +1 -0
  139. package/lib/typescript/src/internal/pressable-base.d.ts +2 -1
  140. package/lib/typescript/src/internal/pressable-base.d.ts.map +1 -1
  141. package/lib/typescript/src/internal/tab-icon-pairs.d.ts +23 -0
  142. package/lib/typescript/src/internal/tab-icon-pairs.d.ts.map +1 -0
  143. package/lib/typescript/src/sortable/block-strip.d.ts +14 -0
  144. package/lib/typescript/src/sortable/block-strip.d.ts.map +1 -0
  145. package/lib/typescript/src/sortable/index.d.ts +1 -0
  146. package/lib/typescript/src/sortable/index.d.ts.map +1 -1
  147. package/lib/typescript/src/templates/index.d.ts +2 -0
  148. package/lib/typescript/src/templates/index.d.ts.map +1 -1
  149. package/lib/typescript/src/templates/parts.d.ts +2 -1
  150. package/lib/typescript/src/templates/parts.d.ts.map +1 -1
  151. package/lib/typescript/src/templates/sheet-form-template.d.ts +31 -0
  152. package/lib/typescript/src/templates/sheet-form-template.d.ts.map +1 -0
  153. package/lib/typescript/src/theme/base.d.ts +4 -4
  154. package/package.json +1 -1
  155. package/src/blocks/cover-photos/cover-photos.tsx +176 -0
  156. package/src/blocks/cover-photos/index.ts +5 -0
  157. package/src/blocks/detail-editor/compare-slider.tsx +112 -0
  158. package/src/blocks/detail-editor/detail-canvas.tsx +369 -0
  159. package/src/blocks/detail-editor/detail-composer.tsx +261 -0
  160. package/src/blocks/detail-editor/detail-editor-template.tsx +109 -0
  161. package/src/blocks/detail-editor/detail-types.ts +113 -0
  162. package/src/blocks/detail-editor/draft-preview.tsx +34 -0
  163. package/src/blocks/detail-editor/draft-strip.tsx +102 -0
  164. package/src/blocks/detail-editor/editor-bar.tsx +116 -0
  165. package/src/blocks/detail-editor/focus-context.ts +7 -0
  166. package/src/blocks/detail-editor/font-picker.tsx +75 -0
  167. package/src/blocks/detail-editor/index.ts +57 -0
  168. package/src/blocks/detail-editor/layout-picker.tsx +158 -0
  169. package/src/blocks/detail-editor/photo-tray.tsx +140 -0
  170. package/src/blocks/detail-editor/structure-picker.tsx +75 -0
  171. package/src/blocks/detail-editor/tool-row.tsx +66 -0
  172. package/src/blocks/index.tsx +3 -0
  173. package/src/blocks/slider-list/index.ts +5 -0
  174. package/src/blocks/slider-list/slider-list.tsx +57 -0
  175. package/src/blocks/task-tiles/task-tiles.tsx +1 -1
  176. package/src/charts/mini-bars.tsx +1 -1
  177. package/src/components/button/button.tsx +10 -3
  178. package/src/components/floating-tab-bar/floating-tab-bar.tsx +121 -0
  179. package/src/components/floating-tab-bar/index.ts +7 -0
  180. package/src/components/list-row/list-row.tsx +7 -1
  181. package/src/components/section-tabs/index.ts +5 -0
  182. package/src/components/section-tabs/section-tabs.tsx +87 -0
  183. package/src/components/slider/index.ts +1 -0
  184. package/src/components/slider/slider.tsx +142 -0
  185. package/src/index.tsx +3 -0
  186. package/src/internal/flush-row.ts +3 -0
  187. package/src/internal/pressable-base.tsx +3 -1
  188. package/src/internal/tab-icon-pairs.ts +22 -0
  189. package/src/sortable/block-strip.tsx +168 -0
  190. package/src/sortable/index.ts +5 -0
  191. package/src/templates/index.ts +5 -0
  192. package/src/templates/parts.tsx +46 -1
  193. package/src/templates/sheet-form-template.tsx +190 -0
  194. package/src/theme/base.ts +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @ezpg/app-ui
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - SliderList: 축 이름 아래 슬라이더 한 줄을 구분선으로 촘촘히 쌓는 묶음
8
+ - 상품 시트: SheetFormTemplate(뒤로 · 제목 · 글자 버튼 위 막대 · 탭 자리 · 회색 바탕 블록 스크롤 · 임시저장 + 등록 나란히) · SheetBlock(흰 블록, 안의 ListRow 좌우 여백 없음) · SectionTabs(구역 탭 · 확인 필요 점) · CoverPhotos(대표 2×2 · 추가 칸 · 업로드 상태)
9
+ - 상세페이지: StructurePicker(구성 그림 고르기) · DraftPreview(초안 미리보기 자르기)
10
+ - BottomBar split(두 버튼 나란히)
11
+
12
+ ## 0.17.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 상세페이지 편집기 2차: 페이지 배경 하나 · 선택 표시 겹쳐 그리기 · 줄 간격 · 자간 · 블록 위아래 여백 · 고른 블록 자동 스크롤 · EditorPanel 좌우 여백 · DETAIL_COLORS
17
+ - Slider: 눈금 없는 연속 슬라이더(접근성 증감 10분의 1) · onSlidingStart
18
+ - Button: 주 버튼 테두리형(흰 바탕 · 1.5 주황 테두리 · 주황 글자), 비활성은 회색 테두리 · 회색 글자
19
+ - 주황 줄이기: 섹션 제목 · 목록 앞 아이콘 · 할 일 아이콘 회색
20
+ - FloatingTabBar: 떠 있는 아래 탭(높이 64 · 가장자리 16 · 선택 칸 48 옅은 브랜드색 · 선택 아이콘 채움 · 할 일 점 배지 6), floatingTabBarSpace
21
+ - 아이콘 Phosphor 2.1.1(MIT) 선 · 채움 5종
22
+ - 상세페이지 편집기: DetailCanvas(블록 그리기 · 선택 핸들) · DetailComposer(첨부 · 요청 입력) · DraftStrip(초안 썸네일 줄) · LayoutPicker(블록 배치 7종) · ToolRow · FontPicker(글꼴 4종) · EditorBar · DetailEditorTemplate
23
+
3
24
  ## 0.16.0
4
25
 
5
26
  ### Minor Changes
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ import { useState } from 'react';
4
+ import { ActivityIndicator, View } from 'react-native';
5
+ import { Photo } from "../../components/photo/photo.js";
6
+ import { Text } from "../../components/text/text.js";
7
+ import { PlusGlyph } from "../../internal/glyphs.js";
8
+ import { PressableBase } from "../../internal/pressable-base.js";
9
+ import { useTheme } from "../../theme/theme-provider.js";
10
+ import { makeStyles } from "../../utils/styles.js";
11
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
+ const COLUMNS = 4;
13
+ const ADD = '__add';
14
+ const useStyles = makeStyles(t => ({
15
+ top: {
16
+ flexDirection: 'row',
17
+ gap: t.space[2]
18
+ },
19
+ side: {
20
+ flexDirection: 'row',
21
+ flexWrap: 'wrap',
22
+ gap: t.space[2]
23
+ },
24
+ rest: {
25
+ flexDirection: 'row',
26
+ flexWrap: 'wrap',
27
+ gap: t.space[2],
28
+ marginTop: t.space[2]
29
+ },
30
+ fill: {
31
+ position: 'absolute',
32
+ top: 0,
33
+ right: 0,
34
+ bottom: 0,
35
+ left: 0,
36
+ alignItems: 'center',
37
+ justifyContent: 'center',
38
+ borderRadius: t.radius.md
39
+ },
40
+ dim: {
41
+ backgroundColor: `${t.colors.background}B3`
42
+ },
43
+ failed: {
44
+ backgroundColor: `${t.colors.background}D9`
45
+ },
46
+ tag: {
47
+ position: 'absolute',
48
+ top: t.space[2],
49
+ left: t.space[2],
50
+ paddingHorizontal: t.space[2],
51
+ borderRadius: t.radius.full,
52
+ backgroundColor: t.colors.foreground
53
+ },
54
+ tagText: {
55
+ color: t.colors.surface
56
+ },
57
+ add: {
58
+ alignItems: 'center',
59
+ justifyContent: 'center',
60
+ gap: t.space[1],
61
+ borderRadius: t.radius.md,
62
+ borderWidth: 1,
63
+ borderStyle: 'dashed',
64
+ borderColor: t.colors.input
65
+ }
66
+ }));
67
+ export function CoverPhotos({
68
+ photos,
69
+ max = 10,
70
+ onAdd,
71
+ onPress,
72
+ onRetry,
73
+ style
74
+ }) {
75
+ const t = useTheme();
76
+ const s = useStyles();
77
+ const [width, setWidth] = useState(0);
78
+ const gap = t.space[2];
79
+ const small = width > 0 ? (width - gap * (COLUMNS - 1)) / COLUMNS : 0;
80
+ const big = small * 2 + gap;
81
+ const cells = [...photos.slice(1).map(p => p.id), ...(onAdd && photos.length < max ? [ADD] : [])];
82
+ const tile = (id, size) => {
83
+ if (id === ADD) {
84
+ return /*#__PURE__*/_jsxs(PressableBase, {
85
+ accessibilityLabel: `사진 추가, ${max}장 중 ${photos.length}장`,
86
+ onPress: onAdd,
87
+ style: [s.add, {
88
+ width: size,
89
+ height: size
90
+ }],
91
+ children: [/*#__PURE__*/_jsx(PlusGlyph, {
92
+ color: t.colors.foreground,
93
+ size: 22
94
+ }), /*#__PURE__*/_jsxs(Text, {
95
+ variant: "caption",
96
+ tone: "muted",
97
+ children: [photos.length, "/", max]
98
+ })]
99
+ }, ADD);
100
+ }
101
+ const index = photos.findIndex(p => p.id === id);
102
+ const photo = photos[index];
103
+ if (!photo) return null;
104
+ const label = `사진 ${index + 1}${index === 0 ? ', 대표' : ''}`;
105
+ return /*#__PURE__*/_jsxs(PressableBase, {
106
+ accessibilityLabel: photo.status === 'failed' ? `${label}, 업로드 실패, 다시 시도` : label,
107
+ disabled: photo.status === 'uploading',
108
+ onPress: () => photo.status === 'failed' ? onRetry?.(photo.id) : onPress?.(photo.id),
109
+ style: {
110
+ width: size,
111
+ height: size
112
+ },
113
+ children: [/*#__PURE__*/_jsx(Photo, {
114
+ source: {
115
+ uri: photo.uri
116
+ },
117
+ radius: t.radius.md,
118
+ style: {
119
+ width: size,
120
+ height: size
121
+ }
122
+ }), index === 0 && !photo.status ? /*#__PURE__*/_jsx(View, {
123
+ style: s.tag,
124
+ children: /*#__PURE__*/_jsx(Text, {
125
+ variant: "caption",
126
+ weight: "bold",
127
+ style: s.tagText,
128
+ children: "\uB300\uD45C"
129
+ })
130
+ }) : null, photo.status === 'uploading' ? /*#__PURE__*/_jsx(View, {
131
+ style: [s.fill, s.dim],
132
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
133
+ color: t.colors.foreground
134
+ })
135
+ }) : photo.status === 'failed' ? /*#__PURE__*/_jsx(View, {
136
+ style: [s.fill, s.failed],
137
+ children: /*#__PURE__*/_jsx(Text, {
138
+ variant: "caption",
139
+ weight: "bold",
140
+ tone: "danger",
141
+ children: "\uB2E4\uC2DC"
142
+ })
143
+ }) : null]
144
+ }, photo.id);
145
+ };
146
+ return /*#__PURE__*/_jsx(View, {
147
+ style: style,
148
+ onLayout: event => setWidth(event.nativeEvent.layout.width),
149
+ children: width > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
150
+ children: [/*#__PURE__*/_jsxs(View, {
151
+ style: s.top,
152
+ children: [photos[0] ? tile(photos[0].id, big) : tile(ADD, big), /*#__PURE__*/_jsx(View, {
153
+ style: [s.side, {
154
+ width: big
155
+ }],
156
+ children: (photos[0] ? cells : []).slice(0, 4).map(id => tile(id, small))
157
+ })]
158
+ }), photos[0] && cells.length > 4 ? /*#__PURE__*/_jsx(View, {
159
+ style: s.rest,
160
+ children: cells.slice(4).map(id => tile(id, small))
161
+ }) : null]
162
+ }) : null
163
+ });
164
+ }
165
+ //# sourceMappingURL=cover-photos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","ActivityIndicator","View","Photo","Text","PlusGlyph","PressableBase","useTheme","makeStyles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","COLUMNS","ADD","useStyles","t","top","flexDirection","gap","space","side","flexWrap","rest","marginTop","fill","position","right","bottom","left","alignItems","justifyContent","borderRadius","radius","md","dim","backgroundColor","colors","background","failed","tag","paddingHorizontal","full","foreground","tagText","color","surface","add","borderWidth","borderStyle","borderColor","input","CoverPhotos","photos","max","onAdd","onPress","onRetry","style","s","width","setWidth","small","big","cells","slice","map","p","id","length","tile","size","accessibilityLabel","height","children","variant","tone","index","findIndex","photo","label","status","disabled","source","uri","weight","onLayout","event","nativeEvent","layout"],"sourceRoot":"../../../../src","sources":["blocks/cover-photos/cover-photos.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SACEC,iBAAiB,EACjBC,IAAI,QAGC,cAAc;AACrB,SAASC,KAAK,QAAQ,iCAA8B;AACpD,SAASC,IAAI,QAAQ,+BAA4B;AACjD,SAASC,SAAS,QAAQ,0BAAuB;AACjD,SAASC,aAAa,QAAQ,kCAA+B;AAC7D,SAASC,QAAQ,QAAQ,+BAA4B;AACrD,SAASC,UAAU,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAiBhD,MAAMC,OAAO,GAAG,CAAC;AACjB,MAAMC,GAAG,GAAG,OAAO;AAEnB,MAAMC,SAAS,GAAGT,UAAU,CAAEU,CAAC,KAAM;EACnCC,GAAG,EAAE;IAAEC,aAAa,EAAE,KAAK;IAAEC,GAAG,EAAEH,CAAC,CAACI,KAAK,CAAC,CAAC;EAAE,CAAC;EAC9CC,IAAI,EAAE;IAAEH,aAAa,EAAE,KAAK;IAAEI,QAAQ,EAAE,MAAM;IAAEH,GAAG,EAAEH,CAAC,CAACI,KAAK,CAAC,CAAC;EAAE,CAAC;EACjEG,IAAI,EAAE;IACJL,aAAa,EAAE,KAAK;IACpBI,QAAQ,EAAE,MAAM;IAChBH,GAAG,EAAEH,CAAC,CAACI,KAAK,CAAC,CAAC,CAAC;IACfI,SAAS,EAAER,CAAC,CAACI,KAAK,CAAC,CAAC;EACtB,CAAC;E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jB,MAAM,CAAC,CAAC,CAAC,CAACe,EAAE,EAAEL,GAAG,CAAC,GAAGO,IAAI,CAACxD,GAAG,EAAEiD,GAAG,CAAC,eACrDvD,IAAA,CAACR,IAAI;UAAC0D,KAAK,EAAE,CAACC,CAAC,CAACtC,IAAI,EAAE;YAAEuC,KAAK,EAAEG;UAAI,CAAC,CAAE;UAAAW,QAAA,EACnC,CAACrB,MAAM,CAAC,CAAC,CAAC,GAAGW,KAAK,GAAG,EAAE,EACrBC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CACXC,GAAG,CAAEE,EAAE,IAAKE,IAAI,CAACF,EAAE,EAAEN,KAAK,CAAC;QAAC,CAC3B,CAAC;MAAA,CACH,CAAC,EACNT,MAAM,CAAC,CAAC,CAAC,IAAIW,KAAK,CAACK,MAAM,GAAG,CAAC,gBAC5B7D,IAAA,CAACR,IAAI;QAAC0D,KAAK,EAAEC,CAAC,CAACpC,IAAK;QAAAmD,QAAA,EACjBV,KAAK,CAACC,KAAK,CAAC,CAAC,CAAC,CAACC,GAAG,CAAEE,EAAE,IAAKE,IAAI,CAACF,EAAE,EAAEN,KAAK,CAAC;MAAC,CACxC,CAAC,GACL,IAAI;IAAA,CACR,CAAC,GACD;EAAI,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { CoverPhotos } from "./cover-photos.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CoverPhotos"],"sourceRoot":"../../../../src","sources":["blocks/cover-photos/index.ts"],"mappings":";;AAAA,SACEA,WAAW,QAGN,mBAAgB","ignoreList":[]}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ import { useRef, useState } from 'react';
4
+ import { Image, PanResponder, View } from 'react-native';
5
+ import { makeStyles } from "../../utils/styles.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const KNOB = 32;
8
+ const useStyles = makeStyles(t => ({
9
+ root: {
10
+ width: '100%',
11
+ overflow: 'hidden',
12
+ backgroundColor: t.colors.muted
13
+ },
14
+ fill: {
15
+ position: 'absolute',
16
+ left: 0,
17
+ top: 0,
18
+ bottom: 0
19
+ },
20
+ clip: {
21
+ position: 'absolute',
22
+ left: 0,
23
+ top: 0,
24
+ bottom: 0,
25
+ overflow: 'hidden'
26
+ },
27
+ line: {
28
+ position: 'absolute',
29
+ top: 0,
30
+ bottom: 0,
31
+ width: 2,
32
+ backgroundColor: t.colors.surface
33
+ },
34
+ knob: {
35
+ position: 'absolute',
36
+ top: '50%',
37
+ marginTop: -KNOB / 2,
38
+ width: KNOB,
39
+ height: KNOB,
40
+ borderRadius: KNOB / 2,
41
+ backgroundColor: t.colors.surface,
42
+ boxShadow: t.shadow.md
43
+ },
44
+ grip: {
45
+ flex: 1,
46
+ margin: t.space[2],
47
+ borderLeftWidth: 2,
48
+ borderRightWidth: 2,
49
+ borderColor: t.colors.input
50
+ }
51
+ }));
52
+ export function CompareSlider({
53
+ before,
54
+ after,
55
+ aspectRatio = 4 / 5,
56
+ label = '원본과 비교'
57
+ }) {
58
+ const s = useStyles();
59
+ const [width, setWidth] = useState(0);
60
+ const [split, setSplit] = useState(0.5);
61
+ const widthRef = useRef(0);
62
+ const follow = e => setSplit(Math.min(1, Math.max(0, e.nativeEvent.locationX / (widthRef.current || 1))));
63
+ const pan = useRef(PanResponder.create({
64
+ onStartShouldSetPanResponder: () => true,
65
+ onMoveShouldSetPanResponder: () => true,
66
+ onPanResponderGrant: follow,
67
+ onPanResponderMove: follow
68
+ })).current;
69
+ const layout = e => {
70
+ widthRef.current = e.nativeEvent.layout.width;
71
+ setWidth(e.nativeEvent.layout.width);
72
+ };
73
+ const x = width * split;
74
+ return /*#__PURE__*/_jsxs(View, {
75
+ onLayout: layout,
76
+ accessibilityLabel: label,
77
+ accessibilityRole: "adjustable",
78
+ style: [s.root, {
79
+ aspectRatio
80
+ }],
81
+ ...pan.panHandlers,
82
+ children: [/*#__PURE__*/_jsx(Image, {
83
+ source: {
84
+ uri: after
85
+ },
86
+ resizeMode: "cover",
87
+ style: [s.fill, {
88
+ width
89
+ }]
90
+ }), /*#__PURE__*/_jsx(View, {
91
+ style: [s.clip, {
92
+ width: x
93
+ }],
94
+ children: /*#__PURE__*/_jsx(Image, {
95
+ source: {
96
+ uri: before
97
+ },
98
+ resizeMode: "cover",
99
+ style: [s.fill, {
100
+ width
101
+ }]
102
+ })
103
+ }), /*#__PURE__*/_jsx(View, {
104
+ style: [s.line, {
105
+ left: x - 1
106
+ }]
107
+ }), /*#__PURE__*/_jsx(View, {
108
+ style: [s.knob, {
109
+ left: x - KNOB / 2
110
+ }],
111
+ children: /*#__PURE__*/_jsx(View, {
112
+ style: s.grip
113
+ })
114
+ })]
115
+ });
116
+ }
117
+ //# sourceMappingURL=compare-slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRef","useState","Image","PanResponder","View","makeStyles","jsx","_jsx","jsxs","_jsxs","KNOB","useStyles","t","root","width","overflow","backgroundColor","colors","muted","fill","position","left","top","bottom","clip","line","surface","knob","marginTop","height","borderRadius","boxShadow","shadow","md","grip","flex","margin","space","borderLeftWidth","borderRightWidth","borderColor","input","CompareSlider","before","after","aspectRatio","label","s","setWidth","split","setSplit","widthRef","follow","e","Math","min","max","nativeEvent","locationX","current","pan","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderGrant","onPanResponderMove","layout","x","onLayout","accessibilityLabel","accessibilityRole","style","panHandlers","children","source","uri","resizeMode"],"sourceRoot":"../../../../src","sources":["blocks/detail-editor/compare-slider.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACxC,SACEC,KAAK,EACLC,YAAY,EACZC,IAAI,QAGC,cAAc;AACrB,SAASC,UAAU,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAShD,MAAMC,IAAI,GA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AEgC;IAAY,CAAC,CAAE;IAAA,GAC7Be,GAAG,CAACY,WAAW;IAAAC,QAAA,gBAEnBlE,IAAA,CAACL,KAAK;MACJwE,MAAM,EAAE;QAAEC,GAAG,EAAE/B;MAAM,CAAE;MACvBgC,UAAU,EAAC,OAAO;MAClBL,KAAK,EAAE,CAACxB,CAAC,CAAC5B,IAAI,EAAE;QAAEL;MAAM,CAAC;IAAE,CAC5B,CAAC,eACFP,IAAA,CAACH,IAAI;MAACmE,KAAK,EAAE,CAACxB,CAAC,CAACvB,IAAI,EAAE;QAAEV,KAAK,EAAEqD;MAAE,CAAC,CAAE;MAAAM,QAAA,eAClClE,IAAA,CAACL,KAAK;QACJwE,MAAM,EAAE;UAAEC,GAAG,EAAEhC;QAAO,CAAE;QACxBiC,UAAU,EAAC,OAAO;QAClBL,KAAK,EAAE,CAACxB,CAAC,CAAC5B,IAAI,EAAE;UAAEL;QAAM,CAAC;MAAE,CAC5B;IAAC,CACE,CAAC,eACPP,IAAA,CAACH,IAAI;MAACmE,KAAK,EAAE,CAACxB,CAAC,CAACtB,IAAI,EAAE;QAAEJ,IAAI,EAAE8C,CAAC,GAAG;MAAE,CAAC;IAAE,CAAE,CAAC,eAC1C5D,IAAA,CAACH,IAAI;MAACmE,KAAK,EAAE,CAACxB,CAAC,CAACpB,IAAI,EAAE;QAAEN,IAAI,EAAE8C,CAAC,GAAGzD,IAAI,GAAG;MAAE,CAAC,CAAE;MAAA+D,QAAA,eAC5ClE,IAAA,CAACH,IAAI;QAACmE,KAAK,EAAExB,CAAC,CAACb;MAAK,CAAE;IAAC,CACnB,CAAC;EAAA,CACH,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,339 @@
1
+ "use strict";
2
+
3
+ import { createContext, useContext, useEffect, useMemo, useRef } from 'react';
4
+ import { Image, Text as RNText, View } from 'react-native';
5
+ import { PressableBase } from "../../internal/pressable-base.js";
6
+ import { useTheme } from "../../theme/theme-provider.js";
7
+ import { makeStyles } from "../../utils/styles.js";
8
+ import { DetailFocusContext } from "./focus-context.js";
9
+ import { DETAIL_FONT_FAMILY, detailBlockSpace, detailFontSize, detailLineHeight, detailTracking } from "./detail-types.js";
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const HANDLE = 10;
12
+ function Tap({
13
+ onPress,
14
+ label,
15
+ style,
16
+ children
17
+ }) {
18
+ if (!onPress) {
19
+ return /*#__PURE__*/_jsx(View, {
20
+ style: style,
21
+ children: children
22
+ });
23
+ }
24
+ return /*#__PURE__*/_jsx(PressableBase, {
25
+ onPress: onPress,
26
+ accessibilityLabel: label,
27
+ pressedStyle: {},
28
+ style: style,
29
+ children: children
30
+ });
31
+ }
32
+ const useStyles = makeStyles(t => ({
33
+ page: {
34
+ overflow: 'hidden'
35
+ },
36
+ texts: {
37
+ gap: t.space[2]
38
+ },
39
+ row: {
40
+ flexDirection: 'row',
41
+ alignItems: 'center'
42
+ },
43
+ half: {
44
+ flex: 1
45
+ },
46
+ full: {
47
+ width: '100%'
48
+ },
49
+ fill: {
50
+ position: 'absolute',
51
+ left: 0,
52
+ right: 0,
53
+ top: 0,
54
+ bottom: 0
55
+ },
56
+ pair: {
57
+ flexDirection: 'row',
58
+ gap: t.space[2]
59
+ },
60
+ card: {
61
+ overflow: 'hidden',
62
+ borderRadius: t.radius.lg
63
+ },
64
+ ring: {
65
+ position: 'absolute',
66
+ left: 0,
67
+ right: 0,
68
+ top: 0,
69
+ bottom: 0,
70
+ borderWidth: 2,
71
+ borderColor: t.colors.primary
72
+ },
73
+ tagText: {
74
+ fontSize: t.typography.caption.fontSize,
75
+ fontWeight: '700'
76
+ },
77
+ tag: {
78
+ position: 'absolute',
79
+ left: t.space[1],
80
+ top: t.space[1],
81
+ minWidth: t.space[6],
82
+ height: t.space[6],
83
+ borderRadius: t.radius.full,
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ backgroundColor: t.colors.primary
87
+ },
88
+ handle: {
89
+ position: 'absolute',
90
+ width: HANDLE,
91
+ height: HANDLE,
92
+ borderRadius: HANDLE / 2,
93
+ borderWidth: 2,
94
+ borderColor: t.colors.primary,
95
+ backgroundColor: t.colors.surface
96
+ }
97
+ }));
98
+ const FocusTargetContext = /*#__PURE__*/createContext(null);
99
+ function Handles() {
100
+ const s = useStyles();
101
+ const edge = -HANDLE / 2;
102
+ const target = useContext(FocusTargetContext);
103
+ const ring = useRef(null);
104
+ useEffect(() => () => target?.report(null), [target]);
105
+ const measure = () => {
106
+ const root = target?.root.current;
107
+ if (!target || !root || !ring.current) return;
108
+ ring.current.measureLayout(root, (_x, y, _w, height) => target.report({
109
+ y,
110
+ height
111
+ }), () => undefined);
112
+ };
113
+ return /*#__PURE__*/_jsxs(_Fragment, {
114
+ children: [/*#__PURE__*/_jsx(View, {
115
+ ref: ring,
116
+ onLayout: measure,
117
+ pointerEvents: "none",
118
+ style: s.ring
119
+ }), /*#__PURE__*/_jsx(View, {
120
+ style: [s.handle, {
121
+ left: edge,
122
+ top: edge
123
+ }]
124
+ }), /*#__PURE__*/_jsx(View, {
125
+ style: [s.handle, {
126
+ right: edge,
127
+ top: edge
128
+ }]
129
+ }), /*#__PURE__*/_jsx(View, {
130
+ style: [s.handle, {
131
+ left: edge,
132
+ bottom: edge
133
+ }]
134
+ }), /*#__PURE__*/_jsx(View, {
135
+ style: [s.handle, {
136
+ right: edge,
137
+ bottom: edge
138
+ }]
139
+ })]
140
+ });
141
+ }
142
+ export function textStyleOf(layer, scale, ink, paper) {
143
+ const st = layer.style ?? {};
144
+ const size = detailFontSize(st.size) * scale;
145
+ const color = st.color ?? ink;
146
+ const base = {
147
+ fontFamily: DETAIL_FONT_FAMILY[st.font ?? 'gothic'][st.weight ?? 'regular'],
148
+ fontSize: size,
149
+ lineHeight: size * detailLineHeight(st.line),
150
+ letterSpacing: size * detailTracking(st.tracking),
151
+ color,
152
+ textAlign: st.align ?? 'left'
153
+ };
154
+ if (st.effect === 'shadow') {
155
+ return {
156
+ ...base,
157
+ textShadowColor: 'rgba(0, 0, 0, 0.35)',
158
+ textShadowOffset: {
159
+ width: 0,
160
+ height: 1
161
+ },
162
+ textShadowRadius: 3
163
+ };
164
+ }
165
+ if (st.effect === 'outline') {
166
+ return {
167
+ ...base,
168
+ borderWidth: 1.5,
169
+ borderColor: color,
170
+ paddingHorizontal: 8 * scale,
171
+ alignSelf: alignSelfOf(st.align)
172
+ };
173
+ }
174
+ if (st.effect === 'band') {
175
+ return {
176
+ ...base,
177
+ color: paper ?? color,
178
+ backgroundColor: color,
179
+ paddingHorizontal: 8 * scale,
180
+ alignSelf: alignSelfOf(st.align)
181
+ };
182
+ }
183
+ return base;
184
+ }
185
+ function alignSelfOf(align) {
186
+ return align === 'center' ? 'center' : align === 'right' ? 'flex-end' : 'flex-start';
187
+ }
188
+ export function DetailCanvas({
189
+ doc,
190
+ selection,
191
+ onSelect,
192
+ scale = 1,
193
+ ink,
194
+ paper
195
+ }) {
196
+ const t = useTheme();
197
+ const s = useStyles();
198
+ const report = useContext(DetailFocusContext);
199
+ const root = useRef(null);
200
+ const target = useMemo(() => report ? {
201
+ root,
202
+ report
203
+ } : null, [report]);
204
+ const pad = t.space[5] * scale;
205
+ const fg = ink ?? t.colors.foreground;
206
+ const bandText = paper ?? t.colors.surface;
207
+ const picked = (block, layer) => selection?.block === block.id && (layer ? selection.layer === layer.id : !selection.layer);
208
+ const press = next => onSelect ? () => onSelect(next) : undefined;
209
+ const image = (block, layer, flex = false, ratio = 1) => /*#__PURE__*/_jsxs(Tap, {
210
+ onPress: press({
211
+ block: block.id,
212
+ layer: layer.id
213
+ }),
214
+ label: '사진',
215
+ style: flex ? s.half : undefined,
216
+ children: [layer.url ? /*#__PURE__*/_jsx(Image, {
217
+ source: {
218
+ uri: layer.url
219
+ },
220
+ resizeMode: "cover",
221
+ style: [s.full, {
222
+ aspectRatio: ratio
223
+ }]
224
+ }) : /*#__PURE__*/_jsx(View, {
225
+ style: [s.full, {
226
+ aspectRatio: ratio,
227
+ backgroundColor: t.colors.muted
228
+ }]
229
+ }), picked(block, layer) ? /*#__PURE__*/_jsx(Handles, {}) : null]
230
+ }, layer.id);
231
+ const texts = (block, shown) => {
232
+ const list = shown.filter(l => l.type === 'text' && l.text);
233
+ if (!list.length) return null;
234
+ return /*#__PURE__*/_jsx(View, {
235
+ style: [s.texts, {
236
+ padding: pad
237
+ }],
238
+ children: list.map(l => {
239
+ const style = textStyleOf(l, scale, fg, bandText);
240
+ return /*#__PURE__*/_jsxs(Tap, {
241
+ onPress: press({
242
+ block: block.id,
243
+ layer: l.id
244
+ }),
245
+ label: l.text ?? '',
246
+ children: [/*#__PURE__*/_jsx(RNText, {
247
+ style: style,
248
+ children: l.text
249
+ }), picked(block, l) ? /*#__PURE__*/_jsx(Handles, {}) : null]
250
+ }, l.id);
251
+ })
252
+ });
253
+ };
254
+ const body = block => {
255
+ const shown = block.layers.filter(l => !l.hidden);
256
+ const images = shown.filter(l => l.type === 'image');
257
+ switch (block.layout) {
258
+ case 'text':
259
+ return texts(block, shown);
260
+ case 'image':
261
+ return images.map(l => image(block, l, false, 4 / 5));
262
+ case 'text_top':
263
+ return /*#__PURE__*/_jsxs(_Fragment, {
264
+ children: [texts(block, shown), images.map(l => image(block, l, false, 4 / 5))]
265
+ });
266
+ case 'side':
267
+ return /*#__PURE__*/_jsxs(View, {
268
+ style: s.row,
269
+ children: [images.slice(0, 1).map(l => image(block, l, true)), /*#__PURE__*/_jsx(View, {
270
+ style: s.half,
271
+ children: texts(block, shown)
272
+ })]
273
+ });
274
+ case 'two_images':
275
+ return /*#__PURE__*/_jsxs(_Fragment, {
276
+ children: [/*#__PURE__*/_jsx(View, {
277
+ style: [s.pair, {
278
+ paddingHorizontal: pad,
279
+ paddingTop: pad
280
+ }],
281
+ children: images.slice(0, 2).map(l => image(block, l, true))
282
+ }), texts(block, shown)]
283
+ });
284
+ case 'card':
285
+ return /*#__PURE__*/_jsx(View, {
286
+ style: {
287
+ padding: pad
288
+ },
289
+ children: /*#__PURE__*/_jsxs(View, {
290
+ style: [s.card, {
291
+ backgroundColor: t.colors.surface
292
+ }],
293
+ children: [images.slice(0, 1).map(l => image(block, l)), texts(block, shown)]
294
+ })
295
+ });
296
+ default:
297
+ return /*#__PURE__*/_jsxs(_Fragment, {
298
+ children: [images.map(l => image(block, l, false, 4 / 5)), texts(block, shown)]
299
+ });
300
+ }
301
+ };
302
+ return /*#__PURE__*/_jsx(FocusTargetContext.Provider, {
303
+ value: target,
304
+ children: /*#__PURE__*/_jsx(View, {
305
+ ref: root,
306
+ style: [s.page, {
307
+ backgroundColor: doc.background ?? paper ?? t.colors.surface
308
+ }],
309
+ children: doc.blocks.map((block, index) => /*#__PURE__*/_jsxs(Tap, {
310
+ onPress: press({
311
+ block: block.id
312
+ }),
313
+ label: '블록',
314
+ style: {
315
+ backgroundColor: block.background?.color ?? undefined,
316
+ paddingTop: detailBlockSpace(block.space_top) * scale,
317
+ paddingBottom: detailBlockSpace(block.space_bottom) * scale
318
+ },
319
+ children: [block.background?.url ? /*#__PURE__*/_jsx(Image, {
320
+ source: {
321
+ uri: block.background.url
322
+ },
323
+ resizeMode: "cover",
324
+ style: s.fill
325
+ }) : null, body(block), picked(block) ? /*#__PURE__*/_jsx(Handles, {}) : null, selection?.block === block.id ? /*#__PURE__*/_jsx(View, {
326
+ pointerEvents: "none",
327
+ style: s.tag,
328
+ children: /*#__PURE__*/_jsx(RNText, {
329
+ style: [s.tagText, {
330
+ color: t.colors.primaryForeground
331
+ }],
332
+ children: String(index + 1)
333
+ })
334
+ }) : null]
335
+ }, block.id))
336
+ })
337
+ });
338
+ }
339
+ //# sourceMappingURL=detail-canvas.js.map