@ezpg/app-ui 0.15.0 → 0.17.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 (141) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/lib/module/adjust/dial-strip.js +2 -2
  3. package/lib/module/blocks/detail-editor/compare-slider.js +117 -0
  4. package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -0
  5. package/lib/module/blocks/detail-editor/detail-canvas.js +339 -0
  6. package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -0
  7. package/lib/module/blocks/detail-editor/detail-composer.js +254 -0
  8. package/lib/module/blocks/detail-editor/detail-composer.js.map +1 -0
  9. package/lib/module/blocks/detail-editor/detail-editor-template.js +102 -0
  10. package/lib/module/blocks/detail-editor/detail-editor-template.js.map +1 -0
  11. package/lib/module/blocks/detail-editor/detail-types.js +64 -0
  12. package/lib/module/blocks/detail-editor/detail-types.js.map +1 -0
  13. package/lib/module/blocks/detail-editor/draft-strip.js +97 -0
  14. package/lib/module/blocks/detail-editor/draft-strip.js.map +1 -0
  15. package/lib/module/blocks/detail-editor/editor-bar.js +96 -0
  16. package/lib/module/blocks/detail-editor/editor-bar.js.map +1 -0
  17. package/lib/module/blocks/detail-editor/focus-context.js +5 -0
  18. package/lib/module/blocks/detail-editor/focus-context.js.map +1 -0
  19. package/lib/module/blocks/detail-editor/font-picker.js +74 -0
  20. package/lib/module/blocks/detail-editor/font-picker.js.map +1 -0
  21. package/lib/module/blocks/detail-editor/index.js +14 -0
  22. package/lib/module/blocks/detail-editor/index.js.map +1 -0
  23. package/lib/module/blocks/detail-editor/layout-picker.js +173 -0
  24. package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -0
  25. package/lib/module/blocks/detail-editor/photo-tray.js +144 -0
  26. package/lib/module/blocks/detail-editor/photo-tray.js.map +1 -0
  27. package/lib/module/blocks/detail-editor/tool-row.js +63 -0
  28. package/lib/module/blocks/detail-editor/tool-row.js.map +1 -0
  29. package/lib/module/blocks/index.js +1 -0
  30. package/lib/module/blocks/index.js.map +1 -1
  31. package/lib/module/blocks/invite-card/invite-card.js +0 -2
  32. package/lib/module/blocks/invite-card/invite-card.js.map +1 -1
  33. package/lib/module/blocks/task-tiles/task-tiles.js +1 -1
  34. package/lib/module/blocks/task-tiles/task-tiles.js.map +1 -1
  35. package/lib/module/charts/mini-bars.js +1 -1
  36. package/lib/module/charts/mini-bars.js.map +1 -1
  37. package/lib/module/components/button/button.js +10 -3
  38. package/lib/module/components/button/button.js.map +1 -1
  39. package/lib/module/components/floating-tab-bar/floating-tab-bar.js +103 -0
  40. package/lib/module/components/floating-tab-bar/floating-tab-bar.js.map +1 -0
  41. package/lib/module/components/floating-tab-bar/index.js +4 -0
  42. package/lib/module/components/floating-tab-bar/index.js.map +1 -0
  43. package/lib/module/components/list-row/list-row.js +1 -1
  44. package/lib/module/components/list-row/list-row.js.map +1 -1
  45. package/lib/module/components/slider/index.js +4 -0
  46. package/lib/module/components/slider/index.js.map +1 -0
  47. package/lib/module/components/slider/slider.js +151 -0
  48. package/lib/module/components/slider/slider.js.map +1 -0
  49. package/lib/module/index.js +2 -0
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/internal/pressable-base.js +3 -2
  52. package/lib/module/internal/pressable-base.js.map +1 -1
  53. package/lib/module/internal/tab-icon-pairs.js +25 -0
  54. package/lib/module/internal/tab-icon-pairs.js.map +1 -0
  55. package/lib/module/sortable/block-strip.js +151 -0
  56. package/lib/module/sortable/block-strip.js.map +1 -0
  57. package/lib/module/sortable/index.js +1 -0
  58. package/lib/module/sortable/index.js.map +1 -1
  59. package/lib/module/templates/parts.js +1 -1
  60. package/lib/module/theme/base.js +17 -17
  61. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +8 -0
  62. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -0
  63. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +13 -0
  64. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -0
  65. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts +25 -0
  66. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts.map +1 -0
  67. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts +13 -0
  68. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts.map +1 -0
  69. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +55 -0
  70. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -0
  71. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts +16 -0
  72. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts.map +1 -0
  73. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts +18 -0
  74. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts.map +1 -0
  75. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +6 -0
  76. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -0
  77. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts +8 -0
  78. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts.map +1 -0
  79. package/lib/typescript/src/blocks/detail-editor/index.d.ts +12 -0
  80. package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -0
  81. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +8 -0
  82. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -0
  83. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts +15 -0
  84. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts.map +1 -0
  85. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts +13 -0
  86. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts.map +1 -0
  87. package/lib/typescript/src/blocks/index.d.ts +1 -0
  88. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  89. package/lib/typescript/src/blocks/invite-card/invite-card.d.ts.map +1 -1
  90. package/lib/typescript/src/components/button/button.d.ts.map +1 -1
  91. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts +20 -0
  92. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts.map +1 -0
  93. package/lib/typescript/src/components/floating-tab-bar/index.d.ts +2 -0
  94. package/lib/typescript/src/components/floating-tab-bar/index.d.ts.map +1 -0
  95. package/lib/typescript/src/components/slider/index.d.ts +2 -0
  96. package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
  97. package/lib/typescript/src/components/slider/slider.d.ts +14 -0
  98. package/lib/typescript/src/components/slider/slider.d.ts.map +1 -0
  99. package/lib/typescript/src/index.d.ts +2 -0
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/internal/pressable-base.d.ts +2 -1
  102. package/lib/typescript/src/internal/pressable-base.d.ts.map +1 -1
  103. package/lib/typescript/src/internal/tab-icon-pairs.d.ts +23 -0
  104. package/lib/typescript/src/internal/tab-icon-pairs.d.ts.map +1 -0
  105. package/lib/typescript/src/sortable/block-strip.d.ts +14 -0
  106. package/lib/typescript/src/sortable/block-strip.d.ts.map +1 -0
  107. package/lib/typescript/src/sortable/index.d.ts +1 -0
  108. package/lib/typescript/src/sortable/index.d.ts.map +1 -1
  109. package/lib/typescript/src/theme/base.d.ts +17 -17
  110. package/package.json +1 -1
  111. package/src/adjust/dial-strip.tsx +2 -2
  112. package/src/blocks/detail-editor/compare-slider.tsx +112 -0
  113. package/src/blocks/detail-editor/detail-canvas.tsx +369 -0
  114. package/src/blocks/detail-editor/detail-composer.tsx +261 -0
  115. package/src/blocks/detail-editor/detail-editor-template.tsx +109 -0
  116. package/src/blocks/detail-editor/detail-types.ts +113 -0
  117. package/src/blocks/detail-editor/draft-strip.tsx +102 -0
  118. package/src/blocks/detail-editor/editor-bar.tsx +116 -0
  119. package/src/blocks/detail-editor/focus-context.ts +7 -0
  120. package/src/blocks/detail-editor/font-picker.tsx +75 -0
  121. package/src/blocks/detail-editor/index.ts +51 -0
  122. package/src/blocks/detail-editor/layout-picker.tsx +158 -0
  123. package/src/blocks/detail-editor/photo-tray.tsx +140 -0
  124. package/src/blocks/detail-editor/tool-row.tsx +66 -0
  125. package/src/blocks/index.tsx +1 -0
  126. package/src/blocks/invite-card/invite-card.tsx +2 -4
  127. package/src/blocks/task-tiles/task-tiles.tsx +1 -1
  128. package/src/charts/mini-bars.tsx +1 -1
  129. package/src/components/button/button.tsx +10 -3
  130. package/src/components/floating-tab-bar/floating-tab-bar.tsx +121 -0
  131. package/src/components/floating-tab-bar/index.ts +7 -0
  132. package/src/components/list-row/list-row.tsx +1 -1
  133. package/src/components/slider/index.ts +1 -0
  134. package/src/components/slider/slider.tsx +142 -0
  135. package/src/index.tsx +2 -0
  136. package/src/internal/pressable-base.tsx +3 -1
  137. package/src/internal/tab-icon-pairs.ts +22 -0
  138. package/src/sortable/block-strip.tsx +168 -0
  139. package/src/sortable/index.ts +5 -0
  140. package/src/templates/parts.tsx +1 -1
  141. package/src/theme/base.ts +17 -17
