maglevcms 2.1.0 → 3.0.0.beta2
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.
- checksums.yaml +4 -4
- data/README.md +53 -13
- data/Rakefile +0 -4
- data/app/assets/builds/maglev/tailwind.css +14393 -0
- data/app/assets/config/maglev_manifest.js +7 -0
- data/app/assets/javascripts/maglev/client/dom-operations.js +282 -0
- data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/iframe-decorator.js +81 -15
- data/app/{frontend/live-preview-client/message.js → assets/javascripts/maglev/client/incoming-messages.js} +14 -12
- data/app/assets/javascripts/maglev/client/index.js +26 -0
- data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/utils.js +4 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/forms/section_form_controller.js +46 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/forms/style_form_controller.js +19 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/index.js +15 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/page_preview_controller.js +163 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/preview_notification_center_controller.js +151 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/setting_controller.js +42 -0
- data/app/assets/javascripts/maglev/editor/controllers/application.js +9 -0
- data/app/assets/javascripts/maglev/editor/controllers/index.js +3 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/auto_save_controller.js +16 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/broken_image_controller.js +16 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/copy_to_clipboard_controller.js +36 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/disappearance_controller.js +21 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/dispatcher_controller.js +12 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/form_refresh_controller.js +15 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/index.js +27 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/max_length_controller.js +30 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/prevent_same_path.js +20 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/reload_page_controller.js +7 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/sortable_controller.js +64 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/submit_button_controller.js +45 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/transition_controller.js +14 -0
- data/app/assets/javascripts/maglev/editor/controllers/uikit.js +39 -0
- data/app/assets/javascripts/maglev/editor/controllers/utils.js +10 -0
- data/app/assets/javascripts/maglev/editor/index.js +66 -0
- data/app/assets/stylesheets/maglev/application.css +88 -0
- data/app/{frontend/editor/design/components/rich-text-editor.scss → assets/stylesheets/maglev/tailwind.css.erb} +30 -15
- data/app/components/maglev/editor/setting_registry.rb +59 -0
- data/app/components/maglev/editor/settings/base_component.rb +55 -0
- data/app/components/maglev/editor/settings/checkbox/checkbox_component.html.erb +16 -0
- data/app/components/maglev/editor/settings/checkbox/checkbox_component.rb +12 -0
- data/app/components/maglev/editor/settings/collection_item/collection_item_component.html.erb +25 -0
- data/app/components/maglev/editor/settings/collection_item/collection_item_component.rb +19 -0
- data/app/components/maglev/editor/settings/color/color_component.html.erb +17 -0
- data/app/components/maglev/editor/settings/color/color_component.rb +12 -0
- data/app/components/maglev/editor/settings/divider/divider_component.html.erb +12 -0
- data/app/components/maglev/editor/settings/divider/divider_component.rb +15 -0
- data/app/components/maglev/editor/settings/hint/hint_component.html.erb +3 -0
- data/app/components/maglev/editor/settings/hint/hint_component.rb +12 -0
- data/app/components/maglev/editor/settings/icon/icon_component.html.erb +21 -0
- data/app/components/maglev/editor/settings/icon/icon_component.rb +15 -0
- data/app/components/maglev/editor/settings/image/image_component.html.erb +26 -0
- data/app/components/maglev/editor/settings/image/image_component.rb +23 -0
- data/app/components/maglev/editor/settings/link/link_component.html.erb +22 -0
- data/app/components/maglev/editor/settings/link/link_component.rb +19 -0
- data/app/components/maglev/editor/settings/select/select_component.html.erb +20 -0
- data/app/components/maglev/editor/settings/select/select_component.rb +27 -0
- data/app/components/maglev/editor/settings/text/richtext_component.html.erb +22 -0
- data/app/components/maglev/editor/settings/text/richtext_component.rb +12 -0
- data/app/components/maglev/editor/settings/text/text_component.html.erb +18 -0
- data/app/components/maglev/editor/settings/text/text_component.rb +12 -0
- data/app/components/maglev/editor/settings/text/textarea_component.html.erb +21 -0
- data/app/components/maglev/editor/settings/text/textarea_component.rb +12 -0
- data/app/components/maglev/editor/settings_group_component.html.erb +5 -0
- data/app/components/maglev/editor/settings_group_component.rb +30 -0
- data/app/components/maglev/section_component.rb +10 -7
- data/app/components/maglev/uikit/app_layout/layout_component.html.erb +15 -0
- data/app/components/maglev/uikit/app_layout/layout_component.rb +19 -0
- data/app/components/maglev/uikit/app_layout/sidebar/link_component.html.erb +5 -0
- data/app/components/maglev/uikit/app_layout/sidebar/link_component.rb +40 -0
- data/app/components/maglev/uikit/app_layout/sidebar_component.html.erb +19 -0
- data/app/components/maglev/uikit/app_layout/sidebar_component.rb +11 -0
- data/app/components/maglev/uikit/app_layout/topbar/logo_component.html.erb +3 -0
- data/app/components/maglev/uikit/app_layout/topbar/logo_component.rb +18 -0
- data/app/components/maglev/uikit/app_layout/topbar/page_info_component.html.erb +26 -0
- data/app/components/maglev/uikit/app_layout/topbar/page_info_component.rb +28 -0
- data/app/components/maglev/uikit/app_layout/topbar_component.html.erb +15 -0
- data/app/components/maglev/uikit/app_layout/topbar_component.rb +21 -0
- data/app/components/maglev/uikit/badge_component.rb +40 -0
- data/app/components/maglev/uikit/base_component.rb +15 -0
- data/app/components/maglev/uikit/breadcrumbs/breadcrumbs_component.html.erb +10 -0
- data/app/components/maglev/uikit/breadcrumbs/breadcrumbs_component.rb +11 -0
- data/app/components/maglev/uikit/breadcrumbs/link_component.html.erb +12 -0
- data/app/components/maglev/uikit/breadcrumbs/link_component.rb +25 -0
- data/app/components/maglev/uikit/collapsible/collapsible_component.html.erb +5 -0
- data/app/components/maglev/uikit/collapsible/collapsible_component.rb +11 -0
- data/app/components/maglev/uikit/collapsible/collapsible_controller.js +9 -0
- data/app/components/maglev/uikit/collapsible/item_component.html.erb +17 -0
- data/app/components/maglev/uikit/collapsible/item_component.rb +11 -0
- data/app/components/maglev/uikit/device_toggler_component/device_toggler_component.html.erb +16 -0
- data/app/components/maglev/uikit/device_toggler_component/device_toggler_controller.js +25 -0
- data/app/components/maglev/uikit/device_toggler_component.rb +28 -0
- data/app/components/maglev/uikit/dropdown_component/dropdown_component.html.erb +18 -0
- data/app/components/maglev/uikit/dropdown_component/dropdown_controller.js +69 -0
- data/app/components/maglev/uikit/dropdown_component.rb +15 -0
- data/app/components/maglev/uikit/form/checkbox_component.html.erb +17 -0
- data/app/components/maglev/uikit/form/checkbox_component.rb +26 -0
- data/app/components/maglev/uikit/form/checkbox_controller.js +7 -0
- data/app/components/maglev/uikit/form/color_field_component.html.erb +76 -0
- data/app/components/maglev/uikit/form/color_field_component.rb +57 -0
- data/app/components/maglev/uikit/form/color_field_controller.js +25 -0
- data/app/components/maglev/uikit/form/combobox/list_component.html.erb +14 -0
- data/app/components/maglev/uikit/form/combobox/list_component.rb +13 -0
- data/app/components/maglev/uikit/form/combobox/option_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/combobox/option_component.rb +22 -0
- data/app/components/maglev/uikit/form/combobox_component.html.erb +75 -0
- data/app/components/maglev/uikit/form/combobox_component.rb +64 -0
- data/app/components/maglev/uikit/form/combobox_controller.js +385 -0
- data/app/components/maglev/uikit/form/icon_field_component.html.erb +76 -0
- data/app/components/maglev/uikit/form/icon_field_component.rb +35 -0
- data/app/components/maglev/uikit/form/icon_field_controller.js +38 -0
- data/app/components/maglev/uikit/form/image_field_component.html.erb +101 -0
- data/app/components/maglev/uikit/form/image_field_component.rb +52 -0
- data/app/components/maglev/uikit/form/image_field_controller.js +74 -0
- data/app/components/maglev/uikit/form/link/base_component.rb +19 -0
- data/app/components/maglev/uikit/form/link/email_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/email_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/page_link_component.html.erb +17 -0
- data/app/components/maglev/uikit/form/link/page_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/static_page_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/static_page_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/url_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/url_link_component.rb +19 -0
- data/app/components/maglev/uikit/form/link_component.html.erb +55 -0
- data/app/components/maglev/uikit/form/link_component.rb +80 -0
- data/app/components/maglev/uikit/form/link_controller.js +36 -0
- data/app/components/maglev/uikit/form/richtext/block_button_component.html.erb +38 -0
- data/app/components/maglev/uikit/form/richtext/block_button_component.rb +22 -0
- data/app/components/maglev/uikit/form/richtext/button_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/richtext/button_component.rb +19 -0
- data/app/components/maglev/uikit/form/richtext/button_group_component.html.erb +7 -0
- data/app/components/maglev/uikit/form/richtext/button_group_component.rb +13 -0
- data/app/components/maglev/uikit/form/richtext/toolbar_component.html.erb +23 -0
- data/app/components/maglev/uikit/form/richtext/toolbar_component.rb +19 -0
- data/app/components/maglev/uikit/form/richtext_component.html.erb +28 -0
- data/app/components/maglev/uikit/form/richtext_component.rb +54 -0
- data/app/components/maglev/uikit/form/richtext_controller.js +248 -0
- data/app/components/maglev/uikit/form/search_form_component.html.erb +24 -0
- data/app/components/maglev/uikit/form/search_form_component.rb +42 -0
- data/app/components/maglev/uikit/form/search_form_controller.js +31 -0
- data/app/components/maglev/uikit/form/select_component.html.erb +19 -0
- data/app/components/maglev/uikit/form/select_component.rb +52 -0
- data/app/components/maglev/uikit/form/select_controller.js +7 -0
- data/app/components/maglev/uikit/form/text_field_component.html.erb +26 -0
- data/app/components/maglev/uikit/form/text_field_component.rb +42 -0
- data/app/components/maglev/uikit/form/text_field_controller.js +18 -0
- data/app/components/maglev/uikit/form/textarea_component.html.erb +43 -0
- data/app/components/maglev/uikit/form/textarea_component.rb +53 -0
- data/app/components/maglev/uikit/icon_button_component/icon_button_component.html.erb +3 -0
- data/app/components/maglev/uikit/icon_button_component.rb +18 -0
- data/app/components/maglev/uikit/icon_component.rb +140 -0
- data/app/components/maglev/uikit/image_library/card_component.html.erb +41 -0
- data/app/components/maglev/uikit/image_library/card_component.rb +52 -0
- data/app/components/maglev/uikit/image_library/list_component.html.erb +7 -0
- data/app/components/maglev/uikit/image_library/list_component.rb +11 -0
- data/app/components/maglev/uikit/image_library/uploader_component.html.erb +30 -0
- data/app/components/maglev/uikit/image_library/uploader_component.rb +29 -0
- data/app/components/maglev/uikit/image_library/uploader_controller.js +74 -0
- data/app/components/maglev/uikit/list/insert_button_component.html.erb +7 -0
- data/app/components/maglev/uikit/list/insert_button_component.rb +40 -0
- data/app/components/maglev/uikit/list/list_component.html.erb +17 -0
- data/app/components/maglev/uikit/list/list_component.rb +34 -0
- data/app/components/maglev/uikit/list/list_item_component.html.erb +47 -0
- data/app/components/maglev/uikit/list/list_item_component.rb +85 -0
- data/app/components/maglev/uikit/locale_switcher_component/locale_switcher_component.html.erb +22 -0
- data/app/components/maglev/uikit/locale_switcher_component.rb +18 -0
- data/app/components/maglev/uikit/menu_dropdown_component/menu_dropdown_component.html.erb +15 -0
- data/app/components/maglev/uikit/menu_dropdown_component.rb +32 -0
- data/app/components/maglev/uikit/modal_component/modal_component.html.erb +63 -0
- data/app/components/maglev/uikit/modal_component/modal_controller.js +47 -0
- data/app/components/maglev/uikit/modal_component.rb +33 -0
- data/app/components/maglev/uikit/page_actions_dropdown_component/page_actions_dropdown_component.html.erb +56 -0
- data/app/components/maglev/uikit/page_actions_dropdown_component.rb +24 -0
- data/app/components/maglev/uikit/page_layout_component/back_link_component.html.erb +4 -0
- data/app/components/maglev/uikit/page_layout_component/page_layout_component.html.erb +58 -0
- data/app/components/maglev/uikit/page_layout_component/page_layout_controller.js +34 -0
- data/app/components/maglev/uikit/page_layout_component.rb +42 -0
- data/app/components/maglev/uikit/pagination_component/pagination_component.html.erb +70 -0
- data/app/components/maglev/uikit/pagination_component.rb +25 -0
- data/app/components/maglev/uikit/section_toolbar/bottom_component.html.erb +13 -0
- data/app/components/maglev/uikit/section_toolbar/bottom_component.rb +27 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_component.html.erb +17 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_component.rb +18 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_controller.js +90 -0
- data/app/components/maglev/uikit/section_toolbar/top_left_corner_component.html.erb +16 -0
- data/app/components/maglev/uikit/section_toolbar/top_left_corner_component.rb +15 -0
- data/app/components/maglev/uikit/section_toolbar/top_right_corner_component.html.erb +28 -0
- data/app/components/maglev/uikit/section_toolbar/top_right_corner_component.rb +28 -0
- data/app/components/maglev/uikit/tabs_component/tabs_component.html.erb +35 -0
- data/app/components/maglev/uikit/tabs_component/tabs_controller.js +57 -0
- data/app/components/maglev/uikit/tabs_component.rb +71 -0
- data/app/controllers/concerns/maglev/content_locale_concern.rb +5 -1
- data/app/controllers/concerns/maglev/editor/errors_concern.rb +45 -0
- data/app/controllers/concerns/maglev/fetchers_concern.rb +3 -6
- data/app/controllers/concerns/maglev/flash_i18n_concern.rb +11 -0
- data/app/controllers/maglev/application_controller.rb +1 -7
- data/app/controllers/maglev/editor/assets_controller.rb +59 -0
- data/app/controllers/maglev/editor/base_controller.rb +111 -0
- data/app/controllers/maglev/editor/combobox/collection_items_controller.rb +17 -0
- data/app/controllers/maglev/editor/combobox/pages_controller.rb +20 -0
- data/app/controllers/maglev/editor/home_controller.rb +25 -0
- data/app/controllers/maglev/editor/icons_controller.rb +24 -0
- data/app/controllers/maglev/editor/links_controller.rb +52 -0
- data/app/controllers/maglev/editor/page_clone_controller.rb +20 -0
- data/app/controllers/maglev/editor/pages_controller.rb +77 -0
- data/app/controllers/maglev/editor/publication_controller.rb +14 -0
- data/app/controllers/maglev/editor/section_blocks_controller.rb +101 -0
- data/app/controllers/maglev/editor/sections_controller.rb +96 -0
- data/app/controllers/maglev/editor/style_controller.rb +31 -0
- data/app/controllers/maglev/page_preview_controller.rb +1 -5
- data/app/controllers/maglev/published_page_preview_controller.rb +50 -0
- data/app/controllers/maglev/sitemap_controller.rb +1 -1
- data/app/helpers/maglev/application_helper.rb +148 -18
- data/app/helpers/maglev/editor/pages_helper.rb +23 -0
- data/app/helpers/maglev/editor/section_blocks_helper.rb +124 -0
- data/app/helpers/maglev/editor/settings_helper.rb +52 -0
- data/app/helpers/maglev/page_preview_helper.rb +1 -1
- data/app/lib/maglev/form/form_builder.rb +38 -0
- data/app/lib/maglev/form/inputs/check_box.rb +20 -0
- data/app/lib/maglev/form/inputs/combobox.rb +33 -0
- data/app/lib/maglev/form/inputs/image_field.rb +39 -0
- data/app/lib/maglev/form/inputs/richtext.rb +34 -0
- data/app/lib/maglev/form/inputs/select.rb +34 -0
- data/app/lib/maglev/form/inputs/text_field.rb +32 -0
- data/app/lib/maglev/form/inputs/textarea.rb +30 -0
- data/app/lib/maglev/turbo/streams/tag_builder.rb +17 -0
- data/app/models/concerns/maglev/content/enhanced_value_concern.rb +40 -0
- data/app/models/concerns/maglev/sections_concern.rb +30 -1
- data/app/models/concerns/maglev/translatable.rb +1 -2
- data/app/models/maglev/asset.rb +1 -3
- data/app/models/maglev/content/block_content.rb +96 -0
- data/app/models/maglev/content/editor_link.rb +49 -0
- data/app/models/maglev/content/section_content.rb +85 -0
- data/app/models/maglev/content/setting_content.rb +33 -0
- data/app/models/maglev/page/path_concern.rb +7 -0
- data/app/models/maglev/page/search_concern.rb +23 -4
- data/app/models/maglev/page.rb +3 -0
- data/app/models/maglev/section/block.rb +43 -6
- data/app/models/maglev/section/content_concern.rb +15 -1
- data/app/models/maglev/section/setting.rb +12 -0
- data/app/models/maglev/section.rb +52 -4
- data/app/models/maglev/sections_content_store.rb +36 -0
- data/app/models/maglev/setting_types/base.rb +8 -0
- data/app/models/maglev/setting_types/collection_item.rb +5 -1
- data/app/models/maglev/setting_types/image.rb +4 -0
- data/app/models/maglev/setting_types/link.rb +4 -0
- data/app/models/maglev/setting_types/text.rb +5 -0
- data/app/models/maglev/site/locales_concern.rb +4 -0
- data/app/models/maglev/site/style_value.rb +19 -13
- data/app/models/maglev/site.rb +4 -0
- data/app/models/maglev/theme/section_category.rb +6 -1
- data/app/models/maglev/theme/style_setting.rb +1 -1
- data/app/models/maglev/theme.rb +13 -0
- data/app/services/concerns/maglev/content/helpers_concern.rb +100 -0
- data/app/services/concerns/maglev/get_page_sections/transform_section_concern.rb +97 -0
- data/app/services/maglev/app_container.rb +27 -2
- data/app/services/maglev/content/add_section_block_service.rb +53 -0
- data/app/services/maglev/content/add_section_service.rb +99 -0
- data/app/services/maglev/content/delete_section_block_service.rb +45 -0
- data/app/services/maglev/content/delete_section_service.rb +34 -0
- data/app/services/maglev/content/sort_section_blocks_service.rb +47 -0
- data/app/services/maglev/content/update_section_block_service.rb +52 -0
- data/app/services/maglev/content/update_section_service.rb +50 -0
- data/app/services/maglev/create_page_service.rb +39 -0
- data/app/services/maglev/fetch_style.rb +22 -12
- data/app/services/maglev/get_base_url.rb +3 -1
- data/app/services/maglev/get_page_section_names.rb +1 -1
- data/app/services/maglev/get_page_sections.rb +11 -82
- data/app/services/maglev/get_published_page_sections_service.rb +48 -0
- data/app/services/maglev/persist_section_screenshot.rb +1 -1
- data/app/services/maglev/persist_style_service.rb +36 -0
- data/app/services/maglev/publish_service.rb +30 -0
- data/app/services/maglev/search_pages.rb +6 -2
- data/app/services/maglev/setup_pages.rb +44 -33
- data/app/views/layouts/maglev/editor/_head.html.erb +0 -0
- data/app/views/layouts/maglev/editor/_sidebar.html.erb +39 -0
- data/app/views/layouts/maglev/editor/_topbar.html.erb +45 -0
- data/app/views/layouts/maglev/editor/application.html.erb +67 -0
- data/app/views/maglev/editor/assets/_list.html.erb +33 -0
- data/app/views/maglev/editor/assets/index.html.erb +29 -0
- data/app/views/maglev/editor/combobox/collection_items/index.turbo_stream.erb +18 -0
- data/app/views/maglev/editor/combobox/pages/index.turbo_stream.erb +7 -0
- data/app/views/maglev/editor/home/index.html.erb +1 -0
- data/app/views/maglev/editor/icons/_list.html.erb +27 -0
- data/app/views/maglev/editor/icons/index.html.erb +23 -0
- data/app/views/maglev/editor/links/edit/_email.html.erb +5 -0
- data/app/views/maglev/editor/links/edit/_page.html.erb +29 -0
- data/app/views/maglev/editor/links/edit/_tabs.html.erb +11 -0
- data/app/views/maglev/editor/links/edit/_url.html.erb +7 -0
- data/app/views/maglev/editor/links/edit.html.erb +31 -0
- data/app/views/maglev/editor/links/update.turbo_stream.erb +9 -0
- data/app/views/maglev/editor/pages/_list.html.erb +28 -0
- data/app/views/maglev/editor/pages/_preview.html.erb +35 -0
- data/app/views/maglev/editor/pages/_preview_empty_message.html.erb +14 -0
- data/app/views/maglev/editor/pages/edit.html.erb +32 -0
- data/app/views/maglev/editor/pages/form/_main.html.erb +7 -0
- data/app/views/maglev/editor/pages/form/_seo.html.erb +11 -0
- data/app/views/maglev/editor/pages/form/_tabs.html.erb +8 -0
- data/app/views/maglev/editor/pages/index.html.erb +23 -0
- data/app/views/maglev/editor/pages/new.html.erb +28 -0
- data/app/views/maglev/editor/publication/create.turbo_stream.erb +1 -0
- data/app/views/maglev/editor/section_blocks/_form.html.erb +15 -0
- data/app/views/maglev/editor/section_blocks/_new.html.erb +21 -0
- data/app/views/maglev/editor/section_blocks/edit.html.erb +28 -0
- data/app/views/maglev/editor/section_blocks/index/_list.html.erb +41 -0
- data/app/views/maglev/editor/section_blocks/index/_tree.html.erb +56 -0
- data/app/views/maglev/editor/section_blocks/index.html.erb +20 -0
- data/app/views/maglev/editor/section_blocks/update.turbo_stream.erb +5 -0
- data/app/views/maglev/editor/sections/_form.html.erb +21 -0
- data/app/views/maglev/editor/sections/_list.html.erb +50 -0
- data/app/views/maglev/editor/sections/_theme_list.html.erb +32 -0
- data/app/views/maglev/editor/sections/_toolbar_list.html.erb +17 -0
- data/app/views/maglev/editor/sections/edit.html.erb +24 -0
- data/app/views/maglev/editor/sections/index.html.erb +11 -0
- data/app/views/maglev/editor/sections/new.html.erb +20 -0
- data/app/views/maglev/editor/sections/update.turbo_stream.erb +5 -0
- data/app/views/maglev/editor/shared/_button_label.html.erb +18 -0
- data/app/views/maglev/editor/shared/errors/not_authorized_error.turbo_stream.erb +17 -0
- data/app/views/maglev/editor/shared/errors/stale_object_error.turbo_stream.erb +21 -0
- data/app/views/maglev/editor/shared/errors/standard_error.turbo_stream.erb +17 -0
- data/app/views/maglev/editor/style/edit.html.erb +24 -0
- data/app/views/maglev/sitemap/index.xml.builder +1 -1
- data/config/client_importmap.rb +4 -0
- data/config/editor_importmap.rb +26 -0
- data/config/initializers/pagy.rb +3 -0
- data/config/locales/activerecord.ar.yml +20 -2
- data/config/locales/activerecord.en.yml +20 -2
- data/config/locales/activerecord.es.yml +15 -14
- data/config/locales/activerecord.fr.yml +15 -14
- data/config/locales/activerecord.pt-BR.yml +22 -4
- data/config/locales/editor.ar.yml +268 -0
- data/config/locales/editor.en.yml +268 -0
- data/config/locales/editor.es.yml +268 -0
- data/config/locales/editor.fr.yml +268 -0
- data/config/locales/editor.pt-BR.yml +268 -0
- data/config/locales/uikit.ar.yml +14 -0
- data/config/locales/uikit.en.yml +14 -0
- data/config/locales/uikit.es.yml +14 -0
- data/config/locales/uikit.fr.yml +14 -0
- data/config/locales/uikit.pt-BR.yml +14 -0
- data/config/routes.rb +34 -35
- data/db/migrate/20250929203214_create_maglev_sections_content_stores.rb +21 -0
- data/exe/tailwind-cli +29 -0
- data/lib/commands/maglev/publish_site_command.rb +46 -0
- data/lib/generators/maglev/install_generator.rb +1 -6
- data/lib/generators/maglev/templates/install/config/initializers/maglev.rb +6 -2
- data/lib/generators/maglev/templates/theme/app/views/theme/layout.html.erb.tt +2 -2
- data/lib/maglev/config.rb +2 -1
- data/lib/maglev/engine.rb +34 -42
- data/lib/maglev/errors.rb +3 -0
- data/lib/maglev/version.rb +1 -1
- data/lib/maglev.rb +3 -1
- data/lib/tasks/maglev/tailwindcss.rake +38 -0
- data/lib/tasks/maglev_tasks.rake +4 -23
- data/vendor/javascript/@floating-ui--core.js +4 -0
- data/vendor/javascript/@floating-ui--dom.js +12 -0
- data/vendor/javascript/@floating-ui--utils--dom.js +4 -0
- data/vendor/javascript/@floating-ui--utils.js +4 -0
- data/vendor/javascript/@hotwired--stimulus.js +4 -0
- data/vendor/javascript/@hotwired--turbo-rails.js +4 -0
- data/vendor/javascript/@hotwired--turbo.js +458 -0
- data/vendor/javascript/@rails--actioncable--src.js +4 -0
- data/vendor/javascript/@rails--request.js.js +4 -0
- data/vendor/javascript/@shopify--draggable.js +4 -0
- data/vendor/javascript/el-transition.js +4 -0
- data/vendor/javascript/stimulus-use.js +4 -0
- data/vendor/javascript/tiptap.bundle.js +1 -0
- metadata +363 -342
- data/.babelrc +0 -9
- data/.yarn/install-state.gz +0 -0
- data/.yarn/releases/yarn-4.4.0.cjs +0 -925
- data/.yarnrc.yml +0 -3
- data/app/controllers/maglev/admin/base_controller.rb +0 -20
- data/app/controllers/maglev/admin/dashboard_controller.rb +0 -11
- data/app/controllers/maglev/admin/sections/previews_controller.rb +0 -52
- data/app/controllers/maglev/admin/sections/screenshots_controller.rb +0 -17
- data/app/controllers/maglev/admin/themes_controller.rb +0 -19
- data/app/controllers/maglev/api/assets_controller.rb +0 -44
- data/app/controllers/maglev/api/collection_items_controller.rb +0 -21
- data/app/controllers/maglev/api/page_clones_controller.rb +0 -21
- data/app/controllers/maglev/api/pages_controller.rb +0 -65
- data/app/controllers/maglev/api/publications_controller.rb +0 -15
- data/app/controllers/maglev/api/sites_controller.rb +0 -21
- data/app/controllers/maglev/api_controller.rb +0 -61
- data/app/controllers/maglev/editor_controller.rb +0 -59
- data/app/frontend/admin/controllers/dropdown_controller.js +0 -9
- data/app/frontend/admin/controllers/iframe_controller.js +0 -16
- data/app/frontend/admin/controllers/screenshot_controller.js +0 -69
- data/app/frontend/admin/index.js +0 -10
- data/app/frontend/admin/utils/axios.js +0 -16
- data/app/frontend/editor/App.vue +0 -43
- data/app/frontend/editor/assets/remixicons/add-box-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-down-s-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-drop-left.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-drop-right.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-up-s-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/camera-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/clipboard-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/close-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/computer-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/delete-bin-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/file-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-blockquote.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-bold.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-code.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-2.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-3.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-4.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-italic.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-link-unlink.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-link.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-list-ordered.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-list-unordered.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-paragraph.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-strikethrough.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-superscript.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-underline.svg +0 -1
- data/app/frontend/editor/assets/remixicons/home-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/image-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/logout-box-r-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-add-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-alert-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-book-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-bug-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-check-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-close-circle-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-close-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-delete-column.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-delete-row.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-draggable.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-drop-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-external-link-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-eye-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-eye-off-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-file-copy-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-file-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-folders-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-global-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-column-left.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-column-right.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-row-bottom.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-row-top.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-loader-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-mail-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-more-2-fill.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-more-fill.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-palette-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-pencil-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-play-list-add-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-settings-5-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-shadow-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-stack-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-table-2.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-table-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/search-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/settings-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/smartphone-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/tablet-line.svg +0 -1
- data/app/frontend/editor/components/dynamic-form/dynamic-input.vue +0 -142
- data/app/frontend/editor/components/dynamic-form/index.vue +0 -36
- data/app/frontend/editor/components/errors/forbidden.vue +0 -24
- data/app/frontend/editor/components/errors/stale-record.vue +0 -24
- data/app/frontend/editor/components/header-nav/device-toggler.vue +0 -40
- data/app/frontend/editor/components/header-nav/index.vue +0 -77
- data/app/frontend/editor/components/header-nav/locale-toggler/index.vue +0 -51
- data/app/frontend/editor/components/header-nav/locale-toggler/locale-link.vue +0 -32
- data/app/frontend/editor/components/header-nav/page-info.vue +0 -41
- data/app/frontend/editor/components/header-nav/preview-button.vue +0 -20
- data/app/frontend/editor/components/header-nav/preview-toggler.vue +0 -40
- data/app/frontend/editor/components/header-nav/publish-button.vue +0 -77
- data/app/frontend/editor/components/header-nav/save-button.vue +0 -33
- data/app/frontend/editor/components/header-nav/separator.vue +0 -11
- data/app/frontend/editor/components/icon-library/index.vue +0 -39
- data/app/frontend/editor/components/image-library/index.vue +0 -107
- data/app/frontend/editor/components/image-library/list-item.vue +0 -93
- data/app/frontend/editor/components/image-library/list.vue +0 -26
- data/app/frontend/editor/components/image-library/uploader.vue +0 -76
- data/app/frontend/editor/components/kit/accordion.vue +0 -68
- data/app/frontend/editor/components/kit/checkbox-input.vue +0 -59
- data/app/frontend/editor/components/kit/collection-item-input.vue +0 -79
- data/app/frontend/editor/components/kit/color-input/core-input.vue +0 -92
- data/app/frontend/editor/components/kit/color-input/preset-button.vue +0 -61
- data/app/frontend/editor/components/kit/color-input/preset-dropdown.vue +0 -47
- data/app/frontend/editor/components/kit/color-input.vue +0 -41
- data/app/frontend/editor/components/kit/confirmation-button.vue +0 -65
- data/app/frontend/editor/components/kit/copy-paste-button.vue +0 -26
- data/app/frontend/editor/components/kit/divider.vue +0 -22
- data/app/frontend/editor/components/kit/dropdown.vue +0 -66
- data/app/frontend/editor/components/kit/hint.vue +0 -12
- data/app/frontend/editor/components/kit/icon-button.vue +0 -24
- data/app/frontend/editor/components/kit/icon-input.vue +0 -96
- data/app/frontend/editor/components/kit/icon.vue +0 -36
- data/app/frontend/editor/components/kit/image-input.vue +0 -124
- data/app/frontend/editor/components/kit/index.js +0 -56
- data/app/frontend/editor/components/kit/link-input.vue +0 -121
- data/app/frontend/editor/components/kit/modal-root.vue +0 -85
- data/app/frontend/editor/components/kit/modal.vue +0 -39
- data/app/frontend/editor/components/kit/page-icon.vue +0 -21
- data/app/frontend/editor/components/kit/pagination/button.vue +0 -35
- data/app/frontend/editor/components/kit/pagination/index.vue +0 -116
- data/app/frontend/editor/components/kit/rich-text-input/block-button.vue +0 -75
- data/app/frontend/editor/components/kit/rich-text-input/extensions/Doc.js +0 -12
- data/app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js +0 -38
- data/app/frontend/editor/components/kit/rich-text-input/extensions/marks/Link.js +0 -57
- data/app/frontend/editor/components/kit/rich-text-input/extensions/marks/Superscript.js +0 -43
- data/app/frontend/editor/components/kit/rich-text-input/format-buttons.vue +0 -47
- data/app/frontend/editor/components/kit/rich-text-input/link-buttons.vue +0 -91
- data/app/frontend/editor/components/kit/rich-text-input/list-buttons.vue +0 -29
- data/app/frontend/editor/components/kit/rich-text-input/menu-button.vue +0 -22
- data/app/frontend/editor/components/kit/rich-text-input/table-button.vue +0 -112
- data/app/frontend/editor/components/kit/rich-text-input.vue +0 -187
- data/app/frontend/editor/components/kit/search-input.vue +0 -54
- data/app/frontend/editor/components/kit/select-input.vue +0 -200
- data/app/frontend/editor/components/kit/simple-select.vue +0 -63
- data/app/frontend/editor/components/kit/submit-button.vue +0 -117
- data/app/frontend/editor/components/kit/tabs.vue +0 -99
- data/app/frontend/editor/components/kit/text-input.vue +0 -63
- data/app/frontend/editor/components/kit/textarea-input.vue +0 -61
- data/app/frontend/editor/components/link-picker/actions.vue +0 -32
- data/app/frontend/editor/components/link-picker/email.vue +0 -32
- data/app/frontend/editor/components/link-picker/index.vue +0 -97
- data/app/frontend/editor/components/link-picker/page.vue +0 -126
- data/app/frontend/editor/components/link-picker/url.vue +0 -43
- data/app/frontend/editor/components/page/edit.vue +0 -99
- data/app/frontend/editor/components/page/form/main.vue +0 -64
- data/app/frontend/editor/components/page/form/seo.vue +0 -94
- data/app/frontend/editor/components/page/list/actions-button.vue +0 -159
- data/app/frontend/editor/components/page/list/index.vue +0 -58
- data/app/frontend/editor/components/page/list/list-item.vue +0 -96
- data/app/frontend/editor/components/page/new.vue +0 -79
- data/app/frontend/editor/components/section-block-pane/index.vue +0 -69
- data/app/frontend/editor/components/section-block-pane/setting-list.vue +0 -53
- data/app/frontend/editor/components/section-highlighter/bottom-actions.vue +0 -60
- data/app/frontend/editor/components/section-highlighter/index.vue +0 -125
- data/app/frontend/editor/components/section-highlighter/top-left-actions.vue +0 -78
- data/app/frontend/editor/components/section-highlighter/top-right-actions.vue +0 -130
- data/app/frontend/editor/components/section-list/add-button.vue +0 -39
- data/app/frontend/editor/components/section-list/index.vue +0 -79
- data/app/frontend/editor/components/section-list/list-item.vue +0 -60
- data/app/frontend/editor/components/section-pane/block-list/index.vue +0 -68
- data/app/frontend/editor/components/section-pane/block-list/list-item.vue +0 -74
- data/app/frontend/editor/components/section-pane/block-list/new-block-button.vue +0 -80
- data/app/frontend/editor/components/section-pane/block-tree/index.vue +0 -63
- data/app/frontend/editor/components/section-pane/block-tree/new-nested-block-button.vue +0 -73
- data/app/frontend/editor/components/section-pane/block-tree/tree-node.vue +0 -109
- data/app/frontend/editor/components/section-pane/index.vue +0 -94
- data/app/frontend/editor/components/section-pane/setting-list.vue +0 -50
- data/app/frontend/editor/components/sidebar-nav/index.vue +0 -102
- data/app/frontend/editor/components/sidebar-nav/link.vue +0 -60
- data/app/frontend/editor/components/style-pane/index.vue +0 -48
- data/app/frontend/editor/components/theme-section-list/category.vue +0 -47
- data/app/frontend/editor/components/theme-section-list/index.vue +0 -27
- data/app/frontend/editor/components/theme-section-list/list-item.vue +0 -95
- data/app/frontend/editor/design/application.scss +0 -17
- data/app/frontend/editor/design/components/buttons.scss +0 -25
- data/app/frontend/editor/design/components/modal.scss +0 -49
- data/app/frontend/editor/design/components/tooltip.scss +0 -123
- data/app/frontend/editor/design/components/tree.scss +0 -6
- data/app/frontend/editor/design/helpers.scss +0 -9
- data/app/frontend/editor/design/transitions.scss +0 -121
- data/app/frontend/editor/layouts/app.vue +0 -42
- data/app/frontend/editor/layouts/default.vue +0 -57
- data/app/frontend/editor/layouts/slide-pane.vue +0 -87
- data/app/frontend/editor/locales/editor.ar.json +0 -265
- data/app/frontend/editor/locales/editor.en.json +0 -265
- data/app/frontend/editor/locales/editor.es.json +0 -265
- data/app/frontend/editor/locales/editor.fr.json +0 -265
- data/app/frontend/editor/locales/editor.pt-BR.json +0 -265
- data/app/frontend/editor/locales/index.js +0 -23
- data/app/frontend/editor/main.js +0 -21
- data/app/frontend/editor/misc/__tests__/utils.spec.js +0 -43
- data/app/frontend/editor/misc/utils.js +0 -177
- data/app/frontend/editor/mixins/error-modal.js +0 -28
- data/app/frontend/editor/mixins/focused-input.js +0 -20
- data/app/frontend/editor/mixins/global.js +0 -140
- data/app/frontend/editor/mixins/grouped-dropdowns.js +0 -17
- data/app/frontend/editor/mixins/index.js +0 -1
- data/app/frontend/editor/mixins/preview-transformation.js +0 -59
- data/app/frontend/editor/plugins/event-bus.js +0 -3
- data/app/frontend/editor/plugins/filters.js +0 -7
- data/app/frontend/editor/plugins/i18n.js +0 -13
- data/app/frontend/editor/plugins/index.js +0 -3
- data/app/frontend/editor/plugins/tooltip.js +0 -4
- data/app/frontend/editor/router/index.js +0 -41
- data/app/frontend/editor/router/routes/base.js +0 -59
- data/app/frontend/editor/router/routes/index.js +0 -3
- data/app/frontend/editor/router/routes/page.js +0 -30
- data/app/frontend/editor/router/routes/section-block.js +0 -29
- data/app/frontend/editor/router/routes/section.js +0 -67
- data/app/frontend/editor/router/routes/style.js +0 -17
- data/app/frontend/editor/services/__tests__/page.spec.js +0 -38
- data/app/frontend/editor/services/__tests__/section.spec.js +0 -39
- data/app/frontend/editor/services/api.js +0 -40
- data/app/frontend/editor/services/block.js +0 -26
- data/app/frontend/editor/services/collection-item.js +0 -20
- data/app/frontend/editor/services/image.js +0 -26
- data/app/frontend/editor/services/index.js +0 -21
- data/app/frontend/editor/services/live-preview.js +0 -131
- data/app/frontend/editor/services/page.js +0 -107
- data/app/frontend/editor/services/section.js +0 -214
- data/app/frontend/editor/services/site.js +0 -21
- data/app/frontend/editor/services/theme.js +0 -9
- data/app/frontend/editor/spec/__mocks__/page.js +0 -434
- data/app/frontend/editor/spec/__mocks__/section.js +0 -232
- data/app/frontend/editor/spec/__mocks__/services.js +0 -84
- data/app/frontend/editor/spec/__mocks__/site.js +0 -95
- data/app/frontend/editor/spec/__mocks__/theme.js +0 -518
- data/app/frontend/editor/store/__tests__/getters.spec.js +0 -158
- data/app/frontend/editor/store/actions/__tests__/page.spec.js +0 -97
- data/app/frontend/editor/store/actions/__tests__/section-block.spec.js +0 -105
- data/app/frontend/editor/store/actions/__tests__/section.spec.js +0 -62
- data/app/frontend/editor/store/actions/index.js +0 -35
- data/app/frontend/editor/store/actions/page.js +0 -66
- data/app/frontend/editor/store/actions/section-block.js +0 -57
- data/app/frontend/editor/store/actions/section.js +0 -75
- data/app/frontend/editor/store/actions/site.js +0 -32
- data/app/frontend/editor/store/default-state.js +0 -27
- data/app/frontend/editor/store/getters.js +0 -113
- data/app/frontend/editor/store/index.js +0 -29
- data/app/frontend/editor/store/mutations.js +0 -187
- data/app/frontend/editor/views/content-pane.vue +0 -109
- data/app/frontend/editor/views/page-preview.vue +0 -160
- data/app/frontend/editor/views/pages/edit.vue +0 -26
- data/app/frontend/editor/views/pages/index.vue +0 -65
- data/app/frontend/editor/views/sections/add-pane.vue +0 -23
- data/app/frontend/editor/views/sections/list-pane.vue +0 -20
- data/app/frontend/editor/views/slide-pane.vue +0 -14
- data/app/frontend/editor/views/slide-pane2.vue +0 -14
- data/app/frontend/editor/views/style/edit-pane.vue +0 -22
- data/app/frontend/entrypoints/admin.js +0 -3
- data/app/frontend/entrypoints/admin.scss +0 -5
- data/app/frontend/entrypoints/editor.js +0 -8
- data/app/frontend/entrypoints/live-preview-client.js +0 -6
- data/app/frontend/entrypoints/live-preview-rails-client.js +0 -9
- data/app/frontend/live-preview-client/index.js +0 -11
- data/app/frontend/live-preview-client/rails.js +0 -217
- data/app/helpers/maglev/editor_helper.rb +0 -95
- data/app/services/maglev/persist_page.rb +0 -97
- data/app/views/layouts/maglev/admin/_header_actions.html.erb +0 -5
- data/app/views/layouts/maglev/admin/application.html.erb +0 -26
- data/app/views/maglev/admin/sections/previews/show.html.erb +0 -47
- data/app/views/maglev/admin/themes/_empty.html.erb +0 -20
- data/app/views/maglev/admin/themes/_section_categories.html.erb +0 -9
- data/app/views/maglev/admin/themes/_sections.html.erb +0 -54
- data/app/views/maglev/admin/themes/show.html.erb +0 -21
- data/app/views/maglev/api/_pagination.json.jbuilder +0 -6
- data/app/views/maglev/api/assets/_show.json.jbuilder +0 -8
- data/app/views/maglev/api/assets/index.json.jbuilder +0 -9
- data/app/views/maglev/api/assets/show.json.jbuilder +0 -3
- data/app/views/maglev/api/collection_items/_show.json.jbuilder +0 -5
- data/app/views/maglev/api/collection_items/index.json.jbuilder +0 -5
- data/app/views/maglev/api/collection_items/show.json.jbuilder +0 -7
- data/app/views/maglev/api/page_clones/create.json.jbuilder +0 -3
- data/app/views/maglev/api/pages/_show.json.jbuilder +0 -23
- data/app/views/maglev/api/pages/index.json.jbuilder +0 -18
- data/app/views/maglev/api/pages/show.json.jbuilder +0 -3
- data/app/views/maglev/api/sites/_show.json.jbuilder +0 -15
- data/app/views/maglev/api/sites/show.json.jbuilder +0 -3
- data/app/views/maglev/api/themes/_show.json.jbuilder +0 -17
- data/app/views/maglev/editor/_header.html.erb +0 -1
- data/app/views/maglev/editor/show.html.erb +0 -41
- data/app/views/maglev/settings/index.html.erb +0 -11
- data/bin/vite +0 -29
- data/config/initializers/kaminari.rb +0 -16
- data/config/vite.json +0 -17
- data/lib/tasks/maglev/vite.rake +0 -70
- data/package.json +0 -58
- data/postcss.config.cjs +0 -6
- data/tailwind.config.js +0 -68
- data/vite.config.ts +0 -18
- data/yarn.lock +0 -4749
- /data/app/{frontend/images → assets/images/maglev}/favicon.svg +0 -0
- /data/app/{frontend/images → assets/images/maglev}/logo.svg +0 -0
- /data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/run-scripts.js +0 -0
data/lib/maglev/engine.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'turbo-rails'
|
|
4
|
+
require 'importmap-rails'
|
|
4
5
|
require 'maglev/migration'
|
|
5
6
|
|
|
6
7
|
module Maglev
|
|
@@ -39,52 +40,43 @@ module Maglev
|
|
|
39
40
|
Rails.application.config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
def self.importmaps
|
|
44
|
+
@importmaps ||= {
|
|
45
|
+
editor: ::Importmap::Map.new,
|
|
46
|
+
client: ::Importmap::Map.new
|
|
47
|
+
}
|
|
46
48
|
end
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
app.middleware.insert_after ActionDispatch::Static,
|
|
54
|
-
Rack::Static,
|
|
55
|
-
urls: ["/#{vite_ruby.config.public_output_dir}"],
|
|
56
|
-
root: root.join(vite_ruby.config.public_dir),
|
|
57
|
-
header_rules: [
|
|
58
|
-
# rubocop:disable Style/StringHashKeys
|
|
59
|
-
[:all, { 'Access-Control-Allow-Origin' => '*' }]
|
|
60
|
-
# rubocop:enable Style/StringHashKeys
|
|
61
|
-
]
|
|
62
|
-
else
|
|
63
|
-
# mostly when running the application in production behind NGINX or APACHE
|
|
64
|
-
app.middleware.insert_before 0,
|
|
65
|
-
Rack::Static,
|
|
66
|
-
urls: ["/#{vite_ruby.config.public_output_dir}"],
|
|
67
|
-
root: root.join(vite_ruby.config.public_dir),
|
|
68
|
-
header_rules: [
|
|
69
|
-
# rubocop:disable Style/StringHashKeys
|
|
70
|
-
[:all, { 'Access-Control-Allow-Origin' => '*' }]
|
|
71
|
-
# rubocop:enable Style/StringHashKeys
|
|
72
|
-
]
|
|
73
|
-
end
|
|
74
|
-
end
|
|
50
|
+
initializer 'maglev.assets' do |app|
|
|
51
|
+
app.config.assets.paths << Engine.root.join('app/assets/builds')
|
|
52
|
+
app.config.assets.paths << Engine.root.join('app/components')
|
|
53
|
+
app.config.assets.paths << Engine.root.join('app/assets/javascripts')
|
|
54
|
+
app.config.assets.paths << Engine.root.join('vendor/javascript')
|
|
75
55
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
app.middleware.insert_before 0,
|
|
79
|
-
ViteRuby::DevServerProxy,
|
|
80
|
-
ssl_verify_none: true,
|
|
81
|
-
vite_ruby: vite_ruby
|
|
82
|
-
end
|
|
56
|
+
# required by Sprockets (if used by the main app)
|
|
57
|
+
app.config.assets.precompile += %w[maglev_manifest]
|
|
83
58
|
end
|
|
84
59
|
|
|
85
|
-
initializer 'maglev.
|
|
86
|
-
config.
|
|
87
|
-
|
|
60
|
+
initializer 'maglev.importmap', after: 'importmap' do |app|
|
|
61
|
+
Engine.importmaps[:editor].draw(Engine.root.join('config/editor_importmap.rb'))
|
|
62
|
+
Engine.importmaps[:client].draw(Engine.root.join('config/client_importmap.rb'))
|
|
63
|
+
|
|
64
|
+
if (Rails.env.development? || Rails.env.test?) && !app.config.cache_classes
|
|
65
|
+
# Editor
|
|
66
|
+
Engine.importmaps[:editor].cache_sweeper(watches: [
|
|
67
|
+
Engine.root.join('app/assets/javascripts'),
|
|
68
|
+
Engine.root.join('app/components')
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
# Client
|
|
72
|
+
Engine.importmaps[:client].cache_sweeper(watches: [
|
|
73
|
+
Engine.root.join('app/assets/javascripts/maglev/client')
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
ActiveSupport.on_load(:action_controller_base) do
|
|
77
|
+
before_action { Engine.importmaps[:editor].cache_sweeper.execute_if_updated }
|
|
78
|
+
before_action { Engine.importmaps[:client].cache_sweeper.execute_if_updated }
|
|
79
|
+
end
|
|
88
80
|
end
|
|
89
81
|
end
|
|
90
82
|
end
|
data/lib/maglev/errors.rb
CHANGED
|
@@ -4,7 +4,10 @@ module Maglev
|
|
|
4
4
|
module Errors
|
|
5
5
|
class NotAuthorized < StandardError; end
|
|
6
6
|
class UnknownSection < StandardError; end
|
|
7
|
+
class UnknownBlock < StandardError; end
|
|
7
8
|
class DuplicateSectionDefinition < StandardError; end
|
|
9
|
+
class NotImplemented < StandardError; end
|
|
10
|
+
class UnpublishedPage < StandardError; end
|
|
8
11
|
|
|
9
12
|
class UnknownSetting < StandardError
|
|
10
13
|
def initialize(section_id, block_id, setting_id)
|
data/lib/maglev/version.rb
CHANGED
data/lib/maglev.rb
CHANGED
|
@@ -9,7 +9,8 @@ require_relative 'maglev/preview_constraint'
|
|
|
9
9
|
require_relative 'maglev/reserved_paths'
|
|
10
10
|
|
|
11
11
|
require 'injectable'
|
|
12
|
-
require '
|
|
12
|
+
require 'pagy'
|
|
13
|
+
require 'view_component'
|
|
13
14
|
|
|
14
15
|
module Maglev
|
|
15
16
|
ROOT_PATH = Pathname.new(File.join(__dir__, '..'))
|
|
@@ -39,6 +40,7 @@ module Maglev
|
|
|
39
40
|
c.admin_password = nil
|
|
40
41
|
c.static_pages = []
|
|
41
42
|
c.reserved_paths = []
|
|
43
|
+
c.tailwindcss_folders = []
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :maglev do
|
|
4
|
+
namespace :tailwindcss do
|
|
5
|
+
desc 'Generate Tailwind CSS classes from component files'
|
|
6
|
+
task build: :environment do
|
|
7
|
+
puts '[Maglev] Building EditorTailwind CSS'
|
|
8
|
+
run_tailwindcss_cli
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
desc 'Watch for changes in component files and rebuild Tailwind CSS'
|
|
12
|
+
task watch: :environment do
|
|
13
|
+
run_tailwindcss_cli('--watch')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
17
|
+
def run_tailwindcss_cli(options = nil)
|
|
18
|
+
command_path = Maglev::Engine.root.join('exe', 'tailwind-cli')
|
|
19
|
+
Maglev::Engine.root.join('tmp/maglev-compiled-tailwind.css')
|
|
20
|
+
erb_input_path = Maglev::Engine.root.join('app/assets/stylesheets/maglev/tailwind.css.erb')
|
|
21
|
+
input_path = Maglev::Engine.root.join('tmp/maglev-compiled-tailwind.css')
|
|
22
|
+
output_path = Maglev::Engine.root.join('app/assets/builds/maglev/tailwind.css')
|
|
23
|
+
|
|
24
|
+
FileUtils.mkdir_p(input_path.dirname)
|
|
25
|
+
|
|
26
|
+
puts "[Maglev] Generating temporary Tailwind input file at: #{input_path}"
|
|
27
|
+
|
|
28
|
+
rendered_css = ERB.new(File.read(erb_input_path)).result
|
|
29
|
+
File.write(input_path, rendered_css)
|
|
30
|
+
|
|
31
|
+
require 'bundler'
|
|
32
|
+
Bundler.with_unbundled_env do
|
|
33
|
+
system "#{command_path} -i #{input_path} -o #{output_path} #{options}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/tasks/maglev_tasks.rake
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
unless ENV['VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION'] == 'true'
|
|
10
|
-
if Rake::Task.task_defined?('assets:precompile')
|
|
11
|
-
Rake::Task['assets:precompile'].enhance do |_task|
|
|
12
|
-
Rake::Task['maglev:vite:install_dependencies'].invoke
|
|
13
|
-
Rake::Task['maglev:vite:build_all'].invoke
|
|
14
|
-
end
|
|
15
|
-
else
|
|
16
|
-
Rake::Task.define_task("assets:precompile": ['maglev:vite:install_dependencies', 'maglev:vite:build_all'])
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
if Rake::Task.task_defined?('assets:clobber')
|
|
20
|
-
Rake::Task['assets:clobber'].enhance do
|
|
21
|
-
Rake::Task['maglev:vite:clobber'].invoke
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
Rake::Task.define_task("assets:clobber": 'maglev:vite:clobber')
|
|
25
|
-
end
|
|
3
|
+
if Rake::Task.task_defined?('assets:precompile')
|
|
4
|
+
Rake::Task['assets:precompile'].enhance(['maglev:tailwindcss:build'])
|
|
5
|
+
else
|
|
6
|
+
Rake::Task.define_task("assets:precompile": ['maglev:tailwindcss:build'])
|
|
26
7
|
end
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @floating-ui/core@1.7.3 downloaded from https://ga.jspm.io/npm:@floating-ui/core@1.7.3/dist/floating-ui.core.mjs
|
|
2
|
+
|
|
3
|
+
import{getSideAxis as t,getAlignmentAxis as e,getAxisLength as n,getSide as o,getAlignment as s,evaluate as i,getPaddingObject as c,rectToClientRect as r,min as a,clamp as l,getOppositeAlignmentPlacement as f,placements as m,getAlignmentSides as u,getOppositePlacement as d,getExpandedPlacements as g,getOppositeAxisPlacements as p,sides as h,max as y,getOppositeAxis as w}from"@floating-ui/utils";export{rectToClientRect}from"@floating-ui/utils";function x(i,c,r){let{reference:a,floating:l}=i;const f=t(c);const m=e(c);const u=n(m);const d=o(c);const g=f==="y";const p=a.x+a.width/2-l.width/2;const h=a.y+a.height/2-l.height/2;const y=a[u]/2-l[u]/2;let w;switch(d){case"top":w={x:p,y:a.y-l.height};break;case"bottom":w={x:p,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:h};break;case"left":w={x:a.x-l.width,y:h};break;default:w={x:a.x,y:a.y}}switch(s(c)){case"start":w[m]-=y*(r&&g?-1:1);break;case"end":w[m]+=y*(r&&g?-1:1);break}return w}const v=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:c}=n;const r=i.filter(Boolean);const a=await(c.isRTL==null?void 0:c.isRTL(e));let l=await c.getElementRects({reference:t,floating:e,strategy:s});let{x:f,y:m}=x(l,o,a);let u=o;let d={};let g=0;for(let n=0;n<r.length;n++){const{name:i,fn:p}=r[n];const{x:h,y:y,data:w,reset:v}=await p({x:f,y:m,initialPlacement:o,placement:u,strategy:s,middlewareData:d,rects:l,platform:c,elements:{reference:t,floating:e}});f=h!=null?h:f;m=y!=null?y:m;d={...d,[i]:{...d[i],...w}};if(v&&g<=50){g++;if(typeof v==="object"){v.placement&&(u=v.placement);v.rects&&(l=v.rects===true?await c.getElementRects({reference:t,floating:e,strategy:s}):v.rects);({x:f,y:m}=x(l,u,a))}n=-1}}return{x:f,y:m,placement:u,strategy:s,middlewareData:d}};async function b(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:a,rects:l,elements:f,strategy:m}=t;const{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:g="floating",altBoundary:p=false,padding:h=0}=i(e,t);const y=c(h);const w=g==="floating"?"reference":"floating";const x=f[p?w:g];const v=r(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(f.floating)),boundary:u,rootBoundary:d,strategy:m}));const b=g==="floating"?{x:o,y:s,width:l.floating.width,height:l.floating.height}:l.reference;const A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f.floating));const R=await(a.isElement==null?void 0:a.isElement(A))&&await(a.getScale==null?void 0:a.getScale(A))||{x:1,y:1};const D=r(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:b,offsetParent:A,strategy:m}):b);return{top:(v.top-D.top+y.top)/R.y,bottom:(D.bottom-v.bottom+y.bottom)/R.y,left:(v.left-D.left+y.left)/R.x,right:(D.right-v.right+y.right)/R.x}}const A=t=>({name:"arrow",options:t,async fn(o){const{x:r,y:f,placement:m,rects:u,platform:d,elements:g,middlewareData:p}=o;const{element:h,padding:y=0}=i(t,o)||{};if(h==null)return{};const w=c(y);const x={x:r,y:f};const v=e(m);const b=n(v);const A=await d.getDimensions(h);const R=v==="y";const D=R?"top":"left";const P=R?"bottom":"right";const T=R?"clientHeight":"clientWidth";const E=u.reference[b]+u.reference[v]-x[v]-u.floating[b];const O=x[v]-u.reference[v];const k=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h));let L=k?k[T]:0;L&&await(d.isElement==null?void 0:d.isElement(k))||(L=g.floating[T]||u.floating[b]);const C=E/2-O/2;const B=L/2-A[b]/2-1;const H=a(w[D],B);const S=a(w[P],B);const F=H;const V=L-A[b]-S;const W=L/2-A[b]/2+C;const j=l(F,W,V);const z=!p.arrow&&s(m)!=null&&W!==j&&u.reference[b]/2-(W<F?H:S)-A[b]/2<0;const q=z?W<F?W-F:W-V:0;return{[v]:x[v]+q,data:{[v]:j,centerOffset:W-j-q,...z&&{alignmentOffset:q}},reset:z}}});function R(t,e,n){const i=t?[...n.filter((e=>s(e)===t)),...n.filter((e=>s(e)!==t))]:n.filter((t=>o(t)===t));return i.filter((n=>!t||(s(n)===t||!!e&&f(n)!==n)))}const D=function(t){t===void 0&&(t={});return{name:"autoPlacement",options:t,async fn(e){var n,c,r;const{rects:a,middlewareData:l,placement:f,platform:d,elements:g}=e;const{crossAxis:p=false,alignment:h,allowedPlacements:y=m,autoAlignment:w=true,...x}=i(t,e);const v=h!==void 0||y===m?R(h||null,w,y):y;const A=await b(e,x);const D=((n=l.autoPlacement)==null?void 0:n.index)||0;const P=v[D];if(P==null)return{};const T=u(P,a,await(d.isRTL==null?void 0:d.isRTL(g.floating)));if(f!==P)return{reset:{placement:v[0]}};const E=[A[o(P)],A[T[0]],A[T[1]]];const O=[...((c=l.autoPlacement)==null?void 0:c.overflows)||[],{placement:P,overflows:E}];const k=v[D+1];if(k)return{data:{index:D+1,overflows:O},reset:{placement:k}};const L=O.map((t=>{const e=s(t.placement);return[t.placement,e&&p?t.overflows.slice(0,2).reduce(((t,e)=>t+e),0):t.overflows[0],t.overflows]})).sort(((t,e)=>t[1]-e[1]));const C=L.filter((t=>t[2].slice(0,s(t[0])?2:3).every((t=>t<=0))));const B=((r=C[0])==null?void 0:r[0])||L[0][0];return B!==f?{data:{index:D+1,overflows:O},reset:{placement:B}}:{}}}};const P=function(e){e===void 0&&(e={});return{name:"flip",options:e,async fn(n){var s,c;const{placement:r,middlewareData:a,rects:l,initialPlacement:f,platform:m,elements:h}=n;const{mainAxis:y=true,crossAxis:w=true,fallbackPlacements:x,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:R=true,...D}=i(e,n);if((s=a.arrow)!=null&&s.alignmentOffset)return{};const P=o(r);const T=t(f);const E=o(f)===f;const O=await(m.isRTL==null?void 0:m.isRTL(h.floating));const k=x||(E||!R?[d(f)]:g(f));const L=A!=="none";!x&&L&&k.push(...p(f,R,A,O));const C=[f,...k];const B=await b(n,D);const H=[];let S=((c=a.flip)==null?void 0:c.overflows)||[];y&&H.push(B[P]);if(w){const t=u(r,l,O);H.push(B[t[0]],B[t[1]])}S=[...S,{placement:r,overflows:H}];if(!H.every((t=>t<=0))){var F,V;const e=(((F=a.flip)==null?void 0:F.index)||0)+1;const n=C[e];if(n){const o=w==="alignment"&&T!==t(n);if(!o||S.every((e=>t(e.placement)!==T||e.overflows[0]>0)))return{data:{index:e,overflows:S},reset:{placement:n}}}let o=(V=S.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])==null?void 0:V.placement;if(!o)switch(v){case"bestFit":{var W;const e=(W=S.filter((e=>{if(L){const n=t(e.placement);return n===T||n==="y"}return true})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])==null?void 0:W[0];e&&(o=e);break}case"initialPlacement":o=f;break}if(r!==o)return{reset:{placement:o}}}return{}}}};function T(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function E(t){return h.some((e=>t[e]>=0))}const O=function(t){t===void 0&&(t={});return{name:"hide",options:t,async fn(e){const{rects:n}=e;const{strategy:o="referenceHidden",...s}=i(t,e);switch(o){case"referenceHidden":{const t=await b(e,{...s,elementContext:"reference"});const o=T(t,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:E(o)}}}case"escaped":{const t=await b(e,{...s,altBoundary:true});const o=T(t,n.floating);return{data:{escapedOffsets:o,escaped:E(o)}}}default:return{}}}}};function k(t){const e=a(...t.map((t=>t.left)));const n=a(...t.map((t=>t.top)));const o=y(...t.map((t=>t.right)));const s=y(...t.map((t=>t.bottom)));return{x:e,y:n,width:o-e,height:s-n}}function L(t){const e=t.slice().sort(((t,e)=>t.y-e.y));const n=[];let o=null;for(let t=0;t<e.length;t++){const s=e[t];!o||s.y-o.y>o.height/2?n.push([s]):n[n.length-1].push(s);o=s}return n.map((t=>r(k(t))))}const C=function(e){e===void 0&&(e={});return{name:"inline",options:e,async fn(n){const{placement:s,elements:l,rects:f,platform:m,strategy:u}=n;const{padding:d=2,x:g,y:p}=i(e,n);const h=Array.from(await(m.getClientRects==null?void 0:m.getClientRects(l.reference))||[]);const w=L(h);const x=r(k(h));const v=c(d);function b(){if(w.length===2&&w[0].left>w[1].right&&g!=null&&p!=null)return w.find((t=>g>t.left-v.left&&g<t.right+v.right&&p>t.top-v.top&&p<t.bottom+v.bottom))||x;if(w.length>=2){if(t(s)==="y"){const t=w[0];const e=w[w.length-1];const n=o(s)==="top";const i=t.top;const c=e.bottom;const r=n?t.left:e.left;const a=n?t.right:e.right;const l=a-r;const f=c-i;return{top:i,bottom:c,left:r,right:a,width:l,height:f,x:r,y:i}}const e=o(s)==="left";const n=y(...w.map((t=>t.right)));const i=a(...w.map((t=>t.left)));const c=w.filter((t=>e?t.left===i:t.right===n));const r=c[0].top;const l=c[c.length-1].bottom;const f=i;const m=n;const u=m-f;const d=l-r;return{top:r,bottom:l,left:f,right:m,width:u,height:d,x:f,y:r}}return x}const A=await m.getElementRects({reference:{getBoundingClientRect:b},floating:l.floating,strategy:u});return f.reference.x!==A.reference.x||f.reference.y!==A.reference.y||f.reference.width!==A.reference.width||f.reference.height!==A.reference.height?{reset:{rects:A}}:{}}}};const B=new Set(["left","top"]);async function H(e,n){const{placement:c,platform:r,elements:a}=e;const l=await(r.isRTL==null?void 0:r.isRTL(a.floating));const f=o(c);const m=s(c);const u=t(c)==="y";const d=B.has(f)?-1:1;const g=l&&u?-1:1;const p=i(n,e);let{mainAxis:h,crossAxis:y,alignmentAxis:w}=typeof p==="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};m&&typeof w==="number"&&(y=m==="end"?w*-1:w);return u?{x:y*g,y:h*d}:{x:h*d,y:y*g}}const S=function(t){t===void 0&&(t=0);return{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:c,middlewareData:r}=e;const a=await H(e,t);return c===((n=r.offset)==null?void 0:n.placement)&&(o=r.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:c}}}}};const F=function(e){e===void 0&&(e={});return{name:"shift",options:e,async fn(n){const{x:s,y:c,placement:r}=n;const{mainAxis:a=true,crossAxis:f=false,limiter:m={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...u}=i(e,n);const d={x:s,y:c};const g=await b(n,u);const p=t(o(r));const h=w(p);let y=d[h];let x=d[p];if(a){const t=h==="y"?"top":"left";const e=h==="y"?"bottom":"right";const n=y+g[t];const o=y-g[e];y=l(n,y,o)}if(f){const t=p==="y"?"top":"left";const e=p==="y"?"bottom":"right";const n=x+g[t];const o=x-g[e];x=l(n,x,o)}const v=m.fn({...n,[h]:y,[p]:x});return{...v,data:{x:v.x-s,y:v.y-c,enabled:{[h]:a,[p]:f}}}}}};const V=function(e){e===void 0&&(e={});return{options:e,fn(n){const{x:s,y:c,placement:r,rects:a,middlewareData:l}=n;const{offset:f=0,mainAxis:m=true,crossAxis:u=true}=i(e,n);const d={x:s,y:c};const g=t(r);const p=w(g);let h=d[p];let y=d[g];const x=i(f,n);const v=typeof x==="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(m){const t=p==="y"?"height":"width";const e=a.reference[p]-a.floating[t]+v.mainAxis;const n=a.reference[p]+a.reference[t]-v.mainAxis;h<e?h=e:h>n&&(h=n)}if(u){var b,A;const t=p==="y"?"width":"height";const e=B.has(o(r));const n=a.reference[g]-a.floating[t]+(e&&((b=l.offset)==null?void 0:b[g])||0)+(e?0:v.crossAxis);const s=a.reference[g]+a.reference[t]+(e?0:((A=l.offset)==null?void 0:A[g])||0)-(e?v.crossAxis:0);y<n?y=n:y>s&&(y=s)}return{[p]:h,[g]:y}}}};const W=function(e){e===void 0&&(e={});return{name:"size",options:e,async fn(n){var c,r;const{placement:l,rects:f,platform:m,elements:u}=n;const{apply:d=()=>{},...g}=i(e,n);const p=await b(n,g);const h=o(l);const w=s(l);const x=t(l)==="y";const{width:v,height:A}=f.floating;let R;let D;if(h==="top"||h==="bottom"){R=h;D=w===(await(m.isRTL==null?void 0:m.isRTL(u.floating))?"start":"end")?"left":"right"}else{D=h;R=w==="end"?"top":"bottom"}const P=A-p.top-p.bottom;const T=v-p.left-p.right;const E=a(A-p[R],P);const O=a(v-p[D],T);const k=!n.middlewareData.shift;let L=E;let C=O;(c=n.middlewareData.shift)!=null&&c.enabled.x&&(C=T);(r=n.middlewareData.shift)!=null&&r.enabled.y&&(L=P);if(k&&!w){const t=y(p.left,0);const e=y(p.right,0);const n=y(p.top,0);const o=y(p.bottom,0);x?C=v-2*(t!==0||e!==0?t+e:y(p.left,p.right)):L=A-2*(n!==0||o!==0?n+o:y(p.top,p.bottom))}await d({...n,availableWidth:C,availableHeight:L});const B=await m.getDimensions(u.floating);return v!==B.width||A!==B.height?{reset:{rects:true}}:{}}}};export{A as arrow,D as autoPlacement,v as computePosition,b as detectOverflow,P as flip,O as hide,C as inline,V as limitShift,S as offset,F as shift,W as size};
|
|
4
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @floating-ui/dom@1.7.3 downloaded from https://ga.jspm.io/npm:@floating-ui/dom@1.7.3/dist/floating-ui.dom.mjs
|
|
2
|
+
|
|
3
|
+
import{rectToClientRect as t,detectOverflow as e,offset as n,autoPlacement as o,shift as i,flip as s,size as c,hide as r,arrow as l,inline as f,limitShift as u,computePosition as h}from"@floating-ui/core";import{round as a,createCoords as d,max as g,min as p,floor as x}from"@floating-ui/utils";import{getComputedStyle as y,isHTMLElement as m,isElement as w,getWindow as v,isWebKit as b,getFrameElement as R,getNodeScroll as L,getDocumentElement as T,isTopLayer as F,getNodeName as E,isOverflowElement as O,getParentNode as W,isLastTraversableNode as C,getOverflowAncestors as H,isContainingBlock as z,isTableElement as A,getContainingBlock as B}from"@floating-ui/utils/dom";export{getOverflowAncestors}from"@floating-ui/utils/dom";function P(t){const e=y(t);let n=parseFloat(e.width)||0;let o=parseFloat(e.height)||0;const i=m(t);const s=i?t.offsetWidth:n;const c=i?t.offsetHeight:o;const r=a(n)!==s||a(o)!==c;if(r){n=s;o=c}return{width:n,height:o,$:r}}function D(t){return w(t)?t:t.contextElement}function S(t){const e=D(t);if(!m(e))return d(1);const n=e.getBoundingClientRect();const{width:o,height:i,$:s}=P(e);let c=(s?a(n.width):n.width)/o;let r=(s?a(n.height):n.height)/i;c&&Number.isFinite(c)||(c=1);r&&Number.isFinite(r)||(r=1);return{x:c,y:r}}const V=d(0);function I(t){const e=v(t);return b()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:V}function q(t,e,n){e===void 0&&(e=false);return!(!n||e&&n!==v(t))&&e}function M(e,n,o,i){n===void 0&&(n=false);o===void 0&&(o=false);const s=e.getBoundingClientRect();const c=D(e);let r=d(1);n&&(i?w(i)&&(r=S(i)):r=S(e));const l=q(c,o,i)?I(c):d(0);let f=(s.left+l.x)/r.x;let u=(s.top+l.y)/r.y;let h=s.width/r.x;let a=s.height/r.y;if(c){const t=v(c);const e=i&&w(i)?v(i):i;let n=t;let o=R(n);while(o&&i&&e!==n){const t=S(o);const e=o.getBoundingClientRect();const i=y(o);const s=e.left+(o.clientLeft+parseFloat(i.paddingLeft))*t.x;const c=e.top+(o.clientTop+parseFloat(i.paddingTop))*t.y;f*=t.x;u*=t.y;h*=t.x;a*=t.y;f+=s;u+=c;n=v(o);o=R(n)}}return t({width:h,height:a,x:f,y:u})}function N(t,e){const n=L(t).scrollLeft;return e?e.left+n:M(T(t)).left+n}function $(t,e,n){n===void 0&&(n=false);const o=t.getBoundingClientRect();const i=o.left+e.scrollLeft-(n?0:N(t,o));const s=o.top+e.scrollTop;return{x:i,y:s}}function _(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s=i==="fixed";const c=T(o);const r=!!e&&F(e.floating);if(o===c||r&&s)return n;let l={scrollLeft:0,scrollTop:0};let f=d(1);const u=d(0);const h=m(o);if(h||!h&&!s){(E(o)!=="body"||O(c))&&(l=L(o));if(m(o)){const t=M(o);f=S(o);u.x=t.x+o.clientLeft;u.y=t.y+o.clientTop}}const a=!c||h||s?d(0):$(c,l,true);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-l.scrollLeft*f.x+u.x+a.x,y:n.y*f.y-l.scrollTop*f.y+u.y+a.y}}function j(t){return Array.from(t.getClientRects())}function k(t){const e=T(t);const n=L(t);const o=t.ownerDocument.body;const i=g(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth);const s=g(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let c=-n.scrollLeft+N(t);const r=-n.scrollTop;y(o).direction==="rtl"&&(c+=g(e.clientWidth,o.clientWidth)-i);return{width:i,height:s,x:c,y:r}}function G(t,e){const n=v(t);const o=T(t);const i=n.visualViewport;let s=o.clientWidth;let c=o.clientHeight;let r=0;let l=0;if(i){s=i.width;c=i.height;const t=b();if(!t||t&&e==="fixed"){r=i.offsetLeft;l=i.offsetTop}}return{width:s,height:c,x:r,y:l}}const J=new Set(["absolute","fixed"]);function K(t,e){const n=M(t,true,e==="fixed");const o=n.top+t.clientTop;const i=n.left+t.clientLeft;const s=m(t)?S(t):d(1);const c=t.clientWidth*s.x;const r=t.clientHeight*s.y;const l=i*s.x;const f=o*s.y;return{width:c,height:r,x:l,y:f}}function Q(e,n,o){let i;if(n==="viewport")i=G(e,o);else if(n==="document")i=k(T(e));else if(w(n))i=K(n,o);else{const t=I(e);i={x:n.x-t.x,y:n.y-t.y,width:n.width,height:n.height}}return t(i)}function U(t,e){const n=W(t);return!(n===e||!w(n)||C(n))&&(y(n).position==="fixed"||U(n,e))}function X(t,e){const n=e.get(t);if(n)return n;let o=H(t,[],false).filter((t=>w(t)&&E(t)!=="body"));let i=null;const s=y(t).position==="fixed";let c=s?W(t):t;while(w(c)&&!C(c)){const e=y(c);const n=z(c);n||e.position!=="fixed"||(i=null);const r=s?!n&&!i:!n&&e.position==="static"&&!!i&&J.has(i.position)||O(c)&&!n&&U(t,c);r?o=o.filter((t=>t!==c)):i=e;c=W(c)}e.set(t,o);return o}function Y(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=n==="clippingAncestors"?F(e)?[]:X(e,this._c):[].concat(n);const c=[...s,o];const r=c[0];const l=c.reduce(((t,n)=>{const o=Q(e,n,i);t.top=g(o.top,t.top);t.right=p(o.right,t.right);t.bottom=p(o.bottom,t.bottom);t.left=g(o.left,t.left);return t}),Q(e,r,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Z(t){const{width:e,height:n}=P(t);return{width:e,height:n}}function tt(t,e,n){const o=m(e);const i=T(e);const s=n==="fixed";const c=M(t,true,s,e);let r={scrollLeft:0,scrollTop:0};const l=d(0);function f(){l.x=N(i)}if(o||!o&&!s){(E(e)!=="body"||O(i))&&(r=L(e));if(o){const t=M(e,true,s,e);l.x=t.x+e.clientLeft;l.y=t.y+e.clientTop}else i&&f()}s&&!o&&i&&f();const u=!i||o||s?d(0):$(i,r);const h=c.left+r.scrollLeft-l.x-u.x;const a=c.top+r.scrollTop-l.y-u.y;return{x:h,y:a,width:c.width,height:c.height}}function et(t){return y(t).position==="static"}function nt(t,e){if(!m(t)||y(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;T(t)===n&&(n=n.ownerDocument.body);return n}function ot(t,e){const n=v(t);if(F(t))return n;if(!m(t)){let e=W(t);while(e&&!C(e)){if(w(e)&&!et(e))return e;e=W(e)}return n}let o=nt(t,e);while(o&&A(o)&&et(o))o=nt(o,e);return o&&C(o)&&et(o)&&!z(o)?n:o||B(t)||n}const it=async function(t){const e=this.getOffsetParent||ot;const n=this.getDimensions;const o=await n(t.floating);return{reference:tt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function st(t){return y(t).direction==="rtl"}const ct={convertOffsetParentRelativeRectToViewportRelativeRect:_,getDocumentElement:T,getClippingRect:Y,getOffsetParent:ot,getElementRects:it,getClientRects:j,getDimensions:Z,getScale:S,isElement:w,isRTL:st};function rt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function lt(t,e){let n=null;let o;const i=T(t);function s(){var t;clearTimeout(o);(t=n)==null||t.disconnect();n=null}function c(r,l){r===void 0&&(r=false);l===void 0&&(l=1);s();const f=t.getBoundingClientRect();const{left:u,top:h,width:a,height:d}=f;r||e();if(!a||!d)return;const y=x(h);const m=x(i.clientWidth-(u+a));const w=x(i.clientHeight-(h+d));const v=x(u);const b=-y+"px "+-m+"px "+-w+"px "+-v+"px";const R={rootMargin:b,threshold:g(0,p(1,l))||1};let L=true;function T(e){const n=e[0].intersectionRatio;if(n!==l){if(!L)return c();n?c(false,n):o=setTimeout((()=>{c(false,1e-7)}),1e3)}n!==1||rt(f,t.getBoundingClientRect())||c();L=false}try{n=new IntersectionObserver(T,{...R,root:i.ownerDocument})}catch(t){n=new IntersectionObserver(T,R)}n.observe(t)}c(true);return s}
|
|
4
|
+
/**
|
|
5
|
+
* Automatically updates the position of the floating element when necessary.
|
|
6
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
7
|
+
* visible on the screen.
|
|
8
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
9
|
+
* removed from the DOM or hidden from the screen.
|
|
10
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
11
|
+
*/function ft(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=true,ancestorResize:s=true,elementResize:c=typeof ResizeObserver==="function",layoutShift:r=typeof IntersectionObserver==="function",animationFrame:l=false}=o;const f=D(t);const u=i||s?[...f?H(f):[],...H(e)]:[];u.forEach((t=>{i&&t.addEventListener("scroll",n,{passive:true});s&&t.addEventListener("resize",n)}));const h=f&&r?lt(f,n):null;let a=-1;let d=null;if(c){d=new ResizeObserver((t=>{let[o]=t;if(o&&o.target===f&&d){d.unobserve(e);cancelAnimationFrame(a);a=requestAnimationFrame((()=>{var t;(t=d)==null||t.observe(e)}))}n()}));f&&!l&&d.observe(f);d.observe(e)}let g;let p=l?M(t):null;l&&x();function x(){const e=M(t);p&&!rt(p,e)&&n();p=e;g=requestAnimationFrame(x)}n();return()=>{var t;u.forEach((t=>{i&&t.removeEventListener("scroll",n);s&&t.removeEventListener("resize",n)}));h==null||h();(t=d)==null||t.disconnect();d=null;l&&cancelAnimationFrame(g)}}const ut=e;const ht=n;const at=o;const dt=i;const gt=s;const pt=c;const xt=r;const yt=l;const mt=f;const wt=u;const vt=(t,e,n)=>{const o=new Map;const i={platform:ct,...n};const s={...i.platform,_c:o};return h(t,e,{...i,platform:s})};export{yt as arrow,at as autoPlacement,ft as autoUpdate,vt as computePosition,ut as detectOverflow,gt as flip,xt as hide,mt as inline,wt as limitShift,ht as offset,ct as platform,dt as shift,pt as size};
|
|
12
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @floating-ui/utils/dom@0.2.10 downloaded from https://ga.jspm.io/npm:@floating-ui/utils@0.2.10/dist/floating-ui.utils.dom.mjs
|
|
2
|
+
|
|
3
|
+
function n(){return typeof window!=="undefined"}function t(n){return r(n)?(n.nodeName||"").toLowerCase():"#document"}function e(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function o(n){var t;return(t=(r(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function r(t){return!!n()&&(t instanceof Node||t instanceof e(t).Node)}function c(t){return!!n()&&(t instanceof Element||t instanceof e(t).Element)}function u(t){return!!n()&&(t instanceof HTMLElement||t instanceof e(t).HTMLElement)}function l(t){return!(!n()||typeof ShadowRoot==="undefined")&&(t instanceof ShadowRoot||t instanceof e(t).ShadowRoot)}const i=new Set(["inline","contents"]);function s(n){const{overflow:t,overflowX:e,overflowY:o,display:r}=C(n);return/auto|scroll|overlay|hidden|clip/.test(t+o+e)&&!i.has(r)}const a=new Set(["table","td","th"]);function f(n){return a.has(t(n))}const d=[":popover-open",":modal"];function p(n){return d.some((t=>{try{return n.matches(t)}catch(n){return false}}))}const m=["transform","translate","scale","rotate","perspective"];const w=["transform","translate","scale","rotate","perspective","filter"];const h=["paint","layout","strict","content"];function v(n){const t=S();const e=c(n)?C(n):n;return m.some((n=>!!e[n]&&e[n]!=="none"))||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||w.some((n=>(e.willChange||"").includes(n)))||h.some((n=>(e.contain||"").includes(n)))}function y(n){let t=L(n);while(u(t)&&!T(t)){if(v(t))return t;if(p(t))return null;t=L(t)}return null}function S(){return!(typeof CSS==="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const b=new Set(["html","body","#document"]);function T(n){return b.has(t(n))}function C(n){return e(n).getComputedStyle(n)}function E(n){return c(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function L(n){if(t(n)==="html")return n;const e=n.assignedSlot||n.parentNode||l(n)&&n.host||o(n);return l(e)?e.host:e}function D(n){const t=L(n);return T(t)?n.ownerDocument?n.ownerDocument.body:n.body:u(t)&&s(t)?t:D(t)}function g(n,t,o){var r;t===void 0&&(t=[]);o===void 0&&(o=true);const c=D(n);const u=c===((r=n.ownerDocument)==null?void 0:r.body);const l=e(c);if(u){const n=k(l);return t.concat(l,l.visualViewport||[],s(c)?c:[],n&&o?g(n):[])}return t.concat(c,g(c,[],o))}function k(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}export{C as getComputedStyle,y as getContainingBlock,o as getDocumentElement,k as getFrameElement,D as getNearestOverflowAncestor,t as getNodeName,E as getNodeScroll,g as getOverflowAncestors,L as getParentNode,e as getWindow,v as isContainingBlock,c as isElement,u as isHTMLElement,T as isLastTraversableNode,r as isNode,s as isOverflowElement,l as isShadowRoot,f as isTableElement,p as isTopLayer,S as isWebKit};
|
|
4
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @floating-ui/utils@0.2.10 downloaded from https://ga.jspm.io/npm:@floating-ui/utils@0.2.10/dist/floating-ui.utils.mjs
|
|
2
|
+
|
|
3
|
+
const t=["top","right","bottom","left"];const n=["start","end"];const o=t.reduce(((t,o)=>t.concat(o,o+"-"+n[0],o+"-"+n[1])),[]);const r=Math.min;const e=Math.max;const c=Math.round;const i=Math.floor;const u=t=>({x:t,y:t});const f={left:"right",right:"left",bottom:"top",top:"bottom"};const s={start:"end",end:"start"};function a(t,n,o){return e(t,r(n,o))}function h(t,n){return typeof t==="function"?t(n):t}function l(t){return t.split("-")[0]}function p(t){return t.split("-")[1]}function g(t){return t==="x"?"y":"x"}function m(t){return t==="y"?"height":"width"}const b=new Set(["top","bottom"]);function d(t){return b.has(l(t))?"y":"x"}function x(t){return g(d(t))}function y(t,n,o){o===void 0&&(o=false);const r=p(t);const e=x(t);const c=m(e);let i=e==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";n.reference[c]>n.floating[c]&&(i=A(i));return[i,A(i)]}function w(t){const n=A(t);return[M(t),n,M(n)]}function M(t){return t.replace(/start|end/g,(t=>s[t]))}const v=["left","right"];const S=["right","left"];const j=["top","bottom"];const k=["bottom","top"];function q(t,n,o){switch(t){case"top":case"bottom":return o?n?S:v:n?v:S;case"left":case"right":return n?j:k;default:return[]}}function z(t,n,o,r){const e=p(t);let c=q(l(t),o==="start",r);if(e){c=c.map((t=>t+"-"+e));n&&(c=c.concat(c.map(M)))}return c}function A(t){return t.replace(/left|right|bottom|top/g,(t=>f[t]))}function B(t){return{top:0,right:0,bottom:0,left:0,...t}}function C(t){return typeof t!=="number"?B(t):{top:t,right:t,bottom:t,left:t}}function D(t){const{x:n,y:o,width:r,height:e}=t;return{width:r,height:e,top:o,left:n,right:n+r,bottom:o+e,x:n,y:o}}export{n as alignments,a as clamp,u as createCoords,h as evaluate,B as expandPaddingObject,i as floor,p as getAlignment,x as getAlignmentAxis,y as getAlignmentSides,m as getAxisLength,w as getExpandedPlacements,M as getOppositeAlignmentPlacement,g as getOppositeAxis,z as getOppositeAxisPlacements,A as getOppositePlacement,C as getPaddingObject,l as getSide,d as getSideAxis,e as max,r as min,o as placements,D as rectToClientRect,c as round,t as sides};
|
|
4
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @hotwired/stimulus@3.2.2 downloaded from https://ga.jspm.io/npm:@hotwired/stimulus@3.2.2/dist/stimulus.js
|
|
2
|
+
|
|
3
|
+
class EventListener{constructor(e,t,r){this.eventTarget=e;this.eventName=t;this.eventOptions=r;this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=extendEvent(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const r=e.index,s=t.index;return r<s?-1:r>s?1:0}))}}function extendEvent(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:false,stopImmediatePropagation(){this.immediatePropagationStopped=true;t.call(this)}})}}class Dispatcher{constructor(e){this.application=e;this.eventListenerMaps=new Map;this.started=false}start(){if(!this.started){this.started=true;this.eventListeners.forEach((e=>e.connect()))}}stop(){if(this.started){this.started=false;this.eventListeners.forEach((e=>e.disconnect()))}}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=false){this.fetchEventListenerForBinding(e).bindingDisconnected(e);t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);if(!t.hasBindings()){t.disconnect();this.removeMappedEventListenerFor(e)}}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:r,eventOptions:s}=e;const n=this.fetchEventListenerMapForEventTarget(t);const i=this.cacheKey(r,s);n.delete(i);0==n.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){const s=this.fetchEventListenerMapForEventTarget(e);const n=this.cacheKey(t,r);let i=s.get(n);if(!i){i=this.createEventListener(e,t,r);s.set(n,i)}return i}createEventListener(e,t,r){const s=new EventListener(e,t,r);this.started&&s.connect();return s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);if(!t){t=new Map;this.eventListenerMaps.set(e,t)}return t}cacheKey(e,t){const r=[e];Object.keys(t).sort().forEach((e=>{r.push(`${t[e]?"":"!"}${e}`)}));return r.join(":")}}const e={stop({event:e,value:t}){t&&e.stopPropagation();return true},prevent({event:e,value:t}){t&&e.preventDefault();return true},self({event:e,value:t,element:r}){return!t||r===e.target}};const t=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function parseActionDescriptorString(e){const r=e.trim();const s=r.match(t)||[];let n=s[2];let i=s[3];if(i&&!["keydown","keyup","keypress"].includes(n)){n+=`.${i}`;i=""}return{eventTarget:parseEventTarget(s[4]),eventName:n,eventOptions:s[7]?parseEventOptions(s[7]):{},identifier:s[5],methodName:s[6],keyFilter:s[1]||i}}function parseEventTarget(e){return"window"==e?window:"document"==e?document:void 0}function parseEventOptions(e){return e.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})}function stringifyEventTarget(e){return e==window?"window":e==document?"document":void 0}function camelize(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function namespaceCamelize(e){return camelize(e.replace(/--/g,"-").replace(/__/g,"_"))}function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function dasherize(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}function tokenize(e){return e.match(/[^\s]+/g)||[]}function isSomething(e){return null!==e&&void 0!==e}function hasProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const r=["meta","ctrl","alt","shift"];class Action{constructor(e,t,r,s){this.element=e;this.index=t;this.eventTarget=r.eventTarget||e;this.eventName=r.eventName||getDefaultEventNameForElement(e)||error("missing event name");this.eventOptions=r.eventOptions||{};this.identifier=r.identifier||error("missing identifier");this.methodName=r.methodName||error("missing method name");this.keyFilter=r.keyFilter||"";this.schema=s}static forToken(e,t){return new this(e.element,e.index,parseActionDescriptorString(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"";const t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return false;const t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return true;const s=t.filter((e=>!r.includes(e)))[0];if(!s)return false;hasProperty(this.keyMappings,s)||error(`contains unknown key filter: ${this.keyFilter}`);return this.keyMappings[s].toLowerCase()!==e.key.toLowerCase()}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return false;const t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){const e={};const t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:s}of Array.from(this.element.attributes)){const n=r.match(t);const i=n&&n[1];i&&(e[camelize(i)]=typecast(s))}return e}get eventTargetName(){return stringifyEventTarget(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){const[s,n,i,o]=r.map((e=>t.includes(e)));return e.metaKey!==s||e.ctrlKey!==n||e.altKey!==i||e.shiftKey!==o}}const s={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function getDefaultEventNameForElement(e){const t=e.tagName.toLowerCase();if(t in s)return s[t](e)}function error(e){throw new Error(e)}function typecast(e){try{return JSON.parse(e)}catch(t){return e}}class Binding{constructor(e,t){this.context=e;this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){const t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action;const{actionDescriptorFilters:r}=this.context.application;const{controller:s}=this.context;let n=true;for(const[i,o]of Object.entries(this.eventOptions))if(i in r){const c=r[i];n=n&&c({name:i,value:o,event:e,element:t,controller:s})}return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){const{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e);this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(t){const{identifier:r,controller:s,element:n,index:i}=this;const o={identifier:r,controller:s,element:n,index:i,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e))&&(!(e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class ElementObserver{constructor(e,t){this.mutationObserverInit={attributes:true,childList:true,subtree:true};this.element=e;this.started=false;this.delegate=t;this.elements=new Set;this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){if(!this.started){this.started=true;this.mutationObserver.observe(this.element,this.mutationObserverInit);this.refresh()}}pause(e){if(this.started){this.mutationObserver.disconnect();this.started=false}e();if(!this.started){this.mutationObserver.observe(this.element,this.mutationObserverInit);this.started=true}}stop(){if(this.started){this.mutationObserver.takeRecords();this.mutationObserver.disconnect();this.started=false}}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){if("attributes"==e.type)this.processAttributeChange(e.target,e.attributeName);else if("childList"==e.type){this.processRemovedNodes(e.removedNodes);this.processAddedNodes(e.addedNodes)}}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){if(!this.elements.has(e)&&this.elementIsActive(e)){this.elements.add(e);this.delegate.elementMatched&&this.delegate.elementMatched(e)}}removeElement(e){if(this.elements.has(e)){this.elements.delete(e);this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e)}}}class AttributeObserver{constructor(e,t,r){this.attributeName=t;this.delegate=r;this.elementObserver=new ElementObserver(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[];const r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function add(e,t,r){fetch(e,t).add(r)}function del(e,t,r){fetch(e,t).delete(r);prune(e,t)}function fetch(e,t){let r=e.get(t);if(!r){r=new Set;e.set(t,r)}return r}function prune(e,t){const r=e.get(t);null!=r&&0==r.size&&e.delete(t)}class Multimap{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){const e=Array.from(this.valuesByKey.values());return e.reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){const e=Array.from(this.valuesByKey.values());return e.reduce(((e,t)=>e+t.size),0)}add(e,t){add(this.valuesByKey,e,t)}delete(e,t){del(this.valuesByKey,e,t)}has(e,t){const r=this.valuesByKey.get(e);return null!=r&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){const t=Array.from(this.valuesByKey.values());return t.some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,r])=>r.has(e))).map((([e,t])=>e))}}class IndexedMultimap extends Multimap{constructor(){super();this.keysByValue=new Map}get values(){return Array.from(this.keysByValue.keys())}add(e,t){super.add(e,t);add(this.keysByValue,t,e)}delete(e,t){super.delete(e,t);del(this.keysByValue,t,e)}hasValue(e){return this.keysByValue.has(e)}getKeysForValue(e){const t=this.keysByValue.get(e);return t?Array.from(t):[]}}class SelectorObserver{constructor(e,t,r,s){this._selector=t;this.details=s;this.elementObserver=new ElementObserver(e,this);this.delegate=r;this.matchesByElement=new Multimap}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e;this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const{selector:t}=this;if(t){const r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}return false}matchElementsInTree(e){const{selector:t}=this;if(t){const r=this.matchElement(e)?[e]:[];const s=Array.from(e.querySelectorAll(t)).filter((e=>this.matchElement(e)));return r.concat(s)}return[]}elementMatched(e){const{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){const t=this.matchesByElement.getKeysForValue(e);for(const r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){const{selector:r}=this;if(r){const t=this.matchElement(e);const s=this.matchesByElement.has(r,e);t&&!s?this.selectorMatched(e,r):!t&&s&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details);this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details);this.matchesByElement.delete(t,e)}}class StringMapObserver{constructor(e,t){this.element=e;this.delegate=t;this.started=false;this.stringMap=new Map;this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){if(!this.started){this.started=true;this.mutationObserver.observe(this.element,{attributes:true,attributeOldValue:true});this.refresh()}}stop(){if(this.started){this.mutationObserver.takeRecords();this.mutationObserver.disconnect();this.started=false}}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const r=this.delegate.getStringMapKeyForAttribute(e);if(null!=r){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);const s=this.element.getAttribute(e);this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t);if(null==s){const t=this.stringMap.get(e);this.stringMap.delete(e);t&&this.stringMapKeyRemoved(r,e,t)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class TokenListObserver{constructor(e,t,r){this.attributeObserver=new AttributeObserver(e,t,this);this.delegate=r;this.tokensByElement=new Multimap}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t);this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e);this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e);this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e);const r=this.readTokensForElement(e);const s=zip(t,r).findIndex((([e,t])=>!tokensAreEqual(e,t)));return-1==s?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){const t=this.attributeName;const r=e.getAttribute(t)||"";return parseTokenString(r,e,t)}}function parseTokenString(e,t,r){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,s)=>({element:t,attributeName:r,content:e,index:s})))}function zip(e,t){const r=Math.max(e.length,t.length);return Array.from({length:r},((r,s)=>[e[s],t[s]]))}function tokensAreEqual(e,t){return e&&t&&e.index==t.index&&e.content==t.content}class ValueListObserver{constructor(e,t,r){this.tokenListObserver=new TokenListObserver(e,t,this);this.delegate=r;this.parseResultsByToken=new WeakMap;this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e;const{value:r}=this.fetchParseResultForToken(e);if(r){this.fetchValuesByTokenForElement(t).set(e,r);this.delegate.elementMatchedValue(t,r)}}tokenUnmatched(e){const{element:t}=e;const{value:r}=this.fetchParseResultForToken(e);if(r){this.fetchValuesByTokenForElement(t).delete(e);this.delegate.elementUnmatchedValue(t,r)}}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);if(!t){t=this.parseToken(e);this.parseResultsByToken.set(e,t)}return t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);if(!t){t=new Map;this.valuesByTokenByElement.set(e,t)}return t}parseToken(e){try{const t=this.delegate.parseValueForToken(e);return{value:t}}catch(e){return{error:e}}}}class BindingObserver{constructor(e,t){this.context=e;this.delegate=t;this.bindingsByAction=new Map}start(){if(!this.valueListObserver){this.valueListObserver=new ValueListObserver(this.element,this.actionAttribute,this);this.valueListObserver.start()}}stop(){if(this.valueListObserver){this.valueListObserver.stop();delete this.valueListObserver;this.disconnectAllActions()}}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new Binding(this.context,e);this.bindingsByAction.set(e,t);this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);if(t){this.bindingsByAction.delete(e);this.delegate.bindingDisconnected(t)}}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e,true)));this.bindingsByAction.clear()}parseValueForToken(e){const t=Action.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class ValueObserver{constructor(e,t){this.context=e;this.receiver=t;this.stringMapObserver=new StringMapObserver(this.element,this);this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start();this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){const s=this.valueDescriptorNameMap[t];if(null!==e){null===r&&(r=s.writer(s.defaultValue));this.invokeChangedCallback(t,e,r)}}stringMapKeyRemoved(e,t,r){const s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)void 0==r||this.controller.data.has(e)||this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){const s=`${e}Changed`;const n=this.receiver[s];if("function"==typeof n){const s=this.valueDescriptorNameMap[e];try{const e=s.reader(t);let i=r;r&&(i=s.reader(r));n.call(this.receiver,e,i)}catch(e){e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${s.name}" - ${e.message}`);throw e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};Object.keys(this.valueDescriptorMap).forEach((t=>{const r=this.valueDescriptorMap[t];e[r.name]=r}));return e}hasValue(e){const t=this.valueDescriptorNameMap[e];const r=`has${capitalize(t.name)}`;return this.receiver[r]}}class TargetObserver{constructor(e,t){this.context=e;this.delegate=t;this.targetsByName=new Multimap}start(){if(!this.tokenListObserver){this.tokenListObserver=new TokenListObserver(this.element,this.attributeName,this);this.tokenListObserver.start()}}stop(){if(this.tokenListObserver){this.disconnectAllTargets();this.tokenListObserver.stop();delete this.tokenListObserver}}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;if(!this.targetsByName.has(t,e)){this.targetsByName.add(t,e);null===(r=this.tokenListObserver)||void 0===r?void 0:r.pause((()=>this.delegate.targetConnected(e,t)))}}disconnectTarget(e,t){var r;if(this.targetsByName.has(t,e)){this.targetsByName.delete(t,e);null===(r=this.tokenListObserver)||void 0===r?void 0:r.pause((()=>this.delegate.targetDisconnected(e,t)))}}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function readInheritableStaticArrayValues(e,t){const r=getAncestorsForConstructor(e);return Array.from(r.reduce(((e,r)=>{getOwnStaticArrayValues(r,t).forEach((t=>e.add(t)));return e}),new Set))}function readInheritableStaticObjectPairs(e,t){const r=getAncestorsForConstructor(e);return r.reduce(((e,r)=>{e.push(...getOwnStaticObjectPairs(r,t));return e}),[])}function getAncestorsForConstructor(e){const t=[];while(e){t.push(e);e=Object.getPrototypeOf(e)}return t.reverse()}function getOwnStaticArrayValues(e,t){const r=e[t];return Array.isArray(r)?r:[]}function getOwnStaticObjectPairs(e,t){const r=e[t];return r?Object.keys(r).map((e=>[e,r[e]])):[]}class OutletObserver{constructor(e,t){this.started=false;this.context=e;this.delegate=t;this.outletsByName=new Multimap;this.outletElementsByName=new Multimap;this.selectorObserverMap=new Map;this.attributeObserverMap=new Map}start(){if(!this.started){this.outletDefinitions.forEach((e=>{this.setupSelectorObserverForOutlet(e);this.setupAttributeObserverForOutlet(e)}));this.started=true;this.dependentContexts.forEach((e=>e.refresh()))}}refresh(){this.selectorObserverMap.forEach((e=>e.refresh()));this.attributeObserverMap.forEach((e=>e.refresh()))}stop(){if(this.started){this.started=false;this.disconnectAllOutlets();this.stopSelectorObservers();this.stopAttributeObservers()}}stopSelectorObservers(){if(this.selectorObserverMap.size>0){this.selectorObserverMap.forEach((e=>e.stop()));this.selectorObserverMap.clear()}}stopAttributeObservers(){if(this.attributeObserverMap.size>0){this.attributeObserverMap.forEach((e=>e.stop()));this.attributeObserverMap.clear()}}selectorMatched(e,t,{outletName:r}){const s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){const s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){const r=this.selector(t);const s=this.hasOutlet(e,t);const n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return!!r&&(s&&n&&e.matches(r))}elementMatchedAttribute(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;if(!this.outletElementsByName.has(r,t)){this.outletsByName.add(r,e);this.outletElementsByName.add(r,t);null===(s=this.selectorObserverMap.get(r))||void 0===s?void 0:s.pause((()=>this.delegate.outletConnected(e,t,r)))}}disconnectOutlet(e,t,r){var s;if(this.outletElementsByName.has(r,t)){this.outletsByName.delete(r,e);this.outletElementsByName.delete(r,t);null===(s=this.selectorObserverMap.get(r))||void 0===s?void 0:s.pause((()=>this.delegate.outletDisconnected(e,t,r)))}}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){const t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){const t=this.selector(e);const r=new SelectorObserver(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r);r.start()}setupAttributeObserverForOutlet(e){const t=this.attributeNameForOutletName(e);const r=new AttributeObserver(this.scope.element,t,this);this.attributeObserverMap.set(e,r);r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find((t=>this.attributeNameForOutletName(t)===e))}get outletDependencies(){const e=new Multimap;this.router.modules.forEach((t=>{const r=t.definition.controllerConstructor;const s=readInheritableStaticArrayValues(r,"outlets");s.forEach((r=>e.add(r,t.identifier)))}));return e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter((t=>e.includes(t.identifier)))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find((t=>t.element===e))}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class Context{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:r,controller:s,element:n}=this;t=Object.assign({identifier:r,controller:s,element:n},t);this.application.logDebugActivity(this.identifier,e,t)};this.module=e;this.scope=t;this.controller=new e.controllerConstructor(this);this.bindingObserver=new BindingObserver(this,this.dispatcher);this.valueObserver=new ValueObserver(this,this.controller);this.targetObserver=new TargetObserver(this,this);this.outletObserver=new OutletObserver(this,this);try{this.controller.initialize();this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start();this.valueObserver.start();this.targetObserver.start();this.outletObserver.start();try{this.controller.connect();this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect();this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop();this.targetObserver.stop();this.valueObserver.stop();this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){const{identifier:s,controller:n,element:i}=this;r=Object.assign({identifier:s,controller:n,element:i},r);this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${namespaceCamelize(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${namespaceCamelize(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const r=this.controller;"function"==typeof r[e]&&r[e](...t)}}function bless(e){return shadow(e,getBlessedProperties(e))}function shadow(e,t){const r=i(e);const s=getShadowProperties(e.prototype,t);Object.defineProperties(r.prototype,s);return r}function getBlessedProperties(e){const t=readInheritableStaticArrayValues(e,"blessings");return t.reduce(((t,r)=>{const s=r(e);for(const e in s){const r=t[e]||{};t[e]=Object.assign(r,s[e])}return t}),{})}function getShadowProperties(e,t){return n(t).reduce(((r,s)=>{const n=getShadowedDescriptor(e,t,s);n&&Object.assign(r,{[s]:n});return r}),{})}function getShadowedDescriptor(e,t,r){const s=Object.getOwnPropertyDescriptor(e,r);const n=s&&"value"in s;if(!n){const e=Object.getOwnPropertyDescriptor(t,r).value;if(s){e.get=s.get||e.get;e.set=s.set||e.set}return e}}const n=(()=>"function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames)();const i=(()=>{function extendWithReflect(e){function extended(){return Reflect.construct(e,arguments,new.target)}extended.prototype=Object.create(e.prototype,{constructor:{value:extended}});Reflect.setPrototypeOf(extended,e);return extended}function testReflectExtension(){const a=function(){this.a.call(this)};const e=extendWithReflect(a);e.prototype.a=function(){};return new e}try{testReflectExtension();return extendWithReflect}catch(e){return e=>class extended extends e{}}})();function blessDefinition(e){return{identifier:e.identifier,controllerConstructor:bless(e.controllerConstructor)}}class Module{constructor(e,t){this.application=e;this.definition=blessDefinition(t);this.contextsByScope=new WeakMap;this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t);t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);if(t){this.connectedContexts.delete(t);t.disconnect()}}fetchContextForScope(e){let t=this.contextsByScope.get(e);if(!t){t=new Context(this,e);this.contextsByScope.set(e,t)}return t}}class ClassMap{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){const t=this.data.get(this.getDataKey(e))||"";return tokenize(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class DataMap{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const r=this.getAttributeNameForKey(e);this.element.setAttribute(r,t);return this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);this.element.removeAttribute(t);return true}return false}getAttributeNameForKey(e){return`data-${this.identifier}-${dasherize(e)}`}}class Guide{constructor(e){this.warnedKeysByObject=new WeakMap;this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);if(!s){s=new Set;this.warnedKeysByObject.set(e,s)}if(!s.has(t)){s.add(t);this.logger.warn(r,e)}}}function attributeValueContainsToken(e,t){return`[${e}~="${t}"]`}class TargetSet{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){const t=this.schema.targetAttributeForScope(this.identifier);return attributeValueContainsToken(t,e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return attributeValueContainsToken(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:r}=this;const s=this.schema.targetAttribute;const n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class OutletSet{constructor(e,t){this.scope=e;this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findOutlet(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllOutlets(t)]),[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){const r=this.scope.queryElements(e);return r.filter((r=>this.matchesElement(r,e,t)))[0]}findAllElements(e,t){const r=this.scope.queryElements(e);return r.filter((r=>this.matchesElement(r,e,t)))}matchesElement(e,t,r){const s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}}class Scope{constructor(e,t,r,s){this.targets=new TargetSet(this);this.classes=new ClassMap(this);this.data=new DataMap(this);this.containsElement=e=>e.closest(this.controllerSelector)===this.element;this.schema=e;this.element=t;this.identifier=r;this.guide=new Guide(s);this.outlets=new OutletSet(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return attributeValueContainsToken(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Scope(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class ScopeObserver{constructor(e,t,r){this.element=e;this.schema=t;this.delegate=r;this.valueListObserver=new ValueListObserver(this.element,this.controllerAttribute,this);this.scopesByIdentifierByElement=new WeakMap;this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){const r=this.fetchScopesByIdentifierForElement(e);let s=r.get(t);if(!s){s=this.delegate.createScopeForElementAndIdentifier(e,t);r.set(t,s)}return s}elementMatchedValue(e,t){const r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r);1==r&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const r=this.scopeReferenceCounts.get(t);if(r){this.scopeReferenceCounts.set(t,r-1);1==r&&this.delegate.scopeDisconnected(t)}}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);if(!t){t=new Map;this.scopesByIdentifierByElement.set(e,t)}return t}}class Router{constructor(e){this.application=e;this.scopeObserver=new ScopeObserver(this.element,this.schema,this);this.scopesByIdentifier=new Multimap;this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new Module(this.application,e);this.connectModule(t);const r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find((t=>t.element==e))}proposeToConnectScopeForElementAndIdentifier(e,t){const r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new Scope(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e);const t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier);const t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach((t=>e.disconnectContextForScope(t)))}}const o={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},objectFromEntries("abcdefghijklmnopqrstuvwxyz".split("").map((e=>[e,e])))),objectFromEntries("0123456789".split("").map((e=>[e,e]))))};function objectFromEntries(e){return e.reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{})}class Application{constructor(t=document.documentElement,r=o){this.logger=console;this.debug=false;this.logDebugActivity=(e,t,r={})=>{this.debug&&this.logFormattedMessage(e,t,r)};this.element=t;this.schema=r;this.dispatcher=new Dispatcher(this);this.router=new Router(this);this.actionDescriptorFilters=Object.assign({},e)}static start(e,t){const r=new this(e,t);r.start();return r}async start(){await domReady();this.logDebugActivity("application","starting");this.dispatcher.start();this.router.start();this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping");this.dispatcher.stop();this.router.stop();this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){const r=Array.isArray(e)?e:[e,...t];r.forEach((e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)}))}unload(e,...t){const r=Array.isArray(e)?e:[e,...t];r.forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error("%s\n\n%o\n\n%o",t,e,r);null===(s=window.onerror)||void 0===s?void 0:s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r);this.logger.groupCollapsed(`${e} #${t}`);this.logger.log("details:",Object.assign({},r));this.logger.groupEnd()}}function domReady(){return new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()}))}function ClassPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"classes");return t.reduce(((e,t)=>Object.assign(e,propertiesForClassDefinition(t))),{})}function propertiesForClassDefinition(e){return{[`${e}Class`]:{get(){const{classes:t}=this;if(t.has(e))return t.get(e);{const r=t.getAttributeName(e);throw new Error(`Missing attribute "${r}"`)}}},[`${e}Classes`]:{get(){return this.classes.getAll(e)}},[`has${capitalize(e)}Class`]:{get(){return this.classes.has(e)}}}}function OutletPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"outlets");return t.reduce(((e,t)=>Object.assign(e,propertiesForOutletDefinition(t))),{})}function getOutletController(e,t,r){return e.application.getControllerForElementAndIdentifier(t,r)}function getControllerAndEnsureConnectedScope(e,t,r){let s=getOutletController(e,t,r);if(s)return s;e.application.router.proposeToConnectScopeForElementAndIdentifier(t,r);s=getOutletController(e,t,r);return s||void 0}function propertiesForOutletDefinition(e){const t=namespaceCamelize(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e);const r=this.outlets.getSelectorForOutletName(e);if(t){const r=getControllerAndEnsureConnectedScope(this,t,e);if(r)return r;throw new Error(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map((t=>{const r=getControllerAndEnsureConnectedScope(this,t,e);if(r)return r;console.warn(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`,t)})).filter((e=>e)):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e);const r=this.outlets.getSelectorForOutletName(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${capitalize(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}function TargetPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"targets");return t.reduce(((e,t)=>Object.assign(e,propertiesForTargetDefinition(t))),{})}function propertiesForTargetDefinition(e){return{[`${e}Target`]:{get(){const t=this.targets.find(e);if(t)return t;throw new Error(`Missing target element "${e}" for "${this.identifier}" controller`)}},[`${e}Targets`]:{get(){return this.targets.findAll(e)}},[`has${capitalize(e)}Target`]:{get(){return this.targets.has(e)}}}}function ValuePropertiesBlessing(e){const t=readInheritableStaticObjectPairs(e,"values");const r={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const r=parseValueDefinitionPair(t,this.identifier);const s=this.data.getAttributeNameForKey(r.key);return Object.assign(e,{[s]:r})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,propertiesForValueDefinitionPair(t))),r)}function propertiesForValueDefinitionPair(e,t){const r=parseValueDefinitionPair(e,t);const{key:s,name:n,reader:i,writer:o}=r;return{[n]:{get(){const e=this.data.get(s);return null!==e?i(e):r.defaultValue},set(e){void 0===e?this.data.delete(s):this.data.set(s,o(e))}},[`has${capitalize(n)}`]:{get(){return this.data.has(s)||r.hasCustomDefaultValue}}}}function parseValueDefinitionPair([e,t],r){return valueDescriptorForTokenAndTypeDefinition({controller:r,token:e,typeDefinition:t})}function parseValueTypeConstant(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function parseValueTypeDefault(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}function parseValueTypeObject(e){const{controller:t,token:r,typeObject:s}=e;const n=isSomething(s.type);const i=isSomething(s.default);const o=n&&i;const c=n&&!i;const l=!n&&i;const h=parseValueTypeConstant(s.type);const u=parseValueTypeDefault(e.typeObject.default);if(c)return h;if(l)return u;if(h!==u){const e=t?`${t}.${r}`:r;throw new Error(`The specified default value for the Stimulus Value "${e}" must match the defined type "${h}". The provided default value of "${s.default}" is of type "${u}".`)}return o?h:void 0}function parseValueTypeDefinition(e){const{controller:t,token:r,typeDefinition:s}=e;const n={controller:t,token:r,typeObject:s};const i=parseValueTypeObject(n);const o=parseValueTypeDefault(s);const c=parseValueTypeConstant(s);const l=i||o||c;if(l)return l;const h=t?`${t}.${s}`:r;throw new Error(`Unknown value type "${h}" for "${r}" value`)}function defaultValueForDefinition(e){const t=parseValueTypeConstant(e);if(t)return c[t];const r=hasProperty(e,"default");const s=hasProperty(e,"type");const n=e;if(r)return n.default;if(s){const{type:e}=n;const t=parseValueTypeConstant(e);if(t)return c[t]}return e}function valueDescriptorForTokenAndTypeDefinition(e){const{token:t,typeDefinition:r}=e;const s=`${dasherize(t)}-value`;const n=parseValueTypeDefinition(e);return{type:n,key:s,name:camelize(s),get defaultValue(){return defaultValueForDefinition(r)},get hasCustomDefaultValue(){return void 0!==parseValueTypeDefault(r)},reader:l[n],writer:h[n]||h.default}}const c={get array(){return[]},boolean:false,number:0,get object(){return{}},string:""};const l={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${parseValueTypeDefault(t)}"`);return t},boolean(e){return!("0"==e||"false"==String(e).toLowerCase())},number(e){return Number(e.replace(/_/g,""))},object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${parseValueTypeDefault(t)}"`);return t},string(e){return e}};const h={default:writeString,array:writeJSON,object:writeJSON};function writeJSON(e){return JSON.stringify(e)}function writeString(e){return`${e}`}class Controller{constructor(e){this.context=e}static get shouldLoad(){return true}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=true,cancelable:i=true}={}){const o=s?`${s}:${e}`:e;const c=new CustomEvent(o,{detail:r,bubbles:n,cancelable:i});t.dispatchEvent(c);return c}}Controller.blessings=[ClassPropertiesBlessing,TargetPropertiesBlessing,ValuePropertiesBlessing,OutletPropertiesBlessing];Controller.targets=[];Controller.outlets=[];Controller.values={};export{Application,AttributeObserver,Context,Controller,ElementObserver,IndexedMultimap,Multimap,SelectorObserver,StringMapObserver,TokenListObserver,ValueListObserver,add,o as defaultSchema,del,fetch,prune};
|
|
4
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @hotwired/turbo-rails@8.0.16 downloaded from https://ga.jspm.io/npm:@hotwired/turbo-rails@8.0.16/app/javascript/turbo/index.js
|
|
2
|
+
|
|
3
|
+
import*as t from"@hotwired/turbo";import{connectStreamSource as e,disconnectStreamSource as n}from"@hotwired/turbo";export{t as Turbo};let s;async function o(){return s||i(r().then(i))}function i(t){return s=t}async function r(){const{createConsumer:t}=await import("@rails/actioncable/src");return t()}async function c(t,e){const{subscriptions:n}=await o();return n.create(t,e)}var a=Object.freeze(Object.defineProperty({__proto__:null,createConsumer:r,getConsumer:o,setConsumer:i,subscribeTo:c},Symbol.toStringTag,{value:"Module"}));function u(t){return t&&typeof t==="object"?t instanceof Date||t instanceof RegExp?t:Array.isArray(t)?t.map(u):Object.keys(t).reduce((function(e,n){var s=n[0].toLowerCase()+n.slice(1).replace(/([A-Z]+)/g,(function(t,e){return"_"+e.toLowerCase()}));e[s]=u(t[n]);return e}),{}):t}class TurboCableStreamSourceElement extends HTMLElement{static observedAttributes=["channel","signed-stream-name"];async connectedCallback(){e(this);this.subscription=await c(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){n(this);this.subscription&&this.subscription.unsubscribe();this.subscriptionDisconnected()}attributeChangedCallback(){if(this.subscription){this.disconnectedCallback();this.connectedCallback()}}dispatchMessageEvent(t){const e=new MessageEvent("message",{data:t});return this.dispatchEvent(e)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){const t=this.getAttribute("channel");const e=this.getAttribute("signed-stream-name");return{channel:t,signed_stream_name:e,...u({...this.dataset})}}}customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",TurboCableStreamSourceElement);function b(t){if(t.target instanceof HTMLFormElement){const{target:e,detail:{fetchOptions:n}}=t;e.addEventListener("turbo:submit-start",(({detail:{formSubmission:{submitter:t}}})=>{const s=h(n.body)?n.body:new URLSearchParams;const o=d(t,s,e);if(!/get/i.test(o)){/post/i.test(o)?s.delete("_method"):s.set("_method",o);n.method="post"}}),{once:true})}}function d(t,e,n){const s=m(t);const o=e.get("_method");const i=n.getAttribute("method")||"get";return typeof s=="string"?s:typeof o=="string"?o:i}function m(t){return t instanceof HTMLButtonElement||t instanceof HTMLInputElement?t.name==="_method"?t.value:t.hasAttribute("formmethod")?t.formMethod:null:null}function h(t){return t instanceof FormData||t instanceof URLSearchParams}window.Turbo=t;addEventListener("turbo:before-fetch-request",b);export{a as cable};
|
|
4
|
+
|