lookbook 1.5.5 → 2.0.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -31
- data/app/assets/lookbook/css/lookbook.css +9 -0
- data/app/assets/lookbook/css/themes/blue.css +7 -0
- data/app/assets/lookbook/css/themes/green.css +7 -0
- data/app/assets/lookbook/css/themes/indigo.css +7 -0
- data/app/assets/lookbook/css/themes/rose.css +7 -0
- data/app/assets/lookbook/css/themes/zinc.css +7 -0
- data/app/assets/lookbook/css/tooltip.css +9 -6
- data/app/assets/lookbook/img/lucide-sprite.svg +4960 -0
- data/app/assets/lookbook/js/app.js +22 -4
- data/app/assets/lookbook/js/helpers/dom.js +4 -7
- data/app/assets/lookbook/js/helpers/string.js +4 -11
- data/app/assets/lookbook/js/index.js +61 -0
- data/app/assets/lookbook/js/lib/lookbook.js +113 -0
- data/app/assets/lookbook/js/lib/tippy.js +1 -0
- data/app/assets/lookbook/js/lookbook-core.js +1 -0
- data/app/assets/lookbook/js/lookbook.js +2 -61
- data/app/components/lookbook/base_component.rb +3 -1
- data/app/components/lookbook/button/component.html.erb +13 -24
- data/app/components/lookbook/button/component.js +13 -3
- data/app/components/lookbook/button/component.rb +16 -25
- data/app/components/lookbook/code/component.rb +0 -2
- data/app/components/lookbook/copy_button/component.html.erb +5 -5
- data/app/components/lookbook/copy_button/component.rb +6 -3
- data/app/components/lookbook/debug_menu/component.html.erb +1 -0
- data/app/components/lookbook/debug_menu/component.rb +12 -1
- data/app/components/lookbook/display_options/editor/component.html.erb +1 -1
- data/app/components/lookbook/display_options/field/component.css +0 -26
- data/app/components/lookbook/display_options/field/component.html.erb +1 -1
- data/app/components/lookbook/embed/component.html.erb +6 -51
- data/app/components/lookbook/embed/component.rb +17 -16
- data/app/components/lookbook/embed/inspector/component.html.erb +102 -0
- data/app/components/lookbook/embed/inspector/component.js +46 -0
- data/app/components/lookbook/embed/inspector/component.rb +64 -0
- data/app/components/lookbook/embed_code_dropdown/component.css +12 -0
- data/app/components/lookbook/embed_code_dropdown/component.html.erb +19 -0
- data/app/components/lookbook/embed_code_dropdown/component.js +26 -0
- data/app/components/lookbook/embed_code_dropdown/component.rb +41 -0
- data/app/components/lookbook/header/component.html.erb +7 -6
- data/app/components/lookbook/header/component.rb +5 -1
- data/app/components/lookbook/icon/component.html.erb +1 -1
- data/app/components/lookbook/icon_button/component.html.erb +20 -0
- data/app/components/lookbook/icon_button/component.rb +46 -0
- data/app/components/lookbook/nav/component.html.erb +0 -1
- data/app/components/lookbook/nav/entity/component.rb +2 -2
- data/app/components/lookbook/nav/item/component.rb +1 -1
- data/app/components/lookbook/page_tabs/component.html.erb +2 -2
- data/app/components/lookbook/params/editor/component.rb +1 -0
- data/app/components/lookbook/prose/component.rb +1 -3
- data/app/components/lookbook/tabs/component.html.erb +2 -2
- data/app/components/lookbook/tabs/component.js +1 -1
- data/app/components/lookbook/tag_component.rb +2 -1
- data/app/components/lookbook/text_button/component.html.erb +26 -0
- data/app/components/lookbook/text_button/component.rb +42 -0
- data/app/components/lookbook/toolbar/component.html.erb +1 -1
- data/app/components/lookbook/viewport/component.rb +0 -4
- data/app/controllers/concerns/lookbook/targetable_concern.rb +26 -22
- data/app/controllers/concerns/lookbook/with_panels_concern.rb +30 -0
- data/app/controllers/concerns/lookbook/with_preview_controller_concern.rb +4 -3
- data/app/controllers/lookbook/application_controller.rb +9 -12
- data/app/controllers/lookbook/embeds_controller.rb +148 -0
- data/app/controllers/lookbook/inspector_controller.rb +3 -22
- data/app/controllers/lookbook/page_controller.rb +7 -6
- data/app/controllers/lookbook/pages_controller.rb +3 -4
- data/app/controllers/lookbook/preview_controller.rb +17 -0
- data/app/controllers/lookbook/previews_controller.rb +10 -30
- data/app/helpers/lookbook/application_helper.rb +3 -19
- data/app/views/layouts/lookbook/application.html.erb +85 -60
- data/app/views/layouts/lookbook/embed.html.erb +16 -0
- data/app/views/layouts/lookbook/shell.html.erb +1 -1
- data/app/views/layouts/lookbook/skeleton.html.erb +13 -8
- data/app/views/lookbook/404.html.erb +2 -2
- data/app/views/lookbook/embeds/show.html.erb +12 -0
- data/app/views/lookbook/inspector/panels/_notes.html.erb +1 -1
- data/app/views/lookbook/inspector/panels/_output.html.erb +3 -3
- data/app/views/lookbook/inspector/panels/_source.html.erb +6 -6
- data/app/views/lookbook/inspector/show.html.erb +130 -123
- data/app/views/lookbook/pages/show.html.erb +81 -34
- data/app/views/lookbook/partials/_iframe_content_scripts.html.erb +1 -0
- data/app/views/lookbook/partials/_user_styles.html.erb +5 -0
- data/app/views/lookbook/previews/group.html.erb +14 -0
- data/app/views/lookbook/previews/preview.html.erb +5 -0
- data/app/views/lookbook/previews/show.html.erb +1 -0
- data/config/app.yml +31 -16
- data/config/panels.yml +23 -25
- data/config/routes.rb +3 -1
- data/config/tags.yml +6 -2
- data/lib/lookbook/cable/cable.rb +53 -0
- data/lib/lookbook/engine.rb +105 -93
- data/lib/lookbook/entities/collections/entity_collection.rb +11 -6
- data/lib/lookbook/entities/collections/page_collection.rb +33 -8
- data/lib/lookbook/entities/collections/preview_collection.rb +42 -17
- data/lib/lookbook/entities/collections/render_target_collection.rb +4 -0
- data/lib/lookbook/entities/collections/scenario_collection.rb +4 -0
- data/lib/lookbook/entities/concerns/{annotatable.rb → annotatable_entity.rb} +7 -6
- data/lib/lookbook/entities/concerns/{inspectable.rb → inspectable_entity.rb} +2 -1
- data/lib/lookbook/entities/concerns/{locatable.rb → locatable_entity.rb} +8 -14
- data/lib/lookbook/entities/concerns/navigable_entity.rb +44 -0
- data/lib/lookbook/entities/entity.rb +7 -2
- data/lib/lookbook/entities/{page.rb → page_entity.rb} +10 -6
- data/lib/lookbook/entities/{page_section.rb → page_section_entity.rb} +1 -1
- data/lib/lookbook/entities/preview_entity.rb +99 -0
- data/lib/lookbook/entities/renderable_entity.rb +50 -0
- data/lib/lookbook/entities/rendered_scenario_entity.rb +53 -0
- data/lib/lookbook/entities/scenario_entity.rb +112 -0
- data/lib/lookbook/entities/scenario_group_entity.rb +53 -0
- data/lib/lookbook/error.rb +5 -5
- data/lib/lookbook/file_watcher.rb +19 -35
- data/lib/lookbook/helpers/class_names_helper.rb +28 -0
- data/lib/lookbook/helpers/page_helper.rb +18 -0
- data/{app/helpers/lookbook → lib/lookbook/helpers}/preview_helper.rb +3 -0
- data/lib/lookbook/helpers/ui_elements_helper.rb +115 -0
- data/lib/lookbook/preview.rb +79 -0
- data/lib/lookbook/preview_controller_actions.rb +50 -0
- data/lib/lookbook/preview_parser.rb +4 -2
- data/lib/lookbook/reloaders.rb +71 -0
- data/lib/lookbook/runtime_context.rb +49 -0
- data/lib/lookbook/services/data/resolvers/data_resolver.rb +4 -6
- data/lib/lookbook/services/entities/entity_tree_builder.rb +6 -6
- data/lib/lookbook/services/list_resolver.rb +35 -0
- data/lib/lookbook/services/markdown_renderer.rb +12 -2
- data/lib/lookbook/services/priority_prefix_parser.rb +16 -0
- data/lib/lookbook/services/urls/search_param_encoder.rb +16 -0
- data/lib/lookbook/services/urls/search_param_parser.rb +7 -6
- data/lib/lookbook/stores/config_store.rb +16 -16
- data/lib/lookbook/stores/input_store.rb +1 -3
- data/lib/lookbook/stores/panel_store.rb +28 -50
- data/lib/lookbook/support/deprecation.rb +5 -0
- data/lib/lookbook/support/errors/preview_template_error.rb +7 -0
- data/lib/lookbook/support/evented_file_update_checker.rb +69 -0
- data/lib/lookbook/support/null_websocket.rb +9 -0
- data/lib/lookbook/support/store.rb +9 -0
- data/lib/lookbook/support/tree_node.rb +7 -7
- data/lib/lookbook/support/utils/path_utils.rb +7 -1
- data/lib/lookbook/support/utils/utils.rb +8 -0
- data/lib/lookbook/tags/{position_tag.rb → priority_tag.rb} +4 -4
- data/lib/lookbook/tags/renders_tag.rb +4 -0
- data/lib/lookbook/tags/tag_provider.rb +3 -0
- data/lib/lookbook/tags/type_tag.rb +7 -0
- data/lib/lookbook/tags/yard_tag.rb +1 -2
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook/websocket.rb +6 -53
- data/lib/lookbook.rb +179 -53
- data/public/lookbook-assets/css/lookbook.css +432 -376
- data/public/lookbook-assets/css/lookbook.css.map +1 -1
- data/public/lookbook-assets/css/themes/blue.css +7 -0
- data/public/lookbook-assets/css/themes/blue.css.map +1 -1
- data/public/lookbook-assets/css/themes/green.css +7 -0
- data/public/lookbook-assets/css/themes/green.css.map +1 -1
- data/public/lookbook-assets/css/themes/indigo.css +7 -0
- data/public/lookbook-assets/css/themes/indigo.css.map +1 -1
- data/public/lookbook-assets/css/themes/rose.css +7 -0
- data/public/lookbook-assets/css/themes/rose.css.map +1 -1
- data/public/lookbook-assets/css/themes/zinc.css +7 -0
- data/public/lookbook-assets/css/themes/zinc.css.map +1 -1
- data/public/lookbook-assets/img/lucide-sprite.svg +4960 -0
- data/public/lookbook-assets/js/embed.js +1363 -843
- data/public/lookbook-assets/js/embed.js.map +1 -1
- data/public/lookbook-assets/js/iframe.js +906 -0
- data/public/lookbook-assets/js/iframe.js.map +1 -0
- data/public/lookbook-assets/js/index.js +13567 -0
- data/public/lookbook-assets/js/index.js.map +1 -0
- data/public/lookbook-assets/js/lookbook-core.js +85 -0
- data/public/lookbook-assets/js/lookbook-core.js.map +1 -0
- data/public/lookbook-assets/js/lookbook.js +151 -12726
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- data/public/lookbook-assets/lookbook-esm.js +1427 -0
- data/public/lookbook-assets/lookbook-esm.js.map +1 -0
- data/public/lookbook-assets/lookbook-global.js +1427 -0
- data/public/lookbook-assets/lookbook-global.js.map +1 -0
- data/public/lookbook-assets/lookbook.js +1427 -0
- data/public/lookbook-assets/lookbook.js.map +1 -0
- metadata +85 -77
- data/app/components/lookbook/embed/component.js +0 -39
- data/app/helpers/lookbook/component_helper.rb +0 -84
- data/app/helpers/lookbook/output_helper.rb +0 -19
- data/app/helpers/lookbook/page_helper.rb +0 -34
- data/app/views/layouts/lookbook/inspector.html.erb +0 -7
- data/app/views/layouts/lookbook/page.html.erb +0 -53
- data/app/views/layouts/lookbook/standalone.html.erb +0 -5
- data/app/views/lookbook/preview.html.erb +0 -14
- data/lib/lookbook/entities/collections/component_collection.rb +0 -4
- data/lib/lookbook/entities/collections/preview_example_collection.rb +0 -4
- data/lib/lookbook/entities/component.rb +0 -31
- data/lib/lookbook/entities/concerns/navigable.rb +0 -43
- data/lib/lookbook/entities/preview.rb +0 -87
- data/lib/lookbook/entities/preview_example.rb +0 -104
- data/lib/lookbook/entities/preview_group.rb +0 -52
- data/lib/lookbook/preview_actions.rb +0 -43
- data/lib/lookbook/process.rb +0 -21
- data/lib/lookbook/rendered_example.rb +0 -37
- data/lib/lookbook/services/position_prefix_parser.rb +0 -16
- data/lib/lookbook/services/urls/search_param_builder.rb +0 -13
- data/lib/lookbook/tags/component_tag.rb +0 -13
- /data/app/assets/lookbook/js/{embed.js → iframe.js} +0 -0
- /data/{app/channels/lookbook → lib/lookbook/cable}/connection.rb +0 -0
- /data/{app/channels/lookbook → lib/lookbook/cable}/reload_channel.rb +0 -0
@@ -1,82 +1,107 @@
|
|
1
|
-
<% content_for :
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<% content_for :body do %>
|
2
|
+
<div
|
3
|
+
id="app"
|
4
|
+
x-data="app"
|
5
|
+
x-cloak
|
6
|
+
@popstate.window="handleNavigation"
|
7
|
+
@click.document="hijax"
|
8
|
+
@navigation:start="closeMobileSidebar"
|
9
|
+
class="w-screen h-screen grid grid-rows-[40px_1fr] relative">
|
7
10
|
|
8
|
-
|
9
|
-
":class": "{
|
10
|
-
'transition': $store.layout.mobile,
|
11
|
-
'translate-x-full': $store.layout.mobile && sidebarHidden,
|
12
|
-
'!absolute right-0 bottom-0 top-[40px] h-[calc(100%_-_40px)] w-full max-w-[420px] z-50 border-l border-lookbook-divider': $store.layout.mobile
|
13
|
-
}",
|
14
|
-
"@click.outside": "closeMobileSidebar",
|
15
|
-
cloak: true do %>
|
16
|
-
<% cache Lookbook::Engine.last_changed do %>
|
17
|
-
<%= lookbook_render :split_layout,
|
18
|
-
alpine_data: "$store.layout.#{@pages.any? && @previews.any? ? "sidebar" : "singleSectionSidebar"}",
|
19
|
-
style: "height: calc(100vh - 2.5rem);" do |layout| %>
|
11
|
+
<%= render "lookbook/partials/user_styles" %>
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
13
|
+
<%= lookbook_render :header, id: "app-header", debug_menu: @config.debug_menu do |header| %>
|
14
|
+
<% header.branding { @config.project_name } %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if @previews.any? || @pages.any? %>
|
18
|
+
|
19
|
+
<%= lookbook_render :split_layout,
|
20
|
+
alpine_data: "$store.layout.main",
|
21
|
+
":class": "$store.layout.mobile && '!block'" do |layout| %>
|
22
|
+
|
23
|
+
<% layout.with_pane id: "app-sidebar", class: "flex flex-col bg-lookbook-sidebar-bg relative translate-x-0",
|
24
|
+
":class": "{
|
25
|
+
'transition': $store.layout.mobile,
|
26
|
+
'translate-x-full': $store.layout.mobile && sidebarHidden,
|
27
|
+
'!absolute right-0 bottom-0 top-[40px] h-[calc(100%_-_40px)] w-full max-w-[420px] z-50 border-l border-lookbook-divider': $store.layout.mobile
|
28
|
+
}",
|
29
|
+
"@click.outside": "closeMobileSidebar",
|
30
|
+
cloak: true do %>
|
31
|
+
|
32
|
+
<% cache do %>
|
33
|
+
|
34
|
+
<%= lookbook_render :split_layout,
|
35
|
+
alpine_data: "$store.layout.#{@pages.any? && @previews.any? ? "sidebar" : "singleSectionSidebar"}",
|
36
|
+
style: "height: calc(100vh - 2.5rem);" do |layout| %>
|
37
|
+
|
38
|
+
<% if @previews.any? %>
|
39
|
+
<% layout.with_pane class: "overflow-hidden" do %>
|
40
|
+
<%= lookbook_render :nav,
|
41
|
+
id: "previews-nav",
|
42
|
+
tree: @previews.to_tree,
|
43
|
+
alpine_data: "$store.nav.previews" do |nav| %>
|
44
|
+
<%= nav.with_toolbar do |toolbar| %>
|
45
|
+
<% toolbar.with_section padded: true do %>
|
46
|
+
<h4 class="pt-1">Previews</h4>
|
47
|
+
<% end %>
|
48
|
+
<% toolbar.with_section align: :right, padded: false do %>
|
49
|
+
<%= lookbook_render :button_group, size: :xs do |group| %>
|
50
|
+
<% group.with_button icon: :minus_square,
|
51
|
+
tooltip: "Collapse all",
|
52
|
+
"@click": "closeAll" %>
|
53
|
+
<% end %>
|
36
54
|
<% end %>
|
37
55
|
<% end %>
|
56
|
+
<% nav.filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name…" %>
|
38
57
|
<% end %>
|
39
|
-
<% nav.with_filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name…" %>
|
40
58
|
<% end %>
|
41
59
|
<% end %>
|
42
|
-
<% end %>
|
43
60
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
<% if @pages.any? %>
|
62
|
+
<% layout.with_pane class: "overflow-hidden" do %>
|
63
|
+
<%= lookbook_render :nav,
|
64
|
+
id: "pages-nav",
|
65
|
+
tree: @pages.to_tree,
|
66
|
+
alpine_data: "$store.nav.pages" do |nav| %>
|
67
|
+
<%= nav.with_toolbar do |toolbar| %>
|
68
|
+
<% toolbar.with_section padded: true do %>
|
69
|
+
<h4 class="pt-1">Pages</h4>
|
70
|
+
<% end %>
|
71
|
+
<% toolbar.with_section align: :right, padded: false do %>
|
72
|
+
<%= lookbook_render :button_group, size: :xs do |group| %>
|
73
|
+
<% group.with_button icon: :minus_square,
|
74
|
+
tooltip: "Collapse all",
|
75
|
+
"@click": "closeAll" %>
|
76
|
+
<% end %>
|
59
77
|
<% end %>
|
60
78
|
<% end %>
|
61
79
|
<% end %>
|
62
80
|
<% end %>
|
63
81
|
<% end %>
|
64
82
|
<% end %>
|
83
|
+
|
65
84
|
<% end %>
|
66
85
|
<% end %>
|
67
|
-
<% end %>
|
68
86
|
|
69
|
-
|
70
|
-
|
87
|
+
<% layout.with_pane id: "app-main", class: "overflow-hidden h-full", ":class": "$store.layout.mobile && 'w-screen'" do %>
|
88
|
+
<%= content_for?(:main) ? yield(:main) : yield %>
|
89
|
+
<% end %>
|
71
90
|
<% end %>
|
91
|
+
<% else %>
|
92
|
+
<div id="app-main" class="w-screen h-full overflow-hidden">
|
93
|
+
<%= content_for?(:main) ? yield(:main) : yield %>
|
94
|
+
</div>
|
72
95
|
<% end %>
|
73
96
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
97
|
+
<div class="absolute opacity-0 bg-black inset-0 top-[39px] z-[-1] transition-opacity" :class="($store.layout.mobile && !sidebarHidden) && '!opacity-30 !z-40'" data-cloak></div>
|
98
|
+
|
99
|
+
<% if content_for? :dropdowns %>
|
100
|
+
<div class="hidden">
|
101
|
+
<%= content_for :dropdowns -%>
|
102
|
+
</div>
|
103
|
+
<% end %>
|
104
|
+
</div>
|
80
105
|
<% end %>
|
81
106
|
|
82
|
-
<%= render template: "layouts/lookbook/
|
107
|
+
<%= render template: "layouts/lookbook/skeleton" %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% content_for :body do %>
|
2
|
+
<div
|
3
|
+
id="app"
|
4
|
+
x-data="app"
|
5
|
+
x-cloak
|
6
|
+
@popstate.window="handleNavigation"
|
7
|
+
@click.document="hijax"
|
8
|
+
class="overflow-hidden">
|
9
|
+
|
10
|
+
<%= render "lookbook/partials/user_styles" %>
|
11
|
+
|
12
|
+
<%= content_for?(:main) ? yield(:main) : yield %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render template: "layouts/lookbook/skeleton" %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<%= lookbook_render :header, id: "app-header", debug_menu: @config.debug_menu do |header| %>
|
18
|
-
<% header.
|
18
|
+
<% header.branding { @config.project_name } %>
|
19
19
|
<% end %>
|
20
20
|
|
21
21
|
<%= content_for?(:shell) ? yield(:shell) : yield %>
|
@@ -5,8 +5,8 @@
|
|
5
5
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
7
7
|
|
8
|
-
<link href="<%=
|
9
|
-
<link href="<%=
|
8
|
+
<link href="<%= lookbook_asset_path("/css/lookbook.css") %>" rel="stylesheet">
|
9
|
+
<link href="<%= lookbook_asset_path("/css/themes/#{@config.ui_theme}.css") %>" rel="stylesheet">
|
10
10
|
|
11
11
|
<%- if @theme_overrides.present? %>
|
12
12
|
<style media="all">
|
@@ -17,11 +17,11 @@
|
|
17
17
|
<% if @config.ui_favicon == true %>
|
18
18
|
<link
|
19
19
|
rel="icon"
|
20
|
-
href="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M96 0v84H0V0h96Z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M71.897 0a1.5 1.5 0 0 1 1.31.769l22.605 40.5a1.5 1.5 0 0 1 0 1.462l-22.605 40.5a1.5 1.5 0 0 1-1.31.769H49.481a1 1 0 0 1-.873-1.487L70.812 42.73a1.5 1.5 0 0 0 0-1.462L48.608 1.487A1 1 0 0 1 49.481 0ZM24.655.564l22.72 40.705a1.5 1.5 0 0 1 0 1.462l-22.72 40.705a1 1 0 0 1-1.746 0L.19 42.73a1.5 1.5 0 0 1 0-1.462L22.91.564a1 1 0 0 1 1.746 0Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23a)'%3E%3Cg clip-path='url(%23b)'%3E%3Cpath fill='<%= url_encode theme.favicon_dark_mode %>' d='M0 0h96v84H0V0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"
|
20
|
+
href="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M96 0v84H0V0h96Z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M71.897 0a1.5 1.5 0 0 1 1.31.769l22.605 40.5a1.5 1.5 0 0 1 0 1.462l-22.605 40.5a1.5 1.5 0 0 1-1.31.769H49.481a1 1 0 0 1-.873-1.487L70.812 42.73a1.5 1.5 0 0 0 0-1.462L48.608 1.487A1 1 0 0 1 49.481 0ZM24.655.564l22.72 40.705a1.5 1.5 0 0 1 0 1.462l-22.72 40.705a1 1 0 0 1-1.746 0L.19 42.73a1.5 1.5 0 0 1 0-1.462L22.91.564a1 1 0 0 1 1.746 0Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23a)'%3E%3Cg clip-path='url(%23b)'%3E%3Cpath fill='<%= url_encode @theme.favicon_dark_mode %>' d='M0 0h96v84H0V0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"
|
21
21
|
media="(prefers-color-scheme: dark)">
|
22
22
|
<link
|
23
23
|
rel="icon"
|
24
|
-
href="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M96 0v84H0V0h96Z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M71.897 0a1.5 1.5 0 0 1 1.31.769l22.605 40.5a1.5 1.5 0 0 1 0 1.462l-22.605 40.5a1.5 1.5 0 0 1-1.31.769H49.481a1 1 0 0 1-.873-1.487L70.812 42.73a1.5 1.5 0 0 0 0-1.462L48.608 1.487A1 1 0 0 1 49.481 0ZM24.655.564l22.72 40.705a1.5 1.5 0 0 1 0 1.462l-22.72 40.705a1 1 0 0 1-1.746 0L.19 42.73a1.5 1.5 0 0 1 0-1.462L22.91.564a1 1 0 0 1 1.746 0Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23a)'%3E%3Cg clip-path='url(%23b)'%3E%3Cpath fill='<%= url_encode theme.favicon_light_mode %>' d='M0 0h96v84H0V0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"
|
24
|
+
href="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M96 0v84H0V0h96Z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M71.897 0a1.5 1.5 0 0 1 1.31.769l22.605 40.5a1.5 1.5 0 0 1 0 1.462l-22.605 40.5a1.5 1.5 0 0 1-1.31.769H49.481a1 1 0 0 1-.873-1.487L70.812 42.73a1.5 1.5 0 0 0 0-1.462L48.608 1.487A1 1 0 0 1 49.481 0ZM24.655.564l22.72 40.705a1.5 1.5 0 0 1 0 1.462l-22.72 40.705a1 1 0 0 1-1.746 0L.19 42.73a1.5 1.5 0 0 1 0-1.462L22.91.564a1 1 0 0 1 1.746 0Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23a)'%3E%3Cg clip-path='url(%23b)'%3E%3Cpath fill='<%= url_encode @theme.favicon_light_mode %>' d='M0 0h96v84H0V0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"
|
25
25
|
media="(prefers-color-scheme: light)">
|
26
26
|
<% end %>
|
27
27
|
|
@@ -32,15 +32,20 @@
|
|
32
32
|
window.SOCKET_PATH = "<%= @engine.websocket.full_mount_path %>";
|
33
33
|
<% end %>
|
34
34
|
</script>
|
35
|
+
|
36
|
+
<script src="<%= lookbook_asset_path("/js/index.js") %>" defer></script>
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
<% if @embed %>
|
39
|
+
<%= render "lookbook/partials/iframe_content_scripts" %>
|
40
|
+
<% else %>
|
41
|
+
<script src="<%= lookbook_asset_path("/js/lookbook.js") %>" defer></script>
|
39
42
|
<% end %>
|
40
43
|
|
44
|
+
<%= content_for :scripts %>
|
45
|
+
|
41
46
|
<title><%= [@title, @config.project_name || "Lookbook"].compact.join(" :: ") %></title>
|
42
47
|
</head>
|
43
48
|
<body>
|
44
|
-
<%= yield
|
49
|
+
<%= content_for?(:body) ? yield(:body) : yield %>
|
45
50
|
</body>
|
46
51
|
</html>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<%= icon :alert_triangle, size: 10, class: "text-red-300 mx-auto" %>
|
4
4
|
<div class="mt-3">
|
5
5
|
<h5 class="text-base">
|
6
|
-
|
6
|
+
<%== message %>
|
7
7
|
</h5>
|
8
8
|
<% if defined?(description) %>
|
9
9
|
<p class="mt-2 opacity-50 text-sm">
|
10
|
-
|
10
|
+
<%== description %>
|
11
11
|
</p>
|
12
12
|
<% end %>
|
13
13
|
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= lookbook_render "embed/inspector",
|
2
|
+
target: @target,
|
3
|
+
scenarios: @scenario_choices,
|
4
|
+
panels: @panels,
|
5
|
+
actions: @actions,
|
6
|
+
options: @options,
|
7
|
+
context: {
|
8
|
+
data: @inspector_data,
|
9
|
+
params: @passed_params,
|
10
|
+
dynamic_display_options: @dynamic_display_options,
|
11
|
+
static_display_options: @static_display_options
|
12
|
+
} %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% items =
|
1
|
+
<% items = scenarios.select { |scenario| scenario.notes.present? } %>
|
2
2
|
<% if items.many? %>
|
3
3
|
<div class="divide-y divide-dashed divide-lookbook-divider bg-lookbook-prose-bg h-full w-full">
|
4
4
|
<% items.each do |item| %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= lookbook_render :code, line_numbers: true, full_height: true do -%>
|
2
|
-
<% if
|
3
|
-
<%
|
2
|
+
<% if scenarios.many? -%>
|
3
|
+
<% scenarios.each do |scenario| -%><%== "<!-- #{scenario.label} -->\n#{scenario.output}\n\n" -%><% end %>
|
4
4
|
<%- else -%>
|
5
|
-
<%==
|
5
|
+
<%== scenarios.first.output -%>
|
6
6
|
<%- end %>
|
7
7
|
<% end %>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<div class="h-full">
|
2
|
-
<% if
|
3
|
-
<%= lookbook_render :code, language:
|
4
|
-
<%-
|
5
|
-
<%== "#{sprintf
|
2
|
+
<% if scenarios.many? %>
|
3
|
+
<%= lookbook_render :code, language: scenarios.first.source_lang[:name], line_numbers: true, full_height: true do -%>
|
4
|
+
<%- scenarios.each.with_index(1) do |scenario, i| -%>
|
5
|
+
<%== "#{sprintf scenario.source_lang[:comment], scenario.label}\n#{scenario.source}\n#{"\n" if i < scenarios.size}" %><% end %>
|
6
6
|
<% end %>
|
7
7
|
<% else %>
|
8
|
-
<%
|
9
|
-
<%= lookbook_render :code, language:
|
8
|
+
<% scenario = scenarios.first %>
|
9
|
+
<%= lookbook_render :code, language: scenario.source_lang[:name], line_numbers: true, full_height: true do %><%== scenario.source %><% end %>
|
10
10
|
<% end %>
|
11
11
|
</div>
|
@@ -1,150 +1,157 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<%=
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
<main class="h-[calc(100vh_-_2.5rem)]">
|
2
|
+
<%= lookbook_render :split_layout,
|
3
|
+
alpine_data: "$store.layout.inspector",
|
4
|
+
":class": "($store.inspector.drawer.hidden || #{@drawer_panels.none?}) && '!grid-rows-[1fr] !grid-cols-[1fr]'",
|
5
|
+
data: {
|
6
|
+
"preview-target": @target.id
|
7
|
+
} do |layout| %>
|
8
|
+
|
9
|
+
<%= layout.with_pane class: "flex flex-col h-full overflow-hidden",
|
10
|
+
"x-effect": "forceOrientation = (layoutWidth < $store.inspector.minVerticalSplitWidth) ? 'horizontal' : null" do %>
|
11
|
+
|
12
|
+
<%= lookbook_render :toolbar, id: "main-toolbar" do |toolbar| %>
|
13
|
+
<% toolbar.with_section ":class": "layoutResizing && 'overflow-hidden'" do %>
|
14
|
+
<%= lookbook_render :tabs, alpine_data: "$store.inspector.main", id: "inspector-tabs-main" do |tabs| %>
|
15
|
+
<%= @main_panels.each do |panel| %>
|
16
|
+
<% tabs.with_tab name: panel.name,
|
17
|
+
label: panel.label,
|
18
|
+
hotkey: panel.hotkey,
|
19
|
+
disabled: panel.disabled %>
|
20
|
+
<% end %>
|
19
21
|
<% end %>
|
20
22
|
<% end %>
|
21
|
-
<% end %>
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
<% toolbar.with_section align: :right, class: "flex-none" do %>
|
25
|
+
<% if @dynamic_display_options.any? %>
|
26
|
+
<%= lookbook_render "display_options/editor" do |editor| %>
|
27
|
+
<% @dynamic_display_options.each do |key, opts| %>
|
28
|
+
<% editor.with_field name: key, opts: opts, value: @static_display_options[key] %>
|
29
|
+
<% end %>
|
28
30
|
<% end %>
|
29
31
|
<% end %>
|
30
32
|
<% end %>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<% toolbar.with_section divide: :left, class: "flex-none relative z-10" do %>
|
34
|
-
<%= lookbook_render :button_group do |group| %>
|
35
|
-
<% group.with_button icon: :link,
|
36
|
-
tooltip: "Copy preview URL",
|
37
|
-
copy: true do %>
|
38
|
-
<%= lookbook_inspect_url(@target.lookup_path, request.query_parameters) %>
|
39
|
-
<% end %>
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
<% toolbar.with_section divide: :left, class: "flex-none relative z-10" do %>
|
35
|
+
<%= lookbook_render :button_group do |group| %>
|
36
|
+
<%= group.with_button id: "embed-generator-dropdown-button", icon: :code_2, tooltip: "Get embed code" do |button| %>
|
37
|
+
<% button.with_dropdown.with_content(lookbook_render :embed_code_dropdown,
|
38
|
+
pages: @pages,
|
39
|
+
preview: @preview,
|
40
|
+
target: @target,
|
41
|
+
params: request.query_parameters
|
42
|
+
) %>
|
43
|
+
<% end %>
|
44
|
+
<% group.with_button id: "copy-preview-url-button",
|
45
|
+
icon: :link,
|
46
|
+
tooltip: "Copy preview URL",
|
44
47
|
copy: true do %>
|
45
|
-
|
48
|
+
<%= lookbook_inspect_url(@target.lookup_path, request.query_parameters) %>
|
46
49
|
<% end %>
|
50
|
+
|
51
|
+
<% group.with_button id: "refresh-preview-button",
|
52
|
+
icon: :refresh_cw,
|
53
|
+
tooltip: "Refresh preview",
|
54
|
+
"@click.stop": "startSpin(); $dispatch('viewport:reload'); stopSpin(500);" %>
|
55
|
+
|
56
|
+
<% group.with_button id: "open-preview-button",
|
57
|
+
icon: :external_link,
|
58
|
+
href: lookbook_preview_path(@target.lookup_path, request.query_parameters),
|
59
|
+
tooltip: "Open preview in new window",
|
60
|
+
target: "_blank" %>
|
61
|
+
|
62
|
+
<% group.with_button id: "show-drawer-button",
|
63
|
+
icon: "vertical ? 'sidebar' : 'credit-card'",
|
64
|
+
tooltip: "Show drawer",
|
65
|
+
"@click": "$store.inspector.drawer.hidden = false",
|
66
|
+
class: "rotate-180",
|
67
|
+
"x-show": "$store.inspector.drawer.hidden",
|
68
|
+
cloak: true %>
|
47
69
|
<% end %>
|
48
|
-
|
49
|
-
<% group.with_button icon: :refresh_cw,
|
50
|
-
tooltip: "Refresh preview",
|
51
|
-
"@click.stop": "startSpin(); $dispatch('viewport:reload'); stopSpin(500);" %>
|
52
|
-
|
53
|
-
<% group.with_button icon: :external_link,
|
54
|
-
href: lookbook_preview_path(@target.lookup_path, request.query_parameters),
|
55
|
-
tooltip: "Open preview in new window",
|
56
|
-
target: "_blank" %>
|
57
|
-
|
58
|
-
<% group.with_button icon: "vertical ? 'sidebar' : 'credit-card'",
|
59
|
-
tooltip: "Show drawer",
|
60
|
-
"@click": "$store.inspector.drawer.hidden = false",
|
61
|
-
class: "rotate-180",
|
62
|
-
"x-show": "$store.inspector.drawer.hidden",
|
63
|
-
cloak: true %>
|
64
70
|
<% end %>
|
65
71
|
<% end %>
|
66
|
-
<% end %>
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
<div class="h-full relative overflow-auto">
|
74
|
+
<%= lookbook_render :tab_panels, alpine_data: "$store.inspector.main", id: "inspector-panels-main" do |tabs| %>
|
75
|
+
<% @main_panels.each do |panel| %>
|
76
|
+
<% tabs.with_panel name: panel.name do %>
|
77
|
+
<%= lookbook_render :inspector_panel, name: panel.name do %>
|
78
|
+
<%= render panel.partial, **@inspector_data, panel: panel, **panel.locals %>
|
79
|
+
<% end %>
|
74
80
|
<% end %>
|
75
81
|
<% end %>
|
76
82
|
<% end %>
|
77
|
-
|
78
|
-
|
79
|
-
<% end %>
|
80
|
-
|
81
|
-
<%= layout.with_pane class: "flex flex-col h-full overflow-hidden bg-lookbook-drawer-bg",
|
82
|
-
"x-show": "!$store.inspector.drawer.hidden && #{@drawer_panels.any?}" do %>
|
83
|
+
</div>
|
84
|
+
<% end %>
|
83
85
|
|
84
|
-
<%=
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
86
|
+
<%= layout.with_pane class: "flex flex-col h-full overflow-hidden bg-lookbook-drawer-bg",
|
87
|
+
"x-show": "!$store.inspector.drawer.hidden && #{@drawer_panels.any?}" do %>
|
88
|
+
|
89
|
+
<%= lookbook_render :toolbar, id: "drawer-toolbar" do |toolbar| %>
|
90
|
+
<% toolbar.with_section ":class": "layoutResizing && 'overflow-hidden'" do %>
|
91
|
+
<%= lookbook_render :tabs, alpine_data: "$store.inspector.drawer", id: "inspector-tabs-drawer" do |tabs| %>
|
92
|
+
<%= @drawer_panels.each do |panel| %>
|
93
|
+
<% tabs.with_tab name: panel.name,
|
94
|
+
label: panel.label,
|
95
|
+
hotkey: panel.hotkey,
|
96
|
+
disabled: panel.disabled %>
|
97
|
+
<% end %>
|
92
98
|
<% end %>
|
93
99
|
<% end %>
|
94
|
-
<% end %>
|
95
100
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
<% toolbar.with_section align: :right, class: "flex-none relative z-10" do %>
|
102
|
+
<%= lookbook_render :button_group do |group| %>
|
103
|
+
<%= @drawer_panels.select { |p| !p.disabled && p.copy }.each do |panel| %>
|
104
|
+
<% group.with_button id: "copy-panel-contents-button",
|
105
|
+
icon: :copy,
|
106
|
+
tooltip: "Copy panel contents",
|
107
|
+
copy: !!panel.copy,
|
108
|
+
"x-show": "$store.inspector.drawer.activeTab === '#{panel.name}'",
|
109
|
+
cloak: true do %>
|
110
|
+
<%= panel.copy ? panel.copy : "" %>
|
111
|
+
<% end %>
|
112
|
+
<% end %>
|
113
|
+
<% end %>
|
107
114
|
<% end %>
|
108
|
-
<% end %>
|
109
|
-
|
110
|
-
<% toolbar.with_section divide: :left, class: "flex-none relative z-10" do %>
|
111
|
-
<%= lookbook_render :button_group do |group| %>
|
112
|
-
|
113
|
-
<% group.with_button icon: :corner_up_right,
|
114
|
-
tooltip: "Move drawer to right",
|
115
|
-
"@click": "switchOrientation",
|
116
|
-
"x-show": "horizontal && layoutWidth > $store.inspector.minVerticalSplitWidth",
|
117
|
-
cloak: true %>
|
118
|
-
|
119
|
-
<% group.with_button icon: :corner_up_right,
|
120
|
-
"x-show": "horizontal && layoutWidth <= $store.inspector.minVerticalSplitWidth",
|
121
|
-
disabled: true,
|
122
|
-
cloak: true %>
|
123
115
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
116
|
+
<% toolbar.with_section divide: :left, class: "flex-none relative z-10" do %>
|
117
|
+
<%= lookbook_render :button_group do |group| %>
|
118
|
+
|
119
|
+
<% group.with_button id: "drawer-to-right-button",
|
120
|
+
icon: :sidebar_open,
|
121
|
+
tooltip: "Pin drawer on right",
|
122
|
+
"@click": "switchOrientation",
|
123
|
+
"x-show": "horizontal",
|
124
|
+
":class": "{'pointer-events-none opacity-50 !cursor-not-allowed': horizontal && layoutWidth <= $store.inspector.minVerticalSplitWidth}",
|
125
|
+
cloak: true %>
|
126
|
+
|
127
|
+
<% group.with_button id: "drawer-to-bottom-button",
|
128
|
+
icon: :sidebar_open,
|
129
|
+
tooltip: "Pin drawer on bottom",
|
130
|
+
"@click": "switchOrientation",
|
131
|
+
"x-show": "vertical",
|
132
|
+
class: "rotate-90",
|
133
|
+
cloak: true %>
|
134
|
+
|
135
|
+
<% group.with_button id: "hide-drawer-button",
|
136
|
+
icon: :x_circle,
|
137
|
+
tooltip: "Hide drawer",
|
138
|
+
"@click": "$store.inspector.drawer.hidden = true",
|
139
|
+
cloak: true %>
|
140
|
+
<% end %>
|
134
141
|
<% end %>
|
135
|
-
<% end %>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
142
|
+
<% end %>
|
143
|
+
|
144
|
+
<div class="h-full overflow-auto">
|
145
|
+
<%= lookbook_render :tab_panels, alpine_data: "$store.inspector.drawer", id: "inspector-panels-drawer" do |tabs| %>
|
146
|
+
<% @drawer_panels.each do |panel| %>
|
147
|
+
<% tabs.with_panel name: panel.name do %>
|
148
|
+
<%= lookbook_render :inspector_panel, name: panel.name do %>
|
149
|
+
<%= render panel.partial, **@inspector_data, panel: panel, **panel.locals %>
|
150
|
+
<% end %>
|
144
151
|
<% end %>
|
145
152
|
<% end %>
|
146
153
|
<% end %>
|
147
|
-
|
148
|
-
|
154
|
+
</div>
|
155
|
+
<% end %>
|
149
156
|
<% end %>
|
150
|
-
|
157
|
+
</main>
|