Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Carousel #635

Merged
merged 6 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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