bitwrench 2.0.17 → 2.0.18
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 +127 -38
- package/dist/bitwrench-bccl.cjs.js +8 -8
- package/dist/bitwrench-bccl.cjs.min.js +3 -3
- package/dist/bitwrench-bccl.esm.js +8 -8
- package/dist/bitwrench-bccl.esm.min.js +3 -3
- package/dist/bitwrench-bccl.umd.js +8 -8
- package/dist/bitwrench-bccl.umd.min.js +2 -2
- package/dist/bitwrench-code-edit.cjs.js +1 -1
- package/dist/bitwrench-code-edit.cjs.min.js +1 -1
- package/dist/bitwrench-code-edit.es5.js +1 -1
- package/dist/bitwrench-code-edit.es5.min.js +1 -1
- package/dist/bitwrench-code-edit.esm.js +1 -1
- package/dist/bitwrench-code-edit.esm.min.js +1 -1
- package/dist/bitwrench-code-edit.umd.js +1 -1
- package/dist/bitwrench-code-edit.umd.min.js +1 -1
- package/dist/bitwrench-lean.cjs.js +941 -775
- package/dist/bitwrench-lean.cjs.min.js +20 -20
- package/dist/bitwrench-lean.es5.js +1012 -961
- package/dist/bitwrench-lean.es5.min.js +18 -18
- package/dist/bitwrench-lean.esm.js +941 -775
- package/dist/bitwrench-lean.esm.min.js +20 -20
- package/dist/bitwrench-lean.umd.js +941 -775
- package/dist/bitwrench-lean.umd.min.js +20 -20
- package/dist/bitwrench-util-css.cjs.js +236 -0
- package/dist/bitwrench-util-css.cjs.min.js +22 -0
- package/dist/bitwrench-util-css.es5.js +414 -0
- package/dist/bitwrench-util-css.es5.min.js +21 -0
- package/dist/bitwrench-util-css.esm.js +230 -0
- package/dist/bitwrench-util-css.esm.min.js +21 -0
- package/dist/bitwrench-util-css.umd.js +242 -0
- package/dist/bitwrench-util-css.umd.min.js +21 -0
- package/dist/bitwrench.cjs.js +948 -782
- package/dist/bitwrench.cjs.min.js +21 -21
- package/dist/bitwrench.css +456 -132
- package/dist/bitwrench.es5.js +1024 -970
- package/dist/bitwrench.es5.min.js +19 -19
- package/dist/bitwrench.esm.js +949 -783
- package/dist/bitwrench.esm.min.js +21 -21
- package/dist/bitwrench.min.css +1 -1
- package/dist/bitwrench.umd.js +948 -782
- package/dist/bitwrench.umd.min.js +21 -21
- package/dist/builds.json +178 -90
- package/dist/bwserve.cjs.js +514 -68
- package/dist/bwserve.esm.js +513 -69
- package/dist/sri.json +44 -36
- package/package.json +3 -2
- package/readme.html +136 -49
- package/src/bitwrench-bccl.js +7 -7
- package/src/bitwrench-color-utils.js +31 -9
- package/src/bitwrench-esm-entry.js +11 -0
- package/src/bitwrench-styles.js +439 -232
- package/src/bitwrench-util-css.js +229 -0
- package/src/bitwrench.js +483 -485
- package/src/bwserve/attach.js +57 -0
- package/src/bwserve/bwclient.js +141 -0
- package/src/bwserve/bwshell.js +102 -0
- package/src/bwserve/client.js +151 -1
- package/src/bwserve/index.js +127 -28
- package/src/cli/attach.js +555 -0
- package/src/cli/convert.js +2 -5
- package/src/cli/index.js +7 -0
- package/src/cli/inject.js +1 -1
- package/src/cli/serve.js +6 -2
- package/src/generate-css.js +11 -4
- package/src/vendor/html2canvas.min.js +20 -0
- package/src/version.js +3 -3
- package/src/bwserve/shell.js +0 -106
package/README.md
CHANGED
|
@@ -6,27 +6,60 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://deftio.github.io/bitwrench/pages/)
|
|
8
8
|
|
|
9
|
-
Bitwrench
|
|
10
|
-
|
|
11
|
-
## Quick Example
|
|
9
|
+
Bitwrench builds UI from plain JavaScript objects — one format for components, styling, state, and server rendering, with no build step and zero dependencies. In bitwrench structure, styles, and state (including client/server) are rendered and managed as javascript objects.
|
|
12
10
|
|
|
13
11
|
```javascript
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
// Describe UI as a JavaScript object (a "TACO")
|
|
13
|
+
var page = {
|
|
14
|
+
t: 'div', a: { class: 'card' },
|
|
16
15
|
c: [
|
|
17
|
-
{ t: '
|
|
18
|
-
{ t: 'p', c: 'UI as native JavaScript objects.' }
|
|
16
|
+
{ t: 'h2', c: 'Hello' },
|
|
17
|
+
{ t: 'p', c: 'UI as native JavaScript objects.' },
|
|
18
|
+
bw.makeButton({ text: 'Click me', variant: 'primary', onclick: fn })
|
|
19
19
|
]
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
bw.
|
|
24
|
-
|
|
25
|
-
// Or render to an HTML string (Node.js, emails, static pages)
|
|
26
|
-
const html = bw.html(card);
|
|
22
|
+
bw.DOM('#app', page); // → live DOM
|
|
23
|
+
bw.html(page); // → HTML string (Node.js, emails, SSR)
|
|
27
24
|
```
|
|
28
25
|
|
|
29
|
-
Each object has four keys: **t** (tag), **a** (attributes), **c** (content),
|
|
26
|
+
Each object has four keys: **t** (tag), **a** (attributes), **c** (content), **o** (options for state/lifecycle). Nest them, loop them, compose them — it's just JavaScript.
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
### Why bitwrench?
|
|
31
|
+
|
|
32
|
+
**One file, everywhere.** At ~39KB gzipped with zero dependencies, bitwrench runs on anything with a browser — phones, tablets, Raspberry Pi, even ESP32 microcontrollers. The device serves a single HTML page and pushes data as JSON; bitwrench handles all rendering, styling, and state on the client. No Node.js, no build step, no internet connection required.
|
|
33
|
+
|
|
34
|
+
Structure, styling, state, and server rendering are all handled as JavaScript objects:
|
|
35
|
+
|
|
36
|
+
- **No build toolchain** — works with a `<script>` tag
|
|
37
|
+
- **50+ ready-made components** — buttons, tables, modals, forms, charts, toasts — one `make*()` call each, returns a composable TACO
|
|
38
|
+
- **CSS from JavaScript** — `bw.css()` generates stylesheets, `bw.s()` composes inline styles, `bw.loadStyles()` or `bw.makeStyles()` derives a complete theme from 2 seed colors
|
|
39
|
+
- **Reactive state** — `bw.component()` provides `.get()/.set()` with `${template}` bindings; `bw.pub()`/`bw.sub()` for cross-component messaging
|
|
40
|
+
- **Dual rendering** — same object renders to live DOM (`bw.DOM()`) or HTML string (`bw.html()`) for SSR, emails, or static sites
|
|
41
|
+
- **Server-driven UI** — push UI updates from any backend (Python, C, Rust, Go) over SSE; `client.screenshot()` captures the page back as PNG/JPEG
|
|
42
|
+
- **CLI** — `bwcli` converts Markdown, HTML, and JSON to styled standalone pages
|
|
43
|
+
- **Utilities** — color interpolation, random data, lorem ipsum, cookies, URL params, file I/O
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Coming from other Frameworks
|
|
48
|
+
|
|
49
|
+
Bitwrench uses JavaScript equivalents for most forms of front-end development. Here is a quick mapping (see the [docs](docs/README.md) and [Thinking in Bitwrench](docs/thinking-in-bitwrench.md) for more details).
|
|
50
|
+
|
|
51
|
+
| You're using | For | Bitwrench equivalent |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| React / Vue / Svelte | Components + reactivity | `{t, a, c, o}` objects + `bw.component()` |
|
|
54
|
+
| JSX / templates | Markup-in-JS | Native JS objects — no compiler |
|
|
55
|
+
| Tailwind / CSS-in-JS | Styling | `bw.css()`, `bw.s()` style composition |
|
|
56
|
+
| Sass / PostCSS | CSS generation | `bw.css()` from JS objects (supports @media, @keyframes) |
|
|
57
|
+
| ThemeProvider / CSS vars | Theming | `bw.loadStyles()` / `bw.makeStyles()` from 2 seed colors |
|
|
58
|
+
| Streamlit / Gradio | Server-driven UI | bwserve SSE — from any language (Python, Go, C, Rust) |
|
|
59
|
+
| Redux / Zustand / Pinia | State management | `bw.component()` `.get()/.set()` + `bw.pub()/sub()` |
|
|
60
|
+
| Vite / webpack / Babel | Build tooling | Not needed — open the HTML file |
|
|
61
|
+
|
|
62
|
+
See the [Framework Translation Table](docs/framework-translation-table.md) for side-by-side code comparisons across 22 operations.
|
|
30
63
|
|
|
31
64
|
## Installation
|
|
32
65
|
|
|
@@ -48,16 +81,6 @@ Or include directly in a page:
|
|
|
48
81
|
<script src="https://cdn.jsdelivr.net/npm/bitwrench/dist/bitwrench.umd.min.js"></script>
|
|
49
82
|
```
|
|
50
83
|
|
|
51
|
-
## Features
|
|
52
|
-
|
|
53
|
-
- **HTML from plain objects** — describe UI as JavaScript objects, render to live DOM with `bw.DOM()` or to HTML strings with `bw.html()` for server-side rendering, emails, and static pages
|
|
54
|
-
- **Built-in reactivity** — `bw.update()` re-renders components when state changes, `bw.patch()` updates individual elements by ID, `bw.pub()`/`bw.sub()` provides decoupled messaging between any part of the application
|
|
55
|
-
- **CSS and theme generation** — `bw.css()` generates stylesheets from objects, `bw.generateTheme()` derives a complete visual theme (buttons, alerts, badges, cards, forms, tables, dark mode) from 2-3 seed colors
|
|
56
|
-
- **45+ ready-made components** — cards, buttons, sortable tables, form inputs, modals, dropdowns, accordions, tooltips, popovers, toasts, timelines, steppers, file uploads, stat cards — each a single function call that returns a composable object
|
|
57
|
-
- **Server-driven UI (bwserve)** — push TACO rendering commands from Node.js to the browser over SSE; same protocol works from C (ESP32), Python, Rust, or any language via the `bwcli serve` pipe server
|
|
58
|
-
- **Static site CLI** — the `bwcli` command converts Markdown, HTML, and JSON files into styled, self-contained pages with theme support
|
|
59
|
-
- **Utilities** — color interpolation, random data generation, lorem ipsum, cookies, URL params, file I/O for both browser and Node.js
|
|
60
|
-
|
|
61
84
|
## Getting Started
|
|
62
85
|
|
|
63
86
|
```html
|
|
@@ -69,7 +92,7 @@ Or include directly in a page:
|
|
|
69
92
|
<body>
|
|
70
93
|
<div id="app"></div>
|
|
71
94
|
<script>
|
|
72
|
-
bw.
|
|
95
|
+
bw.loadStyles();
|
|
73
96
|
|
|
74
97
|
bw.DOM('#app', {
|
|
75
98
|
t: 'div', a: { class: 'bw-container' },
|
|
@@ -79,7 +102,11 @@ Or include directly in a page:
|
|
|
79
102
|
title: 'Welcome',
|
|
80
103
|
content: 'Built with plain JavaScript objects.'
|
|
81
104
|
}),
|
|
82
|
-
bw.makeButton({
|
|
105
|
+
bw.makeButton({
|
|
106
|
+
text: 'Click me',
|
|
107
|
+
variant: 'primary',
|
|
108
|
+
onclick: function() { alert('Hello!'); }
|
|
109
|
+
})
|
|
83
110
|
]
|
|
84
111
|
});
|
|
85
112
|
</script>
|
|
@@ -112,6 +139,8 @@ counter.set('count', 42); // DOM updates automatically
|
|
|
112
139
|
counter.reset(); // methods from o.methods are callable on the handle
|
|
113
140
|
```
|
|
114
141
|
|
|
142
|
+
> **Important: event handlers go in `a: { onclick: fn }`, not in `o.mounted`.** Handlers attached via `addEventListener` in `o.mounted` are silently lost when a component re-renders. Always use `onclick`/`onchange`/etc. inside `a:` — bitwrench re-attaches them on every render automatically.
|
|
143
|
+
|
|
115
144
|
For low-level control, you can also use `o.render` + `bw.update()` directly — see the [State Management guide](docs/state-management.md).
|
|
116
145
|
|
|
117
146
|
For communication between components, use pub/sub:
|
|
@@ -124,38 +153,62 @@ bw.sub('item-added', function(detail) {
|
|
|
124
153
|
bw.pub('item-added', { name: 'Widget' });
|
|
125
154
|
```
|
|
126
155
|
|
|
156
|
+
|
|
157
|
+
## CSS from JavaScript
|
|
158
|
+
|
|
159
|
+
`bw.css()` generates CSS from objects. `bw.s()` composes inline styles from reusable utility objects:
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
// Generate and inject a stylesheet
|
|
163
|
+
bw.injectCSS(bw.css({
|
|
164
|
+
'.my-card': { padding: '1rem', borderRadius: '8px' }
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
// Compose inline styles from objects
|
|
168
|
+
{ t: 'div', a: { style: bw.s({ display: 'flex' }, { gap: '1rem' }, { padding: '1rem' }) } }
|
|
169
|
+
|
|
170
|
+
// Responsive breakpoints
|
|
171
|
+
bw.responsive('.hero', {
|
|
172
|
+
base: { fontSize: '1.5rem' },
|
|
173
|
+
md: { fontSize: '2.5rem' }
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
127
177
|
## Theming
|
|
128
178
|
|
|
129
|
-
|
|
179
|
+
`bw.loadStyles()` derives a design system — buttons, alerts, badges, cards, forms, tables, hover states, focus rings — from two seed colors. Themes are scoped to DOM subtrees, so different sections of a page can use different themes. `toggleStyles()` switches between primary and alternate palettes:
|
|
130
180
|
|
|
131
181
|
```javascript
|
|
132
|
-
bw.
|
|
182
|
+
bw.loadStyles({
|
|
133
183
|
primary: '#336699',
|
|
134
184
|
secondary: '#cc6633'
|
|
135
185
|
});
|
|
136
186
|
|
|
137
|
-
bw.
|
|
187
|
+
bw.toggleStyles(); // switch between primary and alternate palettes
|
|
138
188
|
```
|
|
139
189
|
|
|
190
|
+
|
|
140
191
|
## Core API
|
|
141
192
|
|
|
142
193
|
| Function | Description |
|
|
143
194
|
|---|---|
|
|
144
195
|
| `bw.html(obj)` | Convert an object to an HTML string |
|
|
145
196
|
| `bw.DOM(selector, obj)` | Mount an object to a DOM element |
|
|
197
|
+
| `bw.raw(str)` | Mark a string as pre-escaped HTML (no double-escaping) |
|
|
146
198
|
| `bw.component(taco)` | Wrap a TACO in a ComponentHandle with `.get()/.set()` reactive API |
|
|
147
199
|
| `bw.css(rules)` | Generate CSS from a JS object |
|
|
148
|
-
| `bw.
|
|
149
|
-
| `bw.
|
|
200
|
+
| `bw.s(...objs)` | Compose inline style objects into a style string |
|
|
201
|
+
| `bw.responsive(sel, breakpoints)` | Generate `@media` CSS rules from JS |
|
|
202
|
+
| `bw.loadStyles()` | Inject the built-in stylesheet (or pass config to theme) |
|
|
203
|
+
| `bw.makeStyles(config)` | Generate a scoped theme from seed colors (returns styles object) |
|
|
204
|
+
| `bw.toggleStyles()` | Switch between primary and alternate palettes |
|
|
150
205
|
| `bw.patch(id, content)` | Update a specific element by UUID |
|
|
151
206
|
| `bw.update(el)` | Re-render via the element's `o.render` function |
|
|
152
207
|
| `bw.message(target, action, data)` | Send a message to a component by tag name |
|
|
153
208
|
| `bw.pub(topic, detail)` | Publish a message to subscribers |
|
|
154
209
|
| `bw.sub(topic, handler)` | Subscribe to a topic; returns an unsub function |
|
|
155
210
|
| `bw.inspect(target)` | Debug a component in the browser console |
|
|
156
|
-
| `bw.
|
|
157
|
-
| `bw.clientApply(msg)` | Apply a bwserve protocol message to the DOM |
|
|
158
|
-
| `bw.clientParse(str)` | Parse strict or r-prefix relaxed JSON |
|
|
211
|
+
| `bw.apply(msg)` | Apply a bwserve protocol message to the DOM |
|
|
159
212
|
|
|
160
213
|
See the full [API Reference](https://deftio.github.io/bitwrench/pages/08-api-reference.html) for all functions.
|
|
161
214
|
|
|
@@ -198,7 +251,12 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
|
|
|
198
251
|
|
|
199
252
|
## Documentation
|
|
200
253
|
|
|
201
|
-
**
|
|
254
|
+
**Start here:**
|
|
255
|
+
|
|
256
|
+
- **[Thinking in Bitwrench](docs/thinking-in-bitwrench.md)** — the complete guide. Covers TACO, styling (`bw.css`, `bw.s`, `bw.responsive`), composition, events, the three-level component model, bwserve, and common patterns
|
|
257
|
+
- **[LLM Guide](docs/llm-bitwrench-guide.md)** — compact single-file reference with all APIs, patterns, and rules. Designed for AI-assisted development but works as a cheat sheet for anyone
|
|
258
|
+
|
|
259
|
+
**Reference guides** (in `docs/`):
|
|
202
260
|
|
|
203
261
|
- [TACO Format](docs/taco-format.md) — the `{t, a, c, o}` object format
|
|
204
262
|
- [State Management](docs/state-management.md) — three-level component model, ComponentHandle, reactive state
|
|
@@ -206,7 +264,6 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
|
|
|
206
264
|
- [Theming](docs/theming.md) — palette-driven theme generation, presets, design tokens
|
|
207
265
|
- [CLI](docs/cli.md) — the `bwcli` command for file conversion and pipe server
|
|
208
266
|
- [bwserve](docs/bwserve.md) — server-driven UI protocol (SSE, actions, embedded devices)
|
|
209
|
-
- [LLM Guide](docs/llm-bitwrench-guide.md) — compact single-file reference for AI-assisted development
|
|
210
267
|
|
|
211
268
|
**Tutorials:**
|
|
212
269
|
|
|
@@ -217,20 +274,52 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
|
|
|
217
274
|
**Interactive demos** (live site):
|
|
218
275
|
|
|
219
276
|
- [Quick Start](https://deftio.github.io/bitwrench/pages/00-quick-start.html) — first steps with `bw.DOM()`
|
|
220
|
-
- [Components](https://deftio.github.io/bitwrench/pages/01-components.html) —
|
|
221
|
-
- [Styling & Theming](https://deftio.github.io/bitwrench/pages/03-styling.html) — CSS generation and theming strategies
|
|
277
|
+
- [Components](https://deftio.github.io/bitwrench/pages/01-components.html) — all 50+ UI components with live demos
|
|
278
|
+
- [Styling & Theming](https://deftio.github.io/bitwrench/pages/03-styling.html) — CSS generation, `bw.s()`, and theming strategies
|
|
222
279
|
- [State & Interactivity](https://deftio.github.io/bitwrench/pages/05-state.html) — state patterns and ComponentHandle
|
|
223
280
|
- [Tic Tac Toe Tutorial](https://deftio.github.io/bitwrench/pages/06-tic-tac-toe-tutorial.html) — step-by-step game with state management
|
|
224
281
|
- [Framework Comparison](https://deftio.github.io/bitwrench/pages/07-framework-comparison.html) — bitwrench vs React, Vue, Svelte
|
|
225
282
|
- [Themes](https://deftio.github.io/bitwrench/pages/10-themes.html) — interactive theme generator with presets and CSS export
|
|
226
283
|
|
|
284
|
+
**Example apps** (in `examples/`):
|
|
285
|
+
|
|
286
|
+
- [Ember & Oak Coffee Co.](examples/ember-and-oak/) — full landing page: theme, cart, search, charts, accordion, timeline
|
|
287
|
+
- [SunForge Landing Page](examples/landing-page/) — polished marketing page with zero reactive state, pure BCCL composition
|
|
288
|
+
- [Todo App](examples/todo-app/) — bw.component() with pub/sub
|
|
289
|
+
- [Metrics Dashboard](examples/dashboard/) — live stat cards, bar chart, pub/sub, responsive layout
|
|
290
|
+
- [Signup Wizard](examples/wizard/) — multi-step form, state transitions, bw.raw()
|
|
291
|
+
- [Live Feed](examples/live-feed/) — real-time stream, bw.patch(), slide-in animation
|
|
292
|
+
- [IoT Dashboard](examples/embedded/) — ESP32-style sensor dashboard with SSE
|
|
293
|
+
- [bwserve Counter](examples/client-server/) — server-driven UI demo
|
|
294
|
+
- [LLM Chat](examples/llm-chat/) — streaming chat via bwserve + Ollama/OpenAI
|
|
295
|
+
|
|
296
|
+
## FAQ
|
|
297
|
+
|
|
298
|
+
**Is this a framework?** — No. Bitwrench is a library (~39KB gzipped). No lifecycle to learn, no project structure to follow. Import it, call functions, done.
|
|
299
|
+
|
|
300
|
+
**Does it scale to large apps?** — Bitwrench targets single-page tools, dashboards, prototypes, embedded UIs, and content sites — apps where a single HTML file or a handful of files is the right form factor. For a 500-route SPA with team-scale state management, React or Vue is a better fit.
|
|
301
|
+
|
|
302
|
+
**How does bitwrench compare to React/Vue?** — They solve different problems at different scales. React and Vue provide a component model, virtual DOM, and ecosystem for large team-built SPAs. Bitwrench provides rendering and state primitives in a single file with no build step, aimed at single-page tools, dashboards, embedded devices, and server-driven UIs. They coexist fine — use whichever fits the job.
|
|
303
|
+
|
|
304
|
+
**How does CSS work?** — Bitwrench doesn't own your CSS. Use any external stylesheet, Tailwind, or CSS file you want — bitwrench doesn't interfere. On top of that, `bw.css()` generates CSS from JS objects (with `@media`, `@keyframes`, pseudo-classes), `bw.s()` composes inline style objects, and `bw.loadStyles()` or `bw.makeStyles()` derives a complete theme from 2 seed colors. You can use all three together or none at all.
|
|
305
|
+
|
|
306
|
+
**What's the difference between `bw.DOM()` and `bw.html()`?** — Same TACO input, two outputs. `bw.DOM('#app', taco)` mounts live DOM elements in a browser. `bw.html(taco)` returns an HTML string — use it in Node.js scripts, email generators, static site builds, or anywhere you need markup without a browser. One object format, two rendering modes.
|
|
307
|
+
|
|
308
|
+
**What is bwserve?** — bwserve lets any server push UI updates to a browser over SSE. The server sends TACO objects as JSON; the browser renders them. It's language-agnostic — the server can be Python, Go, Rust, C, or a shell script. Anything that can write JSON to an HTTP response can drive a bitwrench UI. See the [bwserve docs](docs/bwserve.md).
|
|
309
|
+
|
|
310
|
+
**Can I use bitwrench on embedded devices?** — Yes — this is a primary use case. An ESP32 or Raspberry Pi serves one HTML page with bitwrench loaded, then pushes sensor data as JSON patches over SSE. The device never generates HTML. See the [ESP32 tutorial](docs/tutorial-embedded.md).
|
|
311
|
+
|
|
312
|
+
**Can I use it with TypeScript?** — Yes. Type declarations are included. TACO objects are plain JSON-compatible objects that TypeScript infers naturally.
|
|
313
|
+
|
|
314
|
+
**What about accessibility?** — BCCL components emit semantic HTML with ARIA attributes where applicable. You can add any `aria-*` attribute via `a: { 'aria-label': '...' }`.
|
|
315
|
+
|
|
227
316
|
## Development
|
|
228
317
|
|
|
229
318
|
```bash
|
|
230
319
|
npm install # install dev dependencies
|
|
231
320
|
npm run build # build all dist formats (UMD, ESM, CJS, ES5)
|
|
232
321
|
npm test # run unit tests (1000+ tests)
|
|
233
|
-
npm run test:cli # run CLI tests
|
|
322
|
+
npm run test:cli # run CLI tests
|
|
234
323
|
npm run test:e2e # run Playwright browser tests
|
|
235
324
|
npm run lint # run ESLint
|
|
236
325
|
npm run cleanbuild # full production build with SRI hashes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! bitwrench-bccl v2.0.
|
|
1
|
+
/*! bitwrench-bccl v2.0.18 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -330,7 +330,7 @@ function makeCol(props = {}) {
|
|
|
330
330
|
if (breakpoint === 'xs') {
|
|
331
331
|
classes.push(`bw_col_${value}`);
|
|
332
332
|
} else {
|
|
333
|
-
classes.push(`bw_col_${breakpoint}
|
|
333
|
+
classes.push(`bw_col_${breakpoint}_${value}`);
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
336
|
} else if (size) {
|
|
@@ -1713,8 +1713,8 @@ function makePagination(props = {}) {
|
|
|
1713
1713
|
t: 'li',
|
|
1714
1714
|
a: { class: `bw_page_item ${currentPage <= 1 ? 'bw_disabled' : ''}`.trim() },
|
|
1715
1715
|
c: {
|
|
1716
|
-
t: '
|
|
1717
|
-
a: { class: 'bw_page_link',
|
|
1716
|
+
t: 'button',
|
|
1717
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(currentPage - 1), 'aria-label': 'Previous', disabled: currentPage <= 1 ? true : undefined },
|
|
1718
1718
|
c: '\u2039'
|
|
1719
1719
|
}
|
|
1720
1720
|
});
|
|
@@ -1726,8 +1726,8 @@ function makePagination(props = {}) {
|
|
|
1726
1726
|
t: 'li',
|
|
1727
1727
|
a: { class: `bw_page_item ${pageNum === currentPage ? 'bw_active' : ''}`.trim() },
|
|
1728
1728
|
c: {
|
|
1729
|
-
t: '
|
|
1730
|
-
a: { class: 'bw_page_link',
|
|
1729
|
+
t: 'button',
|
|
1730
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(pageNum), 'aria-current': pageNum === currentPage ? 'page' : undefined },
|
|
1731
1731
|
c: '' + pageNum
|
|
1732
1732
|
}
|
|
1733
1733
|
});
|
|
@@ -1739,8 +1739,8 @@ function makePagination(props = {}) {
|
|
|
1739
1739
|
t: 'li',
|
|
1740
1740
|
a: { class: `bw_page_item ${currentPage >= pages ? 'bw_disabled' : ''}`.trim() },
|
|
1741
1741
|
c: {
|
|
1742
|
-
t: '
|
|
1743
|
-
a: { class: 'bw_page_link',
|
|
1742
|
+
t: 'button',
|
|
1743
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(currentPage + 1), 'aria-label': 'Next', disabled: currentPage >= pages ? true : undefined },
|
|
1744
1744
|
c: '\u203A'
|
|
1745
1745
|
}
|
|
1746
1746
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! bitwrench-bccl v2.0.
|
|
1
|
+
/*! bitwrench-bccl v2.0.18 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* Bitwrench v2 Components
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @module bitwrench-bccl
|
|
18
18
|
* @license BSD-2-Clause
|
|
19
19
|
* @author M A Chatterjee <deftio [at] deftio [dot] com>
|
|
20
|
-
*/function e(e){return e?0===e.indexOf("outline")?"bw_btn_outline bw_"+e.replace(/^outline[_-]/,""):"bw_"+e:""}function t(t={}){const{title:a,subtitle:s,content:c,footer:n,header:o,image:i,imagePosition:r="top",variant:l,bordered:d=!0,shadow:_,hoverable:b=!1,className:u="",style:m,headerClass:p="",bodyClass:w="",footerClass:v=""}=t,f=["bw_card",e(l),_&&{none:"",sm:"bw_shadow_sm",md:"bw_shadow",lg:"bw_shadow_lg"}[_]||"",d?"":"bw_border_0",b?"bw_card_hoverable":"",u].filter(Boolean).join(" ").trim(),h=[o&&{t:"div",a:{class:`bw_card_header ${p}`.trim()},c:o},i&&("top"===r||"left"===r)&&{t:"img",a:{class:`bw_card_img_${r}`,src:i.src,alt:i.alt||""}},{t:"div",a:{class:`bw_card_body ${w}`.trim()},c:[a&&{t:"h5",a:{class:"bw_card_title"},c:a},s&&{t:"h6",a:{class:"bw_card_subtitle bw_mb_2 bw_text_muted"},c:s},c&&(Array.isArray(c)?c:[c])].flat().filter(Boolean)},i&&("bottom"===r||"right"===r)&&{t:"img",a:{class:`bw_card_img_${r}`,src:i.src,alt:i.alt||""}},n&&{t:"div",a:{class:`bw_card_footer ${v}`.trim()},c:n}].filter(Boolean);return!i||"left"!==r&&"right"!==r?{t:"div",a:{class:f,style:m},c:h,o:{type:"card",state:t.state||{}}}:{t:"div",a:{class:f,style:m},c:{t:"div",a:{class:"bw_row bw_g_0"},c:h},o:{type:"card",state:t.state||{}}}}function a(t={}){"string"==typeof t&&(t={text:t});const{text:a,variant:s="primary",size:c,disabled:n=!1,onclick:o,type:i="button",className:r="",style:l}=t;return{t:"button",a:{type:i,class:["bw_btn",e(s),c&&`bw_btn_${c}`,r].filter(Boolean).join(" "),disabled:n,onclick:o,style:l},c:a,o:{type:"button"}}}function s(e={}){const{fluid:t=!1,children:a,className:s=""}=e;return{t:"div",a:{class:`bw_container${t?"-fluid":""} ${s}`.trim()},c:a}}function c(e={}){const{children:t,className:a="",gap:s}=e;return{t:"div",a:{class:`bw_row ${s?`bw_g_${s}`:""} ${a}`.trim()},c:t}}function n(e={}){const{size:t,offset:a,push:s,pull:c,content:n,children:o,className:i=""}=e,r=[];return"object"==typeof t?Object.entries(t).forEach(([e,t])=>{"xs"===e?r.push(`bw_col_${t}`):r.push(`bw_col_${e}-${t}`)}):t?r.push(`bw_col_${t}`):r.push("bw_col"),a&&r.push(`bw_offset_${a}`),s&&r.push(`bw_push_${s}`),c&&r.push(`bw_pull_${c}`),{t:"div",a:{class:`${r.join(" ")} ${i}`.trim()},c:n||o}}function o(e={}){const{items:t=[],pills:a=!1,vertical:s=!1,className:c=""}=e;return{t:"ul",a:{class:`bw_nav ${a?"bw_nav_pills":"bw_nav_tabs"} ${s?"bw_nav_vertical":""} ${c}`.trim()},c:t.map(e=>({t:"li",a:{class:"bw_nav_item"},c:{t:"a",a:{href:e.href||"#",class:`bw_nav_link ${e.active?"active":""} ${e.disabled?"disabled":""}`.trim()},c:e.text}}))}}function i(e={}){const{brand:t,brandHref:a="#",items:s=[],dark:c=!0,className:n=""}=e;return{t:"nav",a:{class:`bw_navbar ${c?"bw_navbar_dark":"bw_navbar_light"} ${n}`.trim()},c:{t:"div",a:{class:"bw_container"},c:[t&&{t:"a",a:{href:a,class:"bw_navbar_brand"},c:t},s.length>0&&{t:"div",a:{class:"bw_navbar_nav"},c:s.map(e=>({t:"a",a:{href:e.href||"#",class:"bw_nav_link "+(e.active?"active":"")},c:e.text}))}].filter(Boolean)},o:{type:"navbar",state:{activeItem:s.findIndex(e=>e.active)}}}}function r(e={}){const{tabs:t=[],activeIndex:a=0}=e;let s=a;return t.forEach((e,t)=>{e.active&&(s=t)}),{t:"div",a:{class:"bw_tabs"},c:[{t:"ul",a:{class:"bw_nav bw_nav_tabs",role:"tablist"},c:t.map((e,t)=>({t:"li",a:{class:"bw_nav_item",role:"presentation"},c:{t:"button",a:{class:"bw_nav_link "+(t===s?"active":""),type:"button",role:"tab",tabindex:t===s?"0":"-1","aria-selected":t===s?"true":"false","data-tab-index":t,onclick:e=>{const t=e.target.closest(".bw_tabs"),a=t.querySelectorAll(".bw_nav_link"),s=t.querySelectorAll(".bw_tab_pane");a.forEach(e=>{e.classList.remove("active"),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1")}),s.forEach(e=>e.classList.remove("active")),e.target.classList.add("active"),e.target.setAttribute("aria-selected","true"),e.target.setAttribute("tabindex","0");s[parseInt(e.target.getAttribute("data-tab-index"))].classList.add("active")}},c:e.label}}))},{t:"div",a:{class:"bw_tab_content"},c:t.map((e,t)=>({t:"div",a:{class:"bw_tab_pane "+(t===s?"active":""),role:"tabpanel"},c:e.content}))}],o:{type:"tabs",state:{activeIndex:s},mounted:function(e){var t=e.querySelector('[role="tablist"]');t&&t.addEventListener("keydown",function(e){for(var a=t.querySelectorAll('[role="tab"]'),s=-1,c=0;c<a.length;c++)if(a[c]===e.target){s=c;break}if(-1!==s){var n=-1;"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),n=s>0?s-1:a.length-1):"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),n=s<a.length-1?s+1:0):"Home"===e.key?(e.preventDefault(),n=0):"End"===e.key&&(e.preventDefault(),n=a.length-1),n>=0&&(a[n].focus(),a[n].click())}})}}}}function l(t={}){"string"==typeof t&&(t={content:t});const{content:a,variant:s="info",dismissible:c=!1,className:n=""}=t;return{t:"div",a:{class:`bw_alert ${e(s)} ${c?"bw_alert_dismissible":""} ${n}`.trim(),role:"alert"},c:[a,c&&{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){var t=e.target.closest(".bw_alert");t&&t.remove()}},c:"×"}].filter(Boolean)}}function d(t={}){"string"==typeof t&&(t={text:t});const{text:a,variant:s="primary",size:c,pill:n=!1,className:o=""}=t,i="sm"===c?" bw_badge_sm":"lg"===c?" bw_badge_lg":"";return{t:"span",a:{class:`bw_badge ${e(s)}${i} ${n?"bw_badge_pill":""} ${o}`.trim()},c:a}}function _(t={}){const{value:a=0,max:s=100,variant:c="primary",striped:n=!1,animated:o=!1,label:i,height:r}=t,l=Math.round(a/s*100);return{t:"div",a:{class:"bw_progress",style:r?{height:`${r}px`}:void 0},c:{t:"div",a:{class:["bw_progress_bar",e(c),n&&"bw_progress_bar_striped",o&&"bw_progress_bar_animated"].filter(Boolean).join(" "),role:"progressbar",style:{width:`${l}%`},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":s},c:i||`${l}%`}}}function b(e={}){const{items:t=[],flush:a=!1,interactive:s=!1}=e;return{t:"div",a:{class:("bw_list_group "+(a?"bw_list_group_flush":"")).trim()},c:t.map(e=>{const t="object"==typeof e,a=t?e.text:e,c=!!t&&e.active,n=!!t&&e.disabled,o=t?e.href:null,i=t?e.onclick:null;return s||o||i?{t:"a",a:{class:["bw_list_group_item",c&&"active",n&&"disabled"].filter(Boolean).join(" "),href:o||"#",onclick:i||(e=>{o||e.preventDefault()}),style:n?"pointer-events: none; opacity: 0.65;":""},c:a}:{t:"div",a:{class:["bw_list_group_item",c&&"active",n&&"disabled"].filter(Boolean).join(" ")},c:a}})}}function u(e={}){const{items:t=[]}=e;return{t:"nav",a:{"aria-label":"breadcrumb"},c:{t:"ol",a:{class:"bw_breadcrumb"},c:t.map((e,t)=>({t:"li",a:{class:"bw_breadcrumb_item "+(e.active?"active":""),"aria-current":e.active?"page":void 0},c:e.active?e.text:{t:"a",a:{href:e.href||"#"},c:e.text}}))}}}function m(e={}){const{children:t,onsubmit:a,className:s=""}=e;return{t:"form",a:{class:s,onsubmit:a||(e=>e.preventDefault())},c:t}}function p(e={}){var{label:t,input:a,help:s,id:c,validation:n,feedback:o,required:i}=e,r=a;if(n&&a&&a.a){r={t:a.t,a:Object.assign({},a.a),c:a.c,o:a.o};var l="valid"===n?"bw_is_valid":"invalid"===n?"bw_is_invalid":"";l&&(r.a.class=((r.a.class||"")+" "+l).trim())}return{t:"div",a:{class:"bw_form_group"},c:[t&&{t:"label",a:{for:c,class:"bw_form_label"},c:i?[t,{t:"span",a:{class:"bw_text_danger bw_ms_1"},c:"*"}]:t},r,o&&n&&{t:"div",a:{class:"valid"===n?"bw_valid_feedback":"bw_invalid_feedback"},c:o},s&&{t:"small",a:{class:"bw_form_text bw_text_muted"},c:s}].filter(Boolean)}}function w(e={}){const{type:t="text",placeholder:a,value:s,id:c,name:n,disabled:o=!1,readonly:i=!1,required:r=!1,className:l="",style:d,..._}=e;return{t:"input",a:{type:t,class:`bw_form_control ${l}`.trim(),placeholder:a,value:s,id:c,name:n,style:d,disabled:o,readonly:i,required:r,..._}}}function v(e={}){const{placeholder:t,value:a,rows:s=3,id:c,name:n,disabled:o=!1,readonly:i=!1,required:r=!1,className:l="",...d}=e;return{t:"textarea",a:{class:`bw_form_control ${l}`.trim(),placeholder:t,rows:s,id:c,name:n,disabled:o,readonly:i,required:r,...d},c:a}}function f(e={}){const{options:t=[],value:a,id:s,name:c,disabled:n=!1,required:o=!1,className:i="",...r}=e;return{t:"select",a:{class:`bw_form_control ${i}`.trim(),id:s,name:c,disabled:n,required:o,...r},c:t.map(e=>({t:"option",a:{value:e.value,selected:e.value===a},c:e.text||e.value}))}}function h(e={}){const{label:t,checked:a=!1,id:s,name:c,disabled:n=!1,value:o,className:i="",...r}=e;return{t:"div",a:{class:`bw_form_check ${i}`.trim()},c:[{t:"input",a:{type:"checkbox",class:"bw_form_check_input",checked:a,id:s,name:c,disabled:n,value:o,...r}},t&&{t:"label",a:{class:"bw_form_check_label",for:s},c:t}].filter(Boolean)}}function g(e={}){const{children:t,direction:a="vertical",gap:s=3,className:c=""}=e;return{t:"div",a:{class:`bw_${"vertical"===a?"vstack":"hstack"} bw_gap_${s} ${c}`.trim()},c:t}}function k(t={}){const{variant:a="primary",size:s="md",type:c="border"}=t;return{t:"div",a:{class:`bw_spinner_${c} bw_spinner_${c}-${s} ${e(a)}`,role:"status"},c:{t:"span",a:{class:"bw_visually_hidden"},c:"Loading..."}}}function y(t={}){const{title:a,subtitle:s,content:c,variant:n="primary",size:o="lg",centered:i=!0,overlay:r=!1,backgroundImage:l,actions:d,className:_=""}=t,b={sm:"bw_py_3",md:"bw_py_4",lg:"bw_py_5",xl:"bw_py_6"};return{t:"section",a:{class:`bw_hero ${e(n)} ${b[o]||b.lg} ${i?"bw_text_center":""} ${_}`.trim(),style:l?`background-image: url('${l}'); background-size: cover; background-position: center;`:void 0},c:[r&&{t:"div",a:{class:"bw_hero_overlay"}},{t:"div",a:{class:"bw_container"},c:{t:"div",a:{class:"bw_hero_content"},c:[a&&{t:"h1",a:{class:"bw_hero_title bw_display_4 bw_mb_3"},c:a},s&&{t:"p",a:{class:"bw_hero_subtitle bw_lead bw_mb_4"},c:s},c,d&&{t:"div",a:{class:"bw_hero_actions bw_mt_4"},c:d}].filter(Boolean)}}].filter(Boolean)}}function x(e={}){const{features:t=[],columns:a=3,centered:s=!0,iconSize:c="3rem",className:n=""}=e,o="bw_col_md_"+12/a;return{t:"div",a:{class:`bw_feature_grid ${n}`.trim()},c:{t:"div",a:{class:"bw_row bw_g_4"},c:t.map(e=>({t:"div",a:{class:o},c:{t:"div",a:{class:"bw_feature "+(s?"bw_text_center":"")},c:[e.icon&&{t:"div",a:{class:"bw_feature_icon bw_mb_3 bw_text_primary",style:`font-size: ${c};`},c:e.icon},e.title&&{t:"h3",a:{class:"bw_feature_title bw_h5 bw_mb_2"},c:e.title},e.description&&{t:"p",a:{class:"bw_feature_description bw_text_muted"},c:e.description}].filter(Boolean)}}))}}}function $(e={}){const{title:t,description:a,actions:s,variant:c="light",centered:n=!0,className:o=""}=e;return{t:"section",a:{class:`bw_cta bw_bg_${c} bw_py_5 ${o}`.trim()},c:{t:"div",a:{class:"bw_container"},c:{t:"div",a:{class:"bw_cta_content "+(n?"bw_text_center":"")},c:[t&&{t:"h2",a:{class:"bw_cta_title bw_mb_3"},c:t},a&&{t:"p",a:{class:"bw_cta_description bw_lead bw_mb_4"},c:a},s&&{t:"div",a:{class:"bw_cta_actions"},c:s}].filter(Boolean)}}}}function L(e={}){const{title:t,subtitle:a,content:s,variant:c="default",spacing:n="md",className:o=""}=e,i={sm:"bw_py_3",md:"bw_py_4",lg:"bw_py_5",xl:"bw_py_6"};return{t:"section",a:{class:`bw_section ${i[n]||i.md} ${"default"!==c?`bw_bg_${c}`:""} ${o}`.trim()},c:{t:"div",a:{class:"bw_container"},c:[(t||a)&&{t:"div",a:{class:"bw_section_header bw_text_center bw_mb_5"},c:[t&&{t:"h2",a:{class:"bw_section_title"},c:t},a&&{t:"p",a:{class:"bw_section_subtitle bw_text_muted"},c:a}].filter(Boolean)},s].filter(Boolean)}}}function N(e={}){const{title:t,description:a,code:s,result:c,language:n="javascript"}=e;Math.random().toString(36).substr(2,9);const o=[{label:"Result",active:!0,content:c}];s&&o.push({label:"Code",content:{t:"div",a:{style:"position: relative;"},c:[{t:"button",a:{class:"bw_copy_btn bw_code_copy_btn",onclick:function(e){navigator.clipboard.writeText(s).then(function(){var t=e.target,a=t.textContent;t.textContent="Copied!",t.classList.add("bw_code_copy_btn_copied"),setTimeout(function(){t.textContent=a,t.classList.remove("bw_code_copy_btn_copied")},2e3)})}},c:"Copy"},"undefined"!=typeof globalThis&&void 0!==globalThis.bw&&"function"==typeof globalThis.bw.codeEditor?globalThis.bw.codeEditor({code:s,lang:"javascript"===n?"js":n,readOnly:!0,height:"auto"}):{t:"pre",a:{class:"bw_code_pre"},c:{t:"code",a:{class:`bw_code_block language-${n}`},c:s}}]}});return{t:"div",a:{class:"bw_code_demo"},c:[t&&{t:"h3",c:t},a&&{t:"p",a:{class:"bw_text_muted bw_mb_3"},c:a},r({tabs:o})].filter(Boolean)}}function C(e={}){const{pages:t=1,currentPage:a=1,onPageChange:s,size:c,className:n=""}=e;function o(e){return function(c){c.preventDefault(),e<1||e>t||e===a||s&&s(e)}}const i=[];i.push({t:"li",a:{class:("bw_page_item "+(a<=1?"bw_disabled":"")).trim()},c:{t:"a",a:{class:"bw_page_link",href:"#",onclick:o(a-1),"aria-label":"Previous"},c:"‹"}});for(var r=1;r<=t;r++)(function(e){i.push({t:"li",a:{class:("bw_page_item "+(e===a?"bw_active":"")).trim()},c:{t:"a",a:{class:"bw_page_link",href:"#",onclick:o(e)},c:""+e}})})(r);return i.push({t:"li",a:{class:("bw_page_item "+(a>=t?"bw_disabled":"")).trim()},c:{t:"a",a:{class:"bw_page_link",href:"#",onclick:o(a+1),"aria-label":"Next"},c:"›"}}),{t:"nav",a:{"aria-label":"Pagination"},c:{t:"ul",a:{class:`bw_pagination ${c?"bw_pagination_"+c:""} ${n}`.trim()},c:i}}}function B(e={}){const{label:t,name:a,value:s,checked:c=!1,id:n,disabled:o=!1,className:i="",...r}=e;return{t:"div",a:{class:`bw_form_check ${i}`.trim()},c:[{t:"input",a:{type:"radio",class:"bw_form_check_input",name:a,value:s,checked:c,id:n,disabled:o,...r}},t&&{t:"label",a:{class:"bw_form_check_label",for:n},c:t}].filter(Boolean)}}function A(e={}){const{children:t,size:a,vertical:s=!1,className:c=""}=e;return{t:"div",a:{class:`${s?"bw_btn_group_vertical":"bw_btn_group"} ${a?"bw_btn_group_"+a:""} ${c}`.trim(),role:"group"},c:t}}function S(e={}){const{items:t=[],multiOpen:a=!1,className:s=""}=e;return{t:"div",a:{class:`bw_accordion ${s}`.trim()},c:t.map(function(e,t){return{t:"div",a:{class:"bw_accordion_item"},c:[{t:"h2",a:{class:"bw_accordion_header"},c:{t:"button",a:{class:("bw_accordion_button "+(e.open?"":"bw_collapsed")).trim(),type:"button","aria-expanded":e.open?"true":"false","data-accordion-index":t,onclick:function(e){var t=e.target.closest(".bw_accordion_button"),s=t.closest(".bw_accordion"),c=t.closest(".bw_accordion_item"),n=c.querySelector(".bw_accordion_collapse"),o=n.classList.contains("bw_collapse_show");if(!a)for(var i=s.querySelectorAll(".bw_accordion_item"),r=0;r<i.length;r++)if(i[r]!==c){var l=i[r].querySelector(".bw_accordion_collapse"),d=i[r].querySelector(".bw_accordion_button");l.classList.contains("bw_collapse_show")&&(l.style.maxHeight=l.scrollHeight+"px",l.offsetHeight,l.style.maxHeight="0px",l.classList.remove("bw_collapse_show"),d.classList.add("bw_collapsed"),d.setAttribute("aria-expanded","false"))}if(o)n.style.maxHeight=n.scrollHeight+"px",n.offsetHeight,n.style.maxHeight="0px",n.classList.remove("bw_collapse_show"),t.classList.add("bw_collapsed"),t.setAttribute("aria-expanded","false");else{n.classList.add("bw_collapse_show"),n.style.maxHeight="0px",n.offsetHeight,n.style.maxHeight=n.scrollHeight+"px",t.classList.remove("bw_collapsed"),t.setAttribute("aria-expanded","true");var _=function(e){"max-height"===e.propertyName&&n.classList.contains("bw_collapse_show")&&(n.style.maxHeight="none"),n.removeEventListener("transitionend",_)};n.addEventListener("transitionend",_)}}},c:e.title}},{t:"div",a:{class:("bw_accordion_collapse "+(e.open?"bw_collapse_show":"")).trim()},c:{t:"div",a:{class:"bw_accordion_body"},c:e.content},o:e.open?{mounted:function(e){e.style.maxHeight="none"}}:void 0}]}}),o:{type:"accordion",state:{multiOpen:a}}}}function E(e={}){const{title:t,content:a,footer:s,size:c,closeButton:n=!0,onClose:o,className:i=""}=e;function r(e){var t=e.closest(".bw_modal");t&&(t.classList.remove("bw_modal_show"),document.body.style.overflow=""),o&&o()}return{t:"div",a:{class:`bw_modal ${i}`.trim()},c:{t:"div",a:{class:("bw_modal_dialog "+(c?"bw_modal_"+c:"")).trim()},c:{t:"div",a:{class:"bw_modal_content"},c:[(t||n)&&{t:"div",a:{class:"bw_modal_header"},c:[t&&{t:"h5",a:{class:"bw_modal_title"},c:t},n&&{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){r(e.target)}},c:"×"}].filter(Boolean)},a&&{t:"div",a:{class:"bw_modal_body"},c:a},s&&{t:"div",a:{class:"bw_modal_footer"},c:s}].filter(Boolean)}},o:{type:"modal",mounted:function(e){e.addEventListener("click",function(t){t.target===e&&r(e)});var t=function(t){"Escape"===t.key&&e.classList.contains("bw_modal_show")&&r(e)};document.addEventListener("keydown",t),e._bw_escHandler=t},unmount:function(e){e._bw_escHandler&&document.removeEventListener("keydown",e._bw_escHandler),document.body.style.overflow=""}}}}function I(t={}){const{title:a,content:s,variant:c="info",autoDismiss:n=!0,delay:o=5e3,position:i="top-right",className:r=""}=t;return{t:"div",a:{class:`bw_toast ${e(c)} ${r}`.trim(),role:"alert","data-position":i},c:[a&&{t:"div",a:{class:"bw_toast_header"},c:[{t:"strong",c:a},{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){var t=e.target.closest(".bw_toast");t&&(t.classList.add("bw_toast_hiding"),setTimeout(function(){t.parentNode&&t.parentNode.removeChild(t)},300))}},c:"×"}]},s&&{t:"div",a:{class:"bw_toast_body"},c:s}].filter(Boolean),o:{type:"toast",mounted:function(e){requestAnimationFrame(function(){e.classList.add("bw_toast_show")}),n&&setTimeout(function(){e.classList.add("bw_toast_hiding"),setTimeout(function(){e.parentNode&&e.parentNode.removeChild(e)},300)},o)}}}}function q(t={}){const{trigger:a,items:s=[],align:c="start",variant:n="primary",className:o=""}=t;var i;return i="string"==typeof a||void 0===a?{t:"button",a:{class:`bw_btn ${e(n)} bw_dropdown_toggle`,type:"button",onclick:function(e){e.target.closest(".bw_dropdown").querySelector(".bw_dropdown_menu").classList.toggle("bw_dropdown_show")}},c:a||"Dropdown"}:a,{t:"div",a:{class:`bw_dropdown ${o}`.trim()},c:[i,{t:"div",a:{class:("bw_dropdown_menu "+("end"===c?"bw_dropdown_menu_end":"")).trim()},c:s.map(function(e){return e.divider?{t:"hr",a:{class:"bw_dropdown_divider"}}:{t:"a",a:{class:("bw_dropdown_item "+(e.disabled?"disabled":"")).trim(),href:e.href||"#",onclick:e.disabled?void 0:function(t){e.href||t.preventDefault(),t.target.closest(".bw_dropdown").querySelector(".bw_dropdown_menu").classList.remove("bw_dropdown_show"),e.onclick&&e.onclick(t)}},c:e.text}})}],o:{type:"dropdown",mounted:function(e){var t=function(t){if(!e.contains(t.target)){var a=e.querySelector(".bw_dropdown_menu");a&&a.classList.remove("bw_dropdown_show")}};document.addEventListener("click",t),e._bw_outsideHandler=t},unmount:function(e){e._bw_outsideHandler&&document.removeEventListener("click",e._bw_outsideHandler)}}}}function H(e={}){const{label:t,checked:a=!1,id:s,name:c,disabled:n=!1,className:o="",...i}=e;return{t:"div",a:{class:`bw_form_check bw_form_switch ${o}`.trim()},c:[{t:"input",a:{type:"checkbox",class:"bw_form_check_input bw_switch_input",role:"switch",checked:a,id:s,name:c,disabled:n,...i}},t&&{t:"label",a:{class:"bw_form_check_label",for:s},c:t}].filter(Boolean)}}function j(e={}){const{variant:t="text",width:a,height:s,count:c=1,className:n=""}=e;if("circle"===t){var o=a||s||"3rem";return{t:"div",a:{class:`bw_skeleton bw_skeleton_circle ${n}`.trim(),style:{width:o,height:o}}}}if("rect"===t)return{t:"div",a:{class:`bw_skeleton bw_skeleton_rect ${n}`.trim(),style:{width:a||"100%",height:s||"120px"}}};if(1===c)return{t:"div",a:{class:`bw_skeleton bw_skeleton_text ${n}`.trim(),style:{width:a||"100%",height:s||"1em"}}};for(var i=[],r=0;r<c;r++)i.push({t:"div",a:{class:"bw_skeleton bw_skeleton_text",style:{width:r===c-1?"75%":a||"100%",height:s||"1em"}}});return{t:"div",a:{class:`bw_skeleton_group ${n}`.trim()},c:i}}function D(t={}){const{src:a,alt:s="",initials:c,size:n="md",variant:o="primary",className:i=""}=t;return a?{t:"img",a:{class:`bw_avatar bw_avatar_${n} ${i}`.trim(),src:a,alt:s}}:{t:"div",a:{class:`bw_avatar bw_avatar_${n} ${e(o)} ${i}`.trim()},c:c||""}}function T(e={}){const{items:t=[],showControls:a=!0,showIndicators:s=!0,autoPlay:c=!1,interval:n=5e3,height:o="300px",startIndex:i=0,className:r=""}=e;function l(e,t){var a=e.querySelectorAll(".bw_carousel_slide").length;t<0&&(t=a-1),t>=a&&(t=0),e.setAttribute("data-carousel-index",t),e.querySelector(".bw_carousel_track").style.transform="translateX(-"+100*t+"%)";for(var s=e.querySelectorAll(".bw_carousel_indicator"),c=0;c<s.length;c++)c===t?s[c].classList.add("active"):s[c].classList.remove("active")}var d=t.map(function(e){var t=[e.content,e.caption&&{t:"div",a:{class:"bw_carousel_caption"},c:e.caption}].filter(Boolean);return{t:"div",a:{class:"bw_carousel_slide"},c:1===t.length?t[0]:t}}),_=[{t:"div",a:{class:"bw_carousel_track",style:"transform: translateX(-"+100*i+"%)"},c:d}];return a&&t.length>1&&(_.push({t:"button",a:{class:"bw_carousel_control bw_carousel_control_prev",type:"button","aria-label":"Previous slide",onclick:function(e){var t=e.target.closest(".bw_carousel"),a=parseInt(t.getAttribute("data-carousel-index")||"0");l(t,a-1)}},c:{t:"img",a:{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e",alt:"",role:"presentation"}}}),_.push({t:"button",a:{class:"bw_carousel_control bw_carousel_control_next",type:"button","aria-label":"Next slide",onclick:function(e){var t=e.target.closest(".bw_carousel"),a=parseInt(t.getAttribute("data-carousel-index")||"0");l(t,a+1)}},c:{t:"img",a:{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e",alt:"",role:"presentation"}}})),s&&t.length>1&&_.push({t:"div",a:{class:"bw_carousel_indicators"},c:t.map(function(e,t){return{t:"button",a:{class:"bw_carousel_indicator"+(t===i?" active":""),type:"button","aria-label":"Go to slide "+(t+1),"data-slide-index":t,onclick:function(e){l(e.target.closest(".bw_carousel"),parseInt(e.target.getAttribute("data-slide-index")))}}}})}),{t:"div",a:{class:("bw_carousel "+r).trim(),style:"height: "+o,tabindex:"0","aria-roledescription":"carousel","data-carousel-index":i},c:_,o:{type:"carousel",state:{activeIndex:i,autoPlay:c,interval:n},mounted:function(e){if(e.addEventListener("keydown",function(t){var a=parseInt(e.getAttribute("data-carousel-index")||"0");"ArrowLeft"===t.key?(t.preventDefault(),l(e,a-1)):"ArrowRight"===t.key&&(t.preventDefault(),l(e,a+1))}),c){var t=setInterval(function(){var t=parseInt(e.getAttribute("data-carousel-index")||"0");l(e,t+1)},n);e._bw_carouselInterval=t,e.addEventListener("mouseenter",function(){e._bw_carouselInterval&&clearInterval(e._bw_carouselInterval)}),e.addEventListener("mouseleave",function(){e._bw_carouselInterval=setInterval(function(){var t=parseInt(e.getAttribute("data-carousel-index")||"0");l(e,t+1)},n)})}},unmount:function(e){e._bw_carouselInterval&&clearInterval(e._bw_carouselInterval)}}}}function z(t={}){"string"==typeof t&&(t={label:t});var{value:a=0,label:s,change:c,format:n,prefix:o,suffix:i,icon:r,variant:l,className:d="",style:_}=t;var b=["bw_stat_card",e(l),d].filter(Boolean).join(" ").trim(),u=[];return r&&u.push({t:"div",a:{class:"bw_stat_icon"},c:r}),u.push({t:"div",a:{class:"bw_stat_value"},c:function(e,t){if(o||i)return(o||"")+e+(i||"");switch(t){case"currency":return"$"+Number(e).toLocaleString();case"percent":return e+"%";case"number":return Number(e).toLocaleString();default:return""+e}}(a,n)}),s&&u.push({t:"div",a:{class:"bw_stat_label"},c:s}),null!=c&&u.push({t:"div",a:{class:"bw_stat_change "+(c>=0?"bw_stat_change_up":"bw_stat_change_down")},c:(c>=0?"↑ +":"↓ ")+c+"%"}),{t:"div",a:{class:b,style:_},c:u,o:{type:"stat-card"}}}function O(e={}){var{content:t,text:a="",placement:s="top",className:c=""}=e;return{t:"span",a:{class:("bw_tooltip_wrapper "+c).trim()},c:[t,{t:"span",a:{class:"bw_tooltip bw_tooltip_"+s,role:"tooltip"},c:a}],o:{type:"tooltip",mounted:function(e){var t=e.querySelector(".bw_tooltip");e.addEventListener("mouseenter",function(){t.classList.add("bw_tooltip_show")}),e.addEventListener("mouseleave",function(){t.classList.remove("bw_tooltip_show")}),e.addEventListener("focusin",function(){t.classList.add("bw_tooltip_show")}),e.addEventListener("focusout",function(){t.classList.remove("bw_tooltip_show")})}}}}function P(e={}){var{trigger:t,title:a,content:s,placement:c="top",className:n=""}=e,o=[a&&{t:"div",a:{class:"bw_popover_header"},c:a},s&&{t:"div",a:{class:"bw_popover_body"},c:s}].filter(Boolean);return{t:"span",a:{class:("bw_popover_wrapper "+n).trim()},c:[{t:"span",a:{class:"bw_popover_trigger",onclick:function(e){e.target.closest(".bw_popover_wrapper").querySelector(".bw_popover").classList.toggle("bw_popover_show")}},c:t},{t:"div",a:{class:"bw_popover bw_popover_"+c},c:o}],o:{type:"popover",mounted:function(e){var t=function(t){if(!e.contains(t.target)){var a=e.querySelector(".bw_popover");a&&a.classList.remove("bw_popover_show")}};document.addEventListener("click",t),e._bw_outsideHandler=t},unmount:function(e){e._bw_outsideHandler&&document.removeEventListener("click",e._bw_outsideHandler)}}}}function G(e={}){"string"==typeof e&&(e={placeholder:e});var{placeholder:t="Search...",value:a,onSearch:s,onInput:c,id:n,name:o,className:i=""}=e;return{t:"div",a:{class:("bw_search_input "+i).trim()},c:[{t:"input",a:{type:"search",class:"bw_form_control bw_search_field",placeholder:t,value:a,id:n,name:o,onkeydown:function(e){"Enter"===e.key&&s&&(e.preventDefault(),s(e.target.value))},oninput:function(e){var t=e.target.closest(".bw_search_input").querySelector(".bw_search_clear");t&&(t.style.display=e.target.value?"flex":"none"),c&&c(e.target.value)}}},{t:"button",a:{type:"button",class:"bw_search_clear","aria-label":"Clear search",style:a?void 0:"display: none",onclick:function(e){var t=e.target.closest(".bw_search_input").querySelector(".bw_search_field");t.value="",e.target.style.display="none",t.focus(),c&&c(""),s&&s("")}},c:"×"}],o:{type:"search-input"}}}function R(e={}){var{min:t=0,max:a=100,step:s=1,value:c=50,label:n,showValue:o=!1,id:i,name:r,disabled:l=!1,className:d="",..._}=e,b=[];if(n||o){var u=[];n&&u.push({t:"span",c:n}),o&&u.push({t:"span",a:{class:"bw_range_value"},c:""+c}),b.push({t:"div",a:{class:"bw_range_label"},c:u})}var m=_.oninput;return o&&(_.oninput=function(e){var t=e.target.closest(".bw_range_wrapper").querySelector(".bw_range_value");t&&(t.textContent=e.target.value),m&&m(e)}),b.push({t:"input",a:{type:"range",class:"bw_range",min:t,max:a,step:s,value:c,id:i,name:r,disabled:l,..._}}),{t:"div",a:{class:("bw_range_wrapper "+d).trim()},c:b,o:{type:"range"}}}function F(e={}){var{src:t,alt:a="",title:s,content:c,reverse:n=!1,imageSize:o="3rem",className:i=""}=e,r=t?{t:"img",a:{class:"bw_media_img",src:t,alt:a,style:"width:"+o+";height:"+o}}:null,l={t:"div",a:{class:"bw_media_body"},c:[s&&{t:"h5",a:{class:"bw_media_title"},c:s},c].filter(Boolean)};return{t:"div",a:{class:("bw_media "+(n?"bw_media_reverse ":"")+i).trim()},c:n?[l,r].filter(Boolean):[r,l].filter(Boolean),o:{type:"media-object"}}}function M(e={}){var{accept:t,multiple:a=!1,onFiles:s,text:c="Drop files here or click to browse",id:n,className:o=""}=e;return{t:"div",a:{class:("bw_file_upload "+o).trim(),tabindex:"0",role:"button","aria-label":c},c:[{t:"div",a:{class:"bw_file_upload_icon"},c:"📁"},{t:"div",a:{class:"bw_file_upload_text"},c:c},{t:"input",a:{type:"file",class:"bw_file_upload_input",accept:t,multiple:a,id:n,onchange:function(e){s&&e.target.files.length&&s(e.target.files)}}}],o:{type:"file-upload",mounted:function(e){var t=e.querySelector(".bw_file_upload_input");e.addEventListener("click",function(e){e.target!==t&&t.click()}),e.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),e.addEventListener("dragover",function(t){t.preventDefault(),e.classList.add("bw_file_upload_active")}),e.addEventListener("dragleave",function(){e.classList.remove("bw_file_upload_active")}),e.addEventListener("drop",function(t){t.preventDefault(),e.classList.remove("bw_file_upload_active"),s&&t.dataTransfer.files.length&&s(t.dataTransfer.files)})}}}}function U(t={}){var{items:a=[],className:s=""}=t;return{t:"div",a:{class:("bw_timeline "+s).trim()},c:a.map(function(t){return{t:"div",a:{class:"bw_timeline_item"},c:[{t:"div",a:{class:"bw_timeline_marker "+e(t.variant||"primary")}},{t:"div",a:{class:"bw_timeline_content"},c:[t.date&&{t:"div",a:{class:"bw_timeline_date"},c:t.date},t.title&&{t:"h5",a:{class:"bw_timeline_title"},c:t.title},t.content&&("string"==typeof t.content?{t:"p",a:{class:"bw_timeline_text"},c:t.content}:t.content)].filter(Boolean)}]}}),o:{type:"timeline"}}}function X(e={}){var{steps:t=[],currentStep:a=0,className:s=""}=e;return{t:"div",a:{class:("bw_stepper "+s).trim(),role:"list"},c:t.map(function(e,t){var s=t<a?"completed":t===a?"active":"pending";return{t:"div",a:{class:"bw_step bw_step_"+s,role:"listitem","aria-current":"active"===s?"step":void 0},c:[{t:"div",a:{class:"bw_step_indicator"},c:"completed"===s?"✓":""+(t+1)},{t:"div",a:{class:"bw_step_body"},c:[{t:"div",a:{class:"bw_step_label"},c:e.label},e.description&&{t:"div",a:{class:"bw_step_description"},c:e.description}].filter(Boolean)}]}}),o:{type:"stepper"}}}function V(e={}){var{chips:t=[],placeholder:a="Add...",onAdd:s,onRemove:c,className:n=""}=e;return{t:"div",a:{class:("bw_chip_input "+n).trim()},c:[...t.map(function(e){return{t:"span",a:{class:"bw_chip","data-chip-value":e},c:[e,{t:"button",a:{type:"button",class:"bw_chip_remove","aria-label":"Remove "+e,onclick:function(e){var t=e.target.closest(".bw_chip"),a=t.getAttribute("data-chip-value");t.parentNode.removeChild(t),c&&c(a)}},c:"×"}]}}),{t:"input",a:{type:"text",class:"bw_chip_field",placeholder:a,onkeydown:function(e){if("Enter"===e.key&&e.target.value.trim()){e.preventDefault();var t=e.target.value.trim(),a=e.target.closest(".bw_chip_input"),n=document.createElement("span");n.className="bw_chip",n.setAttribute("data-chip-value",t),n.innerHTML="",n.textContent=t;var o=document.createElement("button");o.type="button",o.className="bw_chip_remove",o.setAttribute("aria-label","Remove "+t),o.textContent="×",o.onclick=function(){n.parentNode.removeChild(n),c&&c(t)},n.appendChild(o),a.insertBefore(n,e.target),e.target.value="",s&&s(t)}if("Backspace"===e.key&&!e.target.value){var i=(a=e.target.closest(".bw_chip_input")).querySelectorAll(".bw_chip");if(i.length){var r=i[i.length-1],l=r.getAttribute("data-chip-value");r.parentNode.removeChild(r),c&&c(l)}}}}}],o:{type:"chip-input"}}}var J={card:{make:t},button:{make:a},container:{make:s},row:{make:c},col:{make:n},nav:{make:o},navbar:{make:i},tabs:{make:r},alert:{make:l},badge:{make:d},progress:{make:_},listGroup:{make:b},breadcrumb:{make:u},form:{make:m},formGroup:{make:p},input:{make:w},textarea:{make:v},select:{make:f},checkbox:{make:h},stack:{make:g},spinner:{make:k},hero:{make:y},featureGrid:{make:x},cta:{make:$},section:{make:L},codeDemo:{make:N},pagination:{make:C},radio:{make:B},buttonGroup:{make:A},accordion:{make:S},modal:{make:E},toast:{make:I},dropdown:{make:q},switch:{make:H},skeleton:{make:j},avatar:{make:D},carousel:{make:T},statCard:{make:z},tooltip:{make:O},popover:{make:P},searchInput:{make:G},range:{make:R},mediaObject:{make:F},fileUpload:{make:M},timeline:{make:U},stepper:{make:X},chipInput:{make:V}};function K(e,t){var a=J[e];if(!a)throw new Error('bw.make: unknown component type "'+e+'". Available: '+Object.keys(J).join(", "));var s=a.make(t||{});return s&&"object"==typeof s&&(s._bwFactory={type:e,props:t||{}}),s}var Q=Object.freeze({__proto__:null,BCCL:J,make:K,makeAccordion:S,makeAlert:l,makeAvatar:D,makeBadge:d,makeBreadcrumb:u,makeButton:a,makeButtonGroup:A,makeCTA:$,makeCard:t,makeCarousel:T,makeCheckbox:h,makeChipInput:V,makeCodeDemo:N,makeCol:n,makeContainer:s,makeDropdown:q,makeFeatureGrid:x,makeFileUpload:M,makeForm:m,makeFormGroup:p,makeHero:y,makeInput:w,makeListGroup:b,makeMediaObject:F,makeModal:E,makeNav:o,makeNavbar:i,makePagination:C,makePopover:P,makeProgress:_,makeRadio:B,makeRange:R,makeRow:c,makeSearchInput:G,makeSection:L,makeSelect:f,makeSkeleton:j,makeSpinner:k,makeStack:g,makeStatCard:z,makeStepper:X,makeSwitch:H,makeTabs:r,makeTextarea:v,makeTimeline:U,makeToast:I,makeTooltip:O,variantClass:e});
|
|
20
|
+
*/function e(e){return e?0===e.indexOf("outline")?"bw_btn_outline bw_"+e.replace(/^outline[_-]/,""):"bw_"+e:""}function t(t={}){const{title:a,subtitle:s,content:n,footer:c,header:o,image:i,imagePosition:r="top",variant:l,bordered:d=!0,shadow:_,hoverable:b=!1,className:u="",style:m,headerClass:p="",bodyClass:w="",footerClass:v=""}=t,f=["bw_card",e(l),_&&{none:"",sm:"bw_shadow_sm",md:"bw_shadow",lg:"bw_shadow_lg"}[_]||"",d?"":"bw_border_0",b?"bw_card_hoverable":"",u].filter(Boolean).join(" ").trim(),h=[o&&{t:"div",a:{class:`bw_card_header ${p}`.trim()},c:o},i&&("top"===r||"left"===r)&&{t:"img",a:{class:`bw_card_img_${r}`,src:i.src,alt:i.alt||""}},{t:"div",a:{class:`bw_card_body ${w}`.trim()},c:[a&&{t:"h5",a:{class:"bw_card_title"},c:a},s&&{t:"h6",a:{class:"bw_card_subtitle bw_mb_2 bw_text_muted"},c:s},n&&(Array.isArray(n)?n:[n])].flat().filter(Boolean)},i&&("bottom"===r||"right"===r)&&{t:"img",a:{class:`bw_card_img_${r}`,src:i.src,alt:i.alt||""}},c&&{t:"div",a:{class:`bw_card_footer ${v}`.trim()},c:c}].filter(Boolean);return!i||"left"!==r&&"right"!==r?{t:"div",a:{class:f,style:m},c:h,o:{type:"card",state:t.state||{}}}:{t:"div",a:{class:f,style:m},c:{t:"div",a:{class:"bw_row bw_g_0"},c:h},o:{type:"card",state:t.state||{}}}}function a(t={}){"string"==typeof t&&(t={text:t});const{text:a,variant:s="primary",size:n,disabled:c=!1,onclick:o,type:i="button",className:r="",style:l}=t;return{t:"button",a:{type:i,class:["bw_btn",e(s),n&&`bw_btn_${n}`,r].filter(Boolean).join(" "),disabled:c,onclick:o,style:l},c:a,o:{type:"button"}}}function s(e={}){const{fluid:t=!1,children:a,className:s=""}=e;return{t:"div",a:{class:`bw_container${t?"-fluid":""} ${s}`.trim()},c:a}}function n(e={}){const{children:t,className:a="",gap:s}=e;return{t:"div",a:{class:`bw_row ${s?`bw_g_${s}`:""} ${a}`.trim()},c:t}}function c(e={}){const{size:t,offset:a,push:s,pull:n,content:c,children:o,className:i=""}=e,r=[];return"object"==typeof t?Object.entries(t).forEach(([e,t])=>{"xs"===e?r.push(`bw_col_${t}`):r.push(`bw_col_${e}_${t}`)}):t?r.push(`bw_col_${t}`):r.push("bw_col"),a&&r.push(`bw_offset_${a}`),s&&r.push(`bw_push_${s}`),n&&r.push(`bw_pull_${n}`),{t:"div",a:{class:`${r.join(" ")} ${i}`.trim()},c:c||o}}function o(e={}){const{items:t=[],pills:a=!1,vertical:s=!1,className:n=""}=e;return{t:"ul",a:{class:`bw_nav ${a?"bw_nav_pills":"bw_nav_tabs"} ${s?"bw_nav_vertical":""} ${n}`.trim()},c:t.map(e=>({t:"li",a:{class:"bw_nav_item"},c:{t:"a",a:{href:e.href||"#",class:`bw_nav_link ${e.active?"active":""} ${e.disabled?"disabled":""}`.trim()},c:e.text}}))}}function i(e={}){const{brand:t,brandHref:a="#",items:s=[],dark:n=!0,className:c=""}=e;return{t:"nav",a:{class:`bw_navbar ${n?"bw_navbar_dark":"bw_navbar_light"} ${c}`.trim()},c:{t:"div",a:{class:"bw_container"},c:[t&&{t:"a",a:{href:a,class:"bw_navbar_brand"},c:t},s.length>0&&{t:"div",a:{class:"bw_navbar_nav"},c:s.map(e=>({t:"a",a:{href:e.href||"#",class:"bw_nav_link "+(e.active?"active":"")},c:e.text}))}].filter(Boolean)},o:{type:"navbar",state:{activeItem:s.findIndex(e=>e.active)}}}}function r(e={}){const{tabs:t=[],activeIndex:a=0}=e;let s=a;return t.forEach((e,t)=>{e.active&&(s=t)}),{t:"div",a:{class:"bw_tabs"},c:[{t:"ul",a:{class:"bw_nav bw_nav_tabs",role:"tablist"},c:t.map((e,t)=>({t:"li",a:{class:"bw_nav_item",role:"presentation"},c:{t:"button",a:{class:"bw_nav_link "+(t===s?"active":""),type:"button",role:"tab",tabindex:t===s?"0":"-1","aria-selected":t===s?"true":"false","data-tab-index":t,onclick:e=>{const t=e.target.closest(".bw_tabs"),a=t.querySelectorAll(".bw_nav_link"),s=t.querySelectorAll(".bw_tab_pane");a.forEach(e=>{e.classList.remove("active"),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1")}),s.forEach(e=>e.classList.remove("active")),e.target.classList.add("active"),e.target.setAttribute("aria-selected","true"),e.target.setAttribute("tabindex","0");s[parseInt(e.target.getAttribute("data-tab-index"))].classList.add("active")}},c:e.label}}))},{t:"div",a:{class:"bw_tab_content"},c:t.map((e,t)=>({t:"div",a:{class:"bw_tab_pane "+(t===s?"active":""),role:"tabpanel"},c:e.content}))}],o:{type:"tabs",state:{activeIndex:s},mounted:function(e){var t=e.querySelector('[role="tablist"]');t&&t.addEventListener("keydown",function(e){for(var a=t.querySelectorAll('[role="tab"]'),s=-1,n=0;n<a.length;n++)if(a[n]===e.target){s=n;break}if(-1!==s){var c=-1;"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),c=s>0?s-1:a.length-1):"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),c=s<a.length-1?s+1:0):"Home"===e.key?(e.preventDefault(),c=0):"End"===e.key&&(e.preventDefault(),c=a.length-1),c>=0&&(a[c].focus(),a[c].click())}})}}}}function l(t={}){"string"==typeof t&&(t={content:t});const{content:a,variant:s="info",dismissible:n=!1,className:c=""}=t;return{t:"div",a:{class:`bw_alert ${e(s)} ${n?"bw_alert_dismissible":""} ${c}`.trim(),role:"alert"},c:[a,n&&{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){var t=e.target.closest(".bw_alert");t&&t.remove()}},c:"×"}].filter(Boolean)}}function d(t={}){"string"==typeof t&&(t={text:t});const{text:a,variant:s="primary",size:n,pill:c=!1,className:o=""}=t,i="sm"===n?" bw_badge_sm":"lg"===n?" bw_badge_lg":"";return{t:"span",a:{class:`bw_badge ${e(s)}${i} ${c?"bw_badge_pill":""} ${o}`.trim()},c:a}}function _(t={}){const{value:a=0,max:s=100,variant:n="primary",striped:c=!1,animated:o=!1,label:i,height:r}=t,l=Math.round(a/s*100);return{t:"div",a:{class:"bw_progress",style:r?{height:`${r}px`}:void 0},c:{t:"div",a:{class:["bw_progress_bar",e(n),c&&"bw_progress_bar_striped",o&&"bw_progress_bar_animated"].filter(Boolean).join(" "),role:"progressbar",style:{width:`${l}%`},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":s},c:i||`${l}%`}}}function b(e={}){const{items:t=[],flush:a=!1,interactive:s=!1}=e;return{t:"div",a:{class:("bw_list_group "+(a?"bw_list_group_flush":"")).trim()},c:t.map(e=>{const t="object"==typeof e,a=t?e.text:e,n=!!t&&e.active,c=!!t&&e.disabled,o=t?e.href:null,i=t?e.onclick:null;return s||o||i?{t:"a",a:{class:["bw_list_group_item",n&&"active",c&&"disabled"].filter(Boolean).join(" "),href:o||"#",onclick:i||(e=>{o||e.preventDefault()}),style:c?"pointer-events: none; opacity: 0.65;":""},c:a}:{t:"div",a:{class:["bw_list_group_item",n&&"active",c&&"disabled"].filter(Boolean).join(" ")},c:a}})}}function u(e={}){const{items:t=[]}=e;return{t:"nav",a:{"aria-label":"breadcrumb"},c:{t:"ol",a:{class:"bw_breadcrumb"},c:t.map((e,t)=>({t:"li",a:{class:"bw_breadcrumb_item "+(e.active?"active":""),"aria-current":e.active?"page":void 0},c:e.active?e.text:{t:"a",a:{href:e.href||"#"},c:e.text}}))}}}function m(e={}){const{children:t,onsubmit:a,className:s=""}=e;return{t:"form",a:{class:s,onsubmit:a||(e=>e.preventDefault())},c:t}}function p(e={}){var{label:t,input:a,help:s,id:n,validation:c,feedback:o,required:i}=e,r=a;if(c&&a&&a.a){r={t:a.t,a:Object.assign({},a.a),c:a.c,o:a.o};var l="valid"===c?"bw_is_valid":"invalid"===c?"bw_is_invalid":"";l&&(r.a.class=((r.a.class||"")+" "+l).trim())}return{t:"div",a:{class:"bw_form_group"},c:[t&&{t:"label",a:{for:n,class:"bw_form_label"},c:i?[t,{t:"span",a:{class:"bw_text_danger bw_ms_1"},c:"*"}]:t},r,o&&c&&{t:"div",a:{class:"valid"===c?"bw_valid_feedback":"bw_invalid_feedback"},c:o},s&&{t:"small",a:{class:"bw_form_text bw_text_muted"},c:s}].filter(Boolean)}}function w(e={}){const{type:t="text",placeholder:a,value:s,id:n,name:c,disabled:o=!1,readonly:i=!1,required:r=!1,className:l="",style:d,..._}=e;return{t:"input",a:{type:t,class:`bw_form_control ${l}`.trim(),placeholder:a,value:s,id:n,name:c,style:d,disabled:o,readonly:i,required:r,..._}}}function v(e={}){const{placeholder:t,value:a,rows:s=3,id:n,name:c,disabled:o=!1,readonly:i=!1,required:r=!1,className:l="",...d}=e;return{t:"textarea",a:{class:`bw_form_control ${l}`.trim(),placeholder:t,rows:s,id:n,name:c,disabled:o,readonly:i,required:r,...d},c:a}}function f(e={}){const{options:t=[],value:a,id:s,name:n,disabled:c=!1,required:o=!1,className:i="",...r}=e;return{t:"select",a:{class:`bw_form_control ${i}`.trim(),id:s,name:n,disabled:c,required:o,...r},c:t.map(e=>({t:"option",a:{value:e.value,selected:e.value===a},c:e.text||e.value}))}}function h(e={}){const{label:t,checked:a=!1,id:s,name:n,disabled:c=!1,value:o,className:i="",...r}=e;return{t:"div",a:{class:`bw_form_check ${i}`.trim()},c:[{t:"input",a:{type:"checkbox",class:"bw_form_check_input",checked:a,id:s,name:n,disabled:c,value:o,...r}},t&&{t:"label",a:{class:"bw_form_check_label",for:s},c:t}].filter(Boolean)}}function g(e={}){const{children:t,direction:a="vertical",gap:s=3,className:n=""}=e;return{t:"div",a:{class:`bw_${"vertical"===a?"vstack":"hstack"} bw_gap_${s} ${n}`.trim()},c:t}}function k(t={}){const{variant:a="primary",size:s="md",type:n="border"}=t;return{t:"div",a:{class:`bw_spinner_${n} bw_spinner_${n}-${s} ${e(a)}`,role:"status"},c:{t:"span",a:{class:"bw_visually_hidden"},c:"Loading..."}}}function y(t={}){const{title:a,subtitle:s,content:n,variant:c="primary",size:o="lg",centered:i=!0,overlay:r=!1,backgroundImage:l,actions:d,className:_=""}=t,b={sm:"bw_py_3",md:"bw_py_4",lg:"bw_py_5",xl:"bw_py_6"};return{t:"section",a:{class:`bw_hero ${e(c)} ${b[o]||b.lg} ${i?"bw_text_center":""} ${_}`.trim(),style:l?`background-image: url('${l}'); background-size: cover; background-position: center;`:void 0},c:[r&&{t:"div",a:{class:"bw_hero_overlay"}},{t:"div",a:{class:"bw_container"},c:{t:"div",a:{class:"bw_hero_content"},c:[a&&{t:"h1",a:{class:"bw_hero_title bw_display_4 bw_mb_3"},c:a},s&&{t:"p",a:{class:"bw_hero_subtitle bw_lead bw_mb_4"},c:s},n,d&&{t:"div",a:{class:"bw_hero_actions bw_mt_4"},c:d}].filter(Boolean)}}].filter(Boolean)}}function x(e={}){const{features:t=[],columns:a=3,centered:s=!0,iconSize:n="3rem",className:c=""}=e,o="bw_col_md_"+12/a;return{t:"div",a:{class:`bw_feature_grid ${c}`.trim()},c:{t:"div",a:{class:"bw_row bw_g_4"},c:t.map(e=>({t:"div",a:{class:o},c:{t:"div",a:{class:"bw_feature "+(s?"bw_text_center":"")},c:[e.icon&&{t:"div",a:{class:"bw_feature_icon bw_mb_3 bw_text_primary",style:`font-size: ${n};`},c:e.icon},e.title&&{t:"h3",a:{class:"bw_feature_title bw_h5 bw_mb_2"},c:e.title},e.description&&{t:"p",a:{class:"bw_feature_description bw_text_muted"},c:e.description}].filter(Boolean)}}))}}}function $(e={}){const{title:t,description:a,actions:s,variant:n="light",centered:c=!0,className:o=""}=e;return{t:"section",a:{class:`bw_cta bw_bg_${n} bw_py_5 ${o}`.trim()},c:{t:"div",a:{class:"bw_container"},c:{t:"div",a:{class:"bw_cta_content "+(c?"bw_text_center":"")},c:[t&&{t:"h2",a:{class:"bw_cta_title bw_mb_3"},c:t},a&&{t:"p",a:{class:"bw_cta_description bw_lead bw_mb_4"},c:a},s&&{t:"div",a:{class:"bw_cta_actions"},c:s}].filter(Boolean)}}}}function L(e={}){const{title:t,subtitle:a,content:s,variant:n="default",spacing:c="md",className:o=""}=e,i={sm:"bw_py_3",md:"bw_py_4",lg:"bw_py_5",xl:"bw_py_6"};return{t:"section",a:{class:`bw_section ${i[c]||i.md} ${"default"!==n?`bw_bg_${n}`:""} ${o}`.trim()},c:{t:"div",a:{class:"bw_container"},c:[(t||a)&&{t:"div",a:{class:"bw_section_header bw_text_center bw_mb_5"},c:[t&&{t:"h2",a:{class:"bw_section_title"},c:t},a&&{t:"p",a:{class:"bw_section_subtitle bw_text_muted"},c:a}].filter(Boolean)},s].filter(Boolean)}}}function N(e={}){const{title:t,description:a,code:s,result:n,language:c="javascript"}=e;Math.random().toString(36).substr(2,9);const o=[{label:"Result",active:!0,content:n}];s&&o.push({label:"Code",content:{t:"div",a:{style:"position: relative;"},c:[{t:"button",a:{class:"bw_copy_btn bw_code_copy_btn",onclick:function(e){navigator.clipboard.writeText(s).then(function(){var t=e.target,a=t.textContent;t.textContent="Copied!",t.classList.add("bw_code_copy_btn_copied"),setTimeout(function(){t.textContent=a,t.classList.remove("bw_code_copy_btn_copied")},2e3)})}},c:"Copy"},"undefined"!=typeof globalThis&&void 0!==globalThis.bw&&"function"==typeof globalThis.bw.codeEditor?globalThis.bw.codeEditor({code:s,lang:"javascript"===c?"js":c,readOnly:!0,height:"auto"}):{t:"pre",a:{class:"bw_code_pre"},c:{t:"code",a:{class:`bw_code_block language-${c}`},c:s}}]}});return{t:"div",a:{class:"bw_code_demo"},c:[t&&{t:"h3",c:t},a&&{t:"p",a:{class:"bw_text_muted bw_mb_3"},c:a},r({tabs:o})].filter(Boolean)}}function C(e={}){const{pages:t=1,currentPage:a=1,onPageChange:s,size:n,className:c=""}=e;function o(e){return function(n){n.preventDefault(),e<1||e>t||e===a||s&&s(e)}}const i=[];i.push({t:"li",a:{class:("bw_page_item "+(a<=1?"bw_disabled":"")).trim()},c:{t:"button",a:{class:"bw_page_link",type:"button",onclick:o(a-1),"aria-label":"Previous",disabled:a<=1||void 0},c:"‹"}});for(var r=1;r<=t;r++)(function(e){i.push({t:"li",a:{class:("bw_page_item "+(e===a?"bw_active":"")).trim()},c:{t:"button",a:{class:"bw_page_link",type:"button",onclick:o(e),"aria-current":e===a?"page":void 0},c:""+e}})})(r);return i.push({t:"li",a:{class:("bw_page_item "+(a>=t?"bw_disabled":"")).trim()},c:{t:"button",a:{class:"bw_page_link",type:"button",onclick:o(a+1),"aria-label":"Next",disabled:a>=t||void 0},c:"›"}}),{t:"nav",a:{"aria-label":"Pagination"},c:{t:"ul",a:{class:`bw_pagination ${n?"bw_pagination_"+n:""} ${c}`.trim()},c:i}}}function B(e={}){const{label:t,name:a,value:s,checked:n=!1,id:c,disabled:o=!1,className:i="",...r}=e;return{t:"div",a:{class:`bw_form_check ${i}`.trim()},c:[{t:"input",a:{type:"radio",class:"bw_form_check_input",name:a,value:s,checked:n,id:c,disabled:o,...r}},t&&{t:"label",a:{class:"bw_form_check_label",for:c},c:t}].filter(Boolean)}}function A(e={}){const{children:t,size:a,vertical:s=!1,className:n=""}=e;return{t:"div",a:{class:`${s?"bw_btn_group_vertical":"bw_btn_group"} ${a?"bw_btn_group_"+a:""} ${n}`.trim(),role:"group"},c:t}}function S(e={}){const{items:t=[],multiOpen:a=!1,className:s=""}=e;return{t:"div",a:{class:`bw_accordion ${s}`.trim()},c:t.map(function(e,t){return{t:"div",a:{class:"bw_accordion_item"},c:[{t:"h2",a:{class:"bw_accordion_header"},c:{t:"button",a:{class:("bw_accordion_button "+(e.open?"":"bw_collapsed")).trim(),type:"button","aria-expanded":e.open?"true":"false","data-accordion-index":t,onclick:function(e){var t=e.target.closest(".bw_accordion_button"),s=t.closest(".bw_accordion"),n=t.closest(".bw_accordion_item"),c=n.querySelector(".bw_accordion_collapse"),o=c.classList.contains("bw_collapse_show");if(!a)for(var i=s.querySelectorAll(".bw_accordion_item"),r=0;r<i.length;r++)if(i[r]!==n){var l=i[r].querySelector(".bw_accordion_collapse"),d=i[r].querySelector(".bw_accordion_button");l.classList.contains("bw_collapse_show")&&(l.style.maxHeight=l.scrollHeight+"px",l.offsetHeight,l.style.maxHeight="0px",l.classList.remove("bw_collapse_show"),d.classList.add("bw_collapsed"),d.setAttribute("aria-expanded","false"))}if(o)c.style.maxHeight=c.scrollHeight+"px",c.offsetHeight,c.style.maxHeight="0px",c.classList.remove("bw_collapse_show"),t.classList.add("bw_collapsed"),t.setAttribute("aria-expanded","false");else{c.classList.add("bw_collapse_show"),c.style.maxHeight="0px",c.offsetHeight,c.style.maxHeight=c.scrollHeight+"px",t.classList.remove("bw_collapsed"),t.setAttribute("aria-expanded","true");var _=function(e){"max-height"===e.propertyName&&c.classList.contains("bw_collapse_show")&&(c.style.maxHeight="none"),c.removeEventListener("transitionend",_)};c.addEventListener("transitionend",_)}}},c:e.title}},{t:"div",a:{class:("bw_accordion_collapse "+(e.open?"bw_collapse_show":"")).trim()},c:{t:"div",a:{class:"bw_accordion_body"},c:e.content},o:e.open?{mounted:function(e){e.style.maxHeight="none"}}:void 0}]}}),o:{type:"accordion",state:{multiOpen:a}}}}function E(e={}){const{title:t,content:a,footer:s,size:n,closeButton:c=!0,onClose:o,className:i=""}=e;function r(e){var t=e.closest(".bw_modal");t&&(t.classList.remove("bw_modal_show"),document.body.style.overflow=""),o&&o()}return{t:"div",a:{class:`bw_modal ${i}`.trim()},c:{t:"div",a:{class:("bw_modal_dialog "+(n?"bw_modal_"+n:"")).trim()},c:{t:"div",a:{class:"bw_modal_content"},c:[(t||c)&&{t:"div",a:{class:"bw_modal_header"},c:[t&&{t:"h5",a:{class:"bw_modal_title"},c:t},c&&{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){r(e.target)}},c:"×"}].filter(Boolean)},a&&{t:"div",a:{class:"bw_modal_body"},c:a},s&&{t:"div",a:{class:"bw_modal_footer"},c:s}].filter(Boolean)}},o:{type:"modal",mounted:function(e){e.addEventListener("click",function(t){t.target===e&&r(e)});var t=function(t){"Escape"===t.key&&e.classList.contains("bw_modal_show")&&r(e)};document.addEventListener("keydown",t),e._bw_escHandler=t},unmount:function(e){e._bw_escHandler&&document.removeEventListener("keydown",e._bw_escHandler),document.body.style.overflow=""}}}}function I(t={}){const{title:a,content:s,variant:n="info",autoDismiss:c=!0,delay:o=5e3,position:i="top-right",className:r=""}=t;return{t:"div",a:{class:`bw_toast ${e(n)} ${r}`.trim(),role:"alert","data-position":i},c:[a&&{t:"div",a:{class:"bw_toast_header"},c:[{t:"strong",c:a},{t:"button",a:{type:"button",class:"bw_close","aria-label":"Close",onclick:function(e){var t=e.target.closest(".bw_toast");t&&(t.classList.add("bw_toast_hiding"),setTimeout(function(){t.parentNode&&t.parentNode.removeChild(t)},300))}},c:"×"}]},s&&{t:"div",a:{class:"bw_toast_body"},c:s}].filter(Boolean),o:{type:"toast",mounted:function(e){requestAnimationFrame(function(){e.classList.add("bw_toast_show")}),c&&setTimeout(function(){e.classList.add("bw_toast_hiding"),setTimeout(function(){e.parentNode&&e.parentNode.removeChild(e)},300)},o)}}}}function q(t={}){const{trigger:a,items:s=[],align:n="start",variant:c="primary",className:o=""}=t;var i;return i="string"==typeof a||void 0===a?{t:"button",a:{class:`bw_btn ${e(c)} bw_dropdown_toggle`,type:"button",onclick:function(e){e.target.closest(".bw_dropdown").querySelector(".bw_dropdown_menu").classList.toggle("bw_dropdown_show")}},c:a||"Dropdown"}:a,{t:"div",a:{class:`bw_dropdown ${o}`.trim()},c:[i,{t:"div",a:{class:("bw_dropdown_menu "+("end"===n?"bw_dropdown_menu_end":"")).trim()},c:s.map(function(e){return e.divider?{t:"hr",a:{class:"bw_dropdown_divider"}}:{t:"a",a:{class:("bw_dropdown_item "+(e.disabled?"disabled":"")).trim(),href:e.href||"#",onclick:e.disabled?void 0:function(t){e.href||t.preventDefault(),t.target.closest(".bw_dropdown").querySelector(".bw_dropdown_menu").classList.remove("bw_dropdown_show"),e.onclick&&e.onclick(t)}},c:e.text}})}],o:{type:"dropdown",mounted:function(e){var t=function(t){if(!e.contains(t.target)){var a=e.querySelector(".bw_dropdown_menu");a&&a.classList.remove("bw_dropdown_show")}};document.addEventListener("click",t),e._bw_outsideHandler=t},unmount:function(e){e._bw_outsideHandler&&document.removeEventListener("click",e._bw_outsideHandler)}}}}function H(e={}){const{label:t,checked:a=!1,id:s,name:n,disabled:c=!1,className:o="",...i}=e;return{t:"div",a:{class:`bw_form_check bw_form_switch ${o}`.trim()},c:[{t:"input",a:{type:"checkbox",class:"bw_form_check_input bw_switch_input",role:"switch",checked:a,id:s,name:n,disabled:c,...i}},t&&{t:"label",a:{class:"bw_form_check_label",for:s},c:t}].filter(Boolean)}}function j(e={}){const{variant:t="text",width:a,height:s,count:n=1,className:c=""}=e;if("circle"===t){var o=a||s||"3rem";return{t:"div",a:{class:`bw_skeleton bw_skeleton_circle ${c}`.trim(),style:{width:o,height:o}}}}if("rect"===t)return{t:"div",a:{class:`bw_skeleton bw_skeleton_rect ${c}`.trim(),style:{width:a||"100%",height:s||"120px"}}};if(1===n)return{t:"div",a:{class:`bw_skeleton bw_skeleton_text ${c}`.trim(),style:{width:a||"100%",height:s||"1em"}}};for(var i=[],r=0;r<n;r++)i.push({t:"div",a:{class:"bw_skeleton bw_skeleton_text",style:{width:r===n-1?"75%":a||"100%",height:s||"1em"}}});return{t:"div",a:{class:`bw_skeleton_group ${c}`.trim()},c:i}}function D(t={}){const{src:a,alt:s="",initials:n,size:c="md",variant:o="primary",className:i=""}=t;return a?{t:"img",a:{class:`bw_avatar bw_avatar_${c} ${i}`.trim(),src:a,alt:s}}:{t:"div",a:{class:`bw_avatar bw_avatar_${c} ${e(o)} ${i}`.trim()},c:n||""}}function T(e={}){const{items:t=[],showControls:a=!0,showIndicators:s=!0,autoPlay:n=!1,interval:c=5e3,height:o="300px",startIndex:i=0,className:r=""}=e;function l(e,t){var a=e.querySelectorAll(".bw_carousel_slide").length;t<0&&(t=a-1),t>=a&&(t=0),e.setAttribute("data-carousel-index",t),e.querySelector(".bw_carousel_track").style.transform="translateX(-"+100*t+"%)";for(var s=e.querySelectorAll(".bw_carousel_indicator"),n=0;n<s.length;n++)n===t?s[n].classList.add("active"):s[n].classList.remove("active")}var d=t.map(function(e){var t=[e.content,e.caption&&{t:"div",a:{class:"bw_carousel_caption"},c:e.caption}].filter(Boolean);return{t:"div",a:{class:"bw_carousel_slide"},c:1===t.length?t[0]:t}}),_=[{t:"div",a:{class:"bw_carousel_track",style:"transform: translateX(-"+100*i+"%)"},c:d}];return a&&t.length>1&&(_.push({t:"button",a:{class:"bw_carousel_control bw_carousel_control_prev",type:"button","aria-label":"Previous slide",onclick:function(e){var t=e.target.closest(".bw_carousel"),a=parseInt(t.getAttribute("data-carousel-index")||"0");l(t,a-1)}},c:{t:"img",a:{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e",alt:"",role:"presentation"}}}),_.push({t:"button",a:{class:"bw_carousel_control bw_carousel_control_next",type:"button","aria-label":"Next slide",onclick:function(e){var t=e.target.closest(".bw_carousel"),a=parseInt(t.getAttribute("data-carousel-index")||"0");l(t,a+1)}},c:{t:"img",a:{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e",alt:"",role:"presentation"}}})),s&&t.length>1&&_.push({t:"div",a:{class:"bw_carousel_indicators"},c:t.map(function(e,t){return{t:"button",a:{class:"bw_carousel_indicator"+(t===i?" active":""),type:"button","aria-label":"Go to slide "+(t+1),"data-slide-index":t,onclick:function(e){l(e.target.closest(".bw_carousel"),parseInt(e.target.getAttribute("data-slide-index")))}}}})}),{t:"div",a:{class:("bw_carousel "+r).trim(),style:"height: "+o,tabindex:"0","aria-roledescription":"carousel","data-carousel-index":i},c:_,o:{type:"carousel",state:{activeIndex:i,autoPlay:n,interval:c},mounted:function(e){if(e.addEventListener("keydown",function(t){var a=parseInt(e.getAttribute("data-carousel-index")||"0");"ArrowLeft"===t.key?(t.preventDefault(),l(e,a-1)):"ArrowRight"===t.key&&(t.preventDefault(),l(e,a+1))}),n){var t=setInterval(function(){var t=parseInt(e.getAttribute("data-carousel-index")||"0");l(e,t+1)},c);e._bw_carouselInterval=t,e.addEventListener("mouseenter",function(){e._bw_carouselInterval&&clearInterval(e._bw_carouselInterval)}),e.addEventListener("mouseleave",function(){e._bw_carouselInterval=setInterval(function(){var t=parseInt(e.getAttribute("data-carousel-index")||"0");l(e,t+1)},c)})}},unmount:function(e){e._bw_carouselInterval&&clearInterval(e._bw_carouselInterval)}}}}function z(t={}){"string"==typeof t&&(t={label:t});var{value:a=0,label:s,change:n,format:c,prefix:o,suffix:i,icon:r,variant:l,className:d="",style:_}=t;var b=["bw_stat_card",e(l),d].filter(Boolean).join(" ").trim(),u=[];return r&&u.push({t:"div",a:{class:"bw_stat_icon"},c:r}),u.push({t:"div",a:{class:"bw_stat_value"},c:function(e,t){if(o||i)return(o||"")+e+(i||"");switch(t){case"currency":return"$"+Number(e).toLocaleString();case"percent":return e+"%";case"number":return Number(e).toLocaleString();default:return""+e}}(a,c)}),s&&u.push({t:"div",a:{class:"bw_stat_label"},c:s}),null!=n&&u.push({t:"div",a:{class:"bw_stat_change "+(n>=0?"bw_stat_change_up":"bw_stat_change_down")},c:(n>=0?"↑ +":"↓ ")+n+"%"}),{t:"div",a:{class:b,style:_},c:u,o:{type:"stat-card"}}}function O(e={}){var{content:t,text:a="",placement:s="top",className:n=""}=e;return{t:"span",a:{class:("bw_tooltip_wrapper "+n).trim()},c:[t,{t:"span",a:{class:"bw_tooltip bw_tooltip_"+s,role:"tooltip"},c:a}],o:{type:"tooltip",mounted:function(e){var t=e.querySelector(".bw_tooltip");e.addEventListener("mouseenter",function(){t.classList.add("bw_tooltip_show")}),e.addEventListener("mouseleave",function(){t.classList.remove("bw_tooltip_show")}),e.addEventListener("focusin",function(){t.classList.add("bw_tooltip_show")}),e.addEventListener("focusout",function(){t.classList.remove("bw_tooltip_show")})}}}}function P(e={}){var{trigger:t,title:a,content:s,placement:n="top",className:c=""}=e,o=[a&&{t:"div",a:{class:"bw_popover_header"},c:a},s&&{t:"div",a:{class:"bw_popover_body"},c:s}].filter(Boolean);return{t:"span",a:{class:("bw_popover_wrapper "+c).trim()},c:[{t:"span",a:{class:"bw_popover_trigger",onclick:function(e){e.target.closest(".bw_popover_wrapper").querySelector(".bw_popover").classList.toggle("bw_popover_show")}},c:t},{t:"div",a:{class:"bw_popover bw_popover_"+n},c:o}],o:{type:"popover",mounted:function(e){var t=function(t){if(!e.contains(t.target)){var a=e.querySelector(".bw_popover");a&&a.classList.remove("bw_popover_show")}};document.addEventListener("click",t),e._bw_outsideHandler=t},unmount:function(e){e._bw_outsideHandler&&document.removeEventListener("click",e._bw_outsideHandler)}}}}function G(e={}){"string"==typeof e&&(e={placeholder:e});var{placeholder:t="Search...",value:a,onSearch:s,onInput:n,id:c,name:o,className:i=""}=e;return{t:"div",a:{class:("bw_search_input "+i).trim()},c:[{t:"input",a:{type:"search",class:"bw_form_control bw_search_field",placeholder:t,value:a,id:c,name:o,onkeydown:function(e){"Enter"===e.key&&s&&(e.preventDefault(),s(e.target.value))},oninput:function(e){var t=e.target.closest(".bw_search_input").querySelector(".bw_search_clear");t&&(t.style.display=e.target.value?"flex":"none"),n&&n(e.target.value)}}},{t:"button",a:{type:"button",class:"bw_search_clear","aria-label":"Clear search",style:a?void 0:"display: none",onclick:function(e){var t=e.target.closest(".bw_search_input").querySelector(".bw_search_field");t.value="",e.target.style.display="none",t.focus(),n&&n(""),s&&s("")}},c:"×"}],o:{type:"search-input"}}}function R(e={}){var{min:t=0,max:a=100,step:s=1,value:n=50,label:c,showValue:o=!1,id:i,name:r,disabled:l=!1,className:d="",..._}=e,b=[];if(c||o){var u=[];c&&u.push({t:"span",c:c}),o&&u.push({t:"span",a:{class:"bw_range_value"},c:""+n}),b.push({t:"div",a:{class:"bw_range_label"},c:u})}var m=_.oninput;return o&&(_.oninput=function(e){var t=e.target.closest(".bw_range_wrapper").querySelector(".bw_range_value");t&&(t.textContent=e.target.value),m&&m(e)}),b.push({t:"input",a:{type:"range",class:"bw_range",min:t,max:a,step:s,value:n,id:i,name:r,disabled:l,..._}}),{t:"div",a:{class:("bw_range_wrapper "+d).trim()},c:b,o:{type:"range"}}}function F(e={}){var{src:t,alt:a="",title:s,content:n,reverse:c=!1,imageSize:o="3rem",className:i=""}=e,r=t?{t:"img",a:{class:"bw_media_img",src:t,alt:a,style:"width:"+o+";height:"+o}}:null,l={t:"div",a:{class:"bw_media_body"},c:[s&&{t:"h5",a:{class:"bw_media_title"},c:s},n].filter(Boolean)};return{t:"div",a:{class:("bw_media "+(c?"bw_media_reverse ":"")+i).trim()},c:c?[l,r].filter(Boolean):[r,l].filter(Boolean),o:{type:"media-object"}}}function M(e={}){var{accept:t,multiple:a=!1,onFiles:s,text:n="Drop files here or click to browse",id:c,className:o=""}=e;return{t:"div",a:{class:("bw_file_upload "+o).trim(),tabindex:"0",role:"button","aria-label":n},c:[{t:"div",a:{class:"bw_file_upload_icon"},c:"📁"},{t:"div",a:{class:"bw_file_upload_text"},c:n},{t:"input",a:{type:"file",class:"bw_file_upload_input",accept:t,multiple:a,id:c,onchange:function(e){s&&e.target.files.length&&s(e.target.files)}}}],o:{type:"file-upload",mounted:function(e){var t=e.querySelector(".bw_file_upload_input");e.addEventListener("click",function(e){e.target!==t&&t.click()}),e.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),e.addEventListener("dragover",function(t){t.preventDefault(),e.classList.add("bw_file_upload_active")}),e.addEventListener("dragleave",function(){e.classList.remove("bw_file_upload_active")}),e.addEventListener("drop",function(t){t.preventDefault(),e.classList.remove("bw_file_upload_active"),s&&t.dataTransfer.files.length&&s(t.dataTransfer.files)})}}}}function U(t={}){var{items:a=[],className:s=""}=t;return{t:"div",a:{class:("bw_timeline "+s).trim()},c:a.map(function(t){return{t:"div",a:{class:"bw_timeline_item"},c:[{t:"div",a:{class:"bw_timeline_marker "+e(t.variant||"primary")}},{t:"div",a:{class:"bw_timeline_content"},c:[t.date&&{t:"div",a:{class:"bw_timeline_date"},c:t.date},t.title&&{t:"h5",a:{class:"bw_timeline_title"},c:t.title},t.content&&("string"==typeof t.content?{t:"p",a:{class:"bw_timeline_text"},c:t.content}:t.content)].filter(Boolean)}]}}),o:{type:"timeline"}}}function X(e={}){var{steps:t=[],currentStep:a=0,className:s=""}=e;return{t:"div",a:{class:("bw_stepper "+s).trim(),role:"list"},c:t.map(function(e,t){var s=t<a?"completed":t===a?"active":"pending";return{t:"div",a:{class:"bw_step bw_step_"+s,role:"listitem","aria-current":"active"===s?"step":void 0},c:[{t:"div",a:{class:"bw_step_indicator"},c:"completed"===s?"✓":""+(t+1)},{t:"div",a:{class:"bw_step_body"},c:[{t:"div",a:{class:"bw_step_label"},c:e.label},e.description&&{t:"div",a:{class:"bw_step_description"},c:e.description}].filter(Boolean)}]}}),o:{type:"stepper"}}}function V(e={}){var{chips:t=[],placeholder:a="Add...",onAdd:s,onRemove:n,className:c=""}=e;return{t:"div",a:{class:("bw_chip_input "+c).trim()},c:[...t.map(function(e){return{t:"span",a:{class:"bw_chip","data-chip-value":e},c:[e,{t:"button",a:{type:"button",class:"bw_chip_remove","aria-label":"Remove "+e,onclick:function(e){var t=e.target.closest(".bw_chip"),a=t.getAttribute("data-chip-value");t.parentNode.removeChild(t),n&&n(a)}},c:"×"}]}}),{t:"input",a:{type:"text",class:"bw_chip_field",placeholder:a,onkeydown:function(e){if("Enter"===e.key&&e.target.value.trim()){e.preventDefault();var t=e.target.value.trim(),a=e.target.closest(".bw_chip_input"),c=document.createElement("span");c.className="bw_chip",c.setAttribute("data-chip-value",t),c.innerHTML="",c.textContent=t;var o=document.createElement("button");o.type="button",o.className="bw_chip_remove",o.setAttribute("aria-label","Remove "+t),o.textContent="×",o.onclick=function(){c.parentNode.removeChild(c),n&&n(t)},c.appendChild(o),a.insertBefore(c,e.target),e.target.value="",s&&s(t)}if("Backspace"===e.key&&!e.target.value){var i=(a=e.target.closest(".bw_chip_input")).querySelectorAll(".bw_chip");if(i.length){var r=i[i.length-1],l=r.getAttribute("data-chip-value");r.parentNode.removeChild(r),n&&n(l)}}}}}],o:{type:"chip-input"}}}var J={card:{make:t},button:{make:a},container:{make:s},row:{make:n},col:{make:c},nav:{make:o},navbar:{make:i},tabs:{make:r},alert:{make:l},badge:{make:d},progress:{make:_},listGroup:{make:b},breadcrumb:{make:u},form:{make:m},formGroup:{make:p},input:{make:w},textarea:{make:v},select:{make:f},checkbox:{make:h},stack:{make:g},spinner:{make:k},hero:{make:y},featureGrid:{make:x},cta:{make:$},section:{make:L},codeDemo:{make:N},pagination:{make:C},radio:{make:B},buttonGroup:{make:A},accordion:{make:S},modal:{make:E},toast:{make:I},dropdown:{make:q},switch:{make:H},skeleton:{make:j},avatar:{make:D},carousel:{make:T},statCard:{make:z},tooltip:{make:O},popover:{make:P},searchInput:{make:G},range:{make:R},mediaObject:{make:F},fileUpload:{make:M},timeline:{make:U},stepper:{make:X},chipInput:{make:V}};function K(e,t){var a=J[e];if(!a)throw new Error('bw.make: unknown component type "'+e+'". Available: '+Object.keys(J).join(", "));var s=a.make(t||{});return s&&"object"==typeof s&&(s._bwFactory={type:e,props:t||{}}),s}var Q=Object.freeze({__proto__:null,BCCL:J,make:K,makeAccordion:S,makeAlert:l,makeAvatar:D,makeBadge:d,makeBreadcrumb:u,makeButton:a,makeButtonGroup:A,makeCTA:$,makeCard:t,makeCarousel:T,makeCheckbox:h,makeChipInput:V,makeCodeDemo:N,makeCol:c,makeContainer:s,makeDropdown:q,makeFeatureGrid:x,makeFileUpload:M,makeForm:m,makeFormGroup:p,makeHero:y,makeInput:w,makeListGroup:b,makeMediaObject:F,makeModal:E,makeNav:o,makeNavbar:i,makePagination:C,makePopover:P,makeProgress:_,makeRadio:B,makeRange:R,makeRow:n,makeSearchInput:G,makeSection:L,makeSelect:f,makeSkeleton:j,makeSpinner:k,makeStack:g,makeStatCard:z,makeStepper:X,makeSwitch:H,makeTabs:r,makeTextarea:v,makeTimeline:U,makeToast:I,makeTooltip:O,variantClass:e});
|
|
21
21
|
/**
|
|
22
22
|
* bitwrench-bccl-entry.js — Standalone entry point for BCCL component library.
|
|
23
23
|
*
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
*
|
|
37
37
|
* @module bitwrench-bccl
|
|
38
38
|
* @license BSD-2-Clause
|
|
39
|
-
*/function W(t){t&&(Object.entries(Q).forEach(function(e){var a=e[0],s=e[1];0===a.indexOf("make")&&(t[a]=s)}),t.make=K,t.BCCL=J,t.variantClass=e,"function"==typeof t.renderComponent&&Object.entries(Q).forEach(function(e){var a=e[0],s=e[1];if(0===a.indexOf("make")){var
|
|
39
|
+
*/function W(t){t&&(Object.entries(Q).forEach(function(e){var a=e[0],s=e[1];0===a.indexOf("make")&&(t[a]=s)}),t.make=K,t.BCCL=J,t.variantClass=e,"function"==typeof t.renderComponent&&Object.entries(Q).forEach(function(e){var a=e[0],s=e[1];if(0===a.indexOf("make")){var n="create"+a.substring(4);t[n]=function(e){var a=s(e);return t.renderComponent(a)}}}))}"undefined"!=typeof window&&void 0!==window.bw?W(window.bw):"undefined"!=typeof globalThis&&void 0!==globalThis.bw&&W(globalThis.bw),exports.BCCL=J,exports.make=K,exports.registerBCCL=W,exports.variantClass=e;
|
|
40
40
|
//# sourceMappingURL=bitwrench-bccl.cjs.min.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! bitwrench-bccl v2.0.
|
|
1
|
+
/*! bitwrench-bccl v2.0.18 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
|
|
2
2
|
/**
|
|
3
3
|
* Bitwrench v2 Components
|
|
4
4
|
*
|
|
@@ -328,7 +328,7 @@ function makeCol(props = {}) {
|
|
|
328
328
|
if (breakpoint === 'xs') {
|
|
329
329
|
classes.push(`bw_col_${value}`);
|
|
330
330
|
} else {
|
|
331
|
-
classes.push(`bw_col_${breakpoint}
|
|
331
|
+
classes.push(`bw_col_${breakpoint}_${value}`);
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
334
|
} else if (size) {
|
|
@@ -1711,8 +1711,8 @@ function makePagination(props = {}) {
|
|
|
1711
1711
|
t: 'li',
|
|
1712
1712
|
a: { class: `bw_page_item ${currentPage <= 1 ? 'bw_disabled' : ''}`.trim() },
|
|
1713
1713
|
c: {
|
|
1714
|
-
t: '
|
|
1715
|
-
a: { class: 'bw_page_link',
|
|
1714
|
+
t: 'button',
|
|
1715
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(currentPage - 1), 'aria-label': 'Previous', disabled: currentPage <= 1 ? true : undefined },
|
|
1716
1716
|
c: '\u2039'
|
|
1717
1717
|
}
|
|
1718
1718
|
});
|
|
@@ -1724,8 +1724,8 @@ function makePagination(props = {}) {
|
|
|
1724
1724
|
t: 'li',
|
|
1725
1725
|
a: { class: `bw_page_item ${pageNum === currentPage ? 'bw_active' : ''}`.trim() },
|
|
1726
1726
|
c: {
|
|
1727
|
-
t: '
|
|
1728
|
-
a: { class: 'bw_page_link',
|
|
1727
|
+
t: 'button',
|
|
1728
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(pageNum), 'aria-current': pageNum === currentPage ? 'page' : undefined },
|
|
1729
1729
|
c: '' + pageNum
|
|
1730
1730
|
}
|
|
1731
1731
|
});
|
|
@@ -1737,8 +1737,8 @@ function makePagination(props = {}) {
|
|
|
1737
1737
|
t: 'li',
|
|
1738
1738
|
a: { class: `bw_page_item ${currentPage >= pages ? 'bw_disabled' : ''}`.trim() },
|
|
1739
1739
|
c: {
|
|
1740
|
-
t: '
|
|
1741
|
-
a: { class: 'bw_page_link',
|
|
1740
|
+
t: 'button',
|
|
1741
|
+
a: { class: 'bw_page_link', type: 'button', onclick: handleClick(currentPage + 1), 'aria-label': 'Next', disabled: currentPage >= pages ? true : undefined },
|
|
1742
1742
|
c: '\u203A'
|
|
1743
1743
|
}
|
|
1744
1744
|
});
|