keystonemc 3.2.3 → 4.0.0

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.
package/README.md CHANGED
@@ -19,6 +19,6 @@
19
19
  1. core/ 配下でライブラリを更新
20
20
  1. キリが良いところで push する
21
21
  1. 動作確認は以下
22
- 1. keystone側で package.json の dependencies を書き換え
22
+ 1. [keystone](https://github.com/XxPMMPERxX/Keystone)側で package.json の dependencies を書き換え
23
23
  1. `"keystonemc": "github:XxPMMPERxX/KeystoneCore#<ブランチ名>"`
24
24
  1. `npm install keystonemc` を実行するとブランチの最新の状態でインストールされる
@@ -0,0 +1,133 @@
1
+ import { ModalFormData, ActionFormData } from "@minecraft/server-ui";
2
+ class ModalForm {
3
+ constructor(config) {
4
+ this.config = config;
5
+ }
6
+ async send(player) {
7
+ const form = new ModalFormData().title(this.config.title);
8
+ for (const component of this.config.components) {
9
+ component.render(form);
10
+ }
11
+ const res = await form.show(player);
12
+ if (res.canceled) {
13
+ this.config.previousForm?.send(player);
14
+ return;
15
+ }
16
+ res.formValues?.forEach((value, index) => {
17
+ const component = this.config.components[index];
18
+ try {
19
+ component.handle?.(player, value);
20
+ } catch (e) {
21
+ console.warn(`[ModalForm] handler error at index ${index}: ${e}`);
22
+ }
23
+ });
24
+ this.config.handle?.(player, res.formValues);
25
+ }
26
+ }
27
+ function createModalForm(config) {
28
+ return new ModalForm(config);
29
+ }
30
+ class ActionForm {
31
+ constructor(config) {
32
+ this.config = config;
33
+ }
34
+ async send(player) {
35
+ const form = new ActionFormData().title(this.config.title);
36
+ if (this.config.body) {
37
+ form.body(this.config.body);
38
+ }
39
+ for (const btn of this.config.buttons) {
40
+ btn.render(form);
41
+ }
42
+ const res = await form.show(player);
43
+ if (res.canceled) {
44
+ this.config.previousForm?.send(player);
45
+ return;
46
+ }
47
+ const index = res.selection;
48
+ if (index === void 0) return;
49
+ const button2 = this.config.buttons[index];
50
+ button2?.handle(player);
51
+ }
52
+ }
53
+ function createActionForm(config) {
54
+ return new ActionForm(config);
55
+ }
56
+ function toggle(opts) {
57
+ return {
58
+ render(form) {
59
+ form.toggle(opts.label, { defaultValue: opts.default });
60
+ },
61
+ handle(player, value) {
62
+ opts.handler?.(player, value);
63
+ }
64
+ };
65
+ }
66
+ function textField(opts) {
67
+ return {
68
+ render(form) {
69
+ form.textField(
70
+ opts.label,
71
+ opts.placeholder ?? "",
72
+ { defaultValue: opts.default ?? "" }
73
+ );
74
+ },
75
+ handle(player, value) {
76
+ opts.handler?.(player, value);
77
+ }
78
+ };
79
+ }
80
+ function slider(opts) {
81
+ return {
82
+ render(form) {
83
+ form.slider(
84
+ opts.label,
85
+ opts.min,
86
+ opts.max,
87
+ { valueStep: opts.step ?? 1, defaultValue: opts.default }
88
+ );
89
+ },
90
+ handle(player, value) {
91
+ opts.handler?.(player, value);
92
+ }
93
+ };
94
+ }
95
+ function dropdown(opts) {
96
+ return {
97
+ render(form) {
98
+ form.dropdown(
99
+ opts.label,
100
+ opts.options,
101
+ { defaultValueIndex: opts.defaultIndex ?? 0 }
102
+ );
103
+ },
104
+ handle(player, value) {
105
+ opts.handler?.(player, value);
106
+ }
107
+ };
108
+ }
109
+ function button(opts) {
110
+ return {
111
+ render(form) {
112
+ if (opts.iconPath) {
113
+ form.button(opts.text, opts.iconPath);
114
+ } else {
115
+ form.button(opts.text);
116
+ }
117
+ },
118
+ handle(player) {
119
+ opts.handler(player);
120
+ }
121
+ };
122
+ }
123
+ export {
124
+ ActionForm as A,
125
+ ModalForm as M,
126
+ createActionForm as a,
127
+ textField as b,
128
+ createModalForm as c,
129
+ dropdown as d,
130
+ button as e,
131
+ slider as s,
132
+ toggle as t
133
+ };
@@ -8,7 +8,7 @@ import { ActionButton, FormComponent } from './types';
8
8
  export declare function toggle(opts: {
9
9
  label: string;
10
10
  default: boolean;
11
- handler(player: Player, value: boolean): void;
11
+ handler?(player: Player, value: boolean): void;
12
12
  }): FormComponent<boolean>;
13
13
  /**
14
14
  * テキストフィールド
@@ -19,7 +19,7 @@ export declare function textField(opts: {
19
19
  label: string;
20
20
  placeholder?: string;
21
21
  default?: string;
22
- handler(player: Player, value: string): void;
22
+ handler?(player: Player, value: string): void;
23
23
  }): FormComponent<string>;
24
24
  /**
25
25
  * スライダー
@@ -32,7 +32,7 @@ export declare function slider(opts: {
32
32
  max: number;
33
33
  step?: number;
34
34
  default: number;
35
- handler(player: Player, value: number): void;
35
+ handler?(player: Player, value: number): void;
36
36
  }): FormComponent<number>;
37
37
  /**
38
38
  * ドロップダウン
@@ -43,7 +43,7 @@ export declare function dropdown(opts: {
43
43
  label: string;
44
44
  options: string[];
45
45
  defaultIndex?: number;
46
- handler(player: Player, value: number): void;
46
+ handler?(player: Player, value: number): void;
47
47
  }): FormComponent<number>;
48
48
  /**
49
49
  * ボタン (ActionForm)
@@ -0,0 +1,12 @@
1
+ import { ActionButton } from '../../types';
2
+ import { ActionForm as ActionFormType } from '../../actionForm';
3
+ import { ModalForm } from '../../modalForm';
4
+ import { MessageForm } from '../../messageForm';
5
+ interface ActionFormProps {
6
+ title: string;
7
+ body?: string;
8
+ previousForm?: ModalForm | ActionFormType | MessageForm;
9
+ children?: ActionButton[];
10
+ }
11
+ export default function ActionForm({ title, body, previousForm, children, }: ActionFormProps): ActionFormType;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Player } from '@minecraft/server';
2
+ interface ActionButtonProps {
3
+ iconPath?: string;
4
+ children?: string | string[];
5
+ onClick?: (player: Player) => any;
6
+ }
7
+ export default function Button({ iconPath, children, onClick, }: ActionButtonProps): import('../../types').ActionButton;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ interface DropdownProps {
2
+ label: string;
3
+ options: string[];
4
+ defaultValueIndex?: number;
5
+ }
6
+ export default function Dropdown({ label, options, defaultValueIndex, }: DropdownProps): import('../../types').FormComponent<number>;
7
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ActionForm } from '../../actionForm';
2
+ import { MessageForm } from '../../messageForm';
3
+ import { ModalForm as ModalFormType } from '../../modalForm';
4
+ import { FormComponent } from '../../types';
5
+ import { Player } from '@minecraft/server';
6
+ interface ModalFormProps<T = any> {
7
+ title: string;
8
+ previousForm?: ModalFormType | ActionForm | MessageForm;
9
+ children?: FormComponent[];
10
+ onSubmit?: (player: Player, values?: T[] | undefined) => any;
11
+ }
12
+ export default function ModalForm({ title, previousForm, children, onSubmit, }: ModalFormProps): ModalFormType;
13
+ export {};
@@ -0,0 +1,9 @@
1
+ interface SliderProps {
2
+ label: string;
3
+ min: number;
4
+ max: number;
5
+ step?: number;
6
+ defaultValue?: number;
7
+ }
8
+ export default function Slider({ label, min, max, step, defaultValue, }: SliderProps): import('../../types').FormComponent<number>;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ interface TextfieldProps {
2
+ label: string;
3
+ placeholder?: string;
4
+ defaultValue?: string;
5
+ }
6
+ export default function Textfield({ label, placeholder, defaultValue, }: TextfieldProps): import('../../types').FormComponent<string>;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ interface ToggleProps {
2
+ label: string;
3
+ defaultValue?: boolean;
4
+ }
5
+ export default function Toggle({ label, defaultValue, }: ToggleProps): import('../../types').FormComponent<boolean>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { default as ActionForm } from './ActionForm';
2
+ import { default as Button } from './Button';
3
+ import { default as ModalForm } from './ModalForm';
4
+ import { default as Slider } from './Slider';
5
+ import { default as Dropdown } from './Dropdown';
6
+ import { default as Textfield } from './Textfield';
7
+ import { default as Toggle } from './Toggle';
8
+ export { ActionForm, Button, ModalForm, Slider, Dropdown, Textfield, Toggle, };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * JSX Fragment 用の一意な識別子
3
+ */
4
+ export declare const Fragment: unique symbol;
5
+ /**
6
+ * JSX で生成される要素の type
7
+ * - 関数コンポーネント
8
+ * - Fragment
9
+ */
10
+ export type JSXElementType = ((props: any) => any) | typeof Fragment;
11
+ /**
12
+ * JSX のエントリポイント
13
+ */
14
+ export declare function createElement(type: JSXElementType, props: any, ...children: any[]): any;
15
+ /**
16
+ * 開発モード用 JSX エントリポイント
17
+ * デバッグ情報(key, isStaticChildren, source, self)を受け取るが、現在は無視
18
+ */
19
+ export declare function jsxDEV(type: JSXElementType, props: any, ..._deps: unknown[]): any;
20
+ export { createElement as jsx, createElement as jsxs, };
@@ -0,0 +1,95 @@
1
+ import { a as createActionForm, e as button, c as createModalForm, s as slider, d as dropdown, b as textField, t as toggle } from "../../components-BZCbUNW6.js";
2
+ function ActionForm({
3
+ title,
4
+ body,
5
+ previousForm,
6
+ children = []
7
+ }) {
8
+ return createActionForm({
9
+ title,
10
+ body,
11
+ previousForm,
12
+ buttons: children
13
+ });
14
+ }
15
+ function Button({
16
+ iconPath = "",
17
+ children = [],
18
+ onClick = () => {
19
+ }
20
+ }) {
21
+ return button({
22
+ text: typeof children === "object" ? children.join("\n") : children,
23
+ iconPath,
24
+ handler: onClick
25
+ });
26
+ }
27
+ function ModalForm({
28
+ title,
29
+ previousForm,
30
+ children = [],
31
+ onSubmit = () => {
32
+ }
33
+ }) {
34
+ return createModalForm({
35
+ title,
36
+ previousForm,
37
+ components: children,
38
+ handle: onSubmit
39
+ });
40
+ }
41
+ function Slider({
42
+ label,
43
+ min,
44
+ max,
45
+ step,
46
+ defaultValue = min
47
+ }) {
48
+ return slider({
49
+ label,
50
+ min,
51
+ max,
52
+ step,
53
+ default: defaultValue
54
+ });
55
+ }
56
+ function Dropdown({
57
+ label,
58
+ options,
59
+ defaultValueIndex
60
+ }) {
61
+ return dropdown({
62
+ label,
63
+ options,
64
+ defaultIndex: defaultValueIndex
65
+ });
66
+ }
67
+ function Textfield({
68
+ label,
69
+ placeholder = "",
70
+ defaultValue = ""
71
+ }) {
72
+ return textField({
73
+ label,
74
+ placeholder,
75
+ default: defaultValue
76
+ });
77
+ }
78
+ function Toggle({
79
+ label,
80
+ defaultValue = false
81
+ }) {
82
+ return toggle({
83
+ label,
84
+ default: defaultValue
85
+ });
86
+ }
87
+ export {
88
+ ActionForm,
89
+ Button,
90
+ Dropdown,
91
+ ModalForm,
92
+ Slider,
93
+ Textfield,
94
+ Toggle
95
+ };
@@ -0,0 +1,40 @@
1
+ const Fragment = /* @__PURE__ */ Symbol("Fragment");
2
+ function createElement(type, props, ...children) {
3
+ if (type === Fragment) {
4
+ return normalizeChildren(children);
5
+ }
6
+ if (typeof type !== "function") {
7
+ throw new Error("Invalid JSX element type");
8
+ }
9
+ return type({
10
+ ...props ?? {},
11
+ children: normalizeChildren(children)
12
+ });
13
+ }
14
+ function normalizeChildren(children) {
15
+ return children.flat(Infinity).filter(
16
+ (child) => child !== null && child !== void 0 && child !== false
17
+ );
18
+ }
19
+ function jsxDEV(type, props, ..._deps) {
20
+ const children = props?.children;
21
+ const restProps = { ...props };
22
+ delete restProps.children;
23
+ if (type === Fragment) {
24
+ return normalizeChildren(Array.isArray(children) ? children : [children]);
25
+ }
26
+ if (typeof type !== "function") {
27
+ throw new Error("Invalid JSX element type");
28
+ }
29
+ return type({
30
+ ...restProps,
31
+ children: normalizeChildren(Array.isArray(children) ? children : [children])
32
+ });
33
+ }
34
+ export {
35
+ Fragment,
36
+ createElement,
37
+ createElement as jsx,
38
+ jsxDEV,
39
+ createElement as jsxs
40
+ };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { world, system } from "@minecraft/server";
2
- import { ModalFormData, ActionFormData, MessageFormData } from "@minecraft/server-ui";
2
+ import { A, M, e, a, c, d, s, b, t } from "./components-BZCbUNW6.js";
3
+ import { MessageFormData } from "@minecraft/server-ui";
3
4
  class Keystone {
4
5
  constructor() {
5
6
  }
@@ -475,12 +476,12 @@ class Vector3 {
475
476
  getIntermediateWithXValue(end, xValue) {
476
477
  const dx = end.x - this.x;
477
478
  if (dx === 0) return;
478
- const t = (xValue - this.x) / dx;
479
- if (t < 0 || t > 1) return;
479
+ const t2 = (xValue - this.x) / dx;
480
+ if (t2 < 0 || t2 > 1) return;
480
481
  return new Vector3(
481
- this.x + dx * t,
482
- this.y + (end.y - this.y) * t,
483
- this.z + (end.z - this.z) * t
482
+ this.x + dx * t2,
483
+ this.y + (end.y - this.y) * t2,
484
+ this.z + (end.z - this.z) * t2
484
485
  );
485
486
  }
486
487
  /**
@@ -492,12 +493,12 @@ class Vector3 {
492
493
  getIntermediateWithYValue(end, yValue) {
493
494
  const dy = end.y - this.y;
494
495
  if (dy === 0) return;
495
- const t = (yValue - this.y) / dy;
496
- if (t < 0 || t > 1) return;
496
+ const t2 = (yValue - this.y) / dy;
497
+ if (t2 < 0 || t2 > 1) return;
497
498
  return new Vector3(
498
- this.x + (end.x - this.x) * t,
499
- this.y + dy * t,
500
- this.z + (end.z - this.z) * t
499
+ this.x + (end.x - this.x) * t2,
500
+ this.y + dy * t2,
501
+ this.z + (end.z - this.z) * t2
501
502
  );
502
503
  }
503
504
  /**
@@ -509,12 +510,12 @@ class Vector3 {
509
510
  getIntermediateWithZValue(end, zValue) {
510
511
  const dz = end.z - this.z;
511
512
  if (dz === 0) return;
512
- const t = (zValue - this.z) / dz;
513
- if (t < 0 || t > 1) return;
513
+ const t2 = (zValue - this.z) / dz;
514
+ if (t2 < 0 || t2 > 1) return;
514
515
  return new Vector3(
515
- this.x + (end.x - this.x) * t,
516
- this.y + (end.y - this.y) * t,
517
- this.z + dz * t
516
+ this.x + (end.x - this.x) * t2,
517
+ this.y + (end.y - this.y) * t2,
518
+ this.z + dz * t2
518
519
  );
519
520
  }
520
521
  /**
@@ -805,7 +806,7 @@ function registerAfter(eventName, listener) {
805
806
  }
806
807
  const arr = afterListeners[eventName];
807
808
  arr.push(listener);
808
- arr.sort((a, b) => (b.priority ?? Priority.NORMAL) - (a.priority ?? Priority.NORMAL));
809
+ arr.sort((a2, b2) => (b2.priority ?? Priority.NORMAL) - (a2.priority ?? Priority.NORMAL));
809
810
  }
810
811
  function registerBefore(eventName, listener) {
811
812
  if (!beforeListeners[eventName]) {
@@ -813,7 +814,7 @@ function registerBefore(eventName, listener) {
813
814
  }
814
815
  const arr = beforeListeners[eventName];
815
816
  arr.push(listener);
816
- arr.sort((a, b) => (b.priority ?? Priority.NORMAL) - (a.priority ?? Priority.NORMAL));
817
+ arr.sort((a2, b2) => (b2.priority ?? Priority.NORMAL) - (a2.priority ?? Priority.NORMAL));
817
818
  }
818
819
  function dispatchAfter(eventName, event) {
819
820
  const arr = afterListeners[eventName];
@@ -821,8 +822,8 @@ function dispatchAfter(eventName, event) {
821
822
  for (const listener of arr) {
822
823
  try {
823
824
  listener.handler(event);
824
- } catch (e) {
825
- console.error(`[EventManager] after:${String(eventName)} handler threw:`, e);
825
+ } catch (e2) {
826
+ console.error(`[EventManager] after:${String(eventName)} handler threw:`, e2);
826
827
  }
827
828
  }
828
829
  }
@@ -832,8 +833,8 @@ function dispatchBefore(eventName, event) {
832
833
  for (const listener of arr) {
833
834
  try {
834
835
  listener.handler(event);
835
- } catch (e) {
836
- console.error(`[EventManager] before:${String(eventName)} handler threw:`, e);
836
+ } catch (e2) {
837
+ console.error(`[EventManager] before:${String(eventName)} handler threw:`, e2);
837
838
  }
838
839
  }
839
840
  }
@@ -922,7 +923,7 @@ class RepeatingTimer extends BaseTimer {
922
923
  }
923
924
  }
924
925
  function repeating(opts) {
925
- const t = new RepeatingTimer(
926
+ const t2 = new RepeatingTimer(
926
927
  opts.run,
927
928
  {
928
929
  period: opts.every ?? 1,
@@ -932,8 +933,8 @@ function repeating(opts) {
932
933
  },
933
934
  opts.cancel
934
935
  );
935
- t.start();
936
- return t;
936
+ t2.start();
937
+ return t2;
937
938
  }
938
939
  class DelayedTimer extends BaseTimer {
939
940
  constructor(delay, onRun, onCancel) {
@@ -966,9 +967,9 @@ class DelayedTimer extends BaseTimer {
966
967
  }
967
968
  }
968
969
  function delayed(ticks, run, cancel) {
969
- const t = new DelayedTimer(ticks, run, cancel);
970
- t.start();
971
- return t;
970
+ const t2 = new DelayedTimer(ticks, run, cancel);
971
+ t2.start();
972
+ return t2;
972
973
  }
973
974
  function sleep(ticks) {
974
975
  return new Promise((resolve) => {
@@ -1018,7 +1019,7 @@ class UntilTimer extends BaseTimer {
1018
1019
  }
1019
1020
  }
1020
1021
  function until(opts) {
1021
- const t = new UntilTimer(
1022
+ const t2 = new UntilTimer(
1022
1023
  opts.when,
1023
1024
  opts.run,
1024
1025
  opts.every ?? 1,
@@ -1026,8 +1027,8 @@ function until(opts) {
1026
1027
  opts.onTimeout,
1027
1028
  opts.cancel
1028
1029
  );
1029
- t.start();
1030
- return t;
1030
+ t2.start();
1031
+ return t2;
1031
1032
  }
1032
1033
  function waitUntil(condition, opts) {
1033
1034
  return new Promise((resolve) => {
@@ -1040,60 +1041,6 @@ function waitUntil(condition, opts) {
1040
1041
  });
1041
1042
  });
1042
1043
  }
1043
- class ModalForm {
1044
- constructor(config) {
1045
- this.config = config;
1046
- }
1047
- async send(player) {
1048
- const form = new ModalFormData().title(this.config.title);
1049
- for (const component of this.config.components) {
1050
- component.render(form);
1051
- }
1052
- const res = await form.show(player);
1053
- if (res.canceled) {
1054
- this.config.previousForm?.send(player);
1055
- return;
1056
- }
1057
- res.formValues?.forEach((value, index) => {
1058
- const component = this.config.components[index];
1059
- try {
1060
- component.handle?.(player, value);
1061
- } catch (e) {
1062
- console.warn(`[ModalForm] handler error at index ${index}: ${e}`);
1063
- }
1064
- });
1065
- this.config.handle?.(player, res.formValues);
1066
- }
1067
- }
1068
- function createModalForm(config) {
1069
- return new ModalForm(config);
1070
- }
1071
- class ActionForm {
1072
- constructor(config) {
1073
- this.config = config;
1074
- }
1075
- async send(player) {
1076
- const form = new ActionFormData().title(this.config.title);
1077
- if (this.config.body) {
1078
- form.body(this.config.body);
1079
- }
1080
- for (const btn of this.config.buttons) {
1081
- btn.render(form);
1082
- }
1083
- const res = await form.show(player);
1084
- if (res.canceled) {
1085
- this.config.previousForm?.send(player);
1086
- return;
1087
- }
1088
- const index = res.selection;
1089
- if (index === void 0) return;
1090
- const button2 = this.config.buttons[index];
1091
- button2?.handle(player);
1092
- }
1093
- }
1094
- function createActionForm(config) {
1095
- return new ActionForm(config);
1096
- }
1097
1044
  class MessageForm {
1098
1045
  constructor(config) {
1099
1046
  this.config = config;
@@ -1115,97 +1062,30 @@ class MessageForm {
1115
1062
  function createMessageForm(config) {
1116
1063
  return new MessageForm(config);
1117
1064
  }
1118
- function toggle(opts) {
1119
- return {
1120
- render(form) {
1121
- form.toggle(opts.label, { defaultValue: opts.default });
1122
- },
1123
- handle(player, value) {
1124
- opts.handler(player, value);
1125
- }
1126
- };
1127
- }
1128
- function textField(opts) {
1129
- return {
1130
- render(form) {
1131
- form.textField(
1132
- opts.label,
1133
- opts.placeholder ?? "",
1134
- { defaultValue: opts.default ?? "" }
1135
- );
1136
- },
1137
- handle(player, value) {
1138
- opts.handler(player, value);
1139
- }
1140
- };
1141
- }
1142
- function slider(opts) {
1143
- return {
1144
- render(form) {
1145
- form.slider(
1146
- opts.label,
1147
- opts.min,
1148
- opts.max,
1149
- { valueStep: opts.step ?? 1, defaultValue: opts.default }
1150
- );
1151
- },
1152
- handle(player, value) {
1153
- opts.handler(player, value);
1154
- }
1155
- };
1156
- }
1157
- function dropdown(opts) {
1158
- return {
1159
- render(form) {
1160
- form.dropdown(
1161
- opts.label,
1162
- opts.options,
1163
- { defaultValueIndex: opts.defaultIndex ?? 0 }
1164
- );
1165
- },
1166
- handle(player, value) {
1167
- opts.handler(player, value);
1168
- }
1169
- };
1170
- }
1171
- function button(opts) {
1172
- return {
1173
- render(form) {
1174
- if (opts.iconPath) {
1175
- form.button(opts.text, opts.iconPath);
1176
- } else {
1177
- form.button(opts.text);
1178
- }
1179
- },
1180
- handle(player) {
1181
- opts.handler(player);
1182
- }
1183
- };
1184
- }
1185
1065
  export {
1186
- ActionForm,
1066
+ A as ActionForm,
1187
1067
  AxisAlignedBB,
1188
1068
  DelayedTimer,
1189
1069
  EventManager,
1190
1070
  MessageForm,
1191
- ModalForm,
1071
+ M as ModalForm,
1192
1072
  Priority,
1193
1073
  RepeatingTimer,
1194
1074
  UntilTimer,
1195
1075
  Vector3,
1196
- button,
1197
- createActionForm,
1076
+ e as button,
1077
+ a as createActionForm,
1198
1078
  createMessageForm,
1199
- createModalForm,
1079
+ c as createModalForm,
1200
1080
  debug,
1201
1081
  delayed,
1202
- dropdown,
1082
+ d as dropdown,
1203
1083
  keystone,
1204
1084
  repeating,
1205
1085
  sleep,
1206
- slider,
1207
- textField,
1208
- toggle,
1086
+ s as slider,
1087
+ b as textField,
1088
+ t as toggle,
1209
1089
  until,
1210
1090
  waitUntil
1211
1091
  };
@@ -0,0 +1,11 @@
1
+ import { Plugin } from 'vite';
2
+ type PluginConfig = {
3
+ name: string;
4
+ uuid?: string;
5
+ description?: string;
6
+ authors?: string[];
7
+ version?: number[];
8
+ embedSourceMap?: boolean;
9
+ };
10
+ declare const behaviorPacker: ({ name, uuid, description, authors, version, embedSourceMap, }?: PluginConfig) => Plugin;
11
+ export default behaviorPacker;
@@ -1,11 +1,3 @@
1
- import { Plugin } from 'vite';
2
- type PluginConfig = {
3
- name: string;
4
- uuid?: string;
5
- description?: string;
6
- authors?: string[];
7
- version?: number[];
8
- embedSourceMap?: boolean;
9
- };
10
- declare const behaviorPacker: ({ name, uuid, description, authors, version, embedSourceMap, }?: PluginConfig) => Plugin;
11
- export default behaviorPacker;
1
+ import { default as behaviorPacker } from './behaviorPacker';
2
+ import { default as supportJsx } from './supportJsx';
3
+ export { behaviorPacker, supportJsx, };
@@ -40,7 +40,7 @@ const behaviorPacker = ({
40
40
  },
41
41
  generateBundle(options, bundle) {
42
42
  if (!embedSourceMap) return;
43
- for (const [fileName, file] of Object.entries(bundle)) {
43
+ for (const [, file] of Object.entries(bundle)) {
44
44
  if (file.type === "chunk" && file.map) {
45
45
  const sourceMapData = file.map;
46
46
  const embeddedSourceMap = {
@@ -113,6 +113,18 @@ globalThis.__SOURCE_MAP__ = ${JSON.stringify(embeddedSourceMap)};
113
113
  fs.writeFileSync("./dist_behavior_pack/manifest.json", JSON.stringify(manifestStub, null, 2));
114
114
  }
115
115
  });
116
+ const supportJsx = () => ({
117
+ name: "SupportJsx",
118
+ config: () => {
119
+ return {
120
+ esbuild: {
121
+ jsx: "automatic",
122
+ jsxImportSource: "keystonemc/form"
123
+ }
124
+ };
125
+ }
126
+ });
116
127
  export {
117
- behaviorPacker as default
128
+ behaviorPacker,
129
+ supportJsx
118
130
  };
@@ -0,0 +1,3 @@
1
+ import { Plugin } from 'vite';
2
+ declare const supportJsx: () => Plugin;
3
+ export default supportJsx;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keystonemc",
3
- "version": "3.2.3",
3
+ "version": "4.0.0",
4
4
  "description": "ScriptAPI Wrapper",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,12 +10,43 @@
10
10
  "main": "./dist/index.js",
11
11
  "module": "./dist/index.js",
12
12
  "types": "./dist/core/index.d.ts",
13
+ "typesVersions": {
14
+ "*": {
15
+ "form/jsx-runtime": [
16
+ "./dist/core/form/tsx/runtime.d.ts"
17
+ ],
18
+ "form/jsx-dev-runtime": [
19
+ "./dist/core/form/tsx/runtime.d.ts"
20
+ ],
21
+ "form/component": [
22
+ "./dist/core/form/tsx/components/index.d.ts"
23
+ ],
24
+ "vite-plugin": [
25
+ "./dist/vite-plugin/index.d.ts"
26
+ ]
27
+ }
28
+ },
13
29
  "exports": {
14
30
  ".": {
15
31
  "types": "./dist/core/index.d.ts",
16
32
  "import": "./dist/index.js",
17
33
  "default": "./dist/index.js"
18
34
  },
35
+ "./form/jsx-runtime": {
36
+ "types": "./dist/core/form/tsx/runtime.d.ts",
37
+ "import": "./dist/form/jsx-runtime/index.js",
38
+ "default": "./dist/form/jsx-runtime/index.js"
39
+ },
40
+ "./form/jsx-dev-runtime": {
41
+ "types": "./dist/core/form/tsx/runtime.d.ts",
42
+ "import": "./dist/form/jsx-runtime/index.js",
43
+ "default": "./dist/form/jsx-runtime/index.js"
44
+ },
45
+ "./form/component": {
46
+ "types": "./dist/core/form/tsx/components/index.d.ts",
47
+ "import": "./dist/form/component/index.js",
48
+ "default": "./dist/form/component/index.js"
49
+ },
19
50
  "./vite-plugin": {
20
51
  "types": "./dist/vite-plugin/index.d.ts",
21
52
  "import": "./dist/vite-plugin/index.js",