react-konva-utils
Advanced tools
Comparing version 0.3.0 to 0.3.1
import React from 'react'; | ||
export declare const EditorSt: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>; | ||
import { TextConfig } from 'konva/lib/shapes/Text'; | ||
interface EditorStProps extends TextConfig { | ||
onChange: () => void; | ||
} | ||
export declare const EditorSt: React.ForwardRefExoticComponent<Pick<EditorStProps, keyof EditorStProps> & React.RefAttributes<unknown>>; | ||
export {}; |
@@ -15,10 +15,10 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { TextEditor } from './text-editor'; | ||
export const EditorSt = React.forwardRef((_a) => { | ||
var { text, onChange } = _a, props = __rest(_a, ["text", "onChange"]); | ||
export const EditorSt = React.forwardRef((props) => { | ||
const { text, onChange } = props, rest = __rest(props, ["text", "onChange"]); | ||
const [editorEnabled, setEditorEnabled] = React.useState(false); | ||
const textRef = React.useRef(); | ||
const textRef = React.useRef(null); | ||
return (React.createElement(Group, { draggable: true }, | ||
React.createElement(Text, Object.assign({ text: text, ref: textRef, width: 100, onClick: () => { | ||
setEditorEnabled(true); | ||
}, visible: !editorEnabled }, props)), | ||
}, visible: !editorEnabled }, rest)), | ||
editorEnabled && (React.createElement(Group, null, | ||
@@ -25,0 +25,0 @@ React.createElement(TextEditor, { value: text, textNodeRef: textRef, onChange: onChange, onBlur: () => { |
import Konva from 'konva'; | ||
import { PropsWithChildren } from 'react'; | ||
declare type TransformAttrs = { | ||
type TransformAttrs = { | ||
x: number; | ||
@@ -12,3 +12,3 @@ y: number; | ||
}; | ||
declare type Props = PropsWithChildren<{ | ||
type Props = PropsWithChildren<{ | ||
groupProps?: Konva.ContainerConfig; | ||
@@ -15,0 +15,0 @@ divProps?: any; |
@@ -80,3 +80,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}); | ||
React.useEffect(() => { | ||
React.useLayoutEffect(() => { | ||
return () => { | ||
@@ -83,0 +83,0 @@ root.unmount(); |
@@ -21,5 +21,11 @@ import React from 'react'; | ||
} | ||
outer.current.getLayer().batchDraw(); | ||
const outerLayer = outer.current.getLayer(); | ||
if (!outerLayer) | ||
return; | ||
outerLayer.batchDraw(); | ||
if (newContainer) { | ||
newContainer.getLayer().batchDraw(); | ||
const newContainerLayer = newContainer.getLayer(); | ||
if (!newContainerLayer) | ||
return; | ||
newContainerLayer.batchDraw(); | ||
} | ||
@@ -26,0 +32,0 @@ }, [selector, shouldMove]); |
/// <reference types="react" /> | ||
export declare const TextEditor: ({ textNodeRef, value, onBlur, onChange, cursorPosition, }: { | ||
export declare const TextEditor: ({ textNodeRef, value, onBlur, onChange, }: { | ||
textNodeRef: any; | ||
@@ -7,3 +7,2 @@ value: any; | ||
onChange: any; | ||
cursorPosition: any; | ||
}) => JSX.Element; |
import React from 'react'; | ||
import { Html } from './html'; | ||
export const TextEditor = ({ textNodeRef, value, onBlur, onChange, cursorPosition, }) => { | ||
export const TextEditor = ({ textNodeRef, value, onBlur, onChange, }) => { | ||
const [style, setStyle] = React.useState(); | ||
@@ -5,0 +5,0 @@ React.useLayoutEffect(() => { |
{ | ||
"name": "react-konva-utils", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Useful components and hooks for react-konva", | ||
@@ -15,8 +15,8 @@ "author": "Anton Lavrenov", | ||
"react-konva": "^18.0.0-0", | ||
"use-image": "^1.0.12" | ||
"use-image": "^1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"konva": "^8.3.5", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
@@ -30,15 +30,16 @@ "types": "./es/index.d.ts", | ||
"devDependencies": { | ||
"@babel/core": "^7.17.9", | ||
"@storybook/addon-actions": "^6.5.0-alpha.61", | ||
"@storybook/addon-essentials": "^6.5.0-alpha.61", | ||
"@storybook/addon-links": "^6.5.0-alpha.61", | ||
"@storybook/core": "^6.5.0-alpha.61", | ||
"@storybook/core-server": "^6.5.0-alpha.61", | ||
"@storybook/react": "^6.5.0-alpha.61", | ||
"@types/react": "^18.0.1", | ||
"babel-loader": "^8.2.4", | ||
"@babel/core": "^7.20.5", | ||
"@storybook/addon-actions": "^6.5.14", | ||
"@storybook/addon-essentials": "^6.5.14", | ||
"@storybook/addon-links": "^6.5.14", | ||
"@storybook/core": "^6.5.14", | ||
"@storybook/core-server": "^6.5.14", | ||
"@storybook/react": "^6.5.14", | ||
"@types/react": "^18.0.26", | ||
"babel-loader": "^9.1.0", | ||
"html-webpack-plugin": "^5.5.0", | ||
"parcel-bundler": "^1.12.4", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"typescript": "^4.6.3" | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"typescript": "^4.9.4" | ||
}, | ||
@@ -45,0 +46,0 @@ "scripts": { |
12836
234
14
Updateduse-image@^1.1.0