lookbook 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/lookbook/js/helpers/string.js +23 -1
  3. data/app/assets/lookbook/js/lookbook.js +0 -1
  4. data/app/components/lookbook/button/component.html.erb +2 -1
  5. data/app/components/lookbook/button/component.js +9 -0
  6. data/app/components/lookbook/display_options/editor/component.html.erb +13 -0
  7. data/app/components/lookbook/display_options/editor/component.rb +7 -0
  8. data/app/components/lookbook/display_options/field/component.css +33 -0
  9. data/app/components/lookbook/display_options/field/component.html.erb +8 -0
  10. data/app/components/lookbook/display_options/field/component.js +30 -0
  11. data/app/components/lookbook/display_options/field/component.rb +28 -0
  12. data/app/components/lookbook/inspector_panel/component.html.erb +1 -1
  13. data/app/components/lookbook/inspector_panel/component.rb +10 -11
  14. data/app/components/lookbook/params/editor/component.rb +6 -3
  15. data/app/components/lookbook/params/field/component.rb +1 -5
  16. data/app/components/lookbook/tab_panels/panel/component.html.erb +1 -1
  17. data/app/components/lookbook/tab_panels/panel/component.rb +1 -2
  18. data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +1 -0
  19. data/app/components/lookbook/tabs/tab/component.html.erb +1 -0
  20. data/app/components/lookbook/viewport/component.html.erb +1 -1
  21. data/app/components/lookbook/viewport/component.rb +2 -1
  22. data/app/controllers/lookbook/previews_controller.rb +40 -29
  23. data/app/helpers/lookbook/preview_helper.rb +1 -1
  24. data/app/views/lookbook/previews/panels/_params.html.erb +1 -1
  25. data/app/views/lookbook/previews/panels/_preview.html.erb +9 -6
  26. data/app/views/lookbook/previews/show.html.erb +29 -11
  27. data/config/app.yml +36 -0
  28. data/config/hooks.yml +4 -0
  29. data/config/inputs.yml +48 -0
  30. data/config/panels.yml +30 -0
  31. data/config/routes.rb +1 -1
  32. data/config/tags.yml +29 -0
  33. data/lib/lookbook/engine.rb +40 -20
  34. data/lib/lookbook/markdown.rb +1 -11
  35. data/lib/lookbook/page.rb +1 -1
  36. data/lib/lookbook/params.rb +0 -7
  37. data/lib/lookbook/parser.rb +3 -10
  38. data/lib/lookbook/preview.rb +7 -3
  39. data/lib/lookbook/preview_example.rb +7 -3
  40. data/lib/lookbook/preview_group.rb +2 -2
  41. data/lib/lookbook/services/config_loader.rb +20 -0
  42. data/lib/lookbook/services/search_param_builder.rb +13 -0
  43. data/lib/lookbook/services/search_param_parser.rb +15 -0
  44. data/lib/lookbook/services/tags/key_value_tag_parser.rb +24 -0
  45. data/lib/lookbook/source_inspector.rb +10 -16
  46. data/lib/lookbook/stores/config_store.rb +80 -0
  47. data/lib/lookbook/stores/hook_store.rb +28 -0
  48. data/lib/lookbook/stores/input_store.rb +58 -0
  49. data/lib/lookbook/stores/panel_store.rb +141 -0
  50. data/lib/lookbook/stores/tag_store.rb +46 -0
  51. data/lib/lookbook/support/errors/config_error.rb +7 -0
  52. data/lib/lookbook/support/errors/lookbook_error.rb +21 -0
  53. data/lib/lookbook/support/errors/parser_error.rb +7 -0
  54. data/lib/lookbook/support/service.rb +7 -0
  55. data/lib/lookbook/support/store.rb +77 -0
  56. data/lib/lookbook/support/utils/attribute_utils.rb +9 -0
  57. data/lib/lookbook/support/utils/path_utils.rb +19 -0
  58. data/lib/lookbook/tags.rb +5 -14
  59. data/lib/lookbook/version.rb +1 -1
  60. data/lib/lookbook.rb +43 -12
  61. data/public/lookbook-assets/css/lookbook.css +33 -0
  62. data/public/lookbook-assets/css/lookbook.css.map +1 -1
  63. data/public/lookbook-assets/js/lookbook.js +145 -4
  64. data/public/lookbook-assets/js/lookbook.js.map +1 -1
  65. metadata +29 -6
  66. data/lib/lookbook/config.rb +0 -278
  67. data/lib/lookbook/hooks.rb +0 -21
  68. data/lib/lookbook/panels.rb +0 -25
  69. data/lib/lookbook/store.rb +0 -34
