mirror of
https://github.com/LukeHagar/sveltesociety.dev.git
synced 2025-12-06 12:47:44 +00:00
feat: Update tags for packages.json (#560)
* Rename time-and-date, merge interactions * Merge maps * Rework forms, inputs, validation * Merge display-components, rename documentation * Reviewing tags carefully * More progress * Rename fonts-and-icons * Rename components-and-libraries * Make new data-fetching * Update submitting page * Remove currentCategories
This commit is contained in:
@@ -3,54 +3,46 @@ import { packageNameRegex } from 'package-name-regex';
|
||||
|
||||
const PACKAGES_TAGS = /** @type {const} */ ([
|
||||
'animations',
|
||||
'async-data',
|
||||
'async-loading',
|
||||
'audio-and-video',
|
||||
'auth',
|
||||
'bundler-plugins',
|
||||
'charts',
|
||||
'cli-tools',
|
||||
'components-and-libraries',
|
||||
'css-and-layout',
|
||||
'data-fetching',
|
||||
'data-visualisation',
|
||||
'debugging',
|
||||
'date-and-time',
|
||||
'design-pattern',
|
||||
'design-system',
|
||||
'developer-experience',
|
||||
'development-and-documentation',
|
||||
'display-components',
|
||||
'fonts-and-icons',
|
||||
'forms-and-validation',
|
||||
'graphql',
|
||||
'documentation',
|
||||
'forms-and-input',
|
||||
'headless',
|
||||
'icons-and-fonts',
|
||||
'images',
|
||||
'in-page-navigation',
|
||||
'inputs-and-widgets',
|
||||
'integrations',
|
||||
'interactions',
|
||||
'internationalization',
|
||||
'intersection-observer',
|
||||
'jsx',
|
||||
'layout-and-structure',
|
||||
'linting-and-formatting',
|
||||
'maps',
|
||||
'markdown',
|
||||
'modals',
|
||||
'multimedia',
|
||||
'native',
|
||||
'network-events',
|
||||
'notifications',
|
||||
'offline-and-online-detection',
|
||||
'official',
|
||||
'preprocessors',
|
||||
'routers',
|
||||
'seo',
|
||||
'ssr',
|
||||
'stores-and-state',
|
||||
'sveltekit-adapters',
|
||||
'testing',
|
||||
'third-party-services',
|
||||
'time-and-date',
|
||||
'typescript',
|
||||
'ui-components',
|
||||
'user-interaction',
|
||||
'viewport'
|
||||
'validation'
|
||||
]);
|
||||
|
||||
export const packagesSchema = z.array(
|
||||
|
||||
@@ -15,12 +15,10 @@
|
||||
|
||||
const data = {
|
||||
package: {
|
||||
tags: extractUnique(packages, 'tags'),
|
||||
categories: [...extractUnique(packages, 'category').filter((cat) => cat.label !== '')]
|
||||
tags: extractUnique(packages, 'tags')
|
||||
},
|
||||
template: {
|
||||
tags: extractUnique(templates, 'tags'),
|
||||
categories: extractUnique(templates, 'category')
|
||||
tags: extractUnique(templates, 'tags')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,7 +33,6 @@
|
||||
let url = 'https://svelte-lorem-ipsum.dev';
|
||||
let description = 'A dummy text generator that does not exist';
|
||||
let npm = 'svelte-lorem-ipsum';
|
||||
let category;
|
||||
let tags;
|
||||
let repository = 'https://github.com/sveltejs/svelte-lorem-ipsum';
|
||||
|
||||
@@ -46,21 +43,18 @@
|
||||
repository: repository ? repository : undefined,
|
||||
description,
|
||||
npm: npm ? npm : undefined,
|
||||
category: category?.value,
|
||||
tags: tags?.map((tag) => tag.value)
|
||||
};
|
||||
|
||||
$: currentTags = data[type.value].tags;
|
||||
$: currentCategories = data[type.value].categories;
|
||||
|
||||
onMount(() => {
|
||||
const typeQuery = new URLSearchParams(location.search).get('type');
|
||||
type = types.find((t) => t.value == typeQuery) || types[0];
|
||||
});
|
||||
|
||||
async function clearCategoryAndTags() {
|
||||
async function clearTags() {
|
||||
await tick();
|
||||
category = null;
|
||||
tags = null;
|
||||
}
|
||||
</script>
|
||||
@@ -86,7 +80,7 @@
|
||||
isClearable={false}
|
||||
showIndicator
|
||||
bind:value={type}
|
||||
on:select={clearCategoryAndTags}
|
||||
on:select={clearTags}
|
||||
/>
|
||||
<span class="input-helper">The type of snippet to generate</span>
|
||||
</div>
|
||||
@@ -128,23 +122,10 @@
|
||||
<span class="input-helper">The npm name of the package</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-wrapper">
|
||||
<label for="category">Category:</label>
|
||||
<div>
|
||||
<SvelteSelect
|
||||
id="category"
|
||||
items={currentCategories}
|
||||
isClearable={false}
|
||||
showIndicator
|
||||
bind:value={category}
|
||||
/>
|
||||
<span class="input-helper">The category of the package</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-wrapper">
|
||||
<label for="tags" class="required">Tags:</label>
|
||||
<div>
|
||||
<SvelteSelect id="category" items={currentTags} showIndicator isMulti bind:value={tags} />
|
||||
<SvelteSelect id="tags" items={currentTags} showIndicator isMulti bind:value={tags} />
|
||||
<span class="input-helper">A list of tags</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user