public/lookbook-assets/app.js in lookbook-0.4.4 vs public/lookbook-assets/app.js in lookbook-0.4.5
- old
+ new
@@ -7331,23 +7331,32 @@
return config;
};
var module_default3 = src_default3;
// node_modules/@ryangjchandler/alpine-clipboard/src/index.js
- function src_default4(Alpine3) {
+ var onCopy = () => {
+ };
+ function Clipboard(Alpine3) {
Alpine3.magic("clipboard", () => {
return function(target) {
if (typeof target === "function") {
target = target();
}
if (typeof target === "object") {
target = JSON.stringify(target);
}
- return window.navigator.clipboard.writeText(target);
+ return window.navigator.clipboard.writeText(target).then(onCopy);
};
});
}
+ Clipboard.configure = (config) => {
+ if (config.hasOwnProperty("onCopy") && typeof config.onCopy === "function") {
+ onCopy = config.onCopy;
+ }
+ return Clipboard;
+ };
+ var src_default4 = Clipboard;
// app/assets/lookbook/js/utils/screen.js
function screen_default(Alpine3) {
let data2 = Alpine3.reactive({ screensize: window.innerWidth });
const defaultBreakpoints = {
@@ -8357,10 +8366,13 @@
Alpine.clone(fromEl, toEl);
}
if (fromEl.isEqualNode(toEl)) {
return false;
}
+ if (fromEl.hasAttribute("skip-morph")) {
+ return false;
+ }
return true;
}
}, opts));
}
@@ -8393,11 +8405,16 @@
document.title = store2.doc.title;
},
render() {
if (this.ready) {
morph_default(this.$el, store2.doc.getElementById(this.$el.id));
+ this.$dispatch("document:patched");
}
+ },
+ navigateTo(path2) {
+ history.pushState({}, null, path2);
+ this.$dispatch("popstate");
}
};
}
// app/assets/lookbook/js/workbench.js
@@ -8467,10 +8484,31 @@
return inspector2.active === id;
}
};
}
+ // app/assets/lookbook/js/workbench/param.js
+ function param() {
+ return {
+ focused: false,
+ setFocus() {
+ if (this.focused && this.$el.focus) {
+ this.$el.focus();
+ }
+ },
+ update(name, value) {
+ const searchParams = new URLSearchParams(window.location.search);
+ searchParams.set(name, value);
+ const path2 = location.href.replace(location.search, "");
+ this.navigateTo(`${path2}?${searchParams.toString()}`);
+ },
+ validate() {
+ return this.$el.reportValidity ? this.$el.reportValidity() : true;
+ }
+ };
+ }
+
// app/assets/lookbook/js/nav.js
function nav_default() {
return {
clearFilter() {
this.$store.nav.filter = "";
@@ -8490,17 +8528,16 @@
this.$refs.shim.style.height = "auto";
this.$dispatch("nav:updated");
});
},
navigate(path2) {
- if (path2 instanceof Event) {
- path2 = path2.currentTarget.href;
- }
- history.pushState({}, null, path2);
- this.$dispatch("popstate");
+ this.navigateTo(path2 instanceof Event ? path2.currentTarget.href : path2);
},
- focusFilter() {
+ focusFilter($event) {
+ if ($event.target.tagName === "INPUT") {
+ return;
+ }
this.currentFocus = this.$refs.filter;
setTimeout(() => this.$refs.filter.focus(), 0);
},
unfocusFilter() {
this.$refs.filter.blur();
@@ -8664,9 +8701,10 @@
module_default.data("navNode", navNode);
module_default.data("navLeaf", navLeaf);
module_default.data("workbench", workbench);
module_default.data("preview", preview);
module_default.data("inspector", inspector);
+ module_default.data("param", param);
module_default.data("clipboard", clipboard);
module_default.data("sizeObserver", sizeObserver);
module_default.data("split", split_default);
for (const el of document.querySelectorAll("[data-hotkey]")) {
install(el);