@azx-pbc/axiom-compiler 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +415 -2
- package/dist/article.d.ts +12 -0
- package/dist/article.d.ts.map +1 -0
- package/dist/article.js +16 -0
- package/dist/article.js.map +1 -0
- package/dist/cli/args.d.ts +101 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +158 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +33 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/compile.d.ts +2 -0
- package/dist/cli/compile.d.ts.map +1 -0
- package/dist/cli/compile.js +43 -0
- package/dist/cli/compile.js.map +1 -0
- package/dist/cli/count.d.ts +15 -0
- package/dist/cli/count.d.ts.map +1 -0
- package/dist/cli/count.js +21 -0
- package/dist/cli/count.js.map +1 -0
- package/dist/cli/dataset.d.ts +28 -0
- package/dist/cli/dataset.d.ts.map +1 -0
- package/dist/cli/dataset.js +115 -0
- package/dist/cli/dataset.js.map +1 -0
- package/dist/cli/diff.d.ts +2 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +297 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/explain.d.ts +2 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +95 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fields.d.ts +11 -0
- package/dist/cli/fields.d.ts.map +1 -0
- package/dist/cli/fields.js +13 -0
- package/dist/cli/fields.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +40 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/read.d.ts +56 -0
- package/dist/cli/read.d.ts.map +1 -0
- package/dist/cli/read.js +179 -0
- package/dist/cli/read.js.map +1 -0
- package/dist/cli/render.d.ts +58 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +422 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/schema.d.ts +28 -0
- package/dist/cli/schema.d.ts.map +1 -0
- package/dist/cli/schema.js +46 -0
- package/dist/cli/schema.js.map +1 -0
- package/dist/cli/suite-report.d.ts +18 -0
- package/dist/cli/suite-report.d.ts.map +1 -0
- package/dist/cli/suite-report.js +58 -0
- package/dist/cli/suite-report.js.map +1 -0
- package/dist/cli/suites.d.ts +25 -0
- package/dist/cli/suites.d.ts.map +1 -0
- package/dist/cli/suites.js +67 -0
- package/dist/cli/suites.js.map +1 -0
- package/dist/cli/terminal.d.ts +45 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +119 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +199 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/usage.d.ts +15 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +95 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +51 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile/artifact-members.d.ts +57 -0
- package/dist/compile/artifact-members.d.ts.map +1 -0
- package/dist/compile/artifact-members.js +130 -0
- package/dist/compile/artifact-members.js.map +1 -0
- package/dist/compile/artifact.d.ts +20 -0
- package/dist/compile/artifact.d.ts.map +1 -0
- package/dist/compile/artifact.js +87 -0
- package/dist/compile/artifact.js.map +1 -0
- package/dist/compile/compilation.d.ts +46 -0
- package/dist/compile/compilation.d.ts.map +1 -0
- package/dist/compile/compilation.js +4 -0
- package/dist/compile/compilation.js.map +1 -0
- package/dist/compile/computed.d.ts +22 -0
- package/dist/compile/computed.d.ts.map +1 -0
- package/dist/compile/computed.js +245 -0
- package/dist/compile/computed.js.map +1 -0
- package/dist/compile/condition-warnings.d.ts +12 -0
- package/dist/compile/condition-warnings.d.ts.map +1 -0
- package/dist/compile/condition-warnings.js +26 -0
- package/dist/compile/condition-warnings.js.map +1 -0
- package/dist/compile/conditions.d.ts +18 -0
- package/dist/compile/conditions.d.ts.map +1 -0
- package/dist/compile/conditions.js +22 -0
- package/dist/compile/conditions.js.map +1 -0
- package/dist/compile/cross-checks.d.ts +67 -0
- package/dist/compile/cross-checks.d.ts.map +1 -0
- package/dist/compile/cross-checks.js +238 -0
- package/dist/compile/cross-checks.js.map +1 -0
- package/dist/compile/datasets.d.ts +52 -0
- package/dist/compile/datasets.d.ts.map +1 -0
- package/dist/compile/datasets.js +183 -0
- package/dist/compile/datasets.js.map +1 -0
- package/dist/compile/dead-weight.d.ts +26 -0
- package/dist/compile/dead-weight.d.ts.map +1 -0
- package/dist/compile/dead-weight.js +244 -0
- package/dist/compile/dead-weight.js.map +1 -0
- package/dist/compile/declaration-rules.d.ts +54 -0
- package/dist/compile/declaration-rules.d.ts.map +1 -0
- package/dist/compile/declaration-rules.js +510 -0
- package/dist/compile/declaration-rules.js.map +1 -0
- package/dist/compile/declarations.d.ts +44 -0
- package/dist/compile/declarations.d.ts.map +1 -0
- package/dist/compile/declarations.js +160 -0
- package/dist/compile/declarations.js.map +1 -0
- package/dist/compile/document.d.ts +4 -0
- package/dist/compile/document.d.ts.map +1 -0
- package/dist/compile/document.js +13 -0
- package/dist/compile/document.js.map +1 -0
- package/dist/compile/expression.d.ts +38 -0
- package/dist/compile/expression.d.ts.map +1 -0
- package/dist/compile/expression.js +288 -0
- package/dist/compile/expression.js.map +1 -0
- package/dist/compile/hashes.d.ts +26 -0
- package/dist/compile/hashes.d.ts.map +1 -0
- package/dist/compile/hashes.js +96 -0
- package/dist/compile/hashes.js.map +1 -0
- package/dist/compile/item-targets.d.ts +12 -0
- package/dist/compile/item-targets.d.ts.map +1 -0
- package/dist/compile/item-targets.js +287 -0
- package/dist/compile/item-targets.js.map +1 -0
- package/dist/compile/messages.d.ts +8 -0
- package/dist/compile/messages.d.ts.map +1 -0
- package/dist/compile/messages.js +62 -0
- package/dist/compile/messages.js.map +1 -0
- package/dist/compile/option-availability.d.ts +51 -0
- package/dist/compile/option-availability.d.ts.map +1 -0
- package/dist/compile/option-availability.js +171 -0
- package/dist/compile/option-availability.js.map +1 -0
- package/dist/compile/option-codes.d.ts +27 -0
- package/dist/compile/option-codes.d.ts.map +1 -0
- package/dist/compile/option-codes.js +212 -0
- package/dist/compile/option-codes.js.map +1 -0
- package/dist/compile/references.d.ts +14 -0
- package/dist/compile/references.d.ts.map +1 -0
- package/dist/compile/references.js +126 -0
- package/dist/compile/references.js.map +1 -0
- package/dist/compile/rows-from.d.ts +27 -0
- package/dist/compile/rows-from.d.ts.map +1 -0
- package/dist/compile/rows-from.js +164 -0
- package/dist/compile/rows-from.js.map +1 -0
- package/dist/compile/rules.d.ts +58 -0
- package/dist/compile/rules.d.ts.map +1 -0
- package/dist/compile/rules.js +327 -0
- package/dist/compile/rules.js.map +1 -0
- package/dist/compile/suggestions.d.ts +52 -0
- package/dist/compile/suggestions.d.ts.map +1 -0
- package/dist/compile/suggestions.js +633 -0
- package/dist/compile/suggestions.js.map +1 -0
- package/dist/compile/targets.d.ts +22 -0
- package/dist/compile/targets.d.ts.map +1 -0
- package/dist/compile/targets.js +125 -0
- package/dist/compile/targets.js.map +1 -0
- package/dist/compile/types.d.ts +84 -0
- package/dist/compile/types.d.ts.map +1 -0
- package/dist/compile/types.js +2 -0
- package/dist/compile/types.js.map +1 -0
- package/dist/compile/warning.d.ts +45 -0
- package/dist/compile/warning.d.ts.map +1 -0
- package/dist/compile/warning.js +2 -0
- package/dist/compile/warning.js.map +1 -0
- package/dist/compile-yaml.d.ts +23 -0
- package/dist/compile-yaml.d.ts.map +1 -0
- package/dist/compile-yaml.js +30 -0
- package/dist/compile-yaml.js.map +1 -0
- package/dist/compile.d.ts +78 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +372 -0
- package/dist/compile.js.map +1 -0
- package/dist/csv/limits.d.ts +43 -0
- package/dist/csv/limits.d.ts.map +1 -0
- package/dist/csv/limits.js +51 -0
- package/dist/csv/limits.js.map +1 -0
- package/dist/csv/scalar.d.ts +33 -0
- package/dist/csv/scalar.d.ts.map +1 -0
- package/dist/csv/scalar.js +77 -0
- package/dist/csv/scalar.js.map +1 -0
- package/dist/datasets/csv.d.ts +46 -0
- package/dist/datasets/csv.d.ts.map +1 -0
- package/dist/datasets/csv.js +293 -0
- package/dist/datasets/csv.js.map +1 -0
- package/dist/datasets/declaration.d.ts +16 -0
- package/dist/datasets/declaration.d.ts.map +1 -0
- package/dist/datasets/declaration.js +104 -0
- package/dist/datasets/declaration.js.map +1 -0
- package/dist/datasets/diagnostics.d.ts +65 -0
- package/dist/datasets/diagnostics.d.ts.map +1 -0
- package/dist/datasets/diagnostics.js +2 -0
- package/dist/datasets/diagnostics.js.map +1 -0
- package/dist/datasets/diff.d.ts +46 -0
- package/dist/datasets/diff.d.ts.map +1 -0
- package/dist/datasets/diff.js +84 -0
- package/dist/datasets/diff.js.map +1 -0
- package/dist/datasets/document.d.ts +12 -0
- package/dist/datasets/document.d.ts.map +1 -0
- package/dist/datasets/document.js +382 -0
- package/dist/datasets/document.js.map +1 -0
- package/dist/datasets/index.d.ts +43 -0
- package/dist/datasets/index.d.ts.map +1 -0
- package/dist/datasets/index.js +68 -0
- package/dist/datasets/index.js.map +1 -0
- package/dist/datasets/repair.d.ts +26 -0
- package/dist/datasets/repair.d.ts.map +1 -0
- package/dist/datasets/repair.js +60 -0
- package/dist/datasets/repair.js.map +1 -0
- package/dist/document-path.d.ts +62 -0
- package/dist/document-path.d.ts.map +1 -0
- package/dist/document-path.js +200 -0
- package/dist/document-path.js.map +1 -0
- package/dist/expr/boundary.d.ts +8 -0
- package/dist/expr/boundary.d.ts.map +1 -0
- package/dist/expr/boundary.js +243 -0
- package/dist/expr/boundary.js.map +1 -0
- package/dist/expr/compile-expr.d.ts +35 -0
- package/dist/expr/compile-expr.d.ts.map +1 -0
- package/dist/expr/compile-expr.js +66 -0
- package/dist/expr/compile-expr.js.map +1 -0
- package/dist/expr/deprecation.d.ts +23 -0
- package/dist/expr/deprecation.d.ts.map +1 -0
- package/dist/expr/deprecation.js +28 -0
- package/dist/expr/deprecation.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +31 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +34 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/lexer.d.ts +49 -0
- package/dist/expr/lexer.d.ts.map +1 -0
- package/dist/expr/lexer.js +277 -0
- package/dist/expr/lexer.js.map +1 -0
- package/dist/expr/lint-warnings.d.ts +11 -0
- package/dist/expr/lint-warnings.d.ts.map +1 -0
- package/dist/expr/lint-warnings.js +20 -0
- package/dist/expr/lint-warnings.js.map +1 -0
- package/dist/expr/lint.d.ts +41 -0
- package/dist/expr/lint.d.ts.map +1 -0
- package/dist/expr/lint.js +1034 -0
- package/dist/expr/lint.js.map +1 -0
- package/dist/expr/parse/aggregates.d.ts +13 -0
- package/dist/expr/parse/aggregates.d.ts.map +1 -0
- package/dist/expr/parse/aggregates.js +48 -0
- package/dist/expr/parse/aggregates.js.map +1 -0
- package/dist/expr/parse/budget.d.ts +11 -0
- package/dist/expr/parse/budget.d.ts.map +1 -0
- package/dist/expr/parse/budget.js +57 -0
- package/dist/expr/parse/budget.js.map +1 -0
- package/dist/expr/parse/grammar.d.ts +9 -0
- package/dist/expr/parse/grammar.d.ts.map +1 -0
- package/dist/expr/parse/grammar.js +699 -0
- package/dist/expr/parse/grammar.js.map +1 -0
- package/dist/expr/parse/literals.d.ts +20 -0
- package/dist/expr/parse/literals.d.ts.map +1 -0
- package/dist/expr/parse/literals.js +132 -0
- package/dist/expr/parse/literals.js.map +1 -0
- package/dist/expr/parse/stream.d.ts +60 -0
- package/dist/expr/parse/stream.d.ts.map +1 -0
- package/dist/expr/parse/stream.js +151 -0
- package/dist/expr/parse/stream.js.map +1 -0
- package/dist/expr/parser.d.ts +45 -0
- package/dist/expr/parser.d.ts.map +1 -0
- package/dist/expr/parser.js +110 -0
- package/dist/expr/parser.js.map +1 -0
- package/dist/expr/print/spell.d.ts +78 -0
- package/dist/expr/print/spell.d.ts.map +1 -0
- package/dist/expr/print/spell.js +592 -0
- package/dist/expr/print/spell.js.map +1 -0
- package/dist/expr/print.d.ts +20 -0
- package/dist/expr/print.d.ts.map +1 -0
- package/dist/expr/print.js +102 -0
- package/dist/expr/print.js.map +1 -0
- package/dist/expr/suggest.d.ts +26 -0
- package/dist/expr/suggest.d.ts.map +1 -0
- package/dist/expr/suggest.js +77 -0
- package/dist/expr/suggest.js.map +1 -0
- package/dist/expr/typecheck/aggregates.d.ts +8 -0
- package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
- package/dist/expr/typecheck/aggregates.js +334 -0
- package/dist/expr/typecheck/aggregates.js.map +1 -0
- package/dist/expr/typecheck/arithmetic.d.ts +6 -0
- package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
- package/dist/expr/typecheck/arithmetic.js +258 -0
- package/dist/expr/typecheck/arithmetic.js.map +1 -0
- package/dist/expr/typecheck/arity.d.ts +38 -0
- package/dist/expr/typecheck/arity.d.ts.map +1 -0
- package/dist/expr/typecheck/arity.js +173 -0
- package/dist/expr/typecheck/arity.js.map +1 -0
- package/dist/expr/typecheck/calls.d.ts +6 -0
- package/dist/expr/typecheck/calls.d.ts.map +1 -0
- package/dist/expr/typecheck/calls.js +137 -0
- package/dist/expr/typecheck/calls.js.map +1 -0
- package/dist/expr/typecheck/comparison.d.ts +13 -0
- package/dist/expr/typecheck/comparison.d.ts.map +1 -0
- package/dist/expr/typecheck/comparison.js +200 -0
- package/dist/expr/typecheck/comparison.js.map +1 -0
- package/dist/expr/typecheck/compound.d.ts +24 -0
- package/dist/expr/typecheck/compound.d.ts.map +1 -0
- package/dist/expr/typecheck/compound.js +175 -0
- package/dist/expr/typecheck/compound.js.map +1 -0
- package/dist/expr/typecheck/context.d.ts +44 -0
- package/dist/expr/typecheck/context.d.ts.map +1 -0
- package/dist/expr/typecheck/context.js +2 -0
- package/dist/expr/typecheck/context.js.map +1 -0
- package/dist/expr/typecheck/datasets.d.ts +17 -0
- package/dist/expr/typecheck/datasets.d.ts.map +1 -0
- package/dist/expr/typecheck/datasets.js +136 -0
- package/dist/expr/typecheck/datasets.js.map +1 -0
- package/dist/expr/typecheck/digest.d.ts +7 -0
- package/dist/expr/typecheck/digest.d.ts.map +1 -0
- package/dist/expr/typecheck/digest.js +44 -0
- package/dist/expr/typecheck/digest.js.map +1 -0
- package/dist/expr/typecheck/fold.d.ts +41 -0
- package/dist/expr/typecheck/fold.d.ts.map +1 -0
- package/dist/expr/typecheck/fold.js +71 -0
- package/dist/expr/typecheck/fold.js.map +1 -0
- package/dist/expr/typecheck/gate-folds.d.ts +22 -0
- package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
- package/dist/expr/typecheck/gate-folds.js +40 -0
- package/dist/expr/typecheck/gate-folds.js.map +1 -0
- package/dist/expr/typecheck/guards.d.ts +6 -0
- package/dist/expr/typecheck/guards.d.ts.map +1 -0
- package/dist/expr/typecheck/guards.js +38 -0
- package/dist/expr/typecheck/guards.js.map +1 -0
- package/dist/expr/typecheck/member.d.ts +17 -0
- package/dist/expr/typecheck/member.d.ts.map +1 -0
- package/dist/expr/typecheck/member.js +46 -0
- package/dist/expr/typecheck/member.js.map +1 -0
- package/dist/expr/typecheck/money.d.ts +8 -0
- package/dist/expr/typecheck/money.d.ts.map +1 -0
- package/dist/expr/typecheck/money.js +49 -0
- package/dist/expr/typecheck/money.js.map +1 -0
- package/dist/expr/typecheck/numeric.d.ts +8 -0
- package/dist/expr/typecheck/numeric.d.ts.map +1 -0
- package/dist/expr/typecheck/numeric.js +84 -0
- package/dist/expr/typecheck/numeric.js.map +1 -0
- package/dist/expr/typecheck/operands.d.ts +27 -0
- package/dist/expr/typecheck/operands.d.ts.map +1 -0
- package/dist/expr/typecheck/operands.js +106 -0
- package/dist/expr/typecheck/operands.js.map +1 -0
- package/dist/expr/typecheck/paths.d.ts +21 -0
- package/dist/expr/typecheck/paths.d.ts.map +1 -0
- package/dist/expr/typecheck/paths.js +321 -0
- package/dist/expr/typecheck/paths.js.map +1 -0
- package/dist/expr/typecheck/records.d.ts +24 -0
- package/dist/expr/typecheck/records.d.ts.map +1 -0
- package/dist/expr/typecheck/records.js +53 -0
- package/dist/expr/typecheck/records.js.map +1 -0
- package/dist/expr/typecheck/sequences.d.ts +15 -0
- package/dist/expr/typecheck/sequences.d.ts.map +1 -0
- package/dist/expr/typecheck/sequences.js +55 -0
- package/dist/expr/typecheck/sequences.js.map +1 -0
- package/dist/expr/typecheck/strings.d.ts +8 -0
- package/dist/expr/typecheck/strings.d.ts.map +1 -0
- package/dist/expr/typecheck/strings.js +188 -0
- package/dist/expr/typecheck/strings.js.map +1 -0
- package/dist/expr/typecheck/temporal.d.ts +7 -0
- package/dist/expr/typecheck/temporal.d.ts.map +1 -0
- package/dist/expr/typecheck/temporal.js +80 -0
- package/dist/expr/typecheck/temporal.js.map +1 -0
- package/dist/expr/typecheck/types.d.ts +163 -0
- package/dist/expr/typecheck/types.d.ts.map +1 -0
- package/dist/expr/typecheck/types.js +404 -0
- package/dist/expr/typecheck/types.js.map +1 -0
- package/dist/expr/typecheck.d.ts +75 -0
- package/dist/expr/typecheck.d.ts.map +1 -0
- package/dist/expr/typecheck.js +242 -0
- package/dist/expr/typecheck.js.map +1 -0
- package/dist/expr/undecided.d.ts +13 -0
- package/dist/expr/undecided.d.ts.map +1 -0
- package/dist/expr/undecided.js +58 -0
- package/dist/expr/undecided.js.map +1 -0
- package/dist/expr/values/code-points.d.ts +13 -0
- package/dist/expr/values/code-points.d.ts.map +1 -0
- package/dist/expr/values/code-points.js +25 -0
- package/dist/expr/values/code-points.js.map +1 -0
- package/dist/expr/values/inline.d.ts +77 -0
- package/dist/expr/values/inline.d.ts.map +1 -0
- package/dist/expr/values/inline.js +404 -0
- package/dist/expr/values/inline.js.map +1 -0
- package/dist/expr/values/interval.d.ts +19 -0
- package/dist/expr/values/interval.d.ts.map +1 -0
- package/dist/expr/values/interval.js +1180 -0
- package/dist/expr/values/interval.js.map +1 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/document.d.ts +58 -0
- package/dist/ingest/document.d.ts.map +1 -0
- package/dist/ingest/document.js +83 -0
- package/dist/ingest/document.js.map +1 -0
- package/dist/ingest/yaml-document.d.ts +15 -0
- package/dist/ingest/yaml-document.d.ts.map +1 -0
- package/dist/ingest/yaml-document.js +42 -0
- package/dist/ingest/yaml-document.js.map +1 -0
- package/dist/ingest/yaml.d.ts +51 -0
- package/dist/ingest/yaml.d.ts.map +1 -0
- package/dist/ingest/yaml.js +340 -0
- package/dist/ingest/yaml.js.map +1 -0
- package/dist/layout/compile.d.ts +6 -0
- package/dist/layout/compile.d.ts.map +1 -0
- package/dist/layout/compile.js +224 -0
- package/dist/layout/compile.js.map +1 -0
- package/dist/layout/context.d.ts +12 -0
- package/dist/layout/context.d.ts.map +1 -0
- package/dist/layout/context.js +26 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/grammar.d.ts +34 -0
- package/dist/layout/grammar.d.ts.map +1 -0
- package/dist/layout/grammar.js +171 -0
- package/dist/layout/grammar.js.map +1 -0
- package/dist/layout/read.d.ts +54 -0
- package/dist/layout/read.d.ts.map +1 -0
- package/dist/layout/read.js +101 -0
- package/dist/layout/read.js.map +1 -0
- package/dist/layout/shape.d.ts +34 -0
- package/dist/layout/shape.d.ts.map +1 -0
- package/dist/layout/shape.js +149 -0
- package/dist/layout/shape.js.map +1 -0
- package/dist/messages/compile.d.ts +47 -0
- package/dist/messages/compile.d.ts.map +1 -0
- package/dist/messages/compile.js +202 -0
- package/dist/messages/compile.js.map +1 -0
- package/dist/messages/locale.d.ts +18 -0
- package/dist/messages/locale.d.ts.map +1 -0
- package/dist/messages/locale.js +33 -0
- package/dist/messages/locale.js.map +1 -0
- package/dist/messages/slots.d.ts +54 -0
- package/dist/messages/slots.d.ts.map +1 -0
- package/dist/messages/slots.js +137 -0
- package/dist/messages/slots.js.map +1 -0
- package/dist/overlay/compile-overlay.d.ts +29 -0
- package/dist/overlay/compile-overlay.d.ts.map +1 -0
- package/dist/overlay/compile-overlay.js +120 -0
- package/dist/overlay/compile-overlay.js.map +1 -0
- package/dist/overlay/compose.d.ts +26 -0
- package/dist/overlay/compose.d.ts.map +1 -0
- package/dist/overlay/compose.js +674 -0
- package/dist/overlay/compose.js.map +1 -0
- package/dist/overlay/types.d.ts +41 -0
- package/dist/overlay/types.d.ts.map +1 -0
- package/dist/overlay/types.js +2 -0
- package/dist/overlay/types.js.map +1 -0
- package/dist/publish/classify.d.ts +50 -0
- package/dist/publish/classify.d.ts.map +1 -0
- package/dist/publish/classify.js +85 -0
- package/dist/publish/classify.js.map +1 -0
- package/dist/publish/environment.d.ts +15 -0
- package/dist/publish/environment.d.ts.map +1 -0
- package/dist/publish/environment.js +2 -0
- package/dist/publish/environment.js.map +1 -0
- package/dist/publish/migrations.d.ts +108 -0
- package/dist/publish/migrations.d.ts.map +1 -0
- package/dist/publish/migrations.js +166 -0
- package/dist/publish/migrations.js.map +1 -0
- package/dist/publish/observation.d.ts +29 -0
- package/dist/publish/observation.d.ts.map +1 -0
- package/dist/publish/observation.js +43 -0
- package/dist/publish/observation.js.map +1 -0
- package/dist/publish/readiness.d.ts +197 -0
- package/dist/publish/readiness.d.ts.map +1 -0
- package/dist/publish/readiness.js +239 -0
- package/dist/publish/readiness.js.map +1 -0
- package/dist/publish/vectors.d.ts +50 -0
- package/dist/publish/vectors.d.ts.map +1 -0
- package/dist/publish/vectors.js +306 -0
- package/dist/publish/vectors.js.map +1 -0
- package/dist/publish/verify.d.ts +146 -0
- package/dist/publish/verify.d.ts.map +1 -0
- package/dist/publish/verify.js +548 -0
- package/dist/publish/verify.js.map +1 -0
- package/dist/scenarios/branch.d.ts +36 -0
- package/dist/scenarios/branch.d.ts.map +1 -0
- package/dist/scenarios/branch.js +30 -0
- package/dist/scenarios/branch.js.map +1 -0
- package/dist/scenarios/capture.d.ts +89 -0
- package/dist/scenarios/capture.d.ts.map +1 -0
- package/dist/scenarios/capture.js +443 -0
- package/dist/scenarios/capture.js.map +1 -0
- package/dist/scenarios/classifier.d.ts +20 -0
- package/dist/scenarios/classifier.d.ts.map +1 -0
- package/dist/scenarios/classifier.js +88 -0
- package/dist/scenarios/classifier.js.map +1 -0
- package/dist/scenarios/credit.d.ts +33 -0
- package/dist/scenarios/credit.d.ts.map +1 -0
- package/dist/scenarios/credit.js +330 -0
- package/dist/scenarios/credit.js.map +1 -0
- package/dist/scenarios/csv.d.ts +34 -0
- package/dist/scenarios/csv.d.ts.map +1 -0
- package/dist/scenarios/csv.js +1047 -0
- package/dist/scenarios/csv.js.map +1 -0
- package/dist/scenarios/data-identity.d.ts +39 -0
- package/dist/scenarios/data-identity.d.ts.map +1 -0
- package/dist/scenarios/data-identity.js +28 -0
- package/dist/scenarios/data-identity.js.map +1 -0
- package/dist/scenarios/document.d.ts +148 -0
- package/dist/scenarios/document.d.ts.map +1 -0
- package/dist/scenarios/document.js +513 -0
- package/dist/scenarios/document.js.map +1 -0
- package/dist/scenarios/environment.d.ts +64 -0
- package/dist/scenarios/environment.d.ts.map +1 -0
- package/dist/scenarios/environment.js +106 -0
- package/dist/scenarios/environment.js.map +1 -0
- package/dist/scenarios/evidence.d.ts +128 -0
- package/dist/scenarios/evidence.d.ts.map +1 -0
- package/dist/scenarios/evidence.js +179 -0
- package/dist/scenarios/evidence.js.map +1 -0
- package/dist/scenarios/expectations.d.ts +63 -0
- package/dist/scenarios/expectations.d.ts.map +1 -0
- package/dist/scenarios/expectations.js +490 -0
- package/dist/scenarios/expectations.js.map +1 -0
- package/dist/scenarios/references.d.ts +15 -0
- package/dist/scenarios/references.d.ts.map +1 -0
- package/dist/scenarios/references.js +239 -0
- package/dist/scenarios/references.js.map +1 -0
- package/dist/scenarios/report.d.ts +216 -0
- package/dist/scenarios/report.d.ts.map +1 -0
- package/dist/scenarios/report.js +54 -0
- package/dist/scenarios/report.js.map +1 -0
- package/dist/scenarios/runner.d.ts +55 -0
- package/dist/scenarios/runner.d.ts.map +1 -0
- package/dist/scenarios/runner.js +205 -0
- package/dist/scenarios/runner.js.map +1 -0
- package/dist/scenarios/vocabulary.d.ts +19 -0
- package/dist/scenarios/vocabulary.d.ts.map +1 -0
- package/dist/scenarios/vocabulary.js +56 -0
- package/dist/scenarios/vocabulary.js.map +1 -0
- package/dist/schema/catalogue.d.ts +54 -0
- package/dist/schema/catalogue.d.ts.map +1 -0
- package/dist/schema/catalogue.js +221 -0
- package/dist/schema/catalogue.js.map +1 -0
- package/dist/schema/check.d.ts +22 -0
- package/dist/schema/check.d.ts.map +1 -0
- package/dist/schema/check.js +30 -0
- package/dist/schema/check.js.map +1 -0
- package/dist/schema/closed.d.ts +19 -0
- package/dist/schema/closed.d.ts.map +1 -0
- package/dist/schema/closed.js +33 -0
- package/dist/schema/closed.js.map +1 -0
- package/dist/schema/collapse.d.ts +27 -0
- package/dist/schema/collapse.d.ts.map +1 -0
- package/dist/schema/collapse.js +143 -0
- package/dist/schema/collapse.js.map +1 -0
- package/dist/schema/controls.d.ts +46 -0
- package/dist/schema/controls.d.ts.map +1 -0
- package/dist/schema/controls.js +75 -0
- package/dist/schema/controls.js.map +1 -0
- package/dist/schema/dataset-declaration.d.ts +11 -0
- package/dist/schema/dataset-declaration.d.ts.map +1 -0
- package/dist/schema/dataset-declaration.js +11 -0
- package/dist/schema/dataset-declaration.js.map +1 -0
- package/dist/schema/declaration-warnings.d.ts +14 -0
- package/dist/schema/declaration-warnings.d.ts.map +1 -0
- package/dist/schema/declaration-warnings.js +77 -0
- package/dist/schema/declaration-warnings.js.map +1 -0
- package/dist/schema/declarations.d.ts +41 -0
- package/dist/schema/declarations.d.ts.map +1 -0
- package/dist/schema/declarations.js +1299 -0
- package/dist/schema/declarations.js.map +1 -0
- package/dist/schema/diagnostic.d.ts +118 -0
- package/dist/schema/diagnostic.d.ts.map +1 -0
- package/dist/schema/diagnostic.js +39 -0
- package/dist/schema/diagnostic.js.map +1 -0
- package/dist/schema/document.d.ts +93 -0
- package/dist/schema/document.d.ts.map +1 -0
- package/dist/schema/document.js +507 -0
- package/dist/schema/document.js.map +1 -0
- package/dist/schema/fields.d.ts +11 -0
- package/dist/schema/fields.d.ts.map +1 -0
- package/dist/schema/fields.js +265 -0
- package/dist/schema/fields.js.map +1 -0
- package/dist/schema/gates.d.ts +4 -0
- package/dist/schema/gates.d.ts.map +1 -0
- package/dist/schema/gates.js +68 -0
- package/dist/schema/gates.js.map +1 -0
- package/dist/schema/located.d.ts +27 -0
- package/dist/schema/located.d.ts.map +1 -0
- package/dist/schema/located.js +56 -0
- package/dist/schema/located.js.map +1 -0
- package/dist/schema/measurement.d.ts +9 -0
- package/dist/schema/measurement.d.ts.map +1 -0
- package/dist/schema/measurement.js +38 -0
- package/dist/schema/measurement.js.map +1 -0
- package/dist/schema/member-wording.d.ts +35 -0
- package/dist/schema/member-wording.d.ts.map +1 -0
- package/dist/schema/member-wording.js +286 -0
- package/dist/schema/member-wording.js.map +1 -0
- package/dist/schema/metaschema.d.ts +20 -0
- package/dist/schema/metaschema.d.ts.map +1 -0
- package/dist/schema/metaschema.js +476 -0
- package/dist/schema/metaschema.js.map +1 -0
- package/dist/schema/pointer.d.ts +31 -0
- package/dist/schema/pointer.d.ts.map +1 -0
- package/dist/schema/pointer.js +73 -0
- package/dist/schema/pointer.js.map +1 -0
- package/dist/schema/primary.d.ts +29 -0
- package/dist/schema/primary.d.ts.map +1 -0
- package/dist/schema/primary.js +48 -0
- package/dist/schema/primary.js.map +1 -0
- package/dist/schema/publish-vector.d.ts +17 -0
- package/dist/schema/publish-vector.d.ts.map +1 -0
- package/dist/schema/publish-vector.js +34 -0
- package/dist/schema/publish-vector.js.map +1 -0
- package/dist/schema/repair.d.ts +34 -0
- package/dist/schema/repair.d.ts.map +1 -0
- package/dist/schema/repair.js +163 -0
- package/dist/schema/repair.js.map +1 -0
- package/dist/schema/schema-v1.generated.d.ts +14 -0
- package/dist/schema/schema-v1.generated.d.ts.map +1 -0
- package/dist/schema/schema-v1.generated.js +7089 -0
- package/dist/schema/schema-v1.generated.js.map +1 -0
- package/dist/schema/screens.d.ts +4 -0
- package/dist/schema/screens.d.ts.map +1 -0
- package/dist/schema/screens.js +28 -0
- package/dist/schema/screens.js.map +1 -0
- package/dist/schema/test-values.d.ts +12 -0
- package/dist/schema/test-values.d.ts.map +1 -0
- package/dist/schema/test-values.js +97 -0
- package/dist/schema/test-values.js.map +1 -0
- package/dist/schema/unions.d.ts +46 -0
- package/dist/schema/unions.d.ts.map +1 -0
- package/dist/schema/unions.js +131 -0
- package/dist/schema/unions.js.map +1 -0
- package/dist/schema/validate-yaml.d.ts +14 -0
- package/dist/schema/validate-yaml.d.ts.map +1 -0
- package/dist/schema/validate-yaml.js +17 -0
- package/dist/schema/validate-yaml.js.map +1 -0
- package/dist/schema/validate.d.ts +46 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +186 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/testing.d.ts +21 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/vocabulary.d.ts +6 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +26 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +66 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.js","sourceRoot":"","sources":["../../src/layout/grammar.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAA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C,IAAgB;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAA8B,EAAE,KAAiB;IAC3E,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAgB,EAAE,OAA0B;IACzE,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import type { LayoutTone } from '@azx-pbc/axiom-runtime';\n\n/**\n * The one authority for the closed layout grammar: the ten node kinds, the members each kind\n * admits, and which kinds a node may contain.\n *\n * The metaschema closes the same shape for a wire document and a generated drift test compares\n * the two member lists, so a kind or member added to only one place fails a gate. The compiler\n * reads this table to narrow a validated document; no second list of layout members exists.\n */\n\n/** Every node kind the grammar admits, `MODEL-3.1.1`. */\nexport const LAYOUT_KINDS = [\n 'section',\n 'group',\n 'wizard',\n 'step',\n 'field',\n 'heading',\n 'callout',\n 'divider',\n 'sop_block',\n 'summary_card',\n] as const;\n\n/** One node kind of the closed layout grammar. */\nexport type LayoutKind = (typeof LAYOUT_KINDS)[number];\n\n/** The emphasis vocabulary a callout states. */\nexport const LAYOUT_TONES: readonly LayoutTone[] = ['info', 'warning', 'danger', 'success'];\n\n/** The kinds a top-level layout array may hold. A `step` lives only inside a `wizard`. */\nconst TOP_LEVEL_KINDS: readonly LayoutKind[] = [\n 'section',\n 'group',\n 'wizard',\n 'field',\n 'heading',\n 'callout',\n 'divider',\n 'sop_block',\n 'summary_card',\n];\n\n/** The kinds one node may hold directly. A leaf holds none. */\nconst CHILD_KINDS: Readonly<Record<LayoutKind, readonly LayoutKind[]>> = {\n section: [\n 'section',\n 'group',\n 'field',\n 'heading',\n 'callout',\n 'divider',\n 'sop_block',\n 'summary_card',\n ],\n group: [\n 'section',\n 'group',\n 'field',\n 'heading',\n 'callout',\n 'divider',\n 'sop_block',\n 'summary_card',\n ],\n wizard: ['step'],\n step: ['section', 'group', 'field', 'heading', 'callout', 'divider', 'sop_block', 'summary_card'],\n field: [],\n heading: [],\n callout: [],\n divider: [],\n sop_block: [],\n summary_card: [],\n};\n\n/** Every member a layout node of any kind may state. A drift gate compares this with the metaschema. */\nexport const LAYOUT_MEMBERS: readonly string[] = [\n 'kind',\n 'sectionId',\n 'titleKey',\n 'descriptionKey',\n 'textKey',\n 'visibleWhen',\n 'params',\n 'readouts',\n 'fields',\n 'children',\n 'columns',\n 'collapsible',\n 'defaultExpanded',\n 'hideWhenEmpty',\n 'stepId',\n 'gateId',\n 'fieldId',\n 'colSpan',\n 'tone',\n];\n\n/** The members one kind admits, `kind` included. */\nconst MEMBERS_BY_KIND: Readonly<Record<LayoutKind, readonly string[]>> = {\n section: [\n 'kind',\n 'sectionId',\n 'titleKey',\n 'descriptionKey',\n 'columns',\n 'collapsible',\n 'defaultExpanded',\n 'hideWhenEmpty',\n 'visibleWhen',\n 'children',\n ],\n group: [\n 'kind',\n 'titleKey',\n 'descriptionKey',\n 'columns',\n 'collapsible',\n 'defaultExpanded',\n 'hideWhenEmpty',\n 'children',\n ],\n wizard: ['kind', 'children'],\n step: [\n 'kind',\n 'stepId',\n 'titleKey',\n 'descriptionKey',\n 'sectionId',\n 'gateId',\n 'hideWhenEmpty',\n 'columns',\n 'visibleWhen',\n 'children',\n ],\n field: ['kind', 'fieldId', 'colSpan'],\n heading: ['kind', 'titleKey', 'textKey'],\n callout: ['kind', 'visibleWhen', 'titleKey', 'textKey', 'tone', 'params'],\n divider: ['kind'],\n sop_block: ['kind', 'sectionId', 'titleKey', 'textKey', 'params', 'visibleWhen'],\n summary_card: [\n 'kind',\n 'sectionId',\n 'titleKey',\n 'textKey',\n 'params',\n 'readouts',\n 'fields',\n 'visibleWhen',\n ],\n};\n\n/** Whether a document's spelling names a kind of the closed grammar. */\nexport function isLayoutKind(value: string): value is LayoutKind {\n return (LAYOUT_KINDS as readonly string[]).includes(value);\n}\n\n/** Whether a document's spelling names a callout tone the contract admits. */\nexport function isLayoutTone(value: string): value is LayoutTone {\n return (LAYOUT_TONES as readonly string[]).includes(value);\n}\n\n/** Whether a node of this kind holds children at all. */\nexport function admitsChildren(kind: LayoutKind): boolean {\n return CHILD_KINDS[kind].length > 0;\n}\n\n/**\n * Whether `child` may appear directly inside `parent`. `undefined` is the document's layout\n * root, which admits every kind but a step.\n */\nexport function admitsChild(parent: LayoutKind | undefined, child: LayoutKind): boolean {\n return parent === undefined\n ? TOP_LEVEL_KINDS.includes(child)\n : CHILD_KINDS[parent].includes(child);\n}\n\n/**\n * The members of a node of `kind` that the kind does not admit, so the caller can refuse a\n * member the metaschema closed globally but this kind has no meaning for.\n */\nexport function foreignMembers(kind: LayoutKind, members: readonly string[]): readonly string[] {\n const admitted = MEMBERS_BY_KIND[kind];\n return members.filter((member) => !admitted.includes(member));\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire read of the layout tree: the validated document's layout as a total list of raw
|
|
3
|
+
* nodes, each carrying the members it spelled and its path.
|
|
4
|
+
*
|
|
5
|
+
* The read never throws and never casts a spelling to a kind. The closed metaschema has
|
|
6
|
+
* already admitted the value, so a kind outside the grammar is evidence for a
|
|
7
|
+
* `LAYOUT_STRUCTURE` diagnostic rather than a program invariant; the shape walk reads this
|
|
8
|
+
* tree, and the expression compiler narrows the members it keeps.
|
|
9
|
+
*/
|
|
10
|
+
/** One readout as the document spelled it, before its expression is compiled. */
|
|
11
|
+
export interface RawLayoutReadout {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly labelKey: string | undefined;
|
|
14
|
+
/** The authored or compiled expression slot, narrowed by the expression compiler. */
|
|
15
|
+
readonly value: unknown;
|
|
16
|
+
}
|
|
17
|
+
/** One layout node as the document spelled it, with every member the walk may inspect. */
|
|
18
|
+
export interface RawLayoutNode {
|
|
19
|
+
readonly path: string;
|
|
20
|
+
/** The spelled `kind`, which may name no grammar kind. */
|
|
21
|
+
readonly kind: string;
|
|
22
|
+
/** The member names the node actually states, so an illegal member is visible to the shape walk. */
|
|
23
|
+
readonly members: readonly string[];
|
|
24
|
+
readonly sectionId: string | undefined;
|
|
25
|
+
readonly titleKey: string | undefined;
|
|
26
|
+
readonly descriptionKey: string | undefined;
|
|
27
|
+
readonly textKey: string | undefined;
|
|
28
|
+
readonly stepId: string | undefined;
|
|
29
|
+
readonly gateId: string | undefined;
|
|
30
|
+
readonly fieldId: string | undefined;
|
|
31
|
+
readonly tone: string | undefined;
|
|
32
|
+
readonly columns: number | undefined;
|
|
33
|
+
readonly colSpan: number | undefined;
|
|
34
|
+
readonly collapsible: boolean | undefined;
|
|
35
|
+
readonly defaultExpanded: boolean | undefined;
|
|
36
|
+
readonly hideWhenEmpty: boolean | undefined;
|
|
37
|
+
readonly visibleWhen: unknown;
|
|
38
|
+
readonly params: Readonly<Record<string, unknown>> | undefined;
|
|
39
|
+
readonly readouts: readonly RawLayoutReadout[];
|
|
40
|
+
readonly fields: readonly string[];
|
|
41
|
+
readonly children: readonly RawLayoutNode[];
|
|
42
|
+
}
|
|
43
|
+
/** The document's layout as a raw tree, in declaration order. */
|
|
44
|
+
export declare function readLayout(document: Record<string, unknown>): readonly RawLayoutNode[];
|
|
45
|
+
/**
|
|
46
|
+
* Every layout target the step folds may address, at any nesting depth.
|
|
47
|
+
*
|
|
48
|
+
* The runtime's fold index treats a wizard `step` and a `section` with an anchor as fold
|
|
49
|
+
* targets (`eval/rule/steps.ts`), so a compile check that admitted only steps would refuse a
|
|
50
|
+
* section fold the engine answers. Both are collected here; a section without a `sectionId`
|
|
51
|
+
* is not addressable and contributes nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function declaredFoldTargets(layout: readonly RawLayoutNode[]): ReadonlySet<string>;
|
|
54
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/layout/read.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oGAAoG;IACpG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAC/D,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAqFD,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,aAAa,EAAE,CAItF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAazF"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { isRecord } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { listAt, textAt } from '../compile/document.js';
|
|
3
|
+
function numberAt(record, key) {
|
|
4
|
+
const value = record[key];
|
|
5
|
+
return typeof value === 'number' && Number.isSafeInteger(value) ? value : undefined;
|
|
6
|
+
}
|
|
7
|
+
function booleanAt(record, key) {
|
|
8
|
+
const value = record[key];
|
|
9
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
10
|
+
}
|
|
11
|
+
function recordAt(record, key) {
|
|
12
|
+
const value = record[key];
|
|
13
|
+
return isRecord(value) ? value : undefined;
|
|
14
|
+
}
|
|
15
|
+
function textListAt(record, key) {
|
|
16
|
+
return listAt(record, key).filter((entry) => typeof entry === 'string');
|
|
17
|
+
}
|
|
18
|
+
function readReadout(value, path) {
|
|
19
|
+
if (!isRecord(value))
|
|
20
|
+
return { path, labelKey: undefined, value: undefined };
|
|
21
|
+
return { path, labelKey: textAt(value, 'labelKey'), value: value['value'] };
|
|
22
|
+
}
|
|
23
|
+
function readNode(value, path) {
|
|
24
|
+
if (!isRecord(value)) {
|
|
25
|
+
return {
|
|
26
|
+
path,
|
|
27
|
+
kind: typeof value === 'string' ? value : '',
|
|
28
|
+
members: [],
|
|
29
|
+
sectionId: undefined,
|
|
30
|
+
titleKey: undefined,
|
|
31
|
+
descriptionKey: undefined,
|
|
32
|
+
textKey: undefined,
|
|
33
|
+
stepId: undefined,
|
|
34
|
+
gateId: undefined,
|
|
35
|
+
fieldId: undefined,
|
|
36
|
+
tone: undefined,
|
|
37
|
+
columns: undefined,
|
|
38
|
+
colSpan: undefined,
|
|
39
|
+
collapsible: undefined,
|
|
40
|
+
defaultExpanded: undefined,
|
|
41
|
+
hideWhenEmpty: undefined,
|
|
42
|
+
visibleWhen: undefined,
|
|
43
|
+
params: undefined,
|
|
44
|
+
readouts: [],
|
|
45
|
+
fields: [],
|
|
46
|
+
children: [],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const children = listAt(value, 'children').map((child, index) => readNode(child, `${path}.children[${String(index)}]`));
|
|
50
|
+
return {
|
|
51
|
+
path,
|
|
52
|
+
kind: textAt(value, 'kind') ?? '',
|
|
53
|
+
members: Object.keys(value),
|
|
54
|
+
sectionId: textAt(value, 'sectionId'),
|
|
55
|
+
titleKey: textAt(value, 'titleKey'),
|
|
56
|
+
descriptionKey: textAt(value, 'descriptionKey'),
|
|
57
|
+
textKey: textAt(value, 'textKey'),
|
|
58
|
+
stepId: textAt(value, 'stepId'),
|
|
59
|
+
gateId: textAt(value, 'gateId'),
|
|
60
|
+
fieldId: textAt(value, 'fieldId'),
|
|
61
|
+
tone: textAt(value, 'tone'),
|
|
62
|
+
columns: numberAt(value, 'columns'),
|
|
63
|
+
colSpan: numberAt(value, 'colSpan'),
|
|
64
|
+
collapsible: booleanAt(value, 'collapsible'),
|
|
65
|
+
defaultExpanded: booleanAt(value, 'defaultExpanded'),
|
|
66
|
+
hideWhenEmpty: booleanAt(value, 'hideWhenEmpty'),
|
|
67
|
+
visibleWhen: value['visibleWhen'],
|
|
68
|
+
params: recordAt(value, 'params'),
|
|
69
|
+
readouts: listAt(value, 'readouts').map((readout, index) => readReadout(readout, `${path}.readouts[${String(index)}]`)),
|
|
70
|
+
fields: textListAt(value, 'fields'),
|
|
71
|
+
children,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** The document's layout as a raw tree, in declaration order. */
|
|
75
|
+
export function readLayout(document) {
|
|
76
|
+
return listAt(document, 'layout').map((node, index) => readNode(node, `$.layout[${String(index)}]`));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Every layout target the step folds may address, at any nesting depth.
|
|
80
|
+
*
|
|
81
|
+
* The runtime's fold index treats a wizard `step` and a `section` with an anchor as fold
|
|
82
|
+
* targets (`eval/rule/steps.ts`), so a compile check that admitted only steps would refuse a
|
|
83
|
+
* section fold the engine answers. Both are collected here; a section without a `sectionId`
|
|
84
|
+
* is not addressable and contributes nothing.
|
|
85
|
+
*/
|
|
86
|
+
export function declaredFoldTargets(layout) {
|
|
87
|
+
const targets = new Set();
|
|
88
|
+
const visit = (nodes) => {
|
|
89
|
+
for (const node of nodes) {
|
|
90
|
+
if (node.kind === 'step' && node.stepId !== undefined)
|
|
91
|
+
targets.add(node.stepId);
|
|
92
|
+
if (node.kind === 'section' && node.sectionId !== undefined) {
|
|
93
|
+
targets.add(node.sectionId);
|
|
94
|
+
}
|
|
95
|
+
visit(node.children);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
visit(layout);
|
|
99
|
+
return targets;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 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C,IAAI,EAAE,YAAY,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAC7C,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAgC;IAClE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,KAAK,GAAG,CAAC,KAA+B,EAAQ,EAAE;QACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChF,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,MAAM,CAAC,CAAC;IACd,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { isRecord } from '@azx-pbc/axiom-runtime';\nimport { listAt, textAt } from '../compile/document.js';\n\n/**\n * The wire read of the layout tree: the validated document's layout as a total list of raw\n * nodes, each carrying the members it spelled and its path.\n *\n * The read never throws and never casts a spelling to a kind. The closed metaschema has\n * already admitted the value, so a kind outside the grammar is evidence for a\n * `LAYOUT_STRUCTURE` diagnostic rather than a program invariant; the shape walk reads this\n * tree, and the expression compiler narrows the members it keeps.\n */\n\n/** One readout as the document spelled it, before its expression is compiled. */\nexport interface RawLayoutReadout {\n readonly path: string;\n readonly labelKey: string | undefined;\n /** The authored or compiled expression slot, narrowed by the expression compiler. */\n readonly value: unknown;\n}\n\n/** One layout node as the document spelled it, with every member the walk may inspect. */\nexport interface RawLayoutNode {\n readonly path: string;\n /** The spelled `kind`, which may name no grammar kind. */\n readonly kind: string;\n /** The member names the node actually states, so an illegal member is visible to the shape walk. */\n readonly members: readonly string[];\n readonly sectionId: string | undefined;\n readonly titleKey: string | undefined;\n readonly descriptionKey: string | undefined;\n readonly textKey: string | undefined;\n readonly stepId: string | undefined;\n readonly gateId: string | undefined;\n readonly fieldId: string | undefined;\n readonly tone: string | undefined;\n readonly columns: number | undefined;\n readonly colSpan: number | undefined;\n readonly collapsible: boolean | undefined;\n readonly defaultExpanded: boolean | undefined;\n readonly hideWhenEmpty: boolean | undefined;\n readonly visibleWhen: unknown;\n readonly params: Readonly<Record<string, unknown>> | undefined;\n readonly readouts: readonly RawLayoutReadout[];\n readonly fields: readonly string[];\n readonly children: readonly RawLayoutNode[];\n}\n\nfunction numberAt(record: Record<string, unknown>, key: string): number | undefined {\n const value = record[key];\n return typeof value === 'number' && Number.isSafeInteger(value) ? value : undefined;\n}\n\nfunction booleanAt(record: Record<string, unknown>, key: string): boolean | undefined {\n const value = record[key];\n return typeof value === 'boolean' ? value : undefined;\n}\n\nfunction recordAt(\n record: Record<string, unknown>,\n key: string,\n): Readonly<Record<string, unknown>> | undefined {\n const value = record[key];\n return isRecord(value) ? value : undefined;\n}\n\nfunction textListAt(record: Record<string, unknown>, key: string): readonly string[] {\n return listAt(record, key).filter((entry): entry is string => typeof entry === 'string');\n}\n\nfunction readReadout(value: unknown, path: string): RawLayoutReadout {\n if (!isRecord(value)) return { path, labelKey: undefined, value: undefined };\n return { path, labelKey: textAt(value, 'labelKey'), value: value['value'] };\n}\n\nfunction readNode(value: unknown, path: string): RawLayoutNode {\n if (!isRecord(value)) {\n return {\n path,\n kind: typeof value === 'string' ? value : '',\n members: [],\n sectionId: undefined,\n titleKey: undefined,\n descriptionKey: undefined,\n textKey: undefined,\n stepId: undefined,\n gateId: undefined,\n fieldId: undefined,\n tone: undefined,\n columns: undefined,\n colSpan: undefined,\n collapsible: undefined,\n defaultExpanded: undefined,\n hideWhenEmpty: undefined,\n visibleWhen: undefined,\n params: undefined,\n readouts: [],\n fields: [],\n children: [],\n };\n }\n const children = listAt(value, 'children').map((child, index) =>\n readNode(child, `${path}.children[${String(index)}]`),\n );\n return {\n path,\n kind: textAt(value, 'kind') ?? '',\n members: Object.keys(value),\n sectionId: textAt(value, 'sectionId'),\n titleKey: textAt(value, 'titleKey'),\n descriptionKey: textAt(value, 'descriptionKey'),\n textKey: textAt(value, 'textKey'),\n stepId: textAt(value, 'stepId'),\n gateId: textAt(value, 'gateId'),\n fieldId: textAt(value, 'fieldId'),\n tone: textAt(value, 'tone'),\n columns: numberAt(value, 'columns'),\n colSpan: numberAt(value, 'colSpan'),\n collapsible: booleanAt(value, 'collapsible'),\n defaultExpanded: booleanAt(value, 'defaultExpanded'),\n hideWhenEmpty: booleanAt(value, 'hideWhenEmpty'),\n visibleWhen: value['visibleWhen'],\n params: recordAt(value, 'params'),\n readouts: listAt(value, 'readouts').map((readout, index) =>\n readReadout(readout, `${path}.readouts[${String(index)}]`),\n ),\n fields: textListAt(value, 'fields'),\n children,\n };\n}\n\n/** The document's layout as a raw tree, in declaration order. */\nexport function readLayout(document: Record<string, unknown>): readonly RawLayoutNode[] {\n return listAt(document, 'layout').map((node, index) =>\n readNode(node, `$.layout[${String(index)}]`),\n );\n}\n\n/**\n * Every layout target the step folds may address, at any nesting depth.\n *\n * The runtime's fold index treats a wizard `step` and a `section` with an anchor as fold\n * targets (`eval/rule/steps.ts`), so a compile check that admitted only steps would refuse a\n * section fold the engine answers. Both are collected here; a section without a `sectionId`\n * is not addressable and contributes nothing.\n */\nexport function declaredFoldTargets(layout: readonly RawLayoutNode[]): ReadonlySet<string> {\n const targets = new Set<string>();\n const visit = (nodes: readonly RawLayoutNode[]): void => {\n for (const node of nodes) {\n if (node.kind === 'step' && node.stepId !== undefined) targets.add(node.stepId);\n if (node.kind === 'section' && node.sectionId !== undefined) {\n targets.add(node.sectionId);\n }\n visit(node.children);\n }\n };\n visit(layout);\n return targets;\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SchemaDiagnostic } from '../schema/diagnostic.js';
|
|
2
|
+
import type { RawLayoutNode } from './read.js';
|
|
3
|
+
/**
|
|
4
|
+
* C11 and every structural check over the layout grammar, `spec/semantics/model-v1.md`
|
|
5
|
+
* section 3.
|
|
6
|
+
*
|
|
7
|
+
* The metaschema closes each node's shape; this walk states what JSON Schema cannot: which
|
|
8
|
+
* kind may hold which, that an interactive field is placed once and a step id is unique, that a
|
|
9
|
+
* `colSpan` fits its parent, that a wizard is declared once at the top level, that a gate reference
|
|
10
|
+
* and a section anchor resolve, and that `visibleWhen` reaches only a section, chrome or an
|
|
11
|
+
* instruction-only step (C11). A section is admitted because its fields stay data: the value and
|
|
12
|
+
* its submission policy are unchanged, and only the painted page and the readiness fold treat a
|
|
13
|
+
* hidden section's fields as off-screen.
|
|
14
|
+
*
|
|
15
|
+
* It is exported because the authoring store needs the same verdict before a document is
|
|
16
|
+
* compiled; the compiler calls it too, so there is one authority. Every refusal is a
|
|
17
|
+
* `LAYOUT_STRUCTURE` diagnostic — never a throw — so one compile names every structural
|
|
18
|
+
* reason instead of the first.
|
|
19
|
+
*/
|
|
20
|
+
/** What the layout walk needs from the document around it. */
|
|
21
|
+
export interface LayoutShapeContext {
|
|
22
|
+
/** Every declared `fieldId`, at any nesting level. */
|
|
23
|
+
readonly fieldIds: ReadonlySet<string>;
|
|
24
|
+
/** Every `annotations.sectionId` a declared field states. */
|
|
25
|
+
readonly sectionIds: ReadonlySet<string>;
|
|
26
|
+
/** Every declared gate rule's `ruleId`, so a `step.gateId` can resolve. */
|
|
27
|
+
readonly gateIds: ReadonlySet<string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Every structural refusal in one layout tree, in declaration order. The result is empty for
|
|
31
|
+
* a legal layout, and containing one entry per defect otherwise.
|
|
32
|
+
*/
|
|
33
|
+
export declare function layoutShapeErrors(layout: readonly RawLayoutNode[], context: LayoutShapeContext): readonly SchemaDiagnostic[];
|
|
34
|
+
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/layout/shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AASnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AAEH,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AAuCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,OAAO,EAAE,kBAAkB,GAC1B,SAAS,gBAAgB,EAAE,CAwK7B"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { admitsChild, admitsChildren, foreignMembers, isLayoutKind, isLayoutTone, } from './grammar.js';
|
|
2
|
+
/** The kinds a node may anchor a review section on. */
|
|
3
|
+
const ANCHOR_KINDS = ['section', 'step', 'sop_block', 'summary_card'];
|
|
4
|
+
/** The kinds C11 admits a `visibleWhen` on unconditionally. */
|
|
5
|
+
const CHROME_KINDS = ['section', 'callout', 'sop_block', 'summary_card'];
|
|
6
|
+
function containmentDetail(parent, child) {
|
|
7
|
+
if (child === 'step')
|
|
8
|
+
return 'a step is only a direct child of a wizard';
|
|
9
|
+
if (parent === 'wizard')
|
|
10
|
+
return `a wizard holds only steps; move this \`${child}\` into a step`;
|
|
11
|
+
if (child === 'wizard') {
|
|
12
|
+
return parent === undefined
|
|
13
|
+
? 'a schema declares at most one wizard'
|
|
14
|
+
: `a wizard is declared at the top level, not inside a \`${parent}\`; move it out`;
|
|
15
|
+
}
|
|
16
|
+
return `a \`${parent ?? 'top-level layout'}\` does not admit a \`${child}\` child`;
|
|
17
|
+
}
|
|
18
|
+
/** Whether any descendant of this node places an interactive field. */
|
|
19
|
+
function hasFieldDescendant(node) {
|
|
20
|
+
return node.children.some((child) => child.kind === 'field' || hasFieldDescendant(child));
|
|
21
|
+
}
|
|
22
|
+
/** The C11 refusal a `visibleWhen` on this node earns, or `undefined` when it is permitted. */
|
|
23
|
+
function visibleWhenRefusal(node, kind) {
|
|
24
|
+
if (CHROME_KINDS.includes(kind))
|
|
25
|
+
return undefined;
|
|
26
|
+
if (kind !== 'step') {
|
|
27
|
+
return `\`visibleWhen\` is permitted only on a section, callout, sop_block, summary_card or an instruction-only step; a \`${kind}\` cannot be hidden conditionally — move the fields into a section and hide that section, or remove \`visibleWhen\` and hide each field with a \`visible\` rule`;
|
|
28
|
+
}
|
|
29
|
+
if (node.gateId !== undefined) {
|
|
30
|
+
return '`visibleWhen` is forbidden on a step carrying a `gateId`; a presentation condition must never hide a gate-bearing step — remove the `gateId`, or remove `visibleWhen` and let the gate decide whether the step is open';
|
|
31
|
+
}
|
|
32
|
+
if (hasFieldDescendant(node)) {
|
|
33
|
+
return '`visibleWhen` is forbidden on a step that places an interactive field because a presentation condition must never hide an interactive field; move the fields into a section and hide that section, or remove `visibleWhen` and hide each field with a `visible` rule';
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Every structural refusal in one layout tree, in declaration order. The result is empty for
|
|
39
|
+
* a legal layout, and containing one entry per defect otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export function layoutShapeErrors(layout, context) {
|
|
42
|
+
const diagnostics = [];
|
|
43
|
+
const placedFields = new Map();
|
|
44
|
+
const stepIds = new Map();
|
|
45
|
+
const anchors = new Map();
|
|
46
|
+
let wizardPath;
|
|
47
|
+
const refuse = (path, reason, detail, repairStated = false) => {
|
|
48
|
+
diagnostics.push({
|
|
49
|
+
code: 'LAYOUT_STRUCTURE',
|
|
50
|
+
path,
|
|
51
|
+
detail,
|
|
52
|
+
layoutReason: reason,
|
|
53
|
+
...(repairStated ? { repairStated: true } : {}),
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const visit = (node, parent, parentColumns) => {
|
|
57
|
+
if (!isLayoutKind(node.kind)) {
|
|
58
|
+
refuse(node.path, 'unknown_kind', `\`${node.kind}\` is not a layout kind; the grammar admits section, group, wizard, step, field, heading, callout, divider, sop_block and summary_card`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const kind = node.kind;
|
|
62
|
+
if (!admitsChild(parent, kind))
|
|
63
|
+
refuse(node.path, 'containment', containmentDetail(parent, kind));
|
|
64
|
+
if (kind === 'wizard') {
|
|
65
|
+
if (wizardPath === undefined)
|
|
66
|
+
wizardPath = node.path;
|
|
67
|
+
else {
|
|
68
|
+
refuse(node.path, 'containment', `a schema declares at most one wizard; the first is at ${wizardPath}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// `visibleWhen` placement is C11's alone: reporting it here as a foreign member as well
|
|
72
|
+
// would state one defect twice and make the count of C11 refusals depend on the kind table.
|
|
73
|
+
for (const member of foreignMembers(kind, node.members.filter((member) => member !== 'visibleWhen'))) {
|
|
74
|
+
refuse(node.path, 'foreign_member', `a \`${kind}\` does not admit \`${member}\``);
|
|
75
|
+
}
|
|
76
|
+
if (kind === 'callout' && node.tone !== undefined && !isLayoutTone(node.tone)) {
|
|
77
|
+
refuse(node.path, 'tone', `\`${node.tone}\` is not a callout tone; the vocabulary is info, warning, danger and success`);
|
|
78
|
+
}
|
|
79
|
+
if (kind === 'step' && node.stepId !== undefined) {
|
|
80
|
+
const first = stepIds.get(node.stepId);
|
|
81
|
+
if (first === undefined)
|
|
82
|
+
stepIds.set(node.stepId, node.path);
|
|
83
|
+
else {
|
|
84
|
+
refuse(`${node.path}.stepId`, 'duplicate_step', `stepId \`${node.stepId}\` is declared more than once (first at ${first}); a layout node id is unique across the document`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (kind === 'field') {
|
|
88
|
+
const fieldId = node.fieldId;
|
|
89
|
+
if (fieldId === undefined) {
|
|
90
|
+
refuse(node.path, 'field_missing', 'a field node names the field it places in `fieldId`');
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (!context.fieldIds.has(fieldId)) {
|
|
94
|
+
refuse(node.path, 'field_missing', `field \`${fieldId}\` is not declared by this document; a field leaf places a declared field`);
|
|
95
|
+
}
|
|
96
|
+
const first = placedFields.get(fieldId);
|
|
97
|
+
if (first === undefined)
|
|
98
|
+
placedFields.set(fieldId, node.path);
|
|
99
|
+
else {
|
|
100
|
+
refuse(node.path, 'duplicate_field', `field \`${fieldId}\` is placed more than once (first at ${first}); an interactive field has one placement`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const colSpan = node.colSpan ?? 1;
|
|
104
|
+
if (colSpan > parentColumns) {
|
|
105
|
+
refuse(node.path, 'columns', `colSpan ${String(colSpan)} exceeds the ${String(parentColumns)} column${parentColumns === 1 ? '' : 's'} its parent lays out; a field spans at most its parent's \`columns\` (the top level is 1 column)`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (node.sectionId !== undefined && ANCHOR_KINDS.includes(kind)) {
|
|
109
|
+
const anchorPath = `${node.path}.sectionId`;
|
|
110
|
+
if (!context.sectionIds.has(node.sectionId)) {
|
|
111
|
+
refuse(anchorPath, 'section_anchor', `sectionId "${node.sectionId}" names no field annotation section; declare that section on a field or remove the layout anchor.`);
|
|
112
|
+
}
|
|
113
|
+
// Only a `section` node's anchor is unique: a summary card and an SOP block may both
|
|
114
|
+
// belong to the same review section, which is what makes several chrome nodes share it.
|
|
115
|
+
if (kind === 'section') {
|
|
116
|
+
const first = anchors.get(node.sectionId);
|
|
117
|
+
if (first === undefined)
|
|
118
|
+
anchors.set(node.sectionId, node.path);
|
|
119
|
+
else {
|
|
120
|
+
refuse(anchorPath, 'section_anchor', `sectionId "${node.sectionId}" is already anchored at ${first}; an anchor is unique across layout \`section\` nodes`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (kind === 'step' && node.gateId !== undefined && !context.gateIds.has(node.gateId)) {
|
|
125
|
+
refuse(node.path, 'gate_reference', `gateId \`${node.gateId}\` names no declared gate rule; declare that gate or remove the step's \`gateId\``);
|
|
126
|
+
}
|
|
127
|
+
if (kind === 'summary_card') {
|
|
128
|
+
for (const fieldId of node.fields) {
|
|
129
|
+
if (context.fieldIds.has(fieldId))
|
|
130
|
+
continue;
|
|
131
|
+
refuse(node.path, 'summary_field', `summary card field \`${fieldId}\` is not declared by this document; a summary card lists declared fields read-only`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (node.visibleWhen !== undefined) {
|
|
135
|
+
const refusal = visibleWhenRefusal(node, kind);
|
|
136
|
+
if (refusal !== undefined)
|
|
137
|
+
refuse(`${node.path}.visibleWhen`, 'c11', refusal, true);
|
|
138
|
+
}
|
|
139
|
+
const columns = kind === 'section' || kind === 'group' || kind === 'step' ? (node.columns ?? 1) : 1;
|
|
140
|
+
if (admitsChildren(kind)) {
|
|
141
|
+
for (const child of node.children)
|
|
142
|
+
visit(child, kind, columns);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
for (const node of layout)
|
|
146
|
+
visit(node, undefined, 1);
|
|
147
|
+
return diagnostics;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"","sources":["../../src/layout/shape.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,cAAc,CAAC;AA+BtB,uDAAuD;AAC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,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACtF,CAAC;QAED,MAAM,OAAO,GACX,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;gBAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,MAAM;QAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import type { LayoutShapeReason, SchemaDiagnostic } from '../schema/diagnostic.js';\nimport type { LayoutKind } from './grammar.js';\nimport {\n admitsChild,\n admitsChildren,\n foreignMembers,\n isLayoutKind,\n isLayoutTone,\n} from './grammar.js';\nimport type { RawLayoutNode } from './read.js';\n\n/**\n * C11 and every structural check over the layout grammar, `spec/semantics/model-v1.md`\n * section 3.\n *\n * The metaschema closes each node's shape; this walk states what JSON Schema cannot: which\n * kind may hold which, that an interactive field is placed once and a step id is unique, that a\n * `colSpan` fits its parent, that a wizard is declared once at the top level, that a gate reference\n * and a section anchor resolve, and that `visibleWhen` reaches only a section, chrome or an\n * instruction-only step (C11). A section is admitted because its fields stay data: the value and\n * its submission policy are unchanged, and only the painted page and the readiness fold treat a\n * hidden section's fields as off-screen.\n *\n * It is exported because the authoring store needs the same verdict before a document is\n * compiled; the compiler calls it too, so there is one authority. Every refusal is a\n * `LAYOUT_STRUCTURE` diagnostic — never a throw — so one compile names every structural\n * reason instead of the first.\n */\n\n/** What the layout walk needs from the document around it. */\nexport interface LayoutShapeContext {\n /** Every declared `fieldId`, at any nesting level. */\n readonly fieldIds: ReadonlySet<string>;\n /** Every `annotations.sectionId` a declared field states. */\n readonly sectionIds: ReadonlySet<string>;\n /** Every declared gate rule's `ruleId`, so a `step.gateId` can resolve. */\n readonly gateIds: ReadonlySet<string>;\n}\n\n/** The kinds a node may anchor a review section on. */\nconst ANCHOR_KINDS: readonly LayoutKind[] = ['section', 'step', 'sop_block', 'summary_card'];\n\n/** The kinds C11 admits a `visibleWhen` on unconditionally. */\nconst CHROME_KINDS: readonly LayoutKind[] = ['section', 'callout', 'sop_block', 'summary_card'];\n\nfunction containmentDetail(parent: LayoutKind | undefined, child: LayoutKind): string {\n if (child === 'step') return 'a step is only a direct child of a wizard';\n if (parent === 'wizard') return `a wizard holds only steps; move this \\`${child}\\` into a step`;\n if (child === 'wizard') {\n return parent === undefined\n ? 'a schema declares at most one wizard'\n : `a wizard is declared at the top level, not inside a \\`${parent}\\`; move it out`;\n }\n return `a \\`${parent ?? 'top-level layout'}\\` does not admit a \\`${child}\\` child`;\n}\n\n/** Whether any descendant of this node places an interactive field. */\nfunction hasFieldDescendant(node: RawLayoutNode): boolean {\n return node.children.some((child) => child.kind === 'field' || hasFieldDescendant(child));\n}\n\n/** The C11 refusal a `visibleWhen` on this node earns, or `undefined` when it is permitted. */\nfunction visibleWhenRefusal(node: RawLayoutNode, kind: LayoutKind): string | undefined {\n if (CHROME_KINDS.includes(kind)) return undefined;\n if (kind !== 'step') {\n return `\\`visibleWhen\\` is permitted only on a section, callout, sop_block, summary_card or an instruction-only step; a \\`${kind}\\` cannot be hidden conditionally — move the fields into a section and hide that section, or remove \\`visibleWhen\\` and hide each field with a \\`visible\\` rule`;\n }\n if (node.gateId !== undefined) {\n return '`visibleWhen` is forbidden on a step carrying a `gateId`; a presentation condition must never hide a gate-bearing step — remove the `gateId`, or remove `visibleWhen` and let the gate decide whether the step is open';\n }\n if (hasFieldDescendant(node)) {\n return '`visibleWhen` is forbidden on a step that places an interactive field because a presentation condition must never hide an interactive field; move the fields into a section and hide that section, or remove `visibleWhen` and hide each field with a `visible` rule';\n }\n return undefined;\n}\n\n/**\n * Every structural refusal in one layout tree, in declaration order. The result is empty for\n * a legal layout, and containing one entry per defect otherwise.\n */\nexport function layoutShapeErrors(\n layout: readonly RawLayoutNode[],\n context: LayoutShapeContext,\n): readonly SchemaDiagnostic[] {\n const diagnostics: SchemaDiagnostic[] = [];\n const placedFields = new Map<string, string>();\n const stepIds = new Map<string, string>();\n const anchors = new Map<string, string>();\n let wizardPath: string | undefined;\n\n const refuse = (\n path: string,\n reason: LayoutShapeReason,\n detail: string,\n repairStated = false,\n ): void => {\n diagnostics.push({\n code: 'LAYOUT_STRUCTURE',\n path,\n detail,\n layoutReason: reason,\n ...(repairStated ? { repairStated: true } : {}),\n });\n };\n\n const visit = (\n node: RawLayoutNode,\n parent: LayoutKind | undefined,\n parentColumns: number,\n ): void => {\n if (!isLayoutKind(node.kind)) {\n refuse(\n node.path,\n 'unknown_kind',\n `\\`${node.kind}\\` is not a layout kind; the grammar admits section, group, wizard, step, field, heading, callout, divider, sop_block and summary_card`,\n );\n return;\n }\n const kind = node.kind;\n if (!admitsChild(parent, kind))\n refuse(node.path, 'containment', containmentDetail(parent, kind));\n\n if (kind === 'wizard') {\n if (wizardPath === undefined) wizardPath = node.path;\n else {\n refuse(\n node.path,\n 'containment',\n `a schema declares at most one wizard; the first is at ${wizardPath}`,\n );\n }\n }\n\n // `visibleWhen` placement is C11's alone: reporting it here as a foreign member as well\n // would state one defect twice and make the count of C11 refusals depend on the kind table.\n for (const member of foreignMembers(\n kind,\n node.members.filter((member) => member !== 'visibleWhen'),\n )) {\n refuse(node.path, 'foreign_member', `a \\`${kind}\\` does not admit \\`${member}\\``);\n }\n\n if (kind === 'callout' && node.tone !== undefined && !isLayoutTone(node.tone)) {\n refuse(\n node.path,\n 'tone',\n `\\`${node.tone}\\` is not a callout tone; the vocabulary is info, warning, danger and success`,\n );\n }\n\n if (kind === 'step' && node.stepId !== undefined) {\n const first = stepIds.get(node.stepId);\n if (first === undefined) stepIds.set(node.stepId, node.path);\n else {\n refuse(\n `${node.path}.stepId`,\n 'duplicate_step',\n `stepId \\`${node.stepId}\\` is declared more than once (first at ${first}); a layout node id is unique across the document`,\n );\n }\n }\n\n if (kind === 'field') {\n const fieldId = node.fieldId;\n if (fieldId === undefined) {\n refuse(node.path, 'field_missing', 'a field node names the field it places in `fieldId`');\n } else {\n if (!context.fieldIds.has(fieldId)) {\n refuse(\n node.path,\n 'field_missing',\n `field \\`${fieldId}\\` is not declared by this document; a field leaf places a declared field`,\n );\n }\n const first = placedFields.get(fieldId);\n if (first === undefined) placedFields.set(fieldId, node.path);\n else {\n refuse(\n node.path,\n 'duplicate_field',\n `field \\`${fieldId}\\` is placed more than once (first at ${first}); an interactive field has one placement`,\n );\n }\n }\n const colSpan = node.colSpan ?? 1;\n if (colSpan > parentColumns) {\n refuse(\n node.path,\n 'columns',\n `colSpan ${String(colSpan)} exceeds the ${String(parentColumns)} column${parentColumns === 1 ? '' : 's'} its parent lays out; a field spans at most its parent's \\`columns\\` (the top level is 1 column)`,\n );\n }\n }\n\n if (node.sectionId !== undefined && ANCHOR_KINDS.includes(kind)) {\n const anchorPath = `${node.path}.sectionId`;\n if (!context.sectionIds.has(node.sectionId)) {\n refuse(\n anchorPath,\n 'section_anchor',\n `sectionId \"${node.sectionId}\" names no field annotation section; declare that section on a field or remove the layout anchor.`,\n );\n }\n // Only a `section` node's anchor is unique: a summary card and an SOP block may both\n // belong to the same review section, which is what makes several chrome nodes share it.\n if (kind === 'section') {\n const first = anchors.get(node.sectionId);\n if (first === undefined) anchors.set(node.sectionId, node.path);\n else {\n refuse(\n anchorPath,\n 'section_anchor',\n `sectionId \"${node.sectionId}\" is already anchored at ${first}; an anchor is unique across layout \\`section\\` nodes`,\n );\n }\n }\n }\n\n if (kind === 'step' && node.gateId !== undefined && !context.gateIds.has(node.gateId)) {\n refuse(\n node.path,\n 'gate_reference',\n `gateId \\`${node.gateId}\\` names no declared gate rule; declare that gate or remove the step's \\`gateId\\``,\n );\n }\n\n if (kind === 'summary_card') {\n for (const fieldId of node.fields) {\n if (context.fieldIds.has(fieldId)) continue;\n refuse(\n node.path,\n 'summary_field',\n `summary card field \\`${fieldId}\\` is not declared by this document; a summary card lists declared fields read-only`,\n );\n }\n }\n\n if (node.visibleWhen !== undefined) {\n const refusal = visibleWhenRefusal(node, kind);\n if (refusal !== undefined) refuse(`${node.path}.visibleWhen`, 'c11', refusal, true);\n }\n\n const columns =\n kind === 'section' || kind === 'group' || kind === 'step' ? (node.columns ?? 1) : 1;\n if (admitsChildren(kind)) {\n for (const child of node.children) visit(child, kind, columns);\n }\n };\n\n for (const node of layout) visit(node, undefined, 1);\n return diagnostics;\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CompiledMessage, MessageNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* ICU MessageFormat 1 compilation, `spec/semantics/model-v1.md` section 6.
|
|
4
|
+
*
|
|
5
|
+
* The compiler is the only producer of a message AST, so every authored
|
|
6
|
+
* locale is parsed and checked here — the `number`/`date`/`time`/currency formatters are
|
|
7
|
+
* refused, each `plural` branch must be a CLDR category one of the
|
|
8
|
+
* declared locales can select, and every `select`/`plural` must carry an `other` branch so
|
|
9
|
+
* a locale can never fall through to nothing.
|
|
10
|
+
*
|
|
11
|
+
* A catalogue may name any locale the metaschema admits, and its text renders as authored;
|
|
12
|
+
* only a `plural` needs the runtime's CLDR rules to select a branch, so a `plural` in a
|
|
13
|
+
* locale the runtime carries no rules for is refused at its own node rather than aborting
|
|
14
|
+
* the compile.
|
|
15
|
+
*
|
|
16
|
+
* The data-only AST keeps the source text beside it: a host may show the source, and a
|
|
17
|
+
* runtime never parses either.
|
|
18
|
+
*/
|
|
19
|
+
/** Why one authored message did not compile. */
|
|
20
|
+
interface MessageDiagnostic {
|
|
21
|
+
/** Where inside the message, as `nodes[1].cases[0]`, or empty for the whole message. */
|
|
22
|
+
readonly path: string;
|
|
23
|
+
readonly detail: string;
|
|
24
|
+
}
|
|
25
|
+
/** The names a message references, in first-appearance order. */
|
|
26
|
+
export type MessageArguments = readonly string[];
|
|
27
|
+
/** One authored message compiled, or every reason it was not. */
|
|
28
|
+
export type MessageCompileResult = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly message: CompiledMessage;
|
|
31
|
+
readonly arguments: MessageArguments;
|
|
32
|
+
} | {
|
|
33
|
+
readonly ok: false;
|
|
34
|
+
readonly diagnostics: readonly MessageDiagnostic[];
|
|
35
|
+
};
|
|
36
|
+
/** Compiles one authored message of one locale, against every locale it declares. */
|
|
37
|
+
export declare function compileMessage(source: string, locale: string, locales: readonly string[]): MessageCompileResult;
|
|
38
|
+
/** The argument names a compiled message references, in first-appearance order. */
|
|
39
|
+
export declare function argumentsOf(nodes: readonly MessageNode[]): MessageArguments;
|
|
40
|
+
/**
|
|
41
|
+
* The `select` branches one compiled message declares, keyed by the argument it selects on.
|
|
42
|
+
* The compiler checks them against the options of the field the using rule binds that
|
|
43
|
+
* argument to.
|
|
44
|
+
*/
|
|
45
|
+
export declare function selectBranches(nodes: readonly MessageNode[]): ReadonlyMap<string, readonly string[]>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/messages/compile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI3E;;;;;;;;;;;;;;;;GAgBG;AAEH,gDAAgD;AAChD,UAAU,iBAAiB;IACzB,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAAC;AAEjD,iEAAiE;AACjE,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;CAAE,GAC9F;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAA;CAAE,CAAC;AAoJ/E,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,oBAAoB,CA2BtB;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,gBAAgB,CAqB3E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAkBxC"}
|