Comparing version 5.10.1 to 5.11.0
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.10.1", | ||
"version": "5.11.0", | ||
"type": "module", | ||
@@ -77,2 +77,6 @@ "types": "./types/index.d.ts", | ||
}, | ||
"./reactivity/window": { | ||
"types": "./types/index.d.ts", | ||
"default": "./src/reactivity/window/index.js" | ||
}, | ||
"./server": { | ||
@@ -79,0 +83,0 @@ "types": "./types/index.d.ts", |
@@ -204,3 +204,3 @@ import { DEV } from 'esm-env'; | ||
/** | ||
* @param {any} node | ||
* @param {HTMLElement} node | ||
* @param {string} prop | ||
@@ -220,6 +220,17 @@ * @param {any} value | ||
try { | ||
if (get_setters(node).includes(prop)) { | ||
if ( | ||
// Don't compute setters for custom elements while they aren't registered yet, | ||
// because during their upgrade/instantiation they might add more setters. | ||
// Instead, fall back to a simple "an object, then set as property" heuristic. | ||
setters_cache.has(node.nodeName) || customElements.get(node.tagName.toLowerCase()) | ||
? get_setters(node).includes(prop) | ||
: value && typeof value === 'object' | ||
) { | ||
// @ts-expect-error | ||
node[prop] = value; | ||
} else { | ||
set_attribute(node, prop, value); | ||
// We did getters etc checks already, stringify before passing to set_attribute | ||
// to ensure it doesn't invoke the same logic again, and potentially populating | ||
// the setters cache too early. | ||
set_attribute(node, prop, value == null ? value : String(value)); | ||
} | ||
@@ -389,4 +400,5 @@ } finally { | ||
setters_cache.set(element.nodeName, (setters = [])); | ||
var descriptors; | ||
var proto = get_prototype_of(element); | ||
var proto = element; // In the case of custom elements there might be setters on the instance | ||
var element_proto = Element.prototype; | ||
@@ -393,0 +405,0 @@ |
import { run_all } from '../../shared/utils.js'; | ||
// Fallback for when requestIdleCallback is not available | ||
const request_idle_callback = | ||
export const request_idle_callback = | ||
typeof requestIdleCallback === 'undefined' | ||
@@ -6,0 +6,0 @@ ? (/** @type {() => void} */ cb) => setTimeout(cb, 1) |
@@ -1,3 +0,3 @@ | ||
import { createSubscriber } from './create-subscriber.js'; | ||
import { on } from '../events/index.js'; | ||
import { ReactiveValue } from './reactive-value.js'; | ||
@@ -19,24 +19,17 @@ /** | ||
* ``` | ||
* @extends {ReactiveValue<boolean>} | ||
* @since 5.7.0 | ||
*/ | ||
export class MediaQuery { | ||
#query; | ||
#subscribe = createSubscriber((update) => { | ||
return on(this.#query, 'change', update); | ||
}); | ||
get current() { | ||
this.#subscribe(); | ||
return this.#query.matches; | ||
} | ||
export class MediaQuery extends ReactiveValue { | ||
/** | ||
* @param {string} query A media query string | ||
* @param {boolean} [matches] Fallback value for the server | ||
* @param {boolean} [fallback] Fallback value for the server | ||
*/ | ||
constructor(query, matches) { | ||
// For convenience (and because people likely forget them) we add the parentheses; double parentheses are not a problem | ||
this.#query = window.matchMedia(`(${query})`); | ||
constructor(query, fallback) { | ||
const q = window.matchMedia(`(${query})`); | ||
super( | ||
() => q.matches, | ||
(update) => on(q, 'change', update) | ||
); | ||
} | ||
} |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.10.1'; | ||
export const VERSION = '5.11.0'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2431800
378
53455