bojuvue 0.3.2 → 0.4.0

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.
package/README.md CHANGED
@@ -1,280 +1,106 @@
1
- # BojuVue 보주뷰 [![starline](https://raw.githubusercontent.com/ScottKirvan/BojuVue/refs/heads/starlines/ScottKirvan/BojuVue/starline.svg)](https://github.com/qoomon/starlines)
2
- <div align="center">
1
+ # BojuVue 보주뷰 <a href="https://github.com/qoomon/starlines"><img src="https://raw.githubusercontent.com/ScottKirvan/BojuVue/refs/heads/starlines/ScottKirvan/BojuVue/starline.svg" alt="starline" /></a>
3
2
 
4
- <img src="assets/media/logo.jpg" alt="logo" width="200" height="auto" />
5
- <h1><a href="https://github.com/ScottKirvan/BojuVue">ScottKirvan/BojuVue</a></h1>
6
- <h3>Shared Vue 3 components, with VitePress-aware builds</h3>
7
-
8
-
9
- <!-- Badges -->
10
- <p>
11
- <a href="https://github.com/ScottKirvan/BojuVue/graphs/contributors">
12
- <img src="https://img.shields.io/github/contributors/ScottKirvan/BojuVue" alt="contributors" />
13
- </a>
14
- <a href="https://github.com/ScottKirvan/BojuVue/commits/main">
15
- <img src="https://img.shields.io/github/last-commit/ScottKirvan/BojuVue" alt="last update" />
16
- </a>
17
- <a href="https://github.com/ScottKirvan/BojuVue/network/members">
18
- <img src="https://img.shields.io/github/forks/ScottKirvan/BojuVue" alt="forks" />
19
- </a>
20
- <a href="https://github.com/ScottKirvan/BojuVue/stargazers">
21
- <img src="https://img.shields.io/github/stars/ScottKirvan/BojuVue" alt="stars" />
22
- </a>
23
- <a href="https://github.com/ScottKirvan/BojuVue/issues/">
24
- <img src="https://img.shields.io/github/issues/ScottKirvan/BojuVue" alt="open issues" />
25
- </a>
26
- <a href="https://github.com/ScottKirvan/BojuVue/blob/main/LICENSE.md">
27
- <img src="https://img.shields.io/github/license/ScottKirvan/BojuVue.svg" alt="license" />
28
- </a>
29
- <a href="https://discord.gg/TN6XJSNK5Y">
30
- <!--<img src="https://img.shields.io/discord/704680098577514527?style=flat-square&label=%F0%9F%92%AC%20discord&color=00ACD7">-->
31
- <img src="https://img.shields.io/discord/1052011377415438346?style=flat-square&label=discord&color=00ACD7">
32
- </a>
33
- </p>
34
-
35
- <h4>
36
- <a href="https://scottkirvan.github.io/BojuVue/">Documentation</a>
37
- <span> · </span>
38
- <a href="https://github.com/ScottKirvan/BojuVue/issues/new?template=bug_report.md">Report Bug</a>
39
- <span> · </span>
40
- <a href="https://github.com/ScottKirvan/BojuVue/issues/new?template=feature_request.md">Request Feature</a>
41
- </h4>
42
- </div>
3
+ BojuVue is a Vue 3 component library including a download button that serves each visitor the right build for their OS. Works in any Vue 3 app; VitePress-aware variants at a second import path, zero VitePress overhead in the generic build.
43
4
 
