@squinch/core 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.
Files changed (64) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +41 -0
  3. package/dist/api.d.ts +91 -0
  4. package/dist/api.js +232 -0
  5. package/dist/browser.d.ts +3 -0
  6. package/dist/browser.js +9 -0
  7. package/dist/diff/diff.d.ts +30 -0
  8. package/dist/diff/diff.js +365 -0
  9. package/dist/fonts.generated.d.ts +1 -0
  10. package/dist/fonts.generated.js +6 -0
  11. package/dist/grammar/parser.js +22 -0
  12. package/dist/grammar/parser.terms.js +115 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +4 -0
  15. package/dist/layout/layout.d.ts +197 -0
  16. package/dist/layout/layout.js +1721 -0
  17. package/dist/metrics.d.ts +20 -0
  18. package/dist/metrics.generated.d.ts +4 -0
  19. package/dist/metrics.generated.js +4 -0
  20. package/dist/metrics.js +57 -0
  21. package/dist/model/build.d.ts +8 -0
  22. package/dist/model/build.js +1343 -0
  23. package/dist/model/packs.d.ts +13 -0
  24. package/dist/model/packs.js +29 -0
  25. package/dist/model/source.d.ts +10 -0
  26. package/dist/model/source.js +28 -0
  27. package/dist/model/suggest.d.ts +2 -0
  28. package/dist/model/suggest.js +24 -0
  29. package/dist/model/types.d.ts +226 -0
  30. package/dist/model/types.js +24 -0
  31. package/dist/packs/node-fs.d.ts +1 -0
  32. package/dist/packs/node-fs.js +37 -0
  33. package/dist/packs/registry.d.ts +61 -0
  34. package/dist/packs/registry.js +122 -0
  35. package/dist/packs/sanitize.d.ts +12 -0
  36. package/dist/packs/sanitize.js +127 -0
  37. package/dist/packs/sysGlyphs.d.ts +2 -0
  38. package/dist/packs/sysGlyphs.js +21 -0
  39. package/dist/render/adaptive.d.ts +13 -0
  40. package/dist/render/adaptive.js +112 -0
  41. package/dist/render/html/runtime.d.ts +1 -0
  42. package/dist/render/html/runtime.generated.d.ts +1 -0
  43. package/dist/render/html/runtime.generated.js +6 -0
  44. package/dist/render/html/runtime.js +362 -0
  45. package/dist/render/html.d.ts +39 -0
  46. package/dist/render/html.js +235 -0
  47. package/dist/render/svg.d.ts +75 -0
  48. package/dist/render/svg.js +1403 -0
  49. package/dist/render/validate.d.ts +4 -0
  50. package/dist/render/validate.js +9 -0
  51. package/dist/themes/index.d.ts +84 -0
  52. package/dist/themes/index.js +90 -0
  53. package/dist/view/dive.d.ts +55 -0
  54. package/dist/view/dive.js +57 -0
  55. package/dist/view/navigate.d.ts +38 -0
  56. package/dist/view/navigate.js +81 -0
  57. package/dist/view/resolve.d.ts +92 -0
  58. package/dist/view/resolve.js +591 -0
  59. package/fonts/inter-400.ttf +0 -0
  60. package/fonts/inter-500.ttf +0 -0
  61. package/fonts/inter-600.ttf +0 -0
  62. package/fonts/mono-400.ttf +0 -0
  63. package/metrics.json +510 -0
  64. package/package.json +89 -0
@@ -0,0 +1,75 @@
1
+ import type { Theme } from "../themes/index.js";
2
+ import type { Positioned } from "../layout/layout.js";
3
+ import type { Hue, SNote } from "../model/types.js";
4
+ export interface RenderOpts {
5
+ highlight?: string[];
6
+ /** The view's `color #tag hue` statements — already applied to the graph by
7
+ * resolution; the renderer only needs them for the legend, where a tag is
8
+ * the one label a hue can honestly carry. */
9
+ colors?: {
10
+ tag: string;
11
+ hue: Hue;
12
+ }[];
13
+ notes?: SNote[];
14
+ showDescriptions?: boolean;
15
+ /** `legend auto` — a key of the styles this render actually uses. */
16
+ legend?: boolean;
17
+ /** drafting-style corner block (bottom-right), free-form key/values */
18
+ titleblock?: Record<string, string>;
19
+ /** view title — the titleblock headline */
20
+ title?: string;
21
+ /** Embed the subsetted faces via @font-face (default true), so the SVG
22
+ * renders with the exact font the metrics were measured from even in
23
+ * sandboxed contexts like GitHub's <img>. Off = smaller output for hosts
24
+ * that already serve the fonts. */
25
+ embedFonts?: boolean;
26
+ /** Reveal this many hops of a `show flow`, dimming everything the request has
27
+ * not reached yet and picking out the current one. A viewer concern — the
28
+ * DSL declares the flow, the presenter walks it — so it lives here and not
29
+ * in the model. Omitted, the whole flow shows at once, as before.
30
+ *
31
+ * Counted over the hops **visible in this view**, not the flow's declared
32
+ * numbering: a flow that starts two systems away has its opening steps
33
+ * lifted out of a scoped view, and walking declared numbers there would
34
+ * spend the first presses on frames where nothing happens. `1` is always
35
+ * the first hop you can actually see. Badges still read their declared
36
+ * number — that's the flow's real shape. */
37
+ flowStep?: number;
38
+ /** Hand id-bearing definitions out instead of emitting them inline, keyed by
39
+ * id. The interactive HTML export puts every view in one document, where
40
+ * fragment references resolve document-wide — so one `<symbol id="sq-aws-
41
+ * lambda">` serves all of them and the bodies keep their `<use href="#…">`
42
+ * untouched. Measured on `examples/microservices`: 27 KB of shared defs
43
+ * against 126 KB if every view carried its own.
44
+ *
45
+ * Setting the same id to *different* markup throws. That turns "symbols,
46
+ * gradients and clip paths are theme-free" from a thing we believe into a
47
+ * build-time assertion — it fires the day someone themes one. */
48
+ collectDefs?: Map<string, string>;
49
+ /** Suffix for the one def whose content does depend on the theme (`sq-hatch`
50
+ * bakes `t.border`), so a document carrying two palettes does not have to
51
+ * pick one. Applied by the emitter to both definition and reference, so
52
+ * nothing downstream rewrites strings. */
53
+ defsScope?: string;
54
+ }
55
+ /** The @font-face rules alone. Exported because the interactive HTML export
56
+ * hoists them into one <style> for the whole document instead of repeating
57
+ * 33 KB of base64 in every view. One implementation of the rule either way.
58
+ *
59
+ * `used` names extra `family:weight` faces to embed. The HTML export passes
60
+ * every face rather than a union of what its views drew: one document holds
61
+ * many views, any of which may be re-rendered client-side, so a hoisted set
62
+ * that happened to miss mono would silently fall back mid-navigation. */
63
+ export declare function fontFaceCSS(t: Theme, used?: Iterable<string>): string;
64
+ /** Every face the bundle carries — the HTML export's hoisted set. */
65
+ export declare function allFaces(): string[];
66
+ /** Anything with a box: a node, a pill, a badge, a chip, a note, a reserved
67
+ * band. The annotation layers all resolve collisions against each other, so
68
+ * they need one shared vocabulary rather than three that agree by accident. */
69
+ export interface Rect {
70
+ x: number;
71
+ y: number;
72
+ w: number;
73
+ h: number;
74
+ }
75
+ export declare function renderSVG(p: Positioned, t: Theme, opts?: RenderOpts): string;