@@ -6830,6 +6830,19 @@ function $7ae6ae39c2ec9059$export$6cb344a21ca18aec(content) {
6830
6830
  function $7ae6ae39c2ec9059$export$2ce3c33e50a76e49(string, prefix = null) {
6831
6831
  return prefix ? `${prefix}-${string}` : string;
6832
6832
  }
6833
+ function $7ae6ae39c2ec9059$export$f720fd0ddbeb53d9(value) {
6834
+ const params = {};
6835
+ value.split("|").forEach((pair_str)=>{
6836
+ const [key, value] = pair_str.split(":").map((part)=>part.trim());
6837
+ params[key] = value;
6838
+ });
6839
+ return params;
6840
+ }
6841
+ function $7ae6ae39c2ec9059$export$c788aab010beeaec(data) {
6842
+ const pairs = [];
6843
+ for (const [key, value] of Object.entries(data))pairs.push(`${key}:${value}`);
6844
+ return pairs.join("|");
6845
+ }
6833
6846
 
6834
6847
 
6835
6848
  const { sidebar: $aabd7bdddb195dac$var$sidebar , main: $aabd7bdddb195dac$var$main , inspector: $aabd7bdddb195dac$var$inspector } = (0, $4d527fa4ac70acba$export$2e2bcd8739ae039);
@@ -11475,6 +11488,14 @@ function $cbd28b10fa9798c7$export$2e2bcd8739ae039() {
11475
11488
  hideDropdown () {
11476
11489
  if (dropdown) dropdown.hide();
11477
11490
  },
11491
+ updateDropdown () {
11492
+ if (dropdown) {
11493
+ dropdown.hide();
11494
+ this.$nextTick(()=>{
11495
+ dropdown.setContent(this.$refs.dropdown.innerHTML);
11496
+ });
11497
+ }
11498
+ },
11478
11499
  startSpin () {
11479
11500
  this._spinning = true;
11480
11501
  },
@@ -13346,7 +13367,125 @@ $1f889267678ff167$exports = {
13346
13367
  };
13347
13368
 
13348
13369
 
13349
- var $c43230a66e7bc31a$exports = {};
13370
+ var $fe98e3f2bf49b28f$exports = {};
13371
+ var $6a9b69d9cc7f810f$exports = {};
13372
+
13373
+ $parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
13374
+
13375
+ $parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
13376
+ var $cdfeaa1e0e8d642c$exports = {};
13377
+ (function(global, factory) {
13378
+ $cdfeaa1e0e8d642c$exports = factory();
13379
+ })($cdfeaa1e0e8d642c$exports, function() {
13380
+ "use strict";
13381
+ /* eslint-disable no-var */ function assign(target) {
13382
+ for(var i = 1; i < arguments.length; i++){
13383
+ var source = arguments[i];
13384
+ for(var key in source)target[key] = source[key];
13385
+ }
13386
+ return target;
13387
+ }
13388
+ /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
13389
+ read: function(value) {
13390
+ if (value[0] === '"') value = value.slice(1, -1);
13391
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
13392
+ },
13393
+ write: function(value) {
13394
+ return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
13395
+ }
13396
+ };
13397
+ /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
13398
+ function set(key, value, attributes) {
13399
+ if (typeof document === "undefined") return;
13400
+ attributes = assign({}, defaultAttributes, attributes);
13401
+ if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
13402
+ if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
13403
+ key = encodeURIComponent(key).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
13404
+ var stringifiedAttributes = "";
13405
+ for(var attributeName in attributes){
13406
+ if (!attributes[attributeName]) continue;
13407
+ stringifiedAttributes += "; " + attributeName;
13408
+ if (attributes[attributeName] === true) continue;
13409
+ // Considers RFC 6265 section 5.2:
13410
+ // ...
13411
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
13412
+ // character:
13413
+ // Consume the characters of the unparsed-attributes up to,
13414
+ // not including, the first %x3B (";") character.
13415
+ // ...
13416
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
13417
+ }
13418
+ return document.cookie = key + "=" + converter.write(value, key) + stringifiedAttributes;
13419
+ }
13420
+ function get(key) {
13421
+ if (typeof document === "undefined" || arguments.length && !key) return;
13422
+ // To prevent the for loop in the first place assign an empty array
13423
+ // in case there are no cookies at all.
13424
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
13425
+ var jar = {};
13426
+ for(var i = 0; i < cookies.length; i++){
13427
+ var parts = cookies[i].split("=");
13428
+ var value = parts.slice(1).join("=");
13429
+ try {
13430
+ var foundKey = decodeURIComponent(parts[0]);
13431
+ jar[foundKey] = converter.read(value, foundKey);
13432
+ if (key === foundKey) break;
13433
+ } catch (e) {}
13434
+ }
13435
+ return key ? jar[key] : jar;
13436
+ }
13437
+ return Object.create({
13438
+ set: set,
13439
+ get: get,
13440
+ remove: function(key, attributes) {
13441
+ set(key, "", assign({}, attributes, {
13442
+ expires: -1
13443
+ }));
13444
+ },
13445
+ withAttributes: function(attributes) {
13446
+ return init(this.converter, assign({}, this.attributes, attributes));
13447
+ },
13448
+ withConverter: function(converter) {
13449
+ return init(assign({}, this.converter, converter), this.attributes);
13450
+ }
13451
+ }, {
13452
+ attributes: {
13453
+ value: Object.freeze(defaultAttributes)
13454
+ },
13455
+ converter: {
13456
+ value: Object.freeze(converter)
13457
+ }
13458
+ });
13459
+ }
13460
+ var api = init(defaultConverter, {
13461
+ path: "/"
13462
+ });
13463
+ /* eslint-enable no-var */ return api;
13464
+ });
13465
+
13466
+
13467
+
13468
+ function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name , value: value }) {
13469
+ return {
13470
+ name: name,
13471
+ value: value,
13472
+ init () {
13473
+ this.$watch("value", ()=>this.update());
13474
+ },
13475
+ update () {
13476
+ (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
13477
+ const searchParams = new URLSearchParams(window.location.search);
13478
+ const display = searchParams.get("_display");
13479
+ const displayParams = display ? (0, $7ae6ae39c2ec9059$export$f720fd0ddbeb53d9)(display) : {};
13480
+ displayParams[this.name] = this.value;
13481
+ searchParams.set("_display", (0, $7ae6ae39c2ec9059$export$c788aab010beeaec)(displayParams));
13482
+ const path = location.href.replace(location.search, "");
13483
+ this.navigateTo(`${path}?${searchParams.toString()}`);
13484
+ }
13485
+ };
13486
+ }
13487
+
13488
+
13350
13489
  var $9b24cbeb3a465447$exports = {};
13351
13490
 
13352
13491
  $parcel$defineInteropFlag($9b24cbeb3a465447$exports);
@@ -13435,7 +13574,10 @@ function $e773f8ef556b41ff$export$2e2bcd8739ae039() {
13435
13574
  }
13436
13575
 
13437
13576
 
13438
- $c43230a66e7bc31a$exports = {
13577
+ $fe98e3f2bf49b28f$exports = {
13578
+ "display_options": {
13579
+ "field": $6a9b69d9cc7f810f$exports
13580
+ },
13439
13581
  "nav": {
13440
13582
  "item": $9b24cbeb3a465447$exports
13441
13583
  },
@@ -13510,12 +13652,11 @@ const $d73574cc5e9b9e72$var$prefix = window.APP_NAME;
13510
13652
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
13511
13653
  [
13512
13654
  $1f889267678ff167$exports,
13513
- $c43230a66e7bc31a$exports,
13655
+ $fe98e3f2bf49b28f$exports,
13514
13656
  $6c10158820e535ef$exports
13515
13657
  ].forEach((scripts)=>{
13516
13658
  const components = (0, $5439cede634b2921$export$4e811121b221213b)(scripts);
13517
13659
  Object.keys(components).forEach((name)=>{
13518
- console.log(name);
13519
13660
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data(`${name}Component`, components[name]);
13520
13661
  });
13521
13662
  });