fulldev-ui 0.27.1 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/liquid/.theme-check.yml +1 -1
  3. package/liquid/README.md +1 -1
  4. package/package.json +1 -1
  5. package/public/r/styles/base-luma/carousel.json +2 -2
  6. package/public/r/styles/base-luma/header-1.json +1 -1
  7. package/public/r/styles/base-luma/header-2.json +1 -1
  8. package/public/r/styles/base-luma/header-3.json +1 -1
  9. package/public/r/styles/base-luma/header-4.json +1 -1
  10. package/public/r/styles/base-luma/header-5.json +1 -1
  11. package/public/r/styles/base-luma/header.json +1 -1
  12. package/public/r/styles/base-luma/images.json +18 -0
  13. package/public/r/styles/base-luma/marquee.json +1 -1
  14. package/public/r/styles/base-luma/og.json +47 -0
  15. package/public/r/styles/base-luma/price.json +1 -1
  16. package/public/r/styles/base-luma/registry.json +57 -0
  17. package/public/r/styles/base-luma/select.json +1 -1
  18. package/public/r/styles/base-luma/sidebar.json +1 -1
  19. package/public/r/styles/base-luma/tabs.json +1 -1
  20. package/public/r/styles/base-luma/toast.json +1 -1
  21. package/public/r/styles/base-lyra/carousel.json +2 -2
  22. package/public/r/styles/base-lyra/header-1.json +1 -1
  23. package/public/r/styles/base-lyra/header-2.json +1 -1
  24. package/public/r/styles/base-lyra/header-3.json +1 -1
  25. package/public/r/styles/base-lyra/header-4.json +1 -1
  26. package/public/r/styles/base-lyra/header-5.json +1 -1
  27. package/public/r/styles/base-lyra/header.json +1 -1
  28. package/public/r/styles/base-lyra/images.json +18 -0
  29. package/public/r/styles/base-lyra/marquee.json +1 -1
  30. package/public/r/styles/base-lyra/og.json +47 -0
  31. package/public/r/styles/base-lyra/price.json +1 -1
  32. package/public/r/styles/base-lyra/registry.json +57 -0
  33. package/public/r/styles/base-lyra/select.json +1 -1
  34. package/public/r/styles/base-lyra/sidebar.json +1 -1
  35. package/public/r/styles/base-lyra/tabs.json +1 -1
  36. package/public/r/styles/base-lyra/toast.json +1 -1
  37. package/public/r/styles/base-maia/carousel.json +2 -2
  38. package/public/r/styles/base-maia/header-1.json +1 -1
  39. package/public/r/styles/base-maia/header-2.json +1 -1
  40. package/public/r/styles/base-maia/header-3.json +1 -1
  41. package/public/r/styles/base-maia/header-4.json +1 -1
  42. package/public/r/styles/base-maia/header-5.json +1 -1
  43. package/public/r/styles/base-maia/header.json +1 -1
  44. package/public/r/styles/base-maia/images.json +18 -0
  45. package/public/r/styles/base-maia/marquee.json +1 -1
  46. package/public/r/styles/base-maia/og.json +47 -0
  47. package/public/r/styles/base-maia/price.json +1 -1
  48. package/public/r/styles/base-maia/registry.json +57 -0
  49. package/public/r/styles/base-maia/select.json +1 -1
  50. package/public/r/styles/base-maia/sidebar.json +1 -1
  51. package/public/r/styles/base-maia/tabs.json +1 -1
  52. package/public/r/styles/base-maia/toast.json +1 -1
  53. package/public/r/styles/base-mira/carousel.json +2 -2
  54. package/public/r/styles/base-mira/header-1.json +1 -1
  55. package/public/r/styles/base-mira/header-2.json +1 -1
  56. package/public/r/styles/base-mira/header-3.json +1 -1
  57. package/public/r/styles/base-mira/header-4.json +1 -1
  58. package/public/r/styles/base-mira/header-5.json +1 -1
  59. package/public/r/styles/base-mira/header.json +1 -1
  60. package/public/r/styles/base-mira/images.json +18 -0
  61. package/public/r/styles/base-mira/marquee.json +1 -1
  62. package/public/r/styles/base-mira/og.json +47 -0
  63. package/public/r/styles/base-mira/price.json +1 -1
  64. package/public/r/styles/base-mira/registry.json +57 -0
  65. package/public/r/styles/base-mira/select.json +1 -1
  66. package/public/r/styles/base-mira/sidebar.json +1 -1
  67. package/public/r/styles/base-mira/tabs.json +1 -1
  68. package/public/r/styles/base-mira/toast.json +1 -1
  69. package/public/r/styles/base-nova/carousel.json +2 -2
  70. package/public/r/styles/base-nova/header-1.json +1 -1
  71. package/public/r/styles/base-nova/header-2.json +1 -1
  72. package/public/r/styles/base-nova/header-3.json +1 -1
  73. package/public/r/styles/base-nova/header-4.json +1 -1
  74. package/public/r/styles/base-nova/header-5.json +1 -1
  75. package/public/r/styles/base-nova/header.json +1 -1
  76. package/public/r/styles/base-nova/images.json +18 -0
  77. package/public/r/styles/base-nova/marquee.json +1 -1
  78. package/public/r/styles/base-nova/og.json +47 -0
  79. package/public/r/styles/base-nova/price.json +1 -1
  80. package/public/r/styles/base-nova/registry.json +57 -0
  81. package/public/r/styles/base-nova/select.json +1 -1
  82. package/public/r/styles/base-nova/sidebar.json +1 -1
  83. package/public/r/styles/base-nova/tabs.json +1 -1
  84. package/public/r/styles/base-nova/toast.json +1 -1
  85. package/public/r/styles/base-rhea/carousel.json +2 -2
  86. package/public/r/styles/base-rhea/header-1.json +1 -1
  87. package/public/r/styles/base-rhea/header-2.json +1 -1
  88. package/public/r/styles/base-rhea/header-3.json +1 -1
  89. package/public/r/styles/base-rhea/header-4.json +1 -1
  90. package/public/r/styles/base-rhea/header-5.json +1 -1
  91. package/public/r/styles/base-rhea/header.json +1 -1
  92. package/public/r/styles/base-rhea/images.json +18 -0
  93. package/public/r/styles/base-rhea/marquee.json +1 -1
  94. package/public/r/styles/base-rhea/og.json +47 -0
  95. package/public/r/styles/base-rhea/price.json +1 -1
  96. package/public/r/styles/base-rhea/registry.json +57 -0
  97. package/public/r/styles/base-rhea/select.json +1 -1
  98. package/public/r/styles/base-rhea/sidebar.json +1 -1
  99. package/public/r/styles/base-rhea/tabs.json +1 -1
  100. package/public/r/styles/base-rhea/toast.json +1 -1
  101. package/public/r/styles/base-sera/carousel.json +2 -2
  102. package/public/r/styles/base-sera/header-1.json +1 -1
  103. package/public/r/styles/base-sera/header-2.json +1 -1
  104. package/public/r/styles/base-sera/header-3.json +1 -1
  105. package/public/r/styles/base-sera/header-4.json +1 -1
  106. package/public/r/styles/base-sera/header-5.json +1 -1
  107. package/public/r/styles/base-sera/header.json +1 -1
  108. package/public/r/styles/base-sera/images.json +18 -0
  109. package/public/r/styles/base-sera/marquee.json +1 -1
  110. package/public/r/styles/base-sera/og.json +47 -0
  111. package/public/r/styles/base-sera/price.json +1 -1
  112. package/public/r/styles/base-sera/registry.json +57 -0
  113. package/public/r/styles/base-sera/select.json +1 -1
  114. package/public/r/styles/base-sera/sidebar.json +1 -1
  115. package/public/r/styles/base-sera/tabs.json +1 -1
  116. package/public/r/styles/base-sera/toast.json +1 -1
  117. package/public/r/styles/base-vega/carousel.json +2 -2
  118. package/public/r/styles/base-vega/header-1.json +1 -1
  119. package/public/r/styles/base-vega/header-2.json +1 -1
  120. package/public/r/styles/base-vega/header-3.json +1 -1
  121. package/public/r/styles/base-vega/header-4.json +1 -1
  122. package/public/r/styles/base-vega/header-5.json +1 -1
  123. package/public/r/styles/base-vega/header.json +1 -1
  124. package/public/r/styles/base-vega/images.json +18 -0
  125. package/public/r/styles/base-vega/marquee.json +1 -1
  126. package/public/r/styles/base-vega/og.json +47 -0
  127. package/public/r/styles/base-vega/price.json +1 -1
  128. package/public/r/styles/base-vega/registry.json +57 -0
  129. package/public/r/styles/base-vega/select.json +1 -1
  130. package/public/r/styles/base-vega/sidebar.json +1 -1
  131. package/public/r/styles/base-vega/tabs.json +1 -1
  132. package/public/r/styles/base-vega/toast.json +1 -1
