lookbook 0.8.0.beta.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa9a6048a7c6da30fcf5fe7c42a0a41365c3964da88d1d639a640c1acdd97a95
4
- data.tar.gz: dbbf4e04289ccadde4f37453123aabc70d982104b6933b3e139b0c65ea2a68f4
3
+ metadata.gz: 79511e3188b92969dfb927515e82464ad712490ed56d4651316f237f2792d9be
4
+ data.tar.gz: 7afbe921d118e685c4d7ec1619f9431296099a9690947baca8bc041b609e8b46
5
5
  SHA512:
6
- metadata.gz: a9eea08255c6263b84d6212d88d4a08ac425377eb1b0f42e4c5e626e04e1281e711c3ba41df98b550e3777b4e292824884ecd5e05b733db97126ccb6ba4cd100
7
- data.tar.gz: 8b48c299198427e2e957eb6c3dcccf6ae1544a921ef5ae4ba37fad558dd0274a1f864e9b8a37fb5b76a49c275f74f5a73e3363a8c6c4d4092a380639b99798e8
6
+ metadata.gz: e300adbcb09915cb48862621e6809a5713c8250e9122c109b3eaadcf770c1c11f4ac7865a78caac233b452f38ca05e499899baf07edcce82d499b3110c4580dc
7
+ data.tar.gz: 4385b86b3115d4ed88d13f8d7b2cb57a15792ac8ccdeb526ff6ffe3a2e35d45b6047b17b10d322d711d7087b26af7f7352aec717f01932263118fd75d40aa475
data/README.md CHANGED
@@ -541,7 +541,7 @@ config.lookbook.page_options = {
541
541
  footer: false,
542
542
  data: {
543
543
  brand_colors: {
544
- red: #ff0000
544
+ red: "#ff0000"
545
545
  }
546
546
  }
547
547
  }
@@ -704,8 +704,10 @@ rake lookbook:previews:preparse
704
704
  If you wish to run this as part of your existing assets precompilation step, you can add the following into your app's `Rakefile`:
705
705
 
706
706
  ```ruby
707
- Rake::Task['assets:precompile'].enhance do
708
- Rake::Task["lookbook:previews:preparse"].invoke
707
+ if Rails.env.production?
708
+ Rake::Task['assets:precompile'].enhance do
709
+ Rake::Task["lookbook:previews:preparse"].invoke
710
+ end
709
711
  end
710
712
  ```
711
713
 
@@ -3,13 +3,24 @@ import config from "../config";
3
3
  export default function createSidebarStore(Alpine) {
4
4
  const { defaultWidth, minWidth, maxWidth } = config.sidebar;
5
5
  return {
6
- open: Alpine.$persist(true).as("sidebar-open"),
6
+ openDesktop: Alpine.$persist(true).as("sidebar-open-desktop"),
7
+ openMobile: Alpine.$persist(false).as("sidebar-open-mobile"),
7
8
  width: Alpine.$persist(defaultWidth).as("sidebar-width"),
8
9
  panelSplits: Alpine.$persist([1.0, 1.0]).as(`sidebar-panel-splits`),
9
10
  minWidth,
10
11
  maxWidth,
12
+ get open() {
13
+ return Alpine.store("sidebar")[
14
+ Alpine.store("layout").desktop ? "openDesktop" : "openMobile"
15
+ ];
16
+ },
11
17
  toggle() {
12
- Alpine.store("sidebar").open = !Alpine.store("sidebar").open;
18
+ const sidebar = Alpine.store("sidebar");
19
+ if (Alpine.store("layout").desktop) {
20
+ sidebar.openDesktop = !sidebar.openDesktop;
21
+ } else {
22
+ sidebar.openMobile = !sidebar.openMobile;
23
+ }
13
24
  },
14
25
  };
15
26
  }
@@ -47,6 +47,9 @@ module Lookbook
47
47
  if params[:path] == @preview&.lookup_path
48
48
  redirect_to show_path "#{params[:path]}/#{@preview.default_example.name}"
49
49
  end
50
+ else
51
+ first_example = Lookbook.previews.find(params[:path])&.examples&.first
52
+ redirect_to show_path(first_example.lookup_path) if first_example
50
53
  end
51
54
  end
52
55
 
@@ -143,9 +146,8 @@ module Lookbook
143
146
  end
144
147
 
145
148
  def preview_controller
146
- return @preview_controller if @preview_controller.present?
147
- controller_class = Lookbook.config.preview_controller.constantize
148
- controller = controller_class.new
149
+ return @preview_controller if @preview_controller
150
+ controller = Lookbook::Engine.preview_controller.new
149
151
  controller.request = request
150
152
  controller.response = response
151
153
  @preview_controller ||= controller
@@ -76,9 +76,6 @@ module Lookbook
76
76
  end
77
77
 
78
78
  config.after_initialize do
79
- preview_controller = Lookbook.config.preview_controller.constantize
80
- preview_controller.class_eval { include Lookbook::PreviewController }
81
-
82
79
  if config.lookbook.listen
83
80
  @preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(rb|html.*)$/) do |modified, added, removed|
84
81
  begin
@@ -154,6 +151,13 @@ module Lookbook
154
151
  def parser
155
152
  @parser ||= Lookbook::Parser.new(config.lookbook.preview_paths, config.lookbook.parser_registry_path)
156
153
  end
154
+
155
+ def preview_controller
156
+ return @preview_controller if @preview_controller
157
+ controller = Lookbook.config.preview_controller.constantize
158
+ controller.class_eval { include Lookbook::PreviewController }
159
+ @preview_controller || controller
160
+ end
157
161
  end
158
162
  end
159
163
  end
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "0.8.0.beta.0"
2
+ VERSION = "0.8.0"
3
3
  end