44
- **BojuVue** is a Vue 3 component library published to npm as [`bojuvue`](https://www.npmjs.com/package/bojuvue). It exists so that VitePress sites this author's homepage blog and several local documentation sites — can share one set of landing-page and UX components instead of duplicating them per repo. Update this repo, bump the version, publish, and every consuming site can pull in the update with `npm update`.
5
+ <!-- TODO: demo GIFrecord label changing across macOS, Windows, Linux save to assets/media/demo.gif -->
45
6
 
46
- Branches
47
- --------
48
- `main` is the [deployed](https://ScottKirvan.github.io/BojuVue/) branch. The repo doesn't currently contain any other historic or dev branches.
7
+ <div align="center"><a href="https://github.com/ScottKirvan/BojuVue/stargazers"><img src="https://img.shields.io/github/stars/ScottKirvan/BojuVue" alt="stars" /></a> <a href="https://github.com/ScottKirvan/BojuVue/commits/main"><img src="https://img.shields.io/github/last-commit/ScottKirvan/BojuVue" alt="last update" /></a> <a href="https://github.com/ScottKirvan/BojuVue/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/ScottKirvan/BojuVue.svg" alt="license" /></a> <a href="https://discord.gg/TN6XJSNK5Y"><img src="https://img.shields.io/discord/1052011377415438346?style=flat-square&label=discord&color=00ACD7" alt="discord" /></a></div>
49
8
 
50
- Repo Layout
51
- -----------
52
- ```
53
- BojuVue
54
- ├───.github
55
- │ ├───gitignore-templates # .gitignore templates for other stacks (not used by this repo's own Node build)
56
- │ ├───release-please # Release-Please config — automated version bumps + CHANGELOG from Conventional Commits
57
- │ └───workflows # CI (test + build), docs deploy, release, pre-release staging
58
- ├───assets
59
- │ └───media # Logo
60
- ├───docs # VitePress site — consumer-facing docs, deployed to GitHub Pages
61
- ├───notes
62
- │ ├───dev # Design specs and working notes for this repo's own contributors
63
- │ ├───CHANGELOG.md # Auto-generated by Release-Please
64
- │ ├───TODO.md
65
- │ └───VERSION.md
66
- ├───src # Library source — see Architecture below
67
- ├───CLAUDE.md # AI agent context
68
- ├───CODE_OF_CONDUCT.md # Community guidelines
69
- ├───CONTRIBUTING.md # Contribution guidelines
70
- ├───LICENSE.md # MIT License
71
- └───README.md # This file
72
- ```
73
-
74
- Issue and PR templates aren't in this repo's own `.github/` — they're inherited from
75
- the `ScottKirvan/.github` org repo via GitHub's community health file fallback.
76
-
77
- Table of Contents
78
- -----------------
79
- - [Branches](#branches)
80
- - [Repo Layout](#repo-layout)
81
- - [Features](#features)
82
- - [Architecture](#architecture)
83
- - [Installation](#installation)
84
- - [Usage](#usage)
85
- - [Adding a new component](#adding-a-new-component)
86
- - [Contributions / Contact](#contributions--contact)
87
- - [Credits](#credits)
9
+ **[See it live](https://www.scottkirvan.com/BojuVue/appendix/examples.html)** — every component rendered, not just described.
88
10
 
89
- Features
90
- --------
91
- - Vue 3 + TypeScript components, built as an ES module via Vite library mode
92
- - `vue` is a peer dependency, so consuming sites use their own Vue instance — no duplicate copies, no broken reactivity
93
- - Every component is exported from one entry point (`src/index.ts`), so consuming a new component is a one-line import change
94
- - The `docs/` VitePress site imports directly from `src/index.ts`/`src/vitepress.ts` and registers every exported component globally, so new components can be previewed live in a real VitePress site without publishing or `npm link`
95
- - Some components (currently `BVPlatformButton`) ship as **two fully independent builds behind two import paths**: a generic implementation at `bojuvue`, with zero dependency on `vitepress`, and a VitePress-specific implementation at `bojuvue/vitepress`, same component name, resolving anything VitePress-specific for you. Neither component imports or renders the other — the import path is what disambiguates them. `vitepress` is an *optional* peer dependency — installing the package alone never requires it; only importing from the `/vitepress` path does.
11
+ ## Install
96
12
 
97
- Architecture
98
- ------------
99
- The bit that shapes everything else in this repo: **the generic build must have zero
100
- dependency on `vitepress`, anywhere in its module graph.** Everything below exists to
101
- make that hold under a real bundler, not just in theory.
102
-
103
- **Two entry points, two physical files.** `vite.config.ts` builds library mode with two
104
- separate entries — `src/index.ts` → `dist/bojuvue.js` (published as `.`) and
105
- `src/vitepress.ts` → `dist/vitepress.js` (published as `./vitepress`). `src/vitepress.ts`
106
- re-exports everything `src/index.ts` has, plus its own VitePress-specific component
107
- implementations, under the same names. This has to be two genuinely separate output
108
- files, not two exports of one bundle — if both compiled into a single file, importing
109
- only the generic path would still execute a top-level `import 'vitepress'` somewhere in
110
- it. Verify this invariant after touching anything under `src/` by building and grepping
111
- the output:
112
13
  ```sh
113
- npm run build
114
- grep -r vitepress dist/bojuvue.js # should print nothing
115
- ```
116
-
117
- **Two independent implementations per VitePress-aware component.** A component that
118
- needs anything VitePress-specific (site data, the router, VitePress's own `VPButton`)
119
- doesn't take a runtime "VitePress mode" flag — it gets two fully independent
120
- implementations sharing one exported name, disambiguated by import path:
121
- `src/ComponentName.vue` (plain props, no `vitepress` import, exported from
122
- `src/index.ts`) and `src/vitepress/ComponentName.vue` (calls whatever VitePress
123
- composables it needs itself, exported from `src/vitepress.ts`). Neither imports or
124
- renders the other. `BVPlatformButton` is the worked example — see
125
- `src/BVPlatformButton.vue` and `src/vitepress/BVPlatformButton.vue`. Logic genuinely
126
- shared between the two (e.g. manifest-fetch orchestration) lives in a plain utility
127
- module both call independently — see `src/useManifestFetch.ts` — not in one component
128
- owning the other's rendering.
129
-
130
- **Prop types stay inline in `defineProps<T>()`.** `@vue/compiler-sfc` resolving a
131
- `defineProps<T>()` type imported from another module needs the `typescript` package
132
- loadable from wherever the `.vue` file is compiled — which breaks under `docs/`'s
133
- cross-directory source build (next point) whenever the repo root's `node_modules` isn't
134
- present. Keep the type written out inline in the macro itself. A type used only for a
135
- public, non-macro export (`BVPlatformButtonProps` in `src/BVPlatformButton.types.ts`,
136
- for instance) is fine to keep in its own file — the constraint is specifically about the
137
- `defineProps<T>()` type position.
138
-
139
- **Real logic lives outside the `.vue` file.** Components with real logic — detection,
140
- data-shaping, anything beyond pure rendering — extract that logic into a plain `.ts`
141
- module (`src/platform.ts` next to `BVPlatformButton.vue`) rather than keeping it inline
142
- in `<script setup>`. Much easier to unit test a plain function than to mount a component
143
- or mock Vue-specific APIs to exercise the same branch.
144
-
145
- **`docs/` previews live source, not the published package.** `docs/` is a separate,
146
- independently-installed VitePress project. `docs/.vitepress/theme/index.ts` imports
147
- directly from `../../../src/vitepress` — this repo's own VitePress-entry *source* — and
148
- registers every export globally, so a new component shows up in a real VitePress site
149
- the moment you write it (`npm run docs:dev`), no publish or `npm link` needed. That
150
- import crosses a directory boundary `docs/`'s own dependency resolution doesn't know
151
- about: files under repo-root `src/` still `import 'vue'`/`import 'vitepress'`
152
- themselves, which would otherwise resolve relative to `src/`'s own location. A scoped
153
- Vite plugin in `docs/.vitepress/config.mts` fixes this by redirecting any such import,
154
- when the importing file is physically under repo-root `src/`, through Vite's normal
155
- resolver as if it came from inside `docs/` instead. Verify a change here by temporarily
156
- renaming the repo root's `node_modules` out of the way and confirming `npm run
157
- docs:build` (from `docs/`) still succeeds — `docs/`'s deploy job never installs the repo
158
- root's dependencies, so this has to work without them.
159
-
160
- **Typechecking and build.** `npm run build` runs `vue-tsc -b` (typecheck, via composite
161
- TypeScript project references) then `vite build` (emits `dist/`). There's no separate
162
- typecheck-only script — `vue-tsc -b --noEmit` isn't valid with composite project
163
- references, so `build` is the only way to typecheck the library.
164
-
165
- Installation
166
- ------------
167
- ```
168
14
  npm install bojuvue
169
15
  ```
170
16
 
171
- Usage
172
- -----
173
- Register components however you already register components in your app:
17
+ ## Usage
174
18
 
175
- ```ts
176
- // main.ts (or wherever you create your Vue app)
177
- import { createApp } from 'vue'
178
- import { BVPlatformButton, SomeComponent } from 'bojuvue'
179
- import App from './App.vue'
19
+ ```vue
20
+ <script setup>
21
+ import { BVPlatformButton } from 'bojuvue'
22
+ </script>
180
23
 
181
- const app = createApp(App)
182
- app.component('BVPlatformButton', BVPlatformButton)
183
- app.component('SomeComponent', SomeComponent)
184
- app.mount('#app')
24
+ <template>
25
+ <BVPlatformButton
26
+ manifest-url="/platformButton.json"
27
+ fallback-href="https://github.com/you/app/releases"
28
+ />
29
+ </template>
185
30
  ```
186
31
 
187
- Building a VitePress site? Register the same way from `enhanceApp` in
188
- `.vitepress/theme/index.ts` instead of `main.ts`, and prefer importing from
189
- `bojuvue/vitepress` for any component with a VitePress-aware build (see
190
- Features above):
32
+ Works as-is in any Vue 3 app. Building a VitePress site instead? Swap the import for
33
+ `bojuvue/vitepress` to get real `VPButton` theme styling, and register it once so every
34
+ `.md` page can use it with no per-page import:
191
35
 
192
36
  ```ts
37
+ // .vitepress/theme/index.ts
193
38
  import DefaultTheme from 'vitepress/theme'
194
- import { BVPlatformButton } from 'bojuvue/vitepress'
195
- import { SomeComponent } from 'bojuvue'
39
+ import * as BojuVue from 'bojuvue/vitepress'
196
40
 
197
41
  export default {
198
42
  extends: DefaultTheme,
199
43
  enhanceApp({ app }) {
200
- app.component('BVPlatformButton', BVPlatformButton)
201
- app.component('SomeComponent', SomeComponent)
44
+ for (const [name, component] of Object.entries(BojuVue)) {
45
+ app.component(name, component)
46
+ }
202
47
  },
203
48
  }
204
49
  ```
205
50
 
206
- Then use it in any `.md` page. Update later with `npm update`.
51
+ Then in any .md page, no import needed:
207
52
 
208
- See the **[component reference](https://scottkirvan.github.io/BojuVue/components/)**
209
- for every available component's props and a usage example — including, per component,
210
- which import path(s) it's available from.
53
+ ```md
54
+ <BVPlatformButton manifest-url="platformButton.json" />
55
+ ```
211
56
 
212
- Adding a new component
213
- -----------------------
214
- Read [Architecture](#architecture) first if you haven't — the steps below assume you
215
- know why some components have two implementations and why prop types stay inline.
57
+ Your manifest (`public/platformButton.json`) — put one entry under `platforms` for each
58
+ platform you ship for:
59
+
60
+ ```json
61
+ {
62
+ "platforms": {
63
+ "windows": { "href": "https://example.com/app.msi" },
64
+ "macos": { "href": "https://example.com/app.dmg" },
65
+ "linux": { "href": "https://example.com/app.tar.gz" }
66
+ }
67
+ }
68
+ ```
216
69
 
217
- **A component with no VitePress-specific needs:**
70
+ **[Documentation](https://scottkirvan.github.io/BojuVue/)** -- props reference, live demos, full setup guide, every component.
218
71
 
219
- 1. Write the `.vue` file under `src/` (e.g. `src/YourComponent.vue`) — standard SFC:
220
- `<script setup lang="ts">` for props/logic, `<template>` for markup, `<style
221
- scoped>` for CSS scoped to that component alone.
222
- 2. Make configurable text/behavior actual props, not hardcoded strings —
223
- `defineProps<{...}>()` with `withDefaults(...)` for sensible fallbacks. Keep the prop
224
- type written inline in the macro.
225
- 3. Extract any real logic (detection, data-shaping) into a plain `.ts` module next to
226
- the component, and write unit tests for it (see `src/platform.ts` /
227
- `src/platform.test.ts`).
228
- 4. Add one line to `src/index.ts`: `export { default as YourComponent } from
229
- './YourComponent.vue'`.
230
- 5. Preview it: `npm run docs:dev` (from `docs/`), then use `<YourComponent />` anywhere
231
- in a `.md` file — it's registered globally in this repo's own `docs/` theme, so no
232
- import is needed there.
233
- 6. Add a reference page at `docs/components/your-component.md` (props table + usage
234
- example — copy the structure of an existing page) and link it from
235
- `docs/components/index.md` and the sidebar in `docs/.vitepress/config.mts`.
236
- 7. `npm run build` at the repo root to confirm the library itself still builds clean,
237
- and `npm test` to run the unit suite.
72
+ What's in the package
73
+ ---------------------
238
74
 
239
- **A component that needs something VitePress-specific** (worked example:
240
- `BVPlatformButton`) gets two fully independent implementations instead of one file:
75
+ Published to npm as [`bojuvue`](https://www.npmjs.com/package/bojuvue). It exists so that VitePress sites can share one set of landing-page components instead of duplicating them per repo. This repo gets updated, the package gets published, and every consuming site picks it up with `npm update`.
241
76
 
242
- 1. The framework-agnostic logic and markup goes in `src/YourComponent.vue` plain
243
- props in (including anything the VitePress-specific implementation would otherwise
244
- read from a VitePress composable e.g. a `base` prop standing in for
245
- `useData().site.value.base`, resolved by that other implementation itself, not read
246
- directly here). No `vitepress` import anywhere in this file.
247
- 2. `src/vitepress/YourComponent.vue` calls whatever VitePress composables it needs
248
- itself and implements its own rendering. It does not import or render
249
- `src/YourComponent.vue`. Any logic genuinely shared between the two (like fetch
250
- orchestration — see `useManifestFetch`) lives in a plain utility module both call
251
- independently, not in one component owning the other's rendering.
252
- 3. `src/index.ts` exports the generic implementation; `src/vitepress.ts` re-exports
253
- everything `src/index.ts` has, plus exports the VitePress-specific implementation —
254
- both under the same name, `YourComponent`. The import path is what disambiguates
255
- them.
256
- 4. Preview via `docs/.vitepress/theme/index.ts`, which registers from `src/vitepress.ts`
257
- (the superset) — this exercises both the VitePress-specific implementation and
258
- everything re-exported from the generic one.
259
- 5. `npm run build` must still produce two separate physical files (check
260
- `vite.config.ts`'s `build.lib.entry`), and the generic build's output file must
261
- contain zero reference to `vitepress` — grep for it directly after any build that
262
- touches this component (see [Architecture](#architecture)).
263
- 6. Add the reference page and sidebar entry as in step 6 above, and document both import
264
- paths on that page — see `docs/components/platform-button.md` for the pattern.
77
+ - **BVPlatformButton** — reads the visitor's OS from the browser, fetches a manifest you host, and links to the right download. No manifest entry for a platform? The button hides itself, or shows a fallback link if you provide one. VitePress sites get real `VPButton` styling from `bojuvue/vitepress`; plain Vue 3 apps use the same prop surface without any VitePress dependency.
78
+ - **BVMoreButton** an overflow dropdown for the secondary links every project needs (repo, report a bug, request a feature) without letting them outweigh your primary call-to-action. Visible-text mode ("More...") or a compact icon-only "⋯" button; VitePress sites get real `VPButton` styling for free via `bojuvue/vitepress`, same as `BVPlatformButton`.
79
+ <!-- TODO: demo GIF/screenshotthe dropdown open, showing the GitHub/bug/feature links → save to assets/media/more-button-demo.gif -->
80
+ - **BVButton** VitePress's own `VPButton` prop shape, usable in any Vue 3 app. The primitive the others build on.
81
+ - **BVIconButton** `BVButton` with an optional inline SVG icon in addition to, or in place of, the button text.
265
82
 
266
- **Before opening a pull request:** `npm test` and `npm run build` both pass; tests exist
267
- for anything with real logic; every failure and edge path has a deliberate, documented
268
- user-visible behavior; the reference page documents every prop's default and whether
269
- it's required, and calls out anything deliberately not supported, with why. See
270
- `CLAUDE.md` for the full set of engineering conventions this project holds
271
- contributions to.
83
+ Every component exports from `bojuvue`. Components with VitePress-specific builds are located at `bojuvue/vitepress` — same exported name, resolves VitePress-specific values and renders through real VitePress components. `vitepress` is an optional peer dependency: installing the package alone never requires it.
84
+
85
+ Why not a monorepo workspace?
86
+ -----------------------------
87
+
88
+ npm/yarn/pnpm workspaces already solve "share a component across projects" for free, and if every consuming site lived in this repo, that would be the right answer — skip this package entirely.
89
+
90
+ It only holds while that's true. The moment a consuming site is a separate repo — a different site, a client's project, a repo you don't control — a workspace can't reach across that boundary. There's no shared `package.json` to add an entry to, no symlinked `node_modules` to rely on. Publishing is what still works: a versioned package on the registry that any repo, anywhere, can `npm install` and `npm update`.
91
+
92
+ That's the actual reason this exists — not "components in a folder," but components that survive the boundary between repos.
93
+
94
+ Contributing
95
+ ------------
96
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, the branch and commit
97
+ conventions, and step-by-step instructions for adding a new component.
272
98
 
273
99
  Contributions / Contact
274
100
  -----------------------
275
101
  - Please [file an issue](https://github.com/ScottKirvan/BojuVue/issues/new), or [grab a fork](https://github.com/ScottKirvan/BojuVue/fork), hack away, and submit a [pull request](https://github.com/ScottKirvan/BojuVue/pulls).
276
102
  - Contact me at [linkedin.com/in/scottkirvan/](https://www.linkedin.com/in/scottkirvan/)
277
- - You can also contact me at my [discord](https://discord.gg/TN6XJSNK5Y) server, I'm cptvideo.
103
+ - You can also find me on [Discord](https://discord.gg/TN6XJSNK5Y) I'm cptvideo.
278
104
 
279
105
  Credits
280
106
  -------
@@ -282,6 +108,6 @@ Credits
282
108
 
283
109
  Scaffolded from [ScooterGitTemplate](https://github.com/ScottKirvan/ScooterGitTemplate).
284
110
 
285
- Project Link: [BojuVue](https://github.com/ScottKirvan/BojuVue)
286
- [CHANGELOG](notes/CHANGELOG.md)
111
+ Project Link: [BojuVue](https://github.com/ScottKirvan/BojuVue)
112
+ [CHANGELOG](notes/CHANGELOG.md)
287
113
  [TODO](notes/TODO.md)
package/dist/bojuvue.js CHANGED
@@ -1,4 +1,4 @@
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-BYpzDpLJ.js";
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-CewNc9xN.js";
2
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
3
  //#region src/BVIconButton.vue?vue&type=script&setup=true&lang.ts
4
4
  var E = ["innerHTML"], D = /*#__PURE__*/ t(/* @__PURE__ */ g({
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { default as BVIconButton } from './BVIconButton.vue';
4
4
  export type { BVIconButtonProps } from './BVIconButton.types';
5
5
  export { default as BVPlatformButton } from './BVPlatformButton.vue';
6
6
  export { detectPlatform, resolveDownload, resolveManifestUrl, defaultLabels } from './platform';
7
- export type { BVPlatformManifest, BVPlatformEntry, BVPlatformId } from './platform';
7
+ export type { BVPlatformData, BVPlatformEntry, BVPlatformId, BVPlatformManifest } from './platform';
8
8
  export type { BVPlatformButtonProps } from './BVPlatformButton.types';
9
9
  export { default as BVMoreButton } from './BVMoreButton.vue';
10
10
  export type { BVMoreButtonItem, BVMoreButtonProps } from './BVMoreButton.types';
@@ -3,7 +3,10 @@ export interface BVPlatformEntry {
3
3
  href: string;
4
4
  label?: string;
5
5
  }
6
- export type BVPlatformManifest = Partial<Record<BVPlatformId, BVPlatformEntry>>;
6
+ export type BVPlatformData = Partial<Record<BVPlatformId, BVPlatformEntry>>;
7
+ export interface BVPlatformManifest {
8
+ platforms: BVPlatformData;
9
+ }
7
10
  export interface NavigatorLike {
8
11
  userAgent: string;
9
12
  platform: string;
@@ -1,53 +1,58 @@
1
+ import { BVPlatformManifest } from './platform';
1
2
  export declare function useManifestFetch(getUrl: () => string): {
2
3
  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;
4
+ platforms: {
5
+ windows?: {
6
+ href: string;
7
+ label?: string | undefined;
8
+ } | undefined;
9
+ macos?: {
10
+ href: string;
11
+ label?: string | undefined;
12
+ } | undefined;
13
+ linux?: {
14
+ href: string;
15
+ label?: string | undefined;
16
+ } | undefined;
17
+ android?: {
18
+ href: string;
19
+ label?: string | undefined;
20
+ } | undefined;
21
+ ios?: {
22
+ href: string;
23
+ label?: string | undefined;
24
+ } | undefined;
25
+ chromeos?: {
26
+ href: string;
27
+ label?: string | undefined;
28
+ } | undefined;
29
+ };
30
+ } | null, BVPlatformManifest | {
31
+ platforms: {
32
+ windows?: {
33
+ href: string;
34
+ label?: string | undefined;
35
+ } | undefined;
36
+ macos?: {
37
+ href: string;
38
+ label?: string | undefined;
39
+ } | undefined;
40
+ linux?: {
41
+ href: string;
42
+ label?: string | undefined;
43
+ } | undefined;
44
+ android?: {
45
+ href: string;
46
+ label?: string | undefined;
47
+ } | undefined;
48
+ ios?: {
49
+ href: string;
50
+ label?: string | undefined;
51
+ } | undefined;
52
+ chromeos?: {
53
+ href: string;
54
+ label?: string | undefined;
55
+ } | undefined;
56
+ };
52
57
  } | null>;
53
58
  };
@@ -57,12 +57,15 @@ var S = {
57
57
  function w(e, t) {
58
58
  return C.test(t) ? t : `${e}${t}`;
59
59
  }
60
- function T(e, t, n = {}) {
60
+ function T(e) {
61
+ return typeof e == "object" && !!e;
62
+ }
63
+ function E(e, t, n = {}) {
61
64
  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]
65
+ let n = T(t.platforms) ? t.platforms : void 0, r = n && (e === "chromeos" ? n.chromeos ?? n.android : n[e]);
66
+ if (r) return {
67
+ href: r.href,
68
+ label: r.label ?? S[e]
66
69
  };
67
70
  }
68
71
  return n.fallbackHref ? {
@@ -72,7 +75,7 @@ function T(e, t, n = {}) {
72
75
  }
73
76
  //#endregion
74
77
  //#region src/useManifestFetch.ts
75
- function E(e) {
78
+ function D(e) {
76
79
  let t = d(null), n = null;
77
80
  async function r() {
78
81
  n?.abort();
@@ -90,13 +93,13 @@ function E(e) {
90
93
  }
91
94
  //#endregion
92
95
  //#region src/moreButtonMenu.ts
93
- function D({ triggerLeft: e, triggerRight: t, panelWidth: n, viewportWidth: r }) {
96
+ function O({ triggerLeft: e, triggerRight: t, panelWidth: n, viewportWidth: r }) {
94
97
  let i = e;
95
98
  if (i + n <= r) return i;
96
99
  let a = t - n;
97
100
  return a >= 0 ? a : Math.max(0, r - n);
98
101
  }
99
- function O(e, t, n) {
102
+ function k(e, t, n) {
100
103
  if (n <= 0) return -1;
101
104
  switch (e) {
102
105
  case "Home": return 0;
@@ -107,7 +110,7 @@ function O(e, t, n) {
107
110
  }
108
111
  //#endregion
109
112
  //#region src/useMoreButtonMenu.ts
110
- function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
113
+ function A({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
111
114
  let a = d(!1), c = d(0), l = d(0);
112
115
  function u() {
113
116
  return (n.value?.$el)?.querySelector("a, button") ?? null;
@@ -134,7 +137,7 @@ function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
134
137
  let e = u(), t = r.value;
135
138
  if (!e || !t || typeof window > "u") return;
136
139
  let n = _(), i = e.getBoundingClientRect(), a = t.getBoundingClientRect().width / n;
137
- c.value = D({
140
+ c.value = O({
138
141
  triggerLeft: i.left / n,
139
142
  triggerRight: i.right / n,
140
143
  panelWidth: a,
@@ -151,7 +154,7 @@ function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
151
154
  a.value ? b() : y();
152
155
  }
153
156
  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()))));
157
+ a.value || (t.key === "ArrowDown" ? (t.preventDefault(), y(k("ArrowDown", -1, e()))) : t.key === "ArrowUp" && (t.preventDefault(), y(k("ArrowUp", -1, e()))));
155
158
  }
156
159
  let C = [
157
160
  "ArrowDown",
@@ -166,7 +169,7 @@ function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
166
169
  }
167
170
  if (C.includes(t.key)) {
168
171
  t.preventDefault();
169
- let n = O(t.key, h(), e());
172
+ let n = k(t.key, h(), e());
170
173
  n >= 0 && g(n);
171
174
  }
172
175
  }
@@ -191,4 +194,4 @@ function k({ itemCount: e, rootEl: t, iconButtonEl: n, panelEl: r }) {
191
194
  };
192
195
  }
193
196
  //#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 };
197
+ export { E as a, y as c, x as i, _ as l, D as n, w as o, S as r, b as s, A as t };
@@ -1,5 +1,5 @@
1
1
  export { detectPlatform, resolveDownload, resolveManifestUrl, defaultLabels } from './platform';
2
- export type { BVPlatformManifest, BVPlatformEntry, BVPlatformId } from './platform';
2
+ export type { BVPlatformData, BVPlatformEntry, BVPlatformId, BVPlatformManifest } from './platform';
3
3
  export type { BVPlatformButtonProps } from './BVPlatformButton.types';
4
4
  export { default as BVPlatformButton } from './vitepress/BVPlatformButton.vue';
5
5
  export type { BVButtonProps } from './BVButton.types';
package/dist/vitepress.js CHANGED
@@ -1,4 +1,4 @@
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-BYpzDpLJ.js";
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-CewNc9xN.js";
2
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
3
  import { useData as E, withBase as D } from "vitepress";
4
4
  import { VPButton as O } from "vitepress/theme";
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "bojuvue",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
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.",
6
+ "description": "Vue 3 components including a download button that serves each visitor the right build for their OS. Works in any Vue 3 app; VitePress-aware variants included.",
7
+ "homepage": "https://www.scottkirvan.com/BojuVue/",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/ScottKirvan/BojuVue.git"
10
11
  },
12
+ "bugs": {
13
+ "url": "https://github.com/ScottKirvan/BojuVue/issues"
14
+ },
11
15
  "files": [
12
16
  "dist"
13
17
  ],
@@ -49,6 +53,16 @@
49
53
  "optional": true
50
54
  }
51
55
  },
56
+ "funding": [
57
+ {
58
+ "type": "github",
59
+ "url": "https://github.com/sponsors/ScottKirvan"
60
+ },
61
+ {
62
+ "type": "ko-fi",
63
+ "url": "https://ko-fi.com/ScottKirvan"
64
+ }
65
+ ],
52
66
  "keywords": [
53
67
  "vue",
54
68
  "vue3",
@@ -60,6 +74,5 @@
60
74
  "platform-detection",
61
75
  "typescript",
62
76
  "vite"
63
- ],
64
- "homepage": "https://github.com/ScottKirvan/BojuVue#readme"
65
- }
77
+ ]
78
+ }