@velastack/patterns 0.2.0 → 0.2.1

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.
Files changed (39) hide show
  1. package/README.md +10 -1
  2. package/dist/chunks/{collections-DcnlHh80.js → collections-wIKcIKzY.js} +2 -2
  3. package/dist/chunks/{collections-DcnlHh80.js.map → collections-wIKcIKzY.js.map} +1 -1
  4. package/dist/chunks/errors-D6gyegUK.js +14 -0
  5. package/dist/chunks/errors-D6gyegUK.js.map +1 -0
  6. package/dist/chunks/{generate-3QOmCHGZ.js → generate-vRi-W3rL.js} +2 -2
  7. package/dist/chunks/{generate-3QOmCHGZ.js.map → generate-vRi-W3rL.js.map} +1 -1
  8. package/dist/chunks/{generate.runtime-CL7NYB3N.js → generate.runtime-BX0QcpGg.js} +2 -2
  9. package/dist/chunks/{generate.runtime-CL7NYB3N.js.map → generate.runtime-BX0QcpGg.js.map} +1 -1
  10. package/dist/chunks/{generate.runtime-CsGO0zuZ.js → generate.runtime-BlK7yHff.js} +2 -2
  11. package/dist/chunks/{generate.runtime-CsGO0zuZ.js.map → generate.runtime-BlK7yHff.js.map} +1 -1
  12. package/dist/chunks/{generate.runtime-CsBQGP_O.js → generate.runtime-BmW0th7X.js} +2 -2
  13. package/dist/chunks/{generate.runtime-CsBQGP_O.js.map → generate.runtime-BmW0th7X.js.map} +1 -1
  14. package/dist/chunks/{generate.runtime-Bhr2eJg6.js → generate.runtime-C4wcEIc9.js} +2 -2
  15. package/dist/chunks/{generate.runtime-Bhr2eJg6.js.map → generate.runtime-C4wcEIc9.js.map} +1 -1
  16. package/dist/chunks/{generate.runtime-CVc_YHTk.js → generate.runtime-CNrtLDCf.js} +2 -2
  17. package/dist/chunks/{generate.runtime-CVc_YHTk.js.map → generate.runtime-CNrtLDCf.js.map} +1 -1
  18. package/dist/chunks/{generate.runtime-CAEeX7Pf.js → generate.runtime-CQ0Veyk4.js} +2 -2
  19. package/dist/chunks/{generate.runtime-CAEeX7Pf.js.map → generate.runtime-CQ0Veyk4.js.map} +1 -1
  20. package/dist/chunks/{generate.runtime-DURymKCu.js → generate.runtime-CQWygx-F.js} +2 -2
  21. package/dist/chunks/{generate.runtime-DURymKCu.js.map → generate.runtime-CQWygx-F.js.map} +1 -1
  22. package/dist/chunks/{generate.runtime-D0D5jods.js → generate.runtime-DOBfTVW3.js} +2 -2
  23. package/dist/chunks/{generate.runtime-D0D5jods.js.map → generate.runtime-DOBfTVW3.js.map} +1 -1
  24. package/dist/chunks/{generate.runtime-B3IKmGyV.js → generate.runtime-DpgPAnEd.js} +2 -2
  25. package/dist/chunks/{generate.runtime-B3IKmGyV.js.map → generate.runtime-DpgPAnEd.js.map} +1 -1
  26. package/dist/chunks/{shared-ClWQZdMa.js → shared-BZlvCHX8.js} +2 -2
  27. package/dist/chunks/{shared-ClWQZdMa.js.map → shared-BZlvCHX8.js.map} +1 -1
  28. package/dist/chunks/ui-DZS2SAQg.js +173 -0
  29. package/dist/chunks/ui-DZS2SAQg.js.map +1 -0
  30. package/dist/chunks/write-result-Cb3r0sCO.js +445 -0
  31. package/dist/chunks/write-result-Cb3r0sCO.js.map +1 -0
  32. package/dist/index.d.ts +109 -1
  33. package/dist/index.js +1878 -1842
  34. package/dist/index.js.map +1 -1
  35. package/package.json +2 -1
  36. package/dist/chunks/errors-D3Zy3wCg.js +0 -10
  37. package/dist/chunks/errors-D3Zy3wCg.js.map +0 -1
  38. package/dist/chunks/write-result-8JW_vky2.js +0 -355
  39. package/dist/chunks/write-result-8JW_vky2.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velastack/patterns",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Registry of VelaStack patterns: generators and modifications applied to SvelteKit projects by the VelaStack CLI.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -106,6 +106,7 @@
106
106
  "package-manager-detector": "^1.6.0",
107
107
  "pluralize": "^8.0.0",
108
108
  "pocketbase": "^0.28.0",
109
+ "shadcn-svelte": "^1.6.0",
109
110
  "stripe": "^19.3.0",
110
111
  "svelte": "^5.56.10",
111
112
  "ts-morph": "^28.0.0",
