@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/cjs/animation/AnimatedPerson.js +3 -1
  3. package/dist/cjs/core/NiceBrushEngine.js +5 -4
  4. package/dist/cjs/core/collaboration.js +11 -6
  5. package/dist/cjs/core/minimap.js +21 -20
  6. package/dist/cjs/font/NiceFontEditor.js +5 -5
  7. package/dist/cjs/game/GameAsset2dEditor.js +57 -38
  8. package/dist/cjs/photo/NiceAITools.js +3 -3
  9. package/dist/cjs/photo/PhotoEditorLeftPanel.js +14 -14
  10. package/dist/cjs/pixel/PixelEditor.js +1 -1
  11. package/dist/cjs/pixel/PixelEditorMenuBar.js +92 -27
  12. package/dist/cjs/pixel/PixelEditorRightPanel.js +7 -3
  13. package/dist/cjs/pixel/PixelEditorStatusBar.js +6 -2
  14. package/dist/cjs/pixel/PixelEditorTimeline.js +5 -1
  15. package/dist/cjs/pixel/PixelEditorToolbar.js +3 -1
  16. package/dist/cjs/pixel/SpriteGeneratorPanel.js +18 -11
  17. package/dist/cjs/texture/Nice3DTexturePainter.js +9 -5
  18. package/dist/cjs/vector/NiceSvgToCode.js +3 -3
  19. package/dist/cjs/vector/VectorEditor.js +1 -1
  20. package/dist/cjs/vector/VectorEditorMenuBar.js +7 -1
  21. package/dist/cjs/vector/VectorEditorRightPanel.js +1 -1
  22. package/dist/esm/animation/AnimatedPerson.js +3 -1
  23. package/dist/esm/core/NiceBrushEngine.js +5 -4
  24. package/dist/esm/core/collaboration.js +11 -6
  25. package/dist/esm/core/minimap.js +21 -20
  26. package/dist/esm/font/NiceFontEditor.js +5 -5
  27. package/dist/esm/game/GameAsset2dEditor.js +57 -38
  28. package/dist/esm/photo/NiceAITools.js +3 -3
  29. package/dist/esm/photo/PhotoEditorLeftPanel.js +14 -14
  30. package/dist/esm/pixel/PixelEditor.js +1 -1
  31. package/dist/esm/pixel/PixelEditorMenuBar.js +92 -27
  32. package/dist/esm/pixel/PixelEditorRightPanel.js +7 -3
  33. package/dist/esm/pixel/PixelEditorStatusBar.js +6 -2
  34. package/dist/esm/pixel/PixelEditorTimeline.js +5 -1
  35. package/dist/esm/pixel/PixelEditorToolbar.js +3 -1
  36. package/dist/esm/pixel/SpriteGeneratorPanel.js +18 -11
  37. package/dist/esm/texture/Nice3DTexturePainter.js +9 -5
  38. package/dist/esm/vector/NiceSvgToCode.js +3 -3
  39. package/dist/esm/vector/VectorEditor.js +1 -1
  40. package/dist/esm/vector/VectorEditorMenuBar.js +7 -1
  41. package/dist/esm/vector/VectorEditorRightPanel.js +1 -1
  42. package/package.json +3 -3
@@ -437,14 +437,14 @@ const NiceSvgToCode = ({ initialSvg = '', onConvert, className = '', }) => {
437
437
  navigator.clipboard.writeText(result.code);
438
438
  }
439
439
  };
