@peter.naydenov/cuts 2.1.0 → 2.1.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.
Files changed (46) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/Changelog.md +17 -0
  3. package/dist/cuts.cjs +1 -1
  4. package/dist/cuts.esm.mjs +1 -1
  5. package/dist/cuts.umd.js +1 -1
  6. package/graphify-out/.graphify_labels.json +56 -0
  7. package/graphify-out/.graphify_root +1 -0
  8. package/graphify-out/GRAPH_REPORT.md +116 -247
  9. package/graphify-out/cache/ast/v0.8.39/043be2e32281a59e2bacb95418b95816b558a290aa581434b22666fb9a6a3a6c.json +1 -0
  10. package/graphify-out/cache/ast/v0.8.39/151934b5e716a5f1d14f4954ebca16c64f767c94ea65182896565a0a845a99d8.json +1 -0
  11. package/graphify-out/cache/ast/v0.8.39/2b64175ef58c779348b9f3b1bc212093f30455a8c3b30e90ec66bc0c83893a17.json +1 -0
  12. package/graphify-out/cache/ast/v0.8.39/93e3201ab0f7055efb1bd85240bdae46fcc21d36089825bafeb9ba97e082b25d.json +1 -0
  13. package/graphify-out/cache/ast/v0.8.39/a54f836214535c9d3ff5d4ba866f261748789984734e148a99dff099f0977cd4.json +1 -0
  14. package/graphify-out/cache/ast/v0.8.39/ac32180db1477eed72583ce9d06051d06eb0336e02b1894789b5a039392b7255.json +1 -0
  15. package/graphify-out/cache/ast/v0.8.39/b3a576733a49496a7d162b3a08710f6ca29fd2678532e9406755046f6250acb9.json +1 -0
  16. package/graphify-out/cache/ast/v0.8.39/c2b57052ba235afaf3195c026546eabbe2ab6274aa24bc3e4481f92904fe6a9d.json +1 -0
  17. package/graphify-out/cache/stat-index.json +1 -0
  18. package/graphify-out/graph.html +69 -28
  19. package/graphify-out/graph.json +4052 -1782
  20. package/graphify-out/manifest.json +300 -50
  21. package/package.json +10 -10
  22. package/src/main.js +8 -3
  23. package/src/methods/hide.js +16 -16
  24. package/src/methods/listShortcuts.js +1 -1
  25. package/src/methods/show.js +14 -5
  26. package/test/02-cuts.test.js +169 -0
  27. package/types/findInstructions.d.ts +1 -1
  28. package/types/findInstructions.d.ts.map +1 -1
  29. package/types/main.d.ts +76 -12
  30. package/types/main.d.ts.map +1 -1
  31. package/types/methods/hide.d.ts +1 -1
  32. package/types/methods/hide.d.ts.map +1 -1
  33. package/types/methods/jump.d.ts +1 -1
  34. package/types/methods/jump.d.ts.map +1 -1
  35. package/types/methods/jumpBack.d.ts +2 -2
  36. package/types/methods/jumpBack.d.ts.map +1 -1
  37. package/types/methods/jumpsReset.d.ts +1 -1
  38. package/types/methods/jumpsReset.d.ts.map +1 -1
  39. package/types/methods/listShortcuts.d.ts +1 -1
  40. package/types/methods/listShortcuts.d.ts.map +1 -1
  41. package/types/methods/setScenes.d.ts +11 -17
  42. package/types/methods/setScenes.d.ts.map +1 -1
  43. package/types/methods/show.d.ts +2 -2
  44. package/types/methods/show.d.ts.map +1 -1
  45. package/types/setInstruction.d.ts +1 -1
  46. package/types/setInstruction.d.ts.map +1 -1
