public/lookbook-assets/js/index.js in lookbook-2.3.0 vs public/lookbook-assets/js/index.js in lookbook-2.3.2
- old
+ new
@@ -7896,12 +7896,12 @@
if (link.href) return link.host !== window.location.host;
return false;
}
-async function $41e83ac737081df5$export$51c59e2af49c1a92(url, selector) {
- const response = await fetch(url || window.document.location);
+async function $41e83ac737081df5$export$51c59e2af49c1a92(url, selector, options = {}) {
+ const response = await fetch(url || window.document.location, options);
const html = await response.text();
const doc = new DOMParser().parseFromString(html, "text/html");
return {
ok: response.ok,
fragment: selector ? doc.querySelector(selector).outerHTML : null,
@@ -7940,11 +7940,15 @@
},
async handleNavigation () {
this.debug("Navigating to ", window.location.pathname);
this.$dispatch("navigation:start");
this.location = window.location;
- await this.updateDOM();
+ await this.updateDOM("#app-main", {
+ headers: {
+ "X-Lookbook-Frame": "main"
+ }
+ });
this.$dispatch("navigation:complete");
},
hijax (evt) {
const link = evt.target.closest("a[href]");
if (link) {
@@ -7959,17 +7963,17 @@
this.navigateTo(link.href);
return;
}
}
},
- async updateDOM () {
+ async updateDOM (rootSelector = `#${this.$root.id}`, options = {}) {
this.debug("Starting DOM update");
this.$dispatch("dom:update-start");
this.requestStart();
try {
- const { fragment: fragment, title: title } = await (0, $41e83ac737081df5$export$51c59e2af49c1a92)(window.location, `#${this.$root.id}`);
- (0, $490552754c23ef6f$export$2e5e8c41f5d4e7c7)(this.$root, fragment);
+ const { fragment: fragment, title: title } = await (0, $41e83ac737081df5$export$51c59e2af49c1a92)(window.location, rootSelector, options);
+ (0, $490552754c23ef6f$export$2e5e8c41f5d4e7c7)(document.querySelector(rootSelector), fragment);
document.title = title;
this.requestEnd();
this.$dispatch("dom:update-complete");
this.debug("DOM update complete");
} catch (err) {
@@ -12529,11 +12533,129 @@
"tabs": $0db07828cadc68e0$exports,
"viewport": $6d64716f0b34fdf4$exports
};
-var $9a68326211e66205$exports = {};
+var $6178ee12f80cbf68$exports = {};
+var $6a9b69d9cc7f810f$exports = {};
+
+$parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
+
+$parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
+var $cdfeaa1e0e8d642c$exports = {};
+(function(global, factory) {
+ $cdfeaa1e0e8d642c$exports = factory();
+})($cdfeaa1e0e8d642c$exports, function() {
+ "use strict";
+ /* eslint-disable no-var */ function assign(target) {
+ for(var i = 1; i < arguments.length; i++){
+ var source = arguments[i];
+ for(var key in source)target[key] = source[key];
+ }
+ return target;
+ }
+ /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
+ read: function(value) {
+ if (value[0] === '"') value = value.slice(1, -1);
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
+ },
+ write: function(value) {
+ return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
+ }
+ };
+ /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
+ function set(name, value, attributes) {
+ if (typeof document === "undefined") return;
+ attributes = assign({}, defaultAttributes, attributes);
+ if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
+ if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
+ name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
+ var stringifiedAttributes = "";
+ for(var attributeName in attributes){
+ if (!attributes[attributeName]) continue;
+ stringifiedAttributes += "; " + attributeName;
+ if (attributes[attributeName] === true) continue;
+ // Considers RFC 6265 section 5.2:
+ // ...
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
+ // character:
+ // Consume the characters of the unparsed-attributes up to,
+ // not including, the first %x3B (";") character.
+ // ...
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
+ }
+ return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
+ }
+ function get(name) {
+ if (typeof document === "undefined" || arguments.length && !name) return;
+ // To prevent the for loop in the first place assign an empty array
+ // in case there are no cookies at all.
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
+ var jar = {};
+ for(var i = 0; i < cookies.length; i++){
+ var parts = cookies[i].split("=");
+ var value = parts.slice(1).join("=");
+ try {
+ var found = decodeURIComponent(parts[0]);
+ jar[found] = converter.read(value, found);
+ if (name === found) break;
+ } catch (e) {}
+ }
+ return name ? jar[name] : jar;
+ }
+ return Object.create({
+ set: set,
+ get: get,
+ remove: function(name, attributes) {
+ set(name, "", assign({}, attributes, {
+ expires: -1
+ }));
+ },
+ withAttributes: function(attributes) {
+ return init(this.converter, assign({}, this.attributes, attributes));
+ },
+ withConverter: function(converter) {
+ return init(assign({}, this.converter, converter), this.attributes);
+ }
+ }, {
+ attributes: {
+ value: Object.freeze(defaultAttributes)
+ },
+ converter: {
+ value: Object.freeze(converter)
+ }
+ });
+ }
+ var api = init(defaultConverter, {
+ path: "/"
+ });
+ /* eslint-enable no-var */ return api;
+});
+
+
+
+function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name, value: value }) {
+ return {
+ name: name,
+ value: value,
+ init () {
+ this.$watch("value", ()=>this.update());
+ },
+ update () {
+ (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
+ const searchParams = new URLSearchParams(window.location.search);
+ const display = searchParams.get("_display");
+ const displayParams = display ? (0, $fb8f79f7dd40b68f$export$f720fd0ddbeb53d9)(display) : {};
+ displayParams[this.name] = this.value;
+ searchParams.set("_display", (0, $fb8f79f7dd40b68f$export$c788aab010beeaec)(displayParams));
+ const path = location.href.replace(location.search, "");
+ this.navigateTo(`${path}?${searchParams.toString()}`);
+ }
+ };
+}
+
+
var $c299e36fa9e271bc$exports = {};
$parcel$defineInteropFlag($c299e36fa9e271bc$exports);
$parcel$export($c299e36fa9e271bc$exports, "default", () => $c299e36fa9e271bc$export$2e2bcd8739ae039);
@@ -13422,150 +13544,32 @@
}
};
}
-var $6a9b69d9cc7f810f$exports = {};
-
-$parcel$defineInteropFlag($6a9b69d9cc7f810f$exports);
-
-$parcel$export($6a9b69d9cc7f810f$exports, "default", () => $6a9b69d9cc7f810f$export$2e2bcd8739ae039);
-var $cdfeaa1e0e8d642c$exports = {};
-(function(global, factory) {
- $cdfeaa1e0e8d642c$exports = factory();
-})($cdfeaa1e0e8d642c$exports, function() {
- "use strict";
- /* eslint-disable no-var */ function assign(target) {
- for(var i = 1; i < arguments.length; i++){
- var source = arguments[i];
- for(var key in source)target[key] = source[key];
- }
- return target;
- }
- /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
- read: function(value) {
- if (value[0] === '"') value = value.slice(1, -1);
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
- },
- write: function(value) {
- return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
- }
- };
- /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
- function set(name, value, attributes) {
- if (typeof document === "undefined") return;
- attributes = assign({}, defaultAttributes, attributes);
- if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
- if (attributes.expires) attributes.expires = attributes.expires.toUTCString();
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
- var stringifiedAttributes = "";
- for(var attributeName in attributes){
- if (!attributes[attributeName]) continue;
- stringifiedAttributes += "; " + attributeName;
- if (attributes[attributeName] === true) continue;
- // Considers RFC 6265 section 5.2:
- // ...
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
- // character:
- // Consume the characters of the unparsed-attributes up to,
- // not including, the first %x3B (";") character.
- // ...
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
- }
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
- }
- function get(name) {
- if (typeof document === "undefined" || arguments.length && !name) return;
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all.
- var cookies = document.cookie ? document.cookie.split("; ") : [];
- var jar = {};
- for(var i = 0; i < cookies.length; i++){
- var parts = cookies[i].split("=");
- var value = parts.slice(1).join("=");
- try {
- var found = decodeURIComponent(parts[0]);
- jar[found] = converter.read(value, found);
- if (name === found) break;
- } catch (e) {}
- }
- return name ? jar[name] : jar;
- }
- return Object.create({
- set: set,
- get: get,
- remove: function(name, attributes) {
- set(name, "", assign({}, attributes, {
- expires: -1
- }));
- },
- withAttributes: function(attributes) {
- return init(this.converter, assign({}, this.attributes, attributes));
- },
- withConverter: function(converter) {
- return init(assign({}, this.converter, converter), this.attributes);
- }
- }, {
- attributes: {
- value: Object.freeze(defaultAttributes)
- },
- converter: {
- value: Object.freeze(converter)
- }
- });
- }
- var api = init(defaultConverter, {
- path: "/"
- });
- /* eslint-enable no-var */ return api;
-});
-
-
-
-function $6a9b69d9cc7f810f$export$2e2bcd8739ae039({ name: name, value: value }) {
- return {
- name: name,
- value: value,
- init () {
- this.$watch("value", ()=>this.update());
- },
- update () {
- (0, (/*@__PURE__*/$parcel$interopDefault($cdfeaa1e0e8d642c$exports))).set(`lookbook-display-${name}`, this.value);
- const searchParams = new URLSearchParams(window.location.search);
- const display = searchParams.get("_display");
- const displayParams = display ? (0, $fb8f79f7dd40b68f$export$f720fd0ddbeb53d9)(display) : {};
- displayParams[this.name] = this.value;
- searchParams.set("_display", (0, $fb8f79f7dd40b68f$export$c788aab010beeaec)(displayParams));
- const path = location.href.replace(location.search, "");
- this.navigateTo(`${path}?${searchParams.toString()}`);
- }
- };
-}
-
-
var $9b24cbeb3a465447$exports = {};
$parcel$defineInteropFlag($9b24cbeb3a465447$exports);
$parcel$export($9b24cbeb3a465447$exports, "default", () => $9b24cbeb3a465447$export$2e2bcd8739ae039);
function $9b24cbeb3a465447$export$2e2bcd8739ae039({ id: id, matchers: matchers }) {
matchers = matchers.map((matcher)=>matcher.replace(/\s/g, "").toLowerCase());
return {
filteredOut: false,
+ active: false,
get open () {
return this.isCollection && this.isOpen(id);
},
- get active () {
- if (this.$refs.link) return this.location && this.location.pathname === this.$refs.link.getAttribute("href");
- return false;
- },
get children () {
return this.$refs.items ? Array.from(this.$refs.items.children) : [];
},
get isCollection () {
return !this.$refs.link;
},
+ checkActive () {
+ this.active = this.$refs.link && window.location.pathname === this.$refs.link.getAttribute("href");
+ },
toggle () {
this.toggleOpen(id);
},
async filter (text) {
if (this.isCollection) {
@@ -13629,17 +13633,17 @@
}
};
}
-$9a68326211e66205$exports = {
- "embed": {
- "inspector": $c299e36fa9e271bc$exports
- },
+$6178ee12f80cbf68$exports = {
"display_options": {
"field": $6a9b69d9cc7f810f$exports
},
+ "embed": {
+ "inspector": $c299e36fa9e271bc$exports
+ },
"nav": {
"item": $9b24cbeb3a465447$exports
},
"params": {
"editor": $1a7a7298eec5b755$exports,
@@ -13710,10 +13714,10 @@
}));
// Components
(0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $5792afa4170ed552$export$2e2bcd8739ae039));
[
$c9dfaeb25bf110ce$exports,
- $9a68326211e66205$exports,
+ $6178ee12f80cbf68$exports,
$d56e5cced44001d2$exports
].forEach((scripts)=>{
const components = (0, $12b7aa006b8a97e1$export$4e811121b221213b)(scripts);
Object.keys(components).forEach((name)=>{
(0, $caa9439642c6336c$export$2e2bcd8739ae039).data(`${name}Component`, components[name]);