@ainsleydev/sveltekit-helper 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,8 @@ export { default as Modal } from './Modal.svelte';
2
2
  export { default as Sidebar } from './Sidebar.svelte';
3
3
  export { default as Hamburger } from './Hamburger.svelte';
4
4
  export { default as TableOfContents } from './TableOfContents.svelte';
5
- export { Alert, Notice } from './notifications';
5
+ export { Alert, Notice, setAlertIcons } from './notifications';
6
6
  export type { ModalProps, TransitionFn } from './Modal.svelte';
7
- export type { AlertProps, AlertType, NoticeProps, NoticeType } from './notifications';
7
+ export type { AlertProps, AlertType, NoticeProps, NoticeType, IconDetail, NotificationType, } from './notifications';
8
8
  export type { TableOfContentsProps, TOCItem } from './TableOfContents.svelte';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC"}
@@ -2,4 +2,4 @@ export { default as Modal } from './Modal.svelte';
2
2
  export { default as Sidebar } from './Sidebar.svelte';
3
3
  export { default as Hamburger } from './Hamburger.svelte';
4
4
  export { default as TableOfContents } from './TableOfContents.svelte';
5
- export { Alert, Notice } from './notifications';
5
+ export { Alert, Notice, setAlertIcons } from './notifications';
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { Icon as IconType } from '@lucide/svelte';
3
- import type { Snippet } from 'svelte';
2
+ import type { Component, Snippet } from 'svelte';
4
3
 
5
4
  export type AlertType = 'info' | 'warning' | 'success' | 'error';
6
5
 
@@ -10,7 +9,7 @@ export type AlertProps = {
10
9
  children?: Snippet;
11
10
  visible?: boolean;
12
11
  dismiss?: boolean;
13
- icon?: typeof IconType;
12
+ icon?: Component;
14
13
  hideIcon?: boolean;
15
14
  };
16
15
  </script>
