bitwrench 2.0.17 → 2.0.18

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 (67) hide show
  1. package/README.md +127 -38
  2. package/dist/bitwrench-bccl.cjs.js +8 -8
  3. package/dist/bitwrench-bccl.cjs.min.js +3 -3
  4. package/dist/bitwrench-bccl.esm.js +8 -8
  5. package/dist/bitwrench-bccl.esm.min.js +3 -3
  6. package/dist/bitwrench-bccl.umd.js +8 -8
  7. package/dist/bitwrench-bccl.umd.min.js +2 -2
  8. package/dist/bitwrench-code-edit.cjs.js +1 -1
  9. package/dist/bitwrench-code-edit.cjs.min.js +1 -1
  10. package/dist/bitwrench-code-edit.es5.js +1 -1
  11. package/dist/bitwrench-code-edit.es5.min.js +1 -1
  12. package/dist/bitwrench-code-edit.esm.js +1 -1
  13. package/dist/bitwrench-code-edit.esm.min.js +1 -1
  14. package/dist/bitwrench-code-edit.umd.js +1 -1
  15. package/dist/bitwrench-code-edit.umd.min.js +1 -1
  16. package/dist/bitwrench-lean.cjs.js +941 -775
  17. package/dist/bitwrench-lean.cjs.min.js +20 -20
  18. package/dist/bitwrench-lean.es5.js +1012 -961
  19. package/dist/bitwrench-lean.es5.min.js +18 -18
  20. package/dist/bitwrench-lean.esm.js +941 -775
  21. package/dist/bitwrench-lean.esm.min.js +20 -20
  22. package/dist/bitwrench-lean.umd.js +941 -775
  23. package/dist/bitwrench-lean.umd.min.js +20 -20
  24. package/dist/bitwrench-util-css.cjs.js +236 -0
  25. package/dist/bitwrench-util-css.cjs.min.js +22 -0
  26. package/dist/bitwrench-util-css.es5.js +414 -0
  27. package/dist/bitwrench-util-css.es5.min.js +21 -0
  28. package/dist/bitwrench-util-css.esm.js +230 -0
  29. package/dist/bitwrench-util-css.esm.min.js +21 -0
  30. package/dist/bitwrench-util-css.umd.js +242 -0
  31. package/dist/bitwrench-util-css.umd.min.js +21 -0
  32. package/dist/bitwrench.cjs.js +948 -782
  33. package/dist/bitwrench.cjs.min.js +21 -21
  34. package/dist/bitwrench.css +456 -132
  35. package/dist/bitwrench.es5.js +1024 -970
  36. package/dist/bitwrench.es5.min.js +19 -19
  37. package/dist/bitwrench.esm.js +949 -783
  38. package/dist/bitwrench.esm.min.js +21 -21
  39. package/dist/bitwrench.min.css +1 -1
  40. package/dist/bitwrench.umd.js +948 -782
  41. package/dist/bitwrench.umd.min.js +21 -21
  42. package/dist/builds.json +178 -90
  43. package/dist/bwserve.cjs.js +514 -68
  44. package/dist/bwserve.esm.js +513 -69
  45. package/dist/sri.json +44 -36
  46. package/package.json +3 -2
  47. package/readme.html +136 -49
  48. package/src/bitwrench-bccl.js +7 -7
  49. package/src/bitwrench-color-utils.js +31 -9
  50. package/src/bitwrench-esm-entry.js +11 -0
  51. package/src/bitwrench-styles.js +439 -232
  52. package/src/bitwrench-util-css.js +229 -0
  53. package/src/bitwrench.js +483 -485
  54. package/src/bwserve/attach.js +57 -0
  55. package/src/bwserve/bwclient.js +141 -0
  56. package/src/bwserve/bwshell.js +102 -0
  57. package/src/bwserve/client.js +151 -1
  58. package/src/bwserve/index.js +127 -28
  59. package/src/cli/attach.js +555 -0
  60. package/src/cli/convert.js +2 -5
  61. package/src/cli/index.js +7 -0
  62. package/src/cli/inject.js +1 -1
  63. package/src/cli/serve.js +6 -2
  64. package/src/generate-css.js +11 -4
  65. package/src/vendor/html2canvas.min.js +20 -0
  66. package/src/version.js +3 -3
  67. 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
- }