app/assets/build/coco/app.js in coveragebook_components-0.10.0 vs app/assets/build/coco/app.js in coveragebook_components-0.10.1.beta.0

- old
+ new

@@ -14046,11 +14046,11 @@ // ../../../package.json var package_default = { name: "coveragebook-components", type: "module", - version: "0.10.0", + version: "0.10.1-beta.0", main: "index.js", repository: "git@github.com:coveragebook/coco.git", author: "Mark Perkins <mark@coveragebook.com>", license: "NO LICENSE", browserslist: [ @@ -24043,17 +24043,17 @@ ); } window.addEventListener("resize", setAppHeightProperty); setAppHeightProperty(); - // ../../components/coco/base/button/button.js + // ../../components/coco/shared/button/button.js var button_exports = {}; __export(button_exports, { default: () => button_default }); - // coco.js + // shared/coco.js function CocoComponent(name, fn3) { const func = nameFunction(name, (...args) => { const data2 = fn3(...args); Object.defineProperties(data2, { $parent: { @@ -24067,11 +24067,11 @@ }); func.component = true; return func; } - // ../../components/coco/base/button/button.js + // ../../components/coco/shared/button/button.js var import_lodash2 = __toESM(require_lodash(), 1); var button_default = CocoComponent("button", (data2 = {}) => { return __spreadProps(__spreadValues({ options: ["state", "confirm", "size", "disabled", "collapsible"], isCollapsed: false, @@ -24201,21 +24201,22 @@ }, /* bindings */ root: { "x-options": "options", "x-tooltip": "tooltipText", - "x-effect": "setTooltipText" + "x-effect": "setTooltipText", + ":disabled": "disabled" } }); }); - // ../../components/coco/base/button/button_dropdown.js + // ../../components/coco/shared/button/button_dropdown.js var button_dropdown_exports = {}; __export(button_dropdown_exports, { default: () => button_dropdown_default }); - var button_dropdown_default = CocoComponent("buttonDropdown", (data2 = {}) => { + var button_dropdown_default = CocoComponent("buttonDropdown", () => { return { dropdown: null, button: null, init() { this.$nextTick(() => { @@ -24229,24 +24230,121 @@ }, showDropdown() { if (this.dropdown) { this.dropdown.show(); } + }, + /* bindings */ + root: { + "@dropdown:show": "button.setState('active')", + "@dropdown:hide": "button.resetState()", + "@confirmation:confirm": "button.approveAndRun($event)", + "@confirmation:cancel": "button.cancelConfirmation($event)" } }; }); - // ../../components/coco/base/dropdown/dropdown.js + // ../../components/coco/shared/button_group/button_group.js + var button_group_exports = {}; + __export(button_group_exports, { + default: () => button_group_default + }); + var button_group_default = CocoComponent("appButtonGroup", () => { + return { + options: ["collapsible"], + ready: false, + containerWidth: 0, + contentWidth: 0, + collapsed: false, + singletonTooltip: null, + tooltipInstances: [], + get collapsible() { + return this.$options.collapsible !== false; + }, + get buttons() { + const buttonElements = this.$el.querySelectorAll( + "[data-component='button']" + ); + return Array.from(buttonElements).map((el) => getComponent(el)); + }, + get parent() { + return this.$root.parentElement; + }, + init() { + if (this.collapsible) { + this.$nextTick(() => { + this.onResize(); + this.createSingletonTooltip(); + this.ready = true; + }); + } else { + this.ready = true; + } + this.$watch("collapsed", (value) => { + this.buttons.forEach((button) => { + button.isCollapsed = value; + }); + this.$nextTick(() => this.createSingletonTooltip()); + }); + }, + createSingletonTooltip() { + this.destroySingletonTooltip(); + this.tooltipInstances = this.buttons.map((button) => { + if (button.tippyInstance && button.shouldShowTooltip && button.shouldShowTooltip()) { + return button.tippyInstance; + } + }).filter((t3) => t3); + this.singletonTooltip = createSingleton(this.tooltipInstances, { + theme: "coco-tooltip", + delay: 100, + moveTransition: "transform 0.1s ease-out" + }); + }, + destroySingletonTooltip() { + if (this.singletonTooltip && this.singletonTooltip.destroy) { + this.singletonTooltip.destroy(); + this.singletonTooltip = null; + this.tooltipInstances.forEach((tooltip) => tooltip.destroy()); + this.tooltipInstances = []; + } + }, + onResize() { + if (!this.collapsible) + return; + this.containerWidth = Math.ceil(this.parent.offsetWidth); + if (this.collapsed) { + if (this.containerWidth > this.contentWidth) { + this.collapsed = false; + } + } else { + if (this.containerWidth < this.contentWidth) { + this.collapsed = true; + } else { + const contentWidth = Math.ceil(this.$refs.buttons.scrollWidth); + this.contentWidth = contentWidth; + } + } + }, + destroy() { + if (this.singletonTooltip) { + this.singletonTooltip.destroy(); + this.singletonTooltip = null; + } + } + }; + }); + + // ../../components/coco/shared/dropdown/dropdown.js var dropdown_exports = {}; __export(dropdown_exports, { default: () => dropdown_default2 }); var dropdown_default2 = CocoComponent("dropdown", () => { return {}; }); - // ../../components/coco/base/icon/icon.js + // ../../components/coco/shared/icon/icon.js var icon_exports = {}; __export(icon_exports, { default: () => icon_default }); var icon_default = CocoComponent("icon", () => { @@ -24268,11 +24366,11 @@ "x-options": "options" } }; }); - // ../../components/coco/base/image_uploader/image_uploader.js + // ../../components/coco/shared/image_uploader/image_uploader.js var image_uploader_exports = {}; __export(image_uploader_exports, { default: () => image_uploader_default }); var image_uploader_default = CocoComponent("imageUploader", ({ click, drop }) => { @@ -24341,11 +24439,11 @@ reader.readAsDataURL(file); } }; }); - // ../../components/coco/base/modal/modal.js + // ../../components/coco/shared/modal/modal.js var modal_exports = {}; __export(modal_exports, { default: () => modal_default }); var modal_default = CocoComponent("modal", () => { @@ -24431,11 +24529,11 @@ "x-transition:leave-end": "container-leave-end" } }; }); - // ../../components/coco/base/modal_dialog/modal_dialog.js + // ../../components/coco/shared/modal_dialog/modal_dialog.js var modal_dialog_exports = {}; __export(modal_dialog_exports, { default: () => modal_dialog_default }); var modal_dialog_default = CocoComponent("modalDialog", () => { @@ -24465,11 +24563,11 @@ ); } }; }); - // ../../components/coco/base/modal_lightbox/modal_lightbox.js + // ../../components/coco/shared/modal_lightbox/modal_lightbox.js var modal_lightbox_exports = {}; __export(modal_lightbox_exports, { default: () => modal_lightbox_default }); var modal_lightbox_default = CocoComponent("modalLightbox", () => { @@ -24499,11 +24597,11 @@ ":class": "{loaded}" } }; }); - // ../../components/coco/base/poll_controller/poll_controller.js + // ../../components/coco/shared/poll_controller/poll_controller.js var poll_controller_exports = {}; __export(poll_controller_exports, { default: () => poll_controller_default }); var poll_controller_default = CocoComponent("pollController", () => { @@ -24563,15 +24661,15 @@ if (headers) { headers.Accept = ["text/vnd.turbo-stream.html", headers.Accept].join(", "); } } - // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/base|@baseComponents/**/*.js - var modules = [button_exports, button_dropdown_exports, dropdown_exports, icon_exports, image_uploader_exports, modal_exports, modal_dialog_exports, modal_lightbox_exports, poll_controller_exports]; + // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/shared|@sharedComponents/**/*.js + var modules = [button_exports, button_dropdown_exports, button_group_exports, dropdown_exports, icon_exports, image_uploader_exports, modal_exports, modal_dialog_exports, modal_lightbox_exports, poll_controller_exports]; var __default = modules; - // base/components.js + // shared/components.js var components_default = registerComponents(__default); // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/book|@bookComponents/**/*.js var modules2 = []; var __default2 = modules2; @@ -25084,96 +25182,10 @@ ":class": "{'force-multi-line': forceMultiLine}" } }; }); - // ../../components/coco/app/elements/button_group/button_group.js - var button_group_exports = {}; - __export(button_group_exports, { - default: () => button_group_default - }); - var button_group_default = CocoComponent("appButtonGroup", () => { - return { - options: ["collapsible"], - ready: false, - containerWidth: 0, - contentWidth: 0, - collapsed: false, - singletonTooltip: null, - tooltipInstances: [], - get collapsible() { - return this.$options.collapsible !== false; - }, - get buttons() { - const buttonElements = this.$el.querySelectorAll( - "[data-component='app-button']" - ); - return Array.from(buttonElements).map((el) => getComponent(el)); - }, - get parent() { - return this.$root.parentElement; - }, - init() { - if (this.collapsible) { - this.$nextTick(() => { - this.onResize(); - this.createSingletonTooltip(); - this.ready = true; - }); - } else { - this.ready = true; - } - this.$watch("collapsed", (value) => { - this.buttons.forEach((button) => { - button.isCollapsed = value; - }); - this.$nextTick(() => this.createSingletonTooltip()); - }); - }, - createSingletonTooltip() { - this.destroySingletonTooltip(); - this.tooltipInstances = this.buttons.map((button) => button.shouldShowTooltip() && button.tippyInstance).filter((t3) => t3); - this.singletonTooltip = createSingleton(this.tooltipInstances, { - theme: "coco-tooltip", - delay: 100, - moveTransition: "transform 0.1s ease-out" - }); - }, - destroySingletonTooltip() { - if (this.singletonTooltip && this.singletonTooltip.destroy) { - this.singletonTooltip.destroy(); - this.singletonTooltip = null; - this.tooltipInstances.forEach((tooltip) => tooltip.destroy()); - this.tooltipInstances = []; - } - }, - onResize() { - if (!this.collapsible) - return; - this.containerWidth = Math.ceil(this.parent.offsetWidth); - if (this.collapsed) { - if (this.containerWidth > this.contentWidth) { - this.collapsed = false; - } - } else { - if (this.containerWidth < this.contentWidth) { - this.collapsed = true; - } else { - const contentWidth = Math.ceil(this.$refs.buttons.scrollWidth); - this.contentWidth = contentWidth; - } - } - }, - destroy() { - if (this.singletonTooltip) { - this.singletonTooltip.destroy(); - this.singletonTooltip = null; - } - } - }; - }); - // ../../components/coco/app/elements/color_picker/color_picker.js var color_picker_exports = {}; __export(color_picker_exports, { default: () => color_picker_default }); @@ -27435,10 +27447,10 @@ var page_default = CocoComponent("pageLayout", () => { return {}; }); // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/app|@appComponents/**/*.js - var modules3 = [header_exports, nav_drawer_exports, item_exports, menu_exports, navbar_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, page_exports]; + var modules3 = [header_exports, nav_drawer_exports, item_exports, menu_exports, navbar_exports, slide_editor_exports, alert_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, page_exports]; var __default3 = modules3; // app/components.js var components_default3 = registerComponents(__default3);