lookbook 1.1.0 → 1.2.0

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.
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/display_options/editor/component.html.erb +13 -0
  5. data/app/components/lookbook/display_options/editor/component.rb +7 -0
  6. data/app/components/lookbook/display_options/field/component.css +33 -0
  7. data/app/components/lookbook/display_options/field/component.html.erb +8 -0
  8. data/app/components/lookbook/display_options/field/component.js +30 -0
  9. data/app/components/lookbook/display_options/field/component.rb +28 -0
  10. data/app/components/lookbook/inspector_panel/component.html.erb +1 -1
  11. data/app/components/lookbook/inspector_panel/component.rb +10 -11
  12. data/app/components/lookbook/params/editor/component.rb +6 -3
  13. data/app/components/lookbook/params/field/component.rb +1 -5
  14. data/app/components/lookbook/tab_panels/panel/component.html.erb +1 -1
  15. data/app/components/lookbook/tab_panels/panel/component.rb +1 -2
  16. data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +1 -0
  17. data/app/components/lookbook/tabs/tab/component.html.erb +1 -0
  18. data/app/components/lookbook/viewport/component.html.erb +1 -1
  19. data/app/components/lookbook/viewport/component.rb +2 -1
  20. data/app/controllers/lookbook/previews_controller.rb +40 -29
  21. data/app/helpers/lookbook/preview_helper.rb +1 -1
  22. data/app/views/lookbook/preview.html.erb +1 -1
  23. data/app/views/lookbook/previews/panels/_params.html.erb +1 -1
  24. data/app/views/lookbook/previews/panels/_preview.html.erb +9 -6
  25. data/app/views/lookbook/previews/show.html.erb +29 -11
  26. data/config/app.yml +36 -0
  27. data/config/hooks.yml +4 -0
  28. data/config/inputs.yml +48 -0
  29. data/config/panels.yml +30 -0
  30. data/config/routes.rb +1 -1
  31. data/config/tags.yml +29 -0
  32. data/lib/lookbook/engine.rb +40 -87
  33. data/lib/lookbook/markdown.rb +1 -11
  34. data/lib/lookbook/page.rb +1 -1
  35. data/lib/lookbook/params.rb +0 -7
  36. data/lib/lookbook/parser.rb +3 -10
  37. data/lib/lookbook/preview.rb +7 -3
  38. data/lib/lookbook/preview_example.rb +7 -3
  39. data/lib/lookbook/preview_group.rb +2 -2
  40. data/lib/lookbook/services/config_loader.rb +20 -0
  41. data/lib/lookbook/services/search_param_builder.rb +13 -0
  42. data/lib/lookbook/services/search_param_parser.rb +15 -0
  43. data/lib/lookbook/services/tags/key_value_tag_parser.rb +24 -0
  44. data/lib/lookbook/source_inspector.rb +10 -16
  45. data/lib/lookbook/stores/config_store.rb +80 -0
  46. data/lib/lookbook/stores/hook_store.rb +28 -0
  47. data/lib/lookbook/stores/input_store.rb +58 -0
  48. data/lib/lookbook/stores/panel_store.rb +141 -0
  49. data/lib/lookbook/stores/tag_store.rb +46 -0
  50. data/lib/lookbook/support/errors/config_error.rb +7 -0
  51. data/lib/lookbook/support/errors/lookbook_error.rb +21 -0
  52. data/lib/lookbook/support/errors/parser_error.rb +7 -0
  53. data/lib/lookbook/support/service.rb +7 -0
  54. data/lib/lookbook/support/store.rb +77 -0
  55. data/lib/lookbook/support/utils/attribute_utils.rb +9 -0
  56. data/lib/lookbook/support/utils/path_utils.rb +19 -0
  57. data/lib/lookbook/tags.rb +5 -14
  58. data/lib/lookbook/version.rb +1 -1
  59. data/lib/lookbook.rb +106 -30
  60. data/public/lookbook-assets/css/lookbook.css +33 -0
  61. data/public/lookbook-assets/css/lookbook.css.map +1 -1
  62. data/public/lookbook-assets/js/lookbook.js +158 -21
  63. data/public/lookbook-assets/js/lookbook.js.map +1 -1
  64. metadata +43 -7
  65. data/lib/lookbook/config.rb +0 -282
  66. data/lib/lookbook/data.rb +0 -11
  67. data/lib/lookbook/hooks.rb +0 -21
  68. data/lib/lookbook/panels.rb +0 -25
  69. data/lib/lookbook/store.rb +0 -48
