@nanoforge-dev/editor 0.0.2-beta.d5ae009 → 0.0.2-beta.f0560db

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.
Files changed (147) hide show
  1. package/dist/client/_app/immutable/assets/{0.CjGIZXZs.css → 0.DM_luNRS.css} +1 -1
  2. package/dist/client/_app/immutable/assets/0.DM_luNRS.css.br +0 -0
  3. package/dist/client/_app/immutable/assets/0.DM_luNRS.css.gz +0 -0
  4. package/dist/client/_app/immutable/chunks/{FP7xnvT4.js → BGzu53pG.js} +1 -1
  5. package/dist/client/_app/immutable/chunks/BGzu53pG.js.br +0 -0
  6. package/dist/client/_app/immutable/chunks/BGzu53pG.js.gz +0 -0
  7. package/dist/client/_app/immutable/chunks/BnWY0TZI.js +1 -0
  8. package/dist/client/_app/immutable/chunks/BnWY0TZI.js.br +0 -0
  9. package/dist/client/_app/immutable/chunks/BnWY0TZI.js.gz +0 -0
  10. package/dist/client/_app/immutable/chunks/CVHDnHfN.js +293 -0
  11. package/dist/client/_app/immutable/chunks/CVHDnHfN.js.br +0 -0
  12. package/dist/client/_app/immutable/chunks/CVHDnHfN.js.gz +0 -0
  13. package/dist/client/_app/immutable/chunks/{MAzZK5cV.js → DXCLqAaQ.js} +1 -1
  14. package/dist/client/_app/immutable/chunks/DXCLqAaQ.js.br +0 -0
  15. package/dist/client/_app/immutable/chunks/DXCLqAaQ.js.gz +0 -0
  16. package/dist/client/_app/immutable/chunks/DoLBDi-M.js +6 -0
  17. package/dist/client/_app/immutable/chunks/DoLBDi-M.js.br +0 -0
  18. package/dist/client/_app/immutable/chunks/DoLBDi-M.js.gz +0 -0
  19. package/dist/client/_app/immutable/chunks/{CT3UgqBA.js → IxQBh0uF.js} +1 -1
  20. package/dist/client/_app/immutable/chunks/IxQBh0uF.js.br +0 -0
  21. package/dist/client/_app/immutable/chunks/IxQBh0uF.js.gz +0 -0
  22. package/dist/client/_app/immutable/entry/{app.D7Qhroat.js → app.BDH5Gw2t.js} +2 -2
  23. package/dist/client/_app/immutable/entry/app.BDH5Gw2t.js.br +0 -0
  24. package/dist/client/_app/immutable/entry/app.BDH5Gw2t.js.gz +0 -0
  25. package/dist/client/_app/immutable/entry/start.D1GEGS4G.js +1 -0
  26. package/dist/client/_app/immutable/entry/start.D1GEGS4G.js.br +0 -0
  27. package/dist/client/_app/immutable/entry/start.D1GEGS4G.js.gz +0 -0
  28. package/dist/client/_app/immutable/nodes/{1.D2petaCJ.js → 1.nyMXETd-.js} +1 -1
  29. package/dist/client/_app/immutable/nodes/1.nyMXETd-.js.br +1 -0
  30. package/dist/client/_app/immutable/nodes/1.nyMXETd-.js.gz +0 -0
  31. package/dist/client/_app/immutable/nodes/{9.BGu6EfS2.js → 10.D5dyxEoB.js} +1 -1
  32. package/dist/client/_app/immutable/nodes/10.D5dyxEoB.js.br +0 -0
  33. package/dist/client/_app/immutable/nodes/10.D5dyxEoB.js.gz +0 -0
  34. package/dist/client/_app/immutable/nodes/2.LU26GJum.js +1 -0
  35. package/dist/client/_app/immutable/nodes/2.LU26GJum.js.br +0 -0
  36. package/dist/client/_app/immutable/nodes/2.LU26GJum.js.gz +0 -0
  37. package/dist/client/_app/immutable/nodes/3.DekRDPns.js +6 -0
  38. package/dist/client/_app/immutable/nodes/3.DekRDPns.js.br +0 -0
  39. package/dist/client/_app/immutable/nodes/3.DekRDPns.js.gz +0 -0
  40. package/dist/client/_app/version.json +1 -1
  41. package/dist/client/_app/version.json.br +0 -0
  42. package/dist/client/_app/version.json.gz +0 -0
  43. package/dist/server/chunks/{0-D3qhveQr.js → 0-DZ9xD1ZS.js} +3 -3
  44. package/dist/server/chunks/{0-D3qhveQr.js.map → 0-DZ9xD1ZS.js.map} +1 -1
  45. package/dist/server/chunks/{1-DC3uFVBV.js → 1-BmDOEhD1.js} +5 -5
  46. package/dist/server/chunks/{1-DC3uFVBV.js.map → 1-BmDOEhD1.js.map} +1 -1
  47. package/dist/server/chunks/{9-C-mS2ReE.js → 10-fxkdMQYG.js} +10 -10
  48. package/dist/server/chunks/10-fxkdMQYG.js.map +1 -0
  49. package/dist/server/chunks/{2-DX6ErPQr.js → 2-CTnsJAeO.js} +7 -7
  50. package/dist/server/chunks/{2-DX6ErPQr.js.map → 2-CTnsJAeO.js.map} +1 -1
  51. package/dist/server/chunks/3-sY71Rvnf.js +22 -0
  52. package/dist/server/chunks/3-sY71Rvnf.js.map +1 -0
  53. package/dist/server/chunks/{3-BFIclw2U.js → 4-BYQgShv3.js} +4 -4
  54. package/dist/server/chunks/{3-BFIclw2U.js.map → 4-BYQgShv3.js.map} +1 -1
  55. package/dist/server/chunks/{8-D8RKzhKE.js → 5-B4IXyXqv.js} +4 -4
  56. package/dist/server/chunks/{8-D8RKzhKE.js.map → 5-B4IXyXqv.js.map} +1 -1
  57. package/dist/server/chunks/{4-Cim4b7CK.js → 6-DH_IMDRv.js} +4 -4
  58. package/dist/server/chunks/{4-Cim4b7CK.js.map → 6-DH_IMDRv.js.map} +1 -1
  59. package/dist/server/chunks/{6-CadULKrR.js → 7-CPMeoSUO.js} +4 -4
  60. package/dist/server/chunks/{6-CadULKrR.js.map → 7-CPMeoSUO.js.map} +1 -1
  61. package/dist/server/chunks/{7-CxjbU6zP.js → 8-CRTa48Fz.js} +4 -4
  62. package/dist/server/chunks/{7-CxjbU6zP.js.map → 8-CRTa48Fz.js.map} +1 -1
  63. package/dist/server/chunks/{5-DQ3o1uwg.js → 9-DPn3d8kr.js} +4 -4
  64. package/dist/server/chunks/{5-DQ3o1uwg.js.map → 9-DPn3d8kr.js.map} +1 -1
  65. package/dist/server/chunks/{_page.svelte-ByqpfNPC.js → _page.svelte-C9Sfe7iL.js} +6 -6
  66. package/dist/server/chunks/_page.svelte-C9Sfe7iL.js.map +1 -0
  67. package/dist/server/chunks/{_page.svelte-C1HyEKjK.js → _page.svelte-CKCWxyuV.js} +202 -41
  68. package/dist/server/chunks/_page.svelte-CKCWxyuV.js.map +1 -0
  69. package/dist/server/chunks/{_page.svelte-CF_EqiqV.js → _page.svelte-DrUJljJj.js} +5 -5
  70. package/dist/server/chunks/_page.svelte-DrUJljJj.js.map +1 -0
  71. package/dist/server/chunks/{_server.ts-DFC8ij6-.js → _server.ts-a-I4s4R9.js} +2 -2
  72. package/dist/server/chunks/{_server.ts-DFC8ij6-.js.map → _server.ts-a-I4s4R9.js.map} +1 -1
  73. package/dist/server/chunks/{_server.ts-DvvWYqRd.js → _server.ts-y6LeO9-5.js} +15 -3
  74. package/dist/server/chunks/_server.ts-y6LeO9-5.js.map +1 -0
  75. package/dist/server/chunks/{client-DhMlbh2c.js → client-wcMzlYMJ.js} +2 -2
  76. package/dist/server/chunks/{client-DhMlbh2c.js.map → client-wcMzlYMJ.js.map} +1 -1
  77. package/dist/server/chunks/{error-Df0LgzGi.js → error-yRLerN6-.js} +127 -57
  78. package/dist/server/chunks/error-yRLerN6-.js.map +1 -0
  79. package/dist/server/chunks/{error.svelte-DM_iE9zL.js → error.svelte-CSc64jDg.js} +2 -2
  80. package/dist/server/chunks/{error.svelte-DM_iE9zL.js.map → error.svelte-CSc64jDg.js.map} +1 -1
  81. package/dist/server/chunks/{hooks.server-CKcZoYoT.js → hooks.server-DZzWiuvp.js} +2 -2
  82. package/dist/server/chunks/{hooks.server-CKcZoYoT.js.map → hooks.server-DZzWiuvp.js.map} +1 -1
  83. package/dist/server/chunks/{internal2-CRbvkWND.js → internal2-CymmS2kD.js} +3 -3
  84. package/dist/server/chunks/{internal2-CRbvkWND.js.map → internal2-CymmS2kD.js.map} +1 -1
  85. package/dist/server/chunks/{logo-C422_TRA.js → logo-DQvU3yHs.js} +2 -2
  86. package/dist/server/chunks/logo-DQvU3yHs.js.map +1 -0
  87. package/dist/server/chunks/{project-loader-3ZC0fkGL.js → project-loader-WpOsdMow.js} +3 -3
  88. package/dist/server/chunks/{project-loader-3ZC0fkGL.js.map → project-loader-WpOsdMow.js.map} +1 -1
  89. package/dist/server/chunks/{request-handler-DIqttORJ.js → request-handler-guINVc1G.js} +3 -3
  90. package/dist/server/chunks/request-handler-guINVc1G.js.map +1 -0
  91. package/dist/server/chunks/{schemas-iHhaE-aY.js → schemas-C35GnK5_.js} +6 -25
  92. package/dist/server/chunks/schemas-C35GnK5_.js.map +1 -0
  93. package/dist/server/chunks/{state-DHSP_spt.js → state-t8aj5-Cf.js} +2 -2
  94. package/dist/server/chunks/{state-DHSP_spt.js.map → state-t8aj5-Cf.js.map} +1 -1
  95. package/dist/server/index.js +1 -1
  96. package/dist/server/manifest.js +29 -29
  97. package/dist/server/manifest.js.map +1 -1
  98. package/package.json +1 -1
  99. package/dist/client/_app/immutable/assets/0.CjGIZXZs.css.br +0 -0
  100. package/dist/client/_app/immutable/assets/0.CjGIZXZs.css.gz +0 -0
  101. package/dist/client/_app/immutable/chunks/CBO6kAED.js +0 -293
  102. package/dist/client/_app/immutable/chunks/CBO6kAED.js.br +0 -0
  103. package/dist/client/_app/immutable/chunks/CBO6kAED.js.gz +0 -0
  104. package/dist/client/_app/immutable/chunks/CT3UgqBA.js.br +0 -0
  105. package/dist/client/_app/immutable/chunks/CT3UgqBA.js.gz +0 -0
  106. package/dist/client/_app/immutable/chunks/DEqe37pD.js +0 -6
  107. package/dist/client/_app/immutable/chunks/DEqe37pD.js.br +0 -0
  108. package/dist/client/_app/immutable/chunks/DEqe37pD.js.gz +0 -0
  109. package/dist/client/_app/immutable/chunks/DNftsqR1.js +0 -1
  110. package/dist/client/_app/immutable/chunks/DNftsqR1.js.br +0 -0
  111. package/dist/client/_app/immutable/chunks/DNftsqR1.js.gz +0 -0
  112. package/dist/client/_app/immutable/chunks/FP7xnvT4.js.br +0 -0
  113. package/dist/client/_app/immutable/chunks/FP7xnvT4.js.gz +0 -0
  114. package/dist/client/_app/immutable/chunks/MAzZK5cV.js.br +0 -0
  115. package/dist/client/_app/immutable/chunks/MAzZK5cV.js.gz +0 -0
  116. package/dist/client/_app/immutable/entry/app.D7Qhroat.js.br +0 -0
  117. package/dist/client/_app/immutable/entry/app.D7Qhroat.js.gz +0 -0
  118. package/dist/client/_app/immutable/entry/start.Di1N-dwj.js +0 -1
  119. package/dist/client/_app/immutable/entry/start.Di1N-dwj.js.br +0 -1
  120. package/dist/client/_app/immutable/entry/start.Di1N-dwj.js.gz +0 -0
  121. package/dist/client/_app/immutable/nodes/1.D2petaCJ.js.br +0 -1
  122. package/dist/client/_app/immutable/nodes/1.D2petaCJ.js.gz +0 -0
  123. package/dist/client/_app/immutable/nodes/10.C4HJc4cu.js +0 -6
  124. package/dist/client/_app/immutable/nodes/10.C4HJc4cu.js.br +0 -0
  125. package/dist/client/_app/immutable/nodes/10.C4HJc4cu.js.gz +0 -0
  126. package/dist/client/_app/immutable/nodes/2.DnluJ7u1.js +0 -1
  127. package/dist/client/_app/immutable/nodes/2.DnluJ7u1.js.br +0 -0
  128. package/dist/client/_app/immutable/nodes/2.DnluJ7u1.js.gz +0 -0
  129. package/dist/client/_app/immutable/nodes/9.BGu6EfS2.js.br +0 -0
  130. package/dist/client/_app/immutable/nodes/9.BGu6EfS2.js.gz +0 -0
  131. package/dist/server/chunks/10-BVrMXTW8.js +0 -22
  132. package/dist/server/chunks/10-BVrMXTW8.js.map +0 -1
  133. package/dist/server/chunks/9-C-mS2ReE.js.map +0 -1
  134. package/dist/server/chunks/_page.svelte-ByqpfNPC.js.map +0 -1
  135. package/dist/server/chunks/_page.svelte-C1HyEKjK.js.map +0 -1
  136. package/dist/server/chunks/_page.svelte-CF_EqiqV.js.map +0 -1
  137. package/dist/server/chunks/_server.ts-DvvWYqRd.js.map +0 -1
  138. package/dist/server/chunks/error-Df0LgzGi.js.map +0 -1
  139. package/dist/server/chunks/logo-C422_TRA.js.map +0 -1
  140. package/dist/server/chunks/request-handler-DIqttORJ.js.map +0 -1
  141. package/dist/server/chunks/schemas-iHhaE-aY.js.map +0 -1
  142. /package/dist/client/_app/immutable/assets/{10.BP_hUVIU.css → 3.BP_hUVIU.css} +0 -0
  143. /package/dist/client/_app/immutable/assets/{10.BP_hUVIU.css.br → 3.BP_hUVIU.css.br} +0 -0
  144. /package/dist/client/_app/immutable/assets/{10.BP_hUVIU.css.gz → 3.BP_hUVIU.css.gz} +0 -0
  145. /package/dist/client/_app/immutable/nodes/{0.CW6BAtSC.js → 0.YMw6-DDI.js} +0 -0
  146. /package/dist/client/_app/immutable/nodes/{0.CW6BAtSC.js.br → 0.YMw6-DDI.js.br} +0 -0
  147. /package/dist/client/_app/immutable/nodes/{0.CW6BAtSC.js.gz → 0.YMw6-DDI.js.gz} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { Ct as clsx, D as ensure_array_like, M as get$1$1, N as getAllContexts, P as getContext, R as hasContext, St as writable, X as mount, a as ATTACHMENT_KEY, ct as setContext, dt as spread_props, g as bind_props, gt as tick, h as attributes, k as escape_html, ot as run, r as on, tt as props_id, w as derived, y as clsx$1, yt as unmount } from "./events-Bhh2w-5S.js";
