diff --git a/packages/components/LICENSE b/packages/components/LICENSE new file mode 100644 index 0000000..3c399c5 --- /dev/null +++ b/packages/components/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Yunfei He + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/components/README.md b/packages/components/README.md new file mode 100644 index 0000000..91eda2d --- /dev/null +++ b/packages/components/README.md @@ -0,0 +1,41 @@ +# @vue-tui/components + +High-level Vue components for [vue-tui](https://github.com/vuejs-ai/vue-tui), composed from +`@vue-tui/runtime` primitives. + +> Early days — the component set is small and growing. Currently: `Spinner`. + +## Install + +```sh +npm install @vue-tui/components +# peer deps: @vue-tui/runtime, vue ^3.4 +``` + +## Spinner + +An animated loading spinner. + +```vue + + + +``` + +### Props + +| prop | type | default | description | +| ---------- | ------------------------------------- | -------- | ------------------------------------------ | +| `type` | preset name (e.g. `"dots"`, `"line"`) | `"dots"` | a built-in spinner animation | +| `frames` | `string[]` | — | custom animation frames (overrides `type`) | +| `interval` | `number` | preset's | ms between frames | +| `color` | `string` | — | chalk color for the spinner glyph | +| `label` | `string` | — | text shown next to the spinner | + +## License + +MIT diff --git a/packages/components/package.json b/packages/components/package.json index 0b40f00..f27cff0 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,22 +1,27 @@ { "name": "@vue-tui/components", - "version": "0.0.0", - "private": true, + "version": "0.1.1", "description": "High-level Vue components for vue-tui, composed from @vue-tui/runtime primitives.", "license": "MIT", "files": [ - "dist" + "dist", + "LICENSE", + "README.md" ], "type": "module", "exports": { ".": "./dist/index.mjs", "./package.json": "./package.json" }, + "publishConfig": { + "access": "public" + }, "scripts": { "build": "vp pack", "dev": "vp pack --watch", "test": "vp test", - "check:type": "vue-tsc --noEmit" + "check:type": "vue-tsc --noEmit", + "prepublishOnly": "vp run build" }, "devDependencies": { "@types/node": "^25.6.2", @@ -33,7 +38,7 @@ "vue-tsc": "catalog:" }, "peerDependencies": { - "@vue-tui/runtime": "workspace:*", + "@vue-tui/runtime": "workspace:^", "vue": "^3.4.0" } } diff --git a/packages/runtime/package.json b/packages/runtime/package.json index d8cafcc..4830b87 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@vue-tui/runtime", - "version": "0.1.0", + "version": "0.1.1", "description": "Vue 3 terminal renderer with Yoga flexbox layout, inspired by React Ink.", "keywords": [ "ansi", diff --git a/packages/vite/LICENSE b/packages/vite/LICENSE new file mode 100644 index 0000000..3c399c5 --- /dev/null +++ b/packages/vite/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Yunfei He + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/vite/README.md b/packages/vite/README.md new file mode 100644 index 0000000..e699bf6 --- /dev/null +++ b/packages/vite/README.md @@ -0,0 +1,79 @@ +# @vue-tui/vite + +Vite plugin for [vue-tui](https://github.com/vuejs-ai/vue-tui): an in-process terminal dev server +with HMR, plus a production build, for Vue apps that render to the terminal via `@vue-tui/runtime`. + +## Install + +```sh +npm install -D @vue-tui/vite +# peer deps: vite ^8, @vue-tui/runtime +``` + +## Usage + +```ts +// vite.config.ts +import { defineConfig } from "vite"; +import { vueTui } from "@vue-tui/vite"; + +export default defineConfig({ + plugins: [vueTui()], +}); +``` + +- `vite` (dev) — boots the app in-process through Vite's SSR module runner and renders it to the + terminal, with state-preserving HMR. +- `vite build` — bundles a single Node entry (`dist/main.js`). + +### Options + +```ts +vueTui({ + entry: "src/main.ts", // default; the app entry (a .ts/.tsx file, not an index.html) + vue: { + // options forwarded to @vitejs/plugin-vue + /* … */ + }, +}); +``` + +For a JSX/TSX entry, add `@vitejs/plugin-vue-jsx` alongside it and point `entry` at the `.tsx` file: + +```ts +import vueJsx from "@vitejs/plugin-vue-jsx"; + +export default defineConfig({ + plugins: [vueTui({ entry: "/src/main.tsx" }), vueJsx()], +}); +``` + +## Build output + +By default the production build **externalizes** bare dependencies (`vue`, `@vue-tui/runtime`, …) — +Node resolves them from `node_modules` at runtime. This is the right shape for a library, or an app +shipped alongside its `node_modules`. + +Distribution shape is yours to choose: to produce a **self-contained** single file (everything +bundled but Node builtins — e.g. toward a standalone binary), set your own build options in +`vite.config.ts` and the plugin yields to them: + +```ts +import { isBuiltin } from "node:module"; + +export default defineConfig({ + plugins: [vueTui()], + build: { + // Vite 8 is Rolldown-powered: the field is `rolldownOptions` (`rollupOptions` is the alias). + rolldownOptions: { + external: (id) => isBuiltin(id), // only Node builtins stay external + platform: "node", // real createRequire for any CJS dependency + output: { inlineDynamicImports: true }, // fold into one file + }, + }, +}); +``` + +## License + +MIT diff --git a/packages/vite/package.json b/packages/vite/package.json index e1c2980..f19188e 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,10 +1,12 @@ { "name": "@vue-tui/vite", - "version": "0.0.0", + "version": "0.1.1", "description": "Vite plugin for vue-tui: in-process terminal dev server with HMR + production build.", "license": "MIT", "files": [ - "dist" + "dist", + "LICENSE", + "README.md" ], "type": "module", "exports": {