@brandocms/jupiter 3.54.4 → 4.0.0-beta.1
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/README.md +318 -52
- package/package.json +26 -16
- package/src/index.js +5 -0
- package/src/modules/Application/index.js +37 -5
- package/src/modules/Breakpoints/index.js +116 -36
- package/src/modules/Cookies/index.js +67 -15
- package/src/modules/CoverOverlay/index.js +2 -2
- package/src/modules/Dom/index.js +6 -0
- package/src/modules/Dropdown/index.js +15 -6
- package/src/modules/EqualHeightElements/index.js +8 -6
- package/src/modules/EqualHeightImages/index.js +9 -6
- package/src/modules/FixedHeader/index.js +57 -1
- package/src/modules/FooterReveal/index.js +3 -3
- package/src/modules/HeroSlider/index.js +39 -30
- package/src/modules/HeroVideo/index.js +64 -24
- package/src/modules/Lazyload/index.js +27 -0
- package/src/modules/Lightbox/index.js +90 -31
- package/src/modules/Links/index.js +23 -2
- package/src/modules/MobileMenu/index.js +50 -21
- package/src/modules/Moonwalk/index.js +131 -4
- package/src/modules/Parallax/index.js +280 -57
- package/src/modules/Popover/index.js +28 -16
- package/src/modules/Popup/index.js +155 -29
- package/src/modules/ScrollSpy/index.js +21 -0
- package/src/modules/StackedBoxes/index.js +6 -4
- package/src/modules/StickyHeader/index.js +45 -24
- package/src/modules/Toggler/index.js +44 -5
- package/src/modules/Typography/index.js +33 -20
- package/types/README.md +159 -0
- package/types/events/index.d.ts +20 -0
- package/types/index.d.ts +35 -0
- package/types/modules/Application/index.d.ts +168 -0
- package/types/modules/Breakpoints/index.d.ts +38 -0
- package/types/modules/Cookies/index.d.ts +81 -0
- package/types/modules/CoverOverlay/index.d.ts +6 -0
- package/types/modules/Dataloader/index.d.ts +35 -0
- package/types/modules/Dom/index.d.ts +40 -0
- package/types/modules/Dropdown/index.d.ts +38 -0
- package/types/modules/EqualHeightElements/index.d.ts +8 -0
- package/types/modules/EqualHeightImages/index.d.ts +11 -0
- package/types/modules/FeatureTests/index.d.ts +27 -0
- package/types/modules/FixedHeader/index.d.ts +219 -0
- package/types/modules/Fontloader/index.d.ts +5 -0
- package/types/modules/FooterReveal/index.d.ts +5 -0
- package/types/modules/HeroSlider/index.d.ts +28 -0
- package/types/modules/HeroVideo/index.d.ts +83 -0
- package/types/modules/Lazyload/index.d.ts +80 -0
- package/types/modules/Lightbox/index.d.ts +128 -0
- package/types/modules/Links/index.d.ts +55 -0
- package/types/modules/Marquee/index.d.ts +23 -0
- package/types/modules/MobileMenu/index.d.ts +63 -0
- package/types/modules/Moonwalk/index.d.ts +331 -0
- package/types/modules/Parallax/index.d.ts +93 -0
- package/types/modules/Popover/index.d.ts +17 -0
- package/types/modules/Popup/index.d.ts +89 -0
- package/types/modules/ScrollSpy/index.d.ts +29 -0
- package/types/modules/StackedBoxes/index.d.ts +9 -0
- package/types/modules/StickyHeader/index.d.ts +63 -0
- package/types/modules/Toggler/index.d.ts +26 -0
- package/types/modules/Typography/index.d.ts +77 -0
- package/types/utils/dispatchElementEvent.d.ts +1 -0
- package/types/utils/imageIsLoaded.d.ts +1 -0
- package/types/utils/imagesAreLoaded.d.ts +1 -0
- package/types/utils/loadScript.d.ts +2 -0
- package/types/utils/prefersReducedMotion.d.ts +4 -0
- package/types/utils/rafCallback.d.ts +2 -0
- package/types/utils/zoom.d.ts +4 -0
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} TypographySettings
|
|
3
|
+
* @property {number} [minWords=4] - Minimum number of words required to apply fixes
|
|
4
|
+
* @property {string} [selector='[data-typo]'] - Selector for elements to process
|
|
5
|
+
* @property {string} [ignoreClass='no-typo-fix'] - Class to exclude elements from processing
|
|
6
|
+
* @property {boolean} [ignoreExistingSpaceChars=false] - Whether to ignore elements with existing non-breaking spaces
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Typography class for enhancing text presentation, including orphan prevention
|
|
11
|
+
*/
|
|
1
12
|
export default class Typography {
|
|
13
|
+
/**
|
|
14
|
+
* Create a new Typography instance
|
|
15
|
+
* @param {HTMLElement|undefined} parent - Parent element to search for typography elements, or undefined for document
|
|
16
|
+
* @param {TypographySettings} settings - Typography settings
|
|
17
|
+
*/
|
|
2
18
|
constructor(parent, settings = {}) {
|
|
3
|
-
const self = this
|
|
4
|
-
|
|
5
19
|
// Set some settings, by merging defaults and passed settings
|
|
6
|
-
|
|
20
|
+
this.settings = {
|
|
7
21
|
minWords: 4,
|
|
8
22
|
selector: '[data-typo]',
|
|
9
23
|
ignoreClass: 'no-typo-fix',
|
|
@@ -11,19 +25,19 @@ export default class Typography {
|
|
|
11
25
|
...settings
|
|
12
26
|
}
|
|
13
27
|
|
|
14
|
-
|
|
28
|
+
this.elems = []
|
|
15
29
|
|
|
16
30
|
// Either load from root or the passed parent element
|
|
17
31
|
if (typeof parent === 'undefined') {
|
|
18
|
-
|
|
32
|
+
this.elems = [...this.elems, ...document.querySelectorAll(this.settings.selector)]
|
|
19
33
|
} else {
|
|
20
|
-
|
|
34
|
+
this.elems = [...this.elems, ...parent.querySelectorAll(this.settings.selector)]
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
// load children
|
|
24
38
|
const typoParents = document.querySelectorAll('[data-typo-children]')
|
|
25
39
|
typoParents.forEach(typoParent => {
|
|
26
|
-
|
|
40
|
+
this.elems = [...this.elems, ...typoParent.children]
|
|
27
41
|
})
|
|
28
42
|
|
|
29
43
|
this.apply()
|
|
@@ -34,11 +48,9 @@ export default class Typography {
|
|
|
34
48
|
* @return void
|
|
35
49
|
*/
|
|
36
50
|
apply() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
self.elems.map(elem => {
|
|
51
|
+
this.elems.map(elem => {
|
|
40
52
|
// Run the ignore checker nd bail if required
|
|
41
|
-
if (
|
|
53
|
+
if (this.shouldElementBeIgnored(elem)) {
|
|
42
54
|
return false
|
|
43
55
|
}
|
|
44
56
|
|
|
@@ -52,12 +64,12 @@ export default class Typography {
|
|
|
52
64
|
.split(/ (?=[^>]*(?:<|$))/)
|
|
53
65
|
|
|
54
66
|
// Check if the text warrants this module
|
|
55
|
-
if (textItems.length <
|
|
67
|
+
if (textItems.length < this.settings.minWords) {
|
|
56
68
|
return false
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
// Run orphans filter
|
|
60
|
-
textItems =
|
|
72
|
+
textItems = this.preventOrphans(textItems)
|
|
61
73
|
|
|
62
74
|
// Join the words back together
|
|
63
75
|
result = textItems.join(' ')
|
|
@@ -91,11 +103,9 @@ export default class Typography {
|
|
|
91
103
|
* @return void
|
|
92
104
|
*/
|
|
93
105
|
reset() {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
self.elems.map(elem => {
|
|
106
|
+
this.elems.map(elem => {
|
|
97
107
|
// Run the ignore checker nd bail if required
|
|
98
|
-
if (
|
|
108
|
+
if (this.shouldElementBeIgnored(elem)) {
|
|
99
109
|
return false
|
|
100
110
|
}
|
|
101
111
|
|
|
@@ -111,11 +121,14 @@ export default class Typography {
|
|
|
111
121
|
* @returns boolean
|
|
112
122
|
*/
|
|
113
123
|
shouldElementBeIgnored(elem) {
|
|
114
|
-
const self = this
|
|
115
|
-
|
|
116
124
|
// Check if the element already contains 1 or more characters and the
|
|
117
125
|
// ignore setting is true. If so: bail.
|
|
118
|
-
if (elem.innerHTML.indexOf(' ') > -1 &&
|
|
126
|
+
if (elem.innerHTML.indexOf(' ') > -1 && this.settings.ignoreExistingSpaceChars) {
|
|
127
|
+
return true
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Check if the element has the ignore class
|
|
131
|
+
if (elem.classList.contains(this.settings.ignoreClass)) {
|
|
119
132
|
return true
|
|
120
133
|
}
|
|
121
134
|
|
package/types/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Jupiter TypeScript Definitions
|
|
2
|
+
|
|
3
|
+
This directory contains TypeScript declaration files (.d.ts) for Jupiter modules.
|
|
4
|
+
|
|
5
|
+
## Using Type Definitions
|
|
6
|
+
|
|
7
|
+
When importing Jupiter modules, you'll get autocomplete and type checking for options:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import { Moonwalk } from '@brandocms/jupiter';
|
|
11
|
+
|
|
12
|
+
// Options object will have autocomplete
|
|
13
|
+
const moonwalk = new Moonwalk(app, {
|
|
14
|
+
clearNestedSections: true,
|
|
15
|
+
rootMargin: '-5% 0%',
|
|
16
|
+
walks: {
|
|
17
|
+
// Autocomplete for walk properties
|
|
18
|
+
default: {
|
|
19
|
+
interval: 0.1,
|
|
20
|
+
duration: 0.5
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Available Typed Modules
|
|
27
|
+
|
|
28
|
+
The following modules have TypeScript definitions:
|
|
29
|
+
|
|
30
|
+
### Core Modules
|
|
31
|
+
- **Application** - Main application controller
|
|
32
|
+
- **Breakpoints** - Responsive design and media query handling
|
|
33
|
+
- **Dom** - DOM utility functions
|
|
34
|
+
|
|
35
|
+
### Media Modules
|
|
36
|
+
- **Lazyload** - Image lazy loading functionality
|
|
37
|
+
- **Lightbox** - Image gallery overlay
|
|
38
|
+
- **HeroVideo** - Background video with controls
|
|
39
|
+
|
|
40
|
+
### Navigation and UI Modules
|
|
41
|
+
- **Links** - Navigation and page transitions
|
|
42
|
+
- **Popup** - Modal dialogs and popups
|
|
43
|
+
- **Toggler** - Show/hide component for collapsible content
|
|
44
|
+
|
|
45
|
+
### Animation Modules
|
|
46
|
+
- **Parallax** - Parallax scrolling effect for background images
|
|
47
|
+
- **Moonwalk** - Animation system for element reveals
|
|
48
|
+
|
|
49
|
+
## Adding Type Definitions for a New Module
|
|
50
|
+
|
|
51
|
+
1. **Create JSDoc annotations** in your source file (src/modules/YourModule/index.js):
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} YourModuleOptions
|
|
56
|
+
* @property {boolean} [someOption=false] - Description of the option
|
|
57
|
+
* @property {number} [anotherOption=10] - Description of another option
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/** @type {YourModuleOptions} */
|
|
61
|
+
const DEFAULT_OPTIONS = {
|
|
62
|
+
someOption: false,
|
|
63
|
+
anotherOption: 10
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Your module description
|
|
68
|
+
*/
|
|
69
|
+
export default class YourModule {
|
|
70
|
+
/**
|
|
71
|
+
* @param {Object} app - Application instance
|
|
72
|
+
* @param {YourModuleOptions} [opts={}] - Configuration options
|
|
73
|
+
*/
|
|
74
|
+
constructor(app, opts = {}) {
|
|
75
|
+
// ...
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} someParam - Parameter description
|
|
80
|
+
* @returns {boolean} Return value description
|
|
81
|
+
*/
|
|
82
|
+
someMethod(someParam) {
|
|
83
|
+
// ...
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. **Create a TypeScript declaration file** in types/modules/YourModule/index.d.ts:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
/**
|
|
92
|
+
* Types for YourModule
|
|
93
|
+
*/
|
|
94
|
+
import Application from '../Application';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* YourModule options
|
|
98
|
+
*/
|
|
99
|
+
export interface YourModuleOptions {
|
|
100
|
+
/** Description of the option */
|
|
101
|
+
someOption?: boolean;
|
|
102
|
+
|
|
103
|
+
/** Description of another option */
|
|
104
|
+
anotherOption?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Your module description
|
|
109
|
+
*/
|
|
110
|
+
export default class YourModule {
|
|
111
|
+
/** Application instance */
|
|
112
|
+
app: Application;
|
|
113
|
+
|
|
114
|
+
/** Module options */
|
|
115
|
+
opts: YourModuleOptions;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a new YourModule instance
|
|
119
|
+
* @param app - Application instance
|
|
120
|
+
* @param opts - YourModule options
|
|
121
|
+
*/
|
|
122
|
+
constructor(app: Application, opts?: Partial<YourModuleOptions>);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Method description
|
|
126
|
+
* @param someParam - Parameter description
|
|
127
|
+
* @returns Return value description
|
|
128
|
+
*/
|
|
129
|
+
someMethod(someParam: string): boolean;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
3. **Update the main index.d.ts file** to export your new module:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
export {
|
|
137
|
+
default as YourModule,
|
|
138
|
+
YourModuleOptions
|
|
139
|
+
} from './modules/YourModule';
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Place this export in the appropriate section (Core, Media, Navigation/UI, or Animation).
|
|
143
|
+
|
|
144
|
+
## Typing Guidelines
|
|
145
|
+
|
|
146
|
+
- Use `Partial<Options>` for optional constructor parameters
|
|
147
|
+
- Use descriptive JSDoc comments for all properties and methods
|
|
148
|
+
- Group related interfaces together (e.g., options and element interfaces)
|
|
149
|
+
- Always import `Application` from '../Application'
|
|
150
|
+
- Use consistent naming patterns:
|
|
151
|
+
- `ModuleOptions` for options interfaces
|
|
152
|
+
- `ModuleElements` for element collections
|
|
153
|
+
- Use camelCase for methods and properties
|
|
154
|
+
|
|
155
|
+
## Running Type Checking
|
|
156
|
+
|
|
157
|
+
Run `yarn types` to generate and check type definitions.
|
|
158
|
+
|
|
159
|
+
If there are errors, don't worry about typechecking passing completely. The primary goal is to provide autocomplete and documentation for developers.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const APPLICATION_MOBILE_MENU_OPEN: "APPLICATION:MOBILE_MENU:OPEN";
|
|
2
|
+
export const APPLICATION_MOBILE_MENU_CLOSED: "APPLICATION:MOBILE_MENU:CLOSED";
|
|
3
|
+
export const APPLICATION_PRELUDIUM: "APPLICATION_PRELUDIUM";
|
|
4
|
+
export const APPLICATION_INITIALIZED: "APPLICATION:INITIALIZED";
|
|
5
|
+
export const APPLICATION_READY: "APPLICATION:READY";
|
|
6
|
+
export const APPLICATION_REVEALED: "APPLICATION:REVEALED";
|
|
7
|
+
export const APPLICATION_RESIZE: "APPLICATION:RESIZE";
|
|
8
|
+
export const APPLICATION_SCROLL: "APPLICATION:SCROLL";
|
|
9
|
+
export const APPLICATION_SCROLL_LOCKED: "APPLICATION:SCROLL_LOCKED";
|
|
10
|
+
export const APPLICATION_SCROLL_RELEASED: "APPLICATION:SCROLL_RELEASED";
|
|
11
|
+
export const APPLICATION_FORCED_SCROLL_START: "APPLICATION:FORCED_SCROLL_START";
|
|
12
|
+
export const APPLICATION_FORCED_SCROLL_END: "APPLICATION:FORCED_SCROLL_END";
|
|
13
|
+
export const APPLICATION_OUTLINE: "APPLICATION:OUTLINE";
|
|
14
|
+
export const APPLICATION_VISIBILITY_CHANGE: "APPLICATION:VISIBILITY_CHANGE";
|
|
15
|
+
export const APPLICATION_HIDDEN: "APPLICATION:HIDDEN";
|
|
16
|
+
export const APPLICATION_VISIBLE: "APPLICATION:VISIBLE";
|
|
17
|
+
export const BREAKPOINT_CHANGE: "BREAKPOINT:CHANGE";
|
|
18
|
+
export const IMAGE_LAZYLOADED: "IMAGE:LAZYLOADED";
|
|
19
|
+
export const IMAGE_REVEALED: "IMAGE:REVEALED";
|
|
20
|
+
export const SECTION_LAZYLOADED: "SECTION:LAZYLOADED";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Application from './modules/Application';
|
|
2
|
+
import Breakpoints from './modules/Breakpoints';
|
|
3
|
+
import Cookies from './modules/Cookies';
|
|
4
|
+
import CoverOverlay from './modules/CoverOverlay';
|
|
5
|
+
import Dataloader from './modules/Dataloader';
|
|
6
|
+
import Dom from './modules/Dom';
|
|
7
|
+
import Dropdown from './modules/Dropdown';
|
|
8
|
+
import EqualHeightElements from './modules/EqualHeightElements';
|
|
9
|
+
import EqualHeightImages from './modules/EqualHeightImages';
|
|
10
|
+
import * as Events from './events';
|
|
11
|
+
import FixedHeader from './modules/FixedHeader';
|
|
12
|
+
import FooterReveal from './modules/FooterReveal';
|
|
13
|
+
import Parallax from './modules/Parallax';
|
|
14
|
+
import HeroSlider from './modules/HeroSlider';
|
|
15
|
+
import HeroVideo from './modules/HeroVideo';
|
|
16
|
+
import Lazyload from './modules/Lazyload';
|
|
17
|
+
import Lightbox from './modules/Lightbox';
|
|
18
|
+
import Links from './modules/Links';
|
|
19
|
+
import Marquee from './modules/Marquee';
|
|
20
|
+
import MobileMenu from './modules/MobileMenu';
|
|
21
|
+
import Moonwalk from './modules/Moonwalk';
|
|
22
|
+
import Popover from './modules/Popover';
|
|
23
|
+
import Popup from './modules/Popup';
|
|
24
|
+
import ScrollSpy from './modules/ScrollSpy';
|
|
25
|
+
import StackedBoxes from './modules/StackedBoxes';
|
|
26
|
+
import StickyHeader from './modules/StickyHeader';
|
|
27
|
+
import Toggler from './modules/Toggler';
|
|
28
|
+
import Typography from './modules/Typography';
|
|
29
|
+
import imageIsLoaded from './utils/imageIsLoaded';
|
|
30
|
+
import imagesAreLoaded from './utils/imagesAreLoaded';
|
|
31
|
+
import loadScript from './utils/loadScript';
|
|
32
|
+
import prefersReducedMotion from './utils/prefersReducedMotion';
|
|
33
|
+
import rafCallback from './utils/rafCallback';
|
|
34
|
+
import Hammer from '@egjs/hammerjs';
|
|
35
|
+
export { Application, Breakpoints, Cookies, CoverOverlay, Dataloader, Dom, Draggable, Dropdown, EqualHeightElements, EqualHeightImages, Events, FixedHeader, FooterReveal, Parallax, HeroSlider, HeroVideo, Lazyload, Lightbox, Links, Marquee, MobileMenu, Moonwalk, Popover, Popup, ScrollSpy, StackedBoxes, StickyHeader, Toggler, Typography, imageIsLoaded, imagesAreLoaded, loadScript, prefersReducedMotion, rafCallback, _defaultsDeep, gsap, CSSPlugin, ScrollToPlugin, ScrollTrigger, Hammer };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export default class Application {
|
|
2
|
+
constructor(opts?: {});
|
|
3
|
+
debugType: number;
|
|
4
|
+
debugOverlay: Element;
|
|
5
|
+
userAgent: string;
|
|
6
|
+
_lastWindowHeight: number;
|
|
7
|
+
breakpoint: any;
|
|
8
|
+
language: string;
|
|
9
|
+
size: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
initialInnerHeight: number;
|
|
13
|
+
initialOuterHeight: number;
|
|
14
|
+
initialInnerWidth: number;
|
|
15
|
+
initialOuterWidth: number;
|
|
16
|
+
zoom: number;
|
|
17
|
+
};
|
|
18
|
+
position: {
|
|
19
|
+
top: number;
|
|
20
|
+
left: number;
|
|
21
|
+
};
|
|
22
|
+
state: {
|
|
23
|
+
revealed: boolean;
|
|
24
|
+
forcedScroll: boolean;
|
|
25
|
+
};
|
|
26
|
+
opts: any;
|
|
27
|
+
focusableSelectors: any;
|
|
28
|
+
featureTests: FeatureTests;
|
|
29
|
+
breakpoints: Breakpoints;
|
|
30
|
+
fontLoader: Fontloader;
|
|
31
|
+
fader: any;
|
|
32
|
+
callbacks: {};
|
|
33
|
+
SCROLL_LOCKED: boolean;
|
|
34
|
+
SCROLLBAR_WIDTH: number;
|
|
35
|
+
INITIALIZED: boolean;
|
|
36
|
+
PREFERS_REDUCED_MOTION: boolean;
|
|
37
|
+
beforeInitializedEvent: CustomEvent<any>;
|
|
38
|
+
initializedEvent: CustomEvent<any>;
|
|
39
|
+
readyEvent: CustomEvent<any>;
|
|
40
|
+
revealedEvent: CustomEvent<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Main init. Called from client application on DOMReady.
|
|
43
|
+
*/
|
|
44
|
+
initialize(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Application is initialized and ready.
|
|
47
|
+
* Fade in, then execute callbacks
|
|
48
|
+
*/
|
|
49
|
+
ready(): void;
|
|
50
|
+
getZoom(): void;
|
|
51
|
+
_lastDevicePixelRatio: number;
|
|
52
|
+
_initialZoom: any;
|
|
53
|
+
_zoomSVG: SVGSVGElement;
|
|
54
|
+
zoomCalculateChrome(dimsChanged: any): void;
|
|
55
|
+
zoomCalculateSafari(): void;
|
|
56
|
+
updateZoom(dimsChanged?: boolean, dprDelta?: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* Fade in application, as declared in the `faderOpts`
|
|
59
|
+
*/
|
|
60
|
+
fadeIn(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Register callbacks by `type`
|
|
63
|
+
*/
|
|
64
|
+
registerCallback(type: any, callback: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Execute callbacks by `type`
|
|
67
|
+
*/
|
|
68
|
+
executeCallbacks(type: any): void;
|
|
69
|
+
/**
|
|
70
|
+
* Set section
|
|
71
|
+
*/
|
|
72
|
+
setSection(): void;
|
|
73
|
+
section: string;
|
|
74
|
+
/**
|
|
75
|
+
* Check if document is scrolled
|
|
76
|
+
*/
|
|
77
|
+
isScrolled(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Locks body scroll
|
|
80
|
+
* `extraPaddedElements` can be a list of elements that also need padding, such as the header!
|
|
81
|
+
* @param {*} extraPaddedElements
|
|
82
|
+
*/
|
|
83
|
+
scrollLock(extraPaddedElements?: any): void;
|
|
84
|
+
_scrollPaddedElements: any[];
|
|
85
|
+
scrollRelease(defaultOverflow?: string): void;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @param {*} target
|
|
89
|
+
* this can be an object too if you want to override scrollTo: `{y: "#someID", offsetY: 50}`
|
|
90
|
+
* @param {*} time
|
|
91
|
+
* @param {*} emitEvents
|
|
92
|
+
*/
|
|
93
|
+
scrollTo(target: any, time?: any, emitEvents?: any, ease?: string): void;
|
|
94
|
+
hardScrollToTop(): void;
|
|
95
|
+
hardScrollTo(target: any): void;
|
|
96
|
+
scrollVoid(e: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get current scrollbar width — if there is none, there is none
|
|
99
|
+
*/
|
|
100
|
+
getCurrentScrollBarWidth(): number;
|
|
101
|
+
/**
|
|
102
|
+
* Get scrollbar width by FORCE. No matter if there is
|
|
103
|
+
* currently a scrollbar or not
|
|
104
|
+
*/
|
|
105
|
+
getScrollBarWidth(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Ugly hacks
|
|
108
|
+
*/
|
|
109
|
+
hacks(): void;
|
|
110
|
+
getIOSCurrentInnerHeight(): number;
|
|
111
|
+
getIOSInnerHeightMax(): number;
|
|
112
|
+
/**
|
|
113
|
+
* Event emitters
|
|
114
|
+
*/
|
|
115
|
+
_emitBeforeInitializedEvent(): void;
|
|
116
|
+
_emitInitializedEvent(): void;
|
|
117
|
+
_emitReadyEvent(): void;
|
|
118
|
+
_emitRevealedEvent(): void;
|
|
119
|
+
_getBaseVW(): string;
|
|
120
|
+
setDims(): void;
|
|
121
|
+
setFontBaseVw(): void;
|
|
122
|
+
setZoom(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Inner height of mobiles may change when showing hiding bottom bar.
|
|
125
|
+
*/
|
|
126
|
+
setvh100(): void;
|
|
127
|
+
setvw100(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Get the max 100vh for iOS
|
|
130
|
+
*/
|
|
131
|
+
setvh100Max(): void;
|
|
132
|
+
setScrollHeight(): void;
|
|
133
|
+
onBreakpointChanged(): void;
|
|
134
|
+
/**
|
|
135
|
+
* RAF'ed resize event
|
|
136
|
+
*/
|
|
137
|
+
onResize(e: any): void;
|
|
138
|
+
/**
|
|
139
|
+
* RAF'ed scroll event
|
|
140
|
+
*/
|
|
141
|
+
onScroll(e: any): void;
|
|
142
|
+
onVisibilityChange(e: any): void;
|
|
143
|
+
pollForElement(selector: any, time?: number, callback?: () => void): void;
|
|
144
|
+
pollForVar(variable: any, time?: number, callback?: () => void): void;
|
|
145
|
+
setupDebug(): void;
|
|
146
|
+
toggleDebug(): void;
|
|
147
|
+
/**
|
|
148
|
+
* CTRL-G to show grid overlay
|
|
149
|
+
*/
|
|
150
|
+
setupGridoverlay(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Add in extra selectors that are focusable
|
|
153
|
+
* @param {array} extraSelectors
|
|
154
|
+
*/
|
|
155
|
+
addFocusableSelectors(extraSelectors: any[]): void;
|
|
156
|
+
/**
|
|
157
|
+
* Set focusable selectors. Replaces default array.
|
|
158
|
+
* @param {array} selectors
|
|
159
|
+
*/
|
|
160
|
+
setFocusableSelectors(selectors: any[]): void;
|
|
161
|
+
/**
|
|
162
|
+
* Returns focusable selectors as a comma separated list
|
|
163
|
+
*/
|
|
164
|
+
getFocusableSelectors(): any;
|
|
165
|
+
}
|
|
166
|
+
import FeatureTests from '../FeatureTests';
|
|
167
|
+
import Breakpoints from '../Breakpoints';
|
|
168
|
+
import Fontloader from '../Fontloader';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breakpoints module for responsive design
|
|
3
|
+
*/
|
|
4
|
+
export default class Breakpoints {
|
|
5
|
+
/**
|
|
6
|
+
* Create a new Breakpoints instance
|
|
7
|
+
* @param {Object} app - Application instance
|
|
8
|
+
* @param {BreakpointsOptions} [opts={}] - Breakpoints options
|
|
9
|
+
*/
|
|
10
|
+
constructor(app: any, opts?: BreakpointsOptions);
|
|
11
|
+
app: any;
|
|
12
|
+
mediaQueries: {};
|
|
13
|
+
opts: any;
|
|
14
|
+
initialize(reveal?: boolean): void;
|
|
15
|
+
getCurrentBreakpoint(): {
|
|
16
|
+
key: string;
|
|
17
|
+
mq: any;
|
|
18
|
+
};
|
|
19
|
+
defaultListener(e: any): void;
|
|
20
|
+
setCurrentBreakpoint(): void;
|
|
21
|
+
_getVal(key: any): string;
|
|
22
|
+
}
|
|
23
|
+
export type BreakpointsOptions = {
|
|
24
|
+
/**
|
|
25
|
+
* - Whether to run listener on initialization
|
|
26
|
+
*/
|
|
27
|
+
runListenerOnInit?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* - Breakpoint names
|
|
30
|
+
*/
|
|
31
|
+
breakpoints?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* - Listener functions for breakpoints
|
|
34
|
+
*/
|
|
35
|
+
listeners?: {
|
|
36
|
+
[x: string]: Function;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookies module for handling cookie consent
|
|
3
|
+
*/
|
|
4
|
+
export default class Cookies {
|
|
5
|
+
/**
|
|
6
|
+
* Create a new Cookies instance
|
|
7
|
+
* @param {Object} app - Application instance
|
|
8
|
+
* @param {CookiesOptions} [opts={}] - Cookies options
|
|
9
|
+
*/
|
|
10
|
+
constructor(app: any, opts?: CookiesOptions);
|
|
11
|
+
app: any;
|
|
12
|
+
opts: any;
|
|
13
|
+
cc: Element;
|
|
14
|
+
inner: Element;
|
|
15
|
+
text: Element;
|
|
16
|
+
btns: Element;
|
|
17
|
+
btn: Element;
|
|
18
|
+
btnRefuse: Element;
|
|
19
|
+
/**
|
|
20
|
+
* Get a cookie value by key
|
|
21
|
+
* @param {string} sKey - Cookie key
|
|
22
|
+
* @returns {string|null} Cookie value or null if not found
|
|
23
|
+
*/
|
|
24
|
+
getCookie(sKey: string): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Set a cookie
|
|
27
|
+
* @param {string} sKey - Cookie key
|
|
28
|
+
* @param {string|number} sValue - Cookie value
|
|
29
|
+
* @param {Date|string|number} vEnd - Expiration date, string date, or max age in seconds
|
|
30
|
+
* @param {string} [sPath] - Cookie path
|
|
31
|
+
* @param {string} [sDomain] - Cookie domain
|
|
32
|
+
* @param {boolean} [bSecure] - Secure flag
|
|
33
|
+
* @returns {boolean} Whether cookie was set successfully
|
|
34
|
+
*/
|
|
35
|
+
setCookie(sKey: string, sValue: string | number, vEnd: Date | string | number, sPath?: string, sDomain?: string, bSecure?: boolean): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Remove a cookie
|
|
38
|
+
* @param {string} sKey - Cookie key
|
|
39
|
+
* @param {string} [sPath] - Cookie path
|
|
40
|
+
* @param {string} [sDomain] - Cookie domain
|
|
41
|
+
* @returns {boolean} Whether cookie was removed successfully
|
|
42
|
+
*/
|
|
43
|
+
removeCookie(sKey: string, sPath?: string, sDomain?: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a cookie exists
|
|
46
|
+
* @param {string} sKey - Cookie key
|
|
47
|
+
* @returns {boolean} Whether cookie exists
|
|
48
|
+
*/
|
|
49
|
+
hasCookie(sKey: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get all cookie keys
|
|
52
|
+
* @returns {string[]} Array of cookie keys
|
|
53
|
+
*/
|
|
54
|
+
keys(): string[];
|
|
55
|
+
}
|
|
56
|
+
export type CookiesOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* - Called when cookies are accepted
|
|
59
|
+
*/
|
|
60
|
+
onAccept?: Function;
|
|
61
|
+
/**
|
|
62
|
+
* - Called when cookies are refused
|
|
63
|
+
*/
|
|
64
|
+
onRefuse?: Function;
|
|
65
|
+
/**
|
|
66
|
+
* - Called if user has already consented to cookies
|
|
67
|
+
*/
|
|
68
|
+
alreadyConsented?: Function;
|
|
69
|
+
/**
|
|
70
|
+
* - Called if user has already refused cookies
|
|
71
|
+
*/
|
|
72
|
+
alreadyRefused?: Function;
|
|
73
|
+
/**
|
|
74
|
+
* - Custom function to set cookies
|
|
75
|
+
*/
|
|
76
|
+
setCookies?: Function;
|
|
77
|
+
/**
|
|
78
|
+
* - Custom function to display cookie consent dialog
|
|
79
|
+
*/
|
|
80
|
+
showCC?: Function;
|
|
81
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default class Dataloader {
|
|
2
|
+
static replaceInnerHTML(el: any, url: any): Promise<any>;
|
|
3
|
+
constructor(app: any, $el: any, opts?: {});
|
|
4
|
+
status: string;
|
|
5
|
+
app: any;
|
|
6
|
+
$el: any;
|
|
7
|
+
$canvasEl: any;
|
|
8
|
+
opts: any;
|
|
9
|
+
debounce(func: any, delay?: number): (...args: any[]) => void;
|
|
10
|
+
updateBaseURL(url: any): void;
|
|
11
|
+
baseURL: any;
|
|
12
|
+
initialize(): void;
|
|
13
|
+
$paramEls: any[];
|
|
14
|
+
$moreBtn: any;
|
|
15
|
+
$filterInput: any;
|
|
16
|
+
id: any;
|
|
17
|
+
onFilterInput(e: any): void;
|
|
18
|
+
onMore(e: any): void;
|
|
19
|
+
onParam(e: any): void;
|
|
20
|
+
fetch(addEntries?: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Set [data-loader-loading] on main el
|
|
23
|
+
*/
|
|
24
|
+
loading(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove [data-loader-loading] on main el
|
|
27
|
+
*/
|
|
28
|
+
complete(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Update the MORE button
|
|
31
|
+
*
|
|
32
|
+
* Sets [data-loader-starved] attribute if there is no more to fetch
|
|
33
|
+
*/
|
|
34
|
+
updateButton(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const _default: DOM;
|
|
2
|
+
export default _default;
|
|
3
|
+
/**
|
|
4
|
+
* DOM utility class for simplifying DOM operations
|
|
5
|
+
*/
|
|
6
|
+
declare class DOM {
|
|
7
|
+
body: HTMLElement;
|
|
8
|
+
html: HTMLElement;
|
|
9
|
+
"new"(arg: any): ChildNode[];
|
|
10
|
+
find(arg1: any, arg2: any): any;
|
|
11
|
+
all(arg1: any, arg2: any): any[];
|
|
12
|
+
create(element: any, ...classes: any[]): any;
|
|
13
|
+
append(element: any): void;
|
|
14
|
+
remove(element: any): void;
|
|
15
|
+
addClass(element: any, ...classes: any[]): any;
|
|
16
|
+
removeClass(element: any, ...classes: any[]): any;
|
|
17
|
+
hasClass(element: any, className: any): any;
|
|
18
|
+
toggleClass(element: any, ...classes: any[]): any[];
|
|
19
|
+
hasAttribute(element: any, attributeName: any): any;
|
|
20
|
+
overlapsVertically($div1: any, $div2: any): number;
|
|
21
|
+
outerHeight(el: any): any;
|
|
22
|
+
outerWidth(el: any): any;
|
|
23
|
+
getCSSVar(key: any, element?: HTMLElement): string;
|
|
24
|
+
setCSSVar(key: any, val: any, element?: HTMLElement): void;
|
|
25
|
+
removeCSSVar(key: any, element?: HTMLElement): void;
|
|
26
|
+
offset(el: any): {
|
|
27
|
+
top: any;
|
|
28
|
+
left: any;
|
|
29
|
+
};
|
|
30
|
+
position(el: any): {
|
|
31
|
+
top: any;
|
|
32
|
+
left: any;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Check if parts of `el` is in viewport
|
|
36
|
+
*
|
|
37
|
+
* @param {*} el
|
|
38
|
+
*/
|
|
39
|
+
inViewport(el: any): boolean;
|
|
40
|
+
}
|