2
- import { G as noop$1, J as parse } from "./internal2-CRbvkWND.js";
2
+ import { G as noop$1, J as parse } from "./internal2-CymmS2kD.js";
3
3
  import { t as app } from "./app-DUeJj5RD.js";
4
4
  import { n as SESSION_PROJECT_HEADER, t as Exception } from "./const-Dy5RfQqP.js";
5
5
  import { r as formatFrom, t as HttpClient } from "./format-DGOlJxF5.js";
6
- import { a as resolve, i as invalidateAll, n as applyAction, r as goto } from "./client-DhMlbh2c.js";
6
+ import { a as resolve, i as invalidateAll, n as applyAction, r as goto } from "./client-wcMzlYMJ.js";
7
7
  import { A as resolveQueryBoolean, I as timeUntilStale, L as timeoutManager, N as shallowEqualObjects, O as pendingThenable, R as toast, T as notifyManager, _ as getIsRestoringContext, c as SvelteMap, f as createSubscriber, h as focusManager, j as resolveStaleTime, k as replaceData, l as SvelteSet, m as fetchState, n as Loader_circle, p as environmentManager, s as Subscribable, t as Icon, v as getQueryClientContext, w as noop$2, x as isValidTimeout } from "./loader-circle-CFNm9vip.js";
