agentgui 1.0.971 → 1.0.972

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.
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env node
2
- // One-time build: produces static/vendor/rippleui.css from the rippleui npm package.
3
- // Buildless at runtime - commit the output so `npm install` is enough to serve.
4
- //
5
- // Source files (from node_modules/rippleui/dist/css/):
6
- // base.css - Tailwind preflight/reset (~2KB)
7
- // components.css - RippleUI components (.btn etc.) (~143KB)
8
- // utilities.css - RippleUI extra utilities (~0.05KB)
9
- // styles.css - full TW + RippleUI monolith (~4.7MB) - we only mine token defs
10
- //
11
- // Output: static/vendor/rippleui.css containing
12
- // 1. :root / html.dark token blocks extracted from styles.css (so components.css works)
13
- // 2. base.css
14
- // 3. components.css
15
- // 4. utilities.css
16
-
17
- import fs from 'fs';
18
- import path from 'path';
19
- import { fileURLToPath } from 'url';
20
-
21
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
22
- const ROOT = path.resolve(__dirname, '..');
23
- const RUI = path.join(ROOT, 'node_modules/rippleui/dist/css');
24
- const OUT = path.join(ROOT, 'static/vendor/rippleui.css');
25
-
26
- if (!fs.existsSync(RUI)) {
27
- console.error('rippleui not installed. Run: bun add --dev rippleui');
28
- process.exit(1);
29
- }
30
-
31
- const base = fs.readFileSync(path.join(RUI, 'base.css'), 'utf8');
32
- const components = fs.readFileSync(path.join(RUI, 'components.css'), 'utf8');
33
- const utilities = fs.readFileSync(path.join(RUI, 'utilities.css'), 'utf8');
34
- const styles = fs.readFileSync(path.join(RUI, 'styles.css'), 'utf8');
35
-
36
- // Extract token blocks. RippleUI defines its design tokens in :root { ... } and html.dark { ... }
37
- // Find every block that contains a RippleUI-signature token like --backgroundPrimary or --gray-3.
38
- const tokenBlocks = [];
39
- const blockRe = /([:a-z.][^{}]*\{[^{}]*\})/gi;
40
- let m;
41
- while ((m = blockRe.exec(styles))) {
42
- const block = m[1];
43
- if (/--backgroundPrimary|--gray-\d|--content1|--primary:\s*\d/.test(block)) {
44
- tokenBlocks.push(block);
45
- if (tokenBlocks.length > 20) break;
46
- }
47
- }
48
-
49
- if (tokenBlocks.length === 0) {
50
- console.error('Could not find token blocks in styles.css - rippleui shape changed?');
51
- process.exit(1);
52
- }
53
-
54
- const header = `/* RippleUI v${readPkgVersion()} - localized for AgentGUI.\n` +
55
- ` * Generated by scripts/build-rippleui.mjs - do not edit by hand.\n` +
56
- ` * Regenerate: bun run scripts/build-rippleui.mjs\n` +
57
- ` */\n`;
58
-
59
- // RippleUI targets [data-theme=dark] for dark mode; AgentGUI uses `html.dark`.
60
- // Duplicate every `[data-theme=dark]` selector with `html.dark` so both work.
61
- function mirrorDarkSelector(css) {
62
- return css.replace(/\[data-theme=dark\]/g, 'html.dark, [data-theme=dark]');
63
- }
64
-
65
- const bundled = header +
66
- '/* --- rippleui design tokens (extracted from styles.css) --- */\n' +
67
- mirrorDarkSelector(tokenBlocks.join('\n')) + '\n\n' +
68
- '/* --- base.css (tailwind preflight) --- */\n' +
69
- base + '\n\n' +
70
- '/* --- components.css --- */\n' +
71
- mirrorDarkSelector(components) + '\n\n' +
72
- '/* --- utilities.css --- */\n' +
73
- mirrorDarkSelector(utilities) + '\n';
74
-
75
- fs.mkdirSync(path.dirname(OUT), { recursive: true });
76
- fs.writeFileSync(OUT, bundled);
77
- const kb = (bundled.length / 1024).toFixed(1);
78
- console.log(`wrote ${OUT} (${kb}KB, ${tokenBlocks.length} token blocks)`);
79
-
80
- function readPkgVersion() {
81
- try {
82
- return JSON.parse(fs.readFileSync(path.join(ROOT, 'node_modules/rippleui/package.json'), 'utf8')).version;
83
- } catch { return 'unknown'; }
84
- }
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from 'fs';
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- const root = path.join(__dirname, '..');
8
-
9
- const copies = [
10
- ['node_modules/xstate/dist/xstate.umd.min.js', 'static/lib/xstate.umd.min.js'],
11
- ];
12
-
13
- for (const [src, dest] of copies) {
14
- const srcPath = path.join(root, src);
15
- const destPath = path.join(root, dest);
16
- if (!fs.existsSync(srcPath)) { console.warn('[copy-vendor] not found:', src); continue; }
17
- fs.mkdirSync(path.dirname(destPath), { recursive: true });
18
- fs.copyFileSync(srcPath, destPath);
19
- console.log('[copy-vendor] copied', src, '->', dest);
20
- }
21
-
22
- // Build webjsx IIFE bundle from ESM dist files
23
- const webjsxDist = path.join(root, 'node_modules/webjsx/dist');
24
- if (fs.existsSync(webjsxDist)) {
25
- const ORDER = ['constants', 'elementTags', 'utils', 'renderSuspension', 'attributes', 'createDOMElement', 'createElement', 'applyDiff', 'types'];
26
-
27
- function stripModule(src) {
28
- return src
29
- .replace(/^import\s+.*?from\s+['"][^'"]+['"];?\s*$/gm, '')
30
- .replace(/^export\s+(const|function|class|async\s+function)\s+/gm, '$1 ')
31
- .replace(/^export\s+\{[^}]*\}(\s+from\s+['"][^'"]+['"])?\s*;?\s*$/gm, '')
32
- .replace(/^export\s+\*\s+from\s+['"][^'"]+['"];?\s*$/gm, '')
33
- .replace(/^\/\/#\s+sourceMappingURL=.*$/gm, '')
34
- .trim();
35
- }
36
-
37
- const stripped = ORDER.map(name => {
38
- const src = fs.readFileSync(path.join(webjsxDist, `${name}.js`), 'utf8');
39
- return `// === ${name}.js ===\n${stripModule(src)}`;
40
- });
41
-
42
- const iife = `(function(window) {\n"use strict";\n\n${stripped.join('\n\n')}\n\nwindow.webjsx = { createElement, applyDiff, createDOMElement, Fragment };\n})(typeof window !== 'undefined' ? window : globalThis);\n`;
43
-
44
- const dest = path.join(root, 'static/lib/webjsx.js');
45
- fs.mkdirSync(path.dirname(dest), { recursive: true });
46
- fs.writeFileSync(dest, iife);
47
- console.log('[copy-vendor] built webjsx IIFE ->', 'static/lib/webjsx.js', `(${iife.split('\n').length} lines)`);
48
- } else {
49
- console.warn('[copy-vendor] webjsx not found in node_modules - run npm install');
50
- }