@@ -19,7 +18,7 @@ export type AlertProps = {
19
18
  import { X } from '@lucide/svelte'
20
19
  import { fade } from 'svelte/transition'
21
20
 
22
- import { alertIcons } from './alertIcons.js'
21
+ import { alertIconStore } from './alertIcons.js'
23
22
 
24
23
  let {
25
24
  type = 'info',
@@ -32,7 +31,7 @@ export type AlertProps = {
32
31
  ...restProps
33
32
  }: AlertProps = $props()
34
33
 
35
- const iconDetail = $derived(alertIcons[type])
34
+ const iconDetail = $derived($alertIconStore[type])
36
35
  const Icon = $derived(customIcon || iconDetail.icon)
37
36
  const hide = () => (visible = false)
38
37
  const ariaLive = $derived(type === 'error' ? 'assertive' : 'polite')
@@ -1,5 +1,4 @@
1
- import type { Icon as IconType } from '@lucide/svelte';
2
- import type { Snippet } from 'svelte';
1
+ import type { Component, Snippet } from 'svelte';
3
2
  export type AlertType = 'info' | 'warning' | 'success' | 'error';
4
3
  export type AlertProps = {
5
4
  type?: AlertType;
@@ -7,7 +6,7 @@ export type AlertProps = {
7
6
  children?: Snippet;
8
7
  visible?: boolean;
9
8
  dismiss?: boolean;
10
- icon?: typeof IconType;
9
+ icon?: Component;
11
10
  hideIcon?: boolean;
12
11
  };
13
12
  /**
@@ -41,7 +40,7 @@ export type AlertProps = {
41
40
  * - `--_alert-text-colour`: Text color (default: rgba(255, 255, 255, 50%))
42
41
  * - `--_alert-icon-colour`: Icon color (set automatically based on type)
43
42
  */
44
- declare const Alert: import("svelte").Component<AlertProps, {}, "visible">;
43
+ declare const Alert: Component<AlertProps, {}, "visible">;
45
44
  type Alert = ReturnType<typeof Alert>;
46
45
  export default Alert;
47
46
  //# sourceMappingURL=Alert.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/Alert.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,QAAQ,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAoEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,KAAK,uDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Alert.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/Alert.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAoEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,KAAK,sCAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type { Icon as IconType } from '@lucide/svelte';
2
+ import type { Component } from 'svelte';
3
3
 
4
4
  export type NoticeType = 'info' | 'warning' | 'success' | 'error';
5
5
 
@@ -8,7 +8,7 @@ export type NoticeProps = {
8
8
  title: string;
9
9
  visible?: boolean;
10
10
  dismiss?: boolean;
11
- icon?: typeof IconType;
11
+ icon?: Component;
12
12
  hideIcon?: boolean;
13
13
  };
14
14
  </script>
@@ -17,7 +17,7 @@ export type NoticeProps = {
17
17
  import { X } from '@lucide/svelte'
18
18
  import { fade } from 'svelte/transition'
19
19
 
20
- import { alertIcons } from './alertIcons'
20
+ import { alertIconStore } from './alertIcons'
21
21
 
22
22
  let {
23
23
  type = 'info',
@@ -29,7 +29,7 @@ export type NoticeProps = {
29
29
  ...restProps
30
30
  }: NoticeProps = $props()
31
31
 
32
- const iconDetail = $derived(alertIcons[type])
32
+ const iconDetail = $derived($alertIconStore[type])
33
33
  const Icon = $derived(customIcon || iconDetail.icon)
34
34
  const hide = () => (visible = false)
35
35
  const ariaLive = $derived(type === 'error' ? 'assertive' : 'polite')
@@ -1,11 +1,11 @@
1
- import type { Icon as IconType } from '@lucide/svelte';
1
+ import type { Component } from 'svelte';
2
2
  export type NoticeType = 'info' | 'warning' | 'success' | 'error';
3
3
  export type NoticeProps = {
4
4
  type?: NoticeType;
5
5
  title: string;
6
6
  visible?: boolean;
7
7
  dismiss?: boolean;
8
- icon?: typeof IconType;
8
+ icon?: Component;
9
9
  hideIcon?: boolean;
10
10
  };
11
11
  /**
@@ -29,7 +29,7 @@ export type NoticeProps = {
29
29
  * - `--_notice-title-colour`: Title text color (default: rgba(255, 255, 255, 1))
30
30
  * - `--_notice-icon-colour`: Icon color (set automatically based on type)
31
31
  */
32
- declare const Notice: import("svelte").Component<NoticeProps, {}, "visible">;
32
+ declare const Notice: Component<NoticeProps, {}, "visible">;
33
33
  type Notice = ReturnType<typeof Notice>;
34
34
  export default Notice;
35
35
  //# sourceMappingURL=Notice.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notice.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/Notice.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,QAAQ,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA0DF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,MAAM,wDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Notice.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/Notice.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA0DF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,MAAM,uCAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -1,18 +1,38 @@
1
- import { type Icon as IconType } from '@lucide/svelte';
1
+ import type { Component } from 'svelte';
2
2
  /**
3
- * Notification type variants
3
+ * Notification type variants.
4
4
  */
5
- type NotificationType = 'info' | 'warning' | 'success' | 'error';
5
+ export type NotificationType = 'info' | 'warning' | 'success' | 'error';
6
6
  /**
7
- * Icon configuration for notification types
7
+ * Icon configuration for a notification type.
8
8
  */
9
- type IconDetail = {
10
- icon: typeof IconType;
9
+ export type IconDetail = {
10
+ icon: Component;
11
11
  colour: string;
12
12
  };
13
13
  /**
14
- * Icon mapping for notification types
14
+ * Writable store holding the active icon map for all Alert and Notice components.
15
+ * Consumers can override individual or all entries via setAlertIcons().
15
16
  */
16
- export declare const alertIcons: Record<NotificationType, IconDetail>;
17
- export {};
17
+ export declare const alertIconStore: import("svelte/store").Writable<Record<NotificationType, IconDetail>>;
18
+ /**
19
+ * Globally overrides icons for Alert and Notice components.
20
+ * Call this once in your root layout (e.g. +layout.svelte) to supply
21
+ * your own SVG components instead of the default Lucide icons.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { setAlertIcons } from '@ainsleydev/sveltekit-helper';
26
+ * import InfoIcon from '../../lib/icons/Info.svelte';
27
+ * import SuccessIcon from '../../lib/icons/Success.svelte';
28
+ *
29
+ * setAlertIcons({
30
+ * info: { icon: InfoIcon, colour: 'var(--colour-info)' },
31
+ * success: { icon: SuccessIcon, colour: 'var(--colour-success)' },
32
+ * });
33
+ * ```
34
+ *
35
+ * @param overrides - Partial map of notification types to icon configurations.
36
+ */
37
+ export declare function setAlertIcons(overrides: Partial<Record<NotificationType, IconDetail>>): void;
18
38
  //# sourceMappingURL=alertIcons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alertIcons.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/alertIcons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,IAAI,IAAI,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAElG;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE;;GAEG;AACH,KAAK,UAAU,GAAG;IACjB,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAK3D,CAAC"}
1
+ {"version":3,"file":"alertIcons.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/alertIcons.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGxC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AASF;;;GAGG;AACH,eAAO,MAAM,cAAc,uEAAoE,CAAC;AAEhG;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,GAAG,IAAI,CAE5F"}
@@ -1,10 +1,35 @@
1
1
  import { CircleCheck, CircleX, Info, TriangleAlert } from '@lucide/svelte';
2
- /**
3
- * Icon mapping for notification types
4
- */
5
- export const alertIcons = {
2
+ import { writable } from 'svelte/store';
3
+ const defaultAlertIcons = {
6
4
  info: { icon: Info, colour: 'var(--colour-semantic-info)' },
7
5
  success: { icon: CircleCheck, colour: 'var(--colour-semantic-success)' },
8
6
  warning: { icon: TriangleAlert, colour: 'var(--colour-semantic-warning)' },
9
7
  error: { icon: CircleX, colour: 'var(--colour-semantic-error)' },
10
8
  };
9
+ /**
10
+ * Writable store holding the active icon map for all Alert and Notice components.
11
+ * Consumers can override individual or all entries via setAlertIcons().
12
+ */
13
+ export const alertIconStore = writable(defaultAlertIcons);
14
+ /**
15
+ * Globally overrides icons for Alert and Notice components.
16
+ * Call this once in your root layout (e.g. +layout.svelte) to supply
17
+ * your own SVG components instead of the default Lucide icons.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { setAlertIcons } from '@ainsleydev/sveltekit-helper';
22
+ * import InfoIcon from '../../lib/icons/Info.svelte';
23
+ * import SuccessIcon from '../../lib/icons/Success.svelte';
24
+ *
25
+ * setAlertIcons({
26
+ * info: { icon: InfoIcon, colour: 'var(--colour-info)' },
27
+ * success: { icon: SuccessIcon, colour: 'var(--colour-success)' },
28
+ * });
29
+ * ```
30
+ *
31
+ * @param overrides - Partial map of notification types to icon configurations.
32
+ */
33
+ export function setAlertIcons(overrides) {
34
+ alertIconStore.update((current) => ({ ...current, ...overrides }));
35
+ }
@@ -2,4 +2,6 @@ export { default as Alert } from './Alert.svelte';
2
2
  export { default as Notice } from './Notice.svelte';
3
3
  export type { AlertProps, AlertType } from './Alert.svelte';
4
4
  export type { NoticeProps, NoticeType } from './Notice.svelte';
5
+ export { setAlertIcons } from './alertIcons.js';
6
+ export type { IconDetail, NotificationType } from './alertIcons.js';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { default as Alert } from './Alert.svelte';
2
2
  export { default as Notice } from './Notice.svelte';
3
+ export { setAlertIcons } from './alertIcons.js';
@@ -121,7 +121,7 @@ const organizationSchema = $derived.by(() => {
121
121
  -->
122
122
  <svelte:head>
123
123
  <!-- Meta -->
124
- <title>{meta.title} | {siteName}</title>
124
+ <title>{meta.title === site ? site : `${meta.title} | ${siteName}`}</title>
125
125
  <meta name="description" content={meta.description} />
126
126
  <!-- Canonical -->
127
127
  {#if meta.canonical}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainsleydev/sveltekit-helper",
3
- "version": "0.6.6",
3
+ "version": "0.7.0",
4
4
  "description": "SvelteKit utilities, components and helpers for ainsley.dev builds",
5
5
  "license": "MIT",
6
6
  "type": "module",