lookbook 2.1.0 → 2.1.1

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: 19ab9c7f446b482d3fca35d243e8c998b2bc6eed27315b88a27e76ff0efd5da2
4
- data.tar.gz: 254235a524acd72521176f195ffb6e2ec4fa972e4590bc495aca6026366a17a3
3
+ metadata.gz: e7cfb74e7c724774d2d70e8fc27186c2238143576585b1ed8246ac323c648fcf
4
+ data.tar.gz: 6d950c9dfee26a0dc25c39a79da81db44657047db9db3dbe6c3e893da0cbdaa2
5
5
  SHA512:
6
- metadata.gz: 5c25ff635a176b8973155be10c3b5bc89dbb5a8bfd75f9427198b9ab6b1ac57fab5a85af4f6a0028c87e5600105d7cebe299997f81d3fb16a03b175424770bbd
7
- data.tar.gz: 3022e8109efafbc70e6e04fffef56694caa6b44be75edf6568c7127b51145ab110bf8baea411e869e790a11405567e3d6da436de12bcf811b076fbf543e6321b
6
+ metadata.gz: a6e2362b4cd5bfee6d80784cb1dcf01c12f954fe3573986f19b1a66538694d0613999418f19fc9235c0530d57adf9be5f0e5b47e9eaf6fcf3f3004cee65ca8c9
7
+ data.tar.gz: 6bec74bc2d847359c19454b42c25cefd0ee928a8274062dcfba5c871527a887fe67e72d527adfbba5ec2131cf4d5fdcfa91f11a325685685b394840a71680725
@@ -146,9 +146,9 @@ module Lookbook
146
146
  @_hooks ||= HookStore.new
147
147
  end
148
148
 
149
- def run_hooks(event_name, *)
149
+ def run_hooks(event_name, *args)
150
150
  hooks.for_event(event_name).each do |hook|
151
- hook.call(Lookbook, *)
151
+ hook.call(Lookbook, *args)
152
152
  end
153
153
  end
154
154
 
@@ -19,8 +19,8 @@ module Lookbook
19
19
  tag_values
20
20
  end
21
21
 
22
- def class_names(*)
23
- tokens = build_tag_values(*).flat_map { |value| value.to_s.split(/\s+/) }.uniq
22
+ def class_names(*args)
23
+ tokens = build_tag_values(*args).flat_map { |value| value.to_s.split(/\s+/) }.uniq
24
24
 
25
25
  safe_join(tokens, " ")
26
26
  end
@@ -17,8 +17,8 @@ module Lookbook
17
17
  #
18
18
  # @param name [Symbol, String] Name of the icon
19
19
  # @param opts [Hash] Options hash
20
- def icon(name, **)
21
- lookbook_render(:icon, name: name, **)
20
+ def icon(name, **opts)
21
+ lookbook_render(:icon, name: name, **opts)
22
22
  end
23
23
 
24
24
  # Display a syntax-highlighted block of code.
@@ -35,13 +35,13 @@ module Lookbook
35
35
  end
36
36
 
37
37
  # @api private
38
- def prose(**, &block)
39
- lookbook_render(:prose, **, &block)
38
+ def prose(**opts, &block)
39
+ lookbook_render(:prose, **opts, &block)
40
40
  end
41
41
 
42
42
  # @api private
43
- def lookbook_tag(tag = :div, **, &block)
44
- lookbook_render(:tag, tag: tag, **, &block)
43
+ def lookbook_tag(tag = :div, **attrs, &block)
44
+ lookbook_render(:tag, tag: tag, **attrs, &block)
45
45
  end
46
46
 
47
47
  # @api private
@@ -16,8 +16,8 @@ module Lookbook
16
16
  end
17
17
  end
18
18
 
19
- def add_input(input, *)
20
- store[normalize_name(input)] = build_config(input, *)
19
+ def add_input(input, *args)
20
+ store[normalize_name(input)] = build_config(input, *args)
21
21
  end
22
22
 
23
23
  def get_input(input)
@@ -19,11 +19,11 @@ module Lookbook
19
19
  load_config(config)
20
20
  end
21
21
 
22
- def add_panel(name, *)
22
+ def add_panel(name, *args)
23
23
  if get_panel(name)
24
24
  raise ConfigError.new("panel with name '#{name}' already exists", scope: "panels.config")
25
25
  else
