bitwrench 2.0.18 → 2.0.19
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 +86 -81
- package/dist/bitwrench-bccl.cjs.js +221 -48
- package/dist/bitwrench-bccl.cjs.min.js +3 -3
- package/dist/bitwrench-bccl.esm.js +221 -48
- package/dist/bitwrench-bccl.esm.min.js +3 -3
- package/dist/bitwrench-bccl.umd.js +221 -48
- package/dist/bitwrench-bccl.umd.min.js +3 -3
- package/dist/bitwrench-code-edit.cjs.js +7 -9
- package/dist/bitwrench-code-edit.cjs.min.js +5 -7
- package/dist/bitwrench-code-edit.es5.js +6 -8
- package/dist/bitwrench-code-edit.es5.min.js +5 -7
- package/dist/bitwrench-code-edit.esm.js +7 -9
- package/dist/bitwrench-code-edit.esm.min.js +5 -7
- package/dist/bitwrench-code-edit.umd.js +7 -9
- package/dist/bitwrench-code-edit.umd.min.js +5 -7
- package/dist/bitwrench-debug.js +268 -0
- package/dist/bitwrench-debug.min.js +3 -0
- package/dist/bitwrench-lean.cjs.js +250 -1574
- package/dist/bitwrench-lean.cjs.min.js +6 -6
- package/dist/bitwrench-lean.es5.js +344 -1661
- package/dist/bitwrench-lean.es5.min.js +4 -4
- package/dist/bitwrench-lean.esm.js +250 -1574
- package/dist/bitwrench-lean.esm.min.js +6 -6
- package/dist/bitwrench-lean.umd.js +250 -1574
- package/dist/bitwrench-lean.umd.min.js +6 -6
- package/dist/bitwrench-util-css.cjs.js +1 -1
- package/dist/bitwrench-util-css.cjs.min.js +1 -1
- package/dist/bitwrench-util-css.es5.js +1 -1
- package/dist/bitwrench-util-css.es5.min.js +1 -1
- package/dist/bitwrench-util-css.esm.js +1 -1
- package/dist/bitwrench-util-css.esm.min.js +1 -1
- package/dist/bitwrench-util-css.umd.js +1 -1
- package/dist/bitwrench-util-css.umd.min.js +1 -1
- package/dist/bitwrench.cjs.js +510 -1660
- package/dist/bitwrench.cjs.min.js +7 -7
- package/dist/bitwrench.css +80 -33
- package/dist/bitwrench.es5.js +569 -1694
- package/dist/bitwrench.es5.min.js +5 -5
- package/dist/bitwrench.esm.js +510 -1660
- package/dist/bitwrench.esm.min.js +7 -7
- package/dist/bitwrench.min.css +1 -1
- package/dist/bitwrench.umd.js +510 -1660
- package/dist/bitwrench.umd.min.js +7 -7
- package/dist/builds.json +133 -111
- package/dist/bwserve.cjs.js +2 -2
- package/dist/bwserve.esm.js +2 -2
- package/dist/sri.json +46 -44
- package/package.json +5 -3
- package/readme.html +86 -75
- package/src/bitwrench-bccl-entry.js +3 -4
- package/src/bitwrench-bccl.js +217 -43
- package/src/bitwrench-code-edit.js +6 -8
- package/src/bitwrench-debug.js +245 -0
- package/src/bitwrench-styles.js +35 -8
- package/src/bitwrench.js +212 -1563
- package/src/cli/attach.js +53 -21
- package/src/cli/serve.js +179 -3
- package/src/version.js +3 -3
package/dist/sri.json
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.0.
|
|
2
|
+
"version": "2.0.19",
|
|
3
3
|
"algorithm": "sha384",
|
|
4
|
-
"generated": "2026-03-
|
|
4
|
+
"generated": "2026-03-22",
|
|
5
5
|
"files": {
|
|
6
|
-
"bitwrench-bccl.cjs.js": "sha384-
|
|
7
|
-
"bitwrench-bccl.cjs.min.js": "sha384-
|
|
8
|
-
"bitwrench-bccl.esm.js": "sha384
|
|
9
|
-
"bitwrench-bccl.esm.min.js": "sha384-
|
|
10
|
-
"bitwrench-bccl.umd.js": "sha384-
|
|
11
|
-
"bitwrench-bccl.umd.min.js": "sha384-
|
|
12
|
-
"bitwrench-code-edit.cjs.js": "sha384-
|
|
13
|
-
"bitwrench-code-edit.cjs.min.js": "sha384-
|
|
14
|
-
"bitwrench-code-edit.es5.js": "sha384-
|
|
15
|
-
"bitwrench-code-edit.es5.min.js": "sha384-
|
|
16
|
-
"bitwrench-code-edit.esm.js": "sha384-
|
|
17
|
-
"bitwrench-code-edit.esm.min.js": "sha384-
|
|
18
|
-
"bitwrench-code-edit.umd.js": "sha384-
|
|
19
|
-
"bitwrench-code-edit.umd.min.js": "sha384-
|
|
20
|
-
"bitwrench-
|
|
21
|
-
"bitwrench-
|
|
22
|
-
"bitwrench-lean.
|
|
23
|
-
"bitwrench-lean.
|
|
24
|
-
"bitwrench-lean.
|
|
25
|
-
"bitwrench-lean.
|
|
26
|
-
"bitwrench-lean.
|
|
27
|
-
"bitwrench-lean.
|
|
28
|
-
"bitwrench-
|
|
29
|
-
"bitwrench-
|
|
30
|
-
"bitwrench-util-css.
|
|
31
|
-
"bitwrench-util-css.
|
|
32
|
-
"bitwrench-util-css.
|
|
33
|
-
"bitwrench-util-css.
|
|
34
|
-
"bitwrench-util-css.
|
|
35
|
-
"bitwrench-util-css.
|
|
36
|
-
"bitwrench.
|
|
37
|
-
"bitwrench.
|
|
38
|
-
"bitwrench.
|
|
39
|
-
"bitwrench.
|
|
40
|
-
"bitwrench.
|
|
41
|
-
"bitwrench.
|
|
42
|
-
"bitwrench.
|
|
43
|
-
"bitwrench.
|
|
44
|
-
"bitwrench.
|
|
45
|
-
"bitwrench.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
6
|
+
"bitwrench-bccl.cjs.js": "sha384-tU0kR6yE/u3qmVJF+fIubtL7W97PNaKveGiJMiIg73RTCUeV2d93+FZUeJJwbKeR",
|
|
7
|
+
"bitwrench-bccl.cjs.min.js": "sha384-KfaZ24lp6M/jMwVaZEvEn+OfZMD6op4JD/XzQr101IxcmXRMgU/3roJIEdabeOis",
|
|
8
|
+
"bitwrench-bccl.esm.js": "sha384-JflWSggVZ/DjXRtKAFpg3if7XkqGopeWIReqNpw78ykaS4QR37QSUF8UAH7tyJyg",
|
|
9
|
+
"bitwrench-bccl.esm.min.js": "sha384-ONbJiMmnhDvgv9LF81dsAOq7bOZ2FGvis4I+MUTpreFgZf5FY2Mv37tF+u8htIux",
|
|
10
|
+
"bitwrench-bccl.umd.js": "sha384-yX7TO/3TkBjjDoiRDcl/ImWorC70Ehxu+MdN1T5AH9K0zOEWUuF+6IbH99gESZu5",
|
|
11
|
+
"bitwrench-bccl.umd.min.js": "sha384-6UumjIdVjj8wm4sowabrDkqzc4uEuwezO0jeUaiK77++l51ih/22hS223HngMfYL",
|
|
12
|
+
"bitwrench-code-edit.cjs.js": "sha384-GHgg57SlYc4996n7w5j1RGcrq/XWw7HF0F0XXjaaTKi4IO1hIlZwcXW2tsqrjdq7",
|
|
13
|
+
"bitwrench-code-edit.cjs.min.js": "sha384-Gv1FU+M69IecIaQ/igevIBoqHB4PpeMY6/Bl2jyqTxQorKy9KvqTuGw2FB0E92Cc",
|
|
14
|
+
"bitwrench-code-edit.es5.js": "sha384-ujeo++ERLhCkk99i1x6GI9Jr1oq+/ZLlCQzt8y6s9w8J/Q9l7/s8rv1Vz3GeFGba",
|
|
15
|
+
"bitwrench-code-edit.es5.min.js": "sha384-ZQ8Vyp+ExE4clA7ifFhlgvyIAgnM7z7S7R/+XRiMR2Q8yyHTSUMYmKEAPusFhNF5",
|
|
16
|
+
"bitwrench-code-edit.esm.js": "sha384-6UTzDNd4crnmo4Ld1tOkxYEjFDKOtJb+7Teve02AX3n4seXORDnlX2Y4RFsfzoWD",
|
|
17
|
+
"bitwrench-code-edit.esm.min.js": "sha384-jiAOgUaRDsVj9pfdaRN/RIXrX916PtBXF5BqUJE4Ry3uVfhFOcOiRGPyA86riyJR",
|
|
18
|
+
"bitwrench-code-edit.umd.js": "sha384-xdQu8xl0kRbbBLzYXnHnv/QKx3bzWy4PvK0f2RG19wMDMS8tf1t2gzmLIDqShPh7",
|
|
19
|
+
"bitwrench-code-edit.umd.min.js": "sha384-8ZTHYUf23cc53on2HtJJHHoZuX+1yXceZCtCFGNKUhmh5PjTVxOT294e1SzSpr86",
|
|
20
|
+
"bitwrench-debug.js": "sha384-neWYtWf9EtBqAQ9/cPEMqD571dGQUGkw9Lt5eaowjIZaAbt11iwjUVJvhW9LsO9Q",
|
|
21
|
+
"bitwrench-debug.min.js": "sha384-XqGyvUcX0ZvxhXNQXrFpgYLRqAQimS2r2qX+YQzoT84TFhiIs7Qp8mxGVoBwjpyg",
|
|
22
|
+
"bitwrench-lean.cjs.js": "sha384-Kg93DwvfM8hR1S9WtTHoH+EFe+QVZXYJfh51wb94CDjDlz2ICUJKXpr5vCg3hGel",
|
|
23
|
+
"bitwrench-lean.cjs.min.js": "sha384-7ZxV5q0ctUGPNf5BrKagV1Z68Ton0RX9uveQqtUVi1LcwS3aogdYGptcUkh2Aj9r",
|
|
24
|
+
"bitwrench-lean.es5.js": "sha384-Gin1VqdtYyyYjKo5FPT4cgtckU+58IaEsidMRUXLEsA9M3YMf0fzSy+g8WSXh9PO",
|
|
25
|
+
"bitwrench-lean.es5.min.js": "sha384-UWrbdhA7gtrdC+pWKwip1maiSpE/LHKteaiFbJUYaD2ykJxaSv61VPzgE6LDwNCJ",
|
|
26
|
+
"bitwrench-lean.esm.js": "sha384-5vW+YpC4mNT9yt6TQqejl6VwNuK9SKcDTnWtPUe+j6MOROQWDajcJt6LsHM8Autz",
|
|
27
|
+
"bitwrench-lean.esm.min.js": "sha384-Saptfscrnk972hQwdcKn2dR91XxlbVU07fAa7nd3heO7GUorrYWZPAuPs//oAU4U",
|
|
28
|
+
"bitwrench-lean.umd.js": "sha384-ZYBAIjnRhx0DkTN4wwTGv/amPB+5AtaOlpLuoss3+bog6HqU2huJdLOjNTBYXTCJ",
|
|
29
|
+
"bitwrench-lean.umd.min.js": "sha384-Vz3fKgDKXX+dtuo1nh+u/InW8lVO52kB6Jhdlv78sYIv0/djitGOn4AmO5n0q03J",
|
|
30
|
+
"bitwrench-util-css.cjs.js": "sha384-1yv6Ss9ZZmqE9ZNPxsvwMa7cXDIRbRDtb0AZMJVQFvLGg7MhQw+2JFGT6J9vEG1y",
|
|
31
|
+
"bitwrench-util-css.cjs.min.js": "sha384-HxVa2HmqGQRu+S6JXtdhMw+vl+Q3s9dyn2nFej7UIF0kZGiX52fnqpwcRIi3TGbS",
|
|
32
|
+
"bitwrench-util-css.es5.js": "sha384-FcYTUpIOmpKxWH6BwDJajnDSPTLbG6png6hv0BzoQ4UCiM2Md7xXl2jkiY03mxIW",
|
|
33
|
+
"bitwrench-util-css.es5.min.js": "sha384-TKVgDvkvqi6UrtOoAaP0rtRNDgf/jchW5I0jLOy7RY8eo8mzilF73L3WxI3LR70x",
|
|
34
|
+
"bitwrench-util-css.esm.js": "sha384-JH6kfqLkfdP3V5u9agouomOUxImhCR2NGn+yPv4Qoma9n3xTzHCAGvo0Zn/zGhS4",
|
|
35
|
+
"bitwrench-util-css.esm.min.js": "sha384-gDSnSPpcskWjQkWL7BZPfgw2Rwz1U9wqc7qjhTFt45S8UNi31mDpCIX5GxFJyJWJ",
|
|
36
|
+
"bitwrench-util-css.umd.js": "sha384-2MM7bwF6NRmNBOYgVGCi2CQQoaix2QXPf9mrHOWOI2DJoxty5SWbu68jNPGwgHBv",
|
|
37
|
+
"bitwrench-util-css.umd.min.js": "sha384-MO5Qrn6aji1Vy6zXeWI/82y47v6hic514JTDUURjmEglnbvZWorOxyUPnnxeaGzw",
|
|
38
|
+
"bitwrench.cjs.js": "sha384-PiVAkba6SrlpTgeLJpgOw+V4iF5UMszH56kVngSA5gii28+82t3cuyW5XQRaycHf",
|
|
39
|
+
"bitwrench.cjs.min.js": "sha384-VO0c3YbkPcWu+WNqswic0wxc1KQ6+7BRfEowfVqxCQxqpVEowevPZUzBgFWZwrrL",
|
|
40
|
+
"bitwrench.css": "sha384-+8yiBHrjrRWTcZ8t8GIyrhylqC/nvQk2z2xUGoQAv63ZRN8zesrYHErqK5UwlN+g",
|
|
41
|
+
"bitwrench.es5.js": "sha384-W2As3FMDb4ZOYDmB2BEUEN4RdwroK/4U4+cz2pa1p6/A9veR2U/5j7CYopzqXt1M",
|
|
42
|
+
"bitwrench.es5.min.js": "sha384-mNEUUvz7AVxzZ2sU/WtvMGkDfEKqgfhCP4DybyYMPBgrgEZc54+t9vs/67vzuCmu",
|
|
43
|
+
"bitwrench.esm.js": "sha384-Rrty92szmiFnNw58C2BmWWkrcBGmHyQ4uiQvxpMm6mPgi3ilfAwlOUzjaFVU3YUB",
|
|
44
|
+
"bitwrench.esm.min.js": "sha384-Ao2D8CxHN70fNzVPFKhgl/fSBD+hoYQxulZRAq/IXhEEJzjpJnv2HV9QF/sHaUsd",
|
|
45
|
+
"bitwrench.min.css": "sha384-gY4lHVKePTqTes9lnWPKs6xhVgqj+GgyW6I3d+6idz0CDioCnNVdqf7ffsvWViHf",
|
|
46
|
+
"bitwrench.umd.js": "sha384-0ozr4VOgCnrIcz/Oqll30CmzbBONL26x6EREo8w6gnIhgvrAXyvdIBm64zczZLmN",
|
|
47
|
+
"bitwrench.umd.min.js": "sha384-tHfp09enPr7Knehnhp3KnI84Li3knJJP/JkFPXLJbdpbWEfdR+qV7X645Bq3xl/A",
|
|
48
|
+
"bwserve.cjs.js": "sha384-9HtLsWSWrJLoYL3LWEoMn4fx6mS3dQcoO+Zsd4nURriDJzFFpWBcpRrMYlYGRrFp",
|
|
49
|
+
"bwserve.esm.js": "sha384-VBS3sQM1VeYSZwojK/fz1uoFbc6Uhz9bJB+rQ1zjocozpP739kBI1R7WBgCURNov"
|
|
48
50
|
}
|
|
49
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitwrench",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.19",
|
|
4
4
|
"description": "A library for javascript UI functions.",
|
|
5
5
|
"main": "./dist/bitwrench.umd.js",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"scripts": {
|
|
88
88
|
"generate-version": "node tools/generate-version.cjs",
|
|
89
89
|
"prebuild": "npm run generate-version && npm run lint",
|
|
90
|
-
"build": "rollup --config && npm run build:css && npm run build:metrics",
|
|
90
|
+
"build": "rollup --config && npm run build:css && npm run build:metrics && npm run build:builds",
|
|
91
91
|
"build:css": "node src/generate-css.js",
|
|
92
92
|
"build:readme": "node tools/build-readme.js",
|
|
93
93
|
"build:watch": "rollup --config --watch",
|
|
@@ -95,9 +95,10 @@
|
|
|
95
95
|
"build_1_x": "./tools/update-bw-package.js package.json package.json && ./tools/export-bw-default-css.js bitwrench.css && uglifyjs bitwrench.js -o bitwrench.min.js && uglifyjs bitwrench_ESM.js -o bitwrench_ESM.min.js && ./tools/umd2ModuleHack.js && npm pack",
|
|
96
96
|
"cleanbuild": "npm run clean && npm run build && npm run build:generated",
|
|
97
97
|
"oldtest": "./node_modules/mocha/bin/mocha test/bitwrench_test.js --reporter spec",
|
|
98
|
-
"test": "c8 --reporter=text mocha ./test/bitwrench_ci.js ./test/bitwrench_test_coverage.js ./test/bitwrench_test_pubsub.js ./test/bitwrench_test_theme.js ./test/bitwrench_test_nodemap.js ./test/bitwrench_test_components.js ./test/
|
|
98
|
+
"test": "c8 --reporter=text mocha ./test/bitwrench_ci.js ./test/bitwrench_test_coverage.js ./test/bitwrench_test_pubsub.js ./test/bitwrench_test_theme.js ./test/bitwrench_test_nodemap.js ./test/bitwrench_test_components.js ./test/bitwrench_test_coverage_gaps.js ./test/bitwrench_test_bwserve.js ./test/bitwrench_test_attach.js ./test/bitwrench_test_serve.js ./test/bitwrench_test_code_edit.js ./test/bitwrench_test_html_page.js ./test/bitwrench_test_util_css.js ./test/bitwrench_test_handle.js ./test/bitwrench_test_debug.js -r jsdom-global/register",
|
|
99
99
|
"test:bwserve": "mocha ./test/bitwrench_test_bwserve.js -r jsdom-global/register",
|
|
100
100
|
"test:attach": "mocha ./test/bitwrench_test_attach.js -r jsdom-global/register",
|
|
101
|
+
"test:serve": "mocha ./test/bitwrench_test_serve.js -r jsdom-global/register --exit",
|
|
101
102
|
"test:components": "mocha ./test/bitwrench_test_components.js -r jsdom-global/register",
|
|
102
103
|
"test:v1": "c8 --reporter=text mocha ./test/bitwrench_test.js -r jsdom-global/",
|
|
103
104
|
"test:pending": "mocha ./test/bitwrench_test_pending.js -r jsdom-global/",
|
|
@@ -112,6 +113,7 @@
|
|
|
112
113
|
"generate-sri": "node tools/generate-sri.js",
|
|
113
114
|
"test:nodemap": "mocha ./test/bitwrench_test_nodemap.js -r jsdom-global/register",
|
|
114
115
|
"test:cli": "mocha ./test/bitwrench_test_cli.js",
|
|
116
|
+
"test:debug": "mocha ./test/bitwrench_test_debug.js -r jsdom-global/register",
|
|
115
117
|
"test:code-edit": "mocha ./test/bitwrench_test_code_edit.js -r jsdom-global/register",
|
|
116
118
|
"test:html-page": "mocha ./test/bitwrench_test_html_page.js -r jsdom-global/register",
|
|
117
119
|
"test:e2e": "playwright test",
|
package/readme.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta name="generator" content="bitwrench v2.0.
|
|
6
|
+
<meta name="generator" content="bitwrench v2.0.19">
|
|
7
7
|
<title>bitwrench.js - README</title>
|
|
8
8
|
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
|
|
9
9
|
<script src="dist/bitwrench.umd.min.js"></script>
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
<h1 class="quikdown-h1">bitwrench.js</h1>
|
|
72
72
|
<a class="quikdown-a" href="https://opensource.org/licenses/BSD-2-Clause" rel="noopener noreferrer"><img class="quikdown-img" src="https://img.shields.io/badge/License-BSD%202--Clause-blue.svg" alt="License"></a>
|
|
73
73
|
<a class="quikdown-a" href="https://www.npmjs.com/package/bitwrench" rel="noopener noreferrer"><img class="quikdown-img" src="https://img.shields.io/npm/v/bitwrench.svg?style=flat-square" alt="NPM version"></a>
|
|
74
|
-
<a class="quikdown-a" href="https://github.com/deftio/bitwrench/actions/workflows/ci.yml" rel="noopener noreferrer"><img class="quikdown-img" src="https://github.com/deftio/bitwrench/actions/workflows/ci.yml/badge.svg" alt="CI"></a
|
|
74
|
+
<a class="quikdown-a" href="https://github.com/deftio/bitwrench/actions/workflows/ci.yml" rel="noopener noreferrer"><img class="quikdown-img" src="https://github.com/deftio/bitwrench/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
75
|
+
<a class="quikdown-a" href="https://github.com/deftio/bitwrench" rel="noopener noreferrer"><img class="quikdown-img" src="https://img.shields.io/badge/coverage-96.3%25-brightgreen.svg" alt="Coverage"></a></p><p><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/" rel="noopener noreferrer"><img class="quikdown-img" src="./images/bitwrench-logo-med.png" alt="bitwrench"></a></p><p>Bitwrench builds UI from plain JavaScript objects -- one format for components, styling, state, and server rendering, with no build step and zero dependencies.</p><pre class="quikdown-pre"><code class="language-javascript">// Describe UI as a JavaScript object (a "TACO")
|
|
75
76
|
var page = {
|
|
76
77
|
t: 'div', a: { class: 'card' },
|
|
77
78
|
c: [
|
|
@@ -81,17 +82,17 @@ var page = {
|
|
|
81
82
|
]
|
|
82
83
|
};
|
|
83
84
|
|
|
84
|
-
bw.DOM('#app', page); //
|
|
85
|
-
bw.html(page); //
|
|
86
|
-
<strong class="quikdown-strong">One file, everywhere.</strong> At ~
|
|
87
|
-
<li class="quikdown-li"><strong class="quikdown-strong">No build toolchain</strong>
|
|
88
|
-
<li class="quikdown-li"><strong class="quikdown-strong">50+ ready-made components</strong>
|
|
89
|
-
<li class="quikdown-li"><strong class="quikdown-strong">CSS from JavaScript</strong>
|
|
90
|
-
<li class="quikdown-li"><strong class="quikdown-strong">Reactive state</strong>
|
|
91
|
-
<li class="quikdown-li"><strong class="quikdown-strong">Dual rendering</strong>
|
|
92
|
-
<li class="quikdown-li"><strong class="quikdown-strong">Server-driven UI</strong>
|
|
93
|
-
<li class="quikdown-li"><strong class="quikdown-strong">CLI</strong>
|
|
94
|
-
<li class="quikdown-li"><strong class="quikdown-strong">Utilities</strong>
|
|
85
|
+
bw.DOM('#app', page); // -> live DOM
|
|
86
|
+
bw.html(page); // -> HTML string (Node.js, emails, SSR)</code></pre><p>Each object has four keys: <strong class="quikdown-strong">t</strong> (tag), <strong class="quikdown-strong">a</strong> (attributes), <strong class="quikdown-strong">c</strong> (content), <strong class="quikdown-strong">o</strong> (options for state/lifecycle). Nest them, loop them, compose them -- it's just JavaScript.</p><p><img class="quikdown-img" src="./images/hero-example.png" alt="Hero example output"></p><h3 class="quikdown-h3">Why bitwrench?</h3>
|
|
87
|
+
<strong class="quikdown-strong">One file, everywhere.</strong> At ~38KB 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.</p><p>Structure, styling, state, and server rendering are all handled as JavaScript objects:</p><ul class="quikdown-ul">
|
|
88
|
+
<li class="quikdown-li"><strong class="quikdown-strong">No build toolchain</strong> -- works with a <code class="quikdown-code"><script></code> tag</li>
|
|
89
|
+
<li class="quikdown-li"><strong class="quikdown-strong">50+ ready-made components</strong> -- buttons, tables, modals, forms, charts, toasts -- one <code class="quikdown-code">make*()</code> call each, returns a composable TACO</li>
|
|
90
|
+
<li class="quikdown-li"><strong class="quikdown-strong">CSS from JavaScript</strong> -- <code class="quikdown-code">bw.css()</code> generates stylesheets, <code class="quikdown-code">bw.s()</code> composes inline styles, <code class="quikdown-code">bw.loadStyles()</code> derives a complete design system from 2 seed colors</li>
|
|
91
|
+
<li class="quikdown-li"><strong class="quikdown-strong">Reactive state</strong> -- <code class="quikdown-code">o.state</code> + <code class="quikdown-code">o.render</code> + <code class="quikdown-code">bw.update()</code> for stateful components; <code class="quikdown-code">bw.pub()</code>/<code class="quikdown-code">bw.sub()</code> for cross-component messaging</li>
|
|
92
|
+
<li class="quikdown-li"><strong class="quikdown-strong">Dual rendering</strong> -- same object renders to live DOM (<code class="quikdown-code">bw.DOM()</code>) or HTML string (<code class="quikdown-code">bw.html()</code>) for SSR, emails, or static sites</li>
|
|
93
|
+
<li class="quikdown-li"><strong class="quikdown-strong">Server-driven UI</strong> -- push UI updates from any backend (Python, C, Rust, Go) over SSE; <code class="quikdown-code">client.screenshot()</code> captures the page back as PNG/JPEG</li>
|
|
94
|
+
<li class="quikdown-li"><strong class="quikdown-strong">CLI</strong> -- <code class="quikdown-code">bwcli</code> converts Markdown, HTML, and JSON to styled standalone pages</li>
|
|
95
|
+
<li class="quikdown-li"><strong class="quikdown-strong">Utilities</strong> -- color interpolation, random data, lorem ipsum, cookies, URL params, file I/O</li>
|
|
95
96
|
</ul><h3 class="quikdown-h3">Coming from other Frameworks</h3>
|
|
96
97
|
<p>Bitwrench uses JavaScript equivalents for most forms of front-end development. Here is a quick mapping (see the <a class="quikdown-a" href="docs/README.md">docs</a> and <a class="quikdown-a" href="docs/thinking-in-bitwrench.md">Thinking in Bitwrench</a> for more details).</p><table class="quikdown-table">
|
|
97
98
|
<thead class="quikdown-thead">
|
|
@@ -105,12 +106,12 @@ bw.html(page); // → HTML string (Node.js, emails, SSR)</code><
|
|
|
105
106
|
<tr class="quikdown-tr">
|
|
106
107
|
<td class="quikdown-td">React / Vue / Svelte</td>
|
|
107
108
|
<td class="quikdown-td">Components + reactivity</td>
|
|
108
|
-
<td class="quikdown-td"><code class="quikdown-code">{t, a, c, o}</code> objects + <code class="quikdown-code">
|
|
109
|
+
<td class="quikdown-td"><code class="quikdown-code">{t, a, c, o}</code> objects + <code class="quikdown-code">o.state</code> + <code class="quikdown-code">o.render</code></td>
|
|
109
110
|
</tr>
|
|
110
111
|
<tr class="quikdown-tr">
|
|
111
112
|
<td class="quikdown-td">JSX / templates</td>
|
|
112
113
|
<td class="quikdown-td">Markup-in-JS</td>
|
|
113
|
-
<td class="quikdown-td">Native JS objects
|
|
114
|
+
<td class="quikdown-td">Native JS objects -- no compiler</td>
|
|
114
115
|
</tr>
|
|
115
116
|
<tr class="quikdown-tr">
|
|
116
117
|
<td class="quikdown-td">Tailwind / CSS-in-JS</td>
|
|
@@ -130,17 +131,17 @@ bw.html(page); // → HTML string (Node.js, emails, SSR)</code><
|
|
|
130
131
|
<tr class="quikdown-tr">
|
|
131
132
|
<td class="quikdown-td">Streamlit / Gradio</td>
|
|
132
133
|
<td class="quikdown-td">Server-driven UI</td>
|
|
133
|
-
<td class="quikdown-td">bwserve SSE
|
|
134
|
+
<td class="quikdown-td">bwserve SSE -- from any language (Python, Go, C, Rust)</td>
|
|
134
135
|
</tr>
|
|
135
136
|
<tr class="quikdown-tr">
|
|
136
137
|
<td class="quikdown-td">Redux / Zustand / Pinia</td>
|
|
137
138
|
<td class="quikdown-td">State management</td>
|
|
138
|
-
<td class="quikdown-td"><code class="quikdown-code">
|
|
139
|
+
<td class="quikdown-td"><code class="quikdown-code">o.state</code> + <code class="quikdown-code">bw.update()</code> + <code class="quikdown-code">bw.pub()/sub()</code></td>
|
|
139
140
|
</tr>
|
|
140
141
|
<tr class="quikdown-tr">
|
|
141
142
|
<td class="quikdown-td">Vite / webpack / Babel</td>
|
|
142
143
|
<td class="quikdown-td">Build tooling</td>
|
|
143
|
-
<td class="quikdown-td">Not needed
|
|
144
|
+
<td class="quikdown-td">Not needed -- open the HTML file</td>
|
|
144
145
|
</tr>
|
|
145
146
|
</tbody>
|
|
146
147
|
</table><p>See the <a class="quikdown-a" href="docs/framework-translation-table.md">Framework Translation Table</a> for side-by-side code comparisons across 22 operations.</p><h2 class="quikdown-h2">Installation</h2>
|
|
@@ -177,24 +178,26 @@ const bw = require('bitwrench');</code></pre><p>Or include directly in a
|
|
|
177
178
|
</script>
|
|
178
179
|
</body>
|
|
179
180
|
</html></code></pre></p><h2 class="quikdown-h2">Adding State</h2>
|
|
180
|
-
<p>
|
|
181
|
-
t: 'div',
|
|
182
|
-
{ t: 'span', c: 'Count: ${count}' },
|
|
183
|
-
{ t: 'button', c: '+1', a: {
|
|
184
|
-
onclick: function() { counter.set('count', counter.get('count') + 1); }
|
|
185
|
-
}}
|
|
186
|
-
],
|
|
181
|
+
<p>Add <code class="quikdown-code">o.state</code> and <code class="quikdown-code">o.render</code> to any TACO to make it stateful. The render function is called with the DOM element, and state lives on <code class="quikdown-code">el._bw_state</code>. Call <code class="quikdown-code">bw.update(el)</code> to re-render:</p><pre class="quikdown-pre"><code class="language-javascript">var counter = {
|
|
182
|
+
t: 'div',
|
|
187
183
|
o: {
|
|
188
184
|
state: { count: 0 },
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
render: function(el) {
|
|
186
|
+
var s = el._bw_state;
|
|
187
|
+
bw.DOM(el, {
|
|
188
|
+
t: 'div', c: [
|
|
189
|
+
{ t: 'h3', c: 'Count: ' + s.count },
|
|
190
|
+
bw.makeButton({ text: '+1', onclick: function() {
|
|
191
|
+
s.count++;
|
|
192
|
+
bw.update(el);
|
|
193
|
+
}})
|
|
194
|
+
]
|
|
195
|
+
});
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
|
-
}
|
|
198
|
+
};
|
|
194
199
|
|
|
195
|
-
bw.DOM('#app', counter);
|
|
196
|
-
counter.set('count', 42); // DOM updates automatically
|
|
197
|
-
counter.reset(); // methods from o.methods are callable on the handle</code></pre><blockquote class="quikdown-blockquote"><strong class="quikdown-strong">Important: event handlers go in <code class="quikdown-code">a: { onclick: fn }</code>, not in <code class="quikdown-code">o.mounted</code>.</strong> Handlers attached via <code class="quikdown-code">addEventListener</code> in <code class="quikdown-code">o.mounted</code> are silently lost when a component re-renders. Always use <code class="quikdown-code">onclick</code>/<code class="quikdown-code">onchange</code>/etc. inside <code class="quikdown-code">a:</code> — bitwrench re-attaches them on every render automatically.</blockquote><p>For low-level control, you can also use <code class="quikdown-code">o.render</code> + <code class="quikdown-code">bw.update()</code> directly — see the <a class="quikdown-a" href="docs/state-management.md">State Management guide</a>.</p><p>For communication between components, use pub/sub:</p><pre class="quikdown-pre"><code class="language-javascript">bw.sub('item-added', function(detail) {
|
|
200
|
+
bw.DOM('#app', counter);</code></pre><blockquote class="quikdown-blockquote"><strong class="quikdown-strong">Important: event handlers go in <code class="quikdown-code">a: { onclick: fn }</code>, not in <code class="quikdown-code">o.mounted</code>.</strong> Handlers attached via <code class="quikdown-code">addEventListener</code> in <code class="quikdown-code">o.mounted</code> are silently lost when a component re-renders. Always use <code class="quikdown-code">onclick</code>/<code class="quikdown-code">onchange</code>/etc. inside <code class="quikdown-code">a:</code> -- bitwrench re-attaches them on every render automatically.</blockquote><p>See the <a class="quikdown-a" href="docs/state-management.md">State Management guide</a> for the full three-level component model.</p><p>For communication between components, use pub/sub:</p><pre class="quikdown-pre"><code class="language-javascript">bw.sub('item-added', function(detail) {
|
|
198
201
|
console.log('New item:', detail.name);
|
|
199
202
|
});
|
|
200
203
|
|
|
@@ -212,7 +215,7 @@ bw.responsive('.hero', {
|
|
|
212
215
|
base: { fontSize: '1.5rem' },
|
|
213
216
|
md: { fontSize: '2.5rem' }
|
|
214
217
|
});</code></pre><h2 class="quikdown-h2">Theming</h2>
|
|
215
|
-
<p><code class="quikdown-code">bw.loadStyles()</code> derives a design system
|
|
218
|
+
<p><code class="quikdown-code">bw.loadStyles()</code> derives a complete design system -- buttons, alerts, badges, cards, forms, tables, hover states, focus rings -- from two seed colors. Styles can be scoped to DOM subtrees, so different sections of a page can use different themes. <code class="quikdown-code">bw.toggleStyles()</code> switches between primary and alternate palettes:</p><pre class="quikdown-pre"><code class="language-javascript">bw.loadStyles({
|
|
216
219
|
primary: '#336699',
|
|
217
220
|
secondary: '#cc6633'
|
|
218
221
|
});
|
|
@@ -228,19 +231,19 @@ bw.toggleStyles(); // switch between primary and alternate palettes</code></pre
|
|
|
228
231
|
<tbody class="quikdown-tbody">
|
|
229
232
|
<tr class="quikdown-tr">
|
|
230
233
|
<td class="quikdown-td"><code class="quikdown-code">bw.html(obj)</code></td>
|
|
231
|
-
<td class="quikdown-td">Convert
|
|
234
|
+
<td class="quikdown-td">Convert a TACO to an HTML string</td>
|
|
232
235
|
</tr>
|
|
233
236
|
<tr class="quikdown-tr">
|
|
234
237
|
<td class="quikdown-td"><code class="quikdown-code">bw.DOM(selector, obj)</code></td>
|
|
235
|
-
<td class="quikdown-td">Mount
|
|
238
|
+
<td class="quikdown-td">Mount a TACO to a DOM element</td>
|
|
236
239
|
</tr>
|
|
237
240
|
<tr class="quikdown-tr">
|
|
238
|
-
<td class="quikdown-td"><code class="quikdown-code">bw.
|
|
239
|
-
<td class="quikdown-td">
|
|
241
|
+
<td class="quikdown-td"><code class="quikdown-code">bw.mount(selector, obj)</code></td>
|
|
242
|
+
<td class="quikdown-td">Like <code class="quikdown-code">bw.DOM()</code> but returns the root element for <code class="quikdown-code">el.bw</code> access</td>
|
|
240
243
|
</tr>
|
|
241
244
|
<tr class="quikdown-tr">
|
|
242
|
-
<td class="quikdown-td"><code class="quikdown-code">bw.
|
|
243
|
-
<td class="quikdown-td">
|
|
245
|
+
<td class="quikdown-td"><code class="quikdown-code">bw.raw(str)</code></td>
|
|
246
|
+
<td class="quikdown-td">Mark a string as pre-escaped HTML (no double-escaping)</td>
|
|
244
247
|
</tr>
|
|
245
248
|
<tr class="quikdown-tr">
|
|
246
249
|
<td class="quikdown-td"><code class="quikdown-code">bw.css(rules)</code></td>
|
|
@@ -255,20 +258,28 @@ bw.toggleStyles(); // switch between primary and alternate palettes</code></pre
|
|
|
255
258
|
<td class="quikdown-td">Generate <code class="quikdown-code">@media</code> CSS rules from JS</td>
|
|
256
259
|
</tr>
|
|
257
260
|
<tr class="quikdown-tr">
|
|
258
|
-
<td class="quikdown-td"><code class="quikdown-code">bw.loadStyles()</code></td>
|
|
259
|
-
<td class="quikdown-td">
|
|
261
|
+
<td class="quikdown-td"><code class="quikdown-code">bw.loadStyles(config?)</code></td>
|
|
262
|
+
<td class="quikdown-td">Load structural CSS (no args) or generate + apply a theme from seed colors</td>
|
|
260
263
|
</tr>
|
|
261
264
|
<tr class="quikdown-tr">
|
|
262
265
|
<td class="quikdown-td"><code class="quikdown-code">bw.makeStyles(config)</code></td>
|
|
263
|
-
<td class="quikdown-td">Generate a
|
|
266
|
+
<td class="quikdown-td">Generate a theme from seed colors (returns styles object)</td>
|
|
267
|
+
</tr>
|
|
268
|
+
<tr class="quikdown-tr">
|
|
269
|
+
<td class="quikdown-td"><code class="quikdown-code">bw.applyStyles(styles)</code></td>
|
|
270
|
+
<td class="quikdown-td">Inject a generated styles object's CSS into the document</td>
|
|
264
271
|
</tr>
|
|
265
272
|
<tr class="quikdown-tr">
|
|
266
273
|
<td class="quikdown-td"><code class="quikdown-code">bw.toggleStyles()</code></td>
|
|
267
274
|
<td class="quikdown-td">Switch between primary and alternate palettes</td>
|
|
268
275
|
</tr>
|
|
269
276
|
<tr class="quikdown-tr">
|
|
277
|
+
<td class="quikdown-td"><code class="quikdown-code">bw.clearStyles()</code></td>
|
|
278
|
+
<td class="quikdown-td">Remove injected theme styles</td>
|
|
279
|
+
</tr>
|
|
280
|
+
<tr class="quikdown-tr">
|
|
270
281
|
<td class="quikdown-td"><code class="quikdown-code">bw.patch(id, content)</code></td>
|
|
271
|
-
<td class="quikdown-td">Update a specific element by UUID</td>
|
|
282
|
+
<td class="quikdown-td">Update a specific element by id or UUID</td>
|
|
272
283
|
</tr>
|
|
273
284
|
<tr class="quikdown-tr">
|
|
274
285
|
<td class="quikdown-td"><code class="quikdown-code">bw.update(el)</code></td>
|
|
@@ -276,7 +287,7 @@ bw.toggleStyles(); // switch between primary and alternate palettes</code></pre
|
|
|
276
287
|
</tr>
|
|
277
288
|
<tr class="quikdown-tr">
|
|
278
289
|
<td class="quikdown-td"><code class="quikdown-code">bw.message(target, action, data)</code></td>
|
|
279
|
-
<td class="quikdown-td">
|
|
290
|
+
<td class="quikdown-td">Dispatch a method call to a component's <code class="quikdown-code">el.bw</code> handle</td>
|
|
280
291
|
</tr>
|
|
281
292
|
<tr class="quikdown-tr">
|
|
282
293
|
<td class="quikdown-td"><code class="quikdown-code">bw.pub(topic, detail)</code></td>
|
|
@@ -288,7 +299,7 @@ bw.toggleStyles(); // switch between primary and alternate palettes</code></pre
|
|
|
288
299
|
</tr>
|
|
289
300
|
<tr class="quikdown-tr">
|
|
290
301
|
<td class="quikdown-td"><code class="quikdown-code">bw.inspect(target)</code></td>
|
|
291
|
-
<td class="quikdown-td">Debug a component in the
|
|
302
|
+
<td class="quikdown-td">Debug a component's state, handles, and metadata in the console</td>
|
|
292
303
|
</tr>
|
|
293
304
|
<tr class="quikdown-tr">
|
|
294
305
|
<td class="quikdown-td"><code class="quikdown-code">bw.apply(msg)</code></td>
|
|
@@ -304,7 +315,7 @@ bwcli doc.md -o doc.html --standalone --theme ocean
|
|
|
304
315
|
|
|
305
316
|
# Custom colors
|
|
306
317
|
bwcli doc.md -o doc.html --standalone --theme "#336699,#cc6633"</code></pre><p>Flags: <code class="quikdown-code">--output/-o</code>, <code class="quikdown-code">--standalone/-s</code>, <code class="quikdown-code">--cdn</code>, <code class="quikdown-code">--theme/-t</code>, <code class="quikdown-code">--css/-c</code>, <code class="quikdown-code">--title</code>, <code class="quikdown-code">--favicon/-f</code>, <code class="quikdown-code">--highlight</code>, <code class="quikdown-code">--verbose/-v</code></p><h3 class="quikdown-h3">Pipe Server</h3>
|
|
307
|
-
<p><code class="quikdown-code">bwcli serve</code> turns any language into a bwserve backend
|
|
318
|
+
<p><code class="quikdown-code">bwcli serve</code> turns any language into a bwserve backend -- send JSON protocol messages via HTTP POST or stdin, and connected browsers update in real time:</p><pre class="quikdown-pre"><code class="language-bash">bwcli serve --port 8080 --input-port 9000
|
|
308
319
|
curl -X POST http://localhost:9000 -d '{"type":"patch","target":"temp","content":"23.5 C"}'</code></pre><h2 class="quikdown-h2">Build Formats</h2>
|
|
309
320
|
<table class="quikdown-table">
|
|
310
321
|
<thead class="quikdown-thead">
|
|
@@ -338,47 +349,47 @@ curl -X POST http://localhost:9000 -d '{"type":"patch",&
|
|
|
338
349
|
</tbody>
|
|
339
350
|
</table><p>All formats include source maps. A separate CSS file (<code class="quikdown-code">bitwrench.css</code>) is also available for use without JavaScript.</p><h2 class="quikdown-h2">Documentation</h2>
|
|
340
351
|
<strong class="quikdown-strong">Start here:</strong></p><ul class="quikdown-ul">
|
|
341
|
-
<li class="quikdown-li"><strong class="quikdown-strong"><a class="quikdown-a" href="docs/thinking-in-bitwrench.md">Thinking in Bitwrench</a></strong>
|
|
342
|
-
<li class="quikdown-li"><strong class="quikdown-strong"><a class="quikdown-a" href="docs/llm-bitwrench-guide.md">LLM Guide</a></strong>
|
|
352
|
+
<li class="quikdown-li"><strong class="quikdown-strong"><a class="quikdown-a" href="docs/thinking-in-bitwrench.md">Thinking in Bitwrench</a></strong> -- the complete guide. Covers TACO, styling (<code class="quikdown-code">bw.css</code>, <code class="quikdown-code">bw.s</code>, <code class="quikdown-code">bw.responsive</code>), composition, events, the three-level component model, bwserve, and common patterns</li>
|
|
353
|
+
<li class="quikdown-li"><strong class="quikdown-strong"><a class="quikdown-a" href="docs/llm-bitwrench-guide.md">LLM Guide</a></strong> -- compact single-file reference with all APIs, patterns, and rules. Designed for AI-assisted development but works as a cheat sheet for anyone</li>
|
|
343
354
|
</ul><p><strong class="quikdown-strong">Reference guides</strong> (in <code class="quikdown-code">docs/</code>):</p><ul class="quikdown-ul">
|
|
344
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/taco-format.md">TACO Format</a>
|
|
345
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/state-management.md">State Management</a>
|
|
346
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/component-library.md">Component Library</a>
|
|
347
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/theming.md">Theming</a>
|
|
348
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/cli.md">CLI</a>
|
|
349
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/bwserve.md">bwserve</a>
|
|
355
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/taco-format.md">TACO Format</a> -- the <code class="quikdown-code">{t, a, c, o}</code> object format</li>
|
|
356
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/state-management.md">State Management</a> -- three-level component model, stateful TACO, reactive state</li>
|
|
357
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/component-library.md">Component Library</a> -- all 50+ <code class="quikdown-code">make*()</code> functions with signatures and examples</li>
|
|
358
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/theming.md">Theming</a> -- palette-driven theme generation, presets, design tokens</li>
|
|
359
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/cli.md">CLI</a> -- the <code class="quikdown-code">bwcli</code> command for file conversion and pipe server</li>
|
|
360
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/bwserve.md">bwserve</a> -- server-driven UI protocol (SSE, actions, embedded devices)</li>
|
|
350
361
|
</ul><p><strong class="quikdown-strong">Tutorials:</strong></p><ul class="quikdown-ul">
|
|
351
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-website.md">Build a Website</a>
|
|
352
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-bwserve.md">bwserve Dashboard</a>
|
|
353
|
-
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-embedded.md">ESP32 IoT Dashboard</a>
|
|
362
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-website.md">Build a Website</a> -- multi-section landing page from TACO objects</li>
|
|
363
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-bwserve.md">bwserve Dashboard</a> -- Streamlit-style server-push dashboard</li>
|
|
364
|
+
<li class="quikdown-li"><a class="quikdown-a" href="docs/tutorial-embedded.md">ESP32 IoT Dashboard</a> -- embedded sensor dashboard with C macros</li>
|
|
354
365
|
</ul><p><strong class="quikdown-strong">Interactive demos</strong> (live site):</p><ul class="quikdown-ul">
|
|
355
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/00-quick-start.html" rel="noopener noreferrer">Quick Start</a>
|
|
356
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/01-components.html" rel="noopener noreferrer">Components</a>
|
|
357
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/03-styling.html" rel="noopener noreferrer">Styling & Theming</a>
|
|
358
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/05-state.html" rel="noopener noreferrer">State & Interactivity</a>
|
|
359
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/06-tic-tac-toe-tutorial.html" rel="noopener noreferrer">Tic Tac Toe Tutorial</a>
|
|
360
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/07-framework-comparison.html" rel="noopener noreferrer">Framework Comparison</a>
|
|
361
|
-
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/10-themes.html" rel="noopener noreferrer">Themes</a>
|
|
366
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/00-quick-start.html" rel="noopener noreferrer">Quick Start</a> -- first steps with <code class="quikdown-code">bw.DOM()</code></li>
|
|
367
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/01-components.html" rel="noopener noreferrer">Components</a> -- all 50+ UI components with live demos</li>
|
|
368
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/03-styling.html" rel="noopener noreferrer">Styling & Theming</a> -- CSS generation, <code class="quikdown-code">bw.s()</code>, and theming strategies</li>
|
|
369
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/05-state.html" rel="noopener noreferrer">State & Interactivity</a> -- state patterns and stateful TACO</li>
|
|
370
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/06-tic-tac-toe-tutorial.html" rel="noopener noreferrer">Tic Tac Toe Tutorial</a> -- step-by-step game with state management</li>
|
|
371
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/07-framework-comparison.html" rel="noopener noreferrer">Framework Comparison</a> -- bitwrench vs React, Vue, Svelte</li>
|
|
372
|
+
<li class="quikdown-li"><a class="quikdown-a" href="https://deftio.github.io/bitwrench/pages/10-themes.html" rel="noopener noreferrer">Themes</a> -- interactive theme generator with presets and CSS export</li>
|
|
362
373
|
</ul><p><strong class="quikdown-strong">Example apps</strong> (in <code class="quikdown-code">examples/</code>):</p><ul class="quikdown-ul">
|
|
363
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/ember-and-oak/">Ember & Oak Coffee Co.</a>
|
|
364
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/landing-page/">SunForge Landing Page</a>
|
|
365
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/todo-app/">Todo App</a>
|
|
366
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/dashboard/">Metrics Dashboard</a>
|
|
367
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/wizard/">Signup Wizard</a>
|
|
368
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/live-feed/">Live Feed</a>
|
|
369
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/embedded/">IoT Dashboard</a>
|
|
370
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/client-server/">bwserve Counter</a>
|
|
371
|
-
<li class="quikdown-li"><a class="quikdown-a" href="examples/llm-chat/">LLM Chat</a>
|
|
374
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/ember-and-oak/">Ember & Oak Coffee Co.</a> -- full landing page: theme, cart, search, charts, accordion, timeline</li>
|
|
375
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/landing-page/">SunForge Landing Page</a> -- polished marketing page with zero reactive state, pure BCCL composition</li>
|
|
376
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/todo-app/">Todo App</a> -- stateful TACO with pub/sub</li>
|
|
377
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/dashboard/">Metrics Dashboard</a> -- live stat cards, bar chart, pub/sub, responsive layout</li>
|
|
378
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/wizard/">Signup Wizard</a> -- multi-step form, state transitions, bw.raw()</li>
|
|
379
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/live-feed/">Live Feed</a> -- real-time stream, bw.patch(), slide-in animation</li>
|
|
380
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/embedded/">IoT Dashboard</a> -- ESP32-style sensor dashboard with SSE</li>
|
|
381
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/client-server/">bwserve Counter</a> -- server-driven UI demo</li>
|
|
382
|
+
<li class="quikdown-li"><a class="quikdown-a" href="examples/llm-chat/">LLM Chat</a> -- streaming chat via bwserve + Ollama/OpenAI</li>
|
|
372
383
|
</ul><h2 class="quikdown-h2">FAQ</h2>
|
|
373
|
-
<strong class="quikdown-strong">Is this a framework?</strong>
|
|
384
|
+
<strong class="quikdown-strong">Is this a framework?</strong> -- No. Bitwrench is a library (~38KB gzipped). No lifecycle to learn, no project structure to follow. Import it, call functions, done.</p><p><strong class="quikdown-strong">Does it scale to large apps?</strong> -- 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.</p><p><strong class="quikdown-strong">How does bitwrench compare to React/Vue?</strong> -- 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.</p><p><strong class="quikdown-strong">How does CSS work?</strong> -- Bitwrench doesn't own your CSS. Use any external stylesheet, Tailwind, or CSS file you want -- bitwrench doesn't interfere. On top of that, <code class="quikdown-code">bw.css()</code> generates CSS from JS objects (with <code class="quikdown-code">@media</code>, <code class="quikdown-code">@keyframes</code>, pseudo-classes), <code class="quikdown-code">bw.s()</code> composes inline style objects, and <code class="quikdown-code">bw.loadStyles()</code> derives a complete design system from 2 seed colors. You can use all three together or none at all.</p><p><strong class="quikdown-strong">What's the difference between <code class="quikdown-code">bw.DOM()</code> and <code class="quikdown-code">bw.html()</code>?</strong> -- Same TACO input, two outputs. <code class="quikdown-code">bw.DOM('#app', taco)</code> mounts live DOM elements in a browser. <code class="quikdown-code">bw.html(taco)</code> 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.</p><p><strong class="quikdown-strong">What is bwserve?</strong> -- 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 <a class="quikdown-a" href="docs/bwserve.md">bwserve docs</a>.</p><p><strong class="quikdown-strong">Can I use bitwrench on embedded devices?</strong> -- 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 <a class="quikdown-a" href="docs/tutorial-embedded.md">ESP32 tutorial</a>.</p><p><strong class="quikdown-strong">Can I use it with TypeScript?</strong> -- Yes. Type declarations are included. TACO objects are plain JSON-compatible objects that TypeScript infers naturally.</p><p><strong class="quikdown-strong">What about accessibility?</strong> -- BCCL components emit semantic HTML with ARIA attributes where applicable. You can add any <code class="quikdown-code">aria-*</code> attribute via <code class="quikdown-code">a: { 'aria-label': '...' }</code>.</p><h2 class="quikdown-h2">Development</h2>
|
|
374
385
|
<p><pre class="quikdown-pre"><code class="language-bash">npm install # install dev dependencies
|
|
375
386
|
npm run build # build all dist formats (UMD, ESM, CJS, ES5)
|
|
376
|
-
npm test # run unit tests (
|
|
387
|
+
npm test # run unit tests (1400+ tests, 96% coverage)
|
|
377
388
|
npm run test:cli # run CLI tests
|
|
378
389
|
npm run test:e2e # run Playwright browser tests
|
|
379
390
|
npm run lint # run ESLint
|
|
380
391
|
npm run cleanbuild # full production build with SRI hashes</code></pre></p><h2 class="quikdown-h2">License</h2>
|
|
381
|
-
<a class="quikdown-a" href="./LICENSE.txt">BSD-2-Clause</a>
|
|
392
|
+
<a class="quikdown-a" href="./LICENSE.txt">BSD-2-Clause</a> -- (c) M. A. Chatterjee / <a class="quikdown-a" href="https://github.com/deftio" rel="noopener noreferrer">deftio</a>
|
|
382
393
|
</p>
|
|
383
394
|
</div>
|
|
384
395
|
</div>
|
|
@@ -46,15 +46,14 @@ export function registerBCCL(bw) {
|
|
|
46
46
|
// Variant class helper
|
|
47
47
|
bw.variantClass = components.variantClass;
|
|
48
48
|
|
|
49
|
-
// Create functions that return
|
|
50
|
-
if (typeof bw.
|
|
49
|
+
// Create functions that return DOM elements
|
|
50
|
+
if (typeof bw.createDOM === 'function') {
|
|
51
51
|
Object.entries(components).forEach(function(entry) {
|
|
52
52
|
var name = entry[0], fn = entry[1];
|
|
53
53
|
if (name.indexOf('make') === 0) {
|
|
54
54
|
var createName = 'create' + name.substring(4);
|
|
55
55
|
bw[createName] = function(props) {
|
|
56
|
-
|
|
57
|
-
return bw.renderComponent(taco);
|
|
56
|
+
return bw.createDOM(fn(props));
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
59
|
});
|