@saasquatch/vanilla-components 1.2.4-0 → 1.2.4-3

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.
Files changed (88) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{WidgetHost-d7b870ce.js → WidgetHost-71b013eb.js} +615 -615
  3. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  4. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1050 -1151
  5. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  6. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  7. package/dist/collection/components/close-button/close-button.js +70 -67
  8. package/dist/collection/components/copy-button/copy-button.js +389 -386
  9. package/dist/collection/components/copy-link-button/copy-link-button.js +233 -230
  10. package/dist/collection/components/global-container/global-container.js +170 -169
  11. package/dist/collection/components/image-component/image-component.js +175 -174
  12. package/dist/collection/components/partner-stat-component/partner-stat-component.js +190 -185
  13. package/dist/collection/components/referral-code/referral-code.js +36 -33
  14. package/dist/collection/components/referral-component/referral-component.js +255 -254
  15. package/dist/collection/components/referral-list/referral-list.js +932 -932
  16. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -104
  17. package/dist/collection/components/share-button/share-button.js +310 -309
  18. package/dist/collection/components/share-button-container/share-button-container.js +2470 -2467
  19. package/dist/collection/components/stat-component/stat-component.js +191 -185
  20. package/dist/collection/components/stats-container/stats-container.js +208 -204
  21. package/dist/collection/components/text-component/text-component.js +280 -276
  22. package/dist/collection/entrypoint.js +32 -32
  23. package/dist/collection/global/global.js +4 -4
  24. package/dist/collection/services/FormatJs.js +15 -15
  25. package/dist/collection/services/WidgetHost.js +621 -621
  26. package/dist/collection/utilities.js +81 -81
  27. package/dist/esm/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +615 -615
  28. package/dist/esm/polyfills/core-js.js +0 -0
  29. package/dist/esm/polyfills/dom.js +0 -0
  30. package/dist/esm/polyfills/es5-html-element.js +0 -0
  31. package/dist/esm/polyfills/index.js +0 -0
  32. package/dist/esm/polyfills/system.js +0 -0
  33. package/dist/esm/sqh-close-button.entry.js +25 -25
  34. package/dist/esm/sqh-copy-button_12.entry.js +1050 -1151
  35. package/dist/esm/sqh-referral-code.entry.js +22 -22
  36. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  37. package/dist/esm-es5/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +9432 -9432
  38. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  39. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  40. package/dist/esm-es5/dom-4061ceba.js +468 -468
  41. package/dist/esm-es5/en-be593af0.js +1471 -1471
  42. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  43. package/dist/esm-es5/loader.mjs +11 -11
  44. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  45. package/dist/esm-es5/sqh-copy-button_12.entry.js +9571 -9660
  46. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  47. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  48. package/dist/esm-es5/widget-components.mjs +6 -6
  49. package/dist/types/components/close-button/close-button.d.ts +18 -15
  50. package/dist/types/components/copy-button/copy-button.d.ts +107 -104
  51. package/dist/types/components/copy-link-button/copy-link-button.d.ts +62 -59
  52. package/dist/types/components/global-container/global-container.d.ts +47 -46
  53. package/dist/types/components/image-component/image-component.d.ts +51 -50
  54. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +53 -48
  55. package/dist/types/components/referral-code/referral-code.d.ts +12 -9
  56. package/dist/types/components/referral-component/referral-component.d.ts +46 -45
  57. package/dist/types/components/referral-list/referral-list.d.ts +251 -249
  58. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -24
  59. package/dist/types/components/share-button/share-button.d.ts +82 -81
  60. package/dist/types/components/share-button-container/share-button-container.d.ts +684 -681
  61. package/dist/types/components/stat-component/stat-component.d.ts +53 -47
  62. package/dist/types/components/stats-container/stats-container.d.ts +48 -44
  63. package/dist/types/components/text-component/text-component.d.ts +81 -77
  64. package/dist/types/components.d.ts +0 -2
  65. package/dist/types/global/global.d.ts +4 -4
  66. package/dist/types/saasquatch.d.ts +103 -103
  67. package/dist/types/services/FormatJs.d.ts +7 -7
  68. package/dist/types/services/WidgetHost.d.ts +45 -45
  69. package/dist/types/utilities.d.ts +7 -7
  70. package/dist/widget-components/entrypoint.js +32 -32
  71. package/dist/widget-components/p-24fc4ba9.js +1 -1
  72. package/dist/widget-components/{p-d4b27c72.entry.js → p-366f1663.entry.js} +1 -1
  73. package/dist/widget-components/p-46109683.js +3 -3
  74. package/dist/widget-components/{p-650d012d.entry.js → p-54ea7a00.entry.js} +1 -1
  75. package/dist/widget-components/p-58be1132.system.js +1 -1
  76. package/dist/widget-components/{p-9adc7c50.system.js → p-8e232564.system.js} +0 -0
  77. package/dist/widget-components/{p-c0cdba77.system.entry.js → p-b17efca4.system.entry.js} +1 -1
  78. package/dist/widget-components/p-c8bc8c77.system.entry.js +1 -0
  79. package/dist/widget-components/{p-d7059393.entry.js → p-d416634a.entry.js} +16 -16
  80. package/dist/widget-components/p-d97c955d.system.entry.js +8 -0
  81. package/dist/widget-components/{p-9525bf4a.js → p-edd43dbc.js} +0 -0
  82. package/dist/widget-components/widget-components.esm.js +1 -1
  83. package/dist/widget-components/widget-components.js +1 -1
  84. package/docs/raisins.json +1 -1
  85. package/package.json +96 -96
  86. package/readme.md +52 -52
  87. package/dist/widget-components/p-908068c2.system.entry.js +0 -1
  88. package/dist/widget-components/p-fba5ea7f.system.entry.js +0 -8