440
- return (jsxs("div", { className: `nice-svg-to-code ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxs("strong", { children: [jsx(NiceIcon, { name: "refresh", size: 14 }), " SVG \u2192 Code"] }), jsx("textarea", { value: svgInput, onChange: (e) => setSvgInput(e.target.value), placeholder: t('svgToCode.pasteSvgMarkupHere', 'Paste SVG markup here…'), rows: 6, style: {
440
+ return (jsxs("div", { className: `nice-svg-to-code ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxs("strong", { children: [jsx(NiceIcon, { name: "refresh", size: 14 }), " ", t('svgToCode.svgCode', 'SVG → Code')] }), jsx("textarea", { value: svgInput, onChange: (e) => setSvgInput(e.target.value), placeholder: t('svgToCode.pasteSvgMarkupHere', 'Paste SVG markup here…'), rows: 6, style: {
441
441
  width: '100%',
442
442
  fontFamily: 'monospace',
443
443
  fontSize: 11,
444
444
  padding: 6,
445
445
  borderRadius: 4,
446
446
  border: '1px solid var(--nice-border, #e2e8f0)',
447
- } }), jsxs("div", { style: { display: 'grid', gap: 4 }, children: [jsxs("label", { children: ["Framework:", jsxs("select", { value: config.framework, onChange: (e) => updateConfig({ framework: e.target.value }), style: { width: '100%' }, children: [jsx("option", { value: "react", children: "React (JSX/TSX)" }), jsx("option", { value: "vue", children: "Vue (SFC)" }), jsx("option", { value: "web-component", children: t('svgToCode.webComponent', 'Web Component') }), jsx("option", { value: "typescript", children: "TypeScript (utility)" })] })] }), jsxs("label", { children: ["Component name:", 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' } })] }), jsxs("div", { style: { display: 'flex', gap: 8, flexWrap: 'wrap', fontSize: 11 }, children: [jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.typescript, onChange: (e) => updateConfig({ typescript: e.target.checked }) }), ' ', t('svgToCode.typescript', 'TypeScript')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.optimize, onChange: (e) => updateConfig({ optimize: e.target.checked }) }), ' ', t('svgToCode.optimize', 'Optimize')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.sizeProps, onChange: (e) => updateConfig({ sizeProps: e.target.checked }) }), ' ', t('svgToCode.sizeProps', 'Size props')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.useCurrentColor, onChange: (e) => updateConfig({ useCurrentColor: e.target.checked }) }), ' ', "currentColor"] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.memo, onChange: (e) => updateConfig({ memo: e.target.checked }) }), ' ', "memo"] })] })] }), jsxs("button", { type: "button", onClick: handleConvert, disabled: !svgInput.trim(), style: {
447
+ } }), jsxs("div", { style: { display: 'grid', gap: 4 }, children: [jsxs("label", { children: [t('svgToCode.framework', 'Framework:'), jsxs("select", { value: config.framework, onChange: (e) => updateConfig({ framework: e.target.value }), style: { width: '100%' }, children: [jsx("option", { value: "react", children: "React (JSX/TSX)" }), jsx("option", { value: "vue", children: "Vue (SFC)" }), jsx("option", { value: "web-component", children: t('svgToCode.webComponent', 'Web Component') }), jsx("option", { value: "typescript", children: t('svgToCode.typescriptUtility', 'TypeScript (utility)') })] })] }), jsxs("label", { children: [t('svgToCode.componentName', 'Component name:'), 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' } })] }), jsxs("div", { style: { display: 'flex', gap: 8, flexWrap: 'wrap', fontSize: 11 }, children: [jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.typescript, onChange: (e) => updateConfig({ typescript: e.target.checked }) }), ' ', t('svgToCode.typescript', 'TypeScript')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.optimize, onChange: (e) => updateConfig({ optimize: e.target.checked }) }), ' ', t('svgToCode.optimize', 'Optimize')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.sizeProps, onChange: (e) => updateConfig({ sizeProps: e.target.checked }) }), ' ', t('svgToCode.sizeProps', 'Size props')] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.useCurrentColor, onChange: (e) => updateConfig({ useCurrentColor: e.target.checked }) }), ' ', "currentColor"] }), jsxs("label", { children: [jsx("input", { type: "checkbox", checked: config.memo, onChange: (e) => updateConfig({ memo: e.target.checked }) }), ' ', "memo"] })] })] }), jsxs("button", { type: "button", onClick: handleConvert, disabled: !svgInput.trim(), style: {
448
448
  background: 'var(--nice-color-accent, #6366f1)',
449
449
  color: 'var(--nice-text-on-primary, #fff)',
450
450
  border: 'none',
@@ -472,7 +472,7 @@ const NiceSvgToCode = ({ initialSvg = '', onConvert, className = '', }) => {
472
472
  overflow: 'auto',
473
473
  maxHeight: 300,
474
474
  whiteSpace: 'pre-wrap',
475
- }, children: result.code }), result.extractedColors.length > 0 && (jsxs("div", { style: { fontSize: 11, marginTop: 4 }, children: ["Kolory:", ' ', result.extractedColors.map((c) => (jsx("span", { style: {
475
+ }, children: result.code }), result.extractedColors.length > 0 && (jsxs("div", { style: { fontSize: 11, marginTop: 4 }, children: [t('svgToCode.colors', 'Colors:'), ' ', result.extractedColors.map((c) => (jsx("span", { style: {
476
476
  display: 'inline-block',
477
477
  width: 12,
478
478
  height: 12,
@@ -110,7 +110,7 @@ const NiceVectorEditor = ({ width: artW = 512, height: artH = 512, className, on
110
110
  }
111
111
  const node = (jsx(ShapeRenderer, { shape: s, selected: s.id === selId, zoom: zoom }, s.id));
112
112
  return previewTr ? (jsx("g", { transform: previewTr, children: node }, s.id)) : (node);
113
- })] }) }) }), jsxs(NiceModal, { open: dlgSvg, onClose: () => setDlgSvg(false), title: t('vectorEditor.pasteSvg', 'Paste SVG'), children: [jsx("label", { children: "Paste SVG source code below:" }), jsx(NiceTextArea, { value: svgText, onChange: (val) => setSvgText(val), placeholder: t('vectorEditor.svgXmlnsHttpWwwW3', '<svg xmlns="http://www.w3.org/2000/svg" ...>') }), jsxs("div", { className: styles.dialogActions, children: [jsx(NiceButton, { variant: "ghost", onClick: () => setDlgSvg(false), children: t('vectorEditor.cancel', 'Cancel') }), jsx(NiceButton, { variant: "primary", onClick: () => importSVGString(svgText), children: t('vectorEditor.import', 'Import') })] })] }), jsxs(NiceModal, { open: snippetOpen, onClose: () => setSnippetOpen(false), title: t('vectorEditor.snippet.title', 'Icon snippet copied to clipboard'), children: [jsxs("p", { style: { marginTop: 0 }, children: [t('vectorEditor.snippet.pasteHint', 'Paste into'), ' ', jsxs("code", { children: ["packages/icons/src/icons/", iconCategory ? `${iconCategory.toLowerCase()}` : '<category>', ".tsx"] }), ":"] }), jsx(NiceTextArea, { value: snippetText, onChange: (val) => setSnippetText(val), rows: 16 }), jsxs("div", { className: styles.dialogActions, children: [jsx(NiceButton, { variant: "primary", onClick: () => {
113
+ })] }) }) }), jsxs(NiceModal, { open: dlgSvg, onClose: () => setDlgSvg(false), title: t('vectorEditor.pasteSvg', 'Paste SVG'), children: [jsx("label", { children: t('vectorEditor.pasteSvgSourceCodeBelow', 'Paste SVG source code below:') }), jsx(NiceTextArea, { value: svgText, onChange: (val) => setSvgText(val), placeholder: t('vectorEditor.svgXmlnsHttpWwwW3', '<svg xmlns="http://www.w3.org/2000/svg" ...>') }), jsxs("div", { className: styles.dialogActions, children: [jsx(NiceButton, { variant: "ghost", onClick: () => setDlgSvg(false), children: t('vectorEditor.cancel', 'Cancel') }), jsx(NiceButton, { variant: "primary", onClick: () => importSVGString(svgText), children: t('vectorEditor.import', 'Import') })] })] }), jsxs(NiceModal, { open: snippetOpen, onClose: () => setSnippetOpen(false), title: t('vectorEditor.snippet.title', 'Icon snippet copied to clipboard'), children: [jsxs("p", { style: { marginTop: 0 }, children: [t('vectorEditor.snippet.pasteHint', 'Paste into'), ' ', jsxs("code", { children: ["packages/icons/src/icons/", iconCategory ? `${iconCategory.toLowerCase()}` : '<category>', ".tsx"] }), ":"] }), jsx(NiceTextArea, { value: snippetText, onChange: (val) => setSnippetText(val), rows: 16 }), jsxs("div", { className: styles.dialogActions, children: [jsx(NiceButton, { variant: "primary", onClick: () => {
114
114
  if (typeof navigator !== 'undefined' && navigator.clipboard) {
115
115
  navigator.clipboard.writeText(snippetText).catch(() => { });
116
116
  }
@@ -262,7 +262,13 @@ const VectorEditorMenuBar$1 = ({ api, hasOnSaveToLibrary, onExportIconSnippet })
262
262
  { value: '', label: t('vectorEditor.menu.secondShape', '2nd Shape') },
263
263
  ...shapes
264
264
  .filter((s) => s.id !== selId)
265
- .map((s, i) => { var _a; return ({ value: s.id, label: (_a = s.name) !== null && _a !== void 0 ? _a : `Shape ${i + 1}` }); }),
265
+ .map((s, i) => {
266
+ var _a;
267
+ return ({
268
+ value: s.id,
269
+ label: (_a = s.name) !== null && _a !== void 0 ? _a : t('vectorEditor.shape', 'Shape {i}').replace('{i}', String(i + 1)),
270
+ });
271
+ }),
266
272
  ], style: { minWidth: 100 } })), jsxs("label", { className: styles.menuLabel, children: [jsx(NiceCheckbox, { checked: snapGrid, onChange: () => setSnapGrid((v) => !v) }), t('vectorEditor.menu.snap', 'Snap')] }), onExportIconSnippet && (jsxs(Fragment, { children: [jsx("div", { className: styles.menuSep }), jsxs(NiceButton, { className: styles.menuBtn, variant: "primary", size: "sm", onClick: onExportIconSnippet, children: [jsx(NiceIcon, { name: "clipboard", size: 14 }), ' ', t('vectorEditor.menu.exportIcon', 'Export Icon')] })] }))] }));
267
273
  };
268
274
  var VectorEditorMenuBar = React.memo(VectorEditorMenuBar$1);
@@ -44,7 +44,7 @@ const VectorEditorRightPanel$1 = ({ api, library, artW = 512, artH = 512 }) => {
44
44
  border: (selectedGradient === null || selectedGradient === void 0 ? void 0 : selectedGradient.id) === grad.id
45
45
  ? '2px solid var(--nice-bg, #FFF)'
46
46
  : '1px solid var(--nice-border-color, #444)',
47
- }, onClick: () => applyGradient(grad), title: `${grad.type} gradient` }, i))) }), jsx("div", { className: styles.propRow, children: jsxs(NiceButton, { className: styles.menuBtn, variant: "ghost", size: "sm", style: { width: '100%', fontSize: 10 }, onClick: () => setShowGradientEditor(!showGradientEditor), children: [jsx(NiceIcon, { name: showGradientEditor ? 'chevron-down' : 'chevron-right', size: 14 }), ' ', showGradientEditor
47
+ }, onClick: () => applyGradient(grad), title: t('vectorEditor.gradient', '{type} gradient').replace('{type}', String(grad.type)) }, i))) }), jsx("div", { className: styles.propRow, children: jsxs(NiceButton, { className: styles.menuBtn, variant: "ghost", size: "sm", style: { width: '100%', fontSize: 10 }, onClick: () => setShowGradientEditor(!showGradientEditor), children: [jsx(NiceIcon, { name: showGradientEditor ? 'chevron-down' : 'chevron-right', size: 14 }), ' ', showGradientEditor
48
48
  ? t('vectorEditor.properties.hideEditor', 'Hide Editor')
49
49
  : t('vectorEditor.properties.editGradient', 'Edit Gradient')] }) }), showGradientEditor && selectedGradient && (jsxs("div", { style: {
50
50
  padding: 4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice2dev/ui-graphics",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Nice2Dev Graphics Editors — Pixel, Vector, Photo and Animation editors for React",
5
5
  "author": "NiceToDev <contact@nicetodev.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -71,8 +71,8 @@
71
71
  "react-dom": ">=17.0.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@nice2dev/ui": "^1.2.1",
75
- "@nice2dev/ui-core": "^1.2.1",
74
+ "@nice2dev/ui": "^1.2.2",
75
+ "@nice2dev/ui-core": "^1.2.2",
76
76
  "@rollup/plugin-commonjs": "^29.0.3",
77
77
  "@rollup/plugin-node-resolve": "^16.0.3",
78
78
  "@rollup/plugin-typescript": "^12.3.0",