@vonage/vivid 5.27.0 → 5.28.1
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/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +3 -3
- package/bundled/decorate.js +1 -1
- package/bundled/definition10.cjs +5 -1
- package/bundled/definition10.js +5 -1
- package/bundled/definition2.cjs +1 -1
- package/bundled/definition2.js +1 -1
- package/bundled/definition23.cjs +8 -4
- package/bundled/definition23.js +8 -4
- package/bundled/definition4.cjs +1 -1
- package/bundled/definition4.js +1 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +2 -1
- package/bundled/definition8.cjs +9 -7
- package/bundled/definition8.js +11 -9
- package/bundled/definition9.cjs +3 -3
- package/bundled/definition9.js +4 -4
- package/bundled/feedback-message.cjs +1 -1
- package/bundled/feedback-message.js +1 -1
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +12 -0
- package/bundled/render-in-light-dom.js +3 -3
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/custom-elements.json +198 -144
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/lib/badge/badge.d.ts +1 -0
- package/lib/badge/badge.template.d.ts +2 -1
- package/lib/icon/icon.d.ts +1 -1
- package/lib/popover/popover.d.ts +2 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/rich-text-editor/rich-text-editor.d.ts +427 -0
- package/lib/rich-text-editor/rte/__tests__/async-generator.d.ts +1 -0
- package/lib/rich-text-editor/rte/features/atom.d.ts +6 -2
- package/lib/rich-text-editor/rte/instance.d.ts +2 -1
- package/lib/table/locale.d.ts +10 -0
- package/lib/table/table-sorting-button.d.ts +425 -0
- package/locales/de-DE.cjs +12 -0
- package/locales/de-DE.js +12 -0
- package/locales/en-GB.cjs +12 -0
- package/locales/en-GB.js +12 -0
- package/locales/ja-JP.cjs +12 -0
- package/locales/ja-JP.js +12 -0
- package/locales/zh-CN.cjs +12 -0
- package/locales/zh-CN.js +12 -0
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/package.json +16 -16
- package/popover/index.cjs +2 -2
- package/popover/index.js +70 -37
- package/rich-text-editor/index.cjs +23 -17
- package/rich-text-editor/index.js +1655 -1590
- package/shared/localization/Locale.d.ts +2 -0
- package/table/index.cjs +17 -17
- package/table/index.js +50 -40
- package/unbundled/decorate.cjs +1 -1
- package/unbundled/decorate.js +1 -1
- package/unbundled/definition.cjs +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/definition14.cjs +1 -1
- package/unbundled/definition14.js +1 -1
- package/unbundled/definition15.cjs +8 -3
- package/unbundled/definition15.js +8 -3
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition24.cjs +4 -4
- package/unbundled/definition24.js +4 -4
- package/unbundled/definition25.cjs +5 -1
- package/unbundled/definition25.js +5 -1
- package/unbundled/definition27.cjs +8 -5
- package/unbundled/definition27.js +8 -5
- package/unbundled/definition35.cjs +1 -1
- package/unbundled/definition35.js +1 -1
- package/unbundled/definition5.cjs +1 -1
- package/unbundled/definition5.js +1 -1
- package/unbundled/definition55.cjs +1 -1
- package/unbundled/definition55.js +1 -1
- package/unbundled/definition58.cjs +69 -4
- package/unbundled/definition58.js +69 -4
- package/unbundled/definition6.cjs +2 -1
- package/unbundled/definition6.js +2 -1
- package/unbundled/definition63.cjs +82 -22
- package/unbundled/definition63.js +82 -22
- package/unbundled/definition75.cjs +19 -6
- package/unbundled/definition75.js +20 -7
- package/unbundled/definition8.cjs +2 -2
- package/unbundled/definition8.js +2 -2
- package/unbundled/definition83.cjs +1 -1
- package/unbundled/definition83.js +1 -1
- package/unbundled/en-US.cjs +12 -0
- package/unbundled/en-US.js +12 -0
- package/unbundled/feedback-message.cjs +1 -1
- package/unbundled/feedback-message.js +1 -1
- package/unbundled/linkable.cjs +1 -1
- package/unbundled/linkable.js +1 -1
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/index.cjs +26 -26
- package/video-player/index.js +2438 -2413
- package/vivid.api.json +64 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime.cjs");
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
3
|
const require_decorate = require("./decorate.cjs");
|
|
4
|
+
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
4
5
|
const require_definition = require("./definition5.cjs");
|
|
5
6
|
const require_localized = require("./localized.cjs");
|
|
6
7
|
const require_definition$1 = require("./definition6.cjs");
|
|
@@ -32,7 +33,7 @@ let prosemirror_inputrules = require("prosemirror-inputrules");
|
|
|
32
33
|
let prosemirror_transform = require("prosemirror-transform");
|
|
33
34
|
let prosemirror_schema_basic = require("prosemirror-schema-basic");
|
|
34
35
|
//#region src/lib/rich-text-editor/rich-text-editor.scss?inline
|
|
35
|
-
var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline:var(--rich-text-editor-padding-inline,16px);--editor-padding-block:var(--rich-text-editor-padding-block,
|
|
36
|
+
var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline:var(--rich-text-editor-padding-inline,16px);--editor-padding-block:var(--rich-text-editor-padding-block,8px);block-size:100%;max-block-size:inherit;min-block-size:inherit;flex-direction:column;display:flex}.rte.appearance-fieldset{background-color:var(--_appearance-color-fill);outline:1px solid var(--_appearance-color-outline);outline-offset:-1px;border-radius:8px;transition:outline-color .2s,background-color .2s}.rte.appearance-fieldset:focus-within{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}.rte.appearance-fieldset .editor-viewport{border-start-start-radius:inherit;border-start-end-radius:inherit}.rte.appearance-fieldset .editor-scroll-area{background:0 0}.rte.appearance-fieldset .toolbar{border-end-end-radius:inherit;border-end-start-radius:inherit}.editor{display:contents}.editor-viewport{contain:layout;flex-direction:column;flex:1;min-block-size:0;display:flex;position:relative;overflow:hidden}.editor-scroll-area{background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);--scrollbar-track-color:transparent;--scrollbar-thumb-color:color-mix(in sRGB, var(--vvd-color-neutral-950), transparent 70%);scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin;flex-direction:column;flex:1;min-block-size:0;display:flex;overflow-y:auto}.editor-scroll-area ::-webkit-scrollbar{width:4px}.editor-scroll-area ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.editor-scroll-area ::-webkit-scrollbar-thumb{background-color:var(--scrollbar-fallback-track-color,var(--scrollbar-thumb-color));border:0;border-radius:4px}.popovers--disabled>*{display:none!important}";
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/lib/rich-text-editor/rich-text-editor.ts
|
|
38
39
|
/**
|
|
@@ -47,10 +48,16 @@ var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline
|
|
|
47
48
|
* @dynamicSlot `{ url: string }` inline-image-placeholder - Placeholder content for inline images.
|
|
48
49
|
* @dynamicSlot `{ id: string }` suggestions-empty - Empty state if no suggestions are found.
|
|
49
50
|
*/
|
|
50
|
-
var RichTextEditor = class extends require_localized.WithObservableLocale(require_vivid_element.VividElement) {
|
|
51
|
+
var RichTextEditor = class extends require_delegates_aria.DelegatesAria(require_localized.WithObservableLocale(require_vivid_element.VividElement)) {
|
|
52
|
+
constructor(..._args) {
|
|
53
|
+
super(..._args);
|
|
54
|
+
this._disabled = false;
|
|
55
|
+
}
|
|
51
56
|
/** @internal */
|
|
52
57
|
instanceChanged(prevInstance) {
|
|
53
58
|
prevInstance?.[require_slottable_request.impl].destroyViewIfNeeded();
|
|
59
|
+
if (prevInstance) prevInstance[require_slottable_request.impl].onDisabledChanged = null;
|
|
60
|
+
this._disabled = false;
|
|
54
61
|
this._initViewIfNeeded();
|
|
55
62
|
prevInstance?.[require_slottable_request.impl].styles.removeStylesFrom(this.shadowRoot);
|
|
56
63
|
this.instance?.[require_slottable_request.impl].styles.addStylesTo(this.shadowRoot);
|
|
@@ -59,7 +66,10 @@ var RichTextEditor = class extends require_localized.WithObservableLocale(requir
|
|
|
59
66
|
const instance = this.instance?.[require_slottable_request.impl];
|
|
60
67
|
if (instance && this.$fastController.isConnected && !instance.view) {
|
|
61
68
|
this._syncStateIfNeeded();
|
|
62
|
-
instance.
|
|
69
|
+
instance.onDisabledChanged = (disabled) => {
|
|
70
|
+
this._disabled = disabled;
|
|
71
|
+
};
|
|
72
|
+
instance.createView(this._editableEl);
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
_destroyViewIfNeeded() {
|
|
@@ -72,6 +82,7 @@ var RichTextEditor = class extends require_localized.WithObservableLocale(requir
|
|
|
72
82
|
disconnectedCallback() {
|
|
73
83
|
super.disconnectedCallback();
|
|
74
84
|
this._destroyViewIfNeeded();
|
|
85
|
+
if (this.instance) this.instance[require_slottable_request.impl].onDisabledChanged = null;
|
|
75
86
|
}
|
|
76
87
|
/** @internal */
|
|
77
88
|
localeChanged() {
|
|
@@ -83,21 +94,37 @@ var RichTextEditor = class extends require_localized.WithObservableLocale(requir
|
|
|
83
94
|
ctx: this._ctx
|
|
84
95
|
});
|
|
85
96
|
}
|
|
97
|
+
/** @internal */
|
|
98
|
+
focus(options) {
|
|
99
|
+
const view = this.instance?.[require_slottable_request.impl].view;
|
|
100
|
+
if (view && view.editable) {
|
|
101
|
+
this._editableEl.focus(options);
|
|
102
|
+
view.focus();
|
|
103
|
+
} else super.focus(options);
|
|
104
|
+
}
|
|
86
105
|
};
|
|
87
106
|
require_decorate.__decorate([_microsoft_fast_element.observable], RichTextEditor.prototype, "instance", void 0);
|
|
88
107
|
require_decorate.__decorate([_microsoft_fast_element.attr], RichTextEditor.prototype, "appearance", void 0);
|
|
108
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], RichTextEditor.prototype, "state", void 0);
|
|
109
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], RichTextEditor.prototype, "_disabled", void 0);
|
|
89
110
|
//#endregion
|
|
90
111
|
//#region src/lib/rich-text-editor/rich-text-editor.template.ts
|
|
91
112
|
var RichTextEditorTemplate = (ctx) => {
|
|
92
113
|
return _microsoft_fast_element.html`<template :_ctx="${() => ctx}">
|
|
93
114
|
<div
|
|
94
|
-
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("rte", `connotation-accent`, "with-idle", "with-hover", [`appearance-${x.appearance}`, Boolean(x.appearance)])}"
|
|
115
|
+
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("rte", `connotation-accent`, "with-idle", "with-hover", "with-disabled", "with-error", "with-success", ["disabled", x._disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], ["error", x.state === "error"], ["success", x.state === "success"])}"
|
|
95
116
|
>
|
|
96
117
|
<slot name="editor-before"></slot>
|
|
97
|
-
<div
|
|
118
|
+
<div
|
|
119
|
+
class="editor-viewport"
|
|
120
|
+
part="editor-viewport"
|
|
121
|
+
${(0, _microsoft_fast_element.ref)("editorViewportElement")}
|
|
122
|
+
>
|
|
98
123
|
<div class="editor-scroll-area" part="editor-scrollable-area">
|
|
99
124
|
<slot name="editor-start"></slot>
|
|
100
|
-
<div class="editor rich-text"
|
|
125
|
+
<div class="editor rich-text">
|
|
126
|
+
<div part="editor" ${require_delegates_aria.delegateAria()} ${(0, _microsoft_fast_element.ref)("_editableEl")}></div>
|
|
127
|
+
</div>
|
|
101
128
|
<div class="popovers"></div>
|
|
102
129
|
<slot name="editor-end"></slot>
|
|
103
130
|
</div>
|
|
@@ -246,7 +273,7 @@ var FeatureState = class {
|
|
|
246
273
|
};
|
|
247
274
|
//#endregion
|
|
248
275
|
//#region src/lib/rich-text-editor/rte/features/internal/core.style.scss?inline
|
|
249
|
-
var core_style_default = ".ProseMirror{box-sizing:border-box;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none;flex:1 0 0}.ProseMirror-selectednode{--focus-stroke-gap-color:transparent;--focus-border-radius:2px;outline:none;position:relative}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:var(--focus-border-radius,inherit);block-size:calc(100% + var(--focus-block-size-addition,4px));content:\"\";inline-size:calc(100% + var(--focus-block-size-addition,4px));display:block;position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.editor--disabled .ProseMirror{color:var(--vvd-color-neutral-300);cursor:not-allowed}";
|
|
276
|
+
var core_style_default = ".ProseMirror{box-sizing:border-box;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none;flex:1 0 0}.ProseMirror-selectednode{--focus-stroke-gap-color:transparent;--focus-border-radius:2px;outline:none;position:relative}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:var(--focus-border-radius,inherit);block-size:calc(100% + var(--focus-block-size-addition,4px));content:\"\";inline-size:calc(100% + var(--focus-block-size-addition,4px));display:block;position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.editor--disabled .ProseMirror{color:var(--_appearance-color-text,var(--vvd-color-neutral-300));cursor:not-allowed}";
|
|
250
277
|
//#endregion
|
|
251
278
|
//#region src/lib/rich-text-editor/rte/features/internal/foreign-html.ts
|
|
252
279
|
var RteForeignHtmlFeatureImpl = class extends require_slottable_request.RteFeatureImpl {
|
|
@@ -390,6 +417,7 @@ var RteCoreImpl = class extends require_slottable_request.RteFeatureImpl {
|
|
|
390
417
|
const disabled = this.disabled.getValue(rte);
|
|
391
418
|
popovers.classList.toggle("popovers--disabled", disabled);
|
|
392
419
|
view.dom.parentElement.classList.toggle("editor--disabled", disabled);
|
|
420
|
+
rte.onDisabledChanged?.(disabled);
|
|
393
421
|
};
|
|
394
422
|
updateDisabled();
|
|
395
423
|
return { update: () => {
|
|
@@ -601,7 +629,7 @@ var RteInstance = class {
|
|
|
601
629
|
const { state, tr, schema, dispatchTransaction } = this[require_slottable_request.impl];
|
|
602
630
|
tr.replaceSelection(new prosemirror_model.Slice(prosemirror_model.Fragment.fromJSON(schema, content), 0, 0));
|
|
603
631
|
tr.doc.check();
|
|
604
|
-
const $from = tr.doc.resolve(tr.mapping.map(state.selection.from));
|
|
632
|
+
const $from = tr.doc.resolve(tr.mapping.map(state.selection.from, -1));
|
|
605
633
|
const $to = tr.doc.resolve(tr.selection.to);
|
|
606
634
|
const [$head, $anchor] = options?.cursorPlacement === "start" ? [$from, $to] : [$to, $from];
|
|
607
635
|
if (options?.selectContent) tr.setSelection(state.selection instanceof prosemirror_state.AllSelection ? new prosemirror_state.AllSelection(tr.doc) : prosemirror_state.TextSelection.between($anchor, $head));
|
|
@@ -651,6 +679,7 @@ var RteInstanceImpl = class {
|
|
|
651
679
|
constructor(instanceFacade, configFacade, options) {
|
|
652
680
|
this.options = options;
|
|
653
681
|
this.view = null;
|
|
682
|
+
this.onDisabledChanged = null;
|
|
654
683
|
this.dispatchTransaction = (tr) => {
|
|
655
684
|
const prevState = this.state;
|
|
656
685
|
this.state = this.state.apply(tr);
|
|
@@ -682,12 +711,9 @@ var RteInstanceImpl = class {
|
|
|
682
711
|
this.updateHostState(currentHostState);
|
|
683
712
|
this.view?.updateState(this.state);
|
|
684
713
|
}
|
|
685
|
-
createView(
|
|
714
|
+
createView(mountTarget) {
|
|
686
715
|
const core = this.config.featureMap.get("RteCore");
|
|
687
|
-
this.view = new prosemirror_view.EditorView(
|
|
688
|
-
editor.part = "editor";
|
|
689
|
-
target.appendChild(editor);
|
|
690
|
-
}, {
|
|
716
|
+
this.view = new prosemirror_view.EditorView({ mount: mountTarget }, {
|
|
691
717
|
state: this.state,
|
|
692
718
|
dispatchTransaction: this.dispatchTransaction,
|
|
693
719
|
...core?.scrollThreshold !== void 0 && { scrollThreshold: core.scrollThreshold },
|
|
@@ -2408,6 +2434,7 @@ var RteAlignmentFeatureImpl = class extends require_slottable_request.RteFeature
|
|
|
2408
2434
|
textAlign: align
|
|
2409
2435
|
});
|
|
2410
2436
|
});
|
|
2437
|
+
if (state.storedMarks) tr.setStoredMarks(state.storedMarks);
|
|
2411
2438
|
dispatch?.(tr.scrollIntoView());
|
|
2412
2439
|
return true;
|
|
2413
2440
|
};
|
|
@@ -3204,24 +3231,57 @@ var RteToolbarButtonFeature = require_slottable_request.featureFacade(RteToolbar
|
|
|
3204
3231
|
//#endregion
|
|
3205
3232
|
//#region src/lib/rich-text-editor/rte/features/atom.ts
|
|
3206
3233
|
var isGenerator = (value) => value !== null && typeof value === "object" && "next" in value;
|
|
3234
|
+
var VALID_VARIANT = /^[a-zA-Z0-9-]+$/;
|
|
3235
|
+
var normalizeResolvedValue = (value) => {
|
|
3236
|
+
if (value == null) return {
|
|
3237
|
+
text: "",
|
|
3238
|
+
variant: []
|
|
3239
|
+
};
|
|
3240
|
+
if (typeof value === "string") return {
|
|
3241
|
+
text: value,
|
|
3242
|
+
variant: []
|
|
3243
|
+
};
|
|
3244
|
+
return {
|
|
3245
|
+
text: value.text,
|
|
3246
|
+
variant: (value.variant ?? []).filter((v) => {
|
|
3247
|
+
if (!VALID_VARIANT.test(v)) {
|
|
3248
|
+
console.warn(`[rich-text-editor] Ignoring invalid atom variant "${v}".`);
|
|
3249
|
+
return false;
|
|
3250
|
+
}
|
|
3251
|
+
return true;
|
|
3252
|
+
})
|
|
3253
|
+
};
|
|
3254
|
+
};
|
|
3255
|
+
var partsFor = (atomName, variant) => [`node--${atomName}`, ...variant.map((v) => `atom-variant--${v}`)].join(" ");
|
|
3207
3256
|
var AtomView = class {
|
|
3208
3257
|
constructor(node, config, atomName) {
|
|
3258
|
+
this.atomName = atomName;
|
|
3209
3259
|
this.dom = document.createElement("span");
|
|
3210
3260
|
this.dom.className = "atom-wrapper";
|
|
3211
|
-
this.dom.setAttribute("part", `node--${atomName}`);
|
|
3212
3261
|
const result = config.resolveValue ? config.resolveValue(node.attrs.value) : node.attrs.value;
|
|
3213
3262
|
if (isGenerator(result)) {
|
|
3214
|
-
this.
|
|
3263
|
+
this.render(null);
|
|
3215
3264
|
this.handleResolvedGenerator(result);
|
|
3216
|
-
} else this.
|
|
3265
|
+
} else this.render(result);
|
|
3266
|
+
}
|
|
3267
|
+
render(value) {
|
|
3268
|
+
const { text, variant } = normalizeResolvedValue(value);
|
|
3269
|
+
if (this.dom.textContent !== text) this.dom.textContent = text;
|
|
3270
|
+
const parts = partsFor(this.atomName, variant);
|
|
3271
|
+
if (this.dom.getAttribute("part") !== parts) this.dom.setAttribute("part", parts);
|
|
3217
3272
|
}
|
|
3218
3273
|
async handleResolvedGenerator(generator) {
|
|
3219
3274
|
const iterator = generator[Symbol.asyncIterator]();
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3275
|
+
try {
|
|
3276
|
+
let result;
|
|
3277
|
+
do {
|
|
3278
|
+
result = await iterator.next();
|
|
3279
|
+
this.render(result.value ?? null);
|
|
3280
|
+
} while (!result.done);
|
|
3281
|
+
} catch (error) {
|
|
3282
|
+
this.render(null);
|
|
3283
|
+
console.warn("[rich-text-editor] Error while resolving atom value:", error);
|
|
3284
|
+
}
|
|
3225
3285
|
}
|
|
3226
3286
|
};
|
|
3227
3287
|
var RteAtomFeatureImpl = class extends require_slottable_request.RteFeatureImpl {
|
|
@@ -3248,7 +3308,7 @@ var RteAtomFeatureImpl = class extends require_slottable_request.RteFeatureImpl
|
|
|
3248
3308
|
if (serializedValue === null) return document.createDocumentFragment();
|
|
3249
3309
|
return [
|
|
3250
3310
|
"span",
|
|
3251
|
-
{ part:
|
|
3311
|
+
{ part: partsFor(this.atomName, []) },
|
|
3252
3312
|
serializedValue
|
|
3253
3313
|
];
|
|
3254
3314
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
|
|
2
2
|
import { t as __decorate } from "./decorate.js";
|
|
3
|
+
import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
|
|
3
4
|
import { r as ProgressRing, t as progressRingDefinition } from "./definition5.js";
|
|
4
5
|
import { n as WithObservableLocale } from "./localized.js";
|
|
5
6
|
import { i as Button, t as buttonDefinition } from "./definition6.js";
|
|
@@ -30,7 +31,7 @@ import { InputRule, inputRules, undoInputRule } from "prosemirror-inputrules";
|
|
|
30
31
|
import { RemoveMarkStep, ReplaceAroundStep, dropPoint } from "prosemirror-transform";
|
|
31
32
|
import { marks } from "prosemirror-schema-basic";
|
|
32
33
|
//#region src/lib/rich-text-editor/rich-text-editor.scss?inline
|
|
33
|
-
var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline:var(--rich-text-editor-padding-inline,16px);--editor-padding-block:var(--rich-text-editor-padding-block,
|
|
34
|
+
var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline:var(--rich-text-editor-padding-inline,16px);--editor-padding-block:var(--rich-text-editor-padding-block,8px);block-size:100%;max-block-size:inherit;min-block-size:inherit;flex-direction:column;display:flex}.rte.appearance-fieldset{background-color:var(--_appearance-color-fill);outline:1px solid var(--_appearance-color-outline);outline-offset:-1px;border-radius:8px;transition:outline-color .2s,background-color .2s}.rte.appearance-fieldset:focus-within{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}.rte.appearance-fieldset .editor-viewport{border-start-start-radius:inherit;border-start-end-radius:inherit}.rte.appearance-fieldset .editor-scroll-area{background:0 0}.rte.appearance-fieldset .toolbar{border-end-end-radius:inherit;border-end-start-radius:inherit}.editor{display:contents}.editor-viewport{contain:layout;flex-direction:column;flex:1;min-block-size:0;display:flex;position:relative;overflow:hidden}.editor-scroll-area{background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);--scrollbar-track-color:transparent;--scrollbar-thumb-color:color-mix(in sRGB, var(--vvd-color-neutral-950), transparent 70%);scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin;flex-direction:column;flex:1;min-block-size:0;display:flex;overflow-y:auto}.editor-scroll-area ::-webkit-scrollbar{width:4px}.editor-scroll-area ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.editor-scroll-area ::-webkit-scrollbar-thumb{background-color:var(--scrollbar-fallback-track-color,var(--scrollbar-thumb-color));border:0;border-radius:4px}.popovers--disabled>*{display:none!important}";
|
|
34
35
|
//#endregion
|
|
35
36
|
//#region src/lib/rich-text-editor/rich-text-editor.ts
|
|
36
37
|
/**
|
|
@@ -45,10 +46,16 @@ var rich_text_editor_default = ":host{display:block}.rte{--editor-padding-inline
|
|
|
45
46
|
* @dynamicSlot `{ url: string }` inline-image-placeholder - Placeholder content for inline images.
|
|
46
47
|
* @dynamicSlot `{ id: string }` suggestions-empty - Empty state if no suggestions are found.
|
|
47
48
|
*/
|
|
48
|
-
var RichTextEditor = class extends WithObservableLocale(VividElement) {
|
|
49
|
+
var RichTextEditor = class extends DelegatesAria(WithObservableLocale(VividElement)) {
|
|
50
|
+
constructor(..._args) {
|
|
51
|
+
super(..._args);
|
|
52
|
+
this._disabled = false;
|
|
53
|
+
}
|
|
49
54
|
/** @internal */
|
|
50
55
|
instanceChanged(prevInstance) {
|
|
51
56
|
prevInstance?.[impl].destroyViewIfNeeded();
|
|
57
|
+
if (prevInstance) prevInstance[impl].onDisabledChanged = null;
|
|
58
|
+
this._disabled = false;
|
|
52
59
|
this._initViewIfNeeded();
|
|
53
60
|
prevInstance?.[impl].styles.removeStylesFrom(this.shadowRoot);
|
|
54
61
|
this.instance?.[impl].styles.addStylesTo(this.shadowRoot);
|
|
@@ -57,7 +64,10 @@ var RichTextEditor = class extends WithObservableLocale(VividElement) {
|
|
|
57
64
|
const instance = this.instance?.[impl];
|
|
58
65
|
if (instance && this.$fastController.isConnected && !instance.view) {
|
|
59
66
|
this._syncStateIfNeeded();
|
|
60
|
-
instance.
|
|
67
|
+
instance.onDisabledChanged = (disabled) => {
|
|
68
|
+
this._disabled = disabled;
|
|
69
|
+
};
|
|
70
|
+
instance.createView(this._editableEl);
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
73
|
_destroyViewIfNeeded() {
|
|
@@ -70,6 +80,7 @@ var RichTextEditor = class extends WithObservableLocale(VividElement) {
|
|
|
70
80
|
disconnectedCallback() {
|
|
71
81
|
super.disconnectedCallback();
|
|
72
82
|
this._destroyViewIfNeeded();
|
|
83
|
+
if (this.instance) this.instance[impl].onDisabledChanged = null;
|
|
73
84
|
}
|
|
74
85
|
/** @internal */
|
|
75
86
|
localeChanged() {
|
|
@@ -81,21 +92,37 @@ var RichTextEditor = class extends WithObservableLocale(VividElement) {
|
|
|
81
92
|
ctx: this._ctx
|
|
82
93
|
});
|
|
83
94
|
}
|
|
95
|
+
/** @internal */
|
|
96
|
+
focus(options) {
|
|
97
|
+
const view = this.instance?.[impl].view;
|
|
98
|
+
if (view && view.editable) {
|
|
99
|
+
this._editableEl.focus(options);
|
|
100
|
+
view.focus();
|
|
101
|
+
} else super.focus(options);
|
|
102
|
+
}
|
|
84
103
|
};
|
|
85
104
|
__decorate([observable], RichTextEditor.prototype, "instance", void 0);
|
|
86
105
|
__decorate([attr], RichTextEditor.prototype, "appearance", void 0);
|
|
106
|
+
__decorate([attr], RichTextEditor.prototype, "state", void 0);
|
|
107
|
+
__decorate([observable], RichTextEditor.prototype, "_disabled", void 0);
|
|
87
108
|
//#endregion
|
|
88
109
|
//#region src/lib/rich-text-editor/rich-text-editor.template.ts
|
|
89
110
|
var RichTextEditorTemplate = (ctx) => {
|
|
90
111
|
return html`<template :_ctx="${() => ctx}">
|
|
91
112
|
<div
|
|
92
|
-
class="${(x) => classNames("rte", `connotation-accent`, "with-idle", "with-hover", [`appearance-${x.appearance}`, Boolean(x.appearance)])}"
|
|
113
|
+
class="${(x) => classNames("rte", `connotation-accent`, "with-idle", "with-hover", "with-disabled", "with-error", "with-success", ["disabled", x._disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], ["error", x.state === "error"], ["success", x.state === "success"])}"
|
|
93
114
|
>
|
|
94
115
|
<slot name="editor-before"></slot>
|
|
95
|
-
<div
|
|
116
|
+
<div
|
|
117
|
+
class="editor-viewport"
|
|
118
|
+
part="editor-viewport"
|
|
119
|
+
${ref("editorViewportElement")}
|
|
120
|
+
>
|
|
96
121
|
<div class="editor-scroll-area" part="editor-scrollable-area">
|
|
97
122
|
<slot name="editor-start"></slot>
|
|
98
|
-
<div class="editor rich-text"
|
|
123
|
+
<div class="editor rich-text">
|
|
124
|
+
<div part="editor" ${delegateAria()} ${ref("_editableEl")}></div>
|
|
125
|
+
</div>
|
|
99
126
|
<div class="popovers"></div>
|
|
100
127
|
<slot name="editor-end"></slot>
|
|
101
128
|
</div>
|
|
@@ -244,7 +271,7 @@ var FeatureState = class {
|
|
|
244
271
|
};
|
|
245
272
|
//#endregion
|
|
246
273
|
//#region src/lib/rich-text-editor/rte/features/internal/core.style.scss?inline
|
|
247
|
-
var core_style_default = ".ProseMirror{box-sizing:border-box;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none;flex:1 0 0}.ProseMirror-selectednode{--focus-stroke-gap-color:transparent;--focus-border-radius:2px;outline:none;position:relative}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:var(--focus-border-radius,inherit);block-size:calc(100% + var(--focus-block-size-addition,4px));content:\"\";inline-size:calc(100% + var(--focus-block-size-addition,4px));display:block;position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.editor--disabled .ProseMirror{color:var(--vvd-color-neutral-300);cursor:not-allowed}";
|
|
274
|
+
var core_style_default = ".ProseMirror{box-sizing:border-box;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none;flex:1 0 0}.ProseMirror-selectednode{--focus-stroke-gap-color:transparent;--focus-border-radius:2px;outline:none;position:relative}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:var(--focus-border-radius,inherit);block-size:calc(100% + var(--focus-block-size-addition,4px));content:\"\";inline-size:calc(100% + var(--focus-block-size-addition,4px));display:block;position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.editor--disabled .ProseMirror{color:var(--_appearance-color-text,var(--vvd-color-neutral-300));cursor:not-allowed}";
|
|
248
275
|
//#endregion
|
|
249
276
|
//#region src/lib/rich-text-editor/rte/features/internal/foreign-html.ts
|
|
250
277
|
var RteForeignHtmlFeatureImpl = class extends RteFeatureImpl {
|
|
@@ -388,6 +415,7 @@ var RteCoreImpl = class extends RteFeatureImpl {
|
|
|
388
415
|
const disabled = this.disabled.getValue(rte);
|
|
389
416
|
popovers.classList.toggle("popovers--disabled", disabled);
|
|
390
417
|
view.dom.parentElement.classList.toggle("editor--disabled", disabled);
|
|
418
|
+
rte.onDisabledChanged?.(disabled);
|
|
391
419
|
};
|
|
392
420
|
updateDisabled();
|
|
393
421
|
return { update: () => {
|
|
@@ -599,7 +627,7 @@ var RteInstance = class {
|
|
|
599
627
|
const { state, tr, schema, dispatchTransaction } = this[impl];
|
|
600
628
|
tr.replaceSelection(new Slice(Fragment.fromJSON(schema, content), 0, 0));
|
|
601
629
|
tr.doc.check();
|
|
602
|
-
const $from = tr.doc.resolve(tr.mapping.map(state.selection.from));
|
|
630
|
+
const $from = tr.doc.resolve(tr.mapping.map(state.selection.from, -1));
|
|
603
631
|
const $to = tr.doc.resolve(tr.selection.to);
|
|
604
632
|
const [$head, $anchor] = options?.cursorPlacement === "start" ? [$from, $to] : [$to, $from];
|
|
605
633
|
if (options?.selectContent) tr.setSelection(state.selection instanceof AllSelection ? new AllSelection(tr.doc) : TextSelection.between($anchor, $head));
|
|
@@ -649,6 +677,7 @@ var RteInstanceImpl = class {
|
|
|
649
677
|
constructor(instanceFacade, configFacade, options) {
|
|
650
678
|
this.options = options;
|
|
651
679
|
this.view = null;
|
|
680
|
+
this.onDisabledChanged = null;
|
|
652
681
|
this.dispatchTransaction = (tr) => {
|
|
653
682
|
const prevState = this.state;
|
|
654
683
|
this.state = this.state.apply(tr);
|
|
@@ -680,12 +709,9 @@ var RteInstanceImpl = class {
|
|
|
680
709
|
this.updateHostState(currentHostState);
|
|
681
710
|
this.view?.updateState(this.state);
|
|
682
711
|
}
|
|
683
|
-
createView(
|
|
712
|
+
createView(mountTarget) {
|
|
684
713
|
const core = this.config.featureMap.get("RteCore");
|
|
685
|
-
this.view = new EditorView(
|
|
686
|
-
editor.part = "editor";
|
|
687
|
-
target.appendChild(editor);
|
|
688
|
-
}, {
|
|
714
|
+
this.view = new EditorView({ mount: mountTarget }, {
|
|
689
715
|
state: this.state,
|
|
690
716
|
dispatchTransaction: this.dispatchTransaction,
|
|
691
717
|
...core?.scrollThreshold !== void 0 && { scrollThreshold: core.scrollThreshold },
|
|
@@ -2406,6 +2432,7 @@ var RteAlignmentFeatureImpl = class extends RteFeatureImpl {
|
|
|
2406
2432
|
textAlign: align
|
|
2407
2433
|
});
|
|
2408
2434
|
});
|
|
2435
|
+
if (state.storedMarks) tr.setStoredMarks(state.storedMarks);
|
|
2409
2436
|
dispatch?.(tr.scrollIntoView());
|
|
2410
2437
|
return true;
|
|
2411
2438
|
};
|
|
@@ -3202,24 +3229,57 @@ var RteToolbarButtonFeature = featureFacade(RteToolbarButtonFeatureImpl);
|
|
|
3202
3229
|
//#endregion
|
|
3203
3230
|
//#region src/lib/rich-text-editor/rte/features/atom.ts
|
|
3204
3231
|
var isGenerator = (value) => value !== null && typeof value === "object" && "next" in value;
|
|
3232
|
+
var VALID_VARIANT = /^[a-zA-Z0-9-]+$/;
|
|
3233
|
+
var normalizeResolvedValue = (value) => {
|
|
3234
|
+
if (value == null) return {
|
|
3235
|
+
text: "",
|
|
3236
|
+
variant: []
|
|
3237
|
+
};
|
|
3238
|
+
if (typeof value === "string") return {
|
|
3239
|
+
text: value,
|
|
3240
|
+
variant: []
|
|
3241
|
+
};
|
|
3242
|
+
return {
|
|
3243
|
+
text: value.text,
|
|
3244
|
+
variant: (value.variant ?? []).filter((v) => {
|
|
3245
|
+
if (!VALID_VARIANT.test(v)) {
|
|
3246
|
+
console.warn(`[rich-text-editor] Ignoring invalid atom variant "${v}".`);
|
|
3247
|
+
return false;
|
|
3248
|
+
}
|
|
3249
|
+
return true;
|
|
3250
|
+
})
|
|
3251
|
+
};
|
|
3252
|
+
};
|
|
3253
|
+
var partsFor = (atomName, variant) => [`node--${atomName}`, ...variant.map((v) => `atom-variant--${v}`)].join(" ");
|
|
3205
3254
|
var AtomView = class {
|
|
3206
3255
|
constructor(node, config, atomName) {
|
|
3256
|
+
this.atomName = atomName;
|
|
3207
3257
|
this.dom = document.createElement("span");
|
|
3208
3258
|
this.dom.className = "atom-wrapper";
|
|
3209
|
-
this.dom.setAttribute("part", `node--${atomName}`);
|
|
3210
3259
|
const result = config.resolveValue ? config.resolveValue(node.attrs.value) : node.attrs.value;
|
|
3211
3260
|
if (isGenerator(result)) {
|
|
3212
|
-
this.
|
|
3261
|
+
this.render(null);
|
|
3213
3262
|
this.handleResolvedGenerator(result);
|
|
3214
|
-
} else this.
|
|
3263
|
+
} else this.render(result);
|
|
3264
|
+
}
|
|
3265
|
+
render(value) {
|
|
3266
|
+
const { text, variant } = normalizeResolvedValue(value);
|
|
3267
|
+
if (this.dom.textContent !== text) this.dom.textContent = text;
|
|
3268
|
+
const parts = partsFor(this.atomName, variant);
|
|
3269
|
+
if (this.dom.getAttribute("part") !== parts) this.dom.setAttribute("part", parts);
|
|
3215
3270
|
}
|
|
3216
3271
|
async handleResolvedGenerator(generator) {
|
|
3217
3272
|
const iterator = generator[Symbol.asyncIterator]();
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3273
|
+
try {
|
|
3274
|
+
let result;
|
|
3275
|
+
do {
|
|
3276
|
+
result = await iterator.next();
|
|
3277
|
+
this.render(result.value ?? null);
|
|
3278
|
+
} while (!result.done);
|
|
3279
|
+
} catch (error) {
|
|
3280
|
+
this.render(null);
|
|
3281
|
+
console.warn("[rich-text-editor] Error while resolving atom value:", error);
|
|
3282
|
+
}
|
|
3223
3283
|
}
|
|
3224
3284
|
};
|
|
3225
3285
|
var RteAtomFeatureImpl = class extends RteFeatureImpl {
|
|
@@ -3246,7 +3306,7 @@ var RteAtomFeatureImpl = class extends RteFeatureImpl {
|
|
|
3246
3306
|
if (serializedValue === null) return document.createDocumentFragment();
|
|
3247
3307
|
return [
|
|
3248
3308
|
"span",
|
|
3249
|
-
{ part:
|
|
3309
|
+
{ part: partsFor(this.atomName, []) },
|
|
3250
3310
|
serializedValue
|
|
3251
3311
|
];
|
|
3252
3312
|
},
|
|
@@ -3,6 +3,7 @@ const require_definition = require("./definition.cjs");
|
|
|
3
3
|
const require_decorate = require("./decorate.cjs");
|
|
4
4
|
const require_icon = require("./icon.cjs");
|
|
5
5
|
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
6
|
+
const require_localized = require("./localized.cjs");
|
|
6
7
|
const require_host_semantics = require("./host-semantics.cjs");
|
|
7
8
|
const require_data_grid_options = require("./data-grid.options.cjs");
|
|
8
9
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
@@ -173,7 +174,7 @@ var TableCellTemplate = () => {
|
|
|
173
174
|
* @component table-sorting-button
|
|
174
175
|
* @event {CustomEvent<undefined>} sort - Emitted when sorting button is clicked.
|
|
175
176
|
*/
|
|
176
|
-
var TableSortingButton = class extends require_delegates_aria.DelegatesAria(require_vivid_element.VividElement) {
|
|
177
|
+
var TableSortingButton = class extends require_localized.Localized(require_delegates_aria.DelegatesAria(require_vivid_element.VividElement)) {
|
|
177
178
|
get #nextDirection() {
|
|
178
179
|
if (!this.direction || this.direction === "none") return "asc";
|
|
179
180
|
else if (this.direction === "asc") return "desc";
|
|
@@ -193,14 +194,26 @@ var TableSortingButton = class extends require_delegates_aria.DelegatesAria(requ
|
|
|
193
194
|
require_decorate.__decorate([_microsoft_fast_element.attr], TableSortingButton.prototype, "direction", void 0);
|
|
194
195
|
//#endregion
|
|
195
196
|
//#region src/lib/table/table-sorting-button.template.ts
|
|
197
|
+
var getSortStateKey = (x) => {
|
|
198
|
+
switch (x.direction) {
|
|
199
|
+
case "asc": return "ascending";
|
|
200
|
+
case "desc": return "descending";
|
|
201
|
+
default: return "none";
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var getSortAnnouncement = (x) => {
|
|
205
|
+
const key = getSortStateKey(x);
|
|
206
|
+
const { sortStatus, sortInstruction } = x.locale.tableSortingButton;
|
|
207
|
+
return `${sortStatus[key]} ${sortInstruction[key]}`;
|
|
208
|
+
};
|
|
196
209
|
var TableSortingButtonTemplate = (context) => {
|
|
197
210
|
const iconTag = context.tagFor(require_icon.Icon);
|
|
198
211
|
return _microsoft_fast_element.html`
|
|
199
|
-
<template
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
212
|
+
<template @click="${(x) => x.toggleSort()}">
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
${require_delegates_aria.delegateAria({ ariaLabel: (x) => x.ariaLabel || getSortAnnouncement(x) })}
|
|
216
|
+
>
|
|
204
217
|
${(x) => {
|
|
205
218
|
switch (x.direction) {
|
|
206
219
|
case "asc": return _microsoft_fast_element.html`<${iconTag} name="sort-asc-line"></${iconTag}>`;
|
|
@@ -2,7 +2,8 @@ import { d as createRegisterFunction, t as VividElement, u as defineVividCompone
|
|
|
2
2
|
import { t as iconDefinition } from "./definition.js";
|
|
3
3
|
import { t as __decorate } from "./decorate.js";
|
|
4
4
|
import { t as Icon } from "./icon.js";
|
|
5
|
-
import { t as DelegatesAria } from "./delegates-aria.js";
|
|
5
|
+
import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
|
|
6
|
+
import { t as Localized } from "./localized.js";
|
|
6
7
|
import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
|
|
7
8
|
import { t as DataGridCellRole } from "./data-grid.options.js";
|
|
8
9
|
import { attr, html } from "@microsoft/fast-element";
|
|
@@ -173,7 +174,7 @@ var TableCellTemplate = () => {
|
|
|
173
174
|
* @component table-sorting-button
|
|
174
175
|
* @event {CustomEvent<undefined>} sort - Emitted when sorting button is clicked.
|
|
175
176
|
*/
|
|
176
|
-
var TableSortingButton = class extends DelegatesAria(VividElement) {
|
|
177
|
+
var TableSortingButton = class extends Localized(DelegatesAria(VividElement)) {
|
|
177
178
|
get #nextDirection() {
|
|
178
179
|
if (!this.direction || this.direction === "none") return "asc";
|
|
179
180
|
else if (this.direction === "asc") return "desc";
|
|
@@ -193,14 +194,26 @@ var TableSortingButton = class extends DelegatesAria(VividElement) {
|
|
|
193
194
|
__decorate([attr], TableSortingButton.prototype, "direction", void 0);
|
|
194
195
|
//#endregion
|
|
195
196
|
//#region src/lib/table/table-sorting-button.template.ts
|
|
197
|
+
var getSortStateKey = (x) => {
|
|
198
|
+
switch (x.direction) {
|
|
199
|
+
case "asc": return "ascending";
|
|
200
|
+
case "desc": return "descending";
|
|
201
|
+
default: return "none";
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var getSortAnnouncement = (x) => {
|
|
205
|
+
const key = getSortStateKey(x);
|
|
206
|
+
const { sortStatus, sortInstruction } = x.locale.tableSortingButton;
|
|
207
|
+
return `${sortStatus[key]} ${sortInstruction[key]}`;
|
|
208
|
+
};
|
|
196
209
|
var TableSortingButtonTemplate = (context) => {
|
|
197
210
|
const iconTag = context.tagFor(Icon);
|
|
198
211
|
return html`
|
|
199
|
-
<template
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
212
|
+
<template @click="${(x) => x.toggleSort()}">
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
${delegateAria({ ariaLabel: (x) => x.ariaLabel || getSortAnnouncement(x) })}
|
|
216
|
+
>
|
|
204
217
|
${(x) => {
|
|
205
218
|
switch (x.direction) {
|
|
206
219
|
case "asc": return html`<${iconTag} name="sort-asc-line"></${iconTag}>`;
|
|
@@ -35,8 +35,8 @@ var CONNOTATION_ICON_MAP = {
|
|
|
35
35
|
* @slot main - The main content of the Alert.
|
|
36
36
|
* @slot action-items - Add action items to the Alert using this slot.
|
|
37
37
|
* @slot icon - The preferred way to add an icon to the component.
|
|
38
|
-
* @event {CustomEvent<undefined>} open - Fired when the Alert is opened
|
|
39
|
-
* @event {CustomEvent<undefined>} close - Fired when the Alert is closed
|
|
38
|
+
* @event {CustomEvent<undefined>} open - Fired when the Alert is opened.
|
|
39
|
+
* @event {CustomEvent<undefined>} close - Fired when the Alert is closed.
|
|
40
40
|
* @testSelector byHeadline byHeadline
|
|
41
41
|
* @testQuery open open true
|
|
42
42
|
* @testQuery closed open false
|
package/unbundled/definition8.js
CHANGED
|
@@ -35,8 +35,8 @@ var CONNOTATION_ICON_MAP = {
|
|
|
35
35
|
* @slot main - The main content of the Alert.
|
|
36
36
|
* @slot action-items - Add action items to the Alert using this slot.
|
|
37
37
|
* @slot icon - The preferred way to add an icon to the component.
|
|
38
|
-
* @event {CustomEvent<undefined>} open - Fired when the Alert is opened
|
|
39
|
-
* @event {CustomEvent<undefined>} close - Fired when the Alert is closed
|
|
38
|
+
* @event {CustomEvent<undefined>} open - Fired when the Alert is opened.
|
|
39
|
+
* @event {CustomEvent<undefined>} close - Fired when the Alert is closed.
|
|
40
40
|
* @testSelector byHeadline byHeadline
|
|
41
41
|
* @testQuery open open true
|
|
42
42
|
* @testQuery closed open false
|