x-runtime-lib 0.8.42 → 0.8.44

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.
@@ -0,0 +1,2 @@
1
+ import { Sandbox } from '../sandbox';
2
+ export declare function bindBase(sandbox: Sandbox): void;
@@ -0,0 +1,2 @@
1
+ import { Sandbox } from '../sandbox';
2
+ export declare function bindCompute(sandbox: Sandbox): void;
@@ -0,0 +1,2 @@
1
+ import { Sandbox } from '../sandbox';
2
+ export declare function bind(sandbox: Sandbox): void;
@@ -0,0 +1,2 @@
1
+ import { Sandbox } from '../sandbox';
2
+ export declare function bindView(sandbox: Sandbox): void;
@@ -0,0 +1 @@
1
+ export * from './sandbox';
@@ -0,0 +1 @@
1
+ export declare const base = "\nvar __env__ = 'dev'\nvar __mode__ = 'editor'\n\nfunction __getEnvV1__() {\n return __env__\n}\n\nvar __pointerPosX__ = 0\nvar __pointerPosY__ = 0\n";
@@ -0,0 +1 @@
1
+ export declare const event = "\nvar __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n var callbacks = __events__[id]\n for (var i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nfunction __triggerEventV1__(id, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (!__events__[id]) {\n return\n }\n var callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i](p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16)\n }\n}\n";
@@ -0,0 +1 @@
1
+ export declare const runtime: string;
@@ -0,0 +1 @@
1
+ export declare const timer = "\nvar __timers__ = {}\nvar __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n __currTimerId__ = __currTimerId__ + 1\n var timer = {}\n timer.id = __currTimerId__\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nfunction __timeoutCallbackV1__(timerId) {\n var timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // \u4FEE\u6539\u8BA1\u6570\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // \u89E6\u53D1\u8D85\u65F6\n if (timer.loop || timer.count > 0) {\n __timeoutV1__(timer.id, timer.interval)\n }\n // \u56DE\u6536\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n";
@@ -37,8 +37,14 @@ export declare class Sandbox {
37
37
  private interpreter;
38
38
  createInterpreter(code: string): void;
39
39
  destroyInterpreter(): void;
40
+ bindNativeFunction(name: string, func: Function): void;
41
+ bindAsyncFunction(name: string, func: Function): void;
42
+ pseudoToNative(obj: any): any;
43
+ nativeToPseudo(obj: any): any;
44
+ run(): void;
40
45
  getVariable(varName: string): any;
41
46
  setVariable(varName: string, value: any): void;
47
+ runCode(code: string): void;
42
48
  callFunction(funcName: string, params?: any[]): void;
43
49
  }
44
50
  export {};
@@ -4,5 +4,4 @@ export * from './node';
4
4
  export * from './property';
5
5
  export * from './provideInject';
6
6
  export * from './reactivity';
7
- export * from './sandbox';
8
7
  export * from './unifiedId';
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
+ import { Sandbox } from '@/sandbox';
2
3
  import { Data, Depends, Env, Mode } from '@/types';
3
- import { Sandbox } from './sandbox';
4
4
  export declare function provideOrg(org: string): void;
5
5
  export declare function injectOrg(): string;
6
6
  export declare function provideEnv(env: Env): void;
@@ -1,4 +1,4 @@
1
+ import { Sandbox } from '@/sandbox';
1
2
  import { Reactivity, Trigger } from '@/types';
2
- import { Sandbox } from './sandbox';
3
3
  export declare function makeTriggerId(trigger: Trigger): string;
4
4
  export declare function triggerReactivity(sandbox: Sandbox, reactivity: Reactivity, triggerId: string, newValue: any, oldValue: any): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-runtime-lib",
3
3
  "private": false,
4
- "version": "0.8.42",
4
+ "version": "0.8.44",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- import Interpreter from 'js-interpreter';
2
- export declare function bindBase(interpreter: Interpreter, globalObject: object): void;
@@ -1,2 +0,0 @@
1
- import Interpreter from 'js-interpreter';
2
- export declare function bindCompute(interpreter: Interpreter, globalObject: object): void;
@@ -1,4 +0,0 @@
1
- import Interpreter from 'js-interpreter';
2
- import { Sandbox } from '@/utils';
3
- declare function bind(sandbox: Sandbox, interpreter: Interpreter, globalObject: object): void;
4
- export default bind;
@@ -1,3 +0,0 @@
1
- import Interpreter from 'js-interpreter';
2
- import { Sandbox } from '@/utils';
3
- export declare function bindView(sandbox: Sandbox, interpreter: Interpreter, globalObject: object): void;
@@ -1,3 +0,0 @@
1
- import bind from './bind';
2
- import runtime from './runtime';
3
- export { bind, runtime };
@@ -1,2 +0,0 @@
1
- declare const base = "\nvar __env__ = 'dev'\nvar __mode__ = 'editor'\n\nfunction __getEnvV1__() {\n return __env__\n}\n\nvar __pointerPosX__ = 0\nvar __pointerPosY__ = 0\n";
2
- export default base;
@@ -1,2 +0,0 @@
1
- declare const event = "\nvar __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n var callbacks = __events__[id]\n for (var i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nfunction __triggerEventV1__(id, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (!__events__[id]) {\n return\n }\n var callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (var i = 0; i < callbacks.length; i++) {\n callbacks[i](p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16)\n }\n}\n";
2
- export default event;
@@ -1,2 +0,0 @@
1
- declare const runtime: string;
2
- export default runtime;
@@ -1,2 +0,0 @@
1
- declare const timer = "\nvar __timers__ = {}\nvar __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n __currTimerId__ = __currTimerId__ + 1\n var timer = {}\n timer.id = __currTimerId__\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nfunction __timeoutCallbackV1__(timerId) {\n var timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // \u4FEE\u6539\u8BA1\u6570\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // \u89E6\u53D1\u8D85\u65F6\n if (timer.loop || timer.count > 0) {\n __timeoutV1__(timer.id, timer.interval)\n }\n // \u56DE\u6536\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n";
2
- export default timer;