26
- store[Utils.symbolize_name(name)] = build_config(name, *)
26
+ store[Utils.symbolize_name(name)] = build_config(name, *args)
27
27
  end
28
28
  end
29
29
 
@@ -1,7 +1,7 @@
1
1
  module Lookbook
2
2
  class Service
3
- def self.call(*, **, &block)
4
- new(*, **).call(&block)
3
+ def self.call(*args, **kwargs, &block)
4
+ new(*args, **kwargs).call(&block)
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -1,10 +1,10 @@
1
1
  module Lookbook
2
2
  class Websocket
3
3
  class << self
4
- def new(mount_path, **)
4
+ def new(mount_path, **kwargs)
5
5
  require_relative "cable/cable"
6
6
 
7
- Cable.new(mount_path, **)
7
+ Cable.new(mount_path, **kwargs)
8
8
  rescue LoadError
9
9
  NullWebsocket.new
10
10
  end
@@ -7874,7 +7874,7 @@ function $12b7aa006b8a97e1$var$toCamel(s) {
7874
7874
  }
7875
7875
 
7876
7876
 
7877
- var $c9dfaeb25bf110ce$exports = {};
7877
+ var $c2b461c6a9d68b2c$exports = {};
7878
7878
  var $cbd28b10fa9798c7$exports = {};
7879
7879
 
7880
7880
  $parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
@@ -11571,6 +11571,126 @@ function $d92d9d5253f84566$export$2e2bcd8739ae039(store) {
11571
11571
  }
11572
11572
 
11573
11573
 
11574
+ var $a87dacf5139b5e2f$exports = {};
11575
+
11576
+ $parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
11577
+
11578
+ $parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
11579
+ function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
11580
+ return {
11581
+ get store () {
11582
+ return store || this;
11583
+ },
11584
+ get id () {
11585
+ return this.$root.id;
11586
+ },
11587
+ get panels () {
11588
+ return Array.from(this.$refs.panels.children);
11589
+ },
11590
+ isActive (el) {
11591
+ return this.store.activeTab === this._getRef(el);
11592
+ },
11593
+ // protected
11594
+ _getRef (el) {
11595
+ return el.getAttribute("x-ref");
11596
+ }
11597
+ };
11598
+ }
11599
+
11600
+
11601
+ var $0db07828cadc68e0$exports = {};
11602
+
11603
+ $parcel$defineInteropFlag($0db07828cadc68e0$exports);
11604
+
11605
+ $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$export$2e2bcd8739ae039);
11606
+
11607
+
11608
+
11609
+
11610
+ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
11611
+ const initial = store ? store.activeTab : null;
11612
+ let dropdown = null;
11613
+ return {
11614
+ visibleTabsCount: 0,
11615
+ triggerLeft: 0,
11616
+ get store () {
11617
+ return store || this;
11618
+ },
11619
+ get tabs () {
11620
+ return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
11621
+ },
11622
+ get dropdownTabs () {
11623
+ return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
11624
+ },
11625
+ get tabWidths () {
11626
+ return this.tabs.map((tab)=>(0, $490552754c23ef6f$export$bdf7e699b242f476)(tab, {
11627
+ includeMargins: true
11628
+ }).width);
11629
+ },
11630
+ init () {
11631
+ this.$nextTick(()=>{
11632
+ if (this.$root.parentElement.offsetWidth === this.$root.offsetWidth) this.visibleTabsCount = this.tabs.length;
11633
+ dropdown = (0, $789b7d27a7c715a6$export$2e2bcd8739ae039)(this.$refs.dropdownTrigger, {
11634
+ content: this.$refs.tabsDropdown,
11635
+ theme: "menu",
11636
+ interactive: true,
11637
+ trigger: "click",
11638
+ placement: "bottom",
11639
+ appendTo: this.$root
11640
+ });
11641
+ const initialTab = initial ? this.tabs.find((t)=>this._getRef(t) === initial) : this.tabs[0];
11642
+ this.selectTab(initialTab || this.tabs[0], true);
11643
+ this.parentObserver = (0, $7ecd1fc3a6b35e5c$export$a2214cc2adb2dc44)(this.$root.parentElement, (0, $c5d017602d25d050$export$61fc7d43ac8f84b0)(10, this.handleResize.bind(this)));
11644
+ this.$watch("visibleTabsCount", (value)=>{
11645
+ this.debug(`'#${this.$root.id}' visible tabs count:`, value);
11646
+ });
11647
+ });
11648
+ },
11649
+ handleResize ({ width: width }) {
11650
+ if (width === this._lastMeasuredWidth) return;
11651
+ if (width === this.$root.offsetWidth) {
11652
+ this.visibleTabsCount = this.tabs.length;
11653
+ return;
11654
+ }
11655
+ let sumTabWidths = 60;
11656
+ let triggerLeft = 20;
11657
+ let visibleTabsCount = 0;
11658
+ this.tabWidths.forEach((tabWidth)=>{
11659
+ sumTabWidths += tabWidth;
11660
+ if (sumTabWidths < width) {
11661
+ triggerLeft += tabWidth;
11662
+ visibleTabsCount++;
11663
+ }
11664
+ });
11665
+ this.visibleTabsCount = visibleTabsCount;
11666
+ this.triggerLeft = triggerLeft;
11667
+ this._lastMeasuredWidth = width;
11668
+ },
11669
+ selectTab (el, initial = false) {
11670
+ this.store.activeTab = this._getRef(el);
11671
+ dropdown.hide();
11672
+ if (!initial) this.$dispatch("tabs:change", {
11673
+ tabs: this
11674
+ });
11675
+ },
11676
+ isSelected (el) {
11677
+ return this.store.activeTab === this._getRef(el);
11678
+ },
11679
+ isDisabled (el) {
11680
+ return el.getAttribute("data-disabled") == "true";
11681
+ },
11682
+ hasHiddenTabs () {
11683
+ return this.visibleTabsCount < this.tabs.length;
11684
+ },
11685
+ // protected
11686
+ _lastMeasuredWidth: 0,
11687
+ _getRef (el) {
11688
+ return el ? el.getAttribute("x-ref").replace("dropdown-", "") : null;
11689
+ }
11690
+ };
11691
+ }
11692
+
11693
+
11574
11694
  var $506dabb2bf255b38$exports = {};
