@stonedeck/core 0.7.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 (110) hide show
  1. package/dist/emitter.d.ts +6 -0
  2. package/dist/emitter.d.ts.map +1 -0
  3. package/dist/emitter.js +107 -0
  4. package/dist/emitter.js.map +1 -0
  5. package/dist/emitter.test.d.ts +2 -0
  6. package/dist/emitter.test.d.ts.map +1 -0
  7. package/dist/emitter.test.js +70 -0
  8. package/dist/emitter.test.js.map +1 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +8 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/interface/export-plugin.d.ts +5 -0
  14. package/dist/interface/export-plugin.d.ts.map +1 -0
  15. package/dist/interface/export-plugin.js +2 -0
  16. package/dist/interface/export-plugin.js.map +1 -0
  17. package/dist/layouts/layout-generator.d.ts +14 -0
  18. package/dist/layouts/layout-generator.d.ts.map +1 -0
  19. package/dist/layouts/layout-generator.js +110 -0
  20. package/dist/layouts/layout-generator.js.map +1 -0
  21. package/dist/layouts/registry.json +290 -0
  22. package/dist/layouts/validator.d.ts +7 -0
  23. package/dist/layouts/validator.d.ts.map +1 -0
  24. package/dist/layouts/validator.js +27 -0
  25. package/dist/layouts/validator.js.map +1 -0
  26. package/dist/layouts/validator.test.d.ts +2 -0
  27. package/dist/layouts/validator.test.d.ts.map +1 -0
  28. package/dist/layouts/validator.test.js +19 -0
  29. package/dist/layouts/validator.test.js.map +1 -0
  30. package/dist/models/ir.d.ts +91 -0
  31. package/dist/models/ir.d.ts.map +1 -0
  32. package/dist/models/ir.js +2 -0
  33. package/dist/models/ir.js.map +1 -0
  34. package/dist/parser/image-mapper.d.ts +8 -0
  35. package/dist/parser/image-mapper.d.ts.map +1 -0
  36. package/dist/parser/image-mapper.js +15 -0
  37. package/dist/parser/image-mapper.js.map +1 -0
  38. package/dist/parser/list-mapper.d.ts +3 -0
  39. package/dist/parser/list-mapper.d.ts.map +1 -0
  40. package/dist/parser/list-mapper.js +24 -0
  41. package/dist/parser/list-mapper.js.map +1 -0
  42. package/dist/parser/list-mapper.test.d.ts +2 -0
  43. package/dist/parser/list-mapper.test.d.ts.map +1 -0
  44. package/dist/parser/list-mapper.test.js +26 -0
  45. package/dist/parser/list-mapper.test.js.map +1 -0
  46. package/dist/parser/manifesto.d.ts +9 -0
  47. package/dist/parser/manifesto.d.ts.map +1 -0
  48. package/dist/parser/manifesto.js +40 -0
  49. package/dist/parser/manifesto.js.map +1 -0
  50. package/dist/parser/manifesto.test.d.ts +2 -0
  51. package/dist/parser/manifesto.test.d.ts.map +1 -0
  52. package/dist/parser/manifesto.test.js +32 -0
  53. package/dist/parser/manifesto.test.js.map +1 -0
  54. package/dist/parser/table-mapper.d.ts +7 -0
  55. package/dist/parser/table-mapper.d.ts.map +1 -0
  56. package/dist/parser/table-mapper.js +33 -0
  57. package/dist/parser/table-mapper.js.map +1 -0
  58. package/dist/parser/tokenizer.d.ts +4 -0
  59. package/dist/parser/tokenizer.d.ts.map +1 -0
  60. package/dist/parser/tokenizer.js +103 -0
  61. package/dist/parser/tokenizer.js.map +1 -0
  62. package/dist/parser/tokenizer.test.d.ts +2 -0
  63. package/dist/parser/tokenizer.test.d.ts.map +1 -0
  64. package/dist/parser/tokenizer.test.js +31 -0
  65. package/dist/parser/tokenizer.test.js.map +1 -0
  66. package/dist/processor.d.ts +3 -0
  67. package/dist/processor.d.ts.map +1 -0
  68. package/dist/processor.js +5 -0
  69. package/dist/processor.js.map +1 -0
  70. package/dist/resolver/metrics.d.ts +27 -0
  71. package/dist/resolver/metrics.d.ts.map +1 -0
  72. package/dist/resolver/metrics.js +43 -0
  73. package/dist/resolver/metrics.js.map +1 -0
  74. package/dist/resolver/metrics.test.d.ts +2 -0
  75. package/dist/resolver/metrics.test.d.ts.map +1 -0
  76. package/dist/resolver/metrics.test.js +23 -0
  77. package/dist/resolver/metrics.test.js.map +1 -0
  78. package/dist/resolver/theme-loader.d.ts +17 -0
  79. package/dist/resolver/theme-loader.d.ts.map +1 -0
  80. package/dist/resolver/theme-loader.js +110 -0
  81. package/dist/resolver/theme-loader.js.map +1 -0
  82. package/dist/resolver/theme-loader.test.d.ts +2 -0
  83. package/dist/resolver/theme-loader.test.d.ts.map +1 -0
  84. package/dist/resolver/theme-loader.test.js +60 -0
  85. package/dist/resolver/theme-loader.test.js.map +1 -0
  86. package/package.json +19 -0
  87. package/src/emitter.ts +118 -0
  88. package/src/index.ts +7 -0
  89. package/src/interface/export-plugin.ts +5 -0
  90. package/src/layouts/layout-generator.ts +116 -0
  91. package/src/layouts/registry.json +290 -0
  92. package/src/layouts/validator.ts +31 -0
  93. package/src/models/ir.ts +98 -0
  94. package/src/parser/image-mapper.ts +14 -0
  95. package/src/parser/list-mapper.ts +28 -0
  96. package/src/parser/manifesto.ts +49 -0
  97. package/src/parser/table-mapper.ts +38 -0
  98. package/src/parser/tokenizer.ts +126 -0
  99. package/src/processor.ts +6 -0
  100. package/src/resolver/metrics.ts +64 -0
  101. package/src/resolver/theme-loader.ts +122 -0
  102. package/src/themes/academico.yaml +25 -0
  103. package/src/themes/corporativo.yaml +25 -0
  104. package/src/themes/dark_mode.yaml +26 -0
  105. package/src/themes/minimalista.yaml +25 -0
  106. package/src/themes/moderno.yaml +26 -0
  107. package/test/cycle2_markdown.test.ts +36 -0
  108. package/test/cycle2_slides.test.ts +52 -0
  109. package/tsconfig.json +17 -0
  110. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,290 @@
