bitwrench 2.0.31 → 2.1.0

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 (126) hide show
  1. package/README.md +210 -125
  2. package/dist/bitwrench-bccl.cjs.js +349 -188
  3. package/dist/bitwrench-bccl.cjs.min.js +2 -39
  4. package/dist/bitwrench-bccl.cjs.min.js.gz +0 -0
  5. package/dist/bitwrench-bccl.esm.js +349 -188
  6. package/dist/bitwrench-bccl.esm.min.js +2 -39
  7. package/dist/bitwrench-bccl.esm.min.js.gz +0 -0
  8. package/dist/bitwrench-bccl.umd.js +349 -188
  9. package/dist/bitwrench-bccl.umd.min.js +2 -39
  10. package/dist/bitwrench-bccl.umd.min.js.gz +0 -0
  11. package/dist/bitwrench-code-edit.cjs.js +17 -6
  12. package/dist/bitwrench-code-edit.cjs.min.js +2 -20
  13. package/dist/bitwrench-code-edit.es5.js +8 -3
  14. package/dist/bitwrench-code-edit.es5.min.js +2 -19
  15. package/dist/bitwrench-code-edit.esm.js +17 -6
  16. package/dist/bitwrench-code-edit.esm.min.js +2 -19
  17. package/dist/bitwrench-code-edit.umd.js +17 -6
  18. package/dist/bitwrench-code-edit.umd.min.js +2 -19
  19. package/dist/bitwrench-code-edit.umd.min.js.gz +0 -0
  20. package/dist/bitwrench-debug.js +1 -1
  21. package/dist/bitwrench-debug.min.js +1 -1
  22. package/dist/bitwrench-lean.cjs.js +2492 -1628
  23. package/dist/bitwrench-lean.cjs.min.js +2 -80
  24. package/dist/bitwrench-lean.cjs.min.js.gz +0 -0
  25. package/dist/bitwrench-lean.es5.js +2740 -1838
  26. package/dist/bitwrench-lean.es5.min.js +2 -49
  27. package/dist/bitwrench-lean.es5.min.js.gz +0 -0
  28. package/dist/bitwrench-lean.esm.js +2492 -1628
  29. package/dist/bitwrench-lean.esm.min.js +2 -80
  30. package/dist/bitwrench-lean.esm.min.js.gz +0 -0
  31. package/dist/bitwrench-lean.umd.js +2492 -1628
  32. package/dist/bitwrench-lean.umd.min.js +2 -80
  33. package/dist/bitwrench-lean.umd.min.js.gz +0 -0
  34. package/dist/bitwrench-util-color.cjs.js +251 -0
  35. package/dist/bitwrench-util-color.cjs.min.js +3 -0
  36. package/dist/bitwrench-util-color.es5.js +256 -0
  37. package/dist/bitwrench-util-color.es5.min.js +3 -0
  38. package/dist/bitwrench-util-color.esm.js +241 -0
  39. package/dist/bitwrench-util-color.esm.min.js +3 -0
  40. package/dist/bitwrench-util-color.umd.js +257 -0
  41. package/dist/bitwrench-util-color.umd.min.js +3 -0
  42. package/dist/bitwrench-util-css.cjs.js +2 -1
  43. package/dist/bitwrench-util-css.cjs.min.js +2 -21
  44. package/dist/bitwrench-util-css.es5.js +2 -1
  45. package/dist/bitwrench-util-css.es5.min.js +2 -20
  46. package/dist/bitwrench-util-css.esm.js +2 -1
  47. package/dist/bitwrench-util-css.esm.min.js +1 -19
  48. package/dist/bitwrench-util-css.umd.js +2 -1
  49. package/dist/bitwrench-util-css.umd.min.js +2 -20
  50. package/dist/bitwrench-util-css.umd.min.js.gz +0 -0
  51. package/dist/bitwrench.cjs.js +2826 -1801
  52. package/dist/bitwrench.cjs.min.js +2 -99
  53. package/dist/bitwrench.cjs.min.js.gz +0 -0
  54. package/dist/bitwrench.css +403 -479
  55. package/dist/bitwrench.d.ts +70 -73
  56. package/dist/bitwrench.es5.js +3106 -2020
  57. package/dist/bitwrench.es5.min.js +2 -67
  58. package/dist/bitwrench.es5.min.js.gz +0 -0
  59. package/dist/bitwrench.esm.js +2826 -1801
  60. package/dist/bitwrench.esm.min.js +2 -99
  61. package/dist/bitwrench.esm.min.js.gz +0 -0
  62. package/dist/bitwrench.min.css +1 -1
  63. package/dist/bitwrench.umd.js +2826 -1801
  64. package/dist/bitwrench.umd.min.js +2 -99
  65. package/dist/bitwrench.umd.min.js.gz +0 -0
  66. package/dist/builds.json +222 -134
  67. package/dist/bwserve.cjs.js +308 -298
  68. package/dist/bwserve.d.ts +157 -0
  69. package/dist/bwserve.esm.js +309 -299
  70. package/dist/sri.json +54 -46
  71. package/docs/README.md +6 -3
  72. package/docs/app-patterns.md +7 -6
  73. package/docs/bitwrench-for-wasm.md +53 -54
  74. package/docs/bitwrench-mcp.md +2 -2
  75. package/docs/bitwrench-northstar-principles.md +406 -0
  76. package/docs/bitwrench-taco-schema-discussion.md +2 -2
  77. package/docs/bitwrench_api.md +191 -106
  78. package/docs/bitwrench_typescript_usage.md +5 -5
  79. package/docs/bw-attach.md +29 -75
  80. package/docs/bwserve.md +200 -168
  81. package/docs/cli.md +36 -12
  82. package/docs/component-cheatsheet.md +2 -2
  83. package/docs/component-library.md +4 -4
  84. package/docs/component-lifecycle.md +234 -0
  85. package/docs/drift-lint.md +268 -0
  86. package/docs/framework-translation-table.md +4 -4
  87. package/docs/llm-bitwrench-guide.md +60 -50
  88. package/docs/routing.md +11 -13
  89. package/docs/state-management.md +110 -109
  90. package/docs/taco-format.md +13 -14
  91. package/docs/theming.md +13 -3
  92. package/docs/thinking-in-bitwrench.md +858 -983
  93. package/docs/tutorial-bwserve.md +37 -36
  94. package/docs/tutorial-embedded.md +10 -21
  95. package/docs/tutorial-website.md +2 -2
  96. package/package.json +38 -7
  97. package/readme.html +262 -160
  98. package/src/bitwrench-bccl-entry.js +2 -2
  99. package/src/bitwrench-bccl.js +346 -185
  100. package/src/bitwrench-code-edit.js +16 -5
  101. package/src/bitwrench-color-utils.js +117 -181
  102. package/src/bitwrench-file-ops.js +2 -2
  103. package/src/bitwrench-lean.js +4 -3
  104. package/src/bitwrench-router.js +5 -2
  105. package/src/bitwrench-styles.js +420 -504
  106. package/src/bitwrench-util-color.js +240 -0
  107. package/src/bitwrench-util-css.js +1 -0
  108. package/src/bitwrench-utils.js +4 -0
  109. package/src/bitwrench.d.ts +70 -73
  110. package/src/bitwrench.h +5 -0
  111. package/src/bitwrench.js +1939 -933
  112. package/src/bwserve/attach.js +0 -1
  113. package/src/bwserve/bwclient.js +172 -32
  114. package/src/bwserve/bwshell.js +0 -4
  115. package/src/bwserve/client.js +59 -220
  116. package/src/bwserve/index.js +78 -42
  117. package/src/bwserve.d.ts +157 -0
  118. package/src/bwserve.h +5 -0
  119. package/src/cli/attach.js +12 -75
  120. package/src/cli/convert.js +2 -2
  121. package/src/cli/serve.js +37 -35
  122. package/src/generate-css.js +1 -1
  123. package/src/mcp/knowledge.js +4 -4
  124. package/src/mcp/live.js +21 -13
  125. package/src/mcp/tools.js +0 -1
  126. package/src/version.js +3 -7
