lookbook 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ae06feed05c93167f7523cb9c1fdbb92c64798dc157dbf09ccb0ade667b046c
4
- data.tar.gz: c75a7391326d4683213b092436d4d60f2e48f6bcedd887c8e35ccba734662e1c
3
+ metadata.gz: 95694c758af19ee6a561b2aedfee93d932c663f7027471204da2dce393052a5a
4
+ data.tar.gz: 1b4f3e4af714af47b6719cbbef7a861ad0ca2341089e2689ef8ed80b9a745867
5
5
  SHA512:
6
- metadata.gz: 5aba929ec53db1f610de4c4d0cac1efa5c5e1461e164ae84eb28b93aad3aefaef7b3c5266757e82f92abf3e345a3653f078d42392b3fdb5660cfb62ee77116d8
7
- data.tar.gz: 42ca7a2a131ec4c4fec4d17ffb9bcccf5ca840684e238531c0629985ad7dc1e2b093d77ac2601b308f21e09b2ad6a4ad92a1acd8dfd2b142c76b3ed320c2f6d1
6
+ metadata.gz: 0a148ae5b71546463c003244040e54de07106db6f927e61b77ff35c92d524f37ed59e53646833675a8d1c399968904ffe41891817e85628aa8da879af8aa3bd8
7
+ data.tar.gz: ee91d909da4634558dbf542802ee770c921f0dfdec0bdc37592977b082a97705957bf7e19cf5168b599e78dca1f5d4222147417262c4b41f90b305a43c2c4f72
@@ -24,6 +24,7 @@ module Lookbook
24
24
  preview_display_params: {},
25
25
  preview_srcdoc: nil,
26
26
  preview_tags: {},
27
+ preview_disable_action_view_annotations: true,
27
28
  sort_examples: false,
28
29
 
29
30
  listen: Rails.env.development?,
@@ -174,7 +174,7 @@ module Lookbook
174
174
  end
175
175
 
176
176
  def websocket_mount_path
177
- "#{mounted_path}#{config.lookbook.cable_mount_path}" if websocket?
177
+ "#{mounted_path}#{config.lookbook.cable_mount_path}".gsub("//", "/") if websocket?
178
178
  end
179
179
 
180
180
  def websocket?
@@ -11,7 +11,10 @@ module Lookbook
11
11
  opts = {}
12
12
  opts[:layout] = nil
13
13
  opts[:locals] = locals if locals.present?
14
- render html: render_to_string(template, **opts)
14
+
15
+ with_optional_annotations do
16
+ render html: render_to_string(template, **opts)
17
+ end
15
18
  end
16
19
 
17
20
  def render_in_layout_to_string(template, locals, opts = {})
@@ -22,5 +25,20 @@ module Lookbook
22
25
  end
23
26
  render html: html
24
27
  end
28
+
29
+ def with_optional_annotations
30
+ if ActionView::Base.respond_to?(:annotate_rendered_view_with_filenames) && Lookbook.config.preview_disable_action_view_annotations
31
+ original_value = ActionView::Base.annotate_rendered_view_with_filenames
32
+ ActionView::Base.annotate_rendered_view_with_filenames = false
33
+
34
+ res = yield
35
+
36
+ ActionView::Base.annotate_rendered_view_with_filenames = original_value
37
+
38
+ res
39
+ else
40
+ yield
41
+ end
42
+ end
25
43
  end
26
44
  end
@@ -27,7 +27,7 @@ module Lookbook
27
27
  end
28
28
 
29
29
  def method_source
30
- @example_inspector.source.split("\n")[1..-2].join("\n").strip_heredoc
30
+ @example_inspector.source.sub(/^def \w+\s?(\([^)]+\))?/m, "").split("\n")[0..-2].join("\n").strip_heredoc.strip
31
31
  end
32
32
 
33
33
  def lang
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -7755,7 +7755,7 @@ function $5439cede634b2921$var$toCamel(s) {
7755
7755
  }
