bojuvue 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +287 -0
  3. package/dist/BVButton.test.d.ts +1 -0
  4. package/dist/BVButton.types.d.ts +9 -0
  5. package/dist/BVButton.vue.d.ts +15 -0
  6. package/dist/BVIconButton.test.d.ts +1 -0
  7. package/dist/BVIconButton.types.d.ts +11 -0
  8. package/dist/BVIconButton.vue.d.ts +17 -0
  9. package/dist/BVMoreButton.test.d.ts +1 -0
  10. package/dist/BVMoreButton.types.d.ts +15 -0
  11. package/dist/BVMoreButton.vue.d.ts +20 -0
  12. package/dist/BVPlatformButton.test.d.ts +1 -0
  13. package/dist/BVPlatformButton.types.d.ts +10 -0
  14. package/dist/BVPlatformButton.vue.d.ts +17 -0
  15. package/dist/bojuvue.css +2 -0
  16. package/dist/bojuvue.js +174 -0
  17. package/dist/index.d.ts +10 -0
  18. package/dist/moreButtonMenu.d.ts +9 -0
  19. package/dist/moreButtonMenu.test.d.ts +1 -0
  20. package/dist/platform.d.ts +22 -0
  21. package/dist/platform.test.d.ts +1 -0
  22. package/dist/url.d.ts +1 -0
  23. package/dist/useManifestFetch.d.ts +53 -0
  24. package/dist/useMoreButtonMenu-BdAgqGZv.js +194 -0
  25. package/dist/useMoreButtonMenu.d.ts +16 -0
  26. package/dist/vitepress/BVButton.test.d.ts +1 -0
  27. package/dist/vitepress/BVButton.vue.d.ts +12 -0
  28. package/dist/vitepress/BVIconButton.test.d.ts +1 -0
  29. package/dist/vitepress/BVIconButton.vue.d.ts +17 -0
  30. package/dist/vitepress/BVMoreButton.test.d.ts +1 -0
  31. package/dist/vitepress/BVMoreButton.vue.d.ts +20 -0
  32. package/dist/vitepress/BVPlatformButton.test.d.ts +1 -0
  33. package/dist/vitepress/BVPlatformButton.vue.d.ts +15 -0
  34. package/dist/vitepress.d.ts +10 -0
  35. package/dist/vitepress.js +223 -0
  36. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ export type BVPlatformId = 'windows' | 'macos' | 'linux' | 'android' | 'ios' | 'chromeos';
