well-waterfall 1.2.10 → 1.2.12
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/util.d.ts +3 -1
- package/dist/{index.js → well-waterfall.es.js} +1185 -1170
- package/dist/well-waterfall.es.js.map +1 -0
- package/dist/well-waterfall.umd.js +7 -0
- package/dist/well-waterfall.umd.js.map +1 -0
- package/package.json +12 -9
- package/.eslintrc.js +0 -12
- package/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -64
- package/.prettierrc +0 -5
- package/dist/index.js.map +0 -1
- package/index.html +0 -28
- package/src/index.ts +0 -124
- package/src/lib/attributes.ts +0 -277
- package/src/lib/elements.ts +0 -14
- package/src/modules/accessibility.ts +0 -41
- package/src/modules/advanced.ts +0 -52
- package/src/modules/breakpoints.ts +0 -61
- package/src/modules/controller.ts +0 -22
- package/src/modules/effect.ts +0 -59
- package/src/modules/freeMode.ts +0 -25
- package/src/modules/general.ts +0 -35
- package/src/modules/hashhistory.ts +0 -27
- package/src/modules/keyboard.ts +0 -11
- package/src/modules/layout.ts +0 -39
- package/src/modules/lazyLoad.ts +0 -8
- package/src/modules/manipulation.ts +0 -68
- package/src/modules/mouse.ts +0 -27
- package/src/modules/navigation.ts +0 -29
- package/src/modules/observer.ts +0 -21
- package/src/modules/pagination.ts +0 -90
- package/src/modules/parallax.ts +0 -9
- package/src/modules/playback.ts +0 -68
- package/src/modules/scrollbar.ts +0 -34
- package/src/modules/slideCount.ts +0 -15
- package/src/modules/thumbs.ts +0 -33
- package/src/modules/touch.ts +0 -67
- package/src/modules/zoom.ts +0 -23
- package/src/types/env.d.ts +0 -1
- package/src/types/waterfall.d.ts +0 -12
- package/src/util.ts +0 -108
- package/tsconfig.json +0 -27
- package/vite.config.ts +0 -39
package/src/modules/touch.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ATTR_ALLOW_TOUCH_MOVE,
|
|
3
|
-
ATTR_EDGE_SWIPE_DETECTION,
|
|
4
|
-
ATTR_EDGE_SWIPE_THRESHOLD,
|
|
5
|
-
ATTR_FOCUSABLE_ELEMENTS,
|
|
6
|
-
ATTR_FOLLOW_FINGER,
|
|
7
|
-
ATTR_GRAB_CURSOR,
|
|
8
|
-
ATTR_LONG_SWIPES,
|
|
9
|
-
ATTR_LONG_SWIPES_MS,
|
|
10
|
-
ATTR_LONG_SWIPES_RATIO,
|
|
11
|
-
ATTR_NO_SWIPING,
|
|
12
|
-
ATTR_NO_SWIPING_CLASS,
|
|
13
|
-
ATTR_NO_SWIPING_SELECTOR,
|
|
14
|
-
ATTR_PREVENT_CLICKS,
|
|
15
|
-
ATTR_PREVENT_CLICKS_PROPAGATION,
|
|
16
|
-
ATTR_PREVENT_INTERACTION_ON_TRANSITION,
|
|
17
|
-
ATTR_RESISTANCE,
|
|
18
|
-
ATTR_RESISTANCE_RATIO,
|
|
19
|
-
ATTR_SHORT_SWIPES,
|
|
20
|
-
ATTR_SIMULATE_TOUCH,
|
|
21
|
-
ATTR_SLIDE_TO_CLICKED_SLIDE,
|
|
22
|
-
ATTR_THRESHOLD,
|
|
23
|
-
ATTR_TOUCH_ANGLE,
|
|
24
|
-
ATTR_TOUCH_EVENTS_TARGET,
|
|
25
|
-
ATTR_TOUCH_MOVE_STOP_PROPAGATION,
|
|
26
|
-
ATTR_TOUCH_RATIO,
|
|
27
|
-
ATTR_TOUCH_RELEASE_ON_EDGES,
|
|
28
|
-
ATTR_TOUCH_START_FORCE_PREVENT_DEFAULT,
|
|
29
|
-
ATTR_TOUCH_START_PREVENT_DEFAULT,
|
|
30
|
-
} from "lib/attributes";
|
|
31
|
-
import { parseAny, parseBoolean, parseNumber, parseString } from "../util";
|
|
32
|
-
import { SwiperOptions } from "swiper/types";
|
|
33
|
-
|
|
34
|
-
export function touchConfig(config: SwiperOptions, el: HTMLElement) {
|
|
35
|
-
config.allowTouchMove = parseBoolean(el, ATTR_ALLOW_TOUCH_MOVE, true);
|
|
36
|
-
config.edgeSwipeDetection = parseBoolean(el, ATTR_EDGE_SWIPE_DETECTION, false);
|
|
37
|
-
config.edgeSwipeThreshold = parseNumber(el, ATTR_EDGE_SWIPE_THRESHOLD, 20);
|
|
38
|
-
config.focusableElements = parseString(
|
|
39
|
-
el,
|
|
40
|
-
ATTR_FOCUSABLE_ELEMENTS,
|
|
41
|
-
"input, select, option, textarea, button, video, label",
|
|
42
|
-
);
|
|
43
|
-
config.followFinger = parseBoolean(el, ATTR_FOLLOW_FINGER, true);
|
|
44
|
-
config.grabCursor = parseBoolean(el, ATTR_GRAB_CURSOR, false);
|
|
45
|
-
config.longSwipes = parseBoolean(el, ATTR_LONG_SWIPES, true); // NOTE no effect
|
|
46
|
-
config.longSwipesMs = parseNumber(el, ATTR_LONG_SWIPES_MS, 300); // NOTE no effect
|
|
47
|
-
config.longSwipesRatio = parseNumber(el, ATTR_LONG_SWIPES_RATIO, 0.5); // NOTE no effect
|
|
48
|
-
config.noSwiping = parseBoolean(el, ATTR_NO_SWIPING, true);
|
|
49
|
-
config.noSwipingClass = parseString(el, ATTR_NO_SWIPING_CLASS, "swiper-no-swiping");
|
|
50
|
-
config.noSwipingSelector = parseString(el, ATTR_NO_SWIPING_SELECTOR);
|
|
51
|
-
config.preventClicks = parseBoolean(el, ATTR_PREVENT_CLICKS, true);
|
|
52
|
-
config.preventClicksPropagation = parseBoolean(el, ATTR_PREVENT_CLICKS_PROPAGATION, true);
|
|
53
|
-
config.preventInteractionOnTransition = parseBoolean(el, ATTR_PREVENT_INTERACTION_ON_TRANSITION, false);
|
|
54
|
-
config.resistance = parseBoolean(el, ATTR_RESISTANCE, true);
|
|
55
|
-
config.resistanceRatio = parseNumber(el, ATTR_RESISTANCE_RATIO, 0.85);
|
|
56
|
-
config.shortSwipes = parseBoolean(el, ATTR_SHORT_SWIPES, true);
|
|
57
|
-
config.simulateTouch = parseBoolean(el, ATTR_SIMULATE_TOUCH, true);
|
|
58
|
-
config.slideToClickedSlide = parseBoolean(el, ATTR_SLIDE_TO_CLICKED_SLIDE, false);
|
|
59
|
-
config.threshold = parseNumber(el, ATTR_THRESHOLD, 5);
|
|
60
|
-
config.touchAngle = parseNumber(el, ATTR_TOUCH_ANGLE, 45);
|
|
61
|
-
config.touchEventsTarget = parseAny(el, ATTR_TOUCH_EVENTS_TARGET, "wrapper");
|
|
62
|
-
config.touchMoveStopPropagation = parseBoolean(el, ATTR_TOUCH_MOVE_STOP_PROPAGATION, false);
|
|
63
|
-
config.touchRatio = parseNumber(el, ATTR_TOUCH_RATIO, 1);
|
|
64
|
-
config.touchReleaseOnEdges = parseBoolean(el, ATTR_TOUCH_RELEASE_ON_EDGES, false);
|
|
65
|
-
config.touchStartForcePreventDefault = parseBoolean(el, ATTR_TOUCH_START_FORCE_PREVENT_DEFAULT, false);
|
|
66
|
-
config.touchStartPreventDefault = parseBoolean(el, ATTR_TOUCH_START_PREVENT_DEFAULT, true);
|
|
67
|
-
}
|
package/src/modules/zoom.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ATTR_ZOOM_CONTAINER_CLASS,
|
|
3
|
-
ATTR_ZOOM_LIMIT_TO_ORIGINAL_SIZE,
|
|
4
|
-
ATTR_ZOOM_MAX_RATIO,
|
|
5
|
-
ATTR_ZOOM_MIN_RATIO,
|
|
6
|
-
ATTR_ZOOM_PAN_ON_MOUSE_MOVE,
|
|
7
|
-
ATTR_ZOOM_TOGGLE,
|
|
8
|
-
ATTR_ZOOMED_SLIDE_CLASS,
|
|
9
|
-
} from "lib/attributes";
|
|
10
|
-
import { parseBoolean, parseNumber, parseString } from "../util";
|
|
11
|
-
import { SwiperOptions } from "swiper/types";
|
|
12
|
-
|
|
13
|
-
export function zoomConfig(config: SwiperOptions, el: HTMLElement) {
|
|
14
|
-
config.zoom = {
|
|
15
|
-
containerClass: parseString(el, ATTR_ZOOM_CONTAINER_CLASS, "swiper-zoom-container"),
|
|
16
|
-
limitToOriginalSize: parseBoolean(el, ATTR_ZOOM_LIMIT_TO_ORIGINAL_SIZE, false),
|
|
17
|
-
maxRatio: parseNumber(el, ATTR_ZOOM_MAX_RATIO, 3),
|
|
18
|
-
minRatio: parseNumber(el, ATTR_ZOOM_MIN_RATIO, 1),
|
|
19
|
-
panOnMouseMove: parseBoolean(el, ATTR_ZOOM_PAN_ON_MOUSE_MOVE, false),
|
|
20
|
-
toggle: parseBoolean(el, ATTR_ZOOM_TOGGLE, true),
|
|
21
|
-
zoomedSlideClass: parseString(el, ATTR_ZOOMED_SLIDE_CLASS, "swiper-slide-zoomed"),
|
|
22
|
-
};
|
|
23
|
-
}
|
package/src/types/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare const APP_VERSION: string;
|
package/src/types/waterfall.d.ts
DELETED
package/src/util.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import Swiper from "swiper";
|
|
2
|
-
import { Waterfall } from "types/waterfall";
|
|
3
|
-
|
|
4
|
-
export function printDebug(debug: boolean, str: string, el: any) {
|
|
5
|
-
if (!debug) return;
|
|
6
|
-
console.log(`${str}:`, el);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getUniqueClasses(targetElement: HTMLElement, comparisonElement: HTMLElement): string {
|
|
10
|
-
if (!targetElement.classList || !comparisonElement.classList) return "";
|
|
11
|
-
|
|
12
|
-
const targetClasses = Array.from(targetElement.classList || []);
|
|
13
|
-
const comparisonClasses = Array.from(comparisonElement.classList || []);
|
|
14
|
-
|
|
15
|
-
const filtered = targetClasses.filter((className) => className && !comparisonClasses.includes(className));
|
|
16
|
-
|
|
17
|
-
return filtered.length > 0 ? filtered.join(" ") : "";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// ✅ Parse attribute as string (ignoring default value)
|
|
21
|
-
export function parseString(el: HTMLElement, attrName: string, defaultValue?: string): string | undefined {
|
|
22
|
-
const attrValue = el.getAttribute(attrName)?.trim();
|
|
23
|
-
if (!attrValue || attrValue === defaultValue) return undefined;
|
|
24
|
-
return attrValue;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function parseSlidesPerView(
|
|
28
|
-
el: HTMLElement,
|
|
29
|
-
attrName: string,
|
|
30
|
-
defaultValue?: number,
|
|
31
|
-
): number | "auto" | undefined {
|
|
32
|
-
const attrValue = el.getAttribute(attrName)?.trim();
|
|
33
|
-
if (!attrValue) return undefined;
|
|
34
|
-
|
|
35
|
-
if (attrValue.toLowerCase() === "auto") return "auto";
|
|
36
|
-
|
|
37
|
-
const parsedValue = Number(attrValue);
|
|
38
|
-
const validAndUnique = isNaN(parsedValue) || parsedValue === defaultValue;
|
|
39
|
-
if (validAndUnique) return undefined;
|
|
40
|
-
return parsedValue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function parseAny(el: HTMLElement, attrName: string, defaultValue?: any): any | undefined {
|
|
44
|
-
const attrValue = el.getAttribute(attrName)?.trim();
|
|
45
|
-
if (!attrValue || attrValue === defaultValue) return undefined;
|
|
46
|
-
return attrValue;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ✅ Parse attribute as number
|
|
50
|
-
export function parseNumber(el: HTMLElement, attrName: string, defaultValue?: number): number | undefined {
|
|
51
|
-
const attrValue = el.getAttribute(attrName)?.trim();
|
|
52
|
-
if (!attrValue) return undefined;
|
|
53
|
-
|
|
54
|
-
const parsedValue = Number(attrValue);
|
|
55
|
-
const validAndUnique = isNaN(parsedValue) || parsedValue === defaultValue;
|
|
56
|
-
if (validAndUnique) return undefined;
|
|
57
|
-
return parsedValue;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// ✅ Parse attribute as boolean
|
|
61
|
-
export function parseBoolean(el: HTMLElement, attrName: string, defaultValue?: boolean): boolean | undefined {
|
|
62
|
-
const attrValue = el.getAttribute(attrName)?.trim()?.toLowerCase();
|
|
63
|
-
if (!attrValue) return undefined;
|
|
64
|
-
|
|
65
|
-
if (attrValue === "true") return defaultValue === true ? undefined : true;
|
|
66
|
-
if (attrValue === "false") return defaultValue === false ? undefined : false;
|
|
67
|
-
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isHTMLElement(value: unknown): value is HTMLElement {
|
|
72
|
-
return typeof HTMLElement !== "undefined" && value instanceof HTMLElement;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function removeNullOrUndefinedKeys<T extends Record<string, any>>(obj: T): T {
|
|
76
|
-
if (typeof obj !== "object" || obj === null) return obj;
|
|
77
|
-
|
|
78
|
-
for (const key in obj) {
|
|
79
|
-
const value = obj[key];
|
|
80
|
-
if (value === null || value === undefined) {
|
|
81
|
-
delete obj[key];
|
|
82
|
-
} else if (typeof value === "object" && value !== null && !isHTMLElement(value)) {
|
|
83
|
-
removeNullOrUndefinedKeys(value as Record<string, any>);
|
|
84
|
-
if (Object.keys(value).length === 0) delete obj[key];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return obj;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function getSwipersByName(waterfalls: Waterfall[], selector: string, debug: boolean): Swiper[] {
|
|
92
|
-
const matchedSwipers = waterfalls
|
|
93
|
-
.filter((w) => {
|
|
94
|
-
const match = w.name === selector;
|
|
95
|
-
return match;
|
|
96
|
-
})
|
|
97
|
-
.map((w) => w.swiper);
|
|
98
|
-
|
|
99
|
-
debug && console.log(`📊 Found ${matchedSwipers.length} matching swiper(s) for "${selector}"`);
|
|
100
|
-
|
|
101
|
-
return matchedSwipers;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function fixWebflowCMSListARIARole() {
|
|
105
|
-
document.querySelectorAll('[waterfall] .swiper-wrapper[role="list"]').forEach((wrapper) => {
|
|
106
|
-
wrapper.removeAttribute("role");
|
|
107
|
-
});
|
|
108
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"strict": true,
|
|
4
|
-
"noImplicitAny": true,
|
|
5
|
-
"strictNullChecks": true,
|
|
6
|
-
"strictFunctionTypes": true,
|
|
7
|
-
"target": "ES2020",
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"checkJs": true,
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"allowSyntheticDefaultImports": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"outDir": "dist",
|
|
15
|
-
"baseUrl": "./src",
|
|
16
|
-
"paths": {
|
|
17
|
-
"lib/*": ["./lib/*"]
|
|
18
|
-
},
|
|
19
|
-
"resolveJsonModule": true,
|
|
20
|
-
"sourceMap": true,
|
|
21
|
-
"declaration": true,
|
|
22
|
-
"declarationDir": "dist",
|
|
23
|
-
"types": ["jquery", "vite/client"]
|
|
24
|
-
},
|
|
25
|
-
"include": ["src/**/*", "src/**/*.tsx", "src/types/**/*.d.ts"],
|
|
26
|
-
"exclude": ["node_modules"]
|
|
27
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
4
|
-
import dts from 'vite-plugin-dts';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [
|
|
8
|
-
cssInjectedByJsPlugin(),
|
|
9
|
-
dts({
|
|
10
|
-
insertTypesEntry: true,
|
|
11
|
-
exclude: ['**/*.test.ts', '**/*.spec.ts']
|
|
12
|
-
})
|
|
13
|
-
],
|
|
14
|
-
build: {
|
|
15
|
-
lib: {
|
|
16
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
17
|
-
name: 'Waterfall',
|
|
18
|
-
formats: ['es'],
|
|
19
|
-
fileName: () => `index.js`
|
|
20
|
-
},
|
|
21
|
-
outDir: 'dist',
|
|
22
|
-
sourcemap: true,
|
|
23
|
-
rollupOptions: {
|
|
24
|
-
// Ensure external dependencies are not bundled
|
|
25
|
-
external: [],
|
|
26
|
-
output: {
|
|
27
|
-
globals: {}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
resolve: {
|
|
32
|
-
alias: {
|
|
33
|
-
'lib': resolve(__dirname, 'src/lib')
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
define: {
|
|
37
|
-
APP_VERSION: JSON.stringify(process.env.npm_package_version)
|
|
38
|
-
}
|
|
39
|
-
});
|