7756
7756
 
7757
7757
 
7758
- var $1c9a2bdb939ee07b$exports = {};
7758
+ var $5a1160331e703b26$exports = {};
7759
7759
  var $cbd28b10fa9798c7$exports = {};
7760
7760
 
7761
7761
  $parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
@@ -11507,6 +11507,31 @@ function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
11507
11507
  }
11508
11508
 
11509
11509
 
11510
+ var $e9904a14dabf652d$exports = {};
11511
+
11512
+ $parcel$defineInteropFlag($e9904a14dabf652d$exports);
11513
+
11514
+ $parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
11515
+ function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
11516
+ return {
11517
+ focussed: false,
11518
+ get active () {
11519
+ return store.active;
11520
+ },
11521
+ get text () {
11522
+ return store.text;
11523
+ },
11524
+ clear () {
11525
+ if (store.raw === "") this.$refs.input.blur();
11526
+ else store.raw = "";
11527
+ },
11528
+ focus () {
11529
+ this.$refs.input.focus();
11530
+ }
11531
+ };
11532
+ }
11533
+
11534
+
11510
11535
  var $e1f51f020443edd4$exports = {};
11511
11536
 
11512
11537
  $parcel$defineInteropFlag($e1f51f020443edd4$exports);
@@ -12372,31 +12397,6 @@ function $e1f51f020443edd4$export$2e2bcd8739ae039(id, embedStore) {
12372
12397
  }
12373
12398
 
12374
12399
 
12375
- var $e9904a14dabf652d$exports = {};
12376
-
12377
- $parcel$defineInteropFlag($e9904a14dabf652d$exports);
12378
-
12379
- $parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
12380
- function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
12381
- return {
12382
- focussed: false,
12383
- get active () {
12384
- return store.active;
12385
- },
12386
- get text () {
12387
- return store.text;
12388
- },
12389
- clear () {
12390
- if (store.raw === "") this.$refs.input.blur();
12391
- else store.raw = "";
12392
- },
12393
- focus () {
12394
- this.$refs.input.focus();
12395
- }
12396
- };
12397
- }
12398
-
12399
-
12400
12400
  var $36506012e0c6e9e3$exports = {};
12401
12401
 
12402
12402
  $parcel$defineInteropFlag($36506012e0c6e9e3$exports);
@@ -13045,6 +13045,98 @@ function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
13045
13045
  }
13046
13046
 
13047
13047
 
