@aiconomy/aico-components 0.0.14 → 0.0.57
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 +67 -57
- package/dist/aico-components/aico-components.css +6 -0
- package/dist/aico-components/aico-components.esm.js +1 -1
- package/dist/aico-components/aico-components.esm.js.map +1 -1
- package/dist/aico-components/assets/slick/ajax-loader.gif +0 -0
- package/dist/aico-components/assets/slick/slick.eot +0 -0
- package/dist/aico-components/assets/slick/slick.svg +14 -0
- package/dist/aico-components/assets/slick/slick.ttf +0 -0
- package/dist/aico-components/assets/slick/slick.woff +0 -0
- package/dist/aico-components/p-0ca1f065.entry.js +2 -0
- package/dist/aico-components/p-0ca1f065.entry.js.map +1 -0
- package/dist/aico-components/p-1c4a07ef.entry.js +7 -0
- package/dist/aico-components/p-1c4a07ef.entry.js.map +1 -0
- package/dist/aico-components/p-406fa2e5.entry.js +2 -0
- package/dist/aico-components/p-406fa2e5.entry.js.map +1 -0
- package/dist/aico-components/p-4c0f3325.entry.js +2 -0
- package/dist/aico-components/p-4c0f3325.entry.js.map +1 -0
- package/dist/aico-components/p-5109399b.entry.js +2 -0
- package/dist/aico-components/p-5109399b.entry.js.map +1 -0
- package/dist/aico-components/p-6464810e.entry.js +2 -0
- package/dist/aico-components/p-6464810e.entry.js.map +1 -0
- package/dist/aico-components/p-68930822.entry.js +2 -0
- package/dist/aico-components/p-68930822.entry.js.map +1 -0
- package/dist/aico-components/p-86c7fdc7.js +13 -0
- package/dist/aico-components/p-86c7fdc7.js.map +1 -0
- package/dist/aico-components/p-90c2d3dc.entry.js +2 -0
- package/dist/aico-components/p-90c2d3dc.entry.js.map +1 -0
- package/dist/aico-components/p-ae20e789.js +3 -0
- package/dist/aico-components/p-ae20e789.js.map +1 -0
- package/dist/aico-components/p-b1f8308f.entry.js +2 -0
- package/dist/aico-components/p-b1f8308f.entry.js.map +1 -0
- package/dist/aico-components/p-dfd3b0d3.js +2 -0
- package/dist/aico-components/p-dfd3b0d3.js.map +1 -0
- package/dist/cjs/aico-album-content_19.cjs.entry.js +6904 -0
- package/dist/cjs/aico-album-content_19.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-article-detail.cjs.entry.js +124 -0
- package/dist/cjs/aico-article-detail.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-asking-list-content.cjs.entry.js +21 -0
- package/dist/cjs/aico-asking-list-content.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-collection-content.cjs.entry.js +21 -0
- package/dist/cjs/aico-collection-content.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-components.cjs.js +2 -2
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js +44 -0
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-news-list-item.cjs.entry.js +27 -0
- package/dist/cjs/aico-news-list-item.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-news-list.cjs.entry.js +92 -0
- package/dist/cjs/aico-news-list.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-no-content_2.cjs.entry.js +49 -0
- package/dist/cjs/aico-no-content_2.cjs.entry.js.map +1 -0
- package/dist/cjs/aico-special-news-carousel.cjs.entry.js +60 -0
- package/dist/cjs/aico-special-news-carousel.cjs.entry.js.map +1 -0
- package/dist/cjs/{index-222c33f1.js → index-e52034b7.js} +864 -28
- package/dist/cjs/index-e52034b7.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/slick-d0dfbd94.js +13662 -0
- package/dist/cjs/slick-d0dfbd94.js.map +1 -0
- package/dist/cjs/utils-095ed22b.js +101 -0
- package/dist/cjs/utils-095ed22b.js.map +1 -0
- package/dist/collection/assets/slick/ajax-loader.gif +0 -0
- package/dist/collection/assets/slick/slick.eot +0 -0
- package/dist/collection/assets/slick/slick.svg +14 -0
- package/dist/collection/assets/slick/slick.ttf +0 -0
- package/dist/collection/assets/slick/slick.woff +0 -0
- package/dist/collection/collection-manifest.json +28 -1
- package/dist/collection/components/aico-article-detail/aico-article-detail.css +0 -0
- package/dist/collection/components/aico-article-detail/aico-article-detail.js +117 -0
- package/dist/collection/components/aico-article-detail/aico-article-detail.js.map +1 -0
- package/dist/collection/components/aico-article-detail/test/aico-article-detail.e2e.js +6 -0
- package/dist/collection/components/aico-article-detail/test/aico-article-detail.e2e.js.map +1 -0
- package/dist/collection/components/aico-article-detail/test/aico-article-detail.spec.js +6 -0
- package/dist/collection/components/aico-article-detail/test/aico-article-detail.spec.js.map +1 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.css +0 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js +121 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map +1 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.js +25 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.js.map +1 -0
- package/dist/collection/components/aico-fetch-article-detail/test/aico-fetch-article-detail.e2e.js +6 -0
- package/dist/collection/components/aico-fetch-article-detail/test/aico-fetch-article-detail.e2e.js.map +1 -0
- package/dist/collection/components/aico-fetch-article-detail/test/aico-fetch-article-detail.spec.js +6 -0
- package/dist/collection/components/aico-fetch-article-detail/test/aico-fetch-article-detail.spec.js.map +1 -0
- package/dist/collection/components/aico-news-list/aico-news-list.css +0 -0
- package/dist/collection/components/aico-news-list/aico-news-list.js +195 -0
- package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -0
- package/dist/collection/components/aico-news-list/aico-news-list.stories.js +24 -0
- package/dist/collection/components/aico-news-list/aico-news-list.stories.js.map +1 -0
- package/dist/collection/components/aico-news-list/test/aico-news-list.e2e.js +6 -0
- package/dist/collection/components/aico-news-list/test/aico-news-list.e2e.js.map +1 -0
- package/dist/collection/components/aico-news-list/test/aico-news-list.spec.js +6 -0
- package/dist/collection/components/aico-news-list/test/aico-news-list.spec.js.map +1 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.css +0 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js +75 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js.map +1 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.stories.js +61 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.stories.js.map +1 -0
- package/dist/collection/components/aico-news-list-item/test/aico-news-list-item.e2e.js +6 -0
- package/dist/collection/components/aico-news-list-item/test/aico-news-list-item.e2e.js.map +1 -0
- package/dist/collection/components/aico-news-list-item/test/aico-news-list-item.spec.js +6 -0
- package/dist/collection/components/aico-news-list-item/test/aico-news-list-item.spec.js.map +1 -0
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.css +3 -0
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js +145 -0
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -0
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.stories.js +30 -0
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.stories.js.map +1 -0
- package/dist/collection/components/aico-special-news-carousel/test/aico-special-news-carousel.e2e.js +6 -0
- package/dist/collection/components/aico-special-news-carousel/test/aico-special-news-carousel.e2e.js.map +1 -0
- package/dist/collection/components/aico-special-news-carousel/test/aico-special-news-carousel.spec.js +6 -0
- package/dist/collection/components/aico-special-news-carousel/test/aico-special-news-carousel.spec.js.map +1 -0
- package/dist/collection/components/content/aico-album-content/aico-album-content.css +0 -0
- package/dist/collection/components/content/aico-album-content/aico-album-content.js +104 -0
- package/dist/collection/components/content/aico-album-content/aico-album-content.js.map +1 -0
- package/dist/collection/components/content/aico-album-content/aico-album-content.stories.js +70 -0
- package/dist/collection/components/content/aico-album-content/aico-album-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-asking-content/aico-asking-content.css +63 -0
- package/dist/collection/components/content/aico-asking-content/aico-asking-content.js +49 -0
- package/dist/collection/components/content/aico-asking-content/aico-asking-content.js.map +1 -0
- package/dist/collection/components/content/aico-asking-content/aico-asking-content.stories.js +37 -0
- package/dist/collection/components/content/aico-asking-content/aico-asking-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-asking-list-content/aico-asking-list-content.css +85 -0
- package/dist/collection/components/content/aico-asking-list-content/aico-asking-list-content.js +19 -0
- package/dist/collection/components/content/aico-asking-list-content/aico-asking-list-content.js.map +1 -0
- package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.css +0 -0
- package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.js +49 -0
- package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.js.map +1 -0
- package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.stories.js +26 -0
- package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.css +0 -0
- package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.js +79 -0
- package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.js.map +1 -0
- package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.stories.js +71 -0
- package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.css +1 -0
- package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.js +95 -0
- package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.js.map +1 -0
- package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.stories.js +73 -0
- package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-collection-content/aico-collection-content.js +19 -0
- package/dist/collection/components/content/aico-collection-content/aico-collection-content.js.map +1 -0
- package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.css +0 -0
- package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.js +62 -0
- package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.js.map +1 -0
- package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.stories.js +26 -0
- package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-divider-content/aico-divider-content.css +0 -0
- package/dist/collection/components/content/aico-divider-content/aico-divider-content.js +49 -0
- package/dist/collection/components/content/aico-divider-content/aico-divider-content.js.map +1 -0
- package/dist/collection/components/content/aico-divider-content/aico-divider-content.stories.js +23 -0
- package/dist/collection/components/content/aico-divider-content/aico-divider-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-document-content/aico-document-content.css +8 -0
- package/dist/collection/components/content/aico-document-content/aico-document-content.js +73 -0
- package/dist/collection/components/content/aico-document-content/aico-document-content.js.map +1 -0
- package/dist/collection/components/content/aico-document-content/aico-document-content.stories.js +30 -0
- package/dist/collection/components/content/aico-document-content/aico-document-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-faq-content/aico-faq-content.css +0 -0
- package/dist/collection/components/content/aico-faq-content/aico-faq-content.js +54 -0
- package/dist/collection/components/content/aico-faq-content/aico-faq-content.js.map +1 -0
- package/dist/collection/components/content/aico-faq-content/aico-faq-content.stories.js +60 -0
- package/dist/collection/components/content/aico-faq-content/aico-faq-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-heading-content/aico-heading-content.css +36 -0
- package/dist/collection/components/content/aico-heading-content/aico-heading-content.js +81 -0
- package/dist/collection/components/content/aico-heading-content/aico-heading-content.js.map +1 -0
- package/dist/collection/components/content/aico-heading-content/aico-heading-content.stories.js +31 -0
- package/dist/collection/components/content/aico-heading-content/aico-heading-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-html-content/aico-html-content.css +3 -0
- package/dist/collection/components/content/aico-html-content/aico-html-content.js +52 -0
- package/dist/collection/components/content/aico-html-content/aico-html-content.js.map +1 -0
- package/dist/collection/components/content/aico-link-content/aico-link-content.css +37 -0
- package/dist/collection/components/content/aico-link-content/aico-link-content.js +68 -0
- package/dist/collection/components/content/aico-link-content/aico-link-content.js.map +1 -0
- package/dist/collection/components/content/aico-link-content/aico-link-content.stories.js +59 -0
- package/dist/collection/components/content/aico-link-content/aico-link-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-news-content/aico-news-content.css +11 -0
- package/dist/collection/components/content/aico-news-content/aico-news-content.js +79 -0
- package/dist/collection/components/content/aico-news-content/aico-news-content.js.map +1 -0
- package/dist/collection/components/content/aico-news-content/aico-news-content.stories.js +43 -0
- package/dist/collection/components/content/aico-news-content/aico-news-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-no-content/aico-no-content.css +3 -0
- package/dist/collection/components/content/aico-no-content/aico-no-content.js +19 -0
- package/dist/collection/components/content/aico-no-content/aico-no-content.js.map +1 -0
- package/dist/collection/components/content/aico-page-content/aico-page-content.css +3 -0
- package/dist/collection/components/content/aico-page-content/aico-page-content.js +79 -0
- package/dist/collection/components/content/aico-page-content/aico-page-content.js.map +1 -0
- package/dist/collection/components/content/aico-page-content/aico-page-content.stories.js +37 -0
- package/dist/collection/components/content/aico-page-content/aico-page-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-table-content/aico-table-content.css +21 -0
- package/dist/collection/components/content/aico-table-content/aico-table-content.js +73 -0
- package/dist/collection/components/content/aico-table-content/aico-table-content.js.map +1 -0
- package/dist/collection/components/content/aico-table-content/aico-table-content.stories.js +130 -0
- package/dist/collection/components/content/aico-table-content/aico-table-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-testimonial-content/aico-testimonial-content.css +93 -0
- package/dist/collection/components/content/aico-testimonial-content/aico-testimonial-content.js +51 -0
- package/dist/collection/components/content/aico-testimonial-content/aico-testimonial-content.js.map +1 -0
- package/dist/collection/components/content/aico-testimonial-content/aico-testimonial-content.stories.js +23 -0
- package/dist/collection/components/content/aico-testimonial-content/aico-testimonial-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-text-content/aico-text-content.css +0 -0
- package/dist/collection/components/content/aico-text-content/aico-text-content.js +127 -0
- package/dist/collection/components/content/aico-text-content/aico-text-content.js.map +1 -0
- package/dist/collection/components/content/aico-text-content/aico-text-content.stories.js +173 -0
- package/dist/collection/components/content/aico-text-content/aico-text-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-title-content/aico-title-content.css +3 -0
- package/dist/collection/components/content/aico-title-content/aico-title-content.js +61 -0
- package/dist/collection/components/content/aico-title-content/aico-title-content.js.map +1 -0
- package/dist/collection/components/content/aico-title-content/aico-title-content.stories.js +28 -0
- package/dist/collection/components/content/aico-title-content/aico-title-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-upload-content/aico-upload-content.css +3 -0
- package/dist/collection/components/content/aico-upload-content/aico-upload-content.js +66 -0
- package/dist/collection/components/content/aico-upload-content/aico-upload-content.js.map +1 -0
- package/dist/collection/components/content/aico-upload-content/aico-upload-content.stories.js +39 -0
- package/dist/collection/components/content/aico-upload-content/aico-upload-content.stories.js.map +1 -0
- package/dist/collection/components/content/aico-video-content/aico-video-content.css +10 -0
- package/dist/collection/components/content/aico-video-content/aico-video-content.js +62 -0
- package/dist/collection/components/content/aico-video-content/aico-video-content.js.map +1 -0
- package/dist/collection/components/content/aico-video-content/aico-video-content.stories.js +43 -0
- package/dist/collection/components/content/aico-video-content/aico-video-content.stories.js.map +1 -0
- package/dist/collection/model/AicoApiRequestInfo.js +13 -0
- package/dist/collection/model/AicoApiRequestInfo.js.map +1 -0
- package/dist/collection/model/Article.js +2 -0
- package/dist/collection/model/Article.js.map +1 -0
- package/dist/collection/model/Entity.js +7 -0
- package/dist/collection/model/Entity.js.map +1 -0
- package/dist/collection/model/NewsCategory.js +2 -0
- package/dist/collection/model/NewsCategory.js.map +1 -0
- package/dist/collection/model/NewsResponse.js +2 -0
- package/dist/collection/model/NewsResponse.js.map +1 -0
- package/dist/collection/model/article/ContentType.js +33 -0
- package/dist/collection/model/article/ContentType.js.map +1 -0
- package/dist/collection/model/article/Translation.js +8 -0
- package/dist/collection/model/article/Translation.js.map +1 -0
- package/dist/collection/model/article/content/AlbumContent.js +2 -0
- package/dist/collection/model/article/content/AlbumContent.js.map +1 -0
- package/dist/collection/model/article/content/AskingContent.js +21 -0
- package/dist/collection/model/article/content/AskingContent.js.map +1 -0
- package/dist/collection/model/article/content/AskingListContent.js +7 -0
- package/dist/collection/model/article/content/AskingListContent.js.map +1 -0
- package/dist/collection/model/article/content/BlockQuoteContent.js +2 -0
- package/dist/collection/model/article/content/BlockQuoteContent.js.map +1 -0
- package/dist/collection/model/article/content/BulletContent.js +2 -0
- package/dist/collection/model/article/content/BulletContent.js.map +1 -0
- package/dist/collection/model/article/content/CardContent.js +2 -0
- package/dist/collection/model/article/content/CardContent.js.map +1 -0
- package/dist/collection/model/article/content/CarouselContent.js +2 -0
- package/dist/collection/model/article/content/CarouselContent.js.map +1 -0
- package/dist/collection/model/article/content/CollectionContent.js +52 -0
- package/dist/collection/model/article/content/CollectionContent.js.map +1 -0
- package/dist/collection/model/article/content/DividerContent.js +2 -0
- package/dist/collection/model/article/content/DividerContent.js.map +1 -0
- package/dist/collection/model/article/content/DocumentContent.js +2 -0
- package/dist/collection/model/article/content/DocumentContent.js.map +1 -0
- package/dist/collection/model/article/content/FaqContent.js +12 -0
- package/dist/collection/model/article/content/FaqContent.js.map +1 -0
- package/dist/collection/model/article/content/HeadingContent.js +2 -0
- package/dist/collection/model/article/content/HeadingContent.js.map +1 -0
- package/dist/collection/model/article/content/HtmlContent.js +2 -0
- package/dist/collection/model/article/content/HtmlContent.js.map +1 -0
- package/dist/collection/model/article/content/LinkContent.js +2 -0
- package/dist/collection/model/article/content/LinkContent.js.map +1 -0
- package/dist/collection/model/article/content/NewsContent.js +19 -0
- package/dist/collection/model/article/content/NewsContent.js.map +1 -0
- package/dist/collection/model/article/content/PageContent.js +37 -0
- package/dist/collection/model/article/content/PageContent.js.map +1 -0
- package/dist/collection/model/article/content/TableContet.js +2 -0
- package/dist/collection/model/article/content/TableContet.js.map +1 -0
- package/dist/collection/model/article/content/TestimonialContent.js +2 -0
- package/dist/collection/model/article/content/TestimonialContent.js.map +1 -0
- package/dist/collection/model/article/content/TextContent.js +2 -0
- package/dist/collection/model/article/content/TextContent.js.map +1 -0
- package/dist/collection/model/article/content/TitleContent.js +2 -0
- package/dist/collection/model/article/content/TitleContent.js.map +1 -0
- package/dist/collection/model/article/content/UploadContent.js +13 -0
- package/dist/collection/model/article/content/UploadContent.js.map +1 -0
- package/dist/collection/model/article/content/VideoContent.js +2 -0
- package/dist/collection/model/article/content/VideoContent.js.map +1 -0
- package/dist/collection/model/article/content/news/NewsAlbum.js +20 -0
- package/dist/collection/model/article/content/news/NewsAlbum.js.map +1 -0
- package/dist/collection/model/article/content/news/NewsArticle.js +43 -0
- package/dist/collection/model/article/content/news/NewsArticle.js.map +1 -0
- package/dist/collection/model/article/content/news/NewsCategory.js +17 -0
- package/dist/collection/model/article/content/news/NewsCategory.js.map +1 -0
- package/dist/collection/model/article/content/news/NewsTag.js +10 -0
- package/dist/collection/model/article/content/news/NewsTag.js.map +1 -0
- package/dist/collection/utils/ConditionalRender.js +5 -0
- package/dist/collection/utils/ConditionalRender.js.map +1 -0
- package/dist/collection/utils/ConditionalWrap.js +5 -0
- package/dist/collection/utils/ConditionalWrap.js.map +1 -0
- package/dist/collection/utils/utils.js +83 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/collection/utils/utils.spec.js +4 -14
- package/dist/collection/utils/utils.spec.js.map +1 -1
- package/dist/components/ConditionalRender.js +7 -0
- package/dist/components/ConditionalRender.js.map +1 -0
- package/dist/components/aico-album-content.d.ts +11 -0
- package/dist/components/aico-album-content.js +8 -0
- package/dist/components/aico-album-content.js.map +1 -0
- package/dist/components/aico-album-content2.js +90 -0
- package/dist/components/aico-album-content2.js.map +1 -0
- package/dist/components/aico-article-detail.d.ts +11 -0
- package/dist/components/aico-article-detail.js +8 -0
- package/dist/components/aico-article-detail.js.map +1 -0
- package/dist/components/aico-article-detail2.js +262 -0
- package/dist/components/aico-article-detail2.js.map +1 -0
- package/dist/components/aico-asking-content.d.ts +11 -0
- package/dist/components/aico-asking-content.js +8 -0
- package/dist/components/aico-asking-content.js.map +1 -0
- package/dist/components/aico-asking-content2.js +36 -0
- package/dist/components/aico-asking-content2.js.map +1 -0
- package/dist/components/aico-asking-list-content.d.ts +11 -0
- package/dist/components/aico-asking-list-content.js +34 -0
- package/dist/components/aico-asking-list-content.js.map +1 -0
- package/dist/components/aico-block-quote-content.d.ts +11 -0
- package/dist/components/aico-block-quote-content.js +8 -0
- package/dist/components/aico-block-quote-content.js.map +1 -0
- package/dist/components/aico-block-quote-content2.js +36 -0
- package/dist/components/aico-block-quote-content2.js.map +1 -0
- package/dist/components/aico-bullet-content.d.ts +11 -0
- package/dist/components/aico-bullet-content.js +8 -0
- package/dist/components/aico-bullet-content.js.map +1 -0
- package/dist/components/aico-bullet-content2.js +78 -0
- package/dist/components/aico-bullet-content2.js.map +1 -0
- package/dist/components/aico-carousel-content.d.ts +11 -0
- package/dist/components/aico-carousel-content.js +8 -0
- package/dist/components/aico-carousel-content.js.map +1 -0
- package/dist/components/aico-carousel-content2.js +76 -0
- package/dist/components/aico-carousel-content2.js.map +1 -0
- package/dist/components/aico-collection-content.d.ts +11 -0
- package/dist/components/aico-collection-content.js +34 -0
- package/dist/components/aico-collection-content.js.map +1 -0
- package/dist/components/aico-content-card-content.d.ts +11 -0
- package/dist/components/aico-content-card-content.js +8 -0
- package/dist/components/aico-content-card-content.js.map +1 -0
- package/dist/components/aico-content-card-content2.js +61 -0
- package/dist/components/aico-content-card-content2.js.map +1 -0
- package/dist/components/aico-divider-content.d.ts +11 -0
- package/dist/components/aico-divider-content.js +8 -0
- package/dist/components/aico-divider-content.js.map +1 -0
- package/dist/components/aico-divider-content2.js +36 -0
- package/dist/components/aico-divider-content2.js.map +1 -0
- package/dist/components/aico-document-content.d.ts +11 -0
- package/dist/components/aico-document-content.js +8 -0
- package/dist/components/aico-document-content.js.map +1 -0
- package/dist/components/aico-document-content2.js +60 -0
- package/dist/components/aico-document-content2.js.map +1 -0
- package/dist/components/aico-faq-content.d.ts +11 -0
- package/dist/components/aico-faq-content.js +8 -0
- package/dist/components/aico-faq-content.js.map +1 -0
- package/dist/components/aico-faq-content2.js +41 -0
- package/dist/components/aico-faq-content2.js.map +1 -0
- package/dist/components/aico-fetch-article-detail.d.ts +11 -0
- package/dist/components/aico-fetch-article-detail.js +195 -0
- package/dist/components/aico-fetch-article-detail.js.map +1 -0
- package/dist/components/aico-heading-content.d.ts +11 -0
- package/dist/components/aico-heading-content.js +8 -0
- package/dist/components/aico-heading-content.js.map +1 -0
- package/dist/components/aico-heading-content2.js +80 -0
- package/dist/components/aico-heading-content2.js.map +1 -0
- package/dist/components/aico-html-content.d.ts +11 -0
- package/dist/components/aico-html-content.js +8 -0
- package/dist/components/aico-html-content.js.map +1 -0
- package/dist/components/aico-html-content2.js +45 -0
- package/dist/components/aico-html-content2.js.map +1 -0
- package/dist/components/aico-link-content.d.ts +11 -0
- package/dist/components/aico-link-content.js +8 -0
- package/dist/components/aico-link-content.js.map +1 -0
- package/dist/components/aico-link-content2.js +55 -0
- package/dist/components/aico-link-content2.js.map +1 -0
- package/dist/components/aico-news-content.d.ts +11 -0
- package/dist/components/aico-news-content.js +8 -0
- package/dist/components/aico-news-content.js.map +1 -0
- package/dist/components/aico-news-content2.js +43 -0
- package/dist/components/aico-news-content2.js.map +1 -0
- package/dist/components/aico-news-list-item.d.ts +11 -0
- package/dist/components/aico-news-list-item.js +8 -0
- package/dist/components/aico-news-list-item.js.map +1 -0
- package/dist/components/aico-news-list-item2.js +39 -0
- package/dist/components/aico-news-list-item2.js.map +1 -0
- package/dist/components/{my-component.d.ts → aico-news-list.d.ts} +4 -4
- package/dist/components/aico-news-list.js +118 -0
- package/dist/components/aico-news-list.js.map +1 -0
- package/dist/components/aico-no-content.d.ts +11 -0
- package/dist/components/aico-no-content.js +8 -0
- package/dist/components/aico-no-content.js.map +1 -0
- package/dist/components/aico-no-content2.js +31 -0
- package/dist/components/aico-no-content2.js.map +1 -0
- package/dist/components/aico-page-content.d.ts +11 -0
- package/dist/components/aico-page-content.js +8 -0
- package/dist/components/aico-page-content.js.map +1 -0
- package/dist/components/aico-page-content2.js +43 -0
- package/dist/components/aico-page-content2.js.map +1 -0
- package/dist/components/aico-special-news-carousel.d.ts +11 -0
- package/dist/components/aico-special-news-carousel.js +78 -0
- package/dist/components/aico-special-news-carousel.js.map +1 -0
- package/dist/components/aico-table-content.d.ts +11 -0
- package/dist/components/aico-table-content.js +8 -0
- package/dist/components/aico-table-content.js.map +1 -0
- package/dist/components/aico-table-content2.js +72 -0
- package/dist/components/aico-table-content2.js.map +1 -0
- package/dist/components/aico-testimonial-content.d.ts +11 -0
- package/dist/components/aico-testimonial-content.js +8 -0
- package/dist/components/aico-testimonial-content.js.map +1 -0
- package/dist/components/aico-testimonial-content2.js +38 -0
- package/dist/components/aico-testimonial-content2.js.map +1 -0
- package/dist/components/aico-text-content.d.ts +11 -0
- package/dist/components/aico-text-content.js +8 -0
- package/dist/components/aico-text-content.js.map +1 -0
- package/dist/components/aico-text-content2.js +125 -0
- package/dist/components/aico-text-content2.js.map +1 -0
- package/dist/components/aico-title-content.d.ts +11 -0
- package/dist/components/aico-title-content.js +8 -0
- package/dist/components/aico-title-content.js.map +1 -0
- package/dist/components/aico-title-content2.js +54 -0
- package/dist/components/aico-title-content2.js.map +1 -0
- package/dist/components/aico-upload-content.d.ts +11 -0
- package/dist/components/aico-upload-content.js +8 -0
- package/dist/components/aico-upload-content.js.map +1 -0
- package/dist/components/aico-upload-content2.js +65 -0
- package/dist/components/aico-upload-content2.js.map +1 -0
- package/dist/components/aico-video-content.d.ts +11 -0
- package/dist/components/aico-video-content.js +8 -0
- package/dist/components/aico-video-content.js.map +1 -0
- package/dist/components/aico-video-content2.js +61 -0
- package/dist/components/aico-video-content2.js.map +1 -0
- package/dist/components/assets/slick/ajax-loader.gif +0 -0
- package/dist/components/assets/slick/slick.eot +0 -0
- package/dist/components/assets/slick/slick.svg +14 -0
- package/dist/components/assets/slick/slick.ttf +0 -0
- package/dist/components/assets/slick/slick.woff +0 -0
- package/dist/components/bootstrap.esm.js +6265 -0
- package/dist/components/bootstrap.esm.js.map +1 -0
- package/dist/components/slick.js +13660 -0
- package/dist/components/slick.js.map +1 -0
- package/dist/components/utils.js +92 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/esm/aico-album-content_19.entry.js +6882 -0
- package/dist/esm/aico-album-content_19.entry.js.map +1 -0
- package/dist/esm/aico-article-detail.entry.js +120 -0
- package/dist/esm/aico-article-detail.entry.js.map +1 -0
- package/dist/esm/aico-asking-list-content.entry.js +17 -0
- package/dist/esm/aico-asking-list-content.entry.js.map +1 -0
- package/dist/esm/aico-collection-content.entry.js +17 -0
- package/dist/esm/aico-collection-content.entry.js.map +1 -0
- package/dist/esm/aico-components.js +3 -3
- package/dist/esm/aico-fetch-article-detail.entry.js +40 -0
- package/dist/esm/aico-fetch-article-detail.entry.js.map +1 -0
- package/dist/esm/aico-news-list-item.entry.js +23 -0
- package/dist/esm/aico-news-list-item.entry.js.map +1 -0
- package/dist/esm/aico-news-list.entry.js +88 -0
- package/dist/esm/aico-news-list.entry.js.map +1 -0
- package/dist/esm/aico-no-content_2.entry.js +44 -0
- package/dist/esm/aico-no-content_2.entry.js.map +1 -0
- package/dist/esm/aico-special-news-carousel.entry.js +56 -0
- package/dist/esm/aico-special-news-carousel.entry.js.map +1 -0
- package/dist/esm/{index-72708389.js → index-4621a8ba.js} +862 -29
- package/dist/esm/index-4621a8ba.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/slick-d11cf173.js +13660 -0
- package/dist/esm/slick-d11cf173.js.map +1 -0
- package/dist/esm/utils-54ffec33.js +92 -0
- package/dist/esm/utils-54ffec33.js.map +1 -0
- package/dist/types/components/aico-article-detail/aico-article-detail.d.ts +10 -0
- package/dist/types/components/aico-fetch-article-detail/aico-fetch-article-detail.d.ts +26 -0
- package/dist/types/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.d.ts +7 -0
- package/dist/types/components/aico-news-list/aico-news-list.d.ts +21 -0
- package/dist/types/components/aico-news-list/aico-news-list.stories.d.ts +7 -0
- package/dist/types/components/aico-news-list-item/aico-news-list-item.d.ts +7 -0
- package/dist/types/components/aico-news-list-item/aico-news-list-item.stories.d.ts +6 -0
- package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +19 -0
- package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.stories.d.ts +7 -0
- package/dist/types/components/content/aico-album-content/aico-album-content.d.ts +7 -0
- package/dist/types/components/content/aico-album-content/aico-album-content.stories.d.ts +5 -0
- package/dist/types/components/content/aico-asking-content/aico-asking-content.d.ts +5 -0
- package/dist/types/components/content/aico-asking-list-content/aico-asking-list-content.d.ts +3 -0
- package/dist/types/components/content/aico-block-quote-content/aico-block-quote-content.d.ts +5 -0
- package/dist/types/components/content/aico-block-quote-content/aico-block-quote-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-bullet-content/aico-bullet-content.d.ts +6 -0
- package/dist/types/components/content/aico-bullet-content/aico-bullet-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-carousel-content/aico-carousel-content.d.ts +9 -0
- package/dist/types/components/content/aico-carousel-content/aico-carousel-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-collection-content/aico-collection-content.d.ts +3 -0
- package/dist/types/components/content/aico-content-card-content/aico-content-card-content.d.ts +6 -0
- package/dist/types/components/content/aico-content-card-content/aico-content-card-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-divider-content/aico-divider-content.d.ts +5 -0
- package/dist/types/components/content/aico-divider-content/aico-divider-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-document-content/aico-document-content.d.ts +5 -0
- package/dist/types/components/content/aico-document-content/aico-document-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-faq-content/aico-faq-content.d.ts +6 -0
- package/dist/types/components/content/aico-faq-content/aico-faq-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-heading-content/aico-heading-content.d.ts +6 -0
- package/dist/types/components/content/aico-heading-content/aico-heading-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-html-content/aico-html-content.d.ts +5 -0
- package/dist/types/components/content/aico-link-content/aico-link-content.d.ts +5 -0
- package/dist/types/components/content/aico-link-content/aico-link-content.stories.d.ts +7 -0
- package/dist/types/components/content/aico-news-content/aico-news-content.d.ts +8 -0
- package/dist/types/components/content/aico-news-content/aico-news-content.stories.d.ts +5 -0
- package/dist/types/components/content/aico-no-content/aico-no-content.d.ts +3 -0
- package/dist/types/components/content/aico-page-content/aico-page-content.d.ts +7 -0
- package/dist/types/components/content/aico-page-content/aico-page-content.stories.d.ts +5 -0
- package/dist/types/components/content/aico-table-content/aico-table-content.d.ts +6 -0
- package/dist/types/components/content/aico-table-content/aico-table-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-testimonial-content/aico-testimonial-content.d.ts +5 -0
- package/dist/types/components/content/aico-testimonial-content/aico-testimonial-content.stories.d.ts +6 -0
- package/dist/types/components/content/aico-text-content/aico-text-content.d.ts +12 -0
- package/dist/types/components/content/aico-text-content/aico-text-content.stories.d.ts +10 -0
- package/dist/types/components/content/aico-title-content/aico-title-content.d.ts +5 -0
- package/dist/types/components/content/aico-title-content/aico-title-content.stories.d.ts +5 -0
- package/dist/types/components/content/aico-upload-content/aico-upload-content.d.ts +6 -0
- package/dist/types/components/content/aico-upload-content/aico-upload-content.stories.d.ts +5 -0
- package/dist/types/components/content/aico-video-content/aico-video-content.d.ts +6 -0
- package/dist/types/components/content/aico-video-content/aico-video-content.stories.d.ts +7 -0
- package/dist/types/components.d.ts +556 -25
- package/dist/types/model/AicoApiRequestInfo.d.ts +6 -0
- package/dist/types/model/Article.d.ts +103 -0
- package/dist/types/model/Entity.d.ts +15 -0
- package/dist/types/model/NewsCategory.d.ts +14 -0
- package/dist/types/model/NewsResponse.d.ts +25 -0
- package/dist/types/model/article/ContentType.d.ts +31 -0
- package/dist/types/model/article/Translation.d.ts +24 -0
- package/dist/types/model/article/content/AlbumContent.d.ts +26 -0
- package/dist/types/model/article/content/AskingContent.d.ts +152 -0
- package/dist/types/model/article/content/AskingListContent.d.ts +17 -0
- package/dist/types/model/article/content/BlockQuoteContent.d.ts +11 -0
- package/dist/types/model/article/content/BulletContent.d.ts +14 -0
- package/dist/types/model/article/content/CardContent.d.ts +10 -0
- package/dist/types/model/article/content/CarouselContent.d.ts +12 -0
- package/dist/types/model/article/content/CollectionContent.d.ts +364 -0
- package/dist/types/model/article/content/DividerContent.d.ts +8 -0
- package/dist/types/model/article/content/DocumentContent.d.ts +19 -0
- package/dist/types/model/article/content/FaqContent.d.ts +106 -0
- package/dist/types/model/article/content/HeadingContent.d.ts +16 -0
- package/dist/types/model/article/content/HtmlContent.d.ts +5 -0
- package/dist/types/model/article/content/LinkContent.d.ts +23 -0
- package/dist/types/model/article/content/NewsContent.d.ts +836 -0
- package/dist/types/model/article/content/PageContent.d.ts +313 -0
- package/dist/types/model/article/content/TableContet.d.ts +30 -0
- package/dist/types/model/article/content/TestimonialContent.d.ts +9 -0
- package/dist/types/model/article/content/TextContent.d.ts +39 -0
- package/dist/types/model/article/content/TitleContent.d.ts +9 -0
- package/dist/types/model/article/content/UploadContent.d.ts +77 -0
- package/dist/types/model/article/content/VideoContent.d.ts +14 -0
- package/dist/types/model/article/content/news/NewsAlbum.d.ts +150 -0
- package/dist/types/model/article/content/news/NewsArticle.d.ts +577 -0
- package/dist/types/model/article/content/news/NewsCategory.d.ts +88 -0
- package/dist/types/model/article/content/news/NewsTag.d.ts +63 -0
- package/dist/types/utils/ConditionalRender.d.ts +6 -0
- package/dist/types/utils/ConditionalWrap.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +14 -1
- package/package.json +13 -4
- package/dist/aico-components/p-23b28a55.js +0 -3
- package/dist/aico-components/p-23b28a55.js.map +0 -1
- package/dist/aico-components/p-efd6913d.entry.js +0 -2
- package/dist/aico-components/p-efd6913d.entry.js.map +0 -1
- package/dist/cjs/index-222c33f1.js.map +0 -1
- package/dist/cjs/my-component.cjs.entry.js +0 -31
- package/dist/cjs/my-component.cjs.entry.js.map +0 -1
- package/dist/collection/components/my-component/my-component.e2e.js +0 -26
- package/dist/collection/components/my-component/my-component.e2e.js.map +0 -1
- package/dist/collection/components/my-component/my-component.js +0 -83
- package/dist/collection/components/my-component/my-component.js.map +0 -1
- package/dist/collection/components/my-component/my-component.spec.js +0 -35
- package/dist/collection/components/my-component/my-component.spec.js.map +0 -1
- package/dist/collection/components/my-component/my-component.stories.js +0 -13
- package/dist/collection/components/my-component/my-component.stories.js.map +0 -1
- package/dist/components/my-component.js +0 -49
- package/dist/components/my-component.js.map +0 -1
- package/dist/esm/index-72708389.js.map +0 -1
- package/dist/esm/my-component.entry.js +0 -27
- package/dist/esm/my-component.entry.js.map +0 -1
- package/dist/types/components/my-component/my-component.d.ts +0 -16
- /package/dist/collection/components/{my-component/my-component.css → content/aico-collection-content/aico-collection-content.css} +0 -0
- /package/dist/types/components/{my-component/my-component.stories.d.ts → content/aico-asking-content/aico-asking-content.stories.d.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const NAMESPACE = 'aico-components';
|
|
2
|
+
const BUILD = /* aico-components */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: true, connectedCallback: true, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: false };
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Virtual DOM patching algorithm based on Snabbdom by
|
|
@@ -9,7 +10,12 @@ const NAMESPACE = 'aico-components';
|
|
|
9
10
|
* Modified for Stencil's renderer and slot projection
|
|
10
11
|
*/
|
|
11
12
|
let scopeId;
|
|
13
|
+
let contentRef;
|
|
12
14
|
let hostTagName;
|
|
15
|
+
let useNativeShadowDom = false;
|
|
16
|
+
let checkSlotFallbackVisibility = false;
|
|
17
|
+
let checkSlotRelocate = false;
|
|
18
|
+
let isSvgMode = false;
|
|
13
19
|
let queuePending = false;
|
|
14
20
|
const createTime = (fnName, tagName = '') => {
|
|
15
21
|
{
|
|
@@ -33,6 +39,19 @@ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
|
33
39
|
* support as of Stencil v4.
|
|
34
40
|
*/
|
|
35
41
|
const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
|
|
42
|
+
/**
|
|
43
|
+
* Default style mode id
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Reusable empty obj/array
|
|
47
|
+
* Don't add values to these!!
|
|
48
|
+
*/
|
|
49
|
+
const EMPTY_OBJ = {};
|
|
50
|
+
/**
|
|
51
|
+
* Namespaces
|
|
52
|
+
*/
|
|
53
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
54
|
+
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
36
55
|
const isDef = (v) => v != null;
|
|
37
56
|
/**
|
|
38
57
|
* Check whether a value is a 'complex type', defined here as an object or a
|
|
@@ -70,6 +89,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
70
89
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
71
90
|
const h = (nodeName, vnodeData, ...children) => {
|
|
72
91
|
let child = null;
|
|
92
|
+
let slotName = null;
|
|
73
93
|
let simple = false;
|
|
74
94
|
let lastSimple = false;
|
|
75
95
|
const vNodeChildren = [];
|
|
@@ -96,11 +116,35 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
96
116
|
}
|
|
97
117
|
};
|
|
98
118
|
walk(children);
|
|
119
|
+
if (vnodeData) {
|
|
120
|
+
if (vnodeData.name) {
|
|
121
|
+
slotName = vnodeData.name;
|
|
122
|
+
}
|
|
123
|
+
// normalize class / className attributes
|
|
124
|
+
{
|
|
125
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
126
|
+
if (classData) {
|
|
127
|
+
vnodeData.class =
|
|
128
|
+
typeof classData !== 'object'
|
|
129
|
+
? classData
|
|
130
|
+
: Object.keys(classData)
|
|
131
|
+
.filter((k) => classData[k])
|
|
132
|
+
.join(' ');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (typeof nodeName === 'function') {
|
|
137
|
+
// nodeName is a functional component
|
|
138
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
139
|
+
}
|
|
99
140
|
const vnode = newVNode(nodeName, null);
|
|
100
141
|
vnode.$attrs$ = vnodeData;
|
|
101
142
|
if (vNodeChildren.length > 0) {
|
|
102
143
|
vnode.$children$ = vNodeChildren;
|
|
103
144
|
}
|
|
145
|
+
{
|
|
146
|
+
vnode.$name$ = slotName;
|
|
147
|
+
}
|
|
104
148
|
return vnode;
|
|
105
149
|
};
|
|
106
150
|
/**
|
|
@@ -119,6 +163,12 @@ const newVNode = (tag, text) => {
|
|
|
119
163
|
$elm$: null,
|
|
120
164
|
$children$: null,
|
|
121
165
|
};
|
|
166
|
+
{
|
|
167
|
+
vnode.$attrs$ = null;
|
|
168
|
+
}
|
|
169
|
+
{
|
|
170
|
+
vnode.$name$ = null;
|
|
171
|
+
}
|
|
122
172
|
return vnode;
|
|
123
173
|
};
|
|
124
174
|
const Host = {};
|
|
@@ -129,6 +179,59 @@ const Host = {};
|
|
|
129
179
|
* @returns whether it's a Host node or not
|
|
130
180
|
*/
|
|
131
181
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
182
|
+
/**
|
|
183
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
|
184
|
+
*
|
|
185
|
+
* Note that these functions convert from {@link d.VNode} to
|
|
186
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
|
187
|
+
* interface.
|
|
188
|
+
*/
|
|
189
|
+
const vdomFnUtils = {
|
|
190
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
191
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
195
|
+
* friendlier public interface (hence, 'convertToPublic').
|
|
196
|
+
*
|
|
197
|
+
* @param node the virtual DOM node to convert
|
|
198
|
+
* @returns a converted child node
|
|
199
|
+
*/
|
|
200
|
+
const convertToPublic = (node) => ({
|
|
201
|
+
vattrs: node.$attrs$,
|
|
202
|
+
vchildren: node.$children$,
|
|
203
|
+
vkey: node.$key$,
|
|
204
|
+
vname: node.$name$,
|
|
205
|
+
vtag: node.$tag$,
|
|
206
|
+
vtext: node.$text$,
|
|
207
|
+
});
|
|
208
|
+
/**
|
|
209
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
210
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
|
211
|
+
* likely created as part of presenting a public API, so converting it back
|
|
212
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
|
213
|
+
*
|
|
214
|
+
* @param node the child node to convert
|
|
215
|
+
* @returns a converted virtual DOM node
|
|
216
|
+
*/
|
|
217
|
+
const convertToPrivate = (node) => {
|
|
218
|
+
if (typeof node.vtag === 'function') {
|
|
219
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
|
220
|
+
if (node.vkey) {
|
|
221
|
+
vnodeData.key = node.vkey;
|
|
222
|
+
}
|
|
223
|
+
if (node.vname) {
|
|
224
|
+
vnodeData.name = node.vname;
|
|
225
|
+
}
|
|
226
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
227
|
+
}
|
|
228
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
229
|
+
vnode.$attrs$ = node.vattrs;
|
|
230
|
+
vnode.$children$ = node.vchildren;
|
|
231
|
+
vnode.$key$ = node.vkey;
|
|
232
|
+
vnode.$name$ = node.vname;
|
|
233
|
+
return vnode;
|
|
234
|
+
};
|
|
132
235
|
/**
|
|
133
236
|
* Parse a new property value for a given property type.
|
|
134
237
|
*
|
|
@@ -155,6 +258,15 @@ const isHost = (node) => node && node.$tag$ === Host;
|
|
|
155
258
|
const parsePropertyValue = (propValue, propType) => {
|
|
156
259
|
// ensure this value is of the correct prop type
|
|
157
260
|
if (propValue != null && !isComplexType(propValue)) {
|
|
261
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
262
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
263
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
264
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
265
|
+
}
|
|
266
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
267
|
+
// force it to be a number
|
|
268
|
+
return parseFloat(propValue);
|
|
269
|
+
}
|
|
158
270
|
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
159
271
|
// could have been passed as a number or boolean
|
|
160
272
|
// but we still want it as a string
|
|
@@ -167,6 +279,20 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
167
279
|
// so no need to change to a different type
|
|
168
280
|
return propValue;
|
|
169
281
|
};
|
|
282
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
283
|
+
const createEvent = (ref, name, flags) => {
|
|
284
|
+
const elm = getElement(ref);
|
|
285
|
+
return {
|
|
286
|
+
emit: (detail) => {
|
|
287
|
+
return emitEvent(elm, name, {
|
|
288
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
289
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
290
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
291
|
+
detail,
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
};
|
|
170
296
|
/**
|
|
171
297
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
172
298
|
* @param elm the target of the Event
|
|
@@ -242,7 +368,7 @@ const attachStyles = (hostRef) => {
|
|
|
242
368
|
const elm = hostRef.$hostElement$;
|
|
243
369
|
const flags = cmpMeta.$flags$;
|
|
244
370
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
245
|
-
const scopeId = addStyle(elm.
|
|
371
|
+
const scopeId = addStyle(elm.getRootNode(), cmpMeta);
|
|
246
372
|
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
247
373
|
// only required when we're NOT using native shadow dom (slot)
|
|
248
374
|
// or this browser doesn't support native shadow dom
|
|
@@ -253,10 +379,191 @@ const attachStyles = (hostRef) => {
|
|
|
253
379
|
// DOM WRITE!!
|
|
254
380
|
elm['s-sc'] = scopeId;
|
|
255
381
|
elm.classList.add(scopeId + '-h');
|
|
382
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
383
|
+
elm.classList.add(scopeId + '-s');
|
|
384
|
+
}
|
|
256
385
|
}
|
|
257
386
|
endAttachStyles();
|
|
258
387
|
};
|
|
259
388
|
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
389
|
+
/**
|
|
390
|
+
* Production setAccessor() function based on Preact by
|
|
391
|
+
* Jason Miller (@developit)
|
|
392
|
+
* Licensed under the MIT License
|
|
393
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
|
394
|
+
*
|
|
395
|
+
* Modified for Stencil's compiler and vdom
|
|
396
|
+
*/
|
|
397
|
+
/**
|
|
398
|
+
* When running a VDom render set properties present on a VDom node onto the
|
|
399
|
+
* corresponding HTML element.
|
|
400
|
+
*
|
|
401
|
+
* Note that this function has special functionality for the `class`,
|
|
402
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
|
403
|
+
* `onClick`, etc). All others are just passed through as-is.
|
|
404
|
+
*
|
|
405
|
+
* @param elm the HTMLElement onto which attributes should be set
|
|
406
|
+
* @param memberName the name of the attribute to set
|
|
407
|
+
* @param oldValue the old value for the attribute
|
|
408
|
+
* @param newValue the new value for the attribute
|
|
409
|
+
* @param isSvg whether we're in an svg context or not
|
|
410
|
+
* @param flags bitflags for Vdom variables
|
|
411
|
+
*/
|
|
412
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
413
|
+
if (oldValue !== newValue) {
|
|
414
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
415
|
+
let ln = memberName.toLowerCase();
|
|
416
|
+
if (memberName === 'class') {
|
|
417
|
+
const classList = elm.classList;
|
|
418
|
+
const oldClasses = parseClassList(oldValue);
|
|
419
|
+
const newClasses = parseClassList(newValue);
|
|
420
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
421
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
422
|
+
}
|
|
423
|
+
else if (memberName === 'style') {
|
|
424
|
+
// update style attribute, css properties and values
|
|
425
|
+
{
|
|
426
|
+
for (const prop in oldValue) {
|
|
427
|
+
if (!newValue || newValue[prop] == null) {
|
|
428
|
+
if (prop.includes('-')) {
|
|
429
|
+
elm.style.removeProperty(prop);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
elm.style[prop] = '';
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
for (const prop in newValue) {
|
|
438
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
439
|
+
if (prop.includes('-')) {
|
|
440
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
elm.style[prop] = newValue[prop];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else if ((!isProp ) &&
|
|
449
|
+
memberName[0] === 'o' &&
|
|
450
|
+
memberName[1] === 'n') {
|
|
451
|
+
// Event Handlers
|
|
452
|
+
// so if the member name starts with "on" and the 3rd characters is
|
|
453
|
+
// a capital letter, and it's not already a member on the element,
|
|
454
|
+
// then we're assuming it's an event listener
|
|
455
|
+
if (memberName[2] === '-') {
|
|
456
|
+
// on- prefixed events
|
|
457
|
+
// allows to be explicit about the dom event to listen without any magic
|
|
458
|
+
// under the hood:
|
|
459
|
+
// <my-cmp on-click> // listens for "click"
|
|
460
|
+
// <my-cmp on-Click> // listens for "Click"
|
|
461
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
462
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
463
|
+
memberName = memberName.slice(3);
|
|
464
|
+
}
|
|
465
|
+
else if (isMemberInElement(win, ln)) {
|
|
466
|
+
// standard event
|
|
467
|
+
// the JSX attribute could have been "onMouseOver" and the
|
|
468
|
+
// member name "onmouseover" is on the window's prototype
|
|
469
|
+
// so let's add the listener "mouseover", which is all lowercased
|
|
470
|
+
memberName = ln.slice(2);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
// custom event
|
|
474
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
|
475
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
|
476
|
+
// and add the listener "myCustomEvent"
|
|
477
|
+
// except for the first character, we keep the event name case
|
|
478
|
+
memberName = ln[2] + memberName.slice(3);
|
|
479
|
+
}
|
|
480
|
+
if (oldValue || newValue) {
|
|
481
|
+
// Need to account for "capture" events.
|
|
482
|
+
// If the event name ends with "Capture", we'll update the name to remove
|
|
483
|
+
// the "Capture" suffix and make sure the event listener is setup to handle the capture event.
|
|
484
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
485
|
+
// Make sure we only replace the last instance of "Capture"
|
|
486
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
|
|
487
|
+
if (oldValue) {
|
|
488
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
489
|
+
}
|
|
490
|
+
if (newValue) {
|
|
491
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
// Set property if it exists and it's not a SVG
|
|
497
|
+
const isComplex = isComplexType(newValue);
|
|
498
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
499
|
+
try {
|
|
500
|
+
if (!elm.tagName.includes('-')) {
|
|
501
|
+
const n = newValue == null ? '' : newValue;
|
|
502
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
503
|
+
if (memberName === 'list') {
|
|
504
|
+
isProp = false;
|
|
505
|
+
}
|
|
506
|
+
else if (oldValue == null || elm[memberName] != n) {
|
|
507
|
+
elm[memberName] = n;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
elm[memberName] = newValue;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
catch (e) {
|
|
515
|
+
/**
|
|
516
|
+
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
|
517
|
+
*/
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (newValue == null || newValue === false) {
|
|
521
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
522
|
+
{
|
|
523
|
+
elm.removeAttribute(memberName);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
528
|
+
newValue = newValue === true ? '' : newValue;
|
|
529
|
+
{
|
|
530
|
+
elm.setAttribute(memberName, newValue);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
const parseClassListRegex = /\s/;
|
|
537
|
+
/**
|
|
538
|
+
* Parsed a string of classnames into an array
|
|
539
|
+
* @param value className string, e.g. "foo bar baz"
|
|
540
|
+
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
|
541
|
+
*/
|
|
542
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
|
543
|
+
const CAPTURE_EVENT_SUFFIX = 'Capture';
|
|
544
|
+
const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
|
|
545
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
546
|
+
// if the element passed in is a shadow root, which is a document fragment
|
|
547
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
548
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
|
549
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
550
|
+
? newVnode.$elm$.host
|
|
551
|
+
: newVnode.$elm$;
|
|
552
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
553
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
554
|
+
{
|
|
555
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
|
556
|
+
for (memberName in oldVnodeAttrs) {
|
|
557
|
+
if (!(memberName in newVnodeAttrs)) {
|
|
558
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
// add new & update changed attributes
|
|
563
|
+
for (memberName in newVnodeAttrs) {
|
|
564
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
565
|
+
}
|
|
566
|
+
};
|
|
260
567
|
/**
|
|
261
568
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
262
569
|
*
|
|
@@ -268,18 +575,53 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
268
575
|
* @returns the newly created node
|
|
269
576
|
*/
|
|
270
577
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
578
|
+
var _a;
|
|
271
579
|
// tslint:disable-next-line: prefer-const
|
|
272
580
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
273
581
|
let i = 0;
|
|
274
582
|
let elm;
|
|
275
583
|
let childNode;
|
|
584
|
+
let oldVNode;
|
|
585
|
+
if (!useNativeShadowDom) {
|
|
586
|
+
// remember for later we need to check to relocate nodes
|
|
587
|
+
checkSlotRelocate = true;
|
|
588
|
+
if (newVNode.$tag$ === 'slot') {
|
|
589
|
+
if (scopeId) {
|
|
590
|
+
// scoped css needs to add its scoped id to the parent element
|
|
591
|
+
parentElm.classList.add(scopeId + '-s');
|
|
592
|
+
}
|
|
593
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
594
|
+
? // slot element has fallback content
|
|
595
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
596
|
+
: // slot element does not have fallback content
|
|
597
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
276
600
|
if (newVNode.$text$ !== null) {
|
|
277
601
|
// create text node
|
|
278
602
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
279
603
|
}
|
|
604
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
605
|
+
// create a slot reference node
|
|
606
|
+
elm = newVNode.$elm$ =
|
|
607
|
+
doc.createTextNode('');
|
|
608
|
+
}
|
|
280
609
|
else {
|
|
610
|
+
if (!isSvgMode) {
|
|
611
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
|
612
|
+
}
|
|
281
613
|
// create element
|
|
282
|
-
elm = newVNode.$elm$ = (doc.
|
|
614
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
615
|
+
? 'slot-fb'
|
|
616
|
+
: newVNode.$tag$)
|
|
617
|
+
);
|
|
618
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
619
|
+
isSvgMode = false;
|
|
620
|
+
}
|
|
621
|
+
// add css classes, attrs, props, listeners, etc.
|
|
622
|
+
{
|
|
623
|
+
updateElement(null, newVNode, isSvgMode);
|
|
624
|
+
}
|
|
283
625
|
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
284
626
|
// if there is a scopeId and this is the initial render
|
|
285
627
|
// then let's add the scopeId as a css class
|
|
@@ -288,7 +630,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
288
630
|
if (newVNode.$children$) {
|
|
289
631
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
290
632
|
// create the node
|
|
291
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
633
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
292
634
|
// return node could have been null
|
|
293
635
|
if (childNode) {
|
|
294
636
|
// append our new node
|
|
@@ -296,12 +638,73 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
296
638
|
}
|
|
297
639
|
}
|
|
298
640
|
}
|
|
641
|
+
{
|
|
642
|
+
if (newVNode.$tag$ === 'svg') {
|
|
643
|
+
// Only reset the SVG context when we're exiting <svg> element
|
|
644
|
+
isSvgMode = false;
|
|
645
|
+
}
|
|
646
|
+
else if (elm.tagName === 'foreignObject') {
|
|
647
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
|
648
|
+
isSvgMode = true;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
299
651
|
}
|
|
300
652
|
// This needs to always happen so we can hide nodes that are projected
|
|
301
653
|
// to another component but don't end up in a slot
|
|
302
654
|
elm['s-hn'] = hostTagName;
|
|
655
|
+
{
|
|
656
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
657
|
+
// remember the content reference comment
|
|
658
|
+
elm['s-sr'] = true;
|
|
659
|
+
// Persist the name of the slot that this slot was going to be projected into.
|
|
660
|
+
elm['s-fs'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.slot;
|
|
661
|
+
// remember the content reference comment
|
|
662
|
+
elm['s-cr'] = contentRef;
|
|
663
|
+
// remember the slot name, or empty string for default slot
|
|
664
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
665
|
+
// check if we've got an old vnode for this slot
|
|
666
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
667
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
668
|
+
{
|
|
669
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
670
|
+
// so let's move the old slot content back to its original location
|
|
671
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
303
676
|
return elm;
|
|
304
677
|
};
|
|
678
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
679
|
+
var _a;
|
|
680
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
681
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
682
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
683
|
+
const childNode = oldSlotChildNodes[i];
|
|
684
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
685
|
+
// and relocate it back to it's original location
|
|
686
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
687
|
+
// remove the old original location comment entirely
|
|
688
|
+
// later on the patch function will know what to do
|
|
689
|
+
// and move this to the correct spot if need be
|
|
690
|
+
childNode['s-ol'].remove();
|
|
691
|
+
childNode['s-ol'] = undefined;
|
|
692
|
+
// Reset so we can correctly move the node around again.
|
|
693
|
+
childNode['s-sh'] = undefined;
|
|
694
|
+
// When putting an element node back in its original location,
|
|
695
|
+
// we need to reset the `slot` attribute back to the value it originally had
|
|
696
|
+
// so we can correctly relocate it again in the future
|
|
697
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
698
|
+
childNode.setAttribute('slot', (_a = childNode['s-sn']) !== null && _a !== void 0 ? _a : '');
|
|
699
|
+
}
|
|
700
|
+
checkSlotRelocate = true;
|
|
701
|
+
}
|
|
702
|
+
if (recursive) {
|
|
703
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
707
|
+
};
|
|
305
708
|
/**
|
|
306
709
|
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
307
710
|
* add them to the DOM in the appropriate place.
|
|
@@ -318,17 +721,14 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
318
721
|
* creating DOM nodes (inclusive)
|
|
319
722
|
*/
|
|
320
723
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
321
|
-
let containerElm = (parentElm);
|
|
724
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
322
725
|
let childNode;
|
|
323
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
324
|
-
containerElm = containerElm.shadowRoot;
|
|
325
|
-
}
|
|
326
726
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
327
727
|
if (vnodes[startIdx]) {
|
|
328
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
728
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
329
729
|
if (childNode) {
|
|
330
730
|
vnodes[startIdx].$elm$ = childNode;
|
|
331
|
-
containerElm.insertBefore(childNode, before);
|
|
731
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
332
732
|
}
|
|
333
733
|
}
|
|
334
734
|
}
|
|
@@ -350,6 +750,20 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
350
750
|
if (vnode) {
|
|
351
751
|
const elm = vnode.$elm$;
|
|
352
752
|
if (elm) {
|
|
753
|
+
{
|
|
754
|
+
// we're removing this element
|
|
755
|
+
// so it's possible we need to show slot fallback content now
|
|
756
|
+
checkSlotFallbackVisibility = true;
|
|
757
|
+
if (elm['s-ol']) {
|
|
758
|
+
// remove the original location comment
|
|
759
|
+
elm['s-ol'].remove();
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
// it's possible that child nodes of the node
|
|
763
|
+
// that's being removed are slot nodes
|
|
764
|
+
putBackInOriginalLocation(elm, true);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
353
767
|
// remove the vnode's element from the dom
|
|
354
768
|
elm.remove();
|
|
355
769
|
}
|
|
@@ -467,6 +881,23 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
467
881
|
newEndVnode = newCh[--newEndIdx];
|
|
468
882
|
}
|
|
469
883
|
else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
|
884
|
+
// case: "Vnode moved right"
|
|
885
|
+
//
|
|
886
|
+
// We've found that the last node in our window on the new children is
|
|
887
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
888
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
889
|
+
// nodes:
|
|
890
|
+
//
|
|
891
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
892
|
+
// ^^^^^^^^^^^
|
|
893
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
894
|
+
// ^^^^^^^^^^^^^
|
|
895
|
+
//
|
|
896
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
897
|
+
// and move the DOM element for `oldStartVnode`.
|
|
898
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
899
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
900
|
+
}
|
|
470
901
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
471
902
|
// We need to move the element for `oldStartVnode` into a position which
|
|
472
903
|
// will be appropriate for `newEndVnode`. For this we can use
|
|
@@ -490,6 +921,24 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
490
921
|
newEndVnode = newCh[--newEndIdx];
|
|
491
922
|
}
|
|
492
923
|
else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
924
|
+
// case: "Vnode moved left"
|
|
925
|
+
//
|
|
926
|
+
// We've found that the first node in our window on the new children is
|
|
927
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
928
|
+
// Visually, this is the layout of these two nodes:
|
|
929
|
+
//
|
|
930
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
931
|
+
// ^^^^^^^^^^^^^
|
|
932
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
933
|
+
// ^^^^^^^^^^^
|
|
934
|
+
//
|
|
935
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
936
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
937
|
+
// children etc) but we also need to move the DOM node to which
|
|
938
|
+
// `oldEndVnode` corresponds.
|
|
939
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
940
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
941
|
+
}
|
|
493
942
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
494
943
|
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
495
944
|
// the same node, so since we're here we know that they are not. Thus we
|
|
@@ -506,13 +955,13 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
506
955
|
// the key of the first new child OR the build is not using `key`
|
|
507
956
|
// attributes at all. In either case we need to create a new element
|
|
508
957
|
// for the new node.
|
|
509
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
958
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
510
959
|
newStartVnode = newCh[++newStartIdx];
|
|
511
960
|
}
|
|
512
961
|
if (node) {
|
|
513
962
|
// if we created a new node then handle inserting it to the DOM
|
|
514
963
|
{
|
|
515
|
-
oldStartVnode.$elm
|
|
964
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
516
965
|
}
|
|
517
966
|
}
|
|
518
967
|
}
|
|
@@ -551,10 +1000,21 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
|
551
1000
|
// compare if two vnode to see if they're "technically" the same
|
|
552
1001
|
// need to have the same element tag, and same key to be the same
|
|
553
1002
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1003
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
1004
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
1005
|
+
}
|
|
554
1006
|
return true;
|
|
555
1007
|
}
|
|
556
1008
|
return false;
|
|
557
1009
|
};
|
|
1010
|
+
const referenceNode = (node) => {
|
|
1011
|
+
// this node was relocated to a new location in the dom
|
|
1012
|
+
// because of some other component's slot
|
|
1013
|
+
// but we still have an html comment in place of where
|
|
1014
|
+
// it's original location was according to it's original vdom
|
|
1015
|
+
return (node && node['s-ol']) || node;
|
|
1016
|
+
};
|
|
1017
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
558
1018
|
/**
|
|
559
1019
|
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
560
1020
|
* it. This function handles flushing updates to the DOM and reconciling the
|
|
@@ -568,8 +1028,25 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
568
1028
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
569
1029
|
const oldChildren = oldVNode.$children$;
|
|
570
1030
|
const newChildren = newVNode.$children$;
|
|
1031
|
+
const tag = newVNode.$tag$;
|
|
571
1032
|
const text = newVNode.$text$;
|
|
1033
|
+
let defaultHolder;
|
|
572
1034
|
if (text === null) {
|
|
1035
|
+
{
|
|
1036
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
1037
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
|
1038
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
1039
|
+
}
|
|
1040
|
+
{
|
|
1041
|
+
if (tag === 'slot')
|
|
1042
|
+
;
|
|
1043
|
+
else {
|
|
1044
|
+
// either this is the first render of an element OR it's an update
|
|
1045
|
+
// AND we already know it's possible it could have changed
|
|
1046
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
1047
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
573
1050
|
if (oldChildren !== null && newChildren !== null) {
|
|
574
1051
|
// looks like there's child vnodes for both the old and new vnodes
|
|
575
1052
|
// so we need to call `updateChildren` to reconcile them
|
|
@@ -588,6 +1065,13 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
588
1065
|
// no new child vnodes, but there are old child vnodes to remove
|
|
589
1066
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
590
1067
|
}
|
|
1068
|
+
if (isSvgMode && tag === 'svg') {
|
|
1069
|
+
isSvgMode = false;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1073
|
+
// this element has slotted content
|
|
1074
|
+
defaultHolder.parentNode.textContent = text;
|
|
591
1075
|
}
|
|
592
1076
|
else if (oldVNode.$text$ !== text) {
|
|
593
1077
|
// update the text content for the text only vnode
|
|
@@ -595,6 +1079,183 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
595
1079
|
elm.data = text;
|
|
596
1080
|
}
|
|
597
1081
|
};
|
|
1082
|
+
/**
|
|
1083
|
+
* Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
|
|
1084
|
+
* are slot fallbacks nodes.
|
|
1085
|
+
*
|
|
1086
|
+
* A slot fallback node should be visible by default. Then, it should be
|
|
1087
|
+
* conditionally hidden if:
|
|
1088
|
+
*
|
|
1089
|
+
* - it has a sibling with a `slot` property set to its slot name or if
|
|
1090
|
+
* - it is a default fallback slot node, in which case we hide if it has any
|
|
1091
|
+
* content
|
|
1092
|
+
*
|
|
1093
|
+
* @param elm the element of interest
|
|
1094
|
+
*/
|
|
1095
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
1096
|
+
const childNodes = elm.childNodes;
|
|
1097
|
+
for (const childNode of childNodes) {
|
|
1098
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1099
|
+
if (childNode['s-sr']) {
|
|
1100
|
+
// this is a slot fallback node
|
|
1101
|
+
// get the slot name for this slot reference node
|
|
1102
|
+
const slotName = childNode['s-sn'];
|
|
1103
|
+
// by default always show a fallback slot node
|
|
1104
|
+
// then hide it if there are other slots in the light dom
|
|
1105
|
+
childNode.hidden = false;
|
|
1106
|
+
// we need to check all of its sibling nodes in order to see if
|
|
1107
|
+
// `childNode` should be hidden
|
|
1108
|
+
for (const siblingNode of childNodes) {
|
|
1109
|
+
// Don't check the node against itself
|
|
1110
|
+
if (siblingNode !== childNode) {
|
|
1111
|
+
if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
|
|
1112
|
+
// this sibling node is from a different component OR is a named
|
|
1113
|
+
// fallback slot node
|
|
1114
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
|
1115
|
+
(slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
|
|
1116
|
+
childNode.hidden = true;
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
else {
|
|
1121
|
+
// this is a default fallback slot node
|
|
1122
|
+
// any element or text node (with content)
|
|
1123
|
+
// should hide the default fallback slot node
|
|
1124
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1125
|
+
(siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
|
|
1126
|
+
childNode.hidden = true;
|
|
1127
|
+
break;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
// keep drilling down
|
|
1134
|
+
updateFallbackSlotVisibility(childNode);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
/**
|
|
1139
|
+
* Component-global information about nodes which are either currently being
|
|
1140
|
+
* relocated or will be shortly.
|
|
1141
|
+
*/
|
|
1142
|
+
const relocateNodes = [];
|
|
1143
|
+
/**
|
|
1144
|
+
* Mark the contents of a slot for relocation via adding references to them to
|
|
1145
|
+
* the {@link relocateNodes} data structure. The actual work of relocating them
|
|
1146
|
+
* will then be handled in {@link renderVdom}.
|
|
1147
|
+
*
|
|
1148
|
+
* @param elm a render node whose child nodes need to be relocated
|
|
1149
|
+
*/
|
|
1150
|
+
const markSlotContentForRelocation = (elm) => {
|
|
1151
|
+
// tslint:disable-next-line: prefer-const
|
|
1152
|
+
let node;
|
|
1153
|
+
let hostContentNodes;
|
|
1154
|
+
let j;
|
|
1155
|
+
for (const childNode of elm.childNodes) {
|
|
1156
|
+
// we need to find child nodes which are slot references so we can then try
|
|
1157
|
+
// to match them up with nodes that need to be relocated
|
|
1158
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1159
|
+
// first get the content reference comment node ('s-cr'), then we get
|
|
1160
|
+
// its parent, which is where all the host content is now
|
|
1161
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
1162
|
+
const slotName = childNode['s-sn'];
|
|
1163
|
+
// iterate through all the nodes under the location where the host was
|
|
1164
|
+
// originally rendered
|
|
1165
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1166
|
+
node = hostContentNodes[j];
|
|
1167
|
+
// check that the node is not a content reference node or a node
|
|
1168
|
+
// reference and then check that the host name does not match that of
|
|
1169
|
+
// childNode.
|
|
1170
|
+
// In addition, check that the slot either has not already been relocated, or
|
|
1171
|
+
// that its current location's host is not childNode's host. This is essentially
|
|
1172
|
+
// a check so that we don't try to relocate (and then hide) a node that is already
|
|
1173
|
+
// where it should be.
|
|
1174
|
+
if (!node['s-cn'] &&
|
|
1175
|
+
!node['s-nr'] &&
|
|
1176
|
+
node['s-hn'] !== childNode['s-hn'] &&
|
|
1177
|
+
(!BUILD.experimentalSlotFixes )) {
|
|
1178
|
+
// if `node` is located in the slot that `childNode` refers to (via the
|
|
1179
|
+
// `'s-sn'` property) then we need to relocate it from it's current spot
|
|
1180
|
+
// (under the host element parent) to the right slot location
|
|
1181
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1182
|
+
// it's possible we've already decided to relocate this node
|
|
1183
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1184
|
+
// made some changes to slots
|
|
1185
|
+
// let's make sure we also double check
|
|
1186
|
+
// fallbacks are correctly hidden or shown
|
|
1187
|
+
checkSlotFallbackVisibility = true;
|
|
1188
|
+
// ensure that the slot-name attr is correct
|
|
1189
|
+
node['s-sn'] = node['s-sn'] || slotName;
|
|
1190
|
+
if (relocateNodeData) {
|
|
1191
|
+
relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
|
|
1192
|
+
// we marked this node for relocation previously but didn't find
|
|
1193
|
+
// out the slot reference node to which it needs to be relocated
|
|
1194
|
+
// so write it down now!
|
|
1195
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
node['s-sh'] = childNode['s-hn'];
|
|
1199
|
+
// add to our list of nodes to relocate
|
|
1200
|
+
relocateNodes.push({
|
|
1201
|
+
$slotRefNode$: childNode,
|
|
1202
|
+
$nodeToRelocate$: node,
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
if (node['s-sr']) {
|
|
1206
|
+
relocateNodes.map((relocateNode) => {
|
|
1207
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
1208
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1209
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1210
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1217
|
+
// the node is not found within the slot (`childNode`) that we're
|
|
1218
|
+
// currently looking at, so we stick it into `relocateNodes` to
|
|
1219
|
+
// handle later. If we never find a home for this element then
|
|
1220
|
+
// we'll need to hide it
|
|
1221
|
+
relocateNodes.push({
|
|
1222
|
+
$nodeToRelocate$: node,
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
// if we're dealing with any type of element (capable of itself being a
|
|
1229
|
+
// slot reference or containing one) then we recur
|
|
1230
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1231
|
+
markSlotContentForRelocation(childNode);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
/**
|
|
1236
|
+
* Check whether a node is located in a given named slot.
|
|
1237
|
+
*
|
|
1238
|
+
* @param nodeToRelocate the node of interest
|
|
1239
|
+
* @param slotName the slot name to check
|
|
1240
|
+
* @returns whether the node is located in the slot or not
|
|
1241
|
+
*/
|
|
1242
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
1243
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1244
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
|
|
1245
|
+
// if the node doesn't have a slot attribute, and the slot we're checking
|
|
1246
|
+
// is not a named slot, then we assume the node should be within the slot
|
|
1247
|
+
return true;
|
|
1248
|
+
}
|
|
1249
|
+
if (nodeToRelocate.getAttribute('slot') === slotName) {
|
|
1250
|
+
return true;
|
|
1251
|
+
}
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
if (nodeToRelocate['s-sn'] === slotName) {
|
|
1255
|
+
return true;
|
|
1256
|
+
}
|
|
1257
|
+
return slotName === '';
|
|
1258
|
+
};
|
|
598
1259
|
/**
|
|
599
1260
|
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
600
1261
|
*
|
|
@@ -609,7 +1270,9 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
609
1270
|
* @param isInitialLoad whether or not this is the first call after page load
|
|
610
1271
|
*/
|
|
611
1272
|
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
1273
|
+
var _a, _b, _c, _d;
|
|
612
1274
|
const hostElm = hostRef.$hostElement$;
|
|
1275
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
613
1276
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
614
1277
|
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
|
615
1278
|
// we need to call `h` again to wrap the children of our component in a
|
|
@@ -642,12 +1305,114 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
642
1305
|
rootVnode.$tag$ = null;
|
|
643
1306
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
644
1307
|
hostRef.$vnode$ = rootVnode;
|
|
645
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
1308
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
646
1309
|
{
|
|
647
1310
|
scopeId = hostElm['s-sc'];
|
|
648
1311
|
}
|
|
1312
|
+
{
|
|
1313
|
+
contentRef = hostElm['s-cr'];
|
|
1314
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1315
|
+
// always reset
|
|
1316
|
+
checkSlotFallbackVisibility = false;
|
|
1317
|
+
}
|
|
649
1318
|
// synchronous patch
|
|
650
1319
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
1320
|
+
{
|
|
1321
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
1322
|
+
// the disconnectCallback from working
|
|
1323
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1324
|
+
if (checkSlotRelocate) {
|
|
1325
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1326
|
+
for (const relocateData of relocateNodes) {
|
|
1327
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1328
|
+
if (!nodeToRelocate['s-ol']) {
|
|
1329
|
+
// add a reference node marking this node's original location
|
|
1330
|
+
// keep a reference to this node for later lookups
|
|
1331
|
+
const orgLocationNode = doc.createTextNode('');
|
|
1332
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1333
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
for (const relocateData of relocateNodes) {
|
|
1337
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1338
|
+
const slotRefNode = relocateData.$slotRefNode$;
|
|
1339
|
+
if (slotRefNode) {
|
|
1340
|
+
const parentNodeRef = slotRefNode.parentNode;
|
|
1341
|
+
// When determining where to insert content, the most simple case would be
|
|
1342
|
+
// to relocate the node immediately following the slot reference node. We do this
|
|
1343
|
+
// by getting a reference to the node immediately following the slot reference node
|
|
1344
|
+
// since we will use `insertBefore` to manipulate the DOM.
|
|
1345
|
+
//
|
|
1346
|
+
// If there is no node immediately following the slot reference node, then we will just
|
|
1347
|
+
// end up appending the node as the last child of the parent.
|
|
1348
|
+
let insertBeforeNode = slotRefNode.nextSibling;
|
|
1349
|
+
// If the node we're currently planning on inserting the new node before is an element,
|
|
1350
|
+
// we need to do some additional checks to make sure we're inserting the node in the correct order.
|
|
1351
|
+
// The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
|
|
1352
|
+
// to make sure they get inserted into their new how in the same order they were declared in their original location.
|
|
1353
|
+
//
|
|
1354
|
+
// TODO(STENCIL-914): Remove `experimentalSlotFixes` check
|
|
1355
|
+
{
|
|
1356
|
+
let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
|
|
1357
|
+
while (orgLocationNode) {
|
|
1358
|
+
let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
|
|
1359
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1360
|
+
refNode = refNode.nextSibling;
|
|
1361
|
+
if (!refNode || !refNode['s-nr']) {
|
|
1362
|
+
insertBeforeNode = refNode;
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
orgLocationNode = orgLocationNode.previousSibling;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1370
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1371
|
+
// we've checked that it's worth while to relocate
|
|
1372
|
+
// since that the node to relocate
|
|
1373
|
+
// has a different next sibling or parent relocated
|
|
1374
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
1375
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1376
|
+
// probably a component in the index.html that doesn't have its hostname set
|
|
1377
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1378
|
+
}
|
|
1379
|
+
// Add it back to the dom but in its new home
|
|
1380
|
+
// If we get to this point and `insertBeforeNode` is `null`, that means
|
|
1381
|
+
// we're just going to append the node as the last child of the parent. Passing
|
|
1382
|
+
// `null` as the second arg here will trigger that behavior.
|
|
1383
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1384
|
+
// Reset the `hidden` value back to what it was defined as originally
|
|
1385
|
+
// This solves a problem where a `slot` is dynamically rendered and `hidden` may have
|
|
1386
|
+
// been set on content originally, but now it has a slot to go to so it should have
|
|
1387
|
+
// the value it was defined as having in the DOM, not what we overrode it to.
|
|
1388
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1389
|
+
nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
else {
|
|
1395
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
1396
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1397
|
+
// Store the initial value of `hidden` so we can reset it later when
|
|
1398
|
+
// moving nodes around.
|
|
1399
|
+
if (isInitialLoad) {
|
|
1400
|
+
nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
|
|
1401
|
+
}
|
|
1402
|
+
nodeToRelocate.hidden = true;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
if (checkSlotFallbackVisibility) {
|
|
1408
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1409
|
+
}
|
|
1410
|
+
// done moving nodes around
|
|
1411
|
+
// allow the disconnect callback to work again
|
|
1412
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1413
|
+
// always reset
|
|
1414
|
+
relocateNodes.length = 0;
|
|
1415
|
+
}
|
|
651
1416
|
};
|
|
652
1417
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
653
1418
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
@@ -695,6 +1460,26 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
695
1460
|
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
696
1461
|
// called in order after `dispatchHooks` exits.
|
|
697
1462
|
let maybePromise;
|
|
1463
|
+
if (isInitialLoad) {
|
|
1464
|
+
{
|
|
1465
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
|
1466
|
+
// whatever's going on in that `Promise` before we launch into
|
|
1467
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
|
1468
|
+
// in that case we assign the returned promise to the variable we
|
|
1469
|
+
// declared above to hold a possible 'queueing' Promise
|
|
1470
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
else {
|
|
1474
|
+
{
|
|
1475
|
+
// Like `componentWillLoad` above, we allow Stencil component
|
|
1476
|
+
// authors to return a `Promise` from this lifecycle callback, and
|
|
1477
|
+
// we specify that our runtime will wait for that `Promise` to
|
|
1478
|
+
// resolve before the component re-renders. So if the method
|
|
1479
|
+
// returns a `Promise` we need to keep it around!
|
|
1480
|
+
maybePromise = safeCall(instance, 'componentWillUpdate');
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
698
1483
|
endSchedule();
|
|
699
1484
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
700
1485
|
};
|
|
@@ -817,6 +1602,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
817
1602
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
818
1603
|
const elm = hostRef.$hostElement$;
|
|
819
1604
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1605
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
820
1606
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
821
1607
|
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
822
1608
|
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
@@ -824,6 +1610,9 @@ const postUpdateComponent = (hostRef) => {
|
|
|
824
1610
|
// DOM WRITE!
|
|
825
1611
|
addHydratedFlag(elm);
|
|
826
1612
|
}
|
|
1613
|
+
{
|
|
1614
|
+
safeCall(instance, 'componentDidLoad');
|
|
1615
|
+
}
|
|
827
1616
|
endPostUpdate();
|
|
828
1617
|
{
|
|
829
1618
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -859,6 +1648,27 @@ const appDidLoad = (who) => {
|
|
|
859
1648
|
}
|
|
860
1649
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
861
1650
|
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
|
1653
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
|
1654
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
|
1655
|
+
* output bundle and this function returns `undefined`.
|
|
1656
|
+
* @param instance any object that may or may not contain methods
|
|
1657
|
+
* @param method method name
|
|
1658
|
+
* @param arg single arbitrary argument
|
|
1659
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
|
1660
|
+
*/
|
|
1661
|
+
const safeCall = (instance, method, arg) => {
|
|
1662
|
+
if (instance && instance[method]) {
|
|
1663
|
+
try {
|
|
1664
|
+
return instance[method](arg);
|
|
1665
|
+
}
|
|
1666
|
+
catch (e) {
|
|
1667
|
+
consoleError(e);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return undefined;
|
|
1671
|
+
};
|
|
862
1672
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
863
1673
|
;
|
|
864
1674
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1069,6 +1879,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1069
1879
|
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1070
1880
|
}
|
|
1071
1881
|
endNewInstance();
|
|
1882
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1072
1883
|
}
|
|
1073
1884
|
if (Cstr.style) {
|
|
1074
1885
|
// this component has styles but we haven't registered them yet
|
|
@@ -1098,6 +1909,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1098
1909
|
}
|
|
1099
1910
|
};
|
|
1100
1911
|
const fireConnectedCallback = (instance) => {
|
|
1912
|
+
{
|
|
1913
|
+
safeCall(instance, 'connectedCallback');
|
|
1914
|
+
}
|
|
1101
1915
|
};
|
|
1102
1916
|
const connectedCallback = (elm) => {
|
|
1103
1917
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
@@ -1107,6 +1921,16 @@ const connectedCallback = (elm) => {
|
|
|
1107
1921
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1108
1922
|
// first time this component has connected
|
|
1109
1923
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1924
|
+
{
|
|
1925
|
+
// initUpdate
|
|
1926
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1927
|
+
// in here to act as original content anchors as we move nodes around
|
|
1928
|
+
// host element has been connected to the DOM
|
|
1929
|
+
if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
1930
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1931
|
+
setContentReference(elm);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1110
1934
|
{
|
|
1111
1935
|
// find the first ancestor component (if there is one) and register
|
|
1112
1936
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1139,22 +1963,40 @@ const connectedCallback = (elm) => {
|
|
|
1139
1963
|
}
|
|
1140
1964
|
else {
|
|
1141
1965
|
// fire off connectedCallback() on component instance
|
|
1142
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$)
|
|
1966
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
1967
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1968
|
+
}
|
|
1143
1969
|
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1144
|
-
hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
|
|
1970
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
|
|
1145
1971
|
}
|
|
1146
1972
|
}
|
|
1147
1973
|
endConnected();
|
|
1148
1974
|
}
|
|
1149
1975
|
};
|
|
1976
|
+
const setContentReference = (elm) => {
|
|
1977
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1978
|
+
// or this browser doesn't support native shadow dom
|
|
1979
|
+
// and this host element was NOT created with SSR
|
|
1980
|
+
// let's pick out the inner content for slot projection
|
|
1981
|
+
// create a node to represent where the original
|
|
1982
|
+
// content was first placed, which is useful later on
|
|
1983
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1984
|
+
contentRefElm['s-cn'] = true;
|
|
1985
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1986
|
+
};
|
|
1150
1987
|
const disconnectInstance = (instance) => {
|
|
1988
|
+
{
|
|
1989
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1990
|
+
}
|
|
1151
1991
|
};
|
|
1152
1992
|
const disconnectedCallback = async (elm) => {
|
|
1153
1993
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1154
1994
|
const hostRef = getHostRef(elm);
|
|
1155
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$)
|
|
1995
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
1996
|
+
disconnectInstance(hostRef.$lazyInstance$);
|
|
1997
|
+
}
|
|
1156
1998
|
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1157
|
-
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
|
1999
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
|
1158
2000
|
}
|
|
1159
2001
|
}
|
|
1160
2002
|
};
|
|
@@ -1197,17 +2039,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1197
2039
|
super(self);
|
|
1198
2040
|
self = this;
|
|
1199
2041
|
registerHost(self, cmpMeta);
|
|
1200
|
-
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1201
|
-
// this component is using shadow dom
|
|
1202
|
-
// and this browser supports shadow dom
|
|
1203
|
-
// add the read-only property "shadowRoot" to the host element
|
|
1204
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
1205
|
-
{
|
|
1206
|
-
{
|
|
1207
|
-
self.attachShadow({ mode: 'open' });
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
2042
|
}
|
|
1212
2043
|
connectedCallback() {
|
|
1213
2044
|
if (appLoadFallback) {
|
|
@@ -1269,6 +2100,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1269
2100
|
// Fallback appLoad event
|
|
1270
2101
|
endBootstrap();
|
|
1271
2102
|
};
|
|
2103
|
+
const Fragment = (_, children) => children;
|
|
1272
2104
|
/**
|
|
1273
2105
|
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1274
2106
|
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
@@ -1320,6 +2152,7 @@ const registerHost = (hostElement, cmpMeta) => {
|
|
|
1320
2152
|
}
|
|
1321
2153
|
return hostRefs.set(hostElement, hostRef);
|
|
1322
2154
|
};
|
|
2155
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1323
2156
|
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1324
2157
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1325
2158
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
@@ -1408,6 +2241,6 @@ const flush = () => {
|
|
|
1408
2241
|
const nextTick = (cb) => promiseResolve().then(cb);
|
|
1409
2242
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1410
2243
|
|
|
1411
|
-
export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
2244
|
+
export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1412
2245
|
|
|
1413
|
-
//# sourceMappingURL=index-
|
|
2246
|
+
//# sourceMappingURL=index-4621a8ba.js.map
|