@samva/markup 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 (124) hide show
  1. package/AGENTS.md +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +41 -0
  4. package/dist/ast-DAhnAvQN.d.ts +120 -0
  5. package/dist/ast.d.ts +2 -0
  6. package/dist/ast.js +159 -0
  7. package/dist/ast.js.map +1 -0
  8. package/dist/candidate.d.ts +29 -0
  9. package/dist/candidate.js +88 -0
  10. package/dist/candidate.js.map +1 -0
  11. package/dist/checks-CW0nFj5n.js +58922 -0
  12. package/dist/checks-CW0nFj5n.js.map +1 -0
  13. package/dist/checks.d.ts +26 -0
  14. package/dist/checks.js +2 -0
  15. package/dist/classes.d.ts +27 -0
  16. package/dist/classes.js +184 -0
  17. package/dist/classes.js.map +1 -0
  18. package/dist/compile-sms.d.ts +28 -0
  19. package/dist/compile-sms.js +44 -0
  20. package/dist/compile-sms.js.map +1 -0
  21. package/dist/compile-whatsapp.d.ts +56 -0
  22. package/dist/compile-whatsapp.js +186 -0
  23. package/dist/compile-whatsapp.js.map +1 -0
  24. package/dist/compile.d.ts +93 -0
  25. package/dist/compile.js +938 -0
  26. package/dist/compile.js.map +1 -0
  27. package/dist/components.d.ts +289 -0
  28. package/dist/components.js +106 -0
  29. package/dist/components.js.map +1 -0
  30. package/dist/conditionals.d.ts +10 -0
  31. package/dist/conditionals.js +42 -0
  32. package/dist/conditionals.js.map +1 -0
  33. package/dist/diagnostics-oveE-laV.d.ts +79 -0
  34. package/dist/diagnostics.d.ts +2 -0
  35. package/dist/diagnostics.js +62 -0
  36. package/dist/diagnostics.js.map +1 -0
  37. package/dist/emit.d.ts +50 -0
  38. package/dist/emit.js +151 -0
  39. package/dist/emit.js.map +1 -0
  40. package/dist/footer.d.ts +66 -0
  41. package/dist/footer.js +90 -0
  42. package/dist/footer.js.map +1 -0
  43. package/dist/interpolate.d.ts +27 -0
  44. package/dist/interpolate.js +61 -0
  45. package/dist/interpolate.js.map +1 -0
  46. package/dist/jsx-dev-runtime.d.ts +10 -0
  47. package/dist/jsx-dev-runtime.js +7 -0
  48. package/dist/jsx-dev-runtime.js.map +1 -0
  49. package/dist/jsx-runtime-fSxcvlx4.d.ts +57 -0
  50. package/dist/jsx-runtime.d.ts +2 -0
  51. package/dist/jsx-runtime.js +102 -0
  52. package/dist/jsx-runtime.js.map +1 -0
  53. package/dist/lexer.d.ts +60 -0
  54. package/dist/lexer.js +269 -0
  55. package/dist/lexer.js.map +1 -0
  56. package/dist/model.d.ts +39 -0
  57. package/dist/model.js +90 -0
  58. package/dist/model.js.map +1 -0
  59. package/dist/ops.d.ts +208 -0
  60. package/dist/ops.js +546 -0
  61. package/dist/ops.js.map +1 -0
  62. package/dist/parser-yzjUOGhc.d.ts +387 -0
  63. package/dist/parser.d.ts +2 -0
  64. package/dist/parser.js +821 -0
  65. package/dist/parser.js.map +1 -0
  66. package/dist/predicate-DTtVtLK7.d.ts +49 -0
  67. package/dist/predicate.d.ts +2 -0
  68. package/dist/predicate.js +417 -0
  69. package/dist/predicate.js.map +1 -0
  70. package/dist/presets/category-mapping.d.ts +13 -0
  71. package/dist/presets/category-mapping.js +49 -0
  72. package/dist/presets/category-mapping.js.map +1 -0
  73. package/dist/presets/public-gallery.d.ts +490 -0
  74. package/dist/presets/public-gallery.js +563 -0
  75. package/dist/presets/public-gallery.js.map +1 -0
  76. package/dist/presets/public-handoff.d.ts +68 -0
  77. package/dist/presets/public-handoff.js +105 -0
  78. package/dist/presets/public-handoff.js.map +1 -0
  79. package/dist/presets/public-preview-artifacts.d.ts +41 -0
  80. package/dist/presets/public-preview-artifacts.js +109 -0
  81. package/dist/presets/public-preview-artifacts.js.map +1 -0
  82. package/dist/presets/public-preview.d.ts +1168 -0
  83. package/dist/presets/public-preview.js +1158 -0
  84. package/dist/presets/public-preview.js.map +1 -0
  85. package/dist/presets/sources.d.ts +7 -0
  86. package/dist/presets/sources.js +54 -0
  87. package/dist/presets/sources.js.map +1 -0
  88. package/dist/presets.d.ts +350 -0
  89. package/dist/presets.js +1251 -0
  90. package/dist/presets.js.map +1 -0
  91. package/dist/printer.d.ts +6 -0
  92. package/dist/printer.js +122 -0
  93. package/dist/printer.js.map +1 -0
  94. package/dist/registry.d.ts +42 -0
  95. package/dist/registry.js +646 -0
  96. package/dist/registry.js.map +1 -0
  97. package/dist/render-template.d.ts +42 -0
  98. package/dist/render-template.js +74 -0
  99. package/dist/render-template.js.map +1 -0
  100. package/dist/sms-segments-y4FpPilJ.d.ts +13 -0
  101. package/dist/sms-segments.d.ts +2 -0
  102. package/dist/sms-segments.js +46 -0
  103. package/dist/sms-segments.js.map +1 -0
  104. package/dist/theme-6ApjjiBo.d.ts +116 -0
  105. package/dist/theme-css.d.ts +24 -0
  106. package/dist/theme-css.js +509 -0
  107. package/dist/theme-css.js.map +1 -0
  108. package/dist/theme.d.ts +2 -0
  109. package/dist/theme.js +95 -0
  110. package/dist/theme.js.map +1 -0
  111. package/dist/tokens.d.ts +6 -0
  112. package/dist/tokens.js +417 -0
  113. package/dist/tokens.js.map +1 -0
  114. package/dist/variables-3NGLpNTB.d.ts +77 -0
  115. package/dist/variables.d.ts +2 -0
  116. package/dist/variables.js +141 -0
  117. package/dist/variables.js.map +1 -0
  118. package/dist/version-BITr58kk.js +96 -0
  119. package/dist/version-BITr58kk.js.map +1 -0
  120. package/generated/sml-agent-contract.json +917 -0
  121. package/generated/sml-email-agent-contract.json +790 -0
  122. package/generated/sml-email-language-reference.md +160 -0
  123. package/generated/sml-language-reference.md +220 -0
  124. package/package.json +203 -0
