jtlt 0.18.0 → 0.19.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/index.d.ts CHANGED
@@ -30,9 +30,21 @@ export type TemplateObject<T, U, TCtx> = {
30
30
  */
31
31
  priority?: number;
32
32
  /**
33
- * - Template function
33
+ * - For an Array `template` only:
34
+ * the jamilih validation strictness `compileJSONTemplate` applies
35
+ * (`isValidJamilih`'s own `format` option) — `'json'` (default) rejects
36
+ * live values (functions, DOM nodes, …) embedded in the structure,
37
+ * `'javascript'` allows them. Ignored for a function `template`. Falls
38
+ * back to `config.defaultTemplateFormat`, then `'json'`, when omitted.
34
39
  */
35
- template: TemplateFunction<T, U, TCtx>;
40
+ format?: 'json' | 'javascript';
41
+ /**
42
+ * -
43
+ * Template function, or a declarative (jamilih-shaped) node array
44
+ * compiled via `compileJSONTemplate` — detected by `Array.isArray`, since
45
+ * a `TemplateFunction` is never an array.
46
+ */
47
+ template: TemplateFunction<T, U, TCtx> | JSONTemplateNode[];
36
48
  };
37
49
  export type TemplateFunction<T, U, TCtx> = (this: TCtx & import('./context-extensions.js').ContextExtensions, value: ResultType<U>, cfg?: {
38
50
  mode?: string;
@@ -45,8 +57,88 @@ export type XPathTemplateArray<T> = (XPathTemplateObject<T> | [
45
57
  ])[];
46
58
  export type JSONPathTemplateArray<T extends "json" | "string" | "dom"> = JSONPathTemplateObject<T> | [
47
59
  string,
48
- TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default>
60
+ TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default> | JSONTemplateNode[]
61
+ ];
62
+ export type JSONElementNode = [string] | [
63
+ string,
64
+ Record<string, unknown>
65
+ ] | [
66
+ string,
67
+ JSONTemplateNode[]
68
+ ] | [
69
+ string,
70
+ Record<string, unknown>,
71
+ JSONTemplateNode[]
49
72
  ];
73
+ export type JSONOperationNode = [{
74
+ $text: unknown;
75
+ }] | [
76
+ {
77
+ $jtltText: unknown;
78
+ $select?: string;
79
+ }
80
+ ] | [
81
+ {
82
+ $string: unknown;
83
+ $select?: string;
84
+ }
85
+ ] | [
86
+ {
87
+ $valueOf: string;
88
+ }
89
+ ] | [
90
+ {
91
+ $applyTemplates: string;
92
+ $jtltMode?: string;
93
+ $sort?: unknown;
94
+ }
95
+ ] | [
96
+ {
97
+ $if: string;
98
+ },
99
+ JSONTemplateNode[]
100
+ ] | [
101
+ {
102
+ $if: string;
103
+ },
104
+ JSONTemplateNode[],
105
+ JSONTemplateNode[]
106
+ ] | [
107
+ {
108
+ $forEach: string;
109
+ $sort?: unknown;
110
+ },
111
+ JSONTemplateNode[]
112
+ ] | [
113
+ {
114
+ $variable: string;
115
+ $select: string;
116
+ }
117
+ ] | [
118
+ {
119
+ $indexedDB: {
120
+ db: string;
121
+ store: string;
122
+ options?: import('./indexedDB.js').QueryOptions;
123
+ };
124
+ $as?: string;
125
+ }
126
+ ] | [
127
+ {
128
+ $indexedDB: {
129
+ db: string;
130
+ store: string;
131
+ options?: import('./indexedDB.js').QueryOptions;
132
+ };
133
+ $as?: string;
134
+ },
135
+ JSONTemplateNode[]
136
+ ] | [
137
+ {
138
+ $renderDefault: true;
139
+ }
140
+ ];
141
+ export type JSONTemplateNode = string | JSONElementNode | JSONOperationNode;
50
142
  export type JoiningTransformerContract = {
51
143
  append: (item: unknown) => unknown;
52
144
  get: () => unknown;
@@ -173,9 +265,16 @@ export type BaseJTLTOptions<T, E extends boolean | undefined = false> = {
173
265
  * parameter from any template.
174
266
  */
175
267
  params?: Record<string, unknown>;
268
+ /**
269
+ * Config-wide
270
+ * default for an Array `template`'s jamilih validation strictness (see
271
+ * `TemplateObject.format`), used for any entry that doesn't specify its
272
+ * own `format`. Defaults to `'json'` when omitted here too.
273
+ */
274
+ defaultTemplateFormat?: 'json' | 'javascript';
176
275
  };
177
276
  export type JSONPathJTLTOptions<T extends "json" | "string" | "dom" = "json", E extends boolean | undefined = false> = BaseJTLTOptions<T, E> & {
178
- templates?: JSONPathTemplateArray<T>[] | TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default<T>>;
277
+ templates?: JSONPathTemplateArray<T>[] | JSONPathTemplateArray<T> | TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default<T>>;
179
278
  template?: JSONPathTemplateObject<T> | TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default>;
180
279
  query?: TemplateFunction<T, "json", import('./JSONPathTransformerContext.js').default>;
181
280
  forQuery?: [string, TemplateFunction<T, "json", import('./XPathTransformerContext.js').default>];
@@ -194,263 +293,6 @@ export type XPathJTLTOptions<T extends "json" | "string" | "dom", E extends bool
194
293
  outputType?: T;
195
294
  };
196
295
  export type JTLTOptions<E extends boolean | undefined = boolean | undefined> = JSONPathJTLTOptions<"json", E> | JSONPathJTLTOptions<"string", E> | JSONPathJTLTOptions<"dom", E> | XPathJTLTOptions<"json", E> | XPathJTLTOptions<"string", E> | XPathJTLTOptions<"dom", E>;
197
- /**
198
- * Internal options extension adding private runtime state flags.
199
- * Not part of the public API surface but used for narrowing casts.
200
- * @typedef {JTLTOptions & {
201
- * _customJoiningTransformer?: boolean
202
- * }} InternalJTLTOptions
203
- */
204
- /**
205
- * A template declaration whose `template` executes with `this` bound
206
- * to the engine-specific context type `TCtx`.
207
- * Either `path` must be provided (for pattern matching), or `name` must be
208
- * provided (for named templates callable via callTemplate), or both.
209
- * @template T
210
- * @template U
211
- * @template TCtx
212
- * @typedef {object} TemplateObject
213
- * @property {string} [path] - JSONPath or XPath selector for matching nodes
214
- * @property {string} [match] - Alias for 'path' (XSLT compatibility)
215
- * @property {string} [name] - Optional name for calling via callTemplate
216
- * @property {string} [mode] - Optional mode for template matching
217
- * @property {number} [priority] - Priority for template selection
218
- * @property {TemplateFunction<T, U, TCtx>} template - Template function
219
- */
220
- /**
221
- * A callable template function with an engine-specific `this`. The `this`
222
- * type is intersected with {@link ContextExtensions} so helpers registered
223
- * through the `extensions` option are visible once a consumer augments that
224
- * interface.
225
- * @template T
226
- * @template U
227
- * @template TCtx
228
- * @typedef {(this: TCtx &
229
- * import('./context-extensions.js').ContextExtensions,
230
- * value: ResultType<U>,
231
- * cfg?: {mode?: string}
232
- * ) => ResultType<T>|void|Promise<ResultType<T>|void>} TemplateFunction
233
- */
234
- /**
235
- * @template {"json"|"string"|"dom"} T
236
- * @typedef {TemplateObject<T, "json",
237
- * import('./JSONPathTransformerContext.js').default<T>
238
- * >} JSONPathTemplateObject
239
- */
240
- /**
241
- * @template T
242
- * @typedef {TemplateObject<T, "dom",
243
- * import('./XPathTransformerContext.js').default
244
- * >} XPathTemplateObject
245
- */
246
- /**
247
- * @template T
248
- * @typedef {(XPathTemplateObject<T> | [string, TemplateFunction<T, "dom",
249
- * import('./XPathTransformerContext.js').default
250
- * >])[]} XPathTemplateArray
251
- */
252
- /**
253
- * @template {"json"|"string"|"dom"} T
254
- * @typedef {JSONPathTemplateObject<T> | [string, TemplateFunction<T, "json",
255
- * import('./JSONPathTransformerContext.js').default
256
- * >]} JSONPathTemplateArray
257
- */
258
- /**
259
- * The output-sink surface a custom `joiningTransformer` may provide. Only
260
- * `append` and `get` are required; the rest are optional because the engine
261
- * guards each call. The built-in joiners' `append`/`string`/… signatures
262
- * diverge (e.g. the DOM joiner also accepts `Node`), so under
263
- * `strictFunctionTypes` no single structural type is a supertype of all
264
- * three; this contract lists the surface with `unknown` parameters, and
265
- * {@link JoiningTransformer} unions it with the concrete classes so real
266
- * joiners still type precisely.
267
- * @typedef {object} JoiningTransformerContract
268
- * @property {(item: unknown) => unknown} append
269
- * @property {() => unknown} get
270
- * @property {(txt: string) => unknown} [text]
271
- * @property {(str: unknown, cb?: () => void) => unknown} [string]
272
- * @property {(num: unknown) => unknown} [number]
273
- * @property {(
274
- * obj: unknown, cb?: unknown, usePropertySets?: unknown, propSets?: unknown
275
- * ) => unknown} [object]
276
- * @property {(arr: unknown, cb?: unknown) => unknown} [array]
277
- * @property {(
278
- * name: string, atts?: unknown, children?: unknown,
279
- * cb?: unknown, useAttributeSets?: unknown
280
- * ) => unknown} [element]
281
- * @property {(
282
- * name: string, val: unknown, avoidAttEscape?: unknown
283
- * ) => unknown} [attribute]
284
- * @property {(text: string) => unknown} [comment]
285
- * @property {(
286
- * target: string, data: string
287
- * ) => unknown} [processingInstruction]
288
- * @property {(str: unknown) => unknown} [plainText]
289
- * @property {(prop: unknown, val: unknown) => unknown} [propValue]
290
- * @property {(item: unknown) => unknown} [rawAppend]
291
- * @property {(prefix: string, namespaceURI: string) => unknown} [namespace]
292
- * @property {(context: unknown) => unknown} [setContext]
293
- * @property {(cfg: unknown) => unknown} [output]
294
- * @property {(cfg: unknown) => unknown} [mode]
295
- * @property {(cfg: unknown) => unknown} [stylesheet]
296
- * @property {(cfg: unknown) => unknown} [function]
297
- * @property {(
298
- * name: string, args?: unknown[]
299
- * ) => unknown} [invokeFunctionByArity]
300
- * @property {(
301
- * name: string, outputCharacters: unknown
302
- * ) => unknown} [characterMap]
303
- * @property {(name: string, attributes: unknown) => unknown} [attributeSet]
304
- * @property {(
305
- * stylesheetPrefix: string, resultPrefix: string
306
- * ) => unknown} [namespaceAlias]
307
- */
308
- /**
309
- * One of the three built-in joiners. Used where engine internals rely on
310
- * concrete members (e.g. `_modeConfig`).
311
- * @typedef {(
312
- * StringJoiningTransformer|
313
- * DOMJoiningTransformer|
314
- * JSONJoiningTransformer
315
- * )} BuiltinJoiningTransformer
316
- */
317
- /**
318
- * The type accepted for a config `joiningTransformer`: a built-in joiner or
319
- * any object implementing {@link JoiningTransformerContract}.
320
- * @typedef {BuiltinJoiningTransformer | JoiningTransformerContract
321
- * } JoiningTransformer
322
- */
323
- /**
324
- * @typedef {"json"|"string"|"dom"} joiningTypes
325
- */
326
- /**
327
- * @template T
328
- * @template {boolean|undefined} [E=false]
329
- * @typedef {T extends "json" ?
330
- * (E extends true ? unknown[] : unknown) :
331
- * T extends "string" ?
332
- * (E extends true ? string[] : string) :
333
- * (E extends true ? XMLDocument[] :
334
- * DocumentFragment|Element)} ResultType
335
- */
336
- /**
337
- * Options common to both engines.
338
- * @template T
339
- * @template {boolean|undefined} [E=false]
340
- * @typedef {object} BaseJTLTOptions
341
- * @property {boolean} [sync] Off by default: the engine awaits any Promise a
342
- * template returns (e.g. from `await this.indexedDB(...)`). Set `true` to
343
- * forbid asynchrony — a template that returns a Promise then throws.
344
- * @property {(
345
- * result: ResultType<T, E>
346
- * ) => ResultType<T, E>|void} [success] A callback supplied
347
- * with a single argument that is the result of this instance's
348
- * transform() method. When used in TypeScript, this can be made
349
- * generic as `success<T>(result: T): void`.
350
- * @property {null|boolean|number|string|object} [data] A JSON
351
- * object or DOM document (XPath)
352
- * @property {string} [ajaxData] URL of a JSON file to retrieve for
353
- * evaluation
354
- * @property {boolean} [errorOnEqualPriority] Whether or not to
355
- * report an error when equal priority templates are found
356
- * @property {boolean} [autostart] Whether to begin transform()
357
- * immediately.
358
- * @property {boolean} [preventEval] Whether to prevent
359
- * parenthetical evaluations in JSONPath. Safer if relying on user
360
- * input, but reduces capabilities of JSONPath.
361
- * @property {boolean} [unwrapSingleResult] For JSON output, whether to
362
- * unwrap single-element root arrays to return just the element
363
- * @property {E} [exposeDocuments] When true, joiners return an array
364
- * of complete documents: XMLDocument[] for DOM, document wrapper objects[]
365
- * for JSON, and string[] for string joiners. Each array element corresponds
366
- * to a root element built during transformation.
367
- * @property {string} [mode] The mode in which to begin the transform.
368
- * @property {(opts: JTLTOptions &
369
- * Required<Pick<JTLTOptions, "joiningTransformer">>
370
- * ) => ResultType<T, E>} [engine] Will be based on the
371
- * same config as passed to this instance. Defaults to a transforming
372
- * function based on JSONPath and with its own set of priorities for
373
- * processing templates.
374
- * @property {null|(
375
- * (path: string) => 0 | 0.5 | -0.5
376
- * )} [specificityPriorityResolver]
377
- * Callback for getting the priority by specificity
378
- * @property {JoiningTransformer} [joiningTransformer]
379
- * A concrete joining transformer instance (or custom subclass) responsible
380
- * for accumulating output. When omitted, one is created automatically based
381
- * on `outputType`.
382
- * @property {import('./AbstractJoiningTransformer.js').
383
- * JoiningTransformerConfig<T> &
384
- * {exposeDocuments?: E}} [joiningConfig] Config for the joining
385
- * transformer.
386
- * @property {object} [parent] Parent object for context
387
- * @property {string} [parentProperty] Parent property name for context
388
- * @property {Record<string, unknown>} [params] Parameter values supplied at
389
- * runtime, mirroring the stylesheet parameters an XSLT processor is handed.
390
- * A `this.param(name, default)` declaration whose name appears here resolves
391
- * to this value instead of its default, and `$name` references such a
392
- * parameter from any template.
393
- */
394
- /**
395
- * JSONPath engine options with context-aware template typing.
396
- * @template {"json"|"string"|"dom"} [T = "json"]
397
- * @template {boolean|undefined} [E=false]
398
- * @typedef {BaseJTLTOptions<T, E> & {
399
- * templates?: JSONPathTemplateArray<T>[] |
400
- * TemplateFunction<T, "json",
401
- * import('./JSONPathTransformerContext.js').default<T>>,
402
- * template?: JSONPathTemplateObject<T> | TemplateFunction<T, "json",
403
- * import('./JSONPathTransformerContext.js').default
404
- * >,
405
- * query?: TemplateFunction<T, "json",
406
- * import('./JSONPathTransformerContext.js').default
407
- * >,
408
- * forQuery?: [string, TemplateFunction<T, "json",
409
- * import('./XPathTransformerContext.js').default
410
- * >],
411
- * extensions?: Record<string, unknown> & ThisType<
412
- * import('./JSONPathTransformerContext.js').default<T> &
413
- * import('./context-extensions.js').ContextExtensions
414
- * >,
415
- * engineType?: 'jsonpath',
416
- * outputType?: T
417
- * }} JSONPathJTLTOptions
418
- */
419
- /**
420
- * XPath engine options with context-aware template typing.
421
- * @template {"json"|"string"|"dom"} T
422
- * @template {boolean|undefined} [E=false]
423
- * @typedef {BaseJTLTOptions<T, E> & {
424
- * templates?: XPathTemplateArray<T> |
425
- * TemplateFunction<T, "dom",
426
- * import('./XPathTransformerContext.js').default<T>>,
427
- * template?: XPathTemplateObject<T> | TemplateFunction<T, "dom",
428
- * import('./XPathTransformerContext.js').default
429
- * >,
430
- * query?: TemplateFunction<T, "dom",
431
- * import('./XPathTransformerContext.js').default
432
- * >,
433
- * forQuery?: [string, TemplateFunction<T, "dom",
434
- * import('./JSONPathTransformerContext.js').default
435
- * >],
436
- * extensions?: Record<string, unknown> & ThisType<
437
- * import('./XPathTransformerContext.js').default &
438
- * import('./context-extensions.js').ContextExtensions
439
- * >,
440
- * engineType: 'xpath',
441
- * xpathVersion?: 1|2|3.1,
442
- * outputType?: T
443
- * }} XPathJTLTOptions
444
- */
445
- /**
446
- * @template {boolean|undefined} [E=boolean|undefined]
447
- * @typedef {JSONPathJTLTOptions<"json", E> |
448
- * JSONPathJTLTOptions<"string", E> |
449
- * JSONPathJTLTOptions<"dom", E> |
450
- * XPathJTLTOptions<"json", E>|
451
- * XPathJTLTOptions<"string", E>|
452
- * XPathJTLTOptions<"dom", E>} JTLTOptions
453
- */
454
296
  /**
455
297
  * High-level façade for running a JTLT transform.
456
298
  *
@@ -522,5 +364,6 @@ export { default as JSONPathTransformerContext } from './JSONPathTransformerCont
522
364
  export { default as JSONPathTransformer } from './JSONPathTransformer.js';
523
365
  export { default as XPathTransformerContext } from './XPathTransformerContext.js';
524
366
  export { default as XPathTransformer } from './XPathTransformer.js';
367
+ export { compileJSONTemplate, isJSONTemplateNodeArray, validateJSONTemplate } from './jsonTemplate.js';
525
368
  export default JTLT;
526
369
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AAGjE,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,SAAS,QAFX,OAAO,OAAO,EAAE,SAAS,GAAG,OAAO,UAAU,SAMvD,CAAC;AAKC,YAEG,mBAAmB,GAFZ,WAAW,GAAG;IACtB,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAqB;AAWtB,YAAkB,cAAc,CAHtB,CAAC,EACD,CAAC,EACD,IAAI,I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OAAO,EACL,OAAO,IAAI,wBAAwB,EACpC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,OAAO,IAAI,qBAAqB,EACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,OAAO,IAAI,sBAAsB,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,IAAI,yBAAyB,EACrC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,IAAI,0BAA0B,EACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,IAAI,uBAAuB,EACnC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EACnE,MAAM,mBAAmB,CAAC;eAEZ,IAAI"}
@@ -0,0 +1,37 @@
1
+ export type NodeKind = 'text' | 'element' | 'operation';
2
+ /**
3
+ * Non-executing structural check for a declarative template. Unlike
4
+ * `compileJSONTemplate`, this never throws — it reports every problem it
5
+ * finds, for a "validate before save" editor workflow.
6
+ * @param {unknown[]} nodes
7
+ * @param {{format?: 'json'|'javascript'}} [options]
8
+ * @returns {{valid: boolean, errors: string[]}}
9
+ */
10
+ export declare function validateJSONTemplate(nodes: unknown[], { format }?: {
11
+ format?: 'json' | 'javascript';
12
+ }): {
13
+ valid: boolean;
14
+ errors: string[];
15
+ };
16
+ /**
17
+ * @param {unknown} x
18
+ * @returns {x is unknown[]}
19
+ */
20
+ export declare function isJSONTemplateNodeArray(x: unknown): x is unknown[];
21
+ /**
22
+ * Compile a declarative (jamilih-shaped) node array into a jtlt
23
+ * `TemplateFunction`. Validates the whole tree up front (see
24
+ * `validateJSONTemplate`) and throws on the first problem, rather than
25
+ * failing partway through execution.
26
+ * @param {unknown[]} nodes
27
+ * @param {{format?: 'json'|'javascript'}} [options]
28
+ * @returns {(
29
+ * this: any, value: unknown, cfg?: {mode?: string}
30
+ * ) => Promise<void>}
31
+ */
32
+ export declare function compileJSONTemplate(nodes: unknown[], { format }?: {
33
+ format?: 'json' | 'javascript';
34
+ }): (this: any, value: unknown, cfg?: {
35
+ mode?: string;
36
+ }) => Promise<void>;
37
+ //# sourceMappingURL=jsonTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonTemplate.d.ts","sourceRoot":"","sources":["../src/jsonTemplate.js"],"names":[],"mappings":"AAyCG,YAAwC,QAAQ,GAAtC,MAAM,GAAC,SAAS,GAAC,WAAW,CAAU;AAyLnD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAJhC,OAAO,EAIyB,EAAE,EAAC,MAAe,EAAC,AAH3D,CACA,EADQ;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,YAAY,CAAA;CAG2B,GAFtD;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAe9C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAE,CAAC,EAH/B,OAG+B,GAF7B,CAAC,IAAI,OAAO,EAAE,CAI1B;AAqID;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAE,KAAK,EAN/B,OAAO,EAMwB,EAAE,EAAC,MAAe,EAAC,AAL1D,CACA,EADQ;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,YAAY,CAAA;CAK0B,GAJrD,CACR,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,CAYpB"}
@@ -59,8 +59,9 @@ Common to both entry points unless noted.
59
59
  | ------ | ---- | ----------- |
60
60
  | `data` | object \| primitive | Root JSON/JS value (or DOM `Document`/`Element` for the XPath engine). Required unless `ajaxData` provided. |
61
61
  | `ajaxData` | string | URL to fetch JSON (async start). |
62
- | `templates` | Array&lt;TemplateObject&gt; | Template declarations; see below. |
62
+ | `templates` | Array&lt;TemplateObject&gt; \| TemplateObject \| [path, Function\|Array] | Template declarations; see below. A bare `TemplateObject` or `[path, template]` tuple (not wrapped in an outer array) is also accepted directly. |
63
63
  | `template` | Function \| TemplateObject | Single root template convenience. |
64
+ | `defaultTemplateFormat` | 'json' \| 'javascript' | JSONPath engine only. Jamilih validation strictness applied to a declarative (`Array`) `template` when its own `format` isn't set. Default `'json'`. See "Declarative (jamilih-shaped) templates" below. |
64
65
  | `query` | Function | Root template convenience (wrapped as `path: '$'`). |
65
66
  | `forQuery` | [select, cb] | One-off query (like FLWOR `for`). Auto-wrapped as root template. |
66
67
  | `success` | Function(result) | **`JTLT` only** — required callback; also the return of `.transform()`. Not accepted by `jtlt()`. |
@@ -97,6 +98,79 @@ Edge cases:
97
98
  - For XPath: `//item`, `/root/item`, `//*[@id='x']`.
98
99
  - Root template: path `$` (JSONPath) or `/` (XPath).
99
100
 
101
+ ## Declarative (jamilih-shaped) templates
102
+
103
+ JSONPath engine only. A `TemplateObject.template` may be an `Array` of
104
+ declarative nodes — modeled on [jamilih](https://github.com/brettz9/jamilih)'s
105
+ own JSON/JS-array HTML/XML construction syntax — instead of a `Function`.
106
+ `compileJSONTemplate()` compiles it once, up front, into an ordinary
107
+ `TemplateFunction`; every other API (`applyTemplates`, `callTemplate`, modes,
108
+ priority, …) works the same regardless of which form a matched template uses.
109
+
110
+ ```js
111
+ const out = await jtlt({
112
+ data: {name: 'Ada'},
113
+ outputType: 'string',
114
+ templates: {
115
+ path: '$',
116
+ template: [
117
+ ['h1', ['Hello']],
118
+ [{$valueOf: '$.name'}]
119
+ ]
120
+ }
121
+ });
122
+ // -> <h1>Hello</h1>Ada
123
+ ```
124
+
125
+ A node is one of:
126
+
127
+ | Node | Emits |
128
+ | --- | --- |
129
+ | `"text"` (a plain string) | a text node |
130
+ | `[name, attrs?, children?]` | an element — `attrs` is omitted when there are none, in which case the second item is the children array directly |
131
+ | `[{$text: value}]` | `this.text(value)` — jamilih's own native text-node form; bare only, no `$select` |
132
+ | `[{$jtltText: value, $select?: sel}]` | `this.text(value)` (no `$select`) or `this.valueOf(sel)` (with `$select`) — the general/canonical form of `$text` |
133
+ | `[{$string: value, $select?: sel}]` | `this.string(value)` or, with `$select`, the selected value stringified |
134
+ | `[{$valueOf: sel}]` | `this.valueOf(sel)` |
135
+ | `[{$applyTemplates: sel, $jtltMode?: mode, $sort?: sort}]` | `this.applyTemplates(sel, mode, sort)` |
136
+ | `[{$if: sel}, thenNodes, elseNodes?]` | `this.if(sel, cb)` or, with an else, `this.choose(sel, whenCb, otherwiseCb)` |
137
+ | `[{$forEach: sel, $sort?: sort}, childNodes]` | `this.forEach(sel, cb, sort)` |
138
+ | `[{$variable: name, $select: sel}]` | `this.variable(name, sel)`, readable back later via a bare `$name` reference |
139
+ | `[{$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` |
140
+ | `[{$renderDefault: true}]` | `this.appendOutput(await this.renderDefault())` (an `extensions.renderDefault` your config supplies) |
141
+
142
+ Every operation node's leading object is entirely `$`-prefixed — jamilih's
143
+ own validator requires this of any first-position plain object. `$jtltMode`/
144
+ `$jtltText` are namespaced because jamilih itself reserves `$mode` outright
145
+ and gives `$text` its own (bare-only) native meaning; see the README's
146
+ ["Differences between an exact equivalence with
147
+ XSLT"](../README.md#differences-between-an-exact-equivalence-with-xslt)
148
+ section for why `template`, an `$if`/`$forEach` body, and an operation
149
+ node's own trailing arguments are each *arrays* — including the
150
+ easy-to-miss case of a single node or a single sibling, which still needs
151
+ its wrapping array.
152
+
153
+ `$indexedDB`/`$renderDefault` may appear nested anywhere a node is
154
+ allowed — inside an element's children, or a `$if`/`$forEach` body — not
155
+ just at a template's top level; see the README section above for why.
156
+
157
+ **Validation**: `format: 'json'` (the default) rejects an embedded live
158
+ function/DOM node anywhere in the tree — the intent is a safely
159
+ serializable structure (e.g. round-tripped through IndexedDB), not
160
+ arbitrary JavaScript. Pass `format: 'javascript'` on the `TemplateObject`
161
+ (or set `defaultTemplateFormat: 'javascript'` on the config to relax every
162
+ entry lacking its own `format`) to allow one.
163
+
164
+ **Exports** (from `'jtlt'`):
165
+ - `compileJSONTemplate(nodes, {format?}) => TemplateFunction` — throws a
166
+ `TypeError` with every problem found if `nodes` is invalid.
167
+ - `validateJSONTemplate(nodes, {format?}) => {valid, errors}` — the same
168
+ checks, non-executing and non-throwing; for a "validate before save"
169
+ editor workflow.
170
+ - `isJSONTemplateNodeArray(x) => boolean` — `Array.isArray`, exported for
171
+ callers that need to detect the declarative form themselves (e.g. before
172
+ deciding whether to call `compileJSONTemplate`).
173
+
100
174
  ## Engines
101
175
 
102
176
  ### `JSONPathTransformer`
package/docs/API.md CHANGED
@@ -181,6 +181,26 @@ this.applyTemplates('$.items[*]');
181
181
 
182
182
  This is useful for strict template matching where ambiguity should be an error rather than silently choosing a template, or for development where warnings help identify potential issues.
183
183
 
184
+ ## Declarative (jamilih-shaped) templates
185
+
186
+ JSONPath engine only. `template` may be an `Array` of jamilih-shaped nodes
187
+ instead of a `Function` — compiled once via `compileJSONTemplate()`
188
+ (also exported, along with `validateJSONTemplate()` for non-executing
189
+ validation and `isJSONTemplateNodeArray()`):
190
+
191
+ ```js
192
+ const templates = {path: '$', template: [
193
+ ['h1', ['Hello']],
194
+ [{$valueOf: '$.name'}]
195
+ ]};
196
+ // -> <h1>Hello</h1>Ada
197
+ ```
198
+
199
+ `format: 'json'` (default) rejects an embedded live function/DOM node
200
+ anywhere in the tree; `format: 'javascript'` (per-entry, or
201
+ `defaultTemplateFormat` on the config) allows one. See
202
+ `docs/API.expanded.md` for the full node vocabulary.
203
+
184
204
  ## Sorting
185
205
 
186
206
  Path string (ascending text), comparator function, object spec
package/docs/TO-DO.md CHANGED
@@ -4,10 +4,12 @@
4
4
 
5
5
  1. Document
6
6
 
7
+ 1. Write a specification for declarative jamilih / jtlt?
8
+
7
9
  1. Implement and demo equivalent to applying and calling templates, and
8
10
  root template
9
11
 
10
- 2. Demo chaining of methods, including [equivalents](https://www.saxonica.com/papers/XTech2005/mhkpaper.html#S4.)
12
+ 1. Demo chaining of methods, including [equivalents](https://www.saxonica.com/papers/XTech2005/mhkpaper.html#S4.)
11
13
  to XQuery's FLWOR expressions (see also Promises to-do), perhaps
12
14
  even making aliases so that XQuery's friendlier terms can be used
13
15
  instead of XSLT's.
@@ -41,10 +43,12 @@
41
43
  through [HTTPQuery](https://github.com/brettz9/httpquery) (and also
42
44
  supply to JSONEditor, etc.). Utilize updating by reference.
43
45
 
44
- 8. Demo narrowing to subset of JavaScript (as with `jsep`) to make
46
+ ## Possible to-dos
47
+
48
+ 1. Demo narrowing to subset of JavaScript (as with `jsep`) to make
45
49
  JTLT truly "declarative" as far as freedom from scripting
46
50
 
47
- ## Possible to-dos
51
+ 1. Support XPath and Declarative Jamilih
48
52
 
49
53
  1. Make schema-aware so that templates could target types. Most reusable
50
54
  application may be having a type-driven view of a JSON Schema instance
@@ -112,6 +116,7 @@ We'd otherwise have to refactor a great deal to maintain a buffer.
112
116
  xsl:break
113
117
  xsl:catch
114
118
  xsl:context-item
119
+ ~~"xsl:document",~~ (not yet exposed)
115
120
  xsl:evaluate
116
121
  xsl:expose
117
122
  "xsl:fallback",
@@ -139,6 +144,8 @@ We'd otherwise have to refactor a great deal to maintain a buffer.
139
144
  xsl:use-package
140
145
  xsl:where-populated
141
146
 
147
+ // Todo: Some of these may be implemented but not yet exposed
148
+
142
149
  ~~"xsl:analyze-string",~~
143
150
  ~~"xsl:apply-templates",~~
144
151
  ~~xsl:assert~~
@@ -151,7 +158,6 @@ We'd otherwise have to refactor a great deal to maintain a buffer.
151
158
  ~~"xsl:copy",~~
152
159
  ~~"xsl:copy-of",~~
153
160
  ~~"xsl:decimal-format",~~
154
- ~~"xsl:document",~~
155
161
  ~~"xsl:element",~~
156
162
  ~~"xsl:for-each",~~
157
163
  ~~"xsl:for-each-group",~~