bitwrench 2.0.17 → 2.0.19

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 (72) hide show
  1. package/README.md +169 -75
  2. package/dist/bitwrench-bccl.cjs.js +228 -55
  3. package/dist/bitwrench-bccl.cjs.min.js +3 -3
  4. package/dist/bitwrench-bccl.esm.js +228 -55
  5. package/dist/bitwrench-bccl.esm.min.js +3 -3
  6. package/dist/bitwrench-bccl.umd.js +228 -55
  7. package/dist/bitwrench-bccl.umd.min.js +3 -3
  8. package/dist/bitwrench-code-edit.cjs.js +7 -9
  9. package/dist/bitwrench-code-edit.cjs.min.js +5 -7
  10. package/dist/bitwrench-code-edit.es5.js +6 -8
  11. package/dist/bitwrench-code-edit.es5.min.js +5 -7
  12. package/dist/bitwrench-code-edit.esm.js +7 -9
  13. package/dist/bitwrench-code-edit.esm.min.js +5 -7
  14. package/dist/bitwrench-code-edit.umd.js +7 -9
  15. package/dist/bitwrench-code-edit.umd.min.js +5 -7
  16. package/dist/bitwrench-debug.js +268 -0
  17. package/dist/bitwrench-debug.min.js +3 -0
  18. package/dist/bitwrench-lean.cjs.js +1190 -2348
  19. package/dist/bitwrench-lean.cjs.min.js +20 -20
  20. package/dist/bitwrench-lean.es5.js +1285 -2551
  21. package/dist/bitwrench-lean.es5.min.js +18 -18
  22. package/dist/bitwrench-lean.esm.js +1190 -2348
  23. package/dist/bitwrench-lean.esm.min.js +20 -20
  24. package/dist/bitwrench-lean.umd.js +1190 -2348
  25. package/dist/bitwrench-lean.umd.min.js +20 -20
  26. package/dist/bitwrench-util-css.cjs.js +236 -0
  27. package/dist/bitwrench-util-css.cjs.min.js +22 -0
  28. package/dist/bitwrench-util-css.es5.js +414 -0
  29. package/dist/bitwrench-util-css.es5.min.js +21 -0
  30. package/dist/bitwrench-util-css.esm.js +230 -0
  31. package/dist/bitwrench-util-css.esm.min.js +21 -0
  32. package/dist/bitwrench-util-css.umd.js +242 -0
  33. package/dist/bitwrench-util-css.umd.min.js +21 -0
  34. package/dist/bitwrench.cjs.js +1404 -2388
  35. package/dist/bitwrench.cjs.min.js +21 -21
  36. package/dist/bitwrench.css +503 -132
  37. package/dist/bitwrench.es5.js +1588 -2659
  38. package/dist/bitwrench.es5.min.js +19 -19
  39. package/dist/bitwrench.esm.js +1405 -2389
  40. package/dist/bitwrench.esm.min.js +21 -21
  41. package/dist/bitwrench.min.css +1 -1
  42. package/dist/bitwrench.umd.js +1404 -2388
  43. package/dist/bitwrench.umd.min.js +21 -21
  44. package/dist/builds.json +214 -104
  45. package/dist/bwserve.cjs.js +514 -68
  46. package/dist/bwserve.esm.js +513 -69
  47. package/dist/sri.json +46 -36
  48. package/package.json +6 -3
  49. package/readme.html +183 -85
  50. package/src/bitwrench-bccl-entry.js +3 -4
  51. package/src/bitwrench-bccl.js +224 -50
  52. package/src/bitwrench-code-edit.js +6 -8
  53. package/src/bitwrench-color-utils.js +31 -9
  54. package/src/bitwrench-debug.js +245 -0
  55. package/src/bitwrench-esm-entry.js +11 -0
  56. package/src/bitwrench-styles.js +474 -240
  57. package/src/bitwrench-util-css.js +229 -0
  58. package/src/bitwrench.js +689 -2042
  59. package/src/bwserve/attach.js +57 -0
  60. package/src/bwserve/bwclient.js +141 -0
  61. package/src/bwserve/bwshell.js +102 -0
  62. package/src/bwserve/client.js +151 -1
  63. package/src/bwserve/index.js +127 -28
  64. package/src/cli/attach.js +587 -0
  65. package/src/cli/convert.js +2 -5
  66. package/src/cli/index.js +7 -0
  67. package/src/cli/inject.js +1 -1
  68. package/src/cli/serve.js +185 -5
  69. package/src/generate-css.js +11 -4
  70. package/src/vendor/html2canvas.min.js +20 -0
  71. package/src/version.js +3 -3
  72. package/src/bwserve/shell.js +0 -106
