public/lookbook-assets/js/index.js in lookbook-2.2.2 vs public/lookbook-assets/js/index.js in lookbook-2.3.0

- old
+ new

@@ -3229,11 +3229,11 @@ // packages/morph/builds/module.js var $512e3a9270ec7803$export$2e2bcd8739ae039 = $512e3a9270ec7803$var$src_default; // packages/persist/src/index.js -function $a5acee56471cec18$var$src_default(Alpine) { +function $a5acee56471cec18$export$9a6132153fba2e0(Alpine) { let persist = ()=>{ let alias; let storage; try { storage = localStorage; @@ -3288,11 +3288,11 @@ } function $a5acee56471cec18$var$storageSet(key, value, storage) { storage.setItem(key, JSON.stringify(value)); } // packages/persist/builds/module.js -var $a5acee56471cec18$export$2e2bcd8739ae039 = $a5acee56471cec18$var$src_default; +var $a5acee56471cec18$export$2e2bcd8739ae039 = $a5acee56471cec18$export$9a6132153fba2e0; var $69a8ec8dbeef3157$var$__create = Object.create; var $69a8ec8dbeef3157$var$__defProp = Object.defineProperty; var $69a8ec8dbeef3157$var$__getProtoOf = Object.getPrototypeOf; @@ -6610,10 +6610,12 @@ "debug", "info", "warn", "error" ]; + var _loggersByName = {}; + var defaultLogger = null; // Cross-browser bind equivalent that works at least back to IE6 function bindMethod(obj, methodName) { var method = obj[methodName]; if (typeof method.bind === "function") return method.bind(obj); else try { @@ -6649,37 +6651,58 @@ else if (console[methodName] !== undefined) return bindMethod(console, methodName); else if (console.log !== undefined) return bindMethod(console, "log"); else return noop; } // These private functions always need `this` to be set properly - function replaceLoggingMethods(level, loggerName) { - /*jshint validthis:true */ for(var i = 0; i < logMethods.length; i++){ + function replaceLoggingMethods() { + /*jshint validthis:true */ var level = this.getLevel(); + // Replace the actual methods. + for(var i = 0; i < logMethods.length; i++){ var methodName = logMethods[i]; - this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName); + this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name); } // Define log.log as an alias for log.debug this.log = this.debug; + // Return any important warnings. + if (typeof console === undefinedType && level < this.levels.SILENT) return "No console available for logging"; } // In old IE versions, the console isn't present until you first open it. // We build realMethod() replacements here that regenerate logging methods - function enableLoggingWhenConsoleArrives(methodName, level, loggerName) { + function enableLoggingWhenConsoleArrives(methodName) { return function() { if (typeof console !== undefinedType) { - replaceLoggingMethods.call(this, level, loggerName); + replaceLoggingMethods.call(this); this[methodName].apply(this, arguments); } }; } // By default, we use closely bound real methods wherever possible, and // otherwise we wait for a console to appear, and then try again. - function defaultMethodFactory(methodName, level, loggerName) { + function defaultMethodFactory(methodName, _level, _loggerName) { /*jshint validthis:true */ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments); } - function Logger(name, defaultLevel, factory) { + function Logger(name, factory) { + // Private instance variables. var self = this; - var currentLevel; - defaultLevel = defaultLevel == null ? "WARN" : defaultLevel; + /** + * The level inherited from a parent logger (or a global default). We + * cache this here rather than delegating to the parent so that it stays + * in sync with the actual logging methods that we have installed (the + * parent could change levels but we might not have rebuilt the loggers + * in this child yet). + * @type {number} + */ var inheritedLevel; + /** + * The default level for this logger, if any. If set, this overrides + * `inheritedLevel`. + * @type {number|null} + */ var defaultLevel; + /** + * A user-specific level for this logger. If set, this overrides + * `defaultLevel`. + * @type {number|null} + */ var userLevel; var storageKey = "loglevel"; if (typeof name === "string") storageKey += ":" + name; else if (typeof name === "symbol") storageKey = undefined; function persistLevelIfPossible(levelNum) { var levelName = (logMethods[levelNum] || "silent").toUpperCase(); @@ -6701,29 +6724,35 @@ storedLevel = window.localStorage[storageKey]; } catch (ignore) {} // Fallback to cookies if local storage gives us nothing if (typeof storedLevel === undefinedType) try { var cookie = window.document.cookie; - var location = cookie.indexOf(encodeURIComponent(storageKey) + "="); - if (location !== -1) storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1]; + var cookieName = encodeURIComponent(storageKey); + var location = cookie.indexOf(cookieName + "="); + if (location !== -1) storedLevel = /^([^;]+)/.exec(cookie.slice(location + cookieName.length + 1))[1]; } catch (ignore) {} // If the stored level is not valid, treat it as if nothing was stored. if (self.levels[storedLevel] === undefined) storedLevel = undefined; return storedLevel; } function clearPersistedLevel() { if (typeof window === undefinedType || !storageKey) return; // Use localStorage if available try { window.localStorage.removeItem(storageKey); - return; } catch (ignore) {} // Use session cookie as fallback try { window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; } catch (ignore) {} } + function normalizeLevel(input) { + var level = input; + if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) level = self.levels[level.toUpperCase()]; + if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) return level; + else throw new TypeError("log.setLevel() called with invalid level: " + input); + } /* * * Public logger API - see https://github.com/pimterry/loglevel for details * */ self.name = name; @@ -6735,50 +6764,55 @@ "ERROR": 4, "SILENT": 5 }; self.methodFactory = factory || defaultMethodFactory; self.getLevel = function() { - return currentLevel; + if (userLevel != null) return userLevel; + else if (defaultLevel != null) return defaultLevel; + else return inheritedLevel; }; self.setLevel = function(level, persist) { - if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) level = self.levels[level.toUpperCase()]; - if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) { - currentLevel = level; - if (persist !== false) persistLevelIfPossible(level); - replaceLoggingMethods.call(self, level, name); - if (typeof console === undefinedType && level < self.levels.SILENT) return "No console available for logging"; - } else throw "log.setLevel() called with invalid level: " + level; + userLevel = normalizeLevel(level); + if (persist !== false) persistLevelIfPossible(userLevel); + // NOTE: in v2, this should call rebuild(), which updates children. + return replaceLoggingMethods.call(self); }; self.setDefaultLevel = function(level) { - defaultLevel = level; + defaultLevel = normalizeLevel(level); if (!getPersistedLevel()) self.setLevel(level, false); }; self.resetLevel = function() { - self.setLevel(defaultLevel, false); + userLevel = null; clearPersistedLevel(); + replaceLoggingMethods.call(self); }; self.enableAll = function(persist) { self.setLevel(self.levels.TRACE, persist); }; self.disableAll = function(persist) { self.setLevel(self.levels.SILENT, persist); }; - // Initialize with the right level + self.rebuild = function() { + if (defaultLogger !== self) inheritedLevel = normalizeLevel(defaultLogger.getLevel()); + replaceLoggingMethods.call(self); + if (defaultLogger === self) for(var childName in _loggersByName)_loggersByName[childName].rebuild(); + }; + // Initialize all the internal levels. + inheritedLevel = normalizeLevel(defaultLogger ? defaultLogger.getLevel() : "WARN"); var initialLevel = getPersistedLevel(); - if (initialLevel == null) initialLevel = defaultLevel; - self.setLevel(initialLevel, false); + if (initialLevel != null) userLevel = normalizeLevel(initialLevel); + replaceLoggingMethods.call(self); } /* * * Top-level API * - */ var defaultLogger = new Logger(); - var _loggersByName = {}; + */ defaultLogger = new Logger(); defaultLogger.getLogger = function getLogger(name) { if (typeof name !== "symbol" && typeof name !== "string" || name === "") throw new TypeError("You must supply a name when creating a logger."); var logger = _loggersByName[name]; - if (!logger) logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory); + if (!logger) logger = _loggersByName[name] = new Logger(name, defaultLogger.methodFactory); return logger; }; // Grab the current global log variable in case of overwrite var _log = typeof window !== undefinedType ? window.log : undefined; defaultLogger.noConflict = function() { @@ -7986,11 +8020,11 @@ return $1.toUpperCase().replace("-", "").replace("_", ""); }); } -var $e29b71de1c821c6e$exports = {}; +var $c9dfaeb25bf110ce$exports = {}; var $cbd28b10fa9798c7$exports = {}; $parcel$defineInteropFlag($cbd28b10fa9798c7$exports); $parcel$export($cbd28b10fa9798c7$exports, "default", () => $cbd28b10fa9798c7$export$2e2bcd8739ae039); @@ -11505,10 +11539,20 @@ _spinning: false }; } +var $99486586f6691564$exports = {}; + +$parcel$defineInteropFlag($99486586f6691564$exports); + +$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039); +function $99486586f6691564$export$2e2bcd8739ae039() { + return {}; +} + + var $47a1c62621be0c54$exports = {}; $parcel$defineInteropFlag($47a1c62621be0c54$exports); $parcel$export($47a1c62621be0c54$exports, "default", () => $47a1c62621be0c54$export$2e2bcd8739ae039); @@ -11561,20 +11605,10 @@ } }; } -var $99486586f6691564$exports = {}; - -$parcel$defineInteropFlag($99486586f6691564$exports); - -$parcel$export($99486586f6691564$exports, "default", () => $99486586f6691564$export$2e2bcd8739ae039); -function $99486586f6691564$export$2e2bcd8739ae039() { - return {}; -} - - var $e398acaded942bbe$exports = {}; $parcel$defineInteropFlag($e398acaded942bbe$exports); $parcel$export($e398acaded942bbe$exports, "default", () => $e398acaded942bbe$export$2e2bcd8739ae039); @@ -12480,14 +12514,14 @@ } }; } -$e29b71de1c821c6e$exports = { +$c9dfaeb25bf110ce$exports = { "button": $cbd28b10fa9798c7$exports, - "copy_button": $47a1c62621be0c54$exports, "code": $99486586f6691564$exports, + "copy_button": $47a1c62621be0c54$exports, "dimensions_display": $e398acaded942bbe$exports, "embed_code_dropdown": $216ef7001f59f21d$exports, "filter": $e9904a14dabf652d$exports, "nav": $d92d9d5253f84566$exports, "split_layout": $506dabb2bf255b38$exports, @@ -12495,129 +12529,11 @@ "tabs": $0db07828cadc68e0$exports, "viewport": $6d64716f0b34fdf4$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 $9a68326211e66205$exports = {}; var $c299e36fa9e271bc$exports = {}; $parcel$defineInteropFlag($c299e36fa9e271bc$exports); $parcel$export($c299e36fa9e271bc$exports, "default", () => $c299e36fa9e271bc$export$2e2bcd8739ae039); @@ -13506,10 +13422,128 @@ } }; } +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); @@ -13595,17 +13629,17 @@ } }; } -$6178ee12f80cbf68$exports = { - "display_options": { - "field": $6a9b69d9cc7f810f$exports - }, +$9a68326211e66205$exports = { "embed": { "inspector": $c299e36fa9e271bc$exports }, + "display_options": { + "field": $6a9b69d9cc7f810f$exports + }, "nav": { "item": $9b24cbeb3a465447$exports }, "params": { "editor": $1a7a7298eec5b755$exports, @@ -13675,11 +13709,11 @@ prefix: $22969b543678f572$var$prefix })); // Components (0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $5792afa4170ed552$export$2e2bcd8739ae039)); [ - $e29b71de1c821c6e$exports, - $6178ee12f80cbf68$exports, + $c9dfaeb25bf110ce$exports, + $9a68326211e66205$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]);