kni 4.0.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +9 -7
- package/console.js +33 -35
- package/describe.js +54 -89
- package/document.js +103 -72
- package/engine.js +436 -407
- package/entry.js +88 -0
- package/evaluate.js +221 -228
- package/excerpt.js +117 -115
- package/grammar.js +1025 -785
- package/html.js +174 -167
- package/inline-lexer.js +155 -125
- package/kni.js +286 -279
- package/link.js +50 -52
- package/outline-lexer.js +64 -37
- package/package.json +27 -34
- package/parser.js +32 -20
- package/path.js +34 -46
- package/readline.js +89 -79
- package/scanner.js +101 -78
- package/scope.js +32 -36
- package/story.js +174 -165
- package/test.js +6 -0
- package/translate-json.js +3 -5
- package/tsconfig.json +11 -0
- package/verify.js +121 -117
- package/wrapper.js +37 -41
- package/template.js +0 -69
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Kris Kowal
|
|
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
|
@@ -29,7 +29,7 @@ Use npm to install and run kni. The kni command line requires Node.js version 4
|
|
|
29
29
|
or greater. Use a major version of kni explicitly.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
|
-
$ npm install kni@
|
|
32
|
+
$ npm install kni@4
|
|
33
33
|
$ PATH=$(pwd)/node_modules/.bin:$PATH
|
|
34
34
|
$ kni
|
|
35
35
|
```
|
|
@@ -82,16 +82,16 @@ $ open hello.html
|
|
|
82
82
|
- [Peruácru][peruacru] is an app for iOS and Android using Apache Cordova.
|
|
83
83
|
A [slice](https://github.com/kriskowal/peruacru.then.land) of the game is open source for illustration.
|
|
84
84
|
|
|
85
|
-
[][peruacru]
|
|
86
86
|
|
|
87
87
|
- The [archery][] prototype illustrates a shop and gambling game.
|
|
88
88
|
|
|
89
|
-
[][archery]
|
|
90
90
|
|
|
91
91
|
- The [journey][] prototype illustrates a survival game over a
|
|
92
92
|
procedurally-generated infinite road.
|
|
93
93
|
|
|
94
|
-
[][journey]
|
|
95
95
|
|
|
96
96
|
- The [airship][] prototype illustrates a narrative that includes
|
|
97
97
|
a simulation of the control and behavior of a steampunk airship.
|
|
@@ -131,12 +131,12 @@ The command line tool can also:
|
|
|
131
131
|
$ kni -J hello.json
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
- Kni can also produce a
|
|
134
|
+
- Kni can also produce a diagnostic view of a story. The first column is
|
|
135
135
|
the thread label, then the instruction type, a description of the
|
|
136
|
-
instruction, and an indicator for the next thread. In the
|
|
136
|
+
instruction, and an indicator for the next thread. In the absence of an
|
|
137
137
|
indicator, the engine proceeds to the next instruction. A forward arrow
|
|
138
138
|
indicates a jump and a backward arrow indicates a return to a calling thread,
|
|
139
|
-
a
|
|
139
|
+
a procession to the next thread of a question or answer sequence, or an
|
|
140
140
|
exit.
|
|
141
141
|
|
|
142
142
|
```
|
|
@@ -162,3 +162,5 @@ DON’T PANIC
|
|
|
162
162
|
|
|
163
163
|
Copyright © 2016 by Kristopher Kowal.
|
|
164
164
|
All rights reserved.
|
|
165
|
+
|
|
166
|
+
[](https://coveralls.io/github/borkshop/kni)
|
package/console.js
CHANGED
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
import Excerpt from './excerpt.js';
|
|
2
|
+
import Wrapper from './wrapper.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var Excerpt = require('./excerpt');
|
|
6
|
-
var Wrapper = require('./wrapper');
|
|
7
|
-
|
|
8
|
-
function Console(writer) {
|
|
4
|
+
export default class Console {
|
|
5
|
+
constructor(writer) {
|
|
9
6
|
this.writer = writer;
|
|
10
7
|
this.wrapper = new Wrapper(writer);
|
|
11
8
|
this.excerpt = new Excerpt();
|
|
12
9
|
this.options = [];
|
|
13
10
|
this.cursor = this.excerpt;
|
|
14
|
-
}
|
|
11
|
+
}
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
write(lift, text, drop) {
|
|
17
14
|
this.cursor.digest(lift, text, drop);
|
|
18
|
-
}
|
|
15
|
+
}
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
break() {
|
|
21
18
|
this.cursor.break();
|
|
22
|
-
}
|
|
19
|
+
}
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
paragraph() {
|
|
25
22
|
this.cursor.paragraph();
|
|
26
|
-
}
|
|
23
|
+
}
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
startOption() {
|
|
26
|
+
const option = new Excerpt();
|
|
30
27
|
this.cursor = option;
|
|
31
28
|
this.options.push(option);
|
|
32
|
-
}
|
|
29
|
+
}
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
stopOption() {
|
|
35
32
|
this.cursor = this.excerpt;
|
|
36
|
-
}
|
|
33
|
+
}
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
flush() {
|
|
39
36
|
this.writer.write('\n');
|
|
40
|
-
}
|
|
37
|
+
}
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
pardon() {
|
|
43
40
|
this.writer.write('?\n');
|
|
44
|
-
}
|
|
41
|
+
}
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
display() {
|
|
47
44
|
this.excerpt.write(this.wrapper);
|
|
48
|
-
for (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
for (let i = 0; i < this.options.length; i++) {
|
|
46
|
+
const number = i + 1;
|
|
47
|
+
const lead = `${`${number}. `.slice(0, 3)} `;
|
|
48
|
+
this.wrapper.word(lead);
|
|
49
|
+
this.wrapper.flush = true;
|
|
50
|
+
this.wrapper.push(' ', ' ');
|
|
51
|
+
this.options[i].write(this.wrapper);
|
|
52
|
+
this.wrapper.pop();
|
|
56
53
|
}
|
|
57
|
-
}
|
|
54
|
+
}
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
clear() {
|
|
60
57
|
this.excerpt = new Excerpt();
|
|
61
58
|
this.options = [];
|
|
62
59
|
this.cursor = this.excerpt;
|
|
63
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/describe.js
CHANGED
|
@@ -1,116 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
const types = {};
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const describe = node => {
|
|
4
|
+
return types[node.type](node);
|
|
5
|
+
};
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
return types[node.type](node);
|
|
7
|
-
}
|
|
7
|
+
export default describe;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
types.text = node => node.text;
|
|
10
10
|
|
|
11
|
-
types.
|
|
12
|
-
return node.text;
|
|
13
|
-
};
|
|
11
|
+
types.echo = node => S(node.expression);
|
|
14
12
|
|
|
15
|
-
types.
|
|
16
|
-
return S(node.expression);
|
|
17
|
-
};
|
|
13
|
+
types.opt = node => `(Q ${node.question.join(' ')}) (A ${node.answer.join(' ')})`;
|
|
18
14
|
|
|
19
|
-
types.
|
|
20
|
-
return '(Q ' + node.question.join(' ') + ') (A ' + node.answer.join(' ') + ')';
|
|
21
|
-
};
|
|
15
|
+
types.goto = _node => '';
|
|
22
16
|
|
|
23
|
-
types.
|
|
24
|
-
return '';
|
|
25
|
-
};
|
|
17
|
+
types.call = node => `${node.label}(${node.args.map(S).join(' ')}) esc ${node.branch}`;
|
|
26
18
|
|
|
27
|
-
types.
|
|
28
|
-
return node.label + '(' + node.args.map(S).join(' ') + ') esc ' + node.branch;
|
|
29
|
-
};
|
|
19
|
+
types.def = node => `(${node.locals.join(' ')})`;
|
|
30
20
|
|
|
31
|
-
types.
|
|
32
|
-
return '(' + node.locals.join(' ') + ')';
|
|
33
|
-
};
|
|
21
|
+
types.jump = node => `${node.branch} if ${S(node.condition)}`;
|
|
34
22
|
|
|
35
|
-
types.
|
|
36
|
-
|
|
23
|
+
types.switch = node => {
|
|
24
|
+
let desc = '';
|
|
25
|
+
if (node.variable) {
|
|
26
|
+
desc += `(${node.variable}+${node.value}) ${S(node.expression)}`;
|
|
27
|
+
} else {
|
|
28
|
+
desc += S(node.expression);
|
|
29
|
+
}
|
|
30
|
+
desc += ` (${node.branches.join(' ')}) W(${node.weights.map(S).join(' ')})`;
|
|
31
|
+
return desc;
|
|
37
32
|
};
|
|
38
33
|
|
|
39
|
-
types.
|
|
40
|
-
var desc = '';
|
|
41
|
-
if (node.variable) {
|
|
42
|
-
desc += '(' + node.variable + '+' + node.value + ') ' + S(node.expression);
|
|
43
|
-
} else {
|
|
44
|
-
desc += S(node.expression);
|
|
45
|
-
}
|
|
46
|
-
desc += ' (' + node.branches.join(' ') + ') W(' + node.weights.map(S).join(' ') + ')';
|
|
47
|
-
return desc;
|
|
48
|
-
};
|
|
34
|
+
types.set = node => `${node.variable} ${S(node.expression)}`;
|
|
49
35
|
|
|
50
|
-
types.
|
|
51
|
-
return node.variable + ' ' + S(node.expression);
|
|
52
|
-
};
|
|
36
|
+
types.move = node => `${S(node.source)} -> ${S(node.target)}`;
|
|
53
37
|
|
|
54
|
-
types.
|
|
55
|
-
return S(node.source) + ' -> ' + S(node.target);
|
|
56
|
-
};
|
|
38
|
+
types.cue = node => node.cue;
|
|
57
39
|
|
|
58
|
-
types.
|
|
59
|
-
return node.cue;
|
|
60
|
-
};
|
|
40
|
+
types.br = _node => '';
|
|
61
41
|
|
|
62
|
-
types.
|
|
63
|
-
return '';
|
|
64
|
-
};
|
|
42
|
+
types.par = _node => '';
|
|
65
43
|
|
|
66
|
-
types.
|
|
67
|
-
return '';
|
|
68
|
-
};
|
|
44
|
+
types.rule = _node => '';
|
|
69
45
|
|
|
70
|
-
types.
|
|
71
|
-
return '';
|
|
72
|
-
};
|
|
46
|
+
types.startJoin = _node => '';
|
|
73
47
|
|
|
74
|
-
types.
|
|
75
|
-
return '';
|
|
76
|
-
};
|
|
48
|
+
types.stopJoin = _node => '';
|
|
77
49
|
|
|
78
|
-
types.
|
|
79
|
-
return '';
|
|
80
|
-
};
|
|
50
|
+
types.delimit = _node => '';
|
|
81
51
|
|
|
82
|
-
types.
|
|
83
|
-
return '';
|
|
84
|
-
};
|
|
52
|
+
types.ask = _node => '';
|
|
85
53
|
|
|
86
|
-
types.
|
|
87
|
-
|
|
54
|
+
types.read = node => {
|
|
55
|
+
let label = node.variable;
|
|
56
|
+
if (node.cue != null) {
|
|
57
|
+
label += ` ${node.cue}`;
|
|
58
|
+
}
|
|
59
|
+
return label;
|
|
88
60
|
};
|
|
89
61
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
62
|
+
const S = args => {
|
|
63
|
+
if (args[0] === 'val' || args[0] === 'get') {
|
|
64
|
+
return args[1];
|
|
65
|
+
} else if (args[0] === 'var') {
|
|
66
|
+
return `(${args[0]} ${V(args[1], args[2])})`;
|
|
67
|
+
} else {
|
|
68
|
+
return `(${args[0]} ${args.slice(1).map(S).join(' ')})`;
|
|
69
|
+
}
|
|
96
70
|
};
|
|
97
71
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return '(' + args[0] + ' ' + V(args[1], args[2]) + ')';
|
|
103
|
-
} else {
|
|
104
|
-
return '(' + args[0] + ' ' + args.slice(1).map(S).join(' ') + ')';
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function V(source, target) {
|
|
109
|
-
var r = '';
|
|
110
|
-
for (var i = 0; i < target.length; i++) {
|
|
111
|
-
r += source[i];
|
|
112
|
-
r += '{' + S(target[i]) + '}';
|
|
113
|
-
}
|
|
72
|
+
const V = (source, target) => {
|
|
73
|
+
let r = '';
|
|
74
|
+
let i;
|
|
75
|
+
for (i = 0; i < target.length; i++) {
|
|
114
76
|
r += source[i];
|
|
115
|
-
|
|
116
|
-
}
|
|
77
|
+
r += `{${S(target[i])}}`;
|
|
78
|
+
}
|
|
79
|
+
r += source[i];
|
|
80
|
+
return r;
|
|
81
|
+
};
|
package/document.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
const linkMatcher = /\s*(\w+:\/\/\S+)$/;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default class Document {
|
|
4
|
+
constructor(element, options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
createPage = undefined,
|
|
7
|
+
meterFaultButton = undefined,
|
|
8
|
+
pageTurnBehavior = 'log',
|
|
9
|
+
} = options;
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
var self = this;
|
|
11
|
+
const self = this;
|
|
7
12
|
this.document = element.ownerDocument;
|
|
8
13
|
this.parent = element;
|
|
9
14
|
this.frame = null;
|
|
@@ -19,92 +24,114 @@ function Document(element, createPage) {
|
|
|
19
24
|
this.options = null;
|
|
20
25
|
this.p = false;
|
|
21
26
|
this.br = false;
|
|
22
|
-
this.onclick =
|
|
27
|
+
this.onclick = event => {
|
|
28
|
+
self.answer(event.target.number);
|
|
29
|
+
};
|
|
23
30
|
this.createPage = createPage || this.createPage;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
this.meterFaultButton = meterFaultButton;
|
|
32
|
+
this.pageTurnBehavior = pageTurnBehavior;
|
|
33
|
+
|
|
27
34
|
Object.seal(this);
|
|
28
|
-
}
|
|
35
|
+
}
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
write(lift, text, drop) {
|
|
38
|
+
const document = this.document;
|
|
32
39
|
lift = this.carry || lift;
|
|
33
40
|
if (this.p) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
this.cursor = document.createElement('p');
|
|
42
|
+
this.cursorParent.insertBefore(this.cursor, this.afterCursor);
|
|
43
|
+
this.p = false;
|
|
44
|
+
this.br = false;
|
|
45
|
+
lift = '';
|
|
39
46
|
}
|
|
40
47
|
if (this.br) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
this.cursor.appendChild(document.createElement('br'));
|
|
49
|
+
this.br = false;
|
|
50
|
+
lift = '';
|
|
51
|
+
}
|
|
52
|
+
const match = linkMatcher.exec(text);
|
|
53
|
+
if (match === null) {
|
|
54
|
+
// TODO merge with prior text node
|
|
55
|
+
this.cursor.appendChild(document.createTextNode(lift + text));
|
|
56
|
+
} else {
|
|
57
|
+
// Support a hyperlink convention.
|
|
58
|
+
if (lift !== '') {
|
|
59
|
+
this.cursor.appendChild(document.createTextNode(lift));
|
|
60
|
+
}
|
|
61
|
+
const link = document.createElement('a');
|
|
62
|
+
link.href = match[1];
|
|
63
|
+
link.target = '_blank';
|
|
64
|
+
link.rel = 'noreferrer';
|
|
65
|
+
link.appendChild(document.createTextNode(text.slice(0, match.index)));
|
|
66
|
+
this.cursor.appendChild(link);
|
|
44
67
|
}
|
|
45
|
-
// TODO merge with prior text node
|
|
46
|
-
this.cursor.appendChild(document.createTextNode(lift + text));
|
|
47
68
|
this.carry = drop;
|
|
48
|
-
}
|
|
69
|
+
}
|
|
49
70
|
|
|
50
|
-
|
|
71
|
+
break() {
|
|
51
72
|
this.br = true;
|
|
52
|
-
}
|
|
73
|
+
}
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
paragraph() {
|
|
55
76
|
this.p = true;
|
|
56
|
-
}
|
|
77
|
+
}
|
|
57
78
|
|
|
58
|
-
|
|
79
|
+
startOption() {
|
|
59
80
|
this.optionIndex++;
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
const document = this.document;
|
|
82
|
+
const tr = document.createElement('tr');
|
|
62
83
|
this.options.appendChild(tr);
|
|
63
|
-
|
|
84
|
+
const th = document.createElement('th');
|
|
64
85
|
tr.appendChild(th);
|
|
65
|
-
th.innerText = this.optionIndex
|
|
66
|
-
|
|
86
|
+
th.innerText = `${this.optionIndex}.`;
|
|
87
|
+
const td = document.createElement('td');
|
|
67
88
|
td.number = this.optionIndex;
|
|
68
89
|
td.onclick = this.onclick;
|
|
69
|
-
td.setAttribute(
|
|
90
|
+
td.setAttribute('aria-role', 'button');
|
|
70
91
|
tr.appendChild(td);
|
|
71
92
|
this.cursor = td;
|
|
72
93
|
this.p = false;
|
|
73
94
|
this.br = false;
|
|
74
95
|
this.carry = '';
|
|
75
|
-
}
|
|
96
|
+
}
|
|
76
97
|
|
|
77
|
-
|
|
98
|
+
stopOption() {
|
|
78
99
|
this.p = false;
|
|
79
100
|
this.br = false;
|
|
80
|
-
}
|
|
101
|
+
}
|
|
81
102
|
|
|
82
|
-
|
|
103
|
+
flush() {
|
|
83
104
|
// No-op (for console only)
|
|
84
|
-
}
|
|
105
|
+
}
|
|
85
106
|
|
|
86
|
-
|
|
107
|
+
pardon() {
|
|
87
108
|
// No-op (for console only)
|
|
88
|
-
}
|
|
109
|
+
}
|
|
89
110
|
|
|
90
|
-
|
|
111
|
+
display() {
|
|
91
112
|
this.frame.style.opacity = 0;
|
|
92
113
|
this.frame.style.transform = 'translateX(2ex)';
|
|
93
114
|
this.parent.appendChild(this.frame);
|
|
94
115
|
|
|
95
116
|
// TODO not this
|
|
96
|
-
|
|
97
|
-
setTimeout(
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
const frame = this.frame;
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
frame.style.opacity = 1;
|
|
120
|
+
frame.style.transform = 'translateX(0)';
|
|
100
121
|
}, 10);
|
|
101
|
-
}
|
|
122
|
+
}
|
|
102
123
|
|
|
103
|
-
|
|
124
|
+
clear() {
|
|
104
125
|
if (this.frame) {
|
|
126
|
+
if (this.pageTurnBehavior === 'log') {
|
|
127
|
+
this.options.remove();
|
|
128
|
+
} else if (this.pageTurnBehavior === 'remove') {
|
|
129
|
+
this.frame.remove();
|
|
130
|
+
} else if (this.pageTurnBehavior === 'fade') {
|
|
105
131
|
this.frame.style.opacity = 0;
|
|
106
132
|
this.frame.style.transform = 'translateX(-2ex)';
|
|
107
|
-
this.frame.addEventListener(
|
|
133
|
+
this.frame.addEventListener('transitionend', this);
|
|
134
|
+
}
|
|
108
135
|
}
|
|
109
136
|
this.createPage(this.document, this);
|
|
110
137
|
this.cursor = null;
|
|
@@ -114,46 +141,50 @@ Document.prototype.clear = function clear() {
|
|
|
114
141
|
this.p = true;
|
|
115
142
|
this.carry = '';
|
|
116
143
|
this.optionIndex = 0;
|
|
117
|
-
}
|
|
144
|
+
}
|
|
118
145
|
|
|
119
|
-
|
|
120
|
-
this.frame = document.createElement(
|
|
121
|
-
this.frame.classList.add(
|
|
146
|
+
createPage(document) {
|
|
147
|
+
this.frame = document.createElement('div');
|
|
148
|
+
this.frame.classList.add('kni-frame');
|
|
122
149
|
this.frame.style.opacity = 0;
|
|
123
150
|
|
|
124
|
-
|
|
125
|
-
A.classList.add(
|
|
151
|
+
const A = document.createElement('div');
|
|
152
|
+
A.classList.add('kni-frame-a');
|
|
126
153
|
this.frame.appendChild(A);
|
|
127
154
|
|
|
128
|
-
|
|
129
|
-
B.classList.add(
|
|
155
|
+
const B = document.createElement('div');
|
|
156
|
+
B.classList.add('kni-frame-b');
|
|
130
157
|
A.appendChild(B);
|
|
131
158
|
|
|
132
|
-
|
|
133
|
-
C.classList.add(
|
|
159
|
+
const C = document.createElement('div');
|
|
160
|
+
C.classList.add('kni-frame-c');
|
|
134
161
|
B.appendChild(C);
|
|
135
162
|
|
|
136
|
-
this.body = document.createElement(
|
|
137
|
-
this.body.classList.add(
|
|
163
|
+
this.body = document.createElement('div');
|
|
164
|
+
this.body.classList.add('kni-body');
|
|
138
165
|
C.appendChild(this.body);
|
|
139
166
|
|
|
140
|
-
this.options = document.createElement(
|
|
167
|
+
this.options = document.createElement('table');
|
|
141
168
|
this.body.appendChild(this.options);
|
|
142
169
|
this.afterBody = this.options;
|
|
143
|
-
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
handleEvent(event) {
|
|
173
|
+
// transitionend on this.frame, only
|
|
174
|
+
event.target.remove();
|
|
175
|
+
}
|
|
144
176
|
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
177
|
+
meterFault() {
|
|
178
|
+
if (this.meterFaultButton) {
|
|
179
|
+
this.body.appendChild(this.meterFaultButton);
|
|
148
180
|
}
|
|
149
|
-
}
|
|
181
|
+
}
|
|
150
182
|
|
|
151
|
-
|
|
152
|
-
};
|
|
183
|
+
ask(_cue) {}
|
|
153
184
|
|
|
154
|
-
|
|
185
|
+
answer(text) {
|
|
155
186
|
this.engine.answer(text);
|
|
156
|
-
}
|
|
187
|
+
}
|
|
157
188
|
|
|
158
|
-
|
|
159
|
-
}
|
|
189
|
+
close() {}
|
|
190
|
+
}
|