@quario/editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE +219 -0
- package/README.md +89 -0
- package/lib/chrome.js +431 -0
- package/lib/document.js +674 -0
- package/lib/history.js +57 -0
- package/lib/index.d.ts +119 -0
- package/lib/index.js +820 -0
- package/lib/rail.js +506 -0
- package/lib/register.d.ts +9 -0
- package/lib/register.js +10 -0
- package/lib/stage.js +654 -0
- package/lib/style.js +85 -0
- package/package.json +77 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to @quario/editor are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-09-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **An embeddable `<quario-editor>`.** A banded document designer whose design
|
|
15
|
+
surface is the rendered preview itself: assign a starter schema, a quario
|
|
16
|
+
instance, the html target and sample data; the report renders on the sheet,
|
|
17
|
+
clicking output selects the definition behind it, and items, table columns
|
|
18
|
+
and groups rearrange structurally — every edit recompiles and re-renders
|
|
19
|
+
through the real engine. A properties panel edits the selected node's
|
|
20
|
+
literals, styles, templates and expressions; problems list with their exact
|
|
21
|
+
spans; undo and redo walk whole gestures. The edited document reaches the
|
|
22
|
+
host on every change, frozen, with its problem list. A failure reaches the
|
|
23
|
+
error panel and the `error` event once per distinct failure, however many
|
|
24
|
+
renders it survives, and a panel the author dismisses stays dismissed.
|
|
25
|
+
- **The preview answers to the keystroke, undo to the gesture.** Typing in the
|
|
26
|
+
properties panel and dragging a colour picker move the report and its problem
|
|
27
|
+
list live, so a half-written expression shows what is wrong with it as it is
|
|
28
|
+
written. Neither takes an undo step or reaches the host until the gesture
|
|
29
|
+
ends — on blur, on Enter, on the picker's release, or after a half-second
|
|
30
|
+
pause — so one edit is one undo, not one per character. Interrupting an edit
|
|
31
|
+
never loses it: pressing another control or selecting something else leaves
|
|
32
|
+
the typing behind as its own undo step rather than folding it into what
|
|
33
|
+
came next.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- **The adopted sheet's baseline face moved onto `.q-report`.** It was on
|
|
38
|
+
`.q-item` and `.q-table`, where a direct rule would have beaten a report's
|
|
39
|
+
own declared family. Same look; the fragment's new root is what carries it.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Quario License Agreement
|
|
2
|
+
|
|
3
|
+
> **In short:** Quario is commercial software with visible source.
|
|
4
|
+
> Evaluate it free for as long as you like. Evaluation output is
|
|
5
|
+
> watermarked. Anything else needs a per-developer license, after
|
|
6
|
+
> which deployment is unlimited and royalty-free. This summary is not
|
|
7
|
+
> the license; the full terms below govern.
|
|
8
|
+
|
|
9
|
+
Version 1.0, August 2026
|
|
10
|
+
|
|
11
|
+
This agreement is between you and Webstronauts, trading as Quario,
|
|
12
|
+
established in the Netherlands ("we", "us"), and governs the Software
|
|
13
|
+
defined below.
|
|
14
|
+
|
|
15
|
+
Quario is commercial software. Its packages ship with readable source
|
|
16
|
+
code, but it is not open source. No rights are granted beyond those in
|
|
17
|
+
this agreement.
|
|
18
|
+
|
|
19
|
+
## 1. Definitions
|
|
20
|
+
|
|
21
|
+
- The **Software** is any software we publish under the Quario name,
|
|
22
|
+
including the `quario` and `@quario/*` packages, except where a
|
|
23
|
+
product states its own terms. Each release states the edition of this
|
|
24
|
+
agreement that governs it.
|
|
25
|
+
- **You** means the individual exercising rights under this agreement
|
|
26
|
+
and, where that individual acts for a company or other organization,
|
|
27
|
+
that organization. In that case the organization is the licensee, and
|
|
28
|
+
the rights and limits in this agreement apply to it as a whole.
|
|
29
|
+
- An **Application** is software you create that incorporates the
|
|
30
|
+
Software and adds substantial functionality beyond it. A
|
|
31
|
+
licensee-operated service that embeds the Software and renders
|
|
32
|
+
reports for your End Users is an Application under this agreement,
|
|
33
|
+
even if it does little more than render.
|
|
34
|
+
- A **Developer** is any individual (employee or contractor working on
|
|
35
|
+
your behalf) who writes or maintains code that uses the Software's
|
|
36
|
+
APIs, or who creates or maintains report definitions for use with the
|
|
37
|
+
Software. That includes people who never install or run the Software
|
|
38
|
+
themselves, when their definitions are rendered by a service that
|
|
39
|
+
embeds it.
|
|
40
|
+
- A **Seat** is a paid license for one named Developer, purchased from
|
|
41
|
+
us or an authorized reseller.
|
|
42
|
+
- **End Users** are people who interact with the Software only through
|
|
43
|
+
an Application: running it, viewing the reports it produces, or
|
|
44
|
+
supplying parameters or other input to existing report definitions
|
|
45
|
+
the Application provides. Creating or maintaining report definitions
|
|
46
|
+
makes someone a Developer. End Users do not purchase a license; their
|
|
47
|
+
rights come from section 5.
|
|
48
|
+
|
|
49
|
+
## 2. Acceptance
|
|
50
|
+
|
|
51
|
+
This file is our standing offer. Anyone who exercises the evaluation
|
|
52
|
+
rights in section 3 accepts them, subject to their conditions. All
|
|
53
|
+
other rights arise when Seats are purchased. Where a purchase is made
|
|
54
|
+
for an organization, the person completing it confirms that they are
|
|
55
|
+
authorized to accept this agreement on the organization's behalf, and
|
|
56
|
+
acceptance covers the whole organization. If you do not accept this
|
|
57
|
+
agreement, do not use the Software.
|
|
58
|
+
|
|
59
|
+
## 3. Evaluation
|
|
60
|
+
|
|
61
|
+
You may download, install, and use the Software free of charge to
|
|
62
|
+
evaluate it: assessing whether it suits your purposes, and building
|
|
63
|
+
prototypes or proofs of concept. Evaluation covers the full feature
|
|
64
|
+
set, needs no key, and has no fixed time limit. The Software marks
|
|
65
|
+
evaluation output as described in section 6.
|
|
66
|
+
|
|
67
|
+
Evaluation is limited to assessment: you may not distribute any
|
|
68
|
+
Application containing the Software, use the Software in live business
|
|
69
|
+
operations, or expose it in services offered to third parties. The
|
|
70
|
+
moment your use goes beyond evaluating the Software, it requires Seats
|
|
71
|
+
under section 4.
|
|
72
|
+
|
|
73
|
+
## 4. Developer licenses
|
|
74
|
+
|
|
75
|
+
Any use of the Software beyond section 3 requires a Seat for every
|
|
76
|
+
Developer, whether or not an Application has shipped. With those Seats
|
|
77
|
+
in place:
|
|
78
|
+
|
|
79
|
+
- Each licensed Developer may install and use the Software on any number
|
|
80
|
+
of machines for developing Applications.
|
|
81
|
+
- Automated build, test, and CI systems do not consume Seats.
|
|
82
|
+
- Seats are per named individual. They may be reassigned when a
|
|
83
|
+
Developer stops working with the Software, but not shared or pooled
|
|
84
|
+
between concurrently active Developers. Contractors' work for you is
|
|
85
|
+
covered by your Seats; work they do for other clients is not.
|
|
86
|
+
|
|
87
|
+
## 5. Distribution and runtime
|
|
88
|
+
|
|
89
|
+
With Seats under section 4 in place, you may deploy and operate your
|
|
90
|
+
Applications yourself, and distribute the Software as an embedded part
|
|
91
|
+
of them, **royalty-free**: no additional fees or per-deployment
|
|
92
|
+
licenses are required for any number of servers, copies, or End Users.
|
|
93
|
+
You may embed your license key in an Application and ship it at no
|
|
94
|
+
charge, so section 6 does not mark that Application's output.
|
|
95
|
+
|
|
96
|
+
For that purpose, we grant you the right to pass through to each End
|
|
97
|
+
User, and to anyone who distributes or operates your Application on your
|
|
98
|
+
behalf, a limited, non-exclusive, non-transferable right to execute the
|
|
99
|
+
Software only as embedded in the Application. You must not permit them
|
|
100
|
+
to extract the Software from the Application or use it to develop
|
|
101
|
+
software of their own.
|
|
102
|
+
|
|
103
|
+
If you operate a service that embeds the Software and renders reports
|
|
104
|
+
for your End Users, that service is an Application under section 1. You
|
|
105
|
+
may run it royalty-free under this section, and you may put your license
|
|
106
|
+
key in it as in any Application. Calling applications that only request
|
|
107
|
+
renders from it need not incorporate the Software. People who use those
|
|
108
|
+
applications only as End Users under section 1 get the pass-through
|
|
109
|
+
rights above.
|
|
110
|
+
|
|
111
|
+
You may not:
|
|
112
|
+
|
|
113
|
+
- distribute the Software on its own, or as part of a product whose
|
|
114
|
+
primary purpose is to provide report-engine, report-design, or
|
|
115
|
+
document-generation capability to third-party developers;
|
|
116
|
+
- expose the Software's APIs to third parties as a development tool or
|
|
117
|
+
service that substitutes for those parties buying their own Seats. A
|
|
118
|
+
licensee-operated service that embeds the Software and renders for
|
|
119
|
+
your own End Users falls outside that ban;
|
|
120
|
+
- fork, mirror, repackage, rename, or wrap the Software, or republish
|
|
121
|
+
it on any package registry or code-hosting platform, other than as
|
|
122
|
+
embedded in an Application.
|
|
123
|
+
|
|
124
|
+
For as long as this agreement is in force, you may not create any tool,
|
|
125
|
+
library, product, or service that competes with the Software or any
|
|
126
|
+
other Quario product, whether the competition is direct or indirect;
|
|
127
|
+
this restriction does not survive termination. You may not remove or
|
|
128
|
+
alter copyright or license notices in the Software. If your Application
|
|
129
|
+
is itself a closed development product for third-party developers (OEM
|
|
130
|
+
redistribution), contact us for separate terms.
|
|
131
|
+
|
|
132
|
+
## 6. License keys and output marking
|
|
133
|
+
|
|
134
|
+
The Software accepts a license key that evidences your Seats under
|
|
135
|
+
section 4. Key checks run offline.
|
|
136
|
+
|
|
137
|
+
Without a valid key, or with a key whose validity period does not cover
|
|
138
|
+
the installed version's release date, the Software runs with its full
|
|
139
|
+
feature set but marks its output as unlicensed. Using a key you are not
|
|
140
|
+
entitled to is a material breach of this agreement.
|
|
141
|
+
|
|
142
|
+
You may not remove, disable, or circumvent the key check or the output
|
|
143
|
+
marking, or distribute anything that does.
|
|
144
|
+
|
|
145
|
+
## 7. Term, updates, and perpetual fallback
|
|
146
|
+
|
|
147
|
+
Seats are sold as an annual subscription. While the subscription is
|
|
148
|
+
active, licensed Developers receive all Software versions we release,
|
|
149
|
+
and support for the Software through our issue tracker and by email. We
|
|
150
|
+
provide support with commercially reasonable effort; we do not guarantee
|
|
151
|
+
specific response times.
|
|
152
|
+
|
|
153
|
+
If the subscription lapses, your license to the versions released during
|
|
154
|
+
your subscription is **perpetual, for the number of Seats held at the
|
|
155
|
+
lapse**: up to that many Developers may keep using those versions, and
|
|
156
|
+
your Applications may keep shipping them, forever, at no further cost.
|
|
157
|
+
Versions released after the lapse require renewal. We encode this rule
|
|
158
|
+
in purchased keys: a key remains valid for every version released
|
|
159
|
+
during its validity period, with no end date.
|
|
160
|
+
|
|
161
|
+
## 8. Source availability
|
|
162
|
+
|
|
163
|
+
The Software's packages ship with readable source code so that you can
|
|
164
|
+
review and debug what you run. Readable source does not grant extra
|
|
165
|
+
rights: this agreement governs all use of the source, and you may
|
|
166
|
+
publish the Software (modified or not) only as part of an Application
|
|
167
|
+
under section 5.
|
|
168
|
+
|
|
169
|
+
## 9. Ownership, trademarks, and feedback
|
|
170
|
+
|
|
171
|
+
We license the Software; we retain all intellectual property rights in
|
|
172
|
+
it. Report definitions, data, and output you create with the Software
|
|
173
|
+
are yours. "Quario" and the Quario logo are our trademarks; this
|
|
174
|
+
agreement grants no rights to use them beyond identifying the Software.
|
|
175
|
+
If you send us feedback or suggestions, we may use them without
|
|
176
|
+
obligation.
|
|
177
|
+
|
|
178
|
+
## 10. Warranty and liability
|
|
179
|
+
|
|
180
|
+
We provide the Software as is. To the fullest extent the law allows, we
|
|
181
|
+
disclaim all warranties and conditions, express or implied, including
|
|
182
|
+
merchantability, fitness for a particular purpose, and non-infringement.
|
|
183
|
+
|
|
184
|
+
To the fullest extent the law allows: we are not liable for indirect or
|
|
185
|
+
consequential damages, loss of profits, loss of data, or business
|
|
186
|
+
interruption; and our total aggregate liability under this agreement is
|
|
187
|
+
limited to the greater of EUR 100 and the fees you paid us in the
|
|
188
|
+
twelve months preceding the event giving rise to the claim. These
|
|
189
|
+
limitations do not apply where the damage results from the intent or
|
|
190
|
+
deliberate recklessness (opzet of bewuste roekeloosheid) of us or our
|
|
191
|
+
management, or where mandatory law does not permit them.
|
|
192
|
+
|
|
193
|
+
## 11. Termination and survival
|
|
194
|
+
|
|
195
|
+
If you materially breach this agreement, we may terminate it by notice.
|
|
196
|
+
If the breach can be remedied, we will first allow 30 days from that
|
|
197
|
+
notice to remedy it, and termination takes effect only if the breach
|
|
198
|
+
remains. On termination, the licenses granted here end.
|
|
199
|
+
Perpetual-fallback rights under section 7 survive termination only if
|
|
200
|
+
they arose from a lapse that predates the breach, and section 5
|
|
201
|
+
survives with them to the extent needed to keep exercising them.
|
|
202
|
+
Sections 8 through 12 survive any termination.
|
|
203
|
+
|
|
204
|
+
## 12. General
|
|
205
|
+
|
|
206
|
+
Dutch law governs this agreement. Disputes go to the competent court for
|
|
207
|
+
our registered office. You may not assign this agreement without our
|
|
208
|
+
consent, except to a successor of your whole business; we may assign it
|
|
209
|
+
to a successor of ours. If a provision is unenforceable, the remainder
|
|
210
|
+
stays in force. Failure to enforce a provision does not waive it. This
|
|
211
|
+
agreement, together with your order for Seats, is the entire agreement
|
|
212
|
+
about the Software, unless we agree otherwise in writing.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
**Purchasing and contact:** <contact@getquario.com> ·
|
|
217
|
+
<https://getquario.com>
|
|
218
|
+
|
|
219
|
+
Copyright © 2026 Webstronauts. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @quario/editor
|
|
2
|
+
|
|
3
|
+
**The embeddable banded document designer for [quario](https://www.npmjs.com/package/quario).**
|
|
4
|
+
`<quario-editor>` shows a report rendered on your sample data and lets the author rearrange it
|
|
5
|
+
structurally: drag items between bands with a gutter grip, reorder table columns on the table,
|
|
6
|
+
restructure groups from a docked list, and edit the selected node's values, styles, templates and
|
|
7
|
+
expressions in a properties panel. Every edit recompiles and re-renders through the real engine
|
|
8
|
+
and the real HTML target, so what the author sees is the report — not an approximation of it.
|
|
9
|
+
|
|
10
|
+
There is no infinite canvas and no free positioning, because the schema has no concept of either:
|
|
11
|
+
bands stack, items stack, tables have columns. Every drag is structural and every drop snaps to a
|
|
12
|
+
slot the schema actually has — and the editor refuses drops that would break at render time, such
|
|
13
|
+
as moving an item that reads the current row (`@`) out of the detail band.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @quario/editor quario @quario/html
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
ESM-only, Node 22+ tooling, evergreen browsers. Runtime dependencies:
|
|
22
|
+
[lit](https://lit.dev), `@lit/task`, and [tinykeys](https://github.com/jamiebuilds/tinykeys).
|
|
23
|
+
The engine and the HTML target are **not** dependencies — your app passes its own configured
|
|
24
|
+
instances in, so your bundle carries one copy of each.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { quario } from "quario";
|
|
30
|
+
import { html } from "@quario/html";
|
|
31
|
+
import "@quario/editor/register";
|
|
32
|
+
|
|
33
|
+
const editor = document.createElement("quario-editor");
|
|
34
|
+
editor.instance = quario({ license: "quario_..." });
|
|
35
|
+
editor.target = html({ paths: true }); // paths map rendered output back to the schema
|
|
36
|
+
editor.schema = starterSchema; // the document the author begins with
|
|
37
|
+
editor.data = sampleData; // what the preview renders on
|
|
38
|
+
editor.addEventListener("change", ({ detail }) => {
|
|
39
|
+
save(detail.schema); // deep-frozen; assigning it back to `schema` is a no-op
|
|
40
|
+
saveButton.disabled = detail.problems.length > 0;
|
|
41
|
+
});
|
|
42
|
+
document.body.append(editor);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`html({ paths: true })` matters: it stamps `data-q-path` on the fragment, which is how clicking
|
|
46
|
+
rendered output selects the schema node behind it. The editor tells you if you forget.
|
|
47
|
+
|
|
48
|
+
## The element
|
|
49
|
+
|
|
50
|
+
The editor is **uncontrolled**: `schema` seeds it, and the editor owns the document from there.
|
|
51
|
+
Only assigning a **new** schema object resets the document, history and selection — assigning
|
|
52
|
+
back the exact object the last `change` delivered does nothing, so a naive persist-and-restore
|
|
53
|
+
loop cannot wipe the author's undo history. Assigning a new `instance`, `target`, `functions`,
|
|
54
|
+
`data` or `page` recompiles and re-renders while leaving the author's work untouched — a license
|
|
55
|
+
key arriving mid-session is one property write, not a catastrophe.
|
|
56
|
+
|
|
57
|
+
| Property | What it is |
|
|
58
|
+
| ------------- | -------------------------------------------------------------------------------- |
|
|
59
|
+
| `schema` | The starter report document. A new object identity loads and resets. |
|
|
60
|
+
| `instance` | Your configured `quario()` instance; the license rides on it. |
|
|
61
|
+
| `target` | The HTML target, from `html({ paths: true })`. |
|
|
62
|
+
| `functions` | Functions callable from the document's expressions. |
|
|
63
|
+
| `data` | The sample data the preview renders on. |
|
|
64
|
+
| `page` | Sheet geometry (`{ size, margin }`), the same values you pass `pdf({ page })`. |
|
|
65
|
+
| `colorScheme` | `"light"` (default), `"dark"`, or `"auto"`. Chrome only — the sheet stays white. |
|
|
66
|
+
|
|
67
|
+
**Events.** `change` fires on every committed change — edits, undo and redo alike — with
|
|
68
|
+
`{ schema, problems }`: the document (deep-frozen) and its structured problem list, so you can
|
|
69
|
+
disable Save without running the engine yourself. `error` reports host mistakes and render
|
|
70
|
+
failures. `renderComplete` is a `Promise<boolean>` for the newest render settling.
|
|
71
|
+
|
|
72
|
+
**Editing.** Hover an item for its gutter grip: drag to move (a caret shows exactly where it will
|
|
73
|
+
land, and refuses to go anywhere illegal), click for Delete and Duplicate, and the `+` beside it
|
|
74
|
+
inserts a text item. Drag table column headers to reorder — a column's total cell travels with
|
|
75
|
+
it. The right rail holds the properties panel (real controls for styles, an `fx` toggle to make
|
|
76
|
+
any style value an expression, errors underlined at the exact character when the engine knows
|
|
77
|
+
it), the groups list, and every problem in the document. `Mod+Z` / `Shift+Mod+Z` undo and redo
|
|
78
|
+
whole gestures; inside a text field they undo typing, not the document. While the document is
|
|
79
|
+
mid-edit and invalid, the preview keeps showing the last version that compiled.
|
|
80
|
+
|
|
81
|
+
**Reveal.** The render is an honest picture: an empty band or a hidden item draws nothing. The
|
|
82
|
+
bar's Reveal toggle (off by default) shows placeholders for them — a hidden item's placeholder
|
|
83
|
+
shows what you wrote in it — and during a drag, empty bands appear as drop targets on their own.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
quario is commercial software; evaluation is free and fully featured, with output marked as
|
|
88
|
+
unlicensed. The key is stated once, on the `quario()` instance you pass in — the editor adds no
|
|
89
|
+
license mechanics of its own. See [LICENSE](https://getquario.com/license).
|