lookbook 0.4.5 → 0.5.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/app/assets/lookbook/css/app.css +63 -5
- data/app/assets/lookbook/css/tooltip_theme.css +28 -0
- data/app/assets/lookbook/js/app.js +40 -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 +58 -0
- data/app/assets/lookbook/js/{nav/node.js → components/nav-group.js} +17 -16
- data/app/assets/lookbook/js/components/nav-item.js +27 -0
- data/app/assets/lookbook/js/components/nav.js +35 -0
- data/app/assets/lookbook/js/components/page.js +45 -0
- data/app/assets/lookbook/js/components/param.js +32 -0
- data/app/assets/lookbook/js/components/preview-window.js +107 -0
- 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/components/tabs.js +50 -0
- data/app/assets/lookbook/js/config.js +20 -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 +24 -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 +71 -96
- data/app/helpers/lookbook/application_helper.rb +48 -4
- data/app/views/layouts/lookbook/app.html.erb +58 -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/components/_copy.html.erb +14 -0
- data/app/views/lookbook/components/_drawer.html.erb +121 -0
- 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 +14 -0
- data/app/views/lookbook/components/_nav_item.html.erb +23 -0
- data/app/views/lookbook/components/_nav_preview.html.erb +11 -0
- data/app/views/lookbook/components/_param.html.erb +24 -0
- data/app/views/lookbook/components/_preview.html.erb +52 -0
- 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 +2 -2
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_text.html.erb +3 -2
- data/app/views/lookbook/inputs/_textarea.html.erb +9 -0
- data/app/views/lookbook/{workbench/inspector/params → inputs}/_toggle.html.erb +5 -5
- 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 +73 -0
- data/lib/lookbook/code_formatter.rb +20 -0
- data/lib/lookbook/engine.rb +8 -1
- data/lib/lookbook/lang.rb +10 -5
- data/lib/lookbook/preview.rb +1 -1
- 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 +2 -0
- data/public/lookbook-assets/css/app.css +4 -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 +58 -45
- 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/param.js +0 -19
- data/app/assets/lookbook/js/workbench/preview.js +0 -39
- 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/_clipboard.html.erb +0 -11
- 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/_preview.html.erb +0 -24
- 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/app/views/lookbook/workbench/inspector/params/_textarea.html.erb +0 -8
- 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
|
+
version: 0.5.0.beta.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: 2021-
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -190,52 +190,63 @@ 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/components/tabs.js
|
206
|
+
- app/assets/lookbook/js/config.js
|
207
|
+
- app/assets/lookbook/js/lib/socket.js
|
208
|
+
- app/assets/lookbook/js/lib/split.js
|
209
|
+
- app/assets/lookbook/js/lib/utils.js
|
210
|
+
- app/assets/lookbook/js/stores/filter.js
|
211
|
+
- app/assets/lookbook/js/stores/inspector.js
|
212
|
+
- app/assets/lookbook/js/stores/layout.js
|
213
|
+
- app/assets/lookbook/js/stores/nav.js
|
214
|
+
- app/assets/lookbook/js/stores/sidebar.js
|
207
215
|
- app/channels/lookbook/connection.rb
|
208
216
|
- app/channels/lookbook/reload_channel.rb
|
209
217
|
- app/controllers/lookbook/app_controller.rb
|
210
218
|
- app/helpers/lookbook/application_helper.rb
|
211
219
|
- 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/
|
220
|
+
- app/views/layouts/lookbook/app.html.erb
|
221
|
+
- app/views/layouts/lookbook/preview.html.erb
|
222
|
+
- app/views/lookbook/components/_code.html.erb
|
223
|
+
- app/views/lookbook/components/_copy.html.erb
|
224
|
+
- app/views/lookbook/components/_drawer.html.erb
|
225
|
+
- app/views/lookbook/components/_filter.html.erb
|
226
|
+
- app/views/lookbook/components/_header.html.erb
|
227
|
+
- app/views/lookbook/components/_icon.html.erb
|
228
|
+
- app/views/lookbook/components/_nav.html.erb
|
229
|
+
- app/views/lookbook/components/_nav_collection.html.erb
|
230
|
+
- app/views/lookbook/components/_nav_group.html.erb
|
231
|
+
- app/views/lookbook/components/_nav_item.html.erb
|
232
|
+
- app/views/lookbook/components/_nav_preview.html.erb
|
233
|
+
- app/views/lookbook/components/_param.html.erb
|
234
|
+
- app/views/lookbook/components/_preview.html.erb
|
235
|
+
- app/views/lookbook/error.html.erb
|
236
|
+
- app/views/lookbook/index.html.erb
|
237
|
+
- app/views/lookbook/inputs/_select.html.erb
|
238
|
+
- app/views/lookbook/inputs/_text.html.erb
|
239
|
+
- app/views/lookbook/inputs/_textarea.html.erb
|
240
|
+
- app/views/lookbook/inputs/_toggle.html.erb
|
241
|
+
- app/views/lookbook/not_found.html.erb
|
242
|
+
- app/views/lookbook/panels/_notes.html.erb
|
243
|
+
- app/views/lookbook/panels/_output.html.erb
|
244
|
+
- app/views/lookbook/panels/_params.html.erb
|
245
|
+
- app/views/lookbook/panels/_source.html.erb
|
246
|
+
- app/views/lookbook/show.html.erb
|
237
247
|
- config/routes.rb
|
238
248
|
- lib/lookbook.rb
|
249
|
+
- lib/lookbook/code_formatter.rb
|
239
250
|
- lib/lookbook/collection.rb
|
240
251
|
- lib/lookbook/engine.rb
|
241
252
|
- lib/lookbook/features.rb
|
@@ -250,9 +261,11 @@ files:
|
|
250
261
|
- lib/lookbook/taggable.rb
|
251
262
|
- lib/lookbook/version.rb
|
252
263
|
- lib/tasks/lookbook_tasks.rake
|
253
|
-
- public/lookbook-assets/app.css
|
254
|
-
- public/lookbook-assets/app.
|
264
|
+
- public/lookbook-assets/css/app.css
|
265
|
+
- public/lookbook-assets/css/app.css.map
|
255
266
|
- public/lookbook-assets/feather-sprite.svg
|
267
|
+
- public/lookbook-assets/js/app.js
|
268
|
+
- public/lookbook-assets/js/app.js.map
|
256
269
|
homepage: https://github.com/allmarkedup/lookbook
|
257
270
|
licenses:
|
258
271
|
- MIT
|
@@ -268,9 +281,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
268
281
|
version: '0'
|
269
282
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
283
|
requirements:
|
271
|
-
- - "
|
284
|
+
- - ">"
|
272
285
|
- !ruby/object:Gem::Version
|
273
|
-
version:
|
286
|
+
version: 1.3.1
|
274
287
|
requirements: []
|
275
288
|
rubygems_version: 3.2.22
|
276
289
|
signing_key:
|
@@ -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,19 +0,0 @@
|
|
1
|
-
export default function param() {
|
2
|
-
return {
|
3
|
-
focused: false,
|
4
|
-
setFocus() {
|
5
|
-
if (this.focused && this.$el.focus) {
|
6
|
-
this.$el.focus();
|
7
|
-
}
|
8
|
-
},
|
9
|
-
update(name, value) {
|
10
|
-
const searchParams = new URLSearchParams(window.location.search);
|
11
|
-
searchParams.set(name, value);
|
12
|
-
const path = location.href.replace(location.search, "");
|
13
|
-
this.navigateTo(`${path}?${searchParams.toString()}`);
|
14
|
-
},
|
15
|
-
validate() {
|
16
|
-
return this.$el.reportValidity ? this.$el.reportValidity() : true;
|
17
|
-
},
|
18
|
-
};
|
19
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
export default function preview() {
|
2
|
-
const app = Alpine.store("page");
|
3
|
-
const preview = Alpine.store("preview");
|
4
|
-
return {
|
5
|
-
init() {
|
6
|
-
this.root = this.$el;
|
7
|
-
},
|
8
|
-
onResize(e) {
|
9
|
-
const size =
|
10
|
-
this.resizeStartSize - (this.resizeStartPosition - e.pageX) * 2;
|
11
|
-
const parentSize = this.root.parentElement.clientWidth;
|
12
|
-
const percentSize = (Math.round(size) / parentSize) * 100;
|
13
|
-
const minWidth = (300 / parentSize) * 100;
|
14
|
-
preview.width = `${Math.min(Math.max(percentSize, minWidth), 100)}%`;
|
15
|
-
},
|
16
|
-
onResizeStart(e) {
|
17
|
-
app.reflowing = true;
|
18
|
-
this.onResize = this.onResize.bind(this);
|
19
|
-
this.onResizeEnd = this.onResizeEnd.bind(this);
|
20
|
-
this.resizeStartPosition = e.pageX;
|
21
|
-
this.resizeStartSize = this.root.clientWidth;
|
22
|
-
window.addEventListener("pointermove", this.onResize);
|
23
|
-
window.addEventListener("pointerup", this.onResizeEnd);
|
24
|
-
},
|
25
|
-
onResizeEnd() {
|
26
|
-
window.removeEventListener("pointermove", this.onResize);
|
27
|
-
window.removeEventListener("pointerup", this.onResizeEnd);
|
28
|
-
app.reflowing = false;
|
29
|
-
},
|
30
|
-
toggleFullWidth() {
|
31
|
-
if (preview.width === "100%" && preview.lastWidth) {
|
32
|
-
preview.width = preview.lastWidth;
|
33
|
-
} else {
|
34
|
-
preview.lastWidth = preview.width;
|
35
|
-
preview.width = "100%";
|
36
|
-
}
|
37
|
-
},
|
38
|
-
};
|
39
|
-
}
|
@@ -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,11 +0,0 @@
|
|
1
|
-
<button
|
2
|
-
class="p-1.5 border-b border-l border-gray-200 hover:border-gray-300 rounded-bl-md bg-white absolute top-0 right-0 text-gray-400 hover:text-indigo-500 transition"
|
3
|
-
x-data="clipboard"
|
4
|
-
x-tooltip.theme.lookbook="done ? 'copied!' : 'copy to clipboard'"
|
5
|
-
@click="save"
|
6
|
-
data-tippy-placement="left">
|
7
|
-
<svg class="feather h-4 w-4 ">
|
8
|
-
<use x-bind:href="`/lookbook-assets/feather-sprite.svg#${done ? 'check' : 'clipboard'}`" />
|
9
|
-
</svg>
|
10
|
-
<div class="hidden" x-init="content = $el.innerText"><%== yield %></div>
|
11
|
-
</button>
|
@@ -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>
|