1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2026-01-10 16:06:28 +01:00

🐛 🔤 v0.9.4-alpha (#42)

* 🐛 fixes #41

*  adjust package size limits

* 🔤

* 📺 requestIdleCallback doesn need to be global

* 🔤 corrects irland page headers

* 📺 version

*  Signal ← SignalReadonly

* 🐛 ensures only one disconncetd listener

…for cleanup

*  🔤 Better build and improve texting

* 🐛 logo alignemt (due to gh)

* 🔤 md enhancements

* 🔤  products
This commit is contained in:
2025-03-19 17:10:43 +01:00
committed by GitHub
parent 04f93345f8
commit 4c450ae763
44 changed files with 854 additions and 339 deletions

View File

@@ -86,6 +86,11 @@ var DDE = (() => {
function kebabToCamel(name) {
return name.replace(/-./g, (x) => x[1].toUpperCase());
}
function requestIdle() {
return new Promise(function(resolve) {
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}
// src/dom-lib/common.js
var enviroment = {
@@ -224,11 +229,6 @@ var DDE = (() => {
is_observing = false;
observer.disconnect();
}
function requestIdle() {
return new Promise(function(resolve) {
(requestIdleCallback || requestAnimationFrame)(resolve);
});
}
async function collectChildren(element) {
if (store.size > 30)
await requestIdle();
@@ -741,13 +741,10 @@ var DDE = (() => {
})();
// src/signals-lib/signals-lib.js
var Signal = oCreate(null, {
var SignalReadOnly = oCreate(null, {
get: { value() {
return read(this);
} },
set: { value(...v) {
return write(this, ...v);
} },
toJSON: { value() {
return read(this);
} },
@@ -755,9 +752,9 @@ var DDE = (() => {
return this[mark] && this[mark].value;
} }
});
var SignalReadOnly = oCreate(Signal, {
set: { value() {
return;
var Signal = oCreate(SignalReadOnly, {
set: { value(...v) {
return write(this, ...v);
} }
});
function isSignal(candidate) {
@@ -869,7 +866,7 @@ var DDE = (() => {
};
function requestCleanUpReactives(host) {
if (!host || !host[key_reactive]) return;
(requestIdleCallback || setTimeout)(function() {
requestIdle().then(function() {
host[key_reactive] = host[key_reactive].filter(([s, el]) => el.isConnected ? true : (removeSignalListener(...s), false));
});
}
@@ -934,9 +931,10 @@ var DDE = (() => {
function removeSignalsFromElements(s, listener, ...notes) {
const { current } = scope;
current.host(function(element) {
if (!element[key_reactive]) element[key_reactive] = [];
const is_first = !element[key_reactive];
if (is_first) element[key_reactive] = [];
element[key_reactive].push([[s, listener], ...notes]);
if (current.prevent) return;
if (!is_first || current.prevent) return;
on.disconnected(
() => (
/*! Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, …?).
@@ -951,7 +949,7 @@ var DDE = (() => {
});
function create(is_readonly, value, actions) {
const varS = oCreate(is_readonly ? SignalReadOnly : Signal);
const SI = toSignal(varS, value, actions, is_readonly);
const SI = toSignal(varS, value, actions);
cleanUpRegistry.register(SI, SI[mark]);
return SI;
}
@@ -963,7 +961,7 @@ var DDE = (() => {
this.skip = true;
}
});
function toSignal(s, value, actions, readonly = false) {
function toSignal(s, value, actions) {
const onclear = [];
if (typeOf(actions) !== "[object Object]")
actions = {};
@@ -979,8 +977,7 @@ var DDE = (() => {
actions,
onclear,
host,
listeners: /* @__PURE__ */ new Set(),
readonly
listeners: /* @__PURE__ */ new Set()
}),
enumerable: false,
writable: false,