@samva/markup 0.8.0 → 0.10.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 (172) hide show
  1. package/AGENTS.md +107 -46
  2. package/CHANGELOG.md +345 -0
  3. package/README.md +188 -52
  4. package/dist/{brand-DcoVkh_S.d.ts → assets-BIsyMQ92.d.ts} +41 -11
  5. package/dist/{email/brand.js → brand-C0MKTwmX.js} +64 -4
  6. package/dist/{theme-css.d.ts → brand.d.ts} +12 -3
  7. package/dist/brand.js +4 -0
  8. package/dist/channel-specs-C2feJwuP.d.ts +13 -0
  9. package/dist/compiler.d.ts +88 -115
  10. package/dist/compiler.js +750 -171
  11. package/dist/components-BZCqegS8.js +1864 -0
  12. package/dist/diagnostic-model-DJtqbETd.js +38 -0
  13. package/dist/{diagnostics-OcQKQYSY.d.ts → diagnostic-model-DxthUZBT.d.ts} +3 -21
  14. package/dist/{diagnostics-BMYtBCQk.d.ts → diagnostics-B-Gym34R.d.ts} +8 -4
  15. package/dist/{email/diagnostics.js → diagnostics-CnKFefKz.js} +4 -3
  16. package/dist/diagnostics.d.ts +410 -2
  17. package/dist/diagnostics.js +402 -52
  18. package/dist/edit.d.ts +234 -0
  19. package/dist/edit.js +947 -0
  20. package/dist/email/jsx-dev-runtime.d.ts +2 -2
  21. package/dist/email/jsx-dev-runtime.js +1 -2
  22. package/dist/email/jsx-runtime.d.ts +1 -1
  23. package/dist/email/jsx-runtime.js +1 -85
  24. package/dist/{email/components.d.ts → email.d.ts} +22 -11
  25. package/dist/email.js +2 -0
  26. package/dist/fmt.d.ts +32 -0
  27. package/dist/fmt.js +174 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +2 -0
  30. package/dist/{render-vAv_4r9v.js → ir-CLhlklKV.js} +96 -279
  31. package/dist/jsx-runtime-CBlexoeR.js +98 -0
  32. package/dist/{elements-BzjjnoCS.d.ts → jsx-runtime-ylIOnaSf.d.ts} +76 -76
  33. package/dist/profile-pWGtWZXF.js +3803 -0
  34. package/dist/render-BPonDpCl.d.ts +539 -0
  35. package/dist/render-BQmfh94k.js +257 -0
  36. package/dist/render.d.ts +35 -0
  37. package/dist/render.js +49 -0
  38. package/dist/sms.d.ts +16 -0
  39. package/dist/sms.js +12 -0
  40. package/dist/source-locations-C8wCsiAy.d.ts +23 -0
  41. package/dist/template-DMPwxMSq.d.ts +65 -0
  42. package/dist/template-zLUjcwfF.js +42 -0
  43. package/dist/{theme-css-hFqcPSar.js → theme-css-JtRCm1fb.js} +2 -2
  44. package/dist/whatsapp.d.ts +57 -0
  45. package/dist/whatsapp.js +22 -0
  46. package/generated/contract.json +1788 -0
  47. package/generated/reference.md +360 -0
  48. package/package.json +46 -239
  49. package/samva-brand.d.ts +4 -4
  50. package/skills/sml/SKILL.md +123 -0
  51. package/dist/ast-BrDtApwS.d.ts +0 -107
  52. package/dist/ast.d.ts +0 -2
  53. package/dist/ast.js +0 -124
  54. package/dist/candidate.d.ts +0 -29
  55. package/dist/candidate.js +0 -88
  56. package/dist/catalog-CKuOooB8.d.ts +0 -354
  57. package/dist/checks-D73Xizbw.js +0 -59366
  58. package/dist/checks.d.ts +0 -33
  59. package/dist/checks.js +0 -2
  60. package/dist/classes.d.ts +0 -26
  61. package/dist/classes.js +0 -184
  62. package/dist/compile-sms.d.ts +0 -28
  63. package/dist/compile-sms.js +0 -44
  64. package/dist/compile-whatsapp.d.ts +0 -56
  65. package/dist/compile-whatsapp.js +0 -186
  66. package/dist/compile.d.ts +0 -18
  67. package/dist/compile.js +0 -29
  68. package/dist/components.d.ts +0 -289
  69. package/dist/components.js +0 -106
  70. package/dist/conditionals.d.ts +0 -10
  71. package/dist/conditionals.js +0 -74
  72. package/dist/corpus-CPPfgAHN.d.ts +0 -106
  73. package/dist/css-CS2jLID6.d.ts +0 -109
  74. package/dist/email/assets.d.ts +0 -40
  75. package/dist/email/assets.js +0 -63
  76. package/dist/email/brand-footer.d.ts +0 -34
  77. package/dist/email/brand-footer.js +0 -62
  78. package/dist/email/brand.d.ts +0 -2
  79. package/dist/email/components.js +0 -240
  80. package/dist/email/diagnostics.d.ts +0 -2
  81. package/dist/email/elements.d.ts +0 -2
  82. package/dist/email/elements.js +0 -299
  83. package/dist/email/html.d.ts +0 -2
  84. package/dist/email/html.js +0 -278
  85. package/dist/email/render.d.ts +0 -50
  86. package/dist/email/render.js +0 -3
  87. package/dist/email/selection.d.ts +0 -2
  88. package/dist/email/selection.js +0 -91
  89. package/dist/email/source-edit.d.ts +0 -67
  90. package/dist/email/source-edit.js +0 -185
  91. package/dist/email/stylesheets.d.ts +0 -15
  92. package/dist/email/stylesheets.js +0 -48
  93. package/dist/email/text.d.ts +0 -7
  94. package/dist/email/text.js +0 -100
  95. package/dist/emit.d.ts +0 -51
  96. package/dist/emit.js +0 -151
  97. package/dist/html-Bl9BAdqc.d.ts +0 -42
  98. package/dist/interpolate.d.ts +0 -24
  99. package/dist/interpolate.js +0 -43
  100. package/dist/jsx-dev-runtime.d.ts +0 -11
  101. package/dist/jsx-dev-runtime.js +0 -15
  102. package/dist/jsx-runtime-I-1nCtl2.d.ts +0 -57
  103. package/dist/jsx-runtime.d.ts +0 -2
  104. package/dist/jsx-runtime.js +0 -121
  105. package/dist/lexer.d.ts +0 -60
  106. package/dist/lexer.js +0 -281
  107. package/dist/model.d.ts +0 -24
  108. package/dist/model.js +0 -77
  109. package/dist/ops-BvwqHl7V.js +0 -630
  110. package/dist/ops.d.ts +0 -114
  111. package/dist/ops.js +0 -2
  112. package/dist/parser-t29cHLVL.d.ts +0 -396
  113. package/dist/parser.d.ts +0 -2
  114. package/dist/parser.js +0 -859
  115. package/dist/predicate-BI6uRRM-.js +0 -549
  116. package/dist/predicate-M-05Nd7R.d.ts +0 -56
  117. package/dist/predicate.d.ts +0 -2
  118. package/dist/predicate.js +0 -2
  119. package/dist/printer.d.ts +0 -6
  120. package/dist/printer.js +0 -122
  121. package/dist/registry-Dcp6QEK_.d.ts +0 -73
  122. package/dist/registry.d.ts +0 -2
  123. package/dist/registry.js +0 -646
  124. package/dist/render-template.d.ts +0 -45
  125. package/dist/render-template.js +0 -76
  126. package/dist/selection-CCArx9lU.d.ts +0 -91
  127. package/dist/showcase-egkusQBf.d.ts +0 -415
  128. package/dist/sms-segments-y4FpPilJ.d.ts +0 -13
  129. package/dist/sms-segments.d.ts +0 -2
  130. package/dist/sms-segments.js +0 -46
  131. package/dist/source-locations-DrCM82Ym.d.ts +0 -67
  132. package/dist/source-locations.d.ts +0 -2
  133. package/dist/source-locations.js +0 -102
  134. package/dist/starters/category-mapping.d.ts +0 -13
  135. package/dist/starters/category-mapping.js +0 -49
  136. package/dist/starters/corpus.d.ts +0 -2
  137. package/dist/starters/corpus.js +0 -194
  138. package/dist/starters/library.d.ts +0 -18
  139. package/dist/starters/library.js +0 -692
  140. package/dist/starters/public-gallery.d.ts +0 -266
  141. package/dist/starters/public-gallery.js +0 -916
  142. package/dist/starters/public-handoff.d.ts +0 -164
  143. package/dist/starters/public-handoff.js +0 -361
  144. package/dist/starters/public-preview-artifacts.d.ts +0 -43
  145. package/dist/starters/public-preview-artifacts.js +0 -104
  146. package/dist/starters/public-preview.d.ts +0 -61
  147. package/dist/starters/public-preview.js +0 -83
  148. package/dist/starters/showcase.d.ts +0 -2
  149. package/dist/starters/showcase.js +0 -335
  150. package/dist/starters/sources.d.ts +0 -45
  151. package/dist/starters/sources.js +0 -7762
  152. package/dist/starters/theme.d.ts +0 -45
  153. package/dist/starters/theme.js +0 -77
  154. package/dist/starters.d.ts +0 -2
  155. package/dist/starters.js +0 -874
  156. package/dist/tailwind-BYq7Lo6u.js +0 -727
  157. package/dist/template-DWftqh4x.d.ts +0 -60
  158. package/dist/template.d.ts +0 -2
  159. package/dist/template.js +0 -37
  160. package/dist/theme-css.js +0 -2
  161. package/dist/tsx-source-instrumentation.d.ts +0 -30
  162. package/dist/tsx-source-instrumentation.js +0 -115
  163. package/dist/tsx-tracer.d.ts +0 -112
  164. package/dist/tsx-tracer.js +0 -985
  165. package/dist/variables-J_L3qxRa.d.ts +0 -77
  166. package/dist/variables.d.ts +0 -2
  167. package/dist/variables.js +0 -141
  168. package/dist/version-BITr58kk.js +0 -96
  169. package/generated/sml-agent-contract.json +0 -709
  170. package/generated/sml-email-agent-contract.json +0 -615
  171. package/generated/sml-email-language-reference.md +0 -94
  172. package/generated/sml-language-reference.md +0 -195
