lookbook 1.0.0.beta.0 → 1.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +231 -9
  3. data/app/assets/lookbook/js/stores/inspector.js +4 -4
  4. data/app/components/lookbook/{component.rb → base_component.rb} +1 -1
  5. data/app/components/lookbook/button/component.rb +1 -1
  6. data/app/components/lookbook/button_group/component.rb +1 -1
  7. data/app/components/lookbook/code/component.rb +1 -1
  8. data/app/components/lookbook/copy_button/component.html.erb +1 -1
  9. data/app/components/lookbook/copy_button/component.rb +1 -1
  10. data/app/components/lookbook/dimensions_display/component.html.erb +2 -1
  11. data/app/components/lookbook/dimensions_display/component.js +19 -12
  12. data/app/components/lookbook/dimensions_display/component.rb +1 -1
  13. data/app/components/lookbook/embed/component.html.erb +6 -5
  14. data/app/components/lookbook/embed/component.rb +1 -1
  15. data/app/components/lookbook/filter/component.html.erb +1 -1
  16. data/app/components/lookbook/filter/component.rb +1 -1
  17. data/app/components/lookbook/header/component.html.erb +7 -12
  18. data/app/components/lookbook/header/component.rb +1 -1
  19. data/app/components/lookbook/icon/component.rb +1 -1
  20. data/app/components/lookbook/nav/component.rb +1 -1
  21. data/app/components/lookbook/nav/item/component.html.erb +2 -2
  22. data/app/components/lookbook/nav/item/component.rb +1 -1
  23. data/app/components/lookbook/page_tabs/component.html.erb +18 -0
  24. data/app/components/lookbook/page_tabs/component.rb +19 -0
  25. data/app/components/lookbook/params_editor/component.rb +1 -1
  26. data/app/components/lookbook/params_editor/field/component.rb +1 -1
  27. data/app/components/lookbook/prose/component.rb +1 -1
  28. data/app/components/lookbook/split_layout/component.rb +1 -1
  29. data/app/components/lookbook/tab_panels/component.html.erb +5 -0
  30. data/app/components/lookbook/tab_panels/component.js +25 -0
  31. data/app/components/lookbook/tab_panels/component.rb +20 -0
  32. data/app/components/lookbook/{tabbed_content/section → tab_panels/panel}/component.html.erb +2 -2
  33. data/app/components/lookbook/tab_panels/panel/component.rb +9 -0
  34. data/app/components/lookbook/tabs/component.html.erb +8 -2
  35. data/app/components/lookbook/tabs/component.js +14 -6
  36. data/app/components/lookbook/tabs/component.rb +9 -11
  37. data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +8 -2
  38. data/app/components/lookbook/tabs/dropdown_tab/component.rb +5 -4
  39. data/app/components/lookbook/tabs/tab/component.html.erb +9 -3
  40. data/app/components/lookbook/tabs/tab/component.rb +5 -4
  41. data/app/components/lookbook/toolbar/component.css +1 -1
  42. data/app/components/lookbook/toolbar/component.rb +1 -1
  43. data/app/components/lookbook/viewport/component.rb +1 -1
  44. data/app/controllers/lookbook/application_controller.rb +2 -2
  45. data/app/controllers/lookbook/pages_controller.rb +2 -1
  46. data/app/controllers/lookbook/previews_controller.rb +90 -91
  47. data/app/helpers/lookbook/application_helper.rb +8 -2
  48. data/app/helpers/lookbook/component_helper.rb +4 -0
  49. data/app/helpers/lookbook/page_helper.rb +2 -2
  50. data/app/views/layouts/lookbook/application.html.erb +1 -1
  51. data/app/views/layouts/lookbook/page.html.erb +2 -2
  52. data/app/views/layouts/lookbook/shell.html.erb +1 -1
  53. data/app/views/layouts/lookbook/skeleton.html.erb +7 -1
  54. data/app/views/lookbook/404.html.erb +1 -1
  55. data/app/views/lookbook/index.html.erb +1 -1
  56. data/app/views/lookbook/pages/show.html.erb +15 -5
  57. data/app/views/lookbook/preview.html.erb +3 -3
  58. data/app/views/lookbook/previews/panels/_content.html.erb +13 -0
  59. data/app/views/lookbook/previews/panels/_notes.html.erb +5 -5
  60. data/app/views/lookbook/previews/panels/_output.html.erb +3 -3
  61. data/app/views/lookbook/previews/panels/_params.html.erb +2 -2
  62. data/app/views/lookbook/previews/panels/_preview.html.erb +2 -2
  63. data/app/views/lookbook/previews/panels/_source.html.erb +6 -6
  64. data/app/views/lookbook/previews/show.html.erb +39 -36
  65. data/config/routes.rb +6 -6
  66. data/lib/lookbook/collection.rb +1 -1
  67. data/lib/lookbook/component.rb +31 -0
  68. data/lib/lookbook/config.rb +133 -33
  69. data/lib/lookbook/engine.rb +72 -12
  70. data/lib/lookbook/page.rb +34 -11
  71. data/lib/lookbook/page_section.rb +31 -0
  72. data/lib/lookbook/parser.rb +1 -4
  73. data/lib/lookbook/preview.rb +25 -8
  74. data/lib/lookbook/preview_example.rb +2 -2
  75. data/lib/lookbook/preview_group.rb +1 -1
  76. data/lib/lookbook/source_inspector.rb +10 -0
  77. data/lib/lookbook/store.rb +36 -0
  78. data/lib/lookbook/theme.rb +7 -0
  79. data/lib/lookbook/utils.rb +3 -3
  80. data/lib/lookbook/version.rb +1 -1
  81. data/lib/lookbook.rb +3 -12
  82. data/public/lookbook-assets/css/lookbook.css +34 -5
  83. data/public/lookbook-assets/css/lookbook.css.map +1 -1
  84. data/public/lookbook-assets/js/lookbook.js +84 -71
  85. data/public/lookbook-assets/js/lookbook.js.map +1 -1
  86. metadata +14 -8
  87. data/app/components/lookbook/tabbed_content/component.html.erb +0 -5
  88. data/app/components/lookbook/tabbed_content/component.js +0 -21
  89. data/app/components/lookbook/tabbed_content/component.rb +0 -20
  90. data/app/components/lookbook/tabbed_content/section/component.rb +0 -9
