zero-query 1.1.1 → 1.2.0
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/LICENSE +21 -21
- package/README.md +2 -0
- package/cli/args.js +33 -33
- package/cli/commands/build-api.js +443 -442
- package/cli/commands/build.js +254 -247
- package/cli/commands/bundle.js +1228 -1224
- package/cli/commands/create.js +137 -121
- package/cli/commands/dev/devtools/index.js +56 -56
- package/cli/commands/dev/devtools/js/components.js +49 -49
- package/cli/commands/dev/devtools/js/core.js +423 -423
- package/cli/commands/dev/devtools/js/elements.js +421 -421
- package/cli/commands/dev/devtools/js/network.js +166 -166
- package/cli/commands/dev/devtools/js/performance.js +73 -73
- package/cli/commands/dev/devtools/js/router.js +105 -105
- package/cli/commands/dev/devtools/js/source.js +132 -132
- package/cli/commands/dev/devtools/js/stats.js +35 -35
- package/cli/commands/dev/devtools/js/tabs.js +79 -79
- package/cli/commands/dev/devtools/panel.html +95 -95
- package/cli/commands/dev/devtools/styles.css +244 -244
- package/cli/commands/dev/index.js +107 -107
- package/cli/commands/dev/logger.js +75 -75
- package/cli/commands/dev/overlay.js +858 -858
- package/cli/commands/dev/server.js +220 -220
- package/cli/commands/dev/validator.js +94 -94
- package/cli/commands/dev/watcher.js +172 -172
- package/cli/help.js +114 -112
- package/cli/index.js +52 -52
- package/cli/scaffold/default/LICENSE +21 -21
- package/cli/scaffold/default/app/app.js +207 -207
- package/cli/scaffold/default/app/components/about.js +201 -201
- package/cli/scaffold/default/app/components/api-demo.js +143 -143
- package/cli/scaffold/default/app/components/contact-card.js +231 -231
- package/cli/scaffold/default/app/components/contacts/contacts.css +706 -706
- package/cli/scaffold/default/app/components/contacts/contacts.html +200 -200
- package/cli/scaffold/default/app/components/contacts/contacts.js +196 -196
- package/cli/scaffold/default/app/components/counter.js +127 -127
- package/cli/scaffold/default/app/components/home.js +249 -249
- package/cli/scaffold/default/app/components/not-found.js +16 -16
- package/cli/scaffold/default/app/components/playground/playground.css +115 -115
- package/cli/scaffold/default/app/components/playground/playground.html +161 -161
- package/cli/scaffold/default/app/components/playground/playground.js +116 -116
- package/cli/scaffold/default/app/components/todos.js +225 -225
- package/cli/scaffold/default/app/components/toolkit/toolkit.css +97 -97
- package/cli/scaffold/default/app/components/toolkit/toolkit.html +146 -146
- package/cli/scaffold/default/app/components/toolkit/toolkit.js +280 -280
- package/cli/scaffold/default/app/routes.js +15 -15
- package/cli/scaffold/default/app/store.js +101 -101
- package/cli/scaffold/default/global.css +552 -552
- package/cli/scaffold/default/index.html +99 -99
- package/cli/scaffold/minimal/app/app.js +85 -85
- package/cli/scaffold/minimal/app/components/about.js +68 -68
- package/cli/scaffold/minimal/app/components/counter.js +122 -122
- package/cli/scaffold/minimal/app/components/home.js +68 -68
- package/cli/scaffold/minimal/app/components/not-found.js +16 -16
- package/cli/scaffold/minimal/app/routes.js +9 -9
- package/cli/scaffold/minimal/app/store.js +36 -36
- package/cli/scaffold/minimal/global.css +300 -300
- package/cli/scaffold/minimal/index.html +44 -44
- package/cli/scaffold/ssr/app/app.js +41 -41
- package/cli/scaffold/ssr/app/components/about.js +55 -55
- package/cli/scaffold/ssr/app/components/blog/index.js +65 -65
- package/cli/scaffold/ssr/app/components/blog/post.js +86 -86
- package/cli/scaffold/ssr/app/components/home.js +37 -37
- package/cli/scaffold/ssr/app/components/not-found.js +15 -15
- package/cli/scaffold/ssr/app/routes.js +8 -8
- package/cli/scaffold/ssr/global.css +228 -228
- package/cli/scaffold/ssr/index.html +37 -37
- package/cli/scaffold/ssr/package.json +8 -8
- package/cli/scaffold/ssr/server/data/posts.js +144 -144
- package/cli/scaffold/ssr/server/index.js +213 -213
- package/cli/scaffold/webrtc/app/app.js +11 -0
- package/cli/scaffold/webrtc/app/components/video-room.js +295 -0
- package/cli/scaffold/webrtc/app/lib/room.js +252 -0
- package/cli/scaffold/webrtc/assets/.gitkeep +0 -0
- package/cli/scaffold/webrtc/global.css +250 -0
- package/cli/scaffold/webrtc/index.html +21 -0
- package/cli/utils.js +305 -287
- package/dist/API.md +661 -0
- package/dist/zquery.dist.zip +0 -0
- package/dist/zquery.js +10313 -6614
- package/dist/zquery.min.js +8 -631
- package/index.d.ts +570 -371
- package/index.js +311 -240
- package/package.json +76 -70
- package/src/component.js +1709 -1691
- package/src/core.js +921 -921
- package/src/diff.js +497 -497
- package/src/errors.js +209 -209
- package/src/expression.js +922 -922
- package/src/http.js +242 -242
- package/src/package.json +1 -1
- package/src/reactive.js +255 -255
- package/src/router.js +843 -843
- package/src/ssr.js +418 -418
- package/src/store.js +318 -318
- package/src/utils.js +515 -515
- package/src/webrtc/e2ee.js +351 -0
- package/src/webrtc/errors.js +116 -0
- package/src/webrtc/ice.js +301 -0
- package/src/webrtc/index.js +131 -0
- package/src/webrtc/joinToken.js +119 -0
- package/src/webrtc/observe.js +172 -0
- package/src/webrtc/peer.js +351 -0
- package/src/webrtc/reactive.js +268 -0
- package/src/webrtc/room.js +625 -0
- package/src/webrtc/sdp.js +302 -0
- package/src/webrtc/sfu/index.js +43 -0
- package/src/webrtc/sfu/livekit.js +131 -0
- package/src/webrtc/sfu/mediasoup.js +150 -0
- package/src/webrtc/signaling.js +373 -0
- package/src/webrtc/turn.js +237 -0
- package/tests/_helpers/webrtcFakes.js +289 -0
- package/tests/audit.test.js +4158 -4158
- package/tests/cli.test.js +1136 -1103
- package/tests/compare.test.js +497 -486
- package/tests/component.test.js +3969 -3938
- package/tests/core.test.js +1910 -1910
- package/tests/dev-server.test.js +489 -489
- package/tests/diff.test.js +1416 -1416
- package/tests/docs.test.js +1664 -1650
- package/tests/electron-features.test.js +864 -864
- package/tests/errors.test.js +619 -619
- package/tests/expression.test.js +1056 -1056
- package/tests/http.test.js +648 -648
- package/tests/reactive.test.js +819 -819
- package/tests/router.test.js +2327 -2327
- package/tests/ssr.test.js +870 -870
- package/tests/store.test.js +830 -830
- package/tests/test-minifier.js +153 -153
- package/tests/test-ssr.js +27 -27
- package/tests/utils.test.js +1377 -1377
- package/tests/webrtc/e2ee.test.js +283 -0
- package/tests/webrtc/ice.test.js +202 -0
- package/tests/webrtc/joinToken.test.js +89 -0
- package/tests/webrtc/observe.test.js +111 -0
- package/tests/webrtc/peer.test.js +373 -0
- package/tests/webrtc/reactive.test.js +235 -0
- package/tests/webrtc/room.test.js +406 -0
- package/tests/webrtc/sdp.test.js +151 -0
- package/tests/webrtc/sfu-livekit.test.js +119 -0
- package/tests/webrtc/sfu.test.js +160 -0
- package/tests/webrtc/signaling.test.js +251 -0
- package/tests/webrtc/turn.test.js +256 -0
- package/types/collection.d.ts +383 -383
- package/types/component.d.ts +186 -186
- package/types/errors.d.ts +135 -135
- package/types/http.d.ts +92 -92
- package/types/misc.d.ts +201 -201
- package/types/reactive.d.ts +98 -98
- package/types/router.d.ts +190 -190
- package/types/ssr.d.ts +102 -102
- package/types/store.d.ts +146 -146
- package/types/utils.d.ts +245 -245
- package/types/webrtc.d.ts +653 -0
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
// api-demo.js - HTTP client demo
|
|
2
|
-
//
|
|
3
|
-
// Features used:
|
|
4
|
-
// $.get() - fetch JSON from an API
|
|
5
|
-
// z-if / z-else / z-show - conditional rendering
|
|
6
|
-
// z-for / z-text - list rendering & text binding
|
|
7
|
-
// $.escapeHtml() - sanitize user-provided content
|
|
8
|
-
// async methods - loading & error state patterns
|
|
9
|
-
|
|
10
|
-
$.component('api-demo', {
|
|
11
|
-
styles: `
|
|
12
|
-
.api-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
13
|
-
gap: .75rem; }
|
|
14
|
-
.api-user { display: flex; flex-direction: column; gap: .2rem; padding: 1rem;
|
|
15
|
-
border-radius: var(--radius); border: 1px solid var(--border);
|
|
16
|
-
background: var(--bg-hover); cursor: pointer;
|
|
17
|
-
transition: border-color .15s, box-shadow .15s, transform .12s; text-align: left; }
|
|
18
|
-
.api-user:hover { border-color: var(--accent); transform: translateY(-2px);
|
|
19
|
-
box-shadow: 0 4px 12px rgba(88,166,255,.12); }
|
|
20
|
-
.api-user strong { color: var(--text); font-size: .95rem; }
|
|
21
|
-
.api-user small { color: var(--text-muted); font-size: .82rem; }
|
|
22
|
-
.api-user .handle { color: var(--accent); font-weight: 500; }
|
|
23
|
-
|
|
24
|
-
.api-detail { display: flex; align-items: flex-start; justify-content: space-between;
|
|
25
|
-
gap: 1rem; flex-wrap: wrap; }
|
|
26
|
-
.api-meta { font-size: .88rem; color: var(--text-muted); margin-top: .15rem; }
|
|
27
|
-
.api-meta span { margin-right: .75rem; }
|
|
28
|
-
.api-meta .accent { color: var(--accent); }
|
|
29
|
-
|
|
30
|
-
.api-posts { display: flex; flex-direction: column; gap: .5rem; }
|
|
31
|
-
.api-post { padding: .85rem 1rem; border-radius: var(--radius);
|
|
32
|
-
border-left: 3px solid var(--accent); background: var(--bg-hover);
|
|
33
|
-
transition: border-color .15s; }
|
|
34
|
-
.api-post:hover { border-left-color: #7ee787; }
|
|
35
|
-
.api-post h4 { font-size: .92rem; margin: 0 0 .3rem; color: var(--text); }
|
|
36
|
-
.api-post p { font-size: .84rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
|
|
37
|
-
|
|
38
|
-
@media (max-width: 768px) {
|
|
39
|
-
.api-users { grid-template-columns: 1fr 1fr; }
|
|
40
|
-
.api-detail { flex-direction: column; }
|
|
41
|
-
}
|
|
42
|
-
@media (max-width: 480px) {
|
|
43
|
-
.api-users { grid-template-columns: 1fr; }
|
|
44
|
-
}
|
|
45
|
-
`,
|
|
46
|
-
|
|
47
|
-
state: () => ({
|
|
48
|
-
users: [],
|
|
49
|
-
selectedUser: null,
|
|
50
|
-
posts: [],
|
|
51
|
-
loading: false,
|
|
52
|
-
error: '',
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
mounted() {
|
|
56
|
-
this.fetchUsers();
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
async fetchUsers() {
|
|
60
|
-
this.state.loading = true;
|
|
61
|
-
this.state.error = '';
|
|
62
|
-
try {
|
|
63
|
-
const res = await $.get('https://jsonplaceholder.typicode.com/users');
|
|
64
|
-
this.state.users = res.data.slice(0, 6);
|
|
65
|
-
} catch (err) {
|
|
66
|
-
this.state.error = 'Failed to load users. Check your connection.';
|
|
67
|
-
}
|
|
68
|
-
this.state.loading = false;
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
async selectUser(id) {
|
|
72
|
-
this.state.selectedUser = this.state.users.find(u => u.id === Number(id));
|
|
73
|
-
this.state.loading = true;
|
|
74
|
-
try {
|
|
75
|
-
const res = await $.get(`https://jsonplaceholder.typicode.com/posts?userId=${id}`);
|
|
76
|
-
this.state.posts = res.data.slice(0, 4);
|
|
77
|
-
} catch (err) {
|
|
78
|
-
this.state.error = 'Failed to load posts.';
|
|
79
|
-
}
|
|
80
|
-
this.state.loading = false;
|
|
81
|
-
$.bus.emit('toast', { message: `Loaded posts for ${this.state.selectedUser.name}`, type: 'success' });
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
clearSelection() {
|
|
85
|
-
this.state.selectedUser = null;
|
|
86
|
-
this.state.posts = [];
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
render() {
|
|
90
|
-
const { selectedUser } = this.state;
|
|
91
|
-
|
|
92
|
-
return `
|
|
93
|
-
<div class="page-header">
|
|
94
|
-
<h1>API Demo</h1>
|
|
95
|
-
<p class="subtitle">Fetching data with <code>$.get()</code>. Directives: <code>z-if</code>, <code>z-show</code>, <code>z-for</code>, <code>z-text</code>.</p>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<div class="card card-error" z-show="error"><p><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:16px;height:16px;vertical-align:-3px;margin-right:0.15rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"/></svg> <span z-text="error"></span></p></div>
|
|
99
|
-
<div class="loading-bar" z-show="loading"></div>
|
|
100
|
-
|
|
101
|
-
<div z-if="!selectedUser">
|
|
102
|
-
<div class="card">
|
|
103
|
-
<h3>Users</h3>
|
|
104
|
-
<p class="muted" style="margin-bottom:.75rem;">Click a user card to fetch their recent posts via <code>$.get()</code>.</p>
|
|
105
|
-
<div class="api-users" z-if="users.length > 0">
|
|
106
|
-
<button z-for="u in users" class="api-user" @click="selectUser({{u.id}})">
|
|
107
|
-
<strong>{{u.name}}</strong>
|
|
108
|
-
<small class="handle">@{{u.username}}</small>
|
|
109
|
-
<small>{{u.company.name}}</small>
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
<p z-else z-show="!loading">No users loaded.</p>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div z-else>
|
|
117
|
-
<div class="card">
|
|
118
|
-
<div class="api-detail">
|
|
119
|
-
<div>
|
|
120
|
-
<h3 style="margin:0;">${selectedUser ? $.escapeHtml(selectedUser.name) : ''}</h3>
|
|
121
|
-
<div class="api-meta">
|
|
122
|
-
<span class="accent">@${selectedUser ? $.escapeHtml(selectedUser.username) : ''}</span>
|
|
123
|
-
<span>${selectedUser ? $.escapeHtml(selectedUser.email) : ''}</span>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
<button class="btn btn-outline btn-sm" @click="clearSelection">← Back to users</button>
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div class="card">
|
|
131
|
-
<h3>Recent Posts</h3>
|
|
132
|
-
<div class="api-posts" z-if="posts.length > 0">
|
|
133
|
-
<article z-for="p in posts" class="api-post">
|
|
134
|
-
<h4>{{p.title}}</h4>
|
|
135
|
-
<p>{{p.body.substring(0, 120)}}…</p>
|
|
136
|
-
</article>
|
|
137
|
-
</div>
|
|
138
|
-
<p z-else class="muted" z-show="!loading">No posts found.</p>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
`;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
1
|
+
// api-demo.js - HTTP client demo
|
|
2
|
+
//
|
|
3
|
+
// Features used:
|
|
4
|
+
// $.get() - fetch JSON from an API
|
|
5
|
+
// z-if / z-else / z-show - conditional rendering
|
|
6
|
+
// z-for / z-text - list rendering & text binding
|
|
7
|
+
// $.escapeHtml() - sanitize user-provided content
|
|
8
|
+
// async methods - loading & error state patterns
|
|
9
|
+
|
|
10
|
+
$.component('api-demo', {
|
|
11
|
+
styles: `
|
|
12
|
+
.api-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
13
|
+
gap: .75rem; }
|
|
14
|
+
.api-user { display: flex; flex-direction: column; gap: .2rem; padding: 1rem;
|
|
15
|
+
border-radius: var(--radius); border: 1px solid var(--border);
|
|
16
|
+
background: var(--bg-hover); cursor: pointer;
|
|
17
|
+
transition: border-color .15s, box-shadow .15s, transform .12s; text-align: left; }
|
|
18
|
+
.api-user:hover { border-color: var(--accent); transform: translateY(-2px);
|
|
19
|
+
box-shadow: 0 4px 12px rgba(88,166,255,.12); }
|
|
20
|
+
.api-user strong { color: var(--text); font-size: .95rem; }
|
|
21
|
+
.api-user small { color: var(--text-muted); font-size: .82rem; }
|
|
22
|
+
.api-user .handle { color: var(--accent); font-weight: 500; }
|
|
23
|
+
|
|
24
|
+
.api-detail { display: flex; align-items: flex-start; justify-content: space-between;
|
|
25
|
+
gap: 1rem; flex-wrap: wrap; }
|
|
26
|
+
.api-meta { font-size: .88rem; color: var(--text-muted); margin-top: .15rem; }
|
|
27
|
+
.api-meta span { margin-right: .75rem; }
|
|
28
|
+
.api-meta .accent { color: var(--accent); }
|
|
29
|
+
|
|
30
|
+
.api-posts { display: flex; flex-direction: column; gap: .5rem; }
|
|
31
|
+
.api-post { padding: .85rem 1rem; border-radius: var(--radius);
|
|
32
|
+
border-left: 3px solid var(--accent); background: var(--bg-hover);
|
|
33
|
+
transition: border-color .15s; }
|
|
34
|
+
.api-post:hover { border-left-color: #7ee787; }
|
|
35
|
+
.api-post h4 { font-size: .92rem; margin: 0 0 .3rem; color: var(--text); }
|
|
36
|
+
.api-post p { font-size: .84rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
|
|
37
|
+
|
|
38
|
+
@media (max-width: 768px) {
|
|
39
|
+
.api-users { grid-template-columns: 1fr 1fr; }
|
|
40
|
+
.api-detail { flex-direction: column; }
|
|
41
|
+
}
|
|
42
|
+
@media (max-width: 480px) {
|
|
43
|
+
.api-users { grid-template-columns: 1fr; }
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
|
|
47
|
+
state: () => ({
|
|
48
|
+
users: [],
|
|
49
|
+
selectedUser: null,
|
|
50
|
+
posts: [],
|
|
51
|
+
loading: false,
|
|
52
|
+
error: '',
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
mounted() {
|
|
56
|
+
this.fetchUsers();
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
async fetchUsers() {
|
|
60
|
+
this.state.loading = true;
|
|
61
|
+
this.state.error = '';
|
|
62
|
+
try {
|
|
63
|
+
const res = await $.get('https://jsonplaceholder.typicode.com/users');
|
|
64
|
+
this.state.users = res.data.slice(0, 6);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
this.state.error = 'Failed to load users. Check your connection.';
|
|
67
|
+
}
|
|
68
|
+
this.state.loading = false;
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
async selectUser(id) {
|
|
72
|
+
this.state.selectedUser = this.state.users.find(u => u.id === Number(id));
|
|
73
|
+
this.state.loading = true;
|
|
74
|
+
try {
|
|
75
|
+
const res = await $.get(`https://jsonplaceholder.typicode.com/posts?userId=${id}`);
|
|
76
|
+
this.state.posts = res.data.slice(0, 4);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
this.state.error = 'Failed to load posts.';
|
|
79
|
+
}
|
|
80
|
+
this.state.loading = false;
|
|
81
|
+
$.bus.emit('toast', { message: `Loaded posts for ${this.state.selectedUser.name}`, type: 'success' });
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
clearSelection() {
|
|
85
|
+
this.state.selectedUser = null;
|
|
86
|
+
this.state.posts = [];
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
render() {
|
|
90
|
+
const { selectedUser } = this.state;
|
|
91
|
+
|
|
92
|
+
return `
|
|
93
|
+
<div class="page-header">
|
|
94
|
+
<h1>API Demo</h1>
|
|
95
|
+
<p class="subtitle">Fetching data with <code>$.get()</code>. Directives: <code>z-if</code>, <code>z-show</code>, <code>z-for</code>, <code>z-text</code>.</p>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div class="card card-error" z-show="error"><p><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:16px;height:16px;vertical-align:-3px;margin-right:0.15rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"/></svg> <span z-text="error"></span></p></div>
|
|
99
|
+
<div class="loading-bar" z-show="loading"></div>
|
|
100
|
+
|
|
101
|
+
<div z-if="!selectedUser">
|
|
102
|
+
<div class="card">
|
|
103
|
+
<h3>Users</h3>
|
|
104
|
+
<p class="muted" style="margin-bottom:.75rem;">Click a user card to fetch their recent posts via <code>$.get()</code>.</p>
|
|
105
|
+
<div class="api-users" z-if="users.length > 0">
|
|
106
|
+
<button z-for="u in users" class="api-user" @click="selectUser({{u.id}})">
|
|
107
|
+
<strong>{{u.name}}</strong>
|
|
108
|
+
<small class="handle">@{{u.username}}</small>
|
|
109
|
+
<small>{{u.company.name}}</small>
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
<p z-else z-show="!loading">No users loaded.</p>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div z-else>
|
|
117
|
+
<div class="card">
|
|
118
|
+
<div class="api-detail">
|
|
119
|
+
<div>
|
|
120
|
+
<h3 style="margin:0;">${selectedUser ? $.escapeHtml(selectedUser.name) : ''}</h3>
|
|
121
|
+
<div class="api-meta">
|
|
122
|
+
<span class="accent">@${selectedUser ? $.escapeHtml(selectedUser.username) : ''}</span>
|
|
123
|
+
<span>${selectedUser ? $.escapeHtml(selectedUser.email) : ''}</span>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<button class="btn btn-outline btn-sm" @click="clearSelection">← Back to users</button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div class="card">
|
|
131
|
+
<h3>Recent Posts</h3>
|
|
132
|
+
<div class="api-posts" z-if="posts.length > 0">
|
|
133
|
+
<article z-for="p in posts" class="api-post">
|
|
134
|
+
<h4>{{p.title}}</h4>
|
|
135
|
+
<p>{{p.body.substring(0, 120)}}…</p>
|
|
136
|
+
</article>
|
|
137
|
+
</div>
|
|
138
|
+
<p z-else class="muted" z-show="!loading">No posts found.</p>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
});
|