lookbook 0.3.1 → 0.3.5
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 +4 -4
- data/app/controllers/lookbook/app_controller.rb +3 -3
- data/app/views/lookbook/app/index.html.erb +2 -2
- data/app/views/lookbook/app/show.html.erb +1 -1
- data/app/views/lookbook/layouts/app.html.erb +3 -3
- data/app/views/lookbook/nav/_collection.html.erb +4 -4
- data/app/views/lookbook/nav/_node.html.erb +2 -2
- data/app/views/lookbook/nav/_preview.html.erb +4 -4
- data/app/views/lookbook/shared/_header.html.erb +1 -1
- data/app/views/lookbook/{_sidebar.html.erb → shared/_sidebar.html.erb} +3 -3
- data/app/views/lookbook/{_workbench.html.erb → shared/_workbench.html.erb} +5 -5
- data/app/views/lookbook/workbench/_header.html.erb +2 -2
- data/app/views/lookbook/workbench/_inspector.html.erb +3 -3
- data/lib/lookbook/collection.rb +3 -3
- data/lib/lookbook/engine.rb +14 -4
- data/lib/lookbook/null_logger.rb +47 -0
- data/lib/lookbook/parser.rb +1 -1
- data/lib/lookbook/preview.rb +1 -3
- data/lib/lookbook/taggable.rb +5 -3
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +1 -0
- data/lib/tasks/lookbook_tasks.rake +1 -1
- data/public/lookbook-assets/app.css +102 -87
- data/public/lookbook-assets/app.js +329 -212
- metadata +5 -5
- data/lib/lookbook/navigation.rb +0 -68
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Perkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -207,8 +207,6 @@ files:
|
|
207
207
|
- app/channels/lookbook/reload_channel.rb
|
208
208
|
- app/controllers/lookbook/app_controller.rb
|
209
209
|
- app/helpers/lookbook/application_helper.rb
|
210
|
-
- app/views/lookbook/_sidebar.html.erb
|
211
|
-
- app/views/lookbook/_workbench.html.erb
|
212
210
|
- app/views/lookbook/app/error.html.erb
|
213
211
|
- app/views/lookbook/app/index.html.erb
|
214
212
|
- app/views/lookbook/app/not_found.html.erb
|
@@ -221,6 +219,8 @@ files:
|
|
221
219
|
- app/views/lookbook/preview_group.html.erb
|
222
220
|
- app/views/lookbook/shared/_clipboard.html.erb
|
223
221
|
- app/views/lookbook/shared/_header.html.erb
|
222
|
+
- app/views/lookbook/shared/_sidebar.html.erb
|
223
|
+
- app/views/lookbook/shared/_workbench.html.erb
|
224
224
|
- app/views/lookbook/workbench/_header.html.erb
|
225
225
|
- app/views/lookbook/workbench/_inspector.html.erb
|
226
226
|
- app/views/lookbook/workbench/_preview.html.erb
|
@@ -232,7 +232,7 @@ files:
|
|
232
232
|
- lib/lookbook/collection.rb
|
233
233
|
- lib/lookbook/engine.rb
|
234
234
|
- lib/lookbook/lang.rb
|
235
|
-
- lib/lookbook/
|
235
|
+
- lib/lookbook/null_logger.rb
|
236
236
|
- lib/lookbook/parser.rb
|
237
237
|
- lib/lookbook/preview.rb
|
238
238
|
- lib/lookbook/preview_controller.rb
|
data/lib/lookbook/navigation.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
module Lookbook
|
2
|
-
class Navigation
|
3
|
-
class << self
|
4
|
-
def previews
|
5
|
-
valid_previews = ViewComponent::Preview.all.filter { |preview| preview.get_visible_examples.any? && !preview.hidden? }
|
6
|
-
valid_previews.sort_by(&:normalized_name)
|
7
|
-
end
|
8
|
-
|
9
|
-
def flat
|
10
|
-
{
|
11
|
-
flat: true,
|
12
|
-
depth: 0,
|
13
|
-
items: previews.map do |preview|
|
14
|
-
nav_item_for_preview(preview, expand_name: true)
|
15
|
-
end
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
def nested
|
20
|
-
nav = {flat: false, depth: 0, items: []}
|
21
|
-
previews.each do |preview|
|
22
|
-
current = nav
|
23
|
-
depth = preview.path_parts.size
|
24
|
-
path = ""
|
25
|
-
preview.path_parts.each_with_index do |segment, i|
|
26
|
-
target = current[:items].find { |item| item[:name] == segment }
|
27
|
-
if target.nil?
|
28
|
-
path = "#{path.present? ? path + "." : ""}#{segment}"
|
29
|
-
target = {
|
30
|
-
depth: i + 1,
|
31
|
-
nested: true,
|
32
|
-
name: path,
|
33
|
-
label: segment.titleize,
|
34
|
-
type: :group,
|
35
|
-
items: []
|
36
|
-
}
|
37
|
-
current[:items].append(target)
|
38
|
-
end
|
39
|
-
if depth == i + 1
|
40
|
-
target[:items].push(nav_item_for_preview(preview))
|
41
|
-
else
|
42
|
-
current = target
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
nav
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def nav_item_for_preview(preview, expand_name: false)
|
52
|
-
{
|
53
|
-
name: preview.preview_name.tr("/", "."),
|
54
|
-
label: expand_name ? "#{preview.pretty_path}/#{preview.label}" : preview.label,
|
55
|
-
type: :preview,
|
56
|
-
examples: preview.get_visible_examples.map do |example|
|
57
|
-
example_path = "#{preview.preview_name}/#{example.name}"
|
58
|
-
{
|
59
|
-
name: example.name,
|
60
|
-
label: example.label,
|
61
|
-
path: example_path
|
62
|
-
}
|
63
|
-
end
|
64
|
-
}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|