@lazlon-platform/html-editor 0.4.0 → 0.6.0
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/lib/hooks/actions.ts +54 -26
- package/lib/hooks/batch.ts +17 -7
- package/lib/hooks/index.ts +1 -0
- package/lib/hooks/node.ts +14 -6
- package/lib/hooks/pointer/movePoint.ts +75 -0
- package/lib/hooks/pointer/moveable.ts +92 -57
- package/lib/hooks/pointer/pointer.ts +21 -11
- package/lib/hooks/pointer/resize.ts +176 -210
- package/lib/hooks/pointer/rotation.ts +89 -68
- package/lib/hooks/pointer/selectionFrame.ts +8 -11
- package/lib/hooks/pointer/selector.ts +62 -40
- package/lib/hooks/pointer/snap.ts +23 -23
- package/lib/hooks/textMarks.ts +1 -3
- package/lib/lib/googleFonts.ts +1 -5
- package/lib/model/editor.ts +13 -9
- package/lib/model/geometry/math.ts +623 -0
- package/lib/model/geometry/svg.ts +55 -0
- package/lib/model/history.ts +10 -13
- package/lib/model/index.ts +7 -10
- package/lib/model/node/{editable → editableNode}/index.ts +13 -29
- package/lib/model/node/{formattable.ts → formattableNode/index.ts} +5 -11
- package/lib/model/node/{group.ts → groupNode.ts} +9 -13
- package/lib/model/node/{image.ts → imageNode.ts} +5 -11
- package/lib/model/node/lineNode.ts +59 -0
- package/lib/model/node/{shape/shape.ts → shapeNode/index.ts} +30 -15
- package/lib/model/node/shapeNode/shape.ts +96 -0
- package/lib/model/node/{text.ts → textNode.ts} +19 -21
- package/lib/model/node.ts +11 -29
- package/lib/model/page.ts +4 -3
- package/lib/model/traversal.ts +1 -1
- package/lib/ui/extractor.ts +3 -3
- package/lib/ui/index.ts +2 -4
- package/lib/ui/node/{EditableContent.tsx → EditableContent/index.tsx} +4 -3
- package/lib/ui/node/GroupContent.tsx +1 -1
- package/lib/ui/node/ImageContent.tsx +1 -1
- package/lib/ui/node/LineContent.tsx +32 -0
- package/lib/ui/node/NodeView.tsx +1 -13
- package/lib/ui/node/ShapeContent/ArrowContent.tsx +57 -0
- package/lib/ui/node/ShapeContent/EllipseContent.tsx +37 -0
- package/lib/ui/node/ShapeContent/PolygonContent.tsx +62 -0
- package/lib/ui/node/ShapeContent/RectangleContent.tsx +35 -0
- package/lib/ui/node/ShapeContent/StarContent.tsx +75 -0
- package/lib/ui/node/ShapeContent/index.tsx +43 -0
- package/lib/ui/node/TextContent.tsx +1 -1
- package/lib/ui/selection.ts +9 -26
- package/package.json +34 -34
- package/lib/model/geometry.ts +0 -247
- package/lib/model/node/shape/arrow.ts +0 -50
- package/lib/model/node/shape/ellipse.ts +0 -26
- package/lib/model/node/shape/polygon.ts +0 -108
- package/lib/model/node/shape/star.ts +0 -63
- package/lib/ui/node/ArrowContent.tsx +0 -60
- package/lib/ui/node/EllipseContent.tsx +0 -49
- package/lib/ui/node/PolygonContent.tsx +0 -81
- package/lib/ui/node/StarContent.tsx +0 -60
- /package/lib/model/node/{editable → editableNode}/letterSpacing.ts +0 -0
- /package/lib/model/node/{editable → editableNode}/persistentMarks.ts +0 -0
- /package/lib/model/node/{editable → editableNode}/tiptapExtensions.ts +0 -0
- /package/lib/ui/node/{useDoubleClick.ts → EditableContent/useDoubleClick.ts} +0 -0
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx"
|
|
2
|
-
import { useId } from "react"
|
|
3
|
-
import { useStore } from "react-bolt"
|
|
4
|
-
import { type StarNode } from "../../model/node/shape/star"
|
|
5
|
-
import { EditableContent } from "./EditableContent"
|
|
6
|
-
|
|
7
|
-
export function StarContent(props: { node: StarNode; isStatic?: boolean }) {
|
|
8
|
-
const maskId = useId()
|
|
9
|
-
const { node, isStatic } = props
|
|
10
|
-
|
|
11
|
-
const [valign, halign, background, borderWidth, borderColor] = useStore(
|
|
12
|
-
node,
|
|
13
|
-
"valign",
|
|
14
|
-
"halign",
|
|
15
|
-
"background",
|
|
16
|
-
"borderWidth",
|
|
17
|
-
"borderColor",
|
|
18
|
-
)
|
|
19
|
-
const [w, h, d] = useStore(node, "width", "height", "svgPathData")
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div className="relative size-full">
|
|
23
|
-
<svg width={w} height={h} className="absolute inset-0">
|
|
24
|
-
<defs>
|
|
25
|
-
<mask id={maskId} maskUnits="userSpaceOnUse">
|
|
26
|
-
<path d={d} fill="white" />
|
|
27
|
-
</mask>
|
|
28
|
-
</defs>
|
|
29
|
-
|
|
30
|
-
<path d={d} fill={background} />
|
|
31
|
-
<path
|
|
32
|
-
d={d}
|
|
33
|
-
fill="none"
|
|
34
|
-
stroke={borderColor}
|
|
35
|
-
strokeWidth={borderWidth}
|
|
36
|
-
mask={`url(#${maskId})`}
|
|
37
|
-
/>
|
|
38
|
-
</svg>
|
|
39
|
-
|
|
40
|
-
<div
|
|
41
|
-
className={clsx(
|
|
42
|
-
"flex size-full",
|
|
43
|
-
valign === "top" && "items-start",
|
|
44
|
-
valign === "center" && "items-center",
|
|
45
|
-
valign === "bottom" && "items-end",
|
|
46
|
-
halign === "left" && "justify-start text-left",
|
|
47
|
-
halign === "center" && "justify-center text-center",
|
|
48
|
-
halign === "right" && "justify-end text-right",
|
|
49
|
-
halign === "justify" && "w-full text-justify",
|
|
50
|
-
)}
|
|
51
|
-
>
|
|
52
|
-
<EditableContent
|
|
53
|
-
isStatic={isStatic}
|
|
54
|
-
node={node}
|
|
55
|
-
className={clsx(halign === "justify" && "w-full")}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|