@bendyline/squisq 2.0.1 → 2.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 (79) hide show
  1. package/dist/{Doc-ylqWKDc_.d.ts → Doc-DynJleo-.d.ts} +159 -2
  2. package/dist/{ImageEditDoc-D828IXJ1.d.ts → ImageEditDoc-Ca4Tr9uN.d.ts} +1 -1
  3. package/dist/{chunk-PXLVXTLW.js → chunk-ILWDXLUK.js} +24 -6
  4. package/dist/chunk-ILWDXLUK.js.map +1 -0
  5. package/dist/{chunk-W4O2TX5I.js → chunk-JHZWYRSW.js} +569 -1
  6. package/dist/chunk-JHZWYRSW.js.map +1 -0
  7. package/dist/{chunk-X6DUONGT.js → chunk-JI77MGAK.js} +123 -10
  8. package/dist/chunk-JI77MGAK.js.map +1 -0
  9. package/dist/{chunk-TFJVXUHH.js → chunk-OTKVFVL6.js} +1403 -41
  10. package/dist/chunk-OTKVFVL6.js.map +1 -0
  11. package/dist/{chunk-MMPBOUK7.js → chunk-QUUPYOSP.js} +8 -2
  12. package/dist/chunk-QUUPYOSP.js.map +1 -0
  13. package/dist/chunk-VWCJ2WXC.js +215 -0
  14. package/dist/chunk-VWCJ2WXC.js.map +1 -0
  15. package/dist/{chunk-2PWOO4ZE.js → chunk-VYFRI7R6.js} +2 -2
  16. package/dist/{chunk-CY2R2VPR.js → chunk-XNLB57UD.js} +2 -2
  17. package/dist/doc/index.d.ts +144 -5
  18. package/dist/doc/index.js +24 -4
  19. package/dist/generate/index.d.ts +1 -1
  20. package/dist/imageEdit/index.d.ts +3 -3
  21. package/dist/index.d.ts +6 -5
  22. package/dist/index.js +66 -8
  23. package/dist/jsonForm/index.d.ts +1 -1
  24. package/dist/jsonForm/index.js +4 -4
  25. package/dist/materializePageSection-DDzubQXo.d.ts +223 -0
  26. package/dist/narration/index.d.ts +1 -1
  27. package/dist/narration/index.js +3 -3
  28. package/dist/schemas/index.d.ts +30 -5
  29. package/dist/schemas/index.js +41 -3
  30. package/dist/{themeLibrary-RjVgLpUi.d.ts → themeLibrary-B72m0W1y.d.ts} +1 -1
  31. package/dist/transform/index.d.ts +8 -9
  32. package/dist/transform/index.js +1 -1
  33. package/package.json +1 -1
  34. package/src/__tests__/materializeBlockLayers.test.ts +32 -0
  35. package/src/__tests__/materializePageSections.test.ts +404 -0
  36. package/src/__tests__/pageStyle.test.ts +258 -0
  37. package/src/__tests__/templateAnnotationParse.test.ts +13 -0
  38. package/src/doc/index.ts +34 -0
  39. package/src/doc/materializeBlockLayers.ts +170 -9
  40. package/src/doc/page/PageSection.ts +174 -0
  41. package/src/doc/page/materializePageSection.ts +616 -0
  42. package/src/doc/page/resolvePageBlock.ts +108 -0
  43. package/src/doc/page/sectionExtractors.ts +466 -0
  44. package/src/doc/pageCss.ts +628 -0
  45. package/src/doc/templateInputs.ts +1 -0
  46. package/src/schemas/Doc.ts +22 -1
  47. package/src/schemas/PageStyle.ts +213 -0
  48. package/src/schemas/Theme.ts +7 -0
  49. package/src/schemas/index.ts +2 -0
  50. package/src/schemas/pageStyleDefaults.ts +204 -0
  51. package/src/schemas/themeCompile.ts +7 -0
  52. package/src/schemas/themeValidator.ts +183 -0
  53. package/src/schemas/themes/bold.json +29 -0
  54. package/src/schemas/themes/cinematic.json +32 -0
  55. package/src/schemas/themes/documentary.json +29 -0
  56. package/src/schemas/themes/gezellig.json +30 -0
  57. package/src/schemas/themes/magazine.json +37 -0
  58. package/src/schemas/themes/minimalist.json +29 -0
  59. package/src/schemas/themes/morning-light.json +32 -0
  60. package/src/schemas/themes/standard-dark.json +24 -0
  61. package/src/schemas/themes/standard.json +24 -0
  62. package/src/schemas/themes/tech-dark.json +42 -0
  63. package/src/schemas/themes/warm-earth.json +24 -0
  64. package/src/transform/registry.ts +19 -0
  65. package/src/transform/styles/dataDriven.ts +1 -0
  66. package/src/transform/styles/documentary.ts +1 -0
  67. package/src/transform/styles/magazine.ts +1 -0
  68. package/src/transform/styles/minimal.ts +1 -0
  69. package/src/transform/styles/narrative.ts +1 -0
  70. package/src/transform/types.ts +7 -0
  71. package/dist/chunk-FVJUUTEM.js +0 -74
  72. package/dist/chunk-FVJUUTEM.js.map +0 -1
  73. package/dist/chunk-MMPBOUK7.js.map +0 -1
  74. package/dist/chunk-PXLVXTLW.js.map +0 -1
  75. package/dist/chunk-TFJVXUHH.js.map +0 -1
  76. package/dist/chunk-W4O2TX5I.js.map +0 -1
  77. package/dist/chunk-X6DUONGT.js.map +0 -1
  78. /package/dist/{chunk-2PWOO4ZE.js.map → chunk-VYFRI7R6.js.map} +0 -0
  79. /package/dist/{chunk-CY2R2VPR.js.map → chunk-XNLB57UD.js.map} +0 -0
