treesap 0.0.2 → 0.1.1
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/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +137 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/BaseHead.d.ts +5 -0
- package/dist/components/BaseHead.d.ts.map +1 -0
- package/dist/components/BaseHead.js +161 -0
- package/dist/components/BaseHead.js.map +1 -0
- package/dist/components/SimpleLivePreview.d.ts +7 -0
- package/dist/components/SimpleLivePreview.d.ts.map +1 -0
- package/dist/components/SimpleLivePreview.js +7 -0
- package/dist/components/SimpleLivePreview.js.map +1 -0
- package/dist/components/Terminal.d.ts +7 -0
- package/dist/components/Terminal.d.ts.map +1 -0
- package/dist/components/Terminal.js +8 -0
- package/dist/components/Terminal.js.map +1 -0
- package/dist/components/VoiceRecorder.d.ts +4 -0
- package/dist/components/VoiceRecorder.d.ts.map +1 -0
- package/dist/components/VoiceRecorder.js +5 -0
- package/dist/components/VoiceRecorder.js.map +1 -0
- package/dist/components/icons/GeminiLogo.d.ts +7 -0
- package/dist/components/icons/GeminiLogo.d.ts.map +1 -0
- package/dist/components/icons/GeminiLogo.js +5 -0
- package/dist/components/icons/GeminiLogo.js.map +1 -0
- package/dist/components/icons/OllamaLogo.d.ts +2 -0
- package/dist/components/icons/OllamaLogo.d.ts.map +1 -0
- package/dist/components/icons/OllamaLogo.js +5 -0
- package/dist/components/icons/OllamaLogo.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/Layout.d.ts +8 -0
- package/dist/layouts/Layout.d.ts.map +1 -0
- package/dist/layouts/Layout.js +16 -0
- package/dist/layouts/Layout.js.map +1 -0
- package/dist/layouts/NotFoundLayout.d.ts +2 -0
- package/dist/layouts/NotFoundLayout.d.ts.map +1 -0
- package/dist/layouts/NotFoundLayout.js +6 -0
- package/dist/layouts/NotFoundLayout.js.map +1 -0
- package/dist/pages/Home.d.ts +7 -0
- package/dist/pages/Home.d.ts.map +1 -0
- package/dist/pages/Home.js +8 -0
- package/dist/pages/Home.js.map +1 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +333 -0
- package/dist/server.js.map +1 -0
- package/dist/services/dev-server.d.ts +29 -0
- package/dist/services/dev-server.d.ts.map +1 -0
- package/dist/services/dev-server.js +201 -0
- package/dist/services/dev-server.js.map +1 -0
- package/dist/services/terminal.d.ts +22 -0
- package/dist/services/terminal.d.ts.map +1 -0
- package/dist/services/terminal.js +133 -0
- package/dist/services/terminal.js.map +1 -0
- package/dist/static/components/SimpleLivePreview.js +270 -0
- package/dist/static/components/Terminal.js +244 -0
- package/dist/static/favicon.svg +14 -0
- package/dist/static/signals/LivePreviewSignal.js +71 -0
- package/dist/static/styles/main.css +1400 -0
- package/package.json +58 -7
- package/src/cli.ts +155 -0
- package/src/components/BaseHead.ts +164 -0
- package/src/components/SimpleLivePreview.tsx +81 -0
- package/src/components/Terminal.tsx +34 -0
- package/src/components/VoiceRecorder.tsx +33 -0
- package/src/components/icons/GeminiLogo.tsx +10 -0
- package/src/components/icons/OllamaLogo.tsx +5 -0
- package/src/index.tsx +11 -0
- package/src/layouts/Layout.tsx +34 -0
- package/src/layouts/NotFoundLayout.tsx +15 -0
- package/src/pages/Home.tsx +27 -0
- package/src/server.tsx +399 -0
- package/src/services/dev-server.ts +234 -0
- package/src/services/terminal.ts +165 -0
- package/src/static/components/SimpleLivePreview.js +270 -0
- package/src/static/components/Terminal.js +244 -0
- package/src/static/favicon.svg +14 -0
- package/src/static/signals/LivePreviewSignal.js +71 -0
- package/src/static/styles/main.css +1400 -0
- package/src/styles/input.css +3 -0
- package/tailwind.config.ts +12 -0
- package/tsconfig.json +37 -0
- package/README.md +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { signal, computed } from 'https://esm.sh/@preact/signals@1.2.2';
|
|
2
|
+
|
|
3
|
+
// Live Preview state management
|
|
4
|
+
class LivePreviewStore {
|
|
5
|
+
constructor() {
|
|
6
|
+
// Core state signals
|
|
7
|
+
this.refreshTrigger = signal(0);
|
|
8
|
+
this.previewPort = signal(5173); // Default port
|
|
9
|
+
this.currentUrl = signal('http://localhost:5173');
|
|
10
|
+
this.isMobileView = signal(false);
|
|
11
|
+
this.isLoading = signal(false);
|
|
12
|
+
|
|
13
|
+
// Computed values
|
|
14
|
+
this.shouldRefresh = computed(() => this.refreshTrigger.value);
|
|
15
|
+
this.baseUrl = computed(() => `http://localhost:${this.previewPort.value}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Actions for managing preview state
|
|
19
|
+
refresh() {
|
|
20
|
+
this.refreshTrigger.value = this.refreshTrigger.value + 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setPreviewPort(port) {
|
|
24
|
+
this.previewPort.value = port;
|
|
25
|
+
// Update currentUrl to use new port if it was using the old port
|
|
26
|
+
const currentUrlValue = this.currentUrl.value;
|
|
27
|
+
const oldPort = currentUrlValue.match(/:(\d+)/)?.[1];
|
|
28
|
+
if (oldPort) {
|
|
29
|
+
this.currentUrl.value = currentUrlValue.replace(`:${oldPort}`, `:${port}`);
|
|
30
|
+
} else {
|
|
31
|
+
this.currentUrl.value = `http://localhost:${port}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setUrl(url) {
|
|
36
|
+
this.currentUrl.value = url;
|
|
37
|
+
this.refresh(); // Auto-refresh when URL changes
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
toggleMobileView() {
|
|
41
|
+
this.isMobileView.value = !this.isMobileView.value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setLoading(isLoading) {
|
|
45
|
+
this.isLoading.value = isLoading;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Debug helpers
|
|
49
|
+
getState() {
|
|
50
|
+
return {
|
|
51
|
+
refreshTrigger: this.refreshTrigger.value,
|
|
52
|
+
previewPort: this.previewPort.value,
|
|
53
|
+
currentUrl: this.currentUrl.value,
|
|
54
|
+
isMobileView: this.isMobileView.value,
|
|
55
|
+
isLoading: this.isLoading.value,
|
|
56
|
+
baseUrl: this.baseUrl.value
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
logState() {
|
|
61
|
+
console.log('Live Preview State:', this.getState());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Create and export singleton instance
|
|
66
|
+
export const livePreviewStore = new LivePreviewStore();
|
|
67
|
+
|
|
68
|
+
// Make it available globally for debugging
|
|
69
|
+
if (typeof window !== 'undefined') {
|
|
70
|
+
window.livePreviewStore = livePreviewStore;
|
|
71
|
+
}
|