lookbook 1.0.0.beta.5 → 1.0.0.beta.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -254
- data/app/assets/lookbook/css/lookbook.css +1 -1
- data/app/assets/lookbook/css/themes/blue.css +58 -37
- data/app/assets/lookbook/css/themes/indigo.css +58 -37
- data/app/assets/lookbook/css/themes/zinc.css +58 -37
- data/app/assets/lookbook/css/tooltip.css +5 -5
- data/app/components/lookbook/base_component.rb +0 -1
- data/app/components/lookbook/button/component.html.erb +2 -2
- data/app/components/lookbook/embed/component.html.erb +5 -5
- data/app/components/lookbook/embed/component.rb +8 -0
- data/app/components/lookbook/filter/component.html.erb +1 -1
- data/app/components/lookbook/header/component.html.erb +1 -1
- data/app/components/lookbook/inspector_panel/component.css +5 -0
- data/app/components/lookbook/inspector_panel/component.html.erb +6 -0
- data/app/components/lookbook/inspector_panel/component.rb +36 -0
- data/app/components/lookbook/nav/component.rb +1 -2
- data/app/components/lookbook/nav/item/component.html.erb +1 -1
- data/app/components/lookbook/params_editor/field/component.rb +2 -1
- data/app/components/lookbook/prose/component.html.erb +1 -1
- data/app/components/lookbook/tab_panels/component.rb +1 -1
- data/app/components/lookbook/tab_panels/panel/component.rb +2 -2
- data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +1 -1
- data/app/components/lookbook/tabs/tab/component.html.erb +1 -1
- data/app/components/lookbook/tag_component.rb +1 -1
- data/app/components/lookbook/toolbar/component.html.erb +1 -1
- data/app/components/lookbook/viewport/component.css +1 -1
- data/app/components/lookbook/viewport/component.html.erb +1 -1
- data/app/controllers/lookbook/application_controller.rb +1 -1
- data/app/controllers/lookbook/pages_controller.rb +1 -0
- data/app/controllers/lookbook/previews_controller.rb +21 -9
- data/app/helpers/lookbook/application_helper.rb +9 -6
- data/app/helpers/lookbook/preview_helper.rb +2 -3
- data/app/views/layouts/lookbook/application.html.erb +1 -1
- data/app/views/layouts/lookbook/page.html.erb +2 -2
- data/app/views/layouts/lookbook/shell.html.erb +6 -0
- data/app/views/layouts/lookbook/skeleton.html.erb +15 -14
- data/app/views/lookbook/previews/panels/_content.html.erb +1 -1
- data/app/views/lookbook/previews/panels/_notes.html.erb +2 -2
- data/app/views/lookbook/previews/panels/_params.html.erb +1 -1
- data/app/views/lookbook/previews/show.html.erb +7 -5
- data/lib/lookbook/code_formatter.rb +1 -1
- data/lib/lookbook/collection.rb +1 -1
- data/lib/lookbook/component.rb +2 -3
- data/lib/lookbook/config.rb +68 -46
- data/lib/lookbook/data.rb +11 -0
- data/lib/lookbook/engine.rb +64 -68
- data/lib/lookbook/entity.rb +1 -1
- data/lib/lookbook/hooks.rb +21 -0
- data/lib/lookbook/markdown.rb +1 -1
- data/lib/lookbook/page.rb +4 -5
- data/lib/lookbook/page_section.rb +2 -4
- data/lib/lookbook/panels.rb +15 -0
- data/lib/lookbook/params.rb +12 -0
- data/lib/lookbook/parser.rb +4 -1
- data/lib/lookbook/preview.rb +9 -11
- data/lib/lookbook/preview_example.rb +1 -1
- data/lib/lookbook/preview_group.rb +8 -0
- data/lib/lookbook/source_inspector.rb +9 -0
- data/lib/lookbook/store.rb +14 -2
- data/lib/lookbook/tag.rb +112 -0
- data/lib/lookbook/tags.rb +22 -0
- data/lib/lookbook/theme.rb +38 -9
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +1 -0
- data/lib/tasks/lookbook_tasks.rake +1 -2
- data/public/lookbook-assets/css/lookbook.css +307 -150
- data/public/lookbook-assets/css/lookbook.css.map +1 -1
- data/public/lookbook-assets/css/themes/blue.css +57 -36
- data/public/lookbook-assets/css/themes/blue.css.map +1 -1
- data/public/lookbook-assets/css/themes/indigo.css +57 -36
- data/public/lookbook-assets/css/themes/indigo.css.map +1 -1
- data/public/lookbook-assets/css/themes/zinc.css +57 -36
- data/public/lookbook-assets/css/themes/zinc.css.map +1 -1
- data/public/lookbook-assets/js/embed.js +193 -193
- data/public/lookbook-assets/js/lookbook.js +1151 -1308
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +12 -4
@@ -4,23 +4,23 @@
|
|
4
4
|
.tippy-box[data-theme~="tooltip"] {
|
5
5
|
@apply text-xs opacity-90;
|
6
6
|
|
7
|
-
background-color: var(--lookbook-tooltip);
|
7
|
+
background-color: var(--lookbook-tooltip-bg);
|
8
8
|
color: var(--lookbook-tooltip-text);
|
9
9
|
|
10
10
|
&[data-placement^="top"] > .tippy-arrow::before {
|
11
|
-
border-top-color: var(--lookbook-tooltip);
|
11
|
+
border-top-color: var(--lookbook-tooltip-bg);
|
12
12
|
}
|
13
13
|
|
14
14
|
&[data-placement^="bottom"] > .tippy-arrow::before {
|
15
|
-
border-bottom-color: var(--lookbook-tooltip);
|
15
|
+
border-bottom-color: var(--lookbook-tooltip-bg);
|
16
16
|
}
|
17
17
|
|
18
18
|
&[data-placement^="left"] > .tippy-arrow::before {
|
19
|
-
border-left-color: var(--lookbook-tooltip);
|
19
|
+
border-left-color: var(--lookbook-tooltip-bg);
|
20
20
|
}
|
21
21
|
|
22
22
|
&[data-placement^="right"] > .tippy-arrow::before {
|
23
|
-
border-right-color: var(--lookbook-tooltip);
|
23
|
+
border-right-color: var(--lookbook-tooltip-bg);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= render_component_tag tag_name,
|
2
2
|
href: @href,
|
3
3
|
class: [
|
4
|
-
"block text-lookbook-button-
|
4
|
+
"block text-lookbook-icon-button-stroke focus:outline-none focus-visible:outline-none #{padding}",
|
5
5
|
{
|
6
|
-
"hover:text-lookbook-button-
|
6
|
+
"hover:text-lookbook-icon-button-stroke-hover": !@disabled,
|
7
7
|
"cursor-[not-allowed] opacity-50": @disabled
|
8
8
|
}
|
9
9
|
],
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<%= @example.preview.label %> (<%= @example.label %>)
|
8
8
|
</h3>
|
9
9
|
<% end %>
|
10
|
-
|
11
|
-
|
10
|
+
<% toolbar.section align: :right, divide: :left do %>
|
11
|
+
<%= render_component :button_group do |group| %>
|
12
12
|
<% group.button icon: :eye,
|
13
|
-
href:
|
13
|
+
href: lookbook_inspect_path(@example.path, @params),
|
14
14
|
tooltip: "View in Inspector" %>
|
15
15
|
<% group.button icon: :external_link,
|
16
|
-
href:
|
16
|
+
href: lookbook_inspect_path(@example.path, @params),
|
17
17
|
tooltip: "Open in new window",
|
18
18
|
target: "_blank" %>
|
19
19
|
<% end %>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
@viewport:resize-complete="resizeIframe"
|
29
29
|
@tabs:change.window="resizeIframe">
|
30
30
|
<%= render_component :viewport,
|
31
|
-
src:
|
31
|
+
src: lookbook_preview_path(@example.path, @params.merge(lookbook_embed: true)),
|
32
32
|
alpine_data: "store",
|
33
33
|
resize_height: false,
|
34
34
|
max_height: @max_height,
|
@@ -11,6 +11,14 @@ module Lookbook
|
|
11
11
|
|
12
12
|
protected
|
13
13
|
|
14
|
+
def lookbook_inspect_path(*args)
|
15
|
+
Lookbook::Engine.routes.url_helpers.lookbook_inspect_path(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def lookbook_preview_path(*args)
|
19
|
+
Lookbook::Engine.routes.url_helpers.lookbook_preview_path(*args)
|
20
|
+
end
|
21
|
+
|
14
22
|
def alpine_data
|
15
23
|
[@id.to_json, "$store.pages.embeds"].join(",")
|
16
24
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
@keydown.esc.stop="clear"
|
11
11
|
@keydown.f.stop.prevent.window="focus"
|
12
12
|
@keydown.stop>
|
13
|
-
<button class="text-lookbook-button-
|
13
|
+
<button class="text-lookbook-icon-button-stroke hover:text-lookbook-icon-button-stroke-hover focus:ring-0 focus:outline-none absolute top-1/2 right-3 -translate-y-1/2" @click="clear" :class="{hidden: !active}">
|
14
14
|
<%= icon :x, size: 3 %>
|
15
15
|
</button>
|
16
16
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= render_component_tag :header do %>
|
2
|
-
<%= render_component :toolbar, class: "!bg-lookbook-header !text-lookbook-header-text !border-lookbook-header-border" do |toolbar| %>
|
2
|
+
<%= render_component :toolbar, class: "!bg-lookbook-header-bg !text-lookbook-header-text !border-lookbook-header-border" do |toolbar| %>
|
3
3
|
<% toolbar.section padded: true do %>
|
4
4
|
<% if branding.present? %>
|
5
5
|
<a
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "css_parser"
|
2
|
+
|
3
|
+
module Lookbook
|
4
|
+
class InspectorPanel::Component < Lookbook::BaseComponent
|
5
|
+
attr_reader :panel_styles, :panel_html, :id
|
6
|
+
|
7
|
+
def initialize(id:, name:, system: false, **html_attrs)
|
8
|
+
@id = id
|
9
|
+
@name = name
|
10
|
+
@system = system
|
11
|
+
@panel_html = nil
|
12
|
+
@panel_styles = nil
|
13
|
+
super(**html_attrs)
|
14
|
+
end
|
15
|
+
|
16
|
+
def before_render
|
17
|
+
if @system == false
|
18
|
+
panel_dom = ::Nokogiri::HTML.fragment(content)
|
19
|
+
style_tags = panel_dom.css("style")
|
20
|
+
if style_tags.any?
|
21
|
+
css_parser = ::CssParser::Parser.new
|
22
|
+
@panel_styles = ""
|
23
|
+
style_tags.each do |style_tag|
|
24
|
+
css_parser.load_string! style_tag.text
|
25
|
+
css_parser.each_selector do |selector, declarations, specificity|
|
26
|
+
@panel_styles += "##{id} #{selector} { #{declarations} }\n"
|
27
|
+
end
|
28
|
+
style_tag.unlink
|
29
|
+
end
|
30
|
+
@panel_html = panel_dom.to_html.html_safe
|
31
|
+
end
|
32
|
+
end
|
33
|
+
@panel_html ||= content
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
size: 3,
|
17
17
|
class: "mr-1 text-lookbook-nav-toggle absolute -left-4",
|
18
18
|
"x-effect": "iconName = open ? 'chevron-down' : 'chevron-right'" if children? %>
|
19
|
-
<%= icon nav_icon, size: 3.5, class: "mr-1.5 text-lookbook-nav-icon" %>
|
19
|
+
<%= icon nav_icon, size: 3.5, class: "mr-1.5 text-lookbook-nav-icon-stroke" %>
|
20
20
|
<span><%= label %></span>
|
21
21
|
</div>
|
22
22
|
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= render_component_tag class: "prose #{size_class} text-lookbook-prose-text bg-lookbook-prose prose-a:text-lookbook-prose-link" do %>
|
1
|
+
<%= render_component_tag class: "prose #{size_class} text-lookbook-prose-text bg-lookbook-prose-bg prose-a:text-lookbook-prose-link" do %>
|
2
2
|
<%== rendered_content %>
|
3
3
|
<% end %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
}
|
9
9
|
],
|
10
10
|
":class": "{
|
11
|
-
'border-lookbook-tabs-
|
11
|
+
'border-lookbook-tabs-border-active': isSelected($el),
|
12
12
|
'border-transparent text-lookbook-tabs-text hover:text-lookbook-tabs-text-hover': !isSelected($el),
|
13
13
|
'hidden': visibleTabsCount >= #{@position}
|
14
14
|
}",
|
@@ -9,7 +9,7 @@
|
|
9
9
|
}
|
10
10
|
],
|
11
11
|
":class": "{
|
12
|
-
'border-lookbook-tabs-
|
12
|
+
'border-lookbook-tabs-border-active': isSelected($el),
|
13
13
|
'border-transparent text-lookbook-tabs-text hover:text-lookbook-tabs-text-hover': !isSelected($el),
|
14
14
|
'!text-lookbook-tabs-text-disabled': isDisabled($el),
|
15
15
|
'invisible pointer-events-none relative z-[-1]': visibleTabsCount < #{@position}
|
@@ -18,7 +18,7 @@ module Lookbook
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.escape_attribute_key
|
21
|
-
@escape_attribute_key ||= Gem::Version.new(Rails.version) < Gem::Version.new(
|
21
|
+
@escape_attribute_key ||= Gem::Version.new(Rails.version) < Gem::Version.new("6.1.5.1") ? :escape_attributes : :escape
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render_component_tag class: "h-10 border-b border-lookbook-divider w-full flex items-center text-sm flex-none bg-lookbook-toolbar" do %>
|
1
|
+
<%= render_component_tag class: "h-10 border-b border-lookbook-divider w-full flex items-center text-sm flex-none bg-lookbook-toolbar-bg" do %>
|
2
2
|
<div class="toolbar-sections flex items-stretch w-full">
|
3
3
|
<%= safe_join(sections) %>
|
4
4
|
</div>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
.resize-handle {
|
7
7
|
@apply flex items-center justify-center h-full w-full border-lookbook-divider bg-lookbook-viewport-handle hover:bg-indigo-100 hover:bg-opacity-20;
|
8
|
-
@apply text-lookbook-viewport-handle-icon hover:text-lookbook-viewport-handle-icon-hover transition select-none touch-none;
|
8
|
+
@apply text-lookbook-viewport-handle-icon-stroke hover:text-lookbook-viewport-handle-icon-stroke-hover transition select-none touch-none;
|
9
9
|
}
|
10
10
|
}
|
11
11
|
}
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<% end %>
|
35
35
|
<% if @resize_height %>
|
36
36
|
<div
|
37
|
-
class="resize-handle border-b border-l border-lookbook-divider cursor-[
|
37
|
+
class="resize-handle border-b border-l border-lookbook-divider cursor-[row-resize] <%= "border-r" unless @resize_width %>"
|
38
38
|
@pointerdown="onResizeHeightStart"
|
39
39
|
@dblclick="toggleFullHeight">
|
40
40
|
<svg class="h-4 w-4 pointer-events-none rotate-90" fill="currentColor" viewBox="0 0 24 24" >
|
@@ -47,6 +47,16 @@ module Lookbook
|
|
47
47
|
redirect_to lookbook_inspect_path params[:path]
|
48
48
|
end
|
49
49
|
|
50
|
+
# Namespaced preview helpers
|
51
|
+
|
52
|
+
def lookbook_display(key, fallback = nil)
|
53
|
+
params.dig(:lookbook, :display, key.to_sym) || fallback
|
54
|
+
end
|
55
|
+
|
56
|
+
def lookbook_data(key, fallback = nil)
|
57
|
+
Lookbook.data.get(key, fallback)
|
58
|
+
end
|
59
|
+
|
50
60
|
private
|
51
61
|
|
52
62
|
def lookup_entities
|
@@ -98,10 +108,11 @@ module Lookbook
|
|
98
108
|
preview_controller.params[param[:name]] = Lookbook::Params.cast(preview_controller.params[param[:name]], param[:type])
|
99
109
|
end
|
100
110
|
end
|
101
|
-
# set display params
|
111
|
+
# set display and data params
|
102
112
|
preview_controller.params.merge!({
|
103
113
|
lookbook: {
|
104
|
-
display: @example.display_params
|
114
|
+
display: @example.display_params,
|
115
|
+
data: Lookbook.data
|
105
116
|
}
|
106
117
|
})
|
107
118
|
end
|
@@ -119,7 +130,7 @@ module Lookbook
|
|
119
130
|
|
120
131
|
context_data = {
|
121
132
|
preview_params: preview_params,
|
122
|
-
path: params[:path]
|
133
|
+
path: params[:path]
|
123
134
|
}
|
124
135
|
|
125
136
|
example = @example
|
@@ -134,7 +145,7 @@ module Lookbook
|
|
134
145
|
output = preview_controller.process(:render_example_to_string, @preview, example.name)
|
135
146
|
source = has_template ? example.template_source(render_args[:template]) : example.method_source
|
136
147
|
source_lang = has_template ? example.template_lang(render_args[:template]) : example.lang
|
137
|
-
|
148
|
+
|
138
149
|
example.define_singleton_method(:output, proc { output })
|
139
150
|
example.define_singleton_method(:source, proc { source })
|
140
151
|
example.define_singleton_method(:source_lang, proc { source_lang })
|
@@ -145,7 +156,8 @@ module Lookbook
|
|
145
156
|
context: context_data,
|
146
157
|
preview: preview,
|
147
158
|
examples: examples,
|
148
|
-
|
159
|
+
example: example,
|
160
|
+
data: Lookbook.data,
|
149
161
|
app: Lookbook
|
150
162
|
})
|
151
163
|
end
|
@@ -158,21 +170,21 @@ module Lookbook
|
|
158
170
|
|
159
171
|
callable_data = {
|
160
172
|
name: name.to_s,
|
161
|
-
index_position: (@panels.
|
173
|
+
index_position: (@panels.count { |p| p.pane == config.pane } + 1),
|
162
174
|
**inspector_data
|
163
175
|
}
|
164
176
|
|
165
177
|
resolved_config = config_with_defaults.transform_values do |value|
|
166
|
-
value.
|
178
|
+
value.instance_of?(Proc) ? value.call(Lookbook::Store.new(callable_data)) : value
|
167
179
|
end
|
168
180
|
resolved_config[:name] = name.to_s
|
169
|
-
|
181
|
+
|
170
182
|
@panels << Lookbook::Store.new(resolved_config, deep: false)
|
171
183
|
end
|
172
184
|
|
173
185
|
@panels = @panels.select(&:show).sort_by { |p| [p.position, p.label] }
|
174
186
|
end
|
175
|
-
|
187
|
+
|
176
188
|
def main_panels
|
177
189
|
panels.select { |panel| panel.pane == :main }
|
178
190
|
end
|
@@ -4,6 +4,15 @@ module Lookbook
|
|
4
4
|
Lookbook::Engine.config.lookbook
|
5
5
|
end
|
6
6
|
|
7
|
+
def theme
|
8
|
+
Lookbook.theme
|
9
|
+
end
|
10
|
+
|
11
|
+
def asset_path(file, version: true)
|
12
|
+
path = "/lookbook-assets/#{file}".gsub("//", "/")
|
13
|
+
version ? "#{path}?v=#{Lookbook::VERSION}" : path
|
14
|
+
end
|
15
|
+
|
7
16
|
def feature_enabled?(name)
|
8
17
|
Lookbook::Features.enabled?(name)
|
9
18
|
end
|
@@ -20,11 +29,5 @@ module Lookbook
|
|
20
29
|
def generate_id(*args)
|
21
30
|
args.map { |args| args.delete_prefix("/").tr("&?=/_\-", "-") }.join("-")
|
22
31
|
end
|
23
|
-
|
24
|
-
def append_styles(&block)
|
25
|
-
content_for :styles do
|
26
|
-
capture(&block)
|
27
|
-
end
|
28
|
-
end
|
29
32
|
end
|
30
33
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
alpine_data: "$store.layout.main",
|
5
5
|
":class": "$store.layout.mobile && '!block'" do |layout| %>
|
6
6
|
|
7
|
-
<% layout.pane id: "app-sidebar", class: "flex flex-col bg-lookbook-sidebar relative translate-x-0",
|
7
|
+
<% layout.pane id: "app-sidebar", class: "flex flex-col bg-lookbook-sidebar-bg relative translate-x-0",
|
8
8
|
":class": "{
|
9
9
|
'transition': $store.layout.mobile,
|
10
10
|
'translate-x-full': $store.layout.mobile && sidebarHidden,
|
@@ -4,11 +4,11 @@
|
|
4
4
|
x-data="{}"
|
5
5
|
@navigation:complete.window="$refs.scroller.scrollTop = 0">
|
6
6
|
|
7
|
-
<div class="h-full bg-lookbook-page relative">
|
7
|
+
<div class="h-full bg-lookbook-page-bg relative">
|
8
8
|
<% unless @error %>
|
9
9
|
|
10
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>
|
11
|
+
<div class="bg-lookbook-page-bg opacity-90 absolute inset-0 w-full h-full z-0"></div>
|
12
12
|
<div class="relative z-10 flex items-center">
|
13
13
|
|
14
14
|
<% if @previous_page %>
|
@@ -7,6 +7,12 @@
|
|
7
7
|
@navigation:start="closeMobileSidebar"
|
8
8
|
class="w-screen h-screen grid grid-rows-[40px_1fr] relative">
|
9
9
|
|
10
|
+
<% if content_for? :panel_css %>
|
11
|
+
<style media="all" id="panel-styles">
|
12
|
+
<%= content_for :panel_css -%>
|
13
|
+
</style>
|
14
|
+
<% end %>
|
15
|
+
|
10
16
|
<%= render_component :header, id: "app-header", debug_menu: config.debug_menu do |header| %>
|
11
17
|
<% header.branding { config.project_name } %>
|
12
18
|
<% end %>
|
@@ -5,22 +5,24 @@
|
|
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="/
|
10
|
-
<% if @theme_overrides.present? %>
|
11
|
-
<style media="all">
|
12
|
-
<%== @theme_overrides %>
|
13
|
-
</style>
|
14
|
-
<% end %>
|
8
|
+
<link href="<%= asset_path("/css/lookbook.css") %>" rel="stylesheet">
|
9
|
+
<link href="<%= asset_path("/css/themes/#{config.ui_theme}.css") %>" rel="stylesheet">
|
15
10
|
|
16
|
-
|
11
|
+
<%- if @theme_overrides.present? %>
|
17
12
|
<style media="all">
|
18
|
-
|
13
|
+
<%== @theme_overrides %>
|
19
14
|
</style>
|
20
15
|
<% end %>
|
21
16
|
|
22
|
-
<% if config.ui_favicon
|
23
|
-
<link
|
17
|
+
<% if config.ui_favicon == true %>
|
18
|
+
<link
|
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"
|
21
|
+
media="(prefers-color-scheme: dark)">
|
22
|
+
<link
|
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"
|
25
|
+
media="(prefers-color-scheme: light)">
|
24
26
|
<% end %>
|
25
27
|
|
26
28
|
<script>
|
@@ -31,15 +33,14 @@
|
|
31
33
|
<% end %>
|
32
34
|
</script>
|
33
35
|
|
34
|
-
<script src="/
|
36
|
+
<script src="<%= asset_path("/js/lookbook.js") %>" defer></script>
|
35
37
|
<% if params[:lookbook_embed] %>
|
36
|
-
<script src="/
|
38
|
+
<script src="<%= asset_path("/js/embed.js") %>" defer></script>
|
37
39
|
<% end %>
|
38
40
|
|
39
41
|
<title><%= [@title, config.project_name || "Lookbook"].compact.join(" :: ") %></title>
|
40
42
|
</head>
|
41
43
|
<body>
|
42
|
-
|
43
44
|
<%= yield :body %>
|
44
45
|
|
45
46
|
<% if Rails.env.development? %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% items = examples.select { |example| example.notes.present? } %>
|
2
2
|
<% if items.many? %>
|
3
|
-
<div class="divide-y divide-dashed divide-lookbook-divider bg-lookbook-prose h-full w-full">
|
3
|
+
<div class="divide-y divide-dashed divide-lookbook-divider bg-lookbook-prose-bg h-full w-full">
|
4
4
|
<% items.each do |item| %>
|
5
5
|
<div class="px-4 py-6 relative">
|
6
6
|
<h6 class="italic font-mono mb-4 opacity-40">
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<% end %>
|
12
12
|
</div>
|
13
13
|
<% else %>
|
14
|
-
<div class="
|
14
|
+
<div class="px-4 py-6 bg-lookbook-prose-bg w-full h-full">
|
15
15
|
<%= render_component :prose do %>
|
16
16
|
<%== items.any? ? items.first.notes : "<em class='opacity-50'>No notes provided.</em>" %>
|
17
17
|
<% end %>
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"@click.stop": "startSpin(); $dispatch('viewport:reload'); stopSpin(500);" %>
|
39
39
|
|
40
40
|
<% group.button icon: :external_link,
|
41
|
-
href: lookbook_preview_path(@example.lookup_path),
|
41
|
+
href: lookbook_preview_path(@example.lookup_path, request.query_parameters),
|
42
42
|
tooltip: "Open preview in new window",
|
43
43
|
target: "_blank" %>
|
44
44
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
<div class="h-full relative overflow-auto">
|
56
56
|
<%= render_component :tab_panels, alpine_data: "$store.inspector.main" do |tabs| %>
|
57
57
|
<% @main_panels.each do |panel| %>
|
58
|
-
<% tabs.panel id: panel.id, name: panel.name, class:
|
58
|
+
<% tabs.panel id: panel.id, name: panel.name, class: panel.panel_classes do %>
|
59
59
|
<%= render panel.partial, **@inspector_data, panel: panel, **panel.locals %>
|
60
60
|
<% end %>
|
61
61
|
<% end %>
|
@@ -63,7 +63,7 @@
|
|
63
63
|
</div>
|
64
64
|
<% end %>
|
65
65
|
|
66
|
-
<%= layout.pane class: "flex flex-col h-full overflow-hidden bg-lookbook-drawer",
|
66
|
+
<%= layout.pane class: "flex flex-col h-full overflow-hidden bg-lookbook-drawer-bg",
|
67
67
|
"x-show": "!$store.inspector.drawer.hidden && #{@drawer_panels.any?}" do %>
|
68
68
|
|
69
69
|
<%= render_component :toolbar do |toolbar| %>
|
@@ -123,8 +123,10 @@
|
|
123
123
|
<div class="h-full overflow-auto">
|
124
124
|
<%= render_component :tab_panels, alpine_data: "$store.inspector.drawer" do |tabs| %>
|
125
125
|
<% @drawer_panels.each do |panel| %>
|
126
|
-
<% tabs.panel id: panel.id, name: panel.name, class:
|
127
|
-
<%=
|
126
|
+
<% tabs.panel id: panel.id, name: panel.name, class: panel.panel_classes do %>
|
127
|
+
<%= render_component :inspector_panel, **panel.slice(:id, :name, :system) do %>
|
128
|
+
<%= render panel.partial, **@inspector_data, panel: panel, **panel.locals %>
|
129
|
+
<% end %>
|
128
130
|
<% end %>
|
129
131
|
<% end %>
|
130
132
|
<% end %>
|
data/lib/lookbook/collection.rb
CHANGED
data/lib/lookbook/component.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
module Lookbook
|
2
2
|
class Component < Entity
|
3
|
-
|
4
3
|
attr_accessor :name
|
5
4
|
|
6
5
|
def initialize(name)
|
7
6
|
@name = name
|
8
7
|
super(path)
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
def path
|
12
11
|
name.underscore
|
13
12
|
end
|
@@ -28,4 +27,4 @@ module Lookbook
|
|
28
27
|
template_path.present?
|
29
28
|
end
|
30
29
|
end
|
31
|
-
end
|
30
|
+
end
|