From f937394b5e683acc805f657fd0944143e7671ede Mon Sep 17 00:00:00 2001 From: grabowski Date: Mon, 13 Apr 2026 15:55:30 +0700 Subject: [PATCH] Add live tag input with chips, autocomplete, and suggestions Reusable TagInput component: - Tags appear as blue chips instantly on comma/Enter press - Remove tags by clicking X on the chip or Backspace when empty - Autocomplete dropdown filters existing tags as you type - All existing tags shown as clickable suggestions below - Hidden input submits comma-separated value - Applied to wiki new and edit pages Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/components/ui/TagInput.svelte | 99 +++++++++++++++++++ .../(app)/wiki/[slug]/edit/+page.svelte | 24 +---- src/routes/(app)/wiki/new/+page.svelte | 24 +---- 3 files changed, 105 insertions(+), 42 deletions(-) create mode 100644 src/lib/components/ui/TagInput.svelte diff --git a/src/lib/components/ui/TagInput.svelte b/src/lib/components/ui/TagInput.svelte new file mode 100644 index 0000000..02e7e77 --- /dev/null +++ b/src/lib/components/ui/TagInput.svelte @@ -0,0 +1,99 @@ + + +
+
+ {#each tags as tag} + + {tag} + + + {/each} + +
+ + {#if suggestions.length > 0} +
+ {#each suggestions.slice(0, 8) as tag} + + {/each} +
+ {/if} + + {#if existingTags.length > 0 && input.length === 0} +
+ {#each existingTags.filter(t => !tags.includes(t.name)) as tag} + + {/each} +
+ {/if} + + +
diff --git a/src/routes/(app)/wiki/[slug]/edit/+page.svelte b/src/routes/(app)/wiki/[slug]/edit/+page.svelte index 5a24c7f..51cefbd 100644 --- a/src/routes/(app)/wiki/[slug]/edit/+page.svelte +++ b/src/routes/(app)/wiki/[slug]/edit/+page.svelte @@ -1,6 +1,7 @@