@@ -9,7 +9,7 @@
9
9
  "files": [
10
10
  {
11
11
  "path": "src/components/ui/tabs/tabs.astro",
12
- "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n defaultValue?: string\n orientation?: \"horizontal\" | \"vertical\"\n activationMode?: \"auto\" | \"manual\"\n}\n\nconst {\n class: className,\n defaultValue,\n orientation = \"horizontal\",\n activationMode,\n ...props\n} = Astro.props\n\n// Show the initial panels in the HTML, the ones Data Slot shows when it\n// starts: those of the default value, or of the first enabled trigger.\n// TabsContent renders hidden, so without this the page shifts when the script\n// starts. Like Data Slot, skip the parts of nested tabs.\nconst html = await Astro.slots.render(\"default\")\nconst entities: Record<string, string> = {\n amp: \"&\",\n lt: \"<\",\n gt: \">\",\n quot: '\"',\n apos: \"'\",\n nbsp: \"\\u00a0\",\n}\nconst decode = (value: string) =>\n value.replace(\n /&(#x?[\\da-f]+|amp|lt|gt|quot|apos|nbsp);/gi,\n (entity, code: string) =>\n code.startsWith(\"#\")\n ? String.fromCodePoint(Number(code.replace(\"#\", \"0\")))\n : (entities[code] ?? entity)\n )\n// Attribute values can hold \">\", as Tailwind classes do.\nconst tags =\n /<!--[\\s\\S]*?-->|<(script|style|textarea)\\b[\\s\\S]*?<\\/\\1\\s*>|<(\\/?)([a-z][\\w:-]*)((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/gi\nconst attributes = (source: string) =>\n [\n ...source.matchAll(/([^\\s\"'>/=]+)(?:\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s>]+))?/g),\n ].map(({ 0: text, 1: name, 2: value = \"\", index }) => ({\n name: name.toLowerCase(),\n value: decode(/^[\"']/.test(value) ? value.slice(1, -1) : value),\n index,\n text,\n }))\n// Elements without an end tag.\nconst empty = new Set(\n \"area base br col embed hr img input link meta source track wbr\".split(\" \")\n)\n\nconst triggers: { value: string; disabled: boolean }[] = []\nconst panels: { value: string; hidden: boolean; start: number; end: number }[] =\n []\nconst open: { name: string; tabs: boolean }[] = []\nfor (const { 2: close, 3: tag, 4: source = \"\", index } of html.matchAll(tags)) {\n if (!tag) continue\n const name = tag.toLowerCase()\n if (close) {\n const at = open.findLastIndex((element) => element.name === name)\n if (at >= 0) open.length = at\n continue\n }\n const list = attributes(source)\n const get = (key: string) => list.find((item) => item.name === key)?.value\n const slot = get(\"data-slot\")\n if (!open.some((element) => element.tabs)) {\n const value = get(\"data-value\")?.trim() ?? \"\"\n if (slot === \"tabs-trigger\" && value) {\n triggers.push({\n value,\n disabled:\n get(\"disabled\") !== undefined ||\n get(\"data-disabled\") !== undefined ||\n get(\"aria-disabled\") === \"true\",\n })\n }\n if (slot === \"tabs-content\" && value) {\n const attribute = list.find((item) => item.name === \"hidden\")\n const start = index + 1 + tag.length + (attribute?.index ?? 0)\n const end = start + (attribute?.text.length ?? 0)\n panels.push({ value, hidden: attribute !== undefined, start, end })\n }\n }\n if (!empty.has(name) && !source.trimEnd().endsWith(\"/\")) {\n open.push({ name, tabs: slot === \"tabs\" })\n }\n}\nconst preferred = triggers.findLast(\n (trigger) => trigger.value === defaultValue?.trim()\n)\nconst initial =\n preferred && !preferred.disabled\n ? preferred.value\n : triggers.find((trigger) => !trigger.disabled)?.value\n// Data Slot shows the panels of the initial value and hides the others.\nlet content = html\nfor (const { value, hidden, start, end } of panels.reverse()) {\n if (initial === undefined || hidden !== (value === initial)) continue\n content =\n content.slice(0, start) + (hidden ? \"\" : \" hidden\") + content.slice(end)\n}\n---\n\n<div\n data-slot=\"tabs\"\n data-default-value={defaultValue}\n data-orientation={orientation}\n data-activation-mode={activationMode}\n data-horizontal={orientation === \"horizontal\" ? \"\" : undefined}\n data-vertical={orientation === \"vertical\" ? \"\" : undefined}\n class={cn(\"gap-2 group/tabs flex data-horizontal:flex-col\", className)}\n {...props}\n>\n <Fragment set:html={content} />\n</div>\n\n<script>\n import { create } from \"@data-slot/tabs\"\n\n const controllers: ReturnType<typeof create> = []\n const initialize = () => controllers.push(...create())\n initialize()\n document.addEventListener(\"astro:after-swap\", initialize)\n document.addEventListener(\"astro:page-load\", initialize)\n document.addEventListener(\"astro:before-swap\", () => {\n for (const controller of controllers) controller.destroy()\n controllers.length = 0\n })\n</script>\n",
12
+ "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n defaultValue?: string\n orientation?: \"horizontal\" | \"vertical\"\n activationMode?: \"auto\" | \"manual\"\n}\n\nconst {\n class: className,\n defaultValue,\n orientation = \"horizontal\",\n activationMode,\n ...props\n} = Astro.props\n\n// Show the initial panels in the HTML, the ones Data Slot shows when it\n// starts: those of the default value, or of the first enabled trigger.\n// TabsContent renders hidden, so without this the page shifts when the script\n// starts. Like Data Slot, skip the parts of nested tabs.\nconst html = await Astro.slots.render(\"default\")\nconst entities: Record<string, string> = {\n amp: \"&\",\n lt: \"<\",\n gt: \">\",\n quot: '\"',\n apos: \"'\",\n nbsp: \"\\u00a0\",\n}\nconst decode = (value: string) =>\n value.replace(\n /&(#x?[\\da-f]+|amp|lt|gt|quot|apos|nbsp);/gi,\n (entity, code: string) =>\n code.startsWith(\"#\")\n ? String.fromCodePoint(Number(code.replace(\"#\", \"0\")))\n : (entities[code] ?? entity)\n )\n// Attribute values can hold \">\", as Tailwind classes do.\nconst tags =\n /<!--[\\s\\S]*?-->|<(script|style|textarea)\\b[\\s\\S]*?<\\/\\1\\s*>|<(\\/?)([a-z][\\w:-]*)((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/gi\nconst attributes = (source: string) =>\n [\n ...source.matchAll(/([^\\s\"'>/=]+)(?:\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s>]+))?/g),\n ].map(({ 0: text, 1: name, 2: value = \"\", index }) => ({\n name: name.toLowerCase(),\n value: decode(/^[\"']/.test(value) ? value.slice(1, -1) : value),\n index,\n text,\n }))\nconst voidElements = new Set(\n \"area base br col embed hr img input link meta source track wbr\".split(\" \")\n)\n\nconst triggers: { value: string; disabled: boolean }[] = []\nconst panels: { value: string; hidden: boolean; start: number; end: number }[] =\n []\nconst open: { name: string; tabs: boolean }[] = []\nfor (const { 2: close, 3: tag, 4: source = \"\", index } of html.matchAll(tags)) {\n if (!tag) continue\n const name = tag.toLowerCase()\n if (close) {\n const at = open.findLastIndex((element) => element.name === name)\n if (at >= 0) open.length = at\n continue\n }\n const list = attributes(source)\n const get = (key: string) => list.find((item) => item.name === key)?.value\n const slot = get(\"data-slot\")\n if (!open.some((element) => element.tabs)) {\n const value = get(\"data-value\")?.trim() ?? \"\"\n if (slot === \"tabs-trigger\" && value) {\n triggers.push({\n value,\n disabled:\n get(\"disabled\") !== undefined ||\n get(\"data-disabled\") !== undefined ||\n get(\"aria-disabled\") === \"true\",\n })\n }\n if (slot === \"tabs-content\" && value) {\n const attribute = list.find((item) => item.name === \"hidden\")\n const start = index + 1 + tag.length + (attribute?.index ?? 0)\n const end = start + (attribute?.text.length ?? 0)\n panels.push({ value, hidden: attribute !== undefined, start, end })\n }\n }\n if (!voidElements.has(name) && !source.trimEnd().endsWith(\"/\")) {\n open.push({ name, tabs: slot === \"tabs\" })\n }\n}\nconst preferred = triggers.findLast(\n (trigger) => trigger.value === defaultValue?.trim()\n)\nconst initial =\n preferred && !preferred.disabled\n ? preferred.value\n : triggers.find((trigger) => !trigger.disabled)?.value\n// Data Slot shows the panels of the initial value and hides the others.\nlet content = html\nfor (const { value, hidden, start, end } of panels.reverse()) {\n if (initial === undefined || hidden !== (value === initial)) continue\n content =\n content.slice(0, start) + (hidden ? \"\" : \" hidden\") + content.slice(end)\n}\n---\n\n<div\n data-slot=\"tabs\"\n data-default-value={defaultValue}\n data-orientation={orientation}\n data-activation-mode={activationMode}\n data-horizontal={orientation === \"horizontal\" ? \"\" : undefined}\n data-vertical={orientation === \"vertical\" ? \"\" : undefined}\n class={cn(\"gap-2 group/tabs flex data-horizontal:flex-col\", className)}\n {...props}\n>\n <Fragment set:html={content} />\n</div>\n\n<script>\n import { create } from \"@data-slot/tabs\"\n\n const controllers: ReturnType<typeof create> = []\n const initialize = () => controllers.push(...create())\n initialize()\n document.addEventListener(\"astro:after-swap\", initialize)\n document.addEventListener(\"astro:page-load\", initialize)\n document.addEventListener(\"astro:before-swap\", () => {\n for (const controller of controllers) controller.destroy()\n controllers.length = 0\n })\n</script>\n",
13
13
  "type": "registry:ui"
14
14
  },
15
15
  {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "path": "src/components/ui/toast/toast-action.astro",
21
- "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\ntype Props = HTMLAttributes<\"button\">\n\nconst {\n class: className,\n hidden = true,\n type = \"button\",\n ...props\n} = Astro.props\n---\n\n<button\n data-slot=\"toast-action\"\n data-variant=\"outline\"\n data-size=\"sm\"\n type={type}\n class={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), className)}\n hidden={hidden}\n {...props}\n>\n <slot />\n</button>\n",
21
+ "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { Button } from \"@/components/ui/button\"\n\ntype Props = HTMLAttributes<\"button\">\n\nconst {\n class: className,\n hidden = true,\n type = \"button\",\n ...props\n} = Astro.props\n---\n\n<Button\n {...props}\n as=\"button\"\n data-slot=\"toast-action\"\n variant=\"outline\"\n size=\"sm\"\n type={type}\n class={className}\n hidden={hidden}\n>\n <slot />\n</Button>\n",
22
22
  "type": "registry:ui"
23
23
  },
24
24
  {
@@ -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 disabled,\n \"data-slot\": dataSlot = \"carousel-next\",\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot={dataSlot}\n data-carousel-next\n data-variant={variant}\n data-size={size}\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation 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 { Button, 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 \"data-slot\": dataSlot = \"carousel-next\",\n ...props\n} = Astro.props\n---\n\n<Button\n {...props}\n as=\"button\"\n type=\"button\"\n data-slot={dataSlot}\n data-carousel-next=\"\"\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n variant={variant}\n size={size}\n class={cn(\n \"absolute touch-manipulation 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>\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 disabled,\n \"data-slot\": dataSlot = \"carousel-previous\",\n ...props\n} = Astro.props\n---\n\n<button\n type=\"button\"\n data-slot={dataSlot}\n data-carousel-previous\n data-variant={variant}\n data-size={size}\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n class={cn(\n buttonVariants({ variant, size }),\n \"absolute touch-manipulation 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 { Button, 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 \"data-slot\": dataSlot = \"carousel-previous\",\n ...props\n} = Astro.props\n---\n\n<Button\n {...props}\n as=\"button\"\n type=\"button\"\n data-slot={dataSlot}\n data-carousel-previous=\"\"\n data-manual-disabled={disabled ? \"true\" : undefined}\n disabled={disabled}\n variant={variant}\n size={size}\n class={cn(\n \"absolute touch-manipulation 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>\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
  {
@@ -17,7 +17,7 @@
17
17
  "files": [
18
18
  {
19
19
  "path": "src/components/blocks/header-1.astro",
20
- "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"\", className)} {...props}>\n <HeaderContainer class=\"items-center justify-between gap-4\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n {navigation.length > 0 && (\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\"hidden flex-none justify-start\", desktopClass)}\n >\n <NavigationMenuList class=\"justify-start\">\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n )}\n <HeaderGroup class={cn(\"ml-auto hidden flex-1 justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n\n<script>\n // Close a menu that the header hides at its fold breakpoint, so it does not\n // stay open, or keep the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
20
+ "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"\", className)} {...props}>\n <HeaderContainer class=\"items-center justify-between gap-4\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n {navigation.length > 0 && (\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\"hidden flex-none justify-start\", desktopClass)}\n >\n <NavigationMenuList class=\"justify-start\">\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n )}\n <HeaderGroup class={cn(\"ml-auto hidden flex-1 justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n",
21
21
  "type": "registry:block"
22
22
  }
23
23
  ],
@@ -17,7 +17,7 @@
17
17
  "files": [
18
18
  {
19
19
  "path": "src/components/blocks/header-2.astro",
20
- "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header variant=\"floating\" class={cn(\"\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\n \"absolute left-1/2 hidden max-w-none -translate-x-1/2\",\n desktopClass\n )}\n >\n <NavigationMenuList>\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n\n<script>\n // Close a menu that the header hides at its fold breakpoint, so it does not\n // stay open, or keep the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
20
+ "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header variant=\"floating\" class={cn(\"\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\n \"absolute left-1/2 hidden max-w-none -translate-x-1/2\",\n desktopClass\n )}\n >\n <NavigationMenuList>\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n",
21
21
  "type": "registry:block"
22
22
  }
23
23
  ],
@@ -18,7 +18,7 @@
18
18
  "files": [
19
19
  {
20
20
  "path": "src/components/blocks/header-3.astro",
21
- "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"border-b\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end gap-1\", desktopClass)}>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\"hidden max-w-none justify-end\", desktopClass)}\n >\n <NavigationMenuList>\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n <Separator\n orientation=\"vertical\"\n class=\"mx-1 hidden h-5 self-center lg:block\"\n />\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && <Separator />}\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n\n<script>\n // Close a menu that the header hides at its fold breakpoint, so it does not\n // stay open, or keep the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
21
+ "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n active?: boolean\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"border-b\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end gap-1\", desktopClass)}>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\"hidden max-w-none justify-end\", desktopClass)}\n >\n <NavigationMenuList>\n {navigation.map((item, index) => (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink href={item.href} active={item.active}>\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n <Separator\n orientation=\"vertical\"\n class=\"mx-1 hidden h-5 self-center lg:block\"\n />\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-1\">\n {navigation.map((item) => (\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start\"\n >\n {item.label}\n </SheetClose>\n ))}\n </nav>\n {buttons.length > 0 && <Separator />}\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n",
22
22
  "type": "registry:block"
23
23
  }
24
24
  ],
@@ -17,7 +17,7 @@
17
17
  "files": [
18
18
  {
19
19
  "path": "src/components/blocks/header-4.astro",
20
- "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Image } from \"astro:assets\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerStyle,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n description?: string\n active?: boolean\n image?: {\n src: ImageMetadata\n }\n links?: {\n label: string\n href: string\n description?: string\n icon?: string\n active?: boolean\n }[]\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"border-b\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\n \"absolute left-1/2 hidden max-w-none -translate-x-1/2\",\n desktopClass\n )}\n align=\"center\"\n >\n <NavigationMenuList>\n {navigation.map((item, index) =>\n item.links?.length ? (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <div class=\"grid w-[min(46rem,calc(100vw-2rem))] gap-2 p-1 lg:grid-cols-[1fr_1.1fr]\">\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class=\"bg-muted/50 hover:bg-muted focus:bg-muted flex min-h-40 flex-col items-start justify-end gap-3 p-4 text-left\"\n >\n {item.image && (\n <Image\n src={item.image.src}\n alt=\"\"\n class=\"mb-auto aspect-[16/9] w-full rounded-md object-cover\"\n widths={[320, 480, 640]}\n sizes=\"(min-width: 1024px) 22rem, 100vw\"\n />\n )}\n <span class=\"text-base font-medium\">{item.label}</span>\n {item.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {item.description}\n </span>\n )}\n </NavigationMenuLink>\n <div class=\"grid gap-1\">\n {item.links.map((link) => (\n <NavigationMenuLink\n href={link.href}\n active={link.active}\n class=\"items-start gap-3 p-3\"\n >\n {link.icon && (\n <Icon\n name={link.icon}\n class=\"text-muted-foreground mt-0.5\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{link.label}</span>\n {link.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {link.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n ) : (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class={navigationMenuTriggerStyle()}\n >\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n )}\n </NavigationMenuList>\n </NavigationMenu>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 overflow-y-auto px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-4\">\n {navigation.map((item) => (\n <div class=\"grid gap-1\">\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start font-medium\"\n >\n {item.label}\n </SheetClose>\n {item.links && item.links.length > 0 && (\n <div class=\"border-border ml-3 grid gap-1 border-l pl-3\">\n {item.links.map((link) => (\n <SheetClose\n as=\"a\"\n href={link.href}\n aria-current={link.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"text-muted-foreground justify-start\"\n >\n {link.icon && <Icon name={link.icon} />}\n {link.label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n\n<script>\n // Close a menu that the header hides at its fold breakpoint, so it does not\n // stay open, or keep the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
20
+ "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Image } from \"astro:assets\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerStyle,\n} from \"@/components/ui/navigation-menu\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n description?: string\n active?: boolean\n image?: {\n src: ImageMetadata\n }\n links?: {\n label: string\n href: string\n description?: string\n icon?: string\n active?: boolean\n }[]\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\n---\n\n<Header class={cn(\"border-b\", className)} {...props}>\n <HeaderContainer class=\"justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <NavigationMenu\n aria-label={navigationLabel}\n class={cn(\n \"absolute left-1/2 hidden max-w-none -translate-x-1/2\",\n desktopClass\n )}\n align=\"center\"\n >\n <NavigationMenuList>\n {navigation.map((item, index) =>\n item.links?.length ? (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <div class=\"grid w-[min(46rem,calc(100vw-2rem))] gap-2 p-1 lg:grid-cols-[1fr_1.1fr]\">\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class=\"bg-muted/50 hover:bg-muted focus:bg-muted flex min-h-40 flex-col items-start justify-end gap-3 p-4 text-left\"\n >\n {item.image && (\n <Image\n src={item.image.src}\n alt=\"\"\n class=\"mb-auto aspect-[16/9] w-full rounded-md object-cover\"\n widths={[320, 480, 640]}\n sizes=\"(min-width: 1024px) 22rem, 100vw\"\n />\n )}\n <span class=\"text-base font-medium\">{item.label}</span>\n {item.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {item.description}\n </span>\n )}\n </NavigationMenuLink>\n <div class=\"grid gap-1\">\n {item.links.map((link) => (\n <NavigationMenuLink\n href={link.href}\n active={link.active}\n class=\"items-start gap-3 p-3\"\n >\n {link.icon && (\n <Icon\n name={link.icon}\n class=\"text-muted-foreground mt-0.5\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{link.label}</span>\n {link.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {link.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n ) : (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class={navigationMenuTriggerStyle()}\n >\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n )}\n </NavigationMenuList>\n </NavigationMenu>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 overflow-y-auto px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-4\">\n {navigation.map((item) => (\n <div class=\"grid gap-1\">\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start font-medium\"\n >\n {item.label}\n </SheetClose>\n {item.links && item.links.length > 0 && (\n <div class=\"border-border ml-3 grid gap-1 border-l pl-3\">\n {item.links.map((link) => (\n <SheetClose\n as=\"a\"\n href={link.href}\n aria-current={link.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"text-muted-foreground justify-start\"\n >\n {link.icon && <Icon name={link.icon} />}\n {link.label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n ))}\n </nav>\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n</Header>\n",
21
21
  "type": "registry:block"
22
22
  }
23
23
  ],
@@ -18,7 +18,7 @@
18
18
  "files": [
19
19
  {
20
20
  "path": "src/components/blocks/header-5.astro",
21
- "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Image } from \"astro:assets\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerStyle,\n} from \"@/components/ui/navigation-menu\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n description?: string\n active?: boolean\n image?: {\n src: ImageMetadata\n }\n links?: {\n label: string\n href: string\n description?: string\n icon?: string\n active?: boolean\n }[]\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\nconst dividerClass = fold === \"xl\" ? \"xl:block\" : \"lg:block\"\n---\n\n<Header\n class={cn(\"flex-col items-stretch gap-0 border-b py-0\", className)}\n {...props}\n>\n <HeaderContainer class=\"min-h-14 justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 overflow-y-auto px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-4\">\n {navigation.map((item) => (\n <div class=\"grid gap-1\">\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start font-medium\"\n >\n {item.label}\n </SheetClose>\n {item.links && item.links.length > 0 && (\n <div class=\"border-border ml-3 grid gap-1 border-l pl-3\">\n {item.links.map((link) => (\n <SheetClose\n as=\"a\"\n href={link.href}\n aria-current={link.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"text-muted-foreground justify-start\"\n >\n {link.icon && <Icon name={link.icon} />}\n {link.label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n ))}\n </nav>\n {buttons.length > 0 && <Separator />}\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n <Separator class={cn(\"hidden\", dividerClass)} />\n <HeaderContainer class={cn(\"hidden min-h-11\", desktopClass)}>\n <NavigationMenu\n aria-label={navigationLabel}\n class=\"max-w-none justify-start\"\n align=\"start\"\n >\n <NavigationMenuList class=\"justify-start\">\n {navigation.map((item, index) =>\n item.links?.length ? (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <div class=\"grid w-[min(52rem,calc(100vw-2rem))] gap-2 p-2 lg:grid-cols-[1fr_1.2fr]\">\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class=\"bg-muted/50 hover:bg-muted focus:bg-muted flex-col items-start gap-3 p-3\"\n >\n {item.image && (\n <Image\n src={item.image.src}\n alt=\"\"\n class=\"aspect-[16/9] w-full rounded-md object-cover\"\n widths={[320, 480, 640]}\n sizes=\"(min-width: 1024px) 22rem, 100vw\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{item.label}</span>\n {item.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {item.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n <div class=\"grid gap-1 lg:grid-cols-2\">\n {item.links.map((link) => (\n <NavigationMenuLink\n href={link.href}\n active={link.active}\n class=\"items-start gap-3 p-3\"\n >\n {link.icon && (\n <Icon\n name={link.icon}\n class=\"text-muted-foreground mt-0.5\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{link.label}</span>\n {link.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {link.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n ) : (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class={navigationMenuTriggerStyle()}\n >\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n )}\n </NavigationMenuList>\n </NavigationMenu>\n </HeaderContainer>\n</Header>\n\n<script>\n // Close a menu that the header hides at its fold breakpoint, so it does not\n // stay open, or keep the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
21
+ "content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Image } from \"astro:assets\"\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Header, HeaderContainer, HeaderGroup } from \"@/components/ui/header\"\nimport { Icon } from \"@/components/ui/icon\"\nimport { Logo, LogoImage, LogoText } from \"@/components/ui/logo\"\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerStyle,\n} from \"@/components/ui/navigation-menu\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from \"@/components/ui/sheet\"\n\ntype Props = HTMLAttributes<\"header\"> & {\n fold?: \"lg\" | \"xl\"\n logo: {\n label: string\n href: string\n src?: ImageMetadata\n srcLight?: ImageMetadata\n srcDark?: ImageMetadata\n }\n navigation: {\n label: string\n href: string\n description?: string\n active?: boolean\n image?: {\n src: ImageMetadata\n }\n links?: {\n label: string\n href: string\n description?: string\n icon?: string\n active?: boolean\n }[]\n }[]\n buttons: {\n label: string\n href: string\n icon?: string\n target?: \"_self\" | \"_blank\"\n }[]\n navigationLabel: string\n menu: {\n label: string\n title: string\n description: string\n closeLabel: string\n }\n}\n\nconst {\n fold = \"lg\",\n class: className,\n logo,\n navigation,\n buttons,\n navigationLabel,\n menu,\n ...props\n} = Astro.props\n\nconst desktopClass = fold === \"xl\" ? \"xl:flex\" : \"lg:flex\"\nconst mobileClass = fold === \"xl\" ? \"xl:hidden\" : \"lg:hidden\"\nconst dividerClass = fold === \"xl\" ? \"xl:block\" : \"lg:block\"\n---\n\n<Header\n class={cn(\"flex-col items-stretch gap-0 border-b py-0\", className)}\n {...props}\n>\n <HeaderContainer class=\"min-h-14 justify-between\">\n <HeaderGroup>\n <Logo href={logo.href}>\n <LogoImage\n src={logo.src}\n srcLight={logo.srcLight}\n srcDark={logo.srcDark}\n alt=\"\"\n />\n <LogoText>{logo.label}</LogoText>\n </Logo>\n </HeaderGroup>\n <HeaderGroup class={cn(\"ml-auto hidden justify-end\", desktopClass)}>\n {buttons.map(({ label, href, icon, target }, index) => (\n <Button\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n size=\"sm\"\n variant={index === buttons.length - 1 ? \"default\" : \"ghost\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </Button>\n ))}\n </HeaderGroup>\n <Sheet class={mobileClass}>\n <SheetTrigger\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"ml-auto\"\n aria-label={menu.label}\n >\n <Icon name=\"menu\" />\n </SheetTrigger>\n <SheetContent side=\"right\" showCloseButton={false} class=\"p-0\">\n <SheetHeader class=\"sr-only\">\n <SheetTitle>{menu.title}</SheetTitle>\n <SheetDescription>{menu.description}</SheetDescription>\n </SheetHeader>\n <div class=\"flex h-full flex-col gap-6 overflow-y-auto px-4 py-12\">\n <nav aria-label={menu.title} class=\"flex flex-col gap-4\">\n {navigation.map((item) => (\n <div class=\"grid gap-1\">\n <SheetClose\n as=\"a\"\n href={item.href}\n aria-current={item.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"justify-start font-medium\"\n >\n {item.label}\n </SheetClose>\n {item.links && item.links.length > 0 && (\n <div class=\"border-border ml-3 grid gap-1 border-l pl-3\">\n {item.links.map((link) => (\n <SheetClose\n as=\"a\"\n href={link.href}\n aria-current={link.active ? \"page\" : undefined}\n variant=\"ghost\"\n class=\"text-muted-foreground justify-start\"\n >\n {link.icon && <Icon name={link.icon} />}\n {link.label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n ))}\n </nav>\n {buttons.length > 0 && <Separator />}\n {buttons.length > 0 && (\n <div class=\"mt-auto flex flex-col gap-2\">\n {buttons.map(({ label, href, icon, target }, index) => (\n <SheetClose\n as=\"a\"\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noreferrer\" : undefined}\n variant={index === buttons.length - 1 ? \"default\" : \"outline\"}\n >\n {icon && <Icon name={icon} />}\n {label}\n </SheetClose>\n ))}\n </div>\n )}\n </div>\n <SheetClose\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n class=\"absolute top-4 right-4 bg-secondary\"\n >\n <XIcon />\n <span class=\"sr-only\">{menu.closeLabel}</span>\n </SheetClose>\n </SheetContent>\n </Sheet>\n </HeaderContainer>\n <Separator class={cn(\"hidden\", dividerClass)} />\n <HeaderContainer class={cn(\"hidden min-h-11\", desktopClass)}>\n <NavigationMenu\n aria-label={navigationLabel}\n class=\"max-w-none justify-start\"\n align=\"start\"\n >\n <NavigationMenuList class=\"justify-start\">\n {navigation.map((item, index) =>\n item.links?.length ? (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <div class=\"grid w-[min(52rem,calc(100vw-2rem))] gap-2 p-2 lg:grid-cols-[1fr_1.2fr]\">\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class=\"bg-muted/50 hover:bg-muted focus:bg-muted flex-col items-start gap-3 p-3\"\n >\n {item.image && (\n <Image\n src={item.image.src}\n alt=\"\"\n class=\"aspect-[16/9] w-full rounded-md object-cover\"\n widths={[320, 480, 640]}\n sizes=\"(min-width: 1024px) 22rem, 100vw\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{item.label}</span>\n {item.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {item.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n <div class=\"grid gap-1 lg:grid-cols-2\">\n {item.links.map((link) => (\n <NavigationMenuLink\n href={link.href}\n active={link.active}\n class=\"items-start gap-3 p-3\"\n >\n {link.icon && (\n <Icon\n name={link.icon}\n class=\"text-muted-foreground mt-0.5\"\n />\n )}\n <span class=\"grid gap-1\">\n <span class=\"font-medium\">{link.label}</span>\n {link.description && (\n <span class=\"text-muted-foreground text-sm leading-relaxed\">\n {link.description}\n </span>\n )}\n </span>\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n ) : (\n <NavigationMenuItem value={`nav-${index}`}>\n <NavigationMenuLink\n href={item.href}\n active={item.active}\n class={navigationMenuTriggerStyle()}\n >\n {item.label}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n )}\n </NavigationMenuList>\n </NavigationMenu>\n </HeaderContainer>\n</Header>\n",
22
22
  "type": "registry:block"
23
23
  }
24
24
  ],
@@ -13,7 +13,7 @@
13
13
  "files": [
14
14
  {
15
15
  "path": "src/components/ui/header/header.astro",
16
- "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"header\"> & VariantProps<typeof variants>\n\nconst variants = cva(\"py-3 relative z-50 flex w-full items-center gap-4\", {\n variants: {\n variant: {\n default: \"\",\n floating:\n \"my-2 rounded-none border bg-background shadow-sm mx-auto w-[calc(100%-2*var(--gutter,--spacing(4)))] max-w-[calc(var(--container,var(--container-7xl))-2*var(--gutter,--spacing(4)))] overflow-hidden\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n})\n\nconst {\n class: className,\n variant = \"default\",\n \"data-slot\": dataSlot = \"header\",\n ...props\n} = Astro.props\n---\n\n<header\n class={cn(variants({ variant }), className)}\n data-slot={dataSlot}\n data-variant={variant}\n {...props}\n>\n <slot />\n</header>\n",
16
+ "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"header\"> & VariantProps<typeof variants>\n\nconst variants = cva(\"py-3 relative z-50 flex w-full items-center gap-4\", {\n variants: {\n variant: {\n default: \"\",\n floating:\n \"my-2 rounded-none border bg-background shadow-sm mx-auto w-[calc(100%-2*var(--gutter,--spacing(4)))] max-w-[calc(var(--container,var(--container-7xl))-2*var(--gutter,--spacing(4)))] overflow-hidden\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n})\n\nconst {\n class: className,\n variant = \"default\",\n \"data-slot\": dataSlot = \"header\",\n ...props\n} = Astro.props\n---\n\n<header\n class={cn(variants({ variant }), className)}\n data-slot={dataSlot}\n data-variant={variant}\n {...props}\n>\n <slot />\n</header>\n\n<script>\n // Header blocks hide their sheet or navigation menu at a fold breakpoint, lg\n // or xl. Close the one that becomes hidden, so it does not stay open, or keep\n // the page from scrolling, while hidden.\n const hidden = (element: Element) => element.getClientRects().length === 0\n const close = () => {\n for (const sheet of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"dialog\"]'\n ))\n if (hidden(sheet))\n sheet.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: false } })\n )\n for (const menu of document.querySelectorAll(\n '[data-slot=\"header\"] [data-slot=\"navigation-menu\"]'\n ))\n if (hidden(menu))\n menu.dispatchEvent(\n new CustomEvent(\"navigation-menu:set\", { detail: { value: null } })\n )\n }\n for (const query of [\"(min-width: 64rem)\", \"(min-width: 80rem)\"])\n matchMedia(query).addEventListener(\"change\", close)\n</script>\n",
17
17
  "type": "registry:ui"
18
18
  },
19
19
  {
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "images",
4
+ "title": "Images",
5
+ "description": "Converts a site's source photos to WebP within 3840 pixels and updates their references; `--check` checks them.",
6
+ "dependencies": [
7
+ "sharp"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "scripts/images.ts",
12
+ "content": "// Keeps source photographs in src as WebP, quality 90, at most 3840 pixels on\n// the longest edge. It reads the real format of each file, not its extension.\n//\n// vp run images fix everything under src\n// vp run images <file> also convert this file, such as a PNG photo\n// node scripts/images.ts --check check src, part of check\n//\n// Fix mode converts JPEG content and PNG content saved as .jpg, .jpeg or .webp\n// to WebP, renames WebP content saved as .jpg without encoding it again,\n// resizes photos over the limit, and updates references in src. Real WebP\n// files within the limit stay as they are, so they are never compressed\n// twice. PNG, SVG and GIF files are graphics and keep their format.\n//\n// --check fails only on what a CloudCannon upload with the image options in\n// AGENTS.md cannot produce: JPEG content in a .jpg or .jpeg file, and photos\n// over the limit. Any other mismatch, such as a PNG saved as .webp by Safari\n// on an iPhone, which cannot encode WebP, is a warning, so an editor's upload\n// never fails a publish pull request.\nimport {\n existsSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\"\nimport { dirname, extname, join, relative, sep } from \"node:path\"\nimport sharp from \"sharp\"\n\nconst maxSize = 3840\nconst photoExtensions = [\".jpg\", \".jpeg\", \".webp\"]\nconst check = process.argv.includes(\"--check\")\n// Paths use forward slashes on every system, as references in src do.\nconst slash = (path: string) => path.split(sep).join(\"/\")\nconst extra = process.argv\n .slice(2)\n .filter((arg) => !arg.startsWith(\"--\"))\n .map((arg) => slash(relative(\".\", arg)))\nfor (const path of extra)\n if (!path.startsWith(\"src/\")) throw new Error(`${path} is not in src`)\n\nconst files = (dir: string): string[] =>\n readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {\n const path = slash(join(dir, entry.name))\n return entry.isDirectory() ? files(path) : [path]\n })\nconst sources = files(\"src\")\n\ntype Task = {\n path: string\n target: string\n problem: string\n fail: boolean\n encode: boolean\n}\n\nasync function inspect(path: string): Promise<Task | undefined> {\n const ext = extname(path).toLowerCase()\n if (!extra.includes(path) && !photoExtensions.includes(ext)) return\n const {\n format,\n width = 0,\n height = 0,\n pages = 1,\n } = await sharp(path)\n .metadata()\n .catch((error: unknown) => {\n throw new Error(`${path}: ${error}`, { cause: error })\n })\n if (pages > 1) return\n const oversized = Math.max(width, height) > maxSize\n const jpeg = format === \"jpeg\"\n const target = (ext ? path.slice(0, -ext.length) : path) + \".webp\"\n if (format === \"webp\" && !oversized)\n return ext === \".webp\"\n ? undefined\n : { path, target, problem: \"is WebP\", fail: false, encode: false }\n if (format !== \"webp\" && !jpeg && format !== \"png\") return\n const problem = oversized\n ? `is larger than ${maxSize} pixels`\n : `is ${jpeg ? \"JPEG\" : \"PNG\"}`\n const fail = oversized || (jpeg && [\".jpg\", \".jpeg\"].includes(ext))\n return { path, target, problem, fail, encode: true }\n}\n\nconst tasks: Task[] = []\nfor (const path of new Set([...sources, ...extra])) {\n const task = await inspect(path)\n if (task) tasks.push(task)\n}\n\nif (check) {\n for (const { path, problem, fail } of tasks)\n if (!fail) console.warn(`Warning: ${path} ${problem}; run pnpm images.`)\n const failures = tasks.filter((task) => task.fail)\n if (failures.length) {\n console.error(\n `Run pnpm images to convert:\\n${failures.map((task) => `${task.path} ${task.problem}`).join(\"\\n\")}`\n )\n process.exit(1)\n }\n process.exit(0)\n}\n\nconst targets = tasks.map((task) => task.target)\nfor (const { path, target } of tasks) {\n if (target === path) continue\n // /assets/<name> can mean src/assets or public/assets, so a WebP name that\n // public/assets already has would make a rewritten reference ambiguous.\n const taken = [\n target,\n path.startsWith(\"src/assets/\") ? `public/${target.slice(4)}` : \"\",\n ].find((file) => file && existsSync(file))\n if (taken || targets.indexOf(target) !== targets.lastIndexOf(target))\n throw new Error(`${path}: ${taken ?? target} already exists`)\n}\n\nconst escape = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n// Matches text in which any character but / may be URL-encoded, in either\n// case, as Markdown writes my photo.jpg as my%20photo.jpg.\nconst encodable = (text: string) =>\n [...text]\n .map((char) => {\n if (char === \"/\") return char\n const bytes = [...new TextEncoder().encode(char)]\n const hex = bytes.map((byte) => `%${byte.toString(16).padStart(2, \"0\")}`)\n return `(?:${escape(char)}|(?i:${hex.join(\"\")}))`\n })\n .join(\"\")\n// Write to a temporary file first, so a failed run never leaves half a file.\nconst write = (path: string, data: string | Buffer) => {\n const temp = `${path}.${process.pid}.tmp`\n try {\n writeFileSync(temp, data)\n renameSync(temp, path)\n } catch (error) {\n rmSync(temp, { force: true })\n throw error\n }\n}\nconst textFiles = sources.filter((file) =>\n /\\.(mdx?|ya?ml|json|astro|[jt]sx?|css)$/.test(file)\n)\nlet before = 0\nlet after = 0\nfor (const { path, target, encode } of tasks) {\n const size = readFileSync(path).length\n if (encode) {\n // rotate() applies the EXIF orientation; metadata is not copied.\n const image = await sharp(path)\n .rotate()\n .resize(maxSize, maxSize, { fit: \"inside\", withoutEnlargement: true })\n .webp({ quality: 90 })\n .toBuffer()\n write(target, image)\n } else write(target, readFileSync(path))\n const newSize = readFileSync(target).length\n before += size\n after += newSize\n console.log(`${path} -> ${target} (${size} -> ${newSize} bytes)`)\n if (target === path) continue\n\n // Point references such as ../../assets/photo.jpg, ./photo.jpg,\n // @/assets/photo.jpg, /src/assets/photo.jpg and, for uploads in src/assets,\n // /assets/photo.jpg at the WebP file, URL-encoded or not. A reference must\n // be a whole path, so photo.jpg does not match my-photo.jpg,\n // ../other/photo.jpg or photo.jpg.webp. Only the extension changes, so a\n // reference keeps its encoding.\n const ext = path.slice(target.length - \".webp\".length)\n const paths = [`@/${path.slice(4)}`, `/${path}`]\n if (path.startsWith(\"src/assets/\") && !existsSync(`public/${path.slice(4)}`))\n paths.push(`/${path.slice(4)}`)\n for (const file of textFiles) {\n const text = readFileSync(file, \"utf8\")\n const local = slash(relative(dirname(file), path))\n const updated = [local, ...paths].reduce((text, from) => {\n const stem = encodable(from.slice(0, from.length - ext.length))\n return text.replace(\n new RegExp(\n `(?<![\\\\w@~./-])(\\\\./)?${stem}${escape(ext)}(?![\\\\w%-]|\\\\.\\\\w)`,\n \"g\"\n ),\n (match) => match.slice(0, match.length - ext.length) + \".webp\"\n )\n }, text)\n if (updated !== text) write(file, updated)\n }\n // Delete the original last, so a failed update leaves it in place.\n rmSync(path)\n}\nif (tasks.length) console.log(`Total: ${before} -> ${after} bytes`)\n",
13
+ "type": "registry:file",
14
+ "target": "~/scripts/images.ts"
15
+ }
16
+ ],
17
+ "type": "registry:file"
18
+ }
@@ -29,7 +29,7 @@
29
29
  },
30
30
  {
31
31
  "path": "src/components/ui/marquee/marquee-toggle.astro",
32
- "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport PauseIcon from \"@lucide/astro/icons/pause\"\nimport PlayIcon from \"@lucide/astro/icons/play\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> &\n ButtonVariantProps & {\n playLabel: string\n pauseLabel: string\n }\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n playLabel,\n pauseLabel,\n \"data-slot\": dataSlot = \"marquee-toggle\",\n ...props\n} = Astro.props\n\n// The marquee shows and hides the toggle through its wrapper, so the button's\n// own hidden attribute, class and style stay the caller's.\n---\n\n<span data-marquee-control hidden class=\"contents\">\n <button\n type=\"button\"\n data-slot={dataSlot}\n data-marquee-toggle\n data-state=\"playing\"\n data-play-label={playLabel}\n data-pause-label={pauseLabel}\n data-variant={variant}\n data-size={size}\n class={cn(\n buttonVariants({ variant, size }),\n \"group/marquee-toggle\",\n className\n )}\n {...props}\n >\n <PauseIcon class=\"group-data-[state=paused]/marquee-toggle:hidden\" />\n <PlayIcon class=\"hidden group-data-[state=paused]/marquee-toggle:block\" />\n <span class=\"sr-only\" data-marquee-label>\n {pauseLabel}\n </span>\n </button>\n</span>\n",
32
+ "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport PauseIcon from \"@lucide/astro/icons/pause\"\nimport PlayIcon from \"@lucide/astro/icons/play\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button, type ButtonVariantProps } from \"@/components/ui/button\"\n\ntype Props = Omit<HTMLAttributes<\"button\">, \"type\"> &\n ButtonVariantProps & {\n playLabel: string\n pauseLabel: string\n }\n\nconst {\n class: className,\n variant = \"outline\",\n size = \"icon-sm\",\n playLabel,\n pauseLabel,\n \"data-slot\": dataSlot = \"marquee-toggle\",\n ...props\n} = Astro.props\n\n// The marquee shows and hides the toggle through its wrapper, so the button's\n// own hidden attribute, class and style stay the caller's.\n---\n\n<span data-marquee-control hidden class=\"contents\">\n <Button\n {...props}\n as=\"button\"\n type=\"button\"\n data-slot={dataSlot}\n data-marquee-toggle=\"\"\n data-state=\"playing\"\n data-play-label={playLabel}\n data-pause-label={pauseLabel}\n variant={variant}\n size={size}\n class={cn(\"group/marquee-toggle\", className)}\n >\n <PauseIcon class=\"group-data-[state=paused]/marquee-toggle:hidden\" />\n <PlayIcon class=\"hidden group-data-[state=paused]/marquee-toggle:block\" />\n <span class=\"sr-only\" data-marquee-label>\n {pauseLabel}\n </span>\n </Button>\n</span>\n",
33
33
  "type": "registry:ui"
34
34
  },
35
35
  {
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "og",
4
+ "title": "Open Graph images",
5
+ "description": "Draws each page's Open Graph image from the built site, checks them, and keeps them in Netlify's build cache.",
6
+ "dependencies": [
7
+ "sharp"
8
+ ],
9
+ "devDependencies": [
10
+ "parse5",
11
+ "playwright-core",
12
+ "sirv"
13
+ ],
14
+ "files": [
15
+ {
16
+ "path": "registry/site/scripts/og.ts",
17
+ "content": "// Draws the Open Graph images of a built site into its dist/og/ (1200 by\n// 630, JPEG): the hero of a page, without the site header, in a raised\n// browser window on the site's stone background that runs off the bottom.\n//\n// node scripts/og.ts [dist]\n//\n// It reads only the built HTML, after `astro build`. An og:image with\n// data-og-source names the page whose hero it shows, such as \"/contact/\" on\n// /meeting/. Each such page is drawn once and saved under a content hash\n// (/og/contact.<hash>.jpg); the og:image and twitter:image that carried the\n// old URL on each page that refers to it get the new one. Images without the\n// marker stay as they are. A second run over the same dist/ changes nothing\n// while the pixels stay the same.\n// The site's node_modules/.cache/fulldev-og holds the images and their\n// input fingerprints between builds. Netlify restores and saves that folder.\n//\n// The hero is the page's [data-og] element, or else the section around its\n// main h1. The folder is served on a free localhost port; only its own files\n// load. It draws with Playwright's Chromium headless shell, installed when\n// missing, or with the browser binary in CHROME.\nimport { execFileSync } from \"node:child_process\"\nimport { createHash } from \"node:crypto\"\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\"\nimport { createServer } from \"node:http\"\nimport type { AddressInfo } from \"node:net\"\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { parse, type DefaultTreeAdapterTypes } from \"parse5\"\nimport { chromium, type Browser } from \"playwright-core\"\nimport sirv from \"sirv\"\n\nimport { ogImage } from \"../src/lib/og.ts\"\n\n// The page is drawn 1680 pixels wide, so it shows at about 70% of its size.\nconst shot = { width: 1680, height: 882 }\nconst card = { width: 1200, height: 630 }\n\ntype Meta = { content: string; source?: string; start: number; end: number }\ntype Page = { file: string; html: string; metas: Meta[] }\nexport type Plan = {\n // The image each owner page draws, such as /contact/ to /og/contact.jpg.\n owners: Map<string, string>\n // The pages with a data-og-source and their og:image and twitter:image.\n pages: Page[]\n}\n\n// The file of a URL path in dir; a path that leaves dir fails.\nconst inside = (dir: string, path: string) => {\n const file = join(dir, decodeURIComponent(path))\n const rest = relative(dir, file)\n if (!rest || rest.split(sep)[0] === \"..\" || isAbsolute(rest))\n throw new Error(`${path} is outside ${dir}`)\n return file\n}\n\nconst hashed = (image: string, jpeg: Buffer) =>\n image.replace(\n /\\.jpg$/,\n `.${createHash(\"sha256\").update(jpeg).digest(\"hex\").slice(0, 12)}.jpg`\n )\n\n// Whether path is a hashed copy of image, from an earlier run.\nconst isHashed = (image: string, path: string) => {\n const stem = image.slice(0, -\".jpg\".length)\n return (\n path.startsWith(stem) &&\n /^\\.[0-9a-f]{12}\\.jpg$/.test(path.slice(stem.length))\n )\n}\n\n// The og:image and twitter:image tags, with their content attribute's place\n// in the source, so a rewrite touches only those characters.\nconst metasOf = (html: string) => {\n const metas: Meta[] = []\n const walk = (node: DefaultTreeAdapterTypes.ParentNode, source?: string) => {\n for (const child of node.childNodes) {\n if (!(\"tagName\" in child)) continue\n const attr = (name: string) =>\n child.attrs.find((each) => each.name === name)?.value\n const content = attr(\"content\")\n const owner = attr(\"data-og-source\") ?? source\n const place = child.sourceCodeLocation?.attrs?.content\n const name = attr(\"property\") ?? attr(\"name\")\n if (\n child.tagName === \"meta\" &&\n [\n \"og:image\",\n \"og:image:url\",\n \"og:image:secure_url\",\n \"twitter:image\",\n \"twitter:image:src\",\n ].includes(name ?? \"\") &&\n content !== undefined &&\n place\n )\n metas.push({\n content,\n source: owner,\n start: place.startOffset,\n end: place.endOffset,\n })\n walk(child, owner)\n }\n }\n walk(parse(html, { sourceCodeLocationInfo: true }))\n return metas\n}\n\n// Finds every generated image in dist and the page it is drawn from. It\n// fails on a source that is not a page of dist, or a marked og:image whose\n// URL is not that page's image.\nexport const plan = (dist: string): Plan => {\n const owners = new Map<string, string>()\n const pages: Page[] = []\n const names = readdirSync(dist, { recursive: true, encoding: \"utf8\" })\n for (const name of names.sort()) {\n if (!name.endsWith(\".html\")) continue\n const file = join(dist, name)\n const html = readFileSync(file, \"utf8\")\n if (!html.includes(\"data-og-source\")) continue\n const metas = metasOf(html)\n for (const { content, source } of metas) {\n if (source === undefined) continue\n if (\n !source.startsWith(\"/\") ||\n new URL(source, \"http://localhost\").pathname !== source\n )\n throw new Error(`${name}: data-og-source \"${source}\" is not a path`)\n const image = ogImage(source)\n const path = URL.canParse(content) ? new URL(content).pathname : \"\"\n if (path !== image && !isHashed(image, path))\n throw new Error(`${name}: ${content} is not the image of ${source}`)\n if (owners.has(source)) continue\n const files = source.endsWith(\"/\")\n ? [`${source}index.html`]\n : [`${source}.html`, `${source}/index.html`]\n if (!files.some((page) => existsSync(inside(dist, page))))\n throw new Error(`${name}: data-og-source ${source} is not in ${dist}`)\n owners.set(source, image)\n }\n pages.push({ file, html, metas })\n }\n return { owners, pages }\n}\n\n// Saves each owner's JPEG under its hash and points the pages at it. A file\n// that already holds the same bytes stays; another file with that name\n// fails.\nexport const apply = (\n dist: string,\n { owners, pages }: Plan,\n jpegs: Map<string, Buffer>\n) => {\n const images = new Map<string, string>()\n for (const [source, image] of owners) {\n const jpeg = jpegs.get(source)\n if (!jpeg) throw new Error(`No image drawn for ${source}`)\n const path = hashed(image, jpeg)\n const file = inside(dist, path)\n if (!existsSync(file)) {\n mkdirSync(dirname(file), { recursive: true })\n writeFileSync(file, jpeg)\n console.log(relative(process.cwd(), file))\n } else if (!readFileSync(file).equals(jpeg))\n throw new Error(`${file} already exists with other content`)\n images.set(source, path)\n }\n for (const { file, html, metas } of pages) {\n const urls = new Map<string, string>()\n for (const { content, source } of metas) {\n const path = source === undefined ? undefined : images.get(source)\n if (path) urls.set(content, new URL(path, content).href)\n }\n let next = html\n for (const { content, start, end } of metas.toReversed()) {\n const url = urls.get(content)\n if (!url || url === content) continue\n next = `${next.slice(0, start)}content=\"${url}\"${next.slice(end)}`\n }\n if (next !== html) writeFileSync(file, next)\n }\n}\n\n// Runs in the page: leaves only the hero, the [data-og] element or else the\n// section around the main h1, by hiding the site header and every other\n// branch of the page, then waits for its fonts and visible images.\nconst isolate = async () => {\n const hero =\n document.querySelector<HTMLElement>(\"[data-og]\") ??\n document.querySelector(\"main h1\")?.closest(\"section\")\n if (!hero) return false\n const style = document.createElement(\"style\")\n style.textContent =\n \"[data-slot=header] { display: none !important } html, body { overflow: hidden !important }\"\n document.head.append(style)\n let node: Element = hero\n while (node !== document.body && node.parentElement) {\n const parent: HTMLElement = node.parentElement\n for (const sibling of parent.children)\n if (sibling !== node)\n (sibling as HTMLElement).style.setProperty(\n \"display\",\n \"none\",\n \"important\"\n )\n node = parent\n }\n hero.style.setProperty(\"padding-top\", \"80px\", \"important\")\n hero.style.setProperty(\"min-height\", \"0\", \"important\")\n scrollTo(0, 0)\n // Measuring lays the page out, so the fonts it needs start loading.\n const images = [...hero.querySelectorAll(\"img\")].filter((img) => {\n img.loading = \"eager\"\n const box = img.getBoundingClientRect()\n return box.width > 0 && box.height > 0 && box.top < innerHeight\n })\n await document.fonts.ready\n // Hiding the scrollbar can change vw-based srcset selection on the next paint.\n await new Promise((done) =>\n requestAnimationFrame(() => requestAnimationFrame(done))\n )\n await Promise.all(\n images.map((img) =>\n img.decode().catch(() => {\n throw new Error(`${img.currentSrc || img.src} did not load`)\n })\n )\n )\n await new Promise((done) =>\n requestAnimationFrame(() => requestAnimationFrame(done))\n )\n const styleOf = getComputedStyle(document.documentElement)\n return {\n background: styleOf.getPropertyValue(\"--background\").trim() || \"white\",\n card: styleOf.getPropertyValue(\"--card\").trim() || \"white\",\n border: styleOf.getPropertyValue(\"--border\").trim() || \"currentColor\",\n shadow:\n styleOf.getPropertyValue(\"--fd-block-shadow\").trim() ||\n \"color-mix(in oklab, currentColor 20%, transparent)\",\n }\n}\n\n// The card: the screenshot in a browser window with three dots, 80px from\n// the sides and 64px from the top, on stone, with the floor shadow in the\n// block shadow's brown.\nconst frame = (src: string) => `<!doctype html><html><head><style>\n* { margin: 0; box-sizing: border-box; }\nhtml, body { width: ${card.width}px; height: ${card.height}px; overflow: hidden; background: var(--og-background); }\n.frame { position: absolute; left: 80px; right: 80px; top: 64px; height: 620px; overflow: hidden; border-radius: 18px;\n background: var(--og-background);\n box-shadow: 0 0 0 1px color-mix(in oklab, var(--og-shadow) 40%, transparent), 0 2px 4px -2px var(--og-shadow), 0 36px 70px -24px var(--og-shadow); }\n.bar { height: 30px; display: flex; gap: 7px; align-items: center; padding: 0 15px; background: var(--og-card); border-bottom: 1px solid var(--og-border); }\n.bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--og-border); }\niframe { display: block; border: 0; width: ${shot.width}px; height: ${shot.height}px; transform: scale(${1040 / shot.width}); transform-origin: top left; }\n</style></head><body><div class=\"frame\"><div class=\"bar\"><i></i><i></i><i></i></div><iframe title=\"Open Graph source\" src=\"${src}\"></iframe></div></body></html>`\n\ntype Drawing = { jpeg: Buffer; resources: string[] }\n\n// Draws each owner page of dist into its card.\nconst draw = async (dist: string, sources: string[]) => {\n if (!process.env.CHROME) {\n const cli = new URL(\n \"cli.js\",\n import.meta.resolve(\"playwright-core/package.json\")\n )\n execFileSync(\n process.execPath,\n [fileURLToPath(cli), \"install\", \"chromium\", \"--only-shell\"],\n { stdio: \"inherit\" }\n )\n }\n const files = sirv(dist)\n const server = createServer((req, res) =>\n files(req, res, () => {\n res.statusCode = 404\n res.end(\"Not found\")\n })\n )\n let browser: Browser | undefined\n try {\n await new Promise<void>((done, fail) =>\n server.once(\"error\", fail).listen(0, \"127.0.0.1\", done)\n )\n const origin = `http://127.0.0.1:${(server.address() as AddressInfo).port}`\n browser = await chromium.launch({ executablePath: process.env.CHROME })\n const activeBrowser = browser\n const drawings = new Map<string, Drawing>()\n let next = 0\n // Reuse one browser with bounded concurrency. The iframe keeps the\n // hero's 1680px layout while the final 1200px card needs only one shot.\n await Promise.all(\n Array.from({ length: Math.min(4, sources.length) }, async () => {\n while (next < sources.length) {\n const source = sources[next++]!\n // A fresh context records every request, even when another page\n // already loaded the same stylesheet, font or public image.\n const context = await activeBrowser.newContext({\n viewport: card,\n reducedMotion: \"reduce\",\n serviceWorkers: \"block\",\n })\n try {\n // Analytics and APIs never see the run or hold it up.\n await context.route(\n (url) => url.origin !== origin,\n (route) => route.abort()\n )\n const page = await context.newPage()\n const resources = new Set([source])\n page.on(\"request\", (request) => {\n const url = new URL(request.url())\n if (url.origin === origin) resources.add(url.pathname)\n })\n const url = new URL(source, origin).href\n await page.setContent(frame(url.replaceAll(\"&\", \"&amp;\")), {\n waitUntil: \"load\",\n })\n const inner = page.frames().find((frame) => frame.url() === url)\n const theme = await inner?.evaluate(isolate)\n if (!theme)\n throw new Error(\n `${source} has no [data-og] or section around its h1`\n )\n await page.evaluate((theme) => {\n for (const [name, color] of Object.entries(theme))\n document.documentElement.style.setProperty(\n `--og-${name}`,\n color\n )\n }, theme)\n drawings.set(source, {\n jpeg: await page.screenshot({\n type: \"jpeg\",\n quality: 85,\n animations: \"disabled\",\n }),\n resources: [...resources].sort(),\n })\n } finally {\n await context.close()\n }\n }\n })\n )\n return drawings\n } finally {\n await browser?.close().catch(() => {})\n server.closeAllConnections()\n await new Promise((done) => server.close(done))\n }\n}\n\nconst digest = (input: string | Buffer) =>\n createHash(\"sha256\").update(input).digest(\"hex\")\n\n// Metadata is rewritten after drawing. Normalize those URLs so a direct\n// rerun and a fresh Astro build have the same input fingerprint.\nconst normalize = (html: string) => {\n const metas = metasOf(html)\n const urls = new Map(\n metas\n .filter((meta) => meta.source !== undefined)\n .map((meta) => [\n meta.content,\n new URL(ogImage(meta.source!), meta.content).href,\n ])\n )\n for (const { content, start, end } of metas.toReversed()) {\n const url = urls.get(content)\n if (url) html = `${html.slice(0, start)}content=\"${url}\"${html.slice(end)}`\n }\n return html\n}\n\n// Cache entries describe the files Chromium actually requested, including\n// imported CSS, scripts, fonts and responsive images. Hash each file once\n// per run; a changed dependency invalidates only the pages that loaded it.\nexport const generate = async (\n dist: string,\n {\n cacheDir = join(dirname(dist), \"node_modules/.cache/fulldev-og\"),\n render = draw,\n }: { cacheDir?: string; render?: typeof draw } = {}\n) => {\n const work = plan(dist)\n const customBrowser = process.env.CHROME && statSync(process.env.CHROME)\n const fingerprint = digest(\n [\n readFileSync(fileURLToPath(import.meta.url), \"utf8\"),\n readFileSync(\n fileURLToPath(import.meta.resolve(\"playwright-core/package.json\")),\n \"utf8\"\n ),\n process.platform,\n process.arch,\n customBrowser\n ? `${process.env.CHROME}:${customBrowser.size}:${customBrowser.mtimeMs}`\n : \"managed-chromium\",\n ].join(\"\\n\")\n )\n const inputs = new Map<string, string>()\n const inputHash = (path: string) => {\n let hash = inputs.get(path)\n if (hash !== undefined) return hash\n // Match sirv's file and directory-index resolution, including routes\n // without a trailing slash.\n const stem = path.replace(/\\/$/, \"\")\n const file = [\"\", \".html\", \".htm\"]\n .flatMap((extension) => [\n ...(stem ? [`${stem}${extension}`] : []),\n `${stem}/index${extension}`,\n ])\n .map((name) => inside(dist, name))\n .find((name) => existsSync(name) && statSync(name).isFile())\n if (!file) hash = \"missing\"\n else\n hash = digest(\n file.endsWith(\".html\")\n ? normalize(readFileSync(file, \"utf8\"))\n : readFileSync(file)\n )\n inputs.set(path, hash)\n return hash\n }\n const jpegs = new Map<string, Buffer>()\n const missing: string[] = []\n mkdirSync(cacheDir, { recursive: true })\n for (const source of work.owners.keys()) {\n const entry = join(cacheDir, digest(source))\n try {\n const cached = JSON.parse(readFileSync(`${entry}.json`, \"utf8\")) as {\n renderer: string\n image: string\n resources: [string, string][]\n }\n if (\n cached.renderer !== fingerprint ||\n !cached.resources.some(([path]) => path === source) ||\n !cached.resources.every(([path, hash]) => inputHash(path) === hash)\n )\n throw new Error(\"Changed input\")\n const jpeg = readFileSync(`${entry}.jpg`)\n if (digest(jpeg) !== cached.image) throw new Error(\"Changed cache image\")\n jpegs.set(source, jpeg)\n } catch {\n missing.push(source)\n }\n }\n if (missing.length) {\n const drawings = await render(dist, missing)\n for (const source of missing) {\n const drawing = drawings.get(source)\n if (!drawing) throw new Error(`No image drawn for ${source}`)\n const entry = join(cacheDir, digest(source))\n writeFileSync(`${entry}.jpg`, drawing.jpeg)\n writeFileSync(\n `${entry}.json`,\n JSON.stringify({\n renderer: fingerprint,\n image: digest(drawing.jpeg),\n resources: [...new Set([source, ...drawing.resources])].map(\n (path) => [path, inputHash(path)]\n ),\n })\n )\n jpegs.set(source, drawing.jpeg)\n }\n }\n apply(dist, work, jpegs)\n const active = new Set([...work.owners.keys()].map(digest))\n for (const name of readdirSync(cacheDir))\n if (\n /^[a-f0-9]{64}\\.(json|jpg)$/.test(name) &&\n !active.has(name.slice(0, 64))\n )\n rmSync(join(cacheDir, name))\n const result = {\n rendered: missing.length,\n reused: work.owners.size - missing.length,\n }\n console.log(\n `Open Graph: ${result.rendered} rendered, ${result.reused} reused`\n )\n return result\n}\n\nif (import.meta.main) await generate(resolve(process.argv[2] ?? \"dist\"))\n",
18
+ "type": "registry:file",
19
+ "target": "~/scripts/og.ts"
20
+ },
21
+ {
22
+ "path": "registry/site/scripts/open-graph.test.ts",
23
+ "content": "// Verify the published routes, after Astro has normalized content filenames\n// and applied custom slugs. Reuse the build.\nimport assert from \"node:assert/strict\"\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport { test } from \"node:test\"\nimport sharp from \"sharp\"\n\ntest(\"indexed pages advertise usable share images without generating unindexed images\", async () => {\n const files = readdirSync(\"dist\", { recursive: true, encoding: \"utf8\" })\n const advertised = new Set<string>()\n for (const file of files.filter((file) => file.endsWith(\"index.html\"))) {\n const html = readFileSync(join(\"dist\", file), \"utf8\")\n const path = file.slice(0, -\"index.html\".length)\n const stem = `/og/${path ? path.slice(0, -1) : \"index\"}.`\n if (/<meta name=\"robots\" content=\"[^\"]*noindex/.test(html)) {\n assert.ok(\n !files.some((name) => `/${name}`.startsWith(stem)),\n `${file} has no fallback`\n )\n continue\n }\n const url = html.match(/property=\"og:image\" content=\"([^\"]+)\"/)?.[1]\n assert.ok(url, `${file} has an og:image`)\n const imagePath = decodeURI(new URL(url).pathname)\n // A custom image is published by Astro's image service. Only generated\n // fallback images belong in /og and must match the page's actual route.\n if (!html.includes(\"data-og-source=\")) continue\n assert.ok(imagePath.startsWith(stem), `${file} uses its fallback`)\n assert.match(imagePath.slice(stem.length), /^[a-f0-9]{12}\\.jpg$/, file)\n assert.ok(existsSync(join(\"dist\", imagePath)), file)\n advertised.add(imagePath)\n const metadata = await sharp(join(\"dist\", imagePath)).metadata()\n assert.equal(metadata.format, \"jpeg\", file)\n assert.equal(metadata.width, 1200, file)\n assert.equal(metadata.height, 630, file)\n }\n const generated = files\n .filter(\n (file) => file.startsWith(\"og/\") && /\\.[a-f0-9]{12}\\.jpg$/.test(file)\n )\n .map((file) => `/${file}`)\n assert.deepEqual(new Set(generated), advertised)\n})\n",
24
+ "type": "registry:file",
25
+ "target": "~/scripts/open-graph.test.ts"
26
+ },
27
+ {
28
+ "path": "registry/site/scripts/netlify-cache/index.js",
29
+ "content": "import { join } from \"node:path\"\n\nconst directory = (inputs) =>\n join(inputs.directory, \"node_modules/.cache/fulldev-og\")\n\nexport async function onPreBuild({ inputs, utils }) {\n const restored = await utils.cache.restore(directory(inputs))\n console.log(`Open Graph cache: ${restored ? \"restored\" : \"empty\"}`)\n}\n\nexport async function onBuild({ inputs, utils }) {\n await utils.cache.save(directory(inputs))\n}\n",
30
+ "type": "registry:file",
31
+ "target": "~/scripts/netlify-cache/index.js"
32
+ },
33
+ {
34
+ "path": "registry/site/scripts/netlify-cache/manifest.yml",
35
+ "content": "name: fulldev-og-cache\ninputs:\n - name: directory\n description: Site directory relative to the Netlify base directory.\n default: .\n",
36
+ "type": "registry:file",
37
+ "target": "~/scripts/netlify-cache/manifest.yml"
38
+ },
39
+ {
40
+ "path": "registry/site/src/lib/og.ts",
41
+ "content": "// The Open Graph image of a page path, generated from dist during the build (scripts/og.ts):\n// /og/index.jpg for the homepage, /og/<path>.jpg for the others.\nexport const ogImage = (path: string) =>\n path === \"/\" ? \"/og/index.jpg\" : `/og${path.replace(/\\/$/, \"\")}.jpg`\n",
42
+ "type": "registry:file",
43
+ "target": "~/src/lib/og.ts"
44
+ }
45
+ ],
46
+ "type": "registry:file"
47
+ }
@@ -16,7 +16,7 @@
16
16
  },
17
17
  {
18
18
  "path": "src/components/ui/price/price-value.astro",
19
- "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport {\n formatPriceDiscount,\n formatPriceValue,\n parseSinglePriceValue,\n type DiscountFormat,\n type PriceValue,\n} from \"./format-price-value\"\n\ntype Props = VariantProps<typeof variants> &\n HTMLAttributes<\"span\"> & {\n price?: PriceValue\n compareAt?: PriceValue\n currency?: string\n locale?: string\n variant?: \"default\" | \"sale\"\n discountFormat?: DiscountFormat\n showDiscount?: boolean\n discountLabel?: string\n }\n\nconst variants = cva(\"leading-tight\", {\n variants: {\n variant: {\n default: \"text-foreground\",\n sale: \"text-muted-foreground line-through\",\n },\n },\n})\n\nconst {\n class: className,\n price,\n compareAt,\n currency = \"USD\",\n locale = \"en-US\",\n variant = \"default\",\n discountFormat = \"percentage\",\n showDiscount = true,\n discountLabel = \"Save\",\n \"data-slot\": dataSlot = \"price-value\",\n ...props\n} = Astro.props\n\nconst formattedPrice = formatPriceValue(price, { currency, locale })\nconst currentValue = parseSinglePriceValue(price)\nconst compareAtValue = parseSinglePriceValue(compareAt)\n// A compare-at price only shows when it is higher than the price.\nconst formattedCompareAt =\n currentValue !== null &&\n compareAtValue !== null &&\n compareAtValue <= currentValue\n ? null\n : formatPriceValue(compareAt, { currency, locale })\nconst formattedDiscount =\n showDiscount && formattedCompareAt !== null\n ? formatPriceDiscount(price, compareAt, {\n currency,\n locale,\n format: discountFormat,\n })\n : null\n---\n\n{formattedPrice !== null && (\n <span\n class={cn(\"inline-flex flex-wrap items-center gap-x-2 gap-y-1\", className)}\n data-slot={dataSlot}\n data-variant={variant}\n {...props}\n >\n <span class={cn(variants({ variant }))}>{formattedPrice}</span>\n {formattedCompareAt !== null && (\n <del class=\"text-muted-foreground text-sm leading-tight line-through\">\n {formattedCompareAt}\n </del>\n )}\n {formattedDiscount !== null && (\n <span class=\"rounded-none px-0 py-0.5 text-[0.625rem] font-semibold tracking-widest text-muted-foreground uppercase\">\n {discountLabel} {formattedDiscount}\n </span>\n )}\n </span>\n)}\n",
19
+ "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport {\n formatPriceDiscount,\n formatPriceValue,\n parseSinglePriceValue,\n type DiscountFormat,\n type PriceValue,\n} from \"./format-price-value\"\n\ntype Props = VariantProps<typeof variants> &\n HTMLAttributes<\"span\"> & {\n price?: PriceValue\n compareAt?: PriceValue\n currency?: string\n locale?: string\n variant?: \"default\" | \"sale\"\n discountFormat?: DiscountFormat\n showDiscount?: boolean\n discountLabel?: string\n }\n\nconst variants = cva(\"leading-tight\", {\n variants: {\n variant: {\n default: \"text-foreground\",\n sale: \"text-muted-foreground line-through\",\n },\n },\n})\n\nconst {\n class: className,\n price,\n compareAt,\n currency = \"USD\",\n locale = \"en-US\",\n variant = \"default\",\n discountFormat = \"percentage\",\n showDiscount = true,\n discountLabel = \"Save\",\n \"data-slot\": dataSlot = \"price-value\",\n ...props\n} = Astro.props\n\nconst formattedPrice = formatPriceValue(price, { currency, locale })\nconst currentValue = parseSinglePriceValue(price)\nconst compareAtValue = parseSinglePriceValue(compareAt)\nconst formattedCompareAt =\n currentValue !== null &&\n compareAtValue !== null &&\n compareAtValue <= currentValue\n ? null\n : formatPriceValue(compareAt, { currency, locale })\nconst formattedDiscount =\n showDiscount && formattedCompareAt !== null\n ? formatPriceDiscount(price, compareAt, {\n currency,\n locale,\n format: discountFormat,\n })\n : null\n---\n\n{formattedPrice !== null && (\n <span\n class={cn(\"inline-flex flex-wrap items-center gap-x-2 gap-y-1\", className)}\n data-slot={dataSlot}\n data-variant={variant}\n {...props}\n >\n <span class={cn(variants({ variant }))}>{formattedPrice}</span>\n {formattedCompareAt !== null && (\n <del class=\"text-muted-foreground text-sm leading-tight line-through\">\n {formattedCompareAt}\n </del>\n )}\n {formattedDiscount !== null && (\n <span class=\"rounded-none px-0 py-0.5 text-[0.625rem] font-semibold tracking-widest text-muted-foreground uppercase\">\n {discountLabel} {formattedDiscount}\n </span>\n )}\n </span>\n)}\n",
20
20
  "type": "registry:ui"
21
21
  },
22
22
  {
@@ -4682,6 +4682,63 @@
4682
4682
  }
4683
4683
  }
