bitwrench 2.0.24 → 2.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +8 -6
  2. package/dist/bitwrench-bccl.cjs.js +1 -1
  3. package/dist/bitwrench-bccl.cjs.min.js +1 -1
  4. package/dist/bitwrench-bccl.cjs.min.js.gz +0 -0
  5. package/dist/bitwrench-bccl.esm.js +1 -1
  6. package/dist/bitwrench-bccl.esm.min.js +1 -1
  7. package/dist/bitwrench-bccl.esm.min.js.gz +0 -0
  8. package/dist/bitwrench-bccl.umd.js +1 -1
  9. package/dist/bitwrench-bccl.umd.min.js +1 -1
  10. package/dist/bitwrench-bccl.umd.min.js.gz +0 -0
  11. package/dist/bitwrench-code-edit.cjs.js +1 -1
  12. package/dist/bitwrench-code-edit.cjs.min.js +1 -1
  13. package/dist/bitwrench-code-edit.es5.js +1 -1
  14. package/dist/bitwrench-code-edit.es5.min.js +1 -1
  15. package/dist/bitwrench-code-edit.esm.js +1 -1
  16. package/dist/bitwrench-code-edit.esm.min.js +1 -1
  17. package/dist/bitwrench-code-edit.umd.js +1 -1
  18. package/dist/bitwrench-code-edit.umd.min.js +1 -1
  19. package/dist/bitwrench-code-edit.umd.min.js.gz +0 -0
  20. package/dist/bitwrench-debug.js +1 -1
  21. package/dist/bitwrench-debug.min.js +1 -1
  22. package/dist/bitwrench-lean.cjs.js +41 -22
  23. package/dist/bitwrench-lean.cjs.min.js +4 -4
  24. package/dist/bitwrench-lean.cjs.min.js.gz +0 -0
  25. package/dist/bitwrench-lean.es5.js +43 -24
  26. package/dist/bitwrench-lean.es5.min.js +4 -4
  27. package/dist/bitwrench-lean.es5.min.js.gz +0 -0
  28. package/dist/bitwrench-lean.esm.js +41 -22
  29. package/dist/bitwrench-lean.esm.min.js +4 -4
  30. package/dist/bitwrench-lean.esm.min.js.gz +0 -0
  31. package/dist/bitwrench-lean.umd.js +41 -22
  32. package/dist/bitwrench-lean.umd.min.js +4 -4
  33. package/dist/bitwrench-lean.umd.min.js.gz +0 -0
  34. package/dist/bitwrench-util-css.cjs.js +1 -1
  35. package/dist/bitwrench-util-css.cjs.min.js +1 -1
  36. package/dist/bitwrench-util-css.es5.js +1 -1
  37. package/dist/bitwrench-util-css.es5.min.js +1 -1
  38. package/dist/bitwrench-util-css.esm.js +1 -1
  39. package/dist/bitwrench-util-css.esm.min.js +1 -1
  40. package/dist/bitwrench-util-css.umd.js +1 -1
  41. package/dist/bitwrench-util-css.umd.min.js +1 -1
  42. package/dist/bitwrench-util-css.umd.min.js.gz +0 -0
  43. package/dist/bitwrench.cjs.js +41 -22
  44. package/dist/bitwrench.cjs.min.js +6 -6
  45. package/dist/bitwrench.cjs.min.js.gz +0 -0
  46. package/dist/bitwrench.css +6 -6
  47. package/dist/bitwrench.d.ts +659 -0
  48. package/dist/bitwrench.es5.js +43 -24
  49. package/dist/bitwrench.es5.min.js +4 -4
  50. package/dist/bitwrench.es5.min.js.gz +0 -0
  51. package/dist/bitwrench.esm.js +41 -22
  52. package/dist/bitwrench.esm.min.js +4 -4
  53. package/dist/bitwrench.esm.min.js.gz +0 -0
  54. package/dist/bitwrench.min.css +1 -1
  55. package/dist/bitwrench.umd.js +41 -22
  56. package/dist/bitwrench.umd.min.js +6 -6
  57. package/dist/bitwrench.umd.min.js.gz +0 -0
  58. package/dist/builds.json +87 -87
  59. package/dist/bwserve.cjs.js +2 -2
  60. package/dist/bwserve.esm.js +2 -2
  61. package/dist/sri.json +46 -46
  62. package/docs/README.md +5 -3
  63. package/docs/bitwrench-mcp.md +1 -1
  64. package/docs/bitwrench-taco-schema-discussion.md +694 -0
  65. package/docs/bitwrench_api.md +4 -4
  66. package/docs/bitwrench_typescript_usage.md +441 -0
  67. package/docs/component-cheatsheet.md +1 -1
  68. package/docs/framework-translation-table.md +1 -1
  69. package/docs/llm-bitwrench-guide.md +28 -1
  70. package/docs/routing.md +1 -1
  71. package/docs/thinking-in-bitwrench.md +3 -3
  72. package/docs/tutorial-bwserve.md +1 -1
  73. package/docs/tutorial-website.md +1 -1
  74. package/package.json +7 -3
  75. package/readme.html +14 -8
  76. package/src/bitwrench-styles.js +17 -17
  77. package/src/bitwrench.d.ts +659 -0
  78. package/src/bitwrench.js +21 -2
  79. package/src/cli/serve.js +1 -0
  80. package/src/mcp/live.js +3 -1
  81. package/src/mcp/server.js +7 -7
  82. package/src/version.js +3 -3
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
4
4
  [![NPM version](https://img.shields.io/npm/v/bitwrench.svg?style=flat-square)](https://www.npmjs.com/package/bitwrench)
5
5
  [![CI](https://github.com/deftio/bitwrench/actions/workflows/ci.yml/badge.svg)](https://github.com/deftio/bitwrench/actions/workflows/ci.yml)
6
- [![Coverage](https://img.shields.io/badge/coverage-96.3%25-brightgreen.svg)](https://github.com/deftio/bitwrench)
6
+ [![Coverage](https://img.shields.io/badge/coverage-97.3%25-brightgreen.svg)](https://github.com/deftio/bitwrench)
7
7
 
8
8
  [![bitwrench](./images/bitwrench-logo-med.png)](https://deftio.github.io/bitwrench/pages/)
9
9
 
@@ -33,13 +33,14 @@ Each object has four keys: **t** (tag), **a** (attributes), **c** (content), **o
33
33
  Structure, styling, state, and server rendering are all handled as JavaScript objects:
34
34
 
35
35
  - **No build toolchain** -- works with a `<script>` tag
36
- - **50+ ready-made components** -- buttons, tables, modals, forms, charts, toasts -- one `make*()` call each, returns a composable TACO
36
+ - **Ready-made components** -- buttons, tables, modals, forms, charts, toasts -- one `make*()` call each, returns a composable TACO
37
37
  - **CSS from JavaScript** -- `bw.css()` generates stylesheets, `bw.s()` composes inline styles, `bw.loadStyles()` derives a complete design system from 2 seed colors
38
38
  - **Reactive state** -- `o.state` + `o.render` + `bw.update()` for stateful components; `bw.pub()`/`bw.sub()` for cross-component messaging
39
39
  - **Dual rendering** -- same object renders to live DOM (`bw.DOM()`) or HTML string (`bw.html()`) for SSR, emails, or static sites
40
40
  - **Server-driven UI** -- push UI updates from any backend (Python, C, Rust, Go) over SSE via the biwrench bwserve protocol; `client.screenshot()` captures the page back as PNG/JPEG
41
41
  - **CLI** -- `bwcli` converts Markdown, HTML, and JSON to styled standalone pages
42
42
  - **Debug tools** -- live client and server debugging with remote incremental inspect, screenshots, and state updates
43
+ - **TypeScript** -- full type declarations ship with the package (`dist/bitwrench.d.ts`); see the [TypeScript Usage Guide](docs/bitwrench_typescript_usage.md)
43
44
  - **Utilities** -- color interpolation, random data, lorem ipsum, cookies, URL params, file I/O
44
45
 
45
46
 
@@ -58,6 +59,7 @@ Bitwrench uses JavaScript equivalents for most forms of front-end development. H
58
59
  | Streamlit / Gradio | Server-driven UI | bwserve SSE -- from any language (Python, Go, C, Rust) |
59
60
  | Redux / Zustand / Pinia | State management | `o.state` + `bw.update()` + `bw.pub()/sub()` |
60
61
  | Vite / webpack / Babel | Build tooling | Not needed -- open the HTML file |
62
+ | DefinitelyTyped / @types | Type declarations | Ships `dist/bitwrench.d.ts` -- nothing extra to install |
61
63
 
62
64
  See the [Framework Translation Table](docs/framework-translation-table.md) for side-by-side code comparisons across 22 operations.
63
65
 
@@ -264,7 +266,7 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
264
266
 
265
267
  - [TACO Format](docs/taco-format.md) -- the `{t, a, c, o}` object format
266
268
  - [State Management](docs/state-management.md) -- three-level component model, stateful TACO, reactive state
267
- - [Component Library](docs/component-library.md) -- all 50+ `make*()` functions with signatures and examples
269
+ - [Component Library](docs/component-library.md) -- all `make*()` functions with signatures and examples
268
270
  - [Theming](docs/theming.md) -- palette-driven theme generation, presets, design tokens
269
271
  - [CLI](docs/cli.md) -- the `bwcli` command for file conversion and pipe server
270
272
  - [bwserve](docs/bwserve.md) -- server-driven UI protocol (SSE, actions, embedded devices)
@@ -278,7 +280,7 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
278
280
  **Interactive demos** (live site):
279
281
 
280
282
  - [Quick Start](https://deftio.github.io/bitwrench/pages/00-quick-start.html) -- first steps with `bw.DOM()`
281
- - [Components](https://deftio.github.io/bitwrench/pages/01-components.html) -- all 50+ UI components with live demos
283
+ - [Components](https://deftio.github.io/bitwrench/pages/01-components.html) -- all UI components with live demos
282
284
  - [Styling & Theming](https://deftio.github.io/bitwrench/pages/03-styling.html) -- CSS generation, `bw.s()`, and theming strategies
283
285
  - [State & Interactivity](https://deftio.github.io/bitwrench/pages/05-state.html) -- state patterns and stateful TACO
284
286
  - [Tic Tac Toe Tutorial](https://deftio.github.io/bitwrench/pages/06-tic-tac-toe-tutorial.html) -- step-by-step game with state management
@@ -311,7 +313,7 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
311
313
 
312
314
  **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).
313
315
 
314
- **Can I use it with TypeScript?** -- Yes. Type declarations are included. TACO objects are plain JSON-compatible objects that TypeScript infers naturally.
316
+ **Can I use it with TypeScript?** -- Yes. Type declarations ship with the package (`dist/bitwrench.d.ts`). TACO objects are plain JSON-compatible objects that TypeScript infers naturally. See the [TypeScript Usage Guide](docs/bitwrench_typescript_usage.md) for import patterns, typed configs, and examples.
315
317
 
316
318
  **What about accessibility?** -- BCCL components emit semantic HTML with ARIA attributes where applicable. You can add any `aria-*` attribute via `a: { 'aria-label': '...' }`.
317
319
 
@@ -320,7 +322,7 @@ All formats include source maps. A separate CSS file (`bitwrench.css`) is also a
320
322
  ```bash
321
323
  npm install # install dev dependencies
322
324
  npm run build # build all dist formats (UMD, ESM, CJS, ES5)
323
- npm test # run unit tests (1400+ tests, 96% coverage)
325
+ npm test # run unit tests
324
326
  npm run test:cli # run CLI tests
325
327
  npm run test:e2e # run Playwright browser tests
326
328
  npm run lint # run ESLint
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  "use strict";
3
3
  /**
4
4
  * Bitwrench v2 Components
Binary file
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  /**
3
3
  * Bitwrench v2 Components
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  /**
3
3
  * Bitwrench v2 Components
4
4
  *
Binary file
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1,4 +1,4 @@
1
- /*! bitwrench-bccl v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-bccl v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).bwBCCL={})}(this,function(e){"use strict";
3
3
  /**
4
4
  * Bitwrench v2 Components
Binary file
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
3
3
  /**
4
4
  * bitwrench-code-edit.js - syntax-highlighted contenteditable code editor addon
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).bwCodeEdit={})}(this,function(e){"use strict";
3
3
  /**
4
4
  * bitwrench-code-edit.js - syntax-highlighted contenteditable code editor addon
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  /**
3
3
  * bitwrench-code-edit.js - syntax-highlighted contenteditable code editor addon
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  /**
3
3
  * bitwrench-code-edit.js - syntax-highlighted contenteditable code editor addon
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1,4 +1,4 @@
1
- /*! bitwrench v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).bwCodeEdit={})}(this,function(e){"use strict";
3
3
  /**
4
4
  * bitwrench-code-edit.js - syntax-highlighted contenteditable code editor addon
@@ -1,4 +1,4 @@
1
- /*! bitwrench-debug v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-debug v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -1,3 +1,3 @@
1
- /*! bitwrench-debug v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-debug v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).bwd=n()}(this,function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n={exports:{}};return function(e){!function(){var n={};function o(e){return new Promise(function(n,o){var t=document.createElement("script");t.src=e,t.onload=function(){n()},t.onerror=function(){o(new Error("Failed to load "+e))},document.head.appendChild(t)})}function t(e,n,o){if(!e||n>o)return null;var l={tag:e.tagName?e.tagName.toLowerCase():"#text"};if(e.id&&(l.id=e.id),e.className&&"string"==typeof e.className&&(l.cls=e.className.split(" ").slice(0,5).join(" ")),e.children&&e.children.length>0&&n<o){l.children=[];for(var i=0;i<Math.min(e.children.length,20);i++){var r=t(e.children[i],n+1,o);r&&l.children.push(r)}}return l}function l(e,n){if(e){var o=e.tag||"?";if(e.id&&(o+="#"+e.id),e.cls&&(o+="."+e.cls.split(" ").join(".")),console.log(" ".repeat(n)+o),e.children)for(var t=0;t<e.children.length;t++)l(e.children[t],n+1)}}var i={tree:function(e,n){e=e||"body",n=n||3;var o=document.querySelector(e);if(!o)return console.log('(no element found for "'+e+'")'),null;var i=t(o,0,n);return l(i,0),i},listen:function(e,o){var t=e+":::"+o;if(n[t])console.log("[bwd] already listening for "+o+" on "+e);else{var l=function(n){var t=n.target.closest?n.target.closest(e):null;t&&console.log("[bwd] "+o+" on "+e+" -> "+t.tagName+(t.id?"#"+t.id:"")+(t.textContent?' "'+t.textContent.slice(0,50).trim()+'"':""))};document.addEventListener(o,l,!0),n[t]={fn:l,event:o},console.log("[bwd] listening for "+o+" on "+e)}},unlisten:function(e,o){var t=e+":::"+o,l=n[t];l?(document.removeEventListener(l.event,l.fn,!0),delete n[t],console.log("[bwd] stopped listening for "+o+" on "+e)):console.log("[bwd] no listener for "+o+" on "+e)},state:function(e){e=e||".bw_lc";for(var n=document.querySelectorAll(e),o=[],t=0;t<n.length;t++){var l=n[t],i="";"undefined"!=typeof window&&window.bw&&window.bw.getUUID&&(i=window.bw.getUUID(l)||""),o.push({id:l.id||"",uuid:i,state:l._bw_state||null})}return 0===o.length?console.log('[bwd] no stateful elements found for "'+e+'"'):"function"==typeof console.table?console.table(o):console.log(o),o},screenshot:function(e){e=e||"body";var n=document.querySelector(e);return n?("undefined"!=typeof window&&window.html2canvas?Promise.resolve(window.html2canvas):o("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js").then(function(){return window.html2canvas})).then(function(o){return console.log("[bwd] capturing "+e+" ..."),o(n,{useCORS:!0})}).then(function(e){var n="screenshot-"+Date.now()+".png";e.toBlob(function(e){if("undefined"!=typeof window&&window.bw&&window.bw.saveClientFile)window.bw.saveClientFile(n,e);else{var o=document.createElement("a");o.href=URL.createObjectURL(e),o.download=n,o.click(),URL.revokeObjectURL(o.href)}console.log("[bwd] saved: "+n)})}).catch(function(e){console.error("[bwd] screenshot failed: "+e.message)}):(console.log('[bwd] no element found for "'+e+'"'),Promise.resolve(null))},_listeners:n};function r(){console.log("[bwd] bitwrench debug toolkit ready"),console.log(" bwd.tree(sel?, depth?) -- print DOM tree"),console.log(" bwd.listen(sel, event) -- log events"),console.log(" bwd.unlisten(sel, event) -- stop logging"),console.log(" bwd.state(sel?) -- dump stateful elements"),console.log(" bwd.screenshot(sel?) -- capture screenshot")}e.exports&&(e.exports=i),"undefined"!=typeof window&&(window.bwd=i),"undefined"!=typeof window&&(window.bw&&window.bw.version?r():(console.log("[bwd] bitwrench not detected, loading from CDN..."),o("https://cdn.jsdelivr.net/npm/bitwrench@2/dist/bitwrench.umd.min.js").then(function(){r()}).catch(function(e){console.warn("[bwd] could not load bitwrench: "+e.message),console.log("[bwd] toolkit ready (limited -- bw.* not available)"),console.log(" bwd.tree, bwd.listen, bwd.unlisten still work")})))}()}(n),e(n.exports)});
3
3
  //# sourceMappingURL=bitwrench-debug.min.js.map
@@ -1,4 +1,4 @@
1
- /*! bitwrench-lean v2.0.24 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-lean v2.0.25 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
2
  'use strict';
3
3
 
4
4
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -8,14 +8,14 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
8
8
  */
9
9
 
10
10
  const VERSION_INFO = {
11
- version: '2.0.24',
11
+ version: '2.0.25',
12
12
  name: 'bitwrench',
13
13
  description: 'A library for javascript UI functions.',
14
14
  license: 'BSD-2-Clause',
15
15
  homepage: 'https://deftio.github.com/bitwrench/pages',
16
16
  repository: 'git+https://github.com/deftio/bitwrench.git',
17
17
  author: 'manu a. chatterjee <deftio@deftio.com> (https://deftio.com/)',
18
- buildDate: '2026-03-28T09:12:50.073Z'
18
+ buildDate: '2026-03-31T03:03:30.752Z'
19
19
  };
20
20
 
21
21
  /**
@@ -705,7 +705,7 @@ function generateTypographyThemed(scope, palette, layout) {
705
705
  'transition': 'color ' + mot.fast + ' ' + mot.easing
706
706
  };
707
707
  rules[_sx(scope, 'a:hover')] = {
708
- 'color': palette.primary.hover,
708
+ 'color': palette.tertiary.hover,
709
709
  'text-decoration': 'underline'
710
710
  };
711
711
  return rules;
@@ -885,7 +885,7 @@ function generateNavigation(scope, palette, layout) {
885
885
  'transition': 'color ' + layout.motion.fast + ' ' + layout.motion.easing + ', background-color ' + layout.motion.fast + ' ' + layout.motion.easing
886
886
  };
887
887
  rules[_sx(scope, '.bw_navbar_nav .bw_nav_link:hover')] = {
888
- 'color': palette.dark.base,
888
+ 'color': palette.tertiary.base,
889
889
  'background-color': palette.surfaceAlt
890
890
  };
891
891
  rules[_sx(scope, '.bw_navbar_nav .bw_nav_link.active')] = {
@@ -966,7 +966,7 @@ function generateTabs(scope, palette, layout) {
966
966
  'transition': 'color ' + mo.fast + ' ' + mo.easing + ', border-color ' + mo.fast + ' ' + mo.easing + ', background-color ' + mo.fast + ' ' + mo.easing
967
967
  };
968
968
  rules[_sx(scope, '.bw_nav_tabs .bw_nav_link:hover')] = {
969
- 'color': palette.dark.base,
969
+ 'color': palette.tertiary.base,
970
970
  'background-color': palette.surfaceAlt,
971
971
  'border-bottom-color': palette.light.border
972
972
  };
@@ -992,7 +992,7 @@ function generateListGroups(scope, palette, layout) {
992
992
  };
993
993
  rules[_sx(scope, 'a.bw_list_group_item:hover')] = {
994
994
  'background-color': palette.surfaceAlt,
995
- 'color': palette.dark.hover
995
+ 'color': palette.tertiary.base
996
996
  };
997
997
  rules[_sx(scope, '.bw_list_group_item.active')] = {
998
998
  'color': palette.primary.textOn,
@@ -1089,11 +1089,11 @@ function generateBreadcrumbThemed(scope, palette, layout) {
1089
1089
  'color': palette.secondary.base
1090
1090
  };
1091
1091
  rules[_sx(scope, '.bw_breadcrumb_item a')] = {
1092
- 'color': palette.primary.base,
1092
+ 'color': palette.tertiary.base,
1093
1093
  'transition': 'color ' + mo.fast + ' ' + mo.easing
1094
1094
  };
1095
1095
  rules[_sx(scope, '.bw_breadcrumb_item a:hover')] = {
1096
- 'color': palette.primary.hover,
1096
+ 'color': palette.tertiary.hover,
1097
1097
  'text-decoration': 'underline'
1098
1098
  };
1099
1099
  rules[_sx(scope, '.bw_breadcrumb_item.active')] = {
@@ -1328,11 +1328,11 @@ function generateStepperThemed(scope, palette) {
1328
1328
  'font-weight': '600'
1329
1329
  };
1330
1330
  rules[_sx(scope, '.bw_step_completed .bw_step_indicator')] = {
1331
- 'background-color': palette.primary.base,
1332
- 'color': palette.primary.textOn
1331
+ 'background-color': palette.tertiary.base,
1332
+ 'color': palette.tertiary.textOn
1333
1333
  };
1334
- rules[_sx(scope, '.bw_step_completed .bw_step_label')] = { 'color': palette.primary.base };
1335
- rules[_sx(scope, '.bw_step_completed + .bw_step::before')] = { 'background-color': palette.primary.base };
1334
+ rules[_sx(scope, '.bw_step_completed .bw_step_label')] = { 'color': palette.tertiary.base };
1335
+ rules[_sx(scope, '.bw_step_completed + .bw_step::before')] = { 'background-color': palette.tertiary.base };
1336
1336
  return rules;
1337
1337
  }
1338
1338
 
@@ -1594,14 +1594,14 @@ function generatePaletteClasses(scope, palette) {
1594
1594
  };
1595
1595
  });
1596
1596
 
1597
- // Text muted — always a neutral gray, never a brand color
1598
- rules[_sx(scope, '.bw_text_muted')] = { 'color': '#6c757d' };
1597
+ // Text muted — uses palette secondary for theme-aware muted text
1598
+ rules[_sx(scope, '.bw_text_muted')] = { 'color': palette.secondary.base };
1599
1599
 
1600
- // Common bg/text utilities that aren't per-variant
1601
- rules[_sx(scope, '.bw_bg_dark')] = { 'background-color': '#212529', 'color': '#f8f9fa' };
1602
- rules[_sx(scope, '.bw_bg_light')] = { 'background-color': '#f8f9fa', 'color': '#212529' };
1603
- rules[_sx(scope, '.bw_text_light')] = { 'color': '#f8f9fa' };
1604
- rules[_sx(scope, '.bw_text_dark')] = { 'color': '#212529' };
1600
+ // Common bg/text utilities derive from palette for theme awareness
1601
+ rules[_sx(scope, '.bw_bg_dark')] = { 'background-color': palette.dark.base, 'color': palette.dark.textOn };
1602
+ rules[_sx(scope, '.bw_bg_light')] = { 'background-color': palette.light.base, 'color': palette.light.textOn };
1603
+ rules[_sx(scope, '.bw_text_light')] = { 'color': palette.light.base };
1604
+ rules[_sx(scope, '.bw_text_dark')] = { 'color': palette.dark.base };
1605
1605
 
1606
1606
  return rules;
1607
1607
  }
@@ -6252,7 +6252,8 @@ bw.applyStyles = function(styles, scope) {
6252
6252
  *
6253
6253
  * @param {Object} [config] - Style configuration (same as `makeStyles`)
6254
6254
  * @param {string} [scope] - Scope selector (same as `applyStyles`)
6255
- * @returns {Element|null} The `<style>` element, or null in Node.js
6255
+ * @returns {Object} The styles object (same as `makeStyles` return value:
6256
+ * `{css, alternateCss, palette, alternatePalette, rules, alternateRules, isLightPrimary}`)
6256
6257
  * @category CSS & Styling
6257
6258
  * @see bw.makeStyles
6258
6259
  * @see bw.applyStyles
@@ -6270,9 +6271,27 @@ bw.loadStyles = function(config, scope) {
6270
6271
  bw.injectCSS(structuralCSS, { id: 'bw_structural', append: false });
6271
6272
  }
6272
6273
  }
6273
- return bw.applyStyles(bw.makeStyles(config), scope);
6274
+ var styles = bw.makeStyles(config);
6275
+ bw.applyStyles(styles, scope);
6276
+ return styles;
6274
6277
  };
6275
6278
 
6279
+ /**
6280
+ * Prefix every selector in a rules object with a scope selector.
6281
+ * Useful for wrapping site-level CSS under `.bw_theme_alt` for dark mode.
6282
+ *
6283
+ * @param {Object} rules - CSS rules object (selector -> declarations)
6284
+ * @param {string} prefix - Scope prefix (e.g. '.bw_theme_alt')
6285
+ * @returns {Object} New rules object with scoped selectors
6286
+ * @category CSS & Styling
6287
+ * @see bw.applyStyles
6288
+ * @see bw.css
6289
+ * @example
6290
+ * var altRules = bw.scopeRulesUnder(myRules, '.bw_theme_alt');
6291
+ * bw.injectCSS(bw.css(altRules));
6292
+ */
6293
+ bw.scopeRulesUnder = scopeRulesUnder;
6294
+
6276
6295
  /**
6277
6296
  * Inject the CSS reset (box-sizing, html/body font, reduced-motion).
6278
6297
  * Idempotent — if already injected, returns the existing `<style>` element.