lookbook 2.0.0.beta.3 → 2.0.0.beta.4

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/lookbook/css/lookbook.css +6 -0
  3. data/app/assets/lookbook/css/themes/blue.css +4 -1
  4. data/app/assets/lookbook/css/themes/green.css +4 -1
  5. data/app/assets/lookbook/css/themes/indigo.css +4 -1
  6. data/app/assets/lookbook/css/themes/rose.css +4 -1
  7. data/app/assets/lookbook/css/themes/zinc.css +4 -1
  8. data/app/assets/lookbook/img/lucide-sprite.svg +869 -869
  9. data/app/components/lookbook/code/highlight_github.css +16 -17
  10. data/app/components/lookbook/dimensions_display/component.js +4 -7
  11. data/app/components/lookbook/file_source/component.html.erb +9 -0
  12. data/app/components/lookbook/file_source/component.rb +73 -0
  13. data/app/components/lookbook/header/component.html.erb +11 -8
  14. data/app/components/lookbook/icon/component.css +1 -1
  15. data/app/components/lookbook/icon/component.html.erb +1 -1
  16. data/app/components/lookbook/icon/component.rb +4 -1
  17. data/app/components/lookbook/logo/component.html.erb +6 -0
  18. data/app/components/lookbook/logo/component.rb +15 -0
  19. data/app/components/lookbook/message/component.css +33 -0
  20. data/app/components/lookbook/message/component.html.erb +26 -0
  21. data/app/components/lookbook/message/component.rb +13 -0
  22. data/app/components/lookbook/nav/entity/component.html.erb +1 -1
  23. data/app/components/lookbook/nav/entity/component.rb +1 -1
  24. data/app/components/lookbook/params/field/component.css +3 -3
  25. data/app/components/lookbook/prose/component.css +8 -1
  26. data/app/components/lookbook/prose/component.html.erb +6 -1
  27. data/app/components/lookbook/prose/component.rb +2 -2
  28. data/app/controllers/concerns/lookbook/targetable_concern.rb +2 -16
  29. data/app/controllers/lookbook/application_controller.rb +38 -14
  30. data/app/controllers/lookbook/embeds_controller.rb +3 -4
  31. data/app/controllers/lookbook/inspector_controller.rb +4 -12
  32. data/app/controllers/lookbook/pages_controller.rb +15 -27
  33. data/app/controllers/lookbook/preview_controller.rb +30 -2
  34. data/app/controllers/lookbook/previews_controller.rb +13 -15
  35. data/app/views/layouts/lookbook/application.html.erb +1 -0
  36. data/app/views/layouts/lookbook/skeleton.html.erb +2 -2
  37. data/app/views/lookbook/errors/default.html.erb +40 -0
  38. data/app/views/lookbook/errors/not_found.html.erb +10 -0
  39. data/app/views/lookbook/index.html.erb +29 -24
  40. data/app/views/lookbook/pages/show.html.erb +6 -5
  41. data/app/views/lookbook/partials/_blank_slate.html.erb +7 -0
  42. data/config/app.yml +8 -0
  43. data/config/routes.rb +2 -0
  44. data/lib/lookbook/engine.rb +6 -3
  45. data/lib/lookbook/entities/concerns/annotatable_entity.rb +26 -1
  46. data/lib/lookbook/entities/concerns/inspectable_entity.rb +17 -2
  47. data/lib/lookbook/entities/concerns/locatable_entity.rb +51 -7
  48. data/lib/lookbook/entities/concerns/navigable_entity.rb +14 -1
  49. data/lib/lookbook/entities/entity.rb +34 -12
  50. data/lib/lookbook/entities/page_entity.rb +68 -10
  51. data/lib/lookbook/entities/page_section_entity.rb +4 -0
  52. data/lib/lookbook/entities/preview_entity.rb +107 -17
  53. data/lib/lookbook/entities/renderable_entity.rb +47 -9
  54. data/lib/lookbook/entities/rendered_scenario_entity.rb +17 -6
  55. data/lib/lookbook/entities/scenario_entity.rb +77 -16
  56. data/lib/lookbook/entities/scenario_group_entity.rb +82 -9
  57. data/lib/lookbook/helpers/page_helper.rb +26 -1
  58. data/lib/lookbook/helpers/ui_elements_helper.rb +0 -24
  59. data/lib/lookbook/param.rb +1 -1
  60. data/lib/lookbook/stores/config_store.rb +0 -12
  61. data/lib/lookbook/support/errors/config_error.rb +1 -1
  62. data/lib/lookbook/support/errors/error.rb +64 -0
  63. data/lib/lookbook/support/errors/parser_error.rb +1 -1
  64. data/lib/lookbook/support/errors/preview_template_error.rb +1 -1
  65. data/lib/lookbook/support/errors/routing_error.rb +7 -0
  66. data/lib/lookbook/support/errors/template_error.rb +7 -0
  67. data/lib/lookbook/version.rb +1 -1
  68. data/public/lookbook-assets/css/lookbook.css +374 -53
  69. data/public/lookbook-assets/css/lookbook.css.map +1 -1
  70. data/public/lookbook-assets/css/themes/blue.css +4 -1
  71. data/public/lookbook-assets/css/themes/blue.css.map +1 -1
  72. data/public/lookbook-assets/css/themes/green.css +4 -1
  73. data/public/lookbook-assets/css/themes/green.css.map +1 -1
  74. data/public/lookbook-assets/css/themes/indigo.css +4 -1
  75. data/public/lookbook-assets/css/themes/indigo.css.map +1 -1
  76. data/public/lookbook-assets/css/themes/rose.css +4 -1
  77. data/public/lookbook-assets/css/themes/rose.css.map +1 -1
  78. data/public/lookbook-assets/css/themes/zinc.css +4 -1
  79. data/public/lookbook-assets/css/themes/zinc.css.map +1 -1
  80. data/public/lookbook-assets/img/lucide-sprite.svg +869 -869
  81. data/public/lookbook-assets/js/index.js +125 -125
  82. data/public/lookbook-assets/js/index.js.map +1 -1
  83. metadata +15 -7
  84. data/app/views/layouts/lookbook/shell.html.erb +0 -25
  85. data/app/views/lookbook/404.html.erb +0 -15
  86. data/app/views/lookbook/error.html.erb +0 -46
  87. data/lib/lookbook/error.rb +0 -120
  88. data/lib/lookbook/support/errors/lookbook_error.rb +0 -21
