You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This update introduces support for constructable/adopted stylesheets in modern browser environments, refines document style synchronization, and implements flexible proxy-based selectable/callable cells for browser.hash and browser.query.
The hash parsing logic now features refined path and flag semantics: top-level bare values without slashes parse into a path property and a companion boolean flag (e.g. #new parses to { path: "new", new: true }), whereas values with slashes parse into the path property only (e.g. #login/new parses to { path: "login/new" }). Top-level parenthesized groups are parsed directly as arrays. Browser.hash and Browser.query cells are now wrapped in a Proxy that can be called directly with a key/subpath argument to retrieve a selected child view, while preserving complete backward compatibility with all properties and methods of the underlying Cell instance.
On the WebComponent side, document styles are now synchronized and cloned into shadow roots using constructable stylesheets (via CSSStyleSheet.replaceSync) in supported environments, avoiding raw <style> element insertions where possible. Style node synchronization signature calculations have been hardened by introducing a 32-bit FNV-like text hashing mechanism (hashText) rather than relying purely on text lengths.
There are no breaking changes; all modified APIs and refactored helper relocations remain completely backward-compatible.
Changed:
- browser: Updated Browser.prototype.hash and Browser.prototype.query properties to return a callable proxy wrapper, enabling direct key selection via function calls (e.g., state.hash("key")) while retaining all original Cell APIs.
- browser: Updated parseHash(value) logic to support stricter path/flag semantics. A bare first segment sets a path property, setting a matching boolean flag unless it contains a slash /. Outermost parenthesized values parse directly as arrays.
- webcomponents: Clones and syncs document styles into WebComponent shadow roots using adopted constructable stylesheets (CSSStyleSheet) in supported browsers, falling back to style elements where needed.
- webcomponents: Enhanced getDocumentStylesSignature(doc) to compute a 32-bit hash (hashText) of style element text contents, ensuring high-fidelity change detection.
- utils: Relocated the def helper function from src/js/select/utils/func.js to src/js/select/utils/values.js. (Exports via the central utils.js compatibility barrel are unchanged and fully backward-compatible).
Added:
- browser: Added parse(value, fallback = {}) method to browser.hash for array-capable parsing and record sanitization.
- webcomponents: Added static options definition (webcomponent.options) to expose configuration defaults and exported webcomponent as default.
- tests: Added comprehensive test suite in tests/browser-parse.test.js covering hash-parsing, slash behavior, parenthesized group arrays, and edge cases.
- tests: Added adopted stylesheet and dynamic content mutation tests in tests/ui-webcomponent-children.test.js.
Removed:
- utils: Removed def helper from src/js/select/utils/func.js (re-added under utils/values.js).
0 commit comments