@vnejs/contracts.core.scenario 0.1.7 → 0.1.9

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.
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Positional argument slot after `$/% <name>` (and optional action).
3
+ * Consumed by editor tooling; not used at runtime.
4
+ */
5
+ export type ScenarioArg = {
6
+ kind: "id";
7
+ optional?: boolean;
8
+ /**
9
+ * When true, only `{…}` / `"…"` / `'…'` tokens match
10
+ * (e.g. optional sprite variation between position and transition).
11
+ */
12
+ delimited?: boolean;
13
+ } | {
14
+ kind: "number";
15
+ optional?: boolean;
16
+ } | {
17
+ kind: "enum";
18
+ /** Stable key → scenario literal (same shape as EXEC_ACTIONS). */
19
+ values: Record<string, string>;
20
+ optional?: boolean;
21
+ };
1
22
  /**
2
23
  * Declarative .vne command surface contributed by a plugin contract.
3
24
  * Tooling (editor, validation) aggregates these; not registered in VNE at runtime.
@@ -7,8 +28,22 @@ export type ScenarioCommandEntry = {
7
28
  * Named actions after `$ <module>` / `% <block>`.
8
29
  * Keys are stable identifiers; values are the literals used in scenario lines
9
30
  * (typically the same object as EXEC_ACTIONS).
31
+ *
32
+ * Used for action-first commands (`$ stack jump …`). For name-first commands
33
+ * (`$ flag <name> set`, `$ counter <name> ++`) prefer `args` and omit relying
34
+ * on first-token action matching.
10
35
  */
11
36
  actions?: Record<string, string>;
37
+ /**
38
+ * Positional args when the first token is not an action
39
+ * (e.g. `$ text.meet <speaker>`, `$ flag <name> [set|unset]`).
40
+ */
41
+ args?: readonly ScenarioArg[];
42
+ /**
43
+ * Positional args after a matched action literal
44
+ * (e.g. `$ ul.sprite show <id> <position>`).
45
+ */
46
+ argsByAction?: Record<string, readonly ScenarioArg[]>;
12
47
  };
