lookbook 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 060aa0a8fdc856787346c247d707f848e7e9aabdb6c19a44a50738ff6389191f
4
- data.tar.gz: d1a6b2e6c0264c3d4cafb77d2a4dfd0e899f4bcae74259a25fad5c1aa512ad2b
3
+ metadata.gz: 7ae06feed05c93167f7523cb9c1fdbb92c64798dc157dbf09ccb0ade667b046c
4
+ data.tar.gz: c75a7391326d4683213b092436d4d60f2e48f6bcedd887c8e35ccba734662e1c
5
5
  SHA512:
6
- metadata.gz: acf0e49fcdf7779e14522dc22a2e27b881e8a7432dd5153d82b5e8f2d7502f82c5c8a273738dc8c54b1162a716e4c7aaf3fd08741f16dff8a711fd551f7a867a
7
- data.tar.gz: dcd91fceaf20c470dd763fecee7bb391c80e8fde538c5b5dbbe70cfbfbdf7424b85f67baed8ecbf88f3234d0ac4422eaf8cb365ec4fd06ce186aedea70dc6ea7
6
+ metadata.gz: 5aba929ec53db1f610de4c4d0cac1efa5c5e1461e164ae84eb28b93aad3aefaef7b3c5266757e82f92abf3e345a3653f078d42392b3fdb5660cfb62ee77116d8
7
+ data.tar.gz: 42ca7a2a131ec4c4fec4d17ffb9bcccf5ca840684e238531c0629985ad7dc1e2b093d77ac2601b308f21e09b2ad6a4ad92a1acd8dfd2b142c76b3ed320c2f6d1
@@ -248,7 +248,7 @@ module Lookbook
248
248
  full_path = absolute_path(path)
249
249
  full_path if Dir.exist?(full_path)
250
250
  end.compact!
251
- paths.uniq
251
+ paths
252
252
  end
253
253
 
254
254
  def absolute_path(path)
@@ -127,12 +127,11 @@ module Lookbook
127
127
  return unless config.listen == true
128
128
  Listen.logger = Lookbook.logger
129
129
 
130
- if config.listen_paths.any?
131
- preview_listener = Listen.to(
132
- *config.listen_paths,
130
+ listen_paths = config.listen_paths.uniq
131
+ if listen_paths.any?
132
+ preview_listener = Listen.to(*listen_paths,
133
133
  only: /\.(#{config.listen_extensions.join("|")})$/,
134
- force_polling: config.listen_use_polling
135
- ) do |modified, added, removed|
134
+ force_polling: config.listen_use_polling) do |modified, added, removed|
136
135
  parser.parse do
137
136
  run_hooks(:after_change, {modified: modified, added: added, removed: removed})
138
137
  end
@@ -140,12 +139,11 @@ module Lookbook
140
139
  register_listener(preview_listener)
141
140
  end
142
141
 
143
- if config.page_paths.any?
144
- page_listener = Listen.to(
145
- *config.page_paths,
142
+ page_paths = config.page_paths.uniq
143
+ if page_paths.any?
144
+ page_listener = Listen.to(*page_paths,
146
145
  only: /\.(html.*|md.*)$/,
147
- force_polling: config.listen_use_polling
148
- ) do |modified, added, removed|
146
+ force_polling: config.listen_use_polling) do |modified, added, removed|
149
147
  changes = {modified: modified, added: added, removed: removed}
150
148
  reload_ui
151
149
  run_hooks(:after_change, changes)
@@ -157,7 +155,7 @@ module Lookbook
157
155
  def websocket
158
156
  config = Lookbook.config
159
157
  return @websocket unless @websocket.nil?
160
- return unless config.auto_refresh == true && !Rails.env.test?
158
+ return unless config.auto_refresh == true && config.listen == true && !Rails.env.test?
161
159
  Lookbook.logger.info "Initializing websocket"
162
160
 
163
161
  cable = ActionCable::Server::Configuration.new
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -7755,7 +7755,7 @@ function $5439cede634b2921$var$toCamel(s) {
7755
7755
  }
7756
7756
 
7757
7757
 
7758
- var $730b795bb0498251$exports = {};
7758
+ var $1c9a2bdb939ee07b$exports = {};
7759
7759
  var $cbd28b10fa9798c7$exports = {};
7760
7760
 
7761
7761
  $parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
@@ -13045,98 +13045,6 @@ 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
-
13140
13048
  var $6d64716f0b34fdf4$exports = {};
13141
13049
 
13142
13050
  $parcel$defineInteropFlag($6d64716f0b34fdf4$exports);
@@ -13264,62 +13172,116 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
13264
13172
  }