@@ -0,0 +1,387 @@
1
+ import { o as SmlParseError } from "./diagnostics-oveE-laV.js";
2
+ import { C as SmlDocument, D as SmlTag, d as Channel } from "./ast-DAhnAvQN.js";
3
+ import { Result } from "effect";
4
+ //#region src/parser.d.ts
5
+ type ContentModel = "email" | "block" | "columns" | "list" | "image" | "if" | "inline" | "inline-nolink" | "preview" | "whatsapp" | "buttons" | "verbatim" | "verbatim-if" | "void";
6
+ interface AttributeSpec {
7
+ readonly type: "string" | "number";
8
+ readonly required?: boolean | undefined;
9
+ /** Inclusive numeric bounds for number attributes. */
10
+ readonly min?: number | undefined;
11
+ readonly max?: number | undefined;
12
+ /** Closed value set for string attributes; anything else is a parse error. */
13
+ readonly values?: ReadonlyArray<string> | undefined;
14
+ }
15
+ interface TagSpec {
16
+ readonly attributes: Readonly<Record<string, AttributeSpec>>;
17
+ readonly content: ContentModel;
18
+ }
19
+ /**
20
+ * The email language surface as data: per-tag attributes
21
+ * (type/required/bounds) and content model. Public API — typed TSX components
22
+ * and the reference-docs generator derive from this table, so it cannot drift
23
+ * from the parser.
24
+ */
25
+ declare const EMAIL_TAG_SPECS: {
26
+ readonly Email: {
27
+ readonly attributes: {
28
+ readonly lang: {
29
+ readonly type: "string";
30
+ };
31
+ readonly dir: {
32
+ readonly type: "string";
33
+ };
34
+ readonly width: {
35
+ readonly type: "number";
36
+ readonly min: 1;
37
+ readonly max: 10000;
38
+ };
39
+ readonly class: {
40
+ readonly type: "string";
41
+ };
42
+ };
43
+ readonly content: "email";
44
+ };
45
+ readonly Subject: {
46
+ readonly attributes: {};
47
+ readonly content: "preview";
48
+ };
49
+ readonly Preview: {
50
+ readonly attributes: {};
51
+ readonly content: "preview";
52
+ };
53
+ readonly Container: {
54
+ readonly attributes: {
55
+ readonly backgroundImage: {
56
+ readonly type: "string";
57
+ };
58
+ readonly backgroundPosition: {
59
+ readonly type: "string";
60
+ readonly values: readonly ["center", "top", "bottom"];
61
+ };
62
+ readonly backgroundSize: {
63
+ readonly type: "string";
64
+ readonly values: readonly ["cover", "contain", "auto"];
65
+ };
66
+ readonly class: {
67
+ readonly type: "string";
68
+ };
69
+ };
70
+ readonly content: "block";
71
+ };
72
+ readonly Section: {
73
+ readonly attributes: {
74
+ readonly backgroundImage: {
75
+ readonly type: "string";
76
+ };
77
+ readonly backgroundPosition: {
78
+ readonly type: "string";
79
+ readonly values: readonly ["center", "top", "bottom"];
80
+ };
81
+ readonly backgroundSize: {
82
+ readonly type: "string";
83
+ readonly values: readonly ["cover", "contain", "auto"];
84
+ };
85
+ readonly class: {
86
+ readonly type: "string";
87
+ };
88
+ };
89
+ readonly content: "block";
90
+ };
91
+ readonly Row: {
92
+ readonly attributes: {
93
+ readonly class: {
94
+ readonly type: "string";
95
+ };
96
+ };
97
+ readonly content: "columns";
98
+ };
99
+ readonly Column: {
100
+ readonly attributes: {
101
+ readonly class: {
102
+ readonly type: "string";
103
+ };
104
+ readonly width: {
105
+ readonly type: "string";
106
+ };
107
+ readonly valign: {
108
+ readonly type: "string";
109
+ readonly values: readonly ["top", "middle", "bottom"];
110
+ };
111
+ };
112
+ readonly content: "block";
113
+ };
114
+ readonly Heading: {
115
+ readonly attributes: {
116
+ readonly level: {
117
+ readonly type: "number";
118
+ readonly min: 1;
119
+ readonly max: 6;
120
+ };
121
+ readonly class: {
122
+ readonly type: "string";
123
+ };
124
+ };
125
+ readonly content: "inline";
126
+ };
127
+ readonly Text: {
128
+ readonly attributes: {
129
+ readonly class: {
130
+ readonly type: "string";
131
+ };
132
+ };
133
+ readonly content: "inline";
134
+ };
135
+ readonly Button: {
136
+ readonly attributes: {
137
+ readonly href: {
138
+ readonly type: "string";
139
+ readonly required: true;
140
+ };
141
+ readonly class: {
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ readonly content: "inline-nolink";
146
+ };
147
+ readonly Image: {
148
+ readonly attributes: {
149
+ readonly src: {
150
+ readonly type: "string";
151
+ readonly required: true;
152
+ };
153
+ readonly alt: {
154
+ readonly type: "string";
155
+ };
156
+ readonly width: {
157
+ readonly type: "number";
158
+ readonly min: 0;
159
+ readonly max: 10000;
160
+ };
161
+ readonly height: {
162
+ readonly type: "number";
163
+ readonly min: 0;
164
+ readonly max: 10000;
165
+ };
166
+ readonly class: {
167
+ readonly type: "string";
168
+ };
169
+ };
170
+ readonly content: "image";
171
+ };
172
+ readonly Source: {
173
+ readonly attributes: {
174
+ readonly scheme: {
175
+ readonly type: "string";
176
+ readonly required: true;
177
+ readonly values: readonly ["dark"];
178
+ };
179
+ readonly src: {
180
+ readonly type: "string";
181
+ readonly required: true;
182
+ };
183
+ };
184
+ readonly content: "void";
185
+ };
186
+ readonly Divider: {
187
+ readonly attributes: {
188
+ readonly class: {
189
+ readonly type: "string";
190
+ };
191
+ };
192
+ readonly content: "void";
193
+ };
194
+ readonly Spacer: {
195
+ readonly attributes: {
196
+ readonly height: {
197
+ readonly type: "number";
198
+ readonly required: true;
199
+ readonly min: 1;
200
+ readonly max: 2000;
201
+ };
202
+ };
203
+ readonly content: "void";
204
+ };
205
+ readonly List: {
206
+ readonly attributes: {
207
+ readonly type: {
208
+ readonly type: "string";
209
+ readonly values: readonly ["unordered", "ordered"];
210
+ };
211
+ readonly class: {
212
+ readonly type: "string";
213
+ };
214
+ };
215
+ readonly content: "list";
216
+ };
217
+ readonly ListItem: {
218
+ readonly attributes: {
219
+ readonly class: {
220
+ readonly type: "string";
221
+ };
222
+ };
223
+ readonly content: "inline";
224
+ };
225
+ readonly If: {
226
+ readonly attributes: {
227
+ readonly test: {
228
+ readonly type: "string";
229
+ readonly required: true;
230
+ };
231
+ };
232
+ readonly content: "if";
233
+ };
234
+ readonly Else: {
235
+ readonly attributes: {};
236
+ readonly content: "block";
237
+ };
238
+ readonly a: {
239
+ readonly attributes: {
240
+ readonly href: {
241
+ readonly type: "string";
242
+ readonly required: true;
243
+ };
244
+ readonly class: {
245
+ readonly type: "string";
246
+ };
247
+ };
248
+ readonly content: "inline-nolink";
249
+ };
250
+ readonly strong: {
251
+ readonly attributes: {};
252
+ readonly content: "inline-nolink";
253
+ };
254
+ readonly em: {
255
+ readonly attributes: {};
256
+ readonly content: "inline-nolink";
257
+ };
258
+ };
259
+ /**
260
+ * The sms language surface: a raw verbatim text body with `{{vars}}` and
261
+ * send-time conditionals — no layout tags, no classes, no theming.
262
+ */
263
+ declare const SMS_TAG_SPECS: {
264
+ readonly Sms: {
265
+ readonly attributes: {
266
+ readonly category: {
267
+ readonly type: "string";
268
+ readonly values: readonly ["transactional", "promotional", "service_implicit"];
269
+ };
270
+ };
271
+ readonly content: "verbatim";
272
+ };
273
+ readonly If: {
274
+ readonly attributes: {
275
+ readonly test: {
276
+ readonly type: "string";
277
+ readonly required: true;
278
+ };
279
+ };
280
+ readonly content: "verbatim-if";
281
+ };
282
+ readonly Else: {
283
+ readonly attributes: {};
284
+ readonly content: "verbatim";
285
+ };
286
+ };
287
+ /**
288
+ * The whatsapp language surface: Meta's template anatomy IS the closed
289
+ * grammar — Header? Body Footer? Buttons?, verbatim text slots, no classes.
290
+ * Root attributes carry authoring intent (name defaults from the template
291
+ * slug, language from the variant locale — defaulting happens at the API
292
+ * layer; the language just carries the attributes).
293
+ */
294
+ declare const WHATSAPP_TAG_SPECS: {
295
+ readonly WhatsApp: {
296
+ readonly attributes: {
297
+ readonly name: {
298
+ readonly type: "string";
299
+ };
300
+ readonly language: {
301
+ readonly type: "string";
302
+ };
303
+ readonly category: {
304
+ readonly type: "string";
305
+ readonly required: true;
306
+ readonly values: readonly ["marketing", "utility", "authentication", "service"];
307
+ };
308
+ };
309
+ readonly content: "whatsapp";
310
+ };
311
+ readonly Header: {
312
+ readonly attributes: {
313
+ readonly type: {
314
+ readonly type: "string";
315
+ readonly values: readonly ["text", "image", "video", "document"];
316
+ };
317
+ };
318
+ readonly content: "verbatim";
319
+ };
320
+ readonly Body: {
321
+ readonly attributes: {};
322
+ readonly content: "verbatim";
323
+ };
324
+ readonly Footer: {
325
+ readonly attributes: {};
326
+ readonly content: "verbatim";
327
+ };
328
+ readonly Buttons: {
329
+ readonly attributes: {};
330
+ readonly content: "buttons";
331
+ };
332
+ readonly Button: {
333
+ readonly attributes: {
334
+ readonly type: {
335
+ readonly type: "string";
336
+ readonly required: true;
337
+ readonly values: readonly ["quick-reply", "url", "phone", "copy-code"];
338
+ };
339
+ readonly url: {
340
+ readonly type: "string";
341
+ };
342
+ readonly phone: {
343
+ readonly type: "string";
344
+ };
345
+ };
346
+ readonly content: "verbatim";
347
+ };
348
+ readonly If: {
349
+ readonly attributes: {
350
+ readonly test: {
351
+ readonly type: "string";
352
+ readonly required: true;
353
+ };
354
+ };
355
+ readonly content: "verbatim-if";
356
+ };
357
+ readonly Else: {
358
+ readonly attributes: {};
359
+ readonly content: "verbatim";
360
+ };
361
+ };
362
+ /** Per-channel tag tables — the root tag picks one for the whole document. */
363
+ declare const CHANNEL_TAG_SPECS: Readonly<Record<Channel, Readonly<Partial<Record<SmlTag, TagSpec>>>>>;
364
+ /**
365
+ * Editor-only attributes accepted on every email block-level tag on top of the
366
+ * tag's own spec. The compiler ignores both, so neither ever reaches HTML:
367
+ * `label` renames a node in the layout navigator; `hidden="true"` drops it from
368
+ * the compiled artifact while it stays in the source. Email-only — sms/whatsapp
369
+ * compile has no strip pass, so their tags keep their own specs verbatim.
370
+ */
371
+ declare const UNIVERSAL_ATTRIBUTES: {
372
+ readonly label: {
373
+ readonly type: "string";
374
+ };
375
+ readonly hidden: {
376
+ readonly type: "string";
377
+ readonly values: readonly ["true"];
378
+ };
379
+ };
380
+ /** Email tags a user manipulates as layers — the ones the universal attributes attach to. */
381
+ declare const UNIVERSAL_ATTRIBUTE_TAGS: ReadonlySet<SmlTag>;
382
+ /** Tags a content model admits as direct children (public alongside the spec tables). */
383
+ declare const allowedChildren: (model: ContentModel) => ReadonlyArray<SmlTag>;
384
+ declare const parseSml: (source: string) => Result.Result<SmlDocument, SmlParseError>;
385
+ //#endregion
386
+ export { SMS_TAG_SPECS as a, UNIVERSAL_ATTRIBUTE_TAGS as c, parseSml as d, EMAIL_TAG_SPECS as i, WHATSAPP_TAG_SPECS as l, CHANNEL_TAG_SPECS as n, TagSpec as o, ContentModel as r, UNIVERSAL_ATTRIBUTES as s, AttributeSpec as t, allowedChildren as u };
387
+ //# sourceMappingURL=parser-yzjUOGhc.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { a as SMS_TAG_SPECS, c as UNIVERSAL_ATTRIBUTE_TAGS, d as parseSml, i as EMAIL_TAG_SPECS, l as WHATSAPP_TAG_SPECS, n as CHANNEL_TAG_SPECS, o as TagSpec, r as ContentModel, s as UNIVERSAL_ATTRIBUTES, t as AttributeSpec, u as allowedChildren } from "./parser-yzjUOGhc.js";
2
+ export { AttributeSpec, CHANNEL_TAG_SPECS, ContentModel, EMAIL_TAG_SPECS, SMS_TAG_SPECS, TagSpec, UNIVERSAL_ATTRIBUTES, UNIVERSAL_ATTRIBUTE_TAGS, WHATSAPP_TAG_SPECS, allowedChildren, parseSml };