bitwrench 2.0.14 → 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.
- package/dist/bitwrench-code-edit.cjs.js +46 -46
- package/dist/bitwrench-code-edit.cjs.min.js +16 -0
- package/dist/bitwrench-code-edit.es5.js +8 -8
- package/dist/bitwrench-code-edit.es5.min.js +2 -2
- package/dist/bitwrench-code-edit.esm.js +46 -46
- package/dist/bitwrench-code-edit.esm.min.js +2 -2
- package/dist/bitwrench-code-edit.umd.js +46 -46
- package/dist/bitwrench-code-edit.umd.min.js +2 -2
- package/dist/bitwrench-lean.cjs.js +4551 -3272
- package/dist/bitwrench-lean.cjs.min.js +35 -6
- package/dist/bitwrench-lean.es5.js +5747 -4414
- package/dist/bitwrench-lean.es5.min.js +32 -3
- package/dist/bitwrench-lean.esm.js +4551 -3272
- package/dist/bitwrench-lean.esm.min.js +35 -6
- package/dist/bitwrench-lean.umd.js +4551 -3272
- package/dist/bitwrench-lean.umd.min.js +35 -6
- package/dist/bitwrench.cjs.js +4739 -3720
- package/dist/bitwrench.cjs.min.js +38 -8
- package/dist/bitwrench.css +2253 -6041
- package/dist/bitwrench.es5.js +6234 -5130
- package/dist/bitwrench.es5.min.js +34 -5
- package/dist/bitwrench.esm.js +4739 -3720
- package/dist/bitwrench.esm.min.js +38 -8
- package/dist/bitwrench.min.css +1 -0
- package/dist/bitwrench.umd.js +4739 -3720
- package/dist/bitwrench.umd.min.js +38 -8
- package/dist/builds.json +89 -67
- package/dist/sri.json +28 -26
- package/package.json +7 -5
- package/readme.html +10 -10
- package/src/{bitwrench-components-v2.js → bitwrench-bccl.js} +396 -647
- package/src/bitwrench-code-edit.js +45 -45
- package/src/bitwrench-color-utils.js +25 -18
- package/src/bitwrench-components-stub.js +4 -1
- package/src/bitwrench-file-ops.js +180 -0
- package/src/bitwrench-lean.js +2 -2
- package/src/bitwrench-styles.js +1275 -4029
- package/src/bitwrench-utils.js +458 -0
- package/src/bitwrench.js +1686 -1293
- package/src/cli/layout-default.js +18 -18
- package/src/generate-css.js +73 -53
- package/src/version.js +3 -3
- package/src/bitwrench-component-base.js +0 -736
- package/src/bitwrench-components-inline.js +0 -374
- package/src/bitwrench-components.js +0 -610
|
@@ -1,374 +0,0 @@
|
|
|
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
|
-
}
|