@nice2dev/ui-graphics 1.1.10 → 1.2.1
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 +173 -0
- package/README.md +60 -63
- package/dist/cjs/animation/AnimationEditor.js +0 -3
- package/dist/cjs/animation/Audience.js +3 -1
- package/dist/cjs/animation/BodyRenderer.js +1 -4
- package/dist/cjs/animation/rig/RigPlayer.js +1 -1
- package/dist/cjs/animation/rig/presets.js +67 -55
- package/dist/cjs/animation/shapes/heads.js +0 -3
- package/dist/cjs/animation/shapes/headwear.js +4 -1
- package/dist/cjs/core/NiceBrushEngine.js +6 -6
- package/dist/cjs/core/editorAsk.js +48 -0
- package/dist/cjs/core/i18n.js +7 -3
- package/dist/cjs/core/plugins.js +1 -1
- package/dist/cjs/core/rtl.js +1 -1
- package/dist/cjs/core/theme.js +1 -1
- package/dist/cjs/font/NiceFontEditor.js +16 -14
- package/dist/cjs/game/GameAsset2dEditor.js +28 -19
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/nice2dev-ui-graphics.css +1 -1
- package/dist/cjs/photo/FilterThumb.js +3 -3
- package/dist/cjs/photo/NiceAITools.js +7 -5
- package/dist/cjs/photo/PhotoEditor.js +3 -1
- package/dist/cjs/photo/PhotoEditorCanvas.js +8 -6
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +19 -19
- package/dist/cjs/photo/PhotoEditorToolbar.js +5 -5
- package/dist/cjs/photo/photoFilters.js +1 -0
- package/dist/cjs/pixel/PixelEditor.js +6 -6
- package/dist/cjs/pixel/PixelEditor.module.css.js +1 -1
- package/dist/cjs/pixel/PixelEditorCanvas.js +10 -6
- package/dist/cjs/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/cjs/pixel/PixelEditorRightPanel.js +28 -24
- package/dist/cjs/pixel/PixelEditorStatusBar.js +8 -4
- package/dist/cjs/pixel/PixelEditorTimeline.js +11 -2
- package/dist/cjs/pixel/PixelEditorToolbar.js +10 -6
- package/dist/cjs/pixel/SpriteGeneratorPanel.js +12 -8
- package/dist/cjs/pixel/animalGeneratorPresets.js +31 -31
- package/dist/cjs/pixel/buildingGeneratorPresets.js +24 -24
- package/dist/cjs/pixel/characterGeneratorPresets.js +25 -25
- package/dist/cjs/pixel/usePixelEditor.js +13 -10
- package/dist/cjs/texture/Nice3DTexturePainter.js +12 -10
- package/dist/cjs/ui/NiceUIDesigner.js +18 -14
- package/dist/cjs/vector/NiceSvgToCode.js +6 -4
- package/dist/cjs/vector/VectorEditor.js +3 -5
- package/dist/cjs/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/cjs/vector/useVectorEditor.js +38 -29
- package/dist/cjs/vector/vectorEditorImport.js +1 -0
- package/dist/cjs/vector/vectorIconImport.js +1 -0
- package/dist/esm/animation/AnimationEditor.js +1 -3
- package/dist/esm/animation/Audience.js +3 -1
- package/dist/esm/animation/BodyRenderer.js +3 -5
- package/dist/esm/animation/rig/RigPlayer.js +1 -1
- package/dist/esm/animation/rig/presets.js +68 -56
- package/dist/esm/animation/shapes/heads.js +1 -3
- package/dist/esm/animation/shapes/headwear.js +4 -1
- package/dist/esm/animation/spineExport.js +1 -1
- package/dist/esm/core/NiceBrushEngine.js +6 -6
- package/dist/esm/core/editorAsk.js +45 -0
- package/dist/esm/core/i18n.js +8 -4
- package/dist/esm/core/plugins.js +1 -1
- package/dist/esm/core/rtl.js +1 -1
- package/dist/esm/core/theme.js +1 -1
- package/dist/esm/font/NiceFontEditor.js +16 -14
- package/dist/esm/game/GameAsset2dEditor.js +29 -19
- package/dist/esm/index.js +10 -10
- package/dist/esm/nice2dev-ui-graphics.css +1 -1
- package/dist/esm/photo/FilterThumb.js +3 -3
- package/dist/esm/photo/NiceAITools.js +7 -5
- package/dist/esm/photo/PhotoEditor.js +3 -1
- package/dist/esm/photo/PhotoEditorCanvas.js +8 -6
- package/dist/esm/photo/PhotoEditorLeftPanel.js +19 -19
- package/dist/esm/photo/PhotoEditorToolbar.js +5 -5
- package/dist/esm/photo/photoFilters.js +1 -0
- package/dist/esm/pixel/PixelEditor.js +7 -6
- package/dist/esm/pixel/PixelEditor.module.css.js +1 -1
- package/dist/esm/pixel/PixelEditorCanvas.js +10 -6
- package/dist/esm/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/esm/pixel/PixelEditorRightPanel.js +28 -24
- package/dist/esm/pixel/PixelEditorStatusBar.js +8 -4
- package/dist/esm/pixel/PixelEditorTimeline.js +11 -2
- package/dist/esm/pixel/PixelEditorToolbar.js +10 -6
- package/dist/esm/pixel/SpriteGeneratorPanel.js +12 -8
- package/dist/esm/pixel/animalGeneratorPresets.js +32 -32
- package/dist/esm/pixel/buildingGeneratorPresets.js +25 -25
- package/dist/esm/pixel/characterGeneratorPresets.js +26 -26
- package/dist/esm/pixel/usePixelEditor.js +13 -10
- package/dist/esm/texture/Nice3DTexturePainter.js +12 -10
- package/dist/esm/ui/NiceUIDesigner.js +18 -14
- package/dist/esm/vector/NiceSvgToCode.js +6 -4
- package/dist/esm/vector/VectorEditor.js +4 -5
- package/dist/esm/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/esm/vector/useVectorEditor.js +38 -29
- package/dist/esm/vector/vectorEditorImport.js +1 -0
- package/dist/esm/vector/vectorIconImport.js +1 -0
- package/dist/types/animation/AnimatedPerson.d.ts +0 -4
- package/dist/types/animation/AnimationEditor.d.ts +1 -5
- package/dist/types/animation/Audience.d.ts +0 -4
- package/dist/types/animation/BodyRenderer.d.ts +0 -4
- package/dist/types/animation/rig/RigPlayer.d.ts +0 -7
- package/dist/types/animation/rig/RiggedBody.d.ts +0 -4
- package/dist/types/animation/shapes/heads.d.ts +0 -4
- package/dist/types/core/LocalUI.d.ts +1 -2
- package/dist/types/core/editorAsk.d.ts +26 -0
- package/dist/types/core/i18n.d.ts +1 -17
- package/dist/types/game/GameAsset2dEditor.d.ts +0 -4
- package/dist/types/game/index.d.ts +1 -1
- package/dist/types/index.d.ts +9 -19
- package/dist/types/photo/index.d.ts +0 -2
- package/dist/types/pixel/PixelEditor.d.ts +0 -4
- package/dist/types/pixel/SpriteGeneratorPanel.d.ts +0 -4
- package/dist/types/pixel/usePixelEditor.d.ts +3 -0
- package/dist/types/vector/VectorEditor.d.ts +0 -4
- package/dist/types/vector/useVectorEditor.d.ts +2 -0
- package/package.json +5 -5
|
@@ -17,13 +17,14 @@ const OverlayToolbar = ({ api }) => {
|
|
|
17
17
|
if (!selectedOverlay) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlayToolbar, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.overlayToolbarLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14, style: { marginRight: 4 } }),
|
|
20
|
+
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlayToolbar, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.overlayToolbarLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "box", size: 14, style: { marginRight: 4 } }), t('photoEditor.layer', 'Layer')] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: ((_a = selectedOverlay.opacity) !== null && _a !== void 0 ? _a : 1) * 100, onChange: (e) => updateOverlay(selectedOverlay.id, { opacity: Number(e.target.value) / 100 }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 70 }, title: t('photoEditor.opacity', 'Opacity') }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: accent }, children: [Math.round(((_b = selectedOverlay.opacity) !== null && _b !== void 0 ? _b : 1) * 100), "%"] }), selectedOverlay.type !== 'drawing' && selectedOverlay.type !== 'frame' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 20, max: 500, value: ((_c = selectedOverlay.scaleX) !== null && _c !== void 0 ? _c : 1) * 100, onChange: (e) => {
|
|
21
21
|
const s = Number(e.target.value) / 100;
|
|
22
22
|
updateOverlay(selectedOverlay.id, { scaleX: s, scaleY: s });
|
|
23
|
-
}, onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title:
|
|
23
|
+
}, onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: t('photoEditor.scale', 'Scale') }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: 'var(--nice-text-muted, #aaa)' }, children: [Math.round(((_d = selectedOverlay.scaleX) !== null && _d !== void 0 ? _d : 1) * 100), "%"] })] })), selectedOverlay.type !== 'drawing' && selectedOverlay.type !== 'frame' && (jsxRuntime.jsx(LocalUI.RangeInput, { min: -180, max: 180, value: (_e = selectedOverlay.rotation) !== null && _e !== void 0 ? _e : 0, onChange: (e) => updateOverlay(selectedOverlay.id, { rotation: Number(e.target.value) }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: t('photoEditor.rotation', 'Rotation') })), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayBack(selectedOverlay.id), title: t('photoEditor.moveBack', 'Move back'), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-down", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayForward(selectedOverlay.id), title: t('photoEditor.moveForward', 'Move forward'), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-up", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => deleteOverlay(selectedOverlay.id), className: PhotoEditor_module.overlayToolbarBtn, title: t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14 }) })] }));
|
|
24
24
|
};
|
|
25
25
|
// ── Left Panel ──
|
|
26
|
-
const PhotoEditorLeftPanel =
|
|
26
|
+
const PhotoEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
27
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
27
28
|
var _a;
|
|
28
29
|
const { t, accent, accentDim, activeTab, setActiveTab, setCropMode,
|
|
29
30
|
// Filters
|
|
@@ -72,16 +73,16 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
72
73
|
}, children: cat.label }, cat.key))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.filterGrid, children: filteredList.map((filter) => (jsxRuntime.jsx(FilterThumb, { filter: filter, selected: selectedFilter === filter.id, accent: accent, onSelect: () => {
|
|
73
74
|
setSelectedFilter(filter.id);
|
|
74
75
|
pushHistory();
|
|
75
|
-
}, generateThumbnail: generateThumbnail }, filter.id))) }), selectedFilter !== 'none' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensitySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensityHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "bar-chart", size: 14, style: { marginRight: 4 } }),
|
|
76
|
+
}, generateThumbnail: generateThumbnail }, filter.id))) }), selectedFilter !== 'none' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensitySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensityHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "bar-chart", size: 14, style: { marginRight: 4 } }), t('photoEditor.intensity', 'Intensity')] }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [Math.round(filterIntensity * 100), "%"] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: filterIntensity * 100, onChange: (e) => setFilterIntensity(Number(e.target.value) / 100), onMouseUp: () => pushHistory(), accentColor: accent })] }))] })), activeTab === 'adjust' && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustColumn, children: [photoEditorTypes.ADJUSTMENT_SLIDERS.map((sl) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: sl.icon, size: 14, style: { marginRight: 4 } }), sl.label] }), jsxRuntime.jsx("span", { className: PhotoEditor_module.adjustValue, style: {
|
|
76
77
|
color: adjustments[sl.key] !== 0 ? accent : 'var(--nice-text-secondary, #666)',
|
|
77
|
-
}, onClick: () => handleAdjChange(sl.key, sl.key === 'blur' ? 0 : 0), title:
|
|
78
|
+
}, onClick: () => handleAdjChange(sl.key, sl.key === 'blur' ? 0 : 0), title: t('photoEditor.reset', 'Reset'), children: adjustments[sl.key] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: sl.min, max: sl.max, value: adjustments[sl.key], onChange: (e) => handleAdjChange(sl.key, Number(e.target.value)), onMouseUp: handleAdjChangeEnd, accentColor: accent })] }, sl.key))), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", className: "mt-2", onClick: () => {
|
|
78
79
|
handleAdjChange('brightness', 0);
|
|
79
80
|
const defaults = { ...photoFilters.DEFAULT_ADJUSTMENTS };
|
|
80
81
|
for (const key of Object.keys(defaults)) {
|
|
81
82
|
handleAdjChange(key, defaults[key]);
|
|
82
83
|
}
|
|
83
84
|
pushHistory();
|
|
84
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetAdjustments', 'Reset adjustments')] })] })), activeTab === 'crop' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.cropInfo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }),
|
|
85
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetAdjustments', 'Reset adjustments')] })] })), activeTab === 'crop' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.cropInfo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.dragCornersOrEdgesTo', 'Drag corners or edges to crop the photo.')] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectLabel, children: t('photoEditor.aspectRatio', 'Aspect ratio') }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectRow, children: photoEditorTypes.ASPECT_RATIOS.map((ar) => (jsxRuntime.jsx("button", { onClick: () => {
|
|
85
86
|
setCropAspect(ar.value);
|
|
86
87
|
if (ar.value && cropRect && image) {
|
|
87
88
|
let newW = cropRect.w;
|
|
@@ -106,7 +107,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
106
107
|
setCropAspect(null);
|
|
107
108
|
pushHistory();
|
|
108
109
|
}
|
|
109
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "expand", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetCrop', 'Reset crop')] })] })), activeTab === 'transform' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children:
|
|
110
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "expand", size: 14, style: { marginRight: 4 } }), t('photoEditor.resetCrop', 'Reset crop')] })] })), activeTab === 'transform' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.rotation', 'Rotation') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
110
111
|
setRotation((rotation - 90 + 360) % 360);
|
|
111
112
|
pushHistory();
|
|
112
113
|
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }), " -90\u00B0"] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
@@ -115,13 +116,13 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
115
116
|
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14, style: { marginRight: 4 } }), " +90\u00B0"] }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => {
|
|
116
117
|
setRotation(0);
|
|
117
118
|
pushHistory();
|
|
118
|
-
}, children: "0\u00B0" })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children:
|
|
119
|
+
}, children: "0\u00B0" })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.flip', 'Flip') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: flipH ? 'outline-info' : 'dark', size: "sm", onClick: () => {
|
|
119
120
|
setFlipH(!flipH);
|
|
120
121
|
pushHistory();
|
|
121
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }),
|
|
122
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.horizontal', 'Horizontal')] }), jsxRuntime.jsxs(LocalUI.Button, { variant: flipV ? 'outline-info' : 'dark', size: "sm", onClick: () => {
|
|
122
123
|
setFlipV(!flipV);
|
|
123
124
|
pushHistory();
|
|
124
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }),
|
|
125
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "move", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.vertical', 'Vertical')] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: t('photoEditor.previewZoom', 'Preview zoom') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformZoomRow, children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 50, max: 300, value: zoom * 100, onChange: (e) => setZoom(Number(e.target.value) / 100), accentColor: accent }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.transformZoomValue, style: { color: accent }, children: [Math.round(zoom * 100), "%"] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformInfo, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Rotation:" }), " ", rotation, "\u00B0"] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Flip H:" }), " ", flipH ? 'Yes' : 'No'] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Flip V:" }), " ", flipV ? 'Yes' : 'No'] }), cropRect && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Crop:" }), " ", Math.round(cropRect.w), " \u00D7 ", Math.round(cropRect.h), ' (', "x:", Math.round(cropRect.x), ", y:", Math.round(cropRect.y), ")"] }))] })] })), activeTab === 'stickers' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "circle", size: 14, style: { marginRight: 4 } }), " Stickers / Emoji"] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.pillRowGap3, children: photoOverlays.EMOJI_CATALOG.map((cat) => (jsxRuntime.jsxs("button", { onClick: () => setEmojiCat(cat.id), className: emojiCat === cat.id ? PhotoEditor_module.pillEmojiActive : PhotoEditor_module.pillEmoji, style: {
|
|
125
126
|
borderColor: emojiCat === cat.id ? accent : undefined,
|
|
126
127
|
background: emojiCat === cat.id ? accentDim : undefined,
|
|
127
128
|
}, children: [cat.icon, " ", cat.label] }, cat.id))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.emojiGrid, children: (_a = photoOverlays.EMOJI_CATALOG.find((c) => c.id === emojiCat)) === null || _a === void 0 ? void 0 : _a.emojis.map((em, idx) => (jsxRuntime.jsx("button", { onClick: () => {
|
|
@@ -142,7 +143,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
142
143
|
: '' }), jsxRuntime.jsx("button", { onClick: (e) => {
|
|
143
144
|
e.stopPropagation();
|
|
144
145
|
deleteOverlay(ov.id);
|
|
145
|
-
}, className: PhotoEditor_module.overlayDeleteBtn, "aria-label": t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, ov.id)))] }))] })), activeTab === 'text' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "type", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.addCaption', 'Add caption')] }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: textDraft, onChange: (e) => setTextDraft(e.target.value), placeholder: t('photoEditor.textPlaceholder', 'Enter text…'), className: PhotoEditor_module.textArea }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textBtnRow, children: [jsxRuntime.jsx(LocalUI.Button, { variant: textBold ? 'light' : 'dark', size: "sm", onClick: () => setTextBold(!textBold), title:
|
|
146
|
+
}, className: PhotoEditor_module.overlayDeleteBtn, "aria-label": t('photoEditor.deleteLayer', 'Delete layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, ov.id)))] }))] })), activeTab === 'text' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "type", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.addCaption', 'Add caption')] }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: textDraft, onChange: (e) => setTextDraft(e.target.value), placeholder: t('photoEditor.textPlaceholder', 'Enter text…'), className: PhotoEditor_module.textArea }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textBtnRow, children: [jsxRuntime.jsx(LocalUI.Button, { variant: textBold ? 'light' : 'dark', size: "sm", onClick: () => setTextBold(!textBold), title: t('photoEditor.bold', 'Bold'), className: PhotoEditor_module.textFormatBtn, style: { fontWeight: 700 }, children: "B" }), jsxRuntime.jsx(LocalUI.Button, { variant: textItalic ? 'light' : 'dark', size: "sm", onClick: () => setTextItalic(!textItalic), title: t('photoEditor.italic', 'Italic'), className: PhotoEditor_module.textFormatBtn, style: { fontStyle: 'italic' }, children: "I" }), jsxRuntime.jsx(LocalUI.Button, { variant: textOutline ? 'light' : 'dark', size: "sm", onClick: () => setTextOutline(!textOutline), title: t('photoEditor.outline', 'Outline'), className: PhotoEditor_module.textFormatBtn, children: "O" }), jsxRuntime.jsx(LocalUI.Button, { variant: textBg ? 'light' : 'dark', size: "sm", onClick: () => setTextBg(!textBg), title: t('photoEditor.background', 'Background'), className: PhotoEditor_module.textFormatBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "square", size: 14 }) }), jsxRuntime.jsx("input", { type: "color", value: textColor, onChange: (e) => setTextColor(e.target.value), className: PhotoEditor_module.colorInputLg, title: t('photoEditor.textColour', 'Text colour') })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [t('photoEditor.size', 'Size'), ":"] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 12, max: 120, value: textFontSize, onChange: (e) => setTextFontSize(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [textFontSize, "px"] })] }), jsxRuntime.jsxs(LocalUI.Button, { size: "sm", className: PhotoEditor_module.accentBtn, style: { background: accent, borderColor: accent }, disabled: !textDraft.trim(), onClick: () => {
|
|
146
147
|
const ov = createTextOverlay(textDraft);
|
|
147
148
|
ov.color = textColor;
|
|
148
149
|
ov.bold = textBold;
|
|
@@ -166,13 +167,13 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
166
167
|
italic: !selectedOverlay.italic,
|
|
167
168
|
});
|
|
168
169
|
pushHistory();
|
|
169
|
-
}, className: PhotoEditor_module.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }),
|
|
170
|
+
}, className: PhotoEditor_module.textFormatBtnSm, style: { fontStyle: 'italic' }, children: "I" })] })] }))] })), activeTab === 'shapes' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "star", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.shapes', 'Shapes')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.shapeColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabel, children: "Stroke:" }), jsxRuntime.jsx("input", { type: "color", value: shapeStroke, onChange: (e) => setShapeStroke(e.target.value), className: PhotoEditor_module.colorInput, title: t('photoEditor.strokeColor', 'Stroke color') }), jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabelMl, children: "Fill:" }), jsxRuntime.jsx("input", { type: "color", value: shapeFill || '#ffffff', onChange: (e) => setShapeFill(e.target.value), className: PhotoEditor_module.colorInput, title: t('photoEditor.fillColor', 'Fill color') }), jsxRuntime.jsx(LocalUI.Button, { variant: shapeFill ? 'light' : 'dark', size: "sm", onClick: () => setShapeFill(shapeFill ? '' : '#ffffff'), className: PhotoEditor_module.shapeFillToggle, children: shapeFill ? 'Off' : 'On' })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Width:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 20, value: shapeStrokeW, onChange: (e) => setShapeStrokeW(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [shapeStrokeW, "px"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.shapeGrid, children: photoOverlays.SHAPE_CATALOG.map((sh) => (jsxRuntime.jsx("button", { title: sh.label, onClick: () => {
|
|
170
171
|
const ov = createShapeOverlay(sh.id);
|
|
171
172
|
ov.strokeColor = shapeStroke;
|
|
172
173
|
ov.fillColor = shapeFill || null;
|
|
173
174
|
ov.strokeWidth = shapeStrokeW;
|
|
174
175
|
addOverlay(ov);
|
|
175
|
-
}, className: PhotoEditor_module.shapeBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }),
|
|
176
|
+
}, className: PhotoEditor_module.shapeBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: sh.icon, size: 18 }) }, sh.id))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "image", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.frames', 'Frames')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameColorRow, children: [jsxRuntime.jsx("input", { type: "color", value: frameColor, onChange: (e) => setFrameColor(e.target.value), className: PhotoEditor_module.colorInput, "aria-label": t('photoEditor.frameColor', 'Frame color') }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameThicknessWrap, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Grub.:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 10, value: frameThick, onChange: (e) => setFrameThick(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsx("span", { className: PhotoEditor_module.frameThicknessValue, style: { color: accent }, children: frameThick })] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameGrid, children: [photoOverlays.FRAME_CATALOG.map((fr) => (jsxRuntime.jsx("button", { title: fr.label, onClick: () => {
|
|
176
177
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
177
178
|
const ov = createFrameOverlay(fr.id, frameColor);
|
|
178
179
|
ov.thickness = frameThick / 100;
|
|
@@ -180,7 +181,7 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
180
181
|
}, className: PhotoEditor_module.frameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: fr.icon, size: 18 }) }, fr.id))), jsxRuntime.jsx("button", { title: t('photoEditor.removeFrame', 'Remove frame'), "aria-label": t('photoEditor.removeFrame', 'Remove frame'), onClick: () => {
|
|
181
182
|
setOverlays((prev) => prev.filter((o) => o.type !== 'frame'));
|
|
182
183
|
pushHistory();
|
|
183
|
-
}, className: PhotoEditor_module.removeFrameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }),
|
|
184
|
+
}, className: PhotoEditor_module.removeFrameBtn, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] })] })), activeTab === 'draw' && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "brush", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.freehandDrawing', 'Freehand drawing')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionInfoMb, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "info", size: 14, style: { marginRight: 4 } }), t('photoEditor.drawDirectlyOnThePhoto', 'Draw directly on the photo by holding the left mouse button.')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.quickColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Color:" }), jsxRuntime.jsx("input", { type: "color", value: drawColor, onChange: (e) => setDrawColor(e.target.value), className: PhotoEditor_module.colorInputDraw, "aria-label": t('photoEditor.drawColor', 'Drawing color') }), [
|
|
184
185
|
'#ff0000',
|
|
185
186
|
'#ff8800',
|
|
186
187
|
'#ffff00',
|
|
@@ -214,15 +215,14 @@ const PhotoEditorLeftPanel = React.memo(({ api }) => {
|
|
|
214
215
|
}));
|
|
215
216
|
pushHistory();
|
|
216
217
|
}
|
|
217
|
-
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }),
|
|
218
|
+
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.undoStroke', 'Undo stroke')] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => {
|
|
218
219
|
if (drawingOverlayRef.current) {
|
|
219
220
|
deleteOverlay(drawingOverlayRef.current.id);
|
|
220
221
|
drawingOverlayRef.current = null;
|
|
221
222
|
}
|
|
222
|
-
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14, style: { marginRight: 4 } }),
|
|
223
|
+
}, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "trash", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.clear', 'Clear')] })] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", className: "mt-2 w-100", onClick: () => {
|
|
223
224
|
drawingOverlayRef.current = null;
|
|
224
|
-
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 14, style: { marginRight: 4 } }),
|
|
225
|
-
});
|
|
226
|
-
PhotoEditorLeftPanel.displayName = 'PhotoEditorLeftPanel';
|
|
225
|
+
}, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.newDrawingLayer', 'New drawing layer')] })] }))] })] }));
|
|
226
|
+
}), { displayName: 'PhotoEditorLeftPanel' });
|
|
227
227
|
|
|
228
228
|
module.exports = PhotoEditorLeftPanel;
|
|
@@ -6,15 +6,15 @@ var React = require('react');
|
|
|
6
6
|
var LocalUI = require('../core/LocalUI.js');
|
|
7
7
|
var PhotoEditor_module = require('./PhotoEditor.module.css.js');
|
|
8
8
|
|
|
9
|
-
const PhotoEditorToolbar =
|
|
9
|
+
const PhotoEditorToolbar = /* @__PURE__ */ Object.assign(
|
|
10
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
10
11
|
const { t, accent, historyIdx, historyLength, undo, redo, handleReset, showCompare, setShowCompare, handleDownload, handleCopyToClipboard, handleShareNative, onCancel, handleSave, } = api;
|
|
11
|
-
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: undo, disabled: historyIdx <= 0, title: `${t('photoEditor.undo', 'Undo')} (Ctrl+Z)`, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: redo, disabled: historyIdx >= historyLength - 1, title: t('photoEditor.redo', 'Redo (Ctrl+Y)'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleReset, title:
|
|
12
|
+
return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: undo, disabled: historyIdx <= 0, title: `${t('photoEditor.undo', 'Undo')} (Ctrl+Z)`, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "reply", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: redo, disabled: historyIdx >= historyLength - 1, title: t('photoEditor.redo', 'Redo (Ctrl+Y)'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "forward", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleReset, title: t('photoEditor.reset', 'Reset'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "refresh", size: 14 }) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.toolbarDivider }), jsxRuntime.jsx(LocalUI.Button, { variant: showCompare ? 'outline-info' : 'dark', size: "sm", onClick: () => setShowCompare(!showCompare), title: t('photoEditor.compareOriginal', 'Compare with original'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "columns", size: 14 }) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.toolbarDivider }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleDownload, title: t('photoEditor.download', 'Download'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "download", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleCopyToClipboard, title: t('photoEditor.copyToClipboard', 'Copy to clipboard'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "clipboard", size: 14 }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: handleShareNative, title: t('common.share', 'Share'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "send", size: 14 }) })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarTitle, style: { color: accent }, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "wand", size: 14, style: { marginRight: 8 } }), t('photoEditor.title', 'Photo Editor')] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.toolbarGroup, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", onClick: onCancel, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14, style: { marginRight: 4 } }), ' ', t('common.cancel', 'Cancel')] }), jsxRuntime.jsxs(LocalUI.Button, { size: "sm", style: {
|
|
12
13
|
background: accent,
|
|
13
14
|
borderColor: accent,
|
|
14
|
-
color: 'var(--nice-
|
|
15
|
+
color: 'var(--nice-color-white, #fff)',
|
|
15
16
|
fontWeight: 600,
|
|
16
17
|
}, onClick: handleSave, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "check", size: 14, style: { marginRight: 4 } }), ' ', t('photoEditor.apply', 'Apply')] })] })] }));
|
|
17
|
-
});
|
|
18
|
-
PhotoEditorToolbar.displayName = 'PhotoEditorToolbar';
|
|
18
|
+
}), { displayName: 'PhotoEditorToolbar' });
|
|
19
19
|
|
|
20
20
|
module.exports = PhotoEditorToolbar;
|
|
@@ -287,6 +287,7 @@ function brownie(data) {
|
|
|
287
287
|
function duotone(data, params) {
|
|
288
288
|
const out = cloneImageData(data);
|
|
289
289
|
const d = out.data;
|
|
290
|
+
// audit-allow: literal-color +2 — the duotone filter's default inks, written into the photo
|
|
290
291
|
const dark = hexToRgb((params === null || params === void 0 ? void 0 : params.darkColor) || '#001f3f');
|
|
291
292
|
const light = hexToRgb((params === null || params === void 0 ? void 0 : params.lightColor) || '#ff851b');
|
|
292
293
|
for (let i = 0; i < d.length; i += 4) {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var ui = require('@nice2dev/ui');
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var editorAsk = require('../core/editorAsk.js');
|
|
7
|
+
var i18n = require('../core/i18n.js');
|
|
6
8
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
7
9
|
var PixelEditorCanvas = require('./PixelEditorCanvas.js');
|
|
8
10
|
var PixelEditorMenuBar = require('./PixelEditorMenuBar.js');
|
|
@@ -14,20 +16,21 @@ var SpriteGeneratorPanel = require('./SpriteGeneratorPanel.js');
|
|
|
14
16
|
var usePixelEditor = require('./usePixelEditor.js');
|
|
15
17
|
|
|
16
18
|
const NicePixelEditor = ({ initialWidth = 64, initialHeight = 64, className, onSaveToLibrary, }) => {
|
|
19
|
+
const { t } = i18n.useNiceTranslation();
|
|
17
20
|
const api = usePixelEditor.usePixelEditor({ initialWidth, initialHeight, onSaveToLibrary });
|
|
18
21
|
const [showGenerator, setShowGenerator] = React.useState(false);
|
|
19
22
|
const handleGeneratorSend = React.useCallback((imageData) => {
|
|
20
23
|
var _a;
|
|
21
24
|
(_a = api.importImageData) === null || _a === void 0 ? void 0 : _a.call(api, imageData);
|
|
22
25
|
}, [api]);
|
|
23
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { ref: api.fInp, type: "file", accept: ".ase,.aseprite,.png,.jpg,.jpeg,.gif,.bmp,.webp,.svg,.tga,.ico,.tiff,.tif,.avif", style: { display: 'none' }, onChange: (e) => {
|
|
26
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(editorAsk.EditorAskDialog, { ask: api.pendingAsk }), jsxRuntime.jsx("input", { ref: api.fInp, type: "file", accept: ".ase,.aseprite,.png,.jpg,.jpeg,.gif,.bmp,.webp,.svg,.tga,.ico,.tiff,.tif,.avif", style: { display: 'none' }, onChange: (e) => {
|
|
24
27
|
var _a;
|
|
25
28
|
const f = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
26
29
|
if (f) {
|
|
27
30
|
api.openFile(f);
|
|
28
31
|
}
|
|
29
32
|
e.target.value = '';
|
|
30
|
-
} }), jsxRuntime.jsx(ui.NiceAppShell, { className: className, flush: true, menubar: jsxRuntime.jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsxRuntime.jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsxRuntime.jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsxRuntime.jsx(PixelEditorTimeline, { api: api }), statusBar: jsxRuntime.jsx(PixelEditorStatusBar, { api: api }), children: jsxRuntime.jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsxRuntime.jsx(SpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxRuntime.jsxs(ui.NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title:
|
|
33
|
+
} }), jsxRuntime.jsx(ui.NiceAppShell, { className: className, flush: true, menubar: jsxRuntime.jsx(PixelEditorMenuBar, { api: api, hasOnSaveToLibrary: !!onSaveToLibrary, onOpenGenerator: () => setShowGenerator(true) }), sidebar: jsxRuntime.jsx(PixelEditorToolbar, { api: api }), rightSidebar: jsxRuntime.jsx(PixelEditorRightPanel, { api: api }), bottomPanel: jsxRuntime.jsx(PixelEditorTimeline, { api: api }), statusBar: jsxRuntime.jsx(PixelEditorStatusBar, { api: api }), children: jsxRuntime.jsx(PixelEditorCanvas, { api: api }) }), showGenerator && (jsxRuntime.jsx(SpriteGeneratorPanel, { onSendToCanvas: handleGeneratorSend, onClose: () => setShowGenerator(false) })), jsxRuntime.jsxs(ui.NiceModal, { open: api.dlgNew, onClose: () => api.setDlgNew(false), title: t('pixelEditor.newDocument', 'New Document'), children: [jsxRuntime.jsx("label", { children: "Width (px)" }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 1, max: 4096, value: api.nw, onChange: (val) => api.setNw(val !== null && val !== void 0 ? val : 64), "aria-label": t('pixelEditor.documentWidth', 'Document width') }), jsxRuntime.jsx("label", { children: "Height (px)" }), jsxRuntime.jsx(ui.NiceNumberInput, { min: 1, max: 4096, value: api.nh, onChange: (val) => api.setNh(val !== null && val !== void 0 ? val : 64), "aria-label": t('pixelEditor.documentHeight', 'Document height') }), jsxRuntime.jsx("div", { style: { display: 'flex', gap: 4, flexWrap: 'wrap', marginTop: 8 }, children: [
|
|
31
34
|
[16, 16],
|
|
32
35
|
[32, 32],
|
|
33
36
|
[48, 48],
|
|
@@ -41,10 +44,7 @@ const NicePixelEditor = ({ initialWidth = 64, initialHeight = 64, className, onS
|
|
|
41
44
|
].map(([w, h]) => (jsxRuntime.jsxs(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", size: "sm", style: { fontSize: 10, padding: '2px 6px' }, onClick: () => {
|
|
42
45
|
api.setNw(w);
|
|
43
46
|
api.setNh(h);
|
|
44
|
-
}, children: [w, "x", h] }, `${w}x${h}`))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", onClick: () => api.setDlgNew(false), children:
|
|
47
|
+
}, children: [w, "x", h] }, `${w}x${h}`))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.dialogActions, children: [jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnSecondary, variant: "ghost", onClick: () => api.setDlgNew(false), children: t('pixelEditor.cancel', 'Cancel') }), jsxRuntime.jsx(ui.NiceButton, { className: PixelEditor_module.btnPrimary, variant: "primary", onClick: () => api.newDoc(api.nw, api.nh), children: t('pixelEditor.create', 'Create') })] })] })] }));
|
|
45
48
|
};
|
|
46
|
-
/** @deprecated Use NicePixelEditor */
|
|
47
|
-
const PixelEditor = NicePixelEditor;
|
|
48
49
|
|
|
49
50
|
exports.NicePixelEditor = NicePixelEditor;
|
|
50
|
-
exports.PixelEditor = PixelEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var styles = {"menuBar":"PixelEditor-module_menuBar__8JFld","menuSep":"PixelEditor-module_menuSep__pNZsR","toolbar":"PixelEditor-module_toolbar__paCGq","toolBtn":"PixelEditor-module_toolBtn__wD1Kj","toolBtnActive":"PixelEditor-module_toolBtnActive__R51U0","canvasContainer":"PixelEditor-module_canvasContainer__8z2AY","rightPanel":"PixelEditor-module_rightPanel__ZjrCh","panelSection":"PixelEditor-module_panelSection__3l225","collapseChevron":"PixelEditor-module_collapseChevron__Yuvz6","layerActions":"PixelEditor-module_layerActions__pZH1f","panelTitle":"PixelEditor-module_panelTitle__vYyeO","layerItem":"PixelEditor-module_layerItem__J-gtn","layerItemActive":"PixelEditor-module_layerItemActive__yPt29","layerVis":"PixelEditor-module_layerVis__Uj7n2","layerName":"PixelEditor-module_layerName__HovwJ","layerOpacity":"PixelEditor-module_layerOpacity__qmWvu","paletteGrid":"PixelEditor-module_paletteGrid__knY-n","paletteSwatch":"PixelEditor-module_paletteSwatch__MUbha","paletteSwatchActive":"PixelEditor-module_paletteSwatchActive__wDR4T","bottomPanel":"PixelEditor-module_bottomPanel__rviLF","timelineControls":"PixelEditor-module_timelineControls__Laroq","timelineFrames":"PixelEditor-module_timelineFrames__dw06F","frameThumb":"PixelEditor-module_frameThumb__2E9mG","frameThumbActive":"PixelEditor-module_frameThumbActive__Z0eK4","frameNum":"PixelEditor-module_frameNum__PoGQC","statusBar":"PixelEditor-module_statusBar__QnphD","dialogActions":"PixelEditor-module_dialogActions__fOa7a","btnPrimary":"PixelEditor-module_btnPrimary__FYlTy","btnSecondary":"PixelEditor-module_btnSecondary__qLfyJ","brushSlider":"PixelEditor-module_brushSlider__UxQ38","toolSep":"PixelEditor-module_toolSep__YIu-E","toolGroup":"PixelEditor-module_toolGroup__xA2lN","miniBtn":"PixelEditor-module_miniBtn__tg5N0","miniBtnActive":"PixelEditor-module_miniBtnActive__gpveu","colorSwatches":"PixelEditor-module_colorSwatches__jFuRX","brushShapes":"PixelEditor-module_brushShapes__2bBfl","pressureToggles":"PixelEditor-module_pressureToggles__AITuh","checkLabel":"PixelEditor-module_checkLabel__-d-TA","hsvPicker":"PixelEditor-module_hsvPicker__0ERIh","layerLock":"PixelEditor-module_layerLock__xeWnc","layerNameInput":"PixelEditor-module_layerNameInput__ZiOKv","layerControls":"PixelEditor-module_layerControls__MrpXo","blendSelect":"PixelEditor-module_blendSelect__QCwns","layerOpSlider":"PixelEditor-module_layerOpSlider__Vw-qs","genPanel":"PixelEditor-module_genPanel__99Md8","
|
|
3
|
+
var styles = {"menuBar":"PixelEditor-module_menuBar__8JFld","menuSep":"PixelEditor-module_menuSep__pNZsR","toolbar":"PixelEditor-module_toolbar__paCGq","toolBtn":"PixelEditor-module_toolBtn__wD1Kj","toolBtnActive":"PixelEditor-module_toolBtnActive__R51U0","canvasContainer":"PixelEditor-module_canvasContainer__8z2AY","rightPanel":"PixelEditor-module_rightPanel__ZjrCh","panelSection":"PixelEditor-module_panelSection__3l225","collapseChevron":"PixelEditor-module_collapseChevron__Yuvz6","layerActions":"PixelEditor-module_layerActions__pZH1f","panelTitle":"PixelEditor-module_panelTitle__vYyeO","layerItem":"PixelEditor-module_layerItem__J-gtn","layerItemActive":"PixelEditor-module_layerItemActive__yPt29","layerVis":"PixelEditor-module_layerVis__Uj7n2","layerName":"PixelEditor-module_layerName__HovwJ","layerOpacity":"PixelEditor-module_layerOpacity__qmWvu","paletteGrid":"PixelEditor-module_paletteGrid__knY-n","paletteSwatch":"PixelEditor-module_paletteSwatch__MUbha","paletteSwatchActive":"PixelEditor-module_paletteSwatchActive__wDR4T","bottomPanel":"PixelEditor-module_bottomPanel__rviLF","timelineControls":"PixelEditor-module_timelineControls__Laroq","timelineFrames":"PixelEditor-module_timelineFrames__dw06F","frameThumb":"PixelEditor-module_frameThumb__2E9mG","frameThumbActive":"PixelEditor-module_frameThumbActive__Z0eK4","frameNum":"PixelEditor-module_frameNum__PoGQC","statusBar":"PixelEditor-module_statusBar__QnphD","dialogActions":"PixelEditor-module_dialogActions__fOa7a","btnPrimary":"PixelEditor-module_btnPrimary__FYlTy","btnSecondary":"PixelEditor-module_btnSecondary__qLfyJ","brushSlider":"PixelEditor-module_brushSlider__UxQ38","toolSep":"PixelEditor-module_toolSep__YIu-E","toolGroup":"PixelEditor-module_toolGroup__xA2lN","miniBtn":"PixelEditor-module_miniBtn__tg5N0","miniBtnActive":"PixelEditor-module_miniBtnActive__gpveu","colorSwatches":"PixelEditor-module_colorSwatches__jFuRX","brushShapes":"PixelEditor-module_brushShapes__2bBfl","pressureToggles":"PixelEditor-module_pressureToggles__AITuh","checkLabel":"PixelEditor-module_checkLabel__-d-TA","hsvPicker":"PixelEditor-module_hsvPicker__0ERIh","layerLock":"PixelEditor-module_layerLock__xeWnc","layerNameInput":"PixelEditor-module_layerNameInput__ZiOKv","layerControls":"PixelEditor-module_layerControls__MrpXo","blendSelect":"PixelEditor-module_blendSelect__QCwns","layerOpSlider":"PixelEditor-module_layerOpSlider__Vw-qs","genPanel":"PixelEditor-module_genPanel__99Md8","genTabs":"PixelEditor-module_genTabs__No5Za","genTabBtn":"PixelEditor-module_genTabBtn__e2VhB","genTabBtnActive":"PixelEditor-module_genTabBtnActive__Rt3jQ","genBody":"PixelEditor-module_genBody__MuiQy","genLeft":"PixelEditor-module_genLeft__JdEw6","genCenter":"PixelEditor-module_genCenter__c5X0S","genRight":"PixelEditor-module_genRight__qFz11","genPreviewWrap":"PixelEditor-module_genPreviewWrap__360F-","genPreviewCanvas":"PixelEditor-module_genPreviewCanvas__75Lw2","genDirGrid":"PixelEditor-module_genDirGrid__xjEp7","genRow":"PixelEditor-module_genRow__awCw9","genPresetGrid":"PixelEditor-module_genPresetGrid__f9XK6","genPresetBtn":"PixelEditor-module_genPresetBtn__5C2We","genPresetBtnActive":"PixelEditor-module_genPresetBtnActive__WAGew","genPartGrid":"PixelEditor-module_genPartGrid__l17oc","genPartBtn":"PixelEditor-module_genPartBtn__5OO82","genColorSwatches":"PixelEditor-module_genColorSwatches__acI6q","genColorSwatch":"PixelEditor-module_genColorSwatch__JE8BO","genAssemblyItem":"PixelEditor-module_genAssemblyItem__zNL2P","genAssemblyName":"PixelEditor-module_genAssemblyName__GU-kr","genFooter":"PixelEditor-module_genFooter__WkyJp","btnIcon":"PixelEditor-module_btnIcon__O59l9","propSelect":"PixelEditor-module_propSelect__4P0Qi"};
|
|
4
4
|
|
|
5
5
|
module.exports = styles;
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18n = require('../core/i18n.js');
|
|
5
6
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
6
7
|
|
|
7
|
-
const PixelEditorCanvas =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const PixelEditorCanvas = /* @__PURE__ */ Object.assign(
|
|
9
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
10
|
+
const { t } = i18n.useNiceTranslation();
|
|
11
|
+
return (jsxRuntime.jsx("div", { ref: api.boxRef, className: PixelEditor_module.canvasContainer, children: jsxRuntime.jsx("canvas", { ref: api.cvRef, onPointerDown: api.onDown, onPointerMove: api.onMove, onPointerUp: api.onUp, onPointerLeave: () => {
|
|
12
|
+
api.drawing.current = false;
|
|
13
|
+
api.panning.current = false;
|
|
14
|
+
api.setCursor(null);
|
|
15
|
+
}, onWheel: api.onWheel, onContextMenu: (e) => e.preventDefault(), style: { inset: 0, width: '100%', height: '100%', touchAction: 'none' }, "aria-label": t('pixelEditorCanvas.pixelEditorCanvas', 'Pixel editor canvas') }) }));
|
|
16
|
+
}), { displayName: 'PixelEditorCanvas' });
|
|
13
17
|
|
|
14
18
|
module.exports = PixelEditorCanvas;
|
|
@@ -6,7 +6,8 @@ var uiCore = require('@nice2dev/ui-core');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
8
8
|
|
|
9
|
-
const PixelEditorMenuBar =
|
|
9
|
+
const PixelEditorMenuBar = /* @__PURE__ */ Object.assign(
|
|
10
|
+
/* @__PURE__ */ React.memo(({ api, hasOnSaveToLibrary, onOpenGenerator }) => {
|
|
10
11
|
const items = [
|
|
11
12
|
{
|
|
12
13
|
id: 'file',
|
|
@@ -95,7 +96,6 @@ const PixelEditorMenuBar = React.memo(({ api, hasOnSaveToLibrary, onOpenGenerato
|
|
|
95
96
|
},
|
|
96
97
|
];
|
|
97
98
|
return (jsxRuntime.jsx("div", { className: PixelEditor_module.menuBar, children: jsxRuntime.jsx(ui.NiceMenu, { items: items, orientation: "horizontal", variant: "ghost", density: "compact" }) }));
|
|
98
|
-
});
|
|
99
|
-
PixelEditorMenuBar.displayName = 'PixelEditorMenuBar';
|
|
99
|
+
}), { displayName: 'PixelEditorMenuBar' });
|
|
100
100
|
|
|
101
101
|
module.exports = PixelEditorMenuBar;
|
|
@@ -4,36 +4,40 @@ 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 HSVPicker = require('./HSVPicker.js');
|
|
8
9
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
9
10
|
var pixelEditorTypes = require('./pixelEditorTypes.js');
|
|
10
11
|
|
|
11
12
|
/** A collapsible section header: rotating chevron + title. */
|
|
12
13
|
const sectionTrigger = (title) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: PixelEditor_module.collapseChevron, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "chevron-right", size: 12 }) }), jsxRuntime.jsx("span", { children: title })] }));
|
|
13
|
-
const PixelEditorRightPanel =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
api.
|
|
14
|
+
const PixelEditorRightPanel = /* @__PURE__ */ Object.assign(
|
|
15
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
16
|
+
const { t } = i18n.useNiceTranslation();
|
|
17
|
+
return (jsxRuntime.jsxs("div", { className: PixelEditor_module.rightPanel, children: [jsxRuntime.jsxs(ui.NiceCollapse, { className: PixelEditor_module.panelSection, defaultExpanded: true, trigger: sectionTrigger('Brush'), children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.brushSlider, children: [jsxRuntime.jsx("label", { children: t('pixelEditorRightPanel.size', 'Size') }), jsxRuntime.jsx(ui.NiceSlider, { min: 1, max: 64, value: api.brush.size, onChange: (val) => api.setBrush((b) => ({ ...b, size: val })), "aria-label": t('pixelEditorRightPanel.brushSize', 'Brush size') }), jsxRuntime.jsx("span", { children: api.brush.size })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.brushSlider, children: [jsxRuntime.jsx("label", { children: t('pixelEditorRightPanel.opacity', 'Opacity') }), jsxRuntime.jsx(ui.NiceSlider, { min: 1, max: 100, value: api.brush.opacity, onChange: (val) => api.setBrush((b) => ({ ...b, opacity: val })), "aria-label": t('pixelEditorRightPanel.brushOpacity', 'Brush opacity') }), jsxRuntime.jsxs("span", { children: [api.brush.opacity, "%"] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.brushSlider, children: [jsxRuntime.jsx("label", { children: t('pixelEditorRightPanel.flow', 'Flow') }), jsxRuntime.jsx(ui.NiceSlider, { min: 1, max: 100, value: api.brush.flow, onChange: (val) => api.setBrush((b) => ({ ...b, flow: val })), "aria-label": t('pixelEditorRightPanel.brushFlow', 'Brush flow') }), jsxRuntime.jsxs("span", { children: [api.brush.flow, "%"] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.brushSlider, children: [jsxRuntime.jsx("label", { children: t('pixelEditorRightPanel.hard', 'Hard') }), jsxRuntime.jsx(ui.NiceSlider, { min: 0, max: 100, value: api.brush.hardness, onChange: (val) => api.setBrush((b) => ({ ...b, hardness: val })), "aria-label": t('pixelEditorRightPanel.brushHardness', 'Brush hardness') }), jsxRuntime.jsxs("span", { children: [api.brush.hardness, "%"] })] }), jsxRuntime.jsxs("div", { className: PixelEditor_module.brushSlider, children: [jsxRuntime.jsx("label", { children: t('pixelEditorRightPanel.space', 'Space') }), jsxRuntime.jsx(ui.NiceSlider, { min: 1, max: 100, value: api.brush.spacing, onChange: (val) => api.setBrush((b) => ({ ...b, spacing: val })), "aria-label": t('pixelEditorRightPanel.brushSpacing', 'Brush spacing') }), jsxRuntime.jsxs("span", { children: [api.brush.spacing, "%"] })] }), jsxRuntime.jsx("div", { className: PixelEditor_module.brushShapes, children: pixelEditorTypes.BRUSH_SHAPES.map((s) => (jsxRuntime.jsx(ui.NiceButton, { className: `${PixelEditor_module.miniBtn} ${api.brush.shape === s.id ? PixelEditor_module.miniBtnActive : ''}`, variant: api.brush.shape === s.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setBrush((b) => ({ ...b, shape: s.id })), title: s.label, "aria-label": s.label, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: s.icon, size: 16 }) }, s.id))) }), jsxRuntime.jsxs("div", { className: PixelEditor_module.pressureToggles, children: [jsxRuntime.jsx(ui.NiceCheckbox, { checked: api.brush.pressureSize, onChange: (checked) => api.setBrush((b) => ({ ...b, pressureSize: checked })), label: t('pixelEditorRightPanel.pressureSize', 'Pressure→Size'), className: PixelEditor_module.checkLabel }), jsxRuntime.jsx(ui.NiceCheckbox, { checked: api.brush.pressureOpacity, onChange: (checked) => api.setBrush((b) => ({ ...b, pressureOpacity: checked })), label: t('pixelEditorRightPanel.pressureOpacity', 'Pressure→Opacity'), className: PixelEditor_module.checkLabel })] })] }), jsxRuntime.jsx(ui.NiceCollapse, { className: PixelEditor_module.panelSection, defaultExpanded: true, trigger: sectionTrigger('Colour'), children: jsxRuntime.jsx(HSVPicker.HSVPicker, { color: api.col1, onChange: api.setCol1 }) }), jsxRuntime.jsxs(ui.NiceCollapse, { className: PixelEditor_module.panelSection, defaultExpanded: true, trigger: sectionTrigger('Layers'), children: [jsxRuntime.jsxs("div", { className: PixelEditor_module.layerActions, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.addLayer, title: t('pixelEditorRightPanel.addLayer', 'Add Layer'), "aria-label": t('pixelEditorRightPanel.addLayer', 'Add Layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.dupLayer, title: t('pixelEditorRightPanel.duplicateLayer', 'Duplicate Layer'), "aria-label": t('pixelEditorRightPanel.duplicateLayer', 'Duplicate Layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "copy", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.rmLayer, title: t('pixelEditorRightPanel.removeLayer', 'Remove Layer'), "aria-label": t('pixelEditorRightPanel.removeLayer', 'Remove Layer'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "minus", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.mergeDown, title: t('pixelEditorRightPanel.mergeDown', 'Merge Down'), "aria-label": t('pixelEditorRightPanel.mergeDown', 'Merge Down'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-down", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.moveLayerUp, title: t('pixelEditorRightPanel.moveUp', 'Move Up'), "aria-label": t('pixelEditorRightPanel.moveUp', 'Move Up'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-up", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.moveLayerDown, title: t('pixelEditorRightPanel.moveDown', 'Move Down'), "aria-label": t('pixelEditorRightPanel.moveDown', 'Move Down'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-down", size: 16 }) })] }), [...api.layers]
|
|
18
|
+
.map((l, i) => ({ l, i }))
|
|
19
|
+
.reverse()
|
|
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
|
+
e.stopPropagation();
|
|
22
|
+
api.toggleVis(i);
|
|
23
|
+
}, title: l.visible ? 'Visible' : 'Hidden', children: jsxRuntime.jsx(uiCore.NiceIcon, { name: l.visible ? 'eye' : 'eye-off', size: 14 }) }), jsxRuntime.jsx("span", { className: PixelEditor_module.layerLock, onClick: (e) => {
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
api.toggleLock(i);
|
|
26
|
+
}, title: l.locked ? 'Locked' : '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
|
+
if (e.key === 'Enter') {
|
|
28
|
+
api.setEditingLayerName(null);
|
|
29
|
+
}
|
|
30
|
+
}, autoFocus: true, "aria-label": t('pixelEditorRightPanel.layerName', 'Layer name') })) : (jsxRuntime.jsx("span", { className: PixelEditor_module.layerName, onDoubleClick: (e) => {
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
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: `Opacity: ${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
|
+
if (!api.pal.includes(api.col1)) {
|
|
35
|
+
api.setPal((p) => [...p, api.col1]);
|
|
25
36
|
}
|
|
26
|
-
},
|
|
27
|
-
e.
|
|
28
|
-
api.
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
api.setPal((p) => [...p, api.col1]);
|
|
32
|
-
}
|
|
33
|
-
}, title: "Add current colour", "aria-label": "Add current colour", children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 16 }) }) }), jsxRuntime.jsx("div", { className: PixelEditor_module.paletteGrid, children: api.pal.map((c, i) => (jsxRuntime.jsx("div", { className: `${PixelEditor_module.paletteSwatch} ${c === api.col1 ? PixelEditor_module.paletteSwatchActive : ''}`, style: { backgroundColor: c }, onClick: () => api.setCol1(c), onContextMenu: (e) => {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
api.setCol2(c);
|
|
36
|
-
}, title: c }, i))) })] })] })));
|
|
37
|
-
PixelEditorRightPanel.displayName = 'PixelEditorRightPanel';
|
|
37
|
+
}, title: t('pixelEditorRightPanel.addCurrentColour', 'Add current colour'), "aria-label": t('pixelEditorRightPanel.addCurrentColour', 'Add current colour'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "plus", size: 16 }) }) }), jsxRuntime.jsx("div", { className: PixelEditor_module.paletteGrid, children: api.pal.map((c, i) => (jsxRuntime.jsx("div", { className: `${PixelEditor_module.paletteSwatch} ${c === api.col1 ? PixelEditor_module.paletteSwatchActive : ''}`, style: { backgroundColor: c }, onClick: () => api.setCol1(c), onContextMenu: (e) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
api.setCol2(c);
|
|
40
|
+
}, title: c }, i))) })] })] }));
|
|
41
|
+
}), { displayName: 'PixelEditorRightPanel' });
|
|
38
42
|
|
|
39
43
|
module.exports = PixelEditorRightPanel;
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18n = require('../core/i18n.js');
|
|
5
6
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
6
7
|
var pixelEditorTypes = require('./pixelEditorTypes.js');
|
|
7
8
|
|
|
8
|
-
const PixelEditorStatusBar =
|
|
9
|
+
const PixelEditorStatusBar = /* @__PURE__ */ Object.assign(
|
|
10
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
9
11
|
var _a;
|
|
10
|
-
|
|
11
|
-
})
|
|
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.jsxs("span", { children: ["Brush: ", api.brush.size, "px ", api.brush.shape] }), jsxRuntime.jsxs("span", { children: ["Pressure: ", Math.round(api.pressure * 100), "%"] }), jsxRuntime.jsxs("span", { children: ["Layer: ", (_a = api.layers[api.aLi]) === null || _a === void 0 ? void 0 : _a.name] }), jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.frame', 'Frame {current}/{total}')
|
|
14
|
+
.replace('{current}', String(api.afi + 1))
|
|
15
|
+
.replace('{total}', String(api.fc)) }), api.symmetry !== 'none' && jsxRuntime.jsxs("span", { children: ["Sym: ", api.symmetry] }), api.shapeFilled && jsxRuntime.jsx("span", { children: t('pixelEditorStatusBar.filled', 'Filled') }), api.sel && (jsxRuntime.jsxs("span", { children: ["Sel: ", api.sel.w, "\u00D7", api.sel.h] }))] }));
|
|
16
|
+
}), { displayName: 'PixelEditorStatusBar' });
|
|
13
17
|
|
|
14
18
|
module.exports = PixelEditorStatusBar;
|
|
@@ -4,9 +4,18 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var ui = require('@nice2dev/ui');
|
|
5
5
|
var uiCore = require('@nice2dev/ui-core');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var i18n = require('../core/i18n.js');
|
|
7
8
|
var PixelEditor_module = require('./PixelEditor.module.css.js');
|
|
8
9
|
|
|
9
|
-
const PixelEditorTimeline =
|
|
10
|
-
|
|
10
|
+
const PixelEditorTimeline = /* @__PURE__ */ Object.assign(
|
|
11
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
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: "+ Frame" }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.dupFrame, "aria-label": t('pixelEditorTimeline.duplicateFrame', 'Duplicate frame'), children: "Dup" }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: api.rmFrame, "aria-label": t('pixelEditorTimeline.removeFrame', 'Remove frame'), children: "\u2212 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 ? 'Pause' : 'Play', children: jsxRuntime.jsx(uiCore.NiceIcon, { name: api.playing ? 'pause' : 'play', size: 16 }) }), jsxRuntime.jsx("label", { children: "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.jsxs("span", { children: [api.fc, " frame", api.fc !== 1 ? 's' : ''] })] }), 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: `Frame ${fi + 1}`, style: {
|
|
14
|
+
width: 36,
|
|
15
|
+
height: 36,
|
|
16
|
+
imageRendering: 'pixelated',
|
|
17
|
+
objectFit: 'contain',
|
|
18
|
+
} })), jsxRuntime.jsx("span", { className: PixelEditor_module.frameNum, children: fi + 1 })] }, fi))) })] }));
|
|
19
|
+
}), { displayName: 'PixelEditorTimeline' });
|
|
11
20
|
|
|
12
21
|
module.exports = PixelEditorTimeline;
|
|
@@ -4,14 +4,18 @@ 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
|
var pixelEditorTypes = require('./pixelEditorTypes.js');
|
|
9
10
|
|
|
10
|
-
const PixelEditorToolbar =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const PixelEditorToolbar = /* @__PURE__ */ Object.assign(
|
|
12
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
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 ? 'Filled shape' : '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: `Symmetry: ${m.label}`, "aria-label": `Symmetry: ${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
|
+
const tmp = api.col1;
|
|
16
|
+
api.setCol1(api.col2);
|
|
17
|
+
api.setCol2(tmp);
|
|
18
|
+
}, title: t('pixelEditorToolbar.swapX', 'Swap (X)'), "aria-label": t('pixelEditorToolbar.swapColours', 'Swap colours'), style: { fontSize: 12, width: 24, height: 24 }, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "shuffle", size: 14 }) })] })] }));
|
|
19
|
+
}), { displayName: 'PixelEditorToolbar' });
|
|
16
20
|
|
|
17
21
|
module.exports = PixelEditorToolbar;
|