@coldsmirk/abacus-core 0.2.0 → 0.3.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.cts CHANGED
@@ -2,9 +2,20 @@ import { InitInput } from "@gorules/zen-engine-wasm";
2
2
 
3
3
  //#region src/engine/intellisense.d.ts
4
4
  /**
5
- * Whether an expression is a standard value expression or a unary (test) expression.
5
+ * How an expression editor interprets its document:
6
+ *
7
+ * - `"standard"` — a single ZEN value expression.
8
+ * - `"unary"` — a single ZEN unary (test) expression, evaluating to a boolean.
9
+ * - `"template"` — literal text with `{{ expression }}` holes; each hole is a
10
+ * standard value expression, the surrounding text is inert.
11
+ *
12
+ * The single-expression intellisense functions here ({@link getDiagnosticsSync},
13
+ * {@link analyzeTypesSync}) treat a `"template"` argument as `"standard"` — they
14
+ * analyze one expression. Whole template documents are handled hole-by-hole by
15
+ * the template functions ({@link analyzeTemplateSync},
16
+ * {@link getTemplateDiagnosticsSync}).
6
17
  */
7
- type ExpressionMode = "standard" | "unary";
18
+ type ExpressionMode = "standard" | "unary" | "template";
8
19
  /**
9
20
  * A ZEN type descriptor — the shape the engine understands for type-aware
10
21
  * completion and validation: a primitive kind name or one of the structural
@@ -273,6 +284,22 @@ declare const CONDITION_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte
273
284
  * vocabulary (the flow editor shares it instead of re-declaring its own).
274
285
  */
275
286
  type ConditionOperator = typeof CONDITION_OPERATORS[number];
287
+ /**
288
+ * The shape of an operator's right-hand operand:
289
+ *
290
+ * - `scalar` — a single comparison value (`eq`, `gt`, `contains`, …);
291
+ * - `array` — a list of membership values (`in` / `not_in`);
292
+ * - `none` — no operand at all (`is_empty` / `is_not_empty`).
293
+ */
294
+ type ConditionOperatorArity = "scalar" | "array" | "none";
295
+ /**
296
+ * The arity of `operator`'s right-hand operand (see
297
+ * {@link ConditionOperatorArity}). One definition site next to
298
+ * {@link CONDITION_OPERATORS}, so the tree compiler's arity enforcement and a
299
+ * condition editor's operand controls classify operators identically instead of
300
+ * each keeping a drift-prone copy.
301
+ */
302
+ declare function conditionOperatorArity(operator: ConditionOperator): ConditionOperatorArity;
276
303
  /**
277
304
  * A field/operator/value condition.
278
305
  */
