rytm-webflow 2.2.5 → 2.2.7

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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/scripts/index.d.ts +216 -0
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "rytm-webflow",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
+ "types": "scripts/index.d.ts",
6
7
  "scripts": {
7
8
  "update": "git pull",
8
9
  "push": "git add . && git commit -a -m \"$m\" && git push"
9
10
  },
10
11
  "repository": {
11
12
  "type": "git",
12
- "url": "git+ssh://git@bitbucket.org/rytm/rytm-webflow.git"
13
+ "url": "https://github.com/rytmdigital/rytm-webflow.git"
13
14
  },
14
15
  "author": "Rytm Digital / Roman Kühl",
15
16
  "license": "UNLICENSED",
16
- "homepage": "https://bitbucket.org/rytm/rytm-webflow#readme",
17
+ "homepage": "https://github.com/rytmdigital/rytm-webflow.git",
17
18
  "devDependencies": {},
18
19
  "dependencies": {
19
20
  "gsap": "^3.5.1",
@@ -0,0 +1,216 @@
1
+ // Minimal stand-in for a ScrollMagic.Controller instance.
2
+ // ScrollMagic ships no official types.
3
+ interface ScrollMagicControllerInstance {
4
+ destroy(reset?: boolean): void;
5
+ update(immediately?: boolean): this;
6
+ }
7
+
8
+ // Shared shape returned by animation-prop parsers
9
+ interface AnimationProps {
10
+ time: number;
11
+ tween: Record<string, unknown>;
12
+ }
13
+
14
+ // ScrollMagic scene props shape
15
+ interface ScrollMagicSceneProps {
16
+ triggerElement: Element | string;
17
+ duration: number | string;
18
+ offset: number | string;
19
+ }
20
+
21
+ // Internal aswap event — target carries freshContent Element
22
+ interface AswapEvent extends Event {
23
+ target: (EventTarget & { freshContent: Element }) | null;
24
+ }
25
+
26
+ // ─── ASwap ───────────────────────────────────────────────────
27
+
28
+ export interface AswapProps {
29
+ animationTimeHide?: number;
30
+ animationTimeShow?: number;
31
+ formsEnabled?: boolean;
32
+ formsSelector?: string;
33
+ swipeEnabled?: boolean;
34
+ swipeMinDistance?: number;
35
+ historyEnabled?: boolean;
36
+ historyFallback?: boolean;
37
+ cacheOn?: boolean;
38
+ noCacheClassName?: string;
39
+ resetScrollOn?: boolean;
40
+ noScrollClassName?: string;
41
+ noSwapClassName?: string;
42
+ oldschoolBrowserFallback?: boolean;
43
+ preloadOnHover?: boolean;
44
+ refreshOnSameUrl?: boolean;
45
+ refreshOnContentParseError?: boolean;
46
+ swapSelector?: string;
47
+ defaultDocumentScrollBehavior?: string;
48
+ trace?: (...args: unknown[]) => void;
49
+ routes?: Record<string, AswapRoute>;
50
+ }
51
+
52
+ export interface AswapRoute {
53
+ controller: new (id: string | number) => Controller;
54
+ view?: new (id: string | number) => View;
55
+ }
56
+
57
+ export interface AswapEvents {
58
+ onInited?: () => void;
59
+ onRequestUrl?: () => void;
60
+ onRequestLoad?: () => void;
61
+ onRequestLoaded?: () => void;
62
+ onRequestSameUrl?: () => void;
63
+ onViewHide?: () => void;
64
+ onViewHidden?: () => void;
65
+ onViewSwapStart?: () => void;
66
+ onViewSwapComplete?: () => void;
67
+ onViewShow?: () => void;
68
+ onViewShown?: () => void;
69
+ }
70
+
71
+ export interface Aswap {
72
+ init(params?: AswapProps, events?: AswapEvents): void;
73
+ openURL(url: string, noHistory?: boolean, useCache?: boolean): void;
74
+ clearCache(url?: string | null): void;
75
+ formSubmit(form: HTMLFormElement): void;
76
+ }
77
+
78
+ // ─── Views ───────────────────────────────────────────────────
79
+
80
+ export declare class View {
81
+ id: string | number;
82
+ active: boolean;
83
+
84
+ constructor(id: string | number);
85
+
86
+ prepare(container: Element | null): void;
87
+ show(container: Element | null): void;
88
+ shown(container: Element | null): void;
89
+ hide(container: Element | null): void;
90
+ hidden(container: Element | null): void;
91
+ loadImagesStart(container: Element | null): void;
92
+ loadImagesComplete(container: Element | null): void;
93
+
94
+ /** Arrow-function property — use to filter elements and exclude those belonging to nested views */
95
+ elementBelongsToView: (el: Element) => boolean;
96
+ }
97
+
98
+ export declare class WebflowView extends View {}
99
+
100
+ export declare class WebflowListView extends View {}
101
+
102
+ // ─── Controllers ─────────────────────────────────────────────
103
+
104
+ export declare class Controller {
105
+ id: string | number;
106
+ name: string | false;
107
+ active: boolean;
108
+ view: View | false;
109
+
110
+ constructor(id: string | number);
111
+
112
+ setView(view: View): void;
113
+ isActive(): boolean;
114
+ getViewContainer(wrapper: Element): Element | null;
115
+ getContainerSelector(): string;
116
+ addEventListeners(): void;
117
+ removeEventListeners(): void;
118
+
119
+ onRequestUrl(e: AswapEvent): void;
120
+ onRequestLoad(e: AswapEvent): void;
121
+ onRequestLoaded(e: AswapEvent): void;
122
+ onViewHide(e: AswapEvent): void;
123
+ onViewHidden(e: AswapEvent): void;
124
+ onViewSwapStart(e: AswapEvent): void;
125
+ onViewSwapComplete(e: AswapEvent): void;
126
+ onViewShow(e: AswapEvent): void;
127
+ onViewShown(e: AswapEvent): void;
128
+ }
129
+
130
+ export declare class ControllerImgLoad extends Controller {
131
+ loadImagesStart(): void;
132
+ loadImagesComplete(e?: Event): void;
133
+ }
134
+
135
+ // ─── ShowUp ──────────────────────────────────────────────────
136
+
137
+ export interface ShowUp {
138
+ init(): void;
139
+ rebuild(): void;
140
+ hide(): void;
141
+ destroy(): void;
142
+ }
143
+
144
+ // ─── Bootstrap 5 helpers ─────────────────────────────────────
145
+
146
+ export interface Bootstrap5 {
147
+ hideFlyovers(): void;
148
+ hideModals(): void;
149
+ hideOffcanvases(): void;
150
+ }
151
+
152
+ // ─── scrollController ────────────────────────────────────────
153
+
154
+ export interface ScrollController {
155
+ get(): ScrollMagicControllerInstance;
156
+ destroy(): void;
157
+ refresh(immediately?: boolean): void;
158
+ }
159
+
160
+ // ─── Utility functions ───────────────────────────────────────
161
+
162
+ /** Split a comma-separated key:value string into an object */
163
+ export declare function parseProps(str: string): Record<string, unknown>;
164
+
165
+ /** Parse a webflow animation data-attribute string into show/hide animation props */
166
+ export declare function getWebflowProps(str: string): {
167
+ show: AnimationProps;
168
+ hide: AnimationProps | false;
169
+ };
170
+
171
+ /** Parse a single animation group string into time + tween props */
172
+ export declare function getWebflowAnimationProps(str: string): AnimationProps;
173
+
174
+ /** Parse a parallax data-attribute string into parallax tween props */
175
+ export declare function getParallaxProps(str: string): {
176
+ parallax?: AnimationProps;
177
+ };
178
+
179
+ /** Build ScrollMagic.Scene constructor props from an element and setup object */
180
+ export declare function getScrollMagicSceneProps(
181
+ el: Element,
182
+ setup: Record<string, unknown>
183
+ ): ScrollMagicSceneProps;
184
+
185
+ /** Check if an element is visible within the current viewport */
186
+ export declare function elementIsVisibleInViewport(
187
+ el: Element,
188
+ partiallyVisible?: boolean
189
+ ): boolean;
190
+
191
+ // ─── Constant ────────────────────────────────────────────────
192
+
193
+ export declare const CLASS_NAME_WEBSCROLL_FIRED: string;
194
+
195
+ // ─── Default export ───────────────────────────────────────────
196
+
197
+ declare const RytmWebflow: {
198
+ aswap: Aswap;
199
+ Controller: typeof Controller;
200
+ ControllerImgLoad: typeof ControllerImgLoad;
201
+ View: typeof View;
202
+ WebflowView: typeof WebflowView;
203
+ WebflowListView: typeof WebflowListView;
204
+ /** Note: "bootsrap5" is the original (typo) name in the library */
205
+ bootsrap5: Bootstrap5;
206
+ scrollController: ScrollController;
207
+ showUp: ShowUp;
208
+ getWebflowProps: typeof getWebflowProps;
209
+ getWebflowAnimationProps: typeof getWebflowAnimationProps;
210
+ getParallaxProps: typeof getParallaxProps;
211
+ parseProps: typeof parseProps;
212
+ getScrollMagicSceneProps: typeof getScrollMagicSceneProps;
213
+ elementIsVisibleInViewport: typeof elementIsVisibleInViewport;
214
+ };
215
+
216
+ export default RytmWebflow;