@@ -1,276 +1,280 @@
1
- import { h, Component, Prop, Element } from "@stencil/core";
2
- import { css } from "emotion";
3
- import marked from "marked";
4
- /**
5
- * @uiName Text Component
6
- */
7
- export class TextComponent {
8
- render() {
9
- const regex = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
10
- const textStyle = css `
11
- font-family: ${this.fontfamily || "inherit"};
12
- font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
13
- text-align: ${this.textalign};
14
- color: ${this.color || "inherit"};
15
- padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
16
- padding-bottom: ${this.paddingbottom
17
- ? this.paddingbottom + "px"
18
- : "inherit"};
19
- overflow-wrap: break-word;
20
- `;
21
- const divStyle = css `
22
- background: ${this.background
23
- ? this.background.match(regex)
24
- ? `url(${this.background}) no-repeat center center;`
25
- : this.background
26
- : "inherit"};
27
- height: ${this.height || "inherit"};
28
- background-size: contain;
29
- `;
30
- const content = this.ismarkdown ? (h("div", { innerHTML: marked(this.text) })) : (this.text);
31
- return (!this.ishidden && (h("div", { class: divStyle },
32
- h("p", { class: textStyle }, content))));
33
- }
34
- static get is() { return "sqh-text-component"; }
35
- static get originalStyleUrls() { return {
36
- "$": ["text-component.scss"]
37
- }; }
38
- static get styleUrls() { return {
39
- "$": ["text-component.css"]
40
- }; }
41
- static get properties() { return {
42
- "ishidden": {
43
- "type": "boolean",
44
- "mutable": false,
45
- "complexType": {
46
- "original": "boolean",
47
- "resolved": "boolean",
48
- "references": {}
49
- },
50
- "required": false,
51
- "optional": false,
52
- "docs": {
53
- "tags": [{
54
- "text": "Hide Text",
55
- "name": "uiName"
56
- }],
57
- "text": "Hide or show the component"
58
- },
59
- "attribute": "ishidden",
60
- "reflect": false
61
- },
62
- "ismarkdown": {
63
- "type": "boolean",
64
- "mutable": false,
65
- "complexType": {
66
- "original": "boolean",
67
- "resolved": "boolean",
68
- "references": {}
69
- },
70
- "required": false,
71
- "optional": false,
72
- "docs": {
73
- "tags": [{
74
- "text": "Is Markdown",
75
- "name": "uiName"
76
- }],
77
- "text": "Compiles plain text into markdown"
78
- },
79
- "attribute": "ismarkdown",
80
- "reflect": false
81
- },
82
- "text": {
83
- "type": "string",
84
- "mutable": false,
85
- "complexType": {
86
- "original": "string",
87
- "resolved": "string",
88
- "references": {}
89
- },
90
- "required": false,
91
- "optional": false,
92
- "docs": {
93
- "tags": [{
94
- "text": "Text",
95
- "name": "uiName"
96
- }],
97
- "text": "The text content"
98
- },
99
- "attribute": "text",
100
- "reflect": false
101
- },
102
- "fontfamily": {
103
- "type": "string",
104
- "mutable": false,
105
- "complexType": {
106
- "original": "string",
107
- "resolved": "string",
108
- "references": {}
109
- },
110
- "required": false,
111
- "optional": false,
112
- "docs": {
113
- "tags": [{
114
- "text": "Font Family",
115
- "name": "uiName"
116
- }],
117
- "text": "Font family of the text"
118
- },
119
- "attribute": "fontfamily",
120
- "reflect": false
121
- },
122
- "color": {
123
- "type": "string",
124
- "mutable": false,
125
- "complexType": {
126
- "original": "string",
127
- "resolved": "string",
128
- "references": {}
129
- },
130
- "required": false,
131
- "optional": false,
132
- "docs": {
133
- "tags": [{
134
- "text": "Color",
135
- "name": "uiName"
136
- }, {
137
- "text": "color",
138
- "name": "uiWidget"
139
- }, {
140
- "text": "color",
141
- "name": "format"
142
- }],
143
- "text": "Color of the text"
144
- },
145
- "attribute": "color",
146
- "reflect": false
147
- },
148
- "fontsize": {
149
- "type": "string",
150
- "mutable": false,
151
- "complexType": {
152
- "original": "string",
153
- "resolved": "string",
154
- "references": {}
155
- },
156
- "required": false,
157
- "optional": false,
158
- "docs": {
159
- "tags": [{
160
- "text": "Font Size",
161
- "name": "uiName"
162
- }],
163
- "text": "Size of the text"
164
- },
165
- "attribute": "fontsize",
166
- "reflect": false
167
- },
168
- "paddingtop": {
169
- "type": "string",
170
- "mutable": false,
171
- "complexType": {
172
- "original": "string",
173
- "resolved": "string",
174
- "references": {}
175
- },
176
- "required": false,
177
- "optional": false,
178
- "docs": {
179
- "tags": [{
180
- "text": "Padding Top",
181
- "name": "uiName"
182
- }],
183
- "text": "Top padding on text"
184
- },
185
- "attribute": "paddingtop",
186
- "reflect": false
187
- },
188
- "paddingbottom": {
189
- "type": "string",
190
- "mutable": false,
191
- "complexType": {
192
- "original": "string",
193
- "resolved": "string",
194
- "references": {}
195
- },
196
- "required": false,
197
- "optional": false,
198
- "docs": {
199
- "tags": [{
200
- "text": "Padding Bottom",
201
- "name": "uiName"
202
- }],
203
- "text": "Bottom padding on text"
204
- },
205
- "attribute": "paddingbottom",
206
- "reflect": false
207
- },
208
- "textalign": {
209
- "type": "string",
210
- "mutable": false,
211
- "complexType": {
212
- "original": "string",
213
- "resolved": "string",
214
- "references": {}
215
- },
216
- "required": false,
217
- "optional": false,
218
- "docs": {
219
- "tags": [{
220
- "text": "Text Align",
221
- "name": "uiName"
222
- }, {
223
- "text": "[\"left\", \"center\", \"right\"]",
224
- "name": "uiEnum"
225
- }, {
226
- "text": "[\"Left\", \"Center\", \"Right\"]",
227
- "name": "uiEnumNames"
228
- }],
229
- "text": "Text alignment"
230
- },
231
- "attribute": "textalign",
232
- "reflect": false
233
- },
234
- "background": {
235
- "type": "string",
236
- "mutable": false,
237
- "complexType": {
238
- "original": "string",
239
- "resolved": "string",
240
- "references": {}
241
- },
242
- "required": false,
243
- "optional": false,
244
- "docs": {
245
- "tags": [{
246
- "text": "Background",
247
- "name": "uiName"
248
- }],
249
- "text": "Background the container, color or url"
250
- },
251
- "attribute": "background",
252
- "reflect": false
253
- },
254
- "height": {
255
- "type": "string",
256
- "mutable": false,
257
- "complexType": {
258
- "original": "string",
259
- "resolved": "string",
260
- "references": {}
261
- },
262
- "required": false,
263
- "optional": false,
264
- "docs": {
265
- "tags": [{
266
- "text": "Height",
267
- "name": "uiName"
268
- }],
269
- "text": "Height of the container"
270
- },
271
- "attribute": "height",
272
- "reflect": false
273
- }
274
- }; }
275
- static get elementRef() { return "textEl"; }
276
- }
1
+ import { h, Component, Prop, Element } from "@stencil/core";
2
+ import { css } from "emotion";
3
+ import marked from "marked";
4
+ /**
5
+ * @uiName Text Component
6
+ * @canvasRenderer always-replace
7
+ * @exampleGroup Common Components
8
+ * @example Header Text - <sqh-text-component sqhheader="true" ishidden="false" ismarkdown="false" text="Give $10 and Get $10!" color="#4486E1" fontsize="30" textalign="center" paddingtop="30" paddingbottom="10"></sqh-text-component>
9
+ * @example Paragraph Text - <sqh-text-component sqhbody="true" ishidden="false" ismarkdown="true" text="Give a friend a $10 and receive $10 for yourself when they purchase.<br/><br/>Share the link below or use the code **<sqh-referral-code />**" color="#000000" fontsize="13" textalign="center" paddingtop="5" paddingbottom="20"></sqh-text-component>
10
+ */
11
+ export class TextComponent {
12
+ render() {
13
+ const regex = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
14
+ const textStyle = css `
15
+ font-family: ${this.fontfamily || "inherit"};
16
+ font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
17
+ text-align: ${this.textalign};
18
+ color: ${this.color || "inherit"};
19
+ padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
20
+ padding-bottom: ${this.paddingbottom
21
+ ? this.paddingbottom + "px"
22
+ : "inherit"};
23
+ overflow-wrap: break-word;
24
+ `;
25
+ const divStyle = css `
26
+ background: ${this.background
27
+ ? this.background.match(regex)
28
+ ? `url(${this.background}) no-repeat center center;`
29
+ : this.background
30
+ : "inherit"};
31
+ height: ${this.height || "inherit"};
32
+ background-size: contain;
33
+ `;
34
+ const content = this.ismarkdown ? (h("div", { innerHTML: marked(this.text) })) : (this.text);
35
+ return (!this.ishidden && (h("div", { class: divStyle },
36
+ h("p", { class: textStyle }, content))));
37
+ }
38
+ static get is() { return "sqh-text-component"; }
39
+ static get originalStyleUrls() { return {
40
+ "$": ["text-component.scss"]
41
+ }; }
42
+ static get styleUrls() { return {
43
+ "$": ["text-component.css"]
44
+ }; }
45
+ static get properties() { return {
46
+ "ishidden": {
47
+ "type": "boolean",
48
+ "mutable": false,
49
+ "complexType": {
50
+ "original": "boolean",
51
+ "resolved": "boolean",
52
+ "references": {}
53
+ },
54
+ "required": false,
55
+ "optional": false,
56
+ "docs": {
57
+ "tags": [{
58
+ "text": "Hide Text",
59
+ "name": "uiName"
60
+ }],
61
+ "text": "Hide or show the component"
62
+ },
63
+ "attribute": "ishidden",
64
+ "reflect": false
65
+ },
66
+ "ismarkdown": {
67
+ "type": "boolean",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "boolean",
71
+ "resolved": "boolean",
72
+ "references": {}
73
+ },
74
+ "required": false,
75
+ "optional": false,
76
+ "docs": {
77
+ "tags": [{
78
+ "text": "Is Markdown",
79
+ "name": "uiName"
80
+ }],
81
+ "text": "Compiles plain text into markdown"
82
+ },
83
+ "attribute": "ismarkdown",
84
+ "reflect": false
85
+ },
86
+ "text": {
87
+ "type": "string",
88
+ "mutable": false,
89
+ "complexType": {
90
+ "original": "string",
91
+ "resolved": "string",
92
+ "references": {}
93
+ },
94
+ "required": false,
95
+ "optional": false,
96
+ "docs": {
97
+ "tags": [{
98
+ "text": "Text",
99
+ "name": "uiName"
100
+ }],
101
+ "text": "The text content"
102
+ },
103
+ "attribute": "text",
104
+ "reflect": false
105
+ },
106
+ "fontfamily": {
107
+ "type": "string",
108
+ "mutable": false,
109
+ "complexType": {
110
+ "original": "string",
111
+ "resolved": "string",
112
+ "references": {}
113
+ },
114
+ "required": false,
115
+ "optional": false,
116
+ "docs": {
117
+ "tags": [{
118
+ "text": "Font Family",
119
+ "name": "uiName"
120
+ }],
121
+ "text": "Font family of the text"
122
+ },
123
+ "attribute": "fontfamily",
124
+ "reflect": false
125
+ },
126
+ "color": {
127
+ "type": "string",
128
+ "mutable": false,
129
+ "complexType": {
130
+ "original": "string",
131
+ "resolved": "string",
132
+ "references": {}
133
+ },
134
+ "required": false,
135
+ "optional": false,
136
+ "docs": {
137
+ "tags": [{
138
+ "text": "Color",
139
+ "name": "uiName"
140
+ }, {
141
+ "text": "color",
142
+ "name": "uiWidget"
143
+ }, {
144
+ "text": "color",
145
+ "name": "format"
146
+ }],
147
+ "text": "Color of the text"
148
+ },
149
+ "attribute": "color",
150
+ "reflect": false
151
+ },
152
+ "fontsize": {
153
+ "type": "string",
154
+ "mutable": false,
155
+ "complexType": {
156
+ "original": "string",
157
+ "resolved": "string",
158
+ "references": {}
159
+ },
160
+ "required": false,
161
+ "optional": false,
162
+ "docs": {
163
+ "tags": [{
164
+ "text": "Font Size",
165
+ "name": "uiName"
166
+ }],
167
+ "text": "Size of the text"
168
+ },
169
+ "attribute": "fontsize",
170
+ "reflect": false
171
+ },
172
+ "paddingtop": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [{
184
+ "text": "Padding Top",
185
+ "name": "uiName"
186
+ }],
187
+ "text": "Top padding on text"
188
+ },
189
+ "attribute": "paddingtop",
190
+ "reflect": false
191
+ },
192
+ "paddingbottom": {
193
+ "type": "string",
194
+ "mutable": false,
195
+ "complexType": {
196
+ "original": "string",
197
+ "resolved": "string",
198
+ "references": {}
199
+ },
200
+ "required": false,
201
+ "optional": false,
202
+ "docs": {
203
+ "tags": [{
204
+ "text": "Padding Bottom",
205
+ "name": "uiName"
206
+ }],
207
+ "text": "Bottom padding on text"
208
+ },
209
+ "attribute": "paddingbottom",
210
+ "reflect": false
211
+ },
212
+ "textalign": {
213
+ "type": "string",
214
+ "mutable": false,
215
+ "complexType": {
216
+ "original": "string",
217
+ "resolved": "string",
218
+ "references": {}
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [{
224
+ "text": "Text Align",
225
+ "name": "uiName"
226
+ }, {
227
+ "text": "[\"left\", \"center\", \"right\"]",
228
+ "name": "uiEnum"
229
+ }, {
230
+ "text": "[\"Left\", \"Center\", \"Right\"]",
231
+ "name": "uiEnumNames"
232
+ }],
233
+ "text": "Text alignment"
234
+ },
235
+ "attribute": "textalign",
236
+ "reflect": false
237
+ },
238
+ "background": {
239
+ "type": "string",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "string",
243
+ "resolved": "string",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [{
250
+ "text": "Background",
251
+ "name": "uiName"
252
+ }],
253
+ "text": "Background the container, color or url"
254
+ },
255
+ "attribute": "background",
256
+ "reflect": false
257
+ },
258
+ "height": {
259
+ "type": "string",
260
+ "mutable": false,
261
+ "complexType": {
262
+ "original": "string",
263
+ "resolved": "string",
264
+ "references": {}
265
+ },
266
+ "required": false,
267
+ "optional": false,
268
+ "docs": {
269
+ "tags": [{
270
+ "text": "Height",
271
+ "name": "uiName"
272
+ }],
273
+ "text": "Height of the container"
274
+ },
275
+ "attribute": "height",
276
+ "reflect": false
277
+ }
278
+ }; }
279
+ static get elementRef() { return "textEl"; }
280
+ }
@@ -1,32 +1,32 @@
1
- // NOTE(johan): This is a custom loader which will inject script tags for both the ES Modules and non-ES Modules
2
- // builds. We use this instead of dist/widget-components.js as that is deprecated and actually doesn't work because of
3
- // its name causing lazy loaded scripts to be loaded from the wrong path in /dist
4
- (function(doc){
5
- var isSafari10 = window.navigator.userAgent.indexOf('Safari') > 0 && window.navigator.userAgent.indexOf('Version/10') > 0;
6
- var scriptElm = doc.scripts[doc.scripts.length - 1];
7
-
8
- var parts = scriptElm.src.split('/');
9
- parts.pop();
10
- var url = parts.join('/');
11
-
12
- // NOTE(johan): Safari 10 supports type="module" but the build is too new for it, so we only want the ES5 build but
13
- // without the "nomodule" attribute
14
- // This may not be necessary in Stencil 1.8.x - https://github.com/ionic-team/stencil/issues/1900
15
-
16
- if (!isSafari10) {
17
- var scriptElm = doc.createElement('script');
18
- scriptElm.setAttribute('type', 'module');
19
- scriptElm.src = url + '/widget-components.esm.js';
20
- scriptElm.setAttribute('data-stencil-namespace', 'widget-components');
21
- doc.head.appendChild(scriptElm);
22
- }
23
-
24
- var scriptElm = doc.createElement('script');
25
- if (!isSafari10) {
26
- scriptElm.setAttribute('nomodule', '');
27
- }
28
- scriptElm.src = url + '/widget-components.js';
29
- scriptElm.setAttribute('data-stencil-namespace', 'widget-components');
30
- doc.head.appendChild(scriptElm)
31
- })(document);
32
-
1
+ // NOTE(johan): This is a custom loader which will inject script tags for both the ES Modules and non-ES Modules
2
+ // builds. We use this instead of dist/widget-components.js as that is deprecated and actually doesn't work because of
3
+ // its name causing lazy loaded scripts to be loaded from the wrong path in /dist
4
+ (function(doc){
5
+ var isSafari10 = window.navigator.userAgent.indexOf('Safari') > 0 && window.navigator.userAgent.indexOf('Version/10') > 0;
6
+ var scriptElm = doc.scripts[doc.scripts.length - 1];
7
+
8
+ var parts = scriptElm.src.split('/');
9
+ parts.pop();
10
+ var url = parts.join('/');
11
+
12
+ // NOTE(johan): Safari 10 supports type="module" but the build is too new for it, so we only want the ES5 build but
13
+ // without the "nomodule" attribute
14
+ // This may not be necessary in Stencil 1.8.x - https://github.com/ionic-team/stencil/issues/1900
15
+
16
+ if (!isSafari10) {
17
+ var scriptElm = doc.createElement('script');
18
+ scriptElm.setAttribute('type', 'module');
19
+ scriptElm.src = url + '/widget-components.esm.js';
20
+ scriptElm.setAttribute('data-stencil-namespace', 'widget-components');
21
+ doc.head.appendChild(scriptElm);
22
+ }
23
+
24
+ var scriptElm = doc.createElement('script');
25
+ if (!isSafari10) {
26
+ scriptElm.setAttribute('nomodule', '');
27
+ }
28
+ scriptElm.src = url + '/widget-components.js';
29
+ scriptElm.setAttribute('data-stencil-namespace', 'widget-components');
30
+ doc.head.appendChild(scriptElm)
31
+ })(document);
32
+