11575
11695
 
11576
11696
  $parcel$defineInteropFlag($506dabb2bf255b38$exports);
@@ -12121,126 +12241,6 @@ function $506dabb2bf255b38$var$sizeSplits(sizes) {
12121
12241
  }
12122
12242
 
12123
12243
 
12124
- var $a87dacf5139b5e2f$exports = {};
12125
-
12126
- $parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
12127
-
12128
- $parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
12129
- function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
12130
- return {
12131
- get store () {
12132
- return store || this;
12133
- },
12134
- get id () {
12135
- return this.$root.id;
12136
- },
12137
- get panels () {
12138
- return Array.from(this.$refs.panels.children);
12139
- },
12140
- isActive (el) {
12141
- return this.store.activeTab === this._getRef(el);
12142
- },
12143
- // protected
12144
- _getRef (el) {
12145
- return el.getAttribute("x-ref");
12146
- }
12147
- };
12148
- }
12149
-
12150
-
12151
- var $0db07828cadc68e0$exports = {};
12152
-
12153
- $parcel$defineInteropFlag($0db07828cadc68e0$exports);
12154
-
12155
- $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$export$2e2bcd8739ae039);
12156
-
12157
-
12158
-
12159
-
12160
- function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
12161
- const initial = store ? store.activeTab : null;
12162
- let dropdown = null;
12163
- return {
12164
- visibleTabsCount: 0,
12165
- triggerLeft: 0,
12166
- get store () {
12167
- return store || this;
12168
- },
12169
- get tabs () {
12170
- return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
12171
- },
12172
- get dropdownTabs () {
12173
- return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
12174
- },
12175
- get tabWidths () {
12176
- return this.tabs.map((tab)=>(0, $490552754c23ef6f$export$bdf7e699b242f476)(tab, {
12177
- includeMargins: true
12178
- }).width);
12179
- },
12180
- init () {
12181
- this.$nextTick(()=>{
12182
- if (this.$root.parentElement.offsetWidth === this.$root.offsetWidth) this.visibleTabsCount = this.tabs.length;
12183
- dropdown = (0, $789b7d27a7c715a6$export$2e2bcd8739ae039)(this.$refs.dropdownTrigger, {
12184
- content: this.$refs.tabsDropdown,
12185
- theme: "menu",
12186
- interactive: true,
12187
- trigger: "click",
12188
- placement: "bottom",
12189
- appendTo: this.$root
12190
- });
12191
- const initialTab = initial ? this.tabs.find((t)=>this._getRef(t) === initial) : this.tabs[0];
12192
- this.selectTab(initialTab || this.tabs[0], true);
12193
- this.parentObserver = (0, $7ecd1fc3a6b35e5c$export$a2214cc2adb2dc44)(this.$root.parentElement, (0, $c5d017602d25d050$export$61fc7d43ac8f84b0)(10, this.handleResize.bind(this)));
12194
- this.$watch("visibleTabsCount", (value)=>{
12195
- this.debug(`'#${this.$root.id}' visible tabs count:`, value);
12196
- });
12197
- });
12198
- },
12199
- handleResize ({ width: width }) {
12200
- if (width === this._lastMeasuredWidth) return;
12201
- if (width === this.$root.offsetWidth) {
12202
- this.visibleTabsCount = this.tabs.length;
12203
- return;
12204
- }
12205
- let sumTabWidths = 60;
12206
- let triggerLeft = 20;
12207
- let visibleTabsCount = 0;
12208
- this.tabWidths.forEach((tabWidth)=>{
12209
- sumTabWidths += tabWidth;
12210
- if (sumTabWidths < width) {
12211
- triggerLeft += tabWidth;
12212
- visibleTabsCount++;
12213
- }
12214
- });
12215
- this.visibleTabsCount = visibleTabsCount;
12216
- this.triggerLeft = triggerLeft;
12217
- this._lastMeasuredWidth = width;
12218
- },
12219
- selectTab (el, initial = false) {
12220
- this.store.activeTab = this._getRef(el);
12221
- dropdown.hide();
12222
- if (!initial) this.$dispatch("tabs:change", {
12223
- tabs: this
12224
- });
12225
- },
12226
- isSelected (el) {
12227
- return this.store.activeTab === this._getRef(el);
12228
- },
12229
- isDisabled (el) {
12230
- return el.getAttribute("data-disabled") == "true";
12231
- },
12232
- hasHiddenTabs () {
12233
- return this.visibleTabsCount < this.tabs.length;
12234
- },
12235
- // protected
12236
- _lastMeasuredWidth: 0,
12237
- _getRef (el) {
12238
- return el ? el.getAttribute("x-ref").replace("dropdown-", "") : null;
12239
- }
12240
- };
12241
- }
12242
-
12243
-
12244
12244
  var $6d64716f0b34fdf4$exports = {};
