Best JavaScript code snippet using playwright-internal
vuetensils.es.js
Source:vuetensils.es.js
...116 default: withCtx(() => [117 !_ctx.dismissed && !!$props.modelValue ? (openBlock(), createBlock(resolveDynamicComponent($props.tag), {118 key: 0,119 role: "alert",120 class: normalizeClass(["vts-alert", $props.classes.root])121 }, {122 default: withCtx(() => [123 renderSlot(_ctx.$slots, "default"),124 $props.dismissible ? (openBlock(), createElementBlock("button", {125 key: 0,126 "aria-label": $props.dismissLabel,127 class: normalizeClass(["vts-alert__dismiss", $props.classes.dismiss]),128 onClick: _cache[0] || (_cache[0] = (...args) => $options.dismiss && $options.dismiss(...args))129 }, [130 renderSlot(_ctx.$slots, "dismiss", {}, () => [131 _hoisted_2$a132 ])133 ], 10, _hoisted_1$e)) : createCommentVNode("", true)134 ]),135 _: 3136 }, 8, ["class"])) : createCommentVNode("", true)137 ]),138 _: 3139 }, 8, ["name"]);140}141var VAlert = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$g]]);142const _sfc_main$i = {143 name: "VAsync",144 props: {145 await: {146 type: [Promise, Function],147 default: () => Promise.resolve()148 },149 default: {150 type: void 0,151 default: void 0152 }153 },154 data() {155 return {156 pending: false,157 results: this.default,158 error: null,159 done: false160 };161 },162 watch: {163 await: {164 handler: "awaitOn",165 immediate: true166 },167 pending: {168 handler(pending) {169 this.$emit("pending", pending);170 },171 immediate: true172 }173 },174 methods: {175 awaitOn(promise) {176 if (!promise)177 return;178 promise = typeof promise === "function" ? promise() : promise;179 if (!promise.then)180 return;181 this.pending = true;182 this.results = this.default;183 this.error = null;184 return promise.then((results) => {185 this.results = typeof results === "undefined" ? this.default : results;186 this.$emit("resolve", results);187 }).catch((error) => {188 if (error instanceof Error) {189 error = {190 name: error.name,191 message: error.message192 };193 }194 this.error = error;195 this.$emit("reject", error);196 }).finally(() => {197 this.pending = false;198 this.done = true;199 this.$emit("finally");200 });201 }202 },203 render() {204 const { pending, error, results, done } = this;205 let slots = this.$slots;206 const pendingSlot = slots.pending;207 const rejectedSlot = slots.rejected;208 const resolvedSlot = slots.resolved;209 const defaultSlot = slots.default;210 if (pending && pendingSlot) {211 return pendingSlot();212 }213 if (done && error && rejectedSlot) {214 return rejectedSlot(error);215 }216 if (done && !error && resolvedSlot) {217 return resolvedSlot(results);218 }219 if (!defaultSlot)220 return;221 return defaultSlot({222 pending,223 resolved: results,224 rejected: error,225 results,226 error227 });228 }229};230var VBtn_vue_vue_type_style_index_0_lang = "";231const _sfc_main$h = {232 name: "VBtn",233 inheritAttrs: false,234 props: {235 action: { type: String, default: "" },236 data: { type: Object, default: () => ({}) }237 },238 computed: {239 tag() {240 const attrs = this.$attrs || {};241 if (attrs.to) {242 return "RouterLink";243 }244 if (attrs.href) {245 return "a";246 }247 return "button";248 },249 type() {250 if (this.tag !== "button")251 return;252 return this.$attrs.type || "button";253 },254 listeners() {255 {256 return this.$attrs;257 }258 }259 },260 methods: {261 async onSubmit({ target: form }) {262 try {263 const data = new FormData(form);264 const response = await fetch(form.action, {265 method: form.method,266 body: data267 });268 this.$emit("response", response);269 } catch (error) {270 this.$emit("error", error);271 }272 }273 }274};275const _hoisted_1$d = ["action"];276const _hoisted_2$9 = ["value", "name"];277function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {278 return $props.action && $props.data ? (openBlock(), createElementBlock("form", {279 key: 0,280 action: $props.action,281 method: "POST",282 class: "vts-btn__form",283 onSubmit: _cache[0] || (_cache[0] = withModifiers((...args) => $options.onSubmit && $options.onSubmit(...args), ["prevent"]))284 }, [285 (openBlock(true), createElementBlock(Fragment, null, renderList($props.data, (key, value) => {286 return openBlock(), createElementBlock("input", {287 key,288 value,289 name: key,290 type: "hidden",291 hidden: "",292 autocomplete: "off",293 "aria-hidden": "true",294 tabindex: "-1"295 }, null, 8, _hoisted_2$9);296 }), 128)),297 createElementVNode("button", mergeProps({ type: "submit" }, _ctx.$attrs, { class: "vts-btn" }, toHandlers(_ctx.$listeners)), [298 renderSlot(_ctx.$slots, "default")299 ], 16)300 ], 40, _hoisted_1$d)) : (openBlock(), createBlock(resolveDynamicComponent($options.tag), mergeProps({301 key: 1,302 class: "vts-btn",303 type: $options.type304 }, _ctx.$attrs, toHandlers($options.listeners)), {305 default: withCtx(() => [306 renderSlot(_ctx.$slots, "default")307 ]),308 _: 3309 }, 16, ["type"]));310}311var VBtn = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$f]]);312var keycodes = Object.freeze({313 TAB: 9,314 ENTER: 13,315 ESC: 27,316 SPACE: 32,317 PAGEUP: 33,318 PAGEDOWN: 34,319 END: 35,320 HOME: 36,321 LEFT: 37,322 UP: 38,323 RIGHT: 39,324 DOWN: 40325});326var autofocus = {327 inserted: (el) => el.focus()328};329var clickout = {330 bind(el, binding) {331 el._vtsClickout = {332 stop: (e) => e.stopPropagation()333 };334 document.body.addEventListener("click", binding.value);335 el.addEventListener("click", el._vtsClickout.stop);336 },337 unbind(el, binding) {338 document.body.removeEventListener("click", binding.value);339 el.removeEventListener("click", el._vtsClickout.stop);340 }341};342function copyToClipboard(content) {343 const activeEl = document.activeElement;344 const textarea = document.createElement("textarea");345 textarea.value = content;346 textarea.setAttribute("readonly", "");347 textarea.style.position = "absolute";348 textarea.style.left = "-9999px";349 textarea.style.fontSize = "12pt";350 document.body.append(textarea);351 textarea.select();352 document.execCommand("copy");353 textarea.remove();354 activeEl && activeEl.focus();355}356var copy = {357 bind(el, binding) {358 el._vtsCopy = () => copyToClipboard(binding.value);359 el.addEventListener("click", el._vtsCopy);360 },361 update(el, binding) {362 el.removeEventListener("click", el._vtsCopy);363 el._vtsCopy = () => copyToClipboard(binding.value);364 el.addEventListener("click", el._vtsCopy);365 },366 unbind(el) {367 el.removeEventListener("click", el._vtsCopy);368 }369};370function unbind(el) {371 if (!el._vtsIntersect)372 return;373 el._vtsIntersect.unobserve(el);374 delete el._vtsIntersect;375}376var intersect = {377 inserted: (el, { value, modifiers }) => {378 const options = __spreadValues({}, value);379 const { enter, exit, once } = modifiers;380 if (options.root) {381 options.root = typeof options.root === "string" ? document.querySelector(options.root) : options.root;382 }383 const listeners = __spreadValues({}, value);384 if (value instanceof Function) {385 if (enter)386 listeners.onEnter = value;387 if (exit)388 listeners.onExit = value;389 if (!enter && !exit)390 listeners.onChange = value;391 }392 const observer = new IntersectionObserver(([entry]) => {393 const isThresholdArray = Array.isArray(options.threshold);394 const clone = {};395 for (const key in entry) {396 clone[key] = entry[key];397 }398 clone.isIntersecting = isThresholdArray ? options.threshold.includes(entry.intersectionRatio) : entry.intersectionRatio === options.threshold;399 if (clone.isIntersecting) {400 listeners.onEnter && listeners.onEnter(clone, el);401 } else {402 listeners.onExit && listeners.onExit(clone, el);403 }404 listeners.onChange && listeners.onChange(clone, el);405 if (once) {406 unbind(el);407 }408 }, options);409 observer.observe(el);410 el._vtsIntersect = observer;411 },412 unbind413};414var allDirectives = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({415 __proto__: null,416 autofocus,417 clickout,418 copy,419 intersect420}, Symbol.toStringTag, { value: "Module" }));421var FOCUSABLE = [422 'a[href]:not([tabindex^="-"])',423 'area[href]:not([tabindex^="-"])',424 'input:not([disabled]):not([type="hidden"]):not([aria-hidden]):not([tabindex^="-"])',425 'select:not([disabled]):not([aria-hidden]):not([tabindex^="-"])',426 'textarea:not([disabled]):not([aria-hidden]):not([tabindex^="-"])',427 'button:not([disabled]):not([aria-hidden]):not([tabindex^="-"]):not([tabindex^="-"])',428 'iframe:not([tabindex^="-"])',429 'object:not([tabindex^="-"])',430 'embed:not([tabindex^="-"])',431 '[contenteditable]:not([tabindex^="-"])',432 '[tabindex]:not([tabindex^="-"])'433];434function randomString(length = 10, allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {435 let result = "";436 for (let i = 0; i < length; i++) {437 result += allowed.charAt(Math.floor(Math.random() * allowed.length));438 }439 return result;440}441function applyFocusTrap(el, event) {442 const focusable = Array.from(el.querySelectorAll(FOCUSABLE));443 if (!focusable.length) {444 event.preventDefault();445 return;446 }447 if (!el.contains(document.activeElement)) {448 event.preventDefault();449 focusable[0].focus();450 } else {451 const focusedItemIndex = focusable.indexOf(document.activeElement);452 if (event.shiftKey && focusedItemIndex === 0) {453 focusable[focusable.length - 1].focus();454 event.preventDefault();455 }456 if (!event.shiftKey && focusedItemIndex === focusable.length - 1) {457 focusable[0].focus();458 event.preventDefault();459 }460 }461}462var VDate_vue_vue_type_style_index_0_lang = "";463function sameDays(first, second) {464 return first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();465}466const keysUsed = [467 keycodes.UP,468 keycodes.DOWN,469 keycodes.LEFT,470 keycodes.RIGHT,471 keycodes.PAGEUP,472 keycodes.PAGEDOWN,473 keycodes.HOME,474 keycodes.END475];476const _sfc_main$g = {477 name: "VDate",478 directives: {479 clickout480 },481 model: {482 prop: "date",483 event: "update"484 },485 props: {486 date: {487 type: [Date, String],488 default: () => new Date()489 },490 min: {491 type: [Date, String],492 default: ""493 },494 max: {495 type: [Date, String],496 default: ""497 },498 id: {499 type: String,500 default: () => `vts-${randomString(4)}`501 },502 daysOfWeek: {503 type: Object,504 default: () => {505 return Object.freeze({506 Su: "Sunday",507 Mo: "Monday",508 Tu: "Tuesday",509 We: "Wednesday",510 Th: "Thursday",511 Fr: "Friday",512 Sa: "Saturday"513 });514 }515 },516 monthLabels: {517 type: Array,518 default: () => [519 "January",520 "February",521 "March",522 "April",523 "May",524 "June",525 "July",526 "August",527 "September",528 "October",529 "November",530 "December"531 ]532 },533 buttonLabels: {534 type: Object,535 default: () => {536 return Object.freeze({537 selectDate: "Select Date",538 showCalendar: "show calendar",539 previousMonth: "previous month",540 nextMonth: "next month",541 previousYear: "previous year",542 nextYear: "next year"543 });544 }545 },546 classes: {547 type: Object,548 default: () => ({})549 }550 },551 data() {552 return {553 show: false,554 previousActiveEl: null,555 focusedDate: new Date(this.date),556 selectedDate: new Date(this.date)557 };558 },559 computed: {560 monthYear() {561 const { monthLabels, focusedDate } = this;562 return `${monthLabels[focusedDate.getMonth()]} ${focusedDate.getFullYear()}`;563 },564 disableNav() {565 const { focusedDate, min, max } = this;566 const disableNav = {};567 const minDate = new Date(min);568 const maxDate = new Date(max);569 if (min) {570 disableNav.prevYear = focusedDate.getYear() <= minDate.getYear();571 disableNav.prevMonth = focusedDate.getMonth() <= minDate.getMonth();572 }573 if (max) {574 disableNav.nextYear = focusedDate.getYear() >= maxDate.getYear();575 disableNav.nextMonth = focusedDate.getMonth() >= maxDate.getMonth();576 }577 return disableNav;578 },579 daysByWeeks() {580 const { focusedDate, selectedDate, min, max } = this;581 const firstDayOfMonth = new Date(focusedDate.getFullYear(), focusedDate.getMonth(), 1);582 const dayOfWeek = firstDayOfMonth.getDay();583 firstDayOfMonth.setDate(firstDayOfMonth.getDate() - dayOfWeek);584 const daysInMonth = new Date(focusedDate.getFullYear(), focusedDate.getMonth() + 1, 0).getDate();585 const d = new Date(firstDayOfMonth);586 const maxWeeks = dayOfWeek + daysInMonth < 36 ? 5 : 6;587 const weeks = [];588 for (let i = 0; i < maxWeeks; i++) {589 weeks.push([]);590 for (let j = 0; j < 7; j++) {591 const date = new Date(d);592 let disabled = false;593 if (min) {594 disabled = date < new Date(min);595 }596 if (max && !disabled) {597 disabled = date > new Date(max);598 }599 weeks[i].push({600 date,601 isFocused: sameDays(date, focusedDate),602 isSelected: sameDays(date, selectedDate),603 disabled604 });605 d.setDate(d.getDate() + 1);606 }607 }608 return weeks;609 },610 toggle() {611 const { show } = this;612 return {613 bind: {614 "aria-label": this.buttonLabels.selectDate,615 "aria-expanded": "" + show616 },617 on: {618 click: () => {619 this.show = !show;620 }621 }622 };623 }624 },625 watch: {626 show(isShow) {627 const { previousActiveEl, date } = this;628 if (isShow) {629 this.previousActiveEl = document.activeElement;630 this.focusedDate = new Date(date);631 this.$nextTick(() => {632 this.$el.querySelector('button[aria-selected="true"]').focus();633 });634 } else if (previousActiveEl) {635 previousActiveEl.focus();636 }637 },638 selectedDate(date) {639 this.$emit("update", date);640 this.show = false;641 }642 },643 methods: {644 incrementMonthBy(inc) {645 const { focusedDate } = this;646 const last = new Date(focusedDate);647 last.setMonth(last.getMonth() + inc + 1);648 last.setDate(0);649 const fd = new Date(focusedDate);650 fd.setDate(Math.min(fd.getDate(), last.getDate()));651 fd.setMonth(fd.getMonth() + inc);652 this.focusedDate = fd;653 },654 incrementYearBy(inc) {655 const d = new Date(this.focusedDate);656 d.setFullYear(d.getFullYear() + inc);657 this.focusedDate = d;658 },659 onClick({ target }) {660 if (!target.classList.contains("vts-date__day"))661 return;662 this.selectedDate = new Date(target.value);663 },664 onKeydown(event) {665 if (!event.target.classList.contains("vts-date__day"))666 return;667 if (!keysUsed.includes(event.keyCode))668 return;669 event.stopPropagation();670 event.preventDefault();671 const { focusedDate, min, max } = this;672 const d = new Date(focusedDate);673 switch (event.keyCode) {674 case keycodes.ENTER:675 case keycodes.SPACE:676 this.selectedDate = d;677 return;678 case keycodes.RIGHT:679 d.setDate(d.getDate() + 1);680 break;681 case keycodes.LEFT:682 d.setDate(d.getDate() - 1);683 break;684 case keycodes.DOWN:685 d.setDate(d.getDate() + 7);686 break;687 case keycodes.UP:688 d.setDate(d.getDate() - 7);689 break;690 case keycodes.PAGEUP:691 if (event.shiftKey) {692 d.setFullYear(focusedDate.getFullYear() - 1);693 } else {694 d.setMonth(focusedDate.getMonth() - 1);695 }696 break;697 case keycodes.PAGEDOWN:698 if (event.shiftKey) {699 d.setFullYear(focusedDate.getFullYear() + 1);700 } else {701 d.setMonth(focusedDate.getMonth() + 1);702 }703 break;704 case keycodes.HOME:705 d.setDate(d.getDate() - d.getDay());706 break;707 case keycodes.END:708 d.setDate(d.getDate() + (6 - d.getDay()));709 break;710 }711 const minDate = min && new Date(min);712 const maxDate = max && new Date(max);713 if (minDate && d < minDate || maxDate && d > maxDate)714 return;715 this.focusedDate = d;716 this.$nextTick(() => {717 this.$el.querySelector('button[aria-selected="true"]').focus();718 });719 },720 onTab(event) {721 applyFocusTrap(this.$refs.calendar, event);722 },723 onClickout(event) {724 const { show } = this;725 event.preventDefault();726 if (show) {727 this.show = false;728 }729 }730 }731};732const _hoisted_1$c = ["id"];733const _hoisted_2$8 = ["aria-label"];734const _hoisted_3$4 = ["aria-labelledby"];735const _hoisted_4$3 = { class: "vts-date__navigation" };736const _hoisted_5$1 = ["aria-label", "disabled"];737const _hoisted_6$1 = /* @__PURE__ */ createTextVNode("\u219E");738const _hoisted_7$1 = ["aria-label", "disabled"];739const _hoisted_8$1 = /* @__PURE__ */ createTextVNode("\u2190");740const _hoisted_9 = ["id"];741const _hoisted_10 = ["aria-label", "disabled"];742const _hoisted_11 = /* @__PURE__ */ createTextVNode("\u2192");743const _hoisted_12 = ["aria-label", "disabled"];744const _hoisted_13 = /* @__PURE__ */ createTextVNode("\u21A0");745const _hoisted_14 = ["aria-labelledby"];746const _hoisted_15 = ["abbr"];747const _hoisted_16 = ["tabindex", "aria-selected", "value", "disabled"];748function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {749 const _directive_clickout = resolveDirective("clickout");750 return withDirectives((openBlock(), createElementBlock("div", {751 id: $props.id,752 class: normalizeClass(["vtd-date", $props.classes.root])753 }, [754 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps($options.toggle)), () => [755 createElementVNode("button", mergeProps($options.toggle.bind, {756 type: "button",757 class: ["vtd-date__toggle", $props.classes.toggle]758 }, toHandlers($options.toggle.on)), [759 createElementVNode("span", {760 role: "img",761 "aria-label": $props.buttonLabels.showCalendar762 }, " \u{1F4C5} ", 8, _hoisted_2$8)763 ], 16)764 ]),765 withDirectives(createElementVNode("div", {766 ref: "calendar",767 class: normalizeClass(["", ["vtd-date__wrapper", $props.classes.wrapper]]),768 role: "dialog",769 "aria-modal": "true",770 "aria-labelledby": `${$props.id}-dialog-label`,771 onClick: _cache[4] || (_cache[4] = (...args) => $options.onClick && $options.onClick(...args)),772 onKeydown: [773 _cache[5] || (_cache[5] = (...args) => $options.onKeydown && $options.onKeydown(...args)),774 _cache[6] || (_cache[6] = withKeys((...args) => $options.onTab && $options.onTab(...args), ["tab"])),775 _cache[7] || (_cache[7] = withKeys(($event) => $data.show = false, ["esc"]))776 ]777 }, [778 createElementVNode("div", _hoisted_4$3, [779 createElementVNode("button", {780 class: normalizeClass(["vtd-date__prev-year", $props.classes.prevYear]),781 "aria-label": $props.buttonLabels.previousYear,782 type: "button",783 disabled: $options.disableNav.prevYear,784 onClick: _cache[0] || (_cache[0] = ($event) => $options.incrementYearBy(-1))785 }, [786 renderSlot(_ctx.$slots, "prevYearLabel", {}, () => [787 _hoisted_6$1788 ])789 ], 10, _hoisted_5$1),790 createElementVNode("button", {791 class: normalizeClass(["vtd-date__prev-month", $props.classes.prevMonth]),792 "aria-label": $props.buttonLabels.previousMonth,793 type: "button",794 disabled: $options.disableNav.prevMonth,795 onClick: _cache[1] || (_cache[1] = ($event) => $options.incrementMonthBy(-1))796 }, [797 renderSlot(_ctx.$slots, "prevMonthLabel", {}, () => [798 _hoisted_8$1799 ])800 ], 10, _hoisted_7$1),801 createElementVNode("h4", {802 id: `${$props.id}-dialog-label`,803 class: normalizeClass(["vtd-date__title", $props.classes.title]),804 "aria-live": "polite"805 }, toDisplayString($options.monthYear), 11, _hoisted_9),806 createElementVNode("button", {807 class: normalizeClass(["vtd-date__next-month", $props.classes.nextMonth]),808 "aria-label": $props.buttonLabels.nextMonth,809 type: "button",810 disabled: $options.disableNav.nextMonth,811 onClick: _cache[2] || (_cache[2] = ($event) => $options.incrementMonthBy(1))812 }, [813 renderSlot(_ctx.$slots, "nextMonthLabel", {}, () => [814 _hoisted_11815 ])816 ], 10, _hoisted_10),817 createElementVNode("button", {818 class: normalizeClass(["vtd-date__next-year", $props.classes.nextYear]),819 "aria-label": $props.buttonLabels.nextYear,820 type: "button",821 disabled: $options.disableNav.nextYear,822 onClick: _cache[3] || (_cache[3] = ($event) => $options.incrementYearBy(1))823 }, [824 renderSlot(_ctx.$slots, "nextYearLabel", {}, () => [825 _hoisted_13826 ])827 ], 10, _hoisted_12)828 ]),829 createElementVNode("table", {830 class: normalizeClass(["vtd-date__calendar", $props.classes.calendar]),831 role: "grid",832 "aria-labelledby": `${$props.id}-dialog-label`833 }, [834 createElementVNode("thead", {835 class: normalizeClass(["vtd-date__thead", $props.classes.thead])836 }, [837 createElementVNode("tr", {838 class: normalizeClass(["vtd-date__week", $props.classes.week])839 }, [840 (openBlock(true), createElementBlock(Fragment, null, renderList($props.daysOfWeek, (val, key) => {841 return openBlock(), createElementBlock("th", {842 key,843 abbr: val,844 scope: "col",845 class: normalizeClass(["vtd-date__th", $props.classes.th])846 }, toDisplayString(key), 11, _hoisted_15);847 }), 128))848 ], 2)849 ], 2),850 createElementVNode("tbody", {851 class: normalizeClass(["vtd-date__tbody", $props.classes.tbody])852 }, [853 (openBlock(), createElementBlock(Fragment, null, renderList(6, (week) => {854 return createElementVNode("tr", {855 key: week,856 class: normalizeClass(["vtd-date__tr", $props.classes.tr])857 }, [858 (openBlock(true), createElementBlock(Fragment, null, renderList($options.daysByWeeks[week - 1], (day) => {859 return openBlock(), createElementBlock("td", {860 key: day.date.toString(),861 class: normalizeClass([862 "vts-date__td",863 { "vts-date__td--focused": day.isFocused },864 { "vts-date__td--selected": day.isSelected },865 $props.classes.td,866 { [$props.classes.tdFocused]: $props.classes.tdFocused && day.isFocused },867 { [$props.classes.tdSelected]: $props.classes.tdSelected && day.isSelected }868 ])869 }, [870 createElementVNode("button", {871 class: normalizeClass([872 "vts-date__day",873 { "vts-date__day--focused": day.isFocused },874 { "vts-date__day--selected": day.isSelected },875 $props.classes.day,876 { [$props.classes.dayFocused]: $props.classes.dayFocused && day.isFocused },877 {878 [$props.classes.daySelected]: $props.classes.daySelected && day.isSelected879 }880 ]),881 tabindex: day.isFocused ? "0" : "-1",882 "aria-selected": day.isFocused,883 value: day.date,884 disabled: day.disabled,885 type: "button"886 }, toDisplayString(day.date.getDate()), 11, _hoisted_16)887 ], 2);888 }), 128))889 ], 2);890 }), 64))891 ], 2)892 ], 10, _hoisted_14)893 ], 42, _hoisted_3$4), [894 [vShow, $data.show]895 ])896 ], 10, _hoisted_1$c)), [897 [_directive_clickout, $options.onClickout]898 ]);899}900var VDate = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$e]]);901var VDialog_vue_vue_type_style_index_0_lang = "";902const _sfc_main$f = {903 name: "VDialog",904 inheritAttrs: false,905 model: {906 prop: "showing",907 event: "update"908 },909 props: {910 showing: Boolean,911 tag: {912 type: String,913 default: "div"914 },915 dismissible: {916 type: Boolean,917 default: true918 },919 width: {920 type: String,921 default: ""922 },923 inlineSize: {924 type: String,925 default: ""926 },927 maxWidth: {928 type: String,929 default: ""930 },931 maxInlineSize: {932 type: String,933 default: ""934 },935 noScroll: Boolean,936 transition: {937 type: String,938 default: ""939 },940 bgTransition: {941 type: String,942 default: ""943 },944 contentTransition: {945 type: String,946 default: ""947 },948 classes: {949 type: Object,950 default: () => ({})951 }952 },953 data() {954 return {955 localShow: this.showing,956 activeElement: null957 };958 },959 computed: {960 slots() {961 return this.$slots;962 }963 },964 watch: {965 showing(next) {966 this.localShow = next;967 },968 localShow: {969 handler(next, prev) {970 if (typeof window === "undefined")971 return;972 if (next && next != prev) {973 this.activeElement = document.activeElement;974 this.onOpen();975 } else {976 this.onClose();977 const { activeElement } = this;978 if (activeElement && activeElement.focus) {979 this.$nextTick(() => {980 activeElement.focus();981 });982 }983 }984 this.$emit("update", next);985 }986 }987 },988 destroyed() {989 this.onClose();990 },991 methods: {992 onOpen() {993 const { onClick, onKeydown, noScroll } = this;994 window.addEventListener("click", onClick);995 window.addEventListener("keydown", onKeydown);996 noScroll && document.body.style.setProperty("overflow", "hidden");997 this.$nextTick(() => this.$refs.content.focus());998 this.$emit("open");999 },1000 onClose() {1001 const { onClick, onKeydown, noScroll } = this;1002 window.removeEventListener("click", onClick);1003 window.removeEventListener("keydown", onKeydown);1004 noScroll && document.body.style.removeProperty("overflow");1005 this.$emit("close");1006 },1007 onClick(event) {1008 if (event.target.classList.contains("vts-dialog") && this.dismissible) {1009 this.localShow = false;1010 }1011 },1012 onKeydown(event) {1013 if (event.keyCode === keycodes.ESC && this.dismissible) {1014 this.localShow = false;1015 }1016 if (event.keyCode === keycodes.TAB) {1017 const content = this.$refs.content;1018 if (!content)1019 return;1020 const focusable = Array.from(content.querySelectorAll(FOCUSABLE));1021 if (!focusable.length) {1022 event.preventDefault();1023 return;1024 }1025 if (!content.contains(document.activeElement)) {1026 event.preventDefault();1027 focusable[0].focus();1028 } else {1029 const focusedItemIndex = focusable.indexOf(document.activeElement);1030 if (event.shiftKey && focusedItemIndex === 0) {1031 focusable[focusable.length - 1].focus();1032 event.preventDefault();1033 }1034 if (!event.shiftKey && focusedItemIndex === focusable.length - 1) {1035 focusable[0].focus();1036 event.preventDefault();1037 }1038 }1039 }1040 }1041 }1042};1043const _hoisted_1$b = { key: 0 };1044function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {1045 return $data.localShow || $options.slots.toggle ? (openBlock(), createElementBlock("span", _hoisted_1$b, [1046 $options.slots.toggle ? renderSlot(_ctx.$slots, "toggle", normalizeProps(mergeProps({ key: 0 }, {1047 on: {1048 click: () => $data.localShow = !$data.localShow1049 },1050 bind: {1051 type: "button",1052 role: "button",1053 "aria-haspopup": true,1054 "aria-expanded": "" + $data.localShow1055 }1056 }))) : createCommentVNode("", true),1057 createVNode(Transition, {1058 name: $props.bgTransition || $props.transition,1059 appear: true1060 }, {1061 default: withCtx(() => [1062 $data.localShow ? (openBlock(), createElementBlock("div", {1063 key: 0,1064 class: normalizeClass(["vts-dialog", $props.classes.root, $props.classes.bg, _ctx.$attrs.class])1065 }, [1066 createVNode(Transition, { name: $props.contentTransition }, {1067 default: withCtx(() => [1068 (openBlock(), createBlock(resolveDynamicComponent($props.tag), {1069 ref: "content",1070 class: normalizeClass(["vts-dialog__content", $props.classes.content]),1071 style: normalizeStyle({1072 width: $props.width,1073 "inline-size": $props.inlineSize,1074 "max-width": $props.maxWidth,1075 "max-inline-size": $props.maxInlineSize1076 }),1077 tabindex: "-1",1078 role: "dialog",1079 "aria-modal": "true"1080 }, {1081 default: withCtx(() => [1082 renderSlot(_ctx.$slots, "default")1083 ]),1084 _: 31085 }, 8, ["class", "style"]))1086 ]),1087 _: 31088 }, 8, ["name"])1089 ], 2)) : createCommentVNode("", true)1090 ]),1091 _: 31092 }, 8, ["name"])1093 ])) : createCommentVNode("", true);1094}1095var VDialog = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$d]]);1096var VDrawer_vue_vue_type_style_index_0_lang = "";1097const NAME$1 = "vts-drawer";1098const _sfc_main$e = {1099 name: "VDrawer",1100 model: {1101 prop: "showing",1102 event: "update"1103 },1104 props: {1105 showing: Boolean,1106 tag: {1107 type: String,1108 default: "aside"1109 },1110 right: Boolean,1111 width: {1112 type: String,1113 default: ""1114 },1115 inlineSize: {1116 type: String,1117 default: ""1118 },1119 maxWidth: {1120 type: String,1121 default: ""1122 },1123 maxInlineSize: {1124 type: String,1125 default: ""1126 },1127 noScroll: Boolean,1128 transition: {1129 type: String,1130 default: ""1131 },1132 bgTransition: {1133 type: String,1134 default: ""1135 },1136 classes: {1137 type: Object,1138 default: () => ({})1139 }1140 },1141 data() {1142 return {1143 localShow: this.showing,1144 activeElement: null1145 };1146 },1147 computed: {1148 slots() {1149 return this.$slots;1150 }1151 },1152 watch: {1153 showing(next) {1154 this.localShow = next;1155 },1156 localShow: {1157 handler(next, prev) {1158 if (typeof window === "undefined")1159 return;1160 if (next && next != prev) {1161 this.activeElement = document.activeElement;1162 this.onOpen();1163 } else {1164 this.onClose();1165 const { activeElement } = this;1166 if (activeElement && activeElement.focus) {1167 this.$nextTick(() => {1168 activeElement.focus();1169 });1170 }1171 }1172 this.$emit("update", next);1173 }1174 }1175 },1176 destroyed() {1177 this.onClose();1178 },1179 methods: {1180 onOpen() {1181 const { onClick, onKeydown, noScroll } = this;1182 window.addEventListener("click", onClick);1183 window.addEventListener("keydown", onKeydown);1184 noScroll && document.body.style.setProperty("overflow", "hidden");1185 this.$nextTick(() => this.$refs.content.focus());1186 this.$emit("open");1187 },1188 onClose() {1189 const { onClick, onKeydown, noScroll } = this;1190 window.removeEventListener("click", onClick);1191 window.removeEventListener("keydown", onKeydown);1192 noScroll && document.body.style.removeProperty("overflow");1193 this.$emit("close");1194 },1195 onClick(event) {1196 if (event.target.classList.contains(NAME$1)) {1197 this.localShow = false;1198 }1199 },1200 onKeydown(event) {1201 if (event.keyCode === keycodes.ESC) {1202 this.localShow = false;1203 }1204 if (event.keyCode === keycodes.TAB) {1205 const content = this.$refs.content;1206 if (!content)1207 return;1208 const focusable = Array.from(content.querySelectorAll(FOCUSABLE));1209 if (!focusable.length) {1210 event.preventDefault();1211 return;1212 }1213 if (!content.contains(document.activeElement)) {1214 event.preventDefault();1215 focusable[0].focus();1216 } else {1217 const focusedItemIndex = focusable.indexOf(document.activeElement);1218 if (event.shiftKey && focusedItemIndex === 0) {1219 focusable[focusable.length - 1].focus();1220 event.preventDefault();1221 }1222 if (!event.shiftKey && focusedItemIndex === focusable.length - 1) {1223 focusable[0].focus();1224 event.preventDefault();1225 }1226 }1227 }1228 }1229 }1230};1231const _hoisted_1$a = { key: 0 };1232function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {1233 return $data.localShow || $options.slots.toggle ? (openBlock(), createElementBlock("span", _hoisted_1$a, [1234 $options.slots.toggle ? renderSlot(_ctx.$slots, "toggle", normalizeProps(mergeProps({ key: 0 }, {1235 on: {1236 click: () => $data.localShow = !$data.localShow1237 },1238 bind: {1239 type: "button",1240 role: "button",1241 "aria-haspopup": true,1242 "aria-expanded": "" + $data.localShow1243 }1244 }))) : createCommentVNode("", true),1245 createVNode(Transition, {1246 name: $props.bgTransition || $props.transition,1247 appear: ""1248 }, {1249 default: withCtx(() => [1250 $data.localShow ? (openBlock(), createElementBlock("div", {1251 key: 0,1252 class: normalizeClass(["vts-drawer", $props.classes.root, $props.classes.bg, _ctx.$attrs.class])1253 }, [1254 createVNode(Transition, {1255 name: $props.transition,1256 appear: ""1257 }, {1258 default: withCtx(() => [1259 $data.localShow ? (openBlock(), createBlock(resolveDynamicComponent($props.tag), {1260 key: 0,1261 ref: "content",1262 class: normalizeClass([1263 "vts-drawer__content",1264 { "vts-drawer__content--right": !!$props.right },1265 $props.classes.content1266 ]),1267 style: normalizeStyle({1268 width: $props.width,1269 "inline-size": $props.inlineSize,1270 "max-width": $props.maxWidth,1271 "max-inline-size": $props.maxInlineSize1272 }),1273 tabindex: "-1"1274 }, {1275 default: withCtx(() => [1276 renderSlot(_ctx.$slots, "default")1277 ]),1278 _: 31279 }, 8, ["class", "style"])) : createCommentVNode("", true)1280 ]),1281 _: 31282 }, 8, ["name"])1283 ], 2)) : createCommentVNode("", true)1284 ]),1285 _: 31286 }, 8, ["name"])1287 ])) : createCommentVNode("", true);1288}1289var VDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$c]]);1290var VDropdown_vue_vue_type_style_index_0_lang = "";1291const _sfc_main$d = {1292 name: "VDrawer",1293 props: {1294 text: {1295 type: String,1296 default: ""1297 },1298 position: {1299 type: String,1300 default: "bottom",1301 validator(value) {1302 return ["top", "bottom"].includes(value);1303 }1304 },1305 transition: {1306 type: String,1307 default: ""1308 },1309 classes: {1310 type: Object,1311 default: () => ({})1312 }1313 },1314 data: () => ({1315 isHovered: false,1316 isFocused: false1317 }),1318 mounted() {1319 document.addEventListener("click", this.onClickout);1320 },1321 beforeDestroy() {1322 document.removeEventListener("click", this.onClickout);1323 },1324 beforeUnmount() {1325 document.removeEventListener("click", this.onClickout);1326 },1327 methods: {1328 onClickout(e) {1329 if (!this.$el.contains(e.target)) {1330 this.isFocused = false;1331 }1332 },1333 onFocusout(event) {1334 if (!this.$el.contains(event.relatedTarget)) {1335 this.isFocused = false;1336 }1337 }1338 }1339};1340const _hoisted_1$9 = ["aria-expanded"];1341function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {1342 return openBlock(), createElementBlock("div", {1343 class: normalizeClass(["vts-dropdown", $props.classes.root]),1344 onMouseenter: _cache[1] || (_cache[1] = ($event) => _ctx.isHovered = true),1345 onMouseleave: _cache[2] || (_cache[2] = ($event) => _ctx.isHovered = false),1346 onFocus: _cache[3] || (_cache[3] = ($event) => _ctx.isFocused = true),1347 onBlur: _cache[4] || (_cache[4] = ($event) => _ctx.isFocused = false),1348 onFocusout: _cache[5] || (_cache[5] = (...args) => $options.onFocusout && $options.onFocusout(...args))1349 }, [1350 createElementVNode("button", {1351 "aria-expanded": !!_ctx.isHovered || !!_ctx.isFocused,1352 "aria-haspopup": "true",1353 class: normalizeClass(["vts-dropdown__trigger", $props.classes.trigger]),1354 onClick: _cache[0] || (_cache[0] = ($event) => _ctx.isFocused = !_ctx.isFocused)1355 }, [1356 renderSlot(_ctx.$slots, "trigger", {}, () => [1357 createTextVNode(toDisplayString($props.text), 1)1358 ])1359 ], 10, _hoisted_1$9),1360 createVNode(Transition, { name: $props.transition }, {1361 default: withCtx(() => [1362 !!_ctx.isHovered || !!_ctx.isFocused ? (openBlock(), createElementBlock("div", {1363 key: 0,1364 class: normalizeClass(["vts-dropdown__content", [`vts-dropdown__content--${$props.position}`, $props.classes.content]])1365 }, [1366 renderSlot(_ctx.$slots, "default")1367 ], 2)) : createCommentVNode("", true)1368 ]),1369 _: 31370 }, 8, ["name"])1371 ], 34);1372}1373var VDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$b]]);1374var VFile_vue_vue_type_style_index_0_lang = "";1375const _sfc_main$c = {1376 name: "VFile",1377 model: {1378 prop: "files",1379 event: "update"1380 },1381 props: {1382 label: {1383 type: String,1384 required: true1385 },1386 files: {1387 type: Array,1388 default: () => []1389 },1390 classes: {1391 type: Object,1392 default: () => ({})1393 }1394 },1395 data: () => ({1396 localFiles: [],1397 droppable: false1398 }),1399 computed: {1400 listeners() {1401 {1402 return this.$attrs;1403 }1404 }1405 },1406 watch: {1407 files(files) {1408 this.localFiles = files;1409 },1410 localFiles() {1411 this.droppable = false;1412 }1413 },1414 created() {1415 this.id = this.$attrs.id || "vts-" + randomString(4);1416 },1417 methods: {1418 onChange(event) {1419 const files = Array.from(event.target.files);1420 this.localFiles = files;1421 this.$emit("update", files);1422 },1423 onDrop(event) {1424 const files = Array.from(event.dataTransfer.files);1425 const isMulti = this.$attrs.multiple != null;1426 if (!isMulti && files.length > 1) {1427 files.length = 1;1428 }1429 this.localFiles = files;1430 this.$emit("update", files);1431 }1432 }1433};1434const _hoisted_1$8 = ["for"];1435const _hoisted_2$7 = ["id"];1436const _hoisted_3$3 = {1437 key: 0,1438 "aria-hidden": "true"1439};1440const _hoisted_4$2 = {1441 key: 1,1442 "aria-hidden": "true"1443};1444function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {1445 return openBlock(), createElementBlock("label", {1446 for: _ctx.id,1447 class: normalizeClass([1448 "vts-file",1449 {1450 "vts-file--droppable": _ctx.droppable,1451 "vts-file--selected": !!_ctx.localFiles.length1452 },1453 $props.classes.label1454 ])1455 }, [1456 createElementVNode("input", mergeProps({1457 id: _ctx.id,1458 ref: "input"1459 }, _ctx.$attrs, {1460 type: "file",1461 class: ["vts-visually-hidden", $props.classes.input],1462 onChange: _cache[0] || (_cache[0] = (...args) => $options.onChange && $options.onChange(...args))1463 }, toHandlers($options.listeners)), null, 16, _hoisted_2$7),1464 createElementVNode("span", {1465 class: normalizeClass(["vts-file__text", $props.classes.text])1466 }, [1467 renderSlot(_ctx.$slots, "label", {}, () => [1468 createTextVNode(toDisplayString($props.label), 1)1469 ])1470 ], 2),1471 createElementVNode("div", {1472 class: "vts-file__dropzone",1473 onDragenter: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.droppable = true, ["prevent"]))1474 }, [1475 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ files: _ctx.localFiles, droppable: _ctx.droppable })), () => [1476 _ctx.localFiles.length ? (openBlock(), createElementBlock("span", _hoisted_3$3, [1477 _ctx.localFiles.length > 1 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [1478 createTextVNode(toDisplayString(_ctx.localFiles.length) + " files selected ", 1)1479 ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [1480 createTextVNode(toDisplayString(_ctx.localFiles[0].name), 1)1481 ], 64))1482 ])) : (openBlock(), createElementBlock("span", _hoisted_4$2, " Choose files or drop here "))1483 ]),1484 _ctx.droppable ? (openBlock(), createElementBlock("span", {1485 key: 0,1486 class: "vts-file__overlay",1487 onDrop: _cache[1] || (_cache[1] = withModifiers((...args) => $options.onDrop && $options.onDrop(...args), ["prevent"])),1488 onDragenter: _cache[2] || (_cache[2] = withModifiers(($event) => _ctx.droppable = true, ["stop"])),1489 onDragleave: _cache[3] || (_cache[3] = withModifiers(($event) => _ctx.droppable = false, ["stop"])),1490 onDragover: _cache[4] || (_cache[4] = withModifiers(() => {1491 }, ["prevent"]))1492 }, [1493 renderSlot(_ctx.$slots, "overlay")1494 ], 32)) : createCommentVNode("", true)1495 ], 32)1496 ], 10, _hoisted_1$8);1497}1498var VFile = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$a]]);1499var VForm_vue_vue_type_style_index_0_lang = "";1500const controlTypes = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);1501const _sfc_main$b = {1502 name: "VForm",1503 props: {1504 lazy: {1505 type: Boolean,1506 default: false1507 },1508 errors: {1509 type: Object,1510 default: () => ({})1511 },1512 preventNavigation: {1513 type: Boolean,1514 default: false1515 },1516 honeypot: {1517 type: [Boolean, String],1518 default: false1519 }1520 },1521 data: () => ({1522 dirty: false,1523 modified: false,1524 localInputs: {}1525 }),1526 computed: {1527 listeners() {1528 {1529 return this.$attrs;1530 }1531 },1532 event() {1533 return this.lazy ? "change" : "input";1534 },1535 valid() {1536 return !Object.values(this.localInputs).find((input) => !input.valid);1537 },1538 error() {1539 return !this.valid && this.dirty;1540 },1541 inputs() {1542 const inputs = {};1543 const { localInputs, errors } = this;1544 for (const key in localInputs) {1545 const input = __spreadProps(__spreadValues({}, localInputs[key]), {1546 error: localInputs[key].dirty && !localInputs[key].valid,1547 errors: []1548 });1549 const errorsMap = new Map(Object.entries(errors || {}));1550 errorsMap.forEach((value, key2) => {1551 if (!input.invalid[key2])1552 return;1553 const errorHandler = errorsMap.get(key2);1554 const attrName = key2.replace("length", "Length");1555 const errorMessage = typeof errorHandler === "string" ? errorHandler : errorHandler(input._inputEl[attrName]);1556 input.errors.push(errorMessage);1557 });1558 inputs[key] = input;1559 }1560 return inputs;1561 }1562 },1563 mounted() {1564 this.validate();1565 const observer = new MutationObserver(this.validate);1566 observer.observe(this.$el, {1567 childList: true,1568 subtree: true1569 });1570 this.observer = observer;1571 if (this.preventNavigation) {1572 window.addEventListener("beforeunload", this.preventNav);1573 }1574 if (this.listeners.invalid) {1575 this.$el.noValidate = true;1576 }1577 },1578 beforeRouteLeave(to, from, next) {1579 if (!this.modified)1580 next();1581 if (window.confirm("Leave without saving?"))1582 next();1583 },1584 beforeDestroy() {1585 this.observer.disconnect();1586 window.removeEventListener("beforeunload", this.preventNav);1587 },1588 beforeUnmount() {1589 this.observer.disconnect();1590 },1591 methods: {1592 checkModified({ target }) {1593 if (!controlTypes.has(target.tagName))1594 return;1595 this.modified = true;1596 },1597 validate() {1598 const els = this.$el.querySelectorAll("input, textarea, select");1599 const localInputs = {};1600 els.forEach((input) => {1601 const { name, id, validity } = input;1602 const key = name || id;1603 if (!key)1604 return;1605 localInputs[key] = {1606 _inputEl: input,1607 valid: validity.valid,1608 dirty: false,1609 invalid: {1610 type: validity.typeMismatch,1611 required: validity.valueMissing,1612 minlength: validity.tooShort,1613 maxlength: validity.tooLong,1614 min: validity.rangeOverflow,1615 max: validity.rangeUnderflow,1616 pattern: validity.patternMismatch1617 }1618 };1619 switch (input.type) {1620 case "checkbox":1621 localInputs[key].value = input.checked;1622 break;1623 case "radio":1624 if (input.checked) {1625 localInputs[key].value = input.value;1626 }1627 break;1628 default:1629 localInputs[key].value = input.value;1630 }1631 });1632 this.localInputs = localInputs;1633 },1634 onEvent() {1635 this.validate();1636 },1637 onBlur({ target }) {1638 if (!controlTypes.has(target.tagName))1639 return;1640 this.dirty = true;1641 this.localInputs[target.name].dirty = true;1642 },1643 clear() {1644 const els = Array.from(this.$el.querySelectorAll("input, textarea, select"));1645 els.forEach((input) => {1646 if (["radio", "checkbox"].includes(input.type)) {1647 input.checked = false;1648 } else {1649 input.value = "";1650 }1651 });1652 },1653 reset() {1654 this.modified = false;1655 this.dirty = false;1656 this.validate();1657 },1658 onSubmit(event) {1659 if (!event.target.checkValidity()) {1660 this.$emit("invalid", event);1661 return;1662 }1663 this.reset();1664 this.$emit("valid", event);1665 },1666 preventNav(event) {1667 if (!this.modified)1668 return;1669 event.preventDefault();1670 event.returnValue = "";1671 }1672 }1673};1674const _hoisted_1$7 = ["method"];1675const _hoisted_2$6 = ["name"];1676function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {1677 return openBlock(), createElementBlock("form", mergeProps({1678 method: _ctx.$attrs.method || "POST",1679 class: [1680 "vts-form",1681 {1682 "vts-form--invalid": !$options.valid,1683 "vts-form--dirty": _ctx.dirty,1684 "vts-form--error": $options.error1685 }1686 ],1687 [toHandlerKey($options.event)]: _cache[0] || (_cache[0] = (...args) => $options.onEvent && $options.onEvent(...args)),1688 onKeydown: _cache[1] || (_cache[1] = (...args) => $options.checkModified && $options.checkModified(...args)),1689 onChange: _cache[2] || (_cache[2] = (...args) => $options.checkModified && $options.checkModified(...args)),1690 onSubmit: _cache[3] || (_cache[3] = (...args) => $options.onSubmit && $options.onSubmit(...args)),1691 onBlurCapture: _cache[4] || (_cache[4] = (...args) => $options.onBlur && $options.onBlur(...args))1692 }, toHandlers($options.listeners)), [1693 $props.honeypot ? (openBlock(), createElementBlock("input", {1694 key: 0,1695 name: typeof $props.honeypot === "string" ? $props.honeypot : "vts-honeypot",1696 class: "visually-hidden",1697 tabindex: "-1",1698 autocomplete: "off",1699 "aria-hidden": "true"1700 }, null, 8, _hoisted_2$6)) : createCommentVNode("", true),1701 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ valid: $options.valid, dirty: _ctx.dirty, modified: _ctx.modified, error: $options.error, inputs: $options.inputs, clear: $options.clear, validate: $options.validate })))1702 ], 16, _hoisted_1$7);1703}1704var VForm = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$9]]);1705var VImg_vue_vue_type_style_index_0_lang = "";1706const NAME = "vts-img";1707const _sfc_main$a = {1708 name: "VImg",1709 inheritAttrs: false,1710 props: {1711 src: {1712 type: String,1713 required: true1714 },1715 srcset: {1716 type: String,1717 default: ""1718 },1719 placeholder: {1720 type: String,1721 default: ""1722 },1723 background: {1724 type: String,1725 default: ""1726 },1727 transitionDuration: {1728 type: [Number, String],1729 default: 3001730 },1731 classes: {1732 type: Object,1733 default: () => ({})1734 }1735 },1736 data: () => ({1737 dataUrl: ""1738 }),1739 computed: {1740 listeners() {1741 {1742 return this.$attrs;1743 }1744 }1745 },1746 watch: {1747 src: {1748 handler: "init"1749 },1750 srcset: {1751 handler: "init"1752 }1753 },1754 mounted() {1755 this.init();1756 },1757 beforeUnmount() {1758 this.observer.disconnect();1759 },1760 beforeDestroy() {1761 this.observer.disconnect();1762 },1763 methods: {1764 init() {1765 this.dataUrl = this.getDataUrl();1766 this.observer = new IntersectionObserver(this.handler);1767 this.observer.observe(this.$el);1768 },1769 handler([entry]) {1770 const { $el } = this;1771 if (entry.isIntersecting) {1772 $el.classList.add(`${NAME}--loading`);1773 this.loadImg();1774 this.observer.disconnect();1775 }1776 },1777 getDataUrl() {1778 if (typeof window === "undefined")1779 return;1780 const { width, height } = this.$attrs;1781 if (!width || !height)1782 return "";1783 const w = 100;1784 const canvas = document.createElement("canvas");1785 canvas.width = w;1786 canvas.height = height / width * w;1787 return canvas.toDataURL();1788 },1789 loadImg() {1790 const { src, srcset } = this;1791 const { img } = this.$refs;1792 img.addEventListener("load", this.onLoad);1793 if (srcset) {1794 img.srcset = srcset;1795 }1796 img.src = src;1797 },1798 onLoad() {1799 const { $el } = this;1800 const { img, placeholder: placeholder2 } = this.$refs;1801 $el.classList.remove(`${NAME}--loading`);1802 $el.classList.add(`${NAME}--loaded`);1803 if (placeholder2) {1804 img.addEventListener("transitionend", function onTransitionEnd() {1805 placeholder2.remove();1806 img.removeEventListener("transitionend", onTransitionEnd);1807 });1808 }1809 img.removeEventListener("load", this.onLoad);1810 }1811 }1812};1813const _hoisted_1$6 = ["src", "decoding"];1814const _hoisted_2$5 = ["src", "alt", "decoding"];1815function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {1816 return openBlock(), createElementBlock("picture", {1817 class: normalizeClass(["vts-img", $props.classes.root])1818 }, [1819 _ctx.dataUrl ? (openBlock(), createElementBlock("div", {1820 key: 0,1821 ref: "placeholder",1822 class: normalizeClass(["vts-img__placeholder", $props.classes.placeholder]),1823 style: normalizeStyle({ background: $props.background })1824 }, [1825 createElementVNode("img", mergeProps({1826 src: $props.placeholder || _ctx.dataUrl,1827 alt: ""1828 }, _ctx.$attrs, {1829 decoding: _ctx.$attrs.decoding || "async"1830 }), null, 16, _hoisted_1$6)1831 ], 6)) : createCommentVNode("", true),1832 createElementVNode("img", mergeProps({1833 ref: "img",1834 src: _ctx.dataUrl,1835 class: ["vts-img__img", $props.classes.img],1836 alt: _ctx.$attrs.alt || "",1837 style: {1838 transitionDuration: `${$props.transitionDuration}ms`1839 },1840 decoding: _ctx.$attrs.decoding || "async"1841 }, _ctx.$attrs, toHandlers($options.listeners)), null, 16, _hoisted_2$5)1842 ], 2);1843}1844var VImg = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$8]]);1845const valuePropDef = {1846 type: [String, Number, Boolean, Array],1847 default: void 01848};1849function updateLocalValue(value, previousValue) {1850 if (value === previousValue)1851 return;1852 this.localValue = value;1853}1854const _sfc_main$9 = {1855 name: "VInput",1856 inheritAttrs: false,1857 model: {1858 event: "update"1859 },1860 props: {1861 label: {1862 type: String,1863 required: true1864 },1865 name: {1866 type: String,1867 required: true1868 },1869 value: valuePropDef,1870 modelValue: valuePropDef,1871 options: {1872 type: Array,1873 default: () => []1874 },1875 errors: {1876 type: Object,1877 default: () => ({})1878 },1879 classes: {1880 type: Object,1881 default: () => ({})1882 }1883 },1884 data() {1885 return {1886 localValue: this.modelValue || this.value,1887 valid: true,1888 anyInvalid: false,1889 dirty: false,1890 invalid: {}1891 };1892 },1893 computed: {1894 bind() {1895 const {1896 id,1897 name,1898 valid,1899 dirty,1900 error,1901 errorMessages,1902 classes,1903 $attrs1904 } = this;1905 const describedby = [];1906 if (error)1907 describedby.push(`${id}__description`);1908 if (errorMessages.length)1909 describedby.push(`${id}__errors`);1910 const attrs = __spreadProps(__spreadValues({1911 "aria-invalid": !valid,1912 "aria-describedby": dirty && describedby.length ? describedby.join(" ") : false1913 }, $attrs), {1914 id: `${id}__input`,1915 name,1916 class: ["vts-input__input", classes.input]1917 });1918 return attrs;1919 },1920 listeners() {1921 {1922 return this.$attrs;1923 }1924 },1925 slots() {1926 return this.$slots;1927 },1928 computedOptions() {1929 const { $attrs, localValue } = this;1930 return this.options.map((item) => {1931 item = typeof item === "object" ? item : { value: item };1932 return Object.assign(item, $attrs, {1933 label: item.label || item.value,1934 value: item.value,1935 checked: localValue !== void 0 ? item.value === localValue : item.checked1936 });1937 });1938 },1939 isMultiple() {1940 const { multiple } = this.$attrs;1941 return multiple != null && multiple != "false";1942 },1943 error() {1944 return !this.valid && this.dirty;1945 },1946 errorMessages() {1947 const { invalid, errors, $attrs } = this;1948 const errorMessages = [];1949 Object.keys(errors || {}).forEach((key) => {1950 if (!invalid[key])1951 return;1952 const errorHandlerOrMessage = errors[key];1953 const errorMessage = typeof errorHandlerOrMessage === "function" ? errorHandlerOrMessage($attrs[key]) : errorHandlerOrMessage;1954 errorMessages.push(errorMessage);1955 });1956 return errorMessages;1957 }1958 },1959 watch: {1960 modelValue: updateLocalValue,1961 value: updateLocalValue,1962 localValue(value) {1963 this.$emit("update", value);1964 this.validate();1965 }1966 },1967 created() {1968 this.id = this.$attrs.id || "vts-" + randomString(4);1969 },1970 mounted() {1971 this.validate();1972 },1973 methods: {1974 validate() {1975 let input = this.$refs.input;1976 if (Array.isArray(input)) {1977 if (!input.length)1978 return;1979 input = input[0];1980 }1981 const { validity } = input;1982 this.anyInvalid = !validity.valid;1983 this.valid = validity.valid;1984 this.invalid = {1985 type: validity.typeMismatch,1986 required: validity.valueMissing,1987 minlength: validity.tooShort,1988 maxlength: validity.tooLong,1989 min: validity.rangeUnderflow,1990 max: validity.rangeOverflow,1991 pattern: validity.patternMismatch1992 };1993 }1994 }1995};1996const _hoisted_1$5 = ["for"];1997const _hoisted_2$4 = ["id", "onInput"];1998const _hoisted_3$2 = ["for"];1999const _hoisted_4$1 = ["checked"];2000const _hoisted_5 = ["for"];2001const _hoisted_6 = ["value"];2002const _hoisted_7 = ["id"];2003const _hoisted_8 = ["id"];2004function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {2005 return openBlock(), createElementBlock("div", {2006 class: normalizeClass([2007 "vts-input",2008 `vts-input--${_ctx.$attrs.type || "text"}`,2009 {2010 "vts-input--required": _ctx.$attrs.hasOwnProperty("required"),2011 "vts-input--invalid": !$data.valid,2012 "vts-input--dirty": $data.dirty,2013 "vts-input--error": $options.error2014 },2015 _ctx.$attrs.class,2016 $props.classes.root2017 ])2018 }, [2019 _ctx.$attrs.type === "radio" ? (openBlock(), createElementBlock("fieldset", {2020 key: 0,2021 class: normalizeClass(["vts-input__fieldset", $props.classes.fieldset])2022 }, [2023 $props.label ? (openBlock(), createElementBlock("legend", {2024 key: 0,2025 class: normalizeClass(["vts-input__legend", $props.classes.text])2026 }, toDisplayString($props.label), 3)) : createCommentVNode("", true),2027 (openBlock(true), createElementBlock(Fragment, null, renderList($options.computedOptions, (option, index2) => {2028 return openBlock(), createElementBlock("label", {2029 key: option.value,2030 for: `${_ctx.id}__input-${index2}`,2031 class: normalizeClass(["vts-input__label", $props.classes.label])2032 }, [2033 createElementVNode("input", mergeProps({2034 id: `${_ctx.id}__input-${index2}`,2035 ref_for: true,2036 ref: "input"2037 }, __spreadValues(__spreadValues({}, $options.bind), option), {2038 onInput: ($event) => $data.localValue = option.value,2039 onBlurOnce: _cache[0] || (_cache[0] = ($event) => $data.dirty = true)2040 }, toHandlers($options.listeners)), null, 16, _hoisted_2$4),2041 createElementVNode("span", {2042 class: normalizeClass(["vts-input__text", $props.classes.text])2043 }, toDisplayString(option.label), 3)2044 ], 10, _hoisted_1$5);2045 }), 128))2046 ], 2)) : _ctx.$attrs.type === "checkbox" ? (openBlock(), createElementBlock("label", {2047 key: 1,2048 for: `${_ctx.id}__input`,2049 class: normalizeClass(["vts-input__label", $props.classes.label])2050 }, [2051 createElementVNode("input", mergeProps({2052 ref: "input",2053 checked: $data.localValue === void 0 ? _ctx.$attrs.checked : $data.localValue2054 }, $options.bind, {2055 onChange: _cache[1] || (_cache[1] = ($event) => $data.localValue = $event.target.checked),2056 onBlurOnce: _cache[2] || (_cache[2] = ($event) => $data.dirty = true)2057 }, toHandlers($options.listeners)), null, 16, _hoisted_4$1),2058 createElementVNode("span", {2059 class: normalizeClass(["vts-input__text", $props.classes.text])2060 }, toDisplayString($props.label), 3)2061 ], 10, _hoisted_3$2)) : (openBlock(), createElementBlock("label", {2062 key: 2,2063 for: `${_ctx.id}__input`,2064 class: normalizeClass(["vts-input__label", $props.classes.label])2065 }, [2066 createElementVNode("span", {2067 class: normalizeClass(["vts-input__text", $props.classes.text])2068 }, toDisplayString($props.label), 3),2069 _ctx.$attrs.type === "select" ? (openBlock(), createElementBlock("select", mergeProps({2070 key: 0,2071 ref: "input",2072 value: $data.localValue2073 }, $options.bind, {2074 onInput: _cache[3] || (_cache[3] = ($event) => $data.localValue = $event.target.value),2075 onChange: _cache[4] || (_cache[4] = ($event) => $data.localValue = $event.target.value),2076 onBlurOnce: _cache[5] || (_cache[5] = ($event) => $data.dirty = true)2077 }, toHandlers($options.listeners)), [2078 renderSlot(_ctx.$slots, "options", {}, () => [2079 (openBlock(true), createElementBlock(Fragment, null, renderList($options.computedOptions, (option, i) => {2080 return openBlock(), createElementBlock("option", mergeProps({ key: i }, option), toDisplayString(option.label), 17);2081 }), 128))2082 ])2083 ], 16, _hoisted_6)) : _ctx.$attrs.type === "textarea" ? withDirectives((openBlock(), createElementBlock("textarea", mergeProps({2084 key: 1,2085 ref: "input",2086 "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.localValue = $event)2087 }, $options.bind, {2088 onBlurOnce: _cache[7] || (_cache[7] = ($event) => $data.dirty = true)2089 }, toHandlers($options.listeners)), null, 16)), [2090 [vModelText, $data.localValue]2091 ]) : withDirectives((openBlock(), createElementBlock("input", mergeProps({2092 key: 2,2093 ref: "input",2094 "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.localValue = $event)2095 }, $options.bind, {2096 onBlurOnce: _cache[9] || (_cache[9] = ($event) => $data.dirty = true)2097 }, toHandlers($options.listeners)), null, 16)), [2098 [vModelDynamic, $data.localValue]2099 ])2100 ], 10, _hoisted_5)),2101 $options.slots.description ? (openBlock(), createElementBlock("div", {2102 key: 3,2103 id: `${_ctx.id}__description`,2104 class: normalizeClass(["vts-input__description", $props.classes.description])2105 }, [2106 renderSlot(_ctx.$slots, "description", normalizeProps(guardReactiveProps({2107 valid: $data.valid,2108 dirty: $data.dirty,2109 error: $options.error,2110 invalid: $data.invalid,2111 anyInvalid: $data.anyInvalid,2112 errors: $options.errorMessages2113 })))2114 ], 10, _hoisted_7)) : createCommentVNode("", true),2115 $data.dirty && $options.errorMessages.length ? (openBlock(), createElementBlock("div", {2116 key: 4,2117 id: `${_ctx.id}__errors`,2118 class: normalizeClass(["vts-input__errors", $props.classes.errors])2119 }, [2120 (openBlock(true), createElementBlock(Fragment, null, renderList($options.errorMessages, (error) => {2121 return openBlock(), createElementBlock("span", {2122 key: error,2123 class: normalizeClass(["vts-input__error", $props.classes.error])2124 }, toDisplayString(error), 3);2125 }), 128))2126 ], 10, _hoisted_8)) : createCommentVNode("", true)2127 ], 2);2128}2129var VInput = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$7]]);2130const _sfc_main$8 = {2131 name: "VIntersect",2132 props: {2133 threshold: {2134 type: [Number, Array],2135 default: () => null2136 },2137 root: {2138 type: String,2139 default: void 02140 },2141 rootMargin: {2142 type: String,2143 default: void 02144 },2145 options: {2146 type: Object,2147 default: () => ({})2148 }2149 },2150 emits: ["enter", "exit", "change"],2151 data: () => ({2152 entry: {}2153 }),2154 mounted() {2155 let el = this.$el;2156 {2157 el = this.$el.nextElementSibling;2158 }2159 const { root, threshold, rootMargin, options, handler } = this;2160 const observerOptions = __spreadProps(__spreadValues({}, options), {2161 root,2162 threshold,2163 rootMargin2164 });2165 this.observer = new IntersectionObserver(handler, observerOptions);2166 this.observer.observe(el);2167 },2168 beforeUnmount() {2169 this.observer.disconnect();2170 },2171 beforeDestroy() {2172 this.observer.disconnect();2173 },2174 methods: {2175 handler([entry]) {2176 this.entry = entry;2177 if (entry.isIntersecting) {2178 this.$emit("enter", entry);2179 } else {2180 this.$emit("exit", entry);2181 }2182 this.$emit("change", entry);2183 }2184 },2185 render() {2186 const { entry } = this;2187 {2188 return this.$slots.default(entry);2189 }2190 }2191};2192var VModal_vue_vue_type_style_index_0_lang = "";2193const _sfc_main$7 = {2194 name: "VModal",2195 model: {2196 prop: "showing",2197 event: "change"2198 },2199 props: {2200 showing: Boolean,2201 tag: {2202 type: String,2203 default: "div"2204 },2205 dismissible: {2206 type: Boolean,2207 default: true2208 },2209 width: {2210 type: String,2211 default: void 02212 },2213 maxWidth: {2214 type: String,2215 default: void 02216 },2217 noScroll: Boolean,2218 transition: {2219 type: String,2220 default: void 02221 },2222 bgTransition: {2223 type: String,2224 default: void 02225 },2226 classes: {2227 type: Object,2228 default: () => ({})2229 }2230 },2231 watch: {2232 showing: {2233 handler(next, prev) {2234 if (typeof window !== "undefined") {2235 if (next && next != prev) {2236 this.noScroll && document.body.style.setProperty("overflow", "hidden");2237 this.$nextTick(() => {2238 this.$refs.content.focus();2239 });2240 } else {2241 this.noScroll && document.body.style.removeProperty("overflow");2242 }2243 }2244 }2245 }2246 },2247 mounted() {2248 console.warn("Vuetensil's VModal is deprecated. Please use VDialog instead.");2249 },2250 methods: {2251 show() {2252 this.$emit("show");2253 this.$emit("change", true);2254 },2255 hide() {2256 this.$emit("hide");2257 this.$emit("change", false);2258 },2259 toggle() {2260 const { showing } = this;2261 const event = showing ? "hide" : "show";2262 this.$emit(event, !showing);2263 this.$emit("change", !showing);2264 },2265 onClick(event) {2266 if (event.target.classList.contains("vts-modal") && this.dismissible) {2267 this.hide();2268 }2269 },2270 onKeydown(event) {2271 if (event.keyCode === keycodes.ESC) {2272 this.hide();2273 }2274 if (event.keyCode === keycodes.TAB) {2275 const content = this.$refs.content;2276 if (!content)2277 return;2278 const focusable = Array.from(content.querySelectorAll(FOCUSABLE));2279 if (!focusable.length) {2280 event.preventDefault();2281 return;2282 }2283 if (!content.contains(document.activeElement)) {2284 event.preventDefault();2285 focusable[0].focus();2286 } else {2287 const focusedItemIndex = focusable.indexOf(document.activeElement);2288 if (event.shiftKey && focusedItemIndex === 0) {2289 focusable[focusable.length - 1].focus();2290 event.preventDefault();2291 }2292 if (!event.shiftKey && focusedItemIndex === focusable.length - 1) {2293 focusable[0].focus();2294 event.preventDefault();2295 }2296 }2297 }2298 }2299 }2300};2301function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {2302 return openBlock(), createBlock(Transition, { name: $props.bgTransition }, {2303 default: withCtx(() => [2304 $props.showing ? (openBlock(), createElementBlock("div", {2305 key: 0,2306 class: normalizeClass(["vts-modal", $props.classes.root]),2307 onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args)),2308 onKeydown: _cache[1] || (_cache[1] = (...args) => $options.onKeydown && $options.onKeydown(...args))2309 }, [2310 createVNode(Transition, {2311 name: $props.transition,2312 appear: ""2313 }, {2314 default: withCtx(() => [2315 (openBlock(), createBlock(resolveDynamicComponent($props.tag), {2316 ref: "content",2317 style: normalizeStyle({ width: $props.width, maxWidth: $props.maxWidth }),2318 class: normalizeClass(["vts-modal__content", $props.classes.content]),2319 tabindex: "-1",2320 role: "dialog"2321 }, {2322 default: withCtx(() => [2323 renderSlot(_ctx.$slots, "default")2324 ]),2325 _: 32326 }, 8, ["style", "class"]))2327 ]),2328 _: 32329 }, 8, ["name"])2330 ], 34)) : createCommentVNode("", true)2331 ]),2332 _: 32333 }, 8, ["name"]);2334}2335var VModal = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6]]);2336const _sfc_main$6 = {2337 name: "VResize",2338 props: {2339 tag: {2340 type: String,2341 default: "div"2342 }2343 },2344 data: () => ({2345 observer: void 0,2346 width: void 0,2347 height: void 02348 }),2349 mounted() {2350 this.observer = new ResizeObserver(this.updateDimensions);2351 this.observer.observe(this.$el);2352 },2353 beforeUnmount() {2354 this.observer.disconnect();2355 },2356 beforeDestroy() {2357 this.observer.disconnect();2358 },2359 methods: {2360 updateDimensions() {2361 const el = this.$el;2362 this.width = el.offsetWidth;2363 this.height = el.offsetHeight;2364 this.$emit("resize", arguments);2365 }2366 }2367};2368function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {2369 return openBlock(), createBlock(resolveDynamicComponent($props.tag), { class: "vts-resize" }, {2370 default: withCtx(() => [2371 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ width: _ctx.width, height: _ctx.height, inlineSize: _ctx.width, blockSize: _ctx.height })))2372 ]),2373 _: 32374 });2375}2376var VResize = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5]]);2377var VSkip_vue_vue_type_style_index_0_lang = "";2378const _sfc_main$5 = {2379 name: "VSkip",2380 props: {2381 to: {2382 type: String,2383 required: true2384 }2385 },2386 methods: {2387 skipTo(id) {2388 if (!id)2389 return;2390 const target = window.document.getElementById(id.slice(1));2391 if (!target)2392 return;2393 if (!["a", "select", "input", "button", "textarea"].includes(target.tagName.toLowerCase())) {2394 target.setAttribute("tabindex", "-1");2395 }2396 target.focus();2397 }2398 }2399};2400const _hoisted_1$4 = ["href"];2401const _hoisted_2$3 = /* @__PURE__ */ createTextVNode("Skip to main content");2402function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {2403 return openBlock(), createElementBlock("a", {2404 class: "vts-skip",2405 href: $props.to,2406 onClick: _cache[0] || (_cache[0] = ($event) => $options.skipTo($props.to))2407 }, [2408 renderSlot(_ctx.$slots, "default", {}, () => [2409 _hoisted_2$32410 ])2411 ], 8, _hoisted_1$4);2412}2413var VSkip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]);2414var VTable_vue_vue_type_style_index_0_lang = "";2415const _sfc_main$4 = {2416 name: "VTable",2417 provide() {2418 return {2419 $table: this2420 };2421 },2422 props: {2423 headers: {2424 type: Array,2425 default: () => []2426 },2427 items: {2428 type: Array,2429 default: () => []2430 },2431 page: {2432 type: [Number, String],2433 default: 12434 },2435 perPage: {2436 type: [Number, String],2437 default: -12438 },2439 sortBy: {2440 type: String,2441 default: ""2442 },2443 sortDirection: {2444 type: String,2445 default: "",2446 validator: (direction) => {2447 return (/* @__PURE__ */ new Set(["ASC", "DESC", ""])).has(direction.toUpperCase());2448 }2449 },2450 id: {2451 type: String,2452 default: "vts-" + randomString(4)2453 },2454 caption: {2455 type: String,2456 default: ""2457 },2458 sortable: Boolean,2459 classes: {2460 type: Object,2461 default: () => ({})2462 }2463 },2464 data() {2465 return {2466 localSortBy: this.sortBy,2467 localSortDirection: this.sortDirection ? this.sortDirection.toUpperCase() : "",2468 localPage: Number(this.page),2469 localPerPage: Number(this.perPage)2470 };2471 },2472 computed: {2473 computedHeaders() {2474 const { headers, sortable, localSortBy, localSortDirection } = this;2475 const computedHeaders = [];2476 headers.forEach((header) => {2477 const computedHeader = __spreadProps(__spreadValues({}, header), {2478 bind: {},2479 sortBtn: {2480 bind: { "aria-label": `toggle sort direction` },2481 on: { click: () => this.onSort(header.key) }2482 }2483 });2484 if (computedHeader.sortable === void 0) {2485 computedHeader.sortable = !!computedHeader.sort || sortable;2486 }2487 if (computedHeader.sortable) {2488 if (localSortBy === header.key && localSortDirection) {2489 if (localSortDirection === "ASC") {2490 computedHeader.bind["aria-sort"] = "ascending";2491 } else {2492 computedHeader.bind["aria-sort"] = "descending";2493 }2494 }2495 }2496 computedHeaders.push(computedHeader);2497 });2498 return computedHeaders;2499 },2500 computedItems() {2501 const {2502 computedHeaders,2503 items,2504 localSortBy,2505 localSortDirection,2506 localPage,2507 localPerPage2508 } = this;2509 let computedItems = [...items];2510 if (localSortBy && localSortDirection) {2511 const targetColumn = computedHeaders.find((header) => {2512 return header.key === localSortBy;2513 });2514 let compareFn = this.defaultComparisonFn;2515 if (typeof targetColumn.sort === "function") {2516 compareFn = targetColumn.sort;2517 }2518 computedItems = computedItems.sort((a, b) => {2519 return compareFn(a, b, localSortDirection === "ASC");2520 });2521 }2522 if (localPerPage > -1) {2523 const offset = (Math.max(localPage, 1) - 1) * localPerPage;2524 computedItems = computedItems.slice(offset, offset + localPerPage);2525 }2526 return computedItems;2527 },2528 lastPage() {2529 return Math.ceil(this.items.length / +this.perPage);2530 }2531 },2532 watch: {2533 sortBy(value) {2534 this.localSortBy = value;2535 },2536 localSortBy(value) {2537 this.$emit("update:sort-by", value);2538 },2539 sortDirection(value) {2540 this.localSortDirection = value && value.toUpperCase() || "";2541 },2542 localSortDirection(value) {2543 this.$emit("update:sort-direction", value);2544 },2545 page(value) {2546 this.localPage = Number(value);2547 },2548 localPage(value) {2549 this.$emit("update:page", value);2550 },2551 perPage(value) {2552 this.localPerPage = Number(value);2553 },2554 localPerPage(value) {2555 this.$emit("update:per-page", value);2556 }2557 },2558 methods: {2559 defaultComparisonFn(a, b, isAscending) {2560 const { localSortBy } = this;2561 const multiplier = isAscending ? 1 : -1;2562 const aVal = a[localSortBy];2563 const bVal = b[localSortBy];2564 const isNumeric = Number.isFinite(aVal) && Number.isFinite(bVal);2565 if (isNumeric) {2566 return (aVal - bVal) * multiplier;2567 }2568 if (aVal < bVal)2569 return -1 * multiplier;2570 if (aVal > bVal)2571 return 1 * multiplier;2572 return 0;2573 },2574 onSort(key) {2575 const { localSortBy, localSortDirection } = this;2576 this.localPage = 1;2577 if (key !== localSortBy) {2578 this.localSortBy = key;2579 this.localSortDirection = "ASC";2580 return;2581 }2582 switch (localSortDirection) {2583 case "ASC":2584 this.localSortDirection = "DESC";2585 break;2586 case "DESC":2587 this.localSortDirection = "";2588 break;2589 default:2590 this.localSortDirection = "ASC";2591 }2592 },2593 goToPage(page) {2594 const { lastPage } = this;2595 this.localPage = Math.min(Math.max(1, page), lastPage);2596 }2597 }2598};2599const _hoisted_1$3 = ["id"];2600const _hoisted_2$2 = ["disabled"];2601const _hoisted_3$1 = ["disabled", "aria-label", "onClick"];2602const _hoisted_4 = ["disabled"];2603function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {2604 return openBlock(), createElementBlock("div", {2605 ref: "container",2606 role: "region",2607 "aria-labelledby": "caption",2608 class: normalizeClass(["vts-table", { "vts-table--sortable": $props.sortable }, $props.classes.root])2609 }, [2610 createElementVNode("table", {2611 class: normalizeClass([$props.classes.table])2612 }, [2613 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({2614 caption: $props.caption,2615 headers: $options.computedHeaders,2616 items: $options.computedItems,2617 sortBy: $data.localSortBy,2618 sortDirection: $data.localSortDirection,2619 page: $data.localPage,2620 perPage: $data.localPerPage2621 })), () => [2622 $props.caption ? (openBlock(), createElementBlock("caption", {2623 key: 0,2624 id: `${$props.id}__caption`,2625 class: normalizeClass([$props.classes.caption])2626 }, toDisplayString($props.caption), 11, _hoisted_1$3)) : createCommentVNode("", true),2627 $options.computedHeaders.length ? (openBlock(), createElementBlock("thead", {2628 key: 1,2629 class: normalizeClass([$props.classes.thead])2630 }, [2631 createElementVNode("tr", {2632 class: normalizeClass([$props.classes.tr])2633 }, [2634 (openBlock(true), createElementBlock(Fragment, null, renderList($options.computedHeaders, (header, index2) => {2635 return openBlock(), createElementBlock("th", mergeProps({2636 key: header.key2637 }, header.bind, {2638 class: [$props.classes.th]2639 }), [2640 renderSlot(_ctx.$slots, `header.${header.key}`, normalizeProps(guardReactiveProps({2641 header,2642 index: index22643 })), () => [2644 createTextVNode(toDisplayString(header.text || header.key) + " ", 1),2645 header.sortable ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [2646 header.key === $data.localSortBy && $data.localSortDirection === "ASC" ? renderSlot(_ctx.$slots, "sort-asc", normalizeProps(mergeProps({ key: 0 }, header.sortBtn)), () => [2647 createElementVNode("button", mergeProps({2648 class: [2649 "vts-table__sort-btn",2650 "vts-table__sort-btn--asc",2651 $props.classes.sortBtn2652 ]2653 }, header.sortBtn.bind, toHandlers(header.sortBtn.on)), " \u2191 ", 16)2654 ]) : header.key === $data.localSortBy && $data.localSortDirection === "DESC" ? renderSlot(_ctx.$slots, "sort-desc", normalizeProps(mergeProps({ key: 1 }, header.sortBtn)), () => [2655 createElementVNode("button", mergeProps({2656 class: [2657 "vts-table__sort-btn",2658 "vts-table__sort-btn--desc",2659 $props.classes.sortBtn2660 ]2661 }, header.sortBtn.bind, toHandlers(header.sortBtn.on)), " \u2193 ", 16)2662 ]) : renderSlot(_ctx.$slots, "sort-none", normalizeProps(mergeProps({ key: 2 }, header.sortBtn)), () => [2663 createElementVNode("button", mergeProps({2664 class: ["vts-table__sort-btn", $props.classes.sortBtn]2665 }, header.sortBtn.bind, toHandlers(header.sortBtn.on)), " \u2195 ", 16)2666 ])2667 ], 64)) : createCommentVNode("", true)2668 ])2669 ], 16);2670 }), 128))2671 ], 2)2672 ], 2)) : createCommentVNode("", true),2673 createElementVNode("tbody", {2674 class: normalizeClass([$props.classes.tbody])2675 }, [2676 renderSlot(_ctx.$slots, "body", normalizeProps(guardReactiveProps({2677 items: $options.computedItems,2678 sortBy: $data.localSortBy,2679 sortDirection: $data.localSortDirection,2680 page: $data.localPage,2681 perPage: $data.localPerPage2682 })), () => [2683 (openBlock(true), createElementBlock(Fragment, null, renderList($options.computedItems, (item, index2) => {2684 return openBlock(), createElementBlock("tr", {2685 key: item.id,2686 class: normalizeClass(["vts-table__row", $props.classes.tr])2687 }, [2688 renderSlot(_ctx.$slots, "row", normalizeProps(guardReactiveProps({ item, index: index2, row: index2 + 1 })), () => [2689 (openBlock(true), createElementBlock(Fragment, null, renderList($options.computedHeaders, (column) => {2690 return openBlock(), createElementBlock("td", {2691 key: column.key,2692 class: normalizeClass([$props.classes.td])2693 }, [2694 renderSlot(_ctx.$slots, `column.${column.key}`, normalizeProps(guardReactiveProps({2695 item,2696 index: ($data.localPage - 1) * $data.localPerPage + index2,2697 row: index2 + 1,2698 key: column.key,2699 column: column.key,2700 value: item[column.key],2701 cell: item[column.key],2702 data: item[column.key]2703 })), () => [2704 createTextVNode(toDisplayString(item[column.key]), 1)2705 ])2706 ], 2);2707 }), 128))2708 ])2709 ], 2);2710 }), 128))2711 ])2712 ], 2),2713 _ctx.$slots.tfoot ? (openBlock(), createElementBlock("tfoot", {2714 key: 2,2715 class: normalizeClass([$props.classes.tfoot])2716 }, [2717 renderSlot(_ctx.$slots, "tfoot")2718 ], 2)) : createCommentVNode("", true)2719 ])2720 ], 2),2721 renderSlot(_ctx.$slots, "pagination", normalizeProps(guardReactiveProps({ page: $data.localPage, perPage: $data.localPerPage, lastPage: $options.lastPage, goToPage: $options.goToPage })), () => [2722 $options.lastPage > 1 ? (openBlock(), createElementBlock("div", {2723 key: 0,2724 class: normalizeClass(["vts-table__pagination", $props.classes.pagination])2725 }, [2726 createElementVNode("button", {2727 disabled: $data.localPage === 1,2728 "aria-label": "go to previous page",2729 class: normalizeClass(["vts-table__prev", $props.classes.previous]),2730 onClick: _cache[0] || (_cache[0] = ($event) => $options.goToPage($data.localPage - 1))2731 }, " Prev ", 10, _hoisted_2$2),2732 createElementVNode("ul", {2733 class: normalizeClass(["vts-table__pages", $props.classes.pageList])2734 }, [2735 (openBlock(true), createElementBlock(Fragment, null, renderList($options.lastPage, (pageNum) => {2736 return openBlock(), createElementBlock("li", {2737 key: pageNum,2738 class: normalizeClass([2739 "vts-table__page-item",2740 { "vts-table__page-item--current": pageNum === $data.localPage },2741 $props.classes.pageItem2742 ])2743 }, [2744 createElementVNode("button", {2745 disabled: pageNum === $data.localPage,2746 "aria-label": `go to page ${pageNum}`,2747 class: normalizeClass([2748 "vts-table__page",2749 { "vts-table__page--current": pageNum === $data.localPage },2750 $props.classes.page2751 ]),2752 onClick: ($event) => $options.goToPage(pageNum)2753 }, toDisplayString(pageNum), 11, _hoisted_3$1)2754 ], 2);2755 }), 128))2756 ], 2),2757 createElementVNode("button", {2758 disabled: $data.localPage === $options.lastPage,2759 "aria-label": "go to next page",2760 class: normalizeClass(["vts-table__next", $props.classes.next]),2761 onClick: _cache[1] || (_cache[1] = ($event) => $options.goToPage($data.localPage + 1))2762 }, " Next ", 10, _hoisted_4)2763 ], 2)) : createCommentVNode("", true)2764 ])2765 ], 2);2766}2767var VTable = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]);2768const _sfc_main$3 = {2769 name: "VTabs",2770 model: {2771 prop: "active",2772 event: "change"2773 },2774 props: {2775 active: {2776 type: Number,2777 default: 02778 },2779 label: {2780 type: String,2781 default: void 02782 },2783 orientation: {2784 type: String,2785 default: "horizontal"2786 },2787 classes: {2788 type: Object,2789 default: () => ({})2790 }2791 },2792 data() {2793 return {2794 activeIndex: this.active,2795 activeTab: this.active2796 };2797 },2798 computed: {2799 tabList() {2800 return Object.keys(this.$slots).filter((name) => name.startsWith("tab-"));2801 },2802 panelList() {2803 return Object.keys(this.$slots).filter((name) => name.startsWith("panel-"));2804 }2805 },2806 watch: {2807 active(next) {2808 this.activeIndex = Math.max(0, Math.min(this.tabList.length - 1, next));2809 },2810 activeIndex(next) {2811 this.$emit("change", next);2812 }2813 },2814 created() {2815 this.id = this.$attrs.id || `vts-${randomString(4)}`;2816 },2817 methods: {2818 onKeydown(event) {2819 const { keyCode } = event;2820 switch (keyCode) {2821 case keycodes.END:2822 event.preventDefault();2823 this.activeIndex = this.tabList.length - 1;2824 this.setFocus();2825 break;2826 case keycodes.HOME:2827 event.preventDefault();2828 this.activeIndex = 0;2829 this.setFocus();2830 break;2831 case keycodes.LEFT:2832 case keycodes.RIGHT:2833 case keycodes.UP:2834 case keycodes.DOWN:2835 this.determineOrientation(event);2836 break;2837 }2838 },2839 determineOrientation(event) {2840 const keyCode = event.keyCode;2841 let proceed = false;2842 if (this.orientation === "vertical") {2843 if (keyCode === keycodes.UP || keyCode === keycodes.DOWN) {2844 event.preventDefault();2845 proceed = true;2846 }2847 } else {2848 if (keyCode === keycodes.LEFT || keyCode === keycodes.RIGHT) {2849 event.preventDefault();2850 proceed = true;2851 }2852 }2853 if (proceed) {2854 this.switchTabOnArrowPress(event);2855 this.setFocus();2856 }2857 },2858 switchTabOnArrowPress(event) {2859 const keyCode = event.keyCode;2860 const directions = {2861 [keycodes.LEFT]: -1,2862 [keycodes.UP]: -1,2863 [keycodes.RIGHT]: 1,2864 [keycodes.DOWN]: 12865 };2866 if (!directions[keyCode])2867 return;2868 const activeIndex = this.activeIndex;2869 const tabLength = this.tabList.length;2870 const nextIndex = activeIndex + directions[keyCode];2871 if (nextIndex < 0) {2872 this.activeIndex = tabLength - 1;2873 } else if (nextIndex >= tabLength) {2874 this.activeIndex = 0;2875 } else {2876 this.activeIndex = nextIndex;2877 }2878 },2879 setFocus() {2880 const { $refs, tabList, activeIndex } = this;2881 const activeTab = tabList[activeIndex];2882 {2883 return $refs[activeTab].focus();2884 }2885 }2886 }2887};2888const _hoisted_1$2 = ["aria-label", "aria-orientation"];2889const _hoisted_2$1 = ["id", "aria-selected", "tabindex", "aria-controls", "onClick"];2890const _hoisted_3 = ["id", "aria-labelledby", "hidden"];2891function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {2892 return openBlock(), createElementBlock("div", {2893 class: normalizeClass(["vts-tabs", $props.classes.root])2894 }, [2895 createElementVNode("div", {2896 role: "tablist",2897 "aria-label": $props.label,2898 "aria-orientation": $props.orientation,2899 class: normalizeClass(["vts-tabs__tablist", $props.classes.tablist])2900 }, [2901 (openBlock(true), createElementBlock(Fragment, null, renderList($options.tabList, (tab, index2) => {2902 return openBlock(), createElementBlock("button", {2903 id: `${_ctx.id}-${tab}`,2904 key: tab,2905 ref_for: true,2906 ref: tab,2907 "aria-selected": index2 === $data.activeIndex,2908 tabindex: index2 === $data.activeIndex ? false : -1,2909 "aria-controls": `${_ctx.id}-${tab.replace("tab", "panel")}`,2910 class: normalizeClass([2911 `vts-tabs__tab vts-tabs__tab--${tab} vts-tabs__tab--${index2}`,2912 {2913 "vts-tabs__tab--active": index2 === $data.activeIndex,2914 [$props.classes.tabActive]: index2 === $data.activeIndex2915 },2916 $props.classes.tab2917 ]),2918 role: "tab",2919 type: "button",2920 onKeydown: _cache[0] || (_cache[0] = (...args) => $options.onKeydown && $options.onKeydown(...args)),2921 onClick: ($event) => $data.activeIndex = index22922 }, [2923 renderSlot(_ctx.$slots, tab)2924 ], 42, _hoisted_2$1);2925 }), 128))2926 ], 10, _hoisted_1$2),2927 (openBlock(true), createElementBlock(Fragment, null, renderList($options.panelList, (tab, index2) => {2928 return openBlock(), createElementBlock("div", {2929 id: `${_ctx.id}-panel-${index2}`,2930 key: tab,2931 "aria-labelledby": `${_ctx.id}-tab-${index2}`,2932 hidden: index2 !== $data.activeIndex,2933 class: normalizeClass([2934 `vts-tabs__panel vts-tabs__panel--${index2}`,2935 {2936 "vts-tabs__panel--active": index2 === $data.activeIndex,2937 [$props.classes.panelActive]: index2 === $data.activeIndex2938 },2939 $props.classes.panel2940 ]),2941 tabindex: "0",2942 role: "tabpanel"2943 }, [2944 renderSlot(_ctx.$slots, tab)2945 ], 10, _hoisted_3);2946 }), 128))2947 ], 2);2948}2949var VTabs = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);2950var VToggle_vue_vue_type_style_index_0_lang = "";2951const _sfc_main$2 = {2952 name: "VToggle",2953 model: {2954 prop: "open",2955 event: "update"2956 },2957 props: {2958 open: Boolean,2959 label: {2960 type: String,2961 default: ""2962 },2963 disabled: Boolean,2964 classes: {2965 type: Object,2966 default: () => ({})2967 }2968 },2969 data() {2970 return {2971 isOpen: this.open2972 };2973 },2974 computed: {2975 listeners() {2976 {2977 return this.$attrs;2978 }2979 }2980 },2981 watch: {2982 open(next) {2983 this.isOpen = next;2984 },2985 isOpen(isOpen) {2986 if (typeof window === "undefined")2987 return;2988 this.$emit("update", isOpen);2989 this.$emit(isOpen ? "open" : "close");2990 }2991 },2992 created() {2993 const { id } = this.$attrs;2994 this.id = id ? id : `vts-${randomString(4)}`;2995 },2996 methods: {2997 collapse(el) {2998 el.style.blockSize = "0";2999 },3000 expand(el) {3001 el.style.overflow = "hidden";3002 el.style.blockSize = `${el.scrollHeight}px`;3003 el.scrollHeight;3004 },3005 resetHeight(el) {3006 el.style.overflow = "visible";3007 el.style.blockSize = "";3008 }3009 }3010};3011const _hoisted_1$1 = ["id", "disabled", "aria-controls", "aria-expanded"];3012const _hoisted_2 = ["id", "aria-labelledby", "aria-hidden"];3013function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {3014 return openBlock(), createElementBlock("div", {3015 class: normalizeClass(["vts-toggle", { "vts-toggle--open": $data.isOpen }, $props.classes.root])3016 }, [3017 createElementVNode("button", mergeProps({3018 id: `${_ctx.id}-label`,3019 ref: "label",3020 type: "button",3021 disabled: $props.disabled,3022 "aria-controls": `${_ctx.id}-content`,3023 "aria-expanded": String($data.isOpen),3024 class: ["vts-toggle__label", $props.classes.label],3025 onClick: _cache[0] || (_cache[0] = ($event) => $data.isOpen = !$data.isOpen)3026 }, toHandlers($options.listeners)), [3027 createTextVNode(toDisplayString($props.label) + " ", 1),3028 renderSlot(_ctx.$slots, "label", normalizeProps(guardReactiveProps({ isOpen: $data.isOpen })))3029 ], 16, _hoisted_1$1),3030 createVNode(Transition, {3031 onBeforeEnter: $options.collapse,3032 onEnter: $options.expand,3033 onAfterEnter: $options.resetHeight,3034 onBeforeLeave: $options.expand,3035 onLeave: $options.collapse3036 }, {3037 default: withCtx(() => [3038 withDirectives(createElementVNode("div", {3039 id: `${_ctx.id}-content`,3040 "aria-labelledby": `${_ctx.id}-label`,3041 "aria-hidden": !$data.isOpen,3042 role: "region",3043 class: normalizeClass(["vts-toggle__content", $props.classes.content])3044 }, [3045 renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ isOpen: $data.isOpen })))3046 ], 10, _hoisted_2), [3047 [vShow, $data.isOpen && !$props.disabled]3048 ])3049 ]),3050 _: 33051 }, 8, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave"])3052 ], 2);3053}3054var VToggle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);3055var VTooltip_vue_vue_type_style_index_0_lang = "";3056const _sfc_main$1 = {3057 name: "VTooltip",3058 props: {3059 tag: {3060 type: String,3061 default: "span"3062 },3063 id: {3064 type: String,3065 default: () => `vts-${randomString(4)}`3066 },3067 focus: Boolean,3068 classes: {3069 type: Object,3070 default: () => ({})3071 }3072 },3073 data: () => ({3074 show: false3075 }),3076 methods: {3077 onMouseenter() {3078 if (this.focus)3079 return;3080 this.show = true;3081 },3082 onMouseleave() {3083 if (this.focus)3084 return;3085 this.show = false;3086 }3087 }3088};3089const _hoisted_1 = ["id", "aria-hidden"];3090function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {3091 return openBlock(), createBlock(resolveDynamicComponent($props.tag), {3092 id: $props.id,3093 tabindex: "0",3094 "aria-describedby": `${$props.id}__content`,3095 class: normalizeClass(["vts-tooltip", $props.classes.toggle]),3096 onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.show = true),3097 onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.show = false),3098 onMouseenter: $options.onMouseenter,3099 onMouseleave: $options.onMouseleave3100 }, {3101 default: withCtx(() => [3102 renderSlot(_ctx.$slots, "default"),3103 createElementVNode("span", {3104 id: `${$props.id}__content`,3105 role: "tooltip",3106 "aria-hidden": !_ctx.show + "",3107 class: normalizeClass([3108 "vts-tooltip__content",3109 {3110 "vts-tooltip__content--visible": _ctx.show3111 },3112 $props.classes.content3113 ])3114 }, [3115 renderSlot(_ctx.$slots, "tooltip")3116 ], 10, _hoisted_1)3117 ]),3118 _: 33119 }, 8, ["id", "aria-describedby", "class", "onMouseenter", "onMouseleave"]);3120}3121var VTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);...
tiro-ui.umd.js
Source:tiro-ui.umd.js
...27 e.openBlock(),28 e.createElementBlock(29 'button',30 {31 class: e.normalizeClass([32 'ti-button',33 `ti-button--${t.type}`,34 `${t.size}`,35 t.disabled ? 'is-disabled' : ''36 ]),37 style: e.normalizeStyle(`border-radius:${t.borderRadius}px`),38 type: 'button'39 },40 [41 e.createElementVNode('div', I, [42 e.createElementVNode('span', null, [43 e.renderSlot(n.$slots, 'default', {}, void 0, !0)44 ])45 ])46 ],47 648 )49 )50 }51 }),52 [['__scopeId', 'data-v-bf5600a2']]53 )54 b.install = function (t) {55 t.component('TiButton', b)56 }57 const z = b58 const fe = ''59 const D = (t) => (60 e.pushScopeId('data-v-f7884f90'), (t = t()), e.popScopeId(), t61 ),62 M = { class: 'ti-card--inner' },63 X = { key: 0, class: 'ti-card--header' },64 Y = D(() => e.createElementVNode('span', null, '\u6807\u9898', -1)),65 F = { class: 'el-card__body' }66 const k = _(67 e.defineComponent({68 props: {69 tiro: { type: Boolean, default: !1 },70 shadow: { type: String, default: 'always' }71 },72 setup(t) {73 return (n, o) => (74 e.openBlock(),75 e.createElementBlock(76 'div',77 {78 class: e.normalizeClass([79 'ti-card',80 t.tiro ? 'tiro' : '',81 `${t.shadow}-shadow`82 ])83 },84 [85 e.createElementVNode('div', M, [86 n.$slots.header87 ? (e.openBlock(),88 e.createElementBlock('div', X, [89 e.renderSlot(n.$slots, 'header', {}, () => [Y], !0)90 ]))91 : e.createCommentVNode('', !0),92 e.createElementVNode('div', F, [93 e.renderSlot(n.$slots, 'default', {}, void 0, !0)94 ])95 ])96 ],97 298 )99 )100 }101 }),102 [['__scopeId', 'data-v-f7884f90']]103 )104 k.install = function (t) {105 t.component('TiCard', k)106 }107 const L = k108 const ye = '',109 m = _(110 e.defineComponent({111 props: {112 name: { type: String },113 size: { type: Number },114 color: { type: String }115 },116 setup(t) {117 return (n, o) => (118 e.openBlock(),119 e.createElementBlock(120 'span',121 {122 class: e.normalizeClass(['ti-icon', t.name]),123 style: e.normalizeStyle({124 fontSize: `${t.size}px`,125 color: t.color126 })127 },128 null,129 6130 )131 )132 }133 }),134 [['__scopeId', 'data-v-cf3d6e46']]135 )136 ;(m.install = function (t) {137 t.component('TiIcon', m)138 }),139 (m.install = function (t) {140 t.component('TiIcon', m)141 })142 const A = m143 const ge = ''144 const R = (t) => (145 e.pushScopeId('data-v-b15b64dc'), (t = t()), e.popScopeId(), t146 ),147 j = { class: 'ti-image' },148 O = { key: 0, class: 'ti-image-error' },149 v = { key: 0 },150 q = R(() =>151 e.createElementVNode('span', null, '\u52A0\u8F7D\u5931\u8D25', -1)152 ),153 W = ['src', 'alt']154 const w = _(155 e.defineComponent({156 props: {157 url: { type: String },158 alt: { type: String },159 fit: { type: String }160 },161 emits: ['error', 'load'],162 setup(t, { emit: n }) {163 const o = e.ref(!0),164 a = (l) => {165 n('error', l), (o.value = !1)166 },167 c = (l) => {168 n('load', l), (o.value = !0)169 }170 return (l, d) => (171 e.openBlock(),172 e.createElementBlock('div', j, [173 !o.value && l.$slots.placeholder174 ? (e.openBlock(),175 e.createElementBlock('div', O, [176 e.renderSlot(177 l.$slots,178 'placeholder',179 {},180 () => [181 t.alt182 ? (e.openBlock(),183 e.createElementBlock(184 'span',185 v,186 e.toDisplayString(t.alt),187 1188 ))189 : e.createCommentVNode('', !0),190 q191 ],192 !0193 )194 ]))195 : e.createCommentVNode('', !0),196 e.createElementVNode(197 'img',198 {199 class: 'ti-image--inner',200 src: t.url,201 alt: t.alt,202 style: e.normalizeStyle(`object-fit:${t.fit}`),203 onError: a,204 onLoad: c205 },206 null,207 44,208 W209 )210 ])211 )212 }213 }),214 [['__scopeId', 'data-v-b15b64dc']]215 )216 w.install = function (t) {217 t.component('TiImage', w)218 }219 const G = w220 const Se = ''221 const H = { class: 'ti-input-box' },222 J = ['type', 'placeholder', 'disabled', 'maxlength', 'value', 'minlength'],223 K = { class: 'ti-input--icon' }224 const E = _(225 e.defineComponent({226 props: {227 type: { type: String, default: 'text' },228 width: { type: String, default: '100%' },229 disabled: { type: Boolean, default: !1 },230 placeholder: { type: String, default: '\u8BF7\u8F93\u5165' },231 clearable: { type: Boolean, default: !1 },232 modelValue: { type: [String, Number] },233 borderRadius: { type: Number },234 maxlength: { type: Number },235 minlength: { type: Number }236 },237 emits: ['input', 'change', 'focus', 'blur', 'clear', 'update:modelValue'],238 setup(t, { emit: n }) {239 const o = t,240 a = e.ref(!1),241 c = e.ref('text'),242 l = { text: 'text', password: 'password' }243 e.onMounted(() => {244 c.value = o.type245 })246 const d = (u) => {247 ;(a.value = !0), n('focus', u)248 },249 h = (u) => {250 ;(a.value = !1), n('blur', u)251 },252 y = (u) => {253 const r = u.target.value254 n('change', r)255 },256 S = (u) => {257 const r = u.target.value258 n('input', r), n('update:modelValue', r)259 },260 B = () => {261 n('clear', o.modelValue), n('update:modelValue', '')262 },263 g = () => {264 c.value = c.value === l.password ? l.text : l.password265 }266 return (u, r) => (267 e.openBlock(),268 e.createElementBlock(269 'div',270 {271 class: e.normalizeClass([272 'ti-input',273 t.disabled ? 'is-disabled' : null274 ]),275 style: e.normalizeStyle(`width:${t.width}`)276 },277 [278 e.createElementVNode('div', H, [279 e.createElementVNode(280 'input',281 {282 class: e.normalizeClass([283 'ti-input--inner',284 t.clearable ? 'is-clearable' : null,285 t.type === l.password ? 'is-password' : null286 ]),287 style: e.normalizeStyle({288 borderRadius: `${t.borderRadius}px`289 }),290 type: c.value,291 placeholder: t.placeholder,292 disabled: t.disabled,293 maxlength: t.maxlength,294 value: t.modelValue,295 minlength: t.minlength,296 onFocus: d,297 onBlur: h,298 onChange: y,299 onInput: S300 },301 null,302 46,303 J304 ),305 e.createElementVNode('div', K, [306 t.modelValue && t.clearable307 ? (e.openBlock(),308 e.createBlock(309 e.unref(m),310 {311 key: 0,312 class: 'icon-delete',313 onMousedown: e.withModifiers(B, ['prevent'])314 },315 null,316 8,317 ['onMousedown']318 ))319 : e.createCommentVNode('', !0),320 t.type === l.password && t.modelValue321 ? (e.openBlock(),322 e.createBlock(323 e.unref(m),324 {325 key: 1,326 class: 'icon-eye',327 onMousedown: e.withModifiers(g, ['prevent'])328 },329 null,330 8,331 ['onMousedown']332 ))333 : e.createCommentVNode('', !0)334 ])335 ])336 ],337 6338 )339 )340 }341 }),342 [['__scopeId', 'data-v-2b79aa8b']]343 )344 E.install = function (t) {345 t.component('TiInput', E)346 }347 const P = E348 const Q = {349 mounted(t, n) {350 const { isDrag: o } = n.value351 if (!o) return352 U(t)353 const a = t.parentNode,354 { parentLeft: c, parentTop: l } = N(a)355 let d = c,356 h = l357 t.addEventListener('mousedown', (y) => {358 y.preventDefault()359 const { borderX: S, borderY: B } = N(a),360 g = y.clientX - d,361 u = y.clientY - h362 ;(document.onmousemove = function (r) {363 const s = r.clientX - g - c,364 i = r.clientY - u - l,365 f = $(s, S),366 p = $(i, B)367 a.style.transform = `translate(${f}px,${p}px)`368 }),369 (document.onmouseup = function (r) {370 const { parBorderX: s, parBorderY: i } = N(a)371 ;(d = $(r.clientX - g, s)),372 (h = $(r.clientY - u, i)),373 (this.onmousemove = null),374 (this.onmouseup = null)375 })376 })377 }378 }379 function U(t) {380 ;(t.style.cursor = 'move'), (t.style.userSelect = 'none')381 }382 function N(t) {383 const n = t.offsetLeft,384 o = t.offsetTop,385 a = [0 - n, n],386 c = [0 - o, o],387 l = [0, 2 * n],388 d = [0, 2 * o]389 return {390 parentLeft: n,391 parentTop: o,392 borderX: a,393 borderY: c,394 parBorderX: l,395 parBorderY: d396 }397 }398 function $(t, n) {399 return t < n[0] ? n[0] : t > n[1] ? n[1] : t400 }401 const Ve = ''402 const Z = ((t) => (403 e.pushScopeId('data-v-750a84a6'), (t = t()), e.popScopeId(), t404 ))(() => e.createElementVNode('div', { class: 'ti-modal-mask' }, null, -1)),405 ee = { class: 'ti-modal-warp' },406 te = { class: 'ti-modal-title' },407 ne = { class: 'title--inner' },408 oe = { class: 'ti-modal-content' },409 le = { class: 'ti-modal-footer' },410 ae = { class: 'footer--inner' }411 const C = _(412 e.defineComponent({413 props: {414 width: { type: String, default: '400px' },415 title: { type: String, default: 'Title' },416 cancelText: { type: String, default: '\u53D6\u6D88' },417 confirmText: { type: String, default: '\u786E\u5B9A' },418 modelValue: { type: Boolean, default: !1 },419 isDrag: Boolean420 },421 emits: ['close', 'cancel', 'confirm', 'update:modelValue'],422 setup(t, { emit: n }) {423 const o = () => {424 n('cancel'), n('update:modelValue', !1)425 },426 a = () => {427 n('confirm'), n('update:modelValue', !1)428 },429 c = () => {430 n('close'), n('update:modelValue', !1)431 }432 return (l, d) =>433 t.modelValue434 ? (e.openBlock(),435 e.createElementBlock(436 'div',437 {438 key: 0,439 class: e.normalizeClass([440 'ti-modal',441 t.isDrag ? 'is-drag' : ''442 ])443 },444 [445 Z,446 e.createElementVNode('div', ee, [447 e.createVNode(448 e.Transition,449 { name: 'modal' },450 {451 default: e.withCtx(() => [452 t.modelValue453 ? (e.openBlock(),454 e.createElementBlock(455 'div',456 {457 key: 0,458 class: 'ti-modal-inner',459 style: e.normalizeStyle({ width: t.width })460 },461 [462 e.withDirectives(463 (e.openBlock(),464 e.createElementBlock('div', te, [465 e.createElementVNode(466 'span',467 ne,468 e.toDisplayString(t.title),469 1470 ),471 e.createVNode(e.unref(m), {472 name: 'icon-delete',473 size: 20,474 color: '#8c8c8c',475 onClick: c476 })477 ])),478 [[e.unref(Q), { isDrag: t.isDrag }]]479 ),480 e.createElementVNode('div', oe, [481 e.renderSlot(482 l.$slots,483 'default',484 {},485 void 0,486 !0487 )488 ]),489 e.createElementVNode('div', le, [490 e.createElementVNode('div', ae, [491 e.createVNode(492 e.unref(b),493 { onClick: o },494 {495 default: e.withCtx(() => [496 e.createTextVNode(497 e.toDisplayString(t.cancelText),498 1499 )500 ]),501 _: 1502 }503 ),504 e.createVNode(505 e.unref(b),506 { type: 'fill', onClick: a },507 {508 default: e.withCtx(() => [509 e.createTextVNode(510 e.toDisplayString(t.confirmText),511 1512 )513 ]),514 _: 1515 }516 )517 ])518 ])519 ],520 4521 ))522 : e.createCommentVNode('', !0)523 ]),524 _: 3525 }526 )527 ])528 ],529 2530 ))531 : e.createCommentVNode('', !0)532 }533 }),534 [['__scopeId', 'data-v-750a84a6']]535 )536 C.install = function (t) {537 t.component('TiModal', C)538 }539 const se = C540 const we = ''541 const ce = ['value', 'placeholder', 'disabled'],542 ie = { class: 'ti-select-dropdown' },543 re = { class: 'ti-select-options ti-scrollbar' },544 de = ['onMousedown']545 const x = _(546 e.defineComponent({547 props: {548 width: { type: String, default: '100%' },549 placeholder: { type: String, default: '\u8BF7\u9009\u62E9' },550 options: { type: Array, default: () => [] },551 disabled: { type: Boolean, default: !1 },552 multiple: { type: Boolean, default: !1 },553 modelValue: { type: [String, Boolean, Number, Array], default: '' }554 },555 emits: ['select', 'update:modelValue'],556 setup(t, { emit: n }) {557 const o = t,558 a = e.ref(!1),559 c = e.ref(-1),560 l = e.ref([]),561 d = e.ref([]),562 h = () => {563 o.disabled || (a.value = !a.value)564 },565 y = () => {566 a.value && (a.value = !1)567 },568 S = (s) => {569 o.multiple ? g(s) : B(s)570 },571 B = (s) => {572 c.value = s573 const i = o.options[s].value574 n('select', i), n('update:modelValue', i)575 },576 g = (s) => {577 let p578 const i = l.value.indexOf(s)579 i === -1580 ? (l.value.push(s),581 d.value.push((p = o.options[s]) == null ? void 0 : p.value))582 : (l.value.splice(i, 1), d.value.splice(i, 1)),583 n('select', d.value),584 n('update:modelValue', d.value)585 },586 u = (s) =>587 o.multiple588 ? l.value.includes(s)589 ? 'active'590 : ''591 : c.value === s592 ? 'active'593 : '',594 r = () => {595 let s596 return o.multiple597 ? l.value.reduce((i, f) => {598 let p599 return `${(p = o.options[f]) == null ? void 0 : p.label}${600 i ? ',' : ''601 }${i}`602 }, '')603 : (s = o.options[c.value]) == null604 ? void 0605 : s.label606 }607 return (s, i) => (608 e.openBlock(),609 e.createElementBlock(610 'div',611 {612 class: e.normalizeClass([613 'ti-select',614 t.disabled ? 'is-disabled' : ''615 ]),616 style: e.normalizeStyle({ width: t.width })617 },618 [619 e.createElementVNode(620 'div',621 { class: 'ti-select-box', onClick: h },622 [623 e.createElementVNode(624 'input',625 {626 class: 'ti-select--inner',627 type: 'text',628 readonly: '',629 value: r(),630 placeholder: t.placeholder,631 disabled: t.disabled,632 onBlur: y,633 onInput: i[0] || (i[0] = (f) => r())634 },635 null,636 40,637 ce638 ),639 e.createVNode(640 e.unref(m),641 {642 class: e.normalizeClass([643 'icon-drop-down',644 a.value ? 'is-reserve' : ''645 ])646 },647 null,648 8,649 ['class']650 )651 ]652 ),653 e.withDirectives(654 e.createElementVNode(655 'div',656 ie,657 [658 e.createElementVNode('div', re, [659 (e.openBlock(!0),660 e.createElementBlock(661 e.Fragment,662 null,663 e.renderList(664 t.options,665 (f, p) => (666 e.openBlock(),667 e.createElementBlock(668 'div',669 {670 key: f.label + f.value,671 class: e.normalizeClass([672 'ti-select-option-item',673 u(p)674 ]),675 onMousedown: (Ne) => S(p)676 },677 e.toDisplayString(f.label),678 43,679 de680 )681 )682 ),683 128684 ))685 ])...
mosaic.toolbar.js
Source:mosaic.toolbar.js
...57 $el = $(document.createElement("label"));58 // Create menu59 parent.append($el60 .addClass("mosaic-icon-menu mosaic-icon-menu-" +61 normalizeClass(action.name) + ' mosaic-icon')62 .html(action.label)63 .attr("title", action.label)64 .append($(document.createElement("select"))65 .addClass("mosaic-menu-" + normalizeClass(action.name))66 .data("action", action.action)67 .change(function () {68 $(this).mosaicExecAction();69 })70 .each(function () {71 // Local variables72 var z, elm, y;73 for (z in action.items) {74 // Check if child objects75 if (action.items[z].items !== undefined) {76 $(this).append($(document.createElement("optgroup"))77 .addClass("mosaic-option-group mosaic-option-group-" +78 normalizeClass(action.items[z].value))79 .attr("label", action.items[z].label)80 );81 elm = $(this).find(".mosaic-option-group-" +82 normalizeClass(action.items[z].value));83 // Add child nodes84 for (y in action.items[z].items) {85 elm.append(86 $(document.createElement("option"))87 .attr('value', action.items[z].items[y].value)88 .addClass('mosaic-option mosaic-option-' +89 normalizeClass(action.items[z].items[y].value))90 .html(action.items[z].items[y].label)91 );92 }93 // Else no child objects94 } else {95 $(this).append(96 $(document.createElement("option"))97 .attr('value', action.items[z].value)98 .addClass('mosaic-option mosaic-option-' + normalizeClass(action.items[z].value))99 .html(action.items[z].label)100 );101 }102 }103 })104 )105 );106 // Else text menu107 } else {108 $el = $(document.createElement("select"));109 // Create menu110 parent.append($el111 .addClass("mosaic-menu mosaic-menu-" +112 action.name.replace(/_/g, "-"))113 .data("action", action.action)114 .change(function () {115 $(this).mosaicExecAction();116 })117 .each(function () {118 // Local variables119 var z, elm, y;120 for (z = 0; z < action.items.length; z += 1) {121 // Check if child objects122 if (action.items[z].items !== undefined) {123 $(this).append($(document.createElement("optgroup"))124 .addClass("mosaic-option-group mosaic-option-group-" +125 normalizeClass(action.items[z].value))126 .attr("label", action.items[z].label)127 );128 elm = $(this).find(".mosaic-option-group-" + normalizeClass(action.items[z].value));129 // Add child nodes130 for (y in action.items[z].items) {131 elm.append(132 $(document.createElement("option"))133 .attr('value', action.items[z].items[y].value)134 .addClass('mosaic-option mosaic-option-' + normalizeClass(action.items[z].items[y].value))135 .html(action.items[z].items[y].label)136 );137 }138 // Else no child objects139 } else {140 $(this).append(141 $(document.createElement("option"))142 .attr('value', action.items[z].value)143 .addClass('mosaic-option mosaic-option-' + normalizeClass(action.items[z].value))144 .html(action.items[z].label)145 );146 }147 }148 })149 );150 }151 } else {152 $el = $(document.createElement("button"));153 // Create button154 parent.append($el155 .addClass("mosaic-button mosaic-button-" + normalizeClass(action.name) + (action.icon ? ' mosaic-icon' : ''))156 .html(action.label)157 .attr("title", action.label)158 .attr("type", "button")159 .data("action", action.action)160 .mousedown(function () {161 $(this).mosaicExecAction();162 })163 );164 }165 if($.mosaic.actionManager.actions[action.name]){166 if(!$.mosaic.actionManager.actions[action.name].visible()){167 // hide it168 $el.hide();169 }170 }171 }172 $.fn._mosaicToolbarLayoutEditor = function(actions){173 $('.mosaic-toolbar-secondary-functions', this).show();174 var x, y, action_group, elm_action_group;175 // Add formats to toolbar176 if ($.mosaic.options.formats !== undefined) {177 for (x = 0; x < $.mosaic.options.formats.length; x += 1) {178 action_group = $.mosaic.options.formats[x];179 actions.primary_actions.append(180 $(document.createElement("fieldset"))181 .addClass(182 "mosaic-button-group mosaic-button-group-" +183 normalizeClass(action_group.name))184 );185 elm_action_group = actions.primary_actions.children(186 ".mosaic-button-group-" +187 action_group.name.replace(/_/g, "-"));188 for (y = 0; y < action_group.actions.length; y += 1) {189 if (action_group.actions[y].favorite) {190 // Add control191 AddControl(elm_action_group,192 action_group.actions[y]);193 }194 }195 if (elm_action_group.children().length === 0) {196 elm_action_group.remove();197 }198 }199 }200 // Add items to the insert menu201 if ($.mosaic.options.tiles !== undefined) {202 var elm_select_insert = actions.secondary_actions.find(203 ".mosaic-menu-insert");204 for (x = 0; x < $.mosaic.options.tiles.length; x += 1) {205 action_group = $.mosaic.options.tiles[x];206 elm_select_insert.append($(document.createElement("optgroup"))207 .addClass("mosaic-option-group mosaic-option-group-" + normalizeClass(action_group.name))208 .attr("label", action_group.label)209 );210 elm_action_group = actions.secondary_actions.find(".mosaic-option-group-" + normalizeClass(action_group.name));211 for (y = 0; y < action_group.tiles.length; y += 1) {212 var tile = action_group.tiles[y];213 elm_action_group.append($(document.createElement("option"))214 .addClass("mosaic-option mosaic-option-" + normalizeClass(tile.name))215 .attr("value", tile.name)216 .html(tile.label)217 );218 }219 if (elm_action_group.children().length === 0) {220 elm_action_group.remove();221 }222 }223 }224 // Add items to the format menu225 if ($.mosaic.options.formats !== undefined) {226 var elm_select_format = actions.secondary_actions.find(".mosaic-menu-format");227 for (x = 0; x < $.mosaic.options.formats.length; x += 1) {228 action_group = $.mosaic.options.formats[x];229 elm_select_format.append($(document.createElement("optgroup"))230 .addClass("mosaic-option-group mosaic-option-group-" + normalizeClass(action_group.name))231 .attr("label", action_group.label)232 );233 elm_action_group = actions.secondary_actions.find(".mosaic-option-group-" + normalizeClass(action_group.name));234 for (y = 0; y < action_group.actions.length; y += 1) {235 var action = action_group.actions[y];236 if (action.favorite === false) {237 elm_action_group.append($(document.createElement("option"))238 .addClass("mosaic-option mosaic-option-" + normalizeClass(action.name))239 .attr("value", action.name)240 .html(action.label)241 .data("action", action.action)242 );243 }244 }245 if (elm_action_group.children().length === 0) {246 elm_action_group.remove();247 }248 }249 }250 };251 /**252 * Create a new instance of a mosaic toolbar.253 *254 * @constructor255 * @id jQuery.fn.mosaicToolbar256 * @return {Object} Returns a jQuery object of the matched elements.257 */258 $.fn.mosaicToolbar = function () {259 // Loop through matched elements260 return this.each(function () {261 // Local variables262 var obj, content, actions, a, x, action_group, elm_action_group, y,263 RepositionToolbar, SelectedTileChange;264 // Get current object265 obj = $(this);266 // Empty object267 obj.html("");268 // Add mosaic toolbar class269 obj.append($(document.createElement("div"))270 .addClass("mosaic-inline-toolbar")271 );272 obj = obj.children(".mosaic-inline-toolbar");273 // Add content274 obj.append($(document.createElement("div"))275 .addClass("mosaic-toolbar-content")276 );277 content = obj.children(".mosaic-toolbar-content");278 // Add primary and secondary function div's279 actions = {};280 content.append($(document.createElement("div"))281 .addClass("mosaic-toolbar-primary-functions")282 );283 actions.primary_actions =284 content.children(".mosaic-toolbar-primary-functions");285 content.append($(document.createElement("div"))286 .addClass("mosaic-toolbar-secondary-functions")287 );288 actions.secondary_actions =289 content.children(".mosaic-toolbar-secondary-functions");290 // Loop through action groups291 for (a in actions) {292 // Add actions to toolbar293 for (x = 0; x < $.mosaic.options[a].length; x += 1) {294 // If single action295 if ($.mosaic.options[a][x].actions === undefined) {296 // Add control297 AddControl(actions[a], $.mosaic.options[a][x]);298 // If fieldset299 } else {300 action_group = $.mosaic.options[a][x];301 var classNamePart = normalizeClass($.mosaic.options[a][x].name);302 var $group = $(document.createElement("div"))303 .addClass("mosaic-button-group mosaic-button-group-" +304 classNamePart);305 $group.append(AddControl($group, $.extend({}, true, action_group, {306 action: action_group.name.toLowerCase(),307 name: action_group.name.toLowerCase()308 })));309 var $btnContainer = $(document.createElement("div")).addClass('btn-container');310 $group.append($btnContainer);311 actions[a].append($group);312 for (y = 0; y < action_group.actions.length; y += 1) {313 // Add control314 AddControl($btnContainer, action_group.actions[y]);315 }...
vue-cookie-accept-decline.esm.js
Source:vue-cookie-accept-decline.esm.js
...167 default: withCtx(function () { return [168 ($data.isOpen)169 ? (openBlock(), createElementBlock("div", {170 key: 0,171 class: normalizeClass(["cookie", ['cookie__' + $props.type, 'cookie__' + $props.type + '--' + $props.position]]),172 id: $props.elementId173 }, [174 createElementVNode("div", {175 class: normalizeClass('cookie__' + $props.type + '__wrap')176 }, [177 ($props.showPostponeButton === true)178 ? (openBlock(), createElementBlock("div", {179 key: 0,180 onClick: _cache[0] || (_cache[0] = function () {181 var args = [], len = arguments.length;182 while ( len-- ) args[ len ] = arguments[ len ];183 return ($options.postpone && $options.postpone.apply($options, args));184 }),185 class: normalizeClass('cookie__' + $props.type + '__postpone-button'),186 title: "Close"187 }, [188 renderSlot(_ctx.$slots, "postponeContent", {}, function () { return [189 _hoisted_2190 ]; })191 ], 2 /* CLASS */))192 : createCommentVNode("v-if", true),193 createElementVNode("div", {194 class: normalizeClass('cookie__' + $props.type + '__content')195 }, [196 renderSlot(_ctx.$slots, "message", {}, function () { return [197 _hoisted_3,198 _hoisted_4199 ]; })200 ], 2 /* CLASS */),201 createElementVNode("div", {202 class: normalizeClass('cookie__' + $props.type + '__buttons')203 }, [204 ($props.disableDecline === false)205 ? (openBlock(), createElementBlock("button", {206 key: 0,207 onClick: _cache[1] || (_cache[1] = function () {208 var args = [], len = arguments.length;209 while ( len-- ) args[ len ] = arguments[ len ];210 return ($options.decline && $options.decline.apply($options, args));211 }),212 class: normalizeClass([213 'cookie__' + $props.type + '__buttons__button',214 'cookie__' + $props.type + '__buttons__button--decline' ])215 }, [216 renderSlot(_ctx.$slots, "declineContent", {}, function () { return [217 _hoisted_5218 ]; })219 ], 2 /* CLASS */))220 : createCommentVNode("v-if", true),221 createElementVNode("button", {222 onClick: _cache[2] || (_cache[2] = function () {223 var args = [], len = arguments.length;224 while ( len-- ) args[ len ] = arguments[ len ];225 return ($options.accept && $options.accept.apply($options, args));226 }),227 class: normalizeClass([228 'cookie__' + $props.type + '__buttons__button',229 'cookie__' + $props.type + '__buttons__button--accept' ])230 }, [231 renderSlot(_ctx.$slots, "acceptContent", {}, function () { return [232 _hoisted_6233 ]; })234 ], 2 /* CLASS */)235 ], 2 /* CLASS */)236 ], 2 /* CLASS */)237 ], 10 /* CLASS, PROPS */, _hoisted_1))238 : createCommentVNode("v-if", true)239 ]; }),240 _: 3 /* FORWARDED */241 }, 8 /* PROPS */, ["name"]))...
entityAttributesActions.js
Source:entityAttributesActions.js
1"use strict";2Object.defineProperty(exports, "__esModule", {3 value: true4});5exports.saveEntityAttributes = exports.loadEntityClassesAndAttributes = exports.normalizeClass = exports.UPDATE_ENTITY_ATTRIBUTES = exports.UPDATE_ENTITY_ATTRIBUTES_STARTED = exports.LOAD_ENTITY_CLASSES_AND_ATTRIBUTES = exports.LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED = void 0;6var _Immutable = _interopRequireDefault(require("app/utils/immutable/Immutable"));7var _lo = require("app/utils/lo/lo");8var _client = require("graphql/client");9var _actionUtils = require("app/utils/redux/action-utils");10var _entityClassesAttributesQuery = _interopRequireDefault(require("graphql/entities/common/classifications/entityClassesAttributesQuery"));11var _saveEntityMutation = _interopRequireDefault(require("graphql/entities/entities/saveEntityMutation"));12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }13const LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED = '@@affectli/entities/common/classifications/LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED';14exports.LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED = LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED;15const LOAD_ENTITY_CLASSES_AND_ATTRIBUTES = '@@affectli/entities/common/classifications/LOAD_ENTITY_CLASSES_AND_ATTRIBUTES';16exports.LOAD_ENTITY_CLASSES_AND_ATTRIBUTES = LOAD_ENTITY_CLASSES_AND_ATTRIBUTES;17const UPDATE_ENTITY_ATTRIBUTES_STARTED = '@@affectli/entities/common/classifications/UPDATE_ENTITY_ATTRIBUTES_STARTED';18exports.UPDATE_ENTITY_ATTRIBUTES_STARTED = UPDATE_ENTITY_ATTRIBUTES_STARTED;19const UPDATE_ENTITY_ATTRIBUTES = '@@affectli/entities/common/classifications/UPDATE_ENTITY_ATTRIBUTES';20exports.UPDATE_ENTITY_ATTRIBUTES = UPDATE_ENTITY_ATTRIBUTES;21const normalizeClass = classification => {22 const fields = (classification.formDefinitions || {}).fields || []; // get the fields' groups names removing the duplicates23 const fieldGroupsNames = Array.from(new Set(fields.map(({24 group_name25 }) => group_name || 'Ungrouped')));26 return { ...classification,27 groups: fieldGroupsNames.map(name => ({28 name: name,29 fields: fields.filter(({30 group_name31 }) => (group_name || 'Ungrouped') === name)32 }))33 };34};35exports.normalizeClass = normalizeClass;36const _loadEntityAttrClasses = id => {37 if (!id) {38 return Promise.resolve(null);39 }40 return _client.graphql.query({41 query: _entityClassesAttributesQuery.default,42 variables: {43 id44 },45 fetchPolicy: 'no-cache'46 }).then(response => {47 const data = (0, _Immutable.default)((0, _lo.get)(response, 'data.result') || []);48 const classes = (data.classes || []).map(normalizeClass);49 return { ...data,50 classes51 };52 });53};54const loadEntityClassesAndAttributes = id => (dispatch, getState) => {55 dispatch({56 type: LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED57 });58 return _loadEntityAttrClasses(id).then(data => {59 dispatch({60 type: LOAD_ENTITY_CLASSES_AND_ATTRIBUTES,61 payload: (0, _Immutable.default)(data)62 });63 return (0, _Immutable.default)(data);64 }).catch((0, _actionUtils.dispatchError)(dispatch, LOAD_ENTITY_CLASSES_AND_ATTRIBUTES_STARTED));65};66exports.loadEntityClassesAndAttributes = loadEntityClassesAndAttributes;67const saveEntityAttributes = (id, attributes) => (0, _actionUtils.mutateData)(UPDATE_ENTITY_ATTRIBUTES_STARTED, UPDATE_ENTITY_ATTRIBUTES, _saveEntityMutation.default, 'Attributes updated.')({68 record: {69 id,70 attributes71 }72});...
dom-manipulator.js
Source:dom-manipulator.js
1const domManipulator = (function(){2 const classNames = emojiReplacer.classNames;3 return {4 start,5 clean6 }7 function start(root=document.body, cleanUp=true) {8 // make sure root is a node9 if (root && root.nodeType) {10 if (cleanUp) {11 clean(root);12 }13 const treeWalker = document.createTreeWalker(14 root, NodeFilter.SHOW_TEXT // filter to only text nodes15 );16 // perform replacement on each text node in document17 while (treeWalker.nextNode()) {18 const originalNode = treeWalker.currentNode;19 emojiReplacer.translateTextNode(originalNode);20 }21 }22 }23 function clean(root=document.body) {24 const normalizeClass = "emoji-to-english-normalize-temp";25 // remove extra nodes added by extension26 let extraNodes = root.querySelectorAll(27 `.${classNames['translation']}, .${classNames['helper']}`28 );29 for (const extraNode of extraNodes) {30 const origParent = extraNode.parentNode;31 if (origParent) {32 origParent.classList.add(normalizeClass);33 origParent.removeChild(extraNode);34 }35 }36 // restore emojis37 let emojiNodes = root.querySelectorAll(`.${classNames['emoji']}`);38 for (const emojiNode of emojiNodes) {39 const parentNode = emojiNode.parentNode;40 parentNode.classList.add(normalizeClass);41 parentNode.insertBefore(42 document.createTextNode(emojiNode.textContent),43 emojiNode44 );45 parentNode.removeChild(emojiNode);46 }47 // rejoin textNodes that were split by translated emojis48 const normalizeNodes = root.querySelectorAll(`.${normalizeClass}`);49 for (const normalizeNode of normalizeNodes) {50 normalizeNode.normalize();51 normalizeNode.classList.remove(normalizeClass);52 }53 }...
vue3-render.result.js
Source:vue3-render.result.js
1function render(_ctx, _cache, $props, $setup, $data, $options) {2 return Object(vue__WEBPACK_IMPORTED_MODULE_0__[3 /* openBlock */4 "i"])(), Object(vue__WEBPACK_IMPORTED_MODULE_0__[5 /* createElementBlock */6 "b"])("view", {7 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[8 /* normalizeClass */9 "g"])(["index container bg-_l__h_ffffff_r_", $setup.flag ? "text-_l__h_aaaaaa_r_" : "text-_l__h_fafafa_r_"])10 }, [Object(vue__WEBPACK_IMPORTED_MODULE_0__[11 /* createElementVNode */12 "c"])("view", {13 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[14 /* normalizeClass */15 "g"])([$setup.flag ? 'bg-red-900' : "bg-_l__h_fafa00_r_"])16 }, "bg-[#fafa00]", 217 /* CLASS */18 ), Object(vue__WEBPACK_IMPORTED_MODULE_0__[19 /* createElementVNode */20 "c"])("view", {21 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[22 /* normalizeClass */23 "g"])({24 "bg-_l__h_098765_r_": $setup.flag === true25 })26 }, "bg-[#098765]", 227 /* CLASS */28 ), _hoisted_1], 229 /* CLASS */30 );...
vue3-render.js
Source:vue3-render.js
1function render(_ctx, _cache, $props, $setup, $data, $options) {2 return Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* openBlock */ "i"])(), Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* createElementBlock */ "b"])("view", {3 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* normalizeClass */ "g"])(["index container bg-[#ffffff]", $setup.flag ? 'text-[#aaaaaa]' : 'text-[#fafafa]'])4 }, [Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* createElementVNode */ "c"])("view", {5 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* normalizeClass */ "g"])([$setup.flag ? 'bg-red-900' : 'bg-[#fafa00]'])6 }, "bg-[#fafa00]", 27 /* CLASS */8 ), Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* createElementVNode */ "c"])("view", {9 class: Object(vue__WEBPACK_IMPORTED_MODULE_0__[/* normalizeClass */ "g"])({10 'bg-[#098765]': $setup.flag === true11 })12 }, "bg-[#098765]", 213 /* CLASS */14 ), _hoisted_1], 215 /* CLASS */16 );...
Using AI Code Generation
1const { normalizeClass } = require('@playwright/test/lib/utils');2const { test } = require('@playwright/test');3test('should work', async ({ page }) => {4 const title = page.locator('.navbar__inner .navbar__title');5 await title.waitFor();6 const titleText = await title.textContent();7 const normalizedTitleText = normalizeClass(titleText);8 console.log(normalizedTitleText);9 expect(titleText).toBe('Playwright');10 expect(normalizedTitleText).toBe('playwright');11});
Using AI Code Generation
1const { normalizeClass } = require('playwright/lib/utils/utils');2const { selectors } = require('playwright/lib/server/selectors');3const { parseSelector } = require('playwright/lib/server/selectorParser');4const { SelectorEngine } = require('playwright/lib/server/selectorEngine');5const { Selector } = require('playwright/lib/server/selector');6const { ElementHandle } = require('playwright/lib/server/dom');7const { assert } = require('playwright/lib/utils/utils');8const { JSHandle } = require('playwright/lib/server/jsHandle');9const { Frame } = require('playwright/lib/server/frame');10const { Page } = require('playwright/lib/server/page');11const { Worker } = require('playwright/lib/server/worker');12const { JSHandleDispatcher } = require('playwright/lib/server/dispatchers/jsHandleDispatcher');13const { FrameDispatcher } = require('playwright/lib/server/dispatchers/frameDispatcher');14const { PageDispatcher } = require('playwright/lib/server/dispatchers/pageDispatcher');15const { WorkerDispatcher } = require('playwright/lib/server/dispatchers/workerDispatcher');16const { ElementHandleDispatcher } = require('playwright/lib/server/dispatchers/elementHandleDispatcher');17const { SelectorDispatcher } = require('playwright/lib/server/dispatchers/selectorDispatcher');18const { normalizeClass: normalizeClass1 } = require('playwright/lib/utils/utils');19const { selectors: selectors1 } = require('playwright/lib/server/selectors');20const { parseSelector: parseSelector1 } = require('playwright/lib/server/selectorParser');21const { SelectorEngine: SelectorEngine1 } = require('playwright/lib/server/selectorEngine');22const { Selector: Selector1 } = require('playwright/lib/server/selector');23const { ElementHandle: ElementHandle1 } = require('playwright/lib/server/dom');24const { assert: assert1 } = require('playwright/lib/utils/utils');25const { JSHandle: JSHandle1 } = require('playwright/lib/server/jsHandle');26const { Frame: Frame1 } = require('playwright/lib/server/frame');27const { Page: Page1 } = require('playwright/lib/server/page');28const { Worker: Worker1 } = require('playwright/lib/server/worker');29const { JSHandleDispatcher: JSHandleDispatcher1 } = require('playwright/lib/server/dispatchers/jsHandleDispatcher');30const { FrameDispatcher: FrameDispatcher1
Using AI Code Generation
1const { normalizeClass } = require('@playwright/test/lib/utils').test;2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 const className = normalizeClass('a b c');5 await page.setContent(`<div class="${className}"></div>`);6});
Using AI Code Generation
1const { normalizeClass } = require('@playwright/test/lib/server/utils');2const normalizedClass = normalizeClass('some-class');3console.log(normalizedClass);4const { normalizeSelector } = require('@playwright/test/lib/server/utils');5const normalizedSelector = normalizeSelector('some-selector');6console.log(normalizedSelector);7const { normalizeType } = require('@playwright/test/lib/server/utils');8const normalizedType = normalizeType('some-type');9console.log(normalizedType);10const { parseSelector } = require('@playwright/test/lib/server/utils');11const parsedSelector = parseSelector('some-selector');12console.log(parsedSelector);13const { removeLineBreaks } = require('@playwright/test/lib/server/utils');14const removedLineBreaks = removeLineBreaks('some-string');15console.log(removedLineBreaks);16const { removeLineBreaks } = require('@playwright/test/lib/server/utils');17const removedLineBreaks = removeLineBreaks('some-string');18console.log(removedLineBreaks);19const { removeLineBreaks } = require('@playwright/test/lib/server/utils');20const removedLineBreaks = removeLineBreaks('some-string');21console.log(removedLineBreaks);22const { serializeError } = require('@playwright/test/lib/server/utils');23const serializedError = serializeError('some-error');24console.log(serializedError);25const { serializeError } = require('@playwright/test/lib/server/utils');26const serializedError = serializeError('some-error');27console.log(serializedError);28const { serializeError } = require('@playwright/test/lib/server/utils');
Using AI Code Generation
1const { normalizeType } = require('@playwright/test/lib/utils/variant');2const { test as base } = require('@playwright/test');3const test = base.extend({4 async normalizeType({}, run, testInfo) {5 await run(normalizeType(testInfo));6 },7});8test('test', async ({ normalizeType }) => {9 console.log(await normalizeType('iPhone 12'));10});11import { PlaywrightTestConfig } from '@playwright/test';12const config: PlaywrightTestConfig = {13 {14 use: {15 },16 },17 {18 use: {19 },20 },21 {22 use: {23 },24 },25};26export default config;27import { PlaywrightTestConfig } from '@playwright/test';28const config: PlaywrightTestConfig = {29 {30 use: {31 },32 },33 {34 use: {35 },36 },37 {38 use: {39 },40 },41};42export default config;
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!