1
+ {
2
+ "layouts": [
3
+ {
4
+ "id": "section-header",
5
+ "slots": [
6
+ {
7
+ "id": "title",
8
+ "x": 50,
9
+ "y": 180,
10
+ "width": 620,
11
+ "height": 60
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "id": "title",
17
+ "slots": [
18
+ {
19
+ "id": "title",
20
+ "x": 50,
21
+ "y": 120,
22
+ "width": 620,
23
+ "height": 100
24
+ },
25
+ {
26
+ "id": "subtitle",
27
+ "x": 50,
28
+ "y": 230,
29
+ "width": 620,
30
+ "height": 80
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ "id": "title-and-content",
36
+ "slots": [
37
+ {
38
+ "id": "title",
39
+ "x": 50,
40
+ "y": 30,
41
+ "width": 620,
42
+ "height": 60
43
+ },
44
+ {
45
+ "id": "body",
46
+ "x": 50,
47
+ "y": 100,
48
+ "width": 620,
49
+ "height": 280
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "id": "title-and-content",
55
+ "slots": [
56
+ {
57
+ "id": "title",
58
+ "x": 50,
59
+ "y": 30,
60
+ "width": 620,
61
+ "height": 60
62
+ },
63
+ {
64
+ "id": "col1",
65
+ "x": 50,
66
+ "y": 100,
67
+ "width": 300,
68
+ "height": 280
69
+ },
70
+ {
71
+ "id": "col2",
72
+ "x": 370,
73
+ "y": 100,
74
+ "width": 300,
75
+ "height": 280
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "id": "title-and-content",
81
+ "slots": [
82
+ {
83
+ "id": "title",
84
+ "x": 50,
85
+ "y": 30,
86
+ "width": 620,
87
+ "height": 60
88
+ },
89
+ {
90
+ "id": "col1",
91
+ "x": 50,
92
+ "y": 100,
93
+ "width": 190,
94
+ "height": 280
95
+ },
96
+ {
97
+ "id": "col2",
98
+ "x": 260,
99
+ "y": 100,
100
+ "width": 190,
101
+ "height": 280
102
+ },
103
+ {
104
+ "id": "col3",
105
+ "x": 470,
106
+ "y": 100,
107
+ "width": 190,
108
+ "height": 280
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "id": "title-and-content",
114
+ "slots": [
115
+ {
116
+ "id": "title",
117
+ "x": 50,
118
+ "y": 30,
119
+ "width": 620,
120
+ "height": 60
121
+ },
122
+ {
123
+ "id": "card1",
124
+ "x": 50,
125
+ "y": 100,
126
+ "width": 300,
127
+ "height": 135
128
+ },
129
+ {
130
+ "id": "card2",
131
+ "x": 370,
132
+ "y": 100,
133
+ "width": 300,
134
+ "height": 135
135
+ },
136
+ {
137
+ "id": "card3",
138
+ "x": 50,
139
+ "y": 245,
140
+ "width": 300,
141
+ "height": 135
142
+ },
143
+ {
144
+ "id": "card4",
145
+ "x": 370,
146
+ "y": 245,
147
+ "width": 300,
148
+ "height": 135
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "id": "content",
154
+ "slots": [
155
+ {
156
+ "id": "body",
157
+ "x": 50,
158
+ "y": 50,
159
+ "width": 620,
160
+ "height": 300
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "id": "content",
166
+ "slots": [
167
+ {
168
+ "id": "col1",
169
+ "x": 50,
170
+ "y": 50,
171
+ "width": 300,
172
+ "height": 300
173
+ },
174
+ {
175
+ "id": "col2",
176
+ "x": 370,
177
+ "y": 50,
178
+ "width": 300,
179
+ "height": 300
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "id": "content",
185
+ "slots": [
186
+ {
187
+ "id": "col1",
188
+ "x": 50,
189
+ "y": 50,
190
+ "width": 190,
191
+ "height": 300
192
+ },
193
+ {
194
+ "id": "col2",
195
+ "x": 260,
196
+ "y": 50,
197
+ "width": 190,
198
+ "height": 300
199
+ },
200
+ {
201
+ "id": "col3",
202
+ "x": 470,
203
+ "y": 50,
204
+ "width": 190,
205
+ "height": 300
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "id": "content",
211
+ "slots": [
212
+ {
213
+ "id": "card1",
214
+ "x": 50,
215
+ "y": 50,
216
+ "width": 300,
217
+ "height": 140
218
+ },
219
+ {
220
+ "id": "card2",
221
+ "x": 370,
222
+ "y": 50,
223
+ "width": 300,
224
+ "height": 140
225
+ },
226
+ {
227
+ "id": "card3",
228
+ "x": 50,
229
+ "y": 210,
230
+ "width": 300,
231
+ "height": 140
232
+ },
233
+ {
234
+ "id": "card4",
235
+ "x": 370,
236
+ "y": 210,
237
+ "width": 300,
238
+ "height": 140
239
+ }
240
+ ]
241
+ },
242
+ {
243
+ "id": "content",
244
+ "slots": [
245
+ {
246
+ "id": "card1",
247
+ "x": 50,
248
+ "y": 50,
249
+ "width": 190,
250
+ "height": 140
251
+ },
252
+ {
253
+ "id": "card2",
254
+ "x": 260,
255
+ "y": 50,
256
+ "width": 190,
257
+ "height": 140
258
+ },
259
+ {
260
+ "id": "card3",
261
+ "x": 470,
262
+ "y": 50,
263
+ "width": 190,
264
+ "height": 140
265
+ },
266
+ {
267
+ "id": "card4",
268
+ "x": 50,
269
+ "y": 210,
270
+ "width": 190,
271
+ "height": 140
272
+ },
273
+ {
274
+ "id": "card5",
275
+ "x": 260,
276
+ "y": 210,
277
+ "width": 190,
278
+ "height": 140
279
+ },
280
+ {
281
+ "id": "card6",
282
+ "x": 470,
283
+ "y": 210,
284
+ "width": 190,
285
+ "height": 140
286
+ }
287
+ ]
288
+ }
289
+ ]
290
+ }
@@ -0,0 +1,7 @@
1
+ import { Layout } from '../models/ir.js';
2
+ export declare function validateLayout(id: string, slotCount: number): {
3
+ valid: boolean;
4
+ error?: string;
5
+ };
6
+ export declare function getLayout(id: string, slotCount: number): Layout | undefined;
7
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/layouts/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAYzC,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAMhG;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAU3E"}
@@ -0,0 +1,27 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { LayoutGenerator } from './layout-generator.js';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ const registryPath = path.join(__dirname, 'registry.json');
8
+ const registry = JSON.parse(fs.readFileSync(registryPath, 'utf-8'));
9
+ export function validateLayout(id, slotCount) {
10
+ const layout = getLayout(id, slotCount);
11
+ if (!layout) {
12
+ return { valid: false, error: `Layout '${id}' not found for ${slotCount} slots.` };
13
+ }
14
+ return { valid: true };
15
+ }
16
+ export function getLayout(id, slotCount) {
17
+ // 1. Try Registry First (Static definitions override dynamic)
18
+ const layout = registry.layouts.find((l) => l.id === id && l.slots.length === slotCount);
19
+ if (layout)
20
+ return layout;
21
+ // 2. Try Dynamic Generator
22
+ const dynamic = LayoutGenerator.generate(id, slotCount);
23
+ if (dynamic)
24
+ return dynamic;
25
+ return undefined;
26
+ }
27
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/layouts/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;AAEpE,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,SAAiB;IACxD,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,mBAAmB,SAAS,SAAS,EAAE,CAAC;IACvF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAU,EAAE,SAAiB;IACnD,8DAA8D;IAC9D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IAC9F,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACxD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.test.d.ts","sourceRoot":"","sources":["../../src/layouts/validator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const validator_1 = require("./validator");
4
+ describe('Layout Validator', () => {
5
+ it('should validate official layouts', () => {
6
+ expect((0, validator_1.validateLayout)('title-slide', 1).valid).toBe(true);
7
+ expect((0, validator_1.validateLayout)('cards-4', 4).valid).toBe(true);
8
+ });
9
+ it('should return invalid for unknown layouts', () => {
10
+ const result = (0, validator_1.validateLayout)('unknown-layout', 1);
11
+ expect(result.valid).toBe(false);
12
+ expect(result.error).toContain('not found in official registry');
13
+ });
14
+ it('should be valid even with excess slots (per RFC 10.3)', () => {
15
+ // RFC says excess is ignored, so it's not a hard validation error
16
+ expect((0, validator_1.validateLayout)('title-only', 3).valid).toBe(true);
17
+ });
18
+ });
19
+ //# sourceMappingURL=validator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.test.js","sourceRoot":"","sources":["../../src/layouts/validator.test.ts"],"names":[],"mappings":";;AAAA,2CAA6C;AAE7C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,IAAA,0BAAc,EAAC,aAAa,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,CAAC,IAAA,0BAAc,EAAC,SAAS,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACjD,MAAM,MAAM,GAAG,IAAA,0BAAc,EAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC7D,kEAAkE;QAClE,MAAM,CAAC,IAAA,0BAAc,EAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,91 @@
1
+ export interface StoneDeckManifesto {
2
+ StoneDeck: boolean;
3
+ title: string;
4
+ subtitle?: string;
5
+ theme: string;
6
+ author?: string;
7
+ }
8
+ export interface ListItem {
9
+ text: string;
10
+ level: number;
11
+ bullet_type: 'dot' | 'square' | 'arrow' | 'dash' | 'number' | string;
12
+ }
13
+ export interface TableCell {
14
+ text: string;
15
+ isHeader: boolean;
16
+ align?: 'left' | 'center' | 'right';
17
+ }
18
+ export interface SlideStyle {
19
+ background?: {
20
+ type: 'color' | 'image' | 'gradient';
21
+ value?: string;
22
+ src?: string;
23
+ opacity?: number;
24
+ fit?: 'cover' | 'contain';
25
+ colors?: string[];
26
+ direction?: string;
27
+ };
28
+ content_align?: {
29
+ horizontal?: 'left' | 'center' | 'right';
30
+ vertical?: 'top' | 'middle' | 'bottom';
31
+ };
32
+ card?: {
33
+ background?: string;
34
+ radius?: string;
35
+ border?: string;
36
+ shadow?: boolean;
37
+ content_align?: {
38
+ horizontal?: 'left' | 'center' | 'right';
39
+ vertical?: 'top' | 'middle' | 'bottom';
40
+ };
41
+ };
42
+ list?: {
43
+ bullet_type?: string;
44
+ bullet_color?: string;
45
+ spacing?: string;
46
+ indent?: string;
47
+ };
48
+ [key: string]: any;
49
+ }
50
+ export type SlotContent = {
51
+ type: 'markdown';
52
+ raw: string;
53
+ } | {
54
+ type: 'list';
55
+ items: ListItem[];
56
+ } | {
57
+ type: 'table';
58
+ rows: TableCell[][];
59
+ } | {
60
+ type: 'image';
61
+ src: string;
62
+ alt?: string;
63
+ };
64
+ export interface Slide {
65
+ layout_id: string;
66
+ title?: string;
67
+ style: SlideStyle;
68
+ slots: SlotContent[];
69
+ warnings?: string[] | undefined;
70
+ metrics?: {
71
+ heights: number[];
72
+ } | undefined;
73
+ }
74
+ export interface StoneDeckIR {
75
+ manifesto: StoneDeckManifesto;
76
+ slides: Slide[];
77
+ basePath: string;
78
+ warnings?: string[] | undefined;
79
+ }
80
+ export interface LayoutSlot {
81
+ id: string;
82
+ x: number;
83
+ y: number;
84
+ width: number;
85
+ height: number;
86
+ }
87
+ export interface Layout {
88
+ id: string;
89
+ slots: LayoutSlot[];
90
+ }
91
+ //# sourceMappingURL=ir.d.ts.map
@@ -0,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IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.js","sourceRoot":"","sources":["../../src/models/ir.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detects a Markdown image in a string.
3
+ */
4
+ export declare function mapMarkdownImage(markdown: string): {
5
+ src: string;
6
+ alt?: string;
7
+ } | null;
8
+ //# sourceMappingURL=image-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-mapper.d.ts","sourceRoot":"","sources":["../../src/parser/image-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAUvF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Detects a Markdown image in a string.
3
+ */
4
+ export function mapMarkdownImage(markdown) {
5
+ // Regex for ![alt](src)
6
+ const match = markdown.trim().match(/^!\[(.*?)\]\((.*?)\)$/);
7
+ if (match && match[1] !== undefined && match[2] !== undefined) {
8
+ return {
9
+ alt: match[1],
10
+ src: match[2]
11
+ };
12
+ }
13
+ return null;
14
+ }
15
+ //# sourceMappingURL=image-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-mapper.js","sourceRoot":"","sources":["../../src/parser/image-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC7C,wBAAwB;IACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC7D,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5D,OAAO;YACH,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACb,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SAChB,CAAC;IACN,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ListItem } from '../models/ir.js';
2
+ export declare function mapMarkdownLists(markdown: string): ListItem[];
3
+ //# sourceMappingURL=list-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-mapper.d.ts","sourceRoot":"","sources":["../../src/parser/list-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAyB7D"}
@@ -0,0 +1,24 @@
1
+ export function mapMarkdownLists(markdown) {
2
+ const lines = markdown.split(/\r?\n/);
3
+ const items = [];
4
+ for (const line of lines) {
5
+ // Regex matches: leading spaces, asterisk/dash/number, then the text
6
+ const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.*)$/);
7
+ if (match) {
8
+ const indentation = match[1].length;
9
+ const bullet = match[2];
10
+ const text = match[3];
11
+ // RFC 9.2: Hierarquia até 3 níveis.
12
+ // Assuming 2 spaces per level.
13
+ const level = Math.min(Math.floor(indentation / 2) + 1, 3);
14
+ let bullet_type = 'dot';
15
+ if (bullet === '-')
16
+ bullet_type = 'dash';
17
+ if (/^\d+\./.test(bullet))
18
+ bullet_type = 'number';
19
+ items.push({ text, level, bullet_type });
20
+ }
21
+ }
22
+ return items;
23
+ }
24
+ //# sourceMappingURL=list-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-mapper.js","sourceRoot":"","sources":["../../src/parser/list-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,KAAK,GAAe,EAAE,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,qEAAqE;QACrE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACxD,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC;YACrC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YACzB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YAEvB,qCAAqC;YACrC,+BAA+B;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAE3D,IAAI,WAAW,GAAG,KAAK,CAAC;YACxB,IAAI,MAAM,KAAK,GAAG;gBAAE,WAAW,GAAG,MAAM,CAAC;YACzC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;gBAAE,WAAW,GAAG,QAAQ,CAAC;YAElD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=list-mapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-mapper.test.d.ts","sourceRoot":"","sources":["../../src/parser/list-mapper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const list_mapper_1 = require("./list-mapper");
4
+ describe('List Mapper', () => {
5
+ it('should map simple lists', () => {
6
+ const markdown = '- Item 1\n- Item 2';
7
+ const items = (0, list_mapper_1.mapMarkdownLists)(markdown);
8
+ expect(items.length).toBe(2);
9
+ expect(items[0]).toEqual({ text: 'Item 1', level: 1, bullet_type: 'dash' });
10
+ });
11
+ it('should handle nested lists up to level 3', () => {
12
+ const markdown = '- Level 1\n - Level 2\n - Level 3\n - Still Level 3';
13
+ const items = (0, list_mapper_1.mapMarkdownLists)(markdown);
14
+ expect(items[0]?.level).toBe(1);
15
+ expect(items[1]?.level).toBe(2);
16
+ expect(items[2]?.level).toBe(3);
17
+ expect(items[3]?.level).toBe(3);
18
+ });
19
+ it('should map numbered lists', () => {
20
+ const markdown = '1. First\n2. Second';
21
+ const items = (0, list_mapper_1.mapMarkdownLists)(markdown);
22
+ expect(items[0]?.bullet_type).toBe('number');
23
+ expect(items[1]?.bullet_type).toBe('number');
24
+ });
25
+ });
26
+ //# sourceMappingURL=list-mapper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-mapper.test.js","sourceRoot":"","sources":["../../src/parser/list-mapper.test.ts"],"names":[],"mappings":";;AAAA,+CAAiD;AAEjD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAC/B,MAAM,QAAQ,GAAG,oBAAoB,CAAC;QACtC,MAAM,KAAK,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,QAAQ,GAAG,8DAA8D,CAAC;QAChF,MAAM,KAAK,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACjC,MAAM,QAAQ,GAAG,qBAAqB,CAAC;QACvC,MAAM,KAAK,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { StoneDeckManifesto } from '../models/ir.js';
2
+ export declare class ManifestoValidationError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export declare function parseManifesto(content: string): {
6
+ manifesto: StoneDeckManifesto;
7
+ remainingContent: string;
8
+ };
9
+ //# sourceMappingURL=manifesto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifesto.d.ts","sourceRoot":"","sources":["../../src/parser/manifesto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,wBAAyB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI9B;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,kBAAkB,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAsC3G"}
@@ -0,0 +1,40 @@
1
+ import * as YAML from 'yaml';
2
+ export class ManifestoValidationError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = 'ManifestoValidationError';
6
+ }
7
+ }
8
+ export function parseManifesto(content) {
9
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
10
+ if (!match) {
11
+ throw new ManifestoValidationError('Manifesto block (--- ... ---) not found at the beginning of the file.');
12
+ }
13
+ const yamlContent = match[1];
14
+ const remainingContent = content.slice(match[0].length).trim();
15
+ let data;
16
+ try {
17
+ data = YAML.parse(yamlContent);
18
+ }
19
+ catch (e) {
20
+ throw new ManifestoValidationError(`Failed to parse Manifesto YAML: ${e.message}`);
21
+ }
22
+ if (data?.StoneDeck !== true) {
23
+ throw new ManifestoValidationError('Manifesto must contain "StoneDeck: true" to be processed.');
24
+ }
25
+ if (!data.title) {
26
+ throw new ManifestoValidationError('Manifesto must contain a "title".');
27
+ }
28
+ if (!data.theme) {
29
+ throw new ManifestoValidationError('Manifesto must contain a "theme".');
30
+ }
31
+ const manifesto = {
32
+ StoneDeck: true,
33
+ title: data.title,
34
+ subtitle: data.subtitle,
35
+ theme: data.theme,
36
+ author: data.author,
37
+ };
38
+ return { manifesto, remainingContent };
39
+ }
40
+ //# sourceMappingURL=manifesto.js.map
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5E,CAAC;IAED,MAAM,SAAS,GAAuB;QAClC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=manifesto.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifesto.test.d.ts","sourceRoot":"","sources":["../../src/parser/manifesto.test.ts"],"names":[],"mappings":""}