13048
+ var $0db07828cadc68e0$exports = {};
13049
+
13050
+ $parcel$defineInteropFlag($0db07828cadc68e0$exports);
13051
+
13052
+ $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$export$2e2bcd8739ae039);
13053
+
13054
+
13055
+
13056
+
13057
+ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13058
+ const initial1 = store ? store.activeTab : null;
13059
+ let dropdown = null;
13060
+ return {
13061
+ visibleTabsCount: 0,
13062
+ triggerLeft: 0,
13063
+ get store () {
13064
+ return store || this;
13065
+ },
13066
+ get tabs () {
13067
+ return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
13068
+ },
13069
+ get dropdownTabs () {
13070
+ return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
13071
+ },
13072
+ get tabWidths () {
13073
+ return this.tabs.map((tab)=>(0, $e263283f97229955$export$bdf7e699b242f476)(tab, {
13074
+ includeMargins: true
13075
+ }).width);
13076
+ },
13077
+ init () {
13078
+ this.$nextTick(()=>{
13079
+ dropdown = (0, $d6f449055c23f07a$export$2e2bcd8739ae039)(this.$refs.dropdownTrigger, {
13080
+ content: this.$refs.tabsDropdown,
13081
+ theme: "menu",
13082
+ interactive: true,
13083
+ trigger: "click",
13084
+ placement: "bottom",
13085
+ appendTo: this.$root
13086
+ });
13087
+ const initialTab = initial1 ? this.tabs.find((t)=>this._getRef(t) === initial1) : this.tabs[0];
13088
+ this.selectTab(initialTab, true);
13089
+ this.parentObserver = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(this.$root.parentElement, (0, $c5d017602d25d050$export$61fc7d43ac8f84b0)(10, this.handleResize.bind(this)));
13090
+ this.$watch("visibleTabsCount", (value)=>{
13091
+ this.debug(`'#${this.$root.id}' visible tabs count:`, value);
13092
+ });
13093
+ });
13094
+ },
13095
+ handleResize ({ width: width }) {
13096
+ if (width === this._lastMeasuredWidth) return;
13097
+ if (width === this.$root.offsetWidth) {
13098
+ this.visibleTabsCount = this.tabs.length;
13099
+ return;
13100
+ }
13101
+ let sumTabWidths = 60;
13102
+ let triggerLeft = 20;
13103
+ let visibleTabsCount = 0;
13104
+ this.tabWidths.forEach((tabWidth)=>{
13105
+ sumTabWidths += tabWidth;
13106
+ if (sumTabWidths < width) {
13107
+ triggerLeft += tabWidth;
13108
+ visibleTabsCount++;
13109
+ }
13110
+ });
13111
+ this.visibleTabsCount = visibleTabsCount;
13112
+ this.triggerLeft = triggerLeft;
13113
+ this._lastMeasuredWidth = width;
13114
+ },
13115
+ selectTab (el, initial = false) {
13116
+ this.store.activeTab = this._getRef(el);
13117
+ dropdown.hide();
13118
+ if (!initial) this.$dispatch("tabs:change", {
13119
+ tabs: this
13120
+ });
13121
+ },
13122
+ isSelected (el) {
13123
+ return this.store.activeTab === this._getRef(el);
13124
+ },
13125
+ isDisabled (el) {
13126
+ return el.getAttribute("data-disabled") == "true";
13127
+ },
13128
+ hasHiddenTabs () {
13129
+ return this.visibleTabsCount < this.tabs.length;
13130
+ },
13131
+ // protected
13132
+ _lastMeasuredWidth: 0,
13133
+ _getRef (el) {
13134
+ return el ? el.getAttribute("x-ref").replace("dropdown-", "") : null;
13135
+ }
13136
+ };
13137
+ }
13138
+
13139
+
13048
13140
  var $6d64716f0b34fdf4$exports = {};
13049
13141
 
13050
13142
  $parcel$defineInteropFlag($6d64716f0b34fdf4$exports);
@@ -13172,112 +13264,20 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
13172
13264
  }
13173
13265
 
13174
13266
 
