lookbook 2.3.15 → 2.3.17

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: d5a85affe60f5fd947084e2c37d9b3b2c890d06154c6ed590eadc60e2a746bcf
4
- data.tar.gz: 61d5068624400dab7d06e416dbf4d8d0f24e66f08de76b3dfb7ef8b697d2e72c
3
+ metadata.gz: a1c5d68258ed8dd2f0bfc5b3cffe4860f6a2df45d0d4c57e12304e5e5bdfe6cf
4
+ data.tar.gz: 667ada787ec847eea4b49efe25c2ead39e4c0da8a61ba08e6effc909e924bbe0
5
5
  SHA512:
6
- metadata.gz: 3a8e91869fab5fb896037f16bf6b3a4be2b9eb513e9b1bf687f55211db8e72776755911781b12f100da44bcbfbb1c628f1299005a0e667e008d0ec6719f4ba57
7
- data.tar.gz: b7bf24501f66b9ae6876604261b47dd6787d96bd75d93ee5ed8261c5da90956ee103404441914a7ceb8295f641c83c3c5da2e7420a574c04be7c07cda1f75b68
6
+ metadata.gz: b65daee7c638c7935fead83d1b66a90718ad0484867d328c71c91c34bcd0deb0fd2324d8bdc8386913adf470f1237c48682b8fcb030002d31e78d358e23ebe4f
7
+ data.tar.gz: 1f7759fb195757c9655399e67308f586acd01e89dbd282fbcbe54f5587914abf21f410a3ce3f43d01bb6469a3ebf999bf1970d1c4bcc13d4e285ef7524cdc4dc
@@ -10,7 +10,7 @@ module Lookbook
10
10
  landing = Engine.pages.find(&:landing?) || Engine.pages.first
11
11
  raise_not_found("Page not found") unless landing.present?
12
12
 
13
- redirect_to lookbook_page_path(landing.path)
13
+ redirect_to lookbook_page_path(landing.lookup_path)
14
14
  end
15
15
 
16
16
  def show
@@ -33,6 +33,11 @@ module Lookbook
33
33
  end
34
34
  end
35
35
 
36
+ # Cached component classes go stale when Rails reloads app/components.
37
+ config.to_prepare do
38
+ UiElementsHelper::COMPONENT_CLASSES.clear
39
+ end
40
+
36
41
  config.after_initialize do
37
42
  if opts.using_view_component
38
43
  vc_config = Engine.host_config.view_component
@@ -74,9 +74,9 @@ module Lookbook
74
74
 
75
75
  # @api private
76
76
  def component_class(ref)
77
+ ref = ref.to_s.tr("-", "_")
77
78
  klass = COMPONENT_CLASSES[ref]
78
79
  if klass.nil?
79
- ref = ref.to_s.tr("-", "_")
80
80
  class_namespace = ref.camelize
81
81
  begin
82
82
  klass = "Lookbook::#{class_namespace}::Component".constantize
@@ -1,5 +1,5 @@
1
1
  require "rouge"
2
- require "htmlentities"
2
+ require "cgi/escape"
3
3
 
4
4
  module Lookbook
5
5
  class CodeHighlighter < Service
@@ -15,8 +15,7 @@ module Lookbook
15
15
  end
16
16
 
17
17
  def call
18
- coder = HTMLEntities.new
19
- decoded_source = coder.decode(source)
18
+ decoded_source = CGI.unescapeHTML(source)
20
19
  language = opts.fetch(:language, "ruby")
21
20
  formatter = LookbookFormatter.new(language: language, **opts)
22
21
  lexer = Rouge::Lexer.find(language.to_s) || Rouge::Lexer.find("plaintext")
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "2.3.15"
2
+ VERSION = "2.3.17"
3
3
  end
@@ -3457,19 +3457,20 @@ function $a5acee56471cec18$export$9a6132153fba2e0(Alpine) {
3457
3457
  console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");
3458
3458
  let dummy = /* @__PURE__ */ new Map();
3459
3459
  storage = {
3460
- getItem: dummy.get.bind(dummy),
3460
+ getItem: (key)=>dummy.has(key) ? dummy.get(key) : null,
3461
3461
  setItem: dummy.set.bind(dummy)
3462
3462
  };
3463
3463
  }
3464
- return Alpine.interceptor((initialValue, getter, setter, path, key)=>{
3464
+ return Alpine.interceptor((initialValue, getter, setter, path, key, cleanup = ()=>{})=>{
3465
3465
  let lookup = alias || `_x_${path}`;
3466
3466
  let initial = $a5acee56471cec18$var$storageHas(lookup, storage) ? $a5acee56471cec18$var$storageGet(lookup, storage) : initialValue;
3467
3467
  setter(initial);
3468
- Alpine.effect(()=>{
3468
+ let effect = Alpine.effect(()=>{
3469
3469
  let value = getter();
3470
3470
  $a5acee56471cec18$var$storageSet(lookup, value, storage);
3471
3471
  setter(value);
3472
3472
  });
3473
+ cleanup(()=>Alpine.release(effect));
3473
3474
  return initial;
3474
3475
  }, (func)=>{
3475
3476
  func.as = (key)=>{
@@ -3496,7 +3497,8 @@ function $a5acee56471cec18$export$9a6132153fba2e0(Alpine) {
3496
3497
  };
3497
3498
  }
3498
3499
  function $a5acee56471cec18$var$storageHas(key, storage) {
3499
- return storage.getItem(key) !== null;
3500
+ let value = storage.getItem(key);
3501
+ return value !== null && value !== void 0;
3500
3502
  }
3501
3503
  function $a5acee56471cec18$var$storageGet(key, storage) {
3502
3504
  let value = storage.getItem(key);
@@ -3504,6 +3506,10 @@ function $a5acee56471cec18$var$storageGet(key, storage) {
3504
3506
  return JSON.parse(value);
3505
3507
  }
3506
3508
  function $a5acee56471cec18$var$storageSet(key, value, storage) {
3509
+ if (value === void 0) {
3510
+ storage.removeItem?.(key);
3511
+ return;
3512
+ }
3507
3513
  storage.setItem(key, JSON.stringify(value));
3508
3514
  }
3509
3515
  // packages/persist/builds/module.js