motionrail 0.2.0 → 0.3.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/dist/disclose-version-Duk-5pp6.js +1 -0
- package/dist/extensions/dots/style.css +1 -1
- package/dist/extensions/dots.js +1 -1
- package/dist/extensions/dots.umd.cjs +1 -1
- package/dist/svelte.d.ts +12 -0
- package/dist/svelte.js +35 -35
- package/dist/svelte5.d.ts +12 -0
- package/dist/svelte5.js +32 -31
- package/dist/vue.d.ts +13 -0
- package/package.json +8 -6
- package/dist/client-pmAKFFi-.js +0 -1755
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.motionrail-dots{z-index:10;scrollbar-width:none;-ms-overflow-style:none;background:#0000004d;border-radius:24px;gap:8px;width:fit-content;max-width:calc(100% - 32px);margin:16px auto 0;padding:8px 12px;display:flex;position:relative;overflow-x:auto;-webkit-mask-image:linear-gradient(90deg,#0000 0,#000 12px calc(100% - 12px),#0000 100%);mask-image:linear-gradient(90deg,#0000 0,#000 12px calc(100% - 12px),#0000 100%)}.motionrail-dots::-webkit-scrollbar{display:none}.motionrail-dot{
|
|
1
|
+
.motionrail-dots{--dot-size:34px;--dot-font-size:12px;z-index:10;scrollbar-width:none;-ms-overflow-style:none;background:#0000004d;border-radius:24px;gap:8px;width:fit-content;max-width:calc(100% - 32px);margin:16px auto 0;padding:8px 12px;display:flex;position:relative;overflow-x:auto;-webkit-mask-image:linear-gradient(90deg,#0000 0,#000 12px calc(100% - 12px),#0000 100%);mask-image:linear-gradient(90deg,#0000 0,#000 12px calc(100% - 12px),#0000 100%)}.motionrail-dots::-webkit-scrollbar{display:none}.motionrail-dot{min-width:var(--dot-size);min-height:var(--dot-size);width:var(--dot-size);height:var(--dot-size);color:#fff;cursor:pointer;font-size:var(--dot-font-size);background:#ffffff4d;border:2px solid #ffffff80;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;transition:all .3s;display:flex}.motionrail-dot:hover{background:#ffffff80;border-color:#fffc;scale:1.1}.motionrail-dot:active{scale:.95}.motionrail-dot-active{color:#000;background:#ffffffe6;border-color:#fff}.motionrail-dot-active:hover{background:#fff}
|
package/dist/extensions/dots.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../motionrail-DsLqZe8W.js";
|
|
2
2
|
function Dots(e) {
|
|
3
|
-
let t = document.createElement("div"), n = [], { showIndex: r = !1, dotSize: i =
|
|
3
|
+
let t = document.createElement("div"), n = [], { showIndex: r = !1, dotSize: i = 34, fontSize: a = 12, log: o = !1 } = e || {};
|
|
4
4
|
return {
|
|
5
5
|
name: "DotsExtension",
|
|
6
6
|
onInit(e, o) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MotionRailDots={}))})(this,function(e){var t=document.createElement(`style`);t.textContent=`[data-motionrail-scrollable]::-webkit-scrollbar{display:none}[data-motionrail]{position:relative}[data-motionrail] [data-motionrail-scrollable]{anchor-name:--motionrail-scrollable;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none;cursor:grab;position:relative;overflow:scroll hidden;container-type:inline-size}[data-motionrail] [data-motionrail-scrollable]:active{cursor:grabbing}[data-motionrail] [data-motionrail-scrollable] [data-motionrail-grid]{grid-auto-flow:column;height:100%;display:grid}[data-motionrail] [data-motionrail-scrollable] [data-motionrail-grid]>*{pointer-events:none;scroll-snap-align:start}
|
|
2
|
-
/*$vite$:1*/`,document.head.appendChild(t);function n(e){let t=document.createElement(`div`),n=[],{showIndex:r=!1,dotSize:i=
|
|
2
|
+
/*$vite$:1*/`,document.head.appendChild(t);function n(e){let t=document.createElement(`div`),n=[],{showIndex:r=!1,dotSize:i=34,fontSize:a=12,log:o=!1}=e||{};return{name:`DotsExtension`,onInit(e,o){let{totalItems:s}=o;if(s!==0){t.className=`motionrail-dots`,t.style.setProperty(`--dot-size`,`${i}px`),t.style.setProperty(`--dot-font-size`,`${a}px`);for(let i=0;i<s;i++){let a=document.createElement(`button`);a.className=`motionrail-dot`,a.setAttribute(`aria-label`,`Go to item ${i+1}`),r&&(a.textContent=(i+1).toString()),a.addEventListener(`click`,()=>{e.scrollToIndex(i)}),n.push(a),t.appendChild(a)}e.element.appendChild(t)}},onUpdate(e,r){let{visibleItemIndexes:i,totalItems:a}=r;if(!a){t.style.display=`none`;return}if(t.style.removeProperty(`display`),n.forEach((e,t)=>{i.includes(t)?e.classList.add(`motionrail-dot-active`):e.classList.remove(`motionrail-dot-active`)}),i.length>0){let e=n[i[0]];if(e){let n=t.offsetWidth,r=e.offsetLeft,i=e.offsetWidth,a=r-n/2+i/2;t.scrollTo({left:a,behavior:`smooth`})}}o&&console.log(`DotsExtension updated`,r)},onDestroy(e,r){t.remove(),n.length=0}}}e.Dots=n});
|
package/dist/svelte.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
2
|
+
import type { MotionRailOptions } from "./lib/types";
|
|
3
|
+
|
|
4
|
+
export interface SvelteProps {
|
|
5
|
+
options?: MotionRailOptions;
|
|
6
|
+
getInstance?: () => any;
|
|
7
|
+
getContainer?: () => HTMLElement | undefined;
|
|
8
|
+
children?: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const Svelte: Component<SvelteProps>;
|
|
12
|
+
export default Svelte;
|
package/dist/svelte.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
import { t as MotionRail } from "./motionrail-DsLqZe8W.js";
|
|
2
|
-
import
|
|
2
|
+
import "./disclose-version-Duk-5pp6.js";
|
|
3
|
+
import * as $ from "svelte/internal/client";
|
|
3
4
|
import { onDestroy, onMount } from "svelte";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let w = legacy_rest_props(legacy_rest_props(C, [
|
|
5
|
+
var root = $.from_html("<div><div data-motionrail-scrollable=\"\"><div data-motionrail-grid=\"\"><!></div></div></div>");
|
|
6
|
+
function Svelte(a, o) {
|
|
7
|
+
let s = $.legacy_rest_props(o, [
|
|
8
8
|
"children",
|
|
9
9
|
"$$slots",
|
|
10
10
|
"$$events",
|
|
11
11
|
"$$legacy"
|
|
12
|
-
]), [
|
|
12
|
+
]), c = $.legacy_rest_props(s, [
|
|
13
13
|
"getInstance",
|
|
14
14
|
"getContainer",
|
|
15
15
|
"options",
|
|
16
16
|
"instance",
|
|
17
17
|
"container"
|
|
18
18
|
]);
|
|
19
|
-
push(
|
|
20
|
-
let
|
|
21
|
-
function
|
|
22
|
-
return get(
|
|
19
|
+
$.push(o, !1);
|
|
20
|
+
let l = $.prop(o, "options", 24, () => ({})), u = $.prop(o, "instance", 12, null), d = $.prop(o, "container", 12, void 0), f = $.mutable_source(), p = $.mutable_source(null), m = null;
|
|
21
|
+
function h() {
|
|
22
|
+
return $.get(p);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return get(
|
|
24
|
+
function g() {
|
|
25
|
+
return $.get(f);
|
|
26
26
|
}
|
|
27
27
|
onMount(() => {
|
|
28
|
-
if (
|
|
29
|
-
set(
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
get(
|
|
33
|
-
}),
|
|
28
|
+
if (!$.get(f)) return;
|
|
29
|
+
$.set(p, new MotionRail($.get(f), l()));
|
|
30
|
+
let i = $.get(f).querySelector("[data-motionrail-grid]");
|
|
31
|
+
i && (m = new MutationObserver(() => {
|
|
32
|
+
$.get(p) && $.get(p).update();
|
|
33
|
+
}), m.observe(i, {
|
|
34
34
|
childList: !0,
|
|
35
35
|
subtree: !0
|
|
36
36
|
}));
|
|
37
37
|
}), onDestroy(() => {
|
|
38
|
-
|
|
39
|
-
}), legacy_pre_effect(() => (get(
|
|
40
|
-
get(
|
|
41
|
-
}), legacy_pre_effect(() => get(
|
|
42
|
-
|
|
43
|
-
}), legacy_pre_effect(() => get(
|
|
44
|
-
|
|
45
|
-
}), legacy_pre_effect_reset();
|
|
46
|
-
var
|
|
47
|
-
getInstance:
|
|
48
|
-
getContainer:
|
|
38
|
+
m &&= (m.disconnect(), null), $.get(p) && ($.get(p).destroy(), $.set(p, null));
|
|
39
|
+
}), $.legacy_pre_effect(() => ($.get(p), $.deep_read_state(l()), $.get(f), MotionRail), () => {
|
|
40
|
+
$.get(p) && l() && $.get(f) && ($.get(p).destroy(), $.set(p, new MotionRail($.get(f), l())));
|
|
41
|
+
}), $.legacy_pre_effect(() => $.get(p), () => {
|
|
42
|
+
u($.get(p));
|
|
43
|
+
}), $.legacy_pre_effect(() => $.get(f), () => {
|
|
44
|
+
d($.get(f));
|
|
45
|
+
}), $.legacy_pre_effect_reset();
|
|
46
|
+
var _ = {
|
|
47
|
+
getInstance: h,
|
|
48
|
+
getContainer: g
|
|
49
49
|
};
|
|
50
|
-
init();
|
|
51
|
-
var
|
|
52
|
-
attribute_effect(
|
|
50
|
+
$.init();
|
|
51
|
+
var v = root();
|
|
52
|
+
$.attribute_effect(v, () => ({
|
|
53
53
|
"data-motionrail": !0,
|
|
54
|
-
...
|
|
54
|
+
...c
|
|
55
55
|
}));
|
|
56
|
-
var
|
|
57
|
-
return slot(
|
|
56
|
+
var y = $.child(v), b = $.child(y), x = $.child(b);
|
|
57
|
+
return $.slot(x, o, "default", {}, null), $.reset(b), $.reset(y), $.reset(v), $.bind_this(v, (e) => $.set(f, e), () => $.get(f)), $.append(a, v), $.bind_prop(o, "getInstance", h), $.bind_prop(o, "getContainer", g), $.pop(_);
|
|
58
58
|
}
|
|
59
59
|
export { Svelte as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
2
|
+
import type { MotionRailOptions } from "./lib/types";
|
|
3
|
+
|
|
4
|
+
export interface Svelte5Props {
|
|
5
|
+
options?: MotionRailOptions;
|
|
6
|
+
getInstance?: () => any;
|
|
7
|
+
getContainer?: () => HTMLElement | undefined;
|
|
8
|
+
children?: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const Svelte5: Component<Svelte5Props>;
|
|
12
|
+
export default Svelte5;
|
package/dist/svelte5.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as MotionRail } from "./motionrail-DsLqZe8W.js";
|
|
2
|
-
import
|
|
2
|
+
import "./disclose-version-Duk-5pp6.js";
|
|
3
|
+
import * as $ from "svelte/internal/client";
|
|
3
4
|
import { onMount } from "svelte";
|
|
4
|
-
var root = from_html("<div><div data-motionrail-scrollable=\"\"><div data-motionrail-grid=\"\"><!></div></div></div>");
|
|
5
|
-
function Svelte5(
|
|
6
|
-
push(
|
|
7
|
-
let
|
|
5
|
+
var root = $.from_html("<div><div data-motionrail-scrollable=\"\"><div data-motionrail-grid=\"\"><!></div></div></div>");
|
|
6
|
+
function Svelte5(i, a) {
|
|
7
|
+
$.push(a, !0);
|
|
8
|
+
let o = $.prop(a, "options", 19, () => ({})), s = $.prop(a, "instance", 15), c = $.prop(a, "container", 15), l = $.rest_props(a, [
|
|
8
9
|
"$$slots",
|
|
9
10
|
"$$events",
|
|
10
11
|
"$$legacy",
|
|
@@ -12,42 +13,42 @@ function Svelte5(v, y) {
|
|
|
12
13
|
"children",
|
|
13
14
|
"instance",
|
|
14
15
|
"container"
|
|
15
|
-
]),
|
|
16
|
-
user_effect(() => {
|
|
17
|
-
|
|
18
|
-
}), user_effect(() => {
|
|
19
|
-
|
|
16
|
+
]), u = $.state(void 0), d = $.state(null), f = $.state(null);
|
|
17
|
+
$.user_effect(() => {
|
|
18
|
+
s($.get(d));
|
|
19
|
+
}), $.user_effect(() => {
|
|
20
|
+
c($.get(u));
|
|
20
21
|
});
|
|
21
|
-
function
|
|
22
|
-
return get(
|
|
22
|
+
function p() {
|
|
23
|
+
return $.get(d);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
return get(
|
|
25
|
+
function m() {
|
|
26
|
+
return $.get(u);
|
|
26
27
|
}
|
|
27
28
|
onMount(() => {
|
|
28
|
-
if (
|
|
29
|
-
set(
|
|
30
|
-
let
|
|
31
|
-
return
|
|
32
|
-
get(
|
|
33
|
-
}), !0), get(
|
|
29
|
+
if (!$.get(u)) return;
|
|
30
|
+
$.set(d, new MotionRail($.get(u), o()), !0);
|
|
31
|
+
let r = $.get(u).querySelector("[data-motionrail-grid]");
|
|
32
|
+
return r && ($.set(f, new MutationObserver(() => {
|
|
33
|
+
$.get(d) && $.get(d).update();
|
|
34
|
+
}), !0), $.get(f).observe(r, {
|
|
34
35
|
childList: !0,
|
|
35
36
|
subtree: !0
|
|
36
37
|
})), () => {
|
|
37
|
-
get(
|
|
38
|
+
$.get(f) && ($.get(f).disconnect(), $.set(f, null)), $.get(d) && ($.get(d).destroy(), $.set(d, null));
|
|
38
39
|
};
|
|
39
|
-
}), user_effect(() => {
|
|
40
|
-
get(
|
|
40
|
+
}), $.user_effect(() => {
|
|
41
|
+
$.get(d) && $.get(u) && ($.get(d).destroy(), $.set(d, new MotionRail($.get(u), o()), !0));
|
|
41
42
|
});
|
|
42
|
-
var
|
|
43
|
-
getInstance:
|
|
44
|
-
getContainer:
|
|
45
|
-
},
|
|
46
|
-
attribute_effect(
|
|
43
|
+
var h = {
|
|
44
|
+
getInstance: p,
|
|
45
|
+
getContainer: m
|
|
46
|
+
}, g = root();
|
|
47
|
+
$.attribute_effect(g, () => ({
|
|
47
48
|
"data-motionrail": !0,
|
|
48
|
-
...
|
|
49
|
+
...l
|
|
49
50
|
}));
|
|
50
|
-
var
|
|
51
|
-
return snippet(
|
|
51
|
+
var _ = $.child(g), v = $.child(_), y = $.child(v);
|
|
52
|
+
return $.snippet(y, () => a.children ?? $.noop), $.reset(v), $.reset(_), $.reset(g), $.bind_this(g, (e) => $.set(u, e), () => $.get(u)), $.append(i, g), $.pop(h);
|
|
52
53
|
}
|
|
53
54
|
export { Svelte5 as default };
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DefineComponent } from "vue";
|
|
2
|
+
import type { MotionRailOptions } from "./lib/types";
|
|
3
|
+
|
|
4
|
+
export interface VueProps {
|
|
5
|
+
options?: MotionRailOptions;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type VueEmits = {
|
|
9
|
+
mounted: (instance: any, container: HTMLElement) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare const Vue: DefineComponent<VueProps, {}, {}, {}, {}, {}, {}, VueEmits>;
|
|
13
|
+
export default Vue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motionrail",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A lightweight carousel library
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A lightweight carousel library for modern web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/motionrail.js",
|
|
7
7
|
"types": "./dist/motionrail.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"./extensions/thumbnails": {
|
|
27
27
|
"import": "./dist/extensions/thumbnails.js",
|
|
28
28
|
"require": "./dist/extensions/thumbnails.umd.cjs",
|
|
29
|
-
"types": "./dist/extensions/thumbnails.d.ts"
|
|
29
|
+
"types": "./dist/extensions/thumbnails/main.d.ts"
|
|
30
30
|
},
|
|
31
31
|
"./extensions/thumbnails/style.css": "./dist/extensions/thumbnails/style.css",
|
|
32
32
|
"./extensions/logger": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"dev": "vite",
|
|
68
|
-
"build": "npm run build:es && npm run build:umd",
|
|
68
|
+
"build": "npm run build:es && npm run build:umd && npm run copy:types",
|
|
69
69
|
"build:es": "vite build && tsc",
|
|
70
70
|
"build:umd": "npm run build:umd:main && npm run build:umd:arrows && npm run build:umd:dots && npm run build:umd:thumbnails && npm run build:umd:logger",
|
|
71
71
|
"build:umd:main": "BUILD_UMD=true ENTRY_PATH=src/motionrail.ts LIB_NAME=MotionRail FILE_NAME=motionrail.umd vite build",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"build:umd:dots": "BUILD_UMD=true ENTRY_PATH=src/extensions/dots/main.ts LIB_NAME=MotionRailDots FILE_NAME=extensions/dots.umd vite build",
|
|
74
74
|
"build:umd:thumbnails": "BUILD_UMD=true ENTRY_PATH=src/extensions/thumbnails/main.ts LIB_NAME=MotionRailThumbnails FILE_NAME=extensions/thumbnails.umd vite build",
|
|
75
75
|
"build:umd:logger": "BUILD_UMD=true ENTRY_PATH=src/extensions/logger.ts LIB_NAME=MotionRailLogger FILE_NAME=extensions/logger.umd vite build",
|
|
76
|
+
"copy:types": "cpr src/svelte.d.ts dist/svelte.d.ts -o && cpr src/svelte5.d.ts dist/svelte5.d.ts -o && cpr src/vue.d.ts dist/vue.d.ts -o",
|
|
76
77
|
"preview": "vite preview",
|
|
77
78
|
"prepare": "husky"
|
|
78
79
|
},
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"@types/node": "^25.0.8",
|
|
87
88
|
"@types/react": "^19.2.8",
|
|
88
89
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
90
|
+
"cpr": "^3.0.1",
|
|
89
91
|
"husky": "^9.1.7",
|
|
90
92
|
"lint-staged": "^16.2.7",
|
|
91
93
|
"prettier": "^3.7.4",
|
|
@@ -99,7 +101,7 @@
|
|
|
99
101
|
"peerDependencies": {
|
|
100
102
|
"react": "^19.2.3",
|
|
101
103
|
"solid-js": "^1.9.10",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
+
"svelte": "^5.19.2",
|
|
105
|
+
"vue": "^3.5.13"
|
|
104
106
|
}
|
|
105
107
|
}
|