@coveo/quantic 3.30.3-pre.47e6fff72f → 3.30.3-pre.4a92f43c77
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/force-app/main/default/lwc/quanticUtils/facetDependenciesUtils.js +0 -2
- package/force-app/main/default/lwc/quanticUtils/markdownUtils.js +3 -18
- package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +17 -108
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +8 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/knowledge/generated-answer/headless-answerapi-generated-answer-mocks.d.ts +904 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-selectors.d.ts +51 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-selectors.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-selectors.d.ts +26 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-selectors.d.ts +7 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-selectors.d.ts +9 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-request.d.ts +16 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-selectors.d.ts +25 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-selectors.d.ts +26 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
- package/package.json +2 -2
|
@@ -79,7 +79,6 @@ export function generateFacetDependencyConditions(dependsOn) {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Type guard to check if the provided value is a CategoryFacetValue.
|
|
82
|
-
* @param {CategoryFacetValue} value - The value to check.
|
|
83
82
|
* @returns {boolean} True if the value is a CategoryFacetValue.
|
|
84
83
|
*/
|
|
85
84
|
function isCategoryFacetValue(value) {
|
|
@@ -113,7 +112,6 @@ function getSelectedCategoryFacetValueRequest(value) {
|
|
|
113
112
|
|
|
114
113
|
/**
|
|
115
114
|
* Type guard to check if the provided value is a SimpleFacetValue.
|
|
116
|
-
* @param {SimpleFacetValue} facetValue - The value to check.
|
|
117
115
|
* @returns {boolean} True if the value is a SimpleFacetValue.
|
|
118
116
|
*/
|
|
119
117
|
function isSimpleFacetValue(facetValue) {
|
|
@@ -7,9 +7,6 @@ import {loadScript} from 'lightning/platformResourceLoader';
|
|
|
7
7
|
* Transforms a single line of text that may contain HTML to plain text.
|
|
8
8
|
* @param {string} textWithHtml A single line of text that may contain HTML
|
|
9
9
|
* @returns {string} The value as plain text
|
|
10
|
-
* @example
|
|
11
|
-
* toInlinePlainText('<p>Hello <strong>World</strong></p>');
|
|
12
|
-
* // Returns: 'Hello World'
|
|
13
10
|
*/
|
|
14
11
|
const toInlinePlainText = (textWithHtml) => {
|
|
15
12
|
const withoutHtmlTags = textWithHtml.replace(/<[^>]*>/g, ' ');
|
|
@@ -24,7 +21,7 @@ const unclosedElement = /(\*{1,3}|`)($|\w[\w\s]*$)/;
|
|
|
24
21
|
/**
|
|
25
22
|
* Complete unclosed elements such as bold, italic, and code.
|
|
26
23
|
* @param {string} text
|
|
27
|
-
* @returns {string}
|
|
24
|
+
* @returns {string}
|
|
28
25
|
*/
|
|
29
26
|
const completeUnclosedElement = (text) => {
|
|
30
27
|
const match = unclosedElement.exec(text);
|
|
@@ -44,11 +41,6 @@ const completeUnclosedElement = (text) => {
|
|
|
44
41
|
return text;
|
|
45
42
|
};
|
|
46
43
|
|
|
47
|
-
/**
|
|
48
|
-
* Escape HTML special characters in a string.
|
|
49
|
-
* @param {*} text
|
|
50
|
-
* @returns {string} The escaped HTML string.
|
|
51
|
-
*/
|
|
52
44
|
const escapeHtml = (text) => {
|
|
53
45
|
return text
|
|
54
46
|
.replace(/&/g, '&')
|
|
@@ -58,12 +50,6 @@ const escapeHtml = (text) => {
|
|
|
58
50
|
.replace(/'/g, ''');
|
|
59
51
|
};
|
|
60
52
|
|
|
61
|
-
/**
|
|
62
|
-
* Custom Marked renderer to override the default rendering of certain elements.
|
|
63
|
-
* @type {object}
|
|
64
|
-
* @property {Function} code
|
|
65
|
-
* @returns {string} The code block element to render.
|
|
66
|
-
*/
|
|
67
53
|
const customRenderer = {
|
|
68
54
|
code(code) {
|
|
69
55
|
return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
@@ -73,7 +59,6 @@ const customRenderer = {
|
|
|
73
59
|
* Custom Marked renderer to replace heading elements with div elements.
|
|
74
60
|
* @param {string} text
|
|
75
61
|
* @param {string} level
|
|
76
|
-
* @return {string} The heading element to render.
|
|
77
62
|
*/
|
|
78
63
|
heading(text, level) {
|
|
79
64
|
const plainText = toInlinePlainText(text);
|
|
@@ -84,7 +69,7 @@ const customRenderer = {
|
|
|
84
69
|
/**
|
|
85
70
|
* Returns escaped HTML.
|
|
86
71
|
* @param {string} text
|
|
87
|
-
* @returns
|
|
72
|
+
* @returns
|
|
88
73
|
*/
|
|
89
74
|
html(text) {
|
|
90
75
|
return escapeHtml(text);
|
|
@@ -134,7 +119,7 @@ const transformMarkdownToHtml = (text, marked) => {
|
|
|
134
119
|
|
|
135
120
|
/**
|
|
136
121
|
* Load the libraries Marked and DOMPurify.
|
|
137
|
-
* @param
|
|
122
|
+
* @param element
|
|
138
123
|
* @returns {Promise<any>}
|
|
139
124
|
*/
|
|
140
125
|
const loadMarkdownDependencies = (element) => {
|
|
@@ -37,9 +37,6 @@ export * from './markdownUtils';
|
|
|
37
37
|
export * from './facetDependenciesUtils';
|
|
38
38
|
export * from './citationAnchoringUtils';
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Utility class for debouncing function calls.
|
|
42
|
-
*/
|
|
43
40
|
export class Debouncer {
|
|
44
41
|
_timeout;
|
|
45
42
|
|
|
@@ -93,18 +90,14 @@ export class Deferred {
|
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
/**
|
|
97
|
-
* Utility class for working with search results and binding analytics events.
|
|
98
|
-
*/
|
|
99
93
|
export class ResultUtils {
|
|
100
94
|
/**
|
|
101
|
-
* Binds
|
|
95
|
+
* Binds the logging of document
|
|
96
|
+
* @returns An unbind function for the events
|
|
102
97
|
* @param {import("coveo").SearchEngine} engine An instance of an Headless Engine
|
|
103
98
|
* @param {import("coveo").Result} result The result object
|
|
104
99
|
* @param {import("lwc").ShadowRootTheGoodPart} resultElement Parent result element
|
|
105
|
-
* @param {Function} controllerBuilder Function to build the interactive result controller.
|
|
106
100
|
* @param {string} selector Optional. Css selector that selects all links to the document. Default: "a" tags with the clickUri as "href" parameter.
|
|
107
|
-
* @returns An unbind function for the events
|
|
108
101
|
*/
|
|
109
102
|
static bindClickEventsOnResult(
|
|
110
103
|
engine,
|
|
@@ -144,15 +137,12 @@ export class ResultUtils {
|
|
|
144
137
|
}
|
|
145
138
|
}
|
|
146
139
|
|
|
147
|
-
/**
|
|
148
|
-
* Utility class for link operations and analytics binding.
|
|
149
|
-
*/
|
|
150
140
|
export class LinkUtils {
|
|
151
141
|
/**
|
|
152
142
|
* Binds the logging of a link
|
|
143
|
+
* @returns An unbind function for the events
|
|
153
144
|
* @param {HTMLAnchorElement} link the link element
|
|
154
145
|
* @param {{select:function, beginDelayedSelect: function, cancelPendingSelect: function }} actions
|
|
155
|
-
* @returns An unbind function for the events
|
|
156
146
|
*/
|
|
157
147
|
static bindAnalyticsToLink(link, actions) {
|
|
158
148
|
const eventsMap = {
|
|
@@ -175,9 +165,6 @@ export class LinkUtils {
|
|
|
175
165
|
}
|
|
176
166
|
}
|
|
177
167
|
|
|
178
|
-
/**
|
|
179
|
-
* Utility class for internationalization and localization.
|
|
180
|
-
*/
|
|
181
168
|
export class I18nUtils {
|
|
182
169
|
static getTextWithDecorator(text, startTag, endTag) {
|
|
183
170
|
return `${startTag}${text}${endTag}`;
|
|
@@ -191,13 +178,6 @@ export class I18nUtils {
|
|
|
191
178
|
return new Intl.PluralRules(LOCALE).select(count) === 'one';
|
|
192
179
|
}
|
|
193
180
|
|
|
194
|
-
/**
|
|
195
|
-
* Gets the label name with count.
|
|
196
|
-
* @param {string} labelName
|
|
197
|
-
* @param {number} count
|
|
198
|
-
* @returns {string} The label name with count.
|
|
199
|
-
* @example `labelName_zero`, `labelName_plural` or `labelName`
|
|
200
|
-
*/
|
|
201
181
|
static getLabelNameWithCount(labelName, count) {
|
|
202
182
|
if (count === 0) {
|
|
203
183
|
return `${labelName}_zero`;
|
|
@@ -207,16 +187,6 @@ export class I18nUtils {
|
|
|
207
187
|
return labelName;
|
|
208
188
|
}
|
|
209
189
|
|
|
210
|
-
/**
|
|
211
|
-
* Formats a string with the given arguments.
|
|
212
|
-
* @param {*} stringToFormat
|
|
213
|
-
* @param {...any} formattingArguments
|
|
214
|
-
* @returns {string} The formatted string.
|
|
215
|
-
* @throws {Error} If string format is not a string.
|
|
216
|
-
* @example
|
|
217
|
-
* I18nUtils.format('Hello {{0}}, you have {{1}} new messages', 'John', 5);
|
|
218
|
-
* returns 'Hello John, you have 5 new messages'
|
|
219
|
-
*/
|
|
220
190
|
static format(stringToFormat, ...formattingArguments) {
|
|
221
191
|
if (typeof stringToFormat !== 'string')
|
|
222
192
|
throw new Error("'stringToFormat' must be a String");
|
|
@@ -227,11 +197,6 @@ export class I18nUtils {
|
|
|
227
197
|
);
|
|
228
198
|
}
|
|
229
199
|
|
|
230
|
-
/**
|
|
231
|
-
* Gets the short date pattern for the current locale.
|
|
232
|
-
* @returns {string} The short date pattern.
|
|
233
|
-
* @example `M/d/yyyy` for `en-US`, `d/M/yyyy` for `fr-FR`, etc.
|
|
234
|
-
*/
|
|
235
200
|
static getShortDatePattern() {
|
|
236
201
|
const date = new Date(2000, 2, 4); // month is zero-based
|
|
237
202
|
const dateAsString = I18nUtils.formatDate(date);
|
|
@@ -250,13 +215,11 @@ export class I18nUtils {
|
|
|
250
215
|
}
|
|
251
216
|
|
|
252
217
|
/**
|
|
253
|
-
* Formats the date in the current locale.
|
|
254
218
|
* @param {Date} date
|
|
255
|
-
* @returns {string} The formatted date.
|
|
256
219
|
*/
|
|
257
220
|
static formatDate(date) {
|
|
258
|
-
const
|
|
259
|
-
return
|
|
221
|
+
const result = new Intl.DateTimeFormat(LOCALE).format(date);
|
|
222
|
+
return result;
|
|
260
223
|
}
|
|
261
224
|
|
|
262
225
|
/**
|
|
@@ -264,24 +227,15 @@ export class I18nUtils {
|
|
|
264
227
|
* @returns {string}
|
|
265
228
|
*/
|
|
266
229
|
static escapeHTML(html) {
|
|
267
|
-
|
|
230
|
+
var escape = document.createElement('textarea');
|
|
268
231
|
escape.textContent = html;
|
|
269
232
|
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
270
233
|
return escape.innerHTML;
|
|
271
234
|
}
|
|
272
235
|
}
|
|
273
236
|
|
|
274
|
-
/**
|
|
275
|
-
* Storage key for standalone search box configuration.
|
|
276
|
-
* @constant {string}
|
|
277
|
-
*/
|
|
278
237
|
export const STANDALONE_SEARCH_BOX_STORAGE_KEY = 'coveo-standalone-search-box';
|
|
279
238
|
|
|
280
|
-
/**
|
|
281
|
-
* Key codes for common keyboard interactions.
|
|
282
|
-
* @readonly
|
|
283
|
-
* @enum {string}
|
|
284
|
-
*/
|
|
285
239
|
export const keys = {
|
|
286
240
|
ESC: 'Escape',
|
|
287
241
|
TAB: 'Tab',
|
|
@@ -305,24 +259,15 @@ export function setItemInLocalStorage(key, item) {
|
|
|
305
259
|
/**
|
|
306
260
|
* Replace char found in pattern with \\$&
|
|
307
261
|
* @param {string} value
|
|
308
|
-
* @return {string}
|
|
309
262
|
*/
|
|
310
263
|
export function regexEncode(value) {
|
|
311
264
|
return value.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
|
|
312
265
|
}
|
|
313
|
-
|
|
314
|
-
* Parses an XML string into a DOM Document.
|
|
315
|
-
* @param {string} string
|
|
316
|
-
* @returns {Document}
|
|
317
|
-
*/
|
|
266
|
+
|
|
318
267
|
export function parseXML(string) {
|
|
319
268
|
return new window.DOMParser().parseFromString(string, 'text/xml');
|
|
320
269
|
}
|
|
321
270
|
|
|
322
|
-
/**
|
|
323
|
-
* Utility class for time-based calculations and formatting.
|
|
324
|
-
* Provides methods to convert between different time units and format durations.
|
|
325
|
-
*/
|
|
326
271
|
export class TimeSpan {
|
|
327
272
|
constructor(time, isMilliseconds = true) {
|
|
328
273
|
if (isMilliseconds) {
|
|
@@ -399,10 +344,6 @@ export class TimeSpan {
|
|
|
399
344
|
}
|
|
400
345
|
}
|
|
401
346
|
|
|
402
|
-
/**
|
|
403
|
-
* Utility class for date operations and formatting.
|
|
404
|
-
* Handles conversion between different date formats and provides parsing utilities.
|
|
405
|
-
*/
|
|
406
347
|
export class DateUtils {
|
|
407
348
|
/**
|
|
408
349
|
* Converts a date string from the Coveo Search API format to the ISO-8601 format.
|
|
@@ -450,7 +391,6 @@ export class DateUtils {
|
|
|
450
391
|
* @param {number} hours The local hours to set on the date.
|
|
451
392
|
* @param {number} minutes The local minutes to set on the date.
|
|
452
393
|
* @param {number} seconds The local seconds to set on the date.
|
|
453
|
-
* @throws {Error} If specified time is invalid.
|
|
454
394
|
* @returns {Date} The parsed date.
|
|
455
395
|
*/
|
|
456
396
|
static fromLocalIsoDate(dateString, hours, minutes, seconds) {
|
|
@@ -478,11 +418,6 @@ export class DateUtils {
|
|
|
478
418
|
return new Date(`${withoutTime}T${time}`);
|
|
479
419
|
}
|
|
480
420
|
|
|
481
|
-
/**
|
|
482
|
-
* Trims the time portion from an ISO 8601 date string.
|
|
483
|
-
* @param {string} dateString
|
|
484
|
-
* @returns {string}
|
|
485
|
-
*/
|
|
486
421
|
static trimIsoTime(dateString) {
|
|
487
422
|
const timeIdx = dateString.indexOf('T');
|
|
488
423
|
return timeIdx !== -1 ? dateString.substring(0, timeIdx) : dateString;
|
|
@@ -490,7 +425,6 @@ export class DateUtils {
|
|
|
490
425
|
|
|
491
426
|
/**
|
|
492
427
|
* @param {number} timestamp
|
|
493
|
-
* @returns {boolean}
|
|
494
428
|
*/
|
|
495
429
|
static isValidTimestamp(timestamp) {
|
|
496
430
|
let isValid = true;
|
|
@@ -505,6 +439,8 @@ export class DateUtils {
|
|
|
505
439
|
|
|
506
440
|
/**
|
|
507
441
|
* Parses a given timestamp into detailed date components.
|
|
442
|
+
*
|
|
443
|
+
* @function
|
|
508
444
|
* @param {number} timestamp - The timestamp in milliseconds since January 1, 1970 (epoch time).
|
|
509
445
|
* @returns {Object} An object containing the following date details:
|
|
510
446
|
* - {number} year - The four-digit year (e.g., 2024).
|
|
@@ -561,10 +497,6 @@ export function fromSearchApiDate(dateString) {
|
|
|
561
497
|
return DateUtils.fromSearchApiDate(dateString);
|
|
562
498
|
}
|
|
563
499
|
|
|
564
|
-
/**
|
|
565
|
-
* Formats relative date ranges into human-readable strings.
|
|
566
|
-
* Supports past and future date ranges with proper pluralization.
|
|
567
|
-
*/
|
|
568
500
|
export class RelativeDateFormatter {
|
|
569
501
|
constructor() {
|
|
570
502
|
this.singularIndex = 0;
|
|
@@ -587,15 +519,10 @@ export class RelativeDateFormatter {
|
|
|
587
519
|
}
|
|
588
520
|
|
|
589
521
|
/**
|
|
590
|
-
*
|
|
591
|
-
* @param {RelativeDate} begin
|
|
592
|
-
* @param {RelativeDate} end
|
|
593
|
-
* @returns {string}
|
|
594
|
-
* @throws {Error} If the provided relative date range is invalid.
|
|
595
|
-
* @example
|
|
596
|
-
* begin = { period: 'past', unit: 'day', amount: 2 };
|
|
597
|
-
* end = { period: 'now', unit: 'day', amount: 1 };
|
|
598
|
-
* Output: "2 days ago - 1 day ago"
|
|
522
|
+
*
|
|
523
|
+
* @param {RelativeDate} begin
|
|
524
|
+
* @param {RelativeDate} end
|
|
525
|
+
* @returns {string}
|
|
599
526
|
*/
|
|
600
527
|
formatRange(begin, end) {
|
|
601
528
|
const isPastRange = begin.period === 'past' && end.period === 'now';
|
|
@@ -619,10 +546,6 @@ export class RelativeDateFormatter {
|
|
|
619
546
|
}
|
|
620
547
|
}
|
|
621
548
|
|
|
622
|
-
/**
|
|
623
|
-
* Utility class for managing a simple in-memory store.
|
|
624
|
-
* Supports registering and retrieving facet and sort option data.
|
|
625
|
-
*/
|
|
626
549
|
export class Store {
|
|
627
550
|
static facetTypes = {
|
|
628
551
|
FACETS: 'facets',
|
|
@@ -642,11 +565,9 @@ export class Store {
|
|
|
642
565
|
};
|
|
643
566
|
}
|
|
644
567
|
/**
|
|
645
|
-
* Registers a facet to the store if it does not already exist.
|
|
646
568
|
* @param {Record<String, unknown>} store
|
|
647
569
|
* @param {string} facetType
|
|
648
570
|
* @param {{ label?: string; facetId: any; format?: Function;}} data
|
|
649
|
-
* @return {void}
|
|
650
571
|
*/
|
|
651
572
|
static registerFacetToStore(store, facetType, data) {
|
|
652
573
|
if (store?.state[facetType][data.facetId]) {
|
|
@@ -656,29 +577,23 @@ export class Store {
|
|
|
656
577
|
}
|
|
657
578
|
|
|
658
579
|
/**
|
|
659
|
-
* Registers sort option data to the store.
|
|
660
580
|
* @param {Record<String, any>} store
|
|
661
581
|
* @param {Array<{label: string; value: string; criterion: SortCriterion;}>} data
|
|
662
|
-
* @return {void}
|
|
663
582
|
*/
|
|
664
583
|
static registerSortOptionDataToStore(store, data) {
|
|
665
584
|
store.state.sort = data;
|
|
666
585
|
}
|
|
667
586
|
|
|
668
587
|
/**
|
|
669
|
-
* Gets facet data from the store.
|
|
670
588
|
* @param {Record<String, unknown>} store
|
|
671
589
|
* @param {string} facetType
|
|
672
|
-
* @return {Object} The facet data.
|
|
673
590
|
*/
|
|
674
591
|
static getFromStore(store, facetType) {
|
|
675
592
|
return store.state[facetType];
|
|
676
593
|
}
|
|
677
594
|
|
|
678
595
|
/**
|
|
679
|
-
* Gets sort options from the store.
|
|
680
596
|
* @param {Record<String, Object>} store
|
|
681
|
-
* @return {Array} The sort options.
|
|
682
597
|
*/
|
|
683
598
|
static getSortOptionsFromStore(store) {
|
|
684
599
|
return store.state.sort;
|
|
@@ -697,7 +612,7 @@ export class Store {
|
|
|
697
612
|
* @param {string} regionName
|
|
698
613
|
* @param {Object} elem
|
|
699
614
|
* @param {boolean} assertive
|
|
700
|
-
* @returns {AriaLiveUtils}
|
|
615
|
+
* @returns {AriaLiveUtils}
|
|
701
616
|
*/
|
|
702
617
|
export function AriaLiveRegion(regionName, elem, assertive = false) {
|
|
703
618
|
function dispatchMessage(message) {
|
|
@@ -848,7 +763,6 @@ export function isCustomElement(element) {
|
|
|
848
763
|
/**
|
|
849
764
|
* Returns the last focusable element in an HTML slot.
|
|
850
765
|
* @param {HTMLElement & {assignedElements?: () => Array<HTMLElement> | null}} slotElement
|
|
851
|
-
* @returns {HTMLElement | null}
|
|
852
766
|
*/
|
|
853
767
|
function getLastFocusableElementFromSlot(slotElement) {
|
|
854
768
|
if (!slotElement && slotElement.assignedElements) {
|
|
@@ -868,7 +782,6 @@ function getLastFocusableElementFromSlot(slotElement) {
|
|
|
868
782
|
/**
|
|
869
783
|
* Returns the first focusable element in an HTML slot.
|
|
870
784
|
* @param {HTMLElement & {assignedElements?: () => Array<HTMLElement> | null}} slotElement
|
|
871
|
-
* @return {HTMLElement | null}
|
|
872
785
|
*/
|
|
873
786
|
function getFirstFocusableElementFromSlot(slotElement) {
|
|
874
787
|
if (!slotElement && slotElement.assignedElements) {
|
|
@@ -889,7 +802,6 @@ function getFirstFocusableElementFromSlot(slotElement) {
|
|
|
889
802
|
* Checks whether an element is indeed the targetElement or one of its parents.
|
|
890
803
|
* @param {HTMLElement} element
|
|
891
804
|
* @param {string} targetElement
|
|
892
|
-
* @returns {boolean}
|
|
893
805
|
*/
|
|
894
806
|
export function isParentOf(element, targetElement) {
|
|
895
807
|
if (!element || element.nodeType === Node.TEXT_NODE) {
|
|
@@ -915,7 +827,6 @@ export function isParentOf(element, targetElement) {
|
|
|
915
827
|
* Copies text to clipboard using the Clipboard API.
|
|
916
828
|
* https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
|
|
917
829
|
* @param {string} text
|
|
918
|
-
* @return {Promise<void>}
|
|
919
830
|
*/
|
|
920
831
|
export async function copyToClipboard(text) {
|
|
921
832
|
try {
|
|
@@ -928,7 +839,6 @@ export async function copyToClipboard(text) {
|
|
|
928
839
|
/**
|
|
929
840
|
* Copies text to clipboard using the DOM.
|
|
930
841
|
* @param {string} text
|
|
931
|
-
* @return {void}
|
|
932
842
|
*/
|
|
933
843
|
export function copyToClipboardFallback(text) {
|
|
934
844
|
const el = document.createElement('textarea');
|
|
@@ -943,7 +853,6 @@ export function copyToClipboardFallback(text) {
|
|
|
943
853
|
* Read the value of a given key from an object.
|
|
944
854
|
* @param {object} object
|
|
945
855
|
* @param {string} key
|
|
946
|
-
* @return {object | undefined} The value of the key.
|
|
947
856
|
*/
|
|
948
857
|
export function readFromObject(object, key) {
|
|
949
858
|
const firstPeriodIndex = key.indexOf('.');
|
|
@@ -989,9 +898,9 @@ export function getElementPadding(element) {
|
|
|
989
898
|
}
|
|
990
899
|
|
|
991
900
|
/**
|
|
992
|
-
* Returns the absolute
|
|
901
|
+
* Returns the absolute width of an element.
|
|
993
902
|
* @param {Element} element
|
|
994
|
-
* @returns {number}
|
|
903
|
+
* @returns {number}
|
|
995
904
|
*/
|
|
996
905
|
export function getAbsoluteHeight(element) {
|
|
997
906
|
if (!element) {
|
|
@@ -1007,7 +916,7 @@ export function getAbsoluteHeight(element) {
|
|
|
1007
916
|
/**
|
|
1008
917
|
* Returns the absolute width of an element.
|
|
1009
918
|
* @param {Element} element
|
|
1010
|
-
* @returns {number}
|
|
919
|
+
* @returns {number}
|
|
1011
920
|
*/
|
|
1012
921
|
export function getAbsoluteWidth(element) {
|
|
1013
922
|
if (!element) {
|