@@ -0,0 +1,174 @@
1
+ /**
2
+ * PageSection — the framework-agnostic block model for Page (linear) mode.
3
+ *
4
+ * Where `materializeBlockLayers` turns a block into fixed-viewport SVG
5
+ * `Layer[]` (slides, video frames, spatial canvases), `materializePageSection`
6
+ * turns the same block into a `PageSection`: a variable-height, content-slot
7
+ * description that HTML renderers lay out reflowably. React's page view and
8
+ * any string-HTML exporter consume this same structure, so neither re-derives
9
+ * content from blocks.
10
+ *
11
+ * Inherently spatial content (diagram/tree/timeline/map/drawing/layout,
12
+ * authored layers, custom templates) stays SVG: those sections carry the
13
+ * source block in a `canvas` media slot and consumers embed the result of
14
+ * `materializeBlockLayers` responsively. Core never emits markup.
15
+ */
16
+
17
+ import type { Block } from '../../schemas/Doc.js';
18
+ import type { MarkdownBlockNode } from '../../markdown/types.js';
19
+ import type { ThemeColorScheme } from '../../schemas/Theme.js';
20
+ import type { PageSectionKind, PageEmphasis, PageBackground } from '../../schemas/PageStyle.js';
21
+
22
+ /**
23
+ * Rich text content for a slot. `text` is always present (plain text);
24
+ * `markdown` carries the original body nodes when the block has them, so
25
+ * renderers can show real rich text with the plain string as fallback.
26
+ */
27
+ export interface PageRichText {
28
+ text: string;
29
+ markdown?: MarkdownBlockNode[];
30
+ }
31
+
32
+ /** Which spatial pipeline a canvas-embed section renders through. */
33
+ export type PageSpatialKind =
34
+ | 'diagram'
35
+ | 'tree'
36
+ | 'timeline'
37
+ | 'map'
38
+ | 'drawing'
39
+ | 'layout'
40
+ | 'custom'
41
+ | 'authored';
42
+
43
+ /** Media content for a section slot. */
44
+ export type PageMedia =
45
+ | {
46
+ type: 'image';
47
+ src: string;
48
+ alt: string;
49
+ credit?: string;
50
+ license?: string;
51
+ width?: number;
52
+ height?: number;
53
+ }
54
+ | {
55
+ type: 'video';
56
+ src: string;
57
+ posterSrc?: string;
58
+ alt: string;
59
+ clipStart?: number;
60
+ clipEnd?: number;
61
+ credit?: string;
62
+ license?: string;
63
+ }
64
+ | {
65
+ type: 'canvas';
66
+ spatial: PageSpatialKind;
67
+ /**
68
+ * The block to pass to `materializeBlockLayers` (already merged with
69
+ * derived inputs/params for annotated blocks). Read-only reference.
70
+ */
71
+ block: Block;
72
+ /** Intrinsic aspect for the responsive embed frame. */
73
+ aspect: { width: number; height: number };
74
+ };
75
+
76
+ /** One entry in a multi-item section (stats, cards, gallery tiles, list rows). */
77
+ export interface PageSectionItem {
78
+ title?: string;
79
+ body?: string;
80
+ /** Large numeral / value for stat and comparison items. */
81
+ value?: string | number;
82
+ media?: PageMedia;
83
+ /** Per-item color-scheme name (e.g. twoColumn halves). */
84
+ accentScheme?: string;
85
+ }
86
+
87
+ /** Structured diagnostics for sections that fell back (unknown template …). */
88
+ export interface PageSectionDiagnostic {
89
+ code: 'unknown-template';
90
+ template: string;
91
+ message: string;
92
+ }
93
+
94
+ /** Where a section's content came from. */
95
+ export type PageSectionSource =
96
+ | 'template'
97
+ | 'prose'
98
+ | 'authored'
99
+ | 'custom-template'
100
+ | 'cover'
101
+ | 'fallback';
102
+
103
+ /**
104
+ * One variable-height page section. The `kind` selects the layout family;
105
+ * `slots` carry the content; `emphasis`/`accent`/`background` carry the
106
+ * theme's art-direction decisions for this position in the sequence.
107
+ */
108
+ export interface PageSection {
109
+ kind: PageSectionKind;
110
+ /** Layout variant within the kind (e.g. quote-band: plain|display|full-bleed|editorial). */
111
+ variant?: string;
112
+ /** Source block id ('' for the synthesized cover hero). */
113
+ blockId: string;
114
+ /** Canonical source template id (post-alias); absent for prose/cover/authored. */
115
+ template?: string;
116
+ slots: {
117
+ /** Kicker text above the title (theme decides visibility/treatment). */
118
+ eyebrow?: string;
119
+ title?: string;
120
+ subtitle?: string;
121
+ body?: PageRichText;
122
+ /**
123
+ * Authored rich body nodes not consumed by the selected template. Page
124
+ * renderers place this after the template-specific layout so images,
125
+ * video/audio HTML, and Mermaid fences are never silently discarded.
126
+ */
127
+ richContent?: PageRichText;
128
+ media?: PageMedia;
129
+ items?: PageSectionItem[];
130
+ table?: {
131
+ headers: string[];
132
+ rows: string[][];
133
+ align?: (('left' | 'right' | 'center') | null)[];
134
+ };
135
+ milestone?: {
136
+ date: string;
137
+ description: string;
138
+ footer?: string;
139
+ mood?: 'neutral' | 'somber' | 'celebratory';
140
+ };
141
+ attribution?: string;
142
+ caption?: string;
143
+ /** Small print: source citation, term origin, comparison unit. */
144
+ meta?: string;
145
+ /** Heading depth for prose sections (1..6). */
146
+ headingLevel?: number;
147
+ };
148
+ emphasis: PageEmphasis;
149
+ /** Resolved accent for this section; block-level colorScheme wins over rotation. */
150
+ accent: {
151
+ schemeName?: string;
152
+ scheme?: ThemeColorScheme;
153
+ role: 'primary' | 'rotation' | 'block' | 'none';
154
+ };
155
+ background: PageBackground;
156
+ /** Pre-order position among this doc's sections. */
157
+ index: number;
158
+ totalSections: number;
159
+ /** Nesting depth of the source block (0 for top-level and the cover). */
160
+ depth: number;
161
+ source: PageSectionSource;
162
+ diagnostic?: PageSectionDiagnostic;
163
+ /** Freeform theme hints from pageStyle overrides (e.g. dropCap, frame). */
164
+ hints?: Record<string, string | number | boolean>;
165
+ }
166
+
167
+ /** Result wrapper mirroring `BlockLayerMaterialization`'s shape. */
168
+ export interface PageSectionMaterialization {
169
+ section: PageSection;
170
+ /** The source block; undefined for the synthesized cover hero. */
171
+ block?: Block;
172
+ source: PageSectionSource;
173
+ diagnostic?: PageSectionDiagnostic;
174
+ }