@pstdio/workbench 0.3.0 → 0.5.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/dist/{context-key-service-W4QEfVdN.js → context-key-service-B2K9LAec.js} +370 -367
- package/dist/context-key-service-B2K9LAec.js.map +1 -0
- package/dist/extensions.d.ts +30 -1
- package/dist/extensions.js +923 -837
- package/dist/extensions.js.map +1 -1
- package/dist/index.d.ts +29 -4
- package/dist/index.js +650 -590
- package/dist/index.js.map +1 -1
- package/dist/layout-types-DMoZz38-.js.map +1 -1
- package/dist/react.d.ts +26 -3
- package/dist/react.js +2592 -2605
- package/dist/react.js.map +1 -1
- package/dist/storage.d.ts +96 -2
- package/dist/storage.js +201 -120
- package/dist/storage.js.map +1 -1
- package/dist/testing.d.ts +15 -1
- package/package.json +3 -3
- package/dist/context-key-service-W4QEfVdN.js.map +0 -1
package/dist/storage.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
declare type ContributionSource = "module" | "extension";
|
|
2
2
|
|
|
3
|
+
declare type ContributionSource_2 = "module" | "extension";
|
|
4
|
+
|
|
3
5
|
export declare const createLocalStorageHistoryPersistence: (input: CreateWorkbenchStoragePersistenceInput) => WorkbenchHistoryPersistence;
|
|
4
6
|
|
|
5
7
|
export declare const createLocalStorageLastResourcePersistence: (input: CreateLocalStorageLastResourcePersistenceInput) => LastResourcePersistenceAdapter;
|
|
@@ -25,10 +27,11 @@ export declare interface CreateLocalStorageTreePersistenceInput extends CreateWo
|
|
|
25
27
|
export declare const createLocalStorageWorkbenchPersistence: (input: CreateLocalStorageWorkbenchPersistenceInput) => {
|
|
26
28
|
snapshotPersistence: WorkbenchPersistenceAdapter;
|
|
27
29
|
historyPersistence: WorkbenchHistoryPersistence;
|
|
28
|
-
layoutPersistence:
|
|
30
|
+
layoutPersistence: LayoutPersistenceAdapter_2;
|
|
29
31
|
panelsPersistence: WorkbenchPanelsPersistenceAdapter;
|
|
30
32
|
treePersistence: TreeRendererPersistenceAdapter;
|
|
31
33
|
lastResourcePersistence: LastResourcePersistenceAdapter;
|
|
34
|
+
sidePanelPersistence: WorkbenchSidePanelPersistenceAdapter;
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
export declare interface CreateLocalStorageWorkbenchPersistenceInput extends CreateWorkbenchStoragePersistenceInput {
|
|
@@ -60,12 +63,31 @@ declare interface LastResourcePersistenceAdapter {
|
|
|
60
63
|
declare interface LayoutPersistenceAdapter {
|
|
61
64
|
getLayout(scope?: LayoutScope): WorkbenchLayout | undefined;
|
|
62
65
|
setLayout(layout: WorkbenchLayout, scope?: LayoutScope): void;
|
|
66
|
+
listScopes?(projectId: string): LayoutScope[];
|
|
67
|
+
transformLayouts?(projectId: string, transform: (layout: WorkbenchLayout, scope: LayoutScope) => WorkbenchLayout | undefined): void;
|
|
68
|
+
getCompatibilityMarker?(key: string): string | undefined;
|
|
69
|
+
setCompatibilityMarker?(key: string, value: string): void;
|
|
70
|
+
advanceWriteGeneration?(): number;
|
|
71
|
+
flush?(): void;
|
|
72
|
+
dispose?(): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare interface LayoutPersistenceAdapter_2 {
|
|
76
|
+
getLayout(scope?: LayoutScope_2): WorkbenchLayout_2 | undefined;
|
|
77
|
+
setLayout(layout: WorkbenchLayout_2, scope?: LayoutScope_2): void;
|
|
78
|
+
listScopes?(projectId: string): LayoutScope_2[];
|
|
79
|
+
transformLayouts?(projectId: string, transform: (layout: WorkbenchLayout_2, scope: LayoutScope_2) => WorkbenchLayout_2 | undefined): void;
|
|
80
|
+
getCompatibilityMarker?(key: string): string | undefined;
|
|
81
|
+
setCompatibilityMarker?(key: string, value: string): void;
|
|
82
|
+
advanceWriteGeneration?(): number;
|
|
63
83
|
flush?(): void;
|
|
64
84
|
dispose?(): void;
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
declare type LayoutScope = string;
|
|
68
88
|
|
|
89
|
+
declare type LayoutScope_2 = string;
|
|
90
|
+
|
|
69
91
|
declare interface PersistedTreeRendererStates {
|
|
70
92
|
statesByTreeId: Record<string, TreeRendererState>;
|
|
71
93
|
}
|
|
@@ -87,6 +109,15 @@ declare interface ResourceRef {
|
|
|
87
109
|
metadata?: Record<string, unknown>;
|
|
88
110
|
}
|
|
89
111
|
|
|
112
|
+
declare interface ResourceRef_2 {
|
|
113
|
+
kind: string;
|
|
114
|
+
uri: string;
|
|
115
|
+
id?: string;
|
|
116
|
+
label?: string;
|
|
117
|
+
icon?: string;
|
|
118
|
+
metadata?: Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
|
|
90
121
|
declare interface TreeRendererPersistenceAdapter {
|
|
91
122
|
getTreeStates(): PersistedTreeRendererStates | undefined;
|
|
92
123
|
setTreeStates(states: PersistedTreeRendererStates): void;
|
|
@@ -101,6 +132,8 @@ declare interface TreeRendererState {
|
|
|
101
132
|
|
|
102
133
|
declare type WidgetMountStrategy = "active" | "keep-mounted";
|
|
103
134
|
|
|
135
|
+
declare type WidgetMountStrategy_2 = "active" | "keep-mounted";
|
|
136
|
+
|
|
104
137
|
declare interface WorkbenchClosedSubPanel {
|
|
105
138
|
region: WorkbenchPanelRegion;
|
|
106
139
|
reference: WorkbenchSubPanelRef;
|
|
@@ -121,6 +154,14 @@ declare interface WorkbenchLayout {
|
|
|
121
154
|
activeResourceUri?: string;
|
|
122
155
|
}
|
|
123
156
|
|
|
157
|
+
declare interface WorkbenchLayout_2 {
|
|
158
|
+
regions: Record<WorkbenchRegion_2, WorkbenchRegionState_2>;
|
|
159
|
+
locationSubPanelSelections?: Record<string, Partial<Record<WorkbenchPanelRegion_2, string>>>;
|
|
160
|
+
activeWidgetId?: string;
|
|
161
|
+
activeLocationWidgetId?: string;
|
|
162
|
+
activeResourceUri?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
124
165
|
declare interface WorkbenchLocationRef {
|
|
125
166
|
key: string;
|
|
126
167
|
modeId?: string;
|
|
@@ -146,8 +187,12 @@ declare interface WorkbenchNavigationEntry {
|
|
|
146
187
|
|
|
147
188
|
declare type WorkbenchPanelRegion = (typeof workbenchPanelRegions)[number];
|
|
148
189
|
|
|
190
|
+
declare type WorkbenchPanelRegion_2 = (typeof workbenchPanelRegions_2)[number];
|
|
191
|
+
|
|
149
192
|
declare const workbenchPanelRegions: readonly ["main", "secondary", "side"];
|
|
150
193
|
|
|
194
|
+
declare const workbenchPanelRegions_2: readonly ["main", "secondary", "side"];
|
|
195
|
+
|
|
151
196
|
declare interface WorkbenchPanelsPersistenceAdapter {
|
|
152
197
|
getPanelStates(scope?: string): PersistedWorkbenchPanels | undefined;
|
|
153
198
|
setPanelStates(state: PersistedWorkbenchPanels, scope?: string): void;
|
|
@@ -162,8 +207,12 @@ declare interface WorkbenchPersistenceAdapter {
|
|
|
162
207
|
|
|
163
208
|
declare type WorkbenchRegion = (typeof workbenchRegions)[number];
|
|
164
209
|
|
|
210
|
+
declare type WorkbenchRegion_2 = (typeof workbenchRegions_2)[number];
|
|
211
|
+
|
|
165
212
|
declare const workbenchRegions: readonly ["nav", "activity", "sidenav-header", "sidenav", "main-header", "main-left-menu", "main", "main-right-menu", "secondary-header", "secondary-left-menu", "secondary", "secondary-right-menu", "side-header", "side-left-menu", "side", "side-right-menu", "status", "overlay"];
|
|
166
213
|
|
|
214
|
+
declare const workbenchRegions_2: readonly ["nav", "activity", "sidenav-header", "sidenav", "main-header", "main-left-menu", "main", "main-right-menu", "secondary-header", "secondary-left-menu", "secondary", "secondary-right-menu", "side-header", "side-left-menu", "side", "side-right-menu", "status", "overlay"];
|
|
215
|
+
|
|
167
216
|
declare interface WorkbenchRegionState {
|
|
168
217
|
id: WorkbenchRegion;
|
|
169
218
|
visible: boolean;
|
|
@@ -172,19 +221,36 @@ declare interface WorkbenchRegionState {
|
|
|
172
221
|
activeWidgetId?: string;
|
|
173
222
|
}
|
|
174
223
|
|
|
224
|
+
declare interface WorkbenchRegionState_2 {
|
|
225
|
+
id: WorkbenchRegion_2;
|
|
226
|
+
visible: boolean;
|
|
227
|
+
size?: number;
|
|
228
|
+
widgets: WorkbenchWidgetPlacement_2[];
|
|
229
|
+
activeWidgetId?: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
declare type WorkbenchSidePanelMode = "floating" | "closed" | "attached";
|
|
233
|
+
|
|
234
|
+
declare interface WorkbenchSidePanelPersistenceAdapter {
|
|
235
|
+
getMode(): WorkbenchSidePanelMode | undefined;
|
|
236
|
+
setMode(mode: WorkbenchSidePanelMode): void;
|
|
237
|
+
}
|
|
238
|
+
|
|
175
239
|
declare interface WorkbenchSnapshot {
|
|
176
240
|
layout: WorkbenchLayout;
|
|
177
241
|
}
|
|
178
242
|
|
|
179
243
|
export declare interface WorkbenchStorageLike {
|
|
244
|
+
readonly length?: number;
|
|
180
245
|
getItem(key: string): string | null;
|
|
246
|
+
key?(index: number): string | null;
|
|
181
247
|
setItem(key: string, value: string): void;
|
|
182
248
|
removeItem?(key: string): void;
|
|
183
249
|
}
|
|
184
250
|
|
|
185
251
|
export declare const workbenchStoragePersistenceKey: (namespace: string, kind: WorkbenchStoragePersistenceKind, scope: string | undefined) => string;
|
|
186
252
|
|
|
187
|
-
export declare type WorkbenchStoragePersistenceKind = "history" | "layout" | "layout-resource-index" | "panels" | "tree" | "last-resource";
|
|
253
|
+
export declare type WorkbenchStoragePersistenceKind = "history" | "layout" | "layout-compatibility" | "layout-generation" | "layout-resource-index" | "layout-scope-index" | "panels" | "side-panel" | "tree" | "last-resource";
|
|
188
254
|
|
|
189
255
|
declare interface WorkbenchSubPanelRef {
|
|
190
256
|
contributionId: string;
|
|
@@ -194,6 +260,8 @@ declare interface WorkbenchSubPanelRef {
|
|
|
194
260
|
|
|
195
261
|
declare type WorkbenchTabRetention = "preview" | "persistent";
|
|
196
262
|
|
|
263
|
+
declare type WorkbenchTabRetention_2 = "preview" | "persistent";
|
|
264
|
+
|
|
197
265
|
declare interface WorkbenchWidgetPlacement {
|
|
198
266
|
widgetId: string;
|
|
199
267
|
contributionId: string;
|
|
@@ -212,12 +280,38 @@ declare interface WorkbenchWidgetPlacement {
|
|
|
212
280
|
role?: WorkbenchWidgetRole;
|
|
213
281
|
}
|
|
214
282
|
|
|
283
|
+
declare interface WorkbenchWidgetPlacement_2 {
|
|
284
|
+
widgetId: string;
|
|
285
|
+
contributionId: string;
|
|
286
|
+
ownerId?: string;
|
|
287
|
+
source?: ContributionSource_2;
|
|
288
|
+
resource?: ResourceRef_2;
|
|
289
|
+
resourceUri?: string;
|
|
290
|
+
ownerResourceUri?: string;
|
|
291
|
+
title?: string;
|
|
292
|
+
pinned?: boolean;
|
|
293
|
+
closable?: boolean;
|
|
294
|
+
mountStrategy?: WidgetMountStrategy_2;
|
|
295
|
+
hiddenByDefault?: boolean;
|
|
296
|
+
tabRetention?: WorkbenchTabRetention_2;
|
|
297
|
+
tab?: WorkbenchWidgetTab_2;
|
|
298
|
+
role?: WorkbenchWidgetRole_2;
|
|
299
|
+
}
|
|
300
|
+
|
|
215
301
|
declare type WorkbenchWidgetRole = "content" | "location" | "sub-panel" | "panel-menu";
|
|
216
302
|
|
|
303
|
+
declare type WorkbenchWidgetRole_2 = "content" | "location" | "sub-panel" | "panel-menu";
|
|
304
|
+
|
|
217
305
|
declare interface WorkbenchWidgetTab {
|
|
218
306
|
contentRendererId?: string;
|
|
219
307
|
/** Custom actions shown when the user activates an already-active tab. */
|
|
220
308
|
customMenuRendererId?: string;
|
|
221
309
|
}
|
|
222
310
|
|
|
311
|
+
declare interface WorkbenchWidgetTab_2 {
|
|
312
|
+
contentRendererId?: string;
|
|
313
|
+
/** Custom actions shown when the user activates an already-active tab. */
|
|
314
|
+
customMenuRendererId?: string;
|
|
315
|
+
}
|
|
316
|
+
|
|
223
317
|
export { }
|
package/dist/storage.js
CHANGED
|
@@ -1,182 +1,263 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
const
|
|
1
|
+
import { b as j } from "./layout-types-DMoZz38-.js";
|
|
2
|
+
const c = (e, t, o) => `${e}:${t}:${o ?? "global"}`, B = () => {
|
|
3
3
|
const e = /* @__PURE__ */ new Map();
|
|
4
4
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
e.set(s, t);
|
|
5
|
+
get length() {
|
|
6
|
+
return e.size;
|
|
8
7
|
},
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
getItem: (t) => e.get(t) ?? null,
|
|
9
|
+
key: (t) => [...e.keys()][t] ?? null,
|
|
10
|
+
setItem: (t, o) => {
|
|
11
|
+
e.set(t, o);
|
|
12
|
+
},
|
|
13
|
+
removeItem: (t) => {
|
|
14
|
+
e.delete(t);
|
|
11
15
|
}
|
|
12
16
|
};
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
17
|
+
}, p = (e) => e || (typeof localStorage < "u" ? localStorage : B()), m = (e, t) => {
|
|
18
|
+
const o = e.getItem(t);
|
|
19
|
+
if (o)
|
|
16
20
|
try {
|
|
17
|
-
return JSON.parse(
|
|
21
|
+
return JSON.parse(o);
|
|
18
22
|
} catch {
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
addEventListener: (
|
|
24
|
-
removeEventListener: (
|
|
25
|
+
}, v = 2, k = 1, W = 50, C = (e) => {
|
|
26
|
+
const t = p(e.storage), o = /* @__PURE__ */ new Map(), i = e.debounceMs ?? 250, d = e.eventTarget ?? (typeof window < "u" ? {
|
|
27
|
+
addEventListener: (s, r) => window.addEventListener(s, r),
|
|
28
|
+
removeEventListener: (s, r) => window.removeEventListener(s, r)
|
|
25
29
|
} : void 0);
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
let y;
|
|
31
|
+
const L = c(e.namespace, "layout-generation", void 0), f = () => {
|
|
32
|
+
const s = m(t, L);
|
|
33
|
+
return typeof s == "object" && s !== null && "version" in s && s.version === 1 && "generation" in s && typeof s.generation == "number" ? s.generation : 0;
|
|
34
|
+
}, P = () => {
|
|
35
|
+
const s = f() + 1, r = {
|
|
36
|
+
version: 1,
|
|
37
|
+
generation: s
|
|
38
|
+
};
|
|
39
|
+
return t.setItem(L, JSON.stringify(r)), s;
|
|
40
|
+
}, J = (s) => s?.match(/^project\/([^/]+)\/mode\/[^/]+\/resource\//)?.[1], O = (s) => s?.match(/^project\/([^/]+)/)?.[1], M = (s) => {
|
|
41
|
+
if (!t.key) return [];
|
|
42
|
+
const r = `${e.namespace}:layout:`, n = [];
|
|
43
|
+
for (let a = 0; a < (t.length ?? 0); a += 1) {
|
|
44
|
+
const l = t.key(a);
|
|
45
|
+
if (!l?.startsWith(r)) continue;
|
|
46
|
+
const g = l.slice(r.length);
|
|
47
|
+
O(g) === s && n.push(g);
|
|
48
|
+
}
|
|
49
|
+
return n;
|
|
50
|
+
}, S = (s, r) => {
|
|
51
|
+
const n = m(t, c(e.namespace, s, r));
|
|
52
|
+
return typeof n == "object" && n !== null && "version" in n && n.version === k && "scopes" in n && Array.isArray(n.scopes) ? n.scopes.filter((a) => typeof a == "string" && t.getItem(c(e.namespace, "layout", a)) !== null) : [];
|
|
53
|
+
}, N = (s, r, n) => {
|
|
54
|
+
const a = {
|
|
55
|
+
version: k,
|
|
56
|
+
scopes: n
|
|
37
57
|
};
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
t.setItem(c(e.namespace, s, r), JSON.stringify(a));
|
|
59
|
+
}, T = (s) => {
|
|
60
|
+
const r = O(s);
|
|
61
|
+
if (!r || !s) return;
|
|
62
|
+
const n = S("layout-scope-index", r).filter((a) => a !== s);
|
|
63
|
+
n.push(s), N("layout-scope-index", r, n);
|
|
64
|
+
}, K = (s) => {
|
|
65
|
+
const r = J(s);
|
|
66
|
+
if (!r || !s) return;
|
|
67
|
+
const n = S("layout-resource-index", r).filter((a) => a !== s);
|
|
68
|
+
n.push(s);
|
|
69
|
+
for (const a of n.splice(0, Math.max(0, n.length - W)))
|
|
70
|
+
t.removeItem?.(c(e.namespace, "layout", a)), t.removeItem?.(c(e.namespace, "panels", a));
|
|
71
|
+
N("layout-resource-index", r, n);
|
|
72
|
+
}, u = () => {
|
|
73
|
+
y && clearTimeout(y), y = void 0;
|
|
74
|
+
const s = [...o.values()];
|
|
75
|
+
o.clear();
|
|
76
|
+
const r = f();
|
|
77
|
+
for (const n of s)
|
|
78
|
+
n.generation === r && (t.setItem(c(e.namespace, "layout", n.scope), n.raw), T(n.scope), K(n.scope), n.legacyPanelsKey && t.removeItem?.(n.legacyPanelsKey));
|
|
79
|
+
}, R = () => {
|
|
80
|
+
y && clearTimeout(y), y = setTimeout(u, i);
|
|
47
81
|
};
|
|
48
|
-
return
|
|
49
|
-
getLayout: (
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
...
|
|
82
|
+
return d?.addEventListener("pagehide", u), {
|
|
83
|
+
getLayout: (s) => {
|
|
84
|
+
const r = c(e.namespace, "layout", s), n = o.get(r), a = n && n.generation === f() ? JSON.parse(n.raw) : m(t, r);
|
|
85
|
+
if (a?.version === v) return a.layout;
|
|
86
|
+
if (a?.version !== 1) return;
|
|
87
|
+
const l = c(e.namespace, "panels", s), g = m(t, l), x = typeof g == "object" && g !== null && "openByRegionId" in g && typeof g.openByRegionId == "object" && g.openByRegionId !== null ? g.openByRegionId : {}, I = {
|
|
88
|
+
...a.layout.regions
|
|
55
89
|
};
|
|
56
|
-
for (const
|
|
57
|
-
const
|
|
58
|
-
typeof
|
|
59
|
-
...
|
|
60
|
-
visible:
|
|
90
|
+
for (const h of j) {
|
|
91
|
+
const w = x[h];
|
|
92
|
+
typeof w == "boolean" && I[h] && (I[h] = {
|
|
93
|
+
...I[h],
|
|
94
|
+
visible: w
|
|
61
95
|
});
|
|
62
96
|
}
|
|
63
|
-
const
|
|
64
|
-
...
|
|
65
|
-
regions:
|
|
66
|
-
},
|
|
67
|
-
version:
|
|
68
|
-
layout:
|
|
97
|
+
const b = {
|
|
98
|
+
...a.layout,
|
|
99
|
+
regions: I
|
|
100
|
+
}, _ = {
|
|
101
|
+
version: v,
|
|
102
|
+
layout: b
|
|
69
103
|
};
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
104
|
+
return o.set(r, {
|
|
105
|
+
generation: f(),
|
|
106
|
+
legacyPanelsKey: t.getItem(l) === null ? void 0 : l,
|
|
107
|
+
raw: JSON.stringify(_),
|
|
108
|
+
scope: s
|
|
109
|
+
}), R(), b;
|
|
110
|
+
},
|
|
111
|
+
setLayout: (s, r) => {
|
|
112
|
+
const n = {
|
|
113
|
+
version: v,
|
|
114
|
+
layout: s
|
|
115
|
+
}, a = c(e.namespace, "layout", r), l = c(e.namespace, "panels", r);
|
|
116
|
+
o.delete(a), o.set(a, {
|
|
117
|
+
generation: f(),
|
|
118
|
+
legacyPanelsKey: t.getItem(l) === null ? void 0 : l,
|
|
119
|
+
raw: JSON.stringify(n),
|
|
120
|
+
scope: r
|
|
121
|
+
}), R();
|
|
75
122
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
layout: n
|
|
80
|
-
}, c = r(e.namespace, "layout", o), i = r(e.namespace, "panels", o);
|
|
81
|
-
t.delete(c), t.set(c, {
|
|
82
|
-
legacyPanelsKey: s.getItem(i) === null ? void 0 : i,
|
|
83
|
-
raw: JSON.stringify(y),
|
|
84
|
-
scope: o
|
|
85
|
-
}), I();
|
|
123
|
+
flush: u,
|
|
124
|
+
listScopes(s) {
|
|
125
|
+
return [.../* @__PURE__ */ new Set([...S("layout-scope-index", s), ...S("layout-resource-index", s), ...M(s)])];
|
|
86
126
|
},
|
|
87
|
-
|
|
127
|
+
transformLayouts(s, r) {
|
|
128
|
+
u(), P();
|
|
129
|
+
for (const n of this.listScopes?.(s) ?? []) {
|
|
130
|
+
const a = c(e.namespace, "layout", n), l = m(t, a);
|
|
131
|
+
if (l?.version !== v) continue;
|
|
132
|
+
const g = r(l.layout, n);
|
|
133
|
+
if (!g) {
|
|
134
|
+
t.removeItem?.(a);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
t.setItem(a, JSON.stringify({
|
|
138
|
+
version: v,
|
|
139
|
+
layout: g
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
getCompatibilityMarker: (s) => m(t, c(e.namespace, "layout-compatibility", s)),
|
|
144
|
+
setCompatibilityMarker: (s, r) => {
|
|
145
|
+
P(), t.setItem(c(e.namespace, "layout-compatibility", s), JSON.stringify(r));
|
|
146
|
+
},
|
|
147
|
+
advanceWriteGeneration: P,
|
|
88
148
|
dispose() {
|
|
89
|
-
|
|
149
|
+
u(), d?.removeEventListener("pagehide", u);
|
|
90
150
|
}
|
|
91
151
|
};
|
|
92
|
-
},
|
|
93
|
-
const
|
|
152
|
+
}, H = (e) => {
|
|
153
|
+
const t = p(e.storage);
|
|
94
154
|
return {
|
|
95
|
-
getHistory: (
|
|
96
|
-
setHistory: (
|
|
97
|
-
|
|
155
|
+
getHistory: (o) => m(t, c(e.namespace, "history", o)),
|
|
156
|
+
setHistory: (o, i) => {
|
|
157
|
+
t.setItem(c(e.namespace, "history", i), JSON.stringify(o));
|
|
98
158
|
}
|
|
99
159
|
};
|
|
100
|
-
},
|
|
101
|
-
const
|
|
160
|
+
}, A = (e) => {
|
|
161
|
+
const t = p(e.storage);
|
|
102
162
|
return {
|
|
103
|
-
getPanelStates: (
|
|
104
|
-
setPanelStates: (
|
|
105
|
-
const
|
|
106
|
-
|
|
163
|
+
getPanelStates: (o) => m(t, c(e.namespace, "panels", o ?? e.scope)),
|
|
164
|
+
setPanelStates: (o, i) => {
|
|
165
|
+
const d = c(e.namespace, "panels", i ?? e.scope);
|
|
166
|
+
t.setItem(d, JSON.stringify(o));
|
|
107
167
|
}
|
|
108
168
|
};
|
|
109
|
-
},
|
|
110
|
-
const
|
|
169
|
+
}, U = (e) => {
|
|
170
|
+
const t = p(e.storage), o = c(e.namespace, "tree", e.scope);
|
|
111
171
|
return {
|
|
112
|
-
getTreeStates: () =>
|
|
113
|
-
setTreeStates: (
|
|
114
|
-
|
|
172
|
+
getTreeStates: () => m(t, o),
|
|
173
|
+
setTreeStates: (i) => {
|
|
174
|
+
t.setItem(o, JSON.stringify(i));
|
|
115
175
|
}
|
|
116
176
|
};
|
|
117
|
-
},
|
|
118
|
-
const
|
|
177
|
+
}, $ = (e) => !!e && typeof e.kind == "string" && typeof e.uri == "string", G = (e) => {
|
|
178
|
+
const t = p(e.storage), o = c(e.namespace, "last-resource", e.scope);
|
|
119
179
|
return {
|
|
120
180
|
getLastResource: () => {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
181
|
+
const i = m(t, o);
|
|
182
|
+
return $(i) ? i : void 0;
|
|
123
183
|
},
|
|
124
|
-
setLastResource: (
|
|
125
|
-
if (!
|
|
126
|
-
|
|
184
|
+
setLastResource: (i) => {
|
|
185
|
+
if (!i) {
|
|
186
|
+
t.removeItem?.(o);
|
|
127
187
|
return;
|
|
128
188
|
}
|
|
129
|
-
|
|
189
|
+
t.setItem(o, JSON.stringify(i));
|
|
130
190
|
}
|
|
131
191
|
};
|
|
132
|
-
},
|
|
133
|
-
const
|
|
192
|
+
}, E = 1, V = ["attached", "closed", "floating"], Y = (e) => {
|
|
193
|
+
const t = p(e.storage), o = c(e.namespace, "side-panel", e.scope);
|
|
194
|
+
return {
|
|
195
|
+
getMode: () => {
|
|
196
|
+
const i = m(t, o);
|
|
197
|
+
if (i?.version === E)
|
|
198
|
+
return V.includes(i.mode) ? i.mode : void 0;
|
|
199
|
+
},
|
|
200
|
+
setMode: (i) => {
|
|
201
|
+
const d = {
|
|
202
|
+
version: E,
|
|
203
|
+
mode: i
|
|
204
|
+
};
|
|
205
|
+
t.setItem(o, JSON.stringify(d));
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}, z = (e) => {
|
|
209
|
+
const t = p(e.storage), o = C({
|
|
134
210
|
debounceMs: e.debounceMs,
|
|
135
211
|
eventTarget: e.eventTarget,
|
|
136
212
|
namespace: e.namespace,
|
|
137
|
-
storage:
|
|
213
|
+
storage: t
|
|
138
214
|
});
|
|
139
215
|
return {
|
|
140
216
|
snapshotPersistence: {
|
|
141
|
-
getSnapshot: (
|
|
142
|
-
const
|
|
143
|
-
return
|
|
144
|
-
layout:
|
|
217
|
+
getSnapshot: (d) => {
|
|
218
|
+
const y = o.getLayout(d);
|
|
219
|
+
return y ? {
|
|
220
|
+
layout: y
|
|
145
221
|
} : void 0;
|
|
146
222
|
},
|
|
147
|
-
setSnapshot: (
|
|
148
|
-
flush:
|
|
149
|
-
dispose:
|
|
223
|
+
setSnapshot: (d, y) => o.setLayout(d.layout, y),
|
|
224
|
+
flush: o.flush,
|
|
225
|
+
dispose: o.dispose
|
|
150
226
|
},
|
|
151
|
-
historyPersistence:
|
|
227
|
+
historyPersistence: H({
|
|
152
228
|
namespace: e.namespace,
|
|
153
|
-
storage:
|
|
229
|
+
storage: t
|
|
154
230
|
}),
|
|
155
|
-
layoutPersistence:
|
|
156
|
-
panelsPersistence:
|
|
231
|
+
layoutPersistence: o,
|
|
232
|
+
panelsPersistence: A({
|
|
157
233
|
namespace: e.namespace,
|
|
158
234
|
scope: e.scope ?? "global",
|
|
159
|
-
storage:
|
|
235
|
+
storage: t
|
|
236
|
+
}),
|
|
237
|
+
treePersistence: U({
|
|
238
|
+
namespace: e.namespace,
|
|
239
|
+
scope: e.scope,
|
|
240
|
+
storage: t
|
|
160
241
|
}),
|
|
161
|
-
|
|
242
|
+
lastResourcePersistence: G({
|
|
162
243
|
namespace: e.namespace,
|
|
163
244
|
scope: e.scope,
|
|
164
|
-
storage:
|
|
245
|
+
storage: t
|
|
165
246
|
}),
|
|
166
|
-
|
|
247
|
+
sidePanelPersistence: Y({
|
|
167
248
|
namespace: e.namespace,
|
|
168
249
|
scope: e.scope,
|
|
169
|
-
storage:
|
|
250
|
+
storage: t
|
|
170
251
|
})
|
|
171
252
|
};
|
|
172
253
|
};
|
|
173
254
|
export {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
255
|
+
H as createLocalStorageHistoryPersistence,
|
|
256
|
+
G as createLocalStorageLastResourcePersistence,
|
|
257
|
+
C as createLocalStorageLayoutPersistence,
|
|
258
|
+
A as createLocalStoragePanelsPersistence,
|
|
259
|
+
U as createLocalStorageTreePersistence,
|
|
260
|
+
z as createLocalStorageWorkbenchPersistence,
|
|
261
|
+
c as workbenchStoragePersistenceKey
|
|
181
262
|
};
|
|
182
263
|
//# sourceMappingURL=storage.js.map
|