lookbook 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/lookbook/css/lookbook.css +76 -2
- data/app/assets/lookbook/js/app.js +20 -2
- data/app/{components/lookbook/params_editor/field/component.js → assets/lookbook/js/components/params_input.js} +1 -14
- data/app/assets/lookbook/js/lookbook.js +2 -1
- data/app/components/lookbook/base_component.rb +2 -3
- data/app/components/lookbook/button/component.html.erb +2 -2
- data/app/components/lookbook/button/component.rb +6 -1
- data/app/components/lookbook/button_group/component.rb +3 -4
- data/app/components/lookbook/copy_button/component.html.erb +1 -1
- data/app/components/lookbook/debug_menu/component.html.erb +51 -0
- data/app/components/lookbook/debug_menu/component.rb +18 -0
- data/app/components/lookbook/embed/component.html.erb +3 -3
- data/app/components/lookbook/header/component.html.erb +19 -44
- data/app/components/lookbook/inspector_panel/component.html.erb +5 -3
- data/app/components/lookbook/inspector_panel/component.rb +6 -18
- data/app/components/lookbook/nav/component.js +4 -0
- data/app/components/lookbook/nav/component.rb +1 -1
- data/app/components/lookbook/nav/item/component.html.erb +4 -4
- data/app/components/lookbook/nav/item/component.rb +1 -1
- data/app/components/lookbook/page_tabs/component.html.erb +4 -4
- data/app/components/lookbook/page_tabs/component.rb +1 -1
- data/app/components/lookbook/params/editor/component.html.erb +21 -0
- data/app/components/lookbook/{params_editor → params/editor}/component.js +1 -1
- data/app/components/lookbook/params/editor/component.rb +40 -0
- data/app/components/lookbook/params/field/component.css +76 -0
- data/app/components/lookbook/params/field/component.html.erb +27 -0
- data/app/components/lookbook/params/field/component.js +7 -0
- data/app/components/lookbook/params/field/component.rb +101 -0
- data/app/components/lookbook/tabs/component.html.erb +2 -2
- data/app/components/lookbook/tag_component.rb +1 -0
- data/app/components/lookbook/viewport/component.css +1 -1
- data/app/components/lookbook/viewport/component.html.erb +11 -0
- data/app/controllers/lookbook/previews_controller.rb +1 -1
- data/app/helpers/lookbook/component_helper.rb +45 -26
- data/app/helpers/lookbook/page_helper.rb +1 -1
- data/app/views/layouts/lookbook/application.html.erb +18 -4
- data/app/views/layouts/lookbook/page.html.erb +4 -4
- data/app/views/layouts/lookbook/shell.html.erb +4 -4
- data/app/views/layouts/lookbook/skeleton.html.erb +0 -6
- data/app/views/lookbook/error.html.erb +1 -1
- data/app/views/lookbook/pages/show.html.erb +2 -2
- data/app/views/lookbook/previews/inputs/_color.html.erb +5 -0
- data/app/views/lookbook/previews/inputs/_range.html.erb +15 -0
- data/app/views/lookbook/previews/inputs/_select.html.erb +5 -0
- data/app/views/lookbook/previews/inputs/_text.html.erb +5 -0
- data/app/views/lookbook/previews/inputs/_textarea.html.erb +5 -0
- data/app/views/lookbook/previews/inputs/_toggle.html.erb +20 -0
- data/app/views/lookbook/previews/panels/_content.html.erb +2 -2
- data/app/views/lookbook/previews/panels/_notes.html.erb +2 -2
- data/app/views/lookbook/previews/panels/_output.html.erb +1 -1
- data/app/views/lookbook/previews/panels/_params.html.erb +3 -3
- data/app/views/lookbook/previews/panels/_preview.html.erb +1 -1
- data/app/views/lookbook/previews/panels/_source.html.erb +2 -2
- data/app/views/lookbook/previews/show.html.erb +13 -19
- data/lib/lookbook/config.rb +17 -1
- data/lib/lookbook/engine.rb +17 -7
- data/lib/lookbook/markdown.rb +1 -1
- data/lib/lookbook/panels.rb +14 -4
- data/lib/lookbook/params.rb +66 -35
- data/lib/lookbook/parser.rb +1 -0
- data/lib/lookbook/preview.rb +10 -4
- data/lib/lookbook/preview_controller.rb +11 -5
- data/lib/lookbook/preview_example.rb +2 -2
- data/lib/lookbook/source_inspector.rb +10 -4
- data/lib/lookbook/tag.rb +13 -3
- data/lib/lookbook/tag_options.rb +111 -0
- data/lib/lookbook/tags.rb +6 -2
- data/lib/lookbook/template_parser.rb +72 -0
- data/lib/lookbook/theme.rb +1 -1
- data/lib/lookbook/utils.rb +23 -0
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +2 -0
- data/public/lookbook-assets/css/lookbook.css +369 -126
- data/public/lookbook-assets/css/lookbook.css.map +1 -1
- data/public/lookbook-assets/js/embed.js +13 -13
- data/public/lookbook-assets/js/embed.js.map +1 -1
- data/public/lookbook-assets/js/lookbook.js +772 -687
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +42 -10
- data/app/components/lookbook/params_editor/component.html.erb +0 -3
- data/app/components/lookbook/params_editor/component.rb +0 -11
- data/app/components/lookbook/params_editor/field/component.html.erb +0 -49
- data/app/components/lookbook/params_editor/field/component.rb +0 -44
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Perkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: css_parser
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activemodel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: railties
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +98,22 @@ dependencies:
|
|
84
98
|
name: rouge
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - "
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '3.26'
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '5.0'
|
90
107
|
type: :runtime
|
91
108
|
prerelease: false
|
92
109
|
version_requirements: !ruby/object:Gem::Requirement
|
93
110
|
requirements:
|
94
|
-
- - "
|
111
|
+
- - ">="
|
95
112
|
- !ruby/object:Gem::Version
|
96
113
|
version: '3.26'
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '5.0'
|
97
117
|
- !ruby/object:Gem::Dependency
|
98
118
|
name: listen
|
99
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +185,7 @@ files:
|
|
165
185
|
- app/assets/lookbook/css/tooltip.css
|
166
186
|
- app/assets/lookbook/js/app.js
|
167
187
|
- app/assets/lookbook/js/components/clipboard.js
|
188
|
+
- app/assets/lookbook/js/components/params_input.js
|
168
189
|
- app/assets/lookbook/js/components/tooltip.js
|
169
190
|
- app/assets/lookbook/js/config.js
|
170
191
|
- app/assets/lookbook/js/embed.js
|
@@ -200,6 +221,8 @@ files:
|
|
200
221
|
- app/components/lookbook/copy_button/component.html.erb
|
201
222
|
- app/components/lookbook/copy_button/component.js
|
202
223
|
- app/components/lookbook/copy_button/component.rb
|
224
|
+
- app/components/lookbook/debug_menu/component.html.erb
|
225
|
+
- app/components/lookbook/debug_menu/component.rb
|
203
226
|
- app/components/lookbook/dimensions_display/component.html.erb
|
204
227
|
- app/components/lookbook/dimensions_display/component.js
|
205
228
|
- app/components/lookbook/dimensions_display/component.rb
|
@@ -226,12 +249,13 @@ files:
|
|
226
249
|
- app/components/lookbook/nav/item/component.rb
|
227
250
|
- app/components/lookbook/page_tabs/component.html.erb
|
228
251
|
- app/components/lookbook/page_tabs/component.rb
|
229
|
-
- app/components/lookbook/
|
230
|
-
- app/components/lookbook/
|
231
|
-
- app/components/lookbook/
|
232
|
-
- app/components/lookbook/
|
233
|
-
- app/components/lookbook/
|
234
|
-
- app/components/lookbook/
|
252
|
+
- app/components/lookbook/params/editor/component.html.erb
|
253
|
+
- app/components/lookbook/params/editor/component.js
|
254
|
+
- app/components/lookbook/params/editor/component.rb
|
255
|
+
- app/components/lookbook/params/field/component.css
|
256
|
+
- app/components/lookbook/params/field/component.html.erb
|
257
|
+
- app/components/lookbook/params/field/component.js
|
258
|
+
- app/components/lookbook/params/field/component.rb
|
235
259
|
- app/components/lookbook/prose/component.css
|
236
260
|
- app/components/lookbook/prose/component.html.erb
|
237
261
|
- app/components/lookbook/prose/component.rb
|
@@ -279,6 +303,12 @@ files:
|
|
279
303
|
- app/views/lookbook/index.html.erb
|
280
304
|
- app/views/lookbook/pages/show.html.erb
|
281
305
|
- app/views/lookbook/preview.html.erb
|
306
|
+
- app/views/lookbook/previews/inputs/_color.html.erb
|
307
|
+
- app/views/lookbook/previews/inputs/_range.html.erb
|
308
|
+
- app/views/lookbook/previews/inputs/_select.html.erb
|
309
|
+
- app/views/lookbook/previews/inputs/_text.html.erb
|
310
|
+
- app/views/lookbook/previews/inputs/_textarea.html.erb
|
311
|
+
- app/views/lookbook/previews/inputs/_toggle.html.erb
|
282
312
|
- app/views/lookbook/previews/panels/_content.html.erb
|
283
313
|
- app/views/lookbook/previews/panels/_notes.html.erb
|
284
314
|
- app/views/lookbook/previews/panels/_output.html.erb
|
@@ -314,7 +344,9 @@ files:
|
|
314
344
|
- lib/lookbook/source_inspector.rb
|
315
345
|
- lib/lookbook/store.rb
|
316
346
|
- lib/lookbook/tag.rb
|
347
|
+
- lib/lookbook/tag_options.rb
|
317
348
|
- lib/lookbook/tags.rb
|
349
|
+
- lib/lookbook/template_parser.rb
|
318
350
|
- lib/lookbook/theme.rb
|
319
351
|
- lib/lookbook/utils.rb
|
320
352
|
- lib/lookbook/version.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<%= render_component_tag class: "px-4 py-3" do %>
|
2
|
-
<div class="flex items-start max-w-[800px]" :class="isNarrowLayout && '!block'">
|
3
|
-
<label
|
4
|
-
for="param-<%= name %>"
|
5
|
-
class="block font-bold cursor-pointer flex-none py-2 w-[140px] truncate pr-2">
|
6
|
-
<%= label %>
|
7
|
-
</label>
|
8
|
-
|
9
|
-
<div class="flex-grow">
|
10
|
-
<% if field_type == "text" %>
|
11
|
-
|
12
|
-
<input
|
13
|
-
class="form-input"
|
14
|
-
value="<%= value %>"
|
15
|
-
type="<%= input_type %>"
|
16
|
-
x-bind="bindings.input || {}">
|
17
|
-
|
18
|
-
<% elsif field_type == "textarea" %>
|
19
|
-
|
20
|
-
<textarea
|
21
|
-
class="form-input"
|
22
|
-
rows="4"
|
23
|
-
x-bind="bindings.input || {}"><%= value %></textarea>
|
24
|
-
|
25
|
-
<% elsif field_type == "select" %>
|
26
|
-
|
27
|
-
<select
|
28
|
-
class="form-input"
|
29
|
-
x-bind="bindings.input || {}"
|
30
|
-
x-model="value"
|
31
|
-
name="<%= name %>">
|
32
|
-
<%= options_for_select(@options || [], value) %>
|
33
|
-
</select>
|
34
|
-
|
35
|
-
<% elsif field_type == "toggle" %>
|
36
|
-
<button type="button"
|
37
|
-
class="<%= value == true ? "bg-lookbook-input-toggle-active" : "bg-lookbook-input-toggle" %> relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-input-border-focus"
|
38
|
-
role="switch"
|
39
|
-
@click.stop="value = !value">
|
40
|
-
<span
|
41
|
-
aria-hidden="true"
|
42
|
-
class="<%= value == true ? "translate-x-5" : "translate-x-0" %> pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow ring-0 transition ease-in-out duration-200"
|
43
|
-
></span>
|
44
|
-
</button>
|
45
|
-
<% end %>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
<% end %>
|
49
|
-
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Lookbook
|
2
|
-
class ParamsEditor::Field::Component < Lookbook::BaseComponent
|
3
|
-
attr_reader :name
|
4
|
-
|
5
|
-
def initialize(input:, name:, default: nil, value: nil, input_type: nil, type: nil, options: nil, **html_attrs)
|
6
|
-
@input = input
|
7
|
-
@name = name
|
8
|
-
@value = value
|
9
|
-
@default_value = default
|
10
|
-
@input_type = input_type
|
11
|
-
@type = type
|
12
|
-
@options = options
|
13
|
-
super(**html_attrs)
|
14
|
-
end
|
15
|
-
|
16
|
-
def label
|
17
|
-
name.titleize
|
18
|
-
end
|
19
|
-
|
20
|
-
def value
|
21
|
-
val = @value.presence || @default_value
|
22
|
-
@type == "Boolean" ? val == "true" || val == true : val
|
23
|
-
end
|
24
|
-
|
25
|
-
def field_type
|
26
|
-
@input.to_s
|
27
|
-
end
|
28
|
-
|
29
|
-
def input_type
|
30
|
-
@input_type.nil? && field_type == "text" ? "text" : @input_type
|
31
|
-
end
|
32
|
-
|
33
|
-
protected
|
34
|
-
|
35
|
-
def alpine_data
|
36
|
-
escaped_value = json_escape(value.to_json)
|
37
|
-
"{name: '#{name}', value: #{escaped_value}}"
|
38
|
-
end
|
39
|
-
|
40
|
-
def alpine_component
|
41
|
-
"paramsEditorFieldComponent"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|