@@ -379,6 +406,97 @@ declare function selectBranchWith(branches: readonly ConditionBranchInput[], con
379
406
  */
380
407
  declare function selectBranch(branches: readonly ConditionBranchInput[], context: ExpressionContext): Promise<BranchSelection>;
381
408
  //#endregion
409
+ //#region src/condition/tree-types.d.ts
410
+ /**
411
+ * The visual condition **tree** model: an arbitrarily nested and/or tree of typed
412
+ * comparison rules that {@link compileConditionTree} serializes to a single ZEN
413
+ * boolean expression and {@link liftConditionTree} reconstructs from one. It is a
414
+ * distinct, self-contained shape from the compiler's flat {@link ConditionInput} —
415
+ * the tree is what a structured builder UI edits, whereas `ConditionInput` is the
416
+ * narrowed per-condition shape the compiler consumes. The two meet only at the
417
+ * leaf: a {@link ConditionTreeRule} lowers to a field {@link ConditionInput} so the
418
+ * operator vocabulary, literal encoding, and injection guard have one owner.
419
+ */
420
+ /**
421
+ * A scalar operand: the value types ZEN compares against and that survive the
422
+ * compile/lift round-trip (strings, numbers, booleans). Objects and null are not
423
+ * representable as a rule operand.
424
+ */
425
+ type ConditionScalar = string | number | boolean;
426
+ /**
427
+ * A rule's right-hand operand, whose shape follows the operator's arity:
428
+ *
429
+ * - comparison / string operators (`eq`, `gt`, `contains`, …) take a single
430
+ * {@link ConditionScalar};
431
+ * - membership operators (`in`, `not_in`) take an array of scalars;
432
+ * - the emptiness operators (`is_empty`, `is_not_empty`) take no operand and omit
433
+ * `right` entirely.
434
+ *
435
+ * The builder keeps a rule's `right` consistent with its operator's arity as the
436
+ * author switches operators.
437
+ */
438
+ type ConditionTreeValue = ConditionScalar | readonly ConditionScalar[];
439
+ /**
440
+ * The tree's operator vocabulary as a runtime list — the compiler's full
441
+ * {@link CONDITION_OPERATORS} set under the tree name. An alias, not a second
442
+ * hand-maintained list, so the tree vocabulary can never drift from the compiler's;
443
+ * it gives tree code and the builder UI one tree-named import for the operators they
444
+ * support.
445
+ */
446
+ declare const CONDITION_TREE_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "not_contains", "starts_with", "ends_with", "in", "not_in", "is_empty", "is_not_empty"];
447
+ /**
448
+ * The tree's operator type: every operator {@link compileCondition} can emit (all
449
+ * 14). The builder deliberately constructs the whole set, so there is no "the library
450
+ * compiles it but the builder cannot express it" gap. Derived from
451
+ * {@link CONDITION_TREE_OPERATORS} so the type and the runtime list share one
452
+ * definition; identical to the compiler's `ConditionOperator`.
453
+ */
454
+ type ConditionTreeOperator = typeof CONDITION_TREE_OPERATORS[number];
455
+ /**
456
+ * A leaf comparison. `left` is a field path emitted **verbatim** into ZEN (guarded
457
+ * by the same identifier-path predicate as {@link compileCondition}); `right`
458
+ * carries the operand for the operator's arity (see {@link ConditionTreeValue}) and
459
+ * is absent for the emptiness operators.
460
+ */
461
+ interface ConditionTreeRule {
462
+ kind: "rule";
463
+ left: string;
464
+ operator: ConditionTreeOperator;
465
+ right?: ConditionTreeValue;
466
+ }
467
+ /**
468
+ * A boolean group joining its `items` with `op`. Items are leaf rules or nested
469
+ * groups, making the model an arbitrarily deep and/or tree. The root of a lifted
470
+ * condition is always a group, so callers can treat {@link ConditionTreeGroup} as
471
+ * the tree's entry type.
472
+ */
473
+ interface ConditionTreeGroup {
474
+ kind: "group";
475
+ op: "and" | "or";
476
+ items: readonly ConditionTreeNode[];
477
+ }
478
+ /**
479
+ * A node in the condition tree: a nested group or a leaf rule.
480
+ */
481
+ type ConditionTreeNode = ConditionTreeGroup | ConditionTreeRule;
482
+ //#endregion
483
+ //#region src/condition/compile-tree.d.ts
484
+ /**
485
+ * Compile a condition tree to a canonical ZEN expression, or `""` when no rule in
486
+ * the tree is compilable (see the module note for the drop semantics).
487
+ */
488
+ declare function compileConditionTree(tree: ConditionTreeGroup): string;
489
+ //#endregion
490
+ //#region src/condition/lift-tree.d.ts
491
+ /**
492
+ * Lift a ZEN expression to a condition tree, or `null` when it is not in the
493
+ * canonical form {@link compileConditionTree} produces (the consumer then keeps the
494
+ * raw expression). Groups nested deeper than 64 parenthesized levels are refused as
495
+ * non-canonical rather than risking parser-stack overflow on adversarial input. The
496
+ * returned root is always a group.
497
+ */
498
+ declare function liftConditionTree(expression: string): ConditionTreeGroup | null;
499
+ //#endregion
382
500
  //#region src/engine/evaluate.d.ts
383
501
  /**
384
502
  * Evaluate a standard ZEN expression, loading the engine on first use.
@@ -491,5 +609,73 @@ declare function configureExpressionMessages({
491
609
  */
492
610
  declare function getExpressionMessages(): ExpressionMessages;
493
611
  //#endregion