@@ -0,0 +1,109 @@
1
+ import {
2
+ useEffect,
3
+ useRef,
4
+ useState,
5
+ type ComponentRef,
6
+ type ReactNode,
7
+ } from 'react';
8
+ import { ScrollView, View } from 'react-native';
9
+ import { useTheme } from '../../theme/theme-provider';
10
+ import { makeStyles } from '../../utils/styles';
11
+ import { DetailFocusContext, type DetailFocusRect } from './focus-context';
12
+
13
+ export type DetailEditorTemplateProps = {
14
+ bar: ReactNode;
15
+ children: ReactNode;
16
+ bottom?: ReactNode;
17
+ bottomInset?: number;
18
+ wide?: boolean;
19
+ };
20
+
21
+ const useStyles = makeStyles((t) => ({
22
+ root: { flex: 1, backgroundColor: t.colors.muted },
23
+ scroll: { paddingVertical: t.space[3] },
24
+ page: {
25
+ alignSelf: 'center',
26
+ width: '86%',
27
+ boxShadow: t.shadow.md,
28
+ },
29
+ wide: { alignSelf: 'stretch', width: '100%', boxShadow: undefined },
30
+ bottom: { gap: t.space[3], paddingTop: t.space[2] },
31
+ panel: { gap: t.space[3], paddingHorizontal: t.layout.screenX },
32
+ }));
33
+
34
+ export function DetailEditorTemplate({
35
+ bar,
36
+ children,
37
+ bottom,
38
+ bottomInset = 0,
39
+ wide,
40
+ }: DetailEditorTemplateProps) {
41
+ const t = useTheme();
42
+ const s = useStyles();
43
+ const scroller = useRef<ComponentRef<typeof ScrollView>>(null);
44
+ const offset = useRef(0);
45
+ const pageTop = useRef(0);
46
+ const [viewport, setViewport] = useState(0);
47
+ const [focus, setFocus] = useState<DetailFocusRect | null>(null);
48
+ const report = useRef((rect: DetailFocusRect | null) =>
49
+ setFocus((now) =>
50
+ now === rect ||
51
+ (now && rect && now.y === rect.y && now.height === rect.height)
52
+ ? now
53
+ : rect
54
+ )
55
+ ).current;
56
+ const margin = t.space[4];
57
+
58
+ useEffect(() => {
59
+ if (!focus || viewport <= 0) return;
60
+ const top = pageTop.current + focus.y - margin;
61
+ const end = pageTop.current + focus.y + focus.height + margin;
62
+ const now = offset.current;
63
+ const next =
64
+ end - top > viewport || top < now
65
+ ? top
66
+ : end > now + viewport
67
+ ? end - viewport
68
+ : now;
69
+ if (next !== now) {
70
+ scroller.current?.scrollTo({ y: Math.max(0, next), animated: true });
71
+ }
72
+ }, [focus, viewport, margin]);
73
+
74
+ return (
75
+ <View style={s.root}>
76
+ {bar}
77
+ <ScrollView
78
+ ref={scroller}
79
+ contentContainerStyle={s.scroll}
80
+ scrollEventThrottle={16}
81
+ onScroll={(e) => {
82
+ offset.current = e.nativeEvent.contentOffset.y;
83
+ }}
84
+ onLayout={(e) => setViewport(e.nativeEvent.layout.height)}
85
+ >
86
+ <DetailFocusContext.Provider value={report}>
87
+ <View
88
+ style={[s.page, wide && s.wide]}
89
+ onLayout={(e) => {
90
+ pageTop.current = e.nativeEvent.layout.y;
91
+ }}
92
+ >
93
+ {children}
94
+ </View>
95
+ </DetailFocusContext.Provider>
96
+ </ScrollView>
97
+ {bottom ? (
98
+ <View style={[s.bottom, { paddingBottom: bottomInset + t.space[3] }]}>
99
+ {bottom}
100
+ </View>
101
+ ) : null}
102
+ </View>
103
+ );
104
+ }
105
+
106
+ export function EditorPanel({ children }: { children: ReactNode }) {
107
+ const s = useStyles();
108
+ return <View style={s.panel}>{children}</View>;
109
+ }
@@ -0,0 +1,113 @@
1
+ export type DetailFont = 'gothic' | 'serif' | 'display' | 'hand';
2
+ export type DetailWeight = 'regular' | 'bold' | 'heavy';
3
+ export type DetailEffect = 'none' | 'shadow' | 'outline' | 'band';
4
+ export type DetailLayout =
5
+ 'text' | 'image' | 'image_top' | 'text_top' | 'side' | 'two_images' | 'card';
6
+
7
+ export type DetailTextStyle = {
8
+ font?: DetailFont;
9
+ size?: number;
10
+ weight?: DetailWeight;
11
+ color?: string;
12
+ align?: 'left' | 'center' | 'right';
13
+ effect?: DetailEffect;
14
+ line?: number;
15
+ tracking?: number;
16
+ };
17
+
18
+ export type DetailLayer = {
19
+ id: string;
20
+ type: 'text' | 'image';
21
+ text?: string | null;
22
+ url?: string | null;
23
+ asset_id?: string | null;
24
+ style?: DetailTextStyle | null;
25
+ hidden?: boolean;
26
+ };
27
+
28
+ export type DetailBlock = {
29
+ id: string;
30
+ layout: DetailLayout;
31
+ background?: {
32
+ color?: string | null;
33
+ url?: string | null;
34
+ asset_id?: string | null;
35
+ };
36
+ space_top?: number;
37
+ space_bottom?: number;
38
+ layers: DetailLayer[];
39
+ };
40
+
41
+ export type DetailDocValue = {
42
+ version?: number;
43
+ background?: string | null;
44
+ blocks: DetailBlock[];
45
+ };
46
+
47
+ export type DetailSelection = { block: string; layer?: string } | null;
48
+
49
+ export const DETAIL_LAYOUTS: readonly DetailLayout[] = [
50
+ 'image_top',
51
+ 'text_top',
52
+ 'side',
53
+ 'image',
54
+ 'two_images',
55
+ 'card',
56
+ 'text',
57
+ ];
58
+
59
+ export const DETAIL_FONT_FAMILY: Record<
60
+ DetailFont,
61
+ Record<DetailWeight, string>
62
+ > = {
63
+ gothic: {
64
+ regular: 'Pretendard-Regular',
65
+ bold: 'Pretendard-Bold',
66
+ heavy: 'Pretendard-ExtraBold',
67
+ },
68
+ serif: {
69
+ regular: 'NanumMyeongjo',
70
+ bold: 'NanumMyeongjoBold',
71
+ heavy: 'NanumMyeongjoBold',
72
+ },
73
+ display: {
74
+ regular: 'BlackHanSans-Regular',
75
+ bold: 'BlackHanSans-Regular',
76
+ heavy: 'BlackHanSans-Regular',
77
+ },
78
+ hand: {
79
+ regular: 'NanumPen-Regular',
80
+ bold: 'NanumPen-Regular',
81
+ heavy: 'NanumPen-Regular',
82
+ },
83
+ };
84
+
85
+ const clamp = (value: number, lo: number, hi: number) =>
86
+ Math.min(hi, Math.max(lo, value));
87
+
88
+ export function detailFontSize(size = 5): number {
89
+ return 12 + (clamp(size, 1, 10) - 1) * 2;
90
+ }
91
+
92
+ export function detailLineHeight(line = 5): number {
93
+ return 1.05 + clamp(line, 1, 10) * 0.08;
94
+ }
95
+
96
+ export function detailTracking(tracking = 0): number {
97
+ return clamp(tracking, -5, 10) * 0.01;
98
+ }
99
+
100
+ export function detailBlockSpace(space = 0): number {
101
+ return clamp(space, 0, 10) * 8;
102
+ }
103
+
104
+ export const DETAIL_COLORS: readonly { value: string; label: string }[] = [
105
+ { value: '#1A1A1A', label: '잉크' },
106
+ { value: '#FFFFFF', label: '흰색' },
107
+ { value: '#F4F4F5', label: '연회색' },
108
+ { value: '#EFE7DC', label: '베이지' },
109
+ { value: '#3B2F25', label: '고동' },
110
+ { value: '#C54211', label: '주황' },
111
+ { value: '#2F4A2B', label: '초록' },
112
+ { value: '#1F3A5F', label: '남색' },
113
+ ];
@@ -0,0 +1,102 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ScrollView, View } from 'react-native';
3
+ import { Text } from '../../components/text/text';
4
+ import { SparklesGlyph } from '../../internal/glyphs';
5
+ import { PressableBase } from '../../internal/pressable-base';
6
+ import { useTheme } from '../../theme/theme-provider';
7
+ import { makeStyles } from '../../utils/styles';
8
+
9
+ export type DraftStripItem = { key: string; label: string; thumb: ReactNode };
10
+
11
+ export type DraftStripProps = {
12
+ items: readonly DraftStripItem[];
13
+ value: string;
14
+ onValueChange: (key: string) => void;
15
+ onMore?: () => void;
16
+ moreLabel?: string;
17
+ };
18
+
19
+ const W = 64;
20
+ const H = 100;
21
+
22
+ const useStyles = makeStyles((t) => ({
23
+ row: { gap: t.space[2], paddingHorizontal: t.space[3] },
24
+ item: { gap: t.space[1], alignItems: 'center' },
25
+ frame: {
26
+ width: W,
27
+ height: H,
28
+ overflow: 'hidden',
29
+ borderRadius: t.radius.sm,
30
+ borderWidth: 1,
31
+ borderColor: t.colors.border,
32
+ backgroundColor: t.colors.surface,
33
+ },
34
+ on: { borderWidth: 3, borderColor: t.colors.primary },
35
+ more: {
36
+ width: W,
37
+ height: H,
38
+ borderRadius: t.radius.sm,
39
+ borderWidth: 1,
40
+ borderStyle: 'dashed',
41
+ borderColor: t.colors.input,
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ },
45
+ }));
46
+
47
+ export function DraftStrip({
48
+ items,
49
+ value,
50
+ onValueChange,
51
+ onMore,
52
+ moreLabel = '더 만들기',
53
+ }: DraftStripProps) {
54
+ const t = useTheme();
55
+ const s = useStyles();
56
+ return (
57
+ <ScrollView
58
+ horizontal
59
+ showsHorizontalScrollIndicator={false}
60
+ contentContainerStyle={s.row}
61
+ accessibilityRole="tablist"
62
+ >
63
+ {items.map((item) => {
64
+ const on = item.key === value;
65
+ return (
66
+ <PressableBase
67
+ key={item.key}
68
+ accessibilityRole="tab"
69
+ accessibilityState={{ selected: on }}
70
+ accessibilityLabel={item.label}
71
+ onPress={() => onValueChange(item.key)}
72
+ style={s.item}
73
+ >
74
+ <View style={[s.frame, on && s.on]}>{item.thumb}</View>
75
+ <Text variant="caption" tone={on ? 'default' : 'muted'}>
76
+ {item.label}
77
+ </Text>
78
+ </PressableBase>
79
+ );
80
+ })}
81
+ {onMore ? (
82
+ <PressableBase
83
+ onPress={onMore}
84
+ accessibilityLabel={moreLabel}
85
+ style={s.item}
86
+ >
87
+ <View style={s.more}>
88
+ <SparklesGlyph
89
+ color={t.colors.mutedForeground}
90
+ size={t.iconSize.md}
91
+ />
92
+ </View>
93
+ <Text variant="caption" tone="muted">
94
+ {moreLabel}
95
+ </Text>
96
+ </PressableBase>
97
+ ) : null}
98
+ </ScrollView>
99
+ );
100
+ }
101
+
102
+ export const DRAFT_THUMB_WIDTH = W;
@@ -0,0 +1,116 @@
1
+ import { View } from 'react-native';
2
+ import { Button } from '../../components/button/button';
3
+ import {
4
+ CloseGlyph,
5
+ EyeGlyph,
6
+ MenuGlyph,
7
+ ReturnGlyph,
8
+ } from '../../internal/glyphs';
9
+ import { renderIcon, type IconSlot } from '../../internal/icon';
10
+ import { PressableBase } from '../../internal/pressable-base';
11
+ import { useTheme } from '../../theme/theme-provider';
12
+ import { makeStyles } from '../../utils/styles';
13
+
14
+ export type EditorBarProps = {
15
+ topInset?: number;
16
+ onClose: () => void;
17
+ onUndo?: () => void;
18
+ onRedo?: () => void;
19
+ onLayers?: () => void;
20
+ onPreview?: () => void;
21
+ layersOn?: boolean;
22
+ previewOn?: boolean;
23
+ action: {
24
+ label: string;
25
+ onPress: () => void;
26
+ disabled?: boolean;
27
+ loading?: boolean;
28
+ };
29
+ };
30
+
31
+ const useStyles = makeStyles((t) => ({
32
+ bar: {
33
+ flexDirection: 'row',
34
+ alignItems: 'center',
35
+ gap: t.space[2],
36
+ paddingHorizontal: t.space[3],
37
+ paddingBottom: t.space[2],
38
+ },
39
+ round: {
40
+ width: t.space[10],
41
+ height: t.space[10],
42
+ borderRadius: t.radius.full,
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ },
46
+ group: {
47
+ flexDirection: 'row',
48
+ alignItems: 'center',
49
+ gap: t.space[1],
50
+ paddingHorizontal: t.space[1],
51
+ borderRadius: t.radius.full,
52
+ backgroundColor: t.colors.surface,
53
+ },
54
+ fill: { flex: 1 },
55
+ mirror: { transform: [{ scaleX: -1 }] },
56
+ on: { backgroundColor: t.colors.primaryTint },
57
+ }));
58
+
59
+ export function EditorBar({
60
+ topInset = 0,
61
+ onClose,
62
+ onUndo,
63
+ onRedo,
64
+ onLayers,
65
+ onPreview,
66
+ layersOn,
67
+ previewOn,
68
+ action,
69
+ }: EditorBarProps) {
70
+ const t = useTheme();
71
+ const s = useStyles();
72
+ const tool = (
73
+ key: string,
74
+ icon: IconSlot,
75
+ label: string,
76
+ onPress?: () => void,
77
+ on?: boolean,
78
+ mirror?: boolean
79
+ ) => (
80
+ <PressableBase
81
+ key={key}
82
+ onPress={onPress}
83
+ disabled={!onPress}
84
+ accessibilityLabel={label}
85
+ accessibilityState={{ disabled: !onPress, selected: !!on }}
86
+ style={[s.round, on && s.on, mirror && s.mirror]}
87
+ >
88
+ {renderIcon(icon, {
89
+ color: onPress ? t.colors.foreground : t.colors.input,
90
+ size: t.iconSize.md,
91
+ })}
92
+ </PressableBase>
93
+ );
94
+ return (
95
+ <View style={[s.bar, { paddingTop: topInset + t.space[2] }]}>
96
+ <View style={[s.round, { backgroundColor: t.colors.surface }]}>
97
+ {tool('close', CloseGlyph, '닫기', onClose)}
98
+ </View>
99
+ <View style={s.fill} />
100
+ <View style={s.group}>
101
+ {tool('undo', ReturnGlyph, '실행 취소', onUndo)}
102
+ {tool('redo', ReturnGlyph, '다시 실행', onRedo, false, true)}
103
+ {tool('layers', MenuGlyph, '레이어', onLayers, layersOn)}
104
+ {tool('preview', EyeGlyph, '미리보기', onPreview, previewOn)}
105
+ </View>
106
+ <Button
107
+ size="sm"
108
+ onPress={action.onPress}
109
+ disabled={action.disabled}
110
+ loading={action.loading}
111
+ >
112
+ {action.label}
113
+ </Button>
114
+ </View>
115
+ );
116
+ }
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ export type DetailFocusRect = { y: number; height: number };
4
+
5
+ export const DetailFocusContext = createContext<
6
+ ((rect: DetailFocusRect | null) => void) | null
7
+ >(null);
@@ -0,0 +1,75 @@
1
+ import { Text as RNText, View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import { PressableBase } from '../../internal/pressable-base';
4
+ import { useTheme } from '../../theme/theme-provider';
5
+ import { makeStyles } from '../../utils/styles';
6
+ import { DETAIL_FONT_FAMILY, type DetailFont } from './detail-types';
7
+
8
+ export type FontPickerProps = {
9
+ value: DetailFont;
10
+ onValueChange: (font: DetailFont) => void;
11
+ sample: string;
12
+ };
13
+
14
+ const NAMES: Record<DetailFont, string> = {
15
+ gothic: '고딕',
16
+ serif: '명조',
17
+ display: '굵은 제목',
18
+ hand: '손글씨',
19
+ };
20
+
21
+ const ORDER: DetailFont[] = ['gothic', 'serif', 'display', 'hand'];
22
+
23
+ const useStyles = makeStyles((t) => ({
24
+ list: { gap: t.space[1] },
25
+ row: {
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ justifyContent: 'space-between',
29
+ minHeight: t.controlSize.sm,
30
+ paddingHorizontal: t.space[3],
31
+ borderRadius: t.radius.md,
32
+ },
33
+ on: { backgroundColor: t.colors.primaryTint },
34
+ sample: { flexShrink: 1 },
35
+ }));
36
+
37
+ export function FontPicker({ value, onValueChange, sample }: FontPickerProps) {
38
+ const t = useTheme();
39
+ const s = useStyles();
40
+ return (
41
+ <View style={s.list} accessibilityRole="radiogroup">
42
+ {ORDER.map((font) => {
43
+ const on = font === value;
44
+ return (
45
+ <PressableBase
46
+ key={font}
47
+ accessibilityRole="radio"
48
+ accessibilityState={{ selected: on }}
49
+ accessibilityLabel={NAMES[font]}
50
+ onPress={() => onValueChange(font)}
51
+ style={[s.row, on && s.on]}
52
+ >
53
+ <RNText
54
+ numberOfLines={1}
55
+ maxFontSizeMultiplier={t.maxFontScale}
56
+ style={[
57
+ s.sample,
58
+ {
59
+ fontFamily: DETAIL_FONT_FAMILY[font].regular,
60
+ fontSize: t.typography.bodyLg.fontSize,
61
+ color: t.colors.foreground,
62
+ },
63
+ ]}
64
+ >
65
+ {sample}
66
+ </RNText>
67
+ <Text variant="caption" tone="muted">
68
+ {NAMES[font]}
69
+ </Text>
70
+ </PressableBase>
71
+ );
72
+ })}
73
+ </View>
74
+ );
75
+ }
@@ -0,0 +1,51 @@
1
+ export {
2
+ DetailCanvas,
3
+ textStyleOf,
4
+ type DetailCanvasProps,
5
+ } from './detail-canvas';
6
+ export {
7
+ DetailComposer,
8
+ type ComposerAttachment,
9
+ type ComposerSource,
10
+ type DetailComposerProps,
11
+ } from './detail-composer';
12
+ export {
13
+ DetailEditorTemplate,
14
+ EditorPanel,
15
+ type DetailEditorTemplateProps,
16
+ } from './detail-editor-template';
17
+ export {
18
+ DETAIL_COLORS,
19
+ DETAIL_FONT_FAMILY,
20
+ DETAIL_LAYOUTS,
21
+ detailBlockSpace,
22
+ detailFontSize,
23
+ detailLineHeight,
24
+ detailTracking,
25
+ type DetailBlock,
26
+ type DetailDocValue,
27
+ type DetailEffect,
28
+ type DetailFont,
29
+ type DetailLayer,
30
+ type DetailLayout,
31
+ type DetailSelection,
32
+ type DetailTextStyle,
33
+ type DetailWeight,
34
+ } from './detail-types';
35
+ export {
36
+ DRAFT_THUMB_WIDTH,
37
+ DraftStrip,
38
+ type DraftStripItem,
39
+ type DraftStripProps,
40
+ } from './draft-strip';
41
+ export { EditorBar, type EditorBarProps } from './editor-bar';
42
+ export { FontPicker, type FontPickerProps } from './font-picker';
43
+ export { LayoutPicker, type LayoutPickerProps } from './layout-picker';
44
+ export { ToolRow, type ToolRowItem } from './tool-row';
45
+ export { CompareSlider, type CompareSliderProps } from './compare-slider';
46
+ export {
47
+ PhotoTray,
48
+ type PhotoTrayProps,
49
+ type TrayPhoto,
50
+ type TraySource,
51
+ } from './photo-tray';