@fragiola/flow-angular 0.0.0-stage → 0.1.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.
@@ -0,0 +1,437 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Directive, computed, effect, input } from "@angular/core";
3
+ import { ɵbeforeInputs, ɵbindAttributes, ɵbindStructuralStyle, ɵdefaultContent, ɵflowValue, ɵinjectFlowContext, ɵinjectHost, ɵinjectNodeContext, ɵoptionalBoolean, ɵoptionalNumber, ɵpartOwnerId } from "@fragiola/flow-angular";
4
+ import { resizeHandleAttributes } from "@fragiola/flow";
5
+ export * from "@fragiola/flow/resize";
6
+ const RESIZE_POSITIONS = Object.freeze([
7
+ "top-left",
8
+ "top-right",
9
+ "bottom-right",
10
+ "bottom-left",
11
+ "top",
12
+ "right",
13
+ "bottom",
14
+ "left"
15
+ ]);
16
+ const PLACE = {
17
+ "top-left": {
18
+ top: 0,
19
+ left: 0,
20
+ transform: "translate(-50%, -50%)",
21
+ zIndex: 1
22
+ },
23
+ "top-right": {
24
+ top: 0,
25
+ left: "100%",
26
+ transform: "translate(-50%, -50%)",
27
+ zIndex: 1
28
+ },
29
+ "bottom-right": {
30
+ top: "100%",
31
+ left: "100%",
32
+ transform: "translate(-50%, -50%)",
33
+ zIndex: 1
34
+ },
35
+ "bottom-left": {
36
+ top: "100%",
37
+ left: 0,
38
+ transform: "translate(-50%, -50%)",
39
+ zIndex: 1
40
+ },
41
+ top: {
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ transform: "translateY(-50%)"
46
+ },
47
+ bottom: {
48
+ top: "100%",
49
+ left: 0,
50
+ width: "100%",
51
+ transform: "translateY(-50%)"
52
+ },
53
+ left: {
54
+ top: 0,
55
+ left: 0,
56
+ height: "100%",
57
+ transform: "translateX(-50%)"
58
+ },
59
+ right: {
60
+ top: 0,
61
+ left: "100%",
62
+ height: "100%",
63
+ transform: "translateX(-50%)"
64
+ }
65
+ };
66
+ function bindResizeHandle(element, context, nodeId, position, look = () => ({})) {
67
+ const attributes = ɵflowValue(context, () => {
68
+ const id = nodeId();
69
+ const at = position();
70
+ const { direction, variant } = look();
71
+ const engine = context.engine();
72
+ return engine && id !== void 0 && at !== void 0 ? engine.adapter.attributes("resize-handle", {
73
+ nodeId: id,
74
+ position: at,
75
+ direction,
76
+ variant
77
+ }) : resizeHandleAttributes(at, {
78
+ direction,
79
+ variant
80
+ });
81
+ }, void 0, { scope: "entity" });
82
+ ɵbindAttributes(element, attributes);
83
+ ɵbindStructuralStyle(element, () => {
84
+ const at = position();
85
+ return {
86
+ position: "absolute",
87
+ pointerEvents: "auto",
88
+ ...at ? PLACE[at] : {}
89
+ };
90
+ });
91
+ }
92
+ var FlowResizeHandleDirective = class FlowResizeHandleDirective {
93
+ constructor() {
94
+ this.position = input.required(...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
95
+ this.nodeId = input(void 0, ...ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []);
96
+ this.direction = input(void 0, ...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
97
+ this.variant = input(void 0, ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
98
+ this.id = ɵpartOwnerId("[flowResizeHandle]", this.nodeId, ɵinjectNodeContext(), "node");
99
+ this.at = computed(() => ɵbeforeInputs(void 0, this.position), ...ngDevMode ? [{ debugName: "at" }] : /* istanbul ignore next */ []);
100
+ this.look = computed(() => ({
101
+ direction: this.direction(),
102
+ variant: this.variant()
103
+ }), ...ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []);
104
+ this.state = computed(() => {
105
+ const nodeId = this.id();
106
+ const position = this.at();
107
+ if (nodeId === void 0 || position === void 0) return void 0;
108
+ const own = resizeHandleAttributes(position, this.look());
109
+ return {
110
+ nodeId,
111
+ position,
112
+ direction: own["data-direction"],
113
+ variant: own["data-variant"]
114
+ };
115
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
116
+ bindResizeHandle(ɵinjectHost(), ɵinjectFlowContext("[flowResizeHandle]"), this.id, this.at, this.look);
117
+ }
118
+ static {
119
+ this.ɵfac = i0.ɵɵngDeclareFactory({
120
+ minVersion: "12.0.0",
121
+ version: "22.2.5",
122
+ ngImport: i0,
123
+ type: FlowResizeHandleDirective,
124
+ deps: [],
125
+ target: i0.ɵɵFactoryTarget.Directive
126
+ });
127
+ }
128
+ static {
129
+ this.ɵdir = i0.ɵɵngDeclareDirective({
130
+ minVersion: "17.1.0",
131
+ version: "22.2.5",
132
+ type: FlowResizeHandleDirective,
133
+ isStandalone: true,
134
+ selector: "[flowResizeHandle]",
135
+ inputs: {
136
+ position: {
137
+ classPropertyName: "position",
138
+ publicName: "position",
139
+ isSignal: true,
140
+ isRequired: true,
141
+ transformFunction: null
142
+ },
143
+ nodeId: {
144
+ classPropertyName: "nodeId",
145
+ publicName: "nodeId",
146
+ isSignal: true,
147
+ isRequired: false,
148
+ transformFunction: null
149
+ },
150
+ direction: {
151
+ classPropertyName: "direction",
152
+ publicName: "direction",
153
+ isSignal: true,
154
+ isRequired: false,
155
+ transformFunction: null
156
+ },
157
+ variant: {
158
+ classPropertyName: "variant",
159
+ publicName: "variant",
160
+ isSignal: true,
161
+ isRequired: false,
162
+ transformFunction: null
163
+ }
164
+ },
165
+ exportAs: ["flowResizeHandle"],
166
+ ngImport: i0
167
+ });
168
+ }
169
+ };
170
+ i0.ɵɵngDeclareClassMetadata({
171
+ minVersion: "12.0.0",
172
+ version: "22.2.5",
173
+ ngImport: i0,
174
+ type: FlowResizeHandleDirective,
175
+ decorators: [{
176
+ type: Directive,
177
+ args: [{
178
+ selector: "[flowResizeHandle]",
179
+ exportAs: "flowResizeHandle"
180
+ }]
181
+ }],
182
+ ctorParameters: () => [],
183
+ propDecorators: {
184
+ position: [{
185
+ type: i0.Input,
186
+ args: [{
187
+ isSignal: true,
188
+ alias: "position",
189
+ required: true
190
+ }]
191
+ }],
192
+ nodeId: [{
193
+ type: i0.Input,
194
+ args: [{
195
+ isSignal: true,
196
+ alias: "nodeId",
197
+ required: false
198
+ }]
199
+ }],
200
+ direction: [{
201
+ type: i0.Input,
202
+ args: [{
203
+ isSignal: true,
204
+ alias: "direction",
205
+ required: false
206
+ }]
207
+ }],
208
+ variant: [{
209
+ type: i0.Input,
210
+ args: [{
211
+ isSignal: true,
212
+ alias: "variant",
213
+ required: false
214
+ }]
215
+ }]
216
+ }
217
+ });
218
+ var FlowNodeResizerDirective = class FlowNodeResizerDirective {
219
+ constructor() {
220
+ this.nodeId = input(void 0, ...ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []);
221
+ this.minWidth = input(void 0, {
222
+ ...ngDevMode ? { debugName: "minWidth" } : /* istanbul ignore next */ {},
223
+ transform: ɵoptionalNumber
224
+ });
225
+ this.minHeight = input(void 0, {
226
+ ...ngDevMode ? { debugName: "minHeight" } : /* istanbul ignore next */ {},
227
+ transform: ɵoptionalNumber
228
+ });
229
+ this.maxWidth = input(void 0, {
230
+ ...ngDevMode ? { debugName: "maxWidth" } : /* istanbul ignore next */ {},
231
+ transform: ɵoptionalNumber
232
+ });
233
+ this.maxHeight = input(void 0, {
234
+ ...ngDevMode ? { debugName: "maxHeight" } : /* istanbul ignore next */ {},
235
+ transform: ɵoptionalNumber
236
+ });
237
+ this.keepAspectRatio = input(void 0, {
238
+ ...ngDevMode ? { debugName: "keepAspectRatio" } : /* istanbul ignore next */ {},
239
+ transform: ɵoptionalBoolean
240
+ });
241
+ this.direction = input(void 0, ...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
242
+ this.context = ɵinjectFlowContext("[flowNodeResizer]");
243
+ this.id = ɵpartOwnerId("[flowNodeResizer]", this.nodeId, ɵinjectNodeContext(), "node");
244
+ this.attributes = ɵflowValue(this.context, () => {
245
+ const nodeId = this.id();
246
+ if (nodeId === void 0) return void 0;
247
+ const engine = this.context.engine();
248
+ return engine ? engine.adapter.attributes("resizer", { nodeId }) : {
249
+ "data-flow-part": "resizer",
250
+ "data-flow-id": nodeId
251
+ };
252
+ }, void 0, { scope: "entity" });
253
+ this.state = computed(() => {
254
+ const nodeId = this.id();
255
+ const attributes = this.attributes();
256
+ return nodeId === void 0 || !attributes ? void 0 : {
257
+ nodeId,
258
+ resizing: attributes["data-resizing"] !== void 0
259
+ };
260
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
261
+ const host = ɵinjectHost();
262
+ ɵbindAttributes(host, () => this.attributes() ?? {});
263
+ ɵbindStructuralStyle(host, () => ({
264
+ position: "absolute",
265
+ inset: 0,
266
+ pointerEvents: "none"
267
+ }));
268
+ effect((onCleanup) => {
269
+ const engine = this.context.engine();
270
+ const nodeId = this.id();
271
+ if (!engine || nodeId === void 0) return;
272
+ const options = Object.fromEntries(Object.entries({
273
+ minWidth: this.minWidth(),
274
+ minHeight: this.minHeight(),
275
+ maxWidth: this.maxWidth(),
276
+ maxHeight: this.maxHeight(),
277
+ keepAspectRatio: this.keepAspectRatio(),
278
+ direction: this.direction()
279
+ }).filter(([, value]) => value !== void 0));
280
+ engine.adapter.setPartOptions("resizer", nodeId, options);
281
+ onCleanup(() => engine.adapter.setPartOptions("resizer", nodeId, null));
282
+ });
283
+ ɵdefaultContent(host, (document) => RESIZE_POSITIONS.map((position) => {
284
+ const handle = document.createElement("div");
285
+ bindResizeHandle(handle, this.context, this.id, () => position);
286
+ return handle;
287
+ }));
288
+ }
289
+ static {
290
+ this.ɵfac = i0.ɵɵngDeclareFactory({
291
+ minVersion: "12.0.0",
292
+ version: "22.2.5",
293
+ ngImport: i0,
294
+ type: FlowNodeResizerDirective,
295
+ deps: [],
296
+ target: i0.ɵɵFactoryTarget.Directive
297
+ });
298
+ }
299
+ static {
300
+ this.ɵdir = i0.ɵɵngDeclareDirective({
301
+ minVersion: "17.1.0",
302
+ version: "22.2.5",
303
+ type: FlowNodeResizerDirective,
304
+ isStandalone: true,
305
+ selector: "[flowNodeResizer]",
306
+ inputs: {
307
+ nodeId: {
308
+ classPropertyName: "nodeId",
309
+ publicName: "nodeId",
310
+ isSignal: true,
311
+ isRequired: false,
312
+ transformFunction: null
313
+ },
314
+ minWidth: {
315
+ classPropertyName: "minWidth",
316
+ publicName: "minWidth",
317
+ isSignal: true,
318
+ isRequired: false,
319
+ transformFunction: null
320
+ },
321
+ minHeight: {
322
+ classPropertyName: "minHeight",
323
+ publicName: "minHeight",
324
+ isSignal: true,
325
+ isRequired: false,
326
+ transformFunction: null
327
+ },
328
+ maxWidth: {
329
+ classPropertyName: "maxWidth",
330
+ publicName: "maxWidth",
331
+ isSignal: true,
332
+ isRequired: false,
333
+ transformFunction: null
334
+ },
335
+ maxHeight: {
336
+ classPropertyName: "maxHeight",
337
+ publicName: "maxHeight",
338
+ isSignal: true,
339
+ isRequired: false,
340
+ transformFunction: null
341
+ },
342
+ keepAspectRatio: {
343
+ classPropertyName: "keepAspectRatio",
344
+ publicName: "keepAspectRatio",
345
+ isSignal: true,
346
+ isRequired: false,
347
+ transformFunction: null
348
+ },
349
+ direction: {
350
+ classPropertyName: "direction",
351
+ publicName: "direction",
352
+ isSignal: true,
353
+ isRequired: false,
354
+ transformFunction: null
355
+ }
356
+ },
357
+ exportAs: ["flowNodeResizer"],
358
+ ngImport: i0
359
+ });
360
+ }
361
+ };
362
+ i0.ɵɵngDeclareClassMetadata({
363
+ minVersion: "12.0.0",
364
+ version: "22.2.5",
365
+ ngImport: i0,
366
+ type: FlowNodeResizerDirective,
367
+ decorators: [{
368
+ type: Directive,
369
+ args: [{
370
+ selector: "[flowNodeResizer]",
371
+ exportAs: "flowNodeResizer"
372
+ }]
373
+ }],
374
+ ctorParameters: () => [],
375
+ propDecorators: {
376
+ nodeId: [{
377
+ type: i0.Input,
378
+ args: [{
379
+ isSignal: true,
380
+ alias: "nodeId",
381
+ required: false
382
+ }]
383
+ }],
384
+ minWidth: [{
385
+ type: i0.Input,
386
+ args: [{
387
+ isSignal: true,
388
+ alias: "minWidth",
389
+ required: false
390
+ }]
391
+ }],
392
+ minHeight: [{
393
+ type: i0.Input,
394
+ args: [{
395
+ isSignal: true,
396
+ alias: "minHeight",
397
+ required: false
398
+ }]
399
+ }],
400
+ maxWidth: [{
401
+ type: i0.Input,
402
+ args: [{
403
+ isSignal: true,
404
+ alias: "maxWidth",
405
+ required: false
406
+ }]
407
+ }],
408
+ maxHeight: [{
409
+ type: i0.Input,
410
+ args: [{
411
+ isSignal: true,
412
+ alias: "maxHeight",
413
+ required: false
414
+ }]
415
+ }],
416
+ keepAspectRatio: [{
417
+ type: i0.Input,
418
+ args: [{
419
+ isSignal: true,
420
+ alias: "keepAspectRatio",
421
+ required: false
422
+ }]
423
+ }],
424
+ direction: [{
425
+ type: i0.Input,
426
+ args: [{
427
+ isSignal: true,
428
+ alias: "direction",
429
+ required: false
430
+ }]
431
+ }]
432
+ }
433
+ });
434
+ const FLOW_RESIZE = [FlowNodeResizerDirective, FlowResizeHandleDirective];
435
+ export { FLOW_RESIZE, FlowNodeResizerDirective, FlowResizeHandleDirective, RESIZE_POSITIONS };
436
+
437
+ //# sourceMappingURL=fragiola-flow-angular-resize.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragiola-flow-angular-resize.mjs","names":["flowValue","partOwnerId","injectNodeContext","beforeInputs","injectHost","injectFlowContext","optionalNumber","optionalBoolean","injectFlowContext","partOwnerId","injectNodeContext","flowValue","injectHost"],"sources":["../../src/resize/resize-handle.directive.ts","../../src/resize/node-resizer.directive.ts","../../src/resize/index.ts"],"sourcesContent":["import { computed, Directive, input, type Signal } from \"@angular/core\";\nimport {\n type ResizeHandleDirection,\n type ResizeHandleVariant,\n resizeHandleAttributes,\n} from \"@fragiola/flow\";\nimport {\n ɵbeforeInputs as beforeInputs,\n ɵbindAttributes as bindAttributes,\n ɵbindStructuralStyle as bindStructuralStyle,\n type ɵFlowContext as FlowContext,\n ɵflowValue as flowValue,\n ɵinjectFlowContext as injectFlowContext,\n ɵinjectHost as injectHost,\n ɵinjectNodeContext as injectNodeContext,\n ɵpartOwnerId as partOwnerId,\n type StructuralStyle,\n} from \"@fragiola/flow-angular\";\n\n/** A corner or a side of a node a resize handle 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\n/** A resize handle's own direction and variant (`bindResizeHandle`). */\nexport interface ResizeHandleLook {\n readonly direction?: ResizeHandleDirection | undefined;\n readonly variant?: ResizeHandleVariant | undefined;\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, StructuralStyle> = {\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: { top: 0, left: 0, height: \"100%\", transform: \"translateX(-50%)\" },\n right: {\n top: 0,\n left: \"100%\",\n height: \"100%\",\n transform: \"translateX(-50%)\",\n },\n};\n\n/**\n * @internal binds a resize handle of the node `nodeId` onto `element`: the engine's record\n * (`data-position`, `data-variant`, `data-direction`, and `tabindex` with `keyboard()`: the\n * arrows resize)\n */\nexport function bindResizeHandle(\n element: HTMLElement,\n context: FlowContext,\n nodeId: () => string | undefined,\n position: () => ResizePosition | undefined,\n look: () => ResizeHandleLook = () => ({}),\n): void {\n const attributes = flowValue(\n context,\n () => {\n const id = nodeId();\n const at = position();\n const { direction, variant } = look();\n const engine = context.engine();\n return engine && id !== undefined && at !== undefined\n ? engine.adapter.attributes(\"resize-handle\", {\n nodeId: id,\n position: at,\n direction,\n variant,\n })\n : resizeHandleAttributes(at, { direction, variant });\n },\n undefined,\n { scope: \"entity\" },\n );\n bindAttributes(element, attributes);\n bindStructuralStyle(element, () => {\n const at = position();\n return {\n position: \"absolute\",\n pointerEvents: \"auto\",\n ...(at ? PLACE[at] : {}),\n };\n });\n}\n\n/**\n * A grab area of a `[flowNodeResizer]` (`data-flow-part=\"resize-handle\"`, `data-position`), on\n * the app's element: `<div flowResizeHandle position=\"bottom-right\">`. A press on it resizes its\n * node from that corner or side (`resize()`); with `keyboard()` too it takes focus and the arrows\n * move that corner or side. Placed on its corner (centred) or along its side; give it its size (a\n * side's thickness) and look. Its `direction` overrides its resizer's; `variant=\"line\"` marks a\n * side's handle as a line for your styles.\n */\n@Directive({ selector: \"[flowResizeHandle]\", exportAs: \"flowResizeHandle\" })\nexport class FlowResizeHandleDirective {\n /** the corner or side it moves */\n readonly position = input.required<ResizePosition>();\n /** its node; default the enclosing `[flowNode]`'s */\n readonly nodeId = input<string | undefined>(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 readonly direction = input<ResizeHandleDirection | undefined>(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 readonly variant = input<ResizeHandleVariant | undefined>(undefined);\n\n private readonly id = partOwnerId(\n \"[flowResizeHandle]\",\n this.nodeId,\n injectNodeContext(),\n \"node\",\n );\n private readonly at = computed(() =>\n beforeInputs(undefined, this.position),\n );\n private readonly look = computed(\n (): ResizeHandleLook => ({\n direction: this.direction(),\n variant: this.variant(),\n }),\n );\n\n /** the handle's state */\n readonly state: Signal<ResizeHandleState | undefined> = computed(() => {\n const nodeId = this.id();\n const position = this.at();\n if (nodeId === undefined || position === undefined) return undefined;\n const own = resizeHandleAttributes(position, this.look());\n return {\n nodeId,\n position,\n direction: own[\"data-direction\"] as\n | ResizeHandleDirection\n | undefined,\n variant: own[\"data-variant\"] as ResizeHandleVariant,\n };\n });\n\n constructor() {\n bindResizeHandle(\n injectHost(),\n injectFlowContext(\"[flowResizeHandle]\"),\n this.id,\n this.at,\n this.look,\n );\n }\n}\n","import { computed, Directive, effect, input, type Signal } from \"@angular/core\";\nimport type { ResizeDirection } from \"@fragiola/flow/resize\";\nimport {\n ɵbindAttributes as bindAttributes,\n ɵbindStructuralStyle as bindStructuralStyle,\n ɵdefaultContent as defaultContent,\n ɵflowValue as flowValue,\n ɵinjectFlowContext as injectFlowContext,\n ɵinjectHost as injectHost,\n ɵinjectNodeContext as injectNodeContext,\n ɵoptionalBoolean as optionalBoolean,\n ɵoptionalNumber as optionalNumber,\n ɵpartOwnerId as partOwnerId,\n} from \"@fragiola/flow-angular\";\nimport { bindResizeHandle, RESIZE_POSITIONS } from \"./resize-handle.directive\";\n\nexport interface NodeResizerState {\n readonly nodeId: string;\n /** its node is being resized: `data-resizing` */\n readonly resizing: boolean;\n}\n\n/**\n * A node's resizer (`data-flow-part=\"resizer\"`, `resize()`), on the app's element inside\n * `[flowNode]`: `<div flowNodeResizer [minWidth]=\"40\">`, a box over the node holding its\n * `[flowResizeHandle]`s (when the app writes none, one at each corner and side); its limits are\n * this node's own (`setPartOptions`). Render it only when the node should be resizable (while it\n * is selected, say).\n */\n@Directive({ selector: \"[flowNodeResizer]\", exportAs: \"flowNodeResizer\" })\nexport class FlowNodeResizerDirective {\n /** its node; default the enclosing `[flowNode]`'s */\n readonly nodeId = input<string | undefined>(undefined);\n /** this node's limits, over `resize()`'s (in flow units) */\n readonly minWidth = input(undefined, { transform: optionalNumber });\n readonly minHeight = input(undefined, { transform: optionalNumber });\n readonly maxWidth = input(undefined, { transform: optionalNumber });\n readonly maxHeight = input(undefined, { transform: optionalNumber });\n /** this node keeps its aspect ratio, over `resize()`'s */\n readonly keepAspectRatio = input(undefined, {\n transform: optionalBoolean,\n });\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 readonly direction = input<ResizeDirection | undefined>(undefined);\n\n private readonly context = injectFlowContext(\"[flowNodeResizer]\");\n private readonly id = partOwnerId(\n \"[flowNodeResizer]\",\n this.nodeId,\n injectNodeContext(),\n \"node\",\n );\n private readonly attributes = flowValue(\n this.context,\n () => {\n const nodeId = this.id();\n if (nodeId === undefined) return undefined;\n const engine = this.context.engine();\n return engine\n ? engine.adapter.attributes(\"resizer\", { nodeId })\n : { \"data-flow-part\": \"resizer\", \"data-flow-id\": nodeId };\n },\n undefined,\n { scope: \"entity\" },\n );\n\n /** the resizer's state */\n readonly state: Signal<NodeResizerState | undefined> = computed(() => {\n const nodeId = this.id();\n const attributes = this.attributes();\n return nodeId === undefined || !attributes\n ? undefined\n : {\n nodeId,\n resizing: attributes[\"data-resizing\"] !== undefined,\n };\n });\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => this.attributes() ?? {});\n bindStructuralStyle(host, () => ({\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n }));\n // this node's limits, while the resizer is there\n effect((onCleanup) => {\n const engine = this.context.engine();\n const nodeId = this.id();\n if (!engine || nodeId === undefined) return;\n const options = Object.fromEntries(\n Object.entries({\n minWidth: this.minWidth(),\n minHeight: this.minHeight(),\n maxWidth: this.maxWidth(),\n maxHeight: this.maxHeight(),\n keepAspectRatio: this.keepAspectRatio(),\n direction: this.direction(),\n }).filter(([, value]) => value !== undefined),\n );\n engine.adapter.setPartOptions(\"resizer\", nodeId, options);\n onCleanup(() =>\n engine.adapter.setPartOptions(\"resizer\", nodeId, null),\n );\n });\n // React's default children: a handle at each corner and side\n defaultContent(host, (document) =>\n RESIZE_POSITIONS.map((position) => {\n const handle = document.createElement(\"div\");\n bindResizeHandle(handle, this.context, this.id, () => position);\n return handle;\n }),\n );\n }\n}\n","// The entry of @fragiola/flow-angular/resize: the core's resize feature (`resize()`) and what\n// draws it: `[flowNodeResizer]`, `[flowResizeHandle]` (`FLOW_RESIZE`). A flow that never imports\n// it does not ship them.\nimport { FlowNodeResizerDirective } from \"./node-resizer.directive\";\nimport { FlowResizeHandleDirective } from \"./resize-handle.directive\";\n\nexport * from \"@fragiola/flow/resize\";\nexport {\n FlowNodeResizerDirective,\n type NodeResizerState,\n} from \"./node-resizer.directive\";\nexport {\n FlowResizeHandleDirective,\n RESIZE_POSITIONS,\n type ResizeHandleState,\n type ResizePosition,\n} from \"./resize-handle.directive\";\n\n/** The resizer's directives, for a standalone component's `imports`. */\nexport const FLOW_RESIZE = [\n FlowNodeResizerDirective,\n FlowResizeHandleDirective,\n] as const;\n"],"mappings":";;;;;AA+BA,MAAa,mBAA8C,OAAO,OAAO;CACrE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACH,CAAA;AAsBD,MAAM,QAAiD;CACnD,YAAY;EACR,KAAK;EACL,MAAM;EACN,WAAW;EACX,QAAQ;CACX;CACD,aAAa;EACT,KAAK;EACL,MAAM;EACN,WAAW;EACX,QAAQ;CACX;CACD,gBAAgB;EACZ,KAAK;EACL,MAAM;EACN,WAAW;EACX,QAAQ;CACX;CACD,eAAe;EACX,KAAK;EACL,MAA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