squiffy-compiler 6.0.0-alpha.0 → 6.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler.d.ts +2 -1
- package/dist/compiler.js +11 -9
- package/package.json +7 -17
- package/dist/compiler.test.d.ts +0 -1
- package/dist/compiler.test.js +0 -73
- package/dist/external-files.d.ts +0 -5
- package/dist/external-files.js +0 -21
- package/dist/index.template.html +0 -39
- package/dist/packager.d.ts +0 -1
- package/dist/packager.js +0 -78
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -15
- package/dist/squiffy.d.ts +0 -1
- package/dist/squiffy.js +0 -29
- package/dist/squiffy.runtime.d.ts +0 -34
- package/dist/squiffy.template.d.ts +0 -29
- package/dist/squiffy.template.js +0 -598
- package/dist/style.template.css +0 -52
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -1
- package/examples/attributes/attributes.squiffy +0 -81
- package/examples/clearscreen/clearscreen.squiffy +0 -15
- package/examples/continue/continue.squiffy +0 -18
- package/examples/helloworld/helloworld.squiffy +0 -1
- package/examples/import/file2.squiffy +0 -8
- package/examples/import/test.js +0 -3
- package/examples/import/test.squiffy +0 -5
- package/examples/input/input.squiffy +0 -22
- package/examples/last/last.squiffy +0 -32
- package/examples/master/master.squiffy +0 -35
- package/examples/replace/replace.squiffy +0 -27
- package/examples/rotate/rotate.squiffy +0 -25
- package/examples/sectiontrack/sectiontrack.squiffy +0 -16
- package/examples/start/start.squiffy +0 -7
- package/examples/test/example.squiffy +0 -52
- package/examples/textprocessor/textprocessor.squiffy +0 -21
- package/examples/transitions/transitions.squiffy +0 -53
- package/examples/turncount/turncount.squiffy +0 -41
- package/examples/warnings/warnings.squiffy +0 -23
- package/examples/warnings/warnings2.squiffy +0 -3
- package/src/__snapshots__/compiler.test.ts.snap +0 -716
- package/src/compiler.test.ts +0 -86
- package/src/compiler.ts +0 -546
- package/src/external-files.ts +0 -22
- package/src/index.template.html +0 -39
- package/src/packager.ts +0 -97
- package/src/server.ts +0 -19
- package/src/squiffy.runtime.ts +0 -670
- package/src/squiffy.ts +0 -36
- package/src/style.template.css +0 -52
- package/src/version.ts +0 -1
- package/tsconfig.json +0 -22
- package/tsconfig.runtime.json +0 -12
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
@set my_string = some text
|
|
2
|
-
Set a start value: [[1]](one) or [[2]](two).
|
|
3
|
-
|
|
4
|
-
[[one]]:
|
|
5
|
-
@set my_attribute = 1
|
|
6
|
-
|
|
7
|
-
Maybe you'd like it to be [3](three) instead? Or you could just [[continue...]](next)
|
|
8
|
-
|
|
9
|
-
[three]:
|
|
10
|
-
@set my_attribute = 3
|
|
11
|
-
@set chose_passage
|
|
12
|
-
|
|
13
|
-
OK. Three it is.
|
|
14
|
-
|
|
15
|
-
[[two]]:
|
|
16
|
-
@set my_attribute = 2
|
|
17
|
-
|
|
18
|
-
Maybe you'd like it to be [4](four) instead? You could try [javascript]. Or you could just [[continue...]](next)
|
|
19
|
-
|
|
20
|
-
[javascript]:
|
|
21
|
-
alert("my_attribute " + get("my_attribute"));
|
|
22
|
-
|
|
23
|
-
[four]:
|
|
24
|
-
@set my_attribute = 4
|
|
25
|
-
@set chose_passage
|
|
26
|
-
|
|
27
|
-
OK. Four it is.
|
|
28
|
-
|
|
29
|
-
[[next]]:
|
|
30
|
-
my_attribute = {my_attribute}
|
|
31
|
-
|
|
32
|
-
Also, my_string = "{my_string}"
|
|
33
|
-
|
|
34
|
-
Did you choose a passage link? {if chose_passage:yes}{else:no} [unset]
|
|
35
|
-
|
|
36
|
-
Click some more links: [a], [b], [c], [d], [e] and then click [[done]].
|
|
37
|
-
|
|
38
|
-
[unset]:
|
|
39
|
-
@unset chose_passage
|
|
40
|
-
|
|
41
|
-
Now the value is: {if chose_passage:yes}{else:no}
|
|
42
|
-
|
|
43
|
-
[a]:
|
|
44
|
-
@inc count
|
|
45
|
-
|
|
46
|
-
OK...
|
|
47
|
-
|
|
48
|
-
[b]:
|
|
49
|
-
@inc count
|
|
50
|
-
|
|
51
|
-
OK...
|
|
52
|
-
|
|
53
|
-
[c]:
|
|
54
|
-
@inc count
|
|
55
|
-
|
|
56
|
-
OK...
|
|
57
|
-
|
|
58
|
-
[d]:
|
|
59
|
-
@inc count
|
|
60
|
-
|
|
61
|
-
OK...
|
|
62
|
-
|
|
63
|
-
[e]:
|
|
64
|
-
@inc count
|
|
65
|
-
|
|
66
|
-
OK...
|
|
67
|
-
|
|
68
|
-
[[done]]:
|
|
69
|
-
You clicked {count} links. What about calling [dec]?
|
|
70
|
-
|
|
71
|
-
[dec]:
|
|
72
|
-
@dec count
|
|
73
|
-
Now count is {count}. You can also [increase] or [decrease] by values other than 1.
|
|
74
|
-
|
|
75
|
-
[increase]:
|
|
76
|
-
@inc count 10
|
|
77
|
-
Now count is {count}.
|
|
78
|
-
|
|
79
|
-
[decrease]:
|
|
80
|
-
@dec count 5
|
|
81
|
-
Now count is {count}.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[This link](one) doesn't clear the screen. But [this link](two) does.
|
|
2
|
-
|
|
3
|
-
[one]:
|
|
4
|
-
This text is on the same screen.
|
|
5
|
-
|
|
6
|
-
[two]:
|
|
7
|
-
@clear
|
|
8
|
-
This text is on a new screen. This [[section]](same page) will be on the same screen, and this [[section]](clear section) clears the screen.
|
|
9
|
-
|
|
10
|
-
[[same page]]:
|
|
11
|
-
This section is on the same screen.
|
|
12
|
-
|
|
13
|
-
[[clear section]]:
|
|
14
|
-
@clear
|
|
15
|
-
Another new page.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Hello, world!
|
package/examples/import/test.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Enter some text in the box:
|
|
2
|
-
|
|
3
|
-
<input type="text" data-attribute="name" placeholder="Type here...">
|
|
4
|
-
|
|
5
|
-
+++Continue...
|
|
6
|
-
You entered: {name}.
|
|
7
|
-
|
|
8
|
-
Now type some more...
|
|
9
|
-
|
|
10
|
-
<textarea data-attribute="some-text"></textarea>
|
|
11
|
-
|
|
12
|
-
+++Continue...
|
|
13
|
-
|
|
14
|
-
You entered: {some-text}.
|
|
15
|
-
|
|
16
|
-
<div contenteditable="true" data-attribute="some-content">
|
|
17
|
-
This is editable content.
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
+++Continue...
|
|
21
|
-
|
|
22
|
-
You entered: {some-content}.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Test section with some passages. [a], [b], [c].
|
|
2
|
-
|
|
3
|
-
[a]:
|
|
4
|
-
Passage A.
|
|
5
|
-
|
|
6
|
-
[b]:
|
|
7
|
-
Passage B.
|
|
8
|
-
|
|
9
|
-
[c]:
|
|
10
|
-
Passage C.
|
|
11
|
-
|
|
12
|
-
[@last]:
|
|
13
|
-
You saw all passages! Now go to the [[next section]](section2).
|
|
14
|
-
|
|
15
|
-
[[section2]]:
|
|
16
|
-
|
|
17
|
-
Second test. [a], [b], [c].
|
|
18
|
-
|
|
19
|
-
[]:
|
|
20
|
-
Master passage.
|
|
21
|
-
|
|
22
|
-
[a]:
|
|
23
|
-
Passage A.
|
|
24
|
-
|
|
25
|
-
[b]:
|
|
26
|
-
Passage B.
|
|
27
|
-
|
|
28
|
-
[c]:
|
|
29
|
-
Passage C.
|
|
30
|
-
|
|
31
|
-
[@last]:
|
|
32
|
-
You saw all passages!
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
@start intro
|
|
2
|
-
|
|
3
|
-
[[]]:
|
|
4
|
-
This text appears before each section in the game.
|
|
5
|
-
|
|
6
|
-
[]:
|
|
7
|
-
console.log("This JS runs for each passage in the entire game.")
|
|
8
|
-
|
|
9
|
-
[[intro]]:
|
|
10
|
-
This is the first section.
|
|
11
|
-
|
|
12
|
-
+++Continue...
|
|
13
|
-
|
|
14
|
-
This is the second section. [One], [two], [three]. [[Next!]]
|
|
15
|
-
|
|
16
|
-
[]:
|
|
17
|
-
console.log("This JS runs for each passage in the second section.");
|
|
18
|
-
|
|
19
|
-
This text appears before each passage in this section.
|
|
20
|
-
|
|
21
|
-
[One]:
|
|
22
|
-
1...
|
|
23
|
-
|
|
24
|
-
[two]:
|
|
25
|
-
2...
|
|
26
|
-
|
|
27
|
-
[three]:
|
|
28
|
-
3...
|
|
29
|
-
|
|
30
|
-
[[Next!]]:
|
|
31
|
-
|
|
32
|
-
Final section, no master passages here. [See].
|
|
33
|
-
|
|
34
|
-
[See]:
|
|
35
|
-
The end...
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
I {label:1=walked} to the shops and I bought {label:2=a pint of milk}.
|
|
2
|
-
|
|
3
|
-
But then I thought, hang on, I [don't really like milk](next, @replace 2=beer).
|
|
4
|
-
|
|
5
|
-
[beer]:
|
|
6
|
-
a [crate of beer]
|
|
7
|
-
|
|
8
|
-
[crate of beer]:
|
|
9
|
-
Yes, beer.
|
|
10
|
-
|
|
11
|
-
[next]:
|
|
12
|
-
And then I thought, hang on, I {label:3=[hate walking](@replace 1=teleported, @replace 3=love teleporting)}.
|
|
13
|
-
|
|
14
|
-
[love teleporting]:
|
|
15
|
-
love teleporting, so much I might [[embark on a wild and crazy adventure]](section2)
|
|
16
|
-
|
|
17
|
-
[[section2]]:
|
|
18
|
-
And so it {label:4=began...}
|
|
19
|
-
|
|
20
|
-
[[Or did it?]](section3)
|
|
21
|
-
|
|
22
|
-
[[section3]]:
|
|
23
|
-
@replace 4=ended [abruptly].
|
|
24
|
-
Oh well.
|
|
25
|
-
|
|
26
|
-
[abruptly]:
|
|
27
|
-
That is all.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Choose a number: {rotate:one:two:three}
|
|
2
|
-
|
|
3
|
-
+++OK...
|
|
4
|
-
|
|
5
|
-
Now {rotate result:four:five:six}
|
|
6
|
-
|
|
7
|
-
+++OK...
|
|
8
|
-
|
|
9
|
-
You chose {result}.
|
|
10
|
-
|
|
11
|
-
Now for a sequence: {sequence:one:two:three:four:five}.
|
|
12
|
-
|
|
13
|
-
+++And another...
|
|
14
|
-
|
|
15
|
-
Another sequence: {sequence seqresult:a:b:c:d:e:f:g}.
|
|
16
|
-
|
|
17
|
-
+++Finally...
|
|
18
|
-
|
|
19
|
-
You chose {seqresult}.
|
|
20
|
-
|
|
21
|
-
Here's a sequence that links to another section. {sequence:Ready...:Steady...:[[Go!]]}
|
|
22
|
-
|
|
23
|
-
[[Go!]]:
|
|
24
|
-
|
|
25
|
-
That's all folks!
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
Choose: [[a]], [[b]], [[c]]. Or read this [note].
|
|
2
|
-
|
|
3
|
-
[note]:
|
|
4
|
-
This is a passage.
|
|
5
|
-
|
|
6
|
-
[[a]]:
|
|
7
|
-
Now choose [[b]] or [[c]].
|
|
8
|
-
|
|
9
|
-
[[b]]:
|
|
10
|
-
Now go to [[c]].
|
|
11
|
-
|
|
12
|
-
[[c]]:
|
|
13
|
-
{if seen a:You saw A.}{else:You didn't see A.}
|
|
14
|
-
{if not seen b:You didn't see B.}{else:You saw B.}
|
|
15
|
-
|
|
16
|
-
{if seen note:You looked at the note.}{else:You didn't look at the note.}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
@title Squiffy Example
|
|
2
|
-
|
|
3
|
-
[[Introduction]]:
|
|
4
|
-
# Squiffy Test
|
|
5
|
-
This is [a website link](http://textadventures.co.uk).
|
|
6
|
-
|
|
7
|
-
This should be [a link to a passage](passage). Here's [another one](passage2).
|
|
8
|
-
|
|
9
|
-
You don't need to specify a name - for example, this [link] and this [[section]].
|
|
10
|
-
|
|
11
|
-
And this goes to the [[next section]](section2).
|
|
12
|
-
|
|
13
|
-
This line has links to [[section 3]] and [[section 4]](section four).
|
|
14
|
-
|
|
15
|
-
This line has links to [passage 3] and [passage 4](passage four).
|
|
16
|
-
|
|
17
|
-
Oh look - [it's a passage with an apostrophe].
|
|
18
|
-
|
|
19
|
-
[passage]:
|
|
20
|
-
Here's some text for the passage.
|
|
21
|
-
|
|
22
|
-
[passage2]:
|
|
23
|
-
alert ("This passage has some JavaScript");
|
|
24
|
-
|
|
25
|
-
This is the text for the second passage.
|
|
26
|
-
|
|
27
|
-
[passage 3]:
|
|
28
|
-
Another passage.
|
|
29
|
-
|
|
30
|
-
[passage four]:
|
|
31
|
-
Yet another passage.
|
|
32
|
-
|
|
33
|
-
[link]:
|
|
34
|
-
Here is the text for the simple link.
|
|
35
|
-
|
|
36
|
-
[it's a passage with an apostrophe]:
|
|
37
|
-
Nothing to worry about.
|
|
38
|
-
|
|
39
|
-
[[section2]]:
|
|
40
|
-
|
|
41
|
-
alert ("This section has some JavaScript");
|
|
42
|
-
|
|
43
|
-
This is the next section.
|
|
44
|
-
|
|
45
|
-
[[section]]:
|
|
46
|
-
This is another section.
|
|
47
|
-
|
|
48
|
-
[[section 3]]:
|
|
49
|
-
Another section is here.
|
|
50
|
-
|
|
51
|
-
[[section four]]:
|
|
52
|
-
Some other section.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Choose a gender:
|
|
2
|
-
|
|
3
|
-
* [[Male]](start, gender=male)
|
|
4
|
-
* [[Female]](start, gender=female)
|
|
5
|
-
|
|
6
|
-
[[start]]:
|
|
7
|
-
You chose {gender}.
|
|
8
|
-
|
|
9
|
-
{if gender=male:You are a man.}
|
|
10
|
-
{else:You are a woman.}
|
|
11
|
-
|
|
12
|
-
[Next]
|
|
13
|
-
|
|
14
|
-
[Next]:
|
|
15
|
-
This is a test. {passage} {section}
|
|
16
|
-
|
|
17
|
-
[passage]:
|
|
18
|
-
Text from passage.
|
|
19
|
-
|
|
20
|
-
[[section]]:
|
|
21
|
-
Text from section.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
You are standing in a room. You can see a [hammer].
|
|
2
|
-
|
|
3
|
-
[hammer]:
|
|
4
|
-
It's nice and weighty. Perhaps you want to [[hit yourself in the face with it]](hit)?
|
|
5
|
-
|
|
6
|
-
[[hit]]:
|
|
7
|
-
|
|
8
|
-
squiffy.ui.transition(function(){
|
|
9
|
-
// Create a blackout <div>...
|
|
10
|
-
$("<div/>", {
|
|
11
|
-
id: "blackout"
|
|
12
|
-
}).css({
|
|
13
|
-
position: "fixed",
|
|
14
|
-
top: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
width: "100%",
|
|
17
|
-
height: "100%",
|
|
18
|
-
background: "black",
|
|
19
|
-
display: "none"
|
|
20
|
-
}).appendTo("body");
|
|
21
|
-
|
|
22
|
-
// Fade it in over 6 seconds...
|
|
23
|
-
$("#blackout").fadeIn({
|
|
24
|
-
duration: 6000,
|
|
25
|
-
easing: "easeInQuad",
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// After fading it in...
|
|
29
|
-
setTimeout(function () {
|
|
30
|
-
|
|
31
|
-
// Move to the next section...
|
|
32
|
-
squiffy.story.go("wake up");
|
|
33
|
-
|
|
34
|
-
// Fade out the blackout and remove the <div>...
|
|
35
|
-
$("#blackout").fadeOut({
|
|
36
|
-
duration: 6000,
|
|
37
|
-
easing: "easeInQuad",
|
|
38
|
-
complete: function() {
|
|
39
|
-
$(this).remove();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}, 9000);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Bang.
|
|
48
|
-
|
|
49
|
-
[[wake up]]:
|
|
50
|
-
@clear
|
|
51
|
-
Slowly your eyes open.
|
|
52
|
-
|
|
53
|
-
That was a rather stupid thing to do.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
After clicking two links in this section, an additional passage will be displayed.
|
|
2
|
-
|
|
3
|
-
[One], [two], [three], [four].
|
|
4
|
-
|
|
5
|
-
[One]:
|
|
6
|
-
First passage.
|
|
7
|
-
|
|
8
|
-
[two]:
|
|
9
|
-
Second passage.
|
|
10
|
-
|
|
11
|
-
[three]:
|
|
12
|
-
Third passage.
|
|
13
|
-
|
|
14
|
-
[four]:
|
|
15
|
-
Fourth passage.
|
|
16
|
-
|
|
17
|
-
[@2]:
|
|
18
|
-
This is some extra text to appear after the second click. The [[next section]] is also good.
|
|
19
|
-
|
|
20
|
-
[[next section]]:
|
|
21
|
-
In this section, you can only click one link, and then you'll be taken to the final section.
|
|
22
|
-
|
|
23
|
-
[One], [two], [three], [four].
|
|
24
|
-
|
|
25
|
-
[One]:
|
|
26
|
-
First passage.
|
|
27
|
-
|
|
28
|
-
[two]:
|
|
29
|
-
Second passage.
|
|
30
|
-
|
|
31
|
-
[three]:
|
|
32
|
-
Third passage.
|
|
33
|
-
|
|
34
|
-
[four]:
|
|
35
|
-
Fourth passage.
|
|
36
|
-
|
|
37
|
-
[@1]:
|
|
38
|
-
squiffy.story.go("final section");
|
|
39
|
-
|
|
40
|
-
[[final section]]:
|
|
41
|
-
**THE END**
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
This link exists: [[section]]
|
|
2
|
-
|
|
3
|
-
This link doesn't exist: [[badsection]]
|
|
4
|
-
|
|
5
|
-
This [[other link]](section) does exist.
|
|
6
|
-
|
|
7
|
-
This [[other link]](badsection2) doesn't exit.
|
|
8
|
-
|
|
9
|
-
[[section]]:
|
|
10
|
-
|
|
11
|
-
This passage exists: [passage]
|
|
12
|
-
|
|
13
|
-
This passage doesn't exist: [badpassage]
|
|
14
|
-
|
|
15
|
-
This [other link](passage) does exist.
|
|
16
|
-
|
|
17
|
-
This [other link](badpassage2) doesn't exist.
|
|
18
|
-
|
|
19
|
-
[passage]:
|
|
20
|
-
|
|
21
|
-
This exists. But it has a link to a [non-existent passage].
|
|
22
|
-
|
|
23
|
-
@import warnings2.squiffy
|