Code clean

- Imports/exports always at top
- Sapper template not needing a div to execute
- NPM packages updates: @rollup/plugin-commonjs 11.1.0 has a bug about import/exports
This commit is contained in:
2020-04-12 11:54:08 +02:00
parent 7180419fb0
commit e27e8a16db
20 changed files with 180 additions and 175 deletions

View File

@@ -1,12 +1,12 @@
<script>
import { stores } from '@sapper/app'
import { randomString } from 'utils/functions'
const { page } = stores()
// Props
export let width = 56
export let color = '#000'
export let animated = false
const { page } = stores()
// Generate a random ID for the mask
const randomId = randomString(6, 'A')

View File

@@ -1,12 +1,12 @@
<script>
import { stores } from '@sapper/app'
import { randomString } from 'utils/functions'
const { page } = stores()
// Props
export let width = 56
export let color = '#000'
export let animated = false
const { page } = stores()
// Generate a random ID for the mask
const randomId = randomString(6, 'A')

View File

@@ -1,7 +1,6 @@
<script>
import { onMount } from 'svelte'
import { charsToSpan } from 'utils/functions'
// Animations
import { animateIn } from 'animations/TitleSite'

View File

@@ -2,5 +2,5 @@ import * as sapper from '@sapper/app'
// Start Sapper
sapper.start({
target: document.getElementById('site')
target: document.body
})

View File

@@ -1,11 +1,11 @@
<script>
import { createEventDispatcher } from 'svelte'
const dispatch = createEventDispatcher()
// Props
export let className = ''
export let photos
export let currentIndex
const dispatch = createEventDispatcher()
</script>
<ol class={className}>

View File

@@ -2,7 +2,6 @@
import { onMount } from 'svelte'
import { site, currentLocation } from 'utils/store'
import { getThumbnail, formatDate } from 'utils/functions'
// Animations
import { animateIn } from 'animations/Photo'

View File

@@ -1,6 +1,5 @@
<script>
import { currentLocation } from 'utils/store'
// Components
import IconGlobe from 'atoms/IconGlobe'

View File

@@ -3,16 +3,11 @@
import { stores } from '@sapper/app'
import { currentLocation, fullscreen } from 'utils/store'
import { getThumbnail, formatDate } from 'utils/functions'
const dispatch = createEventDispatcher()
const { page } = stores()
// Dependencies
import SwipeListener from 'swipe-listener'
import lazySizes from 'lazysizes'
// Animations
import { animateIn } from 'animations/Carousel'
// Components
import IconArrow from 'atoms/IconArrow'
import Counter from 'atoms/Counter'
@@ -22,6 +17,8 @@
export let photos
export let viewer = false
export let locationUrl = false
const dispatch = createEventDispatcher()
const { page } = stores()
let scope
let swiped
let currentIndex = 0

View File

@@ -1,7 +1,5 @@
<script>
// Svelte
import { site, currentLocation } from 'utils/store'
// Components
import LinkTranslate from 'atoms/LinkTranslate'
import Switcher from 'molecules/Switcher'

View File

@@ -1,10 +1,8 @@
<script>
import { fullscreen } from 'utils/store'
import { throttle, getThumbnail } from 'utils/functions'
// Dependencies
import imagesLoaded from 'imagesloaded'
// Components
import IconGlobe from 'atoms/IconGlobe'
import IconZoomOut from 'atoms/IconZoomOut'

View File

@@ -4,11 +4,9 @@
import { receive, send } from 'animations/crossfade'
import { locations, countries, continents } from 'utils/store'
import { throttle } from 'utils/functions'
// Components
import Button from 'atoms/Button'
import Location from 'molecules/Location'
// Animations
import { animateIn } from 'animations/Locations'

View File

@@ -1,7 +1,6 @@
<script>
import { onMount, createEventDispatcher } from 'svelte'
import { currentLocation } from 'utils/store'
const dispatch = createEventDispatcher()
// Props
export let photos
@@ -9,6 +8,7 @@
export let photosPerPage
// Variables
const dispatch = createEventDispatcher()
let currentIndex = photosPerPage
const pagesTotal = Math.ceil(photos.length / photosPerPage)
const pagesArray = Array.from({ length: pagesTotal }, (v, k) => k + 1).reverse()

View File

@@ -1,6 +1,5 @@
<script>
import { site } from 'utils/store'
// Components
import IconArrow from 'atoms/IconArrow'
import TitleSite from 'atoms/TitleSite'

View File

@@ -73,11 +73,12 @@
locations,
pageReady
} from 'utils/store'
const { page } = stores()
// Components
import AnalyticsTracker from 'utils/AnalyticsTracker'
// Variables
const { page } = stores()
/*
** Manipulate data

View File

@@ -7,7 +7,6 @@
currentPhotos,
pageReady
} from 'utils/store'
// Components
import IconArrow from 'atoms/IconArrow'
import TitleSite from 'atoms/TitleSite'
@@ -16,7 +15,6 @@
import Footer from 'organisms/Footer'
import Transition from 'utils/Transition'
import SocialMetas from 'utils/SocialMetas'
// Animations
import { animateIn } from 'animations/page'

View File

@@ -2,7 +2,6 @@
import { onMount } from 'svelte'
import { stores } from '@sapper/app'
import { site, pageReady } from 'utils/store'
// Components
import IconArrow from 'atoms/IconArrow'
import TitleSite from 'atoms/TitleSite'
@@ -11,7 +10,6 @@
import Footer from 'organisms/Footer'
import SocialMetas from 'utils/SocialMetas'
import Transition from 'utils/Transition'
// Animations
import { animateIn } from 'animations/page'

View File

@@ -32,7 +32,6 @@
pageReady
} from 'utils/store'
import { charsToSpan, smoothScroll } from 'utils/functions'
// Components
import Button from 'atoms/Button'
import IconGlobeSmall from 'atoms/IconGlobeSmall'
@@ -44,11 +43,10 @@
import Footer from 'organisms/Footer'
import SocialMetas from 'utils/SocialMetas'
import Transition from 'utils/Transition'
// Animations
import { animateIn } from 'animations/index'
// Props and variables
// Props and Variables
export let photos = ''
const { page } = stores()

View File

@@ -1,33 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="#3C0576">
<meta name="mobile-web-app-capable" content="yes">
<link rel="manifest" href="/manifest.json">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="#3C0576">
<meta name="mobile-web-app-capable" content="yes">
<link rel="manifest" href="/manifest.json">
<link rel="icon" type="image/png" sizes="64x64" href="/img/favicon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/siteicon.png">
<link rel="icon" type="image/png" sizes="64x64" href="/img/favicon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/siteicon.png">
<link rel="preconnect" href="https://api.housesof.world" crossorigin>
<link rel="dns-prefetch" href="https://api.housesof.world">
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin>
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
<link rel="preload" href="/fonts/G-Light.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/G-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/G-Semibold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/M-Extralight.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/M-Light.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preconnect" href="https://api.housesof.world" crossorigin>
<link rel="dns-prefetch" href="https://api.housesof.world">
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin>
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
<link rel="preload" href="/fonts/G-Light.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/G-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/G-Semibold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/M-Extralight.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/M-Light.woff2" as="font" type="font/woff2" crossorigin>
%sapper.base%
%sapper.head%
%sapper.styles%
%sapper.base%
%sapper.head%
%sapper.styles%
</head>
<body>
<div id="site">%sapper.html%</div>
%sapper.html%
%sapper.scripts%
%sapper.scripts%
</body>
</html>