1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-01 12:22:15 +02:00

Signal ← SignalReadonly

This commit is contained in:
2025-03-19 10:02:33 +01:00
parent a459c0d786
commit 74ed180919
6 changed files with 24 additions and 35 deletions

View File

@ -696,13 +696,10 @@ var queueSignalWrite = /* @__PURE__ */ (() => {
})();
// 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);
} },
@ -710,9 +707,9 @@ var Signal = oCreate(null, {
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) {
@ -906,7 +903,7 @@ var cleanUpRegistry = new FinalizationRegistry(function(s) {
});
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;
}
@ -918,7 +915,7 @@ var protoSigal = oAssign(oCreate(), {
this.skip = true;
}
});
function toSignal(s, value, actions, readonly = false) {
function toSignal(s, value, actions) {
const onclear = [];
if (typeOf(actions) !== "[object Object]")
actions = {};
@ -934,8 +931,7 @@ function toSignal(s, value, actions, readonly = false) {
actions,
onclear,
host,
listeners: /* @__PURE__ */ new Set(),
readonly
listeners: /* @__PURE__ */ new Set()
}),
enumerable: false,
writable: false,

File diff suppressed because one or more lines are too long

View File

@ -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) {
@ -951,7 +948,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 +960,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 +976,7 @@ var DDE = (() => {
actions,
onclear,
host,
listeners: /* @__PURE__ */ new Set(),
readonly
listeners: /* @__PURE__ */ new Set()
}),
enumerable: false,
writable: false,

File diff suppressed because one or more lines are too long