zero-query 1.2.17 → 1.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 CHANGED
@@ -5,15 +5,17 @@
5
5
  <h1 align="center">zQuery</h1>
6
6
 
7
7
  <p align="center">
8
+ <a href="https://www.npmjs.com/package/zero-query"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-package-name-zquery.svg?v=7a51b269" alt="npm package"></a>
9
+ <a href="https://www.npmjs.com/package/zero-query"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-npm-zquery.svg?v=6baa3dbe" alt="npm version"></a>
10
+ <a href="https://www.npmjs.com/package/zero-query"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-dm-zquery.svg?v=23646f6e" alt="npm downloads"></a>
11
+ </p>
8
12
 
9
- [![CI](https://github.com/tonywied17/zero-query/actions/workflows/ci.yml/badge.svg)](https://github.com/tonywied17/zero-query/actions/workflows/ci.yml)
10
- [![npm version](https://img.shields.io/npm/v/zero-query.svg)](https://www.npmjs.com/package/zero-query)
11
- [![npm downloads](https://img.shields.io/npm/dm/zero-query.svg)](https://www.npmjs.com/package/zero-query)
12
- [![GitHub](https://img.shields.io/badge/GitHub-zero--query-blue.svg)](https://github.com/tonywied17/zero-query)
13
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14
- [![Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)](package.json)
15
- [![VS Code Extension](https://img.shields.io/visual-studio-marketplace/v/zQuery.zquery-vs-code?label=VS%20Code&logo=visualstudiocode&color=007acc)](https://marketplace.visualstudio.com/items?itemName=zQuery.zquery-vs-code)
16
-
13
+ <p align="center">
14
+ <a href="https://github.com/tonywied17/zero-query/actions/workflows/ci.yml"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-ci-zquery.svg?v=29af6360" alt="CI"></a>
15
+ <a href="https://github.com/tonywied17/zero-query"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-tests-zquery.svg?v=fa09e3d4" alt="tests"></a>
16
+ <a href="https://github.com/tonywied17/zero-query"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-coverage-zquery.svg?v=a969c52b" alt="coverage"></a>
17
+ <a href="https://opensource.org/licenses/MIT"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-license-zquery.svg?v=73a9f288" alt="License"></a>
18
+ <a href="https://marketplace.visualstudio.com/items?itemName=zQuery.zquery-vs-code"><img src="https://raw.githubusercontent.com/tonywied17/tonywied17/main/.github/badges/zero-query-vscode-zquery.svg?v=a2c589fa" alt="VS Code Extension"></a>
17
19
  </p>
18
20
 
19
21
  > **Lightweight, zero-dependency frontend library that combines jQuery-style DOM manipulation with a modern reactive component system, SPA router, global state management, HTTP client, and utility toolkit - all in a single ~108 KB minified browser bundle. Works out of the box with ES modules. An optional CLI bundler is available for single-file production builds.**
package/dist/API.md CHANGED
@@ -1782,7 +1782,7 @@ $.morphElement($.id('panel'), newEl);
1782
1782
  > **Tip:** When you use `$()` to set `.html()` on a component root, auto-morph kicks in automatically — no manual call needed.
1783
1783
 
1784
1784
 
1785
- **Auto-Key Detection:** zQuery automatically detects `z-key` attributes in child lists and switches to keyed reconciliation. If any child has `z-key`, the entire sibling group is reconciled as a keyed list.
1785
+ **Auto-Key Detection:** zQuery automatically detects reconciliation keys in child lists and switches to keyed reconciliation. Keys come from `z-key` first, then fall back to `id`, `data-id`, or `data-key`. If any child carries a key, the entire sibling group is reconciled as a keyed list - unless two siblings resolve to the same key (for example, delegation buttons in one row sharing a `data-id`), in which case that list falls back to positional morphing.
1786
1786
 
1787
1787
 
1788
1788
 
@@ -2267,7 +2267,7 @@ __CODEBLOCK_24__
2267
2267
  > **Tip:** When you use `$()` to set `.html()` on a component root, auto-morph kicks in automatically — no manual call needed.
2268
2268
 
2269
2269
 
2270
- **Auto-Key Detection:** zQuery automatically detects `z-key` attributes in child lists and switches to keyed reconciliation. If any child has `z-key`, the entire sibling group is reconciled as a keyed list.
2270
+ **Auto-Key Detection:** zQuery automatically detects reconciliation keys in child lists and switches to keyed reconciliation. Keys come from `z-key` first, then fall back to `id`, `data-id`, or `data-key`. If any child carries a key, the entire sibling group is reconciled as a keyed list - unless two siblings resolve to the same key (for example, delegation buttons in one row sharing a `data-id`), in which case that list falls back to positional morphing.
2271
2271
 
2272
2272
 
2273
2273
 
@@ -4811,7 +4811,10 @@ $('#root').empty().html('<div>fresh</div>');
4811
4811
  > **Tip:** **Auto-Morph:** When you call `.html()` on an element that already has children, zQuery runs the morph algorithm instead of a raw innerHTML swap. This preserves focus, scroll position, CSS transitions, and event listeners. Use `.morph()` for explicit morph control, or `.empty().html()` to opt out.
4812
4812
 
4813
4813
 
4814
- **Auto-Key Detection:** When morphing a list of children, if *any* child has a `z-key` attribute, the entire sibling group is reconciled using keyed LIS-based reorder. Otherwise, children are patched pairwise.
4814
+ **Auto-Key Detection:** When morphing a list of children, if *any* child carries a reconciliation key, the entire sibling group is reconciled using keyed LIS-based reorder. Otherwise, children are patched pairwise. Keys come from `z-key` first, then fall back to the element's `id`, `data-id`, or `data-key` - so keyed reconciliation activates automatically for lists that already carry stable ids.
4815
+
4816
+
4817
+ **Duplicate-key fallback:** Keyed reconciliation requires keys to be unique among siblings. If two siblings resolve to the same key - common when several delegation buttons in one row share a `data-id` - that child list falls back to positional (pairwise) morphing, which stays well-defined for colliding sets. Use an explicit unique `z-key` when you need keyed identity for reorder-heavy lists.
4815
4818
 
4816
4819
 
4817
4820
  #### CSS & Dimensions
@@ -5883,20 +5886,20 @@ That’s it — one command. The SSR server starts at `http://localhost:3000` an
5883
5886
  The generated project:
5884
5887
 
5885
5888
 
5886
- - [index.html](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/index.html)client HTML shell (meta tags, z-link nav)
5887
- - [global.css](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/global.css)dark theme styles
5888
- - [package.json](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/package.json)
5889
- - [app.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/app.js)client entry — imports & registers shared components
5890
- - [routes.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/routes.js)shared route definitions
5891
- - [home.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/components/home.js)
5892
- - [about.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/components/about.js)
5893
- - [not-found.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/components/not-found.js)
5894
- - [index.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/components/blog/index.js)blog list (/blog)
5895
- - [post.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/app/components/blog/post.js)blog detail (/blog/:slug)
5896
- ▶[server](https://github.com/tonywied17/zero-query/tree/main/cli/scaffold/ssr/server)Node.js SSR server
5897
- - [index.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/server/index.js)SSR HTTP server with JSON API
5898
- - [posts.js](https://github.com/tonywied17/zero-query/blob/main/cli/scaffold/ssr/server/data/posts.js)sample blog data
5899
- ▶[assets](https://github.com/tonywied17/zero-query/tree/main/cli/scaffold/ssr/assets)
5889
+ - [index.html](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/index.html)client HTML shell (meta tags, z-link nav)
5890
+ - [global.css](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/global.css)dark theme styles
5891
+ - [package.json](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/package.json)
5892
+ - [app.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/app.js)client entry — imports & registers shared components
5893
+ - [routes.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/routes.js)shared route definitions
5894
+ - [home.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/components/home.js)
5895
+ - [about.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/components/about.js)
5896
+ - [not-found.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/components/not-found.js)
5897
+ - [index.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/components/blog/index.js)blog list (/blog)
5898
+ - [post.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/app/components/blog/post.js)blog detail (/blog/:slug)
5899
+ ▶[server](https://github.com/molexxxx/zero-query/tree/main/cli/scaffold/ssr/server)Node.js SSR server
5900
+ - [index.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/server/index.js)SSR HTTP server with JSON API
5901
+ - [posts.js](https://github.com/molexxxx/zero-query/blob/main/cli/scaffold/ssr/server/data/posts.js)sample blog data
5902
+ ▶[assets](https://github.com/molexxxx/zero-query/tree/main/cli/scaffold/ssr/assets)
5900
5903
 
5901
5904
  Components in `app/components/` export plain definition objects. The client registers them with `$.component()`, the server with `app.component()` — same files, same definitions, two runtimes. The scaffold includes:
5902
5905
 
@@ -6596,7 +6599,7 @@ The `z-link` directive is for SPA route paths. For external URLs, use standard a
6596
6599
  <a z-link="/settings">Settings</a>
6597
6600
 
6598
6601
  <!-- External link: use regular href -->
6599
- <a href="https://github.com/tonywied17/zero-query"
6602
+ <a href="https://github.com/molexxxx/zero-query"
6600
6603
  target="_blank" rel="noopener">GitHub</a>
6601
6604
  ```
6602
6605
 
@@ -6717,7 +6720,7 @@ The WebRTC surface is layered — pick the level you need:
6717
6720
  | **Hardening** | `SFrameContext`, `attachE2ee`, TURN refresher | You need E2EE and rotating TURN credentials. |
6718
6721
 
6719
6722
 
6720
- > **Tip:** Want a working starting point? Run `npx zero-query create my-app --webrtc-demo` (alias `-w`) to scaffold a one-page video room with mic / camera / screen-share toggles, a reactive roster, and a chat data channel. The scaffold installs [zero-server](https://github.com/tonywied17/zero-server), launches the signaling + static server on `http://localhost:3000`, and opens your browser - one command, no extra setup. Camera and microphone stay off until the user opts in.
6723
+ > **Tip:** Want a working starting point? Run `npx zero-query create my-app --webrtc-demo` (alias `-w`) to scaffold a one-page video room with mic / camera / screen-share toggles, a reactive roster, and a chat data channel. The scaffold installs [zero-server](https://github.com/molexxxx/zero-server), launches the signaling + static server on `http://localhost:3000`, and opens your browser - one command, no extra setup. Camera and microphone stay off until the user opts in.
6721
6724
 
6722
6725
 
6723
6726
 
Binary file
package/dist/zquery.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * zQuery (zeroQuery) v1.2.17
2
+ * zQuery (zeroQuery) v1.3.1
3
3
  * Lightweight Frontend Library
4
4
  * https://github.com/tonywied17/zero-query
5
5
  * (c) 2026 Anthony Wiedman - MIT License
@@ -4311,15 +4311,33 @@ function _morphChildren(oldParent, newParent) {
4311
4311
  if (hasKeys) {
4312
4312
  oldKeyMap = new Map();
4313
4313
  newKeyMap = new Map();
4314
+ // Duplicate keys among siblings (common with auto-keys: several
4315
+ // buttons sharing one data-id for event delegation) make keyed
4316
+ // reconciliation ill-defined - it drops and duplicates nodes.
4317
+ // Positional morphing is always correct for colliding sets, so
4318
+ // bail out to the unkeyed path on the first duplicate.
4319
+ let duplicate = false;
4314
4320
  for (let i = 0; i < oldLen; i++) {
4315
4321
  const key = _getKey(oldChildren[i]);
4316
- if (key != null) oldKeyMap.set(key, i);
4322
+ if (key != null) {
4323
+ if (oldKeyMap.has(key)) { duplicate = true; break; }
4324
+ oldKeyMap.set(key, i);
4325
+ }
4317
4326
  }
4318
- for (let i = 0; i < newLen; i++) {
4319
- const key = _getKey(newChildren[i]);
4320
- if (key != null) newKeyMap.set(key, i);
4327
+ if (!duplicate) {
4328
+ for (let i = 0; i < newLen; i++) {
4329
+ const key = _getKey(newChildren[i]);
4330
+ if (key != null) {
4331
+ if (newKeyMap.has(key)) { duplicate = true; break; }
4332
+ newKeyMap.set(key, i);
4333
+ }
4334
+ }
4335
+ }
4336
+ if (duplicate) {
4337
+ _morphChildrenUnkeyed(oldParent, oldChildren, newChildren);
4338
+ } else {
4339
+ _morphChildrenKeyed(oldParent, oldChildren, newChildren, oldKeyMap, newKeyMap);
4321
4340
  }
4322
- _morphChildrenKeyed(oldParent, oldChildren, newChildren, oldKeyMap, newKeyMap);
4323
4341
  } else {
4324
4342
  _morphChildrenUnkeyed(oldParent, oldChildren, newChildren);
4325
4343
  }
@@ -10500,9 +10518,9 @@ $.TurnError = TurnError;
10500
10518
  $.E2eeError = E2eeError;
10501
10519
 
10502
10520
  // --- Meta ------------------------------------------------------------------
10503
- $.version = '1.2.17';
10521
+ $.version = '1.3.1';
10504
10522
  $.libSize = '~130 KB';
10505
- $.unitTests = {"passed":2349,"failed":0,"total":2535,"suites":620,"duration":8215,"ok":true};
10523
+ $.unitTests = {"passed":2380,"failed":0,"total":2566,"suites":628,"duration":8931,"ok":true};
10506
10524
  $.meta = {}; // populated at build time by CLI bundler
10507
10525
 
10508
10526
  // --- Environment detection -------------------------------------------------