package/dist/edit.d.ts ADDED
@@ -0,0 +1,234 @@
1
+ import { i as completeJsxSourceLocation, n as JsxSource, r as JsxSourceLocation, t as JSX_SOURCE_LOCATION_PROP } from "./source-locations-C8wCsiAy.js";
2
+ import { n as WhatsAppCategory, r as WhatsAppHeaderType, t as SmsCategory } from "./channel-specs-C2feJwuP.js";
3
+ //#region src/source-edit.d.ts
4
+ /** One exact source replacement; before text guards against concurrent changes. */
5
+ interface SourceReplacement {
6
+ readonly start: number;
7
+ readonly end: number;
8
+ readonly before: string;
9
+ readonly after: string;
10
+ }
11
+ type SourceEditResult = {
12
+ readonly ok: true;
13
+ readonly source: string;
14
+ } | {
15
+ readonly ok: false;
16
+ readonly reason: string;
17
+ };
18
+ interface SourceProperty {
19
+ readonly name: string;
20
+ readonly kind: "literal" | "binding" | "computed";
21
+ readonly value: string;
22
+ readonly literalType: "string" | "number" | "boolean";
23
+ readonly start: number;
24
+ readonly end: number;
25
+ readonly syntax: "attribute" | "child" | "value";
26
+ }
27
+ interface SourceElement {
28
+ readonly start: number;
29
+ readonly end: number;
30
+ readonly contentStart: number | null;
31
+ readonly contentEnd: number | null;
32
+ readonly tag: string;
33
+ readonly attributeInsertion: number;
34
+ readonly hasSpread: boolean;
35
+ readonly properties: readonly SourceProperty[];
36
+ readonly structural: boolean;
37
+ /** The JSX element sibling directly before / after this one, when both share a JSX parent. */
38
+ readonly previous: SourceRange | null;
39
+ readonly next: SourceRange | null;
40
+ }
41
+ interface SourceRange {
42
+ readonly start: number;
43
+ readonly end: number;
44
+ }
45
+ /** Resolve a renderer origin against the unchanged authored entry, never against HTML offsets. */
46
+ declare const inspectSourceElement: (source: string, file: string, origin: JsxSourceLocation) => SourceElement | null;
47
+ /** Literal controls cannot overwrite a binding or computed expression. */
48
+ declare const literalReplacement: (source: string, field: SourceProperty, value: string) => SourceReplacement | null;
49
+ /** Explicit expression changes are proposals: callers show before/after and require Apply. */
50
+ declare const expressionReplacement: (source: string, field: SourceProperty, expression: string) => SourceReplacement;
51
+ /**
52
+ * Where an edited file sits in its template project. Every edit of a template is checked against
53
+ * the static profile: one that would leave it is refused, so a visual edit can never produce a
54
+ * template the compiler rejects.
55
+ */
56
+ interface ProfileGuard {
57
+ /** The template entry the profile check reads. */
58
+ readonly entry: string;
59
+ /** The file the edit changes; the entry when omitted. A partial names itself here. */
60
+ readonly file?: string | undefined;
61
+ /** The project's other files, when the edited file is not the entry. */
62
+ readonly files?: Readonly<Record<string, string>> | undefined;
63
+ }
64
+ interface ApplyOptions {
65
+ readonly profile?: ProfileGuard | undefined;
66
+ }
67
+ /** Apply exact, nonoverlapping edits and refuse syntax damage without changing the original. */
68
+ declare const applySourceReplacements: (source: string, edits: readonly SourceReplacement[], options?: ApplyOptions) => SourceEditResult;
69
+ type SourceProposal = {
70
+ readonly ok: true;
71
+ readonly edits: readonly SourceReplacement[];
72
+ } | {
73
+ readonly ok: false;
74
+ readonly reason: string;
75
+ };
76
+ /** Structural edits name a whole authored block; loop iterations are never source nodes. */
77
+ declare const structuralReplacements: (source: string, element: SourceElement, operation: {
78
+ readonly kind: "delete";
79
+ } | {
80
+ readonly kind: "duplicate";
81
+ } | {
82
+ readonly kind: "reorder";
83
+ readonly direction: "before" | "after";
84
+ } | {
85
+ readonly kind: "insert";
86
+ readonly tsx: string;
87
+ } | {
88
+ readonly kind: "move";
89
+ readonly destination: SourceElement;
90
+ }) => readonly SourceReplacement[] | null;
91
+ interface SourceFixture {
92
+ readonly name: string;
93
+ readonly start: number;
94
+ readonly end: number;
95
+ readonly source: string;
96
+ }
97
+ /** Declared fixture values are separate source targets from body bindings and literals. */
98
+ declare const inspectSourceFixtures: (source: string) => readonly SourceFixture[];
99
+ type ClassNameOperation = {
100
+ readonly kind: "set";
101
+ readonly value: string;
102
+ } | {
103
+ readonly kind: "add";
104
+ readonly tokens: string;
105
+ } | {
106
+ readonly kind: "remove";
107
+ readonly tokens: string;
108
+ };
109
+ /**
110
+ * Edit an element's class list where it is written. A literal `className` is replaced, extended or
111
+ * trimmed in place; a missing one is added; one that is a condition or any other expression is
112
+ * refused, because rewriting it would discard the choice the author encoded.
113
+ */
114
+ declare const classNameEdit: (source: string, element: SourceElement, operation: ClassNameOperation) => SourceProposal;
115
+ //#endregion
116
+ //#region src/channel-edit.d.ts
117
+ /** A run of body text between two locked segments. It is empty when nothing sits between them. */
118
+ interface TextSegment {
119
+ readonly kind: "text";
120
+ readonly text: string;
121
+ /** The source range the text is written back over. */
122
+ readonly start: number;
123
+ readonly end: number;
124
+ }
125
+ /** An expression, conditional or element the form does not edit, kept as authored. */
126
+ interface LockedSegment {
127
+ readonly kind: "locked";
128
+ /** The authored source, shortened for display. */
129
+ readonly summary: string;
130
+ readonly start: number;
131
+ readonly end: number;
132
+ }
133
+ type ChannelSegment = TextSegment | LockedSegment;
134
+ /** How an attribute appears on an element. Only a literal is editable. */
135
+ type AttributeState = {
136
+ readonly kind: "absent";
137
+ } | {
138
+ readonly kind: "literal";
139
+ readonly value: string;
140
+ } | {
141
+ readonly kind: "expression";
142
+ readonly source: string;
143
+ };
144
+ interface SmsChannelForm {
145
+ readonly category: AttributeState;
146
+ readonly segments: readonly ChannelSegment[];
147
+ /** The input fields the body reads, as dotted paths. */
148
+ readonly variables: readonly string[];
149
+ }
150
+ type WhatsAppButtonKind = "quick-reply" | "url" | "phone" | "copy-code";
151
+ type WhatsAppButtonRow = {
152
+ readonly kind: "editable";
153
+ readonly type: WhatsAppButtonKind;
154
+ /** The label, or the copied code for a copy-code button. */
155
+ readonly text: string;
156
+ readonly url: AttributeState;
157
+ readonly phone: AttributeState;
158
+ } | {
159
+ /** A conditional, or a button whose label reads the input. */
160
+ readonly kind: "locked";
161
+ readonly summary: string;
162
+ };
163
+ interface WhatsAppChannelForm {
164
+ readonly name: AttributeState;
165
+ readonly language: AttributeState;
166
+ readonly category: AttributeState;
167
+ /** Null when the template has no header. */
168
+ readonly header: readonly ChannelSegment[] | null;
169
+ readonly headerType: AttributeState;
170
+ readonly body: readonly ChannelSegment[];
171
+ /** Null when the template has no footer. */
172
+ readonly footer: readonly ChannelSegment[] | null;
173
+ readonly buttons: readonly WhatsAppButtonRow[];
174
+ readonly variables: readonly string[];
175
+ }
176
+ type ChannelEditResult = {
177
+ readonly ok: true;
178
+ readonly edits: readonly SourceReplacement[];
179
+ } | {
180
+ readonly ok: false;
181
+ readonly reason: string;
182
+ };
183
+ type SmsEdit = {
184
+ readonly kind: "category";
185
+ readonly value: SmsCategory | undefined;
186
+ } | {
187
+ readonly kind: "text";
188
+ readonly segment: number;
189
+ readonly text: string;
190
+ };
191
+ type WhatsAppPart = "header" | "body" | "footer";
192
+ type WhatsAppEdit = {
193
+ readonly kind: "attribute";
194
+ readonly name: "name" | "language" | "category";
195
+ readonly value: string | undefined;
196
+ } | {
197
+ readonly kind: "headerType";
198
+ readonly value: WhatsAppHeaderType;
199
+ } | {
200
+ readonly kind: "text";
201
+ readonly part: WhatsAppPart;
202
+ readonly segment: number;
203
+ readonly text: string;
204
+ } | {
205
+ readonly kind: "buttonText";
206
+ readonly button: number;
207
+ readonly text: string;
208
+ } | {
209
+ readonly kind: "buttonAttribute";
210
+ readonly button: number;
211
+ readonly name: "url" | "phone";
212
+ readonly value: string;
213
+ } | {
214
+ readonly kind: "buttonType";
215
+ readonly button: number;
216
+ readonly type: WhatsAppButtonKind;
217
+ } | {
218
+ readonly kind: "buttonAdd";
219
+ readonly type: WhatsAppButtonKind;
220
+ } | {
221
+ readonly kind: "buttonRemove";
222
+ readonly button: number;
223
+ };
224
+ /** The form model of the template's SMS body, or null when it is not a `<Sms>` written in place. */
225
+ declare const readSmsChannel: (source: string) => SmsChannelForm | null;
226
+ /** The source replacements that apply one form change to the SMS body. */
227
+ declare const editSmsChannel: (source: string, edit: SmsEdit) => ChannelEditResult;
228
+ /** The form model of the template's WhatsApp body, or null when it is not a `<WhatsApp>` written in place. */
229
+ declare const readWhatsAppChannel: (source: string) => WhatsAppChannelForm | null;
230
+ /** The source replacements that apply one form change to the WhatsApp body. */
231
+ declare const editWhatsAppChannel: (source: string, edit: WhatsAppEdit) => ChannelEditResult;
232
+ //#endregion
233
+ export { ApplyOptions, AttributeState, ChannelEditResult, ChannelSegment, ClassNameOperation, JSX_SOURCE_LOCATION_PROP, JsxSource, JsxSourceLocation, LockedSegment, ProfileGuard, type SmsCategory, SmsChannelForm, SmsEdit, SourceEditResult, SourceElement, SourceFixture, SourceProperty, SourceProposal, SourceRange, SourceReplacement, TextSegment, WhatsAppButtonKind, WhatsAppButtonRow, type WhatsAppCategory, WhatsAppChannelForm, WhatsAppEdit, type WhatsAppHeaderType, WhatsAppPart, applySourceReplacements, classNameEdit, completeJsxSourceLocation, editSmsChannel, editWhatsAppChannel, expressionReplacement, inspectSourceElement, inspectSourceFixtures, literalReplacement, readSmsChannel, readWhatsAppChannel, structuralReplacements };
234
+ //# sourceMappingURL=edit.d.ts.map