jtlt 0.25.1 → 0.26.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/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGES for jtlt
2
2
 
3
+ ## 0.26.0
4
+
5
+ - feat: `{$renderDefault: {...}}` passes its argument object to the
6
+ `renderDefault` extension (`{$renderDefault: true}` is unchanged)
7
+
3
8
  ## 0.25.1
4
9
 
5
10
  - fix: JSONPath (preventEval -> eval: false; returnType->resultType; add customTypes; avoid any type)
@@ -1 +1 @@
1
- {"version":3,"file":"jsonTemplate.d.ts","sourceRoot":"","sources":["../src/jsonTemplate.js"],"names":[],"mappings":"AAyEG,YAAwC,QAAQ,GAAtC,MAAM,GAAC,SAAS,GAAC,WAAW,CAAU;AAoEhD,YAAgD,2BAA2B,GAAjE;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,GAAG;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAC,CAA6B;AA8Q3E,YAAuC,UAAU,GAAvC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAY;AA6EpD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAE,KAAK,EAHxB,OAAO,EAGiB,GAFtB;IAAC,KAAK,EAAE,UAAU,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CA+BnD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EARI,OAAO,EAQX,EAAE,EAAC,MAAe,EAAE,qBAAqB,EAAC,AAP9C,CAIA,EAJQ;IACN,MAAM,CAAC,EAAE,MAAM,GAAC,YAAY,CAAC;IAC7B,qBAAqB,CAAC,EAAE,2BAA2B,CAAA;CAKF,GAHzC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CA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AAY,CAAC;IAC7B,qBAAqB,CAAC,EAAE,2BAA2B,CAAA;CAKF,GAHzC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAiB9C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAE,CAAC,EAH/B,OAG+B,GAF7B,CAAC,IAAI,OAAO,EAAE,CAI1B;AA0KD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAVI,OAAO,EAUX,EAAE,EAAC,MAAe,EAAE,qBAAqB,EAAC,AAT9C,CAIA,EAJQ;IACN,MAAM,CAAC,EAAE,MAAM,GAAC,YAAY,CAAC;IAC7B,qBAAqB,CAAC,EAAE,2BAA2B,CAAA;CAOF,GALzC,CACR,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,CAoBpB"}
@@ -138,7 +138,7 @@ A node is one of:
138
138
  | `[{$forEach: sel, $sort?: sort, $key?: name}, childNodes]` | `this.forEach(sel, cb, sort, name)` — with `$key`, binds each iteration's key (array index, or object property name for an object-wildcard `sel` like `$.*`) to `name`, readable via a bare `$name` reference |
139
139
  | `[{$variable: name, $select: sel}]` or `[{$variable: name, $value: literal}]` | `this.variable(name, sel)` / `this.variable(name, {value: literal})`, readable back later via a bare `$name` reference — `$value` embeds a literal directly in the template (e.g. a fixed collection list) rather than selecting from `data`/`params` |
140
140
  | `[{$indexedDB: {db, store, options?}, $as?: name}, childNodes?]` | fetches rows; with `$as`, binds them via `this.variable(name, {value: rows})`; without it, swaps the data context (`$`) to the rows for `childNodes` |
141
- | `[{$renderDefault: true}]` | `this.appendOutput(await this.renderDefault())` (an `extensions.renderDefault` your config supplies) |
141
+ | `[{$renderDefault: true}]` or `[{$renderDefault: {...}}]` | `this.appendOutput(await this.renderDefault())` / `await this.renderDefault(argObject)` (an `extensions.renderDefault` your config supplies; the argument object, if any, is passed through unresolved, like any other extension call's) |
142
142
  | `[{$name: {...}}]` (any key not otherwise recognized above) | an extension call: `await this[name](argObject)` — the argument object is passed through entirely unresolved (no key, e.g. a conventional `select`, is interpreted by jtlt itself; the extension resolves whatever it needs via `this.get(...)`, `this.valueOf(...)`, etc.). `name` must be a key actually present in `config.extensions`; any other name throws |
143
143
 
144
144
  **Dynamic attribute values**: an element's attribute value stays a plain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jtlt",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "author": "Brett Zamir",
6
6
  "contributors": [],
@@ -691,7 +691,12 @@ async function runOperation (head, rest, ctx) {
691
691
  return;
692
692
  }
693
693
  if (Object.hasOwn(head, '$renderDefault')) {
694
- await ctx.renderDefault();
694
+ // `true` (the original, argument-less form) or an argument object, handed
695
+ // to the `renderDefault` extension as-is (like any extension call's
696
+ // argument object, its contents are entirely up to the extension)
697
+ await (head.$renderDefault === true
698
+ ? ctx.renderDefault()
699
+ : ctx.renderDefault(head.$renderDefault));
695
700
  return;
696
701
  }
697
702
  if (Object.hasOwn(head, '$indexedDB')) {