bitwrench 2.0.13 → 2.0.15

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 (46) hide show
  1. package/README.md +4 -4
  2. package/dist/bitwrench-code-edit.cjs.js +46 -46
  3. package/dist/bitwrench-code-edit.cjs.min.js +16 -0
  4. package/dist/bitwrench-code-edit.es5.js +8 -8
  5. package/dist/bitwrench-code-edit.es5.min.js +2 -2
  6. package/dist/bitwrench-code-edit.esm.js +46 -46
  7. package/dist/bitwrench-code-edit.esm.min.js +2 -2
  8. package/dist/bitwrench-code-edit.umd.js +46 -46
  9. package/dist/bitwrench-code-edit.umd.min.js +2 -2
  10. package/dist/bitwrench-lean.cjs.js +5011 -3419
  11. package/dist/bitwrench-lean.cjs.min.js +35 -6
  12. package/dist/bitwrench-lean.es5.js +6218 -4272
  13. package/dist/bitwrench-lean.es5.min.js +32 -3
  14. package/dist/bitwrench-lean.esm.js +5011 -3419
  15. package/dist/bitwrench-lean.esm.min.js +35 -6
  16. package/dist/bitwrench-lean.umd.js +5011 -3419
  17. package/dist/bitwrench-lean.umd.min.js +35 -6
  18. package/dist/bitwrench.cjs.js +6966 -4662
  19. package/dist/bitwrench.cjs.min.js +38 -8
  20. package/dist/bitwrench.css +2453 -4784
  21. package/dist/bitwrench.es5.js +9592 -6813
  22. package/dist/bitwrench.es5.min.js +34 -5
  23. package/dist/bitwrench.esm.js +6966 -4662
  24. package/dist/bitwrench.esm.min.js +38 -8
  25. package/dist/bitwrench.min.css +1 -0
  26. package/dist/bitwrench.umd.js +6966 -4662
  27. package/dist/bitwrench.umd.min.js +38 -8
  28. package/dist/builds.json +89 -67
  29. package/dist/sri.json +28 -26
  30. package/package.json +7 -5
  31. package/readme.html +14 -14
  32. package/src/{bitwrench-components-v2.js → bitwrench-bccl.js} +1311 -600
  33. package/src/bitwrench-code-edit.js +45 -45
  34. package/src/bitwrench-color-utils.js +154 -27
  35. package/src/bitwrench-components-stub.js +4 -1
  36. package/src/bitwrench-file-ops.js +180 -0
  37. package/src/bitwrench-lean.js +2 -2
  38. package/src/bitwrench-styles.js +1468 -3494
  39. package/src/bitwrench-utils.js +458 -0
  40. package/src/bitwrench.js +1795 -1349
  41. package/src/cli/layout-default.js +18 -18
  42. package/src/generate-css.js +73 -53
  43. package/src/version.js +3 -3
  44. package/src/bitwrench-component-base.js +0 -736
  45. package/src/bitwrench-components-inline.js +0 -374
  46. package/src/bitwrench-components.js +0 -610
@@ -9,7 +9,7 @@ import bw from '../bitwrench.js';
9
9
  * Base page CSS for the CLI-generated pages
10
10
  */
11
11
  const BASE_PAGE_CSS = `
12
- .bw-cli-page {
12
+ .bw_cli_page {
13
13
  max-width: 48rem;
14
14
  margin: 0 auto;
15
15
  padding: 2rem 1.5rem;
@@ -18,61 +18,61 @@ const BASE_PAGE_CSS = `
18
18
  line-height: 1.6;
19
19
  color: #333;
20
20
  }
