@quillmark/svelte 0.3.0 → 0.3.2

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.
@@ -8,6 +8,10 @@
8
8
  // ones that release carries (ISC, and MIT for the Feather-derived ten).
9
9
  export const ICONS = {
10
10
  'chevron-right': [['path', { d: 'm9 18 6-6-6-6' }]],
11
+ 'arrow-right': [
12
+ ['path', { d: 'M5 12h14' }],
13
+ ['path', { d: 'm12 5 7 7-7 7' }]
14
+ ],
11
15
  'chevron-down': [['path', { d: 'm6 9 6 6 6-6' }]],
12
16
  'chevron-up': [['path', { d: 'm18 15-6-6-6 6' }]],
13
17
  bold: [['path', { d: 'M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8' }]],
@@ -52,5 +56,12 @@ export const ICONS = {
52
56
  ['path', { d: 'M18 6 6 18' }],
53
57
  ['path', { d: 'm6 6 12 12' }]
54
58
  ],
59
+ 'trash-2': [
60
+ ['path', { d: 'M10 11v6' }],
61
+ ['path', { d: 'M14 11v6' }],
62
+ ['path', { d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6' }],
63
+ ['path', { d: 'M3 6h18' }],
64
+ ['path', { d: 'M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2' }]
65
+ ],
55
66
  minus: [['path', { d: 'M5 12h14' }]]
56
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/svelte",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "author": "Quillmark Contributors",
24
24
  "type": "module",
25
25
  "engines": {
26
- "node": ">=22"
26
+ "node": ">=24"
27
27
  },
28
28
  "svelte": "./dist/index.js",
29
29
  "types": "./dist/index.d.ts",
@@ -1,11 +0,0 @@
1
- import type { LiveSession } from '@quillmark/wasm';
2
- import type { PageSlot } from './paint.js';
3
- export interface OverlayController {
4
- /** Re-read geometry and rebuild every box; call after a layout-affecting refresh. */
5
- refresh(): void;
6
- /** Bloom the boxes at `field` and under it: transient, and a no-op when `field`
7
- * is already the marked one. */
8
- flashField(field: string): void;
9
- destroy(): void;
10
- }
11
- export declare function createOverlay(session: LiveSession, slots: readonly PageSlot[]): OverlayController;
@@ -1,97 +0,0 @@
1
- import { bloom, bloomTiming, primeWash } from '../core/bloom.js';
2
- import { boxesForField, rectToPercent, applyPercentRect } from './geometry.js';
3
- const FIELD_ATTR = 'data-qm-field';
4
- export function createOverlay(session, slots) {
5
- const layers = slots.map((slot) => {
6
- const layer = document.createElement('div');
7
- layer.className = 'qm-overlay-layer';
8
- Object.assign(layer.style, { position: 'absolute', inset: '0', pointerEvents: 'none' });
9
- slot.el.appendChild(layer);
10
- return layer;
11
- });
12
- // The marked address, and with it the bloom's start. One variable does both jobs:
13
- // the change guard has to outlive the decay (a caret move after the wash ended
14
- // must not re-mark the same field), and `bloom` refuses an `elapsed` past the
15
- // decay, so a spent flash is inert on every later rebuild and never needs
16
- // clearing. The editor→preview signal is continuous (every caret move, so every
17
- // keystroke), and only a change of address is an event; marking the field being
18
- // typed into is noise the recompile already answers, since the changed text
19
- // repaints under the caret 120ms later.
20
- let flash;
21
- /** field → its boxes, rebuilt with them. The bloom's only lookup. */
22
- let byField = new Map();
23
- // The boxes a flash covers: the address's own, plus every one under it, since the
24
- // boxes are keyed as `regions()` names them (`main.references.0`) and an
25
- // editor-side signal names the declared field (`main.references`). Resolved per
26
- // apply rather than at `flashField`, so a rebuild picks up boxes the recompile
27
- // moved or added.
28
- function flashed(field) {
29
- const els = [];
30
- for (const [key, group] of byField) {
31
- if (key === field || key.startsWith(`${field}.`))
32
- els.push(...group);
33
- }
34
- return els;
35
- }
36
- // Start or resume the bloom on whatever boxes exist for it now: one path, because
37
- // starting is resuming at ~0. A field surfaces several boxes and they share
38
- // `startedAt`, so they bloom in step rather than shimmering unevenly.
39
- function applyFlash() {
40
- if (!flash)
41
- return;
42
- const els = flashed(flash.field);
43
- if (!els.length)
44
- return;
45
- const elapsed = performance.now() - flash.startedAt;
46
- const timing = bloomTiming(els[0]);
47
- for (const el of els)
48
- bloom(el, elapsed, timing);
49
- }
50
- // Field names come from `regions()` (the only session query that enumerates them;
51
- // Preview carries no schema); the rects from `boxesForField`, whose fallback is
52
- // what makes every address `regions()` names draw.
53
- function build() {
54
- for (const layer of layers)
55
- layer.replaceChildren();
56
- byField = new Map();
57
- const regions = session.regions();
58
- const fields = new Set();
59
- for (const region of regions)
60
- fields.add(region.field);
61
- for (const field of fields) {
62
- const els = [];
63
- for (const box of boxesForField(field, session.fieldBoxes(field), regions)) {
64
- const layer = layers[box.page];
65
- const slot = slots[box.page];
66
- if (!layer || !slot)
67
- continue;
68
- const pct = rectToPercent(box.rect, slot.size);
69
- const el = document.createElement('div');
70
- el.className = 'qm-field-box';
71
- el.setAttribute(FIELD_ATTR, field);
72
- applyPercentRect(el, pct);
73
- el.style.borderRadius = 'var(--_qm-radius-inner)';
74
- primeWash(el);
75
- layer.appendChild(el);
76
- els.push(el);
77
- }
78
- if (els.length)
79
- byField.set(field, els);
80
- }
81
- applyFlash();
82
- }
83
- build();
84
- return {
85
- refresh: build,
86
- flashField(field) {
87
- if (field === flash?.field)
88
- return;
89
- flash = { field, startedAt: performance.now() };
90
- applyFlash();
91
- },
92
- destroy() {
93
- for (const layer of layers)
94
- layer.remove();
95
- }
96
- };
97
- }