8
8
  //#region node_modules/.pnpm/tailwind-merge@3.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs
9
9
  /**
@@ -4665,21 +4665,24 @@ var getActionClient = (projectId) => {
4665
4665
  };
4666
4666
  };
4667
4667
  var noProjectActions = getActionClient();
4668
- var componentsTransformer = (components) => components.map((component) => ({
4668
+ var componentTransformer = (component) => ({
4669
4669
  id: component.manifest.id,
4670
4670
  name: component.manifest.name,
4671
4671
  path: component.save.path,
4672
4672
  params: component.manifest.params
4673
- }));
4674
- var systemsTransformer = (systems) => systems.map((system) => ({
4673
+ });
4674
+ var componentsTransformer = (components) => components.map(componentTransformer);
4675
+ var systemTransformer = (system) => ({
4675
4676
  id: system.manifest.id,
4676
4677
  name: system.manifest.name,
4677
4678
  path: system.save.path
4678
- }));
4679
- var librariesTransformer = (save) => save.libraries.map((lib) => ({
4679
+ });
4680
+ var systemsTransformer = (systems) => systems.map(systemTransformer);
4681
+ var libraryTransformer = (lib) => ({
4680
4682
  id: lib.path,
4681
4683
  name: lib.name
4682
- }));
4684
+ });
4685
+ var librariesTransformer = (save) => save.libraries.map(libraryTransformer);
4683
4686
  var scenesTransformer = (save) => [{
4684
4687
  id: "default",
4685
4688
  name: "Default Scene",
@@ -4759,7 +4762,7 @@ var ComponentHandle = class {
4759
4762
  });
4760
4763
  }
4761
4764
  delete() {
4762
- this._manager.delete(this.id);
4765
+ return this._manager.delete(this.id);
4763
4766
  }
4764
4767
  };
4765
4768
  var _storage$12 = writable([]);
@@ -4778,16 +4781,23 @@ var ComponentManager = class {
4778
4781
  get data() {
4779
4782
  return get$1$1(_storage$12);
4780
4783
  }
4781
- add(component) {
4782
- const components = get$1$1(_storage$12);
4783
- const id = getId(this.data, component.name);
4784
- components.push({
4785
- ...component,
4786
- id,
4787
- path: component.path ?? `components/${id}.ts`
4788
- });
4789
- _storage$12.set(components);
4790
- return id;
4784
+ async create(name) {
4785
+ const { actions, fs } = useProject();
4786
+ const component = await actions.package.createComponent({ componentName: name });
4787
+ this._add(componentTransformer(component));
4788
+ await (await fs.getDirectory()).readdir(true);
4789
+ }
4790
+ async import(names) {
4791
+ const { actions, ecs, fs } = useProject();
4792
+ await actions.package.addComponents({ componentNames: names });
4793
+ await this.sync();
4794
+ await ecs.components.sync();
4795
+ await (await fs.getDirectory()).readdir(true);
4796
+ }
4797
+ async sync() {
4798
+ const { actions } = useProject();
4799
+ const components = await actions.package.getComponents();
4800
+ _storage$12.set(componentsTransformer(components));
4791
4801
  }
4792
4802
  get(id) {
4793
4803
  const component = get$1$1(_storage$12).find((component) => component.id === id);
@@ -4796,9 +4806,13 @@ var ComponentManager = class {
4796
4806
  this._subscribe(id, handle);
4797
4807
  return handle;
4798
4808
  }
4799
- delete(id) {
4809
+ async delete(id) {
4800
4810
  const components = get$1$1(_storage$12);
4801
- _storage$12.set(components.filter((component) => component.id !== id));
4811
+ const component = components.find((c) => c.id === id);
4812
+ if (!component) throw new Error(`System not found: ${id}`);
4813
+ _storage$12.set(components.filter((c) => c.id !== id));
4814
+ const { fs } = useProject();
4815
+ await (await fs.getFile(component.path)).delete();
4802
4816
  const subscriptions = get$1$1(_subscriptions$6);
4803
4817
  if (subscriptions[id]) {
4804
4818
  subscriptions[id]();
@@ -4806,6 +4820,11 @@ var ComponentManager = class {
4806
4820
  _subscriptions$6.set(subscriptions);
4807
4821
  }
4808
4822
  }
4823
+ _add(component) {
4824
+ const components = get$1$1(_storage$12);
4825
+ components.push(component);
4826
+ _storage$12.set(components);
4827
+ }
4809
4828
  _subscribe(id, handle) {
4810
4829
  setTimeout(() => {
4811
4830
  const subscriptions = get$1$1(_subscriptions$6);
@@ -4957,6 +4976,7 @@ var ComponentParamManager = class {
4957
4976
  component;
4958
4977
  _store;
4959
4978
  _valuesStore;
4979
+ _storageResolvable;
4960
4980
  static reset() {
4961
4981
  _storage$8.set({});
4962
4982
  _valueStorage.set({});
@@ -4965,9 +4985,9 @@ var ComponentParamManager = class {
4965
4985
  }
4966
4986
  constructor(component, params) {
4967
4987
  this.component = component;
4968
- const storageResolvable = `${this.component.manager.entity.manager.scene.id}/${this.component.manager.entity.id}/${this.component.id}`;
4969
- this._store = resolveStore(_storage$8, storageResolvable, get$1$1(component.store).params);
4970
- this._valuesStore = resolveStore(_valueStorage, storageResolvable, params);
4988
+ this._storageResolvable = `${this.component.manager.entity.manager.scene.id}/${this.component.manager.entity.id}/${this.component.id}`;
4989
+ this._store = resolveStore(_storage$8, this._storageResolvable, get$1$1(component.store).params);
4990
+ this._valuesStore = resolveStore(_valueStorage, this._storageResolvable, params);
4971
4991
  this._listen();
4972
4992
  }
4973
4993
  get store() {
@@ -4990,10 +5010,11 @@ var ComponentParamManager = class {
4990
5010
  ...param,
4991
5011
  value: void 0
4992
5012
  } : param));
5013
+ const fullId = `${this._storageResolvable}/${id}`;
4993
5014
  const subscriptions = get$1$1(_subscriptions$4);
4994
- if (subscriptions[id]) {
4995
- subscriptions[id]();
4996
- subscriptions[id] = null;
5015
+ if (subscriptions[fullId]) {
5016
+ subscriptions[fullId]();
5017
+ subscriptions[fullId] = null;
4997
5018
  _subscriptions$4.set(subscriptions);
4998
5019
  }
4999
5020
  }
@@ -5006,9 +5027,10 @@ var ComponentParamManager = class {
5006
5027
  }
5007
5028
  _subscribe(id, handle) {
5008
5029
  setTimeout(() => {
5030
+ const fullId = `${this._storageResolvable}/${id}`;
5009
5031
  const subscriptions = get$1$1(_subscriptions$4);
5010
- if (subscriptions[id]) return;
5011
- subscriptions[id] = handle.value.subscribe((param) => this._update(id, param));
5032
+ if (subscriptions[fullId]) return;
5033
+ subscriptions[fullId] = handle.value.subscribe((param) => this._update(id, param));
5012
5034
  _subscriptions$4.set(subscriptions);
5013
5035
  }, 0);
5014
5036
  }
@@ -5048,6 +5070,7 @@ var _listener$3 = writable();
5048
5070
  var EntityComponentManager = class {
5049
5071
  entity;
5050
5072
  _store;
5073
+ _storageResolvable;
5051
5074
  static reset() {
5052
5075
  _storage$7.set({});
5053
5076
  resetSubscriptions(_subscriptions$3);
@@ -5055,8 +5078,8 @@ var EntityComponentManager = class {
5055
5078
  }
5056
5079
  constructor(entity, components) {
5057
5080
  this.entity = entity;
5058
- const storageResolvable = `${this.entity.manager.scene.id}/${this.entity.id}`;
5059
- this._store = resolveStore(_storage$7, storageResolvable, components);
5081
+ this._storageResolvable = `${this.entity.manager.scene.id}/${this.entity.id}`;
5082
+ this._store = resolveStore(_storage$7, this._storageResolvable, components);
5060
5083
  this._listen();
5061
5084
  }
5062
5085
  get store() {
@@ -5085,10 +5108,11 @@ var EntityComponentManager = class {
5085
5108
  if (key !== id) newComponents[key] = params;
5086
5109
  });
5087
5110
  this._store.set(newComponents);
5111
+ const fullId = `${this._storageResolvable}/${id}`;
5088
5112
  const subscriptions = get$1$1(_subscriptions$3);
5089
- if (subscriptions[id]) {
5090
- subscriptions[id]();
5091
- subscriptions[id] = null;
5113
+ if (subscriptions[fullId]) {
5114
+ subscriptions[fullId]();
5115
+ subscriptions[fullId] = null;
5092
5116
  _subscriptions$3.set(subscriptions);
5093
5117
  }
5094
5118
  }
@@ -5106,9 +5130,10 @@ var EntityComponentManager = class {
5106
5130
  }
5107
5131
  _subscribe(id, handle) {
5108
5132
  setTimeout(() => {
5133
+ const fullId = `${this._storageResolvable}/${id}`;
5109
5134
  const subscriptions = get$1$1(_subscriptions$3);
5110
- if (subscriptions[id]) return;
5111
- subscriptions[id] = handle.params.values.subscribe((params) => this._update(id, params));
5135
+ if (subscriptions[fullId]) return;
5136
+ subscriptions[fullId] = handle.params.values.subscribe((params) => this._update(id, params));
5112
5137
  _subscriptions$3.set(subscriptions);
5113
5138
  }, 0);
5114
5139
  }
@@ -5216,19 +5241,21 @@ var SceneEntityManager = class {
5216
5241
  delete(id) {
5217
5242
  const entities = get$1$1(this._store);
5218
5243
  this._store.set(entities.filter((entity) => entity.id !== id));
5244
+ const fullId = `${this.scene.id}/${id}`;
5219
5245
  const subscriptions = get$1$1(_subscriptions$2);
5220
- if (subscriptions[id]) {
5221
- subscriptions[id]();
5222
- subscriptions[id] = null;
5246
+ if (subscriptions[fullId]) {
5247
+ subscriptions[fullId]();
5248
+ subscriptions[fullId] = null;
5223
5249
  _subscriptions$2.set(subscriptions);
5224
5250
  }
5225
5251
  if (this.selectedData?.id === id) this.selected = void 0;
5226
5252
  }
5227
5253
  _subscribe(id, handle) {
5228
5254
  setTimeout(() => {
5255
+ const fullId = `${this.scene.id}/${id}`;
5229
5256
  const subscriptions = get$1$1(_subscriptions$2);
5230
- if (subscriptions[id]) return;
5231
- subscriptions[id] = handle.store.subscribe((entity) => this._update(id, entity));
5257
+ if (subscriptions[fullId]) return;
5258
+ subscriptions[fullId] = handle.store.subscribe((entity) => this._update(id, entity));
5232
5259
  _subscriptions$2.set(subscriptions);
5233
5260
  }, 0);
5234
5261
  }
@@ -5492,7 +5519,7 @@ var SystemHandle = class {
5492
5519
  });
5493
5520
  }
5494
5521
  delete() {
5495
- this._manager.delete(this.id);
5522
+ return this._manager.delete(this.id);
5496
5523
  }
5497
5524
  };
5498
5525
  var _storage = writable([]);
@@ -5511,16 +5538,23 @@ var SystemManager = class {
5511
5538
  get data() {
5512
5539
  return get$1$1(_storage);
5513
5540
  }
5514
- add(system) {
5515
- const systems = get$1$1(_storage);
5516
- const id = getId(this.data, system.name);
5517
- systems.push({
5518
- ...system,
5519
- id,
5520
- path: system.path ?? `systems/${id}.ts`
5521
- });
5522
- _storage.set(systems);
5523
- return id;
5541
+ async create(name) {
5542
+ const { actions, fs } = useProject();
5543
+ const system = await actions.package.createSystem({ systemName: name });
5544
+ this._add(systemTransformer(system));
5545
+ await (await fs.getDirectory()).readdir(true);
5546
+ }
5547
+ async import(names) {
5548
+ const { actions, ecs, fs } = useProject();
5549
+ await actions.package.addSystems({ systemNames: names });
5550
+ await this.sync();
5551
+ await ecs.components.sync();
5552
+ await (await fs.getDirectory()).readdir(true);
5553
+ }
5554
+ async sync() {
5555
+ const { actions } = useProject();
5556
+ const systems = await actions.package.getSystems();
5557
+ _storage.set(systemsTransformer(systems));
5524
5558
  }
5525
5559
  get(id) {
5526
5560
  const system = get$1$1(_storage).find((system) => system.id === id);
@@ -5529,9 +5563,13 @@ var SystemManager = class {
5529
5563
  this._subscribe(id, handle);
5530
5564
  return handle;
5531
5565
  }
5532
- delete(id) {
5566
+ async delete(id) {
5533
5567
  const systems = get$1$1(_storage);
5534
- _storage.set(systems.filter((system) => system.id !== id));
5568
+ const system = systems.find((s) => s.id === id);
5569
+ if (!system) throw new Error(`System not found: ${id}`);
5570
+ _storage.set(systems.filter((s) => s.id !== id));
5571
+ const { fs } = useProject();
5572
+ await (await fs.getFile(system.path)).delete();
5535
5573
  const subscriptions = get$1$1(_subscriptions);
5536
5574
  if (subscriptions[id]) {
5537
5575
  subscriptions[id]();
@@ -5539,6 +5577,11 @@ var SystemManager = class {
5539
5577
  _subscriptions.set(subscriptions);
5540
5578
  }
5541
5579
  }
5580
+ _add(system) {
5581
+ const systems = get$1$1(_storage);
5582
+ systems.push(system);
5583
+ _storage.set(systems);
5584
+ }
5542
5585
  _subscribe(id, handle) {
5543
5586
  setTimeout(() => {
5544
5587
  const subscriptions = get$1$1(_subscriptions);
@@ -6015,6 +6058,13 @@ var SfsFile = class {
6015
6058
  });
6016
6059
  if (!res.ok) throw new Error(`Failed to sync file: ${await res.text()}`);
6017
6060
  }
6061
+ async delete() {
6062
+ const res = await fetch(this._route, {
6063
+ method: "DELETE",
6064
+ headers: { [SESSION_PROJECT_HEADER]: this._handler.project.id }
6065
+ });
6066
+ if (!res.ok) throw new Error(`Failed to delete file: ${await res.text()}`);
6067
+ }
6018
6068
  async getFile() {
6019
6069
  await this._preRead();
6020
6070
  return this._cache;
@@ -6200,6 +6250,7 @@ var SyncFileSystem = class {
6200
6250
  }
6201
6251
  async init() {
6202
6252
  await this.treeCache?.init();
6253
+ await (await this.getDirectory()).readdir(true);
6203
6254
  }
6204
6255
  async getFile(path) {
6205
6256
  return new SfsFile(this, await this.cache.fileExist(path) ? await this.cache.getFile(path, false) : null, path);
@@ -14711,7 +14762,7 @@ function Select_content($$renderer, $$props) {
14711
14762
  if (Select_viewport) {
14712
14763
  $$renderer.push("<!--[-->");
14713
14764
  Select_viewport($$renderer, {
14714
- class: cn("h---bits-select-anchor-height w-full min-w---bits-select-anchor-width scroll-my-1"),
14765
+ class: cn("h-auto max-h-80 w-full min-w---bits-select-anchor-width"),
14715
14766
  children: ($$renderer) => {
14716
14767
  children?.($$renderer);
14717
14768
  $$renderer.push(`<!---->`);
@@ -14909,6 +14960,25 @@ function Select($$renderer, $$props) {
14909
14960
  });
14910
14961
  });
14911
14962
  }
14963
+ function Loading_button($$renderer, $$props) {
14964
+ let { loading = false, disabled, children, $$slots, $$events, ...restProps } = $$props;
14965
+ Button($$renderer, spread_props([
14966
+ { disabled: disabled || loading },
14967
+ restProps,
14968
+ {
14969
+ children: ($$renderer) => {
14970
+ if (loading) {
14971
+ $$renderer.push("<!--[0-->");
14972
+ Spinner($$renderer, {});
14973
+ } else $$renderer.push("<!--[-1-->");
14974
+ $$renderer.push(`<!--]--> `);
14975
+ children?.($$renderer);
14976
+ $$renderer.push(`<!---->`);
14977
+ },
14978
+ $$slots: { default: true }
14979
+ }
14980
+ ]));
14981
+ }
14912
14982
  var handleError = (error, context) => {
14913
14983
  const message = `Failed to ${context ?? "execute"}`;
14914
14984
  if (error instanceof Exception) {
@@ -14933,6 +15003,6 @@ var runSafe = async (context, cb, fallback) => {
14933
15003
  return null;
14934
15004
  };
14935
15005
  //#endregion
14936
- export { createId as $, PresenceManager as A, Spinner as B, MenuRootState as C, Popper_layer as D, PLException as E, Select as F, attachRef as G, Switch as H, Select_content as I, boolToTrueOrUndef as J, boolToEmptyStrOrUndef as K, Select_item as L, ProjectLoader as M, RovingFocusGroup as N, Popper_layer_force_mount as O, Scroll_lock as P, createBitsAttrs as Q, Select_trigger as R, MenuMenuState as S, PLErrors as T, Switch_thumb as U, StyleToObject as V, Text_selection_layer as W, capitalize as X, boxWith as Y, cn as Z, Floating_layer_anchor as _, useProject as _t, Card_content as a, getDataTransitionAttrs as at, MenuContentState as b, Card_title as c, isElement$1 as ct, DOMContext as d, noop as dt, createQuery as et, Dismissible_layer as f, runSafe as ft, Floating_layer as g, useId as gt, FloatingArrowState as h, useDebounce as ht, Card as i, getDataOpenClosed as it, ProjectCache as j, Portal as k, Context as l, isFocusVisible as lt, Escape_layer as m, toastError as mt, Button as n, enhance as nt, Card_description as o, getDocument as ot, DropdownMenuTriggerState as p, simpleBox as pt, boolToStr as q, CONTEXT_MENU_TRIGGER_ATTR as r, getConfig as rt, Card_header as s, getFloatingContentCSSVars as st, AnimationsComplete as t, deserialize as tt, ContextMenuTriggerState as u, mergeProps as ut, Focus_scope as v, watch as vt, MenuSeparatorState as w, MenuItemState as x, IsMounted as y, tv as yt, Separator as z };
15006
+ export { createBitsAttrs as $, Portal as A, Separator as B, MenuMenuState as C, PLException as D, PLErrors as E, Scroll_lock as F, Text_selection_layer as G, StyleToObject as H, Select as I, boolToStr as J, attachRef as K, Select_content as L, ProjectCache as M, ProjectLoader as N, Popper_layer as O, RovingFocusGroup as P, cn as Q, Select_item as R, MenuItemState as S, MenuSeparatorState as T, Switch as U, Spinner as V, Switch_thumb as W, boxWith as X, boolToTrueOrUndef as Y, capitalize as Z, Floating_layer_anchor as _, useId as _t, Card_content as a, getDataOpenClosed as at, Loading_button as b, tv as bt, Card_title as c, getFloatingContentCSSVars as ct, DOMContext as d, mergeProps as dt, createId as et, Dismissible_layer as f, noop as ft, Floating_layer as g, useDebounce as gt, FloatingArrowState as h, toastError as ht, Card as i, getConfig as it, PresenceManager as j, Popper_layer_force_mount as k, Context as l, isElement$1 as lt, Escape_layer as m, simpleBox as mt, Button as n, deserialize as nt, Card_description as o, getDataTransitionAttrs as ot, DropdownMenuTriggerState as p, runSafe as pt, boolToEmptyStrOrUndef as q, CONTEXT_MENU_TRIGGER_ATTR as r, enhance as rt, Card_header as s, getDocument as st, AnimationsComplete as t, createQuery as tt, ContextMenuTriggerState as u, isFocusVisible as ut, Focus_scope as v, useProject as vt, MenuRootState as w, MenuContentState as x, IsMounted as y, watch as yt, Select_trigger as z };
14937
15007
 
14938
- //# sourceMappingURL=error-Df0LgzGi.js.map
15008
+ //# sourceMappingURL=error-yRLerN6-.js.map