fulldev-ui 0.14.1 → 0.14.3
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/package.json +7 -13
- package/public/r/carousel.json +2 -2
- package/public/r/layout.json +1 -1
- package/public/r/marquee.json +1 -1
- package/src/components/ui/carousel/carousel-next.astro +3 -0
- package/src/components/ui/carousel/carousel-previous.astro +3 -0
- package/src/components/ui/layout/layout-head.astro +12 -3
- package/src/components/ui/marquee/marquee.astro +1 -1
- package/src/lib/analytics-interactions.js +72 -0
- package/src/lib/analytics-privacy.js +46 -0
- package/src/lib/analytics.ts +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Fulldev UI
|
|
2
2
|
|
|
3
|
+
## 0.14.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#215](https://github.com/fulldotdev/ui/pull/215) [`b87b9e1`](https://github.com/fulldotdev/ui/commit/b87b9e113f14453f9fd349555ee3654679457dc9) Thanks [@silveltman](https://github.com/silveltman)! - Pause the `Marquee` animation when the visitor prefers reduced motion, and keep a `disabled` value passed to `CarouselPrevious` or `CarouselNext` instead of overwriting it when the carousel scrolls.
|
|
8
|
+
|
|
9
|
+
## 0.14.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#213](https://github.com/fulldotdev/ui/pull/213) [`1304c8b`](https://github.com/fulldotdev/ui/commit/1304c8b49e14a6f4cf3576433014ecf396019913) Thanks [@silveltman](https://github.com/silveltman)! - Improve the `LayoutHead` social tags: add `twitter:card` (`summary_large_image` with an image, `summary` without), emit `og:image:type` for optimized images, skip `og:image` when the image source is empty, and follow `trailingSlash: "never"` in the canonical and `og:url`.
|
|
14
|
+
|
|
3
15
|
## 0.14.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fulldev-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.3",
|
|
5
5
|
"description": "Open-source Astro UI components and blocks",
|
|
6
6
|
"homepage": "https://ui.full.dev",
|
|
7
7
|
"bugs": "https://github.com/fulldotdev/ui/issues",
|
|
@@ -83,23 +83,22 @@
|
|
|
83
83
|
"astro-robots-txt": "^1.0.0",
|
|
84
84
|
"class-variance-authority": "^0.7.1",
|
|
85
85
|
"clsx": "^2.1.1",
|
|
86
|
+
"embla-carousel": "8.6.0",
|
|
86
87
|
"lucide-static": "^1.22.0",
|
|
88
|
+
"posthog-js": "1.434.15",
|
|
87
89
|
"shadcn": "^4.12.0",
|
|
88
90
|
"simple-icons": "^16.24.1",
|
|
89
91
|
"simple-icons-astro": "^16.1.0",
|
|
90
92
|
"tailwind-merge": "^3.6.0",
|
|
91
93
|
"tailwindcss": "^4.3.2",
|
|
92
94
|
"tw-animate-css": "^1.4.0",
|
|
93
|
-
"typescript": "^6.0.3"
|
|
94
|
-
"embla-carousel": "8.6.0"
|
|
95
|
+
"typescript": "^6.0.3"
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
97
|
-
"@argos-ci/playwright": "^7.6.0",
|
|
98
98
|
"@astrojs/check": "^0.9.9",
|
|
99
99
|
"@changesets/changelog-github": "^0.7.0",
|
|
100
100
|
"@changesets/cli": "^2.31.0",
|
|
101
101
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
102
|
-
"@playwright/test": "^1.63.0",
|
|
103
102
|
"prettier": "3.9.3",
|
|
104
103
|
"prettier-plugin-astro": "0.14.1",
|
|
105
104
|
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
@@ -108,23 +107,18 @@
|
|
|
108
107
|
"scripts": {
|
|
109
108
|
"astro": "astro",
|
|
110
109
|
"dev": "pnpm stop && astro dev --host 127.0.0.1 --port 4321",
|
|
111
|
-
"start": "pnpm dev",
|
|
112
110
|
"stop": "lsof -tiTCP:4321 -sTCP:LISTEN | xargs kill 2>/dev/null || true",
|
|
113
111
|
"preview": "pnpm stop && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
114
112
|
"typecheck": "astro check",
|
|
115
|
-
"
|
|
116
|
-
"check": "pnpm format:check && pnpm typecheck",
|
|
113
|
+
"check": "pnpm format:check && pnpm typecheck && pnpm registry:check",
|
|
117
114
|
"build": "astro build",
|
|
118
|
-
"build:prod": "pnpm check && pnpm registry:build && pnpm build",
|
|
119
|
-
"build:preview": "pnpm registry:build && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
120
|
-
"build:test": "pnpm check && pnpm registry:build && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
121
115
|
"registry:build": "pnpm registry:meta && shadcn build && pnpm format:write --log-level warn",
|
|
122
116
|
"registry:check": "pnpm registry:build && git diff --exit-code -- registry.json public/r",
|
|
123
117
|
"format:write": "prettier --write .",
|
|
124
118
|
"format:check": "prettier --check .",
|
|
125
119
|
"release": "changeset version && pnpm install --lockfile-only",
|
|
126
|
-
"release:publish": "pnpm registry:check &&
|
|
120
|
+
"release:publish": "pnpm registry:check && changeset publish",
|
|
127
121
|
"registry:meta": "node scripts/registry-meta.mjs",
|
|
128
|
-
"
|
|
122
|
+
"format": "prettier --write ."
|
|
129
123
|
}
|
|
130
124
|
}
|
package/public/r/carousel.json
CHANGED
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"path": "src/components/ui/carousel/carousel-next.astro",
|
|
31
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronRightIcon from \"@lucide/astro/icons/chevron-right\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> & ButtonVariantProps\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot=\"carousel-next\"\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-right-12 group-data-[orientation=horizontal]/carousel:my-auto\",\n \"group-data-[orientation=vertical]/carousel:right-auto group-data-[orientation=vertical]/carousel:-bottom-12 group-data-[orientation=vertical]/carousel:left-1/2 group-data-[orientation=vertical]/carousel:-translate-x-1/2 group-data-[orientation=vertical]/carousel:translate-y-0 group-data-[orientation=vertical]/carousel:rotate-90\",\n className\n )}\n {...props}\n>\n <slot>\n <ChevronRightIcon aria-hidden=\"true\" />\n <span class=\"sr-only\">Next slide</span>\n </slot>\n</button>\n",
|
|
31
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronRightIcon from \"@lucide/astro/icons/chevron-right\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> & ButtonVariantProps\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n disabled,\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot=\"carousel-next\"\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-right-12 group-data-[orientation=horizontal]/carousel:my-auto\",\n \"group-data-[orientation=vertical]/carousel:right-auto group-data-[orientation=vertical]/carousel:-bottom-12 group-data-[orientation=vertical]/carousel:left-1/2 group-data-[orientation=vertical]/carousel:-translate-x-1/2 group-data-[orientation=vertical]/carousel:translate-y-0 group-data-[orientation=vertical]/carousel:rotate-90\",\n className\n )}\n {...props}\n>\n <slot>\n <ChevronRightIcon aria-hidden=\"true\" />\n <span class=\"sr-only\">Next slide</span>\n </slot>\n</button>\n",
|
|
32
32
|
"type": "registry:ui"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"path": "src/components/ui/carousel/carousel-previous.astro",
|
|
36
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronLeftIcon from \"@lucide/astro/icons/chevron-left\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> & ButtonVariantProps\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot=\"carousel-previous\"\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-left-12 group-data-[orientation=horizontal]/carousel:my-auto\",\n \"group-data-[orientation=vertical]/carousel:-top-12 group-data-[orientation=vertical]/carousel:left-1/2 group-data-[orientation=vertical]/carousel:-translate-x-1/2 group-data-[orientation=vertical]/carousel:translate-y-0 group-data-[orientation=vertical]/carousel:rotate-90\",\n className\n )}\n {...props}\n>\n <slot>\n <ChevronLeftIcon aria-hidden=\"true\" />\n <span class=\"sr-only\">Previous slide</span>\n </slot>\n</button>\n",
|
|
36
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronLeftIcon from \"@lucide/astro/icons/chevron-left\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> & ButtonVariantProps\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n disabled,\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot=\"carousel-previous\"\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-left-12 group-data-[orientation=horizontal]/carousel:my-auto\",\n \"group-data-[orientation=vertical]/carousel:-top-12 group-data-[orientation=vertical]/carousel:left-1/2 group-data-[orientation=vertical]/carousel:-translate-x-1/2 group-data-[orientation=vertical]/carousel:translate-y-0 group-data-[orientation=vertical]/carousel:rotate-90\",\n className\n )}\n {...props}\n>\n <slot>\n <ChevronLeftIcon aria-hidden=\"true\" />\n <span class=\"sr-only\">Previous slide</span>\n </slot>\n</button>\n",
|
|
37
37
|
"type": "registry:ui"
|
|
38
38
|
},
|
|
39
39
|
{
|
package/public/r/layout.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "src/components/ui/layout/layout-head.astro",
|
|
17
|
-
"content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Font, getImage } from \"astro:assets\"\nimport { AstroSeo } from \"@lexingtonthemes/seo\"\n\ntype Props = {\n name?: string\n title?: string\n description?: string\n image?: {\n src?: ImageMetadata | string\n alt?: string\n }\n noindex?: boolean\n nofollow?: boolean\n canonical?: string\n}\n\nconst baseUrl = Astro.site?.origin || Astro.url.origin\nconst
|
|
17
|
+
"content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Font, getImage } from \"astro:assets\"\nimport { trailingSlash } from \"astro:config/server\"\nimport { AstroSeo } from \"@lexingtonthemes/seo\"\n\ntype Props = {\n name?: string\n title?: string\n description?: string\n image?: {\n src?: ImageMetadata | string\n alt?: string\n }\n noindex?: boolean\n nofollow?: boolean\n canonical?: string\n}\n\nconst baseUrl = Astro.site?.origin || Astro.url.origin\nconst pathnameWithSlash = Astro.url.pathname.endsWith(\"/\")\n ? Astro.url.pathname\n : `${Astro.url.pathname}/`\nconst pagePathname =\n trailingSlash === \"never\" && pathnameWithSlash !== \"/\"\n ? pathnameWithSlash.slice(0, -1)\n : pathnameWithSlash\n\nconst {\n name,\n title,\n description,\n image,\n noindex,\n nofollow,\n canonical,\n ...props\n} = Astro.props\n\nconst resolvedCanonical = new URL(canonical || pagePathname, baseUrl).toString()\n\nconst toImageMimeType = (format?: string) => {\n if (!format) return undefined\n if (format.includes(\"/\")) return format\n if (format === \"jpg\") return \"image/jpeg\"\n if (format === \"svg\") return \"image/svg+xml\"\n return `image/${format}`\n}\n\nconst transformedImage =\n image?.src && typeof image.src !== \"string\"\n ? await getImage({\n src: image.src,\n format: \"png\",\n width: 1200,\n height: 630,\n quality: \"medium\",\n })\n : undefined\n\nconst openGraphImage =\n image?.src && typeof image.src === \"string\"\n ? {\n url: new URL(image.src, baseUrl).toString(),\n alt: image.alt,\n }\n : transformedImage\n ? {\n url: new URL(transformedImage.src, baseUrl).toString(),\n alt: image?.alt,\n width: transformedImage.attributes.width,\n height: transformedImage.attributes.height,\n type: toImageMimeType(transformedImage.options.format),\n }\n : undefined\n---\n\n<head data-slot=\"layout-head\" {...props}>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"generator\" content={Astro.generator} />\n <meta charset=\"utf-8\" />\n <Font cssVariable=\"--font-sans\" />\n <Font cssVariable=\"--font-mono\" />\n <AstroSeo\n title={title}\n description={description}\n canonical={resolvedCanonical}\n noindex={noindex}\n nofollow={nofollow}\n openGraph={{\n url: resolvedCanonical,\n type: \"website\",\n ...(name && { site_name: name }),\n ...(openGraphImage && {\n images: [\n {\n ...openGraphImage,\n ...(openGraphImage.url.startsWith(\"https://\") && {\n secureUrl: openGraphImage.url,\n }),\n },\n ],\n }),\n }}\n twitter={{\n cardType: openGraphImage ? \"summary_large_image\" : \"summary\",\n }}\n />\n <slot />\n</head>\n",
|
|
18
18
|
"type": "registry:ui"
|
|
19
19
|
},
|
|
20
20
|
{
|
package/public/r/marquee.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "src/components/ui/marquee/marquee.astro",
|
|
9
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst trackVariants = cva(\n \"flex min-w-max shrink-0 [animation:marquee_var(--marquee-duration)_linear_infinite] items-center gap-[var(--marquee-gap)] before:block before:size-0 before:shrink-0 before:content-['']\",\n {\n variants: {\n direction: {\n left: \"\",\n right: \"[animation-direction:reverse]\",\n },\n pauseOnHover: {\n true: \"group-hover/marquee:[animation-play-state:paused]\",\n false: \"\",\n },\n },\n defaultVariants: {\n direction: \"left\",\n pauseOnHover: false,\n },\n }\n)\n\ntype Props = HTMLAttributes<\"div\"> &\n VariantProps<typeof trackVariants> & {\n duration?: string\n gap?: string\n infinite?: boolean\n }\n\nconst {\n class: className,\n direction,\n pauseOnHover,\n duration = \"40s\",\n gap = \"1.5rem\",\n infinite = true,\n style,\n ...props\n} = Astro.props\n\nconst resolvedStyle = [\n `--marquee-duration:${duration}`,\n `--marquee-gap:${gap}`,\n typeof style === \"string\" ? style : undefined,\n]\n .filter(Boolean)\n .join(\";\")\n---\n\n<div\n class={cn(\n \"group/marquee flex overflow-hidden select-none [--marquee-duration:40s] [--marquee-gap:1.5rem]\",\n className\n )}\n style={resolvedStyle}\n {...props}\n>\n <div class={trackVariants({ direction, pauseOnHover })}>\n <slot />\n </div>\n {\n infinite && (\n <div\n aria-hidden=\"true\"\n class={trackVariants({ direction, pauseOnHover })}\n >\n <slot />\n </div>\n )\n }\n</div>\n\n<style>\n @keyframes marquee {\n from {\n transform: translateX(0);\n }\n\n to {\n transform: translateX(-100%);\n }\n }\n</style>\n",
|
|
9
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst trackVariants = cva(\n \"flex min-w-max shrink-0 [animation:marquee_var(--marquee-duration)_linear_infinite] items-center gap-[var(--marquee-gap)] before:block before:size-0 before:shrink-0 before:content-[''] motion-reduce:[animation-play-state:paused]\",\n {\n variants: {\n direction: {\n left: \"\",\n right: \"[animation-direction:reverse]\",\n },\n pauseOnHover: {\n true: \"group-hover/marquee:[animation-play-state:paused]\",\n false: \"\",\n },\n },\n defaultVariants: {\n direction: \"left\",\n pauseOnHover: false,\n },\n }\n)\n\ntype Props = HTMLAttributes<\"div\"> &\n VariantProps<typeof trackVariants> & {\n duration?: string\n gap?: string\n infinite?: boolean\n }\n\nconst {\n class: className,\n direction,\n pauseOnHover,\n duration = \"40s\",\n gap = \"1.5rem\",\n infinite = true,\n style,\n ...props\n} = Astro.props\n\nconst resolvedStyle = [\n `--marquee-duration:${duration}`,\n `--marquee-gap:${gap}`,\n typeof style === \"string\" ? style : undefined,\n]\n .filter(Boolean)\n .join(\";\")\n---\n\n<div\n class={cn(\n \"group/marquee flex overflow-hidden select-none [--marquee-duration:40s] [--marquee-gap:1.5rem]\",\n className\n )}\n style={resolvedStyle}\n {...props}\n>\n <div class={trackVariants({ direction, pauseOnHover })}>\n <slot />\n </div>\n {\n infinite && (\n <div\n aria-hidden=\"true\"\n class={trackVariants({ direction, pauseOnHover })}\n >\n <slot />\n </div>\n )\n }\n</div>\n\n<style>\n @keyframes marquee {\n from {\n transform: translateX(0);\n }\n\n to {\n transform: translateX(-100%);\n }\n }\n</style>\n",
|
|
10
10
|
"type": "registry:ui"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
class: className,
|
|
12
12
|
variant = "outline",
|
|
13
13
|
size = "icon-sm",
|
|
14
|
+
disabled,
|
|
14
15
|
...props
|
|
15
16
|
} = Astro.props
|
|
16
17
|
---
|
|
@@ -18,6 +19,8 @@ const {
|
|
|
18
19
|
<button
|
|
19
20
|
type="button"
|
|
20
21
|
data-slot="carousel-next"
|
|
22
|
+
data-manual-disabled={disabled ? "true" : undefined}
|
|
23
|
+
disabled={disabled}
|
|
21
24
|
class={cn(
|
|
22
25
|
buttonVariants({ variant, size }),
|
|
23
26
|
"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-right-12 group-data-[orientation=horizontal]/carousel:my-auto",
|
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
class: className,
|
|
12
12
|
variant = "outline",
|
|
13
13
|
size = "icon-sm",
|
|
14
|
+
disabled,
|
|
14
15
|
...props
|
|
15
16
|
} = Astro.props
|
|
16
17
|
---
|
|
@@ -18,6 +19,8 @@ const {
|
|
|
18
19
|
<button
|
|
19
20
|
type="button"
|
|
20
21
|
data-slot="carousel-previous"
|
|
22
|
+
data-manual-disabled={disabled ? "true" : undefined}
|
|
23
|
+
disabled={disabled}
|
|
21
24
|
class={cn(
|
|
22
25
|
buttonVariants({ variant, size }),
|
|
23
26
|
"absolute touch-manipulation rounded-full group-data-[orientation=horizontal]/carousel:inset-y-0 group-data-[orientation=horizontal]/carousel:-left-12 group-data-[orientation=horizontal]/carousel:my-auto",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ImageMetadata } from "astro"
|
|
3
3
|
import { Font, getImage } from "astro:assets"
|
|
4
|
+
import { trailingSlash } from "astro:config/server"
|
|
4
5
|
import { AstroSeo } from "@lexingtonthemes/seo"
|
|
5
6
|
|
|
6
7
|
type Props = {
|
|
@@ -17,9 +18,13 @@ type Props = {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const baseUrl = Astro.site?.origin || Astro.url.origin
|
|
20
|
-
const
|
|
21
|
+
const pathnameWithSlash = Astro.url.pathname.endsWith("/")
|
|
21
22
|
? Astro.url.pathname
|
|
22
23
|
: `${Astro.url.pathname}/`
|
|
24
|
+
const pagePathname =
|
|
25
|
+
trailingSlash === "never" && pathnameWithSlash !== "/"
|
|
26
|
+
? pathnameWithSlash.slice(0, -1)
|
|
27
|
+
: pathnameWithSlash
|
|
23
28
|
|
|
24
29
|
const {
|
|
25
30
|
name,
|
|
@@ -38,6 +43,7 @@ const toImageMimeType = (format?: string) => {
|
|
|
38
43
|
if (!format) return undefined
|
|
39
44
|
if (format.includes("/")) return format
|
|
40
45
|
if (format === "jpg") return "image/jpeg"
|
|
46
|
+
if (format === "svg") return "image/svg+xml"
|
|
41
47
|
return `image/${format}`
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -53,7 +59,7 @@ const transformedImage =
|
|
|
53
59
|
: undefined
|
|
54
60
|
|
|
55
61
|
const openGraphImage =
|
|
56
|
-
typeof image
|
|
62
|
+
image?.src && typeof image.src === "string"
|
|
57
63
|
? {
|
|
58
64
|
url: new URL(image.src, baseUrl).toString(),
|
|
59
65
|
alt: image.alt,
|
|
@@ -64,7 +70,7 @@ const openGraphImage =
|
|
|
64
70
|
alt: image?.alt,
|
|
65
71
|
width: transformedImage.attributes.width,
|
|
66
72
|
height: transformedImage.attributes.height,
|
|
67
|
-
type: toImageMimeType(transformedImage.
|
|
73
|
+
type: toImageMimeType(transformedImage.options.format),
|
|
68
74
|
}
|
|
69
75
|
: undefined
|
|
70
76
|
---
|
|
@@ -96,6 +102,9 @@ const openGraphImage =
|
|
|
96
102
|
],
|
|
97
103
|
}),
|
|
98
104
|
}}
|
|
105
|
+
twitter={{
|
|
106
|
+
cardType: openGraphImage ? "summary_large_image" : "summary",
|
|
107
|
+
}}
|
|
99
108
|
/>
|
|
100
109
|
<slot />
|
|
101
110
|
</head>
|
|
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
5
5
|
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
7
|
const trackVariants = cva(
|
|
8
|
-
"flex min-w-max shrink-0 [animation:marquee_var(--marquee-duration)_linear_infinite] items-center gap-[var(--marquee-gap)] before:block before:size-0 before:shrink-0 before:content-['']",
|
|
8
|
+
"flex min-w-max shrink-0 [animation:marquee_var(--marquee-duration)_linear_infinite] items-center gap-[var(--marquee-gap)] before:block before:size-0 before:shrink-0 before:content-[''] motion-reduce:[animation-play-state:paused]",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
direction: {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
let started = false
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record intent only, never form values, link text or contact details.
|
|
5
|
+
* @param {{ capture: (name: string, properties: Record<string, string>) => unknown }} posthog
|
|
6
|
+
*/
|
|
7
|
+
export function trackInteractions(posthog) {
|
|
8
|
+
if (started) return
|
|
9
|
+
started = true
|
|
10
|
+
const ignored =
|
|
11
|
+
".ph-no-capture, .ph-no-autocapture, [data-ph-no-capture], [data-ph-no-autocapture]"
|
|
12
|
+
const capture = (/** @type {string} */ type) => {
|
|
13
|
+
posthog.capture("website_interaction", { interaction_type: type })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
document.addEventListener(
|
|
17
|
+
"submit",
|
|
18
|
+
(event) => {
|
|
19
|
+
if (
|
|
20
|
+
event.target instanceof HTMLFormElement &&
|
|
21
|
+
!event.target.closest(ignored)
|
|
22
|
+
) {
|
|
23
|
+
capture("form_submit_attempt")
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
true
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
document.addEventListener(
|
|
30
|
+
"click",
|
|
31
|
+
(event) => {
|
|
32
|
+
if (!(event.target instanceof Element) || event.target.closest(ignored))
|
|
33
|
+
return
|
|
34
|
+
const link = event.target.closest("a[href]")
|
|
35
|
+
if (!(link instanceof HTMLAnchorElement)) return
|
|
36
|
+
let url
|
|
37
|
+
try {
|
|
38
|
+
url = new URL(link.href)
|
|
39
|
+
} catch {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (url.protocol === "tel:") capture("phone_click")
|
|
43
|
+
else if (url.protocol === "mailto:") capture("email_click")
|
|
44
|
+
else if (url.protocol === "whatsapp:") capture("whatsapp_click")
|
|
45
|
+
else if (
|
|
46
|
+
link.hasAttribute("download") &&
|
|
47
|
+
(url.protocol === "blob:" || url.protocol === "data:")
|
|
48
|
+
) {
|
|
49
|
+
capture("download_click")
|
|
50
|
+
} else if (url.protocol === "https:" || url.protocol === "http:") {
|
|
51
|
+
if (
|
|
52
|
+
["wa.me", "api.whatsapp.com", "web.whatsapp.com"].includes(
|
|
53
|
+
url.hostname
|
|
54
|
+
)
|
|
55
|
+
) {
|
|
56
|
+
capture("whatsapp_click")
|
|
57
|
+
} else if (
|
|
58
|
+
link.hasAttribute("download") ||
|
|
59
|
+
/\.(pdf|docx?|xlsx?|pptx?|csv|zip)$/i.test(url.pathname)
|
|
60
|
+
) {
|
|
61
|
+
capture("download_click")
|
|
62
|
+
} else if (
|
|
63
|
+
url.hostname.replace(/^www\./, "") !==
|
|
64
|
+
window.location.hostname.replace(/^www\./, "")
|
|
65
|
+
) {
|
|
66
|
+
capture("outbound_click")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ capture: true, passive: true }
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Remove URL details from exceptions; redact ambiguous text as a whole. */
|
|
2
|
+
export function sanitizeExceptionUrls(event) {
|
|
3
|
+
if (event?.event !== "$exception") return event
|
|
4
|
+
const seen = new WeakSet()
|
|
5
|
+
const clean = (value) => {
|
|
6
|
+
if (typeof value === "string") {
|
|
7
|
+
if (!/[?#@]/.test(value)) return value
|
|
8
|
+
const normalized = value.replace(/\\/g, "/")
|
|
9
|
+
// Only preserve an unambiguous standalone URL or relative filename.
|
|
10
|
+
if (
|
|
11
|
+
/\s|["'<>]/.test(normalized) ||
|
|
12
|
+
!/^(?:https?:|\/|\.\.?\/|[\w.-]+[?#])/i.test(normalized)
|
|
13
|
+
) {
|
|
14
|
+
return "[redacted-url-details]"
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const absolute = /^https?:/i.test(normalized)
|
|
18
|
+
const parsed = new URL(
|
|
19
|
+
normalized,
|
|
20
|
+
absolute ? undefined : "https://redacted.invalid"
|
|
21
|
+
)
|
|
22
|
+
if (/https?:|\/\/|@/i.test(parsed.pathname))
|
|
23
|
+
return "[redacted-url-details]"
|
|
24
|
+
const prefix = absolute
|
|
25
|
+
? parsed.protocol + "//" + parsed.host
|
|
26
|
+
: normalized.startsWith("//")
|
|
27
|
+
? "//" + parsed.host
|
|
28
|
+
: ""
|
|
29
|
+
const pathname =
|
|
30
|
+
!absolute && !normalized.startsWith("/")
|
|
31
|
+
? parsed.pathname.slice(1)
|
|
32
|
+
: parsed.pathname
|
|
33
|
+
return prefix + pathname
|
|
34
|
+
} catch {
|
|
35
|
+
return "[redacted-url-details]"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (value && typeof value === "object" && !seen.has(value)) {
|
|
39
|
+
seen.add(value)
|
|
40
|
+
for (const key of Object.keys(value)) value[key] = clean(value[key])
|
|
41
|
+
}
|
|
42
|
+
return value
|
|
43
|
+
}
|
|
44
|
+
clean(event.properties)
|
|
45
|
+
return event
|
|
46
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "posthog-js/dist/web-vitals"
|
|
2
|
+
|
|
3
|
+
import { sanitizeExceptionUrls } from "./analytics-privacy.js"
|
|
4
|
+
|
|
5
|
+
import "posthog-js/dist/exception-autocapture"
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
AnalyticsExtensions,
|
|
9
|
+
ErrorTrackingExtensions,
|
|
10
|
+
} from "posthog-js/dist/extension-bundles"
|
|
11
|
+
import posthog from "posthog-js/dist/module.slim.no-external"
|
|
12
|
+
|
|
13
|
+
import { trackInteractions } from "./analytics-interactions.js"
|
|
14
|
+
|
|
15
|
+
export function startAnalytics() {
|
|
16
|
+
posthog.init("phc_mVacbe8Xydu0UZlh4bNw5EGisvzyRcpqXEEuEEp5lOY", {
|
|
17
|
+
api_host: "https://eu.i.posthog.com",
|
|
18
|
+
defaults: "2025-11-30",
|
|
19
|
+
cookieless_mode: "always",
|
|
20
|
+
person_profiles: "never",
|
|
21
|
+
autocapture: false,
|
|
22
|
+
__extensionClasses: {
|
|
23
|
+
...ErrorTrackingExtensions,
|
|
24
|
+
webVitalsAutocapture: AnalyticsExtensions.webVitalsAutocapture,
|
|
25
|
+
},
|
|
26
|
+
capture_exceptions: {
|
|
27
|
+
capture_unhandled_errors: true,
|
|
28
|
+
capture_unhandled_rejections: true,
|
|
29
|
+
capture_console_errors: true,
|
|
30
|
+
},
|
|
31
|
+
capture_performance: { web_vitals: true, web_vitals_attribution: false },
|
|
32
|
+
mask_personal_data_properties: true,
|
|
33
|
+
custom_personal_data_properties: [
|
|
34
|
+
"email",
|
|
35
|
+
"phone",
|
|
36
|
+
"name",
|
|
37
|
+
"password",
|
|
38
|
+
"token",
|
|
39
|
+
"access_token",
|
|
40
|
+
"refresh_token",
|
|
41
|
+
"code",
|
|
42
|
+
],
|
|
43
|
+
disable_capture_url_hashes: true,
|
|
44
|
+
property_denylist: [
|
|
45
|
+
"$referrer",
|
|
46
|
+
"$initial_referrer",
|
|
47
|
+
"$session_entry_referrer",
|
|
48
|
+
],
|
|
49
|
+
loaded: trackInteractions,
|
|
50
|
+
before_send: sanitizeExceptionUrls,
|
|
51
|
+
capture_pageview: true,
|
|
52
|
+
capture_pageleave: true,
|
|
53
|
+
disable_session_recording: true,
|
|
54
|
+
disable_surveys: true,
|
|
55
|
+
advanced_disable_flags: true,
|
|
56
|
+
disable_external_dependency_loading: true,
|
|
57
|
+
})
|
|
58
|
+
}
|