bitwrench 1.2.15 → 2.0.7

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 (119) hide show
  1. package/README.md +160 -158
  2. package/bin/bitwrench.js +3 -0
  3. package/dist/bitwrench-code-edit.cjs.js +639 -0
  4. package/dist/bitwrench-code-edit.es5.js +875 -0
  5. package/dist/bitwrench-code-edit.es5.min.js +15 -0
  6. package/dist/bitwrench-code-edit.esm.js +628 -0
  7. package/dist/bitwrench-code-edit.esm.min.js +15 -0
  8. package/dist/bitwrench-code-edit.umd.js +645 -0
  9. package/dist/bitwrench-code-edit.umd.min.js +15 -0
  10. package/dist/bitwrench.cjs.js +6983 -0
  11. package/dist/bitwrench.cjs.min.js +62 -0
  12. package/dist/bitwrench.css +5100 -0
  13. package/dist/bitwrench.es5.js +8446 -0
  14. package/dist/bitwrench.es5.min.js +31 -0
  15. package/dist/bitwrench.esm.js +6981 -0
  16. package/dist/bitwrench.esm.min.js +62 -0
  17. package/dist/bitwrench.umd.js +6989 -0
  18. package/dist/bitwrench.umd.min.js +62 -0
  19. package/dist/builds.json +127 -0
  20. package/dist/sri.json +18 -0
  21. package/package.json +86 -24
  22. package/readme.html +288 -0
  23. package/src/bitwrench-code-edit.js +627 -0
  24. package/src/bitwrench-color-utils.js +311 -0
  25. package/src/bitwrench-component-base.js +736 -0
  26. package/src/bitwrench-components-inline.js +374 -0
  27. package/src/bitwrench-components-v2.js +1879 -0
  28. package/src/bitwrench-components.js +610 -0
  29. package/src/bitwrench-styles.js +3240 -0
  30. package/src/bitwrench.js +3367 -0
  31. package/src/cli/convert.js +205 -0
  32. package/src/cli/index.js +122 -0
  33. package/src/cli/inject.js +55 -0
  34. package/src/cli/layout-default.js +142 -0
  35. package/src/generate-css.js +381 -0
  36. package/src/vendor/quikdown.js +654 -0
  37. package/src/version.js +16 -0
  38. package/.eslintrc.json +0 -27
  39. package/.github/workflows/codeql-analysis.yml +0 -72
  40. package/.travis.yml +0 -34
  41. package/bitwrench.css +0 -92
  42. package/bitwrench.js +0 -3348
  43. package/bitwrench.js_sri.txt +0 -1
  44. package/bitwrench.min.js +0 -1
  45. package/bitwrench.min.js_sri.txt +0 -1
  46. package/bitwrench_ESM.js +0 -3207
  47. package/dev/bitwrench-todo.md +0 -215
  48. package/dev/css-arrows.md +0 -23
  49. package/dev/docStringDev.js +0 -124
  50. package/dev/docStringParseDev.js +0 -171
  51. package/dev/figures.html +0 -37
  52. package/dev/html_gen.js +0 -349
  53. package/dev/htmld.md +0 -250
  54. package/dev/htmldev.html +0 -45
  55. package/dev/index-old.html +0 -87
  56. package/dev/misc-notes.md +0 -21
  57. package/dev/notes.md +0 -2
  58. package/dev/sizes.html +0 -49
  59. package/dev/universal-js-module.js +0 -37
  60. package/examples/example1.html +0 -78
  61. package/examples/example10.html +0 -84
  62. package/examples/example2.html +0 -44
  63. package/examples/example3.html +0 -50
  64. package/examples/example4.html +0 -22
  65. package/examples/example5.html +0 -82
  66. package/examples/example6.html +0 -128
  67. package/examples/example7.html +0 -91
  68. package/examples/example8.html +0 -27
  69. package/examples/example9.html +0 -102
  70. package/icon/bitwrench-dark-tall.png +0 -0
  71. package/icon/bitwrench-dark.png +0 -0
  72. package/icon/bitwrench-icon-lt-grey.png +0 -0
  73. package/icon/bitwrench-icon.vsd +0 -0
  74. package/icon/bitwrench-logo-dark.png +0 -0
  75. package/icon/bitwrench-logo-full.png +0 -0
  76. package/icon/bitwrench-logo-green.png +0 -0
  77. package/icon/bitwrench-logo-grey.png +0 -0
  78. package/icon/bitwrench-logo-white.png +0 -0
  79. package/icon/bitwrench-logos-colors.png +0 -0
  80. package/icon/bitwrench-thick-logo.png +0 -0
  81. package/icon/bitwrench-thick-teal/android-chrome-192x192.png +0 -0
  82. package/icon/bitwrench-thick-teal/android-chrome-512x512.png +0 -0
  83. package/icon/bitwrench-thick-teal/apple-touch-icon.png +0 -0
  84. package/icon/bitwrench-thick-teal/browserconfig.xml +0 -9
  85. package/icon/bitwrench-thick-teal/favicon-16x16.png +0 -0
  86. package/icon/bitwrench-thick-teal/favicon-32x32.png +0 -0
  87. package/icon/bitwrench-thick-teal/favicon.ico +0 -0
  88. package/icon/bitwrench-thick-teal/mstile-144x144.png +0 -0
  89. package/icon/bitwrench-thick-teal/mstile-150x150.png +0 -0
  90. package/icon/bitwrench-thick-teal/mstile-310x150.png +0 -0
  91. package/icon/bitwrench-thick-teal/mstile-310x310.png +0 -0
  92. package/icon/bitwrench-thick-teal/mstile-70x70.png +0 -0
  93. package/icon/bitwrench-thick-teal/site.webmanifest +0 -19
  94. package/icon/bitwrench-thick-teal.ico +0 -0
  95. package/icon/bitwrench-thick-teal.svg +0 -44
  96. package/icon/bitwrench-thick-teal.zip +0 -0
  97. package/icon/favicon-test.html +0 -20
  98. package/icon/logos-test.PNG +0 -0
  99. package/images/bitwrench-512x512.png +0 -0
  100. package/images/bitwrench-logo-med.png +0 -0
  101. package/images/bitwrench-thick-logo.png +0 -0
  102. package/images/bitwrench-thick-logo.svg +0 -64
  103. package/images/bitwrench-thick-teal.ico +0 -0
  104. package/images/favicon.ico +0 -0
  105. package/index.html +0 -256
  106. package/instr_tmp/bitwrench.js +0 -1350
  107. package/karma.conf.js +0 -140
  108. package/makefile +0 -21
  109. package/quick-docs.html +0 -206
  110. package/test/bitwrench_test.js +0 -1255
  111. package/test/karma-test.js +0 -1081
  112. package/tools/bw_deprecatedNames.js +0 -19
  113. package/tools/bwconsole.js +0 -20
  114. package/tools/createSimpleHTMLPage.js +0 -41
  115. package/tools/emitreadme.sh +0 -4
  116. package/tools/export-bw-default-css.js +0 -41
  117. package/tools/umd2ModuleHack.js +0 -32
  118. package/tools/update-bw-package.js +0 -36
  119. package/tools/updatereadme.js +0 -34
