@formancy/report-builder-angular 0.1.0 → 0.3.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 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
@@ -59,11 +59,13 @@ builder's suite and report-builder-core's model test.
59
59
 
60
60
  Exactly the structure report-builder-core's README sets out under *What a
61
61
  builder renders*, which the React builder renders too: a region named
62
- "Report editor" with a bar above the panes (the title and the toolbar, with
63
- its four pane buttons), the outline pane with the place chooser floating
64
- over it, the design view, the properties and the problems sharing the third
65
- column, and a bar below with the live region. Every name comes from the
66
- core's catalogue in English, Swiss German and Swiss French.
62
+ "Report editor" with a bar above the panes (the title, the switch between
63
+ the report's languages where it is written in more than one, and the
64
+ toolbar, with its four pane buttons), the outline pane with the place chooser floating
65
+ over it, the design view -- or the host's view in its place -- the
66
+ properties and the problems sharing the third column, and a bar below with
67
+ the live region. Every name comes from the core's catalogue in English,
68
+ Swiss German and Swiss French.
67
69
 
68
70
  What is Angular's own:
69
71
 
@@ -75,6 +77,71 @@ What is Angular's own:
75
77
  is in the document. Every action comes from one of the builder's own
76
78
  listeners, which marks the view for check, so a render follows even an
77
79
  action that changed nothing.