494
- export { type BranchSelection, type BuiltInExpressionLocale, CONDITION_OPERATORS, type ConditionBranchInput, type ConditionGroupInput, type ConditionInput, type ConditionOperator, type ConfigureMessagesOptions, type ExpressionAnalysis, type ExpressionCompletion, type ExpressionConditionInput, type ExpressionContext, type ExpressionDiagnostic, type ExpressionEngine, ExpressionError, type ExpressionLocale, type ExpressionMessages, type ExpressionMode, ExpressionNotReadyError, type ExpressionType, type ExpressionTypeSpan, type FieldConditionInput, type LoadEngineOptions, analyzeTypes, analyzeTypesSync, compileBranch, compileCondition, compileGroup, configureEngine, configureExpressionMessages, enMessages, evaluate, evaluateSync, evaluateUnary, evaluateUnarySync, getCompletionItems, getCompletionItemsSync, getDiagnostics, getDiagnosticsSync, getEngineError, getEngineSync, getExpressionMessages, isEngineReady, loadEngine, registerExpressionLocale, resetEngine, satisfiesType, satisfiesTypeSync, selectBranch, selectBranchWith, toZenLiteral, zhCNMessages };
612
+ //#region src/engine/template.d.ts
613
+ /**
614
+ * One `{{ expression }}` hole located in a template document. `from` / `to` are
615
+ * the character offsets of the inner expression itself — the text between the
616
+ * `{{` and `}}` delimiters, delimiters excluded — so a hole's diagnostics and
617
+ * inferred-type spans map straight back onto the template with no delimiter math.
618
+ */
619
+ interface TemplateHole {
620
+ /**
621
+ * Offset of the inner expression start (immediately after `{{`).
622
+ */
623
+ from: number;
624
+ /**
625
+ * Offset of the inner expression end (immediately before `}}`).
626
+ */
627
+ to: number;
628
+ /**
629
+ * The inner expression text, i.e. `source.slice(from, to)`.
630
+ */
631
+ expression: string;
632
+ }
633
+ /**
634
+ * Extract every `{{ expression }}` hole from a template document, in source
635
+ * order. Literal text outside holes is ignored. Pure string scan — no engine
636
+ * required — matching the `@gorules/lezer-zen-template` hole grammar, so it is
637
+ * consistent with the editor's highlighting and completion gating.
638
+ */
639
+ declare function parseTemplateHoles(source: string): TemplateHole[];
640
+ /**
641
+ * The template hole whose inner expression range contains `pos` (boundaries
642
+ * included, so a caret sitting right after `{{` or right before `}}` counts as
643
+ * inside), or `null` when `pos` is in literal text. Drives the editor's
644
+ * hole-scoped completion and hover: intelligence fires inside a hole, nothing in
645
+ * the surrounding literal text.
646
+ */
647
+ declare function templateHoleAt(source: string, pos: number): TemplateHole | null;
648
+ /**
649
+ * Type-check every hole of a template against a `variables` context and merge the
650
+ * results into one {@link ExpressionAnalysis} whose spans are offset onto the
651
+ * template document. Each hole is a standard ZEN value expression; literal text
652
+ * contributes nothing. `rootKind` is the context itself (shared by every hole),
653
+ * so top-level completion works even in an empty hole.
654
+ *
655
+ * Best-effort: a hole that fails to analyze (e.g. mid-edit syntax) is skipped
656
+ * rather than discarding the spans of its siblings. Throws
657
+ * {@link ExpressionNotReadyError} if the engine has not loaded — use only behind
658
+ * a readiness gate.
659
+ */
660
+ declare function analyzeTemplateSync(variables: ExpressionType, source: string): ExpressionAnalysis;
661
+ /**
662
+ * Async {@link analyzeTemplateSync}, loading the engine on first use.
663
+ */
664
+ declare function analyzeTemplate(variables: ExpressionType, source: string): Promise<ExpressionAnalysis>;
665
+ /**
666
+ * Validate every hole of a template and return their syntax diagnostics, each
667
+ * offset onto the template document (empty holes and literal text produce none).
668
+ * The single-expression {@link getDiagnosticsSync} yields at most one diagnostic
669
+ * per hole, so a template with several broken holes surfaces each one.
670
+ *
671
+ * Throws {@link ExpressionNotReadyError} if the engine has not loaded — use only
672
+ * behind a readiness gate.
673
+ */
674
+ declare function getTemplateDiagnosticsSync(source: string): ExpressionDiagnostic[];
675
+ /**
676
+ * Async {@link getTemplateDiagnosticsSync}, loading the engine on first use.
677
+ */
678
+ declare function getTemplateDiagnostics(source: string): Promise<ExpressionDiagnostic[]>;
679
+ //#endregion
680
+ export { type BranchSelection, type BuiltInExpressionLocale, CONDITION_OPERATORS, CONDITION_TREE_OPERATORS, type ConditionBranchInput, type ConditionGroupInput, type ConditionInput, type ConditionOperator, type ConditionOperatorArity, type ConditionScalar, type ConditionTreeGroup, type ConditionTreeNode, type ConditionTreeOperator, type ConditionTreeRule, type ConditionTreeValue, type ConfigureMessagesOptions, type ExpressionAnalysis, type ExpressionCompletion, type ExpressionConditionInput, type ExpressionContext, type ExpressionDiagnostic, type ExpressionEngine, ExpressionError, type ExpressionLocale, type ExpressionMessages, type ExpressionMode, ExpressionNotReadyError, type ExpressionType, type ExpressionTypeSpan, type FieldConditionInput, type LoadEngineOptions, type TemplateHole, analyzeTemplate, analyzeTemplateSync, analyzeTypes, analyzeTypesSync, compileBranch, compileCondition, compileConditionTree, compileGroup, conditionOperatorArity, configureEngine, configureExpressionMessages, enMessages, evaluate, evaluateSync, evaluateUnary, evaluateUnarySync, getCompletionItems, getCompletionItemsSync, getDiagnostics, getDiagnosticsSync, getEngineError, getEngineSync, getExpressionMessages, getTemplateDiagnostics, getTemplateDiagnosticsSync, isEngineReady, liftConditionTree, loadEngine, parseTemplateHoles, registerExpressionLocale, resetEngine, satisfiesType, satisfiesTypeSync, selectBranch, selectBranchWith, templateHoleAt, toZenLiteral, zhCNMessages };
495
681
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -2,9 +2,20 @@ import { InitInput } from "@gorules/zen-engine-wasm";
2
2
 
