lookbook 1.0.0.beta.2 → 1.0.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +180 -40
- data/app/components/lookbook/{component.rb → base_component.rb} +1 -1
- data/app/components/lookbook/button/component.rb +1 -1
- data/app/components/lookbook/button_group/component.rb +1 -1
- data/app/components/lookbook/code/component.rb +1 -1
- data/app/components/lookbook/copy_button/component.html.erb +1 -1
- data/app/components/lookbook/copy_button/component.rb +1 -1
- data/app/components/lookbook/dimensions_display/component.rb +1 -1
- data/app/components/lookbook/embed/component.html.erb +3 -2
- data/app/components/lookbook/embed/component.rb +1 -1
- data/app/components/lookbook/filter/component.html.erb +1 -1
- data/app/components/lookbook/filter/component.rb +1 -1
- data/app/components/lookbook/header/component.html.erb +5 -10
- data/app/components/lookbook/header/component.rb +1 -1
- data/app/components/lookbook/icon/component.rb +1 -1
- data/app/components/lookbook/nav/component.rb +1 -1
- data/app/components/lookbook/nav/item/component.html.erb +2 -2
- data/app/components/lookbook/nav/item/component.rb +1 -1
- data/app/components/lookbook/page_tabs/component.rb +1 -1
- data/app/components/lookbook/params_editor/component.rb +1 -1
- data/app/components/lookbook/params_editor/field/component.rb +1 -1
- data/app/components/lookbook/prose/component.rb +1 -1
- data/app/components/lookbook/split_layout/component.rb +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/component.js +6 -6
- data/app/components/lookbook/tabs/component.rb +1 -1
- data/app/components/lookbook/tabs/dropdown_tab/component.rb +1 -1
- data/app/components/lookbook/tabs/tab/component.rb +1 -1
- data/app/components/lookbook/toolbar/component.rb +1 -1
- data/app/components/lookbook/viewport/component.rb +1 -1
- data/app/controllers/lookbook/previews_controller.rb +24 -29
- data/app/helpers/lookbook/application_helper.rb +6 -0
- data/app/helpers/lookbook/component_helper.rb +4 -0
- data/app/helpers/lookbook/page_helper.rb +1 -1
- data/app/views/layouts/lookbook/application.html.erb +1 -1
- data/app/views/layouts/lookbook/shell.html.erb +1 -1
- data/app/views/layouts/lookbook/skeleton.html.erb +7 -1
- data/app/views/lookbook/404.html.erb +1 -1
- data/app/views/lookbook/index.html.erb +1 -1
- data/app/views/lookbook/pages/show.html.erb +2 -2
- data/app/views/lookbook/previews/panels/_notes.html.erb +1 -1
- data/app/views/lookbook/previews/show.html.erb +3 -3
- data/lib/lookbook/collection.rb +1 -1
- data/lib/lookbook/component.rb +31 -0
- data/lib/lookbook/config.rb +54 -9
- data/lib/lookbook/engine.rb +72 -12
- data/lib/lookbook/page.rb +2 -2
- data/lib/lookbook/parser.rb +1 -4
- data/lib/lookbook/preview.rb +24 -7
- data/lib/lookbook/preview_example.rb +1 -1
- data/lib/lookbook/source_inspector.rb +10 -0
- data/lib/lookbook/utils.rb +2 -2
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +1 -12
- data/public/lookbook-assets/js/lookbook.js +105 -104
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +3 -2
@@ -39,6 +39,16 @@ module Lookbook
|
|
39
39
|
code_object&.tag(:position)&.text&.to_i || 10000
|
40
40
|
end
|
41
41
|
|
42
|
+
def components
|
43
|
+
if code_object&.tags(:component).present?
|
44
|
+
code_object.tags(:component).map do |component|
|
45
|
+
component.text.constantize
|
46
|
+
end
|
47
|
+
else
|
48
|
+
[]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
42
52
|
def display_params
|
43
53
|
display_params = {}.with_indifferent_access
|
44
54
|
if code_object&.tags(:display).present?
|
data/lib/lookbook/utils.rb
CHANGED
@@ -16,7 +16,7 @@ module Lookbook
|
|
16
16
|
class_name(klass).to_s.chomp("ComponentPreview").chomp("Component::Preview").chomp("::Preview").chomp("Component").chomp("Preview").chomp("::")
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def preview_class_path(klass)
|
20
20
|
preview_class_basename(klass).underscore
|
21
21
|
end
|
22
22
|
|
@@ -49,7 +49,7 @@ module Lookbook
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def to_preview_path(*args)
|
52
|
-
args.flatten.map { |arg|
|
52
|
+
args.flatten.map { |arg| preview_class_path(arg) }.join("/")
|
53
53
|
end
|
54
54
|
|
55
55
|
protected
|
data/lib/lookbook/version.rb
CHANGED
data/lib/lookbook.rb
CHANGED
@@ -27,16 +27,5 @@ module Lookbook
|
|
27
27
|
autoload :Markdown, "lookbook/markdown"
|
28
28
|
autoload :Theme, "lookbook/theme"
|
29
29
|
autoload :Store, "lookbook/store"
|
30
|
-
|
31
|
-
class << self
|
32
|
-
include Utils
|
33
|
-
|
34
|
-
def previews
|
35
|
-
Preview.all
|
36
|
-
end
|
37
|
-
|
38
|
-
def pages
|
39
|
-
Page.all
|
40
|
-
end
|
41
|
-
end
|
30
|
+
autoload :Component, "lookbook/component"
|
42
31
|
end
|
@@ -7849,17 +7849,7 @@ function $5439cede634b2921$var$toCamel(s) {
|
|
7849
7849
|
}
|
7850
7850
|
|
7851
7851
|
|
7852
|
-
var $
|
7853
|
-
var $99486586f6691564$exports = {};
|
7854
|
-
|
7855
|
-
$parcel$defineInteropFlag($99486586f6691564$exports);
|
7856
|
-
|
7857
|
-
$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
|
7858
|
-
function $99486586f6691564$export$2e2bcd8739ae039() {
|
7859
|
-
return {};
|
7860
|
-
}
|
7861
|
-
|
7862
|
-
|
7852
|
+
var $e44b48ce5635d6e0$exports = {};
|
7863
7853
|
var $cbd28b10fa9798c7$exports = {};
|
7864
7854
|
|
7865
7855
|
$parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
|
@@ -11512,36 +11502,13 @@ function $cbd28b10fa9798c7$export$2e2bcd8739ae039() {
|
|
11512
11502
|
}
|
11513
11503
|
|
11514
11504
|
|
11515
|
-
var $
|
11516
|
-
|
11517
|
-
$parcel$defineInteropFlag($e398acaded942bbe$exports);
|
11505
|
+
var $99486586f6691564$exports = {};
|
11518
11506
|
|
11519
|
-
$parcel$
|
11507
|
+
$parcel$defineInteropFlag($99486586f6691564$exports);
|
11520
11508
|
|
11521
|
-
|
11522
|
-
|
11523
|
-
|
11524
|
-
height: 0,
|
11525
|
-
resizing: false,
|
11526
|
-
target: null,
|
11527
|
-
init () {
|
11528
|
-
this.target = document.querySelector(targetSelector);
|
11529
|
-
if (this.target) {
|
11530
|
-
this.width = Math.round(this.target.clientWidth);
|
11531
|
-
this.height = Math.round(this.target.clientHeight);
|
11532
|
-
this.createObserver();
|
11533
|
-
}
|
11534
|
-
},
|
11535
|
-
createObserver () {
|
11536
|
-
if (this.target) this.observer = $9930d46698775b42$export$a2214cc2adb2dc44(document.querySelector(targetSelector), ({ width: width , height: height })=>{
|
11537
|
-
this.width = width;
|
11538
|
-
this.height = height;
|
11539
|
-
});
|
11540
|
-
},
|
11541
|
-
tearDown () {
|
11542
|
-
if (this.observer) this.observer.disconnect();
|
11543
|
-
}
|
11544
|
-
};
|
11509
|
+
$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
|
11510
|
+
function $99486586f6691564$export$2e2bcd8739ae039() {
|
11511
|
+
return {};
|
11545
11512
|
}
|
11546
11513
|
|
11547
11514
|
|
@@ -11601,6 +11568,39 @@ function $47a1c62621be0c54$export$2e2bcd8739ae039() {
|
|
11601
11568
|
}
|
11602
11569
|
|
11603
11570
|
|
11571
|
+
var $e398acaded942bbe$exports = {};
|
11572
|
+
|
11573
|
+
$parcel$defineInteropFlag($e398acaded942bbe$exports);
|
11574
|
+
|
11575
|
+
$parcel$export($e398acaded942bbe$exports, "default", () => $e398acaded942bbe$export$2e2bcd8739ae039);
|
11576
|
+
|
11577
|
+
function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
|
11578
|
+
return {
|
11579
|
+
width: 0,
|
11580
|
+
height: 0,
|
11581
|
+
resizing: false,
|
11582
|
+
target: null,
|
11583
|
+
init () {
|
11584
|
+
this.target = document.querySelector(targetSelector);
|
11585
|
+
if (this.target) {
|
11586
|
+
this.width = Math.round(this.target.clientWidth);
|
11587
|
+
this.height = Math.round(this.target.clientHeight);
|
11588
|
+
this.createObserver();
|
11589
|
+
}
|
11590
|
+
},
|
11591
|
+
createObserver () {
|
11592
|
+
if (this.target) this.observer = $9930d46698775b42$export$a2214cc2adb2dc44(document.querySelector(targetSelector), ({ width: width , height: height })=>{
|
11593
|
+
this.width = width;
|
11594
|
+
this.height = height;
|
11595
|
+
});
|
11596
|
+
},
|
11597
|
+
tearDown () {
|
11598
|
+
if (this.observer) this.observer.disconnect();
|
11599
|
+
}
|
11600
|
+
};
|
11601
|
+
}
|
11602
|
+
|
11603
|
+
|
11604
11604
|
var $e1f51f020443edd4$exports = {};
|
11605
11605
|
|
11606
11606
|
$parcel$defineInteropFlag($e1f51f020443edd4$exports);
|
@@ -12466,31 +12466,6 @@ function $e1f51f020443edd4$export$2e2bcd8739ae039(id, embedStore) {
|
|
12466
12466
|
}
|
12467
12467
|
|
12468
12468
|
|
12469
|
-
var $e9904a14dabf652d$exports = {};
|
12470
|
-
|
12471
|
-
$parcel$defineInteropFlag($e9904a14dabf652d$exports);
|
12472
|
-
|
12473
|
-
$parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
|
12474
|
-
function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
|
12475
|
-
return {
|
12476
|
-
focussed: false,
|
12477
|
-
get active () {
|
12478
|
-
return store.active;
|
12479
|
-
},
|
12480
|
-
get text () {
|
12481
|
-
return store.text;
|
12482
|
-
},
|
12483
|
-
clear () {
|
12484
|
-
if (store.raw === "") this.$refs.input.blur();
|
12485
|
-
else store.raw = "";
|
12486
|
-
},
|
12487
|
-
focus () {
|
12488
|
-
this.$refs.input.focus();
|
12489
|
-
}
|
12490
|
-
};
|
12491
|
-
}
|
12492
|
-
|
12493
|
-
|
12494
12469
|
var $36506012e0c6e9e3$exports = {};
|
12495
12470
|
|
12496
12471
|
$parcel$defineInteropFlag($36506012e0c6e9e3$exports);
|
@@ -12545,6 +12520,31 @@ function $d92d9d5253f84566$export$2e2bcd8739ae039(store) {
|
|
12545
12520
|
}
|
12546
12521
|
|
12547
12522
|
|
12523
|
+
var $e9904a14dabf652d$exports = {};
|
12524
|
+
|
12525
|
+
$parcel$defineInteropFlag($e9904a14dabf652d$exports);
|
12526
|
+
|
12527
|
+
$parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
|
12528
|
+
function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
|
12529
|
+
return {
|
12530
|
+
focussed: false,
|
12531
|
+
get active () {
|
12532
|
+
return store.active;
|
12533
|
+
},
|
12534
|
+
get text () {
|
12535
|
+
return store.text;
|
12536
|
+
},
|
12537
|
+
clear () {
|
12538
|
+
if (store.raw === "") this.$refs.input.blur();
|
12539
|
+
else store.raw = "";
|
12540
|
+
},
|
12541
|
+
focus () {
|
12542
|
+
this.$refs.input.focus();
|
12543
|
+
}
|
12544
|
+
};
|
12545
|
+
}
|
12546
|
+
|
12547
|
+
|
12548
12548
|
var $b63b9c6d236b3f65$exports = {};
|
12549
12549
|
|
12550
12550
|
$parcel$defineInteropFlag($b63b9c6d236b3f65$exports);
|
@@ -12563,6 +12563,33 @@ function $b63b9c6d236b3f65$export$2e2bcd8739ae039() {
|
|
12563
12563
|
}
|
12564
12564
|
|
12565
12565
|
|
12566
|
+
var $a87dacf5139b5e2f$exports = {};
|
12567
|
+
|
12568
|
+
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
12569
|
+
|
12570
|
+
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
12571
|
+
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
12572
|
+
return {
|
12573
|
+
get store () {
|
12574
|
+
return store || this;
|
12575
|
+
},
|
12576
|
+
get id () {
|
12577
|
+
return this.$root.id;
|
12578
|
+
},
|
12579
|
+
get panels () {
|
12580
|
+
return Array.from(this.$refs.panels.children);
|
12581
|
+
},
|
12582
|
+
isActive (el) {
|
12583
|
+
return this.store.activeTab === this._getRef(el);
|
12584
|
+
},
|
12585
|
+
// protected
|
12586
|
+
_getRef (el) {
|
12587
|
+
return el.getAttribute("x-ref");
|
12588
|
+
}
|
12589
|
+
};
|
12590
|
+
}
|
12591
|
+
|
12592
|
+
|
12566
12593
|
var $506dabb2bf255b38$exports = {};
|
12567
12594
|
|
12568
12595
|
$parcel$defineInteropFlag($506dabb2bf255b38$exports);
|
@@ -13116,33 +13143,6 @@ function $506dabb2bf255b38$var$sizeSplits(sizes) {
|
|
13116
13143
|
}
|
13117
13144
|
|
13118
13145
|
|
13119
|
-
var $a87dacf5139b5e2f$exports = {};
|
13120
|
-
|
13121
|
-
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
13122
|
-
|
13123
|
-
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
13124
|
-
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
13125
|
-
return {
|
13126
|
-
get store () {
|
13127
|
-
return store || this;
|
13128
|
-
},
|
13129
|
-
get id () {
|
13130
|
-
return this.$root.id;
|
13131
|
-
},
|
13132
|
-
get panels () {
|
13133
|
-
return Array.from(this.$refs.panels.children);
|
13134
|
-
},
|
13135
|
-
isActive (el) {
|
13136
|
-
return this.store.activeTab === this._getRef(el);
|
13137
|
-
},
|
13138
|
-
// protected
|
13139
|
-
_getRef (el) {
|
13140
|
-
return el.getAttribute("x-ref");
|
13141
|
-
}
|
13142
|
-
};
|
13143
|
-
}
|
13144
|
-
|
13145
|
-
|
13146
13146
|
var $0db07828cadc68e0$exports = {};
|
13147
13147
|
|
13148
13148
|
$parcel$defineInteropFlag($0db07828cadc68e0$exports);
|
@@ -13153,7 +13153,7 @@ $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$exp
|
|
13153
13153
|
|
13154
13154
|
|
13155
13155
|
function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
13156
|
-
const
|
13156
|
+
const initial1 = store ? store.activeTab : null;
|
13157
13157
|
let dropdown = null;
|
13158
13158
|
return {
|
13159
13159
|
visibleTabsCount: 0,
|
@@ -13162,7 +13162,7 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
13162
13162
|
return store || this;
|
13163
13163
|
},
|
13164
13164
|
get tabs () {
|
13165
|
-
return Array.from(this.$refs.tabs.children);
|
13165
|
+
return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
|
13166
13166
|
},
|
13167
13167
|
get dropdownTabs () {
|
13168
13168
|
return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
|
@@ -13183,9 +13183,9 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
13183
13183
|
placement: "bottom",
|
13184
13184
|
appendTo: this.$root
|
13185
13185
|
});
|
13186
|
-
const initialTab =
|
13186
|
+
const initialTab = initial1 ? this.tabs.find((t)=>this._getRef(t) === initial1
|
13187
13187
|
) : this.tabs[0];
|
13188
|
-
this.selectTab(initialTab);
|
13188
|
+
this.selectTab(initialTab, true);
|
13189
13189
|
this.parentObserver = $9930d46698775b42$export$a2214cc2adb2dc44(this.$root.parentElement, (/*@__PURE__*/$parcel$interopDefault($d3ec6a576bb30dc9$exports))(this.handleResize.bind(this), 10));
|
13190
13190
|
this.$watch("visibleTabsCount", (value)=>{
|
13191
13191
|
this.debug(`'#${this.$root.id}' visible tabs count:`, value);
|
@@ -13195,11 +13195,9 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
13195
13195
|
handleResize ({ width: width }) {
|
13196
13196
|
if (width === this._lastMeasuredWidth) return;
|
13197
13197
|
if (width === this.$root.offsetWidth) {
|
13198
|
-
console.log("uep");
|
13199
13198
|
this.visibleTabsCount = this.tabs.length;
|
13200
13199
|
return;
|
13201
13200
|
}
|
13202
|
-
console.log(width);
|
13203
13201
|
let sumTabWidths = 60;
|
13204
13202
|
let triggerLeft = 20;
|
13205
13203
|
let visibleTabsCount = 0;
|
@@ -13214,9 +13212,12 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
13214
13212
|
this.triggerLeft = triggerLeft;
|
13215
13213
|
this._lastMeasuredWidth = width;
|
13216
13214
|
},
|
13217
|
-
selectTab (el) {
|
13215
|
+
selectTab (el, initial = false) {
|
13218
13216
|
this.store.activeTab = this._getRef(el);
|
13219
13217
|
dropdown.hide();
|
13218
|
+
if (!initial) this.$dispatch("tabs:change", {
|
13219
|
+
tabs: this
|
13220
|
+
});
|
13220
13221
|
},
|
13221
13222
|
isSelected (el) {
|
13222
13223
|
return this.store.activeTab === this._getRef(el);
|
@@ -13363,18 +13364,18 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
|
|
13363
13364
|
}
|
13364
13365
|
|
13365
13366
|
|
13366
|
-
$
|
13367
|
-
"code": $99486586f6691564$exports,
|
13367
|
+
$e44b48ce5635d6e0$exports = {
|
13368
13368
|
"button": $cbd28b10fa9798c7$exports,
|
13369
|
-
"
|
13369
|
+
"code": $99486586f6691564$exports,
|
13370
13370
|
"copy_button": $47a1c62621be0c54$exports,
|
13371
|
+
"dimensions_display": $e398acaded942bbe$exports,
|
13371
13372
|
"embed": $e1f51f020443edd4$exports,
|
13372
|
-
"filter": $e9904a14dabf652d$exports,
|
13373
13373
|
"icon": $36506012e0c6e9e3$exports,
|
13374
13374
|
"nav": $d92d9d5253f84566$exports,
|
13375
|
+
"filter": $e9904a14dabf652d$exports,
|
13375
13376
|
"params_editor": $b63b9c6d236b3f65$exports,
|
13376
|
-
"split_layout": $506dabb2bf255b38$exports,
|
13377
13377
|
"tab_panels": $a87dacf5139b5e2f$exports,
|
13378
|
+
"split_layout": $506dabb2bf255b38$exports,
|
13378
13379
|
"tabs": $0db07828cadc68e0$exports,
|
13379
13380
|
"viewport": $6d64716f0b34fdf4$exports
|
13380
13381
|
};
|
@@ -13523,7 +13524,7 @@ $caa9439642c6336c$export$2e2bcd8739ae039.store("settings", $96e0343bbb13096b$exp
|
|
13523
13524
|
// Components
|
13524
13525
|
$caa9439642c6336c$export$2e2bcd8739ae039.data("app", $d709d0f4027033b2$export$2e2bcd8739ae039);
|
13525
13526
|
[
|
13526
|
-
$
|
13527
|
+
$e44b48ce5635d6e0$exports,
|
13527
13528
|
$e4eab7529959b73b$exports,
|
13528
13529
|
$4979d2d897a1c01f$exports
|
13529
13530
|
].forEach((scripts)=>{
|