13
48
  export type ScenarioCommandsManifest = {
14
49
  /** Handlers registered via LINE_EXEC_REG `{ module }` → `$ <name> …` */
package/dist/const.d.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  export declare const OTHER_MODULE: "other";
2
2
  export declare const LINE_KEYWORDS: {
3
- readonly GLOBAL: "global";
4
3
  readonly SKIP_IF_POSSIBLE: "skip-if-possible";
5
4
  readonly ASYNC: "async";
6
- readonly EXTEND: "extend";
7
5
  readonly AUTONEXT: "autonext";
8
- readonly DANGEROUS: "dangerous";
9
6
  };
10
7
  export declare const LINE_PREFIXES: {
11
8
  readonly MODULE: "$";
@@ -22,12 +19,9 @@ export declare const LOGS_ACTIONS: {
22
19
  export declare const CONSTANTS: {
23
20
  readonly OTHER_MODULE: "other";
24
21
  readonly LINE_KEYWORDS: {
25
- readonly GLOBAL: "global";
26
22
  readonly SKIP_IF_POSSIBLE: "skip-if-possible";
27
23
  readonly ASYNC: "async";
28
- readonly EXTEND: "extend";
29
24
  readonly AUTONEXT: "autonext";
30
- readonly DANGEROUS: "dangerous";
31
25
  };
32
26
  readonly LINE_PREFIXES: {
33
27
  readonly MODULE: "$";
package/dist/const.js CHANGED
@@ -1,11 +1,8 @@
1
1
  export const OTHER_MODULE = "other";
2
2
  export const LINE_KEYWORDS = {
3
- GLOBAL: "global",
4
3
  SKIP_IF_POSSIBLE: "skip-if-possible",
5
4
  ASYNC: "async",
6
- EXTEND: "extend",
7
5
  AUTONEXT: "autonext",
8
- DANGEROUS: "dangerous",
9
6
  };
10
7
  export const LINE_PREFIXES = {
11
8
  MODULE: "$",
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export type PluginName = typeof PLUGIN_NAME;
13
13
  export { CONSTANTS };
14
14
  export type { Constants } from "./const.js";
15
15
  export { SCENARIO_COMMANDS };
16
- export type { ScenarioCommandEntry, ScenarioCommands, ScenarioCommandsManifest } from "./commands.js";
16
+ export type { ScenarioArg, ScenarioCommandEntry, ScenarioCommands, ScenarioCommandsManifest, } from "./commands.js";
17
17
  export { SUBSCRIBE_EVENTS };
18
18
  export type { SubscribeEvents } from "./events.js";
19
19
  export { PARAMS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/contracts.core.scenario",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Contracts for @vnejs/plugins.core.scenario",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/commands.ts CHANGED
@@ -1,5 +1,27 @@
1
1
  import { EXEC_ACTIONS } from "./const.js";
2
2
 
3
+ /**
4
+ * Positional argument slot after `$/% <name>` (and optional action).
5
+ * Consumed by editor tooling; not used at runtime.
6
+ */
7
+ export type ScenarioArg =
8
+ | {
9
+ kind: "id";
10
+ optional?: boolean;
11
+ /**
12
+ * When true, only `{…}` / `"…"` / `'…'` tokens match
13
+ * (e.g. optional sprite variation between position and transition).
14
+ */
15
+ delimited?: boolean;
16
+ }
17
+ | { kind: "number"; optional?: boolean }
18
+ | {
19
+ kind: "enum";
20
+ /** Stable key → scenario literal (same shape as EXEC_ACTIONS). */
21
+ values: Record<string, string>;
22
+ optional?: boolean;
23
+ };
24
+
3
25
  /**
4
26
  * Declarative .vne command surface contributed by a plugin contract.
5
27
  * Tooling (editor, validation) aggregates these; not registered in VNE at runtime.
@@ -9,8 +31,22 @@ export type ScenarioCommandEntry = {
9
31
  * Named actions after `$ <module>` / `% <block>`.
10
32
  * Keys are stable identifiers; values are the literals used in scenario lines
11
33
  * (typically the same object as EXEC_ACTIONS).
34
+ *
35
+ * Used for action-first commands (`$ stack jump …`). For name-first commands
36
+ * (`$ flag <name> set`, `$ counter <name> ++`) prefer `args` and omit relying
37
+ * on first-token action matching.
12
38
  */
13
39
  actions?: Record<string, string>;
40
+ /**
41
+ * Positional args when the first token is not an action
42
+ * (e.g. `$ text.meet <speaker>`, `$ flag <name> [set|unset]`).
43
+ */
44
+ args?: readonly ScenarioArg[];
45
+ /**
46
+ * Positional args after a matched action literal
47
+ * (e.g. `$ ul.sprite show <id> <position>`).
48
+ */
49
+ argsByAction?: Record<string, readonly ScenarioArg[]>;
14
50
  };
15
51
 
16
52
  export type ScenarioCommandsManifest = {
package/src/const.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  export const OTHER_MODULE = "other" as const;
2
2
 
3
3
  export const LINE_KEYWORDS = {
4
- GLOBAL: "global",
5
4
  SKIP_IF_POSSIBLE: "skip-if-possible",
6
5
  ASYNC: "async",
7
- EXTEND: "extend",
8
6
  AUTONEXT: "autonext",
9
- DANGEROUS: "dangerous",
10
7
  } as const;
11
8
 
12
9
  export const LINE_PREFIXES = {
package/src/index.ts CHANGED
@@ -17,7 +17,12 @@ export type PluginName = typeof PLUGIN_NAME;
17
17
  export { CONSTANTS };
18
18
  export type { Constants } from "./const.js";
19
19
  export { SCENARIO_COMMANDS };
20
- export type { ScenarioCommandEntry, ScenarioCommands, ScenarioCommandsManifest } from "./commands.js";
20
+ export type {
21
+ ScenarioArg,
22
+ ScenarioCommandEntry,
23
+ ScenarioCommands,
24
+ ScenarioCommandsManifest,
25
+ } from "./commands.js";
21
26
  export { SUBSCRIBE_EVENTS };
22
27
  export type { SubscribeEvents } from "./events.js";
23
28
  export { PARAMS };