@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
|
@@ -21,6 +21,7 @@ function _interopNamespace(e) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'aico-components';
|
|
24
|
+
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 };
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Virtual DOM patching algorithm based on Snabbdom by
|
|
@@ -31,7 +32,12 @@ const NAMESPACE = 'aico-components';
|
|
|
31
32
|
* Modified for Stencil's renderer and slot projection
|
|
32
33
|
*/
|
|
33
34
|
let scopeId;
|
|
35
|
+
let contentRef;
|
|
34
36
|
let hostTagName;
|
|
37
|
+
let useNativeShadowDom = false;
|
|
38
|
+
let checkSlotFallbackVisibility = false;
|
|
39
|
+
let checkSlotRelocate = false;
|
|
40
|
+
let isSvgMode = false;
|
|
35
41
|
let queuePending = false;
|
|
36
42
|
const createTime = (fnName, tagName = '') => {
|
|
37
43
|
{
|
|
@@ -55,6 +61,19 @@ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
|
55
61
|
* support as of Stencil v4.
|
|
56
62
|
*/
|
|
57
63
|
const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
|
|
64
|
+
/**
|
|
65
|
+
* Default style mode id
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Reusable empty obj/array
|
|
69
|
+
* Don't add values to these!!
|
|
70
|
+
*/
|
|
71
|
+
const EMPTY_OBJ = {};
|
|
72
|
+
/**
|
|
73
|
+
* Namespaces
|
|
74
|
+
*/
|
|
75
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
76
|
+
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
58
77
|
const isDef = (v) => v != null;
|
|
59
78
|
/**
|
|
60
79
|
* Check whether a value is a 'complex type', defined here as an object or a
|
|
@@ -92,6 +111,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
92
111
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
93
112
|
const h = (nodeName, vnodeData, ...children) => {
|
|
94
113
|
let child = null;
|
|
114
|
+
let slotName = null;
|
|
95
115
|
let simple = false;
|
|
96
116
|
let lastSimple = false;
|
|
97
117
|
const vNodeChildren = [];
|
|
@@ -118,11 +138,35 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
118
138
|
}
|
|
119
139
|
};
|
|
120
140
|
walk(children);
|
|
141
|
+
if (vnodeData) {
|
|
142
|
+
if (vnodeData.name) {
|
|
143
|
+
slotName = vnodeData.name;
|
|
144
|
+
}
|
|
145
|
+
// normalize class / className attributes
|
|
146
|
+
{
|
|
147
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
148
|
+
if (classData) {
|
|
149
|
+
vnodeData.class =
|
|
150
|
+
typeof classData !== 'object'
|
|
151
|
+
? classData
|
|
152
|
+
: Object.keys(classData)
|
|
153
|
+
.filter((k) => classData[k])
|
|
154
|
+
.join(' ');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (typeof nodeName === 'function') {
|
|
159
|
+
// nodeName is a functional component
|
|
160
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
161
|
+
}
|
|
121
162
|
const vnode = newVNode(nodeName, null);
|
|
122
163
|
vnode.$attrs$ = vnodeData;
|
|
123
164
|
if (vNodeChildren.length > 0) {
|
|
124
165
|
vnode.$children$ = vNodeChildren;
|
|
125
166
|
}
|
|
167
|
+
{
|
|
168
|
+
vnode.$name$ = slotName;
|
|
169
|
+
}
|
|
126
170
|
return vnode;
|
|
127
171
|
};
|
|
128
172
|
/**
|
|
@@ -141,6 +185,12 @@ const newVNode = (tag, text) => {
|
|
|
141
185
|
$elm$: null,
|
|
142
186
|
$children$: null,
|
|
143
187
|
};
|
|
188
|
+
{
|
|
189
|
+
vnode.$attrs$ = null;
|
|
190
|
+
}
|
|
191
|
+
{
|
|
192
|
+
vnode.$name$ = null;
|
|
193
|
+
}
|
|
144
194
|
return vnode;
|
|
145
195
|
};
|
|
146
196
|
const Host = {};
|
|
@@ -151,6 +201,59 @@ const Host = {};
|
|
|
151
201
|
* @returns whether it's a Host node or not
|
|
152
202
|
*/
|
|
153
203
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
204
|
+
/**
|
|
205
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
|
206
|
+
*
|
|
207
|
+
* Note that these functions convert from {@link d.VNode} to
|
|
208
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
|
209
|
+
* interface.
|
|
210
|
+
*/
|
|
211
|
+
const vdomFnUtils = {
|
|
212
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
213
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
217
|
+
* friendlier public interface (hence, 'convertToPublic').
|
|
218
|
+
*
|
|
219
|
+
* @param node the virtual DOM node to convert
|
|
220
|
+
* @returns a converted child node
|
|
221
|
+
*/
|
|
222
|
+
const convertToPublic = (node) => ({
|
|
223
|
+
vattrs: node.$attrs$,
|
|
224
|
+
vchildren: node.$children$,
|
|
225
|
+
vkey: node.$key$,
|
|
226
|
+
vname: node.$name$,
|
|
227
|
+
vtag: node.$tag$,
|
|
228
|
+
vtext: node.$text$,
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
232
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
|
233
|
+
* likely created as part of presenting a public API, so converting it back
|
|
234
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
|
235
|
+
*
|
|
236
|
+
* @param node the child node to convert
|
|
237
|
+
* @returns a converted virtual DOM node
|
|
238
|
+
*/
|
|
239
|
+
const convertToPrivate = (node) => {
|
|
240
|
+
if (typeof node.vtag === 'function') {
|
|
241
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
|
242
|
+
if (node.vkey) {
|
|
243
|
+
vnodeData.key = node.vkey;
|
|
244
|
+
}
|
|
245
|
+
if (node.vname) {
|
|
246
|
+
vnodeData.name = node.vname;
|
|
247
|
+
}
|
|
248
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
249
|
+
}
|
|
250
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
251
|
+
vnode.$attrs$ = node.vattrs;
|
|
252
|
+
vnode.$children$ = node.vchildren;
|
|
253
|
+
vnode.$key$ = node.vkey;
|
|
254
|
+
vnode.$name$ = node.vname;
|
|
255
|
+
return vnode;
|
|
256
|
+
};
|
|
154
257
|
/**
|
|
155
258
|
* Parse a new property value for a given property type.
|
|
156
259
|
*
|
|
@@ -177,6 +280,15 @@ const isHost = (node) => node && node.$tag$ === Host;
|
|
|
177
280
|
const parsePropertyValue = (propValue, propType) => {
|
|
178
281
|
// ensure this value is of the correct prop type
|
|
179
282
|
if (propValue != null && !isComplexType(propValue)) {
|
|
283
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
284
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
285
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
286
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
287
|
+
}
|
|
288
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
289
|
+
// force it to be a number
|
|
290
|
+
return parseFloat(propValue);
|
|
291
|
+
}
|
|
180
292
|
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
181
293
|
// could have been passed as a number or boolean
|
|
182
294
|
// but we still want it as a string
|
|
@@ -189,6 +301,20 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
189
301
|
// so no need to change to a different type
|
|
190
302
|
return propValue;
|
|
191
303
|
};
|
|
304
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
305
|
+
const createEvent = (ref, name, flags) => {
|
|
306
|
+
const elm = getElement(ref);
|
|
307
|
+
return {
|
|
308
|
+
emit: (detail) => {
|
|
309
|
+
return emitEvent(elm, name, {
|
|
310
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
311
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
312
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
313
|
+
detail,
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
};
|
|
192
318
|
/**
|
|
193
319
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
194
320
|
* @param elm the target of the Event
|
|
@@ -264,7 +390,7 @@ const attachStyles = (hostRef) => {
|
|
|
264
390
|
const elm = hostRef.$hostElement$;
|
|
265
391
|
const flags = cmpMeta.$flags$;
|
|
266
392
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
267
|
-
const scopeId = addStyle(elm.
|
|
393
|
+
const scopeId = addStyle(elm.getRootNode(), cmpMeta);
|
|
268
394
|
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
269
395
|
// only required when we're NOT using native shadow dom (slot)
|
|
270
396
|
// or this browser doesn't support native shadow dom
|
|
@@ -275,10 +401,191 @@ const attachStyles = (hostRef) => {
|
|
|
275
401
|
// DOM WRITE!!
|
|
276
402
|
elm['s-sc'] = scopeId;
|
|
277
403
|
elm.classList.add(scopeId + '-h');
|
|
404
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
405
|
+
elm.classList.add(scopeId + '-s');
|
|
406
|
+
}
|
|
278
407
|
}
|
|
279
408
|
endAttachStyles();
|
|
280
409
|
};
|
|
281
410
|
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
411
|
+
/**
|
|
412
|
+
* Production setAccessor() function based on Preact by
|
|
413
|
+
* Jason Miller (@developit)
|
|
414
|
+
* Licensed under the MIT License
|
|
415
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
|
416
|
+
*
|
|
417
|
+
* Modified for Stencil's compiler and vdom
|
|
418
|
+
*/
|
|
419
|
+
/**
|
|
420
|
+
* When running a VDom render set properties present on a VDom node onto the
|
|
421
|
+
* corresponding HTML element.
|
|
422
|
+
*
|
|
423
|
+
* Note that this function has special functionality for the `class`,
|
|
424
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
|
425
|
+
* `onClick`, etc). All others are just passed through as-is.
|
|
426
|
+
*
|
|
427
|
+
* @param elm the HTMLElement onto which attributes should be set
|
|
428
|
+
* @param memberName the name of the attribute to set
|
|
429
|
+
* @param oldValue the old value for the attribute
|
|
430
|
+
* @param newValue the new value for the attribute
|
|
431
|
+
* @param isSvg whether we're in an svg context or not
|
|
432
|
+
* @param flags bitflags for Vdom variables
|
|
433
|
+
*/
|
|
434
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
435
|
+
if (oldValue !== newValue) {
|
|
436
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
437
|
+
let ln = memberName.toLowerCase();
|
|
438
|
+
if (memberName === 'class') {
|
|
439
|
+
const classList = elm.classList;
|
|
440
|
+
const oldClasses = parseClassList(oldValue);
|
|
441
|
+
const newClasses = parseClassList(newValue);
|
|
442
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
443
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
444
|
+
}
|
|
445
|
+
else if (memberName === 'style') {
|
|
446
|
+
// update style attribute, css properties and values
|
|
447
|
+
{
|
|
448
|
+
for (const prop in oldValue) {
|
|
449
|
+
if (!newValue || newValue[prop] == null) {
|
|
450
|
+
if (prop.includes('-')) {
|
|
451
|
+
elm.style.removeProperty(prop);
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
elm.style[prop] = '';
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
for (const prop in newValue) {
|
|
460
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
461
|
+
if (prop.includes('-')) {
|
|
462
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
elm.style[prop] = newValue[prop];
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
else if ((!isProp ) &&
|
|
471
|
+
memberName[0] === 'o' &&
|
|
472
|
+
memberName[1] === 'n') {
|
|
473
|
+
// Event Handlers
|
|
474
|
+
// so if the member name starts with "on" and the 3rd characters is
|
|
475
|
+
// a capital letter, and it's not already a member on the element,
|
|
476
|
+
// then we're assuming it's an event listener
|
|
477
|
+
if (memberName[2] === '-') {
|
|
478
|
+
// on- prefixed events
|
|
479
|
+
// allows to be explicit about the dom event to listen without any magic
|
|
480
|
+
// under the hood:
|
|
481
|
+
// <my-cmp on-click> // listens for "click"
|
|
482
|
+
// <my-cmp on-Click> // listens for "Click"
|
|
483
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
484
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
485
|
+
memberName = memberName.slice(3);
|
|
486
|
+
}
|
|
487
|
+
else if (isMemberInElement(win, ln)) {
|
|
488
|
+
// standard event
|
|
489
|
+
// the JSX attribute could have been "onMouseOver" and the
|
|
490
|
+
// member name "onmouseover" is on the window's prototype
|
|
491
|
+
// so let's add the listener "mouseover", which is all lowercased
|
|
492
|
+
memberName = ln.slice(2);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
// custom event
|
|
496
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
|
497
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
|
498
|
+
// and add the listener "myCustomEvent"
|
|
499
|
+
// except for the first character, we keep the event name case
|
|
500
|
+
memberName = ln[2] + memberName.slice(3);
|
|
501
|
+
}
|
|
502
|
+
if (oldValue || newValue) {
|
|
503
|
+
// Need to account for "capture" events.
|
|
504
|
+
// If the event name ends with "Capture", we'll update the name to remove
|
|
505
|
+
// the "Capture" suffix and make sure the event listener is setup to handle the capture event.
|
|
506
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
507
|
+
// Make sure we only replace the last instance of "Capture"
|
|
508
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
|
|
509
|
+
if (oldValue) {
|
|
510
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
511
|
+
}
|
|
512
|
+
if (newValue) {
|
|
513
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
// Set property if it exists and it's not a SVG
|
|
519
|
+
const isComplex = isComplexType(newValue);
|
|
520
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
521
|
+
try {
|
|
522
|
+
if (!elm.tagName.includes('-')) {
|
|
523
|
+
const n = newValue == null ? '' : newValue;
|
|
524
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
525
|
+
if (memberName === 'list') {
|
|
526
|
+
isProp = false;
|
|
527
|
+
}
|
|
528
|
+
else if (oldValue == null || elm[memberName] != n) {
|
|
529
|
+
elm[memberName] = n;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
elm[memberName] = newValue;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
catch (e) {
|
|
537
|
+
/**
|
|
538
|
+
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
|
539
|
+
*/
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (newValue == null || newValue === false) {
|
|
543
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
544
|
+
{
|
|
545
|
+
elm.removeAttribute(memberName);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
550
|
+
newValue = newValue === true ? '' : newValue;
|
|
551
|
+
{
|
|
552
|
+
elm.setAttribute(memberName, newValue);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
const parseClassListRegex = /\s/;
|
|
559
|
+
/**
|
|
560
|
+
* Parsed a string of classnames into an array
|
|
561
|
+
* @param value className string, e.g. "foo bar baz"
|
|
562
|
+
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
|
563
|
+
*/
|
|
564
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
|
565
|
+
const CAPTURE_EVENT_SUFFIX = 'Capture';
|
|
566
|
+
const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
|
|
567
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
568
|
+
// if the element passed in is a shadow root, which is a document fragment
|
|
569
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
570
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
|
571
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
572
|
+
? newVnode.$elm$.host
|
|
573
|
+
: newVnode.$elm$;
|
|
574
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
575
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
576
|
+
{
|
|
577
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
|
578
|
+
for (memberName in oldVnodeAttrs) {
|
|
579
|
+
if (!(memberName in newVnodeAttrs)) {
|
|
580
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
// add new & update changed attributes
|
|
585
|
+
for (memberName in newVnodeAttrs) {
|
|
586
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
282
589
|
/**
|
|
283
590
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
284
591
|
*
|
|
@@ -290,18 +597,53 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
290
597
|
* @returns the newly created node
|
|
291
598
|
*/
|
|
292
599
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
600
|
+
var _a;
|
|
293
601
|
// tslint:disable-next-line: prefer-const
|
|
294
602
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
295
603
|
let i = 0;
|
|
296
604
|
let elm;
|
|
297
605
|
let childNode;
|
|
606
|
+
let oldVNode;
|
|
607
|
+
if (!useNativeShadowDom) {
|
|
608
|
+
// remember for later we need to check to relocate nodes
|
|
609
|
+
checkSlotRelocate = true;
|
|
610
|
+
if (newVNode.$tag$ === 'slot') {
|
|
611
|
+
if (scopeId) {
|
|
612
|
+
// scoped css needs to add its scoped id to the parent element
|
|
613
|
+
parentElm.classList.add(scopeId + '-s');
|
|
614
|
+
}
|
|
615
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
616
|
+
? // slot element has fallback content
|
|
617
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
618
|
+
: // slot element does not have fallback content
|
|
619
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
298
622
|
if (newVNode.$text$ !== null) {
|
|
299
623
|
// create text node
|
|
300
624
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
301
625
|
}
|
|
626
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
627
|
+
// create a slot reference node
|
|
628
|
+
elm = newVNode.$elm$ =
|
|
629
|
+
doc.createTextNode('');
|
|
630
|
+
}
|
|
302
631
|
else {
|
|
632
|
+
if (!isSvgMode) {
|
|
633
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
|
634
|
+
}
|
|
303
635
|
// create element
|
|
304
|
-
elm = newVNode.$elm$ = (doc.
|
|
636
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
637
|
+
? 'slot-fb'
|
|
638
|
+
: newVNode.$tag$)
|
|
639
|
+
);
|
|
640
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
641
|
+
isSvgMode = false;
|
|
642
|
+
}
|
|
643
|
+
// add css classes, attrs, props, listeners, etc.
|
|
644
|
+
{
|
|
645
|
+
updateElement(null, newVNode, isSvgMode);
|
|
646
|
+
}
|
|
305
647
|
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
306
648
|
// if there is a scopeId and this is the initial render
|
|
307
649
|
// then let's add the scopeId as a css class
|
|
@@ -310,7 +652,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
310
652
|
if (newVNode.$children$) {
|
|
311
653
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
312
654
|
// create the node
|
|
313
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
655
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
314
656
|
// return node could have been null
|
|
315
657
|
if (childNode) {
|
|
316
658
|
// append our new node
|
|
@@ -318,12 +660,73 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
318
660
|
}
|
|
319
661
|
}
|
|
320
662
|
}
|
|
663
|
+
{
|
|
664
|
+
if (newVNode.$tag$ === 'svg') {
|
|
665
|
+
// Only reset the SVG context when we're exiting <svg> element
|
|
666
|
+
isSvgMode = false;
|
|
667
|
+
}
|
|
668
|
+
else if (elm.tagName === 'foreignObject') {
|
|
669
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
|
670
|
+
isSvgMode = true;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
321
673
|
}
|
|
322
674
|
// This needs to always happen so we can hide nodes that are projected
|
|
323
675
|
// to another component but don't end up in a slot
|
|
324
676
|
elm['s-hn'] = hostTagName;
|
|
677
|
+
{
|
|
678
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
679
|
+
// remember the content reference comment
|
|
680
|
+
elm['s-sr'] = true;
|
|
681
|
+
// Persist the name of the slot that this slot was going to be projected into.
|
|
682
|
+
elm['s-fs'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.slot;
|
|
683
|
+
// remember the content reference comment
|
|
684
|
+
elm['s-cr'] = contentRef;
|
|
685
|
+
// remember the slot name, or empty string for default slot
|
|
686
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
687
|
+
// check if we've got an old vnode for this slot
|
|
688
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
689
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
690
|
+
{
|
|
691
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
692
|
+
// so let's move the old slot content back to its original location
|
|
693
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
325
698
|
return elm;
|
|
326
699
|
};
|
|
700
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
701
|
+
var _a;
|
|
702
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
703
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
704
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
705
|
+
const childNode = oldSlotChildNodes[i];
|
|
706
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
707
|
+
// and relocate it back to it's original location
|
|
708
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
709
|
+
// remove the old original location comment entirely
|
|
710
|
+
// later on the patch function will know what to do
|
|
711
|
+
// and move this to the correct spot if need be
|
|
712
|
+
childNode['s-ol'].remove();
|
|
713
|
+
childNode['s-ol'] = undefined;
|
|
714
|
+
// Reset so we can correctly move the node around again.
|
|
715
|
+
childNode['s-sh'] = undefined;
|
|
716
|
+
// When putting an element node back in its original location,
|
|
717
|
+
// we need to reset the `slot` attribute back to the value it originally had
|
|
718
|
+
// so we can correctly relocate it again in the future
|
|
719
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
720
|
+
childNode.setAttribute('slot', (_a = childNode['s-sn']) !== null && _a !== void 0 ? _a : '');
|
|
721
|
+
}
|
|
722
|
+
checkSlotRelocate = true;
|
|
723
|
+
}
|
|
724
|
+
if (recursive) {
|
|
725
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
729
|
+
};
|
|
327
730
|
/**
|
|
328
731
|
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
329
732
|
* add them to the DOM in the appropriate place.
|
|
@@ -340,17 +743,14 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
340
743
|
* creating DOM nodes (inclusive)
|
|
341
744
|
*/
|
|
342
745
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
343
|
-
let containerElm = (parentElm);
|
|
746
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
344
747
|
let childNode;
|
|
345
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
346
|
-
containerElm = containerElm.shadowRoot;
|
|
347
|
-
}
|
|
348
748
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
349
749
|
if (vnodes[startIdx]) {
|
|
350
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
750
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
351
751
|
if (childNode) {
|
|
352
752
|
vnodes[startIdx].$elm$ = childNode;
|
|
353
|
-
containerElm.insertBefore(childNode, before);
|
|
753
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
354
754
|
}
|
|
355
755
|
}
|
|
356
756
|
}
|
|
@@ -372,6 +772,20 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
372
772
|
if (vnode) {
|
|
373
773
|
const elm = vnode.$elm$;
|
|
374
774
|
if (elm) {
|
|
775
|
+
{
|
|
776
|
+
// we're removing this element
|
|
777
|
+
// so it's possible we need to show slot fallback content now
|
|
778
|
+
checkSlotFallbackVisibility = true;
|
|
779
|
+
if (elm['s-ol']) {
|
|
780
|
+
// remove the original location comment
|
|
781
|
+
elm['s-ol'].remove();
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
// it's possible that child nodes of the node
|
|
785
|
+
// that's being removed are slot nodes
|
|
786
|
+
putBackInOriginalLocation(elm, true);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
375
789
|
// remove the vnode's element from the dom
|
|
376
790
|
elm.remove();
|
|
377
791
|
}
|
|
@@ -489,6 +903,23 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
489
903
|
newEndVnode = newCh[--newEndIdx];
|
|
490
904
|
}
|
|
491
905
|
else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
|
906
|
+
// case: "Vnode moved right"
|
|
907
|
+
//
|
|
908
|
+
// We've found that the last node in our window on the new children is
|
|
909
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
910
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
911
|
+
// nodes:
|
|
912
|
+
//
|
|
913
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
914
|
+
// ^^^^^^^^^^^
|
|
915
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
916
|
+
// ^^^^^^^^^^^^^
|
|
917
|
+
//
|
|
918
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
919
|
+
// and move the DOM element for `oldStartVnode`.
|
|
920
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
921
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
922
|
+
}
|
|
492
923
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
493
924
|
// We need to move the element for `oldStartVnode` into a position which
|
|
494
925
|
// will be appropriate for `newEndVnode`. For this we can use
|
|
@@ -512,6 +943,24 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
512
943
|
newEndVnode = newCh[--newEndIdx];
|
|
513
944
|
}
|
|
514
945
|
else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
946
|
+
// case: "Vnode moved left"
|
|
947
|
+
//
|
|
948
|
+
// We've found that the first node in our window on the new children is
|
|
949
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
950
|
+
// Visually, this is the layout of these two nodes:
|
|
951
|
+
//
|
|
952
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
953
|
+
// ^^^^^^^^^^^^^
|
|
954
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
955
|
+
// ^^^^^^^^^^^
|
|
956
|
+
//
|
|
957
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
958
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
959
|
+
// children etc) but we also need to move the DOM node to which
|
|
960
|
+
// `oldEndVnode` corresponds.
|
|
961
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
962
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
963
|
+
}
|
|
515
964
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
516
965
|
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
517
966
|
// the same node, so since we're here we know that they are not. Thus we
|
|
@@ -528,13 +977,13 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
528
977
|
// the key of the first new child OR the build is not using `key`
|
|
529
978
|
// attributes at all. In either case we need to create a new element
|
|
530
979
|
// for the new node.
|
|
531
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
980
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
532
981
|
newStartVnode = newCh[++newStartIdx];
|
|
533
982
|
}
|
|
534
983
|
if (node) {
|
|
535
984
|
// if we created a new node then handle inserting it to the DOM
|
|
536
985
|
{
|
|
537
|
-
oldStartVnode.$elm
|
|
986
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
538
987
|
}
|
|
539
988
|
}
|
|
540
989
|
}
|
|
@@ -573,10 +1022,21 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
|
573
1022
|
// compare if two vnode to see if they're "technically" the same
|
|
574
1023
|
// need to have the same element tag, and same key to be the same
|
|
575
1024
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1025
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
1026
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
1027
|
+
}
|
|
576
1028
|
return true;
|
|
577
1029
|
}
|
|
578
1030
|
return false;
|
|
579
1031
|
};
|
|
1032
|
+
const referenceNode = (node) => {
|
|
1033
|
+
// this node was relocated to a new location in the dom
|
|
1034
|
+
// because of some other component's slot
|
|
1035
|
+
// but we still have an html comment in place of where
|
|
1036
|
+
// it's original location was according to it's original vdom
|
|
1037
|
+
return (node && node['s-ol']) || node;
|
|
1038
|
+
};
|
|
1039
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
580
1040
|
/**
|
|
581
1041
|
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
582
1042
|
* it. This function handles flushing updates to the DOM and reconciling the
|
|
@@ -590,8 +1050,25 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
590
1050
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
591
1051
|
const oldChildren = oldVNode.$children$;
|
|
592
1052
|
const newChildren = newVNode.$children$;
|
|
1053
|
+
const tag = newVNode.$tag$;
|
|
593
1054
|
const text = newVNode.$text$;
|
|
1055
|
+
let defaultHolder;
|
|
594
1056
|
if (text === null) {
|
|
1057
|
+
{
|
|
1058
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
1059
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
|
1060
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
1061
|
+
}
|
|
1062
|
+
{
|
|
1063
|
+
if (tag === 'slot')
|
|
1064
|
+
;
|
|
1065
|
+
else {
|
|
1066
|
+
// either this is the first render of an element OR it's an update
|
|
1067
|
+
// AND we already know it's possible it could have changed
|
|
1068
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
1069
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
595
1072
|
if (oldChildren !== null && newChildren !== null) {
|
|
596
1073
|
// looks like there's child vnodes for both the old and new vnodes
|
|
597
1074
|
// so we need to call `updateChildren` to reconcile them
|
|
@@ -610,6 +1087,13 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
610
1087
|
// no new child vnodes, but there are old child vnodes to remove
|
|
611
1088
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
612
1089
|
}
|
|
1090
|
+
if (isSvgMode && tag === 'svg') {
|
|
1091
|
+
isSvgMode = false;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1095
|
+
// this element has slotted content
|
|
1096
|
+
defaultHolder.parentNode.textContent = text;
|
|
613
1097
|
}
|
|
614
1098
|
else if (oldVNode.$text$ !== text) {
|
|
615
1099
|
// update the text content for the text only vnode
|
|
@@ -617,6 +1101,183 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
617
1101
|
elm.data = text;
|
|
618
1102
|
}
|
|
619
1103
|
};
|
|
1104
|
+
/**
|
|
1105
|
+
* Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
|
|
1106
|
+
* are slot fallbacks nodes.
|
|
1107
|
+
*
|
|
1108
|
+
* A slot fallback node should be visible by default. Then, it should be
|
|
1109
|
+
* conditionally hidden if:
|
|
1110
|
+
*
|
|
1111
|
+
* - it has a sibling with a `slot` property set to its slot name or if
|
|
1112
|
+
* - it is a default fallback slot node, in which case we hide if it has any
|
|
1113
|
+
* content
|
|
1114
|
+
*
|
|
1115
|
+
* @param elm the element of interest
|
|
1116
|
+
*/
|
|
1117
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
1118
|
+
const childNodes = elm.childNodes;
|
|
1119
|
+
for (const childNode of childNodes) {
|
|
1120
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1121
|
+
if (childNode['s-sr']) {
|
|
1122
|
+
// this is a slot fallback node
|
|
1123
|
+
// get the slot name for this slot reference node
|
|
1124
|
+
const slotName = childNode['s-sn'];
|
|
1125
|
+
// by default always show a fallback slot node
|
|
1126
|
+
// then hide it if there are other slots in the light dom
|
|
1127
|
+
childNode.hidden = false;
|
|
1128
|
+
// we need to check all of its sibling nodes in order to see if
|
|
1129
|
+
// `childNode` should be hidden
|
|
1130
|
+
for (const siblingNode of childNodes) {
|
|
1131
|
+
// Don't check the node against itself
|
|
1132
|
+
if (siblingNode !== childNode) {
|
|
1133
|
+
if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
|
|
1134
|
+
// this sibling node is from a different component OR is a named
|
|
1135
|
+
// fallback slot node
|
|
1136
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
|
1137
|
+
(slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
|
|
1138
|
+
childNode.hidden = true;
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
else {
|
|
1143
|
+
// this is a default fallback slot node
|
|
1144
|
+
// any element or text node (with content)
|
|
1145
|
+
// should hide the default fallback slot node
|
|
1146
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1147
|
+
(siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
|
|
1148
|
+
childNode.hidden = true;
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
// keep drilling down
|
|
1156
|
+
updateFallbackSlotVisibility(childNode);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
/**
|
|
1161
|
+
* Component-global information about nodes which are either currently being
|
|
1162
|
+
* relocated or will be shortly.
|
|
1163
|
+
*/
|
|
1164
|
+
const relocateNodes = [];
|
|
1165
|
+
/**
|
|
1166
|
+
* Mark the contents of a slot for relocation via adding references to them to
|
|
1167
|
+
* the {@link relocateNodes} data structure. The actual work of relocating them
|
|
1168
|
+
* will then be handled in {@link renderVdom}.
|
|
1169
|
+
*
|
|
1170
|
+
* @param elm a render node whose child nodes need to be relocated
|
|
1171
|
+
*/
|
|
1172
|
+
const markSlotContentForRelocation = (elm) => {
|
|
1173
|
+
// tslint:disable-next-line: prefer-const
|
|
1174
|
+
let node;
|
|
1175
|
+
let hostContentNodes;
|
|
1176
|
+
let j;
|
|
1177
|
+
for (const childNode of elm.childNodes) {
|
|
1178
|
+
// we need to find child nodes which are slot references so we can then try
|
|
1179
|
+
// to match them up with nodes that need to be relocated
|
|
1180
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1181
|
+
// first get the content reference comment node ('s-cr'), then we get
|
|
1182
|
+
// its parent, which is where all the host content is now
|
|
1183
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
1184
|
+
const slotName = childNode['s-sn'];
|
|
1185
|
+
// iterate through all the nodes under the location where the host was
|
|
1186
|
+
// originally rendered
|
|
1187
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1188
|
+
node = hostContentNodes[j];
|
|
1189
|
+
// check that the node is not a content reference node or a node
|
|
1190
|
+
// reference and then check that the host name does not match that of
|
|
1191
|
+
// childNode.
|
|
1192
|
+
// In addition, check that the slot either has not already been relocated, or
|
|
1193
|
+
// that its current location's host is not childNode's host. This is essentially
|
|
1194
|
+
// a check so that we don't try to relocate (and then hide) a node that is already
|
|
1195
|
+
// where it should be.
|
|
1196
|
+
if (!node['s-cn'] &&
|
|
1197
|
+
!node['s-nr'] &&
|
|
1198
|
+
node['s-hn'] !== childNode['s-hn'] &&
|
|
1199
|
+
(!BUILD.experimentalSlotFixes )) {
|
|
1200
|
+
// if `node` is located in the slot that `childNode` refers to (via the
|
|
1201
|
+
// `'s-sn'` property) then we need to relocate it from it's current spot
|
|
1202
|
+
// (under the host element parent) to the right slot location
|
|
1203
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1204
|
+
// it's possible we've already decided to relocate this node
|
|
1205
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1206
|
+
// made some changes to slots
|
|
1207
|
+
// let's make sure we also double check
|
|
1208
|
+
// fallbacks are correctly hidden or shown
|
|
1209
|
+
checkSlotFallbackVisibility = true;
|
|
1210
|
+
// ensure that the slot-name attr is correct
|
|
1211
|
+
node['s-sn'] = node['s-sn'] || slotName;
|
|
1212
|
+
if (relocateNodeData) {
|
|
1213
|
+
relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
|
|
1214
|
+
// we marked this node for relocation previously but didn't find
|
|
1215
|
+
// out the slot reference node to which it needs to be relocated
|
|
1216
|
+
// so write it down now!
|
|
1217
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
node['s-sh'] = childNode['s-hn'];
|
|
1221
|
+
// add to our list of nodes to relocate
|
|
1222
|
+
relocateNodes.push({
|
|
1223
|
+
$slotRefNode$: childNode,
|
|
1224
|
+
$nodeToRelocate$: node,
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
if (node['s-sr']) {
|
|
1228
|
+
relocateNodes.map((relocateNode) => {
|
|
1229
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
1230
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1231
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1232
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1239
|
+
// the node is not found within the slot (`childNode`) that we're
|
|
1240
|
+
// currently looking at, so we stick it into `relocateNodes` to
|
|
1241
|
+
// handle later. If we never find a home for this element then
|
|
1242
|
+
// we'll need to hide it
|
|
1243
|
+
relocateNodes.push({
|
|
1244
|
+
$nodeToRelocate$: node,
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
// if we're dealing with any type of element (capable of itself being a
|
|
1251
|
+
// slot reference or containing one) then we recur
|
|
1252
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1253
|
+
markSlotContentForRelocation(childNode);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
/**
|
|
1258
|
+
* Check whether a node is located in a given named slot.
|
|
1259
|
+
*
|
|
1260
|
+
* @param nodeToRelocate the node of interest
|
|
1261
|
+
* @param slotName the slot name to check
|
|
1262
|
+
* @returns whether the node is located in the slot or not
|
|
1263
|
+
*/
|
|
1264
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
1265
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1266
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
|
|
1267
|
+
// if the node doesn't have a slot attribute, and the slot we're checking
|
|
1268
|
+
// is not a named slot, then we assume the node should be within the slot
|
|
1269
|
+
return true;
|
|
1270
|
+
}
|
|
1271
|
+
if (nodeToRelocate.getAttribute('slot') === slotName) {
|
|
1272
|
+
return true;
|
|
1273
|
+
}
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
if (nodeToRelocate['s-sn'] === slotName) {
|
|
1277
|
+
return true;
|
|
1278
|
+
}
|
|
1279
|
+
return slotName === '';
|
|
1280
|
+
};
|
|
620
1281
|
/**
|
|
621
1282
|
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
622
1283
|
*
|
|
@@ -631,7 +1292,9 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
631
1292
|
* @param isInitialLoad whether or not this is the first call after page load
|
|
632
1293
|
*/
|
|
633
1294
|
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
1295
|
+
var _a, _b, _c, _d;
|
|
634
1296
|
const hostElm = hostRef.$hostElement$;
|
|
1297
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
635
1298
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
636
1299
|
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
|
637
1300
|
// we need to call `h` again to wrap the children of our component in a
|
|
@@ -664,12 +1327,114 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
664
1327
|
rootVnode.$tag$ = null;
|
|
665
1328
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
666
1329
|
hostRef.$vnode$ = rootVnode;
|
|
667
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
1330
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
668
1331
|
{
|
|
669
1332
|
scopeId = hostElm['s-sc'];
|
|
670
1333
|
}
|
|
1334
|
+
{
|
|
1335
|
+
contentRef = hostElm['s-cr'];
|
|
1336
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1337
|
+
// always reset
|
|
1338
|
+
checkSlotFallbackVisibility = false;
|
|
1339
|
+
}
|
|
671
1340
|
// synchronous patch
|
|
672
1341
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
1342
|
+
{
|
|
1343
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
1344
|
+
// the disconnectCallback from working
|
|
1345
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1346
|
+
if (checkSlotRelocate) {
|
|
1347
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1348
|
+
for (const relocateData of relocateNodes) {
|
|
1349
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1350
|
+
if (!nodeToRelocate['s-ol']) {
|
|
1351
|
+
// add a reference node marking this node's original location
|
|
1352
|
+
// keep a reference to this node for later lookups
|
|
1353
|
+
const orgLocationNode = doc.createTextNode('');
|
|
1354
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1355
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
for (const relocateData of relocateNodes) {
|
|
1359
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1360
|
+
const slotRefNode = relocateData.$slotRefNode$;
|
|
1361
|
+
if (slotRefNode) {
|
|
1362
|
+
const parentNodeRef = slotRefNode.parentNode;
|
|
1363
|
+
// When determining where to insert content, the most simple case would be
|
|
1364
|
+
// to relocate the node immediately following the slot reference node. We do this
|
|
1365
|
+
// by getting a reference to the node immediately following the slot reference node
|
|
1366
|
+
// since we will use `insertBefore` to manipulate the DOM.
|
|
1367
|
+
//
|
|
1368
|
+
// If there is no node immediately following the slot reference node, then we will just
|
|
1369
|
+
// end up appending the node as the last child of the parent.
|
|
1370
|
+
let insertBeforeNode = slotRefNode.nextSibling;
|
|
1371
|
+
// If the node we're currently planning on inserting the new node before is an element,
|
|
1372
|
+
// we need to do some additional checks to make sure we're inserting the node in the correct order.
|
|
1373
|
+
// The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
|
|
1374
|
+
// to make sure they get inserted into their new how in the same order they were declared in their original location.
|
|
1375
|
+
//
|
|
1376
|
+
// TODO(STENCIL-914): Remove `experimentalSlotFixes` check
|
|
1377
|
+
{
|
|
1378
|
+
let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
|
|
1379
|
+
while (orgLocationNode) {
|
|
1380
|
+
let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
|
|
1381
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1382
|
+
refNode = refNode.nextSibling;
|
|
1383
|
+
if (!refNode || !refNode['s-nr']) {
|
|
1384
|
+
insertBeforeNode = refNode;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
orgLocationNode = orgLocationNode.previousSibling;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1392
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1393
|
+
// we've checked that it's worth while to relocate
|
|
1394
|
+
// since that the node to relocate
|
|
1395
|
+
// has a different next sibling or parent relocated
|
|
1396
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
1397
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1398
|
+
// probably a component in the index.html that doesn't have its hostname set
|
|
1399
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1400
|
+
}
|
|
1401
|
+
// Add it back to the dom but in its new home
|
|
1402
|
+
// If we get to this point and `insertBeforeNode` is `null`, that means
|
|
1403
|
+
// we're just going to append the node as the last child of the parent. Passing
|
|
1404
|
+
// `null` as the second arg here will trigger that behavior.
|
|
1405
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1406
|
+
// Reset the `hidden` value back to what it was defined as originally
|
|
1407
|
+
// This solves a problem where a `slot` is dynamically rendered and `hidden` may have
|
|
1408
|
+
// been set on content originally, but now it has a slot to go to so it should have
|
|
1409
|
+
// the value it was defined as having in the DOM, not what we overrode it to.
|
|
1410
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1411
|
+
nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
1418
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1419
|
+
// Store the initial value of `hidden` so we can reset it later when
|
|
1420
|
+
// moving nodes around.
|
|
1421
|
+
if (isInitialLoad) {
|
|
1422
|
+
nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
|
|
1423
|
+
}
|
|
1424
|
+
nodeToRelocate.hidden = true;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (checkSlotFallbackVisibility) {
|
|
1430
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1431
|
+
}
|
|
1432
|
+
// done moving nodes around
|
|
1433
|
+
// allow the disconnect callback to work again
|
|
1434
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1435
|
+
// always reset
|
|
1436
|
+
relocateNodes.length = 0;
|
|
1437
|
+
}
|
|
673
1438
|
};
|
|
674
1439
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
675
1440
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
@@ -717,6 +1482,26 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
717
1482
|
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
718
1483
|
// called in order after `dispatchHooks` exits.
|
|
719
1484
|
let maybePromise;
|
|
1485
|
+
if (isInitialLoad) {
|
|
1486
|
+
{
|
|
1487
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
|
1488
|
+
// whatever's going on in that `Promise` before we launch into
|
|
1489
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
|
1490
|
+
// in that case we assign the returned promise to the variable we
|
|
1491
|
+
// declared above to hold a possible 'queueing' Promise
|
|
1492
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
{
|
|
1497
|
+
// Like `componentWillLoad` above, we allow Stencil component
|
|
1498
|
+
// authors to return a `Promise` from this lifecycle callback, and
|
|
1499
|
+
// we specify that our runtime will wait for that `Promise` to
|
|
1500
|
+
// resolve before the component re-renders. So if the method
|
|
1501
|
+
// returns a `Promise` we need to keep it around!
|
|
1502
|
+
maybePromise = safeCall(instance, 'componentWillUpdate');
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
720
1505
|
endSchedule();
|
|
721
1506
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
722
1507
|
};
|
|
@@ -839,6 +1624,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
839
1624
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
840
1625
|
const elm = hostRef.$hostElement$;
|
|
841
1626
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1627
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
842
1628
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
843
1629
|
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
844
1630
|
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
@@ -846,6 +1632,9 @@ const postUpdateComponent = (hostRef) => {
|
|
|
846
1632
|
// DOM WRITE!
|
|
847
1633
|
addHydratedFlag(elm);
|
|
848
1634
|
}
|
|
1635
|
+
{
|
|
1636
|
+
safeCall(instance, 'componentDidLoad');
|
|
1637
|
+
}
|
|
849
1638
|
endPostUpdate();
|
|
850
1639
|
{
|
|
851
1640
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -881,6 +1670,27 @@ const appDidLoad = (who) => {
|
|
|
881
1670
|
}
|
|
882
1671
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
883
1672
|
};
|
|
1673
|
+
/**
|
|
1674
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
|
1675
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
|
1676
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
|
1677
|
+
* output bundle and this function returns `undefined`.
|
|
1678
|
+
* @param instance any object that may or may not contain methods
|
|
1679
|
+
* @param method method name
|
|
1680
|
+
* @param arg single arbitrary argument
|
|
1681
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
|
1682
|
+
*/
|
|
1683
|
+
const safeCall = (instance, method, arg) => {
|
|
1684
|
+
if (instance && instance[method]) {
|
|
1685
|
+
try {
|
|
1686
|
+
return instance[method](arg);
|
|
1687
|
+
}
|
|
1688
|
+
catch (e) {
|
|
1689
|
+
consoleError(e);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
return undefined;
|
|
1693
|
+
};
|
|
884
1694
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
885
1695
|
;
|
|
886
1696
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1091,6 +1901,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1091
1901
|
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1092
1902
|
}
|
|
1093
1903
|
endNewInstance();
|
|
1904
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1094
1905
|
}
|
|
1095
1906
|
if (Cstr.style) {
|
|
1096
1907
|
// this component has styles but we haven't registered them yet
|
|
@@ -1120,6 +1931,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1120
1931
|
}
|
|
1121
1932
|
};
|
|
1122
1933
|
const fireConnectedCallback = (instance) => {
|
|
1934
|
+
{
|
|
1935
|
+
safeCall(instance, 'connectedCallback');
|
|
1936
|
+
}
|
|
1123
1937
|
};
|
|
1124
1938
|
const connectedCallback = (elm) => {
|
|
1125
1939
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
@@ -1129,6 +1943,16 @@ const connectedCallback = (elm) => {
|
|
|
1129
1943
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1130
1944
|
// first time this component has connected
|
|
1131
1945
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1946
|
+
{
|
|
1947
|
+
// initUpdate
|
|
1948
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1949
|
+
// in here to act as original content anchors as we move nodes around
|
|
1950
|
+
// host element has been connected to the DOM
|
|
1951
|
+
if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
1952
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1953
|
+
setContentReference(elm);
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1132
1956
|
{
|
|
1133
1957
|
// find the first ancestor component (if there is one) and register
|
|
1134
1958
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1161,22 +1985,40 @@ const connectedCallback = (elm) => {
|
|
|
1161
1985
|
}
|
|
1162
1986
|
else {
|
|
1163
1987
|
// fire off connectedCallback() on component instance
|
|
1164
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$)
|
|
1988
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
1989
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1990
|
+
}
|
|
1165
1991
|
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1166
|
-
hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
|
|
1992
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
|
|
1167
1993
|
}
|
|
1168
1994
|
}
|
|
1169
1995
|
endConnected();
|
|
1170
1996
|
}
|
|
1171
1997
|
};
|
|
1998
|
+
const setContentReference = (elm) => {
|
|
1999
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
2000
|
+
// or this browser doesn't support native shadow dom
|
|
2001
|
+
// and this host element was NOT created with SSR
|
|
2002
|
+
// let's pick out the inner content for slot projection
|
|
2003
|
+
// create a node to represent where the original
|
|
2004
|
+
// content was first placed, which is useful later on
|
|
2005
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
2006
|
+
contentRefElm['s-cn'] = true;
|
|
2007
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
2008
|
+
};
|
|
1172
2009
|
const disconnectInstance = (instance) => {
|
|
2010
|
+
{
|
|
2011
|
+
safeCall(instance, 'disconnectedCallback');
|
|
2012
|
+
}
|
|
1173
2013
|
};
|
|
1174
2014
|
const disconnectedCallback = async (elm) => {
|
|
1175
2015
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1176
2016
|
const hostRef = getHostRef(elm);
|
|
1177
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$)
|
|
2017
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
2018
|
+
disconnectInstance(hostRef.$lazyInstance$);
|
|
2019
|
+
}
|
|
1178
2020
|
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1179
|
-
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
|
2021
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
|
1180
2022
|
}
|
|
1181
2023
|
}
|
|
1182
2024
|
};
|
|
@@ -1219,17 +2061,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1219
2061
|
super(self);
|
|
1220
2062
|
self = this;
|
|
1221
2063
|
registerHost(self, cmpMeta);
|
|
1222
|
-
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1223
|
-
// this component is using shadow dom
|
|
1224
|
-
// and this browser supports shadow dom
|
|
1225
|
-
// add the read-only property "shadowRoot" to the host element
|
|
1226
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
1227
|
-
{
|
|
1228
|
-
{
|
|
1229
|
-
self.attachShadow({ mode: 'open' });
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
2064
|
}
|
|
1234
2065
|
connectedCallback() {
|
|
1235
2066
|
if (appLoadFallback) {
|
|
@@ -1291,6 +2122,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1291
2122
|
// Fallback appLoad event
|
|
1292
2123
|
endBootstrap();
|
|
1293
2124
|
};
|
|
2125
|
+
const Fragment = (_, children) => children;
|
|
1294
2126
|
/**
|
|
1295
2127
|
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1296
2128
|
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
@@ -1342,6 +2174,7 @@ const registerHost = (hostElement, cmpMeta) => {
|
|
|
1342
2174
|
}
|
|
1343
2175
|
return hostRefs.set(hostElement, hostRef);
|
|
1344
2176
|
};
|
|
2177
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1345
2178
|
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1346
2179
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1347
2180
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
@@ -1430,10 +2263,13 @@ const flush = () => {
|
|
|
1430
2263
|
const nextTick = (cb) => promiseResolve().then(cb);
|
|
1431
2264
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1432
2265
|
|
|
2266
|
+
exports.Fragment = Fragment;
|
|
2267
|
+
exports.Host = Host;
|
|
1433
2268
|
exports.bootstrapLazy = bootstrapLazy;
|
|
2269
|
+
exports.createEvent = createEvent;
|
|
1434
2270
|
exports.h = h;
|
|
1435
2271
|
exports.promiseResolve = promiseResolve;
|
|
1436
2272
|
exports.registerInstance = registerInstance;
|
|
1437
2273
|
exports.setNonce = setNonce;
|
|
1438
2274
|
|
|
1439
|
-
//# sourceMappingURL=index-
|
|
2275
|
+
//# sourceMappingURL=index-e52034b7.js.map
|