@@ -7047,10 +7047,10 @@ function $45e94a9374456304$export$2e2bcd8739ae039(Alpine, { prefix: prefix }) {
7047
7047
  function $6a63819b7ed6d0ed$export$2e2bcd8739ae039(Alpine, { prefix: prefix }) {
7048
7048
  return {
7049
7049
  minVerticalSplitWidth: 800,
7050
- preview: {
7051
- activeTab: Alpine.$persist("").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-preview-active-tab", prefix)),
7052
- width: Alpine.$persist("100%").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-preview-width", prefix)),
7053
- height: Alpine.$persist("100%").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-preview-height", prefix)),
7050
+ main: {
7051
+ activeTab: Alpine.$persist("").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-main-active-tab", prefix)),
7052
+ width: Alpine.$persist("100%").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-main-width", prefix)),
7053
+ height: Alpine.$persist("100%").as($7ae6ae39c2ec9059$export$2ce3c33e50a76e49("inspector-main-height", prefix)),
7054
7054
  lastWidth: null,
7055
7055
  lastHeight: null,
7056
7056
  resizing: false
@@ -7849,7 +7849,7 @@ function $5439cede634b2921$var$toCamel(s) {
7849
7849
  }
7850
7850
 
7851
7851
 
7852
- var $b40b0b74537cbda1$exports = {};
7852
+ var $e44b48ce5635d6e0$exports = {};
7853
7853
  var $cbd28b10fa9798c7$exports = {};
7854
7854
 
7855
7855
  $parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
@@ -11579,20 +11579,23 @@ function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
11579
11579
  width: 0,
11580
11580
  height: 0,
11581
11581
  resizing: false,
11582
+ target: null,
11582
11583
  init () {
11583
- const target = document.querySelector(targetSelector);
11584
- this.width = Math.round(target.clientWidth);
11585
- this.height = Math.round(target.clientHeight);
11586
- this.createObserver();
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
+ }
11587
11590
  },
11588
11591
  createObserver () {
11589
- this.observer = $9930d46698775b42$export$a2214cc2adb2dc44(document.querySelector(targetSelector), ({ width: width , height: height })=>{
11592
+ if (this.target) this.observer = $9930d46698775b42$export$a2214cc2adb2dc44(document.querySelector(targetSelector), ({ width: width , height: height })=>{
11590
11593
  this.width = width;
11591
11594
  this.height = height;
11592
11595
  });
11593
11596
  },
11594
11597
  tearDown () {
11595
- this.observer.disconnect();
11598
+ if (this.observer) this.observer.disconnect();
11596
11599
  }
11597
11600
  };
11598
11601
  }
@@ -12463,31 +12466,6 @@ function $e1f51f020443edd4$export$2e2bcd8739ae039(id, embedStore) {
12463
12466
  }
12464
12467
 
12465
12468
 
12466
- var $e9904a14dabf652d$exports = {};
12467
-
12468
- $parcel$defineInteropFlag($e9904a14dabf652d$exports);
12469
-
12470
- $parcel$export($e9904a14dabf652d$exports, "default", () => $e9904a14dabf652d$export$2e2bcd8739ae039);
12471
- function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
12472
- return {
12473
- focussed: false,
12474
- get active () {
12475
- return store.active;
12476
- },
12477
- get text () {
12478
- return store.text;
12479
- },
12480
- clear () {
12481
- if (store.raw === "") this.$refs.input.blur();
12482
- else store.raw = "";
12483
- },
12484
- focus () {
12485
- this.$refs.input.focus();
12486
- }
12487
- };
12488
- }
12489
-
12490
-
12491
12469
  var $36506012e0c6e9e3$exports = {};
12492
12470
 
12493
12471
  $parcel$defineInteropFlag($36506012e0c6e9e3$exports);
@@ -12542,6 +12520,31 @@ function $d92d9d5253f84566$export$2e2bcd8739ae039(store) {
12542
12520
  }
12543
12521
 
12544
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
+
12545
12548
  var $b63b9c6d236b3f65$exports = {};
12546
12549
 
12547
12550
  $parcel$defineInteropFlag($b63b9c6d236b3f65$exports);
@@ -12560,6 +12563,33 @@ function $b63b9c6d236b3f65$export$2e2bcd8739ae039() {
12560
12563
  }
12561
12564
 
12562
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
+
12563
12593
  var $506dabb2bf255b38$exports = {};
12564
12594
 
12565
12595
  $parcel$defineInteropFlag($506dabb2bf255b38$exports);
@@ -13113,30 +13143,6 @@ function $506dabb2bf255b38$var$sizeSplits(sizes) {
13113
13143
  }
13114
13144
 
13115
13145
 
13116
- var $d69ee878996183ed$exports = {};
13117
-
13118
- $parcel$defineInteropFlag($d69ee878996183ed$exports);
13119
-
13120
- $parcel$export($d69ee878996183ed$exports, "default", () => $d69ee878996183ed$export$2e2bcd8739ae039);
13121
- function $d69ee878996183ed$export$2e2bcd8739ae039(store) {
13122
- return {
13123
- get id () {
13124
- return this.$root.id;
13125
- },
13126
- get sections () {
13127
- return Array.from(this.$refs.sections.children);
13128
- },
13129
- isActive (el) {
13130
- return store.activeTab === this._getRef(el);
13131
- },
13132
- // protected
13133
- _getRef (el) {
13134
- return el.getAttribute("x-ref");
13135
- }
13136
- };
13137
- }
13138
-
13139
-
13140
13146
  var $0db07828cadc68e0$exports = {};
13141
13147
 
13142
13148
  $parcel$defineInteropFlag($0db07828cadc68e0$exports);
@@ -13147,13 +13153,16 @@ $parcel$export($0db07828cadc68e0$exports, "default", () => $0db07828cadc68e0$exp
13147
13153
 
13148
13154
 
13149
13155
  function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13150
- const initial = store.activeTab || null;
13156
+ const initial1 = store ? store.activeTab : null;
13151
13157
  let dropdown = null;
13152
13158
  return {
13153
13159
  visibleTabsCount: 0,
13154
13160
  triggerLeft: 0,
13161
+ get store () {
13162
+ return store || this;
13163
+ },
13155
13164
  get tabs () {
13156
- return Array.from(this.$refs.tabs.children);
13165
+ return this.$refs.tabs ? Array.from(this.$refs.tabs.children) : [];
13157
13166
  },
13158
13167
  get dropdownTabs () {
13159
13168
  return Array.from(this.$refs.tabsDropdown ? this.$refs.tabsDropdown.children : []);
@@ -13171,11 +13180,12 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13171
13180
  theme: "menu",
13172
13181
  interactive: true,
13173
13182
  trigger: "click",
13183
+ placement: "bottom",
13174
13184
  appendTo: this.$root
13175
13185
  });
13176
- const initialTab = initial ? this.tabs.find((t)=>this._getRef(t) === initial
13186
+ const initialTab = initial1 ? this.tabs.find((t)=>this._getRef(t) === initial1
13177
13187
  ) : this.tabs[0];
13178
- this.selectTab(initialTab);
13188
+ this.selectTab(initialTab, true);
13179
13189
  this.parentObserver = $9930d46698775b42$export$a2214cc2adb2dc44(this.$root.parentElement, (/*@__PURE__*/$parcel$interopDefault($d3ec6a576bb30dc9$exports))(this.handleResize.bind(this), 10));
13180
13190
  this.$watch("visibleTabsCount", (value)=>{
13181
13191
  this.debug(`'#${this.$root.id}' visible tabs count:`, value);
@@ -13202,12 +13212,15 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
13202
13212
  this.triggerLeft = triggerLeft;
13203
13213
  this._lastMeasuredWidth = width;
13204
13214
  },
13205
- selectTab (el) {
13206
- store.activeTab = this._getRef(el);
13215
+ selectTab (el, initial = false) {
13216
+ this.store.activeTab = this._getRef(el);
13207
13217
  dropdown.hide();
13218
+ if (!initial) this.$dispatch("tabs:change", {
13219
+ tabs: this
13220
+ });
13208
13221
  },
13209
13222
  isSelected (el) {
13210
- return store.activeTab === this._getRef(el);
13223
+ return this.store.activeTab === this._getRef(el);
13211
13224
  },
13212
13225
  isDisabled (el) {
13213
13226
  return el.getAttribute("data-disabled") == "true";
@@ -13351,18 +13364,18 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
13351
13364
  }
13352
13365
 
13353
13366
 
13354
- $b40b0b74537cbda1$exports = {
13367
+ $e44b48ce5635d6e0$exports = {
13355
13368
  "button": $cbd28b10fa9798c7$exports,
13356
13369
  "code": $99486586f6691564$exports,
13357
13370
  "copy_button": $47a1c62621be0c54$exports,
13358
13371
  "dimensions_display": $e398acaded942bbe$exports,
13359
13372
  "embed": $e1f51f020443edd4$exports,
13360
- "filter": $e9904a14dabf652d$exports,
13361
13373
  "icon": $36506012e0c6e9e3$exports,
13362
13374
  "nav": $d92d9d5253f84566$exports,
13375
+ "filter": $e9904a14dabf652d$exports,
13363
13376
  "params_editor": $b63b9c6d236b3f65$exports,
13377
+ "tab_panels": $a87dacf5139b5e2f$exports,
13364
13378
  "split_layout": $506dabb2bf255b38$exports,
13365
- "tabbed_content": $d69ee878996183ed$exports,
13366
13379
  "tabs": $0db07828cadc68e0$exports,
13367
13380
  "viewport": $6d64716f0b34fdf4$exports
13368
13381
  };
@@ -13511,7 +13524,7 @@ $caa9439642c6336c$export$2e2bcd8739ae039.store("settings", $96e0343bbb13096b$exp
13511
13524
  // Components
13512
13525
  $caa9439642c6336c$export$2e2bcd8739ae039.data("app", $d709d0f4027033b2$export$2e2bcd8739ae039);
13513
13526
  [
13514
- $b40b0b74537cbda1$exports,
13527
+ $e44b48ce5635d6e0$exports,
13515
13528
  $e4eab7529959b73b$exports,
13516
13529
  $4979d2d897a1c01f$exports
13517
13530
  ].forEach((scripts)=>{