@esri/solutions-components 0.10.36 → 0.10.38
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-action-pad_2.cjs.entry.js +2 -2
- package/dist/cjs/calcite-block_5.cjs.entry.js +2 -2
- package/dist/cjs/{constants-0a4fc296.js → constants-51cf394f.js} +57 -1
- package/dist/cjs/{helpers-415179ad.js → helpers-afcac967.js} +1 -1
- package/dist/cjs/instant-apps-app-guide.cjs.entry.js +26 -13
- package/dist/cjs/instant-apps-export.cjs.entry.js +1086 -59
- package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +8 -4
- package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +10 -5
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +52 -12
- package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +9 -3
- package/dist/cjs/instant-apps-landing-page.cjs.entry.js +19 -13
- package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +3 -2
- package/dist/cjs/instant-apps-language-translator.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-measurement.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-popover.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-sign-in.cjs.entry.js +13 -9
- package/dist/cjs/instant-apps-splash.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-time-filter.cjs.entry.js +11 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solution-item-accordion.cjs.entry.js +15 -6
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/solution-item-accordion/solution-item-accordion.js +15 -6
- package/dist/collection/demos/solution-item-accordion.html +32 -0
- package/dist/components/instant-apps-app-guide.js +28 -14
- package/dist/components/instant-apps-export.js +1119 -76
- package/dist/components/instant-apps-interactive-legend-classic2.js +8 -4
- package/dist/components/instant-apps-interactive-legend-count2.js +6 -3
- package/dist/components/instant-apps-interactive-legend-layer-element-caption2.js +5 -2
- package/dist/components/instant-apps-interactive-legend-legend-element-caption2.js +52 -12
- package/dist/components/instant-apps-interactive-legend.js +13 -4
- package/dist/components/instant-apps-landing-page.js +19 -13
- package/dist/components/instant-apps-language-switcher.js +3 -1
- package/dist/components/instant-apps-language-translator2.js +57 -1
- package/dist/components/instant-apps-measurement-tool2.js +2 -2
- package/dist/components/instant-apps-measurement.js +2 -2
- package/dist/components/instant-apps-popover.js +1 -1
- package/dist/components/instant-apps-scoreboard.js +1 -1
- package/dist/components/instant-apps-sign-in2.js +14 -9
- package/dist/components/instant-apps-social-share2.js +2 -2
- package/dist/components/instant-apps-splash.js +1 -1
- package/dist/components/instant-apps-time-filter.js +11 -9
- package/dist/components/solution-item-accordion.js +15 -6
- package/dist/components/store.js +1 -1
- package/dist/esm/calcite-action-pad_2.entry.js +2 -2
- package/dist/esm/calcite-block_5.entry.js +2 -2
- package/dist/esm/{constants-045d6a1b.js → constants-886c7c2c.js} +57 -1
- package/dist/esm/{helpers-f9bf9c0b.js → helpers-91087955.js} +1 -1
- package/dist/esm/instant-apps-app-guide.entry.js +26 -13
- package/dist/esm/instant-apps-export.entry.js +1086 -59
- package/dist/esm/instant-apps-interactive-legend-classic.entry.js +8 -4
- package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +10 -5
- package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +1 -1
- package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +52 -12
- package/dist/esm/instant-apps-interactive-legend.entry.js +9 -3
- package/dist/esm/instant-apps-landing-page.entry.js +19 -13
- package/dist/esm/instant-apps-language-switcher.entry.js +3 -2
- package/dist/esm/instant-apps-language-translator.entry.js +1 -1
- package/dist/esm/instant-apps-measurement.entry.js +2 -2
- package/dist/esm/instant-apps-popover.entry.js +1 -1
- package/dist/esm/instant-apps-scoreboard.entry.js +1 -1
- package/dist/esm/instant-apps-sign-in.entry.js +13 -9
- package/dist/esm/instant-apps-splash.entry.js +1 -1
- package/dist/esm/instant-apps-time-filter.entry.js +11 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/solution-item-accordion.entry.js +15 -6
- package/dist/esm/solutions-components.js +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-app-guide/instant-apps-app-guide.css +0 -5
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-export/instant-apps-export.css +4 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-interactive-legend/instant-apps-interactive-legend-classic/instant-apps-interactive-legend-classic.css +14 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-interactive-legend/instant-apps-interactive-legend-count/instant-apps-interactive-legend-count.css +9 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-interactive-legend/instant-apps-interactive-legend-layer-element-caption/instant-apps-interactive-legend-layer-element-caption.css +5 -3
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-interactive-legend/instant-apps-interactive-legend-legend-element-caption/instant-apps-interactive-legend-legend-element-caption.css +29 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-landing-page/instant-apps-landing-page.css +8 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-sign-in/instant-apps-sign-in.css +22 -0
- package/dist/solutions-components/demos/solution-item-accordion.html +32 -0
- package/dist/solutions-components/p-1e14b3d0.entry.js +6 -0
- package/dist/solutions-components/p-2542d5c9.entry.js +6 -0
- package/dist/solutions-components/{p-70ecc979.entry.js → p-374ddead.entry.js} +1 -1
- package/dist/solutions-components/{p-146acd9a.entry.js → p-3fc18283.entry.js} +1 -1
- package/dist/solutions-components/p-43699470.entry.js +6 -0
- package/dist/solutions-components/p-5585dcd3.entry.js +6 -0
- package/dist/solutions-components/{p-3a513c67.entry.js → p-5b3c0418.entry.js} +1 -1
- package/dist/solutions-components/{p-f7e7b830.entry.js → p-6438d1ea.entry.js} +1 -1
- package/dist/solutions-components/p-750b3277.entry.js +6 -0
- package/dist/solutions-components/p-8779ee41.entry.js +6 -0
- package/dist/solutions-components/p-90fc786f.entry.js +6 -0
- package/dist/solutions-components/{p-43165ebd.entry.js → p-9c170b30.entry.js} +1 -1
- package/dist/solutions-components/p-a5b751e2.entry.js +6 -0
- package/dist/solutions-components/p-af573e0d.js +6 -0
- package/dist/solutions-components/p-bb8b1ee2.entry.js +6 -0
- package/dist/solutions-components/{p-b79f296d.entry.js → p-c48be45f.entry.js} +2 -2
- package/dist/solutions-components/p-ca3cbd29.entry.js +6 -0
- package/dist/solutions-components/p-ceb1030b.js +6 -0
- package/dist/solutions-components/{p-29047e77.entry.js → p-e1391389.entry.js} +1 -1
- package/dist/solutions-components/{p-759d0beb.entry.js → p-f728af86.entry.js} +1 -1
- package/dist/solutions-components/p-ff3858c6.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/package.json +7 -7
- package/dist/solutions-components/p-07a194e6.entry.js +0 -6
- package/dist/solutions-components/p-14d78748.entry.js +0 -6
- package/dist/solutions-components/p-24e3f09f.entry.js +0 -6
- package/dist/solutions-components/p-3a33ef72.entry.js +0 -6
- package/dist/solutions-components/p-402301cb.js +0 -6
- package/dist/solutions-components/p-41a6f03d.entry.js +0 -6
- package/dist/solutions-components/p-4db86c5e.entry.js +0 -6
- package/dist/solutions-components/p-750f234e.entry.js +0 -6
- package/dist/solutions-components/p-7e97d4d6.entry.js +0 -6
- package/dist/solutions-components/p-7eb5d31a.js +0 -6
- package/dist/solutions-components/p-90d2aadc.entry.js +0 -6
- package/dist/solutions-components/p-b78a4ce7.entry.js +0 -6
- package/dist/solutions-components/p-efb4cb43.entry.js +0 -6
@@ -7,17 +7,851 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
7
7
|
import { l as loadModules } from './loadModules2.js';
|
8
8
|
import { g as getMessages } from './locale3.js';
|
9
9
|
import { g as getMode } from './mode.js';
|
10
|
-
import { d as defineCustomElement$
|
11
|
-
import { d as defineCustomElement$
|
12
|
-
import { d as defineCustomElement$
|
13
|
-
import { d as defineCustomElement$
|
14
|
-
import { d as defineCustomElement$
|
15
|
-
import { d as defineCustomElement$
|
16
|
-
import { d as defineCustomElement$
|
17
|
-
import { d as defineCustomElement$
|
10
|
+
import { d as defineCustomElement$d } from './action.js';
|
11
|
+
import { d as defineCustomElement$c } from './button.js';
|
12
|
+
import { d as defineCustomElement$b } from './icon.js';
|
13
|
+
import { d as defineCustomElement$a } from './input.js';
|
14
|
+
import { d as defineCustomElement$9 } from './label2.js';
|
15
|
+
import { d as defineCustomElement$8 } from './loader.js';
|
16
|
+
import { d as defineCustomElement$7 } from './option.js';
|
17
|
+
import { d as defineCustomElement$6 } from './popover.js';
|
18
|
+
import { d as defineCustomElement$5 } from './progress.js';
|
19
|
+
import { d as defineCustomElement$4 } from './select.js';
|
18
20
|
import { d as defineCustomElement$3 } from './switch.js';
|
19
21
|
import { d as defineCustomElement$2 } from './instant-apps-header2.js';
|
20
22
|
|
23
|
+
function resolveUrl(url, baseUrl) {
|
24
|
+
// url is absolute already
|
25
|
+
if (url.match(/^[a-z]+:\/\//i)) {
|
26
|
+
return url;
|
27
|
+
}
|
28
|
+
// url is absolute already, without protocol
|
29
|
+
if (url.match(/^\/\//)) {
|
30
|
+
return window.location.protocol + url;
|
31
|
+
}
|
32
|
+
// dataURI, mailto:, tel:, etc.
|
33
|
+
if (url.match(/^[a-z]+:/i)) {
|
34
|
+
return url;
|
35
|
+
}
|
36
|
+
const doc = document.implementation.createHTMLDocument();
|
37
|
+
const base = doc.createElement('base');
|
38
|
+
const a = doc.createElement('a');
|
39
|
+
doc.head.appendChild(base);
|
40
|
+
doc.body.appendChild(a);
|
41
|
+
if (baseUrl) {
|
42
|
+
base.href = baseUrl;
|
43
|
+
}
|
44
|
+
a.href = url;
|
45
|
+
return a.href;
|
46
|
+
}
|
47
|
+
const uuid = (() => {
|
48
|
+
// generate uuid for className of pseudo elements.
|
49
|
+
// We should not use GUIDs, otherwise pseudo elements sometimes cannot be captured.
|
50
|
+
let counter = 0;
|
51
|
+
// ref: http://stackoverflow.com/a/6248722/2519373
|
52
|
+
const random = () =>
|
53
|
+
// eslint-disable-next-line no-bitwise
|
54
|
+
`0000${((Math.random() * 36 ** 4) << 0).toString(36)}`.slice(-4);
|
55
|
+
return () => {
|
56
|
+
counter += 1;
|
57
|
+
return `u${random()}${counter}`;
|
58
|
+
};
|
59
|
+
})();
|
60
|
+
function toArray(arrayLike) {
|
61
|
+
const arr = [];
|
62
|
+
for (let i = 0, l = arrayLike.length; i < l; i++) {
|
63
|
+
arr.push(arrayLike[i]);
|
64
|
+
}
|
65
|
+
return arr;
|
66
|
+
}
|
67
|
+
function px(node, styleProperty) {
|
68
|
+
const win = node.ownerDocument.defaultView || window;
|
69
|
+
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
|
70
|
+
return val ? parseFloat(val.replace('px', '')) : 0;
|
71
|
+
}
|
72
|
+
function getNodeWidth(node) {
|
73
|
+
const leftBorder = px(node, 'border-left-width');
|
74
|
+
const rightBorder = px(node, 'border-right-width');
|
75
|
+
return node.clientWidth + leftBorder + rightBorder;
|
76
|
+
}
|
77
|
+
function getNodeHeight(node) {
|
78
|
+
const topBorder = px(node, 'border-top-width');
|
79
|
+
const bottomBorder = px(node, 'border-bottom-width');
|
80
|
+
return node.clientHeight + topBorder + bottomBorder;
|
81
|
+
}
|
82
|
+
function getImageSize(targetNode, options = {}) {
|
83
|
+
const width = options.width || getNodeWidth(targetNode);
|
84
|
+
const height = options.height || getNodeHeight(targetNode);
|
85
|
+
return { width, height };
|
86
|
+
}
|
87
|
+
function getPixelRatio() {
|
88
|
+
let ratio;
|
89
|
+
let FINAL_PROCESS;
|
90
|
+
try {
|
91
|
+
FINAL_PROCESS = process;
|
92
|
+
}
|
93
|
+
catch (e) {
|
94
|
+
// pass
|
95
|
+
}
|
96
|
+
const val = FINAL_PROCESS && FINAL_PROCESS.env
|
97
|
+
? FINAL_PROCESS.env.devicePixelRatio
|
98
|
+
: null;
|
99
|
+
if (val) {
|
100
|
+
ratio = parseInt(val, 10);
|
101
|
+
if (Number.isNaN(ratio)) {
|
102
|
+
ratio = 1;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return ratio || window.devicePixelRatio || 1;
|
106
|
+
}
|
107
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size
|
108
|
+
const canvasDimensionLimit = 16384;
|
109
|
+
function checkCanvasDimensions(canvas) {
|
110
|
+
if (canvas.width > canvasDimensionLimit ||
|
111
|
+
canvas.height > canvasDimensionLimit) {
|
112
|
+
if (canvas.width > canvasDimensionLimit &&
|
113
|
+
canvas.height > canvasDimensionLimit) {
|
114
|
+
if (canvas.width > canvas.height) {
|
115
|
+
canvas.height *= canvasDimensionLimit / canvas.width;
|
116
|
+
canvas.width = canvasDimensionLimit;
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
canvas.width *= canvasDimensionLimit / canvas.height;
|
120
|
+
canvas.height = canvasDimensionLimit;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
else if (canvas.width > canvasDimensionLimit) {
|
124
|
+
canvas.height *= canvasDimensionLimit / canvas.width;
|
125
|
+
canvas.width = canvasDimensionLimit;
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
canvas.width *= canvasDimensionLimit / canvas.height;
|
129
|
+
canvas.height = canvasDimensionLimit;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
function createImage(url) {
|
134
|
+
return new Promise((resolve, reject) => {
|
135
|
+
const img = new Image();
|
136
|
+
img.decode = () => resolve(img);
|
137
|
+
img.onload = () => resolve(img);
|
138
|
+
img.onerror = reject;
|
139
|
+
img.crossOrigin = 'anonymous';
|
140
|
+
img.decoding = 'async';
|
141
|
+
img.src = url;
|
142
|
+
});
|
143
|
+
}
|
144
|
+
async function svgToDataURL(svg) {
|
145
|
+
return Promise.resolve()
|
146
|
+
.then(() => new XMLSerializer().serializeToString(svg))
|
147
|
+
.then(encodeURIComponent)
|
148
|
+
.then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
|
149
|
+
}
|
150
|
+
async function nodeToDataURL(node, width, height) {
|
151
|
+
const xmlns = 'http://www.w3.org/2000/svg';
|
152
|
+
const svg = document.createElementNS(xmlns, 'svg');
|
153
|
+
const foreignObject = document.createElementNS(xmlns, 'foreignObject');
|
154
|
+
svg.setAttribute('width', `${width}`);
|
155
|
+
svg.setAttribute('height', `${height}`);
|
156
|
+
svg.setAttribute('viewBox', `0 0 ${width} ${height}`);
|
157
|
+
foreignObject.setAttribute('width', '100%');
|
158
|
+
foreignObject.setAttribute('height', '100%');
|
159
|
+
foreignObject.setAttribute('x', '0');
|
160
|
+
foreignObject.setAttribute('y', '0');
|
161
|
+
foreignObject.setAttribute('externalResourcesRequired', 'true');
|
162
|
+
svg.appendChild(foreignObject);
|
163
|
+
foreignObject.appendChild(node);
|
164
|
+
return svgToDataURL(svg);
|
165
|
+
}
|
166
|
+
const isInstanceOfElement = (node, instance) => {
|
167
|
+
if (node instanceof instance)
|
168
|
+
return true;
|
169
|
+
const nodePrototype = Object.getPrototypeOf(node);
|
170
|
+
if (nodePrototype === null)
|
171
|
+
return false;
|
172
|
+
return (nodePrototype.constructor.name === instance.name ||
|
173
|
+
isInstanceOfElement(nodePrototype, instance));
|
174
|
+
};
|
175
|
+
|
176
|
+
function formatCSSText(style) {
|
177
|
+
const content = style.getPropertyValue('content');
|
178
|
+
return `${style.cssText} content: '${content.replace(/'|"/g, '')}';`;
|
179
|
+
}
|
180
|
+
function formatCSSProperties(style) {
|
181
|
+
return toArray(style)
|
182
|
+
.map((name) => {
|
183
|
+
const value = style.getPropertyValue(name);
|
184
|
+
const priority = style.getPropertyPriority(name);
|
185
|
+
return `${name}: ${value}${priority ? ' !important' : ''};`;
|
186
|
+
})
|
187
|
+
.join(' ');
|
188
|
+
}
|
189
|
+
function getPseudoElementStyle(className, pseudo, style) {
|
190
|
+
const selector = `.${className}:${pseudo}`;
|
191
|
+
const cssText = style.cssText
|
192
|
+
? formatCSSText(style)
|
193
|
+
: formatCSSProperties(style);
|
194
|
+
return document.createTextNode(`${selector}{${cssText}}`);
|
195
|
+
}
|
196
|
+
function clonePseudoElement(nativeNode, clonedNode, pseudo) {
|
197
|
+
const style = window.getComputedStyle(nativeNode, pseudo);
|
198
|
+
const content = style.getPropertyValue('content');
|
199
|
+
if (content === '' || content === 'none') {
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
const className = uuid();
|
203
|
+
try {
|
204
|
+
clonedNode.className = `${clonedNode.className} ${className}`;
|
205
|
+
}
|
206
|
+
catch (err) {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
const styleElement = document.createElement('style');
|
210
|
+
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
|
211
|
+
clonedNode.appendChild(styleElement);
|
212
|
+
}
|
213
|
+
function clonePseudoElements(nativeNode, clonedNode) {
|
214
|
+
clonePseudoElement(nativeNode, clonedNode, ':before');
|
215
|
+
clonePseudoElement(nativeNode, clonedNode, ':after');
|
216
|
+
}
|
217
|
+
|
218
|
+
const WOFF = 'application/font-woff';
|
219
|
+
const JPEG = 'image/jpeg';
|
220
|
+
const mimes = {
|
221
|
+
woff: WOFF,
|
222
|
+
woff2: WOFF,
|
223
|
+
ttf: 'application/font-truetype',
|
224
|
+
eot: 'application/vnd.ms-fontobject',
|
225
|
+
png: 'image/png',
|
226
|
+
jpg: JPEG,
|
227
|
+
jpeg: JPEG,
|
228
|
+
gif: 'image/gif',
|
229
|
+
tiff: 'image/tiff',
|
230
|
+
svg: 'image/svg+xml',
|
231
|
+
webp: 'image/webp',
|
232
|
+
};
|
233
|
+
function getExtension(url) {
|
234
|
+
const match = /\.([^./]*?)$/g.exec(url);
|
235
|
+
return match ? match[1] : '';
|
236
|
+
}
|
237
|
+
function getMimeType(url) {
|
238
|
+
const extension = getExtension(url).toLowerCase();
|
239
|
+
return mimes[extension] || '';
|
240
|
+
}
|
241
|
+
|
242
|
+
function getContentFromDataUrl(dataURL) {
|
243
|
+
return dataURL.split(/,/)[1];
|
244
|
+
}
|
245
|
+
function isDataUrl(url) {
|
246
|
+
return url.search(/^(data:)/) !== -1;
|
247
|
+
}
|
248
|
+
function makeDataUrl(content, mimeType) {
|
249
|
+
return `data:${mimeType};base64,${content}`;
|
250
|
+
}
|
251
|
+
async function fetchAsDataURL(url, init, process) {
|
252
|
+
const res = await fetch(url, init);
|
253
|
+
if (res.status === 404) {
|
254
|
+
throw new Error(`Resource "${res.url}" not found`);
|
255
|
+
}
|
256
|
+
const blob = await res.blob();
|
257
|
+
return new Promise((resolve, reject) => {
|
258
|
+
const reader = new FileReader();
|
259
|
+
reader.onerror = reject;
|
260
|
+
reader.onloadend = () => {
|
261
|
+
try {
|
262
|
+
resolve(process({ res, result: reader.result }));
|
263
|
+
}
|
264
|
+
catch (error) {
|
265
|
+
reject(error);
|
266
|
+
}
|
267
|
+
};
|
268
|
+
reader.readAsDataURL(blob);
|
269
|
+
});
|
270
|
+
}
|
271
|
+
const cache = {};
|
272
|
+
function getCacheKey(url, contentType, includeQueryParams) {
|
273
|
+
let key = url.replace(/\?.*/, '');
|
274
|
+
if (includeQueryParams) {
|
275
|
+
key = url;
|
276
|
+
}
|
277
|
+
// font resource
|
278
|
+
if (/ttf|otf|eot|woff2?/i.test(key)) {
|
279
|
+
key = key.replace(/.*\//, '');
|
280
|
+
}
|
281
|
+
return contentType ? `[${contentType}]${key}` : key;
|
282
|
+
}
|
283
|
+
async function resourceToDataURL(resourceUrl, contentType, options) {
|
284
|
+
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
|
285
|
+
if (cache[cacheKey] != null) {
|
286
|
+
return cache[cacheKey];
|
287
|
+
}
|
288
|
+
// ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
289
|
+
if (options.cacheBust) {
|
290
|
+
// eslint-disable-next-line no-param-reassign
|
291
|
+
resourceUrl += (/\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime();
|
292
|
+
}
|
293
|
+
let dataURL;
|
294
|
+
try {
|
295
|
+
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
|
296
|
+
if (!contentType) {
|
297
|
+
// eslint-disable-next-line no-param-reassign
|
298
|
+
contentType = res.headers.get('Content-Type') || '';
|
299
|
+
}
|
300
|
+
return getContentFromDataUrl(result);
|
301
|
+
});
|
302
|
+
dataURL = makeDataUrl(content, contentType);
|
303
|
+
}
|
304
|
+
catch (error) {
|
305
|
+
dataURL = options.imagePlaceholder || '';
|
306
|
+
let msg = `Failed to fetch resource: ${resourceUrl}`;
|
307
|
+
if (error) {
|
308
|
+
msg = typeof error === 'string' ? error : error.message;
|
309
|
+
}
|
310
|
+
if (msg) {
|
311
|
+
console.warn(msg);
|
312
|
+
}
|
313
|
+
}
|
314
|
+
cache[cacheKey] = dataURL;
|
315
|
+
return dataURL;
|
316
|
+
}
|
317
|
+
|
318
|
+
async function cloneCanvasElement(canvas) {
|
319
|
+
const dataURL = canvas.toDataURL();
|
320
|
+
if (dataURL === 'data:,') {
|
321
|
+
return canvas.cloneNode(false);
|
322
|
+
}
|
323
|
+
return createImage(dataURL);
|
324
|
+
}
|
325
|
+
async function cloneVideoElement(video, options) {
|
326
|
+
if (video.currentSrc) {
|
327
|
+
const canvas = document.createElement('canvas');
|
328
|
+
const ctx = canvas.getContext('2d');
|
329
|
+
canvas.width = video.clientWidth;
|
330
|
+
canvas.height = video.clientHeight;
|
331
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
332
|
+
const dataURL = canvas.toDataURL();
|
333
|
+
return createImage(dataURL);
|
334
|
+
}
|
335
|
+
const poster = video.poster;
|
336
|
+
const contentType = getMimeType(poster);
|
337
|
+
const dataURL = await resourceToDataURL(poster, contentType, options);
|
338
|
+
return createImage(dataURL);
|
339
|
+
}
|
340
|
+
async function cloneIFrameElement(iframe) {
|
341
|
+
var _a;
|
342
|
+
try {
|
343
|
+
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
|
344
|
+
return (await cloneNode(iframe.contentDocument.body, {}, true));
|
345
|
+
}
|
346
|
+
}
|
347
|
+
catch (_b) {
|
348
|
+
// Failed to clone iframe
|
349
|
+
}
|
350
|
+
return iframe.cloneNode(false);
|
351
|
+
}
|
352
|
+
async function cloneSingleNode(node, options) {
|
353
|
+
if (isInstanceOfElement(node, HTMLCanvasElement)) {
|
354
|
+
return cloneCanvasElement(node);
|
355
|
+
}
|
356
|
+
if (isInstanceOfElement(node, HTMLVideoElement)) {
|
357
|
+
return cloneVideoElement(node, options);
|
358
|
+
}
|
359
|
+
if (isInstanceOfElement(node, HTMLIFrameElement)) {
|
360
|
+
return cloneIFrameElement(node);
|
361
|
+
}
|
362
|
+
return node.cloneNode(false);
|
363
|
+
}
|
364
|
+
const isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SLOT';
|
365
|
+
async function cloneChildren(nativeNode, clonedNode, options) {
|
366
|
+
var _a, _b;
|
367
|
+
let children = [];
|
368
|
+
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
|
369
|
+
children = toArray(nativeNode.assignedNodes());
|
370
|
+
}
|
371
|
+
else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&
|
372
|
+
((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
373
|
+
children = toArray(nativeNode.contentDocument.body.childNodes);
|
374
|
+
}
|
375
|
+
else {
|
376
|
+
children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
|
377
|
+
}
|
378
|
+
if (children.length === 0 ||
|
379
|
+
isInstanceOfElement(nativeNode, HTMLVideoElement)) {
|
380
|
+
return clonedNode;
|
381
|
+
}
|
382
|
+
await children.reduce((deferred, child) => deferred
|
383
|
+
.then(() => cloneNode(child, options))
|
384
|
+
.then((clonedChild) => {
|
385
|
+
if (clonedChild) {
|
386
|
+
clonedNode.appendChild(clonedChild);
|
387
|
+
}
|
388
|
+
}), Promise.resolve());
|
389
|
+
return clonedNode;
|
390
|
+
}
|
391
|
+
function cloneCSSStyle(nativeNode, clonedNode) {
|
392
|
+
const targetStyle = clonedNode.style;
|
393
|
+
if (!targetStyle) {
|
394
|
+
return;
|
395
|
+
}
|
396
|
+
const sourceStyle = window.getComputedStyle(nativeNode);
|
397
|
+
if (sourceStyle.cssText) {
|
398
|
+
targetStyle.cssText = sourceStyle.cssText;
|
399
|
+
targetStyle.transformOrigin = sourceStyle.transformOrigin;
|
400
|
+
}
|
401
|
+
else {
|
402
|
+
toArray(sourceStyle).forEach((name) => {
|
403
|
+
let value = sourceStyle.getPropertyValue(name);
|
404
|
+
if (name === 'font-size' && value.endsWith('px')) {
|
405
|
+
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
|
406
|
+
value = `${reducedFont}px`;
|
407
|
+
}
|
408
|
+
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) &&
|
409
|
+
name === 'display' &&
|
410
|
+
value === 'inline') {
|
411
|
+
value = 'block';
|
412
|
+
}
|
413
|
+
if (name === 'd' && clonedNode.getAttribute('d')) {
|
414
|
+
value = `path(${clonedNode.getAttribute('d')})`;
|
415
|
+
}
|
416
|
+
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
|
417
|
+
});
|
418
|
+
}
|
419
|
+
}
|
420
|
+
function cloneInputValue(nativeNode, clonedNode) {
|
421
|
+
if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
|
422
|
+
clonedNode.innerHTML = nativeNode.value;
|
423
|
+
}
|
424
|
+
if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
|
425
|
+
clonedNode.setAttribute('value', nativeNode.value);
|
426
|
+
}
|
427
|
+
}
|
428
|
+
function cloneSelectValue(nativeNode, clonedNode) {
|
429
|
+
if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
|
430
|
+
const clonedSelect = clonedNode;
|
431
|
+
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute('value'));
|
432
|
+
if (selectedOption) {
|
433
|
+
selectedOption.setAttribute('selected', '');
|
434
|
+
}
|
435
|
+
}
|
436
|
+
}
|
437
|
+
function decorate(nativeNode, clonedNode) {
|
438
|
+
if (isInstanceOfElement(clonedNode, Element)) {
|
439
|
+
cloneCSSStyle(nativeNode, clonedNode);
|
440
|
+
clonePseudoElements(nativeNode, clonedNode);
|
441
|
+
cloneInputValue(nativeNode, clonedNode);
|
442
|
+
cloneSelectValue(nativeNode, clonedNode);
|
443
|
+
}
|
444
|
+
return clonedNode;
|
445
|
+
}
|
446
|
+
async function ensureSVGSymbols(clone, options) {
|
447
|
+
const uses = clone.querySelectorAll ? clone.querySelectorAll('use') : [];
|
448
|
+
if (uses.length === 0) {
|
449
|
+
return clone;
|
450
|
+
}
|
451
|
+
const processedDefs = {};
|
452
|
+
for (let i = 0; i < uses.length; i++) {
|
453
|
+
const use = uses[i];
|
454
|
+
const id = use.getAttribute('xlink:href');
|
455
|
+
if (id) {
|
456
|
+
const exist = clone.querySelector(id);
|
457
|
+
const definition = document.querySelector(id);
|
458
|
+
if (!exist && definition && !processedDefs[id]) {
|
459
|
+
// eslint-disable-next-line no-await-in-loop
|
460
|
+
processedDefs[id] = (await cloneNode(definition, options, true));
|
461
|
+
}
|
462
|
+
}
|
463
|
+
}
|
464
|
+
const nodes = Object.values(processedDefs);
|
465
|
+
if (nodes.length) {
|
466
|
+
const ns = 'http://www.w3.org/1999/xhtml';
|
467
|
+
const svg = document.createElementNS(ns, 'svg');
|
468
|
+
svg.setAttribute('xmlns', ns);
|
469
|
+
svg.style.position = 'absolute';
|
470
|
+
svg.style.width = '0';
|
471
|
+
svg.style.height = '0';
|
472
|
+
svg.style.overflow = 'hidden';
|
473
|
+
svg.style.display = 'none';
|
474
|
+
const defs = document.createElementNS(ns, 'defs');
|
475
|
+
svg.appendChild(defs);
|
476
|
+
for (let i = 0; i < nodes.length; i++) {
|
477
|
+
defs.appendChild(nodes[i]);
|
478
|
+
}
|
479
|
+
clone.appendChild(svg);
|
480
|
+
}
|
481
|
+
return clone;
|
482
|
+
}
|
483
|
+
async function cloneNode(node, options, isRoot) {
|
484
|
+
if (!isRoot && options.filter && !options.filter(node)) {
|
485
|
+
return null;
|
486
|
+
}
|
487
|
+
return Promise.resolve(node)
|
488
|
+
.then((clonedNode) => cloneSingleNode(clonedNode, options))
|
489
|
+
.then((clonedNode) => cloneChildren(node, clonedNode, options))
|
490
|
+
.then((clonedNode) => decorate(node, clonedNode))
|
491
|
+
.then((clonedNode) => ensureSVGSymbols(clonedNode, options));
|
492
|
+
}
|
493
|
+
|
494
|
+
const URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
|
495
|
+
const URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
|
496
|
+
const FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
497
|
+
function toRegex(url) {
|
498
|
+
// eslint-disable-next-line no-useless-escape
|
499
|
+
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
|
500
|
+
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, 'g');
|
501
|
+
}
|
502
|
+
function parseURLs(cssText) {
|
503
|
+
const urls = [];
|
504
|
+
cssText.replace(URL_REGEX, (raw, quotation, url) => {
|
505
|
+
urls.push(url);
|
506
|
+
return raw;
|
507
|
+
});
|
508
|
+
return urls.filter((url) => !isDataUrl(url));
|
509
|
+
}
|
510
|
+
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
|
511
|
+
try {
|
512
|
+
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
|
513
|
+
const contentType = getMimeType(resourceURL);
|
514
|
+
let dataURL;
|
515
|
+
if (getContentFromUrl) {
|
516
|
+
const content = await getContentFromUrl(resolvedURL);
|
517
|
+
dataURL = makeDataUrl(content, contentType);
|
518
|
+
}
|
519
|
+
else {
|
520
|
+
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
521
|
+
}
|
522
|
+
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
523
|
+
}
|
524
|
+
catch (error) {
|
525
|
+
// pass
|
526
|
+
}
|
527
|
+
return cssText;
|
528
|
+
}
|
529
|
+
function filterPreferredFontFormat(str, { preferredFontFormat }) {
|
530
|
+
return !preferredFontFormat
|
531
|
+
? str
|
532
|
+
: str.replace(FONT_SRC_REGEX, (match) => {
|
533
|
+
// eslint-disable-next-line no-constant-condition
|
534
|
+
while (true) {
|
535
|
+
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
|
536
|
+
if (!format) {
|
537
|
+
return '';
|
538
|
+
}
|
539
|
+
if (format === preferredFontFormat) {
|
540
|
+
return `src: ${src};`;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
});
|
544
|
+
}
|
545
|
+
function shouldEmbed(url) {
|
546
|
+
return url.search(URL_REGEX) !== -1;
|
547
|
+
}
|
548
|
+
async function embedResources(cssText, baseUrl, options) {
|
549
|
+
if (!shouldEmbed(cssText)) {
|
550
|
+
return cssText;
|
551
|
+
}
|
552
|
+
const filteredCSSText = filterPreferredFontFormat(cssText, options);
|
553
|
+
const urls = parseURLs(filteredCSSText);
|
554
|
+
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
|
555
|
+
}
|
556
|
+
|
557
|
+
async function embedProp(propName, node, options) {
|
558
|
+
var _a;
|
559
|
+
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
|
560
|
+
if (propValue) {
|
561
|
+
const cssString = await embedResources(propValue, null, options);
|
562
|
+
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
|
563
|
+
return true;
|
564
|
+
}
|
565
|
+
return false;
|
566
|
+
}
|
567
|
+
async function embedBackground(clonedNode, options) {
|
568
|
+
if (!(await embedProp('background', clonedNode, options))) {
|
569
|
+
await embedProp('background-image', clonedNode, options);
|
570
|
+
}
|
571
|
+
if (!(await embedProp('mask', clonedNode, options))) {
|
572
|
+
await embedProp('mask-image', clonedNode, options);
|
573
|
+
}
|
574
|
+
}
|
575
|
+
async function embedImageNode(clonedNode, options) {
|
576
|
+
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
|
577
|
+
if (!(isImageElement && !isDataUrl(clonedNode.src)) &&
|
578
|
+
!(isInstanceOfElement(clonedNode, SVGImageElement) &&
|
579
|
+
!isDataUrl(clonedNode.href.baseVal))) {
|
580
|
+
return;
|
581
|
+
}
|
582
|
+
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
|
583
|
+
const dataURL = await resourceToDataURL(url, getMimeType(url), options);
|
584
|
+
await new Promise((resolve, reject) => {
|
585
|
+
clonedNode.onload = resolve;
|
586
|
+
clonedNode.onerror = reject;
|
587
|
+
const image = clonedNode;
|
588
|
+
if (image.decode) {
|
589
|
+
image.decode = resolve;
|
590
|
+
}
|
591
|
+
if (image.loading === 'lazy') {
|
592
|
+
image.loading = 'eager';
|
593
|
+
}
|
594
|
+
if (isImageElement) {
|
595
|
+
clonedNode.srcset = '';
|
596
|
+
clonedNode.src = dataURL;
|
597
|
+
}
|
598
|
+
else {
|
599
|
+
clonedNode.href.baseVal = dataURL;
|
600
|
+
}
|
601
|
+
});
|
602
|
+
}
|
603
|
+
async function embedChildren(clonedNode, options) {
|
604
|
+
const children = toArray(clonedNode.childNodes);
|
605
|
+
const deferreds = children.map((child) => embedImages(child, options));
|
606
|
+
await Promise.all(deferreds).then(() => clonedNode);
|
607
|
+
}
|
608
|
+
async function embedImages(clonedNode, options) {
|
609
|
+
if (isInstanceOfElement(clonedNode, Element)) {
|
610
|
+
await embedBackground(clonedNode, options);
|
611
|
+
await embedImageNode(clonedNode, options);
|
612
|
+
await embedChildren(clonedNode, options);
|
613
|
+
}
|
614
|
+
}
|
615
|
+
|
616
|
+
function applyStyle(node, options) {
|
617
|
+
const { style } = node;
|
618
|
+
if (options.backgroundColor) {
|
619
|
+
style.backgroundColor = options.backgroundColor;
|
620
|
+
}
|
621
|
+
if (options.width) {
|
622
|
+
style.width = `${options.width}px`;
|
623
|
+
}
|
624
|
+
if (options.height) {
|
625
|
+
style.height = `${options.height}px`;
|
626
|
+
}
|
627
|
+
const manual = options.style;
|
628
|
+
if (manual != null) {
|
629
|
+
Object.keys(manual).forEach((key) => {
|
630
|
+
style[key] = manual[key];
|
631
|
+
});
|
632
|
+
}
|
633
|
+
return node;
|
634
|
+
}
|
635
|
+
|
636
|
+
const cssFetchCache = {};
|
637
|
+
async function fetchCSS(url) {
|
638
|
+
let cache = cssFetchCache[url];
|
639
|
+
if (cache != null) {
|
640
|
+
return cache;
|
641
|
+
}
|
642
|
+
const res = await fetch(url);
|
643
|
+
const cssText = await res.text();
|
644
|
+
cache = { url, cssText };
|
645
|
+
cssFetchCache[url] = cache;
|
646
|
+
return cache;
|
647
|
+
}
|
648
|
+
async function embedFonts(data, options) {
|
649
|
+
let cssText = data.cssText;
|
650
|
+
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
|
651
|
+
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
|
652
|
+
const loadFonts = fontLocs.map(async (loc) => {
|
653
|
+
let url = loc.replace(regexUrl, '$1');
|
654
|
+
if (!url.startsWith('https://')) {
|
655
|
+
url = new URL(url, data.url).href;
|
656
|
+
}
|
657
|
+
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
|
658
|
+
cssText = cssText.replace(loc, `url(${result})`);
|
659
|
+
return [loc, result];
|
660
|
+
});
|
661
|
+
});
|
662
|
+
return Promise.all(loadFonts).then(() => cssText);
|
663
|
+
}
|
664
|
+
function parseCSS(source) {
|
665
|
+
if (source == null) {
|
666
|
+
return [];
|
667
|
+
}
|
668
|
+
const result = [];
|
669
|
+
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
|
670
|
+
// strip out comments
|
671
|
+
let cssText = source.replace(commentsRegex, '');
|
672
|
+
// eslint-disable-next-line prefer-regex-literals
|
673
|
+
const keyframesRegex = new RegExp('((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})', 'gi');
|
674
|
+
// eslint-disable-next-line no-constant-condition
|
675
|
+
while (true) {
|
676
|
+
const matches = keyframesRegex.exec(cssText);
|
677
|
+
if (matches === null) {
|
678
|
+
break;
|
679
|
+
}
|
680
|
+
result.push(matches[0]);
|
681
|
+
}
|
682
|
+
cssText = cssText.replace(keyframesRegex, '');
|
683
|
+
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
|
684
|
+
// to match css & media queries together
|
685
|
+
const combinedCSSRegex = '((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]' +
|
686
|
+
'*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})';
|
687
|
+
// unified regex
|
688
|
+
const unifiedRegex = new RegExp(combinedCSSRegex, 'gi');
|
689
|
+
// eslint-disable-next-line no-constant-condition
|
690
|
+
while (true) {
|
691
|
+
let matches = importRegex.exec(cssText);
|
692
|
+
if (matches === null) {
|
693
|
+
matches = unifiedRegex.exec(cssText);
|
694
|
+
if (matches === null) {
|
695
|
+
break;
|
696
|
+
}
|
697
|
+
else {
|
698
|
+
importRegex.lastIndex = unifiedRegex.lastIndex;
|
699
|
+
}
|
700
|
+
}
|
701
|
+
else {
|
702
|
+
unifiedRegex.lastIndex = importRegex.lastIndex;
|
703
|
+
}
|
704
|
+
result.push(matches[0]);
|
705
|
+
}
|
706
|
+
return result;
|
707
|
+
}
|
708
|
+
async function getCSSRules(styleSheets, options) {
|
709
|
+
const ret = [];
|
710
|
+
const deferreds = [];
|
711
|
+
// First loop inlines imports
|
712
|
+
styleSheets.forEach((sheet) => {
|
713
|
+
if ('cssRules' in sheet) {
|
714
|
+
try {
|
715
|
+
toArray(sheet.cssRules || []).forEach((item, index) => {
|
716
|
+
if (item.type === CSSRule.IMPORT_RULE) {
|
717
|
+
let importIndex = index + 1;
|
718
|
+
const url = item.href;
|
719
|
+
const deferred = fetchCSS(url)
|
720
|
+
.then((metadata) => embedFonts(metadata, options))
|
721
|
+
.then((cssText) => parseCSS(cssText).forEach((rule) => {
|
722
|
+
try {
|
723
|
+
sheet.insertRule(rule, rule.startsWith('@import')
|
724
|
+
? (importIndex += 1)
|
725
|
+
: sheet.cssRules.length);
|
726
|
+
}
|
727
|
+
catch (error) {
|
728
|
+
console.error('Error inserting rule from remote css', {
|
729
|
+
rule,
|
730
|
+
error,
|
731
|
+
});
|
732
|
+
}
|
733
|
+
}))
|
734
|
+
.catch((e) => {
|
735
|
+
console.error('Error loading remote css', e.toString());
|
736
|
+
});
|
737
|
+
deferreds.push(deferred);
|
738
|
+
}
|
739
|
+
});
|
740
|
+
}
|
741
|
+
catch (e) {
|
742
|
+
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
|
743
|
+
if (sheet.href != null) {
|
744
|
+
deferreds.push(fetchCSS(sheet.href)
|
745
|
+
.then((metadata) => embedFonts(metadata, options))
|
746
|
+
.then((cssText) => parseCSS(cssText).forEach((rule) => {
|
747
|
+
inline.insertRule(rule, sheet.cssRules.length);
|
748
|
+
}))
|
749
|
+
.catch((err) => {
|
750
|
+
console.error('Error loading remote stylesheet', err);
|
751
|
+
}));
|
752
|
+
}
|
753
|
+
console.error('Error inlining remote css file', e);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
});
|
757
|
+
return Promise.all(deferreds).then(() => {
|
758
|
+
// Second loop parses rules
|
759
|
+
styleSheets.forEach((sheet) => {
|
760
|
+
if ('cssRules' in sheet) {
|
761
|
+
try {
|
762
|
+
toArray(sheet.cssRules || []).forEach((item) => {
|
763
|
+
ret.push(item);
|
764
|
+
});
|
765
|
+
}
|
766
|
+
catch (e) {
|
767
|
+
console.error(`Error while reading CSS rules from ${sheet.href}`, e);
|
768
|
+
}
|
769
|
+
}
|
770
|
+
});
|
771
|
+
return ret;
|
772
|
+
});
|
773
|
+
}
|
774
|
+
function getWebFontRules(cssRules) {
|
775
|
+
return cssRules
|
776
|
+
.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE)
|
777
|
+
.filter((rule) => shouldEmbed(rule.style.getPropertyValue('src')));
|
778
|
+
}
|
779
|
+
async function parseWebFontRules(node, options) {
|
780
|
+
if (node.ownerDocument == null) {
|
781
|
+
throw new Error('Provided element is not within a Document');
|
782
|
+
}
|
783
|
+
const styleSheets = toArray(node.ownerDocument.styleSheets);
|
784
|
+
const cssRules = await getCSSRules(styleSheets, options);
|
785
|
+
return getWebFontRules(cssRules);
|
786
|
+
}
|
787
|
+
async function getWebFontCSS(node, options) {
|
788
|
+
const rules = await parseWebFontRules(node, options);
|
789
|
+
const cssTexts = await Promise.all(rules.map((rule) => {
|
790
|
+
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
|
791
|
+
return embedResources(rule.cssText, baseUrl, options);
|
792
|
+
}));
|
793
|
+
return cssTexts.join('\n');
|
794
|
+
}
|
795
|
+
async function embedWebFonts(clonedNode, options) {
|
796
|
+
const cssText = options.fontEmbedCSS != null
|
797
|
+
? options.fontEmbedCSS
|
798
|
+
: options.skipFonts
|
799
|
+
? null
|
800
|
+
: await getWebFontCSS(clonedNode, options);
|
801
|
+
if (cssText) {
|
802
|
+
const styleNode = document.createElement('style');
|
803
|
+
const sytleContent = document.createTextNode(cssText);
|
804
|
+
styleNode.appendChild(sytleContent);
|
805
|
+
if (clonedNode.firstChild) {
|
806
|
+
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
|
807
|
+
}
|
808
|
+
else {
|
809
|
+
clonedNode.appendChild(styleNode);
|
810
|
+
}
|
811
|
+
}
|
812
|
+
}
|
813
|
+
|
814
|
+
async function toSvg(node, options = {}) {
|
815
|
+
const { width, height } = getImageSize(node, options);
|
816
|
+
const clonedNode = (await cloneNode(node, options, true));
|
817
|
+
await embedWebFonts(clonedNode, options);
|
818
|
+
await embedImages(clonedNode, options);
|
819
|
+
applyStyle(clonedNode, options);
|
820
|
+
const datauri = await nodeToDataURL(clonedNode, width, height);
|
821
|
+
return datauri;
|
822
|
+
}
|
823
|
+
async function toCanvas(node, options = {}) {
|
824
|
+
const { width, height } = getImageSize(node, options);
|
825
|
+
const svg = await toSvg(node, options);
|
826
|
+
const img = await createImage(svg);
|
827
|
+
const canvas = document.createElement('canvas');
|
828
|
+
const context = canvas.getContext('2d');
|
829
|
+
const ratio = options.pixelRatio || getPixelRatio();
|
830
|
+
const canvasWidth = options.canvasWidth || width;
|
831
|
+
const canvasHeight = options.canvasHeight || height;
|
832
|
+
canvas.width = canvasWidth * ratio;
|
833
|
+
canvas.height = canvasHeight * ratio;
|
834
|
+
if (!options.skipAutoScale) {
|
835
|
+
checkCanvasDimensions(canvas);
|
836
|
+
}
|
837
|
+
canvas.style.width = `${canvasWidth}`;
|
838
|
+
canvas.style.height = `${canvasHeight}`;
|
839
|
+
if (options.backgroundColor) {
|
840
|
+
context.fillStyle = options.backgroundColor;
|
841
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
842
|
+
}
|
843
|
+
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
844
|
+
return canvas;
|
845
|
+
}
|
846
|
+
async function toPng(node, options = {}) {
|
847
|
+
const canvas = await toCanvas(node, options);
|
848
|
+
return canvas.toDataURL();
|
849
|
+
}
|
850
|
+
async function toJpeg(node, options = {}) {
|
851
|
+
const canvas = await toCanvas(node, options);
|
852
|
+
return canvas.toDataURL('image/jpeg', options.quality || 1);
|
853
|
+
}
|
854
|
+
|
21
855
|
const printStyling = `
|
22
856
|
@media print {
|
23
857
|
@page {
|
@@ -42,15 +876,27 @@ const printStyling = `
|
|
42
876
|
|
43
877
|
|
44
878
|
.instant-apps-export-print {
|
45
|
-
height: 100%;
|
46
|
-
width: 100%;
|
47
879
|
position: absolute;
|
48
880
|
z-index: -999;
|
49
881
|
color: #323232 !important;
|
882
|
+
--esri-calcite-mode-name: "light";
|
883
|
+
}
|
884
|
+
|
885
|
+
.instant-apps-export-print__pdf {
|
886
|
+
height: 100%;
|
887
|
+
width: 100%;
|
50
888
|
display: grid;
|
51
889
|
gap: 24px;
|
52
890
|
grid-auto-flow: row;
|
53
|
-
|
891
|
+
}
|
892
|
+
|
893
|
+
.instant-apps-export-print__img {
|
894
|
+
display: grid;
|
895
|
+
width: auto;
|
896
|
+
}
|
897
|
+
|
898
|
+
.instant-apps-export-print__img--extra-content {
|
899
|
+
grid-template-columns: 2fr minmax(0, 325px);
|
54
900
|
}
|
55
901
|
|
56
902
|
.instant-apps-export-print, .instant-apps-export-print * {
|
@@ -68,30 +914,55 @@ const printStyling = `
|
|
68
914
|
justify-content: center;
|
69
915
|
}
|
70
916
|
|
917
|
+
.instant-apps-export-print__img .instant-apps-export-print__view-container {
|
918
|
+
grid-row: 1;
|
919
|
+
grid-column: 1;
|
920
|
+
}
|
921
|
+
|
71
922
|
.instant-apps-export-print__view-wrapper {
|
72
923
|
height: fit-content;
|
73
924
|
width: fit-content;
|
74
925
|
position: relative;
|
75
926
|
display: flex;
|
76
927
|
flex-direction: column;
|
77
|
-
border: 2pt solid #323232;
|
78
928
|
overflow: hidden;
|
79
929
|
}
|
80
930
|
|
931
|
+
.instant-apps-export-print__pdf .instant-apps-export-print__view-wrapper {
|
932
|
+
border: 2pt solid #323232;
|
933
|
+
}
|
934
|
+
|
935
|
+
.instant-apps-export-print__img .instant-apps-export-print__view-wrapper {
|
936
|
+
border: 1pt solid #323232;
|
937
|
+
}
|
938
|
+
|
81
939
|
.instant-apps-export-print__view {
|
82
940
|
object-fit: contain;
|
83
941
|
}
|
84
942
|
|
943
|
+
.instant-apps-export-print__extra-container {
|
944
|
+
grid-row: 1 / span 2;
|
945
|
+
grid-column: 2;
|
946
|
+
}
|
947
|
+
|
85
948
|
.instant-apps-export-print__popup-container {
|
86
949
|
height: min-content;
|
87
|
-
max-width:
|
950
|
+
max-width: 325px;
|
88
951
|
display: none;
|
89
952
|
color: #323232;
|
90
953
|
background: #fff;
|
91
|
-
border: 1pt solid #323232;
|
92
954
|
break-inside: avoid;
|
93
955
|
}
|
94
956
|
|
957
|
+
.instant-apps-export-print__pdf .instant-apps-export-print__popup-container {
|
958
|
+
border: 1pt solid #323232;
|
959
|
+
}
|
960
|
+
|
961
|
+
.instant-apps-export-print__img .instant-apps-export-print__popup-container {
|
962
|
+
grid-row: 1 / span 2;
|
963
|
+
grid-column: 2;
|
964
|
+
}
|
965
|
+
|
95
966
|
.instant-apps-export-print__popup-title {
|
96
967
|
border-bottom: 1pt solid #323232;
|
97
968
|
}
|
@@ -111,6 +982,12 @@ const printStyling = `
|
|
111
982
|
overflow: unset;
|
112
983
|
}
|
113
984
|
|
985
|
+
.instant-apps-export-print__img .instant-apps-export-print__legend-container {
|
986
|
+
margin: 14px;
|
987
|
+
grid-row: 2;
|
988
|
+
grid-column: 1;
|
989
|
+
}
|
990
|
+
|
114
991
|
.esri-legend--card, .esri-legend--card__service-content {
|
115
992
|
flex-flow: row wrap;
|
116
993
|
}
|
@@ -120,7 +997,7 @@ const printStyling = `
|
|
120
997
|
color: #323232;
|
121
998
|
}
|
122
999
|
|
123
|
-
.instant-apps-export-print__popup-content * {
|
1000
|
+
.instant-apps-export-print__popup-content *, .instant-apps-export-print__img .esri-feature.esri-widget * {
|
124
1001
|
color: #323232;
|
125
1002
|
}
|
126
1003
|
|
@@ -309,7 +1186,6 @@ const screenshotStyling = `
|
|
309
1186
|
max-height: 75%;
|
310
1187
|
max-width: 75%;
|
311
1188
|
object-fit: contain;
|
312
|
-
border: 10px solid white;
|
313
1189
|
box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.5);
|
314
1190
|
margin-bottom: 0.5em;
|
315
1191
|
}
|
@@ -329,7 +1205,7 @@ const screenshotStyling = `
|
|
329
1205
|
margin: 5px;
|
330
1206
|
}`;
|
331
1207
|
|
332
|
-
const instantAppsExportCss = ":host{display:block;--instant-apps-export-action-background:var(--calcite-color-foreground-1);--instant-apps-export-action-background-hover:var(--calcite-color-foreground-2);--instant-apps-export-action-background-press:var(--calcite-color-foreground-3);--instant-apps-export-action-height:100%;--instant-apps-export-action-width:fit-content;--instant-apps-export-action-icon-color:var(--calcite-color-text-3);--instant-apps-export-action-icon-hover-color:var(--calcite-color-text-1);--instant-apps-export-background:var(--calcite-color-foreground-1);--instant-apps-export-text-color:var(--calcite-color-text-1);--instant-apps-export-popover-width:250px}.instant-apps-export{height:100%}.instant-apps-export *{box-sizing:border-box}.instant-apps-export__popover-container,.instant-apps-export__inline-container{padding:12px;background:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export__popover-container{width:var(--instant-apps-export-popover-width)}.instant-apps-export calcite-action{height:var(--instant-apps-export-action-height);width:var(--instant-apps-export-action-width);--calcite-color-foreground-1:var(--instant-apps-export-action-background);--calcite-color-foreground-2:var(--instant-apps-export-action-background-hover);--calcite-color-foreground-3:var(--instant-apps-export-action-background-press);--calcite-color-text-3:var(--instant-apps-export-action-icon-color);--calcite-color-text-1:var(--instant-apps-export-action-icon-hover-color)}.instant-apps-export .instant-apps-export-print{display:none}.instant-apps-export__visually-hidden{position:absolute;top:0;z-index:-1;visibility:hidden}.instant-apps-export calcite-input{--calcite-color-foreground-1:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export calcite-popover{--calcite-color-foreground-1:var(--instant-apps-export-background)}.instant-apps-export calcite-switch{--calcite-color-foreground-1:#fff;--calcite-color-foreground-2:#f3f3f3}.instant-apps-export calcite-button:last-of-type{margin-top:0.5rem}.instant-apps-export .calcite-mode-dark calcite-switch{--calcite-color-foreground-1:#2b2b2b;--calcite-color-foreground-2:#202020}.instant-apps-export__compass-container.esri-widget{background:#fff;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.instant-apps-export__compass-container.esri-widget .esri-compass__icon.esri-icon-compass{color:#6e6e6e}.hide{display:none}.screenshotCursor{cursor:crosshair}";
|
1208
|
+
const instantAppsExportCss = ":host{display:block;--instant-apps-export-action-background:var(--calcite-color-foreground-1);--instant-apps-export-action-background-hover:var(--calcite-color-foreground-2);--instant-apps-export-action-background-press:var(--calcite-color-foreground-3);--instant-apps-export-action-height:100%;--instant-apps-export-action-width:fit-content;--instant-apps-export-action-icon-color:var(--calcite-color-text-3);--instant-apps-export-action-icon-hover-color:var(--calcite-color-text-1);--instant-apps-export-background:var(--calcite-color-foreground-1);--instant-apps-export-text-color:var(--calcite-color-text-1);--instant-apps-export-popover-width:250px}.instant-apps-export{height:100%}.instant-apps-export *{box-sizing:border-box}.instant-apps-export__popover-container,.instant-apps-export__inline-container{padding:12px;background:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export__popover-container{width:var(--instant-apps-export-popover-width)}.instant-apps-export calcite-action{height:var(--instant-apps-export-action-height);width:var(--instant-apps-export-action-width);--calcite-color-foreground-1:var(--instant-apps-export-action-background);--calcite-color-foreground-2:var(--instant-apps-export-action-background-hover);--calcite-color-foreground-3:var(--instant-apps-export-action-background-press);--calcite-color-text-3:var(--instant-apps-export-action-icon-color);--calcite-color-text-1:var(--instant-apps-export-action-icon-hover-color)}.instant-apps-export .instant-apps-export-print{display:none}.instant-apps-export .instant-apps-export-print_img{display:flex;flex-flow:row wrap}.instant-apps-export__visually-hidden{position:absolute;top:0;z-index:-1;visibility:hidden}.instant-apps-export calcite-input{--calcite-color-foreground-1:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export calcite-popover{--calcite-color-foreground-1:var(--instant-apps-export-background)}.instant-apps-export calcite-switch{--calcite-color-foreground-1:#fff;--calcite-color-foreground-2:#f3f3f3}.instant-apps-export calcite-button:last-of-type{margin-top:0.5rem}.instant-apps-export .calcite-mode-dark calcite-switch{--calcite-color-foreground-1:#2b2b2b;--calcite-color-foreground-2:#202020}.instant-apps-export__compass-container.esri-widget{background:#fff;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.instant-apps-export__compass-container.esri-widget .esri-compass__icon.esri-icon-compass{color:#6e6e6e}.hide{display:none}.screenshotCursor{cursor:crosshair}";
|
333
1209
|
const InstantAppsExportStyle0 = instantAppsExportCss;
|
334
1210
|
|
335
1211
|
const CSS = {
|
@@ -339,7 +1215,9 @@ const CSS = {
|
|
339
1215
|
popoverContainer: 'instant-apps-export__popover-container',
|
340
1216
|
hidden: 'instant-apps-export__visually-hidden',
|
341
1217
|
print: {
|
342
|
-
|
1218
|
+
pdfBase: 'instant-apps-export-print instant-apps-export-print__pdf',
|
1219
|
+
imgBase: 'instant-apps-export-print instant-apps-export-print__img',
|
1220
|
+
imgExtraContent: 'instant-apps-export-print__img--extra-content',
|
343
1221
|
contentContainer: 'instant-apps-export-print__content-container',
|
344
1222
|
extraContainer: 'instant-apps-export-print__extra-container',
|
345
1223
|
legendContainer: 'instant-apps-export-print__legend-container',
|
@@ -361,16 +1239,20 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
361
1239
|
this.__registerHost();
|
362
1240
|
this.__attachShadow();
|
363
1241
|
this.exportOutputUpdated = createEvent(this, "exportOutputUpdated", 7);
|
1242
|
+
this.fileTypes = ['PDF', 'JPG', 'PNG'];
|
364
1243
|
this.output = undefined;
|
365
1244
|
this.beforeExport = () => Promise.resolve();
|
366
1245
|
this.popoverIcon = 'export';
|
367
1246
|
this.extraContent = undefined;
|
368
1247
|
this.extraContentLabel = undefined;
|
369
1248
|
this.headerTitle = '';
|
1249
|
+
this.logoImage = '';
|
370
1250
|
this.includeExtraContent = true;
|
1251
|
+
this.showExtraContentInImg = false;
|
371
1252
|
this.includeLegend = true;
|
372
1253
|
this.includeMap = true;
|
373
1254
|
this.includePopup = false;
|
1255
|
+
this.includeFileFormat = true;
|
374
1256
|
this.mode = 'popover';
|
375
1257
|
this.popoverPositioning = 'absolute';
|
376
1258
|
this.popoverPlacement = 'auto';
|
@@ -386,6 +1268,7 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
386
1268
|
this.baseClass = CSS.baseLight;
|
387
1269
|
this.exportIsLoading = undefined;
|
388
1270
|
this.messages = undefined;
|
1271
|
+
this.selectedFileType = 'PDF';
|
389
1272
|
}
|
390
1273
|
watchIncludeMap(includeMap) {
|
391
1274
|
if (includeMap) {
|
@@ -413,7 +1296,7 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
413
1296
|
render() {
|
414
1297
|
const mode = this.mode === 'popover' ? this.renderPopover() : this.renderPanel();
|
415
1298
|
const compass = this.renderCompass();
|
416
|
-
return (h(Host, { key: '
|
1299
|
+
return (h(Host, { key: '9811c244faf2c794db3edaad498a9a902cb3faad' }, h("div", { key: 'cb880c04d46ec06a9588cedc0bd90ab62d25c0ac', class: this.baseClass, onMouseEnter: this.handleWidgetCreation.bind(this), onFocusin: this.handleWidgetCreation.bind(this) }, mode, h("div", { key: 'fc7ccd1eeb4b6a82bd9804d1aa73c4f242085a56', class: CSS.hidden }, compass))));
|
417
1300
|
}
|
418
1301
|
renderPopover() {
|
419
1302
|
var _a, _b, _c;
|
@@ -424,25 +1307,31 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
424
1307
|
];
|
425
1308
|
}
|
426
1309
|
renderPanel() {
|
427
|
-
var _a, _b;
|
1310
|
+
var _a, _b, _c;
|
428
1311
|
const headerTitle = this.showHeaderTitle ? this.renderTitle() : null;
|
429
|
-
const includeExtraContent = this.extraContent != null ? this.renderSwitch('includeExtraContent', this.extraContentLabel) : null;
|
430
|
-
const includeMap = this.showIncludeMap ? this.renderSwitch('includeMap') : null;
|
1312
|
+
const includeExtraContent = this.extraContent != null ? this.renderSwitch('includeExtraContent', this.extraContentLabel, this.selectedFileType !== 'PDF' && !this.showExtraContentInImg) : null;
|
1313
|
+
const includeMap = this.showIncludeMap ? this.renderSwitch('includeMap', undefined, this.selectedFileType !== 'PDF') : null;
|
431
1314
|
const options = this.includeMap ? this.renderMapOptions() : null;
|
432
|
-
const
|
1315
|
+
const fileType = this.includeFileFormat ? this.renderSelectFileType() : null;
|
1316
|
+
const print = this.selectedFileType === 'PDF' ? this.renderPrint() : this.renderImg();
|
433
1317
|
const panelClass = this.mode === 'inline' ? CSS.inlineContainer : CSS.popoverContainer;
|
434
|
-
return (h("div", { class: panelClass }, headerTitle, includeExtraContent, includeMap, options, this.includeMap ? (h("calcite-button", { appearance: "transparent", width: "full", onClick: this.setMapAreaOnClick.bind(this), disabled: this.exportIsLoading }, (_a = this.messages) === null || _a === void 0 ? void 0 : _a.setMapArea)) : null, h("calcite-button", { width: "full", onClick: this.exportOnClick.bind(this), disabled: this.exportIsLoading }, (_b = this.messages) === null || _b === void 0 ? void 0 : _b.export), print));
|
1318
|
+
return (h("div", { class: panelClass }, headerTitle, includeExtraContent, includeMap, options, fileType, this.includeMap ? (h("calcite-button", { appearance: "transparent", width: "full", onClick: this.setMapAreaOnClick.bind(this, true), disabled: this.exportIsLoading }, (_a = this.messages) === null || _a === void 0 ? void 0 : _a.setMapArea)) : null, h("calcite-button", { width: "full", onClick: this.exportOnClick.bind(this), disabled: this.exportIsLoading }, this.selectedFileType === 'PDF' ? (_b = this.messages) === null || _b === void 0 ? void 0 : _b.export : (_c = this.messages) === null || _c === void 0 ? void 0 : _c.preview), print));
|
435
1319
|
}
|
436
1320
|
renderTitle() {
|
437
1321
|
var _a;
|
438
1322
|
return (h("calcite-label", null, (_a = this.messages) === null || _a === void 0 ? void 0 :
|
439
1323
|
_a.title, h("calcite-input", { value: this.headerTitle, onCalciteInputInput: this.updateHeaderTitle.bind(this) })));
|
440
1324
|
}
|
441
|
-
renderSwitch(value, label) {
|
1325
|
+
renderSwitch(value, label, disabled) {
|
442
1326
|
var _a;
|
443
1327
|
const checked = this[value];
|
444
1328
|
const title = label != null ? label : (_a = this.messages) === null || _a === void 0 ? void 0 : _a[value];
|
445
|
-
return (h("calcite-label", { layout: "inline-space-between" }, title, h("calcite-switch", { checked: checked, value: value, onCalciteSwitchChange: this.optionOnChange.bind(this) })));
|
1329
|
+
return (h("calcite-label", { layout: "inline-space-between" }, title, h("calcite-switch", { checked: checked, value: value, onCalciteSwitchChange: this.optionOnChange.bind(this), disabled: disabled })));
|
1330
|
+
}
|
1331
|
+
renderSelectFileType() {
|
1332
|
+
var _a;
|
1333
|
+
return (h("calcite-label", null, (_a = this.messages) === null || _a === void 0 ? void 0 :
|
1334
|
+
_a.fileType, h("calcite-select", { onCalciteSelectChange: this.handleSelectFileType.bind(this) }, this.fileTypes.map(fileType => (h("calcite-option", { value: fileType, selected: fileType === this.selectedFileType }, fileType))))));
|
446
1335
|
}
|
447
1336
|
renderMapOptions() {
|
448
1337
|
const includeLegend = this.showIncludeLegend ? this.renderSwitch('includeLegend') : null;
|
@@ -454,10 +1343,10 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
454
1343
|
const extraContent = this.renderExtraContent();
|
455
1344
|
const legend = this.includeMap && this.showIncludeLegend ? this.renderLegend() : null;
|
456
1345
|
const popup = this.includeMap && this.showIncludePopup ? this.renderPopup() : null;
|
457
|
-
return (h("div", { ref: (el) => (this.printContainerEl = el) }, h("div", { class: CSS.print.
|
1346
|
+
return (h("div", { ref: (el) => (this.printContainerEl = el) }, h("div", { class: CSS.print.pdfBase, ref: (el) => (this.printEl = el) }, printMap, legend, h("div", { class: CSS.print.contentContainer }, popup, extraContent))));
|
458
1347
|
}
|
459
1348
|
renderPrintMap() {
|
460
|
-
return (h("div", { class: CSS.print.viewContainer, ref: (el) => (this.viewContainerEl = el) }, h("div", { class: CSS.print.viewWrapper, ref: (el) => (this.viewWrapperEl = el) }, this.headerTitle ? h("instant-apps-header", { titleText: this.headerTitle, backgroundColor: "#fff", textColor: "#323232" }) : null, h("img", { class: CSS.print.view, ref: (el) => (this.viewEl = el) }), h("div", { class: CSS.print.scaleBarContainer, ref: (el) => (this.scaleBarContainerEl = el) }))));
|
1349
|
+
return (h("div", { class: CSS.print.viewContainer, ref: (el) => (this.viewContainerEl = el) }, h("div", { class: CSS.print.viewWrapper, ref: (el) => (this.viewWrapperEl = el) }, this.headerTitle ? (h("instant-apps-header", { logoImage: this.logoImage, logoScale: "s", titleText: this.headerTitle, backgroundColor: "#fff", textColor: "#323232" })) : null, h("img", { class: CSS.print.view, ref: (el) => (this.viewEl = el) }), h("div", { class: CSS.print.scaleBarContainer, ref: (el) => (this.scaleBarContainerEl = el) }))));
|
461
1350
|
}
|
462
1351
|
renderLegend() {
|
463
1352
|
return h("div", { class: CSS.print.legendContainer, ref: (el) => (this.legendContainerEl = el) });
|
@@ -471,6 +1360,18 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
471
1360
|
renderExtraContent() {
|
472
1361
|
return h("div", { class: CSS.print.extraContainer, id: "export-content", ref: (el) => (this.extraContainerEl = el) });
|
473
1362
|
}
|
1363
|
+
renderImg() {
|
1364
|
+
const printMap = this.includeMap ? this.renderPrintMap() : null;
|
1365
|
+
const legend = this.includeMap && this.showIncludeLegend ? this.renderLegend() : null;
|
1366
|
+
let content;
|
1367
|
+
if (this.includeMap && this.showIncludePopup) {
|
1368
|
+
content = this.renderPopup();
|
1369
|
+
}
|
1370
|
+
else if (this.showExtraContentInImg && this.extraContent != null && this.includeExtraContent) {
|
1371
|
+
content = this.renderExtraContent();
|
1372
|
+
}
|
1373
|
+
return (h("div", { ref: (el) => (this.printContainerEl = el) }, h("div", { class: CSS.print.imgBase, ref: (el) => (this.printEl = el) }, printMap, legend, content)));
|
1374
|
+
}
|
474
1375
|
optionOnChange(e) {
|
475
1376
|
const { checked, value } = e.target;
|
476
1377
|
this[value] = checked;
|
@@ -491,6 +1392,40 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
491
1392
|
this.popoverEl.open = false;
|
492
1393
|
}
|
493
1394
|
}
|
1395
|
+
async exportPreviewOnClick() {
|
1396
|
+
if (this.selectedFileType === 'PDF') {
|
1397
|
+
await this.exportPDF();
|
1398
|
+
}
|
1399
|
+
else {
|
1400
|
+
this.exportImg();
|
1401
|
+
}
|
1402
|
+
}
|
1403
|
+
async exportPDF() {
|
1404
|
+
this.removeScreenshotElements();
|
1405
|
+
await this.beforeExport();
|
1406
|
+
if (this.viewWrapperEl != null && !this.viewWrapperEl.contains(this.compassContainerEl)) {
|
1407
|
+
this.viewWrapperEl.append(this.compassContainerEl);
|
1408
|
+
}
|
1409
|
+
this.handleViewExportOnClick();
|
1410
|
+
if (this.popoverEl != null) {
|
1411
|
+
this.popoverEl.open = false;
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
exportImg() {
|
1415
|
+
var _a;
|
1416
|
+
this.resetPopupVisibility();
|
1417
|
+
if (this.dataUrl == null)
|
1418
|
+
return;
|
1419
|
+
const downloadLink = document.createElement('a');
|
1420
|
+
downloadLink.id = 'download-link';
|
1421
|
+
downloadLink.href = this.dataUrl;
|
1422
|
+
downloadLink.download = (_a = this.headerTitle) !== null && _a !== void 0 ? _a : document.title;
|
1423
|
+
downloadLink.click();
|
1424
|
+
this.dataUrl = null;
|
1425
|
+
this.exportIsLoading = false;
|
1426
|
+
this.removeScreenshotElements();
|
1427
|
+
this.resetPrintContent();
|
1428
|
+
}
|
494
1429
|
async handleViewExportOnClick() {
|
495
1430
|
if (this.view != null) {
|
496
1431
|
this.addPrintStyling();
|
@@ -498,7 +1433,6 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
498
1433
|
this.handleExtraContent();
|
499
1434
|
if (this.includeMap) {
|
500
1435
|
this.updateScaleBar();
|
501
|
-
this.updatePopupToPrint();
|
502
1436
|
this.viewScreenshot();
|
503
1437
|
this.handleImgLoaded();
|
504
1438
|
}
|
@@ -522,7 +1456,9 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
522
1456
|
handleImgLoaded() {
|
523
1457
|
this.exportIsLoading = true;
|
524
1458
|
setTimeout(() => {
|
525
|
-
this.
|
1459
|
+
if (this.selectedFileType === 'PDF') {
|
1460
|
+
this.exportIsLoading = false;
|
1461
|
+
}
|
526
1462
|
this.setupViewPrintElements();
|
527
1463
|
}, 1500);
|
528
1464
|
}
|
@@ -530,7 +1466,10 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
530
1466
|
const extraContainerEl = this.printEl.querySelector('#export-content');
|
531
1467
|
if (extraContainerEl != null) {
|
532
1468
|
extraContainerEl.innerHTML = '';
|
533
|
-
|
1469
|
+
const hasExtraContent = this.extraContent != null && this.includeExtraContent;
|
1470
|
+
const imgAndFeatureVisible = this.selectedFileType !== 'PDF' && this.showExtraContentInImg && hasExtraContent;
|
1471
|
+
this.printEl.classList.toggle(CSS.print.imgExtraContent, imgAndFeatureVisible);
|
1472
|
+
if (hasExtraContent) {
|
534
1473
|
extraContainerEl.style.display = 'block';
|
535
1474
|
extraContainerEl.append(this.extraContent.cloneNode(true));
|
536
1475
|
}
|
@@ -538,13 +1477,17 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
538
1477
|
extraContainerEl.style.display = 'none';
|
539
1478
|
}
|
540
1479
|
}
|
1480
|
+
else if (this.showExtraContentInImg && this.selectedFileType !== 'PDF' && !this.includeExtraContent) {
|
1481
|
+
this.printEl.classList.toggle(CSS.print.imgExtraContent, false);
|
1482
|
+
}
|
541
1483
|
}
|
542
1484
|
resetPrintContent() {
|
543
|
-
var _a, _b;
|
1485
|
+
var _a, _b, _c;
|
544
1486
|
if (this.view != null) {
|
545
1487
|
this.screenshot = null;
|
546
1488
|
(_a = this.printContainerEl) === null || _a === void 0 ? void 0 : _a.prepend(this.printEl);
|
547
1489
|
(_b = this.printStyleEl) === null || _b === void 0 ? void 0 : _b.remove();
|
1490
|
+
(_c = this.tmpPopupTitleEl) === null || _c === void 0 ? void 0 : _c.remove();
|
548
1491
|
this.printStyleEl = undefined;
|
549
1492
|
const extraContainerEl = this.printEl.querySelector('#export-content');
|
550
1493
|
if (extraContainerEl) {
|
@@ -554,20 +1497,26 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
554
1497
|
}
|
555
1498
|
async updatePopupToPrint() {
|
556
1499
|
var _a, _b;
|
557
|
-
if (this.view
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
1500
|
+
if (this.view == null || this.popupContainerEl == null)
|
1501
|
+
return;
|
1502
|
+
this.popupContainerEl.style.display = this.includePopup && this.view.popup.visible ? 'block' : 'none';
|
1503
|
+
this.checkPopupOpen();
|
1504
|
+
const popupVisible = this.includePopup && (this.view.popup.visible || this.popupHiddenByMapArea) && this.view.popup.selectedFeature != null;
|
1505
|
+
this.printEl.classList.toggle(CSS.print.imgExtraContent, this.selectedFileType !== 'PDF' && popupVisible);
|
1506
|
+
if (popupVisible) {
|
1507
|
+
const heading = document.createElement(`h${(_a = this.view.popup.headingLevel) !== null && _a !== void 0 ? _a : 2}`);
|
1508
|
+
heading.innerHTML = (_b = this.view.popup.title) !== null && _b !== void 0 ? _b : '';
|
1509
|
+
heading.className = 'esri-widget__heading esri-popup__header-title';
|
1510
|
+
if (this.popupTitleEl == null) {
|
1511
|
+
this.tmpPopupTitleEl = document.createElement('div');
|
1512
|
+
this.tmpPopupTitleEl.prepend(heading);
|
1513
|
+
this.tmpPopupTitleEl.style.display = this.view.popup.title ? 'block' : 'none';
|
1514
|
+
this.popupContainerEl.prepend(this.tmpPopupTitleEl);
|
1515
|
+
}
|
1516
|
+
else {
|
1517
|
+
this.popupTitleEl.style.display = this.view.popup.title ? 'block' : 'none';
|
1518
|
+
this.popupTitleEl.innerHTML = '';
|
1519
|
+
this.popupTitleEl.prepend(heading);
|
571
1520
|
}
|
572
1521
|
}
|
573
1522
|
}
|
@@ -590,17 +1539,40 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
590
1539
|
setupViewPrintElements() {
|
591
1540
|
if (this.view != null) {
|
592
1541
|
this.handleLegendSetup();
|
593
|
-
|
594
|
-
|
595
|
-
|
1542
|
+
if (this.selectedFileType === 'PDF') {
|
1543
|
+
const title = document.title;
|
1544
|
+
if (this.showHeaderTitle && this.headerTitle) {
|
1545
|
+
document.title = this.headerTitle;
|
1546
|
+
}
|
1547
|
+
window.print();
|
1548
|
+
document.title = title;
|
1549
|
+
setTimeout(() => {
|
1550
|
+
this.resetPrintContent();
|
1551
|
+
}, 1000);
|
1552
|
+
}
|
1553
|
+
else {
|
1554
|
+
this.convertToImage();
|
596
1555
|
}
|
597
|
-
window.print();
|
598
|
-
document.title = title;
|
599
|
-
setTimeout(() => {
|
600
|
-
this.resetPrintContent();
|
601
|
-
}, 1000);
|
602
1556
|
}
|
603
1557
|
}
|
1558
|
+
convertToImage() {
|
1559
|
+
const options = { backgroundColor: '#FFF', skipFonts: true };
|
1560
|
+
if (this.selectedFileType === 'JPG') {
|
1561
|
+
toJpeg(this.printEl, options).then(this.handleGetImage.bind(this));
|
1562
|
+
}
|
1563
|
+
else {
|
1564
|
+
toPng(this.printEl, options).then(this.handleGetImage.bind(this));
|
1565
|
+
}
|
1566
|
+
}
|
1567
|
+
handleGetImage(dataUrl) {
|
1568
|
+
var _a;
|
1569
|
+
this.resetPrintContent();
|
1570
|
+
this.dataUrl = dataUrl;
|
1571
|
+
this.setMapAreaOnClick(false);
|
1572
|
+
this.showPreview(dataUrl);
|
1573
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.container.classList.remove('screenshot-cursor');
|
1574
|
+
this.setMaskPosition(null);
|
1575
|
+
}
|
604
1576
|
handleLegendSetup() {
|
605
1577
|
var _a;
|
606
1578
|
if (this.showIncludeLegend && this.view != null && this.includeMap && this.legendContainerEl != null) {
|
@@ -612,6 +1584,7 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
612
1584
|
if (this.includeMap) {
|
613
1585
|
this.handleLegendCreation();
|
614
1586
|
this.handleCompassCreation();
|
1587
|
+
this.updatePopupToPrint();
|
615
1588
|
}
|
616
1589
|
}
|
617
1590
|
handleIncludePopup() {
|
@@ -622,6 +1595,8 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
622
1595
|
(_b = this.reactiveUtils) === null || _b === void 0 ? void 0 : _b.whenOnce(() => { var _a; return (_a = this.view) === null || _a === void 0 ? void 0 : _a.ready; }).then(() => {
|
623
1596
|
var _a;
|
624
1597
|
(_a = this.handles) === null || _a === void 0 ? void 0 : _a.add(this.reactiveUtils.watch(() => { var _a, _b; return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.popup) === null || _b === void 0 ? void 0 : _b.visible; }, (visible) => {
|
1598
|
+
if (this.settingMapArea)
|
1599
|
+
return;
|
625
1600
|
this.includePopup = visible;
|
626
1601
|
}), handleId);
|
627
1602
|
});
|
@@ -653,6 +1628,7 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
653
1628
|
this.legend = new Legend({
|
654
1629
|
container: legendCont,
|
655
1630
|
view,
|
1631
|
+
respectLayerDefinitionExpression: true,
|
656
1632
|
style: {
|
657
1633
|
type: 'card',
|
658
1634
|
layout: 'side-by-side',
|
@@ -720,7 +1696,9 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
720
1696
|
}
|
721
1697
|
}
|
722
1698
|
setMaxRowHeightOnViewContainer() {
|
723
|
-
this.
|
1699
|
+
if (this.selectedFileType === 'PDF') {
|
1700
|
+
this.printEl.style.gridTemplateRows = 'minmax(auto, 70%)';
|
1701
|
+
}
|
724
1702
|
this.viewEl.style.height = '100%';
|
725
1703
|
this.viewEl.style.width = '';
|
726
1704
|
this.viewWrapperEl.style.height = '100%';
|
@@ -764,7 +1742,7 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
764
1742
|
}
|
765
1743
|
}
|
766
1744
|
createScreenshot() {
|
767
|
-
var _a, _b;
|
1745
|
+
var _a, _b, _c;
|
768
1746
|
if (this.view != null) {
|
769
1747
|
this.screenshotPreview = document.createElement('div');
|
770
1748
|
this.screenshotPreview.className = 'screenshot-preview hide';
|
@@ -774,10 +1752,10 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
774
1752
|
const screenshotBtnContainer = document.createElement('div');
|
775
1753
|
const exportBtn = document.createElement('calcite-button');
|
776
1754
|
const returnBtn = document.createElement('calcite-button');
|
777
|
-
exportBtn.innerHTML = (_a = this.messages) === null || _a === void 0 ? void 0 : _a.export;
|
778
|
-
returnBtn.innerHTML = (
|
1755
|
+
exportBtn.innerHTML = this.selectedFileType === 'PDF' ? (_a = this.messages) === null || _a === void 0 ? void 0 : _a.export : (_b = this.messages) === null || _b === void 0 ? void 0 : _b.downloadImage;
|
1756
|
+
returnBtn.innerHTML = (_c = this.messages) === null || _c === void 0 ? void 0 : _c.returnToMap;
|
779
1757
|
returnBtn.appearance = 'outline-fill';
|
780
|
-
exportBtn.onclick = this.
|
1758
|
+
exportBtn.onclick = this.exportPreviewOnClick.bind(this);
|
781
1759
|
returnBtn.onclick = this.screenshotReturn.bind(this);
|
782
1760
|
screenshotBtnContainer.append(returnBtn, exportBtn);
|
783
1761
|
this.screenshotImgContainer.append(this.screenshotImg, screenshotBtnContainer);
|
@@ -802,10 +1780,19 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
802
1780
|
this.removeScreenshotElements();
|
803
1781
|
this.exportIsLoading = false;
|
804
1782
|
this.screenshot = null;
|
1783
|
+
this.resetPopupVisibility();
|
805
1784
|
}
|
806
|
-
setMapAreaOnClick() {
|
1785
|
+
setMapAreaOnClick(handlePopup) {
|
807
1786
|
if (this.view == null)
|
808
1787
|
return;
|
1788
|
+
this.settingMapArea = true;
|
1789
|
+
if (handlePopup) {
|
1790
|
+
if (this.view.popup.visible) {
|
1791
|
+
this.popupHiddenByMapArea = true;
|
1792
|
+
const popupContainer = this.view.popup.container;
|
1793
|
+
popupContainer.style.display = 'none';
|
1794
|
+
}
|
1795
|
+
}
|
809
1796
|
this.exportIsLoading = true;
|
810
1797
|
this.createMaskDiv();
|
811
1798
|
this.createScreenshot();
|
@@ -850,9 +1837,21 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
850
1837
|
this.view.takeScreenshot({ area: this.area, width: width * 2, height: height * 2, format: 'jpg' }).then(screenshot => {
|
851
1838
|
var _a;
|
852
1839
|
this.screenshot = screenshot;
|
853
|
-
this.showPreview();
|
854
1840
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.container.classList.remove('screenshot-cursor');
|
855
1841
|
this.setMaskPosition(null);
|
1842
|
+
if (this.selectedFileType === 'PDF') {
|
1843
|
+
this.showPreview(screenshot === null || screenshot === void 0 ? void 0 : screenshot.dataUrl);
|
1844
|
+
this.resetPopupVisibility();
|
1845
|
+
}
|
1846
|
+
else {
|
1847
|
+
if (this.viewWrapperEl != null && !this.viewWrapperEl.contains(this.compassContainerEl)) {
|
1848
|
+
this.viewWrapperEl.append(this.compassContainerEl);
|
1849
|
+
}
|
1850
|
+
this.handleViewExportOnClick();
|
1851
|
+
if (this.popoverEl != null) {
|
1852
|
+
this.popoverEl.open = false;
|
1853
|
+
}
|
1854
|
+
}
|
856
1855
|
});
|
857
1856
|
}
|
858
1857
|
}
|
@@ -871,10 +1870,12 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
871
1870
|
clamp(value, from, to) {
|
872
1871
|
return value < from ? from : value > to ? to : value;
|
873
1872
|
}
|
874
|
-
showPreview() {
|
1873
|
+
showPreview(dataUrl) {
|
1874
|
+
if (!dataUrl)
|
1875
|
+
return;
|
875
1876
|
this.screenshotPreview.classList.remove('hide');
|
876
|
-
if (this.screenshotImg != null
|
877
|
-
this.screenshotImg.src =
|
1877
|
+
if (this.screenshotImg != null) {
|
1878
|
+
this.screenshotImg.src = dataUrl;
|
878
1879
|
}
|
879
1880
|
}
|
880
1881
|
handleScaleBarSize() {
|
@@ -898,9 +1899,37 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
898
1899
|
}
|
899
1900
|
}
|
900
1901
|
removeScreenshotElements() {
|
901
|
-
var _a, _b;
|
902
|
-
(_a = this.
|
903
|
-
(_b = this.
|
1902
|
+
var _a, _b, _c;
|
1903
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.removeHandles(dragHandlerName);
|
1904
|
+
(_b = this.screenshotPreview) === null || _b === void 0 ? void 0 : _b.remove();
|
1905
|
+
(_c = this.screenshotStyle) === null || _c === void 0 ? void 0 : _c.remove();
|
1906
|
+
}
|
1907
|
+
resetPopupVisibility() {
|
1908
|
+
if (this.view && this.settingMapArea && this.popupHiddenByMapArea) {
|
1909
|
+
const popupContainer = this.view.popup.container;
|
1910
|
+
popupContainer.style.display = '';
|
1911
|
+
}
|
1912
|
+
this.settingMapArea = false;
|
1913
|
+
this.popupHiddenByMapArea = false;
|
1914
|
+
}
|
1915
|
+
handleSelectFileType(e) {
|
1916
|
+
const node = e.target;
|
1917
|
+
this.selectedFileType = node.value;
|
1918
|
+
if (this.selectedFileType === 'PDF') {
|
1919
|
+
this.includeMap = this.pdfIncludeMap;
|
1920
|
+
if (!this.showExtraContentInImg) {
|
1921
|
+
this.includeExtraContent = this.pdfIncludeExtraContent;
|
1922
|
+
}
|
1923
|
+
}
|
1924
|
+
else {
|
1925
|
+
this.pdfIncludeMap = this.includeMap;
|
1926
|
+
this.includeMap = true;
|
1927
|
+
if (!this.showExtraContentInImg) {
|
1928
|
+
this.pdfIncludeExtraContent = this.includeExtraContent;
|
1929
|
+
this.includeMap = true;
|
1930
|
+
this.includeExtraContent = false;
|
1931
|
+
}
|
1932
|
+
}
|
904
1933
|
}
|
905
1934
|
get el() { return this; }
|
906
1935
|
static get watchers() { return {
|
@@ -915,10 +1944,13 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
915
1944
|
"extraContent": [16],
|
916
1945
|
"extraContentLabel": [1, "extra-content-label"],
|
917
1946
|
"headerTitle": [1025, "header-title"],
|
1947
|
+
"logoImage": [1025, "logo-image"],
|
918
1948
|
"includeExtraContent": [1028, "include-extra-content"],
|
1949
|
+
"showExtraContentInImg": [4, "show-extra-content-in-img"],
|
919
1950
|
"includeLegend": [1028, "include-legend"],
|
920
1951
|
"includeMap": [1028, "include-map"],
|
921
1952
|
"includePopup": [1028, "include-popup"],
|
1953
|
+
"includeFileFormat": [1028, "include-file-format"],
|
922
1954
|
"mode": [513],
|
923
1955
|
"popoverPositioning": [1, "popover-positioning"],
|
924
1956
|
"popoverPlacement": [1, "popover-placement"],
|
@@ -933,7 +1965,8 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
933
1965
|
"maskBorder": [1, "mask-border"],
|
934
1966
|
"baseClass": [32],
|
935
1967
|
"exportIsLoading": [32],
|
936
|
-
"messages": [32]
|
1968
|
+
"messages": [32],
|
1969
|
+
"selectedFileType": [32]
|
937
1970
|
}, undefined, {
|
938
1971
|
"includeMap": ["watchIncludeMap"],
|
939
1972
|
"view": ["watchView"]
|
@@ -942,7 +1975,7 @@ function defineCustomElement$1() {
|
|
942
1975
|
if (typeof customElements === "undefined") {
|
943
1976
|
return;
|
944
1977
|
}
|
945
|
-
const components = ["instant-apps-export", "calcite-action", "calcite-button", "calcite-icon", "calcite-input", "calcite-label", "calcite-loader", "calcite-popover", "calcite-progress", "calcite-switch", "instant-apps-header"];
|
1978
|
+
const components = ["instant-apps-export", "calcite-action", "calcite-button", "calcite-icon", "calcite-input", "calcite-label", "calcite-loader", "calcite-option", "calcite-popover", "calcite-progress", "calcite-select", "calcite-switch", "instant-apps-header"];
|
946
1979
|
components.forEach(tagName => { switch (tagName) {
|
947
1980
|
case "instant-apps-export":
|
948
1981
|
if (!customElements.get(tagName)) {
|
@@ -951,40 +1984,50 @@ function defineCustomElement$1() {
|
|
951
1984
|
break;
|
952
1985
|
case "calcite-action":
|
953
1986
|
if (!customElements.get(tagName)) {
|
954
|
-
defineCustomElement$
|
1987
|
+
defineCustomElement$d();
|
955
1988
|
}
|
956
1989
|
break;
|
957
1990
|
case "calcite-button":
|
958
1991
|
if (!customElements.get(tagName)) {
|
959
|
-
defineCustomElement$
|
1992
|
+
defineCustomElement$c();
|
960
1993
|
}
|
961
1994
|
break;
|
962
1995
|
case "calcite-icon":
|
963
1996
|
if (!customElements.get(tagName)) {
|
964
|
-
defineCustomElement$
|
1997
|
+
defineCustomElement$b();
|
965
1998
|
}
|
966
1999
|
break;
|
967
2000
|
case "calcite-input":
|
968
2001
|
if (!customElements.get(tagName)) {
|
969
|
-
defineCustomElement$
|
2002
|
+
defineCustomElement$a();
|
970
2003
|
}
|
971
2004
|
break;
|
972
2005
|
case "calcite-label":
|
973
2006
|
if (!customElements.get(tagName)) {
|
974
|
-
defineCustomElement$
|
2007
|
+
defineCustomElement$9();
|
975
2008
|
}
|
976
2009
|
break;
|
977
2010
|
case "calcite-loader":
|
978
2011
|
if (!customElements.get(tagName)) {
|
979
|
-
defineCustomElement$
|
2012
|
+
defineCustomElement$8();
|
2013
|
+
}
|
2014
|
+
break;
|
2015
|
+
case "calcite-option":
|
2016
|
+
if (!customElements.get(tagName)) {
|
2017
|
+
defineCustomElement$7();
|
980
2018
|
}
|
981
2019
|
break;
|
982
2020
|
case "calcite-popover":
|
983
2021
|
if (!customElements.get(tagName)) {
|
984
|
-
defineCustomElement$
|
2022
|
+
defineCustomElement$6();
|
985
2023
|
}
|
986
2024
|
break;
|
987
2025
|
case "calcite-progress":
|
2026
|
+
if (!customElements.get(tagName)) {
|
2027
|
+
defineCustomElement$5();
|
2028
|
+
}
|
2029
|
+
break;
|
2030
|
+
case "calcite-select":
|
988
2031
|
if (!customElements.get(tagName)) {
|
989
2032
|
defineCustomElement$4();
|
990
2033
|
}
|