@@ -0,0 +1,241 @@
1
+ /*! bitwrench-util-color v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ /**
3
+ * bitwrench-util-color.js - Legacy color parsing and conversion utilities
4
+ *
5
+ * Self-contained module providing CSS color parsing, RGB/HSL conversion,
6
+ * and multi-stop color interpolation. Extracted from bitwrench core in v2.1.
7
+ *
8
+ * Can be loaded standalone (browser script tag after bitwrench.umd.js),
9
+ * or imported as an ES module / CJS module.
10
+ *
11
+ * @module bitwrench-util-color
12
+ * @license BSD-2-Clause
13
+ * @author M A Chatterjee <deftio [at] deftio [dot] com>
14
+ */
15
+
16
+ function _clip(val, min, max) {
17
+ return Math.max(min, Math.min(max, val));
18
+ }
19
+
20
+ function _mapScale(x, in0, in1, out0, out1, options) {
21
+ if (!options) options = {};
22
+ var doClip = options.clip || false;
23
+ var expScale = options.expScale || 1;
24
+ var normalized = (x - in0) / (in1 - in0);
25
+ if (expScale !== 1) normalized = Math.pow(normalized, expScale);
26
+ var result = normalized * (out1 - out0) + out0;
27
+ if (doClip) {
28
+ var mn = Math.min(out0, out1);
29
+ var mx = Math.max(out0, out1);
30
+ result = Math.max(mn, Math.min(mx, result));
31
+ }
32
+ return result;
33
+ }
34
+
35
+ /**
36
+ * Convert HSL to RGB.
37
+ * @param {number|Array} h - Hue 0-360, or [h,s,l,a] array
38
+ * @param {number} [s] - Saturation 0-100
39
+ * @param {number} [l] - Lightness 0-100
40
+ * @param {number} [a=255] - Alpha 0-255
41
+ * @param {boolean} [rnd=true] - Round results
42
+ * @returns {Array} [r, g, b, a, "rgb"]
43
+ */
44
+ function colorHslToRgb(h, s, l, a, rnd) {
45
+ if (a === undefined) a = 255;
46
+ if (rnd === undefined) rnd = true;
47
+ if (Array.isArray(h)) {
48
+ s = h[1]; l = h[2]; a = h[3] !== undefined ? h[3] : 255; h = h[0];
49
+ }
50
+
51
+ var hNorm = h / 360;
52
+ var sNorm = s / 100;
53
+ var lNorm = l / 100;
54
+
55
+ var r, g, b;
56
+
57
+ if (sNorm === 0) {
58
+ r = g = b = lNorm * 255;
59
+ } else {
60
+ var hue2rgb = function(p, q, t) {
61
+ if (t < 0) t += 1;
62
+ if (t > 1) t -= 1;
63
+ if (t < 1/6) return p + (q - p) * 6 * t;
64
+ if (t < 1/2) return q;
65
+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
66
+ return p;
67
+ };
68
+
69
+ var q = lNorm < 0.5 ? lNorm * (1 + sNorm) : lNorm + sNorm - lNorm * sNorm;
70
+ var p = 2 * lNorm - q;
71
+
72
+ r = hue2rgb(p, q, hNorm + 1/3) * 255;
73
+ g = hue2rgb(p, q, hNorm) * 255;
74
+ b = hue2rgb(p, q, hNorm - 1/3) * 255;
75
+ }
76
+
77
+ if (rnd) {
78
+ r = Math.round(r);
79
+ g = Math.round(g);
80
+ b = Math.round(b);
81
+ a = Math.round(a);
82
+ }
83
+
84
+ return [r, g, b, a, "rgb"];
85
+ }
86
+
87
+ /**
88
+ * Convert RGB to HSL.
89
+ * @param {number|Array} r - Red 0-255, or [r,g,b,a] array
90
+ * @param {number} [g] - Green 0-255
91
+ * @param {number} [b] - Blue 0-255
92
+ * @param {number} [a=255] - Alpha 0-255
93
+ * @param {boolean} [rnd=true] - Round results
94
+ * @returns {Array} [h, s, l, a, "hsl"]
95
+ */
96
+ function colorRgbToHsl(r, g, b, a, rnd) {
97
+ if (a === undefined) a = 255;
98
+ if (rnd === undefined) rnd = true;
99
+ if (Array.isArray(r)) {
100
+ g = r[1]; b = r[2]; a = r[3] !== undefined ? r[3] : 255; r = r[0];
101
+ }
102
+
103
+ r /= 255;
104
+ g /= 255;
105
+ b /= 255;
106
+
107
+ var max = Math.max(r, g, b);
108
+ var min = Math.min(r, g, b);
109
+ var h, s, l = (max + min) / 2;
110
+
111
+ if (max === min) {
112
+ h = s = 0;
113
+ } else {
114
+ var d = max - min;
115
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
116
+
117
+ switch (max) {
118
+ case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
119
+ case g: h = ((b - r) / d + 2) / 6; break;
120
+ case b: h = ((r - g) / d + 4) / 6; break;
121
+ }
122
+ }
123
+
124
+ h *= 360;
125
+ s *= 100;
126
+ l *= 100;
127
+
128
+ if (rnd) {
129
+ h = Math.round(h);
130
+ s = Math.round(s);
131
+ l = Math.round(l);
132
+ a = Math.round(a);
133
+ }
134
+
135
+ return [h, s, l, a, "hsl"];
136
+ }
137
+
138
+ /**
139
+ * Parse a CSS color string to [r, g, b, a, "rgb"].
140
+ * Handles #hex, rgb(), rgba(), hsl(), hsla(), and bitwrench color arrays.
141
+ * @param {string|Array} s - Color string or array
142
+ * @param {number} [defAlpha=255] - Default alpha
143
+ * @returns {Array} [r, g, b, a, "rgb"]
144
+ */
145
+ function colorParse(s, defAlpha) {
146
+ if (defAlpha === undefined) defAlpha = 255;
147
+ var r = [0, 0, 0, defAlpha, "rgb"];
148
+
149
+ if (Array.isArray(s)) {
150
+ var df = [0, 0, 0, 255, "rgb"];
151
+ for (var p = 0; p < s.length && p < df.length; p++) {
152
+ df[p] = s[p];
153
+ }
154
+ return df;
155
+ }
156
+
157
+ s = String(s).replace(/\s/g, "");
158
+
159
+ if (s[0] === "#") {
160
+ var hex = s.slice(1);
161
+ if (hex.length === 3 || hex.length === 4) {
162
+ for (var i = 0; i < hex.length; i++) {
163
+ r[i] = parseInt(hex[i] + hex[i], 16);
164
+ }
165
+ } else if (hex.length === 6 || hex.length === 8) {
166
+ for (var j = 0; j < hex.length; j += 2) {
167
+ r[j / 2] = parseInt(hex.substring(j, j + 2), 16);
168
+ }
169
+ }
170
+ } else {
171
+ var match = s.match(/^(rgb|hsl)a?\(([^)]+)\)$/i);
172
+ if (match) {
173
+ var type = match[1].toLowerCase();
174
+ var values = match[2].split(",").map(function(v) { return parseFloat(v); });
175
+
176
+ if (type === "rgb") {
177
+ r[0] = values[0] || 0;
178
+ r[1] = values[1] || 0;
179
+ r[2] = values[2] || 0;
180
+ r[3] = values[3] !== undefined ? values[3] * 255 : defAlpha;
181
+ r[4] = "rgb";
182
+ } else if (type === "hsl") {
183
+ var rgb = colorHslToRgb(values[0] || 0, values[1] || 0, values[2] || 0,
184
+ values[3] !== undefined ? values[3] * 255 : defAlpha);
185
+ return rgb;
186
+ }
187
+ }
188
+ }
189
+
190
+ return r;
191
+ }
192
+
193
+ /**
194
+ * Interpolate between N colors based on a mapped position.
195
+ * @param {number} x - Input value
196
+ * @param {number} in0 - Input range start
197
+ * @param {number} in1 - Input range end
198
+ * @param {Array} colors - Array of color strings
199
+ * @param {number} [stretch] - Exponential scaling factor
200
+ * @returns {Array} [r, g, b, a, "rgb"]
201
+ */
202
+ function colorInterp(x, in0, in1, colors, stretch) {
203
+ var c = Array.isArray(colors) ? colors : ["#000", "#fff"];
204
+ c = c.length === 0 ? ["#000", "#fff"] : c;
205
+ if (c.length === 1) return c[0];
206
+
207
+ c = c.map(function(col) { return colorParse(col); });
208
+
209
+ var a = _mapScale(x, in0, in1, 0, c.length - 1, { clip: true, expScale: stretch });
210
+ var i = _clip(Math.floor(a), 0, c.length - 2);
211
+ var r = a - i;
212
+
213
+ var interp = function(idx) { return _mapScale(r, 0, 1, c[i][idx], c[i + 1][idx], { clip: true }); };
214
+ return [interp(0), interp(1), interp(2), interp(3), "rgb"];
215
+ }
216
+
217
+ var utilColor = {
218
+ colorParse: colorParse,
219
+ colorRgbToHsl: colorRgbToHsl,
220
+ colorHslToRgb: colorHslToRgb,
221
+ colorInterp: colorInterp
222
+ };
223
+
224
+ /**
225
+ * Install color utilities onto a bitwrench instance.
226
+ * @param {Object} bw - The bitwrench object to extend
227
+ */
228
+ function install(bw) {
229
+ if (!bw) return;
230
+ bw.colorParse = colorParse;
231
+ bw.colorRgbToHsl = colorRgbToHsl;
232
+ bw.colorHslToRgb = colorHslToRgb;
233
+ bw.colorInterp = colorInterp;
234
+ }
235
+
236
+ if (typeof window !== 'undefined' && window.bw) {
237
+ install(window.bw);
238
+ }
239
+
240
+ export { colorHslToRgb, colorInterp, colorParse, colorRgbToHsl, utilColor as default, install, utilColor };
241
+ //# sourceMappingURL=bitwrench-util-color.esm.js.map
@@ -0,0 +1,3 @@
1
+ /*! bitwrench-util-color v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ function r(r,a,n,t,o,e){e||(e={});var i=e.clip||!1,l=e.expScale||1,h=(r-a)/(n-a);1!==l&&(h=Math.pow(h,l));var f=h*(o-t)+t;if(i){var u=Math.min(t,o),s=Math.max(t,o);f=Math.max(u,Math.min(s,f))}return f}function a(r,a,n,t,o){void 0===t&&(t=255),void 0===o&&(o=!0),Array.isArray(r)&&(a=r[1],n=r[2],t=void 0!==r[3]?r[3]:255,r=r[0]);var e,i,l,h=r/360,f=a/100,u=n/100;if(0===f)e=i=l=255*u;else{var s=function(r,a,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+6*(a-r)*n:n<.5?a:n<2/3?r+(a-r)*(2/3-n)*6:r},c=u<.5?u*(1+f):u+f-u*f,g=2*u-c;e=255*s(g,c,h+1/3),i=255*s(g,c,h),l=255*s(g,c,h-1/3)}return o&&(e=Math.round(e),i=Math.round(i),l=Math.round(l),t=Math.round(t)),[e,i,l,t,"rgb"]}function n(r,a,n,t,o){void 0===t&&(t=255),void 0===o&&(o=!0),Array.isArray(r)&&(a=r[1],n=r[2],t=void 0!==r[3]?r[3]:255,r=r[0]),r/=255,a/=255,n/=255;var e,i,l=Math.max(r,a,n),h=Math.min(r,a,n),f=(l+h)/2;if(l===h)e=i=0;else{var u=l-h;switch(i=f>.5?u/(2-l-h):u/(l+h),l){case r:e=((a-n)/u+(a<n?6:0))/6;break;case a:e=((n-r)/u+2)/6;break;case n:e=((r-a)/u+4)/6}}return e*=360,i*=100,f*=100,o&&(e=Math.round(e),i=Math.round(i),f=Math.round(f),t=Math.round(t)),[e,i,f,t,"hsl"]}function t(r,n){void 0===n&&(n=255);var t=[0,0,0,n,"rgb"];if(Array.isArray(r)){for(var o=[0,0,0,255,"rgb"],e=0;e<r.length&&e<o.length;e++)o[e]=r[e];return o}if("#"===(r=String(r).replace(/\s/g,""))[0]){var i=r.slice(1);if(3===i.length||4===i.length)for(var l=0;l<i.length;l++)t[l]=parseInt(i[l]+i[l],16);else if(6===i.length||8===i.length)for(var h=0;h<i.length;h+=2)t[h/2]=parseInt(i.substring(h,h+2),16)}else{var f=r.match(/^(rgb|hsl)a?\(([^)]+)\)$/i);if(f){var u=f[1].toLowerCase(),s=f[2].split(",").map(function(r){return parseFloat(r)});if("rgb"===u)t[0]=s[0]||0,t[1]=s[1]||0,t[2]=s[2]||0,t[3]=void 0!==s[3]?255*s[3]:n,t[4]="rgb";else if("hsl"===u){return a(s[0]||0,s[1]||0,s[2]||0,void 0!==s[3]?255*s[3]:n)}}}return t}function o(a,n,o,e,i){var l=Array.isArray(e)?e:["#000","#fff"];if(1===(l=0===l.length?["#000","#fff"]:l).length)return l[0];var h,f,u,s=r(a,n,o,0,(l=l.map(function(r){return t(r)})).length-1,{clip:!0,expScale:i}),c=(h=Math.floor(s),f=0,u=l.length-2,Math.max(f,Math.min(u,h))),g=s-c,v=function(a){return r(g,0,1,l[c][a],l[c+1][a],{clip:!0})};return[v(0),v(1),v(2),v(3),"rgb"]}var e={colorParse:t,colorRgbToHsl:n,colorHslToRgb:a,colorInterp:o};function i(r){r&&(r.colorParse=t,r.colorRgbToHsl=n,r.colorHslToRgb=a,r.colorInterp=o)}"undefined"!=typeof window&&window.bw&&i(window.bw);export{a as colorHslToRgb,o as colorInterp,t as colorParse,n as colorRgbToHsl,e as default,i as install,e as utilColor};
3
+ //# sourceMappingURL=bitwrench-util-color.esm.min.js.map
@@ -0,0 +1,257 @@
1
+ /*! bitwrench-util-color v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bwUtilColor = {}));
6
+ })(this, (function (exports) { 'use strict';
7
+
8
+ /**
9
+ * bitwrench-util-color.js - Legacy color parsing and conversion utilities
10
+ *
11
+ * Self-contained module providing CSS color parsing, RGB/HSL conversion,
12
+ * and multi-stop color interpolation. Extracted from bitwrench core in v2.1.
13
+ *
14
+ * Can be loaded standalone (browser script tag after bitwrench.umd.js),
15
+ * or imported as an ES module / CJS module.
16
+ *
17
+ * @module bitwrench-util-color
18
+ * @license BSD-2-Clause
19
+ * @author M A Chatterjee <deftio [at] deftio [dot] com>
20
+ */
21
+
22
+ function _clip(val, min, max) {
23
+ return Math.max(min, Math.min(max, val));
24
+ }
25
+
26
+ function _mapScale(x, in0, in1, out0, out1, options) {
27
+ if (!options) options = {};
28
+ var doClip = options.clip || false;
29
+ var expScale = options.expScale || 1;
30
+ var normalized = (x - in0) / (in1 - in0);
31
+ if (expScale !== 1) normalized = Math.pow(normalized, expScale);
32
+ var result = normalized * (out1 - out0) + out0;
33
+ if (doClip) {
34
+ var mn = Math.min(out0, out1);
35
+ var mx = Math.max(out0, out1);
36
+ result = Math.max(mn, Math.min(mx, result));
37
+ }
38
+ return result;
39
+ }
40
+
41
+ /**
42
+ * Convert HSL to RGB.
43
+ * @param {number|Array} h - Hue 0-360, or [h,s,l,a] array
44
+ * @param {number} [s] - Saturation 0-100
45
+ * @param {number} [l] - Lightness 0-100
46
+ * @param {number} [a=255] - Alpha 0-255
47
+ * @param {boolean} [rnd=true] - Round results
48
+ * @returns {Array} [r, g, b, a, "rgb"]
49
+ */
50
+ function colorHslToRgb(h, s, l, a, rnd) {
51
+ if (a === undefined) a = 255;
52
+ if (rnd === undefined) rnd = true;
53
+ if (Array.isArray(h)) {
54
+ s = h[1]; l = h[2]; a = h[3] !== undefined ? h[3] : 255; h = h[0];
55
+ }
56
+
57
+ var hNorm = h / 360;
58
+ var sNorm = s / 100;
59
+ var lNorm = l / 100;
60
+
61
+ var r, g, b;
62
+
63
+ if (sNorm === 0) {
64
+ r = g = b = lNorm * 255;
65
+ } else {
66
+ var hue2rgb = function(p, q, t) {
67
+ if (t < 0) t += 1;
68
+ if (t > 1) t -= 1;
69
+ if (t < 1/6) return p + (q - p) * 6 * t;
70
+ if (t < 1/2) return q;
71
+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
72
+ return p;
73
+ };
74
+
75
+ var q = lNorm < 0.5 ? lNorm * (1 + sNorm) : lNorm + sNorm - lNorm * sNorm;
76
+ var p = 2 * lNorm - q;
77
+
78
+ r = hue2rgb(p, q, hNorm + 1/3) * 255;
79
+ g = hue2rgb(p, q, hNorm) * 255;
80
+ b = hue2rgb(p, q, hNorm - 1/3) * 255;
81
+ }
82
+
83
+ if (rnd) {
84
+ r = Math.round(r);
85
+ g = Math.round(g);
86
+ b = Math.round(b);
87
+ a = Math.round(a);
88
+ }
89
+
90
+ return [r, g, b, a, "rgb"];
91
+ }
92
+
93
+ /**
94
+ * Convert RGB to HSL.
95
+ * @param {number|Array} r - Red 0-255, or [r,g,b,a] array
96
+ * @param {number} [g] - Green 0-255
97
+ * @param {number} [b] - Blue 0-255
98
+ * @param {number} [a=255] - Alpha 0-255
99
+ * @param {boolean} [rnd=true] - Round results
100
+ * @returns {Array} [h, s, l, a, "hsl"]
101
+ */
102
+ function colorRgbToHsl(r, g, b, a, rnd) {
103
+ if (a === undefined) a = 255;
104
+ if (rnd === undefined) rnd = true;
105
+ if (Array.isArray(r)) {
106
+ g = r[1]; b = r[2]; a = r[3] !== undefined ? r[3] : 255; r = r[0];
107
+ }
108
+
109
+ r /= 255;
110
+ g /= 255;
111
+ b /= 255;
112
+
113
+ var max = Math.max(r, g, b);
114
+ var min = Math.min(r, g, b);
115
+ var h, s, l = (max + min) / 2;
116
+
117
+ if (max === min) {
118
+ h = s = 0;
119
+ } else {
120
+ var d = max - min;
121
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
122
+
123
+ switch (max) {
124
+ case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
125
+ case g: h = ((b - r) / d + 2) / 6; break;
126
+ case b: h = ((r - g) / d + 4) / 6; break;
127
+ }
128
+ }
129
+
130
+ h *= 360;
131
+ s *= 100;
132
+ l *= 100;
133
+
134
+ if (rnd) {
135
+ h = Math.round(h);
136
+ s = Math.round(s);
137
+ l = Math.round(l);
138
+ a = Math.round(a);
139
+ }
140
+
141
+ return [h, s, l, a, "hsl"];
142
+ }
143
+
144
+ /**
145
+ * Parse a CSS color string to [r, g, b, a, "rgb"].
146
+ * Handles #hex, rgb(), rgba(), hsl(), hsla(), and bitwrench color arrays.
147
+ * @param {string|Array} s - Color string or array
148
+ * @param {number} [defAlpha=255] - Default alpha
149
+ * @returns {Array} [r, g, b, a, "rgb"]
150
+ */
151
+ function colorParse(s, defAlpha) {
152
+ if (defAlpha === undefined) defAlpha = 255;
153
+ var r = [0, 0, 0, defAlpha, "rgb"];
154
+
155
+ if (Array.isArray(s)) {
156
+ var df = [0, 0, 0, 255, "rgb"];
157
+ for (var p = 0; p < s.length && p < df.length; p++) {
158
+ df[p] = s[p];
159
+ }
160
+ return df;
161
+ }
162
+
163
+ s = String(s).replace(/\s/g, "");
164
+
165
+ if (s[0] === "#") {
166
+ var hex = s.slice(1);
167
+ if (hex.length === 3 || hex.length === 4) {
168
+ for (var i = 0; i < hex.length; i++) {
169
+ r[i] = parseInt(hex[i] + hex[i], 16);
170
+ }
171
+ } else if (hex.length === 6 || hex.length === 8) {
172
+ for (var j = 0; j < hex.length; j += 2) {
173
+ r[j / 2] = parseInt(hex.substring(j, j + 2), 16);
174
+ }
175
+ }
176
+ } else {
177
+ var match = s.match(/^(rgb|hsl)a?\(([^)]+)\)$/i);
178
+ if (match) {
179
+ var type = match[1].toLowerCase();
180
+ var values = match[2].split(",").map(function(v) { return parseFloat(v); });
181
+
182
+ if (type === "rgb") {
183
+ r[0] = values[0] || 0;
184
+ r[1] = values[1] || 0;
185
+ r[2] = values[2] || 0;
186
+ r[3] = values[3] !== undefined ? values[3] * 255 : defAlpha;
187
+ r[4] = "rgb";
188
+ } else if (type === "hsl") {
189
+ var rgb = colorHslToRgb(values[0] || 0, values[1] || 0, values[2] || 0,
190
+ values[3] !== undefined ? values[3] * 255 : defAlpha);
191
+ return rgb;
192
+ }
193
+ }
194
+ }
195
+
196
+ return r;
197
+ }
198
+
199
+ /**
200
+ * Interpolate between N colors based on a mapped position.
201
+ * @param {number} x - Input value
202
+ * @param {number} in0 - Input range start
203
+ * @param {number} in1 - Input range end
204
+ * @param {Array} colors - Array of color strings
205
+ * @param {number} [stretch] - Exponential scaling factor
206
+ * @returns {Array} [r, g, b, a, "rgb"]
207
+ */
208
+ function colorInterp(x, in0, in1, colors, stretch) {
209
+ var c = Array.isArray(colors) ? colors : ["#000", "#fff"];
210
+ c = c.length === 0 ? ["#000", "#fff"] : c;
211
+ if (c.length === 1) return c[0];
212
+
213
+ c = c.map(function(col) { return colorParse(col); });
214
+
215
+ var a = _mapScale(x, in0, in1, 0, c.length - 1, { clip: true, expScale: stretch });
216
+ var i = _clip(Math.floor(a), 0, c.length - 2);
217
+ var r = a - i;
218
+
219
+ var interp = function(idx) { return _mapScale(r, 0, 1, c[i][idx], c[i + 1][idx], { clip: true }); };
220
+ return [interp(0), interp(1), interp(2), interp(3), "rgb"];
221
+ }
222
+
223
+ var utilColor = {
224
+ colorParse: colorParse,
225
+ colorRgbToHsl: colorRgbToHsl,
226
+ colorHslToRgb: colorHslToRgb,
227
+ colorInterp: colorInterp
228
+ };
229
+
230
+ /**
231
+ * Install color utilities onto a bitwrench instance.
232
+ * @param {Object} bw - The bitwrench object to extend
233
+ */
234
+ function install(bw) {
235
+ if (!bw) return;
236
+ bw.colorParse = colorParse;
237
+ bw.colorRgbToHsl = colorRgbToHsl;
238
+ bw.colorHslToRgb = colorHslToRgb;
239
+ bw.colorInterp = colorInterp;
240
+ }
241
+
242
+ if (typeof window !== 'undefined' && window.bw) {
243
+ install(window.bw);
244
+ }
245
+
246
+ exports.colorHslToRgb = colorHslToRgb;
247
+ exports.colorInterp = colorInterp;
248
+ exports.colorParse = colorParse;
249
+ exports.colorRgbToHsl = colorRgbToHsl;
250
+ exports.default = utilColor;
251
+ exports.install = install;
252
+ exports.utilColor = utilColor;
253
+
254
+ Object.defineProperty(exports, '__esModule', { value: true });
255
+
256
+ }));
257
+ //# sourceMappingURL=bitwrench-util-color.umd.js.map
@@ -0,0 +1,3 @@
1
+ /*! bitwrench-util-color v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ !function(r,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((r="undefined"!=typeof globalThis?globalThis:r||self).bwUtilColor={})}(this,function(r){"use strict";function o(r,o,e,t,n,a){a||(a={});var i=a.clip||!1,l=a.expScale||1,f=(r-o)/(e-o);1!==l&&(f=Math.pow(f,l));var s=f*(n-t)+t;if(i){var u=Math.min(t,n),c=Math.max(t,n);s=Math.max(u,Math.min(c,s))}return s}function e(r,o,e,t,n){void 0===t&&(t=255),void 0===n&&(n=!0),Array.isArray(r)&&(o=r[1],e=r[2],t=void 0!==r[3]?r[3]:255,r=r[0]);var a,i,l,f=r/360,s=o/100,u=e/100;if(0===s)a=i=l=255*u;else{var c=function(r,o,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+6*(o-r)*e:e<.5?o:e<2/3?r+(o-r)*(2/3-e)*6:r},h=u<.5?u*(1+s):u+s-u*s,d=2*u-h;a=255*c(d,h,f+1/3),i=255*c(d,h,f),l=255*c(d,h,f-1/3)}return n&&(a=Math.round(a),i=Math.round(i),l=Math.round(l),t=Math.round(t)),[a,i,l,t,"rgb"]}function t(r,o,e,t,n){void 0===t&&(t=255),void 0===n&&(n=!0),Array.isArray(r)&&(o=r[1],e=r[2],t=void 0!==r[3]?r[3]:255,r=r[0]),r/=255,o/=255,e/=255;var a,i,l=Math.max(r,o,e),f=Math.min(r,o,e),s=(l+f)/2;if(l===f)a=i=0;else{var u=l-f;switch(i=s>.5?u/(2-l-f):u/(l+f),l){case r:a=((o-e)/u+(o<e?6:0))/6;break;case o:a=((e-r)/u+2)/6;break;case e:a=((r-o)/u+4)/6}}return a*=360,i*=100,s*=100,n&&(a=Math.round(a),i=Math.round(i),s=Math.round(s),t=Math.round(t)),[a,i,s,t,"hsl"]}function n(r,o){void 0===o&&(o=255);var t=[0,0,0,o,"rgb"];if(Array.isArray(r)){for(var n=[0,0,0,255,"rgb"],a=0;a<r.length&&a<n.length;a++)n[a]=r[a];return n}if("#"===(r=String(r).replace(/\s/g,""))[0]){var i=r.slice(1);if(3===i.length||4===i.length)for(var l=0;l<i.length;l++)t[l]=parseInt(i[l]+i[l],16);else if(6===i.length||8===i.length)for(var f=0;f<i.length;f+=2)t[f/2]=parseInt(i.substring(f,f+2),16)}else{var s=r.match(/^(rgb|hsl)a?\(([^)]+)\)$/i);if(s){var u=s[1].toLowerCase(),c=s[2].split(",").map(function(r){return parseFloat(r)});if("rgb"===u)t[0]=c[0]||0,t[1]=c[1]||0,t[2]=c[2]||0,t[3]=void 0!==c[3]?255*c[3]:o,t[4]="rgb";else if("hsl"===u){return e(c[0]||0,c[1]||0,c[2]||0,void 0!==c[3]?255*c[3]:o)}}}return t}function a(r,e,t,a,i){var l=Array.isArray(a)?a:["#000","#fff"];if(1===(l=0===l.length?["#000","#fff"]:l).length)return l[0];var f,s,u,c=o(r,e,t,0,(l=l.map(function(r){return n(r)})).length-1,{clip:!0,expScale:i}),h=(f=Math.floor(c),s=0,u=l.length-2,Math.max(s,Math.min(u,f))),d=c-h,g=function(r){return o(d,0,1,l[h][r],l[h+1][r],{clip:!0})};return[g(0),g(1),g(2),g(3),"rgb"]}var i={colorParse:n,colorRgbToHsl:t,colorHslToRgb:e,colorInterp:a};function l(r){r&&(r.colorParse=n,r.colorRgbToHsl=t,r.colorHslToRgb=e,r.colorInterp=a)}"undefined"!=typeof window&&window.bw&&l(window.bw),r.colorHslToRgb=e,r.colorInterp=a,r.colorParse=n,r.colorRgbToHsl=t,r.default=i,r.install=l,r.utilColor=i,Object.defineProperty(r,"__esModule",{value:!0})});
3
+ //# sourceMappingURL=bitwrench-util-color.umd.min.js.map
@@ -1,4 +1,4 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -225,6 +225,7 @@ function install(bw) {
225
225
  }
226
226
 
227
227
  // Auto-install if bw is on window (script tag usage)
228
+ /* c8 ignore next 3 -- module-level auto-install; only runs at import time in browser */
228
229
  if (typeof window !== 'undefined' && window.bw) {
229
230
  install(window.bw);
230
231
  }