@@ -1,10 +0,0 @@
1
- //#region src/core/errors.ts
2
- var e = class extends Error {
3
- constructor(e) {
4
- super(e), this.name = "InvalidArgumentError";
5
- }
6
- };
7
- //#endregion
8
- export { e as t };
9
-
10
- //# sourceMappingURL=errors-D3Zy3wCg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-D3Zy3wCg.js","names":[],"sources":["../../src/core/errors.ts"],"sourcesContent":["export class InvalidArgumentError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidArgumentError\";\n }\n}\n"],"mappings":";AAAA,IAAa,IAAb,cAA0C,MAAM;CAC9C,YAAY,GAAiB;EAE3B,AADA,MAAM,CAAO,GACb,KAAK,OAAO;CACd;AACF"}
@@ -1,355 +0,0 @@
1
- import { n as e } from "./format-result-BdAy5M8C.js";
2
- import { o as t, r as n } from "./constants-PBCzh8eY.js";
3
- import { n as r, t as i } from "./logger-CQONztPm.js";
4
- import a from "node:path";
5
- import { existsSync as o, mkdirSync as s, readFileSync as c, readdirSync as l, rmSync as u, writeFileSync as d } from "node:fs";
6
- import { detect as f } from "package-manager-detector";
7
- import { resolveCommand as p } from "package-manager-detector/commands";
8
- import m from "cross-spawn";
9
- //#region src/ui/components/auth-menu/auth-menu-content.svelte?raw
10
- var h = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n\n let {\n children,\n class: className,\n ...restProps\n }: DropdownMenuPrimitive.ContentProps & {\n portalProps?: DropdownMenuPrimitive.PortalProps;\n } = $props();\n\n let { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Content class={className} {...restProps}>\n {@render children?.()}\n </DropdownMenu.Content>\n{:else}\n <div class={cn('flex flex-col w-full', className)}>\n {@render children?.()}\n </div>\n{/if}\n", g = "<script lang=\"ts\">\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let { children, ...restProps } = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Group {...restProps}>\n {@render children?.()}\n </DropdownMenu.Group>\n{:else}\n {@render children?.()}\n{/if}\n", _ = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { children, href = undefined, ...restProps } = $props();\n\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n\n const handleClick = () => {\n if (restProps.onclick) {\n restProps.onclick();\n } else {\n if (href) {\n goto(href);\n }\n }\n };\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Item {...restProps} onclick={handleClick}>\n {@render children?.()}\n </DropdownMenu.Item>\n{:else}\n <Button\n class=\"w-full justify-start md:justify-center md:w-auto\"\n variant=\"ghost\"\n {href}\n {...restProps}\n >\n {@render children?.()}\n </Button>\n{/if}\n", v = "<script lang=\"ts\">\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let { children, ...restProps } = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Label {...restProps}>\n {@render children?.()}\n </DropdownMenu.Label>\n{/if}\n", y = "<script lang=\"ts\">\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let restProps = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Separator {...restProps} />\n{/if}\n", b = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { class: className = '', ...restProps } = $props();\n\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />\n{/if}\n", x = "<script lang=\"ts\">\n import { page } from '$app/state';\n import { browser } from '$app/environment';\n import { onMount, setContext } from 'svelte';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n\n let { user, guest } = $props();\n\n const breakpoint = 768;\n const breakpointQuery = `(min-width: ${breakpoint}px)`;\n\n let hasMounted = $state(false);\n let authMenuContext = $state<AuthMenuContext>({ isDesktop: true });\n\n setContext(AUTH_MENU_CONTEXT_KEY, authMenuContext);\n\n function updateIsDesktop() {\n if (!browser) return;\n authMenuContext.isDesktop = window.matchMedia(breakpointQuery).matches;\n }\n\n onMount(() => {\n updateIsDesktop();\n hasMounted = true;\n const mq = window.matchMedia(breakpointQuery);\n const listener = () => (authMenuContext.isDesktop = mq.matches);\n mq.addEventListener('change', listener);\n return () => mq.removeEventListener('change', listener);\n });\n<\/script>\n\n{#if page.data.user}\n {#if authMenuContext.isDesktop}\n <DropdownMenu.Root>\n {@render user?.()}\n </DropdownMenu.Root>\n {:else}\n <!-- This prevents the menu from being rendered twice before we know if we're on desktop or not -->\n {#if hasMounted}\n {@render user?.()}\n {/if}\n {/if}\n{:else}\n {@render guest?.()}\n{/if}\n", ee = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", te = "import Root from \"./auth-menu.svelte\";\nimport Content from \"./auth-menu-content.svelte\";\nimport Trigger from \"./auth-menu-trigger.svelte\";\nimport Group from \"./auth-menu-group.svelte\";\nimport Label from \"./auth-menu-label.svelte\";\nimport Separator from \"./auth-menu-separator.svelte\";\nimport Item from \"./auth-menu-item.svelte\";\n\nexport { Root, Content, Trigger, Group, Label, Separator, Item };\n", ne = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {new Date(value).toLocaleDateString()}\n {/if}\n</div>\n", re = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: boolean | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value ? 'Yes' : 'No'}\n</div>\n", ie = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {new Date(value).toLocaleDateString()}\n {/if}\n</div>\n", ae = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", oe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", se = "<script lang=\"ts\">\n import FileIcon from '@lucide/svelte/icons/file';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n collectionId,\n id,\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n collectionId: string;\n id: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {#if Array.isArray(value)}\n {#each value.slice(0, 2) as filename}\n {#if ['.jpg', '.png', '.jpeg', '.webp', '.gif'].some((ext) => filename.endsWith(ext))}\n <img\n src=\"/api/files/{collectionId}/{id}/{filename}\"\n class=\"w-8 h-8 rounded-sm object-cover inline-block mr-2\"\n alt={filename}\n title={filename}\n />\n {:else}\n <div\n class=\"inline-flex items-center justify-center w-8 h-8 bg-muted rounded-sm mr-2\"\n title={filename}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n {/each}\n {#if value.length > 2}\n and {value.length - 2} more files\n {/if}\n {:else if ['.jpg', '.png', '.jpeg', '.webp', '.gif'].some((ext) => value.endsWith(ext))}\n <img\n src=\"/api/files/{collectionId}/{id}/{value}\"\n class=\"w-8 h-8 rounded-sm object-cover\"\n alt={value}\n title={value}\n />\n {:else}\n <div\n class=\"inline-flex items-center justify-center w-8 h-8 bg-muted rounded-sm\"\n title={value}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n {/if}\n</div>\n", ce = "<script lang=\"ts\">\n import MapPinIcon from '@lucide/svelte/icons/map-pin';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: {\n value: { lat: number; lon: number } | undefined;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center space-x-1', className)} {...restProps}>\n {#if value}\n <MapPinIcon class=\"inline-block w-4 h-4 text-muted-foreground\" />\n <span>{value.lat.toFixed(6)}, {value.lon.toFixed(6)}</span>\n {/if}\n</div>\n", le = "export { default as AutodateCell } from \"./autodate.svelte\";\nexport { default as BoolCell } from \"./bool.svelte\";\nexport { default as DateCell } from \"./date.svelte\";\nexport { default as EditorCell } from \"./editor.svelte\";\nexport { default as EmailCell } from \"./email.svelte\";\nexport { default as FileCell } from \"./file.svelte\";\nexport { default as GeoPointCell } from \"./geoPoint.svelte\";\nexport { default as JsonCell } from \"./json.svelte\";\nexport { default as NumberCell } from \"./number.svelte\";\nexport { default as PasswordCell } from \"./password.svelte\";\nexport { default as RelationCell } from \"./relation.svelte\";\nexport { default as SelectCell } from \"./select.svelte\";\nexport { default as TextCell } from \"./text.svelte\";\nexport { default as UrlCell } from \"./url.svelte\";\n", ue = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: any } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value !== undefined}\n {JSON.stringify(value)}\n {/if}\n</div>\n", S = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: number | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", C = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>********</div>\n", w = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\n\n let {\n value,\n expanded,\n displayField = 'id',\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n expanded: any;\n displayField?: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if expanded}\n {#if Array.isArray(expanded)}\n {#each expanded.slice(0, 2) as item}\n <Badge variant=\"outline\" class=\"mr-1\">\n {item[displayField]}\n </Badge>\n {/each}\n {#if expanded.length > 2}\n <Badge variant=\"secondary\" class=\"mr-1\">\n +{expanded.length - 2}\n </Badge>\n {/if}\n {:else}\n <Badge variant=\"outline\" class=\"mr-1\">\n {expanded[displayField]}\n </Badge>\n {/if}\n {/if}\n</div>\n", T = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\n\n let {\n value,\n options,\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n options: Record<string, { label: string; value: string }>;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {#if Array.isArray(value)}\n {#each value.slice(0, 2) as item}\n <Badge variant=\"outline\" class=\"mr-1\">\n {options[item].label}\n </Badge>\n {/each}\n {:else}\n {options[value].label}\n {/if}\n {/if}\n</div>\n", E = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", D = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\n\n let {\n value,\n class: className,\n target = '_blank',\n rel = 'noopener noreferrer',\n ...restProps\n }: {\n value: string | undefined;\n target?: string;\n rel?: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n <a href={value} {target} {rel}>{value}</a>\n {/if}\n</div>\n", O = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import type { Column } from '@tanstack/table-core';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\n import ArrowUpIcon from '@lucide/svelte/icons/arrow-up';\n import ArrowDownIcon from '@lucide/svelte/icons/arrow-down';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import { cn } from '$lib/utils';\n\n let {\n column,\n title,\n class: className,\n ...restProps\n }: { column: Column<any>; title: string } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n{#if !column?.getCanSort()}\n <div class={className} {...restProps}>\n {title}\n </div>\n{:else}\n <div class={cn('flex items-center', className)} {...restProps}>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Button\n {...props}\n variant=\"ghost\"\n size=\"sm\"\n class=\"data-[state=open]:bg-accent -ml-3 h-8\"\n >\n <span>\n {title}\n </span>\n {#if column.getIsSorted() === 'desc'}\n <ArrowDownIcon />\n {:else if column.getIsSorted() === 'asc'}\n <ArrowUpIcon />\n {:else}\n <ChevronsUpDownIcon />\n {/if}\n </Button>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"start\">\n <DropdownMenu.Item onclick={() => column.toggleSorting(false)}>\n <ArrowUpIcon class=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenu.Item>\n <DropdownMenu.Item onclick={() => column.toggleSorting(true)}>\n <ArrowDownIcon class=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </div>\n{/if}\n", k = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", A = "import {\n type RowData,\n type TableOptions,\n type TableOptionsResolved,\n type TableState,\n type Updater,\n createTable,\n} from \"@tanstack/table-core\";\n\ndeclare module \"@tanstack/table-core\" {\n interface ColumnMeta<TData extends RowData, TValue> {\n /** Classes for the column's header and body cells; pages read `columnDef.meta?.class`. */\n class?: string;\n }\n}\n\n/**\n * Creates a reactive TanStack table object for Svelte.\n * @param options Table options to create the table with.\n * @returns A reactive table object.\n * @example\n * ```svelte\n * <script>\n * const table = createSvelteTable({ ... })\n * <\/script>\n *\n * <table>\n * <thead>\n * {#each table.getHeaderGroups() as headerGroup}\n * <tr>\n * {#each headerGroup.headers as header}\n * <th colspan={header.colSpan}>\n * <FlexRender content={header.column.columnDef.header} context={header.getContext()} />\n * </th>\n * {/each}\n * </tr>\n * {/each}\n * </thead>\n * <!-- ... -->\n * </table>\n * ```\n */\nexport function createSvelteTable<TData extends RowData>(\n options: TableOptions<TData>,\n) {\n const resolvedOptions: TableOptionsResolved<TData> = mergeObjects(\n {\n state: {},\n onStateChange() {},\n renderFallbackValue: null,\n mergeOptions: (\n defaultOptions: TableOptions<TData>,\n options: Partial<TableOptions<TData>>,\n ) => {\n return mergeObjects(defaultOptions, options);\n },\n },\n options,\n );\n\n const table = createTable(resolvedOptions);\n let state = $state<TableState>(table.initialState);\n\n function updateOptions() {\n table.setOptions(() => {\n return mergeObjects(resolvedOptions, options, {\n state: mergeObjects(state, options.state || {}),\n\n onStateChange: (updater: Updater<TableState>) => {\n if (updater instanceof Function) state = updater(state);\n else state = mergeObjects(state, updater);\n\n options.onStateChange?.(updater);\n },\n });\n });\n }\n\n updateOptions();\n\n $effect.pre(() => {\n updateOptions();\n });\n\n return table;\n}\n\ntype MaybeThunk<T extends object> = T | (() => T | null | undefined);\ntype Intersection<T extends readonly unknown[]> = (T extends [\n infer H,\n ...infer R,\n]\n ? H & Intersection<R>\n : unknown) & {};\n\n/**\n * Lazily merges several objects (or thunks) while preserving\n * getter semantics from every source.\n *\n * Proxy-based to avoid known WebKit recursion issue.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function mergeObjects<Sources extends readonly MaybeThunk<any>[]>(\n ...sources: Sources\n): Intersection<{ [K in keyof Sources]: Sources[K] }> {\n const resolve = <T extends object>(src: MaybeThunk<T>): T | undefined =>\n typeof src === \"function\" ? (src() ?? undefined) : src;\n\n const findSourceWithKey = (key: PropertyKey) => {\n for (let i = sources.length - 1; i >= 0; i--) {\n const obj = resolve(sources[i]);\n if (obj && key in obj) return obj;\n }\n return undefined;\n };\n\n return new Proxy(Object.create(null), {\n get(_, key) {\n const src = findSourceWithKey(key);\n\n return src?.[key as never];\n },\n\n has(_, key) {\n return !!findSourceWithKey(key);\n },\n\n ownKeys(): (string | symbol)[] {\n // eslint-disable-next-line svelte/prefer-svelte-reactivity\n const all = new Set<string | symbol>();\n for (const s of sources) {\n const obj = resolve(s);\n if (obj) {\n for (const k of Reflect.ownKeys(obj) as (string | symbol)[]) {\n all.add(k);\n }\n }\n }\n return [...all];\n },\n\n getOwnPropertyDescriptor(_, key) {\n const src = findSourceWithKey(key);\n if (!src) return undefined;\n return {\n configurable: true,\n enumerable: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: (src as any)[key],\n writable: true,\n };\n },\n }) as Intersection<{ [K in keyof Sources]: Sources[K] }>;\n}\n", j = "<script\n lang=\"ts\"\n generics=\"TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>\"\n>\n import type { CellContext, ColumnDefTemplate, HeaderContext } from '@tanstack/table-core';\n import { RenderComponentConfig, RenderSnippetConfig } from './render-helpers.js';\n import type { Attachment } from 'svelte/attachments';\n type Props = {\n /** The cell or header field of the current cell's column definition. */\n content?: TContext extends HeaderContext<TData, TValue>\n ? ColumnDefTemplate<HeaderContext<TData, TValue>>\n : TContext extends CellContext<TData, TValue>\n ? ColumnDefTemplate<CellContext<TData, TValue>>\n : never;\n /** The result of the `getContext()` function of the header or cell */\n context: TContext;\n\n /** Used to pass attachments that can't be gotten through context */\n attach?: Attachment;\n };\n\n let { content, context, attach }: Props = $props();\n<\/script>\n\n{#if typeof content === 'string'}\n {content}\n{:else if content instanceof Function}\n <!-- It's unlikely that a CellContext will be passed to a Header -->\n <!-- eslint-disable-next-line @typescript-eslint/no-explicit-any -->\n {@const result = content(context as any)}\n {#if result instanceof RenderComponentConfig}\n {@const { component: Component, props } = result}\n <Component {...props} {attach} />\n {:else if result instanceof RenderSnippetConfig}\n {@const { snippet, params } = result}\n {@render snippet({ ...params, attach })}\n {:else}\n {result}\n {/if}\n{/if}\n", M = "export { default as FlexRender } from \"./flex-render.svelte\";\nexport { renderComponent, renderSnippet } from \"./render-helpers.js\";\nexport { createSvelteTable } from \"./data-table.svelte.js\";\n", N = "import type { Component, ComponentProps, Snippet } from \"svelte\";\n\n/**\n * A helper class to make it easy to identify Svelte components in\n * `columnDef.cell` and `columnDef.header` properties.\n *\n * > NOTE: This class should only be used internally by the adapter. If you're\n * reading this and you don't know what this is for, you probably don't need it.\n *\n * @example\n * ```svelte\n * {@const result = content(context as any)}\n * {#if result instanceof RenderComponentConfig}\n * {@const { component: Component, props } = result}\n * <Component {...props} />\n * {/if}\n * ```\n */\nexport class RenderComponentConfig<TComponent extends Component> {\n component: TComponent;\n props: ComponentProps<TComponent> | Record<string, never>;\n constructor(\n component: TComponent,\n props: ComponentProps<TComponent> | Record<string, never> = {},\n ) {\n this.component = component;\n this.props = props;\n }\n}\n\n/**\n * A helper class to make it easy to identify Svelte Snippets in `columnDef.cell` and `columnDef.header` properties.\n *\n * > NOTE: This class should only be used internally by the adapter. If you're\n * reading this and you don't know what this is for, you probably don't need it.\n *\n * @example\n * ```svelte\n * {@const result = content(context as any)}\n * {#if result instanceof RenderSnippetConfig}\n * {@const { snippet, params } = result}\n * {@render snippet(params)}\n * {/if}\n * ```\n */\nexport class RenderSnippetConfig<TProps> {\n snippet: Snippet<[TProps]>;\n params: TProps;\n constructor(snippet: Snippet<[TProps]>, params: TProps) {\n this.snippet = snippet;\n this.params = params;\n }\n}\n\n/**\n * A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties.\n *\n * This is only to be used with Svelte Components - use `renderSnippet` for Svelte Snippets.\n *\n * @param component A Svelte component\n * @param props The props to pass to `component`\n * @returns A `RenderComponentConfig` object that helps svelte-table know how to render the header/cell component.\n * @example\n * ```ts\n * // +page.svelte\n * const defaultColumns = [\n * columnHelper.accessor('name', {\n * header: header => renderComponent(SortHeader, { label: 'Name', header }),\n * }),\n * columnHelper.accessor('state', {\n * header: header => renderComponent(SortHeader, { label: 'State', header }),\n * }),\n * ]\n * ```\n * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}\n */\nexport function renderComponent<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Component<any>,\n Props extends ComponentProps<T>,\n>(component: T, props: Props = {} as Props) {\n return new RenderComponentConfig(component, props);\n}\n\n/**\n * A helper function to help create cells from Svelte Snippets through ColumnDef's `cell` and `header` properties.\n *\n * The snippet must only take one parameter.\n *\n * This is only to be used with Snippets - use `renderComponent` for Svelte Components.\n *\n * @param snippet\n * @param params\n * @returns - A `RenderSnippetConfig` object that helps svelte-table know how to render the header/cell snippet.\n * @example\n * ```ts\n * // +page.svelte\n * const defaultColumns = [\n * columnHelper.accessor('name', {\n * cell: cell => renderSnippet(nameSnippet, { name: cell.row.name }),\n * }),\n * columnHelper.accessor('state', {\n * cell: cell => renderSnippet(stateSnippet, { state: cell.row.state }),\n * }),\n * ]\n * ```\n * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}\n */\nexport function renderSnippet<TProps>(\n snippet: Snippet<[TProps]>,\n params: TProps = {} as TProps,\n) {\n return new RenderSnippetConfig(snippet, params);\n}\n", P = "<script lang=\"ts\" generics=\"TData, TValue\">\n import type { Component } from 'svelte';\n import { SvelteSet } from 'svelte/reactivity';\n import type { Column } from '@tanstack/table-core';\n import CirclePlusIcon from '@lucide/svelte/icons/circle-plus';\n import CheckIcon from '@lucide/svelte/icons/check';\n import * as Command from '$lib/components/ui/command';\n import * as Popover from '$lib/components/ui/popover';\n import { Button } from '$lib/components/ui/button';\n import { Separator } from '$lib/components/ui/separator';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\n\n let {\n column,\n title,\n options\n }: {\n column: Column<TData, TValue>;\n title: string;\n options: {\n label: string;\n value: string;\n icon?: Component;\n }[];\n } = $props();\n\n const facets = $derived(column?.getFacetedUniqueValues());\n const selectedValues = $derived(new SvelteSet(column?.getFilterValue() as string[]));\n<\/script>\n\n<Popover.Root>\n <Popover.Trigger>\n {#snippet child({ props })}\n <Button {...props} variant=\"outline\" size=\"sm\" class=\"h-8 border-dashed\">\n <CirclePlusIcon />\n {title}\n {#if selectedValues.size > 0}\n <Separator orientation=\"vertical\" class=\"mx-2 h-4\" />\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal lg:hidden\">\n {selectedValues.size}\n </Badge>\n <div class=\"hidden space-x-1 lg:flex\">\n {#if selectedValues.size > 2}\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal\">\n {selectedValues.size} selected\n </Badge>\n {:else}\n {#each options.filter((opt) => selectedValues.has(opt.value)) as option (option)}\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal\">\n {option.label}\n </Badge>\n {/each}\n {/if}\n </div>\n {/if}\n </Button>\n {/snippet}\n </Popover.Trigger>\n <Popover.Content class=\"w-[200px] p-0\" align=\"start\">\n <Command.Root>\n <Command.Input placeholder={title} />\n <Command.List>\n <Command.Empty>No results found.</Command.Empty>\n <Command.Group>\n {#each options as option (option)}\n {@const isSelected = selectedValues.has(option.value)}\n <Command.Item\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n class={cn(\n 'border-primary mr-2 flex size-4 items-center justify-center rounded-sm border',\n isSelected ? 'bg-primary text-primary-foreground' : 'opacity-50 [&_svg]:invisible'\n )}\n >\n <CheckIcon class=\"size-4\" />\n </div>\n {#if option.icon}\n {@const Icon = option.icon}\n <Icon class=\"text-muted-foreground\" />\n {/if}\n\n <span>{option.label}</span>\n {#if facets?.get(option.value)}\n <span class=\"ml-auto flex size-4 items-center justify-center font-mono text-xs\">\n {facets.get(option.value)}\n </span>\n {/if}\n </Command.Item>\n {/each}\n </Command.Group>\n {#if selectedValues.size > 0}\n <Command.Separator />\n <Command.Group>\n <Command.Item\n onSelect={() => column?.setFilterValue(undefined)}\n class=\"justify-center text-center\"\n >\n Clear filters\n </Command.Item>\n </Command.Group>\n {/if}\n </Command.List>\n </Command.Root>\n </Popover.Content>\n</Popover.Root>\n", F = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", I = "<script lang=\"ts\" generics=\"T extends Record<string, unknown>, U extends FormPath<T>\">\n import * as FormPrimitive from 'formsnap';\n import type { FormPath } from 'sveltekit-superforms';\n import { cn, type WithElementRef, type WithoutChildren } from '$lib/utils';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n\n let {\n ref = $bindable(null),\n class: className,\n form,\n name,\n children: childrenProp,\n ...restProps\n }: FormPrimitive.FieldProps<T, U> &\n WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();\n\n setContext('file-field', {\n get form() {\n return form;\n },\n get name() {\n return name;\n }\n });\n<\/script>\n\n<FormPrimitive.Field {form} {name}>\n {#snippet children({ constraints, errors, tainted, value })}\n <div bind:this={ref} data-slot=\"form-item\" class={cn('space-y-2', className)} {...restProps}>\n {@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}\n </div>\n {/snippet}\n</FormPrimitive.Field>\n", L = "<script lang=\"ts\">\n import { getContext } from 'svelte';\n import { fileProxy, filesProxy, type SuperForm } from 'sveltekit-superforms';\n import { Input } from '$lib/components/ui/input';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const { multiple } = getContext<{ multiple: boolean }>('file-field-multiple');\n\n const files = multiple ? filesProxy(ctx.form, `${ctx.name}+`) : fileProxy(ctx.form, ctx.name);\n const { form: formData, reset } = ctx.form;\n\n const { ...props } = $props();\n\n const onchange = () => {\n reset({\n data: $formData\n });\n };\n<\/script>\n\n{#if !multiple}\n {#if $formData[ctx.name]}\n {#if typeof $formData[ctx.name] === 'string'}\n <input type=\"text\" name={ctx.name} value={$formData[ctx.name]} class=\"hidden\" />\n {:else}\n <input type=\"file\" name={ctx.name} files={$files} class=\"hidden\" />\n {/if}\n {:else}\n <input type=\"text\" name={ctx.name} value=\"\" class=\"hidden\" />\n {/if}\n{/if}\n\n<Input\n type=\"file\"\n bind:files={$files}\n {multiple}\n {onchange}\n {...props}\n name={multiple ? `${ctx.name}+` : ''}\n/>\n", R = "<script lang=\"ts\">\n import { setContext, getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import { getName } from './shared';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const {\n display,\n input\n }: {\n display: (props: {\n file: File | string;\n filename: string;\n onremove: (file: File | string) => void;\n }) => any;\n input: () => any;\n } = $props();\n\n setContext('file-field-multiple', { multiple: true });\n\n const { form: formData, reset } = ctx.form;\n\n let removed = $state<string[]>([]);\n\n const onremove = (file: File | string) => {\n if (typeof file === 'string') {\n removed.push(file);\n } else {\n if (Array.isArray($formData[`${ctx.name}+`])) {\n reset({\n data: {\n ...$formData,\n [`${ctx.name}+`]: $formData[`${ctx.name}+`].filter((f: File | string) => f !== file) as\n | File[]\n | undefined\n }\n });\n }\n }\n };\n\n const initialFiles = $formData[ctx.name] || [];\n<\/script>\n\n{#if initialFiles}\n {#each initialFiles as file}\n {#if !removed.includes(file)}\n {@render display({ file, filename: getName(file), onremove })}\n {/if}\n {/each}\n{/if}\n\n{#each $formData[`${ctx.name}+`] as file}\n {#if file && typeof file !== 'string'}\n {@render display({ file, filename: getName(file), onremove })}\n {/if}\n{/each}\n\n{#each removed as removedFile}\n <input type=\"text\" name={`${ctx.name}-`} value={removedFile} class=\"hidden\" />\n{/each}\n\n{@render input()}\n", z = "<script lang=\"ts\">\n import { setContext, getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import { getName } from './shared';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const {\n display,\n input\n }: {\n display: (props: {\n file: File | string;\n filename: string;\n onremove: (file: File | string) => void;\n }) => any;\n input: () => any;\n } = $props();\n\n const { form: formData, reset } = ctx.form;\n\n setContext('file-field-multiple', { multiple: false });\n\n const onremove = () => {\n reset({\n data: {\n ...$formData,\n [ctx.name]: ''\n }\n });\n };\n<\/script>\n\n{#if $formData[ctx.name]}\n {@render display({ file: $formData[ctx.name], filename: getName($formData[ctx.name]), onremove })}\n{/if}\n\n{@render input()}\n", B = "<script lang=\"ts\">\n import { getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import FileIcon from '@lucide/svelte/icons/file';\n import ImageIcon from '@lucide/svelte/icons/image';\n import { cn } from '$lib/utils';\n import type { HTMLAttributes } from 'svelte/elements';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const { form: formData } = ctx.form;\n\n const {\n file,\n filename,\n collectionId,\n id,\n thumb = '50x50',\n class: className,\n type = 'image',\n ...props\n }: {\n file: File | string;\n filename: string;\n collectionId?: string;\n id?: string;\n thumb?: string;\n class?: string;\n type?: 'image' | 'file';\n } & HTMLAttributes<HTMLImageElement> = $props();\n\n const isImage = $derived(\n type === 'image' ||\n filename.toLowerCase().endsWith('.png') ||\n filename.toLowerCase().endsWith('.jpg') ||\n filename.toLowerCase().endsWith('.jpeg') ||\n filename.toLowerCase().endsWith('.gif') ||\n filename.toLowerCase().endsWith('.webp')\n );\n\n function getUrl(file: string) {\n return `/api/files/${collectionId ?? $formData.collectionId}/${id ?? $formData.id}/${file}?thumb=${thumb}`;\n }\n<\/script>\n\n{#if typeof file === 'string'}\n {#if (id ?? $formData.collectionId) && (id ?? $formData.id) && isImage}\n <img src={getUrl(file)} alt={filename} class={className} {...props} />\n {:else}\n <div\n class={cn('flex items-center justify-center w-full h-full bg-muted rounded-md', className)}\n {...props as HTMLAttributes<HTMLDivElement>}\n >\n {#if isImage}\n <ImageIcon class=\"w-4 h-4\" />\n {:else}\n <FileIcon class=\"w-4 h-4\" />\n {/if}\n </div>\n {/if}\n{:else if isImage}\n <img src={URL.createObjectURL(file)} alt={filename} class={className} {...props} />\n{:else}\n <div\n class={cn('flex items-center justify-center w-full h-full bg-muted rounded-md', className)}\n {...props as HTMLAttributes<HTMLDivElement>}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n{/if}\n", V = "export { default as Field } from \"./file-field.svelte\";\nexport { default as Single } from \"./file-single.svelte\";\nexport { default as Multiple } from \"./file-multiple.svelte\";\nexport { default as Input } from \"./file-input.svelte\";\nexport { default as Thumb } from \"./file-thumb.svelte\";\n", H = "export function getUrl(\n file: File | string,\n collectionId: string,\n recordId: string,\n thumb: string,\n) {\n return typeof file === \"string\"\n ? `/api/files/${collectionId}/${recordId}/${file}?thumb=${thumb}`\n : URL.createObjectURL(file);\n}\n\nexport function getName(file: File | string) {\n return typeof file === \"string\" ? (file.split(\"/\").pop() ?? \"\") : file.name;\n}\n", U = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\n\n let {\n value = $bindable(),\n id,\n label,\n shortLabel,\n mapOpen\n }: {\n value: number;\n id: string;\n label: string;\n shortLabel: string;\n mapOpen: boolean;\n } = $props();\n<\/script>\n\n<div\n class={cn(\n 'border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n 'pr-0 flex items-center',\n label === 'Latitude' && 'rounded-r-none',\n label === 'Longitude' && 'rounded-none -ml-px',\n mapOpen && 'rounded-b-none'\n )}\n>\n <label for={id} class=\"text-muted-foreground mr-2\">\n <span class=\"hidden md:block\">{label}</span>\n <span class=\"block md:hidden\">{shortLabel}</span>\n </label>\n\n <input\n bind:value\n type=\"number\"\n class=\"border-none outline-none min-w-0 w-full pr-2\"\n {id}\n step=\"0.000001\"\n />\n</div>\n", de = "export { default as GeopointInput } from \"./input.svelte\";\n", fe = "<script lang=\"ts\">\n import { setContext } from 'svelte';\n import ToggleMap from './toggle-map.svelte';\n import Coordinate from './coordinate.svelte';\n\n let {\n name,\n value = $bindable()\n }: {\n name: string;\n value: string | undefined;\n } = $props();\n\n const geopoint = $state(value ? JSON.parse(value) : { lat: 0, lon: 0 });\n const map = $state({ open: false });\n\n setContext('geopoint', {\n geopoint,\n map\n });\n\n $effect(() => {\n if (value) {\n const parsed = JSON.parse(value);\n\n if (typeof parsed === 'object' && parsed !== null && 'lat' in parsed && 'lon' in parsed) {\n geopoint.lat = parsed.lat.toFixed(6);\n geopoint.lon = parsed.lon.toFixed(6);\n }\n }\n });\n\n const stringValue = $derived(\n JSON.stringify({ lat: parseFloat(geopoint.lat), lon: parseFloat(geopoint.lon) })\n );\n<\/script>\n\n<input type=\"hidden\" {name} value={stringValue} />\n\n<div class=\"w-full\">\n <div class=\"w-full flex\">\n <Coordinate\n id=\"latitude\"\n label=\"Latitude\"\n shortLabel=\"Lat\"\n bind:value={geopoint.lat}\n mapOpen={map.open}\n />\n <Coordinate\n id=\"longitude\"\n label=\"Longitude\"\n shortLabel=\"Lon\"\n bind:value={geopoint.lon}\n mapOpen={map.open}\n />\n <ToggleMap />\n </div>\n\n {#if map.open}\n {#await import('$lib/components/ui/leaflet/leaflet.svelte')}\n <div class=\"h-[225px] w-full bg-input rounded-b-md\"></div>\n {:then { default: Leaflet }}\n <Leaflet height={225} point={geopoint} class=\"rounded-b-md overflow-hidden\" />\n {/await}\n {/if}\n</div>\n", pe = "<script>\n import { Button } from '$lib/components/ui/button';\n import MapIcon from '@lucide/svelte/icons/map';\n import { getContext } from 'svelte';\n import { cn } from '$lib/utils';\n\n let { map } = getContext('geopoint');\n<\/script>\n\n<Button\n variant=\"outline\"\n size=\"icon\"\n class={cn('w-10 rounded-none rounded-r-md border-l-0', map.open && 'rounded-b-none')}\n onclick={() => (map.open = !map.open)}\n>\n <MapIcon class=\"w-4 h-4\" />\n</Button>\n", me = "export { default as Leaflet } from \"./leaflet.svelte\";\n", he = "<script lang=\"ts\">\n import { onMount } from 'svelte';\n import L from 'leaflet';\n import 'leaflet/dist/leaflet.css';\n\n // manually load the markers so that they can be embedded in the prod bundle\n import markerIconUrl from 'leaflet/dist/images/marker-icon.png';\n import markerIconRetinaUrl from 'leaflet/dist/images/marker-icon-2x.png';\n import markerShadowUrl from 'leaflet/dist/images/marker-shadow.png';\n\n let { height = 225, point = $bindable(), readonly = false, ...props } = $props();\n\n let map: L.Map;\n let mapEl: HTMLElement;\n let marker: L.Marker;\n let panTimeoutId: ReturnType<typeof setTimeout>;\n\n const defaultZoomLevel = 8;\n\n $effect(() => {\n if (point.lat && point.lon) {\n panInside();\n }\n });\n\n function normalizeCoordinate(coord: any) {\n return +(+coord).toFixed(6);\n }\n\n function panInside(debounce = 200) {\n clearTimeout(panTimeoutId);\n panTimeoutId = setTimeout(() => {\n marker?.setLatLng([point.lat, point.lon]);\n map?.panInside([point.lat, point.lon], { padding: [20, 40] });\n }, debounce);\n }\n\n function initMap() {\n const latlon = [\n normalizeCoordinate(point.lat),\n normalizeCoordinate(point.lon)\n ] as L.LatLngTuple;\n\n map = L.map(mapEl, {\n zoomControl: false,\n maxBounds: [\n [-90, -180],\n [90, 180]\n ],\n minZoom: 2\n }).setView(latlon, defaultZoomLevel);\n\n if (readonly) {\n map.dragging.disable();\n map.touchZoom.disable();\n map.doubleClickZoom.disable();\n map.scrollWheelZoom.disable();\n map.boxZoom.disable();\n map.keyboard.disable();\n }\n\n L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OSM</a>',\n noWrap: true\n }).addTo(map);\n\n map.attributionControl.setPrefix('');\n\n // reassign the default marker images with the loaded ones\n // (https://leafletjs.com/reference.html#icon-default-option)\n L.Icon.Default.prototype.options.iconUrl = markerIconUrl;\n L.Icon.Default.prototype.options.iconRetinaUrl = markerIconRetinaUrl;\n L.Icon.Default.prototype.options.shadowUrl = markerShadowUrl;\n L.Icon.Default.imagePath = '';\n\n marker = L.marker(latlon, {\n draggable: true,\n autoPan: true\n }).addTo(map);\n\n marker.bindTooltip('drag or right click anywhere on the map to move');\n\n marker.on('moveend', (e) => {\n if (e.sourceTarget?._latlng) {\n select(e.sourceTarget._latlng.lat, e.sourceTarget._latlng.lng, false);\n }\n });\n\n map.on('contextmenu', (e) => {\n select(e.latlng.lat, e.latlng.lng, false);\n });\n }\n\n function destroyMap() {\n marker?.remove();\n map?.remove();\n }\n\n function select(lat: number, lon: number, centerMap = true) {\n point.lat = normalizeCoordinate(lat);\n point.lon = normalizeCoordinate(lon);\n\n // center the map\n if (centerMap) {\n marker?.setLatLng([point.lat, point.lon]); // optimistic marker update\n map?.panTo([point.lat, point.lon], { animate: false });\n }\n }\n\n onMount(() => {\n initMap();\n\n return () => {\n destroyMap();\n };\n });\n<\/script>\n\n<div class=\"map-wrapper\" style=\"{height ? `height:${height}px` : null};\" {...props}>\n <div bind:this={mapEl} class=\"map-box\"></div>\n</div>\n\n<style>\n .map-wrapper {\n position: relative;\n display: block;\n height: 100%;\n width: 100%;\n }\n .map-box {\n z-index: 1;\n height: 100%;\n width: 100%;\n }\n</style>\n", ge = "<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { cn } from '$lib/utils';\n\n let { children, class: className }: { children: Snippet; class?: string } = $props();\n<\/script>\n\n<span class={cn('bg-secondary text-secondary-foreground px-2 py-1 rounded-sm text-sm', className)}>\n {@render children?.()}\n</span>\n", _e = "<script lang=\"ts\">\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import * as Popover from '$lib/components/ui/popover';\n\n let {\n children,\n ...props\n }: PopoverPrimitive.ContentProps & {\n portalProps?: PopoverPrimitive.PortalProps;\n } = $props();\n<\/script>\n\n<Popover.Content {...props}>\n {@render children?.()}\n</Popover.Content>\n", ve = "<script lang=\"ts\" generics=\"T extends Record<string, unknown>, U extends FormPath<T>\">\n import * as FormPrimitive from 'formsnap';\n import type { FormPath } from 'sveltekit-superforms';\n import { cn, type WithElementRef, type WithoutChildren } from '$lib/utils';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n import * as Popover from '$lib/components/ui/popover';\n\n let {\n ref = $bindable(null),\n class: className,\n type,\n form,\n name,\n required,\n children: childrenProp,\n ...restProps\n }: FormPrimitive.FieldProps<T, U> & {\n type: 'multiple' | 'single';\n required?: boolean;\n } & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();\n\n const { form: formData } = $derived(form);\n\n const toggleSelected = (value: string) => {\n if (type === 'single') {\n if (!required && $formData[name] === value) {\n $formData[name] = undefined as T[U];\n } else {\n $formData[name] = value as T[U];\n }\n } else if (type === 'multiple') {\n if (!$formData[name]) {\n $formData[name] = [] as T[U];\n }\n\n const currentValue = $formData[name] as string[];\n const index = currentValue.indexOf(value);\n\n if (index > -1) {\n $formData[name] = currentValue.filter((id) => id !== value) as T[U];\n } else {\n $formData[name] = [...currentValue, value] as T[U];\n }\n }\n };\n\n const isSelected = (value: string) => {\n if (type === 'single') {\n return $formData[name] === value;\n } else if (type === 'multiple') {\n return ($formData[name] as string[])?.includes(value) ?? false;\n }\n };\n\n setContext('multiselect-field', {\n get form() {\n return form;\n },\n get name() {\n return name;\n },\n get type() {\n return type;\n },\n toggleSelected,\n isSelected\n });\n<\/script>\n\n<Popover.Root>\n <FormPrimitive.Field {form} {name}>\n {#snippet children({ constraints, errors, tainted, value })}\n <div bind:this={ref} data-slot=\"form-item\" class={cn('space-y-2', className)} {...restProps}>\n {@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}\n </div>\n {/snippet}\n </FormPrimitive.Field>\n</Popover.Root>\n", ye = "export { default as Field } from \"./field.svelte\";\nexport { default as Trigger } from \"./trigger.svelte\";\nexport { default as Input } from \"./input.svelte\";\nexport { default as Content } from \"./content.svelte\";\nexport { default as Item } from \"./item.svelte\";\nexport { default as Chip } from \"./chip.svelte\";\n", be = "<script lang=\"ts\" generics=\"T extends string\">\n import type { SuperForm } from 'sveltekit-superforms';\n import { getContext, type Snippet } from 'svelte';\n\n const { form, type } = getContext<{ form: SuperForm<any, any>; type: 'single' | 'multiple' }>(\n 'multiselect-field'\n );\n const { form: formData } = form;\n\n let {\n children,\n placeholder,\n name,\n value = $bindable()\n }: {\n children: Snippet<[{ selected: T[] }]>;\n placeholder?: string;\n name: string;\n value: T[] | T | undefined;\n } = $props();\n<\/script>\n\n{#if value && value.length > 0}\n {@render children?.({ selected: type === 'single' ? [$formData[name]] : $formData[name] })}\n {#if type === 'multiple'}\n {#each value as v}\n <input type=\"hidden\" {name} value={v} />\n {/each}\n {:else}\n <input type=\"hidden\" {name} {value} />\n {/if}\n{:else}\n {placeholder}\n{/if}\n", xe = "<script lang=\"ts\">\n import { getContext, type Snippet } from 'svelte';\n import { cn } from '$lib/utils';\n import { Command as CommandPrimitive } from 'bits-ui';\n import * as Command from '$lib/components/ui/command';\n import CheckIcon from '@lucide/svelte/icons/check';\n\n let {\n children,\n value,\n label,\n class: className,\n ...props\n }: CommandPrimitive.ItemProps & {\n value: string;\n label: string | undefined;\n children?: Snippet;\n class?: string;\n } = $props();\n\n const { toggleSelected, isSelected } = getContext<{\n toggleSelected: (value: string) => void;\n isSelected: (value: string) => boolean;\n }>('multiselect-field');\n\n const handleSelect = () => {\n toggleSelected(value);\n };\n<\/script>\n\n<Command.Item\n class={cn('cursor-pointer', className)}\n {...props}\n value={label}\n onSelect={handleSelect}\n>\n {label}\n <CheckIcon class={cn('ml-auto', !isSelected(value) && 'text-transparent')} />\n</Command.Item>\n", Se = "<script lang=\"ts\">\n import * as Popover from '$lib/components/ui/popover';\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import { cn } from '$lib/utils';\n import { buttonVariants } from '$lib/components/ui/button';\n import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';\n\n let { children, class: className, ...props }: PopoverPrimitive.TriggerProps = $props();\n<\/script>\n\n<Popover.Trigger\n class={cn(buttonVariants({ variant: 'outline' }), className)}\n role=\"combobox\"\n {...props}\n>\n {@render children?.()}\n <ChevronDownIcon class=\"size-4 opacity-50\" />\n</Popover.Trigger>\n", Ce = "export { default as Pagination } from \"./pagination.svelte\";\n", we = "<script lang=\"ts\">\n import * as Select from '$lib/components/ui/select';\n import { Button } from '$lib/components/ui/button';\n import ChevronsLeftIcon from '@lucide/svelte/icons/chevrons-left';\n import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';\n import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';\n import ChevronsRightIcon from '@lucide/svelte/icons/chevrons-right';\n import type { Table as TableType } from '@tanstack/table-core';\n\n let { table }: { table: TableType<any> } = $props();\n<\/script>\n\n<div class=\"flex items-center justify-between px-2\">\n <div class=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of\n {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div class=\"flex items-center space-x-6 lg:space-x-8\">\n <div class=\"flex items-center space-x-2\">\n <p class=\"text-sm font-medium\">Rows per page</p>\n <Select.Root\n allowDeselect={false}\n type=\"single\"\n value={`${table.getState().pagination.pageSize}`}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <Select.Trigger class=\"h-8 w-[70px]\">\n {String(table.getState().pagination.pageSize)}\n </Select.Trigger>\n <Select.Content side=\"top\">\n {#each [10, 20, 30, 40, 50] as pageSize (pageSize)}\n <Select.Item value={`${pageSize}`}>\n {pageSize}\n </Select.Item>\n {/each}\n </Select.Content>\n </Select.Root>\n </div>\n <div class=\"flex w-[100px] items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of\n {table.getPageCount()}\n </div>\n <div class=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(0)}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to first page</span>\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to next page</span>\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(table.getPageCount() - 1)}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to last page</span>\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n</div>\n", Te = "export { default as RowActions } from \"./row-actions.svelte\";\n", Ee = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\n import EllipsisIcon from '@lucide/svelte/icons/ellipsis';\n\n let {\n viewPath,\n editPath,\n deletePath\n }: {\n viewPath: string;\n editPath: string;\n deletePath: string;\n } = $props();\n<\/script>\n\n<DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Button {...props} variant=\"ghost\" class=\"data-[state=open]:bg-muted flex h-8 w-8 p-0\">\n <EllipsisIcon />\n <span class=\"sr-only\">Open Menu</span>\n </Button>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content class=\"w-[160px]\" align=\"end\">\n <DropdownMenu.Item onclick={() => goto(viewPath)}>View</DropdownMenu.Item>\n <DropdownMenu.Item onclick={() => goto(editPath)}>Edit</DropdownMenu.Item>\n <DropdownMenu.Item>\n <form method=\"POST\" action={deletePath}>\n <button type=\"submit\" class=\"contents\">Delete</button>\n </form>\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n</DropdownMenu.Root>\n", De = {
11
- "file-form": ["input"],
12
- multiselect: [
13
- "command",
14
- "popover",
15
- "button"
16
- ],
17
- geopoint: ["button", "leaflet"],
18
- cells: ["badge"],
19
- "data-table": [],
20
- "column-header": ["dropdown-menu", "button"],
21
- "faceted-filter": [
22
- "command",
23
- "popover",
24
- "button",
25
- "separator",
26
- "badge"
27
- ],
28
- pagination: ["button", "select"],
29
- "row-actions": ["dropdown-menu", "button"],
30
- leaflet: [],
31
- "auth-menu": ["dropdown-menu", "button"]
32
- }, Oe = {
33
- "file-form": [n],
34
- multiselect: [n],
35
- geopoint: [],
36
- cells: [],
37
- "data-table": [t],
38
- "column-header": [t],
39
- "faceted-filter": [t],
40
- pagination: [t],
41
- "row-actions": [],
42
- leaflet: ["leaflet", "@types/leaflet"]
43
- }, W = /* #__PURE__ */ Object.assign({
44
- "../ui/components/auth-menu/auth-menu-content.svelte": h,
45
- "../ui/components/auth-menu/auth-menu-group.svelte": g,
46
- "../ui/components/auth-menu/auth-menu-item.svelte": _,
47
- "../ui/components/auth-menu/auth-menu-label.svelte": v,
48
- "../ui/components/auth-menu/auth-menu-separator.svelte": y,
49
- "../ui/components/auth-menu/auth-menu-trigger.svelte": b,
50
- "../ui/components/auth-menu/auth-menu.svelte": x,
51
- "../ui/components/auth-menu/context.ts": ee,
52
- "../ui/components/auth-menu/index.ts": te,
53
- "../ui/components/cells/autodate.svelte": ne,
54
- "../ui/components/cells/bool.svelte": re,
55
- "../ui/components/cells/date.svelte": ie,
56
- "../ui/components/cells/editor.svelte": ae,
57
- "../ui/components/cells/email.svelte": oe,
58
- "../ui/components/cells/file.svelte": se,
59
- "../ui/components/cells/geoPoint.svelte": ce,
60
- "../ui/components/cells/index.ts": le,
61
- "../ui/components/cells/json.svelte": ue,
62
- "../ui/components/cells/number.svelte": S,
63
- "../ui/components/cells/password.svelte": C,
64
- "../ui/components/cells/relation.svelte": w,
65
- "../ui/components/cells/select.svelte": T,
66
- "../ui/components/cells/text.svelte": E,
67
- "../ui/components/cells/url.svelte": D,
68
- "../ui/components/column-header/column-header.svelte": O,
69
- "../ui/components/column-header/index.ts": k,
70
- "../ui/components/data-table/data-table.svelte.ts": A,
71
- "../ui/components/data-table/flex-render.svelte": j,
72
- "../ui/components/data-table/index.ts": M,
73
- "../ui/components/data-table/render-helpers.ts": N,
74
- "../ui/components/faceted-filter/faceted-filter.svelte": P,
75
- "../ui/components/faceted-filter/index.ts": F,
76
- "../ui/components/file-form/file-field.svelte": I,
77
- "../ui/components/file-form/file-input.svelte": L,
78
- "../ui/components/file-form/file-multiple.svelte": R,
79
- "../ui/components/file-form/file-single.svelte": z,
80
- "../ui/components/file-form/file-thumb.svelte": B,
81
- "../ui/components/file-form/index.ts": V,
82
- "../ui/components/file-form/shared.ts": H,
83
- "../ui/components/geopoint/coordinate.svelte": U,
84
- "../ui/components/geopoint/index.ts": de,
85
- "../ui/components/geopoint/input.svelte": fe,
86
- "../ui/components/geopoint/toggle-map.svelte": pe,
87
- "../ui/components/leaflet/index.ts": me,
88
- "../ui/components/leaflet/leaflet.svelte": he,
89
- "../ui/components/multiselect/chip.svelte": ge,
90
- "../ui/components/multiselect/content.svelte": _e,
91
- "../ui/components/multiselect/field.svelte": ve,
92
- "../ui/components/multiselect/index.ts": ye,
93
- "../ui/components/multiselect/input.svelte": be,
94
- "../ui/components/multiselect/item.svelte": xe,
95
- "../ui/components/multiselect/trigger.svelte": Se,
96
- "../ui/components/pagination/index.ts": Ce,
97
- "../ui/components/pagination/pagination.svelte": we,
98
- "../ui/components/row-actions/index.ts": Te,
99
- "../ui/components/row-actions/row-actions.svelte": Ee
100
- });
101
- function ke() {
102
- return [...new Set(Object.keys(W).map(G))].filter(Boolean).sort();
103
- }
104
- function G(e) {
105
- let t = e.split("/");
106
- return t[t.indexOf("components") + 1] ?? "";
107
- }
108
- function Ae(e) {
109
- let t = e.split("/"), n = t.indexOf("components");
110
- return t.slice(n + 2).join("/");
111
- }
112
- function K(e, t) {
113
- return a.isAbsolute(t) ? t : a.join(e, t);
114
- }
115
- function q(e, t) {
116
- return a.isAbsolute(t) ? a.relative(e, t) : t;
117
- }
118
- function J(e, t) {
119
- s(a.dirname(e), { recursive: !0 }), d(e, t, "utf8");
120
- }
121
- function je(e, t) {
122
- o(e) && (u(e, {
123
- force: !0,
124
- recursive: !0
125
- }), Me(a.dirname(e), t));
126
- }
127
- function Me(e, t) {
128
- let n = a.resolve(t), r = a.resolve(e);
129
- for (; r !== n && r.startsWith(n);) {
130
- if (!o(r) || l(r).length > 0) return;
131
- u(r, {
132
- recursive: !0,
133
- force: !0
134
- }), r = a.dirname(r);
135
- }
136
- }
137
- async function Ne(e, t, n) {
138
- let r = (await f({ cwd: e }))?.name ?? "npm", i = p(r, t, n);
139
- if (!i) throw Error(`Unable to resolve ${t} command for ${r}`);
140
- let a = [...i.args];
141
- r === "npm" && a.unshift("--yes"), await new Promise((t, n) => {
142
- let r = m(i.command, a, {
143
- cwd: e,
144
- stdio: "inherit"
145
- });
146
- r.on("error", n), r.on("exit", (e) => {
147
- if (e === 0) {
148
- t();
149
- return;
150
- }
151
- n(/* @__PURE__ */ Error(`${i.command} exited with code ${e ?? "unknown"}`));
152
- });
153
- });
154
- }
155
- async function Y(e, t, n, r) {
156
- if (r?.executeCommand) {
157
- await r.executeCommand(e, t, n);
158
- return;
159
- }
160
- await Ne(e, t, n);
161
- }
162
- function Pe(e) {
163
- let t = a.join(e, "package.json");
164
- if (!o(t)) return /* @__PURE__ */ new Set();
165
- let n = JSON.parse(c(t, "utf8"));
166
- return /* @__PURE__ */ new Set([
167
- ...Object.keys(n.dependencies ?? {}),
168
- ...Object.keys(n.devDependencies ?? {}),
169
- ...Object.keys(n.optionalDependencies ?? {}),
170
- ...Object.keys(n.peerDependencies ?? {})
171
- ]);
172
- }
173
- function Fe(e) {
174
- let t = e.indexOf("@", +!!e.startsWith("@"));
175
- return t === -1 ? e : e.slice(0, t);
176
- }
177
- async function X(e, t, n, r = i) {
178
- if (t.length === 0) return [];
179
- let a = Pe(e), o = [...new Set(t)].filter((e) => !a.has(Fe(e)));
180
- return o.length === 0 ? [] : (r.info(`Installing packages: ${o.join(", ")}`), await Y(e, "install", o, n), o);
181
- }
182
- function Z(e) {
183
- return ke().includes(e);
184
- }
185
- function Q(e) {
186
- return [...new Set(e.flatMap((e) => Oe[e] ?? []))];
187
- }
188
- function Ie(e, t) {
189
- let n = a.join(t, e);
190
- s(n, { recursive: !0 });
191
- for (let [t, r] of Object.entries(W)) {
192
- if (G(t) !== e) continue;
193
- let i = Ae(t);
194
- if (!i) continue;
195
- let o = a.join(n, i);
196
- s(a.dirname(o), { recursive: !0 }), d(o, r, "utf8");
197
- }
198
- }
199
- var Le = [
200
- "src",
201
- "lib",
202
- "components",
203
- "ui"
204
- ], Re = /* @__PURE__ */ new Set([
205
- ".ts",
206
- ".js",
207
- ".svelte",
208
- ".json"
209
- ]);
210
- async function ze(t, n, r) {
211
- let i = {
212
- env: "runtime",
213
- root: t
214
- };
215
- for (let t of r) {
216
- let r = a.join(n, t);
217
- if (!o(r)) continue;
218
- let s = l(r, {
219
- recursive: !0,
220
- withFileTypes: !0
221
- });
222
- for (let t of s) {
223
- if (!t.isFile()) continue;
224
- let n = a.join(t.parentPath, t.name);
225
- if (!Re.has(a.extname(n))) continue;
226
- let r = c(n, "utf8"), o = await e(r, n, i);
227
- o !== r && d(n, o, "utf8");
228
- }
229
- }
230
- }
231
- function Be(e) {
232
- let t = a.join(e, ...Le), n = a.join(e, "components.json");
233
- if (!o(n)) return t;
234
- try {
235
- let r = JSON.parse(c(n, "utf8")).aliases?.ui;
236
- return r === "$lib" ? a.join(e, "src", "lib") : r?.startsWith("$lib/") ? a.join(e, "src", "lib", ...r.slice(5).split("/")) : t;
237
- } catch {
238
- return t;
239
- }
240
- }
241
- async function $(e, t) {
242
- let { root: n, components: i, overwrite: c = !1 } = e, l = r(e), u = [...new Set(i)];
243
- if (u.length === 0) return {
244
- installed: [],
245
- skipped: [],
246
- packages: []
247
- };
248
- let d = Be(n);
249
- s(d, { recursive: !0 });
250
- let f = (e) => o(a.join(d, e)), p = c ? [] : u.filter(f), m = u.filter((e) => !p.includes(e));
251
- if (p.length > 0 && l.info(`Already present: ${p.join(", ")}`), m.length === 0) return {
252
- installed: [],
253
- skipped: p,
254
- packages: []
255
- };
256
- let h = new Set(m.filter(Z)), g = new Set(m.filter((e) => !Z(e)));
257
- for (let e of [...h]) for (let t of De[e] ?? []) f(t) || (Z(t) ? h.add(t) : g.add(t));
258
- let _ = [], v = [...h].sort();
259
- v.length > 0 && l.info(`Installing custom components: ${v.join(", ")}`);
260
- for (let e of v) Ie(e, d), _.push(e), g.delete(e);
261
- let y = await X(n, Q(v), t, l), b = [...g].sort();
262
- b.length > 0 && (l.info(`Installing shadcn-svelte components: ${b.join(", ")}`), await Y(n, "execute", [
263
- "shadcn-svelte",
264
- "add",
265
- "--yes",
266
- "--overwrite",
267
- ...b
268
- ], t), _.push(...b));
269
- let x = [...new Set(_)].sort();
270
- return await ze(n, d, x), {
271
- installed: x,
272
- skipped: p,
273
- packages: y
274
- };
275
- }
276
- async function Ve(e, t, n) {
277
- let i = r(t), a = {
278
- creates: [],
279
- modifies: [],
280
- deletes: [],
281
- components: [],
282
- packages: [],
283
- collections: [],
284
- collectionPatches: [],
285
- collectionDrops: []
286
- }, s = [];
287
- if (e.collectionDrops.length > 0) {
288
- let { dropCollections: n } = await import("./collections-DcnlHh80.js");
289
- s = await n(e.collectionDrops, t);
290
- }
291
- let l = await X(t.root, e.packages, n, i), u = await $({
292
- root: t.root,
293
- components: e.components,
294
- logger: i
295
- }, n);
296
- for (let n of [...e.creates, ...s]) {
297
- if (n.status !== "success") {
298
- a.creates.push({
299
- ...n,
300
- path: q(t.root, n.path)
301
- });
302
- continue;
303
- }
304
- let e = K(t.root, n.path);
305
- if (!o(e)) {
306
- J(e, n.content), a.creates.push({
307
- ...n,
308
- path: q(t.root, n.path)
309
- });
310
- continue;
311
- }
312
- c(e, "utf8") !== n.content && (J(e, n.content), a.modifies.push({
313
- ...n,
314
- path: q(t.root, n.path)
315
- }));
316
- }
317
- for (let n of e.modifies) {
318
- if (n.status !== "success") {
319
- a.modifies.push({
320
- ...n,
321
- path: q(t.root, n.path)
322
- });
323
- continue;
324
- }
325
- J(K(t.root, n.path), n.content), a.modifies.push({
326
- ...n,
327
- path: q(t.root, n.path)
328
- });
329
- }
330
- for (let n of e.deletes) {
331
- if (n.status !== "success") {
332
- a.deletes.push({
333
- ...n,
334
- path: q(t.root, n.path)
335
- });
336
- continue;
337
- }
338
- o(K(t.root, n.path)) && (je(K(t.root, n.path), t.root), a.deletes.push({
339
- ...n,
340
- path: q(t.root, n.path)
341
- }));
342
- }
343
- return {
344
- ...e,
345
- creates: a.creates,
346
- modifies: a.modifies,
347
- deletes: a.deletes,
348
- components: u.installed,
349
- packages: [.../* @__PURE__ */ new Set([...l, ...u.packages])]
350
- };
351
- }
352
- //#endregion
353
- export { $ as installComponents, Ve as writeResult };
354
-
355
- //# sourceMappingURL=write-result-8JW_vky2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-result-8JW_vky2.js","names":[],"sources":["../../src/runtime/write-result.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport path from \"node:path\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport type {\n InstallComponentsOptions,\n InstallComponentsResult,\n Options,\n PackageManagerOperation,\n Result,\n WriteResultRuntime,\n} from \"../core/types\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { formatSource } from \"../core/format-result\";\nimport { FORMSNAP, TANSTACK_TABLE_CORE } from \"../core/constants\";\n\ntype CustomNpmPackages = Record<string, string[]>;\n\n/**\n * The components under `src/ui/components` are copied into a project rather\n * than fetched from the shadcn-svelte registry, so their dependencies have to\n * be declared here: every `$lib/components/ui/<x>` import a component makes\n * must appear in `customDependencies`, and every npm package that no shadcn\n * item installs for it must appear in `customNpmPackages`.\n */\nconst customDependencies: Record<string, string[]> = {\n \"file-form\": [\"input\"],\n multiselect: [\"command\", \"popover\", \"button\"],\n geopoint: [\"button\", \"leaflet\"],\n cells: [\"badge\"],\n \"data-table\": [],\n \"column-header\": [\"dropdown-menu\", \"button\"],\n \"faceted-filter\": [\"command\", \"popover\", \"button\", \"separator\", \"badge\"],\n pagination: [\"button\", \"select\"],\n \"row-actions\": [\"dropdown-menu\", \"button\"],\n leaflet: [],\n \"auth-menu\": [\"dropdown-menu\", \"button\"],\n};\n\nconst customNpmPackages: CustomNpmPackages = {\n \"file-form\": [FORMSNAP],\n multiselect: [FORMSNAP],\n geopoint: [],\n cells: [],\n // shadcn-svelte >= 1.2.0 resolves items from the style-scoped registry\n // (/registry/styles/<style>/), which has no `data-table` item, so the\n // TanStack helpers ship from here instead.\n \"data-table\": [TANSTACK_TABLE_CORE],\n \"column-header\": [TANSTACK_TABLE_CORE],\n \"faceted-filter\": [TANSTACK_TABLE_CORE],\n pagination: [TANSTACK_TABLE_CORE],\n \"row-actions\": [],\n leaflet: [\"leaflet\", \"@types/leaflet\"],\n};\n\nconst customComponentAssets = import.meta.glob<string>(\"../ui/components/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nfunction getAllCustomComponents() {\n return [\n ...new Set(\n Object.keys(customComponentAssets).map(componentNameFromAssetPath),\n ),\n ]\n .filter(Boolean)\n .sort();\n}\n\nfunction componentNameFromAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts[index + 1] ?? \"\";\n}\n\nfunction componentRelativeAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts.slice(index + 2).join(\"/\");\n}\n\nfunction toTargetPath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return filePath;\n }\n return path.join(root, filePath);\n}\n\nfunction toRelativePath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return path.relative(root, filePath);\n }\n return filePath;\n}\n\nfunction writeFile(filePath: string, content: string): void {\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf8\");\n}\n\nfunction removeFile(filePath: string, root: string): void {\n if (!existsSync(filePath)) {\n return;\n }\n\n rmSync(filePath, { force: true, recursive: true });\n pruneEmptyDirectories(path.dirname(filePath), root);\n}\n\n/**\n * Deleting a feature's files must also delete the directories it added, up\n * to the first one that still has content. The CLI detects features by\n * directory (`src/routes/(app)` means auth is on), so an empty leftover\n * directory keeps a disabled feature \"enabled\".\n */\nfunction pruneEmptyDirectories(dir: string, root: string): void {\n const stop = path.resolve(root);\n let current = path.resolve(dir);\n while (current !== stop && current.startsWith(stop)) {\n if (!existsSync(current) || readdirSync(current).length > 0) {\n return;\n }\n rmSync(current, { recursive: true, force: true });\n current = path.dirname(current);\n }\n}\n\nasync function executeWithDetectedPackageManager(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n): Promise<void> {\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n const resolved = resolveCommand(packageManager, operation, args);\n if (!resolved) {\n throw new Error(\n `Unable to resolve ${operation} command for ${packageManager}`,\n );\n }\n\n const commandArgs = [...resolved.args];\n if (packageManager === \"npm\") {\n commandArgs.unshift(\"--yes\");\n }\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(resolved.command, commandArgs, {\n cwd,\n stdio: \"inherit\",\n });\n child.on(\"error\", reject);\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n return;\n }\n reject(\n new Error(`${resolved.command} exited with code ${code ?? \"unknown\"}`),\n );\n });\n });\n}\n\nasync function executeCommand(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n runtime?: WriteResultRuntime,\n): Promise<void> {\n if (runtime?.executeCommand) {\n await runtime.executeCommand(cwd, operation, args);\n return;\n }\n\n await executeWithDetectedPackageManager(cwd, operation, args);\n}\n\nfunction installedPackagesFromProject(root: string): Set<string> {\n const packageJsonPath = path.join(root, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return new Set();\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n };\n\n return new Set([\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.devDependencies ?? {}),\n ...Object.keys(packageJson.optionalDependencies ?? {}),\n ...Object.keys(packageJson.peerDependencies ?? {}),\n ]);\n}\n\n/**\n * Splits an npm install spec into its package name, dropping any range.\n * `wuchale@^0.26.3` -> `wuchale`, `@wuchale/svelte@^0.21.1` -> `@wuchale/svelte`.\n *\n * The name is what `package.json` records, so it -- not the full spec -- is what\n * the already-installed check has to compare against.\n */\nexport function packageName(spec: string): string {\n const at = spec.indexOf(\"@\", spec.startsWith(\"@\") ? 1 : 0);\n return at === -1 ? spec : spec.slice(0, at);\n}\n\nasync function installPackages(\n root: string,\n packages: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<string[]> {\n if (packages.length === 0) {\n return [];\n }\n\n const installed = installedPackagesFromProject(root);\n const toInstall = [...new Set(packages)].filter(\n (pkg) => !installed.has(packageName(pkg)),\n );\n if (toInstall.length === 0) {\n return [];\n }\n\n logger.info(`Installing packages: ${toInstall.join(\", \")}`);\n await executeCommand(root, \"install\", toInstall, runtime);\n return toInstall;\n}\n\nfunction isCustomComponent(component: string): boolean {\n return getAllCustomComponents().includes(component);\n}\n\nfunction customNpmPackagesFor(components: string[]): string[] {\n return [\n ...new Set(\n components.flatMap((component) => customNpmPackages[component] ?? []),\n ),\n ];\n}\n\nfunction copyCustomComponent(\n component: string,\n targetComponentsDir: string,\n): void {\n const targetDir = path.join(targetComponentsDir, component);\n mkdirSync(targetDir, { recursive: true });\n\n for (const [assetPath, content] of Object.entries(customComponentAssets)) {\n if (componentNameFromAssetPath(assetPath) !== component) {\n continue;\n }\n const relativePath = componentRelativeAssetPath(assetPath);\n if (!relativePath) {\n continue;\n }\n\n const outputPath = path.join(targetDir, relativePath);\n mkdirSync(path.dirname(outputPath), { recursive: true });\n writeFileSync(outputPath, content, \"utf8\");\n }\n}\n\nconst DEFAULT_UI_DIR = [\"src\", \"lib\", \"components\", \"ui\"];\nconst FORMATTABLE_EXTENSIONS = new Set([\".ts\", \".js\", \".svelte\", \".json\"]);\n\n/**\n * `shadcn-svelte add` writes files in the registry's style and the bundled\n * components carry this repo's; the project's `npm run lint` expects its own.\n * Runs the project's prettier over every file in the installed directories.\n */\nasync function formatComponentDirs(\n root: string,\n componentsDir: string,\n components: string[],\n): Promise<void> {\n const context = { env: \"runtime\" as const, root };\n for (const component of components) {\n const dir = path.join(componentsDir, component);\n if (!existsSync(dir)) {\n continue;\n }\n const entries = readdirSync(dir, { recursive: true, withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isFile()) {\n continue;\n }\n const filePath = path.join(entry.parentPath, entry.name);\n if (!FORMATTABLE_EXTENSIONS.has(path.extname(filePath))) {\n continue;\n }\n const content = readFileSync(filePath, \"utf8\");\n const formatted = await formatSource(content, filePath, context);\n if (formatted !== content) {\n writeFileSync(filePath, formatted, \"utf8\");\n }\n }\n }\n}\n\n/**\n * Where shadcn-svelte writes items: `components.json` `aliases.ui`, resolved\n * the way SvelteKit resolves `$lib` (`src/lib`). Anything else (a custom\n * `kit.alias`, a missing or unreadable config) falls back to the default so\n * the existence check here and shadcn's own target agree for every project\n * the CLI creates.\n */\nexport function resolveUiDir(root: string): string {\n const fallback = path.join(root, ...DEFAULT_UI_DIR);\n const configPath = path.join(root, \"components.json\");\n if (!existsSync(configPath)) {\n return fallback;\n }\n try {\n const config = JSON.parse(readFileSync(configPath, \"utf8\")) as {\n aliases?: { ui?: string };\n };\n const alias = config.aliases?.ui;\n if (alias === \"$lib\") {\n return path.join(root, \"src\", \"lib\");\n }\n if (alias?.startsWith(\"$lib/\")) {\n return path.join(root, \"src\", \"lib\", ...alias.slice(5).split(\"/\"));\n }\n return fallback;\n } catch {\n return fallback;\n }\n}\n\nexport async function installComponents(\n options: InstallComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<InstallComponentsResult> {\n const { root, components, overwrite = false } = options;\n const logger = getLogger(options);\n\n const requested = [...new Set(components)];\n if (requested.length === 0) {\n return { installed: [], skipped: [], packages: [] };\n }\n\n const componentsDir = resolveUiDir(root);\n mkdirSync(componentsDir, { recursive: true });\n const isPresent = (component: string) =>\n existsSync(path.join(componentsDir, component));\n\n const skipped = overwrite ? [] : requested.filter(isPresent);\n const toInstall = requested.filter(\n (component) => !skipped.includes(component),\n );\n if (skipped.length > 0) {\n logger.info(`Already present: ${skipped.join(\", \")}`);\n }\n if (toInstall.length === 0) {\n return { installed: [], skipped, packages: [] };\n }\n\n const customToInstall = new Set(toInstall.filter(isCustomComponent));\n const publicToInstall = new Set(\n toInstall.filter((component) => !isCustomComponent(component)),\n );\n\n // Dependencies are added only when missing, even under `overwrite`:\n // re-adding `button` because `pagination` was re-added would clobber edits\n // the user never asked to lose.\n for (const component of [...customToInstall]) {\n for (const dependency of customDependencies[component] ?? []) {\n if (isPresent(dependency)) {\n continue;\n }\n if (isCustomComponent(dependency)) {\n customToInstall.add(dependency);\n } else {\n publicToInstall.add(dependency);\n }\n }\n }\n\n const installed: string[] = [];\n const customList = [...customToInstall].sort();\n if (customList.length > 0) {\n logger.info(`Installing custom components: ${customList.join(\", \")}`);\n }\n for (const component of customList) {\n copyCustomComponent(component, componentsDir);\n installed.push(component);\n publicToInstall.delete(component);\n }\n\n const packages = await installPackages(\n root,\n customNpmPackagesFor(customList),\n runtime,\n logger,\n );\n\n const publicList = [...publicToInstall].sort();\n if (publicList.length > 0) {\n logger.info(\n `Installing shadcn-svelte components: ${publicList.join(\", \")}`,\n );\n await executeCommand(\n root,\n \"execute\",\n [\"shadcn-svelte\", \"add\", \"--yes\", \"--overwrite\", ...publicList],\n runtime,\n );\n installed.push(...publicList);\n }\n\n const installedList = [...new Set(installed)].sort();\n await formatComponentDirs(root, componentsDir, installedList);\n\n return { installed: installedList, skipped, packages };\n}\n\nexport async function writeResult(\n result: Result,\n options: Options,\n runtime?: WriteResultRuntime,\n): Promise<Result> {\n const logger = getLogger(options);\n\n const writtenResult: Result = {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n\n let dropMigrationCreates: Result[\"creates\"] = [];\n if (result.collectionDrops.length > 0) {\n const { dropCollections } = await import(\"./collections\");\n dropMigrationCreates = await dropCollections(\n result.collectionDrops,\n options,\n );\n }\n\n const packageInstalls = await installPackages(\n options.root,\n result.packages,\n runtime,\n logger,\n );\n\n const componentInstalls = await installComponents(\n { root: options.root, components: result.components, logger },\n runtime,\n );\n\n for (const file of [...result.creates, ...dropMigrationCreates]) {\n if (file.status !== \"success\") {\n // A modifier that could not recognise the file it was asked to edit\n // reports `failed` / `not-found` with a paste-ready remediation snippet.\n // Nothing is written, but the entry has to survive into the result: this\n // loop used to `continue` before pushing, so the entry never reached the\n // caller at all and the snippet was lost. The pattern reported success\n // and simply said nothing about the file it had given up on.\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n const target = toTargetPath(options.root, file.path);\n if (!existsSync(target)) {\n writeFile(target, file.content);\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (readFileSync(target, \"utf8\") !== file.content) {\n writeFile(target, file.content);\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n for (const file of result.modifies) {\n if (file.status !== \"success\") {\n // Carried through unwritten, so the caller can report the failure. See\n // the note in the creates loop above.\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n writeFile(toTargetPath(options.root, file.path), file.content);\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n\n for (const file of result.deletes) {\n if (file.status !== \"success\") {\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (existsSync(toTargetPath(options.root, file.path))) {\n removeFile(toTargetPath(options.root, file.path), options.root);\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n return {\n ...result,\n creates: writtenResult.creates,\n modifies: writtenResult.modifies,\n deletes: writtenResult.deletes,\n components: componentInstalls.installed,\n packages: [...new Set([...packageInstalls, ...componentInstalls.packages])],\n };\n}\n"],"mappings":";;;;;;;;;i0pDAiCM,KAA+C;CACnD,aAAa,CAAC,OAAO;CACrB,aAAa;EAAC;EAAW;EAAW;CAAQ;CAC5C,UAAU,CAAC,UAAU,SAAS;CAC9B,OAAO,CAAC,OAAO;CACf,cAAc,CAAC;CACf,iBAAiB,CAAC,iBAAiB,QAAQ;CAC3C,kBAAkB;EAAC;EAAW;EAAW;EAAU;EAAa;CAAO;CACvE,YAAY,CAAC,UA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