pageflow 15.1.0.beta6 → 15.1.0.rc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/app/assets/javascripts/pageflow/dist/editor.js +613 -94
- data/app/assets/javascripts/pageflow/dist/ui.js +120 -3
- data/app/assets/stylesheets/pageflow/editor/base.scss +1 -0
- data/app/assets/stylesheets/pageflow/editor/composables.scss +9 -0
- data/app/assets/stylesheets/pageflow/editor/file_import.scss +7 -8
- data/app/helpers/pageflow/config_helper.rb +1 -1
- data/app/helpers/pageflow/entries_helper.rb +6 -1
- data/app/helpers/pageflow/social_share_links_helper.rb +5 -1
- data/config/locales/de.yml +34 -16
- data/config/locales/en.yml +34 -16
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +613 -93
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +2 -1
- data/entry_types/paged/lib/pageflow_paged/engine.rb +1 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +9 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +28 -0
- data/entry_types/scrolled/config/locales/new/de.yml +46 -0
- data/entry_types/scrolled/config/locales/new/en.yml +46 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +1 -0
- data/entry_types/scrolled/package/editor.js +2844 -78
- data/entry_types/scrolled/package/frontend.js +955 -443
- data/entry_types/scrolled/package/package.json +1 -0
- data/lib/pageflow/version.rb +1 -1
- data/packages/pageflow/editor.js +485 -90
- data/packages/pageflow/ui.js +120 -3
- metadata +5 -4
- data/config/locales/new/entry_metadata_configuration.de.yml +0 -17
- data/config/locales/new/entry_metadata_configuration.en.yml +0 -17
@@ -9,7 +9,8 @@
|
|
9
9
|
|
10
10
|
<%= javascript_include_tag 'pageflow/vendor', 'data-turbolinks-track' => true %>
|
11
11
|
<%= javascript_include_tag 'pageflow/application', 'data-turbolinks-track' => true %>
|
12
|
-
|
12
|
+
|
13
|
+
<meta charset="utf-8" />
|
13
14
|
<%= csrf_meta_tags %>
|
14
15
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1" />
|
15
16
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
@@ -4,6 +4,7 @@ module PageflowPaged
|
|
4
4
|
isolate_namespace PageflowPaged
|
5
5
|
|
6
6
|
config.paths.add('lib', eager_load: true)
|
7
|
+
config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
|
7
8
|
|
8
9
|
initializer 'pageflow_paged.assets.precompile' do |app|
|
9
10
|
app.config.assets.precompile += %w[
|
@@ -31,7 +31,7 @@ module PageflowScrolled
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def order
|
34
|
-
storyline =
|
34
|
+
storyline = find_storyline
|
35
35
|
chapters = Chapter.all_for_revision(@entry.draft)
|
36
36
|
|
37
37
|
params.require(:ids).each_with_index do |id, index|
|
@@ -51,6 +51,14 @@ module PageflowScrolled
|
|
51
51
|
.permit(:position)
|
52
52
|
.merge(configuration: configuration)
|
53
53
|
end
|
54
|
+
|
55
|
+
def find_storyline
|
56
|
+
if params[:storyline_id]
|
57
|
+
Storyline.all_for_revision(@entry.draft).find(params[:storyline_id])
|
58
|
+
else
|
59
|
+
Storyline.all_for_revision(@entry.draft).first
|
60
|
+
end
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
@@ -6,6 +6,8 @@ module PageflowScrolled
|
|
6
6
|
include Pageflow::ConfigHelper
|
7
7
|
include Pageflow::RenderJsonHelper
|
8
8
|
include Pageflow::FilesHelper
|
9
|
+
include Pageflow::EntriesHelper
|
10
|
+
include Pageflow::SocialShareLinksHelper
|
9
11
|
|
10
12
|
def scrolled_entry_json_seed_script_tag(scrolled_entry, options = {})
|
11
13
|
seed_json = render_json do |json|
|
@@ -7,10 +7,38 @@ json.config do
|
|
7
7
|
json.file_model_types do
|
8
8
|
config_file_model_types_seed(json, entry_config)
|
9
9
|
end
|
10
|
+
|
11
|
+
json.pretty_url pretty_entry_url(entry)
|
12
|
+
json.share_url_templates share_provider_url_templates
|
13
|
+
|
14
|
+
json.default_file_rights entry.account.default_file_rights
|
15
|
+
|
16
|
+
json.legal_info do
|
17
|
+
theming = entry.theming
|
18
|
+
json.imprint do
|
19
|
+
json.label raw(theming.imprint_link_label)
|
20
|
+
json.url theming.imprint_link_url
|
21
|
+
end
|
22
|
+
json.copyright do
|
23
|
+
json.label raw(theming.copyright_link_label)
|
24
|
+
json.url theming.copyright_link_url
|
25
|
+
end
|
26
|
+
json.privacy do
|
27
|
+
json.label I18n.t('pageflow.public.privacy_notice')
|
28
|
+
json.url entry_privacy_link_url(entry)
|
29
|
+
end
|
30
|
+
end
|
10
31
|
end
|
11
32
|
|
12
33
|
unless options[:skip_collections]
|
13
34
|
json.collections do
|
35
|
+
json.entries do
|
36
|
+
json.array!([entry]) do |entry|
|
37
|
+
json.call(entry, :id, :share_providers, :share_url, :credits)
|
38
|
+
json.permaId entry.id # required as keyAttribute in EntryStateProvider
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
14
42
|
json.chapters do
|
15
43
|
json.array!(chapters) do |chapter|
|
16
44
|
json.partial! 'pageflow_scrolled/chapters/chapter', chapter: chapter
|
@@ -0,0 +1,46 @@
|
|
1
|
+
de:
|
2
|
+
pageflow_scrolled:
|
3
|
+
editor:
|
4
|
+
entry_outline:
|
5
|
+
header: "Giederung"
|
6
|
+
add_chapter: "Neues Kapitel"
|
7
|
+
chapter_item:
|
8
|
+
add_section: "Neuer Abschnitt"
|
9
|
+
save_error: Beim Speichern des Kapitels ist ein Fehler aufgetreten.
|
10
|
+
section_item:
|
11
|
+
edit: "Abschnitt bearbeiten"
|
12
|
+
save_error: Beim Speichern des Abschnitts ist ein Fehler aufgetreten.
|
13
|
+
edit_chapter:
|
14
|
+
tabs:
|
15
|
+
chapter: Kapitel
|
16
|
+
attributes:
|
17
|
+
title:
|
18
|
+
label: Titel
|
19
|
+
summary:
|
20
|
+
label: Zusammenfassung
|
21
|
+
confirm_destroy: |-
|
22
|
+
Kapitel einschließlich ALLER enthaltener Abschnitte wirklich löschen?
|
23
|
+
|
24
|
+
Dieser Schritt kann nicht rückgängig gemacht werden.
|
25
|
+
save_error: Beim Speichern des Kapitels ist ein Fehler aufgetreten.
|
26
|
+
edit_section:
|
27
|
+
tabs:
|
28
|
+
section: Abschnitt
|
29
|
+
attributes:
|
30
|
+
backdropImage:
|
31
|
+
label: Hintergrund
|
32
|
+
backdropType:
|
33
|
+
label: Hintergrund-Typ
|
34
|
+
invert:
|
35
|
+
label: Text invertieren
|
36
|
+
layout:
|
37
|
+
label: Text-Ausrichtung
|
38
|
+
values:
|
39
|
+
left: "Links"
|
40
|
+
right: "Rechts"
|
41
|
+
center: "Mitte"
|
42
|
+
confirm_destroy: |-
|
43
|
+
Abschnitt einschließlich ALLER enthaltener Elemente wirklich löschen?
|
44
|
+
|
45
|
+
Dieser Schritt kann nicht rückgängig gemacht werden.
|
46
|
+
save_error: Beim Speichern des Abschnitts ist ein Fehler aufgetreten.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
en:
|
2
|
+
pageflow_scrolled:
|
3
|
+
editor:
|
4
|
+
entry_outline:
|
5
|
+
header: "Outline"
|
6
|
+
add_chapter: "New chapter"
|
7
|
+
chapter_item:
|
8
|
+
add_section: "New section"
|
9
|
+
save_error: There was an error while saving this chapter.
|
10
|
+
section_item:
|
11
|
+
edit: "Edit section"
|
12
|
+
save_error: There was an error while saving this section.
|
13
|
+
edit_chapter:
|
14
|
+
tabs:
|
15
|
+
chapter: Chapter
|
16
|
+
attributes:
|
17
|
+
title:
|
18
|
+
label: Title
|
19
|
+
summary:
|
20
|
+
label: Summary
|
21
|
+
confirm_destroy: |-
|
22
|
+
Really delete this chapter including ALL its sections?
|
23
|
+
|
24
|
+
This operation cannot be undone.
|
25
|
+
save_error: There was an error while saving this chapter.
|
26
|
+
edit_section:
|
27
|
+
tabs:
|
28
|
+
section: Section
|
29
|
+
attributes:
|
30
|
+
backdropImage:
|
31
|
+
label: Background
|
32
|
+
backdropType:
|
33
|
+
label: Background-Type
|
34
|
+
invert:
|
35
|
+
label: Invert text
|
36
|
+
layout:
|
37
|
+
label: Text alignment
|
38
|
+
values:
|
39
|
+
left: "Left"
|
40
|
+
right: "Right"
|
41
|
+
center: "Center"
|
42
|
+
confirm_destroy: |-
|
43
|
+
Really delete this section including ALL its elements?
|
44
|
+
|
45
|
+
This operation cannot be undone.
|
46
|
+
save_error: There was an error while saving this section.
|
@@ -1,71 +1,295 @@
|
|
1
1
|
import * as globalInterop from 'pageflow/editor';
|
2
|
-
import { Entry } from 'pageflow/editor';
|
3
|
-
import Backbone from 'backbone';
|
2
|
+
import { configurationContainer, delayedDestroying, entryTypeEditorControllerUrls, failureTracking, ForeignKeySubsetCollection, orderedCollection, Configuration, editor, Entry, modelLifecycleTrackingView, EditConfigurationView, FileInputView, ColorInputView } from 'pageflow/editor';
|
3
|
+
import Backbone$1 from 'backbone';
|
4
4
|
import Marionette from 'backbone.marionette';
|
5
|
+
import I18n from 'i18n-js';
|
6
|
+
import { cssModulesUtils, SortableCollectionView, TextInputView, TextAreaInputView, SelectInputView, CheckBoxInputView } from 'pageflow/ui';
|
7
|
+
import React, { useReducer, useMemo, useContext, useState, useEffect, useRef, useCallback } from 'react';
|
8
|
+
import ReactDOM from 'react-dom';
|
5
9
|
import $ from 'jquery';
|
6
|
-
import { cssModulesUtils } from 'pageflow/ui';
|
7
|
-
import React from 'react';
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
function _defineProperty(obj, key, value) {
|
12
|
+
if (key in obj) {
|
13
|
+
Object.defineProperty(obj, key, {
|
14
|
+
value: value,
|
15
|
+
enumerable: true,
|
16
|
+
configurable: true,
|
17
|
+
writable: true
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
obj[key] = value;
|
21
|
+
}
|
22
|
+
|
23
|
+
return obj;
|
24
|
+
}
|
25
|
+
|
26
|
+
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; }
|
27
|
+
|
28
|
+
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; }
|
29
|
+
var Chapter = Backbone$1.Model.extend({
|
30
|
+
mixins: [configurationContainer({
|
31
|
+
autoSave: true,
|
32
|
+
includeAttributesInJSON: ['position']
|
33
|
+
}), delayedDestroying, entryTypeEditorControllerUrls.forModel({
|
34
|
+
resources: 'chapters'
|
35
|
+
}), failureTracking],
|
36
|
+
initialize: function initialize(attributes, options) {
|
37
|
+
this.sections = new ForeignKeySubsetCollection({
|
38
|
+
parent: options.sections,
|
39
|
+
parentModel: this,
|
40
|
+
foreignKeyAttribute: 'chapterId',
|
41
|
+
parentReferenceAttribute: 'chapter'
|
14
42
|
});
|
43
|
+
},
|
44
|
+
addSection: function addSection(attributes) {
|
45
|
+
this.sections.create(_objectSpread({
|
46
|
+
position: this.sections.length,
|
47
|
+
chapterId: this.id
|
48
|
+
}, attributes));
|
15
49
|
}
|
16
50
|
});
|
17
51
|
|
18
|
-
var ChaptersCollection = Backbone.Collection.extend({
|
19
|
-
model: Chapter
|
52
|
+
var ChaptersCollection = Backbone$1.Collection.extend({
|
53
|
+
model: Chapter,
|
54
|
+
mixins: [entryTypeEditorControllerUrls.forCollection({
|
55
|
+
resources: 'chapters'
|
56
|
+
}), orderedCollection],
|
57
|
+
comparator: function comparator(chapter) {
|
58
|
+
return chapter.get('position');
|
59
|
+
}
|
20
60
|
});
|
21
61
|
|
22
|
-
var
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
62
|
+
var SectionConfiguration = Configuration.extend({
|
63
|
+
defaults: {
|
64
|
+
transition: 'scroll',
|
65
|
+
backdrop: {
|
66
|
+
image: '#fff'
|
67
|
+
}
|
68
|
+
},
|
69
|
+
get: function get(name) {
|
70
|
+
if (name === 'backdropImage') {
|
71
|
+
return this.attributes.backdrop && this.attributes.backdrop.image;
|
72
|
+
}
|
73
|
+
|
74
|
+
if (name === 'backdropType') {
|
75
|
+
return Configuration.prototype.get.apply(this, arguments) || (this.attributes.backdrop && this.attributes.backdrop.image.toString().startsWith('#') ? 'color' : 'image');
|
76
|
+
}
|
77
|
+
|
78
|
+
return Configuration.prototype.get.apply(this, arguments);
|
79
|
+
},
|
80
|
+
set: function set(name, value) {
|
81
|
+
if (name === 'backdropImage' && value) {
|
82
|
+
this.set('backdrop', {
|
83
|
+
image: value
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
return Configuration.prototype.set.apply(this, arguments);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
var FileSelectionHandler = function FileSelectionHandler(options) {
|
91
|
+
var contentElement = options.entry.sections.get(options.id);
|
92
|
+
|
93
|
+
this.call = function (file) {
|
94
|
+
contentElement.configuration.setReference(options.attributeName, file);
|
95
|
+
};
|
96
|
+
|
97
|
+
this.getReferer = function () {
|
98
|
+
return '/scrolled/sections/' + contentElement.id;
|
99
|
+
};
|
100
|
+
};
|
101
|
+
editor.registerFileSelectionHandler('sectionConfiguration', FileSelectionHandler);
|
102
|
+
|
103
|
+
var Section = Backbone$1.Model.extend({
|
104
|
+
mixins: [configurationContainer({
|
105
|
+
autoSave: true,
|
106
|
+
includeAttributesInJSON: ['position'],
|
107
|
+
configurationModel: SectionConfiguration
|
108
|
+
}), delayedDestroying, entryTypeEditorControllerUrls.forModel({
|
109
|
+
resources: 'sections'
|
110
|
+
}), failureTracking],
|
111
|
+
chapterPosition: function chapterPosition() {
|
112
|
+
return this.chapter && this.chapter.has('position') ? this.chapter.get('position') : -1;
|
28
113
|
}
|
29
114
|
});
|
30
115
|
|
31
|
-
var SectionsCollection = Backbone.Collection.extend({
|
32
|
-
model: Section
|
116
|
+
var SectionsCollection = Backbone$1.Collection.extend({
|
117
|
+
model: Section,
|
118
|
+
mixins: [entryTypeEditorControllerUrls.forCollection({
|
119
|
+
resources: 'sections'
|
120
|
+
})],
|
121
|
+
comparator: function comparator(sectionA, sectionB) {
|
122
|
+
if (sectionA.chapterPosition() > sectionB.chapterPosition()) {
|
123
|
+
return 1;
|
124
|
+
} else if (sectionA.chapterPosition() < sectionB.chapterPosition()) {
|
125
|
+
return -1;
|
126
|
+
} else if (sectionA.get('position') > sectionB.get('position')) {
|
127
|
+
return 1;
|
128
|
+
} else if (sectionA.get('position') < sectionB.get('position')) {
|
129
|
+
return -1;
|
130
|
+
} else {
|
131
|
+
return 0;
|
132
|
+
}
|
133
|
+
}
|
33
134
|
});
|
34
135
|
|
35
|
-
var ContentElement = Backbone.Model.extend({
|
136
|
+
var ContentElement = Backbone$1.Model.extend({
|
36
137
|
initialize: function initialize() {
|
37
|
-
this.configuration = new Backbone.Model(this.get('configuration'));
|
138
|
+
this.configuration = new Backbone$1.Model(this.get('configuration'));
|
38
139
|
this.listenTo(this.configuration, 'change', function () {
|
39
140
|
this.trigger('change:configuration', this);
|
40
141
|
});
|
41
142
|
}
|
42
143
|
});
|
43
144
|
|
44
|
-
var ContentElementsCollection = Backbone.Collection.extend({
|
145
|
+
var ContentElementsCollection = Backbone$1.Collection.extend({
|
45
146
|
model: ContentElement
|
46
147
|
});
|
47
148
|
|
149
|
+
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; }
|
150
|
+
|
151
|
+
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; }
|
48
152
|
var ScrolledEntry = Entry.extend({
|
49
153
|
setupFromEntryTypeSeed: function setupFromEntryTypeSeed(seed) {
|
50
|
-
this.chapters = new ChaptersCollection(seed.collections.chapters);
|
51
|
-
this.sections = new SectionsCollection(seed.collections.sections);
|
52
154
|
this.contentElements = new ContentElementsCollection(seed.collections.contentElements);
|
155
|
+
this.sections = new SectionsCollection(seed.collections.sections);
|
156
|
+
this.chapters = new ChaptersCollection(seed.collections.chapters, {
|
157
|
+
sections: this.sections
|
158
|
+
});
|
159
|
+
this.chapters.parentModel = this;
|
160
|
+
this.sections.sort();
|
161
|
+
editor.failures.watch(this.contentElements);
|
162
|
+
editor.failures.watch(this.sections);
|
163
|
+
editor.failures.watch(this.chapters);
|
164
|
+
editor.savingRecords.watch(this.contentElements);
|
165
|
+
editor.savingRecords.watch(this.sections);
|
166
|
+
editor.savingRecords.watch(this.chapters);
|
167
|
+
this.scrolledSeed = seed;
|
168
|
+
},
|
169
|
+
addChapter: function addChapter(attributes) {
|
170
|
+
this.chapters.create(_objectSpread$1({
|
171
|
+
position: this.chapters.length
|
172
|
+
}, attributes), {
|
173
|
+
sections: this.sections
|
174
|
+
});
|
53
175
|
}
|
54
176
|
});
|
55
177
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
178
|
+
function _arrayWithHoles(arr) {
|
179
|
+
if (Array.isArray(arr)) return arr;
|
180
|
+
}
|
181
|
+
|
182
|
+
function _iterableToArrayLimit(arr, i) {
|
183
|
+
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
184
|
+
return;
|
60
185
|
}
|
61
|
-
});
|
62
186
|
|
187
|
+
var _arr = [];
|
188
|
+
var _n = true;
|
189
|
+
var _d = false;
|
190
|
+
var _e = undefined;
|
191
|
+
|
192
|
+
try {
|
193
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
194
|
+
_arr.push(_s.value);
|
195
|
+
|
196
|
+
if (i && _arr.length === i) break;
|
197
|
+
}
|
198
|
+
} catch (err) {
|
199
|
+
_d = true;
|
200
|
+
_e = err;
|
201
|
+
} finally {
|
202
|
+
try {
|
203
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
204
|
+
} finally {
|
205
|
+
if (_d) throw _e;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
return _arr;
|
210
|
+
}
|
211
|
+
|
212
|
+
function _nonIterableRest() {
|
213
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
214
|
+
}
|
215
|
+
|
216
|
+
function _slicedToArray(arr, i) {
|
217
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
218
|
+
}
|
219
|
+
|
220
|
+
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; }
|
221
|
+
|
222
|
+
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; }
|
63
223
|
var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
|
64
224
|
var RESET = "".concat(PREFIX, "_RESET");
|
65
225
|
var ADD = "".concat(PREFIX, "_ADD");
|
66
226
|
var CHANGE = "".concat(PREFIX, "_CHANGE");
|
67
227
|
var REMOVE = "".concat(PREFIX, "_REMOVE");
|
68
228
|
var SORT = "".concat(PREFIX, "_SORT");
|
229
|
+
function useCollections() {
|
230
|
+
var seed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
231
|
+
|
232
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
233
|
+
keyAttribute = _ref.keyAttribute;
|
234
|
+
|
235
|
+
return useReducer(reducer, Object.keys(seed).reduce(function (result, key) {
|
236
|
+
result[key] = init(seed[key], keyAttribute);
|
237
|
+
return result;
|
238
|
+
}, {}));
|
239
|
+
}
|
240
|
+
|
241
|
+
function reducer(state, action) {
|
242
|
+
var collectionName = action.payload.collectionName;
|
243
|
+
var keyAttribute = action.payload.keyAttribute;
|
244
|
+
|
245
|
+
switch (action.type) {
|
246
|
+
case RESET:
|
247
|
+
return _objectSpread$2({}, state, _defineProperty({}, collectionName, init(action.payload.items, keyAttribute)));
|
248
|
+
|
249
|
+
case ADD:
|
250
|
+
return _objectSpread$2({}, state, _defineProperty({}, collectionName, {
|
251
|
+
order: action.payload.order,
|
252
|
+
items: _objectSpread$2({}, state[collectionName].items, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
253
|
+
}));
|
254
|
+
|
255
|
+
case CHANGE:
|
256
|
+
return _objectSpread$2({}, state, _defineProperty({}, collectionName, {
|
257
|
+
order: state[collectionName].order,
|
258
|
+
items: _objectSpread$2({}, state[collectionName].items, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
|
259
|
+
}));
|
260
|
+
|
261
|
+
case REMOVE:
|
262
|
+
var clonedItems = _objectSpread$2({}, state[collectionName].items);
|
263
|
+
|
264
|
+
delete clonedItems[action.payload.key];
|
265
|
+
return _objectSpread$2({}, state, _defineProperty({}, collectionName, {
|
266
|
+
order: action.payload.order,
|
267
|
+
items: clonedItems
|
268
|
+
}));
|
269
|
+
|
270
|
+
case SORT:
|
271
|
+
return _objectSpread$2({}, state, _defineProperty({}, collectionName, {
|
272
|
+
order: action.payload.order,
|
273
|
+
items: state[collectionName].items
|
274
|
+
}));
|
275
|
+
|
276
|
+
default:
|
277
|
+
return state;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
function init(items) {
|
282
|
+
var keyAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
283
|
+
return {
|
284
|
+
order: items.map(function (item) {
|
285
|
+
return item[keyAttribute];
|
286
|
+
}),
|
287
|
+
items: items.reduce(function (result, item) {
|
288
|
+
result[item[keyAttribute]] = item;
|
289
|
+
return result;
|
290
|
+
}, {})
|
291
|
+
};
|
292
|
+
}
|
69
293
|
|
70
294
|
function watchCollection(collection, _ref2) {
|
71
295
|
var name = _ref2.name,
|
@@ -143,7 +367,7 @@ function watchCollection(collection, _ref2) {
|
|
143
367
|
type: SORT,
|
144
368
|
payload: {
|
145
369
|
collectionName: name,
|
146
|
-
order: collection.pluck(keyAttribute)
|
370
|
+
order: collection.pluck(keyAttribute).filter(Boolean)
|
147
371
|
}
|
148
372
|
});
|
149
373
|
});
|
@@ -186,23 +410,252 @@ function getAttributes(model, _ref3) {
|
|
186
410
|
return result;
|
187
411
|
}
|
188
412
|
|
413
|
+
function getItems(state, collectionName) {
|
414
|
+
if (state[collectionName]) {
|
415
|
+
var items = state[collectionName].items;
|
416
|
+
return state[collectionName].order.map(function (key) {
|
417
|
+
return items[key];
|
418
|
+
});
|
419
|
+
} else {
|
420
|
+
return [];
|
421
|
+
}
|
422
|
+
}
|
423
|
+
function getItem(state, collectionName, key) {
|
424
|
+
if (state[collectionName]) {
|
425
|
+
return state[collectionName].items[key];
|
426
|
+
}
|
427
|
+
}
|
428
|
+
|
189
429
|
var Context = React.createContext();
|
430
|
+
function EntryStateProvider(_ref) {
|
431
|
+
var seed = _ref.seed,
|
432
|
+
children = _ref.children;
|
433
|
+
|
434
|
+
var _useCollections = useCollections(seed.collections, {
|
435
|
+
keyAttribute: 'permaId'
|
436
|
+
}),
|
437
|
+
_useCollections2 = _slicedToArray(_useCollections, 2),
|
438
|
+
collections = _useCollections2[0],
|
439
|
+
dispatch = _useCollections2[1];
|
440
|
+
|
441
|
+
var value = useMemo(function () {
|
442
|
+
return {
|
443
|
+
entryState: {
|
444
|
+
collections: collections,
|
445
|
+
config: seed.config
|
446
|
+
},
|
447
|
+
dispatch: dispatch
|
448
|
+
};
|
449
|
+
}, [collections, dispatch, seed]);
|
450
|
+
return React.createElement(Context.Provider, {
|
451
|
+
value: value
|
452
|
+
}, children);
|
453
|
+
}
|
454
|
+
function useEntryState() {
|
455
|
+
var value = useContext(Context);
|
456
|
+
return value.entryState;
|
457
|
+
}
|
458
|
+
function useEntryStateDispatch() {
|
459
|
+
var value = useContext(Context);
|
460
|
+
return value.dispatch;
|
461
|
+
}
|
462
|
+
|
463
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
464
|
+
if (source == null) return {};
|
465
|
+
var target = {};
|
466
|
+
var sourceKeys = Object.keys(source);
|
467
|
+
var key, i;
|
468
|
+
|
469
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
470
|
+
key = sourceKeys[i];
|
471
|
+
if (excluded.indexOf(key) >= 0) continue;
|
472
|
+
target[key] = source[key];
|
473
|
+
}
|
474
|
+
|
475
|
+
return target;
|
476
|
+
}
|
477
|
+
|
478
|
+
function _objectWithoutProperties(source, excluded) {
|
479
|
+
if (source == null) return {};
|
480
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
481
|
+
var key, i;
|
482
|
+
|
483
|
+
if (Object.getOwnPropertySymbols) {
|
484
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
485
|
+
|
486
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
487
|
+
key = sourceSymbolKeys[i];
|
488
|
+
if (excluded.indexOf(key) >= 0) continue;
|
489
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
490
|
+
target[key] = source[key];
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
return target;
|
495
|
+
}
|
496
|
+
|
497
|
+
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; }
|
498
|
+
|
499
|
+
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; }
|
500
|
+
/**
|
501
|
+
* Returns a nested data structure representing the content elements
|
502
|
+
* of section.
|
503
|
+
*
|
504
|
+
* @param {Object} options
|
505
|
+
* @param {number} options.sectionPermaId
|
506
|
+
*
|
507
|
+
* @example
|
508
|
+
*
|
509
|
+
* const section = useSectionStructure({sectionPermaId: 4});
|
510
|
+
* section // =>
|
511
|
+
* {
|
512
|
+
* permaId: 4,
|
513
|
+
* transition: 'scroll',
|
514
|
+
* foreground: [
|
515
|
+
* {
|
516
|
+
* type: 'heading',
|
517
|
+
* props: {
|
518
|
+
* children: 'Heading'
|
519
|
+
* }
|
520
|
+
* },
|
521
|
+
* {
|
522
|
+
* type: 'textBlock',
|
523
|
+
* props: {
|
524
|
+
* children: 'Some text'
|
525
|
+
* }
|
526
|
+
* }
|
527
|
+
* ]
|
528
|
+
* }
|
529
|
+
*/
|
530
|
+
|
531
|
+
function useSectionStructure(_ref) {
|
532
|
+
var sectionPermaId = _ref.sectionPermaId;
|
533
|
+
var entryState = useEntryState();
|
534
|
+
var section = getItem(entryState.collections, 'sections', sectionPermaId);
|
535
|
+
return sectionStructure(entryState.collections, section);
|
536
|
+
}
|
537
|
+
|
538
|
+
function sectionStructure(collections, section) {
|
539
|
+
return section && _objectSpread$3({
|
540
|
+
permaId: section.permaId
|
541
|
+
}, section.configuration, {
|
542
|
+
foreground: getItems(collections, 'contentElements').filter(function (item) {
|
543
|
+
return item.sectionId === section.id;
|
544
|
+
}).map(function (item) {
|
545
|
+
return {
|
546
|
+
type: item.typeName,
|
547
|
+
position: item.configuration.position,
|
548
|
+
props: item.configuration
|
549
|
+
};
|
550
|
+
})
|
551
|
+
});
|
552
|
+
}
|
553
|
+
|
554
|
+
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; }
|
555
|
+
|
556
|
+
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; }
|
557
|
+
|
558
|
+
function expandUrls(collectionName, file, urlTemplates) {
|
559
|
+
if (!file) {
|
560
|
+
return null;
|
561
|
+
}
|
562
|
+
|
563
|
+
if (!urlTemplates[collectionName]) {
|
564
|
+
throw new Error("No file url templates found for ".concat(collectionName));
|
565
|
+
}
|
566
|
+
|
567
|
+
var variants = file.variants || Object.keys(urlTemplates[collectionName]);
|
568
|
+
var urls = variants.reduce(function (result, variant) {
|
569
|
+
var url = getFileUrl(collectionName, file, variant, urlTemplates);
|
570
|
+
|
571
|
+
if (url) {
|
572
|
+
result[variant] = url;
|
573
|
+
}
|
574
|
+
|
575
|
+
return result;
|
576
|
+
}, {});
|
577
|
+
return _objectSpread$4({
|
578
|
+
urls: urls
|
579
|
+
}, file);
|
580
|
+
}
|
581
|
+
|
582
|
+
function getFileUrl(collectionName, file, quality, urlTemplates) {
|
583
|
+
var templates = urlTemplates[collectionName];
|
584
|
+
var template = templates[quality];
|
585
|
+
|
586
|
+
if (template) {
|
587
|
+
return template.replace(':id_partition', idPartition(file.id)).replace(':basename', file.basename);
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
function idPartition(id) {
|
592
|
+
return partition(pad(id, 9));
|
593
|
+
}
|
594
|
+
|
595
|
+
function partition(string, separator) {
|
596
|
+
return string.replace(/./g, function (c, i, a) {
|
597
|
+
return i && (a.length - i) % 3 === 0 ? '/' + c : c;
|
598
|
+
});
|
599
|
+
}
|
600
|
+
|
601
|
+
function pad(string, size) {
|
602
|
+
return (Array(size).fill(0).join('') + string).slice(-size);
|
603
|
+
}
|
604
|
+
|
605
|
+
/**
|
606
|
+
* Look up a file by its collection and perma id.
|
607
|
+
*
|
608
|
+
* @param {Object} options
|
609
|
+
* @param {String} options.collectionName - Collection name of file type to look for (in camel case).
|
610
|
+
* @param {String} options.permaId - Perma id of file look up
|
611
|
+
*
|
612
|
+
* @example
|
613
|
+
* const imageFile = useFile({collectionName: 'imageFiles', permaId: 5});
|
614
|
+
* imageFile // =>
|
615
|
+
* {
|
616
|
+
* id: 102,
|
617
|
+
* permaId: 5,
|
618
|
+
* width: 1000,
|
619
|
+
* height: 500,
|
620
|
+
* urls: {
|
621
|
+
* large: 'https://...'
|
622
|
+
* },
|
623
|
+
* }
|
624
|
+
*/
|
190
625
|
|
191
|
-
function
|
192
|
-
var
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
626
|
+
function useFile(_ref) {
|
627
|
+
var collectionName = _ref.collectionName,
|
628
|
+
permaId = _ref.permaId;
|
629
|
+
var entryState = useEntryState();
|
630
|
+
return expandUrls(collectionName, getItem(entryState.collections, collectionName, permaId), entryState.config.fileUrlTemplates);
|
631
|
+
}
|
632
|
+
|
633
|
+
function watchCollections(entry, _ref) {
|
634
|
+
var dispatch = _ref.dispatch;
|
635
|
+
var chapters = entry.chapters,
|
636
|
+
sections = entry.sections,
|
637
|
+
contentElements = entry.contentElements,
|
638
|
+
files = entry.files;
|
639
|
+
watchCollection(new Backbone.Collection([entry.metadata]), {
|
640
|
+
name: 'entries',
|
641
|
+
attributes: ['id', {
|
642
|
+
shareProviders: 'share_providers'
|
643
|
+
}, {
|
644
|
+
shareUrl: 'share_url'
|
645
|
+
}, 'credits'],
|
646
|
+
dispatch: dispatch
|
647
|
+
});
|
197
648
|
watchCollection(chapters, {
|
198
649
|
name: 'chapters',
|
199
650
|
attributes: ['id', 'permaId'],
|
651
|
+
keyAttribute: 'permaId',
|
200
652
|
includeConfiguration: true,
|
201
653
|
dispatch: dispatch
|
202
654
|
});
|
203
655
|
watchCollection(sections, {
|
204
656
|
name: 'sections',
|
205
657
|
attributes: ['id', 'permaId', 'chapterId'],
|
658
|
+
keyAttribute: 'permaId',
|
206
659
|
includeConfiguration: true,
|
207
660
|
dispatch: dispatch
|
208
661
|
});
|
@@ -218,7 +671,7 @@ function watchCollections(_ref, _ref2) {
|
|
218
671
|
name: camelize(collectionName),
|
219
672
|
attributes: ['id', {
|
220
673
|
permaId: 'perma_id'
|
221
|
-
}, 'width', 'height', 'basename'],
|
674
|
+
}, 'width', 'height', 'basename', 'rights'],
|
222
675
|
keyAttribute: 'permaId',
|
223
676
|
includeConfiguration: true,
|
224
677
|
dispatch: dispatch
|
@@ -232,6 +685,96 @@ function camelize(snakeCase) {
|
|
232
685
|
});
|
233
686
|
}
|
234
687
|
|
688
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
689
|
+
|
690
|
+
function createCommonjsModule(fn, module) {
|
691
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
692
|
+
}
|
693
|
+
|
694
|
+
var classnames = createCommonjsModule(function (module) {
|
695
|
+
/*!
|
696
|
+
Copyright (c) 2017 Jed Watson.
|
697
|
+
Licensed under the MIT License (MIT), see
|
698
|
+
http://jedwatson.github.io/classnames
|
699
|
+
*/
|
700
|
+
/* global define */
|
701
|
+
|
702
|
+
(function () {
|
703
|
+
|
704
|
+
var hasOwn = {}.hasOwnProperty;
|
705
|
+
|
706
|
+
function classNames () {
|
707
|
+
var classes = [];
|
708
|
+
|
709
|
+
for (var i = 0; i < arguments.length; i++) {
|
710
|
+
var arg = arguments[i];
|
711
|
+
if (!arg) continue;
|
712
|
+
|
713
|
+
var argType = typeof arg;
|
714
|
+
|
715
|
+
if (argType === 'string' || argType === 'number') {
|
716
|
+
classes.push(arg);
|
717
|
+
} else if (Array.isArray(arg) && arg.length) {
|
718
|
+
var inner = classNames.apply(null, arg);
|
719
|
+
if (inner) {
|
720
|
+
classes.push(inner);
|
721
|
+
}
|
722
|
+
} else if (argType === 'object') {
|
723
|
+
for (var key in arg) {
|
724
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
725
|
+
classes.push(key);
|
726
|
+
}
|
727
|
+
}
|
728
|
+
}
|
729
|
+
}
|
730
|
+
|
731
|
+
return classes.join(' ');
|
732
|
+
}
|
733
|
+
|
734
|
+
if ( module.exports) {
|
735
|
+
classNames.default = classNames;
|
736
|
+
module.exports = classNames;
|
737
|
+
} else {
|
738
|
+
window.classNames = classNames;
|
739
|
+
}
|
740
|
+
}());
|
741
|
+
});
|
742
|
+
|
743
|
+
function useOnScreen(ref) {
|
744
|
+
var rootMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0px';
|
745
|
+
var cb = arguments.length > 2 ? arguments[2] : undefined;
|
746
|
+
|
747
|
+
var _useState = useState(false),
|
748
|
+
_useState2 = _slicedToArray(_useState, 2),
|
749
|
+
isIntersecting = _useState2[0],
|
750
|
+
setIntersecting = _useState2[1];
|
751
|
+
|
752
|
+
useEffect(function () {
|
753
|
+
var current = ref.current;
|
754
|
+
var observer = new IntersectionObserver(function (_ref) {
|
755
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
756
|
+
entry = _ref2[0];
|
757
|
+
|
758
|
+
setIntersecting(entry.isIntersecting);
|
759
|
+
|
760
|
+
if (entry.isIntersecting && cb) {
|
761
|
+
cb();
|
762
|
+
}
|
763
|
+
}, {
|
764
|
+
rootMargin: rootMargin
|
765
|
+
});
|
766
|
+
|
767
|
+
if (ref.current) {
|
768
|
+
observer.observe(current);
|
769
|
+
}
|
770
|
+
|
771
|
+
return function () {
|
772
|
+
observer.unobserve(current);
|
773
|
+
};
|
774
|
+
}, [ref, rootMargin, cb]);
|
775
|
+
return isIntersecting;
|
776
|
+
}
|
777
|
+
|
235
778
|
function styleInject(css, ref) {
|
236
779
|
if ( ref === void 0 ) ref = {};
|
237
780
|
var insertAt = ref.insertAt;
|
@@ -259,57 +802,2280 @@ function styleInject(css, ref) {
|
|
259
802
|
}
|
260
803
|
}
|
261
804
|
|
262
|
-
var css = ".
|
263
|
-
var styles = {"root":"
|
805
|
+
var css = ".Fullscreen-module_root__1N3CI {\n width: 100%;\n height: 100vh;\n position: relative;\n overflow: hidden;\n}\n";
|
806
|
+
var styles = {"root":"Fullscreen-module_root__1N3CI"};
|
264
807
|
styleInject(css);
|
265
808
|
|
266
|
-
var
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
809
|
+
var Fullscreen = React.forwardRef(function Fullscreen(props, ref) {
|
810
|
+
return React.createElement("div", {
|
811
|
+
ref: ref,
|
812
|
+
className: styles.root
|
813
|
+
}, props.children);
|
814
|
+
});
|
815
|
+
|
816
|
+
var css$1 = ".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}";
|
817
|
+
var styles$1 = {"root":"Image-module_root__1ef3j","portrait":"Image-module_portrait__1mRha"};
|
818
|
+
styleInject(css$1);
|
819
|
+
|
820
|
+
/**
|
821
|
+
* Render an image file.
|
822
|
+
*
|
823
|
+
* @param {Object} props
|
824
|
+
* @param {number} props.id - Perma id of the image file.
|
825
|
+
*/
|
826
|
+
|
827
|
+
function Image(props) {
|
828
|
+
var image = useFile({
|
829
|
+
collectionName: 'imageFiles',
|
830
|
+
permaId: props.id
|
831
|
+
});
|
832
|
+
|
833
|
+
if (image) {
|
834
|
+
var focusX = typeof image.configuration.focusX === 'undefined' ? 50 : image.configuration.focusX;
|
835
|
+
var focusY = typeof image.configuration.focusY === 'undefined' ? 50 : image.configuration.focusY;
|
836
|
+
return React.createElement("div", {
|
837
|
+
className: classnames(styles$1.root, _defineProperty({}, styles$1.portrait, props.mobile)),
|
838
|
+
role: "img",
|
839
|
+
style: {
|
840
|
+
backgroundImage: "url(".concat(image.urls.large, ")"),
|
841
|
+
backgroundPosition: "".concat(focusX, "% ").concat(focusY, "%")
|
842
|
+
}
|
843
|
+
});
|
844
|
+
}
|
845
|
+
|
846
|
+
return null;
|
847
|
+
}
|
848
|
+
|
849
|
+
var ScrollToSectionContext = React.createContext(function () {});
|
850
|
+
|
851
|
+
var MutedContext = React.createContext({
|
852
|
+
muted: true,
|
853
|
+
setMuted: function setMuted() {},
|
854
|
+
mediaOff: true
|
855
|
+
});
|
856
|
+
|
857
|
+
var css$2 = ".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";
|
858
|
+
var styles$2 = {"root":"Video-module_root__30u0y","video":"Video-module_video__3FJvj","backdrop":"Video-module_backdrop__1R7f4"};
|
859
|
+
styleInject(css$2);
|
284
860
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
861
|
+
function Video(props) {
|
862
|
+
var awsBucket = '//s3-eu-west-1.amazonaws.com/de.codevise.pageflow.development/pageflow-next/presentation-videos/';
|
863
|
+
var videoBoatSunset = awsBucket + 'floodplain-clean.mp4';
|
864
|
+
var poster_videoBoatSunset = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
865
|
+
var videoBoatDark = awsBucket + 'floodplain-dirty.mp4';
|
866
|
+
var poster_videoBoatDark = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
867
|
+
var videoKaterchen = awsBucket + 'katerchen.mp4';
|
868
|
+
var poster_videoKaterchen = awsBucket + 'posterframes/poster_katerchen.jpeg';
|
869
|
+
var videoGarzweilerLoop1 = awsBucket + 'braunkohle_loop1.mp4';
|
870
|
+
var poster_videoGarzweilerLoop1 = awsBucket + 'posterframes/poster_braunkohle_loop1.jpeg';
|
871
|
+
var videoGarzweilerLoop2 = awsBucket + 'braunkohle_loop2.mp4';
|
872
|
+
var poster_videoGarzweilerLoop2 = awsBucket + 'posterframes/poster_braunkohle_loop2.jpeg';
|
873
|
+
var videoGarzweilerDrohne = awsBucket + 'braunkohle_drone.mp4';
|
874
|
+
var poster_videoGarzweilerDrohne = awsBucket + 'posterframes/poster_braunkohle_drone.jpeg';
|
875
|
+
var videoInselInterviewToni = awsBucket + 'pageflow_insel_interview_toni02.mp4';
|
876
|
+
var poster_videoInselInterviewToni = awsBucket + 'posterframes/poster_pageflow_insel_interview_toni02.jpg';
|
877
|
+
var videoUrl = {
|
878
|
+
videoBoatSunset: videoBoatSunset,
|
879
|
+
videoBoatDark: videoBoatDark,
|
880
|
+
videoKaterchen: videoKaterchen,
|
881
|
+
videoGarzweilerLoop1: videoGarzweilerLoop1,
|
882
|
+
videoGarzweilerLoop2: videoGarzweilerLoop2,
|
883
|
+
videoGarzweilerDrohne: videoGarzweilerDrohne,
|
884
|
+
videoInselInterviewToni: videoInselInterviewToni
|
885
|
+
}[props.id];
|
886
|
+
var posterUrl = {
|
887
|
+
poster_videoBoatSunset: poster_videoBoatSunset,
|
888
|
+
poster_videoBoatDark: poster_videoBoatDark,
|
889
|
+
poster_videoKaterchen: poster_videoKaterchen,
|
890
|
+
poster_videoGarzweilerLoop1: poster_videoGarzweilerLoop1,
|
891
|
+
poster_videoGarzweilerLoop2: poster_videoGarzweilerLoop2,
|
892
|
+
poster_videoGarzweilerDrohne: poster_videoGarzweilerDrohne,
|
893
|
+
poster_videoInselInterviewToni: poster_videoInselInterviewToni
|
894
|
+
}['poster_' + props.id];
|
895
|
+
var videoRef = useRef();
|
896
|
+
var state = props.state;
|
897
|
+
var mutedSettings = useContext(MutedContext);
|
898
|
+
var mediaOff = mutedSettings.mediaOff;
|
899
|
+
useEffect(function () {
|
900
|
+
var video = videoRef.current;
|
901
|
+
|
902
|
+
if (video && !mediaOff) {
|
903
|
+
if (state === 'active') {
|
904
|
+
if (video.readyState > 0) {
|
905
|
+
video.play();
|
906
|
+
} else {
|
907
|
+
video.addEventListener('loadedmetadata', play);
|
908
|
+
return function () {
|
909
|
+
return video.removeEventListener('loadedmetadata', play);
|
910
|
+
};
|
292
911
|
}
|
293
|
-
}
|
912
|
+
} else {
|
913
|
+
video.pause();
|
914
|
+
}
|
915
|
+
}
|
916
|
+
|
917
|
+
function play() {
|
918
|
+
video.play();
|
919
|
+
}
|
920
|
+
}, [state, videoRef, mediaOff]);
|
921
|
+
return React.createElement("div", {
|
922
|
+
className: styles$2.root
|
923
|
+
}, React.createElement(ScrollToSectionContext.Consumer, null, function (scrollToSection) {
|
924
|
+
return React.createElement("video", {
|
925
|
+
src: videoUrl,
|
926
|
+
ref: videoRef,
|
927
|
+
className: classnames(styles$2.video, _defineProperty({}, styles$2.backdrop, !props.interactive)),
|
928
|
+
controls: props.controls,
|
929
|
+
playsInline: true,
|
930
|
+
onEnded: function onEnded() {
|
931
|
+
return props.nextSectionOnEnd && scrollToSection('next');
|
932
|
+
},
|
933
|
+
loop: !props.interactive,
|
934
|
+
muted: mutedSettings.muted,
|
935
|
+
poster: posterUrl
|
936
|
+
});
|
937
|
+
}));
|
938
|
+
}
|
939
|
+
Video.defaultProps = {
|
940
|
+
interactive: false,
|
941
|
+
controls: false
|
942
|
+
};
|
943
|
+
|
944
|
+
var css$3 = ".FillColor-module_FillColor__S1uEG {\n width: 100%;\n height: 100vh;\n}\n";
|
945
|
+
var styles$3 = {"FillColor":"FillColor-module_FillColor__S1uEG"};
|
946
|
+
styleInject(css$3);
|
947
|
+
|
948
|
+
function FillColor(props) {
|
949
|
+
return React.createElement("div", {
|
950
|
+
className: styles$3.FillColor,
|
951
|
+
style: {
|
952
|
+
backgroundColor: props.color
|
294
953
|
}
|
954
|
+
});
|
955
|
+
}
|
956
|
+
|
957
|
+
var css$4 = ".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";
|
958
|
+
var styles$4 = {"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"};
|
959
|
+
styleInject(css$4);
|
960
|
+
|
961
|
+
var MotifArea = React.forwardRef(function MotifArea(props, ref) {
|
962
|
+
var image = useFile({
|
963
|
+
collectionName: 'imageFiles',
|
964
|
+
permaId: props.imageId
|
965
|
+
});
|
966
|
+
|
967
|
+
if (!image) {
|
968
|
+
return null;
|
295
969
|
}
|
970
|
+
|
971
|
+
return React.createElement("div", {
|
972
|
+
ref: ref,
|
973
|
+
className: classnames(styles$4.root, _defineProperty({}, styles$4.active, props.active)),
|
974
|
+
style: position(props, image),
|
975
|
+
onMouseEnter: props.onMouseEnter,
|
976
|
+
onMouseLeave: props.onMouseLeave
|
977
|
+
}, React.createElement("div", {
|
978
|
+
className: styles$4.topLeft
|
979
|
+
}), React.createElement("div", {
|
980
|
+
className: styles$4.topRight
|
981
|
+
}), React.createElement("div", {
|
982
|
+
className: styles$4.bottomLeft
|
983
|
+
}), React.createElement("div", {
|
984
|
+
className: styles$4.bottomRight
|
985
|
+
}));
|
296
986
|
});
|
297
987
|
|
298
|
-
function
|
299
|
-
var
|
300
|
-
|
301
|
-
|
302
|
-
|
988
|
+
function position(props, image) {
|
989
|
+
var originalRatio = image.width / image.height;
|
990
|
+
var containerRatio = props.containerWidth / props.containerHeight;
|
991
|
+
var scale = containerRatio > originalRatio ? props.containerWidth / image.width : props.containerHeight / image.height;
|
992
|
+
var contentWidth = image.width * scale;
|
993
|
+
var contentHeight = image.height * scale;
|
994
|
+
var focusX = image.configuration.focusX === undefined ? 50 : image.configuration.focusX;
|
995
|
+
var focusY = image.configuration.focusY === undefined ? 50 : image.configuration.focusY;
|
996
|
+
var cropLeft = (contentWidth - props.containerWidth) * focusX / 100;
|
997
|
+
var cropTop = (contentHeight - props.containerHeight) * focusY / 100;
|
998
|
+
var motifArea = image.configuration.motifArea || {
|
999
|
+
top: 0,
|
1000
|
+
left: 0,
|
1001
|
+
width: 0,
|
1002
|
+
height: 0
|
1003
|
+
};
|
1004
|
+
return {
|
1005
|
+
top: contentHeight * motifArea.top / 100 - cropTop,
|
1006
|
+
left: contentWidth * motifArea.left / 100 - cropLeft,
|
1007
|
+
width: contentWidth * motifArea.width / 100,
|
1008
|
+
height: contentHeight * motifArea.height / 100
|
1009
|
+
};
|
303
1010
|
}
|
304
1011
|
|
305
|
-
function
|
306
|
-
|
1012
|
+
function getSize(el) {
|
1013
|
+
if (!el) {
|
1014
|
+
return {
|
1015
|
+
left: 0,
|
1016
|
+
top: 0,
|
1017
|
+
width: 0,
|
1018
|
+
height: 0
|
1019
|
+
};
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
return {
|
1023
|
+
left: el.offsetLeft,
|
1024
|
+
top: el.offsetTop,
|
1025
|
+
width: el.offsetWidth,
|
1026
|
+
height: el.offsetHeight
|
1027
|
+
};
|
307
1028
|
}
|
308
1029
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
1030
|
+
function useDimension() {
|
1031
|
+
var _useState = useState(getSize(null)),
|
1032
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1033
|
+
componentSize = _useState2[0],
|
1034
|
+
setComponentSize = _useState2[1];
|
1035
|
+
|
1036
|
+
var _useState3 = useState(null),
|
1037
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1038
|
+
currentNode = _useState4[0],
|
1039
|
+
setCurrentNode = _useState4[1];
|
1040
|
+
|
1041
|
+
var measuredRef = useCallback(function (node) {
|
1042
|
+
setCurrentNode(node);
|
1043
|
+
setComponentSize(getSize(node));
|
1044
|
+
}, []);
|
1045
|
+
useEffect(function () {
|
1046
|
+
function handleResize() {
|
1047
|
+
setComponentSize(getSize(currentNode));
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
if (!currentNode) {
|
1051
|
+
return;
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
handleResize();
|
1055
|
+
window.addEventListener('resize', handleResize);
|
1056
|
+
return function () {
|
1057
|
+
window.removeEventListener('resize', handleResize);
|
1058
|
+
};
|
1059
|
+
}, [currentNode]);
|
1060
|
+
return [componentSize, measuredRef];
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
var videos = {
|
1064
|
+
videoBoatSunset: {
|
1065
|
+
id: "videoBoatSunset",
|
1066
|
+
width: 960,
|
1067
|
+
height: 406,
|
1068
|
+
motiveArea: {
|
1069
|
+
top: 0,
|
1070
|
+
left: 0,
|
1071
|
+
width: 0,
|
1072
|
+
height: 0
|
1073
|
+
},
|
1074
|
+
focusX: 50,
|
1075
|
+
focusY: 50
|
1076
|
+
},
|
1077
|
+
videoBoatDark: {
|
1078
|
+
id: "videoBoatDark",
|
1079
|
+
width: 960,
|
1080
|
+
height: 406,
|
1081
|
+
motiveArea: {
|
1082
|
+
top: 0,
|
1083
|
+
left: 0,
|
1084
|
+
width: 0,
|
1085
|
+
height: 0
|
1086
|
+
},
|
1087
|
+
focusX: 50,
|
1088
|
+
focusY: 50
|
1089
|
+
},
|
1090
|
+
videoKaterchen: {
|
1091
|
+
id: "videoKaterchen",
|
1092
|
+
width: 1920,
|
1093
|
+
height: 1080,
|
1094
|
+
motiveArea: {
|
1095
|
+
top: 0,
|
1096
|
+
left: 0,
|
1097
|
+
width: 0,
|
1098
|
+
height: 0
|
1099
|
+
},
|
1100
|
+
focusX: 50,
|
1101
|
+
focusY: 50
|
1102
|
+
},
|
1103
|
+
videoGarzweilerLoop1: {
|
1104
|
+
id: "videoGarzweilerLoop1",
|
1105
|
+
width: 3840,
|
1106
|
+
height: 2160,
|
1107
|
+
motiveArea: {
|
1108
|
+
top: 0,
|
1109
|
+
left: 0,
|
1110
|
+
width: 1,
|
1111
|
+
height: 1
|
1112
|
+
},
|
1113
|
+
focusX: 50,
|
1114
|
+
focusY: 50
|
1115
|
+
},
|
1116
|
+
videoGarzweilerLoop2: {
|
1117
|
+
id: "videoGarzweilerLoop2",
|
1118
|
+
width: 1920,
|
1119
|
+
height: 1080,
|
1120
|
+
motiveArea: {
|
1121
|
+
top: 0,
|
1122
|
+
left: 0,
|
1123
|
+
width: 1,
|
1124
|
+
height: 1
|
1125
|
+
},
|
1126
|
+
focusX: 15,
|
1127
|
+
focusY: 20
|
1128
|
+
},
|
1129
|
+
videoGarzweilerDrohne: {
|
1130
|
+
id: "videoGarzweilerDrohne",
|
1131
|
+
width: 1920,
|
1132
|
+
height: 1080,
|
1133
|
+
motiveArea: {
|
1134
|
+
top: 0,
|
1135
|
+
left: 0,
|
1136
|
+
width: 0,
|
1137
|
+
height: 0
|
1138
|
+
}
|
1139
|
+
},
|
1140
|
+
videoInselInterviewToni: {
|
1141
|
+
id: "videoInselInterviewToni",
|
1142
|
+
width: 1920,
|
1143
|
+
height: 1080,
|
1144
|
+
motiveArea: {
|
1145
|
+
top: 0,
|
1146
|
+
left: 0,
|
1147
|
+
width: 0,
|
1148
|
+
height: 0
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
};
|
1152
|
+
|
1153
|
+
var ResizeSensor = createCommonjsModule(function (module, exports) {
|
1154
|
+
// Copyright (c) 2013 Marc J. Schmidt
|
1155
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
1156
|
+
// of this software and associated documentation files (the "Software"), to deal
|
1157
|
+
// in the Software without restriction, including without limitation the rights
|
1158
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1159
|
+
// copies of the Software, and to permit persons to whom the Software is
|
1160
|
+
// furnished to do so, subject to the following conditions:
|
1161
|
+
// The above copyright notice and this permission notice shall be included in
|
1162
|
+
// all copies or substantial portions of the Software.
|
1163
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1164
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1165
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1166
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1167
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1168
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
1169
|
+
// THE SOFTWARE.
|
1170
|
+
// Originally based on version 1.2.1,
|
1171
|
+
// https://github.com/marcj/css-element-queries/tree/1.2.1
|
1172
|
+
// Some lines removed for compatibility.
|
1173
|
+
(function (root, factory) {
|
1174
|
+
{
|
1175
|
+
module.exports = factory();
|
1176
|
+
}
|
1177
|
+
})(typeof window !== 'undefined' ? window : commonjsGlobal, function () {
|
1178
|
+
// Make sure it does not throw in a SSR (Server Side Rendering) situation
|
1179
|
+
if (typeof window === "undefined") {
|
1180
|
+
return null;
|
1181
|
+
} // https://github.com/Semantic-Org/Semantic-UI/issues/3855
|
1182
|
+
// https://github.com/marcj/css-element-queries/issues/257
|
1183
|
+
|
1184
|
+
|
1185
|
+
var globalWindow = window; // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
|
1186
|
+
// In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
|
1187
|
+
// would generate too many unnecessary events.
|
1188
|
+
|
1189
|
+
var requestAnimationFrame = globalWindow.requestAnimationFrame || globalWindow.mozRequestAnimationFrame || globalWindow.webkitRequestAnimationFrame || function (fn) {
|
1190
|
+
return globalWindow.setTimeout(fn, 20);
|
1191
|
+
};
|
1192
|
+
|
1193
|
+
function forEachElement(elements, callback) {
|
1194
|
+
var elementsType = Object.prototype.toString.call(elements);
|
1195
|
+
var isCollectionTyped = '[object Array]' === elementsType || '[object NodeList]' === elementsType || '[object HTMLCollection]' === elementsType || '[object Object]' === elementsType;
|
1196
|
+
var i = 0,
|
1197
|
+
j = elements.length;
|
1198
|
+
|
1199
|
+
if (isCollectionTyped) {
|
1200
|
+
for (; i < j; i++) {
|
1201
|
+
callback(elements[i]);
|
1202
|
+
}
|
1203
|
+
} else {
|
1204
|
+
callback(elements);
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
function getElementSize(element) {
|
1209
|
+
if (!element.getBoundingClientRect) {
|
1210
|
+
return {
|
1211
|
+
width: element.offsetWidth,
|
1212
|
+
height: element.offsetHeight
|
1213
|
+
};
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
var rect = element.getBoundingClientRect();
|
1217
|
+
return {
|
1218
|
+
width: Math.round(rect.width),
|
1219
|
+
height: Math.round(rect.height)
|
1220
|
+
};
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
function setStyle(element, style) {
|
1224
|
+
Object.keys(style).forEach(function (key) {
|
1225
|
+
element.style[key] = style[key];
|
1226
|
+
});
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
var ResizeSensor = function ResizeSensor(element, callback) {
|
1230
|
+
function EventQueue() {
|
1231
|
+
var q = [];
|
1232
|
+
|
1233
|
+
this.add = function (ev) {
|
1234
|
+
q.push(ev);
|
1235
|
+
};
|
1236
|
+
|
1237
|
+
var i, j;
|
1238
|
+
|
1239
|
+
this.call = function (sizeInfo) {
|
1240
|
+
for (i = 0, j = q.length; i < j; i++) {
|
1241
|
+
q[i].call(this, sizeInfo);
|
1242
|
+
}
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
this.remove = function (ev) {
|
1246
|
+
var newQueue = [];
|
1247
|
+
|
1248
|
+
for (i = 0, j = q.length; i < j; i++) {
|
1249
|
+
if (q[i] !== ev) newQueue.push(q[i]);
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
q = newQueue;
|
1253
|
+
};
|
1254
|
+
|
1255
|
+
this.length = function () {
|
1256
|
+
return q.length;
|
1257
|
+
};
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
function attachResizeEvent(element, resized) {
|
1261
|
+
if (!element) return;
|
1262
|
+
|
1263
|
+
if (element.resizedAttached) {
|
1264
|
+
element.resizedAttached.add(resized);
|
1265
|
+
return;
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
element.resizedAttached = new EventQueue();
|
1269
|
+
element.resizedAttached.add(resized);
|
1270
|
+
element.resizeSensor = document.createElement('div');
|
1271
|
+
element.resizeSensor.dir = 'ltr';
|
1272
|
+
element.resizeSensor.className = 'resize-sensor';
|
1273
|
+
var style = {
|
1274
|
+
pointerEvents: 'none',
|
1275
|
+
position: 'absolute',
|
1276
|
+
left: '0px',
|
1277
|
+
top: '0px',
|
1278
|
+
right: '0px',
|
1279
|
+
bottom: '0px',
|
1280
|
+
overflow: 'hidden',
|
1281
|
+
zIndex: '-1',
|
1282
|
+
visibility: 'hidden',
|
1283
|
+
maxWidth: '100%'
|
1284
|
+
};
|
1285
|
+
var styleChild = {
|
1286
|
+
position: 'absolute',
|
1287
|
+
left: '0px',
|
1288
|
+
top: '0px',
|
1289
|
+
transition: '0s'
|
1290
|
+
};
|
1291
|
+
setStyle(element.resizeSensor, style);
|
1292
|
+
var expand = document.createElement('div');
|
1293
|
+
expand.className = 'resize-sensor-expand';
|
1294
|
+
setStyle(expand, style);
|
1295
|
+
var expandChild = document.createElement('div');
|
1296
|
+
setStyle(expandChild, styleChild);
|
1297
|
+
expand.appendChild(expandChild);
|
1298
|
+
var shrink = document.createElement('div');
|
1299
|
+
shrink.className = 'resize-sensor-shrink';
|
1300
|
+
setStyle(shrink, style);
|
1301
|
+
var shrinkChild = document.createElement('div');
|
1302
|
+
setStyle(shrinkChild, styleChild);
|
1303
|
+
setStyle(shrinkChild, {
|
1304
|
+
width: '200%',
|
1305
|
+
height: '200%'
|
1306
|
+
});
|
1307
|
+
shrink.appendChild(shrinkChild);
|
1308
|
+
element.resizeSensor.appendChild(expand);
|
1309
|
+
element.resizeSensor.appendChild(shrink);
|
1310
|
+
element.appendChild(element.resizeSensor);
|
1311
|
+
var computedStyle = window.getComputedStyle(element);
|
1312
|
+
var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
|
1313
|
+
|
1314
|
+
if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) {
|
1315
|
+
element.style.position = 'relative';
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
var dirty, rafId;
|
1319
|
+
var size = getElementSize(element);
|
1320
|
+
var lastWidth = 0;
|
1321
|
+
var lastHeight = 0;
|
1322
|
+
var initialHiddenCheck = true;
|
1323
|
+
var lastAnimationFrame = 0;
|
1324
|
+
|
1325
|
+
var resetExpandShrink = function resetExpandShrink() {
|
1326
|
+
var width = element.offsetWidth;
|
1327
|
+
var height = element.offsetHeight;
|
1328
|
+
expandChild.style.width = width + 10 + 'px';
|
1329
|
+
expandChild.style.height = height + 10 + 'px';
|
1330
|
+
expand.scrollLeft = width + 10;
|
1331
|
+
expand.scrollTop = height + 10;
|
1332
|
+
shrink.scrollLeft = width + 10;
|
1333
|
+
shrink.scrollTop = height + 10;
|
1334
|
+
};
|
1335
|
+
|
1336
|
+
var reset = function reset() {
|
1337
|
+
// Check if element is hidden
|
1338
|
+
if (initialHiddenCheck) {
|
1339
|
+
var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
|
1340
|
+
|
1341
|
+
if (invisible) {
|
1342
|
+
// Check in next frame
|
1343
|
+
if (!lastAnimationFrame) {
|
1344
|
+
lastAnimationFrame = requestAnimationFrame(function () {
|
1345
|
+
lastAnimationFrame = 0;
|
1346
|
+
reset();
|
1347
|
+
});
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
return;
|
1351
|
+
} else {
|
1352
|
+
// Stop checking
|
1353
|
+
initialHiddenCheck = false;
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
resetExpandShrink();
|
1358
|
+
};
|
1359
|
+
|
1360
|
+
element.resizeSensor.resetSensor = reset;
|
1361
|
+
|
1362
|
+
var onResized = function onResized() {
|
1363
|
+
rafId = 0;
|
1364
|
+
if (!dirty) return;
|
1365
|
+
lastWidth = size.width;
|
1366
|
+
lastHeight = size.height;
|
1367
|
+
|
1368
|
+
if (element.resizedAttached) {
|
1369
|
+
element.resizedAttached.call(size);
|
1370
|
+
}
|
1371
|
+
};
|
1372
|
+
|
1373
|
+
var onScroll = function onScroll() {
|
1374
|
+
size = getElementSize(element);
|
1375
|
+
dirty = size.width !== lastWidth || size.height !== lastHeight;
|
1376
|
+
|
1377
|
+
if (dirty && !rafId) {
|
1378
|
+
rafId = requestAnimationFrame(onResized);
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
reset();
|
1382
|
+
};
|
1383
|
+
|
1384
|
+
var addEvent = function addEvent(el, name, cb) {
|
1385
|
+
if (el.attachEvent) {
|
1386
|
+
el.attachEvent('on' + name, cb);
|
1387
|
+
} else {
|
1388
|
+
el.addEventListener(name, cb);
|
1389
|
+
}
|
1390
|
+
};
|
1391
|
+
|
1392
|
+
addEvent(expand, 'scroll', onScroll);
|
1393
|
+
addEvent(shrink, 'scroll', onScroll); // Fix for custom Elements
|
1394
|
+
|
1395
|
+
requestAnimationFrame(reset);
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
forEachElement(element, function (elem) {
|
1399
|
+
attachResizeEvent(elem, callback);
|
1400
|
+
});
|
1401
|
+
|
1402
|
+
this.detach = function (ev) {
|
1403
|
+
ResizeSensor.detach(element, ev);
|
1404
|
+
};
|
1405
|
+
|
1406
|
+
this.reset = function () {
|
1407
|
+
element.resizeSensor.resetSensor();
|
1408
|
+
};
|
1409
|
+
};
|
1410
|
+
|
1411
|
+
ResizeSensor.reset = function (element) {
|
1412
|
+
forEachElement(element, function (elem) {
|
1413
|
+
elem.resizeSensor.resetSensor();
|
1414
|
+
});
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
ResizeSensor.detach = function (element, ev) {
|
1418
|
+
forEachElement(element, function (elem) {
|
1419
|
+
if (!elem) return;
|
1420
|
+
|
1421
|
+
if (elem.resizedAttached && typeof ev === "function") {
|
1422
|
+
elem.resizedAttached.remove(ev);
|
1423
|
+
if (elem.resizedAttached.length()) return;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
if (elem.resizeSensor) {
|
1427
|
+
if (elem.contains(elem.resizeSensor)) {
|
1428
|
+
elem.removeChild(elem.resizeSensor);
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
delete elem.resizeSensor;
|
1432
|
+
delete elem.resizedAttached;
|
1433
|
+
}
|
1434
|
+
});
|
1435
|
+
};
|
1436
|
+
|
1437
|
+
if (typeof MutationObserver !== "undefined") {
|
1438
|
+
var observer = new MutationObserver(function (mutations) {
|
1439
|
+
for (var i in mutations) {
|
1440
|
+
if (mutations.hasOwnProperty(i)) {
|
1441
|
+
var items = mutations[i].addedNodes;
|
1442
|
+
|
1443
|
+
for (var j = 0; j < items.length; j++) {
|
1444
|
+
if (items[j].resizeSensor) {
|
1445
|
+
ResizeSensor.reset(items[j]);
|
1446
|
+
}
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
}
|
1450
|
+
});
|
1451
|
+
document.addEventListener("DOMContentLoaded", function (event) {
|
1452
|
+
observer.observe(document.body, {
|
1453
|
+
childList: true,
|
1454
|
+
subtree: true
|
1455
|
+
});
|
1456
|
+
});
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
return ResizeSensor;
|
1460
|
+
});
|
1461
|
+
});
|
1462
|
+
|
1463
|
+
var cssElementQueries = {
|
1464
|
+
ResizeSensor: ResizeSensor
|
1465
|
+
};
|
1466
|
+
var cssElementQueries_1 = cssElementQueries.ResizeSensor;
|
1467
|
+
|
1468
|
+
function ownKeys$5(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; }
|
1469
|
+
|
1470
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
1471
|
+
var defaultProps = {
|
1472
|
+
handleSize: 40,
|
1473
|
+
handle: null,
|
1474
|
+
hover: false,
|
1475
|
+
leftImageAlt: '',
|
1476
|
+
leftImageCss: {},
|
1477
|
+
leftImageLabel: null,
|
1478
|
+
onSliderPositionChange: function onSliderPositionChange() {},
|
1479
|
+
rightImageAlt: '',
|
1480
|
+
rightImageCss: {},
|
1481
|
+
rightImageLabel: null,
|
1482
|
+
skeleton: null,
|
1483
|
+
sliderLineColor: '#ffffff',
|
1484
|
+
sliderLineWidth: 2,
|
1485
|
+
sliderPositionPercentage: 0.5
|
1486
|
+
};
|
1487
|
+
|
1488
|
+
function ReactCompareImage(props) {
|
1489
|
+
var handleSize = props.handleSize,
|
1490
|
+
handle = props.handle,
|
1491
|
+
hover = props.hover,
|
1492
|
+
leftImage = props.leftImage,
|
1493
|
+
leftImageAlt = props.leftImageAlt,
|
1494
|
+
leftImageCss = props.leftImageCss,
|
1495
|
+
leftImageLabel = props.leftImageLabel,
|
1496
|
+
onSliderPositionChange = props.onSliderPositionChange,
|
1497
|
+
rightImage = props.rightImage,
|
1498
|
+
rightImageAlt = props.rightImageAlt,
|
1499
|
+
rightImageCss = props.rightImageCss,
|
1500
|
+
rightImageLabel = props.rightImageLabel,
|
1501
|
+
skeleton = props.skeleton,
|
1502
|
+
sliderLineColor = props.sliderLineColor,
|
1503
|
+
sliderLineWidth = props.sliderLineWidth,
|
1504
|
+
sliderPositionPercentage = props.sliderPositionPercentage,
|
1505
|
+
sliderPosition = props.sliderPosition,
|
1506
|
+
setSliderPosition = props.setSliderPosition,
|
1507
|
+
isSliding = props.isSliding,
|
1508
|
+
setIsSliding = props.setIsSliding,
|
1509
|
+
classicMode = props.classicMode,
|
1510
|
+
wiggle = props.wiggle;
|
1511
|
+
|
1512
|
+
var _useState = useState(0),
|
1513
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1514
|
+
containerWidth = _useState2[0],
|
1515
|
+
setContainerWidth = _useState2[1];
|
1516
|
+
|
1517
|
+
var _useState3 = useState(false),
|
1518
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1519
|
+
leftImgLoaded = _useState4[0],
|
1520
|
+
setLeftImgLoaded = _useState4[1];
|
1521
|
+
|
1522
|
+
var _useState5 = useState(false),
|
1523
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
1524
|
+
rightImgLoaded = _useState6[0],
|
1525
|
+
setRightImgLoaded = _useState6[1];
|
1526
|
+
|
1527
|
+
var containerRef = useRef();
|
1528
|
+
var rightImageRef = useRef();
|
1529
|
+
var leftImageRef = useRef(); // keep track container's width in local state
|
1530
|
+
|
1531
|
+
useEffect(function () {
|
1532
|
+
var updateContainerWidth = function updateContainerWidth() {
|
1533
|
+
var currentContainerWidth = containerRef.current.getBoundingClientRect().width;
|
1534
|
+
setContainerWidth(currentContainerWidth);
|
1535
|
+
}; // initial execution must be done manually
|
1536
|
+
|
1537
|
+
|
1538
|
+
updateContainerWidth(); // update local state if container size is changed
|
1539
|
+
|
1540
|
+
var containerElement = containerRef.current;
|
1541
|
+
var resizeSensor = new cssElementQueries_1(containerElement, function () {
|
1542
|
+
updateContainerWidth();
|
1543
|
+
});
|
1544
|
+
return function () {
|
1545
|
+
resizeSensor.detach(containerElement);
|
1546
|
+
};
|
1547
|
+
}, []);
|
1548
|
+
useEffect(function () {
|
1549
|
+
// consider the case where loading image is completed immediately
|
1550
|
+
// due to the cache etc.
|
1551
|
+
var alreadyDone = leftImageRef.current.complete;
|
1552
|
+
alreadyDone && setLeftImgLoaded(true);
|
1553
|
+
return function () {
|
1554
|
+
// when the left image source is changed
|
1555
|
+
setLeftImgLoaded(false);
|
1556
|
+
};
|
1557
|
+
}, [leftImage]);
|
1558
|
+
useEffect(function () {
|
1559
|
+
// consider the case where loading image is completed immediately
|
1560
|
+
// due to the cache etc.
|
1561
|
+
var alreadyDone = rightImageRef.current.complete;
|
1562
|
+
alreadyDone && setRightImgLoaded(true);
|
1563
|
+
return function () {
|
1564
|
+
// when the right image source is changed
|
1565
|
+
setRightImgLoaded(false);
|
1566
|
+
};
|
1567
|
+
}, [rightImage]);
|
1568
|
+
var allImagesLoaded = rightImgLoaded && leftImgLoaded;
|
1569
|
+
useEffect(function () {
|
1570
|
+
var handleSliding = function handleSliding(event) {
|
1571
|
+
var e = event || window.event; // Calc Cursor Position from the left edge of the viewport
|
1572
|
+
|
1573
|
+
var cursorXfromViewport = e.touches ? e.touches[0].pageX : e.pageX; // Calc Cursor Position from the left edge of the window (consider any page scrolling)
|
1574
|
+
|
1575
|
+
var cursorXfromWindow = cursorXfromViewport - window.pageXOffset; // Calc Cursor Position from the left edge of the image
|
1576
|
+
|
1577
|
+
var imagePosition = rightImageRef.current.getBoundingClientRect();
|
1578
|
+
var pos = cursorXfromWindow - imagePosition.left; // Set minimum and maximum values to prevent the slider from overflowing
|
1579
|
+
|
1580
|
+
var minPos = 0 + sliderLineWidth / 2;
|
1581
|
+
var maxPos = containerWidth - sliderLineWidth / 2;
|
1582
|
+
if (pos < minPos) pos = minPos;
|
1583
|
+
if (pos > maxPos) pos = maxPos;
|
1584
|
+
setSliderPosition(pos / containerWidth); // If there's a callback function, invoke it everytime the slider changes
|
1585
|
+
|
1586
|
+
if (onSliderPositionChange) {
|
1587
|
+
onSliderPositionChange(pos / containerWidth);
|
1588
|
+
}
|
1589
|
+
};
|
1590
|
+
|
1591
|
+
var startSliding = function startSliding(e) {
|
1592
|
+
setIsSliding(true); // Prevent default behavior other than mobile scrolling
|
1593
|
+
|
1594
|
+
if (!('touches' in e)) {
|
1595
|
+
e.preventDefault();
|
1596
|
+
} // Slide the image even if you just click or tap (not drag)
|
1597
|
+
|
1598
|
+
|
1599
|
+
handleSliding(e);
|
1600
|
+
window.addEventListener('mousemove', handleSliding); // 07
|
1601
|
+
|
1602
|
+
window.addEventListener('touchmove', handleSliding); // 08
|
1603
|
+
};
|
1604
|
+
|
1605
|
+
var finishSliding = function finishSliding() {
|
1606
|
+
setIsSliding(false);
|
1607
|
+
window.removeEventListener('mousemove', handleSliding);
|
1608
|
+
window.removeEventListener('touchmove', handleSliding);
|
1609
|
+
};
|
1610
|
+
|
1611
|
+
var containerElement = containerRef.current;
|
1612
|
+
|
1613
|
+
if (allImagesLoaded) {
|
1614
|
+
if (classicMode) {
|
1615
|
+
// it's necessary to reset event handlers each time the canvasWidth changes
|
1616
|
+
// for mobile
|
1617
|
+
containerElement.addEventListener('touchstart', startSliding); // 01
|
1618
|
+
|
1619
|
+
window.addEventListener('touchend', finishSliding); // 02
|
1620
|
+
// for desktop
|
1621
|
+
|
1622
|
+
if (hover) {
|
1623
|
+
containerElement.addEventListener('mousemove', handleSliding); // 03
|
1624
|
+
|
1625
|
+
containerElement.addEventListener('mouseleave', finishSliding); // 04
|
1626
|
+
} else {
|
1627
|
+
containerElement.addEventListener('mousedown', startSliding); // 05
|
1628
|
+
|
1629
|
+
window.addEventListener('mouseup', finishSliding); // 06
|
1630
|
+
}
|
1631
|
+
}
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
return function () {
|
1635
|
+
if (classicMode) {
|
1636
|
+
// cleanup all event resteners
|
1637
|
+
containerElement.removeEventListener('touchstart', startSliding); // 01
|
1638
|
+
|
1639
|
+
window.removeEventListener('touchend', finishSliding); // 02
|
1640
|
+
|
1641
|
+
containerElement.removeEventListener('mousemove', handleSliding); // 03
|
1642
|
+
|
1643
|
+
containerElement.removeEventListener('mouseleave', finishSliding); // 04
|
1644
|
+
|
1645
|
+
containerElement.removeEventListener('mousedown', startSliding); // 05
|
1646
|
+
|
1647
|
+
window.removeEventListener('mouseup', finishSliding); // 06
|
1648
|
+
|
1649
|
+
window.removeEventListener('mousemove', handleSliding); // 07
|
1650
|
+
|
1651
|
+
window.removeEventListener('touchmove', handleSliding); // 08
|
1652
|
+
}
|
1653
|
+
};
|
1654
|
+
}, [allImagesLoaded, containerWidth, hover, sliderLineWidth]); // eslint-disable-line
|
1655
|
+
// Image size set as follows.
|
1656
|
+
//
|
1657
|
+
// 1. right(under) image:
|
1658
|
+
// width = 100% of container width
|
1659
|
+
// height = auto
|
1660
|
+
//
|
1661
|
+
// 2. left(over) imaze:
|
1662
|
+
// width = 100% of container width
|
1663
|
+
// height = right image's height
|
1664
|
+
// (protrudes is hidden by css 'object-fit: hidden')
|
1665
|
+
|
1666
|
+
var styles = {
|
1667
|
+
container: {
|
1668
|
+
boxSizing: 'border-box',
|
1669
|
+
position: 'relative',
|
1670
|
+
width: '100%',
|
1671
|
+
overflow: 'hidden'
|
1672
|
+
},
|
1673
|
+
rightImage: _objectSpread$5({
|
1674
|
+
display: 'block',
|
1675
|
+
height: 'auto',
|
1676
|
+
// Respect the aspect ratio
|
1677
|
+
width: '100%'
|
1678
|
+
}, rightImageCss),
|
1679
|
+
leftImage: _objectSpread$5({
|
1680
|
+
clip: "rect(auto, ".concat(containerWidth * sliderPosition, "px, auto, auto)"),
|
1681
|
+
display: 'block',
|
1682
|
+
height: '100%',
|
1683
|
+
// fit to the height of right(under) image
|
1684
|
+
objectFit: 'cover',
|
1685
|
+
// protrudes is hidden
|
1686
|
+
position: 'absolute',
|
1687
|
+
top: 0,
|
1688
|
+
width: '100%'
|
1689
|
+
}, leftImageCss),
|
1690
|
+
slider: {
|
1691
|
+
alignItems: 'center',
|
1692
|
+
cursor: !hover && 'ew-resize',
|
1693
|
+
display: 'flex',
|
1694
|
+
flexDirection: 'column',
|
1695
|
+
height: '100%',
|
1696
|
+
justifyContent: 'center',
|
1697
|
+
left: "".concat(containerWidth * sliderPosition - handleSize / 2, "px"),
|
1698
|
+
position: 'absolute',
|
1699
|
+
top: 0,
|
1700
|
+
width: "".concat(handleSize, "px")
|
1701
|
+
},
|
1702
|
+
line: {
|
1703
|
+
background: sliderLineColor,
|
1704
|
+
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)',
|
1705
|
+
flex: '0 1 auto',
|
1706
|
+
height: '100%',
|
1707
|
+
width: "".concat(sliderLineWidth, "px")
|
1708
|
+
},
|
1709
|
+
handleCustom: {
|
1710
|
+
alignItems: 'center',
|
1711
|
+
boxSizing: 'border-box',
|
1712
|
+
display: 'flex',
|
1713
|
+
flex: '1 0 auto',
|
1714
|
+
height: 'auto',
|
1715
|
+
justifyContent: 'center',
|
1716
|
+
width: 'auto'
|
1717
|
+
},
|
1718
|
+
handleDefault: {
|
1719
|
+
alignItems: 'center',
|
1720
|
+
border: "".concat(sliderLineWidth, "px solid ").concat(sliderLineColor),
|
1721
|
+
borderRadius: '100%',
|
1722
|
+
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)',
|
1723
|
+
boxSizing: 'border-box',
|
1724
|
+
display: 'flex',
|
1725
|
+
flex: '1 0 auto',
|
1726
|
+
height: "".concat(handleSize, "px"),
|
1727
|
+
justifyContent: 'center',
|
1728
|
+
width: "".concat(handleSize, "px")
|
1729
|
+
},
|
1730
|
+
leftArrow: {
|
1731
|
+
border: "inset ".concat(handleSize * 0.15, "px rgba(0,0,0,0)"),
|
1732
|
+
borderRight: "".concat(handleSize * 0.15, "px solid ").concat(sliderLineColor),
|
1733
|
+
height: '0px',
|
1734
|
+
marginLeft: "-".concat(handleSize * 0.25, "px"),
|
1735
|
+
// for IE11
|
1736
|
+
marginRight: "".concat(handleSize * 0.25, "px"),
|
1737
|
+
width: '0px'
|
1738
|
+
},
|
1739
|
+
rightArrow: {
|
1740
|
+
border: "inset ".concat(handleSize * 0.15, "px rgba(0,0,0,0)"),
|
1741
|
+
borderLeft: "".concat(handleSize * 0.15, "px solid ").concat(sliderLineColor),
|
1742
|
+
height: '0px',
|
1743
|
+
marginRight: "-".concat(handleSize * 0.25, "px"),
|
1744
|
+
// for IE11
|
1745
|
+
width: '0px'
|
1746
|
+
},
|
1747
|
+
leftLabel: {
|
1748
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
1749
|
+
color: 'white',
|
1750
|
+
left: '5%',
|
1751
|
+
opacity: isSliding ? 0 : 1,
|
1752
|
+
padding: '10px 20px',
|
1753
|
+
position: 'absolute',
|
1754
|
+
top: '50%',
|
1755
|
+
transform: 'translate(0,-50%)',
|
1756
|
+
transition: 'opacity 0.1s ease-out 0.5s',
|
1757
|
+
maxWidth: '30%',
|
1758
|
+
WebkitUserSelect: 'none',
|
1759
|
+
WebkitTouchCallout: 'none'
|
1760
|
+
},
|
1761
|
+
rightLabel: {
|
1762
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
1763
|
+
color: 'white',
|
1764
|
+
opacity: isSliding ? 0 : 1,
|
1765
|
+
padding: '10px 20px',
|
1766
|
+
position: 'absolute',
|
1767
|
+
right: '5%',
|
1768
|
+
top: '50%',
|
1769
|
+
transform: 'translate(0,-50%)',
|
1770
|
+
transition: 'opacity 0.1s ease-out 0.5s',
|
1771
|
+
maxWidth: '30%',
|
1772
|
+
WebkitUserSelect: 'none',
|
1773
|
+
WebkitTouchCallout: 'none'
|
1774
|
+
}
|
1775
|
+
};
|
1776
|
+
return React.createElement(React.Fragment, null, skeleton && !allImagesLoaded && React.createElement("div", {
|
1777
|
+
style: _objectSpread$5({}, styles.container)
|
1778
|
+
}, skeleton), React.createElement("div", {
|
1779
|
+
style: _objectSpread$5({}, styles.container, {
|
1780
|
+
display: allImagesLoaded ? 'block' : 'none'
|
1781
|
+
}),
|
1782
|
+
ref: containerRef,
|
1783
|
+
"data-testid": "container"
|
1784
|
+
}, React.createElement("img", {
|
1785
|
+
onLoad: function onLoad() {
|
1786
|
+
return setRightImgLoaded(true);
|
1787
|
+
},
|
1788
|
+
alt: rightImageAlt,
|
1789
|
+
"data-testid": "right-image",
|
1790
|
+
ref: rightImageRef,
|
1791
|
+
src: rightImage,
|
1792
|
+
style: styles.rightImage
|
1793
|
+
}), React.createElement("img", {
|
1794
|
+
onLoad: function onLoad() {
|
1795
|
+
return setLeftImgLoaded(true);
|
1796
|
+
},
|
1797
|
+
alt: leftImageAlt,
|
1798
|
+
"data-testid": "left-image",
|
1799
|
+
ref: leftImageRef,
|
1800
|
+
src: leftImage,
|
1801
|
+
style: styles.leftImage
|
1802
|
+
}), React.createElement("div", {
|
1803
|
+
style: styles.slider,
|
1804
|
+
className: classnames(_defineProperty({}, 'wiggle', wiggle))
|
1805
|
+
}, React.createElement("div", {
|
1806
|
+
style: styles.line
|
1807
|
+
}), handle ? React.createElement("div", {
|
1808
|
+
style: styles.handleCustom
|
1809
|
+
}, handle) : React.createElement("div", {
|
1810
|
+
style: styles.handleDefault
|
1811
|
+
}, React.createElement("div", {
|
1812
|
+
style: styles.leftArrow
|
1813
|
+
}), React.createElement("div", {
|
1814
|
+
style: styles.rightArrow
|
1815
|
+
})), React.createElement("div", {
|
1816
|
+
style: styles.line
|
1817
|
+
})), leftImageLabel && React.createElement("div", {
|
1818
|
+
style: styles.leftLabel
|
1819
|
+
}, leftImageLabel), rightImageLabel && React.createElement("div", {
|
1820
|
+
style: styles.rightLabel
|
1821
|
+
}, rightImageLabel)));
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
ReactCompareImage.defaultProps = defaultProps;
|
1825
|
+
|
1826
|
+
var css$5 = ".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}";
|
1827
|
+
var styles$5 = {"container":"BeforeAfter-module_container__38Dru","shake":"BeforeAfter-module_shake__3iLe8"};
|
1828
|
+
styleInject(css$5);
|
1829
|
+
|
1830
|
+
var BeforeAfter = (function (_ref) {
|
1831
|
+
var state = _ref.state,
|
1832
|
+
leftImageLabel = _ref.leftImageLabel,
|
1833
|
+
rightImageLabel = _ref.rightImageLabel,
|
1834
|
+
_ref$startPos = _ref.startPos,
|
1835
|
+
startPos = _ref$startPos === void 0 ? 0 : _ref$startPos,
|
1836
|
+
_ref$slideMode = _ref.slideMode,
|
1837
|
+
slideMode = _ref$slideMode === void 0 ? 'both' : _ref$slideMode;
|
1838
|
+
|
1839
|
+
var _useState = useState({
|
1840
|
+
pos: window.pageYOffset || document.documentElement.scrollTop,
|
1841
|
+
dir: 'unknown'
|
1842
|
+
}),
|
1843
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1844
|
+
scrollPos = _useState2[0],
|
1845
|
+
setScrollPos = _useState2[1];
|
1846
|
+
|
1847
|
+
var _useState3 = useState(false),
|
1848
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1849
|
+
isSliding = _useState4[0],
|
1850
|
+
setIsSliding = _useState4[1];
|
1851
|
+
|
1852
|
+
var _useState5 = useState(startPos),
|
1853
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
1854
|
+
beforeAfterPos = _useState6[0],
|
1855
|
+
setBeforeAfterPos = _useState6[1];
|
1856
|
+
|
1857
|
+
var beforeAfterRef = useRef();
|
1858
|
+
var slideOnScroll = slideMode === 'both' || slideMode === 'scroll';
|
1859
|
+
var slideClassic = slideMode === 'both' || slideMode === 'classic';
|
1860
|
+
var current = beforeAfterRef.current;
|
1861
|
+
|
1862
|
+
var _useState7 = useState(false),
|
1863
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
1864
|
+
wiggle = _useState8[0],
|
1865
|
+
setWiggle = _useState8[1];
|
1866
|
+
|
1867
|
+
useEffect(function () {
|
1868
|
+
var node = current;
|
1869
|
+
|
1870
|
+
if (node) {
|
1871
|
+
setWiggle(state === 'active');
|
1872
|
+
}
|
1873
|
+
}, [state, current]);
|
1874
|
+
useEffect(function () {
|
1875
|
+
var node = current;
|
1876
|
+
|
1877
|
+
function handler() {
|
1878
|
+
if (node) {
|
1879
|
+
setScrollPos(function (prevPos) {
|
1880
|
+
var currPos = window.pageYOffset || document.documentElement.scrollTop;
|
1881
|
+
|
1882
|
+
if (currPos > prevPos['pos']) {
|
1883
|
+
return {
|
1884
|
+
pos: currPos,
|
1885
|
+
dir: 'down'
|
1886
|
+
};
|
1887
|
+
}
|
1888
|
+
|
1889
|
+
if (currPos < prevPos['pos']) {
|
1890
|
+
return {
|
1891
|
+
pos: currPos,
|
1892
|
+
dir: 'up'
|
1893
|
+
};
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
return prevPos;
|
1897
|
+
});
|
1898
|
+
|
1899
|
+
if (slideOnScroll) {
|
1900
|
+
if (scrollPos['dir'] === 'down' && beforeAfterPos < 1) {
|
1901
|
+
setBeforeAfterPos(function (prev) {
|
1902
|
+
return prev + 0.025;
|
1903
|
+
});
|
1904
|
+
setIsSliding(true);
|
1905
|
+
setTimeout(function () {
|
1906
|
+
return setIsSliding(false);
|
1907
|
+
}, 200);
|
1908
|
+
} else if (scrollPos['dir'] === 'up' && beforeAfterPos > 0) {
|
1909
|
+
setBeforeAfterPos(function (prev) {
|
1910
|
+
return prev - 0.025;
|
1911
|
+
});
|
1912
|
+
setIsSliding(true);
|
1913
|
+
setTimeout(function () {
|
1914
|
+
return setIsSliding(false);
|
1915
|
+
}, 250);
|
1916
|
+
} else {
|
1917
|
+
setIsSliding(false);
|
1918
|
+
}
|
1919
|
+
}
|
1920
|
+
}
|
1921
|
+
}
|
1922
|
+
|
1923
|
+
if (!node) {
|
1924
|
+
return;
|
1925
|
+
}
|
1926
|
+
|
1927
|
+
setTimeout(handler, 0);
|
1928
|
+
|
1929
|
+
if (state === 'active') {
|
1930
|
+
window.addEventListener('scroll', handler);
|
1931
|
+
return function () {
|
1932
|
+
window.removeEventListener('scroll', handler);
|
1933
|
+
};
|
1934
|
+
}
|
1935
|
+
}, [current, setBeforeAfterPos, scrollPos, state, setIsSliding]);
|
1936
|
+
var awsBucket = '//s3-eu-west-1.amazonaws.com/de.codevise.pageflow.development/pageflow-next/presentation-images/';
|
1937
|
+
var beforeImage = awsBucket + 'before_after/haldern_church1.jpg';
|
1938
|
+
var afterImage = awsBucket + 'before_after/haldern_church2.jpg';
|
1939
|
+
return React.createElement("div", {
|
1940
|
+
ref: beforeAfterRef,
|
1941
|
+
className: styles$5.container
|
1942
|
+
}, React.createElement(ReactCompareImage, {
|
1943
|
+
leftImage: beforeImage,
|
1944
|
+
rightImage: afterImage,
|
1945
|
+
sliderPosition: beforeAfterPos,
|
1946
|
+
setSliderPosition: setBeforeAfterPos,
|
1947
|
+
isSliding: isSliding,
|
1948
|
+
setIsSliding: setIsSliding,
|
1949
|
+
leftImageLabel: leftImageLabel,
|
1950
|
+
rightImageLabel: rightImageLabel,
|
1951
|
+
classicMode: slideClassic,
|
1952
|
+
wiggle: wiggle
|
1953
|
+
}));
|
1954
|
+
});
|
1955
|
+
|
1956
|
+
var css$6 = ".Backdrop-module_Backdrop__1w4UZ {\n width: 100%;\n z-index: 2;\n}\n\n.Backdrop-module_offScreen__2_FYZ {\n}\n";
|
1957
|
+
var styles$6 = {"Backdrop":"Backdrop-module_Backdrop__1w4UZ","offScreen":"Backdrop-module_offScreen__2_FYZ"};
|
1958
|
+
styleInject(css$6);
|
1959
|
+
|
1960
|
+
function Backdrop(props) {
|
1961
|
+
var _useDimension = useDimension(),
|
1962
|
+
_useDimension2 = _slicedToArray(_useDimension, 2),
|
1963
|
+
containerDimension = _useDimension2[0],
|
1964
|
+
setContainerRef = _useDimension2[1];
|
1965
|
+
|
1966
|
+
return React.createElement("div", {
|
1967
|
+
className: classnames(styles$6.Backdrop, props.transitionStyles.backdrop, props.transitionStyles["backdrop-".concat(props.state)], _defineProperty({}, styles$6.offScreen, props.offScreen))
|
1968
|
+
}, React.createElement("div", {
|
1969
|
+
className: props.transitionStyles.backdropInner
|
1970
|
+
}, React.createElement("div", {
|
1971
|
+
className: props.transitionStyles.backdropInner2
|
1972
|
+
}, props.children(renderContent(props, containerDimension, setContainerRef)))));
|
1973
|
+
}
|
1974
|
+
Backdrop.defaultProps = {
|
1975
|
+
transitionStyles: {}
|
1976
|
+
};
|
1977
|
+
|
1978
|
+
function renderContent(props, containerDimension, setContainerRef) {
|
1979
|
+
if (props.image.toString().startsWith('#')) {
|
1980
|
+
return React.createElement(FillColor, {
|
1981
|
+
color: props.image
|
1982
|
+
});
|
1983
|
+
} else if (props.image.toString().startsWith('video')) {
|
1984
|
+
var video = videos[props.image];
|
1985
|
+
return React.createElement(Fullscreen, {
|
1986
|
+
ref: setContainerRef
|
1987
|
+
}, React.createElement(Video, {
|
1988
|
+
state: props.onScreen ? 'active' : 'inactive',
|
1989
|
+
id: props.image,
|
1990
|
+
offset: props.offset,
|
1991
|
+
interactive: props.interactive,
|
1992
|
+
nextSectionOnEnd: props.nextSectionOnEnd
|
1993
|
+
}), React.createElement(MotifArea, {
|
1994
|
+
ref: props.motifAreaRef,
|
1995
|
+
image: video,
|
1996
|
+
containerWidth: containerDimension.width,
|
1997
|
+
containerHeight: containerDimension.height
|
1998
|
+
}));
|
1999
|
+
} else if (props.image.toString().startsWith('beforeAfter')) {
|
2000
|
+
return React.createElement(Fullscreen, {
|
2001
|
+
ref: setContainerRef
|
2002
|
+
}, React.createElement(BeforeAfter, {
|
2003
|
+
state: props.state,
|
2004
|
+
leftImageLabel: props.leftImageLabel,
|
2005
|
+
rightImageLabel: props.rightImageLabel,
|
2006
|
+
startPos: props.startPos,
|
2007
|
+
slideMode: props.slideMode
|
2008
|
+
}));
|
2009
|
+
} else {
|
2010
|
+
return React.createElement(Fullscreen, {
|
2011
|
+
ref: setContainerRef
|
2012
|
+
}, React.createElement(Image, {
|
2013
|
+
id: props.image
|
2014
|
+
}), React.createElement(Image, {
|
2015
|
+
id: props.imageMobile,
|
2016
|
+
mobile: true
|
2017
|
+
}), React.createElement(MotifArea, {
|
2018
|
+
ref: props.motifAreaRef,
|
2019
|
+
imageId: props.image,
|
2020
|
+
containerWidth: containerDimension.width,
|
2021
|
+
containerHeight: containerDimension.height
|
2022
|
+
}));
|
2023
|
+
}
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
var css$7 = ".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";
|
2027
|
+
var styles$7 = {"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"};
|
2028
|
+
styleInject(css$7);
|
2029
|
+
|
2030
|
+
function Foreground(props) {
|
2031
|
+
return React.createElement("div", {
|
2032
|
+
className: className(props)
|
2033
|
+
}, props.children);
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
function className(props) {
|
2037
|
+
var _classNames;
|
2038
|
+
|
2039
|
+
return classnames(styles$7.Foreground, props.transitionStyles.foreground, props.transitionStyles["foreground-".concat(props.state)], styles$7["".concat(props.heightMode, "Height")], (_classNames = {}, _defineProperty(_classNames, styles$7.hidden, props.hidden), _defineProperty(_classNames, styles$7.enlarge, props.hidden && !props.disableEnlarge), _classNames));
|
2040
|
+
}
|
2041
|
+
|
2042
|
+
function _arrayWithoutHoles(arr) {
|
2043
|
+
if (Array.isArray(arr)) {
|
2044
|
+
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
2045
|
+
arr2[i] = arr[i];
|
2046
|
+
}
|
2047
|
+
|
2048
|
+
return arr2;
|
2049
|
+
}
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
function _iterableToArray(iter) {
|
2053
|
+
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
function _nonIterableSpread() {
|
2057
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
function _toConsumableArray(arr) {
|
2061
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
2062
|
+
}
|
2063
|
+
|
2064
|
+
var css$8 = "\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";
|
2065
|
+
var styles$8 = {"text-l":"40px","text-xl":"66px","text-2xl":"110px","Heading":"Heading-module_Heading__1YSiy","first":"Heading-module_first__1yPxD"};
|
2066
|
+
styleInject(css$8);
|
2067
|
+
|
2068
|
+
function Heading(props) {
|
2069
|
+
return React.createElement("h1", {
|
2070
|
+
className: classnames(styles$8.Heading, _defineProperty({}, styles$8.first, props.first)),
|
2071
|
+
style: props.style
|
2072
|
+
}, props.children);
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
var css$9 = "\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";
|
2076
|
+
var styles$9 = {"text-base":"22px","TextBlock":"TextBlock-module_TextBlock__5Zpj7","dummy":"TextBlock-module_dummy__3W5ls"};
|
2077
|
+
styleInject(css$9);
|
2078
|
+
|
2079
|
+
function TextBlock(props) {
|
2080
|
+
return React.createElement("div", {
|
2081
|
+
className: classnames(styles$9.TextBlock, _defineProperty({}, styles$9.dummy, props.dummy)),
|
2082
|
+
style: props.style,
|
2083
|
+
dangerouslySetInnerHTML: {
|
2084
|
+
__html: props.children
|
2085
|
+
}
|
2086
|
+
});
|
2087
|
+
}
|
2088
|
+
|
2089
|
+
var css$a = ".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";
|
2090
|
+
var styles$a = {"text-base":"22px","root":"InlineCaption-module_root__1R8Ib"};
|
2091
|
+
styleInject(css$a);
|
2092
|
+
|
2093
|
+
function InlineCaption(props) {
|
2094
|
+
if (props.text) {
|
2095
|
+
return React.createElement("div", {
|
2096
|
+
className: styles$a.root
|
2097
|
+
}, props.text);
|
2098
|
+
} else {
|
2099
|
+
return null;
|
2100
|
+
}
|
2101
|
+
}
|
2102
|
+
|
2103
|
+
var css$b = ".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";
|
2104
|
+
var styles$b = {"root":"InlineImage-module_root__1DvUb","container":"InlineImage-module_container__Pui7E","spacer":"InlineImage-module_spacer__2rMkE","inner":"InlineImage-module_inner__2AMK-"};
|
2105
|
+
styleInject(css$b);
|
2106
|
+
|
2107
|
+
function InlineImage(props) {
|
2108
|
+
return React.createElement("div", {
|
2109
|
+
className: classnames(styles$b.root)
|
2110
|
+
}, React.createElement("div", {
|
2111
|
+
className: styles$b.container
|
2112
|
+
}, React.createElement("div", {
|
2113
|
+
className: styles$b.spacer
|
2114
|
+
}, React.createElement("div", {
|
2115
|
+
className: styles$b.inner
|
2116
|
+
}, React.createElement(Image, props)))), React.createElement(InlineCaption, {
|
2117
|
+
text: props.caption
|
2118
|
+
}));
|
2119
|
+
}
|
2120
|
+
|
2121
|
+
var css$c = ".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";
|
2122
|
+
var styles$c = {"root":"InlineVideo-module_root__2UD3D","inner":"InlineVideo-module_inner__H81_g"};
|
2123
|
+
styleInject(css$c);
|
2124
|
+
|
2125
|
+
function InlineVideo(props) {
|
2126
|
+
var ref = useRef();
|
2127
|
+
var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
|
2128
|
+
return React.createElement("div", {
|
2129
|
+
ref: ref,
|
2130
|
+
className: classnames(styles$c.root)
|
2131
|
+
}, React.createElement("div", {
|
2132
|
+
style: {
|
2133
|
+
paddingTop: props.wideFormat ? '41.15%' : '56.25%'
|
2134
|
+
}
|
2135
|
+
}, React.createElement("div", {
|
2136
|
+
className: styles$c.inner
|
2137
|
+
}, React.createElement(Video, Object.assign({}, props, {
|
2138
|
+
state: onScreen ? 'active' : 'inactive',
|
2139
|
+
interactive: true
|
2140
|
+
})))));
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
var css$d = ".InlineBeforeAfter-module_root__2O9F8 {\n position: relative;\n margin: 0 auto;\n}\n";
|
2144
|
+
var styles$d = {"root":"InlineBeforeAfter-module_root__2O9F8"};
|
2145
|
+
styleInject(css$d);
|
2146
|
+
|
2147
|
+
function InlineBeforeAfter(props) {
|
2148
|
+
var ref = useRef();
|
2149
|
+
var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
|
2150
|
+
return React.createElement("div", {
|
2151
|
+
ref: ref,
|
2152
|
+
className: styles$d.root
|
2153
|
+
}, React.createElement(BeforeAfter, Object.assign({}, props, {
|
2154
|
+
state: onScreen ? 'active' : 'inactive'
|
2155
|
+
})));
|
2156
|
+
}
|
2157
|
+
|
2158
|
+
var css$e = ".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}";
|
2159
|
+
var styles$e = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__1sAiH"};
|
2160
|
+
styleInject(css$e);
|
2161
|
+
|
2162
|
+
function UnmuteButton() {
|
2163
|
+
return React.createElement(MutedContext.Consumer, null, function (mutedSettings) {
|
2164
|
+
return React.createElement("div", {
|
2165
|
+
className: classnames(styles$e.soundDisclaimer),
|
2166
|
+
onClick: function onClick() {
|
2167
|
+
return mutedSettings.setMuted(false);
|
2168
|
+
}
|
2169
|
+
}, 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."));
|
2170
|
+
});
|
2171
|
+
}
|
2172
|
+
|
2173
|
+
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. ';
|
2174
|
+
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.';
|
2175
|
+
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.';
|
2176
|
+
|
2177
|
+
var templates = {
|
2178
|
+
heading: {
|
2179
|
+
name: 'Überschrift',
|
2180
|
+
component: Heading
|
2181
|
+
},
|
2182
|
+
textBlock: {
|
2183
|
+
name: 'Text Block',
|
2184
|
+
component: TextBlock
|
2185
|
+
},
|
2186
|
+
soundDisclaimer: {
|
2187
|
+
name: 'Sound Disclaimer',
|
2188
|
+
component: UnmuteButton
|
2189
|
+
},
|
2190
|
+
loremIpsum1: {
|
2191
|
+
name: 'Blindtext 1',
|
2192
|
+
component: TextBlock,
|
2193
|
+
props: {
|
2194
|
+
children: loremIpsum1
|
2195
|
+
}
|
2196
|
+
},
|
2197
|
+
loremIpsum2: {
|
2198
|
+
name: 'Blindtext 2',
|
2199
|
+
component: TextBlock,
|
2200
|
+
props: {
|
2201
|
+
children: loremIpsum2
|
2202
|
+
}
|
2203
|
+
},
|
2204
|
+
loremIpsum3: {
|
2205
|
+
name: 'Blindtext 3',
|
2206
|
+
component: TextBlock,
|
2207
|
+
props: {
|
2208
|
+
children: loremIpsum3
|
2209
|
+
}
|
2210
|
+
},
|
2211
|
+
inlineImage: {
|
2212
|
+
name: 'Inline Bild',
|
2213
|
+
component: InlineImage,
|
2214
|
+
inlinePositioning: true
|
2215
|
+
},
|
2216
|
+
inlineVideo: {
|
2217
|
+
name: 'Inline Video',
|
2218
|
+
component: InlineVideo,
|
2219
|
+
inlinePositioning: true
|
2220
|
+
},
|
2221
|
+
inlineBeforeAfter: {
|
2222
|
+
name: 'Inline Before/After',
|
2223
|
+
component: InlineBeforeAfter,
|
2224
|
+
inlinePositioning: true
|
2225
|
+
},
|
2226
|
+
stickyImage: {
|
2227
|
+
name: 'Sticky Bild',
|
2228
|
+
component: InlineImage,
|
2229
|
+
inlinePositioning: true
|
2230
|
+
}
|
2231
|
+
};
|
2232
|
+
|
2233
|
+
function ForegroundItem(props) {
|
2234
|
+
var template = templates[props.type];
|
2235
|
+
var Component = template.component;
|
2236
|
+
return React.createElement(Component, Object.assign({}, template.props, props.itemProps));
|
2237
|
+
}
|
2238
|
+
|
2239
|
+
function ForegroundItems(props) {
|
2240
|
+
return React.createElement(React.Fragment, null, props.items.map(function (item, index) {
|
2241
|
+
return props.children(item, React.createElement(ForegroundItem, {
|
2242
|
+
key: index,
|
2243
|
+
type: item.type,
|
2244
|
+
position: item.position,
|
2245
|
+
itemProps: item.props
|
2246
|
+
}));
|
2247
|
+
}));
|
2248
|
+
}
|
2249
|
+
ForegroundItems.defaultProps = {
|
2250
|
+
children: function children(item, child) {
|
2251
|
+
return child;
|
2252
|
+
}
|
2253
|
+
};
|
2254
|
+
|
2255
|
+
var css$f = ".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";
|
2256
|
+
var styles$f = {"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"};
|
2257
|
+
styleInject(css$f);
|
2258
|
+
|
2259
|
+
var availablePositions = ['inline', 'sticky', 'full'];
|
2260
|
+
function TwoColumn(props) {
|
2261
|
+
return React.createElement("div", {
|
2262
|
+
className: classnames(styles$f.root, styles$f[props.align])
|
2263
|
+
}, React.createElement("div", {
|
2264
|
+
className: styles$f.inline,
|
2265
|
+
ref: props.contentAreaRef
|
2266
|
+
}), renderItems(props));
|
2267
|
+
}
|
2268
|
+
TwoColumn.defaultProps = {
|
2269
|
+
align: 'left'
|
2270
|
+
};
|
2271
|
+
|
2272
|
+
function renderItems(props) {
|
2273
|
+
return groupItemsByPosition(props.items).map(function (group, index) {
|
2274
|
+
return React.createElement("div", {
|
2275
|
+
key: index,
|
2276
|
+
className: classnames(styles$f.group, styles$f["group-".concat(group.position)])
|
2277
|
+
}, renderItemGroup(props, group, 'sticky'), renderItemGroup(props, group, 'inline'), renderItemGroup(props, group, 'full'));
|
2278
|
+
});
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
function renderItemGroup(props, group, position) {
|
2282
|
+
if (group[position].length) {
|
2283
|
+
return React.createElement("div", {
|
2284
|
+
className: styles$f[position]
|
2285
|
+
}, props.children(React.createElement(ForegroundItems, {
|
2286
|
+
items: group[position]
|
2287
|
+
})));
|
2288
|
+
}
|
2289
|
+
}
|
2290
|
+
|
2291
|
+
function groupItemsByPosition(items) {
|
2292
|
+
var groups = [];
|
2293
|
+
var currentGroup;
|
2294
|
+
items.reduce(function (previousItemPosition, item, index) {
|
2295
|
+
var position = availablePositions.indexOf(item.position) >= 0 ? item.position : 'inline';
|
2296
|
+
|
2297
|
+
if (!previousItemPosition || previousItemPosition !== position && (previousItemPosition !== 'sticky' || position !== 'inline')) {
|
2298
|
+
currentGroup = {
|
2299
|
+
position: position,
|
2300
|
+
sticky: [],
|
2301
|
+
inline: [],
|
2302
|
+
full: []
|
2303
|
+
};
|
2304
|
+
groups = [].concat(_toConsumableArray(groups), [currentGroup]);
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
currentGroup[position].push(item);
|
2308
|
+
return position;
|
2309
|
+
}, null);
|
2310
|
+
return groups;
|
2311
|
+
}
|
2312
|
+
|
2313
|
+
var css$g = ".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";
|
2314
|
+
var styles$g = {"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"};
|
2315
|
+
styleInject(css$g);
|
2316
|
+
|
2317
|
+
function Center(props) {
|
2318
|
+
return React.createElement("div", {
|
2319
|
+
className: classnames(styles$g.root)
|
2320
|
+
}, React.createElement("div", {
|
2321
|
+
ref: props.contentAreaRef
|
2322
|
+
}), React.createElement(ForegroundItems, {
|
2323
|
+
items: props.items
|
2324
|
+
}, function (item, child) {
|
2325
|
+
return React.createElement("div", {
|
2326
|
+
key: item.index,
|
2327
|
+
className: classnames(styles$g.outer, styles$g["outer-".concat(item.position)])
|
2328
|
+
}, React.createElement("div", {
|
2329
|
+
className: classnames(styles$g.item, styles$g["item-".concat(item.position)])
|
2330
|
+
}, props.children(React.createElement("div", {
|
2331
|
+
className: styles$g["inner-".concat(item.position)]
|
2332
|
+
}, child))));
|
2333
|
+
}));
|
2334
|
+
}
|
2335
|
+
|
2336
|
+
function Layout(props) {
|
2337
|
+
if (props.layout === 'center') {
|
2338
|
+
return React.createElement(Center, props);
|
2339
|
+
} else if (props.layout === 'right') {
|
2340
|
+
return React.createElement(TwoColumn, Object.assign({
|
2341
|
+
align: "right"
|
2342
|
+
}, props));
|
2343
|
+
} else {
|
2344
|
+
return React.createElement(TwoColumn, props);
|
2345
|
+
}
|
2346
|
+
}
|
2347
|
+
Layout.defaultProps = {
|
2348
|
+
layout: 'left'
|
2349
|
+
};
|
2350
|
+
|
2351
|
+
function isIntersectingX(rectA, rectB) {
|
2352
|
+
return rectA.left < rectB.right && rectA.right > rectB.left || rectB.left < rectA.right && rectB.right > rectA.left;
|
2353
|
+
}
|
2354
|
+
|
2355
|
+
function getBoundingClientRect(el) {
|
2356
|
+
if (!el) {
|
2357
|
+
return {
|
2358
|
+
left: 0,
|
2359
|
+
right: 0,
|
2360
|
+
top: 0,
|
2361
|
+
bottom: 0,
|
2362
|
+
width: 0,
|
2363
|
+
height: 0
|
2364
|
+
};
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
return el.getBoundingClientRect();
|
2368
|
+
}
|
2369
|
+
|
2370
|
+
function useBoundingClientRect() {
|
2371
|
+
var _useState = useState(getBoundingClientRect(null)),
|
2372
|
+
_useState2 = _slicedToArray(_useState, 2),
|
2373
|
+
boundingClientRect = _useState2[0],
|
2374
|
+
setBoundingClientRect = _useState2[1];
|
2375
|
+
|
2376
|
+
var _useState3 = useState(null),
|
2377
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
2378
|
+
currentNode = _useState4[0],
|
2379
|
+
setCurrentNode = _useState4[1];
|
2380
|
+
|
2381
|
+
var measureRef = useCallback(function (node) {
|
2382
|
+
setCurrentNode(node);
|
2383
|
+
setBoundingClientRect(getBoundingClientRect(node));
|
2384
|
+
}, []);
|
2385
|
+
useEffect(function () {
|
2386
|
+
function handler() {
|
2387
|
+
setBoundingClientRect(getBoundingClientRect(currentNode));
|
2388
|
+
}
|
2389
|
+
|
2390
|
+
if (!currentNode) {
|
2391
|
+
return;
|
2392
|
+
}
|
2393
|
+
|
2394
|
+
window.addEventListener('resize', handler);
|
2395
|
+
window.addEventListener('scroll', handler);
|
2396
|
+
return function () {
|
2397
|
+
window.removeEventListener('resize', handler);
|
2398
|
+
window.removeEventListener('scroll', handler);
|
2399
|
+
};
|
2400
|
+
}, [currentNode]);
|
2401
|
+
return [boundingClientRect, measureRef];
|
2402
|
+
}
|
2403
|
+
|
2404
|
+
function useScrollTarget(ref, isScrollTarget) {
|
2405
|
+
useEffect(function () {
|
2406
|
+
if (ref.current && isScrollTarget) {
|
2407
|
+
window.scrollTo({
|
2408
|
+
top: ref.current.getBoundingClientRect().top + window.scrollY - window.innerHeight * 0.25,
|
2409
|
+
behavior: 'smooth'
|
2410
|
+
});
|
2411
|
+
}
|
2412
|
+
}, [ref, isScrollTarget]);
|
2413
|
+
}
|
2414
|
+
|
2415
|
+
var css$h = ".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";
|
2416
|
+
var styles$h = {"Section":"Section-module_Section__Yo58b","invert":"Section-module_invert__3_p7F","activityProbe":"Section-module_activityProbe__Fsklh"};
|
2417
|
+
styleInject(css$h);
|
2418
|
+
|
2419
|
+
var css$i = "\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";
|
2420
|
+
var fadeInBgConceal = {"fade-duration":"0.5s","backdrop":"fadeInBgConceal-module_backdrop__11JGO","backdropInner":"fadeInBgConceal-module_backdropInner__1IAYD","backdrop-below":"fadeInBgConceal-module_backdrop-below__3E6Uk"};
|
2421
|
+
styleInject(css$i);
|
2422
|
+
|
2423
|
+
var css$j = "\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";
|
2424
|
+
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"};
|
2425
|
+
styleInject(css$j);
|
2426
|
+
|
2427
|
+
var css$k = "\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";
|
2428
|
+
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"};
|
2429
|
+
styleInject(css$k);
|
2430
|
+
|
2431
|
+
var css$l = "\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";
|
2432
|
+
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"};
|
2433
|
+
styleInject(css$l);
|
2434
|
+
|
2435
|
+
var css$m = "\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";
|
2436
|
+
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"};
|
2437
|
+
styleInject(css$m);
|
2438
|
+
|
2439
|
+
var css$n = "\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";
|
2440
|
+
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"};
|
2441
|
+
styleInject(css$n);
|
2442
|
+
|
2443
|
+
var css$o = "\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";
|
2444
|
+
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"};
|
2445
|
+
styleInject(css$o);
|
2446
|
+
|
2447
|
+
var css$p = "\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";
|
2448
|
+
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"};
|
2449
|
+
styleInject(css$p);
|
2450
|
+
|
2451
|
+
var css$q = ".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";
|
2452
|
+
var revealConceal = {"backdrop":"revealConceal-module_backdrop__dLUhU","backdropInner":"revealConceal-module_backdropInner__2k1Z-"};
|
2453
|
+
styleInject(css$q);
|
2454
|
+
|
2455
|
+
var css$r = "\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";
|
2456
|
+
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"};
|
2457
|
+
styleInject(css$r);
|
2458
|
+
|
2459
|
+
var css$s = "\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";
|
2460
|
+
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"};
|
2461
|
+
styleInject(css$s);
|
2462
|
+
|
2463
|
+
var css$t = ".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";
|
2464
|
+
var revealScrollOut = {"backdrop":"revealScrollOut-module_backdrop__2yOXd","backdropInner":"revealScrollOut-module_backdropInner__211p3","backdropInner2":"revealScrollOut-module_backdropInner2__v6WqM","foreground":"revealScrollOut-module_foreground__3z-hw"};
|
2465
|
+
styleInject(css$t);
|
2466
|
+
|
2467
|
+
var css$u = ".scrollInConceal-module_backdrop__2OJJC {\n position: sticky;\n top: 0;\n height: 0;\n}\n";
|
2468
|
+
var scrollInConceal = {"backdrop":"scrollInConceal-module_backdrop__2OJJC"};
|
2469
|
+
styleInject(css$u);
|
2470
|
+
|
2471
|
+
var css$v = "\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";
|
2472
|
+
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"};
|
2473
|
+
styleInject(css$v);
|
2474
|
+
|
2475
|
+
var css$w = "\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";
|
2476
|
+
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"};
|
2477
|
+
styleInject(css$w);
|
2478
|
+
|
2479
|
+
var css$x = ".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";
|
2480
|
+
var scrollInScrollOut = {"backdrop":"scrollInScrollOut-module_backdrop__XzCge","foreground":"scrollInScrollOut-module_foreground__1yyY8"};
|
2481
|
+
styleInject(css$x);
|
2482
|
+
|
2483
|
+
var css$y = ".previewScrollOut-module_scene__W9bDl {\n height: 100%;\n}\n\n.previewScrollOut-module_backdrop__2-Bl_ {\n position: absolute;\n top: 0;\n}\n";
|
2484
|
+
var previewScrollOut = {"scene":"previewScrollOut-module_scene__W9bDl","backdrop":"previewScrollOut-module_backdrop__2-Bl_"};
|
2485
|
+
styleInject(css$y);
|
2486
|
+
|
2487
|
+
var styles$i = {
|
2488
|
+
fadeInBgConceal: fadeInBgConceal,
|
2489
|
+
fadeInBgFadeOut: fadeInBgFadeOut,
|
2490
|
+
fadeInBgFadeOutBg: fadeInBgFadeOutBg,
|
2491
|
+
fadeInBgScrollOut: fadeInBgScrollOut,
|
2492
|
+
fadeInConceal: fadeInConceal,
|
2493
|
+
fadeInFadeOut: fadeInFadeOut,
|
2494
|
+
fadeInFadeOutBg: fadeInFadeOutBg,
|
2495
|
+
fadeInScrollOut: fadeInScrollOut,
|
2496
|
+
revealConceal: revealConceal,
|
2497
|
+
revealFadeOut: revealFadeOut,
|
2498
|
+
revealFadeOutBg: revealFadeOutBg,
|
2499
|
+
revealScrollOut: revealScrollOut,
|
2500
|
+
scrollInConceal: scrollInConceal,
|
2501
|
+
scrollInFadeOut: scrollInFadeOut,
|
2502
|
+
scrollInFadeOutBg: scrollInFadeOutBg,
|
2503
|
+
scrollInScrollOut: scrollInScrollOut,
|
2504
|
+
previewScrollOut: previewScrollOut
|
2505
|
+
};
|
2506
|
+
var enterTransitions = {
|
2507
|
+
fade: 'fadeIn',
|
2508
|
+
fadeBg: 'fadeInBg',
|
2509
|
+
scroll: 'scrollIn',
|
2510
|
+
scrollOver: 'scrollIn',
|
2511
|
+
reveal: 'reveal',
|
2512
|
+
beforeAfter: 'reveal',
|
2513
|
+
preview: 'preview'
|
2514
|
+
};
|
2515
|
+
var exitTransitions = {
|
2516
|
+
fade: 'fadeOut',
|
2517
|
+
fadeBg: 'fadeOutBg',
|
2518
|
+
scroll: 'scrollOut',
|
2519
|
+
scrollOver: 'conceal',
|
2520
|
+
reveal: 'scrollOut',
|
2521
|
+
beforeAfter: 'conceal'
|
2522
|
+
};
|
2523
|
+
function getTransitionStyles(section, previousSection, nextSection) {
|
2524
|
+
var enterTransition = enterTransitions[section.transition];
|
2525
|
+
var exitTransition = exitTransitions[nextSection ? nextSection.transition : 'scroll'];
|
2526
|
+
var name = "".concat(enterTransition).concat(capitalize(exitTransition));
|
2527
|
+
|
2528
|
+
if (!styles$i[name]) {
|
2529
|
+
throw new Error("Unknown transition ".concat(name));
|
2530
|
+
}
|
2531
|
+
|
2532
|
+
return styles$i[name];
|
2533
|
+
}
|
2534
|
+
|
2535
|
+
function capitalize(string) {
|
2536
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
2537
|
+
}
|
2538
|
+
|
2539
|
+
function NoOpShadow(props) {
|
2540
|
+
return React.createElement("div", null, props.children);
|
2541
|
+
}
|
2542
|
+
|
2543
|
+
var css$z = ".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";
|
2544
|
+
var styles$j = {"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"};
|
2545
|
+
styleInject(css$z);
|
2546
|
+
|
2547
|
+
function GradientShadow(props) {
|
2548
|
+
var maxOpacityOverlap = props.motifAreaRect.height / 2;
|
2549
|
+
var motifAreaOverlap = Math.min(maxOpacityOverlap, props.motifAreaRect.bottom - props.contentAreaRect.top);
|
2550
|
+
var opacityFactor = props.intersecting && props.motifAreaRect.height > 0 ? motifAreaOverlap / maxOpacityOverlap : 1;
|
2551
|
+
return React.createElement("div", {
|
2552
|
+
className: classnames(styles$j.root, styles$j["align-".concat(props.align)], _defineProperty({}, styles$j.intersecting, props.intersecting))
|
2553
|
+
}, React.createElement("div", {
|
2554
|
+
className: styles$j.shadow,
|
2555
|
+
style: {
|
2556
|
+
opacity: props.opacity * Math.round(opacityFactor * 10) / 10
|
2557
|
+
}
|
2558
|
+
}), props.children);
|
2559
|
+
}
|
2560
|
+
GradientShadow.defaultProps = {
|
2561
|
+
opacity: 0.7,
|
2562
|
+
align: 'left'
|
2563
|
+
};
|
2564
|
+
|
2565
|
+
function NoOpBoxWrapper(props) {
|
2566
|
+
return React.createElement("div", null, props.children);
|
2567
|
+
}
|
2568
|
+
|
2569
|
+
var css$A = ".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";
|
2570
|
+
var styles$k = {"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"};
|
2571
|
+
styleInject(css$A);
|
2572
|
+
|
2573
|
+
function GradientBox(props) {
|
2574
|
+
var _classNames;
|
2575
|
+
|
2576
|
+
var padding = props.active ? props.padding : 0;
|
2577
|
+
return React.createElement("div", {
|
2578
|
+
className: classnames(styles$k.root, (_classNames = {}, _defineProperty(_classNames, styles$k.gradient, padding > 0), _defineProperty(_classNames, styles$k["long"], props.coverInvisibleNextSection), _classNames)),
|
2579
|
+
style: {
|
2580
|
+
paddingTop: padding
|
2581
|
+
}
|
2582
|
+
}, React.createElement("div", {
|
2583
|
+
className: styles$k.wrapper
|
2584
|
+
}, React.createElement("div", {
|
2585
|
+
className: classnames(styles$k.shadow, props.transitionStyles.boxShadow, props.transitionStyles["boxShadow-".concat(props.state)]),
|
2586
|
+
style: {
|
2587
|
+
top: padding,
|
2588
|
+
opacity: props.opacity
|
2589
|
+
}
|
2590
|
+
}), React.createElement("div", {
|
2591
|
+
className: styles$k.content
|
2592
|
+
}, props.children)));
|
2593
|
+
}
|
2594
|
+
GradientBox.defaultProps = {
|
2595
|
+
opacity: 1
|
2596
|
+
};
|
2597
|
+
|
2598
|
+
var css$B = ".CardBox-module_wrapper__3vnaH {\n}\n\n.CardBox-module_content__36v7J {\n position: relative;\n}\n";
|
2599
|
+
var styles$l = {"wrapper":"CardBox-module_wrapper__3vnaH","content":"CardBox-module_content__36v7J"};
|
2600
|
+
styleInject(css$B);
|
2601
|
+
|
2602
|
+
function CardBox(props) {
|
2603
|
+
var padding = props.active ? props.padding : 0;
|
2604
|
+
return React.createElement("div", {
|
2605
|
+
style: {
|
2606
|
+
paddingTop: padding
|
2607
|
+
}
|
2608
|
+
}, React.createElement("div", {
|
2609
|
+
className: styles$l.wrapper
|
2610
|
+
}, React.createElement("div", {
|
2611
|
+
style: {
|
2612
|
+
top: padding
|
2613
|
+
}
|
2614
|
+
}), React.createElement("div", {
|
2615
|
+
className: styles$l.content
|
2616
|
+
}, props.children)));
|
2617
|
+
}
|
2618
|
+
|
2619
|
+
var css$C = ".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";
|
2620
|
+
var styles$m = {"cardBg":"CardBoxWrapper-module_cardBg__154o2"};
|
2621
|
+
styleInject(css$C);
|
2622
|
+
|
2623
|
+
function CardBoxWrapper(props) {
|
2624
|
+
return React.createElement("div", {
|
2625
|
+
className: styles$m.cardBg
|
2626
|
+
}, props.children);
|
2627
|
+
}
|
2628
|
+
|
2629
|
+
function ownKeys$6(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; }
|
2630
|
+
|
2631
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2632
|
+
var OnScreenContext = React.createContext({
|
2633
|
+
center: false,
|
2634
|
+
top: false,
|
2635
|
+
bottom: false
|
2636
|
+
});
|
2637
|
+
function Section$1(props) {
|
2638
|
+
var activityProbeRef = useRef();
|
2639
|
+
useOnScreen(activityProbeRef, '-50% 0px -50% 0px', props.onActivate);
|
2640
|
+
var ref = useRef();
|
2641
|
+
var onScreen = useOnScreen(ref, '0px 0px 0px 0px');
|
2642
|
+
useScrollTarget(ref, props.isScrollTarget);
|
2643
|
+
|
2644
|
+
var _useBoundingClientRec = useBoundingClientRect(),
|
2645
|
+
_useBoundingClientRec2 = _slicedToArray(_useBoundingClientRec, 2),
|
2646
|
+
motifAreaRect = _useBoundingClientRec2[0],
|
2647
|
+
setMotifAreaRectRect = _useBoundingClientRec2[1];
|
2648
|
+
|
2649
|
+
var _useDimension = useDimension(),
|
2650
|
+
_useDimension2 = _slicedToArray(_useDimension, 2),
|
2651
|
+
motifAreaDimension = _useDimension2[0],
|
2652
|
+
setMotifAreaDimensionRef = _useDimension2[1];
|
2653
|
+
|
2654
|
+
var setMotifAreaRefs = useCallback(function (node) {
|
2655
|
+
setMotifAreaRectRect(node);
|
2656
|
+
setMotifAreaDimensionRef(node);
|
2657
|
+
}, [setMotifAreaRectRect, setMotifAreaDimensionRef]);
|
2658
|
+
|
2659
|
+
var _useBoundingClientRec3 = useBoundingClientRect(props.layout),
|
2660
|
+
_useBoundingClientRec4 = _slicedToArray(_useBoundingClientRec3, 2),
|
2661
|
+
contentAreaRect = _useBoundingClientRec4[0],
|
2662
|
+
setContentAreaRef = _useBoundingClientRec4[1];
|
2663
|
+
|
2664
|
+
var intersecting = isIntersectingX(motifAreaRect, contentAreaRect);
|
2665
|
+
var heightOffset = 0; //(props.backdrop.first || props.transition === 'scrollOver') ? 0 : (window.innerHeight / 3);
|
2666
|
+
|
2667
|
+
var transitionStyles = getTransitionStyles(props, props.previousSection, props.nextSection);
|
2668
|
+
var appearance = {
|
2669
|
+
shadow: {
|
2670
|
+
background: GradientShadow,
|
2671
|
+
foreground: GradientBox,
|
2672
|
+
foregroundWrapper: NoOpBoxWrapper
|
2673
|
+
},
|
2674
|
+
transparent: {
|
2675
|
+
background: NoOpShadow,
|
2676
|
+
foreground: CardBox,
|
2677
|
+
foregroundWrapper: NoOpBoxWrapper
|
2678
|
+
},
|
2679
|
+
cards: {
|
2680
|
+
background: NoOpShadow,
|
2681
|
+
foreground: CardBox,
|
2682
|
+
foregroundWrapper: CardBoxWrapper
|
2683
|
+
}
|
2684
|
+
}[props.appearance || 'shadow'];
|
2685
|
+
var Shadow = appearance.background;
|
2686
|
+
var Box = appearance.foreground;
|
2687
|
+
var BoxWrapper = appearance.foregroundWrapper;
|
2688
|
+
return React.createElement("section", {
|
2689
|
+
id: "section-".concat(props.permaId),
|
2690
|
+
ref: ref,
|
2691
|
+
className: classnames(styles$h.Section, transitionStyles.section, _defineProperty({}, styles$h.invert, props.invert))
|
2692
|
+
}, React.createElement("div", {
|
2693
|
+
ref: activityProbeRef,
|
2694
|
+
className: styles$h.activityProbe
|
2695
|
+
}), React.createElement(Backdrop, Object.assign({}, props.backdrop, {
|
2696
|
+
motifAreaRef: setMotifAreaRefs,
|
2697
|
+
onScreen: onScreen,
|
2698
|
+
offset: Math.max(0, Math.max(1, -contentAreaRect.top / 200)),
|
2699
|
+
state: props.state,
|
2700
|
+
transitionStyles: transitionStyles,
|
2701
|
+
nextSectionOnEnd: props.nextSectionOnEnd,
|
2702
|
+
interactive: props.interactiveBackdrop
|
2703
|
+
}), function (children) {
|
2704
|
+
return props.interactiveBackdrop ? children : React.createElement(Shadow, {
|
2705
|
+
align: props.layout,
|
2706
|
+
intersecting: intersecting,
|
2707
|
+
opacity: props.shadowOpacity >= 0 ? props.shadowOpacity / 100 : 0.7,
|
2708
|
+
motifAreaRect: motifAreaRect,
|
2709
|
+
contentAreaRect: contentAreaRect
|
2710
|
+
}, children);
|
2711
|
+
}), React.createElement(Foreground, {
|
2712
|
+
transitionStyles: transitionStyles,
|
2713
|
+
hidden: props.interactiveBackdrop,
|
2714
|
+
disableEnlarge: props.disableEnlarge,
|
2715
|
+
state: props.state,
|
2716
|
+
heightMode: heightMode(props)
|
2717
|
+
}, React.createElement(Box, {
|
2718
|
+
active: intersecting,
|
2719
|
+
coverInvisibleNextSection: props.nextSection && props.nextSection.transition.startsWith('fade'),
|
2720
|
+
transitionStyles: transitionStyles,
|
2721
|
+
state: props.state,
|
2722
|
+
padding: Math.max(0, motifAreaDimension.top + motifAreaDimension.height - heightOffset),
|
2723
|
+
opacity: props.shadowOpacity
|
2724
|
+
}, React.createElement(Layout, {
|
2725
|
+
items: indexItems(props.foreground),
|
2726
|
+
appearance: props.appearance,
|
2727
|
+
contentAreaRef: setContentAreaRef,
|
2728
|
+
layout: props.layout
|
2729
|
+
}, function (children) {
|
2730
|
+
return React.createElement(BoxWrapper, null, children);
|
2731
|
+
}))));
|
2732
|
+
}
|
2733
|
+
|
2734
|
+
function indexItems(items) {
|
2735
|
+
return items.map(function (item, index) {
|
2736
|
+
return _objectSpread$6({}, item, {
|
2737
|
+
index: index
|
2738
|
+
});
|
2739
|
+
});
|
2740
|
+
}
|
2741
|
+
|
2742
|
+
function heightMode(props) {
|
2743
|
+
if (props.fullHeight) {
|
2744
|
+
if (props.transition.startsWith('fade') || props.nextSection && props.nextSection.transition.startsWith('fade')) {
|
2745
|
+
return 'fullFade';
|
2746
|
+
} else {
|
2747
|
+
return 'full';
|
2748
|
+
}
|
2749
|
+
}
|
2750
|
+
|
2751
|
+
return 'dynamic';
|
2752
|
+
}
|
2753
|
+
|
2754
|
+
var css$D = "\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";
|
2755
|
+
var entryStyles = {"font-sans":"'Source Sans Pro', sans-serif","Entry":"Entry-module_Entry__1nDGh","exampleSelect":"Entry-module_exampleSelect__1uAJs"};
|
2756
|
+
styleInject(css$D);
|
2757
|
+
|
2758
|
+
var css$E = ".SectionThumbnail-module_root__16zjY {\n padding-top: 50%;\n position: relative;\n border: solid 1px #888;\n}\n\n.SectionThumbnail-module_crop__Q1nZj {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.SectionThumbnail-module_scale__2tKDG {\n transform: scale(0.2);\n transform-origin: 0 0;\n width: 500%;\n}\n";
|
2759
|
+
var styles$n = {"root":"SectionThumbnail-module_root__16zjY","crop":"SectionThumbnail-module_crop__Q1nZj","scale":"SectionThumbnail-module_scale__2tKDG"};
|
2760
|
+
styleInject(css$E);
|
2761
|
+
|
2762
|
+
function SectionThumbnail(_ref) {
|
2763
|
+
var seed = _ref.seed,
|
2764
|
+
props = _objectWithoutProperties(_ref, ["seed"]);
|
2765
|
+
|
2766
|
+
return React.createElement(EntryStateProvider, {
|
2767
|
+
seed: seed
|
2768
|
+
}, React.createElement(Inner, props));
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
function Inner(_ref2) {
|
2772
|
+
var sectionPermaId = _ref2.sectionPermaId,
|
2773
|
+
subscribe = _ref2.subscribe;
|
2774
|
+
var dispatch = useEntryStateDispatch();
|
2775
|
+
useEffect(function () {
|
2776
|
+
return subscribe(dispatch);
|
2777
|
+
}, [subscribe, dispatch]);
|
2778
|
+
var section = useSectionStructure({
|
2779
|
+
sectionPermaId: sectionPermaId
|
2780
|
+
});
|
2781
|
+
|
2782
|
+
if (section) {
|
2783
|
+
return React.createElement("div", {
|
2784
|
+
className: styles$n.root
|
2785
|
+
}, React.createElement("div", {
|
2786
|
+
className: styles$n.crop
|
2787
|
+
}, React.createElement("div", {
|
2788
|
+
className: styles$n.scale
|
2789
|
+
}, React.createElement("div", {
|
2790
|
+
className: entryStyles.Entry
|
2791
|
+
}, React.createElement(Section$1, Object.assign({
|
2792
|
+
state: "active"
|
2793
|
+
}, section, {
|
2794
|
+
transition: "preview"
|
2795
|
+
}))))));
|
2796
|
+
} else {
|
2797
|
+
return React.createElement("div", {
|
2798
|
+
className: styles$n.root
|
2799
|
+
}, "Not found.");
|
2800
|
+
}
|
2801
|
+
}
|
2802
|
+
|
2803
|
+
Inner.defaultProps = {
|
2804
|
+
subscribe: function subscribe() {}
|
2805
|
+
};
|
2806
|
+
|
2807
|
+
var css$F = ".icons-module_icon__16IVx::before {\n font-family: \"entypo\";\n}.icons-module_arrowsCcw__3_nrJ,\n.icons-module_attention__1sssG,\n.icons-module_plusCircled__20FlJ,\n.icons-module_rightOpen__9vsOG,\n.icons-module_trash__DH1EH {\n}.icons-module_arrowsCcw__3_nrJ::before {\n content: \"\\1F504\";\n}.icons-module_attention__1sssG::before {\n content: \"\\26A0\";\n}.icons-module_plusCircled__20FlJ::before {\n content: \"\\2795\";\n}.icons-module_rightOpen__9vsOG::before {\n content: \"\\E75E\"\n}.icons-module_trash__DH1EH::before {\n content: \"\\E729\";\n}@keyframes animations-module_blink__32C5j {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.3;\n }\n 100% {\n opacity: 1;\n }\n}.animations-module_blink__32C5j {\n animation: animations-module_blink__32C5j 1.5s ease infinite;\n}.outline-module_indicator__2dw_X {\n display: none;\n position: absolute;\n right: 14px;\n top: 7px;\n width: 30px;\n height: 30px;\n font-size: 19px;\n color: #888;\n}.outline-module_creatingIndicator__3O7Rw {\n}.outline-module_destroyingIndicator__2-mKh {\n}.outline-module_failedIndicator__2QK1F {\n color: #d00;\n}\n\n.SectionItemView-module_root__1Pp0d {\n position: relative;\n border: solid 3px transparent;\n padding: 3px 3px 0 3px;\n margin-bottom: 4px;\n max-width: 270px;\n text-align: right;\n background-color: #eee;\n}\n\n.SectionItemView-module_active__1tLN5 {\n border: solid 3px #1c86fe;\n}\n\n.SectionItemView-module_thumbnailContainer__1Xe7C {\n position: relative;\n}\n\n.SectionItemView-module_thumbnail__1ecBT {}\n\n.SectionItemView-module_clickMask__2JYEH {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n cursor: pointer;\n}\n\n.SectionItemView-module_editLink__2mHqk {\n display: inline-block;\n position: relative;\n width: 30px;\n height: 25px;\n}\n\n.SectionItemView-module_editLink__2mHqk::before {\n font-family: 'entypo';\n content: \"\\270E\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: #555;\n font-size: 15px;\n}\n\n.SectionItemView-module_creating__3Pjx9 .SectionItemView-module_creatingIndicator__1GnKq { display: block; }\n.SectionItemView-module_destroying__1m53s .SectionItemView-module_destroyingIndicator__HtKWF { display: block; }\n.SectionItemView-module_failed__1CR2R .SectionItemView-module_failedIndicator__1HVHn { display: block; }\n\n.SectionItemView-module_creatingIndicator__1GnKq { }\n.SectionItemView-module_destroyingIndicator__HtKWF { }\n.SectionItemView-module_failedIndicator__1HVHn { }\n";
|
2808
|
+
var styles$o = {"selectionColor":"#1c86fe","selectionWidth":"3px","root":"SectionItemView-module_root__1Pp0d","active":"SectionItemView-module_active__1tLN5","thumbnailContainer":"SectionItemView-module_thumbnailContainer__1Xe7C","thumbnail":"SectionItemView-module_thumbnail__1ecBT","clickMask":"SectionItemView-module_clickMask__2JYEH","editLink":"SectionItemView-module_editLink__2mHqk","creating":"SectionItemView-module_creating__3Pjx9","creatingIndicator":"SectionItemView-module_creatingIndicator__1GnKq outline-module_creatingIndicator__3O7Rw outline-module_indicator__2dw_X icons-module_arrowsCcw__3_nrJ icons-module_icon__16IVx animations-module_blink__32C5j","destroying":"SectionItemView-module_destroying__1m53s","destroyingIndicator":"SectionItemView-module_destroyingIndicator__HtKWF outline-module_destroyingIndicator__2-mKh outline-module_indicator__2dw_X icons-module_trash__DH1EH icons-module_icon__16IVx animations-module_blink__32C5j","failed":"SectionItemView-module_failed__1CR2R","failedIndicator":"SectionItemView-module_failedIndicator__1HVHn outline-module_failedIndicator__2QK1F outline-module_indicator__2dw_X icons-module_attention__1sssG icons-module_icon__16IVx"};
|
2809
|
+
styleInject(css$F);
|
2810
|
+
|
2811
|
+
var _events;
|
2812
|
+
var SectionItemView = Marionette.ItemView.extend({
|
2813
|
+
tagName: 'li',
|
2814
|
+
className: styles$o.root,
|
2815
|
+
mixins: [modelLifecycleTrackingView({
|
2816
|
+
classNames: styles$o
|
2817
|
+
})],
|
2818
|
+
template: function template(data) {
|
2819
|
+
return "\n <div class=\"".concat(styles$o.thumbnailContainer, "\">\n <div class=\"").concat(styles$o.thumbnail, "\"></div>\n <div class=\"").concat(styles$o.clickMask, "\"></div>\n </div>\n <span class=\"").concat(styles$o.creatingIndicator, "\" />\n <span class=\"").concat(styles$o.destroyingIndicator, "\" />\n <span class=\"").concat(styles$o.failedIndicator, "\"\n title=\"").concat(I18n.t('pageflow_scrolled.editor.section_item.save_error'), "\" />\n <a href=\"\" class=\"").concat(styles$o.editLink, "\" title=\"").concat(I18n.t('pageflow_scrolled.editor.section_item.edit'), "\"></a>\n ");
|
2820
|
+
},
|
2821
|
+
ui: cssModulesUtils.ui(styles$o, 'thumbnail'),
|
2822
|
+
events: (_events = {}, _defineProperty(_events, "click .".concat(styles$o.clickMask), function click() {
|
2823
|
+
this.options.entry.trigger('scrollToSection', this.model);
|
2824
|
+
}), _defineProperty(_events, "click .".concat(styles$o.editLink), function click() {
|
2825
|
+
if (!this.model.isNew() && !this.model.isDestroying()) {
|
2826
|
+
this.options.entry.trigger('scrollToSection', this.model);
|
2827
|
+
editor.navigate("/scrolled/sections/".concat(this.model.id), {
|
2828
|
+
trigger: true
|
2829
|
+
});
|
2830
|
+
}
|
2831
|
+
|
2832
|
+
return false;
|
2833
|
+
}), _events),
|
2834
|
+
initialize: function initialize() {
|
2835
|
+
var _this = this;
|
2836
|
+
|
2837
|
+
this.listenTo(this.options.entry, 'change:currentSectionIndex', function () {
|
2838
|
+
var active = _this.options.entry.sections.indexOf(_this.model) === _this.options.entry.get('currentSectionIndex');
|
2839
|
+
|
2840
|
+
_this.$el.toggleClass(styles$o.active, active);
|
2841
|
+
|
2842
|
+
if (active) {
|
2843
|
+
_this.$el[0].scrollIntoView({
|
2844
|
+
block: 'nearest',
|
2845
|
+
behavior: 'smooth'
|
2846
|
+
});
|
2847
|
+
}
|
2848
|
+
});
|
2849
|
+
},
|
2850
|
+
onRender: function onRender() {
|
2851
|
+
var _this2 = this;
|
2852
|
+
|
2853
|
+
ReactDOM.render(React.createElement(SectionThumbnail, {
|
2854
|
+
sectionPermaId: this.model.get('permaId'),
|
2855
|
+
seed: this.options.entry.scrolledSeed,
|
2856
|
+
subscribe: function subscribe(dispatch) {
|
2857
|
+
return watchCollections(_this2.options.entry, {
|
2858
|
+
dispatch: dispatch
|
2859
|
+
});
|
2860
|
+
}
|
2861
|
+
}), this.ui.thumbnail[0]);
|
2862
|
+
}
|
2863
|
+
});
|
2864
|
+
|
2865
|
+
var css$G = ".icons-module_icon__16IVx::before {\n font-family: \"entypo\";\n}.icons-module_arrowsCcw__3_nrJ,\n.icons-module_attention__1sssG,\n.icons-module_plusCircled__20FlJ,\n.icons-module_rightOpen__9vsOG,\n.icons-module_trash__DH1EH {\n}.icons-module_arrowsCcw__3_nrJ::before {\n content: \"\\1F504\";\n}.icons-module_attention__1sssG::before {\n content: \"\\26A0\";\n}.icons-module_plusCircled__20FlJ::before {\n content: \"\\2795\";\n}.icons-module_rightOpen__9vsOG::before {\n content: \"\\E75E\"\n}.icons-module_trash__DH1EH::before {\n content: \"\\E729\";\n}@keyframes animations-module_blink__32C5j {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.3;\n }\n 100% {\n opacity: 1;\n }\n}.animations-module_blink__32C5j {\n animation: animations-module_blink__32C5j 1.5s ease infinite;\n}.outline-module_indicator__2dw_X {\n display: none;\n position: absolute;\n right: 14px;\n top: 7px;\n width: 30px;\n height: 30px;\n font-size: 19px;\n color: #888;\n}.outline-module_creatingIndicator__3O7Rw {\n}.outline-module_destroyingIndicator__2-mKh {\n}.outline-module_failedIndicator__2QK1F {\n color: #d00;\n}.buttons-module_iconButton__3ZSFV {\n /* see app/assets/stylesheets/pageflow/editor/composable.scss */\n}.buttons-module_addButton__2pN-g {\n}\n\n.ChapterItemView-module_root__19GIF {\n background-color: #fff;\n margin-bottom: 10px;\n padding: 0 10px 10px 10px;\n}\n\n.ChapterItemView-module_link__2dj_z {\n display: block;\n position: relative;\n margin: 0 -10px 0 -10px;\n padding: 10px 10px 10px 30px;\n background-color: #efefef;\n}\n\n.ChapterItemView-module_link__2dj_z::before {\n position: absolute;\n right: 7px;\n top: 7px;\n font-size: 19px;\n color: #888;\n}\n\n.ChapterItemView-module_number__1GjyC {\n font-weight: bold;\n}\n\n.ChapterItemView-module_title__3jVXE {}\n\n.ChapterItemView-module_sections__3zg2a {\n margin: 10px 0 10px 0;\n min-height: 20px;\n}\n\n.ChapterItemView-module_creating__c1q2b .ChapterItemView-module_creatingIndicator__2zOEN { display: block; }\n.ChapterItemView-module_destroying__2PP1l .ChapterItemView-module_destroyingIndicator__2YZaB { display: block; }\n.ChapterItemView-module_failed__2MtQW .ChapterItemView-module_failedIndicator__2s6Xk { display: block; }\n\n\n.ChapterItemView-module_creatingIndicator__2zOEN { }\n.ChapterItemView-module_destroyingIndicator__2YZaB { }\n.ChapterItemView-module_failedIndicator__2s6Xk { }\n\n.ChapterItemView-module_addSection__3XQvI {\n}\n";
|
2866
|
+
var styles$p = {"indicatorIconColor":"#888","root":"ChapterItemView-module_root__19GIF","link":"ChapterItemView-module_link__2dj_z icons-module_rightOpen__9vsOG icons-module_icon__16IVx","number":"ChapterItemView-module_number__1GjyC","title":"ChapterItemView-module_title__3jVXE","sections":"ChapterItemView-module_sections__3zg2a","creating":"ChapterItemView-module_creating__c1q2b","creatingIndicator":"ChapterItemView-module_creatingIndicator__2zOEN outline-module_creatingIndicator__3O7Rw outline-module_indicator__2dw_X icons-module_arrowsCcw__3_nrJ icons-module_icon__16IVx animations-module_blink__32C5j","destroying":"ChapterItemView-module_destroying__2PP1l","destroyingIndicator":"ChapterItemView-module_destroyingIndicator__2YZaB outline-module_destroyingIndicator__2-mKh outline-module_indicator__2dw_X icons-module_trash__DH1EH icons-module_icon__16IVx animations-module_blink__32C5j","failed":"ChapterItemView-module_failed__2MtQW","failedIndicator":"ChapterItemView-module_failedIndicator__2s6Xk outline-module_failedIndicator__2QK1F outline-module_indicator__2dw_X icons-module_attention__1sssG icons-module_icon__16IVx","addSection":"ChapterItemView-module_addSection__3XQvI buttons-module_addButton__2pN-g buttons-module_iconButton__3ZSFV icon_button icons-module_plusCircled__20FlJ icons-module_icon__16IVx"};
|
2867
|
+
styleInject(css$G);
|
2868
|
+
|
2869
|
+
var ChapterItemView = Marionette.Layout.extend({
|
2870
|
+
tagName: 'li',
|
2871
|
+
className: styles$p.root,
|
2872
|
+
mixins: [modelLifecycleTrackingView({
|
2873
|
+
classNames: styles$p
|
2874
|
+
})],
|
2875
|
+
template: function template() {
|
2876
|
+
return "\n <a class=\"".concat(styles$p.link, "\" href=\"\">\n <span class=\"").concat(styles$p.number, "\"></span>\n <span class=\"").concat(styles$p.title, "\"></span>\n <span class=\"").concat(styles$p.creatingIndicator, "\" />\n <span class=\"").concat(styles$p.destroyingIndicator, "\" />\n <span class=\"").concat(styles$p.failedIndicator, "\"\n title=\"").concat(I18n.t('pageflow_scrolled.editor.chapter_item.save_error'), "\" />\n </a>\n\n <ul class=\"").concat(styles$p.sections, "\"></ul>\n\n <a href=\"\" class=\"").concat(styles$p.addSection, "\">").concat(I18n.t('pageflow_scrolled.editor.chapter_item.add_section'), "</a>\n ");
|
2877
|
+
},
|
2878
|
+
ui: cssModulesUtils.ui(styles$p, 'title', 'number', 'sections'),
|
2879
|
+
events: cssModulesUtils.events(styles$p, {
|
2880
|
+
'click addSection': function clickAddSection() {
|
2881
|
+
this.model.addSection();
|
2882
|
+
},
|
2883
|
+
'click link': function clickLink() {
|
2884
|
+
if (!this.model.isNew() && !this.model.isDestroying()) {
|
2885
|
+
editor.navigate('/scrolled/chapters/' + this.model.get('id'), {
|
2886
|
+
trigger: true
|
2887
|
+
});
|
2888
|
+
}
|
2889
|
+
|
2890
|
+
return false;
|
2891
|
+
}
|
2892
|
+
}),
|
2893
|
+
modelEvents: {
|
2894
|
+
change: 'update'
|
2895
|
+
},
|
2896
|
+
onRender: function onRender() {
|
2897
|
+
this.subview(new SortableCollectionView({
|
2898
|
+
el: this.ui.sections,
|
2899
|
+
collection: this.model.sections,
|
2900
|
+
itemViewConstructor: SectionItemView,
|
2901
|
+
itemViewOptions: {
|
2902
|
+
entry: this.options.entry
|
2903
|
+
},
|
2904
|
+
connectWith: cssModulesUtils.selector(styles$p, 'sections')
|
2905
|
+
}));
|
2906
|
+
this.update();
|
2907
|
+
},
|
2908
|
+
update: function update() {
|
2909
|
+
this.ui.title.text(this.model.configuration.get('title') || I18n.t('pageflow.editor.views.chapter_item_view.unnamed'));
|
2910
|
+
this.ui.number.text(I18n.t('pageflow.editor.views.chapter_item_view.chapter') + ' ' + (this.model.get('position') + 1));
|
2911
|
+
}
|
2912
|
+
});
|
2913
|
+
|
2914
|
+
var css$H = ".icons-module_icon__16IVx::before {\n font-family: \"entypo\";\n}.icons-module_arrowsCcw__3_nrJ,\n.icons-module_attention__1sssG,\n.icons-module_plusCircled__20FlJ,\n.icons-module_rightOpen__9vsOG,\n.icons-module_trash__DH1EH {\n}.icons-module_arrowsCcw__3_nrJ::before {\n content: \"\\1F504\";\n}.icons-module_attention__1sssG::before {\n content: \"\\26A0\";\n}.icons-module_plusCircled__20FlJ::before {\n content: \"\\2795\";\n}.icons-module_rightOpen__9vsOG::before {\n content: \"\\E75E\"\n}.icons-module_trash__DH1EH::before {\n content: \"\\E729\";\n}.buttons-module_iconButton__3ZSFV {\n /* see app/assets/stylesheets/pageflow/editor/composable.scss */\n}.buttons-module_addButton__2pN-g {\n}\n\n.EntryOutlineView-module_root__3NBUB {}\n\n.EntryOutlineView-module_chapters__3Gr1l {}\n\n.EntryOutlineView-module_addChapter__3_M-b {\n}\n";
|
2915
|
+
var styles$q = {"root":"EntryOutlineView-module_root__3NBUB","chapters":"EntryOutlineView-module_chapters__3Gr1l","addChapter":"EntryOutlineView-module_addChapter__3_M-b buttons-module_addButton__2pN-g buttons-module_iconButton__3ZSFV icon_button icons-module_plusCircled__20FlJ icons-module_icon__16IVx"};
|
2916
|
+
styleInject(css$H);
|
2917
|
+
|
2918
|
+
var EntryOutlineView = Marionette.Layout.extend({
|
2919
|
+
tagName: 'nav',
|
2920
|
+
className: styles$q.root,
|
2921
|
+
template: function template() {
|
2922
|
+
return "\n <h2>".concat(I18n.t('pageflow_scrolled.editor.entry_outline.header'), "</h2>\n <ul class=\"").concat(styles$q.chapters, "\"></ul>\n\n <a class=\"").concat(styles$q.addChapter, "\" href=\"\">\n ").concat(I18n.t('pageflow_scrolled.editor.entry_outline.add_chapter'), "\n </a>\n ");
|
2923
|
+
},
|
2924
|
+
ui: cssModulesUtils.ui(styles$q, 'chapters'),
|
2925
|
+
events: cssModulesUtils.events(styles$q, {
|
2926
|
+
'click addChapter': function clickAddChapter() {
|
2927
|
+
this.options.entry.addChapter();
|
2928
|
+
}
|
2929
|
+
}),
|
2930
|
+
onRender: function onRender() {
|
2931
|
+
this.subview(new SortableCollectionView({
|
2932
|
+
el: this.ui.chapters,
|
2933
|
+
collection: this.options.entry.chapters,
|
2934
|
+
itemViewConstructor: ChapterItemView,
|
2935
|
+
itemViewOptions: {
|
2936
|
+
entry: this.options.entry
|
2937
|
+
}
|
2938
|
+
}));
|
2939
|
+
}
|
2940
|
+
});
|
2941
|
+
|
2942
|
+
var css$I = ".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";
|
2943
|
+
var styles$r = {"root":"EntryPreviewView-module_root__1Nb6e","iframe":"EntryPreviewView-module_iframe__1leJC"};
|
2944
|
+
styleInject(css$I);
|
2945
|
+
|
2946
|
+
var EntryPreviewView = Marionette.ItemView.extend({
|
2947
|
+
template: function template() {
|
2948
|
+
return "\n <iframe class=\"".concat(styles$r.iframe, "\" />\n ");
|
2949
|
+
},
|
2950
|
+
className: styles$r.root,
|
2951
|
+
ui: cssModulesUtils.ui(styles$r, 'iframe'),
|
2952
|
+
initialize: function initialize() {
|
2953
|
+
this.messageListener = this.onMessage.bind(this);
|
2954
|
+
},
|
2955
|
+
onShow: function onShow() {
|
2956
|
+
window.addEventListener('message', this.messageListener);
|
2957
|
+
inject(this.ui.iframe[0], unescape($('[data-template="iframe_seed"]').html()));
|
2958
|
+
},
|
2959
|
+
onClose: function onClose() {
|
2960
|
+
window.removeEventListener('message', this.messageListener);
|
2961
|
+
},
|
2962
|
+
onMessage: function onMessage(message) {
|
2963
|
+
var _this = this;
|
2964
|
+
|
2965
|
+
if (window.location.href.indexOf(message.origin) === 0) {
|
2966
|
+
if (message.data.type === 'READY') {
|
2967
|
+
var postMessage = function postMessage(message) {
|
2968
|
+
_this.ui.iframe[0].contentWindow.postMessage(message, window.location.origin);
|
2969
|
+
};
|
2970
|
+
|
2971
|
+
watchCollections(this.model, {
|
2972
|
+
dispatch: function dispatch(action) {
|
2973
|
+
return postMessage({
|
2974
|
+
type: 'ACTION',
|
2975
|
+
payload: action
|
2976
|
+
});
|
2977
|
+
}
|
2978
|
+
});
|
2979
|
+
this.listenTo(this.model, 'scrollToSection', function (section) {
|
2980
|
+
return postMessage({
|
2981
|
+
type: 'SCROLL_TO_SECTION',
|
2982
|
+
payload: {
|
2983
|
+
index: _this.model.sections.indexOf(section)
|
2984
|
+
}
|
2985
|
+
});
|
2986
|
+
});
|
2987
|
+
} else if (message.data.type === 'CHANGE_SECTION') {
|
2988
|
+
this.model.set('currentSectionIndex', message.data.payload.index);
|
2989
|
+
}
|
2990
|
+
}
|
2991
|
+
}
|
2992
|
+
});
|
2993
|
+
|
2994
|
+
function inject(iframe, html) {
|
2995
|
+
var doc = iframe.document || iframe.contentDocument || iframe.contentWindow.document;
|
2996
|
+
doc.open();
|
2997
|
+
doc.writeln(html);
|
2998
|
+
doc.close();
|
2999
|
+
}
|
3000
|
+
|
3001
|
+
function unescape(text) {
|
3002
|
+
return text.replace(/<\\\//g, '</');
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
var SideBarRouter = Marionette.AppRouter.extend({
|
3006
|
+
appRoutes: {
|
3007
|
+
'scrolled/chapters/:id': 'chapter',
|
3008
|
+
'scrolled/sections/:id': 'section'
|
3009
|
+
}
|
3010
|
+
});
|
3011
|
+
|
3012
|
+
var EditChapterView = EditConfigurationView.extend({
|
3013
|
+
translationKeyPrefix: 'pageflow_scrolled.editor.edit_chapter',
|
3014
|
+
configure: function configure(configurationEditor) {
|
3015
|
+
configurationEditor.tab('chapter', function () {
|
3016
|
+
this.input('title', TextInputView);
|
3017
|
+
this.input('summary', TextAreaInputView, {
|
3018
|
+
disableLinks: true
|
3019
|
+
});
|
3020
|
+
});
|
3021
|
+
}
|
3022
|
+
});
|
3023
|
+
|
3024
|
+
var EditSectionView = EditConfigurationView.extend({
|
3025
|
+
translationKeyPrefix: 'pageflow_scrolled.editor.edit_section',
|
3026
|
+
configure: function configure(configurationEditor) {
|
3027
|
+
configurationEditor.tab('section', function () {
|
3028
|
+
this.input('layout', SelectInputView, {
|
3029
|
+
values: ['left', 'right', 'center']
|
3030
|
+
});
|
3031
|
+
this.input('backdropType', SelectInputView, {
|
3032
|
+
values: ['image', 'color'],
|
3033
|
+
texts: ['Bild', 'Farbe']
|
3034
|
+
});
|
3035
|
+
this.input('backdropImage', FileInputView, {
|
3036
|
+
collection: 'image_files',
|
3037
|
+
fileSelectionHandler: 'sectionConfiguration',
|
3038
|
+
visibleBinding: 'backdropType',
|
3039
|
+
visibleBindingValue: 'image'
|
3040
|
+
});
|
3041
|
+
this.input('backdropImage', ColorInputView, {
|
3042
|
+
visibleBinding: 'backdropType',
|
3043
|
+
visibleBindingValue: 'color'
|
3044
|
+
});
|
3045
|
+
this.input('invert', CheckBoxInputView);
|
3046
|
+
});
|
3047
|
+
}
|
3048
|
+
});
|
3049
|
+
|
3050
|
+
var SideBarController = Marionette.Controller.extend({
|
3051
|
+
initialize: function initialize(options) {
|
3052
|
+
this.region = options.region;
|
3053
|
+
this.entry = options.entry;
|
3054
|
+
},
|
3055
|
+
chapter: function chapter(id, tab) {
|
3056
|
+
this.region.show(new EditChapterView({
|
3057
|
+
entry: this.entry,
|
3058
|
+
model: this.entry.chapters.get(id),
|
3059
|
+
api: editor
|
3060
|
+
}));
|
3061
|
+
},
|
3062
|
+
section: function section(id, tab) {
|
3063
|
+
this.region.show(new EditSectionView({
|
3064
|
+
entry: this.entry,
|
3065
|
+
model: this.entry.sections.get(id),
|
3066
|
+
api: editor
|
3067
|
+
}));
|
3068
|
+
}
|
3069
|
+
});
|
3070
|
+
|
3071
|
+
/*global pageflow*/
|
3072
|
+
Object.assign(pageflow, globalInterop);
|
3073
|
+
pageflow.editor.registerEntryType('scrolled', {
|
3074
|
+
entryModel: ScrolledEntry,
|
3075
|
+
previewView: EntryPreviewView,
|
3076
|
+
outlineView: EntryOutlineView
|
3077
|
+
});
|
3078
|
+
pageflow.editor.registerSideBarRouting({
|
3079
|
+
router: SideBarRouter,
|
3080
|
+
controller: SideBarController
|
315
3081
|
});
|