@atlassian/clientside-extensions-base 4.0.2 → 5.1.0-5a180d69-mdyn784a

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
4
+ const Subject_1 = tslib_1.__importDefault(require("./Subject"));
5
5
  /**
6
6
  * Subject for a single location and its observers
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubject.js","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":";;;AACA,qEAAgC;AAIhC;;;;;GAKG;AACH,MAAqB,eAAmB,SAAQ,iBAAU;IAKtD,YAAoB,UAAkB,CAAC;QACnC,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAY;QAJ/B,gBAAW,GAAS,IAAI,CAAC;IAMjC,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAE3B,oEAAoE;QACpE,wEAAwE;QACxE,mGAAmG;QACnG,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAES,UAAU;QAChB,YAAY,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAES,KAAK;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE9B,iGAAiG;QACjG,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;QAChD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,EAAE;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,OAAO;YACH,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;SAChD,CAAC;IACN,CAAC;CACJ;AArDD,kCAqDC","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\nexport type Tick = null | number | NodeJS.Timer;\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class DeferredSubject<T> extends Subject<T> {\n private notifyTimer: Tick = null;\n\n private lastPayload!: T;\n\n constructor(private timeout: number = 0) {\n super();\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.clearTimer();\n this.lastPayload = payload;\n\n // The resources for a specific location will be loaded all at once.\n // We defer updating the observers until the last such update made it in\n // so we dont call observers overly often, which could result in a waste of expensive calculations.\n this.notifyTimer = setTimeout(() => {\n this.flush();\n }, this.timeout);\n }\n\n protected clearTimer() {\n clearTimeout(this.notifyTimer as number);\n this.notifyTimer = null;\n }\n\n protected flush() {\n this.clearTimer();\n this.observers.forEach((observer) => observer(this.lastPayload));\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.observers.push(observer);\n\n // no notify timer is running - otherwise just wait for the cycle to update the location observer\n const noNotifyTimer = this.notifyTimer === null;\n if (this.lastPayload !== undefined && noNotifyTimer) {\n observer(this.lastPayload);\n }\n\n return {\n unsubscribe: () => this.unsubscribe(observer),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"DeferredSubject.js","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":";;;AACA,gEAAgC;AAIhC;;;;;GAKG;AACH,MAAqB,eAAmB,SAAQ,iBAAU;IAKtD,YAAoB,UAAkB,CAAC;QACnC,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAY;QAJ/B,gBAAW,GAAS,IAAI,CAAC;IAMjC,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAE3B,oEAAoE;QACpE,wEAAwE;QACxE,mGAAmG;QACnG,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAES,UAAU;QAChB,YAAY,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAES,KAAK;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE9B,iGAAiG;QACjG,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;QAChD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO;YACH,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;SAChD,CAAC;IACN,CAAC;CACJ;AArDD,kCAqDC","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\nexport type Tick = null | number | NodeJS.Timer;\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class DeferredSubject<T> extends Subject<T> {\n private notifyTimer: Tick = null;\n\n private lastPayload!: T;\n\n constructor(private timeout: number = 0) {\n super();\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.clearTimer();\n this.lastPayload = payload;\n\n // The resources for a specific location will be loaded all at once.\n // We defer updating the observers until the last such update made it in\n // so we dont call observers overly often, which could result in a waste of expensive calculations.\n this.notifyTimer = setTimeout(() => {\n this.flush();\n }, this.timeout);\n }\n\n protected clearTimer() {\n clearTimeout(this.notifyTimer as number);\n this.notifyTimer = null;\n }\n\n protected flush() {\n this.clearTimer();\n this.observers.forEach((observer) => observer(this.lastPayload));\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.observers.push(observer);\n\n // no notify timer is running - otherwise just wait for the cycle to update the location observer\n const noNotifyTimer = this.notifyTimer === null;\n if (this.lastPayload !== undefined && noNotifyTimer) {\n observer(this.lastPayload);\n }\n\n return {\n unsubscribe: () => this.unsubscribe(observer),\n };\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
4
+ const Subject_1 = tslib_1.__importDefault(require("./Subject"));
5
5
  /**
6
6
  * Subject for a single location and its observers
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ReplaySubject.js","sourceRoot":"","sources":["../../lib/ReplaySubject.ts"],"names":[],"mappings":";;;AACA,qEAAgC;AAEhC;;;;;GAKG;AACH,MAAqB,aAAiB,SAAQ,iBAAU;IAKpD,YAAY,aAAqB,EAAE;QAC/B,KAAK,EAAE,CAAC;QALJ,iBAAY,GAAQ,EAAE,CAAC;QAM3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEO,UAAU,CAAC,OAAU;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE;YAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjE;IACL,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAClC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ;AA1CD,gCA0CC","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class ReplaySubject<T> extends Subject<T> {\n private lastPayloads: T[] = [];\n\n private readonly replaySize: number;\n\n constructor(replaySize: number = 10) {\n super();\n this.replaySize = Math.abs(replaySize);\n }\n\n private addPayload(payload: T) {\n this.lastPayloads.push(payload);\n if (this.lastPayloads.length > this.replaySize) {\n this.lastPayloads = this.lastPayloads.slice(-this.replaySize);\n }\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.addPayload(payload);\n super.notify(payload);\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.lastPayloads.forEach((payload) => {\n observer(payload);\n });\n\n return super.subscribe(observer);\n }\n\n prune() {\n this.lastPayloads.length = 0;\n }\n}\n"]}
1
+ {"version":3,"file":"ReplaySubject.js","sourceRoot":"","sources":["../../lib/ReplaySubject.ts"],"names":[],"mappings":";;;AACA,gEAAgC;AAEhC;;;;;GAKG;AACH,MAAqB,aAAiB,SAAQ,iBAAU;IAKpD,YAAY,aAAqB,EAAE;QAC/B,KAAK,EAAE,CAAC;QALJ,iBAAY,GAAQ,EAAE,CAAC;QAM3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEO,UAAU,CAAC,OAAU;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAClC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ;AA1CD,gCA0CC","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class ReplaySubject<T> extends Subject<T> {\n private lastPayloads: T[] = [];\n\n private readonly replaySize: number;\n\n constructor(replaySize: number = 10) {\n super();\n this.replaySize = Math.abs(replaySize);\n }\n\n private addPayload(payload: T) {\n this.lastPayloads.push(payload);\n if (this.lastPayloads.length > this.replaySize) {\n this.lastPayloads = this.lastPayloads.slice(-this.replaySize);\n }\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.addPayload(payload);\n super.notify(payload);\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.lastPayloads.forEach((payload) => {\n observer(payload);\n });\n\n return super.subscribe(observer);\n }\n\n prune() {\n this.lastPayloads.length = 0;\n }\n}\n"]}
package/dist/cjs/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReplaySubject = exports.DeferredSubject = exports.Subject = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
5
+ const Subject_1 = tslib_1.__importDefault(require("./Subject"));
6
6
  exports.Subject = Subject_1.default;
7
- const DeferredSubject_1 = (0, tslib_1.__importDefault)(require("./DeferredSubject"));
7
+ const DeferredSubject_1 = tslib_1.__importDefault(require("./DeferredSubject"));
8
8
  exports.DeferredSubject = DeferredSubject_1.default;
9
- const ReplaySubject_1 = (0, tslib_1.__importDefault)(require("./ReplaySubject"));
9
+ const ReplaySubject_1 = tslib_1.__importDefault(require("./ReplaySubject"));
10
10
  exports.ReplaySubject = ReplaySubject_1.default;
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAI/D,kBAJF,iBAAO,CAIE;AAHhB,qFAAgD;AAG9B,0BAHX,yBAAe,CAGW;AAFjC,iFAA4C;AAET,wBAF5B,uBAAa,CAE4B","sourcesContent":["import Subject, { Observer, Observable, Subscription } from './Subject';\nimport DeferredSubject from './DeferredSubject';\nimport ReplaySubject from './ReplaySubject';\n\nexport { Subject, DeferredSubject, ReplaySubject, Observable, Subscription, Observer };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,gEAAwE;AAI/D,kBAJF,iBAAO,CAIE;AAHhB,gFAAgD;AAG9B,0BAHX,yBAAe,CAGW;AAFjC,4EAA4C;AAET,wBAF5B,uBAAa,CAE4B","sourcesContent":["import Subject, { Observer, Observable, Subscription } from './Subject';\nimport DeferredSubject from './DeferredSubject';\nimport ReplaySubject from './ReplaySubject';\n\nexport { Subject, DeferredSubject, ReplaySubject, Observable, Subscription, Observer };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubject.js","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":"AACA,OAAO,OA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cesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\nexport type Tick = null | number | NodeJS.Timer;\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class DeferredSubject<T> extends Subject<T> {\n private notifyTimer: Tick = null;\n\n private lastPayload!: T;\n\n constructor(private timeout: number = 0) {\n super();\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.clearTimer();\n this.lastPayload = payload;\n\n // The resources for a specific location will be loaded all at once.\n // We defer updating the observers until the last such update made it in\n // so we dont call observers overly often, which could result in a waste of expensive calculations.\n this.notifyTimer = setTimeout(() => {\n this.flush();\n }, this.timeout);\n }\n\n protected clearTimer() {\n clearTimeout(this.notifyTimer as number);\n this.notifyTimer = null;\n }\n\n protected flush() {\n this.clearTimer();\n this.observers.forEach((observer) => observer(this.lastPayload));\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.observers.push(observer);\n\n // no notify timer is running - otherwise just wait for the cycle to update the location observer\n const noNotifyTimer = this.notifyTimer === null;\n if (this.lastPayload !== undefined && noNotifyTimer) {\n observer(this.lastPayload);\n }\n\n return {\n unsubscribe: () => this.unsubscribe(observer),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"DeferredSubject.js","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAIhC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAmB,SAAQ,OAAU;IAKtD,YAAoB,UAAkB,CAAC;QACnC,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAY;QAJ/B,gBAAW,GAAS,IAAI,CAAC;IAMjC,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAE3B,oEAAoE;QACpE,wEAAwE;QACxE,mGAAmG;QACnG,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAES,UAAU;QAChB,YAAY,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAES,KAAK;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE9B,iGAAiG;QACjG,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;QAChD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO;YACH,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;SAChD,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\nexport type Tick = null | number | NodeJS.Timer;\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class DeferredSubject<T> extends Subject<T> {\n private notifyTimer: Tick = null;\n\n private lastPayload!: T;\n\n constructor(private timeout: number = 0) {\n super();\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.clearTimer();\n this.lastPayload = payload;\n\n // The resources for a specific location will be loaded all at once.\n // We defer updating the observers until the last such update made it in\n // so we dont call observers overly often, which could result in a waste of expensive calculations.\n this.notifyTimer = setTimeout(() => {\n this.flush();\n }, this.timeout);\n }\n\n protected clearTimer() {\n clearTimeout(this.notifyTimer as number);\n this.notifyTimer = null;\n }\n\n protected flush() {\n this.clearTimer();\n this.observers.forEach((observer) => observer(this.lastPayload));\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.observers.push(observer);\n\n // no notify timer is running - otherwise just wait for the cycle to update the location observer\n const noNotifyTimer = this.notifyTimer === null;\n if (this.lastPayload !== undefined && noNotifyTimer) {\n observer(this.lastPayload);\n }\n\n return {\n unsubscribe: () => this.unsubscribe(observer),\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ReplaySubject.js","sourceRoot":"","sources":["../../lib/ReplaySubject.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,aAAiB,SAAQ,OAAU;IAKpD,YAAY,aAAqB,EAAE;QAC/B,KAAK,EAAE,CAAC;QALJ,iBAAY,GAAQ,EAAE,CAAC;QAM3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEO,UAAU,CAAC,OAAU;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE;YAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjE;IACL,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAClC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class ReplaySubject<T> extends Subject<T> {\n private lastPayloads: T[] = [];\n\n private readonly replaySize: number;\n\n constructor(replaySize: number = 10) {\n super();\n this.replaySize = Math.abs(replaySize);\n }\n\n private addPayload(payload: T) {\n this.lastPayloads.push(payload);\n if (this.lastPayloads.length > this.replaySize) {\n this.lastPayloads = this.lastPayloads.slice(-this.replaySize);\n }\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.addPayload(payload);\n super.notify(payload);\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.lastPayloads.forEach((payload) => {\n observer(payload);\n });\n\n return super.subscribe(observer);\n }\n\n prune() {\n this.lastPayloads.length = 0;\n }\n}\n"]}
1
+ {"version":3,"file":"ReplaySubject.js","sourceRoot":"","sources":["../../lib/ReplaySubject.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,aAAiB,SAAQ,OAAU;IAKpD,YAAY,aAAqB,EAAE;QAC/B,KAAK,EAAE,CAAC;QALJ,iBAAY,GAAQ,EAAE,CAAC;QAM3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEO,UAAU,CAAC,OAAU;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,OAAU;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACM,SAAS,CAAC,QAAqB;QACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAClC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ","sourcesContent":["import type { Observer, Subscription } from './Subject';\nimport Subject from './Subject';\n\n/**\n * Subject for a single location and its observers\n *\n * Observers are callbacks provided by the different instances of a location that want to be notified\n * when a list of descriptors changed and is available to be rendered.\n */\nexport default class ReplaySubject<T> extends Subject<T> {\n private lastPayloads: T[] = [];\n\n private readonly replaySize: number;\n\n constructor(replaySize: number = 10) {\n super();\n this.replaySize = Math.abs(replaySize);\n }\n\n private addPayload(payload: T) {\n this.lastPayloads.push(payload);\n if (this.lastPayloads.length > this.replaySize) {\n this.lastPayloads = this.lastPayloads.slice(-this.replaySize);\n }\n }\n\n /**\n * @Override\n * Notify all observers with a list of descriptors. Send the last value sent if no value is provided.\n */\n public override notify(payload: T) {\n this.addPayload(payload);\n super.notify(payload);\n }\n\n /**\n * @Override\n * Add an observer to the location subject. The observer will be notified each time there's a new list of\n * descriptors ready to be renderer.\n */\n override subscribe(observer: Observer<T>): Subscription {\n this.lastPayloads.forEach((payload) => {\n observer(payload);\n });\n\n return super.subscribe(observer);\n }\n\n prune() {\n this.lastPayloads.length = 0;\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
1
  import type { Observer, Subscription } from './Subject';
3
2
  import Subject from './Subject';
4
- export declare type Tick = null | number | NodeJS.Timer;
3
+ export type Tick = null | number | NodeJS.Timer;
5
4
  /**
6
5
  * Subject for a single location and its observers
7
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubject.d.ts","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,oBAAY,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAK1C,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,WAAW,CAAc;IAEjC,OAAO,CAAC,WAAW,CAAK;gBAEJ,OAAO,GAAE,MAAU;IAIvC;;;OAGG;IACa,MAAM,CAAC,OAAO,EAAE,CAAC;IAYjC,SAAS,CAAC,UAAU;IAKpB,SAAS,CAAC,KAAK;IAKf;;;;OAIG;IACM,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY;CAa1D"}
1
+ {"version":3,"file":"DeferredSubject.d.ts","sourceRoot":"","sources":["../../lib/DeferredSubject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAK1C,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,WAAW,CAAc;IAEjC,OAAO,CAAC,WAAW,CAAK;gBAEJ,OAAO,GAAE,MAAU;IAIvC;;;OAGG;IACa,MAAM,CAAC,OAAO,EAAE,CAAC;IAYjC,SAAS,CAAC,UAAU;IAKpB,SAAS,CAAC,KAAK;IAKf;;;;OAIG;IACM,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY;CAa1D"}
@@ -1,4 +1,4 @@
1
- export declare type Observer<T> = (data: T) => void;
1
+ export type Observer<T> = (data: T) => void;
2
2
  export interface Subscription {
3
3
  unsubscribe: () => void;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Subject.d.ts","sourceRoot":"","sources":["../../lib/Subject.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAE5C,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IACzB,SAAS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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/clientside-extensions-base",
3
- "version": "4.0.2",
3
+ "version": "5.1.0-5a180d69-mdyn784a",
4
4
  "description": "Shared base components and utilities for Client-side extensions",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://bitbucket.org/atlassian/atlassian-clientside-extensions#readme",
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "publishConfig": {
54
54
  "access": "public",
55
- "@atlassian:registry": "https://registry.npmjs.org/"
55
+ "@atlassian:registry": "https://packages.atlassian.com/api/npm/npm-public/"
56
56
  },
57
57
  "scripts": {
58
58
  "prepublish": "yarn build",
@@ -68,7 +68,7 @@
68
68
  "tslib": "^2.2.0"
69
69
  },
70
70
  "engines": {
71
- "node": ">=20.16.0"
71
+ "node": ">=20.18.1"
72
72
  },
73
- "gitHead": "2d552dc8d3b5d2c9583a19324d5b7459f5db6afa"
73
+ "gitHead": "5a180d69885a02ac1d96b980893b6a5c77e9459a"
74
74
  }