21
- .bw-cli-page pre {
21
+ .bw_cli_page pre {
22
22
  overflow-x: auto;
23
23
  padding: 1em;
24
24
  background: #f5f5f5;
25
25
  border-radius: 4px;
26
26
  font-size: 0.875em;
27
27
  }
28
- .bw-cli-page code {
28
+ .bw_cli_page code {
29
29
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, Courier, monospace;
30
30
  }
31
- .bw-cli-page p code {
31
+ .bw_cli_page p code {
32
32
  background: #f0f0f0;
33
33
  padding: 0.15em 0.3em;
34
34
  border-radius: 3px;
35
35
  font-size: 0.875em;
36
36
  }
37
- .bw-cli-page table {
37
+ .bw_cli_page table {
38
38
  border-collapse: collapse;
39
39
  width: 100%;
40
40
  margin: 1em 0;
41
41
  overflow-x: auto;
42
42
  display: block;
43
43
  }
44
- .bw-cli-page th, .bw-cli-page td {
44
+ .bw_cli_page th, .bw_cli_page td {
45
45
  border: 1px solid #ddd;
46
46
  padding: 0.5em 0.75em;
47
47
  text-align: left;
48
48
  }
49
- .bw-cli-page th {
49
+ .bw_cli_page th {
50
50
  background: #f5f5f5;
51
51
  font-weight: 600;
52
52
  }
53
- .bw-cli-page blockquote {
53
+ .bw_cli_page blockquote {
54
54
  border-left: 4px solid #ddd;
55
55
  margin-left: 0;
56
56
  padding-left: 1em;
57
57
  color: #666;
58
58
  }
59
- .bw-cli-page img {
59
+ .bw_cli_page img {
60
60
  max-width: 100%;
61
61
  height: auto;
62
62
  }
63
- .bw-cli-page h1, .bw-cli-page h2, .bw-cli-page h3,
64
- .bw-cli-page h4, .bw-cli-page h5, .bw-cli-page h6 {
63
+ .bw_cli_page h1, .bw_cli_page h2, .bw_cli_page h3,
64
+ .bw_cli_page h4, .bw_cli_page h5, .bw_cli_page h6 {
65
65
  margin-top: 1.5em;
66
66
  margin-bottom: 0.5em;
67
67
  line-height: 1.25;
68
68
  }
69
- .bw-cli-page h1 { font-size: 2em; }
70
- .bw-cli-page h2 { font-size: 1.5em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
71
- .bw-cli-page a { color: #0366d6; text-decoration: none; }
72
- .bw-cli-page a:hover { text-decoration: underline; }
73
- .bw-cli-page hr { border: none; border-top: 1px solid #eee; margin: 2em 0; }
69
+ .bw_cli_page h1 { font-size: 2em; }
70
+ .bw_cli_page h2 { font-size: 1.5em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
71
+ .bw_cli_page a { color: #0366d6; text-decoration: none; }
72
+ .bw_cli_page a:hover { text-decoration: underline; }
73
+ .bw_cli_page hr { border: none; border-top: 1px solid #eee; margin: 2em 0; }
74
74
  @media (max-width: 600px) {
75
- .bw-cli-page { padding: 1rem; }
75
+ .bw_cli_page { padding: 1rem; }
76
76
  }
77
77
  `;
78
78
 
@@ -131,7 +131,7 @@ ${faviconTag}${headInjection}${highlightHead}
131
131
  <style>${allCSS}</style>
132
132
  </head>
133
133
  <body>
134
- <div class="bw-cli-page">
134
+ <div class="bw_cli_page">
135
135
  ${bodyHTML}
136
136
  </div>
137
137
  ${bodyEndInjection}${highlightBodyEnd}
@@ -3,7 +3,9 @@
3
3
  * Creates class-based CSS to prevent collisions with other frameworks
4
4
  */
5
5
 
6
- import { getAllStyles, getStructuralStyles } from './bitwrench-styles.js';
6
+ import { getAllStyles, getStructuralStyles, generateThemedCSS,
7
+ resolveLayout, DEFAULT_PALETTE_CONFIG } from './bitwrench-styles.js';
8
+ import { derivePalette } from './bitwrench-color-utils.js';
7
9
  import fs from 'fs';
8
10
  import path from 'path';
9
11
 
@@ -57,7 +59,7 @@ function stylesToCSS(styles) {
57
59
  // Process selector to add .bw prefix where needed
58
60
  function processSelector(selector) {
59
61
  // Don't modify :root, html, body, or already namespaced selectors
60
- if (selector === ':root' || selector === 'html' || selector === 'body' || selector.includes('.bw-')) {
62
+ if (selector === ':root' || selector === 'html' || selector === 'body' || selector.includes('.bw_')) {
61
63
  return selector;
62
64
  }
63
65
 
@@ -74,7 +76,7 @@ function processSelector(selector) {
74
76
  if (bootstrapClasses.some(cls => className.startsWith(cls))) {
75
77
  return selector;
76
78
  }
77
- return `.bw-${className}`;
79
+ return `.bw_${className}`;
78
80
  }
79
81
 
80
82
  return selector;
@@ -106,178 +108,180 @@ function deepMergeStyles(base, overrides) {
106
108
  return merged;
107
109
  }
108
110
 
109
- // Generate the CSS — merge themed styles + structural styles
110
- const themed = getAllStyles();
111
+ // Generate the CSS — merge structural + themed (default palette) styles
111
112
  const structural = getStructuralStyles();
112
- // Structural properties take precedence; themed properties preserved where structural doesn't override
113
- const styles = deepMergeStyles(themed, structural);
113
+ const palette = derivePalette(DEFAULT_PALETTE_CONFIG);
114
+ const layout = resolveLayout({});
115
+ const themed = generateThemedCSS('', palette, layout);
116
+ // Themed properties layer on top of structural (colors, padding, borders)
117
+ const styles = deepMergeStyles(structural, themed);
114
118
  const css = stylesToCSS(styles);
115
119
 
116
120
  // Add additional bitwrench-specific styles
117
121
  const additionalCSS = `
118
122
  /* Bitwrench Page Layout */
119
- .bw-page {
123
+ .bw_page {
120
124
  min-height: 100vh;
121
125
  display: flex;
122
126
  flex-direction: column;
123
127
  background-color: #f8f9fa;
124
128
  }
125
129
 
126
- .bw-page-content {
130
+ .bw_page_content {
127
131
  flex: 1;
128
132
  padding: 2rem 0;
129
133
  }
130
134
 
131
135
  /* Responsive body margins */
132
136
  @media (min-width: 576px) {
133
- .bw-page-content {
137
+ .bw_page_content {
134
138
  padding: 3rem 0;
135
139
  }
136
140
  }
137
141
 
138
142
  @media (min-width: 768px) {
139
- .bw-page-content {
143
+ .bw_page_content {
140
144
  padding: 4rem 0;
141
145
  }
142
146
  }
143
147
 
144
148
  /* Theme variations */
145
- .bw-theme-dark,
146
- .bw-theme-dark body {
149
+ .bw_theme_dark,
150
+ .bw_theme_dark body {
147
151
  background-color: #212529;
148
152
  color: #fff;
149
153
  }
150
154
 
151
- .bw-theme-dark h1,
152
- .bw-theme-dark h2,
153
- .bw-theme-dark h3,
154
- .bw-theme-dark h4,
155
- .bw-theme-dark h5,
156
- .bw-theme-dark h6 {
155
+ .bw_theme_dark h1,
156
+ .bw_theme_dark h2,
157
+ .bw_theme_dark h3,
158
+ .bw_theme_dark h4,
159
+ .bw_theme_dark h5,
160
+ .bw_theme_dark h6 {
157
161
  color: #fff;
158
162
  }
159
163
 
160
- .bw-theme-dark .text-muted {
164
+ .bw_theme_dark .text-muted {
161
165
  color: #adb5bd !important;
162
166
  }
163
167
 
164
- .bw-theme-dark .lead {
168
+ .bw_theme_dark .lead {
165
169
  color: #e9ecef;
166
170
  }
167
171
 
168
- .bw-theme-dark .card {
172
+ .bw_theme_dark .card {
169
173
  background-color: #343a40;
170
174
  border-color: #495057;
171
175
  color: #fff;
172
176
  }
173
177
 
174
- .bw-theme-dark .btn-light {
178
+ .bw_theme_dark .btn-light {
175
179
  background-color: #495057;
176
180
  border-color: #495057;
177
181
  color: #fff;
178
182
  }
179
183
 
180
- .bw-theme-dark .btn-light:hover {
184
+ .bw_theme_dark .btn-light:hover {
181
185
  background-color: #5a6268;
182
186
  border-color: #545b62;
183
187
  }
184
188
 
185
- .bw-theme-dark .navbar-light {
189
+ .bw_theme_dark .navbar-light {
186
190
  background-color: #343a40 !important;
187
191
  }
188
192
 
189
- .bw-theme-dark .navbar-light .navbar-brand,
190
- .bw-theme-dark .navbar-light .nav-link {
193
+ .bw_theme_dark .navbar-light .navbar-brand,
194
+ .bw_theme_dark .navbar-light .nav-link {
191
195
  color: rgba(255,255,255,.8);
192
196
  }
193
197
 
194
- .bw-theme-dark .navbar-light .nav-link:hover {
198
+ .bw_theme_dark .navbar-light .nav-link:hover {
195
199
  color: rgba(255,255,255,.9);
196
200
  }
197
201
 
198
- .bw-theme-dark .navbar-light .nav-link.active {
202
+ .bw_theme_dark .navbar-light .nav-link.active {
199
203
  color: #fff;
200
204
  }
201
205
 
202
- .bw-theme-dark .bg-light {
206
+ .bw_theme_dark .bg-light {
203
207
  background-color: #495057 !important;
204
208
  color: #fff;
205
209
  }
206
210
 
207
- .bw-theme-dark .text-muted {
211
+ .bw_theme_dark .text-muted {
208
212
  color: #adb5bd !important;
209
213
  }
210
214
 
211
- .bw-theme-dark .table {
215
+ .bw_theme_dark .table {
212
216
  color: #fff;
213
217
  border-color: #495057;
214
218
  }
215
219
 
216
- .bw-theme-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
220
+ .bw_theme_dark .table-striped > tbody > tr:nth-of-type(odd) > * {
217
221
  background-color: rgba(255, 255, 255, 0.05);
218
222
  }
219
223
 
220
- .bw-theme-dark .table-hover > tbody > tr:hover > * {
224
+ .bw_theme_dark .table-hover > tbody > tr:hover > * {
221
225
  background-color: rgba(255, 255, 255, 0.075);
222
226
  color: #fff;
223
227
  }
224
228
 
225
- .bw-theme-dark .form-control {
229
+ .bw_theme_dark .form-control {
226
230
  background-color: #495057;
227
231
  border-color: #495057;
228
232
  color: #fff;
229
233
  }
230
234
 
231
- .bw-theme-dark .form-control:focus {
235
+ .bw_theme_dark .form-control:focus {
232
236
  background-color: #495057;
233
237
  border-color: #80bdff;
234
238
  color: #fff;
235
239
  }
236
240
 
237
- .bw-theme-dark .form-control::placeholder {
241
+ .bw_theme_dark .form-control::placeholder {
238
242
  color: #adb5bd;
239
243
  }
240
244
 
241
- .bw-theme-dark .form-select {
245
+ .bw_theme_dark .form-select {
242
246
  background-color: #495057;
243
247
  border-color: #495057;
244
248
  color: #fff;
245
249
  }
246
250
 
247
- .bw-theme-dark pre {
251
+ .bw_theme_dark pre {
248
252
  background-color: #343a40;
249
253
  color: #f8f9fa;
250
254
  }
251
255
 
252
- .bw-theme-dark code {
256
+ .bw_theme_dark code {
253
257
  color: #e83e8c;
254
258
  }
255
259
 
256
260
  /* Form switch in dark mode */
257
- .bw-theme-dark .form-check-input:checked {
261
+ .bw_theme_dark .form-check-input:checked {
258
262
  background-color: #0dcaf0;
259
263
  border-color: #0dcaf0;
260
264
  }
261
265
 
262
- .bw-theme-dark .form-switch .form-check-input {
266
+ .bw_theme_dark .form-switch .form-check-input {
263
267
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 0.85%29'/%3e%3c/svg%3e");
264
268
  }
265
269
 
266
- .bw-theme-dark .form-switch .form-check-input:checked {
270
+ .bw_theme_dark .form-switch .form-check-input:checked {
267
271
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.85%29'/%3e%3c/svg%3e");
268
272
  }
269
273
 
270
- .bw-theme-dark .form-check-label {
274
+ .bw_theme_dark .form-check-label {
271
275
  color: #fff;
272
276
  }
273
277
 
274
278
  /* Ensure proper spacing for example pages */
275
- .bw-example-page {
279
+ .bw_example_page {
276
280
  padding: 0;
277
281
  margin: 0;
278
282
  }
279
283
 
280
- .bw-example-page .container {
284
+ .bw_example_page .container {
281
285
  padding-top: 2rem;
282
286
  padding-bottom: 2rem;
283
287
  }
@@ -298,7 +302,7 @@ const additionalCSS = `
298
302
  border-bottom: 2px solid #dee2e6;
299
303
  }
300
304
 
301
- .bw-theme-dark .table th {
305
+ .bw_theme_dark .table th {
302
306
  background-color: #343a40;
303
307
  border-bottom-color: #495057;
304
308
  }
@@ -342,7 +346,7 @@ pre {
342
346
  border: 1px solid #dee2e6;
343
347
  }
344
348
 
345
- .bw-theme-dark pre {
349
+ .bw_theme_dark pre {
346
350
  border-color: #495057;
347
351
  }
348
352
 
@@ -376,11 +380,11 @@ pre {
376
380
  @media print {
377
381
  .navbar,
378
382
  .btn,
379
- .bw-no-print {
383
+ .bw_no_print {
380
384
  display: none !important;
381
385
  }
382
386
 
383
- .bw-page {
387
+ .bw_page {
384
388
  min-height: auto;
385
389
  }
386
390
 
@@ -392,7 +396,23 @@ pre {
392
396
  `;
393
397
 
394
398
  // Write to file
399
+ const fullCSS = css + additionalCSS;
395
400
  const outputPath = path.join(process.cwd(), 'dist', 'bitwrench.css');
396
- fs.writeFileSync(outputPath, css + additionalCSS);
397
-
398
- console.log(`Generated bitwrench.css at ${outputPath}`);
401
+ fs.writeFileSync(outputPath, fullCSS);
402
+
403
+ // Generate minified CSS — strip comments, collapse whitespace
404
+ const minCSS = fullCSS
405
+ .replace(/\/\*[\s\S]*?\*\//g, '') // remove block comments
406
+ .replace(/\s*\n\s*/g, '') // collapse newlines
407
+ .replace(/\s*{\s*/g, '{') // collapse around {
408
+ .replace(/\s*}\s*/g, '}') // collapse around }
409
+ .replace(/\s*;\s*/g, ';') // collapse around ;
410
+ .replace(/\s*:\s*/g, ':') // collapse around :
411
+ .replace(/\s*,\s*/g, ',') // collapse around ,
412
+ .replace(/;}/g, '}') // remove last semicolon before }
413
+ .trim();
414
+ const minOutputPath = path.join(process.cwd(), 'dist', 'bitwrench.min.css');
415
+ fs.writeFileSync(minOutputPath, minCSS);
416
+
417
+ console.log(`Generated bitwrench.css at ${outputPath}`);
418
+ console.log(`Generated bitwrench.min.css at ${minOutputPath} (${(minCSS.length / 1024).toFixed(1)} KB)`);
package/src/version.js CHANGED
@@ -3,14 +3,14 @@
3
3
  * DO NOT EDIT DIRECTLY - Use npm run generate-version
4
4
  */
5
5
 
6
- export const VERSION = '2.0.13';
6
+ export const VERSION = '2.0.15';
7
7
  export const VERSION_INFO = {
8
- version: '2.0.13',
8
+ version: '2.0.15',
9
9
  name: 'bitwrench',
10
10
  description: 'A library for javascript UI functions.',
11
11
  license: 'BSD-2-Clause',
12
12
  homepage: 'https://deftio.github.com/bitwrench/pages',
13
13
  repository: 'git+https://github.com/deftio/bitwrench.git',
14
14
  author: 'manu a. chatterjee <deftio@deftio.com> (https://deftio.com/)',
15
- buildDate: '2026-03-07T22:35:06.056Z'
15
+ buildDate: '2026-03-10T09:08:17.015Z'
16
16
  };