@peter.naydenov/cuts 1.4.5 → 1.6.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 +55 -6
- package/README.md +1 -0
- package/dist/cuts.cjs +1 -1
- package/dist/cuts.esm.mjs +1 -1
- package/dist/cuts.umd.js +1 -1
- package/package.json +4 -4
- package/src/findInstructions.js +18 -13
- package/src/main.js +21 -2
- package/src/methods/hide.js +2 -2
- package/src/methods/setScenes.js +27 -11
- package/src/methods/show.js +43 -45
- package/test-vitest/01-findPosition.test.js +25 -14
- package/test-vitest/02-cuts.test.js +412 -0
- package/types/findInstructions.d.ts +2 -2
- package/types/findInstructions.d.ts.map +1 -1
- package/types/main.d.ts +1 -0
- package/types/main.d.ts.map +1 -1
- package/types/methods/setScenes.d.ts +20 -4
- package/types/methods/setScenes.d.ts.map +1 -1
- package/types/methods/show.d.ts.map +1 -1
|
@@ -3,10 +3,10 @@ export default findInstructions;
|
|
|
3
3
|
* @function findInstructions
|
|
4
4
|
* @description Generator that yields instructions for transitioning between scenes
|
|
5
5
|
* @param {string|null} currentName - current scene name
|
|
6
|
-
* @param {Array.<string
|
|
6
|
+
* @param {Array.<string>} currentParents - current scene parents
|
|
7
7
|
* @param {string} targetName - target scene name
|
|
8
8
|
* @param {Array.<string>} targetParents - target scene parents
|
|
9
9
|
* @yields {Array.<string, 'show'|'hide'>} - instruction array with scene name and action
|
|
10
10
|
*/
|
|
11
|
-
declare function findInstructions(currentName: string | null, currentParents: Array<string
|
|
11
|
+
declare function findInstructions(currentName: string | null, currentParents: Array<string>, targetName: string, targetParents: Array<string>): Generator<string[], void, unknown>;
|
|
12
12
|
//# sourceMappingURL=findInstructions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findInstructions.d.ts","sourceRoot":"","sources":["../src/findInstructions.js"],"names":[],"mappings":";AAGA;;;;;;;;GAQG;AACH,+CANW,MAAM,GAAC,IAAI,kBACX,KAAK,CAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"findInstructions.d.ts","sourceRoot":"","sources":["../src/findInstructions.js"],"names":[],"mappings":";AAGA;;;;;;;;GAQG;AACH,+CANW,MAAM,GAAC,IAAI,kBACX,KAAK,CAAE,MAAM,CAAC,cACd,MAAM,iBACN,KAAK,CAAE,MAAM,CAAC,sCAyExB"}
|
package/types/main.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare function main(cfg?: {
|
|
|
25
25
|
listScenes(): Array<string>;
|
|
26
26
|
enablePlugin(plugin: Function, options?: any): void;
|
|
27
27
|
disablePlugin(pluginName: string): void;
|
|
28
|
+
getState(): any;
|
|
28
29
|
emit(event: string, ...args: any[]): void;
|
|
29
30
|
};
|
|
30
31
|
//# sourceMappingURL=main.d.ts.map
|
package/types/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AAoCA;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AAoCA;;;;;;;;;;;;;;;;;;;yBA8CmB,KAAK,0BAAc,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"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export default setScenes;
|
|
2
|
+
export type AskObject = {
|
|
3
|
+
/**
|
|
4
|
+
* - Mark the task as done
|
|
5
|
+
*/
|
|
6
|
+
done: Function;
|
|
7
|
+
};
|
|
2
8
|
export type SceneObject = {
|
|
3
9
|
/**
|
|
4
10
|
* - load interface and prerequisites for the scene;
|
|
5
11
|
*/
|
|
6
|
-
show:
|
|
12
|
+
show: (arg0: {
|
|
13
|
+
task: AskObject;
|
|
14
|
+
dependencies: any;
|
|
15
|
+
}) => void;
|
|
7
16
|
/**
|
|
8
17
|
* - run after scene is loaded. Optional. Returns true to continue loading, false to cancel;
|
|
9
18
|
*/
|
|
@@ -11,7 +20,10 @@ export type SceneObject = {
|
|
|
11
20
|
/**
|
|
12
21
|
* - Reverse the settings from 'show';
|
|
13
22
|
*/
|
|
14
|
-
hide: (
|
|
23
|
+
hide: (arg0: {
|
|
24
|
+
task: AskObject;
|
|
25
|
+
dependencies: any;
|
|
26
|
+
}) => void;
|
|
15
27
|
/**
|
|
16
28
|
* - Run before scene is hidden. Optional;
|
|
17
29
|
*/
|
|
@@ -35,11 +47,15 @@ export type sceneDescription = {
|
|
|
35
47
|
*/
|
|
36
48
|
scene: SceneObject;
|
|
37
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} AskObject
|
|
52
|
+
* @property {function} done - Mark the task as done
|
|
53
|
+
*/
|
|
38
54
|
/**
|
|
39
55
|
* @typedef {Object} SceneObject
|
|
40
|
-
* @property {function} show - load interface and prerequisites for the scene;
|
|
56
|
+
* @property {function({task: AskObject, dependencies: *}): void} show - load interface and prerequisites for the scene;
|
|
41
57
|
* @property {function():boolean} [afterShow] - run after scene is loaded. Optional. Returns true to continue loading, false to cancel;
|
|
42
|
-
* @property {function():void} hide - Reverse the settings from 'show';
|
|
58
|
+
* @property {function({task: AskObject, dependencies: *}): void} hide - Reverse the settings from 'show';
|
|
43
59
|
* @property {function():void} [beforeHide] - Run before scene is hidden. Optional;
|
|
44
60
|
* @property {Array.<string>} [parents] - list of parent scene names.
|
|
45
61
|
* @property {*} ... - shortcut descriptions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setScenes.d.ts","sourceRoot":"","sources":["../../src/methods/setScenes.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setScenes.d.ts","sourceRoot":"","sources":["../../src/methods/setScenes.js"],"names":[],"mappings":";;;;;;;;;;;UASc,CAAS,IAAkC,EAAlC;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,YAAY,EAAE,GAAC,CAAA;KAAC,KAAG,IAAI;;;;gBAClD,MAAW,OAAO;;;;UAClB,CAAS,IAAkC,EAAlC;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,YAAY,EAAE,GAAC,CAAA;KAAC,KAAG,IAAI;;;;iBAClD,MAAW,IAAI;;;;cACf,KAAK,CAAE,MAAM,CAAC;;;;QACd,GAAC;;;;;;UAOD,MAAM;;;;WACN,WAAW;;AAnBzB;;;GAGG;AACH;;;;;;;;GAQG;AAIH;;;;GAIG;AAKH,4DAOgC,MAJhB,gBAAgB,EAII,UAkClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../src/methods/show.js"],"names":[],"mappings":";AAIA,2FAKG;IAAwB,KAAK,EAArB,MAAM;IACW,OAAO,GAChC;QAAiC,GAAG,EAA5B,OAAO;KACf;CAAA,
|
|
1
|
+
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../src/methods/show.js"],"names":[],"mappings":";AAIA,2FAKG;IAAwB,KAAK,EAArB,MAAM;IACW,OAAO,GAChC;QAAiC,GAAG,EAA5B,OAAO;KACf;CAAA,mCA4GF"}
|