2
+ export interface BVPlatformEntry {
3
+ href: string;
4
+ label?: string;
5
+ }
6
+ export type BVPlatformManifest = Partial<Record<BVPlatformId, BVPlatformEntry>>;
7
+ export interface NavigatorLike {
8
+ userAgent: string;
9
+ platform: string;
10
+ maxTouchPoints: number;
11
+ }
12
+ export declare function detectPlatform(nav: NavigatorLike | undefined): BVPlatformId | null;
13
+ export declare const defaultLabels: Record<BVPlatformId, string>;
14
+ export declare function resolveManifestUrl(base: string, manifestUrl: string): string;
15
+ export interface ResolveDownloadOptions {
16
+ fallbackHref?: string;
17
+ fallbackLabel?: string;
18
+ }
19
+ export declare function resolveDownload(platform: BVPlatformId | null, manifest: BVPlatformManifest | null, options?: ResolveDownloadOptions): {
20
+ href: string;
21
+ label: string;
22
+ } | null;
@@ -0,0 +1 @@
1
+ export {};
package/dist/url.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function isExternalUrl(href: string): boolean;
@@ -0,0 +1,53 @@
1
+ export declare function useManifestFetch(getUrl: () => string): {
2
+ manifest: import('vue').Ref<{
3
+ windows?: {
4
+ href: string;
5
+ label?: string | undefined;
6
+ } | undefined;
7
+ macos?: {
8
+ href: string;
9
+ label?: string | undefined;
10
+ } | undefined;
11
+ linux?: {
12
+ href: string;
13
+ label?: string | undefined;
14
+ } | undefined;
15
+ android?: {
16
+ href: string;
17
+ label?: string | undefined;
18
+ } | undefined;
19
+ ios?: {
20
+ href: string;
21
+ label?: string | undefined;
22
+ } | undefined;
23
+ chromeos?: {
24
+ href: string;
25
+ label?: string | undefined;
26
+ } | undefined;
27
+ } | null, Partial<Record<import('./platform').BVPlatformId, import('./platform').BVPlatformEntry>> | {
28
+ windows?: {
29
+ href: string;
30
+ label?: string | undefined;
31
+ } | undefined;
32
+ macos?: {
33
+ href: string;
34
+ label?: string | undefined;
35
+ } | undefined;
36
+ linux?: {
37
+ href: string;
38
+ label?: string | undefined;
39
+ } | undefined;
40
+ android?: {
41
+ href: string;
42
+ label?: string | undefined;
43
+ } | undefined;
44
+ ios?: {
45
+ href: string;
46
+ label?: string | undefined;
47
+ } | undefined;
48
+ chromeos?: {
49
+ href: string;
50
+ label?: string | undefined;
51
+ } | undefined;
52
+ } | null>;
53
+ };
@@ -0,0 +1,194 @@
1
+ import { computed as e, createBlock as t, createTextVNode as n, defineComponent as r, nextTick as i, normalizeClass as a, onBeforeUnmount as o, onBeforeUpdate as s, onMounted as c, onUnmounted as l, openBlock as u, ref as d, resolveDynamicComponent as f, toDisplayString as p, watch as m, withCtx as h } from "vue";
2
+ //#region src/url.ts
3
+ var g = /^(?:[a-z]+:|\/\/)/i;
4
+ function _(e) {
5
+ return g.test(e);
6
+ }
7
+ //#endregion
8
+ //#region src/BVButton.vue?vue&type=script&setup=true&lang.ts
9
+ var v = /*@__PURE__*/ r({
10
+ __name: "BVButton",
11
+ props: {
12
+ text: {},
13
+ href: {},
14
+ target: {},
15
+ rel: {},
16
+ size: { default: "medium" },
17
+ theme: { default: "brand" },
18
+ tag: {}
19
+ },
20
+ setup(r) {
21
+ let i = r, o = e(() => i.tag || (i.href ? "a" : "button")), s = e(() => !!i.href && _(i.href)), c = e(() => i.target ?? (s.value ? "_blank" : void 0)), l = e(() => i.rel ?? (s.value ? "noreferrer" : void 0));
22
+ return (e, i) => (u(), t(f(o.value), {
23
+ class: a(["bv-button", [r.size, r.theme]]),
24
+ href: r.href,
25
+ target: c.value,
26
+ rel: l.value
27
+ }, {
28
+ default: h(() => [n(p(r.text), 1)]),
29
+ _: 1
30
+ }, 8, [
31
+ "class",
32
+ "href",
33
+ "target",
34
+ "rel"
35
+ ]));
36
+ }
37
+ }), y = (e, t) => {
38
+ let n = e.__vccOpts || e;
39
+ for (let [e, r] of t) n[e] = r;
40
+ return n;
41
+ }, b = /*#__PURE__*/ y(v, [["__scopeId", "data-v-8e3f769d"]]);
42
+ //#endregion
43
+ //#region src/platform.ts
44
+ function x(e) {
45
+ if (!e) return null;
46
+ let t = e.userAgent, n = e.platform || "", r = n === "MacIntel" && e.maxTouchPoints > 1;
47
+ return /iPhone|iPad|iPod/i.test(t) || r ? "ios" : /Android/i.test(t) ? "android" : /CrOS/i.test(t) ? "chromeos" : /Win/i.test(n) || /Windows NT/i.test(t) ? "windows" : /Mac/i.test(n) || /Macintosh/i.test(t) ? "macos" : /Linux/i.test(n) || /X11|Linux/i.test(t) ? "linux" : null;
48
+ }
49
+ var S = {
50
+ windows: "Download for Windows",
51
+ macos: "Download for macOS",
52
+ linux: "Download for Linux",
53
+ android: "Get for Android",
54
+ ios: "Get for iOS",
55
+ chromeos: "Get for ChromeOS"
56
+ }, C = /^https?:\/\//i;
57
+ function w(e, t) {
58
+ return C.test(t) ? t : `${e}${t}`;
59
+ }
60
+ function T(e, t, n = {}) {
61
+ if (e && t) {
62
+ let n = e === "chromeos" ? t.chromeos ?? t.android : t[e];
63
+ if (n) return {
64
+ href: n.href,
65
+ label: n.label ?? S[e]
66
+ };
67
+ }
68
+ return n.fallbackHref ? {
69
+ href: n.fallbackHref,
70
+ label: n.fallbackLabel ?? "View Downloads"
71
+ } : null;
72
+ }
73
+ //#endregion
74
+ //#region src/useManifestFetch.ts
75
+ function E(e) {
76
+ let t = d(null), n = null;
77
+ async function r() {
78
+ n?.abort();
79
+ let r = new AbortController();
80
+ n = r;
81
+ try {
82
+ let n = await fetch(e(), { signal: r.signal });
83
+ t.value = n.ok ? await n.json() : null;
84
+ } catch {
85
+ if (r.signal.aborted) return;
86
+ t.value = null;
87
+ }
88
+ }
89
+ return c(r), m(e, r), l(() => n?.abort()), { manifest: t };
90
+ }
91
+ //#endregion
92
+ //#region src/moreButtonMenu.ts
93
+ function D({ triggerLeft: e, triggerRight: t, panelWidth: n, viewportWidth: r }) {
94
+ let i = e;
95
+ if (i + n <= r) return i;
96
+ let a = t - n;
97
+ return a >= 0 ? a : Math.max(0, r - n);
98
+ }
99
+ function O(e, t, n) {
100
+ if (n <= 0) return -1;
101
+ switch (e) {
102
+ case "Home": return 0;
103
+ case "End": return n - 1;
104
+ case "ArrowDown": return t === -1 ? 0 : (t + 1) % n;
105
+ case "ArrowUp": return t === -1 ? n - 1 : (t - 1 + n) % n;
106
+ }
107
+ }
108
+ //#endregion
109
+ //#region src/useMoreButtonMenu.ts
110
+ function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
111
+ let a = d(!1), c = d(0), l = d(0);
112
+ function u() {
113
+ return (n.value?.$el)?.querySelector("a, button") ?? null;
114
+ }
115
+ let f = [];
116
+ s(() => {
117
+ f = [];
118
+ });
119
+ function p(e, t) {
120
+ f[t] = e ?? null;
121
+ }
122
+ function h() {
123
+ return typeof document > "u" ? -1 : f.findIndex((e) => e === document.activeElement);
124
+ }
125
+ function g(e) {
126
+ f[e]?.focus();
127
+ }
128
+ function _() {
129
+ if (typeof document > "u") return 1;
130
+ let e = parseFloat(getComputedStyle(document.documentElement).zoom);
131
+ return Number.isFinite(e) && e > 0 ? e : 1;
132
+ }
133
+ function v() {
134
+ let e = u(), t = r.value;
135
+ if (!e || !t || typeof window > "u") return;
136
+ let n = _(), i = e.getBoundingClientRect(), a = t.getBoundingClientRect().width / n;
137
+ c.value = D({
138
+ triggerLeft: i.left / n,
139
+ triggerRight: i.right / n,
140
+ panelWidth: a,
141
+ viewportWidth: window.innerWidth
142
+ }), l.value = i.bottom / n;
143
+ }
144
+ async function y(e = -1) {
145
+ a.value || (a.value = !0, await i(), v(), e >= 0 && g(e));
146
+ }
147
+ function b(e = !1) {
148
+ a.value && (a.value = !1, e && u()?.focus());
149
+ }
150
+ function x() {
151
+ a.value ? b() : y();
152
+ }
153
+ function S(t) {
154
+ a.value || (t.key === "ArrowDown" ? (t.preventDefault(), y(O("ArrowDown", -1, e()))) : t.key === "ArrowUp" && (t.preventDefault(), y(O("ArrowUp", -1, e()))));
155
+ }
156
+ let C = [
157
+ "ArrowDown",
158
+ "ArrowUp",
159
+ "Home",
160
+ "End"
161
+ ];
162
+ function w(t) {
163
+ if (t.key === "Escape") {
164
+ t.preventDefault(), b(!0);
165
+ return;
166
+ }
167
+ if (C.includes(t.key)) {
168
+ t.preventDefault();
169
+ let n = O(t.key, h(), e());
170
+ n >= 0 && g(n);
171
+ }
172
+ }
173
+ function T(e) {
174
+ t.value && e.target instanceof Node && !t.value.contains(e.target) && b();
175
+ }
176
+ return m(a, (e) => {
177
+ typeof window > "u" || (e ? (window.addEventListener("resize", v), window.addEventListener("scroll", v, {
178
+ capture: !0,
179
+ passive: !0
180
+ }), document.addEventListener("pointerdown", T)) : (window.removeEventListener("resize", v), window.removeEventListener("scroll", v, { capture: !0 }), document.removeEventListener("pointerdown", T)));
181
+ }), o(() => {
182
+ typeof window > "u" || (window.removeEventListener("resize", v), window.removeEventListener("scroll", v, { capture: !0 }), document.removeEventListener("pointerdown", T));
183
+ }), {
184
+ open: a,
185
+ panelLeft: c,
186
+ panelTop: l,
187
+ setItemRef: p,
188
+ toggleMenu: x,
189
+ onTriggerKeydown: S,
190
+ onMenuKeydown: w
191
+ };
192
+ }
193
+ //#endregion
194
+ export { T as a, y as c, x as i, _ as l, E as n, w as o, S as r, b as s, k as t };
@@ -0,0 +1,16 @@
1
+ import { ComponentPublicInstance, Ref } from 'vue';
2
+ export interface UseMoreButtonMenuOptions {
3
+ itemCount: () => number;
4
+ rootEl: Ref<HTMLElement | null>;
5
+ iconButtonEl: Ref<ComponentPublicInstance | null>;
6
+ panelEl: Ref<HTMLDivElement | null>;
7
+ }
8
+ export declare function useMoreButtonMenu({ itemCount, rootEl, iconButtonEl, panelEl }: UseMoreButtonMenuOptions): {
9
+ open: Ref<boolean, boolean>;
10
+ panelLeft: Ref<number, number>;
11
+ panelTop: Ref<number, number>;
12
+ setItemRef: (el: Element | ComponentPublicInstance | null, index: number) => void;
13
+ toggleMenu: () => void;
14
+ onTriggerKeydown: (event: KeyboardEvent) => void;
15
+ onMenuKeydown: (event: KeyboardEvent) => void;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ type __VLS_Props = {
2
+ text: string;
3
+ href?: string;
4
+ target?: string;
5
+ rel?: string;
6
+ size?: 'medium' | 'big';
7
+ theme?: 'brand' | 'alt' | 'sponsor';
8
+ tag?: string;
9
+ };
10
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ text?: string;
3
+ href?: string;
4
+ target?: string;
5
+ rel?: string;
6
+ size?: 'medium' | 'big';
7
+ theme?: 'brand' | 'alt' | 'sponsor';
8
+ tag?: string;
9
+ icon?: string;
10
+ label?: string;
11
+ };
12
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
13
+ size: "medium" | "big";
14
+ theme: "brand" | "alt" | "sponsor";
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ items: {
3
+ label: string;
4
+ href: string;
5
+ icon?: string;
6
+ target?: string;
7
+ rel?: string;
8
+ }[];
9
+ icon?: string;
10
+ text?: string;
11
+ label?: string;
12
+ size?: 'medium' | 'big';
13
+ theme?: 'brand' | 'alt' | 'sponsor';
14
+ };
15
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ text: string;
17
+ label: string;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ type __VLS_Props = {
2
+ manifestUrl?: string;
3
+ fallbackHref?: string;
4
+ fallbackLabel?: string;
5
+ size?: 'medium' | 'big';
6
+ theme?: 'brand' | 'alt' | 'sponsor';
7
+ target?: string;
8
+ rel?: string;
9
+ icon?: string;
10
+ };
11
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ manifestUrl: string;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,10 @@
1
+ export { detectPlatform, resolveDownload, resolveManifestUrl, defaultLabels } from './platform';
2
+ export type { BVPlatformManifest, BVPlatformEntry, BVPlatformId } from './platform';
3
+ export type { BVPlatformButtonProps } from './BVPlatformButton.types';
4
+ export { default as BVPlatformButton } from './vitepress/BVPlatformButton.vue';
5
+ export type { BVButtonProps } from './BVButton.types';
6
+ export { default as BVButton } from './vitepress/BVButton.vue';
7
+ export type { BVIconButtonProps } from './BVIconButton.types';
8
+ export { default as BVIconButton } from './vitepress/BVIconButton.vue';
9
+ export type { BVMoreButtonItem, BVMoreButtonProps } from './BVMoreButton.types';
10
+ export { default as BVMoreButton } from './vitepress/BVMoreButton.vue';
@@ -0,0 +1,223 @@
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./useMoreButtonMenu-BdAgqGZv.js";
2
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createTextVNode as m, createVNode as h, defineComponent as g, mergeProps as _, normalizeClass as v, normalizeStyle as y, onMounted as b, openBlock as x, ref as S, renderList as C, toDisplayString as w, unref as T } from "vue";
3
+ import { useData as E, withBase as D } from "vitepress";
4
+ import { VPButton as O } from "vitepress/theme";
5
+ //#endregion
6
+ //#region src/vitepress/BVButton.vue
7
+ var k = /*#__PURE__*/ t(/* @__PURE__ */ g({
8
+ __name: "BVButton",
9
+ props: {
10
+ text: {},
11
+ href: {},
12
+ target: {},
13
+ rel: {},
14
+ size: {},
15
+ theme: {},
16
+ tag: {}
17
+ },
18
+ setup(e) {
19
+ return (t, n) => (x(), d(T(O), {
20
+ tag: e.tag,
21
+ text: e.text,
22
+ href: e.href,
23
+ target: e.target,
24
+ rel: e.rel,
25
+ size: e.size,
26
+ theme: e.theme
27
+ }, null, 8, [
28
+ "tag",
29
+ "text",
30
+ "href",
31
+ "target",
32
+ "rel",
33
+ "size",
34
+ "theme"
35
+ ]));
36
+ }
37
+ }), [["__scopeId", "data-v-7730de16"]]), A = ["innerHTML"], j = ["innerHTML"], M = /*#__PURE__*/ t(/* @__PURE__ */ g({
38
+ inheritAttrs: !1,
39
+ __name: "BVIconButton",
40
+ props: {
41
+ text: {},
42
+ href: {},
43
+ target: {},
44
+ rel: {},
45
+ size: { default: "medium" },
46
+ theme: { default: "brand" },
47
+ tag: {},
48
+ icon: {},
49
+ label: {}
50
+ },
51
+ setup(e) {
52
+ let t = e, n = u(() => !t.text);
53
+ return (t, r) => (x(), p("span", { class: v(["bv-icon-button", [e.size, {
54
+ "icon-only": n.value,
55
+ "has-icon": !!e.icon && !n.value
56
+ }]]) }, [n.value ? (x(), p(l, { key: 0 }, [h(s, _(t.$attrs, {
57
+ class: "bv-icon-button-target icon-only",
58
+ text: "",
59
+ href: e.href ? T(D)(e.href) : void 0,
60
+ target: e.target,
61
+ rel: e.rel,
62
+ size: e.size,
63
+ theme: e.theme,
64
+ tag: e.tag,
65
+ "aria-label": e.label
66
+ }), null, 16, [
67
+ "href",
68
+ "target",
69
+ "rel",
70
+ "size",
71
+ "theme",
72
+ "tag",
73
+ "aria-label"
74
+ ]), e.icon ? (x(), p("span", {
75
+ key: 0,
76
+ class: "bv-icon-button-icon",
77
+ innerHTML: e.icon
78
+ }, null, 8, A)) : f("", !0)], 64)) : (x(), p(l, { key: 1 }, [h(k, _(t.$attrs, {
79
+ class: ["bv-icon-button-target", { "has-icon": !!e.icon }],
80
+ text: e.text ?? "",
81
+ href: e.href,
82
+ target: e.target,
83
+ rel: e.rel,
84
+ size: e.size,
85
+ theme: e.theme,
86
+ tag: e.tag
87
+ }), null, 16, [
88
+ "class",
89
+ "text",
90
+ "href",
91
+ "target",
92
+ "rel",
93
+ "size",
94
+ "theme",
95
+ "tag"
96
+ ]), e.icon ? (x(), p("span", {
97
+ key: 0,
98
+ class: "bv-icon-button-icon",
99
+ innerHTML: e.icon
100
+ }, null, 8, j)) : f("", !0)], 64))], 2));
101
+ }
102
+ }), [["__scopeId", "data-v-27cc1a4c"]]), N = /* @__PURE__ */ g({
103
+ __name: "BVPlatformButton",
104
+ props: {
105
+ manifestUrl: { default: "platformButton.json" },
106
+ fallbackHref: {},
107
+ fallbackLabel: {},
108
+ size: {},
109
+ theme: {},
110
+ target: {},
111
+ rel: {},
112
+ icon: {}
113
+ },
114
+ setup(t) {
115
+ let r = t, { site: o } = E(), s = u(() => o.value.base), c = S(null), { manifest: l } = i(() => a(s.value, r.manifestUrl));
116
+ b(() => {
117
+ c.value = n(typeof navigator > "u" ? void 0 : navigator);
118
+ });
119
+ let p = u(() => e(c.value, l.value, {
120
+ fallbackHref: r.fallbackHref,
121
+ fallbackLabel: r.fallbackLabel
122
+ }));
123
+ return (e, n) => p.value ? (x(), d(M, {
124
+ key: 0,
125
+ tag: "a",
126
+ text: p.value.label,
127
+ href: p.value.href,
128
+ target: t.target,
129
+ rel: t.rel,
130
+ size: t.size,
131
+ theme: t.theme,
132
+ icon: t.icon
133
+ }, null, 8, [
134
+ "text",
135
+ "href",
136
+ "target",
137
+ "rel",
138
+ "size",
139
+ "theme",
140
+ "icon"
141
+ ])) : f("", !0);
142
+ }
143
+ }), P = [
144
+ "href",
145
+ "target",
146
+ "rel"
147
+ ], F = ["innerHTML"], I = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"currentColor\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"12\" r=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><circle cx=\"19\" cy=\"12\" r=\"2\"/></svg>", L = /*#__PURE__*/ t(/* @__PURE__ */ g({
148
+ __name: "BVMoreButton",
149
+ props: {
150
+ items: {},
151
+ icon: {},
152
+ text: { default: "More..." },
153
+ label: { default: "More options" },
154
+ size: {},
155
+ theme: {}
156
+ },
157
+ setup(e) {
158
+ let t = e, n = u(() => t.icon ?? (t.text ? null : I)), i = S(null), a = S(null), o = S(null), { open: s, panelLeft: d, panelTop: g, setItemRef: _, toggleMenu: v, onTriggerKeydown: b, onMenuKeydown: E } = c({
159
+ itemCount: () => t.items.length,
160
+ rootEl: i,
161
+ iconButtonEl: a,
162
+ panelEl: o
163
+ });
164
+ function D(e) {
165
+ return e.target ?? (r(e.href) ? "_blank" : void 0);
166
+ }
167
+ function O(e) {
168
+ return e.rel ?? (r(e.href) ? "noreferrer" : void 0);
169
+ }
170
+ return (t, r) => (x(), p("span", {
171
+ ref_key: "rootEl",
172
+ ref: i,
173
+ class: "bv-more-button"
174
+ }, [h(M, {
175
+ ref_key: "iconButtonEl",
176
+ ref: a,
177
+ text: e.text,
178
+ icon: n.value ?? void 0,
179
+ size: e.size,
180
+ theme: e.theme,
181
+ label: e.text ? void 0 : e.label,
182
+ "aria-haspopup": "menu",
183
+ "aria-expanded": T(s),
184
+ onClick: T(v),
185
+ onKeydown: T(b)
186
+ }, null, 8, [
187
+ "text",
188
+ "icon",
189
+ "size",
190
+ "theme",
191
+ "label",
192
+ "aria-expanded",
193
+ "onClick",
194
+ "onKeydown"
195
+ ]), T(s) ? (x(), p("div", {
196
+ key: 0,
197
+ ref_key: "panelEl",
198
+ ref: o,
199
+ class: "bv-more-button-panel",
200
+ role: "menu",
201
+ style: y({
202
+ left: `${T(d)}px`,
203
+ top: `${T(g)}px`
204
+ }),
205
+ onKeydown: r[0] ||= (...e) => T(E) && T(E)(...e)
206
+ }, [(x(!0), p(l, null, C(e.items, (e, t) => (x(), p("a", {
207
+ key: e.href,
208
+ ref_for: !0,
209
+ ref: (e) => T(_)(e, t),
210
+ role: "menuitem",
211
+ class: "bv-more-button-item",
212
+ href: e.href,
213
+ target: D(e),
214
+ rel: O(e)
215
+ }, [e.icon ? (x(), p("span", {
216
+ key: 0,
217
+ class: "bv-more-button-item-icon",
218
+ innerHTML: e.icon
219
+ }, null, 8, F)) : f("", !0), m(" " + w(e.label), 1)], 8, P))), 128))], 36)) : f("", !0)], 512));
220
+ }
221
+ }), [["__scopeId", "data-v-e689232f"]]);
222
+ //#endregion
223
+ export { k as BVButton, M as BVIconButton, L as BVMoreButton, N as BVPlatformButton, o as defaultLabels, n as detectPlatform, e as resolveDownload, a as resolveManifestUrl };
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "bojuvue",
3
+ "version": "0.2.1",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "Vue 3 components for VitePress — platform-aware download buttons and shared UI, built so publishing them doesn't duplicate Vue.",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ScottKirvan/BojuVue"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "main": "./dist/bojuvue.js",
15
+ "module": "./dist/bojuvue.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/bojuvue.js"
21
+ },
22
+ "./vitepress": {
23
+ "types": "./dist/vitepress.d.ts",
24
+ "import": "./dist/vitepress.js"
25
+ }
26
+ },
27
+ "scripts": {
28
+ "build": "vue-tsc -b && vite build",
29
+ "test": "vitest run"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^26.2.0",
33
+ "@vitejs/plugin-vue": "^6.0.8",
34
+ "@vue/test-utils": "^2.4.11",
35
+ "jsdom": "^29.1.1",
36
+ "typescript": "^5.9.3",
37
+ "vite": "^8.2.2",
38
+ "vite-plugin-dts": "^5.0.3",
39
+ "vitepress": "^1.6.4",
40
+ "vitest": "^4.1.11",
41
+ "vue-tsc": "^3.3.11"
42
+ },
43
+ "peerDependencies": {
44
+ "vitepress": "^1.6.4",
45
+ "vue": "^3.5.41"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "vitepress": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "keywords": [
53
+ "vue",
54
+ "vue3",
55
+ "vitepress",
56
+ "vitepress-components",
57
+ "vitepress-theme",
58
+ "component-library",
59
+ "download-button",
60
+ "platform-detection",
61
+ "typescript",
62
+ "vite"
63
+ ],
64
+ "homepage": "https://github.com/ScottKirvan/BojuVue#readme"
65
+ }