13175
- var $0db07828cadc68e0$exports = {};
13176
-
13177
- $parcel$defineInteropFlag($0db07828cadc68e0$exports);
13178
-
13179
- $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$export$2e2bcd8739ae039);
13180
-
13181
-
13182
-
13183
-
13184
- function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13185
- const initial1 = store ? store.activeTab : null;
13186
- let dropdown = null;
13187
- return {
13188
- visibleTabsCount: 0,
13189
- triggerLeft: 0,
13190
- get store () {
13191
- return store || this;
13192
- },
13193
- get tabs () {
13194
- return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
13195
- },
13196
- get dropdownTabs () {
13197
- return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
13198
- },
13199
- get tabWidths () {
13200
- return this.tabs.map((tab)=>(0, $e263283f97229955$export$bdf7e699b242f476)(tab, {
13201
- includeMargins: true
13202
- }).width);
13203
- },
13204
- init () {
13205
- this.$nextTick(()=>{
13206
- dropdown = (0, $d6f449055c23f07a$export$2e2bcd8739ae039)(this.$refs.dropdownTrigger, {
13207
- content: this.$refs.tabsDropdown,
13208
- theme: "menu",
13209
- interactive: true,
13210
- trigger: "click",
13211
- placement: "bottom",
13212
- appendTo: this.$root
13213
- });
13214
- const initialTab = initial1 ? this.tabs.find((t)=>this._getRef(t) === initial1) : this.tabs[0];
13215
- this.selectTab(initialTab, true);
13216
- this.parentObserver = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(this.$root.parentElement, (0, $c5d017602d25d050$export$61fc7d43ac8f84b0)(10, this.handleResize.bind(this)));
13217
- this.$watch("visibleTabsCount", (value)=>{
13218
- this.debug(`'#${this.$root.id}' visible tabs count:`, value);
13219
- });
13220
- });
13221
- },
13222
- handleResize ({ width: width }) {
13223
- if (width === this._lastMeasuredWidth) return;
13224
- if (width === this.$root.offsetWidth) {
13225
- this.visibleTabsCount = this.tabs.length;
13226
- return;
13227
- }
13228
- let sumTabWidths = 60;
13229
- let triggerLeft = 20;
13230
- let visibleTabsCount = 0;
13231
- this.tabWidths.forEach((tabWidth)=>{
13232
- sumTabWidths += tabWidth;
13233
- if (sumTabWidths < width) {
13234
- triggerLeft += tabWidth;
13235
- visibleTabsCount++;
13236
- }
13237
- });
13238
- this.visibleTabsCount = visibleTabsCount;
13239
- this.triggerLeft = triggerLeft;
13240
- this._lastMeasuredWidth = width;
13241
- },
13242
- selectTab (el, initial = false) {
13243
- this.store.activeTab = this._getRef(el);
13244
- dropdown.hide();
13245
- if (!initial) this.$dispatch("tabs:change", {
13246
- tabs: this
13247
- });
13248
- },
13249
- isSelected (el) {
13250
- return this.store.activeTab === this._getRef(el);
13251
- },
13252
- isDisabled (el) {
13253
- return el.getAttribute("data-disabled") == "true";
13254
- },
13255
- hasHiddenTabs () {
13256
- return this.visibleTabsCount < this.tabs.length;
13257
- },
13258
- // protected
13259
- _lastMeasuredWidth: 0,
13260
- _getRef (el) {
13261
- return el ? el.getAttribute("x-ref").replace("dropdown-", "") : null;
13262
- }
13263
- };
13264
- }
13265
-
13266
-
13267
- $1c9a2bdb939ee07b$exports = {
13267
+ $5a1160331e703b26$exports = {
13268
13268
  "button": $cbd28b10fa9798c7$exports,
13269
13269
  "code": $99486586f6691564$exports,
13270
13270
  "copy_button": $47a1c62621be0c54$exports,
13271
13271
  "dimensions_display": $e398acaded942bbe$exports,
13272
- "embed": $e1f51f020443edd4$exports,
13273
13272
  "filter": $e9904a14dabf652d$exports,
13273
+ "embed": $e1f51f020443edd4$exports,
13274
13274
  "icon": $36506012e0c6e9e3$exports,
13275
13275
  "nav": $d92d9d5253f84566$exports,
13276
13276
  "params_editor": $b63b9c6d236b3f65$exports,
13277
13277
  "split_layout": $506dabb2bf255b38$exports,
13278
13278
  "tab_panels": $a87dacf5139b5e2f$exports,
13279
- "viewport": $6d64716f0b34fdf4$exports,
13280
- "tabs": $0db07828cadc68e0$exports
13279
+ "tabs": $0db07828cadc68e0$exports,
13280
+ "viewport": $6d64716f0b34fdf4$exports
13281
13281
  };
13282
13282
 
13283
13283
 
@@ -13421,7 +13421,7 @@ const $d73574cc5e9b9e72$var$prefix = window.APP_NAME;
13421
13421
  // Components
13422
13422
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
13423
13423
  [
13424
- $1c9a2bdb939ee07b$exports,
13424
+ $5a1160331e703b26$exports,
13425
13425
  $e4eab7529959b73b$exports,
13426
13426
  $4979d2d897a1c01f$exports
13427
13427
  ].forEach((scripts)=>{