diff --git a/jest.config.cjs b/jest.config.cjs index 8cbf894..5faa4b6 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,5 +1,5 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', -}; \ No newline at end of file + preset: 'ts-jest', + testEnvironment: 'node' +}; diff --git a/src/lib/components/ComponentIndex/ArrowButton.svelte b/src/lib/components/ComponentIndex/ArrowButton.svelte index 104f503..612083f 100644 --- a/src/lib/components/ComponentIndex/ArrowButton.svelte +++ b/src/lib/components/ComponentIndex/ArrowButton.svelte @@ -1,83 +1,83 @@ - -Package Manager -
- - - -
-
-
- \ No newline at end of file + Package Manager +
+ + + +
+
+
+ + + diff --git a/src/lib/components/ComponentIndex/Card.svelte b/src/lib/components/ComponentIndex/Card.svelte index cbb8935..55b3b9b 100644 --- a/src/lib/components/ComponentIndex/Card.svelte +++ b/src/lib/components/ComponentIndex/Card.svelte @@ -1,17 +1,17 @@ - -
-

- # {title} - {#if npm} copyToClipboard(`${packageManagers[manager]}l ${cleanupNpm(npm)}`)} variant="copy" title={clipboardCopy ? 'copied!' : `${packageManagers[manager]} ${cleanupNpm(npm)}`}/>{/if} -

-

{description}

