@haventmet/carousel 1.0.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/.mcp.json +8 -0
- package/CLAUDE.md +177 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/biome.json +174 -0
- package/package.json +33 -0
- package/packages/alpine/index.html +50 -0
- package/packages/alpine/package.json +70 -0
- package/packages/alpine/src/index.ts +46 -0
- package/packages/alpine/style.css +76 -0
- package/packages/alpine/tsconfig.json +28 -0
- package/packages/alpine/vite.config.ts +28 -0
- package/packages/core/README.md +69 -0
- package/packages/core/package.json +45 -0
- package/packages/core/src/carousel.ts +842 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/style.css +46 -0
- package/packages/core/vite.config.js +14 -0
- package/packages/react/.vite/deps/_metadata.json +25 -0
- package/packages/react/.vite/deps/chunk-7CQ73C3Q.js +1908 -0
- package/packages/react/.vite/deps/chunk-7CQ73C3Q.js.map +7 -0
- package/packages/react/.vite/deps/package.json +3 -0
- package/packages/react/.vite/deps/react-dom_client.js +21712 -0
- package/packages/react/.vite/deps/react-dom_client.js.map +7 -0
- package/packages/react/.vite/deps/react.js +4 -0
- package/packages/react/.vite/deps/react.js.map +7 -0
- package/packages/react/README.md +75 -0
- package/packages/react/index.html +12 -0
- package/packages/react/package.json +74 -0
- package/packages/react/src/App.tsx +38 -0
- package/packages/react/src/BlossomCarousel.tsx +77 -0
- package/packages/react/src/index.ts +2 -0
- package/packages/react/src/main.jsx +6 -0
- package/packages/react/src/style.css +50 -0
- package/packages/react/tsconfig.json +17 -0
- package/packages/react/vite.config.js +27 -0
- package/packages/svelte/README.md +58 -0
- package/packages/svelte/index.html +12 -0
- package/packages/svelte/package.json +71 -0
- package/packages/svelte/src/App.svelte +12 -0
- package/packages/svelte/src/BlossomCarousel.svelte +39 -0
- package/packages/svelte/src/BlossomCarousel.svelte.d.ts +8 -0
- package/packages/svelte/src/index.ts +2 -0
- package/packages/svelte/src/main.js +10 -0
- package/packages/svelte/src/style.css +52 -0
- package/packages/svelte/tsconfig.json +16 -0
- package/packages/svelte/vite.config.js +45 -0
- package/packages/vue/README.md +70 -0
- package/packages/vue/index.html +12 -0
- package/packages/vue/package.json +69 -0
- package/packages/vue/src/App.vue +82 -0
- package/packages/vue/src/BlossomCarousel.vue +52 -0
- package/packages/vue/src/index.ts +2 -0
- package/packages/vue/src/main.js +5 -0
- package/packages/vue/src/style.css +18 -0
- package/packages/vue/vite.config.js +25 -0
- package/packages/web/README.md +44 -0
- package/packages/web/index.html +29 -0
- package/packages/web/package.json +65 -0
- package/packages/web/src/index.ts +27 -0
- package/packages/web/src/style.css +53 -0
- package/packages/web/style.css +54 -0
- package/packages/web/tsconfig.json +18 -0
- package/packages/web/vite.config.ts +23 -0
- package/pnpm-workspace.yaml +8 -0
- package/public/cover.jpg +0 -0
- package/turbo.json +12 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import "@numbered/carousel/core/style.css";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
5
|
+
line-height: 1.5;
|
|
6
|
+
font-weight: 400;
|
|
7
|
+
|
|
8
|
+
color-scheme: light dark;
|
|
9
|
+
color: rgba(255, 255, 255, 0.87);
|
|
10
|
+
background-color: #242424;
|
|
11
|
+
|
|
12
|
+
font-synthesis: none;
|
|
13
|
+
text-rendering: optimizeLegibility;
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.wrapper {
|
|
23
|
+
width: 100%;
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.page {
|
|
28
|
+
height: 100vh;
|
|
29
|
+
width: 100%;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
overflow: clip;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.carousel {
|
|
39
|
+
display: flex;
|
|
40
|
+
gap: 1rem;
|
|
41
|
+
scroll-snap-type: x mandatory;
|
|
42
|
+
scroll-snap-stop: always;
|
|
43
|
+
width: 100%;
|
|
44
|
+
/* scroll-padding: 4rem; */
|
|
45
|
+
padding-inline: 50% !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.slide {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
width: 300px;
|
|
51
|
+
aspect-ratio: 3/4;
|
|
52
|
+
border-radius: 1rem;
|
|
53
|
+
background-color: #404040;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
/* scroll-snap-align: center; */
|
|
58
|
+
|
|
59
|
+
@media (max-width: 767px) {
|
|
60
|
+
scroll-snap-align: center;
|
|
61
|
+
background-color: #606060;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (min-width: 768px) {
|
|
65
|
+
&:nth-child(2n+1) {
|
|
66
|
+
scroll-snap-align: center;
|
|
67
|
+
background-color: #606060;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.controls {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
gap: 0.5rem;
|
|
76
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
|
|
22
|
+
/* Workspace paths */
|
|
23
|
+
"paths": {
|
|
24
|
+
"@numbered/carousel": ["../core/src/index.ts"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": ["src", "index.ts"]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
import dts from 'vite-plugin-dts'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [dts()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
'@numbered/carousel/style.css': path.resolve(__dirname, '../core/dist/carousel.css'),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
build: {
|
|
13
|
+
lib: {
|
|
14
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
15
|
+
name: 'BlossomCarousel',
|
|
16
|
+
fileName: 'blossom-carousel-alpine',
|
|
17
|
+
},
|
|
18
|
+
rollupOptions: {
|
|
19
|
+
external: ['alpinejs', '@numbered/carousel'],
|
|
20
|
+
output: {
|
|
21
|
+
globals: {
|
|
22
|
+
alpinejs: 'Alpine',
|
|
23
|
+
'@numbered/carousel': 'BlossomCarouselCore',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
})
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Blossom Core
|
|
2
|
+
|
|
3
|
+
A native-scroll-first carousel for the web.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add the blossom-carousel package to your project.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @numbered/carousel/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then, create a Blossom instance and initialize it.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { Blossom } from "@numbered/carousel/core";
|
|
17
|
+
import "@numbered/carousel/core/style.css";
|
|
18
|
+
|
|
19
|
+
const element = document.querySelector("#my-carousel-element");
|
|
20
|
+
// prepare the Blossom carousel
|
|
21
|
+
const blossom = Blossom(element);
|
|
22
|
+
// initialize whenever you want
|
|
23
|
+
blossom.init();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Lazy loading
|
|
27
|
+
|
|
28
|
+
Load Blossom only when needed.
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const hasMouse = window.matchMedia(
|
|
32
|
+
"(hover: hover) and (pointer: fine)"
|
|
33
|
+
).matches;
|
|
34
|
+
|
|
35
|
+
// We don't need Blossom's engine on touch devices
|
|
36
|
+
if (!hasMouse) return;
|
|
37
|
+
|
|
38
|
+
const { Blossom } = await import("@numbered/carousel/core");
|
|
39
|
+
|
|
40
|
+
const element = document.querySelector("#my-carousel-element");
|
|
41
|
+
const blossom = Blossom(element);
|
|
42
|
+
blossom.init();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Destroy
|
|
46
|
+
|
|
47
|
+
Destroy the Blossom instance when you no longer need it to free up resources.
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
blossom.destroy();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Get started in your favorite framework:
|
|
54
|
+
|
|
55
|
+
- [React](https://www.npmjs.com/package/@numbered/carousel/react)
|
|
56
|
+
- [Vue](https://www.npmjs.com/package/@numbered/carousel/vue)
|
|
57
|
+
- [Svelte](https://www.npmjs.com/package/@numbered/carousel/svelte)
|
|
58
|
+
- [Web Component](https://www.npmjs.com/package/@numbered/carousel/web)
|
|
59
|
+
|
|
60
|
+
## Examples
|
|
61
|
+
|
|
62
|
+
- [Simple](https://www.blossom-carousel.com/docs/examples#simple)
|
|
63
|
+
- [Variable widths](https://www.blossom-carousel.com/docs/examples#variable-widths)
|
|
64
|
+
- [CSS Grid](https://www.blossom-carousel.com/docs/examples#css-grid)
|
|
65
|
+
- [Multiple rows](https://www.blossom-carousel.com/docs/examples#multiple-rows)
|
|
66
|
+
- [Snapping](https://www.blossom-carousel.com/docs/examples#snapping)
|
|
67
|
+
- [Grouping](https://www.blossom-carousel.com/docs/examples#grouping)
|
|
68
|
+
- [Sticky](https://www.blossom-carousel.com/docs/examples#sticky)
|
|
69
|
+
- [Coverflow](https://www.blossom-carousel.com/docs/examples#cover-flow)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@haventmet/carousel",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"author": "Loris",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "A native-scroll-first carousel component for the web.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/loris-numbered/carousel"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/loris-numbered/carousel/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://www.blossom-carousel.com",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"main": "dist/carousel.umd.cjs",
|
|
20
|
+
"module": "dist/carousel.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/carousel.js",
|
|
26
|
+
"require": "./dist/carousel.umd.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./style.css": "./dist/carousel.css"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "vite",
|
|
35
|
+
"build": "vite build",
|
|
36
|
+
"preview": "vite preview"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"tsup": "^6.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"vite": "^6.3.3",
|
|
43
|
+
"vite-plugin-dts": "^4.5.3"
|
|
44
|
+
}
|
|
45
|
+
}
|