Skip to content

Commit

Permalink
feat: Carousel (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Jan 13, 2024
1 parent d48d69f commit 87fc4f5
Show file tree
Hide file tree
Showing 89 changed files with 1,480 additions and 130 deletions.
84 changes: 84 additions & 0 deletions apps/www/__registry__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,48 @@ export const Index = {
component: () => import("../src/lib/registry/default/example/card-with-form.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/card-with-form.svelte"],
},
"carousel-api": {
name: "carousel-api",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-api.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-api.svelte"],
},
"carousel-demo": {
name: "carousel-demo",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-demo.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-demo.svelte"],
},
"carousel-orientation": {
name: "carousel-orientation",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-orientation.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-orientation.svelte"],
},
"carousel-plugin": {
name: "carousel-plugin",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-plugin.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-plugin.svelte"],
},
"carousel-size": {
name: "carousel-size",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-size.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-size.svelte"],
},
"carousel-spacing": {
name: "carousel-spacing",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/default/example/carousel-spacing.svelte").then((m) => m.default),
files: ["../src/lib/registry/default/example/carousel-spacing.svelte"],
},
"checkbox-demo": {
name: "checkbox-demo",
type: "components:example",
Expand Down Expand Up @@ -928,6 +970,48 @@ export const Index = {
component: () => import("../src/lib/registry/new-york/example/card-with-form.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/card-with-form.svelte"],
},
"carousel-api": {
name: "carousel-api",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-api.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-api.svelte"],
},
"carousel-demo": {
name: "carousel-demo",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-demo.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-demo.svelte"],
},
"carousel-orientation": {
name: "carousel-orientation",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-orientation.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-orientation.svelte"],
},
"carousel-plugin": {
name: "carousel-plugin",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-plugin.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-plugin.svelte"],
},
"carousel-size": {
name: "carousel-size",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-size.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-size.svelte"],
},
"carousel-spacing": {
name: "carousel-spacing",
type: "components:example",
registryDependencies: ["index.js"],
component: () => import("../src/lib/registry/new-york/example/carousel-spacing.svelte").then((m) => m.default),
files: ["../src/lib/registry/new-york/example/carousel-spacing.svelte"],
},
"checkbox-demo": {
name: "checkbox-demo",
type: "components:example",
Expand Down
2 changes: 2 additions & 0 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"autoprefixer": "^10.4.16",
"embla-carousel-svelte": "8.0.0-rc19",
"escape-html": "^1.0.3",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.9.0",
Expand Down Expand Up @@ -78,6 +79,7 @@
"clsx": "^2.1.0",
"cmdk-sv": "^0.0.12",
"d3-scale": "^4.0.2",
"embla-carousel-autoplay": "8.0.0-rc19",
"esm-env": "^1.0.0",
"formsnap": "^0.4.2",
"lucide-svelte": "^0.292.0",
Expand Down
35 changes: 35 additions & 0 deletions apps/www/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions apps/www/scripts/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const DEPENDENCIES = new Map<string, string[]>([
["formsnap", ["zod", "sveltekit-superforms"]],
["cmdk-sv", ["bits-ui"]],
["svelte-sonner", ["mode-watcher"]],
["vaul-svelte", []]
["vaul-svelte", []],
["embla-carousel-svelte", []]
]);
// these are required dependencies for particular components
// where the dependencies are not specified in the import declarations of the component file
Expand Down Expand Up @@ -63,7 +64,7 @@ async function crawlExample(rootPath: string) {
const exampleRegistry: Registry = [];

for (const dirent of dir) {
if (dirent.name === "index.ts") continue;
if (!dirent.name.endsWith(".svelte")) continue;

if (dirent.isFile() && dirent.name.endsWith(".svelte")) {
const [name] = dirent.name.split(".svelte");
Expand Down Expand Up @@ -113,7 +114,7 @@ async function buildUIRegistry(componentPath: string, componentName: string) {
files.push(file_path);

// only grab deps from the svelte files
if (dirent.name === "index.ts") continue;
if (!dirent.name.endsWith(".svelte")) continue;
const deps = await getDependencies(join(componentPath, dirent.name));

deps.dependencies.forEach((dep) => dependencies.add(dep));
Expand Down
10 changes: 10 additions & 0 deletions apps/www/src/content/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ description: Latest updates and announcements.
import { Steps, Callout, ComponentPreview } from '$components/docs'
</script>

## January 2024 - Part 2

We've added a new component to the project, [Carousel](/docs/components/carousel).

<ComponentPreview name="carousel-demo">

<div />

</ComponentPreview>

## January 2024

We've added three new components to the project, [Drawer](/docs/components/drawer), [Sonner](/docs/components/sonner), & [Pagination](/docs/components/pagination).
Expand Down
Loading

1 comment on commit 87fc4f5

@vercel
Copy link

@vercel vercel bot commented on 87fc4f5 Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.