@@ -1,52 +1,302 @@
1
1
  {
2
- "playwright.config.js": 1775747587.7230244,
3
- "vite.config.js": 1775747005.1079392,
4
- "vitest.config.js": 1775749596.644355,
5
- "main.js": 1702928911.6192012,
6
- "rollup.config.js": 1715186404.1361377,
7
- "types/findInstructions.d.ts": 1775747014.5687258,
8
- "types/main.d.ts": 1775747014.5962942,
9
- "types/setInstruction.d.ts": 1775747014.5703552,
10
- "types/methods/hide.d.ts": 1775747014.571754,
11
- "types/methods/jumpsReset.d.ts": 1775747014.5811584,
12
- "types/methods/jump.d.ts": 1775747014.5788813,
13
- "types/methods/listShortcuts.d.ts": 1775747014.5725722,
14
- "types/methods/jumpBack.d.ts": 1775747014.5801046,
15
- "types/methods/index.d.ts": 1734032993.8985457,
16
- "types/methods/show.d.ts": 1775747014.5780683,
17
- "types/methods/setScenes.d.ts": 1775747014.5764768,
18
- "types/src/findInstructions.d.ts": 1774331028.2620726,
19
- "types/src/main.d.ts": 1774331028.2866547,
20
- "types/src/setInstruction.d.ts": 1774331028.2635846,
21
- "types/src/methods/hide.d.ts": 1774331028.2649617,
22
- "types/src/methods/jumpsReset.d.ts": 1774331028.2733746,
23
- "types/src/methods/jump.d.ts": 1774331028.2712362,
24
- "types/src/methods/listShortcuts.d.ts": 1774331028.2657318,
25
- "types/src/methods/jumpBack.d.ts": 1774331028.272342,
26
- "types/src/methods/show.d.ts": 1774331028.2705016,
27
- "types/src/methods/setScenes.d.ts": 1774331028.2690504,
28
- "test/01-findPosition.test.js": 1762684004.7208605,
29
- "test/02-cuts.test.js": 1762683999.2773185,
30
- "test-e2e/vite.config.js": 1775747576.199647,
31
- "test-e2e/01-general.test.js": 1775748664.7938879,
32
- "coverage/lcov-report/block-navigation.js": 1775749651.7539763,
33
- "coverage/lcov-report/prettify.js": 1775749651.7545831,
34
- "coverage/lcov-report/sorter.js": 1775749651.7543092,
35
- "src/main.js": 1762682459.954932,
36
- "src/findInstructions.js": 1761203709.521908,
37
- "src/setInstruction.js": 1761165393.1722348,
38
- "src/methods/listShortcuts.js": 1734775137.1596165,
39
- "src/methods/jumpsReset.js": 1760945941.3071249,
40
- "src/methods/jump.js": 1760945931.6560884,
41
- "src/methods/show.js": 1761214660.90501,
42
- "src/methods/jumpBack.js": 1760945937.0249515,
43
- "src/methods/setScenes.js": 1761219590.2996268,
44
- "src/methods/hide.js": 1761195475.0249836,
45
- "Changelog.md": 1776938480.0698996,
46
- "Migration.guide.md": 1762682470.1813977,
47
- "README.md": 1778474994.5648646,
48
- "AGENTS.md": 1780688618.8972664,
49
- "cuts.png": 1762812566.1244016,
50
- "coverage/lcov-report/favicon.png": 1775749651.7540824,
51
- "coverage/lcov-report/sort-arrow-sprite.png": 1775749651.7541811
2
+ "playwright.config.js": {
3
+ "mtime": 1775747587.7230244,
4
+ "ast_hash": "1255e970a054cb38e73ac2af9d25c432",
5
+ "semantic_hash": ""
6
+ },
7
+ "vite.config.js": {
8
+ "mtime": 1775747005.1079392,
9
+ "ast_hash": "123229270d8c2e1864a8ef32eb6d6924",
10
+ "semantic_hash": ""
11
+ },
12
+ "vitest.config.js": {
13
+ "mtime": 1775749596.644355,
14
+ "ast_hash": "d4416e1518a185ef9968179ebd653cbb",
15
+ "semantic_hash": ""
16
+ },
17
+ "main.js": {
18
+ "mtime": 1702928911.6192012,
19
+ "ast_hash": "cc93cd8fa4102761e9a2e77b10ea47a3",
20
+ "semantic_hash": ""
21
+ },
22
+ "rollup.config.js": {
23
+ "mtime": 1715186404.1361377,
24
+ "ast_hash": "cc94eb190cb2b90e8dbf35dccddba6f7",
25
+ "semantic_hash": ""
26
+ },
27
+ "types/findInstructions.d.ts": {
28
+ "mtime": 1783542739.3061938,
29
+ "ast_hash": "98a75d2c0b05b7afdbea430a1590557b",
30
+ "semantic_hash": ""
31
+ },
32
+ "types/main.d.ts": {
33
+ "mtime": 1783542739.3057697,
34
+ "ast_hash": "40be7f4637f1868f8e022c637f46b916",
35
+ "semantic_hash": ""
36
+ },
37
+ "types/setInstruction.d.ts": {
38
+ "mtime": 1783542739.3050709,
39
+ "ast_hash": "320eecb32d022a084b0c682d576cc86e",
40
+ "semantic_hash": ""
41
+ },
42
+ "types/methods/hide.d.ts": {
43
+ "mtime": 1783542739.30511,
44
+ "ast_hash": "1f5fd4a88ec385fdfd9ed4cd99dc77f2",
45
+ "semantic_hash": ""
46
+ },
47
+ "types/methods/jumpsReset.d.ts": {
48
+ "mtime": 1783542739.3050199,
49
+ "ast_hash": "5f915e1ed57047066eb23bce1246a4fa",
50
+ "semantic_hash": ""
51
+ },
52
+ "types/methods/jump.d.ts": {
53
+ "mtime": 1783542739.3050845,
54
+ "ast_hash": "e8150e61f44db4d8dfcb1bb200663ad8",
55
+ "semantic_hash": ""
56
+ },
57
+ "types/methods/listShortcuts.d.ts": {
58
+ "mtime": 1783542739.304983,
59
+ "ast_hash": "9a994d0a00c5146770124e3b1d27b385",
60
+ "semantic_hash": ""
61
+ },
62
+ "types/methods/jumpBack.d.ts": {
63
+ "mtime": 1783542739.3051302,
64
+ "ast_hash": "f12d0743eba6e7024e1ac59b6978b0f3",
65
+ "semantic_hash": ""
66
+ },
67
+ "types/methods/index.d.ts": {
68
+ "mtime": 1734032993.8985457,
69
+ "ast_hash": "efaa8e9c9544d3e6e35775b93eda835e",
70
+ "semantic_hash": ""
71
+ },
72
+ "types/methods/show.d.ts": {
73
+ "mtime": 1783542739.3058105,
74
+ "ast_hash": "b17ebeef974e4e9e67ad63477e2dbe07",
75
+ "semantic_hash": ""
76
+ },
77
+ "types/methods/setScenes.d.ts": {
78
+ "mtime": 1783542739.3051052,
79
+ "ast_hash": "f02ee78e8bf2039c0d70027432dad653",
80
+ "semantic_hash": ""
81
+ },
82
+ "types/src/findInstructions.d.ts": {
83
+ "mtime": 1774331028.2620726,
84
+ "ast_hash": "7e6c6681490eb78b61fba265d254bf8b",
85
+ "semantic_hash": ""
86
+ },
87
+ "types/src/main.d.ts": {
88
+ "mtime": 1774331028.2866547,
89
+ "ast_hash": "4636f053d4be7f40dbbd36b943b3e6a2",
90
+ "semantic_hash": ""
91
+ },
92
+ "types/src/setInstruction.d.ts": {
93
+ "mtime": 1774331028.2635846,
94
+ "ast_hash": "dfdd8df7409736f6d6ab16ce75275786",
95
+ "semantic_hash": ""
96
+ },
97
+ "types/src/methods/hide.d.ts": {
98
+ "mtime": 1774331028.2649617,
99
+ "ast_hash": "4d2c8131db9d91cdcdb1fd21296639b7",
100
+ "semantic_hash": ""
101
+ },
102
+ "types/src/methods/jumpsReset.d.ts": {
103
+ "mtime": 1774331028.2733746,
104
+ "ast_hash": "68de7cbee36bbda74d5a751fcafa7449",
105
+ "semantic_hash": ""
106
+ },
107
+ "types/src/methods/jump.d.ts": {
108
+ "mtime": 1774331028.2712362,
109
+ "ast_hash": "f01c13b561194ea9a96065752e7c9f2a",
110
+ "semantic_hash": ""
111
+ },
112
+ "types/src/methods/listShortcuts.d.ts": {
113
+ "mtime": 1774331028.2657318,
114
+ "ast_hash": "b6123139eb545a56ba5182511dabf484",
115
+ "semantic_hash": ""
116
+ },
117
+ "types/src/methods/jumpBack.d.ts": {
118
+ "mtime": 1774331028.272342,
119
+ "ast_hash": "8223b9c9142689849a1e6f0276464729",
120
+ "semantic_hash": ""
121
+ },
122
+ "types/src/methods/show.d.ts": {
123
+ "mtime": 1774331028.2705016,
124
+ "ast_hash": "a1b7c91cfd5bcc35876eb793ef16c92d",
125
+ "semantic_hash": ""
126
+ },
127
+ "types/src/methods/setScenes.d.ts": {
128
+ "mtime": 1774331028.2690504,
129
+ "ast_hash": "46a38dcab8e723ada98d444a9229c679",
130
+ "semantic_hash": ""
131
+ },
132
+ "test/01-findPosition.test.js": {
133
+ "mtime": 1762684004.7208605,
134
+ "ast_hash": "c385c0cba0d70a503073a6dce9b14567",
135
+ "semantic_hash": ""
136
+ },
137
+ "test/02-cuts.test.js": {
138
+ "mtime": 1762683999.2773185,
139
+ "ast_hash": "f77c842c4efd8a19d19c697be8ef64d3",
140
+ "semantic_hash": ""
141
+ },
142
+ "test-e2e/vite.config.js": {
143
+ "mtime": 1775747576.199647,
144
+ "ast_hash": "2c038512ea00a76b2a6c70b48f3c1895",
145
+ "semantic_hash": ""
146
+ },
147
+ "test-e2e/01-general.test.js": {
148
+ "mtime": 1775748664.7938879,
149
+ "ast_hash": "756bc0b1b3bdaed16406ce6aebf70dd1",
150
+ "semantic_hash": ""
151
+ },
152
+ "coverage/lcov-report/block-navigation.js": {
153
+ "mtime": 1775749651.7539763,
154
+ "ast_hash": "",
155
+ "semantic_hash": ""
156
+ },
157
+ "coverage/lcov-report/prettify.js": {
158
+ "mtime": 1775749651.7545831,
159
+ "ast_hash": "",
160
+ "semantic_hash": ""
161
+ },
162
+ "coverage/lcov-report/sorter.js": {
163
+ "mtime": 1775749651.7543092,
164
+ "ast_hash": "",
165
+ "semantic_hash": ""
166
+ },
167
+ "src/main.js": {
168
+ "mtime": 1762682459.954932,
169
+ "ast_hash": "3a75eb6e5df7c5db478c920694278b8d",
170
+ "semantic_hash": ""
171
+ },
172
+ "src/findInstructions.js": {
173
+ "mtime": 1761203709.521908,
174
+ "ast_hash": "7b8eb9645663150b2aec77052849bcf4",
175
+ "semantic_hash": ""
176
+ },
177
+ "src/setInstruction.js": {
178
+ "mtime": 1761165393.1722348,
179
+ "ast_hash": "fa6217e5d265d1a7ba291d5ac8d963a1",
180
+ "semantic_hash": ""
181
+ },
182
+ "src/methods/listShortcuts.js": {
183
+ "mtime": 1734775137.1596165,
184
+ "ast_hash": "e712a6c59532853de31505444108c58b",
185
+ "semantic_hash": ""
186
+ },
187
+ "src/methods/jumpsReset.js": {
188
+ "mtime": 1760945941.3071249,
189
+ "ast_hash": "cee32469cac4c97e90a4c9015c34c2bb",
190
+ "semantic_hash": ""
191
+ },
192
+ "src/methods/jump.js": {
193
+ "mtime": 1760945931.6560884,
194
+ "ast_hash": "3af4e4f4d73ca19c34acce4c2947c338",
195
+ "semantic_hash": ""
196
+ },
197
+ "src/methods/show.js": {
198
+ "mtime": 1761214660.90501,
199
+ "ast_hash": "ddfde4756f0358a1f3602816b4b32ac7",
200
+ "semantic_hash": ""
201
+ },
202
+ "src/methods/jumpBack.js": {
203
+ "mtime": 1760945937.0249515,
204
+ "ast_hash": "b217605e4f72ca3571665f941cb50547",
205
+ "semantic_hash": ""
206
+ },
207
+ "src/methods/setScenes.js": {
208
+ "mtime": 1761219590.2996268,
209
+ "ast_hash": "7d477001ad2705910ad1c69f476341eb",
210
+ "semantic_hash": ""
211
+ },
212
+ "src/methods/hide.js": {
213
+ "mtime": 1761195475.0249836,
214
+ "ast_hash": "d147619de7988e3484d0d29dc7996293",
215
+ "semantic_hash": ""
216
+ },
217
+ "Changelog.md": {
218
+ "mtime": 1783542720.7995958,
219
+ "ast_hash": "a51efaeb02a5e219b8cc71dce39f58d2",
220
+ "semantic_hash": ""
221
+ },
222
+ "Migration.guide.md": {
223
+ "mtime": 1762682470.1813977,
224
+ "ast_hash": "b1341dfc2e732b6ca3d8d56c62bc1939",
225
+ "semantic_hash": ""
226
+ },
227
+ "README.md": {
228
+ "mtime": 1780838155.3072953,
229
+ "ast_hash": "4160c58f17f75910bfd62f8a6d0c95a0",
230
+ "semantic_hash": ""
231
+ },
232
+ "AGENTS.md": {
233
+ "mtime": 1780688618.8972664,
234
+ "ast_hash": "31e0358c19f45d8f8354305cd71a126a",
235
+ "semantic_hash": ""
236
+ },
237
+ "cuts.png": {
238
+ "mtime": 1762812566.1244016,
239
+ "ast_hash": "0b6d4f225efdb6c122ee41868cb15b53",
240
+ "semantic_hash": ""
241
+ },
242
+ "coverage/lcov-report/favicon.png": {
243
+ "mtime": 1775749651.7540824,
244
+ "ast_hash": "",
245
+ "semantic_hash": ""
246
+ },
247
+ "coverage/lcov-report/sort-arrow-sprite.png": {
248
+ "mtime": 1775749651.7541811,
249
+ "ast_hash": "",
250
+ "semantic_hash": ""
251
+ },
252
+ "package.json": {
253
+ "mtime": 1783542735.9145458,
254
+ "ast_hash": "4b7a0d8d1cd480bbcfe7b85172cb551f",
255
+ "semantic_hash": ""
256
+ },
257
+ "test-e2e/blue.vue": {
258
+ "mtime": 1702928911.621158,
259
+ "ast_hash": "e827023682d04a76cf3f07bbae57d09b",
260
+ "semantic_hash": ""
261
+ },
262
+ "test-e2e/dummy.vue": {
263
+ "mtime": 1702928911.6212878,
264
+ "ast_hash": "8a44cbc803e94b4834ac4f494ab239be",
265
+ "semantic_hash": ""
266
+ },
267
+ "test-e2e/gray.vue": {
268
+ "mtime": 1702928911.6213918,
269
+ "ast_hash": "4a4370b7d776611134903d6db66c2da1",
270
+ "semantic_hash": ""
271
+ },
272
+ "test-e2e/package.json": {
273
+ "mtime": 1775747107.5161173,
274
+ "ast_hash": "bed21e7025c16867b7176fe9fa25e4c8",
275
+ "semantic_hash": ""
276
+ },
277
+ "test-e2e/red.vue": {
278
+ "mtime": 1702928911.6214666,
279
+ "ast_hash": "8ed0e85e11cf56daf12e0f83b31d0d7f",
280
+ "semantic_hash": ""
281
+ },
282
+ "test-results/.last-run.json": {
283
+ "mtime": 1775749625.6012325,
284
+ "ast_hash": "f196824657d8858bc7fa44eecbba38b1",
285
+ "semantic_hash": ""
286
+ },
287
+ "tsconfig.json": {
288
+ "mtime": 1774331190.6502898,
289
+ "ast_hash": "1701bad005eff9dbaee66c58e0ee1825",
290
+ "semantic_hash": ""
291
+ },
292
+ "index.html": {
293
+ "mtime": 1734778257.9280357,
294
+ "ast_hash": "615dec619c3f8ea625e9ab5d63e0171b",
295
+ "semantic_hash": ""
296
+ },
297
+ "test-e2e/index.html": {
298
+ "mtime": 1775749479.7263045,
299
+ "ast_hash": "5b44f88a65f0e46b8433cbc3944748bb",
300
+ "semantic_hash": ""
301
+ }
52
302
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peter.naydenov/cuts",
3
3
  "description": "SPA scene manager",
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "license": "MIT",
6
6
  "author": "Peter Naydenov",
7
7
  "main": "./src/main.js",
@@ -28,22 +28,22 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@peter.naydenov/visual-controller-for-vue3": "^2.3.1",
31
- "@playwright/test": "^1.60.0",
31
+ "@playwright/test": "^1.61.1",
32
32
  "@rollup/plugin-commonjs": "^29.0.3",
33
33
  "@rollup/plugin-node-resolve": "^16.0.3",
34
34
  "@rollup/plugin-terser": "^1.0.0",
35
- "@types/node": "^25.9.2",
35
+ "@types/node": "^26.1.1",
36
36
  "@vitejs/plugin-vue": "^6.0.7",
37
- "@vitest/coverage-v8": "^4.1.8",
38
- "rollup": "^4.61.1",
39
- "typescript": "^6.0.3",
40
- "vite": "^8.0.16",
41
- "vitest": "^4.1.8",
42
- "vue": "^3.5.35"
37
+ "@vitest/coverage-v8": "^4.1.10",
38
+ "rollup": "^4.62.2",
39
+ "typescript": "^7.0.2",
40
+ "vite": "^8.1.3",
41
+ "vitest": "^4.1.10",
42
+ "vue": "^3.5.39"
43
43
  },
