@vonage/vivid 5.7.0 → 5.9.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.
- package/bundled/data-grid.options.cjs +1 -0
- package/bundled/data-grid.options.js +29 -0
- package/bundled/definition19.cjs +3 -4
- package/bundled/definition19.js +35 -52
- package/bundled/definition2.cjs +1 -1
- package/bundled/definition2.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -1
- package/bundled/definition9.cjs +9 -9
- package/bundled/definition9.js +113 -1342
- package/bundled/feature.cjs +4 -0
- package/bundled/feature.js +2886 -0
- package/bundled/floating-ui.dom.cjs +1 -0
- package/bundled/floating-ui.dom.js +1242 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +49 -22
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +15 -13
- package/bundled/vivid-element.cjs +3 -3
- package/bundled/vivid-element.js +89 -69
- package/checkbox/definition.cjs +1 -1
- package/checkbox/definition.js +1 -1
- package/combobox/definition.cjs +14 -15
- package/combobox/definition.js +15 -16
- package/combobox/index.cjs +4 -4
- package/combobox/index.js +82 -87
- package/contextual-help/definition.cjs +1 -0
- package/contextual-help/definition.js +1 -1
- package/custom-elements.json +5145 -3781
- package/data-grid/definition.cjs +23 -49
- package/data-grid/definition.js +1 -27
- package/data-grid/index.cjs +27 -27
- package/data-grid/index.js +44 -64
- package/data-table/definition.cjs +204 -0
- package/data-table/definition.js +188 -0
- package/data-table/index.cjs +37 -0
- package/data-table/index.js +143 -0
- package/file-picker/definition.cjs +10 -8
- package/file-picker/definition.js +10 -8
- package/file-picker/index.cjs +5 -5
- package/file-picker/index.js +12 -12
- package/icon/definition.cjs +1 -1
- package/icon/definition.js +1 -1
- package/index.cjs +26 -0
- package/index.js +4 -0
- package/lib/components.d.ts +4 -0
- package/lib/contextual-help/definition.d.ts +2 -0
- package/lib/data-table/definition.d.ts +8 -0
- package/lib/data-table/table-body.d.ts +3 -0
- package/lib/data-table/table-body.template.d.ts +3 -0
- package/lib/data-table/table-cell.d.ts +381 -0
- package/lib/data-table/table-cell.template.d.ts +3 -0
- package/lib/data-table/table-head.d.ts +3 -0
- package/lib/data-table/table-head.template.d.ts +3 -0
- package/lib/data-table/table-header-cell.d.ts +381 -0
- package/lib/data-table/table-header-cell.template.d.ts +3 -0
- package/lib/data-table/table-row.d.ts +381 -0
- package/lib/data-table/table-row.template.d.ts +3 -0
- package/lib/data-table/table.d.ts +3 -0
- package/lib/data-table/table.template.d.ts +3 -0
- package/lib/popover/definition.d.ts +4 -0
- package/lib/popover/locale.d.ts +3 -0
- package/lib/popover/popover.d.ts +781 -0
- package/lib/popover/popover.template.d.ts +3 -0
- package/lib/rich-text-editor/locale.d.ts +0 -1
- package/lib/rich-text-editor/rte/config.d.ts +3 -0
- package/lib/rich-text-editor/rte/document.d.ts +2 -0
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/view.d.ts +30 -0
- package/lib/rich-text-view/definition.d.ts +4 -0
- package/lib/rich-text-view/rich-text-view.d.ts +15 -0
- package/lib/rich-text-view/rich-text-view.template.d.ts +3 -0
- package/lib/tag-name-map.d.ts +10 -1
- package/locales/de-DE.cjs +3 -1
- package/locales/de-DE.js +3 -1
- package/locales/en-GB.cjs +3 -1
- package/locales/en-GB.js +3 -1
- package/locales/en-US.cjs +3 -1
- package/locales/en-US.js +3 -1
- package/locales/ja-JP.cjs +3 -1
- package/locales/ja-JP.js +3 -1
- package/locales/zh-CN.cjs +3 -1
- package/locales/zh-CN.js +3 -1
- package/package.json +8 -12
- package/popover/definition.cjs +363 -0
- package/popover/definition.js +357 -0
- package/popover/index.cjs +27 -0
- package/popover/index.js +263 -0
- package/rich-text-editor/definition.cjs +328 -3882
- package/rich-text-editor/definition.js +143 -3697
- package/rich-text-editor/index.cjs +12 -15
- package/rich-text-editor/index.js +3489 -6291
- package/rich-text-view/definition.cjs +159 -0
- package/rich-text-view/definition.js +153 -0
- package/rich-text-view/index.cjs +1 -0
- package/rich-text-view/index.js +95 -0
- package/select/definition.cjs +27 -15
- package/select/definition.js +27 -15
- package/shared/foundation/listbox/listbox.d.ts +0 -1
- package/shared/localization/Locale.d.ts +2 -0
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/unbundled/_commonjsHelpers.cjs +26 -0
- package/unbundled/_commonjsHelpers.js +26 -1
- package/unbundled/data-grid.options.cjs +34 -0
- package/unbundled/data-grid.options.js +28 -0
- package/unbundled/definition.cjs +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/feature.cjs +3678 -0
- package/unbundled/feature.js +3662 -0
- package/unbundled/listbox.cjs +29 -2
- package/unbundled/listbox.js +29 -2
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +11 -1
- package/video-player/definition.js +12 -2
- package/video-player/index.cjs +30 -30
- package/video-player/index.js +705 -702
- package/vivid.api.json +1478 -39
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
6
|
+
const fastElement = require('@microsoft/fast-element');
|
|
7
|
+
const feature = require('../unbundled/feature.cjs');
|
|
8
|
+
|
|
9
|
+
const styles = ":host{display:contents}.content{display:contents}";
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = void 0 ;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (decorator(target, key, result) ) || result;
|
|
17
|
+
if (result) __defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
class RichTextView extends vividElement.VividElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this._slotCounter = 0;
|
|
24
|
+
this._slottedChildren = /* @__PURE__ */ new Set();
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
this._contentElement = null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
viewChanged(oldView, newView) {
|
|
34
|
+
if (oldView) {
|
|
35
|
+
this._removeStyles();
|
|
36
|
+
}
|
|
37
|
+
if (newView) {
|
|
38
|
+
this._addStyles(newView);
|
|
39
|
+
}
|
|
40
|
+
this._updateView();
|
|
41
|
+
}
|
|
42
|
+
_addStyles(view) {
|
|
43
|
+
const config = view[feature.impl].config[feature.impl];
|
|
44
|
+
this._styles = new fastElement.ElementStyles(
|
|
45
|
+
feature.sortedContributions(config.features.flatMap((f) => f.getStyles()))
|
|
46
|
+
);
|
|
47
|
+
this._styles.addStylesTo(this.shadowRoot);
|
|
48
|
+
}
|
|
49
|
+
_removeStyles() {
|
|
50
|
+
if (this._styles) {
|
|
51
|
+
this._styles.removeStylesFrom(this.shadowRoot);
|
|
52
|
+
this._styles = void 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
_cleanupLightDom() {
|
|
56
|
+
for (const el of this._slottedChildren) {
|
|
57
|
+
this.removeChild(el);
|
|
58
|
+
}
|
|
59
|
+
this._slottedChildren.clear();
|
|
60
|
+
this._slotCounter = 0;
|
|
61
|
+
}
|
|
62
|
+
_updateView() {
|
|
63
|
+
if (!this._contentElement) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this._contentElement.innerHTML = "";
|
|
67
|
+
this._cleanupLightDom();
|
|
68
|
+
if (this.view) {
|
|
69
|
+
this._contentElement.appendChild(this._renderView(this.view));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_renderView(rteView) {
|
|
73
|
+
const ctx = rteView[feature.impl];
|
|
74
|
+
if (rteView.type === "node" && rteView.node.type === "doc") {
|
|
75
|
+
rteView = rteView.children;
|
|
76
|
+
}
|
|
77
|
+
if (rteView.type === "fragment") {
|
|
78
|
+
const frag = document.createDocumentFragment();
|
|
79
|
+
for (const child of rteView.content) {
|
|
80
|
+
frag.appendChild(this._renderView(child));
|
|
81
|
+
}
|
|
82
|
+
return frag;
|
|
83
|
+
}
|
|
84
|
+
const customRenderedView = ctx.options.renderChildView?.(rteView) ?? false;
|
|
85
|
+
if (customRenderedView) {
|
|
86
|
+
return this._handleCustomRender(rteView, customRenderedView);
|
|
87
|
+
} else {
|
|
88
|
+
return this._renderDefault(rteView);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
_handleCustomRender(rteView, customResult) {
|
|
92
|
+
const { dom, contentDom = dom } = customResult;
|
|
93
|
+
const slotName = `view-${this._slotCounter++}`;
|
|
94
|
+
const slot = document.createElement("slot");
|
|
95
|
+
slot.setAttribute("name", slotName);
|
|
96
|
+
const nestedView = document.createElement(this.tagName);
|
|
97
|
+
nestedView.view = rteView.children;
|
|
98
|
+
contentDom.appendChild(nestedView);
|
|
99
|
+
dom.setAttribute("slot", slotName);
|
|
100
|
+
this.appendChild(dom);
|
|
101
|
+
this._slottedChildren.add(dom);
|
|
102
|
+
return slot;
|
|
103
|
+
}
|
|
104
|
+
_renderDefault(view) {
|
|
105
|
+
const ctx = view[feature.impl];
|
|
106
|
+
const config = ctx.config[feature.impl];
|
|
107
|
+
const schema = config.schema;
|
|
108
|
+
if (view.type === "node" && view.node.type === "text") {
|
|
109
|
+
return document.createTextNode(view.node.text);
|
|
110
|
+
}
|
|
111
|
+
const item = view.type === "node" ? view.node : view.mark;
|
|
112
|
+
const pmItem = view.type === "node" ? feature.Node.fromJSON(schema, item) : feature.Mark.fromJSON(schema, item);
|
|
113
|
+
const spec = pmItem instanceof feature.Node ? pmItem.type.spec.toDOM(pmItem) : pmItem.type.spec.toDOM(pmItem, true);
|
|
114
|
+
const { dom, contentDOM = dom } = feature.DOMSerializer.renderSpec(document, spec);
|
|
115
|
+
const childrenRendered = this._renderView(view.children);
|
|
116
|
+
contentDOM.appendChild(childrenRendered);
|
|
117
|
+
return dom;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
connectedCallback() {
|
|
123
|
+
super.connectedCallback();
|
|
124
|
+
this._updateView();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
disconnectedCallback() {
|
|
130
|
+
super.disconnectedCallback();
|
|
131
|
+
this._removeStyles();
|
|
132
|
+
this._cleanupLightDom();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
__decorateClass([
|
|
136
|
+
fastElement.observable
|
|
137
|
+
], RichTextView.prototype, "view");
|
|
138
|
+
|
|
139
|
+
const RichTextViewTemplate = () => fastElement.html`<div class="content rich-text" ${fastElement.ref("_contentElement")}></div>`;
|
|
140
|
+
|
|
141
|
+
const richTextViewDefinition = vividElement.defineVividComponent(
|
|
142
|
+
"rich-text-view",
|
|
143
|
+
RichTextView,
|
|
144
|
+
RichTextViewTemplate,
|
|
145
|
+
[],
|
|
146
|
+
{
|
|
147
|
+
styles,
|
|
148
|
+
shadowOptions: {
|
|
149
|
+
delegatesFocus: true
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
const registerRichTextView = vividElement.createRegisterFunction(
|
|
154
|
+
richTextViewDefinition
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
exports.VwcRichTextViewElement = RichTextView;
|
|
158
|
+
exports.registerRichTextView = registerRichTextView;
|
|
159
|
+
exports.richTextViewDefinition = richTextViewDefinition;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
|
+
import { ElementStyles, observable, ref, html } from '@microsoft/fast-element';
|
|
3
|
+
import { i as impl, s as sortedContributions, N as Node, M as Mark, D as DOMSerializer } from '../unbundled/feature.js';
|
|
4
|
+
|
|
5
|
+
const styles = ":host{display:contents}.content{display:contents}";
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class RichTextView extends VividElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this._slotCounter = 0;
|
|
20
|
+
this._slottedChildren = /* @__PURE__ */ new Set();
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
this._contentElement = null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
viewChanged(oldView, newView) {
|
|
30
|
+
if (oldView) {
|
|
31
|
+
this._removeStyles();
|
|
32
|
+
}
|
|
33
|
+
if (newView) {
|
|
34
|
+
this._addStyles(newView);
|
|
35
|
+
}
|
|
36
|
+
this._updateView();
|
|
37
|
+
}
|
|
38
|
+
_addStyles(view) {
|
|
39
|
+
const config = view[impl].config[impl];
|
|
40
|
+
this._styles = new ElementStyles(
|
|
41
|
+
sortedContributions(config.features.flatMap((f) => f.getStyles()))
|
|
42
|
+
);
|
|
43
|
+
this._styles.addStylesTo(this.shadowRoot);
|
|
44
|
+
}
|
|
45
|
+
_removeStyles() {
|
|
46
|
+
if (this._styles) {
|
|
47
|
+
this._styles.removeStylesFrom(this.shadowRoot);
|
|
48
|
+
this._styles = void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_cleanupLightDom() {
|
|
52
|
+
for (const el of this._slottedChildren) {
|
|
53
|
+
this.removeChild(el);
|
|
54
|
+
}
|
|
55
|
+
this._slottedChildren.clear();
|
|
56
|
+
this._slotCounter = 0;
|
|
57
|
+
}
|
|
58
|
+
_updateView() {
|
|
59
|
+
if (!this._contentElement) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this._contentElement.innerHTML = "";
|
|
63
|
+
this._cleanupLightDom();
|
|
64
|
+
if (this.view) {
|
|
65
|
+
this._contentElement.appendChild(this._renderView(this.view));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
_renderView(rteView) {
|
|
69
|
+
const ctx = rteView[impl];
|
|
70
|
+
if (rteView.type === "node" && rteView.node.type === "doc") {
|
|
71
|
+
rteView = rteView.children;
|
|
72
|
+
}
|
|
73
|
+
if (rteView.type === "fragment") {
|
|
74
|
+
const frag = document.createDocumentFragment();
|
|
75
|
+
for (const child of rteView.content) {
|
|
76
|
+
frag.appendChild(this._renderView(child));
|
|
77
|
+
}
|
|
78
|
+
return frag;
|
|
79
|
+
}
|
|
80
|
+
const customRenderedView = ctx.options.renderChildView?.(rteView) ?? false;
|
|
81
|
+
if (customRenderedView) {
|
|
82
|
+
return this._handleCustomRender(rteView, customRenderedView);
|
|
83
|
+
} else {
|
|
84
|
+
return this._renderDefault(rteView);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
_handleCustomRender(rteView, customResult) {
|
|
88
|
+
const { dom, contentDom = dom } = customResult;
|
|
89
|
+
const slotName = `view-${this._slotCounter++}`;
|
|
90
|
+
const slot = document.createElement("slot");
|
|
91
|
+
slot.setAttribute("name", slotName);
|
|
92
|
+
const nestedView = document.createElement(this.tagName);
|
|
93
|
+
nestedView.view = rteView.children;
|
|
94
|
+
contentDom.appendChild(nestedView);
|
|
95
|
+
dom.setAttribute("slot", slotName);
|
|
96
|
+
this.appendChild(dom);
|
|
97
|
+
this._slottedChildren.add(dom);
|
|
98
|
+
return slot;
|
|
99
|
+
}
|
|
100
|
+
_renderDefault(view) {
|
|
101
|
+
const ctx = view[impl];
|
|
102
|
+
const config = ctx.config[impl];
|
|
103
|
+
const schema = config.schema;
|
|
104
|
+
if (view.type === "node" && view.node.type === "text") {
|
|
105
|
+
return document.createTextNode(view.node.text);
|
|
106
|
+
}
|
|
107
|
+
const item = view.type === "node" ? view.node : view.mark;
|
|
108
|
+
const pmItem = view.type === "node" ? Node.fromJSON(schema, item) : Mark.fromJSON(schema, item);
|
|
109
|
+
const spec = pmItem instanceof Node ? pmItem.type.spec.toDOM(pmItem) : pmItem.type.spec.toDOM(pmItem, true);
|
|
110
|
+
const { dom, contentDOM = dom } = DOMSerializer.renderSpec(document, spec);
|
|
111
|
+
const childrenRendered = this._renderView(view.children);
|
|
112
|
+
contentDOM.appendChild(childrenRendered);
|
|
113
|
+
return dom;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
connectedCallback() {
|
|
119
|
+
super.connectedCallback();
|
|
120
|
+
this._updateView();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
super.disconnectedCallback();
|
|
127
|
+
this._removeStyles();
|
|
128
|
+
this._cleanupLightDom();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
__decorateClass([
|
|
132
|
+
observable
|
|
133
|
+
], RichTextView.prototype, "view");
|
|
134
|
+
|
|
135
|
+
const RichTextViewTemplate = () => html`<div class="content rich-text" ${ref("_contentElement")}></div>`;
|
|
136
|
+
|
|
137
|
+
const richTextViewDefinition = defineVividComponent(
|
|
138
|
+
"rich-text-view",
|
|
139
|
+
RichTextView,
|
|
140
|
+
RichTextViewTemplate,
|
|
141
|
+
[],
|
|
142
|
+
{
|
|
143
|
+
styles,
|
|
144
|
+
shadowOptions: {
|
|
145
|
+
delegatesFocus: true
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
const registerRichTextView = createRegisterFunction(
|
|
150
|
+
richTextViewDefinition
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
export { RichTextView as VwcRichTextViewElement, registerRichTextView, richTextViewDefinition };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../bundled/vivid-element.cjs"),r=require("../bundled/feature.cjs"),_=require("../bundled/ref.cjs"),f=":host{display:contents}.content{display:contents}";var y=Object.defineProperty,C=(l,e,n,s)=>{for(var t=void 0,o=l.length-1,i;o>=0;o--)(i=l[o])&&(t=i(e,n,t)||t);return t&&y(e,n,t),t};class h extends c.VividElement{constructor(){super(...arguments),this._slotCounter=0,this._slottedChildren=new Set,this._contentElement=null}viewChanged(e,n){e&&this._removeStyles(),n&&this._addStyles(n),this._updateView()}_addStyles(e){const n=e[r.impl].config[r.impl];this._styles=new c.ElementStyles(r.sortedContributions(n.features.flatMap(s=>s.getStyles()))),this._styles.addStylesTo(this.shadowRoot)}_removeStyles(){this._styles&&(this._styles.removeStylesFrom(this.shadowRoot),this._styles=void 0)}_cleanupLightDom(){for(const e of this._slottedChildren)this.removeChild(e);this._slottedChildren.clear(),this._slotCounter=0}_updateView(){this._contentElement&&(this._contentElement.innerHTML="",this._cleanupLightDom(),this.view&&this._contentElement.appendChild(this._renderView(this.view)))}_renderView(e){const n=e[r.impl];if(e.type==="node"&&e.node.type==="doc"&&(e=e.children),e.type==="fragment"){const t=document.createDocumentFragment();for(const o of e.content)t.appendChild(this._renderView(o));return t}const s=n.options.renderChildView?.(e)??!1;return s?this._handleCustomRender(e,s):this._renderDefault(e)}_handleCustomRender(e,n){const{dom:s,contentDom:t=s}=n,o=`view-${this._slotCounter++}`,i=document.createElement("slot");i.setAttribute("name",o);const d=document.createElement(this.tagName);return d.view=e.children,t.appendChild(d),s.setAttribute("slot",o),this.appendChild(s),this._slottedChildren.add(s),i}_renderDefault(e){const t=e[r.impl].config[r.impl].schema;if(e.type==="node"&&e.node.type==="text")return document.createTextNode(e.node.text);const o=e.type==="node"?e.node:e.mark,i=e.type==="node"?r.Node.fromJSON(t,o):r.Mark.fromJSON(t,o),d=i instanceof r.Node?i.type.spec.toDOM(i):i.type.spec.toDOM(i,!0),{dom:a,contentDOM:p=a}=r.DOMSerializer.renderSpec(document,d),u=this._renderView(e.children);return p.appendChild(u),a}connectedCallback(){super.connectedCallback(),this._updateView()}disconnectedCallback(){super.disconnectedCallback(),this._removeStyles(),this._cleanupLightDom()}}C([c.observable],h.prototype,"view");const g=()=>c.html`<div class="content rich-text" ${_.ref("_contentElement")}></div>`,v=c.defineVividComponent("rich-text-view",h,g,[],{styles:f,shadowOptions:{delegatesFocus:!0}}),m=c.createRegisterFunction(v);m();exports.RichTextView=h;exports.registerRichTextView=m;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { V as u, w as _, o as f, h as y, c as C, d as g } from "../bundled/vivid-element.js";
|
|
2
|
+
import { i as r, s as v, N as a, M as x, D as S } from "../bundled/feature.js";
|
|
3
|
+
import { r as D } from "../bundled/ref.js";
|
|
4
|
+
const b = ":host{display:contents}.content{display:contents}";
|
|
5
|
+
var R = Object.defineProperty, E = (d, e, n, s) => {
|
|
6
|
+
for (var t = void 0, o = d.length - 1, i; o >= 0; o--)
|
|
7
|
+
(i = d[o]) && (t = i(e, n, t) || t);
|
|
8
|
+
return t && R(e, n, t), t;
|
|
9
|
+
};
|
|
10
|
+
class h extends u {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this._slotCounter = 0, this._slottedChildren = /* @__PURE__ */ new Set(), this._contentElement = null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
viewChanged(e, n) {
|
|
18
|
+
e && this._removeStyles(), n && this._addStyles(n), this._updateView();
|
|
19
|
+
}
|
|
20
|
+
_addStyles(e) {
|
|
21
|
+
const n = e[r].config[r];
|
|
22
|
+
this._styles = new _(
|
|
23
|
+
v(n.features.flatMap((s) => s.getStyles()))
|
|
24
|
+
), this._styles.addStylesTo(this.shadowRoot);
|
|
25
|
+
}
|
|
26
|
+
_removeStyles() {
|
|
27
|
+
this._styles && (this._styles.removeStylesFrom(this.shadowRoot), this._styles = void 0);
|
|
28
|
+
}
|
|
29
|
+
_cleanupLightDom() {
|
|
30
|
+
for (const e of this._slottedChildren)
|
|
31
|
+
this.removeChild(e);
|
|
32
|
+
this._slottedChildren.clear(), this._slotCounter = 0;
|
|
33
|
+
}
|
|
34
|
+
_updateView() {
|
|
35
|
+
this._contentElement && (this._contentElement.innerHTML = "", this._cleanupLightDom(), this.view && this._contentElement.appendChild(this._renderView(this.view)));
|
|
36
|
+
}
|
|
37
|
+
_renderView(e) {
|
|
38
|
+
const n = e[r];
|
|
39
|
+
if (e.type === "node" && e.node.type === "doc" && (e = e.children), e.type === "fragment") {
|
|
40
|
+
const t = document.createDocumentFragment();
|
|
41
|
+
for (const o of e.content)
|
|
42
|
+
t.appendChild(this._renderView(o));
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
const s = n.options.renderChildView?.(e) ?? !1;
|
|
46
|
+
return s ? this._handleCustomRender(e, s) : this._renderDefault(e);
|
|
47
|
+
}
|
|
48
|
+
_handleCustomRender(e, n) {
|
|
49
|
+
const { dom: s, contentDom: t = s } = n, o = `view-${this._slotCounter++}`, i = document.createElement("slot");
|
|
50
|
+
i.setAttribute("name", o);
|
|
51
|
+
const c = document.createElement(this.tagName);
|
|
52
|
+
return c.view = e.children, t.appendChild(c), s.setAttribute("slot", o), this.appendChild(s), this._slottedChildren.add(s), i;
|
|
53
|
+
}
|
|
54
|
+
_renderDefault(e) {
|
|
55
|
+
const t = e[r].config[r].schema;
|
|
56
|
+
if (e.type === "node" && e.node.type === "text")
|
|
57
|
+
return document.createTextNode(e.node.text);
|
|
58
|
+
const o = e.type === "node" ? e.node : e.mark, i = e.type === "node" ? a.fromJSON(t, o) : x.fromJSON(t, o), c = i instanceof a ? i.type.spec.toDOM(i) : i.type.spec.toDOM(i, !0), { dom: l, contentDOM: m = l } = S.renderSpec(document, c), p = this._renderView(e.children);
|
|
59
|
+
return m.appendChild(p), l;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
super.connectedCallback(), this._updateView();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
super.disconnectedCallback(), this._removeStyles(), this._cleanupLightDom();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
E([
|
|
75
|
+
f
|
|
76
|
+
], h.prototype, "view");
|
|
77
|
+
const w = () => y`<div class="content rich-text" ${D("_contentElement")}></div>`, M = g(
|
|
78
|
+
"rich-text-view",
|
|
79
|
+
h,
|
|
80
|
+
w,
|
|
81
|
+
[],
|
|
82
|
+
{
|
|
83
|
+
styles: b,
|
|
84
|
+
shadowOptions: {
|
|
85
|
+
delegatesFocus: !0
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
), O = C(
|
|
89
|
+
M
|
|
90
|
+
);
|
|
91
|
+
O();
|
|
92
|
+
export {
|
|
93
|
+
h as RichTextView,
|
|
94
|
+
O as registerRichTextView
|
|
95
|
+
};
|
package/select/definition.cjs
CHANGED
|
@@ -124,18 +124,21 @@ class Select extends mixins.WithLightDOMFeedback(
|
|
|
124
124
|
* @internal
|
|
125
125
|
*/
|
|
126
126
|
checkFirstOption(preserveChecked) {
|
|
127
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
128
|
+
if (firstSelectableIndex === -1) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
127
131
|
if (preserveChecked) {
|
|
128
|
-
/* v8 ignore else -- @preserve */
|
|
129
132
|
if (this.rangeStartIndex === -1) {
|
|
130
|
-
this.rangeStartIndex = this.activeIndex
|
|
133
|
+
this.rangeStartIndex = this.activeIndex;
|
|
131
134
|
}
|
|
132
135
|
this.options.forEach((o, i) => {
|
|
133
|
-
o.checked = fastWebUtilities.inRange(i, this.rangeStartIndex);
|
|
136
|
+
o.checked = fastWebUtilities.inRange(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
134
137
|
});
|
|
135
138
|
} else {
|
|
136
139
|
this.uncheckAllOptions();
|
|
137
140
|
}
|
|
138
|
-
this.activeIndex =
|
|
141
|
+
this.activeIndex = firstSelectableIndex;
|
|
139
142
|
this.checkActiveIndex();
|
|
140
143
|
}
|
|
141
144
|
/**
|
|
@@ -149,18 +152,23 @@ class Select extends mixins.WithLightDOMFeedback(
|
|
|
149
152
|
* @internal
|
|
150
153
|
*/
|
|
151
154
|
checkLastOption(preserveChecked) {
|
|
155
|
+
const lastSelectableIndex = this.getPreviousSelectableIndex(
|
|
156
|
+
this.length - 1
|
|
157
|
+
);
|
|
158
|
+
if (lastSelectableIndex === -1) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
152
161
|
if (preserveChecked) {
|
|
153
|
-
/* v8 ignore else -- @preserve */
|
|
154
162
|
if (this.rangeStartIndex === -1) {
|
|
155
163
|
this.rangeStartIndex = this.activeIndex;
|
|
156
164
|
}
|
|
157
165
|
this.options.forEach((o, i) => {
|
|
158
|
-
o.checked = fastWebUtilities.inRange(i, this.rangeStartIndex,
|
|
166
|
+
o.checked = fastWebUtilities.inRange(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
|
|
159
167
|
});
|
|
160
168
|
} else {
|
|
161
169
|
this.uncheckAllOptions();
|
|
162
170
|
}
|
|
163
|
-
this.activeIndex =
|
|
171
|
+
this.activeIndex = lastSelectableIndex;
|
|
164
172
|
this.checkActiveIndex();
|
|
165
173
|
}
|
|
166
174
|
/**
|
|
@@ -174,18 +182,21 @@ class Select extends mixins.WithLightDOMFeedback(
|
|
|
174
182
|
* @internal
|
|
175
183
|
*/
|
|
176
184
|
checkNextOption(preserveChecked) {
|
|
185
|
+
const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
|
|
186
|
+
if (nextIndex === -1) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
177
189
|
if (preserveChecked) {
|
|
178
|
-
/* v8 ignore else -- @preserve */
|
|
179
190
|
if (this.rangeStartIndex === -1) {
|
|
180
191
|
this.rangeStartIndex = this.activeIndex;
|
|
181
192
|
}
|
|
182
193
|
this.options.forEach((o, i) => {
|
|
183
|
-
o.checked = fastWebUtilities.inRange(i, this.rangeStartIndex,
|
|
194
|
+
o.checked = fastWebUtilities.inRange(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
|
|
184
195
|
});
|
|
185
196
|
} else {
|
|
186
197
|
this.uncheckAllOptions();
|
|
187
198
|
}
|
|
188
|
-
this.activeIndex
|
|
199
|
+
this.activeIndex = nextIndex;
|
|
189
200
|
this.checkActiveIndex();
|
|
190
201
|
}
|
|
191
202
|
/**
|
|
@@ -199,22 +210,24 @@ class Select extends mixins.WithLightDOMFeedback(
|
|
|
199
210
|
* @internal
|
|
200
211
|
*/
|
|
201
212
|
checkPreviousOption(preserveChecked) {
|
|
213
|
+
const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
|
|
214
|
+
if (previousIndex === -1) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
202
217
|
if (preserveChecked) {
|
|
203
|
-
/* v8 ignore else -- @preserve */
|
|
204
218
|
if (this.rangeStartIndex === -1) {
|
|
205
219
|
this.rangeStartIndex = this.activeIndex;
|
|
206
220
|
}
|
|
207
|
-
/* v8 ignore else -- @preserve */
|
|
208
221
|
if (this.checkedOptions.length === 1) {
|
|
209
222
|
this.rangeStartIndex += 1;
|
|
210
223
|
}
|
|
211
224
|
this.options.forEach((o, i) => {
|
|
212
|
-
o.checked = fastWebUtilities.inRange(i,
|
|
225
|
+
o.checked = fastWebUtilities.inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
213
226
|
});
|
|
214
227
|
} else {
|
|
215
228
|
this.uncheckAllOptions();
|
|
216
229
|
}
|
|
217
|
-
this.activeIndex
|
|
230
|
+
this.activeIndex = previousIndex;
|
|
218
231
|
this.checkActiveIndex();
|
|
219
232
|
}
|
|
220
233
|
/**
|
|
@@ -847,7 +860,6 @@ function ifNotFromFeedback(handler) {
|
|
|
847
860
|
const SelectTemplate = (context) => {
|
|
848
861
|
return fastElement.html`
|
|
849
862
|
<template
|
|
850
|
-
class="base"
|
|
851
863
|
${hostSemantics.applyHostSemantics({
|
|
852
864
|
role: "combobox",
|
|
853
865
|
ariaLabel: (x) => x.ariaLabel ?? x.label,
|
package/select/definition.js
CHANGED
|
@@ -120,18 +120,21 @@ class Select extends WithLightDOMFeedback(
|
|
|
120
120
|
* @internal
|
|
121
121
|
*/
|
|
122
122
|
checkFirstOption(preserveChecked) {
|
|
123
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
124
|
+
if (firstSelectableIndex === -1) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
123
127
|
if (preserveChecked) {
|
|
124
|
-
/* v8 ignore else -- @preserve */
|
|
125
128
|
if (this.rangeStartIndex === -1) {
|
|
126
|
-
this.rangeStartIndex = this.activeIndex
|
|
129
|
+
this.rangeStartIndex = this.activeIndex;
|
|
127
130
|
}
|
|
128
131
|
this.options.forEach((o, i) => {
|
|
129
|
-
o.checked = inRange(i, this.rangeStartIndex);
|
|
132
|
+
o.checked = inRange(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
130
133
|
});
|
|
131
134
|
} else {
|
|
132
135
|
this.uncheckAllOptions();
|
|
133
136
|
}
|
|
134
|
-
this.activeIndex =
|
|
137
|
+
this.activeIndex = firstSelectableIndex;
|
|
135
138
|
this.checkActiveIndex();
|
|
136
139
|
}
|
|
137
140
|
/**
|
|
@@ -145,18 +148,23 @@ class Select extends WithLightDOMFeedback(
|
|
|
145
148
|
* @internal
|
|
146
149
|
*/
|
|
147
150
|
checkLastOption(preserveChecked) {
|
|
151
|
+
const lastSelectableIndex = this.getPreviousSelectableIndex(
|
|
152
|
+
this.length - 1
|
|
153
|
+
);
|
|
154
|
+
if (lastSelectableIndex === -1) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
148
157
|
if (preserveChecked) {
|
|
149
|
-
/* v8 ignore else -- @preserve */
|
|
150
158
|
if (this.rangeStartIndex === -1) {
|
|
151
159
|
this.rangeStartIndex = this.activeIndex;
|
|
152
160
|
}
|
|
153
161
|
this.options.forEach((o, i) => {
|
|
154
|
-
o.checked = inRange(i, this.rangeStartIndex,
|
|
162
|
+
o.checked = inRange(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
|
|
155
163
|
});
|
|
156
164
|
} else {
|
|
157
165
|
this.uncheckAllOptions();
|
|
158
166
|
}
|
|
159
|
-
this.activeIndex =
|
|
167
|
+
this.activeIndex = lastSelectableIndex;
|
|
160
168
|
this.checkActiveIndex();
|
|
161
169
|
}
|
|
162
170
|
/**
|
|
@@ -170,18 +178,21 @@ class Select extends WithLightDOMFeedback(
|
|
|
170
178
|
* @internal
|
|
171
179
|
*/
|
|
172
180
|
checkNextOption(preserveChecked) {
|
|
181
|
+
const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
|
|
182
|
+
if (nextIndex === -1) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
173
185
|
if (preserveChecked) {
|
|
174
|
-
/* v8 ignore else -- @preserve */
|
|
175
186
|
if (this.rangeStartIndex === -1) {
|
|
176
187
|
this.rangeStartIndex = this.activeIndex;
|
|
177
188
|
}
|
|
178
189
|
this.options.forEach((o, i) => {
|
|
179
|
-
o.checked = inRange(i, this.rangeStartIndex,
|
|
190
|
+
o.checked = inRange(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
|
|
180
191
|
});
|
|
181
192
|
} else {
|
|
182
193
|
this.uncheckAllOptions();
|
|
183
194
|
}
|
|
184
|
-
this.activeIndex
|
|
195
|
+
this.activeIndex = nextIndex;
|
|
185
196
|
this.checkActiveIndex();
|
|
186
197
|
}
|
|
187
198
|
/**
|
|
@@ -195,22 +206,24 @@ class Select extends WithLightDOMFeedback(
|
|
|
195
206
|
* @internal
|
|
196
207
|
*/
|
|
197
208
|
checkPreviousOption(preserveChecked) {
|
|
209
|
+
const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
|
|
210
|
+
if (previousIndex === -1) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
198
213
|
if (preserveChecked) {
|
|
199
|
-
/* v8 ignore else -- @preserve */
|
|
200
214
|
if (this.rangeStartIndex === -1) {
|
|
201
215
|
this.rangeStartIndex = this.activeIndex;
|
|
202
216
|
}
|
|
203
|
-
/* v8 ignore else -- @preserve */
|
|
204
217
|
if (this.checkedOptions.length === 1) {
|
|
205
218
|
this.rangeStartIndex += 1;
|
|
206
219
|
}
|
|
207
220
|
this.options.forEach((o, i) => {
|
|
208
|
-
o.checked = inRange(i,
|
|
221
|
+
o.checked = inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
209
222
|
});
|
|
210
223
|
} else {
|
|
211
224
|
this.uncheckAllOptions();
|
|
212
225
|
}
|
|
213
|
-
this.activeIndex
|
|
226
|
+
this.activeIndex = previousIndex;
|
|
214
227
|
this.checkActiveIndex();
|
|
215
228
|
}
|
|
216
229
|
/**
|
|
@@ -843,7 +856,6 @@ function ifNotFromFeedback(handler) {
|
|
|
843
856
|
const SelectTemplate = (context) => {
|
|
844
857
|
return html`
|
|
845
858
|
<template
|
|
846
|
-
class="base"
|
|
847
859
|
${applyHostSemantics({
|
|
848
860
|
role: "combobox",
|
|
849
861
|
ariaLabel: (x) => x.ariaLabel ?? x.label,
|
|
@@ -8,7 +8,6 @@ export declare class Listbox extends VividElement {
|
|
|
8
8
|
selectedIndex: number;
|
|
9
9
|
selectedOptions: ListboxOption[];
|
|
10
10
|
static slottedOptionFilter: (n: HTMLElement) => boolean;
|
|
11
|
-
protected getNextSelectableIndex(fromIndex: number): number;
|
|
12
11
|
protected _validSelectedIndex(index: number): number;
|
|
13
12
|
selectFirstOption(): void;
|
|
14
13
|
protected _newDefaultSelectedIndex(prev: ListboxOption[], next: ListboxOption[], currentSelectedIndex: number): number | null;
|
|
@@ -26,6 +26,7 @@ import type { ToggletipLocale } from '../../lib/toggletip/locale';
|
|
|
26
26
|
import type { SimpleColorPickerLocale } from '../../lib/simple-color-picker/locale';
|
|
27
27
|
import type { ColorPickerLocale } from '../../lib/color-picker/locale';
|
|
28
28
|
import type { BaseColorPickerLocale } from '../color-picker/locale';
|
|
29
|
+
import type { PopoverLocale } from '../../lib/popover/locale';
|
|
29
30
|
type ConnotationAnnoncementLocale = {
|
|
30
31
|
[key in Connotation as `${key}Icon`]: string;
|
|
31
32
|
};
|
|
@@ -62,5 +63,6 @@ export interface Locale {
|
|
|
62
63
|
baseColorPicker: BaseColorPickerLocale;
|
|
63
64
|
simpleColorPicker: SimpleColorPickerLocale;
|
|
64
65
|
colorPicker: ColorPickerLocale;
|
|
66
|
+
popover: PopoverLocale;
|
|
65
67
|
}
|
|
66
68
|
export {};
|