12245
12245
 
12246
12246
  $parcel$defineInteropFlag($6d64716f0b34fdf4$exports);
@@ -12368,7 +12368,7 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
12368
12368
  }
12369
12369
 
12370
12370
 
12371
- $c9dfaeb25bf110ce$exports = {
12371
+ $c2b461c6a9d68b2c$exports = {
12372
12372
  "button": $cbd28b10fa9798c7$exports,
12373
12373
  "code": $99486586f6691564$exports,
12374
12374
  "copy_button": $47a1c62621be0c54$exports,
@@ -12376,14 +12376,14 @@ $c9dfaeb25bf110ce$exports = {
12376
12376
  "embed_code_dropdown": $216ef7001f59f21d$exports,
12377
12377
  "filter": $e9904a14dabf652d$exports,
12378
12378
  "nav": $d92d9d5253f84566$exports,
12379
- "split_layout": $506dabb2bf255b38$exports,
12380
12379
  "tab_panels": $a87dacf5139b5e2f$exports,
12381
12380
  "tabs": $0db07828cadc68e0$exports,
12381
+ "split_layout": $506dabb2bf255b38$exports,
12382
12382
  "viewport": $6d64716f0b34fdf4$exports
12383
12383
  };
12384
12384
 
12385
12385
 
12386
- var $6178ee12f80cbf68$exports = {};
12386
+ var $5d1c9207cb730903$exports = {};
12387
12387
  var $6a9b69d9cc7f810f$exports = {};
12388
12388
 
12389
12389
  $parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
@@ -13394,6 +13394,38 @@ function $c299e36fa9e271bc$export$2e2bcd8739ae039(id, embedStore) {
13394
13394
  }
13395
13395
 
13396
13396
 
13397
+ var $1a7a7298eec5b755$exports = {};
13398
+
13399
+ $parcel$defineInteropFlag($1a7a7298eec5b755$exports);
13400
+
13401
+ $parcel$export($1a7a7298eec5b755$exports, "default", () => $1a7a7298eec5b755$export$2e2bcd8739ae039);
13402
+
13403
+ function $1a7a7298eec5b755$export$2e2bcd8739ae039() {
13404
+ return {
13405
+ narrow: false,
13406
+ init () {
13407
+ (0, $7ecd1fc3a6b35e5c$export$a2214cc2adb2dc44)(this.$el, ({ width: width })=>{
13408
+ this.narrow = width < 500;
13409
+ });
13410
+ }
13411
+ };
13412
+ }
13413
+
13414
+
13415
+ var $e773f8ef556b41ff$exports = {};
13416
+
13417
+ $parcel$defineInteropFlag($e773f8ef556b41ff$exports);
13418
+
13419
+ $parcel$export($e773f8ef556b41ff$exports, "default", () => $e773f8ef556b41ff$export$2e2bcd8739ae039);
13420
+ function $e773f8ef556b41ff$export$2e2bcd8739ae039() {
13421
+ return {
13422
+ get isNarrowLayout () {
13423
+ return this.narrow || false;
13424
+ }
13425
+ };
13426
+ }
13427
+
13428
+
13397
13429
  var $9b24cbeb3a465447$exports = {};
13398
13430
 
13399
13431
  $parcel$defineInteropFlag($9b24cbeb3a465447$exports);
@@ -13451,51 +13483,19 @@ function $9b24cbeb3a465447$export$2e2bcd8739ae039({ id: id , matchers: matchers
13451
13483
  }
13452
13484
 
13453
13485
 
13454
- var $1a7a7298eec5b755$exports = {};
13455
-
13456
- $parcel$defineInteropFlag($1a7a7298eec5b755$exports);
13457
-
13458
- $parcel$export($1a7a7298eec5b755$exports, "default", () => $1a7a7298eec5b755$export$2e2bcd8739ae039);
13459
-
13460
- function $1a7a7298eec5b755$export$2e2bcd8739ae039() {
13461
- return {
13462
- narrow: false,
13463
- init () {
13464
- (0, $7ecd1fc3a6b35e5c$export$a2214cc2adb2dc44)(this.$el, ({ width: width })=>{
13465
- this.narrow = width < 500;
13466
- });
13467
- }
13468
- };
13469
- }
13470
-
13471
-
13472
- var $e773f8ef556b41ff$exports = {};
13473
-
13474
- $parcel$defineInteropFlag($e773f8ef556b41ff$exports);
13475
-
13476
- $parcel$export($e773f8ef556b41ff$exports, "default", () => $e773f8ef556b41ff$export$2e2bcd8739ae039);
13477
- function $e773f8ef556b41ff$export$2e2bcd8739ae039() {
13478
- return {
13479
- get isNarrowLayout () {
13480
- return this.narrow || false;
13481
- }
13482
- };
13483
- }
13484
-
13485
-
13486
- $6178ee12f80cbf68$exports = {
13486
+ $5d1c9207cb730903$exports = {
13487
13487
  "display_options": {
13488
13488
  "field": $6a9b69d9cc7f810f$exports
13489
13489
  },
13490
13490
  "embed": {
13491
13491
  "inspector": $c299e36fa9e271bc$exports
13492
13492
  },
13493
- "nav": {
13494
- "item": $9b24cbeb3a465447$exports
13495
- },
13496
13493
  "params": {
13497
13494
  "editor": $1a7a7298eec5b755$exports,
13498
13495
  "field": $e773f8ef556b41ff$exports
13496
+ },
13497
+ "nav": {
13498
+ "item": $9b24cbeb3a465447$exports
13499
13499
  }
13500
13500
  };
13501
13501
 
@@ -13563,8 +13563,8 @@ const $22969b543678f572$var$prefix = window.APP_NAME;
13563
13563
  // Components
13564
13564
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $5792afa4170ed552$export$2e2bcd8739ae039));
13565
13565
  [
13566
- $c9dfaeb25bf110ce$exports,
13567
- $6178ee12f80cbf68$exports,
13566
+ $c2b461c6a9d68b2c$exports,
13567
+ $5d1c9207cb730903$exports,
13568
13568
  $d56e5cced44001d2$exports
13569
13569
  ].forEach((scripts)=>{
13570
13570
  const components = (0, $12b7aa006b8a97e1$export$4e811121b221213b)(scripts);