@nice2dev/ui-graphics 1.2.0 → 1.2.2
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 +142 -0
- package/dist/cjs/animation/AnimatedPerson.js +3 -1
- package/dist/cjs/animation/Audience.js +3 -1
- package/dist/cjs/animation/rig/RigPlayer.js +1 -1
- package/dist/cjs/animation/rig/presets.js +67 -55
- package/dist/cjs/animation/shapes/headwear.js +4 -1
- package/dist/cjs/core/NiceBrushEngine.js +8 -5
- package/dist/cjs/core/collaboration.js +11 -6
- package/dist/cjs/core/editorAsk.js +48 -0
- package/dist/cjs/core/i18n.js +7 -3
- package/dist/cjs/core/minimap.js +21 -20
- package/dist/cjs/core/plugins.js +1 -1
- package/dist/cjs/core/rtl.js +1 -1
- package/dist/cjs/core/theme.js +1 -1
- package/dist/cjs/font/NiceFontEditor.js +14 -12
- package/dist/cjs/game/GameAsset2dEditor.js +75 -44
- package/dist/cjs/nice2dev-ui-graphics.css +1 -1
- package/dist/cjs/photo/FilterThumb.js +3 -3
- package/dist/cjs/photo/NiceAITools.js +6 -4
- package/dist/cjs/photo/PhotoEditor.js +3 -1
- package/dist/cjs/photo/PhotoEditorCanvas.js +8 -6
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +29 -29
- package/dist/cjs/photo/PhotoEditorToolbar.js +4 -4
- package/dist/cjs/photo/photoFilters.js +1 -0
- package/dist/cjs/pixel/PixelEditor.js +6 -3
- package/dist/cjs/pixel/PixelEditorCanvas.js +10 -6
- package/dist/cjs/pixel/PixelEditorMenuBar.js +95 -30
- package/dist/cjs/pixel/PixelEditorRightPanel.js +32 -24
- package/dist/cjs/pixel/PixelEditorStatusBar.js +12 -4
- package/dist/cjs/pixel/PixelEditorTimeline.js +15 -2
- package/dist/cjs/pixel/PixelEditorToolbar.js +12 -6
- package/dist/cjs/pixel/SpriteGeneratorPanel.js +28 -17
- package/dist/cjs/pixel/animalGeneratorPresets.js +31 -31
- package/dist/cjs/pixel/buildingGeneratorPresets.js +24 -24
- package/dist/cjs/pixel/characterGeneratorPresets.js +25 -25
- package/dist/cjs/pixel/usePixelEditor.js +13 -10
- package/dist/cjs/texture/Nice3DTexturePainter.js +16 -10
- package/dist/cjs/ui/NiceUIDesigner.js +17 -13
- package/dist/cjs/vector/NiceSvgToCode.js +7 -5
- package/dist/cjs/vector/VectorEditor.js +3 -2
- package/dist/cjs/vector/VectorEditorMenuBar.js +7 -1
- package/dist/cjs/vector/VectorEditorRightPanel.js +1 -1
- package/dist/cjs/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/cjs/vector/useVectorEditor.js +38 -29
- package/dist/cjs/vector/vectorEditorImport.js +1 -0
- package/dist/cjs/vector/vectorIconImport.js +1 -0
- package/dist/esm/animation/AnimatedPerson.js +3 -1
- package/dist/esm/animation/Audience.js +3 -1
- package/dist/esm/animation/rig/RigPlayer.js +1 -1
- package/dist/esm/animation/rig/presets.js +68 -56
- package/dist/esm/animation/shapes/headwear.js +4 -1
- package/dist/esm/animation/spineExport.js +1 -1
- package/dist/esm/core/NiceBrushEngine.js +8 -5
- package/dist/esm/core/collaboration.js +11 -6
- package/dist/esm/core/editorAsk.js +45 -0
- package/dist/esm/core/i18n.js +8 -4
- package/dist/esm/core/minimap.js +21 -20
- package/dist/esm/core/plugins.js +1 -1
- package/dist/esm/core/rtl.js +1 -1
- package/dist/esm/core/theme.js +1 -1
- package/dist/esm/font/NiceFontEditor.js +14 -12
- package/dist/esm/game/GameAsset2dEditor.js +75 -44
- package/dist/esm/nice2dev-ui-graphics.css +1 -1
- package/dist/esm/photo/FilterThumb.js +3 -3
- package/dist/esm/photo/NiceAITools.js +6 -4
- package/dist/esm/photo/PhotoEditor.js +3 -1
- package/dist/esm/photo/PhotoEditorCanvas.js +8 -6
- package/dist/esm/photo/PhotoEditorLeftPanel.js +29 -29
- package/dist/esm/photo/PhotoEditorToolbar.js +4 -4
- package/dist/esm/photo/photoFilters.js +1 -0
- package/dist/esm/pixel/PixelEditor.js +6 -3
- package/dist/esm/pixel/PixelEditorCanvas.js +10 -6
- package/dist/esm/pixel/PixelEditorMenuBar.js +95 -30
- package/dist/esm/pixel/PixelEditorRightPanel.js +32 -24
- package/dist/esm/pixel/PixelEditorStatusBar.js +12 -4
- package/dist/esm/pixel/PixelEditorTimeline.js +15 -2
- package/dist/esm/pixel/PixelEditorToolbar.js +12 -6
- package/dist/esm/pixel/SpriteGeneratorPanel.js +28 -17
- package/dist/esm/pixel/animalGeneratorPresets.js +32 -32
- package/dist/esm/pixel/buildingGeneratorPresets.js +25 -25
- package/dist/esm/pixel/characterGeneratorPresets.js +26 -26
- package/dist/esm/pixel/usePixelEditor.js +13 -10
- package/dist/esm/texture/Nice3DTexturePainter.js +16 -10
- package/dist/esm/ui/NiceUIDesigner.js +17 -13
- package/dist/esm/vector/NiceSvgToCode.js +7 -5
- package/dist/esm/vector/VectorEditor.js +3 -2
- package/dist/esm/vector/VectorEditorMenuBar.js +7 -1
- package/dist/esm/vector/VectorEditorRightPanel.js +1 -1
- package/dist/esm/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/esm/vector/useVectorEditor.js +38 -29
- package/dist/esm/vector/vectorEditorImport.js +1 -0
- package/dist/esm/vector/vectorIconImport.js +1 -0
- package/dist/types/core/LocalUI.d.ts +1 -2
- package/dist/types/core/editorAsk.d.ts +26 -0
- package/dist/types/core/i18n.d.ts +1 -17
- package/dist/types/pixel/usePixelEditor.d.ts +3 -0
- package/dist/types/vector/useVectorEditor.d.ts +2 -0
- package/package.json +5 -5
|
@@ -17,13 +17,14 @@ const OverlayToolbar = ({ api }) => {
|
|
|
17
17
|
if (!selectedOverlay) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlayToolbar, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.overlayToolbarLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14, style: { marginRight: 4 } }),
|
|
20
|
+
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlayToolbar, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.overlayToolbarLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14, style: { marginRight: 4 } }), t('photoEditor.layer', 'Layer')] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: ((_a = selectedOverlay.opacity) !== null && _a !== void 0 ? _a : 1) * 100, onChange: (e) => updateOverlay(selectedOverlay.id, { opacity: Number(e.target.value) / 100 }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 70 }, title: t('photoEditor.opacity', 'Opacity') }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: accent }, children: [Math.round(((_b = selectedOverlay.opacity) !== null && _b !== void 0 ? _b : 1) * 100), "%"] }), selectedOverlay.type !== 'drawing' && selectedOverlay.type !== 'frame' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 20, max: 500, value: ((_c = selectedOverlay.scaleX) !== null && _c !== void 0 ? _c : 1) * 100, onChange: (e) => {
|
|
21
21
|
const s = Number(e.target.value) / 100;
|
|
22
22
|
updateOverlay(selectedOverlay.id, { scaleX: s, scaleY: s });
|
|
23
|
-
}, onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title:
|
|
23
|
+
}, onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: t('photoEditor.scale', 'Scale') }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: 'var(--nice-text-muted, #aaa)' }, children: [Math.round(((_d = selectedOverlay.scaleX) !== null && _d !== void 0 ? _d : 1) * 100), "%"] })] })), selectedOverlay.type !== 'drawing' && selectedOverlay.type !== 'frame' && (jsxRuntime.jsx(LocalUI.RangeInput, { min: -180, max: 180, value: (_e = selectedOverlay.rotation) !== null && _e !== void 0 ? _e : 0, onChange: (e) => updateOverlay(selectedOverlay.id, { rotation: Number(e.target.value) }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: t('photoEditor.rotation', 'Rotation') })), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayBack(selectedOverlay.id), title: t('photoEditor.moveBack', 'Move back'), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-down", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayForward(selectedOverlay.id), title: t('photoEditor.moveForward', 'Move forward'), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-up", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => deleteOverlay(selectedOverlay.id), className: PhotoEditor_module.overlayToolbarBtn, title: t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14 }) })] }));
|
|
24
24
|
};
|
|
25
25
|
// ── Left Panel ──
|
|
26
|
-
const PhotoEditorLeftPanel =
|
|
26
|
+
const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
27
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
27
28
|
var _a;
|
|
28
29
|
const { t, accent, accentDim, activeTab, setActiveTab, setCropMode,
|
|
29
30
|
// Filters
|
|
@@ -60,28 +61,28 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
60
61
|
color: activeTab === tab.key ? accent : undefined,
|
|
61
62
|
borderBottomColor: activeTab === tab.key ? accent : undefined,
|
|
62
63
|
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: tab.icon, size: 14 }), tab.label] }, tab.key))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.panelContent, children: [activeTab === 'filters' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.pillRow, children: [
|
|
63
|
-
{ key: 'all', label: 'All' },
|
|
64
|
-
{ key: 'color', label: 'Color' },
|
|
65
|
-
{ key: 'light', label: 'Light' },
|
|
66
|
-
{ key: 'vintage', label: 'Vintage' },
|
|
67
|
-
{ key: 'artistic', label: 'Artistic' },
|
|
68
|
-
{ key: 'fun', label: 'Fun' },
|
|
64
|
+
{ key: 'all', label: t('photoEditor.all', 'All') },
|
|
65
|
+
{ key: 'color', label: t('photoEditor.color', 'Color') },
|
|
66
|
+
{ key: 'light', label: t('photoEditor.light', 'Light') },
|
|
67
|
+
{ key: 'vintage', label: t('photoEditor.vintage', 'Vintage') },
|
|
68
|
+
{ key: 'artistic', label: t('photoEditor.artistic', 'Artistic') },
|
|
69
|
+
{ key: 'fun', label: t('photoEditor.fun', 'Fun') },
|
|
69
70
|
].map((cat) => (jsxRuntime.jsx("button", { onClick: () => setFilterCategory(cat.key), className: filterCategory === cat.key ? PhotoEditor_module.pillActive : PhotoEditor_module.pill, style: {
|
|
70
71
|
borderColor: filterCategory === cat.key ? accent : undefined,
|
|
71
72
|
background: filterCategory === cat.key ? accentDim : undefined,
|
|
72
73
|
}, children: cat.label }, cat.key))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.filterGrid, children: filteredList.map((filter) => (jsxRuntime.jsx(FilterThumb, { filter: filter, selected: selectedFilter === filter.id, accent: accent, onSelect: () => {
|
|
73
74
|
setSelectedFilter(filter.id);
|
|
74
75
|
pushHistory();
|
|
75
|
-
}, generateThumbnail: generateThumbnail }, filter.id))) }), selectedFilter !== 'none' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensitySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensityHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "bar-chart", size: 14, style: { marginRight: 4 } }),
|
|
76
|
+
}, generateThumbnail: generateThumbnail }, filter.id))) }), selectedFilter !== 'none' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensitySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensityHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "bar-chart", size: 14, style: { marginRight: 4 } }), t('photoEditor.intensity', 'Intensity')] }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [Math.round(filterIntensity * 100), "%"] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: filterIntensity * 100, onChange: (e) => setFilterIntensity(Number(e.target.value) / 100), onMouseUp: () => pushHistory(), accentColor: accent })] }))] })), activeTab === 'adjust' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustColumn, children: [photoEditorTypes.ADJUSTMENT_SLIDERS.map((sl) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: sl.icon, size: 14, style: { marginRight: 4 } }), sl.label] }), jsxRuntime.jsx("span", { className: PhotoEditor_module.adjustValue, style: {
|
|
76
77
|
color: adjustments[sl.key] !== 0 ? accent : 'var(--nice-text-secondary, #666)',
|
|
77
|
-
}, onClick: () => handleAdjChange(sl.key, sl.key === 'blur' ? 0 : 0), title:
|
|
78
|
+
}, onClick: () => handleAdjChange(sl.key, sl.key === 'blur' ? 0 : 0), title: t('photoEditor.reset', 'Reset'), children: adjustments[sl.key] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: sl.min, max: sl.max, value: adjustments[sl.key], onChange: (e) => handleAdjChange(sl.key, Number(e.target.value)), onMouseUp: handleAdjChangeEnd, accentColor: accent })] }, sl.key))), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", className: "mt-2", onClick: () => {
|
|
78
79
|
handleAdjChange('brightness', 0);
|
|
79
80
|
const defaults = { ...photoFilters.DEFAULT_ADJUSTMENTS };
|
|
80
81
|
for (const key of Object.keys(defaults)) {
|
|
81
82
|
handleAdjChange(key, defaults[key]);
|
|
82
83
|
}
|
|
83
84
|
pushHistory();
|
|
84
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetAdjustments', 'Reset adjustments')] })] })), activeTab === 'crop' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.cropInfo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }),
|
|
85
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetAdjustments', 'Reset adjustments')] })] })), activeTab === 'crop' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.cropInfo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.dragCornersOrEdgesTo', 'Drag corners or edges to crop the photo.')] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectLabel, children: t('photoEditor.aspectRatio', 'Aspect ratio') }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectRow, children: photoEditorTypes.ASPECT_RATIOS.map((ar) => (jsxRuntime.jsx("button", { onClick: () => {
|
|
85
86
|
setCropAspect(ar.value);
|
|
86
87
|
if (ar.value && cropRect && image) {
|
|
87
88
|
let newW = cropRect.w;
|
|
@@ -106,7 +107,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
106
107
|
setCropAspect(null);
|
|
107
108
|
pushHistory();
|
|
108
109
|
}
|
|
109
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "expand", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetCrop', 'Reset crop')] })] })), activeTab === 'transform' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children:
|
|
110
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "expand", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetCrop', 'Reset crop')] })] })), activeTab === 'transform' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.rotation', 'Rotation') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
110
111
|
setRotation((rotation - 90 + 360) % 360);
|
|
111
112
|
pushHistory();
|
|
112
113
|
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }), " -90\u00B0"] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
@@ -115,13 +116,13 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
115
116
|
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14, style: { marginRight: 4 } }), " +90\u00B0"] }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
116
117
|
setRotation(0);
|
|
117
118
|
pushHistory();
|
|
118
|
-
}, children: "0\u00B0" })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children:
|
|
119
|
+
}, children: "0\u00B0" })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.flip', 'Flip') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: flipH ? 'outline-info' : 'dark', size: "sm", onClick: () => {
|
|
119
120
|
setFlipH(!flipH);
|
|
120
121
|
pushHistory();
|
|
121
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }),
|
|
122
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.horizontal', 'Horizontal')] }), jsxRuntime.jsxs(LocalUI.Button, { variant: flipV ? 'outline-info' : 'dark', size: "sm", onClick: () => {
|
|
122
123
|
setFlipV(!flipV);
|
|
123
124
|
pushHistory();
|
|
124
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }),
|
|
125
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.vertical', 'Vertical')] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.previewZoom', 'Preview zoom') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformZoomRow, children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 50, max: 300, value: zoom * 100, onChange: (e) => setZoom(Number(e.target.value) / 100), accentColor: accent }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.transformZoomValue, style: { color: accent }, children: [Math.round(zoom * 100), "%"] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformInfo, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: t('photoEditor.rotation2', 'Rotation:') }), " ", rotation, "\u00B0"] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: t('photoEditor.flipH', 'Flip H:') }), ' ', flipH ? t('photoEditor.yes', 'Yes') : t('photoEditor.no', 'No')] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: t('photoEditor.flipV', 'Flip V:') }), ' ', flipV ? t('photoEditor.yes', 'Yes') : t('photoEditor.no', 'No')] }), cropRect && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: t('photoEditor.crop', 'Crop:') }), " ", Math.round(cropRect.w), " \u00D7", ' ', Math.round(cropRect.h), ' (', "x:", Math.round(cropRect.x), ", y:", Math.round(cropRect.y), ")"] }))] })] })), activeTab === 'stickers' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "circle", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.stickersEmoji', 'Stickers / Emoji')] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.pillRowGap3, children: photoOverlays.EMOJI_CATALOG.map((cat) => (jsxRuntime.jsxs("button", { onClick: () => setEmojiCat(cat.id), className: emojiCat === cat.id ? PhotoEditor_module.pillEmojiActive : PhotoEditor_module.pillEmoji, style: {
|
|
125
126
|
borderColor: emojiCat === cat.id ? accent : undefined,
|
|
126
127
|
background: emojiCat === cat.id ? accentDim : undefined,
|
|
127
128
|
}, children: [cat.icon, " ", cat.label] }, cat.id))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.emojiGrid, children: (_a = photoOverlays.EMOJI_CATALOG.find((c) => c.id === emojiCat)) === null || _a === void 0 ? void 0 : _a.emojis.map((em, idx) => (jsxRuntime.jsx("button", { onClick: () => {
|
|
@@ -129,20 +130,20 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
129
130
|
const cw = (_b = (_a = mainCanvasRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 400;
|
|
130
131
|
const ch = (_d = (_c = mainCanvasRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 400;
|
|
131
132
|
addOverlay(createEmojiOverlay(em, cw, ch));
|
|
132
|
-
}, className: PhotoEditor_module.emojiBtn, title: em, children: em }, idx))) }), overlays.length > 0 && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlaySection, children: [jsxRuntime.
|
|
133
|
+
}, className: PhotoEditor_module.emojiBtn, title: em, children: em }, idx))) }), overlays.length > 0 && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlaySection, children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.overlaySectionTitle, children: t('photoEditor.layers', 'Layers ({overlays})').replace('{overlays}', String(overlays.length)) }), overlays.map((ov) => (jsxRuntime.jsxs("div", { onClick: () => setSelectedOverlayId(ov.id), className: PhotoEditor_module.overlayItem, style: { background: selectedOverlayId === ov.id ? accentDim : undefined }, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.overlayIcon, children: ov.type === 'emoji' ? (ov.emoji) : ov.type === 'text' ? ('T') : ov.type === 'shape' ? (jsxRuntime.jsx(uiCore.NiceIcon, { name: "star", size: 14 })) : ov.type === 'drawing' ? (jsxRuntime.jsx(uiCore.NiceIcon, { name: "pen", size: 14 })) : (jsxRuntime.jsx(uiCore.NiceIcon, { name: "square", size: 14 })) }), jsxRuntime.jsx("span", { className: PhotoEditor_module.overlayName, children: ov.type === 'text'
|
|
133
134
|
? ov.text.slice(0, 20)
|
|
134
135
|
: ov.type === 'emoji'
|
|
135
|
-
? 'Emoji'
|
|
136
|
+
? t('photoEditor.emoji', 'Emoji')
|
|
136
137
|
: ov.type === 'shape'
|
|
137
138
|
? ov.shapeKind
|
|
138
139
|
: ov.type === 'drawing'
|
|
139
|
-
?
|
|
140
|
+
? t('photoEditor.drawing', 'Drawing ({strokes})').replace('{strokes}', String(ov.strokes.length))
|
|
140
141
|
: ov.type === 'frame'
|
|
141
142
|
? ov.frameStyle
|
|
142
143
|
: '' }), jsxRuntime.jsx("button", { onClick: (e) => {
|
|
143
144
|
e.stopPropagation();
|
|
144
145
|
deleteOverlay(ov.id);
|
|
145
|
-
}, className: PhotoEditor_module.overlayDeleteBtn, "aria-label": t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, ov.id)))] }))] })), activeTab === 'text' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "type", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.addCaption', 'Add caption')] }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: textDraft, onChange: (e) => setTextDraft(e.target.value), placeholder: t('photoEditor.textPlaceholder', 'Enter text…'), className: PhotoEditor_module.textArea }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textBtnRow, children: [jsxRuntime.jsx(LocalUI.Button, { variant: textBold ? 'light' : 'dark', size: "sm", onClick: () => setTextBold(!textBold), title:
|
|
146
|
+
}, className: PhotoEditor_module.overlayDeleteBtn, "aria-label": t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, ov.id)))] }))] })), activeTab === 'text' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "type", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.addCaption', 'Add caption')] }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: textDraft, onChange: (e) => setTextDraft(e.target.value), placeholder: t('photoEditor.textPlaceholder', 'Enter text…'), className: PhotoEditor_module.textArea }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textBtnRow, children: [jsxRuntime.jsx(LocalUI.Button, { variant: textBold ? 'light' : 'dark', size: "sm", onClick: () => setTextBold(!textBold), title: t('photoEditor.bold', 'Bold'), className: PhotoEditor_module.textFormatBtn, style: { fontWeight: 700 }, children: "B" }), jsxRuntime.jsx(LocalUI.Button, { variant: textItalic ? 'light' : 'dark', size: "sm", onClick: () => setTextItalic(!textItalic), title: t('photoEditor.italic', 'Italic'), className: PhotoEditor_module.textFormatBtn, style: { fontStyle: 'italic' }, children: "I" }), jsxRuntime.jsx(LocalUI.Button, { variant: textOutline ? 'light' : 'dark', size: "sm", onClick: () => setTextOutline(!textOutline), title: t('photoEditor.outline', 'Outline'), className: PhotoEditor_module.textFormatBtn, children: "O" }), jsxRuntime.jsx(LocalUI.Button, { variant: textBg ? 'light' : 'dark', size: "sm", onClick: () => setTextBg(!textBg), title: t('photoEditor.background', 'Background'), className: PhotoEditor_module.textFormatBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "square", size: 14 }) }), jsxRuntime.jsx("input", { type: "color", value: textColor, onChange: (e) => setTextColor(e.target.value), className: PhotoEditor_module.colorInputLg, title: t('photoEditor.textColour', 'Text colour') })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [t('photoEditor.size', 'Size'), ":"] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 12, max: 120, value: textFontSize, onChange: (e) => setTextFontSize(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [textFontSize, "px"] })] }), jsxRuntime.jsxs(LocalUI.Button, { size: "sm", className: PhotoEditor_module.accentBtn, style: { background: accent, borderColor: accent }, disabled: !textDraft.trim(), onClick: () => {
|
|
146
147
|
const ov = createTextOverlay(textDraft);
|
|
147
148
|
ov.color = textColor;
|
|
148
149
|
ov.bold = textBold;
|
|
@@ -166,13 +167,13 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
166
167
|
italic: !selectedOverlay.italic,
|
|
167
168
|
});
|
|
168
169
|
pushHistory();
|
|
169
|
-
}, className: PhotoEditor_module.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }),
|
|
170
|
+
}, className: PhotoEditor_module.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.shapes', 'Shapes')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.shapeColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabel, children: t('photoEditor.stroke', 'Stroke:') }), jsxRuntime.jsx("input", { type: "color", value: shapeStroke, onChange: (e) => setShapeStroke(e.target.value), className: PhotoEditor_module.colorInput, title: t('photoEditor.strokeColor', 'Stroke color') }), jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabelMl, children: t('photoEditor.fill', 'Fill:') }), jsxRuntime.jsx("input", { type: "color", value: shapeFill || '#ffffff', onChange: (e) => setShapeFill(e.target.value), className: PhotoEditor_module.colorInput, title: t('photoEditor.fillColor', 'Fill color') }), jsxRuntime.jsx(LocalUI.Button, { variant: shapeFill ? 'light' : 'dark', size: "sm", onClick: () => setShapeFill(shapeFill ? '' : '#ffffff'), className: PhotoEditor_module.shapeFillToggle, children: shapeFill ? t('photoEditor.off', 'Off') : t('photoEditor.on', 'On') })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: t('photoEditor.width', 'Width:') }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 20, value: shapeStrokeW, onChange: (e) => setShapeStrokeW(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [shapeStrokeW, "px"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.shapeGrid, children: photoOverlays.SHAPE_CATALOG.map((sh) => (jsxRuntime.jsx("button", { title: sh.label, onClick: () => {
|
|
170
171
|
const ov = createShapeOverlay(sh.id);
|
|
171
172
|
ov.strokeColor = shapeStroke;
|
|
172
173
|
ov.fillColor = shapeFill || null;
|
|
173
174
|
ov.strokeWidth = shapeStrokeW;
|
|
174
175
|
addOverlay(ov);
|
|
175
|
-
}, className: PhotoEditor_module.shapeBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }),
|
|
176
|
+
}, className: PhotoEditor_module.shapeBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.frames', 'Frames')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameColorRow, children: [jsxRuntime.jsx("input", { type: "color", value: frameColor, onChange: (e) => setFrameColor(e.target.value), className: PhotoEditor_module.colorInput, "aria-label": t('photoEditor.frameColor', 'Frame color') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameThicknessWrap, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: t('photoEditor.thickness', 'Thickness:') }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 10, value: frameThick, onChange: (e) => setFrameThick(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsx("span", { className: PhotoEditor_module.frameThicknessValue, style: { color: accent }, children: frameThick })] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameGrid, children: [photoOverlays.FRAME_CATALOG.map((fr) => (jsxRuntime.jsx("button", { title: fr.label, onClick: () => {
|
|
176
177
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
177
178
|
const ov = createFrameOverlay(fr.id, frameColor);
|
|
178
179
|
ov.thickness = frameThick / 100;
|
|
@@ -180,7 +181,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
180
181
|
}, className: PhotoEditor_module.frameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: fr.icon, size: 18 }) }, fr.id))), jsxRuntime.jsx("button", { title: t('photoEditor.removeFrame', 'Remove frame'), "aria-label": t('photoEditor.removeFrame', 'Remove frame'), onClick: () => {
|
|
181
182
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
182
183
|
pushHistory();
|
|
183
|
-
}, className: PhotoEditor_module.removeFrameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }),
|
|
184
|
+
}, className: PhotoEditor_module.removeFrameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.freehandDrawing', 'Freehand drawing')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionInfoMb, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.drawDirectlyOnThePhoto', 'Draw directly on the photo by holding the left mouse button.')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.quickColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: t('photoEditor.color2', 'Color:') }), jsxRuntime.jsx("input", { type: "color", value: drawColor, onChange: (e) => setDrawColor(e.target.value), className: PhotoEditor_module.colorInputDraw, "aria-label": t('photoEditor.drawColor', 'Drawing color') }), [
|
|
184
185
|
'#ff0000',
|
|
185
186
|
'#ff8800',
|
|
186
187
|
'#ffff00',
|
|
@@ -193,7 +194,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
193
194
|
].map((c) => (jsxRuntime.jsx("div", { onClick: () => setDrawColor(c), className: PhotoEditor_module.quickColorSwatch, style: {
|
|
194
195
|
background: c,
|
|
195
196
|
border: drawColor === c ? `2px solid ${accent}` : undefined,
|
|
196
|
-
} }, c)))] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, style: { marginBottom: 12 }, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children:
|
|
197
|
+
} }, c)))] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, style: { marginBottom: 12 }, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: t('photoEditor.width', 'Width:') }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 30, value: drawWidth, onChange: (e) => setDrawWidth(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [drawWidth, "px"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.drawPreview, children: jsxRuntime.jsx("div", { style: {
|
|
197
198
|
width: Math.max(drawWidth, 4),
|
|
198
199
|
height: Math.max(drawWidth, 4),
|
|
199
200
|
borderRadius: '50%',
|
|
@@ -214,15 +215,14 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
214
215
|
}));
|
|
215
216
|
pushHistory();
|
|
216
217
|
}
|
|
217
|
-
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }),
|
|
218
|
+
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.undoStroke', 'Undo stroke')] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => {
|
|
218
219
|
if (drawingOverlayRef.current) {
|
|
219
220
|
deleteOverlay(drawingOverlayRef.current.id);
|
|
220
221
|
drawingOverlayRef.current = null;
|
|
221
222
|
}
|
|
222
|
-
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14, style: { marginRight: 4 } }),
|
|
223
|
+
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.clear', 'Clear')] })] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", className: "mt-2 w-100", onClick: () => {
|
|
223
224
|
drawingOverlayRef.current = null;
|
|
224
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 14, style: { marginRight: 4 } }),
|
|
225
|
-
});
|
|
226
|
-
PhotoEditorLeftPanel.displayName = 'PhotoEditorLeftPanel';
|
|
225
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.newDrawingLayer', 'New drawing layer')] })] }))] })] }));
|
|
226
|
+
}), { displayName: 'PhotoEditorLeftPanel' });
|
|
227
227
|
|
|
228
228
|
module.exports = PhotoEditorLeftPanel;
|
|
@@ -6,15 +6,15 @@ var React = require('react');
|
|
|
6
6
|
var LocalUI = require('../core/LocalUI.js');
|
|
7
7
|
var PhotoEditor_module = require('./PhotoEditor.module.css.js');
|
|
8
8
|
|
|
9
|
-
const PhotoEditorToolbar =
|
|
9
|
+
const PhotoEditorToolbar = /* @__PURE__ */ Object.assign(
|
|
10
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
10
11
|
const { t, accent, historyIdx, historyLength, undo, redo, handleReset, showCompare, setShowCompare, handleDownload, handleCopyToClipboard, handleShareNative, onCancel, handleSave, } = api;
|
|
11
|
-
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: undo, disabled: historyIdx <= 0, title: `${t('photoEditor.undo', 'Undo')} (Ctrl+Z)`, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: redo, disabled: historyIdx >= historyLength - 1, title: t('photoEditor.redo', 'Redo (Ctrl+Y)'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleReset, title:
|
|
12
|
+
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: undo, disabled: historyIdx <= 0, title: `${t('photoEditor.undo', 'Undo')} (Ctrl+Z)`, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: redo, disabled: historyIdx >= historyLength - 1, title: t('photoEditor.redo', 'Redo (Ctrl+Y)'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleReset, title: t('photoEditor.reset', 'Reset'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14 }) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.toolbarDivider }), jsxRuntime.jsx(LocalUI.Button, { variant: showCompare ? 'outline-info' : 'dark', size: "sm", onClick: () => setShowCompare(!showCompare), title: t('photoEditor.compareOriginal', 'Compare with original'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "columns", size: 14 }) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.toolbarDivider }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleDownload, title: t('photoEditor.download', 'Download'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "download", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleCopyToClipboard, title: t('photoEditor.copyToClipboard', 'Copy to clipboard'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "clipboard", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleShareNative, title: t('common.share', 'Share'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "send", size: 14 }) })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarTitle, style: { color: accent }, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "wand", size: 14, style: { marginRight: 8 } }), t('photoEditor.title', 'Photo Editor')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", onClick: onCancel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14, style: { marginRight: 4 } }), ' ', t('common.cancel', 'Cancel')] }), jsxRuntime.jsxs(LocalUI.Button, { size: "sm", style: {
|
|
12
13
|
background: accent,
|
|
13
14
|
borderColor: accent,
|
|
14
15
|
color: 'var(--nice-color-white, #fff)',
|
|
15
16
|
fontWeight: 600,
|
|
16
17
|
}, onClick: handleSave, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "check", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.apply', 'Apply')] })] })] }));
|
|
17
|
-
});
|
|
18
|
-
PhotoEditorToolbar.displayName = 'PhotoEditorToolbar';
|
|
18
|
+
}), { displayName: 'PhotoEditorToolbar' });
|
|
19
19
|
|
|
20
20
|
module.exports = PhotoEditorToolbar;
|
|
@@ -287,6 +287,7 @@ function brownie(data) {
|
|
|
287
287
|
function duotone(data, params) {
|
|
288
288
|
const out = cloneImageData(data);
|
|
289
289
|
const d = out.data;
|
|
290
|
+
// audit-allow: literal-color +2 — the duotone filter's default inks, written into the photo
|
|
290
291
|
const dark = hexToRgb((params === null || params === void 0 ? void 0 : params.darkColor) || '#001f3f');
|
|
291
292
|
const light = hexToRgb((params === null || params === void 0 ? void 0 : params.lightColor) || '#ff851b');
|
|
292
293
|
for (let i = 0; i < d.length; i += 4) {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var ui = require('@nice2dev/ui');
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var editorAsk = require('../core/editorAsk.js');
|
|
7
|
+
var i18n = require('../core/i18n.js');
|
|
6
8
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
7
9
|
var PixelEditorCanvas = require('./PixelEditorCanvas.js');
|
|
8
10
|
var PixelEditorMenuBar = require('./PixelEditorMenuBar.js');
|
|
@@ -14,20 +16,21 @@ var SpriteGeneratorPanel = require('./SpriteGeneratorPanel.js');
|
|
|
14
16
|
var usePixelEditor = require('./usePixelEditor.js');
|
|
15
17
|
|
|
16
18
|
const NicePixelEditor = ({ initialWidth = 64, initialHeight = 64, className, onSaveToLibrary, }) => {
|
|
19
|
+
const { t } = i18n.useNiceTranslation();
|
|
17
20
|
const api = usePixelEditor.usePixelEditor({ initialWidth, initialHeight, onSaveToLibrary });
|
|
18
21
|
const [showGenerator, setShowGenerator] = React.useState(false);
|
|
19
22
|
const handleGeneratorSend = React.useCallback((imageData) => {
|
|
20
23
|
var _a;
|
|
21
24
|
(_a = api.importImageData) === null || _a === void 0 ? void 0 : _a.call(api, imageData);
|
|
22
25
|
}, [api]);
|
|
23
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { ref: api.fInp, type: "file", accept: ".ase,.aseprite,.png,.jpg,.jpeg,.gif,.bmp,.webp,.svg,.tga,.ico,.tiff,.tif,.avif", style: { display: 'none' }, onChange: (e) => {
|
|
26
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(editorAsk.EditorAskDialog, { ask: api.pendingAsk }), jsxRuntime.jsx("input", { ref: api.fInp, type: "file", accept: ".ase,.aseprite,.png,.jpg,.jpeg,.gif,.bmp,.webp,.svg,.tga,.ico,.tiff,.tif,.avif", style: { display: 'none' }, onChange: (e) => {
|
|
24
27
|
var _a;
|
|
25
28
|
const f = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
26
29
|
if (f) {
|
|
27
30
|
api.openFile(f);
|
|
28
31
|
}
|
|
29
32
|
e.target.value = '';
|
|
30
|
-
} }), jsxRuntime.jsx(ui.NiceAppShell, { className: className, flush: true, menubar: jsxRuntime.jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsxRuntime.jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsxRuntime.jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsxRuntime.jsx(PixelEditorTimeline, { api: api }), statusBar: jsxRuntime.jsx(PixelEditorStatusBar, { api: api }), children: jsxRuntime.jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsxRuntime.jsx(SpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxRuntime.jsxs(ui.NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title:
|
|
33
|
+
} }), jsxRuntime.jsx(ui.NiceAppShell, { className: className, flush: true, menubar: jsxRuntime.jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsxRuntime.jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsxRuntime.jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsxRuntime.jsx(PixelEditorTimeline, { api: api }), statusBar: jsxRuntime.jsx(PixelEditorStatusBar, { api: api }), children: jsxRuntime.jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsxRuntime.jsx(SpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxRuntime.jsxs(ui.NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title: t('pixelEditor.newDocument', 'New Document'), children: [jsxRuntime.jsx("label", { children: t('pixelEditor.widthPx', 'Width (px)') }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 1, max: 4096, value: api.nw, onChange: (val) => api.setNw(val !== null && val !== void 0 ? val : 64), "aria-label": t('pixelEditor.documentWidth', 'Document width') }), jsxRuntime.jsx("label", { children: t('pixelEditor.heightPx', 'Height (px)') }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 1, max: 4096, value: api.nh, onChange: (val) => api.setNh(val !== null && val !== void 0 ? val : 64), "aria-label": t('pixelEditor.documentHeight', 'Document height') }), jsxRuntime.jsx("div", { style: { display: 'flex', gap: 4, flexWrap: 'wrap', marginTop: 8 }, children: [
|
|
31
34
|
[16, 16],
|
|
32
35
|
[32, 32],
|
|
33
36
|
[48, 48],
|
|
@@ -41,7 +44,7 @@ const NicePixelEditor = ({ initialWidth = 64, initialHeight = 64, className, onS
|
|
|
41
44
|
].map(([w, h]) => (jsxRuntime.jsxs(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", size: "sm", style: { fontSize: 10, padding: '2px 6px' }, onClick: () => {
|
|
42
45
|
api.setNw(w);
|
|
43
46
|
api.setNh(h);
|
|
44
|
-
}, children: [w, "x", h] }, `${w}x${h}`))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", onClick: () => api.setDlgNew(false), children:
|
|
47
|
+
}, children: [w, "x", h] }, `${w}x${h}`))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", onClick: () => api.setDlgNew(false), children: t('pixelEditor.cancel', 'Cancel') }), jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnPrimary, variant: "primary", onClick: () => api.newDoc(api.nw, api.nh), children: t('pixelEditor.create', 'Create') })] })] })] }));
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
exports.NicePixelEditor = NicePixelEditor;
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18n = require('../core/i18n.js');
|
|
5
6
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
6
7
|
|
|
7
|
-
const PixelEditorCanvas =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const PixelEditorCanvas = /* @__PURE__ */ Object.assign(
|
|
9
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
10
|
+
const { t } = i18n.useNiceTranslation();
|
|
11
|
+
return (jsxRuntime.jsx("div", { ref: api.boxRef, className: PixelEditor_module.canvasContainer, children: jsxRuntime.jsx("canvas", { ref: api.cvRef, onPointerDown: api.onDown, onPointerMove: api.onMove, onPointerUp: api.onUp, onPointerLeave: () => {
|
|
12
|
+
api.drawing.current = false;
|
|
13
|
+
api.panning.current = false;
|
|
14
|
+
api.setCursor(null);
|
|
15
|
+
}, onWheel: api.onWheel, onContextMenu: (e) => e.preventDefault(), style: { inset: 0, width: '100%', height: '100%', touchAction: 'none' }, "aria-label": t('pixelEditorCanvas.pixelEditorCanvas', 'Pixel editor canvas') }) }));
|
|
16
|
+
}), { displayName: 'PixelEditorCanvas' });
|
|
13
17
|
|
|
14
18
|
module.exports = PixelEditorCanvas;
|
|
@@ -4,40 +4,71 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var ui = require('@nice2dev/ui');
|
|
5
5
|
var uiCore = require('@nice2dev/ui-core');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var i18n = require('../core/i18n.js');
|
|
7
8
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
8
9
|
|
|
9
|
-
const PixelEditorMenuBar =
|
|
10
|
+
const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
11
|
+
/* @__PURE__ */ React.memo(({ api, hasOnSaveToLibrary, onOpenGenerator }) => {
|
|
12
|
+
const { t } = i18n.useNiceTranslation();
|
|
10
13
|
const items = [
|
|
11
14
|
{
|
|
12
15
|
id: 'file',
|
|
13
|
-
label: 'File',
|
|
16
|
+
label: t('pixelEditorMenuBar.file', 'File'),
|
|
14
17
|
children: [
|
|
15
18
|
{
|
|
16
19
|
id: 'new',
|
|
17
|
-
label: 'New…',
|
|
20
|
+
label: t('pixelEditorMenuBar.new', 'New…'),
|
|
18
21
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "file", size: 14 }),
|
|
19
22
|
onClick: () => api.setDlgNew(true),
|
|
20
23
|
},
|
|
21
24
|
{
|
|
22
25
|
id: 'open',
|
|
23
|
-
label: 'Open…',
|
|
26
|
+
label: t('pixelEditorMenuBar.open', 'Open…'),
|
|
24
27
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "folder", size: 14 }),
|
|
25
28
|
onClick: () => { var _a; return (_a = api.fInp.current) === null || _a === void 0 ? void 0 : _a.click(); },
|
|
26
29
|
},
|
|
27
30
|
{ id: 'sep-file-1', divider: true },
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
31
|
+
{
|
|
32
|
+
id: 'ase',
|
|
33
|
+
label: t('pixelEditorMenuBar.saveAse', 'Save .ase'),
|
|
34
|
+
onClick: api.exportAse,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'png',
|
|
38
|
+
label: t('pixelEditorMenuBar.exportPng', 'Export PNG'),
|
|
39
|
+
onClick: api.exportPNG,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'jpg',
|
|
43
|
+
label: t('pixelEditorMenuBar.exportJpg', 'Export JPG'),
|
|
44
|
+
onClick: api.exportJPG,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'webp',
|
|
48
|
+
label: t('pixelEditorMenuBar.exportWebp', 'Export WebP'),
|
|
49
|
+
onClick: api.exportWebP,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'bmp',
|
|
53
|
+
label: t('pixelEditorMenuBar.exportBmp', 'Export BMP'),
|
|
54
|
+
onClick: api.exportBMP,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'svg',
|
|
58
|
+
label: t('pixelEditorMenuBar.exportSvg', 'Export SVG'),
|
|
59
|
+
onClick: api.exportSVG,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'sheet',
|
|
63
|
+
label: t('pixelEditorMenuBar.exportSpriteSheet', 'Export sprite sheet'),
|
|
64
|
+
onClick: api.exportSheet,
|
|
65
|
+
},
|
|
35
66
|
...(hasOnSaveToLibrary
|
|
36
67
|
? [
|
|
37
68
|
{ id: 'sep-file-2', divider: true },
|
|
38
69
|
{
|
|
39
70
|
id: 'lib',
|
|
40
|
-
label: 'Save to Library',
|
|
71
|
+
label: t('pixelEditorMenuBar.saveToLibrary', 'Save to Library'),
|
|
41
72
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14 }),
|
|
42
73
|
onClick: api.saveToLibrary,
|
|
43
74
|
},
|
|
@@ -47,35 +78,70 @@ const PixelEditorMenuBar = React.memo(({ api, hasOnSaveToLibrary, onOpenGenerato
|
|
|
47
78
|
},
|
|
48
79
|
{
|
|
49
80
|
id: 'edit',
|
|
50
|
-
label: 'Edit',
|
|
81
|
+
label: t('pixelEditorMenuBar.edit', 'Edit'),
|
|
51
82
|
children: [
|
|
52
|
-
{ id: 'undo', label: 'Undo', onClick: api.undo },
|
|
53
|
-
{ id: 'redo', label: 'Redo', onClick: api.redo },
|
|
83
|
+
{ id: 'undo', label: t('pixelEditorMenuBar.undo', 'Undo'), onClick: api.undo },
|
|
84
|
+
{ id: 'redo', label: t('pixelEditorMenuBar.redo', 'Redo'), onClick: api.redo },
|
|
54
85
|
{ id: 'sep-edit-1', divider: true },
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
86
|
+
{
|
|
87
|
+
id: 'copy',
|
|
88
|
+
label: t('pixelEditorMenuBar.copy', 'Copy'),
|
|
89
|
+
onClick: api.doCopy,
|
|
90
|
+
disabled: !api.sel,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'cut',
|
|
94
|
+
label: t('pixelEditorMenuBar.cut', 'Cut'),
|
|
95
|
+
onClick: api.doCut,
|
|
96
|
+
disabled: !api.sel,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'paste',
|
|
100
|
+
label: t('pixelEditorMenuBar.paste', 'Paste'),
|
|
101
|
+
onClick: api.doPaste,
|
|
102
|
+
disabled: !api.clipboard.current,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'selall',
|
|
106
|
+
label: t('pixelEditorMenuBar.selectAll', 'Select all'),
|
|
107
|
+
onClick: api.doSelectAll,
|
|
108
|
+
},
|
|
59
109
|
],
|
|
60
110
|
},
|
|
61
111
|
{
|
|
62
112
|
id: 'image',
|
|
63
|
-
label: 'Image',
|
|
113
|
+
label: t('pixelEditorMenuBar.image', 'Image'),
|
|
64
114
|
children: [
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
115
|
+
{
|
|
116
|
+
id: 'fliph',
|
|
117
|
+
label: t('pixelEditorMenuBar.flipHorizontal', 'Flip horizontal'),
|
|
118
|
+
onClick: () => api.flipCv('h'),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'flipv',
|
|
122
|
+
label: t('pixelEditorMenuBar.flipVertical', 'Flip vertical'),
|
|
123
|
+
onClick: () => api.flipCv('v'),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'rot',
|
|
127
|
+
label: t('pixelEditorMenuBar.rotate90', 'Rotate 90°'),
|
|
128
|
+
onClick: api.rotateCv,
|
|
129
|
+
},
|
|
68
130
|
{ id: 'sep-image-1', divider: true },
|
|
69
|
-
{
|
|
131
|
+
{
|
|
132
|
+
id: 'clear',
|
|
133
|
+
label: t('pixelEditorMenuBar.clearCanvas', 'Clear canvas'),
|
|
134
|
+
onClick: api.clearCv,
|
|
135
|
+
},
|
|
70
136
|
],
|
|
71
137
|
},
|
|
72
138
|
{
|
|
73
139
|
id: 'view',
|
|
74
|
-
label: 'View',
|
|
140
|
+
label: t('pixelEditorMenuBar.view', 'View'),
|
|
75
141
|
children: [
|
|
76
142
|
{
|
|
77
143
|
id: 'grid',
|
|
78
|
-
label: 'Show grid',
|
|
144
|
+
label: t('pixelEditorMenuBar.showGrid', 'Show grid'),
|
|
79
145
|
badge: api.grid ? 'On' : 'Off',
|
|
80
146
|
onClick: () => api.setGrid((g) => !g),
|
|
81
147
|
},
|
|
@@ -83,11 +149,11 @@ const PixelEditorMenuBar = React.memo(({ api, hasOnSaveToLibrary, onOpenGenerato
|
|
|
83
149
|
},
|
|
84
150
|
{
|
|
85
151
|
id: 'tools',
|
|
86
|
-
label: 'Tools',
|
|
152
|
+
label: t('pixelEditorMenuBar.tools', 'Tools'),
|
|
87
153
|
children: [
|
|
88
154
|
{
|
|
89
155
|
id: 'gen',
|
|
90
|
-
label: 'Sprite generator…',
|
|
156
|
+
label: t('pixelEditorMenuBar.spriteGenerator', 'Sprite generator…'),
|
|
91
157
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "palette", size: 14 }),
|
|
92
158
|
onClick: onOpenGenerator,
|
|
93
159
|
},
|
|
@@ -95,7 +161,6 @@ const PixelEditorMenuBar = React.memo(({ api, hasOnSaveToLibrary, onOpenGenerato
|
|
|
95
161
|
},
|
|
96
162
|
];
|
|
97
163
|
return (jsxRuntime.jsx("div", { className: PixelEditor_module.menuBar, children: jsxRuntime.jsx(ui.NiceMenu, { items: items, orientation: "horizontal", variant: "ghost", density: "compact" }) }));
|
|
98
|
-
});
|
|
99
|
-
PixelEditorMenuBar.displayName = 'PixelEditorMenuBar';
|
|
164
|
+
}), { displayName: 'PixelEditorMenuBar' });
|
|
100
165
|
|
|
101
166
|
module.exports = PixelEditorMenuBar;
|