13265
13173
 
13266
13174
 
13267
- $730b795bb0498251$exports = {
13268
- "button": $cbd28b10fa9798c7$exports,
13269
- "code": $99486586f6691564$exports,
13270
- "copy_button": $47a1c62621be0c54$exports,
13271
- "dimensions_display": $e398acaded942bbe$exports,
13272
- "embed": $e1f51f020443edd4$exports,
13273
- "filter": $e9904a14dabf652d$exports,
13274
- "icon": $36506012e0c6e9e3$exports,
13275
- "nav": $d92d9d5253f84566$exports,
13276
- "params_editor": $b63b9c6d236b3f65$exports,
13277
- "split_layout": $506dabb2bf255b38$exports,
13278
- "tab_panels": $a87dacf5139b5e2f$exports,
13279
- "tabs": $0db07828cadc68e0$exports,
13280
- "viewport": $6d64716f0b34fdf4$exports
13281
- };
13175
+ var $0db07828cadc68e0$exports = {};
13282
13176
 
13177
+ $parcel$defineInteropFlag($0db07828cadc68e0$exports);
13283
13178
 
13284
- var $71b50ebcd41f31b8$exports = {};
13285
- var $fa8073e5be19dff9$exports = {};
13179
+ $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$export$2e2bcd8739ae039);
13286
13180
 
13287
- $parcel$defineInteropFlag($fa8073e5be19dff9$exports);
13288
13181
 
13289
- $parcel$export($fa8073e5be19dff9$exports, "default", () => $fa8073e5be19dff9$export$2e2bcd8739ae039);
13290
- function $fa8073e5be19dff9$export$2e2bcd8739ae039({ name: name , value: value }) {
13182
+
13183
+
13184
+ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13185
+ const initial1 = store ? store.activeTab : null;
13186
+ let dropdown = null;
13291
13187
  return {
13292
- name: name,
13293
- value: value,
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
+ },
13294
13204
  init () {
13295
- this.$watch("value", ()=>this.update());
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
+ });
13296
13221
  },
13297
- update () {
13298
- if (this.validate()) {
13299
- const searchParams = new URLSearchParams(window.location.search);
13300
- searchParams.set(this.name, this.value);
13301
- const path = location.href.replace(location.search, "");
13302
- this.navigateTo(`${path}?${searchParams.toString()}`);
13222
+ handleResize ({ width: width }) {
13223
+ if (width === this._lastMeasuredWidth) return;
13224
+ if (width === this.$root.offsetWidth) {
13225
+ this.visibleTabsCount = this.tabs.length;
13226
+ return;
13303
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;
13304
13241
  },
13305
- validate () {
13306
- return this.$root.reportValidity ? this.$root.reportValidity() : true;
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
+ });
13307
13248
  },
13308
- get isNarrowLayout () {
13309
- return this.narrow || false;
13249
+ isSelected (el) {
13250
+ return this.store.activeTab === this._getRef(el);
13310
13251
  },
13311
- bindings: {
13312
- input: {
13313
- [":id"]: "`param-${name}`",
13314
- ["x-ref"]: "input",
13315
- ["x-model.debounce.200"]: "value",
13316
- ["@keydown.stop"]: true
13317
- }
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;
13318
13262
  }
13319
13263
  };
13320
13264
  }
