@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
|
@@ -4,41 +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
10
|
const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
10
11
|
/* @__PURE__ */ React.memo(({ api, hasOnSaveToLibrary, onOpenGenerator }) => {
|
|
12
|
+
const { t } = i18n.useNiceTranslation();
|
|
11
13
|
const items = [
|
|
12
14
|
{
|
|
13
15
|
id: 'file',
|
|
14
|
-
label: 'File',
|
|
16
|
+
label: t('pixelEditorMenuBar.file', 'File'),
|
|
15
17
|
children: [
|
|
16
18
|
{
|
|
17
19
|
id: 'new',
|
|
18
|
-
label: 'New…',
|
|
20
|
+
label: t('pixelEditorMenuBar.new', 'New…'),
|
|
19
21
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "file", size: 14 }),
|
|
20
22
|
onClick: () => api.setDlgNew(true),
|
|
21
23
|
},
|
|
22
24
|
{
|
|
23
25
|
id: 'open',
|
|
24
|
-
label: 'Open…',
|
|
26
|
+
label: t('pixelEditorMenuBar.open', 'Open…'),
|
|
25
27
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "folder", size: 14 }),
|
|
26
28
|
onClick: () => { var _a; return (_a = api.fInp.current) === null || _a === void 0 ? void 0 : _a.click(); },
|
|
27
29
|
},
|
|
28
30
|
{ id: 'sep-file-1', divider: true },
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
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
|
+
},
|
|
36
66
|
...(hasOnSaveToLibrary
|
|
37
67
|
? [
|
|
38
68
|
{ id: 'sep-file-2', divider: true },
|
|
39
69
|
{
|
|
40
70
|
id: 'lib',
|
|
41
|
-
label: 'Save to Library',
|
|
71
|
+
label: t('pixelEditorMenuBar.saveToLibrary', 'Save to Library'),
|
|
42
72
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14 }),
|
|
43
73
|
onClick: api.saveToLibrary,
|
|
44
74
|
},
|
|
@@ -48,35 +78,70 @@ const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
|
48
78
|
},
|
|
49
79
|
{
|
|
50
80
|
id: 'edit',
|
|
51
|
-
label: 'Edit',
|
|
81
|
+
label: t('pixelEditorMenuBar.edit', 'Edit'),
|
|
52
82
|
children: [
|
|
53
|
-
{ id: 'undo', label: 'Undo', onClick: api.undo },
|
|
54
|
-
{ 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 },
|
|
55
85
|
{ id: 'sep-edit-1', divider: true },
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
},
|
|
60
109
|
],
|
|
61
110
|
},
|
|
62
111
|
{
|
|
63
112
|
id: 'image',
|
|
64
|
-
label: 'Image',
|
|
113
|
+
label: t('pixelEditorMenuBar.image', 'Image'),
|
|
65
114
|
children: [
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
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
|
+
},
|
|
69
130
|
{ id: 'sep-image-1', divider: true },
|
|
70
|
-
{
|
|
131
|
+
{
|
|
132
|
+
id: 'clear',
|
|
133
|
+
label: t('pixelEditorMenuBar.clearCanvas', 'Clear canvas'),
|
|
134
|
+
onClick: api.clearCv,
|
|
135
|
+
},
|
|
71
136
|
],
|
|
72
137
|
},
|
|
73
138
|
{
|
|
74
139
|
id: 'view',
|
|
75
|
-
label: 'View',
|
|
140
|
+
label: t('pixelEditorMenuBar.view', 'View'),
|
|
76
141
|
children: [
|
|
77
142
|
{
|
|
78
143
|
id: 'grid',
|
|
79
|
-
label: 'Show grid',
|
|
144
|
+
label: t('pixelEditorMenuBar.showGrid', 'Show grid'),
|
|
80
145
|
badge: api.grid ? 'On' : 'Off',
|
|
81
146
|
onClick: () => api.setGrid((g) => !g),
|
|
82
147
|
},
|
|
@@ -84,11 +149,11 @@ const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
|
84
149
|
},
|
|
85
150
|
{
|
|
86
151
|
id: 'tools',
|
|
87
|
-
label: 'Tools',
|
|
152
|
+
label: t('pixelEditorMenuBar.tools', 'Tools'),
|
|
88
153
|
children: [
|
|
89
154
|
{
|
|
90
155
|
id: 'gen',
|
|
91
|
-
label: 'Sprite generator…',
|
|
156
|
+
label: t('pixelEditorMenuBar.spriteGenerator', 'Sprite generator…'),
|
|
92
157
|
icon: jsxRuntime.jsx(uiCore.NiceIcon, { name: "palette", size: 14 }),
|
|
93
158
|
onClick: onOpenGenerator,
|
|
94
159
|
},
|
|
@@ -20,17 +20,21 @@ const PixelEditorRightPanel = /* @__PURE__ */ Object.assign(
|
|
|
20
20
|
.map(({ l, i }) => (jsxRuntime.jsxs("div", { className: `${PixelEditor_module.layerItem} ${i === api.aLi ? PixelEditor_module.layerItemActive : ''}`, onClick: () => api.setALi(i), children: [jsxRuntime.jsx("span", { className: PixelEditor_module.layerVis, onClick: (e) => {
|
|
21
21
|
e.stopPropagation();
|
|
22
22
|
api.toggleVis(i);
|
|
23
|
-
}, title: l.visible
|
|
23
|
+
}, title: l.visible
|
|
24
|
+
? t('pixelEditorRightPanel.visible', 'Visible')
|
|
25
|
+
: t('pixelEditorRightPanel.hidden', 'Hidden'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: l.visible ? 'eye' : 'eye-off', size: 14 }) }), jsxRuntime.jsx("span", { className: PixelEditor_module.layerLock, onClick: (e) => {
|
|
24
26
|
e.stopPropagation();
|
|
25
27
|
api.toggleLock(i);
|
|
26
|
-
}, title: l.locked
|
|
28
|
+
}, title: l.locked
|
|
29
|
+
? t('pixelEditorRightPanel.locked', 'Locked')
|
|
30
|
+
: t('pixelEditorRightPanel.unlocked', 'Unlocked'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "lock", size: 14 }) }), api.editingLayerName === l.id ? (jsxRuntime.jsx(ui.NiceTextInput, { className: PixelEditor_module.layerNameInput, value: l.name, onChange: (val) => api.renameLayer(i, val), onBlur: () => api.setEditingLayerName(null), onKeyDown: (e) => {
|
|
27
31
|
if (e.key === 'Enter') {
|
|
28
32
|
api.setEditingLayerName(null);
|
|
29
33
|
}
|
|
30
34
|
}, autoFocus: true, "aria-label": t('pixelEditorRightPanel.layerName', 'Layer name') })) : (jsxRuntime.jsx("span", { className: PixelEditor_module.layerName, onDoubleClick: (e) => {
|
|
31
35
|
e.stopPropagation();
|
|
32
36
|
api.setEditingLayerName(l.id);
|
|
33
|
-
}, children: l.name })), jsxRuntime.jsxs("span", { className: PixelEditor_module.layerOpacity, children: [Math.round((l.opacity / 255) * 100), "%"] })] }, l.id))), api.layers[api.aLi] && (jsxRuntime.jsxs("div", { className: PixelEditor_module.layerControls, children: [jsxRuntime.jsx(ui.NiceSelect, { value: api.layers[api.aLi].blendMode, onChange: (val) => api.setLayerBlendMode(api.aLi, val), className: PixelEditor_module.blendSelect, "aria-label": t('pixelEditorRightPanel.blendMode', 'Blend mode'), options: pixelEditorTypes.BLEND_MODES.map((m) => ({ value: m, label: m })) }), jsxRuntime.jsx(ui.NiceSlider, { min: 0, max: 255, value: api.layers[api.aLi].opacity, onChange: (val) => api.setLayerOpacity(api.aLi, val), className: PixelEditor_module.layerOpSlider, title:
|
|
37
|
+
}, children: l.name })), jsxRuntime.jsxs("span", { className: PixelEditor_module.layerOpacity, children: [Math.round((l.opacity / 255) * 100), "%"] })] }, l.id))), api.layers[api.aLi] && (jsxRuntime.jsxs("div", { className: PixelEditor_module.layerControls, children: [jsxRuntime.jsx(ui.NiceSelect, { value: api.layers[api.aLi].blendMode, onChange: (val) => api.setLayerBlendMode(api.aLi, val), className: PixelEditor_module.blendSelect, "aria-label": t('pixelEditorRightPanel.blendMode', 'Blend mode'), options: pixelEditorTypes.BLEND_MODES.map((m) => ({ value: m, label: m })) }), jsxRuntime.jsx(ui.NiceSlider, { min: 0, max: 255, value: api.layers[api.aLi].opacity, onChange: (val) => api.setLayerOpacity(api.aLi, val), className: PixelEditor_module.layerOpSlider, title: t('pixelEditorRightPanel.opacity2', 'Opacity: {opacity}%').replace('{opacity}', String(Math.round((api.layers[api.aLi].opacity / 255) * 100))) })] }))] }), jsxRuntime.jsxs(ui.NiceCollapse, { className: PixelEditor_module.panelSection, defaultExpanded: true, trigger: sectionTrigger('Palette'), children: [jsxRuntime.jsx("div", { className: PixelEditor_module.layerActions, children: jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: () => {
|
|
34
38
|
if (!api.pal.includes(api.col1)) {
|
|
35
39
|
api.setPal((p) => [...p, api.col1]);
|
|
36
40
|
}
|
|
@@ -10,9 +10,13 @@ const PixelEditorStatusBar = /* @__PURE__ */ Object.assign(
|
|
|
10
10
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
11
11
|
var _a;
|
|
12
12
|
const { t } = i18n.useNiceTranslation();
|
|
13
|
-
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.statusBar, children: [jsxRuntime.jsxs("span", { children: [api.dw, "\u00D7", api.dh] }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.zoom', 'Zoom {zoom}%').replace('{zoom}', String(Math.round(api.zoom * 100))) }), api.cursor && pixelEditorTypes.inB(api.cursor.x, api.cursor.y, api.dw, api.dh) && (jsxRuntime.jsxs("span", { children: ["(", api.cursor.x, ", ", api.cursor.y, ")"] })), jsxRuntime.jsx("span", { children: api.tool }), jsxRuntime.
|
|
13
|
+
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.statusBar, children: [jsxRuntime.jsxs("span", { children: [api.dw, "\u00D7", api.dh] }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.zoom', 'Zoom {zoom}%').replace('{zoom}', String(Math.round(api.zoom * 100))) }), api.cursor && pixelEditorTypes.inB(api.cursor.x, api.cursor.y, api.dw, api.dh) && (jsxRuntime.jsxs("span", { children: ["(", api.cursor.x, ", ", api.cursor.y, ")"] })), jsxRuntime.jsx("span", { children: api.tool }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.brushPx', 'Brush: {size}px {shape}')
|
|
14
|
+
.replace('{size}', String(api.brush.size))
|
|
15
|
+
.replace('{shape}', String(api.brush.shape)) }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.pressure', 'Pressure: {pressure}%').replace('{pressure}', String(Math.round(api.pressure * 100))) }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.layer', 'Layer: {name}').replace('{name}', String((_a = api.layers[api.aLi]) === null || _a === void 0 ? void 0 : _a.name)) }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.frame', 'Frame {current}/{total}')
|
|
14
16
|
.replace('{current}', String(api.afi + 1))
|
|
15
|
-
.replace('{total}', String(api.fc)) }), api.symmetry !== 'none' && jsxRuntime.
|
|
17
|
+
.replace('{total}', String(api.fc)) }), api.symmetry !== 'none' && (jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.sym', 'Sym: {symmetry}').replace('{symmetry}', String(api.symmetry)) })), api.shapeFilled && jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.filled', 'Filled') }), api.sel && (jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.sel', 'Sel: {w}×{h}')
|
|
18
|
+
.replace('{w}', String(api.sel.w))
|
|
19
|
+
.replace('{h}', String(api.sel.h)) }))] }));
|
|
16
20
|
}), { displayName: 'PixelEditorStatusBar' });
|
|
17
21
|
|
|
18
22
|
module.exports = PixelEditorStatusBar;
|
|
@@ -10,7 +10,11 @@ var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
|
10
10
|
const PixelEditorTimeline = /* @__PURE__ */ Object.assign(
|
|
11
11
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
12
12
|
const { t } = i18n.useNiceTranslation();
|
|
13
|
-
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.bottomPanel, children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.timelineControls, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.addFrame, children:
|
|
13
|
+
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.bottomPanel, children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.timelineControls, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.addFrame, children: t('pixelEditorTimeline.frame', '+ Frame') }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.dupFrame, "aria-label": t('pixelEditorTimeline.duplicateFrame', 'Duplicate frame'), children: t('pixelEditorTimeline.dup', 'Dup') }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.rmFrame, "aria-label": t('pixelEditorTimeline.removeFrame', 'Remove frame'), children: t('pixelEditorTimeline.frame2', '− Frame') }), jsxRuntime.jsx("div", { className: PixelEditor_module.menuSep }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: () => api.setPlaying((p) => !p), "aria-label": api.playing
|
|
14
|
+
? t('pixelEditorTimeline.pause', 'Pause')
|
|
15
|
+
: t('pixelEditorTimeline.play', 'Play'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: api.playing ? 'pause' : 'play', size: 16 }) }), jsxRuntime.jsx("label", { children: t('pixelEditorTimeline.fps', 'FPS:') }), jsxRuntime.jsx(ui.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') }), jsxRuntime.jsx("div", { className: PixelEditor_module.menuSep }), jsxRuntime.jsx(ui.NiceCheckbox, { checked: api.onion, onChange: (checked) => api.setOnion(checked), label: t('pixelEditorTimeline.onion', 'Onion') }), jsxRuntime.jsx("div", { style: { flex: 1 } }), jsxRuntime.jsx("span", { children: api.fc !== 1
|
|
16
|
+
? t('pixelEditorTimeline.framesMany', '{fc} frames').replace('{fc}', String(api.fc))
|
|
17
|
+
: t('pixelEditorTimeline.framesOne', '{fc} frame').replace('{fc}', String(api.fc)) })] }), jsxRuntime.jsx("div", { className: PixelEditor_module.timelineFrames, children: Array.from({ length: api.fc }, (_, fi) => (jsxRuntime.jsxs("div", { className: `${PixelEditor_module.frameThumb} ${fi === api.afi ? PixelEditor_module.frameThumbActive : ''}`, onClick: () => api.setAfi(fi), children: [api.thumbs[fi] && (jsxRuntime.jsx("img", { src: api.thumbs[fi], alt: t('pixelEditorTimeline.frame3', 'Frame {fi}').replace('{fi}', String(fi + 1)), style: {
|
|
14
18
|
width: 36,
|
|
15
19
|
height: 36,
|
|
16
20
|
imageRendering: 'pixelated',
|
|
@@ -11,7 +11,9 @@ var pixelEditorTypes = require('./pixelEditorTypes.js');
|
|
|
11
11
|
const PixelEditorToolbar = /* @__PURE__ */ Object.assign(
|
|
12
12
|
/* @__PURE__ */ React.memo(({ api }) => {
|
|
13
13
|
const { t } = i18n.useNiceTranslation();
|
|
14
|
-
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.toolbar, children: [pixelEditorTypes.TOOLS.map((t) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.toolBtn} ${api.tool === t.id ? PixelEditor_module.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: jsxRuntime.jsx(uiCore.NiceIcon, { name: t.icon, size: 16 }) }, t.id))), jsxRuntime.jsx("div", { className: PixelEditor_module.toolSep }), jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.toolBtn} ${api.shapeFilled ? PixelEditor_module.toolBtnActive : ''}`, variant: api.shapeFilled ? 'primary' : 'ghost', size: "sm", onClick: () => api.setShapeFilled((f) => !f), title: `${api.shapeFilled ? 'Filled' : 'Outline'} (F)`, "aria-label": api.shapeFilled
|
|
14
|
+
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.toolbar, children: [pixelEditorTypes.TOOLS.map((t) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.toolBtn} ${api.tool === t.id ? PixelEditor_module.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: jsxRuntime.jsx(uiCore.NiceIcon, { name: t.icon, size: 16 }) }, t.id))), jsxRuntime.jsx("div", { className: PixelEditor_module.toolSep }), jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.toolBtn} ${api.shapeFilled ? PixelEditor_module.toolBtnActive : ''}`, variant: api.shapeFilled ? 'primary' : 'ghost', size: "sm", onClick: () => api.setShapeFilled((f) => !f), title: `${api.shapeFilled ? 'Filled' : 'Outline'} (F)`, "aria-label": api.shapeFilled
|
|
15
|
+
? t('pixelEditorToolbar.filledShape', 'Filled shape')
|
|
16
|
+
: t('pixelEditorToolbar.outlineShape', 'Outline shape'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: api.shapeFilled ? 'check-square' : 'square', size: 16 }) }), jsxRuntime.jsx("div", { className: PixelEditor_module.toolGroup, children: pixelEditorTypes.SYMMETRY_MODES.map((m) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.miniBtn} ${api.symmetry === m.id ? PixelEditor_module.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: jsxRuntime.jsx(uiCore.NiceIcon, { name: m.icon, size: 14 }) }, m.id))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.colorSwatches, children: [jsxRuntime.jsx("label", { style: { position: 'relative', width: 28, height: 28, cursor: 'pointer' }, title: t('pixelEditorToolbar.primaryColourClickForHsv', 'Primary Colour (click for HSV)'), children: jsxRuntime.jsx(ui.NiceColorPicker, { value: api.col1, onChange: (c) => api.setCol1(c) }) }), jsxRuntime.jsx("label", { style: { position: 'relative', width: 22, height: 22, cursor: 'pointer' }, title: t('pixelEditorToolbar.secondaryColour', 'Secondary Colour'), children: jsxRuntime.jsx(ui.NiceColorPicker, { value: api.col2, onChange: (c) => api.setCol2(c) }) }), jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.toolBtn, variant: "ghost", size: "sm", onClick: () => {
|
|
15
17
|
const tmp = api.col1;
|
|
16
18
|
api.setCol1(api.col2);
|
|
17
19
|
api.setCol2(tmp);
|
|
@@ -228,19 +228,19 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
228
228
|
case 'character':
|
|
229
229
|
return [
|
|
230
230
|
{
|
|
231
|
-
label: 'Skin',
|
|
231
|
+
label: t('spriteGeneratorPanel.skin', 'Skin'),
|
|
232
232
|
options: palettesToOptions(characterGeneratorPresets.SKIN_PALETTES),
|
|
233
233
|
value: skinPalette,
|
|
234
234
|
set: setSkinPalette,
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
|
-
label: 'Hair',
|
|
237
|
+
label: t('spriteGeneratorPanel.hair', 'Hair'),
|
|
238
238
|
options: palettesToOptions(characterGeneratorPresets.HAIR_PALETTES),
|
|
239
239
|
value: hairPalette,
|
|
240
240
|
set: setHairPalette,
|
|
241
241
|
},
|
|
242
242
|
{
|
|
243
|
-
label: 'Clothing',
|
|
243
|
+
label: t('spriteGeneratorPanel.clothing', 'Clothing'),
|
|
244
244
|
options: palettesToOptions(characterGeneratorPresets.CLOTHING_PALETTES),
|
|
245
245
|
value: clothPalette,
|
|
246
246
|
set: setClothPalette,
|
|
@@ -249,13 +249,13 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
249
249
|
case 'building':
|
|
250
250
|
return [
|
|
251
251
|
{
|
|
252
|
-
label: 'Walls',
|
|
252
|
+
label: t('spriteGeneratorPanel.walls', 'Walls'),
|
|
253
253
|
options: palettesToOptions(buildingGeneratorPresets.WALL_PALETTES),
|
|
254
254
|
value: wallPalette,
|
|
255
255
|
set: setWallPalette,
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
|
-
label: 'Roof',
|
|
258
|
+
label: t('spriteGeneratorPanel.roof', 'Roof'),
|
|
259
259
|
options: palettesToOptions(buildingGeneratorPresets.ROOF_PALETTES),
|
|
260
260
|
value: roofPalette,
|
|
261
261
|
set: setRoofPalette,
|
|
@@ -264,14 +264,14 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
264
264
|
case 'animal':
|
|
265
265
|
return [
|
|
266
266
|
{
|
|
267
|
-
label: 'Fur',
|
|
267
|
+
label: t('spriteGeneratorPanel.fur', 'Fur'),
|
|
268
268
|
options: palettesToOptions(animalGeneratorPresets.FUR_PALETTES),
|
|
269
269
|
value: furPalette,
|
|
270
270
|
set: setFurPalette,
|
|
271
271
|
},
|
|
272
272
|
];
|
|
273
273
|
}
|
|
274
|
-
}, [tab, skinPalette, hairPalette, clothPalette, wallPalette, roofPalette, furPalette]);
|
|
274
|
+
}, [tab, skinPalette, hairPalette, clothPalette, wallPalette, roofPalette, furPalette, t]);
|
|
275
275
|
/* ── Render ── */
|
|
276
276
|
return (jsxRuntime.jsx(ui.NiceModal, { open: true, onClose: onClose !== null && onClose !== void 0 ? onClose : (() => { }), title: t('spriteGeneratorPanel.spriteGenerator', 'Sprite Generator'), size: "xl", children: jsxRuntime.jsxs("div", { className: PixelEditor_module.genPanel, children: [jsxRuntime.jsx("div", { className: PixelEditor_module.genTabs, children: ['character', 'building', 'animal'].map((t) => (jsxRuntime.jsxs(ui.NiceButton, { className: `${PixelEditor_module.genTabBtn} ${tab === t ? PixelEditor_module.genTabBtnActive : ''}`, variant: tab === t ? 'primary' : 'ghost', size: "sm", onClick: () => setTab(t), children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: t === 'character' ? 'user' : t === 'building' ? 'home' : 'heart', size: 14 }), ' ', t.charAt(0).toUpperCase() + t.slice(1)] }, t))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genBody, children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.genLeft, children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.panelSection, children: [jsxRuntime.jsx("div", { className: PixelEditor_module.panelTitle, children: jsxRuntime.jsx("span", { children: t('spriteGeneratorPanel.presets', 'Presets') }) }), jsxRuntime.jsx("div", { className: PixelEditor_module.genPresetGrid, children: presets.map((preset, i) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.genPresetBtn} ${i === selectedPresetIdx ? PixelEditor_module.genPresetBtnActive : ''}`, variant: i === selectedPresetIdx ? 'primary' : 'ghost', size: "sm", onClick: () => applyPreset(i), title: preset.name, children: preset.name }, i))) })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.panelSection, style: { flex: 1, overflowY: 'auto' }, children: [jsxRuntime.jsx("div", { className: PixelEditor_module.panelTitle, children: jsxRuntime.jsx("span", { children: t('spriteGeneratorPanel.parts', 'Parts') }) }), categories.map((cat) => {
|
|
277
277
|
const parts = spriteGeneratorCore.getPartsByCategory(cat);
|
|
@@ -288,9 +288,12 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
288
288
|
return (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.miniBtn} ${PixelEditor_module.genPartBtn} ${active ? PixelEditor_module.miniBtnActive : ''}`, variant: active ? 'primary' : 'ghost', size: "sm", onClick: () => (active ? removePart(part.id) : addPart(part.id)), title: part.name, children: part.name }, part.id));
|
|
289
289
|
}) })] }, cat));
|
|
290
290
|
})] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genCenter, children: [jsxRuntime.jsx("div", { className: PixelEditor_module.genPreviewWrap, children: jsxRuntime.jsx("canvas", { ref: previewRef, className: PixelEditor_module.genPreviewCanvas }) }), jsxRuntime.jsx("div", { className: PixelEditor_module.genDirGrid, children: spriteGeneratorCore.ALL_DIRECTIONS.map((d) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.miniBtn} ${direction === d ? PixelEditor_module.miniBtnActive : ''}`, variant: direction === d ? 'primary' : 'ghost', size: "sm", onClick: () => setDirection(d), children: d }, d))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genRow, children: [jsxRuntime.jsx("label", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: t('spriteGeneratorPanel.projection', 'Projection') }), jsxRuntime.jsx(ui.NiceSelect, { className: PixelEditor_module.propSelect, value: projection, onChange: (val) => setProjection(val), options: [
|
|
291
|
-
{ value: 'topDown', label: 'Top-Down' },
|
|
292
|
-
{ value: 'sideView', label: 'Side View' },
|
|
293
|
-
{
|
|
291
|
+
{ value: 'topDown', label: t('spriteGeneratorPanel.topDown', 'Top-Down') },
|
|
292
|
+
{ value: 'sideView', label: t('spriteGeneratorPanel.sideView', 'Side View') },
|
|
293
|
+
{
|
|
294
|
+
value: 'iso25d',
|
|
295
|
+
label: t('spriteGeneratorPanel.n25dIsometric', '2.5D Isometric'),
|
|
296
|
+
},
|
|
294
297
|
] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genRow, children: [jsxRuntime.jsx("label", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: t('spriteGeneratorPanel.size', 'Size') }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 8, max: 256, value: canvasW, onChange: (val) => setCanvasW(val !== null && val !== void 0 ? val : 32) }), jsxRuntime.jsx("span", { style: { fontSize: 10, color: 'var(--nice-text-muted)' }, children: "\u00D7" }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 8, max: 256, value: canvasH, onChange: (val) => setCanvasH(val !== null && val !== void 0 ? val : 32) })] }), jsxRuntime.jsx(ui.NiceCheckbox, { checked: generate8Dir, onChange: (checked) => setGenerate8Dir(checked), label: t('spriteGeneratorPanel.generate8DirectionSheet', 'Generate 8-direction sheet'), className: PixelEditor_module.checkLabel })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genRight, children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.panelSection, children: [jsxRuntime.jsx("div", { className: PixelEditor_module.panelTitle, children: jsxRuntime.jsx("span", { children: t('spriteGeneratorPanel.colors', 'Colors') }) }), paletteGroups.map((group) => {
|
|
295
298
|
var _a;
|
|
296
299
|
return (jsxRuntime.jsxs("div", { style: { marginBottom: 6 }, children: [jsxRuntime.jsx("div", { style: { fontSize: 9, color: 'var(--nice-text-muted)', marginBottom: 2 }, children: group.label }), jsxRuntime.jsx(ui.NiceSelect, { className: PixelEditor_module.propSelect, value: group.value, onChange: (val) => group.set(val), options: group.options.map((opt) => ({
|
|
@@ -304,7 +307,11 @@ const NiceSpriteGeneratorPanel = ({ onSendToCanvas, onClose, mode,
|
|
|
304
307
|
return (
|
|
305
308
|
// A part can be placed twice (left and right leg, flipped), so its id
|
|
306
309
|
// alone is not a unique key.
|
|
307
|
-
jsxRuntime.jsxs("div", { className: PixelEditor_module.genAssemblyItem, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnIcon, variant: "ghost", size: "sm", onClick: () => togglePart(ap.partId), title: ((_a = ap.visible) !== null && _a !== void 0 ? _a : true)
|
|
310
|
+
jsxRuntime.jsxs("div", { className: PixelEditor_module.genAssemblyItem, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnIcon, variant: "ghost", size: "sm", onClick: () => togglePart(ap.partId), title: ((_a = ap.visible) !== null && _a !== void 0 ? _a : true)
|
|
311
|
+
? t('spriteGeneratorPanel.hide', 'Hide')
|
|
312
|
+
: t('spriteGeneratorPanel.show', 'Show'), "aria-label": ((_b = ap.visible) !== null && _b !== void 0 ? _b : true)
|
|
313
|
+
? t('spriteGeneratorPanel.hide', 'Hide')
|
|
314
|
+
: t('spriteGeneratorPanel.show', 'Show'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: ((_c = ap.visible) !== null && _c !== void 0 ? _c : true) ? 'eye' : 'eye-off', size: 14 }) }), jsxRuntime.jsx("span", { className: PixelEditor_module.genAssemblyName, children: (_d = part === null || part === void 0 ? void 0 : part.name) !== null && _d !== void 0 ? _d : ap.partId }), jsxRuntime.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] }), jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnIcon, variant: "ghost", size: "sm", onClick: () => removePart(ap.partId), title: t('spriteGeneratorPanel.remove', 'Remove'), "aria-label": t('spriteGeneratorPanel.remove', 'Remove'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, `${ap.partId}-${i}`));
|
|
308
315
|
})] })] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.genFooter, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", onClick: onClose, children: t('spriteGeneratorPanel.cancel', 'Cancel') }), jsxRuntime.jsxs(ui.NiceButton, { className: PixelEditor_module.btnPrimary, variant: "primary", onClick: handleSendToCanvas, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "clipboard", size: 14 }), ' ', t('spriteGeneratorPanel.sendToCanvas', 'Send to Canvas')] })] })] }) }));
|
|
309
316
|
};
|
|
310
317
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -346,7 +346,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
346
346
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
347
347
|
width: '100%',
|
|
348
348
|
margin: '4px 0',
|
|
349
|
-
} }), jsxRuntime.
|
|
349
|
+
} }), jsxRuntime.jsx("label", { children: t('texturePainter3d.sizePx', 'Size: {size}px').replace('{size}', String(painter.brush.size)) }), jsxRuntime.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%' } }), jsxRuntime.jsx("label", { children: t('texturePainter3d.opacity', 'Opacity: {opacity}%').replace('{opacity}', String(Math.round(painter.brush.opacity * 100))) }), jsxRuntime.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%' } }), jsxRuntime.jsx("label", { children: t('texturePainter3d.hardness', 'Hardness: {hardness}%').replace('{hardness}', String(Math.round(painter.brush.hardness * 100))) }), jsxRuntime.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%' } }), jsxRuntime.jsx("label", { children: t('texturePainter3d.blendMode', 'Blend Mode') }), jsxRuntime.jsxs("select", { value: painter.brush.blendMode, onChange: (e) => painter.setBrush({
|
|
350
350
|
...painter.brush,
|
|
351
351
|
blendMode: e.target.value,
|
|
352
352
|
}), style: {
|
|
@@ -362,7 +362,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
362
362
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
363
363
|
width: '100%',
|
|
364
364
|
margin: '4px 0',
|
|
365
|
-
} }), jsxRuntime.
|
|
365
|
+
} }), jsxRuntime.jsx("label", { children: t('texturePainter3d.zoom', 'Zoom: {zoom}%').replace('{zoom}', String(Math.round(zoom * 100))) }), jsxRuntime.jsxs("div", { style: { display: 'flex', gap: 2 }, children: [jsxRuntime.jsx("button", { onClick: () => setZoom((z) => Math.max(0.1, z - 0.1)), style: btnStyle(false), children: "\u2212" }), jsxRuntime.jsx("button", { onClick: () => setZoom(0.5), style: btnStyle(false), children: t('texturePainter3d.reset', 'Reset') }), jsxRuntime.jsx("button", { onClick: () => setZoom((z) => Math.min(4, z + 0.1)), style: btnStyle(false), children: "+" })] })] }), jsxRuntime.jsxs("div", { style: {
|
|
366
366
|
flex: 1,
|
|
367
367
|
overflow: 'hidden',
|
|
368
368
|
position: 'relative',
|
|
@@ -384,7 +384,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
384
384
|
color: 'var(--nice-text-secondary, #868e96)',
|
|
385
385
|
display: 'flex',
|
|
386
386
|
gap: 12,
|
|
387
|
-
}, children: [jsxRuntime.jsxs("span", { children: [textureWidth, "\u00D7", textureHeight] }), cursorPos && (jsxRuntime.jsxs("span", { children: ["X: ", cursorPos.x, " Y: ", cursorPos.y] })), jsxRuntime.
|
|
387
|
+
}, children: [jsxRuntime.jsxs("span", { children: [textureWidth, "\u00D7", textureHeight] }), cursorPos && (jsxRuntime.jsxs("span", { children: ["X: ", cursorPos.x, " Y: ", cursorPos.y] })), jsxRuntime.jsx("span", { children: t('texturePainter3d.zoom', 'Zoom: {zoom}%').replace('{zoom}', String(Math.round(zoom * 100))) })] })] }), jsxRuntime.jsxs("div", { style: { width: 160, fontSize: 11, display: 'flex', flexDirection: 'column', gap: 4 }, children: [jsxRuntime.jsx("strong", { style: { fontSize: 12 }, children: t('texturePainter3d.layers', 'Layers') }), jsxRuntime.jsx("div", { style: { flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 2 }, children: [...painter.layers].reverse().map((l) => (jsxRuntime.jsxs("div", { style: {
|
|
388
388
|
padding: '4px 6px',
|
|
389
389
|
borderRadius: 3,
|
|
390
390
|
background: painter.activeLayerId === l.id
|
|
@@ -405,7 +405,11 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
405
405
|
? 'var(--nice-text, #c1c2c5)'
|
|
406
406
|
: 'var(--nice-text-secondary, #5c5f66)',
|
|
407
407
|
fontSize: 12,
|
|
408
|
-
}, title: l.visible
|
|
408
|
+
}, title: l.visible
|
|
409
|
+
? t('texturePainter3d.hideLayer', 'Hide layer')
|
|
410
|
+
: t('texturePainter3d.showLayer', 'Show layer'), "aria-label": l.visible
|
|
411
|
+
? t('texturePainter3d.hideLayer', 'Hide layer')
|
|
412
|
+
: t('texturePainter3d.showLayer', 'Show layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: l.visible ? 'eye' : 'eye-off', size: 14 }) }), jsxRuntime.jsx("span", { style: {
|
|
409
413
|
flex: 1,
|
|
410
414
|
overflow: 'hidden',
|
|
411
415
|
textOverflow: 'ellipsis',
|
|
@@ -427,7 +431,7 @@ const Nice3DTexturePainter = ({ textureWidth = 1024, textureHeight = 1024, onSav
|
|
|
427
431
|
cursor: 'pointer',
|
|
428
432
|
background: 'var(--nice-bg-secondary, #2c2e33)',
|
|
429
433
|
color: 'var(--nice-text, #c1c2c5)',
|
|
430
|
-
}, children:
|
|
434
|
+
}, children: t('texturePainter3d.addLayer', '+ Add Layer') }), jsxRuntime.jsx("hr", { style: {
|
|
431
435
|
border: 'none',
|
|
432
436
|
borderTop: '1px solid var(--nice-border, #373a40)',
|
|
433
437
|
width: '100%',
|
|
@@ -439,14 +439,14 @@ const NiceSvgToCode = ({ initialSvg = '', onConvert, className = '', }) => {
|
|
|
439
439
|
navigator.clipboard.writeText(result.code);
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
|
-
return (jsxRuntime.jsxs("div", { className: `nice-svg-to-code ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxRuntime.jsxs("strong", { children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14 }), " SVG
|
|
442
|
+
return (jsxRuntime.jsxs("div", { className: `nice-svg-to-code ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxRuntime.jsxs("strong", { children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14 }), " ", t('svgToCode.svgCode', 'SVG → Code')] }), jsxRuntime.jsx("textarea", { value: svgInput, onChange: (e) => setSvgInput(e.target.value), placeholder: t('svgToCode.pasteSvgMarkupHere', 'Paste SVG markup here…'), rows: 6, style: {
|
|
443
443
|
width: '100%',
|
|
444
444
|
fontFamily: 'monospace',
|
|
445
445
|
fontSize: 11,
|
|
446
446
|
padding: 6,
|
|
447
447
|
borderRadius: 4,
|
|
448
448
|
border: '1px solid var(--nice-border, #e2e8f0)',
|
|
449
|
-
} }), jsxRuntime.jsxs("div", { style: { display: 'grid', gap: 4 }, children: [jsxRuntime.jsxs("label", { children: [
|
|
449
|
+
} }), jsxRuntime.jsxs("div", { style: { display: 'grid', gap: 4 }, children: [jsxRuntime.jsxs("label", { children: [t('svgToCode.framework', 'Framework:'), jsxRuntime.jsxs("select", { value: config.framework, onChange: (e) => updateConfig({ framework: e.target.value }), style: { width: '100%' }, children: [jsxRuntime.jsx("option", { value: "react", children: "React (JSX/TSX)" }), jsxRuntime.jsx("option", { value: "vue", children: "Vue (SFC)" }), jsxRuntime.jsx("option", { value: "web-component", children: t('svgToCode.webComponent', 'Web Component') }), jsxRuntime.jsx("option", { value: "typescript", children: t('svgToCode.typescriptUtility', 'TypeScript (utility)') })] })] }), jsxRuntime.jsxs("label", { children: [t('svgToCode.componentName', 'Component name:'), jsxRuntime.jsx("input", { type: "text", value: config.componentName, onChange: (e) => updateConfig({ componentName: e.target.value.replace(/[^a-zA-Z0-9]/g, '') }), style: { width: '100%', padding: '3px 6px' } })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', gap: 8, flexWrap: 'wrap', fontSize: 11 }, children: [jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: config.typescript, onChange: (e) => updateConfig({ typescript: e.target.checked }) }), ' ', t('svgToCode.typescript', 'TypeScript')] }), jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: config.optimize, onChange: (e) => updateConfig({ optimize: e.target.checked }) }), ' ', t('svgToCode.optimize', 'Optimize')] }), jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: config.sizeProps, onChange: (e) => updateConfig({ sizeProps: e.target.checked }) }), ' ', t('svgToCode.sizeProps', 'Size props')] }), jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: config.useCurrentColor, onChange: (e) => updateConfig({ useCurrentColor: e.target.checked }) }), ' ', "currentColor"] }), jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: config.memo, onChange: (e) => updateConfig({ memo: e.target.checked }) }), ' ', "memo"] })] })] }), jsxRuntime.jsxs("button", { type: "button", onClick: handleConvert, disabled: !svgInput.trim(), style: {
|
|
450
450
|
background: 'var(--nice-color-accent, #6366f1)',
|
|
451
451
|
color: 'var(--nice-text-on-primary, #fff)',
|
|
452
452
|
border: 'none',
|
|
@@ -474,7 +474,7 @@ const NiceSvgToCode = ({ initialSvg = '', onConvert, className = '', }) => {
|
|
|
474
474
|
overflow: 'auto',
|
|
475
475
|
maxHeight: 300,
|
|
476
476
|
whiteSpace: 'pre-wrap',
|
|
477
|
-
}, children: result.code }), result.extractedColors.length > 0 && (jsxRuntime.jsxs("div", { style: { fontSize: 11, marginTop: 4 }, children: [
|
|
477
|
+
}, children: result.code }), result.extractedColors.length > 0 && (jsxRuntime.jsxs("div", { style: { fontSize: 11, marginTop: 4 }, children: [t('svgToCode.colors', 'Colors:'), ' ', result.extractedColors.map((c) => (jsxRuntime.jsx("span", { style: {
|
|
478
478
|
display: 'inline-block',
|
|
479
479
|
width: 12,
|
|
480
480
|
height: 12,
|
|
@@ -112,7 +112,7 @@ const NiceVectorEditor = ({ width: artW = 512, height: artH = 512, className, on
|
|
|
112
112
|
}
|
|
113
113
|
const node = (jsxRuntime.jsx(VectorEditorShapeRenderer.ShapeRenderer, { shape: s, selected: s.id === selId, zoom: zoom }, s.id));
|
|
114
114
|
return previewTr ? (jsxRuntime.jsx("g", { transform: previewTr, children: node }, s.id)) : (node);
|
|
115
|
-
})] }) }) }), jsxRuntime.jsxs(ui.NiceModal, { open: dlgSvg, onClose: () => setDlgSvg(false), title: t('vectorEditor.pasteSvg', 'Paste SVG'), children: [jsxRuntime.jsx("label", { children:
|
|
115
|
+
})] }) }) }), jsxRuntime.jsxs(ui.NiceModal, { open: dlgSvg, onClose: () => setDlgSvg(false), title: t('vectorEditor.pasteSvg', 'Paste SVG'), children: [jsxRuntime.jsx("label", { children: t('vectorEditor.pasteSvgSourceCodeBelow', 'Paste SVG source code below:') }), jsxRuntime.jsx(ui.NiceTextArea, { value: svgText, onChange: (val) => setSvgText(val), placeholder: t('vectorEditor.svgXmlnsHttpWwwW3', '<svg xmlns="http://www.w3.org/2000/svg" ...>') }), jsxRuntime.jsxs("div", { className: VectorEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", onClick: () => setDlgSvg(false), children: t('vectorEditor.cancel', 'Cancel') }), jsxRuntime.jsx(ui.NiceButton, { variant: "primary", onClick: () => importSVGString(svgText), children: t('vectorEditor.import', 'Import') })] })] }), jsxRuntime.jsxs(ui.NiceModal, { open: snippetOpen, onClose: () => setSnippetOpen(false), title: t('vectorEditor.snippet.title', 'Icon snippet copied to clipboard'), children: [jsxRuntime.jsxs("p", { style: { marginTop: 0 }, children: [t('vectorEditor.snippet.pasteHint', 'Paste into'), ' ', jsxRuntime.jsxs("code", { children: ["packages/icons/src/icons/", iconCategory ? `${iconCategory.toLowerCase()}` : '<category>', ".tsx"] }), ":"] }), jsxRuntime.jsx(ui.NiceTextArea, { value: snippetText, onChange: (val) => setSnippetText(val), rows: 16 }), jsxRuntime.jsxs("div", { className: VectorEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "primary", onClick: () => {
|
|
116
116
|
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
117
117
|
navigator.clipboard.writeText(snippetText).catch(() => { });
|
|
118
118
|
}
|
|
@@ -264,7 +264,13 @@ const VectorEditorMenuBar = ({ api, hasOnSaveToLibrary, onExportIconSnippet }) =
|
|
|
264
264
|
{ value: '', label: t('vectorEditor.menu.secondShape', '2nd Shape') },
|
|
265
265
|
...shapes
|
|
266
266
|
.filter((s) => s.id !== selId)
|
|
267
|
-
.map((s, i) => {
|
|
267
|
+
.map((s, i) => {
|
|
268
|
+
var _a;
|
|
269
|
+
return ({
|
|
270
|
+
value: s.id,
|
|
271
|
+
label: (_a = s.name) !== null && _a !== void 0 ? _a : t('vectorEditor.shape', 'Shape {i}').replace('{i}', String(i + 1)),
|
|
272
|
+
});
|
|
273
|
+
}),
|
|
268
274
|
], style: { minWidth: 100 } })), jsxRuntime.jsxs("label", { className: VectorEditor_module.menuLabel, children: [jsxRuntime.jsx(ui.NiceCheckbox, { checked: snapGrid, onChange: () => setSnapGrid((v) => !v) }), t('vectorEditor.menu.snap', 'Snap')] }), onExportIconSnippet && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: VectorEditor_module.menuSep }), jsxRuntime.jsxs(ui.NiceButton, { className: VectorEditor_module.menuBtn, variant: "primary", size: "sm", onClick: onExportIconSnippet, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "clipboard", size: 14 }), ' ', t('vectorEditor.menu.exportIcon', 'Export Icon')] })] }))] }));
|
|
269
275
|
};
|
|
270
276
|
var VectorEditorMenuBar$1 = React.memo(VectorEditorMenuBar);
|
|
@@ -46,7 +46,7 @@ const VectorEditorRightPanel = ({ api, library, artW = 512, artH = 512 }) => {
|
|
|
46
46
|
border: (selectedGradient === null || selectedGradient === void 0 ? void 0 : selectedGradient.id) === grad.id
|
|
47
47
|
? '2px solid var(--nice-bg, #FFF)'
|
|
48
48
|
: '1px solid var(--nice-border-color, #444)',
|
|
49
|
-
}, onClick: () => applyGradient(grad), title:
|
|
49
|
+
}, onClick: () => applyGradient(grad), title: t('vectorEditor.gradient', '{type} gradient').replace('{type}', String(grad.type)) }, i))) }), jsxRuntime.jsx("div", { className: VectorEditor_module.propRow, children: jsxRuntime.jsxs(ui.NiceButton, { className: VectorEditor_module.menuBtn, variant: "ghost", size: "sm", style: { width: '100%', fontSize: 10 }, onClick: () => setShowGradientEditor(!showGradientEditor), children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: showGradientEditor ? 'chevron-down' : 'chevron-right', size: 14 }), ' ', showGradientEditor
|
|
50
50
|
? t('vectorEditor.properties.hideEditor', 'Hide Editor')
|
|
51
51
|
: t('vectorEditor.properties.editGradient', 'Edit Gradient')] }) }), showGradientEditor && selectedGradient && (jsxRuntime.jsxs("div", { style: {
|
|
52
52
|
padding: 4,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
3
|
import { useMemo, useEffect } from 'react';
|
|
4
|
+
import { useNiceTranslation } from '../core/i18n.js';
|
|
4
5
|
import { usePersonControls, playPose } from './animationHelper.js';
|
|
5
6
|
import { DEFAULT_CHARACTER, pick } from './characterTypes.js';
|
|
6
7
|
|
|
@@ -9,6 +10,7 @@ const NiceAnimatedPerson = ({ id, name, size, score = 10, startPose = 'idle', on
|
|
|
9
10
|
// colors prop is destructured for API completeness but not yet fully wired into character defaults.
|
|
10
11
|
}) => {
|
|
11
12
|
var _a, _b, _c, _d, _e;
|
|
13
|
+
const { t } = useNiceTranslation();
|
|
12
14
|
const fx = usePersonControls();
|
|
13
15
|
const effectiveStartPose = pose !== null && pose !== void 0 ? pose : startPose;
|
|
14
16
|
const effectiveCharacter = character !== null && character !== void 0 ? character : config;
|
|
@@ -20,7 +22,7 @@ const NiceAnimatedPerson = ({ id, name, size, score = 10, startPose = 'idle', on
|
|
|
20
22
|
}, [fx, onReady, effectiveStartPose]);
|
|
21
23
|
const W = (_c = (_b = (_a = cfg.size) !== null && _a !== void 0 ? _a : effectiveSize) !== null && _b !== void 0 ? _b : DEFAULT_CHARACTER.size) !== null && _c !== void 0 ? _c : 180;
|
|
22
24
|
const skin = pick(cfg.face.colors, 0, 'var(--anim-skin, #FFD2B3)');
|
|
23
|
-
return (jsx(motion.div, { id: id, style: { width: W, height: W * 1.35, overflow: 'visible' }, animate: fx.root, children: jsxs("svg", { viewBox: "0 0 180 240", width: "100%", height: "100%", role: "img", "aria-label": (_e = (_d = cfg.name) !== null && _d !== void 0 ? _d : name) !== null && _e !== void 0 ? _e : 'Juror', children: [jsxs(motion.g, { animate: fx.body, children: [jsx("rect", { x: "68", y: "158", width: "14", height: "46", rx: "6", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg, #334155)') }), jsx("ellipse", { cx: "75", cy: "204", rx: "10", ry: "5", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg-shadow, #1E293B)') }), jsx("rect", { x: "98", y: "158", width: "14", height: "46", rx: "6", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg, #334155)') }), jsx("ellipse", { cx: "105", cy: "204", rx: "10", ry: "5", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg-shadow, #1E293B)') })] }), jsx(motion.g, { animate: fx.body, children: renderOutfit(cfg.outfit) }), jsx("rect", { x: "84", y: "82", width: "12", height: "12", rx: "4", fill: skin }), jsxs(motion.g, { animate: fx.leftArm, style: { transformOrigin: '64px 96px' }, children: [jsx("rect", { x: "36", y: "96", width: "16", height: "36", rx: "7", fill: skin }), jsx("circle", { cx: "44", cy: "136", r: "7", fill: skin })] }), jsxs(motion.g, { animate: fx.rightArm, style: { transformOrigin: '116px 96px' }, children: [jsx("rect", { x: "128", y: "96", width: "16", height: "36", rx: "7", fill: skin }), jsx("circle", { cx: "136", cy: "136", r: "7", fill: skin }), jsxs(motion.g, { animate: fx.card, children: [jsx("rect", { x: "126", y: "50", width: "42", height: "30", rx: "4", fill: "var(--nice-color-surface, #fff)", stroke: "var(--nice-text-primary, #111)", strokeWidth: 1.2 }), jsx("text", { x: "147", y: "70", textAnchor: "middle", fontSize: "16", fontWeight: 700, fill: "var(--nice-text-primary, #111)", children: String(score) })] }), renderProp(cfg.prop)] }), jsxs(motion.g, { animate: fx.head, children: [renderHairBack(cfg.hair), renderFace(cfg.face), jsx(motion.g, { animate: fx.eyes, children: renderEyes(cfg.eyes) }), renderNose(cfg.nose), jsx(motion.g, { animate: fx.mouth, children: renderMouth(cfg.mouth) }), renderHeadwear(cfg.headwear)] }), jsxs(motion.g, { animate: fx.curse, initial: { opacity: 0 }, children: [jsx("rect", { x: "62", y: "10", width: "56", height: "22", rx: "8", fill: "var(--nice-text-primary, #111)" }), jsx("text", { x: "90", y: "26", textAnchor: "middle", fontSize: "12", fill: "var(--nice-text-inverse, #fff)", children: "#!%&*" }), jsx("path", { d: "M82 32 l4 8 l4 -8", fill: "var(--nice-text-primary, #111)" })] })] }) }));
|
|
25
|
+
return (jsx(motion.div, { id: id, style: { width: W, height: W * 1.35, overflow: 'visible' }, animate: fx.root, children: jsxs("svg", { viewBox: "0 0 180 240", width: "100%", height: "100%", role: "img", "aria-label": (_e = (_d = cfg.name) !== null && _d !== void 0 ? _d : name) !== null && _e !== void 0 ? _e : t('animatedPerson.juror', 'Juror'), children: [jsxs(motion.g, { animate: fx.body, children: [jsx("rect", { x: "68", y: "158", width: "14", height: "46", rx: "6", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg, #334155)') }), jsx("ellipse", { cx: "75", cy: "204", rx: "10", ry: "5", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg-shadow, #1E293B)') }), jsx("rect", { x: "98", y: "158", width: "14", height: "46", rx: "6", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg, #334155)') }), jsx("ellipse", { cx: "105", cy: "204", rx: "10", ry: "5", fill: pick(cfg.outfit.colors, 1, 'var(--anim-outfit-leg-shadow, #1E293B)') })] }), jsx(motion.g, { animate: fx.body, children: renderOutfit(cfg.outfit) }), jsx("rect", { x: "84", y: "82", width: "12", height: "12", rx: "4", fill: skin }), jsxs(motion.g, { animate: fx.leftArm, style: { transformOrigin: '64px 96px' }, children: [jsx("rect", { x: "36", y: "96", width: "16", height: "36", rx: "7", fill: skin }), jsx("circle", { cx: "44", cy: "136", r: "7", fill: skin })] }), jsxs(motion.g, { animate: fx.rightArm, style: { transformOrigin: '116px 96px' }, children: [jsx("rect", { x: "128", y: "96", width: "16", height: "36", rx: "7", fill: skin }), jsx("circle", { cx: "136", cy: "136", r: "7", fill: skin }), jsxs(motion.g, { animate: fx.card, children: [jsx("rect", { x: "126", y: "50", width: "42", height: "30", rx: "4", fill: "var(--nice-color-surface, #fff)", stroke: "var(--nice-text-primary, #111)", strokeWidth: 1.2 }), jsx("text", { x: "147", y: "70", textAnchor: "middle", fontSize: "16", fontWeight: 700, fill: "var(--nice-text-primary, #111)", children: String(score) })] }), renderProp(cfg.prop)] }), jsxs(motion.g, { animate: fx.head, children: [renderHairBack(cfg.hair), renderFace(cfg.face), jsx(motion.g, { animate: fx.eyes, children: renderEyes(cfg.eyes) }), renderNose(cfg.nose), jsx(motion.g, { animate: fx.mouth, children: renderMouth(cfg.mouth) }), renderHeadwear(cfg.headwear)] }), jsxs(motion.g, { animate: fx.curse, initial: { opacity: 0 }, children: [jsx("rect", { x: "62", y: "10", width: "56", height: "22", rx: "8", fill: "var(--nice-text-primary, #111)" }), jsx("text", { x: "90", y: "26", textAnchor: "middle", fontSize: "12", fill: "var(--nice-text-inverse, #fff)", children: "#!%&*" }), jsx("path", { d: "M82 32 l4 8 l4 -8", fill: "var(--nice-text-primary, #111)" })] })] }) }));
|
|
24
26
|
};
|
|
25
27
|
/* ---------------- RENDERERS (redesigned proportions) ---------------- */
|
|
26
28
|
function renderOutfit(cfg) {
|