x-runtime-lib 0.8.11 → 0.8.12

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,4 +1,3 @@
1
- import Interpreter from 'js-interpreter';
2
- import { InterpreterContext } from '@/types';
3
- export declare function startInterpreter(context: InterpreterContext, code: string): Interpreter;
4
- export declare function stopInterpreter(interpreter: Interpreter): void;
1
+ import bind from './bind';
2
+ import runtime from './runtime';
3
+ export { bind, runtime };
@@ -4,5 +4,5 @@ export * from './context';
4
4
  export * from './data';
5
5
  export * from './depend';
6
6
  export * from './element';
7
+ export * from './interpreter';
7
8
  export * from './meta';
8
- export * from './sandbox';
@@ -0,0 +1,11 @@
1
+ import { Sandbox } from '@/utils';
2
+ import { Env, Mode } from './basic';
3
+ import { Data } from './data';
4
+ export interface InterpreterContext {
5
+ org: string;
6
+ env: Env;
7
+ mode: Mode;
8
+ type: 'page' | 'comp';
9
+ data: Data;
10
+ sandbox: Sandbox;
11
+ }
@@ -3,3 +3,4 @@ export * from './node';
3
3
  export * from './prop';
4
4
  export * from './provideInject';
5
5
  export * from './reactivity';
6
+ export * from './sandbox';
@@ -1,5 +1,6 @@
1
1
  import { Ref } from 'vue';
2
- import { Data, Depends, Env, Mode, Sandbox } from '@/types';
2
+ import { Data, Depends, Env, Mode } from '@/types';
3
+ import { Sandbox } from './sandbox';
3
4
  export declare function provideOrg(org: string): void;
4
5
  export declare function injectOrg(): string;
5
6
  export declare function provideEnv(env: Env): void;
@@ -1,3 +1,4 @@
1
- import { Reactivity, Sandbox, Trigger } from '@/types';
1
+ import { Reactivity, Trigger } from '@/types';
2
+ import { Sandbox } from './sandbox';
2
3
  export declare function makeTriggerId(trigger: Trigger): string;
3
4
  export declare function triggerReactivity(sandbox: Sandbox, reactivity: Reactivity, triggerId: string, newValue: any, oldValue: any): void;
@@ -0,0 +1,38 @@
1
+ import { Data, InterpreterContext } from '@/types';
2
+ export type PropKeys = string[] | string;
3
+ interface Hooks {
4
+ onElementPropChange: (nodeId: string, propKeys: PropKeys, newValue: any, oldValue: any) => void;
5
+ onCustomPropChange: (propId: string, newValue: any, oldValue: any) => void;
6
+ onCustomStateChange: (stateId: string, newValue: any, oldValue: any) => void;
7
+ onAdaptSlotPropChange: (propId: string, newValue: any, oldValue: any) => void;
8
+ }
9
+ export declare class Sandbox {
10
+ eventBus: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
11
+ private hooks?;
12
+ constructor(hooks?: Hooks);
13
+ private nodes;
14
+ syncNodes(data: Data | undefined): void;
15
+ getElementPropInner(node: any, propKeys: PropKeys): any;
16
+ getElementProp(nodeId: string, propKeys: PropKeys): any;
17
+ setElementPropInner(node: any, propKeys: PropKeys, newValue: any): void;
18
+ setElementProp(nodeId: string, propKeys: PropKeys, newValue: any): void;
19
+ private customProps;
20
+ resetCustomProps(): void;
21
+ getCustomProp(propId: string): any;
22
+ setCustomProp(propId: string, newValue: any): void;
23
+ private customStates;
24
+ resetCustomStates(): void;
25
+ getCustomState(stateId: string): any;
26
+ setCustomState(stateId: string, newValue: string): void;
27
+ private adaptSlotProps;
28
+ resetAdaptSlotProps(): void;
29
+ getAdaptSlotProp(propId: string): any;
30
+ setAdaptSlotProp(propId: string, newValue: any): void;
31
+ private interpreter;
32
+ createInterpreter(context: InterpreterContext, code: string): void;
33
+ destroyInterpreter(): void;
34
+ getVariable(varName: string): any;
35
+ setVariable(varName: string, value: any): void;
36
+ callFunction(funcName: string, params?: any[]): void;
37
+ }
38
+ export {};