@peter.naydenov/cuts 1.6.0 → 2.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/Changelog.md +2 -1
- package/Migration.guide.md +93 -0
- package/README.md +30 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/findInstructions.js.html +352 -0
- package/coverage/lcov-report/src/index.html +146 -0
- package/coverage/lcov-report/src/main.js.html +610 -0
- package/coverage/lcov-report/src/methods/hide.js.html +244 -0
- package/coverage/lcov-report/src/methods/index.html +206 -0
- package/coverage/lcov-report/src/methods/jump.js.html +148 -0
- package/coverage/lcov-report/src/methods/jumpBack.js.html +157 -0
- package/coverage/lcov-report/src/methods/jumpsReset.js.html +133 -0
- package/coverage/lcov-report/src/methods/listShortcuts.js.html +148 -0
- package/coverage/lcov-report/src/methods/setScenes.js.html +313 -0
- package/coverage/lcov-report/src/methods/show.js.html +466 -0
- package/coverage/lcov-report/src/setInstruction.js.html +157 -0
- package/coverage/lcov.info +461 -0
- package/cypress/support/component-index.html +11 -0
- package/dist/cuts.cjs +1 -1
- package/dist/cuts.esm.mjs +1 -1
- package/dist/cuts.umd.js +1 -1
- package/package.json +12 -12
- package/src/main.js +6 -4
- package/test/01-general.cy.js +348 -0
- package/test/blue.vue +13 -0
- package/test/dummy.vue +34 -0
- package/test/gray.vue +12 -0
- package/test/red.vue +11 -0
- package/tsconfig.json +13 -10
- package/types/main.d.ts +2 -2
- package/types/main.d.ts.map +1 -1
- package/test-vitest/01-findPosition.test.js +0 -119
- package/test-vitest/02-cuts.test.js +0 -412
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peter.naydenov/cuts",
|
|
3
3
|
"description": "SPA scene manager",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Peter Naydenov",
|
|
7
7
|
"main": "./src/main.js",
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"url": "git+https://github.com/PeterNaydenov/cuts.git"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@peter.naydenov/visual-controller-for-vue3": "^2.1.
|
|
35
|
-
"@rollup/plugin-commonjs": "^
|
|
34
|
+
"@peter.naydenov/visual-controller-for-vue3": "^2.1.7",
|
|
35
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
36
36
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
37
37
|
"@rollup/plugin-terser": "^0.4.4",
|
|
38
|
-
"@types/node": "^24.
|
|
38
|
+
"@types/node": "^24.10.0",
|
|
39
39
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
40
|
-
"@vitest/coverage-v8": "^4.0.
|
|
41
|
-
"cypress": "^15.
|
|
42
|
-
"rollup": "^4.
|
|
40
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
41
|
+
"cypress": "^15.6.0",
|
|
42
|
+
"rollup": "^4.53.1",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
|
-
"vite": "^7.
|
|
45
|
-
"vitest": "^4.0.
|
|
46
|
-
"vue": "^3.5.
|
|
44
|
+
"vite": "^7.2.2",
|
|
45
|
+
"vitest": "^4.0.8",
|
|
46
|
+
"vue": "^3.5.24"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@peter.naydenov/log": "^1.1.1",
|
|
50
|
-
"@peter.naydenov/shortcuts": "^
|
|
51
|
-
"ask-for-promise": "^3.0
|
|
50
|
+
"@peter.naydenov/shortcuts": "^4.0.0",
|
|
51
|
+
"ask-for-promise": "^3.1.0"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"script",
|
package/src/main.js
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
* History notes:
|
|
9
9
|
* - Started as @peter.naydenov/screen-writer on gitHub for the first time on 2023-11-24;
|
|
10
10
|
* - Version 2.0.0 of screen-writer. Works with shortcuts@3.0.1. Published on March 6th, 2024;
|
|
11
|
+
* - Version 2.0.0 of cuts. Works with shortcuts@4.0.0. Published on November 9th, 2025;
|
|
11
12
|
* - Rename to @peter.naydenov/cuts
|
|
12
13
|
* Changes in documentation and some methods were renamed accordingly.
|
|
13
14
|
* Version 1.0.0.
|
|
14
15
|
* Published for first time as package '@peter.naydenov/cuts' on May 8th, 2024;
|
|
15
16
|
* Extend 'scene' with optional 'afterShow' and 'beforeHide' methods. December 21st, 2024;
|
|
16
17
|
* - Shortcuts@3.2.x. Plugin 'form' is available. August 15th, 2025;
|
|
18
|
+
* - Shortcuts@4.0.0. New plugins 'scroll' and 'hover' are available. November 9th, 2025;
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
21
|
|
|
@@ -74,10 +76,10 @@ function main ( cfg= {logLevel:0} ) {
|
|
|
74
76
|
API.jumpsReset = jumpsReset ( state )
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
|
-
* @typedef {'Key'|'Click'|'Form' } pluginNames
|
|
78
|
-
* @description List of possible plugin names: 'Key', 'Click', 'Form'
|
|
79
|
+
* @typedef {'Key'|'Click'|'Form'|'Hover'|'Scroll' } pluginNames
|
|
80
|
+
* @description List of possible plugin names: 'Key', 'Click', 'Form', 'Hover', 'Scroll'
|
|
79
81
|
*
|
|
80
|
-
* Load a needed shortcut plugins - 'Key', 'Click', 'Form' and so on.
|
|
82
|
+
* Load a needed shortcut plugins - 'Key', 'Click', 'Form', 'Hover', 'Scroll' and so on.
|
|
81
83
|
* It's a async function. Don't forget to 'await' it.
|
|
82
84
|
* @function loadPlugins
|
|
83
85
|
* @param {Array.<pluginNames>} plugins - list of plugins to load
|
|
@@ -114,7 +116,7 @@ function main ( cfg= {logLevel:0} ) {
|
|
|
114
116
|
* @param {string} note - note, provided to action functions
|
|
115
117
|
* @returns void
|
|
116
118
|
*/
|
|
117
|
-
|
|
119
|
+
API.setNote = note => shortcutMngr.setNote ( note )
|
|
118
120
|
|
|
119
121
|
/**
|
|
120
122
|
* @function listScenes
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import VisualController from '@peter.naydenov/visual-controller-for-vue3' // Docs : https://github.com/PeterNaydenov/visual-controller-for-vue3
|
|
4
|
+
import { expect } from 'chai'
|
|
5
|
+
import cuts from '../src/main.js'
|
|
6
|
+
import { pluginClick } from '@peter.naydenov/shortcuts'
|
|
7
|
+
|
|
8
|
+
import Dummy from './dummy.vue'
|
|
9
|
+
import Red from './red.vue'
|
|
10
|
+
import Blue from './blue.vue'
|
|
11
|
+
import Gray from './gray.vue'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
describe ( 'General', () => {
|
|
16
|
+
|
|
17
|
+
it ( 'Start a sreenWriter. ScreenWriter API', () => {
|
|
18
|
+
const script = cuts ();
|
|
19
|
+
expect ( script ).to.have.property ( 'show' )
|
|
20
|
+
expect ( script ).to.have.property ( 'hide' )
|
|
21
|
+
expect ( script ).to.have.property ( 'setScenes' )
|
|
22
|
+
expect ( script ).to.have.property ( 'setNote' )
|
|
23
|
+
expect ( script ).to.have.property ( 'listScenes' )
|
|
24
|
+
expect ( script ).to.have.property ( 'listShortcuts' )
|
|
25
|
+
expect ( script ).to.have.property ( 'setDependencies' )
|
|
26
|
+
expect ( script ).to.have.property ( 'getDependencies' )
|
|
27
|
+
}) // it start a director
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
it ( 'Load a top level page', done => {
|
|
32
|
+
let
|
|
33
|
+
render = false
|
|
34
|
+
, click = false
|
|
35
|
+
, html = new VisualController ()
|
|
36
|
+
;
|
|
37
|
+
const
|
|
38
|
+
script = cuts ()
|
|
39
|
+
, d = document.querySelector ('[data-cy-root]')
|
|
40
|
+
, testScene = {
|
|
41
|
+
show : ({ task, dependencies }) => {
|
|
42
|
+
const { html } = dependencies;
|
|
43
|
+
html.publish ( Red, {}, 'container' )
|
|
44
|
+
render = true
|
|
45
|
+
task.done ()
|
|
46
|
+
}
|
|
47
|
+
, hide : ({task, dependencies}) => {
|
|
48
|
+
const { html } = dependencies;
|
|
49
|
+
html.destroy ( 'container' )
|
|
50
|
+
task.done ()
|
|
51
|
+
}
|
|
52
|
+
, 'click: left-1' : ({dependencies,target}) => {
|
|
53
|
+
click = true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
;
|
|
57
|
+
script.enablePlugin ( pluginClick )
|
|
58
|
+
d.id = 'root'
|
|
59
|
+
html.publish ( Dummy, {}, 'root' )
|
|
60
|
+
|
|
61
|
+
cy.wait ( 0 )
|
|
62
|
+
.then ( () => {
|
|
63
|
+
script.setDependencies ({ html })
|
|
64
|
+
script.setScenes ([
|
|
65
|
+
{ name:'test', scene:testScene }
|
|
66
|
+
])
|
|
67
|
+
script.show ({ scene : 'test' })
|
|
68
|
+
// cy.get ( '#target' ).click ()
|
|
69
|
+
})
|
|
70
|
+
.then ( () => {
|
|
71
|
+
expect ( render ).to.be.true
|
|
72
|
+
// expect ( click ).to.be.true
|
|
73
|
+
return cy.wait ( 0 )
|
|
74
|
+
})
|
|
75
|
+
.then ( () => {
|
|
76
|
+
return script.hide ()
|
|
77
|
+
})
|
|
78
|
+
.then ( () => {
|
|
79
|
+
const pageContent = document.getElementById('container').innerHTML
|
|
80
|
+
expect ( pageContent ).to.be.empty
|
|
81
|
+
done ()
|
|
82
|
+
})
|
|
83
|
+
}) // it load a top level page
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
it ( 'Load a deep level page', done => {
|
|
88
|
+
let
|
|
89
|
+
render = false
|
|
90
|
+
, click = false
|
|
91
|
+
, html = new VisualController ()
|
|
92
|
+
;
|
|
93
|
+
const
|
|
94
|
+
script = cuts ()
|
|
95
|
+
, d = document.querySelector ('[data-cy-root]' )
|
|
96
|
+
, testScene = {
|
|
97
|
+
show : ({ task, dependencies }) => {
|
|
98
|
+
const { html } = dependencies;
|
|
99
|
+
html.publish ( Red, {}, 'container' )
|
|
100
|
+
render = true
|
|
101
|
+
task.done ()
|
|
102
|
+
}
|
|
103
|
+
, hide : ({task, dependencies}) => {
|
|
104
|
+
const { html } = dependencies;
|
|
105
|
+
html.destroy ( 'container' )
|
|
106
|
+
task.done ()
|
|
107
|
+
}
|
|
108
|
+
, parents : [ 'blue' ]
|
|
109
|
+
, 'click: 1-left' : ({dependencies,target}) => { // Order in the event name after the prefix is not important
|
|
110
|
+
click = true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
, bluePage = {
|
|
114
|
+
show : ({ task, dependencies }) => {
|
|
115
|
+
const { html } = dependencies;
|
|
116
|
+
html.publish ( Blue, {}, 'blue' )
|
|
117
|
+
task.done ()
|
|
118
|
+
}
|
|
119
|
+
, hide : ({task, dependencies}) => {
|
|
120
|
+
const { html } = dependencies;
|
|
121
|
+
html.destroy ( 'blue' )
|
|
122
|
+
task.done ()
|
|
123
|
+
}
|
|
124
|
+
, 'click: left-1' : ({dependencies,target}) => {}
|
|
125
|
+
}
|
|
126
|
+
;
|
|
127
|
+
script.enablePlugin ( pluginClick )
|
|
128
|
+
d.id = 'root'
|
|
129
|
+
html.publish ( Dummy, {}, 'root' )
|
|
130
|
+
|
|
131
|
+
cy.wait ( 0 )
|
|
132
|
+
.then ( () => {
|
|
133
|
+
script.setDependencies ({ html })
|
|
134
|
+
script.setScenes ([
|
|
135
|
+
{ name:'test' , scene : testScene }
|
|
136
|
+
, { name: 'blue', scene : bluePage }
|
|
137
|
+
])
|
|
138
|
+
script.show ({ scene: 'test' })
|
|
139
|
+
cy.get ( '#target' ).click ()
|
|
140
|
+
})
|
|
141
|
+
.then ( () => {
|
|
142
|
+
expect ( render ).to.be.true
|
|
143
|
+
expect ( click ).to.be.true
|
|
144
|
+
return cy.wait ( 0 )
|
|
145
|
+
})
|
|
146
|
+
.then ( () => {
|
|
147
|
+
return script.hide ( '*' )
|
|
148
|
+
})
|
|
149
|
+
.then ( () => {
|
|
150
|
+
const pageContent = document.getElementById('container').innerHTML
|
|
151
|
+
expect ( pageContent ).to.be.empty
|
|
152
|
+
done ()
|
|
153
|
+
})
|
|
154
|
+
}) // it load a deep level page
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
it ( 'Turn to other branch', done => {
|
|
159
|
+
let
|
|
160
|
+
render = false
|
|
161
|
+
, click = false
|
|
162
|
+
, html = new VisualController ()
|
|
163
|
+
;
|
|
164
|
+
const
|
|
165
|
+
script = cuts ()
|
|
166
|
+
, d = document.querySelector ('[data-cy-root]' )
|
|
167
|
+
, testScene = {
|
|
168
|
+
show : ({ task, dependencies }) => {
|
|
169
|
+
const { html } = dependencies;
|
|
170
|
+
html.publish ( Red, {}, 'subgray' ) // subgray is inside 'blue' component
|
|
171
|
+
render = true
|
|
172
|
+
task.done ()
|
|
173
|
+
}
|
|
174
|
+
, hide : ({task, dependencies}) => {
|
|
175
|
+
const { html } = dependencies;
|
|
176
|
+
html.destroy ( 'subgray' )
|
|
177
|
+
task.done ()
|
|
178
|
+
}
|
|
179
|
+
, parents : [ 'blue' ]
|
|
180
|
+
, 'click: left-1' : ({dependencies,target}) => {
|
|
181
|
+
click = true
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
, bluePage = {
|
|
185
|
+
show : ({ task, dependencies }) => {
|
|
186
|
+
const { html } = dependencies;
|
|
187
|
+
html.publish ( Blue, {}, 'blue' )
|
|
188
|
+
task.done ()
|
|
189
|
+
}
|
|
190
|
+
, hide : ({task, dependencies}) => {
|
|
191
|
+
const { html } = dependencies;
|
|
192
|
+
html.destroy ( 'blue' )
|
|
193
|
+
task.done ()
|
|
194
|
+
}
|
|
195
|
+
, 'click: left-1' : ({dependencies,target}) => {}
|
|
196
|
+
}
|
|
197
|
+
, grayPage = {
|
|
198
|
+
show : ({ task, dependencies }) => {
|
|
199
|
+
const { html } = dependencies;
|
|
200
|
+
html.publish ( Gray, {}, 'subgray' )
|
|
201
|
+
task.done ()
|
|
202
|
+
}
|
|
203
|
+
, hide : ({task, dependencies}) => {
|
|
204
|
+
const { html } = dependencies;
|
|
205
|
+
html.destroy ( 'subgray' )
|
|
206
|
+
task.done ()
|
|
207
|
+
}
|
|
208
|
+
, parents : [ 'blue' ]
|
|
209
|
+
, 'click: left-1' : ({dependencies,target}) => {}
|
|
210
|
+
}
|
|
211
|
+
;
|
|
212
|
+
script.enablePlugin ( pluginClick )
|
|
213
|
+
d.id = 'root'
|
|
214
|
+
html.publish ( Dummy, {}, 'root' )
|
|
215
|
+
|
|
216
|
+
cy.wait ( 0 )
|
|
217
|
+
.then ( () => {
|
|
218
|
+
script.setDependencies ({ html })
|
|
219
|
+
script.setScenes ([
|
|
220
|
+
{ name:'test', scene : testScene }
|
|
221
|
+
, { name: 'blue', scene : bluePage }
|
|
222
|
+
, { name: 'gray', scene : grayPage }
|
|
223
|
+
])
|
|
224
|
+
script.show ({ scene : 'test' })
|
|
225
|
+
cy.get ( '#target' ).click ()
|
|
226
|
+
})
|
|
227
|
+
.then ( () => {
|
|
228
|
+
expect ( render ).to.be.true
|
|
229
|
+
expect ( click ).to.be.true
|
|
230
|
+
return cy.wait ( 0 )
|
|
231
|
+
})
|
|
232
|
+
.then ( () => script.show ({ scene : 'gray' } ))
|
|
233
|
+
.then ( () => {
|
|
234
|
+
const
|
|
235
|
+
red = document.querySelectorAll ( '.red' )
|
|
236
|
+
, blue = document.querySelectorAll ( '.gray' )
|
|
237
|
+
;
|
|
238
|
+
expect ( blue.length ).to.be.equal ( 1 )
|
|
239
|
+
expect ( red.length ).to.be.equal ( 0 )
|
|
240
|
+
done ()
|
|
241
|
+
})
|
|
242
|
+
}) // it turn to other branch
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
it ( 'Jump and jumpBack', done => {
|
|
247
|
+
const
|
|
248
|
+
script = cuts ()
|
|
249
|
+
, myLocations = []
|
|
250
|
+
, testScene = {
|
|
251
|
+
show : ({ task, dependencies }) => {
|
|
252
|
+
myLocations.push ( 'test scene' )
|
|
253
|
+
task.done ()
|
|
254
|
+
}
|
|
255
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
256
|
+
}
|
|
257
|
+
, bluePage = {
|
|
258
|
+
show : ({ task, dependencies }) => {
|
|
259
|
+
myLocations.push ( 'blue scene' )
|
|
260
|
+
task.done ()
|
|
261
|
+
}
|
|
262
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
263
|
+
, 'click: left-1' : ({dependencies,target}) => {}
|
|
264
|
+
}
|
|
265
|
+
, grayPage = {
|
|
266
|
+
show : ({ task, dependencies }) => {
|
|
267
|
+
myLocations.push ( 'gray scene' )
|
|
268
|
+
task.done ()
|
|
269
|
+
}
|
|
270
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
271
|
+
}
|
|
272
|
+
;
|
|
273
|
+
|
|
274
|
+
script.setScenes ([
|
|
275
|
+
{ name:'test', scene : testScene }
|
|
276
|
+
, { name: 'blue', scene : bluePage }
|
|
277
|
+
, { name: 'gray', scene : grayPage }
|
|
278
|
+
])
|
|
279
|
+
|
|
280
|
+
script.show ({ scene : 'test' })
|
|
281
|
+
.then ( () => script.jump ({ scene : 'blue' })) // Go from test to blue. Remember 'test'
|
|
282
|
+
.then ( () => script.jump ({ scene : 'gray' })) // Go from blue to gray. Remember 'blue'
|
|
283
|
+
.then ( () => script.jumpBack ()) // Go back to blue. Taken from the stack
|
|
284
|
+
.then ( () => script.jumpBack ()) // Go back to test. Taken from the stack
|
|
285
|
+
.then ( () => script.jumpBack ()) // this should do nothing - no more back hops in stack
|
|
286
|
+
.then ( () => {
|
|
287
|
+
expect ( myLocations ).to.be.deep.equal ([
|
|
288
|
+
'test scene',
|
|
289
|
+
'blue scene',
|
|
290
|
+
'gray scene',
|
|
291
|
+
'blue scene',
|
|
292
|
+
'test scene'
|
|
293
|
+
])
|
|
294
|
+
done ()
|
|
295
|
+
})
|
|
296
|
+
}) // it jump
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
it ( 'Jump and jumpsReset', done => {
|
|
301
|
+
const
|
|
302
|
+
script = cuts ()
|
|
303
|
+
, myLocations = []
|
|
304
|
+
, testScene = {
|
|
305
|
+
show : ({ task, dependencies }) => {
|
|
306
|
+
myLocations.push ( 'test scene' )
|
|
307
|
+
task.done ()
|
|
308
|
+
}
|
|
309
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
310
|
+
}
|
|
311
|
+
, bluePage = {
|
|
312
|
+
show : ({ task, dependencies }) => {
|
|
313
|
+
myLocations.push ( 'blue scene' )
|
|
314
|
+
task.done ()
|
|
315
|
+
}
|
|
316
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
317
|
+
, 'click: left-1' : ({dependencies,target}) => {}
|
|
318
|
+
}
|
|
319
|
+
, grayPage = {
|
|
320
|
+
show : ({ task, dependencies }) => {
|
|
321
|
+
myLocations.push ( 'gray scene' )
|
|
322
|
+
task.done ()
|
|
323
|
+
}
|
|
324
|
+
, hide : ({task, dependencies}) => task.done ()
|
|
325
|
+
}
|
|
326
|
+
;
|
|
327
|
+
|
|
328
|
+
script.setScenes ([
|
|
329
|
+
{ name:'test', scene : testScene }
|
|
330
|
+
, { name: 'blue', scene : bluePage }
|
|
331
|
+
, { name: 'gray', scene : grayPage }
|
|
332
|
+
])
|
|
333
|
+
|
|
334
|
+
script.show ({ scene : 'test' })
|
|
335
|
+
.then ( () => script.jump ({ scene : 'blue' })) // Go from test to blue. Remember 'test'
|
|
336
|
+
.then ( () => script.jump ({ scene : 'gray' })) // Go from blue to gray. Remember 'blue'
|
|
337
|
+
.then ( () => script.jumpsReset () ) // Clear the jump stack
|
|
338
|
+
.then ( () => script.jumpBack ()) // This should do nothing - no back hops
|
|
339
|
+
.then ( () => {
|
|
340
|
+
expect ( myLocations ).to.be.deep.equal ([
|
|
341
|
+
'test scene',
|
|
342
|
+
'blue scene',
|
|
343
|
+
'gray scene',
|
|
344
|
+
])
|
|
345
|
+
done ()
|
|
346
|
+
})
|
|
347
|
+
}) // it jump
|
|
348
|
+
}) // describe
|
package/test/blue.vue
ADDED
package/test/dummy.vue
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h1>Test</h1>
|
|
4
|
+
<p id="target">Test <a href="#">lorem ipsum</a></p>
|
|
5
|
+
<div id="container">
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
<div id="blue"></div>
|
|
9
|
+
<div id="gray"></div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
:root {
|
|
15
|
+
--blue: #007bff;
|
|
16
|
+
--gray: #6c757d;
|
|
17
|
+
--link-color: rgb(204, 51, 10);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body.dark {
|
|
21
|
+
--background-color: #000;
|
|
22
|
+
--link-color: rgb(249, 249, 249);
|
|
23
|
+
background-color: var(--background-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#target {
|
|
27
|
+
--blue: var(--link-color);
|
|
28
|
+
color: var(--blue);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#target a {
|
|
32
|
+
color: var(--link-color);
|
|
33
|
+
}
|
|
34
|
+
</style>
|
package/test/gray.vue
ADDED
package/test/red.vue
ADDED
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": ["./src/**/*"],
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
"exclude": ["./test-vitest/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"checkJs": false,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"emitDeclarationOnly": true,
|
|
9
|
+
"outDir": "types",
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"target": "ES2022",
|
|
13
|
+
"module": "ES2022",
|
|
14
|
+
"skipLibCheck": true
|
|
15
|
+
}
|
|
13
16
|
}
|
package/types/main.d.ts
CHANGED
|
@@ -18,10 +18,10 @@ declare function main(cfg?: {
|
|
|
18
18
|
hops?: number;
|
|
19
19
|
}, ...args?: any[]) => Promise<any> | undefined;
|
|
20
20
|
jumpsReset: () => void;
|
|
21
|
-
loadPlugins(plugins: Array<"Key" | "Click" | "Form">): Promise<Function[]>;
|
|
21
|
+
loadPlugins(plugins: Array<"Key" | "Click" | "Form" | "Hover" | "Scroll">): Promise<Function[]>;
|
|
22
22
|
setDependencies(deps: any): void;
|
|
23
23
|
getDependencies(): any;
|
|
24
|
-
setNote(note: string):
|
|
24
|
+
setNote(note: string): void;
|
|
25
25
|
listScenes(): Array<string>;
|
|
26
26
|
enablePlugin(plugin: Function, options?: any): void;
|
|
27
27
|
disablePlugin(pluginName: string): void;
|
package/types/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AAsCA;;;;;;;;;;;;;;;;;;;yBA8CmB,KAAK,+CAAc,GACjB,OAAO,CAAE,UAAU,CAAC;0BAgBtB,GAAC;uBAQC,GAAC;kBAMH,MAAM;kBAQJ,KAAK,CAAE,MAAM,CAAC;6CAQhB,GAAC;8BAQD,MAAM;;gBAuBL,MAAM,WACH,GAAC,EAAA;EAKvB"}
|