lookbook 0.4.6 → 0.4.7
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/assets/lookbook/css/app.css +55 -5
- data/app/assets/lookbook/js/app.js +38 -54
- data/app/assets/lookbook/js/components/copy.js +16 -0
- data/app/assets/lookbook/js/components/filter.js +24 -0
- data/app/assets/lookbook/js/components/inspector.js +21 -0
- data/app/assets/lookbook/js/{nav/node.js → components/nav-group.js} +16 -15
- data/app/assets/lookbook/js/components/nav-item.js +26 -0
- data/app/assets/lookbook/js/components/nav.js +35 -0
- data/app/assets/lookbook/js/components/page.js +33 -0
- data/app/assets/lookbook/js/{workbench → components}/param.js +3 -4
- data/app/assets/lookbook/js/{workbench/preview.js → components/preview-window.js} +9 -10
- data/app/assets/lookbook/js/components/sidebar.js +3 -0
- data/app/assets/lookbook/js/components/sizes.js +16 -0
- data/app/assets/lookbook/js/components/splitter.js +25 -0
- data/app/assets/lookbook/js/config.js +14 -0
- data/app/assets/lookbook/js/{utils/reloader.js → lib/socket.js} +7 -12
- data/app/assets/lookbook/js/lib/split.js +21 -0
- data/app/assets/lookbook/js/lib/utils.js +3 -0
- data/app/assets/lookbook/js/stores/filter.js +11 -0
- data/app/assets/lookbook/js/stores/inspector.js +17 -0
- data/app/assets/lookbook/js/stores/layout.js +12 -0
- data/app/assets/lookbook/js/stores/nav.js +21 -0
- data/app/assets/lookbook/js/stores/sidebar.js +14 -0
- data/app/controllers/lookbook/app_controller.rb +70 -97
- data/app/helpers/lookbook/application_helper.rb +48 -4
- data/app/views/layouts/lookbook/app.html.erb +54 -0
- data/app/views/layouts/lookbook/preview.html.erb +12 -0
- data/app/views/lookbook/components/_code.html.erb +8 -0
- data/app/views/lookbook/{shared/_clipboard.html.erb → components/_copy.html.erb} +4 -5
- data/app/views/lookbook/components/_filter.html.erb +15 -0
- data/app/views/lookbook/{shared → components}/_header.html.erb +3 -3
- data/app/views/lookbook/components/_icon.html.erb +5 -0
- data/app/views/lookbook/components/_nav.html.erb +17 -0
- data/app/views/lookbook/components/_nav_collection.html.erb +5 -0
- data/app/views/lookbook/components/_nav_group.html.erb +17 -0
- data/app/views/lookbook/components/_nav_item.html.erb +21 -0
- data/app/views/lookbook/components/_nav_preview.html.erb +11 -0
- data/app/views/lookbook/components/_param.html.erb +20 -0
- data/app/views/lookbook/{workbench → components}/_preview.html.erb +8 -8
- data/app/views/lookbook/{app/error.html.erb → error.html.erb} +0 -0
- data/app/views/lookbook/index.html.erb +9 -0
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_select.html.erb +1 -1
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_text.html.erb +1 -1
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_textarea.html.erb +1 -1
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_toggle.html.erb +1 -1
- data/app/views/lookbook/{app/not_found.html.erb → not_found.html.erb} +2 -4
- data/app/views/lookbook/panels/_notes.html.erb +25 -0
- data/app/views/lookbook/panels/_output.html.erb +18 -0
- data/app/views/lookbook/panels/_params.html.erb +17 -0
- data/app/views/lookbook/panels/_source.html.erb +20 -0
- data/app/views/lookbook/show.html.erb +90 -0
- data/lib/lookbook/code_formatter.rb +20 -0
- data/lib/lookbook/engine.rb +4 -1
- data/lib/lookbook/lang.rb +10 -5
- data/lib/lookbook/preview_controller.rb +1 -1
- data/lib/lookbook/preview_group.rb +5 -1
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +1 -0
- data/public/lookbook-assets/css/app.css +2 -0
- data/public/lookbook-assets/css/app.css.map +1 -0
- data/public/lookbook-assets/js/app.js +2 -0
- data/public/lookbook-assets/js/app.js.map +1 -0
- metadata +54 -43
- data/app/assets/lookbook/js/nav/leaf.js +0 -20
- data/app/assets/lookbook/js/nav.js +0 -38
- data/app/assets/lookbook/js/page.js +0 -38
- data/app/assets/lookbook/js/utils/clipboard.js +0 -13
- data/app/assets/lookbook/js/utils/morph.js +0 -19
- data/app/assets/lookbook/js/utils/screen.js +0 -44
- data/app/assets/lookbook/js/utils/size_observer.js +0 -16
- data/app/assets/lookbook/js/utils/split.js +0 -26
- data/app/assets/lookbook/js/workbench/inspector.js +0 -11
- data/app/assets/lookbook/js/workbench.js +0 -14
- data/app/views/lookbook/app/index.html.erb +0 -11
- data/app/views/lookbook/app/show.html.erb +0 -1
- data/app/views/lookbook/layouts/app.html.erb +0 -41
- data/app/views/lookbook/nav/_collection.html.erb +0 -5
- data/app/views/lookbook/nav/_leaf.html.erb +0 -22
- data/app/views/lookbook/nav/_node.html.erb +0 -19
- data/app/views/lookbook/nav/_preview.html.erb +0 -11
- data/app/views/lookbook/preview/group.html.erb +0 -8
- data/app/views/lookbook/shared/_sidebar.html.erb +0 -45
- data/app/views/lookbook/shared/_workbench.html.erb +0 -12
- data/app/views/lookbook/workbench/_header.html.erb +0 -39
- data/app/views/lookbook/workbench/_inspector.html.erb +0 -38
- data/app/views/lookbook/workbench/inspector/_code.html.erb +0 -3
- data/app/views/lookbook/workbench/inspector/_notes.html.erb +0 -24
- data/app/views/lookbook/workbench/inspector/_params.html.erb +0 -28
- data/app/views/lookbook/workbench/inspector/_plain.html.erb +0 -3
- data/public/lookbook-assets/app.css +0 -2626
- data/public/lookbook-assets/app.js +0 -8718
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.4.
|
|
4
|
+
version: 0.4.7
|
|
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-
|
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -190,52 +190,61 @@ files:
|
|
|
190
190
|
- app/assets/lookbook/css/code_theme.css
|
|
191
191
|
- app/assets/lookbook/css/tooltip_theme.css
|
|
192
192
|
- app/assets/lookbook/js/app.js
|
|
193
|
-
- app/assets/lookbook/js/
|
|
194
|
-
- app/assets/lookbook/js/
|
|
195
|
-
- app/assets/lookbook/js/
|
|
196
|
-
- app/assets/lookbook/js/
|
|
197
|
-
- app/assets/lookbook/js/
|
|
198
|
-
- app/assets/lookbook/js/
|
|
199
|
-
- app/assets/lookbook/js/
|
|
200
|
-
- app/assets/lookbook/js/
|
|
201
|
-
- app/assets/lookbook/js/
|
|
202
|
-
- app/assets/lookbook/js/
|
|
203
|
-
- app/assets/lookbook/js/
|
|
204
|
-
- app/assets/lookbook/js/
|
|
205
|
-
- app/assets/lookbook/js/
|
|
206
|
-
- app/assets/lookbook/js/
|
|
193
|
+
- app/assets/lookbook/js/components/copy.js
|
|
194
|
+
- app/assets/lookbook/js/components/filter.js
|
|
195
|
+
- app/assets/lookbook/js/components/inspector.js
|
|
196
|
+
- app/assets/lookbook/js/components/nav-group.js
|
|
197
|
+
- app/assets/lookbook/js/components/nav-item.js
|
|
198
|
+
- app/assets/lookbook/js/components/nav.js
|
|
199
|
+
- app/assets/lookbook/js/components/page.js
|
|
200
|
+
- app/assets/lookbook/js/components/param.js
|
|
201
|
+
- app/assets/lookbook/js/components/preview-window.js
|
|
202
|
+
- app/assets/lookbook/js/components/sidebar.js
|
|
203
|
+
- app/assets/lookbook/js/components/sizes.js
|
|
204
|
+
- app/assets/lookbook/js/components/splitter.js
|
|
205
|
+
- app/assets/lookbook/js/config.js
|
|
206
|
+
- app/assets/lookbook/js/lib/socket.js
|
|
207
|
+
- app/assets/lookbook/js/lib/split.js
|
|
208
|
+
- app/assets/lookbook/js/lib/utils.js
|
|
209
|
+
- app/assets/lookbook/js/stores/filter.js
|
|
210
|
+
- app/assets/lookbook/js/stores/inspector.js
|
|
211
|
+
- app/assets/lookbook/js/stores/layout.js
|
|
212
|
+
- app/assets/lookbook/js/stores/nav.js
|
|
213
|
+
- app/assets/lookbook/js/stores/sidebar.js
|
|
207
214
|
- app/channels/lookbook/connection.rb
|
|
208
215
|
- app/channels/lookbook/reload_channel.rb
|
|
209
216
|
- app/controllers/lookbook/app_controller.rb
|
|
210
217
|
- app/helpers/lookbook/application_helper.rb
|
|
211
218
|
- app/helpers/lookbook/preview_helper.rb
|
|
212
|
-
- app/views/lookbook/app
|
|
213
|
-
- app/views/lookbook/
|
|
214
|
-
- app/views/lookbook/
|
|
215
|
-
- app/views/lookbook/
|
|
216
|
-
- app/views/lookbook/
|
|
217
|
-
- app/views/lookbook/
|
|
218
|
-
- app/views/lookbook/
|
|
219
|
-
- app/views/lookbook/
|
|
220
|
-
- app/views/lookbook/
|
|
221
|
-
- app/views/lookbook/
|
|
222
|
-
- app/views/lookbook/
|
|
223
|
-
- app/views/lookbook/
|
|
224
|
-
- app/views/lookbook/
|
|
225
|
-
- app/views/lookbook/
|
|
226
|
-
- app/views/lookbook/
|
|
227
|
-
- app/views/lookbook/
|
|
228
|
-
- app/views/lookbook/
|
|
229
|
-
- app/views/lookbook/
|
|
230
|
-
- app/views/lookbook/
|
|
231
|
-
- app/views/lookbook/
|
|
232
|
-
- app/views/lookbook/
|
|
233
|
-
- app/views/lookbook/
|
|
234
|
-
- app/views/lookbook/
|
|
235
|
-
- app/views/lookbook/
|
|
236
|
-
- app/views/lookbook/
|
|
219
|
+
- app/views/layouts/lookbook/app.html.erb
|
|
220
|
+
- app/views/layouts/lookbook/preview.html.erb
|
|
221
|
+
- app/views/lookbook/components/_code.html.erb
|
|
222
|
+
- app/views/lookbook/components/_copy.html.erb
|
|
223
|
+
- app/views/lookbook/components/_filter.html.erb
|
|
224
|
+
- app/views/lookbook/components/_header.html.erb
|
|
225
|
+
- app/views/lookbook/components/_icon.html.erb
|
|
226
|
+
- app/views/lookbook/components/_nav.html.erb
|
|
227
|
+
- app/views/lookbook/components/_nav_collection.html.erb
|
|
228
|
+
- app/views/lookbook/components/_nav_group.html.erb
|
|
229
|
+
- app/views/lookbook/components/_nav_item.html.erb
|
|
230
|
+
- app/views/lookbook/components/_nav_preview.html.erb
|
|
231
|
+
- app/views/lookbook/components/_param.html.erb
|
|
232
|
+
- app/views/lookbook/components/_preview.html.erb
|
|
233
|
+
- app/views/lookbook/error.html.erb
|
|
234
|
+
- app/views/lookbook/index.html.erb
|
|
235
|
+
- app/views/lookbook/inputs/_select.html.erb
|
|
236
|
+
- app/views/lookbook/inputs/_text.html.erb
|
|
237
|
+
- app/views/lookbook/inputs/_textarea.html.erb
|
|
238
|
+
- app/views/lookbook/inputs/_toggle.html.erb
|
|
239
|
+
- app/views/lookbook/not_found.html.erb
|
|
240
|
+
- app/views/lookbook/panels/_notes.html.erb
|
|
241
|
+
- app/views/lookbook/panels/_output.html.erb
|
|
242
|
+
- app/views/lookbook/panels/_params.html.erb
|
|
243
|
+
- app/views/lookbook/panels/_source.html.erb
|
|
244
|
+
- app/views/lookbook/show.html.erb
|
|
237
245
|
- config/routes.rb
|
|
238
246
|
- lib/lookbook.rb
|
|
247
|
+
- lib/lookbook/code_formatter.rb
|
|
239
248
|
- lib/lookbook/collection.rb
|
|
240
249
|
- lib/lookbook/engine.rb
|
|
241
250
|
- lib/lookbook/features.rb
|
|
@@ -250,9 +259,11 @@ files:
|
|
|
250
259
|
- lib/lookbook/taggable.rb
|
|
251
260
|
- lib/lookbook/version.rb
|
|
252
261
|
- lib/tasks/lookbook_tasks.rake
|
|
253
|
-
- public/lookbook-assets/app.css
|
|
254
|
-
- public/lookbook-assets/app.
|
|
262
|
+
- public/lookbook-assets/css/app.css
|
|
263
|
+
- public/lookbook-assets/css/app.css.map
|
|
255
264
|
- public/lookbook-assets/feather-sprite.svg
|
|
265
|
+
- public/lookbook-assets/js/app.js
|
|
266
|
+
- public/lookbook-assets/js/app.js.map
|
|
256
267
|
homepage: https://github.com/allmarkedup/lookbook
|
|
257
268
|
licenses:
|
|
258
269
|
- MIT
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default function navLeaf() {
|
|
2
|
-
return {
|
|
3
|
-
path: null,
|
|
4
|
-
matchers: [],
|
|
5
|
-
active: false,
|
|
6
|
-
hidden: false,
|
|
7
|
-
setActive() {
|
|
8
|
-
this.active = this.path === window.location.pathname;
|
|
9
|
-
},
|
|
10
|
-
filter() {
|
|
11
|
-
if (this.$store.nav.filtering) {
|
|
12
|
-
const text = this.$store.nav.filterText;
|
|
13
|
-
const matched = this.matchers.map((m) => m.includes(text));
|
|
14
|
-
this.hidden = !matched.filter((m) => m).length;
|
|
15
|
-
} else {
|
|
16
|
-
this.hidden = false;
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import morph from "./utils/morph";
|
|
2
|
-
|
|
3
|
-
export default function () {
|
|
4
|
-
return {
|
|
5
|
-
clearFilter() {
|
|
6
|
-
this.$store.nav.filter = "";
|
|
7
|
-
},
|
|
8
|
-
init() {
|
|
9
|
-
this.$watch("$store.nav.filter", (value) => {
|
|
10
|
-
const nav = this.$store.nav;
|
|
11
|
-
nav.filterText = value.replace(/\s/g, "").toLowerCase();
|
|
12
|
-
nav.filtering = nav.filterText.length > 0;
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
updateNav(event) {
|
|
16
|
-
const nav = document.getElementById("nav");
|
|
17
|
-
nav.style.height = `${this.$refs.shim.offsetHeight}px`;
|
|
18
|
-
morph(nav, event.detail.doc.getElementById("nav"));
|
|
19
|
-
Promise.resolve().then(() => {
|
|
20
|
-
this.$refs.shim.style.height = "auto";
|
|
21
|
-
this.$dispatch("nav:updated");
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
navigate(path) {
|
|
25
|
-
this.navigateTo(path instanceof Event ? path.currentTarget.href : path);
|
|
26
|
-
},
|
|
27
|
-
focusFilter($event) {
|
|
28
|
-
if ($event.target.tagName === "INPUT") {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.currentFocus = this.$refs.filter;
|
|
32
|
-
setTimeout(() => this.$refs.filter.focus(), 0);
|
|
33
|
-
},
|
|
34
|
-
unfocusFilter() {
|
|
35
|
-
this.$refs.filter.blur();
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import morph from "./utils/morph";
|
|
2
|
-
|
|
3
|
-
export default function page() {
|
|
4
|
-
const store = Alpine.store("page");
|
|
5
|
-
return {
|
|
6
|
-
ready: false,
|
|
7
|
-
sidebarOpenMobile: false,
|
|
8
|
-
init() {
|
|
9
|
-
this.$nextTick(() => (this.ready = true));
|
|
10
|
-
},
|
|
11
|
-
splitProps: {
|
|
12
|
-
minSize: 200,
|
|
13
|
-
onDrag(splits) {
|
|
14
|
-
Alpine.store("nav").width = Math.min(splits[0], 500);
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
async fetchHTML() {
|
|
18
|
-
const response = await fetch(window.document.location);
|
|
19
|
-
if (!response.ok) return window.location.reload();
|
|
20
|
-
const html = await response.text();
|
|
21
|
-
store.doc = new DOMParser().parseFromString(html, "text/html");
|
|
22
|
-
return store.doc;
|
|
23
|
-
},
|
|
24
|
-
updateTitle() {
|
|
25
|
-
document.title = store.doc.title;
|
|
26
|
-
},
|
|
27
|
-
render() {
|
|
28
|
-
if (this.ready) {
|
|
29
|
-
morph(this.$el, store.doc.getElementById(this.$el.id));
|
|
30
|
-
this.$dispatch("document:patched");
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
navigateTo(path) {
|
|
34
|
-
history.pushState({}, null, path);
|
|
35
|
-
this.$dispatch("popstate");
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import morph from "morphdom";
|
|
2
|
-
|
|
3
|
-
export default function (from, to, opts = {}) {
|
|
4
|
-
morph(from, to, {
|
|
5
|
-
onBeforeElUpdated: function (fromEl, toEl) {
|
|
6
|
-
if (fromEl._x_dataStack) {
|
|
7
|
-
Alpine.clone(fromEl, toEl);
|
|
8
|
-
}
|
|
9
|
-
if (fromEl.isEqualNode(toEl)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (fromEl.hasAttribute("skip-morph")) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
},
|
|
17
|
-
...opts,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Adapted from: https://github.com/alpine-collective/toolkit
|
|
2
|
-
|
|
3
|
-
export default function (Alpine) {
|
|
4
|
-
// Create reactive data context
|
|
5
|
-
let data = Alpine.reactive({ screensize: window.innerWidth });
|
|
6
|
-
|
|
7
|
-
// Configuration
|
|
8
|
-
const defaultBreakpoints = {
|
|
9
|
-
xs: 0,
|
|
10
|
-
sm: 640,
|
|
11
|
-
md: 768,
|
|
12
|
-
lg: 1024,
|
|
13
|
-
xl: 1280,
|
|
14
|
-
"2xl": 1536,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const breakpoints =
|
|
18
|
-
window.AlpineMagicHelpersConfig &&
|
|
19
|
-
window.AlpineMagicHelpersConfig.breakpoints
|
|
20
|
-
? window.AlpineMagicHelpersConfig.breakpoints
|
|
21
|
-
: defaultBreakpoints;
|
|
22
|
-
|
|
23
|
-
window.addEventListener("resize", () => {
|
|
24
|
-
data.screensize = window.innerWidth;
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
Alpine.magic("screen", () => (breakpoint) => {
|
|
28
|
-
let width = data.screensize;
|
|
29
|
-
|
|
30
|
-
if (Number.isInteger(breakpoint)) return breakpoint <= width;
|
|
31
|
-
|
|
32
|
-
// Check if breakpoint exists
|
|
33
|
-
if (breakpoints[breakpoint] === undefined) {
|
|
34
|
-
throw Error(
|
|
35
|
-
"Undefined $screen property: " +
|
|
36
|
-
breakpoint +
|
|
37
|
-
". Supported properties: " +
|
|
38
|
-
Object.keys(breakpoints).join(", ")
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return breakpoints[breakpoint] <= width;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default function sizeObserver() {
|
|
2
|
-
return {
|
|
3
|
-
observedWidth: 0,
|
|
4
|
-
observedHeight: 0,
|
|
5
|
-
init() {
|
|
6
|
-
const ro = new ResizeObserver((entries) => {
|
|
7
|
-
const rect = entries[0].contentRect;
|
|
8
|
-
this.observedWidth = Math.round(rect.width);
|
|
9
|
-
this.observedHeight = Math.round(rect.height);
|
|
10
|
-
});
|
|
11
|
-
ro.observe(this.$el);
|
|
12
|
-
this.observedWidth = Math.round(this.$el.clientWidth);
|
|
13
|
-
this.observedHeight = Math.round(this.$el.clientHeight);
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Split from "split-grid";
|
|
2
|
-
|
|
3
|
-
export default function (props) {
|
|
4
|
-
const page = Alpine.store("page");
|
|
5
|
-
return {
|
|
6
|
-
init() {
|
|
7
|
-
Split({
|
|
8
|
-
[`${props.direction === "vertical" ? "row" : "column"}Gutters`]: [
|
|
9
|
-
{ track: 1, element: this.$el },
|
|
10
|
-
],
|
|
11
|
-
minSize: props.minSize,
|
|
12
|
-
writeStyle() {},
|
|
13
|
-
onDrag(dir, track, style) {
|
|
14
|
-
const splits = style.split(" ").map((num) => parseInt(num));
|
|
15
|
-
props.onDrag(splits);
|
|
16
|
-
},
|
|
17
|
-
onDragStart() {
|
|
18
|
-
page.reflowing = true;
|
|
19
|
-
},
|
|
20
|
-
onDragEnd() {
|
|
21
|
-
page.reflowing = false;
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default function workbench() {
|
|
2
|
-
const inspector = Alpine.store("inspector");
|
|
3
|
-
return {
|
|
4
|
-
previewViewportHeight: 0,
|
|
5
|
-
previewViewportWidth: 0,
|
|
6
|
-
splitProps: {
|
|
7
|
-
direction: "vertical",
|
|
8
|
-
minSize: 200,
|
|
9
|
-
onDrag(splits) {
|
|
10
|
-
inspector.height = splits[2];
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="flex flex-col h-full min-h-fill w-full">
|
|
2
|
-
<%= render "shared/header" %>
|
|
3
|
-
<div class="flex flex-col items-center justify-center h-full min-h-fill">
|
|
4
|
-
<div class="p-4 text-center">
|
|
5
|
-
<svg class="feather w-10 h-10 text-gray-300 mx-auto">
|
|
6
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#layers" />
|
|
7
|
-
</svg>
|
|
8
|
-
<h5 class="mt-4 text-gray-400 text-base">Select a preview to get started</h5>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= render "shared/workbench" %>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" class="h-screen">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
7
|
-
|
|
8
|
-
<link href="/lookbook-assets/app.css" rel="stylesheet">
|
|
9
|
-
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👀</text></svg>">
|
|
10
|
-
|
|
11
|
-
<% if config.auto_refresh %>
|
|
12
|
-
<script>
|
|
13
|
-
window.SOCKET_PATH = "<%= Lookbook::Engine.websocket_mount_path %>";
|
|
14
|
-
</script>
|
|
15
|
-
<% end %>
|
|
16
|
-
<script src="/lookbook-assets/app.js" defer></script>
|
|
17
|
-
|
|
18
|
-
<title><%= [@example&.label, @preview&.label, "Lookbook"].compact.join(" :: ") %></title>
|
|
19
|
-
</head>
|
|
20
|
-
<body class="text-gray-800 font-sans text-sm antialiased h-screen overflow-hidden">
|
|
21
|
-
<div
|
|
22
|
-
x-data="page"
|
|
23
|
-
x-effect="updateTitle"
|
|
24
|
-
@refresh.document="fetchHTML().then(doc => $dispatch('document:updated', {doc}))"
|
|
25
|
-
@popstate.window="fetchHTML().then(doc => { $dispatch('document:loaded', {doc}); sidebarOpenMobile = false})"
|
|
26
|
-
@sidebar:toggle.window="sidebarOpenMobile = !sidebarOpenMobile"
|
|
27
|
-
:style="`grid-template-columns: ${$store.nav.width}px 1px 1fr;`"
|
|
28
|
-
class="md:grid w-screen h-screen"
|
|
29
|
-
>
|
|
30
|
-
<div class="h-full bg-gray-100 overflow-hidden" x-show="$screen('md') || sidebarOpenMobile" x-cloak>
|
|
31
|
-
<%= render "shared/sidebar" %>
|
|
32
|
-
</div>
|
|
33
|
-
<div x-data="split(splitProps)" class="h-full gutter border-r border-gray-300 relative" x-show="$screen('md')" x-cloak>
|
|
34
|
-
<div class="w-[9px] h-full bg-transparent hover:bg-indigo-100 hover:bg-opacity-20 transition absolute top-0 bottom-0 transform -translate-x-1/2 cursor-[col-resize] z-10"></div>
|
|
35
|
-
</div>
|
|
36
|
-
<main id="main" x-effect="render" class="h-full overflow-hidden w-full" x-show="!$screen('md') || !sidebarOpenMobile" x-cloak>
|
|
37
|
-
<%= yield %>
|
|
38
|
-
</main>
|
|
39
|
-
</div>
|
|
40
|
-
</body>
|
|
41
|
-
</html>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
path = show_path leaf.path
|
|
3
|
-
display ||= :leaf
|
|
4
|
-
label ||= leaf.label
|
|
5
|
-
%>
|
|
6
|
-
<li x-data="navLeaf" :class="{hidden}" x-init="matchers = <%= leaf.matchers.to_json %>; path = '<%= path %>'; setActive()" @popstate.window="setActive">
|
|
7
|
-
<a href="<%= path %>"
|
|
8
|
-
class="nav-link pr-3 py-[5px] flex items-center w-full group transition hover:bg-gray-200 hover:bg-opacity-50"
|
|
9
|
-
style="<%= nav_padding_style(depth) %>"
|
|
10
|
-
:class="{'!bg-indigo-100':active}"
|
|
11
|
-
@click.stop.prevent="navigate"
|
|
12
|
-
>
|
|
13
|
-
<div class="relative w-3.5 h-3.5 mr-1.5 <%= "ml-[3px]" if display == :node %> " :class="active ? 'text-gray-900' : 'text-indigo-500'">
|
|
14
|
-
<svg class="feather flex-none group-hover:text-indigo-800 transition w-3.5 h-3.5">
|
|
15
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#<%= display == :node ? "layers" : "eye" %>" />
|
|
16
|
-
</svg>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="truncate whitespace-nowrap <%= "font-bold" if display == :node %>">
|
|
19
|
-
<%= label %>
|
|
20
|
-
</div>
|
|
21
|
-
</a>
|
|
22
|
-
</li>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<li id="<%= node.id %>" x-data="navNode" <% if node.hierarchy_depth == 1 %> class="py-1 border-b border-gray-300 cursor-pointer"<% end %> :class="{hidden}" x-cloak>
|
|
2
|
-
<div @click="toggle" style="<%= nav_padding_style(node.hierarchy_depth) %>" class="hover:bg-gray-200 hover:bg-opacity-50">
|
|
3
|
-
<div class="flex items-center cursor-pointer pr-3 py-[5px]">
|
|
4
|
-
<svg class="feather w-3 h-3 mr-1 text-gray-500 flex-none">
|
|
5
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#chevron-down" x-show="open" x-cloak />
|
|
6
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#chevron-right" x-show="!open()" x-cloak />
|
|
7
|
-
</svg>
|
|
8
|
-
<svg class="feather h-3.5 w-3.5 mr-1.5 flex-none text-indigo-500">
|
|
9
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#<%= node.type == :preview ? 'layers' : 'folder' %>" />
|
|
10
|
-
</svg>
|
|
11
|
-
<div class="truncate w-full whitespace-nowrap text-left <%= "font-bold" if node.type == :preview %>" @click.stop="toggle(); navigateToFirstChild();">
|
|
12
|
-
<%= node.label %>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<ul x-ref="items" x-show="open" x-cloak>
|
|
17
|
-
<%= yield %>
|
|
18
|
-
</ul>
|
|
19
|
-
</li>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<% examples = node.get_examples.reject(&:hidden?) %>
|
|
2
|
-
<% if examples.many? %>
|
|
3
|
-
<%= render "nav/node", node: node, path: show_path(examples.first.path) do %>
|
|
4
|
-
<% examples.each do |example| %>
|
|
5
|
-
<%= render "nav/leaf", leaf: example, depth: example.hierarchy_depth + 1 %>
|
|
6
|
-
<% end %>
|
|
7
|
-
<% end %>
|
|
8
|
-
<% else %>
|
|
9
|
-
<% example = examples.first %>
|
|
10
|
-
<%= render "nav/leaf", leaf: example, depth: example.hierarchy_depth, label: node.label, display: :node %>
|
|
11
|
-
<% end %>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<div id="sidebar" class="h-full" x-data="nav" @document:updated.window="updateNav" @navigate.window="navigate">
|
|
2
|
-
<div class="bg-white h-10 border-b border-gray-300 flex items-center relative">
|
|
3
|
-
<button class="flex-none ml-4 " x-show="!$screen('md')" @click="$dispatch('sidebar:toggle')" x-cloak>
|
|
4
|
-
<svg class="feather w-5 h-5 hover:text-indigo-500 transition">
|
|
5
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#x" />
|
|
6
|
-
</svg>
|
|
7
|
-
</button>
|
|
8
|
-
<input
|
|
9
|
-
type="text"
|
|
10
|
-
class="text-sm px-4 h-10 w-full border-0 bg-transparent focus:outline-none outline-none focus:ring-0"
|
|
11
|
-
placeholder="Filter previews…"
|
|
12
|
-
x-ref="filter"
|
|
13
|
-
x-model="$store.nav.filter"
|
|
14
|
-
x-effect="if (sidebarOpenMobile) focusFilter()"
|
|
15
|
-
@keyup.stop="if ($event.key === 'Escape') $store.nav.filtering ? clearFilter() : unfocusFilter()"
|
|
16
|
-
@keyup.f.document="focusFilter"
|
|
17
|
-
>
|
|
18
|
-
<button class="text-gray-400 hover:text-indigo-500 focus:ring-0 focus:outline-none absolute top-1/2 right-2 transform -translate-y-1/2" @click="clearFilter">
|
|
19
|
-
<svg class="feather w-3 h-3">
|
|
20
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#x" />
|
|
21
|
-
</svg>
|
|
22
|
-
</button>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="relative overflow-y-auto w-full" style="height: calc(100% - 40px)">
|
|
25
|
-
<div x-ref="shim">
|
|
26
|
-
<nav id="nav" class="select-none" x-data="navNode" @nav:updated.window="filter" x-init="$watch('$store.nav.filterText', () => filter()); $nextTick(() => filter());">
|
|
27
|
-
<% if @nav.items.any? %>
|
|
28
|
-
<ul x-ref="items">
|
|
29
|
-
<% @nav.items.each do |item| %>
|
|
30
|
-
<%= render "nav/#{item.type.to_s}", node: item %>
|
|
31
|
-
<% end %>
|
|
32
|
-
</ul>
|
|
33
|
-
<div class="p-4 text-center" x-show="hidden" x-cloak>
|
|
34
|
-
<em class="text-gray-400">No matching previews found.</em>
|
|
35
|
-
</div>
|
|
36
|
-
<% else %>
|
|
37
|
-
<div class="p-4">
|
|
38
|
-
<h4 class="text-gray-500 mb-1">No previews found.</h4>
|
|
39
|
-
<p class="text-gray-400 text-xs">Have you set your <a class="underline" href="https://viewcomponent.org/api.html#preview_paths">preview paths</a> config correctly?</p>
|
|
40
|
-
</div>
|
|
41
|
-
<% end %>
|
|
42
|
-
</nav>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<div id="workbench" class="bg-gray-50 h-screen flex flex-col" x-data="workbench">
|
|
2
|
-
<%= render "workbench/header" %>
|
|
3
|
-
<div class="md:grid flex-grow" :style="`grid-template-rows: 1fr 1px ${$store.inspector.height}px`">
|
|
4
|
-
<%= render "workbench/preview" %>
|
|
5
|
-
<div class="w-full gutter border-t border-gray-300 relative" x-data="split(splitProps)" x-show="$screen('md')">
|
|
6
|
-
<div class="h-[11px] w-full bg-transparent hover:bg-indigo-100 hover:bg-opacity-20 transition absolute left-0 right-0 transform -translate-y-1/2 cursor-[row-resize]"></div>
|
|
7
|
-
</div>
|
|
8
|
-
<% if @inspector %>
|
|
9
|
-
<%= render "workbench/inspector", **@inspector %>
|
|
10
|
-
<% end %>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<%= render "shared/header" do %>
|
|
2
|
-
<div class="flex items-center">
|
|
3
|
-
<div class="flex items-center space-x-1">
|
|
4
|
-
<strong class="whitespace-nowrap truncate"><%= @preview.label %></strong>
|
|
5
|
-
<% if @preview.get_examples.many? %>
|
|
6
|
-
<span>/</span>
|
|
7
|
-
<span class="whitespace-nowrap truncate"><%= @example.label %></span>
|
|
8
|
-
<% end %>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="flex text-xs ml-auto font-monospace text-gray-700 space-x-1" x-show="$screen('md')">
|
|
12
|
-
<span x-text="`${previewViewportWidth}px`"></span>
|
|
13
|
-
<span class="text-gray-500">x</span>
|
|
14
|
-
<span x-text="`${previewViewportHeight}px`"></span>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="flex items-center ml-auto md:ml-3 md:pl-3 space-x-3 md:border-l border-gray-300 text-gray-400">
|
|
17
|
-
<a
|
|
18
|
-
href="<%= url_for %>"
|
|
19
|
-
class="block transition hover:text-indigo-800"
|
|
20
|
-
x-tooltip.theme.lookbook="`Refresh preview`"
|
|
21
|
-
@click.prevent.stop="$dispatch('navigate')"
|
|
22
|
-
data-hotkey="r"
|
|
23
|
-
>
|
|
24
|
-
<svg class="feather w-4 h-4">
|
|
25
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#refresh-cw" />
|
|
26
|
-
</svg>
|
|
27
|
-
</a>
|
|
28
|
-
<a
|
|
29
|
-
href="<%= preview_path %>"
|
|
30
|
-
class="block transition hover:text-indigo-800" target="_blank"
|
|
31
|
-
x-tooltip.theme.lookbook="`Open in new window`"
|
|
32
|
-
data-hotkey="w"
|
|
33
|
-
>
|
|
34
|
-
<svg class="feather w-4 h-4">
|
|
35
|
-
<use xlink:href="/lookbook-assets/feather-sprite.svg#external-link" />
|
|
36
|
-
</svg>
|
|
37
|
-
</a>
|
|
38
|
-
</div>
|
|
39
|
-
<% end %>
|