@fluixi/template-parser 1.0.0-alpha.107 → 1.0.0-alpha.109

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @fluixi/template-parser v1.0.0-alpha.107 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/template-parser v1.0.0-alpha.109 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,6 +23,7 @@ var index_exports = {};
23
23
  __export(index_exports, {
24
24
  CORE_DIRECTIVES: () => CORE_DIRECTIVES,
25
25
  Reader: () => Reader,
26
+ SVG_TAGS: () => SVG_TAGS,
26
27
  childrenOf: () => childrenOf,
27
28
  parse: () => parse,
28
29
  parseTemplate: () => parseTemplate,
@@ -244,12 +245,18 @@ var CORE_DIRECTIVES = [
244
245
  {
245
246
  id: "load",
246
247
  match: (n) => n.startsWith("load:"),
247
- build: (raw) => ({
248
- kind: "LoadDirective",
249
- strategy: raw.name.slice("load:".length),
250
- modifier: raw.value && raw.value.kind === "static" ? raw.value.value : null,
251
- loc: raw.loc
252
- })
248
+ build: (raw) => {
249
+ if (raw.value && raw.value.kind !== "static") {
250
+ raw.report("invalid-binding", `'${raw.name}' needs a literal value, not an expression: the strategy is compile-time.`);
251
+ }
252
+ return {
253
+ kind: "LoadDirective",
254
+ strategy: raw.name.slice("load:".length),
255
+ modifier: raw.value && raw.value.kind === "static" ? raw.value.value : null,
256
+ ...raw.value && raw.value.kind !== "static" ? { dynamic: true } : {},
257
+ loc: raw.loc
258
+ };
259
+ }
253
260
  },
254
261
  // Custom directive: `use=${d}` or `use:tooltip[=${opts}]`.
255
262
  {
@@ -337,17 +344,64 @@ function resolveAttribute(raw, directives = CORE_DIRECTIVES, ctx = { component:
337
344
  // src/tags.ts
338
345
  var SVG_TAGS = /* @__PURE__ */ new Set([
339
346
  "svg",
347
+ "g",
348
+ "defs",
349
+ "symbol",
350
+ "use",
351
+ "switch",
352
+ "view",
353
+ "desc",
354
+ "metadata",
340
355
  "path",
341
356
  "circle",
342
- "rect",
357
+ "ellipse",
343
358
  "line",
344
359
  "polygon",
345
360
  "polyline",
346
- "ellipse",
347
- "g",
348
- "defs",
361
+ "rect",
362
+ "image",
363
+ "text",
364
+ "tspan",
365
+ "textPath",
366
+ "linearGradient",
367
+ "radialGradient",
368
+ "stop",
369
+ "pattern",
370
+ "mask",
349
371
  "clipPath",
350
- "text"
372
+ "marker",
373
+ "foreignObject",
374
+ "animate",
375
+ "animateMotion",
376
+ "animateTransform",
377
+ "mpath",
378
+ "set",
379
+ "filter",
380
+ "feBlend",
381
+ "feColorMatrix",
382
+ "feComponentTransfer",
383
+ "feComposite",
384
+ "feConvolveMatrix",
385
+ "feDiffuseLighting",
386
+ "feDisplacementMap",
387
+ "feDistantLight",
388
+ "feDropShadow",
389
+ "feFlood",
390
+ "feFuncA",
391
+ "feFuncB",
392
+ "feFuncG",
393
+ "feFuncR",
394
+ "feGaussianBlur",
395
+ "feImage",
396
+ "feMerge",
397
+ "feMergeNode",
398
+ "feMorphology",
399
+ "feOffset",
400
+ "fePointLight",
401
+ "feSpecularLighting",
402
+ "feSpotLight",
403
+ "feTile",
404
+ "feTurbulence"
351
405
  ]);
352
406
  var RAW_TEXT_ELEMENTS = /* @__PURE__ */ new Set(["script", "style", "textarea", "title"]);
353
407
  var VOID_ELEMENTS = /* @__PURE__ */ new Set([
package/dist/index.d.cts CHANGED
@@ -15,6 +15,7 @@ export * from './ast.cjs';
15
15
  export { Reader, type Piece, type HoleToken } from './reader.cjs';
16
16
  export { CORE_DIRECTIVES, resolveAttribute, type DirectiveDescriptor, type RawAttribute, } from './directives.cjs';
17
17
  export { parseTemplate, type ParserOptions } from './parser.cjs';
18
+ export { SVG_TAGS } from './tags.cjs';
18
19
  import type { Piece } from './reader.cjs';
19
20
  import { type ParserOptions } from './parser.cjs';
20
21
  import type { ParseResult, SourceSpan } from './ast.cjs';
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from './ast.js';
15
15
  export { Reader, type Piece, type HoleToken } from './reader.js';
16
16
  export { CORE_DIRECTIVES, resolveAttribute, type DirectiveDescriptor, type RawAttribute, } from './directives.js';
17
17
  export { parseTemplate, type ParserOptions } from './parser.js';
18
+ export { SVG_TAGS } from './tags.js';
18
19
  import type { Piece } from './reader.js';
19
20
  import { type ParserOptions } from './parser.js';
20
21
  import type { ParseResult, SourceSpan } from './ast.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,EAAE,CAYrE;AAED,+DAA+D;AAC/D,wBAAgB,KAAK,CACnB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,GAAE,aAAkB,GACvB,WAAW,CAEb;AAED,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,EAAE,CAYrE;AAED,+DAA+D;AAC/D,wBAAgB,KAAK,CACnB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,GAAE,aAAkB,GACvB,WAAW,CAEb;AAED,YAAY,EAAE,UAAU,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export * from './ast.js';
15
15
  export { Reader } from './reader.js';
16
16
  export { CORE_DIRECTIVES, resolveAttribute, } from './directives.js';
17
17
  export { parseTemplate } from './parser.js';
18
+ export { SVG_TAGS } from './tags.js';
18
19
  import { parseTemplate } from './parser.js';
19
20
  /**
20
21
  * Build a piece list from the static string segments of a tagged template