@coveo/quantic 3.30.3-pre.a2ee91c3b9 → 3.30.3-pre.a55b5cf74a
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/markdownUtils.js +3 -16
- package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +17 -105
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +8 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/navigator-context-provider.d.ts +0 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/knowledge/generated-answer/headless-answerapi-generated-answer-mocks.d.ts +743 -25
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-selectors.d.ts +0 -7
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-request.d.ts +0 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-selectors.d.ts +0 -25
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +0 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/engine/commerce-engine.ssr.d.ts +3 -9
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/build-factory.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/recommendation-static-state-factory.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +5 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/utils/engine-wiring.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +4 -10
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/build.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/fetch-static-state.d.ts +1 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/hydrate-static-state.d.ts +1 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next.index.d.ts +5 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/utils/utils.d.ts +0 -3
- 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
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-selectors.d.ts +0 -51
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-selectors.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-selectors.d.ts +0 -26
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-selectors.d.ts +0 -9
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-selectors.d.ts +0 -26
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-context.d.ts +0 -2
|
@@ -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 {String} text
|
|
50
|
-
* @returns {string} The escaped HTML string.
|
|
51
|
-
*/
|
|
52
44
|
const escapeHtml = (text) => {
|
|
53
45
|
return text
|
|
54
46
|
.replace(/&/g, '&')
|
|
@@ -58,10 +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
|
-
* See: https://marked.js.org/using_pro
|
|
64
|
-
*/
|
|
65
53
|
const customRenderer = {
|
|
66
54
|
code(code) {
|
|
67
55
|
return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
@@ -71,7 +59,6 @@ const customRenderer = {
|
|
|
71
59
|
* Custom Marked renderer to replace heading elements with div elements.
|
|
72
60
|
* @param {string} text
|
|
73
61
|
* @param {string} level
|
|
74
|
-
* @return {string} The heading element to render.
|
|
75
62
|
*/
|
|
76
63
|
heading(text, level) {
|
|
77
64
|
const plainText = toInlinePlainText(text);
|
|
@@ -82,7 +69,7 @@ const customRenderer = {
|
|
|
82
69
|
/**
|
|
83
70
|
* Returns escaped HTML.
|
|
84
71
|
* @param {string} text
|
|
85
|
-
* @returns
|
|
72
|
+
* @returns
|
|
86
73
|
*/
|
|
87
74
|
html(text) {
|
|
88
75
|
return escapeHtml(text);
|
|
@@ -132,7 +119,7 @@ const transformMarkdownToHtml = (text, marked) => {
|
|
|
132
119
|
|
|
133
120
|
/**
|
|
134
121
|
* Load the libraries Marked and DOMPurify.
|
|
135
|
-
* @param
|
|
122
|
+
* @param element
|
|
136
123
|
* @returns {Promise<any>}
|
|
137
124
|
*/
|
|
138
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 {string|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 {String} 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,7 +565,6 @@ 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
|
|
@@ -655,7 +577,6 @@ export class Store {
|
|
|
655
577
|
}
|
|
656
578
|
|
|
657
579
|
/**
|
|
658
|
-
* Registers sort option data to the store.
|
|
659
580
|
* @param {Record<String, any>} store
|
|
660
581
|
* @param {Array<{label: string; value: string; criterion: SortCriterion;}>} data
|
|
661
582
|
*/
|
|
@@ -664,19 +585,15 @@ export class Store {
|
|
|
664
585
|
}
|
|
665
586
|
|
|
666
587
|
/**
|
|
667
|
-
* Gets facet data from the store.
|
|
668
588
|
* @param {Record<String, unknown>} store
|
|
669
589
|
* @param {string} facetType
|
|
670
|
-
* @return {Object} The facet data.
|
|
671
590
|
*/
|
|
672
591
|
static getFromStore(store, facetType) {
|
|
673
592
|
return store.state[facetType];
|
|
674
593
|
}
|
|
675
594
|
|
|
676
595
|
/**
|
|
677
|
-
* Gets sort options from the store.
|
|
678
596
|
* @param {Record<String, Object>} store
|
|
679
|
-
* @return {Array} The sort options.
|
|
680
597
|
*/
|
|
681
598
|
static getSortOptionsFromStore(store) {
|
|
682
599
|
return store.state.sort;
|
|
@@ -695,7 +612,7 @@ export class Store {
|
|
|
695
612
|
* @param {string} regionName
|
|
696
613
|
* @param {Object} elem
|
|
697
614
|
* @param {boolean} assertive
|
|
698
|
-
* @returns {AriaLiveUtils}
|
|
615
|
+
* @returns {AriaLiveUtils}
|
|
699
616
|
*/
|
|
700
617
|
export function AriaLiveRegion(regionName, elem, assertive = false) {
|
|
701
618
|
function dispatchMessage(message) {
|
|
@@ -846,7 +763,6 @@ export function isCustomElement(element) {
|
|
|
846
763
|
/**
|
|
847
764
|
* Returns the last focusable element in an HTML slot.
|
|
848
765
|
* @param {HTMLElement & {assignedElements?: () => Array<HTMLElement> | null}} slotElement
|
|
849
|
-
* @returns {HTMLElement | null}
|
|
850
766
|
*/
|
|
851
767
|
function getLastFocusableElementFromSlot(slotElement) {
|
|
852
768
|
if (!slotElement && slotElement.assignedElements) {
|
|
@@ -866,7 +782,6 @@ function getLastFocusableElementFromSlot(slotElement) {
|
|
|
866
782
|
/**
|
|
867
783
|
* Returns the first focusable element in an HTML slot.
|
|
868
784
|
* @param {HTMLElement & {assignedElements?: () => Array<HTMLElement> | null}} slotElement
|
|
869
|
-
* @return {HTMLElement | null}
|
|
870
785
|
*/
|
|
871
786
|
function getFirstFocusableElementFromSlot(slotElement) {
|
|
872
787
|
if (!slotElement && slotElement.assignedElements) {
|
|
@@ -887,7 +802,6 @@ function getFirstFocusableElementFromSlot(slotElement) {
|
|
|
887
802
|
* Checks whether an element is indeed the targetElement or one of its parents.
|
|
888
803
|
* @param {HTMLElement} element
|
|
889
804
|
* @param {string} targetElement
|
|
890
|
-
* @returns {boolean}
|
|
891
805
|
*/
|
|
892
806
|
export function isParentOf(element, targetElement) {
|
|
893
807
|
if (!element || element.nodeType === Node.TEXT_NODE) {
|
|
@@ -913,7 +827,6 @@ export function isParentOf(element, targetElement) {
|
|
|
913
827
|
* Copies text to clipboard using the Clipboard API.
|
|
914
828
|
* https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
|
|
915
829
|
* @param {string} text
|
|
916
|
-
* @return {Promise<void>}
|
|
917
830
|
*/
|
|
918
831
|
export async function copyToClipboard(text) {
|
|
919
832
|
try {
|
|
@@ -940,7 +853,6 @@ export function copyToClipboardFallback(text) {
|
|
|
940
853
|
* Read the value of a given key from an object.
|
|
941
854
|
* @param {object} object
|
|
942
855
|
* @param {string} key
|
|
943
|
-
* @return {object | undefined} The value of the key.
|
|
944
856
|
*/
|
|
945
857
|
export function readFromObject(object, key) {
|
|
946
858
|
const firstPeriodIndex = key.indexOf('.');
|
|
@@ -986,9 +898,9 @@ export function getElementPadding(element) {
|
|
|
986
898
|
}
|
|
987
899
|
|
|
988
900
|
/**
|
|
989
|
-
* Returns the absolute
|
|
901
|
+
* Returns the absolute width of an element.
|
|
990
902
|
* @param {Element} element
|
|
991
|
-
* @returns {number}
|
|
903
|
+
* @returns {number}
|
|
992
904
|
*/
|
|
993
905
|
export function getAbsoluteHeight(element) {
|
|
994
906
|
if (!element) {
|
|
@@ -1004,7 +916,7 @@ export function getAbsoluteHeight(element) {
|
|
|
1004
916
|
/**
|
|
1005
917
|
* Returns the absolute width of an element.
|
|
1006
918
|
* @param {Element} element
|
|
1007
|
-
* @returns {number}
|
|
919
|
+
* @returns {number}
|
|
1008
920
|
*/
|
|
1009
921
|
export function getAbsoluteWidth(element) {
|
|
1010
922
|
if (!element) {
|