@@ -1,22 +1,3 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
- "use strict";
3
- /**
4
- * bitwrench-util-css.js - Rule-based CSS utility parser plugin
5
- *
6
- * Replaces the old static `bw.u` dictionary with a parser that generates
7
- * style objects, CSS strings, or class names from shorthand tokens.
8
- *
9
- * Three output methods:
10
- * bw.u('flex gap4 p4') → { display: 'flex', gap: '1rem', padding: '1rem' }
11
- * bw.u.css('flex gap4 p4') → "display:flex;gap:1rem;padding:1rem"
12
- * bw.u.cls('flex gap4 p4') → "bw_flex bw_gap_4 bw_p_4"
13
- * bw.u.extend({ name: fn }) → register custom rules
14
- *
15
- * Can be loaded standalone (browser script tag after bitwrench.umd.js),
16
- * or imported as an ES module / CJS module.
17
- *
18
- * @module bitwrench-util-css
19
- * @license BSD-2-Clause
20
- */
21
- function t(t){return.25*t+"rem"}Object.defineProperty(exports,"__esModule",{value:!0});var n={p:function(n){return{padding:t(n)}},pt:function(n){return{paddingTop:t(n)}},pb:function(n){return{paddingBottom:t(n)}},pl:function(n){return{paddingLeft:t(n)}},pr:function(n){return{paddingRight:t(n)}},px:function(n){return{paddingLeft:t(n),paddingRight:t(n)}},py:function(n){return{paddingTop:t(n),paddingBottom:t(n)}},m:function(n){return{margin:t(n)}},mt:function(n){return{marginTop:t(n)}},mb:function(n){return{marginBottom:t(n)}},ml:function(n){return{marginLeft:t(n)}},mr:function(n){return{marginRight:t(n)}},mx:function(n){return{marginLeft:t(n),marginRight:t(n)}},my:function(n){return{marginTop:t(n),marginBottom:t(n)}},gap:function(n){return{gap:t(n)}},w:function(n){return{width:t(n)}},h:function(n){return{height:t(n)}},rounded:function(n){return{borderRadius:t(n)}},textSm:function(){return{fontSize:"0.875rem"}},textBase:function(){return{fontSize:"1rem"}},textLg:function(){return{fontSize:"1.125rem"}},textXl:function(){return{fontSize:"1.25rem"}},text2xl:function(){return{fontSize:"1.5rem"}},text3xl:function(){return{fontSize:"1.875rem"}}},e={flex:{display:"flex"},flexCol:{display:"flex",flexDirection:"column"},flexRow:{display:"flex",flexDirection:"row"},flexWrap:{display:"flex",flexWrap:"wrap"},block:{display:"block"},inline:{display:"inline"},hidden:{display:"none"},bold:{fontWeight:"700"},semibold:{fontWeight:"600"},italic:{fontStyle:"italic"},textCenter:{textAlign:"center"},textRight:{textAlign:"right"},justifyCenter:{justifyContent:"center"},justifyBetween:{justifyContent:"space-between"},justifyEnd:{justifyContent:"flex-end"},alignCenter:{alignItems:"center"},alignStart:{alignItems:"flex-start"},alignEnd:{alignItems:"flex-end"},wFull:{width:"100%"},hFull:{height:"100%"},transition:{transition:"all 0.2s ease"}},r={},i=/\s+/,o=/^([a-zA-Z]+?)(\d+)$/,u=/^bg-\[([^\]]+)\]$/,f=/^text-\[([^\]]+)\]$/,a=/^bg-(.+)$/,l=/^text-(.+)$/;function c(t){if(r[t]){var i=r[t];return"function"==typeof i?i(t):i}if(e[t])return e[t];var c=o.exec(t);if(c){var g=c[1],d=parseInt(c[2],10);if(n[g])return n[g](d)}if(n[t])return n[t]();var p=u.exec(t);if(p)return{background:p[1]};var s=f.exec(t);if(s)return{color:s[1]};var x=a.exec(t);if(x)return{background:x[1]};var m=l.exec(t);return m?{color:m[1]}:null}function g(t){if(!t||"string"!=typeof t)return{};for(var n=t.trim().split(i),e={},r=0;r<n.length;r++){var o=c(n[r]);if(o)for(var u=Object.keys(o),f=0;f<u.length;f++)e[u[f]]=o[u[f]]}return e}function d(t){t&&(t.utilCSS=g,t.u=g)}g.css=function(t){for(var n=g(t),e=[],r=Object.keys(n),i=0;i<r.length;i++){var o=r[i].replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});e.push(o+":"+n[r[i]])}return e.join(";")},g.cls=function(t){if(!t||"string"!=typeof t)return"";for(var n=t.trim().split(i),e=[],r=0;r<n.length;r++){var o=n[r];if(c(o)){var u="bw_"+o.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}).replace(/(\d+)/g,function(t){return"_"+t});e.push(u)}}return e.join(" ")},g.extend=function(t){if(t&&"object"==typeof t)for(var n=Object.keys(t),e=0;e<n.length;e++)r[n[e]]=t[n[e]]},"undefined"!=typeof window&&window.bw&&d(window.bw);var p={utilCSS:g,install:d};exports.default=p,exports.install=d,exports.utilCSS=g;
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ "use strict";function t(t){return.25*t+"rem"}Object.defineProperty(exports,"__esModule",{value:!0});var n={p:function(n){return{padding:t(n)}},pt:function(n){return{paddingTop:t(n)}},pb:function(n){return{paddingBottom:t(n)}},pl:function(n){return{paddingLeft:t(n)}},pr:function(n){return{paddingRight:t(n)}},px:function(n){return{paddingLeft:t(n),paddingRight:t(n)}},py:function(n){return{paddingTop:t(n),paddingBottom:t(n)}},m:function(n){return{margin:t(n)}},mt:function(n){return{marginTop:t(n)}},mb:function(n){return{marginBottom:t(n)}},ml:function(n){return{marginLeft:t(n)}},mr:function(n){return{marginRight:t(n)}},mx:function(n){return{marginLeft:t(n),marginRight:t(n)}},my:function(n){return{marginTop:t(n),marginBottom:t(n)}},gap:function(n){return{gap:t(n)}},w:function(n){return{width:t(n)}},h:function(n){return{height:t(n)}},rounded:function(n){return{borderRadius:t(n)}},textSm:function(){return{fontSize:"0.875rem"}},textBase:function(){return{fontSize:"1rem"}},textLg:function(){return{fontSize:"1.125rem"}},textXl:function(){return{fontSize:"1.25rem"}},text2xl:function(){return{fontSize:"1.5rem"}},text3xl:function(){return{fontSize:"1.875rem"}}},e={flex:{display:"flex"},flexCol:{display:"flex",flexDirection:"column"},flexRow:{display:"flex",flexDirection:"row"},flexWrap:{display:"flex",flexWrap:"wrap"},block:{display:"block"},inline:{display:"inline"},hidden:{display:"none"},bold:{fontWeight:"700"},semibold:{fontWeight:"600"},italic:{fontStyle:"italic"},textCenter:{textAlign:"center"},textRight:{textAlign:"right"},justifyCenter:{justifyContent:"center"},justifyBetween:{justifyContent:"space-between"},justifyEnd:{justifyContent:"flex-end"},alignCenter:{alignItems:"center"},alignStart:{alignItems:"flex-start"},alignEnd:{alignItems:"flex-end"},wFull:{width:"100%"},hFull:{height:"100%"},transition:{transition:"all 0.2s ease"}},r={},i=/\s+/,o=/^([a-zA-Z]+?)(\d+)$/,u=/^bg-\[([^\]]+)\]$/,f=/^text-\[([^\]]+)\]$/,a=/^bg-(.+)$/,l=/^text-(.+)$/;function c(t){if(r[t]){var i=r[t];return"function"==typeof i?i(t):i}if(e[t])return e[t];var c=o.exec(t);if(c){var g=c[1],d=parseInt(c[2],10);if(n[g])return n[g](d)}if(n[t])return n[t]();var p=u.exec(t);if(p)return{background:p[1]};var s=f.exec(t);if(s)return{color:s[1]};var x=a.exec(t);if(x)return{background:x[1]};var m=l.exec(t);return m?{color:m[1]}:null}function g(t){if(!t||"string"!=typeof t)return{};for(var n=t.trim().split(i),e={},r=0;r<n.length;r++){var o=c(n[r]);if(o)for(var u=Object.keys(o),f=0;f<u.length;f++)e[u[f]]=o[u[f]]}return e}function d(t){t&&(t.utilCSS=g,t.u=g)}g.css=function(t){for(var n=g(t),e=[],r=Object.keys(n),i=0;i<r.length;i++){var o=r[i].replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});e.push(o+":"+n[r[i]])}return e.join(";")},g.cls=function(t){if(!t||"string"!=typeof t)return"";for(var n=t.trim().split(i),e=[],r=0;r<n.length;r++){var o=n[r];if(c(o)){var u="bw_"+o.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}).replace(/(\d+)/g,function(t){return"_"+t});e.push(u)}}return e.join(" ")},g.extend=function(t){if(t&&"object"==typeof t)for(var n=Object.keys(t),e=0;e<n.length;e++)r[n[e]]=t[n[e]]},"undefined"!=typeof window&&window.bw&&d(window.bw);var p={utilCSS:g,install:d};exports.default=p,exports.install=d,exports.utilCSS=g;
22
3
  //# sourceMappingURL=bitwrench-util-css.cjs.min.js.map
