x-runtime-lib 0.8.9 → 0.8.11

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.
@@ -12,9 +12,43 @@ export interface Node {
12
12
  export interface View {
13
13
  nodes: Node[];
14
14
  }
15
+ interface TriggerElementProp {
16
+ type: 'elementProp';
17
+ nodeId: string;
18
+ propKeys: string;
19
+ }
20
+ interface TriggerCustomProp {
21
+ type: 'customProp';
22
+ propId: string;
23
+ }
24
+ interface TriggerCustomState {
25
+ type: 'customState';
26
+ stateId: string;
27
+ }
28
+ interface TriggerAdaptSlotProp {
29
+ type: 'adaptSlotProp';
30
+ propId: string;
31
+ }
32
+ export type Trigger = (TriggerElementProp | TriggerCustomProp | TriggerCustomState | TriggerAdaptSlotProp) & {
33
+ subKeys?: string;
34
+ };
35
+ export interface Reactivity {
36
+ watchEffect: {
37
+ [key: string]: string[];
38
+ };
39
+ bind: {
40
+ sets: {
41
+ [key: string]: Trigger[];
42
+ };
43
+ triggers: {
44
+ [key: string]: string[];
45
+ };
46
+ };
47
+ }
15
48
  export interface Code {
16
49
  blockly: object;
17
50
  script: string;
51
+ reactivity?: Reactivity;
18
52
  }
19
53
  export declare const pageTypes: string[];
20
54
  export type PageType = (typeof pageTypes)[number];
@@ -26,3 +60,4 @@ export interface Data {
26
60
  view: View;
27
61
  code: Code;
28
62
  }
63
+ export {};
@@ -3,14 +3,19 @@ import { Emitter, EventType } from 'mitt';
3
3
  import { Env, Mode } from './basic';
4
4
  import { Data } from './data';
5
5
  type EventBus = Emitter<Record<EventType, unknown>>;
6
- export declare function newEventBus(): Emitter<Record<EventType, unknown>>;
7
6
  export interface Sandbox {
8
- eventBus?: EventBus;
7
+ eventBus: EventBus;
9
8
  interpreter?: Interpreter;
10
- setCustomProp?: (key: string, value: any) => void;
11
- getCustomProp?: (key: string) => any;
12
- setCustomState?: (key: string, value: any) => void;
13
- getCustomState?: (key: string) => any;
9
+ getElementPropInner: (node: any, propKeys: string[] | string) => any;
10
+ getElementProp: (nodeId: string, propKeys: string[] | string) => any;
11
+ setElementPropInner: (node: any, propKeys: string[] | string, newValue: any) => void;
12
+ setElementProp: (nodeId: string, propKeys: string[] | string, newValue: any) => void;
13
+ getCustomProp: (propId: string) => any;
14
+ setCustomProp: (propId: string, newValue: any) => void;
15
+ getCustomState: (stateId: string) => any;
16
+ setCustomState: (stateId: string, newValue: any) => void;
17
+ getAdaptSlotProp: (propId: string) => any;
18
+ setAdaptSlotProp: (propId: string, newValue: any) => void;
14
19
  }
15
20
  export interface InterpreterContext {
16
21
  org: string;
@@ -2,3 +2,4 @@ export * from './misc';
2
2
  export * from './node';
3
3
  export * from './prop';
4
4
  export * from './provideInject';
5
+ export * from './reactivity';
@@ -11,3 +11,5 @@ export declare function getIndexOfBreakpoint(breakpoint: Breakpoint): number;
11
11
  export declare function getBreakpointProp(current: Breakpoint, props: {
12
12
  [bp: Breakpoint]: any;
13
13
  }): any;
14
+ export declare function getField(object: any, keys: string[] | string): any;
15
+ export declare function setField(object: any, keys: string[] | string, value: any): void;
@@ -0,0 +1,3 @@
1
+ import { Reactivity, Sandbox, Trigger } from '@/types';
2
+ export declare function makeTriggerId(trigger: Trigger): string;
3
+ export declare function triggerReactivity(sandbox: Sandbox, reactivity: Reactivity, triggerId: string, newValue: any, oldValue: any): void;