@@ -11449,7 +11449,7 @@ function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
11449
11449
  }
11450
11450
  },
11451
11451
  createObserver () {
11452
- if (this.target) this.observer = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(document.querySelector(targetSelector), ({ width: width , height: height })=>{
11452
+ if (this.target) this.observer = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(this.target, ({ width: width , height: height })=>{
11453
11453
  this.width = width;
11454
11454
  this.height = height;
11455
11455
  });
@@ -12380,125 +12380,7 @@ $77553f14666631eb$exports = {
12380
12380
  };
12381
12381
 
12382
12382
 
12383
- var $f3e1e32f4a1bd6da$exports = {};
12384
- var $6a9b69d9cc7f810f$exports = {};
12385
-
12386
- $parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
12387
-
12388
- $parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
12389
- var $cdfeaa1e0e8d642c$exports = {};
12390
- (function(global, factory) {
12391
- $cdfeaa1e0e8d642c$exports = factory();
12392
- })($cdfeaa1e0e8d642c$exports, function() {
12393
- "use strict";
12394
- /* eslint-disable no-var */ function assign(target) {
12395
- for(var i = 1; i < arguments.length; i++){
12396
- var source = arguments[i];
12397
- for(var key in source)target[key] = source[key];
12398
- }
12399
- return target;
12400
- }
12401
- /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
12402
- read: function(value) {
12403
- if (value[0] === '"') value = value.slice(1, -1);
12404
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
12405
- },
12406
- write: function(value) {
12407
- return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
12408
- }
12409
- };
12410
- /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
12411
- function set(key, value, attributes) {
12412
- if (typeof document === "undefined") return;
12413
- attributes = assign({}, defaultAttributes, attributes);
12414
- if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
12415
- if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
12416
- key = encodeURIComponent(key).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
12417
- var stringifiedAttributes = "";
12418
- for(var attributeName in attributes){
12419
- if (!attributes[attributeName]) continue;
12420
- stringifiedAttributes += "; " + attributeName;
12421
- if (attributes[attributeName] === true) continue;
12422
- // Considers RFC 6265 section 5.2:
12423
- // ...
12424
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
12425
- // character:
12426
- // Consume the characters of the unparsed-attributes up to,
12427
- // not including, the first %x3B (";") character.
12428
- // ...
12429
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
12430
- }
12431
- return document.cookie = key + "=" + converter.write(value, key) + stringifiedAttributes;
12432
- }
12433
- function get(key) {
12434
- if (typeof document === "undefined" || arguments.length && !key) return;
12435
- // To prevent the for loop in the first place assign an empty array
12436
- // in case there are no cookies at all.
12437
- var cookies = document.cookie ? document.cookie.split("; ") : [];
12438
- var jar = {};
12439
- for(var i = 0; i < cookies.length; i++){
12440
- var parts = cookies[i].split("=");
12441
- var value = parts.slice(1).join("=");
12442
- try {
12443
- var foundKey = decodeURIComponent(parts[0]);
12444
- jar[foundKey] = converter.read(value, foundKey);
12445
- if (key === foundKey) break;
12446
- } catch (e) {}
12447
- }
12448
- return key ? jar[key] : jar;
12449
- }
12450
- return Object.create({
12451
- set: set,
12452
- get: get,
12453
- remove: function(key, attributes) {
12454
- set(key, "", assign({}, attributes, {
12455
- expires: -1
12456
- }));
12457
- },
12458
- withAttributes: function(attributes) {
12459
- return init(this.converter, assign({}, this.attributes, attributes));
12460
- },
12461
- withConverter: function(converter) {
12462
- return init(assign({}, this.converter, converter), this.attributes);
12463
- }
12464
- }, {
12465
- attributes: {
12466
- value: Object.freeze(defaultAttributes)
12467
- },
12468
- converter: {
12469
- value: Object.freeze(converter)
12470
- }
12471
- });
12472
- }
12473
- var api = init(defaultConverter, {
12474
- path: "/"
12475
- });
12476
- /* eslint-enable no-var */ return api;
12477
- });
12478
-
12479
-
12480
-
12481
- function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name , value: value }) {
12482
- return {
12483
- name: name,
12484
- value: value,
12485
- init () {
12486
- this.$watch("value", ()=>this.update());
12487
- },
12488
- update () {
12489
- (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
12490
- const searchParams = new URLSearchParams(window.location.search);
12491
- const display = searchParams.get("_display");
12492
- const displayParams = display ? (0, $7ae6ae39c2ec9059$export$f720fd0ddbeb53d9)(display) : {};
12493
- displayParams[this.name] = this.value;
12494
- searchParams.set("_display", (0, $7ae6ae39c2ec9059$export$c788aab010beeaec)(displayParams));
12495
- const path = location.href.replace(location.search, "");
12496
- this.navigateTo(`${path}?${searchParams.toString()}`);
12497
- }
12498
- };
12499
- }
12500
-
12501
-
12383
+ var $2af7656449ff0341$exports = {};
12502
12384
  var $c299e36fa9e271bc$exports = {};
12503
12385
 
12504
12386
  $parcel$defineInteropFlag($c299e36fa9e271bc$exports);
@@ -13380,6 +13262,124 @@ function $c299e36fa9e271bc$export$2e2bcd8739ae039(id, embedStore) {
13380
13262
  }
13381
13263
 
13382
13264
 
13265
+ var $6a9b69d9cc7f810f$exports = {};
13266
+
13267
+ $parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
13268
+
13269
+ $parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
13270
+ var $cdfeaa1e0e8d642c$exports = {};
13271
+ (function(global, factory) {
13272
+ $cdfeaa1e0e8d642c$exports = factory();
13273
+ })($cdfeaa1e0e8d642c$exports, function() {
13274
+ "use strict";
13275
+ /* eslint-disable no-var */ function assign(target) {
13276
+ for(var i = 1; i < arguments.length; i++){
13277
+ var source = arguments[i];
13278
+ for(var key in source)target[key] = source[key];
13279
+ }
13280
+ return target;
13281
+ }
13282
+ /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
13283
+ read: function(value) {
13284
+ if (value[0] === '"') value = value.slice(1, -1);
13285
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
13286
+ },
13287
+ write: function(value) {
13288
+ return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
13289
+ }
13290
+ };
13291
+ /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
13292
+ function set(key, value, attributes) {
13293
+ if (typeof document === "undefined") return;
13294
+ attributes = assign({}, defaultAttributes, attributes);
13295
+ if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
13296
+ if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
13297
+ key = encodeURIComponent(key).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
13298
+ var stringifiedAttributes = "";
13299
+ for(var attributeName in attributes){
13300
+ if (!attributes[attributeName]) continue;
13301
+ stringifiedAttributes += "; " + attributeName;
13302
+ if (attributes[attributeName] === true) continue;
13303
+ // Considers RFC 6265 section 5.2:
13304
+ // ...
13305
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
13306
+ // character:
13307
+ // Consume the characters of the unparsed-attributes up to,
13308
+ // not including, the first %x3B (";") character.
13309
+ // ...
13310
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
13311
+ }
13312
+ return document.cookie = key + "=" + converter.write(value, key) + stringifiedAttributes;
13313
+ }
13314
+ function get(key) {
13315
+ if (typeof document === "undefined" || arguments.length && !key) return;
13316
+ // To prevent the for loop in the first place assign an empty array
13317
+ // in case there are no cookies at all.
13318
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
13319
+ var jar = {};
13320
+ for(var i = 0; i < cookies.length; i++){
13321
+ var parts = cookies[i].split("=");
13322
+ var value = parts.slice(1).join("=");
13323
+ try {
13324
+ var foundKey = decodeURIComponent(parts[0]);
13325
+ jar[foundKey] = converter.read(value, foundKey);
13326
+ if (key === foundKey) break;
13327
+ } catch (e) {}
13328
+ }
13329
+ return key ? jar[key] : jar;
13330
+ }
13331
+ return Object.create({
13332
+ set: set,
13333
+ get: get,
13334
+ remove: function(key, attributes) {
13335
+ set(key, "", assign({}, attributes, {
13336
+ expires: -1
13337
+ }));
13338
+ },
13339
+ withAttributes: function(attributes) {
13340
+ return init(this.converter, assign({}, this.attributes, attributes));
13341
+ },
13342
+ withConverter: function(converter) {
13343
+ return init(assign({}, this.converter, converter), this.attributes);
13344
+ }
13345
+ }, {
13346
+ attributes: {
13347
+ value: Object.freeze(defaultAttributes)
13348
+ },
13349
+ converter: {
13350
+ value: Object.freeze(converter)
13351
+ }
13352
+ });
13353
+ }
13354
+ var api = init(defaultConverter, {
13355
+ path: "/"
13356
+ });
13357
+ /* eslint-enable no-var */ return api;
13358
+ });
13359
+
13360
+
13361
+
13362
+ function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name , value: value }) {
13363
+ return {
13364
+ name: name,
13365
+ value: value,
13366
+ init () {
13367
+ this.$watch("value", ()=>this.update());
13368
+ },
13369
+ update () {
13370
+ (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
13371
+ const searchParams = new URLSearchParams(window.location.search);
13372
+ const display = searchParams.get("_display");
13373
+ const displayParams = display ? (0, $7ae6ae39c2ec9059$export$f720fd0ddbeb53d9)(display) : {};
13374
+ displayParams[this.name] = this.value;
13375
+ searchParams.set("_display", (0, $7ae6ae39c2ec9059$export$c788aab010beeaec)(displayParams));
13376
+ const path = location.href.replace(location.search, "");
13377
+ this.navigateTo(`${path}?${searchParams.toString()}`);
13378
+ }
13379
+ };
13380
+ }
13381
+
13382
+
13383
13383
  var $9b24cbeb3a465447$exports = {};
13384
13384
 
13385
13385
  $parcel$defineInteropFlag($9b24cbeb3a465447$exports);
@@ -13469,13 +13469,13 @@ function $e773f8ef556b41ff$export$2e2bcd8739ae039() {
13469
13469
  }
13470
13470
 
13471
13471
 
13472
- $f3e1e32f4a1bd6da$exports = {
13473
- "display_options": {
13474
- "field": $6a9b69d9cc7f810f$exports
13475
- },
13472
+ $2af7656449ff0341$exports = {
13476
13473
  "embed": {
13477
13474
  "inspector": $c299e36fa9e271bc$exports
13478
13475
  },
13476
+ "display_options": {
13477
+ "field": $6a9b69d9cc7f810f$exports
13478
+ },
13479
13479
  "nav": {
13480
13480
  "item": $9b24cbeb3a465447$exports
13481
13481
  },
@@ -13550,7 +13550,7 @@ const $939f2ad3cd685486$var$prefix = window.APP_NAME;
13550
13550
  (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
13551
13551
  [
13552
13552
  $77553f14666631eb$exports,
13553
- $f3e1e32f4a1bd6da$exports,
13553
+ $2af7656449ff0341$exports,
13554
13554
  $6c10158820e535ef$exports
13555
13555
  ].forEach((scripts)=>{
13556
13556
  const components = (0, $5439cede634b2921$export$4e811121b221213b)(scripts);