@vonage/vivid 3.0.0-next.18 → 3.0.0-next.20

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/shared/index.js CHANGED
@@ -275,30 +275,6 @@ const DOM = Object.freeze({
275
275
  },
276
276
  });
277
277
 
278
- function spilloverSubscribe(subscriber) {
279
- const spillover = this.spillover;
280
- const index = spillover.indexOf(subscriber);
281
- if (index === -1) {
282
- spillover.push(subscriber);
283
- }
284
- }
285
- function spilloverUnsubscribe(subscriber) {
286
- const spillover = this.spillover;
287
- const index = spillover.indexOf(subscriber);
288
- if (index !== -1) {
289
- spillover.splice(index, 1);
290
- }
291
- }
292
- function spilloverNotifySubscribers(args) {
293
- const spillover = this.spillover;
294
- const source = this.source;
295
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
296
- spillover[i].handleChange(source, args);
297
- }
298
- }
299
- function spilloverHas(subscriber) {
300
- return this.spillover.indexOf(subscriber) !== -1;
301
- }
302
278
  /**
303
279
  * An implementation of {@link Notifier} that efficiently keeps track of
304
280
  * subscribers interested in a specific change notification on an
@@ -328,42 +304,58 @@ class SubscriberSet {
328
304
  * @param subscriber - The subscriber to test for inclusion in this set.
329
305
  */
330
306
  has(subscriber) {
331
- return this.sub1 === subscriber || this.sub2 === subscriber;
307
+ return this.spillover === void 0
308
+ ? this.sub1 === subscriber || this.sub2 === subscriber
309
+ : this.spillover.indexOf(subscriber) !== -1;
332
310
  }
333
311
  /**
334
312
  * Subscribes to notification of changes in an object's state.
335
313
  * @param subscriber - The object that is subscribing for change notification.
336
314
  */
337
315
  subscribe(subscriber) {
338
- if (this.has(subscriber)) {
339
- return;
340
- }
341
- if (this.sub1 === void 0) {
342
- this.sub1 = subscriber;
343
- return;
316
+ const spillover = this.spillover;
317
+ if (spillover === void 0) {
318
+ if (this.has(subscriber)) {
319
+ return;
320
+ }
321
+ if (this.sub1 === void 0) {
322
+ this.sub1 = subscriber;
323
+ return;
324
+ }
325
+ if (this.sub2 === void 0) {
326
+ this.sub2 = subscriber;
327
+ return;
328
+ }
329
+ this.spillover = [this.sub1, this.sub2, subscriber];
330
+ this.sub1 = void 0;
331
+ this.sub2 = void 0;
344
332
  }
345
- if (this.sub2 === void 0) {
346
- this.sub2 = subscriber;
347
- return;
333
+ else {
334
+ const index = spillover.indexOf(subscriber);
335
+ if (index === -1) {
336
+ spillover.push(subscriber);
337
+ }
348
338
  }
349
- this.spillover = [this.sub1, this.sub2, subscriber];
350
- this.subscribe = spilloverSubscribe;
351
- this.unsubscribe = spilloverUnsubscribe;
352
- this.notify = spilloverNotifySubscribers;
353
- this.has = spilloverHas;
354
- this.sub1 = void 0;
355
- this.sub2 = void 0;
356
339
  }
357
340
  /**
358
341
  * Unsubscribes from notification of changes in an object's state.
359
342
  * @param subscriber - The object that is unsubscribing from change notification.
360
343
  */
361
344
  unsubscribe(subscriber) {
362
- if (this.sub1 === subscriber) {
363
- this.sub1 = void 0;
345
+ const spillover = this.spillover;
346
+ if (spillover === void 0) {
347
+ if (this.sub1 === subscriber) {
348
+ this.sub1 = void 0;
349
+ }
350
+ else if (this.sub2 === subscriber) {
351
+ this.sub2 = void 0;
352
+ }
364
353
  }
365
- else if (this.sub2 === subscriber) {
366
- this.sub2 = void 0;
354
+ else {
355
+ const index = spillover.indexOf(subscriber);
356
+ if (index !== -1) {
357
+ spillover.splice(index, 1);
358
+ }
367
359
  }
368
360
  }
369
361
  /**
@@ -371,14 +363,22 @@ class SubscriberSet {
371
363
  * @param args - Data passed along to subscribers during notification.
372
364
  */
373
365
  notify(args) {
374
- const sub1 = this.sub1;
375
- const sub2 = this.sub2;
366
+ const spillover = this.spillover;
376
367
  const source = this.source;
377
- if (sub1 !== void 0) {
378
- sub1.handleChange(source, args);
368
+ if (spillover === void 0) {
369
+ const sub1 = this.sub1;
370
+ const sub2 = this.sub2;
371
+ if (sub1 !== void 0) {
372
+ sub1.handleChange(source, args);
373
+ }
374
+ if (sub2 !== void 0) {
375
+ sub2.handleChange(source, args);
376
+ }
379
377
  }
380
- if (sub2 !== void 0) {
381
- sub2.handleChange(source, args);
378
+ else {
379
+ for (let i = 0, ii = spillover.length; i < ii; ++i) {
380
+ spillover[i].handleChange(source, args);
381
+ }
382
382
  }
383
383
  }
384
384
  }
@@ -424,7 +424,8 @@ class PropertyChangeNotifier {
424
424
  subscribers.subscribe(subscriber);
425
425
  }
426
426
  else {
427
- this.sourceSubscribers = (_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);
427
+ this.sourceSubscribers =
428
+ (_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);
428
429
  this.sourceSubscribers.subscribe(subscriber);
429
430
  }
430
431
  }
@@ -568,6 +569,7 @@ const Observable = FAST.getById(2 /* observable */, () => {
568
569
  watcher = void 0;
569
570
  /* eslint-disable-next-line */
570
571
  prevValue = prev.propertySource[prev.propertyName];
572
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
571
573
  watcher = this;
572
574
  if (propertySource === prevValue) {
573
575
  this.needsRefresh = true;
@@ -1143,6 +1145,7 @@ class CompilationContext {
1143
1145
  this.targetIndex = -1;
1144
1146
  }
1145
1147
  release() {
1148
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
1146
1149
  sharedContext = this;
1147
1150
  }
1148
1151
  static borrow(directives) {
@@ -1621,8 +1624,6 @@ function html(strings, ...values) {
1621
1624
  class ElementStyles {
1622
1625
  constructor() {
1623
1626
  this.targets = new WeakSet();
1624
- /** @internal */
1625
- this.behaviors = null;
1626
1627
  }
1627
1628
  /** @internal */
1628
1629
  addStylesTo(target) {