@@ -623,6 +623,10 @@ var $caa9439642c6336c$var$directiveOrder = [
623
623
  "ref",
624
624
  "data",
625
625
  "id",
626
+ "tabs",
627
+ "radio",
628
+ "switch",
629
+ "disclosure",
626
630
  "bind",
627
631
  "init",
628
632
  "for",
@@ -1238,11 +1242,11 @@ function $caa9439642c6336c$var$getBinding(el, name, fallback) {
1238
1242
  if (el._x_bindings && el._x_bindings[name] !== void 0) return el._x_bindings[name];
1239
1243
  let attr = el.getAttribute(name);
1240
1244
  if (attr === null) return typeof fallback === "function" ? fallback() : fallback;
1245
+ if (attr === "") return true;
1241
1246
  if ($caa9439642c6336c$var$isBooleanAttr(name)) return !![
1242
1247
  name,
1243
1248
  "true"
1244
1249
  ].includes(attr);
1245
- if (attr === "") return true;
1246
1250
  return attr;
1247
1251
  }
1248
1252
  // packages/alpinejs/src/utils/debounce.js
@@ -1361,7 +1365,7 @@ var $caa9439642c6336c$var$Alpine = {
1361
1365
  get raw () {
1362
1366
  return $caa9439642c6336c$var$raw;
1363
1367
  },
1364
- version: "3.10.3",
1368
+ version: "3.10.4",
1365
1369
  flushAndStopDeferringMutations: $caa9439642c6336c$var$flushAndStopDeferringMutations,
1366
1370
  dontAutoEvaluateFunctions: $caa9439642c6336c$var$dontAutoEvaluateFunctions,
1367
1371
  disableEffectScheduling: $caa9439642c6336c$var$disableEffectScheduling,
@@ -2390,7 +2394,7 @@ $caa9439642c6336c$var$directive("bind", (el, { value: value , modifiers: modifie
2390
2394
  if (value === "key") return $caa9439642c6336c$var$storeKeyForXFor(el, expression);
2391
2395
  let evaluate2 = $caa9439642c6336c$var$evaluateLater(el, expression);
2392
2396
  effect3(()=>evaluate2((result)=>{
2393
- if (result === void 0 && expression.match(/\./)) result = "";
2397
+ if (result === void 0 && typeof expression === "string" && expression.match(/\./)) result = "";
2394
2398
  $caa9439642c6336c$var$mutateDom(()=>$caa9439642c6336c$var$bind(el, value, result, modifiers));
2395
2399
  }));
2396
2400
  });
@@ -6826,6 +6830,19 @@ function $7ae6ae39c2ec9059$export$6cb344a21ca18aec(content) {
6826
6830
  function $7ae6ae39c2ec9059$export$2ce3c33e50a76e49(string, prefix = null) {
6827
6831
  return prefix ? `${prefix}-${string}` : string;
6828
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
+ }
6829
6846
 
6830
6847
 
6831
6848
  const { sidebar: $aabd7bdddb195dac$var$sidebar , main: $aabd7bdddb195dac$var$main , inspector: $aabd7bdddb195dac$var$inspector } = (0, $4d527fa4ac70acba$export$2e2bcd8739ae039);
@@ -7821,7 +7838,7 @@ function $5439cede634b2921$var$toCamel(s) {
7821
7838
  }
7822
7839
 
7823
7840
 
7824
- var $205fb3dd9870d001$exports = {};
7841
+ var $1f889267678ff167$exports = {};
7825
7842
  var $cbd28b10fa9798c7$exports = {};
7826
7843
 
7827
7844
  $parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
@@ -11485,6 +11502,16 @@ function $cbd28b10fa9798c7$export$2e2bcd8739ae039() {
11485
11502
  }
11486
11503
 
11487
11504
 
11505
+ var $99486586f6691564$exports = {};
11506
+
11507
+ $parcel$defineInteropFlag($99486586f6691564$exports);
11508
+
11509
+ $parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
11510
+ function $99486586f6691564$export$2e2bcd8739ae039() {
11511
+ return {};
11512
+ }
11513
+
11514
+
11488
11515
  var $47a1c62621be0c54$exports = {};
11489
11516
 
11490
11517
  $parcel$defineInteropFlag($47a1c62621be0c54$exports);
@@ -11541,16 +11568,6 @@ function $47a1c62621be0c54$export$2e2bcd8739ae039() {
11541
11568
  }
11542
11569
 
11543
11570
 
11544
- var $99486586f6691564$exports = {};
11545
-
11546
- $parcel$defineInteropFlag($99486586f6691564$exports);
11547
-
11548
- $parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039);
11549
- function $99486586f6691564$export$2e2bcd8739ae039() {
11550
- return {};
11551
- }
11552
-
11553
-
11554
11571
  var $e398acaded942bbe$exports = {};
11555
11572
 
11556
11573
  $parcel$defineInteropFlag($e398acaded942bbe$exports);
@@ -13326,10 +13343,10 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
13326
13343
  }
13327
13344
 
13328
13345
 
13329
- $205fb3dd9870d001$exports = {
13346
+ $1f889267678ff167$exports = {
13330
13347
  "button": $cbd28b10fa9798c7$exports,
13331
- "copy_button": $47a1c62621be0c54$exports,
13332
13348
  "code": $99486586f6691564$exports,
13349
+ "copy_button": $47a1c62621be0c54$exports,
13333
13350
  "dimensions_display": $e398acaded942bbe$exports,
13334
13351
  "embed": $e1f51f020443edd4$exports,
13335
13352
  "filter": $e9904a14dabf652d$exports,
@@ -13342,7 +13359,125 @@ $205fb3dd9870d001$exports = {
13342
13359
  };
13343
13360
 
13344
13361
 
13345
- var $c43230a66e7bc31a$exports = {};
13362
+ var $fe98e3f2bf49b28f$exports = {};
13363
+ var $6a9b69d9cc7f810f$exports = {};
13364
+
13365
+ $parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
13366
+
13367
+ $parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
13368
+ var $cdfeaa1e0e8d642c$exports = {};
13369
+ (function(global, factory) {
13370
+ $cdfeaa1e0e8d642c$exports = factory();
13371
+ })($cdfeaa1e0e8d642c$exports, function() {
13372
+ "use strict";
13373
+ /* eslint-disable no-var */ function assign(target) {
13374
+ for(var i = 1; i < arguments.length; i++){
13375
+ var source = arguments[i];
13376
+ for(var key in source)target[key] = source[key];
13377
+ }
13378
+ return target;
13379
+ }
13380
+ /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
13381
+ read: function(value) {
13382
+ if (value[0] === '"') value = value.slice(1, -1);
13383
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
13384
+ },
13385
+ write: function(value) {
13386
+ return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
13387
+ }
13388
+ };
13389
+ /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
13390
+ function set(key, value, attributes) {
13391
+ if (typeof document === "undefined") return;
13392
+ attributes = assign({}, defaultAttributes, attributes);
13393
+ if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
13394
+ if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
13395
+ key = encodeURIComponent(key).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
13396
+ var stringifiedAttributes = "";
13397
+ for(var attributeName in attributes){
13398
+ if (!attributes[attributeName]) continue;
13399
+ stringifiedAttributes += "; " + attributeName;
13400
+ if (attributes[attributeName] === true) continue;
13401
+ // Considers RFC 6265 section 5.2:
13402
+ // ...
13403
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
13404
+ // character:
13405
+ // Consume the characters of the unparsed-attributes up to,
13406
+ // not including, the first %x3B (";") character.
13407
+ // ...
13408
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
13409
+ }
13410
+ return document.cookie = key + "=" + converter.write(value, key) + stringifiedAttributes;
13411
+ }
13412
+ function get(key) {
13413
+ if (typeof document === "undefined" || arguments.length && !key) return;
13414
+ // To prevent the for loop in the first place assign an empty array
13415
+ // in case there are no cookies at all.
13416
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
13417
+ var jar = {};
13418
+ for(var i = 0; i < cookies.length; i++){
13419
+ var parts = cookies[i].split("=");
13420
+ var value = parts.slice(1).join("=");
13421
+ try {
13422
+ var foundKey = decodeURIComponent(parts[0]);
13423
+ jar[foundKey] = converter.read(value, foundKey);
13424
+ if (key === foundKey) break;
13425
+ } catch (e) {}
13426
+ }
13427
+ return key ? jar[key] : jar;
13428
+ }
13429
+ return Object.create({
13430
+ set: set,
13431
+ get: get,
13432
+ remove: function(key, attributes) {
13433
+ set(key, "", assign({}, attributes, {
13434
+ expires: -1
13435
+ }));
13436
+ },
13437
+ withAttributes: function(attributes) {
13438
+ return init(this.converter, assign({}, this.attributes, attributes));
13439
+ },
13440
+ withConverter: function(converter) {
13441
+ return init(assign({}, this.converter, converter), this.attributes);
13442
+ }
13443
+ }, {
13444
+ attributes: {
13445
+ value: Object.freeze(defaultAttributes)
13446
+ },
13447
+ converter: {
13448
+ value: Object.freeze(converter)
13449
+ }
13450
+ });
13451
+ }
13452
+ var api = init(defaultConverter, {
13453
+ path: "/"
13454
+ });
13455
+ /* eslint-enable no-var */ return api;
13456
+ });
13457
+
13458
+
13459
+
13460
+ function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name , value: value }) {
13461
+ return {
13462
+ name: name,
13463
+ value: value,
13464
+ init () {
13465
+ this.$watch("value", ()=>this.update());
13466
+ },
13467
+ update () {
13468
+ (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
13469
+ const searchParams = new URLSearchParams(window.location.search);
13470
+ const display = searchParams.get("_display");
13471
+ const displayParams = display ? (0, $7ae6ae39c2ec9059$export$f720fd0ddbeb53d9)(display) : {};
13472
+ displayParams[this.name] = this.value;
13473
+ searchParams.set("_display", (0, $7ae6ae39c2ec9059$export$c788aab010beeaec)(displayParams));
13474
+ const path = location.href.replace(location.search, "");
13475
+ this.navigateTo(`${path}?${searchParams.toString()}`);
13476
+ }
13477
+ };
13478
+ }
13479
+
13480
+
13346
13481
  var $9b24cbeb3a465447$exports = {};
13347
13482
 
13348
13483
  $parcel$defineInteropFlag($9b24cbeb3a465447$exports);
@@ -13431,7 +13566,10 @@ function $e773f8ef556b41ff$export$2e2bcd8739ae039() {
13431
13566
  }
13432
13567
 
13433
13568
 
13434
- $c43230a66e7bc31a$exports = {
13569
+ $fe98e3f2bf49b28f$exports = {
13570
+ "display_options": {
13571
+ "field": $6a9b69d9cc7f810f$exports
13572
+ },
13435
13573
  "nav": {
13436
13574
  "item": $9b24cbeb3a465447$exports
13437
13575
  },
@@ -13505,13 +13643,12 @@ const $d73574cc5e9b9e72$var$prefix = window.APP_NAME;
13505
13643
  // Components
13506
13644
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
13507
13645
  [
13508
- $205fb3dd9870d001$exports,
13509
- $c43230a66e7bc31a$exports,
13646
+ $1f889267678ff167$exports,
13647
+ $fe98e3f2bf49b28f$exports,
13510
13648
  $6c10158820e535ef$exports
13511
13649
  ].forEach((scripts)=>{
13512
13650
  const components = (0, $5439cede634b2921$export$4e811121b221213b)(scripts);
13513
13651
  Object.keys(components).forEach((name)=>{
13514
- console.log(name);
13515
13652
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data(`${name}Component`, components[name]);
13516
13653
  });
13517
13654
  });