2024-05-29 18:43:41 +00:00
|
|
|
function noop() {
|
|
|
|
}
|
|
|
|
const identity = (x) => x;
|
|
|
|
function run(fn) {
|
|
|
|
return fn();
|
|
|
|
}
|
|
|
|
function blank_object() {
|
|
|
|
return /* @__PURE__ */ Object.create(null);
|
|
|
|
}
|
|
|
|
function run_all(fns) {
|
|
|
|
fns.forEach(run);
|
|
|
|
}
|
|
|
|
function is_function(thing) {
|
|
|
|
return typeof thing === "function";
|
|
|
|
}
|
|
|
|
function safe_not_equal(a, b) {
|
|
|
|
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
|
|
|
|
}
|
|
|
|
function subscribe(store, ...callbacks) {
|
|
|
|
if (store == null) {
|
|
|
|
for (const callback of callbacks) {
|
|
|
|
callback(void 0);
|
|
|
|
}
|
|
|
|
return noop;
|
|
|
|
}
|
|
|
|
const unsub = store.subscribe(...callbacks);
|
|
|
|
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
|
|
|
|
}
|
|
|
|
function get_store_value(store) {
|
|
|
|
let value;
|
|
|
|
subscribe(store, (_) => value = _)();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
function compute_rest_props(props, keys) {
|
|
|
|
const rest = {};
|
|
|
|
keys = new Set(keys);
|
|
|
|
for (const k in props)
|
|
|
|
if (!keys.has(k) && k[0] !== "$")
|
|
|
|
rest[k] = props[k];
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
function set_store_value(store, ret, value) {
|
|
|
|
store.set(value);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
function split_css_unit(value) {
|
|
|
|
const split = typeof value === "string" && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
|
|
|
|
return split ? [parseFloat(split[1]), split[2] || "px"] : [
|
|
|
|
/** @type {number} */
|
|
|
|
value,
|
|
|
|
"px"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
|
|
|
|
return new CustomEvent(type, { detail, bubbles, cancelable });
|
|
|
|
}
|
|
|
|
let current_component;
|
|
|
|
function set_current_component(component) {
|
|
|
|
current_component = component;
|
|
|
|
}
|
|
|
|
function get_current_component() {
|
|
|
|
if (!current_component)
|
|
|
|
throw new Error("Function called outside component initialization");
|
|
|
|
return current_component;
|
|
|
|
}
|
|
|
|
function onDestroy(fn) {
|
|
|
|
get_current_component().$$.on_destroy.push(fn);
|
|
|
|
}
|
|
|
|
function createEventDispatcher() {
|
|
|
|
const component = get_current_component();
|
|
|
|
return (type, detail, { cancelable = false } = {}) => {
|
|
|
|
const callbacks = component.$$.callbacks[type];
|
|
|
|
if (callbacks) {
|
|
|
|
const event = custom_event(
|
|
|
|
/** @type {string} */
|
|
|
|
type,
|
|
|
|
detail,
|
|
|
|
{ cancelable }
|
|
|
|
);
|
|
|
|
callbacks.slice().forEach((fn) => {
|
|
|
|
fn.call(component, event);
|
|
|
|
});
|
|
|
|
return !event.defaultPrevented;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
function setContext(key, context) {
|
|
|
|
get_current_component().$$.context.set(key, context);
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
function getContext(key) {
|
|
|
|
return get_current_component().$$.context.get(key);
|
|
|
|
}
|
|
|
|
function hasContext(key) {
|
|
|
|
return get_current_component().$$.context.has(key);
|
|
|
|
}
|
|
|
|
|
2024-06-23 09:25:48 +00:00
|
|
|
export { subscribe as a, getContext as b, compute_rest_props as c, set_current_component as d, current_component as e, split_css_unit as f, get_store_value as g, set_store_value as h, identity as i, hasContext as j, createEventDispatcher as k, safe_not_equal as l, is_function as m, noop as n, onDestroy as o, blank_object as p, run_all as r, setContext as s };
|
|
|
|
//# sourceMappingURL=lifecycle-px-3doLe.js.map
|