@momoyu-ink/kit 0.6.0 → 0.6.1

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.
@@ -175,6 +175,20 @@ type ScenarioCommand = {
175
175
  };
176
176
  } | {
177
177
  subCommand: 'getVariables';
178
+ } | {
179
+ subCommand: 'setLocalVariable';
180
+ name: string;
181
+ value: JsonValue;
182
+ } | {
183
+ subCommand: 'getLocalVariable';
184
+ name: string;
185
+ } | {
186
+ subCommand: 'setLocalVariables';
187
+ variables: {
188
+ [key in string]: JsonValue;
189
+ };
190
+ } | {
191
+ subCommand: 'getLocalVariables';
178
192
  } | {
179
193
  subCommand: 'setPermanentVariable';
180
194
  key: string;
@@ -175,6 +175,20 @@ type ScenarioCommand = {
175
175
  };
176
176
  } | {
177
177
  subCommand: 'getVariables';
178
+ } | {
179
+ subCommand: 'setLocalVariable';
180
+ name: string;
181
+ value: JsonValue;
182
+ } | {
183
+ subCommand: 'getLocalVariable';
184
+ name: string;
185
+ } | {
186
+ subCommand: 'setLocalVariables';
187
+ variables: {
188
+ [key in string]: JsonValue;
189
+ };
190
+ } | {
191
+ subCommand: 'getLocalVariables';
178
192
  } | {
179
193
  subCommand: 'setPermanentVariable';
180
194
  key: string;
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsxDEV } from 'react/jsx-dev-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-B5T-ZMWr.mjs';
2
+ export { J as JSX } from './jsx-dev-runtime-CFlTWFj5.mjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsxDEV } from 'react/jsx-dev-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-B5T-ZMWr.js';
2
+ export { J as JSX } from './jsx-dev-runtime-CFlTWFj5.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsx, jsxs } from 'react/jsx-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-B5T-ZMWr.mjs';
2
+ export { J as JSX } from './jsx-dev-runtime-CFlTWFj5.mjs';
3
3
  import 'react/jsx-dev-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsx, jsxs } from 'react/jsx-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-B5T-ZMWr.js';
2
+ export { J as JSX } from './jsx-dev-runtime-CFlTWFj5.js';
3
3
  import 'react/jsx-dev-runtime';
4
4
  import 'react';
