@quillmark/svelte 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.
Files changed (64) hide show
  1. package/README.md +15 -11
  2. package/THEMING.md +42 -23
  3. package/dist/core/address.d.ts +39 -4
  4. package/dist/core/address.js +47 -19
  5. package/dist/core/codec/encode.js +4 -1
  6. package/dist/core/codec/field.d.ts +1 -1
  7. package/dist/core/codec/prose.css +41 -18
  8. package/dist/core/codec/table.js +3 -1
  9. package/dist/core/errors.d.ts +15 -5
  10. package/dist/core/index.d.ts +1 -1
  11. package/dist/core/index.js +5 -4
  12. package/dist/core/lifecycle.d.ts +21 -5
  13. package/dist/core/lifecycle.js +34 -8
  14. package/dist/core/rebind.svelte.d.ts +16 -2
  15. package/dist/core/rebind.svelte.js +26 -8
  16. package/dist/core/theme.css +50 -18
  17. package/dist/preset/recipes.css +55 -8
  18. package/dist/preset/scale.css +5 -4
  19. package/dist/preview/Preview.svelte +10 -9
  20. package/dist/preview/Preview.svelte.d.ts +5 -5
  21. package/dist/preview/bridge.d.ts +6 -4
  22. package/dist/preview/bridge.js +17 -7
  23. package/dist/preview/controller.d.ts +13 -6
  24. package/dist/preview/controller.js +5 -2
  25. package/dist/preview/geometry.d.ts +16 -1
  26. package/dist/preview/geometry.js +20 -0
  27. package/dist/preview/index.d.ts +1 -0
  28. package/dist/preview/index.js +7 -0
  29. package/dist/preview/overlay.d.ts +2 -1
  30. package/dist/preview/overlay.js +24 -9
  31. package/dist/preview/paint.js +4 -0
  32. package/dist/visual/ArrayField.svelte +26 -20
  33. package/dist/visual/ArrayField.svelte.d.ts +4 -3
  34. package/dist/visual/Card.svelte +21 -19
  35. package/dist/visual/Card.svelte.d.ts +8 -3
  36. package/dist/visual/DiagnosticList.svelte +1 -1
  37. package/dist/visual/EnumField.svelte +34 -14
  38. package/dist/visual/EnumField.svelte.d.ts +4 -3
  39. package/dist/visual/Field.svelte +87 -25
  40. package/dist/visual/Field.svelte.d.ts +11 -7
  41. package/dist/visual/FieldHint.svelte +59 -10
  42. package/dist/visual/FormatPopover.svelte +3 -1
  43. package/dist/visual/ObjectField.svelte +21 -2
  44. package/dist/visual/ObjectField.svelte.d.ts +3 -1
  45. package/dist/visual/ProseArrayElement.svelte +1 -6
  46. package/dist/visual/ProseArrayElement.svelte.d.ts +0 -1
  47. package/dist/visual/ProseField.svelte +20 -12
  48. package/dist/visual/ProseField.svelte.d.ts +5 -3
  49. package/dist/visual/TipsCard.svelte +1 -1
  50. package/dist/visual/VisualEditor.svelte +12 -13
  51. package/dist/visual/VisualEditor.svelte.d.ts +2 -3
  52. package/dist/visual/VisualEditorInner.svelte +140 -66
  53. package/dist/visual/VisualEditorInner.svelte.d.ts +2 -3
  54. package/dist/visual/controls.css +14 -11
  55. package/dist/visual/diagnostics.d.ts +12 -20
  56. package/dist/visual/diagnostics.js +6 -18
  57. package/dist/visual/index.d.ts +1 -0
  58. package/dist/visual/index.js +7 -0
  59. package/dist/visual/leaves.d.ts +47 -0
  60. package/dist/visual/leaves.js +31 -0
  61. package/dist/visual/props.d.ts +27 -6
  62. package/dist/visual/tips.d.ts +3 -1
  63. package/dist/visual/tips.js +5 -2
  64. package/package.json +3 -5
@@ -5,6 +5,13 @@ import type { ActiveLeaf, EditorChange } from './signals.js';
5
5
  import type { FormatDiagnostic, VisualStringsInput } from './strings.js';
