squiffy-compiler 6.0.1 → 7.0.0-beta.11
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/README.md +10 -2
- package/dist/analyse.d.ts +96 -0
- package/dist/analyse.js +951 -0
- package/dist/compiler.d.ts +32 -40
- package/dist/compiler.js +26 -691
- package/dist/css-urls.d.ts +4 -0
- package/dist/css-urls.js +59 -0
- package/dist/emit.d.ts +71 -0
- package/dist/emit.js +192 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +14 -0
- package/dist/ignore.d.ts +8 -0
- package/dist/ignore.js +71 -0
- package/dist/infix-expressions.d.ts +19 -0
- package/dist/infix-expressions.js +713 -0
- package/dist/language-service.d.ts +90 -0
- package/dist/language-service.js +883 -0
- package/dist/node.d.ts +23 -0
- package/dist/node.js +122 -0
- package/dist/parse.d.ts +22 -0
- package/dist/parse.js +316 -0
- package/dist/project.d.ts +129 -0
- package/dist/project.js +488 -0
- package/dist/quest/aslx.d.ts +51 -0
- package/dist/quest/aslx.js +184 -0
- package/dist/quest/convert.d.ts +20 -0
- package/dist/quest/convert.js +552 -0
- package/dist/quest/script.d.ts +92 -0
- package/dist/quest/script.js +453 -0
- package/dist/quest/scripts.d.ts +24 -0
- package/dist/quest/scripts.js +506 -0
- package/dist/quest/text.d.ts +18 -0
- package/dist/quest/text.js +323 -0
- package/dist/section-labels.d.ts +4 -0
- package/dist/section-labels.js +64 -0
- package/dist/setters.d.ts +49 -0
- package/dist/setters.js +477 -0
- package/dist/story-graph.d.ts +71 -0
- package/dist/story-graph.js +445 -0
- package/dist/syntax.d.ts +198 -0
- package/dist/syntax.js +8 -0
- package/dist/templates.d.ts +17 -0
- package/dist/templates.js +180 -0
- package/dist/text.d.ts +44 -0
- package/dist/text.js +348 -0
- package/dist/twine/audio.d.ts +21 -0
- package/dist/twine/audio.js +80 -0
- package/dist/twine/convert.d.ts +131 -0
- package/dist/twine/convert.js +1057 -0
- package/dist/twine/expression.d.ts +88 -0
- package/dist/twine/expression.js +318 -0
- package/dist/twine/harlowe.d.ts +27 -0
- package/dist/twine/harlowe.js +2341 -0
- package/dist/twine/settings.d.ts +9 -0
- package/dist/twine/settings.js +322 -0
- package/dist/twine/story.d.ts +24 -0
- package/dist/twine/story.js +231 -0
- package/dist/twine/sugarcube.d.ts +40 -0
- package/dist/twine/sugarcube.js +2172 -0
- package/dist/v5.js +2 -1
- package/package.json +35 -6
- package/syntaxes/squiffy.tmLanguage.json +1003 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Expr } from "./expression.js";
|
|
2
|
+
import type { TwinePassage, TwineStory } from "./story.js";
|
|
3
|
+
export interface TwineConversionProblem {
|
|
4
|
+
passage?: string;
|
|
5
|
+
text: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TwineConversionResult {
|
|
9
|
+
title: string;
|
|
10
|
+
format: string;
|
|
11
|
+
files: Record<string, string>;
|
|
12
|
+
main: string;
|
|
13
|
+
passages: number;
|
|
14
|
+
problems: TwineConversionProblem[];
|
|
15
|
+
}
|
|
16
|
+
export interface TwineConversionOptions {
|
|
17
|
+
name?: string;
|
|
18
|
+
}
|
|
19
|
+
export type PassageKind = "story" | "header" | "footer" | "panel" | "startup" | "widget";
|
|
20
|
+
export interface PassageContext {
|
|
21
|
+
readonly story: StoryContext;
|
|
22
|
+
readonly passage: TwinePassage;
|
|
23
|
+
readonly kind: PassageKind;
|
|
24
|
+
readonly section: string;
|
|
25
|
+
unconvertible(text: string, reason: string): string;
|
|
26
|
+
approximate(text: string, reason: string): void;
|
|
27
|
+
addPassage(nameHint: string, content: ConvertedPassage | string): string;
|
|
28
|
+
reservePassage(nameHint: string): {
|
|
29
|
+
name: string;
|
|
30
|
+
fill: (content: ConvertedPassage | string) => void;
|
|
31
|
+
};
|
|
32
|
+
addSection(nameHint: string, content: ConvertedPassage | string): string;
|
|
33
|
+
fillSection(name: string, content: ConvertedPassage | string): void;
|
|
34
|
+
newLabel(hint: string): string;
|
|
35
|
+
}
|
|
36
|
+
export interface ConvertedPassage {
|
|
37
|
+
directives: string[];
|
|
38
|
+
body: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const reservedAttributes: Set<string>;
|
|
41
|
+
export declare class StoryContext {
|
|
42
|
+
readonly twine: TwineStory;
|
|
43
|
+
readonly problems: TwineConversionProblem[];
|
|
44
|
+
private readonly sectionNames;
|
|
45
|
+
private readonly usedSectionNames;
|
|
46
|
+
private readonly usedLabels;
|
|
47
|
+
readonly extraSections: string[];
|
|
48
|
+
private readonly permanentVars;
|
|
49
|
+
readonly passagesByName: Map<string, TwinePassage>;
|
|
50
|
+
readonly passageStyles: {
|
|
51
|
+
passage: string;
|
|
52
|
+
css: string;
|
|
53
|
+
}[];
|
|
54
|
+
readonly passageScripts: {
|
|
55
|
+
passage: string;
|
|
56
|
+
js: string;
|
|
57
|
+
}[];
|
|
58
|
+
readonly persistent: Set<string>;
|
|
59
|
+
constructor(twine: TwineStory, passages: TwinePassage[]);
|
|
60
|
+
private readonly problemKeys;
|
|
61
|
+
addProblem(problem: TwineConversionProblem): void;
|
|
62
|
+
notePermanentVar(name: string): void;
|
|
63
|
+
readonly setupValues: Set<string>;
|
|
64
|
+
noteSetupValues(text: string): void;
|
|
65
|
+
sectionFor(passageName: string): string | undefined;
|
|
66
|
+
private trimmed?;
|
|
67
|
+
private trimmedNames;
|
|
68
|
+
private readonly cache;
|
|
69
|
+
cached<T>(key: string, make: () => T): T;
|
|
70
|
+
private readonly notes;
|
|
71
|
+
note(key: string, text: string, reason: string): void;
|
|
72
|
+
noteProblems(): TwineConversionProblem[];
|
|
73
|
+
sectionForUnknown(passageName: string): string;
|
|
74
|
+
uniqueSectionName(hint: string): string;
|
|
75
|
+
newLabel(hint: string): string;
|
|
76
|
+
private readonly loops;
|
|
77
|
+
inLoop<T>(vars: Map<string, "item" | "index">, array: string | undefined, convert: () => T, numbers?: boolean): T;
|
|
78
|
+
get inAnyLoop(): boolean;
|
|
79
|
+
linkBody<T>(convert: () => T): {
|
|
80
|
+
result: T;
|
|
81
|
+
setters: string[];
|
|
82
|
+
};
|
|
83
|
+
private loopVariable;
|
|
84
|
+
variable(name: string, temporary: boolean): Expr;
|
|
85
|
+
attribute(name: string, temporary: boolean): string;
|
|
86
|
+
persistentAttribute(key: string): string;
|
|
87
|
+
private attributeName;
|
|
88
|
+
}
|
|
89
|
+
export declare function sanitiseName(name: string): string;
|
|
90
|
+
export declare function escapeText(text: string): string;
|
|
91
|
+
export declare function escapeLinkBrackets(text: string): string;
|
|
92
|
+
export declare function sectionLink(text: string | null, target: string, setters?: string[]): string;
|
|
93
|
+
export declare function isUrl(target: string): boolean;
|
|
94
|
+
export declare function urlLink(text: string, url: string): string;
|
|
95
|
+
export declare function dynamicSectionLink(text: string, target: Expr, setters?: string[]): string;
|
|
96
|
+
export declare function passageLink(text: string, target: string, setters?: string[]): string;
|
|
97
|
+
export declare function setter(name: string, op: "=" | "+=" | "-=" | "*=" | "/=", value: Expr, inLink: boolean): string;
|
|
98
|
+
export declare function comment(text: string): string;
|
|
99
|
+
export declare function formatTwineProblems(result: TwineConversionResult, sourceName?: string): string;
|
|
100
|
+
export declare function convertTwine(source: string, options?: TwineConversionOptions): TwineConversionResult;
|
|
101
|
+
export declare function convertTwineStory(twine: TwineStory, options?: TwineConversionOptions): TwineConversionResult;
|
|
102
|
+
export declare function tagClasses(tags: string[]): string[];
|
|
103
|
+
export declare function convertTagSelectors(css: string): string;
|
|
104
|
+
export interface HtmlBlock {
|
|
105
|
+
t: "html";
|
|
106
|
+
tag: "script" | "style";
|
|
107
|
+
raw: string;
|
|
108
|
+
attributes: string;
|
|
109
|
+
content: string;
|
|
110
|
+
}
|
|
111
|
+
export declare function readHtmlBlock(src: string, i: number): {
|
|
112
|
+
block: HtmlBlock;
|
|
113
|
+
end: number;
|
|
114
|
+
} | undefined;
|
|
115
|
+
export declare function passageHtmlBlock(ctx: PassageContext, block: HtmlBlock, top: boolean): {
|
|
116
|
+
text: string;
|
|
117
|
+
directive?: string;
|
|
118
|
+
};
|
|
119
|
+
export declare function topScripts<N extends {
|
|
120
|
+
t: string;
|
|
121
|
+
}>(ctx: PassageContext, nodes: (N | HtmlBlock)[], directives: string[]): (N | HtmlBlock | {
|
|
122
|
+
t: "raw";
|
|
123
|
+
s: string;
|
|
124
|
+
})[];
|
|
125
|
+
export declare function convertTwineSelectors(css: string): {
|
|
126
|
+
css: string;
|
|
127
|
+
translated: string[];
|
|
128
|
+
untranslated: string[];
|
|
129
|
+
};
|
|
130
|
+
export declare function usesOuterLoop(text: string): boolean;
|
|
131
|
+
export declare function finishText(text: string): string;
|