@@ -1,4 +1,4 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -396,6 +396,7 @@
396
396
  }
397
397
 
398
398
  // Auto-install if bw is on window (script tag usage)
399
+ /* c8 ignore next 3 -- module-level auto-install; only runs at import time in browser */
399
400
  if (typeof window !== 'undefined' && window.bw) {
400
401
  install(window.bw);
401
402
  }
@@ -1,21 +1,3 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).bwUtilCSS={})}(this,function(t){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}
3
- /**
4
- * bitwrench-util-css.js - Rule-based CSS utility parser plugin
5
- *
6
- * Replaces the old static `bw.u` dictionary with a parser that generates
7
- * style objects, CSS strings, or class names from shorthand tokens.
8
- *
9
- * Three output methods:
10
- * bw.u('flex gap4 p4') → { display: 'flex', gap: '1rem', padding: '1rem' }
11
- * bw.u.css('flex gap4 p4') → "display:flex;gap:1rem;padding:1rem"
12
- * bw.u.cls('flex gap4 p4') → "bw_flex bw_gap_4 bw_p_4"
13
- * bw.u.extend({ name: fn }) → register custom rules
14
- *
15
- * Can be loaded standalone (browser script tag after bitwrench.umd.js),
16
- * or imported as an ES module / CJS module.
17
- *
18
- * @module bitwrench-util-css
19
- * @license BSD-2-Clause
20
- */function e(t){return.25*t+"rem"}var r={p:function(t){return{padding:e(t)}},pt:function(t){return{paddingTop:e(t)}},pb:function(t){return{paddingBottom:e(t)}},pl:function(t){return{paddingLeft:e(t)}},pr:function(t){return{paddingRight:e(t)}},px:function(t){return{paddingLeft:e(t),paddingRight:e(t)}},py:function(t){return{paddingTop:e(t),paddingBottom:e(t)}},m:function(t){return{margin:e(t)}},mt:function(t){return{marginTop:e(t)}},mb:function(t){return{marginBottom:e(t)}},ml:function(t){return{marginLeft:e(t)}},mr:function(t){return{marginRight:e(t)}},mx:function(t){return{marginLeft:e(t),marginRight:e(t)}},my:function(t){return{marginTop:e(t),marginBottom:e(t)}},gap:function(t){return{gap:e(t)}},w:function(t){return{width:e(t)}},h:function(t){return{height:e(t)}},rounded:function(t){return{borderRadius:e(t)}},textSm:function(){return{fontSize:"0.875rem"}},textBase:function(){return{fontSize:"1rem"}},textLg:function(){return{fontSize:"1.125rem"}},textXl:function(){return{fontSize:"1.25rem"}},text2xl:function(){return{fontSize:"1.5rem"}},text3xl:function(){return{fontSize:"1.875rem"}}},i={flex:{display:"flex"},flexCol:{display:"flex",flexDirection:"column"},flexRow:{display:"flex",flexDirection:"row"},flexWrap:{display:"flex",flexWrap:"wrap"},block:{display:"block"},inline:{display:"inline"},hidden:{display:"none"},bold:{fontWeight:"700"},semibold:{fontWeight:"600"},italic:{fontStyle:"italic"},textCenter:{textAlign:"center"},textRight:{textAlign:"right"},justifyCenter:{justifyContent:"center"},justifyBetween:{justifyContent:"space-between"},justifyEnd:{justifyContent:"flex-end"},alignCenter:{alignItems:"center"},alignStart:{alignItems:"flex-start"},alignEnd:{alignItems:"flex-end"},wFull:{width:"100%"},hFull:{height:"100%"},transition:{transition:"all 0.2s ease"}},o={},f=/\s+/,u=/^([a-zA-Z]+?)(\d+)$/,l=/^bg-\[([^\]]+)\]$/,a=/^text-\[([^\]]+)\]$/,c=/^bg-(.+)$/,d=/^text-(.+)$/;function p(t){if(o[t]){var n=o[t];return"function"==typeof n?n(t):n}if(i[t])return i[t];var e=u.exec(t);if(e){var f=e[1],p=parseInt(e[2],10);if(r[f])return r[f](p)}if(r[t])return r[t]();var s=l.exec(t);if(s)return{background:s[1]};var g=a.exec(t);if(g)return{color:g[1]};var m=c.exec(t);if(m)return{background:m[1]};var y=d.exec(t);return y?{color:y[1]}:null}function s(t){if(!t||"string"!=typeof t)return{};for(var n=t.trim().split(f),e={},r=0;r<n.length;r++){var i=p(n[r]);if(i)for(var o=Object.keys(i),u=0;u<o.length;u++)e[o[u]]=i[o[u]]}return e}function g(t){t&&(t.utilCSS=s,t.u=s)}s.css=function(t){for(var n=s(t),e=[],r=Object.keys(n),i=0;i<r.length;i++){var o=r[i].replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});e.push(o+":"+n[r[i]])}return e.join(";")},s.cls=function(t){if(!t||"string"!=typeof t)return"";for(var n=t.trim().split(f),e=[],r=0;r<n.length;r++){var i=n[r];if(p(i)){var o="bw_"+i.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}).replace(/(\d+)/g,function(t){return"_"+t});e.push(o)}}return e.join(" ")},s.extend=function(t){if(t&&"object"===n(t))for(var e=Object.keys(t),r=0;r<e.length;r++)o[e[r]]=t[e[r]]},"undefined"!=typeof window&&window.bw&&g(window.bw);var m={utilCSS:s,install:g};t.default=m,t.install=g,t.utilCSS=s,Object.defineProperty(t,"__esModule",{value:!0})});
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).bwUtilCSS={})}(this,function(t){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function e(t){return.25*t+"rem"}var r={p:function(t){return{padding:e(t)}},pt:function(t){return{paddingTop:e(t)}},pb:function(t){return{paddingBottom:e(t)}},pl:function(t){return{paddingLeft:e(t)}},pr:function(t){return{paddingRight:e(t)}},px:function(t){return{paddingLeft:e(t),paddingRight:e(t)}},py:function(t){return{paddingTop:e(t),paddingBottom:e(t)}},m:function(t){return{margin:e(t)}},mt:function(t){return{marginTop:e(t)}},mb:function(t){return{marginBottom:e(t)}},ml:function(t){return{marginLeft:e(t)}},mr:function(t){return{marginRight:e(t)}},mx:function(t){return{marginLeft:e(t),marginRight:e(t)}},my:function(t){return{marginTop:e(t),marginBottom:e(t)}},gap:function(t){return{gap:e(t)}},w:function(t){return{width:e(t)}},h:function(t){return{height:e(t)}},rounded:function(t){return{borderRadius:e(t)}},textSm:function(){return{fontSize:"0.875rem"}},textBase:function(){return{fontSize:"1rem"}},textLg:function(){return{fontSize:"1.125rem"}},textXl:function(){return{fontSize:"1.25rem"}},text2xl:function(){return{fontSize:"1.5rem"}},text3xl:function(){return{fontSize:"1.875rem"}}},i={flex:{display:"flex"},flexCol:{display:"flex",flexDirection:"column"},flexRow:{display:"flex",flexDirection:"row"},flexWrap:{display:"flex",flexWrap:"wrap"},block:{display:"block"},inline:{display:"inline"},hidden:{display:"none"},bold:{fontWeight:"700"},semibold:{fontWeight:"600"},italic:{fontStyle:"italic"},textCenter:{textAlign:"center"},textRight:{textAlign:"right"},justifyCenter:{justifyContent:"center"},justifyBetween:{justifyContent:"space-between"},justifyEnd:{justifyContent:"flex-end"},alignCenter:{alignItems:"center"},alignStart:{alignItems:"flex-start"},alignEnd:{alignItems:"flex-end"},wFull:{width:"100%"},hFull:{height:"100%"},transition:{transition:"all 0.2s ease"}},o={},f=/\s+/,u=/^([a-zA-Z]+?)(\d+)$/,l=/^bg-\[([^\]]+)\]$/,a=/^text-\[([^\]]+)\]$/,c=/^bg-(.+)$/,d=/^text-(.+)$/;function p(t){if(o[t]){var n=o[t];return"function"==typeof n?n(t):n}if(i[t])return i[t];var e=u.exec(t);if(e){var f=e[1],p=parseInt(e[2],10);if(r[f])return r[f](p)}if(r[t])return r[t]();var s=l.exec(t);if(s)return{background:s[1]};var g=a.exec(t);if(g)return{color:g[1]};var m=c.exec(t);if(m)return{background:m[1]};var y=d.exec(t);return y?{color:y[1]}:null}function s(t){if(!t||"string"!=typeof t)return{};for(var n=t.trim().split(f),e={},r=0;r<n.length;r++){var i=p(n[r]);if(i)for(var o=Object.keys(i),u=0;u<o.length;u++)e[o[u]]=i[o[u]]}return e}function g(t){t&&(t.utilCSS=s,t.u=s)}s.css=function(t){for(var n=s(t),e=[],r=Object.keys(n),i=0;i<r.length;i++){var o=r[i].replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});e.push(o+":"+n[r[i]])}return e.join(";")},s.cls=function(t){if(!t||"string"!=typeof t)return"";for(var n=t.trim().split(f),e=[],r=0;r<n.length;r++){var i=n[r];if(p(i)){var o="bw_"+i.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}).replace(/(\d+)/g,function(t){return"_"+t});e.push(o)}}return e.join(" ")},s.extend=function(t){if(t&&"object"===n(t))for(var e=Object.keys(t),r=0;r<e.length;r++)o[e[r]]=t[e[r]]},"undefined"!=typeof window&&window.bw&&g(window.bw);var m={utilCSS:s,install:g};t.default=m,t.install=g,t.utilCSS=s,Object.defineProperty(t,"__esModule",{value:!0})});
21
3
  //# sourceMappingURL=bitwrench-util-css.es5.min.js.map