3
3
  //#region src/engine/intellisense.d.ts
4
4
  /**
5
- * Whether an expression is a standard value expression or a unary (test) expression.
5
+ * How an expression editor interprets its document:
6
+ *
7
+ * - `"standard"` — a single ZEN value expression.
8
+ * - `"unary"` — a single ZEN unary (test) expression, evaluating to a boolean.
9
+ * - `"template"` — literal text with `{{ expression }}` holes; each hole is a
10
+ * standard value expression, the surrounding text is inert.
11
+ *
12
+ * The single-expression intellisense functions here ({@link getDiagnosticsSync},
13
+ * {@link analyzeTypesSync}) treat a `"template"` argument as `"standard"` — they
14
+ * analyze one expression. Whole template documents are handled hole-by-hole by
15
+ * the template functions ({@link analyzeTemplateSync},
16
+ * {@link getTemplateDiagnosticsSync}).
6
17
  */
7
- type ExpressionMode = "standard" | "unary";
18
+ type ExpressionMode = "standard" | "unary" | "template";
8
19
  /**
9
20
  * A ZEN type descriptor — the shape the engine understands for type-aware
10
21
  * completion and validation: a primitive kind name or one of the structural
@@ -273,6 +284,22 @@ declare const CONDITION_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte
273
284
  * vocabulary (the flow editor shares it instead of re-declaring its own).
274
285
  */
275
286
  type ConditionOperator = typeof CONDITION_OPERATORS[number];
287
+ /**
288
+ * The shape of an operator's right-hand operand:
289
+ *
290
+ * - `scalar` — a single comparison value (`eq`, `gt`, `contains`, …);
291
+ * - `array` — a list of membership values (`in` / `not_in`);
292
+ * - `none` — no operand at all (`is_empty` / `is_not_empty`).
293
+ */
294
+ type ConditionOperatorArity = "scalar" | "array" | "none";
295
+ /**
296
+ * The arity of `operator`'s right-hand operand (see
297
+ * {@link ConditionOperatorArity}). One definition site next to
298
+ * {@link CONDITION_OPERATORS}, so the tree compiler's arity enforcement and a
299
+ * condition editor's operand controls classify operators identically instead of
300
+ * each keeping a drift-prone copy.
301
+ */
302
+ declare function conditionOperatorArity(operator: ConditionOperator): ConditionOperatorArity;
276
303
  /**
277
304
  * A field/operator/value condition.
278
305
  */