-
- {#each tags as tag} - - {/each} -
- {#if typeof stars !== 'undefined'} -
-
- {#if (repo || url).includes('github')} - github logo - {:else if (repo || url).includes('gitlab')} - gitlab logo - - {/if} -
-
- ★ - {stars} -
- - -
- {/if} +

+ # {title} + {#if npm} copyToClipboard(`${packageManagers[manager]}l ${cleanupNpm(npm)}`)} + variant="copy" + title={clipboardCopy ? 'copied!' : `${packageManagers[manager]} ${cleanupNpm(npm)}`} + />{/if} +

+

{description}

+
+ {#each tags as tag} + + {/each} +
+ {#if typeof stars !== 'undefined'} +
+
+ {#if (repo || url).includes('github')} + github logo + {:else if (repo || url).includes('gitlab')} + gitlab logo + + {/if} +
+
+ ★ + {stars} +
+ + +
+ {/if}
+ + diff --git a/src/lib/components/ComponentIndex/CardList.svelte b/src/lib/components/ComponentIndex/CardList.svelte index 235deec..96eb86b 100644 --- a/src/lib/components/ComponentIndex/CardList.svelte +++ b/src/lib/components/ComponentIndex/CardList.svelte @@ -1,43 +1,43 @@ - -
-

{title} #

-
- -
-
\ No newline at end of file +

{title} #

+
+ +
+
+ + diff --git a/src/lib/components/EventListElement/index.svelte b/src/lib/components/EventListElement/index.svelte index caf3f7b..570bfd6 100644 --- a/src/lib/components/EventListElement/index.svelte +++ b/src/lib/components/EventListElement/index.svelte @@ -11,7 +11,6 @@ let formattedDate = rawDate.toDateString(); return formattedDate; } -
@@ -29,9 +28,9 @@
diff --git a/src/lib/components/Icon/index.svelte b/src/lib/components/Icon/index.svelte index 7ba5272..b533b10 100644 --- a/src/lib/components/Icon/index.svelte +++ b/src/lib/components/Icon/index.svelte @@ -1,213 +1,211 @@ - {@html displayIcon.svg} - \ No newline at end of file + />` + } + ]; + let displayIcon = icons.find((e) => e.name === name); + if (!displayIcon) { + throw Error(`Could not find icon with name ${name}`); + } + + +{@html displayIcon.svg} + + diff --git a/src/lib/components/Select.svelte b/src/lib/components/Select.svelte index f50609b..2e9ae50 100644 --- a/src/lib/components/Select.svelte +++ b/src/lib/components/Select.svelte @@ -29,7 +29,7 @@ } .themed :global(.select-container) { - border: 2px solid var(--dark-gray); + border: 2px solid var(--dark-gray); cursor: pointer; flex: 1; align-items: center; @@ -62,5 +62,4 @@ position: static; cursor: pointer; } - diff --git a/src/lib/components/Societies/index.svelte b/src/lib/components/Societies/index.svelte index e3547fe..f3733d6 100644 --- a/src/lib/components/Societies/index.svelte +++ b/src/lib/components/Societies/index.svelte @@ -1,7 +1,6 @@ @@ -100,5 +99,4 @@ var(--tw-shadow); } } - diff --git a/src/lib/components/Tag.svelte b/src/lib/components/Tag.svelte index 518c147..126e04c 100644 --- a/src/lib/components/Tag.svelte +++ b/src/lib/components/Tag.svelte @@ -1,38 +1,38 @@ - -
{title}
+ + diff --git a/src/lib/components/_SocialLinks/Link.svelte b/src/lib/components/_SocialLinks/Link.svelte index 8025f73..f7ce5a0 100644 --- a/src/lib/components/_SocialLinks/Link.svelte +++ b/src/lib/components/_SocialLinks/Link.svelte @@ -3,14 +3,18 @@
  • - +
  • - + + diff --git a/src/lib/components/recipes/Note.svelte b/src/lib/components/recipes/Note.svelte index cc12ce8..d1df689 100644 --- a/src/lib/components/recipes/Note.svelte +++ b/src/lib/components/recipes/Note.svelte @@ -1,28 +1,28 @@ - -
    - -
    \ No newline at end of file + +
    + + diff --git a/src/lib/components/recipes/ReadMore.svelte b/src/lib/components/recipes/ReadMore.svelte index d6ad2b5..8557a71 100644 --- a/src/lib/components/recipes/ReadMore.svelte +++ b/src/lib/components/recipes/ReadMore.svelte @@ -1,28 +1,28 @@ - -
    - -
    \ No newline at end of file + + + + diff --git a/src/lib/components/recipes/Warning.svelte b/src/lib/components/recipes/Warning.svelte index 0397b66..be3e11d 100644 --- a/src/lib/components/recipes/Warning.svelte +++ b/src/lib/components/recipes/Warning.svelte @@ -1,28 +1,28 @@ - -
    - -
    \ No newline at end of file + + + + diff --git a/src/lib/layouts/EventPage.svelte b/src/lib/layouts/EventPage.svelte index 5cd033c..7dbfa78 100644 --- a/src/lib/layouts/EventPage.svelte +++ b/src/lib/layouts/EventPage.svelte @@ -1,6 +1,5 @@
    @@ -19,5 +18,4 @@ text-align: start; display: block; } - diff --git a/src/lib/layouts/Recipe.svelte b/src/lib/layouts/Recipe.svelte index 0a5b837..19fc81f 100644 --- a/src/lib/layouts/Recipe.svelte +++ b/src/lib/layouts/Recipe.svelte @@ -1,75 +1,75 @@
    -
    -

    Table of Contents

    - {#each $categories as node} - - {#if $page.path.includes(node.path)} - - {/if} - {/each} -
    -
    -

    {title}

    - -
    +
    +

    Table of Contents

    + {#each $categories as node} + + {#if $page.path.includes(node.path)} + + {/if} + {/each} +
    +
    +

    {title}

    + +
    diff --git a/src/lib/layouts/RecipeCategory.svelte b/src/lib/layouts/RecipeCategory.svelte index ae185c6..6dd1444 100644 --- a/src/lib/layouts/RecipeCategory.svelte +++ b/src/lib/layouts/RecipeCategory.svelte @@ -1,85 +1,85 @@
    -
    -

    Table of Contents

    - {#each $categories as node} - - {#if $page.path.includes(node.path)} - - {/if} - {/each} -
    -
    -

    {title}

    - +
    +

    Table of Contents

    + {#each $categories as node} + + {#if $page.path.includes(node.path)} + + {/if} + {/each} +
    +
    +

    {title}

    + - -
    + +
    diff --git a/src/lib/utils/sort.test.ts b/src/lib/utils/sort.test.ts index d1ff6e4..9839ad8 100644 --- a/src/lib/utils/sort.test.ts +++ b/src/lib/utils/sort.test.ts @@ -1,58 +1,61 @@ import { compare } from './sort'; -describe("sort", () => { - const mock = [{ - "addedOn": "2019-09-29T14:39:13Z", - "category": "Svelte", - "description": "Boilerplate with TypeScript, Webpack, Storybook, Travis CI, SCSS, Babel, EsLint, Prettier, Jest", - "stars": 51, - "tags": [], - "title": "agusID/boilerplate-svelte", - "url": "https://github.com/agusID/boilerplate-svelte" - }, - { - "addedOn": "2020-09-29T14:39:13Z", - "category": "Svelte", - "description": "An example repo of a Svelte app that is IE11 compatible", - "stars": 27, - "tags": [], - "title": "angelozehr/svelte-example-museums", - "url": "https://github.com/angelozehr/svelte-example-museums" - }]; - - it("should sort by added_desc", () => { - mock.sort(compare("added_desc")); - expect(mock[0].title).toEqual("angelozehr/svelte-example-museums"); - expect(mock[1].title).toEqual("agusID/boilerplate-svelte"); - }); - - it("should sort by added_asc", () => { - mock.sort(compare("added_asc")); - expect(mock[0].title).toEqual("agusID/boilerplate-svelte"); - expect(mock[1].title).toEqual("angelozehr/svelte-example-museums"); - }); - - it("should sort by name_asc", () => { - mock.sort(compare("name_asc")); - expect(mock[0].title).toEqual("agusID/boilerplate-svelte"); - expect(mock[1].title).toEqual("angelozehr/svelte-example-museums"); - }); - - it("should sort by name_desc", () => { - mock.sort(compare("name_desc")); - expect(mock[0].title).toEqual("angelozehr/svelte-example-museums"); - expect(mock[1].title).toEqual("agusID/boilerplate-svelte"); - }); - - it("should sort by stars_asc", () => { - mock.sort(compare("stars_asc")); - expect(mock[0].title).toEqual("angelozehr/svelte-example-museums"); - expect(mock[1].title).toEqual("agusID/boilerplate-svelte"); - }); - - it("should sort by stars_desc", () => { - mock.sort(compare("stars_desc")); - expect(mock[0].title).toEqual("agusID/boilerplate-svelte"); - expect(mock[1].title).toEqual("angelozehr/svelte-example-museums"); - }); -}); \ No newline at end of file +describe('sort', () => { + const mock = [ + { + addedOn: '2019-09-29T14:39:13Z', + category: 'Svelte', + description: + 'Boilerplate with TypeScript, Webpack, Storybook, Travis CI, SCSS, Babel, EsLint, Prettier, Jest', + stars: 51, + tags: [], + title: 'agusID/boilerplate-svelte', + url: 'https://github.com/agusID/boilerplate-svelte' + }, + { + addedOn: '2020-09-29T14:39:13Z', + category: 'Svelte', + description: 'An example repo of a Svelte app that is IE11 compatible', + stars: 27, + tags: [], + title: 'angelozehr/svelte-example-museums', + url: 'https://github.com/angelozehr/svelte-example-museums' + } + ]; + + it('should sort by added_desc', () => { + mock.sort(compare('added_desc')); + expect(mock[0].title).toEqual('angelozehr/svelte-example-museums'); + expect(mock[1].title).toEqual('agusID/boilerplate-svelte'); + }); + + it('should sort by added_asc', () => { + mock.sort(compare('added_asc')); + expect(mock[0].title).toEqual('agusID/boilerplate-svelte'); + expect(mock[1].title).toEqual('angelozehr/svelte-example-museums'); + }); + + it('should sort by name_asc', () => { + mock.sort(compare('name_asc')); + expect(mock[0].title).toEqual('agusID/boilerplate-svelte'); + expect(mock[1].title).toEqual('angelozehr/svelte-example-museums'); + }); + + it('should sort by name_desc', () => { + mock.sort(compare('name_desc')); + expect(mock[0].title).toEqual('angelozehr/svelte-example-museums'); + expect(mock[1].title).toEqual('agusID/boilerplate-svelte'); + }); + + it('should sort by stars_asc', () => { + mock.sort(compare('stars_asc')); + expect(mock[0].title).toEqual('angelozehr/svelte-example-museums'); + expect(mock[1].title).toEqual('agusID/boilerplate-svelte'); + }); + + it('should sort by stars_desc', () => { + mock.sort(compare('stars_desc')); + expect(mock[0].title).toEqual('agusID/boilerplate-svelte'); + expect(mock[1].title).toEqual('angelozehr/svelte-example-museums'); + }); +}); diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 55271fe..e113a4b 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -27,7 +27,7 @@
    \ No newline at end of file + main { + padding: var(--s-10) var(--s-5) var(--s-20); + } + diff --git a/src/routes/about/__layout.svelte b/src/routes/about/__layout.svelte index c7d02bf..25ed9b1 100644 --- a/src/routes/about/__layout.svelte +++ b/src/routes/about/__layout.svelte @@ -1,22 +1,23 @@ - About Svelte Society + About Svelte Society
    - +
    \ No newline at end of file + .wrapper { + max-width: 65ch; + } + .wrapper :global(h2), + .wrapper :global(h3) { + margin-top: 2rem; + margin-bottom: 1.25rem; + } + .wrapper :global(p) { + margin-bottom: 1.25rem; + } + .wrapper :global(li) { + margin-bottom: 1.1rem; + } + diff --git a/src/routes/cheatsheet/cheat-sheet.js b/src/routes/cheatsheet/cheat-sheet.js index 1825890..11f1c60 100644 --- a/src/routes/cheatsheet/cheat-sheet.js +++ b/src/routes/cheatsheet/cheat-sheet.js @@ -1,12 +1,12 @@ -const replPath = 'https://svelte.dev/repl' -const docPath = 'https://svelte.dev/docs' +const replPath = 'https://svelte.dev/repl'; +const docPath = 'https://svelte.dev/docs'; export const cheatSheet = [ - { - title: "Svelte Component", - repl: `${replPath}/6a5416148c4b410b8ee0325eef54b107`, - doc: `${docPath}#Component_format`, - content: ` + { + title: 'Svelte Component', + repl: `${replPath}/6a5416148c4b410b8ee0325eef54b107`, + doc: `${docPath}#Component_format`, + content: ` @@ -31,12 +31,12 @@ export const cheatSheet = [ ` - }, - { - title: "Expressions", - repl: `${replPath}/27bd55a7357046f2911923069dee9d86`, - doc: `${docPath}#Text_expressions`, - content: ` @@ -355,14 +346,12 @@ import Widget from '.Widget.svelte'
    ...
    ` - - }, - { - title: "Lifecycle", - repl: `${replPath}/ca959a7e552a4b35aa678dbe9a2d2b48`, - doc: `${docPath}#svelte`, - content: - ` + }, + { + title: 'Lifecycle', + repl: `${replPath}/ca959a7e552a4b35aa678dbe9a2d2b48`, + doc: `${docPath}#svelte`, + content: ` @@ -423,13 +409,12 @@ onMount(() => { // Other transitions [Blur, Scale, Fly, Draw, Slide] ` - }, - { - title: "Reactive Expressions", - repl: `${replPath}/0f7793bf7b0745f1b356327fad4a71e1`, - doc: `${docPath}#2_Assignments_are_reactive`, - content: -` ` - }, -] + } +]; diff --git a/src/routes/cheatsheet/index.svelte b/src/routes/cheatsheet/index.svelte index b9be128..46d8efd 100644 --- a/src/routes/cheatsheet/index.svelte +++ b/src/routes/cheatsheet/index.svelte @@ -20,11 +20,11 @@ \ No newline at end of file + main { + display: flex; + flex-wrap: wrap; + align-items: stretch; + justify-items: stretch; + gap: var(--s-10); + } + diff --git a/src/routes/components/components.js b/src/routes/components/components.js index 4116204..f8b2b11 100644 --- a/src/routes/components/components.js +++ b/src/routes/components/components.js @@ -1,24 +1,24 @@ const components = new Array(6) -.fill({ - image: "/preview-image.png", - title: "svelte-tooltip", - description: - "A tooltip action that you can attach to any element and pass in a Svelte component...", - tags: [], - stars: 511, - addedOn: new Date(), - category: "forms" -}) -.concat( - new Array(3).fill({ - image: "/preview-image.png", - title: "svelte-ui", - description: - "A tooltip action that you can attach to any element and pass in a Svelte component...", - tags: [], - stars: 511, - addedOn: new Date(), - category: "ui" - }) -); -export default components; \ No newline at end of file + .fill({ + image: '/preview-image.png', + title: 'svelte-tooltip', + description: + 'A tooltip action that you can attach to any element and pass in a Svelte component...', + tags: [], + stars: 511, + addedOn: new Date(), + category: 'forms' + }) + .concat( + new Array(3).fill({ + image: '/preview-image.png', + title: 'svelte-ui', + description: + 'A tooltip action that you can attach to any element and pass in a Svelte component...', + tags: [], + stars: 511, + addedOn: new Date(), + category: 'ui' + }) + ); +export default components; diff --git a/src/routes/components/components.json b/src/routes/components/components.json index 58b1d81..039f399 100644 --- a/src/routes/components/components.json +++ b/src/routes/components/components.json @@ -2216,12 +2216,7 @@ "description": "Add OAuth2 authorization in Svelte (and SvelteKit, works with SSR)", "npm": "@macfja/svelte-oauth2", "stars": 3, - "tags": [ - "auth", - "integrations", - "ssr", - "third party services" - ], + "tags": ["auth", "integrations", "ssr", "third party services"], "url": "https://github.com/macfja/svelte-oauth2#readme", "addedOn": "2021-09-10T20:00:00.000Z" } diff --git a/src/routes/components/index.svelte b/src/routes/components/index.svelte index 5a0c690..5144d88 100644 --- a/src/routes/components/index.svelte +++ b/src/routes/components/index.svelte @@ -83,7 +83,7 @@
    - + Submit a component - Events - Svelte Society + Events - Svelte Society
    @@ -50,5 +48,4 @@ flex-direction: column; } } - diff --git a/src/routes/help/__layout.svelte b/src/routes/help/__layout.svelte index 3322f61..af1c4b3 100644 --- a/src/routes/help/__layout.svelte +++ b/src/routes/help/__layout.svelte @@ -1,6 +1,6 @@ - Help + Help
    - -
    \ No newline at end of file + + diff --git a/src/routes/index.svelte b/src/routes/index.svelte index a8614a6..fff8376 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -14,7 +14,7 @@
    -

    Welcome to Svelte Society!

    +

    Welcome to Svelte Society!

    We are a volunteer global network of Svelte fans that strive to promote Svelte and its @@ -61,28 +61,28 @@

    - \ No newline at end of file + diff --git a/src/routes/recipes/index.svelte b/src/routes/recipes/index.svelte index 222de86..5c8a188 100644 --- a/src/routes/recipes/index.svelte +++ b/src/routes/recipes/index.svelte @@ -112,8 +112,7 @@ } @media screen and (max-width: 600px) { .categories-wrap { - - grid-template-columns: 1fr + grid-template-columns: 1fr; } } .category-style { diff --git a/src/routes/recipes/recipes.ts b/src/routes/recipes/recipes.ts index 8711ee6..72227eb 100644 --- a/src/routes/recipes/recipes.ts +++ b/src/routes/recipes/recipes.ts @@ -3,8 +3,7 @@ */ export async function get() { const pages = await Promise.all( - Object.entries(import.meta.glob('./**/*.svx')) - .map(async ([path, page]) => { + Object.entries(import.meta.glob('./**/*.svx')).map(async ([path, page]) => { const { metadata } = await page(); const filename = path.split('/').pop(); path = '/recipes' + path.substring(1, path.length - '.svx'.length); @@ -15,11 +14,11 @@ export async function get() { }) ); - const categories = pages.filter(page => page.meta.layout === 'recipeCategory'); + const categories = pages.filter((page) => page.meta.layout === 'recipeCategory'); - categories.forEach(category => { + categories.forEach((category) => { category.children = []; - pages.forEach(p => { + pages.forEach((p) => { if (category !== p && p.path.startsWith(category.path)) { category.children.push(p); } diff --git a/src/routes/templates/index.svelte b/src/routes/templates/index.svelte index 6cd26c2..d3eed4a 100644 --- a/src/routes/templates/index.svelte +++ b/src/routes/templates/index.svelte @@ -4,7 +4,7 @@ import components from './templates.json'; import { compare, selectSortItems } from '$lib/utils/sort'; import Select from '$lib/components/Select.svelte'; -import SearchLayout from '$lib/layouts/SearchLayout.svelte'; + import SearchLayout from '$lib/layouts/SearchLayout.svelte'; let searchValue; @@ -77,27 +77,26 @@ import SearchLayout from '$lib/layouts/SearchLayout.svelte'; isClearable={false} /> - Submit a template - - + Submit a template + + {dataToDisplay.length} result{#if dataToDisplay.length !== 1}s{/if}{dataToDisplay.length} result{#if dataToDisplay.length !== 1}s{/if} - -
    - {#each categories as category} - - {#each dataToDisplay.filter((d) => d.category === category) as data} - - {/each} - - {/each} -
    + +
    + {#each categories as category} + + {#each dataToDisplay.filter((d) => d.category === category) as data} + + {/each} + + {/each} +
    - diff --git a/src/routes/tooling/index.svelte b/src/routes/tooling/index.svelte index 803083c..8c6ec0b 100644 --- a/src/routes/tooling/index.svelte +++ b/src/routes/tooling/index.svelte @@ -1,7 +1,7 @@