@vonage/vivid 3.0.0-next.2 → 3.0.0-next.3
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/breadcrumb/index.js +212 -0
- package/breadcrumb-item/index.js +8 -7
- package/index.js +4 -1
- package/lib/breadcrumb/breadcrumb.d.ts +3 -0
- package/lib/breadcrumb/index.d.ts +2 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +3 -3
- package/lib/components.d.ts +2 -0
- package/package.json +1 -1
- package/shared/anchor.js +1 -1
- package/shared/breadcrumb-item.js +25 -0
- package/shared/index2.js +1 -1
- package/shared/text-anchor.template.js +2 -14
- package/text-anchor/index.js +13 -3
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { O as Observable, e as emptyArray, A as AttachedBehaviorHTMLDirective, h as html, F as FoundationElement, _ as __decorate, o as observable, d as designSystem } from '../shared/index2.js';
|
|
2
|
+
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
|
+
import { B as BreadcrumbItem } from '../shared/breadcrumb-item.js';
|
|
4
|
+
import '../shared/apply-mixins.js';
|
|
5
|
+
import '../shared/anchor.js';
|
|
6
|
+
import '../shared/aria-global.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
10
|
+
* @param selector - An optional selector to restrict the filter to.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
function elements(selector) {
|
|
14
|
+
if (selector) {
|
|
15
|
+
return function (value, index, array) {
|
|
16
|
+
return value.nodeType === 1 && value.matches(selector);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return function (value, index, array) {
|
|
20
|
+
return value.nodeType === 1;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A base class for node observation.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
class NodeObservationBehavior {
|
|
28
|
+
/**
|
|
29
|
+
* Creates an instance of NodeObservationBehavior.
|
|
30
|
+
* @param target - The target to assign the nodes property on.
|
|
31
|
+
* @param options - The options to use in configuring node observation.
|
|
32
|
+
*/
|
|
33
|
+
constructor(target, options) {
|
|
34
|
+
this.target = target;
|
|
35
|
+
this.options = options;
|
|
36
|
+
this.source = null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Bind this behavior to the source.
|
|
40
|
+
* @param source - The source to bind to.
|
|
41
|
+
* @param context - The execution context that the binding is operating within.
|
|
42
|
+
*/
|
|
43
|
+
bind(source) {
|
|
44
|
+
const name = this.options.property;
|
|
45
|
+
this.shouldUpdate = Observable.getAccessors(source).some((x) => x.name === name);
|
|
46
|
+
this.source = source;
|
|
47
|
+
this.updateTarget(this.computeNodes());
|
|
48
|
+
if (this.shouldUpdate) {
|
|
49
|
+
this.observe();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Unbinds this behavior from the source.
|
|
54
|
+
* @param source - The source to unbind from.
|
|
55
|
+
*/
|
|
56
|
+
unbind() {
|
|
57
|
+
this.updateTarget(emptyArray);
|
|
58
|
+
this.source = null;
|
|
59
|
+
if (this.shouldUpdate) {
|
|
60
|
+
this.disconnect();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** @internal */
|
|
64
|
+
handleEvent() {
|
|
65
|
+
this.updateTarget(this.computeNodes());
|
|
66
|
+
}
|
|
67
|
+
computeNodes() {
|
|
68
|
+
let nodes = this.getNodes();
|
|
69
|
+
if (this.options.filter !== void 0) {
|
|
70
|
+
nodes = nodes.filter(this.options.filter);
|
|
71
|
+
}
|
|
72
|
+
return nodes;
|
|
73
|
+
}
|
|
74
|
+
updateTarget(value) {
|
|
75
|
+
this.source[this.options.property] = value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The runtime behavior for slotted node observation.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
class SlottedBehavior extends NodeObservationBehavior {
|
|
84
|
+
/**
|
|
85
|
+
* Creates an instance of SlottedBehavior.
|
|
86
|
+
* @param target - The slot element target to observe.
|
|
87
|
+
* @param options - The options to use when observing the slot.
|
|
88
|
+
*/
|
|
89
|
+
constructor(target, options) {
|
|
90
|
+
super(target, options);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Begins observation of the nodes.
|
|
94
|
+
*/
|
|
95
|
+
observe() {
|
|
96
|
+
this.target.addEventListener("slotchange", this);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Disconnects observation of the nodes.
|
|
100
|
+
*/
|
|
101
|
+
disconnect() {
|
|
102
|
+
this.target.removeEventListener("slotchange", this);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves the nodes that should be assigned to the target.
|
|
106
|
+
*/
|
|
107
|
+
getNodes() {
|
|
108
|
+
return this.target.assignedNodes(this.options);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
113
|
+
* whenever they change.
|
|
114
|
+
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
function slotted(propertyOrOptions) {
|
|
118
|
+
if (typeof propertyOrOptions === "string") {
|
|
119
|
+
propertyOrOptions = { property: propertyOrOptions };
|
|
120
|
+
}
|
|
121
|
+
return new AttachedBehaviorHTMLDirective("fast-slotted", SlottedBehavior, propertyOrOptions);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The template for the {@link @microsoft/fast-foundation#Breadcrumb} component.
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
const breadcrumbTemplate = (context, definition) => html `
|
|
129
|
+
<template role="navigation">
|
|
130
|
+
<div role="list" class="list" part="list">
|
|
131
|
+
<slot
|
|
132
|
+
${slotted({ property: "slottedBreadcrumbItems", filter: elements() })}
|
|
133
|
+
></slot>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A Breadcrumb Custom HTML Element.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
class Breadcrumb$1 extends FoundationElement {
|
|
144
|
+
slottedBreadcrumbItemsChanged() {
|
|
145
|
+
if (this.$fastController.isConnected) {
|
|
146
|
+
if (this.slottedBreadcrumbItems === undefined ||
|
|
147
|
+
this.slottedBreadcrumbItems.length === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
|
|
151
|
+
this.setItemSeparator(lastNode);
|
|
152
|
+
this.setLastItemAriaCurrent(lastNode);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
setItemSeparator(lastNode) {
|
|
156
|
+
this.slottedBreadcrumbItems.forEach((item) => {
|
|
157
|
+
if (item instanceof BreadcrumbItem) {
|
|
158
|
+
item.separator = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
if (lastNode instanceof BreadcrumbItem) {
|
|
162
|
+
lastNode.separator = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @internal
|
|
167
|
+
* Finds href on childnodes in the light DOM or shadow DOM.
|
|
168
|
+
* We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
|
|
169
|
+
*/
|
|
170
|
+
findChildWithHref(node) {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
if (node.childElementCount > 0) {
|
|
173
|
+
return node.querySelector("a[href]");
|
|
174
|
+
}
|
|
175
|
+
else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
|
|
176
|
+
return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
|
|
177
|
+
}
|
|
178
|
+
else
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* If child node with an anchor tag and with href is found then apply aria-current to child node otherwise apply aria-current to the host element, with an href
|
|
183
|
+
*/
|
|
184
|
+
setLastItemAriaCurrent(lastNode) {
|
|
185
|
+
const childNodeWithHref = this.findChildWithHref(lastNode);
|
|
186
|
+
if (childNodeWithHref === null &&
|
|
187
|
+
lastNode.hasAttribute("href") &&
|
|
188
|
+
lastNode instanceof BreadcrumbItem) {
|
|
189
|
+
lastNode.ariaCurrent = "page";
|
|
190
|
+
}
|
|
191
|
+
else if (childNodeWithHref !== null) {
|
|
192
|
+
childNodeWithHref.setAttribute("aria-current", "page");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
__decorate([
|
|
197
|
+
observable
|
|
198
|
+
], Breadcrumb$1.prototype, "slottedBreadcrumbItems", void 0);
|
|
199
|
+
|
|
200
|
+
var css_248z = ".list {\n display: flex;\n}";
|
|
201
|
+
styleInject(css_248z);
|
|
202
|
+
|
|
203
|
+
class Breadcrumb extends Breadcrumb$1 {}
|
|
204
|
+
|
|
205
|
+
const vividBreadcrumb = Breadcrumb.compose({
|
|
206
|
+
baseName: 'breadcrumb',
|
|
207
|
+
template: breadcrumbTemplate,
|
|
208
|
+
styles: css_248z
|
|
209
|
+
});
|
|
210
|
+
designSystem.register(vividBreadcrumb());
|
|
211
|
+
|
|
212
|
+
export { vividBreadcrumb };
|
package/breadcrumb-item/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { _ as __decorate,
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index2.js';
|
|
2
2
|
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
|
-
import {
|
|
3
|
+
import { B as BreadcrumbItem$1 } from '../shared/breadcrumb-item.js';
|
|
4
|
+
import { t as textAnchorTemplate } from '../shared/text-anchor.template.js';
|
|
4
5
|
import { w as when } from '../shared/index.js';
|
|
5
6
|
import { c as classNames } from '../shared/class-names.js';
|
|
6
|
-
import '../shared/web.dom-collections.iterator.js';
|
|
7
|
-
import '../shared/anchor.js';
|
|
8
7
|
import '../shared/apply-mixins.js';
|
|
8
|
+
import '../shared/anchor.js';
|
|
9
9
|
import '../shared/aria-global.js';
|
|
10
|
+
import '../shared/web.dom-collections.iterator.js';
|
|
10
11
|
|
|
11
12
|
var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.breadcrumb-item {\n font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: flex;\n align-items: center;\n color: var(--vvd-color-neutral-70);\n}\n.breadcrumb-item a {\n color: var(--vvd-color-cta-70);\n text-decoration: none;\n}\n.breadcrumb-item a:hover {\n text-decoration: underline;\n}\n.breadcrumb-item vwc-icon {\n margin: 0 16px;\n color: var(--vvd-color-on-canvas);\n}";
|
|
12
13
|
styleInject(css_248z);
|
|
13
14
|
|
|
14
|
-
class BreadcrumbItem extends
|
|
15
|
+
class BreadcrumbItem extends BreadcrumbItem$1 {
|
|
15
16
|
constructor() {
|
|
16
17
|
super();
|
|
17
|
-
this.
|
|
18
|
+
this.text = '';
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
__decorate([
|
|
23
|
+
__decorate([attr, __metadata("design:type", String)], BreadcrumbItem.prototype, "text", void 0);
|
|
23
24
|
|
|
24
25
|
let _2 = t => t,
|
|
25
26
|
_t,
|
package/index.js
CHANGED
|
@@ -5,12 +5,15 @@ export { V as VIVIDFocus } from './shared/index3.js';
|
|
|
5
5
|
export { v as vividIcon } from './shared/index.js';
|
|
6
6
|
export { VIVIDLayout } from './layout/index.js';
|
|
7
7
|
export { VIVIDElevation } from './elevation/index.js';
|
|
8
|
+
export { vividBreadcrumbItem } from './breadcrumb-item/index.js';
|
|
9
|
+
export { vividBreadcrumb } from './breadcrumb/index.js';
|
|
8
10
|
import './shared/index2.js';
|
|
9
|
-
import './shared/text-anchor.template.js';
|
|
10
11
|
import './shared/web.dom-collections.iterator.js';
|
|
11
12
|
import './shared/anchor.js';
|
|
12
13
|
import './shared/apply-mixins.js';
|
|
13
14
|
import './shared/aria-global.js';
|
|
15
|
+
import './shared/text-anchor.template.js';
|
|
14
16
|
import './shared/class-names.js';
|
|
15
17
|
import './shared/affix.js';
|
|
16
18
|
import './shared/style-inject.es.js';
|
|
19
|
+
import './shared/breadcrumb-item.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
2
|
+
export declare const vividBreadcrumb: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<FoundationElementDefinition, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class BreadcrumbItem extends
|
|
3
|
-
|
|
1
|
+
import { BreadcrumbItem as FastBreadcrumbItem } from '@microsoft/fast-foundation';
|
|
2
|
+
export declare class BreadcrumbItem extends FastBreadcrumbItem {
|
|
3
|
+
text: string;
|
|
4
4
|
constructor();
|
|
5
5
|
}
|
package/lib/components.d.ts
CHANGED
package/package.json
CHANGED
package/shared/anchor.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { _ as __decorate, o as observable } from './index2.js';
|
|
2
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
3
|
+
import { A as Anchor, D as DelegatesARIALink } from './anchor.js';
|
|
4
|
+
import { S as StartEnd } from './aria-global.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A Breadcrumb Item Custom HTML Element.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class BreadcrumbItem extends Anchor {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
this.separator = true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
observable
|
|
22
|
+
], BreadcrumbItem.prototype, "separator", void 0);
|
|
23
|
+
applyMixins(BreadcrumbItem, StartEnd, DelegatesARIALink);
|
|
24
|
+
|
|
25
|
+
export { BreadcrumbItem as B };
|
package/shared/index2.js
CHANGED
|
@@ -4908,4 +4908,4 @@ function provideVividDesignSystem(element) {
|
|
|
4908
4908
|
}
|
|
4909
4909
|
const designSystem = provideVividDesignSystem();
|
|
4910
4910
|
|
|
4911
|
-
export { AttachedBehaviorHTMLDirective as A, DOM as D, FoundationElement as F, __decorate as _, attr as a, __metadata as b, designSystem as d, emptyArray as e, html as h, observable as o };
|
|
4911
|
+
export { AttachedBehaviorHTMLDirective as A, DOM as D, FoundationElement as F, Observable as O, __decorate as _, attr as a, __metadata as b, designSystem as d, emptyArray as e, html as h, observable as o };
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import { _ as __decorate, a as attr, b as __metadata, h as html } from './index2.js';
|
|
3
|
-
import { A as Anchor } from './anchor.js';
|
|
1
|
+
import { h as html } from './index2.js';
|
|
4
2
|
import { r as ref } from './aria-global.js';
|
|
5
3
|
import { c as classNames } from './class-names.js';
|
|
6
4
|
|
|
7
|
-
class TextAnchor extends Anchor {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.text = '';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
__decorate([attr, __metadata("design:type", Object)], TextAnchor.prototype, "text", void 0);
|
|
16
|
-
|
|
17
5
|
let _2 = t => t,
|
|
18
6
|
_t;
|
|
19
7
|
|
|
@@ -56,4 +44,4 @@ const textAnchorTemplate = () => html(_t || (_t = _2`
|
|
|
56
44
|
</a>
|
|
57
45
|
`), getClasses, x => x.download, x => x.href, x => x.hreflang, x => x.ping, x => x.referrerpolicy, x => x.rel, x => x.target, x => x.type, x => x.ariaAtomic, x => x.ariaBusy, x => x.ariaControls, x => x.ariaCurrent, x => x.ariaDescribedby, x => x.ariaDetails, x => x.ariaDisabled, x => x.ariaErrormessage, x => x.ariaExpanded, x => x.ariaFlowto, x => x.ariaHaspopup, x => x.ariaHidden, x => x.ariaInvalid, x => x.ariaKeyshortcuts, x => x.ariaLabel, x => x.ariaLabelledby, x => x.ariaLive, x => x.ariaOwns, x => x.ariaRelevant, x => x.ariaRoledescription, ref('control'), x => x.text);
|
|
58
46
|
|
|
59
|
-
export {
|
|
47
|
+
export { textAnchorTemplate as t };
|
package/text-anchor/index.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { d as designSystem } from '../shared/index2.js';
|
|
2
|
-
import { T as TextAnchor, t as textAnchorTemplate } from '../shared/text-anchor.template.js';
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata, d as designSystem } from '../shared/index2.js';
|
|
3
2
|
import '../shared/web.dom-collections.iterator.js';
|
|
4
|
-
import '../shared/anchor.js';
|
|
3
|
+
import { A as Anchor } from '../shared/anchor.js';
|
|
4
|
+
import { t as textAnchorTemplate } from '../shared/text-anchor.template.js';
|
|
5
5
|
import '../shared/apply-mixins.js';
|
|
6
6
|
import '../shared/aria-global.js';
|
|
7
7
|
import '../shared/class-names.js';
|
|
8
8
|
|
|
9
|
+
class TextAnchor extends Anchor {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.text = '';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
__decorate([attr, __metadata("design:type", Object)], TextAnchor.prototype, "text", void 0);
|
|
18
|
+
|
|
9
19
|
const vividTextAnchor = TextAnchor.compose({
|
|
10
20
|
baseName: 'text-anchor',
|
|
11
21
|
template: textAnchorTemplate
|