app/assets/build/coco/app.js in coveragebook_components-0.7.10 vs app/assets/build/coco/app.js in coveragebook_components-0.8.0.beta.1

- old
+ new

@@ -4297,11 +4297,11 @@ return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; } function toString(value) { return value == null ? "" : baseToString(value); } - var assign = createAssigner(function(object, source) { + var assign2 = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { @@ -4609,11 +4609,11 @@ position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length); var end2 = position; position -= target.length; return position >= 0 && string.slice(position, end2) == target; } - function escape(string) { + function escape2(string) { string = toString(string); return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } function escapeRegExp(string) { string = toString(string); @@ -5047,11 +5047,11 @@ function sumBy(array, iteratee2) { return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; } lodash.after = after; lodash.ary = ary; - lodash.assign = assign; + lodash.assign = assign2; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at2; lodash.before = before; @@ -5215,11 +5215,11 @@ lodash.deburr = deburr; lodash.defaultTo = defaultTo; lodash.divide = divide; lodash.endsWith = endsWith; lodash.eq = eq; - lodash.escape = escape; + lodash.escape = escape2; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex3; lodash.findKey = findKey; @@ -6071,10 +6071,13 @@ positive: __spreadValues({}, colors.green), negative: __spreadValues({}, colors.red), warning: __spreadValues({}, colors.amber), info: __spreadValues({}, colors.blue), background: { + header: { + DEFAULT: "#427484" + }, light: { 1: colors.white, 2: colors.gray[50], 3: colors.gray[100] }, @@ -6149,11 +6152,11 @@ md: "768px", lg: "992px", xl: "1200px", "2xl": "1400px", max: "1800px", - "small-landscape": { raw: "(max-height: 760px) and (min-width: 576px)" }, + letterbox: { raw: "(max-height: 760px) and (min-width: 576px)" }, print: { raw: "print" } // Note: PDFs are rendered at a viewport width of 1280px }; var fontSize = { "para-xs": ["12px", "16px"], @@ -14033,11 +14036,11 @@ // ../../../package.json var package_default = { name: "coveragebook-components", type: "module", - version: "0.7.10", + version: "0.8.0-beta.1", main: "index.js", repository: "git@github.com:coveragebook/coco.git", author: "Mark Perkins <mark@coveragebook.com>", license: "NO LICENSE", browserslist: [ @@ -14054,10 +14057,11 @@ "@tailwindcss/forms": "^0.5.3", alpinejs: "^3.11.1", "container-query-polyfill": "^1.0.2", del: "^7.0.0", html2canvas: "^1.4.1", + "js-cookie": "^3.0.5", lodash: "^4.17.21", "lucide-static": "^0.258.0", tailwindcss: "^3.3.0", "tippy.js": "^6.3.7" }, @@ -20208,21 +20212,10 @@ // libs/alpine/directives/options.js var import_lodash = __toESM(require_lodash(), 1); // helpers/dom.js - function getHiddenElementDimensions(el, display = "block") { - let size2; - if (el.style.display === "none") { - el.style.display = display; - size2 = el.getBoundingClientRect(); - el.style.display = "none"; - } else { - size2 = el.getBoundingClientRect(); - } - return size2; - } function castAttributeValue(value) { if (value === "false") { return false; } if (value === "true") { @@ -24158,49 +24151,115 @@ var __default2 = modules2; // book/components.js var components_default2 = registerComponents(__default2); - // ../../components/coco/app/blocks/nav_bar/nav_bar.js - var nav_bar_exports = {}; - __export(nav_bar_exports, { - default: () => nav_bar_default + // ../../components/coco/app/blocks/header/header.js + var header_exports = {}; + __export(header_exports, { + default: () => header_default }); + var header_default = CocoComponent("appHeader", () => { + return { + drawerOpen: false, + toggleDrawer() { + this.drawerOpen = !this.drawerOpen; + } + }; + }); + + // ../../components/coco/app/blocks/nav_drawer/nav_drawer.js + var nav_drawer_exports = {}; + __export(nav_drawer_exports, { + default: () => nav_drawer_default + }); + var nav_drawer_default = CocoComponent("appNavDrawer", () => { + return { + active: false, + init() { + this.$watch("drawerOpen", (open) => { + if (open) { + this.$refs.content.scrollTop = 0; + setTimeout(() => { + this.active = true; + }, 200); + } else { + this.active = false; + } + }); + }, + close() { + this.drawerOpen = false; + } + }; + }); + + // ../../components/coco/app/blocks/sidebar_nav/sidebar_nav.js + var sidebar_nav_exports = {}; + __export(sidebar_nav_exports, { + default: () => sidebar_nav_default + }); var import_tokens = __toESM(require_tokens(), 1); - var nav_bar_default = CocoComponent("appNavBar", () => { - const mobileMaxWidth = parseInt(import_tokens.default.app.screens.md, 10); + var mobileMaxWidth = parseInt(import_tokens.default.app.screens.sm, 10); + var sidebar_nav_default = CocoComponent("appSidebarNav", () => { return { - mobile: true, + sizeObserver: null, + mobileLayout: true, init() { - const sizeObserver = new ResizeObserver( + this.sizeObserver = new ResizeObserver( Alpine.throttle((entries) => { this.$nextTick(() => { - const navWidth = entries[0].contentRect.width; - const linksWidth = this.$refs.links.offsetWidth; - const primaryWidth = getHiddenElementDimensions(this.$refs.primaryLinks, "flex").width; - const secondaryWidth = getHiddenElementDimensions( - this.$refs.secondaryLinks, - "flex" - ).width; - const difference = linksWidth - primaryWidth - secondaryWidth; - this.mobile = navWidth < mobileMaxWidth || this.mobudifference <= 50; + const bodyWidth = entries[0].contentRect.width; + this.mobileLayout = bodyWidth < mobileMaxWidth; }); }, 20) ); - sizeObserver.observe(this.$root); + this.sizeObserver.observe(document.documentElement); + }, + destroy() { + this.sizeObserver && this.sizeObserver.disconnect(); } }; }); - // ../../components/coco/app/blocks/nav_drawer/nav_drawer.js - var nav_drawer_exports = {}; - __export(nav_drawer_exports, { - default: () => nav_drawer_default + // ../../components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js + var sidebar_nav_item_exports = {}; + __export(sidebar_nav_item_exports, { + default: () => sidebar_nav_item_default }); - var nav_drawer_default = CocoComponent("appNavDrawer", () => { + var sidebar_nav_item_default = CocoComponent("appSidebarNavItem", () => { return { - open: false + menu: null, + init() { + if (this.$refs.menu) { + this.menu = tippy_default(this.$el, { + theme: "coco-naked-dropdown", + placement: this.menuPlacement, + arrow: false, + offset: [0, 0], + trigger: "click", + interactive: true, + maxWidth: null, + content: () => { + return this.$refs.menu.innerHTML; + } + }); + } + this.$watch("mobileLayout", () => { + this.onOrientationChange(); + }); + }, + onOrientationChange() { + if (this.menu) { + this.menu.setProps({ + placement: this.menuPlacement + }); + } + }, + get menuPlacement() { + return this.mobileLayout ? "top" : "right-start"; + } }; }); // ../../components/coco/app/blocks/slide_editor/slide_editor.js var slide_editor_exports = {}; @@ -24529,20 +24588,21 @@ this.dismissed = true; setTimeout(() => this.remove(), this.dismissDuration); } }, remove() { + this.$nextTick(() => this.$dispatch("alert:removed", { alert: this })); this.$root.remove(); }, checkSingleLineWrap({ height }) { - if (!this.forceMultiLine) { + this.forceMultiLine = false; + this.$nextTick(() => { this.forceMultiLine = height > 24 && this.$options.singleLine; - } + }); }, root: { "x-options": '["dismissable", "singleLine"]', - "x-show": "!dismissed", ":class": "{'force-multi-line': forceMultiLine}" } }; }); @@ -26648,12 +26708,139 @@ // ../../components/coco/app/elements/system_banner/system_banner.js var system_banner_exports = {}; __export(system_banner_exports, { default: () => system_banner_default }); - var system_banner_default = CocoComponent("appSystemBanner", () => { - return {}; + + // ../../../node_modules/js-cookie/dist/js.cookie.mjs + function assign(target) { + for (var i3 = 1; i3 < arguments.length; i3++) { + var source = arguments[i3]; + for (var key in source) { + target[key] = source[key]; + } + } + return target; + } + 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 + ); + } + }; + function init(converter, defaultAttributes) { + function set3(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; + } + stringifiedAttributes += "=" + attributes[attributeName].split(";")[0]; + } + return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes; + } + function get3(name) { + if (typeof document === "undefined" || arguments.length && !name) { + return; + } + var cookies = document.cookie ? document.cookie.split("; ") : []; + var jar = {}; + for (var i3 = 0; i3 < cookies.length; i3++) { + var parts = cookies[i3].split("="); + var value = parts.slice(1).join("="); + try { + var found = decodeURIComponent(parts[0]); + jar[found] = converter.read(value, found); + if (name === found) { + break; + } + } catch (e3) { + } + } + return name ? jar[name] : jar; + } + return Object.create( + { + set: set3, + get: get3, + remove: function(name, attributes) { + set3( + name, + "", + assign({}, attributes, { + expires: -1 + }) + ); + }, + withAttributes: function(attributes) { + return init(this.converter, assign({}, this.attributes, attributes)); + }, + withConverter: function(converter2) { + return init(assign({}, this.converter, converter2), this.attributes); + } + }, + { + attributes: { value: Object.freeze(defaultAttributes) }, + converter: { value: Object.freeze(converter) } + } + ); + } + var api = init(defaultConverter, { path: "/" }); + + // ../../components/coco/app/elements/system_banner/system_banner.js + var system_banner_default = CocoComponent("appSystemBanner", (opts = {}) => { + return { + cookieName: null, + cookieValue: null, + cookieExpiry: null, + init() { + this.cookieName = opts.cookieName; + this.cookieValue = opts.cookieValue; + this.cookieExpiry = opts.cookieExpiry; + }, + onDismiss() { + this.$dispatch("banner:dismiss", { banner: this }); + if (this.shouldSetCookie) { + api.set(this.cookieName, this.cookieValue, { + expires: this.cookieExpiry + }); + } + }, + remove() { + this.$root.remove(); + }, + get shouldSetCookie() { + return Number.isInteger(this.cookieExpiry); + }, + root: { + "@alert:dismiss": "onDismiss", + "@alert:removed": "remove" + } + }; }); // ../../components/coco/app/elements/toast/toast.js var toast_exports = {}; __export(toast_exports, { @@ -26722,12 +26909,30 @@ }); } }; }); + // ../../components/coco/app/layouts/application/application.js + var application_exports = {}; + __export(application_exports, { + default: () => application_default + }); + var application_default = CocoComponent("appLayout", (opts) => { + return { + banner: false, + init() { + this.banner = opts.banner; + }, + hideBanner() { + this.banner = false; + this.$el.remove(); + } + }; + }); + // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/app|@appComponents/**/*.js - var modules3 = [nav_bar_exports, nav_drawer_exports, slide_editor_exports, alert_exports, button_group_exports, color_picker_exports, color_picker_button_exports, confirm_panel_exports, image_picker_exports, image_picker_button_exports, layout_picker_button_exports, menu_button_exports, notice_exports, seamless_textarea_exports, snackbar_exports, system_banner_exports, toast_exports, toolbar_exports]; + var modules3 = [header_exports, nav_drawer_exports, sidebar_nav_exports, sidebar_nav_item_exports, slide_editor_exports, alert_exports, button_group_exports, color_picker_exports, color_picker_button_exports, confirm_panel_exports, image_picker_exports, image_picker_button_exports, layout_picker_button_exports, menu_button_exports, notice_exports, seamless_textarea_exports, snackbar_exports, system_banner_exports, toast_exports, toolbar_exports, application_exports]; var __default3 = modules3; // app/components.js var components_default3 = registerComponents(__default3); @@ -26783,6 +26988,9 @@ * iro.js v5.5.2 * 2016-2021 James Daniel * Licensed under MPL 2.0 * github.com/jaames/iro.js *) + +js-cookie/dist/js.cookie.mjs: + (*! js-cookie v3.0.5 | MIT *) */