@velastack/patterns 0.1.3 → 0.1.5
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.
- package/README.md +22 -0
- package/dist/chunks/{collections-DgZjDXef.js → collections-C1SaNdMd.js} +2 -2
- package/dist/chunks/{collections-DgZjDXef.js.map → collections-C1SaNdMd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CG0gMypH.js → generate.runtime-B08p7DoC.js} +3 -3
- package/dist/chunks/{generate.runtime-CG0gMypH.js.map → generate.runtime-B08p7DoC.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DrDZe6gu.js → generate.runtime-BS0FFasX.js} +3 -3
- package/dist/chunks/{generate.runtime-DrDZe6gu.js.map → generate.runtime-BS0FFasX.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Cc1SG-nN.js → generate.runtime-C2DgLTi8.js} +2 -2
- package/dist/chunks/{generate.runtime-Cc1SG-nN.js.map → generate.runtime-C2DgLTi8.js.map} +1 -1
- package/dist/chunks/{generate.runtime-PtDQdWNY.js → generate.runtime-CK1ApRFh.js} +2 -2
- package/dist/chunks/{generate.runtime-PtDQdWNY.js.map → generate.runtime-CK1ApRFh.js.map} +1 -1
- package/dist/chunks/{generate.runtime-WaqVbEPP.js → generate.runtime-CKW5vPzA.js} +2 -2
- package/dist/chunks/{generate.runtime-WaqVbEPP.js.map → generate.runtime-CKW5vPzA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dad9oAKS.js → generate.runtime-CWA_i6Ch.js} +2 -2
- package/dist/chunks/{generate.runtime-Dad9oAKS.js.map → generate.runtime-CWA_i6Ch.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DpV_oOT7.js → generate.runtime-D33zutDr.js} +3 -3
- package/dist/chunks/{generate.runtime-DpV_oOT7.js.map → generate.runtime-D33zutDr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-677mL0-8.js → generate.runtime-DnFdGn1e.js} +2 -2
- package/dist/chunks/{generate.runtime-677mL0-8.js.map → generate.runtime-DnFdGn1e.js.map} +1 -1
- package/dist/chunks/{generate.runtime-lvraqNgB.js → generate.runtime-YwrRBYSg.js} +2 -2
- package/dist/chunks/{generate.runtime-lvraqNgB.js.map → generate.runtime-YwrRBYSg.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Coi_Y6nm.js → generate.runtime-eojYS75G.js} +2 -2
- package/dist/chunks/{generate.runtime-Coi_Y6nm.js.map → generate.runtime-eojYS75G.js.map} +1 -1
- package/dist/chunks/{pocketbase-BPwW3TWr.js → pocketbase-C4NoNrnW.js} +26 -9
- package/dist/chunks/pocketbase-C4NoNrnW.js.map +1 -0
- package/dist/chunks/{shared-BGvy1V-z.js → shared--GUUivGs.js} +2 -2
- package/dist/chunks/{shared-BGvy1V-z.js.map → shared--GUUivGs.js.map} +1 -1
- package/dist/chunks/write-result-Hq8bafvV.js +296 -0
- package/dist/chunks/write-result-Hq8bafvV.js.map +1 -0
- package/dist/index.js +1499 -1487
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/pocketbase-BPwW3TWr.js.map +0 -1
- package/dist/chunks/write-result-DvELaUJg.js +0 -262
- package/dist/chunks/write-result-DvELaUJg.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velastack/patterns",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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,
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"lint": "npm run lint:ts && npm run lint:format",
|
|
39
39
|
"lint:ts": "tsc --noEmit",
|
|
40
40
|
"lint:format": "prettier --check .",
|
|
41
|
-
"test": "vitest run
|
|
42
|
-
"test:watch": "vitest --watch
|
|
43
|
-
"test:integration": "vitest run integration.
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest --watch",
|
|
43
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
44
44
|
"prepare": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pocketbase-BPwW3TWr.js","names":[],"sources":["../../src/runtime/net.ts","../../src/runtime/pocketbase.ts"],"sourcesContent":["import net from \"node:net\";\n\n// Generate a random port\nexport function randomPort() {\n return Math.floor(Math.random() * 10000) + 10000;\n}\n\n// Wait for the port to be available\nexport function waitForPort(\n port: number,\n host: string,\n maxAttempts = 10,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryConnect = () => {\n attempts++;\n\n const socket = new net.Socket();\n\n const onError = () => {\n socket.destroy();\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for port ${port} to be available`),\n );\n return;\n }\n\n setTimeout(tryConnect, 500);\n };\n\n socket.once(\"error\", onError);\n\n socket.connect(port, host, () => {\n socket.destroy();\n resolve();\n });\n };\n\n tryConnect();\n });\n}\n\n// Wait for the health check to be successful\nexport function waitForHealth(url: string, maxAttempts = 10): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryHealth = async () => {\n attempts++;\n\n try {\n const response = await fetch(`${url}/api/health`);\n if (response.status === 200) {\n resolve();\n return;\n }\n } catch {\n // Ignore fetch errors and continue retrying\n }\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for health check at ${url}/api/health`),\n );\n return;\n }\n\n setTimeout(tryHealth, 500);\n };\n\n tryHealth();\n });\n}\n","import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport PocketBase from \"pocketbase\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport { randomPort, waitForPort, waitForHealth } from \"./net\";\nimport type { Options } from \"../core/types\";\nimport { DATA_DIR, MIGRATIONS_DIR } from \"../core/constants\";\n\n/**\n * PocketBase names migration files with a 1-second-resolution Unix timestamp\n * (e.g. `1776099881_created_users.js`). Two schema operations issued in the\n * same wall-clock second produce files that sort alphabetically by their\n * action/collection suffix — which reverses the intended order whenever a\n * later migration depends on an earlier one. Wait out the full second between\n * migration-producing calls so the timestamps stay distinct.\n */\nconst MIGRATION_DELAY_MS = 1100;\n\nexport function migrationDelay(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, MIGRATION_DELAY_MS));\n}\n\nexport function getMigrationFile(\n collectionName: string,\n action: \"created\" | \"deleted\" | \"updated\",\n options: Options,\n): string | undefined {\n const ending = `${action}_${collectionName}.js`;\n\n // find last file with ending in migrations dir\n const migrationFiles = readdirSync(\n path.join(options.root, MIGRATIONS_DIR),\n ).filter((file) => file.endsWith(ending));\n\n const migrationFile = migrationFiles.sort().pop();\n\n if (!migrationFile) {\n return undefined;\n }\n\n return path.join(options.root, MIGRATIONS_DIR, migrationFile);\n}\n\nexport function getPocketbaseMetadata(cwd: string): {\n pocketbaseUrl: string;\n vitePort: number;\n} | null {\n const metadataPath = path.join(\n cwd,\n \"node_modules\",\n \".vite\",\n \"_pocketbase_metadata.json\",\n );\n if (existsSync(metadataPath)) {\n return JSON.parse(readFileSync(metadataPath, \"utf8\"));\n }\n return null;\n}\n\nexport async function authWithRetries(\n pb: PocketBase,\n email: string,\n password: string,\n) {\n // Retry authentication up to 3 times with 100ms backoff\n let authSuccess = false;\n for (let attempt = 1; attempt <= 3; attempt++) {\n try {\n await pb.collection(\"_superusers\").authWithPassword(email, password);\n authSuccess = true;\n break;\n } catch {\n if (attempt < 3) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n }\n\n if (!authSuccess) {\n throw new Error(\n \"Failed to authenticate with PocketBase. Check your superuser credentials.\",\n );\n }\n}\n\nexport async function withPocketbase(\n cwd: string,\n fn: (pb: PocketBase) => Promise<void>,\n) {\n const dir = path.join(cwd, DATA_DIR);\n const migrationsDir = path.join(cwd, MIGRATIONS_DIR);\n const host = \"localhost\";\n\n if (!existsSync(dir)) {\n throw new Error(\"PocketBase data directory does not exist\");\n }\n\n // First check if the server is already running by reading node_modules/.vite/_pocketbase_metadata.json\n const metadata = getPocketbaseMetadata(cwd);\n if (metadata) {\n if (metadata.pocketbaseUrl) {\n const pb = new PocketBase(metadata.pocketbaseUrl);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n return;\n }\n }\n\n const port = randomPort();\n const commandArgs = [\n \"pocketbase-server\",\n \"serve\",\n \"--dir\",\n dir,\n \"--migrationsDir\",\n migrationsDir,\n \"--http\",\n `${host}:${port}`,\n ];\n\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n const { command, args } = resolveCommand(\n packageManager,\n \"execute\",\n commandArgs,\n )!;\n\n // adding --yes as the first parameter helps avoiding the \"Need to install the following packages:\" message\n if (packageManager === \"npm\") args.unshift(\"--yes\");\n\n // Start the PocketBase server process\n const serverProcess = spawn(command, args, {\n stdio: \"ignore\",\n });\n\n try {\n // Wait for the server to be ready\n await waitForPort(port, host);\n await waitForHealth(`http://${host}:${port}`);\n\n const pb = new PocketBase(`http://${host}:${port}`);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n } finally {\n // Ensure we always clean up the process\n serverProcess.kill();\n }\n}\n"],"mappings":";;;;;;;;;AAGA,SAAgB,IAAa;CAC3B,OAAO,KAAK,MAAM,KAAK,OAAO,IAAI,GAAK,IAAI;AAC7C;AAGA,SAAgB,EACd,GACA,GACA,IAAc,IACC;CACf,OAAO,IAAI,SAAS,GAAS,MAAW;EACtC,IAAI,IAAW,GAET,UAAmB;GACvB;GAEA,IAAM,IAAS,IAAI,EAAI,OAAO;GAiB9B,AAF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AG,CAAE;CACb,UAAU;EAER,EAAc,KAAK;CACrB;AACF"}
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./logger-CQONztPm.js";
|
|
2
|
-
import n from "node:path";
|
|
3
|
-
import { existsSync as r, mkdirSync as i, readFileSync as a, rmSync as o, writeFileSync as s } from "node:fs";
|
|
4
|
-
import { detect as c } from "package-manager-detector";
|
|
5
|
-
import { resolveCommand as l } from "package-manager-detector/commands";
|
|
6
|
-
import u from "cross-spawn";
|
|
7
|
-
//#region src/ui/components/auth-menu/auth-menu-content.svelte?raw
|
|
8
|
-
var d = "<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", f = "<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", p = "<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", m = "<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", h = "<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", ee = "<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", te = "<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", ne = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", re = "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", g = "<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", _ = "<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", v = "<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", y = "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", b = "<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", x = "<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", 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: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>********</div>\n", C = "<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", 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 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", T = "<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", 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 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", D = "<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", O = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", k = "<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", A = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", j = "<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", M = "<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", N = "<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", P = "<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", F = "<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", I = "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", L = "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", R = "<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", z = "export { default as GeopointInput } from \"./input.svelte\";\n", B = "<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", V = "<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", H = "export { default as Leaflet } from \"./leaflet.svelte\";\n", U = "<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: '© <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", W = "<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", ce = "<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", G = "<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", le = "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", ue = "<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", de = "<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", fe = "<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", pe = "export { default as Pagination } from \"./pagination.svelte\";\n", me = "<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", he = "export { default as RowActions } from \"./row-actions.svelte\";\n", ge = "<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", _e = {
|
|
9
|
-
"file-form": ["input", "form"],
|
|
10
|
-
multiselect: [
|
|
11
|
-
"command",
|
|
12
|
-
"popover",
|
|
13
|
-
"button",
|
|
14
|
-
"badge"
|
|
15
|
-
],
|
|
16
|
-
geopoint: ["button", "leaflet"],
|
|
17
|
-
cells: [],
|
|
18
|
-
"column-header": ["dropdown-menu", "button"],
|
|
19
|
-
"faceted-filter": [
|
|
20
|
-
"command",
|
|
21
|
-
"popover",
|
|
22
|
-
"button",
|
|
23
|
-
"separator",
|
|
24
|
-
"badge"
|
|
25
|
-
],
|
|
26
|
-
pagination: ["button", "select"],
|
|
27
|
-
"row-actions": ["dropdown-menu", "button"],
|
|
28
|
-
leaflet: [],
|
|
29
|
-
"auth-menu": ["dropdown-menu", "button"]
|
|
30
|
-
}, ve = {
|
|
31
|
-
"file-form": [],
|
|
32
|
-
multiselect: [],
|
|
33
|
-
geopoint: [],
|
|
34
|
-
cells: [],
|
|
35
|
-
"column-header": ["@tanstack/table-core"],
|
|
36
|
-
"faceted-filter": ["@tanstack/table-core"],
|
|
37
|
-
pagination: ["@tanstack/table-core"],
|
|
38
|
-
"row-actions": [],
|
|
39
|
-
leaflet: ["leaflet", "@types/leaflet"]
|
|
40
|
-
}, K = /* #__PURE__ */ Object.assign({
|
|
41
|
-
"../ui/components/auth-menu/auth-menu-content.svelte": d,
|
|
42
|
-
"../ui/components/auth-menu/auth-menu-group.svelte": f,
|
|
43
|
-
"../ui/components/auth-menu/auth-menu-item.svelte": p,
|
|
44
|
-
"../ui/components/auth-menu/auth-menu-label.svelte": m,
|
|
45
|
-
"../ui/components/auth-menu/auth-menu-separator.svelte": h,
|
|
46
|
-
"../ui/components/auth-menu/auth-menu-trigger.svelte": ee,
|
|
47
|
-
"../ui/components/auth-menu/auth-menu.svelte": te,
|
|
48
|
-
"../ui/components/auth-menu/context.ts": ne,
|
|
49
|
-
"../ui/components/auth-menu/index.ts": re,
|
|
50
|
-
"../ui/components/cells/autodate.svelte": g,
|
|
51
|
-
"../ui/components/cells/bool.svelte": _,
|
|
52
|
-
"../ui/components/cells/date.svelte": ie,
|
|
53
|
-
"../ui/components/cells/editor.svelte": ae,
|
|
54
|
-
"../ui/components/cells/email.svelte": oe,
|
|
55
|
-
"../ui/components/cells/file.svelte": se,
|
|
56
|
-
"../ui/components/cells/geoPoint.svelte": v,
|
|
57
|
-
"../ui/components/cells/index.ts": y,
|
|
58
|
-
"../ui/components/cells/json.svelte": b,
|
|
59
|
-
"../ui/components/cells/number.svelte": x,
|
|
60
|
-
"../ui/components/cells/password.svelte": S,
|
|
61
|
-
"../ui/components/cells/relation.svelte": C,
|
|
62
|
-
"../ui/components/cells/select.svelte": w,
|
|
63
|
-
"../ui/components/cells/text.svelte": T,
|
|
64
|
-
"../ui/components/cells/url.svelte": E,
|
|
65
|
-
"../ui/components/column-header/column-header.svelte": D,
|
|
66
|
-
"../ui/components/column-header/index.ts": O,
|
|
67
|
-
"../ui/components/faceted-filter/faceted-filter.svelte": k,
|
|
68
|
-
"../ui/components/faceted-filter/index.ts": A,
|
|
69
|
-
"../ui/components/file-form/file-field.svelte": j,
|
|
70
|
-
"../ui/components/file-form/file-input.svelte": M,
|
|
71
|
-
"../ui/components/file-form/file-multiple.svelte": N,
|
|
72
|
-
"../ui/components/file-form/file-single.svelte": P,
|
|
73
|
-
"../ui/components/file-form/file-thumb.svelte": F,
|
|
74
|
-
"../ui/components/file-form/index.ts": I,
|
|
75
|
-
"../ui/components/file-form/shared.ts": L,
|
|
76
|
-
"../ui/components/geopoint/coordinate.svelte": R,
|
|
77
|
-
"../ui/components/geopoint/index.ts": z,
|
|
78
|
-
"../ui/components/geopoint/input.svelte": B,
|
|
79
|
-
"../ui/components/geopoint/toggle-map.svelte": V,
|
|
80
|
-
"../ui/components/leaflet/index.ts": H,
|
|
81
|
-
"../ui/components/leaflet/leaflet.svelte": U,
|
|
82
|
-
"../ui/components/multiselect/chip.svelte": W,
|
|
83
|
-
"../ui/components/multiselect/content.svelte": ce,
|
|
84
|
-
"../ui/components/multiselect/field.svelte": G,
|
|
85
|
-
"../ui/components/multiselect/index.ts": le,
|
|
86
|
-
"../ui/components/multiselect/input.svelte": ue,
|
|
87
|
-
"../ui/components/multiselect/item.svelte": de,
|
|
88
|
-
"../ui/components/multiselect/trigger.svelte": fe,
|
|
89
|
-
"../ui/components/pagination/index.ts": pe,
|
|
90
|
-
"../ui/components/pagination/pagination.svelte": me,
|
|
91
|
-
"../ui/components/row-actions/index.ts": he,
|
|
92
|
-
"../ui/components/row-actions/row-actions.svelte": ge
|
|
93
|
-
});
|
|
94
|
-
function ye() {
|
|
95
|
-
return [...new Set(Object.keys(K).map(q))].filter(Boolean).sort();
|
|
96
|
-
}
|
|
97
|
-
function q(e) {
|
|
98
|
-
let t = e.split("/");
|
|
99
|
-
return t[t.indexOf("components") + 1] ?? "";
|
|
100
|
-
}
|
|
101
|
-
function be(e) {
|
|
102
|
-
let t = e.split("/"), n = t.indexOf("components");
|
|
103
|
-
return t.slice(n + 2).join("/");
|
|
104
|
-
}
|
|
105
|
-
function J(e, t) {
|
|
106
|
-
return n.isAbsolute(t) ? t : n.join(e, t);
|
|
107
|
-
}
|
|
108
|
-
function Y(e, t) {
|
|
109
|
-
return n.isAbsolute(t) ? n.relative(e, t) : t;
|
|
110
|
-
}
|
|
111
|
-
function X(e, t) {
|
|
112
|
-
i(n.dirname(e), { recursive: !0 }), s(e, t, "utf8");
|
|
113
|
-
}
|
|
114
|
-
function xe(e) {
|
|
115
|
-
r(e) && o(e, {
|
|
116
|
-
force: !0,
|
|
117
|
-
recursive: !0
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
async function Se(e, t, n) {
|
|
121
|
-
let r = (await c({ cwd: e }))?.name ?? "npm", i = l(r, t, n);
|
|
122
|
-
if (!i) throw Error(`Unable to resolve ${t} command for ${r}`);
|
|
123
|
-
let a = [...i.args];
|
|
124
|
-
r === "npm" && a.unshift("--yes"), await new Promise((t, n) => {
|
|
125
|
-
let r = u(i.command, a, {
|
|
126
|
-
cwd: e,
|
|
127
|
-
stdio: "inherit"
|
|
128
|
-
});
|
|
129
|
-
r.on("error", n), r.on("exit", (e) => {
|
|
130
|
-
if (e === 0) {
|
|
131
|
-
t();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
n(/* @__PURE__ */ Error(`${i.command} exited with code ${e ?? "unknown"}`));
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
async function Z(e, t, n, r) {
|
|
139
|
-
if (r?.executeCommand) {
|
|
140
|
-
await r.executeCommand(e, t, n);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
await Se(e, t, n);
|
|
144
|
-
}
|
|
145
|
-
function Ce(e) {
|
|
146
|
-
let t = n.join(e, "package.json");
|
|
147
|
-
if (!r(t)) return /* @__PURE__ */ new Set();
|
|
148
|
-
let i = JSON.parse(a(t, "utf8"));
|
|
149
|
-
return /* @__PURE__ */ new Set([
|
|
150
|
-
...Object.keys(i.dependencies ?? {}),
|
|
151
|
-
...Object.keys(i.devDependencies ?? {}),
|
|
152
|
-
...Object.keys(i.optionalDependencies ?? {}),
|
|
153
|
-
...Object.keys(i.peerDependencies ?? {})
|
|
154
|
-
]);
|
|
155
|
-
}
|
|
156
|
-
function we(e) {
|
|
157
|
-
let t = e.indexOf("@", +!!e.startsWith("@"));
|
|
158
|
-
return t === -1 ? e : e.slice(0, t);
|
|
159
|
-
}
|
|
160
|
-
async function Q(e, n, r, i = t) {
|
|
161
|
-
if (n.length === 0) return [];
|
|
162
|
-
let a = Ce(e), o = [...new Set(n)].filter((e) => !a.has(we(e)));
|
|
163
|
-
return o.length === 0 ? [] : (i.info(`Installing packages: ${o.join(", ")}`), await Z(e, "install", o, r), o);
|
|
164
|
-
}
|
|
165
|
-
function $(e) {
|
|
166
|
-
return ye().includes(e);
|
|
167
|
-
}
|
|
168
|
-
function Te(e) {
|
|
169
|
-
return [...new Set(e.flatMap((e) => ve[e] ?? []))];
|
|
170
|
-
}
|
|
171
|
-
function Ee(e, t) {
|
|
172
|
-
let r = n.join(t, e);
|
|
173
|
-
i(r, { recursive: !0 });
|
|
174
|
-
for (let [t, a] of Object.entries(K)) {
|
|
175
|
-
if (q(t) !== e) continue;
|
|
176
|
-
let o = be(t);
|
|
177
|
-
if (!o) continue;
|
|
178
|
-
let c = n.join(r, o);
|
|
179
|
-
i(n.dirname(c), { recursive: !0 }), s(c, a, "utf8");
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function De(e, a, o, s = t) {
|
|
183
|
-
if (a.length === 0) return {
|
|
184
|
-
components: [],
|
|
185
|
-
packages: []
|
|
186
|
-
};
|
|
187
|
-
let c = n.join(e, "src", "lib", "components", "ui");
|
|
188
|
-
i(c, { recursive: !0 });
|
|
189
|
-
let l = [...new Set(a)].filter((e) => !r(n.join(c, e)));
|
|
190
|
-
if (l.length === 0) return {
|
|
191
|
-
components: [],
|
|
192
|
-
packages: []
|
|
193
|
-
};
|
|
194
|
-
let u = new Set(l.filter($)), d = new Set(l.filter((e) => !$(e)));
|
|
195
|
-
for (let e of [...u]) for (let t of _e[e] ?? []) r(n.join(c, t)) || ($(t) ? u.add(t) : d.add(t));
|
|
196
|
-
let f = [], p = [...u].sort();
|
|
197
|
-
p.length > 0 && s.info(`Installing custom components: ${p.join(", ")}`);
|
|
198
|
-
for (let e of p) Ee(e, c), f.push(e), d.delete(e);
|
|
199
|
-
let m = await Q(e, Te([...u]), o, s), h = [...d].sort();
|
|
200
|
-
return h.length > 0 && (s.info(`Installing shadcn-svelte components: ${h.join(", ")}`), await Z(e, "execute", [
|
|
201
|
-
"shadcn-svelte",
|
|
202
|
-
"add",
|
|
203
|
-
"--yes",
|
|
204
|
-
"--overwrite",
|
|
205
|
-
...h
|
|
206
|
-
], o), f.push(...h)), {
|
|
207
|
-
components: [...new Set(f)],
|
|
208
|
-
packages: m
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
async function Oe(t, n, i) {
|
|
212
|
-
let o = e(n), s = {
|
|
213
|
-
creates: [],
|
|
214
|
-
modifies: [],
|
|
215
|
-
deletes: [],
|
|
216
|
-
components: [],
|
|
217
|
-
packages: [],
|
|
218
|
-
collections: [],
|
|
219
|
-
collectionPatches: [],
|
|
220
|
-
collectionDrops: []
|
|
221
|
-
}, c = [];
|
|
222
|
-
if (t.collectionDrops.length > 0) {
|
|
223
|
-
let { dropCollections: e } = await import("./collections-DgZjDXef.js");
|
|
224
|
-
c = await e(t.collectionDrops, n);
|
|
225
|
-
}
|
|
226
|
-
let l = await Q(n.root, t.packages, i, o), u = await De(n.root, t.components, i, o);
|
|
227
|
-
for (let e of [...t.creates, ...c]) {
|
|
228
|
-
if (e.status !== "success") continue;
|
|
229
|
-
let t = J(n.root, e.path);
|
|
230
|
-
if (!r(t)) {
|
|
231
|
-
X(t, e.content), s.creates.push({
|
|
232
|
-
...e,
|
|
233
|
-
path: Y(n.root, e.path)
|
|
234
|
-
});
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
a(t, "utf8") !== e.content && (X(t, e.content), s.modifies.push({
|
|
238
|
-
...e,
|
|
239
|
-
path: Y(n.root, e.path)
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
for (let e of t.modifies) e.status === "success" && (X(J(n.root, e.path), e.content), s.modifies.push({
|
|
243
|
-
...e,
|
|
244
|
-
path: Y(n.root, e.path)
|
|
245
|
-
}));
|
|
246
|
-
for (let e of t.deletes) e.status === "success" && r(J(n.root, e.path)) && (xe(J(n.root, e.path)), s.deletes.push({
|
|
247
|
-
...e,
|
|
248
|
-
path: Y(n.root, e.path)
|
|
249
|
-
}));
|
|
250
|
-
return {
|
|
251
|
-
...t,
|
|
252
|
-
creates: s.creates,
|
|
253
|
-
modifies: s.modifies,
|
|
254
|
-
deletes: s.deletes,
|
|
255
|
-
components: u.components,
|
|
256
|
-
packages: [.../* @__PURE__ */ new Set([...l, ...u.packages])]
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
export { Oe as writeResult };
|
|
261
|
-
|
|
262
|
-
//# sourceMappingURL=write-result-DvELaUJg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-result-DvELaUJg.js","names":[],"sources":["../../src/runtime/write-result.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\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 { Options, Result } from \"../core/types\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\n\ntype PackageManagerOperation = \"execute\" | \"install\";\ntype ExecuteCommand = (\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n) => Promise<void>;\n\ninterface WriteResultRuntime {\n executeCommand?: ExecuteCommand;\n}\n\ntype CustomNpmPackages = Record<string, string[]>;\n\nconst customDependencies: Record<string, string[]> = {\n \"file-form\": [\"input\", \"form\"],\n multiselect: [\"command\", \"popover\", \"button\", \"badge\"],\n geopoint: [\"button\", \"leaflet\"],\n cells: [],\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\": [],\n multiselect: [],\n geopoint: [],\n cells: [],\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): void {\n if (!existsSync(filePath)) {\n return;\n }\n\n rmSync(filePath, { force: true, recursive: true });\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\nasync function installComponents(\n root: string,\n components: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<{ components: string[]; packages: string[] }> {\n if (components.length === 0) {\n return { components: [], packages: [] };\n }\n\n const componentsDir = path.join(root, \"src\", \"lib\", \"components\", \"ui\");\n mkdirSync(componentsDir, { recursive: true });\n\n const requested = [...new Set(components)];\n const missing = requested.filter(\n (component) => !existsSync(path.join(componentsDir, component)),\n );\n\n if (missing.length === 0) {\n return { components: [], packages: [] };\n }\n\n const customToInstall = new Set(missing.filter(isCustomComponent));\n const publicToInstall = new Set(\n missing.filter((component) => !isCustomComponent(component)),\n );\n\n for (const component of [...customToInstall]) {\n for (const dependency of customDependencies[component] ?? []) {\n if (existsSync(path.join(componentsDir, dependency))) {\n continue;\n }\n if (isCustomComponent(dependency)) {\n customToInstall.add(dependency);\n } else {\n publicToInstall.add(dependency);\n }\n }\n }\n\n const installedComponents: 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 installedComponents.push(component);\n publicToInstall.delete(component);\n }\n\n const customPackages = await installPackages(\n root,\n customNpmPackagesFor([...customToInstall]),\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 installedComponents.push(...publicList);\n }\n\n return {\n components: [...new Set(installedComponents)],\n packages: customPackages,\n };\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 options.root,\n result.components,\n runtime,\n logger,\n );\n\n for (const file of [...result.creates, ...dropMigrationCreates]) {\n if (file.status !== \"success\") continue;\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\") continue;\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\") continue;\n if (existsSync(toTargetPath(options.root, file.path))) {\n removeFile(toTargetPath(options.root, file.path));\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.components,\n packages: [...new Set([...packageInstalls, ...componentInstalls.packages])],\n };\n}\n"],"mappings":";;;;;;;wv2CA2BM,KAA+C;CACnD,aAAa,CAAC,SAAS,MAAM;CAC7B,aAAa;EAAC;EAAW;EAAW;EAAU;CAAO;CACrD,UAAU,CAAC,UAAU,SAAS;CAC9B,OAAO,CAAC;CACR,iBAAiB,CAAC,iBAAiB,QAAQ;CAC3C,kBAAkB;EAAC;EAAW;EAAW;EAAU;EAAa;CAAO;CACvE,YAAY,CAAC,UAAU,QAAQ;CAC/B,eAAe,CAAC,iBAAiB,QAAQ;CACzC,SAAS,CAAC;CACV,aAAa,CAAC,iBAAiB,QAAQ;AACzC,GAEM,KAAuC;CAC3C,aAAa,CAAC;CACd,aAAa,CAAC;CACd,UAAU,CAAC;CACX,OAAO,CAAC;CACR,iBAAiB,CAAC,sBAAsB;CACxC,kBAAkB,CAAC,sBAAsB;CACzC,YAAY,CAAC,sBAAsB;CACnC,eAAe,CAAC;CAChB,SAAS,CAAC,WAAW,gBAAgB;AACvC,GAEM,IAAwB,uBAAA,OAAA;CAAA,uDAAA;CAAA,qDAAA;CAAA,oDAAA;CAAA,qDAAA;CAAA,yDAAA;CAAA,uDAAA;CAAA,+CAAA;CAAA,yCAAA;CAAA,uCAAA;CAAA,0CAAA;CAAA,sCAAA;CAAA,sCAAA;CAAA,wCAAA;CAAA,uCAAA;CAAA,sCAAA;CAAA,0CAAA;CAAA,mCAAA;CAAA,sCAAA;CAAA,wCAAA;CAAA,0CAAA;CAAA,0CAAA;CAAA,wCAAA;CAAA,sCAAA;CAAA,qCAAA;CAAA,uDAAA;CAAA,2CAAA;CAAA,yDAAA;CAAA,4CAAA;CAAA,gDAAA;CAAA,gDAAA;CAAA,mDAAA;CAAA,iDAAA;CAAA,gDAAA;CAAA,uCAAA;CAAA,wCAAA;CAAA,+CAAA;CAAA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