lookbook 0.8.3 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -795
- data/app/assets/lookbook/css/lookbook.css +55 -0
- data/app/assets/lookbook/css/themes/blue.css +42 -0
- data/app/assets/lookbook/css/themes/indigo.css +42 -0
- data/app/assets/lookbook/css/themes/zinc.css +42 -0
- data/app/assets/lookbook/css/{tooltip_theme.css → tooltip.css} +14 -8
- data/app/assets/lookbook/js/app.js +64 -61
- data/app/assets/lookbook/js/components/clipboard.js +47 -0
- data/app/assets/lookbook/js/components/tooltip.js +30 -0
- data/app/assets/lookbook/js/config.js +7 -4
- data/app/assets/lookbook/js/helpers/build.js +22 -0
- data/app/assets/lookbook/js/helpers/dom.js +45 -0
- data/app/assets/lookbook/js/helpers/layout.js +21 -0
- data/app/assets/lookbook/js/helpers/request.js +16 -0
- data/app/assets/lookbook/js/helpers/string.js +11 -0
- data/app/assets/lookbook/js/lib/socket.js +4 -3
- data/app/assets/lookbook/js/lib/tippy.js +8 -0
- data/app/assets/lookbook/js/lookbook.js +61 -0
- data/app/assets/lookbook/js/plugins/logger.js +39 -0
- data/app/assets/lookbook/js/stores/filter.js +2 -2
- data/app/assets/lookbook/js/stores/inspector.js +23 -17
- data/app/assets/lookbook/js/stores/layout.js +101 -5
- data/app/assets/lookbook/js/stores/nav.js +17 -16
- data/app/assets/lookbook/js/stores/pages.js +4 -2
- data/app/assets/lookbook/js/stores/settings.js +7 -0
- data/app/assets/lookbook/js/stores/workbench.js +29 -0
- data/app/components/lookbook/button/component.html.erb +28 -0
- data/app/components/lookbook/button/component.js +55 -0
- data/app/components/lookbook/button/component.rb +39 -0
- data/app/components/lookbook/button_group/component.html.erb +3 -0
- data/app/components/lookbook/button_group/component.rb +18 -0
- data/app/components/lookbook/code/component.css +57 -0
- data/app/components/lookbook/code/component.html.erb +10 -0
- data/app/components/lookbook/code/component.js +3 -0
- data/app/components/lookbook/code/component.rb +56 -0
- data/app/components/lookbook/code/highlight_github_light.css +217 -0
- data/app/components/lookbook/component.rb +41 -0
- data/app/components/lookbook/copy_button/component.html.erb +11 -0
- data/app/components/lookbook/copy_button/component.js +16 -0
- data/app/components/lookbook/copy_button/component.rb +23 -0
- data/app/components/lookbook/dimensions_display/component.html.erb +11 -0
- data/app/components/lookbook/dimensions_display/component.js +37 -0
- data/app/components/lookbook/dimensions_display/component.rb +18 -0
- data/app/components/lookbook/embed/component.html.erb +50 -0
- data/app/components/lookbook/embed/component.js +39 -0
- data/app/components/lookbook/embed/component.rb +22 -0
- data/app/components/lookbook/filter/component.html.erb +17 -0
- data/app/components/lookbook/filter/component.js +21 -0
- data/app/components/lookbook/filter/component.rb +15 -0
- data/app/components/lookbook/header/component.html.erb +79 -0
- data/app/components/lookbook/header/component.rb +9 -0
- data/app/components/lookbook/icon/component.css +11 -0
- data/app/components/lookbook/icon/component.html.erb +5 -0
- data/app/components/lookbook/icon/component.js +5 -0
- data/app/components/lookbook/icon/component.rb +23 -0
- data/app/components/lookbook/nav/component.html.erb +33 -0
- data/app/components/lookbook/nav/component.js +52 -0
- data/app/components/lookbook/nav/component.rb +37 -0
- data/app/components/lookbook/nav/item/component.html.erb +23 -0
- data/app/components/lookbook/nav/item/component.js +66 -0
- data/app/components/lookbook/nav/item/component.rb +84 -0
- data/app/components/lookbook/page_tabs/component.html.erb +18 -0
- data/app/components/lookbook/page_tabs/component.rb +19 -0
- data/app/components/lookbook/params_editor/component.html.erb +3 -0
- data/app/components/lookbook/params_editor/component.js +12 -0
- data/app/components/lookbook/params_editor/component.rb +11 -0
- data/app/components/lookbook/params_editor/field/component.html.erb +50 -0
- data/app/components/lookbook/params_editor/field/component.js +36 -0
- data/app/components/lookbook/params_editor/field/component.rb +41 -0
- data/app/components/lookbook/prose/component.css +12 -0
- data/app/components/lookbook/prose/component.html.erb +3 -0
- data/app/components/lookbook/prose/component.rb +26 -0
- data/app/components/lookbook/split_layout/component.html.erb +13 -0
- data/app/components/lookbook/split_layout/component.js +151 -0
- data/app/components/lookbook/split_layout/component.rb +11 -0
- data/app/components/lookbook/tab_panels/component.html.erb +5 -0
- data/app/components/lookbook/tab_panels/component.js +25 -0
- data/app/components/lookbook/tab_panels/component.rb +20 -0
- data/app/components/lookbook/tab_panels/panel/component.html.erb +8 -0
- data/app/components/lookbook/tab_panels/panel/component.rb +9 -0
- data/app/components/lookbook/tabs/component.css +8 -0
- data/app/components/lookbook/tabs/component.html.erb +20 -0
- data/app/components/lookbook/tabs/component.js +115 -0
- data/app/components/lookbook/tabs/component.rb +28 -0
- data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +20 -0
- data/app/components/lookbook/tabs/dropdown_tab/component.rb +17 -0
- data/app/components/lookbook/tabs/tab/component.html.erb +24 -0
- data/app/components/lookbook/tabs/tab/component.rb +17 -0
- data/app/components/lookbook/tag_component.rb +29 -0
- data/app/components/lookbook/toolbar/component.css +16 -0
- data/app/components/lookbook/toolbar/component.html.erb +5 -0
- data/app/components/lookbook/toolbar/component.rb +26 -0
- data/app/components/lookbook/viewport/component.css +11 -0
- data/app/components/lookbook/viewport/component.html.erb +57 -0
- data/app/{assets/lookbook/js/components/preview-window.js → components/lookbook/viewport/component.js} +57 -14
- data/app/components/lookbook/viewport/component.rb +21 -0
- data/app/controllers/lookbook/application_controller.rb +16 -5
- data/app/controllers/lookbook/pages_controller.rb +19 -8
- data/app/controllers/lookbook/previews_controller.rb +131 -90
- data/app/helpers/lookbook/application_helper.rb +5 -1
- data/app/helpers/lookbook/component_helper.rb +22 -10
- data/app/helpers/lookbook/output_helper.rb +8 -4
- data/app/helpers/lookbook/page_helper.rb +13 -21
- data/app/views/layouts/lookbook/application.html.erb +76 -28
- data/app/views/layouts/lookbook/inspector.html.erb +7 -0
- data/app/views/layouts/lookbook/page.html.erb +53 -0
- data/app/views/layouts/lookbook/shell.html.erb +64 -0
- data/app/views/layouts/lookbook/skeleton.html.erb +27 -10
- data/app/views/layouts/lookbook/standalone.html.erb +5 -0
- data/app/views/lookbook/404.html.erb +15 -0
- data/app/views/lookbook/error.html.erb +34 -34
- data/app/views/lookbook/index.html.erb +11 -6
- data/app/views/lookbook/pages/show.html.erb +38 -66
- data/app/views/{layouts/lookbook → lookbook}/preview.html.erb +6 -8
- data/app/views/lookbook/previews/panels/_content.html.erb +13 -0
- data/app/views/lookbook/previews/panels/_notes.html.erb +19 -25
- data/app/views/lookbook/previews/panels/_output.html.erb +7 -18
- data/app/views/lookbook/previews/panels/_params.html.erb +13 -15
- data/app/views/lookbook/previews/panels/_preview.html.erb +6 -52
- data/app/views/lookbook/previews/panels/_source.html.erb +6 -15
- data/app/views/lookbook/previews/show.html.erb +133 -24
- data/config/routes.rb +5 -5
- data/lib/lookbook/code_formatter.rb +37 -13
- data/lib/lookbook/collection.rb +19 -16
- data/lib/lookbook/config.rb +180 -0
- data/lib/lookbook/engine.rb +66 -59
- data/lib/lookbook/entity.rb +47 -0
- data/lib/lookbook/error.rb +1 -2
- data/lib/lookbook/features.rb +1 -1
- data/lib/lookbook/markdown.rb +3 -4
- data/lib/lookbook/page.rb +52 -20
- data/lib/lookbook/page_collection.rb +8 -0
- data/lib/lookbook/page_section.rb +31 -0
- data/lib/lookbook/params.rb +14 -3
- data/lib/lookbook/preview.rb +16 -7
- data/lib/lookbook/preview_collection.rb +8 -0
- data/lib/lookbook/preview_controller.rb +6 -2
- data/lib/lookbook/preview_example.rb +5 -6
- data/lib/lookbook/preview_group.rb +4 -9
- data/lib/lookbook/{code_inspector.rb → source_inspector.rb} +2 -2
- data/lib/lookbook/store.rb +36 -0
- data/lib/lookbook/theme.rb +29 -0
- data/lib/lookbook/utils.rb +11 -3
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +6 -1
- data/lib/tasks/lookbook_tasks.rake +12 -0
- data/public/lookbook-assets/css/app.css +2340 -1
- data/public/lookbook-assets/css/app.css.map +11 -1
- data/public/lookbook-assets/css/lookbook.css +3069 -0
- data/public/lookbook-assets/css/lookbook.css.map +1 -0
- data/public/lookbook-assets/css/themes/blue.css +44 -0
- data/public/lookbook-assets/css/themes/blue.css.map +1 -0
- data/public/lookbook-assets/css/themes/indigo.css +44 -0
- data/public/lookbook-assets/css/themes/indigo.css.map +1 -0
- data/public/lookbook-assets/css/themes/zinc.css +44 -0
- data/public/lookbook-assets/css/themes/zinc.css.map +1 -0
- data/public/lookbook-assets/js/app.js +10861 -1
- data/public/lookbook-assets/js/app.js.map +2571 -1
- data/public/lookbook-assets/js/embed.js +895 -1
- data/public/lookbook-assets/js/embed.js.map +1 -1
- data/public/lookbook-assets/js/lookbook.js +13541 -0
- data/public/lookbook-assets/js/lookbook.js.map +1 -0
- metadata +133 -115
- data/app/assets/lookbook/css/app.css +0 -161
- data/app/assets/lookbook/css/code_theme.css +0 -214
- data/app/assets/lookbook/js/components/app.js +0 -55
- data/app/assets/lookbook/js/components/code.js +0 -5
- data/app/assets/lookbook/js/components/copy.js +0 -20
- data/app/assets/lookbook/js/components/embed.js +0 -89
- data/app/assets/lookbook/js/components/filter.js +0 -35
- data/app/assets/lookbook/js/components/inspector.js +0 -66
- data/app/assets/lookbook/js/components/nav-group.js +0 -47
- data/app/assets/lookbook/js/components/nav-item.js +0 -29
- data/app/assets/lookbook/js/components/nav.js +0 -28
- data/app/assets/lookbook/js/components/page.js +0 -25
- data/app/assets/lookbook/js/components/param.js +0 -34
- data/app/assets/lookbook/js/components/sidebar.js +0 -18
- data/app/assets/lookbook/js/components/sizes.js +0 -16
- data/app/assets/lookbook/js/components/splitter.js +0 -25
- data/app/assets/lookbook/js/components/tabs.js +0 -52
- data/app/assets/lookbook/js/lib/split.js +0 -15
- data/app/assets/lookbook/js/stores/sidebar.js +0 -26
- data/app/views/layouts/lookbook/basic.html.erb +0 -7
- data/app/views/lookbook/components/_branding.html.erb +0 -8
- data/app/views/lookbook/components/_code.html.erb +0 -17
- data/app/views/lookbook/components/_copy_button.html.erb +0 -11
- data/app/views/lookbook/components/_drawer.html.erb +0 -112
- data/app/views/lookbook/components/_embed.html.erb +0 -39
- data/app/views/lookbook/components/_errors.html.erb +0 -13
- data/app/views/lookbook/components/_filter.html.erb +0 -18
- data/app/views/lookbook/components/_header.html.erb +0 -6
- data/app/views/lookbook/components/_icon.html.erb +0 -5
- data/app/views/lookbook/components/_nav.html.erb +0 -16
- data/app/views/lookbook/components/_nav_collection.html.erb +0 -5
- data/app/views/lookbook/components/_nav_group.html.erb +0 -14
- data/app/views/lookbook/components/_nav_item.html.erb +0 -24
- data/app/views/lookbook/components/_nav_page.html.erb +0 -22
- data/app/views/lookbook/components/_nav_preview.html.erb +0 -13
- data/app/views/lookbook/components/_not_found.html.erb +0 -11
- data/app/views/lookbook/components/_param.html.erb +0 -21
- data/app/views/lookbook/components/_preview.html.erb +0 -77
- data/app/views/lookbook/components/_sidebar.html.erb +0 -69
- data/app/views/lookbook/pages/not_found.html.erb +0 -15
- data/app/views/lookbook/previews/error.html.erb +0 -1
- data/app/views/lookbook/previews/inputs/_select.html.erb +0 -7
- data/app/views/lookbook/previews/inputs/_text.html.erb +0 -8
- data/app/views/lookbook/previews/inputs/_textarea.html.erb +0 -8
- data/app/views/lookbook/previews/inputs/_toggle.html.erb +0 -13
- data/app/views/lookbook/previews/not_found.html.erb +0 -23
@@ -4,38 +4,30 @@ module Lookbook
|
|
4
4
|
|
5
5
|
def page_path(id)
|
6
6
|
page = id.is_a?(Page) ? id : Lookbook.pages.find(id)
|
7
|
-
|
7
|
+
if page.present?
|
8
|
+
lookbook.page_path page.lookup_path
|
9
|
+
else
|
10
|
+
Lookbook.logger.warn "Could not find page with id ':#{id}'"
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
|
-
def embed(*args, params: {}, type: :preview, **opts)
|
14
|
+
def embed(*args, params: {}, type: :preview, max_height: nil, **opts)
|
11
15
|
return unless args.any?
|
12
16
|
|
13
17
|
@embed_counter ||= 0
|
14
18
|
|
15
19
|
preview_lookup = args.first.is_a?(Symbol) ? args.first : preview_class_name(args.first)
|
16
20
|
preview = Lookbook.previews.find(preview_lookup)
|
17
|
-
|
18
21
|
example = args[1] ? preview&.example(args[1]) : preview&.default_example
|
19
22
|
|
20
|
-
|
21
|
-
@embed_counter += 1
|
22
|
-
render_component "embed",
|
23
|
-
id: generate_id("embed", url_for, example.lookup_path, @embed_counter - 1),
|
24
|
-
example: example,
|
25
|
-
params: params,
|
26
|
-
opts: opts
|
27
|
-
else
|
28
|
-
embed_not_found
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
protected
|
23
|
+
embed_id = "#{url_for}/embed/#{example.lookup_path}".delete_prefix("/").tr("/", "-")
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
25
|
+
render_component :embed,
|
26
|
+
id: embed_id,
|
27
|
+
example: example,
|
28
|
+
params: params,
|
29
|
+
max_height: max_height,
|
30
|
+
opts: opts
|
39
31
|
end
|
40
32
|
end
|
41
33
|
end
|
@@ -1,30 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
<% content_for :shell do %>
|
2
|
+
<%= render_component :split_layout,
|
3
|
+
alpine_data: "$store.layout.main",
|
4
|
+
":class": "$store.layout.mobile && '!block'" do |layout| %>
|
5
|
+
|
6
|
+
<% layout.pane class: "flex flex-col bg-lookbook-sidebar relative translate-x-0",
|
7
|
+
":class": "{
|
8
|
+
'transition': $store.layout.mobile,
|
9
|
+
'translate-x-full': $store.layout.mobile && sidebarHidden,
|
10
|
+
'!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
|
11
|
+
}",
|
12
|
+
"@click.outside": "closeMobileSidebar",
|
13
|
+
x_cloak: true do %>
|
14
|
+
|
15
|
+
<%= render_component :split_layout,
|
16
|
+
alpine_data: "$store.layout.#{Lookbook.pages.any? ? "sidebar" : "singleSectionSidebar"}",
|
17
|
+
style: "height: calc(100vh - 2.5rem);" do |layout| %>
|
18
|
+
<% layout.pane class: "overflow-hidden" do %>
|
19
|
+
<%= render_component :nav,
|
20
|
+
collection: Lookbook.previews,
|
21
|
+
alpine_data: "$store.nav.previews",
|
22
|
+
label: "Previews",
|
23
|
+
collapse_singles: true do |nav| %>
|
24
|
+
<% nav.filter store: "$store.nav.previews.filter", placeholder: "Filter by preview name…" %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% if Lookbook.pages.any? %>
|
29
|
+
<% layout.pane class: "overflow-hidden" do %>
|
30
|
+
<%= render_component :nav,
|
31
|
+
collection: Lookbook.pages,
|
32
|
+
alpine_data: "$store.nav.pages",
|
33
|
+
label: "Pages" %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% if Lookbook::Preview.errors.any? %>
|
40
|
+
<div x-data="{hidden: false}" class="flex-none border-t border-lookbook-divider absolute bottom-0 left-0 right-0" x-show="!hidden">
|
41
|
+
<%= render_component :toolbar do |toolbar| %>
|
42
|
+
<% toolbar.section padded: true, class: "flex items-center" do %>
|
43
|
+
<%= render_component :icon, name: :alert_triangle, size: 4, class: "text-red-700" %>
|
44
|
+
<span class="ml-2">Preview load errors</span>
|
45
|
+
<% end %>
|
46
|
+
<% toolbar.section align: :right do %>
|
47
|
+
<% render_component :button, icon: :x, "@click": "hidden = !hidden" %>
|
48
|
+
<% end %>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<div class="h-full max-h-[300px] overflow-hidden">
|
52
|
+
<div class="bg-red-50 w-full overflow-auto h-full">
|
53
|
+
<ul class="text-sm divide-y divide-red-200">
|
54
|
+
<% Lookbook::Preview.errors.each do |error| %>
|
55
|
+
<% error = error.is_a?(Lookbook::Error) ? error : Lookbook::Error.new(error) %>
|
56
|
+
<li class="px-4 py-3">
|
57
|
+
<h4 class="break-all leading-tight text-xs ">
|
58
|
+
<%= error.file_name %><%= ":#{error.line_number}" if error.line_number %>
|
59
|
+
</h4>
|
60
|
+
<pre class="text-red-800 text-xs mt-2 whitespace-pre-wrap opacity-80 font-mono"><%= error.message %></pre>
|
61
|
+
</li>
|
62
|
+
<% end %>
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
<% layout.pane class: "overflow-hidden", ":class": "$store.layout.mobile && 'w-screen'" do %>
|
71
|
+
<%= content_for?(:main) ? yield(:main) : yield %>
|
72
|
+
<% end %>
|
73
|
+
|
74
|
+
<% end %>
|
75
|
+
<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>
|
28
76
|
<% end %>
|
29
77
|
|
30
|
-
<%= render template: "layouts/lookbook/
|
78
|
+
<%= render template: "layouts/lookbook/shell" %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<%= content_for :main do %>
|
2
|
+
<div
|
3
|
+
class="h-[calc(100vh_-_40px)]"
|
4
|
+
x-data="{}"
|
5
|
+
@navigation:complete.window="$refs.scroller.scrollTop = 0">
|
6
|
+
|
7
|
+
<div class="h-full bg-lookbook-page relative">
|
8
|
+
<% unless @error %>
|
9
|
+
|
10
|
+
<div class="absolute top-0 right-0 pt-1 pr-0 pl-1 pb-1 rounded-bl-md">
|
11
|
+
<div class="bg-lookbook-page opacity-90 absolute inset-0 w-full h-full z-0"></div>
|
12
|
+
<div class="relative z-10 flex items-center">
|
13
|
+
|
14
|
+
<% if @previous_page %>
|
15
|
+
<%= render_component :button,
|
16
|
+
size: :lg,
|
17
|
+
icon: :chevron_left,
|
18
|
+
tooltip: "Previous page",
|
19
|
+
href: page_path(@previous_page.lookup_path),
|
20
|
+
class: "pr-0.5 bg-transparent" %>
|
21
|
+
<% else %>
|
22
|
+
<%= render_component :button,
|
23
|
+
size: :lg,
|
24
|
+
icon: :chevron_left,
|
25
|
+
disabled: true,
|
26
|
+
class: "opacity-50 !cursor-default pr-0.5 bg-transparent" %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% if @next_page %>
|
30
|
+
<%= render_component :button,
|
31
|
+
size: :lg,
|
32
|
+
icon: :chevron_right,
|
33
|
+
tooltip: "Next page",
|
34
|
+
href: page_path(@next_page.lookup_path),
|
35
|
+
class: "pl-0.5 bg-transparent" %>
|
36
|
+
<% else %>
|
37
|
+
<%= render_component :button,
|
38
|
+
size: :lg,
|
39
|
+
icon: :chevron_right,
|
40
|
+
disabled: true,
|
41
|
+
class: "opacity-50 !cursor-default pl-0.5 bg-transparent" %>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<%= yield %>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
</div>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
<%= render template: "layouts/lookbook/application" %>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<%= content_for :body do %>
|
2
|
+
<div
|
3
|
+
id="app"
|
4
|
+
x-data="app"
|
5
|
+
@popstate.window="handleNavigation"
|
6
|
+
@click.document="hijax"
|
7
|
+
@navigation:start="closeMobileSidebar"
|
8
|
+
class="w-screen h-screen grid grid-rows-[40px_1fr] relative">
|
9
|
+
|
10
|
+
<%= render_component :header do |header| %>
|
11
|
+
<% header.branding { config.project_name } %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if false %>
|
15
|
+
<%= render_component :toolbar, class: "group !bg-lookbook-header !text-lookbook-header-text" do |toolbar| %>
|
16
|
+
<% toolbar.section padded: true do %>
|
17
|
+
<%= render_component :branding,
|
18
|
+
text: config.project_name,
|
19
|
+
href: landing_path if config.project_name %>
|
20
|
+
<% end %>
|
21
|
+
<% toolbar.section padded: false, align: :right, class: "flex items-center" do %>
|
22
|
+
<%= render_component :button_group, class: "relative -top-px" do |group| %>
|
23
|
+
<% if Rails.env == "development" %>
|
24
|
+
<% group.button icon: :help_circle, class: "opacity-50 hover:opacity-100 transition !text-lookbook-header-text" do |button| %>
|
25
|
+
<% button.dropdown do %>
|
26
|
+
<%= tag.div class: "divide-y divide-lookbook-divider" do %>
|
27
|
+
<div class="flex items-center text-xs px-3 py-2">
|
28
|
+
<span class="opacity-60 mr-1">Lookbook</span>
|
29
|
+
<span class="mr-6">v<%= Lookbook::VERSION %></span>
|
30
|
+
<a href="https://github.com/allmarkedup/lookbook" target="_blank" class="ml-auto opacity-70">
|
31
|
+
<%= render_component :icon, name: :github, size: 3 %>
|
32
|
+
</a>
|
33
|
+
</div>
|
34
|
+
<div class="px-3 py-2">
|
35
|
+
<a href="#"
|
36
|
+
class="text-xs underline"
|
37
|
+
@click.stop="localStorage.clear(); window.location.reload();">
|
38
|
+
Clear local storage
|
39
|
+
</a>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% group.button icon: :menu,
|
46
|
+
"@click.stop": "toggleSidebar",
|
47
|
+
x_show: "$store.layout.mobile && sidebarHidden",
|
48
|
+
class: "!text-lookbook-header-text" %>
|
49
|
+
<% group.button icon: :x,
|
50
|
+
"@click.stop": "toggleSidebar",
|
51
|
+
x_show: "$store.layout.mobile && !sidebarHidden",
|
52
|
+
"@keydown.esc.window": "closeMobileSidebar",
|
53
|
+
class: "!text-lookbook-header-text" %>
|
54
|
+
<% end %>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
<%= content_for?(:shell) ? yield(:shell) : yield %>
|
60
|
+
</div>
|
61
|
+
<% end %>
|
62
|
+
|
63
|
+
<%= render template: "layouts/lookbook/skeleton" %>
|
64
|
+
0
|
@@ -1,28 +1,45 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html lang="en"
|
2
|
+
<html lang="en">
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-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="/lookbook-assets/css/
|
8
|
+
<link href="/lookbook-assets/css/lookbook.css?v=<%= Lookbook::VERSION %>" rel="stylesheet">
|
9
|
+
<link href="/lookbook-assets/css/themes/<%= config.ui_theme %>.css?v=<%= Lookbook::VERSION %>" rel="stylesheet">
|
10
|
+
<% if @theme_overrides.present? %>
|
11
|
+
<style>
|
12
|
+
<%== @theme_overrides %>
|
13
|
+
</style>
|
14
|
+
<% end %>
|
15
|
+
|
9
16
|
<% if config.ui_favicon != false %>
|
10
17
|
<link rel="icon" href="<%= config.ui_favicon || "data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👀</text></svg>" %>">
|
11
18
|
<% end %>
|
12
19
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
<script>
|
21
|
+
window.LOG_LEVEL = <%= Lookbook::Engine.log_level %>;
|
22
|
+
window.APP_NAME = "<%= Lookbook::Engine.app_name %>";
|
23
|
+
<% if Lookbook::Engine.websocket %>
|
24
|
+
window.SOCKET_PATH = "<%= Lookbook::Engine.websocket_mount_path %>";
|
25
|
+
<% end %>
|
26
|
+
</script>
|
27
|
+
|
28
|
+
<script src="/lookbook-assets/js/lookbook.js?v=<%= Lookbook::VERSION %>" defer></script>
|
19
29
|
<% if params[:lookbook_embed] %>
|
20
|
-
<script src="/lookbook-assets/js/embed.js?v=<%= Lookbook
|
30
|
+
<script src="/lookbook-assets/js/embed.js?v=<%= Lookbook::VERSION %>" defer></script>
|
21
31
|
<% end %>
|
22
32
|
|
23
33
|
<title><%= [@title, config.project_name || "Lookbook"].compact.join(" :: ") %></title>
|
24
34
|
</head>
|
25
|
-
<body
|
35
|
+
<body>
|
36
|
+
|
26
37
|
<%= yield :body %>
|
38
|
+
|
39
|
+
<% if Rails.env.development? %>
|
40
|
+
<div id="debug-data" class="hidden" x-cloak>
|
41
|
+
<%= pretty_json(Lookbook.debug_data) %>
|
42
|
+
</div>
|
43
|
+
<% end %>
|
27
44
|
</body>
|
28
45
|
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="bg-white flex flex-col items-center justify-center h-screen w-full">
|
2
|
+
<div class="px-4 text-center max-w-sm">
|
3
|
+
<%= render_component :icon, name: :alert_triangle, size: 10, class: "text-red-300 mx-auto" %>
|
4
|
+
<div class="mt-3">
|
5
|
+
<h5 class="text-base">
|
6
|
+
<%== message %>
|
7
|
+
</h5>
|
8
|
+
<% if defined?(description) %>
|
9
|
+
<p class="mt-2 opacity-50 text-sm">
|
10
|
+
<%== description %>
|
11
|
+
</p>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
@@ -1,46 +1,46 @@
|
|
1
1
|
<%
|
2
2
|
error = error.is_a?(Lookbook::Error) ? error : Lookbook::Error.new(error)
|
3
3
|
@title = error.title
|
4
|
-
disable_header ||= false
|
5
4
|
%>
|
6
|
-
<%= component "header" unless disable_header %>
|
7
|
-
<div class="h-full w-full bg-red-50 flex flex-col border-red-300" id="error-<%= Time.now %>">
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<pre class="whitespace-pre-wrap font-sans leading-tight text-red-900"><%= error.message %></pre>
|
15
|
-
</div>
|
6
|
+
<div class="flex flex-col h-screen">
|
7
|
+
<div class="h-full bg-red-50 overflow-y-auto">
|
8
|
+
<header class="mx-8 py-6">
|
9
|
+
<h2 class="text-xl font-bold text-red-700"><%= error.title %></h2>
|
10
|
+
</header>
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
<span><%= error.file_name %></span>
|
20
|
-
<% if error.line_number %>
|
21
|
-
<span>[line <strong><%= error.line_number %></strong>]</span>
|
22
|
-
<% end %>
|
12
|
+
<div class="flex-none px-8 py-6 mb-8 border-t border-b border-red-200 bg-red-100 text-base font-mono leading-relaxed">
|
13
|
+
<pre class="whitespace-pre-wrap font-sans leading-tight text-red-900"><%= error.message %></pre>
|
23
14
|
</div>
|
24
|
-
<% end %>
|
25
15
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
16
|
+
<% if error.file_name %>
|
17
|
+
<div class="text-sm mx-8 mb-2 font-mono">
|
18
|
+
<span><%= error.file_name %></span>
|
19
|
+
<% if error.line_number %>
|
20
|
+
<span>[line <strong><%= error.line_number %></strong>]</span>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<% if error.source_code %>
|
26
|
+
<div class="mx-8 border border-red-200 max-w-screen-lg">
|
27
|
+
<%= render_component :code,
|
28
|
+
language: error.file_lang,
|
29
|
+
highlight_lines: [error.source_code[:highlighted_line]],
|
30
|
+
start_line: error.source_code[:start_line],
|
31
|
+
line_numbers: true do %><%= h(error.source_code[:code]) %><% end %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
<h3 class="font-bold mb-2 px-8 py-2 mt-8 sticky top-0 bg-red-50">Full stack trace:</h3>
|
36
|
+
<div class="text-xs font-mono">
|
37
|
+
<div class="px-8 pb-10 text-gray-400 leading-relaxed">
|
38
|
+
<% error.backtrace.each do |line| %>
|
39
|
+
<div class="hover:text-gray-900 transition-colors duration-100">
|
40
|
+
<%= line %>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
44
|
</div>
|
45
45
|
</div>
|
46
46
|
</div>
|
@@ -1,9 +1,14 @@
|
|
1
|
-
<div class="flex flex-col h-full w-full">
|
2
|
-
<%= component "header" %>
|
1
|
+
<div id="welcome-message" class="flex flex-col h-full w-full">
|
3
2
|
<div class="flex flex-col items-center justify-center h-full">
|
4
|
-
<div class="p-4 text-center">
|
5
|
-
<%= icon
|
6
|
-
<
|
3
|
+
<div class="p-4 text-center mx-auto">
|
4
|
+
<%= render_component :icon, name: :layers, size: 10, class: "opacity-30 mx-auto" %>
|
5
|
+
<div class="mt-6 text-base opacity-40">
|
6
|
+
<% if Lookbook.previews.any? %>
|
7
|
+
<h5>Select a preview to get started</h5>
|
8
|
+
<% else %>
|
9
|
+
<p>Create a <a href="https://viewcomponent.org/guide/previews.html" target="_blank">preview file</a> to get started.</p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
7
12
|
</div>
|
8
13
|
</div>
|
9
|
-
</div>
|
14
|
+
</div>
|
@@ -1,71 +1,43 @@
|
|
1
|
-
<div
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<div id="page-banner-<%= @page.id %>" class="flex items-center ml-auto pr-2">
|
9
|
-
<% if @previous_page %>
|
10
|
-
<a ref="header-previous-page"
|
11
|
-
href="<%= page_path @previous_page.lookup_path %>"
|
12
|
-
x-tooltip.theme.lookbook="`Previous page`"
|
13
|
-
class="flex-none p-1">
|
14
|
-
<%= icon "chevron-left", size: 4, class: "hover:text-indigo-800" %>
|
15
|
-
</a>
|
16
|
-
<% else %>
|
17
|
-
<span ref="header-previous-page" class="flex-none p-1">
|
18
|
-
<%= icon "chevron-left", size: 4, class: "opacity-20" %>
|
19
|
-
</span>
|
20
|
-
<% end %>
|
1
|
+
<div class="px-4 md:px-10 pt-8 md:pt-10 overflow-auto scroll-smooth w-full max-h-full pb-12" x-ref="scroller">
|
2
|
+
<div class="w-full max-w-3xl mx-auto h-full flex flex-col">
|
3
|
+
<% if @page.header? %>
|
4
|
+
<header class="mb-8 prose max-w-none flex-none">
|
5
|
+
<h1><%= @page.title %></h1>
|
6
|
+
</header>
|
7
|
+
<% end %>
|
21
8
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
x-tooltip.theme.lookbook="`Next page`"
|
26
|
-
class="flex-none p-1">
|
27
|
-
<%= icon "chevron-right", size: 4, class: "hover:text-indigo-800" %>
|
28
|
-
</a>
|
29
|
-
<% else %>
|
30
|
-
<span ref="header-next-page" class="flex-none p-1">
|
31
|
-
<%= icon "chevron-right", size: 4, class: "opacity-20" %>
|
32
|
-
</span>
|
33
|
-
<% end %>
|
34
|
-
</div>
|
35
|
-
<% end %>
|
36
|
-
<div class="px-4 md:px-10 w-full pt-8 md:pt-12 overflow-auto pb-10 scroll-smooth" x-ref="scroller">
|
37
|
-
<div class="w-full max-w-3xl mx-auto text-gray-600">
|
38
|
-
<% if @page.header? %>
|
39
|
-
<header id="page-header-<%= @page.id %>" class="mb-10 prose max-w-none">
|
40
|
-
<h1><%= @page.title %></h1>
|
41
|
-
</header>
|
42
|
-
<% end %>
|
43
|
-
<div id="page-main-<%= @page.id %>" data-morph-strategy="replace">
|
44
|
-
<div class="prose max-w-none prose-a:text-indigo-900">
|
45
|
-
<%= @page_content %>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
<% if @page.footer? %>
|
49
|
-
<footer id="page-footer-<%= @page.id %>" class="flex items-center justify-between border-t border-gray-300 mt-12 pt-8">
|
50
|
-
<% if @previous_page %>
|
51
|
-
<a ref="footer-previous-page"
|
52
|
-
href="<%= page_path @previous_page.lookup_path %>"
|
53
|
-
class="flex items-center flex-none">
|
54
|
-
<%= icon "arrow-left", size: 4, class: "hover:text-indigo-800" %>
|
55
|
-
<span class="ml-2 underline"><%= @previous_page.title %></span>
|
56
|
-
</a>
|
57
|
-
<% end %>
|
9
|
+
<%= render_component :prose, markdown: false, class: "max-w-none flex-none" do %>
|
10
|
+
<%= @page_content %>
|
11
|
+
<% end %>
|
58
12
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
<%= icon "arrow-right", size: 4, class: "hover:text-indigo-800" %>
|
65
|
-
</a>
|
13
|
+
<% if @page.sections.any? %>
|
14
|
+
<%= render_component :page_tabs, markdown: false do |page_tabs| %>
|
15
|
+
<% @page.sections.each do |section| %>
|
16
|
+
<% page_tabs.tab name: "page-section-#{section.name}", label: section.label do %>
|
17
|
+
<%= page_controller.render_page(section) %>
|
66
18
|
<% end %>
|
67
|
-
|
19
|
+
<% end %>
|
68
20
|
<% end %>
|
69
|
-
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% if @page.footer? && @pages.many? %>
|
24
|
+
<footer class="flex items-center justify-between border-t border-gray-300 mt-12 pt-8 pb-10 ">
|
25
|
+
<% if @previous_page %>
|
26
|
+
<a href="<%= page_path @previous_page.lookup_path %>"
|
27
|
+
class="flex items-center flex-none">
|
28
|
+
<%= render_component :icon, name: :arrow_left, size: 4, class: "hover:text-indigo-800" %>
|
29
|
+
<span class="ml-2 underline"><%= @previous_page.title %></span>
|
30
|
+
</a>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if @next_page %>
|
34
|
+
<a href="<%= page_path @next_page.lookup_path %>"
|
35
|
+
class="flex items-center flex-none ml-auto">
|
36
|
+
<span class="mr-2 underline"><%= @next_page.title %></span>
|
37
|
+
<%= render_component :icon, name: :arrow_right, size: 4, class: "hover:text-indigo-800" %>
|
38
|
+
</a>
|
39
|
+
<% end %>
|
40
|
+
</footer>
|
41
|
+
<% end %>
|
70
42
|
</div>
|
71
|
-
</div>
|
43
|
+
</div>
|
@@ -1,16 +1,14 @@
|
|
1
1
|
<% if examples.many? %>
|
2
|
+
<%# Render a group of examples %>
|
2
3
|
<% examples.each do |example| %>
|
3
4
|
<div style="all: unset; margin-bottom: 30px; display: block;">
|
4
5
|
<h6 style="all: unset; display: block; color: #999; font-family: sans-serif; font-size: 14px; margin-top: 0; margin-bottom: 10px;">
|
5
|
-
<%= example
|
6
|
+
<%= example.label %>
|
6
7
|
</h6>
|
7
|
-
<%= example
|
8
|
+
<%= example.output %>
|
8
9
|
</div>
|
9
10
|
<% end %>
|
10
11
|
<% else %>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<% if params[:lookbook_embed] == "true" %>
|
15
|
-
<script src="/lookbook-assets/js/embed.js?v=<%= Lookbook.version %>" defer></script>
|
16
|
-
<% end %>
|
12
|
+
<%# Render a single example %>
|
13
|
+
<%= examples.first.output %>
|
14
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="p-4 bg-lookbook-prose h-full">
|
2
|
+
<% if panel.content.present? %>
|
3
|
+
<%= render_component :prose, markdown: true do %>
|
4
|
+
<%== panel.content %>
|
5
|
+
<% end %>
|
6
|
+
<% else %>
|
7
|
+
<% if Rails.env.development? %>
|
8
|
+
<%= render_component :prose do %>
|
9
|
+
<em class='opacity-50'>No content has been defined for this panel.</em>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|