@@ -1,106 +0,0 @@
1
- /**
2
- * bwserve shell — generates the HTML page shell served to browsers.
3
- *
4
- * The shell is a minimal HTML doc that:
5
- * - Loads bitwrench UMD + CSS from /__bw/ routes
6
- * - Calls bw.loadDefaultStyles()
7
- * - Optionally applies a theme
8
- * - Creates a #app div
9
- * - Opens an SSE connection via bw.clientConnect()
10
- * - Delegates data-bw-action clicks to the server via POST
11
- *
12
- * @module bwserve/shell
13
- */
14
-
15
- /**
16
- * Generate the shell HTML page for a bwserve app.
17
- *
18
- * @param {Object} opts
19
- * @param {string} opts.clientId - Unique client ID for this connection
20
- * @param {string} [opts.title='bwserve'] - Page title
21
- * @param {string} [opts.theme] - Theme preset name or config
22
- * @param {boolean} [opts.injectBitwrench=true] - Whether to inject bitwrench scripts
23
- * @returns {string} Complete HTML document
24
- */
25
- export function generateShell(opts) {
26
- opts = opts || {};
27
- var clientId = opts.clientId || 'default';
28
- var title = opts.title || 'bwserve';
29
- var inject = opts.injectBitwrench !== false;
30
-
31
- var head = [
32
- '<!DOCTYPE html>',
33
- '<html lang="en">',
34
- '<head>',
35
- '<meta charset="UTF-8">',
36
- '<meta name="viewport" content="width=device-width, initial-scale=1.0">',
37
- '<title>' + title + '</title>'
38
- ];
39
-
40
- if (inject) {
41
- head.push('<script src="/__bw/bitwrench.umd.js"></script>');
42
- head.push('<link rel="stylesheet" href="/__bw/bitwrench.css">');
43
- }
44
-
45
- head.push('</head>');
46
- head.push('<body>');
47
- head.push('<div id="app"></div>');
48
-
49
- var script = [
50
- '<script>',
51
- '(function() {',
52
- ' "use strict";',
53
- ' bw.loadDefaultStyles();'
54
- ];
55
-
56
- if (opts.theme) {
57
- script.push(' bw.generateTheme("bwserve", ' + JSON.stringify(
58
- typeof opts.theme === 'string'
59
- ? { primary: '#006666', secondary: '#333333' }
60
- : opts.theme
61
- ) + ');');
62
- }
63
-
64
- script.push(' var clientId = ' + JSON.stringify(clientId) + ';');
65
- script.push(' var conn = bw.clientConnect("/__bw/events/" + clientId, {');
66
- script.push(' actionUrl: "/__bw/action/" + clientId,');
67
- if (opts.allowExec) {
68
- script.push(' allowExec: true,');
69
- }
70
- script.push(' onStatus: function(s) {');
71
- script.push(' if (typeof console !== "undefined") console.log("[bwserve] " + s);');
72
- script.push(' }');
73
- script.push(' });');
74
-
75
- // data-bw-action click delegation
76
- script.push(' document.addEventListener("click", function(e) {');
77
- script.push(' var el = e.target.closest ? e.target.closest("[data-bw-action]") : null;');
78
- script.push(' if (!el) return;');
79
- script.push(' e.preventDefault();');
80
- script.push(' var actionData = {};');
81
- script.push(' if (el.getAttribute("data-bw-id")) actionData.bwId = el.getAttribute("data-bw-id");');
82
- script.push(' var form = el.closest("div") || document;');
83
- script.push(' var inp = form.querySelector("input[type=text],input:not([type])");');
84
- script.push(' if (inp) { actionData.inputValue = inp.value; inp.value = ""; }');
85
- script.push(' conn.sendAction(el.getAttribute("data-bw-action"), actionData);');
86
- script.push(' });');
87
-
88
- // Enter key on inputs
89
- script.push(' document.addEventListener("keydown", function(e) {');
90
- script.push(' if (e.key === "Enter" && e.target.tagName === "INPUT") {');
91
- script.push(' var form = e.target.closest("div") || document;');
92
- script.push(' var btn = form.querySelector("[data-bw-action]");');
93
- script.push(' if (btn) {');
94
- script.push(' conn.sendAction(btn.getAttribute("data-bw-action"), { inputValue: e.target.value });');
95
- script.push(' e.target.value = "";');
96
- script.push(' }');
97
- script.push(' }');
98
- script.push(' });');
99
-
100
- script.push('})();');
101
- script.push('</script>');
102
- script.push('</body>');
103
- script.push('</html>');
104
-
105
- return head.concat(script).join('\n');
106
- }