@@ -0,0 +1,381 @@
1
+ /**
2
+ * Generate bitwrench.css from the styles object
3
+ * Creates class-based CSS to prevent collisions with other frameworks
4
+ */
5
+
6
+ import { getAllStyles } from './bitwrench-styles.js';
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+
10
+ // Convert styles object to CSS string
11
+ function stylesToCSS(styles) {
12
+ let css = `/**
13
+ * Bitwrench v2 CSS
14
+ * Class-based styles to prevent framework collisions
15
+ * Generated from bitwrench-styles.js
16
+ */
17
+
18
+ /* Base styles with .bw namespace */
19
+ `;
20
+
21
+ // Process each style rule
22
+ for (const [selector, rules] of Object.entries(styles)) {
23
+ if (typeof rules !== 'object') continue;
24
+
25
+ // Handle media queries
26
+ if (selector.startsWith('@media')) {
27
+ css += `\n${selector} {\n`;
28
+ for (const [innerSelector, innerRules] of Object.entries(rules)) {
29
+ css += ` ${processSelector(innerSelector)} {\n`;
30
+ css += processRules(innerRules, ' ');
31
+ css += ` }\n`;
32
+ }
33
+ css += `}\n`;
34
+ }
35
+ // Handle keyframes
36
+ else if (selector.startsWith('@keyframes')) {
37
+ css += `\n${selector} {\n`;
38
+ for (const [frame, frameRules] of Object.entries(rules)) {
39
+ css += ` ${frame} {\n`;
40
+ css += processRules(frameRules, ' ');
41
+ css += ` }\n`;
42
+ }
43
+ css += `}\n`;
44
+ }
45
+ // Regular selectors
46
+ else {
47
+ const processedSelector = processSelector(selector);
48
+ css += `\n${processedSelector} {\n`;
49
+ css += processRules(rules, ' ');
50
+ css += `}\n`;
51
+ }
52
+ }
53
+
54
+ return css;
55
+ }
56
+
57
+ // Process selector to add .bw prefix where needed
58
+ function processSelector(selector) {
59
+ // Don't modify :root, html, body, or already namespaced selectors
60
+ if (selector === ':root' || selector === 'html' || selector === 'body' || selector.includes('.bw-')) {
61
+ return selector;
62
+ }
63
+
64
+ // For element selectors, keep them as is (they'll be scoped by parent)
65
+ if (/^[a-z]+$/i.test(selector) || selector === '*') {
66
+ return selector;
67
+ }
68
+
69
+ // For class selectors, add .bw- prefix if not present
70
+ if (selector.startsWith('.')) {
71
+ const className = selector.substring(1);
72
+ // Skip Bootstrap-like classes that we're overriding
73
+ const bootstrapClasses = ['container', 'row', 'col', 'btn', 'card', 'alert', 'badge', 'table', 'form-control', 'navbar'];
74
+ if (bootstrapClasses.some(cls => className.startsWith(cls))) {
75
+ return selector;
76
+ }
77
+ return `.bw-${className}`;
78
+ }
79
+
80
+ return selector;
81
+ }
82
+
83
+ // Process CSS rules
84
+ function processRules(rules, indent = '') {
85
+ let css = '';
86
+ for (const [property, value] of Object.entries(rules)) {
87
+ if (value != null && typeof value !== 'object') {
88
+ const kebabProperty = property.replace(/[A-Z]/g, m => '-' + m.toLowerCase());
89
+ css += `${indent}${kebabProperty}: ${value};\n`;
90
+ }
91
+ }
92
+ return css;
93
+ }
94
+
95
+ // Generate the CSS
96
+ const styles = getAllStyles();
97
+ const css = stylesToCSS(styles);
98
+
99
+ // Add additional bitwrench-specific styles
100
+ const additionalCSS = `
101
+ /* Bitwrench Page Layout */
102
+ .bw-page {
103
+ min-height: 100vh;
104
+ display: flex;
105
+ flex-direction: column;
106
+ background-color: #f8f9fa;
107
+ }
108
+
109
+ .bw-page-content {
110
+ flex: 1;
111
+ padding: 2rem 0;
112
+ }
113
+
114
+ /* Responsive body margins */
115
+ @media (min-width: 576px) {
116
+ .bw-page-content {
117
+ padding: 3rem 0;
118
+ }
119
+ }
120
+
121
+ @media (min-width: 768px) {
122
+ .bw-page-content {
123
+ padding: 4rem 0;
124
+ }
125
+ }
126
+
127
+ /* Theme variations */
128
+ .bw-theme-dark,
129
+ .bw-theme-dark body {
130
+ background-color: #212529;
131
+ color: #fff;
132
+ }
133
+
134
+ .bw-theme-dark h1,
135
+ .bw-theme-dark h2,
136
+ .bw-theme-dark h3,
137
+ .bw-theme-dark h4,
138
+ .bw-theme-dark h5,
139
+ .bw-theme-dark h6 {
140
+ color: #fff;
141
+ }
142
+
143
+ .bw-theme-dark .text-muted {
144
+ color: #adb5bd !important;
145
+ }
146
+
147
+ .bw-theme-dark .lead {
148
+ color: #e9ecef;
149
+ }
150
+
151
+ .bw-theme-dark .card {
152
+ background-color: #343a40;
153
+ border-color: #495057;
154
+ color: #fff;
155
+ }
156
+
157
+ .bw-theme-dark .btn-light {
158
+ background-color: #495057;
159
+ border-color: #495057;
160
+ color: #fff;
161
+ }
162
+
163
+ .bw-theme-dark .btn-light:hover {
164
+ background-color: #5a6268;
165
+ border-color: #545b62;
166
+ }
167
+
168
+ .bw-theme-dark .navbar-light {
169
+ background-color: #343a40 !important;
170
+ }
171
+
172
+ .bw-theme-dark .navbar-light .navbar-brand,
173
+ .bw-theme-dark .navbar-light .nav-link {
174
+ color: rgba(255,255,255,.8);
175
+ }
176
+
177
+ .bw-theme-dark .navbar-light .nav-link:hover {
178
+ color: rgba(255,255,255,.9);
179
+ }
180
+
181
+ .bw-theme-dark .navbar-light .nav-link.active {
182
+ color: #fff;
183
+ }
184
+
185
+ .bw-theme-dark .bg-light {
186
+ background-color: #495057 !important;
187
+ color: #fff;
188
+ }
189
+
190
+ .bw-theme-dark .text-muted {
191
+ color: #adb5bd !important;
192
+ }
193
+
194
+ .bw-theme-dark .table {
195
+ color: #fff;
196
+ border-color: #495057;
197
+ }
198
+
199
+ .bw-theme-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
200
+ background-color: rgba(255, 255, 255, 0.05);
201
+ }
202
+
203
+ .bw-theme-dark .table-hover > tbody > tr:hover > * {
204
+ background-color: rgba(255, 255, 255, 0.075);
205
+ color: #fff;
206
+ }
207
+
208
+ .bw-theme-dark .form-control {
209
+ background-color: #495057;
210
+ border-color: #495057;
211
+ color: #fff;
212
+ }
213
+
214
+ .bw-theme-dark .form-control:focus {
215
+ background-color: #495057;
216
+ border-color: #80bdff;
217
+ color: #fff;
218
+ }
219
+
220
+ .bw-theme-dark .form-control::placeholder {
221
+ color: #adb5bd;
222
+ }
223
+
224
+ .bw-theme-dark .form-select {
225
+ background-color: #495057;
226
+ border-color: #495057;
227
+ color: #fff;
228
+ }
229
+
230
+ .bw-theme-dark pre {
231
+ background-color: #343a40;
232
+ color: #f8f9fa;
233
+ }
234
+
235
+ .bw-theme-dark code {
236
+ color: #e83e8c;
237
+ }
238
+
239
+ /* Form switch in dark mode */
240
+ .bw-theme-dark .form-check-input:checked {
241
+ background-color: #0dcaf0;
242
+ border-color: #0dcaf0;
243
+ }
244
+
245
+ .bw-theme-dark .form-switch .form-check-input {
246
+ 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");
247
+ }
248
+
249
+ .bw-theme-dark .form-switch .form-check-input:checked {
250
+ 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");
251
+ }
252
+
253
+ .bw-theme-dark .form-check-label {
254
+ color: #fff;
255
+ }
256
+
257
+ /* Ensure proper spacing for example pages */
258
+ .bw-example-page {
259
+ padding: 0;
260
+ margin: 0;
261
+ }
262
+
263
+ .bw-example-page .container {
264
+ padding-top: 2rem;
265
+ padding-bottom: 2rem;
266
+ }
267
+
268
+ /* Make cards equal height in grid */
269
+ .row > [class*="col-"] > .card {
270
+ height: 100%;
271
+ }
272
+
273
+ /* Improve table styling */
274
+ .table {
275
+ margin-bottom: 0;
276
+ }
277
+
278
+ .table th {
279
+ font-weight: 600;
280
+ background-color: #f8f9fa;
281
+ border-bottom: 2px solid #dee2e6;
282
+ }
283
+
284
+ .bw-theme-dark .table th {
285
+ background-color: #343a40;
286
+ border-bottom-color: #495057;
287
+ }
288
+
289
+ /* Better spacing for buttons */
290
+ .btn + .btn {
291
+ margin-left: 0.5rem;
292
+ }
293
+
294
+ /* Card improvements */
295
+ .card {
296
+ transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
297
+ }
298
+
299
+ .card:hover {
300
+ transform: translateY(-2px);
301
+ }
302
+
303
+ .card-title {
304
+ font-weight: 600;
305
+ }
306
+
307
+ /* Navbar improvements */
308
+ .navbar {
309
+ box-shadow: 0 2px 4px rgba(0,0,0,.1);
310
+ }
311
+
312
+ .navbar-brand {
313
+ font-weight: 600;
314
+ }
315
+
316
+ /* Form improvements */
317
+ .form-label {
318
+ font-weight: 500;
319
+ margin-bottom: 0.5rem;
320
+ }
321
+
322
+ /* Code block improvements */
323
+ pre {
324
+ border-radius: 0.5rem;
325
+ border: 1px solid #dee2e6;
326
+ }
327
+
328
+ .bw-theme-dark pre {
329
+ border-color: #495057;
330
+ }
331
+
332
+ /* Alert improvements */
333
+ .alert {
334
+ border: none;
335
+ box-shadow: 0 1px 3px rgba(0,0,0,.1);
336
+ }
337
+
338
+ /* Progress bar improvements */
339
+ .progress {
340
+ box-shadow: none;
341
+ border: 1px solid rgba(0,0,0,.1);
342
+ }
343
+
344
+ /* Badge improvements */
345
+ .badge {
346
+ font-weight: 500;
347
+ padding: 0.375em 0.75em;
348
+ }
349
+
350
+ /* Responsive utilities */
351
+ @media (max-width: 575.98px) {
352
+ .display-1 { font-size: 3rem; }
353
+ .display-2 { font-size: 2.5rem; }
354
+ .display-3 { font-size: 2rem; }
355
+ .display-4 { font-size: 1.75rem; }
356
+ }
357
+
358
+ /* Print styles */
359
+ @media print {
360
+ .navbar,
361
+ .btn,
362
+ .bw-no-print {
363
+ display: none !important;
364
+ }
365
+
366
+ .bw-page {
367
+ min-height: auto;
368
+ }
369
+
370
+ .card {
371
+ border: 1px solid #000 !important;
372
+ page-break-inside: avoid;
373
+ }
374
+ }
375
+ `;
376
+
377
+ // Write to file
378
+ const outputPath = path.join(process.cwd(), 'dist', 'bitwrench.css');
379
+ fs.writeFileSync(outputPath, css + additionalCSS);
380
+
381
+ console.log(`Generated bitwrench.css at ${outputPath}`);