package/dist/lib.cjs CHANGED
@@ -408,8 +408,35 @@ function createRoot(options) {
408
408
 
409
409
  // src/sandbox.ts
410
410
  var JS_GLOBAL_KEYS = new Set(Object.getOwnPropertyNames(globalThis));
411
- var JS_GLOBAL_KEYS_EXCLUDED = /* @__PURE__ */ new Set(["window", "globalThis", "ARCHIVE", "GLOBAL"]);
412
- JS_GLOBAL_KEYS_EXCLUDED.forEach((key) => JS_GLOBAL_KEYS.delete(key));
411
+ var JS_GLOBAL_KEYS_EXCLUDED = /* @__PURE__ */ new Set(["window", "globalThis", "LOCAL", "ARCHIVE", "GLOBAL"]);
412
+ JS_GLOBAL_KEYS_EXCLUDED.forEach((key) => {
413
+ JS_GLOBAL_KEYS.delete(key);
414
+ });
415
+ var localVariables = new Proxy(
416
+ {},
417
+ {
418
+ get(_, key) {
419
+ if (typeof key === "string") {
420
+ return executePluginCommand("scenario", {
421
+ subCommand: "getLocalVariable",
422
+ name: key
423
+ });
424
+ }
425
+ return void 0;
426
+ },
427
+ set(_, key, value) {
428
+ if (typeof key === "string") {
429
+ executePluginCommand("scenario", {
430
+ subCommand: "setLocalVariable",
431
+ name: key,
432
+ value
433
+ });
434
+ return true;
435
+ }
436
+ return false;
437
+ }
438
+ }
439
+ );
413
440
  var archiveVariables = new Proxy(
414
441
  {},
415
442
  {
@@ -466,10 +493,11 @@ function safeEval(code, sandbox) {
466
493
  if (typeof key === "string" && JS_GLOBAL_KEYS.has(key)) {
467
494
  return false;
468
495
  }
469
- return key in target || key === "ARCHIVE" || key === "GLOBAL" || key === "window" || key === "globalThis";
496
+ return key in target || key === "LOCAL" || key === "ARCHIVE" || key === "GLOBAL" || key === "window" || key === "globalThis";
470
497
  },
471
498
  get(target, key) {
472
499
  if (key === "window" || key === "globalThis") return proxy4;
500
+ if (key === "LOCAL") return localVariables;
473
501
  if (key === "ARCHIVE") return archiveVariables;
474
502
  if (key === "GLOBAL") return globalVariables;
475
503
  if (key === Symbol.unscopables) return void 0;
package/dist/lib.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, Component, ForwardRefExoticComponent, CSSProperties, FC, ComponentType } from 'react';
3
- import { M as MouseEvent, a as MoyuEvent, C as Command, b as MaybePromise, J as JSX } from './jsx-dev-runtime-B5T-ZMWr.mjs';
4
- export { A as AudioCommand, c as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, E as EffectParams, G as GamepadCommand, K as KeyboardEvent, d as KeyboardEventKind, e as MakeNullOptional, f as MouseEventKind, g as MoyuAnimationAttributes, h as MoyuBackdropAttributes, i as MoyuClipAttributes, j as MoyuContainerAttributes, k as MoyuEventHandler, l as MoyuFilterAttributes, m as MoyuListenerAttributes, n as MoyuNodeAttributes, o as MoyuSpriteAttributes, p as MoyuTextAttributes, q as MoyuVideoAttributes, N as Node, S as ScenarioCommand, r as SystemCommand, T as TextCommand, s as TouchEvent, t as TouchEventKind, u as Tuple2, v as Tuple3, w as Tuple4, W as WindowState, x as createBubbleEvent, y as getStageSize } from './jsx-dev-runtime-B5T-ZMWr.mjs';
3
+ import { M as MouseEvent, a as MoyuEvent, C as Command, b as MaybePromise, J as JSX } from './jsx-dev-runtime-CFlTWFj5.mjs';
4
+ export { A as AudioCommand, c as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, E as EffectParams, G as GamepadCommand, K as KeyboardEvent, d as KeyboardEventKind, e as MakeNullOptional, f as MouseEventKind, g as MoyuAnimationAttributes, h as MoyuBackdropAttributes, i as MoyuClipAttributes, j as MoyuContainerAttributes, k as MoyuEventHandler, l as MoyuFilterAttributes, m as MoyuListenerAttributes, n as MoyuNodeAttributes, o as MoyuSpriteAttributes, p as MoyuTextAttributes, q as MoyuVideoAttributes, N as Node, S as ScenarioCommand, r as SystemCommand, T as TextCommand, s as TouchEvent, t as TouchEventKind, u as Tuple2, v as Tuple3, w as Tuple4, W as WindowState, x as createBubbleEvent, y as getStageSize } from './jsx-dev-runtime-CFlTWFj5.mjs';
5
5
  import { FluidValue } from '@react-spring/shared';
6
6
  import { ElementType, AssignableKeys, ComponentPropsWithRef } from '@react-spring/types';
7
7
  import { Snapshot } from 'valtio';
package/dist/lib.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, Component, ForwardRefExoticComponent, CSSProperties, FC, ComponentType } from 'react';
3
- import { M as MouseEvent, a as MoyuEvent, C as Command, b as MaybePromise, J as JSX } from './jsx-dev-runtime-B5T-ZMWr.js';
4
- export { A as AudioCommand, c as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, E as EffectParams, G as GamepadCommand, K as KeyboardEvent, d as KeyboardEventKind, e as MakeNullOptional, f as MouseEventKind, g as MoyuAnimationAttributes, h as MoyuBackdropAttributes, i as MoyuClipAttributes, j as MoyuContainerAttributes, k as MoyuEventHandler, l as MoyuFilterAttributes, m as MoyuListenerAttributes, n as MoyuNodeAttributes, o as MoyuSpriteAttributes, p as MoyuTextAttributes, q as MoyuVideoAttributes, N as Node, S as ScenarioCommand, r as SystemCommand, T as TextCommand, s as TouchEvent, t as TouchEventKind, u as Tuple2, v as Tuple3, w as Tuple4, W as WindowState, x as createBubbleEvent, y as getStageSize } from './jsx-dev-runtime-B5T-ZMWr.js';
3
+ import { M as MouseEvent, a as MoyuEvent, C as Command, b as MaybePromise, J as JSX } from './jsx-dev-runtime-CFlTWFj5.js';
4
+ export { A as AudioCommand, c as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, E as EffectParams, G as GamepadCommand, K as KeyboardEvent, d as KeyboardEventKind, e as MakeNullOptional, f as MouseEventKind, g as MoyuAnimationAttributes, h as MoyuBackdropAttributes, i as MoyuClipAttributes, j as MoyuContainerAttributes, k as MoyuEventHandler, l as MoyuFilterAttributes, m as MoyuListenerAttributes, n as MoyuNodeAttributes, o as MoyuSpriteAttributes, p as MoyuTextAttributes, q as MoyuVideoAttributes, N as Node, S as ScenarioCommand, r as SystemCommand, T as TextCommand, s as TouchEvent, t as TouchEventKind, u as Tuple2, v as Tuple3, w as Tuple4, W as WindowState, x as createBubbleEvent, y as getStageSize } from './jsx-dev-runtime-CFlTWFj5.js';
5
5
  import { FluidValue } from '@react-spring/shared';
6
6
  import { ElementType, AssignableKeys, ComponentPropsWithRef } from '@react-spring/types';
7
7
  import { Snapshot } from 'valtio';
package/dist/lib.mjs CHANGED
@@ -395,8 +395,35 @@ function createRoot(options) {
395
395
 
396
396
  // src/sandbox.ts
397
397
  var JS_GLOBAL_KEYS = new Set(Object.getOwnPropertyNames(globalThis));
398
- var JS_GLOBAL_KEYS_EXCLUDED = /* @__PURE__ */ new Set(["window", "globalThis", "ARCHIVE", "GLOBAL"]);
399
- JS_GLOBAL_KEYS_EXCLUDED.forEach((key) => JS_GLOBAL_KEYS.delete(key));
398
+ var JS_GLOBAL_KEYS_EXCLUDED = /* @__PURE__ */ new Set(["window", "globalThis", "LOCAL", "ARCHIVE", "GLOBAL"]);
399
+ JS_GLOBAL_KEYS_EXCLUDED.forEach((key) => {
400
+ JS_GLOBAL_KEYS.delete(key);
401
+ });
402
+ var localVariables = new Proxy(
403
+ {},
404
+ {
405
+ get(_, key) {
406
+ if (typeof key === "string") {
407
+ return executePluginCommand("scenario", {
408
+ subCommand: "getLocalVariable",
409
+ name: key
410
+ });
411
+ }
412
+ return void 0;
413
+ },
414
+ set(_, key, value) {
415
+ if (typeof key === "string") {
416
+ executePluginCommand("scenario", {
417
+ subCommand: "setLocalVariable",
418
+ name: key,
419
+ value
420
+ });
421
+ return true;
422
+ }
423
+ return false;
424
+ }
425
+ }
426
+ );
400
427
  var archiveVariables = new Proxy(
401
428
  {},
402
429
  {
@@ -453,10 +480,11 @@ function safeEval(code, sandbox) {
453
480
  if (typeof key === "string" && JS_GLOBAL_KEYS.has(key)) {
454
481
  return false;
455
482
  }
456
- return key in target || key === "ARCHIVE" || key === "GLOBAL" || key === "window" || key === "globalThis";
483
+ return key in target || key === "LOCAL" || key === "ARCHIVE" || key === "GLOBAL" || key === "window" || key === "globalThis";
457
484
  },
458
485
  get(target, key) {
459
486
  if (key === "window" || key === "globalThis") return proxy4;
487
+ if (key === "LOCAL") return localVariables;
460
488
  if (key === "ARCHIVE") return archiveVariables;
461
489
  if (key === "GLOBAL") return globalVariables;
462
490
  if (key === Symbol.unscopables) return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoyu-ink/kit",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Software Development Kit of Moyu Visual Novel Engine",
5
5
  "main": "dist/lib.cjs",
6
6
  "module": "dist/lib.mjs",