@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.
@@ -1149,7 +1149,7 @@
1149
1149
  type: eventTypeDecoder,
1150
1150
  branch: nonEmptyStringDecoder
1151
1151
  });
1152
- 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"));
1152
+ 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"));
1153
1153
  const workspaceConfigResultDecoder = object({
1154
1154
  frameId: nonEmptyStringDecoder,
1155
1155
  title: nonEmptyStringDecoder,
@@ -1445,7 +1445,14 @@
1445
1445
  workspaceId: nonEmptyStringDecoder,
1446
1446
  saveContext: optional(boolean()),
1447
1447
  allowMultiple: optional(boolean()),
1448
- metadata: optional(object())
1448
+ metadata: optional(object()),
1449
+ saveWindowContexts: optional(boolean())
1450
+ });
1451
+ const saveLayoutConfigDecoder = object({
1452
+ saveContext: optional(boolean()),
1453
+ allowMultiple: optional(boolean()),
1454
+ metadata: optional(object()),
1455
+ saveWindowContexts: optional(boolean())
1449
1456
  });
1450
1457
  const workspaceLockConfigDecoder = object({
1451
1458
  allowDrop: optional(boolean()),
@@ -2866,7 +2873,10 @@
2866
2873
  }
2867
2874
  async saveLayout(name, config) {
2868
2875
  nonEmptyStringDecoder.runWithException(name);
2869
- await getData$3(this).controller.saveLayout({ name, workspaceId: this.id, saveContext: config?.saveContext, metadata: config?.metadata, allowMultiple: config?.allowMultiple });
2876
+ if (config) {
2877
+ saveLayoutConfigDecoder.runWithException(config);
2878
+ }
2879
+ await getData$3(this).controller.saveLayout({ name, workspaceId: this.id, saveContext: config?.saveContext, metadata: config?.metadata, allowMultiple: config?.allowMultiple, saveWindowContexts: config?.saveWindowContexts });
2870
2880
  }
2871
2881
  async setTitle(title) {
2872
2882
  nonEmptyStringDecoder.runWithException(title);
@@ -3129,6 +3139,57 @@
3129
3139
  const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3130
3140
  return unsubscribe;
3131
3141
  }
3142
+ async onLockConfigurationChanged(callback) {
3143
+ checkThrowCallback(callback);
3144
+ const id = getData$3(this).id;
3145
+ const wrappedCallback = async () => {
3146
+ await this.refreshReference();
3147
+ callback({
3148
+ allowDrop: this.allowDrop,
3149
+ allowDropLeft: this.allowDropLeft,
3150
+ allowDropTop: this.allowDropTop,
3151
+ allowDropRight: this.allowDropRight,
3152
+ allowDropBottom: this.allowDropBottom,
3153
+ allowSystemHibernation: this.allowSystemHibernation,
3154
+ allowExtract: this.allowExtract,
3155
+ allowSplitters: this.allowSplitters,
3156
+ allowWindowReorder: this.allowWindowReorder,
3157
+ allowWorkspaceTabExtract: this.allowWorkspaceTabExtract,
3158
+ allowWorkspaceTabReorder: this.allowWorkspaceTabReorder,
3159
+ showAddWindowButtons: this.showAddWindowButtons,
3160
+ showCloseButton: this.showCloseButton,
3161
+ showEjectButtons: this.showEjectButtons,
3162
+ showSaveButton: this.showSaveButton,
3163
+ showWindowCloseButtons: this.showWindowCloseButtons
3164
+ });
3165
+ };
3166
+ const config = {
3167
+ action: "lock-configuration-changed",
3168
+ eventType: "workspace",
3169
+ scope: "workspace",
3170
+ scopeId: id,
3171
+ callback: wrappedCallback
3172
+ };
3173
+ const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3174
+ return unsubscribe;
3175
+ }
3176
+ async onTabReordered(callback) {
3177
+ checkThrowCallback(callback);
3178
+ const id = getData$3(this).id;
3179
+ const wrappedCallback = async () => {
3180
+ await this.refreshReference();
3181
+ callback();
3182
+ };
3183
+ const config = {
3184
+ action: "tab-reordered",
3185
+ eventType: "workspace",
3186
+ scope: "workspace",
3187
+ scopeId: id,
3188
+ callback: wrappedCallback
3189
+ };
3190
+ const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3191
+ return unsubscribe;
3192
+ }
3132
3193
  async onWindowAdded(callback) {
3133
3194
  checkThrowCallback(callback);
3134
3195
  const id = getData$3(this).id;
@@ -3251,33 +3312,20 @@
3251
3312
  const unsubscribe = await getData$3(this).controller.processLocalSubscription(config, id);
3252
3313
  return unsubscribe;
3253
3314
  }
3254
- async onLockConfigurationChanged(callback) {
3315
+ async onWindowTabReordered(callback) {
3255
3316
  checkThrowCallback(callback);
3256
3317
  const id = getData$3(this).id;
3257
- const wrappedCallback = async () => {
3318
+ const wrappedCallback = async (payload) => {
3258
3319
  await this.refreshReference();
3259
- callback({
3260
- allowDrop: this.allowDrop,
3261
- allowDropLeft: this.allowDropLeft,
3262
- allowDropTop: this.allowDropTop,
3263
- allowDropRight: this.allowDropRight,
3264
- allowDropBottom: this.allowDropBottom,
3265
- allowSystemHibernation: this.allowSystemHibernation,
3266
- allowExtract: this.allowExtract,
3267
- allowSplitters: this.allowSplitters,
3268
- allowWindowReorder: this.allowWindowReorder,
3269
- allowWorkspaceTabExtract: this.allowWorkspaceTabExtract,
3270
- allowWorkspaceTabReorder: this.allowWorkspaceTabReorder,
3271
- showAddWindowButtons: this.showAddWindowButtons,
3272
- showCloseButton: this.showCloseButton,
3273
- showEjectButtons: this.showEjectButtons,
3274
- showSaveButton: this.showSaveButton,
3275
- showWindowCloseButtons: this.showWindowCloseButtons
3320
+ const windowParent = this.getBox((parent) => parent.id === payload.windowSummary.parentId);
3321
+ const foundWindow = windowParent.children.find((child) => {
3322
+ return child.type === "window" && child.elementId === payload.windowSummary.itemId;
3276
3323
  });
3324
+ callback(foundWindow);
3277
3325
  };
3278
3326
  const config = {
3279
- action: "lock-configuration-changed",
3280
- eventType: "workspace",
3327
+ action: "tab-reordered",
3328
+ eventType: "window",
3281
3329
  scope: "workspace",
3282
3330
  scopeId: id,
3283
3331
  callback: wrappedCallback
@@ -3511,6 +3559,22 @@
3511
3559
  const unsubscribe = await getData$2(this).controller.processLocalSubscription(config, id);
3512
3560
  return unsubscribe;
3513
3561
  }
3562
+ async onTabReordered(callback) {
3563
+ checkThrowCallback(callback);
3564
+ const id = getData$2(this).id;
3565
+ const wrappedCallback = async () => {
3566
+ await this.workspace.refreshReference();
3567
+ callback();
3568
+ };
3569
+ const config = {
3570
+ callback: wrappedCallback,
3571
+ action: "tab-reordered",
3572
+ eventType: "window",
3573
+ scope: "window"
3574
+ };
3575
+ const unsubscribe = await getData$2(this).controller.processLocalSubscription(config, id);
3576
+ return unsubscribe;
3577
+ }
3514
3578
  }
3515
3579
 
3516
3580
  const data$1 = new WeakMap();
@@ -5285,7 +5349,7 @@
5285
5349
  }
5286
5350
  }
5287
5351
 
5288
- var version = "4.3.0";
5352
+ var version = "4.4.0";
5289
5353
 
5290
5354
  const composeAPI = (glue, ioc) => {
5291
5355
  const controller = ioc.controller;
@@ -5454,6 +5518,15 @@
5454
5518
  const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "workspace", "resumed");
5455
5519
  return unsubscribe;
5456
5520
  };
5521
+ const onWorkspaceTabReordered = async (callback) => {
5522
+ checkThrowCallback(callback);
5523
+ const wrappedCallback = async (payload) => {
5524
+ const workspace = await controller.transformStreamPayloadToWorkspace(payload);
5525
+ callback(workspace);
5526
+ };
5527
+ const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "workspace", "tab-reordered");
5528
+ return unsubscribe;
5529
+ };
5457
5530
  const onWindowAdded = async (callback) => {
5458
5531
  checkThrowCallback(callback);
5459
5532
  const wrappedCallback = async (payload) => {
@@ -5547,6 +5620,23 @@
5547
5620
  const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "window", "selected");
5548
5621
  return unsubscribe;
5549
5622
  };
5623
+ const onWindowTabReordered = async (callback) => {
5624
+ checkThrowCallback(callback);
5625
+ const wrappedCallback = async (payload) => {
5626
+ const snapshot = (await controller.getSnapshot(payload.windowSummary.config.workspaceId, "workspace"));
5627
+ const frameConfig = {
5628
+ summary: snapshot.frameSummary
5629
+ };
5630
+ const frame = ioc.getModel("frame", frameConfig);
5631
+ const workspaceConfig = { frame, snapshot };
5632
+ const workspace = ioc.getModel("workspace", workspaceConfig);
5633
+ const windowParent = workspace.getBox((parent) => parent.id === payload.windowSummary.parentId);
5634
+ const foundWindow = windowParent.children.find((child) => child.type === "window" && child.elementId === payload.windowSummary.itemId);
5635
+ callback(foundWindow);
5636
+ };
5637
+ const unsubscribe = await controller.processGlobalSubscription(wrappedCallback, "window", "tab-reordered");
5638
+ return unsubscribe;
5639
+ };
5550
5640
  const waitForFrame = async (id) => {
5551
5641
  nonEmptyStringDecoder.runWithException(id);
5552
5642
  return new Promise((res, rej) => {
@@ -5593,6 +5683,8 @@
5593
5683
  onWorkspaceClosed,
5594
5684
  onWorkspaceHibernated,
5595
5685
  onWorkspaceResumed,
5686
+ onWorkspaceTabReordered,
5687
+ onWindowTabReordered,
5596
5688
  onWindowAdded,
5597
5689
  onWindowLoaded,
5598
5690
  onWindowRemoved,