@peculiar/certificates-viewer 1.20.2-alpha.0 → 2.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/_commonjsHelpers-cb1f949a.js +23 -0
- package/dist/cjs/{download-aed99556.js → certification_request-96951e7b.js} +2898 -3336
- package/dist/cjs/{dom-760f300f.js → dom-f57e260e.js} +4 -1
- package/dist/cjs/download-5e7d5455.js +438 -0
- package/dist/cjs/{index-2973f90a.js → index-064e95c7.js} +287 -634
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/{l10n-e971a5ac.js → l10n-2e7def18.js} +72 -90
- package/dist/cjs/loader.cjs.js +12 -3
- package/dist/cjs/peculiar-attribute-certificate-viewer_9.cjs.entry.js +1426 -1391
- package/dist/cjs/peculiar-certificate-summary_3.cjs.entry.js +66 -62
- package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +222 -217
- package/dist/cjs/peculiar.cjs.js +70 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/attribute-certificate-viewer/attribute-certificate-viewer.js +220 -205
- package/dist/collection/components/attribute-certificate-viewer/holder.js +27 -24
- package/dist/collection/components/attribute-certificate-viewer/issuer.js +11 -8
- package/dist/collection/components/button/button.css +2 -7
- package/dist/collection/components/button/button.js +125 -122
- package/dist/collection/components/button-split/button-split.js +103 -100
- package/dist/collection/components/certificate-decoder/certificate-decoder.css +1 -3
- package/dist/collection/components/certificate-decoder/certificate-decoder.js +158 -155
- package/dist/collection/components/certificate-summary/certificate-summary.js +75 -72
- package/dist/collection/components/certificate-viewer/attributes/activity_description_attribute.js +11 -8
- package/dist/collection/components/certificate-viewer/attributes/as_string_attribute.js +6 -3
- package/dist/collection/components/certificate-viewer/attributes/basic_attribute.js +11 -8
- package/dist/collection/components/certificate-viewer/attributes/challenge_password_attribute.js +6 -3
- package/dist/collection/components/certificate-viewer/attributes/index.js +45 -42
- package/dist/collection/components/certificate-viewer/attributes/insurance_value_attribute.js +7 -4
- package/dist/collection/components/certificate-viewer/attributes/name_attribute.js +6 -3
- package/dist/collection/components/certificate-viewer/attributes/name_part.js +8 -5
- package/dist/collection/components/certificate-viewer/attributes/type_relationship_attribute.js +5 -2
- package/dist/collection/components/certificate-viewer/attributes/unstructured_name_attribute.js +6 -3
- package/dist/collection/components/certificate-viewer/attributes/valuation_ranking_attribute.js +18 -15
- package/dist/collection/components/certificate-viewer/attributes/web_gdpr_attribute.js +13 -10
- package/dist/collection/components/certificate-viewer/basic_information.js +13 -10
- package/dist/collection/components/certificate-viewer/certificate-viewer.js +255 -240
- package/dist/collection/components/certificate-viewer/extensions/archive_rev_info_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/as_string_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/attribute_value.js +4 -1
- package/dist/collection/components/certificate-viewer/extensions/authority_key_identifier_extension.js +18 -15
- package/dist/collection/components/certificate-viewer/extensions/basic_constraints_extension.js +7 -4
- package/dist/collection/components/certificate-viewer/extensions/basic_extension.js +12 -9
- package/dist/collection/components/certificate-viewer/extensions/biometric_syntax_extension.js +12 -9
- package/dist/collection/components/certificate-viewer/extensions/ca_version_extension.js +8 -5
- package/dist/collection/components/certificate-viewer/extensions/certificate_policies_extension.js +28 -25
- package/dist/collection/components/certificate-viewer/extensions/certificate_template_extension.js +8 -5
- package/dist/collection/components/certificate-viewer/extensions/certificate_transparency_extension.js +13 -10
- package/dist/collection/components/certificate-viewer/extensions/crl_distribution_points_extension.js +11 -8
- package/dist/collection/components/certificate-viewer/extensions/crl_reason_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/enroll_cert_type_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/entrust_version_info_extension.js +7 -4
- package/dist/collection/components/certificate-viewer/extensions/extended_key_usage_extension.js +5 -2
- package/dist/collection/components/certificate-viewer/extensions/general_name_part.js +55 -52
- package/dist/collection/components/certificate-viewer/extensions/index.js +112 -109
- package/dist/collection/components/certificate-viewer/extensions/info_access_syntax_extension.js +9 -6
- package/dist/collection/components/certificate-viewer/extensions/key_usage_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/lei_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/lei_role_extennsion.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/logotype_extension.js +49 -46
- package/dist/collection/components/certificate-viewer/extensions/name_constraints_extension.js +8 -5
- package/dist/collection/components/certificate-viewer/extensions/netscape_cert_type_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/netscape_comment_extension.js +6 -3
- package/dist/collection/components/certificate-viewer/extensions/policy_constraints_extension.js +7 -4
- package/dist/collection/components/certificate-viewer/extensions/policy_mappings_extension.js +9 -6
- package/dist/collection/components/certificate-viewer/extensions/private_key_usage_period_extension.js +7 -4
- package/dist/collection/components/certificate-viewer/extensions/qc_statements_extension.js +9 -6
- package/dist/collection/components/certificate-viewer/extensions/subject_alternative_name_extension.js +5 -2
- package/dist/collection/components/certificate-viewer/extensions/subject_directory_attributes_extension.js +9 -6
- package/dist/collection/components/certificate-viewer/extensions/subject_key_identifier_extension.js +18 -15
- package/dist/collection/components/certificate-viewer/extensions/timestamp_extension.js +8 -5
- package/dist/collection/components/certificate-viewer/extensions/tn_auth_list_extension.js +10 -7
- package/dist/collection/components/certificate-viewer/get_string_by_oid.js +8 -5
- package/dist/collection/components/certificate-viewer/issuer_name.js +9 -6
- package/dist/collection/components/certificate-viewer/miscellaneous.js +29 -26
- package/dist/collection/components/certificate-viewer/public_key.js +31 -28
- package/dist/collection/components/certificate-viewer/row.js +35 -32
- package/dist/collection/components/certificate-viewer/signature.js +12 -9
- package/dist/collection/components/certificate-viewer/subject_name.js +8 -5
- package/dist/collection/components/certificate-viewer/thumbprints.js +15 -12
- package/dist/collection/components/certificates-viewer/certificates-viewer.css +1 -19
- package/dist/collection/components/certificates-viewer/certificates-viewer.js +384 -381
- package/dist/collection/components/circular-progress/circular-progress.css +2 -24
- package/dist/collection/components/circular-progress/circular-progress.js +73 -70
- package/dist/collection/components/csr-viewer/csr-viewer.js +197 -188
- package/dist/collection/components/highlight-words/highlight-words.js +56 -53
- package/dist/collection/components/link/link.css +1 -3
- package/dist/collection/components/link/link.js +60 -57
- package/dist/collection/components/text-hider/text-hider.js +75 -72
- package/dist/collection/components/typography/typography.css +1 -3
- package/dist/collection/components/typography/typography.js +126 -123
- package/dist/collection/constants/logs.js +79 -76
- package/dist/collection/constants/oids.js +2301 -2298
- package/dist/collection/crypto/asn_data.js +33 -32
- package/dist/collection/crypto/attribute.js +52 -49
- package/dist/collection/crypto/csr.js +64 -61
- package/dist/collection/crypto/extension.js +126 -123
- package/dist/collection/crypto/index.js +3 -0
- package/dist/collection/crypto/name.js +33 -32
- package/dist/collection/crypto/provider.js +28 -25
- package/dist/collection/crypto/utils.js +24 -21
- package/dist/collection/crypto/x509_attribute_certificate.js +61 -58
- package/dist/collection/crypto/x509_certificate.js +107 -104
- package/dist/collection/index.js +5 -1
- package/dist/collection/utils/date_formatter.js +19 -16
- package/dist/collection/utils/download.js +18 -15
- package/dist/collection/utils/download_from_buffer.js +30 -25
- package/dist/collection/utils/history.js +5 -2
- package/dist/collection/utils/index.js +3 -0
- package/dist/collection/utils/is_link.js +4 -1
- package/dist/collection/utils/l10n.js +28 -25
- package/dist/collection/utils/parse_hash.js +16 -13
- package/dist/collection/utils/query_stringify.js +12 -9
- package/dist/collection/utils/read_file.js +43 -40
- package/dist/collection/utils/third_party_links.js +3 -0
- package/dist/collection/utils/validator.js +15 -12
- package/dist/esm/_commonjsHelpers-bfbd2ad8.js +20 -0
- package/dist/esm/{download-1580501c.js → certification_request-48e8b956.js} +2916 -3351
- package/dist/esm/{dom-91ed8d21.js → dom-f1b08a97.js} +4 -1
- package/dist/esm/download-cf68ac2c.js +434 -0
- package/dist/esm/{index-5ef692cc.js → index-bbd484d9.js} +278 -624
- package/dist/esm/index.js +5 -0
- package/dist/esm/{l10n-c8cf6930.js → l10n-ead9928b.js} +71 -86
- package/dist/esm/{loader.mjs → loader.js} +11 -2
- package/dist/esm/peculiar-attribute-certificate-viewer_9.entry.js +1425 -1390
- package/dist/esm/peculiar-certificate-summary_3.entry.js +66 -62
- package/dist/esm/peculiar-certificates-viewer.entry.js +222 -217
- package/dist/esm/peculiar.js +73 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/index.js +2 -2
- package/dist/esm-es5/_commonjsHelpers-bfbd2ad8.js +4 -0
- package/dist/esm-es5/certification_request-48e8b956.js +89 -0
- package/dist/esm-es5/dom-f1b08a97.js +24 -0
- package/dist/esm-es5/download-cf68ac2c.js +18 -0
- package/dist/esm-es5/index-bbd484d9.js +5 -0
- package/dist/esm-es5/index.js +4 -0
- package/dist/esm-es5/l10n-ead9928b.js +39 -0
- package/dist/esm-es5/loader.js +4 -0
- package/dist/esm-es5/peculiar-attribute-certificate-viewer_9.entry.js +198 -1907
- package/dist/esm-es5/peculiar-certificate-summary_3.entry.js +4 -83
- package/dist/esm-es5/peculiar-certificates-viewer.entry.js +4 -290
- package/dist/esm-es5/peculiar.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -1
- package/dist/peculiar/index.esm.js +4 -0
- package/dist/peculiar/p-047b12d9.system.js +89 -0
- package/dist/peculiar/p-13e9d17d.system.entry.js +460 -0
- package/dist/peculiar/p-29cdd256.system.js +18 -0
- package/dist/peculiar/{p-75076c56.system.js → p-3929074b.system.js} +18 -15
- package/dist/peculiar/p-452d69af.entry.js +113 -0
- package/dist/peculiar/p-4f52a24f.system.js +39 -0
- package/dist/peculiar/p-5f7fbf05.system.entry.js +4 -0
- package/dist/peculiar/p-82033e2e.system.entry.js +4 -0
- package/dist/peculiar/p-886e9c53.js +87 -0
- package/dist/peculiar/p-88fbaf05.system.js +4 -0
- package/dist/peculiar/p-8df391dc.system.js +4 -0
- package/dist/peculiar/p-9837be14.system.js +5 -0
- package/dist/peculiar/p-9ae6b1f8.entry.js +4 -0
- package/dist/peculiar/{p-3d1015c2.js → p-9f4ee110.js} +5 -2
- package/dist/peculiar/p-c774ec0b.js +18 -0
- package/dist/peculiar/p-d09b762f.js +33 -0
- package/dist/peculiar/p-d0b55fbb.js +4 -0
- package/dist/peculiar/p-e5f99586.entry.js +4 -0
- package/dist/peculiar/p-ee0e2707.system.js +4 -0
- package/dist/peculiar/p-f7683ba5.js +5 -0
- package/dist/peculiar/peculiar.esm.js +4 -1
- package/dist/peculiar/peculiar.js +1 -3
- package/dist/types/components/attribute-certificate-viewer/attribute-certificate-viewer.d.ts +56 -56
- package/dist/types/components/attribute-certificate-viewer/holder.d.ts +1 -1
- package/dist/types/components/attribute-certificate-viewer/issuer.d.ts +1 -1
- package/dist/types/components/button/button.d.ts +17 -17
- package/dist/types/components/button-split/button-split.d.ts +10 -10
- package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +16 -16
- package/dist/types/components/certificate-summary/certificate-summary.d.ts +4 -4
- package/dist/types/components/certificate-viewer/attributes/activity_description_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/as_string_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/basic_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/challenge_password_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/index.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/insurance_value_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/name_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/name_part.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/type_relationship_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/unstructured_name_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/valuation_ranking_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/attributes/web_gdpr_attribute.d.ts +1 -1
- package/dist/types/components/certificate-viewer/basic_information.d.ts +6 -6
- package/dist/types/components/certificate-viewer/certificate-viewer.d.ts +66 -66
- package/dist/types/components/certificate-viewer/extensions/archive_rev_info_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/as_string_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/authority_key_identifier_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/basic_constraints_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/basic_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/biometric_syntax_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/ca_version_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/certificate_policies_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/certificate_template_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/certificate_transparency_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/crl_distribution_points_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/crl_reason_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/enroll_cert_type_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/entrust_version_info_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/extended_key_usage_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/general_name_part.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/index.d.ts +2 -2
- package/dist/types/components/certificate-viewer/extensions/info_access_syntax_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/key_usage_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/lei_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/lei_role_extennsion.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/logotype_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/name_constraints_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/netscape_cert_type_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/netscape_comment_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/policy_constraints_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/policy_mappings_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/private_key_usage_period_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/qc_statements_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/subject_alternative_name_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/subject_directory_attributes_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/subject_key_identifier_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/timestamp_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/extensions/tn_auth_list_extension.d.ts +1 -1
- package/dist/types/components/certificate-viewer/issuer_name.d.ts +2 -2
- package/dist/types/components/certificate-viewer/miscellaneous.d.ts +1 -1
- package/dist/types/components/certificate-viewer/public_key.d.ts +1 -1
- package/dist/types/components/certificate-viewer/row.d.ts +7 -7
- package/dist/types/components/certificate-viewer/signature.d.ts +1 -1
- package/dist/types/components/certificate-viewer/subject_name.d.ts +1 -1
- package/dist/types/components/certificate-viewer/thumbprints.d.ts +1 -1
- package/dist/types/components/certificate-viewer/types.d.ts +26 -0
- package/dist/types/components/certificates-viewer/certificates-viewer.d.ts +64 -64
- package/dist/types/components/circular-progress/circular-progress.d.ts +10 -10
- package/dist/types/components/csr-viewer/csr-viewer.d.ts +45 -45
- package/dist/types/components/highlight-words/highlight-words.d.ts +8 -8
- package/dist/types/components/link/link.d.ts +6 -6
- package/dist/types/components/text-hider/text-hider.d.ts +4 -4
- package/dist/types/components/typography/typography.d.ts +18 -18
- package/dist/types/components.d.ts +11 -3
- package/dist/types/constants/logs.d.ts +76 -76
- package/dist/types/constants/oids.d.ts +2293 -2293
- package/dist/types/crypto/asn_data.d.ts +6 -6
- package/dist/types/crypto/attribute.d.ts +3 -3
- package/dist/types/crypto/csr.d.ts +19 -19
- package/dist/types/crypto/extension.d.ts +3 -3
- package/dist/types/crypto/name.d.ts +7 -7
- package/dist/types/crypto/provider.d.ts +15 -15
- package/dist/types/crypto/x509_attribute_certificate.d.ts +22 -22
- package/dist/types/crypto/x509_certificate.d.ts +28 -28
- package/dist/types/index.d.ts +2 -1
- package/dist/types/interface.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +230 -217
- package/dist/types/utils/download.d.ts +8 -8
- package/dist/types/utils/download_from_buffer.d.ts +3 -3
- package/dist/types/utils/l10n.d.ts +43 -43
- package/dist/types/utils/read_file.d.ts +7 -7
- package/loader/cdn.js +3 -1
- package/loader/index.cjs.js +3 -1
- package/loader/index.d.ts +0 -1
- package/loader/index.es2017.js +5 -0
- package/loader/{index.mjs → index.js} +4 -2
- package/loader/package.json +4 -5
- package/package.json +32 -33
- package/dist/cjs/css-shim-1b988199.js +0 -6
- package/dist/cjs/patch-15ea31af.js +0 -112
- package/dist/cjs/shadow-css-376763e9.js +0 -385
- package/dist/esm/css-shim-5ce2b5c4.js +0 -4
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/patch-f8a17185.js +0 -109
- package/dist/esm/peculiar.mjs +0 -6
- package/dist/esm/shadow-css-95922619.js +0 -383
- package/dist/esm-es5/css-shim-5ce2b5c4.js +0 -122
- package/dist/esm-es5/dom-91ed8d21.js +0 -468
- package/dist/esm-es5/download-1580501c.js +0 -12701
- package/dist/esm-es5/index-5ef692cc.js +0 -1839
- package/dist/esm-es5/index.mjs +0 -0
- package/dist/esm-es5/l10n-c8cf6930.js +0 -758
- package/dist/esm-es5/loader.mjs +0 -10
- package/dist/esm-es5/patch-f8a17185.js +0 -106
- package/dist/esm-es5/peculiar.mjs +0 -5
- package/dist/esm-es5/shadow-css-95922619.js +0 -408
- package/dist/index.mjs +0 -1
- package/dist/peculiar/p-0ad0b6e8.js +0 -1
- package/dist/peculiar/p-198d9121.js +0 -1
- package/dist/peculiar/p-294c4ef9.entry.js +0 -1
- package/dist/peculiar/p-344c2502.system.entry.js +0 -1
- package/dist/peculiar/p-4b7cd42f.js +0 -12
- package/dist/peculiar/p-50ea2036.system.js +0 -1
- package/dist/peculiar/p-557d912f.system.js +0 -1
- package/dist/peculiar/p-6639fba3.system.js +0 -100
- package/dist/peculiar/p-7c7cd1d9.js +0 -100
- package/dist/peculiar/p-9351b95f.system.entry.js +0 -457
- package/dist/peculiar/p-983b5210.system.entry.js +0 -1
- package/dist/peculiar/p-9f815f76.system.js +0 -1
- package/dist/peculiar/p-aa0a9b36.system.js +0 -1
- package/dist/peculiar/p-ad2ab9ac.entry.js +0 -110
- package/dist/peculiar/p-bd1f9066.system.js +0 -36
- package/dist/peculiar/p-bd949790.js +0 -1
- package/dist/peculiar/p-cf1841f8.js +0 -30
- package/dist/peculiar/p-efc86dbf.entry.js +0 -1
- package/dist/peculiar/p-fb53799e.system.js +0 -1
- package/dist/peculiar/p-fdad110e.system.js +0 -13
- package/dist/peculiar.js +0 -30
- package/loader/index.es2017.mjs +0 -3
- package/loader/node-main.js +0 -3
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
|
+
*/
|
|
1
4
|
'use strict';
|
|
2
5
|
|
|
3
6
|
function _interopNamespace(e) {
|
|
4
|
-
if (e && e.__esModule)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
8
12
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
9
13
|
Object.defineProperty(n, k, d.get ? d : {
|
|
10
14
|
enumerable: true,
|
|
@@ -12,51 +16,44 @@ function _interopNamespace(e) {
|
|
|
12
16
|
return e[k];
|
|
13
17
|
}
|
|
14
18
|
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
n['default'] = e;
|
|
18
|
-
return n;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
19
21
|
}
|
|
22
|
+
n['default'] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
const NAMESPACE = 'peculiar';
|
|
23
27
|
|
|
24
28
|
let scopeId;
|
|
25
|
-
let contentRef;
|
|
26
29
|
let hostTagName;
|
|
27
|
-
let useNativeShadowDom = false;
|
|
28
|
-
let checkSlotFallbackVisibility = false;
|
|
29
|
-
let checkSlotRelocate = false;
|
|
30
30
|
let isSvgMode = false;
|
|
31
|
-
let queueCongestion = 0;
|
|
32
31
|
let queuePending = false;
|
|
33
32
|
const win = typeof window !== 'undefined' ? window : {};
|
|
34
|
-
const CSS = win.CSS ;
|
|
35
33
|
const doc = win.document || { head: {} };
|
|
36
34
|
const plt = {
|
|
37
35
|
$flags$: 0,
|
|
38
36
|
$resourcesUrl$: '',
|
|
39
|
-
jmp: h => h(),
|
|
40
|
-
raf: h => requestAnimationFrame(h),
|
|
37
|
+
jmp: (h) => h(),
|
|
38
|
+
raf: (h) => requestAnimationFrame(h),
|
|
41
39
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
42
40
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
43
41
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
44
42
|
};
|
|
45
|
-
const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() ;
|
|
46
43
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
47
|
-
const supportsConstructibleStylesheets =
|
|
44
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
48
45
|
try {
|
|
49
46
|
new CSSStyleSheet();
|
|
50
|
-
return
|
|
47
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
51
48
|
}
|
|
52
49
|
catch (e) { }
|
|
53
50
|
return false;
|
|
54
51
|
})()
|
|
55
52
|
;
|
|
56
53
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
57
|
-
if (
|
|
54
|
+
if (listeners) {
|
|
58
55
|
listeners.map(([flags, name, method]) => {
|
|
59
|
-
const target =
|
|
56
|
+
const target = elm;
|
|
60
57
|
const handler = hostListenerProxy(hostRef, method);
|
|
61
58
|
const opts = hostListenerOpts(flags);
|
|
62
59
|
plt.ael(target, name, handler, opts);
|
|
@@ -65,18 +62,23 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
65
62
|
}
|
|
66
63
|
};
|
|
67
64
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
try {
|
|
66
|
+
{
|
|
67
|
+
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
68
|
+
// instance is ready, let's call it's member method for this event
|
|
69
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
73
|
+
}
|
|
75
74
|
}
|
|
76
75
|
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
consoleError(e);
|
|
78
|
+
}
|
|
77
79
|
};
|
|
78
80
|
// prettier-ignore
|
|
79
|
-
const hostListenerOpts = (flags) =>
|
|
81
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
80
82
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
81
83
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
82
84
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -107,7 +109,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
107
109
|
};
|
|
108
110
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
109
111
|
let scopeId = getScopeId(cmpMeta);
|
|
110
|
-
|
|
112
|
+
const style = styles.get(scopeId);
|
|
111
113
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
112
114
|
// so the fallback is to always use the document for the root node in those cases
|
|
113
115
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -121,18 +123,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
121
123
|
}
|
|
122
124
|
if (!appliedStyles.has(scopeId)) {
|
|
123
125
|
{
|
|
124
|
-
|
|
125
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
126
|
-
const newScopeId = styleElm['s-sc'];
|
|
127
|
-
if (newScopeId) {
|
|
128
|
-
scopeId = newScopeId;
|
|
129
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
130
|
-
// since the cssVarShim might need to apply several different
|
|
131
|
-
// stylesheets for the same component
|
|
132
|
-
appliedStyles = null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
126
|
+
{
|
|
136
127
|
styleElm = doc.createElement('style');
|
|
137
128
|
styleElm.innerHTML = style;
|
|
138
129
|
}
|
|
@@ -143,7 +134,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
143
134
|
}
|
|
144
135
|
}
|
|
145
136
|
}
|
|
146
|
-
else if (
|
|
137
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
147
138
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
148
139
|
}
|
|
149
140
|
}
|
|
@@ -154,8 +145,8 @@ const attachStyles = (hostRef) => {
|
|
|
154
145
|
const elm = hostRef.$hostElement$;
|
|
155
146
|
const flags = cmpMeta.$flags$;
|
|
156
147
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
157
|
-
const scopeId = addStyle(
|
|
158
|
-
if (
|
|
148
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
149
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
159
150
|
// only required when we're NOT using native shadow dom (slot)
|
|
160
151
|
// or this browser doesn't support native shadow dom
|
|
161
152
|
// and this host element was NOT created with SSR
|
|
@@ -168,7 +159,7 @@ const attachStyles = (hostRef) => {
|
|
|
168
159
|
}
|
|
169
160
|
endAttachStyles();
|
|
170
161
|
};
|
|
171
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
162
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
172
163
|
/**
|
|
173
164
|
* Default style mode id
|
|
174
165
|
*/
|
|
@@ -183,24 +174,11 @@ const EMPTY_OBJ = {};
|
|
|
183
174
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
184
175
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
185
176
|
const isDef = (v) => v != null;
|
|
186
|
-
const noop = () => {
|
|
187
|
-
/* noop*/
|
|
188
|
-
};
|
|
189
177
|
const isComplexType = (o) => {
|
|
190
178
|
// https://jsperf.com/typeof-fn-object/5
|
|
191
179
|
o = typeof o;
|
|
192
180
|
return o === 'object' || o === 'function';
|
|
193
181
|
};
|
|
194
|
-
const IS_DENO_ENV = typeof Deno !== 'undefined';
|
|
195
|
-
const IS_NODE_ENV = !IS_DENO_ENV &&
|
|
196
|
-
typeof global !== 'undefined' &&
|
|
197
|
-
typeof require === 'function' &&
|
|
198
|
-
!!global.process &&
|
|
199
|
-
typeof __filename === 'string' &&
|
|
200
|
-
(!global.origin || typeof global.origin !== 'string');
|
|
201
|
-
const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows';
|
|
202
|
-
const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/';
|
|
203
|
-
const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop;
|
|
204
182
|
/**
|
|
205
183
|
* Production h() function based on Preact by
|
|
206
184
|
* Jason Miller (@developit)
|
|
@@ -215,10 +193,9 @@ const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop;
|
|
|
215
193
|
const h = (nodeName, vnodeData, ...children) => {
|
|
216
194
|
let child = null;
|
|
217
195
|
let key = null;
|
|
218
|
-
let slotName = null;
|
|
219
196
|
let simple = false;
|
|
220
197
|
let lastSimple = false;
|
|
221
|
-
|
|
198
|
+
const vNodeChildren = [];
|
|
222
199
|
const walk = (c) => {
|
|
223
200
|
for (let i = 0; i < c.length; i++) {
|
|
224
201
|
child = c[i];
|
|
@@ -244,12 +221,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
244
221
|
walk(children);
|
|
245
222
|
if (vnodeData) {
|
|
246
223
|
// normalize class / classname attributes
|
|
247
|
-
if (
|
|
224
|
+
if (vnodeData.key) {
|
|
248
225
|
key = vnodeData.key;
|
|
249
226
|
}
|
|
250
|
-
if ( vnodeData.name) {
|
|
251
|
-
slotName = vnodeData.name;
|
|
252
|
-
}
|
|
253
227
|
{
|
|
254
228
|
const classData = vnodeData.className || vnodeData.class;
|
|
255
229
|
if (classData) {
|
|
@@ -257,12 +231,12 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
257
231
|
typeof classData !== 'object'
|
|
258
232
|
? classData
|
|
259
233
|
: Object.keys(classData)
|
|
260
|
-
.filter(k => classData[k])
|
|
234
|
+
.filter((k) => classData[k])
|
|
261
235
|
.join(' ');
|
|
262
236
|
}
|
|
263
237
|
}
|
|
264
238
|
}
|
|
265
|
-
if (
|
|
239
|
+
if (typeof nodeName === 'function') {
|
|
266
240
|
// nodeName is a functional component
|
|
267
241
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
268
242
|
}
|
|
@@ -274,9 +248,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
274
248
|
{
|
|
275
249
|
vnode.$key$ = key;
|
|
276
250
|
}
|
|
277
|
-
{
|
|
278
|
-
vnode.$name$ = slotName;
|
|
279
|
-
}
|
|
280
251
|
return vnode;
|
|
281
252
|
};
|
|
282
253
|
const newVNode = (tag, text) => {
|
|
@@ -293,19 +264,13 @@ const newVNode = (tag, text) => {
|
|
|
293
264
|
{
|
|
294
265
|
vnode.$key$ = null;
|
|
295
266
|
}
|
|
296
|
-
{
|
|
297
|
-
vnode.$name$ = null;
|
|
298
|
-
}
|
|
299
267
|
return vnode;
|
|
300
268
|
};
|
|
301
269
|
const Host = {};
|
|
302
270
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
303
271
|
const vdomFnUtils = {
|
|
304
272
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
305
|
-
map: (children, cb) => children
|
|
306
|
-
.map(convertToPublic)
|
|
307
|
-
.map(cb)
|
|
308
|
-
.map(convertToPrivate),
|
|
273
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
309
274
|
};
|
|
310
275
|
const convertToPublic = (node) => ({
|
|
311
276
|
vattrs: node.$attrs$,
|
|
@@ -324,7 +289,7 @@ const convertToPrivate = (node) => {
|
|
|
324
289
|
if (node.vname) {
|
|
325
290
|
vnodeData.name = node.vname;
|
|
326
291
|
}
|
|
327
|
-
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
292
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
328
293
|
}
|
|
329
294
|
const vnode = newVNode(node.vtag, node.vtext);
|
|
330
295
|
vnode.$attrs$ = node.vattrs;
|
|
@@ -345,19 +310,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
345
310
|
if (oldValue !== newValue) {
|
|
346
311
|
let isProp = isMemberInElement(elm, memberName);
|
|
347
312
|
let ln = memberName.toLowerCase();
|
|
348
|
-
if (
|
|
313
|
+
if (memberName === 'class') {
|
|
349
314
|
const classList = elm.classList;
|
|
350
315
|
const oldClasses = parseClassList(oldValue);
|
|
351
316
|
const newClasses = parseClassList(newValue);
|
|
352
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
353
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
317
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
318
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
354
319
|
}
|
|
355
|
-
else if (
|
|
320
|
+
else if (memberName === 'style') {
|
|
356
321
|
// update style attribute, css properties and values
|
|
357
322
|
{
|
|
358
323
|
for (const prop in oldValue) {
|
|
359
324
|
if (!newValue || newValue[prop] == null) {
|
|
360
|
-
if (
|
|
325
|
+
if (prop.includes('-')) {
|
|
361
326
|
elm.style.removeProperty(prop);
|
|
362
327
|
}
|
|
363
328
|
else {
|
|
@@ -368,7 +333,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
368
333
|
}
|
|
369
334
|
for (const prop in newValue) {
|
|
370
335
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
371
|
-
if (
|
|
336
|
+
if (prop.includes('-')) {
|
|
372
337
|
elm.style.setProperty(prop, newValue[prop]);
|
|
373
338
|
}
|
|
374
339
|
else {
|
|
@@ -377,15 +342,17 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
377
342
|
}
|
|
378
343
|
}
|
|
379
344
|
}
|
|
380
|
-
else if (
|
|
345
|
+
else if (memberName === 'key')
|
|
381
346
|
;
|
|
382
|
-
else if (
|
|
347
|
+
else if (memberName === 'ref') {
|
|
383
348
|
// minifier will clean this up
|
|
384
349
|
if (newValue) {
|
|
385
350
|
newValue(elm);
|
|
386
351
|
}
|
|
387
352
|
}
|
|
388
|
-
else if (
|
|
353
|
+
else if ((!isProp ) &&
|
|
354
|
+
memberName[0] === 'o' &&
|
|
355
|
+
memberName[1] === 'n') {
|
|
389
356
|
// Event Handlers
|
|
390
357
|
// so if the member name starts with "on" and the 3rd characters is
|
|
391
358
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -428,11 +395,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
428
395
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
429
396
|
try {
|
|
430
397
|
if (!elm.tagName.includes('-')) {
|
|
431
|
-
|
|
398
|
+
const n = newValue == null ? '' : newValue;
|
|
432
399
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
433
400
|
if (memberName === 'list') {
|
|
434
401
|
isProp = false;
|
|
435
|
-
// tslint:disable-next-line: triple-equals
|
|
436
402
|
}
|
|
437
403
|
else if (oldValue == null || elm[memberName] != n) {
|
|
438
404
|
elm[memberName] = n;
|
|
@@ -460,7 +426,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
460
426
|
}
|
|
461
427
|
if (newValue == null || newValue === false) {
|
|
462
428
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
463
|
-
if (
|
|
429
|
+
if (xlink) {
|
|
464
430
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
465
431
|
}
|
|
466
432
|
else {
|
|
@@ -470,7 +436,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
470
436
|
}
|
|
471
437
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
472
438
|
newValue = newValue === true ? '' : newValue;
|
|
473
|
-
if (
|
|
439
|
+
if (xlink) {
|
|
474
440
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
475
441
|
}
|
|
476
442
|
else {
|
|
@@ -486,7 +452,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
486
452
|
// if the element passed in is a shadow root, which is a document fragment
|
|
487
453
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
488
454
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
489
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
455
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
456
|
+
? newVnode.$elm$.host
|
|
457
|
+
: newVnode.$elm$;
|
|
490
458
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
491
459
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
492
460
|
{
|
|
@@ -504,49 +472,29 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
504
472
|
};
|
|
505
473
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
506
474
|
// tslint:disable-next-line: prefer-const
|
|
507
|
-
|
|
475
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
508
476
|
let i = 0;
|
|
509
477
|
let elm;
|
|
510
478
|
let childNode;
|
|
511
|
-
|
|
512
|
-
if ( !useNativeShadowDom) {
|
|
513
|
-
// remember for later we need to check to relocate nodes
|
|
514
|
-
checkSlotRelocate = true;
|
|
515
|
-
if (newVNode.$tag$ === 'slot') {
|
|
516
|
-
if (scopeId) {
|
|
517
|
-
// scoped css needs to add its scoped id to the parent element
|
|
518
|
-
parentElm.classList.add(scopeId + '-s');
|
|
519
|
-
}
|
|
520
|
-
newVNode.$flags$ |= newVNode.$children$
|
|
521
|
-
? // slot element has fallback content
|
|
522
|
-
2 /* isSlotFallback */
|
|
523
|
-
: // slot element does not have fallback content
|
|
524
|
-
1 /* isSlotReference */;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
if ( newVNode.$text$ !== null) {
|
|
479
|
+
if (newVNode.$text$ !== null) {
|
|
528
480
|
// create text node
|
|
529
481
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
530
482
|
}
|
|
531
|
-
else if ( newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
532
|
-
// create a slot reference node
|
|
533
|
-
elm = newVNode.$elm$ = doc.createTextNode('');
|
|
534
|
-
}
|
|
535
483
|
else {
|
|
536
|
-
if (
|
|
484
|
+
if (!isSvgMode) {
|
|
537
485
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
538
486
|
}
|
|
539
487
|
// create element
|
|
540
|
-
elm = newVNode.$elm$ = (
|
|
488
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
|
541
489
|
);
|
|
542
|
-
if (
|
|
490
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
543
491
|
isSvgMode = false;
|
|
544
492
|
}
|
|
545
493
|
// add css classes, attrs, props, listeners, etc.
|
|
546
494
|
{
|
|
547
495
|
updateElement(null, newVNode, isSvgMode);
|
|
548
496
|
}
|
|
549
|
-
if (
|
|
497
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
550
498
|
// if there is a scopeId and this is the initial render
|
|
551
499
|
// then let's add the scopeId as a css class
|
|
552
500
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -554,7 +502,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
554
502
|
if (newVNode.$children$) {
|
|
555
503
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
556
504
|
// create the node
|
|
557
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
505
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
558
506
|
// return node could have been null
|
|
559
507
|
if (childNode) {
|
|
560
508
|
// append our new node
|
|
@@ -573,62 +521,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
573
521
|
}
|
|
574
522
|
}
|
|
575
523
|
}
|
|
576
|
-
{
|
|
577
|
-
elm['s-hn'] = hostTagName;
|
|
578
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
579
|
-
// remember the content reference comment
|
|
580
|
-
elm['s-sr'] = true;
|
|
581
|
-
// remember the content reference comment
|
|
582
|
-
elm['s-cr'] = contentRef;
|
|
583
|
-
// remember the slot name, or empty string for default slot
|
|
584
|
-
elm['s-sn'] = newVNode.$name$ || '';
|
|
585
|
-
// check if we've got an old vnode for this slot
|
|
586
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
587
|
-
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
588
|
-
// we've got an old slot vnode and the wrapper is being replaced
|
|
589
|
-
// so let's move the old slot content back to it's original location
|
|
590
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
524
|
return elm;
|
|
595
525
|
};
|
|
596
|
-
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
597
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
598
|
-
const oldSlotChildNodes = parentElm.childNodes;
|
|
599
|
-
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
600
|
-
const childNode = oldSlotChildNodes[i];
|
|
601
|
-
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
602
|
-
// // this child node in the old element is from another component
|
|
603
|
-
// // remove this node from the old slot's parent
|
|
604
|
-
// childNode.remove();
|
|
605
|
-
// and relocate it back to it's original location
|
|
606
|
-
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
607
|
-
// remove the old original location comment entirely
|
|
608
|
-
// later on the patch function will know what to do
|
|
609
|
-
// and move this to the correct spot in need be
|
|
610
|
-
childNode['s-ol'].remove();
|
|
611
|
-
childNode['s-ol'] = undefined;
|
|
612
|
-
checkSlotRelocate = true;
|
|
613
|
-
}
|
|
614
|
-
if (recursive) {
|
|
615
|
-
putBackInOriginalLocation(childNode, recursive);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
619
|
-
};
|
|
620
526
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
621
|
-
let containerElm = (
|
|
527
|
+
let containerElm = (parentElm);
|
|
622
528
|
let childNode;
|
|
623
|
-
if (
|
|
529
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
624
530
|
containerElm = containerElm.shadowRoot;
|
|
625
531
|
}
|
|
626
532
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
627
533
|
if (vnodes[startIdx]) {
|
|
628
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
534
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
629
535
|
if (childNode) {
|
|
630
536
|
vnodes[startIdx].$elm$ = childNode;
|
|
631
|
-
containerElm.insertBefore(childNode,
|
|
537
|
+
containerElm.insertBefore(childNode, before);
|
|
632
538
|
}
|
|
633
539
|
}
|
|
634
540
|
}
|
|
@@ -638,20 +544,6 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
638
544
|
if ((vnode = vnodes[startIdx])) {
|
|
639
545
|
elm = vnode.$elm$;
|
|
640
546
|
callNodeRefs(vnode);
|
|
641
|
-
{
|
|
642
|
-
// we're removing this element
|
|
643
|
-
// so it's possible we need to show slot fallback content now
|
|
644
|
-
checkSlotFallbackVisibility = true;
|
|
645
|
-
if (elm['s-ol']) {
|
|
646
|
-
// remove the original location comment
|
|
647
|
-
elm['s-ol'].remove();
|
|
648
|
-
}
|
|
649
|
-
else {
|
|
650
|
-
// it's possible that child nodes of the node
|
|
651
|
-
// that's being removed are slot nodes
|
|
652
|
-
putBackInOriginalLocation(elm, true);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
547
|
// remove the vnode's element from the dom
|
|
656
548
|
elm.remove();
|
|
657
549
|
}
|
|
@@ -695,20 +587,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
695
587
|
newEndVnode = newCh[--newEndIdx];
|
|
696
588
|
}
|
|
697
589
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
698
|
-
// Vnode moved right
|
|
699
|
-
if ( (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
700
|
-
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
701
|
-
}
|
|
702
590
|
patch(oldStartVnode, newEndVnode);
|
|
703
591
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
704
592
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
705
593
|
newEndVnode = newCh[--newEndIdx];
|
|
706
594
|
}
|
|
707
595
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
708
|
-
// Vnode moved left
|
|
709
|
-
if ( (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
710
|
-
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
711
|
-
}
|
|
712
596
|
patch(oldEndVnode, newStartVnode);
|
|
713
597
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
714
598
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
@@ -725,10 +609,10 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
725
609
|
}
|
|
726
610
|
}
|
|
727
611
|
}
|
|
728
|
-
if (
|
|
612
|
+
if (idxInOld >= 0) {
|
|
729
613
|
elmToMove = oldCh[idxInOld];
|
|
730
614
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
731
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld
|
|
615
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
732
616
|
}
|
|
733
617
|
else {
|
|
734
618
|
patch(elmToMove, newStartVnode);
|
|
@@ -739,12 +623,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
739
623
|
}
|
|
740
624
|
else {
|
|
741
625
|
// new element
|
|
742
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
626
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
743
627
|
newStartVnode = newCh[++newStartIdx];
|
|
744
628
|
}
|
|
745
629
|
if (node) {
|
|
746
630
|
{
|
|
747
|
-
|
|
631
|
+
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
748
632
|
}
|
|
749
633
|
}
|
|
750
634
|
}
|
|
@@ -752,7 +636,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
752
636
|
if (oldStartIdx > oldEndIdx) {
|
|
753
637
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
754
638
|
}
|
|
755
|
-
else if (
|
|
639
|
+
else if (newStartIdx > newEndIdx) {
|
|
756
640
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
757
641
|
}
|
|
758
642
|
};
|
|
@@ -760,31 +644,19 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
760
644
|
// compare if two vnode to see if they're "technically" the same
|
|
761
645
|
// need to have the same element tag, and same key to be the same
|
|
762
646
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
763
|
-
if ( vnode1.$tag$ === 'slot') {
|
|
764
|
-
return vnode1.$name$ === vnode2.$name$;
|
|
765
|
-
}
|
|
766
647
|
{
|
|
767
648
|
return vnode1.$key$ === vnode2.$key$;
|
|
768
649
|
}
|
|
769
650
|
}
|
|
770
651
|
return false;
|
|
771
652
|
};
|
|
772
|
-
const referenceNode = (node) => {
|
|
773
|
-
// this node was relocated to a new location in the dom
|
|
774
|
-
// because of some other component's slot
|
|
775
|
-
// but we still have an html comment in place of where
|
|
776
|
-
// it's original location was according to it's original vdom
|
|
777
|
-
return (node && node['s-ol']) || node;
|
|
778
|
-
};
|
|
779
|
-
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
780
653
|
const patch = (oldVNode, newVNode) => {
|
|
781
654
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
782
655
|
const oldChildren = oldVNode.$children$;
|
|
783
656
|
const newChildren = newVNode.$children$;
|
|
784
657
|
const tag = newVNode.$tag$;
|
|
785
658
|
const text = newVNode.$text$;
|
|
786
|
-
|
|
787
|
-
if ( text === null) {
|
|
659
|
+
if (text === null) {
|
|
788
660
|
{
|
|
789
661
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
790
662
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
@@ -792,7 +664,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
792
664
|
}
|
|
793
665
|
// element node
|
|
794
666
|
{
|
|
795
|
-
if (
|
|
667
|
+
if (tag === 'slot')
|
|
796
668
|
;
|
|
797
669
|
else {
|
|
798
670
|
// either this is the first render of an element OR it's an update
|
|
@@ -801,170 +673,33 @@ const patch = (oldVNode, newVNode) => {
|
|
|
801
673
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
802
674
|
}
|
|
803
675
|
}
|
|
804
|
-
if (
|
|
676
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
805
677
|
// looks like there's child vnodes for both the old and new vnodes
|
|
806
678
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
807
679
|
}
|
|
808
680
|
else if (newChildren !== null) {
|
|
809
681
|
// no old child vnodes, but there are new child vnodes to add
|
|
810
|
-
if (
|
|
682
|
+
if (oldVNode.$text$ !== null) {
|
|
811
683
|
// the old vnode was text, so be sure to clear it out
|
|
812
684
|
elm.textContent = '';
|
|
813
685
|
}
|
|
814
686
|
// add the new vnode children
|
|
815
687
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
816
688
|
}
|
|
817
|
-
else if (
|
|
689
|
+
else if (oldChildren !== null) {
|
|
818
690
|
// no new child vnodes, but there are old child vnodes to remove
|
|
819
691
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
820
692
|
}
|
|
821
|
-
if (
|
|
693
|
+
if (isSvgMode && tag === 'svg') {
|
|
822
694
|
isSvgMode = false;
|
|
823
695
|
}
|
|
824
696
|
}
|
|
825
|
-
else if (
|
|
826
|
-
// this element has slotted content
|
|
827
|
-
defaultHolder.parentNode.textContent = text;
|
|
828
|
-
}
|
|
829
|
-
else if ( oldVNode.$text$ !== text) {
|
|
697
|
+
else if (oldVNode.$text$ !== text) {
|
|
830
698
|
// update the text content for the text only vnode
|
|
831
699
|
// and also only if the text is different than before
|
|
832
700
|
elm.data = text;
|
|
833
701
|
}
|
|
834
702
|
};
|
|
835
|
-
const updateFallbackSlotVisibility = (elm) => {
|
|
836
|
-
// tslint:disable-next-line: prefer-const
|
|
837
|
-
let childNodes = elm.childNodes;
|
|
838
|
-
let childNode;
|
|
839
|
-
let i;
|
|
840
|
-
let ilen;
|
|
841
|
-
let j;
|
|
842
|
-
let slotNameAttr;
|
|
843
|
-
let nodeType;
|
|
844
|
-
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
845
|
-
childNode = childNodes[i];
|
|
846
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
847
|
-
if (childNode['s-sr']) {
|
|
848
|
-
// this is a slot fallback node
|
|
849
|
-
// get the slot name for this slot reference node
|
|
850
|
-
slotNameAttr = childNode['s-sn'];
|
|
851
|
-
// by default always show a fallback slot node
|
|
852
|
-
// then hide it if there are other slots in the light dom
|
|
853
|
-
childNode.hidden = false;
|
|
854
|
-
for (j = 0; j < ilen; j++) {
|
|
855
|
-
if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
|
|
856
|
-
// this sibling node is from a different component
|
|
857
|
-
nodeType = childNodes[j].nodeType;
|
|
858
|
-
if (slotNameAttr !== '') {
|
|
859
|
-
// this is a named fallback slot node
|
|
860
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
861
|
-
childNode.hidden = true;
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
// this is a default fallback slot node
|
|
867
|
-
// any element or text node (with content)
|
|
868
|
-
// should hide the default fallback slot node
|
|
869
|
-
if (nodeType === 1 /* ElementNode */ || (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
870
|
-
childNode.hidden = true;
|
|
871
|
-
break;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
// keep drilling down
|
|
878
|
-
updateFallbackSlotVisibility(childNode);
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
const relocateNodes = [];
|
|
883
|
-
const relocateSlotContent = (elm) => {
|
|
884
|
-
// tslint:disable-next-line: prefer-const
|
|
885
|
-
let childNode;
|
|
886
|
-
let node;
|
|
887
|
-
let hostContentNodes;
|
|
888
|
-
let slotNameAttr;
|
|
889
|
-
let relocateNodeData;
|
|
890
|
-
let j;
|
|
891
|
-
let i = 0;
|
|
892
|
-
let childNodes = elm.childNodes;
|
|
893
|
-
let ilen = childNodes.length;
|
|
894
|
-
for (; i < ilen; i++) {
|
|
895
|
-
childNode = childNodes[i];
|
|
896
|
-
if (childNode['s-sr'] && (node = childNode['s-cr'])) {
|
|
897
|
-
// first got the content reference comment node
|
|
898
|
-
// then we got it's parent, which is where all the host content is in now
|
|
899
|
-
hostContentNodes = node.parentNode.childNodes;
|
|
900
|
-
slotNameAttr = childNode['s-sn'];
|
|
901
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
902
|
-
node = hostContentNodes[j];
|
|
903
|
-
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
904
|
-
// let's do some relocating to its new home
|
|
905
|
-
// but never relocate a content reference node
|
|
906
|
-
// that is suppose to always represent the original content location
|
|
907
|
-
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
908
|
-
// it's possible we've already decided to relocate this node
|
|
909
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
910
|
-
// made some changes to slots
|
|
911
|
-
// let's make sure we also double check
|
|
912
|
-
// fallbacks are correctly hidden or shown
|
|
913
|
-
checkSlotFallbackVisibility = true;
|
|
914
|
-
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
915
|
-
if (relocateNodeData) {
|
|
916
|
-
// previously we never found a slot home for this node
|
|
917
|
-
// but turns out we did, so let's remember it now
|
|
918
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
|
919
|
-
}
|
|
920
|
-
else {
|
|
921
|
-
// add to our list of nodes to relocate
|
|
922
|
-
relocateNodes.push({
|
|
923
|
-
$slotRefNode$: childNode,
|
|
924
|
-
$nodeToRelocate$: node,
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
if (node['s-sr']) {
|
|
928
|
-
relocateNodes.map(relocateNode => {
|
|
929
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
930
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
931
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
932
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
|
|
939
|
-
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
940
|
-
// if we never find a home for this element then we'll need to hide it
|
|
941
|
-
relocateNodes.push({
|
|
942
|
-
$nodeToRelocate$: node,
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
949
|
-
relocateSlotContent(childNode);
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
};
|
|
953
|
-
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
954
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
955
|
-
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
956
|
-
return true;
|
|
957
|
-
}
|
|
958
|
-
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
959
|
-
return true;
|
|
960
|
-
}
|
|
961
|
-
return false;
|
|
962
|
-
}
|
|
963
|
-
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
964
|
-
return true;
|
|
965
|
-
}
|
|
966
|
-
return slotNameAttr === '';
|
|
967
|
-
};
|
|
968
703
|
const callNodeRefs = (vNode) => {
|
|
969
704
|
{
|
|
970
705
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
@@ -977,101 +712,21 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
977
712
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
978
713
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
979
714
|
hostTagName = hostElm.tagName;
|
|
980
|
-
if (
|
|
715
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
981
716
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
982
717
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
983
718
|
}
|
|
984
719
|
rootVnode.$tag$ = null;
|
|
985
720
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
986
721
|
hostRef.$vnode$ = rootVnode;
|
|
987
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
722
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
988
723
|
{
|
|
989
724
|
scopeId = hostElm['s-sc'];
|
|
990
725
|
}
|
|
991
|
-
{
|
|
992
|
-
contentRef = hostElm['s-cr'];
|
|
993
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
994
|
-
// always reset
|
|
995
|
-
checkSlotFallbackVisibility = false;
|
|
996
|
-
}
|
|
997
726
|
// synchronous patch
|
|
998
727
|
patch(oldVNode, rootVnode);
|
|
999
|
-
{
|
|
1000
|
-
// while we're moving nodes around existing nodes, temporarily disable
|
|
1001
|
-
// the disconnectCallback from working
|
|
1002
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1003
|
-
if (checkSlotRelocate) {
|
|
1004
|
-
relocateSlotContent(rootVnode.$elm$);
|
|
1005
|
-
let relocateData;
|
|
1006
|
-
let nodeToRelocate;
|
|
1007
|
-
let orgLocationNode;
|
|
1008
|
-
let parentNodeRef;
|
|
1009
|
-
let insertBeforeNode;
|
|
1010
|
-
let refNode;
|
|
1011
|
-
let i = 0;
|
|
1012
|
-
for (; i < relocateNodes.length; i++) {
|
|
1013
|
-
relocateData = relocateNodes[i];
|
|
1014
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1015
|
-
if (!nodeToRelocate['s-ol']) {
|
|
1016
|
-
// add a reference node marking this node's original location
|
|
1017
|
-
// keep a reference to this node for later lookups
|
|
1018
|
-
orgLocationNode = doc.createTextNode('');
|
|
1019
|
-
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1020
|
-
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
for (i = 0; i < relocateNodes.length; i++) {
|
|
1024
|
-
relocateData = relocateNodes[i];
|
|
1025
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1026
|
-
if (relocateData.$slotRefNode$) {
|
|
1027
|
-
// by default we're just going to insert it directly
|
|
1028
|
-
// after the slot reference node
|
|
1029
|
-
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
1030
|
-
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
1031
|
-
orgLocationNode = nodeToRelocate['s-ol'];
|
|
1032
|
-
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
1033
|
-
refNode = orgLocationNode['s-nr'];
|
|
1034
|
-
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1035
|
-
refNode = refNode.nextSibling;
|
|
1036
|
-
if (!refNode || !refNode['s-nr']) {
|
|
1037
|
-
insertBeforeNode = refNode;
|
|
1038
|
-
break;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1043
|
-
// we've checked that it's worth while to relocate
|
|
1044
|
-
// since that the node to relocate
|
|
1045
|
-
// has a different next sibling or parent relocated
|
|
1046
|
-
if (nodeToRelocate !== insertBeforeNode) {
|
|
1047
|
-
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1048
|
-
// probably a component in the index.html that doesn't have it's hostname set
|
|
1049
|
-
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1050
|
-
}
|
|
1051
|
-
// add it back to the dom but in its new home
|
|
1052
|
-
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
else {
|
|
1057
|
-
// this node doesn't have a slot home to go to, so let's hide it
|
|
1058
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1059
|
-
nodeToRelocate.hidden = true;
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
if (checkSlotFallbackVisibility) {
|
|
1065
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1066
|
-
}
|
|
1067
|
-
// done moving nodes around
|
|
1068
|
-
// allow the disconnect callback to work again
|
|
1069
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1070
|
-
// always reset
|
|
1071
|
-
relocateNodes.length = 0;
|
|
1072
|
-
}
|
|
1073
728
|
};
|
|
1074
|
-
const getElement = (ref) => (
|
|
729
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1075
730
|
const createEvent = (ref, name, flags) => {
|
|
1076
731
|
const elm = getElement(ref);
|
|
1077
732
|
return {
|
|
@@ -1085,34 +740,41 @@ const createEvent = (ref, name, flags) => {
|
|
|
1085
740
|
},
|
|
1086
741
|
};
|
|
1087
742
|
};
|
|
743
|
+
/**
|
|
744
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
745
|
+
* @param elm the target of the Event
|
|
746
|
+
* @param name the name to give the custom Event
|
|
747
|
+
* @param opts options for configuring a custom Event
|
|
748
|
+
* @returns the custom Event
|
|
749
|
+
*/
|
|
1088
750
|
const emitEvent = (elm, name, opts) => {
|
|
1089
751
|
const ev = plt.ce(name, opts);
|
|
1090
752
|
elm.dispatchEvent(ev);
|
|
1091
753
|
return ev;
|
|
1092
754
|
};
|
|
1093
755
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1094
|
-
if (
|
|
1095
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
756
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
757
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1096
758
|
}
|
|
1097
759
|
};
|
|
1098
760
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1099
761
|
{
|
|
1100
762
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1101
763
|
}
|
|
1102
|
-
if (
|
|
764
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1103
765
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1104
766
|
return;
|
|
1105
767
|
}
|
|
1106
768
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
1107
|
-
// there is no
|
|
769
|
+
// there is no ancestor component or the ancestor component
|
|
1108
770
|
// has already fired off its lifecycle update then
|
|
1109
771
|
// fire off the initial update
|
|
1110
772
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1111
|
-
return
|
|
773
|
+
return writeTask(dispatch) ;
|
|
1112
774
|
};
|
|
1113
775
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1114
776
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1115
|
-
const instance =
|
|
777
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1116
778
|
let promise;
|
|
1117
779
|
if (isInitialLoad) {
|
|
1118
780
|
{
|
|
@@ -1129,32 +791,24 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1129
791
|
endSchedule();
|
|
1130
792
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1131
793
|
};
|
|
1132
|
-
const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
794
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1133
795
|
// updateComponent
|
|
1134
796
|
const elm = hostRef.$hostElement$;
|
|
1135
797
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1136
798
|
const rc = elm['s-rc'];
|
|
1137
|
-
if (
|
|
799
|
+
if (isInitialLoad) {
|
|
1138
800
|
// DOM WRITE!
|
|
1139
801
|
attachStyles(hostRef);
|
|
1140
802
|
}
|
|
1141
803
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1142
804
|
{
|
|
1143
|
-
|
|
1144
|
-
// looks like we've got child nodes to render into this host element
|
|
1145
|
-
// or we need to update the css class/attrs on the host element
|
|
1146
|
-
// DOM WRITE!
|
|
1147
|
-
renderVdom(hostRef, callRender(hostRef, instance));
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
if ( plt.$cssShim$) {
|
|
1151
|
-
plt.$cssShim$.updateHost(elm);
|
|
805
|
+
callRender(hostRef, instance);
|
|
1152
806
|
}
|
|
1153
|
-
if (
|
|
807
|
+
if (rc) {
|
|
1154
808
|
// ok, so turns out there are some child host elements
|
|
1155
809
|
// waiting on this parent element to load
|
|
1156
810
|
// let's fire off all update callbacks waiting
|
|
1157
|
-
rc.map(cb => cb());
|
|
811
|
+
rc.map((cb) => cb());
|
|
1158
812
|
elm['s-rc'] = undefined;
|
|
1159
813
|
}
|
|
1160
814
|
endRender();
|
|
@@ -1172,26 +826,36 @@ const updateComponent = (hostRef, instance, isInitialLoad) => {
|
|
|
1172
826
|
}
|
|
1173
827
|
}
|
|
1174
828
|
};
|
|
1175
|
-
const callRender = (hostRef, instance) => {
|
|
829
|
+
const callRender = (hostRef, instance, elm) => {
|
|
1176
830
|
try {
|
|
1177
|
-
instance =
|
|
831
|
+
instance = instance.render() ;
|
|
1178
832
|
{
|
|
1179
833
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1180
834
|
}
|
|
1181
835
|
{
|
|
1182
836
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1183
837
|
}
|
|
838
|
+
{
|
|
839
|
+
{
|
|
840
|
+
// looks like we've got child nodes to render into this host element
|
|
841
|
+
// or we need to update the css class/attrs on the host element
|
|
842
|
+
// DOM WRITE!
|
|
843
|
+
{
|
|
844
|
+
renderVdom(hostRef, instance);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
1184
848
|
}
|
|
1185
849
|
catch (e) {
|
|
1186
|
-
consoleError(e);
|
|
850
|
+
consoleError(e, hostRef.$hostElement$);
|
|
1187
851
|
}
|
|
1188
|
-
return
|
|
852
|
+
return null;
|
|
1189
853
|
};
|
|
1190
854
|
const postUpdateComponent = (hostRef) => {
|
|
1191
855
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1192
856
|
const elm = hostRef.$hostElement$;
|
|
1193
857
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1194
|
-
const instance =
|
|
858
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1195
859
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1196
860
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1197
861
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
@@ -1232,26 +896,12 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1232
896
|
// ( •_•)>⌐■-■
|
|
1233
897
|
// (⌐■_■)
|
|
1234
898
|
};
|
|
1235
|
-
const forceUpdate = (ref) => {
|
|
1236
|
-
{
|
|
1237
|
-
const hostRef = getHostRef(ref);
|
|
1238
|
-
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1239
|
-
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1240
|
-
scheduleUpdate(hostRef, false);
|
|
1241
|
-
}
|
|
1242
|
-
// Returns "true" when the forced update was successfully scheduled
|
|
1243
|
-
return isConnected;
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
899
|
const appDidLoad = (who) => {
|
|
1247
900
|
// on appload
|
|
1248
901
|
// we have finish the first big initial render
|
|
1249
902
|
{
|
|
1250
903
|
addHydratedFlag(doc.documentElement);
|
|
1251
904
|
}
|
|
1252
|
-
{
|
|
1253
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
1254
|
-
}
|
|
1255
905
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1256
906
|
};
|
|
1257
907
|
const safeCall = (instance, method, arg) => {
|
|
@@ -1268,20 +918,44 @@ const safeCall = (instance, method, arg) => {
|
|
|
1268
918
|
const then = (promise, thenFn) => {
|
|
1269
919
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1270
920
|
};
|
|
1271
|
-
const addHydratedFlag = (elm) =>
|
|
921
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
922
|
+
;
|
|
923
|
+
/**
|
|
924
|
+
* Parse a new property value for a given property type.
|
|
925
|
+
*
|
|
926
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
927
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
928
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
929
|
+
* 2. the type stored from `propType`.
|
|
930
|
+
*
|
|
931
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
932
|
+
*
|
|
933
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
934
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
935
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
936
|
+
* ```tsx
|
|
937
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* HTML prop values on the other hand, will always a string
|
|
941
|
+
*
|
|
942
|
+
* @param propValue the new value to coerce to some type
|
|
943
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
944
|
+
* @returns the parsed/coerced value
|
|
945
|
+
*/
|
|
1272
946
|
const parsePropertyValue = (propValue, propType) => {
|
|
1273
947
|
// ensure this value is of the correct prop type
|
|
1274
948
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1275
|
-
if (
|
|
949
|
+
if (propType & 4 /* Boolean */) {
|
|
1276
950
|
// per the HTML spec, any string value means it is a boolean true value
|
|
1277
951
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1278
952
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1279
953
|
}
|
|
1280
|
-
if (
|
|
954
|
+
if (propType & 2 /* Number */) {
|
|
1281
955
|
// force it to be a number
|
|
1282
956
|
return parseFloat(propValue);
|
|
1283
957
|
}
|
|
1284
|
-
if (
|
|
958
|
+
if (propType & 1 /* String */) {
|
|
1285
959
|
// could have been passed as a number or boolean
|
|
1286
960
|
// but we still want it as a string
|
|
1287
961
|
return String(propValue);
|
|
@@ -1297,32 +971,36 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
1297
971
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1298
972
|
// check our new property value against our internal value
|
|
1299
973
|
const hostRef = getHostRef(ref);
|
|
974
|
+
const elm = hostRef.$hostElement$ ;
|
|
1300
975
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1301
976
|
const flags = hostRef.$flags$;
|
|
1302
|
-
const instance =
|
|
977
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1303
978
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1304
|
-
|
|
979
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
980
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
981
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
982
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1305
983
|
// gadzooks! the property's value has changed!!
|
|
1306
984
|
// set our new value!
|
|
1307
985
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1308
|
-
if (
|
|
986
|
+
if (instance) {
|
|
1309
987
|
// get an array of method names of watch functions to call
|
|
1310
|
-
if (
|
|
988
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1311
989
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1312
990
|
if (watchMethods) {
|
|
1313
991
|
// this instance is watching for when this property changed
|
|
1314
|
-
watchMethods.map(watchMethodName => {
|
|
992
|
+
watchMethods.map((watchMethodName) => {
|
|
1315
993
|
try {
|
|
1316
994
|
// fire off each of the watch methods that are watching this property
|
|
1317
995
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
1318
996
|
}
|
|
1319
997
|
catch (e) {
|
|
1320
|
-
consoleError(e);
|
|
998
|
+
consoleError(e, elm);
|
|
1321
999
|
}
|
|
1322
1000
|
});
|
|
1323
1001
|
}
|
|
1324
1002
|
}
|
|
1325
|
-
if (
|
|
1003
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1326
1004
|
// looks like this value actually changed, so we've got work to do!
|
|
1327
1005
|
// but only if we've already rendered, otherwise just chill out
|
|
1328
1006
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1333,15 +1011,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1333
1011
|
}
|
|
1334
1012
|
};
|
|
1335
1013
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1336
|
-
if (
|
|
1337
|
-
if (
|
|
1014
|
+
if (cmpMeta.$members$) {
|
|
1015
|
+
if (Cstr.watchers) {
|
|
1338
1016
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1339
1017
|
}
|
|
1340
1018
|
// It's better to have a const than two Object.entries()
|
|
1341
1019
|
const members = Object.entries(cmpMeta.$members$);
|
|
1342
1020
|
const prototype = Cstr.prototype;
|
|
1343
1021
|
members.map(([memberName, [memberFlags]]) => {
|
|
1344
|
-
if (
|
|
1022
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
1023
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1345
1024
|
// proxyComponent - prop
|
|
1346
1025
|
Object.defineProperty(prototype, memberName, {
|
|
1347
1026
|
get() {
|
|
@@ -1357,11 +1036,56 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1357
1036
|
});
|
|
1358
1037
|
}
|
|
1359
1038
|
});
|
|
1360
|
-
if (
|
|
1039
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1361
1040
|
const attrNameToPropName = new Map();
|
|
1362
1041
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1363
1042
|
plt.jmp(() => {
|
|
1364
1043
|
const propName = attrNameToPropName.get(attrName);
|
|
1044
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
1045
|
+
// in the case where an attribute was set inline.
|
|
1046
|
+
// ```html
|
|
1047
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
1048
|
+
// ```
|
|
1049
|
+
//
|
|
1050
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
1051
|
+
// programmatically changes it before it has been upgraded as shown below:
|
|
1052
|
+
//
|
|
1053
|
+
// ```html
|
|
1054
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
1055
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1056
|
+
// <script>
|
|
1057
|
+
// // grab non-upgraded component
|
|
1058
|
+
// el = document.querySelector("#test");
|
|
1059
|
+
// el.someAttribute = "another-value";
|
|
1060
|
+
// // upgrade component
|
|
1061
|
+
// customElements.define('my-component', MyComponent);
|
|
1062
|
+
// </script>
|
|
1063
|
+
// ```
|
|
1064
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1065
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1066
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1067
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
|
|
1068
|
+
//
|
|
1069
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1070
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1071
|
+
//
|
|
1072
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1073
|
+
//
|
|
1074
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1075
|
+
// properties here given that this goes against best practices outlined here
|
|
1076
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1077
|
+
if (this.hasOwnProperty(propName)) {
|
|
1078
|
+
newValue = this[propName];
|
|
1079
|
+
delete this[propName];
|
|
1080
|
+
}
|
|
1081
|
+
else if (prototype.hasOwnProperty(propName) &&
|
|
1082
|
+
typeof this[propName] === 'number' &&
|
|
1083
|
+
this[propName] == newValue) {
|
|
1084
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
|
1085
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
|
1086
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1365
1089
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1366
1090
|
});
|
|
1367
1091
|
};
|
|
@@ -1372,7 +1096,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1372
1096
|
.map(([propName, m]) => {
|
|
1373
1097
|
const attrName = m[1] || propName;
|
|
1374
1098
|
attrNameToPropName.set(attrName, propName);
|
|
1375
|
-
if (
|
|
1099
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
1376
1100
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1377
1101
|
}
|
|
1378
1102
|
return attrName;
|
|
@@ -1383,7 +1107,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1383
1107
|
};
|
|
1384
1108
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1385
1109
|
// initializeComponent
|
|
1386
|
-
if (
|
|
1110
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1387
1111
|
{
|
|
1388
1112
|
// we haven't initialized this element yet
|
|
1389
1113
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1397,8 +1121,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1397
1121
|
Cstr = await Cstr;
|
|
1398
1122
|
endLoad();
|
|
1399
1123
|
}
|
|
1400
|
-
if (
|
|
1401
|
-
// we'
|
|
1124
|
+
if (!Cstr.isProxied) {
|
|
1125
|
+
// we've never proxied this Constructor before
|
|
1402
1126
|
// let's add the getters/setters to its prototype before
|
|
1403
1127
|
// the first time we create an instance of the implementation
|
|
1404
1128
|
{
|
|
@@ -1432,15 +1156,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1432
1156
|
}
|
|
1433
1157
|
endNewInstance();
|
|
1434
1158
|
}
|
|
1435
|
-
if (
|
|
1159
|
+
if (Cstr.style) {
|
|
1436
1160
|
// this component has styles but we haven't registered them yet
|
|
1437
1161
|
let style = Cstr.style;
|
|
1438
1162
|
const scopeId = getScopeId(cmpMeta);
|
|
1439
1163
|
if (!styles.has(scopeId)) {
|
|
1440
1164
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1441
|
-
if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1442
|
-
style = await Promise.resolve().then(function () { return require('./shadow-css-376763e9.js'); }).then(m => m.scopeCss(style, scopeId, false));
|
|
1443
|
-
}
|
|
1444
1165
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1445
1166
|
endRegisterStyles();
|
|
1446
1167
|
}
|
|
@@ -1449,8 +1170,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1449
1170
|
// we've successfully created a lazy instance
|
|
1450
1171
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1451
1172
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1452
|
-
if (
|
|
1453
|
-
// this is the
|
|
1173
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1174
|
+
// this is the initial load and this component it has an ancestor component
|
|
1454
1175
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1455
1176
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
1456
1177
|
// this will get fired off when the ancestor component
|
|
@@ -1470,15 +1191,6 @@ const connectedCallback = (elm) => {
|
|
|
1470
1191
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1471
1192
|
// first time this component has connected
|
|
1472
1193
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1473
|
-
{
|
|
1474
|
-
// initUpdate
|
|
1475
|
-
// if the slot polyfill is required we'll need to put some nodes
|
|
1476
|
-
// in here to act as original content anchors as we move nodes around
|
|
1477
|
-
// host element has been connected to the DOM
|
|
1478
|
-
if ( ( cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1479
|
-
setContentReference(elm);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
1194
|
{
|
|
1483
1195
|
// find the first ancestor component (if there is one) and register
|
|
1484
1196
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1486,8 +1198,7 @@ const connectedCallback = (elm) => {
|
|
|
1486
1198
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1487
1199
|
// climb up the ancestors looking for the first
|
|
1488
1200
|
// component that hasn't finished its lifecycle update yet
|
|
1489
|
-
if (
|
|
1490
|
-
ancestorComponent['s-p']) {
|
|
1201
|
+
if (ancestorComponent['s-p']) {
|
|
1491
1202
|
// we found this components first ancestor component
|
|
1492
1203
|
// keep a reference to this component's ancestor component
|
|
1493
1204
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1497,7 +1208,7 @@ const connectedCallback = (elm) => {
|
|
|
1497
1208
|
}
|
|
1498
1209
|
// Lazy properties
|
|
1499
1210
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1500
|
-
if (
|
|
1211
|
+
if (cmpMeta.$members$) {
|
|
1501
1212
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1502
1213
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1503
1214
|
const value = elm[memberName];
|
|
@@ -1523,30 +1234,15 @@ const connectedCallback = (elm) => {
|
|
|
1523
1234
|
endConnected();
|
|
1524
1235
|
}
|
|
1525
1236
|
};
|
|
1526
|
-
const setContentReference = (elm) => {
|
|
1527
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
1528
|
-
// or this browser doesn't support native shadow dom
|
|
1529
|
-
// and this host element was NOT created with SSR
|
|
1530
|
-
// let's pick out the inner content for slot projection
|
|
1531
|
-
// create a node to represent where the original
|
|
1532
|
-
// content was first placed, which is useful later on
|
|
1533
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment( ''));
|
|
1534
|
-
contentRefElm['s-cn'] = true;
|
|
1535
|
-
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1536
|
-
};
|
|
1537
1237
|
const disconnectedCallback = (elm) => {
|
|
1538
1238
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1539
1239
|
const hostRef = getHostRef(elm);
|
|
1540
1240
|
{
|
|
1541
1241
|
if (hostRef.$rmListeners$) {
|
|
1542
|
-
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1242
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1543
1243
|
hostRef.$rmListeners$ = undefined;
|
|
1544
1244
|
}
|
|
1545
1245
|
}
|
|
1546
|
-
// clear CSS var-shim tracking
|
|
1547
|
-
if ( plt.$cssShim$) {
|
|
1548
|
-
plt.$cssShim$.removeHost(elm);
|
|
1549
|
-
}
|
|
1550
1246
|
}
|
|
1551
1247
|
};
|
|
1552
1248
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
@@ -1562,85 +1258,73 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1562
1258
|
let isBootstrapping = true;
|
|
1563
1259
|
Object.assign(plt, options);
|
|
1564
1260
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1565
|
-
{
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
self = this;
|
|
1599
|
-
registerHost(self, cmpMeta);
|
|
1600
|
-
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1601
|
-
// this component is using shadow dom
|
|
1602
|
-
// and this browser supports shadow dom
|
|
1603
|
-
// add the read-only property "shadowRoot" to the host element
|
|
1604
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
1605
|
-
if (supportsShadow) {
|
|
1261
|
+
lazyBundles.map((lazyBundle) => {
|
|
1262
|
+
lazyBundle[1].map((compactMeta) => {
|
|
1263
|
+
const cmpMeta = {
|
|
1264
|
+
$flags$: compactMeta[0],
|
|
1265
|
+
$tagName$: compactMeta[1],
|
|
1266
|
+
$members$: compactMeta[2],
|
|
1267
|
+
$listeners$: compactMeta[3],
|
|
1268
|
+
};
|
|
1269
|
+
{
|
|
1270
|
+
cmpMeta.$members$ = compactMeta[2];
|
|
1271
|
+
}
|
|
1272
|
+
{
|
|
1273
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1274
|
+
}
|
|
1275
|
+
{
|
|
1276
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1277
|
+
}
|
|
1278
|
+
{
|
|
1279
|
+
cmpMeta.$watchers$ = {};
|
|
1280
|
+
}
|
|
1281
|
+
const tagName = cmpMeta.$tagName$;
|
|
1282
|
+
const HostElement = class extends HTMLElement {
|
|
1283
|
+
// StencilLazyHost
|
|
1284
|
+
constructor(self) {
|
|
1285
|
+
// @ts-ignore
|
|
1286
|
+
super(self);
|
|
1287
|
+
self = this;
|
|
1288
|
+
registerHost(self, cmpMeta);
|
|
1289
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1290
|
+
// this component is using shadow dom
|
|
1291
|
+
// and this browser supports shadow dom
|
|
1292
|
+
// add the read-only property "shadowRoot" to the host element
|
|
1293
|
+
// adding the shadow root build conditionals to minimize runtime
|
|
1606
1294
|
{
|
|
1607
|
-
|
|
1295
|
+
{
|
|
1296
|
+
self.attachShadow({ mode: 'open' });
|
|
1297
|
+
}
|
|
1608
1298
|
}
|
|
1609
1299
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1300
|
+
}
|
|
1301
|
+
connectedCallback() {
|
|
1302
|
+
if (appLoadFallback) {
|
|
1303
|
+
clearTimeout(appLoadFallback);
|
|
1304
|
+
appLoadFallback = null;
|
|
1305
|
+
}
|
|
1306
|
+
if (isBootstrapping) {
|
|
1307
|
+
// connectedCallback will be processed once all components have been registered
|
|
1308
|
+
deferredConnectedCallbacks.push(this);
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
plt.jmp(() => connectedCallback(this));
|
|
1612
1312
|
}
|
|
1613
1313
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
if (appLoadFallback) {
|
|
1617
|
-
clearTimeout(appLoadFallback);
|
|
1618
|
-
appLoadFallback = null;
|
|
1314
|
+
disconnectedCallback() {
|
|
1315
|
+
plt.jmp(() => disconnectedCallback(this));
|
|
1619
1316
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
deferredConnectedCallbacks.push(this);
|
|
1317
|
+
componentOnReady() {
|
|
1318
|
+
return getHostRef(this).$onReadyPromise$;
|
|
1623
1319
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
plt.jmp(() => disconnectedCallback(this));
|
|
1630
|
-
}
|
|
1631
|
-
forceUpdate() {
|
|
1632
|
-
forceUpdate(this);
|
|
1633
|
-
}
|
|
1634
|
-
componentOnReady() {
|
|
1635
|
-
return getHostRef(this).$onReadyPromise$;
|
|
1320
|
+
};
|
|
1321
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1322
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1323
|
+
cmpTags.push(tagName);
|
|
1324
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1636
1325
|
}
|
|
1637
|
-
};
|
|
1638
|
-
|
|
1639
|
-
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1640
|
-
cmpTags.push(tagName);
|
|
1641
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1642
|
-
}
|
|
1643
|
-
}));
|
|
1326
|
+
});
|
|
1327
|
+
});
|
|
1644
1328
|
{
|
|
1645
1329
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1646
1330
|
visibilityStyle.setAttribute('data-styles', '');
|
|
@@ -1649,7 +1333,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1649
1333
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1650
1334
|
isBootstrapping = false;
|
|
1651
1335
|
if (deferredConnectedCallbacks.length) {
|
|
1652
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1336
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1653
1337
|
}
|
|
1654
1338
|
else {
|
|
1655
1339
|
{
|
|
@@ -1670,7 +1354,7 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1670
1354
|
$instanceValues$: new Map(),
|
|
1671
1355
|
};
|
|
1672
1356
|
{
|
|
1673
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1357
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1674
1358
|
elm['s-p'] = [];
|
|
1675
1359
|
elm['s-rc'] = [];
|
|
1676
1360
|
}
|
|
@@ -1678,21 +1362,23 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1678
1362
|
return hostRefs.set(elm, hostRef);
|
|
1679
1363
|
};
|
|
1680
1364
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1681
|
-
const consoleError = (e) => console.error(e);
|
|
1365
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1682
1366
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1683
1367
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1684
1368
|
// loadModuleImport
|
|
1685
1369
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1686
1370
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1687
|
-
const module =
|
|
1371
|
+
const module = cmpModules.get(bundleId) ;
|
|
1688
1372
|
if (module) {
|
|
1689
1373
|
return module[exportName];
|
|
1690
1374
|
}
|
|
1691
|
-
|
|
1375
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1376
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1377
|
+
/* @vite-ignore */
|
|
1692
1378
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1693
1379
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1694
1380
|
/* webpackMode: "lazy" */
|
|
1695
|
-
`./${bundleId}.entry.js${
|
|
1381
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1696
1382
|
{
|
|
1697
1383
|
cmpModules.set(bundleId, importedModule);
|
|
1698
1384
|
}
|
|
@@ -1702,7 +1388,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1702
1388
|
const styles = new Map();
|
|
1703
1389
|
const queueDomReads = [];
|
|
1704
1390
|
const queueDomWrites = [];
|
|
1705
|
-
const queueDomWritesLow = [];
|
|
1706
1391
|
const queueTask = (queue, write) => (cb) => {
|
|
1707
1392
|
queue.push(cb);
|
|
1708
1393
|
if (!queuePending) {
|
|
@@ -1726,55 +1411,24 @@ const consume = (queue) => {
|
|
|
1726
1411
|
}
|
|
1727
1412
|
queue.length = 0;
|
|
1728
1413
|
};
|
|
1729
|
-
const consumeTimeout = (queue, timeout) => {
|
|
1730
|
-
let i = 0;
|
|
1731
|
-
let ts = 0;
|
|
1732
|
-
while (i < queue.length && (ts = performance.now()) < timeout) {
|
|
1733
|
-
try {
|
|
1734
|
-
queue[i++](ts);
|
|
1735
|
-
}
|
|
1736
|
-
catch (e) {
|
|
1737
|
-
consoleError(e);
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
if (i === queue.length) {
|
|
1741
|
-
queue.length = 0;
|
|
1742
|
-
}
|
|
1743
|
-
else if (i !== 0) {
|
|
1744
|
-
queue.splice(0, i);
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
1414
|
const flush = () => {
|
|
1748
|
-
{
|
|
1749
|
-
queueCongestion++;
|
|
1750
|
-
}
|
|
1751
1415
|
// always force a bunch of medium callbacks to run, but still have
|
|
1752
1416
|
// a throttle on how many can run in a certain time
|
|
1753
1417
|
// DOM READS!!!
|
|
1754
1418
|
consume(queueDomReads);
|
|
1755
1419
|
// DOM WRITES!!!
|
|
1756
1420
|
{
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
consumeTimeout(queueDomWritesLow, timeout);
|
|
1760
|
-
if (queueDomWrites.length > 0) {
|
|
1761
|
-
queueDomWritesLow.push(...queueDomWrites);
|
|
1762
|
-
queueDomWrites.length = 0;
|
|
1763
|
-
}
|
|
1764
|
-
if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
|
|
1421
|
+
consume(queueDomWrites);
|
|
1422
|
+
if ((queuePending = queueDomReads.length > 0)) {
|
|
1765
1423
|
// still more to do yet, but we've run out of time
|
|
1766
1424
|
// let's let this thing cool off and try again in the next tick
|
|
1767
1425
|
plt.raf(flush);
|
|
1768
1426
|
}
|
|
1769
|
-
else {
|
|
1770
|
-
queueCongestion = 0;
|
|
1771
|
-
}
|
|
1772
1427
|
}
|
|
1773
1428
|
};
|
|
1774
1429
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1775
1430
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1776
1431
|
|
|
1777
|
-
exports.CSS = CSS;
|
|
1778
1432
|
exports.Host = Host;
|
|
1779
1433
|
exports.NAMESPACE = NAMESPACE;
|
|
1780
1434
|
exports.bootstrapLazy = bootstrapLazy;
|
|
@@ -1782,7 +1436,6 @@ exports.createEvent = createEvent;
|
|
|
1782
1436
|
exports.doc = doc;
|
|
1783
1437
|
exports.getElement = getElement;
|
|
1784
1438
|
exports.h = h;
|
|
1785
|
-
exports.plt = plt;
|
|
1786
1439
|
exports.promiseResolve = promiseResolve;
|
|
1787
1440
|
exports.registerInstance = registerInstance;
|
|
1788
1441
|
exports.win = win;
|