@quillmark/svelte 0.44.0 → 0.45.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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @quillmark/svelte
2
2
 
3
- Editor + live-preview components for [Quillmark](https://github.com/birdorbs/quillmark) WASM consumers. A WYSIWYG **VisualEditor**, and a canvas **Preview** that paints the compiled document and round-trips clicks to the editor, over one `@quillmark/wasm` session. Vanilla-TS cores with thin Svelte 5 wrappers.
3
+ Editor + live-preview components for [quillmark](https://github.com/birdorbs/quillmark) WASM consumers. A WYSIWYG **VisualEditor**, and a canvas **Preview** that paints the compiled document and round-trips clicks to the editor, over one `@quillmark/wasm` session. Vanilla-TS cores with thin Svelte 5 wrappers.
4
4
 
5
- Quillmark is pre-1.0. Its [stability statement](https://github.com/birdorbs/quillmark#status) says what any release can change and what every release keeps.
5
+ quillmark is pre-1.0. Its [stability statement](https://github.com/birdorbs/quillmark#status) says what any release can change and what every release keeps.
6
6
 
7
7
  ## Install
8
8
 
@@ -16,11 +16,11 @@ npm install @quillmark/svelte
16
16
 
17
17
  A page imports from the root. `/preview` imports less where less is the point, and the preset is a stylesheet.
18
18
 
19
- | Import | What it is |
20
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
- | `@quillmark/svelte` | Everything a page mounts: `<VisualEditor>`, `<Preview>` and `createPreview`, review and wording, `init`, the `DocPath`/`Place` address vocabulary and `EditorError` channel the surfaces share, and `createWorkspace` with `beginPrint` for a shell. |
22
- | `@quillmark/svelte/preview` | `createPreview` and `<Preview>`, with `init` and the shared address and error types, for a page that only displays a document. It reaches nothing editor-side, so the page ships no ProseMirror. |
23
- | `@quillmark/svelte/preset` | The opt-in stylesheet for the page around a surface ([THEMING.md](THEMING.md)). |
19
+ | Import | What it is |
20
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
+ | `@quillmark/svelte` | Everything a page mounts: `<VisualEditor>`, `<Preview>` and `createPreview`, review and wording, `init`, the `DocPath`/`Place` address vocabulary and `EditorError` channel the surfaces share, and `createWorkspace` for a shell. |
22
+ | `@quillmark/svelte/preview` | `createPreview` and `<Preview>`, with `init` and the shared address and error types, for a page that only displays a document. It reaches nothing editor-side, so the page ships no ProseMirror. |
23
+ | `@quillmark/svelte/preset` | The opt-in stylesheet for the page around a surface ([THEMING.md](THEMING.md)). |
24
24
 
25
25
  Code with no page, a worker or a plain Node server, mounts no surface, so it imports `init` from `@quillmark/wasm` directly: this package's entries reach the surfaces' stylesheets. Tree-shaking the root is no substitute for `/preview`: the package is `sideEffects: true`, since its components import stylesheets, so a bundler keeps what the root reaches.
26
26
 
@@ -41,7 +41,7 @@ const quill = Quill.fromTree(tree); // tree: Map<string, Uint8Array> of the quil
41
41
  const doc = quill.seedDocument();
42
42
 
43
43
  // An EXISTING document: parsed back from what you stored.
44
- const doc = Document.parse(markdown); // canonical Quillmark markdown
44
+ const doc = Document.parse(markdown); // canonical quillmark markdown
45
45
  const doc = Document.fromStored(json); // the versioned storage DTO (`doc.toStored()`)
46
46
 
47
47
  const session = await new Engine().open(quill, doc);
@@ -112,16 +112,9 @@ A host that opens several documents keys this shell on the document and guards i
112
112
 
113
113
  `ws.editor` and `ws.preview` are handler objects: spread them, or call one from a handler of the shell's own, as one that also saves each edit does with `onChange={(change) => { save(); ws.editor.onChange(change); }}`. The surfaces are read through getters because a preview mounts only once a session stands, so its ref arrives late. `onState` hands over a new `state` on every change: the `session` to mount the preview over, `diagnostics` for the editor, `formats` the backend emits, `review`, which is `none`, `shown` (the preview compiles the open review's projection) or `failed` (the projection did not compile, so the preview shows the document), and `status`, which is `opening`, `ready`, `refused` (the engine refused the last open or compile with `refused`; a session that stands still paints its last good compile, and the next edit after a refused open opens again), `paint-failed` (until the next edit) or `trapped`. `diagnostics` takes the shell's own as a getter, merged once each at every compile.
114
114
 
115
- `trapped` is terminal: the render build trapped (`runtime::backend_trapped`), so its state is undefined, the session is dropped for the preview to unmount and then freed, and nothing compiles or opens again until the page reloads; editing continues, on the core build. The render build is one per process, so a workspace created after a trap starts `trapped`, and `backendTrapped()` says whether one has happened.
115
+ `trapped` is terminal: the render build trapped (`runtime::backend_trapped`), so its state is undefined, the session is dropped for the preview to unmount and then freed, and nothing compiles or opens again until the page reloads; editing continues, on the core build. The render build is one per process, so a workspace created after a trap starts `trapped`.
116
116
 
117
- `ws.wrote(structural)` is the door for a write the shell made to the document itself: `true` compiles at once, as a card operation does, and otherwise the compile debounces as a keystroke's. `ws.flush()` runs a pending compile now and resolves once the page is current, for a shell that marks the page. `ws.render(format)` compiles a pending edit, waits on the open, and resolves `undefined` where the document does not compile, so a download is the document in hand, never a proposal the reader has not accepted, even while the preview shows one. `ws.doc` and `ws.quill` are the handles the editor mounts over. `ws.dispose(unmounted)` hands `onState` a state with no session, awaits `unmounted` so the surfaces go first, then frees the session. `beginPrint()`, called on the press itself so a fallback tab is not a blocked popup, prints the PDF once it is rendered:
118
-
119
- ```ts
120
- const printing = beginPrint();
121
- const pdf = await ws.render('pdf');
122
- if (!pdf) printing.cancel();
123
- else if (!printing.print(pdf.bytes)) refusal = 'This browser blocked printing.';
124
- ```
117
+ `ws.wrote(structural)` is the door for a write the shell made to the document itself: `true` compiles at once, as a card operation does, and otherwise the compile debounces as a keystroke's. `ws.flush()` runs a pending compile now and resolves once the page is current, for a shell that marks the page. `ws.render(format)` compiles a pending edit, waits on the open, and resolves `undefined` where the document does not compile, so a download is the document in hand, never a proposal the reader has not accepted, even while the preview shows one. `ws.doc` and `ws.quill` are the handles the editor mounts over. `ws.dispose(unmounted)` hands `onState` a state with no session, awaits `unmounted` so the surfaces go first, then frees the session.
125
118
 
126
119
  Storage, choosing the quill, switching documents, the review list and collaboration stay the shell's.
127
120
 
@@ -347,7 +340,7 @@ const engine = new Engine({ fonts: [carlito] });
347
340
  <VisualEditor {doc} {quill} {fonts} />
348
341
  ```
349
342
 
350
- [`@quillmark/fonts`](../fonts) is the library every Quillmark client builds its engine over, so a family a document names sets the same way in each; a host's own files go after it. `fontFaces` loads the render build, as `open` does, so mount the editor first and let the faces arrive behind it. A family the document already sets edits with no library at all, and the picker offers it so it can be cleared.
343
+ [`@quillmark/fonts`](../fonts) is the library every quillmark client builds its engine over, so a family a document names sets the same way in each; a host's own files go after it. `fontFaces` loads the render build, as `open` does, so mount the editor first and let the faces arrive behind it. A family the document already sets edits with no library at all, and the picker offers it so it can be cleared.
351
344
 
352
345
  ### Recompiling
353
346
 
@@ -416,17 +409,70 @@ This is not the diagnostics channel. A `Diagnostic` is about the **document** an
416
409
 
417
410
  ## Canonical markdown
418
411
 
419
- `doc.toMarkdown()` returns the document's canonical Quillmark markdown, which re-parses to an equal `Document`. A read-only mirror is that call in a `<pre>`, re-run after each edit lands, so it needs no surface from this package:
412
+ `doc.toMarkdown()` returns the document's canonical quillmark markdown, which re-parses to an equal `Document`. A read-only mirror is that call in a `<pre>`, re-run after each edit lands, so it needs no surface from this package:
420
413
 
421
414
  ```ts
422
415
  el.textContent = doc.toMarkdown();
423
416
  ```
424
417
 
425
- ## Theming
418
+ ## Customizing
419
+
420
+ What you can change about quillmark's editor and preview without forking either, and what is closed on purpose. How the surfaces look, from the ten `--qm-*` dials to the opt-in preset, is [`THEMING.md`](THEMING.md); this section says which depth a change belongs to and where each depth stops.
421
+
422
+ ### The two depths
423
+
424
+ Start at the shallowest one that holds your change.
425
+
426
+ | | You write | You can change |
427
+ | ------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- |
428
+ | **Theme and word the surfaces** | props and CSS in your own page | how `<VisualEditor>` and `<Preview>` look and what they say |
429
+ | **Write your own shell** | a Svelte file on `createWorkspace` | what the page does: its actions, its storage, where documents come from |
430
+
431
+ #### Theme and word the surfaces
432
+
433
+ In a page of your own you mount `<VisualEditor>` and `<Preview>` yourself and reach everything below.
434
+
435
+ | Handle | What it changes |
436
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
437
+ | the ten `--qm-*` dials | colour, type, corner and spacing across both surfaces ([THEMING §"The dials"](THEMING.md#the-dials)) |
438
+ | `color-scheme` | light or dark, read off your page or set on one mount with `style` ([THEMING §"The surface follows your colour scheme"](THEMING.md#the-surface-follows-your-colour-scheme)) |
439
+ | `.qm-editor`, `.qm-preview`, `.qm-pane` | placing and sizing each surface from your own stylesheet; `class` and `style` props land on the same root |
440
+ | `[data-qm-card="<kind>"]` | the cards of one kind, `main` for the main card ([THEMING §"What a stylesheet may aim at"](THEMING.md#what-a-stylesheet-may-aim-at)) |
441
+ | `strings`, on each surface | every word it says, keyed and partial, the value-inserting ones included ([§Wording](#wording)) |
442
+ | `formatDiagnostic` | the text of a validation or edit diagnostic under its field |
443
+ | `enumOptionAllowed`, `enumDisallowed` | which options of an enum a deployment offers, and whether a refused one is hidden or greyed |
444
+ | `fonts`, `fontLabels` | the font families the format popover offers, and the names it shows them by ([§Fonts](#fonts)) |
445
+ | the quill's `ui` hints | layout from the schema: `ui.compact` to share a row, `ui.layout: table` for an array, `ui.blank_title` for an enum's blank |
446
+ | `review` | another writer's proposals, drawn where each sits and answered on the page ([§Review](#review)) |
447
+
448
+ #### Write your own shell
449
+
450
+ Any change of behaviour, rather than of look or wording, is a shell of your own: a submit button, saving to your server, sign-in, a document opened prefilled. `createWorkspace` is the glue between the two surfaces packaged, so the shell is a short file of your wiring that takes each npm release as it comes rather than a copy of ours that drifts ([§"A shell on the workspace"](#a-shell-on-the-workspace)).
451
+
452
+ The shell holds the `Document`, so where it comes from and where it goes is yours: parse it from markdown your server sends, seed it from the quill, write it back on every `onChange` or on a press. Storage, choosing the quill, switching documents, the review list and collaboration are the shell's.
453
+
454
+ ### What is closed, and why
455
+
456
+ Closed means no prop or promised class reaches it. Each is closed for the reason beside it.
457
+
458
+ | Closed | Why |
459
+ | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
460
+ | the DOM and classes inside a surface | a class contract over the interior would freeze the DOM the surfaces are free to re-cut; the dials and the root classes already reach what a restyle wants |
461
+ | the control drawn for each field type | per-control render slots are declined: they would hand reconciliation to your code |
462
+ | what the slash menu and the format popover offer | the slash menu offers the constructs the caret can make, each asked whether it would fire there, and its pointer door is declined; the format popover's buttons are fixed and the fonts it offers are yours (`fonts`) |
463
+ | the icons | a closed set drawn against one frame, so no glyph strokes differently from its neighbours; a glyph takes its control's colour, which the dials reach |
464
+ | keyboard shortcuts | each binding and the shortcut list are read off one table, so a list and a key cannot drift; `editorShortcuts()` and `REVIEW_KEYS` read them, and nothing rebinds them |
465
+ | the undo model | undo is per prose field and per list, never one stack for the document, and a removed card has its own step back |
466
+ | image authoring | declined: there is no asset story |
467
+ | touch-first editing | declined: touch is not a target, and neither is an accessory bar |
468
+
469
+ The reasons are recorded with the designs they rejected in [this package's INVARIANTS](prose/INVARIANTS.md). Each package's exported names are held against a committed snapshot, `api.json`, which `check:api` compares on every build of this repository, so nothing becomes open or closed by an export appearing, vanishing or moving between entries without a reviewed diff.
470
+
471
+ ### When something you need is missing
426
472
 
427
- The surfaces carry the behavior against a neutral, overridable visual baseline: a set of `--qm-*` CSS custom properties you override on any ancestor. See [`THEMING.md`](THEMING.md).
473
+ A dial appears when a real consumer needs one, and every dial is one more thing a reader has to hold. So before forking, [open an issue](https://github.com/birdorbs/quillmark-js/issues) describing what you are building and what stopped you: the need, not the patch.
428
474
 
429
- What you can change without forking, at each depth from configuring the quillkit app to a shell of your own, and what is closed and why: [`CUSTOMIZING.md`](CUSTOMIZING.md).
475
+ Meanwhile the supported escape route is a custom shell on the published packages, not a fork: a shell takes each release as an npm update, where a fork takes one only by a merge.
430
476
 
431
477
  ## Development
432
478
 
package/THEMING.md CHANGED
@@ -10,7 +10,7 @@ There are three depths to that. An app mounting into an unstyled page stops at t
10
10
  | **Make it yours** | ten custom properties | the whole surface rescaled and recolored to your brand |
11
11
  | **Match ours** | one CSS import | the page around the surface, drawn the way we draw ours |
12
12
 
13
- Theming is one part of what you can change without forking: [CUSTOMIZING.md](CUSTOMIZING.md) maps the rest, and what is closed.
13
+ Theming is one part of what you can change without forking: [README §Customizing](README.md#customizing) maps the rest, and what is closed.
14
14
 
15
15
  ## Drop it in
16
16
 
@@ -132,7 +132,7 @@ import '@quillmark/svelte/preset';
132
132
  </body>
133
133
  ```
134
134
 
135
- This is the stylesheet our own apps import: the playground, studio and quillkit's app client draw with these rules and nothing else, so what you get is what we ship, not a reduction of it.
135
+ This is the stylesheet our own apps import: the playground and studio draw with these rules and nothing else, so what you get is what we ship, not a reduction of it.
136
136
 
137
137
  It carries a `--qmh-*` scale for the page, derived from the same ten dials and calibrated against the surfaces' own steps, so a plate of yours and a card of ours agree about which way "raised" goes. Turning a dial moves both.
138
138
 
@@ -182,11 +182,11 @@ An app that mounts an editor beside a preview over one session needs a screen to
182
182
 
183
183
  The narrow shape is one mount at a time, not two of them stacked: half a narrow viewport is under the width either surface reads at. The track you are not showing is `display: none`, so it leaves the tab order, hit-testing and the accessibility tree together: you need no `inert` on it, and no breakpoint in your JS, since the only state you hold is which of the two you last asked for. Keep both mounted: the hidden pane keeps its pixels, its caret and its scroll, and comes back to them — it rasters nothing at a box it has none of, and repaints only where it returns to a box that draws its pages at another scale. A preview scroll asked for while it was hidden is held and run on the way back, so it opens at the caret rather than several edits behind it. A click that lands in the hidden pane is the one thing the shape adds to your wiring, so send the caret and reveal the track together, or the hit goes somewhere the reader cannot see.
184
184
 
185
- Every rule behind the five is wrapped in `:where()`, so it computes at specificity zero: a rule of yours on the same element wins at any specificity and in any sheet order, which is what lets a stylesheet written by someone other than the app's author (an `app.css` over quillkit's app client) restyle a band without knowing which shell rules set it.
185
+ Every rule behind the five is wrapped in `:where()`, so it computes at specificity zero: a rule of yours on the same element wins at any specificity and in any sheet order, which is what lets a stylesheet written by someone other than the app's author restyle a band without knowing which shell rules set it.
186
186
 
187
187
  The shape is shared; the look of a band is not. Your wordmark, your nav and the depth of your head are the most app-specific things on the screen, and a preset that drew them would hand every tool built on this the same face, so they read `--qmh-*` like everything else and you write the rules. `.qm-split`'s gap is a default rather than a fact about splitting: close it to `0` and carry a hairline on one pane if you want the two mounts to meet instead of stand apart.
188
188
 
189
- It is **unlayered**, and nothing in it outranks a rule of yours aimed at the same element: the page, type, status and control recipes compute at ordinary specificity, so your own rules beat them by ordinary precedence, and the shell and the app chrome compute at specificity zero, as the surfaces do. It is also opt-in and side-effect free until imported: nothing that styles your document arrives with a component.
189
+ It is **unlayered**, and nothing in it outranks a rule of yours aimed at the same element: the page, type, status and control recipes compute at ordinary specificity, so your own rules beat them by ordinary precedence, and the shell computes at specificity zero, as the surfaces do. It is also opt-in and side-effect free until imported: nothing that styles your document arrives with a component.
190
190
 
191
191
  One rule in it earns its place regardless of whether you take the rest, and you want it if you draw a focus ring of your own — cut the mounted surfaces out of the blanket:
192
192
 
@@ -198,19 +198,6 @@ One rule in it earns its place regardless of whether you take the rest, and you
198
198
 
199
199
  A blanket `:focus-visible` of yours outranks ours, including on the controls that already draw one, so a ring written for the controls that draw none repaints the ones that do. The cut-out leaves yours everywhere else, and `:not(:where(…))` contributes no specificity, so your rule ranks exactly as it would without it.
200
200
 
201
- ### The app chrome
202
-
203
- A tool's bands are yours, since a tool's head is the most app-specific thing on its screen. An app whose whole page is one form to fill in has less to say there: a name, the action the page leads to, and a line signing it. Four classes draw that much, quillkit's app client wears them, and a host of its own takes them the same way:
204
-
205
- | Class | What it is |
206
- | ----------------- | --------------------------------------------------------------------------------------------------------------- |
207
- | `.qm-app-header` | The band naming the app: a plate, a gutter and a hairline under it. Put it beside `.qm-bar`. |
208
- | `.qm-app-title` | What the app is called, at the title rung: the one line on the screen read as a name. |
209
- | `.qm-app-footer` | The line signing the app, in meta type on the head's plate under a hairline; its links take the line's own ink. |
210
- | `.qm-app-primary` | The one action the page leads to: the control wearing `--qm-accent`, standing at the touch floor. |
211
-
212
- They compute at specificity zero, as the shell does, so `.qm-app-header { background: #00308f; color: #fff; }` is the whole of rebranding the head.
213
-
214
201
  ## What a stylesheet may aim at
215
202
 
216
203
  A stylesheet you write against a mounted surface, or one an author writes over an app someone else built, may aim at these and nothing else:
@@ -2,10 +2,9 @@
2
2
  * `@quillmark/svelte/preset`, the package's one CSS entry point: the endorsed look for the page a
3
3
  * surface is mounted on. Opt-in: the surface barrels pull `core/theme.css` and never this, because
4
4
  * this styles the document. `scale.css` is where the literals are minted; the rest read them.
5
- * `recipes.css` ranks at ordinary specificity, `shell.css` and `app.css` at zero.
5
+ * `recipes.css` ranks at ordinary specificity, `shell.css` at zero.
6
6
  */
7
7
 
8
8
  @import './scale.css';
9
9
  @import './recipes.css';
10
10
  @import './shell.css';
11
- @import './app.css';
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * The endorsed look: the rules a host draws around a mounted surface, as classes it puts on its
3
- * own elements. The shell is `shell.css` and an app's chrome `app.css`; the rungs in `scale.css`
4
- * are the invisible half. This file mints nothing; `check:style` runs its axes here.
3
+ * own elements. The shell is `shell.css`; the rungs in `scale.css` are the invisible half. This
4
+ * file mints nothing; `check:style` runs its axes here.
5
5
  *
6
6
  * These are host classes: they land on the consumer's DOM, never on a mounted root, so they freeze
7
7
  * nothing about the surfaces' interior.
@@ -3,10 +3,9 @@
3
3
  surface sits on; this is what it is mounted in, a tool where `.qm-page` is a document.
4
4
 
5
5
  Every selector here computes at specificity zero, as the surfaces' own do: a host's
6
- rule on the same element wins whatever order the sheets land in, and an app whose
7
- stylesheet someone else writes (quillkit's app client, under an author's `app.css`)
8
- needs no knowledge of which of these the client happened to set. `check:style` holds
9
- the rank. This file mints nothing. */
6
+ rule on the same element wins whatever order the sheets land in, and a stylesheet
7
+ someone other than the app's author writes needs no knowledge of which of these the
8
+ app happened to set. `check:style` holds the rank. This file mints nothing. */
10
9
 
11
10
  /* Pinned to the viewport rather than sized to it: a page-height box still leaves the
12
11
  root scroller counting the overflow its panes clip, and a wheel over the chrome drags
@@ -1,5 +1,2 @@
1
1
  export { createWorkspace } from './workspace.js';
2
- export { backendTrapped } from './trap.js';
3
2
  export type { Workspace, WorkspaceEditor, WorkspaceOptions, WorkspacePreview, WorkspaceState, WorkspaceStatus } from './workspace.js';
4
- export { beginPrint } from './print.js';
5
- export type { Printing } from './print.js';
@@ -2,6 +2,3 @@
2
2
  // bridge over the two surfaces, an opt-in layer the root re-exports. Neither surface imports it
3
3
  // (`check:deps`).
4
4
  export { createWorkspace } from './workspace.js';
5
- export { backendTrapped } from './trap.js';
6
- // The browser door a shell prints a file through.
7
- export { beginPrint } from './print.js';
@@ -1,5 +1,5 @@
1
1
  // The render build is one instance per process, so a trap in it is one latch for every
2
- // workspace in the process. `unlatch` is the tests' door and is not exported from the root.
2
+ // workspace in the process. `unlatch` is the tests' door.
3
3
  import { isQuillmarkError } from '@quillmark/wasm';
4
4
  export const TRAPPED = 'runtime::backend_trapped';
5
5
  let latched = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/svelte",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
4
4
  "description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,6 @@
46
46
  "files": [
47
47
  "dist",
48
48
  "THEMING.md",
49
- "CUSTOMIZING.md",
50
49
  "NOTICE"
51
50
  ],
52
51
  "sideEffects": true,
package/CUSTOMIZING.md DELETED
@@ -1,78 +0,0 @@
1
- # Customizing
2
-
3
- What you can change about Quillmark's editor, preview and the quillkit app without forking any of it, and what is closed on purpose. The CSS detail is [THEMING.md](THEMING.md); this page says which depth a change belongs to and where each depth stops.
4
-
5
- ## The three depths
6
-
7
- Start at the shallowest one that holds your change.
8
-
9
- | | You write | You can change |
10
- | ------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- |
11
- | **Configure the quillkit app** | files beside your quiver, no code | the app's name, icon and look |
12
- | **Theme and word the surfaces** | props and CSS in your own page | how `<VisualEditor>` and `<Preview>` look and what they say |
13
- | **Write your own shell** | a Svelte file on `createWorkspace` | what the page does: its actions, its storage, where documents come from |
14
-
15
- ### Configure the quillkit app
16
-
17
- `quillkit build app` turns a quiver into a standalone app for the people filling its forms in. You configure it with files found by name beside `Quiver.yaml`, all optional ([quillkit's README](../quillkit/README.md#the-app)):
18
-
19
- | File | What it sets |
20
- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
21
- | `App.yaml` | `title` and `description` |
22
- | `icon.svg` or `icon.png` | the icon in the header and on the tab |
23
- | `app.css` | the look: the `--qm-*` dials, the surface roots, the app chrome classes and `[data-qm-card="<kind>"]`, linked after the app's own styles |
24
-
25
- Which forms appear is whatever the quiver holds: every quill in it, at its latest version, drafts only under `--drafts`. A different set of forms is a different quiver.
26
-
27
- `check` and `build app` refuse an `App.yaml` key the app does not have and warn on an `app.css` selector the theming contract does not promise, so a key or a selector a release moves fails or warns where you build rather than going quiet.
28
-
29
- ### Theme and word the surfaces
30
-
31
- In a page of your own you mount `<VisualEditor>` and `<Preview>` yourself and reach everything below.
32
-
33
- | Handle | What it changes |
34
- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
- | the ten `--qm-*` dials | colour, type, corner and spacing across both surfaces ([THEMING §"The dials"](THEMING.md#the-dials)) |
36
- | `color-scheme` | light or dark, read off your page or set on one mount with `style` ([THEMING §"The surface follows your colour scheme"](THEMING.md#the-surface-follows-your-colour-scheme)) |
37
- | `.qm-editor`, `.qm-preview`, `.qm-pane` | placing and sizing each surface from your own stylesheet; `class` and `style` props land on the same root |
38
- | `[data-qm-card="<kind>"]` | the cards of one kind, `main` for the main card ([THEMING §"What a stylesheet may aim at"](THEMING.md#what-a-stylesheet-may-aim-at)) |
39
- | `strings`, on each surface | every word it says, keyed and partial, the value-inserting ones included ([README §Wording](README.md#wording)) |
40
- | `formatDiagnostic` | the text of a validation or edit diagnostic under its field |
41
- | `enumOptionAllowed`, `enumDisallowed` | which options of an enum a deployment offers, and whether a refused one is hidden or greyed |
42
- | `fonts`, `fontLabels` | the font families the format popover offers, and the names it shows them by ([README §Fonts](README.md#fonts)) |
43
- | the quill's `ui` hints | layout from the schema: `ui.compact` to share a row, `ui.layout: table` for an array, `ui.blank_title` for an enum's blank |
44
- | `review` | another writer's proposals, drawn where each sits and answered on the page ([README §Review](README.md#review)) |
45
-
46
- ### Write your own shell
47
-
48
- Any change of behaviour, rather than of look or wording, is a shell of your own: a submit button, saving to your server, sign-in, a document opened prefilled. `createWorkspace` is the glue between the two surfaces packaged, so the shell is a short file of your wiring that takes each npm release as it comes rather than a copy of ours that drifts ([README §"A shell on the workspace"](README.md#a-shell-on-the-workspace)). The quillkit app is one such shell.
49
-
50
- The shell holds the `Document`, so where it comes from and where it goes is yours: parse it from markdown your server sends, seed it from the quill, write it back on every `onChange` or on a press. Storage, choosing the quill, switching documents, the review list and collaboration are the shell's.
51
-
52
- ## What is closed, and why
53
-
54
- Closed means no prop, promised class or file reaches it. Each is closed for the reason beside it.
55
-
56
- | Closed | Why |
57
- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
- | the DOM and classes inside a surface | a class contract over the interior would freeze the DOM the surfaces are free to re-cut; the dials and the root classes already reach what a restyle wants |
59
- | the control drawn for each field type | per-control render slots are declined: they would hand reconciliation to your code |
60
- | what the slash menu and the format popover offer | the slash menu offers the constructs the caret can make, each asked whether it would fire there, and its pointer door is declined; the format popover's buttons are fixed and the fonts it offers are yours (`fonts`) |
61
- | the icons | a closed set drawn against one frame, so no glyph strokes differently from its neighbours; a glyph takes its control's colour, which the dials reach |
62
- | keyboard shortcuts | each binding and the shortcut list are read off one table, so a list and a key cannot drift; `editorShortcuts()` and `REVIEW_KEYS` read them, and nothing rebinds them |
63
- | the undo model | undo is per prose field and per list, never one stack for the document, and a removed card has its own step back |
64
- | image authoring | declined: there is no asset story |
65
- | touch-first editing | declined: touch is not a target, and neither is an accessory bar |
66
- | in the quillkit app: where documents are stored | in this browser only, one database per app, and the app says so; a server is a shell's |
67
- | in the quillkit app: the actions offered | `App.yaml` holds what the app says, not what it does: keys that compose into behaviour are a program, and a program belongs in a real language, the custom shell |
68
- | in the quillkit app: the layout | where the app puts its parts is its client's; `app.css` restyles the chrome through the promised classes, and anything past them is warned, since a release may re-cut it |
69
- | in the quillkit app: the version a new document opens on | the latest the quiver holds, at `0.1.0` or above unless built with `--drafts`; a document reopens on the version it was made on and offers an update, so a release never moves a half-filled form under its reader |
70
- | in the quillkit app: the wording and the language | English and fixed: plain text in `App.yaml` cannot set a string that inserts a value, so a translation there stays part English; a shell sets every string through `strings` |
71
-
72
- The reasons are recorded with the designs they rejected in [this package's INVARIANTS](prose/INVARIANTS.md) and [quillkit's](../quillkit/prose/INVARIANTS.md). Each package's exported names are held against a committed snapshot, `api.json`, which `check:api` compares on every build of this repository, so nothing becomes open or closed by an export appearing, vanishing or moving between entries without a reviewed diff.
73
-
74
- ## When something you need is missing
75
-
76
- A dial appears when a real consumer needs one, and every dial is one more thing a reader has to hold. So before forking, [open an issue](https://github.com/birdorbs/quillmark-js/issues) describing what you are building and what stopped you: the need, not the patch.
77
-
78
- Meanwhile the supported escape route is a custom shell on the published packages, not a fork: a shell takes each release as an npm update, where a fork takes one only by a merge.
@@ -1,71 +0,0 @@
1
- /* An app's own chrome: the band that names it, the line that signs it, and the one
2
- action it exists for. The shell gives a band its row; these give the app's bands their
3
- look, for a host whose page is one form rather than a workroom. quillkit's app client
4
- wears them, and an author's `app.css` restyles them (THEMING §"The app chrome").
5
-
6
- Specificity zero throughout, as the shell's: a rule of the host's own on the same
7
- element wins at any specificity and in any sheet order. `check:style` holds the rank.
8
- This file mints nothing. */
9
-
10
- /* The head: the plate the title stands on, a hairline under it, and the ink everything on
11
- it takes, so a host recolouring the band recolours its name with it. */
12
- :where(.qm-app-header) {
13
- padding: var(--qmh-space-2) var(--qmh-space-4);
14
- color: var(--qmh-ink);
15
- background: var(--qmh-surface);
16
- border-block-end: var(--qmh-border-width) solid var(--qmh-border);
17
- }
18
-
19
- /* What the app is called. Display type rather than chrome type: it is the one line on
20
- the screen a reader reads as a name. */
21
- :where(.qm-app-title) {
22
- margin: 0;
23
- font-size: var(--qmh-text-title);
24
- font-weight: var(--qmh-weight-strong);
25
- line-height: var(--qmh-leading-tight);
26
- color: inherit;
27
- overflow-wrap: anywhere;
28
- }
29
-
30
- /* The foot: a line of meta type on the head's plate under a hairline, its links in the
31
- line's own ink. The two bands framing the panes stand on one plate. */
32
- :where(.qm-app-footer) {
33
- padding: var(--qmh-space-2) var(--qmh-space-4);
34
- background: var(--qmh-surface);
35
- border-block-start: var(--qmh-border-width) solid var(--qmh-border);
36
- font-size: var(--qmh-text-meta);
37
- line-height: var(--qmh-leading-tight);
38
- color: var(--qmh-ink-meta);
39
- }
40
-
41
- :where(.qm-app-footer a) {
42
- color: inherit;
43
- }
44
-
45
- /* The primary action: the one control on the screen that wears the accent, at the touch
46
- floor, since it is the press the whole page leads to. */
47
- :where(.qm-app-primary) {
48
- font: inherit;
49
- font-size: var(--qmh-text-label);
50
- font-weight: var(--qmh-weight-strong);
51
- line-height: var(--qmh-leading-tight);
52
- min-height: var(--qmh-tap);
53
- padding: var(--qmh-space-2) var(--qmh-space-4);
54
- color: var(--qmh-on-accent);
55
- background: var(--qmh-accent);
56
- border: var(--qmh-border-width) solid var(--qmh-accent);
57
- border-radius: var(--qmh-radius-inner);
58
- cursor: pointer;
59
- transition: background-color var(--qmh-duration) var(--qmh-ease-reverse);
60
- }
61
-
62
- :where(.qm-app-primary:hover) {
63
- background: var(--qmh-accent-hover);
64
- }
65
-
66
- :where(.qm-app-primary:disabled) {
67
- color: var(--qmh-ink-meta);
68
- background: var(--qmh-surface-hover);
69
- border-color: var(--qmh-border);
70
- cursor: default;
71
- }
@@ -1,13 +0,0 @@
1
- /** A print begun on a press, finished once the PDF is in hand. */
2
- export interface Printing {
3
- /** Print `pdf`. Returns false where the browser refused every way in. */
4
- print(pdf: Uint8Array): boolean;
5
- /** Drop a print that has nothing to print. */
6
- cancel(): void;
7
- }
8
- /**
9
- * Begin a print on the press itself, then hand the PDF to `print` once it is rendered, or call
10
- * `cancel` where there is none. The tab a fallback prints from is opened here, while the press
11
- * still counts as one, since a tab opened after the render's await is a popup the browser blocks.
12
- */
13
- export declare function beginPrint(): Printing;
@@ -1,67 +0,0 @@
1
- /**
2
- * Whether this browser prints a PDF from a hidden frame. A browser without an inline PDF
3
- * viewer (every phone) has nothing to print there, and Safari's frame prints blank or the
4
- * page around it, so both are handed a tab of the PDF instead, printed from its viewer.
5
- */
6
- function framePrints() {
7
- if (navigator.pdfViewerEnabled === false)
8
- return false;
9
- const ua = navigator.userAgent;
10
- return !(/AppleWebKit\//.test(ua) && !/(Chrome|Chromium)\//.test(ua));
11
- }
12
- /** The frame the last print loaded. A frame's print returns before its viewer is done
13
- * with the PDF, so a frame stands until the next print replaces it. */
14
- let frame;
15
- function blobOf(pdf) {
16
- // `BlobPart` takes an `ArrayBuffer`-backed view; wasm output is one.
17
- return URL.createObjectURL(new Blob([pdf], { type: 'application/pdf' }));
18
- }
19
- /**
20
- * Begin a print on the press itself, then hand the PDF to `print` once it is rendered, or call
21
- * `cancel` where there is none. The tab a fallback prints from is opened here, while the press
22
- * still counts as one, since a tab opened after the render's await is a popup the browser blocks.
23
- */
24
- export function beginPrint() {
25
- const tab = framePrints() ? null : window.open('', '_blank');
26
- const viaTab = (pdf) => {
27
- const target = tab ?? window.open('', '_blank');
28
- if (!target)
29
- return false;
30
- // Not revoked: the tab's viewer can read the URL again for as long as it stands.
31
- target.location.href = blobOf(pdf);
32
- return true;
33
- };
34
- return {
35
- print(pdf) {
36
- if (!framePrints())
37
- return viaTab(pdf);
38
- if (frame) {
39
- frame.el.remove();
40
- URL.revokeObjectURL(frame.url);
41
- }
42
- const url = blobOf(pdf);
43
- const el = document.createElement('iframe');
44
- el.setAttribute('aria-hidden', 'true');
45
- el.tabIndex = -1;
46
- // Laid out and off screen: a frame under `display: none` loads no viewer to print.
47
- el.style.cssText =
48
- 'position:fixed;inset-inline-start:-10000px;top:0;width:1px;height:1px;border:0';
49
- el.addEventListener('load', () => {
50
- try {
51
- el.contentWindow?.focus();
52
- el.contentWindow?.print();
53
- }
54
- catch {
55
- viaTab(pdf);
56
- }
57
- }, { once: true });
58
- el.src = url;
59
- document.body.append(el);
60
- frame = { el, url };
61
- return true;
62
- },
63
- cancel() {
64
- tab?.close();
65
- }
66
- };
67
- }