@@ -1,4 +1,4 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
2
2
  /**
3
3
  * bitwrench-util-css.js - Rule-based CSS utility parser plugin
4
4
  *
@@ -221,6 +221,7 @@ function install(bw) {
221
221
  }
222
222
 
223
223
  // Auto-install if bw is on window (script tag usage)
224
+ /* c8 ignore next 3 -- module-level auto-install; only runs at import time in browser */
224
225
  if (typeof window !== 'undefined' && window.bw) {
225
226
  install(window.bw);
226
227
  }
@@ -1,21 +1,3 @@
1
- /*! bitwrench-util-css v2.0.31 | BSD-2-Clause | https://deftio.github.com/bitwrench/pages */
2
- /**
3
- * bitwrench-util-css.js - Rule-based CSS utility parser plugin
4
- *
5
- * Replaces the old static `bw.u` dictionary with a parser that generates
6
- * style objects, CSS strings, or class names from shorthand tokens.
7
- *
8
- * Three output methods:
9
- * bw.u('flex gap4 p4') → { display: 'flex', gap: '1rem', padding: '1rem' }
10
- * bw.u.css('flex gap4 p4') → "display:flex;gap:1rem;padding:1rem"
11
- * bw.u.cls('flex gap4 p4') → "bw_flex bw_gap_4 bw_p_4"
12
- * bw.u.extend({ name: fn }) → register custom rules
13
- *
14
- * Can be loaded standalone (browser script tag after bitwrench.umd.js),
15
- * or imported as an ES module / CJS module.
16
- *
17
- * @module bitwrench-util-css
18
- * @license BSD-2-Clause
19
- */
1
+ /*! bitwrench-util-css v2.1.0 | BSD-2-Clause | https://deftio.github.io/bitwrench/pages */
20
2
  function t(t){return.25*t+"rem"}var n={p:function(n){return{padding:t(n)}},pt:function(n){return{paddingTop:t(n)}},pb:function(n){return{paddingBottom:t(n)}},pl:function(n){return{paddingLeft:t(n)}},pr:function(n){return{paddingRight:t(n)}},px:function(n){return{paddingLeft:t(n),paddingRight:t(n)}},py:function(n){return{paddingTop:t(n),paddingBottom:t(n)}},m:function(n){return{margin:t(n)}},mt:function(n){return{marginTop:t(n)}},mb:function(n){return{marginBottom:t(n)}},ml:function(n){return{marginLeft:t(n)}},mr:function(n){return{marginRight:t(n)}},mx:function(n){return{marginLeft:t(n),marginRight:t(n)}},my:function(n){return{marginTop:t(n),marginBottom:t(n)}},gap:function(n){return{gap:t(n)}},w:function(n){return{width:t(n)}},h:function(n){return{height:t(n)}},rounded:function(n){return{borderRadius:t(n)}},textSm:function(){return{fontSize:"0.875rem"}},textBase:function(){return{fontSize:"1rem"}},textLg:function(){return{fontSize:"1.125rem"}},textXl:function(){return{fontSize:"1.25rem"}},text2xl:function(){return{fontSize:"1.5rem"}},text3xl:function(){return{fontSize:"1.875rem"}}},e={flex:{display:"flex"},flexCol:{display:"flex",flexDirection:"column"},flexRow:{display:"flex",flexDirection:"row"},flexWrap:{display:"flex",flexWrap:"wrap"},block:{display:"block"},inline:{display:"inline"},hidden:{display:"none"},bold:{fontWeight:"700"},semibold:{fontWeight:"600"},italic:{fontStyle:"italic"},textCenter:{textAlign:"center"},textRight:{textAlign:"right"},justifyCenter:{justifyContent:"center"},justifyBetween:{justifyContent:"space-between"},justifyEnd:{justifyContent:"flex-end"},alignCenter:{alignItems:"center"},alignStart:{alignItems:"flex-start"},alignEnd:{alignItems:"flex-end"},wFull:{width:"100%"},hFull:{height:"100%"},transition:{transition:"all 0.2s ease"}},r={},i=/\s+/,o=/^([a-zA-Z]+?)(\d+)$/,u=/^bg-\[([^\]]+)\]$/,f=/^text-\[([^\]]+)\]$/,a=/^bg-(.+)$/,l=/^text-(.+)$/;function c(t){if(r[t]){var i=r[t];return"function"==typeof i?i(t):i}if(e[t])return e[t];var c=o.exec(t);if(c){var g=c[1],d=parseInt(c[2],10);if(n[g])return n[g](d)}if(n[t])return n[t]();var p=u.exec(t);if(p)return{background:p[1]};var s=f.exec(t);if(s)return{color:s[1]};var x=a.exec(t);if(x)return{background:x[1]};var m=l.exec(t);return m?{color:m[1]}:null}function g(t){if(!t||"string"!=typeof t)return{};for(var n=t.trim().split(i),e={},r=0;r<n.length;r++){var o=c(n[r]);if(o)for(var u=Object.keys(o),f=0;f<u.length;f++)e[u[f]]=o[u[f]]}return e}function d(t){t&&(t.utilCSS=g,t.u=g)}g.css=function(t){for(var n=g(t),e=[],r=Object.keys(n),i=0;i<r.length;i++){var o=r[i].replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});e.push(o+":"+n[r[i]])}return e.join(";")},g.cls=function(t){if(!t||"string"!=typeof t)return"";for(var n=t.trim().split(i),e=[],r=0;r<n.length;r++){var o=n[r];if(c(o)){var u="bw_"+o.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}).replace(/(\d+)/g,function(t){return"_"+t});e.push(u)}}return e.join(" ")},g.extend=function(t){if(t&&"object"==typeof t)for(var n=Object.keys(t),e=0;e<n.length;e++)r[n[e]]=t[n[e]]},"undefined"!=typeof window&&window.bw&&d(window.bw);var p={utilCSS:g,install:d};export{p as default,d as install,g as utilCSS};
21
3
  //# sourceMappingURL=bitwrench-util-css.esm.min.js.map