4684
4684
  },
4685
+ {
4686
+ "name": "images",
4687
+ "type": "registry:file",
4688
+ "title": "Images",
4689
+ "description": "Converts a site's source photos to WebP within 3840 pixels and updates their references; `--check` checks them.",
4690
+ "dependencies": [
4691
+ "sharp"
4692
+ ],
4693
+ "files": [
4694
+ {
4695
+ "path": "scripts/images.ts",
4696
+ "type": "registry:file",
4697
+ "target": "~/scripts/images.ts"
4698
+ }
4699
+ ]
4700
+ },
4701
+ {
4702
+ "name": "og",
4703
+ "type": "registry:file",
4704
+ "title": "Open Graph images",
4705
+ "description": "Draws each page's Open Graph image from the built site, checks them, and keeps them in Netlify's build cache.",
4706
+ "dependencies": [
4707
+ "sharp"
4708
+ ],
4709
+ "devDependencies": [
4710
+ "parse5",
4711
+ "playwright-core",
4712
+ "sirv"
4713
+ ],
4714
+ "files": [
4715
+ {
4716
+ "path": "registry/site/scripts/og.ts",
4717
+ "type": "registry:file",
4718
+ "target": "~/scripts/og.ts"
4719
+ },
4720
+ {
4721
+ "path": "registry/site/scripts/open-graph.test.ts",
4722
+ "type": "registry:file",
4723
+ "target": "~/scripts/open-graph.test.ts"
4724
+ },
4725
+ {
4726
+ "path": "registry/site/scripts/netlify-cache/index.js",
4727
+ "type": "registry:file",
4728
+ "target": "~/scripts/netlify-cache/index.js"
4729
+ },
4730
+ {
4731
+ "path": "registry/site/scripts/netlify-cache/manifest.yml",
4732
+ "type": "registry:file",
4733
+ "target": "~/scripts/netlify-cache/manifest.yml"
4734
+ },
4735
+ {
4736
+ "path": "registry/site/src/lib/og.ts",
4737
+ "type": "registry:file",
4738
+ "target": "~/src/lib/og.ts"
4739
+ }
4740
+ ]
4741
+ },
4685
4742
  {
4686
4743
  "name": "base",
4687
4744
  "type": "registry:base",