6
6
  export interface VisualEditorProps {
7
7
  doc: Document;
8
+ /**
9
+ * The schema this document is edited against. BORROWED for the surface's lifetime,
10
+ * whoever handed it over: a quill from `@quillmark/quiver`'s `getQuill` is the
11
+ * quiver's, shared with every other caller for that ref, and freeing it hands the
12
+ * next caller a freed handle. A host wanting one of its own mints it from
13
+ * `.toTree()`. The editor frees nothing it is passed.
14
+ */
8
15
  quill: Quill;
9
16
  /**
10
17
  * The active leaf: its canonical `DocPath` and the session key of the card holding
@@ -30,8 +37,13 @@ export interface VisualEditorProps {
30
37
  /**
31
38
  * EVERY edit that lands on the document: a prose commit, a scalar/array/object
32
39
  * write, a card operation. The signal a host recompiles off; `source` is what
33
- * moved, for a host that wants a structure op to recompile at once and a
34
- * keystroke to wait for the burst to settle.
40
+ * moved.
41
+ *
42
+ * **The lane split is the default, not a tuning exercise.** `'structure'` arrives
43
+ * once per gesture and recompiles at once; `'prose'` and `'field'` arrive per
44
+ * keystroke and wait for the burst to settle. Recompiling structure on the debounce
45
+ * makes a card insert look dropped, and recompiling prose at once compiles the
46
+ * document on every character.
35
47
  */
36
48
  onChange?: (change: EditorChange) => void;
37
49
  /**
@@ -49,12 +61,21 @@ export interface VisualEditorProps {
49
61
  diagnostics?: Diagnostic[];
50
62
  /**
51
63
  * Consumer policy hook: given a field `addr` and an enum option,
52
- * return `false` to mark that option unavailable. A disallowed option renders
53
- * DISABLED (never stripped), so an already-authored value stays visible and its
54
- * stored payload is untouched: the schema is unchanged, this is runtime policy.
55
- * Absent → every schema option is offered (the default, zero behavior change).
64
+ * return `false` to mark that option unavailable; `enumDisallowed` decides how
65
+ * the control then draws it. The stored payload is untouched either way: the
66
+ * schema is unchanged, this is runtime policy. Absent → every schema option is
67
+ * offered. It reaches a field's own enum control; an enum inside an object
68
+ * subform has no `Addr` to pass and is offered whole.
56
69
  */
57
70
  enumOptionAllowed?: (addr: Addr, value: string) => boolean;
71
+ /**
72
+ * How an `enumOptionAllowed: false` option draws: `'disable'` (the default) greys
73
+ * it in place, `'hide'` leaves it out of the list. One policy for the surface, not
74
+ * a per-option verdict, and the SELECTED value is drawn under either (disabled
75
+ * when refused), so the control always shows what the document says
76
+ * (VISUAL_EDITOR §"Enum policy").
77
+ */
78
+ enumDisallowed?: 'hide' | 'disable';
58
79
  /**
59
80
  * Every word the surface says, keyed and partial: unset keys take the package's
60
81
  * English. Several are ACCESSIBLE NAMES rather than decoration, so this is what
@@ -19,6 +19,8 @@ export declare function tipsChannel(raw: unknown): string[];
19
19
  *
20
20
  * Raw HTML does not survive the round-trip, so this is not the injection seam an
21
21
  * `{@html}` of the same string would be. A throw degrades to the literal text:
22
- * chrome never breaks the editor.
22
+ * chrome never breaks the editor. The gate is read OUTSIDE that catch — an
23
+ * uninitialized core is not a tip that failed to render, and would otherwise be
24
+ * reported as one.
23
25
  */
24
26
  export declare function renderTip(markdown: string, onError?: EditorErrorHandler): Node;
@@ -5,7 +5,7 @@
5
5
  //
6
6
  // The channel narrowing the derive reads and the render the card paints. The write
7
7
  // is `patchEditorExt` (ext.ts), the one door into the namespace.
8
- import { importMarkdown } from '@quillmark/wasm';
8
+ import { core } from '../core/lifecycle.js';
9
9
  import { reportError, errorMessage } from '../core/errors.js';
10
10
  import { renderContent, inlineSchema } from '../core/codec/index.js';
11
11
  /**
@@ -32,9 +32,12 @@ export function tipsChannel(raw) {
32
32
  *
33
33
  * Raw HTML does not survive the round-trip, so this is not the injection seam an
34
34
  * `{@html}` of the same string would be. A throw degrades to the literal text:
35
- * chrome never breaks the editor.
35
+ * chrome never breaks the editor. The gate is read OUTSIDE that catch — an
36
+ * uninitialized core is not a tip that failed to render, and would otherwise be
37
+ * reported as one.
36
38
  */
37
39
  export function renderTip(markdown, onError) {
40
+ const { importMarkdown } = core();
38
41
  try {
39
42
  return renderContent(importMarkdown(markdown), inlineSchema);
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/svelte",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,9 +55,7 @@
55
55
  "THEMING.md",
56
56
  "NOTICE"
57
57
  ],
58
- "sideEffects": [
59
- "**/*.css"
60
- ],
58
+ "sideEffects": true,
61
59
  "scripts": {
62
60
  "build": "svelte-package",
63
61
  "prepare": "npm run build",
@@ -68,7 +66,7 @@
68
66
  "check": "svelte-check --tsconfig ./tsconfig.json"
69
67
  },
70
68
  "peerDependencies": {
71
- "@quillmark/wasm": ">=0.102.0-0",
69
+ "@quillmark/wasm": ">=0.103.0-0",
72
70
  "svelte": "^5.0.0"
73
71
  },
74
72
  "dependencies": {