lookbook 1.0.0.rc.1 → 1.0.0
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/README.md +22 -53
- data/app/assets/lookbook/js/components/clipboard.js +1 -1
- data/app/components/lookbook/base_component.rb +1 -1
- data/app/components/lookbook/embed/component.html.erb +1 -1
- data/app/components/lookbook/params_editor/field/component.html.erb +3 -4
- data/app/components/lookbook/params_editor/field/component.rb +5 -3
- data/app/controllers/lookbook/application_controller.rb +1 -0
- data/lib/lookbook/engine.rb +0 -1
- data/lib/lookbook/preview_controller.rb +1 -1
- data/lib/lookbook/version.rb +1 -1
- data/lib/tasks/lookbook_tasks.rake +0 -29
- data/public/lookbook-assets/css/themes/zinc.css.map.91837.5 +1 -0
- data/public/lookbook-assets/js/embed.js.91837.6 +0 -0
- data/public/lookbook-assets/js/lookbook.js +1 -1
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5617d397419ae8b9e95fa6c53ceb94dd3a7dffe83ea1fae0f643f17f6c15b995
|
4
|
+
data.tar.gz: 1fb037740def1192fa5aa9d0c076419dc06ed629996e7cc82ed741e7aefa000f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5710f8a40f7594bc4d9ac3347ca8c04102f708b50c21d96d1695b26ab4d6ccc23436e1288cea7d43516264260c31f091530cb15d3ea144707d2ae280442c333
|
7
|
+
data.tar.gz: 1bfdcf6ce5bb68e2af399b5920ec821a73057e77aaf4732216da498b1745c5c8eb15b220ce56115dd8c14d757febe75315c2620c6c6c929b3e973d001a5b7797
|
data/README.md
CHANGED
@@ -1,83 +1,52 @@
|
|
1
|
-
# Lookbook
|
1
|
+
# Lookbook
|
2
2
|
|
3
3
|
<div>
|
4
4
|
<a href="https://rubygems.org/gems/lookbook"><img src="https://img.shields.io/gem/v/lookbook?include_prereleases" alt="Gem version"></a>
|
5
|
-
<img src="https://github.com/allmarkedup/lookbook/actions/workflows/ci.yml/badge.svg?branch=
|
5
|
+
<a href="https://github.com/allmarkedup/lookbook/actions/workflows/ci.yml"><img src="https://github.com/allmarkedup/lookbook/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status"></a>
|
6
6
|
</div>
|
7
7
|
<br>
|
8
8
|
|
9
|
-
|
10
|
-
>_For code and documentation for the current stable release see the [main branch](https://github.com/allmarkedup/lookbook/tree/main)._
|
9
|
+
A tool to help develop, test and document [ViewComponents](https://viewcomponent.org/) in isolation.
|
11
10
|
|
11
|
+
## Documentation
|
12
12
|
|
13
|
-
|
13
|
+
**Lookbook (v1.x)** documentation: **[https://lookbook.build](https://lookbook.build)**
|
14
14
|
|
15
|
-
|
15
|
+
> _Looking for v0.9.x docs? [Head over here](https://github.com/allmarkedup/lookbook/tree/0.9.x)._
|
16
16
|
|
17
|
-
```ruby
|
18
|
-
gem "lookbook", ">= 1.0.0.beta.8"
|
19
|
-
```
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<h4>Useful Resources</h4>
|
25
|
-
|
26
|
-
* 👉 <a href="https://beta.lookbook.build/">v1.0 docs</a>
|
27
|
-
* 👉 <a href="https://lookbook-demo-app-v1-0-beta.herokuapp.com/lookbook">v1.0 demo app</a> <em>(The repo for the demo <a href="https://github.com/allmarkedup/lookbook-demo/tree/v1.0-beta">is here</a> if you want to dig in further)</em>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
## Changes and new features in v1.0
|
32
|
-
|
33
|
-
Lookbook v1.0 includes a completely re-written UI, many under-the hood improvements and a some exciting new customisation options.
|
34
|
-
|
35
|
-
### Frontend changes:
|
36
|
-
|
37
|
-
* Completely re-written UI - now built with ViewComponents
|
38
|
-
* New [UI themes and customisation options](https://beta.lookbook.build/guide/themes/)
|
39
|
-
* Improved small-screen/mobile view
|
40
|
-
* Debug menu
|
41
|
-
* ...and many other small visual and usability improvements
|
42
|
-
|
43
|
-
### New options for extending Lookbook:
|
44
|
-
|
45
|
-
* Define [custom tags](https://beta.lookbook.build/guide/extend/tags/) for preview file annotations
|
46
|
-
* Create [your own tab panels](https://beta.lookbook.build/guide/extend/panels/) - with complete control over content/layout and access to all Lookbook data
|
47
|
-
* Use [lifecycle hooks](https://beta.lookbook.build/guide/extend/hooks/) to run your own code when Lookbook starts up, when files change or at shutdown
|
48
|
-
|
49
|
-
### Other changes
|
50
|
-
|
51
|
-
* 'Workbench' app for developing Lookbook's UI components in Lookbook
|
52
|
-
* New Rspec-based test suite and dummy app
|
53
|
-
* All new documentation site built using [Bridgetown](https://www.bridgetownrb.com/)
|
18
|
+
## Demo
|
54
19
|
|
20
|
+
**Online Demo:** [https://lookbook-demo-app-v1-0-beta.herokuapp.com/lookbook](https://lookbook-demo-app-v1-0-beta.herokuapp.com/lookbook)
|
55
21
|
|
56
22
|
[](https://lookbook-demo-app-v1-0-beta.herokuapp.com/lookbook/)
|
57
23
|
|
58
|
-
## Workbench
|
59
24
|
|
60
|
-
|
25
|
+
## Development
|
26
|
+
|
27
|
+
Lookbook's UI is itself built using ViewComponents. To preview these components in a Lookbook instance you can run the included `workbench` app:
|
61
28
|
|
62
29
|
1. Clone this repo
|
63
30
|
2. Install dependencies: `bundle install & npm install`
|
64
|
-
3. Start the
|
65
|
-
4.
|
31
|
+
3. Start the app: `bin/workbench`
|
32
|
+
4. Visit http://localhost:4545/lookbook to view the Lookbook instance
|
33
|
+
|
34
|
+
The `workbench` app will be started in development mode and any changes to Lookbook's views or assets will immediately be reflected in the UI.
|
66
35
|
|
67
|
-
|
36
|
+
### Docs site
|
68
37
|
|
38
|
+
The [Lookbook docs site](https://lookbook.build) is built using [Bridgetown](https://www.bridgetownrb.com/) and the source files can be found in the `./docs` directory.
|
69
39
|
|
70
|
-
|
40
|
+
To see a local version of the site run `bin/docs` from the root of this repo and then visit http://localhost:4000 in your browser.
|
71
41
|
|
72
|
-
|
42
|
+
### Testing
|
73
43
|
|
74
|
-
|
44
|
+
Lookbook uses RSpec for testing.
|
75
45
|
|
76
|
-
|
77
|
-
- The dummy app that the tests are being run against can be viewed by running the `rake lookbook:test:serve` command and then browsing to http://localhost:9292/lookbook
|
46
|
+
Tests can be run using the `rake spec` or `bundle exec rspec` commands.
|
78
47
|
|
48
|
+
The dummy app that the tests are being run against can be viewed by running the `bin/dummy` command and then browsing to http://localhost:9292/lookbook
|
79
49
|
|
80
|
-
---
|
81
50
|
|
82
51
|
## License
|
83
52
|
|
@@ -19,7 +19,7 @@ function initClipboard(context = {}) {
|
|
19
19
|
return false;
|
20
20
|
}
|
21
21
|
|
22
|
-
const content = decodeEntities(targetEl.
|
22
|
+
const content = decodeEntities(targetEl.innerHTML.trim());
|
23
23
|
|
24
24
|
await window.navigator.clipboard.writeText(content);
|
25
25
|
this.copied = true;
|
@@ -35,7 +35,7 @@ module Lookbook
|
|
35
35
|
alpine_component_name = x_data || @html_attrs&.dig(:"x-data") || alpine_component
|
36
36
|
if alpine_component_name.present?
|
37
37
|
args = Array.wrap(alpine_data)
|
38
|
-
args.any? ? "#{alpine_component_name}(#{safe_join(args)
|
38
|
+
args.any? ? "#{alpine_component_name}(#{safe_join(args)})" : alpine_component_name
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
href: lookbook_inspect_path(@example.path, @params),
|
14
14
|
tooltip: "View in Inspector" %>
|
15
15
|
<% group.button icon: :external_link,
|
16
|
-
href:
|
16
|
+
href: lookbook_preview_path(@example.path, @params),
|
17
17
|
tooltip: "Open in new window",
|
18
18
|
target: "_blank" %>
|
19
19
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= render_component_tag class: "px-4 py-3" do %>
|
2
2
|
<div class="flex items-start max-w-[800px]" :class="isNarrowLayout && '!block'">
|
3
3
|
<label
|
4
|
-
for="param-<%=
|
4
|
+
for="param-<%= name %>"
|
5
5
|
class="block font-bold cursor-pointer flex-none py-2 w-[140px] truncate pr-2">
|
6
6
|
<%= label %>
|
7
7
|
</label>
|
@@ -27,12 +27,12 @@
|
|
27
27
|
<select
|
28
28
|
class="form-input"
|
29
29
|
x-bind="bindings.input || {}"
|
30
|
-
x-model="value"
|
30
|
+
x-model="value"
|
31
|
+
name="<%= name %>">
|
31
32
|
<%= options_for_select(@options || [], value) %>
|
32
33
|
</select>
|
33
34
|
|
34
35
|
<% elsif field_type == "toggle" %>
|
35
|
-
|
36
36
|
<button type="button"
|
37
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
38
|
role="switch"
|
@@ -42,7 +42,6 @@
|
|
42
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
43
|
></span>
|
44
44
|
</button>
|
45
|
-
|
46
45
|
<% end %>
|
47
46
|
</div>
|
48
47
|
</div>
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Lookbook
|
2
2
|
class ParamsEditor::Field::Component < Lookbook::BaseComponent
|
3
|
+
attr_reader :name
|
4
|
+
|
3
5
|
def initialize(input:, name:, default: nil, value: nil, input_type: nil, type: nil, options: nil, **html_attrs)
|
4
6
|
@input = input
|
5
7
|
@name = name
|
@@ -12,7 +14,7 @@ module Lookbook
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def label
|
15
|
-
|
17
|
+
name.titleize
|
16
18
|
end
|
17
19
|
|
18
20
|
def value
|
@@ -31,8 +33,8 @@ module Lookbook
|
|
31
33
|
protected
|
32
34
|
|
33
35
|
def alpine_data
|
34
|
-
escaped_value =
|
35
|
-
"{name: '#{
|
36
|
+
escaped_value = helpers.raw json_escape(value.to_json)
|
37
|
+
"{name: '#{name}', value: #{escaped_value}}"
|
36
38
|
end
|
37
39
|
|
38
40
|
def alpine_component
|
data/lib/lookbook/engine.rb
CHANGED
@@ -14,7 +14,7 @@ module Lookbook
|
|
14
14
|
render html: render_to_string(template, **opts)
|
15
15
|
end
|
16
16
|
|
17
|
-
def render_in_layout_to_string(template, locals,
|
17
|
+
def render_in_layout_to_string(template, locals, opts = {})
|
18
18
|
append_view_path Lookbook::Engine.root.join("app/views")
|
19
19
|
html = render_to_string(template, locals: locals, **determine_layout(opts[:layout]))
|
20
20
|
if opts[:append_html].present?
|
data/lib/lookbook/version.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
require_relative "../lookbook"
|
2
2
|
|
3
3
|
namespace :lookbook do
|
4
|
-
desc "Run the rspec tests"
|
5
|
-
task :test do
|
6
|
-
sh "bundle exec rspec"
|
7
|
-
end
|
8
|
-
|
9
|
-
namespace :test do
|
10
|
-
desc "Start a server to view the test app"
|
11
|
-
task :serve do
|
12
|
-
sh "bundle exec rackup"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
4
|
namespace :previews do
|
17
5
|
desc "Preparse the previews"
|
18
6
|
task preparse: :environment do
|
@@ -20,21 +8,4 @@ namespace :lookbook do
|
|
20
8
|
puts "Lookbook preview parsing complete"
|
21
9
|
end
|
22
10
|
end
|
23
|
-
|
24
|
-
namespace :release do
|
25
|
-
desc "Bump the Lookbook engine version number"
|
26
|
-
task :bump_version, [:version] do |t, args|
|
27
|
-
filename = Lookbook::Engine.root.join("lib/lookbook/version.rb")
|
28
|
-
current_version = Lookbook::VERSION.to_s
|
29
|
-
new_version = args[:version].sub("v", "").tr("-", ".")
|
30
|
-
file = File.open(filename)
|
31
|
-
contents = file.read
|
32
|
-
File.write(filename, contents.gsub(current_version, new_version))
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "Build Gem and push to RubyGems"
|
36
|
-
task :build_and_push do
|
37
|
-
sh("rake build && gem push pkg/lookbook-#{Lookbook::VERSION}.gem")
|
38
|
-
end
|
39
|
-
end
|
40
11
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AAAA","sources":["app/assets/lookbook/css/themes/zinc.css"],"sourcesContent":[":root {\n --lookbook-white: theme(\"colors.white\");\n --lookbook-accent-50: theme(\"colors.zinc.50\");\n --lookbook-accent-100: theme(\"colors.zinc.100\");\n --lookbook-accent-200: theme(\"colors.zinc.200\");\n --lookbook-accent-300: theme(\"colors.zinc.300\");\n --lookbook-accent-400: theme(\"colors.zinc.400\");\n --lookbook-accent-500: theme(\"colors.zinc.500\");\n --lookbook-accent-600: theme(\"colors.zinc.600\");\n --lookbook-accent-700: theme(\"colors.zinc.700\");\n --lookbook-accent-800: theme(\"colors.zinc.800\");\n --lookbook-accent-900: theme(\"colors.zinc.900\");\n --lookbook-base-50: theme(\"colors.zinc.50\");\n --lookbook-base-100: theme(\"colors.zinc.100\");\n --lookbook-base-200: theme(\"colors.zinc.200\");\n --lookbook-base-300: theme(\"colors.zinc.300\");\n --lookbook-base-400: theme(\"colors.zinc.400\");\n --lookbook-base-500: theme(\"colors.zinc.500\");\n --lookbook-base-600: theme(\"colors.zinc.600\");\n --lookbook-base-700: theme(\"colors.zinc.700\");\n --lookbook-base-800: theme(\"colors.zinc.800\");\n --lookbook-base-900: theme(\"colors.zinc.900\");\n --lookbook-text: var(--lookbook-base-800);\n --lookbook-divider: var(--lookbook-base-300);\n --lookbook-icon-button-stroke: var(--lookbook-base-400);\n --lookbook-icon-button-stroke-hover: var(--lookbook-accent-600);\n --lookbook-tooltip-bg: var(--lookbook-accent-500);\n --lookbook-tooltip-text: var(--lookbook-white);\n --lookbook-scrollbar: var(--lookbook-base-200);\n --lookbook-scrollbar-hover: var(--lookbook-base-300);\n --lookbook-toolbar-bg: var(--lookbook-white);\n --lookbook-toolbar-divider: var(--lookbook-divider);\n --lookbook-nav-text: var(--lookbook-text);\n --lookbook-nav-toggle: var(--lookbook-base-500);\n --lookbook-nav-icon-stroke: var(--lookbook-accent-500);\n --lookbook-nav-item-hover: var(--lookbook-base-100);\n --lookbook-nav-item-active: var(--lookbook-accent-50);\n --lookbook-input-bg: var(--lookbook-white);\n --lookbook-input-border: var(--lookbook-base-300);\n --lookbook-input-border-focus: var(--lookbook-accent-200);\n --lookbook-input-text: var(--lookbook-base-600);\n --lookbook-input-text-placeholder: var(--lookbook-base-400);\n --lookbook-input-toggle: var(--lookbook-base-300);\n --lookbook-input-toggle-active: var(--lookbook-accent-500);\n --lookbook-prose-bg: var(--lookbook-white);\n --lookbook-prose-text: var(--lookbook-base-600);\n --lookbook-prose-link: var(--lookbook-accent-900);\n --lookbook-tabs-text: var(--lookbook-base-500);\n --lookbook-tabs-text-hover: var(--lookbook-base-700);\n --lookbook-tabs-text-disabled: var(--lookbook-base-300);\n --lookbook-tabs-border-active: var(--lookbook-accent-400);\n --lookbook-viewport-handle: var(--lookbook-white);\n --lookbook-viewport-handle-icon-stroke: var(--lookbook-base-300);\n --lookbook-viewport-handle-icon-stroke-hover: var(--lookbook-base-700);\n --lookbook-sidebar-bg: var(--lookbook-base-50);\n --lookbook-page-bg: var(--lookbook-white);\n --lookbook-drawer-bg: var(--lookbook-base-50);\n --lookbook-header-bg: var(--lookbook-accent-600);\n --lookbook-header-text: var(--lookbook-white);\n --lookbook-header-border: var(--lookbook-accent-700);\n --lookbook-blank-slate-title: var(--lookbook-accent-600);\n --lookbook-branding-text: var(--lookbook-header-text);\n --lookbook-draggable-hint: rgb(224 231 255 / 0.2);\n}\n"],"names":[],"version":3,"file":"zinc.css.map","sourceRoot":"../../../../"}
|
File without changes
|
@@ -11421,7 +11421,7 @@ function $122263eab94cad08$export$c6684e6159b21de3(context = {}) {
|
|
11421
11421
|
this.warn("Could not find copy target");
|
11422
11422
|
return false;
|
11423
11423
|
}
|
11424
|
-
const content = (0, $7ae6ae39c2ec9059$export$6cb344a21ca18aec)(targetEl.
|
11424
|
+
const content = (0, $7ae6ae39c2ec9059$export$6cb344a21ca18aec)(targetEl.innerHTML.trim());
|
11425
11425
|
await window.navigator.clipboard.writeText(content);
|
11426
11426
|
this.copied = true;
|
11427
11427
|
if (copyTimeout) clearTimeout(copyTimeout);
|