@formancy/report-builder-react 0.1.0 → 0.2.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/NOTICE +8 -0
- package/README.md +52 -3
- package/dist/index.d.mts +11 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +217 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/NOTICE
CHANGED
|
@@ -7,3 +7,11 @@ This product is distributed under the Formancy Report Source-Available Licence
|
|
|
7
7
|
This product includes software developed by the formancy project
|
|
8
8
|
(https://github.com/sharkysan/formancy.ai), licensed under the Apache License,
|
|
9
9
|
Version 2.0. Those packages keep their licence; nothing here changes it.
|
|
10
|
+
|
|
11
|
+
@formancy/report-render-pdf includes the Liberation Sans fonts, version
|
|
12
|
+
2.1.5, Regular and Bold, in its fonts directory and, as base64, in its
|
|
13
|
+
browser build. Digitized data copyright (c) 2010 Google Corporation, with
|
|
14
|
+
Reserved Font Arimo, Tinos and Cousine. Copyright (c) 2012 Red Hat, Inc.,
|
|
15
|
+
with Reserved Font Name Liberation. They are licensed under the SIL Open
|
|
16
|
+
Font License, Version 1.1, whose text travels with them as
|
|
17
|
+
fonts/LICENSE-LiberationSans.txt; nothing here changes it.
|
package/README.md
CHANGED
|
@@ -45,11 +45,41 @@ geometry. The host imports `workbench.css` from `@formancy/themes`, then
|
|
|
45
45
|
`report-builder.css` from `report-builder-core`, and recolours the builder
|
|
46
46
|
by setting the workbench's `--wb-*` variables.
|
|
47
47
|
|
|
48
|
-
**`ReportBuilder` takes
|
|
48
|
+
**`ReportBuilder` takes the `editor`.** The builder subscribes while
|
|
49
49
|
it is mounted and never disposes the editor. Whoever created the editor
|
|
50
50
|
disposes it, once no builder shows it. Given another editor, the builder
|
|
51
51
|
lets go of the old one and subscribes to the new one.
|
|
52
52
|
|
|
53
|
+
**`hostView` is what it draws in the design view's place** while the
|
|
54
|
+
editor's `view` is the host's: a view of the host's own, which the editor
|
|
55
|
+
was made knowing by name
|
|
56
|
+
([0029](../../docs/decisions/0029-the-preview-stands-in-the-design-views-place-where-it-does-not-fit-beside-the-builder.md)).
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
const editor = createReportEditor(opening.session, { hostView: { name: 'Preview', shown: true } })
|
|
60
|
+
|
|
61
|
+
root.render(<ReportBuilder editor={editor} hostView={<Preview />} />)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The builder lends it the middle pane's box and a region named by the
|
|
65
|
+
editor's `hostView`. No rule of `report-builder.css` reaches it, and of
|
|
66
|
+
the workbench's only `.wb *`, which turns transitions off when motion is
|
|
67
|
+
reduced; none of the builder's keys do either, nor from a portal the host
|
|
68
|
+
opens from it, whose events React bubbles through the view wherever its
|
|
69
|
+
DOM is. It is mounted only while it is drawn: the toolbar's Design view
|
|
70
|
+
unmounts it, and the editor's `showHostView` mounts it again.
|
|
71
|
+
|
|
72
|
+
**Images a person adds need nothing of the builder.** A host that keeps
|
|
73
|
+
them gives the editor its store (`createReportEditor`'s `images`,
|
|
74
|
+
report-builder-core's *Images a person adds*), and the builder draws Add
|
|
75
|
+
image… last in the palette, with a hidden file input beside it, and the
|
|
76
|
+
report's images, each with its Remove, under the report's own properties
|
|
77
|
+
([0033](../../docs/decisions/0033-a-person-adds-an-image-in-either-builder-and-the-host-keeps-its-bytes.md)). Add image… sends `chooseImage` and opens the platform's chooser
|
|
78
|
+
in the same click; the file chosen is taken, the input cleared so the same
|
|
79
|
+
file is a change again, and handed to `editor.addImage`, which says what
|
|
80
|
+
became of it. The keyboard stays on the button; a Remove that removed its
|
|
81
|
+
image puts it on the first field.
|
|
82
|
+
|
|
53
83
|
**`useEditorState(editor)`** is the subscription on its own, for a host
|
|
54
84
|
that shows something of the editor's state outside the builder.
|
|
55
85
|
|
|
@@ -82,8 +112,9 @@ Exactly the structure `report-builder-core`'s README sets out under *What a
|
|
|
82
112
|
builder renders*, which the Angular builder renders too: a region named
|
|
83
113
|
"Report editor" with a bar above the panes (the title and the toolbar,
|
|
84
114
|
with its four pane buttons), the outline pane with the place dialog
|
|
85
|
-
floating over it, the design view
|
|
86
|
-
sharing the third column, and a bar below
|
|
115
|
+
floating over it, the design view -- or the host's view in its place --
|
|
116
|
+
the properties and the problems sharing the third column, and a bar below
|
|
117
|
+
with the live region.
|
|
87
118
|
|
|
88
119
|
## The keyboard
|
|
89
120
|
|
|
@@ -102,10 +133,12 @@ keyboard path came first.
|
|
|
102
133
|
| Anywhere but a text field | Ctrl and +, −, 0 | Zooms in, out, to actual size. |
|
|
103
134
|
| The toolbar | ← →, Home, End | Moves between tools. The toolbar is one tab stop. → is "next" in a left-to-right page and "previous" under `dir="rtl"`; with Ctrl, Alt or ⌘ held the arrow is the browser's. |
|
|
104
135
|
| A palette entry, Move to… | Enter, Space | Opens the place dialog. Focus goes to its first place. |
|
|
136
|
+
| Add image… | Enter, Space | Opens the platform's file chooser. Focus stays on the button while the image is added and after. |
|
|
105
137
|
| The place dialog | Enter on a place | Inserts or moves there. Focus goes to the row. |
|
|
106
138
|
| The place dialog | Escape, Cancel | Closes it. Focus goes back to what opened it; for a dialog another builder over the same editor opened, to the palette entry of what is placed, else the selected row, else the tree. |
|
|
107
139
|
| A single-line field | Enter | Commits the value, and stays in the field. |
|
|
108
140
|
| A text field | Escape | Gives back what the report holds. |
|
|
141
|
+
| The host's view | Any | The host's, and a portal's the host opens from it. The builder passes none of them on, so Ctrl+Z there undoes nothing of the report. |
|
|
109
142
|
|
|
110
143
|
The keys in the outline and the editor's shortcuts are `actionForKey`'s,
|
|
111
144
|
decided in `report-builder-core` for both builders. A text field, a
|
|
@@ -183,7 +216,23 @@ jsdom with Testing Library and user-event:
|
|
|
183
216
|
way out, the panes, a text field's own keys, every pointer drag above,
|
|
184
217
|
the pointer read inside the sheet's border, and the keyboard kept on a
|
|
185
218
|
problem when another is listed before it.
|
|
219
|
+
- **Images**: `image-chooser.test.tsx` gives the file input `files` and a
|
|
220
|
+
`value` that behave as a browser's, where clearing the value empties the
|
|
221
|
+
files, and holds the file taken before the input is cleared, the input
|
|
222
|
+
cleared, a chooser closed without a file doing nothing, the keyboard on
|
|
223
|
+
Add image… while an image is added and after, Enter and Space opening
|
|
224
|
+
the chooser, no chooser where the editor takes no file, nothing drawn
|
|
225
|
+
without a store, and the host's types offered. `properties.test.tsx`
|
|
226
|
+
holds the image rows. These, and the scenarios' `upload`, find the file
|
|
227
|
+
input beside the button in the DOM: it has no role.
|
|
186
228
|
- **One session, many builders**, as above.
|
|
229
|
+
- **The host's view**: a bare region in the design view's place, with the
|
|
230
|
+
middle pane's `data-pane`, its own part, no workbench class and only the
|
|
231
|
+
host's node in it, which is mounted while the region is drawn and
|
|
232
|
+
unmounted with it; and a key pressed in a portal the host opens from it,
|
|
233
|
+
Ctrl+Z on a menu in the body, undoes nothing. That test reads the DOM,
|
|
234
|
+
because which rules reach the host's view is a stylesheet's reach, which
|
|
235
|
+
the accessibility tree cannot show.
|
|
187
236
|
|
|
188
237
|
Each guard was watched failing with the code it guards removed. Among
|
|
189
238
|
them: the subscription left behind on unmount, ids shared between two
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { EditorState, ReportEditor } from "@formancy/report-builder-core";
|
|
3
3
|
//#region src/report-builder.d.ts
|
|
4
4
|
interface ReportBuilderProps {
|
|
@@ -8,8 +8,17 @@ interface ReportBuilderProps {
|
|
|
8
8
|
* whoever created it does, once no builder shows it.
|
|
9
9
|
*/
|
|
10
10
|
readonly editor: ReportEditor;
|
|
11
|
+
/**
|
|
12
|
+
* What the builder draws in the design view's place while the editor's
|
|
13
|
+
* `view` is the host's: the host's own view, named by the editor's
|
|
14
|
+
* `hostView`. The builder lends it the middle pane's box and a region's
|
|
15
|
+
* name, none of report-builder.css's rules -- the workbench's `.wb *`
|
|
16
|
+
* reaches it, turning transitions off under reduced motion -- and none of
|
|
17
|
+
* its keys; it is mounted only while drawn.
|
|
18
|
+
*/
|
|
19
|
+
readonly hostView?: ReactNode;
|
|
11
20
|
}
|
|
12
|
-
export declare function ReportBuilder({ editor }: ReportBuilderProps): ReactElement;
|
|
21
|
+
export declare function ReportBuilder({ editor, hostView }: ReportBuilderProps): ReactElement;
|
|
13
22
|
//#endregion
|
|
14
23
|
//#region src/use-editor-state.d.ts
|
|
15
24
|
/** Re-renders the component on every change to `editor`'s state; unsubscribes when it unmounts or the editor is replaced. */
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/report-builder.tsx","../src/use-editor-state.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/report-builder.tsx","../src/use-editor-state.ts"],"mappings":";;;UA4CiB;;;;;;WAMN,QAAQ;;;;;;;;;WASR,WAAW;;wBAgBN,gBAAgB,QAAQ,YAAY,qBAAqB;;;;wBC7DzD,eAAe,QAAQ,eAAe"}
|
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,16 @@ function Canvas({ state, t, canvas: canvasRef, sheet: sheetRef, drag, select })
|
|
|
105
105
|
children: box.problems
|
|
106
106
|
}) : null]
|
|
107
107
|
}, box.key)),
|
|
108
|
+
canvas.paymentPart === null ? null : /* @__PURE__ */ jsx("div", {
|
|
109
|
+
role: "img",
|
|
110
|
+
"aria-label": canvas.paymentPart.label,
|
|
111
|
+
"data-report-part": "payment-part",
|
|
112
|
+
style: placed(canvas.paymentPart.px),
|
|
113
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
114
|
+
"data-report-part": "region-label",
|
|
115
|
+
children: canvas.paymentPart.label
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
108
118
|
placing === null ? null : dropTargets.map((target) => /* @__PURE__ */ jsx("div", {
|
|
109
119
|
role: "img",
|
|
110
120
|
"aria-label": target.label,
|
|
@@ -144,6 +154,85 @@ function Diagnostics({ state, t, ids, list, follow }) {
|
|
|
144
154
|
}), state.diagnostics.length === 0 ? /* @__PURE__ */ jsx("p", { children: t("problems.none") }) : null] });
|
|
145
155
|
}
|
|
146
156
|
//#endregion
|
|
157
|
+
//#region src/image-chooser.tsx
|
|
158
|
+
/**
|
|
159
|
+
* Add image…: the palette's last button, where the host keeps images
|
|
160
|
+
* (0033), and the file input it opens, hidden beside it.
|
|
161
|
+
*
|
|
162
|
+
* The button sends `chooseImage` and, when the editor will take a file
|
|
163
|
+
* now, calls the input's `click()` at once, in the same activation -- a
|
|
164
|
+
* click, Enter or Space -- which opens the platform's chooser; awaiting
|
|
165
|
+
* anything first would lose the activation, and the browser would open
|
|
166
|
+
* nothing. The input is outside the accessibility tree and never has
|
|
167
|
+
* focus: the keyboard stays on the button throughout.
|
|
168
|
+
*
|
|
169
|
+
* On the input's change the file is taken into a local before `value` is
|
|
170
|
+
* cleared, because in a browser clearing it empties `files`; it is cleared
|
|
171
|
+
* so that the same file chosen again is a change again. A chooser closed
|
|
172
|
+
* without a file changes nothing, and nothing is sent. What the file is,
|
|
173
|
+
* and whether it is added, is the editor's to say, in the live region.
|
|
174
|
+
*/
|
|
175
|
+
function ImageChooser({ state, t, ids, choose, add }) {
|
|
176
|
+
const input = useRef(null);
|
|
177
|
+
const { images } = state;
|
|
178
|
+
if (!images.store) return null;
|
|
179
|
+
const why = `${ids}-unavailable-add-image`;
|
|
180
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
"data-report-part": "palette-item",
|
|
183
|
+
"aria-disabled": state.can.addImage ? void 0 : true,
|
|
184
|
+
"aria-describedby": images.unavailable === void 0 ? void 0 : why,
|
|
185
|
+
"aria-busy": images.adding === null ? void 0 : true,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
if (choose()) input.current?.click();
|
|
188
|
+
},
|
|
189
|
+
children: [t("images.add"), images.unavailable === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
190
|
+
id: why,
|
|
191
|
+
hidden: true,
|
|
192
|
+
children: images.unavailable
|
|
193
|
+
})]
|
|
194
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
195
|
+
ref: input,
|
|
196
|
+
type: "file",
|
|
197
|
+
hidden: true,
|
|
198
|
+
accept: images.accept,
|
|
199
|
+
onChange: (event) => {
|
|
200
|
+
const chosen = event.currentTarget;
|
|
201
|
+
const file = chosen.files?.[0];
|
|
202
|
+
chosen.value = "";
|
|
203
|
+
if (file !== void 0) add(file);
|
|
204
|
+
}
|
|
205
|
+
})] });
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/image-library.tsx
|
|
209
|
+
function ImageLibrary({ state, t, ids, remove }) {
|
|
210
|
+
const { assets } = state.images;
|
|
211
|
+
if (assets.length === 0) return null;
|
|
212
|
+
return /* @__PURE__ */ jsx("div", {
|
|
213
|
+
role: "group",
|
|
214
|
+
"aria-label": t("images.heading"),
|
|
215
|
+
children: assets.map((image, at) => {
|
|
216
|
+
const why = `${ids}-image-${String(at)}-in-use`;
|
|
217
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
218
|
+
"data-report-part": "property",
|
|
219
|
+
children: [/* @__PURE__ */ jsx("span", { children: image.label }), /* @__PURE__ */ jsxs("button", {
|
|
220
|
+
type: "button",
|
|
221
|
+
"aria-label": image.removeLabel,
|
|
222
|
+
"aria-disabled": image.inUse === void 0 ? void 0 : true,
|
|
223
|
+
"aria-describedby": image.inUse === void 0 ? void 0 : why,
|
|
224
|
+
onClick: () => remove(image.id),
|
|
225
|
+
children: [t("images.remove"), image.inUse === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
226
|
+
id: why,
|
|
227
|
+
hidden: true,
|
|
228
|
+
children: image.inUse
|
|
229
|
+
})]
|
|
230
|
+
})]
|
|
231
|
+
}, image.id);
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
147
236
|
//#region src/outline.tsx
|
|
148
237
|
function rows(nodes, into = []) {
|
|
149
238
|
nodes.forEach((node, at) => {
|
|
@@ -259,12 +348,12 @@ function Outline({ state, t, ids, tree, drag, act }) {
|
|
|
259
348
|
}
|
|
260
349
|
//#endregion
|
|
261
350
|
//#region src/palette.tsx
|
|
262
|
-
function Palette({ state, t, ids, drag, place }) {
|
|
263
|
-
return /* @__PURE__ */
|
|
351
|
+
function Palette({ state, t, ids, drag, place, chooser }) {
|
|
352
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
264
353
|
role: "group",
|
|
265
354
|
"aria-label": t("pane.palette"),
|
|
266
355
|
"data-report-part": "palette",
|
|
267
|
-
children: state.palette.map((entry) => {
|
|
356
|
+
children: [state.palette.map((entry) => {
|
|
268
357
|
const why = `${ids}-unavailable-${entry.kind}`;
|
|
269
358
|
return /* @__PURE__ */ jsxs("button", {
|
|
270
359
|
type: "button",
|
|
@@ -282,7 +371,7 @@ function Palette({ state, t, ids, drag, place }) {
|
|
|
282
371
|
children: entry.unavailable
|
|
283
372
|
})]
|
|
284
373
|
}, entry.kind);
|
|
285
|
-
})
|
|
374
|
+
}), chooser]
|
|
286
375
|
});
|
|
287
376
|
}
|
|
288
377
|
//#endregion
|
|
@@ -463,7 +552,8 @@ function usePointerDrag(editor, zones, placed) {
|
|
|
463
552
|
* same. A typed value is the person's until it is committed -- on leaving
|
|
464
553
|
* the field, or Enter in a single-line one -- and a value the editor refuses
|
|
465
554
|
* stays as typed, `aria-invalid`, with the reason beside it as its
|
|
466
|
-
* description. Escape gives back what the report holds.
|
|
555
|
+
* description. Escape gives back what the report holds. Under the
|
|
556
|
+
* report's own fields, its images (`library`, 0033).
|
|
467
557
|
*/
|
|
468
558
|
/** A text, a colour, an expression, a number or a length: typed, then committed. */
|
|
469
559
|
function Typed({ field, id, validity, commit }) {
|
|
@@ -528,12 +618,12 @@ function Control(props) {
|
|
|
528
618
|
default: return /* @__PURE__ */ jsx(Typed, { ...props });
|
|
529
619
|
}
|
|
530
620
|
}
|
|
531
|
-
function Properties({ state, ids, act }) {
|
|
532
|
-
return /* @__PURE__ */
|
|
621
|
+
function Properties({ state, ids, act, library }) {
|
|
622
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
533
623
|
"aria-label": state.properties.heading,
|
|
534
624
|
"data-report-part": "properties",
|
|
535
625
|
onSubmit: (event) => event.preventDefault(),
|
|
536
|
-
children: state.properties.fields.map((field, at) => {
|
|
626
|
+
children: [state.properties.fields.map((field, at) => {
|
|
537
627
|
const id = `${ids}-field-${at}`;
|
|
538
628
|
const error = `${id}-error`;
|
|
539
629
|
const validity = field.error === void 0 ? {} : {
|
|
@@ -565,7 +655,7 @@ function Properties({ state, ids, act }) {
|
|
|
565
655
|
})
|
|
566
656
|
]
|
|
567
657
|
}, field.key);
|
|
568
|
-
})
|
|
658
|
+
}), library]
|
|
569
659
|
});
|
|
570
660
|
}
|
|
571
661
|
//#endregion
|
|
@@ -780,18 +870,36 @@ function useEditorState(editor) {
|
|
|
780
870
|
* The document and its history live in the session, so unmounting this and
|
|
781
871
|
* mounting another builder -- React or Angular -- over the same session
|
|
782
872
|
* loses nothing, and leaves no subscription behind.
|
|
873
|
+
*
|
|
874
|
+
* A host may give a view of its own -- the Studio's PDF -- which stands in
|
|
875
|
+
* the design view's place while the editor says so (0029): a bare region,
|
|
876
|
+
* named by the editor's `hostView`, holding what the host gave and nothing
|
|
877
|
+
* of the builder's, its keys the host's.
|
|
878
|
+
*
|
|
879
|
+
* Where the host gave the editor a store for images, the palette ends with
|
|
880
|
+
* Add image…, and the report's own properties list its images (0033): the
|
|
881
|
+
* file a person chooses goes to `editor.addImage`, which says what became
|
|
882
|
+
* of it; nothing here reads it.
|
|
783
883
|
*/
|
|
784
884
|
/** A field that keeps its own keys: Ctrl+Z in it undoes typing, not the report, and its arrows move its caret. A checkbox has no typing to undo. */
|
|
785
885
|
function keepsItsKeys(element) {
|
|
786
886
|
if (element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) return true;
|
|
787
887
|
return element instanceof HTMLInputElement && element.type !== "checkbox";
|
|
788
888
|
}
|
|
789
|
-
function ReportBuilder({ editor }) {
|
|
889
|
+
function ReportBuilder({ editor, hostView }) {
|
|
790
890
|
const state = useEditorState(editor);
|
|
791
891
|
const t = useMemo(() => editorText(state.locale), [state.locale]);
|
|
792
892
|
const ids = useId();
|
|
793
893
|
const tree = useRef(null);
|
|
794
894
|
const canvas = useRef(null);
|
|
895
|
+
/** The host's view's region, while it stands in the design view's place. */
|
|
896
|
+
const view = useRef(null);
|
|
897
|
+
/** The last key press the host's view had first: React bubbles one from a portal the host opened there through the view, wherever the portal's DOM is. */
|
|
898
|
+
const hostKey = useRef(null);
|
|
899
|
+
/** The element the keyboard last stood on in this builder, for a middle pane swapped from under it to hand the keyboard on. */
|
|
900
|
+
const lastFocused = useRef(null);
|
|
901
|
+
/** Whether that element stood in the properties form, for a row taken from under it to hand the keyboard to the first field. */
|
|
902
|
+
const lastInProperties = useRef(false);
|
|
795
903
|
const sheet = useRef(null);
|
|
796
904
|
const fields = useRef(null);
|
|
797
905
|
const problemList = useRef(null);
|
|
@@ -813,7 +921,7 @@ function ReportBuilder({ editor }) {
|
|
|
813
921
|
closed.current = null;
|
|
814
922
|
return from?.focus();
|
|
815
923
|
}
|
|
816
|
-
case "canvas": return canvas.current?.focus();
|
|
924
|
+
case "canvas": return (canvas.current ?? view.current)?.focus();
|
|
817
925
|
case "properties": return fields.current?.querySelector("input, select, textarea")?.focus();
|
|
818
926
|
case "diagnostics": return problemList.current?.focus();
|
|
819
927
|
}
|
|
@@ -824,6 +932,16 @@ function ReportBuilder({ editor }) {
|
|
|
824
932
|
wanted.current = null;
|
|
825
933
|
focus(where);
|
|
826
934
|
});
|
|
935
|
+
useLayoutEffect(() => {
|
|
936
|
+
const last = lastFocused.current;
|
|
937
|
+
const dropped = document.activeElement === null || document.activeElement === document.body;
|
|
938
|
+
if (last instanceof Node && !last.isConnected && dropped) focus("canvas");
|
|
939
|
+
}, [state.view, focus]);
|
|
940
|
+
useLayoutEffect(() => {
|
|
941
|
+
const last = lastFocused.current;
|
|
942
|
+
const dropped = document.activeElement === null || document.activeElement === document.body;
|
|
943
|
+
if (lastInProperties.current && last instanceof Node && !last.isConnected && dropped) focus("properties");
|
|
944
|
+
}, [state, focus]);
|
|
827
945
|
/** Dispatches `action`; when it succeeds, focus goes to `then` -- at once if nothing changed, else once the change is drawn. */
|
|
828
946
|
function act(action, then) {
|
|
829
947
|
const before = editor.state();
|
|
@@ -841,7 +959,7 @@ function ReportBuilder({ editor }) {
|
|
|
841
959
|
wanted.current = "selection";
|
|
842
960
|
});
|
|
843
961
|
function onKeyDown(event) {
|
|
844
|
-
if (event.defaultPrevented || keepsItsKeys(event.target)) return;
|
|
962
|
+
if (event.defaultPrevented || keepsItsKeys(event.target) || event.nativeEvent === hostKey.current) return;
|
|
845
963
|
const inTree = tree.current?.contains(event.target) === true;
|
|
846
964
|
const action = actionForKey(event, inTree ? "outline" : "editor", state.drag !== null);
|
|
847
965
|
if (action === void 0) return;
|
|
@@ -911,13 +1029,30 @@ function ReportBuilder({ editor }) {
|
|
|
911
1029
|
}
|
|
912
1030
|
const choosing = state.drag?.via === "keyboard" ? state.drag : null;
|
|
913
1031
|
const count = state.diagnostics.length;
|
|
1032
|
+
const shows = (panel) => !state.hidden.includes(panel);
|
|
1033
|
+
/** A side pane's Hide, named after the pane; the design view takes its room and the keyboard. */
|
|
1034
|
+
const hide = (panel, name) => /* @__PURE__ */ jsx("button", {
|
|
1035
|
+
type: "button",
|
|
1036
|
+
"data-report-part": "hide-pane",
|
|
1037
|
+
"aria-label": t("action.hidePane", { pane: name }),
|
|
1038
|
+
onClick: () => act({
|
|
1039
|
+
type: "hidePanel",
|
|
1040
|
+
panel
|
|
1041
|
+
}, "canvas"),
|
|
1042
|
+
children: t("action.hide")
|
|
1043
|
+
});
|
|
914
1044
|
return /* @__PURE__ */ jsxs("section", {
|
|
915
1045
|
ref: root,
|
|
916
1046
|
"aria-label": t("editor.label"),
|
|
917
1047
|
className: "wb",
|
|
918
1048
|
"data-report-part": "editor",
|
|
919
1049
|
"data-panel": state.panel,
|
|
1050
|
+
"data-hidden": state.hidden.length === 0 ? void 0 : state.hidden.join(" "),
|
|
920
1051
|
onKeyDown,
|
|
1052
|
+
onFocus: (event) => {
|
|
1053
|
+
lastFocused.current = event.target;
|
|
1054
|
+
lastInProperties.current = event.target.closest("[data-report-part=\"properties\"]") !== null;
|
|
1055
|
+
},
|
|
921
1056
|
children: [
|
|
922
1057
|
/* @__PURE__ */ jsx("div", {
|
|
923
1058
|
className: "wb-pane",
|
|
@@ -935,11 +1070,11 @@ function ReportBuilder({ editor }) {
|
|
|
935
1070
|
}, pane)
|
|
936
1071
|
})] })
|
|
937
1072
|
}),
|
|
938
|
-
/* @__PURE__ */ jsxs("section", {
|
|
1073
|
+
shows("outline") ? /* @__PURE__ */ jsxs("section", {
|
|
939
1074
|
className: "wb-pane",
|
|
940
1075
|
"data-pane": "outline",
|
|
941
1076
|
children: [
|
|
942
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ jsxs("header", { children: [/* @__PURE__ */ jsx("span", { children: t("pane.outline") }), hide("outline", t("pane.outline"))] }),
|
|
943
1078
|
/* @__PURE__ */ jsxs("div", {
|
|
944
1079
|
className: "wb-body",
|
|
945
1080
|
children: [/* @__PURE__ */ jsx(Palette, {
|
|
@@ -947,7 +1082,14 @@ function ReportBuilder({ editor }) {
|
|
|
947
1082
|
t,
|
|
948
1083
|
ids,
|
|
949
1084
|
drag,
|
|
950
|
-
place
|
|
1085
|
+
place,
|
|
1086
|
+
chooser: /* @__PURE__ */ jsx(ImageChooser, {
|
|
1087
|
+
state,
|
|
1088
|
+
t,
|
|
1089
|
+
ids,
|
|
1090
|
+
choose: () => act({ type: "chooseImage" }).ok,
|
|
1091
|
+
add: (file) => void editor.addImage(file)
|
|
1092
|
+
})
|
|
951
1093
|
}), /* @__PURE__ */ jsx(Outline, {
|
|
952
1094
|
state,
|
|
953
1095
|
t,
|
|
@@ -967,8 +1109,18 @@ function ReportBuilder({ editor }) {
|
|
|
967
1109
|
cancel: cancelPlaces
|
|
968
1110
|
})
|
|
969
1111
|
]
|
|
970
|
-
}),
|
|
971
|
-
/* @__PURE__ */
|
|
1112
|
+
}) : null,
|
|
1113
|
+
state.view === "host" ? /* @__PURE__ */ jsx("section", {
|
|
1114
|
+
ref: view,
|
|
1115
|
+
"aria-label": state.hostView?.name,
|
|
1116
|
+
"data-pane": "canvas",
|
|
1117
|
+
"data-report-part": "view",
|
|
1118
|
+
tabIndex: -1,
|
|
1119
|
+
onKeyDown: (event) => {
|
|
1120
|
+
hostKey.current = event.nativeEvent;
|
|
1121
|
+
},
|
|
1122
|
+
children: hostView
|
|
1123
|
+
}, "view") : /* @__PURE__ */ jsxs("section", {
|
|
972
1124
|
className: "wb-pane wb-canvas",
|
|
973
1125
|
"data-pane": "canvas",
|
|
974
1126
|
children: [/* @__PURE__ */ jsx("header", { children: t("pane.canvas") }), /* @__PURE__ */ jsx("div", {
|
|
@@ -982,57 +1134,65 @@ function ReportBuilder({ editor }) {
|
|
|
982
1134
|
select: (action) => act(action, "selection")
|
|
983
1135
|
})
|
|
984
1136
|
})]
|
|
985
|
-
}),
|
|
986
|
-
/* @__PURE__ */ jsxs("section", {
|
|
1137
|
+
}, "design"),
|
|
1138
|
+
shows("properties") || shows("diagnostics") ? /* @__PURE__ */ jsxs("section", {
|
|
987
1139
|
className: "wb-pane",
|
|
988
|
-
"data-pane": state.panel === "diagnostics" ? "diagnostics" : "properties",
|
|
989
|
-
children: [
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1140
|
+
"data-pane": state.panel === "diagnostics" || !shows("properties") ? "diagnostics" : "properties",
|
|
1141
|
+
children: [shows("properties") ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("header", {
|
|
1142
|
+
"data-pane": "properties",
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ jsx("span", { children: state.properties.heading }),
|
|
1145
|
+
state.selection === null ? null : /* @__PURE__ */ jsx("button", {
|
|
993
1146
|
type: "button",
|
|
994
1147
|
onClick: () => act({
|
|
995
1148
|
type: "select",
|
|
996
1149
|
id: null
|
|
997
1150
|
}, "properties"),
|
|
998
1151
|
children: t("properties.report")
|
|
999
|
-
})
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
/* @__PURE__ */ jsx("header", {
|
|
1012
|
-
"data-pane": "diagnostics",
|
|
1013
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1014
|
-
role: "status",
|
|
1015
|
-
"aria-label": t("pane.problems"),
|
|
1016
|
-
children: [/* @__PURE__ */ jsx("span", { children: t("pane.problems") }), count === 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("span", {
|
|
1017
|
-
"data-report-part": "badge",
|
|
1018
|
-
"data-severity": state.diagnostics.some((entry) => entry.severity === "error") ? "error" : "warning",
|
|
1019
|
-
children: count
|
|
1020
|
-
})] })]
|
|
1021
|
-
})
|
|
1022
|
-
}),
|
|
1023
|
-
/* @__PURE__ */ jsx("div", {
|
|
1024
|
-
className: "wb-body",
|
|
1025
|
-
"data-pane": "diagnostics",
|
|
1026
|
-
children: /* @__PURE__ */ jsx(Diagnostics, {
|
|
1152
|
+
}),
|
|
1153
|
+
hide("properties", t("pane.properties"))
|
|
1154
|
+
]
|
|
1155
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1156
|
+
ref: fields,
|
|
1157
|
+
className: "wb-body",
|
|
1158
|
+
"data-pane": "properties",
|
|
1159
|
+
children: /* @__PURE__ */ jsx(Properties, {
|
|
1160
|
+
state,
|
|
1161
|
+
ids,
|
|
1162
|
+
act,
|
|
1163
|
+
library: state.selection === null ? /* @__PURE__ */ jsx(ImageLibrary, {
|
|
1027
1164
|
state,
|
|
1028
1165
|
t,
|
|
1029
1166
|
ids,
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1167
|
+
remove: (asset) => act({
|
|
1168
|
+
type: "removeImage",
|
|
1169
|
+
asset
|
|
1170
|
+
}, "properties")
|
|
1171
|
+
}) : null
|
|
1033
1172
|
})
|
|
1034
|
-
]
|
|
1035
|
-
|
|
1173
|
+
})] }) : null, shows("diagnostics") ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("header", {
|
|
1174
|
+
"data-pane": "diagnostics",
|
|
1175
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1176
|
+
role: "status",
|
|
1177
|
+
"aria-label": t("pane.problems"),
|
|
1178
|
+
children: [/* @__PURE__ */ jsx("span", { children: t("pane.problems") }), count === 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("span", {
|
|
1179
|
+
"data-report-part": "badge",
|
|
1180
|
+
"data-severity": state.diagnostics.some((entry) => entry.severity === "error") ? "error" : "warning",
|
|
1181
|
+
children: count
|
|
1182
|
+
})] })]
|
|
1183
|
+
}), hide("diagnostics", t("pane.problems"))]
|
|
1184
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1185
|
+
className: "wb-body",
|
|
1186
|
+
"data-pane": "diagnostics",
|
|
1187
|
+
children: /* @__PURE__ */ jsx(Diagnostics, {
|
|
1188
|
+
state,
|
|
1189
|
+
t,
|
|
1190
|
+
ids,
|
|
1191
|
+
list: problemList,
|
|
1192
|
+
follow
|
|
1193
|
+
})
|
|
1194
|
+
})] }) : null]
|
|
1195
|
+
}) : null,
|
|
1036
1196
|
/* @__PURE__ */ jsx("div", {
|
|
1037
1197
|
className: "wb-pane",
|
|
1038
1198
|
children: /* @__PURE__ */ jsx("p", {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["selection"],"sources":["../src/canvas.tsx","../src/diagnostics.tsx","../src/outline.tsx","../src/palette.tsx","../src/places.tsx","../src/pointer-drag.ts","../src/properties.tsx","../src/toolbar.tsx","../src/use-editor-state.ts","../src/report-builder.tsx"],"sourcesContent":["/**\n * The design view: one sheet as wide as the page, the regions as bands on it,\n * a box per component and table column, rulers in millimetres, and while\n * something is being placed, an indicator at every place it may go.\n *\n * It draws the state's geometry and decides none: every left, top, width and\n * height is a number report-builder-core computed in pixels at the zoom. It\n * is labelled as not the PDF, because it is not -- the renderer measures text\n * and breaks pages, and the preview shows what prints.\n *\n * Each box is a picture of where a component stands -- `role=\"img\"`, named\n * by its label, so reading the view says what is on it. A click selects; a\n * box is not a tab stop, because the outline is the keyboard's way to every\n * box and two ways to the same place would double the tabbing. The view\n * itself is one stop, so a keyboard can scroll it.\n */\nimport type { CSSProperties, ReactElement, Ref } from 'react'\nimport type { Box, CanvasBox, EditorAction, EditorState, EditorText, RulerTick } from '@formancy/report-builder-core'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface CanvasProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly canvas: Ref<HTMLElement>\n readonly sheet: Ref<HTMLDivElement>\n readonly drag: PointerDrag\n /** Selects a box, focus to follow to its outline row. */\n readonly select: (action: EditorAction) => void\n}\n\n/** A box's place on the sheet: physical left and top, because a page's coordinates run from its top-left whatever the language. */\nfunction placed(box: Box): CSSProperties {\n return { left: box.x, top: box.y, width: box.width, height: box.height }\n}\n\nfunction Ruler({ orientation, ticks, length, label }: { readonly orientation: 'horizontal' | 'vertical'; readonly ticks: readonly RulerTick[]; readonly length: number; readonly label: string }): ReactElement {\n const across = orientation === 'horizontal'\n return (\n <div role=\"img\" aria-label={label} data-report-part=\"ruler\" data-orientation={orientation} style={across ? { width: length } : { height: length }}>\n {ticks.map((tick) => (\n <span key={tick.mm} data-report-part=\"ruler-tick\" data-major={tick.major ? 'true' : undefined} style={across ? { left: tick.at } : { top: tick.at }}>\n {tick.label === undefined ? null : <span>{tick.label}</span>}\n </span>\n ))}\n </div>\n )\n}\n\nfunction selection(box: CanvasBox): EditorAction {\n return box.column === undefined ? { type: 'select', id: box.id } : { type: 'select', id: box.id, column: box.column }\n}\n\nexport function Canvas({ state, t, canvas: canvasRef, sheet: sheetRef, drag, select }: CanvasProps): ReactElement {\n const { canvas, drag: placing, dropTargets } = state\n const moving = placing !== null && 'id' in placing.subject ? placing.subject.id : undefined\n return (\n <section ref={canvasRef} aria-label={canvas.label} data-report-part=\"canvas\" tabIndex={0}>\n <p data-report-part=\"canvas-note\">{canvas.note}</p>\n <Ruler orientation=\"horizontal\" ticks={canvas.rulers.horizontal} length={canvas.sheet.px.width} label={t('ruler.horizontal')} />\n <Ruler orientation=\"vertical\" ticks={canvas.rulers.vertical} length={canvas.sheet.px.height} label={t('ruler.vertical')} />\n <div ref={sheetRef} data-report-part=\"sheet\" style={{ width: canvas.sheet.px.width, height: canvas.sheet.px.height }}>\n {canvas.regions.map((region) => (\n <div key={region.region} data-report-part=\"region\" data-empty={region.empty ? 'true' : undefined} style={placed(region.px)}>\n <span data-report-part=\"region-label\">{region.label}</span>\n </div>\n ))}\n {canvas.boxes.map((box) => (\n <div\n key={box.key}\n role=\"img\"\n aria-label={box.label}\n data-report-part=\"box\"\n data-kind={box.kind}\n data-selected={box.selected ? 'true' : undefined}\n data-overflows={box.overflows ? 'true' : undefined}\n data-dragging={box.column === undefined && box.id === moving ? 'true' : undefined}\n title={box.overflows ? t('canvas.overflow') : undefined}\n style={placed(box.px)}\n onPointerDown={(event) => {\n if (box.column === undefined) drag.press(event, { id: box.id })\n }}\n onClick={() => {\n if (!drag.swallowClick()) select(selection(box))\n }}\n >\n <span data-report-part=\"box-label\">{box.label}</span>\n {box.problems > 0 ? (\n <span data-report-part=\"badge\" data-severity={box.severity} aria-hidden=\"true\">\n {box.problems}\n </span>\n ) : null}\n </div>\n ))}\n {/* Drawn only for the places the session accepts, named as the place\n dialog names them; the one under the pointer, or focused in the\n dialog, is marked. */}\n {placing === null\n ? null\n : dropTargets.map((target) => (\n <div key={target.index} role=\"img\" aria-label={target.label} data-report-part=\"drop-indicator\" data-over={placing.over === target.index ? 'true' : undefined} style={placed(target.px)} />\n ))}\n </div>\n </section>\n )\n}\n","/**\n * The problems: report-core's diagnostics, each a button named \"Error:\n * Introduction\" and described by report-core's sentence. Activating one\n * selects what it is about, and the builder moves focus to its outline row;\n * one about the report as a whole selects nothing, which shows the report's\n * own properties.\n *\n * Each entry is keyed by what it is (`DiagnosticEntry.key`), never by its\n * place in the list: a problem listed before the one the keyboard is on\n * leaves that one's button, and the keyboard, where they were.\n */\nimport type { ReactElement, Ref } from 'react'\nimport type { DiagnosticEntry, EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface DiagnosticsProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly ids: string\n readonly list: Ref<HTMLUListElement>\n readonly follow: (entry: DiagnosticEntry) => void\n}\n\nexport function Diagnostics({ state, t, ids, list, follow }: DiagnosticsProps): ReactElement {\n return (\n <>\n {/* Not a tab stop: the problems pane's button moves focus here, to say\n how many there are. Named in words, as the pane's heading says. */}\n <ul ref={list} aria-label={t('pane.problems')} data-report-part=\"diagnostics\" tabIndex={-1}>\n {state.diagnostics.map((entry, at) => {\n const message = `${ids}-problem-${at}`\n return (\n <li key={entry.key} data-report-part=\"diagnostic\" data-severity={entry.severity}>\n <button type=\"button\" aria-describedby={message} onClick={() => follow(entry)}>\n {entry.label}\n </button>\n <div id={message}>{entry.message}</div>\n </li>\n )\n })}\n </ul>\n {state.diagnostics.length === 0 ? <p>{t('problems.none')}</p> : null}\n </>\n )\n}\n","/**\n * The outline: the report as an ARIA tree, a group per region and a row per\n * component or table column; with no row at all, an empty tree and the\n * sentence that says so.\n *\n * Rows are flat within their region and nest by `aria-level`, which is also\n * what report-builder.css indents by, so the nesting drawn and the nesting\n * announced cannot disagree. One row is a tab stop -- the selected one, or\n * the first -- and focus follows the selection: moving focus to a row\n * selects it, and every action that selects moves focus to its row. The\n * keys are report-builder-core's `actionForKey`, which the builder applies\n * to the whole tree; nothing here decides a key.\n */\nimport type { ReactElement, Ref } from 'react'\nimport type { EditorAction, EditorState, EditorText, OutlineNode } from '@formancy/report-builder-core'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface OutlineProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly ids: string\n readonly tree: Ref<HTMLDivElement>\n readonly drag: PointerDrag\n readonly act: (action: EditorAction) => void\n}\n\n/** A node with its place among its siblings, for `aria-posinset` and `aria-setsize`. */\ninterface Row {\n readonly node: OutlineNode\n readonly position: number\n readonly siblings: number\n}\n\nfunction rows(nodes: readonly OutlineNode[], into: Row[] = []): Row[] {\n nodes.forEach((node, at) => {\n into.push({ node, position: at + 1, siblings: nodes.length })\n rows(node.children, into)\n })\n return into\n}\n\n/** The ids of what describes a row: how many problems it has, and that it is wider than its place. */\nfunction described(node: OutlineNode, problems: string, overflow: string): string | undefined {\n const ids = [...(node.problems > 0 ? [problems] : []), ...(node.overflows ? [overflow] : [])]\n return ids.length === 0 ? undefined : ids.join(' ')\n}\n\nfunction selection(node: OutlineNode): EditorAction {\n return node.column === undefined ? { type: 'select', id: node.id } : { type: 'select', id: node.id, column: node.column }\n}\n\nexport function Outline({ state, t, ids, tree, drag, act }: OutlineProps): ReactElement {\n const regions = state.outline.map((region) => ({ region, rows: rows(region.nodes) }))\n const all = regions.flatMap((region) => region.rows)\n // The tree's one tab stop: the selected row, else the first; the tree itself when it has none.\n const stop = all.find((row) => row.node.selected)?.node.key ?? all[0]?.node.key\n const empty = `${ids}-outline-empty`\n\n // With no row at all the tree holds nothing -- a tree owns rows, and a\n // region's name with none under it is not one -- and is itself the tab\n // stop, described by the sentence beside it. With rows it still takes\n // focus from a script, never from Tab: where focus goes when an action\n // leaves nothing selected, since focusing a row would select it.\n if (stop === undefined) {\n return (\n <>\n <div ref={tree} role=\"tree\" aria-label={t('pane.outline')} aria-describedby={empty} data-report-part=\"outline\" tabIndex={0} />\n <p id={empty} data-report-part=\"outline-empty\">\n {t('outline.empty')}\n </p>\n </>\n )\n }\n\n return (\n <div ref={tree} role=\"tree\" aria-label={t('pane.outline')} data-report-part=\"outline\" tabIndex={-1}>\n {regions.map(({ region, rows: list }) => {\n return (\n // Named in the editor's words, not after the label drawn in it:\n // Chromium would put report-builder.css's capitals into that name,\n // \"BODY\". The label is hidden from the tree, which would read it\n // again as a text among the group's rows.\n <div key={region.region} role=\"group\" aria-label={region.label} data-report-part=\"outline-region\">\n <span data-report-part=\"region-label\" aria-hidden=\"true\">\n {region.label}\n </span>\n {list.length === 0 ? <span>{t('outline.empty')}</span> : null}\n {list.map(({ node, position, siblings }) => {\n const problems = `${ids}-problems-${node.key}`\n const overflow = `${ids}-overflow-${node.key}`\n return (\n <div\n key={node.key}\n ref={(element) => drag.row(element, node)}\n role=\"treeitem\"\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-selected={node.selected}\n aria-describedby={described(node, problems, overflow)}\n tabIndex={node.key === stop ? 0 : -1}\n data-report-part=\"outline-item\"\n data-kind={node.kind}\n onPointerDown={(event) => {\n if (node.column === undefined) drag.press(event, { id: node.id })\n }}\n onFocus={() => {\n if (!node.selected) act(selection(node))\n }}\n onClick={() => {\n if (!drag.swallowClick()) act(selection(node))\n }}\n >\n {node.label}\n {node.problems > 0 ? (\n <>\n {/* The count is drawn, and said as the row's description:\n inside the name it would make \"Introduction\" read\n \"Introduction 1\". */}\n <span data-report-part=\"badge\" data-severity={node.severity} aria-hidden=\"true\">\n {node.problems}\n </span>\n <span id={problems} hidden>\n {t('outline.problems', { count: node.problems })}\n </span>\n </>\n ) : null}\n {/* What the canvas marks on a box too wide for its place,\n said where a keyboard is: on its row. */}\n {node.overflows ? (\n <span id={overflow} hidden>\n {t('canvas.overflow')}\n </span>\n ) : null}\n </div>\n )\n })}\n </div>\n )\n })}\n </div>\n )\n}\n","/**\n * The palette: one button per kind of component the format has.\n *\n * Activating one -- a click, Enter or Space -- opens the place dialog for\n * that kind, the keyboard path every drag has. Pressing one and moving is\n * the pointer path to the same places. An entry the report cannot hold yet\n * (an image with nothing to draw) stays in the list, `aria-disabled` and\n * described by what to declare first, so it is found rather than missed.\n */\nimport type { ReactElement } from 'react'\nimport type { EditorState, EditorText } from '@formancy/report-builder-core'\nimport type { ComponentKind } from '@formancy/report-spec'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface PaletteProps {\n readonly state: EditorState\n readonly t: EditorText\n /** Prefix for the element ids this pane mints, unique to its builder. */\n readonly ids: string\n readonly drag: PointerDrag\n /** Opens the place dialog for a new component of `kind`, focus to return to `from`. */\n readonly place: (kind: ComponentKind, from: HTMLElement) => void\n}\n\nexport function Palette({ state, t, ids, drag, place }: PaletteProps): ReactElement {\n return (\n <div role=\"group\" aria-label={t('pane.palette')} data-report-part=\"palette\">\n {state.palette.map((entry) => {\n const why = `${ids}-unavailable-${entry.kind}`\n return (\n <button\n key={entry.kind}\n type=\"button\"\n data-report-part=\"palette-item\"\n data-kind={entry.kind}\n aria-disabled={entry.component === null ? true : undefined}\n aria-describedby={entry.unavailable === undefined ? undefined : why}\n onPointerDown={(event) => drag.press(event, { kind: entry.kind })}\n onClick={(event) => {\n if (!drag.swallowClick()) place(entry.kind, event.currentTarget)\n }}\n >\n {entry.label}\n {entry.unavailable === undefined ? null : (\n <span id={why} hidden>\n {entry.unavailable}\n </span>\n )}\n </button>\n )\n })}\n </div>\n )\n}\n","/**\n * The place dialog: the keyboard path for every drag (formancy.ai 0046).\n *\n * While the editor's drag is `via: 'keyboard'` it lists the drag's targets\n * -- the places report-core's `validLocations` accepts, named \"Body, after\n * Introduction\" -- as buttons, and Cancel. Focus moves into it when this\n * builder opens it (the builder's `openPlaces`), never merely because it is\n * drawn: a dialog another builder opened stays where the keyboard left it.\n * The place focused is the one the canvas marks, so a sighted keyboard user\n * sees where each choice lands before making it. Escape cancels, through the\n * editor's own key map. Choosing a place, and cancelling, are the builder's\n * to finish: it knows where focus goes next.\n */\nimport type { ReactElement } from 'react'\nimport type { DragState, DropTarget, EditorAction, EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface PlacesProps {\n readonly state: EditorState\n readonly drag: DragState\n readonly t: EditorText\n readonly ids: string\n readonly act: (action: EditorAction) => void\n readonly choose: (subject: DragState['subject'], target: DropTarget) => void\n readonly cancel: () => void\n}\n\nexport function Places({ state, drag, t, ids, act, choose, cancel }: PlacesProps): ReactElement {\n const nowhere = `${ids}-nowhere`\n\n return (\n // A floating pane of the workbench, so its buttons are the workbench's.\n // Named in the editor's words, as the header says, never after the\n // header, whose name a host's stylesheet could set in capitals.\n <div role=\"dialog\" aria-label={drag.title} aria-describedby={drag.nowhere === undefined ? undefined : nowhere} data-report-part=\"places\" className=\"wb-pane\">\n <header>{drag.title}</header>\n {drag.nowhere === undefined ? null : (\n <p id={nowhere} className=\"wb-problem\">\n {drag.nowhere}\n </p>\n )}\n {state.dropTargets.map((target) => (\n <button\n key={target.index}\n type=\"button\"\n data-report-part=\"place\"\n onFocus={() => act({ type: 'updateDrag', over: target.index })}\n onClick={() => choose(drag.subject, target)}\n >\n {target.label}\n </button>\n ))}\n <button type=\"button\" onClick={cancel}>\n {t('places.cancel')}\n </button>\n </div>\n )\n}\n","/**\n * Dragging with a pointer: a palette entry, a box on the canvas or an outline\n * row, dropped on the canvas or beside an outline row.\n *\n * The drag itself is the editor's state machine (`startDrag`, `updateDrag`,\n * `drop`, `cancelDrag`), and where a drop may land is its `dropTargets`,\n * which are report-core's `validLocations`; this file only turns pointer\n * positions into a target's index with `targetNear` and `targetBeside`. So a\n * pointer is never offered a place the session would refuse, and the\n * keyboard path -- the place dialog -- offers exactly the same places\n * (formancy.ai 0046: every drag has a keyboard path, built first).\n *\n * A press becomes a drag only once it has moved, so a click stays a click:\n * activating a palette entry opens the place dialog, and clicking a box\n * selects it. Mouse and pen drag; a touch scrolls, as the page needs it to,\n * and a tap is a click.\n */\nimport { useEffect, useRef } from 'react'\nimport type { PointerEvent as ReactPointerEvent, RefObject } from 'react'\nimport { targetBeside, targetNear } from '@formancy/report-builder-core'\nimport type { DragSubject, OutlineNode, ReportEditor } from '@formancy/report-builder-core'\n\n/**\n * How far a press may wander, in CSS pixels, and still be a click: Windows'\n * default drag rectangle (`SM_CXDRAG`, `SM_CYDRAG`), which is what a person\n * on that system already has in their hands. A convention, not a measurement.\n */\nconst DRAG_DISTANCE = 4\n\n/** Where a drag can land: the outline's tree, and the canvas with its sheet. */\nexport interface DropZones {\n readonly tree: RefObject<HTMLElement | null>\n readonly canvas: RefObject<HTMLElement | null>\n readonly sheet: RefObject<HTMLElement | null>\n}\n\nexport interface PointerDrag {\n /** Watches a press on something that can be dragged; it becomes a drag once it moves. */\n press(event: ReactPointerEvent<HTMLElement>, subject: DragSubject): void\n /** True, once, for the click a drag ended in, before any key or press: that click must not also select or open what it ended on. */\n swallowClick(): boolean\n /** Remembers which node an outline row draws, so a drag over the row can find the places beside it. */\n row(element: HTMLElement | null, node: OutlineNode): void\n}\n\ninterface Press {\n readonly subject: DragSubject\n readonly x: number\n readonly y: number\n}\n\nexport function usePointerDrag(editor: ReportEditor, zones: DropZones, placed: () => void): PointerDrag {\n const pressed = useRef<Press | null>(null)\n const dragging = useRef(false)\n const swallow = useRef(false)\n const rows = useRef(new WeakMap<Element, OutlineNode>())\n // The latest of each, read when an event arrives, so a re-render never\n // re-subscribes -- which would cancel a drag in flight.\n const onPlaced = useRef(placed)\n onPlaced.current = placed\n const where = useRef(zones)\n where.current = zones\n\n useEffect(() => {\n /** The target under the pointer: beside the outline row it is over, else the nearest on the sheet, else none. */\n function over(event: PointerEvent): number | null {\n const targets = editor.state().dropTargets\n const zones = where.current\n const at = event.target instanceof Element ? event.target : null\n if (at === null) return null\n const row = at.closest('[role=\"treeitem\"]')\n if (row !== null && zones.tree.current?.contains(row) === true) {\n const node = rows.current.get(row)\n if (node === undefined || node.column !== undefined) return null\n const box = row.getBoundingClientRect()\n return targetBeside(targets, node.id, event.clientY < box.top + box.height / 2 ? 'before' : 'after')\n }\n const sheet = zones.sheet.current\n if (sheet === null || zones.canvas.current?.contains(at) !== true) return null\n // The targets are in pixels from the sheet's padding edge, where its\n // absolutely placed children start: inside its border.\n const box = sheet.getBoundingClientRect()\n return targetNear(targets, { x: event.clientX - box.left - sheet.clientLeft, y: event.clientY - box.top - sheet.clientTop })\n }\n\n /** Forgets the press, and says whether it had become a drag the editor still holds. */\n function release(): boolean {\n const was = dragging.current && editor.state().drag?.via === 'pointer'\n pressed.current = null\n dragging.current = false\n return was\n }\n\n function onMove(event: PointerEvent): void {\n const press = pressed.current\n if (press === null) return\n if (!dragging.current) {\n if (Math.hypot(event.clientX - press.x, event.clientY - press.y) < DRAG_DISTANCE) return\n if (!editor.dispatch({ type: 'startDrag', subject: press.subject, via: 'pointer' }).ok) {\n pressed.current = null\n return\n }\n dragging.current = true\n }\n // Ended elsewhere -- Escape, or the subject deleted under it -- and not to be revived.\n if (editor.state().drag?.via !== 'pointer') {\n release()\n return\n }\n editor.dispatch({ type: 'updateDrag', over: over(event) })\n }\n\n function onUp(): void {\n if (!release()) return\n swallow.current = true\n // With nothing under the pointer the editor ends the drag and says nothing moved.\n if (editor.dispatch({ type: 'drop' }).ok) onPlaced.current()\n }\n\n function onCancel(): void {\n if (release()) editor.dispatch({ type: 'cancelDrag' })\n }\n\n // The click a drop ends in comes straight after the release, with no key\n // or press between. A drop that ended away from where it began ends in\n // no click on what it began on; a key or a new press then is the\n // person's next act, whose click is theirs to keep.\n function forget(): void {\n swallow.current = false\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onCancel)\n window.addEventListener('keydown', forget, true)\n window.addEventListener('pointerdown', forget, true)\n return () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onCancel)\n window.removeEventListener('keydown', forget, true)\n window.removeEventListener('pointerdown', forget, true)\n // A drag in flight belongs to the builder that started it.\n if (release()) editor.dispatch({ type: 'cancelDrag' })\n }\n }, [editor])\n\n return {\n press(event, subject) {\n swallow.current = false\n if (event.button !== 0 || event.pointerType === 'touch') return\n pressed.current = { subject, x: event.clientX, y: event.clientY }\n },\n swallowClick() {\n const was = swallow.current\n swallow.current = false\n return was\n },\n row(element, node) {\n if (element !== null) rows.current.set(element, node)\n },\n }\n}\n","/**\n * The properties: one native control per field of the selection, or of the\n * report when nothing is selected, each labelled by its field's label.\n *\n * Which control a field gets is `PROPERTY_ROLES`, report-builder-core's, so\n * the role a test finds and the role the Angular builder renders are the\n * same. A typed value is the person's until it is committed -- on leaving\n * the field, or Enter in a single-line one -- and a value the editor refuses\n * stays as typed, `aria-invalid`, with the reason beside it as its\n * description. Escape gives back what the report holds.\n */\nimport { useState } from 'react'\nimport type { KeyboardEvent, ReactElement } from 'react'\nimport type { EditorAction, EditorState, EditorText, PropertyField } from '@formancy/report-builder-core'\n\nexport interface PropertiesProps {\n readonly state: EditorState\n readonly ids: string\n readonly act: (action: EditorAction) => void\n}\n\n/** What the control states about validity: invalid, and why, when the field has an error. */\ninterface Validity {\n readonly 'aria-invalid'?: true\n readonly 'aria-describedby'?: string\n}\n\ninterface ControlProps {\n readonly field: PropertyField\n readonly id: string\n readonly validity: Validity\n readonly commit: (value: string | boolean) => void\n}\n\n/** A text, a colour, an expression, a number or a length: typed, then committed. */\nfunction Typed({ field, id, validity, commit }: ControlProps): ReactElement {\n const held = String(field.value)\n const [draft, setDraft] = useState<string | null>(null)\n const finish = (): void => {\n if (draft !== null && draft !== held) commit(draft)\n setDraft(null)\n }\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (event.key === 'Escape') setDraft(null)\n else if (event.key === 'Enter' && field.kind !== 'multiline') {\n event.preventDefault()\n finish()\n }\n }\n const shared = {\n id,\n value: draft ?? held,\n required: field.required,\n ...(field.placeholder === undefined ? {} : { placeholder: field.placeholder }),\n ...validity,\n onBlur: finish,\n onKeyDown,\n }\n if (field.kind === 'multiline') return <textarea {...shared} onChange={(event) => setDraft(event.target.value)} />\n const numeric = field.kind === 'number' || field.kind === 'length'\n return (\n <input\n {...shared}\n type={numeric ? 'number' : 'text'}\n // Any decimal the format stores, not the browser's whole-number default step.\n step={numeric ? 'any' : undefined}\n spellCheck={field.kind === 'text' ? undefined : false}\n onChange={(event) => setDraft(event.target.value)}\n />\n )\n}\n\nfunction Control(props: ControlProps): ReactElement {\n const { field, id, validity, commit } = props\n switch (field.kind) {\n case 'boolean':\n return <input id={id} type=\"checkbox\" checked={field.value === true} {...validity} onChange={(event) => commit(event.target.checked)} />\n case 'select':\n case 'binding':\n case 'style':\n return (\n <select id={id} value={String(field.value)} required={field.required} {...validity} onChange={(event) => commit(event.target.value)}>\n {(field.options ?? []).map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n )\n default:\n return <Typed {...props} />\n }\n}\n\nexport function Properties({ state, ids, act }: PropertiesProps): ReactElement {\n return (\n // Named in words, as the pane's heading says, never after the heading,\n // which a stylesheet sets in capitals that Chromium would put in the name.\n <form aria-label={state.properties.heading} data-report-part=\"properties\" onSubmit={(event) => event.preventDefault()}>\n {state.properties.fields.map((field, at) => {\n const id = `${ids}-field-${at}`\n const error = `${id}-error`\n const validity: Validity = field.error === undefined ? {} : { 'aria-invalid': true, 'aria-describedby': error }\n return (\n // A draft never outlives its field: leaving the field commits it, before anything else can be selected.\n <div key={field.key} data-report-part=\"property\" data-kind={field.kind}>\n <label htmlFor={id}>{field.label}</label>\n <Control field={field} id={id} validity={validity} commit={(value) => act({ type: 'setProperty', key: field.key, value })} />\n {field.error === undefined ? null : (\n <p id={error} data-report-part=\"property-error\">\n {field.error}\n </p>\n )}\n </div>\n )\n })}\n </form>\n )\n}\n","/**\n * The toolbar: undo and redo, the structural actions on the selection, the\n * zoom, and the panes a narrow screen shows one at a time.\n *\n * One tab stop for the whole bar, the arrow keys moving within it, as the\n * ARIA toolbar pattern has it. A tool with nothing to act on is\n * `aria-disabled` rather than `disabled`: it stays where focus is, so the\n * person who just pressed Redo for the last time keeps their place, and\n * pressing it again says why nothing happened instead of doing nothing.\n */\nimport { useRef, useState } from 'react'\nimport type { KeyboardEvent, ReactElement } from 'react'\nimport type { EditorAction, EditorPanel, EditorState, EditorText } from '@formancy/report-builder-core'\n\n/** What activating a tool does: an action for the editor, the place dialog for the selection, or a pane. */\ntype Use = { readonly action: EditorAction } | { readonly placeSelection: true } | { readonly pane: EditorPanel }\n\ninterface Tool {\n readonly name: string\n readonly use: Use\n readonly available: boolean\n /** Said as its description: what undo or redo would take back. */\n readonly title?: string\n}\n\nexport interface ToolbarProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly act: (action: EditorAction) => void\n /** Opens the place dialog for the selection, focus to return to `from`. */\n readonly placeSelection: (from: HTMLElement) => void\n readonly showPane: (pane: EditorPanel) => void\n}\n\nfunction tools(state: EditorState, t: EditorText): { readonly before: readonly Tool[]; readonly zoom: readonly Tool[]; readonly panes: readonly Tool[] } {\n const { history, can } = state\n const act = (action: EditorAction): Use => ({ action })\n return {\n before: [\n { name: t('action.undo'), use: act({ type: 'undo' }), available: history.canUndo, ...(history.undoLabel === null ? {} : { title: t('action.undoWhat', { label: history.undoLabel }) }) },\n { name: t('action.redo'), use: act({ type: 'redo' }), available: history.canRedo, ...(history.redoLabel === null ? {} : { title: t('action.redoWhat', { label: history.redoLabel }) }) },\n { name: t('action.moveUp'), use: act({ type: 'moveUp' }), available: can.moveUp },\n { name: t('action.moveDown'), use: act({ type: 'moveDown' }), available: can.moveDown },\n { name: t('action.indent'), use: act({ type: 'indent' }), available: can.indent },\n { name: t('action.outdent'), use: act({ type: 'outdent' }), available: can.outdent },\n { name: t('action.moveTo'), use: { placeSelection: true }, available: can.moveTo },\n { name: t('action.duplicate'), use: act({ type: 'duplicate' }), available: can.duplicate },\n { name: t('action.delete'), use: act({ type: 'delete' }), available: can.delete },\n ],\n zoom: [\n { name: t('action.zoomOut'), use: act({ type: 'zoomOut' }), available: can.zoomOut },\n { name: t('action.zoomIn'), use: act({ type: 'zoomIn' }), available: can.zoomIn },\n { name: t('action.zoomReset'), use: act({ type: 'setZoom', zoom: 1 }), available: can.zoomReset },\n ],\n panes: [\n { name: t('pane.outline'), use: { pane: 'outline' }, available: true },\n { name: t('pane.canvas'), use: { pane: 'canvas' }, available: true },\n { name: t('pane.properties'), use: { pane: 'properties' }, available: true },\n { name: t('pane.problems'), use: { pane: 'diagnostics' }, available: true },\n ],\n }\n}\n\n/**\n * Which way the arrow keys step: the reading direction the page declares, so\n * → is \"next\" in a left-to-right page and \"previous\" in a right-to-left one.\n * A key held with a modifier is the browser's or the screen reader's, never\n * the toolbar's.\n */\nfunction step(event: KeyboardEvent<HTMLElement>, at: number, count: number): number | undefined {\n if (event.altKey || event.ctrlKey || event.metaKey) return undefined\n const forwards = event.currentTarget.closest('[dir]')?.getAttribute('dir') === 'rtl' ? -1 : 1\n switch (event.key) {\n case 'ArrowRight':\n return (at + forwards + count) % count\n case 'ArrowLeft':\n return (at - forwards + count) % count\n case 'Home':\n return 0\n case 'End':\n return count - 1\n default:\n return undefined\n }\n}\n\nexport function Toolbar({ state, t, act, placeSelection, showPane }: ToolbarProps): ReactElement {\n const [active, setActive] = useState(0)\n const buttons = useRef<(HTMLButtonElement | null)[]>([])\n const { before, zoom, panes } = tools(state, t)\n const all = [...before, ...zoom, ...panes]\n\n function use(tool: Tool, from: HTMLElement): void {\n if ('pane' in tool.use) return showPane(tool.use.pane)\n // Every other unavailable tool still asks, and the editor says why not;\n // this one has no component to place, only a table's column.\n if ('placeSelection' in tool.use) return tool.available ? placeSelection(from) : undefined\n act(tool.use.action)\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLElement>): void {\n const next = step(event, active, all.length)\n if (next === undefined) return\n event.preventDefault()\n buttons.current[next]?.focus()\n }\n\n const button = (tool: Tool, at: number): ReactElement => (\n <button\n key={tool.name}\n ref={(element) => {\n buttons.current[at] = element\n }}\n type=\"button\"\n tabIndex={at === active ? 0 : -1}\n aria-disabled={tool.available ? undefined : true}\n title={tool.title}\n onFocus={() => setActive(at)}\n onClick={(event) => use(tool, event.currentTarget)}\n >\n {tool.name}\n </button>\n )\n\n return (\n <div role=\"toolbar\" aria-label={t('toolbar.label')} data-report-part=\"toolbar\" className=\"wb-tools\" onKeyDown={onKeyDown}>\n {before.map((tool, at) => button(tool, at))}\n {button(zoom[0] as Tool, before.length)}\n {/* The zoom as a value, named. Off as a live region: the editor's own\n status line already says \"Zoom 125%.\" once, and an <output> is a\n live region of its own that would say it twice. */}\n <output aria-label={t('zoom.label')} aria-live=\"off\" data-report-part=\"zoom\">\n {state.zoomLabel}\n </output>\n {zoom.slice(1).map((tool, at) => button(tool, before.length + 1 + at))}\n {panes.map((tool, at) => button(tool, before.length + zoom.length + at))}\n </div>\n )\n}\n","/**\n * The editor's state as a React value.\n *\n * `editor.state()` is deeply frozen and stays the same object until\n * something changes, which is exactly the snapshot `useSyncExternalStore`\n * compares by identity, so React re-renders once per change and never\n * loops. The subscription is the whole of React's part: what the state\n * holds is report-builder-core's, shared with the Angular builder (plan\n * 11.4).\n */\nimport { useSyncExternalStore } from 'react'\nimport type { EditorState, ReportEditor } from '@formancy/report-builder-core'\n\n/** Re-renders the component on every change to `editor`'s state; unsubscribes when it unmounts or the editor is replaced. */\nexport function useEditorState(editor: ReportEditor): EditorState {\n return useSyncExternalStore(editor.subscribe, editor.state, editor.state)\n}\n","/**\n * The report builder for React: the workbench's three panes over one\n * report-builder-core editor -- the palette and the outline, the design\n * view, the properties and the problems -- with the toolbar above them and\n * the status line below.\n *\n * It renders the editor's state and dispatches what the person did; it\n * decides nothing the editor decides. Keys are `actionForKey`'s, places are\n * the editor's drop targets, words are its catalogue. What is React's is\n * the subscription (`useSyncExternalStore`), the DOM, and focus: where focus\n * goes after an action, which only the builder can know, because only it\n * knows which element the person was on.\n *\n * The document and its history live in the session, so unmounting this and\n * mounting another builder -- React or Angular -- over the same session\n * loses nothing, and leaves no subscription behind.\n */\nimport { useCallback, useId, useLayoutEffect, useMemo, useRef } from 'react'\nimport type { KeyboardEvent, ReactElement } from 'react'\nimport { actionForKey, editorText } from '@formancy/report-builder-core'\nimport type { DiagnosticEntry, DragSubject, DropTarget, EditorAction, EditorOutcome, EditorPanel, ReportEditor, Selection } from '@formancy/report-builder-core'\nimport type { ComponentKind } from '@formancy/report-spec'\nimport { Canvas } from './canvas.js'\nimport { Diagnostics } from './diagnostics.js'\nimport { Outline } from './outline.js'\nimport { Palette } from './palette.js'\nimport { Places } from './places.js'\nimport { usePointerDrag } from './pointer-drag.js'\nimport { Properties } from './properties.js'\nimport { Toolbar } from './toolbar.js'\nimport { useEditorState } from './use-editor-state.js'\n\nexport interface ReportBuilderProps {\n /**\n * The editor to render: one person's view of a report session. The\n * builder subscribes while it is mounted and never disposes the editor;\n * whoever created it does, once no builder shows it.\n */\n readonly editor: ReportEditor\n}\n\n/**\n * Where focus goes once the result of an action is drawn: the selection's\n * outline row, the place dialog this builder has just opened, the element\n * that opened it, or a pane.\n */\ntype FocusAfter = 'selection' | 'places' | 'opener' | EditorPanel\n\n/** A field that keeps its own keys: Ctrl+Z in it undoes typing, not the report, and its arrows move its caret. A checkbox has no typing to undo. */\nfunction keepsItsKeys(element: EventTarget): boolean {\n if (element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) return true\n return element instanceof HTMLInputElement && element.type !== 'checkbox'\n}\n\nexport function ReportBuilder({ editor }: ReportBuilderProps): ReactElement {\n const state = useEditorState(editor)\n const t = useMemo(() => editorText(state.locale), [state.locale])\n // Every id this builder mints starts here, so two builders on one page never share one.\n const ids = useId()\n const tree = useRef<HTMLDivElement>(null)\n const canvas = useRef<HTMLElement>(null)\n const sheet = useRef<HTMLDivElement>(null)\n const fields = useRef<HTMLDivElement>(null)\n const problemList = useRef<HTMLUListElement>(null)\n const root = useRef<HTMLElement>(null)\n const opener = useRef<HTMLElement | null>(null)\n /** What the place dialog was placing when it closed, for focus to find its palette entry. */\n const closed = useRef<DragSubject | null>(null)\n const wanted = useRef<FocusAfter | null>(null)\n\n const focus = useCallback((where: FocusAfter): void => {\n const selectedRow = (): HTMLElement | null => tree.current?.querySelector<HTMLElement>('[role=\"treeitem\"][aria-selected=\"true\"]') ?? null\n switch (where) {\n // After an action that leaves nothing selected -- an undo of an\n // insert -- the tree itself: a row given focus would select itself,\n // and the next Delete would delete what nobody chose.\n case 'selection':\n return (selectedRow() ?? tree.current)?.focus()\n // Shown from the toolbar: the tree's tab stop, as Tab would reach it.\n case 'outline':\n return (selectedRow() ?? tree.current?.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]') ?? tree.current)?.focus()\n case 'places':\n return root.current?.querySelector<HTMLElement>('[data-report-part=\"places\"] button')?.focus()\n // What opened the place dialog; when another builder opened it -- the\n // drag outlived the builder that started it -- the palette entry of\n // what is being placed, or what is being moved, which stay in the\n // outline pane the dialog floated over.\n case 'opener': {\n const subject = closed.current\n const from =\n opener.current ??\n (subject !== null && 'kind' in subject ? root.current?.querySelector<HTMLElement>(`[data-report-part=\"palette-item\"][data-kind=\"${subject.kind}\"]`) : null) ??\n selectedRow() ??\n tree.current\n opener.current = null\n closed.current = null\n return from?.focus()\n }\n case 'canvas':\n return canvas.current?.focus()\n case 'properties':\n return fields.current?.querySelector<HTMLElement>('input, select, textarea')?.focus()\n case 'diagnostics':\n // The list, not its first entry: what is said first is how many there are.\n return problemList.current?.focus()\n }\n }, [])\n\n // After a render, the focus the action that caused it asked for: only now\n // is the row it selected, or the pane it opened, in the document.\n useLayoutEffect(() => {\n const where = wanted.current\n if (where === null) return\n wanted.current = null\n focus(where)\n })\n\n /** Dispatches `action`; when it succeeds, focus goes to `then` -- at once if nothing changed, else once the change is drawn. */\n function act(action: EditorAction, then?: FocusAfter): EditorOutcome {\n const before = editor.state()\n const outcome = editor.dispatch(action)\n if (then === undefined || !outcome.ok) return outcome\n if (editor.state() === before) focus(then)\n else wanted.current = then\n return outcome\n }\n\n const drag = usePointerDrag(editor, { tree, canvas, sheet }, () => {\n wanted.current = 'selection'\n })\n\n function onKeyDown(event: KeyboardEvent<HTMLElement>): void {\n if (event.defaultPrevented || keepsItsKeys(event.target)) return\n const inTree = tree.current?.contains(event.target as Node) === true\n const action = actionForKey(event, inTree ? 'outline' : 'editor', state.drag !== null)\n if (action === undefined) return\n event.preventDefault()\n if (action.type === 'cancelDrag' && state.drag?.via === 'keyboard') return cancelPlaces()\n act(action, inTree ? 'selection' : undefined)\n }\n\n /**\n * Opens the place dialog for `subject`, focus to return to `from`, and\n * puts focus on its first place. Only here: a dialog that opened in\n * another builder -- the drag is the editor's, and outlives a builder --\n * is drawn by this one without taking the keyboard from where it is. It\n * floats over the outline pane, so that is the pane a narrow screen shows.\n */\n function openPlaces(subject: DragSubject, from: HTMLElement): void {\n opener.current = from\n if (!act({ type: 'startDrag', subject, via: 'keyboard' }).ok) {\n opener.current = null\n return\n }\n act({ type: 'openPanel', panel: 'outline' })\n // The drag began, so the dialog is drawn next: focus goes there then.\n wanted.current = 'places'\n }\n\n /** Closes the place dialog, Cancel or Escape, focus back to what opened it. */\n function cancelPlaces(): void {\n closed.current = editor.state().drag?.subject ?? null\n act({ type: 'cancelDrag' }, 'opener')\n }\n\n function place(kind: ComponentKind, from: HTMLElement): void {\n openPlaces({ kind }, from)\n }\n\n function placeSelection(from: HTMLElement): void {\n // The toolbar offers this only while `can.moveTo`, which holds only for a selected component.\n openPlaces({ id: (state.selection as Selection).id }, from)\n }\n\n function choose(subject: DragSubject, target: DropTarget): void {\n act('kind' in subject ? { type: 'insert', kind: subject.kind, target: target.location } : { type: 'move', id: subject.id, target: target.location }, 'selection')\n }\n\n function follow(entry: DiagnosticEntry): void {\n const { target } = entry\n if (target === null) act({ type: 'select', id: null })\n else act(target.column === undefined ? { type: 'select', id: target.id } : { type: 'select', id: target.id, column: target.column }, 'selection')\n }\n\n const choosing = state.drag?.via === 'keyboard' ? state.drag : null\n const count = state.diagnostics.length\n\n return (\n <section ref={root} aria-label={t('editor.label')} className=\"wb\" data-report-part=\"editor\" data-panel={state.panel} onKeyDown={onKeyDown}>\n {/* A bar across the panes: report-builder.css spans every root child that is no pane. */}\n <div className=\"wb-pane\">\n <header>\n <span data-report-part=\"title\">{state.document.title}</span>\n <Toolbar state={state} t={t} act={act} placeSelection={placeSelection} showPane={(pane) => act({ type: 'openPanel', panel: pane }, pane)} />\n </header>\n </div>\n\n {/* The place dialog floats over this pane: the canvas beside it stays\n in view, with the place the dialog's focus is on marked. */}\n <section className=\"wb-pane\" data-pane=\"outline\">\n <header>{t('pane.outline')}</header>\n <div className=\"wb-body\">\n <Palette state={state} t={t} ids={ids} drag={drag} place={place} />\n <Outline state={state} t={t} ids={ids} tree={tree} drag={drag} act={act} />\n </div>\n {choosing === null ? null : <Places state={state} drag={choosing} t={t} ids={ids} act={act} choose={choose} cancel={cancelPlaces} />}\n </section>\n\n <section className=\"wb-pane wb-canvas\" data-pane=\"canvas\">\n <header>{t('pane.canvas')}</header>\n <div className=\"wb-body\">\n <Canvas state={state} t={t} canvas={canvas} sheet={sheet} drag={drag} select={(action) => act(action, 'selection')} />\n </div>\n </section>\n\n {/* The properties and the problems share the third column. On a narrow\n screen report-builder.css shows the one pane `data-panel` names, so\n this column says it is whichever of its two is asked for, and each\n half carries its own name for the other to be hidden by. */}\n <section className=\"wb-pane\" data-pane={state.panel === 'diagnostics' ? 'diagnostics' : 'properties'}>\n <header data-pane=\"properties\">\n <span>{state.properties.heading}</span>\n {state.selection === null ? null : (\n <button type=\"button\" onClick={() => act({ type: 'select', id: null }, 'properties')}>\n {t('properties.report')}\n </button>\n )}\n </header>\n <div ref={fields} className=\"wb-body\" data-pane=\"properties\">\n <Properties state={state} ids={ids} act={act} />\n </div>\n <header data-pane=\"diagnostics\">\n {/* A status, so a change in how many problems there are is said\n without taking the person's place: \"Problems 2\". Named in\n words, never after its own heading, which the Studio sets in\n capitals that Chromium would put in the name. */}\n <div role=\"status\" aria-label={t('pane.problems')}>\n <span>{t('pane.problems')}</span>\n {count === 0 ? null : (\n <>\n {' '}\n <span data-report-part=\"badge\" data-severity={state.diagnostics.some((entry) => entry.severity === 'error') ? 'error' : 'warning'}>\n {count}\n </span>\n </>\n )}\n </div>\n </header>\n <div className=\"wb-body\" data-pane=\"diagnostics\">\n <Diagnostics state={state} t={t} ids={ids} list={problemList} follow={follow} />\n </div>\n </section>\n\n <div className=\"wb-pane\">\n {/* The editor's announcements. Each is a new child, so the same words\n said twice -- \"Nothing to undo.\" -- are two announcements, as the\n state's sequence number means them to be. */}\n <p role=\"status\" data-report-part=\"status\">\n {state.status.text === '' ? null : <span key={state.status.sequence}>{state.status.text}</span>}\n </p>\n </div>\n </section>\n )\n}\n"],"mappings":";;;;;AA+BA,SAAS,OAAO,KAAyB;CACvC,OAAO;EAAE,MAAM,IAAI;EAAG,KAAK,IAAI;EAAG,OAAO,IAAI;EAAO,QAAQ,IAAI;CAAO;AACzE;AAEA,SAAS,MAAM,EAAE,aAAa,OAAO,QAAQ,SAAmK;CAC9M,MAAM,SAAS,gBAAgB;CAC/B,OACE,oBAAC,OAAD;EAAK,MAAK;EAAM,cAAY;EAAO,oBAAiB;EAAQ,oBAAkB;EAAa,OAAO,SAAS,EAAE,OAAO,OAAO,IAAI,EAAE,QAAQ,OAAO;EAC7I,UAAA,MAAM,KAAK,SACV,oBAAC,QAAD;GAAoB,oBAAiB;GAAa,cAAY,KAAK,QAAQ,SAAS,KAAA;GAAW,OAAO,SAAS,EAAE,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,KAAK,GAAG;GAC/I,UAAA,KAAK,UAAU,KAAA,IAAY,OAAO,oBAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA;EACvD,GAFK,KAAK,EAEV,CACP;CACE,CAAA;AAET;AAEA,SAASA,YAAU,KAA8B;CAC/C,OAAO,IAAI,WAAW,KAAA,IAAY;EAAE,MAAM;EA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AD;QAAM,oBAAiB;QAAQ,iBAAe,MAAM,YAAY,MAAM,UAAU,MAAM,aAAa,OAAO,IAAI,UAAU;QACrH,UAAA;OACG,CAAA,CACN,EAAA,CAAA,CAED;;KACC,CAAA;KACR,oBAAC,OAAD;MAAK,WAAU;MAAU,aAAU;MACjC,UAAA,oBAAC,aAAD;OAAoB;OAAU;OAAQ;OAAK,MAAM;OAAqB;MAAS,CAAA;KAC5E,CAAA;IACE;;GAET,oBAAC,OAAD;IAAK,WAAU;IAIb,UAAA,oBAAC,KAAD;KAAG,MAAK;KAAS,oBAAiB;KAC/B,UAAA,MAAM,OAAO,SAAS,KAAK,OAAO,oBAAC,QAAD,EAAA,UAAmC,MAAM,OAAO,KAAW,GAAhD,MAAM,OAAO,QAAmC;IAC7F,CAAA;GACA,CAAA;EACE;;AAEb"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["selection"],"sources":["../src/canvas.tsx","../src/diagnostics.tsx","../src/image-chooser.tsx","../src/image-library.tsx","../src/outline.tsx","../src/palette.tsx","../src/places.tsx","../src/pointer-drag.ts","../src/properties.tsx","../src/toolbar.tsx","../src/use-editor-state.ts","../src/report-builder.tsx"],"sourcesContent":["/**\n * The design view: one sheet as wide as the page, the regions as bands on it,\n * a box per component and table column, a payment part's band at its foot,\n * rulers in millimetres, and while something is being placed, an indicator\n * at every place it may go.\n *\n * It draws the state's geometry and decides none: every left, top, width and\n * height is a number report-builder-core computed in pixels at the zoom. It\n * is labelled as not the PDF, because it is not -- the renderer measures text\n * and breaks pages, and the preview shows what prints.\n *\n * Each box is a picture of where a component stands -- `role=\"img\"`, named\n * by its label, so reading the view says what is on it. A click selects; a\n * box is not a tab stop, because the outline is the keyboard's way to every\n * box and two ways to the same place would double the tabbing. The view\n * itself is one stop, so a keyboard can scroll it.\n */\nimport type { CSSProperties, ReactElement, Ref } from 'react'\nimport type { Box, CanvasBox, EditorAction, EditorState, EditorText, RulerTick } from '@formancy/report-builder-core'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface CanvasProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly canvas: Ref<HTMLElement>\n readonly sheet: Ref<HTMLDivElement>\n readonly drag: PointerDrag\n /** Selects a box, focus to follow to its outline row. */\n readonly select: (action: EditorAction) => void\n}\n\n/** A box's place on the sheet: physical left and top, because a page's coordinates run from its top-left whatever the language. */\nfunction placed(box: Box): CSSProperties {\n return { left: box.x, top: box.y, width: box.width, height: box.height }\n}\n\nfunction Ruler({ orientation, ticks, length, label }: { readonly orientation: 'horizontal' | 'vertical'; readonly ticks: readonly RulerTick[]; readonly length: number; readonly label: string }): ReactElement {\n const across = orientation === 'horizontal'\n return (\n <div role=\"img\" aria-label={label} data-report-part=\"ruler\" data-orientation={orientation} style={across ? { width: length } : { height: length }}>\n {ticks.map((tick) => (\n <span key={tick.mm} data-report-part=\"ruler-tick\" data-major={tick.major ? 'true' : undefined} style={across ? { left: tick.at } : { top: tick.at }}>\n {tick.label === undefined ? null : <span>{tick.label}</span>}\n </span>\n ))}\n </div>\n )\n}\n\nfunction selection(box: CanvasBox): EditorAction {\n return box.column === undefined ? { type: 'select', id: box.id } : { type: 'select', id: box.id, column: box.column }\n}\n\nexport function Canvas({ state, t, canvas: canvasRef, sheet: sheetRef, drag, select }: CanvasProps): ReactElement {\n const { canvas, drag: placing, dropTargets } = state\n const moving = placing !== null && 'id' in placing.subject ? placing.subject.id : undefined\n return (\n <section ref={canvasRef} aria-label={canvas.label} data-report-part=\"canvas\" tabIndex={0}>\n <p data-report-part=\"canvas-note\">{canvas.note}</p>\n <Ruler orientation=\"horizontal\" ticks={canvas.rulers.horizontal} length={canvas.sheet.px.width} label={t('ruler.horizontal')} />\n <Ruler orientation=\"vertical\" ticks={canvas.rulers.vertical} length={canvas.sheet.px.height} label={t('ruler.vertical')} />\n <div ref={sheetRef} data-report-part=\"sheet\" style={{ width: canvas.sheet.px.width, height: canvas.sheet.px.height }}>\n {canvas.regions.map((region) => (\n <div key={region.region} data-report-part=\"region\" data-empty={region.empty ? 'true' : undefined} style={placed(region.px)}>\n <span data-report-part=\"region-label\">{region.label}</span>\n </div>\n ))}\n {canvas.boxes.map((box) => (\n <div\n key={box.key}\n role=\"img\"\n aria-label={box.label}\n data-report-part=\"box\"\n data-kind={box.kind}\n data-selected={box.selected ? 'true' : undefined}\n data-overflows={box.overflows ? 'true' : undefined}\n data-dragging={box.column === undefined && box.id === moving ? 'true' : undefined}\n title={box.overflows ? t('canvas.overflow') : undefined}\n style={placed(box.px)}\n onPointerDown={(event) => {\n if (box.column === undefined) drag.press(event, { id: box.id })\n }}\n onClick={() => {\n if (!drag.swallowClick()) select(selection(box))\n }}\n >\n <span data-report-part=\"box-label\">{box.label}</span>\n {box.problems > 0 ? (\n <span data-report-part=\"badge\" data-severity={box.severity} aria-hidden=\"true\">\n {box.problems}\n </span>\n ) : null}\n </div>\n ))}\n {/* Where a payment part's slip prints, below every region: a\n picture named as SIX names the part, as a box is named by its\n label. */}\n {canvas.paymentPart === null ? null : (\n <div role=\"img\" aria-label={canvas.paymentPart.label} data-report-part=\"payment-part\" style={placed(canvas.paymentPart.px)}>\n <span data-report-part=\"region-label\">{canvas.paymentPart.label}</span>\n </div>\n )}\n {/* Drawn only for the places the session accepts, named as the place\n dialog names them; the one under the pointer, or focused in the\n dialog, is marked. */}\n {placing === null\n ? null\n : dropTargets.map((target) => (\n <div key={target.index} role=\"img\" aria-label={target.label} data-report-part=\"drop-indicator\" data-over={placing.over === target.index ? 'true' : undefined} style={placed(target.px)} />\n ))}\n </div>\n </section>\n )\n}\n","/**\n * The problems: report-core's diagnostics, each a button named \"Error:\n * Introduction\" and described by report-core's sentence. Activating one\n * selects what it is about, and the builder moves focus to its outline row;\n * one about the report as a whole selects nothing, which shows the report's\n * own properties.\n *\n * Each entry is keyed by what it is (`DiagnosticEntry.key`), never by its\n * place in the list: a problem listed before the one the keyboard is on\n * leaves that one's button, and the keyboard, where they were.\n */\nimport type { ReactElement, Ref } from 'react'\nimport type { DiagnosticEntry, EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface DiagnosticsProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly ids: string\n readonly list: Ref<HTMLUListElement>\n readonly follow: (entry: DiagnosticEntry) => void\n}\n\nexport function Diagnostics({ state, t, ids, list, follow }: DiagnosticsProps): ReactElement {\n return (\n <>\n {/* Not a tab stop: the problems pane's button moves focus here, to say\n how many there are. Named in words, as the pane's heading says. */}\n <ul ref={list} aria-label={t('pane.problems')} data-report-part=\"diagnostics\" tabIndex={-1}>\n {state.diagnostics.map((entry, at) => {\n const message = `${ids}-problem-${at}`\n return (\n <li key={entry.key} data-report-part=\"diagnostic\" data-severity={entry.severity}>\n <button type=\"button\" aria-describedby={message} onClick={() => follow(entry)}>\n {entry.label}\n </button>\n <div id={message}>{entry.message}</div>\n </li>\n )\n })}\n </ul>\n {state.diagnostics.length === 0 ? <p>{t('problems.none')}</p> : null}\n </>\n )\n}\n","/**\n * Add image…: the palette's last button, where the host keeps images\n * (0033), and the file input it opens, hidden beside it.\n *\n * The button sends `chooseImage` and, when the editor will take a file\n * now, calls the input's `click()` at once, in the same activation -- a\n * click, Enter or Space -- which opens the platform's chooser; awaiting\n * anything first would lose the activation, and the browser would open\n * nothing. The input is outside the accessibility tree and never has\n * focus: the keyboard stays on the button throughout.\n *\n * On the input's change the file is taken into a local before `value` is\n * cleared, because in a browser clearing it empties `files`; it is cleared\n * so that the same file chosen again is a change again. A chooser closed\n * without a file changes nothing, and nothing is sent. What the file is,\n * and whether it is added, is the editor's to say, in the live region.\n */\nimport { useRef } from 'react'\nimport type { ReactElement } from 'react'\nimport type { EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface ImageChooserProps {\n readonly state: EditorState\n readonly t: EditorText\n /** Prefix for the element ids this pane mints, unique to its builder. */\n readonly ids: string\n /** Sends `chooseImage`: whether the editor takes a file now, else it has said why not. */\n readonly choose: () => boolean\n /** Hands the editor the file a person chose. */\n readonly add: (file: File) => void\n}\n\nexport function ImageChooser({ state, t, ids, choose, add }: ImageChooserProps): ReactElement | null {\n const input = useRef<HTMLInputElement>(null)\n const { images } = state\n if (!images.store) return null\n const why = `${ids}-unavailable-add-image`\n return (\n <>\n <button\n type=\"button\"\n data-report-part=\"palette-item\"\n aria-disabled={state.can.addImage ? undefined : true}\n aria-describedby={images.unavailable === undefined ? undefined : why}\n aria-busy={images.adding === null ? undefined : true}\n onClick={() => {\n if (choose()) input.current?.click()\n }}\n >\n {t('images.add')}\n {images.unavailable === undefined ? null : (\n <span id={why} hidden>\n {images.unavailable}\n </span>\n )}\n </button>\n <input\n ref={input}\n type=\"file\"\n hidden\n accept={images.accept}\n onChange={(event) => {\n const chosen = event.currentTarget\n const file = chosen.files?.[0]\n chosen.value = ''\n if (file !== undefined) add(file)\n }}\n />\n </>\n )\n}\n","/**\n * The report's images, listed under its own properties (0033): a group\n * named by the catalogue, with a row per image the report declares -- its\n * label as text, and a Remove named after the image.\n *\n * A Remove whose image something draws is `aria-disabled`, described by\n * what draws it, and still sends `removeImage`, so the live region says\n * why nothing happened. One that removed its image takes its own button\n * away, so the builder puts the keyboard on the first field, as the way\n * back to the report's properties does.\n */\nimport type { ReactElement } from 'react'\nimport type { EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface ImageLibraryProps {\n readonly state: EditorState\n readonly t: EditorText\n /** Prefix for the element ids this pane mints, unique to its builder. */\n readonly ids: string\n readonly remove: (asset: string) => void\n}\n\nexport function ImageLibrary({ state, t, ids, remove }: ImageLibraryProps): ReactElement | null {\n const { assets } = state.images\n if (assets.length === 0) return null\n return (\n <div role=\"group\" aria-label={t('images.heading')}>\n {assets.map((image, at) => {\n const why = `${ids}-image-${String(at)}-in-use`\n return (\n <div key={image.id} data-report-part=\"property\">\n <span>{image.label}</span>\n <button type=\"button\" aria-label={image.removeLabel} aria-disabled={image.inUse === undefined ? undefined : true} aria-describedby={image.inUse === undefined ? undefined : why} onClick={() => remove(image.id)}>\n {t('images.remove')}\n {image.inUse === undefined ? null : (\n <span id={why} hidden>\n {image.inUse}\n </span>\n )}\n </button>\n </div>\n )\n })}\n </div>\n )\n}\n","/**\n * The outline: the report as an ARIA tree, a group per region and a row per\n * component or table column; with no row at all, an empty tree and the\n * sentence that says so.\n *\n * Rows are flat within their region and nest by `aria-level`, which is also\n * what report-builder.css indents by, so the nesting drawn and the nesting\n * announced cannot disagree. One row is a tab stop -- the selected one, or\n * the first -- and focus follows the selection: moving focus to a row\n * selects it, and every action that selects moves focus to its row. The\n * keys are report-builder-core's `actionForKey`, which the builder applies\n * to the whole tree; nothing here decides a key.\n */\nimport type { ReactElement, Ref } from 'react'\nimport type { EditorAction, EditorState, EditorText, OutlineNode } from '@formancy/report-builder-core'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface OutlineProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly ids: string\n readonly tree: Ref<HTMLDivElement>\n readonly drag: PointerDrag\n readonly act: (action: EditorAction) => void\n}\n\n/** A node with its place among its siblings, for `aria-posinset` and `aria-setsize`. */\ninterface Row {\n readonly node: OutlineNode\n readonly position: number\n readonly siblings: number\n}\n\nfunction rows(nodes: readonly OutlineNode[], into: Row[] = []): Row[] {\n nodes.forEach((node, at) => {\n into.push({ node, position: at + 1, siblings: nodes.length })\n rows(node.children, into)\n })\n return into\n}\n\n/** The ids of what describes a row: how many problems it has, and that it is wider than its place. */\nfunction described(node: OutlineNode, problems: string, overflow: string): string | undefined {\n const ids = [...(node.problems > 0 ? [problems] : []), ...(node.overflows ? [overflow] : [])]\n return ids.length === 0 ? undefined : ids.join(' ')\n}\n\nfunction selection(node: OutlineNode): EditorAction {\n return node.column === undefined ? { type: 'select', id: node.id } : { type: 'select', id: node.id, column: node.column }\n}\n\nexport function Outline({ state, t, ids, tree, drag, act }: OutlineProps): ReactElement {\n const regions = state.outline.map((region) => ({ region, rows: rows(region.nodes) }))\n const all = regions.flatMap((region) => region.rows)\n // The tree's one tab stop: the selected row, else the first; the tree itself when it has none.\n const stop = all.find((row) => row.node.selected)?.node.key ?? all[0]?.node.key\n const empty = `${ids}-outline-empty`\n\n // With no row at all the tree holds nothing -- a tree owns rows, and a\n // region's name with none under it is not one -- and is itself the tab\n // stop, described by the sentence beside it. With rows it still takes\n // focus from a script, never from Tab: where focus goes when an action\n // leaves nothing selected, since focusing a row would select it.\n if (stop === undefined) {\n return (\n <>\n <div ref={tree} role=\"tree\" aria-label={t('pane.outline')} aria-describedby={empty} data-report-part=\"outline\" tabIndex={0} />\n <p id={empty} data-report-part=\"outline-empty\">\n {t('outline.empty')}\n </p>\n </>\n )\n }\n\n return (\n <div ref={tree} role=\"tree\" aria-label={t('pane.outline')} data-report-part=\"outline\" tabIndex={-1}>\n {regions.map(({ region, rows: list }) => {\n return (\n // Named in the editor's words, not after the label drawn in it:\n // Chromium would put report-builder.css's capitals into that name,\n // \"BODY\". The label is hidden from the tree, which would read it\n // again as a text among the group's rows.\n <div key={region.region} role=\"group\" aria-label={region.label} data-report-part=\"outline-region\">\n <span data-report-part=\"region-label\" aria-hidden=\"true\">\n {region.label}\n </span>\n {list.length === 0 ? <span>{t('outline.empty')}</span> : null}\n {list.map(({ node, position, siblings }) => {\n const problems = `${ids}-problems-${node.key}`\n const overflow = `${ids}-overflow-${node.key}`\n return (\n <div\n key={node.key}\n ref={(element) => drag.row(element, node)}\n role=\"treeitem\"\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-selected={node.selected}\n aria-describedby={described(node, problems, overflow)}\n tabIndex={node.key === stop ? 0 : -1}\n data-report-part=\"outline-item\"\n data-kind={node.kind}\n onPointerDown={(event) => {\n if (node.column === undefined) drag.press(event, { id: node.id })\n }}\n onFocus={() => {\n if (!node.selected) act(selection(node))\n }}\n onClick={() => {\n if (!drag.swallowClick()) act(selection(node))\n }}\n >\n {node.label}\n {node.problems > 0 ? (\n <>\n {/* The count is drawn, and said as the row's description:\n inside the name it would make \"Introduction\" read\n \"Introduction 1\". */}\n <span data-report-part=\"badge\" data-severity={node.severity} aria-hidden=\"true\">\n {node.problems}\n </span>\n <span id={problems} hidden>\n {t('outline.problems', { count: node.problems })}\n </span>\n </>\n ) : null}\n {/* What the canvas marks on a box too wide for its place,\n said where a keyboard is: on its row. */}\n {node.overflows ? (\n <span id={overflow} hidden>\n {t('canvas.overflow')}\n </span>\n ) : null}\n </div>\n )\n })}\n </div>\n )\n })}\n </div>\n )\n}\n","/**\n * The palette: one button per kind of component the format has.\n *\n * Activating one -- a click, Enter or Space -- opens the place dialog for\n * that kind, the keyboard path every drag has. Pressing one and moving is\n * the pointer path to the same places. An entry the report cannot hold yet\n * (an image with nothing to draw) stays in the list, `aria-disabled` and\n * described by what to declare first, so it is found rather than missed.\n * Where the host keeps images, Add image… stands last (`chooser`, 0033).\n */\nimport type { ReactElement, ReactNode } from 'react'\nimport type { EditorState, EditorText } from '@formancy/report-builder-core'\nimport type { ComponentKind } from '@formancy/report-spec'\nimport type { PointerDrag } from './pointer-drag.js'\n\nexport interface PaletteProps {\n readonly state: EditorState\n readonly t: EditorText\n /** Prefix for the element ids this pane mints, unique to its builder. */\n readonly ids: string\n readonly drag: PointerDrag\n /** Opens the place dialog for a new component of `kind`, focus to return to `from`. */\n readonly place: (kind: ComponentKind, from: HTMLElement) => void\n /** Add image… and its file input, after the entries; nothing where the host keeps no images. */\n readonly chooser?: ReactNode\n}\n\nexport function Palette({ state, t, ids, drag, place, chooser }: PaletteProps): ReactElement {\n return (\n <div role=\"group\" aria-label={t('pane.palette')} data-report-part=\"palette\">\n {state.palette.map((entry) => {\n const why = `${ids}-unavailable-${entry.kind}`\n return (\n <button\n key={entry.kind}\n type=\"button\"\n data-report-part=\"palette-item\"\n data-kind={entry.kind}\n aria-disabled={entry.component === null ? true : undefined}\n aria-describedby={entry.unavailable === undefined ? undefined : why}\n onPointerDown={(event) => drag.press(event, { kind: entry.kind })}\n onClick={(event) => {\n if (!drag.swallowClick()) place(entry.kind, event.currentTarget)\n }}\n >\n {entry.label}\n {entry.unavailable === undefined ? null : (\n <span id={why} hidden>\n {entry.unavailable}\n </span>\n )}\n </button>\n )\n })}\n {chooser}\n </div>\n )\n}\n","/**\n * The place dialog: the keyboard path for every drag (formancy.ai 0046).\n *\n * While the editor's drag is `via: 'keyboard'` it lists the drag's targets\n * -- the places report-core's `validLocations` accepts, named \"Body, after\n * Introduction\" -- as buttons, and Cancel. Focus moves into it when this\n * builder opens it (the builder's `openPlaces`), never merely because it is\n * drawn: a dialog another builder opened stays where the keyboard left it.\n * The place focused is the one the canvas marks, so a sighted keyboard user\n * sees where each choice lands before making it. Escape cancels, through the\n * editor's own key map. Choosing a place, and cancelling, are the builder's\n * to finish: it knows where focus goes next.\n */\nimport type { ReactElement } from 'react'\nimport type { DragState, DropTarget, EditorAction, EditorState, EditorText } from '@formancy/report-builder-core'\n\nexport interface PlacesProps {\n readonly state: EditorState\n readonly drag: DragState\n readonly t: EditorText\n readonly ids: string\n readonly act: (action: EditorAction) => void\n readonly choose: (subject: DragState['subject'], target: DropTarget) => void\n readonly cancel: () => void\n}\n\nexport function Places({ state, drag, t, ids, act, choose, cancel }: PlacesProps): ReactElement {\n const nowhere = `${ids}-nowhere`\n\n return (\n // A floating pane of the workbench, so its buttons are the workbench's.\n // Named in the editor's words, as the header says, never after the\n // header, whose name a host's stylesheet could set in capitals.\n <div role=\"dialog\" aria-label={drag.title} aria-describedby={drag.nowhere === undefined ? undefined : nowhere} data-report-part=\"places\" className=\"wb-pane\">\n <header>{drag.title}</header>\n {drag.nowhere === undefined ? null : (\n <p id={nowhere} className=\"wb-problem\">\n {drag.nowhere}\n </p>\n )}\n {state.dropTargets.map((target) => (\n <button\n key={target.index}\n type=\"button\"\n data-report-part=\"place\"\n onFocus={() => act({ type: 'updateDrag', over: target.index })}\n onClick={() => choose(drag.subject, target)}\n >\n {target.label}\n </button>\n ))}\n <button type=\"button\" onClick={cancel}>\n {t('places.cancel')}\n </button>\n </div>\n )\n}\n","/**\n * Dragging with a pointer: a palette entry, a box on the canvas or an outline\n * row, dropped on the canvas or beside an outline row.\n *\n * The drag itself is the editor's state machine (`startDrag`, `updateDrag`,\n * `drop`, `cancelDrag`), and where a drop may land is its `dropTargets`,\n * which are report-core's `validLocations`; this file only turns pointer\n * positions into a target's index with `targetNear` and `targetBeside`. So a\n * pointer is never offered a place the session would refuse, and the\n * keyboard path -- the place dialog -- offers exactly the same places\n * (formancy.ai 0046: every drag has a keyboard path, built first).\n *\n * A press becomes a drag only once it has moved, so a click stays a click:\n * activating a palette entry opens the place dialog, and clicking a box\n * selects it. Mouse and pen drag; a touch scrolls, as the page needs it to,\n * and a tap is a click.\n */\nimport { useEffect, useRef } from 'react'\nimport type { PointerEvent as ReactPointerEvent, RefObject } from 'react'\nimport { targetBeside, targetNear } from '@formancy/report-builder-core'\nimport type { DragSubject, OutlineNode, ReportEditor } from '@formancy/report-builder-core'\n\n/**\n * How far a press may wander, in CSS pixels, and still be a click: Windows'\n * default drag rectangle (`SM_CXDRAG`, `SM_CYDRAG`), which is what a person\n * on that system already has in their hands. A convention, not a measurement.\n */\nconst DRAG_DISTANCE = 4\n\n/** Where a drag can land: the outline's tree, and the canvas with its sheet. */\nexport interface DropZones {\n readonly tree: RefObject<HTMLElement | null>\n readonly canvas: RefObject<HTMLElement | null>\n readonly sheet: RefObject<HTMLElement | null>\n}\n\nexport interface PointerDrag {\n /** Watches a press on something that can be dragged; it becomes a drag once it moves. */\n press(event: ReactPointerEvent<HTMLElement>, subject: DragSubject): void\n /** True, once, for the click a drag ended in, before any key or press: that click must not also select or open what it ended on. */\n swallowClick(): boolean\n /** Remembers which node an outline row draws, so a drag over the row can find the places beside it. */\n row(element: HTMLElement | null, node: OutlineNode): void\n}\n\ninterface Press {\n readonly subject: DragSubject\n readonly x: number\n readonly y: number\n}\n\nexport function usePointerDrag(editor: ReportEditor, zones: DropZones, placed: () => void): PointerDrag {\n const pressed = useRef<Press | null>(null)\n const dragging = useRef(false)\n const swallow = useRef(false)\n const rows = useRef(new WeakMap<Element, OutlineNode>())\n // The latest of each, read when an event arrives, so a re-render never\n // re-subscribes -- which would cancel a drag in flight.\n const onPlaced = useRef(placed)\n onPlaced.current = placed\n const where = useRef(zones)\n where.current = zones\n\n useEffect(() => {\n /** The target under the pointer: beside the outline row it is over, else the nearest on the sheet, else none. */\n function over(event: PointerEvent): number | null {\n const targets = editor.state().dropTargets\n const zones = where.current\n const at = event.target instanceof Element ? event.target : null\n if (at === null) return null\n const row = at.closest('[role=\"treeitem\"]')\n if (row !== null && zones.tree.current?.contains(row) === true) {\n const node = rows.current.get(row)\n if (node === undefined || node.column !== undefined) return null\n const box = row.getBoundingClientRect()\n return targetBeside(targets, node.id, event.clientY < box.top + box.height / 2 ? 'before' : 'after')\n }\n const sheet = zones.sheet.current\n if (sheet === null || zones.canvas.current?.contains(at) !== true) return null\n // The targets are in pixels from the sheet's padding edge, where its\n // absolutely placed children start: inside its border.\n const box = sheet.getBoundingClientRect()\n return targetNear(targets, { x: event.clientX - box.left - sheet.clientLeft, y: event.clientY - box.top - sheet.clientTop })\n }\n\n /** Forgets the press, and says whether it had become a drag the editor still holds. */\n function release(): boolean {\n const was = dragging.current && editor.state().drag?.via === 'pointer'\n pressed.current = null\n dragging.current = false\n return was\n }\n\n function onMove(event: PointerEvent): void {\n const press = pressed.current\n if (press === null) return\n if (!dragging.current) {\n if (Math.hypot(event.clientX - press.x, event.clientY - press.y) < DRAG_DISTANCE) return\n if (!editor.dispatch({ type: 'startDrag', subject: press.subject, via: 'pointer' }).ok) {\n pressed.current = null\n return\n }\n dragging.current = true\n }\n // Ended elsewhere -- Escape, or the subject deleted under it -- and not to be revived.\n if (editor.state().drag?.via !== 'pointer') {\n release()\n return\n }\n editor.dispatch({ type: 'updateDrag', over: over(event) })\n }\n\n function onUp(): void {\n if (!release()) return\n swallow.current = true\n // With nothing under the pointer the editor ends the drag and says nothing moved.\n if (editor.dispatch({ type: 'drop' }).ok) onPlaced.current()\n }\n\n function onCancel(): void {\n if (release()) editor.dispatch({ type: 'cancelDrag' })\n }\n\n // The click a drop ends in comes straight after the release, with no key\n // or press between. A drop that ended away from where it began ends in\n // no click on what it began on; a key or a new press then is the\n // person's next act, whose click is theirs to keep.\n function forget(): void {\n swallow.current = false\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onCancel)\n window.addEventListener('keydown', forget, true)\n window.addEventListener('pointerdown', forget, true)\n return () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onCancel)\n window.removeEventListener('keydown', forget, true)\n window.removeEventListener('pointerdown', forget, true)\n // A drag in flight belongs to the builder that started it.\n if (release()) editor.dispatch({ type: 'cancelDrag' })\n }\n }, [editor])\n\n return {\n press(event, subject) {\n swallow.current = false\n if (event.button !== 0 || event.pointerType === 'touch') return\n pressed.current = { subject, x: event.clientX, y: event.clientY }\n },\n swallowClick() {\n const was = swallow.current\n swallow.current = false\n return was\n },\n row(element, node) {\n if (element !== null) rows.current.set(element, node)\n },\n }\n}\n","/**\n * The properties: one native control per field of the selection, or of the\n * report when nothing is selected, each labelled by its field's label.\n *\n * Which control a field gets is `PROPERTY_ROLES`, report-builder-core's, so\n * the role a test finds and the role the Angular builder renders are the\n * same. A typed value is the person's until it is committed -- on leaving\n * the field, or Enter in a single-line one -- and a value the editor refuses\n * stays as typed, `aria-invalid`, with the reason beside it as its\n * description. Escape gives back what the report holds. Under the\n * report's own fields, its images (`library`, 0033).\n */\nimport { useState } from 'react'\nimport type { KeyboardEvent, ReactElement, ReactNode } from 'react'\nimport type { EditorAction, EditorState, EditorText, PropertyField } from '@formancy/report-builder-core'\n\nexport interface PropertiesProps {\n readonly state: EditorState\n readonly ids: string\n readonly act: (action: EditorAction) => void\n /** The report's images, after its fields; nothing while something is selected. */\n readonly library?: ReactNode\n}\n\n/** What the control states about validity: invalid, and why, when the field has an error. */\ninterface Validity {\n readonly 'aria-invalid'?: true\n readonly 'aria-describedby'?: string\n}\n\ninterface ControlProps {\n readonly field: PropertyField\n readonly id: string\n readonly validity: Validity\n readonly commit: (value: string | boolean) => void\n}\n\n/** A text, a colour, an expression, a number or a length: typed, then committed. */\nfunction Typed({ field, id, validity, commit }: ControlProps): ReactElement {\n const held = String(field.value)\n const [draft, setDraft] = useState<string | null>(null)\n const finish = (): void => {\n if (draft !== null && draft !== held) commit(draft)\n setDraft(null)\n }\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (event.key === 'Escape') setDraft(null)\n else if (event.key === 'Enter' && field.kind !== 'multiline') {\n event.preventDefault()\n finish()\n }\n }\n const shared = {\n id,\n value: draft ?? held,\n required: field.required,\n ...(field.placeholder === undefined ? {} : { placeholder: field.placeholder }),\n ...validity,\n onBlur: finish,\n onKeyDown,\n }\n if (field.kind === 'multiline') return <textarea {...shared} onChange={(event) => setDraft(event.target.value)} />\n const numeric = field.kind === 'number' || field.kind === 'length'\n return (\n <input\n {...shared}\n type={numeric ? 'number' : 'text'}\n // Any decimal the format stores, not the browser's whole-number default step.\n step={numeric ? 'any' : undefined}\n spellCheck={field.kind === 'text' ? undefined : false}\n onChange={(event) => setDraft(event.target.value)}\n />\n )\n}\n\nfunction Control(props: ControlProps): ReactElement {\n const { field, id, validity, commit } = props\n switch (field.kind) {\n case 'boolean':\n return <input id={id} type=\"checkbox\" checked={field.value === true} {...validity} onChange={(event) => commit(event.target.checked)} />\n case 'select':\n case 'binding':\n case 'style':\n return (\n <select id={id} value={String(field.value)} required={field.required} {...validity} onChange={(event) => commit(event.target.value)}>\n {(field.options ?? []).map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n )\n default:\n return <Typed {...props} />\n }\n}\n\nexport function Properties({ state, ids, act, library }: PropertiesProps): ReactElement {\n return (\n // Named in words, as the pane's heading says, never after the heading,\n // which a stylesheet sets in capitals that Chromium would put in the name.\n <form aria-label={state.properties.heading} data-report-part=\"properties\" onSubmit={(event) => event.preventDefault()}>\n {state.properties.fields.map((field, at) => {\n const id = `${ids}-field-${at}`\n const error = `${id}-error`\n const validity: Validity = field.error === undefined ? {} : { 'aria-invalid': true, 'aria-describedby': error }\n return (\n // A draft never outlives its field: leaving the field commits it, before anything else can be selected.\n <div key={field.key} data-report-part=\"property\" data-kind={field.kind}>\n <label htmlFor={id}>{field.label}</label>\n <Control field={field} id={id} validity={validity} commit={(value) => act({ type: 'setProperty', key: field.key, value })} />\n {field.error === undefined ? null : (\n <p id={error} data-report-part=\"property-error\">\n {field.error}\n </p>\n )}\n </div>\n )\n })}\n {library}\n </form>\n )\n}\n","/**\n * The toolbar: undo and redo, the structural actions on the selection, the\n * zoom, and the panes a narrow screen shows one at a time.\n *\n * One tab stop for the whole bar, the arrow keys moving within it, as the\n * ARIA toolbar pattern has it. A tool with nothing to act on is\n * `aria-disabled` rather than `disabled`: it stays where focus is, so the\n * person who just pressed Redo for the last time keeps their place, and\n * pressing it again says why nothing happened instead of doing nothing.\n */\nimport { useRef, useState } from 'react'\nimport type { KeyboardEvent, ReactElement } from 'react'\nimport type { EditorAction, EditorPanel, EditorState, EditorText } from '@formancy/report-builder-core'\n\n/** What activating a tool does: an action for the editor, the place dialog for the selection, or a pane. */\ntype Use = { readonly action: EditorAction } | { readonly placeSelection: true } | { readonly pane: EditorPanel }\n\ninterface Tool {\n readonly name: string\n readonly use: Use\n readonly available: boolean\n /** Said as its description: what undo or redo would take back. */\n readonly title?: string\n}\n\nexport interface ToolbarProps {\n readonly state: EditorState\n readonly t: EditorText\n readonly act: (action: EditorAction) => void\n /** Opens the place dialog for the selection, focus to return to `from`. */\n readonly placeSelection: (from: HTMLElement) => void\n readonly showPane: (pane: EditorPanel) => void\n}\n\nfunction tools(state: EditorState, t: EditorText): { readonly before: readonly Tool[]; readonly zoom: readonly Tool[]; readonly panes: readonly Tool[] } {\n const { history, can } = state\n const act = (action: EditorAction): Use => ({ action })\n return {\n before: [\n { name: t('action.undo'), use: act({ type: 'undo' }), available: history.canUndo, ...(history.undoLabel === null ? {} : { title: t('action.undoWhat', { label: history.undoLabel }) }) },\n { name: t('action.redo'), use: act({ type: 'redo' }), available: history.canRedo, ...(history.redoLabel === null ? {} : { title: t('action.redoWhat', { label: history.redoLabel }) }) },\n { name: t('action.moveUp'), use: act({ type: 'moveUp' }), available: can.moveUp },\n { name: t('action.moveDown'), use: act({ type: 'moveDown' }), available: can.moveDown },\n { name: t('action.indent'), use: act({ type: 'indent' }), available: can.indent },\n { name: t('action.outdent'), use: act({ type: 'outdent' }), available: can.outdent },\n { name: t('action.moveTo'), use: { placeSelection: true }, available: can.moveTo },\n { name: t('action.duplicate'), use: act({ type: 'duplicate' }), available: can.duplicate },\n { name: t('action.delete'), use: act({ type: 'delete' }), available: can.delete },\n ],\n zoom: [\n { name: t('action.zoomOut'), use: act({ type: 'zoomOut' }), available: can.zoomOut },\n { name: t('action.zoomIn'), use: act({ type: 'zoomIn' }), available: can.zoomIn },\n { name: t('action.zoomReset'), use: act({ type: 'setZoom', zoom: 1 }), available: can.zoomReset },\n ],\n panes: [\n { name: t('pane.outline'), use: { pane: 'outline' }, available: true },\n { name: t('pane.canvas'), use: { pane: 'canvas' }, available: true },\n { name: t('pane.properties'), use: { pane: 'properties' }, available: true },\n { name: t('pane.problems'), use: { pane: 'diagnostics' }, available: true },\n ],\n }\n}\n\n/**\n * Which way the arrow keys step: the reading direction the page declares, so\n * → is \"next\" in a left-to-right page and \"previous\" in a right-to-left one.\n * A key held with a modifier is the browser's or the screen reader's, never\n * the toolbar's.\n */\nfunction step(event: KeyboardEvent<HTMLElement>, at: number, count: number): number | undefined {\n if (event.altKey || event.ctrlKey || event.metaKey) return undefined\n const forwards = event.currentTarget.closest('[dir]')?.getAttribute('dir') === 'rtl' ? -1 : 1\n switch (event.key) {\n case 'ArrowRight':\n return (at + forwards + count) % count\n case 'ArrowLeft':\n return (at - forwards + count) % count\n case 'Home':\n return 0\n case 'End':\n return count - 1\n default:\n return undefined\n }\n}\n\nexport function Toolbar({ state, t, act, placeSelection, showPane }: ToolbarProps): ReactElement {\n const [active, setActive] = useState(0)\n const buttons = useRef<(HTMLButtonElement | null)[]>([])\n const { before, zoom, panes } = tools(state, t)\n const all = [...before, ...zoom, ...panes]\n\n function use(tool: Tool, from: HTMLElement): void {\n if ('pane' in tool.use) return showPane(tool.use.pane)\n // Every other unavailable tool still asks, and the editor says why not;\n // this one has no component to place, only a table's column.\n if ('placeSelection' in tool.use) return tool.available ? placeSelection(from) : undefined\n act(tool.use.action)\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLElement>): void {\n const next = step(event, active, all.length)\n if (next === undefined) return\n event.preventDefault()\n buttons.current[next]?.focus()\n }\n\n const button = (tool: Tool, at: number): ReactElement => (\n <button\n key={tool.name}\n ref={(element) => {\n buttons.current[at] = element\n }}\n type=\"button\"\n tabIndex={at === active ? 0 : -1}\n aria-disabled={tool.available ? undefined : true}\n title={tool.title}\n onFocus={() => setActive(at)}\n onClick={(event) => use(tool, event.currentTarget)}\n >\n {tool.name}\n </button>\n )\n\n return (\n <div role=\"toolbar\" aria-label={t('toolbar.label')} data-report-part=\"toolbar\" className=\"wb-tools\" onKeyDown={onKeyDown}>\n {before.map((tool, at) => button(tool, at))}\n {button(zoom[0] as Tool, before.length)}\n {/* The zoom as a value, named. Off as a live region: the editor's own\n status line already says \"Zoom 125%.\" once, and an <output> is a\n live region of its own that would say it twice. */}\n <output aria-label={t('zoom.label')} aria-live=\"off\" data-report-part=\"zoom\">\n {state.zoomLabel}\n </output>\n {zoom.slice(1).map((tool, at) => button(tool, before.length + 1 + at))}\n {panes.map((tool, at) => button(tool, before.length + zoom.length + at))}\n </div>\n )\n}\n","/**\n * The editor's state as a React value.\n *\n * `editor.state()` is deeply frozen and stays the same object until\n * something changes, which is exactly the snapshot `useSyncExternalStore`\n * compares by identity, so React re-renders once per change and never\n * loops. The subscription is the whole of React's part: what the state\n * holds is report-builder-core's, shared with the Angular builder (plan\n * 11.4).\n */\nimport { useSyncExternalStore } from 'react'\nimport type { EditorState, ReportEditor } from '@formancy/report-builder-core'\n\n/** Re-renders the component on every change to `editor`'s state; unsubscribes when it unmounts or the editor is replaced. */\nexport function useEditorState(editor: ReportEditor): EditorState {\n return useSyncExternalStore(editor.subscribe, editor.state, editor.state)\n}\n","/**\n * The report builder for React: the workbench's three panes over one\n * report-builder-core editor -- the palette and the outline, the design\n * view, the properties and the problems -- with the toolbar above them and\n * the status line below.\n *\n * It renders the editor's state and dispatches what the person did; it\n * decides nothing the editor decides. Keys are `actionForKey`'s, places are\n * the editor's drop targets, words are its catalogue. What is React's is\n * the subscription (`useSyncExternalStore`), the DOM, and focus: where focus\n * goes after an action, which only the builder can know, because only it\n * knows which element the person was on.\n *\n * The document and its history live in the session, so unmounting this and\n * mounting another builder -- React or Angular -- over the same session\n * loses nothing, and leaves no subscription behind.\n *\n * A host may give a view of its own -- the Studio's PDF -- which stands in\n * the design view's place while the editor says so (0029): a bare region,\n * named by the editor's `hostView`, holding what the host gave and nothing\n * of the builder's, its keys the host's.\n *\n * Where the host gave the editor a store for images, the palette ends with\n * Add image…, and the report's own properties list its images (0033): the\n * file a person chooses goes to `editor.addImage`, which says what became\n * of it; nothing here reads it.\n */\nimport { useCallback, useId, useLayoutEffect, useMemo, useRef } from 'react'\nimport type { KeyboardEvent, ReactElement, ReactNode } from 'react'\nimport { actionForKey, editorText } from '@formancy/report-builder-core'\nimport type { DiagnosticEntry, DragSubject, DropTarget, EditorAction, EditorOutcome, EditorPanel, HideablePanel, ReportEditor, Selection } from '@formancy/report-builder-core'\nimport type { ComponentKind } from '@formancy/report-spec'\nimport { Canvas } from './canvas.js'\nimport { Diagnostics } from './diagnostics.js'\nimport { ImageChooser } from './image-chooser.js'\nimport { ImageLibrary } from './image-library.js'\nimport { Outline } from './outline.js'\nimport { Palette } from './palette.js'\nimport { Places } from './places.js'\nimport { usePointerDrag } from './pointer-drag.js'\nimport { Properties } from './properties.js'\nimport { Toolbar } from './toolbar.js'\nimport { useEditorState } from './use-editor-state.js'\n\nexport interface ReportBuilderProps {\n /**\n * The editor to render: one person's view of a report session. The\n * builder subscribes while it is mounted and never disposes the editor;\n * whoever created it does, once no builder shows it.\n */\n readonly editor: ReportEditor\n /**\n * What the builder draws in the design view's place while the editor's\n * `view` is the host's: the host's own view, named by the editor's\n * `hostView`. The builder lends it the middle pane's box and a region's\n * name, none of report-builder.css's rules -- the workbench's `.wb *`\n * reaches it, turning transitions off under reduced motion -- and none of\n * its keys; it is mounted only while drawn.\n */\n readonly hostView?: ReactNode\n}\n\n/**\n * Where focus goes once the result of an action is drawn: the selection's\n * outline row, the place dialog this builder has just opened, the element\n * that opened it, or a pane.\n */\ntype FocusAfter = 'selection' | 'places' | 'opener' | EditorPanel\n\n/** A field that keeps its own keys: Ctrl+Z in it undoes typing, not the report, and its arrows move its caret. A checkbox has no typing to undo. */\nfunction keepsItsKeys(element: EventTarget): boolean {\n if (element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) return true\n return element instanceof HTMLInputElement && element.type !== 'checkbox'\n}\n\nexport function ReportBuilder({ editor, hostView }: ReportBuilderProps): ReactElement {\n const state = useEditorState(editor)\n const t = useMemo(() => editorText(state.locale), [state.locale])\n // Every id this builder mints starts here, so two builders on one page never share one.\n const ids = useId()\n const tree = useRef<HTMLDivElement>(null)\n const canvas = useRef<HTMLElement>(null)\n /** The host's view's region, while it stands in the design view's place. */\n const view = useRef<HTMLElement>(null)\n /** The last key press the host's view had first: React bubbles one from a portal the host opened there through the view, wherever the portal's DOM is. */\n const hostKey = useRef<Event | null>(null)\n /** The element the keyboard last stood on in this builder, for a middle pane swapped from under it to hand the keyboard on. */\n const lastFocused = useRef<EventTarget | null>(null)\n /** Whether that element stood in the properties form, for a row taken from under it to hand the keyboard to the first field. */\n const lastInProperties = useRef(false)\n const sheet = useRef<HTMLDivElement>(null)\n const fields = useRef<HTMLDivElement>(null)\n const problemList = useRef<HTMLUListElement>(null)\n const root = useRef<HTMLElement>(null)\n const opener = useRef<HTMLElement | null>(null)\n /** What the place dialog was placing when it closed, for focus to find its palette entry. */\n const closed = useRef<DragSubject | null>(null)\n const wanted = useRef<FocusAfter | null>(null)\n\n const focus = useCallback((where: FocusAfter): void => {\n const selectedRow = (): HTMLElement | null => tree.current?.querySelector<HTMLElement>('[role=\"treeitem\"][aria-selected=\"true\"]') ?? null\n switch (where) {\n // After an action that leaves nothing selected -- an undo of an\n // insert -- the tree itself: a row given focus would select itself,\n // and the next Delete would delete what nobody chose.\n case 'selection':\n return (selectedRow() ?? tree.current)?.focus()\n // Shown from the toolbar: the tree's tab stop, as Tab would reach it.\n case 'outline':\n return (selectedRow() ?? tree.current?.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]') ?? tree.current)?.focus()\n case 'places':\n return root.current?.querySelector<HTMLElement>('[data-report-part=\"places\"] button')?.focus()\n // What opened the place dialog; when another builder opened it -- the\n // drag outlived the builder that started it -- the palette entry of\n // what is being placed, or what is being moved, which stay in the\n // outline pane the dialog floated over.\n case 'opener': {\n const subject = closed.current\n const from =\n opener.current ??\n (subject !== null && 'kind' in subject ? root.current?.querySelector<HTMLElement>(`[data-report-part=\"palette-item\"][data-kind=\"${subject.kind}\"]`) : null) ??\n selectedRow() ??\n tree.current\n opener.current = null\n closed.current = null\n return from?.focus()\n }\n // The design view, or the host's view standing in its place.\n case 'canvas':\n return (canvas.current ?? view.current)?.focus()\n case 'properties':\n return fields.current?.querySelector<HTMLElement>('input, select, textarea')?.focus()\n case 'diagnostics':\n // The list, not its first entry: what is said first is how many there are.\n return problemList.current?.focus()\n }\n }, [])\n\n // After a render, the focus the action that caused it asked for: only now\n // is the row it selected, or the pane it opened, in the document.\n useLayoutEffect(() => {\n const where = wanted.current\n if (where === null) return\n wanted.current = null\n focus(where)\n })\n\n // The middle pane swapped by the host -- its view placed or shown from\n // outside, as the window crosses a width -- takes the keyboard along\n // rather than drop it on the page: where the element it stood on went\n // with the pane, and nothing has taken it since, it goes to what stands\n // in the middle now.\n useLayoutEffect(() => {\n const last = lastFocused.current\n const dropped = document.activeElement === null || document.activeElement === document.body\n if (last instanceof Node && !last.isConnected && dropped) focus('canvas')\n }, [state.view, focus])\n\n // An undo or a redo that takes away the row the keyboard stood on in the\n // properties -- an image's Remove, the add undone or the remove redone --\n // would leave it on the page: it goes to the first field, as a Remove\n // that worked sends it.\n useLayoutEffect(() => {\n const last = lastFocused.current\n const dropped = document.activeElement === null || document.activeElement === document.body\n if (lastInProperties.current && last instanceof Node && !last.isConnected && dropped) focus('properties')\n }, [state, focus])\n\n /** Dispatches `action`; when it succeeds, focus goes to `then` -- at once if nothing changed, else once the change is drawn. */\n function act(action: EditorAction, then?: FocusAfter): EditorOutcome {\n const before = editor.state()\n const outcome = editor.dispatch(action)\n if (then === undefined || !outcome.ok) return outcome\n if (editor.state() === before) focus(then)\n else wanted.current = then\n return outcome\n }\n\n const drag = usePointerDrag(editor, { tree, canvas, sheet }, () => {\n wanted.current = 'selection'\n })\n\n function onKeyDown(event: KeyboardEvent<HTMLElement>): void {\n // A key pressed in the host's view is the host's, as a text field's are its own.\n if (event.defaultPrevented || keepsItsKeys(event.target) || event.nativeEvent === hostKey.current) return\n const inTree = tree.current?.contains(event.target as Node) === true\n const action = actionForKey(event, inTree ? 'outline' : 'editor', state.drag !== null)\n if (action === undefined) return\n event.preventDefault()\n if (action.type === 'cancelDrag' && state.drag?.via === 'keyboard') return cancelPlaces()\n act(action, inTree ? 'selection' : undefined)\n }\n\n /**\n * Opens the place dialog for `subject`, focus to return to `from`, and\n * puts focus on its first place. Only here: a dialog that opened in\n * another builder -- the drag is the editor's, and outlives a builder --\n * is drawn by this one without taking the keyboard from where it is. It\n * floats over the outline pane, so that is the pane a narrow screen shows.\n */\n function openPlaces(subject: DragSubject, from: HTMLElement): void {\n opener.current = from\n if (!act({ type: 'startDrag', subject, via: 'keyboard' }).ok) {\n opener.current = null\n return\n }\n act({ type: 'openPanel', panel: 'outline' })\n // The drag began, so the dialog is drawn next: focus goes there then.\n wanted.current = 'places'\n }\n\n /** Closes the place dialog, Cancel or Escape, focus back to what opened it. */\n function cancelPlaces(): void {\n closed.current = editor.state().drag?.subject ?? null\n act({ type: 'cancelDrag' }, 'opener')\n }\n\n function place(kind: ComponentKind, from: HTMLElement): void {\n openPlaces({ kind }, from)\n }\n\n function placeSelection(from: HTMLElement): void {\n // The toolbar offers this only while `can.moveTo`, which holds only for a selected component.\n openPlaces({ id: (state.selection as Selection).id }, from)\n }\n\n function choose(subject: DragSubject, target: DropTarget): void {\n act('kind' in subject ? { type: 'insert', kind: subject.kind, target: target.location } : { type: 'move', id: subject.id, target: target.location }, 'selection')\n }\n\n function follow(entry: DiagnosticEntry): void {\n const { target } = entry\n if (target === null) act({ type: 'select', id: null })\n else act(target.column === undefined ? { type: 'select', id: target.id } : { type: 'select', id: target.id, column: target.column }, 'selection')\n }\n\n const choosing = state.drag?.via === 'keyboard' ? state.drag : null\n const count = state.diagnostics.length\n const shows = (panel: HideablePanel): boolean => !state.hidden.includes(panel)\n\n /** A side pane's Hide, named after the pane; the design view takes its room and the keyboard. */\n const hide = (panel: HideablePanel, name: string): ReactElement => (\n <button type=\"button\" data-report-part=\"hide-pane\" aria-label={t('action.hidePane', { pane: name })} onClick={() => act({ type: 'hidePanel', panel }, 'canvas')}>\n {t('action.hide')}\n </button>\n )\n\n return (\n <section\n ref={root}\n aria-label={t('editor.label')}\n className=\"wb\"\n data-report-part=\"editor\"\n data-panel={state.panel}\n data-hidden={state.hidden.length === 0 ? undefined : state.hidden.join(' ')}\n onKeyDown={onKeyDown}\n onFocus={(event) => {\n lastFocused.current = event.target\n lastInProperties.current = event.target.closest('[data-report-part=\"properties\"]') !== null\n }}\n >\n {/* A bar across the panes: report-builder.css spans every root child that is no pane. */}\n <div className=\"wb-pane\">\n <header>\n <span data-report-part=\"title\">{state.document.title}</span>\n <Toolbar state={state} t={t} act={act} placeSelection={placeSelection} showPane={(pane) => act({ type: 'openPanel', panel: pane }, pane)} />\n </header>\n </div>\n\n {/* The place dialog floats over this pane: the canvas beside it stays\n in view, with the place the dialog's focus is on marked. Opening\n the dialog shows the pane, were it hidden. */}\n {shows('outline') ? (\n <section className=\"wb-pane\" data-pane=\"outline\">\n <header>\n <span>{t('pane.outline')}</span>\n {hide('outline', t('pane.outline'))}\n </header>\n <div className=\"wb-body\">\n <Palette\n state={state}\n t={t}\n ids={ids}\n drag={drag}\n place={place}\n chooser={<ImageChooser state={state} t={t} ids={ids} choose={() => act({ type: 'chooseImage' }).ok} add={(file) => void editor.addImage(file)} />}\n />\n <Outline state={state} t={t} ids={ids} tree={tree} drag={drag} act={act} />\n </div>\n {choosing === null ? null : <Places state={state} drag={choosing} t={t} ids={ids} act={act} choose={choose} cancel={cancelPlaces} />}\n </section>\n ) : null}\n\n {/* The middle pane: the design view, or the host's view in its place --\n no workbench pane, so no rule of the builder's dresses what the host\n drew. Keyed, so that React draws each its own element rather than\n turn one into the other, the keyboard left on a pane no longer\n focusable. */}\n {state.view === 'host' ? (\n <section\n key=\"view\"\n ref={view}\n aria-label={state.hostView?.name}\n data-pane=\"canvas\"\n data-report-part=\"view\"\n tabIndex={-1}\n onKeyDown={(event) => {\n hostKey.current = event.nativeEvent\n }}\n >\n {hostView}\n </section>\n ) : (\n <section key=\"design\" className=\"wb-pane wb-canvas\" data-pane=\"canvas\">\n <header>{t('pane.canvas')}</header>\n <div className=\"wb-body\">\n <Canvas state={state} t={t} canvas={canvas} sheet={sheet} drag={drag} select={(action) => act(action, 'selection')} />\n </div>\n </section>\n )}\n\n {/* The properties and the problems share the third column. On a narrow\n screen report-builder.css shows the one pane `data-panel` names, so\n this column says it is whichever of its two is asked for, and each\n half carries its own name for the other to be hidden by. Each half\n hides alone; the column goes with the second. */}\n {shows('properties') || shows('diagnostics') ? (\n <section className=\"wb-pane\" data-pane={state.panel === 'diagnostics' || !shows('properties') ? 'diagnostics' : 'properties'}>\n {shows('properties') ? (\n <>\n <header data-pane=\"properties\">\n <span>{state.properties.heading}</span>\n {state.selection === null ? null : (\n <button type=\"button\" onClick={() => act({ type: 'select', id: null }, 'properties')}>\n {t('properties.report')}\n </button>\n )}\n {hide('properties', t('pane.properties'))}\n </header>\n <div ref={fields} className=\"wb-body\" data-pane=\"properties\">\n <Properties\n state={state}\n ids={ids}\n act={act}\n library={state.selection === null ? <ImageLibrary state={state} t={t} ids={ids} remove={(asset) => act({ type: 'removeImage', asset }, 'properties')} /> : null}\n />\n </div>\n </>\n ) : null}\n {shows('diagnostics') ? (\n <>\n <header data-pane=\"diagnostics\">\n {/* A status, so a change in how many problems there are is said\n without taking the person's place: \"Problems 2\". Named in\n words, never after its own heading, which the Studio sets in\n capitals that Chromium would put in the name. */}\n <div role=\"status\" aria-label={t('pane.problems')}>\n <span>{t('pane.problems')}</span>\n {count === 0 ? null : (\n <>\n {' '}\n <span data-report-part=\"badge\" data-severity={state.diagnostics.some((entry) => entry.severity === 'error') ? 'error' : 'warning'}>\n {count}\n </span>\n </>\n )}\n </div>\n {hide('diagnostics', t('pane.problems'))}\n </header>\n <div className=\"wb-body\" data-pane=\"diagnostics\">\n <Diagnostics state={state} t={t} ids={ids} list={problemList} follow={follow} />\n </div>\n </>\n ) : null}\n </section>\n ) : null}\n\n <div className=\"wb-pane\">\n {/* The editor's announcements. Each is a new child, so the same words\n said twice -- \"Nothing to undo.\" -- are two announcements, as the\n state's sequence number means them to be. */}\n <p role=\"status\" data-report-part=\"status\">\n {state.status.text === '' ? null : <span key={state.status.sequence}>{state.status.text}</span>}\n </p>\n </div>\n </section>\n )\n}\n"],"mappings":";;;;;AAgCA,SAAS,OAAO,KAAyB;CACvC,OAAO;EAAE,MAAM,IAAI;EAAG,KAAK,IAAI;EAAG,OAAO,IAAI;EAAO,QAAQ,IAAI;CAAO;AACzE;AAEA,SAAS,MAAM,EAAE,aAAa,OAAO,QAAQ,SAAmK;CAC9M,MAAM,SAAS,gBAAgB;CAC/B,OACE,oBAAC,OAAD;EAAK,MAAK;EAAM,cAAY;EAAO,oBAAiB;EAAQ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react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Formancy Report Studio for React: the native report editor over report-builder-core and one report-core session.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@formancy/report-builder-core": "0.
|
|
26
|
-
"@formancy/report-core": "0.
|
|
27
|
-
"@formancy/report-spec": "0.
|
|
25
|
+
"@formancy/report-builder-core": "0.2.0",
|
|
26
|
+
"@formancy/report-core": "0.2.0",
|
|
27
|
+
"@formancy/report-spec": "0.2.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^19.0.0",
|