@fragiola/flow-vue 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/connection.d.ts +1 -0
- package/dist/connection.js +1 -0
- package/dist/drag.d.ts +1 -0
- package/dist/drag.js +1 -0
- package/dist/index.d.ts +893 -0
- package/dist/index.js +2184 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard.d.ts +1 -0
- package/dist/keyboard.js +1 -0
- package/dist/minimap.d.ts +80 -0
- package/dist/minimap.js +167 -0
- package/dist/minimap.js.map +1 -0
- package/dist/primitive-h9jTIEeT.js +274 -0
- package/dist/primitive-h9jTIEeT.js.map +1 -0
- package/dist/primitive-ryVigrQO.d.ts +42 -0
- package/dist/reconnection.d.ts +1 -0
- package/dist/reconnection.js +1 -0
- package/dist/resize.d.ts +80 -0
- package/dist/resize.js +195 -0
- package/dist/resize.js.map +1 -0
- package/dist/rolldown-runtime-D8jQpDG7.js +12 -0
- package/dist/selection.d.ts +1 -0
- package/dist/selection.js +1 -0
- package/dist/subflows.d.ts +1 -0
- package/dist/subflows.js +1 -0
- package/package.json +101 -3
package/dist/resize.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { n as PrimitiveProps, o as RenderSlot, r as SlotFunction, t as FlowComponent } from "./primitive-ryVigrQO.js";
|
|
2
|
+
import { ResizeHandleDirection, ResizeHandleVariant } from "@fragiola/flow";
|
|
3
|
+
import { ResizeDirection } from "@fragiola/flow/resize";
|
|
4
|
+
export * from "@fragiola/flow/resize";
|
|
5
|
+
interface NodeResizerState {
|
|
6
|
+
readonly nodeId: string;
|
|
7
|
+
/** its node is being resized: `data-resizing` */
|
|
8
|
+
readonly resizing: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface NodeResizerProps extends PrimitiveProps {
|
|
11
|
+
/** its node; default the enclosing `Flow.Node`'s */
|
|
12
|
+
nodeId?: string | undefined;
|
|
13
|
+
/** this node's limits, over `resize()`'s (in flow units) */
|
|
14
|
+
minWidth?: number | undefined;
|
|
15
|
+
minHeight?: number | undefined;
|
|
16
|
+
maxWidth?: number | undefined;
|
|
17
|
+
maxHeight?: number | undefined;
|
|
18
|
+
/** this node keeps its aspect ratio, over `resize()`'s */
|
|
19
|
+
keepAspectRatio?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* the sides its handles move: `"horizontal"` only the width (and x), `"vertical"` only the
|
|
22
|
+
* height (and y); default both. A corner then moves its one dimension
|
|
23
|
+
*/
|
|
24
|
+
direction?: ResizeDirection | undefined;
|
|
25
|
+
}
|
|
26
|
+
interface NodeResizerSlots extends RenderSlot<NodeResizerState> {
|
|
27
|
+
/** its handles; default a `ResizeHandle` at each corner and side */
|
|
28
|
+
default?: SlotFunction<{
|
|
29
|
+
state: NodeResizerState;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A node's resizer (`data-flow-part="resizer"`, `resize()`), inside `Flow.Node`: a box over the
|
|
34
|
+
* node holding its `ResizeHandle`s; its limits are this node's own (`setPartOptions`). Render it
|
|
35
|
+
* only when the node should be resizable (while it is selected, say).
|
|
36
|
+
*/
|
|
37
|
+
export declare const NodeResizer: FlowComponent<NodeResizerProps, NodeResizerSlots>;
|
|
38
|
+
/** A corner or a side of a node a `ResizeHandle` moves. */
|
|
39
|
+
type ResizePosition = "top-left" | "top" | "top-right" | "right" | "bottom-right" | "bottom" | "bottom-left" | "left";
|
|
40
|
+
/** Every position, corners then sides. */
|
|
41
|
+
export declare const RESIZE_POSITIONS: readonly ResizePosition[];
|
|
42
|
+
interface ResizeHandleState {
|
|
43
|
+
readonly nodeId: string;
|
|
44
|
+
readonly position: ResizePosition;
|
|
45
|
+
/** its own direction, over its resizer's (`data-direction`); none: the resizer's */
|
|
46
|
+
readonly direction: ResizeHandleDirection | undefined;
|
|
47
|
+
/** how it is drawn (`data-variant`): a corner is always a `handle` */
|
|
48
|
+
readonly variant: ResizeHandleVariant;
|
|
49
|
+
}
|
|
50
|
+
interface ResizeHandleProps extends PrimitiveProps {
|
|
51
|
+
/** the corner or side it moves */
|
|
52
|
+
position: ResizePosition;
|
|
53
|
+
/** its node; default the enclosing `Flow.Node`'s */
|
|
54
|
+
nodeId?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* the sides it moves, over its resizer's `direction` (`data-direction`): `"horizontal"` only
|
|
57
|
+
* the width (and x), `"vertical"` only the height (and y); default the resizer's
|
|
58
|
+
*/
|
|
59
|
+
direction?: ResizeHandleDirection | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* how it is drawn (`data-variant`, for your styles): `"handle"` (default) or `"line"`, a
|
|
62
|
+
* side's whole length; a corner's `"line"` is ignored
|
|
63
|
+
*/
|
|
64
|
+
variant?: ResizeHandleVariant | undefined;
|
|
65
|
+
}
|
|
66
|
+
interface ResizeHandleSlots extends RenderSlot<ResizeHandleState> {
|
|
67
|
+
default?: SlotFunction<{
|
|
68
|
+
state: ResizeHandleState;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A grab area of a `NodeResizer` (`data-flow-part="resize-handle"`, `data-position`): a press on
|
|
73
|
+
* it resizes its node from that corner or side (`resize()`); with `keyboard()` too it takes focus
|
|
74
|
+
* and the arrows move that corner or side. Placed on its corner (centred) or
|
|
75
|
+
* along its side; give it its size (a side's thickness) and look. Its `direction` overrides its
|
|
76
|
+
* resizer's; `variant="line"` marks a side's handle as a line for your styles.
|
|
77
|
+
*/
|
|
78
|
+
export declare const ResizeHandle: FlowComponent<ResizeHandleProps, ResizeHandleSlots>;
|
|
79
|
+
export type { NodeResizerProps, NodeResizerSlots, NodeResizerState, ResizeHandleProps, ResizeHandleSlots, ResizeHandleState, ResizePosition };
|
|
80
|
+
//# sourceMappingURL=resize.d.ts.map
|
package/dist/resize.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { C as usePartNodeId, S as useFlowContext, d as useFlowValue, l as sameValue, n as definePrimitive, s as renderElement } from "./primitive-h9jTIEeT.js";
|
|
2
|
+
import { resizeHandleAttributes } from "@fragiola/flow";
|
|
3
|
+
import { h, watchEffect } from "vue";
|
|
4
|
+
export * from "@fragiola/flow/resize";
|
|
5
|
+
// src/resize/resize-handle.ts
|
|
6
|
+
/** Every position, corners then sides. */
|
|
7
|
+
const RESIZE_POSITIONS = Object.freeze([
|
|
8
|
+
"top-left",
|
|
9
|
+
"top-right",
|
|
10
|
+
"bottom-right",
|
|
11
|
+
"bottom-left",
|
|
12
|
+
"top",
|
|
13
|
+
"right",
|
|
14
|
+
"bottom",
|
|
15
|
+
"left"
|
|
16
|
+
]);
|
|
17
|
+
/**
|
|
18
|
+
* Where a handle sits: a corner's centre on the corner, a side's along the side. A corner is above
|
|
19
|
+
* the two sides it joins (`zIndex`), so a press on it resizes both dimensions, whatever the order
|
|
20
|
+
* of the handles.
|
|
21
|
+
*/
|
|
22
|
+
const PLACE = {
|
|
23
|
+
"top-left": {
|
|
24
|
+
top: "0",
|
|
25
|
+
left: "0",
|
|
26
|
+
transform: "translate(-50%, -50%)",
|
|
27
|
+
zIndex: "1"
|
|
28
|
+
},
|
|
29
|
+
"top-right": {
|
|
30
|
+
top: "0",
|
|
31
|
+
left: "100%",
|
|
32
|
+
transform: "translate(-50%, -50%)",
|
|
33
|
+
zIndex: "1"
|
|
34
|
+
},
|
|
35
|
+
"bottom-right": {
|
|
36
|
+
top: "100%",
|
|
37
|
+
left: "100%",
|
|
38
|
+
transform: "translate(-50%, -50%)",
|
|
39
|
+
zIndex: "1"
|
|
40
|
+
},
|
|
41
|
+
"bottom-left": {
|
|
42
|
+
top: "100%",
|
|
43
|
+
left: "0",
|
|
44
|
+
transform: "translate(-50%, -50%)",
|
|
45
|
+
zIndex: "1"
|
|
46
|
+
},
|
|
47
|
+
top: {
|
|
48
|
+
top: "0",
|
|
49
|
+
left: "0",
|
|
50
|
+
width: "100%",
|
|
51
|
+
transform: "translateY(-50%)"
|
|
52
|
+
},
|
|
53
|
+
bottom: {
|
|
54
|
+
top: "100%",
|
|
55
|
+
left: "0",
|
|
56
|
+
width: "100%",
|
|
57
|
+
transform: "translateY(-50%)"
|
|
58
|
+
},
|
|
59
|
+
left: {
|
|
60
|
+
top: "0",
|
|
61
|
+
left: "0",
|
|
62
|
+
height: "100%",
|
|
63
|
+
transform: "translateX(-50%)"
|
|
64
|
+
},
|
|
65
|
+
right: {
|
|
66
|
+
top: "0",
|
|
67
|
+
left: "100%",
|
|
68
|
+
height: "100%",
|
|
69
|
+
transform: "translateX(-50%)"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* A grab area of a `NodeResizer` (`data-flow-part="resize-handle"`, `data-position`): a press on
|
|
74
|
+
* it resizes its node from that corner or side (`resize()`); with `keyboard()` too it takes focus
|
|
75
|
+
* and the arrows move that corner or side. Placed on its corner (centred) or
|
|
76
|
+
* along its side; give it its size (a side's thickness) and look. Its `direction` overrides its
|
|
77
|
+
* resizer's; `variant="line"` marks a side's handle as a line for your styles.
|
|
78
|
+
*/
|
|
79
|
+
const ResizeHandle = definePrimitive("ResizeHandle", [
|
|
80
|
+
"position",
|
|
81
|
+
"nodeId",
|
|
82
|
+
"direction",
|
|
83
|
+
"variant",
|
|
84
|
+
"as"
|
|
85
|
+
], (props, { attrs, slots }) => {
|
|
86
|
+
const nodeId = usePartNodeId("ResizeHandle", () => props.nodeId);
|
|
87
|
+
const context = useFlowContext("ResizeHandle");
|
|
88
|
+
const attributes = useFlowValue(context, () => {
|
|
89
|
+
const engine = context.engine.value;
|
|
90
|
+
const { position, direction, variant } = props;
|
|
91
|
+
return engine ? engine.adapter.attributes("resize-handle", {
|
|
92
|
+
nodeId: nodeId(),
|
|
93
|
+
position,
|
|
94
|
+
direction,
|
|
95
|
+
variant
|
|
96
|
+
}) : resizeHandleAttributes(position, {
|
|
97
|
+
direction,
|
|
98
|
+
variant
|
|
99
|
+
});
|
|
100
|
+
}, sameValue, "entity");
|
|
101
|
+
return () => {
|
|
102
|
+
const own = attributes.value;
|
|
103
|
+
const state = {
|
|
104
|
+
nodeId: nodeId(),
|
|
105
|
+
position: props.position,
|
|
106
|
+
direction: own["data-direction"],
|
|
107
|
+
variant: own["data-variant"]
|
|
108
|
+
};
|
|
109
|
+
return renderElement({
|
|
110
|
+
tag: "div",
|
|
111
|
+
as: props.as,
|
|
112
|
+
attrs,
|
|
113
|
+
render: slots.render,
|
|
114
|
+
state,
|
|
115
|
+
props: { ...own },
|
|
116
|
+
style: {
|
|
117
|
+
position: "absolute",
|
|
118
|
+
pointerEvents: "auto",
|
|
119
|
+
...PLACE[props.position]
|
|
120
|
+
},
|
|
121
|
+
children: () => slots.default?.({ state })
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
// src/resize/node-resizer.ts
|
|
126
|
+
const RESIZER_STYLE = {
|
|
127
|
+
position: "absolute",
|
|
128
|
+
inset: "0",
|
|
129
|
+
pointerEvents: "none"
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A node's resizer (`data-flow-part="resizer"`, `resize()`), inside `Flow.Node`: a box over the
|
|
133
|
+
* node holding its `ResizeHandle`s; its limits are this node's own (`setPartOptions`). Render it
|
|
134
|
+
* only when the node should be resizable (while it is selected, say).
|
|
135
|
+
*/
|
|
136
|
+
const NodeResizer = definePrimitive("NodeResizer", [
|
|
137
|
+
"nodeId",
|
|
138
|
+
"minWidth",
|
|
139
|
+
"minHeight",
|
|
140
|
+
"maxWidth",
|
|
141
|
+
"maxHeight",
|
|
142
|
+
"keepAspectRatio",
|
|
143
|
+
"direction",
|
|
144
|
+
"as"
|
|
145
|
+
], (props, { attrs, slots }) => {
|
|
146
|
+
const nodeId = usePartNodeId("NodeResizer", () => props.nodeId);
|
|
147
|
+
const context = useFlowContext("NodeResizer");
|
|
148
|
+
watchEffect((onCleanup) => {
|
|
149
|
+
const engine = context.engine.value;
|
|
150
|
+
if (!engine) return;
|
|
151
|
+
const id = nodeId();
|
|
152
|
+
const options = Object.fromEntries(Object.entries({
|
|
153
|
+
minWidth: props.minWidth,
|
|
154
|
+
minHeight: props.minHeight,
|
|
155
|
+
maxWidth: props.maxWidth,
|
|
156
|
+
maxHeight: props.maxHeight,
|
|
157
|
+
keepAspectRatio: props.keepAspectRatio,
|
|
158
|
+
direction: props.direction
|
|
159
|
+
}).filter(([, value]) => value !== void 0));
|
|
160
|
+
engine.adapter.setPartOptions("resizer", id, options);
|
|
161
|
+
onCleanup(() => engine.adapter.setPartOptions("resizer", id, null));
|
|
162
|
+
});
|
|
163
|
+
const attributes = useFlowValue(context, () => {
|
|
164
|
+
const engine = context.engine.value;
|
|
165
|
+
const id = nodeId();
|
|
166
|
+
return engine ? engine.adapter.attributes("resizer", { nodeId: id }) : {
|
|
167
|
+
"data-flow-part": "resizer",
|
|
168
|
+
"data-flow-id": id
|
|
169
|
+
};
|
|
170
|
+
}, sameValue, "entity");
|
|
171
|
+
return () => {
|
|
172
|
+
const own = attributes.value;
|
|
173
|
+
const state = {
|
|
174
|
+
nodeId: nodeId(),
|
|
175
|
+
resizing: own["data-resizing"] !== void 0
|
|
176
|
+
};
|
|
177
|
+
return renderElement({
|
|
178
|
+
tag: "div",
|
|
179
|
+
as: props.as,
|
|
180
|
+
attrs,
|
|
181
|
+
render: slots.render,
|
|
182
|
+
state,
|
|
183
|
+
props: { ...own },
|
|
184
|
+
style: RESIZER_STYLE,
|
|
185
|
+
children: () => slots.default ? slots.default({ state }) : RESIZE_POSITIONS.map((position) => h(ResizeHandle, {
|
|
186
|
+
key: position,
|
|
187
|
+
position,
|
|
188
|
+
nodeId: state.nodeId
|
|
189
|
+
}))
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
}, { booleans: ["keepAspectRatio"] });
|
|
193
|
+
export { NodeResizer, RESIZE_POSITIONS, ResizeHandle };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=resize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize.js","names":[],"sources":["../src/resize/resize-handle.ts","../src/resize/node-resizer.ts"],"sourcesContent":["import {\n type ResizeHandleDirection,\n type ResizeHandleVariant,\n resizeHandleAttributes,\n} from \"@fragiola/flow\";\nimport { sameValue, useFlowValue } from \"../composables/internal\";\nimport { useFlowContext, usePartNodeId } from \"../context\";\nimport {\n definePrimitive,\n type FlowComponent,\n type PrimitiveProps,\n type SlotFunction,\n} from \"../utils/primitive\";\nimport { type RenderSlot, renderElement } from \"../utils/render\";\n\n/** A corner or a side of a node a `ResizeHandle` moves. */\nexport type ResizePosition =\n | \"top-left\"\n | \"top\"\n | \"top-right\"\n | \"right\"\n | \"bottom-right\"\n | \"bottom\"\n | \"bottom-left\"\n | \"left\";\n\n/** Every position, corners then sides. */\nexport const RESIZE_POSITIONS: readonly ResizePosition[] = Object.freeze([\n \"top-left\",\n \"top-right\",\n \"bottom-right\",\n \"bottom-left\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\nexport interface ResizeHandleState {\n readonly nodeId: string;\n readonly position: ResizePosition;\n /** its own direction, over its resizer's (`data-direction`); none: the resizer's */\n readonly direction: ResizeHandleDirection | undefined;\n /** how it is drawn (`data-variant`): a corner is always a `handle` */\n readonly variant: ResizeHandleVariant;\n}\n\nexport interface ResizeHandleProps extends PrimitiveProps {\n /** the corner or side it moves */\n position: ResizePosition;\n /** its node; default the enclosing `Flow.Node`'s */\n nodeId?: string | undefined;\n /**\n * the sides it moves, over its resizer's `direction` (`data-direction`): `\"horizontal\"` only\n * the width (and x), `\"vertical\"` only the height (and y); default the resizer's\n */\n direction?: ResizeHandleDirection | undefined;\n /**\n * how it is drawn (`data-variant`, for your styles): `\"handle\"` (default) or `\"line\"`, a\n * side's whole length; a corner's `\"line\"` is ignored\n */\n variant?: ResizeHandleVariant | undefined;\n}\n\nexport interface ResizeHandleSlots extends RenderSlot<ResizeHandleState> {\n default?: SlotFunction<{ state: ResizeHandleState }>;\n}\n\n/**\n * Where a handle sits: a corner's centre on the corner, a side's along the side. A corner is above\n * the two sides it joins (`zIndex`), so a press on it resizes both dimensions, whatever the order\n * of the handles.\n */\nconst PLACE: Record<ResizePosition, Record<string, string>> = {\n \"top-left\": {\n top: \"0\",\n left: \"0\",\n transform: \"translate(-50%, -50%)\",\n zIndex: \"1\",\n },\n \"top-right\": {\n top: \"0\",\n left: \"100%\",\n transform: \"translate(-50%, -50%)\",\n zIndex: \"1\",\n },\n \"bottom-right\": {\n top: \"100%\",\n left: \"100%\",\n transform: \"translate(-50%, -50%)\",\n zIndex: \"1\",\n },\n \"bottom-left\": {\n top: \"100%\",\n left: \"0\",\n transform: \"translate(-50%, -50%)\",\n zIndex: \"1\",\n },\n top: { top: \"0\", left: \"0\", width: \"100%\", transform: \"translateY(-50%)\" },\n bottom: {\n top: \"100%\",\n left: \"0\",\n width: \"100%\",\n transform: \"translateY(-50%)\",\n },\n left: {\n top: \"0\",\n left: \"0\",\n height: \"100%\",\n transform: \"translateX(-50%)\",\n },\n right: {\n top: \"0\",\n left: \"100%\",\n height: \"100%\",\n transform: \"translateX(-50%)\",\n },\n};\n\n/**\n * A grab area of a `NodeResizer` (`data-flow-part=\"resize-handle\"`, `data-position`): a press on\n * it resizes its node from that corner or side (`resize()`); with `keyboard()` too it takes focus\n * and the arrows move that corner or side. Placed on its corner (centred) or\n * along its side; give it its size (a side's thickness) and look. Its `direction` overrides its\n * resizer's; `variant=\"line\"` marks a side's handle as a line for your styles.\n */\nexport const ResizeHandle: FlowComponent<ResizeHandleProps, ResizeHandleSlots> =\n definePrimitive<ResizeHandleProps, ResizeHandleSlots>(\n \"ResizeHandle\",\n [\"position\", \"nodeId\", \"direction\", \"variant\", \"as\"],\n (props, { attrs, slots }) => {\n const nodeId = usePartNodeId(\"ResizeHandle\", () => props.nodeId);\n const context = useFlowContext(\"ResizeHandle\");\n // the engine's record: `data-position`, `data-variant`, `data-direction`, and\n // `tabindex` with `keyboard()` (arrows resize)\n const attributes = useFlowValue(\n context,\n () => {\n const engine = context.engine.value;\n const { position, direction, variant } = props;\n return engine\n ? engine.adapter.attributes(\"resize-handle\", {\n nodeId: nodeId(),\n position,\n direction,\n variant,\n })\n : resizeHandleAttributes(position, {\n direction,\n variant,\n });\n },\n sameValue,\n \"entity\",\n );\n return () => {\n const own = attributes.value;\n const state: ResizeHandleState = {\n nodeId: nodeId(),\n position: props.position,\n direction: own[\"data-direction\"] as\n | ResizeHandleDirection\n | undefined,\n variant: own[\"data-variant\"] as ResizeHandleVariant,\n };\n return renderElement({\n tag: \"div\",\n as: props.as,\n attrs,\n render: slots.render,\n state,\n props: { ...own },\n style: {\n position: \"absolute\",\n pointerEvents: \"auto\",\n ...PLACE[props.position],\n },\n children: () => slots.default?.({ state }),\n });\n };\n },\n );\n","import type { ResizeDirection } from \"@fragiola/flow/resize\";\nimport { h, watchEffect } from \"vue\";\nimport { sameValue, useFlowValue } from \"../composables/internal\";\nimport { useFlowContext, usePartNodeId } from \"../context\";\nimport {\n definePrimitive,\n type FlowComponent,\n type PrimitiveProps,\n type SlotFunction,\n} from \"../utils/primitive\";\nimport { type RenderSlot, renderElement } from \"../utils/render\";\nimport { RESIZE_POSITIONS, ResizeHandle } from \"./resize-handle\";\n\nexport interface NodeResizerState {\n readonly nodeId: string;\n /** its node is being resized: `data-resizing` */\n readonly resizing: boolean;\n}\n\nexport interface NodeResizerProps extends PrimitiveProps {\n /** its node; default the enclosing `Flow.Node`'s */\n nodeId?: string | undefined;\n /** this node's limits, over `resize()`'s (in flow units) */\n minWidth?: number | undefined;\n minHeight?: number | undefined;\n maxWidth?: number | undefined;\n maxHeight?: number | undefined;\n /** this node keeps its aspect ratio, over `resize()`'s */\n keepAspectRatio?: boolean | undefined;\n /**\n * the sides its handles move: `\"horizontal\"` only the width (and x), `\"vertical\"` only the\n * height (and y); default both. A corner then moves its one dimension\n */\n direction?: ResizeDirection | undefined;\n}\n\nexport interface NodeResizerSlots extends RenderSlot<NodeResizerState> {\n /** its handles; default a `ResizeHandle` at each corner and side */\n default?: SlotFunction<{ state: NodeResizerState }>;\n}\n\nconst RESIZER_STYLE = {\n position: \"absolute\",\n inset: \"0\",\n pointerEvents: \"none\",\n};\n\n/**\n * A node's resizer (`data-flow-part=\"resizer\"`, `resize()`), inside `Flow.Node`: a box over the\n * node holding its `ResizeHandle`s; its limits are this node's own (`setPartOptions`). Render it\n * only when the node should be resizable (while it is selected, say).\n */\nexport const NodeResizer: FlowComponent<NodeResizerProps, NodeResizerSlots> =\n definePrimitive<NodeResizerProps, NodeResizerSlots>(\n \"NodeResizer\",\n [\n \"nodeId\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"keepAspectRatio\",\n \"direction\",\n \"as\",\n ],\n (props, { attrs, slots }) => {\n const nodeId = usePartNodeId(\"NodeResizer\", () => props.nodeId);\n const context = useFlowContext(\"NodeResizer\");\n // this node's limits, set again when one changes, cleared when the resizer goes\n watchEffect((onCleanup) => {\n const engine = context.engine.value;\n if (!engine) return;\n const id = nodeId();\n const options = Object.fromEntries(\n Object.entries({\n minWidth: props.minWidth,\n minHeight: props.minHeight,\n maxWidth: props.maxWidth,\n maxHeight: props.maxHeight,\n keepAspectRatio: props.keepAspectRatio,\n direction: props.direction,\n }).filter(([, value]) => value !== undefined),\n );\n engine.adapter.setPartOptions(\"resizer\", id, options);\n onCleanup(() =>\n engine.adapter.setPartOptions(\"resizer\", id, null),\n );\n });\n const attributes = useFlowValue(\n context,\n () => {\n const engine = context.engine.value;\n const id = nodeId();\n return engine\n ? engine.adapter.attributes(\"resizer\", { nodeId: id })\n : { \"data-flow-part\": \"resizer\", \"data-flow-id\": id };\n },\n sameValue,\n \"entity\",\n );\n return () => {\n const own = attributes.value;\n const state: NodeResizerState = {\n nodeId: nodeId(),\n resizing: own[\"data-resizing\"] !== undefined,\n };\n return renderElement({\n tag: \"div\",\n as: props.as,\n attrs,\n render: slots.render,\n state,\n props: { ...own },\n style: RESIZER_STYLE,\n children: () =>\n slots.default\n ? slots.default({ state })\n : RESIZE_POSITIONS.map((position) =>\n h(ResizeHandle, {\n key: position,\n position,\n nodeId: state.nodeId,\n }),\n ),\n });\n };\n },\n { booleans: [\"keepAspectRatio\"] },\n );\n"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@fragiola/flow/selection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@fragiola/flow/selection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@fragiola/flow/subflows";
|
package/dist/subflows.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@fragiola/flow/subflows";
|
package/package.json
CHANGED
|
@@ -1,6 +1,104 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragiola/flow-vue",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Composable, unstyled Vue primitives for @fragiola/flow: node-based editors and diagrams (nodes, edges, handles, connections, a pannable and zoomable viewport) styled entirely by you.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vue",
|
|
7
|
+
"flow",
|
|
8
|
+
"node-editor",
|
|
9
|
+
"diagram",
|
|
10
|
+
"graph",
|
|
11
|
+
"headless"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Mauro de Souza",
|
|
17
|
+
"email": "maurodesouza.me@gmail.com",
|
|
18
|
+
"url": "https://github.com/maurodesouza"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/fragiola/flow.git",
|
|
23
|
+
"directory": "packages/vue"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://fragiola.com/flow",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/fragiola/flow/issues"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./selection": {
|
|
37
|
+
"types": "./dist/selection.d.ts",
|
|
38
|
+
"import": "./dist/selection.js",
|
|
39
|
+
"default": "./dist/selection.js"
|
|
40
|
+
},
|
|
41
|
+
"./subflows": {
|
|
42
|
+
"types": "./dist/subflows.d.ts",
|
|
43
|
+
"import": "./dist/subflows.js",
|
|
44
|
+
"default": "./dist/subflows.js"
|
|
45
|
+
},
|
|
46
|
+
"./drag": {
|
|
47
|
+
"types": "./dist/drag.d.ts",
|
|
48
|
+
"import": "./dist/drag.js",
|
|
49
|
+
"default": "./dist/drag.js"
|
|
50
|
+
},
|
|
51
|
+
"./resize": {
|
|
52
|
+
"types": "./dist/resize.d.ts",
|
|
53
|
+
"import": "./dist/resize.js",
|
|
54
|
+
"default": "./dist/resize.js"
|
|
55
|
+
},
|
|
56
|
+
"./connection": {
|
|
57
|
+
"types": "./dist/connection.d.ts",
|
|
58
|
+
"import": "./dist/connection.js",
|
|
59
|
+
"default": "./dist/connection.js"
|
|
60
|
+
},
|
|
61
|
+
"./reconnection": {
|
|
62
|
+
"types": "./dist/reconnection.d.ts",
|
|
63
|
+
"import": "./dist/reconnection.js",
|
|
64
|
+
"default": "./dist/reconnection.js"
|
|
65
|
+
},
|
|
66
|
+
"./keyboard": {
|
|
67
|
+
"types": "./dist/keyboard.d.ts",
|
|
68
|
+
"import": "./dist/keyboard.js",
|
|
69
|
+
"default": "./dist/keyboard.js"
|
|
70
|
+
},
|
|
71
|
+
"./minimap": {
|
|
72
|
+
"types": "./dist/minimap.d.ts",
|
|
73
|
+
"import": "./dist/minimap.js",
|
|
74
|
+
"default": "./dist/minimap.js"
|
|
75
|
+
},
|
|
76
|
+
"./package.json": "./package.json"
|
|
77
|
+
},
|
|
78
|
+
"files": [
|
|
79
|
+
"dist",
|
|
80
|
+
"README.md",
|
|
81
|
+
"LICENSE"
|
|
82
|
+
],
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"@fragiola/flow": "0.0.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"vue": "^3.5.0"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@testing-library/jest-dom": "7.0.1",
|
|
91
|
+
"@vue/test-utils": "2.5.1",
|
|
92
|
+
"jsdom": "30.1.1",
|
|
93
|
+
"tsdown": "0.23.0",
|
|
94
|
+
"typescript": "7.0.2",
|
|
95
|
+
"vite": "8.3.1",
|
|
96
|
+
"vitest": "5.0.2",
|
|
97
|
+
"vue": "3.5.45"
|
|
98
|
+
},
|
|
99
|
+
"scripts": {
|
|
100
|
+
"build": "tsdown",
|
|
101
|
+
"typecheck": "tsc --noEmit",
|
|
102
|
+
"test": "vitest run"
|
|
103
|
+
}
|
|
6
104
|
}
|