zero-query 0.2.9 → 0.3.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/README.md +1 -1
- package/cli.js +12 -4
- package/dist/zquery.dist.zip +0 -0
- package/dist/zquery.js +2 -2
- package/dist/zquery.min.js +2 -2
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ cd my-app
|
|
|
50
50
|
npx zquery dev
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
The `create` command generates a ready-to-run project with `index.html`, a router, two components, and styles. The dev server watches for file changes, hot-swaps CSS in-place, full-reloads on
|
|
53
|
+
The `create` command generates a ready-to-run project with `index.html`, a router, two components, and styles. The dev server watches for file changes, hot-swaps CSS in-place, full-reloads on other changes, and handles SPA fallback routing.
|
|
54
54
|
|
|
55
55
|
### Alternative: Manual Setup (No npm)
|
|
56
56
|
|
package/cli.js
CHANGED
|
@@ -815,7 +815,10 @@ function devServer() {
|
|
|
815
815
|
// 2. node_modules/zero-query/dist/ (when installed as a dependency)
|
|
816
816
|
// 3. Fall through to static serving (vendor copy on disk)
|
|
817
817
|
// Registered as middleware so it runs BEFORE serveStatic.
|
|
818
|
+
// Use --no-intercept to skip this and serve the on-disk vendor copy instead.
|
|
819
|
+
const noIntercept = flag('no-intercept');
|
|
818
820
|
app.use((req, res, next) => {
|
|
821
|
+
if (noIntercept) return next();
|
|
819
822
|
const basename = path.basename(req.url.split('?')[0]).toLowerCase();
|
|
820
823
|
if (basename !== 'zquery.min.js') return next();
|
|
821
824
|
|
|
@@ -866,14 +869,16 @@ function devServer() {
|
|
|
866
869
|
}
|
|
867
870
|
|
|
868
871
|
// File watcher — watch the project root for changes
|
|
869
|
-
|
|
872
|
+
// All file types trigger a reload; CSS gets hot-swapped, everything else
|
|
873
|
+
// triggers a full page reload. Only ignored directories are skipped.
|
|
870
874
|
const IGNORE_DIRS = new Set(['node_modules', '.git', 'dist', '.cache']);
|
|
871
875
|
let debounceTimer;
|
|
872
876
|
|
|
873
877
|
function shouldWatch(filename) {
|
|
874
878
|
if (!filename) return false;
|
|
875
|
-
|
|
876
|
-
|
|
879
|
+
// Ignore dotfiles (e.g. .DS_Store)
|
|
880
|
+
if (filename.startsWith('.')) return false;
|
|
881
|
+
return true;
|
|
877
882
|
}
|
|
878
883
|
|
|
879
884
|
function isIgnored(filepath) {
|
|
@@ -931,7 +936,8 @@ function devServer() {
|
|
|
931
936
|
console.log(` Local: \x1b[36mhttp://localhost:${PORT}/\x1b[0m`);
|
|
932
937
|
console.log(` Root: ${path.relative(process.cwd(), root) || '.'}`);
|
|
933
938
|
console.log(` Live Reload: \x1b[32menabled\x1b[0m (SSE)`);
|
|
934
|
-
console.log(`
|
|
939
|
+
if (noIntercept) console.log(` Intercept: \x1b[33mdisabled\x1b[0m (--no-intercept)`);
|
|
940
|
+
console.log(` Watching: all files in ${watchDirs.length} director${watchDirs.length === 1 ? 'y' : 'ies'}`);
|
|
935
941
|
console.log(` \x1b[2m${'─'.repeat(40)}\x1b[0m`);
|
|
936
942
|
console.log(` Press Ctrl+C to stop\n`);
|
|
937
943
|
});
|
|
@@ -1115,6 +1121,8 @@ function showHelp() {
|
|
|
1115
1121
|
|
|
1116
1122
|
dev [root] Start a dev server with live-reload
|
|
1117
1123
|
--port, -p <number> Port number (default: 3100)
|
|
1124
|
+
--no-intercept Disable auto-resolution of zquery.min.js
|
|
1125
|
+
(serve the on-disk vendor copy instead)
|
|
1118
1126
|
|
|
1119
1127
|
bundle [entry] Bundle app ES modules into a single file
|
|
1120
1128
|
--out, -o <path> Output directory (default: dist/ next to index.html)
|
package/dist/zquery.dist.zip
CHANGED
|
Binary file
|
package/dist/zquery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zQuery (zeroQuery) v0.
|
|
2
|
+
* zQuery (zeroQuery) v0.3.1
|
|
3
3
|
* Lightweight Frontend Library
|
|
4
4
|
* https://github.com/tonywied17/zero-query
|
|
5
5
|
* (c) 2026 Anthony Wiedman — MIT License
|
|
@@ -2576,7 +2576,7 @@ $.session = session;
|
|
|
2576
2576
|
$.bus = bus;
|
|
2577
2577
|
|
|
2578
2578
|
// --- Meta ------------------------------------------------------------------
|
|
2579
|
-
$.version = '0.
|
|
2579
|
+
$.version = '0.3.1';
|
|
2580
2580
|
$.meta = {}; // populated at build time by CLI bundler
|
|
2581
2581
|
|
|
2582
2582
|
$.noConflict = () => {
|
package/dist/zquery.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zQuery (zeroQuery) v0.
|
|
2
|
+
* zQuery (zeroQuery) v0.3.1
|
|
3
3
|
* Lightweight Frontend Library
|
|
4
4
|
* https://github.com/tonywied17/zero-query
|
|
5
5
|
* (c) 2026 Anthony Wiedman — MIT License
|
|
@@ -13,5 +13,5 @@ class Router { constructor(config = {}) { this._el = null; const isFile = typeof
|
|
|
13
13
|
class Store { constructor(config = {}) { this._subscribers = new Map(); this._wildcards = new Set(); this._actions = config.actions || {}; this._getters = config.getters || {}; this._middleware = []; this._history = []; this._debug = config.debug || false; const initial = typeof config.state === 'function' ? config.state() : { ...(config.state || {}) }; this.state = reactive(initial, (key, value, old) => { const subs = this._subscribers.get(key); if (subs) subs.forEach(fn => fn(value, old, key)); this._wildcards.forEach(fn => fn(key, value, old)); }); this.getters = {}; for (const [name, fn] of Object.entries(this._getters)) { Object.defineProperty(this.getters, name, { get: () => fn(this.state.__raw || this.state), enumerable: true }); } } dispatch(name, ...args) { const action = this._actions[name]; if (!action) { console.warn(`zQuery Store: Unknown action "${name}"`); return; } for (const mw of this._middleware) { const result = mw(name, args, this.state); if (result === false) return; } if (this._debug) { console.log(`%c[Store] ${name}`, 'color: #4CAF50; font-weight: bold;', ...args); } const result = action(this.state, ...args); this._history.push({ action: name, args, timestamp: Date.now() }); return result; } subscribe(keyOrFn, fn) { if (typeof keyOrFn === 'function') { this._wildcards.add(keyOrFn); return () => this._wildcards.delete(keyOrFn); } if (!this._subscribers.has(keyOrFn)) { this._subscribers.set(keyOrFn, new Set()); } this._subscribers.get(keyOrFn).add(fn); return () => this._subscribers.get(keyOrFn)?.delete(fn); } snapshot() { return JSON.parse(JSON.stringify(this.state.__raw || this.state)); } replaceState(newState) { const raw = this.state.__raw || this.state; for (const key of Object.keys(raw)) { delete this.state[key]; } Object.assign(this.state, newState); } use(fn) { this._middleware.push(fn); return this; } get history() { return [...this._history]; } reset(initialState) { this.replaceState(initialState); this._history = []; }
|
|
14
14
|
const _config = { baseURL: '', headers: { 'Content-Type': 'application/json' }, timeout: 30000,
|
|
15
15
|
function debounce(fn, ms = 250) { let timer; const debounced = (...args) => { clearTimeout(timer); timer = setTimeout(() => fn(...args), ms); }; debounced.cancel = () => clearTimeout(timer); return debounced;
|
|
16
|
-
function $(selector, context) { if (typeof selector === 'function') { query.ready(selector); return; } return query(selector, context);
|
|
16
|
+
function $(selector, context) { if (typeof selector === 'function') { query.ready(selector); return; } return query(selector, context);
|
|
17
17
|
})(typeof window !== 'undefined' ? window : globalThis);
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zero-query",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Lightweight modern frontend library — jQuery-like selectors, reactive components, SPA router, and state management with zero dependencies.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|