@justifi/webcomponents 4.0.2 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/Api-11362403.js +111 -0
- package/dist/cjs/Api-11362403.js.map +1 -0
- package/dist/cjs/Payment-ac4dea02.js +2 -0
- package/dist/cjs/Payment-ac4dea02.js.map +1 -0
- package/dist/cjs/{index-051b6dd0.js → index-34312a38.js} +185 -21
- package/dist/cjs/index-34312a38.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/{index.esm-8df4906e.js → index.esm-bcf90c56.js} +2 -244
- package/dist/cjs/index.esm-bcf90c56.js.map +1 -0
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -1
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js +8 -5
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-business-address.cjs.entry.js +7 -4
- package/dist/cjs/justifi-business-address.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-business-info.cjs.entry.js +174 -0
- package/dist/cjs/justifi-business-info.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-card-form.cjs.entry.js +3 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-payment-form.cjs.entry.js +10 -4
- package/dist/cjs/justifi-payment-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +12 -7
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-payments-list.cjs.entry.js +5 -108
- package/dist/cjs/justifi-payments-list.cjs.entry.js.map +1 -0
- package/dist/cjs/loader.cjs.js +6 -3
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/select-input_2.cjs.entry.js +5 -3
- package/dist/cjs/select-input_2.cjs.entry.js.map +1 -0
- package/dist/cjs/state-options-efeaa587.js +248 -0
- package/dist/cjs/state-options-efeaa587.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +12 -3
- package/dist/cjs/webcomponents.cjs.js.map +1 -0
- package/dist/collection/api/Api.js +2 -1
- package/dist/collection/api/Api.js.map +1 -0
- package/dist/collection/api/Pagination.js +1 -0
- package/dist/collection/api/Pagination.js.map +1 -0
- package/dist/collection/api/Payment.js +1 -0
- package/dist/collection/api/Payment.js.map +1 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/index.js.map +1 -0
- package/dist/collection/api/mockData/MockPayments.js +1 -0
- package/dist/collection/api/mockData/MockPayments.js.map +1 -0
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/bank-account-form/bank-account-form.js +1 -0
- package/dist/collection/components/bank-account-form/bank-account-form.js.map +1 -0
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js +1 -0
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js.map +1 -0
- package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js +14 -0
- package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js.map +1 -0
- package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js +48 -0
- package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js.map +1 -0
- package/dist/collection/components/billing-form/billing-form-schema.js +1 -0
- package/dist/collection/components/billing-form/billing-form-schema.js.map +1 -0
- package/dist/collection/components/billing-form/billing-form.css +337 -0
- package/dist/collection/components/billing-form/billing-form.js +1 -0
- package/dist/collection/components/billing-form/billing-form.js.map +1 -0
- package/dist/collection/components/billing-form/billing-form.stories.js +1 -0
- package/dist/collection/components/billing-form/billing-form.stories.js.map +1 -0
- package/dist/collection/components/billing-form/state-options.js +1 -0
- package/dist/collection/components/billing-form/state-options.js.map +1 -0
- package/dist/collection/components/billing-form/test/billing-form.spec.js +31 -0
- package/dist/collection/components/billing-form/test/billing-form.spec.js.map +1 -0
- package/dist/collection/components/business-address/business-address-schema.js +1 -0
- package/dist/collection/components/business-address/business-address-schema.js.map +1 -0
- package/dist/collection/components/business-address/business-address.css +337 -0
- package/dist/collection/components/business-address/business-address.js +1 -0
- package/dist/collection/components/business-address/business-address.js.map +1 -0
- package/dist/collection/components/business-address/test/business-address.e2e.js +10 -0
- package/dist/collection/components/business-address/test/business-address.e2e.js.map +1 -0
- package/dist/collection/components/business-address/test/business-address.spec.js +18 -0
- package/dist/collection/components/business-address/test/business-address.spec.js.map +1 -0
- package/dist/collection/components/business-info/business-info-schema.js +94 -0
- package/dist/collection/components/business-info/business-info-schema.js.map +1 -0
- package/dist/collection/components/business-info/business-info.css +2274 -0
- package/dist/collection/components/business-info/business-info.js +168 -0
- package/dist/collection/components/business-info/business-info.js.map +1 -0
- package/dist/collection/components/card-form/card-form.js +1 -0
- package/dist/collection/components/card-form/card-form.js.map +1 -0
- package/dist/collection/components/card-form/card-form.stories.js +1 -0
- package/dist/collection/components/card-form/card-form.stories.js.map +1 -0
- package/dist/collection/components/card-form/test/card-form.e2e.js +14 -0
- package/dist/collection/components/card-form/test/card-form.e2e.js.map +1 -0
- package/dist/collection/components/card-form/test/card-form.spec.js +56 -0
- package/dist/collection/components/card-form/test/card-form.spec.js.map +1 -0
- package/dist/collection/components/payment-form/payment-form.css +412 -0
- package/dist/collection/components/payment-form/payment-form.js +8 -2
- package/dist/collection/components/payment-form/payment-form.js.map +1 -0
- package/dist/collection/components/payment-form/payment-form.stories.js +1 -0
- package/dist/collection/components/payment-form/payment-form.stories.js.map +1 -0
- package/dist/collection/components/payment-form/payment-method-selector.css +337 -0
- package/dist/collection/components/payment-form/payment-method-selector.js +1 -0
- package/dist/collection/components/payment-form/payment-method-selector.js.map +1 -0
- package/dist/collection/components/payment-form/test/payment-form.e2e.js +23 -0
- package/dist/collection/components/payment-form/test/payment-form.e2e.js.map +1 -0
- package/dist/collection/components/payment-form/test/payment-form.spec.js +182 -0
- package/dist/collection/components/payment-form/test/payment-form.spec.js.map +1 -0
- package/dist/collection/components/payment-form/tokenize.js +1 -0
- package/dist/collection/components/payment-form/tokenize.js.map +1 -0
- package/dist/collection/components/payment-method-form/get-computed-theme.js +1 -0
- package/dist/collection/components/payment-method-form/get-computed-theme.js.map +1 -0
- package/dist/collection/components/payment-method-form/message-event-types.js +1 -0
- package/dist/collection/components/payment-method-form/message-event-types.js.map +1 -0
- package/dist/collection/components/payment-method-form/payment-method-form.js +2 -2
- package/dist/collection/components/payment-method-form/payment-method-form.js.map +1 -0
- package/dist/collection/components/payment-method-form/payment-method-responses.js +1 -0
- package/dist/collection/components/payment-method-form/payment-method-responses.js.map +1 -0
- package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +22 -0
- package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js.map +1 -0
- package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js +83 -0
- package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js.map +1 -0
- package/dist/collection/components/payment-method-form/theme.js +1 -0
- package/dist/collection/components/payment-method-form/theme.js.map +1 -0
- package/dist/collection/components/payments-list/payments-list.js +1 -0
- package/dist/collection/components/payments-list/payments-list.js.map +1 -0
- package/dist/collection/components/payments-list/test/payments-list.spec.js +21 -0
- package/dist/collection/components/payments-list/test/payments-list.spec.js.map +1 -0
- package/dist/collection/components/select-input/select-input.css +337 -0
- package/dist/collection/components/select-input/select-input.js +1 -0
- package/dist/collection/components/select-input/select-input.js.map +1 -0
- package/dist/collection/components/select-input/test/select-input.spec.js +36 -0
- package/dist/collection/components/select-input/test/select-input.spec.js.map +1 -0
- package/dist/collection/components/text-input/test/text-input.spec.js +19 -0
- package/dist/collection/components/text-input/test/text-input.spec.js.map +1 -0
- package/dist/collection/components/text-input/text-input.css +337 -0
- package/dist/collection/components/text-input/text-input.js +1 -0
- package/dist/collection/components/text-input/text-input.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/utils/utils.js +1 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/Api.js +109 -0
- package/dist/components/Api.js.map +1 -0
- package/dist/components/Payment.js +2 -0
- package/dist/components/Payment.js.map +1 -0
- package/dist/components/billing-form.js +6 -3
- package/dist/components/billing-form.js.map +1 -0
- package/dist/components/index.d.ts +9 -13
- package/dist/{esm/index.esm-c6a89005.js → components/index.esm.js} +3 -244
- package/dist/components/index.esm.js.map +1 -0
- package/dist/components/index.js +3 -11
- package/dist/components/index.js.map +1 -0
- package/dist/components/justifi-bank-account-form.js +3 -1
- package/dist/components/justifi-bank-account-form.js.map +1 -0
- package/dist/components/justifi-billing-form.js +2 -0
- package/dist/components/justifi-billing-form.js.map +1 -0
- package/dist/components/justifi-business-address.js +6 -3
- package/dist/components/justifi-business-address.js.map +1 -0
- package/dist/components/justifi-business-info.d.ts +11 -0
- package/dist/components/justifi-business-info.js +207 -0
- package/dist/components/justifi-business-info.js.map +1 -0
- package/dist/components/justifi-card-form.js +3 -1
- package/dist/components/justifi-card-form.js.map +1 -0
- package/dist/components/justifi-payment-form.js +11 -4
- package/dist/components/justifi-payment-form.js.map +1 -0
- package/dist/components/justifi-payment-method-form.js +2 -0
- package/dist/components/justifi-payment-method-form.js.map +1 -0
- package/dist/components/justifi-payment-method-selector.js +2 -0
- package/dist/components/justifi-payment-method-selector.js.map +1 -0
- package/dist/components/justifi-payments-list.js +4 -107
- package/dist/components/justifi-payments-list.js.map +1 -0
- package/dist/components/payment-method-form.js +12 -7
- package/dist/components/payment-method-form.js.map +1 -0
- package/dist/components/payment-method-selector.js +4 -2
- package/dist/components/payment-method-selector.js.map +1 -0
- package/dist/components/select-input.js +2 -0
- package/dist/components/select-input.js.map +1 -0
- package/dist/components/select-input2.js +4 -2
- package/dist/components/select-input2.js.map +1 -0
- package/dist/components/state-options.js +3 -1845
- package/dist/components/state-options.js.map +1 -0
- package/dist/components/text-input.js +2 -0
- package/dist/components/text-input.js.map +1 -0
- package/dist/components/text-input2.js +4 -2
- package/dist/components/text-input2.js.map +1 -0
- package/dist/esm/Api-a07f0057.js +109 -0
- package/dist/esm/Api-a07f0057.js.map +1 -0
- package/dist/esm/Payment-c86e1e84.js +2 -0
- package/dist/esm/Payment-c86e1e84.js.map +1 -0
- package/dist/esm/{index-605b421a.js → index-044f93fc.js} +185 -22
- package/dist/esm/index-044f93fc.js.map +1 -0
- package/dist/esm/index.esm-5624a5ed.js +1847 -0
- package/dist/esm/index.esm-5624a5ed.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/justifi-bank-account-form.entry.js +3 -1
- package/dist/esm/justifi-bank-account-form.entry.js.map +1 -0
- package/dist/esm/justifi-billing-form_2.entry.js +7 -4
- package/dist/esm/justifi-billing-form_2.entry.js.map +1 -0
- package/dist/esm/justifi-business-address.entry.js +6 -3
- package/dist/esm/justifi-business-address.entry.js.map +1 -0
- package/dist/esm/justifi-business-info.entry.js +170 -0
- package/dist/esm/justifi-business-info.entry.js.map +1 -0
- package/dist/esm/justifi-card-form.entry.js +3 -1
- package/dist/esm/justifi-card-form.entry.js.map +1 -0
- package/dist/esm/justifi-payment-form.entry.js +10 -4
- package/dist/esm/justifi-payment-form.entry.js.map +1 -0
- package/dist/esm/justifi-payment-method-form.entry.js +12 -7
- package/dist/esm/justifi-payment-method-form.entry.js.map +1 -0
- package/dist/esm/justifi-payments-list.entry.js +4 -107
- package/dist/esm/justifi-payments-list.entry.js.map +1 -0
- package/dist/esm/loader.js +6 -3
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/select-input_2.entry.js +5 -3
- package/dist/esm/select-input_2.entry.js.map +1 -0
- package/dist/esm/state-options-188acc34.js +246 -0
- package/dist/esm/state-options-188acc34.js.map +1 -0
- package/dist/esm/webcomponents.js +9 -3
- package/dist/esm/webcomponents.js.map +1 -0
- package/dist/types/api/Api.d.ts +1 -1
- package/dist/types/api/Payment.d.ts +1 -1
- package/dist/types/components/business-info/business-info-schema.d.ts +42 -0
- package/dist/types/components/business-info/business-info.d.ts +20 -0
- package/dist/types/components/payment-form/payment-form.d.ts +1 -0
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +1 -1
- package/dist/types/components.d.ts +63 -0
- package/dist/types/stencil-public-runtime.d.ts +72 -15
- package/dist/webcomponents/index.esm.js +2 -0
- package/dist/webcomponents/index.esm.js.map +1 -0
- package/dist/webcomponents/p-0ea23153.js +2 -0
- package/dist/webcomponents/p-0ea23153.js.map +1 -0
- package/dist/webcomponents/p-16b4e90a.entry.js +2 -0
- package/dist/webcomponents/p-16b4e90a.entry.js.map +1 -0
- package/dist/webcomponents/p-1ca0646b.js +2 -1
- package/dist/webcomponents/p-1ca0646b.js.map +1 -0
- package/dist/webcomponents/p-1f151d49.js +2 -0
- package/dist/webcomponents/p-1f151d49.js.map +1 -0
- package/dist/webcomponents/p-1f23b391.entry.js +2 -0
- package/dist/webcomponents/p-1f23b391.entry.js.map +1 -0
- package/dist/webcomponents/p-255b1284.entry.js +2 -0
- package/dist/webcomponents/p-255b1284.entry.js.map +1 -0
- package/dist/webcomponents/p-3aa91155.js +3 -0
- package/dist/webcomponents/p-3aa91155.js.map +1 -0
- package/dist/webcomponents/p-90c0d9e1.entry.js +2 -0
- package/dist/webcomponents/p-90c0d9e1.entry.js.map +1 -0
- package/dist/webcomponents/p-c903cc5a.entry.js +2 -0
- package/dist/webcomponents/p-c903cc5a.entry.js.map +1 -0
- package/dist/webcomponents/p-d87b0711.entry.js +2 -0
- package/dist/webcomponents/p-d87b0711.entry.js.map +1 -0
- package/dist/webcomponents/p-dbf7100f.entry.js +2 -0
- package/dist/webcomponents/p-dbf7100f.entry.js.map +1 -0
- package/dist/webcomponents/p-e0054bc3.js +2 -0
- package/dist/webcomponents/p-e0054bc3.js.map +1 -0
- package/dist/webcomponents/p-f30d1567.entry.js +2 -0
- package/dist/webcomponents/p-f30d1567.entry.js.map +1 -0
- package/dist/webcomponents/p-f66f024e.entry.js +2 -0
- package/dist/webcomponents/p-f66f024e.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.css +1 -1
- package/dist/webcomponents/webcomponents.esm.js +2 -1
- package/dist/webcomponents/webcomponents.esm.js.map +1 -0
- package/loader/index.d.ts +9 -0
- package/package.json +8 -4
- package/dist/webcomponents/p-039e3540.entry.js +0 -1
- package/dist/webcomponents/p-11e5bef9.entry.js +0 -1
- package/dist/webcomponents/p-20732337.js +0 -1
- package/dist/webcomponents/p-24409e8e.entry.js +0 -1
- package/dist/webcomponents/p-4a406704.js +0 -2
- package/dist/webcomponents/p-5774e36e.entry.js +0 -1
- package/dist/webcomponents/p-5b5e8351.entry.js +0 -1
- package/dist/webcomponents/p-7747c086.entry.js +0 -1
- package/dist/webcomponents/p-b061da77.entry.js +0 -1
- package/dist/webcomponents/p-bc35e124.entry.js +0 -1
|
@@ -36,11 +36,30 @@ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
|
36
36
|
*/
|
|
37
37
|
const EMPTY_OBJ = {};
|
|
38
38
|
const isDef = (v) => v != null;
|
|
39
|
+
/**
|
|
40
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
|
41
|
+
* function.
|
|
42
|
+
*
|
|
43
|
+
* @param o the value to check
|
|
44
|
+
* @returns whether it's a complex type or not
|
|
45
|
+
*/
|
|
39
46
|
const isComplexType = (o) => {
|
|
40
47
|
// https://jsperf.com/typeof-fn-object/5
|
|
41
48
|
o = typeof o;
|
|
42
49
|
return o === 'object' || o === 'function';
|
|
43
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
53
|
+
* out of a DOM's head.
|
|
54
|
+
*
|
|
55
|
+
* @param doc The DOM containing the `head` to query against
|
|
56
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
57
|
+
* exists or the tag has no content.
|
|
58
|
+
*/
|
|
59
|
+
function queryNonceMetaTagContent(doc) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
62
|
+
}
|
|
44
63
|
/**
|
|
45
64
|
* Production h() function based on Preact by
|
|
46
65
|
* Jason Miller (@developit)
|
|
@@ -49,7 +68,6 @@ const isComplexType = (o) => {
|
|
|
49
68
|
*
|
|
50
69
|
* Modified for Stencil's compiler and vdom
|
|
51
70
|
*/
|
|
52
|
-
// const stack: any[] = [];
|
|
53
71
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
54
72
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
55
73
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -104,6 +122,14 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
104
122
|
}
|
|
105
123
|
return vnode;
|
|
106
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
|
127
|
+
* possible text content.
|
|
128
|
+
*
|
|
129
|
+
* @param tag the tag for this element
|
|
130
|
+
* @param text possible text content for the node
|
|
131
|
+
* @returns a newly-minted virtual DOM node
|
|
132
|
+
*/
|
|
107
133
|
const newVNode = (tag, text) => {
|
|
108
134
|
const vnode = {
|
|
109
135
|
$flags$: 0,
|
|
@@ -118,11 +144,31 @@ const newVNode = (tag, text) => {
|
|
|
118
144
|
return vnode;
|
|
119
145
|
};
|
|
120
146
|
const Host = {};
|
|
147
|
+
/**
|
|
148
|
+
* Check whether a given node is a Host node or not
|
|
149
|
+
*
|
|
150
|
+
* @param node the virtual DOM node to check
|
|
151
|
+
* @returns whether it's a Host node or not
|
|
152
|
+
*/
|
|
121
153
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
154
|
+
/**
|
|
155
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
|
156
|
+
*
|
|
157
|
+
* Note that these functions convert from {@link d.VNode} to
|
|
158
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
|
159
|
+
* interface.
|
|
160
|
+
*/
|
|
122
161
|
const vdomFnUtils = {
|
|
123
162
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
124
163
|
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
125
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
167
|
+
* friendlier public interface (hence, 'convertToPublic').
|
|
168
|
+
*
|
|
169
|
+
* @param node the virtual DOM node to convert
|
|
170
|
+
* @returns a converted child node
|
|
171
|
+
*/
|
|
126
172
|
const convertToPublic = (node) => ({
|
|
127
173
|
vattrs: node.$attrs$,
|
|
128
174
|
vchildren: node.$children$,
|
|
@@ -131,6 +177,15 @@ const convertToPublic = (node) => ({
|
|
|
131
177
|
vtag: node.$tag$,
|
|
132
178
|
vtext: node.$text$,
|
|
133
179
|
});
|
|
180
|
+
/**
|
|
181
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
182
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
|
183
|
+
* likely created as part of presenting a public API, so converting it back
|
|
184
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
|
185
|
+
*
|
|
186
|
+
* @param node the child node to convert
|
|
187
|
+
* @returns a converted virtual DOM node
|
|
188
|
+
*/
|
|
134
189
|
const convertToPrivate = (node) => {
|
|
135
190
|
if (typeof node.vtag === 'function') {
|
|
136
191
|
const vnodeData = Object.assign({}, node.vattrs);
|
|
@@ -236,6 +291,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
236
291
|
styles.set(scopeId, style);
|
|
237
292
|
};
|
|
238
293
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
294
|
+
var _a;
|
|
239
295
|
let scopeId = getScopeId(cmpMeta);
|
|
240
296
|
const style = styles.get(scopeId);
|
|
241
297
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
@@ -251,10 +307,16 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
251
307
|
}
|
|
252
308
|
if (!appliedStyles.has(scopeId)) {
|
|
253
309
|
{
|
|
310
|
+
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
254
311
|
{
|
|
255
312
|
styleElm = doc.createElement('style');
|
|
256
313
|
styleElm.innerHTML = style;
|
|
257
314
|
}
|
|
315
|
+
// Apply CSP nonce to the style tag if it exists
|
|
316
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
317
|
+
if (nonce != null) {
|
|
318
|
+
styleElm.setAttribute('nonce', nonce);
|
|
319
|
+
}
|
|
258
320
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
259
321
|
}
|
|
260
322
|
if (appliedStyles) {
|
|
@@ -274,6 +336,7 @@ const attachStyles = (hostRef) => {
|
|
|
274
336
|
const flags = cmpMeta.$flags$;
|
|
275
337
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
276
338
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
339
|
+
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
277
340
|
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
278
341
|
// only required when we're NOT using native shadow dom (slot)
|
|
279
342
|
// or this browser doesn't support native shadow dom
|
|
@@ -459,6 +522,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
459
522
|
}
|
|
460
523
|
return elm;
|
|
461
524
|
};
|
|
525
|
+
/**
|
|
526
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
527
|
+
* add them to the DOM in the appropriate place.
|
|
528
|
+
*
|
|
529
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
|
530
|
+
* DOM nodes
|
|
531
|
+
* @param before a child of the `parentElm` which the new children should be
|
|
532
|
+
* inserted before (optional)
|
|
533
|
+
* @param parentVNode the parent virtual DOM node
|
|
534
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
535
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
536
|
+
* creating DOM nodes (inclusive)
|
|
537
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
538
|
+
* creating DOM nodes (inclusive)
|
|
539
|
+
*/
|
|
462
540
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
463
541
|
let containerElm = (parentElm);
|
|
464
542
|
let childNode;
|
|
@@ -475,13 +553,27 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
475
553
|
}
|
|
476
554
|
}
|
|
477
555
|
};
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
|
558
|
+
* This can be used to, for instance, clean up after a list of children which
|
|
559
|
+
* should no longer be shown.
|
|
560
|
+
*
|
|
561
|
+
* This function also handles some of Stencil's slot relocation logic.
|
|
562
|
+
*
|
|
563
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
|
564
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
565
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
566
|
+
*/
|
|
567
|
+
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
568
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
|
569
|
+
const vnode = vnodes[index];
|
|
570
|
+
if (vnode) {
|
|
571
|
+
const elm = vnode.$elm$;
|
|
572
|
+
nullifyVNodeRefs(vnode);
|
|
573
|
+
if (elm) {
|
|
574
|
+
// remove the vnode's element from the dom
|
|
575
|
+
elm.remove();
|
|
576
|
+
}
|
|
485
577
|
}
|
|
486
578
|
}
|
|
487
579
|
};
|
|
@@ -667,7 +759,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
667
759
|
*
|
|
668
760
|
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
669
761
|
* changing order within a `children` array or something along those lines then
|
|
670
|
-
* we could obtain a false
|
|
762
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
|
763
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
671
764
|
*
|
|
672
765
|
* @param leftVNode the first VNode to check
|
|
673
766
|
* @param rightVNode the second VNode to check
|
|
@@ -728,12 +821,31 @@ const patch = (oldVNode, newVNode) => {
|
|
|
728
821
|
elm.data = text;
|
|
729
822
|
}
|
|
730
823
|
};
|
|
731
|
-
|
|
824
|
+
/**
|
|
825
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
826
|
+
* calling them with `null`. This signals that the DOM element corresponding to
|
|
827
|
+
* the VDom node has been removed from the DOM.
|
|
828
|
+
*
|
|
829
|
+
* @param vNode a virtual DOM node
|
|
830
|
+
*/
|
|
831
|
+
const nullifyVNodeRefs = (vNode) => {
|
|
732
832
|
{
|
|
733
833
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
734
|
-
vNode.$children$ && vNode.$children$.map(
|
|
834
|
+
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
735
835
|
}
|
|
736
836
|
};
|
|
837
|
+
/**
|
|
838
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
839
|
+
*
|
|
840
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
841
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
|
842
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
843
|
+
* relocation, and reflecting attributes.
|
|
844
|
+
*
|
|
845
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
846
|
+
* the DOM node into which it should be rendered.
|
|
847
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
848
|
+
*/
|
|
737
849
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
738
850
|
const hostElm = hostRef.$hostElement$;
|
|
739
851
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
@@ -769,24 +881,63 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
769
881
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
770
882
|
return writeTask(dispatch) ;
|
|
771
883
|
};
|
|
884
|
+
/**
|
|
885
|
+
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
|
886
|
+
* component lifecycle methods like `componentWillLoad` as well as
|
|
887
|
+
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
|
888
|
+
*
|
|
889
|
+
* @param hostRef a reference to a host DOM node
|
|
890
|
+
* @param isInitialLoad whether we're on the initial load or not
|
|
891
|
+
* @returns an empty Promise which is used to enqueue a series of operations for
|
|
892
|
+
* the component
|
|
893
|
+
*/
|
|
772
894
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
773
895
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
774
896
|
const instance = hostRef.$lazyInstance$ ;
|
|
775
|
-
|
|
897
|
+
// We're going to use this variable together with `enqueue` to implement a
|
|
898
|
+
// little promise-based queue. We start out with it `undefined`. When we add
|
|
899
|
+
// the first function to the queue we'll set this variable to be that
|
|
900
|
+
// function's return value. When we attempt to add subsequent values to the
|
|
901
|
+
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
|
902
|
+
// the new function off of that `Promise` using `.then()`. This will give our
|
|
903
|
+
// queue two nice properties:
|
|
904
|
+
//
|
|
905
|
+
// 1. If all functions added to the queue are synchronous they'll be called
|
|
906
|
+
// synchronously right away.
|
|
907
|
+
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
908
|
+
// called in order after `dispatchHooks` exits.
|
|
909
|
+
let maybePromise;
|
|
776
910
|
if (isInitialLoad) {
|
|
777
911
|
{
|
|
778
912
|
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
779
913
|
if (hostRef.$queuedListeners$) {
|
|
780
914
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
781
|
-
hostRef.$queuedListeners$ =
|
|
915
|
+
hostRef.$queuedListeners$ = undefined;
|
|
782
916
|
}
|
|
783
917
|
}
|
|
784
918
|
}
|
|
785
919
|
endSchedule();
|
|
786
|
-
return
|
|
920
|
+
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
787
921
|
};
|
|
922
|
+
/**
|
|
923
|
+
* This function uses a Promise to implement a simple first-in, first-out queue
|
|
924
|
+
* of functions to be called.
|
|
925
|
+
*
|
|
926
|
+
* The queue is ordered on the basis of the first argument. If it's
|
|
927
|
+
* `undefined`, then nothing is on the queue yet, so the provided function can
|
|
928
|
+
* be called synchronously (although note that this function may return a
|
|
929
|
+
* `Promise`). The idea is that then the return value of that enqueueing
|
|
930
|
+
* operation is kept around, so that if it was a `Promise` then subsequent
|
|
931
|
+
* functions can be enqueued by calling this function again with that `Promise`
|
|
932
|
+
* as the first argument.
|
|
933
|
+
*
|
|
934
|
+
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
|
935
|
+
* @param fn a function to enqueue
|
|
936
|
+
* @returns either a `Promise` or the return value of the provided function
|
|
937
|
+
*/
|
|
938
|
+
const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
|
|
788
939
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
789
|
-
|
|
940
|
+
var _a;
|
|
790
941
|
const elm = hostRef.$hostElement$;
|
|
791
942
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
792
943
|
const rc = elm['s-rc'];
|
|
@@ -808,7 +959,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
808
959
|
endRender();
|
|
809
960
|
endUpdate();
|
|
810
961
|
{
|
|
811
|
-
const childrenPromises = elm['s-p'];
|
|
962
|
+
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
|
812
963
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
813
964
|
if (childrenPromises.length === 0) {
|
|
814
965
|
postUpdate();
|
|
@@ -905,9 +1056,6 @@ const safeCall = (instance, method, arg) => {
|
|
|
905
1056
|
}
|
|
906
1057
|
return undefined;
|
|
907
1058
|
};
|
|
908
|
-
const then = (promise, thenFn) => {
|
|
909
|
-
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
910
|
-
};
|
|
911
1059
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
912
1060
|
;
|
|
913
1061
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1073,9 +1221,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1073
1221
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1074
1222
|
// initializeComponent
|
|
1075
1223
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1224
|
+
// Let the runtime know that the component has been initialized
|
|
1225
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1076
1226
|
{
|
|
1077
|
-
// we haven't initialized this element yet
|
|
1078
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1079
1227
|
// lazy loaded components
|
|
1080
1228
|
// request the component's implementation to be
|
|
1081
1229
|
// wired up with the host element
|
|
@@ -1219,6 +1367,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1219
1367
|
}
|
|
1220
1368
|
};
|
|
1221
1369
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1370
|
+
var _a;
|
|
1222
1371
|
const endBootstrap = createTime();
|
|
1223
1372
|
const cmpTags = [];
|
|
1224
1373
|
const exclude = options.exclude || [];
|
|
@@ -1298,6 +1447,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1298
1447
|
{
|
|
1299
1448
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1300
1449
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1450
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1451
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1452
|
+
if (nonce != null) {
|
|
1453
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1454
|
+
}
|
|
1301
1455
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1302
1456
|
}
|
|
1303
1457
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1343,6 +1497,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
1343
1497
|
};
|
|
1344
1498
|
// prettier-ignore
|
|
1345
1499
|
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1500
|
+
/**
|
|
1501
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1502
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
1503
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
1504
|
+
* @returns void
|
|
1505
|
+
*/
|
|
1506
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1346
1507
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1347
1508
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1348
1509
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -1453,4 +1614,6 @@ const flush = () => {
|
|
|
1453
1614
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1454
1615
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1455
1616
|
|
|
1456
|
-
export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };
|
|
1617
|
+
export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1618
|
+
|
|
1619
|
+
//# sourceMappingURL=index-044f93fc.js.map
|