bitwrench 2.0.14 → 2.0.16

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 (61) hide show
  1. package/README.md +57 -21
  2. package/dist/bitwrench-bccl.cjs.js +3746 -0
  3. package/dist/bitwrench-bccl.cjs.min.js +40 -0
  4. package/dist/bitwrench-bccl.esm.js +3741 -0
  5. package/dist/bitwrench-bccl.esm.min.js +40 -0
  6. package/dist/bitwrench-bccl.umd.js +3752 -0
  7. package/dist/bitwrench-bccl.umd.min.js +40 -0
  8. package/dist/bitwrench-code-edit.cjs.js +99 -49
  9. package/dist/bitwrench-code-edit.cjs.min.js +23 -0
  10. package/dist/bitwrench-code-edit.es5.js +79 -16
  11. package/dist/bitwrench-code-edit.es5.min.js +9 -2
  12. package/dist/bitwrench-code-edit.esm.js +99 -49
  13. package/dist/bitwrench-code-edit.esm.min.js +9 -2
  14. package/dist/bitwrench-code-edit.umd.js +99 -49
  15. package/dist/bitwrench-code-edit.umd.min.js +9 -2
  16. package/dist/bitwrench-lean.cjs.js +4923 -3248
  17. package/dist/bitwrench-lean.cjs.min.js +35 -6
  18. package/dist/bitwrench-lean.es5.js +6325 -4580
  19. package/dist/bitwrench-lean.es5.min.js +32 -3
  20. package/dist/bitwrench-lean.esm.js +4923 -3248
  21. package/dist/bitwrench-lean.esm.min.js +35 -6
  22. package/dist/bitwrench-lean.umd.js +4923 -3248
  23. package/dist/bitwrench-lean.umd.min.js +35 -6
  24. package/dist/bitwrench.cjs.js +5082 -3667
  25. package/dist/bitwrench.cjs.min.js +38 -8
  26. package/dist/bitwrench.css +2289 -6034
  27. package/dist/bitwrench.es5.js +6862 -5346
  28. package/dist/bitwrench.es5.min.js +34 -5
  29. package/dist/bitwrench.esm.js +5082 -3667
  30. package/dist/bitwrench.esm.min.js +38 -8
  31. package/dist/bitwrench.min.css +1 -0
  32. package/dist/bitwrench.umd.js +5082 -3667
  33. package/dist/bitwrench.umd.min.js +38 -8
  34. package/dist/builds.json +184 -74
  35. package/dist/bwserve.cjs.js +646 -0
  36. package/dist/bwserve.esm.js +638 -0
  37. package/dist/sri.json +36 -26
  38. package/package.json +23 -6
  39. package/readme.html +71 -32
  40. package/src/bitwrench-bccl-entry.js +72 -0
  41. package/src/{bitwrench-components-v2.js → bitwrench-bccl.js} +396 -647
  42. package/src/bitwrench-code-edit.js +98 -48
  43. package/src/bitwrench-color-utils.js +24 -18
  44. package/src/bitwrench-components-stub.js +4 -1
  45. package/src/bitwrench-file-ops.js +180 -0
  46. package/src/bitwrench-lean.js +2 -2
  47. package/src/bitwrench-styles.js +1287 -4029
  48. package/src/bitwrench-utils.js +458 -0
  49. package/src/bitwrench.js +2070 -1292
  50. package/src/bwserve/client.js +182 -0
  51. package/src/bwserve/index.js +352 -0
  52. package/src/bwserve/shell.js +103 -0
  53. package/src/cli/index.js +36 -15
  54. package/src/cli/layout-default.js +18 -18
  55. package/src/cli/serve.js +325 -0
  56. package/src/generate-css.js +73 -53
  57. package/src/version.js +3 -3
  58. package/src/bitwrench-component-base.js +0 -736
  59. package/src/bitwrench-components-inline.js +0 -374
  60. package/src/bitwrench-components.js +0 -610
  61. /package/bin/{bitwrench.js → bwcli.js} +0 -0
@@ -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.14';
6
+ export const VERSION = '2.0.16';
7
7
  export const VERSION_INFO = {
8
- version: '2.0.14',
8
+ version: '2.0.16',
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-08T08:04:06.572Z'
15
+ buildDate: '2026-03-12T08:05:52.043Z'
16
16
  };