@interopio/workspaces-api 4.3.0 → 4.4.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/changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  4.2.1
2
2
 
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3ba192c: feat: implemented the saveWindowContexts flag for workspace layouts
8
+
9
+ ### Patch Changes
10
+
11
+ - 3a52c8d: feature: Added support for the TabReordered event for Workspace and WorkspaceWindow tabs
12
+
3
13
  ## 4.3.0
4
14
 
5
15
  ### Minor Changes
@@ -1143,7 +1143,7 @@ const streamRequestArgumentsDecoder = object({
1143
1143
  type: eventTypeDecoder,
1144
1144
  branch: nonEmptyStringDecoder
1145
1145
  });
1146
- const workspaceEventActionDecoder = oneOf(constant("opened"), constant("closing"), constant("closed"), constant("focus"), constant("added"), constant("loaded"), constant("removed"), constant("childrenUpdate"), constant("containerChange"), constant("maximized"), constant("restored"), constant("minimized"), constant("normal"), constant("selected"), constant("lock-configuration-changed"), constant("hibernated"), constant("resumed"));
1146
+ const workspaceEventActionDecoder = oneOf(constant("opened"), constant("closing"), constant("closed"), constant("focus"), constant("added"), constant("loaded"), constant("removed"), constant("childrenUpdate"), constant("containerChange"), constant("maximized"), constant("restored"), constant("minimized"), constant("normal"), constant("selected"), constant("lock-configuration-changed"), constant("hibernated"), constant("resumed"), constant("tab-reordered"));
1147
1147
  const workspaceConfigResultDecoder = object({
1148
1148
  frameId: nonEmptyStringDecoder,
1149
1149
  title: nonEmptyStringDecoder,
@@ -1439,7 +1439,14 @@ const workspaceLayoutSaveConfigDecoder = object({
1439
1439
  workspaceId: nonEmptyStringDecoder,
1440
1440
  saveContext: optional(boolean()),
1441
1441
  allowMultiple: optional(boolean()),
1442
- metadata: optional(object())
1442
+ metadata: optional(object()),
1443
+ saveWindowContexts: optional(boolean())
1444
+ });
1445
+ const saveLayoutConfigDecoder = object({
1446
+ saveContext: optional(boolean()),
1447
+ allowMultiple: optional(boolean()),
1448
+ metadata: optional(object()),
1449
+ saveWindowContexts: optional(boolean())
1443
1450
  });
1444
1451
  const workspaceLockConfigDecoder = object({
1445
1452
  allowDrop: optional(boolean()),
@@ -2860,7 +2867,10 @@ class Workspace {
2860
2867
  }
2861
2868
  async saveLayout(name, config) {
2862
2869
  nonEmptyStringDecoder.runWithException(name);
2863
- await getData$3(this).controller.saveLayout({ name, workspaceId: this.id, saveContext: config?.saveContext, metadata: config?.metadata, allowMultiple: config?.allowMultiple });
2870
+ if (config) {
2871
+ saveLayoutConfigDecoder.runWithException(config);
2872
+ }
2873
+ await getData$3(this).controller.saveLayout({ name, workspaceId: this.id, saveContext: config?.saveContext, metadata: config?.metadata, allowMultiple: config?.allowMultiple, saveWindowContexts: config?.saveWindowContexts });
2864
2874
  }
2865
2875
  async setTitle(title) {
2866
2876
  nonEmptyStringDecoder.runWithException(title);
@@ -3123,6 +3133,57 @@ class Workspace {
3123
3133
  const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3124
3134
  return unsubscribe;
3125
3135
  }
3136
+ async onLockConfigurationChanged(callback) {
3137
+ checkThrowCallback(callback);
3138
+ const id = getData$3(this).id;
3139
+ const wrappedCallback = async () => {
3140
+ await this.refreshReference();
3141
+ callback({
3142
+ allowDrop: this.allowDrop,
3143
+ allowDropLeft: this.allowDropLeft,
3144
+ allowDropTop: this.allowDropTop,
3145
+ allowDropRight: this.allowDropRight,
3146
+ allowDropBottom: this.allowDropBottom,
3147
+ allowSystemHibernation: this.allowSystemHibernation,
3148
+ allowExtract: this.allowExtract,
3149
+ allowSplitters: this.allowSplitters,
3150
+ allowWindowReorder: this.allowWindowReorder,
3151
+ allowWorkspaceTabExtract: this.allowWorkspaceTabExtract,
3152
+ allowWorkspaceTabReorder: this.allowWorkspaceTabReorder,
3153
+ showAddWindowButtons: this.showAddWindowButtons,
3154
+ showCloseButton: this.showCloseButton,
3155
+ showEjectButtons: this.showEjectButtons,
3156
+ showSaveButton: this.showSaveButton,
3157
+ showWindowCloseButtons: this.showWindowCloseButtons
3158
+ });
3159
+ };
3160
+ const config = {
3161
+ action: "lock-configuration-changed",
3162
+ eventType: "workspace",
3163
+ scope: "workspace",
3164
+ scopeId: id,
3165
+ callback: wrappedCallback
3166
+ };
3167
+ const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3168
+ return unsubscribe;
3169
+ }
3170
+ async onTabReordered(callback) {
3171
+ checkThrowCallback(callback);
3172
+ const id = getData$3(this).id;
3173
+ const wrappedCallback = async () => {
3174
+ await this.refreshReference();
3175
+ callback();
3176
+ };
3177
+ const config = {
3178
+ action: "tab-reordered",
3179
+ eventType: "workspace",
3180
+ scope: "workspace",
3181
+ scopeId: id,
3182
+ callback: wrappedCallback
3183
+ };
3184
+ const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3185
+ return unsubscribe;
3186
+ }
3126
3187
  async onWindowAdded(callback) {
3127
3188
  checkThrowCallback(callback);
3128
3189
  const id = getData$3(this).id;
@@ -3245,33 +3306,20 @@ class Workspace {
3245
3306
  const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3246
3307
  return unsubscribe;
3247
3308
  }
3248
- async onLockConfigurationChanged(callback) {
3309
+ async onWindowTabReordered(callback) {
3249
3310
  checkThrowCallback(callback);
3250
3311
  const id = getData$3(this).id;
3251
- const wrappedCallback = async () => {
3312
+ const wrappedCallback = async (payload) => {
3252
3313
  await this.refreshReference();
3253
- callback({
3254
- allowDrop: this.allowDrop,
3255
- allowDropLeft: this.allowDropLeft,
3256
- allowDropTop: this.allowDropTop,
3257
- allowDropRight: this.allowDropRight,
3258
- allowDropBottom: this.allowDropBottom,
3259
- allowSystemHibernation: this.allowSystemHibernation,
3260
- allowExtract: this.allowExtract,
3261
- allowSplitters: this.allowSplitters,
3262
- allowWindowReorder: this.allowWindowReorder,
3263
- allowWorkspaceTabExtract: this.allowWorkspaceTabExtract,
3264
- allowWorkspaceTabReorder: this.allowWorkspaceTabReorder,
3265
- showAddWindowButtons: this.showAddWindowButtons,
3266
- showCloseButton: this.showCloseButton,
3267
- showEjectButtons: this.showEjectButtons,
3268
- showSaveButton: this.showSaveButton,
3269
- showWindowCloseButtons: this.showWindowCloseButtons
3314
+ const windowParent = this.getBox((parent) => parent.id === payload.windowSummary.parentId);
3315
+ const foundWindow = windowParent.children.find((child) => {
3316
+ return child.type === "window" && child.elementId === payload.windowSummary.itemId;
3270
3317
  });
3318
+ callback(foundWindow);
3271
3319
  };
3272
3320
  const config = {
3273
- action: "lock-configuration-changed",
3274
- eventType: "workspace",
3321
+ action: "tab-reordered",
3322
+ eventType: "window",
3275
3323
  scope: "workspace",
3276
3324
  scopeId: id,
3277
3325
  callback: wrappedCallback
@@ -3505,6 +3553,22 @@ class Window {
3505
3553
  const unsubscribe = await getData$2(this).controller.processLocalSubscription(config, id);
3506
3554
  return unsubscribe;
3507
3555
  }
3556
+ async onTabReordered(callback) {
3557
+ checkThrowCallback(callback);
3558
+ const id = getData$2(this).id;
3559
+ const wrappedCallback = async () => {
3560
+ await this.workspace.refreshReference();
3561
+ callback();
3562
+ };
3563
+ const config = {
3564
+ callback: wrappedCallback,
3565
+ action: "tab-reordered",
3566
+ eventType: "window",
3567
+ scope: "window"
3568
+ };
3569
+ const unsubscribe = await getData$2(this).controller.processLocalSubscription(config, id);
3570
+ return unsubscribe;
3571
+ }
3508
3572
  }
3509
3573
 
3510
3574
  const data$1 = new WeakMap();
@@ -5279,7 +5343,7 @@ class IoC {
5279
5343
  }
5280
5344
  }
5281
5345
 
5282
- var version = "4.3.0";
5346
+ var version = "4.4.0";
5283
5347
 
5284
5348
  const composeAPI = (glue, ioc) => {
5285
5349
  const controller = ioc.controller;
@@ -5448,6 +5512,15 @@ const composeAPI = (glue, ioc) => {
5448
5512
  const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "workspace", "resumed");
5449
5513
  return unsubscribe;
5450
5514
  };
5515
+ const onWorkspaceTabReordered = async (callback) => {
5516
+ checkThrowCallback(callback);
5517
+ const wrappedCallback = async (payload) => {
5518
+ const workspace = await controller.transformStreamPayloadToWorkspace(payload);
5519
+ callback(workspace);
5520
+ };
5521
+ const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "workspace", "tab-reordered");
5522
+ return unsubscribe;
5523
+ };
5451
5524
  const onWindowAdded = async (callback) => {
5452
5525
  checkThrowCallback(callback);
5453
5526
  const wrappedCallback = async (payload) => {
@@ -5541,6 +5614,23 @@ const composeAPI = (glue, ioc) => {
5541
5614
  const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "window", "selected");
5542
5615
  return unsubscribe;
5543
5616
  };
5617
+ const onWindowTabReordered = async (callback) => {
5618
+ checkThrowCallback(callback);
5619
+ const wrappedCallback = async (payload) => {
5620
+ const snapshot = (await controller.getSnapshot(payload.windowSummary.config.workspaceId, "workspace"));
5621
+ const frameConfig = {
5622
+ summary: snapshot.frameSummary
5623
+ };
5624
+ const frame = ioc.getModel("frame", frameConfig);
5625
+ const workspaceConfig = { frame, snapshot };
5626
+ const workspace = ioc.getModel("workspace", workspaceConfig);
5627
+ const windowParent = workspace.getBox((parent) => parent.id === payload.windowSummary.parentId);
5628
+ const foundWindow = windowParent.children.find((child) => child.type === "window" && child.elementId === payload.windowSummary.itemId);
5629
+ callback(foundWindow);
5630
+ };
5631
+ const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "window", "tab-reordered");
5632
+ return unsubscribe;
5633
+ };
5544
5634
  const waitForFrame = async (id) => {
5545
5635
  nonEmptyStringDecoder.runWithException(id);
5546
5636
  return new Promise((res, rej) => {
@@ -5587,6 +5677,8 @@ const composeAPI = (glue, ioc) => {
5587
5677
  onWorkspaceClosed,
5588
5678
  onWorkspaceHibernated,
5589
5679
  onWorkspaceResumed,
5680
+ onWorkspaceTabReordered,
5681
+ onWindowTabReordered,
5590
5682
  onWindowAdded,
5591
5683
  onWindowLoaded,
5592
5684
  onWindowRemoved,