@@ -379,6 +406,97 @@ declare function selectBranchWith(branches: readonly ConditionBranchInput[], con
379
406
  */
380
407
  declare function selectBranch(branches: readonly ConditionBranchInput[], context: ExpressionContext): Promise<BranchSelection>;
381
408
  //#endregion
409
+ //#region src/condition/tree-types.d.ts
410
+ /**
411
+ * The visual condition **tree** model: an arbitrarily nested and/or tree of typed
412
+ * comparison rules that {@link compileConditionTree} serializes to a single ZEN
413
+ * boolean expression and {@link liftConditionTree} reconstructs from one. It is a
414
+ * distinct, self-contained shape from the compiler's flat {@link ConditionInput} —
415
+ * the tree is what a structured builder UI edits, whereas `ConditionInput` is the
416
+ * narrowed per-condition shape the compiler consumes. The two meet only at the
417
+ * leaf: a {@link ConditionTreeRule} lowers to a field {@link ConditionInput} so the
418
+ * operator vocabulary, literal encoding, and injection guard have one owner.
419
+ */
420
+ /**
421
+ * A scalar operand: the value types ZEN compares against and that survive the
422
+ * compile/lift round-trip (strings, numbers, booleans). Objects and null are not
423
+ * representable as a rule operand.
424
+ */
425
+ type ConditionScalar = string | number | boolean;
426
+ /**
427
+ * A rule's right-hand operand, whose shape follows the operator's arity:
428
+ *
429
+ * - comparison / string operators (`eq`, `gt`, `contains`, …) take a single
430
+ * {@link ConditionScalar};
431
+ * - membership operators (`in`, `not_in`) take an array of scalars;
432
+ * - the emptiness operators (`is_empty`, `is_not_empty`) take no operand and omit
433
+ * `right` entirely.
434
+ *
435
+ * The builder keeps a rule's `right` consistent with its operator's arity as the
436
+ * author switches operators.
437
+ */
438
+ type ConditionTreeValue = ConditionScalar | readonly ConditionScalar[];
439
+ /**
440
+ * The tree's operator vocabulary as a runtime list — the compiler's full
441
+ * {@link CONDITION_OPERATORS} set under the tree name. An alias, not a second
442
+ * hand-maintained list, so the tree vocabulary can never drift from the compiler's;
443
+ * it gives tree code and the builder UI one tree-named import for the operators they
444
+ * support.
445
+ */
446
+ declare const CONDITION_TREE_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "not_contains", "starts_with", "ends_with", "in", "not_in", "is_empty", "is_not_empty"];
447
+ /**
448
+ * The tree's operator type: every operator {@link compileCondition} can emit (all
449
+ * 14). The builder deliberately constructs the whole set, so there is no "the library
450
+ * compiles it but the builder cannot express it" gap. Derived from
451
+ * {@link CONDITION_TREE_OPERATORS} so the type and the runtime list share one
452
+ * definition; identical to the compiler's `ConditionOperator`.
453
+ */
454
+ type ConditionTreeOperator = typeof CONDITION_TREE_OPERATORS[number];
455
+ /**
456
+ * A leaf comparison. `left` is a field path emitted **verbatim** into ZEN (guarded
457
+ * by the same identifier-path predicate as {@link compileCondition}); `right`
458
+ * carries the operand for the operator's arity (see {@link ConditionTreeValue}) and
459
+ * is absent for the emptiness operators.
460
+ */
461
+ interface ConditionTreeRule {
462
+ kind: "rule";
463
+ left: string;
464
+ operator: ConditionTreeOperator;
465
+ right?: ConditionTreeValue;
466
+ }
467
+ /**
468
+ * A boolean group joining its `items` with `op`. Items are leaf rules or nested
469
+ * groups, making the model an arbitrarily deep and/or tree. The root of a lifted
470
+ * condition is always a group, so callers can treat {@link ConditionTreeGroup} as
471
+ * the tree's entry type.
472
+ */
473
+ interface ConditionTreeGroup {
474
+ kind: "group";
475
+ op: "and" | "or";
476
+ items: readonly ConditionTreeNode[];
477
+ }
478
+ /**
479
+ * A node in the condition tree: a nested group or a leaf rule.
480
+ */
481
+ type ConditionTreeNode = ConditionTreeGroup | ConditionTreeRule;
482
+ //#endregion
483
+ //#region src/condition/compile-tree.d.ts
484
+ /**
485
+ * Compile a condition tree to a canonical ZEN expression, or `""` when no rule in
486
+ * the tree is compilable (see the module note for the drop semantics).
487
+ */
488
+ declare function compileConditionTree(tree: ConditionTreeGroup): string;
489
+ //#endregion
490
+ //#region src/condition/lift-tree.d.ts
491
+ /**
492
+ * Lift a ZEN expression to a condition tree, or `null` when it is not in the
493
+ * canonical form {@link compileConditionTree} produces (the consumer then keeps the
494
+ * raw expression). Groups nested deeper than 64 parenthesized levels are refused as
495
+ * non-canonical rather than risking parser-stack overflow on adversarial input. The
496
+ * returned root is always a group.
497
+ */
498
+ declare function liftConditionTree(expression: string): ConditionTreeGroup | null;
499
+ //#endregion
382
500
  //#region src/engine/evaluate.d.ts
