@vonage/vivid 3.0.0-next.6 → 3.0.0-next.61

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.
Files changed (161) hide show
  1. package/README.md +135 -4
  2. package/accordion/index.js +2 -4
  3. package/accordion-item/index.js +26 -20
  4. package/action-group/index.js +47 -0
  5. package/avatar/index.js +51 -0
  6. package/badge/index.js +14 -20
  7. package/banner/index.js +21 -86
  8. package/breadcrumb/index.js +20 -18
  9. package/breadcrumb-item/index.js +14 -11
  10. package/button/index.js +28 -661
  11. package/calendar/index.js +67 -25
  12. package/calendar-event/index.js +115 -0
  13. package/card/index.js +132 -0
  14. package/checkbox/index.js +180 -0
  15. package/dialog/index.js +279 -0
  16. package/divider/index.js +86 -0
  17. package/elevation/index.js +3 -31
  18. package/fab/index.js +100 -0
  19. package/focus/index.js +18 -3
  20. package/header/index.js +66 -0
  21. package/icon/index.js +9 -5
  22. package/index.js +45 -20
  23. package/layout/index.js +4 -6
  24. package/lib/accordion-item/accordion-item.d.ts +2 -2
  25. package/lib/accordion-item/index.d.ts +2 -1
  26. package/lib/action-group/action-group.d.ts +10 -0
  27. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  28. package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
  29. package/lib/avatar/avatar.d.ts +14 -0
  30. package/lib/avatar/avatar.template.d.ts +4 -0
  31. package/lib/avatar/index.d.ts +3 -0
  32. package/lib/badge/badge.d.ts +6 -6
  33. package/lib/badge/index.d.ts +1 -1
  34. package/lib/banner/banner.d.ts +1 -1
  35. package/lib/banner/banner.template.d.ts +0 -2
  36. package/lib/banner/index.d.ts +1 -0
  37. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  38. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  39. package/lib/breadcrumb-item/index.d.ts +1 -0
  40. package/lib/button/button.d.ts +6 -5
  41. package/lib/button/index.d.ts +2 -19
  42. package/lib/calendar/calendar.d.ts +3 -1
  43. package/lib/calendar/index.d.ts +0 -1
  44. package/lib/calendar-event/calendar-event.d.ts +14 -0
  45. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  46. package/lib/calendar-event/index.d.ts +2 -0
  47. package/lib/card/card.d.ts +10 -0
  48. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  49. package/lib/card/index.d.ts +4 -0
  50. package/lib/checkbox/checkbox.d.ts +5 -0
  51. package/lib/checkbox/checkbox.template.d.ts +4 -0
  52. package/lib/checkbox/index.d.ts +4 -0
  53. package/lib/components.d.ts +22 -10
  54. package/lib/dialog/dialog.d.ts +20 -0
  55. package/lib/dialog/dialog.template.d.ts +4 -0
  56. package/lib/dialog/index.d.ts +5 -0
  57. package/lib/divider/divider.d.ts +3 -0
  58. package/lib/divider/divider.template.d.ts +4 -0
  59. package/lib/divider/index.d.ts +2 -0
  60. package/lib/elevation/elevation.d.ts +1 -0
  61. package/lib/elevation/index.d.ts +1 -1
  62. package/lib/enums.d.ts +12 -6
  63. package/lib/fab/fab.d.ts +13 -0
  64. package/lib/fab/fab.template.d.ts +4 -0
  65. package/lib/fab/index.d.ts +4 -0
  66. package/lib/focus/index.d.ts +1 -1
  67. package/lib/header/header.d.ts +5 -0
  68. package/lib/header/header.template.d.ts +4 -0
  69. package/lib/header/index.d.ts +3 -0
  70. package/lib/icon/icon.d.ts +4 -3
  71. package/lib/layout/index.d.ts +1 -1
  72. package/lib/layout/layout.d.ts +3 -3
  73. package/lib/menu/index.d.ts +11 -0
  74. package/lib/menu/menu.d.ts +7 -0
  75. package/lib/menu/menu.template.d.ts +3 -0
  76. package/lib/nav/index.d.ts +2 -0
  77. package/lib/nav/nav.d.ts +3 -0
  78. package/lib/nav/nav.template.d.ts +4 -0
  79. package/lib/nav-disclosure/index.d.ts +4 -0
  80. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  81. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  82. package/lib/nav-item/index.d.ts +4 -0
  83. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  84. package/lib/nav-item/nav-item.template.d.ts +4 -0
  85. package/lib/{text → note}/index.d.ts +1 -1
  86. package/lib/note/note.d.ts +10 -0
  87. package/lib/note/note.template.d.ts +5 -0
  88. package/lib/popup/index.d.ts +1 -1
  89. package/lib/popup/popup.d.ts +3 -15
  90. package/lib/progress/progress.d.ts +1 -1
  91. package/lib/progress-ring/progress-ring.d.ts +2 -1
  92. package/lib/side-drawer/index.d.ts +1 -1
  93. package/lib/side-drawer/side-drawer.d.ts +4 -7
  94. package/lib/side-drawer/side-drawer.template.d.ts +2 -2
  95. package/lib/text-anchor/text-anchor.d.ts +1 -1
  96. package/lib/text-area/index.d.ts +3 -0
  97. package/lib/text-area/text-area.d.ts +9 -0
  98. package/lib/text-area/text-area.template.d.ts +4 -0
  99. package/lib/text-field/index.d.ts +4 -0
  100. package/lib/text-field/text-field.d.ts +16 -0
  101. package/lib/text-field/text-field.template.d.ts +5 -0
  102. package/lib/tooltip/tooltip.d.ts +2 -4
  103. package/menu/index.js +659 -0
  104. package/nav/index.js +17 -0
  105. package/nav-disclosure/index.js +88 -0
  106. package/nav-item/index.js +41 -0
  107. package/note/index.js +66 -0
  108. package/package.json +49 -8
  109. package/popup/index.js +19 -2082
  110. package/progress/index.js +35 -28
  111. package/progress-ring/index.js +9 -5
  112. package/shared/anchor.js +8 -1
  113. package/shared/aria-global.js +3 -40
  114. package/shared/base-progress.js +5 -0
  115. package/shared/button.js +199 -0
  116. package/shared/calendar-event.js +26 -0
  117. package/shared/dialog-polyfill.esm.js +858 -0
  118. package/shared/enums.js +79 -0
  119. package/shared/es.object.assign.js +7 -6
  120. package/shared/export.js +995 -0
  121. package/shared/focus.js +5 -0
  122. package/shared/focus2.js +11 -0
  123. package/shared/form-associated.js +554 -0
  124. package/shared/form-elements.js +298 -0
  125. package/shared/icon.js +533 -520
  126. package/shared/index.js +79 -56
  127. package/shared/index2.js +26 -12
  128. package/shared/index3.js +2113 -0
  129. package/shared/iterators.js +61 -0
  130. package/shared/object-keys.js +13 -0
  131. package/shared/patterns/focus.d.ts +3 -0
  132. package/shared/patterns/form-elements.d.ts +22 -0
  133. package/shared/patterns/index.d.ts +1 -0
  134. package/shared/ref.js +41 -0
  135. package/shared/text-anchor.js +2 -11
  136. package/shared/text-anchor.template.js +5 -2
  137. package/shared/to-string.js +51 -0
  138. package/shared/web.dom-collections.iterator.js +78 -1083
  139. package/side-drawer/index.js +50 -51
  140. package/styles/core/all.css +75 -0
  141. package/styles/core/theme.css +11 -0
  142. package/styles/core/typography.css +69 -0
  143. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff +0 -0
  144. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  145. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff +0 -0
  146. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  147. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff +0 -0
  148. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  149. package/styles/fonts/spezia.css +12 -12
  150. package/styles/tokens/theme-dark.css +210 -0
  151. package/styles/tokens/theme-light.css +210 -0
  152. package/text-anchor/index.js +8 -1
  153. package/text-area/index.js +302 -0
  154. package/text-field/index.js +150 -0
  155. package/tooltip/index.js +19 -23
  156. package/lib/text/text.d.ts +0 -10
  157. package/shared/style-inject.es.js +0 -28
  158. package/sidenav-item/index.js +0 -38
  159. package/styles/themes/dark.css +0 -193
  160. package/styles/themes/light.css +0 -193
  161. package/text/index.js +0 -45
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;
@@ -707,6 +709,21 @@ const Observable = FAST.getById(2 /* observable */, () => {
707
709
  function observable(target, nameOrAccessor) {
708
710
  Observable.defineProperty(target, nameOrAccessor);
709
711
  }
712
+ /**
713
+ * Decorator: Marks a property getter as having volatile observable dependencies.
714
+ * @param target - The target that the property is defined on.
715
+ * @param name - The property name.
716
+ * @param name - The existing descriptor.
717
+ * @public
718
+ */
719
+ function volatile(target, name, descriptor) {
720
+ return Object.assign({}, descriptor, {
721
+ get: function () {
722
+ Observable.trackVolatile();
723
+ return descriptor.get.apply(this);
724
+ },
725
+ });
726
+ }
710
727
  const contextEvent = FAST.getById(3 /* contextEvent */, () => {
711
728
  let current = null;
712
729
  return {
@@ -1128,6 +1145,7 @@ class CompilationContext {
1128
1145
  this.targetIndex = -1;
1129
1146
  }
1130
1147
  release() {
1148
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
1131
1149
  sharedContext = this;
1132
1150
  }
1133
1151
  static borrow(directives) {
@@ -1606,8 +1624,6 @@ function html(strings, ...values) {
1606
1624
  class ElementStyles {
1607
1625
  constructor() {
1608
1626
  this.targets = new WeakSet();
1609
- /** @internal */
1610
- this.behaviors = null;
1611
1627
  }
1612
1628
  /** @internal */
1613
1629
  addStylesTo(target) {
@@ -2473,7 +2489,7 @@ class CSSDirective {
2473
2489
  }
2474
2490
  }
2475
2491
 
2476
- /*! *****************************************************************************
2492
+ /******************************************************************************
2477
2493
  Copyright (c) Microsoft Corporation.
2478
2494
 
2479
2495
  Permission to use, copy, modify, and/or distribute this software for any
@@ -2503,6 +2519,13 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
2503
2519
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2504
2520
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2505
2521
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2522
+ }
2523
+
2524
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
2525
+ if (kind === "m") throw new TypeError("Private method is not writable");
2526
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2527
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2528
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
2506
2529
  }
2507
2530
 
2508
2531
  /**
@@ -4988,4 +5011,4 @@ function provideVividDesignSystem(element) {
4988
5011
  }
4989
5012
  const designSystem = provideVividDesignSystem();
4990
5013
 
4991
- export { AttachedBehaviorHTMLDirective as A, DOM as D, FoundationElement as F, HTMLDirective as H, Observable as O, SubscriberSet as S, __decorate as _, attr as a, __metadata as b, __classPrivateFieldGet as c, designSystem as d, emptyArray as e, HTMLView as f, html as h, nullableNumberConverter as n, observable as o, provideVividDesignSystem as p };
5014
+ export { AttachedBehaviorHTMLDirective as A, DOM as D, FoundationElement as F, HTMLDirective as H, Observable as O, SubscriberSet as S, __decorate as _, attr as a, __metadata as b, __classPrivateFieldGet as c, designSystem as d, emptyArray as e, booleanConverter as f, HTMLView as g, html as h, __classPrivateFieldSet as i, nullableNumberConverter as n, observable as o, provideVividDesignSystem as p, volatile as v };
package/shared/index2.js CHANGED
@@ -1,21 +1,35 @@
1
- import { F as FoundationElement, h as html, d as designSystem } from './index.js';
2
- import { s as styleInject } from './style-inject.es.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from './index.js';
2
+ import { c as classNames } from './class-names.js';
3
3
 
4
- class Focus extends FoundationElement {}
4
+ class Elevation extends FoundationElement {}
5
5
 
6
- var css_248z = ":host {\n display: contents;\n border-radius: inherit;\n}\n\n.control {\n position: absolute;\n box-sizing: border-box;\n border-radius: inherit;\n box-shadow: inset 0 0 0 2px var(--focus-stroke-color, var(--vvd-color-on-canvas)), inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);\n inset: 0;\n}";
7
- styleInject(css_248z);
6
+ __decorate([attr, __metadata("design:type", Number)], Elevation.prototype, "dp", void 0);
7
+
8
+ __decorate([attr({
9
+ attribute: 'no-shadow',
10
+ mode: 'boolean'
11
+ }), __metadata("design:type", Boolean)], Elevation.prototype, "noShadow", void 0);
12
+
13
+ var css_248z = ":host {\n display: contents;\n}\n\n.control {\n display: contents;\n}\n.control.dp-0 {\n --_elevation-fill: var(--vvd-color-surface-0dp);\n --_elevation-shadow: var(--vvd-shadow-surface-0dp);\n}\n.control.dp-4 {\n --_elevation-fill: var(--vvd-color-surface-4dp);\n --_elevation-shadow: var(--vvd-shadow-surface-4dp);\n}\n.control.dp-8 {\n --_elevation-fill: var(--vvd-color-surface-8dp);\n --_elevation-shadow: var(--vvd-shadow-surface-8dp);\n}\n.control.dp-12 {\n --_elevation-fill: var(--vvd-color-surface-12dp);\n --_elevation-shadow: var(--vvd-shadow-surface-12dp);\n}\n.control.dp-16 {\n --_elevation-fill: var(--vvd-color-surface-16dp);\n --_elevation-shadow: var(--vvd-shadow-surface-16dp);\n}\n.control.dp-24 {\n --_elevation-fill: var(--vvd-color-surface-24dp);\n --_elevation-shadow: var(--vvd-shadow-surface-24dp);\n}\n.control:not(.dp-0, .dp-4, .dp-8, .dp-12, .dp-16, .dp-24) {\n --_elevation-fill: var(--vvd-color-surface-2dp);\n --_elevation-shadow: var(--vvd-shadow-surface-2dp);\n}\n.control ::slotted(*) {\n background: var(--_elevation-fill);\n filter: var(--_elevation-shadow);\n transition: background-color 0.15s linear, filter 0.15s linear;\n}\n.control.no-shadow ::slotted(*) {\n filter: none;\n}";
8
14
 
9
15
  let _ = t => t,
10
16
  _t;
11
- const focusTemplate = () => html(_t || (_t = _`
12
- <span class="control"></span>`));
13
17
 
14
- const VIVIDFocus = Focus.compose({
15
- baseName: 'focus',
16
- template: focusTemplate,
18
+ const getClasses = ({
19
+ dp,
20
+ noShadow
21
+ }) => classNames('control', [`dp-${dp}`, Boolean(dp)], ['no-shadow', Boolean(noShadow)]);
22
+
23
+ const elevationTemplate = () => html(_t || (_t = _`
24
+ <div class="${0}" part="base">
25
+ <slot></slot>
26
+ </div>`), getClasses);
27
+
28
+ const vividElevation = Elevation.compose({
29
+ baseName: 'elevation',
30
+ template: elevationTemplate,
17
31
  styles: css_248z
18
32
  });
19
- designSystem.register(VIVIDFocus());
33
+ designSystem.register(vividElevation());
20
34
 
21
- export { Focus as F, VIVIDFocus as V };
35
+ export { Elevation as E, vividElevation as v };