pageflow 15.2.0 → 15.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +89 -83
- data/README.md +2 -3
- data/admins/pageflow/accounts.rb +1 -98
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/entry_templates.rb +140 -0
- data/admins/pageflow/membership.rb +12 -0
- data/admins/pageflow/user.rb +5 -5
- data/app/assets/javascripts/pageflow/admin/accounts.js +1 -1
- data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
- data/app/assets/javascripts/pageflow/admin/users.js +1 -1
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
- data/app/assets/javascripts/pageflow/base.js +0 -12
- data/app/assets/javascripts/pageflow/components.js +2 -6
- data/app/assets/javascripts/pageflow/dist/ui.js +178 -55
- data/app/assets/javascripts/pageflow/editor/vendor.js +1 -0
- data/app/assets/javascripts/pageflow/vendor.js +12 -10
- data/app/assets/stylesheets/pageflow/base.scss +0 -7
- data/app/assets/stylesheets/pageflow/editor/base.scss +5 -2
- data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
- data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
- data/app/assets/stylesheets/pageflow/entries.scss +1 -1
- data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
- data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
- data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page.scss +7 -0
- data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
- data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
- data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
- data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
- data/app/helpers/pageflow/structured_data_helper.rb +0 -2
- data/app/models/pageflow/account.rb +21 -1
- data/app/models/pageflow/account_role_query.rb +1 -1
- data/app/models/pageflow/chapter.rb +3 -9
- data/app/models/pageflow/entry.rb +9 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -0
- data/app/models/pageflow/entry_template.rb +16 -2
- data/app/models/pageflow/managed_user_query.rb +1 -1
- data/app/models/pageflow/page.rb +1 -4
- data/app/models/pageflow/revision.rb +0 -4
- data/app/models/pageflow/storyline.rb +2 -9
- data/app/policies/pageflow/account_policy.rb +10 -0
- data/app/policies/pageflow/entry_template_policy.rb +5 -1
- data/app/policies/pageflow/folder_policy.rb +2 -2
- data/app/policies/pageflow/membership_policy.rb +2 -2
- data/app/policies/pageflow/theming_policy.rb +2 -2
- data/app/policies/pageflow/user_policy.rb +1 -1
- data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
- data/app/views/admin/accounts/_form.html.erb +3 -49
- data/app/views/admin/entries/_attributes_table.html.arb +5 -0
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
- data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
- data/app/views/admin/entry_templates/_form.html.erb +58 -0
- data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
- data/app/views/pageflow/admin/initial_passwords/edit.html.erb +2 -1
- data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
- data/app/views/pageflow/themes/_theme.json.jbuilder +1 -1
- data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
- data/config/initializers/admin_resource_tabs.rb +5 -0
- data/config/initializers/help_entries.rb +1 -5
- data/config/initializers/revision_components.rb +5 -0
- data/config/locales/de.yml +88 -155
- data/config/locales/en.yml +79 -143
- data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
- data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1528 -1349
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9258 -0
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
- data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
- data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +3 -3
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +4 -2
- data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
- data/entry_types/paged/config/initializers/features.rb +1 -1
- data/entry_types/paged/config/initializers/help_entries.rb +17 -0
- data/entry_types/paged/config/locales/new/help.de.yml +162 -0
- data/entry_types/paged/config/locales/new/help.en.yml +153 -0
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
- data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
- data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
- data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +7 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +40 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +36 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +3 -9
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +37 -2
- data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +3 -9
- data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +1 -9
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/_global_notices.html.erb +10 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +28 -11
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +8 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
- data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
- data/entry_types/scrolled/config/locales/de.yml +669 -0
- data/entry_types/scrolled/config/locales/en.yml +488 -0
- data/entry_types/scrolled/config/routes.rb +1 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +76 -6
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +32 -0
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +8 -0
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +173 -0
- data/entry_types/scrolled/package/contentElements-editor.js +541 -0
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements-frontend.js +1169 -0
- data/entry_types/scrolled/package/editor.js +2930 -371
- data/entry_types/scrolled/package/frontend-server.js +228 -0
- data/entry_types/scrolled/package/frontend/EditableText-7093fd0e.js +1071 -0
- data/entry_types/scrolled/package/frontend/Viewer-e49e7807.js +387 -0
- data/entry_types/scrolled/package/frontend/Wavesurfer-0adf5667.js +375 -0
- data/entry_types/scrolled/package/frontend/components-6a6793ca.js +2534 -0
- data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
- data/entry_types/scrolled/package/frontend/i18n-4dc6c377.js +1092 -0
- data/entry_types/scrolled/package/frontend/index.css +9 -0
- data/entry_types/scrolled/package/frontend/index.js +5686 -0
- data/entry_types/scrolled/package/frontend/useBrowserFeature-91a4c29d.js +33 -0
- data/entry_types/scrolled/package/package.json +30 -9
- data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
- data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +14 -9
- data/lib/pageflow/ability_mixin.rb +14 -2
- data/lib/pageflow/configuration.rb +6 -5
- data/lib/pageflow/entry_export_import/revision_serialization.rb +15 -13
- data/lib/pageflow/entry_export_import/revision_serialization/import.rb +18 -26
- data/lib/pageflow/entry_type_configuration.rb +2 -0
- data/lib/pageflow/global_config_api.rb +5 -4
- data/lib/pageflow/nested_revision_component.rb +49 -0
- data/lib/pageflow/react.rb +4 -2
- data/lib/pageflow/revision_component.rb +6 -2
- data/lib/pageflow/themes.rb +4 -0
- data/lib/pageflow/user_mixin.rb +2 -1
- data/lib/pageflow/version.rb +1 -1
- data/{packages/pageflow → package}/config/jest/index.js +8 -2
- data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
- data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
- data/{packages/pageflow → package}/config/webpack.js +7 -0
- data/{packages/pageflow → package}/editor.js +482 -1130
- data/package/frontend.js +2553 -0
- data/{packages/pageflow → package}/package.json +3 -0
- data/{packages/pageflow → package}/testHelpers.js +114 -13
- data/{packages/pageflow → package}/ui.js +178 -55
- data/spec/factories/accounts.rb +3 -1
- data/spec/factories/entry_templates.rb +1 -0
- data/spec/factories/published_entries.rb +6 -1
- data/spec/factories/test_revision_components.rb +4 -0
- metadata +96 -37
- data/app/assets/javascripts/pageflow/dist/editor.js +0 -11890
- data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
- data/app/assets/javascripts/pageflow/videojs.js +0 -6
- data/config/initializers/entry_types.rb +0 -4
- data/entry_types/scrolled/config/locales/new/de.yml +0 -269
- data/entry_types/scrolled/config/locales/new/en.yml +0 -264
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +0 -96
- data/entry_types/scrolled/package/frontend.js +0 -2879
- data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
@@ -0,0 +1,228 @@
|
|
1
|
+
import 'core-js/modules/es.symbol';
|
2
|
+
import 'core-js/modules/es.symbol.description';
|
3
|
+
import 'core-js/modules/es.symbol.async-iterator';
|
4
|
+
import 'core-js/modules/es.symbol.has-instance';
|
5
|
+
import 'core-js/modules/es.symbol.is-concat-spreadable';
|
6
|
+
import 'core-js/modules/es.symbol.iterator';
|
7
|
+
import 'core-js/modules/es.symbol.match';
|
8
|
+
import 'core-js/modules/es.symbol.replace';
|
9
|
+
import 'core-js/modules/es.symbol.search';
|
10
|
+
import 'core-js/modules/es.symbol.species';
|
11
|
+
import 'core-js/modules/es.symbol.split';
|
12
|
+
import 'core-js/modules/es.symbol.to-primitive';
|
13
|
+
import 'core-js/modules/es.symbol.to-string-tag';
|
14
|
+
import 'core-js/modules/es.symbol.unscopables';
|
15
|
+
import 'core-js/modules/es.array.concat';
|
16
|
+
import 'core-js/modules/es.array.copy-within';
|
17
|
+
import 'core-js/modules/es.array.every';
|
18
|
+
import 'core-js/modules/es.array.fill';
|
19
|
+
import 'core-js/modules/es.array.filter';
|
20
|
+
import 'core-js/modules/es.array.find';
|
21
|
+
import 'core-js/modules/es.array.find-index';
|
22
|
+
import 'core-js/modules/es.array.flat';
|
23
|
+
import 'core-js/modules/es.array.flat-map';
|
24
|
+
import 'core-js/modules/es.array.for-each';
|
25
|
+
import 'core-js/modules/es.array.from';
|
26
|
+
import 'core-js/modules/es.array.includes';
|
27
|
+
import 'core-js/modules/es.array.index-of';
|
28
|
+
import 'core-js/modules/es.array.is-array';
|
29
|
+
import 'core-js/modules/es.array.iterator';
|
30
|
+
import 'core-js/modules/es.array.join';
|
31
|
+
import 'core-js/modules/es.array.last-index-of';
|
32
|
+
import 'core-js/modules/es.array.map';
|
33
|
+
import 'core-js/modules/es.array.of';
|
34
|
+
import 'core-js/modules/es.array.reduce';
|
35
|
+
import 'core-js/modules/es.array.reduce-right';
|
36
|
+
import 'core-js/modules/es.array.reverse';
|
37
|
+
import 'core-js/modules/es.array.slice';
|
38
|
+
import 'core-js/modules/es.array.some';
|
39
|
+
import 'core-js/modules/es.array.sort';
|
40
|
+
import 'core-js/modules/es.array.species';
|
41
|
+
import 'core-js/modules/es.array.splice';
|
42
|
+
import 'core-js/modules/es.array.unscopables.flat';
|
43
|
+
import 'core-js/modules/es.array.unscopables.flat-map';
|
44
|
+
import 'core-js/modules/es.array-buffer.constructor';
|
45
|
+
import 'core-js/modules/es.array-buffer.is-view';
|
46
|
+
import 'core-js/modules/es.array-buffer.slice';
|
47
|
+
import 'core-js/modules/es.data-view';
|
48
|
+
import 'core-js/modules/es.date.now';
|
49
|
+
import 'core-js/modules/es.date.to-iso-string';
|
50
|
+
import 'core-js/modules/es.date.to-json';
|
51
|
+
import 'core-js/modules/es.date.to-primitive';
|
52
|
+
import 'core-js/modules/es.date.to-string';
|
53
|
+
import 'core-js/modules/es.function.bind';
|
54
|
+
import 'core-js/modules/es.function.has-instance';
|
55
|
+
import 'core-js/modules/es.function.name';
|
56
|
+
import 'core-js/modules/es.json.to-string-tag';
|
57
|
+
import 'core-js/modules/es.map';
|
58
|
+
import 'core-js/modules/es.math.acosh';
|
59
|
+
import 'core-js/modules/es.math.asinh';
|
60
|
+
import 'core-js/modules/es.math.atanh';
|
61
|
+
import 'core-js/modules/es.math.cbrt';
|
62
|
+
import 'core-js/modules/es.math.clz32';
|
63
|
+
import 'core-js/modules/es.math.cosh';
|
64
|
+
import 'core-js/modules/es.math.expm1';
|
65
|
+
import 'core-js/modules/es.math.fround';
|
66
|
+
import 'core-js/modules/es.math.hypot';
|
67
|
+
import 'core-js/modules/es.math.imul';
|
68
|
+
import 'core-js/modules/es.math.log10';
|
69
|
+
import 'core-js/modules/es.math.log1p';
|
70
|
+
import 'core-js/modules/es.math.log2';
|
71
|
+
import 'core-js/modules/es.math.sign';
|
72
|
+
import 'core-js/modules/es.math.sinh';
|
73
|
+
import 'core-js/modules/es.math.tanh';
|
74
|
+
import 'core-js/modules/es.math.to-string-tag';
|
75
|
+
import 'core-js/modules/es.math.trunc';
|
76
|
+
import 'core-js/modules/es.number.constructor';
|
77
|
+
import 'core-js/modules/es.number.epsilon';
|
78
|
+
import 'core-js/modules/es.number.is-finite';
|
79
|
+
import 'core-js/modules/es.number.is-integer';
|
80
|
+
import 'core-js/modules/es.number.is-nan';
|
81
|
+
import 'core-js/modules/es.number.is-safe-integer';
|
82
|
+
import 'core-js/modules/es.number.max-safe-integer';
|
83
|
+
import 'core-js/modules/es.number.min-safe-integer';
|
84
|
+
import 'core-js/modules/es.number.parse-float';
|
85
|
+
import 'core-js/modules/es.number.parse-int';
|
86
|
+
import 'core-js/modules/es.number.to-fixed';
|
87
|
+
import 'core-js/modules/es.number.to-precision';
|
88
|
+
import 'core-js/modules/es.object.assign';
|
89
|
+
import 'core-js/modules/es.object.create';
|
90
|
+
import 'core-js/modules/es.object.define-getter';
|
91
|
+
import 'core-js/modules/es.object.define-properties';
|
92
|
+
import 'core-js/modules/es.object.define-property';
|
93
|
+
import 'core-js/modules/es.object.define-setter';
|
94
|
+
import 'core-js/modules/es.object.entries';
|
95
|
+
import 'core-js/modules/es.object.freeze';
|
96
|
+
import 'core-js/modules/es.object.from-entries';
|
97
|
+
import 'core-js/modules/es.object.get-own-property-descriptor';
|
98
|
+
import 'core-js/modules/es.object.get-own-property-descriptors';
|
99
|
+
import 'core-js/modules/es.object.get-own-property-names';
|
100
|
+
import 'core-js/modules/es.object.get-prototype-of';
|
101
|
+
import 'core-js/modules/es.object.is';
|
102
|
+
import 'core-js/modules/es.object.is-extensible';
|
103
|
+
import 'core-js/modules/es.object.is-frozen';
|
104
|
+
import 'core-js/modules/es.object.is-sealed';
|
105
|
+
import 'core-js/modules/es.object.keys';
|
106
|
+
import 'core-js/modules/es.object.lookup-getter';
|
107
|
+
import 'core-js/modules/es.object.lookup-setter';
|
108
|
+
import 'core-js/modules/es.object.prevent-extensions';
|
109
|
+
import 'core-js/modules/es.object.seal';
|
110
|
+
import 'core-js/modules/es.object.set-prototype-of';
|
111
|
+
import 'core-js/modules/es.object.to-string';
|
112
|
+
import 'core-js/modules/es.object.values';
|
113
|
+
import 'core-js/modules/es.parse-float';
|
114
|
+
import 'core-js/modules/es.parse-int';
|
115
|
+
import 'core-js/modules/es.promise';
|
116
|
+
import 'core-js/modules/es.promise.finally';
|
117
|
+
import 'core-js/modules/es.reflect.apply';
|
118
|
+
import 'core-js/modules/es.reflect.construct';
|
119
|
+
import 'core-js/modules/es.reflect.define-property';
|
120
|
+
import 'core-js/modules/es.reflect.delete-property';
|
121
|
+
import 'core-js/modules/es.reflect.get';
|
122
|
+
import 'core-js/modules/es.reflect.get-own-property-descriptor';
|
123
|
+
import 'core-js/modules/es.reflect.get-prototype-of';
|
124
|
+
import 'core-js/modules/es.reflect.has';
|
125
|
+
import 'core-js/modules/es.reflect.is-extensible';
|
126
|
+
import 'core-js/modules/es.reflect.own-keys';
|
127
|
+
import 'core-js/modules/es.reflect.prevent-extensions';
|
128
|
+
import 'core-js/modules/es.reflect.set';
|
129
|
+
import 'core-js/modules/es.reflect.set-prototype-of';
|
130
|
+
import 'core-js/modules/es.regexp.constructor';
|
131
|
+
import 'core-js/modules/es.regexp.exec';
|
132
|
+
import 'core-js/modules/es.regexp.flags';
|
133
|
+
import 'core-js/modules/es.regexp.to-string';
|
134
|
+
import 'core-js/modules/es.set';
|
135
|
+
import 'core-js/modules/es.string.code-point-at';
|
136
|
+
import 'core-js/modules/es.string.ends-with';
|
137
|
+
import 'core-js/modules/es.string.from-code-point';
|
138
|
+
import 'core-js/modules/es.string.includes';
|
139
|
+
import 'core-js/modules/es.string.iterator';
|
140
|
+
import 'core-js/modules/es.string.match';
|
141
|
+
import 'core-js/modules/es.string.pad-end';
|
142
|
+
import 'core-js/modules/es.string.pad-start';
|
143
|
+
import 'core-js/modules/es.string.raw';
|
144
|
+
import 'core-js/modules/es.string.repeat';
|
145
|
+
import 'core-js/modules/es.string.replace';
|
146
|
+
import 'core-js/modules/es.string.search';
|
147
|
+
import 'core-js/modules/es.string.split';
|
148
|
+
import 'core-js/modules/es.string.starts-with';
|
149
|
+
import 'core-js/modules/es.string.trim';
|
150
|
+
import 'core-js/modules/es.string.trim-end';
|
151
|
+
import 'core-js/modules/es.string.trim-start';
|
152
|
+
import 'core-js/modules/es.string.anchor';
|
153
|
+
import 'core-js/modules/es.string.big';
|
154
|
+
import 'core-js/modules/es.string.blink';
|
155
|
+
import 'core-js/modules/es.string.bold';
|
156
|
+
import 'core-js/modules/es.string.fixed';
|
157
|
+
import 'core-js/modules/es.string.fontcolor';
|
158
|
+
import 'core-js/modules/es.string.fontsize';
|
159
|
+
import 'core-js/modules/es.string.italics';
|
160
|
+
import 'core-js/modules/es.string.link';
|
161
|
+
import 'core-js/modules/es.string.small';
|
162
|
+
import 'core-js/modules/es.string.strike';
|
163
|
+
import 'core-js/modules/es.string.sub';
|
164
|
+
import 'core-js/modules/es.string.sup';
|
165
|
+
import 'core-js/modules/es.typed-array.float32-array';
|
166
|
+
import 'core-js/modules/es.typed-array.float64-array';
|
167
|
+
import 'core-js/modules/es.typed-array.int8-array';
|
168
|
+
import 'core-js/modules/es.typed-array.int16-array';
|
169
|
+
import 'core-js/modules/es.typed-array.int32-array';
|
170
|
+
import 'core-js/modules/es.typed-array.uint8-array';
|
171
|
+
import 'core-js/modules/es.typed-array.uint8-clamped-array';
|
172
|
+
import 'core-js/modules/es.typed-array.uint16-array';
|
173
|
+
import 'core-js/modules/es.typed-array.uint32-array';
|
174
|
+
import 'core-js/modules/es.typed-array.copy-within';
|
175
|
+
import 'core-js/modules/es.typed-array.every';
|
176
|
+
import 'core-js/modules/es.typed-array.fill';
|
177
|
+
import 'core-js/modules/es.typed-array.filter';
|
178
|
+
import 'core-js/modules/es.typed-array.find';
|
179
|
+
import 'core-js/modules/es.typed-array.find-index';
|
180
|
+
import 'core-js/modules/es.typed-array.for-each';
|
181
|
+
import 'core-js/modules/es.typed-array.from';
|
182
|
+
import 'core-js/modules/es.typed-array.includes';
|
183
|
+
import 'core-js/modules/es.typed-array.index-of';
|
184
|
+
import 'core-js/modules/es.typed-array.iterator';
|
185
|
+
import 'core-js/modules/es.typed-array.join';
|
186
|
+
import 'core-js/modules/es.typed-array.last-index-of';
|
187
|
+
import 'core-js/modules/es.typed-array.map';
|
188
|
+
import 'core-js/modules/es.typed-array.of';
|
189
|
+
import 'core-js/modules/es.typed-array.reduce';
|
190
|
+
import 'core-js/modules/es.typed-array.reduce-right';
|
191
|
+
import 'core-js/modules/es.typed-array.reverse';
|
192
|
+
import 'core-js/modules/es.typed-array.set';
|
193
|
+
import 'core-js/modules/es.typed-array.slice';
|
194
|
+
import 'core-js/modules/es.typed-array.some';
|
195
|
+
import 'core-js/modules/es.typed-array.sort';
|
196
|
+
import 'core-js/modules/es.typed-array.subarray';
|
197
|
+
import 'core-js/modules/es.typed-array.to-locale-string';
|
198
|
+
import 'core-js/modules/es.typed-array.to-string';
|
199
|
+
import 'core-js/modules/es.weak-map';
|
200
|
+
import 'core-js/modules/es.weak-set';
|
201
|
+
import 'core-js/modules/web.dom-collections.for-each';
|
202
|
+
import 'core-js/modules/web.dom-collections.iterator';
|
203
|
+
import 'core-js/modules/web.immediate';
|
204
|
+
import 'core-js/modules/web.queue-microtask';
|
205
|
+
import 'core-js/modules/web.timers';
|
206
|
+
import 'core-js/modules/web.url';
|
207
|
+
import 'core-js/modules/web.url.to-json';
|
208
|
+
import 'core-js/modules/web.url-search-params';
|
209
|
+
import React from 'react';
|
210
|
+
import ReactRailsUJS from 'react_ujs';
|
211
|
+
import { setupI18n, Root } from 'pageflow-scrolled/frontend';
|
212
|
+
|
213
|
+
ReactRailsUJS.getConstructor = function () {
|
214
|
+
// Normally this function receives the name of a component, but we
|
215
|
+
// only need to render one type of component.
|
216
|
+
return ServerRenderedRoot;
|
217
|
+
};
|
218
|
+
|
219
|
+
function ServerRenderedRoot(_ref) {
|
220
|
+
var seed = _ref.seed;
|
221
|
+
setupI18n(seed.i18n);
|
222
|
+
return (
|
223
|
+
/*#__PURE__*/
|
224
|
+
React.createElement(Root, {
|
225
|
+
seed: seed
|
226
|
+
})
|
227
|
+
);
|
228
|
+
}
|
@@ -0,0 +1,1071 @@
|
|
1
|
+
import React, { useState, useEffect, createContext, useContext, useRef, useMemo, useCallback } from 'react';
|
2
|
+
import { _ as _slicedToArray, k as _objectSpread2, a as _defineProperty, p as _toConsumableArray } from './i18n-4dc6c377.js';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import { _ as _createClass, a as _classCallCheck, b as _inherits, c as _getPrototypeOf, d as _possibleConstructorReturn } from './getPrototypeOf-63c7c8e8.js';
|
5
|
+
|
6
|
+
var PhonePlatformContext = React.createContext(false);
|
7
|
+
|
8
|
+
function useOnScreen(ref) {
|
9
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
10
|
+
rootMargin = _ref.rootMargin,
|
11
|
+
onIntersecting = _ref.onIntersecting,
|
12
|
+
skipIframeFix = _ref.skipIframeFix;
|
13
|
+
|
14
|
+
var _useState = useState(false),
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
16
|
+
isIntersecting = _useState2[0],
|
17
|
+
setIntersecting = _useState2[1];
|
18
|
+
|
19
|
+
useEffect(function () {
|
20
|
+
var current = ref.current;
|
21
|
+
var observer = createIntersectionObserver(function (entries) {
|
22
|
+
// Even when observing only a single element, multiple entries
|
23
|
+
// may have queued up. In Chrome this can be observed when
|
24
|
+
// moving an observed element in the DOM: The callback is
|
25
|
+
// invoked once with two entries for the same target, one
|
26
|
+
// claiming the element no longer intersects and one - with a
|
27
|
+
// later timestamp - saying that is does intersect. Assuming
|
28
|
+
// entries are ordered according to time, we only consider the
|
29
|
+
// last entry.
|
30
|
+
var entry = entries[entries.length - 1];
|
31
|
+
setIntersecting(entry.isIntersecting);
|
32
|
+
|
33
|
+
if (entry.isIntersecting && onIntersecting) {
|
34
|
+
onIntersecting();
|
35
|
+
}
|
36
|
+
}, {
|
37
|
+
rootMargin: rootMargin
|
38
|
+
}, skipIframeFix);
|
39
|
+
|
40
|
+
if (ref.current) {
|
41
|
+
observer.observe(current);
|
42
|
+
}
|
43
|
+
|
44
|
+
return function () {
|
45
|
+
observer.unobserve(current);
|
46
|
+
};
|
47
|
+
}, [ref, rootMargin, onIntersecting, skipIframeFix]);
|
48
|
+
return isIntersecting;
|
49
|
+
}
|
50
|
+
|
51
|
+
function createIntersectionObserver(callback, options, skipIframeFix) {
|
52
|
+
if (skipIframeFix) {
|
53
|
+
return new IntersectionObserver(callback, options);
|
54
|
+
} // Positive root margins are ignored in iframes [1] (i.e. in
|
55
|
+
// the Pageflow editor). To make it work, the iframe document
|
56
|
+
// needs to be passed as `root` [2].
|
57
|
+
// This leads to a `TypeError`, though, in browers that do not
|
58
|
+
// support this yet (e.g. Chrome 80). We catch the error and
|
59
|
+
// skip passing the `root` option.
|
60
|
+
//
|
61
|
+
// [1] https://github.com/w3c/IntersectionObserver/issues/283
|
62
|
+
// [2] https://github.com/w3c/IntersectionObserver/issues/372
|
63
|
+
|
64
|
+
|
65
|
+
try {
|
66
|
+
var optionsWithIframeFix = options;
|
67
|
+
|
68
|
+
if (options.rootMargin && window.parent !== window) {
|
69
|
+
optionsWithIframeFix = _objectSpread2(_objectSpread2({}, options), {}, {
|
70
|
+
root: window.document
|
71
|
+
});
|
72
|
+
}
|
73
|
+
|
74
|
+
return new IntersectionObserver(callback, optionsWithIframeFix);
|
75
|
+
} catch (e) {
|
76
|
+
// Normally we would check for TypeError here. Since the polyfill
|
77
|
+
// throws a generic error, we retry either way and trust that the
|
78
|
+
// error will happen again if it is not related to the `root`
|
79
|
+
// option.
|
80
|
+
return createIntersectionObserver(callback, options, true);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
var styles = {"wrapper":"useScrollPositionLifecycle-module_wrapper__1a6Kr","isActiveProbe":"useScrollPositionLifecycle-module_isActiveProbe__3VKB5"};
|
85
|
+
|
86
|
+
var StaticPreviewContext = createContext(false);
|
87
|
+
function StaticPreview(_ref) {
|
88
|
+
var children = _ref.children;
|
89
|
+
return (
|
90
|
+
/*#__PURE__*/
|
91
|
+
React.createElement(StaticPreviewContext.Provider, {
|
92
|
+
value: true
|
93
|
+
}, children)
|
94
|
+
);
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Use inside a content element component to determine whether the
|
98
|
+
* component is being rendered in a static preview, e.g. editor
|
99
|
+
* thumbnails.
|
100
|
+
*
|
101
|
+
* @example
|
102
|
+
* const isStaticPreview = useIsStaticPreview();
|
103
|
+
*/
|
104
|
+
|
105
|
+
function useIsStaticPreview() {
|
106
|
+
return useContext(StaticPreviewContext);
|
107
|
+
}
|
108
|
+
function createScrollPositionLifecycleProvider(Context) {
|
109
|
+
return function ScrollPositionLifecycleProvider(_ref2) {
|
110
|
+
var children = _ref2.children,
|
111
|
+
onActivate = _ref2.onActivate;
|
112
|
+
var ref = useRef();
|
113
|
+
var isActiveProbeRef = useRef();
|
114
|
+
var isStaticPreview = useContext(StaticPreviewContext);
|
115
|
+
var shouldLoad = useOnScreen(ref, {
|
116
|
+
rootMargin: '200% 0px 200% 0px'
|
117
|
+
});
|
118
|
+
var shouldPrepare = useOnScreen(ref, {
|
119
|
+
rootMargin: '25% 0px 25% 0px'
|
120
|
+
}) && !isStaticPreview;
|
121
|
+
var isVisible = useOnScreen(ref) && !isStaticPreview;
|
122
|
+
var isActive = useOnScreen(isActiveProbeRef, {
|
123
|
+
rootMargin: '-50% 0px -50% 0px',
|
124
|
+
onIntersecting: onActivate
|
125
|
+
}) && !isStaticPreview;
|
126
|
+
var value = useMemo(function () {
|
127
|
+
return {
|
128
|
+
shouldLoad: shouldLoad,
|
129
|
+
shouldPrepare: shouldPrepare,
|
130
|
+
isVisible: isVisible,
|
131
|
+
isActive: isActive
|
132
|
+
};
|
133
|
+
}, [shouldLoad, shouldPrepare, isVisible, isActive]);
|
134
|
+
return (
|
135
|
+
/*#__PURE__*/
|
136
|
+
React.createElement("div", {
|
137
|
+
ref: ref,
|
138
|
+
className: classNames(styles.wrapper)
|
139
|
+
},
|
140
|
+
/*#__PURE__*/
|
141
|
+
React.createElement("div", {
|
142
|
+
ref: isActiveProbeRef,
|
143
|
+
className: styles.isActiveProbe
|
144
|
+
}),
|
145
|
+
/*#__PURE__*/
|
146
|
+
React.createElement(Context.Provider, {
|
147
|
+
value: value
|
148
|
+
}, children))
|
149
|
+
);
|
150
|
+
};
|
151
|
+
}
|
152
|
+
function createScrollPositionLifecycleHook(Context) {
|
153
|
+
return function useScrollPositionLifecycle() {
|
154
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
155
|
+
onActivate = _ref3.onActivate,
|
156
|
+
onDeactivate = _ref3.onDeactivate,
|
157
|
+
onVisible = _ref3.onVisible,
|
158
|
+
onInvisible = _ref3.onInvisible;
|
159
|
+
|
160
|
+
var result = useContext(Context);
|
161
|
+
var wasActive = useRef();
|
162
|
+
var wasVisible = useRef();
|
163
|
+
|
164
|
+
var _ref4 = result || {},
|
165
|
+
isActive = _ref4.isActive,
|
166
|
+
isVisible = _ref4.isVisible;
|
167
|
+
|
168
|
+
useEffect(function () {
|
169
|
+
if (!wasVisible.current && isVisible && onVisible) {
|
170
|
+
onVisible();
|
171
|
+
}
|
172
|
+
|
173
|
+
if (!wasActive.current && isActive && onActivate) {
|
174
|
+
onActivate();
|
175
|
+
} else if (wasActive.current && !isActive && onDeactivate) {
|
176
|
+
onDeactivate();
|
177
|
+
}
|
178
|
+
|
179
|
+
if (wasVisible.current && !isVisible && onInvisible) {
|
180
|
+
onInvisible();
|
181
|
+
}
|
182
|
+
|
183
|
+
wasActive.current = isActive;
|
184
|
+
wasVisible.current = isVisible;
|
185
|
+
});
|
186
|
+
return result;
|
187
|
+
};
|
188
|
+
}
|
189
|
+
|
190
|
+
var styles$1 = {"root":"MotifArea-module_root__1_ACd","visible":"MotifArea-module_visible__18Kln"};
|
191
|
+
|
192
|
+
var VisibilityContext = React.createContext(false);
|
193
|
+
function MotifAreaVisibilityProvider(_ref) {
|
194
|
+
var visible = _ref.visible,
|
195
|
+
children = _ref.children;
|
196
|
+
return (
|
197
|
+
/*#__PURE__*/
|
198
|
+
React.createElement(VisibilityContext.Provider, {
|
199
|
+
value: visible
|
200
|
+
}, children)
|
201
|
+
);
|
202
|
+
}
|
203
|
+
var MotifArea = function MotifArea(props) {
|
204
|
+
var _props$file;
|
205
|
+
|
206
|
+
var lastPosition = useRef();
|
207
|
+
var position = ((_props$file = props.file) === null || _props$file === void 0 ? void 0 : _props$file.isReady) && getPosition(props);
|
208
|
+
var visible = useContext(VisibilityContext);
|
209
|
+
var elementRef = useRef();
|
210
|
+
var onUpdate = props.onUpdate;
|
211
|
+
var setElementRef = useCallback(function (element) {
|
212
|
+
elementRef.current = element;
|
213
|
+
onUpdate(element);
|
214
|
+
}, [elementRef, onUpdate]);
|
215
|
+
useEffect(function () {
|
216
|
+
if (lastPosition.current && position && (lastPosition.current.top !== position.top || lastPosition.current.left !== position.left || lastPosition.current.width !== position.width || lastPosition.current.height !== position.height)) {
|
217
|
+
onUpdate(elementRef.current);
|
218
|
+
}
|
219
|
+
|
220
|
+
lastPosition.current = position;
|
221
|
+
});
|
222
|
+
|
223
|
+
if (!position) {
|
224
|
+
return null;
|
225
|
+
}
|
226
|
+
|
227
|
+
return (
|
228
|
+
/*#__PURE__*/
|
229
|
+
React.createElement("div", {
|
230
|
+
ref: setElementRef,
|
231
|
+
className: classNames(styles$1.root, _defineProperty({}, styles$1.visible, visible)),
|
232
|
+
style: position,
|
233
|
+
onMouseEnter: props.onMouseEnter,
|
234
|
+
onMouseLeave: props.onMouseLeave
|
235
|
+
})
|
236
|
+
);
|
237
|
+
};
|
238
|
+
MotifArea.defaultProps = {
|
239
|
+
onUpdate: function onUpdate() {}
|
240
|
+
};
|
241
|
+
|
242
|
+
function getPosition(props) {
|
243
|
+
return props.file.motifAreaOffsetRect || {
|
244
|
+
top: 0,
|
245
|
+
left: 0,
|
246
|
+
width: 0,
|
247
|
+
height: 0
|
248
|
+
};
|
249
|
+
}
|
250
|
+
|
251
|
+
function useMediaQuery(query) {
|
252
|
+
var _useState = useState(false),
|
253
|
+
_useState2 = _slicedToArray(_useState, 2),
|
254
|
+
doesMatch = _useState2[0],
|
255
|
+
onSetDoesMatch = _useState2[1];
|
256
|
+
|
257
|
+
useEffect(function () {
|
258
|
+
var onUpdateMatch = function onUpdateMatch(_ref) {
|
259
|
+
var matches = _ref.matches;
|
260
|
+
onSetDoesMatch(matches);
|
261
|
+
};
|
262
|
+
|
263
|
+
var matcher = window.matchMedia(query);
|
264
|
+
var isModern = 'addEventListener' in matcher;
|
265
|
+
|
266
|
+
if (isModern) {
|
267
|
+
matcher.addEventListener('change', onUpdateMatch);
|
268
|
+
} else {
|
269
|
+
matcher.addListener(onUpdateMatch);
|
270
|
+
}
|
271
|
+
|
272
|
+
onUpdateMatch(matcher);
|
273
|
+
return function () {
|
274
|
+
if (isModern) {
|
275
|
+
matcher.removeEventListener('change', onUpdateMatch);
|
276
|
+
} else {
|
277
|
+
matcher.removeListener(onUpdateMatch);
|
278
|
+
}
|
279
|
+
};
|
280
|
+
}, [query, onSetDoesMatch]);
|
281
|
+
return doesMatch;
|
282
|
+
}
|
283
|
+
|
284
|
+
var styles$2 = {"Foreground":"Foreground-module_Foreground__13ODU","fullFadeHeight":"Foreground-module_fullFadeHeight__2p9dx","fullHeight":"Foreground-module_fullHeight__1vMXb","inFirstSection":"Foreground-module_inFirstSection__1r-_i","paddingBottom":"Foreground-module_paddingBottom__3OtY4"};
|
285
|
+
|
286
|
+
var ForcePaddingContext = createContext(false);
|
287
|
+
function Foreground(props) {
|
288
|
+
var forcePadding = useContext(ForcePaddingContext);
|
289
|
+
return (
|
290
|
+
/*#__PURE__*/
|
291
|
+
React.createElement("div", {
|
292
|
+
className: className(props, forcePadding),
|
293
|
+
style: {
|
294
|
+
minHeight: props.minHeight
|
295
|
+
}
|
296
|
+
}, props.children)
|
297
|
+
);
|
298
|
+
}
|
299
|
+
|
300
|
+
function className(props, forcePadding) {
|
301
|
+
return classNames(styles$2.Foreground, props.transitionStyles.foreground, props.transitionStyles["foreground-".concat(props.state)], _defineProperty({}, styles$2.paddingBottom, props.paddingBottom || forcePadding), _defineProperty({}, styles$2.inFirstSection, props.inFirstSection), styles$2["".concat(props.heightMode, "Height")]);
|
302
|
+
}
|
303
|
+
|
304
|
+
/**
|
305
|
+
* Register new types of content elements.
|
306
|
+
* @name frontend_contentElementTypes
|
307
|
+
*/
|
308
|
+
var ContentElementTypeRegistry =
|
309
|
+
/*#__PURE__*/
|
310
|
+
function () {
|
311
|
+
function ContentElementTypeRegistry() {
|
312
|
+
_classCallCheck(this, ContentElementTypeRegistry);
|
313
|
+
|
314
|
+
this.types = {};
|
315
|
+
}
|
316
|
+
/**
|
317
|
+
* Register a new type of content element.
|
318
|
+
*
|
319
|
+
* @param {string} typeName - Name of the content element type.
|
320
|
+
* @param {Object} options
|
321
|
+
* @param {React.Component} options.component
|
322
|
+
* @param {boolean} [options.supportsWrappingAroundFloats] -
|
323
|
+
* In sections with centered layout, content elements can be
|
324
|
+
* floated to the left or right. By default all content
|
325
|
+
* elements are cleared to position them below floating
|
326
|
+
* elements. If a content element renders mainly text that
|
327
|
+
* can wrap around floating elements, clearing can be
|
328
|
+
* disabled via this option.
|
329
|
+
* @memberof frontend_contentElementTypes
|
330
|
+
*
|
331
|
+
* @example
|
332
|
+
*
|
333
|
+
* // frontend.js
|
334
|
+
*
|
335
|
+
* import {frontend} from 'pageflow-scrolled/frontend';
|
336
|
+
* import {InlineImage} from './InlineImage';
|
337
|
+
*
|
338
|
+
* frontend.contentElementTypes.register('inlineImage', {
|
339
|
+
* component: InlineImage
|
340
|
+
* });
|
341
|
+
*/
|
342
|
+
|
343
|
+
|
344
|
+
_createClass(ContentElementTypeRegistry, [{
|
345
|
+
key: "register",
|
346
|
+
value: function register(typeName, options) {
|
347
|
+
this.types[typeName] = options;
|
348
|
+
}
|
349
|
+
}, {
|
350
|
+
key: "getComponent",
|
351
|
+
value: function getComponent(typeName) {
|
352
|
+
return this.types[typeName] && this.types[typeName].component;
|
353
|
+
}
|
354
|
+
}, {
|
355
|
+
key: "getOptions",
|
356
|
+
value: function getOptions(typeName) {
|
357
|
+
return this.types[typeName];
|
358
|
+
}
|
359
|
+
}]);
|
360
|
+
|
361
|
+
return ContentElementTypeRegistry;
|
362
|
+
}();
|
363
|
+
|
364
|
+
var api = {
|
365
|
+
contentElementTypes: new ContentElementTypeRegistry()
|
366
|
+
};
|
367
|
+
|
368
|
+
// For reasons that are beyond me, Storybook's Webpack build fails
|
369
|
+
// with a "JavaScript heap out of memory" error if this import
|
370
|
+
// expression lives in inlineEditing/index.js directly. I originally
|
371
|
+
// intended to hide the import from Webpack by using
|
372
|
+
// file-replace-loader in Storybook's Webpack config to replace this
|
373
|
+
// file with an empty one, but found out that extracting the import
|
374
|
+
// to a separate file apparently is enough.
|
375
|
+
function importComponents() {
|
376
|
+
return import('./components-6a6793ca.js');
|
377
|
+
}
|
378
|
+
|
379
|
+
var components = {};
|
380
|
+
function loadInlineEditingComponents() {
|
381
|
+
return importComponents().then(function (importedComponents) {
|
382
|
+
components = importedComponents;
|
383
|
+
});
|
384
|
+
}
|
385
|
+
function withInlineEditingDecorator(name, Component) {
|
386
|
+
return function InlineEditingDecorator(props) {
|
387
|
+
var Decorator = components[name];
|
388
|
+
|
389
|
+
if (Decorator) {
|
390
|
+
return (
|
391
|
+
/*#__PURE__*/
|
392
|
+
React.createElement(Decorator, props,
|
393
|
+
/*#__PURE__*/
|
394
|
+
React.createElement(Component, props))
|
395
|
+
);
|
396
|
+
} else {
|
397
|
+
return (
|
398
|
+
/*#__PURE__*/
|
399
|
+
React.createElement(Component, props)
|
400
|
+
);
|
401
|
+
}
|
402
|
+
};
|
403
|
+
}
|
404
|
+
function withInlineEditingAlternative(name, Component) {
|
405
|
+
return function InlineEditingDecorator(props) {
|
406
|
+
var Alternative = components[name];
|
407
|
+
|
408
|
+
if (Alternative) {
|
409
|
+
return (
|
410
|
+
/*#__PURE__*/
|
411
|
+
React.createElement(Alternative, props)
|
412
|
+
);
|
413
|
+
} else {
|
414
|
+
return (
|
415
|
+
/*#__PURE__*/
|
416
|
+
React.createElement(Component, props)
|
417
|
+
);
|
418
|
+
}
|
419
|
+
};
|
420
|
+
}
|
421
|
+
|
422
|
+
var ContentElementAttributesContext = createContext({});
|
423
|
+
function ContentElementAttributesProvider(_ref) {
|
424
|
+
var id = _ref.id,
|
425
|
+
children = _ref.children;
|
426
|
+
var attributes = useMemo(function () {
|
427
|
+
return {
|
428
|
+
contentElementId: id
|
429
|
+
};
|
430
|
+
}, [id]);
|
431
|
+
return (
|
432
|
+
/*#__PURE__*/
|
433
|
+
React.createElement(ContentElementAttributesContext.Provider, {
|
434
|
+
value: attributes
|
435
|
+
}, children)
|
436
|
+
);
|
437
|
+
}
|
438
|
+
function useContentElementAttributes() {
|
439
|
+
return useContext(ContentElementAttributesContext);
|
440
|
+
}
|
441
|
+
|
442
|
+
var ContentElementLifecycleContext = createContext();
|
443
|
+
var LifecycleProvider = createScrollPositionLifecycleProvider(ContentElementLifecycleContext);
|
444
|
+
var useLifecycle = createScrollPositionLifecycleHook(ContentElementLifecycleContext);
|
445
|
+
function ContentElementLifecycleProvider(_ref) {
|
446
|
+
var type = _ref.type,
|
447
|
+
children = _ref.children;
|
448
|
+
|
449
|
+
var _api$contentElementTy = api.contentElementTypes.getOptions(type),
|
450
|
+
lifecycle = _api$contentElementTy.lifecycle;
|
451
|
+
|
452
|
+
if (lifecycle) {
|
453
|
+
return (
|
454
|
+
/*#__PURE__*/
|
455
|
+
React.createElement(LifecycleProvider, null, children)
|
456
|
+
);
|
457
|
+
} else {
|
458
|
+
return children;
|
459
|
+
}
|
460
|
+
}
|
461
|
+
/**
|
462
|
+
* Returns an object containing information about the scroll position
|
463
|
+
* related lifecylce of the content element. Requires the `lifecycle`
|
464
|
+
* option to be set to true in the `frontend.contentElements.register`
|
465
|
+
* call for the content element's type.
|
466
|
+
*
|
467
|
+
* * `shouldLoad` is true if the content element should start lazy
|
468
|
+
* load. Becomes true before `shouldPrepare`.
|
469
|
+
*
|
470
|
+
* * `shouldPrepare` is true if the content element is about to enter
|
471
|
+
* the viewport.
|
472
|
+
*
|
473
|
+
* * `isActive` is true if the content element is completely in the
|
474
|
+
* viewport.
|
475
|
+
*
|
476
|
+
* @param {Function} onActivate -
|
477
|
+
* Invoked when content element has entered the viewport.
|
478
|
+
*
|
479
|
+
* @param {Function} onDeactivate -
|
480
|
+
* Invoked when content element has left the viewport.
|
481
|
+
*
|
482
|
+
* @example
|
483
|
+
*
|
484
|
+
* const {isActive, shouldPrepare} = useContentElementLifecycle();
|
485
|
+
*/
|
486
|
+
|
487
|
+
function useContentElementLifecycle(options) {
|
488
|
+
var result = useLifecycle(options);
|
489
|
+
|
490
|
+
if (!result) {
|
491
|
+
throw new Error('useContentElementLifecycle is only available in ' + 'content elements for which `lifecycle: true` has ' + 'been passed to frontend.contentElements.register');
|
492
|
+
}
|
493
|
+
|
494
|
+
return result;
|
495
|
+
}
|
496
|
+
|
497
|
+
var styles$3 = {"wrapper":"ContentElementMargin-module_wrapper__20kIk"};
|
498
|
+
|
499
|
+
function ContentElementMargin(_ref) {
|
500
|
+
var position = _ref.position,
|
501
|
+
children = _ref.children;
|
502
|
+
|
503
|
+
if (position === 'full') {
|
504
|
+
return children;
|
505
|
+
}
|
506
|
+
|
507
|
+
return (
|
508
|
+
/*#__PURE__*/
|
509
|
+
React.createElement("div", {
|
510
|
+
className: styles$3.wrapper
|
511
|
+
}, children)
|
512
|
+
);
|
513
|
+
}
|
514
|
+
|
515
|
+
var styles$4 = {"missing":"ContentElement-module_missing__2_1j9"};
|
516
|
+
|
517
|
+
function _createSuper(Derived) {
|
518
|
+
function isNativeReflectConstruct() {
|
519
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
520
|
+
if (Reflect.construct.sham) return false;
|
521
|
+
if (typeof Proxy === "function") return true;
|
522
|
+
|
523
|
+
try {
|
524
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
525
|
+
return true;
|
526
|
+
} catch (e) {
|
527
|
+
return false;
|
528
|
+
}
|
529
|
+
}
|
530
|
+
|
531
|
+
return function () {
|
532
|
+
var Super = _getPrototypeOf(Derived),
|
533
|
+
result;
|
534
|
+
|
535
|
+
if (isNativeReflectConstruct()) {
|
536
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
537
|
+
|
538
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
539
|
+
} else {
|
540
|
+
result = Super.apply(this, arguments);
|
541
|
+
}
|
542
|
+
|
543
|
+
return _possibleConstructorReturn(this, result);
|
544
|
+
};
|
545
|
+
}
|
546
|
+
var ContentElementErrorBoundary =
|
547
|
+
/*#__PURE__*/
|
548
|
+
function (_React$Component) {
|
549
|
+
_inherits(ContentElementErrorBoundary, _React$Component);
|
550
|
+
|
551
|
+
var _super = _createSuper(ContentElementErrorBoundary);
|
552
|
+
|
553
|
+
function ContentElementErrorBoundary(props) {
|
554
|
+
var _this;
|
555
|
+
|
556
|
+
_classCallCheck(this, ContentElementErrorBoundary);
|
557
|
+
|
558
|
+
_this = _super.call(this, props);
|
559
|
+
_this.state = {
|
560
|
+
hasError: false
|
561
|
+
};
|
562
|
+
return _this;
|
563
|
+
}
|
564
|
+
|
565
|
+
_createClass(ContentElementErrorBoundary, [{
|
566
|
+
key: "render",
|
567
|
+
value: function render() {
|
568
|
+
if (this.state.hasError) {
|
569
|
+
return (
|
570
|
+
/*#__PURE__*/
|
571
|
+
React.createElement("div", {
|
572
|
+
className: styles$4.missing
|
573
|
+
}, "Error rendering element of type \"", this.props.type, "\"")
|
574
|
+
);
|
575
|
+
}
|
576
|
+
|
577
|
+
return this.props.children;
|
578
|
+
}
|
579
|
+
}], [{
|
580
|
+
key: "getDerivedStateFromError",
|
581
|
+
value: function getDerivedStateFromError(error) {
|
582
|
+
return {
|
583
|
+
hasError: true
|
584
|
+
};
|
585
|
+
}
|
586
|
+
}]);
|
587
|
+
|
588
|
+
return ContentElementErrorBoundary;
|
589
|
+
}(React.Component);
|
590
|
+
|
591
|
+
var ContentElement = withInlineEditingDecorator('ContentElementDecorator', function ContentElement(props) {
|
592
|
+
var Component = api.contentElementTypes.getComponent(props.type);
|
593
|
+
|
594
|
+
if (Component) {
|
595
|
+
return (
|
596
|
+
/*#__PURE__*/
|
597
|
+
React.createElement(ContentElementAttributesProvider, {
|
598
|
+
id: props.id
|
599
|
+
},
|
600
|
+
/*#__PURE__*/
|
601
|
+
React.createElement(ContentElementLifecycleProvider, {
|
602
|
+
type: props.type
|
603
|
+
},
|
604
|
+
/*#__PURE__*/
|
605
|
+
React.createElement(ContentElementMargin, {
|
606
|
+
position: props.itemProps.position
|
607
|
+
},
|
608
|
+
/*#__PURE__*/
|
609
|
+
React.createElement(ContentElementErrorBoundary, {
|
610
|
+
type: props.type
|
611
|
+
},
|
612
|
+
/*#__PURE__*/
|
613
|
+
React.createElement(Component, {
|
614
|
+
sectionProps: props.sectionProps,
|
615
|
+
configuration: props.itemProps,
|
616
|
+
contentElementId: props.id
|
617
|
+
})))))
|
618
|
+
);
|
619
|
+
} else {
|
620
|
+
return (
|
621
|
+
/*#__PURE__*/
|
622
|
+
React.createElement("div", {
|
623
|
+
className: styles$4.missing
|
624
|
+
}, "Element of unknown type \"", props.type, "\"")
|
625
|
+
);
|
626
|
+
}
|
627
|
+
});
|
628
|
+
ContentElement.defaultProps = {
|
629
|
+
itemProps: {}
|
630
|
+
};
|
631
|
+
|
632
|
+
function ContentElements(props) {
|
633
|
+
return (
|
634
|
+
/*#__PURE__*/
|
635
|
+
React.createElement(React.Fragment, null, props.items.map(function (item, index) {
|
636
|
+
return props.children(item,
|
637
|
+
/*#__PURE__*/
|
638
|
+
React.createElement(MemoizedContentElement, {
|
639
|
+
key: item.id,
|
640
|
+
id: item.id,
|
641
|
+
permaId: item.permaId,
|
642
|
+
type: item.type,
|
643
|
+
first: index === 0,
|
644
|
+
position: item.position,
|
645
|
+
itemProps: item.props,
|
646
|
+
sectionProps: props.sectionProps
|
647
|
+
}), index);
|
648
|
+
}))
|
649
|
+
);
|
650
|
+
}
|
651
|
+
var MemoizedContentElement = React.memo(ContentElement, function (prevProps, nextProps) {
|
652
|
+
return prevProps.id === nextProps.id && prevProps.permaId === nextProps.permaId && prevProps.type === nextProps.type && prevProps.position === nextProps.position && prevProps.itemProps === nextProps.itemProps && prevProps.sectionProps === nextProps.sectionProps;
|
653
|
+
});
|
654
|
+
ContentElements.defaultProps = {
|
655
|
+
children: function children(item, child) {
|
656
|
+
return child;
|
657
|
+
}
|
658
|
+
};
|
659
|
+
|
660
|
+
function useNarrowViewport() {
|
661
|
+
return useMediaQuery('(max-width: 950px)');
|
662
|
+
}
|
663
|
+
|
664
|
+
var styles$5 = {"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","wide":"TwoColumn-module_wide__xdF_t","wideViewport":"TwoColumn-module_wideViewport___c_Zz","right":"TwoColumn-module_right__Fr52a","narrowViewport":"TwoColumn-module_narrowViewport__1x_NY"};
|
665
|
+
|
666
|
+
function availablePositions(narrow) {
|
667
|
+
if (narrow) {
|
668
|
+
return ['inline', 'wide', 'full'];
|
669
|
+
} else {
|
670
|
+
return ['inline', 'sticky', 'wide', 'full'];
|
671
|
+
}
|
672
|
+
}
|
673
|
+
|
674
|
+
function TwoColumn(props) {
|
675
|
+
var narrow = useNarrowViewport();
|
676
|
+
return (
|
677
|
+
/*#__PURE__*/
|
678
|
+
React.createElement("div", {
|
679
|
+
className: classNames(styles$5.root, styles$5[props.align], narrow ? styles$5.narrowViewport : styles$5.wideViewport)
|
680
|
+
},
|
681
|
+
/*#__PURE__*/
|
682
|
+
React.createElement("div", {
|
683
|
+
className: classNames(styles$5.group),
|
684
|
+
key: props.align
|
685
|
+
},
|
686
|
+
/*#__PURE__*/
|
687
|
+
React.createElement("div", {
|
688
|
+
className: styles$5.inline,
|
689
|
+
ref: props.contentAreaRef
|
690
|
+
})), renderItems(props, narrow), renderPlaceholder(props.placeholder))
|
691
|
+
);
|
692
|
+
}
|
693
|
+
TwoColumn.defaultProps = {
|
694
|
+
align: 'left'
|
695
|
+
};
|
696
|
+
|
697
|
+
function renderItems(props, narrow) {
|
698
|
+
return groupItemsByPosition(props.items, availablePositions(narrow)).map(function (group, index) {
|
699
|
+
return (
|
700
|
+
/*#__PURE__*/
|
701
|
+
React.createElement("div", {
|
702
|
+
key: index,
|
703
|
+
className: classNames(styles$5.group, styles$5["group-".concat(group.position)])
|
704
|
+
}, renderItemGroup(props, group, 'sticky'), renderItemGroup(props, group, 'inline'), renderItemGroup(props, group, 'wide'), renderItemGroup(props, group, 'full'))
|
705
|
+
);
|
706
|
+
});
|
707
|
+
}
|
708
|
+
|
709
|
+
function renderItemGroup(props, group, position) {
|
710
|
+
if (group[position].length) {
|
711
|
+
return (
|
712
|
+
/*#__PURE__*/
|
713
|
+
React.createElement("div", {
|
714
|
+
className: styles$5[position]
|
715
|
+
}, props.children(
|
716
|
+
/*#__PURE__*/
|
717
|
+
React.createElement(ContentElements, {
|
718
|
+
sectionProps: props.sectionProps,
|
719
|
+
items: group[position]
|
720
|
+
}), {
|
721
|
+
position: position,
|
722
|
+
openStart: position === 'inline' && group.openStart,
|
723
|
+
openEnd: position === 'inline' && group.openEnd
|
724
|
+
}))
|
725
|
+
);
|
726
|
+
}
|
727
|
+
}
|
728
|
+
|
729
|
+
function groupItemsByPosition(items, availablePositions) {
|
730
|
+
var groups = [];
|
731
|
+
var currentGroup;
|
732
|
+
items.reduce(function (previousItemPosition, item, index) {
|
733
|
+
var position = availablePositions.indexOf(item.position) >= 0 ? item.position : 'inline';
|
734
|
+
|
735
|
+
if (!previousItemPosition || previousItemPosition !== position && !(previousItemPosition === 'sticky' && position === 'inline')) {
|
736
|
+
currentGroup = {
|
737
|
+
position: position,
|
738
|
+
sticky: [],
|
739
|
+
inline: [],
|
740
|
+
wide: [],
|
741
|
+
full: []
|
742
|
+
};
|
743
|
+
groups = [].concat(_toConsumableArray(groups), [currentGroup]);
|
744
|
+
}
|
745
|
+
|
746
|
+
currentGroup[position].push(item);
|
747
|
+
return position;
|
748
|
+
}, null);
|
749
|
+
groups.forEach(function (group, index) {
|
750
|
+
var previous = groups[index - 1];
|
751
|
+
var next = groups[index + 1];
|
752
|
+
group.openStart = previous && !(previous.full.length || previous.wide.length);
|
753
|
+
group.openEnd = next && next.inline.length > 0;
|
754
|
+
});
|
755
|
+
return groups;
|
756
|
+
}
|
757
|
+
|
758
|
+
function renderPlaceholder(placeholder) {
|
759
|
+
if (!placeholder) {
|
760
|
+
return null;
|
761
|
+
}
|
762
|
+
|
763
|
+
return (
|
764
|
+
/*#__PURE__*/
|
765
|
+
React.createElement("div", {
|
766
|
+
className: classNames(styles$5.group)
|
767
|
+
},
|
768
|
+
/*#__PURE__*/
|
769
|
+
React.createElement("div", {
|
770
|
+
className: styles$5.inline
|
771
|
+
}, placeholder))
|
772
|
+
);
|
773
|
+
}
|
774
|
+
|
775
|
+
var styles$6 = {"outer":"Center-module_outer__3Rr0H","outer-full":"Center-module_outer-full__3dknO","item":"Center-module_item__1KSs3","item-wide":"Center-module_item-wide__2shH7","item-full":"Center-module_item-full__1cEuv","clear":"Center-module_clear__jJEap","inner-left":"Center-module_inner-left__2z9Ea","inner-right":"Center-module_inner-right__KBkVt"};
|
776
|
+
|
777
|
+
function Center(props) {
|
778
|
+
return (
|
779
|
+
/*#__PURE__*/
|
780
|
+
React.createElement("div", {
|
781
|
+
className: classNames(styles$6.root)
|
782
|
+
},
|
783
|
+
/*#__PURE__*/
|
784
|
+
React.createElement("div", {
|
785
|
+
ref: props.contentAreaRef
|
786
|
+
}),
|
787
|
+
/*#__PURE__*/
|
788
|
+
React.createElement(ContentElements, {
|
789
|
+
sectionProps: props.sectionProps,
|
790
|
+
items: props.items
|
791
|
+
}, function (item, child, index) {
|
792
|
+
return (
|
793
|
+
/*#__PURE__*/
|
794
|
+
React.createElement("div", {
|
795
|
+
key: item.id,
|
796
|
+
className: outerClassName(item)
|
797
|
+
},
|
798
|
+
/*#__PURE__*/
|
799
|
+
React.createElement("div", {
|
800
|
+
className: classNames(styles$6.item, styles$6["item-".concat(item.position)])
|
801
|
+
}, props.children(
|
802
|
+
/*#__PURE__*/
|
803
|
+
React.createElement("div", {
|
804
|
+
className: styles$6["inner-".concat(item.position)]
|
805
|
+
}, child), boxProps(props.items, item, index))))
|
806
|
+
);
|
807
|
+
}), renderPlaceholder$1(props.placeholder))
|
808
|
+
);
|
809
|
+
}
|
810
|
+
|
811
|
+
function outerClassName(item) {
|
812
|
+
var _api$contentElementTy = api.contentElementTypes.getOptions(item.type),
|
813
|
+
supportsWrappingAroundFloats = _api$contentElementTy.supportsWrappingAroundFloats;
|
814
|
+
|
815
|
+
return classNames(styles$6.outer, styles$6["outer-".concat(item.position)], _defineProperty({}, styles$6.clear, !supportsWrappingAroundFloats));
|
816
|
+
}
|
817
|
+
|
818
|
+
function boxProps(items, item, index) {
|
819
|
+
var previous = items[index - 1];
|
820
|
+
var next = items[index + 1];
|
821
|
+
return {
|
822
|
+
position: item.position,
|
823
|
+
openStart: previous && item.position !== 'full' && previous.position !== 'full' && item.position !== 'wide' && previous.position !== 'wide',
|
824
|
+
openEnd: next && item.position !== 'full' && next.position !== 'full' && item.position !== 'wide' && next.position !== 'wide'
|
825
|
+
};
|
826
|
+
}
|
827
|
+
|
828
|
+
function renderPlaceholder$1(placeholder) {
|
829
|
+
if (!placeholder) {
|
830
|
+
return null;
|
831
|
+
}
|
832
|
+
|
833
|
+
return (
|
834
|
+
/*#__PURE__*/
|
835
|
+
React.createElement("div", {
|
836
|
+
className: classNames(styles$6.outer)
|
837
|
+
},
|
838
|
+
/*#__PURE__*/
|
839
|
+
React.createElement("div", {
|
840
|
+
className: classNames(styles$6.item)
|
841
|
+
}, placeholder))
|
842
|
+
);
|
843
|
+
}
|
844
|
+
|
845
|
+
var Layout = React.memo(withInlineEditingAlternative('LayoutWithPlaceholder', LayoutWithoutInlineEditing), function (prevProps, nextProps) {
|
846
|
+
return prevProps.sectionId === nextProps.sectionId && prevProps.items === nextProps.items && prevProps.appearance === nextProps.appearance && prevProps.contentAreaRef === nextProps.contentAreaRef && prevProps.sectionProps === nextProps.sectionProps;
|
847
|
+
});
|
848
|
+
function LayoutWithoutInlineEditing(props) {
|
849
|
+
if (props.sectionProps.layout === 'center') {
|
850
|
+
return (
|
851
|
+
/*#__PURE__*/
|
852
|
+
React.createElement(Center, props)
|
853
|
+
);
|
854
|
+
} else if (props.sectionProps.layout === 'right') {
|
855
|
+
return (
|
856
|
+
/*#__PURE__*/
|
857
|
+
React.createElement(TwoColumn, Object.assign({
|
858
|
+
align: "right"
|
859
|
+
}, props))
|
860
|
+
);
|
861
|
+
} else {
|
862
|
+
return (
|
863
|
+
/*#__PURE__*/
|
864
|
+
React.createElement(TwoColumn, props)
|
865
|
+
);
|
866
|
+
}
|
867
|
+
}
|
868
|
+
Layout.defaultProps = {
|
869
|
+
layout: 'left'
|
870
|
+
};
|
871
|
+
|
872
|
+
function usePostMessageListener(receiveData) {
|
873
|
+
useEffect(function () {
|
874
|
+
if (window.parent !== window) {
|
875
|
+
window.addEventListener('message', receive);
|
876
|
+
}
|
877
|
+
|
878
|
+
return function () {
|
879
|
+
return window.removeEventListener('message', receive);
|
880
|
+
};
|
881
|
+
|
882
|
+
function receive(message) {
|
883
|
+
if (window.location.href.indexOf(message.origin) === 0) {
|
884
|
+
receiveData(message.data);
|
885
|
+
}
|
886
|
+
}
|
887
|
+
}, [receiveData]);
|
888
|
+
}
|
889
|
+
|
890
|
+
var styles$7 = {"text-s":"20px","text-base":"22px","text-l":"40px","text-xl":"66px","text-2xl":"110px","h2":"Text-module_h2__34chJ","h1":"Text-module_h1__2_5kX","body":"Text-module_body__4oWD-","caption":"Text-module_caption__3_6Au"};
|
891
|
+
|
892
|
+
/**
|
893
|
+
* Render some text using the default typography scale.
|
894
|
+
*
|
895
|
+
* @param {Object} props
|
896
|
+
* @param {string} props.scaleCategory - One of the styles `'h1'`, `'h2'`, `'body'`, `'caption'`.
|
897
|
+
* @param {string} [props.inline] - Render a span instread of a div.
|
898
|
+
* @param {string} props.children - Nodes to render with specified typography.
|
899
|
+
*/
|
900
|
+
|
901
|
+
function Text(_ref) {
|
902
|
+
var inline = _ref.inline,
|
903
|
+
scaleCategory = _ref.scaleCategory,
|
904
|
+
children = _ref.children;
|
905
|
+
return React.createElement(inline ? 'span' : 'div', {
|
906
|
+
className: styles$7[scaleCategory]
|
907
|
+
}, children);
|
908
|
+
}
|
909
|
+
|
910
|
+
var ContentElementConfigurationUpdateContext = React.createContext(function () {});
|
911
|
+
function useContentElementConfigurationUpdate() {
|
912
|
+
return useContext(ContentElementConfigurationUpdateContext);
|
913
|
+
}
|
914
|
+
|
915
|
+
var ContentElementEditorCommandEmitterContext = createContext({
|
916
|
+
on: function on() {},
|
917
|
+
off: function off() {}
|
918
|
+
});
|
919
|
+
function useContentElementEditorCommandSubscription(callback) {
|
920
|
+
var _useContentElementAtt = useContentElementAttributes(),
|
921
|
+
contentElementId = _useContentElementAtt.contentElementId;
|
922
|
+
|
923
|
+
var emitter = useContext(ContentElementEditorCommandEmitterContext);
|
924
|
+
useEffect(function () {
|
925
|
+
emitter.on("command:".concat(contentElementId), callback);
|
926
|
+
return function () {
|
927
|
+
return emitter.off("command:".concat(contentElementId), callback);
|
928
|
+
};
|
929
|
+
}, [emitter, callback, contentElementId]);
|
930
|
+
}
|
931
|
+
|
932
|
+
var ContentElementEditorStateContext = createContext({
|
933
|
+
isSelected: false,
|
934
|
+
isEditable: false,
|
935
|
+
setTransientState: function setTransientState() {}
|
936
|
+
});
|
937
|
+
/**
|
938
|
+
* Use inside a content element component to determine whether the
|
939
|
+
* component is being rendered inside the editor iframe, and whether
|
940
|
+
* the content element is currently selected. This can be used to
|
941
|
+
* implement simple inline editing capabilities like displaying extra
|
942
|
+
* information when the content element is selected.
|
943
|
+
*
|
944
|
+
* @example
|
945
|
+
* const {isEditable, isSelected} = useContentElementEditorState();
|
946
|
+
*/
|
947
|
+
|
948
|
+
function useContentElementEditorState() {
|
949
|
+
return useContext(ContentElementEditorStateContext);
|
950
|
+
}
|
951
|
+
|
952
|
+
var EditableText = withInlineEditingAlternative('EditableText', function EditableText(_ref) {
|
953
|
+
var value = _ref.value;
|
954
|
+
return (
|
955
|
+
/*#__PURE__*/
|
956
|
+
React.createElement(Text, {
|
957
|
+
scaleCategory: "body"
|
958
|
+
}, render(value))
|
959
|
+
);
|
960
|
+
});
|
961
|
+
|
962
|
+
function render() {
|
963
|
+
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
964
|
+
return children.map(function (element, index) {
|
965
|
+
if (element.type) {
|
966
|
+
return renderElement({
|
967
|
+
attributes: {
|
968
|
+
key: index
|
969
|
+
},
|
970
|
+
element: element,
|
971
|
+
children: render(element.children)
|
972
|
+
});
|
973
|
+
} else {
|
974
|
+
return renderLeaf({
|
975
|
+
attributes: {
|
976
|
+
key: index
|
977
|
+
},
|
978
|
+
leaf: element,
|
979
|
+
children: element.text.trim() === '' ? "\uFEFF" : element.text
|
980
|
+
});
|
981
|
+
}
|
982
|
+
});
|
983
|
+
}
|
984
|
+
|
985
|
+
function renderElement(_ref2) {
|
986
|
+
var attributes = _ref2.attributes,
|
987
|
+
children = _ref2.children,
|
988
|
+
element = _ref2.element;
|
989
|
+
|
990
|
+
switch (element.type) {
|
991
|
+
case 'block-quote':
|
992
|
+
return (
|
993
|
+
/*#__PURE__*/
|
994
|
+
React.createElement("blockquote", attributes, children)
|
995
|
+
);
|
996
|
+
|
997
|
+
case 'bulleted-list':
|
998
|
+
return (
|
999
|
+
/*#__PURE__*/
|
1000
|
+
React.createElement("ul", attributes, children)
|
1001
|
+
);
|
1002
|
+
|
1003
|
+
case 'numbered-list':
|
1004
|
+
return (
|
1005
|
+
/*#__PURE__*/
|
1006
|
+
React.createElement("ol", attributes, children)
|
1007
|
+
);
|
1008
|
+
|
1009
|
+
case 'list-item':
|
1010
|
+
return (
|
1011
|
+
/*#__PURE__*/
|
1012
|
+
React.createElement("li", attributes, children)
|
1013
|
+
);
|
1014
|
+
|
1015
|
+
case 'heading':
|
1016
|
+
return (
|
1017
|
+
/*#__PURE__*/
|
1018
|
+
React.createElement("h2", attributes, children)
|
1019
|
+
);
|
1020
|
+
|
1021
|
+
case 'link':
|
1022
|
+
return (
|
1023
|
+
/*#__PURE__*/
|
1024
|
+
React.createElement("a", Object.assign({}, attributes, {
|
1025
|
+
href: element.href
|
1026
|
+
}), children)
|
1027
|
+
);
|
1028
|
+
|
1029
|
+
default:
|
1030
|
+
return (
|
1031
|
+
/*#__PURE__*/
|
1032
|
+
React.createElement("p", attributes, children)
|
1033
|
+
);
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
function renderLeaf(_ref3) {
|
1037
|
+
var attributes = _ref3.attributes,
|
1038
|
+
children = _ref3.children,
|
1039
|
+
leaf = _ref3.leaf;
|
1040
|
+
|
1041
|
+
if (leaf.bold) {
|
1042
|
+
children =
|
1043
|
+
/*#__PURE__*/
|
1044
|
+
React.createElement("strong", null, children);
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
if (leaf.italic) {
|
1048
|
+
children =
|
1049
|
+
/*#__PURE__*/
|
1050
|
+
React.createElement("em", null, children);
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
if (leaf.underline) {
|
1054
|
+
children =
|
1055
|
+
/*#__PURE__*/
|
1056
|
+
React.createElement("u", null, children);
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
if (leaf.strikethrough) {
|
1060
|
+
children =
|
1061
|
+
/*#__PURE__*/
|
1062
|
+
React.createElement("s", null, children);
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
return (
|
1066
|
+
/*#__PURE__*/
|
1067
|
+
React.createElement("span", attributes, children)
|
1068
|
+
);
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
export { ContentElementEditorCommandEmitterContext as C, EditableText as E, Foreground as F, Layout as L, MotifArea as M, PhonePlatformContext as P, StaticPreview as S, Text as T, createScrollPositionLifecycleHook as a, useMediaQuery as b, createScrollPositionLifecycleProvider as c, usePostMessageListener as d, withInlineEditingAlternative as e, api as f, useContentElementConfigurationUpdate as g, useContentElementEditorCommandSubscription as h, useContentElementEditorState as i, useContentElementLifecycle as j, useOnScreen as k, loadInlineEditingComponents as l, MotifAreaVisibilityProvider as m, ForcePaddingContext as n, ContentElementConfigurationUpdateContext as o, ContentElementEditorStateContext as p, LayoutWithoutInlineEditing as q, renderElement as r, renderLeaf as s, useIsStaticPreview as u, withInlineEditingDecorator as w };
|