@ezpg/app-ui 0.20.0 → 0.22.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/CHANGELOG.md +37 -0
- package/lib/module/adjust/adjust-template.js +1 -0
- package/lib/module/adjust/adjust-template.js.map +1 -1
- package/lib/module/adjust/axis-adjust.js +181 -0
- package/lib/module/adjust/axis-adjust.js.map +1 -0
- package/lib/module/adjust/axis-tabs.js +81 -0
- package/lib/module/adjust/axis-tabs.js.map +1 -0
- package/lib/module/adjust/axis-wheel.js +286 -0
- package/lib/module/adjust/axis-wheel.js.map +1 -0
- package/lib/module/adjust/index.js +4 -0
- package/lib/module/adjust/index.js.map +1 -1
- package/lib/module/adjust/store-sample.js +436 -0
- package/lib/module/adjust/store-sample.js.map +1 -0
- package/lib/module/blocks/choice-art/choice-art.js +589 -0
- package/lib/module/blocks/choice-art/choice-art.js.map +1 -0
- package/lib/module/blocks/choice-art/index.js +4 -0
- package/lib/module/blocks/choice-art/index.js.map +1 -0
- package/lib/module/blocks/color-swatch-picker/color-swatch-picker.js +1 -1
- package/lib/module/blocks/detail-editor/compare-slider.js +5 -2
- package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -1
- package/lib/module/blocks/detail-editor/detail-canvas.js +192 -61
- package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -1
- package/lib/module/blocks/detail-editor/detail-types.js +57 -0
- package/lib/module/blocks/detail-editor/detail-types.js.map +1 -1
- package/lib/module/blocks/detail-editor/draft-preview.js +22 -0
- package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -1
- package/lib/module/blocks/detail-editor/focus-context.js +1 -0
- package/lib/module/blocks/detail-editor/focus-context.js.map +1 -1
- package/lib/module/blocks/detail-editor/index.js +2 -2
- package/lib/module/blocks/detail-editor/index.js.map +1 -1
- package/lib/module/blocks/detail-editor/keep-words.js +34 -0
- package/lib/module/blocks/detail-editor/keep-words.js.map +1 -0
- package/lib/module/blocks/detail-editor/layout-picker.js +192 -8
- package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -1
- package/lib/module/blocks/detail-request/detail-request.js +213 -0
- package/lib/module/blocks/detail-request/detail-request.js.map +1 -0
- package/lib/module/blocks/detail-request/index.js +4 -0
- package/lib/module/blocks/detail-request/index.js.map +1 -0
- package/lib/module/blocks/detail-studio/action-chips.js +72 -0
- package/lib/module/blocks/detail-studio/action-chips.js.map +1 -0
- package/lib/module/blocks/detail-studio/adjust-tiles.js +3 -3
- package/lib/module/blocks/detail-studio/adjust-tiles.js.map +1 -1
- package/lib/module/blocks/detail-studio/asset-grid.js +33 -16
- package/lib/module/blocks/detail-studio/asset-grid.js.map +1 -1
- package/lib/module/blocks/detail-studio/confirm-row.js +3 -0
- package/lib/module/blocks/detail-studio/confirm-row.js.map +1 -1
- package/lib/module/blocks/detail-studio/detail-studio-template.js +2 -6
- package/lib/module/blocks/detail-studio/detail-studio-template.js.map +1 -1
- package/lib/module/blocks/detail-studio/edge-fade.js +74 -0
- package/lib/module/blocks/detail-studio/edge-fade.js.map +1 -0
- package/lib/module/blocks/detail-studio/image-prompt.js +8 -10
- package/lib/module/blocks/detail-studio/image-prompt.js.map +1 -1
- package/lib/module/blocks/detail-studio/index.js +7 -5
- package/lib/module/blocks/detail-studio/index.js.map +1 -1
- package/lib/module/blocks/detail-studio/rewrite-tray.js +17 -64
- package/lib/module/blocks/detail-studio/rewrite-tray.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-cover.js +41 -0
- package/lib/module/blocks/detail-studio/section-cover.js.map +1 -0
- package/lib/module/blocks/detail-studio/section-edit-template.js +103 -12
- package/lib/module/blocks/detail-studio/section-edit-template.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-kind-grid.js +2 -3
- package/lib/module/blocks/detail-studio/section-kind-grid.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-settings.js +127 -61
- package/lib/module/blocks/detail-studio/section-settings.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-bar.js +46 -25
- package/lib/module/blocks/detail-studio/studio-bar.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-dock.js +21 -39
- package/lib/module/blocks/detail-studio/studio-dock.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-glyphs.js +92 -0
- package/lib/module/blocks/detail-studio/studio-glyphs.js.map +1 -0
- package/lib/module/blocks/detail-studio/studio-sheet.js +5 -3
- package/lib/module/blocks/detail-studio/studio-sheet.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-steps.js +60 -0
- package/lib/module/blocks/detail-studio/studio-steps.js.map +1 -0
- package/lib/module/blocks/detail-studio/studio-toggle.js +130 -0
- package/lib/module/blocks/detail-studio/studio-toggle.js.map +1 -0
- package/lib/module/blocks/detail-studio/{photo-tool-bar.js → studio-tools.js} +63 -42
- package/lib/module/blocks/detail-studio/studio-tools.js.map +1 -0
- package/lib/module/blocks/detail-studio/text-format-panel.js +16 -8
- package/lib/module/blocks/detail-studio/text-format-panel.js.map +1 -1
- package/lib/module/blocks/index.js +2 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/components/button/button.js +13 -5
- package/lib/module/components/button/button.js.map +1 -1
- package/lib/module/components/chip/chip.js +5 -1
- package/lib/module/components/chip/chip.js.map +1 -1
- package/lib/module/components/chip-group/chip-group.js +1 -0
- package/lib/module/components/chip-group/chip-group.js.map +1 -1
- package/lib/module/components/credit/credit.js +6 -2
- package/lib/module/components/credit/credit.js.map +1 -1
- package/lib/module/components/dropdown-menu/dropdown-menu.js +9 -4
- package/lib/module/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/lib/module/components/page-header/page-header.js +25 -1
- package/lib/module/components/page-header/page-header.js.map +1 -1
- package/lib/module/components/segmented-control/segmented-control.js +3 -1
- package/lib/module/components/segmented-control/segmented-control.js.map +1 -1
- package/lib/module/components/skeleton/skeleton.js +4 -2
- package/lib/module/components/skeleton/skeleton.js.map +1 -1
- package/lib/module/components/slider/slider.js +53 -16
- package/lib/module/components/slider/slider.js.map +1 -1
- package/lib/module/components/toast/index.js.map +1 -1
- package/lib/module/components/toast/toast.js +8 -4
- package/lib/module/components/toast/toast.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/glyphs.js +459 -1
- package/lib/module/internal/glyphs.js.map +1 -1
- package/lib/module/internal/line-icons.js +1 -0
- package/lib/module/internal/line-icons.js.map +1 -1
- package/lib/module/internal/retry-glyph.js +5 -2
- package/lib/module/internal/retry-glyph.js.map +1 -1
- package/lib/module/internal/undo-glyph.js +11 -8
- package/lib/module/internal/undo-glyph.js.map +1 -1
- package/lib/module/sortable/section-board.js +73 -89
- package/lib/module/sortable/section-board.js.map +1 -1
- package/lib/module/templates/design-pick-template.js +8 -1
- package/lib/module/templates/design-pick-template.js.map +1 -1
- package/lib/module/templates/index.js +1 -0
- package/lib/module/templates/index.js.map +1 -1
- package/lib/module/templates/intro-template.js +3 -3
- package/lib/module/templates/intro-template.js.map +1 -1
- package/lib/module/templates/preview-edit-template.js +422 -0
- package/lib/module/templates/preview-edit-template.js.map +1 -0
- package/lib/module/templates/result-template.js +2 -1
- package/lib/module/templates/result-template.js.map +1 -1
- package/lib/typescript/src/adjust/adjust-template.d.ts.map +1 -1
- package/lib/typescript/src/adjust/axis-adjust.d.ts +25 -0
- package/lib/typescript/src/adjust/axis-adjust.d.ts.map +1 -0
- package/lib/typescript/src/adjust/axis-tabs.d.ts +15 -0
- package/lib/typescript/src/adjust/axis-tabs.d.ts.map +1 -0
- package/lib/typescript/src/adjust/axis-wheel.d.ts +15 -0
- package/lib/typescript/src/adjust/axis-wheel.d.ts.map +1 -0
- package/lib/typescript/src/adjust/index.d.ts +4 -0
- package/lib/typescript/src/adjust/index.d.ts.map +1 -1
- package/lib/typescript/src/adjust/store-sample.d.ts +46 -0
- package/lib/typescript/src/adjust/store-sample.d.ts.map +1 -0
- package/lib/typescript/src/blocks/choice-art/choice-art.d.ts +73 -0
- package/lib/typescript/src/blocks/choice-art/choice-art.d.ts.map +1 -0
- package/lib/typescript/src/blocks/choice-art/index.d.ts +2 -0
- package/lib/typescript/src/blocks/choice-art/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +2 -1
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +3 -1
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +11 -0
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +4 -1
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +9 -0
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/index.d.ts +3 -2
- package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/keep-words.d.ts +2 -0
- package/lib/typescript/src/blocks/detail-editor/keep-words.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +6 -1
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-request/detail-request.d.ts +24 -0
- package/lib/typescript/src/blocks/detail-request/detail-request.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-request/index.d.ts +2 -0
- package/lib/typescript/src/blocks/detail-request/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/action-chips.d.ts +12 -0
- package/lib/typescript/src/blocks/detail-studio/action-chips.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/asset-grid.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/confirm-row.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/detail-studio-template.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/edge-fade.d.ts +10 -0
- package/lib/typescript/src/blocks/detail-studio/edge-fade.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/image-prompt.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/index.d.ts +7 -5
- package/lib/typescript/src/blocks/detail-studio/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/rewrite-tray.d.ts +3 -3
- package/lib/typescript/src/blocks/detail-studio/rewrite-tray.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-cover.d.ts +7 -0
- package/lib/typescript/src/blocks/detail-studio/section-cover.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/section-edit-template.d.ts +9 -0
- package/lib/typescript/src/blocks/detail-studio/section-edit-template.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-kind-grid.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-settings.d.ts +11 -13
- package/lib/typescript/src/blocks/detail-studio/section-settings.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-bar.d.ts +6 -2
- package/lib/typescript/src/blocks/detail-studio/studio-bar.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-dock.d.ts +0 -2
- package/lib/typescript/src/blocks/detail-studio/studio-dock.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-glyphs.d.ts +6 -0
- package/lib/typescript/src/blocks/detail-studio/studio-glyphs.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-sheet.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-steps.d.ts +11 -0
- package/lib/typescript/src/blocks/detail-studio/studio-steps.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-toggle.d.ts +14 -0
- package/lib/typescript/src/blocks/detail-studio/studio-toggle.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-tools.d.ts +19 -0
- package/lib/typescript/src/blocks/detail-studio/studio-tools.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/text-format-panel.d.ts +2 -1
- package/lib/typescript/src/blocks/detail-studio/text-format-panel.d.ts.map +1 -1
- package/lib/typescript/src/blocks/index.d.ts +2 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/button.d.ts +3 -1
- package/lib/typescript/src/components/button/button.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/chip.d.ts +2 -1
- package/lib/typescript/src/components/chip/chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip-group/chip-group.d.ts +1 -0
- package/lib/typescript/src/components/chip-group/chip-group.d.ts.map +1 -1
- package/lib/typescript/src/components/credit/credit.d.ts +1 -0
- package/lib/typescript/src/components/credit/credit.d.ts.map +1 -1
- package/lib/typescript/src/components/dropdown-menu/dropdown-menu.d.ts +2 -0
- package/lib/typescript/src/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/lib/typescript/src/components/page-header/page-header.d.ts +1 -0
- package/lib/typescript/src/components/page-header/page-header.d.ts.map +1 -1
- package/lib/typescript/src/components/segmented-control/segmented-control.d.ts +2 -0
- package/lib/typescript/src/components/segmented-control/segmented-control.d.ts.map +1 -1
- package/lib/typescript/src/components/skeleton/skeleton.d.ts +2 -1
- package/lib/typescript/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/slider.d.ts +2 -1
- package/lib/typescript/src/components/slider/slider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +1 -1
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/toast.d.ts +4 -1
- package/lib/typescript/src/components/toast/toast.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/glyphs.d.ts +13 -0
- package/lib/typescript/src/internal/glyphs.d.ts.map +1 -1
- package/lib/typescript/src/internal/line-icons.d.ts +1 -0
- package/lib/typescript/src/internal/line-icons.d.ts.map +1 -1
- package/lib/typescript/src/internal/retry-glyph.d.ts.map +1 -1
- package/lib/typescript/src/internal/undo-glyph.d.ts.map +1 -1
- package/lib/typescript/src/sortable/section-board.d.ts.map +1 -1
- package/lib/typescript/src/templates/design-pick-template.d.ts.map +1 -1
- package/lib/typescript/src/templates/index.d.ts +2 -0
- package/lib/typescript/src/templates/index.d.ts.map +1 -1
- package/lib/typescript/src/templates/intro-template.d.ts.map +1 -1
- package/lib/typescript/src/templates/preview-edit-template.d.ts +39 -0
- package/lib/typescript/src/templates/preview-edit-template.d.ts.map +1 -0
- package/lib/typescript/src/templates/result-template.d.ts +2 -1
- package/lib/typescript/src/templates/result-template.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adjust/adjust-template.tsx +1 -0
- package/src/adjust/axis-adjust.tsx +206 -0
- package/src/adjust/axis-tabs.tsx +81 -0
- package/src/adjust/axis-wheel.tsx +309 -0
- package/src/adjust/index.ts +15 -0
- package/src/adjust/store-sample.tsx +519 -0
- package/src/blocks/choice-art/choice-art.tsx +500 -0
- package/src/blocks/choice-art/index.ts +29 -0
- package/src/blocks/color-swatch-picker/color-swatch-picker.tsx +1 -1
- package/src/blocks/detail-editor/compare-slider.tsx +3 -1
- package/src/blocks/detail-editor/detail-canvas.tsx +264 -69
- package/src/blocks/detail-editor/detail-types.ts +37 -0
- package/src/blocks/detail-editor/draft-preview.tsx +46 -2
- package/src/blocks/detail-editor/focus-context.ts +13 -0
- package/src/blocks/detail-editor/index.ts +11 -1
- package/src/blocks/detail-editor/keep-words.ts +36 -0
- package/src/blocks/detail-editor/layout-picker.tsx +188 -6
- package/src/blocks/detail-request/detail-request.tsx +198 -0
- package/src/blocks/detail-request/index.ts +11 -0
- package/src/blocks/detail-studio/action-chips.tsx +77 -0
- package/src/blocks/detail-studio/adjust-tiles.tsx +3 -3
- package/src/blocks/detail-studio/asset-grid.tsx +30 -16
- package/src/blocks/detail-studio/confirm-row.tsx +3 -0
- package/src/blocks/detail-studio/detail-studio-template.tsx +2 -6
- package/src/blocks/detail-studio/edge-fade.tsx +76 -0
- package/src/blocks/detail-studio/image-prompt.tsx +6 -9
- package/src/blocks/detail-studio/index.ts +19 -16
- package/src/blocks/detail-studio/rewrite-tray.tsx +16 -56
- package/src/blocks/detail-studio/section-cover.tsx +44 -0
- package/src/blocks/detail-studio/section-edit-template.tsx +138 -13
- package/src/blocks/detail-studio/section-kind-grid.tsx +2 -2
- package/src/blocks/detail-studio/section-settings.tsx +124 -69
- package/src/blocks/detail-studio/studio-bar.tsx +61 -41
- package/src/blocks/detail-studio/studio-dock.tsx +19 -37
- package/src/blocks/detail-studio/studio-glyphs.tsx +77 -0
- package/src/blocks/detail-studio/studio-sheet.tsx +7 -3
- package/src/blocks/detail-studio/studio-steps.tsx +58 -0
- package/src/blocks/detail-studio/studio-toggle.tsx +130 -0
- package/src/blocks/detail-studio/studio-tools.tsx +126 -0
- package/src/blocks/detail-studio/text-format-panel.tsx +26 -14
- package/src/blocks/index.tsx +2 -0
- package/src/components/button/button.tsx +12 -5
- package/src/components/chip/chip.tsx +9 -1
- package/src/components/chip-group/chip-group.tsx +2 -0
- package/src/components/credit/credit.tsx +9 -2
- package/src/components/dropdown-menu/dropdown-menu.tsx +18 -7
- package/src/components/page-header/page-header.tsx +28 -1
- package/src/components/segmented-control/segmented-control.tsx +10 -2
- package/src/components/skeleton/skeleton.tsx +5 -2
- package/src/components/slider/slider.tsx +66 -14
- package/src/components/toast/index.ts +1 -0
- package/src/components/toast/toast.tsx +12 -4
- package/src/index.tsx +13 -0
- package/src/internal/glyphs.tsx +411 -0
- package/src/internal/line-icons.ts +2 -0
- package/src/internal/retry-glyph.tsx +7 -2
- package/src/internal/undo-glyph.tsx +12 -11
- package/src/sortable/section-board.tsx +71 -76
- package/src/templates/design-pick-template.tsx +9 -1
- package/src/templates/index.ts +7 -0
- package/src/templates/intro-template.tsx +14 -12
- package/src/templates/preview-edit-template.tsx +467 -0
- package/src/templates/result-template.tsx +3 -0
- package/lib/module/blocks/detail-studio/keyboard-bar.js +0 -67
- package/lib/module/blocks/detail-studio/keyboard-bar.js.map +0 -1
- package/lib/module/blocks/detail-studio/photo-tool-bar.js.map +0 -1
- package/lib/module/blocks/detail-studio/section-thumb.js +0 -49
- package/lib/module/blocks/detail-studio/section-thumb.js.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/keyboard-bar.d.ts +0 -18
- package/lib/typescript/src/blocks/detail-studio/keyboard-bar.d.ts.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/photo-tool-bar.d.ts +0 -19
- package/lib/typescript/src/blocks/detail-studio/photo-tool-bar.d.ts.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/section-thumb.d.ts +0 -14
- package/lib/typescript/src/blocks/detail-studio/section-thumb.d.ts.map +0 -1
- package/src/blocks/detail-studio/keyboard-bar.tsx +0 -73
- package/src/blocks/detail-studio/photo-tool-bar.tsx +0 -100
- package/src/blocks/detail-studio/section-thumb.tsx +0 -41
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createContext,
|
|
3
|
+
useCallback,
|
|
3
4
|
useContext,
|
|
4
5
|
useEffect,
|
|
5
6
|
useMemo,
|
|
@@ -26,7 +27,13 @@ import { useTheme } from '../../theme/theme-provider';
|
|
|
26
27
|
import { withAlpha } from '../../utils/color';
|
|
27
28
|
import { makeStyles } from '../../utils/styles';
|
|
28
29
|
import { CompareSlider } from './compare-slider';
|
|
29
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
DetailFocusContext,
|
|
32
|
+
DetailPartsContext,
|
|
33
|
+
type DetailFocusRect,
|
|
34
|
+
type DetailPart,
|
|
35
|
+
} from './focus-context';
|
|
36
|
+
import { keepWords } from './keep-words';
|
|
30
37
|
import {
|
|
31
38
|
DETAIL_FONT_FAMILY,
|
|
32
39
|
DETAIL_STEP_COLUMNS,
|
|
@@ -37,6 +44,7 @@ import {
|
|
|
37
44
|
detailSteps,
|
|
38
45
|
detailTableRows,
|
|
39
46
|
detailFontSize,
|
|
47
|
+
detailIsTitle,
|
|
40
48
|
detailLineHeight,
|
|
41
49
|
detailTracking,
|
|
42
50
|
type DetailBlock,
|
|
@@ -86,28 +94,103 @@ export type DetailCanvasProps = {
|
|
|
86
94
|
paper?: string;
|
|
87
95
|
mode?: 'select' | 'edit';
|
|
88
96
|
focus?: DetailCanvasFocus | null;
|
|
97
|
+
onMeasure?: (parts: DetailPart[]) => void;
|
|
89
98
|
};
|
|
90
99
|
|
|
100
|
+
const lay = Platform.OS === 'ios' ? (text: string) => text : keepWords;
|
|
101
|
+
|
|
91
102
|
const HANDLE = 10;
|
|
92
|
-
const BLANK_TITLE = 7;
|
|
93
103
|
const DOT = 6;
|
|
94
104
|
const MAX_TEXT = 2000;
|
|
95
105
|
const RING = 2;
|
|
96
106
|
const HALO = 0.9;
|
|
97
107
|
|
|
108
|
+
type PartSink = {
|
|
109
|
+
root: RefObject<ComponentRef<typeof View> | null>;
|
|
110
|
+
put: (key: string, part: DetailPart | null) => void;
|
|
111
|
+
watch: (key: string, measure: (() => void) | null) => void;
|
|
112
|
+
again: () => void;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const PartsContext = createContext<PartSink | null>(null);
|
|
116
|
+
|
|
117
|
+
type PartSpec = {
|
|
118
|
+
key: string;
|
|
119
|
+
kind: DetailPart['kind'];
|
|
120
|
+
line?: number;
|
|
121
|
+
blank?: boolean;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function useProbe(spec?: PartSpec) {
|
|
125
|
+
const sink = useContext(PartsContext);
|
|
126
|
+
const node = useRef<ComponentRef<typeof View>>(null);
|
|
127
|
+
const latest = useRef(spec);
|
|
128
|
+
latest.current = spec;
|
|
129
|
+
const measure = useCallback(() => {
|
|
130
|
+
const now = latest.current;
|
|
131
|
+
const root = sink?.root.current;
|
|
132
|
+
const self = node.current;
|
|
133
|
+
if (!sink || !now || !root || !self) return;
|
|
134
|
+
self.measureLayout(
|
|
135
|
+
root,
|
|
136
|
+
(_x, y, _w, height) =>
|
|
137
|
+
sink.put(now.key, {
|
|
138
|
+
key: now.key,
|
|
139
|
+
kind: now.kind,
|
|
140
|
+
y,
|
|
141
|
+
height,
|
|
142
|
+
line: now.line ?? 0,
|
|
143
|
+
...(now.blank ? { blank: true } : {}),
|
|
144
|
+
}),
|
|
145
|
+
() => undefined
|
|
146
|
+
);
|
|
147
|
+
}, [sink]);
|
|
148
|
+
const key = spec?.key;
|
|
149
|
+
const blank = !!spec?.blank;
|
|
150
|
+
const seen = useRef(blank);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (seen.current === blank) return;
|
|
153
|
+
seen.current = blank;
|
|
154
|
+
measure();
|
|
155
|
+
}, [blank, measure]);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (!sink || !key) return;
|
|
158
|
+
sink.watch(key, measure);
|
|
159
|
+
return () => {
|
|
160
|
+
sink.watch(key, null);
|
|
161
|
+
sink.put(key, null);
|
|
162
|
+
};
|
|
163
|
+
}, [sink, key, measure]);
|
|
164
|
+
if (!sink || !spec) return null;
|
|
165
|
+
return { ref: node, onLayout: measure };
|
|
166
|
+
}
|
|
167
|
+
|
|
98
168
|
type TapProps = {
|
|
99
169
|
onPress?: () => void;
|
|
100
170
|
label: string;
|
|
101
171
|
style?: StyleProp<ViewStyle>;
|
|
172
|
+
part?: PartSpec;
|
|
102
173
|
children?: ReactNode;
|
|
103
174
|
};
|
|
104
175
|
|
|
105
|
-
function Tap({ onPress, label, style, children }: TapProps) {
|
|
176
|
+
function Tap({ onPress, label, style, part, children }: TapProps) {
|
|
177
|
+
const probe = useProbe(part);
|
|
106
178
|
if (!onPress) {
|
|
107
|
-
return
|
|
179
|
+
return (
|
|
180
|
+
<View
|
|
181
|
+
ref={probe?.ref}
|
|
182
|
+
onLayout={probe?.onLayout}
|
|
183
|
+
collapsable={probe ? false : undefined}
|
|
184
|
+
style={style}
|
|
185
|
+
>
|
|
186
|
+
{children}
|
|
187
|
+
</View>
|
|
188
|
+
);
|
|
108
189
|
}
|
|
109
190
|
return (
|
|
110
191
|
<PressableBase
|
|
192
|
+
ref={probe?.ref}
|
|
193
|
+
onLayout={probe?.onLayout}
|
|
111
194
|
onPress={onPress}
|
|
112
195
|
accessibilityLabel={label}
|
|
113
196
|
feedback="none"
|
|
@@ -118,6 +201,17 @@ function Tap({ onPress, label, style, children }: TapProps) {
|
|
|
118
201
|
);
|
|
119
202
|
}
|
|
120
203
|
|
|
204
|
+
const textPart = (
|
|
205
|
+
block: DetailBlock,
|
|
206
|
+
layer: DetailLayer,
|
|
207
|
+
style: TextStyle,
|
|
208
|
+
lines = true
|
|
209
|
+
): PartSpec => ({
|
|
210
|
+
key: `${block.id}/${layer.id}`,
|
|
211
|
+
kind: 'text',
|
|
212
|
+
line: lines ? (style.lineHeight ?? 0) : 0,
|
|
213
|
+
});
|
|
214
|
+
|
|
121
215
|
const useStyles = makeStyles((t) => ({
|
|
122
216
|
page: { overflow: 'hidden' },
|
|
123
217
|
texts: { gap: t.space[2] },
|
|
@@ -218,7 +312,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
218
312
|
flexDirection: 'row',
|
|
219
313
|
justifyContent: 'center',
|
|
220
314
|
gap: t.space[2],
|
|
221
|
-
marginTop: t.space[
|
|
315
|
+
marginTop: t.space[5],
|
|
222
316
|
},
|
|
223
317
|
dotMark: { width: DOT, height: DOT, borderRadius: DOT / 2 },
|
|
224
318
|
field: {
|
|
@@ -392,6 +486,7 @@ type FocusTextProps = {
|
|
|
392
486
|
result?: DetailCanvasResult | null;
|
|
393
487
|
blank: ReactNode;
|
|
394
488
|
style?: StyleProp<ViewStyle>;
|
|
489
|
+
part?: PartSpec;
|
|
395
490
|
};
|
|
396
491
|
|
|
397
492
|
function FocusText({
|
|
@@ -401,9 +496,11 @@ function FocusText({
|
|
|
401
496
|
result,
|
|
402
497
|
blank,
|
|
403
498
|
style,
|
|
499
|
+
part,
|
|
404
500
|
}: FocusTextProps) {
|
|
405
501
|
const t = useTheme();
|
|
406
502
|
const s = useStyles();
|
|
503
|
+
const probe = useProbe(part);
|
|
407
504
|
const target = useContext(FocusTargetContext);
|
|
408
505
|
const ring = useRef<ComponentRef<typeof View>>(null);
|
|
409
506
|
const field = useRef<ComponentRef<typeof TextInput>>(null);
|
|
@@ -435,7 +532,11 @@ function FocusText({
|
|
|
435
532
|
const ready = () => {
|
|
436
533
|
if (laid.current) return;
|
|
437
534
|
laid.current = true;
|
|
438
|
-
|
|
535
|
+
const node = field.current;
|
|
536
|
+
if (!wanted.current || !node) return;
|
|
537
|
+
node.focus();
|
|
538
|
+
const end = input?.value.length ?? 0;
|
|
539
|
+
node.setSelection?.(end, end);
|
|
439
540
|
};
|
|
440
541
|
|
|
441
542
|
const pan = useMemo(
|
|
@@ -457,15 +558,22 @@ function FocusText({
|
|
|
457
558
|
[slop, swipe]
|
|
458
559
|
);
|
|
459
560
|
|
|
460
|
-
const
|
|
561
|
+
const below = shown && shown.count >= 2 ? t.space[5] + DOT : 0;
|
|
562
|
+
const reach = useRef(below);
|
|
563
|
+
reach.current = below;
|
|
564
|
+
const measure = useCallback(() => {
|
|
461
565
|
const root = target?.root.current;
|
|
462
566
|
if (!target || !root || !ring.current) return;
|
|
463
567
|
ring.current.measureLayout(
|
|
464
568
|
root,
|
|
465
|
-
(_x, y, _w, height) =>
|
|
569
|
+
(_x, y, _w, height) =>
|
|
570
|
+
target.report({ y, height: height + reach.current }),
|
|
466
571
|
() => undefined
|
|
467
572
|
);
|
|
468
|
-
};
|
|
573
|
+
}, [target]);
|
|
574
|
+
useEffect(() => {
|
|
575
|
+
measure();
|
|
576
|
+
}, [below, measure]);
|
|
469
577
|
|
|
470
578
|
const line = text.lineHeight ?? 0;
|
|
471
579
|
const fieldStyle: TextStyle = { ...text, alignSelf: undefined };
|
|
@@ -500,15 +608,24 @@ function FocusText({
|
|
|
500
608
|
]}
|
|
501
609
|
/>
|
|
502
610
|
) : shown ? (
|
|
503
|
-
<RNText style={text}>
|
|
611
|
+
<RNText lineBreakStrategyIOS="hangul-word" style={text}>
|
|
612
|
+
{lay(shown.text)}
|
|
613
|
+
</RNText>
|
|
504
614
|
) : layer.text?.trim() ? (
|
|
505
|
-
<RNText style={text}>
|
|
615
|
+
<RNText lineBreakStrategyIOS="hangul-word" style={text}>
|
|
616
|
+
{lay(layer.text)}
|
|
617
|
+
</RNText>
|
|
506
618
|
) : (
|
|
507
619
|
blank
|
|
508
620
|
);
|
|
509
621
|
|
|
510
622
|
return (
|
|
511
|
-
<View
|
|
623
|
+
<View
|
|
624
|
+
ref={probe?.ref}
|
|
625
|
+
onLayout={probe?.onLayout}
|
|
626
|
+
collapsable={probe ? false : undefined}
|
|
627
|
+
style={style}
|
|
628
|
+
>
|
|
512
629
|
<View
|
|
513
630
|
testID="detail-focus-text"
|
|
514
631
|
style={[s.focus, shown && s.focusResult]}
|
|
@@ -570,12 +687,61 @@ export function DetailCanvas({
|
|
|
570
687
|
paper,
|
|
571
688
|
mode = 'select',
|
|
572
689
|
focus,
|
|
690
|
+
onMeasure,
|
|
573
691
|
}: DetailCanvasProps) {
|
|
574
692
|
const t = useTheme();
|
|
575
693
|
const s = useStyles();
|
|
576
694
|
const report = useContext(DetailFocusContext);
|
|
695
|
+
const listen = useContext(DetailPartsContext);
|
|
577
696
|
const root = useRef<ComponentRef<typeof View>>(null);
|
|
578
697
|
const target = useMemo(() => (report ? { root, report } : null), [report]);
|
|
698
|
+
const sink = onMeasure ?? listen;
|
|
699
|
+
const latest = useRef(sink);
|
|
700
|
+
latest.current = sink;
|
|
701
|
+
const measuring = !!sink;
|
|
702
|
+
const store = useRef(new Map<string, DetailPart>());
|
|
703
|
+
const watchers = useRef(new Map<string, () => void>());
|
|
704
|
+
const frame = useRef<number | null>(null);
|
|
705
|
+
useEffect(
|
|
706
|
+
() => () => {
|
|
707
|
+
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
708
|
+
},
|
|
709
|
+
[]
|
|
710
|
+
);
|
|
711
|
+
const parts = useMemo<PartSink | null>(() => {
|
|
712
|
+
if (!measuring) return null;
|
|
713
|
+
const flush = () => {
|
|
714
|
+
frame.current = null;
|
|
715
|
+
const list = [...store.current.values()].sort((a, b) => a.y - b.y);
|
|
716
|
+
latest.current?.(list);
|
|
717
|
+
};
|
|
718
|
+
return {
|
|
719
|
+
root,
|
|
720
|
+
put: (key, part) => {
|
|
721
|
+
const now = store.current.get(key);
|
|
722
|
+
if (part) {
|
|
723
|
+
if (
|
|
724
|
+
now &&
|
|
725
|
+
now.y === part.y &&
|
|
726
|
+
now.height === part.height &&
|
|
727
|
+
!!now.blank === !!part.blank
|
|
728
|
+
)
|
|
729
|
+
return;
|
|
730
|
+
store.current.set(key, part);
|
|
731
|
+
} else {
|
|
732
|
+
if (!now) return;
|
|
733
|
+
store.current.delete(key);
|
|
734
|
+
}
|
|
735
|
+
if (frame.current === null)
|
|
736
|
+
frame.current = requestAnimationFrame(flush);
|
|
737
|
+
},
|
|
738
|
+
watch: (key, measure) => {
|
|
739
|
+
if (measure) watchers.current.set(key, measure);
|
|
740
|
+
else watchers.current.delete(key);
|
|
741
|
+
},
|
|
742
|
+
again: () => watchers.current.forEach((measure) => measure()),
|
|
743
|
+
};
|
|
744
|
+
}, [measuring]);
|
|
579
745
|
const pad = t.space[5] * scale;
|
|
580
746
|
const fg = ink ?? t.colors.foreground;
|
|
581
747
|
const bandText = paper ?? t.colors.surface;
|
|
@@ -639,6 +805,7 @@ export function DetailCanvas({
|
|
|
639
805
|
after={compare.after}
|
|
640
806
|
aspectRatio={ratio}
|
|
641
807
|
labels={compare.labels}
|
|
808
|
+
inset={t.space[1] + RING}
|
|
642
809
|
/>
|
|
643
810
|
<PhotoRing />
|
|
644
811
|
</View>
|
|
@@ -653,6 +820,7 @@ export function DetailCanvas({
|
|
|
653
820
|
onPress={press({ block: block.id, layer: layer.id })}
|
|
654
821
|
label={'사진'}
|
|
655
822
|
style={flex ? s.half : undefined}
|
|
823
|
+
part={{ key: `${block.id}/${layer.id}`, kind: 'image', blank: !url }}
|
|
656
824
|
>
|
|
657
825
|
{url ? (
|
|
658
826
|
<Image
|
|
@@ -680,13 +848,14 @@ export function DetailCanvas({
|
|
|
680
848
|
testID="detail-blank-text"
|
|
681
849
|
style={[
|
|
682
850
|
s.blank,
|
|
683
|
-
(l.style
|
|
851
|
+
detailIsTitle(l.style) ? s.blankTitle : s.blankLine,
|
|
684
852
|
{ height: style.lineHeight, alignSelf: alignSelfOf(l.style?.align) },
|
|
685
853
|
]}
|
|
686
854
|
/>
|
|
687
855
|
);
|
|
688
856
|
|
|
689
857
|
const focusText = (
|
|
858
|
+
block: DetailBlock,
|
|
690
859
|
l: DetailLayer,
|
|
691
860
|
style: TextStyle,
|
|
692
861
|
wrap?: StyleProp<ViewStyle>
|
|
@@ -699,6 +868,7 @@ export function DetailCanvas({
|
|
|
699
868
|
result={focus?.result}
|
|
700
869
|
blank={blankBar(l, style)}
|
|
701
870
|
style={wrap}
|
|
871
|
+
part={textPart(block, l, style, false)}
|
|
702
872
|
/>
|
|
703
873
|
);
|
|
704
874
|
|
|
@@ -709,7 +879,7 @@ export function DetailCanvas({
|
|
|
709
879
|
) => {
|
|
710
880
|
if (!l || l.hidden) return <View style={style} />;
|
|
711
881
|
const text = tx(l);
|
|
712
|
-
if (focused(block, l)) return focusText(l, text, style);
|
|
882
|
+
if (focused(block, l)) return focusText(block, l, text, style);
|
|
713
883
|
const blank = !l.text?.trim();
|
|
714
884
|
if (blank && !onSelect) return <View style={style} />;
|
|
715
885
|
return (
|
|
@@ -717,8 +887,15 @@ export function DetailCanvas({
|
|
|
717
887
|
onPress={press({ block: block.id, layer: l.id })}
|
|
718
888
|
label={blank ? '글' : (l.text ?? '')}
|
|
719
889
|
style={style}
|
|
890
|
+
part={textPart(block, l, text)}
|
|
720
891
|
>
|
|
721
|
-
{blank ?
|
|
892
|
+
{blank ? (
|
|
893
|
+
blankBar(l, text)
|
|
894
|
+
) : (
|
|
895
|
+
<RNText lineBreakStrategyIOS="hangul-word" style={text}>
|
|
896
|
+
{lay(l.text ?? '')}
|
|
897
|
+
</RNText>
|
|
898
|
+
)}
|
|
722
899
|
{picked(block, l) ? <Handles /> : null}
|
|
723
900
|
</Tap>
|
|
724
901
|
);
|
|
@@ -802,7 +979,7 @@ export function DetailCanvas({
|
|
|
802
979
|
return (
|
|
803
980
|
<View key={l.id} style={[s.step, { gap }]}>
|
|
804
981
|
{dot}
|
|
805
|
-
{focusText(l, text, s.stretch)}
|
|
982
|
+
{focusText(block, l, text, s.stretch)}
|
|
806
983
|
</View>
|
|
807
984
|
);
|
|
808
985
|
}
|
|
@@ -812,12 +989,18 @@ export function DetailCanvas({
|
|
|
812
989
|
onPress={press({ block: block.id, layer: l.id })}
|
|
813
990
|
label={blank ? '글' : (l.text ?? '')}
|
|
814
991
|
style={[s.step, { gap }]}
|
|
992
|
+
part={textPart(block, l, text, false)}
|
|
815
993
|
>
|
|
816
994
|
{dot}
|
|
817
995
|
{blank ? (
|
|
818
996
|
blankBar(l, text)
|
|
819
997
|
) : (
|
|
820
|
-
<RNText
|
|
998
|
+
<RNText
|
|
999
|
+
lineBreakStrategyIOS="hangul-word"
|
|
1000
|
+
style={[text, s.stretch]}
|
|
1001
|
+
>
|
|
1002
|
+
{lay(l.text ?? '')}
|
|
1003
|
+
</RNText>
|
|
821
1004
|
)}
|
|
822
1005
|
{picked(block, l) ? <Handles /> : null}
|
|
823
1006
|
</Tap>
|
|
@@ -829,27 +1012,36 @@ export function DetailCanvas({
|
|
|
829
1012
|
);
|
|
830
1013
|
};
|
|
831
1014
|
|
|
832
|
-
const texts = (block: DetailBlock, shown: DetailLayer[]) => {
|
|
1015
|
+
const texts = (block: DetailBlock, shown: DetailLayer[], under = false) => {
|
|
833
1016
|
const list = shown.filter(
|
|
834
1017
|
(l) => l.type === 'text' && (l.text || onSelect || focused(block, l))
|
|
835
1018
|
);
|
|
836
1019
|
if (!list.length) return null;
|
|
837
1020
|
return (
|
|
838
|
-
<View
|
|
1021
|
+
<View
|
|
1022
|
+
style={[
|
|
1023
|
+
s.texts,
|
|
1024
|
+
{ padding: pad },
|
|
1025
|
+
under && { paddingTop: pad + t.space[2] * scale },
|
|
1026
|
+
]}
|
|
1027
|
+
>
|
|
839
1028
|
{list.map((l) => {
|
|
840
1029
|
const style = tx(l);
|
|
841
|
-
if (focused(block, l)) return focusText(l, style);
|
|
1030
|
+
if (focused(block, l)) return focusText(block, l, style);
|
|
842
1031
|
const blank = !!onSelect && !l.text?.trim();
|
|
843
1032
|
return (
|
|
844
1033
|
<Tap
|
|
845
1034
|
key={l.id}
|
|
846
1035
|
onPress={press({ block: block.id, layer: l.id })}
|
|
847
1036
|
label={blank ? '글' : (l.text ?? '')}
|
|
1037
|
+
part={textPart(block, l, style)}
|
|
848
1038
|
>
|
|
849
1039
|
{blank ? (
|
|
850
1040
|
blankBar(l, style)
|
|
851
1041
|
) : (
|
|
852
|
-
<RNText style={style}>
|
|
1042
|
+
<RNText lineBreakStrategyIOS="hangul-word" style={style}>
|
|
1043
|
+
{lay(l.text ?? '')}
|
|
1044
|
+
</RNText>
|
|
853
1045
|
)}
|
|
854
1046
|
{picked(block, l) ? <Handles /> : null}
|
|
855
1047
|
</Tap>
|
|
@@ -908,59 +1100,62 @@ export function DetailCanvas({
|
|
|
908
1100
|
return (
|
|
909
1101
|
<>
|
|
910
1102
|
{images.map((l) => image(block, l, false, 4 / 5))}
|
|
911
|
-
{texts(block, shown)}
|
|
1103
|
+
{texts(block, shown, images.length > 0)}
|
|
912
1104
|
</>
|
|
913
1105
|
);
|
|
914
1106
|
}
|
|
915
1107
|
};
|
|
916
1108
|
|
|
917
1109
|
return (
|
|
918
|
-
<
|
|
919
|
-
<
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
<
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1110
|
+
<PartsContext.Provider value={parts}>
|
|
1111
|
+
<FocusTargetContext.Provider value={target}>
|
|
1112
|
+
<View
|
|
1113
|
+
ref={root}
|
|
1114
|
+
style={[
|
|
1115
|
+
s.page,
|
|
1116
|
+
{ backgroundColor: doc.background ?? paper ?? t.colors.surface },
|
|
1117
|
+
]}
|
|
1118
|
+
>
|
|
1119
|
+
{doc.blocks.map((block, index) => (
|
|
1120
|
+
<View
|
|
1121
|
+
key={block.id}
|
|
1122
|
+
onLayout={parts?.again}
|
|
1123
|
+
style={{
|
|
1124
|
+
backgroundColor: block.background?.color ?? undefined,
|
|
1125
|
+
paddingTop: detailBlockSpace(block.space_top) * scale,
|
|
1126
|
+
paddingBottom: detailBlockSpace(block.space_bottom) * scale,
|
|
1127
|
+
}}
|
|
1128
|
+
>
|
|
1129
|
+
{block.background?.url ? (
|
|
1130
|
+
<Image
|
|
1131
|
+
source={{ uri: block.background.url }}
|
|
1132
|
+
resizeMode="cover"
|
|
1133
|
+
style={s.fill}
|
|
1134
|
+
/>
|
|
1135
|
+
) : null}
|
|
1136
|
+
{onSelect && !edit ? (
|
|
1137
|
+
<PressableBase
|
|
1138
|
+
onPress={() => onSelect({ block: block.id })}
|
|
1139
|
+
accessibilityLabel="블록"
|
|
1140
|
+
feedback="none"
|
|
1141
|
+
style={s.fill}
|
|
1142
|
+
/>
|
|
1143
|
+
) : null}
|
|
1144
|
+
{body(block)}
|
|
1145
|
+
{picked(block) ? <Handles /> : null}
|
|
1146
|
+
{!edit && selection?.block === block.id ? (
|
|
1147
|
+
<View pointerEvents="none" style={s.tag}>
|
|
1148
|
+
<RNText
|
|
1149
|
+
style={[s.tagText, { color: t.colors.primaryForeground }]}
|
|
1150
|
+
>
|
|
1151
|
+
{String(index + 1)}
|
|
1152
|
+
</RNText>
|
|
1153
|
+
</View>
|
|
1154
|
+
) : null}
|
|
1155
|
+
</View>
|
|
1156
|
+
))}
|
|
1157
|
+
</View>
|
|
1158
|
+
</FocusTargetContext.Provider>
|
|
1159
|
+
</PartsContext.Provider>
|
|
965
1160
|
);
|
|
966
1161
|
}
|
|
@@ -170,3 +170,40 @@ export const DETAIL_COLORS: readonly { value: string; label: string }[] = [
|
|
|
170
170
|
{ value: '#2F4A2B', label: '초록' },
|
|
171
171
|
{ value: '#1F3A5F', label: '남색' },
|
|
172
172
|
];
|
|
173
|
+
|
|
174
|
+
export const DETAIL_HEAD_SIZE = 7;
|
|
175
|
+
export const DETAIL_TITLE_SIZE = 5;
|
|
176
|
+
|
|
177
|
+
export function detailIsTitle(style?: DetailTextStyle | null): boolean {
|
|
178
|
+
const size = style?.size ?? 5;
|
|
179
|
+
const weight = style?.weight ?? 'regular';
|
|
180
|
+
return (
|
|
181
|
+
size >= DETAIL_HEAD_SIZE ||
|
|
182
|
+
(size >= DETAIL_TITLE_SIZE && weight !== 'regular')
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const DETAIL_TEXT_COLORS: readonly { value: string; label: string }[] = [
|
|
187
|
+
{ value: '#1A1A1A', label: '검정' },
|
|
188
|
+
{ value: '#626262', label: '회색' },
|
|
189
|
+
{ value: '#FFFFFF', label: '흰색' },
|
|
190
|
+
{ value: '#8A6A4A', label: '갈색' },
|
|
191
|
+
{ value: '#B5651D', label: '황토색' },
|
|
192
|
+
{ value: '#3F5D45', label: '초록' },
|
|
193
|
+
{ value: '#2F4A6B', label: '남색' },
|
|
194
|
+
{ value: '#9A3412', label: '벽돌색' },
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
export const DETAIL_BACKGROUND_COLORS: readonly {
|
|
198
|
+
value: string;
|
|
199
|
+
label: string;
|
|
200
|
+
}[] = [
|
|
201
|
+
{ value: '#FFFFFF', label: '흰색' },
|
|
202
|
+
{ value: '#F3EFE7', label: '크림색' },
|
|
203
|
+
{ value: '#E6E1D8', label: '연회색' },
|
|
204
|
+
{ value: '#D6C7B2', label: '베이지' },
|
|
205
|
+
{ value: '#8A6A4A', label: '갈색' },
|
|
206
|
+
{ value: '#3F5D45', label: '초록' },
|
|
207
|
+
{ value: '#2F4A6B', label: '남색' },
|
|
208
|
+
{ value: '#2A2D33', label: '먹색' },
|
|
209
|
+
];
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { makeStyles } from '../../utils/styles';
|
|
4
|
+
import type { DetailPart } from './focus-context';
|
|
5
|
+
|
|
6
|
+
const EPS = 0.5;
|
|
7
|
+
|
|
8
|
+
export function draftPreviewFit(
|
|
9
|
+
parts: readonly DetailPart[],
|
|
10
|
+
room: number
|
|
11
|
+
): number {
|
|
12
|
+
let end = room;
|
|
13
|
+
for (const part of parts) {
|
|
14
|
+
if (part.kind !== 'text') continue;
|
|
15
|
+
if (part.y + part.height <= room + EPS || part.y >= room - EPS) continue;
|
|
16
|
+
end = Math.min(end, part.y);
|
|
17
|
+
}
|
|
18
|
+
const photo = parts
|
|
19
|
+
.filter((p) => p.kind === 'image' && p.y + p.height <= end + EPS)
|
|
20
|
+
.pop();
|
|
21
|
+
if (!photo) return end;
|
|
22
|
+
const below = photo.y + photo.height;
|
|
23
|
+
const words = parts.some(
|
|
24
|
+
(p) => p.kind === 'text' && p.y >= below - EPS && p.y < end - EPS
|
|
25
|
+
);
|
|
26
|
+
return words ? end : below;
|
|
27
|
+
}
|
|
4
28
|
|
|
5
29
|
export type DraftPreviewProps = {
|
|
6
30
|
height: number;
|
|
7
31
|
width: number;
|
|
32
|
+
pageHeight?: number;
|
|
8
33
|
children: ReactNode;
|
|
9
34
|
};
|
|
10
35
|
|
|
@@ -22,13 +47,32 @@ const useStyles = makeStyles((t) => ({
|
|
|
22
47
|
borderTopRightRadius: t.radius.sm,
|
|
23
48
|
backgroundColor: t.colors.surface,
|
|
24
49
|
},
|
|
50
|
+
whole: {
|
|
51
|
+
borderBottomLeftRadius: t.radius.sm,
|
|
52
|
+
borderBottomRightRadius: t.radius.sm,
|
|
53
|
+
},
|
|
25
54
|
}));
|
|
26
55
|
|
|
27
|
-
export function DraftPreview({
|
|
56
|
+
export function DraftPreview({
|
|
57
|
+
height,
|
|
58
|
+
width,
|
|
59
|
+
pageHeight,
|
|
60
|
+
children,
|
|
61
|
+
}: DraftPreviewProps) {
|
|
28
62
|
const s = useStyles();
|
|
63
|
+
const whole = pageHeight !== undefined;
|
|
29
64
|
return (
|
|
30
65
|
<View style={[s.box, { height }]}>
|
|
31
|
-
<View
|
|
66
|
+
<View
|
|
67
|
+
style={[
|
|
68
|
+
s.page,
|
|
69
|
+
{ width },
|
|
70
|
+
whole && s.whole,
|
|
71
|
+
whole && { height: pageHeight },
|
|
72
|
+
]}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
</View>
|
|
32
76
|
</View>
|
|
33
77
|
);
|
|
34
78
|
}
|
|
@@ -5,3 +5,16 @@ export type DetailFocusRect = { y: number; height: number };
|
|
|
5
5
|
export const DetailFocusContext = createContext<
|
|
6
6
|
((rect: DetailFocusRect | null) => void) | null
|
|
7
7
|
>(null);
|
|
8
|
+
|
|
9
|
+
export type DetailPart = {
|
|
10
|
+
key: string;
|
|
11
|
+
kind: 'text' | 'image';
|
|
12
|
+
y: number;
|
|
13
|
+
height: number;
|
|
14
|
+
line: number;
|
|
15
|
+
blank?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DetailPartsContext = createContext<
|
|
19
|
+
((parts: DetailPart[]) => void) | null
|
|
20
|
+
>(null);
|