From 4e5709386d781628e0e419c7d9e6f2b0c5764a4a Mon Sep 17 00:00:00 2001 From: Mark Teekman Date: Sun, 22 Jan 2023 11:03:01 +0100 Subject: [PATCH] Update library output --- dist/accessible-vue-components.es.js | 46 +++++++++++++++------------ dist/accessible-vue-components.umd.js | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/dist/accessible-vue-components.es.js b/dist/accessible-vue-components.es.js index e537730..3a073bb 100644 --- a/dist/accessible-vue-components.es.js +++ b/dist/accessible-vue-components.es.js @@ -1,24 +1,24 @@ -import { ref as r, openBlock as l, createElementBlock as a, createElementVNode as u, withKeys as k } from "vue"; -const m = ["onKeydown"], p = { +import { ref as i, openBlock as l, createElementBlock as a, createElementVNode as u, withKeys as k, renderSlot as m, createTextVNode as d } from "vue"; +const p = ["onKeydown"], _ = { __name: "SkipLinks", setup(s) { - const c = r(null), o = (n) => { - n.setAttribute("tabindex", "-1"), n.focus(); - }, i = (n) => { - const e = c.value.querySelector("a").getAttribute("href"); - if (document.querySelector(e)) { - const t = document.querySelector(e); - o(t); - } else if (!document.querySelector(e) && document.querySelector("h1")) { - const t = document.querySelector("h1"); - o(t); - } else if (!document.querySelector(e) && !document.querySelector("h1")) { - const t = document.querySelector("main"); - o(t); + const c = i(null), o = (e) => { + e.setAttribute("tabindex", "-1"), e.focus(); + }, r = (e) => { + const t = c.value.querySelector("a").getAttribute("href"); + if (document.querySelector(t)) { + const n = document.querySelector(t); + o(n); + } else if (!document.querySelector(t) && document.querySelector("h1")) { + const n = document.querySelector("h1"); + o(n); + } else if (!document.querySelector(t) && !document.querySelector("h1")) { + const n = document.querySelector("main"); + o(n); } else console.warn("SkipLinks are not set, either missing an h1, main landmark or main content id on the page."); }; - return (n, e) => (l(), a("div", { + return (e, t) => (l(), a("div", { class: "avc-skiplinks", ref_key: "skipLinks", ref: c @@ -26,15 +26,19 @@ const m = ["onKeydown"], p = { u("a", { href: "#main-content", class: "skiplinks__skiplink", - onKeydown: k(i, ["enter"]) - }, "Skip to main content", 40, m) + onKeydown: k(r, ["enter"]) + }, [ + m(e.$slots, "default", {}, () => [ + d("Skip to main content") + ]) + ], 40, p) ], 512)); } -}, d = { +}, S = { install: (s) => { - s.component("SkipLinks", p); + s.component("SkipLinks", _); } }; export { - d as default + S as default }; diff --git a/dist/accessible-vue-components.umd.js b/dist/accessible-vue-components.umd.js index 31b8a05..2ec7adf 100644 --- a/dist/accessible-vue-components.umd.js +++ b/dist/accessible-vue-components.umd.js @@ -1 +1 @@ -(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("vue")):typeof define=="function"&&define.amd?define(["vue"],o):(e=typeof globalThis<"u"?globalThis:e||self,e["accessible-vue-components"]=o(e.Vue))})(this,function(e){"use strict";const o="",u=["onKeydown"],l={__name:"SkipLinks",setup(c){const r=e.ref(null),i=s=>{s.setAttribute("tabindex","-1"),s.focus()},d=s=>{const n=r.value.querySelector("a").getAttribute("href");if(document.querySelector(n)){const t=document.querySelector(n);i(t)}else if(!document.querySelector(n)&&document.querySelector("h1")){const t=document.querySelector("h1");i(t)}else if(!document.querySelector(n)&&!document.querySelector("h1")){const t=document.querySelector("main");i(t)}else console.warn("SkipLinks are not set, either missing an h1, main landmark or main content id on the page.")};return(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:"avc-skiplinks",ref_key:"skipLinks",ref:r},[e.createElementVNode("a",{href:"#main-content",class:"skiplinks__skiplink",onKeydown:e.withKeys(d,["enter"])},"Skip to main content",40,u)],512))}};return{install:c=>{c.component("SkipLinks",l)}}}); +(function(e,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("vue")):typeof define=="function"&&define.amd?define(["vue"],s):(e=typeof globalThis<"u"?globalThis:e||self,e["accessible-vue-components"]=s(e.Vue))})(this,function(e){"use strict";const s="",u=["onKeydown"],l={__name:"SkipLinks",setup(c){const r=e.ref(null),i=n=>{n.setAttribute("tabindex","-1"),n.focus()},d=n=>{const t=r.value.querySelector("a").getAttribute("href");if(document.querySelector(t)){const o=document.querySelector(t);i(o)}else if(!document.querySelector(t)&&document.querySelector("h1")){const o=document.querySelector("h1");i(o)}else if(!document.querySelector(t)&&!document.querySelector("h1")){const o=document.querySelector("main");i(o)}else console.warn("SkipLinks are not set, either missing an h1, main landmark or main content id on the page.")};return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:"avc-skiplinks",ref_key:"skipLinks",ref:r},[e.createElementVNode("a",{href:"#main-content",class:"skiplinks__skiplink",onKeydown:e.withKeys(d,["enter"])},[e.renderSlot(n.$slots,"default",{},()=>[e.createTextVNode("Skip to main content")])],40,u)],512))}};return{install:c=>{c.component("SkipLinks",l)}}});