80
+ - **The host's view is a template.** A host whose editor was made with a
81
+ view of its own gives it as `<ng-template reportHostView>`, and the builder
82
+ stamps it into the design view's place while the editor's `view` is the
83
+ host's
84
+ ([0029](../../docs/decisions/0029-the-preview-stands-in-the-design-views-place-where-it-does-not-fit-beside-the-builder.md)):
85
+
86
+ ```html
87
+ <report-builder [editor]="editor">
88
+ <ng-template reportHostView><app-preview /></ng-template>
89
+ </report-builder>
90
+ ```
91
+
92
+ A template, not projected content, because Angular makes projected
93
+ content once whether its slot is drawn or not: the host's view lives only
94
+ while it is drawn, and the toolbar's Design view destroys it. The builder
95
+ stamps it with `@angular/core` alone, since `NgTemplateOutlet` is
96
+ `@angular/common`'s, which is not this package's peer. A key pressed in
97
+ it is the host's.
98
+ - **Images a person adds** need nothing of the host but the editor's
99
+ store (`createReportEditor`'s `images`, [0033](../../docs/decisions/0033-a-person-adds-an-image-in-either-builder-and-the-host-keeps-its-bytes.md)): the palette draws Add
100
+ image… last, and beside it the hidden file input, an `<input>` the
101
+ `ReportImageChooser` directive holds, which Add image… opens in the same
102
+ click once `chooseImage` is done; the file chosen is taken, the input
103
+ cleared, and handed to `editor.addImage`. The report's own properties
104
+ list its images, each with its Remove, which puts the keyboard on the
105
+ first field only once the image is gone (`ReportEditorRoot.attempt`).
106
+ - **A report's QR-bill is selected and edited like a component**
107
+ ([0039](../../docs/decisions/0039-a-person-selects-a-reports-qr-bill-and-edits-it-field-by-field-in-either-builder.md)): its row stands in the outline after the regions, its band
108
+ on the canvas selects it with a click, and the properties draw its
109
+ fields and its parties as groups, each a `group` named in the editor's
110
+ words with its one button, which keeps the keyboard as its words change.
111
+ A field is `ReportPropertyRow`, drawn by itself or in a group from one
112
+ template, since `NgTemplateOutlet` is not this package's to use. Add
113
+ QR-bill takes its own button away, and the keyboard goes to the bill's
114
+ IBAN, the first field, as it does when a Remove takes its row.
115
+ - **A report's e-invoice is selected and edited the same way**
116
+ ([0044](../../docs/decisions/0044-a-person-edits-a-reports-e-invoice-in-either-builder-one-term-a-field-in-groups.md)): its row stands after the bill's, and its properties
117
+ are groups -- the parties, the seller's contact, each VAT category, the
118
+ list's Add, the lines, the payment instructions, an XRechnung's own
119
+ terms -- each with its buttons, one with nowhere to go `aria-disabled`
120
+ and still sent. Where a button's action says where the keyboard goes
121
+ once it is done (`then`), the root puts it there after the render
122
+ (`ReportEditorRoot.attempt`, a `group` focus): a category moved keeps
123
+ it on the same button of the group it went to, one removed hands it to
124
+ the list's Add, and one added to its first field.
125
+ - **A report written in several languages**
126
+ ([0063](../../docs/decisions/0063-a-reports-own-words-are-written-in-each-language-it-declares-and-a-render-names-the-one-it-prints-in.md))
127
+ has a switch between them in `<report-builder>`'s bar, a native
128
+ `<select>` beside the title that dispatches `setLanguage`, drawn only
129
+ while the report declares more than one; a language is added from the
130
+ report's own properties, its Languages group's Add language. In another
131
+ language than the report's own, a field at a word writes its
132
+ translation, `ReportPropertyRow` drawing its note under it and
133
+ describing it by it, and a box or a field whose word is missing there
134
+ is marked `data-missing`, the box described as missing by its `title`.
135
+ - **A run of a paragraph is set below or above the line from its group**
136
+ ([0061](../../docs/decisions/0061-a-paragraphs-run-may-be-set-below-or-above-the-line-in-any-character-its-face-draws-and-prints-only-beside-a-run-on-the-line.md)): each run is a group with two buttons, Subscript and
137
+ Superscript, each showing its word, named after the run by `aria-label`
138
+ ("Part 2: Text, subscript") and `aria-pressed` as the run is set.
139
+ Pressed, one reads the selection of its group's text field and the text
140
+ it is of from the element, the one thing it reads from the DOM to send,
141
+ and adds them to the action; the editor decides what it sets, and
142
+ `ReportEditorRoot.attempt` puts the keyboard where the outcome's `then`
143
+ says, the pressed button of the run that holds the text now. A run bound
144
+ to a value is a select, and is set whole.
78
145
  - **Drag and drop is HTML's**, from the palette, from a canvas box or from an
79
146
  outline row, onto the sheet (the nearest place, `targetNear`, read inside
80
147
  the sheet's border) or onto a row (before or after it, `targetBeside`). A
@@ -101,9 +168,11 @@ and the parts inside it:
101
168
  ```
102
169
 
103
170
  Each part is an attribute on the element it is, so the DOM has no wrapper
104
- elements the React builder lacks. The bars, the panes' headers, the Report
105
- button and the problems' count are `<report-builder>`'s template, not parts;
106
- a host that arranges the parts itself writes its own. The parts inject
171
+ elements the React builder lacks. The bars, the switch between languages,
172
+ the panes' headers, the Report button and the problems' count are
173
+ `<report-builder>`'s template, not parts;
174
+ a host that arranges the parts itself writes its own, and draws its own
175
+ view where the state's `view` says, in place of `reportCanvas`. The parts inject
107
176
  `ReportEditorRoot`, which holds the state as a signal and the editor's words.
108
177
  It also routes key presses through `actionForKey`, dispatches, and moves
109
178
  focus. `injectEditorState(editorSignal)` is the same signal for a host's own
@@ -140,8 +209,11 @@ under jsdom with zoneless change detection, as an application on Angular 22
140
209
  runs.
141
210
 
142
211
  - **Every `BUILDER_SCENARIOS` scenario**, in English, Swiss German and Swiss
143
- French. Each step finds elements by role and accessible name only, and each
144
- scenario ends with axe over the whole page at WCAG 2.2 AA, as formancy.ai's
212
+ French. Each step finds elements by role and accessible name only, but an
213
+ `upload`, which finds the hidden file input beside Add image… in the DOM,
214
+ since it has no role, and a `selectText`, which selects characters with
215
+ the field's own `setSelectionRange`, as this runner's keys move no caret
216
+ (0061); and each scenario ends with axe over the whole page at WCAG 2.2 AA, as formancy.ai's
145
217
  conformance suite audits. A scenario left out, or a kind of step never
146
218
  taken, fails the file.
147
219
  - **The accessible tree:** every element a person operates or reads is
@@ -152,7 +224,8 @@ runs.
152
224
  the statuses and the place chooser are named in the editor's words, never
153
225
  after text on the page, which Chromium would read in the stylesheet's
154
226
  capitals; jsdom applies no stylesheet, so that test reads from the DOM
155
- how each name is given. The Studio compares this tree with the React
227
+ how each name is given, and a run's buttons' word beside their name and
228
+ their pressed state (0061). The Studio compares this tree with the React
156
229
  builder's, in jsdom and in Chromium.
157
230
  - **The builder's life:** destroyed and made again, given another editor, and
158
231
  plan 21's switch over one session.
@@ -161,8 +234,22 @@ runs.
161
234
  it among them. Each property of every component kind is found by its role
162
235
  and name, and axe runs on each selection in turn.
163
236
  - **The stylesheet's hooks:** the parts rendered are exactly `REPORT_PARTS`,
164
- the `data-*` states are exactly those `REPORT_ATTRIBUTES` lists, and the
165
- classes are only the workbench's.
237
+ the design view's and the host's view's together, since the two are never
238
+ drawn at once; the `data-*` states are exactly those `REPORT_ATTRIBUTES`
239
+ lists, and the classes are only the workbench's.
240
+ - **The host's view**: a bare region in the design view's place, with the
241
+ middle pane's `data-pane`, its own part, no workbench class and only the
242
+ host's view in it, stamped while the region is drawn and destroyed with
243
+ it. That test reads the DOM, for the reason the hooks' tests do.
244
+ - **Images**: `image-chooser.test.ts` gives the file input `files` and a
245
+ `value` that behave as a browser's, where clearing the value empties the
246
+ files, and holds the file taken before the input is cleared, the input
247
+ cleared, a chooser closed without a file doing nothing, the keyboard on
248
+ Add image… while an image is added and after, Enter and a click opening
249
+ the chooser, no chooser where the editor takes no file, nothing drawn
250
+ without a store, and the host's types offered; `properties.test.ts` holds
251
+ the image rows. Space is not fired here; the Studio's browser gate
252
+ presses it (`apps/studio/scripts/gate-images.mjs`).
166
253
  - **The dependency closure:** the manifest, the installed tree and every
167
254
  import the published entry reaches. No React anywhere, and nothing imported
168
255
  that is not declared.
@@ -203,7 +290,8 @@ a host's own page is its own to measure.
203
290
  - **Text that is not a number never reaches the editor from a number field.**
204
291
  A browser empties an `<input type="number">` holding "tall" before any
205
292
  change event fires, so the field says "This cannot be empty." rather than
206
- "Enter a number.".
293
+ "Enter a number.", and an optional one is emptied: the rows a group
294
+ header is kept with, emptied, are 1 again, the member's absence (0059).
207
295
  - **Most touch browsers fire no HTML drag and drop.** There, as everywhere,
208
296
  the place chooser is the path to every place.
209
297
  - **No measured cost.** Rendering a long report's outline and design view has