@coveo/atomic 3.52.0 → 3.53.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/README.md +0 -26
- package/custom-elements.json +34 -4
- package/dist/atomic/atomic.esm.js +0 -1
- package/dist/atomic/autoloader/index.cjs.js +2 -2
- package/dist/atomic/autoloader/index.esm.js +2 -2
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/fetch-product-context.js +14 -0
- package/dist/atomic/components/components/common/generated-answer/atomic-answer-content/atomic-answer-content.js +35 -9
- package/dist/atomic/components/components/common/generated-answer/feedback-button.js +2 -1
- package/dist/atomic/components/components/common/generated-answer/render-agent-generation-steps.js +34 -0
- package/dist/atomic/components/components/common/generated-answer/render-answer-content.js +7 -19
- package/dist/atomic/components/components/common/generated-answer/render-disclaimer.js +6 -7
- package/dist/atomic/components/components/common/generated-answer/styles/generated-answer.tw.css.js +1 -1
- package/dist/atomic/components/components/common/item-list/fetch-item-context.js +15 -0
- package/dist/atomic/components/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.js +7 -4
- package/dist/atomic/components/components/search/atomic-generated-answer/atomic-generated-answer.js +18 -13
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.d.ts +2 -3
- package/dist/atomic/components/index.js +8 -2
- package/dist/atomic/lang/cs.json +1 -1
- package/dist/atomic/lang/da.json +1 -1
- package/dist/atomic/lang/de.json +1 -1
- package/dist/atomic/lang/dev.json +1 -1
- package/dist/atomic/lang/el.json +1 -1
- package/dist/atomic/lang/en.json +1 -1
- package/dist/atomic/lang/es.json +1 -1
- package/dist/atomic/lang/fi.json +1 -1
- package/dist/atomic/lang/fr.json +1 -1
- package/dist/atomic/lang/hu.json +1 -1
- package/dist/atomic/lang/id.json +1 -1
- package/dist/atomic/lang/it.json +1 -1
- package/dist/atomic/lang/ja.json +1 -1
- package/dist/atomic/lang/ko.json +1 -1
- package/dist/atomic/lang/nl.json +1 -1
- package/dist/atomic/lang/no.json +1 -1
- package/dist/atomic/lang/pl.json +1 -1
- package/dist/atomic/lang/pt-BR.json +1 -1
- package/dist/atomic/lang/pt.json +1 -1
- package/dist/atomic/lang/ru.json +1 -1
- package/dist/atomic/lang/sv.json +1 -1
- package/dist/atomic/lang/th.json +1 -1
- package/dist/atomic/lang/tr.json +1 -1
- package/dist/atomic/lang/zh-CN.json +1 -1
- package/dist/atomic/lang/zh-TW.json +1 -1
- package/dist/atomic/lang/zh.json +1 -1
- package/dist/atomic/loader/index.d.ts +4 -15
- package/dist/atomic/loader/index.js +0 -1
- package/dist/cjs/index.cjs.js +5 -2
- package/dist/cjs/loader.cjs.js +7 -4
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +9 -5
- package/dist/esm/version.js +2 -2
- package/dist/types/components/common/generated-answer/atomic-answer-content/atomic-answer-content.d.ts +3 -1
- package/dist/types/components/common/generated-answer/atomic-generated-answers-thread/atomic-generated-answers-thread.d.ts +1 -1
- package/dist/types/components/common/generated-answer/render-agent-generation-steps.d.ts +16 -0
- package/dist/types/components/common/generated-answer/render-answer-content.d.ts +3 -4
- package/dist/types/components/common/generated-answer/render-disclaimer.d.ts +0 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +17 -31
- package/dist/atomic/_atomic.esm.js +0 -2
- package/dist/atomic/atomic.esm.js.map +0 -1
- package/dist/atomic/components/_index.d.ts +0 -36
- package/dist/atomic/components/_index.js +0 -219
- package/dist/atomic/components/index.js.map +0 -1
- package/dist/atomic/index.esm.js +0 -2
- package/dist/atomic/index.esm.js.map +0 -1
- package/dist/atomic/loader/cdn.js +0 -1
- package/dist/atomic/loader/index.cjs.js +0 -1
- package/dist/atomic/loader/index.es2017.js +0 -1
- package/dist/atomic/p-998f7983.js +0 -3
- package/dist/atomic/p-998f7983.js.map +0 -1
- package/dist/cjs/_index.cjs.js +0 -236
- package/dist/cjs/_loader.cjs.js +0 -16
- package/dist/cjs/app-globals-18f43c37.js +0 -506
- package/dist/cjs/app-globals-18f43c37.js.map +0 -1
- package/dist/cjs/atomic.cjs.js +0 -26
- package/dist/cjs/atomic.cjs.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/esm/_index.js +0 -218
- package/dist/esm/_loader.js +0 -12
- package/dist/esm/app-globals-c5b073da.js +0 -481
- package/dist/esm/app-globals-c5b073da.js.map +0 -1
- package/dist/esm/atomic.js +0 -21
- package/dist/esm/atomic.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/types/autoloader/index.d.ts +0 -1
- package/dist/types/components/common/layout/display-options.d.ts +0 -40
- package/dist/types/components/search/atomic-smart-snippet-feedback-modal/atomic-smart-snippet-feedback-modal.tw.css.d.ts +0 -2
- package/dist/types/components/search/result-template-component-utils/context/fetch-result-context.d.ts +0 -8
- package/dist/types/components.d.ts +0 -24
- package/dist/types/icons.d.ts +0 -4
- package/dist/types/lit-components.d.ts +0 -10
- package/dist/types/stencil-public-runtime.d.ts +0 -1674
- package/dist/types/types/custom-env.d.ts +0 -7
- package/dist/types/types/dayjs/locale.d.ts +0 -4
- package/dist/types/types/open-api.d.ts +0 -3
- package/dist/types/types/storybook.d.ts +0 -7
- package/docs/atomic-docs.d.ts +0 -435
- package/docs/atomic-docs.json +0 -10
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
-
export * from '@coveo/atomic-legacy/item-decorators';
|
|
3
|
-
import { buildInteractiveResult } from '@coveo/headless';
|
|
4
|
-
|
|
5
|
-
function closest(element, selector) {
|
|
6
|
-
if (!element) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
if (element.matches(selector)) {
|
|
10
|
-
return element;
|
|
11
|
-
}
|
|
12
|
-
if (element.parentNode instanceof ShadowRoot) {
|
|
13
|
-
return closest(element.parentNode.host, selector);
|
|
14
|
-
}
|
|
15
|
-
return closest(element.parentElement, selector);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function buildCustomEvent(name, detail) {
|
|
19
|
-
return new CustomEvent(name, {
|
|
20
|
-
detail,
|
|
21
|
-
// Event will bubble up the DOM until it is caught
|
|
22
|
-
bubbles: true,
|
|
23
|
-
// Allows to verify if event is caught (cancelled). If it's not caught, it won't be initialized.
|
|
24
|
-
cancelable: true,
|
|
25
|
-
// Allows to compose Atomic components inside one another, event will go across DOM/Shadow DOM
|
|
26
|
-
composed: true,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
class MissingParentError extends Error {
|
|
31
|
-
constructor(elementName, parentName) {
|
|
32
|
-
super(`The "${elementName}" element must be the child of an "${parentName}" element.`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const itemContextEventName = 'atomic/resolveResult';
|
|
37
|
-
function fetchItemContext(element, parentName) {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
const event = buildCustomEvent(itemContextEventName, (item) => {
|
|
40
|
-
return resolve(item);
|
|
41
|
-
});
|
|
42
|
-
element.dispatchEvent(event);
|
|
43
|
-
if (!closest(element, parentName)) {
|
|
44
|
-
reject(new MissingParentError(element.nodeName.toLowerCase(), parentName));
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Retrieves `Product` on a rendered `atomic-product`.
|
|
51
|
-
*
|
|
52
|
-
* This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.
|
|
53
|
-
*
|
|
54
|
-
* You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).
|
|
55
|
-
*
|
|
56
|
-
* @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.
|
|
57
|
-
* @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.
|
|
58
|
-
*/
|
|
59
|
-
function fetchProductContext(element) {
|
|
60
|
-
return fetchItemContext(element, 'atomic-product');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
|
65
|
-
*
|
|
66
|
-
* @param event Event sent from the registered query suggestions to the parent search box
|
|
67
|
-
* @param element Element on which to dispatch the event, which must be the child of a configured search box
|
|
68
|
-
* @param allowedSearchBoxElements Optional array of allowed search box element selectors
|
|
69
|
-
*
|
|
70
|
-
* @throws Error if the element is not a child of an allowed search box element
|
|
71
|
-
*/
|
|
72
|
-
const dispatchSearchBoxSuggestionsEvent = (event, element, allowedSearchBoxElements = searchBoxElements) => {
|
|
73
|
-
const interfaceElement = closest(element, searchBoxElements.join(', '));
|
|
74
|
-
if (!interfaceElement) {
|
|
75
|
-
throw new Error(`The "${element.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(', ')}`);
|
|
76
|
-
}
|
|
77
|
-
void dispatchSearchBoxSuggestionsEventEventually(interfaceElement, element, event);
|
|
78
|
-
};
|
|
79
|
-
const searchBoxElements = [
|
|
80
|
-
'atomic-search-box',
|
|
81
|
-
'atomic-insight-search-box',
|
|
82
|
-
'atomic-commerce-search-box',
|
|
83
|
-
];
|
|
84
|
-
const isLitElementLoosely = (candidate) => 'updateComplete' in candidate &&
|
|
85
|
-
candidate.updateComplete instanceof Promise;
|
|
86
|
-
const dispatchSearchBoxSuggestionsEventEventually = async (interfaceElement, element, event) => {
|
|
87
|
-
await customElements.whenDefined(interfaceElement.nodeName.toLowerCase());
|
|
88
|
-
if (isLitElementLoosely(interfaceElement)) {
|
|
89
|
-
await interfaceElement.updateComplete;
|
|
90
|
-
}
|
|
91
|
-
else if ('componentOnReady' in interfaceElement) {
|
|
92
|
-
await interfaceElement.componentOnReady();
|
|
93
|
-
}
|
|
94
|
-
element.dispatchEvent(buildCustomEvent('atomic/searchBoxSuggestion/register', event));
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Checks if a search box suggestion element has no query.
|
|
99
|
-
*
|
|
100
|
-
* @param el - The search box suggestion element to check
|
|
101
|
-
* @returns True if the element has no query or the query is whitespace-only
|
|
102
|
-
*/
|
|
103
|
-
function elementHasNoQuery(el) {
|
|
104
|
-
return !el.query || el.query.trim() === '';
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Checks if a search box suggestion element has a query.
|
|
108
|
-
*
|
|
109
|
-
* @param el - The search box suggestion element to check
|
|
110
|
-
* @returns True if the element has a non-empty, non-whitespace query
|
|
111
|
-
*/
|
|
112
|
-
function elementHasQuery(el) {
|
|
113
|
-
return !!el.query && el.query.trim() !== '';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function getWindow() {
|
|
117
|
-
return window;
|
|
118
|
-
}
|
|
119
|
-
function getInitQueueNamespace() {
|
|
120
|
-
if (!getWindow().initQueueNamespace) {
|
|
121
|
-
getWindow().initQueueNamespace = {
|
|
122
|
-
eventQueueMap: new Map(),
|
|
123
|
-
parentReadyMap: new Map(),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
return getWindow().initQueueNamespace;
|
|
127
|
-
}
|
|
128
|
-
function getEventQueueMap() {
|
|
129
|
-
return getInitQueueNamespace().eventQueueMap;
|
|
130
|
-
}
|
|
131
|
-
function getParentReadyMap() {
|
|
132
|
-
return getInitQueueNamespace().parentReadyMap;
|
|
133
|
-
}
|
|
134
|
-
function isParentReady(parent) {
|
|
135
|
-
const parentReadyMap = getParentReadyMap();
|
|
136
|
-
return parentReadyMap.get(parent) || false;
|
|
137
|
-
}
|
|
138
|
-
function queueEventForParent(parent, event, element) {
|
|
139
|
-
const eventQueueMap = getEventQueueMap();
|
|
140
|
-
if (!eventQueueMap.has(parent)) {
|
|
141
|
-
eventQueueMap.set(parent, []);
|
|
142
|
-
}
|
|
143
|
-
eventQueueMap.get(parent).push({ event, element });
|
|
144
|
-
}
|
|
145
|
-
function enqueueOrDispatchInitializationEvent(parent, event, element) {
|
|
146
|
-
if (isParentReady(parent)) {
|
|
147
|
-
element.dispatchEvent(event);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
queueEventForParent(parent, event, element);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Retrieves `Bindings` or `CommerceBindings` on a configured parent interface.
|
|
156
|
-
* @param event - The element on which to dispatch the event, which must be the child of a configured Atomic container element.
|
|
157
|
-
* @returns A promise that resolves upon initialization of the parent container element, and rejects otherwise.
|
|
158
|
-
*/
|
|
159
|
-
function fetchBindings(element) {
|
|
160
|
-
return new Promise((resolve, reject) => {
|
|
161
|
-
const event = buildCustomEvent(initializeEventName, (bindings) => resolve(bindings));
|
|
162
|
-
const parent = closest(element, initializableElements.join(', '));
|
|
163
|
-
if (!parent) {
|
|
164
|
-
reject(new MissingInterfaceParentError(element.nodeName.toLowerCase()));
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
enqueueOrDispatchInitializationEvent(parent, event, element);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
class MissingInterfaceParentError extends Error {
|
|
171
|
-
constructor(elementName) {
|
|
172
|
-
super(`The "${elementName}" element must be the child of the following elements: ${initializableElements.join(', ')}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const initializableElements = [
|
|
176
|
-
'atomic-recs-interface',
|
|
177
|
-
'atomic-search-interface',
|
|
178
|
-
'atomic-commerce-interface',
|
|
179
|
-
'atomic-commerce-recommendation-interface',
|
|
180
|
-
'atomic-relevance-inspector',
|
|
181
|
-
'atomic-insight-interface',
|
|
182
|
-
'atomic-external',
|
|
183
|
-
];
|
|
184
|
-
const initializeEventName = 'atomic/initializeComponent';
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Binds the logging of document
|
|
188
|
-
* @returns An unbind function for the events
|
|
189
|
-
* @param engine A headless search engine instance.
|
|
190
|
-
* @param result The result object
|
|
191
|
-
* @param resultElement Parent result element
|
|
192
|
-
* @param selector Optional. Css selector that selects all links to the document. Default: "a" tags with the clickUri as "href" parameter.
|
|
193
|
-
*/
|
|
194
|
-
function bindLogDocumentOpenOnResult(engine, result, resultElement, selector) {
|
|
195
|
-
const interactiveResult = buildInteractiveResult(engine, {
|
|
196
|
-
options: { result },
|
|
197
|
-
});
|
|
198
|
-
const eventsMap = {
|
|
199
|
-
contextmenu: () => interactiveResult.select(),
|
|
200
|
-
click: () => interactiveResult.select(),
|
|
201
|
-
mouseup: () => interactiveResult.select(),
|
|
202
|
-
mousedown: () => interactiveResult.select(),
|
|
203
|
-
touchstart: () => interactiveResult.beginDelayedSelect(),
|
|
204
|
-
touchend: () => interactiveResult.cancelPendingSelect(),
|
|
205
|
-
};
|
|
206
|
-
const elements = resultElement.querySelectorAll(selector || 'a');
|
|
207
|
-
elements.forEach((element) => {
|
|
208
|
-
Object.keys(eventsMap).forEach((key) => element.addEventListener(key, eventsMap[key]));
|
|
209
|
-
});
|
|
210
|
-
return () => {
|
|
211
|
-
elements.forEach((element) => {
|
|
212
|
-
Object.keys(eventsMap).forEach((key) => element.removeEventListener(key, eventsMap[key]));
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export { MissingInterfaceParentError, bindLogDocumentOpenOnResult, dispatchSearchBoxSuggestionsEvent, elementHasNoQuery, elementHasQuery, fetchProductContext, fetchBindings as initializeBindings };
|
|
218
|
-
|
|
219
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"index.js","mappings":";;;;SA2BgB,OAAO,C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EAAC;KAClB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAuD;QACpE,WAAW,EAAE,MAAM,iBAAiB,CAAC,MAAM,EAAE;QAC7C,KAAK,EAAE,MAAM,iBAAiB,CAAC,MAAM,EAAE;QACvC,OAAO,EAAE,MAAM,iBAAiB,CAAC,MAAM,EAAE;QACzC,SAAS,EAAE,MAAM,iBAAiB,CAAC,MAAM,EAAE;QAC3C,UAAU,EAAE,MAAM,iBAAiB,CAAC,kBAAkB,EAAE;QACxD,QAAQ,EAAE,MAAM,iBAAiB,CAAC,mBAAmB,EAAE;KACxD,CAAC;IACF,MAAM,QAAQ,GAAG,aAAa,CAAC,gBAAgB,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;IAEjE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO;QACvB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KACjC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAC9C,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO;YACvB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KACjC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CACjD,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;AACJ;;;;","names":[],"sources":["src/utils/dom-utils.ts","src/utils/event-utils.ts","src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/components/commerce/product-template-component-utils/context/fetch-product-context.ts","src/components/common/suggestions/suggestions-events.ts","src/components/common/suggestions/suggestions-utils.ts","src/utils/init-queue.ts","src/utils/initialization-common-utils.ts","src/utils/result-utils.ts"],"sourcesContent":["export function rectEquals(r1: DOMRect, r2: DOMRect) {\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n\nexport function parentNodeToString(node: ParentNode): string {\n return Array.from(node.children)\n .map((child) => child.outerHTML)\n .join('');\n}\n\nexport function closest<K extends keyof HTMLElementTagNameMap>(\n element: Element | null,\n selector: K\n): HTMLElementTagNameMap[K] | null;\nexport function closest<K extends keyof SVGElementTagNameMap>(\n element: Element | null,\n selector: K\n): SVGElementTagNameMap[K] | null;\nexport function closest<E extends Element = Element>(\n element: Element | null,\n selector: string\n): E | null;\nexport function closest(\n element: Element | null,\n selector: string\n): HTMLElement | null {\n if (!element) {\n return null;\n }\n if (element.matches(selector)) {\n return element as HTMLElement;\n }\n if (element.parentNode instanceof ShadowRoot) {\n return closest(element.parentNode.host, selector);\n }\n return closest(element.parentElement, selector);\n}\n","import {promiseTimeout} from './promise-utils';\n\nexport function buildCustomEvent<T = undefined>(name: string, detail?: T) {\n return new CustomEvent(name, {\n detail,\n // Event will bubble up the DOM until it is caught\n bubbles: true,\n // Allows to verify if event is caught (cancelled). If it's not caught, it won't be initialized.\n cancelable: true,\n // Allows to compose Atomic components inside one another, event will go across DOM/Shadow DOM\n composed: true,\n });\n}\n\nexport function listenOnce<K extends keyof HTMLElementEventMap>(\n element: HTMLElement,\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void {\n const _listener: EventListener = (evt: Event) => {\n element.removeEventListener(type, _listener, options);\n typeof listener === 'object'\n ? listener.handleEvent.call(element, evt)\n : listener.call(element, evt);\n };\n element.addEventListener(type, _listener, options);\n}\n\nexport function eventPromise(\n element: HTMLElement,\n type: string,\n timeoutMs: number = 0\n): Promise<Event> {\n let promise = new Promise<Event>((resolve) => {\n listenOnce(element, type, (e) => {\n resolve(e);\n });\n });\n\n if (timeoutMs > 0) {\n promise = promiseTimeout(promise, timeoutMs);\n }\n\n return promise;\n}\n","import type {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\nimport type {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n","import type {Product} from '@coveo/headless/commerce';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n","import type {HTMLStencilElement} from '@stencil/core/internal';\nimport type {LitElement} from 'lit';\nimport {closest} from '../../../utils/dom-utils';\nimport {buildCustomEvent} from '../../../utils/event-utils';\nimport type {AnyBindings} from '../interface/bindings';\nimport type {SearchBoxSuggestionsEvent} from './suggestions-types';\n\n/**\n * Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.\n *\n * @param event Event sent from the registered query suggestions to the parent search box\n * @param element Element on which to dispatch the event, which must be the child of a configured search box\n * @param allowedSearchBoxElements Optional array of allowed search box element selectors\n *\n * @throws Error if the element is not a child of an allowed search box element\n */\nexport const dispatchSearchBoxSuggestionsEvent = <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>,\n element: HTMLElement,\n allowedSearchBoxElements: readonly (typeof searchBoxElements)[number][] = searchBoxElements\n) => {\n const interfaceElement = closest(element, searchBoxElements.join(', '));\n if (!interfaceElement) {\n throw new Error(\n `The \"${element.nodeName.toLowerCase()}\" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(\n ', '\n )}`\n );\n }\n void dispatchSearchBoxSuggestionsEventEventually(\n interfaceElement,\n element,\n event\n );\n};\n\nconst searchBoxElements = [\n 'atomic-search-box',\n 'atomic-insight-search-box',\n 'atomic-commerce-search-box',\n] as const;\n\nconst isLitElementLoosely = (candidate: unknown): candidate is LitElement =>\n 'updateComplete' in (candidate as LitElement) &&\n (candidate as LitElement).updateComplete instanceof Promise;\n\nconst dispatchSearchBoxSuggestionsEventEventually = async <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n interfaceElement: Element,\n element: HTMLElement,\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>\n) => {\n await customElements.whenDefined(interfaceElement.nodeName.toLowerCase());\n if (isLitElementLoosely(interfaceElement)) {\n await interfaceElement.updateComplete;\n } else if ('componentOnReady' in interfaceElement) {\n await (interfaceElement as HTMLStencilElement).componentOnReady();\n }\n element.dispatchEvent(\n buildCustomEvent('atomic/searchBoxSuggestion/register', event)\n );\n};\n","import type {SearchBoxSuggestionElement} from './suggestions-types';\n\n/**\n * Checks if a search box suggestion element has no query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has no query or the query is whitespace-only\n */\nexport function elementHasNoQuery(el: SearchBoxSuggestionElement): boolean {\n return !el.query || el.query.trim() === '';\n}\n\n/**\n * Checks if a search box suggestion element has a query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has a non-empty, non-whitespace query\n */\nexport function elementHasQuery(el: SearchBoxSuggestionElement): boolean {\n return !!el.query && el.query.trim() !== '';\n}\n","import type {InitializeEventHandler} from './initialization-common-utils';\n\nexport type InitializeEvent = CustomEvent<InitializeEventHandler>;\n\ndeclare global {\n interface Window {\n initQueueNamespace: {\n eventQueueMap: Map<Element, QueuedEvent[]>;\n parentReadyMap: Map<Element, boolean>;\n };\n }\n}\n\ntype QueuedEvent = {\n event: InitializeEvent;\n element: Element;\n};\n\nfunction getWindow() {\n return window;\n}\n\nfunction getInitQueueNamespace() {\n if (!getWindow().initQueueNamespace) {\n getWindow().initQueueNamespace = {\n eventQueueMap: new Map(),\n parentReadyMap: new Map(),\n };\n }\n return getWindow().initQueueNamespace;\n}\n\nfunction getEventQueueMap(): Map<Element, QueuedEvent[]> {\n return getInitQueueNamespace().eventQueueMap;\n}\n\nfunction getParentReadyMap(): Map<Element, boolean> {\n return getInitQueueNamespace().parentReadyMap;\n}\n\nexport function markParentAsReady(parent: Element) {\n const parentReadyMap = getParentReadyMap();\n parentReadyMap.set(parent, true);\n const eventQueueMap = getEventQueueMap();\n const eventQueue = eventQueueMap.get(parent) || [];\n eventQueue.reverse();\n while (eventQueue.length > 0) {\n const {event, element} = eventQueue.pop()!;\n element.dispatchEvent(event);\n }\n parent.dispatchEvent(new CustomEvent('atomic/parentReady', {bubbles: true}));\n eventQueueMap.delete(parent);\n}\n\nexport function isParentReady(parent: Element): boolean {\n const parentReadyMap = getParentReadyMap();\n return parentReadyMap.get(parent) || false;\n}\n\nexport function queueEventForParent(\n parent: Element,\n event: InitializeEvent,\n element: Element\n) {\n const eventQueueMap = getEventQueueMap();\n if (!eventQueueMap.has(parent)) {\n eventQueueMap.set(parent, []);\n }\n eventQueueMap.get(parent)!.push({event, element});\n}\n\nexport function enqueueOrDispatchInitializationEvent(\n parent: Element,\n event: InitializeEvent,\n element: Element\n) {\n if (isParentReady(parent)) {\n element.dispatchEvent(event);\n } else {\n queueEventForParent(parent, event, element);\n }\n}\n","import type {CoreEngine} from '@coveo/headless';\nimport type {AnyBindings} from '../components/common/interface/bindings';\nimport {closest} from './dom-utils';\nimport {buildCustomEvent} from './event-utils';\nimport {enqueueOrDispatchInitializationEvent} from './init-queue';\n\n/**\n * Retrieves `Bindings` or `CommerceBindings` on a configured parent interface.\n * @param event - The element on which to dispatch the event, which must be the child of a configured Atomic container element.\n * @returns A promise that resolves upon initialization of the parent container element, and rejects otherwise.\n */\nexport function fetchBindings<SpecificBindings extends AnyBindings>(\n element: Element\n) {\n return new Promise<SpecificBindings>((resolve, reject) => {\n const event = buildCustomEvent<InitializeEventHandler>(\n initializeEventName,\n (bindings: unknown) => resolve(bindings as SpecificBindings)\n );\n const parent = closest(element, initializableElements.join(', '));\n if (!parent) {\n reject(new MissingInterfaceParentError(element.nodeName.toLowerCase()));\n return;\n }\n enqueueOrDispatchInitializationEvent(parent, event, element);\n });\n}\nexport type InitializeEventHandler = (bindings: AnyBindings) => void;\nexport class MissingInterfaceParentError extends Error {\n constructor(elementName: string) {\n super(\n `The \"${elementName}\" element must be the child of the following elements: ${initializableElements.join(\n ', '\n )}`\n );\n }\n}\nexport const initializableElements = [\n 'atomic-recs-interface',\n 'atomic-search-interface',\n 'atomic-commerce-interface',\n 'atomic-commerce-recommendation-interface',\n 'atomic-relevance-inspector',\n 'atomic-insight-interface',\n 'atomic-external',\n];\nexport const initializeEventName = 'atomic/initializeComponent';\n\nexport type AtomicInterface = HTMLElement & {\n engine?: CoreEngine;\n bindings?: AnyBindings;\n};\n","import {\n buildInteractiveResult,\n type Result,\n ResultTemplatesHelpers,\n type SearchEngine,\n} from '@coveo/headless';\nimport type {RecsBindings} from '../components/recommendations/atomic-recs-interface/interfaces';\nimport type {Bindings} from '../components/search/atomic-search-interface/atomic-search-interface';\nimport {readFromObject} from './object-utils';\n\n/**\n * Binds the logging of document\n * @returns An unbind function for the events\n * @param engine A headless search engine instance.\n * @param result The result object\n * @param resultElement Parent result element\n * @param selector Optional. Css selector that selects all links to the document. Default: \"a\" tags with the clickUri as \"href\" parameter.\n */\nexport function bindLogDocumentOpenOnResult(\n engine: SearchEngine,\n result: Result,\n resultElement: Element | ShadowRoot,\n selector?: string\n) {\n const interactiveResult = buildInteractiveResult(engine, {\n options: {result},\n });\n\n const eventsMap: Record<string, EventListenerOrEventListenerObject> = {\n contextmenu: () => interactiveResult.select(),\n click: () => interactiveResult.select(),\n mouseup: () => interactiveResult.select(),\n mousedown: () => interactiveResult.select(),\n touchstart: () => interactiveResult.beginDelayedSelect(),\n touchend: () => interactiveResult.cancelPendingSelect(),\n };\n const elements = resultElement.querySelectorAll(selector || 'a');\n\n elements.forEach((element) => {\n Object.keys(eventsMap).forEach((key) =>\n element.addEventListener(key, eventsMap[key])\n );\n });\n\n return () => {\n elements.forEach((element) => {\n Object.keys(eventsMap).forEach((key) =>\n element.removeEventListener(key, eventsMap[key])\n );\n });\n };\n}\n\nexport function buildStringTemplateFromResult(\n template: string,\n result: Result,\n bindings: Bindings | RecsBindings\n) {\n return template.replace(/\\${(.*?)}/g, (value: string) => {\n const key = value.substring(2, value.length - 1);\n let newValue = readFromObject(result, key);\n if (!newValue && typeof window !== 'undefined') {\n newValue = readFromObject(window, key);\n }\n\n if (!newValue) {\n bindings.engine.logger.warn(\n `${key} used in the href template is undefined for this result: ${result.uniqueId} and could not be found in the window object.`\n );\n return '';\n }\n\n return newValue;\n });\n}\n\nexport function getStringValueFromResultOrNull(result: Result, field: string) {\n const value = ResultTemplatesHelpers.getResultProperty(result, field);\n\n if (typeof value !== 'string' || value.trim() === '') {\n return null;\n }\n\n return value;\n}\n"],"version":3}
|
package/dist/atomic/index.esm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export*from"@coveo/atomic-legacy/item-decorators";import{buildInteractiveResult as e}from"@coveo/headless";function t(e,n){if(!e){return null}if(e.matches(n)){return e}if(e.parentNode instanceof ShadowRoot){return t(e.parentNode.host,n)}return t(e.parentElement,n)}function n(e,t){return new CustomEvent(e,{detail:t,bubbles:true,cancelable:true,composed:true})}class o extends Error{constructor(e,t){super(`The "${e}" element must be the child of an "${t}" element.`)}}const c="atomic/resolveResult";function i(e,i){return new Promise(((r,s)=>{const a=n(c,(e=>r(e)));e.dispatchEvent(a);if(!t(e,i)){s(new o(e.nodeName.toLowerCase(),i))}}))}function r(e){return i(e,"atomic-product")}const s=(e,n,o=a)=>{const c=t(n,a.join(", "));if(!c){throw new Error(`The "${n.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${o.join(", ")}`)}void m(c,n,e)};const a=["atomic-search-box","atomic-insight-search-box","atomic-commerce-search-box"];const u=e=>"updateComplete"in e&&e.updateComplete instanceof Promise;const m=async(e,t,o)=>{await customElements.whenDefined(e.nodeName.toLowerCase());if(u(e)){await e.updateComplete}else if("componentOnReady"in e){await e.componentOnReady()}t.dispatchEvent(n("atomic/searchBoxSuggestion/register",o))};function f(e){return!e.query||e.query.trim()===""}function l(e){return!!e.query&&e.query.trim()!==""}function h(){return window}function d(){if(!h().initQueueNamespace){h().initQueueNamespace={eventQueueMap:new Map,parentReadyMap:new Map}}return h().initQueueNamespace}function p(){return d().eventQueueMap}function w(){return d().parentReadyMap}function b(e){const t=w();return t.get(e)||false}function x(e,t,n){const o=p();if(!o.has(e)){o.set(e,[])}o.get(e).push({event:t,element:n})}function g(e,t,n){if(b(e)){n.dispatchEvent(t)}else{x(e,t,n)}}function v(e){return new Promise(((o,c)=>{const i=n(y,(e=>o(e)));const r=t(e,E.join(", "));if(!r){c(new $(e.nodeName.toLowerCase()));return}g(r,i,e)}))}class $ extends Error{constructor(e){super(`The "${e}" element must be the child of the following elements: ${E.join(", ")}`)}}const E=["atomic-recs-interface","atomic-search-interface","atomic-commerce-interface","atomic-commerce-recommendation-interface","atomic-relevance-inspector","atomic-insight-interface","atomic-external"];const y="atomic/initializeComponent";function M(t,n,o,c){const i=e(t,{options:{result:n}});const r={contextmenu:()=>i.select(),click:()=>i.select(),mouseup:()=>i.select(),mousedown:()=>i.select(),touchstart:()=>i.beginDelayedSelect(),touchend:()=>i.cancelPendingSelect()};const s=o.querySelectorAll(c||"a");s.forEach((e=>{Object.keys(r).forEach((t=>e.addEventListener(t,r[t])))}));return()=>{s.forEach((e=>{Object.keys(r).forEach((t=>e.removeEventListener(t,r[t])))}))}}export{$ as MissingInterfaceParentError,M as bindLogDocumentOpenOnResult,s as dispatchSearchBoxSuggestionsEvent,f as elementHasNoQuery,l as elementHasQuery,r as fetchProductContext,v as initializeBindings};
|
|
2
|
-
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["closest","element","selector","matches","parentNode","ShadowRoot","host","parentElement","buildCustomEvent","name","detail","CustomEvent","bubbles","cancelable","composed","MissingParentError","Error","constructor","elementName","parentName","super","itemContextEventName","fetchItemContext","Promise","resolve","reject","event","item","dispatchEvent","nodeName","toLowerCase","fetchProductContext","dispatchSearchBoxSuggestionsEvent","allowedSearchBoxElements","searchBoxElements","interfaceElement","join","dispatchSearchBoxSuggestionsEventEventually","isLitElementLoosely","candidate","updateComplete","async","customElements","whenDefined","componentOnReady","elementHasNoQuery","el","query","trim","elementHasQuery","getWindow","window","getInitQueueNamespace","initQueueNamespace","eventQueueMap","Map","parentReadyMap","getEventQueueMap","getParentReadyMap","isParentReady","parent","get","queueEventForParent","has","set","push","enqueueOrDispatchInitializationEvent","fetchBindings","initializeEventName","bindings","initializableElements","MissingInterfaceParentError","bindLogDocumentOpenOnResult","engine","result","resultElement","interactiveResult","buildInteractiveResult","options","eventsMap","contextmenu","select","click","mouseup","mousedown","touchstart","beginDelayedSelect","touchend","cancelPendingSelect","elements","querySelectorAll","forEach","Object","keys","key","addEventListener","removeEventListener"],"sources":["src/utils/dom-utils.ts","src/utils/event-utils.ts","src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/components/commerce/product-template-component-utils/context/fetch-product-context.ts","src/components/common/suggestions/suggestions-events.ts","src/components/common/suggestions/suggestions-utils.ts","src/utils/init-queue.ts","src/utils/initialization-common-utils.ts","src/utils/result-utils.ts"],"sourcesContent":["export function rectEquals(r1: DOMRect, r2: DOMRect) {\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n\nexport function parentNodeToString(node: ParentNode): string {\n return Array.from(node.children)\n .map((child) => child.outerHTML)\n .join('');\n}\n\nexport function closest<K extends keyof HTMLElementTagNameMap>(\n element: Element | null,\n selector: K\n): HTMLElementTagNameMap[K] | null;\nexport function closest<K extends keyof SVGElementTagNameMap>(\n element: Element | null,\n selector: K\n): SVGElementTagNameMap[K] | null;\nexport function closest<E extends Element = Element>(\n element: Element | null,\n selector: string\n): E | null;\nexport function closest(\n element: Element | null,\n selector: string\n): HTMLElement | null {\n if (!element) {\n return null;\n }\n if (element.matches(selector)) {\n return element as HTMLElement;\n }\n if (element.parentNode instanceof ShadowRoot) {\n return closest(element.parentNode.host, selector);\n }\n return closest(element.parentElement, selector);\n}\n","import {promiseTimeout} from './promise-utils';\n\nexport function buildCustomEvent<T = undefined>(name: string, detail?: T) {\n return new CustomEvent(name, {\n detail,\n // Event will bubble up the DOM until it is caught\n bubbles: true,\n // Allows to verify if event is caught (cancelled). If it's not caught, it won't be initialized.\n cancelable: true,\n // Allows to compose Atomic components inside one another, event will go across DOM/Shadow DOM\n composed: true,\n });\n}\n\nexport function listenOnce<K extends keyof HTMLElementEventMap>(\n element: HTMLElement,\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void {\n const _listener: EventListener = (evt: Event) => {\n element.removeEventListener(type, _listener, options);\n typeof listener === 'object'\n ? listener.handleEvent.call(element, evt)\n : listener.call(element, evt);\n };\n element.addEventListener(type, _listener, options);\n}\n\nexport function eventPromise(\n element: HTMLElement,\n type: string,\n timeoutMs: number = 0\n): Promise<Event> {\n let promise = new Promise<Event>((resolve) => {\n listenOnce(element, type, (e) => {\n resolve(e);\n });\n });\n\n if (timeoutMs > 0) {\n promise = promiseTimeout(promise, timeoutMs);\n }\n\n return promise;\n}\n","import type {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\nimport type {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n","import type {Product} from '@coveo/headless/commerce';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n","import type {HTMLStencilElement} from '@stencil/core/internal';\nimport type {LitElement} from 'lit';\nimport {closest} from '../../../utils/dom-utils';\nimport {buildCustomEvent} from '../../../utils/event-utils';\nimport type {AnyBindings} from '../interface/bindings';\nimport type {SearchBoxSuggestionsEvent} from './suggestions-types';\n\n/**\n * Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.\n *\n * @param event Event sent from the registered query suggestions to the parent search box\n * @param element Element on which to dispatch the event, which must be the child of a configured search box\n * @param allowedSearchBoxElements Optional array of allowed search box element selectors\n *\n * @throws Error if the element is not a child of an allowed search box element\n */\nexport const dispatchSearchBoxSuggestionsEvent = <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>,\n element: HTMLElement,\n allowedSearchBoxElements: readonly (typeof searchBoxElements)[number][] = searchBoxElements\n) => {\n const interfaceElement = closest(element, searchBoxElements.join(', '));\n if (!interfaceElement) {\n throw new Error(\n `The \"${element.nodeName.toLowerCase()}\" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(\n ', '\n )}`\n );\n }\n void dispatchSearchBoxSuggestionsEventEventually(\n interfaceElement,\n element,\n event\n );\n};\n\nconst searchBoxElements = [\n 'atomic-search-box',\n 'atomic-insight-search-box',\n 'atomic-commerce-search-box',\n] as const;\n\nconst isLitElementLoosely = (candidate: unknown): candidate is LitElement =>\n 'updateComplete' in (candidate as LitElement) &&\n (candidate as LitElement).updateComplete instanceof Promise;\n\nconst dispatchSearchBoxSuggestionsEventEventually = async <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n interfaceElement: Element,\n element: HTMLElement,\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>\n) => {\n await customElements.whenDefined(interfaceElement.nodeName.toLowerCase());\n if (isLitElementLoosely(interfaceElement)) {\n await interfaceElement.updateComplete;\n } else if ('componentOnReady' in interfaceElement) {\n await (interfaceElement as HTMLStencilElement).componentOnReady();\n }\n element.dispatchEvent(\n buildCustomEvent('atomic/searchBoxSuggestion/register', event)\n );\n};\n","import type {SearchBoxSuggestionElement} from './suggestions-types';\n\n/**\n * Checks if a search box suggestion element has no query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has no query or the query is whitespace-only\n */\nexport function elementHasNoQuery(el: SearchBoxSuggestionElement): boolean {\n return !el.query || el.query.trim() === '';\n}\n\n/**\n * Checks if a search box suggestion element has a query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has a non-empty, non-whitespace query\n */\nexport function elementHasQuery(el: SearchBoxSuggestionElement): boolean {\n return !!el.query && el.query.trim() !== '';\n}\n","import type {InitializeEventHandler} from './initialization-common-utils';\n\nexport type InitializeEvent = CustomEvent<InitializeEventHandler>;\n\ndeclare global {\n interface Window {\n initQueueNamespace: {\n eventQueueMap: Map<Element, QueuedEvent[]>;\n parentReadyMap: Map<Element, boolean>;\n };\n }\n}\n\ntype QueuedEvent = {\n event: InitializeEvent;\n element: Element;\n};\n\nfunction getWindow() {\n return window;\n}\n\nfunction getInitQueueNamespace() {\n if (!getWindow().initQueueNamespace) {\n getWindow().initQueueNamespace = {\n eventQueueMap: new Map(),\n parentReadyMap: new Map(),\n };\n }\n return getWindow().initQueueNamespace;\n}\n\nfunction getEventQueueMap(): Map<Element, QueuedEvent[]> {\n return getInitQueueNamespace().eventQueueMap;\n}\n\nfunction getParentReadyMap(): Map<Element, boolean> {\n return getInitQueueNamespace().parentReadyMap;\n}\n\nexport function markParentAsReady(parent: Element) {\n const parentReadyMap = getParentReadyMap();\n parentReadyMap.set(parent, true);\n const eventQueueMap = getEventQueueMap();\n const eventQueue = eventQueueMap.get(parent) || [];\n eventQueue.reverse();\n while (eventQueue.length > 0) {\n const {event, element} = eventQueue.pop()!;\n element.dispatchEvent(event);\n }\n parent.dispatchEvent(new CustomEvent('atomic/parentReady', {bubbles: true}));\n eventQueueMap.delete(parent);\n}\n\nexport function isParentReady(parent: Element): boolean {\n const parentReadyMap = getParentReadyMap();\n return parentReadyMap.get(parent) || false;\n}\n\nexport function queueEventForParent(\n parent: Element,\n event: InitializeEvent,\n element: Element\n) {\n const eventQueueMap = getEventQueueMap();\n if (!eventQueueMap.has(parent)) {\n eventQueueMap.set(parent, []);\n }\n eventQueueMap.get(parent)!.push({event, element});\n}\n\nexport function enqueueOrDispatchInitializationEvent(\n parent: Element,\n event: InitializeEvent,\n element: Element\n) {\n if (isParentReady(parent)) {\n element.dispatchEvent(event);\n } else {\n queueEventForParent(parent, event, element);\n }\n}\n","import type {CoreEngine} from '@coveo/headless';\nimport type {AnyBindings} from '../components/common/interface/bindings';\nimport {closest} from './dom-utils';\nimport {buildCustomEvent} from './event-utils';\nimport {enqueueOrDispatchInitializationEvent} from './init-queue';\n\n/**\n * Retrieves `Bindings` or `CommerceBindings` on a configured parent interface.\n * @param event - The element on which to dispatch the event, which must be the child of a configured Atomic container element.\n * @returns A promise that resolves upon initialization of the parent container element, and rejects otherwise.\n */\nexport function fetchBindings<SpecificBindings extends AnyBindings>(\n element: Element\n) {\n return new Promise<SpecificBindings>((resolve, reject) => {\n const event = buildCustomEvent<InitializeEventHandler>(\n initializeEventName,\n (bindings: unknown) => resolve(bindings as SpecificBindings)\n );\n const parent = closest(element, initializableElements.join(', '));\n if (!parent) {\n reject(new MissingInterfaceParentError(element.nodeName.toLowerCase()));\n return;\n }\n enqueueOrDispatchInitializationEvent(parent, event, element);\n });\n}\nexport type InitializeEventHandler = (bindings: AnyBindings) => void;\nexport class MissingInterfaceParentError extends Error {\n constructor(elementName: string) {\n super(\n `The \"${elementName}\" element must be the child of the following elements: ${initializableElements.join(\n ', '\n )}`\n );\n }\n}\nexport const initializableElements = [\n 'atomic-recs-interface',\n 'atomic-search-interface',\n 'atomic-commerce-interface',\n 'atomic-commerce-recommendation-interface',\n 'atomic-relevance-inspector',\n 'atomic-insight-interface',\n 'atomic-external',\n];\nexport const initializeEventName = 'atomic/initializeComponent';\n\nexport type AtomicInterface = HTMLElement & {\n engine?: CoreEngine;\n bindings?: AnyBindings;\n};\n","import {\n buildInteractiveResult,\n type Result,\n ResultTemplatesHelpers,\n type SearchEngine,\n} from '@coveo/headless';\nimport type {RecsBindings} from '../components/recommendations/atomic-recs-interface/interfaces';\nimport type {Bindings} from '../components/search/atomic-search-interface/atomic-search-interface';\nimport {readFromObject} from './object-utils';\n\n/**\n * Binds the logging of document\n * @returns An unbind function for the events\n * @param engine A headless search engine instance.\n * @param result The result object\n * @param resultElement Parent result element\n * @param selector Optional. Css selector that selects all links to the document. Default: \"a\" tags with the clickUri as \"href\" parameter.\n */\nexport function bindLogDocumentOpenOnResult(\n engine: SearchEngine,\n result: Result,\n resultElement: Element | ShadowRoot,\n selector?: string\n) {\n const interactiveResult = buildInteractiveResult(engine, {\n options: {result},\n });\n\n const eventsMap: Record<string, EventListenerOrEventListenerObject> = {\n contextmenu: () => interactiveResult.select(),\n click: () => interactiveResult.select(),\n mouseup: () => interactiveResult.select(),\n mousedown: () => interactiveResult.select(),\n touchstart: () => interactiveResult.beginDelayedSelect(),\n touchend: () => interactiveResult.cancelPendingSelect(),\n };\n const elements = resultElement.querySelectorAll(selector || 'a');\n\n elements.forEach((element) => {\n Object.keys(eventsMap).forEach((key) =>\n element.addEventListener(key, eventsMap[key])\n );\n });\n\n return () => {\n elements.forEach((element) => {\n Object.keys(eventsMap).forEach((key) =>\n element.removeEventListener(key, eventsMap[key])\n );\n });\n };\n}\n\nexport function buildStringTemplateFromResult(\n template: string,\n result: Result,\n bindings: Bindings | RecsBindings\n) {\n return template.replace(/\\${(.*?)}/g, (value: string) => {\n const key = value.substring(2, value.length - 1);\n let newValue = readFromObject(result, key);\n if (!newValue && typeof window !== 'undefined') {\n newValue = readFromObject(window, key);\n }\n\n if (!newValue) {\n bindings.engine.logger.warn(\n `${key} used in the href template is undefined for this result: ${result.uniqueId} and could not be found in the window object.`\n );\n return '';\n }\n\n return newValue;\n });\n}\n\nexport function getStringValueFromResultOrNull(result: Result, field: string) {\n const value = ResultTemplatesHelpers.getResultProperty(result, field);\n\n if (typeof value !== 'string' || value.trim() === '') {\n return null;\n }\n\n return value;\n}\n"],"mappings":"oHA2BgBA,EACdC,EACAC,GAEA,IAAKD,EAAS,CACZ,OAAO,I,CAET,GAAIA,EAAQE,QAAQD,GAAW,CAC7B,OAAOD,C,CAET,GAAIA,EAAQG,sBAAsBC,WAAY,CAC5C,OAAOL,EAAQC,EAAQG,WAAWE,KAAMJ,E,CAE1C,OAAOF,EAAQC,EAAQM,cAAeL,EACxC,C,SCvCgBM,EAAgCC,EAAcC,GAC5D,OAAO,IAAIC,YAAYF,EAAM,CAC3BC,SAEAE,QAAS,KAETC,WAAY,KAEZC,SAAU,MAEd,C,MCEaC,UAA2BC,MACtC,WAAAC,CAAYC,EAAqBC,GAC/BC,MACE,QAAQF,uCAAiDC,c,ECb/D,MAAME,EAAuB,uB,SAIbC,EAAoBrB,EAAkBkB,GACpD,OAAO,IAAII,SAAW,CAACC,EAASC,KAC9B,MAAMC,EAAQlB,EACZa,GACCM,GACQH,EAAQG,KAGnB1B,EAAQ2B,cAAcF,GAEtB,IAAK1B,EAAQC,EAASkB,GAAa,CACjCM,EACE,IAAIV,EAAmBd,EAAQ4B,SAASC,cAAeX,G,IAI/D,C,SCXgBY,EAAuC9B,GACrD,OAAOqB,EAAoBrB,EAAS,iBACtC,C,MCCa+B,EAAoC,CAI/CN,EACAzB,EACAgC,EAA0EC,KAE1E,MAAMC,EAAmBnC,EAAQC,EAASiC,EAAkBE,KAAK,OACjE,IAAKD,EAAkB,CACrB,MAAM,IAAInB,MACR,QAAQf,EAAQ4B,SAASC,6FAA6FG,EAAyBG,KAC7I,Q,MAIDC,EACHF,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GACCC,GAAsB7C,EAAQ6C,KAEjC,MAAMT,EAAS5D,EAAQC,EAASqE,EAAsBlC,KAAK,OAC3D,IAAKwB,EAAQ,CACXnC,EAAO,IAAI8C,EAA4BtE,EAAQ4B,SAASC,gBACxD,M,CAEFoC,EAAqCN,EAAQlC,EAAOzB,EAAQ,GAEhE,C,MAEasE,UAAoCvD,MAC/C,WAAAC,CAAYC,GACVE,MACE,QAAQF,2DAAqEoD,EAAsBlC,KACjG,Q,EAKD,MAAMkC,EAAwB,CACnC,wBACA,0BACA,4BACA,2CACA,6BACA,2BACA,mBAEK,MAAMF,EAAsB,6B,SC5BnBI,EACdC,EACAC,EACAC,EACAzE,GAEA,MAAM0E,EAAoBC,EAAuBJ,EAAQ,CACvDK,QAAS,CAACJ,YAGZ,MAAMK,EAAgE,CACpEC,YAAa,IAAMJ,EAAkBK,SACrCC,MAAO,IAAMN,EAAkBK,SAC/BE,QAAS,IAAMP,EAAkBK,SACjCG,UAAW,IAAMR,EAAkBK,SACnCI,WAAY,IAAMT,EAAkBU,qBACpCC,SAAU,IAAMX,EAAkBY,uBAEpC,MAAMC,EAAWd,EAAce,iBAAiBxF,GAAY,KAE5DuF,EAASE,SAAS1F,IAChB2F,OAAOC,KAAKd,GAAWY,SAASG,GAC9B7F,EAAQ8F,iBAAiBD,EAAKf,EAAUe,KACzC,IAGH,MAAO,KACLL,EAASE,SAAS1F,IAChB2F,OAAOC,KAAKd,GAAWY,SAASG,GAC9B7F,EAAQ+F,oBAAoBF,EAAKf,EAAUe,KAC5C,GACD,CAEN,Q","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../../cjs/loader.cjs.js');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../../cjs/loader.cjs.js');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../esm/loader.js';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e="atomic";const t={allRenderFn:true,appendChildSlotFix:false,asyncLoading:true,asyncQueue:false,attachStyles:true,cloneNodeFix:false,cmpDidLoad:false,cmpDidRender:false,cmpDidUnload:false,cmpDidUpdate:false,cmpShouldUpdate:false,cmpWillLoad:false,cmpWillRender:false,cmpWillUpdate:false,connectedCallback:false,constructableCSS:true,cssAnnotations:true,devTools:false,disconnectedCallback:false,element:false,event:false,experimentalScopedSlotChanges:false,experimentalSlotFixes:false,formAssociated:false,hasRenderFn:false,hostListener:false,hostListenerTarget:false,hostListenerTargetBody:false,hostListenerTargetDocument:false,hostListenerTargetParent:false,hostListenerTargetWindow:false,hotModuleReplacement:false,hydrateClientSide:false,hydrateServerSide:false,hydratedAttribute:false,hydratedClass:true,hydratedSelectorName:"hydrated",initializeNextTick:false,invisiblePrehydration:true,isDebug:false,isDev:false,isTesting:false,lazyLoad:true,lifecycle:false,lifecycleDOMEvents:false,member:false,method:false,mode:false,observeAttribute:false,profile:false,prop:false,propBoolean:false,propMutable:false,propNumber:false,propString:false,reflect:false,scoped:false,scopedSlotTextContentFix:false,scriptDataOpts:false,shadowDelegatesFocus:false,shadowDom:false,slot:false,slotChildNodesFix:false,slotRelocation:false,state:false,style:false,svg:false,taskQueue:true,transformTagName:false,updatable:false,vdomAttribute:false,vdomClass:false,vdomFunctional:false,vdomKey:false,vdomListener:false,vdomPropOrAttr:false,vdomRef:false,vdomRender:false,vdomStyle:false,vdomText:false,vdomXlink:false,watchCallback:false};var s=Object.defineProperty;var a=(e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:true})};var r=new WeakMap;var n=e=>r.get(e);var l=(e,t)=>{const s={t:0,$hostElement$:e,l:t,o:new Map};{s.i=new Promise((e=>s.u=e));e["s-p"]=[];e["s-rc"]=[]}return r.set(e,s)};var o=(e,t)=>(0,console.error)(e,t);var i=new Map;var f=(e,t,s)=>{const a=e.v.replace(/-/g,"_");const r=e.m;if(!r){return void 0}const n=i.get(r);if(n){return n[a]}
|
|
2
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/return import(`./${r}.entry.js${""}`).then((e=>{{i.set(r,e)}return e[a]}),o)};var c="{visibility:hidden}.hydrated{visibility:inherit}";var d="slot-fb{display:contents}slot-fb[hidden]{display:none}";var u=typeof window!=="undefined"?window:{};var v=u.document||{head:{}};var m={t:0,p:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,s,a)=>e.addEventListener(t,s,a),rel:(e,t,s,a)=>e.removeEventListener(t,s,a),ce:(e,t)=>new CustomEvent(e,t)};var p=e=>Promise.resolve(e);var h=false;var y=[];var w=[];var b=(e,t)=>s=>{e.push(s);if(!h){h=true;if(t&&m.t&4){C(g)}else{m.raf(g)}}};var $=e=>{for(let t=0;t<e.length;t++){try{e[t](performance.now())}catch(e){o(e)}}e.length=0};var g=()=>{$(y);{$(w);if(h=y.length>0){m.raf(g)}}};var C=e=>p().then(e);var S=b(w,true);function k(e){var t,s,a;return(a=(s=(t=e.head)==null?void 0:t.querySelector('meta[name="csp-nonce"]'))==null?void 0:s.getAttribute("content"))!=null?a:void 0}var x={};a(x,{err:()=>L,map:()=>D,ok:()=>T,unwrap:()=>F,unwrapErr:()=>R});var T=e=>({isOk:true,isErr:false,value:e});var L=e=>({isOk:false,isErr:true,value:e});function D(e,t){if(e.isOk){const s=t(e.value);if(s instanceof Promise){return s.then((e=>T(e)))}else{return T(s)}}if(e.isErr){const t=e.value;return L(t)}throw"should never get here"}var F=e=>{if(e.isOk){return e.value}else{throw e.value}};var R=e=>{if(e.isErr){return e.value}else{throw e.value}};var E=(e,t="")=>{{return()=>{}}};var M=(e,t)=>{{return()=>{}}};var P=(e,t,s)=>{const a=m.ce(t,s);e.dispatchEvent(a);return a};var O=(e,t)=>{if(t&&!e.h&&t["s-p"]){t["s-p"].push(new Promise((t=>e.h=t)))}};var U=(e,t)=>{if(e.t&4){e.t|=512;return}O(e,e.$);const s=()=>A(e);return S(s)};var A=(e,t)=>{const s=e.$hostElement$;const a=E("scheduleUpdate",e.l.v);const r=e.C;if(!r){throw new Error(`Can't render component <${s.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`)}let n;a();return N(n,(()=>W(e,r)))};var N=(e,t)=>j(e)?e.then(t).catch((e=>{console.error(e);t()})):t();var j=e=>e instanceof Promise||e&&e.then&&typeof e.then==="function";var W=async(e,t,s)=>{var a;const r=e.$hostElement$;const n=E("update",e.l.v);const l=r["s-rc"];const o=E("render",e.l.v);{z(e,t)}if(l){l.map((e=>e()));r["s-rc"]=void 0}o();n();{const t=(a=r["s-p"])!=null?a:[];const s=()=>B(e);if(t.length===0){s()}else{Promise.all(t).then(s);e.t|=4;t.length=0}}};var z=(e,t,s,a)=>{try{t=t.render();{e.t|=2}}catch(t){o(t,e.$hostElement$)}return null};var B=e=>{const t=e.l.v;const s=e.$hostElement$;const a=E("postUpdate",t);const r=e.$;if(!(e.t&64)){e.t|=64;{q(s)}a();{e.u(s);if(!r){Q()}}}else{a()}{if(e.h){e.h();e.h=void 0}if(e.t&512){C((()=>U(e)))}e.t&=~(4|512)}};var Q=t=>{{q(v.documentElement)}C((()=>P(u,"appload",{detail:{namespace:e}})))};var q=e=>{var s;return e.classList.add((s=t.hydratedSelectorName)!=null?s:"hydrated")};var H=(e,t,s)=>e;var I=async(e,t,s,a)=>{let r;if((t.t&32)===0){t.t|=32;const a=s.m;if(a){const e=f(s);if(e&&"then"in e){const t=M();r=await e;t()}else{r=e}if(!r){throw new Error(`Constructor for "${s.v}#${t.S}" was not found`)}const a=E("createInstance",s.v);try{new r(t)}catch(e){o(e)}a()}else{r=e.constructor;const s=e.localName;customElements.whenDefined(s).then((()=>t.t|=128))}}const n=t.$;const l=()=>U(t);if(n&&n["s-rc"]){n["s-rc"].push(l)}else{l()}};var K=e=>{};var V=e=>{if((m.t&1)===0){const t=n(e);const s=t.l;const a=E("connectedCallback",s.v);if(!(t.t&1)){t.t|=1;{let s=e;while(s=s.parentNode||s.host){if(s["s-p"]){O(t,t.$=s);break}}}{I(e,t,s)}}else{if(t==null?void 0:t.C);else if(t==null?void 0:t.i){t.i.then((()=>K()))}}a()}};var X=e=>{};var _=async e=>{if((m.t&1)===0){const t=n(e);if(t==null?void 0:t.C);else if(t==null?void 0:t.i){t.i.then((()=>X()))}}};var G=(e,t={})=>{var s;const a=E();const r=[];const o=t.exclude||[];const i=u.customElements;const f=v.head;const p=f.querySelector("meta[charset]");const h=v.createElement("style");const y=[];let w;let b=true;Object.assign(m,t);m.p=new URL(t.resourcesUrl||"./",v.baseURI).href;let $=false;e.map((e=>{e[1].map((t=>{const s={t:t[0],v:t[1],k:t[2],T:t[3]};if(s.t&4){$=true}const a=s.v;const f=class extends HTMLElement{constructor(e){super(e);this.hasRegisteredEventListeners=false;e=this;l(e,s)}connectedCallback(){n(this);if(!this.hasRegisteredEventListeners){this.hasRegisteredEventListeners=true}if(w){clearTimeout(w);w=null}if(b){y.push(this)}else{m.jmp((()=>V(this)))}}disconnectedCallback(){m.jmp((()=>_(this)))}componentOnReady(){return n(this).i}};s.m=e[0];if(!o.includes(a)&&!i.get(a)){r.push(a);i.define(a,H(f))}}))}));if(r.length>0){if($){h.textContent+=d}{h.textContent+=r.sort()+c}if(h.innerHTML.length){h.setAttribute("data-styles","");const e=(s=m.L)!=null?s:k(v);if(e!=null){h.setAttribute("nonce",e)}f.insertBefore(h,p?p.nextSibling:f.firstChild)}}b=false;if(y.length){y.map((e=>e.connectedCallback()))}else{{m.jmp((()=>w=setTimeout(Q,30)))}}a()};var J=e=>m.L=e;const Y=()=>{};export{G as b,Y as g,p,J as s};
|
|
3
|
-
//# sourceMappingURL=p-998f7983.js.map
|