@forinda/kickjs-view 0.6.0 → 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.
- package/dist/cli.d.ts +3 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/edge.d.ts +4 -5
- package/dist/edge.js +2 -2
- package/dist/{exports-BsyGvnEU.js → exports-CII2eM6o.js} +4 -4
- package/dist/exports-CII2eM6o.js.map +1 -0
- package/dist/{types-D-OIrXCW.d.ts → file-BIua9gOB.d.ts} +676 -105
- package/dist/file-BIua9gOB.d.ts.map +1 -0
- package/dist/file-loader.d.ts +2 -2
- package/dist/file-loader.js +3 -3
- package/dist/file-loader.js.map +1 -1
- package/dist/{format-DBjtuDUY.js → format-CvHG95ck.js} +3 -3
- package/dist/{format-DBjtuDUY.js.map → format-CvHG95ck.js.map} +1 -1
- package/dist/i18n-EriU9b68.js +12 -0
- package/dist/i18n-EriU9b68.js.map +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{project-DeGFHgGJ.d.ts → project-mP4NzZhQ.d.ts} +4 -2
- package/dist/project-mP4NzZhQ.d.ts.map +1 -0
- package/dist/{serve-Hc5UlJ56.d.ts → serve-Df9_MrXE.d.ts} +11 -12
- package/dist/serve-Df9_MrXE.d.ts.map +1 -0
- package/dist/{summary-EefMyOjo.js → summary-DOhWOKmu.js} +6 -6
- package/dist/summary-DOhWOKmu.js.map +1 -0
- package/package.json +5 -3
- package/virtual.d.ts +4 -1
- package/dist/ast-Pq3XT2Xi.d.ts +0 -527
- package/dist/ast-Pq3XT2Xi.d.ts.map +0 -1
- package/dist/exports-BsyGvnEU.js.map +0 -1
- package/dist/project-DeGFHgGJ.d.ts.map +0 -1
- package/dist/project-XTTCeVf3.js +0 -12
- package/dist/project-XTTCeVf3.js.map +0 -1
- package/dist/serve-Hc5UlJ56.d.ts.map +0 -1
- package/dist/summary-EefMyOjo.js.map +0 -1
- package/dist/types-D-OIrXCW.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "KickJS views — .kick templates rendered on every runtime and the edge",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"optional": true
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@forinda/kickjs-cli-kit": "0.1.4"
|
|
49
|
+
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@fastify/middie": "^9.3.6",
|
|
49
52
|
"@swc/core": "^1.16.22",
|
|
@@ -60,8 +63,7 @@
|
|
|
60
63
|
"supertest": "^7.3.2",
|
|
61
64
|
"typescript": "^7.0.2",
|
|
62
65
|
"vitest": "^5.1.0",
|
|
63
|
-
"@forinda/kickjs": "10.15.0"
|
|
64
|
-
"@forinda/kickjs-cli-kit": "0.1.4"
|
|
66
|
+
"@forinda/kickjs": "10.15.0"
|
|
65
67
|
},
|
|
66
68
|
"publishConfig": {
|
|
67
69
|
"access": "public"
|
package/virtual.d.ts
CHANGED
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
declare module 'virtual:kick-views' {
|
|
13
|
-
import type { EnvPipe, Pipe, ViewsBundle } from '@forinda/kickjs-view'
|
|
13
|
+
import type { EnvPipe, Messages, Pipe, ViewsBundle } from '@forinda/kickjs-view'
|
|
14
14
|
export const bundle: ViewsBundle | null
|
|
15
15
|
export const pipes: Record<string, Pipe | EnvPipe>
|
|
16
|
+
/** The build's message catalogues; `undefined` in dev, where they're read from disk. */
|
|
17
|
+
export const messages: Messages | undefined
|
|
16
18
|
/** Where component scripts are served: the Vite plugin's `clientScriptPath`. */
|
|
17
19
|
export const clientScriptPath: string
|
|
18
20
|
/** A `file:` URL of the folder `kick build` wrote client files to; `undefined` in dev. */
|
|
@@ -22,6 +24,7 @@ declare module 'virtual:kick-views' {
|
|
|
22
24
|
const views: {
|
|
23
25
|
bundle: ViewsBundle | null
|
|
24
26
|
pipes: Record<string, Pipe | EnvPipe>
|
|
27
|
+
messages: Messages | undefined
|
|
25
28
|
clientScriptPath: string
|
|
26
29
|
clientDir: string | undefined
|
|
27
30
|
validatorsFile?: string
|
package/dist/ast-Pq3XT2Xi.d.ts
DELETED
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/** A point in a template: 0-based offset, 1-based line and column (UTF-16 units). */
|
|
3
|
-
interface Pos {
|
|
4
|
-
offset: number;
|
|
5
|
-
line: number;
|
|
6
|
-
column: number;
|
|
7
|
-
}
|
|
8
|
-
/** A source range in a template, start and end. */
|
|
9
|
-
interface Span {
|
|
10
|
-
start: Pos;
|
|
11
|
-
end: Pos;
|
|
12
|
-
}
|
|
13
|
-
/** An error or warning from parsing, checking or rendering a template. */
|
|
14
|
-
interface Diagnostic {
|
|
15
|
-
file: string;
|
|
16
|
-
span: Span;
|
|
17
|
-
message: string;
|
|
18
|
-
severity: 'error' | 'warning';
|
|
19
|
-
/** The templates being rendered, outermost first, when the error came from a render. */
|
|
20
|
-
stack?: string[];
|
|
21
|
-
}
|
|
22
|
-
/** The position of `offset` in `source`. */
|
|
23
|
-
declare const positionAt: (source: string, offset: number) => Pos;
|
|
24
|
-
/** Bumped when the shape of a checked template changes; builds and runtimes must agree. */
|
|
25
|
-
declare const AST_FORMAT_VERSION = 3;
|
|
26
|
-
/** A literal value in a template expression. */
|
|
27
|
-
type Literal = string | number | boolean | null;
|
|
28
|
-
/** One step of a path expression: `.name`, `[expr]`, or their `?.` forms. */
|
|
29
|
-
interface PathSegment {
|
|
30
|
-
/** `.name` / `?.name` */
|
|
31
|
-
name?: string;
|
|
32
|
-
/** `[expr]` / `?.[expr]` */
|
|
33
|
-
computed?: Expr;
|
|
34
|
-
optional: boolean;
|
|
35
|
-
}
|
|
36
|
-
/** A parsed template expression. */
|
|
37
|
-
type Expr = {
|
|
38
|
-
kind: 'literal';
|
|
39
|
-
value: Literal;
|
|
40
|
-
span: Span;
|
|
41
|
-
} | {
|
|
42
|
-
kind: 'path';
|
|
43
|
-
root: string;
|
|
44
|
-
segments: PathSegment[];
|
|
45
|
-
span: Span;
|
|
46
|
-
} | {
|
|
47
|
-
kind: 'unary';
|
|
48
|
-
op: '!' | '-';
|
|
49
|
-
arg: Expr;
|
|
50
|
-
span: Span;
|
|
51
|
-
} | {
|
|
52
|
-
kind: 'binary';
|
|
53
|
-
op: '+' | '-' | '<' | '>' | '<=' | '>=' | '==' | '!=' | '===' | '!==';
|
|
54
|
-
left: Expr;
|
|
55
|
-
right: Expr;
|
|
56
|
-
span: Span;
|
|
57
|
-
} | {
|
|
58
|
-
kind: 'logical';
|
|
59
|
-
op: '&&' | '||' | '??';
|
|
60
|
-
left: Expr;
|
|
61
|
-
right: Expr;
|
|
62
|
-
span: Span;
|
|
63
|
-
} | {
|
|
64
|
-
kind: 'conditional';
|
|
65
|
-
test: Expr;
|
|
66
|
-
whenTrue: Expr;
|
|
67
|
-
whenFalse: Expr;
|
|
68
|
-
span: Span;
|
|
69
|
-
} | {
|
|
70
|
-
kind: 'pipe';
|
|
71
|
-
input: Expr;
|
|
72
|
-
name: string;
|
|
73
|
-
args: Expr[];
|
|
74
|
-
span: Span;
|
|
75
|
-
};
|
|
76
|
-
/** Where an interpolation lands, which decides how its value is escaped. */
|
|
77
|
-
type Ctx = 'text' | 'rcdata' | 'raw-text' | 'comment';
|
|
78
|
-
/** A parsed element attribute. */
|
|
79
|
-
interface Attr {
|
|
80
|
-
/** As written: `href`, `userId` (from `[userId]`), `on` (from `[class.on]`). */
|
|
81
|
-
name: string;
|
|
82
|
-
/**
|
|
83
|
-
* `static` `a="x"`, `interp` `a="x{{ y }}"`, `bare` `a`, `bind` `[a]="expr"`,
|
|
84
|
-
* `class` `[class.a]="expr"`, `style` `[style.a(.unit)]="expr"`.
|
|
85
|
-
*/
|
|
86
|
-
kind: 'static' | 'interp' | 'bare' | 'bind' | 'class' | 'style';
|
|
87
|
-
/** `static` / `interp`: the value, literal text and expressions in order. */
|
|
88
|
-
parts?: Array<string | Expr>;
|
|
89
|
-
/** `bind` / `class` / `style`: the bound expression. */
|
|
90
|
-
expr?: Expr;
|
|
91
|
-
/** `[style.width.px]`: `px`. */
|
|
92
|
-
unit?: string;
|
|
93
|
-
quoted: boolean;
|
|
94
|
-
span: Span;
|
|
95
|
-
}
|
|
96
|
-
/** A parsed HTML element. */
|
|
97
|
-
interface Element {
|
|
98
|
-
k: 'element';
|
|
99
|
-
/** As written. */
|
|
100
|
-
tag: string;
|
|
101
|
-
attrs: Attr[];
|
|
102
|
-
children: Node[];
|
|
103
|
-
/** Inside `<svg>` / `<math>`: names keep their case. */
|
|
104
|
-
foreign: boolean;
|
|
105
|
-
void: boolean;
|
|
106
|
-
selfClosing: boolean;
|
|
107
|
-
span: Span;
|
|
108
|
-
}
|
|
109
|
-
/** One branch of an `@if` / `@else if` / `@else` chain. */
|
|
110
|
-
interface IfBranch {
|
|
111
|
-
/** Absent on `@else`. */
|
|
112
|
-
cond?: Expr;
|
|
113
|
-
/** `@if (x; as y)` */
|
|
114
|
-
alias?: string;
|
|
115
|
-
body: Node[];
|
|
116
|
-
}
|
|
117
|
-
/** A loop variable an `@for` can bind with `let`. */
|
|
118
|
-
type LoopVar = '$index' | '$first' | '$last' | '$even' | '$odd' | '$count';
|
|
119
|
-
/** A parsed template node. */
|
|
120
|
-
type Node = {
|
|
121
|
-
k: 'text';
|
|
122
|
-
value: string;
|
|
123
|
-
span: Span;
|
|
124
|
-
} | {
|
|
125
|
-
k: 'interp';
|
|
126
|
-
expr: Expr;
|
|
127
|
-
ctx: Ctx;
|
|
128
|
-
span: Span;
|
|
129
|
-
} | Element | {
|
|
130
|
-
k: 'comment';
|
|
131
|
-
children: Node[];
|
|
132
|
-
span: Span;
|
|
133
|
-
} | {
|
|
134
|
-
k: 'if';
|
|
135
|
-
branches: IfBranch[];
|
|
136
|
-
span: Span;
|
|
137
|
-
} | {
|
|
138
|
-
k: 'for';
|
|
139
|
-
item: string | [string, string];
|
|
140
|
-
of: Expr;
|
|
141
|
-
lets: Record<string, LoopVar>;
|
|
142
|
-
body: Node[];
|
|
143
|
-
empty?: Node[];
|
|
144
|
-
span: Span;
|
|
145
|
-
} | {
|
|
146
|
-
k: 'switch';
|
|
147
|
-
on: Expr;
|
|
148
|
-
cases: Array<{
|
|
149
|
-
value: Expr;
|
|
150
|
-
body: Node[];
|
|
151
|
-
}>;
|
|
152
|
-
default?: Node[];
|
|
153
|
-
span: Span;
|
|
154
|
-
} | {
|
|
155
|
-
k: 'let';
|
|
156
|
-
name: string;
|
|
157
|
-
expr: Expr;
|
|
158
|
-
span: Span;
|
|
159
|
-
} | {
|
|
160
|
-
k: 'verbatim';
|
|
161
|
-
text: string;
|
|
162
|
-
span: Span;
|
|
163
|
-
} |
|
|
164
|
-
/** `<slot name="n" [x]="expr">`: the values (`offers`) it hands the caller's content */
|
|
165
|
-
{
|
|
166
|
-
k: 'slot-outlet';
|
|
167
|
-
name?: string;
|
|
168
|
-
offers: Array<{
|
|
169
|
-
name: string;
|
|
170
|
-
expr: Expr;
|
|
171
|
-
span: Span;
|
|
172
|
-
}>;
|
|
173
|
-
fallback: Node[];
|
|
174
|
-
span: Span;
|
|
175
|
-
} |
|
|
176
|
-
/** `@slot('n'; let a, b = c) { }`: `lets` bind offered values (`from`) to names */
|
|
177
|
-
{
|
|
178
|
-
k: 'slot-fill';
|
|
179
|
-
name: string;
|
|
180
|
-
lets: Array<{
|
|
181
|
-
name: string;
|
|
182
|
-
from: string;
|
|
183
|
-
}>;
|
|
184
|
-
body: Node[];
|
|
185
|
-
span: Span;
|
|
186
|
-
} | {
|
|
187
|
-
k: 'assets';
|
|
188
|
-
entry: string;
|
|
189
|
-
span: Span;
|
|
190
|
-
} |
|
|
191
|
-
/** `@fragment('name') { }`: a block a render can ask for on its own */
|
|
192
|
-
{
|
|
193
|
-
k: 'fragment';
|
|
194
|
-
name: string;
|
|
195
|
-
body: Node[];
|
|
196
|
-
span: Span;
|
|
197
|
-
} |
|
|
198
|
-
/** `@push('name') { }`: content for a layout's `<stack name>` */
|
|
199
|
-
{
|
|
200
|
-
k: 'push';
|
|
201
|
-
name: string;
|
|
202
|
-
body: Node[];
|
|
203
|
-
span: Span;
|
|
204
|
-
} |
|
|
205
|
-
/** `@snippet name(a, b = 'x') { }`: a block of markup with parameters, top level only */
|
|
206
|
-
{
|
|
207
|
-
k: 'snippet';
|
|
208
|
-
name: string;
|
|
209
|
-
params: Array<{
|
|
210
|
-
name: string;
|
|
211
|
-
default?: Literal;
|
|
212
|
-
}>;
|
|
213
|
-
body: Node[];
|
|
214
|
-
span: Span;
|
|
215
|
-
} |
|
|
216
|
-
/** `@render name(args)`: run a snippet of this file */
|
|
217
|
-
{
|
|
218
|
-
k: 'render';
|
|
219
|
-
name: string;
|
|
220
|
-
args: Expr[];
|
|
221
|
-
span: Span;
|
|
222
|
-
} |
|
|
223
|
-
/** `<stack name="…" />`: where pushed content goes; `children` must be blank (checked) */
|
|
224
|
-
{
|
|
225
|
-
k: 'stack';
|
|
226
|
-
name: string;
|
|
227
|
-
children: Node[];
|
|
228
|
-
span: Span;
|
|
229
|
-
};
|
|
230
|
-
/** An `@input` declaration, with its default when given. */
|
|
231
|
-
interface InputDecl {
|
|
232
|
-
name: string;
|
|
233
|
-
/** `@input name: Type`: the TypeScript type, as written (typegen copies it) */
|
|
234
|
-
type?: string;
|
|
235
|
-
default?: {
|
|
236
|
-
value: Literal;
|
|
237
|
-
span: Span;
|
|
238
|
-
};
|
|
239
|
-
span: Span;
|
|
240
|
-
}
|
|
241
|
-
/** A parsed template: its layout, inputs and body. */
|
|
242
|
-
interface TemplateAst {
|
|
243
|
-
file: string;
|
|
244
|
-
/** `undefined`: none declared (the default layout applies); `null`: `@layout(none)`. */
|
|
245
|
-
layout?: string | null;
|
|
246
|
-
layoutSpan?: Span;
|
|
247
|
-
inputs: InputDecl[];
|
|
248
|
-
/** `@import type … from '…'` lines, as written without the `@` (typegen copies them) */
|
|
249
|
-
typeImports?: string[];
|
|
250
|
-
body: Node[];
|
|
251
|
-
}
|
|
252
|
-
/** `[line, column]` of a node in its template, for render errors. */
|
|
253
|
-
type At = [number, number];
|
|
254
|
-
/** A path segment: `.n` or `[e]`; `o` marks `?.`. */
|
|
255
|
-
type CSeg = {
|
|
256
|
-
n: string;
|
|
257
|
-
o?: 1;
|
|
258
|
-
} | {
|
|
259
|
-
e: CExpr;
|
|
260
|
-
o?: 1;
|
|
261
|
-
};
|
|
262
|
-
/** A checked expression, as the renderer reads it. */
|
|
263
|
-
type CExpr =
|
|
264
|
-
/** literal */
|
|
265
|
-
{
|
|
266
|
-
k: 'l';
|
|
267
|
-
v: Literal;
|
|
268
|
-
} |
|
|
269
|
-
/** undefined (a name a component doesn't have) */
|
|
270
|
-
{
|
|
271
|
-
k: 'x';
|
|
272
|
-
} |
|
|
273
|
-
/** page / shared data: `n` then the path */
|
|
274
|
-
{
|
|
275
|
-
k: 'd';
|
|
276
|
-
n: string;
|
|
277
|
-
p: CSeg[];
|
|
278
|
-
} |
|
|
279
|
-
/** a scope slot (@let, loop item, @if alias, component input) then the path */
|
|
280
|
-
{
|
|
281
|
-
k: 'v';
|
|
282
|
-
s: number;
|
|
283
|
-
p: CSeg[];
|
|
284
|
-
} |
|
|
285
|
-
/** a loop variable of the loop whose meta is in slot `s` */
|
|
286
|
-
{
|
|
287
|
-
k: 'm';
|
|
288
|
-
s: number;
|
|
289
|
-
w: LoopVar;
|
|
290
|
-
} | {
|
|
291
|
-
k: 'u';
|
|
292
|
-
o: '!' | '-';
|
|
293
|
-
a: CExpr;
|
|
294
|
-
} | {
|
|
295
|
-
k: 'b';
|
|
296
|
-
o: string;
|
|
297
|
-
l: CExpr;
|
|
298
|
-
r: CExpr;
|
|
299
|
-
} | {
|
|
300
|
-
k: 'c';
|
|
301
|
-
t: CExpr;
|
|
302
|
-
y: CExpr;
|
|
303
|
-
n: CExpr;
|
|
304
|
-
} | {
|
|
305
|
-
k: 'p';
|
|
306
|
-
n: string;
|
|
307
|
-
i: CExpr;
|
|
308
|
-
a: CExpr[];
|
|
309
|
-
};
|
|
310
|
-
/** One attribute of an element whose attributes need work at render time. */
|
|
311
|
-
type CAttr =
|
|
312
|
-
/** static; `v: true` is a bare attribute */
|
|
313
|
-
{
|
|
314
|
-
t: 's';
|
|
315
|
-
n: string;
|
|
316
|
-
v: string | true;
|
|
317
|
-
} |
|
|
318
|
-
/** `n="text {{ e }}"`; `u` marks a URL attribute (`srcset` checks each candidate) */
|
|
319
|
-
{
|
|
320
|
-
t: 'i';
|
|
321
|
-
n: string;
|
|
322
|
-
p: Array<string | CExpr>;
|
|
323
|
-
u?: 'url' | 'srcset';
|
|
324
|
-
} |
|
|
325
|
-
/** `[n]="e"` */
|
|
326
|
-
{
|
|
327
|
-
t: 'b';
|
|
328
|
-
n: string;
|
|
329
|
-
e: CExpr;
|
|
330
|
-
u?: 'url' | 'srcset';
|
|
331
|
-
} |
|
|
332
|
-
/** `[class.n]="e"` */
|
|
333
|
-
{
|
|
334
|
-
t: 'c';
|
|
335
|
-
n: string;
|
|
336
|
-
e: CExpr;
|
|
337
|
-
} |
|
|
338
|
-
/** `[style.n(.x)]="e"` */
|
|
339
|
-
{
|
|
340
|
-
t: 'y';
|
|
341
|
-
n: string;
|
|
342
|
-
e: CExpr;
|
|
343
|
-
x?: string;
|
|
344
|
-
};
|
|
345
|
-
/** A checked template node, as the renderer walks it. */
|
|
346
|
-
/**
|
|
347
|
-
* Slot content: its nodes, compiled in the caller's scope, and the offered
|
|
348
|
-
* values it takes (`let x = from`), each bound to caller slot `s`.
|
|
349
|
-
*/
|
|
350
|
-
interface CFill {
|
|
351
|
-
nodes: CNode[];
|
|
352
|
-
params?: Array<{
|
|
353
|
-
from: string;
|
|
354
|
-
s: number;
|
|
355
|
-
}>;
|
|
356
|
-
}
|
|
357
|
-
type CNode =
|
|
358
|
-
/** static output */
|
|
359
|
-
{
|
|
360
|
-
k: 's';
|
|
361
|
-
t: string;
|
|
362
|
-
} |
|
|
363
|
-
/** `{{ e }}`: `text` escapes HTML (trusted HTML prints as is), `rcdata` (`<title>`, `<textarea>`) escapes everything, `json` is the one value of a JSON script */
|
|
364
|
-
{
|
|
365
|
-
k: 'i';
|
|
366
|
-
c: 'text' | 'rcdata' | 'json' | 'css';
|
|
367
|
-
e: CExpr;
|
|
368
|
-
at: At;
|
|
369
|
-
} |
|
|
370
|
-
/** the attributes of an element (between `<tag` and `>`); `f` takes a component caller's fallthrough attributes */
|
|
371
|
-
{
|
|
372
|
-
k: 'A';
|
|
373
|
-
tag: string;
|
|
374
|
-
a: CAttr[];
|
|
375
|
-
f?: 1;
|
|
376
|
-
at: At;
|
|
377
|
-
} | {
|
|
378
|
-
k: 'if';
|
|
379
|
-
br: Array<{
|
|
380
|
-
c?: CExpr;
|
|
381
|
-
a?: number;
|
|
382
|
-
b: CNode[];
|
|
383
|
-
}>;
|
|
384
|
-
} | {
|
|
385
|
-
k: 'for';
|
|
386
|
-
e: CExpr;
|
|
387
|
-
it: number | [number, number];
|
|
388
|
-
m: number;
|
|
389
|
-
b: CNode[];
|
|
390
|
-
em?: CNode[];
|
|
391
|
-
at: At;
|
|
392
|
-
} | {
|
|
393
|
-
k: 'sw';
|
|
394
|
-
e: CExpr;
|
|
395
|
-
cs: Array<{
|
|
396
|
-
e: CExpr;
|
|
397
|
-
b: CNode[];
|
|
398
|
-
}>;
|
|
399
|
-
d?: CNode[];
|
|
400
|
-
} | {
|
|
401
|
-
k: 'let';
|
|
402
|
-
s: number;
|
|
403
|
-
e: CExpr;
|
|
404
|
-
} |
|
|
405
|
-
/** a component: inputs into its slots, fallthrough attributes, slot fills (`''` is the default) */
|
|
406
|
-
{
|
|
407
|
-
k: 'cmp';
|
|
408
|
-
n: string;
|
|
409
|
-
in: Array<{
|
|
410
|
-
s: number;
|
|
411
|
-
e: CExpr;
|
|
412
|
-
}>;
|
|
413
|
-
/** inputs of wrapped components further down the chain, by name */
|
|
414
|
-
ci?: Array<{
|
|
415
|
-
n: string;
|
|
416
|
-
e: CExpr;
|
|
417
|
-
}>;
|
|
418
|
-
fa: CAttr[];
|
|
419
|
-
f: Record<string, CFill>;
|
|
420
|
-
/** this call is its template's root: it takes the caller's chained attributes */
|
|
421
|
-
r?: 1;
|
|
422
|
-
at: At;
|
|
423
|
-
} |
|
|
424
|
-
/**
|
|
425
|
-
* `<slot name="n" [x]="e">fallback</slot>`: `v` are the values it offers;
|
|
426
|
-
* while the fallback renders they sit in slots `fs` (same order).
|
|
427
|
-
*/
|
|
428
|
-
{
|
|
429
|
-
k: 'o';
|
|
430
|
-
n: string;
|
|
431
|
-
fb: CNode[];
|
|
432
|
-
v?: Array<{
|
|
433
|
-
n: string;
|
|
434
|
-
e: CExpr;
|
|
435
|
-
}>;
|
|
436
|
-
fs?: number[];
|
|
437
|
-
} |
|
|
438
|
-
/**
|
|
439
|
-
* `<component [is]="e" of="…">`: one compiled call per candidate tag, picked
|
|
440
|
-
* by `e`. The slot content `f` is compiled once, here, and given to whichever
|
|
441
|
-
* candidate renders (it's in the caller's scope, the same for all).
|
|
442
|
-
*/
|
|
443
|
-
{
|
|
444
|
-
k: 'dyn';
|
|
445
|
-
e: CExpr;
|
|
446
|
-
c: Record<string, CNode>;
|
|
447
|
-
f: Record<string, CFill>;
|
|
448
|
-
at: At;
|
|
449
|
-
} |
|
|
450
|
-
/** `@render n(args)`: run snippet `n` of the current template */
|
|
451
|
-
{
|
|
452
|
-
k: 'rnd';
|
|
453
|
-
n: string;
|
|
454
|
-
a: CExpr[];
|
|
455
|
-
at: At;
|
|
456
|
-
} |
|
|
457
|
-
/** `@push('n') { }`: rendered, then added to stack `n` */
|
|
458
|
-
{
|
|
459
|
-
k: 'push';
|
|
460
|
-
n: string;
|
|
461
|
-
b: CNode[];
|
|
462
|
-
} |
|
|
463
|
-
/** `<stack name="n" />`: filled once the render is done */
|
|
464
|
-
{
|
|
465
|
-
k: 'stk';
|
|
466
|
-
n: string;
|
|
467
|
-
} | {
|
|
468
|
-
k: 'as';
|
|
469
|
-
en: string;
|
|
470
|
-
};
|
|
471
|
-
/** A template after `check`: plain JSON the renderer walks, which a build can ship as data. */
|
|
472
|
-
/**
|
|
473
|
-
* A `@snippet`, in its own slot space: the template's inputs first (same
|
|
474
|
-
* indexes as in the template), then `params`, then its own variables.
|
|
475
|
-
*/
|
|
476
|
-
interface CSnippet {
|
|
477
|
-
params: number[];
|
|
478
|
-
defaults: Array<Literal | undefined>;
|
|
479
|
-
slots: number;
|
|
480
|
-
body: CNode[];
|
|
481
|
-
/** a field in it has `validate` */
|
|
482
|
-
validates?: true;
|
|
483
|
-
}
|
|
484
|
-
/** A page's `@fragment`, compiled to render on its own. */
|
|
485
|
-
interface CheckedFragment {
|
|
486
|
-
/** names enclosing blocks bound (loop items, aliases, `@let`): the caller passes them */
|
|
487
|
-
needs: string[];
|
|
488
|
-
/** scope slots the unit needs */
|
|
489
|
-
slots: number;
|
|
490
|
-
body: CNode[];
|
|
491
|
-
/** a field in it has `validate` */
|
|
492
|
-
validates?: true;
|
|
493
|
-
}
|
|
494
|
-
interface CheckedTemplate {
|
|
495
|
-
v: typeof AST_FORMAT_VERSION;
|
|
496
|
-
name: string;
|
|
497
|
-
file: string;
|
|
498
|
-
/** declared layout; `null` is `@layout(none)`; absent means the default layout applies to a page */
|
|
499
|
-
layout?: string | null;
|
|
500
|
-
/** scope slots the template needs */
|
|
501
|
-
slots: number;
|
|
502
|
-
/** a component's inputs: name, slot, default, required */
|
|
503
|
-
inputs: Array<{
|
|
504
|
-
n: string;
|
|
505
|
-
s: number;
|
|
506
|
-
d?: Literal;
|
|
507
|
-
r: boolean;
|
|
508
|
-
}>;
|
|
509
|
-
/** `@slot('name') { }` fills a page passes to its layout */
|
|
510
|
-
fills: Record<string, CFill>;
|
|
511
|
-
body: CNode[];
|
|
512
|
-
/** a component's `<script client>`: TypeScript as written (`js: false`), or plain JS once a build stripped it */
|
|
513
|
-
client?: {
|
|
514
|
-
code: string;
|
|
515
|
-
js: boolean;
|
|
516
|
-
};
|
|
517
|
-
/** a field in it has `validate`: pages rendering it ship the validator script */
|
|
518
|
-
validates?: true;
|
|
519
|
-
/** a page's `@input name = value` defaults: data that fills in when nobody supplied it */
|
|
520
|
-
defaults?: Record<string, Literal>;
|
|
521
|
-
/** its `@snippet`s, by name */
|
|
522
|
-
snippets?: Record<string, CSnippet>;
|
|
523
|
-
/** its `@fragment`s, by name */
|
|
524
|
-
fragments?: Record<string, CheckedFragment>;
|
|
525
|
-
}
|
|
526
|
-
export { TemplateAst as _, CNode as a, Span as b, Ctx as c, IfBranch as d, InputDecl as f, PathSegment as g, Node as h, CExpr as i, Element as l, LoopVar as m, Attr as n, CSeg as o, Literal as p, CAttr as r, CheckedTemplate as s, AST_FORMAT_VERSION as t, Expr as u, Diagnostic as v, positionAt as x, Pos as y };
|
|
527
|
-
//# sourceMappingURL=ast-Pq3XT2Xi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ast-Pq3XT2Xi.d.ts","names":[],"sources":["../src/diagnostics.ts","../src/ast.ts"],"mappings":";;UACiB;EACf;EACA;EACA;;;UAIe;EACf,OAAO;EACP,KAAK;;;UAIU;EACf;EACA,MAAM;EACN;EACA;;EAEA;;;cA6BW,aAAU,gBAAkB,mBAAmB;;cC9C/C;;KAGD;;UAGK;;EAEf;;EAEA,WAAW;EACX;;;KAIU;EACN;EAAiB,OAAO;EAAS,MAAM;;EACvC;EAAc;EAAc,UAAU;EAAe,MAAM;;EAC3D;EAAe;EAAe,KAAK;EAAM,MAAM;;EAE/C;EACA;EACA,MAAM;EACN,OAAO;EACP,MAAM;;EAEN;EAAi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