@pixerate/editor-react 0.13.0 → 0.14.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/README.md +3 -3
- package/dist/canvas/index.cjs +180 -68
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +36 -6
- package/dist/canvas/index.d.ts +36 -6
- package/dist/canvas/index.js +113 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-MHTAR3RS.js → chunk-25S5EHH4.js} +84 -27
- package/dist/chunk-25S5EHH4.js.map +1 -0
- package/dist/image-editor/index.d.cts +3 -3
- package/dist/image-editor/index.d.ts +3 -3
- package/dist/index.cjs +94 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -17
- package/dist/index.d.ts +26 -17
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +78 -21
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +8 -9
- package/dist/spreadsheet/index.d.ts +8 -9
- package/dist/spreadsheet/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-MHTAR3RS.js.map +0 -1
package/README.md
CHANGED
|
@@ -68,14 +68,14 @@ import { CommentsPanel, ReviewToolbar, CommentButton, BubbleMenu } from "@pixera
|
|
|
68
68
|
|
|
69
69
|
const editor = useEditor({ extensions: [Comments.configure({ author: me }), TrackChanges.configure({ author: me })] });
|
|
70
70
|
|
|
71
|
-
<ReviewToolbar editor={editor} /> {/* toggle tracking, prev/next, accept/reject (all) */}
|
|
71
|
+
<ReviewToolbar editor={editor} /> {/* toggle tracking, prev/next, accept/reject (all), current change description */}
|
|
72
72
|
<BubbleMenu editor={editor}><CommentButton editor={editor} /></BubbleMenu>
|
|
73
73
|
<CommentsPanel editor={editor} /> {/* threads: reply, resolve, delete, click to select */}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
`useComments(editorOrStore)` and `useTrackChanges(editor)` expose the same state for custom UIs.
|
|
76
|
+
`ReviewToolbar` steps through insertions, deletions, formatting and block changes and shows the current one's author and description (e.g. "Ada: Changed Paragraph to Heading 2"); hide it with `showDescription={false}` or restyle it with `descriptionClassName`. `useComments(editorOrStore)` and `useTrackChanges(editor)` expose the same state for custom UIs (each change has `type` and `description`).
|
|
77
77
|
|
|
78
|
-
`useEditor({ fileImport: true, richClipboard: true })` imports dropped/pasted `.md`, `.html`, `.txt` and `.
|
|
78
|
+
`useEditor({ fileImport: true, richClipboard: true })` imports dropped/pasted `.md`, `.html`, `.txt`, `.rtf` and `.docx` files (plus any adapter you register, e.g. PDF or zipped exports) at the drop position and copies lossless slices between editors. `useFileImport(editor)` returns `{ openFilePicker, importFiles, accept, isImporting, error }` for an import button. `usePromptEditor({ fileImport: true })` imports dropped files as plain text.
|
|
79
79
|
|
|
80
80
|
`useAgentToolProvider(registry, provider)` registers an agent tool provider (see `ToolRegistry` in `@pixerate/editor/agent`) while the component is mounted. Memoize the provider:
|
|
81
81
|
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -21,72 +21,103 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var canvas_exports = {};
|
|
22
22
|
__export(canvas_exports, {
|
|
23
23
|
AgentPresenceLayer: () => AgentPresenceLayer,
|
|
24
|
-
CONNECTION_LINE_TYPES: () =>
|
|
24
|
+
CONNECTION_LINE_TYPES: () => import_canvas9.CONNECTION_LINE_TYPES,
|
|
25
25
|
CanvasGuidesLayer: () => CanvasGuidesLayer,
|
|
26
|
-
CanvasScenesStore: () =>
|
|
27
|
-
DEFAULT_ARRANGE_SHORTCUTS: () =>
|
|
28
|
-
ManualClock: () =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
26
|
+
CanvasScenesStore: () => import_canvas9.CanvasScenesStore,
|
|
27
|
+
DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas9.DEFAULT_ARRANGE_SHORTCUTS,
|
|
28
|
+
ManualClock: () => import_canvas11.ManualClock,
|
|
29
|
+
SHAPE_DATA_KEY: () => import_canvas10.SHAPE_DATA_KEY,
|
|
30
|
+
SHAPE_KINDS: () => import_canvas10.SHAPE_KINDS,
|
|
31
|
+
SHAPE_NODE_TYPE: () => import_canvas10.SHAPE_NODE_TYPE,
|
|
32
|
+
SHAPE_OPERATIONS: () => import_canvas10.SHAPE_OPERATIONS,
|
|
33
|
+
ShapeNode: () => ShapeNode,
|
|
34
|
+
alignNodes: () => import_canvas9.alignNodes,
|
|
35
|
+
applyNodeUpdates: () => import_canvas9.applyNodeUpdates,
|
|
36
|
+
applyShapeCombination: () => import_canvas10.applyShapeCombination,
|
|
37
|
+
blendLayout: () => import_canvas11.blendLayout,
|
|
38
|
+
boundsOf: () => import_canvas11.boundsOf,
|
|
39
|
+
calculateDagreReflowDisplacement: () => import_canvas11.calculateDagreReflowDisplacement,
|
|
40
|
+
calculateDirectionalDisplacement: () => import_canvas11.calculateDirectionalDisplacement,
|
|
41
|
+
canCombineShapeNodes: () => import_canvas10.canCombineShapeNodes,
|
|
42
|
+
canvasHeight: () => import_canvas11.canvasHeight,
|
|
43
|
+
centerNodes: () => import_canvas11.centerNodes,
|
|
44
|
+
centre: () => import_canvas11.centre,
|
|
45
|
+
combineShapeNodes: () => import_canvas10.combineShapeNodes,
|
|
46
|
+
computeNodesBoundingBox: () => import_canvas11.computeNodesBoundingBox,
|
|
47
|
+
computeSnapGuides: () => import_canvas9.computeSnapGuides,
|
|
48
|
+
connectedOnly: () => import_canvas11.connectedOnly,
|
|
49
|
+
createBezierTrajectory: () => import_canvas11.createBezierTrajectory,
|
|
50
|
+
createCanvasScenesStore: () => import_canvas9.createCanvasScenesStore,
|
|
51
|
+
createFanOutTrajectory: () => import_canvas11.createFanOutTrajectory,
|
|
52
|
+
createGuideIndex: () => import_canvas9.createGuideIndex,
|
|
53
|
+
createNodeGuideIndex: () => import_canvas9.createNodeGuideIndex,
|
|
54
|
+
defaultEasing: () => import_canvas11.defaultEasing,
|
|
55
|
+
distributeNodes: () => import_canvas9.distributeNodes,
|
|
56
|
+
dividePolygons: () => import_canvas10.dividePolygons,
|
|
57
|
+
ensureLayout: () => import_canvas11.ensureLayout,
|
|
58
|
+
estimateCanvasHeight: () => import_canvas11.estimateCanvasHeight,
|
|
59
|
+
estimateNodeSize: () => import_canvas11.estimateNodeSize,
|
|
60
|
+
findConnectorSnap: () => import_canvas9.findConnectorSnap,
|
|
61
|
+
fitViewportToNodes: () => import_canvas9.fitViewportToNodes,
|
|
62
|
+
fitViewportToRect: () => import_canvas9.fitViewportToRect,
|
|
63
|
+
flattenSvgPath: () => import_canvas10.flattenSvgPath,
|
|
64
|
+
flowSide: () => import_canvas11.flowSide,
|
|
65
|
+
getAbsolutePosition: () => import_canvas9.getAbsolutePosition,
|
|
66
|
+
getCenteredNodePosition: () => import_canvas11.getCenteredNodePosition,
|
|
67
|
+
getLayoutedNodes: () => import_canvas11.getLayoutedNodes,
|
|
68
|
+
getNodeRect: () => import_canvas9.getNodeRect,
|
|
69
|
+
getNodeShape: () => import_canvas10.getNodeShape,
|
|
70
|
+
getNodeSize: () => import_canvas9.getNodeSize,
|
|
71
|
+
getShapeRenderData: () => import_canvas10.getShapeRenderData,
|
|
72
|
+
getShapeSvg: () => import_canvas10.getShapeSvg,
|
|
73
|
+
handlePoint: () => import_canvas9.handlePoint,
|
|
74
|
+
intersectPolygons: () => import_canvas10.intersectPolygons,
|
|
75
|
+
invertNodeUpdates: () => import_canvas9.invertNodeUpdates,
|
|
76
|
+
isEventFromTextInput: () => import_canvas11.isEventFromTextInput,
|
|
77
|
+
isLocked: () => import_canvas9.isLocked,
|
|
78
|
+
isShapeDescription: () => import_canvas10.isShapeDescription,
|
|
79
|
+
isShapeNode: () => import_canvas10.isShapeNode,
|
|
80
|
+
isValidCanvasNode: () => import_canvas11.isValidCanvasNode,
|
|
81
|
+
isValidUrl: () => import_canvas11.isValidUrl,
|
|
82
|
+
layoutBounds: () => import_canvas11.layoutBounds,
|
|
83
|
+
linearPositionTrajectory: () => import_canvas11.linearPositionTrajectory,
|
|
84
|
+
linearTrajectory: () => import_canvas11.linearTrajectory,
|
|
85
|
+
lockNodes: () => import_canvas9.lockNodes,
|
|
86
|
+
matchArrangeShortcut: () => import_canvas9.matchArrangeShortcut,
|
|
87
|
+
matchSize: () => import_canvas9.matchSize,
|
|
88
|
+
multiPolygonArea: () => import_canvas10.multiPolygonArea,
|
|
89
|
+
multiPolygonBounds: () => import_canvas10.multiPolygonBounds,
|
|
90
|
+
nearestHandlePositions: () => import_canvas9.nearestHandlePositions,
|
|
91
|
+
oppositePosition: () => import_canvas9.oppositePosition,
|
|
92
|
+
overlaps: () => import_canvas11.overlaps,
|
|
93
|
+
parseCanvasClipboardData: () => import_canvas11.parseCanvasClipboardData,
|
|
94
|
+
parseCanvasScenes: () => import_canvas9.parseCanvasScenes,
|
|
95
|
+
parseSvgPath: () => import_canvas10.parseSvgPath,
|
|
96
|
+
placeBeside: () => import_canvas11.placeBeside,
|
|
97
|
+
pointInMultiPolygon: () => import_canvas10.pointInMultiPolygon,
|
|
98
|
+
pointInRings: () => import_canvas10.pointInRings,
|
|
99
|
+
polygonArea: () => import_canvas10.polygonArea,
|
|
100
|
+
polygonBoolean: () => import_canvas10.polygonBoolean,
|
|
101
|
+
polygonToSvgPath: () => import_canvas10.polygonToSvgPath,
|
|
102
|
+
positionToSide: () => import_canvas9.positionToSide,
|
|
103
|
+
readStyleSize: () => import_canvas9.readStyleSize,
|
|
104
|
+
realClock: () => import_canvas11.realClock,
|
|
105
|
+
remapPastedNodes: () => import_canvas11.remapPastedNodes,
|
|
106
|
+
reorderNodes: () => import_canvas9.reorderNodes,
|
|
107
|
+
repositionNodesTo: () => import_canvas11.repositionNodesTo,
|
|
108
|
+
revertShapeCombination: () => import_canvas10.revertShapeCombination,
|
|
109
|
+
ringSignedArea: () => import_canvas10.ringSignedArea,
|
|
110
|
+
runMultiNodeTransition: () => import_canvas11.runMultiNodeTransition,
|
|
111
|
+
serializeCanvasNodes: () => import_canvas11.serializeCanvasNodes,
|
|
112
|
+
shapeNodeToPolygon: () => import_canvas10.shapeNodeToPolygon,
|
|
113
|
+
shapeToPolygon: () => import_canvas10.shapeToPolygon,
|
|
114
|
+
sideToPosition: () => import_canvas9.sideToPosition,
|
|
115
|
+
simplifyRing: () => import_canvas10.simplifyRing,
|
|
116
|
+
snapNodeDrag: () => import_canvas9.snapNodeDrag,
|
|
117
|
+
subtractPolygons: () => import_canvas10.subtractPolygons,
|
|
118
|
+
toggleLockNodes: () => import_canvas9.toggleLockNodes,
|
|
119
|
+
unionPolygons: () => import_canvas10.unionPolygons,
|
|
120
|
+
unlockNodes: () => import_canvas9.unlockNodes,
|
|
90
121
|
useCanvasArrange: () => useCanvasArrange,
|
|
91
122
|
useCanvasArrangeShortcuts: () => useCanvasArrangeShortcuts,
|
|
92
123
|
useCanvasClipboard: () => useCanvasClipboard,
|
|
@@ -97,7 +128,8 @@ __export(canvas_exports, {
|
|
|
97
128
|
useCanvasScenes: () => useCanvasScenes,
|
|
98
129
|
useCanvasShortcuts: () => useCanvasShortcuts,
|
|
99
130
|
useStreamingCanvas: () => useStreamingCanvas,
|
|
100
|
-
withStyleSize: () =>
|
|
131
|
+
withStyleSize: () => import_canvas9.withStyleSize,
|
|
132
|
+
xorPolygons: () => import_canvas10.xorPolygons
|
|
101
133
|
});
|
|
102
134
|
module.exports = __toCommonJS(canvas_exports);
|
|
103
135
|
|
|
@@ -1015,8 +1047,56 @@ function CanvasGuidesLayer({
|
|
|
1015
1047
|
}
|
|
1016
1048
|
|
|
1017
1049
|
// src/canvas/index.ts
|
|
1018
|
-
var import_canvas8 = require("@pixerate/editor/canvas");
|
|
1019
1050
|
var import_canvas9 = require("@pixerate/editor/canvas");
|
|
1051
|
+
|
|
1052
|
+
// src/canvas/ShapeNode.tsx
|
|
1053
|
+
var import_canvas8 = require("@pixerate/editor/canvas");
|
|
1054
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1055
|
+
function ShapeNode({ data, width, height, selected, className = "", children }) {
|
|
1056
|
+
const shape = data?.shape;
|
|
1057
|
+
if (!(0, import_canvas8.isShapeDescription)(shape)) return null;
|
|
1058
|
+
const render = (0, import_canvas8.getShapeRenderData)(shape, { width, height });
|
|
1059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1060
|
+
"div",
|
|
1061
|
+
{
|
|
1062
|
+
className: `pixerate-shape-node ${className}`.trim(),
|
|
1063
|
+
"data-shape-kind": shape.kind,
|
|
1064
|
+
"data-selected": selected ? "true" : void 0,
|
|
1065
|
+
style: { position: "relative", width: "100%", height: "100%" },
|
|
1066
|
+
children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1068
|
+
"svg",
|
|
1069
|
+
{
|
|
1070
|
+
viewBox: render.viewBox,
|
|
1071
|
+
preserveAspectRatio: "none",
|
|
1072
|
+
width: "100%",
|
|
1073
|
+
height: "100%",
|
|
1074
|
+
style: { display: "block", overflow: "visible" },
|
|
1075
|
+
"aria-hidden": "true",
|
|
1076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1077
|
+
"path",
|
|
1078
|
+
{
|
|
1079
|
+
d: render.d,
|
|
1080
|
+
transform: render.transform,
|
|
1081
|
+
fill: render.fill,
|
|
1082
|
+
fillRule: render.fillRule,
|
|
1083
|
+
stroke: render.stroke,
|
|
1084
|
+
strokeWidth: render.strokeWidth,
|
|
1085
|
+
opacity: render.opacity,
|
|
1086
|
+
vectorEffect: "non-scaling-stroke"
|
|
1087
|
+
}
|
|
1088
|
+
)
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
children
|
|
1092
|
+
]
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// src/canvas/index.ts
|
|
1098
|
+
var import_canvas10 = require("@pixerate/editor/canvas");
|
|
1099
|
+
var import_canvas11 = require("@pixerate/editor/canvas");
|
|
1020
1100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1021
1101
|
0 && (module.exports = {
|
|
1022
1102
|
AgentPresenceLayer,
|
|
@@ -1025,15 +1105,23 @@ var import_canvas9 = require("@pixerate/editor/canvas");
|
|
|
1025
1105
|
CanvasScenesStore,
|
|
1026
1106
|
DEFAULT_ARRANGE_SHORTCUTS,
|
|
1027
1107
|
ManualClock,
|
|
1108
|
+
SHAPE_DATA_KEY,
|
|
1109
|
+
SHAPE_KINDS,
|
|
1110
|
+
SHAPE_NODE_TYPE,
|
|
1111
|
+
SHAPE_OPERATIONS,
|
|
1112
|
+
ShapeNode,
|
|
1028
1113
|
alignNodes,
|
|
1029
1114
|
applyNodeUpdates,
|
|
1115
|
+
applyShapeCombination,
|
|
1030
1116
|
blendLayout,
|
|
1031
1117
|
boundsOf,
|
|
1032
1118
|
calculateDagreReflowDisplacement,
|
|
1033
1119
|
calculateDirectionalDisplacement,
|
|
1120
|
+
canCombineShapeNodes,
|
|
1034
1121
|
canvasHeight,
|
|
1035
1122
|
centerNodes,
|
|
1036
1123
|
centre,
|
|
1124
|
+
combineShapeNodes,
|
|
1037
1125
|
computeNodesBoundingBox,
|
|
1038
1126
|
computeSnapGuides,
|
|
1039
1127
|
connectedOnly,
|
|
@@ -1044,22 +1132,30 @@ var import_canvas9 = require("@pixerate/editor/canvas");
|
|
|
1044
1132
|
createNodeGuideIndex,
|
|
1045
1133
|
defaultEasing,
|
|
1046
1134
|
distributeNodes,
|
|
1135
|
+
dividePolygons,
|
|
1047
1136
|
ensureLayout,
|
|
1048
1137
|
estimateCanvasHeight,
|
|
1049
1138
|
estimateNodeSize,
|
|
1050
1139
|
findConnectorSnap,
|
|
1051
1140
|
fitViewportToNodes,
|
|
1052
1141
|
fitViewportToRect,
|
|
1142
|
+
flattenSvgPath,
|
|
1053
1143
|
flowSide,
|
|
1054
1144
|
getAbsolutePosition,
|
|
1055
1145
|
getCenteredNodePosition,
|
|
1056
1146
|
getLayoutedNodes,
|
|
1057
1147
|
getNodeRect,
|
|
1148
|
+
getNodeShape,
|
|
1058
1149
|
getNodeSize,
|
|
1150
|
+
getShapeRenderData,
|
|
1151
|
+
getShapeSvg,
|
|
1059
1152
|
handlePoint,
|
|
1153
|
+
intersectPolygons,
|
|
1060
1154
|
invertNodeUpdates,
|
|
1061
1155
|
isEventFromTextInput,
|
|
1062
1156
|
isLocked,
|
|
1157
|
+
isShapeDescription,
|
|
1158
|
+
isShapeNode,
|
|
1063
1159
|
isValidCanvasNode,
|
|
1064
1160
|
isValidUrl,
|
|
1065
1161
|
layoutBounds,
|
|
@@ -1068,23 +1164,38 @@ var import_canvas9 = require("@pixerate/editor/canvas");
|
|
|
1068
1164
|
lockNodes,
|
|
1069
1165
|
matchArrangeShortcut,
|
|
1070
1166
|
matchSize,
|
|
1167
|
+
multiPolygonArea,
|
|
1168
|
+
multiPolygonBounds,
|
|
1071
1169
|
nearestHandlePositions,
|
|
1072
1170
|
oppositePosition,
|
|
1073
1171
|
overlaps,
|
|
1074
1172
|
parseCanvasClipboardData,
|
|
1075
1173
|
parseCanvasScenes,
|
|
1174
|
+
parseSvgPath,
|
|
1076
1175
|
placeBeside,
|
|
1176
|
+
pointInMultiPolygon,
|
|
1177
|
+
pointInRings,
|
|
1178
|
+
polygonArea,
|
|
1179
|
+
polygonBoolean,
|
|
1180
|
+
polygonToSvgPath,
|
|
1077
1181
|
positionToSide,
|
|
1078
1182
|
readStyleSize,
|
|
1079
1183
|
realClock,
|
|
1080
1184
|
remapPastedNodes,
|
|
1081
1185
|
reorderNodes,
|
|
1082
1186
|
repositionNodesTo,
|
|
1187
|
+
revertShapeCombination,
|
|
1188
|
+
ringSignedArea,
|
|
1083
1189
|
runMultiNodeTransition,
|
|
1084
1190
|
serializeCanvasNodes,
|
|
1191
|
+
shapeNodeToPolygon,
|
|
1192
|
+
shapeToPolygon,
|
|
1085
1193
|
sideToPosition,
|
|
1194
|
+
simplifyRing,
|
|
1086
1195
|
snapNodeDrag,
|
|
1196
|
+
subtractPolygons,
|
|
1087
1197
|
toggleLockNodes,
|
|
1198
|
+
unionPolygons,
|
|
1088
1199
|
unlockNodes,
|
|
1089
1200
|
useCanvasArrange,
|
|
1090
1201
|
useCanvasArrangeShortcuts,
|
|
@@ -1096,6 +1207,7 @@ var import_canvas9 = require("@pixerate/editor/canvas");
|
|
|
1096
1207
|
useCanvasScenes,
|
|
1097
1208
|
useCanvasShortcuts,
|
|
1098
1209
|
useStreamingCanvas,
|
|
1099
|
-
withStyleSize
|
|
1210
|
+
withStyleSize,
|
|
1211
|
+
xorPolygons
|
|
1100
1212
|
});
|
|
1101
1213
|
//# sourceMappingURL=index.cjs.map
|