pageflow 15.1.0.beta4 → 15.1.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/entry_types/scrolled/package/editor.js +315 -0
- data/entry_types/scrolled/package/frontend.js +2892 -0
- data/entry_types/scrolled/package/package.json +42 -0
- data/lib/pageflow/version.rb +1 -1
- data/packages/pageflow/config/jest/index.js +27 -0
- data/packages/pageflow/config/jest/transformers/cssModules.js +1 -0
- data/packages/pageflow/config/jest/transformers/jst.js +8 -0
- data/packages/pageflow/config/jest/transformers/upwardBabel.js +5 -0
- data/packages/pageflow/config/webpack.js +15 -0
- data/packages/pageflow/editor.js +8465 -0
- data/packages/pageflow/package.json +27 -0
- data/packages/pageflow/testHelpers.js +268 -0
- data/packages/pageflow/ui.js +2708 -0
- metadata +13 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdd026a04cce5cafe6995a71e8b6787e47ce7f6bc3e8e3442707b7eeb8bc4f2b
|
4
|
+
data.tar.gz: 2eb3e985022e4a89e07cea935844d140c8bfde32d24847ca8e6d083d73587947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfc0cca465ec6f3d6e97db760d9cd32868e99576e6cc6e1750ed9b9ebb0820b3dab7b40151e393b75dbc259f1e9a1821dd79e64599b672e4355aea16a2b1012f
|
7
|
+
data.tar.gz: f08aaef98881ada85734829e70c25b004afb4c7cd8d3cb197d1066d5c38bca7d5f7caab0e0716cd9d8da32cd2fb93c497eca3c18efeb373801a1048e4d739a49
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### Version 15.1.0.beta5
|
4
|
+
|
5
|
+
2020-01-29
|
6
|
+
|
7
|
+
[Compare changes](https://github.com/codevise/pageflow/compare/v15.1.0.beta4...v15.1.0.beta5)
|
8
|
+
|
9
|
+
Include `pageflow` and `pageflow-scrolled` packages in gem to allow a
|
10
|
+
host application setup where Yarn uses packages from the gem directory
|
11
|
+
managed by bundler.
|
12
|
+
|
3
13
|
### Version 15.1.0.beta4
|
4
14
|
|
5
15
|
2020-01-29
|
@@ -18,8 +28,20 @@ Forgot to build assets before doing previous release.
|
|
18
28
|
|
19
29
|
##### Host Application
|
20
30
|
|
21
|
-
- Updated
|
31
|
+
- Updated Active Admin to 2.5.0
|
22
32
|
([#1280](https://github.com/codevise/pageflow/pull/1280))
|
33
|
+
|
34
|
+
Starting with Active Admin 2.0, using `unshift` (or any other
|
35
|
+
mutating method) to add load paths no longer work reliably (see
|
36
|
+
[activeadmin/activeadmin#5995](https://github.com/activeadmin/activeadmin/issues/5995).
|
37
|
+
Apply the following change to your host application's
|
38
|
+
`active_admin.rb` initializer:
|
39
|
+
|
40
|
+
```diff
|
41
|
+
- ActiveAdmin.application.unshift(Pageflow.active_admin_load_path)
|
42
|
+
+ ActiveAdmin.application.load_paths +=[Pageflow.active_admin_load_path]
|
43
|
+
```
|
44
|
+
|
23
45
|
- Improve support for Webpack setup in host appplication
|
24
46
|
([#1276](https://github.com/codevise/pageflow/pull/1276),
|
25
47
|
[#1279](https://github.com/codevise/pageflow/pull/1279))
|
@@ -0,0 +1,315 @@
|
|
1
|
+
import * as globalInterop from 'pageflow/editor';
|
2
|
+
import { Entry } from 'pageflow/editor';
|
3
|
+
import Backbone from 'backbone';
|
4
|
+
import Marionette from 'backbone.marionette';
|
5
|
+
import $ from 'jquery';
|
6
|
+
import { cssModulesUtils } from 'pageflow/ui';
|
7
|
+
import React from 'react';
|
8
|
+
|
9
|
+
var Chapter = Backbone.Model.extend({
|
10
|
+
initialize: function initialize() {
|
11
|
+
this.configuration = new Backbone.Model(this.get('configuration'));
|
12
|
+
this.listenTo(this.configuration, 'change', function () {
|
13
|
+
this.trigger('change:configuration', this);
|
14
|
+
});
|
15
|
+
}
|
16
|
+
});
|
17
|
+
|
18
|
+
var ChaptersCollection = Backbone.Collection.extend({
|
19
|
+
model: Chapter
|
20
|
+
});
|
21
|
+
|
22
|
+
var Section = Backbone.Model.extend({
|
23
|
+
initialize: function initialize() {
|
24
|
+
this.configuration = new Backbone.Model(this.get('configuration'));
|
25
|
+
this.listenTo(this.configuration, 'change', function () {
|
26
|
+
this.trigger('change:configuration', this);
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
var SectionsCollection = Backbone.Collection.extend({
|
32
|
+
model: Section
|
33
|
+
});
|
34
|
+
|
35
|
+
var ContentElement = Backbone.Model.extend({
|
36
|
+
initialize: function initialize() {
|
37
|
+
this.configuration = new Backbone.Model(this.get('configuration'));
|
38
|
+
this.listenTo(this.configuration, 'change', function () {
|
39
|
+
this.trigger('change:configuration', this);
|
40
|
+
});
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
var ContentElementsCollection = Backbone.Collection.extend({
|
45
|
+
model: ContentElement
|
46
|
+
});
|
47
|
+
|
48
|
+
var ScrolledEntry = Entry.extend({
|
49
|
+
setupFromEntryTypeSeed: function setupFromEntryTypeSeed(seed) {
|
50
|
+
this.chapters = new ChaptersCollection(seed.collections.chapters);
|
51
|
+
this.sections = new SectionsCollection(seed.collections.sections);
|
52
|
+
this.contentElements = new ContentElementsCollection(seed.collections.contentElements);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
var EntryOutlineView = Marionette.View.extend({
|
57
|
+
className: 'entry_outline',
|
58
|
+
render: function render() {
|
59
|
+
this.$el.text('Outline');
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
|
64
|
+
var RESET = "".concat(PREFIX, "_RESET");
|
65
|
+
var ADD = "".concat(PREFIX, "_ADD");
|
66
|
+
var CHANGE = "".concat(PREFIX, "_CHANGE");
|
67
|
+
var REMOVE = "".concat(PREFIX, "_REMOVE");
|
68
|
+
var SORT = "".concat(PREFIX, "_SORT");
|
69
|
+
|
70
|
+
function watchCollection(collection, _ref2) {
|
71
|
+
var name = _ref2.name,
|
72
|
+
dispatch = _ref2.dispatch,
|
73
|
+
attributes = _ref2.attributes,
|
74
|
+
includeConfiguration = _ref2.includeConfiguration,
|
75
|
+
_ref2$keyAttribute = _ref2.keyAttribute,
|
76
|
+
keyAttribute = _ref2$keyAttribute === void 0 ? 'id' : _ref2$keyAttribute;
|
77
|
+
var options = {
|
78
|
+
attributeNames: attributes,
|
79
|
+
includeConfiguration: includeConfiguration
|
80
|
+
};
|
81
|
+
var watchedAttributeNames = getWatchedAttributeNames(attributes);
|
82
|
+
dispatch({
|
83
|
+
type: RESET,
|
84
|
+
payload: {
|
85
|
+
collectionName: name,
|
86
|
+
keyAttribute: keyAttribute,
|
87
|
+
items: collection.map(function (model) {
|
88
|
+
return getAttributes(model, options);
|
89
|
+
})
|
90
|
+
}
|
91
|
+
});
|
92
|
+
collection.on('add change:id', function (model) {
|
93
|
+
if (!model.isNew()) {
|
94
|
+
dispatch({
|
95
|
+
type: ADD,
|
96
|
+
payload: {
|
97
|
+
collectionName: name,
|
98
|
+
keyAttribute: keyAttribute,
|
99
|
+
order: collection.pluck(keyAttribute),
|
100
|
+
attributes: getAttributes(model, options)
|
101
|
+
}
|
102
|
+
});
|
103
|
+
}
|
104
|
+
});
|
105
|
+
collection.on('change', function (model) {
|
106
|
+
if (hasChangedAttributes(model, watchedAttributeNames)) {
|
107
|
+
dispatch({
|
108
|
+
type: CHANGE,
|
109
|
+
payload: {
|
110
|
+
collectionName: name,
|
111
|
+
keyAttribute: keyAttribute,
|
112
|
+
attributes: getAttributes(model, options)
|
113
|
+
}
|
114
|
+
});
|
115
|
+
}
|
116
|
+
});
|
117
|
+
|
118
|
+
if (includeConfiguration) {
|
119
|
+
collection.on('change:configuration', function (model) {
|
120
|
+
return dispatch({
|
121
|
+
type: CHANGE,
|
122
|
+
payload: {
|
123
|
+
collectionName: name,
|
124
|
+
keyAttribute: keyAttribute,
|
125
|
+
attributes: getAttributes(model, options)
|
126
|
+
}
|
127
|
+
});
|
128
|
+
});
|
129
|
+
}
|
130
|
+
|
131
|
+
collection.on('remove', function (model) {
|
132
|
+
return dispatch({
|
133
|
+
type: REMOVE,
|
134
|
+
payload: {
|
135
|
+
collectionName: name,
|
136
|
+
order: collection.pluck(keyAttribute),
|
137
|
+
key: model.attributes[keyAttribute]
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
collection.on('sort', function (model) {
|
142
|
+
return dispatch({
|
143
|
+
type: SORT,
|
144
|
+
payload: {
|
145
|
+
collectionName: name,
|
146
|
+
order: collection.pluck(keyAttribute)
|
147
|
+
}
|
148
|
+
});
|
149
|
+
});
|
150
|
+
}
|
151
|
+
|
152
|
+
function hasChangedAttributes(model, attributeNames) {
|
153
|
+
return attributeNames.some(function (attributeName) {
|
154
|
+
return model.hasChanged(attributeName);
|
155
|
+
});
|
156
|
+
}
|
157
|
+
|
158
|
+
function getWatchedAttributeNames(attributeNames) {
|
159
|
+
return attributeNames.map(function (attributeName) {
|
160
|
+
return typeof attributeName == 'object' ? mappedAttributeSource(attributeName) : attributeName;
|
161
|
+
});
|
162
|
+
}
|
163
|
+
|
164
|
+
function mappedAttributeSource(attributeName) {
|
165
|
+
return attributeName[Object.keys(attributeName)[0]];
|
166
|
+
}
|
167
|
+
|
168
|
+
function getAttributes(model, _ref3) {
|
169
|
+
var attributeNames = _ref3.attributeNames,
|
170
|
+
includeConfiguration = _ref3.includeConfiguration;
|
171
|
+
var result = attributeNames.reduce(function (result, attributeName) {
|
172
|
+
if (typeof attributeName == 'object') {
|
173
|
+
var key = Object.keys(attributeName)[0];
|
174
|
+
var value = attributeName[key];
|
175
|
+
result[key] = model.get(value);
|
176
|
+
} else {
|
177
|
+
result[attributeName] = model.get(attributeName);
|
178
|
+
}
|
179
|
+
|
180
|
+
return result;
|
181
|
+
}, {});
|
182
|
+
|
183
|
+
if (includeConfiguration) {
|
184
|
+
result.configuration = model.configuration.attributes;
|
185
|
+
}
|
186
|
+
return result;
|
187
|
+
}
|
188
|
+
|
189
|
+
var Context = React.createContext();
|
190
|
+
|
191
|
+
function watchCollections(_ref, _ref2) {
|
192
|
+
var chapters = _ref.chapters,
|
193
|
+
sections = _ref.sections,
|
194
|
+
contentElements = _ref.contentElements,
|
195
|
+
files = _ref.files;
|
196
|
+
var dispatch = _ref2.dispatch;
|
197
|
+
watchCollection(chapters, {
|
198
|
+
name: 'chapters',
|
199
|
+
attributes: ['id', 'permaId'],
|
200
|
+
includeConfiguration: true,
|
201
|
+
dispatch: dispatch
|
202
|
+
});
|
203
|
+
watchCollection(sections, {
|
204
|
+
name: 'sections',
|
205
|
+
attributes: ['id', 'permaId', 'chapterId'],
|
206
|
+
includeConfiguration: true,
|
207
|
+
dispatch: dispatch
|
208
|
+
});
|
209
|
+
watchCollection(contentElements, {
|
210
|
+
name: 'contentElements',
|
211
|
+
attributes: ['id', 'permaId', 'typeName', 'sectionId'],
|
212
|
+
keyAttribute: 'permaId',
|
213
|
+
includeConfiguration: true,
|
214
|
+
dispatch: dispatch
|
215
|
+
});
|
216
|
+
Object.keys(files).forEach(function (collectionName) {
|
217
|
+
watchCollection(files[collectionName], {
|
218
|
+
name: camelize(collectionName),
|
219
|
+
attributes: ['id', {
|
220
|
+
permaId: 'perma_id'
|
221
|
+
}, 'width', 'height', 'basename'],
|
222
|
+
keyAttribute: 'permaId',
|
223
|
+
includeConfiguration: true,
|
224
|
+
dispatch: dispatch
|
225
|
+
});
|
226
|
+
});
|
227
|
+
}
|
228
|
+
|
229
|
+
function camelize(snakeCase) {
|
230
|
+
return snakeCase.replace(/_[a-z]/g, function (match) {
|
231
|
+
return match[1].toUpperCase();
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
235
|
+
function styleInject(css, ref) {
|
236
|
+
if ( ref === void 0 ) ref = {};
|
237
|
+
var insertAt = ref.insertAt;
|
238
|
+
|
239
|
+
if (!css || typeof document === 'undefined') { return; }
|
240
|
+
|
241
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
242
|
+
var style = document.createElement('style');
|
243
|
+
style.type = 'text/css';
|
244
|
+
|
245
|
+
if (insertAt === 'top') {
|
246
|
+
if (head.firstChild) {
|
247
|
+
head.insertBefore(style, head.firstChild);
|
248
|
+
} else {
|
249
|
+
head.appendChild(style);
|
250
|
+
}
|
251
|
+
} else {
|
252
|
+
head.appendChild(style);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (style.styleSheet) {
|
256
|
+
style.styleSheet.cssText = css;
|
257
|
+
} else {
|
258
|
+
style.appendChild(document.createTextNode(css));
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
var css = ".EntryPreviewView-module_root__1Nb6e {\n height: 100%;\n}\n\n.EntryPreviewView-module_iframe__1leJC {\n border: none;\n width: 100%;\n height: 100%;\n}\n";
|
263
|
+
var styles = {"root":"EntryPreviewView-module_root__1Nb6e","iframe":"EntryPreviewView-module_iframe__1leJC"};
|
264
|
+
styleInject(css);
|
265
|
+
|
266
|
+
var EntryPreviewView = Marionette.ItemView.extend({
|
267
|
+
template: function template() {
|
268
|
+
return "\n <iframe class=\"".concat(styles.iframe, "\" />\n ");
|
269
|
+
},
|
270
|
+
className: styles.root,
|
271
|
+
ui: cssModulesUtils.ui(styles, 'iframe'),
|
272
|
+
initialize: function initialize() {
|
273
|
+
this.messageListener = this.onMessage.bind(this);
|
274
|
+
},
|
275
|
+
onShow: function onShow() {
|
276
|
+
window.addEventListener('message', this.messageListener);
|
277
|
+
inject(this.ui.iframe[0], unescape($('[data-template="iframe_seed"]').html()));
|
278
|
+
},
|
279
|
+
onClose: function onClose() {
|
280
|
+
window.removeEventListener('message', this.messageListener);
|
281
|
+
},
|
282
|
+
onMessage: function onMessage(message) {
|
283
|
+
var _this = this;
|
284
|
+
|
285
|
+
if (window.location.href.indexOf(message.origin) === 0 && message.data.type === 'READY') {
|
286
|
+
watchCollections(this.model, {
|
287
|
+
dispatch: function dispatch(action) {
|
288
|
+
return _this.ui.iframe[0].contentWindow.postMessage({
|
289
|
+
type: 'ACTION',
|
290
|
+
payload: action
|
291
|
+
}, window.location.origin);
|
292
|
+
}
|
293
|
+
});
|
294
|
+
}
|
295
|
+
}
|
296
|
+
});
|
297
|
+
|
298
|
+
function inject(iframe, html) {
|
299
|
+
var doc = iframe.document || iframe.contentDocument || iframe.contentWindow.document;
|
300
|
+
doc.open();
|
301
|
+
doc.writeln(html);
|
302
|
+
doc.close();
|
303
|
+
}
|
304
|
+
|
305
|
+
function unescape(text) {
|
306
|
+
return text.replace(/<\\\//g, '</');
|
307
|
+
}
|
308
|
+
|
309
|
+
/*global pageflow*/
|
310
|
+
Object.assign(pageflow, globalInterop);
|
311
|
+
pageflow.editor.registerEntryType('scrolled', {
|
312
|
+
entryModel: ScrolledEntry,
|
313
|
+
previewView: EntryPreviewView,
|
314
|
+
outlineView: EntryOutlineView
|
315
|
+
});
|
@@ -0,0 +1,2892 @@
|
|
1
|
+
import React, { useRef, useLayoutEffect, useEffect, useReducer, useMemo, useContext, useState, useCallback } from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import ReactTooltip from 'react-tooltip';
|
4
|
+
|
5
|
+
function _defineProperty(obj, key, value) {
|
6
|
+
if (key in obj) {
|
7
|
+
Object.defineProperty(obj, key, {
|
8
|
+
value: value,
|
9
|
+
enumerable: true,
|
10
|
+
configurable: true,
|
11
|
+
writable: true
|
12
|
+
});
|
13
|
+
} else {
|
14
|
+
obj[key] = value;
|
15
|
+
}
|
16
|
+
|
17
|
+
return obj;
|
18
|
+
}
|
19
|
+
|
20
|
+
function _arrayWithHoles(arr) {
|
21
|
+
if (Array.isArray(arr)) return arr;
|
22
|
+
}
|
23
|
+
|
24
|
+
function _iterableToArrayLimit(arr, i) {
|
25
|
+
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
|
29
|
+
var _arr = [];
|
30
|
+
var _n = true;
|
31
|
+
var _d = false;
|
32
|
+
var _e = undefined;
|
33
|
+
|
34
|
+
try {
|
35
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
36
|
+
_arr.push(_s.value);
|
37
|
+
|
38
|
+
if (i && _arr.length === i) break;
|
39
|
+
}
|
40
|
+
} catch (err) {
|
41
|
+
_d = true;
|
42
|
+
_e = err;
|
43
|
+
} finally {
|
44
|
+
try {
|
45
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
46
|
+
} finally {
|
47
|
+
if (_d) throw _e;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
return _arr;
|
52
|
+
}
|
53
|
+
|
54
|
+
function _nonIterableRest() {
|
55
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
56
|
+
}
|
57
|
+
|
58
|
+
function _slicedToArray(arr, i) {
|
59
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
60
|
+
}
|
61
|
+
|
62
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
63
|
+
|
64
|
+
function createCommonjsModule(fn, module) {
|
65
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
66
|
+
}
|
67
|
+
|
68
|
+
var classnames = createCommonjsModule(function (module) {
|
69
|
+
/*!
|
70
|
+
Copyright (c) 2017 Jed Watson.
|
71
|
+
Licensed under the MIT License (MIT), see
|
72
|
+
http://jedwatson.github.io/classnames
|
73
|
+
*/
|
74
|
+
/* global define */
|
75
|
+
|
76
|
+
(function () {
|
77
|
+
|
78
|
+
var hasOwn = {}.hasOwnProperty;
|
79
|
+
|
80
|
+
function classNames () {
|
81
|
+
var classes = [];
|
82
|
+
|
83
|
+
for (var i = 0; i < arguments.length; i++) {
|
84
|
+
var arg = arguments[i];
|
85
|
+
if (!arg) continue;
|
86
|
+
|
87
|
+
var argType = typeof arg;
|
88
|
+
|
89
|
+
if (argType === 'string' || argType === 'number') {
|
90
|
+
classes.push(arg);
|
91
|
+
} else if (Array.isArray(arg) && arg.length) {
|
92
|
+
var inner = classNames.apply(null, arg);
|
93
|
+
if (inner) {
|
94
|
+
classes.push(inner);
|
95
|
+
}
|
96
|
+
} else if (argType === 'object') {
|
97
|
+
for (var key in arg) {
|
98
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
99
|
+
classes.push(key);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
return classes.join(' ');
|
106
|
+
}
|
107
|
+
|
108
|
+
if ( module.exports) {
|
109
|
+
classNames.default = classNames;
|
110
|
+
module.exports = classNames;
|
111
|
+
} else {
|
112
|
+
window.classNames = classNames;
|
113
|
+
}
|
114
|
+
}());
|
115
|
+
});
|
116
|
+
|
117
|
+
// from https://github.com/n8tb1t/use-scroll-position
|
118
|
+
var isBrowser = typeof window !== "undefined";
|
119
|
+
|
120
|
+
function getScrollPosition(_ref) {
|
121
|
+
var element = _ref.element,
|
122
|
+
useWindow = _ref.useWindow;
|
123
|
+
if (!isBrowser) return {
|
124
|
+
x: 0,
|
125
|
+
y: 0
|
126
|
+
};
|
127
|
+
var target = element ? element.current : document.body;
|
128
|
+
var position = target.getBoundingClientRect();
|
129
|
+
return useWindow ? {
|
130
|
+
x: window.scrollX,
|
131
|
+
y: window.scrollY
|
132
|
+
} : {
|
133
|
+
x: position.left,
|
134
|
+
y: position.top
|
135
|
+
};
|
136
|
+
}
|
137
|
+
|
138
|
+
function useScrollPosition(effect, deps, element, useWindow, wait) {
|
139
|
+
var position = useRef(getScrollPosition({
|
140
|
+
useWindow: useWindow
|
141
|
+
}));
|
142
|
+
var throttleTimeout = null;
|
143
|
+
|
144
|
+
var callBack = function callBack() {
|
145
|
+
var currPos = getScrollPosition({
|
146
|
+
element: element,
|
147
|
+
useWindow: useWindow
|
148
|
+
});
|
149
|
+
effect({
|
150
|
+
prevPos: position.current,
|
151
|
+
currPos: currPos
|
152
|
+
});
|
153
|
+
position.current = currPos;
|
154
|
+
throttleTimeout = null;
|
155
|
+
};
|
156
|
+
|
157
|
+
useLayoutEffect(function () {
|
158
|
+
if (!isBrowser) {
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
|
162
|
+
var handleScroll = function handleScroll() {
|
163
|
+
if (wait) {
|
164
|
+
if (throttleTimeout === null) {
|
165
|
+
// Todo: store in useRef hook?
|
166
|
+
throttleTimeout = setTimeout(callBack, wait);
|
167
|
+
}
|
168
|
+
} else {
|
169
|
+
callBack();
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
window.addEventListener('scroll', handleScroll);
|
174
|
+
return function () {
|
175
|
+
return window.removeEventListener('scroll', handleScroll);
|
176
|
+
};
|
177
|
+
}, deps);
|
178
|
+
}
|
179
|
+
useScrollPosition.defaultProps = {
|
180
|
+
deps: [],
|
181
|
+
element: false,
|
182
|
+
useWindow: false,
|
183
|
+
wait: null
|
184
|
+
};
|
185
|
+
|
186
|
+
function useNativeScrollPrevention(ref) {
|
187
|
+
useEffect(function () {
|
188
|
+
function preventNativeScroll(e) {
|
189
|
+
e.preventDefault();
|
190
|
+
}
|
191
|
+
|
192
|
+
var current = ref.current;
|
193
|
+
|
194
|
+
if (current) {
|
195
|
+
current.addEventListener('touchmove', preventNativeScroll);
|
196
|
+
current.addEventListener('mousewheel', preventNativeScroll);
|
197
|
+
}
|
198
|
+
|
199
|
+
return function () {
|
200
|
+
if (current) {
|
201
|
+
current.removeEventListener('touchmove', preventNativeScroll);
|
202
|
+
current.removeEventListener('mousewheel', preventNativeScroll);
|
203
|
+
}
|
204
|
+
};
|
205
|
+
}, [ref]);
|
206
|
+
}
|
207
|
+
|
208
|
+
function styleInject(css, ref) {
|
209
|
+
if ( ref === void 0 ) ref = {};
|
210
|
+
var insertAt = ref.insertAt;
|
211
|
+
|
212
|
+
if (!css || typeof document === 'undefined') { return; }
|
213
|
+
|
214
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
215
|
+
var style = document.createElement('style');
|
216
|
+
style.type = 'text/css';
|
217
|
+
|
218
|
+
if (insertAt === 'top') {
|
219
|
+
if (head.firstChild) {
|
220
|
+
head.insertBefore(style, head.firstChild);
|
221
|
+
} else {
|
222
|
+
head.appendChild(style);
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
head.appendChild(style);
|
226
|
+
}
|
227
|
+
|
228
|
+
if (style.styleSheet) {
|
229
|
+
style.styleSheet.cssText = css;
|
230
|
+
} else {
|
231
|
+
style.appendChild(document.createTextNode(css));
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
var css = ".ChapterLink-module_chapterLink__v5VRl {\n line-height: 3rem;\n color: rgb(0, 55, 90);\n text-decoration: none;\n position: relative;\n display: block;\n font-family: inherit;\n font-weight: 700;\n font-size: 1rem;\n}\n\n.ChapterLink-module_chapterLink__v5VRl:hover,\n.ChapterLink-module_chapterLinkActive__jl4h5 {\n color: #e10028;\n}\n\n/* mobile view */\n@media (max-width: 780px) {\n .ChapterLink-module_chapterLink__v5VRl,\n .ChapterLink-module_chapterLink__v5VRl:hover {\n padding: 10px 0px;\n }\n}";
|
236
|
+
var styles = {"chapterLink":"ChapterLink-module_chapterLink__v5VRl","chapterLinkActive":"ChapterLink-module_chapterLinkActive__jl4h5"};
|
237
|
+
styleInject(css);
|
238
|
+
|
239
|
+
var css$1 = ".navigationTooltip {\n opacity: 1 !important;\n border-bottom: 3px solid #e10028;\n box-shadow: 0 0 0.3125rem rgba(0,0,0,.2);\n width: 200px;\n}\n\n.AppHeaderTooltip-module_tooltipHeadline__pul87 {\n margin: 5px 0 0px;\n color: #e10028;\n}\n\n@media (max-width: 780px) {\n .navigationTooltip {\n display: none !important;\n }\n}\n";
|
240
|
+
var styles$1 = {"tooltipHeadline":"AppHeaderTooltip-module_tooltipHeadline__pul87"};
|
241
|
+
styleInject(css$1);
|
242
|
+
|
243
|
+
function AppHeaderTooltip(props) {
|
244
|
+
return React.createElement(ReactTooltip, {
|
245
|
+
id: props.chapterLinkId,
|
246
|
+
type: "light",
|
247
|
+
effect: "solid",
|
248
|
+
className: "navigationTooltip",
|
249
|
+
overridePosition: function overridePosition(_ref) {
|
250
|
+
var left = _ref.left,
|
251
|
+
top = _ref.top;
|
252
|
+
top = 48;
|
253
|
+
return {
|
254
|
+
top: top,
|
255
|
+
left: left
|
256
|
+
};
|
257
|
+
}
|
258
|
+
}, React.createElement("div", null, React.createElement("h3", {
|
259
|
+
className: styles$1.tooltipHeadline
|
260
|
+
}, "Kapitel ", props.chapterIndex), React.createElement("p", null, props.summary)));
|
261
|
+
}
|
262
|
+
|
263
|
+
function ChapterLink(props) {
|
264
|
+
return React.createElement("div", null, React.createElement("a", {
|
265
|
+
className: classnames(styles.chapterLink, _defineProperty({}, styles.chapterLinkActive, props.active)),
|
266
|
+
href: "#chapter-".concat(props.permaId),
|
267
|
+
onClick: function onClick() {
|
268
|
+
return props.handleMenuClick(props.chapterLinkId);
|
269
|
+
},
|
270
|
+
"data-tip": true,
|
271
|
+
"data-for": props.chapterLinkId
|
272
|
+
}, props.title), React.createElement(AppHeaderTooltip, Object.assign({
|
273
|
+
chapterIndex: props.chapterIndex,
|
274
|
+
chapterLinkId: props.chapterLinkId
|
275
|
+
}, props)));
|
276
|
+
}
|
277
|
+
|
278
|
+
var css$2 = "/*!\n * Hamburgers\n * @description Tasty CSS-animated hamburgers\n * @author Jonathan Suh @jonsuh\n * @site https://jonsuh.com/hamburgers\n * @link https://github.com/jonsuh/hamburgers\n */\n.hamburgerIcons-module_hamburger__3XwKv {\n display: inline-block;\n cursor: pointer;\n transition-property: opacity, filter;\n transition-duration: 0.15s;\n transition-timing-function: linear;\n font: inherit;\n color: inherit;\n text-transform: none;\n background-color: transparent;\n border: 0;\n margin: 0;\n overflow: visible;\n}\n\n.hamburgerIcons-module_hamburger__3XwKv.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj,\n.hamburgerIcons-module_hamburger__3XwKv.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj::before,\n.hamburgerIcons-module_hamburger__3XwKv.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj::after {\n background-color: #e10028;\n}\n\n.hamburgerIcons-module_hamburger-box__38Ldp {\n width: 40px;\n height: 24px;\n display: inline-block;\n position: relative;\n}\n\n.hamburgerIcons-module_hamburger-inner__2Colj {\n display: block;\n top: 50%;\n margin-top: -2px;\n}\n\n.hamburgerIcons-module_hamburger-inner__2Colj, .hamburgerIcons-module_hamburger-inner__2Colj::before, .hamburgerIcons-module_hamburger-inner__2Colj::after {\n width: 30px;\n height: 4px;\n background-color: rgb(0, 55, 90);\n border-radius: 4px;\n position: absolute;\n transition-property: transform;\n transition-duration: 0.15s;\n transition-timing-function: ease;\n}\n\n.hamburgerIcons-module_hamburger-inner__2Colj::before, .hamburgerIcons-module_hamburger-inner__2Colj::after {\n content: \"\";\n display: block;\n}\n\n.hamburgerIcons-module_hamburger-inner__2Colj::before {\n top: -10px;\n}\n\n.hamburgerIcons-module_hamburger-inner__2Colj::after {\n bottom: -10px;\n}\n\n/*\n * Collapse\n */\n.hamburgerIcons-module_hamburger--collapse__3Dqee .hamburgerIcons-module_hamburger-inner__2Colj {\n top: auto;\n bottom: 0;\n transition-duration: 0.13s;\n transition-delay: 0.13s;\n transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n}\n\n.hamburgerIcons-module_hamburger--collapse__3Dqee .hamburgerIcons-module_hamburger-inner__2Colj::after {\n top: -20px;\n transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), opacity 0.1s linear;\n}\n\n.hamburgerIcons-module_hamburger--collapse__3Dqee .hamburgerIcons-module_hamburger-inner__2Colj::before {\n transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);\n}\n\n.hamburgerIcons-module_hamburger--collapse__3Dqee.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj {\n transform: translate3d(0, -10px, 0) rotate(-45deg);\n transition-delay: 0.22s;\n transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n}\n\n.hamburgerIcons-module_hamburger--collapse__3Dqee.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj::after {\n top: 0;\n opacity: 0;\n transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), opacity 0.1s 0.22s linear;\n}\n\n.hamburgerIcons-module_hamburger--collapse__3Dqee.hamburgerIcons-module_is-active__3OTNl .hamburgerIcons-module_hamburger-inner__2Colj::before {\n top: 0;\n transform: rotate(-90deg);\n transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);\n}\n";
|
279
|
+
var hamburgerIcons = {"hamburger":"hamburgerIcons-module_hamburger__3XwKv","is-active":"hamburgerIcons-module_is-active__3OTNl","hamburger-inner":"hamburgerIcons-module_hamburger-inner__2Colj","hamburger-box":"hamburgerIcons-module_hamburger-box__38Ldp","hamburger--collapse":"hamburgerIcons-module_hamburger--collapse__3Dqee"};
|
280
|
+
styleInject(css$2);
|
281
|
+
|
282
|
+
var css$3 = "header svg {\n fill: #c2c2c2;\n cursor: pointer;\n}\n\nheader svg:hover {\n fill: rgb(0, 55, 90);;\n}\n\n.AppHeader-module_navigationBar__2EFHw {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n position: sticky;\n top: -50px;\n transition: top .15s;\n z-index: 10000;\n width: 100%;\n text-align: center;\n}\n\n.AppHeader-module_navigationBarExpanded__18nbf {\n top: 0;\n}\n\n.AppHeader-module_navigationBarContentWrapper__2Sf8y {\n position: relative;\n z-index: 2;\n background-color: #fff;\n height: 50px;\n}\n\n.AppHeader-module_menuIcon__5JKuj {\n position: absolute;\n}\n\n.AppHeader-module_wdrLogo__3XGNI {\n position: absolute;\n top: 12px;\n left: 15px;\n width: 80px;\n}\n\n.AppHeader-module_burgerMenuIcon__3isKe {\n display: none;\n top: 12px;\n left: 12px;\n outline: none;\n}\n\n.AppHeader-module_infoIcon__XMTFH {\n top: 12px;\n right: 55px;\n width: 26px;\n}\n\n.AppHeader-module_shareIcon__2lPNl {\n top: 5px;\n right: 10px;\n width: 40px;\n}\n\n.AppHeader-module_chapterList__2lMMD {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\n.AppHeader-module_chapterListItem__28zrc {\n position: relative;\n display: inline-block;\n padding: 0 15px;\n border-right: 1px solid #e9e9e9;\n}\n\n.AppHeader-module_chapterListItem__28zrc:last-of-type {\n border-right: none;\n}\n\n.AppHeader-module_progressBar__17IVu {\n background-color: rgba(194,194,194,0.8);\n height: 8px;\n width: 100%;\n}\n\n.AppHeader-module_progressIndicator__3SlYz {\n position: absolute;\n top: 0;\n left: 0;\n width: 0vw;\n height: 100%;\n background-color: #e10028;\n}\n\n/* mobile view */\n@media (max-width: 780px) {\n .AppHeader-module_burgerMenuIcon__3isKe {\n display: block;\n }\n\n .AppHeader-module_wdrLogo__3XGNI {\n position: inherit;\n }\n\n .AppHeader-module_navigationChapters__1dzyV {\n touch-action: none;\n display: block;\n position: fixed;\n top: 60px;\n left: 0px;\n background: rgba(255, 255, 255, 0.95);\n width: 100vw;\n height: 100vh;\n }\n\n .AppHeader-module_navigationChaptersHidden__8AEPA {\n display: none;\n }\n\n .AppHeader-module_chapterList__2lMMD {\n margin-top: 50px;\n }\n\n .AppHeader-module_chapterListItem__28zrc {\n display: list-item;\n width: 80vw;\n padding: 25px 10vw;\n border-right: none;\n }\n\n .AppHeader-module_chapterListItem__28zrc::before,\n .AppHeader-module_chapterListItem__28zrc::after {\n display: table;\n content: \" \";\n border-top: 1px solid rgb(100, 100, 100);\n width: 30%;\n margin: 0 35%;\n transition: width .15s, margin .15s;\n }\n\n .AppHeader-module_chapterListItem__28zrc:hover::before,\n .AppHeader-module_chapterListItem__28zrc:hover::after {\n border-top: 1px solid rgb(0, 55, 90);\n width: 80%;\n margin: 0 10%;\n }\n\n .AppHeader-module_chapterLink__1Q-ee,\n .AppHeader-module_chapterLink__1Q-ee:hover {\n padding: 10px 0px;\n }\n\n .AppHeader-module_progressBar__17IVu {\n height: 10px;\n }\n}\n";
|
283
|
+
var styles$2 = {"navigationBar":"AppHeader-module_navigationBar__2EFHw","navigationBarExpanded":"AppHeader-module_navigationBarExpanded__18nbf","navigationBarContentWrapper":"AppHeader-module_navigationBarContentWrapper__2Sf8y","menuIcon":"AppHeader-module_menuIcon__5JKuj","wdrLogo":"AppHeader-module_wdrLogo__3XGNI","burgerMenuIcon":"AppHeader-module_burgerMenuIcon__3isKe","infoIcon":"AppHeader-module_infoIcon__XMTFH","shareIcon":"AppHeader-module_shareIcon__2lPNl","chapterList":"AppHeader-module_chapterList__2lMMD","chapterListItem":"AppHeader-module_chapterListItem__28zrc","progressBar":"AppHeader-module_progressBar__17IVu","progressIndicator":"AppHeader-module_progressIndicator__3SlYz","navigationChapters":"AppHeader-module_navigationChapters__1dzyV","navigationChaptersHidden":"AppHeader-module_navigationChaptersHidden__8AEPA","chapterLink":"AppHeader-module_chapterLink__1Q-ee"};
|
284
|
+
styleInject(css$3);
|
285
|
+
|
286
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
287
|
+
if (source == null) return {};
|
288
|
+
var target = {};
|
289
|
+
var sourceKeys = Object.keys(source);
|
290
|
+
var key, i;
|
291
|
+
|
292
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
293
|
+
key = sourceKeys[i];
|
294
|
+
if (excluded.indexOf(key) >= 0) continue;
|
295
|
+
target[key] = source[key];
|
296
|
+
}
|
297
|
+
|
298
|
+
return target;
|
299
|
+
}
|
300
|
+
|
301
|
+
function _objectWithoutProperties(source, excluded) {
|
302
|
+
if (source == null) return {};
|
303
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
304
|
+
var key, i;
|
305
|
+
|
306
|
+
if (Object.getOwnPropertySymbols) {
|
307
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
308
|
+
|
309
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
310
|
+
key = sourceSymbolKeys[i];
|
311
|
+
if (excluded.indexOf(key) >= 0) continue;
|
312
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
313
|
+
target[key] = source[key];
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
return target;
|
318
|
+
}
|
319
|
+
|
320
|
+
function _extends() {
|
321
|
+
_extends = Object.assign || function (target) {
|
322
|
+
for (var i = 1; i < arguments.length; i++) {
|
323
|
+
var source = arguments[i];
|
324
|
+
|
325
|
+
for (var key in source) {
|
326
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
327
|
+
target[key] = source[key];
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
return target;
|
333
|
+
};
|
334
|
+
|
335
|
+
return _extends.apply(this, arguments);
|
336
|
+
}
|
337
|
+
var WDRlogo = (function (_ref) {
|
338
|
+
var _ref$styles = _ref.styles,
|
339
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
340
|
+
|
341
|
+
return React.createElement("svg", _extends({
|
342
|
+
viewBox: "-0.445 -0.445 51.921 15.721"
|
343
|
+
}, props), React.createElement("path", {
|
344
|
+
d: "M31.189 14.83h3.731v-4.772h.285c.425 0 1.496-.023 2.079.919l2.292 3.854h4.015l-2.088-3.509c-.69-1.176-1.258-1.806-1.704-2.13v-.039c1.259-.446 2.636-1.522 2.636-3.715 0-2.716-1.946-4.116-5.394-4.116H31.19v4.689h-.038c-.708-2.829-3.095-4.689-7.453-4.689h-8.253l-1.257 5.516a42.42 42.42 0 00-.488 2.578h-.04s-.284-1.603-.547-2.74l-1.077-5.354h-4.53L6.43 6.676c-.264 1.137-.547 2.74-.547 2.74H5.84s-.222-1.442-.486-2.578L4.097 1.322H0L3.61 14.83h4.121L9.78 6.169h.041l2.048 8.662h4.056L18.93 3.614h.04v11.217h4.606c4.42 0 6.86-2.028 7.577-4.927h.036v4.927zm-7.309-3.062h-1.135V4.384h1.034c2.475 0 3.59 1.095 3.59 3.612 0 2.473-1.115 3.772-3.489 3.772m13.08-4.565h-2.04V4.182h1.918c1.278 0 1.806.506 1.806 1.52 0 .934-.548 1.501-1.684 1.501m12.003-2.317V1.404L45.48 2.66v.865l1.153-.418v2.616l2.33-.838zM47.573 0a3.469 3.469 0 013.459 3.478 3.468 3.468 0 01-3.46 3.477 3.468 3.468 0 01-3.458-3.478A3.469 3.469 0 0147.573 0m0 .51a2.96 2.96 0 00-2.951 2.967 2.96 2.96 0 002.95 2.968 2.96 2.96 0 002.953-2.967A2.96 2.96 0 0047.573.51",
|
345
|
+
fill: "#00375a"
|
346
|
+
}));
|
347
|
+
});
|
348
|
+
|
349
|
+
function _extends$1() {
|
350
|
+
_extends$1 = Object.assign || function (target) {
|
351
|
+
for (var i = 1; i < arguments.length; i++) {
|
352
|
+
var source = arguments[i];
|
353
|
+
|
354
|
+
for (var key in source) {
|
355
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
356
|
+
target[key] = source[key];
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
361
|
+
return target;
|
362
|
+
};
|
363
|
+
|
364
|
+
return _extends$1.apply(this, arguments);
|
365
|
+
}
|
366
|
+
var ShareIcon = (function (_ref) {
|
367
|
+
var _ref$styles = _ref.styles,
|
368
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
369
|
+
|
370
|
+
return React.createElement("svg", _extends$1({
|
371
|
+
xmlns: "http://www.w3.org/2000/svg",
|
372
|
+
viewBox: "0 0 96 96"
|
373
|
+
}, props), React.createElement("path", {
|
374
|
+
d: "M67.5 18c-5.1 0-9.3 4.2-9.3 9.3 0 .5.1 1.1.2 1.6l-23 12.9c-1.7-1.8-4.1-3-6.8-3-5.1 0-9.3 4.1-9.3 9.3 0 5.1 4.1 9.3 9.3 9.3 2.7 0 5.2-1.2 6.9-3.1l22.8 13.4c0 .4-.1.7-.1 1.1 0 5.1 4.1 9.3 9.3 9.3 5.1 0 9.3-4.1 9.3-9.3 0-5.1-4.1-9.3-9.3-9.3-2.8 0-5.4 1.3-7.1 3.3L37.7 49.4c.1-.4.1-.9.1-1.3 0-.5 0-1-.1-1.5l23.1-13c1.7 1.8 4.1 3 6.8 3 5.1 0 9.3-4.1 9.3-9.3-.1-5.1-4.3-9.3-9.4-9.3z"
|
375
|
+
}));
|
376
|
+
});
|
377
|
+
|
378
|
+
function _extends$2() {
|
379
|
+
_extends$2 = Object.assign || function (target) {
|
380
|
+
for (var i = 1; i < arguments.length; i++) {
|
381
|
+
var source = arguments[i];
|
382
|
+
|
383
|
+
for (var key in source) {
|
384
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
385
|
+
target[key] = source[key];
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
return target;
|
391
|
+
};
|
392
|
+
|
393
|
+
return _extends$2.apply(this, arguments);
|
394
|
+
}
|
395
|
+
var InfoIcon = (function (_ref) {
|
396
|
+
var _ref$styles = _ref.styles,
|
397
|
+
props = _objectWithoutProperties(_ref, ["styles"]);
|
398
|
+
|
399
|
+
return React.createElement("svg", _extends$2({
|
400
|
+
xmlns: "http://www.w3.org/2000/svg",
|
401
|
+
viewBox: "0 0 330 330"
|
402
|
+
}, props), React.createElement("path", {
|
403
|
+
d: "M165 0C74.019 0 0 74.02 0 165.001 0 255.982 74.019 330 165 330s165-74.018 165-164.999S255.981 0 165 0zm0 300c-74.44 0-135-60.56-135-134.999S90.56 30 165 30s135 60.562 135 135.001C300 239.44 239.439 300 165 300z"
|
404
|
+
}), React.createElement("path", {
|
405
|
+
d: "M164.998 70c-11.026 0-19.996 8.976-19.996 20.009 0 11.023 8.97 19.991 19.996 19.991 11.026 0 19.996-8.968 19.996-19.991 0-11.033-8.97-20.009-19.996-20.009zm.002 70c-8.284 0-15 6.716-15 15v90c0 8.284 6.716 15 15 15 8.284 0 15-6.716 15-15v-90c0-8.284-6.716-15-15-15z"
|
406
|
+
}));
|
407
|
+
});
|
408
|
+
|
409
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
410
|
+
|
411
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
412
|
+
var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
|
413
|
+
var RESET = "".concat(PREFIX, "_RESET");
|
414
|
+
var ADD = "".concat(PREFIX, "_ADD");
|
415
|
+
var CHANGE = "".concat(PREFIX, "_CHANGE");
|
416
|
+
var REMOVE = "".concat(PREFIX, "_REMOVE");
|
417
|
+
var SORT = "".concat(PREFIX, "_SORT");
|
418
|
+
function useCollections() {
|
419
|
+
var seed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
420
|
+
|
421
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
422
|
+
keyAttribute = _ref.keyAttribute;
|
423
|
+
|
424
|
+
return useReducer(reducer, Object.keys(seed).reduce(function (result, key) {
|
425
|
+
result[key] = init(seed[key], keyAttribute);
|
426
|
+
return result;
|
427
|
+
}, {}));
|
428
|
+
}
|
429
|
+
|
430
|
+
function reducer(state, action) {
|
431
|
+
var collectionName = action.payload.collectionName;
|
432
|
+
var keyAttribute = action.payload.keyAttribute;
|
433
|
+
|
434
|
+
switch (action.type) {
|
435
|
+
case RESET:
|
436
|
+
return _objectSpread({}, state, _defineProperty({}, collectionName, init(action.payload.items, keyAttribute)));
|
437
|
+
|
438
|
+
case ADD:
|
439
|
+
return _objectSpread({}, state, _defineProperty({}, collectionName, {
|
440
|
+
order: action.payload.order,
|
441
|
+
items: _objectSpread({}, state[collectionName].items, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
442
|
+
}));
|
443
|
+
|
444
|
+
case CHANGE:
|
445
|
+
return _objectSpread({}, state, _defineProperty({}, collectionName, {
|
446
|
+
order: state[collectionName].order,
|
447
|
+
items: _objectSpread({}, state[collectionName].items, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
448
|
+
}));
|
449
|
+
|
450
|
+
case REMOVE:
|
451
|
+
var clonedItems = _objectSpread({}, state[collectionName].items);
|
452
|
+
|
453
|
+
delete clonedItems[action.payload.key];
|
454
|
+
return _objectSpread({}, state, _defineProperty({}, collectionName, {
|
455
|
+
order: action.payload.order,
|
456
|
+
items: clonedItems
|
457
|
+
}));
|
458
|
+
|
459
|
+
case SORT:
|
460
|
+
return _objectSpread({}, state, _defineProperty({}, collectionName, {
|
461
|
+
order: action.payload.order,
|
462
|
+
items: state[collectionName].items
|
463
|
+
}));
|
464
|
+
|
465
|
+
default:
|
466
|
+
return state;
|
467
|
+
}
|
468
|
+
}
|
469
|
+
|
470
|
+
function init(items) {
|
471
|
+
var keyAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
472
|
+
return {
|
473
|
+
order: items.map(function (item) {
|
474
|
+
return item[keyAttribute];
|
475
|
+
}),
|
476
|
+
items: items.reduce(function (result, item) {
|
477
|
+
result[item[keyAttribute]] = item;
|
478
|
+
return result;
|
479
|
+
}, {})
|
480
|
+
};
|
481
|
+
}
|
482
|
+
|
483
|
+
function getItems(state, collectionName) {
|
484
|
+
if (state[collectionName]) {
|
485
|
+
var items = state[collectionName].items;
|
486
|
+
return state[collectionName].order.map(function (key) {
|
487
|
+
return items[key];
|
488
|
+
});
|
489
|
+
} else {
|
490
|
+
return [];
|
491
|
+
}
|
492
|
+
}
|
493
|
+
function getItem(state, collectionName, key) {
|
494
|
+
if (state[collectionName]) {
|
495
|
+
return state[collectionName].items[key];
|
496
|
+
}
|
497
|
+
}
|
498
|
+
|
499
|
+
var Context = React.createContext();
|
500
|
+
function EntryStateProvider(_ref) {
|
501
|
+
var seed = _ref.seed,
|
502
|
+
children = _ref.children;
|
503
|
+
|
504
|
+
var _useCollections = useCollections(seed.collections, {
|
505
|
+
keyAttribute: 'permaId'
|
506
|
+
}),
|
507
|
+
_useCollections2 = _slicedToArray(_useCollections, 2),
|
508
|
+
collections = _useCollections2[0],
|
509
|
+
dispatch = _useCollections2[1];
|
510
|
+
|
511
|
+
var value = useMemo(function () {
|
512
|
+
return {
|
513
|
+
entryState: {
|
514
|
+
collections: collections,
|
515
|
+
config: seed.config
|
516
|
+
},
|
517
|
+
dispatch: dispatch
|
518
|
+
};
|
519
|
+
}, [collections, dispatch, seed]);
|
520
|
+
return React.createElement(Context.Provider, {
|
521
|
+
value: value
|
522
|
+
}, children);
|
523
|
+
}
|
524
|
+
function useEntryState() {
|
525
|
+
var value = useContext(Context);
|
526
|
+
return value.entryState;
|
527
|
+
}
|
528
|
+
function useEntryStateDispatch() {
|
529
|
+
var value = useContext(Context);
|
530
|
+
return value.dispatch;
|
531
|
+
}
|
532
|
+
|
533
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
534
|
+
|
535
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
536
|
+
/**
|
537
|
+
* Returns a nested data structure representing the chapters, sections
|
538
|
+
* and content elements of the entry.
|
539
|
+
*
|
540
|
+
* @example
|
541
|
+
*
|
542
|
+
* const structure = useEntryStructure();
|
543
|
+
* structure // =>
|
544
|
+
* [
|
545
|
+
* {
|
546
|
+
* permaId: 5,
|
547
|
+
* title: 'Chapter 1',
|
548
|
+
* summary: 'An introductory chapter',
|
549
|
+
* sections: [
|
550
|
+
* {
|
551
|
+
* permaId: 101,
|
552
|
+
* sectionIndex: 0,
|
553
|
+
* transition: 'scroll',
|
554
|
+
*
|
555
|
+
* // references to adjacent section objects
|
556
|
+
* previousSection: { ... },
|
557
|
+
* nextSection: { ... },
|
558
|
+
*
|
559
|
+
* foreground: [
|
560
|
+
* {
|
561
|
+
* type: 'heading',
|
562
|
+
* props: {
|
563
|
+
* children: 'Heading'
|
564
|
+
* }
|
565
|
+
* },
|
566
|
+
* {
|
567
|
+
* type: 'textBlock',
|
568
|
+
* props: {
|
569
|
+
* children: 'Some text'
|
570
|
+
* }
|
571
|
+
* }
|
572
|
+
* ]
|
573
|
+
* }
|
574
|
+
* ],
|
575
|
+
* }
|
576
|
+
* ]
|
577
|
+
*/
|
578
|
+
|
579
|
+
function useEntryStructure() {
|
580
|
+
var entryState = useEntryState();
|
581
|
+
return useMemo(function () {
|
582
|
+
var sections = [];
|
583
|
+
var chapters = getItems(entryState.collections, 'chapters').map(function (chapter) {
|
584
|
+
return _objectSpread$1({
|
585
|
+
permaId: chapter.permaId
|
586
|
+
}, chapter.configuration, {
|
587
|
+
sections: getItems(entryState.collections, 'sections').filter(function (item) {
|
588
|
+
return item.chapterId === chapter.id;
|
589
|
+
}).map(function (section) {
|
590
|
+
var result = sectionStructure(entryState.collections, section);
|
591
|
+
sections.push(result);
|
592
|
+
return result;
|
593
|
+
})
|
594
|
+
});
|
595
|
+
});
|
596
|
+
sections.forEach(function (section, index) {
|
597
|
+
section.sectionIndex = index;
|
598
|
+
section.previousSection = sections[index - 1];
|
599
|
+
section.nextSection = sections[index + 1];
|
600
|
+
});
|
601
|
+
return chapters;
|
602
|
+
}, [entryState]);
|
603
|
+
}
|
604
|
+
|
605
|
+
function sectionStructure(collections, section) {
|
606
|
+
return section && _objectSpread$1({
|
607
|
+
permaId: section.permaId
|
608
|
+
}, section.configuration, {
|
609
|
+
foreground: getItems(collections, 'contentElements').filter(function (item) {
|
610
|
+
return item.sectionId === section.id;
|
611
|
+
}).map(function (item) {
|
612
|
+
return {
|
613
|
+
type: item.typeName,
|
614
|
+
position: item.configuration.position,
|
615
|
+
props: item.configuration
|
616
|
+
};
|
617
|
+
})
|
618
|
+
});
|
619
|
+
}
|
620
|
+
|
621
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
622
|
+
|
623
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
624
|
+
|
625
|
+
function expandUrls(collectionName, file, urlTemplates) {
|
626
|
+
if (!file) {
|
627
|
+
return null;
|
628
|
+
}
|
629
|
+
|
630
|
+
if (!urlTemplates[collectionName]) {
|
631
|
+
throw new Error("No file url templates found for ".concat(collectionName));
|
632
|
+
}
|
633
|
+
|
634
|
+
var variants = file.variants || Object.keys(urlTemplates[collectionName]);
|
635
|
+
var urls = variants.reduce(function (result, variant) {
|
636
|
+
var url = getFileUrl(collectionName, file, variant, urlTemplates);
|
637
|
+
|
638
|
+
if (url) {
|
639
|
+
result[variant] = url;
|
640
|
+
}
|
641
|
+
|
642
|
+
return result;
|
643
|
+
}, {});
|
644
|
+
return _objectSpread$2({
|
645
|
+
urls: urls
|
646
|
+
}, file);
|
647
|
+
}
|
648
|
+
|
649
|
+
function getFileUrl(collectionName, file, quality, urlTemplates) {
|
650
|
+
var templates = urlTemplates[collectionName];
|
651
|
+
var template = templates[quality];
|
652
|
+
|
653
|
+
if (template) {
|
654
|
+
return template.replace(':id_partition', idPartition(file.id)).replace(':basename', file.basename);
|
655
|
+
}
|
656
|
+
}
|
657
|
+
|
658
|
+
function idPartition(id) {
|
659
|
+
return partition(pad(id, 9));
|
660
|
+
}
|
661
|
+
|
662
|
+
function partition(string, separator) {
|
663
|
+
return string.replace(/./g, function (c, i, a) {
|
664
|
+
return i && (a.length - i) % 3 === 0 ? '/' + c : c;
|
665
|
+
});
|
666
|
+
}
|
667
|
+
|
668
|
+
function pad(string, size) {
|
669
|
+
return (Array(size).fill(0).join('') + string).slice(-size);
|
670
|
+
}
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Look up a file by its collection and perma id.
|
674
|
+
*
|
675
|
+
* @param {Object} options
|
676
|
+
* @param {String} options.collectionName - Collection name of file type to look for (in camel case).
|
677
|
+
* @param {String} options.permaId - Perma id of file look up
|
678
|
+
*
|
679
|
+
* @example
|
680
|
+
* const imageFile = useFile({collectionName: 'imageFiles', permaId: 5});
|
681
|
+
* imageFile // =>
|
682
|
+
* {
|
683
|
+
* id: 102,
|
684
|
+
* permaId: 5,
|
685
|
+
* width: 1000,
|
686
|
+
* height: 500,
|
687
|
+
* urls: {
|
688
|
+
* large: 'https://...'
|
689
|
+
* },
|
690
|
+
* }
|
691
|
+
*/
|
692
|
+
|
693
|
+
function useFile(_ref) {
|
694
|
+
var collectionName = _ref.collectionName,
|
695
|
+
permaId = _ref.permaId;
|
696
|
+
var entryState = useEntryState();
|
697
|
+
return expandUrls(collectionName, getItem(entryState.collections, collectionName, permaId), entryState.config.fileUrlTemplates);
|
698
|
+
}
|
699
|
+
|
700
|
+
function AppHeader(props) {
|
701
|
+
var _useState = useState(true),
|
702
|
+
_useState2 = _slicedToArray(_useState, 2),
|
703
|
+
navExpanded = _useState2[0],
|
704
|
+
setNavExpanded = _useState2[1];
|
705
|
+
|
706
|
+
var _useState3 = useState(true),
|
707
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
708
|
+
mobileNavHidden = _useState4[0],
|
709
|
+
setMobileNavHidden = _useState4[1];
|
710
|
+
|
711
|
+
var _useState5 = useState(0),
|
712
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
713
|
+
readingProgress = _useState6[0],
|
714
|
+
setReadingProgress = _useState6[1];
|
715
|
+
|
716
|
+
var _useState7 = useState('chapterLink1'),
|
717
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
718
|
+
activeChapterLink = _useState8[0],
|
719
|
+
setActiveChapterLink = _useState8[1];
|
720
|
+
|
721
|
+
var entryStructure = useEntryStructure();
|
722
|
+
var ref = useRef();
|
723
|
+
useNativeScrollPrevention(ref);
|
724
|
+
var chapters = entryStructure.map(function (chapter) {
|
725
|
+
return {
|
726
|
+
permaId: chapter.permaId,
|
727
|
+
title: chapter.title,
|
728
|
+
summary: chapter.summary
|
729
|
+
};
|
730
|
+
});
|
731
|
+
useScrollPosition(function (_ref) {
|
732
|
+
var prevPos = _ref.prevPos,
|
733
|
+
currPos = _ref.currPos;
|
734
|
+
var expand = currPos.y > prevPos.y;
|
735
|
+
if (expand !== navExpanded) setNavExpanded(expand);
|
736
|
+
}, [navExpanded]);
|
737
|
+
useScrollPosition(function (_ref2) {
|
738
|
+
var prevPos = _ref2.prevPos,
|
739
|
+
currPos = _ref2.currPos;
|
740
|
+
var current = currPos.y * -1; // Todo: Memoize and update on window resize
|
741
|
+
|
742
|
+
var total = document.body.clientHeight - window.innerHeight;
|
743
|
+
var progress = Math.abs(current / total) * 100;
|
744
|
+
setReadingProgress(progress);
|
745
|
+
}, [readingProgress], null, false, 1);
|
746
|
+
|
747
|
+
function handleProgressBarMouseEnter() {
|
748
|
+
setNavExpanded(true);
|
749
|
+
}
|
750
|
+
|
751
|
+
function handleBurgerMenuClick() {
|
752
|
+
setMobileNavHidden(!mobileNavHidden);
|
753
|
+
}
|
754
|
+
|
755
|
+
function handleMenuClick(chapterLinkId) {
|
756
|
+
setActiveChapterLink(chapterLinkId);
|
757
|
+
setMobileNavHidden(true);
|
758
|
+
}
|
759
|
+
|
760
|
+
function renderMenuLinks(chapters) {
|
761
|
+
return chapters.map(function (chapter, index) {
|
762
|
+
var chapterIndex = index + 1;
|
763
|
+
var chapterLinkId = "chapterLink".concat(chapterIndex);
|
764
|
+
return React.createElement("li", {
|
765
|
+
key: index,
|
766
|
+
className: styles$2.chapterListItem
|
767
|
+
}, React.createElement(ChapterLink, Object.assign({}, chapter, {
|
768
|
+
chapterIndex: chapterIndex,
|
769
|
+
chapterLinkId: chapterLinkId,
|
770
|
+
active: activeChapterLink === chapterLinkId,
|
771
|
+
handleMenuClick: handleMenuClick
|
772
|
+
})));
|
773
|
+
});
|
774
|
+
}
|
775
|
+
return React.createElement("header", {
|
776
|
+
className: classnames(styles$2.navigationBar, _defineProperty({}, styles$2.navigationBarExpanded, navExpanded))
|
777
|
+
}, React.createElement("div", {
|
778
|
+
className: styles$2.navigationBarContentWrapper
|
779
|
+
}, React.createElement("button", {
|
780
|
+
className: classnames(styles$2.menuIcon, styles$2.burgerMenuIcon, hamburgerIcons.hamburger, hamburgerIcons['hamburger--collapse'], _defineProperty({}, hamburgerIcons['is-active'], !mobileNavHidden)),
|
781
|
+
type: "button",
|
782
|
+
onClick: handleBurgerMenuClick
|
783
|
+
}, React.createElement("span", {
|
784
|
+
className: hamburgerIcons['hamburger-box']
|
785
|
+
}, React.createElement("span", {
|
786
|
+
className: hamburgerIcons['hamburger-inner']
|
787
|
+
}))), React.createElement(WDRlogo, {
|
788
|
+
className: classnames(styles$2.wdrLogo)
|
789
|
+
}), React.createElement("nav", {
|
790
|
+
className: classnames(styles$2.navigationChapters, _defineProperty({}, styles$2.navigationChaptersHidden, mobileNavHidden)),
|
791
|
+
role: "navigation",
|
792
|
+
ref: ref
|
793
|
+
}, React.createElement("ul", {
|
794
|
+
className: styles$2.chapterList
|
795
|
+
}, renderMenuLinks(chapters))), React.createElement("a", {
|
796
|
+
className: classnames(styles$2.menuIcon, styles$2.infoIcon)
|
797
|
+
}, React.createElement(InfoIcon, null)), React.createElement("a", {
|
798
|
+
className: classnames(styles$2.menuIcon, styles$2.shareIcon)
|
799
|
+
}, React.createElement(ShareIcon, null))), React.createElement("div", {
|
800
|
+
className: styles$2.progressBar,
|
801
|
+
onMouseEnter: handleProgressBarMouseEnter
|
802
|
+
}, React.createElement("span", {
|
803
|
+
className: styles$2.progressIndicator,
|
804
|
+
style: {
|
805
|
+
width: readingProgress + '%'
|
806
|
+
}
|
807
|
+
})));
|
808
|
+
}
|
809
|
+
|
810
|
+
function useOnScreen(ref) {
|
811
|
+
var rootMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0px';
|
812
|
+
var cb = arguments.length > 2 ? arguments[2] : undefined;
|
813
|
+
|
814
|
+
var _useState = useState(false),
|
815
|
+
_useState2 = _slicedToArray(_useState, 2),
|
816
|
+
isIntersecting = _useState2[0],
|
817
|
+
setIntersecting = _useState2[1];
|
818
|
+
|
819
|
+
useEffect(function () {
|
820
|
+
var current = ref.current;
|
821
|
+
var observer = new IntersectionObserver(function (_ref) {
|
822
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
823
|
+
entry = _ref2[0];
|
824
|
+
|
825
|
+
setIntersecting(entry.isIntersecting);
|
826
|
+
|
827
|
+
if (entry.isIntersecting && cb) {
|
828
|
+
cb();
|
829
|
+
}
|
830
|
+
}, {
|
831
|
+
rootMargin: rootMargin
|
832
|
+
});
|
833
|
+
|
834
|
+
if (ref.current) {
|
835
|
+
observer.observe(current);
|
836
|
+
}
|
837
|
+
|
838
|
+
return function () {
|
839
|
+
observer.unobserve(current);
|
840
|
+
};
|
841
|
+
}, [ref, rootMargin, cb]);
|
842
|
+
return isIntersecting;
|
843
|
+
}
|
844
|
+
|
845
|
+
var css$4 = ".Fullscreen-module_root__1N3CI {\n width: 100%;\n height: 100vh;\n position: relative;\n overflow: hidden;\n}\n";
|
846
|
+
var styles$3 = {"root":"Fullscreen-module_root__1N3CI"};
|
847
|
+
styleInject(css$4);
|
848
|
+
|
849
|
+
var Fullscreen = React.forwardRef(function Fullscreen(props, ref) {
|
850
|
+
return React.createElement("div", {
|
851
|
+
ref: ref,
|
852
|
+
className: styles$3.root
|
853
|
+
}, props.children);
|
854
|
+
});
|
855
|
+
|
856
|
+
var css$5 = ".Image-module_root__1ef3j {\n background-size: cover;\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n}\n\n@media (orientation: landscape) {\n .Image-module_portrait__1mRha {\n display: none;\n }\n}\n\n@media (orientation: portrait) {\n .Image-module_portrait__1mRha {\n display: block;\n }\n}";
|
857
|
+
var styles$4 = {"root":"Image-module_root__1ef3j","portrait":"Image-module_portrait__1mRha"};
|
858
|
+
styleInject(css$5);
|
859
|
+
|
860
|
+
/**
|
861
|
+
* Render an image file.
|
862
|
+
*
|
863
|
+
* @param {Object} props
|
864
|
+
* @param {number} props.id - Perma id of the image file.
|
865
|
+
*/
|
866
|
+
|
867
|
+
function Image(props) {
|
868
|
+
var image = useFile({
|
869
|
+
collectionName: 'imageFiles',
|
870
|
+
permaId: props.id
|
871
|
+
});
|
872
|
+
|
873
|
+
if (image) {
|
874
|
+
var focusX = typeof image.configuration.focusX === 'undefined' ? 50 : image.configuration.focusX;
|
875
|
+
var focusY = typeof image.configuration.focusY === 'undefined' ? 50 : image.configuration.focusY;
|
876
|
+
return React.createElement("div", {
|
877
|
+
className: classnames(styles$4.root, _defineProperty({}, styles$4.portrait, props.mobile)),
|
878
|
+
role: "img",
|
879
|
+
style: {
|
880
|
+
backgroundImage: "url(".concat(image.urls.large, ")"),
|
881
|
+
backgroundPosition: "".concat(focusX, "% ").concat(focusY, "%")
|
882
|
+
}
|
883
|
+
});
|
884
|
+
}
|
885
|
+
|
886
|
+
return null;
|
887
|
+
}
|
888
|
+
|
889
|
+
var ScrollToSectionContext = React.createContext();
|
890
|
+
|
891
|
+
var MutedContext = React.createContext();
|
892
|
+
|
893
|
+
var css$6 = ".Video-module_root__30u0y {\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n}\n\n.Video-module_video__3FJvj {\n width: 100%;\n height: 100%;\n transition: transform ease 0.2s;\n outline: none;\n}\n\n.Video-module_video__3FJvj:focus {\n outline: none;\n}\n\n.Video-module_backdrop__1R7f4 {\n object-fit: cover;\n}\n";
|
894
|
+
var styles$5 = {"root":"Video-module_root__30u0y","video":"Video-module_video__3FJvj","backdrop":"Video-module_backdrop__1R7f4"};
|
895
|
+
styleInject(css$6);
|
896
|
+
|
897
|
+
function Video(props) {
|
898
|
+
var awsBucket = '//s3-eu-west-1.amazonaws.com/de.codevise.pageflow.development/pageflow-next/presentation-videos/';
|
899
|
+
var videoBoatSunset = awsBucket + 'floodplain-clean.mp4';
|
900
|
+
var poster_videoBoatSunset = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
901
|
+
var videoBoatDark = awsBucket + 'floodplain-dirty.mp4';
|
902
|
+
var poster_videoBoatDark = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
903
|
+
var videoKaterchen = awsBucket + 'katerchen.mp4';
|
904
|
+
var poster_videoKaterchen = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
905
|
+
var videoGarzweilerLoop1 = awsBucket + 'braunkohle_loop1.mp4';
|
906
|
+
var poster_videoGarzweilerLoop1 = awsBucket + 'posterframes/poster_braunkohle_loop1.jpeg';
|
907
|
+
var videoGarzweilerLoop2 = awsBucket + 'braunkohle_loop2.mp4';
|
908
|
+
var poster_videoGarzweilerLoop2 = awsBucket + 'posterframes/poster_braunkohle_loop2.jpeg';
|
909
|
+
var videoGarzweilerDrohne = awsBucket + 'braunkohle_drone.mp4';
|
910
|
+
var poster_videoGarzweilerDrohne = awsBucket + 'posterframes/poster_braunkohle_drone.jpeg';
|
911
|
+
var videoInselInterviewToni = awsBucket + 'pageflow_insel_interview_toni02.mp4';
|
912
|
+
var poster_videoInselInterviewToni = awsBucket + 'posterframes/poster_pageflow_insel_interview_toni02.jpg';
|
913
|
+
var videoUrl = {
|
914
|
+
videoBoatSunset: videoBoatSunset,
|
915
|
+
videoBoatDark: videoBoatDark,
|
916
|
+
videoKaterchen: videoKaterchen,
|
917
|
+
videoGarzweilerLoop1: videoGarzweilerLoop1,
|
918
|
+
videoGarzweilerLoop2: videoGarzweilerLoop2,
|
919
|
+
videoGarzweilerDrohne: videoGarzweilerDrohne,
|
920
|
+
videoInselInterviewToni: videoInselInterviewToni
|
921
|
+
}[props.id];
|
922
|
+
var posterUrl = {
|
923
|
+
poster_videoBoatSunset: poster_videoBoatSunset,
|
924
|
+
poster_videoBoatDark: poster_videoBoatDark,
|
925
|
+
poster_videoKaterchen: poster_videoKaterchen,
|
926
|
+
poster_videoGarzweilerLoop1: poster_videoGarzweilerLoop1,
|
927
|
+
poster_videoGarzweilerLoop2: poster_videoGarzweilerLoop2,
|
928
|
+
poster_videoGarzweilerDrohne: poster_videoGarzweilerDrohne,
|
929
|
+
poster_videoInselInterviewToni: poster_videoInselInterviewToni
|
930
|
+
}['poster_' + props.id];
|
931
|
+
var videoRef = useRef();
|
932
|
+
var state = props.state;
|
933
|
+
useEffect(function () {
|
934
|
+
var video = videoRef.current;
|
935
|
+
|
936
|
+
if (video) {
|
937
|
+
if (state === 'active') {
|
938
|
+
if (video.readyState > 0) {
|
939
|
+
video.play();
|
940
|
+
} else {
|
941
|
+
video.addEventListener('loadedmetadata', play);
|
942
|
+
return function () {
|
943
|
+
return video.removeEventListener('loadedmetadata', play);
|
944
|
+
};
|
945
|
+
}
|
946
|
+
} else {
|
947
|
+
video.pause();
|
948
|
+
}
|
949
|
+
}
|
950
|
+
|
951
|
+
function play() {
|
952
|
+
video.play();
|
953
|
+
}
|
954
|
+
}, [state, videoRef]);
|
955
|
+
return React.createElement("div", {
|
956
|
+
className: styles$5.root
|
957
|
+
}, React.createElement(MutedContext.Consumer, null, function (mutedSettings) {
|
958
|
+
return React.createElement(ScrollToSectionContext.Consumer, null, function (scrollToSection) {
|
959
|
+
return React.createElement("video", {
|
960
|
+
src: videoUrl,
|
961
|
+
ref: videoRef,
|
962
|
+
className: classnames(styles$5.video, _defineProperty({}, styles$5.backdrop, !props.interactive)),
|
963
|
+
controls: props.controls,
|
964
|
+
playsInline: true,
|
965
|
+
onEnded: function onEnded() {
|
966
|
+
return props.nextSectionOnEnd && scrollToSection('next');
|
967
|
+
},
|
968
|
+
loop: !props.interactive,
|
969
|
+
muted: mutedSettings.muted,
|
970
|
+
poster: posterUrl
|
971
|
+
});
|
972
|
+
});
|
973
|
+
}));
|
974
|
+
}
|
975
|
+
Video.defaultProps = {
|
976
|
+
interactive: false,
|
977
|
+
controls: false
|
978
|
+
};
|
979
|
+
|
980
|
+
var css$7 = ".FillColor-module_FillColor__S1uEG {\n width: 100%;\n height: 100vh;\n}\n";
|
981
|
+
var styles$6 = {"FillColor":"FillColor-module_FillColor__S1uEG"};
|
982
|
+
styleInject(css$7);
|
983
|
+
|
984
|
+
function FillColor(props) {
|
985
|
+
return React.createElement("div", {
|
986
|
+
className: styles$6.FillColor,
|
987
|
+
style: {
|
988
|
+
backgroundColor: props.color
|
989
|
+
}
|
990
|
+
});
|
991
|
+
}
|
992
|
+
|
993
|
+
var css$8 = ".MotifArea-module_root__1_ACd {\n position: absolute;\n background: hsla(0, 0%, 100%, 0.2);\n z-index: 2;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n\n.MotifArea-module_active__1q4z2 {\n opacity: 1;\n}\n\n.MotifArea-module_corner__3hB5t {\n position: absolute;\n width: 10px;\n height: 10px;\n}\n\n.MotifArea-module_topLeft__3vHHi {\n border-top: solid 2px #fff;\n border-left: solid 2px #fff;\n}\n\n.MotifArea-module_topRight__2gNmC {\n right: 0;\n border-top: solid 2px #fff;\n border-right: solid 2px #fff;\n}\n\n.MotifArea-module_bottomLeft__2qEqb {\n bottom: 0;\n border-bottom: solid 2px #fff;\n border-left: solid 2px #fff;\n}\n\n.MotifArea-module_bottomRight__3OjTb {\n right: 0;\n bottom: 0;\n border-bottom: solid 2px #fff;\n border-right: solid 2px #fff;\n}\n";
|
994
|
+
var styles$7 = {"root":"MotifArea-module_root__1_ACd","active":"MotifArea-module_active__1q4z2","corner":"MotifArea-module_corner__3hB5t","topLeft":"MotifArea-module_topLeft__3vHHi MotifArea-module_corner__3hB5t","topRight":"MotifArea-module_topRight__2gNmC MotifArea-module_corner__3hB5t","bottomLeft":"MotifArea-module_bottomLeft__2qEqb MotifArea-module_corner__3hB5t","bottomRight":"MotifArea-module_bottomRight__3OjTb MotifArea-module_corner__3hB5t"};
|
995
|
+
styleInject(css$8);
|
996
|
+
|
997
|
+
var MotifArea = React.forwardRef(function MotifArea(props, ref) {
|
998
|
+
var image = useFile({
|
999
|
+
collectionName: 'imageFiles',
|
1000
|
+
permaId: props.imageId
|
1001
|
+
});
|
1002
|
+
|
1003
|
+
if (!image) {
|
1004
|
+
return null;
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
return React.createElement("div", {
|
1008
|
+
ref: ref,
|
1009
|
+
className: classnames(styles$7.root, _defineProperty({}, styles$7.active, props.active)),
|
1010
|
+
style: position(props, image),
|
1011
|
+
onMouseEnter: props.onMouseEnter,
|
1012
|
+
onMouseLeave: props.onMouseLeave
|
1013
|
+
}, React.createElement("div", {
|
1014
|
+
className: styles$7.topLeft
|
1015
|
+
}), React.createElement("div", {
|
1016
|
+
className: styles$7.topRight
|
1017
|
+
}), React.createElement("div", {
|
1018
|
+
className: styles$7.bottomLeft
|
1019
|
+
}), React.createElement("div", {
|
1020
|
+
className: styles$7.bottomRight
|
1021
|
+
}));
|
1022
|
+
});
|
1023
|
+
|
1024
|
+
function position(props, image) {
|
1025
|
+
var originalRatio = image.width / image.height;
|
1026
|
+
var containerRatio = props.containerWidth / props.containerHeight;
|
1027
|
+
var scale = containerRatio > originalRatio ? props.containerWidth / image.width : props.containerHeight / image.height;
|
1028
|
+
var contentWidth = image.width * scale;
|
1029
|
+
var contentHeight = image.height * scale;
|
1030
|
+
var focusX = image.configuration.focusX === undefined ? 50 : image.configuration.focusX;
|
1031
|
+
var focusY = image.configuration.focusY === undefined ? 50 : image.configuration.focusY;
|
1032
|
+
var cropLeft = (contentWidth - props.containerWidth) * focusX / 100;
|
1033
|
+
var cropTop = (contentHeight - props.containerHeight) * focusY / 100;
|
1034
|
+
var motifArea = image.configuration.motifArea || {
|
1035
|
+
top: 0,
|
1036
|
+
left: 0,
|
1037
|
+
width: 0,
|
1038
|
+
height: 0
|
1039
|
+
};
|
1040
|
+
return {
|
1041
|
+
top: contentHeight * motifArea.top / 100 - cropTop,
|
1042
|
+
left: contentWidth * motifArea.left / 100 - cropLeft,
|
1043
|
+
width: contentWidth * motifArea.width / 100,
|
1044
|
+
height: contentHeight * motifArea.height / 100
|
1045
|
+
};
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
function getSize(el) {
|
1049
|
+
if (!el) {
|
1050
|
+
return {
|
1051
|
+
left: 0,
|
1052
|
+
top: 0,
|
1053
|
+
width: 0,
|
1054
|
+
height: 0
|
1055
|
+
};
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
return {
|
1059
|
+
left: el.offsetLeft,
|
1060
|
+
top: el.offsetTop,
|
1061
|
+
width: el.offsetWidth,
|
1062
|
+
height: el.offsetHeight
|
1063
|
+
};
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
function useDimension() {
|
1067
|
+
var _useState = useState(getSize(null)),
|
1068
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1069
|
+
componentSize = _useState2[0],
|
1070
|
+
setComponentSize = _useState2[1];
|
1071
|
+
|
1072
|
+
var _useState3 = useState(null),
|
1073
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1074
|
+
currentNode = _useState4[0],
|
1075
|
+
setCurrentNode = _useState4[1];
|
1076
|
+
|
1077
|
+
var measuredRef = useCallback(function (node) {
|
1078
|
+
setCurrentNode(node);
|
1079
|
+
setComponentSize(getSize(node));
|
1080
|
+
}, []);
|
1081
|
+
useEffect(function () {
|
1082
|
+
function handleResize() {
|
1083
|
+
setComponentSize(getSize(currentNode));
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
if (!currentNode) {
|
1087
|
+
return;
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
handleResize();
|
1091
|
+
window.addEventListener('resize', handleResize);
|
1092
|
+
return function () {
|
1093
|
+
window.removeEventListener('resize', handleResize);
|
1094
|
+
};
|
1095
|
+
}, [currentNode]);
|
1096
|
+
return [componentSize, measuredRef];
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
var videos = {
|
1100
|
+
videoBoatSunset: {
|
1101
|
+
id: "videoBoatSunset",
|
1102
|
+
width: 960,
|
1103
|
+
height: 406,
|
1104
|
+
motiveArea: {
|
1105
|
+
top: 0,
|
1106
|
+
left: 0,
|
1107
|
+
width: 0,
|
1108
|
+
height: 0
|
1109
|
+
},
|
1110
|
+
focusX: 50,
|
1111
|
+
focusY: 50
|
1112
|
+
},
|
1113
|
+
videoBoatDark: {
|
1114
|
+
id: "videoBoatDark",
|
1115
|
+
width: 960,
|
1116
|
+
height: 406,
|
1117
|
+
motiveArea: {
|
1118
|
+
top: 0,
|
1119
|
+
left: 0,
|
1120
|
+
width: 0,
|
1121
|
+
height: 0
|
1122
|
+
},
|
1123
|
+
focusX: 50,
|
1124
|
+
focusY: 50
|
1125
|
+
},
|
1126
|
+
videoKaterchen: {
|
1127
|
+
id: "videoKaterchen",
|
1128
|
+
width: 1920,
|
1129
|
+
height: 1080,
|
1130
|
+
motiveArea: {
|
1131
|
+
top: 0,
|
1132
|
+
left: 0,
|
1133
|
+
width: 0,
|
1134
|
+
height: 0
|
1135
|
+
},
|
1136
|
+
focusX: 50,
|
1137
|
+
focusY: 50
|
1138
|
+
},
|
1139
|
+
videoGarzweilerLoop1: {
|
1140
|
+
id: "videoGarzweilerLoop1",
|
1141
|
+
width: 3840,
|
1142
|
+
height: 2160,
|
1143
|
+
motiveArea: {
|
1144
|
+
top: 0,
|
1145
|
+
left: 0,
|
1146
|
+
width: 1,
|
1147
|
+
height: 1
|
1148
|
+
},
|
1149
|
+
focusX: 50,
|
1150
|
+
focusY: 50
|
1151
|
+
},
|
1152
|
+
videoGarzweilerLoop2: {
|
1153
|
+
id: "videoGarzweilerLoop2",
|
1154
|
+
width: 1920,
|
1155
|
+
height: 1080,
|
1156
|
+
motiveArea: {
|
1157
|
+
top: 0,
|
1158
|
+
left: 0,
|
1159
|
+
width: 1,
|
1160
|
+
height: 1
|
1161
|
+
},
|
1162
|
+
focusX: 15,
|
1163
|
+
focusY: 20
|
1164
|
+
},
|
1165
|
+
videoGarzweilerDrohne: {
|
1166
|
+
id: "videoGarzweilerDrohne",
|
1167
|
+
width: 1920,
|
1168
|
+
height: 1080,
|
1169
|
+
motiveArea: {
|
1170
|
+
top: 0,
|
1171
|
+
left: 0,
|
1172
|
+
width: 0,
|
1173
|
+
height: 0
|
1174
|
+
}
|
1175
|
+
},
|
1176
|
+
videoInselInterviewToni: {
|
1177
|
+
id: "videoInselInterviewToni",
|
1178
|
+
width: 1920,
|
1179
|
+
height: 1080,
|
1180
|
+
motiveArea: {
|
1181
|
+
top: 0,
|
1182
|
+
left: 0,
|
1183
|
+
width: 0,
|
1184
|
+
height: 0
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
var ResizeSensor = createCommonjsModule(function (module, exports) {
|
1190
|
+
// Copyright (c) 2013 Marc J. Schmidt
|
1191
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
1192
|
+
// of this software and associated documentation files (the "Software"), to deal
|
1193
|
+
// in the Software without restriction, including without limitation the rights
|
1194
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1195
|
+
// copies of the Software, and to permit persons to whom the Software is
|
1196
|
+
// furnished to do so, subject to the following conditions:
|
1197
|
+
// The above copyright notice and this permission notice shall be included in
|
1198
|
+
// all copies or substantial portions of the Software.
|
1199
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1200
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1201
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1202
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1203
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1204
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
1205
|
+
// THE SOFTWARE.
|
1206
|
+
// Originally based on version 1.2.1,
|
1207
|
+
// https://github.com/marcj/css-element-queries/tree/1.2.1
|
1208
|
+
// Some lines removed for compatibility.
|
1209
|
+
(function (root, factory) {
|
1210
|
+
{
|
1211
|
+
module.exports = factory();
|
1212
|
+
}
|
1213
|
+
})(typeof window !== 'undefined' ? window : commonjsGlobal, function () {
|
1214
|
+
// Make sure it does not throw in a SSR (Server Side Rendering) situation
|
1215
|
+
if (typeof window === "undefined") {
|
1216
|
+
return null;
|
1217
|
+
} // https://github.com/Semantic-Org/Semantic-UI/issues/3855
|
1218
|
+
// https://github.com/marcj/css-element-queries/issues/257
|
1219
|
+
|
1220
|
+
|
1221
|
+
var globalWindow = window; // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
|
1222
|
+
// In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
|
1223
|
+
// would generate too many unnecessary events.
|
1224
|
+
|
1225
|
+
var requestAnimationFrame = globalWindow.requestAnimationFrame || globalWindow.mozRequestAnimationFrame || globalWindow.webkitRequestAnimationFrame || function (fn) {
|
1226
|
+
return globalWindow.setTimeout(fn, 20);
|
1227
|
+
};
|
1228
|
+
|
1229
|
+
function forEachElement(elements, callback) {
|
1230
|
+
var elementsType = Object.prototype.toString.call(elements);
|
1231
|
+
var isCollectionTyped = '[object Array]' === elementsType || '[object NodeList]' === elementsType || '[object HTMLCollection]' === elementsType || '[object Object]' === elementsType;
|
1232
|
+
var i = 0,
|
1233
|
+
j = elements.length;
|
1234
|
+
|
1235
|
+
if (isCollectionTyped) {
|
1236
|
+
for (; i < j; i++) {
|
1237
|
+
callback(elements[i]);
|
1238
|
+
}
|
1239
|
+
} else {
|
1240
|
+
callback(elements);
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
function getElementSize(element) {
|
1245
|
+
if (!element.getBoundingClientRect) {
|
1246
|
+
return {
|
1247
|
+
width: element.offsetWidth,
|
1248
|
+
height: element.offsetHeight
|
1249
|
+
};
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
var rect = element.getBoundingClientRect();
|
1253
|
+
return {
|
1254
|
+
width: Math.round(rect.width),
|
1255
|
+
height: Math.round(rect.height)
|
1256
|
+
};
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
function setStyle(element, style) {
|
1260
|
+
Object.keys(style).forEach(function (key) {
|
1261
|
+
element.style[key] = style[key];
|
1262
|
+
});
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
var ResizeSensor = function ResizeSensor(element, callback) {
|
1266
|
+
function EventQueue() {
|
1267
|
+
var q = [];
|
1268
|
+
|
1269
|
+
this.add = function (ev) {
|
1270
|
+
q.push(ev);
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
var i, j;
|
1274
|
+
|
1275
|
+
this.call = function (sizeInfo) {
|
1276
|
+
for (i = 0, j = q.length; i < j; i++) {
|
1277
|
+
q[i].call(this, sizeInfo);
|
1278
|
+
}
|
1279
|
+
};
|
1280
|
+
|
1281
|
+
this.remove = function (ev) {
|
1282
|
+
var newQueue = [];
|
1283
|
+
|
1284
|
+
for (i = 0, j = q.length; i < j; i++) {
|
1285
|
+
if (q[i] !== ev) newQueue.push(q[i]);
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
q = newQueue;
|
1289
|
+
};
|
1290
|
+
|
1291
|
+
this.length = function () {
|
1292
|
+
return q.length;
|
1293
|
+
};
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
function attachResizeEvent(element, resized) {
|
1297
|
+
if (!element) return;
|
1298
|
+
|
1299
|
+
if (element.resizedAttached) {
|
1300
|
+
element.resizedAttached.add(resized);
|
1301
|
+
return;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
element.resizedAttached = new EventQueue();
|
1305
|
+
element.resizedAttached.add(resized);
|
1306
|
+
element.resizeSensor = document.createElement('div');
|
1307
|
+
element.resizeSensor.dir = 'ltr';
|
1308
|
+
element.resizeSensor.className = 'resize-sensor';
|
1309
|
+
var style = {
|
1310
|
+
pointerEvents: 'none',
|
1311
|
+
position: 'absolute',
|
1312
|
+
left: '0px',
|
1313
|
+
top: '0px',
|
1314
|
+
right: '0px',
|
1315
|
+
bottom: '0px',
|
1316
|
+
overflow: 'hidden',
|
1317
|
+
zIndex: '-1',
|
1318
|
+
visibility: 'hidden',
|
1319
|
+
maxWidth: '100%'
|
1320
|
+
};
|
1321
|
+
var styleChild = {
|
1322
|
+
position: 'absolute',
|
1323
|
+
left: '0px',
|
1324
|
+
top: '0px',
|
1325
|
+
transition: '0s'
|
1326
|
+
};
|
1327
|
+
setStyle(element.resizeSensor, style);
|
1328
|
+
var expand = document.createElement('div');
|
1329
|
+
expand.className = 'resize-sensor-expand';
|
1330
|
+
setStyle(expand, style);
|
1331
|
+
var expandChild = document.createElement('div');
|
1332
|
+
setStyle(expandChild, styleChild);
|
1333
|
+
expand.appendChild(expandChild);
|
1334
|
+
var shrink = document.createElement('div');
|
1335
|
+
shrink.className = 'resize-sensor-shrink';
|
1336
|
+
setStyle(shrink, style);
|
1337
|
+
var shrinkChild = document.createElement('div');
|
1338
|
+
setStyle(shrinkChild, styleChild);
|
1339
|
+
setStyle(shrinkChild, {
|
1340
|
+
width: '200%',
|
1341
|
+
height: '200%'
|
1342
|
+
});
|
1343
|
+
shrink.appendChild(shrinkChild);
|
1344
|
+
element.resizeSensor.appendChild(expand);
|
1345
|
+
element.resizeSensor.appendChild(shrink);
|
1346
|
+
element.appendChild(element.resizeSensor);
|
1347
|
+
var computedStyle = window.getComputedStyle(element);
|
1348
|
+
var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
|
1349
|
+
|
1350
|
+
if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) {
|
1351
|
+
element.style.position = 'relative';
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
var dirty, rafId;
|
1355
|
+
var size = getElementSize(element);
|
1356
|
+
var lastWidth = 0;
|
1357
|
+
var lastHeight = 0;
|
1358
|
+
var initialHiddenCheck = true;
|
1359
|
+
var lastAnimationFrame = 0;
|
1360
|
+
|
1361
|
+
var resetExpandShrink = function resetExpandShrink() {
|
1362
|
+
var width = element.offsetWidth;
|
1363
|
+
var height = element.offsetHeight;
|
1364
|
+
expandChild.style.width = width + 10 + 'px';
|
1365
|
+
expandChild.style.height = height + 10 + 'px';
|
1366
|
+
expand.scrollLeft = width + 10;
|
1367
|
+
expand.scrollTop = height + 10;
|
1368
|
+
shrink.scrollLeft = width + 10;
|
1369
|
+
shrink.scrollTop = height + 10;
|
1370
|
+
};
|
1371
|
+
|
1372
|
+
var reset = function reset() {
|
1373
|
+
// Check if element is hidden
|
1374
|
+
if (initialHiddenCheck) {
|
1375
|
+
var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
|
1376
|
+
|
1377
|
+
if (invisible) {
|
1378
|
+
// Check in next frame
|
1379
|
+
if (!lastAnimationFrame) {
|
1380
|
+
lastAnimationFrame = requestAnimationFrame(function () {
|
1381
|
+
lastAnimationFrame = 0;
|
1382
|
+
reset();
|
1383
|
+
});
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
return;
|
1387
|
+
} else {
|
1388
|
+
// Stop checking
|
1389
|
+
initialHiddenCheck = false;
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
resetExpandShrink();
|
1394
|
+
};
|
1395
|
+
|
1396
|
+
element.resizeSensor.resetSensor = reset;
|
1397
|
+
|
1398
|
+
var onResized = function onResized() {
|
1399
|
+
rafId = 0;
|
1400
|
+
if (!dirty) return;
|
1401
|
+
lastWidth = size.width;
|
1402
|
+
lastHeight = size.height;
|
1403
|
+
|
1404
|
+
if (element.resizedAttached) {
|
1405
|
+
element.resizedAttached.call(size);
|
1406
|
+
}
|
1407
|
+
};
|
1408
|
+
|
1409
|
+
var onScroll = function onScroll() {
|
1410
|
+
size = getElementSize(element);
|
1411
|
+
dirty = size.width !== lastWidth || size.height !== lastHeight;
|
1412
|
+
|
1413
|
+
if (dirty && !rafId) {
|
1414
|
+
rafId = requestAnimationFrame(onResized);
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
reset();
|
1418
|
+
};
|
1419
|
+
|
1420
|
+
var addEvent = function addEvent(el, name, cb) {
|
1421
|
+
if (el.attachEvent) {
|
1422
|
+
el.attachEvent('on' + name, cb);
|
1423
|
+
} else {
|
1424
|
+
el.addEventListener(name, cb);
|
1425
|
+
}
|
1426
|
+
};
|
1427
|
+
|
1428
|
+
addEvent(expand, 'scroll', onScroll);
|
1429
|
+
addEvent(shrink, 'scroll', onScroll); // Fix for custom Elements
|
1430
|
+
|
1431
|
+
requestAnimationFrame(reset);
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
forEachElement(element, function (elem) {
|
1435
|
+
attachResizeEvent(elem, callback);
|
1436
|
+
});
|
1437
|
+
|
1438
|
+
this.detach = function (ev) {
|
1439
|
+
ResizeSensor.detach(element, ev);
|
1440
|
+
};
|
1441
|
+
|
1442
|
+
this.reset = function () {
|
1443
|
+
element.resizeSensor.resetSensor();
|
1444
|
+
};
|
1445
|
+
};
|
1446
|
+
|
1447
|
+
ResizeSensor.reset = function (element) {
|
1448
|
+
forEachElement(element, function (elem) {
|
1449
|
+
elem.resizeSensor.resetSensor();
|
1450
|
+
});
|
1451
|
+
};
|
1452
|
+
|
1453
|
+
ResizeSensor.detach = function (element, ev) {
|
1454
|
+
forEachElement(element, function (elem) {
|
1455
|
+
if (!elem) return;
|
1456
|
+
|
1457
|
+
if (elem.resizedAttached && typeof ev === "function") {
|
1458
|
+
elem.resizedAttached.remove(ev);
|
1459
|
+
if (elem.resizedAttached.length()) return;
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
if (elem.resizeSensor) {
|
1463
|
+
if (elem.contains(elem.resizeSensor)) {
|
1464
|
+
elem.removeChild(elem.resizeSensor);
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
delete elem.resizeSensor;
|
1468
|
+
delete elem.resizedAttached;
|
1469
|
+
}
|
1470
|
+
});
|
1471
|
+
};
|
1472
|
+
|
1473
|
+
if (typeof MutationObserver !== "undefined") {
|
1474
|
+
var observer = new MutationObserver(function (mutations) {
|
1475
|
+
for (var i in mutations) {
|
1476
|
+
if (mutations.hasOwnProperty(i)) {
|
1477
|
+
var items = mutations[i].addedNodes;
|
1478
|
+
|
1479
|
+
for (var j = 0; j < items.length; j++) {
|
1480
|
+
if (items[j].resizeSensor) {
|
1481
|
+
ResizeSensor.reset(items[j]);
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
});
|
1487
|
+
document.addEventListener("DOMContentLoaded", function (event) {
|
1488
|
+
observer.observe(document.body, {
|
1489
|
+
childList: true,
|
1490
|
+
subtree: true
|
1491
|
+
});
|
1492
|
+
});
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
return ResizeSensor;
|
1496
|
+
});
|
1497
|
+
});
|
1498
|
+
|
1499
|
+
var cssElementQueries = {
|
1500
|
+
ResizeSensor: ResizeSensor
|
1501
|
+
};
|
1502
|
+
var cssElementQueries_1 = cssElementQueries.ResizeSensor;
|
1503
|
+
|
1504
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
1505
|
+
|
1506
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
1507
|
+
var defaultProps = {
|
1508
|
+
handleSize: 40,
|
1509
|
+
handle: null,
|
1510
|
+
hover: false,
|
1511
|
+
leftImageAlt: '',
|
1512
|
+
leftImageCss: {},
|
1513
|
+
leftImageLabel: null,
|
1514
|
+
onSliderPositionChange: function onSliderPositionChange() {},
|
1515
|
+
rightImageAlt: '',
|
1516
|
+
rightImageCss: {},
|
1517
|
+
rightImageLabel: null,
|
1518
|
+
skeleton: null,
|
1519
|
+
sliderLineColor: '#ffffff',
|
1520
|
+
sliderLineWidth: 2,
|
1521
|
+
sliderPositionPercentage: 0.5
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
function ReactCompareImage(props) {
|
1525
|
+
var handleSize = props.handleSize,
|
1526
|
+
handle = props.handle,
|
1527
|
+
hover = props.hover,
|
1528
|
+
leftImage = props.leftImage,
|
1529
|
+
leftImageAlt = props.leftImageAlt,
|
1530
|
+
leftImageCss = props.leftImageCss,
|
1531
|
+
leftImageLabel = props.leftImageLabel,
|
1532
|
+
onSliderPositionChange = props.onSliderPositionChange,
|
1533
|
+
rightImage = props.rightImage,
|
1534
|
+
rightImageAlt = props.rightImageAlt,
|
1535
|
+
rightImageCss = props.rightImageCss,
|
1536
|
+
rightImageLabel = props.rightImageLabel,
|
1537
|
+
skeleton = props.skeleton,
|
1538
|
+
sliderLineColor = props.sliderLineColor,
|
1539
|
+
sliderLineWidth = props.sliderLineWidth,
|
1540
|
+
sliderPositionPercentage = props.sliderPositionPercentage,
|
1541
|
+
sliderPosition = props.sliderPosition,
|
1542
|
+
setSliderPosition = props.setSliderPosition,
|
1543
|
+
isSliding = props.isSliding,
|
1544
|
+
setIsSliding = props.setIsSliding,
|
1545
|
+
classicMode = props.classicMode,
|
1546
|
+
wiggle = props.wiggle;
|
1547
|
+
|
1548
|
+
var _useState = useState(0),
|
1549
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1550
|
+
containerWidth = _useState2[0],
|
1551
|
+
setContainerWidth = _useState2[1];
|
1552
|
+
|
1553
|
+
var _useState3 = useState(false),
|
1554
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1555
|
+
leftImgLoaded = _useState4[0],
|
1556
|
+
setLeftImgLoaded = _useState4[1];
|
1557
|
+
|
1558
|
+
var _useState5 = useState(false),
|
1559
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
1560
|
+
rightImgLoaded = _useState6[0],
|
1561
|
+
setRightImgLoaded = _useState6[1];
|
1562
|
+
|
1563
|
+
var containerRef = useRef();
|
1564
|
+
var rightImageRef = useRef();
|
1565
|
+
var leftImageRef = useRef(); // keep track container's width in local state
|
1566
|
+
|
1567
|
+
useEffect(function () {
|
1568
|
+
var updateContainerWidth = function updateContainerWidth() {
|
1569
|
+
var currentContainerWidth = containerRef.current.getBoundingClientRect().width;
|
1570
|
+
setContainerWidth(currentContainerWidth);
|
1571
|
+
}; // initial execution must be done manually
|
1572
|
+
|
1573
|
+
|
1574
|
+
updateContainerWidth(); // update local state if container size is changed
|
1575
|
+
|
1576
|
+
var containerElement = containerRef.current;
|
1577
|
+
var resizeSensor = new cssElementQueries_1(containerElement, function () {
|
1578
|
+
updateContainerWidth();
|
1579
|
+
});
|
1580
|
+
return function () {
|
1581
|
+
resizeSensor.detach(containerElement);
|
1582
|
+
};
|
1583
|
+
}, []);
|
1584
|
+
useEffect(function () {
|
1585
|
+
// consider the case where loading image is completed immediately
|
1586
|
+
// due to the cache etc.
|
1587
|
+
var alreadyDone = leftImageRef.current.complete;
|
1588
|
+
alreadyDone && setLeftImgLoaded(true);
|
1589
|
+
return function () {
|
1590
|
+
// when the left image source is changed
|
1591
|
+
setLeftImgLoaded(false);
|
1592
|
+
};
|
1593
|
+
}, [leftImage]);
|
1594
|
+
useEffect(function () {
|
1595
|
+
// consider the case where loading image is completed immediately
|
1596
|
+
// due to the cache etc.
|
1597
|
+
var alreadyDone = rightImageRef.current.complete;
|
1598
|
+
alreadyDone && setRightImgLoaded(true);
|
1599
|
+
return function () {
|
1600
|
+
// when the right image source is changed
|
1601
|
+
setRightImgLoaded(false);
|
1602
|
+
};
|
1603
|
+
}, [rightImage]);
|
1604
|
+
var allImagesLoaded = rightImgLoaded && leftImgLoaded;
|
1605
|
+
useEffect(function () {
|
1606
|
+
var handleSliding = function handleSliding(event) {
|
1607
|
+
var e = event || window.event; // Calc Cursor Position from the left edge of the viewport
|
1608
|
+
|
1609
|
+
var cursorXfromViewport = e.touches ? e.touches[0].pageX : e.pageX; // Calc Cursor Position from the left edge of the window (consider any page scrolling)
|
1610
|
+
|
1611
|
+
var cursorXfromWindow = cursorXfromViewport - window.pageXOffset; // Calc Cursor Position from the left edge of the image
|
1612
|
+
|
1613
|
+
var imagePosition = rightImageRef.current.getBoundingClientRect();
|
1614
|
+
var pos = cursorXfromWindow - imagePosition.left; // Set minimum and maximum values to prevent the slider from overflowing
|
1615
|
+
|
1616
|
+
var minPos = 0 + sliderLineWidth / 2;
|
1617
|
+
var maxPos = containerWidth - sliderLineWidth / 2;
|
1618
|
+
if (pos < minPos) pos = minPos;
|
1619
|
+
if (pos > maxPos) pos = maxPos;
|
1620
|
+
setSliderPosition(pos / containerWidth); // If there's a callback function, invoke it everytime the slider changes
|
1621
|
+
|
1622
|
+
if (onSliderPositionChange) {
|
1623
|
+
onSliderPositionChange(pos / containerWidth);
|
1624
|
+
}
|
1625
|
+
};
|
1626
|
+
|
1627
|
+
var startSliding = function startSliding(e) {
|
1628
|
+
setIsSliding(true); // Prevent default behavior other than mobile scrolling
|
1629
|
+
|
1630
|
+
if (!('touches' in e)) {
|
1631
|
+
e.preventDefault();
|
1632
|
+
} // Slide the image even if you just click or tap (not drag)
|
1633
|
+
|
1634
|
+
|
1635
|
+
handleSliding(e);
|
1636
|
+
window.addEventListener('mousemove', handleSliding); // 07
|
1637
|
+
|
1638
|
+
window.addEventListener('touchmove', handleSliding); // 08
|
1639
|
+
};
|
1640
|
+
|
1641
|
+
var finishSliding = function finishSliding() {
|
1642
|
+
setIsSliding(false);
|
1643
|
+
window.removeEventListener('mousemove', handleSliding);
|
1644
|
+
window.removeEventListener('touchmove', handleSliding);
|
1645
|
+
};
|
1646
|
+
|
1647
|
+
var containerElement = containerRef.current;
|
1648
|
+
|
1649
|
+
if (allImagesLoaded) {
|
1650
|
+
if (classicMode) {
|
1651
|
+
// it's necessary to reset event handlers each time the canvasWidth changes
|
1652
|
+
// for mobile
|
1653
|
+
containerElement.addEventListener('touchstart', startSliding); // 01
|
1654
|
+
|
1655
|
+
window.addEventListener('touchend', finishSliding); // 02
|
1656
|
+
// for desktop
|
1657
|
+
|
1658
|
+
if (hover) {
|
1659
|
+
containerElement.addEventListener('mousemove', handleSliding); // 03
|
1660
|
+
|
1661
|
+
containerElement.addEventListener('mouseleave', finishSliding); // 04
|
1662
|
+
} else {
|
1663
|
+
containerElement.addEventListener('mousedown', startSliding); // 05
|
1664
|
+
|
1665
|
+
window.addEventListener('mouseup', finishSliding); // 06
|
1666
|
+
}
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
return function () {
|
1671
|
+
if (classicMode) {
|
1672
|
+
// cleanup all event resteners
|
1673
|
+
containerElement.removeEventListener('touchstart', startSliding); // 01
|
1674
|
+
|
1675
|
+
window.removeEventListener('touchend', finishSliding); // 02
|
1676
|
+
|
1677
|
+
containerElement.removeEventListener('mousemove', handleSliding); // 03
|
1678
|
+
|
1679
|
+
containerElement.removeEventListener('mouseleave', finishSliding); // 04
|
1680
|
+
|
1681
|
+
containerElement.removeEventListener('mousedown', startSliding); // 05
|
1682
|
+
|
1683
|
+
window.removeEventListener('mouseup', finishSliding); // 06
|
1684
|
+
|
1685
|
+
window.removeEventListener('mousemove', handleSliding); // 07
|
1686
|
+
|
1687
|
+
window.removeEventListener('touchmove', handleSliding); // 08
|
1688
|
+
}
|
1689
|
+
};
|
1690
|
+
}, [allImagesLoaded, containerWidth, hover, sliderLineWidth]); // eslint-disable-line
|
1691
|
+
// Image size set as follows.
|
1692
|
+
//
|
1693
|
+
// 1. right(under) image:
|
1694
|
+
// width = 100% of container width
|
1695
|
+
// height = auto
|
1696
|
+
//
|
1697
|
+
// 2. left(over) imaze:
|
1698
|
+
// width = 100% of container width
|
1699
|
+
// height = right image's height
|
1700
|
+
// (protrudes is hidden by css 'object-fit: hidden')
|
1701
|
+
|
1702
|
+
var styles = {
|
1703
|
+
container: {
|
1704
|
+
boxSizing: 'border-box',
|
1705
|
+
position: 'relative',
|
1706
|
+
width: '100%',
|
1707
|
+
overflow: 'hidden'
|
1708
|
+
},
|
1709
|
+
rightImage: _objectSpread$3({
|
1710
|
+
display: 'block',
|
1711
|
+
height: 'auto',
|
1712
|
+
// Respect the aspect ratio
|
1713
|
+
width: '100%'
|
1714
|
+
}, rightImageCss),
|
1715
|
+
leftImage: _objectSpread$3({
|
1716
|
+
clip: "rect(auto, ".concat(containerWidth * sliderPosition, "px, auto, auto)"),
|
1717
|
+
display: 'block',
|
1718
|
+
height: '100%',
|
1719
|
+
// fit to the height of right(under) image
|
1720
|
+
objectFit: 'cover',
|
1721
|
+
// protrudes is hidden
|
1722
|
+
position: 'absolute',
|
1723
|
+
top: 0,
|
1724
|
+
width: '100%'
|
1725
|
+
}, leftImageCss),
|
1726
|
+
slider: {
|
1727
|
+
alignItems: 'center',
|
1728
|
+
cursor: !hover && 'ew-resize',
|
1729
|
+
display: 'flex',
|
1730
|
+
flexDirection: 'column',
|
1731
|
+
height: '100%',
|
1732
|
+
justifyContent: 'center',
|
1733
|
+
left: "".concat(containerWidth * sliderPosition - handleSize / 2, "px"),
|
1734
|
+
position: 'absolute',
|
1735
|
+
top: 0,
|
1736
|
+
width: "".concat(handleSize, "px")
|
1737
|
+
},
|
1738
|
+
line: {
|
1739
|
+
background: sliderLineColor,
|
1740
|
+
boxShadow: '0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)',
|
1741
|
+
flex: '0 1 auto',
|
1742
|
+
height: '100%',
|
1743
|
+
width: "".concat(sliderLineWidth, "px")
|
1744
|
+
},
|
1745
|
+
handleCustom: {
|
1746
|
+
alignItems: 'center',
|
1747
|
+
boxSizing: 'border-box',
|
1748
|
+
display: 'flex',
|
1749
|
+
flex: '1 0 auto',
|
1750
|
+
height: 'auto',
|
1751
|
+
justifyContent: 'center',
|
1752
|
+
width: 'auto'
|
1753
|
+
},
|
1754
|
+
handleDefault: {
|
1755
|
+
alignItems: 'center',
|
1756
|
+
border: "".concat(sliderLineWidth, "px solid ").concat(sliderLineColor),
|
1757
|
+
borderRadius: '100%',
|
1758
|
+
boxShadow: '0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)',
|
1759
|
+
boxSizing: 'border-box',
|
1760
|
+
display: 'flex',
|
1761
|
+
flex: '1 0 auto',
|
1762
|
+
height: "".concat(handleSize, "px"),
|
1763
|
+
justifyContent: 'center',
|
1764
|
+
width: "".concat(handleSize, "px")
|
1765
|
+
},
|
1766
|
+
leftArrow: {
|
1767
|
+
border: "inset ".concat(handleSize * 0.15, "px rgba(0,0,0,0)"),
|
1768
|
+
borderRight: "".concat(handleSize * 0.15, "px solid ").concat(sliderLineColor),
|
1769
|
+
height: '0px',
|
1770
|
+
marginLeft: "-".concat(handleSize * 0.25, "px"),
|
1771
|
+
// for IE11
|
1772
|
+
marginRight: "".concat(handleSize * 0.25, "px"),
|
1773
|
+
width: '0px'
|
1774
|
+
},
|
1775
|
+
rightArrow: {
|
1776
|
+
border: "inset ".concat(handleSize * 0.15, "px rgba(0,0,0,0)"),
|
1777
|
+
borderLeft: "".concat(handleSize * 0.15, "px solid ").concat(sliderLineColor),
|
1778
|
+
height: '0px',
|
1779
|
+
marginRight: "-".concat(handleSize * 0.25, "px"),
|
1780
|
+
// for IE11
|
1781
|
+
width: '0px'
|
1782
|
+
},
|
1783
|
+
leftLabel: {
|
1784
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
1785
|
+
color: 'white',
|
1786
|
+
left: '5%',
|
1787
|
+
opacity: isSliding ? 0 : 1,
|
1788
|
+
padding: '10px 20px',
|
1789
|
+
position: 'absolute',
|
1790
|
+
top: '50%',
|
1791
|
+
transform: 'translate(0,-50%)',
|
1792
|
+
transition: 'opacity 0.1s ease-out 0.5s',
|
1793
|
+
maxWidth: '30%',
|
1794
|
+
WebkitUserSelect: 'none',
|
1795
|
+
WebkitTouchCallout: 'none'
|
1796
|
+
},
|
1797
|
+
rightLabel: {
|
1798
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
1799
|
+
color: 'white',
|
1800
|
+
opacity: isSliding ? 0 : 1,
|
1801
|
+
padding: '10px 20px',
|
1802
|
+
position: 'absolute',
|
1803
|
+
right: '5%',
|
1804
|
+
top: '50%',
|
1805
|
+
transform: 'translate(0,-50%)',
|
1806
|
+
transition: 'opacity 0.1s ease-out 0.5s',
|
1807
|
+
maxWidth: '30%',
|
1808
|
+
WebkitUserSelect: 'none',
|
1809
|
+
WebkitTouchCallout: 'none'
|
1810
|
+
}
|
1811
|
+
};
|
1812
|
+
return React.createElement(React.Fragment, null, skeleton && !allImagesLoaded && React.createElement("div", {
|
1813
|
+
style: _objectSpread$3({}, styles.container)
|
1814
|
+
}, skeleton), React.createElement("div", {
|
1815
|
+
style: _objectSpread$3({}, styles.container, {
|
1816
|
+
display: allImagesLoaded ? 'block' : 'none'
|
1817
|
+
}),
|
1818
|
+
ref: containerRef,
|
1819
|
+
"data-testid": "container"
|
1820
|
+
}, React.createElement("img", {
|
1821
|
+
onLoad: function onLoad() {
|
1822
|
+
return setRightImgLoaded(true);
|
1823
|
+
},
|
1824
|
+
alt: rightImageAlt,
|
1825
|
+
"data-testid": "right-image",
|
1826
|
+
ref: rightImageRef,
|
1827
|
+
src: rightImage,
|
1828
|
+
style: styles.rightImage
|
1829
|
+
}), React.createElement("img", {
|
1830
|
+
onLoad: function onLoad() {
|
1831
|
+
return setLeftImgLoaded(true);
|
1832
|
+
},
|
1833
|
+
alt: leftImageAlt,
|
1834
|
+
"data-testid": "left-image",
|
1835
|
+
ref: leftImageRef,
|
1836
|
+
src: leftImage,
|
1837
|
+
style: styles.leftImage
|
1838
|
+
}), React.createElement("div", {
|
1839
|
+
style: styles.slider,
|
1840
|
+
className: classnames(_defineProperty({}, 'wiggle', wiggle))
|
1841
|
+
}, React.createElement("div", {
|
1842
|
+
style: styles.line
|
1843
|
+
}), handle ? React.createElement("div", {
|
1844
|
+
style: styles.handleCustom
|
1845
|
+
}, handle) : React.createElement("div", {
|
1846
|
+
style: styles.handleDefault
|
1847
|
+
}, React.createElement("div", {
|
1848
|
+
style: styles.leftArrow
|
1849
|
+
}), React.createElement("div", {
|
1850
|
+
style: styles.rightArrow
|
1851
|
+
})), React.createElement("div", {
|
1852
|
+
style: styles.line
|
1853
|
+
})), leftImageLabel && React.createElement("div", {
|
1854
|
+
style: styles.leftLabel
|
1855
|
+
}, leftImageLabel), rightImageLabel && React.createElement("div", {
|
1856
|
+
style: styles.rightLabel
|
1857
|
+
}, rightImageLabel)));
|
1858
|
+
}
|
1859
|
+
|
1860
|
+
ReactCompareImage.defaultProps = defaultProps;
|
1861
|
+
|
1862
|
+
var css$9 = ".BeforeAfter-module_container__38Dru {\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.wiggle {\n animation: BeforeAfter-module_shake__3iLe8 1.5s cubic-bezier(.36,.07,.19,.97) both;\n}\n\n@keyframes BeforeAfter-module_shake__3iLe8 {\n 10%, 90% {\n transform: translate3d(-20%, 0, 0);\n }\n\n 20%, 80% {\n transform: translate3d(40%, 0, 0);\n }\n\n 30%, 50%, 70% {\n transform: translate3d(-80%, 0, 0);\n }\n\n 40%, 60% {\n transform: translate3d(80%, 0, 0);\n }\n}";
|
1863
|
+
var styles$8 = {"container":"BeforeAfter-module_container__38Dru","shake":"BeforeAfter-module_shake__3iLe8"};
|
1864
|
+
styleInject(css$9);
|
1865
|
+
|
1866
|
+
var BeforeAfter = (function (_ref) {
|
1867
|
+
var state = _ref.state,
|
1868
|
+
leftImageLabel = _ref.leftImageLabel,
|
1869
|
+
rightImageLabel = _ref.rightImageLabel,
|
1870
|
+
_ref$startPos = _ref.startPos,
|
1871
|
+
startPos = _ref$startPos === void 0 ? 0 : _ref$startPos,
|
1872
|
+
_ref$slideMode = _ref.slideMode,
|
1873
|
+
slideMode = _ref$slideMode === void 0 ? 'both' : _ref$slideMode;
|
1874
|
+
|
1875
|
+
var _useState = useState({
|
1876
|
+
pos: window.pageYOffset || document.documentElement.scrollTop,
|
1877
|
+
dir: 'unknown'
|
1878
|
+
}),
|
1879
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1880
|
+
scrollPos = _useState2[0],
|
1881
|
+
setScrollPos = _useState2[1];
|
1882
|
+
|
1883
|
+
var _useState3 = useState(false),
|
1884
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1885
|
+
isSliding = _useState4[0],
|
1886
|
+
setIsSliding = _useState4[1];
|
1887
|
+
|
1888
|
+
var _useState5 = useState(startPos),
|
1889
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
1890
|
+
beforeAfterPos = _useState6[0],
|
1891
|
+
setBeforeAfterPos = _useState6[1];
|
1892
|
+
|
1893
|
+
var beforeAfterRef = useRef();
|
1894
|
+
var slideOnScroll = slideMode === 'both' || slideMode === 'scroll';
|
1895
|
+
var slideClassic = slideMode === 'both' || slideMode === 'classic';
|
1896
|
+
var current = beforeAfterRef.current;
|
1897
|
+
|
1898
|
+
var _useState7 = useState(false),
|
1899
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
1900
|
+
wiggle = _useState8[0],
|
1901
|
+
setWiggle = _useState8[1];
|
1902
|
+
|
1903
|
+
useEffect(function () {
|
1904
|
+
var node = current;
|
1905
|
+
|
1906
|
+
if (node) {
|
1907
|
+
setWiggle(state === 'active');
|
1908
|
+
}
|
1909
|
+
}, [state, current]);
|
1910
|
+
useEffect(function () {
|
1911
|
+
var node = current;
|
1912
|
+
|
1913
|
+
function handler() {
|
1914
|
+
if (node) {
|
1915
|
+
setScrollPos(function (prevPos) {
|
1916
|
+
var currPos = window.pageYOffset || document.documentElement.scrollTop;
|
1917
|
+
|
1918
|
+
if (currPos > prevPos['pos']) {
|
1919
|
+
return {
|
1920
|
+
pos: currPos,
|
1921
|
+
dir: 'down'
|
1922
|
+
};
|
1923
|
+
}
|
1924
|
+
|
1925
|
+
if (currPos < prevPos['pos']) {
|
1926
|
+
return {
|
1927
|
+
pos: currPos,
|
1928
|
+
dir: 'up'
|
1929
|
+
};
|
1930
|
+
}
|
1931
|
+
|
1932
|
+
return prevPos;
|
1933
|
+
});
|
1934
|
+
|
1935
|
+
if (slideOnScroll) {
|
1936
|
+
if (scrollPos['dir'] === 'down' && beforeAfterPos < 1) {
|
1937
|
+
setBeforeAfterPos(function (prev) {
|
1938
|
+
return prev + 0.025;
|
1939
|
+
});
|
1940
|
+
setIsSliding(true);
|
1941
|
+
setTimeout(function () {
|
1942
|
+
return setIsSliding(false);
|
1943
|
+
}, 200);
|
1944
|
+
} else if (scrollPos['dir'] === 'up' && beforeAfterPos > 0) {
|
1945
|
+
setBeforeAfterPos(function (prev) {
|
1946
|
+
return prev - 0.025;
|
1947
|
+
});
|
1948
|
+
setIsSliding(true);
|
1949
|
+
setTimeout(function () {
|
1950
|
+
return setIsSliding(false);
|
1951
|
+
}, 250);
|
1952
|
+
} else {
|
1953
|
+
setIsSliding(false);
|
1954
|
+
}
|
1955
|
+
}
|
1956
|
+
}
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
if (!node) {
|
1960
|
+
return;
|
1961
|
+
}
|
1962
|
+
|
1963
|
+
setTimeout(handler, 0);
|
1964
|
+
|
1965
|
+
if (state === 'active') {
|
1966
|
+
window.addEventListener('scroll', handler);
|
1967
|
+
return function () {
|
1968
|
+
window.removeEventListener('scroll', handler);
|
1969
|
+
};
|
1970
|
+
}
|
1971
|
+
}, [current, setBeforeAfterPos, scrollPos, state, setIsSliding]);
|
1972
|
+
var awsBucket = '//s3-eu-west-1.amazonaws.com/de.codevise.pageflow.development/pageflow-next/presentation-images/';
|
1973
|
+
var beforeImage = awsBucket + 'before_after/haldern_church1.jpg';
|
1974
|
+
var afterImage = awsBucket + 'before_after/haldern_church2.jpg';
|
1975
|
+
return React.createElement("div", {
|
1976
|
+
ref: beforeAfterRef,
|
1977
|
+
className: styles$8.container
|
1978
|
+
}, React.createElement(ReactCompareImage, {
|
1979
|
+
leftImage: beforeImage,
|
1980
|
+
rightImage: afterImage,
|
1981
|
+
sliderPosition: beforeAfterPos,
|
1982
|
+
setSliderPosition: setBeforeAfterPos,
|
1983
|
+
isSliding: isSliding,
|
1984
|
+
setIsSliding: setIsSliding,
|
1985
|
+
leftImageLabel: leftImageLabel,
|
1986
|
+
rightImageLabel: rightImageLabel,
|
1987
|
+
classicMode: slideClassic,
|
1988
|
+
wiggle: wiggle
|
1989
|
+
}));
|
1990
|
+
});
|
1991
|
+
|
1992
|
+
var css$a = ".Backdrop-module_Backdrop__1w4UZ {\n width: 100%;\n z-index: 2;\n}\n\n.Backdrop-module_offScreen__2_FYZ {\n}\n";
|
1993
|
+
var styles$9 = {"Backdrop":"Backdrop-module_Backdrop__1w4UZ","offScreen":"Backdrop-module_offScreen__2_FYZ"};
|
1994
|
+
styleInject(css$a);
|
1995
|
+
|
1996
|
+
function Backdrop(props) {
|
1997
|
+
var _useDimension = useDimension(),
|
1998
|
+
_useDimension2 = _slicedToArray(_useDimension, 2),
|
1999
|
+
containerDimension = _useDimension2[0],
|
2000
|
+
setContainerRef = _useDimension2[1];
|
2001
|
+
|
2002
|
+
return React.createElement("div", {
|
2003
|
+
className: classnames(styles$9.Backdrop, props.transitionStyles.backdrop, props.transitionStyles["backdrop-".concat(props.state)], _defineProperty({}, styles$9.offScreen, props.offScreen))
|
2004
|
+
}, React.createElement("div", {
|
2005
|
+
className: props.transitionStyles.backdropInner
|
2006
|
+
}, React.createElement("div", {
|
2007
|
+
className: props.transitionStyles.backdropInner2
|
2008
|
+
}, props.children(renderContent(props, containerDimension, setContainerRef)))));
|
2009
|
+
}
|
2010
|
+
Backdrop.defaultProps = {
|
2011
|
+
transitionStyles: {}
|
2012
|
+
};
|
2013
|
+
|
2014
|
+
function renderContent(props, containerDimension, setContainerRef) {
|
2015
|
+
if (props.image.toString().startsWith('#')) {
|
2016
|
+
return React.createElement(FillColor, {
|
2017
|
+
color: props.image
|
2018
|
+
});
|
2019
|
+
} else if (props.image.toString().startsWith('video')) {
|
2020
|
+
var video = videos[props.image];
|
2021
|
+
return React.createElement(Fullscreen, {
|
2022
|
+
ref: setContainerRef
|
2023
|
+
}, React.createElement(Video, {
|
2024
|
+
state: props.onScreen ? 'active' : 'inactive',
|
2025
|
+
id: props.image,
|
2026
|
+
offset: props.offset,
|
2027
|
+
interactive: props.interactive,
|
2028
|
+
nextSectionOnEnd: props.nextSectionOnEnd
|
2029
|
+
}), React.createElement(MotifArea, {
|
2030
|
+
ref: props.motifAreaRef,
|
2031
|
+
image: video,
|
2032
|
+
containerWidth: containerDimension.width,
|
2033
|
+
containerHeight: containerDimension.height
|
2034
|
+
}));
|
2035
|
+
} else if (props.image.toString().startsWith('beforeAfter')) {
|
2036
|
+
return React.createElement(Fullscreen, {
|
2037
|
+
ref: setContainerRef
|
2038
|
+
}, React.createElement(BeforeAfter, {
|
2039
|
+
state: props.state,
|
2040
|
+
leftImageLabel: props.leftImageLabel,
|
2041
|
+
rightImageLabel: props.rightImageLabel,
|
2042
|
+
startPos: props.startPos,
|
2043
|
+
slideMode: props.slideMode
|
2044
|
+
}));
|
2045
|
+
} else {
|
2046
|
+
return React.createElement(Fullscreen, {
|
2047
|
+
ref: setContainerRef
|
2048
|
+
}, React.createElement(Image, {
|
2049
|
+
id: props.image
|
2050
|
+
}), React.createElement(Image, {
|
2051
|
+
id: props.imageMobile,
|
2052
|
+
mobile: true
|
2053
|
+
}), React.createElement(MotifArea, {
|
2054
|
+
ref: props.motifAreaRef,
|
2055
|
+
imageId: props.image,
|
2056
|
+
containerWidth: containerDimension.width,
|
2057
|
+
containerHeight: containerDimension.height
|
2058
|
+
}));
|
2059
|
+
}
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
var css$b = ".Foreground-module_Foreground__13ODU {\n position: relative;\n z-index: 3;\n\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.Foreground-module_fullFadeHeight__2p9dx {\n min-height: 51vh;\n}\n\n.Foreground-module_fullHeight__1vMXb {\n min-height: 100vh;\n}\n\n.Foreground-module_fullFadeHeight__2p9dx.Foreground-module_enlarge__14Plm,\n.Foreground-module_fullHeight__1vMXb.Foreground-module_enlarge__14Plm {\n min-height: 130vh;\n}\n\n.Foreground-module_hidden__2dmAx {\n visibility: hidden;\n}\n";
|
2063
|
+
var styles$a = {"Foreground":"Foreground-module_Foreground__13ODU","fullFadeHeight":"Foreground-module_fullFadeHeight__2p9dx","fullHeight":"Foreground-module_fullHeight__1vMXb","enlarge":"Foreground-module_enlarge__14Plm","hidden":"Foreground-module_hidden__2dmAx"};
|
2064
|
+
styleInject(css$b);
|
2065
|
+
|
2066
|
+
function Foreground(props) {
|
2067
|
+
return React.createElement("div", {
|
2068
|
+
className: className(props)
|
2069
|
+
}, props.children);
|
2070
|
+
}
|
2071
|
+
|
2072
|
+
function className(props) {
|
2073
|
+
var _classNames;
|
2074
|
+
|
2075
|
+
return classnames(styles$a.Foreground, props.transitionStyles.foreground, props.transitionStyles["foreground-".concat(props.state)], styles$a["".concat(props.heightMode, "Height")], (_classNames = {}, _defineProperty(_classNames, styles$a.hidden, props.hidden), _defineProperty(_classNames, styles$a.enlarge, props.hidden && !props.disableEnlarge), _classNames));
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
function _arrayWithoutHoles(arr) {
|
2079
|
+
if (Array.isArray(arr)) {
|
2080
|
+
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
2081
|
+
arr2[i] = arr[i];
|
2082
|
+
}
|
2083
|
+
|
2084
|
+
return arr2;
|
2085
|
+
}
|
2086
|
+
}
|
2087
|
+
|
2088
|
+
function _iterableToArray(iter) {
|
2089
|
+
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
2090
|
+
}
|
2091
|
+
|
2092
|
+
function _nonIterableSpread() {
|
2093
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
function _toConsumableArray(arr) {
|
2097
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
2098
|
+
}
|
2099
|
+
|
2100
|
+
var css$c = "\n\n.Heading-module_Heading__1YSiy {\n font-size: 66px;\n font-weight: 700;\n margin-top: 0;\n margin-bottom: 0.5em;\n padding-top: 0.5em;\n}\n\n.Heading-module_first__1yPxD {\n font-size: 110px;\n line-height: 1;\n}\n\n@media (orientation: landscape) {\n .Heading-module_first__1yPxD {\n padding-top: 25%;\n }\n}\n\n@media (max-width: 600px) {\n .Heading-module_Heading__1YSiy {\n font-size: 40px;\n }\n\n .Heading-module_first__1yPxD {\n font-size: 66px;\n }\n}\n";
|
2101
|
+
var styles$b = {"text-l":"40px","text-xl":"66px","text-2xl":"110px","Heading":"Heading-module_Heading__1YSiy","first":"Heading-module_first__1yPxD"};
|
2102
|
+
styleInject(css$c);
|
2103
|
+
|
2104
|
+
function Heading(props) {
|
2105
|
+
return React.createElement("h1", {
|
2106
|
+
className: classnames(styles$b.Heading, _defineProperty({}, styles$b.first, props.first)),
|
2107
|
+
style: props.style
|
2108
|
+
}, props.children);
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
var css$d = "\n\n.TextBlock-module_TextBlock__5Zpj7 {\n font-size: 22px;\n line-height: 1.4;\n\n padding: 1em 0;\n margin-top: 0;\n margin-bottom: 0;\n text-shadow: none;\n}\n\n.TextBlock-module_dummy__3W5ls {\n opacity: 0.7;\n}\n\n.TextBlock-module_TextBlock__5Zpj7 a {\n color: #fff;\n word-wrap: break-word;\n}\n\n.TextBlock-module_TextBlock__5Zpj7 ol,\n.TextBlock-module_TextBlock__5Zpj7 ul {\n padding-left: 20px;\n}\n";
|
2112
|
+
var styles$c = {"text-base":"22px","TextBlock":"TextBlock-module_TextBlock__5Zpj7","dummy":"TextBlock-module_dummy__3W5ls"};
|
2113
|
+
styleInject(css$d);
|
2114
|
+
|
2115
|
+
function TextBlock(props) {
|
2116
|
+
return React.createElement("div", {
|
2117
|
+
className: classnames(styles$c.TextBlock, _defineProperty({}, styles$c.dummy, props.dummy)),
|
2118
|
+
style: props.style,
|
2119
|
+
dangerouslySetInnerHTML: {
|
2120
|
+
__html: props.children
|
2121
|
+
}
|
2122
|
+
});
|
2123
|
+
}
|
2124
|
+
|
2125
|
+
var css$e = ".InlineCaption-module_root__1R8Ib {\n padding: 3px 10px 5px;\n background-color: #fff;\n color: #222;\n font-size: text-s;\n line-height: 1.4;\n text-shadow: none;\n}\n";
|
2126
|
+
var styles$d = {"text-base":"22px","root":"InlineCaption-module_root__1R8Ib"};
|
2127
|
+
styleInject(css$e);
|
2128
|
+
|
2129
|
+
function InlineCaption(props) {
|
2130
|
+
if (props.text) {
|
2131
|
+
return React.createElement("div", {
|
2132
|
+
className: styles$d.root
|
2133
|
+
}, props.text);
|
2134
|
+
} else {
|
2135
|
+
return null;
|
2136
|
+
}
|
2137
|
+
}
|
2138
|
+
|
2139
|
+
var css$f = ".InlineImage-module_root__1DvUb {\n position: relative;\n margin-top: 1em;\n}\n\n.InlineImage-module_container__Pui7E {\n position: relative;\n margin-top: 1em;\n}\n\n.InlineImage-module_spacer__2rMkE {\n padding-top: 75%;\n}\n\n.InlineImage-module_inner__2AMK- {\n border: solid 2px #fff;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n";
|
2140
|
+
var styles$e = {"root":"InlineImage-module_root__1DvUb","container":"InlineImage-module_container__Pui7E","spacer":"InlineImage-module_spacer__2rMkE","inner":"InlineImage-module_inner__2AMK-"};
|
2141
|
+
styleInject(css$f);
|
2142
|
+
|
2143
|
+
function InlineImage(props) {
|
2144
|
+
return React.createElement("div", {
|
2145
|
+
className: classnames(styles$e.root)
|
2146
|
+
}, React.createElement("div", {
|
2147
|
+
className: styles$e.container
|
2148
|
+
}, React.createElement("div", {
|
2149
|
+
className: styles$e.spacer
|
2150
|
+
}, React.createElement("div", {
|
2151
|
+
className: styles$e.inner
|
2152
|
+
}, React.createElement(Image, props)))), React.createElement(InlineCaption, {
|
2153
|
+
text: props.caption
|
2154
|
+
}));
|
2155
|
+
}
|
2156
|
+
|
2157
|
+
var css$g = ".InlineVideo-module_root__2UD3D {\n position: relative;\n max-height: 98vh;\n}\n\n.InlineVideo-module_inner__H81_g {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n";
|
2158
|
+
var styles$f = {"root":"InlineVideo-module_root__2UD3D","inner":"InlineVideo-module_inner__H81_g"};
|
2159
|
+
styleInject(css$g);
|
2160
|
+
|
2161
|
+
function InlineVideo(props) {
|
2162
|
+
var ref = useRef();
|
2163
|
+
var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
|
2164
|
+
return React.createElement("div", {
|
2165
|
+
ref: ref,
|
2166
|
+
className: classnames(styles$f.root)
|
2167
|
+
}, React.createElement("div", {
|
2168
|
+
style: {
|
2169
|
+
paddingTop: props.wideFormat ? '41.15%' : '56.25%'
|
2170
|
+
}
|
2171
|
+
}, React.createElement("div", {
|
2172
|
+
className: styles$f.inner
|
2173
|
+
}, React.createElement(Video, Object.assign({}, props, {
|
2174
|
+
state: onScreen ? 'active' : 'inactive',
|
2175
|
+
interactive: true
|
2176
|
+
})))));
|
2177
|
+
}
|
2178
|
+
|
2179
|
+
var css$h = ".InlineBeforeAfter-module_root__2O9F8 {\n position: relative;\n margin: 0 auto;\n}\n";
|
2180
|
+
var styles$g = {"root":"InlineBeforeAfter-module_root__2O9F8"};
|
2181
|
+
styleInject(css$h);
|
2182
|
+
|
2183
|
+
function InlineBeforeAfter(props) {
|
2184
|
+
var ref = useRef();
|
2185
|
+
var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
|
2186
|
+
return React.createElement("div", {
|
2187
|
+
ref: ref,
|
2188
|
+
className: styles$g.root
|
2189
|
+
}, React.createElement(BeforeAfter, Object.assign({}, props, {
|
2190
|
+
state: onScreen ? 'active' : 'inactive'
|
2191
|
+
})));
|
2192
|
+
}
|
2193
|
+
|
2194
|
+
var css$i = ".SoundDisclaimer-module_soundDisclaimer__1sAiH {\n text-align: center;\n border: 1px solid white;\n border-radius: 4px;\n cursor: pointer;\n font-size: inherit;\n}\n\n.SoundDisclaimer-module_soundDisclaimer__1sAiH:hover {\n background: rgba(255, 255, 255, 0.25);\n}";
|
2195
|
+
var styles$h = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__1sAiH"};
|
2196
|
+
styleInject(css$i);
|
2197
|
+
|
2198
|
+
function UnmuteButton() {
|
2199
|
+
return React.createElement(MutedContext.Consumer, null, function (mutedSettings) {
|
2200
|
+
return React.createElement("div", {
|
2201
|
+
className: classnames(styles$h.soundDisclaimer),
|
2202
|
+
onClick: function onClick() {
|
2203
|
+
return mutedSettings.setMuted(false);
|
2204
|
+
}
|
2205
|
+
}, React.createElement("p", null, "Dieser Artikel wirkt am besten mit eingeschaltetem Ton.", React.createElement("br", null), "Klicken Sie einmal in dieses Feld, um den Ton f\xFCr die gesamte Geschichte zu aktivieren."));
|
2206
|
+
});
|
2207
|
+
}
|
2208
|
+
|
2209
|
+
var loremIpsum1 = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ';
|
2210
|
+
var loremIpsum2 = 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr. Sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.';
|
2211
|
+
var loremIpsum3 = 'Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.';
|
2212
|
+
|
2213
|
+
var templates = {
|
2214
|
+
heading: {
|
2215
|
+
name: 'Überschrift',
|
2216
|
+
component: Heading
|
2217
|
+
},
|
2218
|
+
textBlock: {
|
2219
|
+
name: 'Text Block',
|
2220
|
+
component: TextBlock
|
2221
|
+
},
|
2222
|
+
soundDisclaimer: {
|
2223
|
+
name: 'Sound Disclaimer',
|
2224
|
+
component: UnmuteButton
|
2225
|
+
},
|
2226
|
+
loremIpsum1: {
|
2227
|
+
name: 'Blindtext 1',
|
2228
|
+
component: TextBlock,
|
2229
|
+
props: {
|
2230
|
+
children: loremIpsum1
|
2231
|
+
}
|
2232
|
+
},
|
2233
|
+
loremIpsum2: {
|
2234
|
+
name: 'Blindtext 2',
|
2235
|
+
component: TextBlock,
|
2236
|
+
props: {
|
2237
|
+
children: loremIpsum2
|
2238
|
+
}
|
2239
|
+
},
|
2240
|
+
loremIpsum3: {
|
2241
|
+
name: 'Blindtext 3',
|
2242
|
+
component: TextBlock,
|
2243
|
+
props: {
|
2244
|
+
children: loremIpsum3
|
2245
|
+
}
|
2246
|
+
},
|
2247
|
+
inlineImage: {
|
2248
|
+
name: 'Inline Bild',
|
2249
|
+
component: InlineImage,
|
2250
|
+
inlinePositioning: true
|
2251
|
+
},
|
2252
|
+
inlineVideo: {
|
2253
|
+
name: 'Inline Video',
|
2254
|
+
component: InlineVideo,
|
2255
|
+
inlinePositioning: true
|
2256
|
+
},
|
2257
|
+
inlineBeforeAfter: {
|
2258
|
+
name: 'Inline Before/After',
|
2259
|
+
component: InlineBeforeAfter,
|
2260
|
+
inlinePositioning: true
|
2261
|
+
},
|
2262
|
+
stickyImage: {
|
2263
|
+
name: 'Sticky Bild',
|
2264
|
+
component: InlineImage,
|
2265
|
+
inlinePositioning: true
|
2266
|
+
}
|
2267
|
+
};
|
2268
|
+
|
2269
|
+
function ForegroundItem(props) {
|
2270
|
+
var template = templates[props.type];
|
2271
|
+
var Component = template.component;
|
2272
|
+
return React.createElement(Component, Object.assign({}, template.props, props.itemProps));
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
function ForegroundItems(props) {
|
2276
|
+
return React.createElement(React.Fragment, null, props.items.map(function (item, index) {
|
2277
|
+
return props.children(item, React.createElement(ForegroundItem, {
|
2278
|
+
key: index,
|
2279
|
+
type: item.type,
|
2280
|
+
position: item.position,
|
2281
|
+
itemProps: item.props
|
2282
|
+
}));
|
2283
|
+
}));
|
2284
|
+
}
|
2285
|
+
ForegroundItems.defaultProps = {
|
2286
|
+
children: function children(item, child) {
|
2287
|
+
return child;
|
2288
|
+
}
|
2289
|
+
};
|
2290
|
+
|
2291
|
+
var css$j = ".TwoColumn-module_root__37EqL {\n}\n\n.TwoColumn-module_group__3Hg2y {\n clear: right;\n margin-left: 8%;\n margin-right: 8%;\n}\n\n.TwoColumn-module_group-full__2OT4o {\n margin-left: 0;\n margin-right: 0;\n}\n\n.TwoColumn-module_sticky__4LCDO,\n.TwoColumn-module_inline__1fPfM {\n max-width: 500px;\n}\n\n.TwoColumn-module_right__Fr52a .TwoColumn-module_inline__1fPfM {\n margin-left: auto;\n}\n\n@media (max-width: 949px) {\n .TwoColumn-module_right__Fr52a .TwoColumn-module_sticky__4LCDO {\n margin-left: auto;\n }\n}\n\n@media (min-width: 950px) {\n .TwoColumn-module_sticky__4LCDO {\n position: sticky;\n float: right;\n top: 33%;\n width: 30%;\n max-width: 600px;\n }\n\n .TwoColumn-module_right__Fr52a .TwoColumn-module_sticky__4LCDO {\n float: left;\n }\n}\n";
|
2292
|
+
var styles$i = {"root":"TwoColumn-module_root__37EqL","group":"TwoColumn-module_group__3Hg2y","group-full":"TwoColumn-module_group-full__2OT4o","sticky":"TwoColumn-module_sticky__4LCDO","inline":"TwoColumn-module_inline__1fPfM","right":"TwoColumn-module_right__Fr52a"};
|
2293
|
+
styleInject(css$j);
|
2294
|
+
|
2295
|
+
var availablePositions = ['inline', 'sticky', 'full'];
|
2296
|
+
function TwoColumn(props) {
|
2297
|
+
return React.createElement("div", {
|
2298
|
+
className: classnames(styles$i.root, styles$i[props.align])
|
2299
|
+
}, React.createElement("div", {
|
2300
|
+
className: styles$i.inline,
|
2301
|
+
ref: props.contentAreaRef
|
2302
|
+
}), renderItems(props));
|
2303
|
+
}
|
2304
|
+
TwoColumn.defaultProps = {
|
2305
|
+
align: 'left'
|
2306
|
+
};
|
2307
|
+
|
2308
|
+
function renderItems(props) {
|
2309
|
+
return groupItemsByPosition(props.items).map(function (group, index) {
|
2310
|
+
return React.createElement("div", {
|
2311
|
+
key: index,
|
2312
|
+
className: classnames(styles$i.group, styles$i["group-".concat(group.position)])
|
2313
|
+
}, renderItemGroup(props, group, 'sticky'), renderItemGroup(props, group, 'inline'), renderItemGroup(props, group, 'full'));
|
2314
|
+
});
|
2315
|
+
}
|
2316
|
+
|
2317
|
+
function renderItemGroup(props, group, position) {
|
2318
|
+
if (group[position].length) {
|
2319
|
+
return React.createElement("div", {
|
2320
|
+
className: styles$i[position]
|
2321
|
+
}, props.children(React.createElement(ForegroundItems, {
|
2322
|
+
items: group[position]
|
2323
|
+
})));
|
2324
|
+
}
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
function groupItemsByPosition(items) {
|
2328
|
+
var groups = [];
|
2329
|
+
var currentGroup;
|
2330
|
+
items.reduce(function (previousItemPosition, item, index) {
|
2331
|
+
var position = availablePositions.indexOf(item.position) >= 0 ? item.position : 'inline';
|
2332
|
+
|
2333
|
+
if (!previousItemPosition || previousItemPosition !== position && (previousItemPosition !== 'sticky' || position !== 'inline')) {
|
2334
|
+
currentGroup = {
|
2335
|
+
position: position,
|
2336
|
+
sticky: [],
|
2337
|
+
inline: [],
|
2338
|
+
full: []
|
2339
|
+
};
|
2340
|
+
groups = [].concat(_toConsumableArray(groups), [currentGroup]);
|
2341
|
+
}
|
2342
|
+
|
2343
|
+
currentGroup[position].push(item);
|
2344
|
+
return position;
|
2345
|
+
}, null);
|
2346
|
+
return groups;
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
var css$k = ".Center-module_outer__3Rr0H {\n margin-left: 8%;\n margin-right: 8%;\n}\n\n.Center-module_outer-full__3dknO {\n margin-left: 0;\n margin-right: 0;\n}\n\n.Center-module_item__1KSs3 {\n margin-left: auto;\n margin-right: auto;\n max-width: 700px;\n}\n\n.Center-module_item-full__1cEuv {\n margin-left: 0;\n margin-right: 0;\n max-width: none;\n}\n\n@media (min-width: 950px) {\n .Center-module_inner-left__2z9Ea {\n float: left;\n width: 60%;\n margin-left: -10%;\n margin-right: 1em;\n margin-bottom: 1em;\n }\n\n .Center-module_inner-right__KBkVt {\n float: right;\n width: 60%;\n margin-right: -10%;\n margin-left: 1em;\n margin-bottom: 1em;\n }\n}\n";
|
2350
|
+
var styles$j = {"outer":"Center-module_outer__3Rr0H","outer-full":"Center-module_outer-full__3dknO","item":"Center-module_item__1KSs3","item-full":"Center-module_item-full__1cEuv","inner-left":"Center-module_inner-left__2z9Ea","inner-right":"Center-module_inner-right__KBkVt"};
|
2351
|
+
styleInject(css$k);
|
2352
|
+
|
2353
|
+
function Center(props) {
|
2354
|
+
return React.createElement("div", {
|
2355
|
+
className: classnames(styles$j.root)
|
2356
|
+
}, React.createElement("div", {
|
2357
|
+
ref: props.contentAreaRef
|
2358
|
+
}), React.createElement(ForegroundItems, {
|
2359
|
+
items: props.items
|
2360
|
+
}, function (item, child) {
|
2361
|
+
return React.createElement("div", {
|
2362
|
+
key: item.index,
|
2363
|
+
className: classnames(styles$j.outer, styles$j["outer-".concat(item.position)])
|
2364
|
+
}, React.createElement("div", {
|
2365
|
+
className: classnames(styles$j.item, styles$j["item-".concat(item.position)])
|
2366
|
+
}, props.children(React.createElement("div", {
|
2367
|
+
className: styles$j["inner-".concat(item.position)]
|
2368
|
+
}, child))));
|
2369
|
+
}));
|
2370
|
+
}
|
2371
|
+
|
2372
|
+
function Layout(props) {
|
2373
|
+
if (props.layout === 'center') {
|
2374
|
+
return React.createElement(Center, props);
|
2375
|
+
} else if (props.layout === 'right') {
|
2376
|
+
return React.createElement(TwoColumn, Object.assign({
|
2377
|
+
align: "right"
|
2378
|
+
}, props));
|
2379
|
+
} else {
|
2380
|
+
return React.createElement(TwoColumn, props);
|
2381
|
+
}
|
2382
|
+
}
|
2383
|
+
Layout.defaultProps = {
|
2384
|
+
layout: 'left'
|
2385
|
+
};
|
2386
|
+
|
2387
|
+
function isIntersectingX(rectA, rectB) {
|
2388
|
+
return rectA.left < rectB.right && rectA.right > rectB.left || rectB.left < rectA.right && rectB.right > rectA.left;
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
function getBoundingClientRect(el) {
|
2392
|
+
if (!el) {
|
2393
|
+
return {
|
2394
|
+
left: 0,
|
2395
|
+
right: 0,
|
2396
|
+
top: 0,
|
2397
|
+
bottom: 0,
|
2398
|
+
width: 0,
|
2399
|
+
height: 0
|
2400
|
+
};
|
2401
|
+
}
|
2402
|
+
|
2403
|
+
return el.getBoundingClientRect();
|
2404
|
+
}
|
2405
|
+
|
2406
|
+
function useBoundingClientRect() {
|
2407
|
+
var _useState = useState(getBoundingClientRect(null)),
|
2408
|
+
_useState2 = _slicedToArray(_useState, 2),
|
2409
|
+
boundingClientRect = _useState2[0],
|
2410
|
+
setBoundingClientRect = _useState2[1];
|
2411
|
+
|
2412
|
+
var _useState3 = useState(null),
|
2413
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
2414
|
+
currentNode = _useState4[0],
|
2415
|
+
setCurrentNode = _useState4[1];
|
2416
|
+
|
2417
|
+
var measureRef = useCallback(function (node) {
|
2418
|
+
setCurrentNode(node);
|
2419
|
+
setBoundingClientRect(getBoundingClientRect(node));
|
2420
|
+
}, []);
|
2421
|
+
useEffect(function () {
|
2422
|
+
function handler() {
|
2423
|
+
setBoundingClientRect(getBoundingClientRect(currentNode));
|
2424
|
+
}
|
2425
|
+
|
2426
|
+
if (!currentNode) {
|
2427
|
+
return;
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
window.addEventListener('resize', handler);
|
2431
|
+
window.addEventListener('scroll', handler);
|
2432
|
+
return function () {
|
2433
|
+
window.removeEventListener('resize', handler);
|
2434
|
+
window.removeEventListener('scroll', handler);
|
2435
|
+
};
|
2436
|
+
}, [currentNode]);
|
2437
|
+
return [boundingClientRect, measureRef];
|
2438
|
+
}
|
2439
|
+
|
2440
|
+
function useScrollTarget(ref, isScrollTarget) {
|
2441
|
+
useEffect(function () {
|
2442
|
+
if (ref.current && isScrollTarget) {
|
2443
|
+
window.scrollTo({
|
2444
|
+
top: ref.current.getBoundingClientRect().top + window.scrollY - window.innerHeight * 0.25,
|
2445
|
+
behavior: 'smooth'
|
2446
|
+
});
|
2447
|
+
}
|
2448
|
+
}, [ref, isScrollTarget]);
|
2449
|
+
}
|
2450
|
+
|
2451
|
+
var css$l = ".Section-module_Section__Yo58b {\n position: relative;\n}\n\n.Section-module_invert__3_p7F {\n color: #222;\n}\n\n.Section-module_activityProbe__Fsklh {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 2px;\n width: 1px;\n}\n";
|
2452
|
+
var styles$k = {"Section":"Section-module_Section__Yo58b","invert":"Section-module_invert__3_p7F","activityProbe":"Section-module_activityProbe__Fsklh"};
|
2453
|
+
styleInject(css$l);
|
2454
|
+
|
2455
|
+
var css$m = "\n\n.fadeInBgConceal-module_backdrop__11JGO {\n position: absolute;\n height: 100%;\n}\n\n.fadeInBgConceal-module_backdropInner__1IAYD {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInBgConceal-module_backdrop__11JGO {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInBgConceal-module_backdrop-below__3E6Uk {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2456
|
+
var fadeInBgConceal = {"fade-duration":"0.5s","backdrop":"fadeInBgConceal-module_backdrop__11JGO","backdropInner":"fadeInBgConceal-module_backdropInner__1IAYD","backdrop-below":"fadeInBgConceal-module_backdrop-below__3E6Uk"};
|
2457
|
+
styleInject(css$m);
|
2458
|
+
|
2459
|
+
var css$n = "\n\n.fadeInBgFadeOut-module_backdrop__r0YXp {\n position: absolute;\n height: 100%;\n}\n\n.fadeInBgFadeOut-module_backdropInner__IQp87 {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInBgFadeOut-module_backdrop__r0YXp .fadeInBgFadeOut-module_backdropInner__IQp87,\n.fadeInBgFadeOut-module_foreground__Q2vkT {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInBgFadeOut-module_foreground-above__3pmz9,\n.fadeInBgFadeOut-module_backdrop-below__2G-Ic .fadeInBgFadeOut-module_backdropInner__IQp87 {\n opacity: 0;\n visibility: hidden;\n}\n\n.fadeInBgFadeOut-module_bbackdrop__1thge::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.fadeInBgFadeOut-module_bbackdrop-below__yaeMc::before {\n visibility: hidden;\n}\n";
|
2460
|
+
var fadeInBgFadeOut = {"fade-duration":"0.5s","backdrop":"fadeInBgFadeOut-module_backdrop__r0YXp","backdropInner":"fadeInBgFadeOut-module_backdropInner__IQp87","foreground":"fadeInBgFadeOut-module_foreground__Q2vkT","foreground-above":"fadeInBgFadeOut-module_foreground-above__3pmz9","backdrop-below":"fadeInBgFadeOut-module_backdrop-below__2G-Ic","bbackdrop":"fadeInBgFadeOut-module_bbackdrop__1thge","bbackdrop-below":"fadeInBgFadeOut-module_bbackdrop-below__yaeMc"};
|
2461
|
+
styleInject(css$n);
|
2462
|
+
|
2463
|
+
var css$o = "\n\n.fadeInBgFadeOutBg-module_backdrop__15ocl {\n position: absolute;\n height: 100%;\n}\n\n.fadeInBgFadeOutBg-module_backdropInner__sAnz6 {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInBgFadeOutBg-module_boxShadow__xUKyj,\n.fadeInBgFadeOutBg-module_backdrop__15ocl .fadeInBgFadeOutBg-module_backdropInner__sAnz6 {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInBgFadeOutBg-module_boxShadow-above__2bY0E,\n.fadeInBgFadeOutBg-module_backdrop-below__1rDT6 .fadeInBgFadeOutBg-module_backdropInner__sAnz6 {\n opacity: 0;\n visibility: hidden;\n}\n\n.fadeInBgFadeOutBg-module_bbackdrop__25Ux-::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.fadeInBgFadeOutBg-module_bbackdrop-below__2MPgj::before {\n visibility: hidden;\n}\n";
|
2464
|
+
var fadeInBgFadeOutBg = {"fade-duration":"0.5s","backdrop":"fadeInBgFadeOutBg-module_backdrop__15ocl","backdropInner":"fadeInBgFadeOutBg-module_backdropInner__sAnz6","boxShadow":"fadeInBgFadeOutBg-module_boxShadow__xUKyj","boxShadow-above":"fadeInBgFadeOutBg-module_boxShadow-above__2bY0E","backdrop-below":"fadeInBgFadeOutBg-module_backdrop-below__1rDT6","bbackdrop":"fadeInBgFadeOutBg-module_bbackdrop__25Ux-","bbackdrop-below":"fadeInBgFadeOutBg-module_bbackdrop-below__2MPgj"};
|
2465
|
+
styleInject(css$o);
|
2466
|
+
|
2467
|
+
var css$p = "\n\n.fadeInBgScrollOut-module_backdrop__1bSsb {\n position: absolute;\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n\n.fadeInBgScrollOut-module_backdropInner__3JZBG {\n position: sticky;\n bottom: 0;\n width: 100%;\n}\n\n.fadeInBgScrollOut-module_backdropInner2__q-00L {\n position: absolute;\n bottom: 0;\n width: 100%;\n}\n\n.fadeInBgScrollOut-module_foreground__1ODH9 {\n min-height: 100vh;\n}\n\n.fadeInBgScrollOut-module_backdrop__1bSsb {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInBgScrollOut-module_backdrop-below__2Dbkr {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2468
|
+
var fadeInBgScrollOut = {"fade-duration":"0.5s","backdrop":"fadeInBgScrollOut-module_backdrop__1bSsb","backdropInner":"fadeInBgScrollOut-module_backdropInner__3JZBG","backdropInner2":"fadeInBgScrollOut-module_backdropInner2__q-00L","foreground":"fadeInBgScrollOut-module_foreground__1ODH9","backdrop-below":"fadeInBgScrollOut-module_backdrop-below__2Dbkr"};
|
2469
|
+
styleInject(css$p);
|
2470
|
+
|
2471
|
+
var css$q = "\n\n.fadeInConceal-module_backdrop__1zaRO {\n position: absolute;\n height: 100%;\n}\n\n.fadeInConceal-module_backdropInner__1AIvq {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInConceal-module_backdrop__1zaRO,\n.fadeInConceal-module_foreground__3giM9 {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInConceal-module_backdrop-below__AWyQe,\n.fadeInConceal-module_foreground-below__2z5Op {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2472
|
+
var fadeInConceal = {"fade-duration":"0.5s","backdrop":"fadeInConceal-module_backdrop__1zaRO","backdropInner":"fadeInConceal-module_backdropInner__1AIvq","foreground":"fadeInConceal-module_foreground__3giM9","backdrop-below":"fadeInConceal-module_backdrop-below__AWyQe","foreground-below":"fadeInConceal-module_foreground-below__2z5Op"};
|
2473
|
+
styleInject(css$q);
|
2474
|
+
|
2475
|
+
var css$r = "\n\n.fadeInFadeOut-module_backdrop__Y4xOA {\n position: absolute;\n height: 100%;\n}\n\n.fadeInFadeOut-module_backdropInner__1oRfP {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInFadeOut-module_backdrop__Y4xOA .fadeInFadeOut-module_backdropInner__1oRfP,\n.fadeInFadeOut-module_foreground__1eleZ {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInFadeOut-module_foreground-above__249wa,\n.fadeInFadeOut-module_backdrop-below__1h2I4 .fadeInFadeOut-module_backdropInner__1oRfP,\n.fadeInFadeOut-module_foreground-below__3mE6f {\n opacity: 0;\n visibility: hidden;\n}\n\n.fadeInFadeOut-module_bbackdrop__WJjFl::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.fadeInFadeOut-module_bbackdrop-below__1Htkz::before {\n visibility: hidden;\n}\n";
|
2476
|
+
var fadeInFadeOut = {"fade-duration":"0.5s","backdrop":"fadeInFadeOut-module_backdrop__Y4xOA","backdropInner":"fadeInFadeOut-module_backdropInner__1oRfP","foreground":"fadeInFadeOut-module_foreground__1eleZ","foreground-above":"fadeInFadeOut-module_foreground-above__249wa","backdrop-below":"fadeInFadeOut-module_backdrop-below__1h2I4","foreground-below":"fadeInFadeOut-module_foreground-below__3mE6f","bbackdrop":"fadeInFadeOut-module_bbackdrop__WJjFl","bbackdrop-below":"fadeInFadeOut-module_bbackdrop-below__1Htkz"};
|
2477
|
+
styleInject(css$r);
|
2478
|
+
|
2479
|
+
var css$s = "\n\n.fadeInFadeOutBg-module_backdrop__2-IF3 {\n position: absolute;\n height: 100%;\n}\n\n.fadeInFadeOutBg-module_backdropInner__3r_bo {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n}\n\n.fadeInFadeOutBg-module_backdrop__2-IF3 .fadeInFadeOutBg-module_backdropInner__3r_bo,\n.fadeInFadeOutBg-module_boxShadow__3x7Ki,\n.fadeInFadeOutBg-module_foreground__24f_M {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInFadeOutBg-module_backdrop-below__4Ys_2 .fadeInFadeOutBg-module_backdropInner__3r_bo,\n.fadeInFadeOutBg-module_boxShadow-above__3T2K5,\n.fadeInFadeOutBg-module_foreground-below__3pTRc {\n opacity: 0;\n visibility: hidden;\n}\n\n.fadeInFadeOutBg-module_bbackdrop__MVdvw::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.fadeInFadeOutBg-module_bbackdrop-below__30mpF::before {\n visibility: hidden;\n}\n";
|
2480
|
+
var fadeInFadeOutBg = {"fade-duration":"0.5s","backdrop":"fadeInFadeOutBg-module_backdrop__2-IF3","backdropInner":"fadeInFadeOutBg-module_backdropInner__3r_bo","boxShadow":"fadeInFadeOutBg-module_boxShadow__3x7Ki","foreground":"fadeInFadeOutBg-module_foreground__24f_M","backdrop-below":"fadeInFadeOutBg-module_backdrop-below__4Ys_2","boxShadow-above":"fadeInFadeOutBg-module_boxShadow-above__3T2K5","foreground-below":"fadeInFadeOutBg-module_foreground-below__3pTRc","bbackdrop":"fadeInFadeOutBg-module_bbackdrop__MVdvw","bbackdrop-below":"fadeInFadeOutBg-module_bbackdrop-below__30mpF"};
|
2481
|
+
styleInject(css$s);
|
2482
|
+
|
2483
|
+
var css$t = "\n\n.fadeInScrollOut-module_backdrop__2FhBb {\n position: absolute;\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n\n.fadeInScrollOut-module_backdropInner__1OfNZ {\n position: sticky;\n bottom: 0;\n width: 100%;\n}\n\n.fadeInScrollOut-module_backdropInner2__5bNPT {\n position: absolute;\n bottom: 0;\n width: 100%;\n}\n\n.fadeInScrollOut-module_foreground__3h0EX {\n min-height: 100vh;\n}\n\n.fadeInScrollOut-module_backdrop__2FhBb,\n.fadeInScrollOut-module_foreground__3h0EX {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.fadeInScrollOut-module_backdrop-below__3cRLH,\n.fadeInScrollOut-module_foreground-below__1Jcql {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2484
|
+
var fadeInScrollOut = {"fade-duration":"0.5s","backdrop":"fadeInScrollOut-module_backdrop__2FhBb","backdropInner":"fadeInScrollOut-module_backdropInner__1OfNZ","backdropInner2":"fadeInScrollOut-module_backdropInner2__5bNPT","foreground":"fadeInScrollOut-module_foreground__3h0EX","backdrop-below":"fadeInScrollOut-module_backdrop-below__3cRLH","foreground-below":"fadeInScrollOut-module_foreground-below__1Jcql"};
|
2485
|
+
styleInject(css$t);
|
2486
|
+
|
2487
|
+
var css$u = ".revealConceal-module_backdrop__dLUhU {\n position: absolute;\n clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);\n height: 100%;\n}\n\n.revealConceal-module_backdropInner__2k1Z- {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n";
|
2488
|
+
var revealConceal = {"backdrop":"revealConceal-module_backdrop__dLUhU","backdropInner":"revealConceal-module_backdropInner__2k1Z-"};
|
2489
|
+
styleInject(css$u);
|
2490
|
+
|
2491
|
+
var css$v = "\n\n.revealFadeOut-module_backdrop___Q1QF {\n position: absolute;\n clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);\n height: 200%;\n}\n\n.revealFadeOut-module_backdropInner__17qRn {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n\n.revealFadeOut-module_foreground__1GzBs {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.revealFadeOut-module_foreground-above__3GxOf {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2492
|
+
var revealFadeOut = {"fade-duration":"0.5s","backdrop":"revealFadeOut-module_backdrop___Q1QF","backdropInner":"revealFadeOut-module_backdropInner__17qRn","foreground":"revealFadeOut-module_foreground__1GzBs","foreground-above":"revealFadeOut-module_foreground-above__3GxOf"};
|
2493
|
+
styleInject(css$v);
|
2494
|
+
|
2495
|
+
var css$w = "\n\n.revealFadeOutBg-module_backdrop__30OCF {\n position: absolute;\n clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);\n height: 200%;\n}\n\n.revealFadeOutBg-module_backdropInner__3v3tM {\n position: fixed;\n top: 0;\n height: 100vh;\n width: 100%;\n\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n\n.revealFadeOutBg-module_boxShadow__1NZRz {\n transition: opacity 1s ease, visibility 1s;\n}\n\n.revealFadeOutBg-module_boxShadow-above__2r4ov {\n opacity: 0;\n visibility: hidden;\n}\n";
|
2496
|
+
var revealFadeOutBg = {"fade-duration":"0.5s","backdrop":"revealFadeOutBg-module_backdrop__30OCF","backdropInner":"revealFadeOutBg-module_backdropInner__3v3tM","boxShadow":"revealFadeOutBg-module_boxShadow__1NZRz","boxShadow-above":"revealFadeOutBg-module_boxShadow-above__2r4ov"};
|
2497
|
+
styleInject(css$w);
|
2498
|
+
|
2499
|
+
var css$x = ".revealScrollOut-module_backdrop__2yOXd {\n position: absolute;\n clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n\n.revealScrollOut-module_backdropInner__211p3 {\n position: sticky;\n bottom: 0;\n width: 100%;\n\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n\n.revealScrollOut-module_backdropInner2__v6WqM {\n position: absolute;\n bottom: 0;\n width: 100%;\n}\n\n.revealScrollOut-module_foreground__3z-hw {\n}\n";
|
2500
|
+
var revealScrollOut = {"backdrop":"revealScrollOut-module_backdrop__2yOXd","backdropInner":"revealScrollOut-module_backdropInner__211p3","backdropInner2":"revealScrollOut-module_backdropInner2__v6WqM","foreground":"revealScrollOut-module_foreground__3z-hw"};
|
2501
|
+
styleInject(css$x);
|
2502
|
+
|
2503
|
+
var css$y = ".scrollInConceal-module_backdrop__2OJJC {\n position: sticky;\n top: 0;\n height: 0;\n}\n";
|
2504
|
+
var scrollInConceal = {"backdrop":"scrollInConceal-module_backdrop__2OJJC"};
|
2505
|
+
styleInject(css$y);
|
2506
|
+
|
2507
|
+
var css$z = "\n\n.scrollInFadeOut-module_backdrop__1vXJd {\n position: sticky;\n top: 0;\n height: 0;\n}\n\n.scrollInFadeOut-module_foreground__3Ikxb {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.scrollInFadeOut-module_foreground-above__6ipm- {\n opacity: 0;\n visibility: hidden;\n}\n\n.scrollInFadeOut-module_bbackdrop__2C-bf::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.scrollInFadeOut-module_bbackdrop-below__3tq0M::before {\n visibility: hidden;\n}\n";
|
2508
|
+
var scrollInFadeOut = {"fade-duration":"0.5s","backdrop":"scrollInFadeOut-module_backdrop__1vXJd","foreground":"scrollInFadeOut-module_foreground__3Ikxb","foreground-above":"scrollInFadeOut-module_foreground-above__6ipm-","bbackdrop":"scrollInFadeOut-module_bbackdrop__2C-bf","bbackdrop-below":"scrollInFadeOut-module_bbackdrop-below__3tq0M"};
|
2509
|
+
styleInject(css$z);
|
2510
|
+
|
2511
|
+
var css$A = "\n\n.scrollInFadeOutBg-module_backdrop__zw95c {\n position: sticky;\n top: 0;\n height: 0;\n}\n\n.scrollInFadeOutBg-module_boxShadow__3UxCQ {\n transition: opacity 0.5s ease, visibility 0.5s;\n}\n\n.scrollInFadeOutBg-module_boxShadow-above__3kfau {\n opacity: 0;\n visibility: hidden;\n}\n\n.scrollInFadeOutBg-module_bbackdrop__2pO9o::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n background-color: #000;\n}\n\n.scrollInFadeOutBg-module_bbackdrop-below__1Ky2w::before {\n visibility: hidden;\n}\n";
|
2512
|
+
var scrollInFadeOutBg = {"fade-duration":"0.5s","backdrop":"scrollInFadeOutBg-module_backdrop__zw95c","boxShadow":"scrollInFadeOutBg-module_boxShadow__3UxCQ","boxShadow-above":"scrollInFadeOutBg-module_boxShadow-above__3kfau","bbackdrop":"scrollInFadeOutBg-module_bbackdrop__2pO9o","bbackdrop-below":"scrollInFadeOutBg-module_bbackdrop-below__1Ky2w"};
|
2513
|
+
styleInject(css$A);
|
2514
|
+
|
2515
|
+
var css$B = ".scrollInScrollOut-module_backdrop__XzCge {\n position: sticky;\n top: 0;\n height: 100vh;\n}\n\n.scrollInScrollOut-module_foreground__1yyY8 {\n margin-top: -100vh;\n}\n";
|
2516
|
+
var scrollInScrollOut = {"backdrop":"scrollInScrollOut-module_backdrop__XzCge","foreground":"scrollInScrollOut-module_foreground__1yyY8"};
|
2517
|
+
styleInject(css$B);
|
2518
|
+
|
2519
|
+
var styles$l = {
|
2520
|
+
fadeInBgConceal: fadeInBgConceal,
|
2521
|
+
fadeInBgFadeOut: fadeInBgFadeOut,
|
2522
|
+
fadeInBgFadeOutBg: fadeInBgFadeOutBg,
|
2523
|
+
fadeInBgScrollOut: fadeInBgScrollOut,
|
2524
|
+
fadeInConceal: fadeInConceal,
|
2525
|
+
fadeInFadeOut: fadeInFadeOut,
|
2526
|
+
fadeInFadeOutBg: fadeInFadeOutBg,
|
2527
|
+
fadeInScrollOut: fadeInScrollOut,
|
2528
|
+
revealConceal: revealConceal,
|
2529
|
+
revealFadeOut: revealFadeOut,
|
2530
|
+
revealFadeOutBg: revealFadeOutBg,
|
2531
|
+
revealScrollOut: revealScrollOut,
|
2532
|
+
scrollInConceal: scrollInConceal,
|
2533
|
+
scrollInFadeOut: scrollInFadeOut,
|
2534
|
+
scrollInFadeOutBg: scrollInFadeOutBg,
|
2535
|
+
scrollInScrollOut: scrollInScrollOut
|
2536
|
+
};
|
2537
|
+
var enterTransitions = {
|
2538
|
+
fade: 'fadeIn',
|
2539
|
+
fadeBg: 'fadeInBg',
|
2540
|
+
scroll: 'scrollIn',
|
2541
|
+
scrollOver: 'scrollIn',
|
2542
|
+
reveal: 'reveal',
|
2543
|
+
beforeAfter: 'reveal'
|
2544
|
+
};
|
2545
|
+
var exitTransitions = {
|
2546
|
+
fade: 'fadeOut',
|
2547
|
+
fadeBg: 'fadeOutBg',
|
2548
|
+
scroll: 'scrollOut',
|
2549
|
+
scrollOver: 'conceal',
|
2550
|
+
reveal: 'scrollOut',
|
2551
|
+
beforeAfter: 'conceal'
|
2552
|
+
};
|
2553
|
+
function getTransitionStyles(section, previousSection, nextSection) {
|
2554
|
+
var enterTransition = enterTransitions[section.transition];
|
2555
|
+
var exitTransition = exitTransitions[nextSection ? nextSection.transition : 'scroll'];
|
2556
|
+
var name = "".concat(enterTransition).concat(capitalize(exitTransition));
|
2557
|
+
|
2558
|
+
if (!styles$l[name]) {
|
2559
|
+
throw new Error("Unknown transition ".concat(name));
|
2560
|
+
}
|
2561
|
+
|
2562
|
+
return styles$l[name];
|
2563
|
+
}
|
2564
|
+
|
2565
|
+
function capitalize(string) {
|
2566
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
2567
|
+
}
|
2568
|
+
|
2569
|
+
function NoOpShadow(props) {
|
2570
|
+
return React.createElement("div", null, props.children);
|
2571
|
+
}
|
2572
|
+
|
2573
|
+
var css$C = ".GradientShadow-module_shadow__2UiDH {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 1;\n transition: opacity 1s ease;\n}\n\n.GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadow__2UiDH,\n.GradientShadow-module_align-left__3qcNM .GradientShadow-module_shadow__2UiDH {\n background: linear-gradient(to right, #000 0%,rgba(0, 0, 0, 0) 100%);\n}\n\n@media (min-width: 950px) {\n .GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadow__2UiDH {\n background: linear-gradient(to left, #000 0%,rgba(0, 0, 0, 0) 100%);\n }\n}\n\n.GradientShadow-module_intersecting__h6vpz .GradientShadow-module_shadow__2UiDH,\n.GradientShadow-module_align-center__2C7cl .GradientShadow-module_shadow__2UiDH {\n background: #000;\n}\n";
|
2574
|
+
var styles$m = {"shadow":"GradientShadow-module_shadow__2UiDH","align-right":"GradientShadow-module_align-right__3iXZs","align-left":"GradientShadow-module_align-left__3qcNM","intersecting":"GradientShadow-module_intersecting__h6vpz","align-center":"GradientShadow-module_align-center__2C7cl"};
|
2575
|
+
styleInject(css$C);
|
2576
|
+
|
2577
|
+
function GradientShadow(props) {
|
2578
|
+
var maxOpacityOverlap = props.motifAreaRect.height / 2;
|
2579
|
+
var motifAreaOverlap = Math.min(maxOpacityOverlap, props.motifAreaRect.bottom - props.contentAreaRect.top);
|
2580
|
+
var opacityFactor = props.intersecting && props.motifAreaRect.height > 0 ? motifAreaOverlap / maxOpacityOverlap : 1;
|
2581
|
+
return React.createElement("div", {
|
2582
|
+
className: classnames(styles$m.root, styles$m["align-".concat(props.align)], _defineProperty({}, styles$m.intersecting, props.intersecting))
|
2583
|
+
}, React.createElement("div", {
|
2584
|
+
className: styles$m.shadow,
|
2585
|
+
style: {
|
2586
|
+
opacity: props.opacity * Math.round(opacityFactor * 10) / 10
|
2587
|
+
}
|
2588
|
+
}), props.children);
|
2589
|
+
}
|
2590
|
+
GradientShadow.defaultProps = {
|
2591
|
+
opacity: 0.7,
|
2592
|
+
align: 'left'
|
2593
|
+
};
|
2594
|
+
|
2595
|
+
function NoOpBoxWrapper(props) {
|
2596
|
+
return React.createElement("div", null, props.children);
|
2597
|
+
}
|
2598
|
+
|
2599
|
+
var css$D = ".GradientBox-module_wrapper__1Jj7N {\n padding-bottom: 50px;\n}\n\n.GradientBox-module_shadow__2XilX {\n --background: rgba(0, 0, 0, 0.7);\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n pointer-events: none;\n}\n\n.GradientBox-module_long__10s6v .GradientBox-module_shadow__2XilX {\n bottom: -100vh;\n}\n\n.GradientBox-module_gradient__31tJ- {\n text-shadow: 0px 1px 5px black;\n}\n\n.GradientBox-module_gradient__31tJ- .GradientBox-module_shadow__2XilX {\n background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0px,rgba(0, 0, 0, 0.3) 100px,rgba(0, 0, 0, 0.3) 100%);\n}\n\n.GradientBox-module_content__96lDk {\n position: relative;\n}\n";
|
2600
|
+
var styles$n = {"wrapper":"GradientBox-module_wrapper__1Jj7N","shadow":"GradientBox-module_shadow__2XilX","long":"GradientBox-module_long__10s6v","gradient":"GradientBox-module_gradient__31tJ-","content":"GradientBox-module_content__96lDk"};
|
2601
|
+
styleInject(css$D);
|
2602
|
+
|
2603
|
+
function GradientBox(props) {
|
2604
|
+
var _classNames;
|
2605
|
+
|
2606
|
+
var padding = props.active ? props.padding : 0;
|
2607
|
+
return React.createElement("div", {
|
2608
|
+
className: classnames(styles$n.root, (_classNames = {}, _defineProperty(_classNames, styles$n.gradient, padding > 0), _defineProperty(_classNames, styles$n["long"], props.coverInvisibleNextSection), _classNames)),
|
2609
|
+
style: {
|
2610
|
+
paddingTop: padding
|
2611
|
+
}
|
2612
|
+
}, React.createElement("div", {
|
2613
|
+
className: styles$n.wrapper
|
2614
|
+
}, React.createElement("div", {
|
2615
|
+
className: classnames(styles$n.shadow, props.transitionStyles.boxShadow, props.transitionStyles["boxShadow-".concat(props.state)]),
|
2616
|
+
style: {
|
2617
|
+
top: padding,
|
2618
|
+
opacity: props.opacity
|
2619
|
+
}
|
2620
|
+
}), React.createElement("div", {
|
2621
|
+
className: styles$n.content
|
2622
|
+
}, props.children)));
|
2623
|
+
}
|
2624
|
+
GradientBox.defaultProps = {
|
2625
|
+
opacity: 1
|
2626
|
+
};
|
2627
|
+
|
2628
|
+
var css$E = ".CardBox-module_wrapper__3vnaH {\n}\n\n.CardBox-module_content__36v7J {\n position: relative;\n}\n";
|
2629
|
+
var styles$o = {"wrapper":"CardBox-module_wrapper__3vnaH","content":"CardBox-module_content__36v7J"};
|
2630
|
+
styleInject(css$E);
|
2631
|
+
|
2632
|
+
function CardBox(props) {
|
2633
|
+
var padding = props.active ? props.padding : 0;
|
2634
|
+
return React.createElement("div", {
|
2635
|
+
style: {
|
2636
|
+
paddingTop: padding
|
2637
|
+
}
|
2638
|
+
}, React.createElement("div", {
|
2639
|
+
className: styles$o.wrapper
|
2640
|
+
}, React.createElement("div", {
|
2641
|
+
style: {
|
2642
|
+
top: padding
|
2643
|
+
}
|
2644
|
+
}), React.createElement("div", {
|
2645
|
+
className: styles$o.content
|
2646
|
+
}, props.children)));
|
2647
|
+
}
|
2648
|
+
|
2649
|
+
var css$F = ".CardBoxWrapper-module_cardBg__154o2 {\n background: white;\n color: black;\n padding: 4%;\n margin: 0 -4% 50px 0;\n border-radius: 15px;\n opacity: 1;\n}\n";
|
2650
|
+
var styles$p = {"cardBg":"CardBoxWrapper-module_cardBg__154o2"};
|
2651
|
+
styleInject(css$F);
|
2652
|
+
|
2653
|
+
function CardBoxWrapper(props) {
|
2654
|
+
return React.createElement("div", {
|
2655
|
+
className: styles$p.cardBg
|
2656
|
+
}, props.children);
|
2657
|
+
}
|
2658
|
+
|
2659
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2660
|
+
|
2661
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2662
|
+
var OnScreenContext = React.createContext({
|
2663
|
+
center: false,
|
2664
|
+
top: false,
|
2665
|
+
bottom: false
|
2666
|
+
});
|
2667
|
+
function Section(props) {
|
2668
|
+
var activityProbeRef = useRef();
|
2669
|
+
useOnScreen(activityProbeRef, '-50% 0px -50% 0px', props.onActivate);
|
2670
|
+
var ref = useRef();
|
2671
|
+
var onScreen = useOnScreen(ref, '0px 0px 0px 0px');
|
2672
|
+
useScrollTarget(ref, props.isScrollTarget);
|
2673
|
+
|
2674
|
+
var _useBoundingClientRec = useBoundingClientRect(),
|
2675
|
+
_useBoundingClientRec2 = _slicedToArray(_useBoundingClientRec, 2),
|
2676
|
+
motifAreaRect = _useBoundingClientRec2[0],
|
2677
|
+
setMotifAreaRectRect = _useBoundingClientRec2[1];
|
2678
|
+
|
2679
|
+
var _useDimension = useDimension(),
|
2680
|
+
_useDimension2 = _slicedToArray(_useDimension, 2),
|
2681
|
+
motifAreaDimension = _useDimension2[0],
|
2682
|
+
setMotifAreaDimensionRef = _useDimension2[1];
|
2683
|
+
|
2684
|
+
var setMotifAreaRefs = useCallback(function (node) {
|
2685
|
+
setMotifAreaRectRect(node);
|
2686
|
+
setMotifAreaDimensionRef(node);
|
2687
|
+
}, [setMotifAreaRectRect, setMotifAreaDimensionRef]);
|
2688
|
+
|
2689
|
+
var _useBoundingClientRec3 = useBoundingClientRect(props.layout),
|
2690
|
+
_useBoundingClientRec4 = _slicedToArray(_useBoundingClientRec3, 2),
|
2691
|
+
contentAreaRect = _useBoundingClientRec4[0],
|
2692
|
+
setContentAreaRef = _useBoundingClientRec4[1];
|
2693
|
+
|
2694
|
+
var intersecting = isIntersectingX(motifAreaRect, contentAreaRect);
|
2695
|
+
var heightOffset = 0; //(props.backdrop.first || props.transition === 'scrollOver') ? 0 : (window.innerHeight / 3);
|
2696
|
+
|
2697
|
+
var transitionStyles = getTransitionStyles(props, props.previousSection, props.nextSection);
|
2698
|
+
var appearance = {
|
2699
|
+
shadow: {
|
2700
|
+
background: GradientShadow,
|
2701
|
+
foreground: GradientBox,
|
2702
|
+
foregroundWrapper: NoOpBoxWrapper
|
2703
|
+
},
|
2704
|
+
transparent: {
|
2705
|
+
background: NoOpShadow,
|
2706
|
+
foreground: CardBox,
|
2707
|
+
foregroundWrapper: NoOpBoxWrapper
|
2708
|
+
},
|
2709
|
+
cards: {
|
2710
|
+
background: NoOpShadow,
|
2711
|
+
foreground: CardBox,
|
2712
|
+
foregroundWrapper: CardBoxWrapper
|
2713
|
+
}
|
2714
|
+
}[props.appearance || 'shadow'];
|
2715
|
+
var Shadow = appearance.background;
|
2716
|
+
var Box = appearance.foreground;
|
2717
|
+
var BoxWrapper = appearance.foregroundWrapper;
|
2718
|
+
return React.createElement("section", {
|
2719
|
+
ref: ref,
|
2720
|
+
className: classnames(styles$k.Section, transitionStyles.section, _defineProperty({}, styles$k.invert, props.invert))
|
2721
|
+
}, React.createElement("div", {
|
2722
|
+
ref: activityProbeRef,
|
2723
|
+
className: styles$k.activityProbe
|
2724
|
+
}), React.createElement(Backdrop, Object.assign({}, props.backdrop, {
|
2725
|
+
motifAreaRef: setMotifAreaRefs,
|
2726
|
+
onScreen: onScreen,
|
2727
|
+
offset: Math.max(0, Math.max(1, -contentAreaRect.top / 200)),
|
2728
|
+
state: props.state,
|
2729
|
+
transitionStyles: transitionStyles,
|
2730
|
+
nextSectionOnEnd: props.nextSectionOnEnd,
|
2731
|
+
interactive: props.interactiveBackdrop
|
2732
|
+
}), function (children) {
|
2733
|
+
return props.interactiveBackdrop ? children : React.createElement(Shadow, {
|
2734
|
+
align: props.layout,
|
2735
|
+
intersecting: intersecting,
|
2736
|
+
opacity: props.shadowOpacity >= 0 ? props.shadowOpacity / 100 : 0.7,
|
2737
|
+
motifAreaRect: motifAreaRect,
|
2738
|
+
contentAreaRect: contentAreaRect
|
2739
|
+
}, children);
|
2740
|
+
}), React.createElement(Foreground, {
|
2741
|
+
transitionStyles: transitionStyles,
|
2742
|
+
hidden: props.interactiveBackdrop,
|
2743
|
+
disableEnlarge: props.disableEnlarge,
|
2744
|
+
state: props.state,
|
2745
|
+
heightMode: heightMode(props)
|
2746
|
+
}, React.createElement(Box, {
|
2747
|
+
active: intersecting,
|
2748
|
+
coverInvisibleNextSection: props.nextSection && props.nextSection.transition.startsWith('fade'),
|
2749
|
+
transitionStyles: transitionStyles,
|
2750
|
+
state: props.state,
|
2751
|
+
padding: Math.max(0, motifAreaDimension.top + motifAreaDimension.height - heightOffset),
|
2752
|
+
opacity: props.shadowOpacity
|
2753
|
+
}, React.createElement(Layout, {
|
2754
|
+
items: indexItems(props.foreground),
|
2755
|
+
appearance: props.appearance,
|
2756
|
+
contentAreaRef: setContentAreaRef,
|
2757
|
+
layout: props.layout
|
2758
|
+
}, function (children) {
|
2759
|
+
return React.createElement(BoxWrapper, null, children);
|
2760
|
+
}))));
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
function indexItems(items) {
|
2764
|
+
return items.map(function (item, index) {
|
2765
|
+
return _objectSpread$4({}, item, {
|
2766
|
+
index: index
|
2767
|
+
});
|
2768
|
+
});
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
function heightMode(props) {
|
2772
|
+
if (props.fullHeight) {
|
2773
|
+
if (props.transition.startsWith('fade') || props.nextSection && props.nextSection.transition.startsWith('fade')) {
|
2774
|
+
return 'fullFade';
|
2775
|
+
} else {
|
2776
|
+
return 'full';
|
2777
|
+
}
|
2778
|
+
}
|
2779
|
+
|
2780
|
+
return 'dynamic';
|
2781
|
+
}
|
2782
|
+
|
2783
|
+
function Chapter(props) {
|
2784
|
+
return React.createElement("div", {
|
2785
|
+
id: "chapter-".concat(props.permaId)
|
2786
|
+
}, renderSections(props.sections, props.currentSectionIndex, props.setCurrentSectionIndex, props.scrollTargetSectionIndex, props.setScrollTargetSectionIndex));
|
2787
|
+
}
|
2788
|
+
|
2789
|
+
function renderSections(sections, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex) {
|
2790
|
+
function _onActivate(sectionIndex) {
|
2791
|
+
setCurrentSectionIndex(sectionIndex);
|
2792
|
+
setScrollTargetSectionIndex(null);
|
2793
|
+
}
|
2794
|
+
|
2795
|
+
return sections.map(function (section) {
|
2796
|
+
return React.createElement(Section, Object.assign({
|
2797
|
+
key: section.permaId,
|
2798
|
+
state: section.sectionIndex > currentSectionIndex ? 'below' : section.sectionIndex < currentSectionIndex ? 'above' : 'active',
|
2799
|
+
isScrollTarget: section.sectionIndex === scrollTargetSectionIndex,
|
2800
|
+
onActivate: function onActivate() {
|
2801
|
+
return _onActivate(section.sectionIndex);
|
2802
|
+
}
|
2803
|
+
}, section));
|
2804
|
+
});
|
2805
|
+
}
|
2806
|
+
|
2807
|
+
var css$G = "\n\n.Entry-module_Entry__1nDGh {\n font-family: 'Source Sans Pro', sans-serif;\n background-color: #000;\n color: #fff;\n}\n\n.Entry-module_exampleSelect__1uAJs {\n position: absolute;\n top: 5px;\n left: 50%;\n z-index: 10;\n transform: translateX(-50%);\n}\n";
|
2808
|
+
var styles$q = {"font-sans":"'Source Sans Pro', sans-serif","Entry":"Entry-module_Entry__1nDGh","exampleSelect":"Entry-module_exampleSelect__1uAJs"};
|
2809
|
+
styleInject(css$G);
|
2810
|
+
|
2811
|
+
function Entry(props) {
|
2812
|
+
var _useState = useState(0),
|
2813
|
+
_useState2 = _slicedToArray(_useState, 2),
|
2814
|
+
currentSectionIndex = _useState2[0],
|
2815
|
+
setCurrentSectionIndex = _useState2[1];
|
2816
|
+
|
2817
|
+
var _useState3 = useState(null),
|
2818
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
2819
|
+
scrollTargetSectionIndex = _useState4[0],
|
2820
|
+
setScrollTargetSectionIndex = _useState4[1];
|
2821
|
+
|
2822
|
+
var _useState5 = useState(true),
|
2823
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
2824
|
+
muted = _useState6[0],
|
2825
|
+
setMuted = _useState6[1];
|
2826
|
+
|
2827
|
+
var dispatch = useEntryStateDispatch();
|
2828
|
+
var entryStructure = useEntryStructure();
|
2829
|
+
useEffect(function () {
|
2830
|
+
if (window.parent) {
|
2831
|
+
window.addEventListener('message', receive);
|
2832
|
+
window.parent.postMessage({
|
2833
|
+
type: 'READY'
|
2834
|
+
}, window.location.origin);
|
2835
|
+
}
|
2836
|
+
|
2837
|
+
return function () {
|
2838
|
+
return window.removeEventListener('message', receive);
|
2839
|
+
};
|
2840
|
+
|
2841
|
+
function receive(message) {
|
2842
|
+
if (window.location.href.indexOf(message.origin) === 0 && message.data.type === 'ACTION') {
|
2843
|
+
dispatch(message.data.payload);
|
2844
|
+
}
|
2845
|
+
}
|
2846
|
+
}, [dispatch]);
|
2847
|
+
|
2848
|
+
function scrollToSection(index) {
|
2849
|
+
if (index === 'next') {
|
2850
|
+
index = currentSectionIndex + 1;
|
2851
|
+
}
|
2852
|
+
|
2853
|
+
setScrollTargetSectionIndex(index);
|
2854
|
+
}
|
2855
|
+
|
2856
|
+
return React.createElement("div", {
|
2857
|
+
className: styles$q.Entry
|
2858
|
+
}, React.createElement(MutedContext.Provider, {
|
2859
|
+
value: {
|
2860
|
+
muted: muted,
|
2861
|
+
setMuted: setMuted
|
2862
|
+
}
|
2863
|
+
}, React.createElement(ScrollToSectionContext.Provider, {
|
2864
|
+
value: scrollToSection
|
2865
|
+
}, renderChapters(entryStructure, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex))));
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
function renderChapters(entryStructure, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex) {
|
2869
|
+
return entryStructure.map(function (chapter, index) {
|
2870
|
+
return React.createElement(Chapter, {
|
2871
|
+
key: index,
|
2872
|
+
permaId: chapter.permaId,
|
2873
|
+
sections: chapter.sections,
|
2874
|
+
currentSectionIndex: currentSectionIndex,
|
2875
|
+
setCurrentSectionIndex: setCurrentSectionIndex,
|
2876
|
+
scrollTargetSectionIndex: scrollTargetSectionIndex,
|
2877
|
+
setScrollTargetSectionIndex: setScrollTargetSectionIndex
|
2878
|
+
});
|
2879
|
+
});
|
2880
|
+
}
|
2881
|
+
|
2882
|
+
var css$H = "body {\n margin: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n";
|
2883
|
+
styleInject(css$H);
|
2884
|
+
|
2885
|
+
function Root() {
|
2886
|
+
return React.createElement(React.Fragment, null, React.createElement(EntryStateProvider, {
|
2887
|
+
seed: window.pageflowScrolledSeed
|
2888
|
+
}, React.createElement(AppHeader, null), React.createElement(Entry, null)));
|
2889
|
+
}
|
2890
|
+
ReactDOM.render(React.createElement(Root, null), document.getElementById('root'));
|
2891
|
+
|
2892
|
+
export default Root;
|