13321
13265
 
13322
13266
 
13267
+ $1c9a2bdb939ee07b$exports = {
13268
+ "button": $cbd28b10fa9798c7$exports,
13269
+ "code": $99486586f6691564$exports,
13270
+ "copy_button": $47a1c62621be0c54$exports,
13271
+ "dimensions_display": $e398acaded942bbe$exports,
13272
+ "embed": $e1f51f020443edd4$exports,
13273
+ "filter": $e9904a14dabf652d$exports,
13274
+ "icon": $36506012e0c6e9e3$exports,
13275
+ "nav": $d92d9d5253f84566$exports,
13276
+ "params_editor": $b63b9c6d236b3f65$exports,
13277
+ "split_layout": $506dabb2bf255b38$exports,
13278
+ "tab_panels": $a87dacf5139b5e2f$exports,
13279
+ "viewport": $6d64716f0b34fdf4$exports,
13280
+ "tabs": $0db07828cadc68e0$exports
13281
+ };
13282
+
13283
+
13284
+ var $e4eab7529959b73b$exports = {};
13323
13285
  var $9b24cbeb3a465447$exports = {};
13324
13286
 
13325
13287
  $parcel$defineInteropFlag($9b24cbeb3a465447$exports);
@@ -13376,12 +13338,50 @@ function $9b24cbeb3a465447$export$2e2bcd8739ae039({ id: id , matchers: matchers
13376
13338
  }
13377
13339
 
13378
13340
 
13379
- $71b50ebcd41f31b8$exports = {
13380
- "params_editor": {
13381
- "field": $fa8073e5be19dff9$exports
13382
- },
13341
+ var $fa8073e5be19dff9$exports = {};
13342
+
13343
+ $parcel$defineInteropFlag($fa8073e5be19dff9$exports);
13344
+
13345
+ $parcel$export($fa8073e5be19dff9$exports, "default", () => $fa8073e5be19dff9$export$2e2bcd8739ae039);
13346
+ function $fa8073e5be19dff9$export$2e2bcd8739ae039({ name: name , value: value }) {
13347
+ return {
13348
+ name: name,
13349
+ value: value,
13350
+ init () {
13351
+ this.$watch("value", ()=>this.update());
13352
+ },
13353
+ update () {
13354
+ if (this.validate()) {
13355
+ const searchParams = new URLSearchParams(window.location.search);
13356
+ searchParams.set(this.name, this.value);
13357
+ const path = location.href.replace(location.search, "");
13358
+ this.navigateTo(`${path}?${searchParams.toString()}`);
13359
+ }
13360
+ },
13361
+ validate () {
13362
+ return this.$root.reportValidity ? this.$root.reportValidity() : true;
13363
+ },
13364
+ get isNarrowLayout () {
13365
+ return this.narrow || false;
13366
+ },
13367
+ bindings: {
13368
+ input: {
13369
+ [":id"]: "`param-${name}`",
13370
+ ["x-ref"]: "input",
13371
+ ["x-model.debounce.200"]: "value",
13372
+ ["@keydown.stop"]: true
13373
+ }
13374
+ }
13375
+ };
13376
+ }
13377
+
13378
+
13379
+ $e4eab7529959b73b$exports = {
13383
13380
  "nav": {
13384
13381
  "item": $9b24cbeb3a465447$exports
13382
+ },
13383
+ "params_editor": {
13384
+ "field": $fa8073e5be19dff9$exports
13385
13385
  }
13386
13386
  };
13387
13387
 
@@ -13421,8 +13421,8 @@ 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
- $730b795bb0498251$exports,
13425
- $71b50ebcd41f31b8$exports,
13424
+ $1c9a2bdb939ee07b$exports,
13425
+ $e4eab7529959b73b$exports,
13426
13426
  $4979d2d897a1c01f$exports
13427
13427
  ].forEach((scripts)=>{
13428
13428
  const components1 = (0, $5439cede634b2921$export$4e811121b221213b)(scripts);