From f43bf7c4ee6abf931dd015261d0d51111a4aa222 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 13:01:25 +0000 Subject: [PATCH 1/9] feat: Add Alert and Notice components with Lucide icon support - Created alerts/ folder containing Alert and Notice components - Added shared alertIcons helper and alert.types definitions - Both components support info, warning, success, and error types - Fully customizable via CSS variables and props - Added @lucide/svelte as peer dependency - Updated package.json exports for @ainsleydev/sveltekit-helper/components/alerts - Exported components from main components/index.ts Usage: import { Alert, Notice } from '@ainsleydev/sveltekit-helper/components/alerts' --- packages/sveltekit-helper/package.json | 6 + .../src/components/alerts/Alert.svelte | 133 ++++++++++++++++++ .../src/components/alerts/Notice.svelte | 108 ++++++++++++++ .../src/components/alerts/alert.types.ts | 8 ++ .../src/components/alerts/alertIcons.ts | 10 ++ .../src/components/alerts/index.ts | 6 + .../sveltekit-helper/src/components/index.ts | 6 +- 7 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 packages/sveltekit-helper/src/components/alerts/Alert.svelte create mode 100644 packages/sveltekit-helper/src/components/alerts/Notice.svelte create mode 100644 packages/sveltekit-helper/src/components/alerts/alert.types.ts create mode 100644 packages/sveltekit-helper/src/components/alerts/alertIcons.ts create mode 100644 packages/sveltekit-helper/src/components/alerts/index.ts diff --git a/packages/sveltekit-helper/package.json b/packages/sveltekit-helper/package.json index 2e805652..fa308bae 100644 --- a/packages/sveltekit-helper/package.json +++ b/packages/sveltekit-helper/package.json @@ -38,6 +38,11 @@ "svelte": "./dist/components/payload/index.js", "default": "./dist/components/payload/index.js" }, + "./components/alerts": { + "types": "./dist/components/alerts/index.d.ts", + "svelte": "./dist/components/alerts/index.js", + "default": "./dist/components/alerts/index.js" + }, "./utils/forms": { "types": "./dist/utils/forms/index.d.ts", "import": "./dist/utils/forms/index.js" @@ -60,6 +65,7 @@ "access": "public" }, "peerDependencies": { + "@lucide/svelte": "^0.468.0", "@sveltejs/kit": "^2.0.0", "svelte": "^5.0.0" }, diff --git a/packages/sveltekit-helper/src/components/alerts/Alert.svelte b/packages/sveltekit-helper/src/components/alerts/Alert.svelte new file mode 100644 index 00000000..8d6b522a --- /dev/null +++ b/packages/sveltekit-helper/src/components/alerts/Alert.svelte @@ -0,0 +1,133 @@ + + + + +{#if visible} + +{/if} + + diff --git a/packages/sveltekit-helper/src/components/alerts/Notice.svelte b/packages/sveltekit-helper/src/components/alerts/Notice.svelte new file mode 100644 index 00000000..4662f4f4 --- /dev/null +++ b/packages/sveltekit-helper/src/components/alerts/Notice.svelte @@ -0,0 +1,108 @@ + + + + +{#if visible} + +{/if} + + diff --git a/packages/sveltekit-helper/src/components/alerts/alert.types.ts b/packages/sveltekit-helper/src/components/alerts/alert.types.ts new file mode 100644 index 00000000..994f29cc --- /dev/null +++ b/packages/sveltekit-helper/src/components/alerts/alert.types.ts @@ -0,0 +1,8 @@ +import { type Icon as IconType } from '@lucide/svelte' + +export type AlertType = 'info' | 'warning' | 'success' | 'error' + +export type IconDetail = { + icon: typeof IconType + colour: string +} diff --git a/packages/sveltekit-helper/src/components/alerts/alertIcons.ts b/packages/sveltekit-helper/src/components/alerts/alertIcons.ts new file mode 100644 index 00000000..60485f9b --- /dev/null +++ b/packages/sveltekit-helper/src/components/alerts/alertIcons.ts @@ -0,0 +1,10 @@ +import { CircleX, Info, CircleCheck, TriangleAlert } from '@lucide/svelte' + +import type { AlertType, IconDetail } from './alert.types' + +export const alertIcons: Record = { + info: { icon: Info, colour: 'var(--colour-semantic-info)' }, + success: { icon: CircleCheck, colour: 'var(--colour-semantic-success)' }, + warning: { icon: TriangleAlert, colour: 'var(--colour-semantic-warning)' }, + error: { icon: CircleX, colour: 'var(--colour-semantic-error)' }, +} diff --git a/packages/sveltekit-helper/src/components/alerts/index.ts b/packages/sveltekit-helper/src/components/alerts/index.ts new file mode 100644 index 00000000..4741e3be --- /dev/null +++ b/packages/sveltekit-helper/src/components/alerts/index.ts @@ -0,0 +1,6 @@ +export { default as Alert } from './Alert.svelte' +export { default as Notice } from './Notice.svelte' +export type { AlertProps } from './Alert.svelte' +export type { NoticeProps } from './Notice.svelte' +export type { AlertType, IconDetail } from './alert.types' +export { alertIcons } from './alertIcons' diff --git a/packages/sveltekit-helper/src/components/index.ts b/packages/sveltekit-helper/src/components/index.ts index e9ec2b0b..14023dbb 100644 --- a/packages/sveltekit-helper/src/components/index.ts +++ b/packages/sveltekit-helper/src/components/index.ts @@ -1,2 +1,4 @@ -export { default as Sidebar } from './Sidebar.svelte'; -export { default as Hamburger } from './Hamburger.svelte'; +export { default as Sidebar } from './Sidebar.svelte' +export { default as Hamburger } from './Hamburger.svelte' +export { Alert, Notice } from './alerts' +export type { AlertProps, NoticeProps, AlertType } from './alerts' From 79bf43664b74bbffc85bf447b2d18c6282ca88a3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 13:11:21 +0000 Subject: [PATCH 2/9] chore: Improve alerts package configuration and documentation - Move @lucide/svelte from peerDependencies to dependencies - Upgrade @lucide/svelte to latest version (^0.562.0) - Add comprehensive JSDoc comments to AlertType and IconDetail types - Document each alert variant (info, warning, success, error) --- packages/sveltekit-helper/package.json | 2 +- .../src/components/alerts/alert.types.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/sveltekit-helper/package.json b/packages/sveltekit-helper/package.json index fa308bae..0b74b19a 100644 --- a/packages/sveltekit-helper/package.json +++ b/packages/sveltekit-helper/package.json @@ -65,7 +65,6 @@ "access": "public" }, "peerDependencies": { - "@lucide/svelte": "^0.468.0", "@sveltejs/kit": "^2.0.0", "svelte": "^5.0.0" }, @@ -78,6 +77,7 @@ } }, "dependencies": { + "@lucide/svelte": "^0.562.0", "svelte-hamburgers": "^5.0.0" }, "devDependencies": { diff --git a/packages/sveltekit-helper/src/components/alerts/alert.types.ts b/packages/sveltekit-helper/src/components/alerts/alert.types.ts index 994f29cc..a0f51c4e 100644 --- a/packages/sveltekit-helper/src/components/alerts/alert.types.ts +++ b/packages/sveltekit-helper/src/components/alerts/alert.types.ts @@ -1,8 +1,21 @@ import { type Icon as IconType } from '@lucide/svelte' +/** + * Available alert type variants + * - info: Informational message + * - warning: Warning or cautionary message + * - success: Success confirmation message + * - error: Error or critical message + */ export type AlertType = 'info' | 'warning' | 'success' | 'error' +/** + * Icon configuration for alert types + * Contains the Lucide icon component and corresponding colour + */ export type IconDetail = { + /** Lucide icon component to display */ icon: typeof IconType + /** CSS colour value for the icon (usually a semantic colour variable) */ colour: string } From 9f80b5938edbf5305deab2d1d47fdc04f26c1b92 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 13:17:28 +0000 Subject: [PATCH 3/9] refactor: Rename alerts to notifications and update dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename alerts/ folder to notifications/ for better semantic clarity - Move @lucide/svelte from dependencies to peerDependencies (v0.562.0) - Simplify type documentation in alert.types.ts - Update package.json exports: ./components/alerts → ./components/notifications - Update components/index.ts imports to reference ./notifications BREAKING CHANGE: Import path changed from '@ainsleydev/sveltekit-helper/components/alerts' to '@ainsleydev/sveltekit-helper/components/notifications' --- packages/sveltekit-helper/package.json | 10 ++++----- .../src/components/alerts/alert.types.ts | 21 ------------------- .../sveltekit-helper/src/components/index.ts | 4 ++-- .../{alerts => notifications}/Alert.svelte | 0 .../{alerts => notifications}/Notice.svelte | 0 .../components/notifications/alert.types.ts | 10 +++++++++ .../{alerts => notifications}/alertIcons.ts | 0 .../{alerts => notifications}/index.ts | 0 8 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 packages/sveltekit-helper/src/components/alerts/alert.types.ts rename packages/sveltekit-helper/src/components/{alerts => notifications}/Alert.svelte (100%) rename packages/sveltekit-helper/src/components/{alerts => notifications}/Notice.svelte (100%) create mode 100644 packages/sveltekit-helper/src/components/notifications/alert.types.ts rename packages/sveltekit-helper/src/components/{alerts => notifications}/alertIcons.ts (100%) rename packages/sveltekit-helper/src/components/{alerts => notifications}/index.ts (100%) diff --git a/packages/sveltekit-helper/package.json b/packages/sveltekit-helper/package.json index 0b74b19a..91b26741 100644 --- a/packages/sveltekit-helper/package.json +++ b/packages/sveltekit-helper/package.json @@ -38,10 +38,10 @@ "svelte": "./dist/components/payload/index.js", "default": "./dist/components/payload/index.js" }, - "./components/alerts": { - "types": "./dist/components/alerts/index.d.ts", - "svelte": "./dist/components/alerts/index.js", - "default": "./dist/components/alerts/index.js" + "./components/notifications": { + "types": "./dist/components/notifications/index.d.ts", + "svelte": "./dist/components/notifications/index.js", + "default": "./dist/components/notifications/index.js" }, "./utils/forms": { "types": "./dist/utils/forms/index.d.ts", @@ -65,6 +65,7 @@ "access": "public" }, "peerDependencies": { + "@lucide/svelte": "^0.562.0", "@sveltejs/kit": "^2.0.0", "svelte": "^5.0.0" }, @@ -77,7 +78,6 @@ } }, "dependencies": { - "@lucide/svelte": "^0.562.0", "svelte-hamburgers": "^5.0.0" }, "devDependencies": { diff --git a/packages/sveltekit-helper/src/components/alerts/alert.types.ts b/packages/sveltekit-helper/src/components/alerts/alert.types.ts deleted file mode 100644 index a0f51c4e..00000000 --- a/packages/sveltekit-helper/src/components/alerts/alert.types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { type Icon as IconType } from '@lucide/svelte' - -/** - * Available alert type variants - * - info: Informational message - * - warning: Warning or cautionary message - * - success: Success confirmation message - * - error: Error or critical message - */ -export type AlertType = 'info' | 'warning' | 'success' | 'error' - -/** - * Icon configuration for alert types - * Contains the Lucide icon component and corresponding colour - */ -export type IconDetail = { - /** Lucide icon component to display */ - icon: typeof IconType - /** CSS colour value for the icon (usually a semantic colour variable) */ - colour: string -} diff --git a/packages/sveltekit-helper/src/components/index.ts b/packages/sveltekit-helper/src/components/index.ts index 14023dbb..0e185935 100644 --- a/packages/sveltekit-helper/src/components/index.ts +++ b/packages/sveltekit-helper/src/components/index.ts @@ -1,4 +1,4 @@ export { default as Sidebar } from './Sidebar.svelte' export { default as Hamburger } from './Hamburger.svelte' -export { Alert, Notice } from './alerts' -export type { AlertProps, NoticeProps, AlertType } from './alerts' +export { Alert, Notice } from './notifications' +export type { AlertProps, NoticeProps, AlertType } from './notifications' diff --git a/packages/sveltekit-helper/src/components/alerts/Alert.svelte b/packages/sveltekit-helper/src/components/notifications/Alert.svelte similarity index 100% rename from packages/sveltekit-helper/src/components/alerts/Alert.svelte rename to packages/sveltekit-helper/src/components/notifications/Alert.svelte diff --git a/packages/sveltekit-helper/src/components/alerts/Notice.svelte b/packages/sveltekit-helper/src/components/notifications/Notice.svelte similarity index 100% rename from packages/sveltekit-helper/src/components/alerts/Notice.svelte rename to packages/sveltekit-helper/src/components/notifications/Notice.svelte diff --git a/packages/sveltekit-helper/src/components/notifications/alert.types.ts b/packages/sveltekit-helper/src/components/notifications/alert.types.ts new file mode 100644 index 00000000..c97f5861 --- /dev/null +++ b/packages/sveltekit-helper/src/components/notifications/alert.types.ts @@ -0,0 +1,10 @@ +import { type Icon as IconType } from '@lucide/svelte' + +/** Available notification type variants */ +export type AlertType = 'info' | 'warning' | 'success' | 'error' + +/** Icon configuration for notification types */ +export type IconDetail = { + icon: typeof IconType + colour: string +} diff --git a/packages/sveltekit-helper/src/components/alerts/alertIcons.ts b/packages/sveltekit-helper/src/components/notifications/alertIcons.ts similarity index 100% rename from packages/sveltekit-helper/src/components/alerts/alertIcons.ts rename to packages/sveltekit-helper/src/components/notifications/alertIcons.ts diff --git a/packages/sveltekit-helper/src/components/alerts/index.ts b/packages/sveltekit-helper/src/components/notifications/index.ts similarity index 100% rename from packages/sveltekit-helper/src/components/alerts/index.ts rename to packages/sveltekit-helper/src/components/notifications/index.ts From 889f5266c5a086cebdd9a50c70f1d0392ce3e50b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 13:40:22 +0000 Subject: [PATCH 4/9] refactor: Improve notification components structure and documentation - Move AlertType and NoticeType into respective component files - Remove internal exports (alertIcons, IconDetail) from public API - Add comprehensive @component documentation with examples to Alert and Notice - Convert single-line comments to multi-line format for better readability - Move IconDetail type definition into alertIcons.ts (internal use only) - Delete alert.types.ts (types now colocated with components) - Export both AlertType and NoticeType for external type usage Components now have complete inline documentation showing usage examples. --- .../sveltekit-helper/src/components/index.ts | 2 +- .../src/components/notifications/Alert.svelte | 26 +++++++++++++++++-- .../components/notifications/Notice.svelte | 20 ++++++++++++-- .../components/notifications/alert.types.ts | 10 ------- .../components/notifications/alertIcons.ts | 17 +++++++++--- .../src/components/notifications/index.ts | 6 ++--- 6 files changed, 59 insertions(+), 22 deletions(-) delete mode 100644 packages/sveltekit-helper/src/components/notifications/alert.types.ts diff --git a/packages/sveltekit-helper/src/components/index.ts b/packages/sveltekit-helper/src/components/index.ts index 0e185935..47028b3b 100644 --- a/packages/sveltekit-helper/src/components/index.ts +++ b/packages/sveltekit-helper/src/components/index.ts @@ -1,4 +1,4 @@ export { default as Sidebar } from './Sidebar.svelte' export { default as Hamburger } from './Hamburger.svelte' export { Alert, Notice } from './notifications' -export type { AlertProps, NoticeProps, AlertType } from './notifications' +export type { AlertProps, AlertType, NoticeProps, NoticeType } from './notifications' diff --git a/packages/sveltekit-helper/src/components/notifications/Alert.svelte b/packages/sveltekit-helper/src/components/notifications/Alert.svelte index 8d6b522a..29f5d3ee 100644 --- a/packages/sveltekit-helper/src/components/notifications/Alert.svelte +++ b/packages/sveltekit-helper/src/components/notifications/Alert.svelte @@ -1,9 +1,12 @@ + {#if visible}
import { type Icon as IconType } from '@lucide/svelte' - import type { AlertType } from './alert.types' + /** + * Available notice type variants + */ + export type NoticeType = 'info' | 'warning' | 'success' | 'error' export type NoticeProps = { - type?: AlertType + type?: NoticeType title: string visible?: boolean dismiss?: boolean @@ -32,6 +35,19 @@ const hide = () => (visible = false) + {#if visible}
= { +/** + * Icon configuration for notification types + */ +type IconDetail = { + icon: typeof IconType + colour: string +} + +export const alertIcons: Record = { info: { icon: Info, colour: 'var(--colour-semantic-info)' }, success: { icon: CircleCheck, colour: 'var(--colour-semantic-success)' }, warning: { icon: TriangleAlert, colour: 'var(--colour-semantic-warning)' }, diff --git a/packages/sveltekit-helper/src/components/notifications/index.ts b/packages/sveltekit-helper/src/components/notifications/index.ts index 4741e3be..3bccded1 100644 --- a/packages/sveltekit-helper/src/components/notifications/index.ts +++ b/packages/sveltekit-helper/src/components/notifications/index.ts @@ -1,6 +1,4 @@ export { default as Alert } from './Alert.svelte' export { default as Notice } from './Notice.svelte' -export type { AlertProps } from './Alert.svelte' -export type { NoticeProps } from './Notice.svelte' -export type { AlertType, IconDetail } from './alert.types' -export { alertIcons } from './alertIcons' +export type { AlertProps, AlertType } from './Alert.svelte' +export type { NoticeProps, NoticeType } from './Notice.svelte' From 22577691dca3b171340917461616bd5ab34702c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 13:44:17 +0000 Subject: [PATCH 5/9] chore: Clean up notification component type comments - Remove verbose comments from AlertType and NoticeType - Add concise comment to alertIcons export - Keep code minimal and self-documenting --- .../sveltekit-helper/src/components/notifications/Alert.svelte | 3 --- .../src/components/notifications/Notice.svelte | 3 --- .../src/components/notifications/alertIcons.ts | 3 +++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/sveltekit-helper/src/components/notifications/Alert.svelte b/packages/sveltekit-helper/src/components/notifications/Alert.svelte index 29f5d3ee..1210819d 100644 --- a/packages/sveltekit-helper/src/components/notifications/Alert.svelte +++ b/packages/sveltekit-helper/src/components/notifications/Alert.svelte @@ -2,9 +2,6 @@ import { type Icon as IconType } from '@lucide/svelte' import type { Snippet } from 'svelte' - /** - * Available alert type variants - */ export type AlertType = 'info' | 'warning' | 'success' | 'error' export type AlertProps = { diff --git a/packages/sveltekit-helper/src/components/notifications/Notice.svelte b/packages/sveltekit-helper/src/components/notifications/Notice.svelte index 930615de..99677073 100644 --- a/packages/sveltekit-helper/src/components/notifications/Notice.svelte +++ b/packages/sveltekit-helper/src/components/notifications/Notice.svelte @@ -1,9 +1,6 @@ {#if dismiss} - {/if} @@ -101,7 +104,7 @@ {/if}