avo 3.30.4 → 4.0.0.beta.2
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/Gemfile +18 -1
- data/Gemfile.lock +257 -174
- data/README.md +1 -1
- data/app/assets/builds/avo/application.css +13979 -0
- data/app/assets/builds/avo/application.js +1160 -0
- data/app/assets/builds/avo/application.js.map +7 -0
- data/app/assets/builds/avo/late-registration.js +2 -0
- data/app/assets/builds/avo/late-registration.js.map +7 -0
- data/app/assets/config/avo_manifest.js +2 -1
- data/app/assets/images/avo/placeholder.svg +1 -0
- data/app/assets/stylesheets/application.css +250 -0
- data/app/assets/stylesheets/css/button-group.css +23 -0
- data/app/assets/stylesheets/css/components/avatar.css +128 -0
- data/app/assets/stylesheets/css/components/breadcrumbs.css +43 -0
- data/app/assets/stylesheets/css/components/button.css +343 -0
- data/app/assets/stylesheets/css/components/color_scheme_switcher.css +226 -0
- data/app/assets/stylesheets/css/components/discreet_information.css +49 -0
- data/app/assets/stylesheets/css/components/field-wrapper.css +107 -0
- data/app/assets/stylesheets/css/components/grid.css +120 -0
- data/app/assets/stylesheets/css/components/input.css +312 -0
- data/app/assets/stylesheets/css/components/modal.css +228 -0
- data/app/assets/stylesheets/css/components/tooltip.css +25 -0
- data/app/assets/stylesheets/css/components/ui/badge.css +143 -0
- data/app/assets/stylesheets/css/components/ui/card.css +95 -0
- data/app/assets/stylesheets/css/components/ui/checkbox.css +50 -0
- data/app/assets/stylesheets/css/components/ui/description_list.css +3 -0
- data/app/assets/stylesheets/css/components/ui/dropdown.css +68 -0
- data/app/assets/stylesheets/css/components/ui/file_upload_input.css +94 -0
- data/app/assets/stylesheets/css/components/ui/file_upload_item.css +78 -0
- data/app/assets/stylesheets/css/components/ui/panel.css +59 -0
- data/app/assets/stylesheets/css/components/ui/panel_header.css +48 -0
- data/app/assets/stylesheets/css/components/ui/radio.css +22 -0
- data/app/assets/stylesheets/css/components/ui/tabs.css +74 -0
- data/app/assets/stylesheets/css/css-animations.css +54 -0
- data/app/assets/stylesheets/css/fields/code.css +75 -9
- data/app/assets/stylesheets/css/fields/easy-mde.css +7 -0
- data/app/assets/stylesheets/css/fields/key_value.css +97 -0
- data/app/assets/stylesheets/css/fields/progress.css +4 -4
- data/app/assets/stylesheets/css/fields/status.css +7 -1
- data/app/assets/stylesheets/css/fields/tags.css +33 -16
- data/app/assets/stylesheets/css/fields/tiptap.css +17 -15
- data/app/assets/stylesheets/css/fields/trix.css +62 -2
- data/app/assets/stylesheets/css/fonts.css +24 -24
- data/app/assets/stylesheets/css/layout.css +135 -0
- data/app/assets/stylesheets/css/pagination.css +114 -78
- data/app/assets/stylesheets/css/resource-controls.css +13 -0
- data/app/assets/stylesheets/css/search.css +22 -12
- data/app/assets/stylesheets/css/sidebar.css +310 -24
- data/app/assets/stylesheets/css/table.css +60 -0
- data/app/assets/stylesheets/css/tooltips.css +1 -1
- data/app/assets/stylesheets/css/typography.css +10 -1
- data/app/assets/stylesheets/css/variables.css +318 -0
- data/app/assets/svgs/avo/moon-plus-plus.svg +1 -0
- data/app/components/avo/actions_component.html.erb +30 -36
- data/app/components/avo/actions_component.rb +8 -11
- data/app/components/avo/alert_component.html.erb +3 -3
- data/app/components/avo/alert_component.rb +1 -1
- data/app/components/avo/asset_manager/javascript_component.html.erb +1 -2
- data/app/components/avo/backtrace_alert_component.html.erb +4 -4
- data/app/components/avo/base_component.rb +3 -4
- data/app/components/avo/breadcrumb_element_component.html.erb +17 -0
- data/app/components/avo/breadcrumb_element_component.rb +21 -0
- data/app/components/avo/breadcrumbs_component.html.erb +19 -0
- data/app/components/avo/breadcrumbs_component.rb +5 -0
- data/app/components/avo/button_component.rb +20 -126
- data/app/components/avo/clipboard_component.html.erb +3 -2
- data/app/components/avo/clipboard_component.rb +1 -1
- data/app/components/avo/component_missing_component.rb +11 -0
- data/app/components/avo/cover_component.html.erb +3 -0
- data/app/components/avo/cover_component.rb +25 -0
- data/app/components/avo/debug/status_component.html.erb +59 -0
- data/app/components/avo/debug/status_component.rb +30 -0
- data/app/components/avo/description_list_component.rb +11 -0
- data/app/components/avo/discreet_information_component.html.erb +31 -6
- data/app/components/avo/discreet_information_component.rb +23 -32
- data/app/components/avo/divider_component.html.erb +2 -2
- data/app/components/avo/empty_state_component.html.erb +2 -9
- data/app/components/avo/empty_state_component.rb +0 -8
- data/app/components/avo/field_wrapper_component.html.erb +21 -22
- data/app/components/avo/field_wrapper_component.rb +9 -18
- data/app/components/avo/fields/avatar_field/index_component.html.erb +9 -0
- data/app/components/avo/fields/avatar_field/index_component.rb +4 -0
- data/app/components/avo/fields/badge_field/index_component.html.erb +7 -1
- data/app/components/avo/fields/badge_field/show_component.html.erb +6 -1
- data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +16 -14
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +13 -3
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +2 -2
- data/app/components/avo/fields/boolean_group_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/boolean_group_field/edit_component.rb +2 -3
- data/app/components/avo/fields/code_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/common/boolean_check_component.rb +3 -3
- data/app/components/avo/fields/common/boolean_group_component.html.erb +2 -2
- data/app/components/avo/fields/common/files/controls_component.html.erb +30 -27
- data/app/components/avo/fields/common/files/controls_component.rb +0 -1
- data/app/components/avo/fields/common/files/list_viewer_component.html.erb +4 -5
- data/app/components/avo/fields/common/files/view_type/grid_item_component.html.erb +1 -1
- data/app/components/avo/fields/common/files/view_type/list_item_component.html.erb +7 -19
- data/app/components/avo/fields/common/heading_component.html.erb +2 -2
- data/app/components/avo/fields/common/heading_component.rb +1 -1
- data/app/components/avo/fields/common/key_value_component.html.erb +20 -24
- data/app/components/avo/fields/common/nested_field_component.html.erb +1 -1
- data/app/components/avo/fields/common/nested_field_component.rb +1 -1
- data/app/components/avo/fields/common/progress_bar_component.html.erb +2 -2
- data/app/components/avo/fields/common/stars_component.html.erb +1 -1
- data/app/components/avo/fields/common/status_viewer_component.html.erb +4 -10
- data/app/components/avo/fields/date_field/edit_component.html.erb +14 -1
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +3 -3
- data/app/components/avo/fields/easy_mde_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/edit_component.rb +9 -5
- data/app/components/avo/fields/file_field/edit_component.html.erb +14 -6
- data/app/components/avo/fields/files_field/edit_component.html.erb +11 -4
- data/app/components/avo/fields/has_one_field/show_component.html.erb +10 -9
- data/app/components/avo/fields/heading_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/show_component.html.erb +2 -2
- data/app/components/avo/fields/password_field/edit_component.html.erb +5 -7
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/radio_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/show_component.rb +4 -7
- data/app/components/avo/fields/stars_field/edit_component.html.erb +3 -4
- data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/tag_component.html.erb +7 -8
- data/app/components/avo/fields/time_field/edit_component.html.erb +3 -3
- data/app/components/avo/fields/tiptap_field/edit_component.html.erb +11 -11
- data/app/components/avo/fields/tiptap_field/show_component.html.erb +4 -4
- data/app/components/avo/fields/trix_field/edit_component.html.erb +2 -2
- data/app/components/avo/filters_component.html.erb +8 -16
- data/app/components/avo/index/field_wrapper_component.html.erb +9 -2
- data/app/components/avo/index/field_wrapper_component.rb +0 -16
- data/app/components/avo/index/grid_cover_empty_state_component.html.erb +16 -2
- data/app/components/avo/index/grid_cover_empty_state_component.rb +90 -0
- data/app/components/avo/index/grid_item_component.html.erb +29 -12
- data/app/components/avo/index/grid_item_component.rb +12 -10
- data/app/components/avo/index/resource_controls_component.html.erb +1 -1
- data/app/components/avo/index/resource_controls_component.rb +7 -17
- data/app/components/avo/index/resource_controls_dropdown_component.html.erb +3 -0
- data/app/components/avo/index/resource_controls_dropdown_component.rb +81 -0
- data/app/components/avo/index/table_row_component.html.erb +11 -11
- data/app/components/avo/items/panel_component.html.erb +8 -18
- data/app/components/avo/items/panel_component.rb +0 -20
- data/app/components/avo/items/switcher_component.html.erb +60 -1
- data/app/components/avo/items/switcher_component.rb +10 -5
- data/app/components/avo/items/visible_items_component.html.erb +2 -1
- data/app/components/avo/items/visible_items_component.rb +1 -0
- data/app/components/avo/media_library/item_details_component.html.erb +2 -2
- data/app/components/avo/media_library/list_component.html.erb +24 -19
- data/app/components/avo/media_library/list_component.rb +2 -2
- data/app/components/avo/media_library/list_item_component.html.erb +3 -3
- data/app/components/avo/modal_component.html.erb +52 -20
- data/app/components/avo/modal_component.rb +7 -12
- data/app/components/avo/paginator_component.html.erb +46 -33
- data/app/components/avo/paginator_component.rb +10 -5
- data/app/components/avo/panel_name_component.html.erb +1 -1
- data/app/components/avo/profile_item_component.html.erb +4 -4
- data/app/components/avo/profile_item_component.rb +2 -4
- data/app/components/avo/referrer_params_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +8 -19
- data/app/components/avo/resource_listing_component.html.erb +22 -0
- data/app/components/avo/resource_listing_component.rb +28 -0
- data/app/components/avo/resource_sidebar_component.html.erb +2 -2
- data/app/components/avo/resource_sidebar_component.rb +0 -4
- data/app/components/avo/row_component.html.erb +1 -1
- data/app/components/avo/row_selector_component.html.erb +2 -4
- data/app/components/avo/row_selector_component.rb +0 -1
- data/app/components/avo/search_overlay_component.html.erb +6 -0
- data/app/components/avo/search_overlay_component.rb +2 -0
- data/app/components/avo/sidebar/base_item_component.rb +9 -9
- data/app/components/avo/sidebar/group_component.html.erb +23 -27
- data/app/components/avo/sidebar/group_component.rb +4 -0
- data/app/components/avo/sidebar/link_component.html.erb +30 -7
- data/app/components/avo/sidebar/link_component.rb +30 -2
- data/app/components/avo/sidebar/section_component.html.erb +31 -11
- data/app/components/avo/sidebar/section_component.rb +1 -3
- data/app/components/avo/sidebar_component.html.erb +35 -36
- data/app/components/avo/sidebar_component.rb +16 -0
- data/app/components/avo/sidebar_profile_component.html.erb +27 -36
- data/app/components/avo/sidebar_profile_component.rb +14 -0
- data/app/components/avo/tab_group_component.html.erb +21 -9
- data/app/components/avo/tab_group_component.rb +54 -15
- data/app/components/avo/turbo_frame_wrapper_component.html.erb +4 -8
- data/app/components/avo/turbo_frame_wrapper_component.rb +9 -0
- data/app/components/avo/u_i/avatar_component.html.erb +11 -0
- data/app/components/avo/u_i/avatar_component.rb +61 -0
- data/app/components/avo/u_i/badge_component.html.erb +9 -0
- data/app/components/avo/u_i/badge_component.rb +35 -0
- data/app/components/avo/u_i/card_component.html.erb +29 -0
- data/app/components/avo/u_i/card_component.rb +65 -0
- data/app/components/avo/u_i/dropdown_component.html.erb +14 -0
- data/app/components/avo/u_i/dropdown_component.rb +26 -0
- data/app/components/avo/u_i/dropdown_menu_component.html.erb +16 -0
- data/app/components/avo/u_i/dropdown_menu_component.rb +8 -0
- data/app/components/avo/u_i/file_upload_input_component.html.erb +26 -0
- data/app/components/avo/u_i/file_upload_input_component.rb +15 -0
- data/app/components/avo/u_i/file_upload_item_component.html.erb +48 -0
- data/app/components/avo/u_i/file_upload_item_component.rb +17 -0
- data/app/components/avo/u_i/icon_button_component.html.erb +7 -0
- data/app/components/avo/u_i/icon_button_component.rb +22 -0
- data/app/components/avo/u_i/panel_component.html.erb +49 -0
- data/app/components/avo/u_i/panel_component.rb +29 -0
- data/app/components/avo/u_i/panel_header_component.html.erb +37 -0
- data/app/components/avo/u_i/panel_header_component.rb +24 -0
- data/app/components/avo/u_i/search_input_component.html.erb +28 -0
- data/app/components/avo/u_i/search_input_component.rb +12 -0
- data/app/components/avo/u_i/tabs/tab_component.html.erb +26 -0
- data/app/components/avo/u_i/tabs/tab_component.rb +25 -0
- data/app/components/avo/u_i/tabs/tabs_component.html.erb +7 -0
- data/app/components/avo/u_i/tabs/tabs_component.rb +13 -0
- data/app/components/avo/view_types/base_view_type_component.rb +26 -0
- data/app/components/avo/view_types/grid_component.html.erb +18 -0
- data/app/components/avo/view_types/grid_component.rb +4 -0
- data/app/components/avo/view_types/map_component.html.erb +17 -0
- data/app/components/avo/view_types/map_component.rb +110 -0
- data/app/components/avo/view_types/table_component.html.erb +63 -0
- data/app/components/avo/{index/resource_table_component.rb → view_types/table_component.rb} +1 -10
- data/app/components/avo/views/resource_edit_component.html.erb +12 -18
- data/app/components/avo/views/resource_edit_component.rb +1 -27
- data/app/components/avo/views/resource_index_component.html.erb +97 -74
- data/app/components/avo/views/resource_index_component.rb +23 -3
- data/app/components/avo/views/resource_show_component.html.erb +4 -2
- data/app/components/avo/views/resource_show_component.rb +1 -4
- data/app/controllers/avo/associations_controller.rb +1 -1
- data/app/controllers/avo/base_application_controller.rb +7 -5
- data/app/controllers/avo/base_controller.rb +139 -40
- data/app/controllers/avo/debug_controller.rb +0 -29
- data/app/controllers/avo/media_library_controller.rb +17 -1
- data/app/controllers/avo/search_controller.rb +5 -0
- data/app/controllers/concerns/avo/initializes_avo.rb +7 -8
- data/app/helpers/avo/application_helper.rb +60 -46
- data/app/helpers/avo/turbo_stream_actions_helper.rb +10 -1
- data/app/helpers/avo/url_helpers.rb +3 -2
- data/app/javascript/{avo.base.js → application.js} +9 -18
- data/app/javascript/js/application.js +40 -0
- data/app/javascript/js/controllers/action_controller.js +4 -4
- data/app/javascript/js/controllers/actions_overflow_controller.js +21 -6
- data/app/javascript/js/controllers/color_scheme_switcher_controller.js +226 -0
- data/app/javascript/js/controllers/dropdown_menu_controller.js +42 -0
- data/app/javascript/js/controllers/fields/code_field_controller.js +20 -3
- data/app/javascript/js/controllers/fields/easy_mde_controller.js +23 -1
- data/app/javascript/js/controllers/fields/key_value_controller.js +43 -39
- data/app/javascript/js/controllers/fields/panel_refresh_controller.js +4 -0
- data/app/javascript/js/controllers/fields/tags_field_controller.js +2 -2
- data/app/javascript/js/controllers/fields/tags_field_helpers.js +4 -6
- data/app/javascript/js/controllers/grid_cover_empty_state_controller.js +42 -0
- data/app/javascript/js/controllers/item_selector_controller.js +0 -2
- data/app/javascript/js/controllers/loading_button_controller.js +1 -5
- data/app/javascript/js/controllers/map_dark_mode_controller.js +131 -0
- data/app/javascript/js/controllers/menu_controller.js +38 -16
- data/app/javascript/js/controllers/modal_controller.js +16 -0
- data/app/javascript/js/controllers/modal_size_controller.js +83 -0
- data/app/javascript/js/controllers/nested_form_controller.js +2 -2
- data/app/javascript/js/controllers/password_visibility_controller.js +13 -0
- data/app/javascript/js/controllers/preview_controller.js +2 -2
- data/app/javascript/js/controllers/resource_search_controller.js +123 -0
- data/app/javascript/js/controllers/search_controller.js +10 -29
- data/app/javascript/js/controllers/sidebar_controller.js +29 -9
- data/app/javascript/js/controllers/table_row_controller.js +28 -0
- data/app/javascript/js/controllers/tippy_controller.js +1 -1
- data/app/javascript/js/controllers/toggle_controller.js +40 -5
- data/app/javascript/js/controllers.js +14 -2
- data/app/javascript/js/custom-stream-actions.js +10 -8
- data/app/views/avo/actions/show.html.erb +14 -10
- data/app/views/avo/base/_boolean_filter.html.erb +1 -1
- data/app/views/avo/base/_date_time_filter.html.erb +3 -3
- data/app/views/avo/base/_multiple_select_filter.html.erb +1 -1
- data/app/views/avo/base/_new_via_belongs_to.html.erb +2 -3
- data/app/views/avo/base/_text_filter.html.erb +1 -1
- data/app/views/avo/base/preview.html.erb +5 -4
- data/app/views/avo/debug/status.html.erb +5 -92
- data/app/views/avo/debug/status.text.erb +0 -2
- data/app/views/avo/home/_actions.html.erb +1 -1
- data/app/views/avo/home/_dashboards.html.erb +1 -1
- data/app/views/avo/home/_filters.html.erb +1 -1
- data/app/views/avo/home/_resources.html.erb +2 -2
- data/app/views/avo/home/failed_to_load.html.erb +2 -2
- data/app/views/avo/home/index.html.erb +25 -25
- data/app/views/avo/media_library/_form.html.erb +43 -28
- data/app/views/avo/media_library/show.html.erb +7 -3
- data/app/views/avo/modal/_size_selector.html.erb +46 -0
- data/app/views/avo/partials/_alerts.html.erb +1 -1
- data/app/views/avo/partials/_color_scheme_switcher.html.erb +106 -0
- data/app/views/avo/partials/_color_theme_override.html.erb +49 -0
- data/app/views/avo/partials/_confirm_dialog.html.erb +19 -17
- data/app/views/avo/partials/_custom_tools_alert.html.erb +6 -6
- data/app/views/avo/partials/_footer.html.erb +1 -1
- data/app/views/avo/partials/_header.html.erb +1 -1
- data/app/views/avo/partials/_javascript.html.erb +0 -2
- data/app/views/avo/partials/_navbar.html.erb +53 -8
- data/app/views/avo/partials/_sortable_component.html.erb +1 -1
- data/app/views/avo/partials/_table_header.html.erb +28 -19
- data/app/views/avo/partials/_view_toggle_button.html.erb +6 -29
- data/app/views/avo/partials/distribution_chart.html.erb +2 -2
- data/app/views/avo/private/_links_and_buttons.html.erb +12 -8
- data/app/views/avo/private/design.html.erb +8 -4
- data/app/views/avo/sidebar/_license_warning.html.erb +3 -3
- data/app/views/layouts/avo/application.html.erb +39 -17
- data/app/views/layouts/avo/modal.html.erb +7 -0
- data/avo.gemspec +3 -4
- data/config/i18n-tasks.yml +1 -1
- data/config/importmap.rb +1 -0
- data/config/initializers/pagy.rb +5 -25
- data/config/routes/dynamic_routes.rb +4 -0
- data/config/routes.rb +6 -7
- data/db/factories.rb +14 -0
- data/lib/avo/asset_manager.rb +2 -0
- data/lib/avo/avatar.rb +7 -0
- data/lib/avo/base_action.rb +16 -4
- data/lib/avo/concerns/breadcrumbs.rb +7 -66
- data/lib/avo/concerns/form_builder.rb +41 -0
- data/lib/avo/concerns/{has_profile_photo.rb → has_avatar.rb} +8 -4
- data/lib/avo/concerns/{has_cover_photo.rb → has_cover.rb} +4 -4
- data/lib/avo/concerns/has_description.rb +9 -0
- data/lib/avo/concerns/has_item_type.rb +6 -2
- data/lib/avo/concerns/has_items.rb +43 -58
- data/lib/avo/concerns/pagination.rb +29 -19
- data/lib/avo/concerns/row_controls_configuration.rb +22 -15
- data/lib/avo/configuration/branding.rb +7 -7
- data/lib/avo/configuration.rb +92 -45
- data/lib/avo/{cover_photo.rb → cover.rb} +2 -2
- data/lib/avo/current.rb +0 -11
- data/lib/avo/discreet_information.rb +52 -29
- data/lib/avo/dsl/field_parser.rb +1 -1
- data/lib/avo/engine.rb +41 -8
- data/lib/avo/error_manager.rb +1 -1
- data/lib/avo/fields/avatar_field.rb +19 -0
- data/lib/avo/fields/badge_field.rb +23 -3
- data/lib/avo/fields/base_field.rb +46 -1
- data/lib/avo/fields/concerns/dom_id.rb +17 -0
- data/lib/avo/fields/concerns/file_authorization.rb +4 -0
- data/lib/avo/fields/concerns/has_html_attributes.rb +1 -1
- data/lib/avo/fields/concerns/is_searchable.rb +2 -5
- data/lib/avo/fields/concerns/nested.rb +1 -1
- data/lib/avo/fields/files_field.rb +2 -2
- data/lib/avo/fields/frame_base_field.rb +2 -2
- data/lib/avo/fields/id_field.rb +5 -1
- data/lib/avo/fields/progress_bar_field.rb +1 -1
- data/lib/avo/fields/text_field.rb +1 -1
- data/lib/avo/photo_object.rb +12 -1
- data/lib/avo/plugin_manager.rb +4 -0
- data/lib/avo/resources/base.rb +33 -21
- data/lib/avo/resources/controls/actions_list.rb +3 -3
- data/lib/avo/resources/controls/base_control.rb +1 -1
- data/lib/avo/resources/items/card.rb +16 -0
- data/lib/avo/resources/items/header.rb +11 -0
- data/lib/avo/resources/items/holder.rb +18 -23
- data/lib/avo/resources/items/item_group.rb +5 -7
- data/lib/avo/resources/items/sidebar.rb +5 -9
- data/lib/avo/resources/items/tab.rb +8 -8
- data/lib/avo/resources/items/tab_group.rb +8 -10
- data/lib/avo/resources/resource_manager.rb +2 -1
- data/lib/avo/services/hq_reporter.rb +102 -0
- data/lib/avo/services/telemetry_service.rb +0 -1
- data/lib/avo/test_helpers.rb +36 -22
- data/lib/avo/u_i_instance.rb +60 -0
- data/lib/avo/version.rb +1 -1
- data/lib/avo/view_inquirer.rb +6 -1
- data/lib/avo/view_types/view_type_manager.rb +70 -0
- data/lib/avo.rb +30 -45
- data/lib/generators/avo/action_generator.rb +1 -1
- data/lib/generators/avo/resource_generator.rb +43 -0
- data/lib/generators/avo/resource_tool_generator.rb +1 -1
- data/lib/generators/avo/tailwindcss/install_generator.rb +0 -6
- data/lib/generators/avo/templates/cards/partial_card_partial.tt +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +7 -9
- data/lib/generators/avo/templates/locales/avo.ar.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.de.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.en.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.es.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.fr.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.it.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.ja.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.nb.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.nl.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.nn.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.pl.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.pt-BR.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.pt.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.ro.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.ru.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.tr.yml +25 -0
- data/lib/generators/avo/templates/locales/{avo.uk.yml → avo.ua.yml} +26 -1
- data/lib/generators/avo/templates/locales/avo.zh-TW.yml +25 -0
- data/lib/generators/avo/templates/locales/avo.zh.yml +25 -0
- data/lib/generators/avo/templates/resource/resource.tt +10 -1
- data/lib/generators/avo/templates/resource_tools/partial.tt +20 -22
- data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +1 -3
- data/lib/generators/avo/templates/tailwindcss/tailwind.config.js +0 -7
- data/lib/generators/avo/templates/tool/view.tt +14 -16
- data/lib/generators/avo/tool_generator.rb +3 -3
- data/lib/generators/avo/version_generator.rb +1 -1
- data/lib/tasks/avo_tasks.rake +29 -25
- metadata +145 -97
- data/app/assets/stylesheets/avo.base.css +0 -130
- data/app/assets/stylesheets/css/breadcrumbs.css +0 -16
- data/app/assets/stylesheets/css/buttons.css +0 -19
- data/app/assets/stylesheets/css/tailwindcss/base.css +0 -1
- data/app/assets/stylesheets/css/tailwindcss/components.css +0 -1
- data/app/assets/stylesheets/css/tailwindcss/utilities.css +0 -1
- data/app/assets/svgs/avo/arrow-down.svg +0 -3
- data/app/assets/svgs/avo/arrow-up.svg +0 -3
- data/app/assets/svgs/avo/detach.svg +0 -8
- data/app/assets/svgs/avo/download-solid-reversed.svg +0 -3
- data/app/assets/svgs/avo/download-solid.svg +0 -3
- data/app/assets/svgs/avo/edit.svg +0 -5
- data/app/assets/svgs/avo/editor-bold.svg +0 -1
- data/app/assets/svgs/avo/editor-italic.svg +0 -1
- data/app/assets/svgs/avo/editor-link.svg +0 -1
- data/app/assets/svgs/avo/editor-list.svg +0 -1
- data/app/assets/svgs/avo/editor-strike.svg +0 -1
- data/app/assets/svgs/avo/editor-underline.svg +0 -1
- data/app/assets/svgs/avo/eye.svg +0 -1
- data/app/assets/svgs/avo/trash-sm.svg +0 -3
- data/app/assets/svgs/avo/trash.svg +0 -7
- data/app/components/avo/cover_photo_component.html.erb +0 -3
- data/app/components/avo/cover_photo_component.rb +0 -19
- data/app/components/avo/fields/common/badge_viewer_component.html.erb +0 -1
- data/app/components/avo/fields/common/badge_viewer_component.rb +0 -33
- data/app/components/avo/index/resource_grid_component.html.erb +0 -23
- data/app/components/avo/index/resource_grid_component.rb +0 -10
- data/app/components/avo/index/resource_map_component.html.erb +0 -16
- data/app/components/avo/index/resource_map_component.rb +0 -114
- data/app/components/avo/index/resource_table_component.html.erb +0 -52
- data/app/components/avo/panel_component.html.erb +0 -63
- data/app/components/avo/panel_component.rb +0 -43
- data/app/components/avo/panel_header_component.html.erb +0 -42
- data/app/components/avo/panel_header_component.rb +0 -31
- data/app/components/avo/profile_photo_component.html.erb +0 -6
- data/app/components/avo/profile_photo_component.rb +0 -9
- data/app/components/avo/sidebar/heading_component.html.erb +0 -21
- data/app/components/avo/sidebar/heading_component.rb +0 -9
- data/app/components/avo/tab_switcher_component.html.erb +0 -20
- data/app/components/avo/tab_switcher_component.rb +0 -45
- data/app/views/avo/base/close_modal_and_reload_field.turbo_stream.erb +0 -8
- data/app/views/avo/debug/report.html.erb +0 -37
- data/app/views/avo/partials/_panel_breadcrumbs.html.erb +0 -3
- data/app/views/avo/partials/_resource_search.html.erb +0 -16
- data/lib/avo/licensing/community_license.rb +0 -6
- data/lib/avo/licensing/h_q.rb +0 -202
- data/lib/avo/licensing/license.rb +0 -76
- data/lib/avo/licensing/license_manager.rb +0 -24
- data/lib/avo/licensing/nil_license.rb +0 -14
- data/lib/avo/licensing/pro_license.rb +0 -20
- data/lib/avo/licensing/request.rb +0 -20
- data/lib/avo/profile_photo.rb +0 -7
- data/lib/avo/services/debug_service.rb +0 -107
- data/public/avo-assets/placeholder.svg +0 -1
- data/tailwind.preset.js +0 -171
- /data/{public/avo-assets → app/assets/images/avo}/favicon.ico +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-500.eot +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-500.svg +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-500.ttf +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-500.woff +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-500.woff2 +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-600.eot +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-600.svg +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-600.ttf +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-600.woff +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-600.woff2 +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-700.eot +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-700.svg +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-700.ttf +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-700.woff +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-700.woff2 +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-regular.eot +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-regular.svg +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-regular.ttf +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-regular.woff +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/fonts/inter-v7-latin-regular.woff2 +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/logo-on-white.png +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/logo.png +0 -0
- /data/{public/avo-assets → app/assets/images/avo}/logomark.png +0 -0
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import 'core-js/stable'
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
4
|
import 'chartkick/chart.js/chart.esm'
|
|
5
|
-
import
|
|
6
|
-
import mapboxgl from 'mapbox-gl'
|
|
5
|
+
import 'mapkick/bundle'
|
|
7
6
|
import 'regenerator-runtime/runtime'
|
|
8
7
|
import * as ActiveStorage from '@rails/activestorage'
|
|
9
8
|
import * as Mousetrap from 'mousetrap'
|
|
@@ -17,8 +16,6 @@ import './js/controllers'
|
|
|
17
16
|
import './js/custom-confirm'
|
|
18
17
|
import './js/custom-stream-actions'
|
|
19
18
|
|
|
20
|
-
Mapkick.use(mapboxgl)
|
|
21
|
-
|
|
22
19
|
window.Avo.localStorage = new LocalStorageService()
|
|
23
20
|
|
|
24
21
|
window.Turbolinks = Turbo
|
|
@@ -31,18 +28,6 @@ Mousetrap.bind('r r r', () => {
|
|
|
31
28
|
window.StreamActions.turbo_reload()
|
|
32
29
|
})
|
|
33
30
|
|
|
34
|
-
function isMac() {
|
|
35
|
-
const isMac = window.navigator.userAgent.indexOf('Mac OS X')
|
|
36
|
-
|
|
37
|
-
if (isMac >= 0) {
|
|
38
|
-
document.body.classList.add('os-mac')
|
|
39
|
-
document.body.classList.remove('os-pc')
|
|
40
|
-
} else {
|
|
41
|
-
document.body.classList.add('os-pc')
|
|
42
|
-
document.body.classList.remove('os-mac')
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
31
|
// Add the shift-pressed class to the body when the shift key is pressed
|
|
47
32
|
document.addEventListener('keydown', (event) => {
|
|
48
33
|
if (event.shiftKey) {
|
|
@@ -58,7 +43,7 @@ document.addEventListener('keyup', (event) => {
|
|
|
58
43
|
|
|
59
44
|
function initTippy() {
|
|
60
45
|
tippy('[data-tippy="tooltip"]', {
|
|
61
|
-
theme: '
|
|
46
|
+
theme: 'basic',
|
|
62
47
|
allowHTML: true,
|
|
63
48
|
content(reference) {
|
|
64
49
|
const title = reference.getAttribute('title')
|
|
@@ -96,7 +81,6 @@ document.addEventListener('turbo:before-stream-render', () => {
|
|
|
96
81
|
|
|
97
82
|
document.addEventListener('turbo:load', () => {
|
|
98
83
|
initTippy()
|
|
99
|
-
isMac()
|
|
100
84
|
|
|
101
85
|
// Restore scroll position after r r r turbo reload
|
|
102
86
|
if (scrollTop) {
|
|
@@ -150,6 +134,13 @@ document.addEventListener('turbo:before-cache', () => {
|
|
|
150
134
|
})
|
|
151
135
|
})
|
|
152
136
|
|
|
137
|
+
// Watch for live changes when the user has "auto" as the default setting.
|
|
138
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {
|
|
139
|
+
const method = event.matches ? 'add' : 'remove'
|
|
140
|
+
|
|
141
|
+
document.documentElement.classList[method]('dark')
|
|
142
|
+
})
|
|
143
|
+
|
|
153
144
|
window.Avo = window.Avo || { configuration: {} }
|
|
154
145
|
|
|
155
146
|
window.Avo.menus = {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Alert, Popover } from 'tailwindcss-stimulus-components'
|
|
2
|
+
import { Application, Controller } from '@hotwired/stimulus'
|
|
3
|
+
import Clipboard from '@stimulus-components/clipboard'
|
|
4
|
+
import PasswordVisibility from '@stimulus-components/password-visibility'
|
|
5
|
+
import PasswordVisibilityController from './controllers/password_visibility_controller'
|
|
6
|
+
import TextareaAutogrow from 'stimulus-textarea-autogrow'
|
|
7
|
+
import TurboPower from 'turbo_power'
|
|
8
|
+
|
|
9
|
+
TurboPower.initialize(window.Turbo.StreamActions)
|
|
10
|
+
|
|
11
|
+
const application = Application.start()
|
|
12
|
+
|
|
13
|
+
// Configure Stimulus development experience
|
|
14
|
+
application.debug = window?.localStorage.getItem('avo.debug')
|
|
15
|
+
window.Stimulus = application
|
|
16
|
+
|
|
17
|
+
/* Using this patter of providing a fake Stimulus object so the plugins do not have to bundle the Stimulus controller too.
|
|
18
|
+
Their rollup config is isntructed to use `fakeStimulus` instead of `Stimulus`.
|
|
19
|
+
output: {
|
|
20
|
+
...
|
|
21
|
+
globals: {
|
|
22
|
+
"@hotwired/stimulus": "FakeStimulus"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Example rollup config
|
|
27
|
+
https://github.com/avo-hq/marksmith/blob/main/rollup.config.mjs
|
|
28
|
+
*/
|
|
29
|
+
window.FakeStimulus = {
|
|
30
|
+
Controller,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Register stimulus-components controller
|
|
34
|
+
application.register('alert', Alert)
|
|
35
|
+
application.register('popover', Popover)
|
|
36
|
+
application.register('clipboard', Clipboard)
|
|
37
|
+
application.register('password-visibility', PasswordVisibilityController)
|
|
38
|
+
application.register('textarea-autogrow', TextareaAutogrow)
|
|
39
|
+
|
|
40
|
+
export { application }
|
|
@@ -4,7 +4,7 @@ export default class extends Controller {
|
|
|
4
4
|
static targets = ['resourceIds', 'form', 'selectedAll', 'indexQuery']
|
|
5
5
|
|
|
6
6
|
static values = {
|
|
7
|
-
|
|
7
|
+
confirmation: Boolean,
|
|
8
8
|
resourceName: String,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -21,10 +21,10 @@ export default class extends Controller {
|
|
|
21
21
|
this.indexQueryTarget.value = this.selectionOptions.itemSelectAllSelectedAllQueryValue
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (this.
|
|
25
|
-
this.formTarget.requestSubmit()
|
|
26
|
-
} else {
|
|
24
|
+
if (this.confirmationValue) {
|
|
27
25
|
this.element.classList.remove('hidden')
|
|
26
|
+
} else {
|
|
27
|
+
this.formTarget.requestSubmit()
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -9,9 +9,14 @@ export default class extends Controller {
|
|
|
9
9
|
|
|
10
10
|
// get the table or grid component, if both null, get the panel body (for show page for example)
|
|
11
11
|
get parentTarget() {
|
|
12
|
-
return document.querySelector('[data-component-name="avo/
|
|
13
|
-
|| document.querySelector('[data-component-name="avo/
|
|
14
|
-
|| document.querySelector('
|
|
12
|
+
return document.querySelector('[data-component-name="avo/view_types/table_component"]')
|
|
13
|
+
|| document.querySelector('[data-component-name="avo/view_types/grid_component"]')
|
|
14
|
+
|| document.querySelector('.main-content-area .scrollable-wrapper') // TODO: to be fixed when we get to the row controls
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Check if the document is in RTL mode
|
|
18
|
+
get isRTL() {
|
|
19
|
+
return document.documentElement.dir === 'rtl'
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
childDimensions = null
|
|
@@ -41,9 +46,15 @@ export default class extends Controller {
|
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
adjustHorizontalOverflow() {
|
|
44
|
-
if (this.
|
|
45
|
-
|
|
46
|
-
this.
|
|
49
|
+
if (this.isRTL) {
|
|
50
|
+
// RTL: Check for right overflow and flip to left if needed
|
|
51
|
+
if (this.contentRightOverflow) {
|
|
52
|
+
this.contentTarget.classList.remove('xl:start-0', 'sm:start-0')
|
|
53
|
+
this.contentTarget.classList.add('xl:end-0', 'sm:end-0')
|
|
54
|
+
}
|
|
55
|
+
} else if (this.contentLeftOverflow) {
|
|
56
|
+
this.contentTarget.classList.remove('xl:end-0', 'sm:end-0')
|
|
57
|
+
this.contentTarget.classList.add('xl:start-0', 'sm:start-0')
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -59,4 +70,8 @@ export default class extends Controller {
|
|
|
59
70
|
get contentLeftOverflow() {
|
|
60
71
|
return this.parentDimensions.left > this.childDimensions.left
|
|
61
72
|
}
|
|
73
|
+
|
|
74
|
+
get contentRightOverflow() {
|
|
75
|
+
return this.parentDimensions.right < this.childDimensions.right
|
|
76
|
+
}
|
|
62
77
|
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
|
2
|
+
import Cookies from 'js-cookie'
|
|
3
|
+
|
|
4
|
+
export default class extends Controller {
|
|
5
|
+
static targets = ['button', 'accentPanel', 'accentOption', 'themePanel', 'themeLabel', 'themeOption']
|
|
6
|
+
|
|
7
|
+
connect() {
|
|
8
|
+
// Read from cookies (cookie is source of truth)
|
|
9
|
+
const cookieScheme = Cookies.get('color_scheme')
|
|
10
|
+
const cookieTheme = Cookies.get('theme')
|
|
11
|
+
const cookieAccent = Cookies.get('accent_color')
|
|
12
|
+
|
|
13
|
+
// Use cookie value if it exists, otherwise use default
|
|
14
|
+
this.currentSchemeValue = cookieScheme || 'auto'
|
|
15
|
+
this.currentThemeValue = cookieTheme || 'brand'
|
|
16
|
+
this.currentAccentValue = cookieAccent || 'neutral'
|
|
17
|
+
|
|
18
|
+
this.applyScheme()
|
|
19
|
+
this.applyTheme()
|
|
20
|
+
this.applyAccent()
|
|
21
|
+
this.updateThemeLabel()
|
|
22
|
+
this.updateActiveThemeOption()
|
|
23
|
+
this.updateActiveAccentOption()
|
|
24
|
+
|
|
25
|
+
// Watch for live changes when the user has "auto" as the default setting
|
|
26
|
+
this.mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
|
27
|
+
this.mediaQueryListener = () => {
|
|
28
|
+
if (this.currentSchemeValue === 'auto') {
|
|
29
|
+
this.applyScheme()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
this.mediaQuery.addEventListener('change', this.mediaQueryListener)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
disconnect() {
|
|
36
|
+
if (this.mediaQuery && this.mediaQueryListener) {
|
|
37
|
+
this.mediaQuery.removeEventListener('change', this.mediaQueryListener)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setScheme(event) {
|
|
42
|
+
event.preventDefault()
|
|
43
|
+
const { scheme } = event.currentTarget.dataset
|
|
44
|
+
|
|
45
|
+
if (!scheme || !['auto', 'light', 'dark'].includes(scheme)) return
|
|
46
|
+
|
|
47
|
+
this.currentSchemeValue = scheme
|
|
48
|
+
this.saveScheme()
|
|
49
|
+
this.applyScheme()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setTheme(event) {
|
|
53
|
+
event.preventDefault()
|
|
54
|
+
const { theme } = event.currentTarget.dataset
|
|
55
|
+
|
|
56
|
+
if (!theme || !['brand', 'slate', 'stone', 'gray', 'zinc', 'neutral', 'taupe', 'mauve', 'mist', 'olive'].includes(theme)) return
|
|
57
|
+
|
|
58
|
+
this.currentThemeValue = theme
|
|
59
|
+
this.saveTheme()
|
|
60
|
+
this.applyTheme()
|
|
61
|
+
this.updateThemeLabel()
|
|
62
|
+
this.updateActiveThemeOption()
|
|
63
|
+
|
|
64
|
+
// Close the dropdown
|
|
65
|
+
if (this.hasThemePanelTarget) {
|
|
66
|
+
this.themePanelTarget.setAttribute('hidden', true)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
previewTheme(event) {
|
|
71
|
+
const { theme } = event.currentTarget.dataset
|
|
72
|
+
if (!theme) return
|
|
73
|
+
|
|
74
|
+
this.applyThemeClass(theme)
|
|
75
|
+
this.updateActiveThemeOptionFor(theme)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
revertTheme() {
|
|
79
|
+
this.applyTheme()
|
|
80
|
+
this.updateActiveThemeOption()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
setAccent(event) {
|
|
84
|
+
event.preventDefault()
|
|
85
|
+
const { accent } = event.currentTarget.dataset
|
|
86
|
+
|
|
87
|
+
if (!accent) return
|
|
88
|
+
|
|
89
|
+
this.currentAccentValue = accent
|
|
90
|
+
this.saveAccent()
|
|
91
|
+
this.applyAccent()
|
|
92
|
+
|
|
93
|
+
// Close the dropdown
|
|
94
|
+
if (this.hasAccentPanelTarget) {
|
|
95
|
+
this.accentPanelTarget.setAttribute('hidden', true)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
previewAccent(event) {
|
|
100
|
+
const { accent } = event.currentTarget.dataset
|
|
101
|
+
if (!accent) return
|
|
102
|
+
|
|
103
|
+
this.applyAccentClass(accent)
|
|
104
|
+
this.updateActiveAccentOptionFor(accent)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
revertAccent() {
|
|
108
|
+
this.applyAccent()
|
|
109
|
+
this.updateActiveAccentOption()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
saveScheme() {
|
|
113
|
+
if (this.currentSchemeValue === 'auto') {
|
|
114
|
+
Cookies.remove('color_scheme')
|
|
115
|
+
} else {
|
|
116
|
+
Cookies.set('color_scheme', this.currentSchemeValue)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
saveTheme() {
|
|
121
|
+
if (this.currentThemeValue === 'brand') {
|
|
122
|
+
Cookies.remove('theme')
|
|
123
|
+
} else {
|
|
124
|
+
Cookies.set('theme', this.currentThemeValue)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
saveAccent() {
|
|
129
|
+
if (this.currentAccentValue === 'neutral') {
|
|
130
|
+
Cookies.remove('accent_color')
|
|
131
|
+
} else {
|
|
132
|
+
Cookies.set('accent_color', this.currentAccentValue)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
applyScheme() {
|
|
137
|
+
const scheme = this.currentSchemeValue || 'auto'
|
|
138
|
+
|
|
139
|
+
// Remove all scheme selection classes
|
|
140
|
+
document.documentElement.classList.remove('scheme-light', 'scheme-dark', 'scheme-auto')
|
|
141
|
+
|
|
142
|
+
if (scheme === 'light') {
|
|
143
|
+
document.documentElement.classList.add('scheme-light')
|
|
144
|
+
document.documentElement.classList.remove('dark')
|
|
145
|
+
} else if (scheme === 'dark') {
|
|
146
|
+
document.documentElement.classList.add('scheme-dark')
|
|
147
|
+
document.documentElement.classList.add('dark')
|
|
148
|
+
} else if (scheme === 'auto') {
|
|
149
|
+
document.documentElement.classList.add('scheme-auto')
|
|
150
|
+
// Set dark class based on system preference
|
|
151
|
+
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
152
|
+
if (isDark) {
|
|
153
|
+
document.documentElement.classList.add('dark')
|
|
154
|
+
} else {
|
|
155
|
+
document.documentElement.classList.remove('dark')
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
applyTheme() {
|
|
161
|
+
this.applyThemeClass(this.currentThemeValue || 'brand')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
applyThemeClass(theme) {
|
|
165
|
+
document.documentElement.classList.remove('theme-slate', 'theme-stone', 'theme-gray', 'theme-zinc', 'theme-neutral', 'theme-taupe', 'theme-mauve', 'theme-mist', 'theme-olive')
|
|
166
|
+
|
|
167
|
+
if (theme !== 'brand') {
|
|
168
|
+
document.documentElement.classList.add(`theme-${theme}`)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
updateActiveThemeOption() {
|
|
173
|
+
this.updateActiveThemeOptionFor(this.currentThemeValue || 'brand')
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
updateActiveThemeOptionFor(activeTheme) {
|
|
177
|
+
if (!this.hasThemeOptionTarget) return
|
|
178
|
+
|
|
179
|
+
this.themeOptionTargets.forEach((option) => {
|
|
180
|
+
const { theme } = option.dataset
|
|
181
|
+
if (!theme) return
|
|
182
|
+
|
|
183
|
+
option.classList.toggle('color-scheme-switcher__theme-option--active', theme === activeTheme)
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
applyAccent() {
|
|
188
|
+
this.applyAccentClass(this.currentAccentValue || 'neutral')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
applyAccentClass(accent) {
|
|
192
|
+
const accentColors = ['red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose']
|
|
193
|
+
accentColors.forEach((color) => {
|
|
194
|
+
document.documentElement.classList.remove(`accent-${color}`)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
if (accent !== 'neutral') {
|
|
198
|
+
document.documentElement.classList.add(`accent-${accent}`)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
updateActiveAccentOption() {
|
|
203
|
+
this.updateActiveAccentOptionFor(this.currentAccentValue || 'neutral')
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
updateActiveAccentOptionFor(activeAccent) {
|
|
207
|
+
if (!this.hasAccentOptionTarget) return
|
|
208
|
+
|
|
209
|
+
this.accentOptionTargets.forEach((option) => {
|
|
210
|
+
const { accent } = option.dataset
|
|
211
|
+
if (!accent) return
|
|
212
|
+
|
|
213
|
+
option.classList.toggle('color-scheme-switcher__accent-option--active', accent === activeAccent)
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
updateThemeLabel() {
|
|
218
|
+
this.updateThemeLabelText(this.currentThemeValue || 'brand')
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
updateThemeLabelText(theme) {
|
|
222
|
+
if (!this.hasThemeLabelTarget) return
|
|
223
|
+
|
|
224
|
+
this.themeLabelTarget.textContent = theme.charAt(0).toUpperCase() + theme.slice(1)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
|
2
|
+
import { useClickOutside } from 'stimulus-use'
|
|
3
|
+
|
|
4
|
+
export default class extends Controller {
|
|
5
|
+
static targets = ['menu']
|
|
6
|
+
|
|
7
|
+
static values = {
|
|
8
|
+
// One may want to have elements that are exempt from triggering the click outside event
|
|
9
|
+
exemptionContainers: Array,
|
|
10
|
+
logger: Boolean,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get exemptionContainerTargets() {
|
|
14
|
+
return this.exemptionContainersValue.map((selector) => document.querySelector(selector)).filter(Boolean)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get isOpen() {
|
|
18
|
+
return this.menuTarget.hasAttribute('open')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
clickOutside(e) {
|
|
22
|
+
if (this.hasMenuTarget) {
|
|
23
|
+
const isInExemptionContainer = this.hasExemptionContainersValue && this.exemptionContainerTargets.some((container) => container.contains(e.target))
|
|
24
|
+
|
|
25
|
+
if (!isInExemptionContainer && this.isOpen) {
|
|
26
|
+
this.menuTarget.close()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
connect() {
|
|
32
|
+
useClickOutside(this)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toggle() {
|
|
36
|
+
if (this.isOpen) {
|
|
37
|
+
this.menuTarget.close()
|
|
38
|
+
} else {
|
|
39
|
+
this.menuTarget.show()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -21,29 +21,46 @@ import { castBoolean } from '../../helpers/cast_boolean'
|
|
|
21
21
|
export default class extends Controller {
|
|
22
22
|
static targets = ['element']
|
|
23
23
|
|
|
24
|
+
get isDark() {
|
|
25
|
+
return document.documentElement.classList.contains('dark')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get resolvedTheme() {
|
|
29
|
+
return this.isDark ? 'material-darker' : (this.elementTarget.dataset.theme || 'default')
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
connect() {
|
|
25
33
|
const options = {
|
|
26
34
|
readOnly: castBoolean(this.elementTarget.dataset.readOnly),
|
|
27
35
|
mode: this.elementTarget.dataset.language,
|
|
28
|
-
theme: this.
|
|
36
|
+
theme: this.resolvedTheme,
|
|
29
37
|
tabSize: this.elementTarget.dataset.tabSize,
|
|
30
38
|
indentWithTabs: castBoolean(this.elementTarget.dataset.indentWithTabs),
|
|
31
39
|
lineWrapping: castBoolean(this.elementTarget.dataset.lineWrapping),
|
|
32
40
|
lineNumbers: true,
|
|
41
|
+
extraKeys: {
|
|
42
|
+
Esc: (cm) => cm.getInputField().blur(),
|
|
43
|
+
},
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
const vm = this
|
|
36
47
|
|
|
37
48
|
setTimeout(() => {
|
|
38
|
-
CodeMirror.fromTextArea(
|
|
39
|
-
|
|
49
|
+
vm.cm = CodeMirror.fromTextArea(vm.elementTarget, options)
|
|
50
|
+
vm.cm.on('change', (cm) => {
|
|
40
51
|
vm.elementTarget.innerText = cm.getValue()
|
|
41
52
|
vm.elementTarget.dispatchEvent(new Event('input'))
|
|
42
53
|
})
|
|
43
54
|
}, 1)
|
|
55
|
+
|
|
56
|
+
this.observer = new MutationObserver(() => {
|
|
57
|
+
if (vm.cm) vm.cm.setOption('theme', vm.resolvedTheme)
|
|
58
|
+
})
|
|
59
|
+
this.observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
disconnect() {
|
|
63
|
+
if (this.observer) this.observer.disconnect()
|
|
47
64
|
this.element.querySelector('.CodeMirror').CodeMirror.toTextArea()
|
|
48
65
|
}
|
|
49
66
|
}
|
|
@@ -16,11 +16,20 @@ export default class extends Controller {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
get isDark() {
|
|
20
|
+
return document.documentElement.classList.contains('dark')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get resolvedTheme() {
|
|
24
|
+
return this.isDark ? 'material-darker' : 'default'
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
connect() {
|
|
20
28
|
const options = {
|
|
21
29
|
element: this.elementTarget,
|
|
22
30
|
spellChecker: this.componentOptions.spell_checker,
|
|
23
|
-
autoRefresh: { delay: 500},
|
|
31
|
+
autoRefresh: { delay: 500 },
|
|
32
|
+
theme: this.resolvedTheme,
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
if (this.view === 'show') {
|
|
@@ -32,9 +41,22 @@ export default class extends Controller {
|
|
|
32
41
|
if (this.view === 'show') {
|
|
33
42
|
this.easyMde.codemirror.options.readOnly = true
|
|
34
43
|
}
|
|
44
|
+
|
|
45
|
+
this.easyMde.codemirror.on('keydown', (_cm, event) => {
|
|
46
|
+
if (event.key === 'Escape') {
|
|
47
|
+
this.easyMde.codemirror.getInputField().blur()
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const vm = this
|
|
52
|
+
this.observer = new MutationObserver(() => {
|
|
53
|
+
vm.easyMde.codemirror.setOption('theme', vm.resolvedTheme)
|
|
54
|
+
})
|
|
55
|
+
this.observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
|
35
56
|
}
|
|
36
57
|
|
|
37
58
|
disconnect() {
|
|
59
|
+
if (this.observer) this.observer.disconnect()
|
|
38
60
|
if (this.easyMde) {
|
|
39
61
|
this.easyMde.toTextArea()
|
|
40
62
|
this.easyMde = null
|
|
@@ -134,16 +134,18 @@ export default class extends Controller {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
interpolatedRow(key, value, index) {
|
|
137
|
-
let result = '<div class="
|
|
137
|
+
let result = '<div class="key-value__row" role="row">'
|
|
138
138
|
|
|
139
139
|
result += `
|
|
140
|
-
${this.
|
|
141
|
-
${this.
|
|
140
|
+
${this.inputCell('key', index, key, value)}
|
|
141
|
+
${this.inputCell('value', index, key, value)}
|
|
142
142
|
`
|
|
143
143
|
|
|
144
144
|
if (this.options.editable) {
|
|
145
|
+
result += `<div class="key-value__cell key-value__cell--actions">`
|
|
145
146
|
result += this.dndIcon(index)
|
|
146
147
|
result += this.deleteButton(index)
|
|
148
|
+
result += '</div>'
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
result += '</div>'
|
|
@@ -151,6 +153,21 @@ export default class extends Controller {
|
|
|
151
153
|
return result
|
|
152
154
|
}
|
|
153
155
|
|
|
156
|
+
inputCell(id = 'key', index, key, value) {
|
|
157
|
+
const inputValue = id === 'key' ? key : value
|
|
158
|
+
|
|
159
|
+
return `<div class="key-value__cell key-value__cell--${id}">
|
|
160
|
+
<input
|
|
161
|
+
class="${this.options.inputClasses} key-value__input key-value-input-${id}"
|
|
162
|
+
data-action="input->key-value#${id}FieldUpdated"
|
|
163
|
+
placeholder="${this.options[`${id}_label`]}"
|
|
164
|
+
data-index="${index}"
|
|
165
|
+
${this[`${id}InputDisabled`] ? "disabled='disabled'" : ''}
|
|
166
|
+
value="${this.escapeAttribute(inputValue)}"
|
|
167
|
+
/>
|
|
168
|
+
</div>`
|
|
169
|
+
}
|
|
170
|
+
|
|
154
171
|
escapeAttribute(str) {
|
|
155
172
|
if (str === null || str === undefined) return ''
|
|
156
173
|
return String(str)
|
|
@@ -160,47 +177,34 @@ export default class extends Controller {
|
|
|
160
177
|
.replace(/>/g, '>')
|
|
161
178
|
}
|
|
162
179
|
|
|
163
|
-
inputField(id = 'key', index, key, value) {
|
|
164
|
-
const inputValue = id === 'key' ? key : value
|
|
165
|
-
|
|
166
|
-
return `<input
|
|
167
|
-
class="${this.options.inputClasses} focus:bg-gray-100 !rounded-none border-gray-600 border-r border-l-0 border-b-0 border-t-0 focus:border-gray-300 w-1/2 focus:outline-none outline-none key-value-input-${id}"
|
|
168
|
-
data-action="input->key-value#${id}FieldUpdated"
|
|
169
|
-
placeholder="${this.options[`${id}_label`]}"
|
|
170
|
-
data-index="${index}"
|
|
171
|
-
${this[`${id}InputDisabled`] ? "disabled='disabled'" : ''}
|
|
172
|
-
value="${this.escapeAttribute(inputValue)}"
|
|
173
|
-
/>`
|
|
174
|
-
}
|
|
175
|
-
|
|
176
180
|
deleteButton(index) {
|
|
177
181
|
return `<a
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
href="javascript:void(0);"
|
|
183
|
+
data-key-value-index-param="${index}"
|
|
184
|
+
data-action="click->key-value#deleteRow"
|
|
185
|
+
title="${this.options.delete_text}"
|
|
186
|
+
data-tippy="tooltip"
|
|
187
|
+
data-button="delete-row"
|
|
188
|
+
tabindex="-1"
|
|
189
|
+
${this.options.disable_deleting_rows ? "disabled='disabled'" : ''}
|
|
190
|
+
class="key-value__action-button ${this.options.disable_deleting_rows ? 'cursor-not-allowed' : ''}"
|
|
191
|
+
>
|
|
192
|
+
<svg class="key-value__action-icon" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>
|
|
193
|
+
</a>`
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
dndIcon(index) {
|
|
191
|
-
return `<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
>
|
|
201
|
-
|
|
202
|
-
</a>
|
|
203
|
-
</div>`
|
|
197
|
+
return `<a
|
|
198
|
+
href="javascript:void(0);"
|
|
199
|
+
data-key-value-index-param="${index}"
|
|
200
|
+
data-control="dnd-handle"
|
|
201
|
+
title="${this.options.reorder_text}"
|
|
202
|
+
data-tippy="tooltip"
|
|
203
|
+
tabindex="-1"
|
|
204
|
+
class="key-value__action-button key-value__action-button--drag ${this.options.disable_deleting_rows ? 'cursor-not-allowed' : ''}"
|
|
205
|
+
>
|
|
206
|
+
<svg class="key-value__action-icon key-value__action-icon--small" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" /></svg>
|
|
207
|
+
</a>`
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
setOptions() {
|
|
@@ -5,6 +5,10 @@ export default class extends Controller {
|
|
|
5
5
|
const frame = this.context.scope.element.closest('turbo-frame')
|
|
6
6
|
this.element.querySelector('svg').classList.add('animate-spin')
|
|
7
7
|
if (frame) {
|
|
8
|
+
frame.classList.add('opacity-50')
|
|
9
|
+
frame.addEventListener('turbo:frame-load', () => {
|
|
10
|
+
frame.classList.remove('opacity-50')
|
|
11
|
+
}, { once: true })
|
|
8
12
|
frame.reload()
|
|
9
13
|
} else {
|
|
10
14
|
console.error(
|
|
@@ -126,10 +126,10 @@ export default class extends Controller {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
hideFakeInput() {
|
|
129
|
-
this.fakeInputTarget.classList.add('hidden')
|
|
129
|
+
this.fakeInputTarget.classList.add('!hidden')
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
showRealInput() {
|
|
133
|
-
this.inputTarget.classList.remove('hidden')
|
|
133
|
+
this.inputTarget.classList.remove('!hidden')
|
|
134
134
|
}
|
|
135
135
|
}
|