@aftertext/compiler 0.0.0-stage → 0.1.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 +68 -2
- package/dist/ast/expression.d.ts +55 -0
- package/dist/ast/expression.d.ts.map +1 -0
- package/dist/ast/expression.js +2 -0
- package/dist/ast/expression.js.map +1 -0
- package/dist/ast/index.d.ts +6 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +2 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/inline.d.ts +39 -0
- package/dist/ast/inline.d.ts.map +1 -0
- package/dist/ast/inline.js +2 -0
- package/dist/ast/inline.js.map +1 -0
- package/dist/ast/presentation.d.ts +41 -0
- package/dist/ast/presentation.d.ts.map +1 -0
- package/dist/ast/presentation.js +8 -0
- package/dist/ast/presentation.js.map +1 -0
- package/dist/ast/span.d.ts +19 -0
- package/dist/ast/span.d.ts.map +1 -0
- package/dist/ast/span.js +2 -0
- package/dist/ast/span.js.map +1 -0
- package/dist/ast/story.d.ts +354 -0
- package/dist/ast/story.d.ts.map +1 -0
- package/dist/ast/story.js +2 -0
- package/dist/ast/story.js.map +1 -0
- package/dist/compile.d.ts +25 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +19 -0
- package/dist/compile.js.map +1 -0
- package/dist/diagnostics/codes.d.ts +26 -0
- package/dist/diagnostics/codes.d.ts.map +1 -0
- package/dist/diagnostics/codes.js +69 -0
- package/dist/diagnostics/codes.js.map +1 -0
- package/dist/diagnostics/index.d.ts +3 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +2 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/types.d.ts +19 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +2 -0
- package/dist/diagnostics/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/blocks.d.ts +40 -0
- package/dist/parser/blocks.d.ts.map +1 -0
- package/dist/parser/blocks.js +927 -0
- package/dist/parser/blocks.js.map +1 -0
- package/dist/parser/directive-line.d.ts +21 -0
- package/dist/parser/directive-line.d.ts.map +1 -0
- package/dist/parser/directive-line.js +50 -0
- package/dist/parser/directive-line.js.map +1 -0
- package/dist/parser/document.d.ts +13 -0
- package/dist/parser/document.d.ts.map +1 -0
- package/dist/parser/document.js +28 -0
- package/dist/parser/document.js.map +1 -0
- package/dist/parser/expression-lexer.d.ts +44 -0
- package/dist/parser/expression-lexer.d.ts.map +1 -0
- package/dist/parser/expression-lexer.js +166 -0
- package/dist/parser/expression-lexer.js.map +1 -0
- package/dist/parser/expression-parser.d.ts +13 -0
- package/dist/parser/expression-parser.d.ts.map +1 -0
- package/dist/parser/expression-parser.js +201 -0
- package/dist/parser/expression-parser.js.map +1 -0
- package/dist/parser/frontmatter.d.ts +23 -0
- package/dist/parser/frontmatter.d.ts.map +1 -0
- package/dist/parser/frontmatter.js +158 -0
- package/dist/parser/frontmatter.js.map +1 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +2 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/lexical-primitives.d.ts +38 -0
- package/dist/parser/lexical-primitives.d.ts.map +1 -0
- package/dist/parser/lexical-primitives.js +46 -0
- package/dist/parser/lexical-primitives.js.map +1 -0
- package/dist/parser/lines.d.ts +32 -0
- package/dist/parser/lines.d.ts.map +1 -0
- package/dist/parser/lines.js +60 -0
- package/dist/parser/lines.js.map +1 -0
- package/dist/parser/markdown.d.ts +19 -0
- package/dist/parser/markdown.d.ts.map +1 -0
- package/dist/parser/markdown.js +221 -0
- package/dist/parser/markdown.js.map +1 -0
- package/dist/parser/serializer-safety.d.ts +57 -0
- package/dist/parser/serializer-safety.d.ts.map +1 -0
- package/dist/parser/serializer-safety.js +66 -0
- package/dist/parser/serializer-safety.js.map +1 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/validate.d.ts +4 -0
- package/dist/validation/validate.d.ts.map +1 -0
- package/dist/validation/validate.js +221 -0
- package/dist/validation/validate.js.map +1 -0
- package/package.json +43 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 z0rimo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@aftertext/compiler`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compiles prose-first AfterText source into a validated `StoryDocument`.
|
|
4
|
+
|
|
5
|
+
> v0.1 foundation: the language and public API are early and may change.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @aftertext/compiler
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { compile } from "@aftertext/compiler";
|
|
17
|
+
|
|
18
|
+
const result = compile(`---
|
|
19
|
+
title: Example
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
@scene start
|
|
23
|
+
|
|
24
|
+
Hello.
|
|
25
|
+
`);
|
|
26
|
+
|
|
27
|
+
if (result.hasErrors) {
|
|
28
|
+
console.error(result.diagnostics);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
console.log(result.document);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The compiler returns best-effort output plus structured diagnostics. AfterText
|
|
35
|
+
source is declarative and cannot execute arbitrary JavaScript.
|
|
36
|
+
|
|
37
|
+
## Source-generation helpers
|
|
38
|
+
|
|
39
|
+
Two small predicates are exported from the package root for tools that
|
|
40
|
+
**generate or edit AfterText source** (for example a structured editor or an
|
|
41
|
+
importer). They are source-editing/tooling helpers, not part of the narrative
|
|
42
|
+
runtime, and nothing in `@aftertext/runtime`, `@aftertext/player`, or
|
|
43
|
+
`@aftertext/web-renderer` uses them. They have been public since `0.1.0` and
|
|
44
|
+
remain part of the public API.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import {
|
|
48
|
+
isChoiceTargetBoundarySafe,
|
|
49
|
+
isPresentationNamedArgumentValueBoundarySafe
|
|
50
|
+
} from "@aftertext/compiler";
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- `isChoiceTargetBoundarySafe(value: string): boolean` — `false` if `value`
|
|
54
|
+
contains separator whitespace or an unescaped `->`. Interpolated into a
|
|
55
|
+
`@choice` item, such a value could be re-read by the parser as an extra `if`
|
|
56
|
+
condition or as a different item/target split instead of a single
|
|
57
|
+
unconditional scene target.
|
|
58
|
+
- `isPresentationNamedArgumentValueBoundarySafe(value: string): boolean` —
|
|
59
|
+
`false` if `value` contains separator whitespace. Interpolated into a named
|
|
60
|
+
presentation argument (such as `volume=…`, `to=…`, or `duration=…`), such a
|
|
61
|
+
value could add or truncate a parameter.
|
|
62
|
+
|
|
63
|
+
Both checks are lexical and conservative. They are not validators: a value can
|
|
64
|
+
pass and still be rejected by the compiler (for example a non-numeric
|
|
65
|
+
`volume`), and the compiler's own diagnostics remain the source of truth.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { SourceSpan } from "./span.js";
|
|
2
|
+
/** A literal value permitted inside AfterText expressions. */
|
|
3
|
+
export type LiteralValue = string | number | boolean | null;
|
|
4
|
+
export type UnaryOperator = "!" | "-";
|
|
5
|
+
export type BinaryOperator = "*" | "/" | "%" | "+" | "-" | "<" | "<=" | ">" | ">=" | "==" | "!=" | "&&" | "||";
|
|
6
|
+
export interface LiteralExpression {
|
|
7
|
+
readonly type: "Literal";
|
|
8
|
+
readonly value: LiteralValue;
|
|
9
|
+
readonly span: SourceSpan;
|
|
10
|
+
}
|
|
11
|
+
export interface IdentifierExpression {
|
|
12
|
+
readonly type: "Identifier";
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly span: SourceSpan;
|
|
15
|
+
}
|
|
16
|
+
export interface UnaryExpression {
|
|
17
|
+
readonly type: "Unary";
|
|
18
|
+
readonly operator: UnaryOperator;
|
|
19
|
+
readonly argument: ExpressionNode;
|
|
20
|
+
readonly span: SourceSpan;
|
|
21
|
+
}
|
|
22
|
+
export interface BinaryExpression {
|
|
23
|
+
readonly type: "Binary";
|
|
24
|
+
readonly operator: BinaryOperator;
|
|
25
|
+
readonly left: ExpressionNode;
|
|
26
|
+
readonly right: ExpressionNode;
|
|
27
|
+
readonly span: SourceSpan;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A call, `callee(args...)`. This is a syntax/AST primitive only: it does
|
|
31
|
+
* not mean user-defined functions, callable values, or a general standard
|
|
32
|
+
* library exist. `callee` is a plain name, never itself an expression (no
|
|
33
|
+
* member calls, no calling a computed value) — only a small, fixed set of
|
|
34
|
+
* compiler/runtime-approved builtin names may execute (see
|
|
35
|
+
* docs/CORE_SPEC.md Section 17.14). `args` stays structurally general
|
|
36
|
+
* (ordinary comma-separated expressions) so a future builtin with a
|
|
37
|
+
* different argument contract does not require redesigning this node;
|
|
38
|
+
* individual builtins impose their own, narrower argument rules through
|
|
39
|
+
* semantic validation, not through this AST shape.
|
|
40
|
+
*/
|
|
41
|
+
export interface CallExpression {
|
|
42
|
+
readonly type: "Call";
|
|
43
|
+
readonly callee: string;
|
|
44
|
+
readonly args: readonly ExpressionNode[];
|
|
45
|
+
readonly span: SourceSpan;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* AfterText expression AST. A discriminated union on `type`, deliberately
|
|
49
|
+
* excluding member access, indexing, arrays, objects, and assignment:
|
|
50
|
+
* `@set` is the only state-mutation syntax in v0.1. `Call` (added for
|
|
51
|
+
* Reader Memory queries, Section 17.14) is a fixed-builtin-only primitive,
|
|
52
|
+
* not a general function-call feature — see `CallExpression` above.
|
|
53
|
+
*/
|
|
54
|
+
export type ExpressionNode = LiteralExpression | IdentifierExpression | UnaryExpression | BinaryExpression | CallExpression;
|
|
55
|
+
//# sourceMappingURL=expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../src/ast/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,8DAA8D;AAC9D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,MAAM,MAAM,cAAc,GACtB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,CAAC;AAET,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../src/ast/expression.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { SourcePosition, SourceSpan } from "./span.js";
|
|
2
|
+
export type { LiteralValue, UnaryOperator, BinaryOperator, LiteralExpression, IdentifierExpression, UnaryExpression, BinaryExpression, CallExpression, ExpressionNode } from "./expression.js";
|
|
3
|
+
export type { TextInline, EmphasisInline, StrongInline, InlineCodeInline, LinkInline, LineBreakInline, InlineNode } from "./inline.js";
|
|
4
|
+
export type { BackgroundCommand, LayerCommand, CameraAction, CameraZoomCommand, CameraCommand, MusicCommand, SfxCommand, PauseCommand, PresentationCommand } from "./presentation.js";
|
|
5
|
+
export type { StateValue, StoryStateDefinition, StoryMetadata, ParagraphNode, HeadingNode, PresentationNode, SetNode, GotoNode, ChoiceItem, ChoiceNode, ConditionalBranchKind, ConditionalBranch, ConditionalNode, VariantBranchKind, VariantBranch, VariantNode, StoryBlock, SceneNode, StoryDocument } from "./story.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ast/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ast/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SourceSpan } from "./span.js";
|
|
2
|
+
/**
|
|
3
|
+
* Inline content types produced by converting prose regions out of the
|
|
4
|
+
* Markdown parser's AST. This is intentionally a small subset of Markdown's
|
|
5
|
+
* inline grammar (see architecture notes in parser/markdown.ts) — AfterText
|
|
6
|
+
* v0.1 does not attempt to reimplement the complete Markdown spec.
|
|
7
|
+
*/
|
|
8
|
+
export interface TextInline {
|
|
9
|
+
readonly type: "Text";
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly span: SourceSpan;
|
|
12
|
+
}
|
|
13
|
+
export interface EmphasisInline {
|
|
14
|
+
readonly type: "Emphasis";
|
|
15
|
+
readonly children: readonly InlineNode[];
|
|
16
|
+
readonly span: SourceSpan;
|
|
17
|
+
}
|
|
18
|
+
export interface StrongInline {
|
|
19
|
+
readonly type: "Strong";
|
|
20
|
+
readonly children: readonly InlineNode[];
|
|
21
|
+
readonly span: SourceSpan;
|
|
22
|
+
}
|
|
23
|
+
export interface InlineCodeInline {
|
|
24
|
+
readonly type: "InlineCode";
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly span: SourceSpan;
|
|
27
|
+
}
|
|
28
|
+
export interface LinkInline {
|
|
29
|
+
readonly type: "Link";
|
|
30
|
+
readonly url: string;
|
|
31
|
+
readonly children: readonly InlineNode[];
|
|
32
|
+
readonly span: SourceSpan;
|
|
33
|
+
}
|
|
34
|
+
export interface LineBreakInline {
|
|
35
|
+
readonly type: "LineBreak";
|
|
36
|
+
readonly span: SourceSpan;
|
|
37
|
+
}
|
|
38
|
+
export type InlineNode = TextInline | EmphasisInline | StrongInline | InlineCodeInline | LinkInline | LineBreakInline;
|
|
39
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/ast/inline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,cAAc,GACd,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/ast/inline.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed presentation commands for @background, @layer, @camera, @music,
|
|
3
|
+
* @sfx, and @pause. The compiler owns parsing, unit normalization (e.g.
|
|
4
|
+
* `6s` / `1200ms` -> milliseconds), and validation of these directives, so
|
|
5
|
+
* runtime code consumes typed values and never re-parses directive text.
|
|
6
|
+
*/
|
|
7
|
+
export interface BackgroundCommand {
|
|
8
|
+
readonly type: "Background";
|
|
9
|
+
readonly image: string;
|
|
10
|
+
}
|
|
11
|
+
export interface LayerCommand {
|
|
12
|
+
readonly type: "Layer";
|
|
13
|
+
readonly image: string;
|
|
14
|
+
}
|
|
15
|
+
/** v0.1 defines a single camera action. New actions extend this union. */
|
|
16
|
+
export type CameraAction = "zoom";
|
|
17
|
+
export interface CameraZoomCommand {
|
|
18
|
+
readonly type: "Camera";
|
|
19
|
+
readonly action: "zoom";
|
|
20
|
+
readonly to: number;
|
|
21
|
+
/** Milliseconds; absent when the directive didn't specify `duration=`. */
|
|
22
|
+
readonly durationMs: number | undefined;
|
|
23
|
+
}
|
|
24
|
+
export type CameraCommand = CameraZoomCommand;
|
|
25
|
+
export interface MusicCommand {
|
|
26
|
+
readonly type: "Music";
|
|
27
|
+
readonly track: string;
|
|
28
|
+
/** Absent when the directive didn't specify `volume=`. */
|
|
29
|
+
readonly volume: number | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface SfxCommand {
|
|
32
|
+
readonly type: "Sfx";
|
|
33
|
+
readonly clip: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PauseCommand {
|
|
36
|
+
readonly type: "Pause";
|
|
37
|
+
/** Milliseconds. */
|
|
38
|
+
readonly durationMs: number;
|
|
39
|
+
}
|
|
40
|
+
export type PresentationCommand = BackgroundCommand | LayerCommand | CameraCommand | MusicCommand | SfxCommand | PauseCommand;
|
|
41
|
+
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed presentation commands for @background, @layer, @camera, @music,
|
|
3
|
+
* @sfx, and @pause. The compiler owns parsing, unit normalization (e.g.
|
|
4
|
+
* `6s` / `1200ms` -> milliseconds), and validation of these directives, so
|
|
5
|
+
* runtime code consumes typed values and never re-parses directive text.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.js","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single position in AfterText source: 1-based line, 1-based column,
|
|
3
|
+
* and a 0-based absolute character offset into the source string.
|
|
4
|
+
*/
|
|
5
|
+
export interface SourcePosition {
|
|
6
|
+
readonly line: number;
|
|
7
|
+
readonly column: number;
|
|
8
|
+
readonly offset: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A half-open range `[start, end)` in AfterText source. Every AST node that
|
|
12
|
+
* originates from source text carries one of these so downstream tools
|
|
13
|
+
* (editors, error reporters) can map back to the original text.
|
|
14
|
+
*/
|
|
15
|
+
export interface SourceSpan {
|
|
16
|
+
readonly start: SourcePosition;
|
|
17
|
+
readonly end: SourcePosition;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../src/ast/span.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;CAC9B"}
|
package/dist/ast/span.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span.js","sourceRoot":"","sources":["../../src/ast/span.ts"],"names":[],"mappings":""}
|