44
44
  "dependencies": {
45
45
  "@peter.naydenov/log": "^1.1.1",
46
- "@peter.naydenov/shortcuts": "^4.1.0",
46
+ "@peter.naydenov/shortcuts": "^4.1.1",
47
47
  "ask-for-promise": "^3.1.1"
48
48
  },
49
49
  "keywords": [
package/src/main.js CHANGED
@@ -42,8 +42,11 @@ function main ( cfg= {logLevel:0} ) {
42
42
  , logLevel = cfg.logLevel || 1
43
43
  , log = createLog ({ level:logLevel }, (arg) => {
44
44
  const { type } = arg;
45
- if ( type === 'error' ) {
46
- shortcutMngr.emit ( '@app-error', arg )
45
+ if ( type === 'error' ) {
46
+ // Use the raw emitter (not shortcutMngr.emit) so '@app-error'
47
+ // handlers keep receiving the log entry as their sole argument -
48
+ // shortcutMngr.emit now prepends a { dependencies, type } context object.
49
+ shortcutMngr.getDependencies().emit ( '@app-error', arg )
47
50
  }
48
51
  })
49
52
  , state = {
@@ -164,7 +167,9 @@ function main ( cfg= {logLevel:0} ) {
164
167
  * @param {...*} args - Extra data to pass to the listeners
165
168
  * @returns void
166
169
  */
167
- API.emit = ( event, ...args ) => shortcutMngr.emit ( event, ...args )
170
+ // Use the raw emitter (not shortcutMngr.emit) so listeners keep receiving exactly the
171
+ // args passed here - shortcutMngr.emit prepends a { dependencies, type } context object.
172
+ API.emit = ( event, ...args ) => shortcutMngr.getDependencies().emit ( event, ...args )
168
173
  return API
169
174
  } // main func.
170
175
 
@@ -17,31 +17,31 @@ return function hide ( endSteps=1 ) {
17
17
  , instructions = []
18
18
  , hasParents = currentParents.length > 0
19
19
  ;
20
- let el;
21
-
20
+
22
21
  shortcutMngr.pause () // Stop all shortcuts
23
22
  instructions.push ( setInstruction ( scenes[currentScene].hide )) // Set instruction to hide current scene
24
23
 
25
24
  if ( !hasParents ) state.currentScene = null
26
-
25
+
26
+ let namesToHide = []
27
27
  if ( hasParents && endSteps === '*' ) {
28
- [...currentParents].reverse().forEach ( name => {
29
- el = state.currentParents.at ( -1 )
30
- state.currentScene = el
31
- instructions.push ( setInstruction ( scenes[name].hide))
32
- })
28
+ namesToHide = [...currentParents].reverse ()
33
29
  }
34
30
  if ( hasParents && ![ '*', 1].includes(endSteps) ) {
35
- currentParents.slice ( `-${endSteps-1}` ).reverse().map ( name => {
36
- el = state.currentParents.at ( -1 )
37
- state.currentScene = el
38
- instructions.push ( setInstruction (scenes[name].hide))
39
- })
31
+ namesToHide = currentParents.slice ( `-${endSteps-1}` ).reverse ()
40
32
  }
41
- endSteps = askForPromise.sequence ( instructions )
42
- endSteps.onComplete ( () => {
33
+
34
+ namesToHide.forEach ( name => {
35
+ instructions.push ( setInstruction ( scenes[name].hide))
36
+ // Climb to the parent of the scene just hidden - same technique 'show' uses for its 'hide' steps.
37
+ state.currentScene = scenes[name].parents.at ( -1 ) ?? null
38
+ state.currentParents = state.currentScene ? scenes[state.currentScene].parents : []
39
+ })
40
+
41
+ const goingTask = askForPromise.sequence ( instructions );
42
+ goingTask.onComplete ( () => {
43
43
  shortcutMngr.changeContext ( state.currentScene ) // If state.currentScene is null, then all shortcuts are switched off and currentContext is null
44
- hideTask.done ()
44
+ hideTask.done ()
45
45
  })
46
46
  return hideTask.promise
47
47
  }} // hide func.
@@ -10,7 +10,7 @@ function listShortcuts ( dependencies, state ) {
10
10
  return function listShortcuts ( sceneName ) {
11
11
  const { scenes, sceneNames } = state;
12
12
  if ( ! sceneNames.has ( sceneName ) ) return null
13
- const { show, hide, parents, beforeUnload, afterLoad, ...shortcuts } = scenes[sceneName];
13
+ const { show, hide, parents, beforeHide, afterShow, ...shortcuts } = scenes[sceneName];
14
14
  return Object.keys ( shortcuts )
15
15
  }} // listShortcuts func.
16
16
 
@@ -59,12 +59,15 @@ function show ( dependencies, state ) {
59
59
  }
60
60
 
61
61
  const { show, parents=[] } = scenes[requestedScene];
62
-
62
+
63
+ if ( !state.currentParents ) state.currentParents = []
64
+
63
65
  if ( parents[0] === '*' ) {
64
66
  const overlayTask = setInstruction(show, ...args)()
65
67
  overlayTask.then ( () => showTask.done () )
66
68
  state.currentParents.push ( state.currentScene )
67
69
  state.currentScene = requestedScene
70
+ shortcutMngr.changeContext ( requestedScene ) // Activate the overlay scene's own shortcuts
68
71
  return showTask.promise
69
72
  }
70
73
 
@@ -86,14 +89,18 @@ function show ( dependencies, state ) {
86
89
  state.currentScene = name
87
90
  }
88
91
  else {
89
- let el = scenes[name].parents.at ( -1 )
92
+ // Wildcard overlays aren't climbing their own declared parents ('*' isn't a
93
+ // real scene) - they climb back to whatever scene they were shown on top of.
94
+ let el = ( scenes[name].parents[0] === '*' )
95
+ ? state.currentParents.pop ()
96
+ : scenes[name].parents.at ( -1 )
97
+ ;
90
98
  state.currentScene = el
91
99
  }
92
100
  return scenes[name][action]
93
101
  } // getStep func.
94
102
 
95
- if ( !state.currentParents ) state.currentParents = []
96
- const
103
+ const
97
104
  g = findInstructions ( state.currentScene, state.currentParents, requestedScene, parents )
98
105
  , instructions = []
99
106
  ;
@@ -109,7 +116,9 @@ function show ( dependencies, state ) {
109
116
  goingTask.onComplete ( () => {
110
117
  state.opened = true
111
118
  state.currentScene = requestedScene
112
- state.currentParents = scenes[requestedScene].parents || null
119
+ // Copy - never alias state.currentParents to a scene's own 'parents' array,
120
+ // or later mutations (eg. the wildcard-overlay push above) corrupt the scene definition.
121
+ state.currentParents = scenes[requestedScene].parents ? [...scenes[requestedScene].parents] : null
113
122
  shortcutMngr.changeContext ( requestedScene )
114
123
  if ( typeof scenes[requestedScene].afterShow === 'function' ) scenes[requestedScene].afterShow ({ dependencies: shortcutMngr.getDependencies(), done: () => {} })
115
124
  showTask.done ()