From 1421e15c03c86906e1f160e59b1256ef5849de75 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 17:39:22 +0900 Subject: [PATCH 1/3] feat: add open code button --- .../content-browser/content-item.svelte | 18 ++------------- .../ecs-tree/packages/package-row.svelte | 12 +++++++++- .../ecs-tree/packages/package-tab.svelte | 13 +++++++++++ .../scenes/systems/scene-system-list.svelte | 23 +++++++++++++++---- src/lib/components/Widget/ecs-tree/types.ts | 2 +- .../components/Widget/ecs-tree/widget.svelte | 9 ++++++++ src/lib/utils/file.ts | 15 ++++++++++++ 7 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 src/lib/utils/file.ts diff --git a/src/lib/components/Widget/content-browser/content-item.svelte b/src/lib/components/Widget/content-browser/content-item.svelte index 56bb25c..eb82f1b 100644 --- a/src/lib/components/Widget/content-browser/content-item.svelte +++ b/src/lib/components/Widget/content-browser/content-item.svelte @@ -1,32 +1,18 @@ { + const [type] = FILE_TYPES.find(([, exts]) => exts.includes(name.split('.').pop()!)) ?? [ + 'unknown', + ]; + return type; +}; From 395bd418250a7fc31fe6a47bd3b3bdcf9c987432 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 18:32:24 +0900 Subject: [PATCH 2/3] fix: add full path id for subscriptions to avoid duplicate params names --- .../entity/component/component-manager.ts | 18 ++++++++++------- .../component/component-param-manager.ts | 20 +++++++++++-------- .../client/ecs/scene/entity/entity-manager.ts | 12 ++++++----- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/lib/client/ecs/scene/entity/component/component-manager.ts b/src/lib/client/ecs/scene/entity/component/component-manager.ts index f40514b..35ebf91 100644 --- a/src/lib/client/ecs/scene/entity/component/component-manager.ts +++ b/src/lib/client/ecs/scene/entity/component/component-manager.ts @@ -15,6 +15,8 @@ export class EntityComponentManager { public readonly entity: SceneEntityHandle; private readonly _store: Writable>>; + private readonly _storageResolvable: string; + static reset() { _storage.set({}); resetSubscriptions(_subscriptions); @@ -24,9 +26,9 @@ export class EntityComponentManager { constructor(entity: SceneEntityHandle, components: Record>) { this.entity = entity; - const storageResolvable = `${this.entity.manager.scene.id}/${this.entity.id}`; + this._storageResolvable = `${this.entity.manager.scene.id}/${this.entity.id}`; - this._store = resolveStore(_storage, storageResolvable, components); + this._store = resolveStore(_storage, this._storageResolvable, components); this._listen(); } @@ -70,10 +72,11 @@ export class EntityComponentManager { }); this._store.set(newComponents); + const fullId = `${this._storageResolvable}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) { - subscriptions[id](); - subscriptions[id] = null; + if (subscriptions[fullId]) { + subscriptions[fullId](); + subscriptions[fullId] = null; _subscriptions.set(subscriptions); } } @@ -93,9 +96,10 @@ export class EntityComponentManager { private _subscribe(id: string, handle: EntityComponentHandle) { setTimeout(() => { + const fullId = `${this._storageResolvable}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) return; - subscriptions[id] = handle.params.values.subscribe((params) => this._update(id, params)); + if (subscriptions[fullId]) return; + subscriptions[fullId] = handle.params.values.subscribe((params) => this._update(id, params)); _subscriptions.set(subscriptions); }, 0); } diff --git a/src/lib/client/ecs/scene/entity/component/component-param-manager.ts b/src/lib/client/ecs/scene/entity/component/component-param-manager.ts index 47b8adc..89e9fc8 100644 --- a/src/lib/client/ecs/scene/entity/component/component-param-manager.ts +++ b/src/lib/client/ecs/scene/entity/component/component-param-manager.ts @@ -18,6 +18,8 @@ export class ComponentParamManager { private readonly _store: Writable; private readonly _valuesStore: Writable>; + private readonly _storageResolvable: string; + static reset() { _storage.set({}); _valueStorage.set({}); @@ -28,10 +30,10 @@ export class ComponentParamManager { constructor(component: EntityComponentHandle, params: Record) { this.component = component; - const storageResolvable = `${this.component.manager.entity.manager.scene.id}/${this.component.manager.entity.id}/${this.component.id}`; + this._storageResolvable = `${this.component.manager.entity.manager.scene.id}/${this.component.manager.entity.id}/${this.component.id}`; - this._store = resolveStore(_storage, storageResolvable, get(component.store).params); - this._valuesStore = resolveStore(_valueStorage, storageResolvable, params); + this._store = resolveStore(_storage, this._storageResolvable, get(component.store).params); + this._valuesStore = resolveStore(_valueStorage, this._storageResolvable, params); this._listen(); } @@ -62,10 +64,11 @@ export class ComponentParamManager { params.map((param) => (param.name === id ? { ...param, value: undefined } : param)), ); + const fullId = `${this._storageResolvable}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) { - subscriptions[id](); - subscriptions[id] = null; + if (subscriptions[fullId]) { + subscriptions[fullId](); + subscriptions[fullId] = null; _subscriptions.set(subscriptions); } } @@ -80,9 +83,10 @@ export class ComponentParamManager { private _subscribe(id: string, handle: ComponentParamHandle) { setTimeout(() => { + const fullId = `${this._storageResolvable}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) return; - subscriptions[id] = handle.value.subscribe((param) => this._update(id, param)); + if (subscriptions[fullId]) return; + subscriptions[fullId] = handle.value.subscribe((param) => this._update(id, param)); _subscriptions.set(subscriptions); }, 0); } diff --git a/src/lib/client/ecs/scene/entity/entity-manager.ts b/src/lib/client/ecs/scene/entity/entity-manager.ts index 7c2238d..527f046 100644 --- a/src/lib/client/ecs/scene/entity/entity-manager.ts +++ b/src/lib/client/ecs/scene/entity/entity-manager.ts @@ -69,10 +69,11 @@ export class SceneEntityManager { const entities = get(this._store); this._store.set(entities.filter((entity) => entity.id !== id)); + const fullId = `${this.scene.id}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) { - subscriptions[id](); - subscriptions[id] = null; + if (subscriptions[fullId]) { + subscriptions[fullId](); + subscriptions[fullId] = null; _subscriptions.set(subscriptions); } @@ -83,9 +84,10 @@ export class SceneEntityManager { private _subscribe(id: string, handle: SceneEntityHandle) { setTimeout(() => { + const fullId = `${this.scene.id}/${id}`; const subscriptions = get(_subscriptions); - if (subscriptions[id]) return; - subscriptions[id] = handle.store.subscribe((entity) => this._update(id, entity)); + if (subscriptions[fullId]) return; + subscriptions[fullId] = handle.store.subscribe((entity) => this._update(id, entity)); _subscriptions.set(subscriptions); }, 0); } From 01d3853218bbad143c8465f30ffbe7fef5ba0593 Mon Sep 17 00:00:00 2001 From: Exelo Date: Tue, 9 Jun 2026 17:27:11 +0900 Subject: [PATCH 3/3] fix: tab name takes last element of path --- src/lib/components/Widget/ecs-tree/packages/package-row.svelte | 2 +- .../Widget/ecs-tree/scenes/systems/scene-system-list.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Widget/ecs-tree/packages/package-row.svelte b/src/lib/components/Widget/ecs-tree/packages/package-row.svelte index 0a921b7..40d9f90 100644 --- a/src/lib/components/Widget/ecs-tree/packages/package-row.svelte +++ b/src/lib/components/Widget/ecs-tree/packages/package-row.svelte @@ -86,7 +86,7 @@ if (type === 'library' || !item.path) return; tabsStore.openTab({ type: getType(item.path), - title: item.name, + title: item.path.split('/').at(-1) ?? item.name, metadata: { path: item.path, }, diff --git a/src/lib/components/Widget/ecs-tree/scenes/systems/scene-system-list.svelte b/src/lib/components/Widget/ecs-tree/scenes/systems/scene-system-list.svelte index 62cdbdf..1ebaa35 100644 --- a/src/lib/components/Widget/ecs-tree/scenes/systems/scene-system-list.svelte +++ b/src/lib/components/Widget/ecs-tree/scenes/systems/scene-system-list.svelte @@ -69,7 +69,7 @@ tabsStore.openTab({ type: getType(item.path), - title: item.name, + title: item.path.split('/').at(-1) ?? item.name, metadata: { path: item.path, },