383
501
  /**
384
502
  * Evaluate a standard ZEN expression, loading the engine on first use.
@@ -491,5 +609,73 @@ declare function configureExpressionMessages({
491
609
  */
492
610
  declare function getExpressionMessages(): ExpressionMessages;
493
611
  //#endregion
494
- export { type BranchSelection, type BuiltInExpressionLocale, CONDITION_OPERATORS, type ConditionBranchInput, type ConditionGroupInput, type ConditionInput, type ConditionOperator, type ConfigureMessagesOptions, type ExpressionAnalysis, type ExpressionCompletion, type ExpressionConditionInput, type ExpressionContext, type ExpressionDiagnostic, type ExpressionEngine, ExpressionError, type ExpressionLocale, type ExpressionMessages, type ExpressionMode, ExpressionNotReadyError, type ExpressionType, type ExpressionTypeSpan, type FieldConditionInput, type LoadEngineOptions, analyzeTypes, analyzeTypesSync, compileBranch, compileCondition, compileGroup, configureEngine, configureExpressionMessages, enMessages, evaluate, evaluateSync, evaluateUnary, evaluateUnarySync, getCompletionItems, getCompletionItemsSync, getDiagnostics, getDiagnosticsSync, getEngineError, getEngineSync, getExpressionMessages, isEngineReady, loadEngine, registerExpressionLocale, resetEngine, satisfiesType, satisfiesTypeSync, selectBranch, selectBranchWith, toZenLiteral, zhCNMessages };
612
+ //#region src/engine/template.d.ts
613
+ /**
614
+ * One `{{ expression }}` hole located in a template document. `from` / `to` are
615
+ * the character offsets of the inner expression itself — the text between the
616
+ * `{{` and `}}` delimiters, delimiters excluded — so a hole's diagnostics and
617
+ * inferred-type spans map straight back onto the template with no delimiter math.
618
+ */
619
+ interface TemplateHole {
620
+ /**
621
+ * Offset of the inner expression start (immediately after `{{`).
622
+ */
623
+ from: number;
624
+ /**
625
+ * Offset of the inner expression end (immediately before `}}`).
626
+ */
627
+ to: number;
628
+ /**
629
+ * The inner expression text, i.e. `source.slice(from, to)`.
630
+ */
631
+ expression: string;
632
+ }
633
+ /**
634
+ * Extract every `{{ expression }}` hole from a template document, in source
635
+ * order. Literal text outside holes is ignored. Pure string scan — no engine
636
+ * required — matching the `@gorules/lezer-zen-template` hole grammar, so it is
637
+ * consistent with the editor's highlighting and completion gating.
638
+ */
639
+ declare function parseTemplateHoles(source: string): TemplateHole[];
640
+ /**
641
+ * The template hole whose inner expression range contains `pos` (boundaries
642
+ * included, so a caret sitting right after `{{` or right before `}}` counts as
643
+ * inside), or `null` when `pos` is in literal text. Drives the editor's
644
+ * hole-scoped completion and hover: intelligence fires inside a hole, nothing in
645
+ * the surrounding literal text.
646
+ */
647
+ declare function templateHoleAt(source: string, pos: number): TemplateHole | null;
648
+ /**
649
+ * Type-check every hole of a template against a `variables` context and merge the
650
+ * results into one {@link ExpressionAnalysis} whose spans are offset onto the
651
+ * template document. Each hole is a standard ZEN value expression; literal text
652
+ * contributes nothing. `rootKind` is the context itself (shared by every hole),
653
+ * so top-level completion works even in an empty hole.
654
+ *
655
+ * Best-effort: a hole that fails to analyze (e.g. mid-edit syntax) is skipped
656
+ * rather than discarding the spans of its siblings. Throws
657
+ * {@link ExpressionNotReadyError} if the engine has not loaded — use only behind
658
+ * a readiness gate.
659
+ */
660
+ declare function analyzeTemplateSync(variables: ExpressionType, source: string): ExpressionAnalysis;
661
+ /**
662
+ * Async {@link analyzeTemplateSync}, loading the engine on first use.
663
+ */
664
+ declare function analyzeTemplate(variables: ExpressionType, source: string): Promise<ExpressionAnalysis>;
665
+ /**
666
+ * Validate every hole of a template and return their syntax diagnostics, each
667
+ * offset onto the template document (empty holes and literal text produce none).
668
+ * The single-expression {@link getDiagnosticsSync} yields at most one diagnostic
669
+ * per hole, so a template with several broken holes surfaces each one.
670
+ *
671
+ * Throws {@link ExpressionNotReadyError} if the engine has not loaded — use only
672
+ * behind a readiness gate.
673
+ */
674
+ declare function getTemplateDiagnosticsSync(source: string): ExpressionDiagnostic[];
675
+ /**
676
+ * Async {@link getTemplateDiagnosticsSync}, loading the engine on first use.
677
+ */
678
+ declare function getTemplateDiagnostics(source: string): Promise<ExpressionDiagnostic[]>;
679
+ //#endregion
680
+ export { type BranchSelection, type BuiltInExpressionLocale, CONDITION_OPERATORS, CONDITION_TREE_OPERATORS, type ConditionBranchInput, type ConditionGroupInput, type ConditionInput, type ConditionOperator, type ConditionOperatorArity, type ConditionScalar, type ConditionTreeGroup, type ConditionTreeNode, type ConditionTreeOperator, type ConditionTreeRule, type ConditionTreeValue, type ConfigureMessagesOptions, type ExpressionAnalysis, type ExpressionCompletion, type ExpressionConditionInput, type ExpressionContext, type ExpressionDiagnostic, type ExpressionEngine, ExpressionError, type ExpressionLocale, type ExpressionMessages, type ExpressionMode, ExpressionNotReadyError, type ExpressionType, type ExpressionTypeSpan, type FieldConditionInput, type LoadEngineOptions, type TemplateHole, analyzeTemplate, analyzeTemplateSync, analyzeTypes, analyzeTypesSync, compileBranch, compileCondition, compileConditionTree, compileGroup, conditionOperatorArity, configureEngine, configureExpressionMessages, enMessages, evaluate, evaluateSync, evaluateUnary, evaluateUnarySync, getCompletionItems, getCompletionItemsSync, getDiagnostics, getDiagnosticsSync, getEngineError, getEngineSync, getExpressionMessages, getTemplateDiagnostics, getTemplateDiagnosticsSync, isEngineReady, liftConditionTree, loadEngine, parseTemplateHoles, registerExpressionLocale, resetEngine, satisfiesType, satisfiesTypeSync, selectBranch, selectBranchWith, templateHoleAt, toZenLiteral, zhCNMessages };
495
681
  //# sourceMappingURL=index.d.ts.map