@decido/shell 4.0.2 → 4.0.3

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 (37) hide show
  1. package/dist/CenterComposite-RPEGBKQU.mjs +1697 -0
  2. package/dist/DebugPanel-KEKDMHDN.mjs +14 -0
  3. package/dist/MorphShell-FKDBB7E5.mjs +14 -0
  4. package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +9 -0
  5. package/dist/PlaygroundChat-MI2KXMK6.mjs +15 -0
  6. package/dist/PlaygroundTerminal-5AV4BJAI.mjs +7 -0
  7. package/dist/PluginSandbox-WMNAUQOJ.mjs +188 -0
  8. package/dist/ReactFlowEditor-RTF2652X.mjs +3574 -0
  9. package/dist/ReactFlowEditor-ZW5MCN5Y.css +561 -0
  10. package/dist/TimelineEditor-N4HRMHTB.mjs +226 -0
  11. package/dist/WidgetSlotPanel-KJI4CHHD.mjs +11 -0
  12. package/dist/chunk-2YMI4N5I.mjs +2004 -0
  13. package/dist/chunk-3BZX7LF2.mjs +139 -0
  14. package/dist/chunk-3P4P3M54.mjs +136 -0
  15. package/dist/chunk-F3OTFHNO.mjs +40 -0
  16. package/dist/chunk-IMHORBTL.mjs +48 -0
  17. package/dist/chunk-JF5QSJYT.mjs +295 -0
  18. package/dist/chunk-LWMMFTJC.mjs +382 -0
  19. package/dist/chunk-MSVEFEXE.mjs +179 -0
  20. package/dist/chunk-OCHGY2MN.mjs +1662 -0
  21. package/dist/chunk-PMYAM764.mjs +813 -0
  22. package/dist/chunk-Q64KZXPK.mjs +43 -0
  23. package/dist/chunk-QHQW2HMU.mjs +155 -0
  24. package/dist/chunk-RWZ4BOIN.mjs +385 -0
  25. package/dist/chunk-UHT6FIYF.mjs +195 -0
  26. package/dist/chunk-UJCSKKID.mjs +30 -0
  27. package/dist/chunk-V3CYNPGL.mjs +8758 -0
  28. package/dist/chunk-VBPGEFNM.mjs +2381 -0
  29. package/dist/chunk-XMSU6UWD.mjs +158 -0
  30. package/dist/chunk-ZCCCBHE6.mjs +55 -0
  31. package/dist/index.css +561 -0
  32. package/dist/index.js +65130 -0
  33. package/dist/index.mjs +40248 -0
  34. package/dist/useIntentLens-LEQCAXCK.mjs +13 -0
  35. package/dist/useSuggestionsStore-4L2AIZ2D.mjs +7 -0
  36. package/dist/wasm-QFXGEYGP.mjs +81 -0
  37. package/package.json +17 -18
