Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ It is designed to give teams the kind of component coverage, polish, accessibili
- **Accessible by default** with keyboard support, ARIA roles, focus management, and screen reader announcements
- **Themeable via design tokens** and CSS custom properties
- **Tree-shakeable ESM exports** with per-component imports
- **CDN-ready root bundles** for ES modules, UMD, and IIFE delivery
- **Built-in dark mode, i18n, and event-driven APIs**

## Component Coverage
Expand Down Expand Up @@ -62,6 +63,23 @@ import '@bquery/ui';
</bq-alert>
```

### Use from a CDN

```html
<!-- ESM -->
<script type="module">
import 'https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.js';
</script>

<!-- UMD -->
<script src="https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.umd.js"></script>

<!-- IIFE -->
<script src="https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.iife.js"></script>
```

The UMD and IIFE bundles expose the library on `window.BQueryUI`.

## Tree-Shakeable Usage

Import only the component entry points you need for the smallest bundle:
Expand Down
21 changes: 18 additions & 3 deletions docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,29 @@ bun add @bquery/ui

:::

## CDN / ESM
## CDN / ESM / UMD / IIFE

```html
::: code-group

```html [ESM]
<script type="module">
import 'https://cdn.jsdelivr.net/npm/@bquery/ui/dist/index.js';
import 'https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.js';
</script>
```

```html [UMD]
<script src="https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.umd.js"></script>
```

```html [IIFE]
<script src="https://cdn.jsdelivr.net/npm/@bquery/ui@1.1.0/dist/index.iife.js"></script>
```

:::

The UMD and IIFE bundles register all `bq-*` elements on load and expose the library on `window.BQueryUI`.
Pinning the version in CDN URLs keeps production integrations reproducible across future releases.

## TypeScript

The package ships with full TypeScript declarations. No `@types` package needed.
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "@bquery/ui",
"version": "1.0.0",
"version": "1.1.0",
"description": "Production-grade web component library for the bQuery project",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist-types/index.d.ts",
"unpkg": "./dist/index.umd.js",
"jsdelivr": "./dist/index.umd.js",
"exports": {
".": {
"import": "./dist/index.js",
Expand Down Expand Up @@ -55,8 +57,9 @@
],
"scripts": {
"dev": "vite",
"build": "npm run build:lib && npm run build:types",
"build": "npm run build:lib && npm run build:cdn && npm run build:types",
"build:lib": "vite build",
"build:cdn": "vite build --config vite.cdn.config.ts",
"build:types": "tsc --emitDeclarationOnly --outDir dist-types",
"build:docs": "vitepress build docs",
"dev:docs": "vitepress dev docs",
Expand Down
27 changes: 27 additions & 0 deletions vite.cdn.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';

export default defineConfig({
build: {
emptyOutDir: false,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'BQueryUI',
formats: ['umd', 'iife'],
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
output: {
exports: 'named',
},
},
sourcemap: true,
minify: true,
target: 'es2020',
},
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
});
Loading