@onsvisual/svelte-components 0.1.104 → 1.0.0-next.1
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/dist/css/main.css +500 -4
- package/dist/datavis/BarChart/BarChart.stories.svelte +84 -0
- package/dist/datavis/BarChart/BarChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/BarChart/docs/component.md +19 -0
- package/dist/datavis/Chart/Chart.stories.svelte +128 -0
- package/dist/datavis/Chart/Chart.stories.svelte.d.ts +23 -0
- package/dist/datavis/Chart/docs/component.md +31 -0
- package/dist/datavis/Chart/docs/example.md +28 -0
- package/dist/datavis/ColumnChart/ColumnChart.stories.svelte +84 -0
- package/dist/datavis/ColumnChart/ColumnChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/ColumnChart/docs/component.md +19 -0
- package/dist/datavis/DotPlotChart/DotPlotChart.stories.svelte +40 -0
- package/dist/datavis/DotPlotChart/DotPlotChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/DotPlotChart/docs/component.md +19 -0
- package/dist/datavis/LineChart/LineChart.stories.svelte +64 -0
- package/dist/datavis/LineChart/LineChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/LineChart/docs/component.md +31 -0
- package/dist/datavis/ScatterChart/ScatterChart.stories.svelte +55 -0
- package/dist/datavis/ScatterChart/ScatterChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/ScatterChart/docs/component.md +53 -0
- package/dist/datavis/Table/Table.stories.svelte +32 -0
- package/dist/{@types/datavis/Table/Table.svelte.d.ts → datavis/Table/Table.stories.svelte.d.ts} +2 -16
- package/dist/datavis/Table/Table.svelte +141 -149
- package/dist/datavis/Table/Table.svelte.d.ts +35 -0
- package/dist/datavis/Table/docs/component.md +20 -0
- package/dist/datavis/intro.mdx +22 -0
- package/dist/decorators/Blockquote/Blockquote.stories.svelte +25 -0
- package/dist/decorators/Blockquote/Blockquote.stories.svelte.d.ts +23 -0
- package/dist/decorators/Blockquote/Blockquote.svelte +22 -22
- package/dist/{@types/decorators → decorators}/Blockquote/Blockquote.svelte.d.ts +2 -2
- package/dist/decorators/Blockquote/docs/component.md +10 -0
- package/dist/decorators/Divider/Divider.stories.svelte +29 -0
- package/dist/decorators/Divider/Divider.stories.svelte.d.ts +23 -0
- package/dist/decorators/Divider/Divider.svelte +40 -59
- package/dist/{@types/decorators → decorators}/Divider/Divider.svelte.d.ts +10 -14
- package/dist/decorators/Divider/docs/component.md +12 -0
- package/dist/decorators/Em/Em.stories.svelte +30 -0
- package/dist/{@types/decorators/Em/Em.svelte.d.ts → decorators/Em/Em.stories.svelte.d.ts} +4 -10
- package/dist/decorators/Em/Em.svelte +42 -25
- package/dist/decorators/Em/Em.svelte.d.ts +33 -0
- package/dist/decorators/Em/docs/component.md +12 -0
- package/dist/decorators/Indent/Indent.stories.svelte +22 -0
- package/dist/decorators/Indent/Indent.stories.svelte.d.ts +23 -0
- package/dist/decorators/Indent/Indent.svelte +3 -0
- package/dist/decorators/Indent/Indent.svelte.d.ts +27 -0
- package/dist/decorators/Indent/docs/component.md +10 -0
- package/dist/{@types/index.d.ts → index.d.ts} +10 -10
- package/dist/index.js +13 -8
- package/dist/inputs/Button/Button.stories.svelte +65 -0
- package/dist/inputs/Button/Button.stories.svelte.d.ts +23 -0
- package/dist/inputs/Button/Button.svelte +113 -113
- package/dist/inputs/Button/Button.svelte.d.ts +51 -0
- package/dist/inputs/Button/Icon.svelte +44 -44
- package/dist/{@types/inputs → inputs}/Button/Icon.svelte.d.ts +6 -6
- package/dist/inputs/Button/docs/component.md +17 -0
- package/dist/inputs/Checkbox/Checkbox.stories.svelte +34 -0
- package/dist/inputs/Checkbox/Checkbox.stories.svelte.d.ts +23 -0
- package/dist/inputs/Checkbox/Checkbox.svelte +145 -152
- package/dist/{@types/inputs → inputs}/Checkbox/Checkbox.svelte.d.ts +16 -16
- package/dist/inputs/Checkbox/docs/component.md +14 -0
- package/dist/inputs/Checkboxes/Checkboxes.stories.svelte +42 -0
- package/dist/inputs/Checkboxes/Checkboxes.stories.svelte.d.ts +23 -0
- package/dist/inputs/Checkboxes/Checkboxes.svelte +29 -29
- package/dist/{@types/inputs → inputs}/Checkboxes/Checkboxes.svelte.d.ts +8 -8
- package/dist/inputs/Checkboxes/docs/component.md +20 -0
- package/dist/inputs/Checkboxes/docs/example.md +16 -0
- package/dist/inputs/Dropdown/Dropdown.stories.svelte +54 -0
- package/dist/{@types/inputs/Dropdown/Dropdown.svelte.d.ts → inputs/Dropdown/Dropdown.stories.svelte.d.ts} +2 -16
- package/dist/inputs/Dropdown/Dropdown.svelte +49 -55
- package/dist/inputs/Dropdown/Dropdown.svelte.d.ts +37 -0
- package/dist/inputs/Dropdown/docs/component.md +22 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.stories.svelte +25 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.stories.svelte.d.ts +23 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.svelte +14 -30
- package/dist/{@types/inputs → inputs}/ErrorPanel/ErrorPanel.svelte.d.ts +2 -2
- package/dist/inputs/ErrorPanel/docs/component.md +14 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.stories.svelte +34 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.stories.svelte.d.ts +23 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.svelte +34 -32
- package/dist/{@types/inputs → inputs}/ErrorSummary/ErrorSummary.svelte.d.ts +4 -4
- package/dist/inputs/ErrorSummary/docs/component.md +17 -0
- package/dist/inputs/ErrorSummary/docs/example.md +12 -0
- package/dist/inputs/Input/Input.stories.svelte +73 -0
- package/dist/inputs/Input/Input.stories.svelte.d.ts +23 -0
- package/dist/inputs/Input/Input.svelte +125 -156
- package/dist/inputs/Input/Input.svelte.d.ts +51 -0
- package/dist/inputs/Input/docs/component.md +16 -0
- package/dist/inputs/Radios/Radio.svelte +68 -102
- package/dist/{@types/inputs → inputs}/Radios/Radio.svelte.d.ts +6 -6
- package/dist/inputs/Radios/Radios.stories.svelte +51 -0
- package/dist/inputs/Radios/Radios.stories.svelte.d.ts +23 -0
- package/dist/inputs/Radios/Radios.svelte +38 -38
- package/dist/{@types/inputs → inputs}/Radios/Radios.svelte.d.ts +10 -10
- package/dist/inputs/Radios/docs/component.md +24 -0
- package/dist/inputs/Radios/docs/example.md +21 -0
- package/dist/inputs/Select/Select.stories.svelte +61 -0
- package/dist/inputs/Select/Select.stories.svelte.d.ts +23 -0
- package/dist/inputs/Select/Select.svelte +271 -289
- package/dist/inputs/Select/Select.svelte.d.ts +58 -0
- package/dist/inputs/Select/docs/component.md +27 -0
- package/dist/inputs/Textarea/Textarea.stories.svelte +40 -0
- package/dist/{@types/inputs/Textarea/Textarea.svelte.d.ts → inputs/Textarea/Textarea.stories.svelte.d.ts} +2 -16
- package/dist/inputs/Textarea/Textarea.svelte +93 -89
- package/dist/inputs/Textarea/Textarea.svelte.d.ts +37 -0
- package/dist/inputs/Textarea/docs/component.md +16 -0
- package/dist/intro.mdx +60 -0
- package/dist/js/menuOptions.js +14 -0
- package/dist/{@types/js → js}/utils.d.ts +8 -2
- package/dist/js/utils.js +61 -44
- package/dist/{@types/js → js}/withParams.d.ts +3 -9
- package/dist/js/withParams.js +17 -20
- package/dist/layout/Accordion/Accordion.stories.svelte +30 -0
- package/dist/{@types/layout/Accordion/Accordion.svelte.d.ts → layout/Accordion/Accordion.stories.svelte.d.ts} +4 -8
- package/dist/layout/Accordion/Accordion.svelte +49 -29
- package/dist/layout/Accordion/Accordion.svelte.d.ts +31 -0
- package/dist/layout/Accordion/AccordionItem.svelte +46 -81
- package/dist/{@types/layout → layout}/Accordion/AccordionItem.svelte.d.ts +6 -6
- package/dist/layout/Accordion/accordion.d.ts +18 -0
- package/dist/layout/Accordion/accordion.js +64 -0
- package/dist/layout/Accordion/details.d.ts +14 -0
- package/dist/layout/Accordion/details.js +83 -0
- package/dist/layout/Accordion/docs/component.md +19 -0
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.stories.svelte +16 -0
- package/dist/{@types/layout/AnalyticsBanner/AnalyticsBanner.svelte.d.ts → layout/AnalyticsBanner/AnalyticsBanner.stories.svelte.d.ts} +2 -13
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte +284 -273
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte.d.ts +36 -0
- package/dist/layout/AnalyticsBanner/docs/component.md +17 -0
- package/dist/layout/BackLink/BackLink.stories.svelte +16 -0
- package/dist/layout/BackLink/BackLink.stories.svelte.d.ts +23 -0
- package/dist/layout/BackLink/BackLink.svelte +30 -0
- package/dist/layout/BackLink/BackLink.svelte.d.ts +25 -0
- package/dist/layout/BackLink/docs/component.md +12 -0
- package/dist/layout/Breadcrumb/Breadcrumb.stories.svelte +31 -0
- package/dist/layout/Breadcrumb/Breadcrumb.stories.svelte.d.ts +23 -0
- package/dist/layout/Breadcrumb/Breadcrumb.svelte +44 -67
- package/dist/{@types/layout → layout}/Breadcrumb/Breadcrumb.svelte.d.ts +6 -12
- package/dist/layout/Breadcrumb/docs/component.md +15 -0
- package/dist/layout/Card/Card.stories.svelte +39 -0
- package/dist/layout/Card/Card.stories.svelte.d.ts +23 -0
- package/dist/layout/Card/Card.svelte +120 -0
- package/dist/layout/Card/Card.svelte.d.ts +49 -0
- package/dist/layout/Card/docs/component.md +14 -0
- package/dist/layout/Card/docs/eg-images.md +27 -0
- package/dist/layout/Card/docs/eg-links.md +12 -0
- package/dist/layout/Card/docs/eg-spans.md +12 -0
- package/dist/layout/Contents/Contents.stories.svelte +27 -0
- package/dist/{@types/layout/Contents/Contents.svelte.d.ts → layout/Contents/Contents.stories.svelte.d.ts} +2 -8
- package/dist/layout/Contents/Contents.svelte +42 -40
- package/dist/layout/Contents/Contents.svelte.d.ts +29 -0
- package/dist/layout/Contents/docs/component.md +18 -0
- package/dist/layout/DescriptionList/DescriptionList.stories.svelte +22 -0
- package/dist/layout/DescriptionList/DescriptionList.stories.svelte.d.ts +23 -0
- package/dist/layout/DescriptionList/DescriptionList.svelte +48 -0
- package/dist/layout/DescriptionList/DescriptionList.svelte.d.ts +27 -0
- package/dist/layout/DescriptionList/docs/component.md +18 -0
- package/dist/layout/Details/Details.stories.svelte +32 -0
- package/dist/layout/Details/Details.stories.svelte.d.ts +23 -0
- package/dist/layout/Details/Details.svelte +70 -0
- package/dist/layout/Details/Details.svelte.d.ts +35 -0
- package/dist/layout/Details/docs/component.md +14 -0
- package/dist/layout/DocumentList/Document.svelte +103 -0
- package/dist/layout/DocumentList/Document.svelte.d.ts +39 -0
- package/dist/layout/DocumentList/DocumentList.stories.svelte +73 -0
- package/dist/layout/DocumentList/DocumentList.stories.svelte.d.ts +23 -0
- package/dist/layout/DocumentList/DocumentList.svelte +17 -0
- package/dist/layout/DocumentList/DocumentList.svelte.d.ts +27 -0
- package/dist/layout/DocumentList/docs/component.md +28 -0
- package/dist/layout/DocumentList/docs/example.md +23 -0
- package/dist/layout/ErrorPage/ErrorPage.stories.svelte +18 -0
- package/dist/{@types/layout/ErrorPage/ErrorPage.svelte.d.ts → layout/ErrorPage/ErrorPage.stories.svelte.d.ts} +2 -6
- package/dist/layout/ErrorPage/ErrorPage.svelte +45 -40
- package/dist/layout/ErrorPage/ErrorPage.svelte.d.ts +29 -0
- package/dist/layout/ErrorPage/docs/component.md +13 -0
- package/dist/layout/Footer/Footer.stories.svelte +24 -0
- package/dist/{@types/layout/Footer/Footer.svelte.d.ts → layout/Footer/Footer.stories.svelte.d.ts} +4 -12
- package/dist/layout/Footer/Footer.svelte +372 -257
- package/dist/layout/Footer/Footer.svelte.d.ts +27 -0
- package/dist/layout/Footer/docs/component.md +10 -0
- package/dist/layout/Grid/Grid.stories.svelte +50 -0
- package/dist/layout/Grid/Grid.stories.svelte.d.ts +23 -0
- package/dist/layout/Grid/Grid.svelte +110 -160
- package/dist/layout/Grid/Grid.svelte.d.ts +49 -0
- package/dist/layout/Grid/GridCell.svelte +65 -0
- package/dist/layout/Grid/GridCell.svelte.d.ts +27 -0
- package/dist/layout/Grid/docs/component.md +14 -0
- package/dist/layout/Header/Header.stories.svelte +26 -0
- package/dist/{@types/layout/Header/Header.svelte.d.ts → layout/Header/Header.stories.svelte.d.ts} +4 -20
- package/dist/layout/Header/Header.svelte +842 -612
- package/dist/layout/Header/Header.svelte.d.ts +39 -0
- package/dist/layout/Header/docs/component.md +11 -0
- package/dist/layout/Hero/Hero.stories.svelte +77 -0
- package/dist/layout/Hero/Hero.stories.svelte.d.ts +23 -0
- package/dist/layout/Hero/Hero.svelte +350 -80
- package/dist/layout/Hero/Hero.svelte.d.ts +55 -0
- package/dist/layout/Hero/docs/component.md +14 -0
- package/dist/layout/Highlight/Highlight.stories.svelte +29 -0
- package/dist/layout/Highlight/Highlight.stories.svelte.d.ts +23 -0
- package/dist/layout/Highlight/Highlight.svelte +78 -66
- package/dist/layout/Highlight/Highlight.svelte.d.ts +45 -0
- package/dist/layout/Highlight/docs/component.md +12 -0
- package/dist/layout/Image/Image.stories.svelte +23 -0
- package/dist/layout/Image/Image.stories.svelte.d.ts +23 -0
- package/dist/layout/Image/Image.svelte +24 -0
- package/dist/layout/Image/Image.svelte.d.ts +27 -0
- package/dist/layout/Image/docs/component.md +15 -0
- package/dist/layout/List/Li.svelte +3 -0
- package/dist/layout/List/Li.svelte.d.ts +27 -0
- package/dist/layout/List/List.stories.svelte +40 -0
- package/dist/{@types/layout/List/List.svelte.d.ts → layout/List/List.stories.svelte.d.ts} +4 -8
- package/dist/layout/List/List.svelte +34 -25
- package/dist/layout/List/List.svelte.d.ts +29 -0
- package/dist/layout/List/docs/component.md +14 -0
- package/dist/layout/List/docs/example.md +12 -0
- package/dist/layout/NavSections/NavSection.svelte +66 -66
- package/dist/{@types/layout → layout}/NavSections/NavSection.svelte.d.ts +10 -10
- package/dist/layout/NavSections/NavSections.stories.svelte +48 -0
- package/dist/layout/NavSections/NavSections.stories.svelte.d.ts +23 -0
- package/dist/layout/NavSections/NavSections.svelte +135 -183
- package/dist/{@types/layout → layout}/NavSections/NavSections.svelte.d.ts +14 -24
- package/dist/layout/NavSections/docs/component.md +27 -0
- package/dist/layout/Notice/Notice.stories.svelte +61 -0
- package/dist/layout/Notice/Notice.stories.svelte.d.ts +23 -0
- package/dist/layout/Notice/Notice.svelte +45 -54
- package/dist/{@types/layout → layout}/Notice/Notice.svelte.d.ts +2 -6
- package/dist/layout/Notice/docs/component.md +14 -0
- package/dist/layout/PhaseBanner/PhaseBanner.stories.svelte +24 -0
- package/dist/{@types/layout/PhaseBanner/PhaseBanner.svelte.d.ts → layout/PhaseBanner/PhaseBanner.stories.svelte.d.ts} +2 -4
- package/dist/layout/PhaseBanner/PhaseBanner.svelte +56 -35
- package/dist/layout/PhaseBanner/PhaseBanner.svelte.d.ts +25 -0
- package/dist/layout/PhaseBanner/docs/component.md +14 -0
- package/dist/layout/RelatedContent/RelatedContent.stories.svelte +36 -0
- package/dist/{@types/layout/RelatedContent/RelatedContent.svelte.d.ts → layout/RelatedContent/RelatedContent.stories.svelte.d.ts} +2 -2
- package/dist/layout/RelatedContent/RelatedContent.svelte +44 -54
- package/dist/layout/RelatedContent/RelatedContent.svelte.d.ts +31 -0
- package/dist/layout/RelatedContent/docs/component.md +16 -0
- package/dist/layout/Scroller/Scroller.stories.svelte +61 -0
- package/dist/layout/Scroller/Scroller.stories.svelte.d.ts +23 -0
- package/dist/layout/Scroller/Scroller.svelte +341 -331
- package/dist/{@types/layout → layout}/Scroller/Scroller.svelte.d.ts +22 -20
- package/dist/layout/Scroller/ScrollerSection.svelte +54 -73
- package/dist/{@types/layout → layout}/Scroller/ScrollerSection.svelte.d.ts +6 -12
- package/dist/layout/Scroller/docs/component.md +41 -0
- package/dist/layout/Section/Section.stories.svelte +33 -0
- package/dist/layout/Section/Section.stories.svelte.d.ts +23 -0
- package/dist/layout/Section/Section.svelte +53 -77
- package/dist/layout/Section/Section.svelte.d.ts +41 -0
- package/dist/layout/Section/docs/component.md +12 -0
- package/dist/layout/ShareButtons/ShareButtons.stories.svelte +20 -0
- package/dist/layout/ShareButtons/ShareButtons.stories.svelte.d.ts +23 -0
- package/dist/layout/ShareButtons/ShareButtons.svelte +118 -175
- package/dist/{@types/layout → layout}/ShareButtons/ShareButtons.svelte.d.ts +6 -14
- package/dist/layout/ShareButtons/docs/component.md +14 -0
- package/dist/layout/SkipLink/SkipLink.stories.svelte +16 -0
- package/dist/{@types/layout/SkipLink/SkipLink.svelte.d.ts → layout/SkipLink/SkipLink.stories.svelte.d.ts} +2 -2
- package/dist/layout/SkipLink/SkipLink.svelte +6 -6
- package/dist/layout/SkipLink/SkipLink.svelte.d.ts +23 -0
- package/dist/layout/SkipLink/docs/component.md +11 -0
- package/dist/layout/Summary/Summary.stories.svelte +21 -0
- package/dist/{@types/layout/Summary/Summary.svelte.d.ts → layout/Summary/Summary.stories.svelte.d.ts} +2 -4
- package/dist/layout/Summary/Summary.svelte +50 -46
- package/dist/layout/Summary/Summary.svelte.d.ts +31 -0
- package/dist/layout/Summary/docs/component.md +17 -0
- package/dist/layout/Tabs/Tab.svelte +42 -42
- package/dist/{@types/layout → layout}/Tabs/Tab.svelte.d.ts +6 -6
- package/dist/layout/Tabs/Tabs.stories.svelte +29 -0
- package/dist/layout/Tabs/Tabs.stories.svelte.d.ts +23 -0
- package/dist/layout/Tabs/Tabs.svelte +71 -97
- package/dist/{@types/layout → layout}/Tabs/Tabs.svelte.d.ts +6 -6
- package/dist/layout/Tabs/docs/component.md +16 -0
- package/dist/layout/Tabs/tabs.d.ts +43 -0
- package/dist/layout/Tabs/tabs.js +302 -0
- package/dist/templates/EmbedArticle/EmbedArticle.stories.svelte +72 -0
- package/dist/templates/EmbedArticle/EmbedArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/EmbedArticle/docs/component.md +56 -0
- package/dist/templates/FeatureArticle/FeatureArticle.stories.svelte +151 -0
- package/dist/templates/FeatureArticle/FeatureArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/FeatureArticle/docs/component.md +125 -0
- package/dist/templates/StandardArticle/StandardArticle.stories.svelte +86 -0
- package/dist/templates/StandardArticle/StandardArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/StandardArticle/docs/component.md +76 -0
- package/dist/templates/intro.mdx +19 -0
- package/dist/wrappers/Container/Container.stories.svelte +38 -0
- package/dist/wrappers/Container/Container.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Container/Container.svelte +61 -140
- package/dist/wrappers/Container/Container.svelte.d.ts +39 -0
- package/dist/wrappers/Container/docs/component.md +10 -0
- package/dist/wrappers/Embed/Embed.stories.svelte +24 -0
- package/dist/wrappers/Embed/Embed.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Embed/Embed.svelte +33 -32
- package/dist/{@types/wrappers → wrappers}/Embed/Embed.svelte.d.ts +4 -4
- package/dist/wrappers/Embed/docs/component.md +15 -0
- package/dist/wrappers/LazyLoad/LazyLoad.stories.svelte +37 -0
- package/dist/wrappers/LazyLoad/LazyLoad.stories.svelte.d.ts +23 -0
- package/dist/wrappers/LazyLoad/LazyLoad.svelte +34 -35
- package/dist/{@types/wrappers → wrappers}/LazyLoad/LazyLoad.svelte.d.ts +6 -6
- package/dist/wrappers/LazyLoad/docs/component.md +29 -0
- package/dist/wrappers/Main/Main.stories.svelte +24 -0
- package/dist/wrappers/Main/Main.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Main/Main.svelte +10 -3
- package/dist/{@types/wrappers → wrappers}/Main/Main.svelte.d.ts +2 -4
- package/dist/wrappers/Main/docs/component.md +16 -0
- package/dist/wrappers/Observe/Observe.stories.svelte +29 -0
- package/dist/wrappers/Observe/Observe.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Observe/Observe.svelte +24 -24
- package/dist/{@types/wrappers → wrappers}/Observe/Observe.svelte.d.ts +2 -2
- package/dist/wrappers/Observe/docs/component.md +22 -0
- package/dist/wrappers/Theme/Theme.stories.svelte +70 -0
- package/dist/{@types/wrappers/Theme/Theme.svelte.d.ts → wrappers/Theme/Theme.stories.svelte.d.ts} +4 -20
- package/dist/wrappers/Theme/Theme.svelte +64 -101
- package/dist/wrappers/Theme/Theme.svelte.d.ts +37 -0
- package/dist/wrappers/Theme/docs/component.md +10 -0
- package/dist/wrappers/Theme/themes.d.ts +143 -0
- package/dist/wrappers/Theme/themes.js +68 -27
- package/package.json +82 -195
- package/dist/@types/actions/cssVariables/index.d.ts +0 -4
- package/dist/@types/actions/resizeObserver/index.d.ts +0 -4
- package/dist/@types/inputs/AccessibleSelect/AccessibleSelect.svelte.d.ts +0 -58
- package/dist/@types/inputs/Button/Button.svelte.d.ts +0 -51
- package/dist/@types/inputs/Input/Input.svelte.d.ts +0 -51
- package/dist/@types/inputs/Select/Select.svelte.d.ts +0 -77
- package/dist/@types/js/docsPage.d.ts +0 -25
- package/dist/@types/layout/Backlink/Backlink.svelte.d.ts +0 -23
- package/dist/@types/layout/Cards/Card.svelte.d.ts +0 -49
- package/dist/@types/layout/Cards/Cards.svelte.d.ts +0 -51
- package/dist/@types/layout/Footer/ONSLogo.svelte.d.ts +0 -29
- package/dist/@types/layout/Grid/Grid.svelte.d.ts +0 -53
- package/dist/@types/layout/Header/ONSLogo.svelte.d.ts +0 -31
- package/dist/@types/layout/Hero/Hero.svelte.d.ts +0 -47
- package/dist/@types/layout/Highlight/Highlight.svelte.d.ts +0 -43
- package/dist/@types/layout/NavSections/SectionBacklink.svelte.d.ts +0 -23
- package/dist/@types/layout/Section/Section.svelte.d.ts +0 -47
- package/dist/@types/layout/Survey/Survey.svelte.d.ts +0 -23
- package/dist/@types/layout/Survey/init-survey.d.ts +0 -1
- package/dist/@types/layout/Titleblock/Meta.svelte.d.ts +0 -23
- package/dist/@types/layout/Titleblock/Titleblock.svelte.d.ts +0 -53
- package/dist/@types/layout/Twisty/Twisty.svelte.d.ts +0 -33
- package/dist/@types/wrappers/Container/Container.svelte.d.ts +0 -45
- package/dist/@types/wrappers/Theme/themes.d.ts +0 -29
- package/dist/actions/cssVariables/index.js +0 -20
- package/dist/actions/resizeObserver/index.js +0 -25
- package/dist/globals.d.ts +0 -23
- package/dist/inputs/AccessibleSelect/AccessibleSelect.svelte +0 -280
- package/dist/inputs/AccessibleSelect/options.js +0 -263
- package/dist/js/docsPage.js +0 -13
- package/dist/layout/Backlink/Backlink.svelte +0 -32
- package/dist/layout/Cards/Card.svelte +0 -99
- package/dist/layout/Cards/Cards.svelte +0 -95
- package/dist/layout/Footer/ONSLogo.svelte +0 -150
- package/dist/layout/Header/ONSLogo.svelte +0 -148
- package/dist/layout/NavSections/SectionBacklink.svelte +0 -31
- package/dist/layout/Survey/Survey.svelte +0 -96
- package/dist/layout/Survey/init-survey.js +0 -230
- package/dist/layout/Titleblock/Meta.svelte +0 -26
- package/dist/layout/Titleblock/Titleblock.svelte +0 -147
- package/dist/layout/Twisty/Twisty.svelte +0 -56
- /package/dist/{@types/datavis/shared → datavis/demo-data}/data-scatter.d.ts +0 -0
- /package/dist/datavis/{shared → demo-data}/data-scatter.js +0 -0
- /package/dist/{@types/datavis/shared → datavis/demo-data}/data.d.ts +0 -0
- /package/dist/datavis/{shared → demo-data}/data.js +0 -0
- /package/dist/{@types/inputs/AccessibleSelect/options.d.ts → js/menuOptions.d.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { withComponentDocs } from "../../js/withParams.js";
|
|
4
|
+
import Embed from "./Embed.svelte";
|
|
5
|
+
import componentDocs from "./docs/component.md?raw";
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: "Wrappers/Embed",
|
|
9
|
+
component: Embed,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {},
|
|
12
|
+
parameters: withComponentDocs(componentDocs)
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#snippet template(args)}
|
|
17
|
+
<Embed {...args}>
|
|
18
|
+
<div style:padding="24px 0" style:background="var(--ons-color-grey-10)">
|
|
19
|
+
<p style:margin="0">Embedded content.</p>
|
|
20
|
+
</div>
|
|
21
|
+
</Embed>
|
|
22
|
+
{/snippet}
|
|
23
|
+
|
|
24
|
+
<Story name="Default" args={{}} {template} />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} EmbedProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} EmbedEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} EmbedSlots */
|
|
4
|
+
export default class Embed extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type EmbedProps = typeof __propDef.props;
|
|
11
|
+
export type EmbedEvents = typeof __propDef.events;
|
|
12
|
+
export type EmbedSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { onMount, createEventDispatcher } from "svelte";
|
|
3
|
+
import pym from "pym.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Binding for pymChild element (can be used to send messages to parent of iframe)
|
|
7
|
+
* @type {object}
|
|
8
|
+
*/
|
|
9
|
+
export let pymChild = null;
|
|
10
|
+
/**
|
|
11
|
+
* Frequency (in milliseconds) of iframe height updates. Set as "false" to disable polling.
|
|
12
|
+
* @type {number|false}
|
|
13
|
+
*/
|
|
14
|
+
export let polling = 500;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const dispatch = createEventDispatcher();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
onMount(() => {
|
|
19
|
+
pymChild = new pym.Child();
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
if (polling) {
|
|
22
|
+
setInterval(() => {
|
|
23
|
+
pymChild.sendMessage(
|
|
24
|
+
"height",
|
|
25
|
+
Math.max(document.body.scrollHeight, document.body.offsetHeight)
|
|
26
|
+
);
|
|
27
|
+
}, polling);
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const href = document.location.href;
|
|
31
|
+
const parentUrl = new URLSearchParams(document.location.search).get("parentUrl");
|
|
32
|
+
dispatch("load", { href, parentUrl, pymChild });
|
|
33
|
+
});
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
|
-
<div class="embed-container" style:display="
|
|
37
|
-
|
|
36
|
+
<div class="ons-svelte-embed-container" style:display="contents">
|
|
37
|
+
<slot />
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<style>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
.ons-svelte-embed-container :global(.ons-container) {
|
|
42
|
+
padding: 0 !important;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} EmbedEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} EmbedSlots */
|
|
4
4
|
export default class Embed extends SvelteComponentTyped<{
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
polling?: number | false | undefined;
|
|
6
|
+
pymChild?: object | undefined;
|
|
7
7
|
}, {
|
|
8
8
|
load: CustomEvent<any>;
|
|
9
9
|
} & {
|
|
@@ -18,8 +18,8 @@ export type EmbedSlots = typeof __propDef.slots;
|
|
|
18
18
|
import { SvelteComponentTyped } from "svelte";
|
|
19
19
|
declare const __propDef: {
|
|
20
20
|
props: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
polling?: number | false | undefined;
|
|
22
|
+
pymChild?: object | undefined;
|
|
23
23
|
};
|
|
24
24
|
events: {
|
|
25
25
|
load: CustomEvent<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
A container for content designed to appear within an `<iframe>`. The component does two things:
|
|
2
|
+
|
|
3
|
+
1. Overrides padding, so that content can fill the full width of its iframe.
|
|
4
|
+
2. Initialises a Pym.js child for the iframe, so that it can communicate its height with its parent page.
|
|
5
|
+
|
|
6
|
+
<!-- prettier-ignore -->
|
|
7
|
+
```html
|
|
8
|
+
<script>
|
|
9
|
+
import { Embed } from "@onsvisual/svelte-components";
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Embed>
|
|
13
|
+
{child_components}
|
|
14
|
+
</Embed>
|
|
15
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { withComponentDocs } from "../../js/withParams.js";
|
|
4
|
+
import LazyLoad from "./LazyLoad.svelte";
|
|
5
|
+
import componentDocs from "./docs/component.md?raw";
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: "Wrappers/LazyLoad",
|
|
9
|
+
component: LazyLoad,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {},
|
|
12
|
+
parameters: withComponentDocs(componentDocs)
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#snippet template(args)}
|
|
17
|
+
{#each Array.from(Array(15).keys()) as i}
|
|
18
|
+
<LazyLoad {...args}>
|
|
19
|
+
<div class="img-container">
|
|
20
|
+
<img src="https://picsum.photos/400/300?random={i}" alt="" />
|
|
21
|
+
</div>
|
|
22
|
+
</LazyLoad>
|
|
23
|
+
{/each}
|
|
24
|
+
{/snippet}
|
|
25
|
+
|
|
26
|
+
<Story name="Default" args={{}} {template} />
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
.img-container {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
height: 500px;
|
|
34
|
+
background: #eee;
|
|
35
|
+
margin-bottom: 10px;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} LazyLoadProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} LazyLoadEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} LazyLoadSlots */
|
|
4
|
+
export default class LazyLoad extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type LazyLoadProps = typeof __propDef.props;
|
|
11
|
+
export type LazyLoadEvents = typeof __propDef.events;
|
|
12
|
+
export type LazyLoadSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import { onMount, onDestroy } from "svelte";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Bind to this variable to monitor whether the component has entered the viewport (boolean true/false).
|
|
6
|
+
* @type {boolean}
|
|
7
|
+
*/
|
|
8
|
+
export let entered = false;
|
|
9
|
+
/**
|
|
10
|
+
* Set the initial "placeholder" height of the component in pixels.
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
export let initialHeight = 400;
|
|
14
|
+
/**
|
|
15
|
+
* Set how many pixels from the viewport you want lazy loading to kick in.
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
export let rootMargin = 200;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
let el, observer;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
22
|
+
const callback = (entries, observer) => {
|
|
23
|
+
entries.forEach((entry) => {
|
|
24
|
+
let intersecting = entry.isIntersecting;
|
|
25
|
+
if (!entered && intersecting) {
|
|
26
|
+
observer.unobserve(el);
|
|
27
|
+
entered = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
onMount(() => {
|
|
33
|
+
let options = { root: document, rootMargin: `${rootMargin}px` };
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
observer = new IntersectionObserver(callback, options);
|
|
36
|
+
observer.observe(el);
|
|
37
|
+
});
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
onDestroy(() => observer.unobserve(el));
|
|
41
40
|
</script>
|
|
42
41
|
|
|
43
42
|
{#if entered}
|
|
44
|
-
|
|
43
|
+
<slot />
|
|
45
44
|
{:else}
|
|
46
|
-
|
|
45
|
+
<div bind:this={el} style:height="{+initialHeight || 100}px"></div>
|
|
47
46
|
{/if}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} LazyLoadEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} LazyLoadSlots */
|
|
4
4
|
export default class LazyLoad extends SvelteComponentTyped<{
|
|
5
|
-
entered?: boolean;
|
|
6
|
-
initialHeight?: number;
|
|
7
|
-
rootMargin?: number;
|
|
5
|
+
entered?: boolean | undefined;
|
|
6
|
+
initialHeight?: number | undefined;
|
|
7
|
+
rootMargin?: number | undefined;
|
|
8
8
|
}, {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
}, {
|
|
@@ -17,9 +17,9 @@ export type LazyLoadSlots = typeof __propDef.slots;
|
|
|
17
17
|
import { SvelteComponentTyped } from "svelte";
|
|
18
18
|
declare const __propDef: {
|
|
19
19
|
props: {
|
|
20
|
-
entered?: boolean;
|
|
21
|
-
initialHeight?: number;
|
|
22
|
-
rootMargin?: number;
|
|
20
|
+
entered?: boolean | undefined;
|
|
21
|
+
initialHeight?: number | undefined;
|
|
22
|
+
rootMargin?: number | undefined;
|
|
23
23
|
};
|
|
24
24
|
events: {
|
|
25
25
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
A wrapper component that uses IntersectionObserver to allow the elements it contains to be lazy loaded, ie. to be initialised/mounted only when they enter the viewport (or come close to it).
|
|
2
|
+
|
|
3
|
+
Optionally, you can use the **initialHeight** to set a placeholder height in pixels (default 400), and you can use **rootMargin** to set how many pixels from the viewport you want lazy loading to kick in (default 200).
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```html
|
|
7
|
+
<script>
|
|
8
|
+
import { LazyLoad } from "@onsvisual/svelte-components";
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#each Array.from(Array(20).keys()) as i}
|
|
12
|
+
<LazyLoad>
|
|
13
|
+
<div class="img-container">
|
|
14
|
+
<img src="https://picsum.photos/400/300?random={i}" alt="" />
|
|
15
|
+
</div>
|
|
16
|
+
</LazyLoad>
|
|
17
|
+
{/each}
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.img-container {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
height: 400px;
|
|
25
|
+
background: #eee;
|
|
26
|
+
margin-bottom: 10px;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { withComponentDocs } from "../../js/withParams.js";
|
|
4
|
+
import Main from "./Main.svelte";
|
|
5
|
+
import componentDocs from "./docs/component.md?raw";
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: "Wrappers/Main",
|
|
9
|
+
component: Main,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {},
|
|
12
|
+
parameters: withComponentDocs(componentDocs)
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#snippet template(args)}
|
|
17
|
+
<Main {...args}>
|
|
18
|
+
<div style:padding="24px 12px" style:background="var(--ons-color-grey-10)">
|
|
19
|
+
<p style:margin="0">Child components go here.</p>
|
|
20
|
+
</div>
|
|
21
|
+
</Main>
|
|
22
|
+
{/snippet}
|
|
23
|
+
|
|
24
|
+
<Story name="Default" args={{}} {template} />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} MainProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} MainEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} MainSlots */
|
|
4
|
+
export default class Main extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type MainProps = typeof __propDef.props;
|
|
11
|
+
export type MainEvents = typeof __propDef.events;
|
|
12
|
+
export type MainSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Sets the unique ID that can be targetted by hyperlinks
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export let id = "main";
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<main {id}>
|
|
10
|
+
<slot />
|
|
4
11
|
</main>
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} MainEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} MainSlots */
|
|
4
4
|
export default class Main extends SvelteComponentTyped<{
|
|
5
|
-
|
|
5
|
+
id?: string | undefined;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
}, {
|
|
9
|
-
before: {};
|
|
10
9
|
default: {};
|
|
11
10
|
}> {
|
|
12
11
|
}
|
|
@@ -16,13 +15,12 @@ export type MainSlots = typeof __propDef.slots;
|
|
|
16
15
|
import { SvelteComponentTyped } from "svelte";
|
|
17
16
|
declare const __propDef: {
|
|
18
17
|
props: {
|
|
19
|
-
|
|
18
|
+
id?: string | undefined;
|
|
20
19
|
};
|
|
21
20
|
events: {
|
|
22
21
|
[evt: string]: CustomEvent<any>;
|
|
23
22
|
};
|
|
24
23
|
slots: {
|
|
25
|
-
before: {};
|
|
26
24
|
default: {};
|
|
27
25
|
};
|
|
28
26
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
This component creates a styled `<main>` element to wrap the primary contents of a page (generally everything between the page header and footer).
|
|
2
|
+
|
|
3
|
+
This component is useful for screen readers to identify the primary content of the page. The standard header component also contains a visually hidden "Skip to content" link that will bring users to it.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```html
|
|
7
|
+
<script>
|
|
8
|
+
import { Main } from "@onsvisual/svelte-components";
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<!-- Header goes here -->
|
|
12
|
+
<Main>
|
|
13
|
+
{child_components}
|
|
14
|
+
</Main>
|
|
15
|
+
<!-- Footer goes here -->
|
|
16
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { withComponentDocs } from "../../js/withParams.js";
|
|
4
|
+
import Observe from "./Observe.svelte";
|
|
5
|
+
import componentDocs from "./docs/component.md?raw";
|
|
6
|
+
|
|
7
|
+
const colors = ["yellow", "green", "blue", "purple", "red", "orange"];
|
|
8
|
+
|
|
9
|
+
const { Story } = defineMeta({
|
|
10
|
+
title: "Wrappers/Observe",
|
|
11
|
+
component: Observe,
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
argTypes: {},
|
|
14
|
+
parameters: withComponentDocs(componentDocs)
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet template(args)}
|
|
19
|
+
{#each colors as color}
|
|
20
|
+
<Observe
|
|
21
|
+
on:enter={() => console.log(`${color} entered`)}
|
|
22
|
+
on:exit={() => console.log(`${color} exited`)}
|
|
23
|
+
>
|
|
24
|
+
<div style:background={color} style:height="400px"></div>
|
|
25
|
+
</Observe>
|
|
26
|
+
{/each}
|
|
27
|
+
{/snippet}
|
|
28
|
+
|
|
29
|
+
<Story name="Default" args={{}} {template} />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ObserveProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ObserveEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ObserveSlots */
|
|
4
|
+
export default class Observe extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type ObserveProps = typeof __propDef.props;
|
|
11
|
+
export type ObserveEvents = typeof __propDef.events;
|
|
12
|
+
export type ObserveSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import { onMount, onDestroy, createEventDispatcher } from "svelte";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Bind to this variable to monitor visiblity (boolean true/false).
|
|
8
|
+
* @type {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export let visible = false;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
let el, observer;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const callback = (entries) => {
|
|
15
|
+
entries.forEach((entry) => {
|
|
16
|
+
let intersecting = entry.isIntersecting;
|
|
17
|
+
if (!visible && intersecting) dispatch("enter", entry);
|
|
18
|
+
if (visible && !intersecting) dispatch("exit", entry);
|
|
19
|
+
visible = intersecting;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
onMount(() => {
|
|
24
|
+
let options = {};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
observer = new IntersectionObserver(callback, options);
|
|
27
|
+
observer.observe(el);
|
|
28
|
+
});
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
onDestroy(() => observer.unobserve(el));
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
|
-
<div bind:this=
|
|
34
|
-
|
|
33
|
+
<div bind:this={el}>
|
|
34
|
+
<slot />
|
|
35
35
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ObserveEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ObserveSlots */
|
|
4
4
|
export default class Observe extends SvelteComponentTyped<{
|
|
5
|
-
visible?: boolean;
|
|
5
|
+
visible?: boolean | undefined;
|
|
6
6
|
}, {
|
|
7
7
|
enter: CustomEvent<any>;
|
|
8
8
|
exit: CustomEvent<any>;
|
|
@@ -18,7 +18,7 @@ export type ObserveSlots = typeof __propDef.slots;
|
|
|
18
18
|
import { SvelteComponentTyped } from "svelte";
|
|
19
19
|
declare const __propDef: {
|
|
20
20
|
props: {
|
|
21
|
-
visible?: boolean;
|
|
21
|
+
visible?: boolean | undefined;
|
|
22
22
|
};
|
|
23
23
|
events: {
|
|
24
24
|
enter: CustomEvent<any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
A wrapper component that uses IntersectionObserver to monitor whether the elements in contains are within the current viewport.
|
|
2
|
+
|
|
3
|
+
This component can be useful for triggering actions such as lazy loading of data/images or scroll-driven interactions.
|
|
4
|
+
|
|
5
|
+
This component has **enter** and **exit** events, triggered when it enters or leaves the viewport. It also has a **visible** binding which has a value of **true** when it is within the viewport.
|
|
6
|
+
|
|
7
|
+
<!-- prettier-ignore -->
|
|
8
|
+
```html
|
|
9
|
+
<script>
|
|
10
|
+
import { Observe } from "@onsvisual/svelte-components";
|
|
11
|
+
|
|
12
|
+
const colors = ["yellow", "green", "blue", "purple", "red", "orange"];
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#each colors as color}
|
|
16
|
+
<Observe
|
|
17
|
+
on:enter={() => console.log(`${color} entered`)}
|
|
18
|
+
on:exit={() => console.log(`${color} exited`)}>
|
|
19
|
+
<div class="section" style:background={color} style:height="400px"/>
|
|
20
|
+
</Observe>
|
|
21
|
+
{/each}
|
|
22
|
+
```
|