@@ -0,0 +1,195 @@
1
+ import {
2
+ dlog
3
+ } from "./chunk-3P4P3M54.mjs";
4
+
5
+ // src/store/useMorphInstanceStore.ts
6
+ import { create } from "zustand";
7
+ import { persist } from "zustand/middleware";
8
+ var useMorphInstanceStore = create()(
9
+ persist(
10
+ (set, get) => ({
11
+ instances: /* @__PURE__ */ new Map(),
12
+ activeInstanceId: null,
13
+ historyByInstance: /* @__PURE__ */ new Map(),
14
+ upsertInstance: (partial) => {
15
+ dlog.store(`upsertInstance: ${partial.id} (${partial.shellType})`, { id: partial.id, shellType: partial.shellType, label: partial.label });
16
+ set((state) => {
17
+ const instances = new Map(state.instances);
18
+ const existing = instances.get(partial.id);
19
+ const historyByInstance = new Map(state.historyByInstance);
20
+ if (existing?.data) {
21
+ const hist = historyByInstance.get(partial.id) || { stack: [], index: -1 };
22
+ const trimmed = hist.stack.slice(0, hist.index + 1);
23
+ trimmed.push({ ...existing.data });
24
+ if (trimmed.length > 20) trimmed.shift();
25
+ historyByInstance.set(partial.id, { stack: trimmed, index: trimmed.length - 1 });
26
+ }
27
+ instances.set(partial.id, {
28
+ artifacts: [],
29
+ activeArtifactIndex: 0,
30
+ createdAt: Date.now(),
31
+ ...existing,
32
+ ...partial
33
+ });
34
+ return { instances, activeInstanceId: partial.id, historyByInstance };
35
+ });
36
+ },
37
+ removeInstance: (id) => {
38
+ set((state) => {
39
+ const instances = new Map(state.instances);
40
+ instances.delete(id);
41
+ const activeInstanceId = state.activeInstanceId === id ? instances.size > 0 ? instances.keys().next().value ?? null : null : state.activeInstanceId;
42
+ return { instances, activeInstanceId };
43
+ });
44
+ },
45
+ setActiveInstance: (id) => set({ activeInstanceId: id }),
46
+ pushArtifact: (instanceId, artifact) => {
47
+ set((state) => {
48
+ const instances = new Map(state.instances);
49
+ const instance = instances.get(instanceId);
50
+ if (!instance) return state;
51
+ const newArtifact = { ...artifact, updatedAt: Date.now() };
52
+ const artifacts = [...instance.artifacts, newArtifact];
53
+ instances.set(instanceId, {
54
+ ...instance,
55
+ artifacts,
56
+ activeArtifactIndex: artifacts.length - 1
57
+ });
58
+ return { instances };
59
+ });
60
+ },
61
+ updateArtifact: (instanceId, artifactId, data) => {
62
+ set((state) => {
63
+ const instances = new Map(state.instances);
64
+ const instance = instances.get(instanceId);
65
+ if (!instance) return state;
66
+ const artifacts = instance.artifacts.map(
67
+ (a) => a.id === artifactId ? { ...a, data: { ...a.data, ...data }, updatedAt: Date.now() } : a
68
+ );
69
+ instances.set(instanceId, { ...instance, artifacts });
70
+ return { instances };
71
+ });
72
+ },
73
+ setActiveArtifact: (instanceId, index) => {
74
+ set((state) => {
75
+ const instances = new Map(state.instances);
76
+ const instance = instances.get(instanceId);
77
+ if (!instance) return state;
78
+ instances.set(instanceId, {
79
+ ...instance,
80
+ activeArtifactIndex: Math.max(0, Math.min(index, instance.artifacts.length - 1))
81
+ });
82
+ return { instances };
83
+ });
84
+ },
85
+ removeArtifact: (instanceId, artifactId) => {
86
+ set((state) => {
87
+ const instances = new Map(state.instances);
88
+ const instance = instances.get(instanceId);
89
+ if (!instance) return state;
90
+ const artifacts = instance.artifacts.filter((a) => a.id !== artifactId);
91
+ instances.set(instanceId, {
92
+ ...instance,
93
+ artifacts,
94
+ activeArtifactIndex: Math.min(instance.activeArtifactIndex, Math.max(0, artifacts.length - 1))
95
+ });
96
+ return { instances };
97
+ });
98
+ },
99
+ getInstance: (id) => get().instances.get(id),
100
+ getInstances: () => Array.from(get().instances.values()),
101
+ getActiveInstance: () => {
102
+ const { instances, activeInstanceId } = get();
103
+ return activeInstanceId ? instances.get(activeInstanceId) : void 0;
104
+ },
105
+ // Sprint AL: Undo/Redo
106
+ undo: (instanceId) => {
107
+ const id = instanceId || get().activeInstanceId;
108
+ if (!id) return;
109
+ set((state) => {
110
+ const hist = state.historyByInstance.get(id);
111
+ if (!hist || hist.index < 0) return state;
112
+ const instances = new Map(state.instances);
113
+ const inst = instances.get(id);
114
+ if (!inst) return state;
115
+ const historyByInstance = new Map(state.historyByInstance);
116
+ const restoredData = hist.stack[hist.index];
117
+ dlog.store(`undo: ${id} \u2192 version ${hist.index}/${hist.stack.length}`, { instanceId: id });
118
+ instances.set(id, { ...inst, data: { ...restoredData } });
119
+ historyByInstance.set(id, { ...hist, index: hist.index - 1 });
120
+ return { instances, historyByInstance };
121
+ });
122
+ },
123
+ redo: (instanceId) => {
124
+ const id = instanceId || get().activeInstanceId;
125
+ if (!id) return;
126
+ set((state) => {
127
+ const hist = state.historyByInstance.get(id);
128
+ if (!hist || hist.index >= hist.stack.length - 1) return state;
129
+ const instances = new Map(state.instances);
130
+ const inst = instances.get(id);
131
+ if (!inst) return state;
132
+ const historyByInstance = new Map(state.historyByInstance);
133
+ const nextIndex = hist.index + 1;
134
+ const restoredData = hist.stack[nextIndex];
135
+ dlog.store(`redo: ${id} \u2192 version ${nextIndex + 1}/${hist.stack.length}`, { instanceId: id });
136
+ instances.set(id, { ...inst, data: { ...restoredData } });
137
+ historyByInstance.set(id, { ...hist, index: nextIndex });
138
+ return { instances, historyByInstance };
139
+ });
140
+ },
141
+ canUndo: (instanceId) => {
142
+ const id = instanceId || get().activeInstanceId;
143
+ if (!id) return false;
144
+ const hist = get().historyByInstance.get(id);
145
+ return !!hist && hist.index >= 0;
146
+ },
147
+ canRedo: (instanceId) => {
148
+ const id = instanceId || get().activeInstanceId;
149
+ if (!id) return false;
150
+ const hist = get().historyByInstance.get(id);
151
+ return !!hist && hist.index < hist.stack.length - 1;
152
+ },
153
+ getHistoryInfo: (instanceId) => {
154
+ const id = instanceId || get().activeInstanceId;
155
+ if (!id) return { current: 0, total: 0 };
156
+ const hist = get().historyByInstance.get(id);
157
+ if (!hist) return { current: 0, total: 0 };
158
+ return { current: hist.index + 2, total: hist.stack.length + 1 };
159
+ }
160
+ }),
161
+ {
162
+ name: "decido-morph-instances",
163
+ storage: {
164
+ getItem: (name) => {
165
+ const raw = localStorage.getItem(name);
166
+ if (!raw) return null;
167
+ const parsed = JSON.parse(raw);
168
+ if (parsed.state?.instances) {
169
+ parsed.state.instances = new Map(parsed.state.instances);
170
+ }
171
+ return parsed;
172
+ },
173
+ setItem: (name, value) => {
174
+ const toStore = {
175
+ ...value,
176
+ state: {
177
+ ...value.state,
178
+ instances: Array.from(value.state.instances.entries())
179
+ }
180
+ };
181
+ localStorage.setItem(name, JSON.stringify(toStore));
182
+ },
183
+ removeItem: (name) => localStorage.removeItem(name)
184
+ },
185
+ partialize: (state) => ({
186
+ instances: state.instances,
187
+ activeInstanceId: state.activeInstanceId
188
+ })
189
+ }
190
+ )
191
+ );
192
+
193
+ export {
194
+ useMorphInstanceStore
195
+ };
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };