zero-query 0.7.5 → 0.8.7
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/README.md +39 -30
- package/cli/commands/build.js +110 -1
- package/cli/commands/bundle.js +127 -50
- package/cli/commands/create.js +1 -1
- package/cli/commands/dev/devtools/index.js +56 -0
- package/cli/commands/dev/devtools/js/components.js +49 -0
- package/cli/commands/dev/devtools/js/core.js +409 -0
- package/cli/commands/dev/devtools/js/elements.js +413 -0
- package/cli/commands/dev/devtools/js/network.js +166 -0
- package/cli/commands/dev/devtools/js/performance.js +73 -0
- package/cli/commands/dev/devtools/js/router.js +105 -0
- package/cli/commands/dev/devtools/js/source.js +132 -0
- package/cli/commands/dev/devtools/js/stats.js +35 -0
- package/cli/commands/dev/devtools/js/tabs.js +79 -0
- package/cli/commands/dev/devtools/panel.html +95 -0
- package/cli/commands/dev/devtools/styles.css +244 -0
- package/cli/commands/dev/index.js +28 -3
- package/cli/commands/dev/logger.js +6 -1
- package/cli/commands/dev/overlay.js +377 -0
- package/cli/commands/dev/server.js +8 -0
- package/cli/commands/dev/watcher.js +26 -1
- package/cli/help.js +8 -5
- package/cli/scaffold/{scripts → app}/app.js +1 -1
- package/cli/scaffold/{scripts → app}/components/about.js +4 -4
- package/cli/scaffold/{scripts → app}/components/api-demo.js +1 -1
- package/cli/scaffold/app/components/home.js +137 -0
- package/cli/scaffold/{scripts → app}/routes.js +1 -1
- package/cli/scaffold/{scripts → app}/store.js +6 -6
- package/cli/scaffold/assets/.gitkeep +0 -0
- package/cli/scaffold/{styles/styles.css → global.css} +3 -2
- package/cli/scaffold/index.html +11 -11
- package/dist/zquery.dist.zip +0 -0
- package/dist/zquery.js +740 -226
- package/dist/zquery.min.js +2 -2
- package/index.d.ts +11 -11
- package/index.js +15 -10
- package/package.json +3 -2
- package/src/component.js +154 -139
- package/src/core.js +57 -11
- package/src/diff.js +256 -58
- package/src/expression.js +33 -3
- package/src/reactive.js +37 -5
- package/src/router.js +196 -7
- package/src/ssr.js +1 -1
- package/tests/component.test.js +582 -0
- package/tests/core.test.js +251 -0
- package/tests/diff.test.js +333 -2
- package/tests/expression.test.js +148 -0
- package/tests/http.test.js +108 -0
- package/tests/reactive.test.js +148 -0
- package/tests/router.test.js +317 -0
- package/tests/store.test.js +126 -0
- package/tests/utils.test.js +161 -2
- package/types/collection.d.ts +17 -2
- package/types/component.d.ts +10 -34
- package/types/misc.d.ts +13 -0
- package/types/router.d.ts +30 -1
- package/cli/commands/dev.old.js +0 -520
- package/cli/scaffold/scripts/components/home.js +0 -137
- /package/cli/scaffold/{scripts → app}/components/contacts/contacts.css +0 -0
- /package/cli/scaffold/{scripts → app}/components/contacts/contacts.html +0 -0
- /package/cli/scaffold/{scripts → app}/components/contacts/contacts.js +0 -0
- /package/cli/scaffold/{scripts → app}/components/counter.js +0 -0
- /package/cli/scaffold/{scripts → app}/components/not-found.js +0 -0
- /package/cli/scaffold/{scripts → app}/components/todos.js +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// scripts/components/home.js — dashboard / landing page
|
|
2
|
-
//
|
|
3
|
-
// Demonstrates: $.component, state, render, mounted lifecycle,
|
|
4
|
-
// signal + computed + effect (reactive primitives),
|
|
5
|
-
// $.store integration, $.bus, template rendering
|
|
6
|
-
|
|
7
|
-
$.component('home-page', {
|
|
8
|
-
state: () => ({
|
|
9
|
-
greeting: '',
|
|
10
|
-
signalDemo: 0,
|
|
11
|
-
}),
|
|
12
|
-
|
|
13
|
-
mounted() {
|
|
14
|
-
// $.signal() — fine-grained reactive primitive
|
|
15
|
-
const count = $.signal(0);
|
|
16
|
-
|
|
17
|
-
// $.computed() — derived reactive value that auto-updates
|
|
18
|
-
const doubled = $.computed(() => count.value * 2);
|
|
19
|
-
|
|
20
|
-
// $.effect() — runs whenever its dependencies change
|
|
21
|
-
$.effect(() => {
|
|
22
|
-
this.state.signalDemo = doubled.value;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Store the signal setter so the button can use it
|
|
26
|
-
this._signalCount = count;
|
|
27
|
-
|
|
28
|
-
// Greet based on time of day
|
|
29
|
-
const hour = new Date().getHours();
|
|
30
|
-
this.state.greeting = hour < 12 ? 'Good morning'
|
|
31
|
-
: hour < 18 ? 'Good afternoon'
|
|
32
|
-
: 'Good evening';
|
|
33
|
-
|
|
34
|
-
// Track page visit via the global store
|
|
35
|
-
const store = $.getStore('main');
|
|
36
|
-
store.dispatch('incrementVisits');
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
incrementSignal() {
|
|
40
|
-
if (this._signalCount) {
|
|
41
|
-
this._signalCount.value++;
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
render() {
|
|
46
|
-
const store = $.getStore('main');
|
|
47
|
-
return `
|
|
48
|
-
<div class="page-header">
|
|
49
|
-
<h1>${this.state.greeting} 👋</h1>
|
|
50
|
-
<p class="subtitle">Welcome to your new <strong>zQuery</strong> app. Explore the pages to see different features in action.</p>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<div class="card-grid">
|
|
54
|
-
<div class="card card-accent">
|
|
55
|
-
<h3>⚡ Reactive Signals</h3>
|
|
56
|
-
<p>Fine-grained reactivity with <code>signal()</code>, <code>computed()</code>, and <code>effect()</code>.</p>
|
|
57
|
-
<div class="signal-demo">
|
|
58
|
-
<span class="signal-value">Doubled: ${this.state.signalDemo}</span>
|
|
59
|
-
<button class="btn btn-sm" @click="incrementSignal">Increment Signal</button>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="card">
|
|
64
|
-
<h3>🔢 Counter</h3>
|
|
65
|
-
<p><code>computed</code> properties, <code>watch</code> callbacks, and <code>z-for</code> with <code>z-key</code> diffing.</p>
|
|
66
|
-
<a z-link="/counter" class="btn btn-outline">Try It →</a>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<div class="card">
|
|
70
|
-
<h3>✅ Todos</h3>
|
|
71
|
-
<p>Global store, <code>z-key</code> keyed lists, DOM diffing. <strong>${store.getters.todoCount}</strong> items, <strong>${store.getters.doneCount}</strong> done.</p>
|
|
72
|
-
<a z-link="/todos" class="btn btn-outline">Try It →</a>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="card">
|
|
76
|
-
<h3>📇 Contacts</h3>
|
|
77
|
-
<p>External templates, scoped styles, and <code>z-key</code> keyed lists. <strong>${store.getters.contactCount}</strong> contacts, <strong>${store.getters.favoriteCount}</strong> ★ favorited.</p>
|
|
78
|
-
<a z-link="/contacts" class="btn btn-outline">Try It →</a>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<div class="card">
|
|
82
|
-
<h3>🌐 API Demo</h3>
|
|
83
|
-
<p>Fetch data with <code>$.get()</code>, loading states, and <code>$.escapeHtml()</code>.</p>
|
|
84
|
-
<a z-link="/api" class="btn btn-outline">Try It →</a>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div class="card card-muted">
|
|
89
|
-
<h3>📊 App Stats</h3>
|
|
90
|
-
<div class="stats-grid">
|
|
91
|
-
<div class="stat-group">
|
|
92
|
-
<span class="stat-group-title">🏠 General</span>
|
|
93
|
-
<div class="stat-group-values">
|
|
94
|
-
<div class="stat">
|
|
95
|
-
<span class="stat-value">${store.state.visits}</span>
|
|
96
|
-
<span class="stat-label">Page Views</span>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<div class="stat-group">
|
|
102
|
-
<span class="stat-group-title">✅ Todos</span>
|
|
103
|
-
<div class="stat-group-values">
|
|
104
|
-
<div class="stat">
|
|
105
|
-
<span class="stat-value">${store.getters.todoCount}</span>
|
|
106
|
-
<span class="stat-label">Total</span>
|
|
107
|
-
</div>
|
|
108
|
-
<div class="stat">
|
|
109
|
-
<span class="stat-value">${store.getters.pendingCount}</span>
|
|
110
|
-
<span class="stat-label">Pending</span>
|
|
111
|
-
</div>
|
|
112
|
-
<div class="stat">
|
|
113
|
-
<span class="stat-value">${store.getters.doneCount}</span>
|
|
114
|
-
<span class="stat-label">Done</span>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
|
|
119
|
-
<div class="stat-group">
|
|
120
|
-
<span class="stat-group-title">📇 Contacts</span>
|
|
121
|
-
<div class="stat-group-values">
|
|
122
|
-
<div class="stat">
|
|
123
|
-
<span class="stat-value">${store.getters.contactCount}</span>
|
|
124
|
-
<span class="stat-label">Total</span>
|
|
125
|
-
</div>
|
|
126
|
-
<div class="stat">
|
|
127
|
-
<span class="stat-value">${store.getters.favoriteCount}</span>
|
|
128
|
-
<span class="stat-label">★ Favorited</span>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
<small class="muted">Stats powered by <code>$.store()</code> getters — visit count tracked globally.</small>
|
|
134
|
-
</div>
|
|
135
|
-
`;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|