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,374 @@
1
+ /**
2
+ * Bitwrench v2 Component Library - Inline Version
3
+ * This file contains component factory functions that can be used directly in browsers
4
+ * without ES module support. All components return TACO objects.
5
+ */
6
+
7
+ // Attach to the global bw object
8
+ if (typeof window !== 'undefined' && window.bw) {
9
+
10
+ // Navigation Components
11
+ window.bw.components = window.bw.components || {};
12
+ const c = window.bw.components;
13
+
14
+ c.Navbar = function({ brand, brandHref = '#', dark = true, items = [] }) {
15
+ return {
16
+ t: 'nav',
17
+ a: { class: `navbar navbar-expand-lg ${dark ? 'navbar-dark bg-dark' : 'navbar-light bg-light'}` },
18
+ c: {
19
+ t: 'div',
20
+ a: { class: 'container' },
21
+ c: [
22
+ {
23
+ t: 'a',
24
+ a: { href: brandHref, class: 'navbar-brand' },
25
+ c: brand
26
+ },
27
+ items.length > 0 && {
28
+ t: 'div',
29
+ a: { class: 'navbar-collapse' },
30
+ c: {
31
+ t: 'ul',
32
+ a: { class: 'navbar-nav ms-auto' },
33
+ c: items.map(item => ({
34
+ t: 'li',
35
+ a: { class: 'nav-item' },
36
+ c: {
37
+ t: 'a',
38
+ a: {
39
+ href: item.href || '#',
40
+ class: `nav-link ${item.active ? 'active' : ''}`
41
+ },
42
+ c: item.text
43
+ }
44
+ }))
45
+ }
46
+ }
47
+ ].filter(Boolean)
48
+ }
49
+ };
50
+ };
51
+
52
+ // Layout Components
53
+ c.Container = function({ fluid = false, children }) {
54
+ return {
55
+ t: 'div',
56
+ a: { class: fluid ? 'container-fluid' : 'container' },
57
+ c: children
58
+ };
59
+ };
60
+
61
+ c.Row = function({ children, class: className = '' }) {
62
+ return {
63
+ t: 'div',
64
+ a: { class: `row ${className}`.trim() },
65
+ c: children
66
+ };
67
+ };
68
+
69
+ c.Col = function({ size, sm, md, lg, xl, children, class: className = '' }) {
70
+ const classes = ['col'];
71
+
72
+ if (size) classes.push(`col-${size}`);
73
+ if (sm) classes.push(`col-sm-${sm}`);
74
+ if (md) classes.push(`col-md-${md}`);
75
+ if (lg) classes.push(`col-lg-${lg}`);
76
+ if (xl) classes.push(`col-xl-${xl}`);
77
+
78
+ if (classes.length === 1 && !size) classes[0] = 'col';
79
+
80
+ return {
81
+ t: 'div',
82
+ a: { class: `${classes.join(' ')} ${className}`.trim() },
83
+ c: children
84
+ };
85
+ };
86
+
87
+ // Card Components
88
+ c.Card = function({
89
+ header,
90
+ title,
91
+ subtitle,
92
+ text,
93
+ footer,
94
+ children,
95
+ class: className = '',
96
+ shadow = false
97
+ }) {
98
+ return {
99
+ t: 'div',
100
+ a: { class: `card ${shadow ? 'shadow' : ''} ${className}`.trim() },
101
+ c: [
102
+ header && {
103
+ t: 'div',
104
+ a: { class: 'card-header' },
105
+ c: header
106
+ },
107
+ {
108
+ t: 'div',
109
+ a: { class: 'card-body' },
110
+ c: children || [
111
+ title && { t: 'h5', a: { class: 'card-title' }, c: title },
112
+ subtitle && { t: 'h6', a: { class: 'card-subtitle mb-2 text-muted' }, c: subtitle },
113
+ text && { t: 'p', a: { class: 'card-text' }, c: text }
114
+ ].filter(Boolean)
115
+ },
116
+ footer && {
117
+ t: 'div',
118
+ a: { class: 'card-footer' },
119
+ c: footer
120
+ }
121
+ ].filter(Boolean)
122
+ };
123
+ };
124
+
125
+ // Button Components
126
+ c.Button = function({
127
+ variant = 'primary',
128
+ size,
129
+ block = false,
130
+ disabled = false,
131
+ onClick,
132
+ children,
133
+ type = 'button',
134
+ class: className = ''
135
+ }) {
136
+ return {
137
+ t: 'button',
138
+ a: {
139
+ type,
140
+ class: [
141
+ 'btn',
142
+ `btn-${variant}`,
143
+ size && `btn-${size}`,
144
+ block && 'btn-block w-100',
145
+ className
146
+ ].filter(Boolean).join(' '),
147
+ disabled,
148
+ onclick: onClick
149
+ },
150
+ c: children
151
+ };
152
+ };
153
+
154
+ // Alert Components
155
+ c.Alert = function({ variant = 'primary', dismissible = false, children, onClose }) {
156
+ return {
157
+ t: 'div',
158
+ a: {
159
+ class: `alert alert-${variant} ${dismissible ? 'alert-dismissible fade show' : ''}`.trim(),
160
+ role: 'alert'
161
+ },
162
+ c: [
163
+ ...(Array.isArray(children) ? children : [children]),
164
+ dismissible && {
165
+ t: 'button',
166
+ a: {
167
+ type: 'button',
168
+ class: 'btn-close',
169
+ onclick: onClose || function(e) { e.target.closest('.alert').remove(); }
170
+ }
171
+ }
172
+ ].filter(Boolean)
173
+ };
174
+ };
175
+
176
+ // Badge Components
177
+ c.Badge = function({ variant = 'primary', pill = false, children }) {
178
+ return {
179
+ t: 'span',
180
+ a: { class: `badge badge-${variant} ${pill ? 'rounded-pill' : ''}`.trim() },
181
+ c: children
182
+ };
183
+ };
184
+
185
+ // Progress Components
186
+ c.Progress = function({ value = 0, max = 100, height, striped = false, animated = false, variant = 'primary' }) {
187
+ return {
188
+ t: 'div',
189
+ a: {
190
+ class: 'progress',
191
+ style: height ? { height: `${height}px` } : undefined
192
+ },
193
+ c: {
194
+ t: 'div',
195
+ a: {
196
+ class: [
197
+ 'progress-bar',
198
+ `bg-${variant}`,
199
+ striped && 'progress-bar-striped',
200
+ animated && 'progress-bar-animated'
201
+ ].filter(Boolean).join(' '),
202
+ role: 'progressbar',
203
+ style: { width: `${(value / max) * 100}%` },
204
+ 'aria-valuenow': value,
205
+ 'aria-valuemin': 0,
206
+ 'aria-valuemax': max
207
+ },
208
+ c: `${Math.round((value / max) * 100)}%`
209
+ }
210
+ };
211
+ };
212
+
213
+ // Page Layout Components
214
+ c.PageHeader = function({ title, subtitle, breadcrumb }) {
215
+ return {
216
+ t: 'div',
217
+ a: { class: 'page-header mb-4' },
218
+ c: [
219
+ breadcrumb && {
220
+ t: 'nav',
221
+ a: { 'aria-label': 'breadcrumb' },
222
+ c: {
223
+ t: 'ol',
224
+ a: { class: 'breadcrumb' },
225
+ c: breadcrumb.map((item, idx) => ({
226
+ t: 'li',
227
+ a: {
228
+ class: `breadcrumb-item ${idx === breadcrumb.length - 1 ? 'active' : ''}`,
229
+ 'aria-current': idx === breadcrumb.length - 1 ? 'page' : undefined
230
+ },
231
+ c: item.href && idx !== breadcrumb.length - 1 ? {
232
+ t: 'a',
233
+ a: { href: item.href },
234
+ c: item.text
235
+ } : item.text || item
236
+ }))
237
+ }
238
+ },
239
+ {
240
+ t: 'h1',
241
+ a: { class: 'display-4' },
242
+ c: title
243
+ },
244
+ subtitle && {
245
+ t: 'p',
246
+ a: { class: 'lead' },
247
+ c: subtitle
248
+ }
249
+ ].filter(Boolean)
250
+ };
251
+ };
252
+
253
+ // Stat Card for dashboards
254
+ c.StatCard = function({ title, value, change, icon, variant = 'primary' }) {
255
+ return {
256
+ t: 'div',
257
+ a: { class: 'card' },
258
+ c: {
259
+ t: 'div',
260
+ a: { class: 'card-body' },
261
+ c: [
262
+ {
263
+ t: 'div',
264
+ a: { class: 'd-flex justify-content-between align-items-center' },
265
+ c: [
266
+ {
267
+ t: 'div',
268
+ c: [
269
+ { t: 'h6', a: { class: 'text-muted mb-2' }, c: title },
270
+ { t: 'h2', a: { class: 'mb-0' }, c: value },
271
+ change && {
272
+ t: 'small',
273
+ a: {
274
+ class: `text-${change > 0 ? 'success' : 'danger'}`
275
+ },
276
+ c: `${change > 0 ? '↑' : '↓'} ${Math.abs(change)}%`
277
+ }
278
+ ].filter(Boolean)
279
+ },
280
+ icon && {
281
+ t: 'div',
282
+ a: {
283
+ class: `text-${variant}`,
284
+ style: { fontSize: '3rem', opacity: 0.3 }
285
+ },
286
+ c: icon
287
+ }
288
+ ].filter(Boolean)
289
+ }
290
+ ]
291
+ }
292
+ };
293
+ };
294
+
295
+ // Table Component
296
+ c.Table = function({
297
+ striped = false,
298
+ hover = false,
299
+ bordered = false,
300
+ responsive = false,
301
+ class: className = '',
302
+ children
303
+ }) {
304
+ const table = {
305
+ t: 'table',
306
+ a: {
307
+ class: [
308
+ 'table',
309
+ striped && 'table-striped',
310
+ hover && 'table-hover',
311
+ bordered && 'table-bordered',
312
+ className
313
+ ].filter(Boolean).join(' ')
314
+ },
315
+ c: children
316
+ };
317
+
318
+ return responsive ? {
319
+ t: 'div',
320
+ a: { class: 'table-responsive' },
321
+ c: table
322
+ } : table;
323
+ };
324
+
325
+ // Table with sorting support
326
+ c.SortableTable = function({ data = [], columns = [], sortColumn = null, sortDirection = 'asc', onSort }) {
327
+ const table = {
328
+ t: 'table',
329
+ a: { class: 'table table-striped table-hover' },
330
+ c: [
331
+ {
332
+ t: 'thead',
333
+ c: {
334
+ t: 'tr',
335
+ c: columns.map(col => ({
336
+ t: 'th',
337
+ a: {
338
+ scope: 'col',
339
+ style: { cursor: 'pointer', userSelect: 'none' },
340
+ onclick: () => onSort && onSort(col.key)
341
+ },
342
+ c: [
343
+ col.label,
344
+ {
345
+ t: 'span',
346
+ a: { class: 'ms-1' },
347
+ c: sortColumn === col.key
348
+ ? (sortDirection === 'asc' ? '↑' : '↓')
349
+ : '↕'
350
+ }
351
+ ]
352
+ }))
353
+ }
354
+ },
355
+ {
356
+ t: 'tbody',
357
+ c: data.map(row => ({
358
+ t: 'tr',
359
+ c: columns.map(col => ({
360
+ t: 'td',
361
+ c: col.render ? col.render(row[col.key], row) : row[col.key]
362
+ }))
363
+ }))
364
+ }
365
+ ]
366
+ };
367
+
368
+ return {
369
+ t: 'div',
370
+ a: { class: 'table-responsive' },
371
+ c: table
372
+ };
373
+ };
374
+ }