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.
- package/CHANGELOG.md +12 -0
- package/liquid/.theme-check.yml +1 -1
- package/liquid/README.md +1 -1
- package/package.json +1 -1
- package/public/r/styles/base-luma/carousel.json +2 -2
- package/public/r/styles/base-luma/header-1.json +1 -1
- package/public/r/styles/base-luma/header-2.json +1 -1
- package/public/r/styles/base-luma/header-3.json +1 -1
- package/public/r/styles/base-luma/header-4.json +1 -1
- package/public/r/styles/base-luma/header-5.json +1 -1
- package/public/r/styles/base-luma/header.json +1 -1
- package/public/r/styles/base-luma/images.json +18 -0
- package/public/r/styles/base-luma/marquee.json +1 -1
- package/public/r/styles/base-luma/og.json +47 -0
- package/public/r/styles/base-luma/price.json +1 -1
- package/public/r/styles/base-luma/registry.json +57 -0
- package/public/r/styles/base-luma/select.json +1 -1
- package/public/r/styles/base-luma/sidebar.json +1 -1
- package/public/r/styles/base-luma/tabs.json +1 -1
- package/public/r/styles/base-luma/toast.json +1 -1
- package/public/r/styles/base-lyra/carousel.json +2 -2
- package/public/r/styles/base-lyra/header-1.json +1 -1
- package/public/r/styles/base-lyra/header-2.json +1 -1
- package/public/r/styles/base-lyra/header-3.json +1 -1
- package/public/r/styles/base-lyra/header-4.json +1 -1
- package/public/r/styles/base-lyra/header-5.json +1 -1
- package/public/r/styles/base-lyra/header.json +1 -1
- package/public/r/styles/base-lyra/images.json +18 -0
- package/public/r/styles/base-lyra/marquee.json +1 -1
- package/public/r/styles/base-lyra/og.json +47 -0
- package/public/r/styles/base-lyra/price.json +1 -1
- package/public/r/styles/base-lyra/registry.json +57 -0
- package/public/r/styles/base-lyra/select.json +1 -1
- package/public/r/styles/base-lyra/sidebar.json +1 -1
- package/public/r/styles/base-lyra/tabs.json +1 -1
- package/public/r/styles/base-lyra/toast.json +1 -1
- package/public/r/styles/base-maia/carousel.json +2 -2
- package/public/r/styles/base-maia/header-1.json +1 -1
- package/public/r/styles/base-maia/header-2.json +1 -1
- package/public/r/styles/base-maia/header-3.json +1 -1
- package/public/r/styles/base-maia/header-4.json +1 -1
- package/public/r/styles/base-maia/header-5.json +1 -1
- package/public/r/styles/base-maia/header.json +1 -1
- package/public/r/styles/base-maia/images.json +18 -0
- package/public/r/styles/base-maia/marquee.json +1 -1
- package/public/r/styles/base-maia/og.json +47 -0
- package/public/r/styles/base-maia/price.json +1 -1
- package/public/r/styles/base-maia/registry.json +57 -0
- package/public/r/styles/base-maia/select.json +1 -1
- package/public/r/styles/base-maia/sidebar.json +1 -1
- package/public/r/styles/base-maia/tabs.json +1 -1
- package/public/r/styles/base-maia/toast.json +1 -1
- package/public/r/styles/base-mira/carousel.json +2 -2
- package/public/r/styles/base-mira/header-1.json +1 -1
- package/public/r/styles/base-mira/header-2.json +1 -1
- package/public/r/styles/base-mira/header-3.json +1 -1
- package/public/r/styles/base-mira/header-4.json +1 -1
- package/public/r/styles/base-mira/header-5.json +1 -1
- package/public/r/styles/base-mira/header.json +1 -1
- package/public/r/styles/base-mira/images.json +18 -0
- package/public/r/styles/base-mira/marquee.json +1 -1
- package/public/r/styles/base-mira/og.json +47 -0
- package/public/r/styles/base-mira/price.json +1 -1
- package/public/r/styles/base-mira/registry.json +57 -0
- package/public/r/styles/base-mira/select.json +1 -1
- package/public/r/styles/base-mira/sidebar.json +1 -1
- package/public/r/styles/base-mira/tabs.json +1 -1
- package/public/r/styles/base-mira/toast.json +1 -1
- package/public/r/styles/base-nova/carousel.json +2 -2
- package/public/r/styles/base-nova/header-1.json +1 -1
- package/public/r/styles/base-nova/header-2.json +1 -1
- package/public/r/styles/base-nova/header-3.json +1 -1
- package/public/r/styles/base-nova/header-4.json +1 -1
- package/public/r/styles/base-nova/header-5.json +1 -1
- package/public/r/styles/base-nova/header.json +1 -1
- package/public/r/styles/base-nova/images.json +18 -0
- package/public/r/styles/base-nova/marquee.json +1 -1
- package/public/r/styles/base-nova/og.json +47 -0
- package/public/r/styles/base-nova/price.json +1 -1
- package/public/r/styles/base-nova/registry.json +57 -0
- package/public/r/styles/base-nova/select.json +1 -1
- package/public/r/styles/base-nova/sidebar.json +1 -1
- package/public/r/styles/base-nova/tabs.json +1 -1
- package/public/r/styles/base-nova/toast.json +1 -1
- package/public/r/styles/base-rhea/carousel.json +2 -2
- package/public/r/styles/base-rhea/header-1.json +1 -1
- package/public/r/styles/base-rhea/header-2.json +1 -1
- package/public/r/styles/base-rhea/header-3.json +1 -1
- package/public/r/styles/base-rhea/header-4.json +1 -1
- package/public/r/styles/base-rhea/header-5.json +1 -1
- package/public/r/styles/base-rhea/header.json +1 -1
- package/public/r/styles/base-rhea/images.json +18 -0
- package/public/r/styles/base-rhea/marquee.json +1 -1
- package/public/r/styles/base-rhea/og.json +47 -0
- package/public/r/styles/base-rhea/price.json +1 -1
- package/public/r/styles/base-rhea/registry.json +57 -0
- package/public/r/styles/base-rhea/select.json +1 -1
- package/public/r/styles/base-rhea/sidebar.json +1 -1
- package/public/r/styles/base-rhea/tabs.json +1 -1
- package/public/r/styles/base-rhea/toast.json +1 -1
- package/public/r/styles/base-sera/carousel.json +2 -2
- package/public/r/styles/base-sera/header-1.json +1 -1
- package/public/r/styles/base-sera/header-2.json +1 -1
- package/public/r/styles/base-sera/header-3.json +1 -1
- package/public/r/styles/base-sera/header-4.json +1 -1
- package/public/r/styles/base-sera/header-5.json +1 -1
- package/public/r/styles/base-sera/header.json +1 -1
- package/public/r/styles/base-sera/images.json +18 -0
- package/public/r/styles/base-sera/marquee.json +1 -1
- package/public/r/styles/base-sera/og.json +47 -0
- package/public/r/styles/base-sera/price.json +1 -1
- package/public/r/styles/base-sera/registry.json +57 -0
- package/public/r/styles/base-sera/select.json +1 -1
- package/public/r/styles/base-sera/sidebar.json +1 -1
- package/public/r/styles/base-sera/tabs.json +1 -1
- package/public/r/styles/base-sera/toast.json +1 -1
- package/public/r/styles/base-vega/carousel.json +2 -2
- package/public/r/styles/base-vega/header-1.json +1 -1
- package/public/r/styles/base-vega/header-2.json +1 -1
- package/public/r/styles/base-vega/header-3.json +1 -1
- package/public/r/styles/base-vega/header-4.json +1 -1
- package/public/r/styles/base-vega/header-5.json +1 -1
- package/public/r/styles/base-vega/header.json +1 -1
- package/public/r/styles/base-vega/images.json +18 -0
- package/public/r/styles/base-vega/marquee.json +1 -1
- package/public/r/styles/base-vega/og.json +47 -0
- package/public/r/styles/base-vega/price.json +1 -1
- package/public/r/styles/base-vega/registry.json +57 -0
- package/public/r/styles/base-vega/select.json +1 -1
- package/public/r/styles/base-vega/sidebar.json +1 -1
- package/public/r/styles/base-vega/tabs.json +1 -1
- package/public/r/styles/base-vega/toast.json +1 -1
|
@@ -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)\
|
|
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-full bg-muted px-2 py-0.5 text-xs font-medium text-foreground\">\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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/select/select.astro",
|
|
13
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport type { Align, Position, Side } from \"@data-slot/select\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n mountStrategy?: \"lazy\" | \"eager\"\n defaultValue?: string\n defaultOpen?: boolean\n placeholder?: string\n disabled?: boolean\n required?: boolean\n name?: string\n position?: Position\n side?: Side\n align?: Align\n sideOffset?: number\n alignOffset?: number\n avoidCollisions?: boolean\n collisionPadding?: number\n highlightItemOnHover?: boolean\n lockScroll?: boolean\n}\n\nconst {\n mountStrategy,\n class: className,\n defaultValue,\n defaultOpen,\n placeholder,\n disabled,\n required,\n name,\n position,\n side,\n align,\n sideOffset,\n alignOffset,\n avoidCollisions,\n collisionPadding,\n highlightItemOnHover,\n lockScroll,\n ...props\n} = Astro.props\n\n// Show the text Data Slot puts in the SelectValue when it starts: the label of\n// the default item, or the placeholder. Without it the trigger is empty, and\n// has no accessible name, until the script runs.\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 }))\
|
|
13
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport type { Align, Position, Side } from \"@data-slot/select\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n mountStrategy?: \"lazy\" | \"eager\"\n defaultValue?: string\n defaultOpen?: boolean\n placeholder?: string\n disabled?: boolean\n required?: boolean\n name?: string\n position?: Position\n side?: Side\n align?: Align\n sideOffset?: number\n alignOffset?: number\n avoidCollisions?: boolean\n collisionPadding?: number\n highlightItemOnHover?: boolean\n lockScroll?: boolean\n}\n\nconst {\n mountStrategy,\n class: className,\n defaultValue,\n defaultOpen,\n placeholder,\n disabled,\n required,\n name,\n position,\n side,\n align,\n sideOffset,\n alignOffset,\n avoidCollisions,\n collisionPadding,\n highlightItemOnHover,\n lockScroll,\n ...props\n} = Astro.props\n\n// Show the text Data Slot puts in the SelectValue when it starts: the label of\n// the default item, or the placeholder. Without it the trigger is empty, and\n// has no accessible name, until the script runs.\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)\nconst escape = (value: string) =>\n value.replace(/[&<>]/g, (char) => `&#${char.charCodeAt(0)};`)\n\ntype Item = { value?: string; label?: string; text: string; itemText?: string }\nconst items: Item[] = []\nlet trigger: number | undefined\nlet value: { start: number; end?: number; placeholder?: string } | undefined\nconst open: { name: string; item?: Item; itemText?: Item; value?: true }[] = []\nlet last = 0\nfor (const match of html.matchAll(tags)) {\n const { 0: whole, 2: close, 3: tag, 4: source = \"\", index } = match\n const text = html.slice(last, index)\n last = index + whole.length\n for (const element of open) {\n if (element.item) element.item.text += text\n if (element.itemText) element.itemText.itemText += text\n }\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) continue\n if (value && open.slice(at).some((element) => element.value)) {\n value.end ??= index\n }\n 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 const element: (typeof open)[number] = { name }\n if (slot === \"select-item\") {\n element.item = {\n value: get(\"data-value\"),\n label: get(\"data-label\")?.trim(),\n text: \"\",\n }\n items.push(element.item)\n }\n const owner = open.findLast((element) => element.item)?.item\n if (slot === \"select-item-text\" && owner && owner.itemText === undefined) {\n owner.itemText = \"\"\n element.itemText = owner\n }\n if (slot === \"select-trigger\" && get(\"data-placeholder\") === undefined) {\n trigger ??= index + whole.length - 1\n }\n if (slot === \"select-value\" && !value) {\n value = { start: last, placeholder: get(\"data-placeholder\") }\n element.value = true\n }\n if (!voidElements.has(name) && !source.trimEnd().endsWith(\"/\"))\n open.push(element)\n}\n\n// The label as Data Slot reads it: data-label, the SelectItemText, the item's\n// text, or else the value itself.\nconst item = items.find((item) => item.value === defaultValue)\nconst plain = (source = \"\") => escape(decode(source).trim())\nconst label =\n defaultValue === undefined\n ? escape(placeholder ?? value?.placeholder ?? \"\")\n : item?.label\n ? escape(item.label)\n : plain(item?.itemText) || plain(item?.text) || escape(defaultValue)\nconst edits: [start: number, end: number, text: string][] = []\nif (value?.end !== undefined && label) {\n if (!html.slice(value.start, value.end).trim()) {\n edits.push([value.start, value.end, label])\n }\n}\nif (defaultValue === undefined && trigger !== undefined) {\n edits.push([trigger, trigger, \" data-placeholder\"])\n}\nlet content = html\nfor (const [start, end, text] of edits.sort(([a], [b]) => b - a)) {\n content = content.slice(0, start) + text + content.slice(end)\n}\n---\n\n<div\n data-slot=\"select\"\n data-mount-strategy={mountStrategy}\n data-default-value={defaultValue}\n data-default-open={defaultOpen}\n data-placeholder={placeholder}\n data-disabled={disabled}\n data-required={required}\n data-name={name}\n data-position={position}\n data-side={side}\n data-align={align}\n data-side-offset={sideOffset}\n data-align-offset={alignOffset}\n data-avoid-collisions={avoidCollisions}\n data-collision-padding={collisionPadding}\n data-highlight-item-on-hover={highlightItemOnHover}\n data-lock-scroll={lockScroll}\n class={cn(\n \"group/select relative inline-flex w-fit flex-col gap-1.5\",\n className\n )}\n {...props}\n>\n <Fragment set:html={content} />\n</div>\n\n<script>\n import { create } from \"@data-slot/select\"\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",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
{
|
|
21
21
|
"path": "src/components/ui/sidebar/sidebar-provider.astro",
|
|
22
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst SIDEBAR_WIDTH = \"16rem\"\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\"\nconst SIDEBAR_WIDTH_ICON = \"3rem\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n defaultOpen?: boolean\n open?: boolean\n}\n\nconst {\n class: className,\n style,\n defaultOpen = true,\n open,\n ...props\n} = Astro.props\n\nconst resolvedStyle = [\n `--sidebar-width: ${SIDEBAR_WIDTH}`,\n `--sidebar-width-mobile: ${SIDEBAR_WIDTH_MOBILE}`,\n `--sidebar-width-icon: ${SIDEBAR_WIDTH_ICON}`,\n typeof style === \"string\" ? style : undefined,\n]\n .filter(Boolean)\n .join(\"; \")\n---\n\n<div\n data-slot=\"sidebar-wrapper\"\n data-default-open={defaultOpen ? \"true\" : \"false\"}\n data-open={open === undefined ? undefined : open ? \"true\" : \"false\"}\n style={resolvedStyle}\n class={cn(\n \"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\n className\n )}\n {...props}\n>\n <slot />\n <script is:inline>\n ;(() => {\n
|
|
22
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst SIDEBAR_WIDTH = \"16rem\"\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\"\nconst SIDEBAR_WIDTH_ICON = \"3rem\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n defaultOpen?: boolean\n open?: boolean\n}\n\nconst {\n class: className,\n style,\n defaultOpen = true,\n open,\n ...props\n} = Astro.props\n\nconst resolvedStyle = [\n `--sidebar-width: ${SIDEBAR_WIDTH}`,\n `--sidebar-width-mobile: ${SIDEBAR_WIDTH_MOBILE}`,\n `--sidebar-width-icon: ${SIDEBAR_WIDTH_ICON}`,\n typeof style === \"string\" ? style : undefined,\n]\n .filter(Boolean)\n .join(\"; \")\n---\n\n<div\n data-slot=\"sidebar-wrapper\"\n data-default-open={defaultOpen ? \"true\" : \"false\"}\n data-open={open === undefined ? undefined : open ? \"true\" : \"false\"}\n style={resolvedStyle}\n class={cn(\n \"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\n className\n )}\n {...props}\n>\n <slot />\n <script is:inline>\n ;(() => {\n const owned = (provider, selector) =>\n [...provider.querySelectorAll(selector)].filter(\n (element) =>\n element.closest(\"[data-slot='sidebar-wrapper']\") === provider\n )\n\n window.__fulldevSyncSidebarProvider ??= (provider, open) => {\n const state = open ? \"expanded\" : \"collapsed\"\n const [sidebar] = owned(\n provider,\n \"[data-slot='sidebar']:not([data-mobile='true'])\"\n )\n const collapsible = sidebar?.dataset.sidebarCollapsible ?? \"offcanvas\"\n\n provider.dataset.open = open ? \"true\" : \"false\"\n provider.dataset.state = state\n\n if (sidebar) {\n sidebar.dataset.state = collapsible === \"none\" ? \"expanded\" : state\n sidebar.dataset.collapsible =\n collapsible === \"none\" ? \"none\" : open ? \"\" : collapsible\n }\n\n owned(\n provider,\n \"[data-sidebar='trigger'], [data-sidebar='rail']\"\n ).forEach((control) => {\n control.setAttribute(\"aria-expanded\", String(open))\n })\n\n owned(provider, \"[data-slot='tooltip']\").forEach((tooltip) => {\n if (\n state !== \"collapsed\" &&\n tooltip.querySelector(\"[data-sidebar='menu-button']\")\n ) {\n tooltip.dispatchEvent(\n new CustomEvent(\"tooltip:set\", { detail: { open: false } })\n )\n }\n })\n }\n\n // A sidebar inside a page that has one, such as an example, keeps its\n // state out of the shared cookie.\n window.__fulldevInitSidebarProvider ??= (provider) => {\n const controlledOpen = provider.dataset.open\n const nested = provider.parentElement?.closest(\n \"[data-slot='sidebar-wrapper']\"\n )\n const cookieValue = nested\n ? undefined\n : document.cookie\n .split(\"; \")\n .find((entry) => entry.startsWith(\"sidebar_state=\"))\n ?.slice(\"sidebar_state=\".length)\n\n const isOpen =\n controlledOpen === \"true\" || controlledOpen === \"false\"\n ? controlledOpen === \"true\"\n : cookieValue === \"true\" || cookieValue === \"false\"\n ? cookieValue === \"true\"\n : provider.dataset.defaultOpen !== \"false\"\n\n provider.dataset.openMobile = \"false\"\n window.__fulldevSyncSidebarProvider(provider, isOpen)\n }\n\n const provider = document.currentScript?.closest(\n \"[data-slot='sidebar-wrapper']\"\n )\n if (provider instanceof HTMLElement)\n window.__fulldevInitSidebarProvider(provider)\n })()\n </script>\n</div>\n\n<script is:inline>\n ;(() => {\n const scrollTop = Number(sessionStorage.getItem(\"sidebar_scroll\") || 0)\n\n document.querySelectorAll(\"[data-sidebar='content']\").forEach((content) => {\n if (\n content.closest(\n \"[data-slot='sidebar-wrapper'] [data-slot='sidebar-wrapper']\"\n )\n )\n return\n content.scrollTop = scrollTop\n })\n })()\n</script>\n\n<script is:inline>\n ;(() => {\n if (window.__fulldevSidebarInitialized) return\n window.__fulldevSidebarInitialized = true\n\n // Markup added without running its inline script, such as a swapped\n // preview, initializes here.\n document.addEventListener(\"astro:page-load\", () => {\n document\n .querySelectorAll(\"[data-slot='sidebar-wrapper']:not([data-state])\")\n .forEach((provider) => window.__fulldevInitSidebarProvider?.(provider))\n })\n\n const SIDEBAR_COOKIE_NAME = \"sidebar_state\"\n const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\n\n const toggleSidebar = (provider) => {\n if (!window.matchMedia(\"(min-width: 768px)\").matches) {\n const openMobile = provider.dataset.openMobile !== \"true\"\n provider.dataset.openMobile = openMobile ? \"true\" : \"false\"\n provider\n .querySelector(\"[data-sidebar='sheet']\")\n ?.dispatchEvent(\n new CustomEvent(\"dialog:set\", { detail: { open: openMobile } })\n )\n return\n }\n\n const open = provider.dataset.open === \"false\"\n if (!provider.parentElement?.closest(\"[data-slot='sidebar-wrapper']\"))\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n window.__fulldevSyncSidebarProvider?.(provider, open)\n }\n\n document.addEventListener(\"dialog:change\", (event) => {\n const root = event.target\n if (!(root instanceof HTMLElement) || root.dataset.sidebar !== \"sheet\")\n return\n const provider = root.closest(\"[data-slot='sidebar-wrapper']\")\n if (provider)\n provider.dataset.openMobile = String(Boolean(event.detail?.open))\n })\n\n document.addEventListener(\"tooltip:change\", (event) => {\n if (!event.detail?.open) return\n const root = event.target\n if (!(root instanceof HTMLElement)) return\n if (!root.querySelector(\"[data-sidebar='menu-button']\")) return\n const provider = root.closest(\"[data-slot='sidebar-wrapper']\")\n const sidebar = root.closest(\"[data-slot='sidebar']\")\n if (\n provider?.dataset.state !== \"collapsed\" ||\n sidebar?.dataset.collapsible !== \"icon\" ||\n !window.matchMedia(\"(min-width: 768px)\").matches\n ) {\n root.dispatchEvent(\n new CustomEvent(\"tooltip:set\", { detail: { open: false } })\n )\n }\n })\n\n document.addEventListener(\"click\", (event) => {\n const control = event.target?.closest?.(\n \"[data-sidebar='trigger'], [data-sidebar='rail']\"\n )\n if (!control || control.matches(\":disabled, [aria-disabled='true']\")) {\n return\n }\n\n const provider = control.closest(\"[data-slot='sidebar-wrapper']\")\n if (!provider) return\n\n toggleSidebar(provider)\n })\n\n document.addEventListener(\"keydown\", (event) => {\n if (event.key.toLowerCase() !== \"b\") return\n if (!(event.metaKey || event.ctrlKey) || event.shiftKey || event.altKey) {\n return\n }\n if (event.defaultPrevented) return\n\n const target = event.target\n const isTyping =\n target instanceof HTMLElement &&\n (target.isContentEditable ||\n target.matches(\"input, textarea, select, [role='textbox']\"))\n if (isTyping) return\n\n const provider = document.querySelector(\"[data-slot='sidebar-wrapper']\")\n if (!(provider instanceof HTMLElement)) return\n\n event.preventDefault()\n toggleSidebar(provider)\n })\n\n document.addEventListener(\n \"scroll\",\n (event) => {\n if (\n event.target?.dataset?.sidebar === \"content\" &&\n !event.target.closest(\n \"[data-slot='sidebar-wrapper'] [data-slot='sidebar-wrapper']\"\n )\n ) {\n sessionStorage.setItem(\"sidebar_scroll\", event.target.scrollTop)\n }\n },\n true\n )\n })()\n</script>\n",
|
|
23
23
|
"type": "registry:ui"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
@@ -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 }))\
|
|
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 {
|
|
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
|
{
|