@nice2dev/ui-graphics 1.2.1 → 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 +39 -0
- package/dist/cjs/animation/AnimatedPerson.js +3 -1
- package/dist/cjs/core/NiceBrushEngine.js +5 -4
- package/dist/cjs/core/collaboration.js +11 -6
- package/dist/cjs/core/minimap.js +21 -20
- package/dist/cjs/font/NiceFontEditor.js +5 -5
- package/dist/cjs/game/GameAsset2dEditor.js +57 -38
- package/dist/cjs/photo/NiceAITools.js +3 -3
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +14 -14
- package/dist/cjs/pixel/PixelEditor.js +1 -1
- package/dist/cjs/pixel/PixelEditorMenuBar.js +92 -27
- package/dist/cjs/pixel/PixelEditorRightPanel.js +7 -3
- package/dist/cjs/pixel/PixelEditorStatusBar.js +6 -2
- package/dist/cjs/pixel/PixelEditorTimeline.js +5 -1
- package/dist/cjs/pixel/PixelEditorToolbar.js +3 -1
- package/dist/cjs/pixel/SpriteGeneratorPanel.js +18 -11
- package/dist/cjs/texture/Nice3DTexturePainter.js +9 -5
- package/dist/cjs/vector/NiceSvgToCode.js +3 -3
- package/dist/cjs/vector/VectorEditor.js +1 -1
- package/dist/cjs/vector/VectorEditorMenuBar.js +7 -1
- package/dist/cjs/vector/VectorEditorRightPanel.js +1 -1
- package/dist/esm/animation/AnimatedPerson.js +3 -1
- package/dist/esm/core/NiceBrushEngine.js +5 -4
- package/dist/esm/core/collaboration.js +11 -6
- package/dist/esm/core/minimap.js +21 -20
- package/dist/esm/font/NiceFontEditor.js +5 -5
- package/dist/esm/game/GameAsset2dEditor.js +57 -38
- package/dist/esm/photo/NiceAITools.js +3 -3
- package/dist/esm/photo/PhotoEditorLeftPanel.js +14 -14
- package/dist/esm/pixel/PixelEditor.js +1 -1
- package/dist/esm/pixel/PixelEditorMenuBar.js +92 -27
- package/dist/esm/pixel/PixelEditorRightPanel.js +7 -3
- package/dist/esm/pixel/PixelEditorStatusBar.js +6 -2
- package/dist/esm/pixel/PixelEditorTimeline.js +5 -1
- package/dist/esm/pixel/PixelEditorToolbar.js +3 -1
- package/dist/esm/pixel/SpriteGeneratorPanel.js +18 -11
- package/dist/esm/texture/Nice3DTexturePainter.js +9 -5
- package/dist/esm/vector/NiceSvgToCode.js +3 -3
- package/dist/esm/vector/VectorEditor.js +1 -1
- package/dist/esm/vector/VectorEditorMenuBar.js +7 -1
- package/dist/esm/vector/VectorEditorRightPanel.js +1 -1
- package/package.json +3 -3
|
@@ -59,12 +59,12 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
59
59
|
color: activeTab === tab.key ? accent : undefined,
|
|
60
60
|
borderBottomColor: activeTab === tab.key ? accent : undefined,
|
|
61
61
|
}, children: [jsx(NiceIcon, { name: tab.icon, size: 14 }), tab.label] }, tab.key))) }), jsxs("div", { className: cs.panelContent, children: [activeTab === 'filters' && (jsxs(Fragment, { children: [jsx("div", { className: cs.pillRow, children: [
|
|
62
|
-
{ key: 'all', label: 'All' },
|
|
63
|
-
{ key: 'color', label: 'Color' },
|
|
64
|
-
{ key: 'light', label: 'Light' },
|
|
65
|
-
{ key: 'vintage', label: 'Vintage' },
|
|
66
|
-
{ key: 'artistic', label: 'Artistic' },
|
|
67
|
-
{ key: 'fun', label: 'Fun' },
|
|
62
|
+
{ key: 'all', label: t('photoEditor.all', 'All') },
|
|
63
|
+
{ key: 'color', label: t('photoEditor.color', 'Color') },
|
|
64
|
+
{ key: 'light', label: t('photoEditor.light', 'Light') },
|
|
65
|
+
{ key: 'vintage', label: t('photoEditor.vintage', 'Vintage') },
|
|
66
|
+
{ key: 'artistic', label: t('photoEditor.artistic', 'Artistic') },
|
|
67
|
+
{ key: 'fun', label: t('photoEditor.fun', 'Fun') },
|
|
68
68
|
].map((cat) => (jsx("button", { onClick: () => setFilterCategory(cat.key), className: filterCategory === cat.key ? cs.pillActive : cs.pill, style: {
|
|
69
69
|
borderColor: filterCategory === cat.key ? accent : undefined,
|
|
70
70
|
background: filterCategory === cat.key ? accentDim : undefined,
|
|
@@ -120,7 +120,7 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
120
120
|
}, children: [jsx(NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.horizontal', 'Horizontal')] }), jsxs(Button, { variant: flipV ? 'outline-info' : 'dark', size: "sm", onClick: () => {
|
|
121
121
|
setFlipV(!flipV);
|
|
122
122
|
pushHistory();
|
|
123
|
-
}, children: [jsx(NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.vertical', 'Vertical')] })] }), jsx("div", { className: cs.sectionTitleMb8, children: t('photoEditor.previewZoom', 'Preview zoom') }), jsxs("div", { className: cs.transformZoomRow, children: [jsx(RangeInput, { min: 50, max: 300, value: zoom * 100, onChange: (e) => setZoom(Number(e.target.value) / 100), accentColor: accent }), jsxs("span", { className: cs.transformZoomValue, style: { color: accent }, children: [Math.round(zoom * 100), "%"] })] }), jsxs("div", { className: cs.transformInfo, children: [jsxs("div", { children: [jsx("strong", { children:
|
|
123
|
+
}, children: [jsx(NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.vertical', 'Vertical')] })] }), jsx("div", { className: cs.sectionTitleMb8, children: t('photoEditor.previewZoom', 'Preview zoom') }), jsxs("div", { className: cs.transformZoomRow, children: [jsx(RangeInput, { min: 50, max: 300, value: zoom * 100, onChange: (e) => setZoom(Number(e.target.value) / 100), accentColor: accent }), jsxs("span", { className: cs.transformZoomValue, style: { color: accent }, children: [Math.round(zoom * 100), "%"] })] }), jsxs("div", { className: cs.transformInfo, children: [jsxs("div", { children: [jsx("strong", { children: t('photoEditor.rotation2', 'Rotation:') }), " ", rotation, "\u00B0"] }), jsxs("div", { children: [jsx("strong", { children: t('photoEditor.flipH', 'Flip H:') }), ' ', flipH ? t('photoEditor.yes', 'Yes') : t('photoEditor.no', 'No')] }), jsxs("div", { children: [jsx("strong", { children: t('photoEditor.flipV', 'Flip V:') }), ' ', flipV ? t('photoEditor.yes', 'Yes') : t('photoEditor.no', 'No')] }), cropRect && (jsxs("div", { children: [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' && (jsxs("div", { children: [jsx(OverlayToolbar, { api: api }), jsxs("div", { className: cs.sectionTitle, children: [jsx(NiceIcon, { name: "circle", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.stickersEmoji', 'Stickers / Emoji')] }), jsx("div", { className: cs.pillRowGap3, children: EMOJI_CATALOG.map((cat) => (jsxs("button", { onClick: () => setEmojiCat(cat.id), className: emojiCat === cat.id ? cs.pillEmojiActive : cs.pillEmoji, style: {
|
|
124
124
|
borderColor: emojiCat === cat.id ? accent : undefined,
|
|
125
125
|
background: emojiCat === cat.id ? accentDim : undefined,
|
|
126
126
|
}, children: [cat.icon, " ", cat.label] }, cat.id))) }), jsx("div", { className: cs.emojiGrid, children: (_a = EMOJI_CATALOG.find((c) => c.id === emojiCat)) === null || _a === void 0 ? void 0 : _a.emojis.map((em, idx) => (jsx("button", { onClick: () => {
|
|
@@ -128,14 +128,14 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
128
128
|
const cw = (_b = (_a = mainCanvasRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 400;
|
|
129
129
|
const ch = (_d = (_c = mainCanvasRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 400;
|
|
130
130
|
addOverlay(createEmojiOverlay(em, cw, ch));
|
|
131
|
-
}, className: cs.emojiBtn, title: em, children: em }, idx))) }), overlays.length > 0 && (jsxs("div", { className: cs.overlaySection, children: [
|
|
131
|
+
}, className: cs.emojiBtn, title: em, children: em }, idx))) }), overlays.length > 0 && (jsxs("div", { className: cs.overlaySection, children: [jsx("div", { className: cs.overlaySectionTitle, children: t('photoEditor.layers', 'Layers ({overlays})').replace('{overlays}', String(overlays.length)) }), overlays.map((ov) => (jsxs("div", { onClick: () => setSelectedOverlayId(ov.id), className: cs.overlayItem, style: { background: selectedOverlayId === ov.id ? accentDim : undefined }, children: [jsx("span", { className: cs.overlayIcon, children: ov.type === 'emoji' ? (ov.emoji) : ov.type === 'text' ? ('T') : ov.type === 'shape' ? (jsx(NiceIcon, { name: "star", size: 14 })) : ov.type === 'drawing' ? (jsx(NiceIcon, { name: "pen", size: 14 })) : (jsx(NiceIcon, { name: "square", size: 14 })) }), jsx("span", { className: cs.overlayName, children: ov.type === 'text'
|
|
132
132
|
? ov.text.slice(0, 20)
|
|
133
133
|
: ov.type === 'emoji'
|
|
134
|
-
? 'Emoji'
|
|
134
|
+
? t('photoEditor.emoji', 'Emoji')
|
|
135
135
|
: ov.type === 'shape'
|
|
136
136
|
? ov.shapeKind
|
|
137
137
|
: ov.type === 'drawing'
|
|
138
|
-
?
|
|
138
|
+
? t('photoEditor.drawing', 'Drawing ({strokes})').replace('{strokes}', String(ov.strokes.length))
|
|
139
139
|
: ov.type === 'frame'
|
|
140
140
|
? ov.frameStyle
|
|
141
141
|
: '' }), jsx("button", { onClick: (e) => {
|
|
@@ -165,13 +165,13 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
165
165
|
italic: !selectedOverlay.italic,
|
|
166
166
|
});
|
|
167
167
|
pushHistory();
|
|
168
|
-
}, className: cs.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxs("div", { children: [jsx(OverlayToolbar, { api: api }), jsxs("div", { className: cs.sectionTitle, children: [jsx(NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.shapes', 'Shapes')] }), jsxs("div", { className: cs.shapeColorRow, children: [jsx("span", { className: cs.shapeColorLabel, children:
|
|
168
|
+
}, className: cs.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxs("div", { children: [jsx(OverlayToolbar, { api: api }), jsxs("div", { className: cs.sectionTitle, children: [jsx(NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.shapes', 'Shapes')] }), jsxs("div", { className: cs.shapeColorRow, children: [jsx("span", { className: cs.shapeColorLabel, children: t('photoEditor.stroke', 'Stroke:') }), jsx("input", { type: "color", value: shapeStroke, onChange: (e) => setShapeStroke(e.target.value), className: cs.colorInput, title: t('photoEditor.strokeColor', 'Stroke color') }), jsx("span", { className: cs.shapeColorLabelMl, children: t('photoEditor.fill', 'Fill:') }), jsx("input", { type: "color", value: shapeFill || '#ffffff', onChange: (e) => setShapeFill(e.target.value), className: cs.colorInput, title: t('photoEditor.fillColor', 'Fill color') }), jsx(Button, { variant: shapeFill ? 'light' : 'dark', size: "sm", onClick: () => setShapeFill(shapeFill ? '' : '#ffffff'), className: cs.shapeFillToggle, children: shapeFill ? t('photoEditor.off', 'Off') : t('photoEditor.on', 'On') })] }), jsxs("div", { className: cs.sliderRow, children: [jsx("span", { className: cs.sliderLabel, children: t('photoEditor.width', 'Width:') }), jsx(RangeInput, { min: 1, max: 20, value: shapeStrokeW, onChange: (e) => setShapeStrokeW(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxs("span", { className: cs.sliderValue, style: { color: accent }, children: [shapeStrokeW, "px"] })] }), jsx("div", { className: cs.shapeGrid, children: SHAPE_CATALOG.map((sh) => (jsx("button", { title: sh.label, onClick: () => {
|
|
169
169
|
const ov = createShapeOverlay(sh.id);
|
|
170
170
|
ov.strokeColor = shapeStroke;
|
|
171
171
|
ov.fillColor = shapeFill || null;
|
|
172
172
|
ov.strokeWidth = shapeStrokeW;
|
|
173
173
|
addOverlay(ov);
|
|
174
|
-
}, className: cs.shapeBtn, children: jsx(NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxs("div", { className: cs.sectionTitle, children: [jsx(NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.frames', 'Frames')] }), jsxs("div", { className: cs.frameColorRow, children: [jsx("input", { type: "color", value: frameColor, onChange: (e) => setFrameColor(e.target.value), className: cs.colorInput, "aria-label": t('photoEditor.frameColor', 'Frame color') }), jsxs("div", { className: cs.frameThicknessWrap, children: [jsx("span", { className: cs.sliderLabel, children:
|
|
174
|
+
}, className: cs.shapeBtn, children: jsx(NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxs("div", { className: cs.sectionTitle, children: [jsx(NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.frames', 'Frames')] }), jsxs("div", { className: cs.frameColorRow, children: [jsx("input", { type: "color", value: frameColor, onChange: (e) => setFrameColor(e.target.value), className: cs.colorInput, "aria-label": t('photoEditor.frameColor', 'Frame color') }), jsxs("div", { className: cs.frameThicknessWrap, children: [jsx("span", { className: cs.sliderLabel, children: t('photoEditor.thickness', 'Thickness:') }), jsx(RangeInput, { min: 1, max: 10, value: frameThick, onChange: (e) => setFrameThick(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsx("span", { className: cs.frameThicknessValue, style: { color: accent }, children: frameThick })] })] }), jsxs("div", { className: cs.frameGrid, children: [FRAME_CATALOG.map((fr) => (jsx("button", { title: fr.label, onClick: () => {
|
|
175
175
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
176
176
|
const ov = createFrameOverlay(fr.id, frameColor);
|
|
177
177
|
ov.thickness = frameThick / 100;
|
|
@@ -179,7 +179,7 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
179
179
|
}, className: cs.frameBtn, children: jsx(NiceIcon, { name: fr.icon, size: 18 }) }, fr.id))), jsx("button", { title: t('photoEditor.removeFrame', 'Remove frame'), "aria-label": t('photoEditor.removeFrame', 'Remove frame'), onClick: () => {
|
|
180
180
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
181
181
|
pushHistory();
|
|
182
|
-
}, className: cs.removeFrameBtn, children: jsx(NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxs("div", { children: [jsx(OverlayToolbar, { api: api }), jsxs("div", { className: cs.sectionTitleMb8, children: [jsx(NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.freehandDrawing', 'Freehand drawing')] }), jsxs("div", { className: cs.sectionInfoMb, children: [jsx(NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.drawDirectlyOnThePhoto', 'Draw directly on the photo by holding the left mouse button.')] }), jsxs("div", { className: cs.quickColorRow, children: [jsx("span", { className: cs.sliderLabel, children:
|
|
182
|
+
}, className: cs.removeFrameBtn, children: jsx(NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxs("div", { children: [jsx(OverlayToolbar, { api: api }), jsxs("div", { className: cs.sectionTitleMb8, children: [jsx(NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.freehandDrawing', 'Freehand drawing')] }), jsxs("div", { className: cs.sectionInfoMb, children: [jsx(NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.drawDirectlyOnThePhoto', 'Draw directly on the photo by holding the left mouse button.')] }), jsxs("div", { className: cs.quickColorRow, children: [jsx("span", { className: cs.sliderLabel, children: t('photoEditor.color2', 'Color:') }), jsx("input", { type: "color", value: drawColor, onChange: (e) => setDrawColor(e.target.value), className: cs.colorInputDraw, "aria-label": t('photoEditor.drawColor', 'Drawing color') }), [
|
|
183
183
|
'#ff0000',
|
|
184
184
|
'#ff8800',
|
|
185
185
|
'#ffff00',
|
|
@@ -192,7 +192,7 @@ const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
|
192
192
|
].map((c) => (jsx("div", { onClick: () => setDrawColor(c), className: cs.quickColorSwatch, style: {
|
|
193
193
|
background: c,
|
|
194
194
|
border: drawColor === c ? `2px solid ${accent}` : undefined,
|
|
195
|
-
} }, c)))] }), jsxs("div", { className: cs.sliderRow, style: { marginBottom: 12 }, children: [jsx("span", { className: cs.sliderLabel, children:
|
|
195
|
+
} }, c)))] }), jsxs("div", { className: cs.sliderRow, style: { marginBottom: 12 }, children: [jsx("span", { className: cs.sliderLabel, children: t('photoEditor.width', 'Width:') }), jsx(RangeInput, { min: 1, max: 30, value: drawWidth, onChange: (e) => setDrawWidth(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxs("span", { className: cs.sliderValue, style: { color: accent }, children: [drawWidth, "px"] })] }), jsx("div", { className: cs.drawPreview, children: jsx("div", { style: {
|
|
196
196
|
width: Math.max(drawWidth, 4),
|
|
197
197
|
height: Math.max(drawWidth, 4),
|
|
198
198
|
borderRadius: '50%',
|
|
@@ -28,7 +28,7 @@ const NicePixelEditor = ({ initialWidth = 64, initialHeight = 64, className, onS
|
|
|
28
28
|
api.openFile(f);
|
|
29
29
|
}
|
|
30
30
|
e.target.value = '';
|
|
31
|
-
} }), jsx(NiceAppShell, { className: className, flush: true, menubar: jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsx(PixelEditorTimeline, { api: api }), statusBar: jsx(PixelEditorStatusBar, { api: api }), children: jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsx(NiceSpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxs(NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title: t('pixelEditor.newDocument', 'New Document'), children: [jsx("label", { children:
|
|
31
|
+
} }), jsx(NiceAppShell, { className: className, flush: true, menubar: jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsx(PixelEditorTimeline, { api: api }), statusBar: jsx(PixelEditorStatusBar, { api: api }), children: jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsx(NiceSpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxs(NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title: t('pixelEditor.newDocument', 'New Document'), children: [jsx("label", { children: t('pixelEditor.widthPx', 'Width (px)') }), jsx(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') }), jsx("label", { children: t('pixelEditor.heightPx', 'Height (px)') }), jsx(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') }), jsx("div", { style: { display: 'flex', gap: 4, flexWrap: 'wrap', marginTop: 8 }, children: [
|
|
32
32
|
[16, 16],
|
|
33
33
|
[32, 32],
|
|
34
34
|
[48, 48],
|
|
@@ -2,41 +2,71 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { NiceMenu } from '@nice2dev/ui';
|
|
3
3
|
import { NiceIcon } from '@nice2dev/ui-core';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { useNiceTranslation } from '../core/i18n.js';
|
|
5
6
|
import styles from './PixelEditor.module.css.js';
|
|
6
7
|
|
|
7
8
|
const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
8
9
|
/* @__PURE__ */ React.memo(({ api, hasOnSaveToLibrary, onOpenGenerator }) => {
|
|
10
|
+
const { t } = useNiceTranslation();
|
|
9
11
|
const items = [
|
|
10
12
|
{
|
|
11
13
|
id: 'file',
|
|
12
|
-
label: 'File',
|
|
14
|
+
label: t('pixelEditorMenuBar.file', 'File'),
|
|
13
15
|
children: [
|
|
14
16
|
{
|
|
15
17
|
id: 'new',
|
|
16
|
-
label: 'New…',
|
|
18
|
+
label: t('pixelEditorMenuBar.new', 'New…'),
|
|
17
19
|
icon: jsx(NiceIcon, { name: "file", size: 14 }),
|
|
18
20
|
onClick: () => api.setDlgNew(true),
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
id: 'open',
|
|
22
|
-
label: 'Open…',
|
|
24
|
+
label: t('pixelEditorMenuBar.open', 'Open…'),
|
|
23
25
|
icon: jsx(NiceIcon, { name: "folder", size: 14 }),
|
|
24
26
|
onClick: () => { var _a; return (_a = api.fInp.current) === null || _a === void 0 ? void 0 : _a.click(); },
|
|
25
27
|
},
|
|
26
28
|
{ id: 'sep-file-1', divider: true },
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
|
|
29
|
+
{
|
|
30
|
+
id: 'ase',
|
|
31
|
+
label: t('pixelEditorMenuBar.saveAse', 'Save .ase'),
|
|
32
|
+
onClick: api.exportAse,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'png',
|
|
36
|
+
label: t('pixelEditorMenuBar.exportPng', 'Export PNG'),
|
|
37
|
+
onClick: api.exportPNG,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'jpg',
|
|
41
|
+
label: t('pixelEditorMenuBar.exportJpg', 'Export JPG'),
|
|
42
|
+
onClick: api.exportJPG,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'webp',
|
|
46
|
+
label: t('pixelEditorMenuBar.exportWebp', 'Export WebP'),
|
|
47
|
+
onClick: api.exportWebP,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'bmp',
|
|
51
|
+
label: t('pixelEditorMenuBar.exportBmp', 'Export BMP'),
|
|
52
|
+
onClick: api.exportBMP,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'svg',
|
|
56
|
+
label: t('pixelEditorMenuBar.exportSvg', 'Export SVG'),
|
|
57
|
+
onClick: api.exportSVG,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'sheet',
|
|
61
|
+
label: t('pixelEditorMenuBar.exportSpriteSheet', 'Export sprite sheet'),
|
|
62
|
+
onClick: api.exportSheet,
|
|
63
|
+
},
|
|
34
64
|
...(hasOnSaveToLibrary
|
|
35
65
|
? [
|
|
36
66
|
{ id: 'sep-file-2', divider: true },
|
|
37
67
|
{
|
|
38
68
|
id: 'lib',
|
|
39
|
-
label: 'Save to Library',
|
|
69
|
+
label: t('pixelEditorMenuBar.saveToLibrary', 'Save to Library'),
|
|
40
70
|
icon: jsx(NiceIcon, { name: "box", size: 14 }),
|
|
41
71
|
onClick: api.saveToLibrary,
|
|
42
72
|
},
|
|
@@ -46,35 +76,70 @@ const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
|
46
76
|
},
|
|
47
77
|
{
|
|
48
78
|
id: 'edit',
|
|
49
|
-
label: 'Edit',
|
|
79
|
+
label: t('pixelEditorMenuBar.edit', 'Edit'),
|
|
50
80
|
children: [
|
|
51
|
-
{ id: 'undo', label: 'Undo', onClick: api.undo },
|
|
52
|
-
{ id: 'redo', label: 'Redo', onClick: api.redo },
|
|
81
|
+
{ id: 'undo', label: t('pixelEditorMenuBar.undo', 'Undo'), onClick: api.undo },
|
|
82
|
+
{ id: 'redo', label: t('pixelEditorMenuBar.redo', 'Redo'), onClick: api.redo },
|
|
53
83
|
{ id: 'sep-edit-1', divider: true },
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
{
|
|
85
|
+
id: 'copy',
|
|
86
|
+
label: t('pixelEditorMenuBar.copy', 'Copy'),
|
|
87
|
+
onClick: api.doCopy,
|
|
88
|
+
disabled: !api.sel,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'cut',
|
|
92
|
+
label: t('pixelEditorMenuBar.cut', 'Cut'),
|
|
93
|
+
onClick: api.doCut,
|
|
94
|
+
disabled: !api.sel,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'paste',
|
|
98
|
+
label: t('pixelEditorMenuBar.paste', 'Paste'),
|
|
99
|
+
onClick: api.doPaste,
|
|
100
|
+
disabled: !api.clipboard.current,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'selall',
|
|
104
|
+
label: t('pixelEditorMenuBar.selectAll', 'Select all'),
|
|
105
|
+
onClick: api.doSelectAll,
|
|
106
|
+
},
|
|
58
107
|
],
|
|
59
108
|
},
|
|
60
109
|
{
|
|
61
110
|
id: 'image',
|
|
62
|
-
label: 'Image',
|
|
111
|
+
label: t('pixelEditorMenuBar.image', 'Image'),
|
|
63
112
|
children: [
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
113
|
+
{
|
|
114
|
+
id: 'fliph',
|
|
115
|
+
label: t('pixelEditorMenuBar.flipHorizontal', 'Flip horizontal'),
|
|
116
|
+
onClick: () => api.flipCv('h'),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'flipv',
|
|
120
|
+
label: t('pixelEditorMenuBar.flipVertical', 'Flip vertical'),
|
|
121
|
+
onClick: () => api.flipCv('v'),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: 'rot',
|
|
125
|
+
label: t('pixelEditorMenuBar.rotate90', 'Rotate 90°'),
|
|
126
|
+
onClick: api.rotateCv,
|
|
127
|
+
},
|
|
67
128
|
{ id: 'sep-image-1', divider: true },
|
|
68
|
-
{
|
|
129
|
+
{
|
|
130
|
+
id: 'clear',
|
|
131
|
+
label: t('pixelEditorMenuBar.clearCanvas', 'Clear canvas'),
|
|
132
|
+
onClick: api.clearCv,
|
|
133
|
+
},
|
|
69
134
|
],
|
|
70
135
|
},
|
|
71
136
|
{
|
|
72
137
|
id: 'view',
|
|
73
|
-
label: 'View',
|
|
138
|
+
label: t('pixelEditorMenuBar.view', 'View'),
|
|
74
139
|
children: [
|
|
75
140
|
{
|
|
76
141
|
id: 'grid',
|
|
77
|
-
label: 'Show grid',
|
|
142
|
+
label: t('pixelEditorMenuBar.showGrid', 'Show grid'),
|
|
78
143
|
badge: api.grid ? 'On' : 'Off',
|
|
79
144
|
onClick: () => api.setGrid((g) => !g),
|
|
80
145
|
},
|
|
@@ -82,11 +147,11 @@ const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
|
82
147
|
},
|
|
83
148
|
{
|
|
84
149
|
id: 'tools',
|
|
85
|
-
label: 'Tools',
|
|
150
|
+
label: t('pixelEditorMenuBar.tools', 'Tools'),
|
|
86
151
|
children: [
|
|
87
152
|
{
|
|
88
153
|
id: 'gen',
|
|
89
|
-
label: 'Sprite generator…',
|
|
154
|
+
label: t('pixelEditorMenuBar.spriteGenerator', 'Sprite generator…'),
|
|
90
155
|
icon: jsx(NiceIcon, { name: "palette", size: 14 }),
|
|
91
156
|
onClick: onOpenGenerator,
|
|
92
157
|
},
|
|
@@ -18,17 +18,21 @@ const PixelEditorRightPanel = /* @__PURE__ */ Object.assign(
|
|
|
18
18
|
.map(({ l, i }) => (jsxs("div", { className: `${styles.layerItem} ${i === api.aLi ? styles.layerItemActive : ''}`, onClick: () => api.setALi(i), children: [jsx("span", { className: styles.layerVis, onClick: (e) => {
|
|
19
19
|
e.stopPropagation();
|
|
20
20
|
api.toggleVis(i);
|
|
21
|
-
}, title: l.visible
|
|
21
|
+
}, title: l.visible
|
|
22
|
+
? t('pixelEditorRightPanel.visible', 'Visible')
|
|
23
|
+
: t('pixelEditorRightPanel.hidden', 'Hidden'), children: jsx(NiceIcon, { name: l.visible ? 'eye' : 'eye-off', size: 14 }) }), jsx("span", { className: styles.layerLock, onClick: (e) => {
|
|
22
24
|
e.stopPropagation();
|
|
23
25
|
api.toggleLock(i);
|
|
24
|
-
}, title: l.locked
|
|
26
|
+
}, title: l.locked
|
|
27
|
+
? t('pixelEditorRightPanel.locked', 'Locked')
|
|
28
|
+
: t('pixelEditorRightPanel.unlocked', 'Unlocked'), children: jsx(NiceIcon, { name: "lock", size: 14 }) }), api.editingLayerName === l.id ? (jsx(NiceTextInput, { className: styles.layerNameInput, value: l.name, onChange: (val) => api.renameLayer(i, val), onBlur: () => api.setEditingLayerName(null), onKeyDown: (e) => {
|
|
25
29
|
if (e.key === 'Enter') {
|
|
26
30
|
api.setEditingLayerName(null);
|
|
27
31
|
}
|
|
28
32
|
}, autoFocus: true, "aria-label": t('pixelEditorRightPanel.layerName', 'Layer name') })) : (jsx("span", { className: styles.layerName, onDoubleClick: (e) => {
|
|
29
33
|
e.stopPropagation();
|
|
30
34
|
api.setEditingLayerName(l.id);
|
|
31
|
-
}, children: l.name })), jsxs("span", { className: styles.layerOpacity, children: [Math.round((l.opacity / 255) * 100), "%"] })] }, l.id))), api.layers[api.aLi] && (jsxs("div", { className: styles.layerControls, children: [jsx(NiceSelect, { value: api.layers[api.aLi].blendMode, onChange: (val) => api.setLayerBlendMode(api.aLi, val), className: styles.blendSelect, "aria-label": t('pixelEditorRightPanel.blendMode', 'Blend mode'), options: BLEND_MODES.map((m) => ({ value: m, label: m })) }), jsx(NiceSlider, { min: 0, max: 255, value: api.layers[api.aLi].opacity, onChange: (val) => api.setLayerOpacity(api.aLi, val), className: styles.layerOpSlider, title:
|
|
35
|
+
}, children: l.name })), jsxs("span", { className: styles.layerOpacity, children: [Math.round((l.opacity / 255) * 100), "%"] })] }, l.id))), api.layers[api.aLi] && (jsxs("div", { className: styles.layerControls, children: [jsx(NiceSelect, { value: api.layers[api.aLi].blendMode, onChange: (val) => api.setLayerBlendMode(api.aLi, val), className: styles.blendSelect, "aria-label": t('pixelEditorRightPanel.blendMode', 'Blend mode'), options: BLEND_MODES.map((m) => ({ value: m, label: m })) }), jsx(NiceSlider, { min: 0, max: 255, value: api.layers[api.aLi].opacity, onChange: (val) => api.setLayerOpacity(api.aLi, val), className: styles.layerOpSlider, title: t('pixelEditorRightPanel.opacity2', 'Opacity: {opacity}%').replace('{opacity}', String(Math.round((api.layers[api.aLi].opacity / 255) * 100))) })] }))] }), jsxs(NiceCollapse, { className: styles.panelSection, defaultExpanded: true, trigger: sectionTrigger('Palette'), children: [jsx("div", { className: styles.layerActions, children: jsx(NiceButton, { variant: "ghost", size: "sm", onClick: () => {
|
|
32
36
|
if (!api.pal.includes(api.col1)) {
|
|
33
37
|
api.setPal((p) => [...p, api.col1]);
|
|
34
38
|
}
|
|
@@ -8,9 +8,13 @@ const PixelEditorStatusBar = /* @__PURE__ */ Object.assign(
|
|
|
8
8
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
9
9
|
var _a;
|
|
10
10
|
const { t } = useNiceTranslation();
|
|
11
|
-
return (jsxs("div", { className: styles.statusBar, children: [jsxs("span", { children: [api.dw, "\u00D7", api.dh] }), jsx("span", { children: t('pixelEditorStatusBar.zoom', 'Zoom {zoom}%').replace('{zoom}', String(Math.round(api.zoom * 100))) }), api.cursor && inB(api.cursor.x, api.cursor.y, api.dw, api.dh) && (jsxs("span", { children: ["(", api.cursor.x, ", ", api.cursor.y, ")"] })), jsx("span", { children: api.tool }),
|
|
11
|
+
return (jsxs("div", { className: styles.statusBar, children: [jsxs("span", { children: [api.dw, "\u00D7", api.dh] }), jsx("span", { children: t('pixelEditorStatusBar.zoom', 'Zoom {zoom}%').replace('{zoom}', String(Math.round(api.zoom * 100))) }), api.cursor && inB(api.cursor.x, api.cursor.y, api.dw, api.dh) && (jsxs("span", { children: ["(", api.cursor.x, ", ", api.cursor.y, ")"] })), jsx("span", { children: api.tool }), jsx("span", { children: t('pixelEditorStatusBar.brushPx', 'Brush: {size}px {shape}')
|
|
12
|
+
.replace('{size}', String(api.brush.size))
|
|
13
|
+
.replace('{shape}', String(api.brush.shape)) }), jsx("span", { children: t('pixelEditorStatusBar.pressure', 'Pressure: {pressure}%').replace('{pressure}', String(Math.round(api.pressure * 100))) }), jsx("span", { children: t('pixelEditorStatusBar.layer', 'Layer: {name}').replace('{name}', String((_a = api.layers[api.aLi]) === null || _a === void 0 ? void 0 : _a.name)) }), jsx("span", { children: t('pixelEditorStatusBar.frame', 'Frame {current}/{total}')
|
|
12
14
|
.replace('{current}', String(api.afi + 1))
|
|
13
|
-
.replace('{total}', String(api.fc)) }), api.symmetry !== 'none' &&
|
|
15
|
+
.replace('{total}', String(api.fc)) }), api.symmetry !== 'none' && (jsx("span", { children: t('pixelEditorStatusBar.sym', 'Sym: {symmetry}').replace('{symmetry}', String(api.symmetry)) })), api.shapeFilled && jsx("span", { children: t('pixelEditorStatusBar.filled', 'Filled') }), api.sel && (jsx("span", { children: t('pixelEditorStatusBar.sel', 'Sel: {w}×{h}')
|
|
16
|
+
.replace('{w}', String(api.sel.w))
|
|
17
|
+
.replace('{h}', String(api.sel.h)) }))] }));
|
|
14
18
|
}), { displayName: 'PixelEditorStatusBar' });
|
|
15
19
|
|
|
16
20
|
export { PixelEditorStatusBar as default };
|
|
@@ -8,7 +8,11 @@ import styles from './PixelEditor.module.css.js';
|
|
|
8
8
|
const PixelEditorTimeline = /* @__PURE__ */ Object.assign(
|
|
9
9
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
10
10
|
const { t } = useNiceTranslation();
|
|
11
|
-
return (jsxs("div", { className: styles.bottomPanel, children: [jsxs("div", { className: styles.timelineControls, children: [jsx(NiceButton, { variant: "ghost", size: "sm", onClick: api.addFrame, children:
|
|
11
|
+
return (jsxs("div", { className: styles.bottomPanel, children: [jsxs("div", { className: styles.timelineControls, children: [jsx(NiceButton, { variant: "ghost", size: "sm", onClick: api.addFrame, children: t('pixelEditorTimeline.frame', '+ Frame') }), jsx(NiceButton, { variant: "ghost", size: "sm", onClick: api.dupFrame, "aria-label": t('pixelEditorTimeline.duplicateFrame', 'Duplicate frame'), children: t('pixelEditorTimeline.dup', 'Dup') }), jsx(NiceButton, { variant: "ghost", size: "sm", onClick: api.rmFrame, "aria-label": t('pixelEditorTimeline.removeFrame', 'Remove frame'), children: t('pixelEditorTimeline.frame2', '− Frame') }), jsx("div", { className: styles.menuSep }), jsx(NiceButton, { variant: "ghost", size: "sm", onClick: () => api.setPlaying((p) => !p), "aria-label": api.playing
|
|
12
|
+
? t('pixelEditorTimeline.pause', 'Pause')
|
|
13
|
+
: t('pixelEditorTimeline.play', 'Play'), children: jsx(NiceIcon, { name: api.playing ? 'pause' : 'play', size: 16 }) }), jsx("label", { children: t('pixelEditorTimeline.fps', 'FPS:') }), jsx(NiceNumberInput, { min: 1, max: 60, value: api.fps, onChange: (val) => api.setFps(val !== null && val !== void 0 ? val : 8), "aria-label": t('pixelEditorTimeline.framesPerSecond', 'Frames per second') }), jsx("div", { className: styles.menuSep }), jsx(NiceCheckbox, { checked: api.onion, onChange: (checked) => api.setOnion(checked), label: t('pixelEditorTimeline.onion', 'Onion') }), jsx("div", { style: { flex: 1 } }), jsx("span", { children: api.fc !== 1
|
|
14
|
+
? t('pixelEditorTimeline.framesMany', '{fc} frames').replace('{fc}', String(api.fc))
|
|
15
|
+
: t('pixelEditorTimeline.framesOne', '{fc} frame').replace('{fc}', String(api.fc)) })] }), jsx("div", { className: styles.timelineFrames, children: Array.from({ length: api.fc }, (_, fi) => (jsxs("div", { className: `${styles.frameThumb} ${fi === api.afi ? styles.frameThumbActive : ''}`, onClick: () => api.setAfi(fi), children: [api.thumbs[fi] && (jsx("img", { src: api.thumbs[fi], alt: t('pixelEditorTimeline.frame3', 'Frame {fi}').replace('{fi}', String(fi + 1)), style: {
|
|
12
16
|
width: 36,
|
|
13
17
|
height: 36,
|
|
14
18
|
imageRendering: 'pixelated',
|
|
@@ -9,7 +9,9 @@ import { TOOLS, SYMMETRY_MODES } from './pixelEditorTypes.js';
|
|
|
9
9
|
const PixelEditorToolbar = /* @__PURE__ */ Object.assign(
|
|
10
10
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
11
11
|
const { t } = useNiceTranslation();
|
|
12
|
-
return (jsxs("div", { className: styles.toolbar, children: [TOOLS.map((t) => (jsx(NiceButton, { className: `${styles.toolBtn} ${api.tool === t.id ? styles.toolBtnActive : ''}`, variant: api.tool === t.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setTool(t.id), title: `${t.label} (${t.key})`, "aria-label": t.label, children: jsx(NiceIcon, { name: t.icon, size: 16 }) }, t.id))), jsx("div", { className: styles.toolSep }), jsx(NiceButton, { className: `${styles.toolBtn} ${api.shapeFilled ? styles.toolBtnActive : ''}`, variant: api.shapeFilled ? 'primary' : 'ghost', size: "sm", onClick: () => api.setShapeFilled((f) => !f), title: `${api.shapeFilled ? 'Filled' : 'Outline'} (F)`, "aria-label": api.shapeFilled
|
|
12
|
+
return (jsxs("div", { className: styles.toolbar, children: [TOOLS.map((t) => (jsx(NiceButton, { className: `${styles.toolBtn} ${api.tool === t.id ? styles.toolBtnActive : ''}`, variant: api.tool === t.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setTool(t.id), title: `${t.label} (${t.key})`, "aria-label": t.label, children: jsx(NiceIcon, { name: t.icon, size: 16 }) }, t.id))), jsx("div", { className: styles.toolSep }), jsx(NiceButton, { className: `${styles.toolBtn} ${api.shapeFilled ? styles.toolBtnActive : ''}`, variant: api.shapeFilled ? 'primary' : 'ghost', size: "sm", onClick: () => api.setShapeFilled((f) => !f), title: `${api.shapeFilled ? 'Filled' : 'Outline'} (F)`, "aria-label": api.shapeFilled
|
|
13
|
+
? t('pixelEditorToolbar.filledShape', 'Filled shape')
|
|
14
|
+
: t('pixelEditorToolbar.outlineShape', 'Outline shape'), children: jsx(NiceIcon, { name: api.shapeFilled ? 'check-square' : 'square', size: 16 }) }), jsx("div", { className: styles.toolGroup, children: SYMMETRY_MODES.map((m) => (jsx(NiceButton, { className: `${styles.miniBtn} ${api.symmetry === m.id ? styles.miniBtnActive : ''}`, variant: api.symmetry === m.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setSymmetry(m.id), title: t('pixelEditorToolbar.symmetry', 'Symmetry: {label}').replace('{label}', String(m.label)), "aria-label": t('pixelEditorToolbar.symmetry', 'Symmetry: {label}').replace('{label}', String(m.label)), children: jsx(NiceIcon, { name: m.icon, size: 14 }) }, m.id))) }), jsxs("div", { className: styles.colorSwatches, children: [jsx("label", { style: { position: 'relative', width: 28, height: 28, cursor: 'pointer' }, title: t('pixelEditorToolbar.primaryColourClickForHsv', 'Primary Colour (click for HSV)'), children: jsx(NiceColorPicker, { value: api.col1, onChange: (c) => api.setCol1(c) }) }), jsx("label", { style: { position: 'relative', width: 22, height: 22, cursor: 'pointer' }, title: t('pixelEditorToolbar.secondaryColour', 'Secondary Colour'), children: jsx(NiceColorPicker, { value: api.col2, onChange: (c) => api.setCol2(c) }) }), jsx(NiceButton, { className: styles.toolBtn, variant: "ghost", size: "sm", onClick: () => {
|
|
13
15
|
const tmp = api.col1;
|
|
14
16
|
api.setCol1(api.col2);
|
|
15
17
|
api.setCol2(tmp);
|
|
@@ -226,19 +226,19 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
226
226
|
case 'character':
|
|
227
227
|
return [
|
|
228
228
|
{
|
|
229
|
-
label: 'Skin',
|
|
229
|
+
label: t('spriteGeneratorPanel.skin', 'Skin'),
|
|
230
230
|
options: palettesToOptions(SKIN_PALETTES),
|
|
231
231
|
value: skinPalette,
|
|
232
232
|
set: setSkinPalette,
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
|
-
label: 'Hair',
|
|
235
|
+
label: t('spriteGeneratorPanel.hair', 'Hair'),
|
|
236
236
|
options: palettesToOptions(HAIR_PALETTES),
|
|
237
237
|
value: hairPalette,
|
|
238
238
|
set: setHairPalette,
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
|
-
label: 'Clothing',
|
|
241
|
+
label: t('spriteGeneratorPanel.clothing', 'Clothing'),
|
|
242
242
|
options: palettesToOptions(CLOTHING_PALETTES),
|
|
243
243
|
value: clothPalette,
|
|
244
244
|
set: setClothPalette,
|
|
@@ -247,13 +247,13 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
247
247
|
case 'building':
|
|
248
248
|
return [
|
|
249
249
|
{
|
|
250
|
-
label: 'Walls',
|
|
250
|
+
label: t('spriteGeneratorPanel.walls', 'Walls'),
|
|
251
251
|
options: palettesToOptions(WALL_PALETTES),
|
|
252
252
|
value: wallPalette,
|
|
253
253
|
set: setWallPalette,
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
|
-
label: 'Roof',
|
|
256
|
+
label: t('spriteGeneratorPanel.roof', 'Roof'),
|
|
257
257
|
options: palettesToOptions(ROOF_PALETTES),
|
|
258
258
|
value: roofPalette,
|
|
259
259
|
set: setRoofPalette,
|
|
@@ -262,14 +262,14 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
262
262
|
case 'animal':
|
|
263
263
|
return [
|
|
264
264
|
{
|
|
265
|
-
label: 'Fur',
|
|
265
|
+
label: t('spriteGeneratorPanel.fur', 'Fur'),
|
|
266
266
|
options: palettesToOptions(FUR_PALETTES),
|
|
267
267
|
value: furPalette,
|
|
268
268
|
set: setFurPalette,
|
|
269
269
|
},
|
|
270
270
|
];
|
|
271
271
|
}
|
|
272
|
-
}, [tab, skinPalette, hairPalette, clothPalette, wallPalette, roofPalette, furPalette]);
|
|
272
|
+
}, [tab, skinPalette, hairPalette, clothPalette, wallPalette, roofPalette, furPalette, t]);
|
|
273
273
|
/* ── Render ── */
|
|
274
274
|
return (jsx(NiceModal, { open: true, onClose: onClose !== null && onClose !== void 0 ? onClose : (() => { }), title: t('spriteGeneratorPanel.spriteGenerator', 'Sprite Generator'), size: "xl", children: jsxs("div", { className: styles.genPanel, children: [jsx("div", { className: styles.genTabs, children: ['character', 'building', 'animal'].map((t) => (jsxs(NiceButton, { className: `${styles.genTabBtn} ${tab === t ? styles.genTabBtnActive : ''}`, variant: tab === t ? 'primary' : 'ghost', size: "sm", onClick: () => setTab(t), children: [jsx(NiceIcon, { name: t === 'character' ? 'user' : t === 'building' ? 'home' : 'heart', size: 14 }), ' ', t.charAt(0).toUpperCase() + t.slice(1)] }, t))) }), jsxs("div", { className: styles.genBody, children: [jsxs("div", { className: styles.genLeft, children: [jsxs("div", { className: styles.panelSection, children: [jsx("div", { className: styles.panelTitle, children: jsx("span", { children: t('spriteGeneratorPanel.presets', 'Presets') }) }), jsx("div", { className: styles.genPresetGrid, children: presets.map((preset, i) => (jsx(NiceButton, { className: `${styles.genPresetBtn} ${i === selectedPresetIdx ? styles.genPresetBtnActive : ''}`, variant: i === selectedPresetIdx ? 'primary' : 'ghost', size: "sm", onClick: () => applyPreset(i), title: preset.name, children: preset.name }, i))) })] }), jsxs("div", { className: styles.panelSection, style: { flex: 1, overflowY: 'auto' }, children: [jsx("div", { className: styles.panelTitle, children: jsx("span", { children: t('spriteGeneratorPanel.parts', 'Parts') }) }), categories.map((cat) => {
|
|
275
275
|
const parts = getPartsByCategory(cat);
|
|
@@ -286,9 +286,12 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
286
286
|
return (jsx(NiceButton, { className: `${styles.miniBtn} ${styles.genPartBtn} ${active ? styles.miniBtnActive : ''}`, variant: active ? 'primary' : 'ghost', size: "sm", onClick: () => (active ? removePart(part.id) : addPart(part.id)), title: part.name, children: part.name }, part.id));
|
|
287
287
|
}) })] }, cat));
|
|
288
288
|
})] })] }), jsxs("div", { className: styles.genCenter, children: [jsx("div", { className: styles.genPreviewWrap, children: jsx("canvas", { ref: previewRef, className: styles.genPreviewCanvas }) }), jsx("div", { className: styles.genDirGrid, children: ALL_DIRECTIONS.map((d) => (jsx(NiceButton, { className: `${styles.miniBtn} ${direction === d ? styles.miniBtnActive : ''}`, variant: direction === d ? 'primary' : 'ghost', size: "sm", onClick: () => setDirection(d), children: d }, d))) }), jsxs("div", { className: styles.genRow, children: [jsx("label", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: t('spriteGeneratorPanel.projection', 'Projection') }), jsx(NiceSelect, { className: styles.propSelect, value: projection, onChange: (val) => setProjection(val), options: [
|
|
289
|
-
{ value: 'topDown', label: 'Top-Down' },
|
|
290
|
-
{ value: 'sideView', label: 'Side View' },
|
|
291
|
-
{
|
|
289
|
+
{ value: 'topDown', label: t('spriteGeneratorPanel.topDown', 'Top-Down') },
|
|
290
|
+
{ value: 'sideView', label: t('spriteGeneratorPanel.sideView', 'Side View') },
|
|
291
|
+
{
|
|
292
|
+
value: 'iso25d',
|
|
293
|
+
label: t('spriteGeneratorPanel.n25dIsometric', '2.5D Isometric'),
|
|
294
|
+
},
|
|
292
295
|
] })] }), jsxs("div", { className: styles.genRow, children: [jsx("label", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: t('spriteGeneratorPanel.size', 'Size') }), jsx(NiceNumberInput, { min: 8, max: 256, value: canvasW, onChange: (val) => setCanvasW(val !== null && val !== void 0 ? val : 32) }), jsx("span", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: "\u00D7" }), jsx(NiceNumberInput, { min: 8, max: 256, value: canvasH, onChange: (val) => setCanvasH(val !== null && val !== void 0 ? val : 32) })] }), jsx(NiceCheckbox, { checked: generate8Dir, onChange: (checked) => setGenerate8Dir(checked), label: t('spriteGeneratorPanel.generate8DirectionSheet', 'Generate 8-direction sheet'), className: styles.checkLabel })] }), jsxs("div", { className: styles.genRight, children: [jsxs("div", { className: styles.panelSection, children: [jsx("div", { className: styles.panelTitle, children: jsx("span", { children: t('spriteGeneratorPanel.colors', 'Colors') }) }), paletteGroups.map((group) => {
|
|
293
296
|
var _a;
|
|
294
297
|
return (jsxs("div", { style: { marginBottom: 6 }, children: [jsx("div", { style: { fontSize: 9, color: 'var(--nice-text-muted)', marginBottom: 2 }, children: group.label }), jsx(NiceSelect, { className: styles.propSelect, value: group.value, onChange: (val) => group.set(val), options: group.options.map((opt) => ({
|
|
@@ -302,7 +305,11 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
302
305
|
return (
|
|
303
306
|
// A part can be placed twice (left and right leg, flipped), so its id
|
|
304
307
|
// alone is not a unique key.
|
|
305
|
-
jsxs("div", { className: styles.genAssemblyItem, children: [jsx(NiceButton, { className: styles.btnIcon, variant: "ghost", size: "sm", onClick: () => togglePart(ap.partId), title: ((_a = ap.visible) !== null && _a !== void 0 ? _a : true)
|
|
308
|
+
jsxs("div", { className: styles.genAssemblyItem, children: [jsx(NiceButton, { className: styles.btnIcon, variant: "ghost", size: "sm", onClick: () => togglePart(ap.partId), title: ((_a = ap.visible) !== null && _a !== void 0 ? _a : true)
|
|
309
|
+
? t('spriteGeneratorPanel.hide', 'Hide')
|
|
310
|
+
: t('spriteGeneratorPanel.show', 'Show'), "aria-label": ((_b = ap.visible) !== null && _b !== void 0 ? _b : true)
|
|
311
|
+
? t('spriteGeneratorPanel.hide', 'Hide')
|
|
312
|
+
: t('spriteGeneratorPanel.show', 'Show'), children: jsx(NiceIcon, { name: ((_c = ap.visible) !== null && _c !== void 0 ? _c : true) ? 'eye' : 'eye-off', size: 14 }) }), jsx("span", { className: styles.genAssemblyName, children: (_d = part === null || part === void 0 ? void 0 : part.name) !== null && _d !== void 0 ? _d : ap.partId }), jsxs("span", { style: { fontSize: 9, color: 'var(--nice-text-muted)' }, children: ["z:", (_e = part === null || part === void 0 ? void 0 : part.zOrder) !== null && _e !== void 0 ? _e : 0] }), jsx(NiceButton, { className: styles.btnIcon, variant: "ghost", size: "sm", onClick: () => removePart(ap.partId), title: t('spriteGeneratorPanel.remove', 'Remove'), "aria-label": t('spriteGeneratorPanel.remove', 'Remove'), children: jsx(NiceIcon, { name: "close", size: 14 }) })] }, `${ap.partId}-${i}`));
|
|
306
313
|
})] })] })] }), jsxs("div", { className: styles.genFooter, children: [jsx(NiceButton, { className: styles.btnSecondary, variant: "ghost", onClick: onClose, children: t('spriteGeneratorPanel.cancel', 'Cancel') }), jsxs(NiceButton, { className: styles.btnPrimary, variant: "primary", onClick: handleSendToCanvas, children: [jsx(NiceIcon, { name: "clipboard", size: 14 }), ' ', t('spriteGeneratorPanel.sendToCanvas', 'Send to Canvas')] })] })] }) }));
|
|
307
314
|
};
|
|
308
315
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -344,7 +344,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
344
344
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
345
345
|
width: '100%',
|
|
346
346
|
margin: '4px 0',
|
|
347
|
-
} }),
|
|
347
|
+
} }), jsx("label", { children: t('texturePainter3d.sizePx', 'Size: {size}px').replace('{size}', String(painter.brush.size)) }), jsx("input", { type: "range", min: 1, max: 100, value: painter.brush.size, onChange: (e) => painter.setBrush({ ...painter.brush, size: Number(e.target.value) }), style: { width: '100%' } }), jsx("label", { children: t('texturePainter3d.opacity', 'Opacity: {opacity}%').replace('{opacity}', String(Math.round(painter.brush.opacity * 100))) }), jsx("input", { type: "range", min: 0, max: 1, step: 0.01, value: painter.brush.opacity, onChange: (e) => painter.setBrush({ ...painter.brush, opacity: Number(e.target.value) }), style: { width: '100%' } }), jsx("label", { children: t('texturePainter3d.hardness', 'Hardness: {hardness}%').replace('{hardness}', String(Math.round(painter.brush.hardness * 100))) }), jsx("input", { type: "range", min: 0, max: 1, step: 0.01, value: painter.brush.hardness, onChange: (e) => painter.setBrush({ ...painter.brush, hardness: Number(e.target.value) }), style: { width: '100%' } }), jsx("label", { children: t('texturePainter3d.blendMode', 'Blend Mode') }), jsxs("select", { value: painter.brush.blendMode, onChange: (e) => painter.setBrush({
|
|
348
348
|
...painter.brush,
|
|
349
349
|
blendMode: e.target.value,
|
|
350
350
|
}), style: {
|
|
@@ -360,7 +360,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
360
360
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
361
361
|
width: '100%',
|
|
362
362
|
margin: '4px 0',
|
|
363
|
-
} }),
|
|
363
|
+
} }), jsx("label", { children: t('texturePainter3d.zoom', 'Zoom: {zoom}%').replace('{zoom}', String(Math.round(zoom * 100))) }), jsxs("div", { style: { display: 'flex', gap: 2 }, children: [jsx("button", { onClick: () => setZoom((z) => Math.max(0.1, z - 0.1)), style: btnStyle(false), children: "\u2212" }), jsx("button", { onClick: () => setZoom(0.5), style: btnStyle(false), children: t('texturePainter3d.reset', 'Reset') }), jsx("button", { onClick: () => setZoom((z) => Math.min(4, z + 0.1)), style: btnStyle(false), children: "+" })] })] }), jsxs("div", { style: {
|
|
364
364
|
flex: 1,
|
|
365
365
|
overflow: 'hidden',
|
|
366
366
|
position: 'relative',
|
|
@@ -382,7 +382,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
382
382
|
color: 'var(--nice-text-secondary, #868e96)',
|
|
383
383
|
display: 'flex',
|
|
384
384
|
gap: 12,
|
|
385
|
-
}, children: [jsxs("span", { children: [textureWidth, "\u00D7", textureHeight] }), cursorPos && (jsxs("span", { children: ["X: ", cursorPos.x, " Y: ", cursorPos.y] })),
|
|
385
|
+
}, children: [jsxs("span", { children: [textureWidth, "\u00D7", textureHeight] }), cursorPos && (jsxs("span", { children: ["X: ", cursorPos.x, " Y: ", cursorPos.y] })), jsx("span", { children: t('texturePainter3d.zoom', 'Zoom: {zoom}%').replace('{zoom}', String(Math.round(zoom * 100))) })] })] }), jsxs("div", { style: { width: 160, fontSize: 11, display: 'flex', flexDirection: 'column', gap: 4 }, children: [jsx("strong", { style: { fontSize: 12 }, children: t('texturePainter3d.layers', 'Layers') }), jsx("div", { style: { flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 2 }, children: [...painter.layers].reverse().map((l) => (jsxs("div", { style: {
|
|
386
386
|
padding: '4px 6px',
|
|
387
387
|
borderRadius: 3,
|
|
388
388
|
background: painter.activeLayerId === l.id
|
|
@@ -403,7 +403,11 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
403
403
|
? 'var(--nice-text, #c1c2c5)'
|
|
404
404
|
: 'var(--nice-text-secondary, #5c5f66)',
|
|
405
405
|
fontSize: 12,
|
|
406
|
-
}, title: l.visible
|
|
406
|
+
}, title: l.visible
|
|
407
|
+
? t('texturePainter3d.hideLayer', 'Hide layer')
|
|
408
|
+
: t('texturePainter3d.showLayer', 'Show layer'), "aria-label": l.visible
|
|
409
|
+
? t('texturePainter3d.hideLayer', 'Hide layer')
|
|
410
|
+
: t('texturePainter3d.showLayer', 'Show layer'), children: jsx(NiceIcon, { name: l.visible ? 'eye' : 'eye-off', size: 14 }) }), jsx("span", { style: {
|
|
407
411
|
flex: 1,
|
|
408
412
|
overflow: 'hidden',
|
|
409
413
|
textOverflow: 'ellipsis',
|
|
@@ -425,7 +429,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
425
429
|
cursor: 'pointer',
|
|
426
430
|
background: 'var(--nice-bg-secondary, #2c2e33)',
|
|
427
431
|
color: 'var(--nice-text, #c1c2c5)',
|
|
428
|
-
}, children:
|
|
432
|
+
}, children: t('texturePainter3d.addLayer', '+ Add Layer') }), jsx("hr", { style: {
|
|
429
433
|
border: 'none',
|
|
430
434
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
431
435
|
width: '100%',
|