lookbook 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/lookbook/nav/component.rb +1 -1
- data/app/components/lookbook/nav/item/component.rb +1 -1
- data/app/components/lookbook/params/field/component.rb +1 -1
- data/app/components/lookbook/tabs/component.html.erb +1 -1
- data/app/components/lookbook/tabs/component.js +4 -0
- data/app/views/layouts/lookbook/application.html.erb +40 -37
- data/app/views/layouts/lookbook/shell.html.erb +1 -0
- data/app/views/lookbook/inspector/inputs/_toggle.html.erb +3 -3
- data/lib/lookbook/entities/collections/preview_collection.rb +8 -2
- data/lib/lookbook/entities/concerns/locatable.rb +2 -2
- data/lib/lookbook/tags/param_tag.rb +1 -1
- data/lib/lookbook/version.rb +1 -1
- data/public/lookbook-assets/js/lookbook.js +77 -76
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4165491fc6d6554857e0837049842dcbbe1d3d1e9485d53e74b96bec431b4697
|
4
|
+
data.tar.gz: 3da4d309a93c7e3ecfea782b15aa798db61a3fb3865101e44196fb3899c0fe71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 885c643078eca95f5987c43b200fb6004fb0daa7272513203c6537b9689b74ba6a52b229d431c86427a67e987d3e3999c14c709467291a28cb48dab53cb1e574
|
7
|
+
data.tar.gz: 1d2d0404c67f5bdf8fbab778e1fbcb37797c329baaa76e58bffb0f1e02de1d05a5544eced228d22ff57289a04f6ca6477c3da6175cfe7f4afd42a2f9feabbfcf
|
@@ -34,7 +34,7 @@ module Lookbook
|
|
34
34
|
value: param.value,
|
35
35
|
value_type: param.value_type,
|
36
36
|
value_default: param.value_default,
|
37
|
-
input_options: input_options.except(:choices),
|
37
|
+
input_options: input_options.except(:choices, :opts),
|
38
38
|
choices: input_options[:choices])
|
39
39
|
end
|
40
40
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%= lookbook_render :button, icon: :menu, class: "-ml-3", "x-show": "visibleTabsCount === 0" %>
|
14
14
|
</div>
|
15
15
|
<div class="hidden">
|
16
|
-
<div x-ref="tabsDropdown"
|
16
|
+
<div x-ref="tabsDropdown" x-cloak>
|
17
17
|
<%= safe_join(dropdown_tabs) %>
|
18
18
|
</div>
|
19
19
|
</div>
|
@@ -33,6 +33,10 @@ export default function tabsComponent(store) {
|
|
33
33
|
|
34
34
|
init() {
|
35
35
|
this.$nextTick(() => {
|
36
|
+
if (this.$root.parentElement.offsetWidth === this.$root.offsetWidth) {
|
37
|
+
this.visibleTabsCount = this.tabs.length;
|
38
|
+
}
|
39
|
+
|
36
40
|
dropdown = tippy(this.$refs.dropdownTrigger, {
|
37
41
|
content: this.$refs.tabsDropdown,
|
38
42
|
theme: "menu",
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<% content_for :shell do %>
|
2
2
|
<% if @previews.any? || @pages.any? %>
|
3
|
+
|
3
4
|
<%= lookbook_render :split_layout,
|
4
5
|
alpine_data: "$store.layout.main",
|
5
6
|
":class": "$store.layout.mobile && '!block'" do |layout| %>
|
@@ -12,49 +13,50 @@
|
|
12
13
|
}",
|
13
14
|
"@click.outside": "closeMobileSidebar",
|
14
15
|
cloak: true do %>
|
16
|
+
<% cache 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| %>
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<% group.button icon: :minus_square,
|
33
|
-
tooltip: "Collapse all",
|
34
|
-
"@click": "closeAll" %>
|
21
|
+
<% if @previews.any? %>
|
22
|
+
<% layout.pane class: "overflow-hidden" do %>
|
23
|
+
<%= lookbook_render :nav,
|
24
|
+
id: "previews-nav",
|
25
|
+
tree: @previews.to_tree,
|
26
|
+
alpine_data: "$store.nav.previews" do |nav| %>
|
27
|
+
<%= nav.toolbar do |toolbar| %>
|
28
|
+
<% toolbar.section padded: true do %>
|
29
|
+
<h4 class="pt-1">Previews</h4>
|
30
|
+
<% end %>
|
31
|
+
<% toolbar.section align: :right, padded: false do %>
|
32
|
+
<%= lookbook_render :button_group, size: :xs do |group| %>
|
33
|
+
<% group.button icon: :minus_square,
|
34
|
+
tooltip: "Collapse all",
|
35
|
+
"@click": "closeAll" %>
|
36
|
+
<% end %>
|
35
37
|
<% end %>
|
36
38
|
<% end %>
|
39
|
+
<% nav.filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name…" %>
|
37
40
|
<% end %>
|
38
|
-
<% nav.filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name…" %>
|
39
41
|
<% end %>
|
40
42
|
<% end %>
|
41
|
-
<% end %>
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
44
|
+
<% if @pages.any? %>
|
45
|
+
<% layout.pane class: "overflow-hidden" do %>
|
46
|
+
<%= lookbook_render :nav,
|
47
|
+
id: "pages-nav",
|
48
|
+
tree: @pages.to_tree,
|
49
|
+
alpine_data: "$store.nav.pages" do |nav| %>
|
50
|
+
<%= nav.toolbar do |toolbar| %>
|
51
|
+
<% toolbar.section padded: true do %>
|
52
|
+
<h4 class="pt-1">Pages</h4>
|
53
|
+
<% end %>
|
54
|
+
<% toolbar.section align: :right, padded: false do %>
|
55
|
+
<%= lookbook_render :button_group, size: :xs do |group| %>
|
56
|
+
<% group.button icon: :minus_square,
|
57
|
+
tooltip: "Collapse all",
|
58
|
+
"@click": "closeAll" %>
|
59
|
+
<% end %>
|
58
60
|
<% end %>
|
59
61
|
<% end %>
|
60
62
|
<% end %>
|
@@ -68,6 +70,7 @@
|
|
68
70
|
<%= content_for?(:main) ? yield(:main) : yield %>
|
69
71
|
<% end %>
|
70
72
|
<% end %>
|
73
|
+
|
71
74
|
<% else %>
|
72
75
|
<div id="app-main" class="w-screen h-full overflow-hidden">
|
73
76
|
<%= content_for?(:main) ? yield(:main) : yield %>
|
@@ -76,4 +79,4 @@
|
|
76
79
|
<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>
|
77
80
|
<% end %>
|
78
81
|
|
79
|
-
<%= render template: "layouts/lookbook/shell" %>
|
82
|
+
<%= render template: "layouts/lookbook/shell" %>
|
@@ -11,10 +11,10 @@ span_classes = [
|
|
11
11
|
]
|
12
12
|
%>
|
13
13
|
|
14
|
-
<%=
|
14
|
+
<%= tag.button **input_options,
|
15
15
|
class: class_names(button_classes),
|
16
16
|
role: "switch",
|
17
17
|
type: "button",
|
18
|
-
"@click.stop": "value = value == 'true' ? 'false' : 'true'" do %>
|
18
|
+
"@click.stop": "value = value == 'true' ? 'false' : 'true'", escape: false do %>
|
19
19
|
<%= tag.span "aria-hidden": true, class: class_names(span_classes) %>
|
20
|
-
<% end %>
|
20
|
+
<% end %>
|
@@ -20,12 +20,18 @@ module Lookbook
|
|
20
20
|
|
21
21
|
def self.preview_from_code_object(code_object)
|
22
22
|
klass = code_object.path.constantize
|
23
|
-
Preview.new(code_object) if
|
23
|
+
Preview.new(code_object) if preview_class?(klass)
|
24
24
|
rescue => exception
|
25
|
-
Lookbook.logger.error
|
25
|
+
Lookbook.logger.error exception.to_s
|
26
26
|
nil
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.preview_class?(klass)
|
30
|
+
if klass.ancestors.include?(ViewComponent::Preview)
|
31
|
+
!klass.respond_to?(:abstract_class) || klass.abstract_class != true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
protected
|
30
36
|
|
31
37
|
def examples
|
@@ -65,8 +65,8 @@ module Lookbook
|
|
65
65
|
def base_directory
|
66
66
|
return @_base_directory if @_base_directory
|
67
67
|
|
68
|
-
directories =
|
69
|
-
@_base_directory ||= directories.
|
68
|
+
directories = Array(base_directories).map(&:to_s).sort_by { |path| path.split("/").size }.reverse
|
69
|
+
@_base_directory ||= directories.find { |dir| file_path.to_s.start_with?(dir) }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
data/lib/lookbook/version.rb
CHANGED
@@ -7705,7 +7705,7 @@ function $5439cede634b2921$var$toCamel(s) {
|
|
7705
7705
|
}
|
7706
7706
|
|
7707
7707
|
|
7708
|
-
var $
|
7708
|
+
var $368fec5c8619cf6d$exports = {};
|
7709
7709
|
var $cbd28b10fa9798c7$exports = {};
|
7710
7710
|
|
7711
7711
|
$parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
|
@@ -11228,16 +11228,6 @@ function $cbd28b10fa9798c7$export$2e2bcd8739ae039() {
|
|
11228
11228
|
}
|
11229
11229
|
|
11230
11230
|
|
11231
|
-
var $99486586f6691564$exports = {};
|
11232
|
-
|
11233
|
-
$parcel$defineInteropFlag($99486586f6691564$exports);
|
11234
|
-
|
11235
|
-
$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
|
11236
|
-
function $99486586f6691564$export$2e2bcd8739ae039() {
|
11237
|
-
return {};
|
11238
|
-
}
|
11239
|
-
|
11240
|
-
|
11241
11231
|
var $47a1c62621be0c54$exports = {};
|
11242
11232
|
|
11243
11233
|
$parcel$defineInteropFlag($47a1c62621be0c54$exports);
|
@@ -11327,28 +11317,13 @@ function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
|
|
11327
11317
|
}
|
11328
11318
|
|
11329
11319
|
|
11330
|
-
var $
|
11320
|
+
var $99486586f6691564$exports = {};
|
11331
11321
|
|
11332
|
-
$parcel$defineInteropFlag($
|
11322
|
+
$parcel$defineInteropFlag($99486586f6691564$exports);
|
11333
11323
|
|
11334
|
-
$parcel$export($
|
11335
|
-
function $
|
11336
|
-
return {
|
11337
|
-
focussed: false,
|
11338
|
-
get active () {
|
11339
|
-
return store.active;
|
11340
|
-
},
|
11341
|
-
get text () {
|
11342
|
-
return store.text;
|
11343
|
-
},
|
11344
|
-
clear () {
|
11345
|
-
if (store.raw === "") this.$refs.input.blur();
|
11346
|
-
else store.raw = "";
|
11347
|
-
},
|
11348
|
-
focus () {
|
11349
|
-
this.$refs.input.focus();
|
11350
|
-
}
|
11351
|
-
};
|
11324
|
+
$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
|
11325
|
+
function $99486586f6691564$export$2e2bcd8739ae039() {
|
11326
|
+
return {};
|
11352
11327
|
}
|
11353
11328
|
|
11354
11329
|
|
@@ -12226,6 +12201,43 @@ function $e1f51f020443edd4$export$2e2bcd8739ae039(id, embedStore) {
|
|
12226
12201
|
}
|
12227
12202
|
|
12228
12203
|
|
12204
|
+
var $e9904a14dabf652d$exports = {};
|
12205
|
+
|
12206
|
+
$parcel$defineInteropFlag($e9904a14dabf652d$exports);
|
12207
|
+
|
12208
|
+
$parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
|
12209
|
+
function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
|
12210
|
+
return {
|
12211
|
+
focussed: false,
|
12212
|
+
get active () {
|
12213
|
+
return store.active;
|
12214
|
+
},
|
12215
|
+
get text () {
|
12216
|
+
return store.text;
|
12217
|
+
},
|
12218
|
+
clear () {
|
12219
|
+
if (store.raw === "") this.$refs.input.blur();
|
12220
|
+
else store.raw = "";
|
12221
|
+
},
|
12222
|
+
focus () {
|
12223
|
+
this.$refs.input.focus();
|
12224
|
+
}
|
12225
|
+
};
|
12226
|
+
}
|
12227
|
+
|
12228
|
+
|
12229
|
+
var $36506012e0c6e9e3$exports = {};
|
12230
|
+
|
12231
|
+
$parcel$defineInteropFlag($36506012e0c6e9e3$exports);
|
12232
|
+
|
12233
|
+
$parcel$export($36506012e0c6e9e3$exports, "default", () => $36506012e0c6e9e3$export$2e2bcd8739ae039);
|
12234
|
+
function $36506012e0c6e9e3$export$2e2bcd8739ae039(iconName) {
|
12235
|
+
return {
|
12236
|
+
iconName: iconName
|
12237
|
+
};
|
12238
|
+
}
|
12239
|
+
|
12240
|
+
|
12229
12241
|
var $d92d9d5253f84566$exports = {};
|
12230
12242
|
|
12231
12243
|
$parcel$defineInteropFlag($d92d9d5253f84566$exports);
|
@@ -12270,18 +12282,6 @@ function $d92d9d5253f84566$export$2e2bcd8739ae039(store) {
|
|
12270
12282
|
}
|
12271
12283
|
|
12272
12284
|
|
12273
|
-
var $36506012e0c6e9e3$exports = {};
|
12274
|
-
|
12275
|
-
$parcel$defineInteropFlag($36506012e0c6e9e3$exports);
|
12276
|
-
|
12277
|
-
$parcel$export($36506012e0c6e9e3$exports, "default", () => $36506012e0c6e9e3$export$2e2bcd8739ae039);
|
12278
|
-
function $36506012e0c6e9e3$export$2e2bcd8739ae039(iconName) {
|
12279
|
-
return {
|
12280
|
-
iconName: iconName
|
12281
|
-
};
|
12282
|
-
}
|
12283
|
-
|
12284
|
-
|
12285
12285
|
var $506dabb2bf255b38$exports = {};
|
12286
12286
|
|
12287
12287
|
$parcel$defineInteropFlag($506dabb2bf255b38$exports);
|
@@ -12832,6 +12832,33 @@ function $506dabb2bf255b38$var$sizeSplits(sizes) {
|
|
12832
12832
|
}
|
12833
12833
|
|
12834
12834
|
|
12835
|
+
var $a87dacf5139b5e2f$exports = {};
|
12836
|
+
|
12837
|
+
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
12838
|
+
|
12839
|
+
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
12840
|
+
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
12841
|
+
return {
|
12842
|
+
get store () {
|
12843
|
+
return store || this;
|
12844
|
+
},
|
12845
|
+
get id () {
|
12846
|
+
return this.$root.id;
|
12847
|
+
},
|
12848
|
+
get panels () {
|
12849
|
+
return Array.from(this.$refs.panels.children);
|
12850
|
+
},
|
12851
|
+
isActive (el) {
|
12852
|
+
return this.store.activeTab === this._getRef(el);
|
12853
|
+
},
|
12854
|
+
// protected
|
12855
|
+
_getRef (el) {
|
12856
|
+
return el.getAttribute("x-ref");
|
12857
|
+
}
|
12858
|
+
};
|
12859
|
+
}
|
12860
|
+
|
12861
|
+
|
12835
12862
|
var $0db07828cadc68e0$exports = {};
|
12836
12863
|
|
12837
12864
|
$parcel$defineInteropFlag($0db07828cadc68e0$exports);
|
@@ -12863,6 +12890,7 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
12863
12890
|
},
|
12864
12891
|
init () {
|
12865
12892
|
this.$nextTick(()=>{
|
12893
|
+
if (this.$root.parentElement.offsetWidth === this.$root.offsetWidth) this.visibleTabsCount = this.tabs.length;
|
12866
12894
|
dropdown = (0, $d6f449055c23f07a$export$2e2bcd8739ae039)(this.$refs.dropdownTrigger, {
|
12867
12895
|
content: this.$refs.tabsDropdown,
|
12868
12896
|
theme: "menu",
|
@@ -12924,33 +12952,6 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
12924
12952
|
}
|
12925
12953
|
|
12926
12954
|
|
12927
|
-
var $a87dacf5139b5e2f$exports = {};
|
12928
|
-
|
12929
|
-
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
12930
|
-
|
12931
|
-
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
12932
|
-
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
12933
|
-
return {
|
12934
|
-
get store () {
|
12935
|
-
return store || this;
|
12936
|
-
},
|
12937
|
-
get id () {
|
12938
|
-
return this.$root.id;
|
12939
|
-
},
|
12940
|
-
get panels () {
|
12941
|
-
return Array.from(this.$refs.panels.children);
|
12942
|
-
},
|
12943
|
-
isActive (el) {
|
12944
|
-
return this.store.activeTab === this._getRef(el);
|
12945
|
-
},
|
12946
|
-
// protected
|
12947
|
-
_getRef (el) {
|
12948
|
-
return el.getAttribute("x-ref");
|
12949
|
-
}
|
12950
|
-
};
|
12951
|
-
}
|
12952
|
-
|
12953
|
-
|
12954
12955
|
var $6d64716f0b34fdf4$exports = {};
|
12955
12956
|
|
12956
12957
|
$parcel$defineInteropFlag($6d64716f0b34fdf4$exports);
|
@@ -13078,18 +13079,18 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
|
|
13078
13079
|
}
|
13079
13080
|
|
13080
13081
|
|
13081
|
-
$
|
13082
|
+
$368fec5c8619cf6d$exports = {
|
13082
13083
|
"button": $cbd28b10fa9798c7$exports,
|
13083
|
-
"code": $99486586f6691564$exports,
|
13084
13084
|
"copy_button": $47a1c62621be0c54$exports,
|
13085
13085
|
"dimensions_display": $e398acaded942bbe$exports,
|
13086
|
-
"
|
13086
|
+
"code": $99486586f6691564$exports,
|
13087
13087
|
"embed": $e1f51f020443edd4$exports,
|
13088
|
-
"
|
13088
|
+
"filter": $e9904a14dabf652d$exports,
|
13089
13089
|
"icon": $36506012e0c6e9e3$exports,
|
13090
|
+
"nav": $d92d9d5253f84566$exports,
|
13090
13091
|
"split_layout": $506dabb2bf255b38$exports,
|
13091
|
-
"tabs": $0db07828cadc68e0$exports,
|
13092
13092
|
"tab_panels": $a87dacf5139b5e2f$exports,
|
13093
|
+
"tabs": $0db07828cadc68e0$exports,
|
13093
13094
|
"viewport": $6d64716f0b34fdf4$exports
|
13094
13095
|
};
|
13095
13096
|
|
@@ -13379,7 +13380,7 @@ const $d73574cc5e9b9e72$var$prefix = window.APP_NAME;
|
|
13379
13380
|
// Components
|
13380
13381
|
(0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
|
13381
13382
|
[
|
13382
|
-
$
|
13383
|
+
$368fec5c8619cf6d$exports,
|
13383
13384
|
$fe98e3f2bf49b28f$exports,
|
13384
13385
|
$6c10158820e535ef$exports
|
13385
13386
|
].forEach((scripts)=>{
|