streetui 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/create-bin.cjs +1 -1
- package/dist/create-bin.cjs.map +1 -1
- package/dist/create-bin.js +1 -1
- package/dist/create-bin.js.map +1 -1
- package/dist/{hydration-diagnostics-j2ged4cF.d.cts → hydration-diagnostics-Bh0-5vdC.d.cts} +82 -60
- package/dist/{hydration-diagnostics-j2ged4cF.d.ts → hydration-diagnostics-Bh0-5vdC.d.ts} +82 -60
- package/dist/index.cjs +1443 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1033 -6
- package/dist/index.d.ts +1033 -6
- package/dist/index.js +1376 -201
- package/dist/index.js.map +1 -1
- package/dist/{renderer-interface-DngAhfHx.d.ts → renderer-interface-BOpzkWWQ.d.ts} +1 -1
- package/dist/{renderer-interface-hcqzG-N6.d.cts → renderer-interface-D0021Or5.d.cts} +1 -1
- package/dist/{server-VTKCPoqG.d.ts → server-CzcNNC9F.d.ts} +1 -1
- package/dist/{server-Codluzqu.d.cts → server-cE_Qhu4k.d.cts} +1 -1
- package/dist/server.cjs +30 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +30 -1
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +245 -183
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +245 -183
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-
|
|
2
|
-
export { V as VERSION } from './hydration-diagnostics-
|
|
3
|
-
import { R as RenderHandle } from './renderer-interface-
|
|
1
|
+
import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-Bh0-5vdC.cjs';
|
|
2
|
+
export { V as VERSION } from './hydration-diagnostics-Bh0-5vdC.cjs';
|
|
3
|
+
import { R as RenderHandle } from './renderer-interface-D0021Or5.cjs';
|
|
4
4
|
export * from 'streetui/diagnostics';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-
|
|
2
|
-
export { V as VERSION } from './hydration-diagnostics-
|
|
3
|
-
import { R as RenderHandle } from './renderer-interface-
|
|
1
|
+
import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-Bh0-5vdC.js';
|
|
2
|
+
export { V as VERSION } from './hydration-diagnostics-Bh0-5vdC.js';
|
|
3
|
+
import { R as RenderHandle } from './renderer-interface-BOpzkWWQ.js';
|
|
4
4
|
export * from 'streetui/diagnostics';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/testing.js
CHANGED
|
@@ -921,6 +921,13 @@ function applyProp(dom, element, name, value) {
|
|
|
921
921
|
}
|
|
922
922
|
return;
|
|
923
923
|
}
|
|
924
|
+
if (name.startsWith("style.")) {
|
|
925
|
+
const el = element;
|
|
926
|
+
const prop = name.slice("style.".length);
|
|
927
|
+
if (value === null || value === void 0) el.style.removeProperty(prop);
|
|
928
|
+
else el.style.setProperty(prop, String(value));
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
924
931
|
if (value === null || value === void 0 || value === false) {
|
|
925
932
|
dom.removeAttribute(element, name);
|
|
926
933
|
return;
|
|
@@ -971,6 +978,11 @@ var TAG_MAP = {
|
|
|
971
978
|
"list-item": "li",
|
|
972
979
|
image: "img",
|
|
973
980
|
link: "a",
|
|
981
|
+
// A `code()` node renders as a semantic `<pre>` outer element; the mount/
|
|
982
|
+
// hydrate branches add a single inner `<code>` holding the escaped source
|
|
983
|
+
// (mirrors how `text` renders `<span>` + an inner text node). One graph
|
|
984
|
+
// node → one outer element preserves positional hydration.
|
|
985
|
+
code: "pre",
|
|
974
986
|
component: "div",
|
|
975
987
|
slot: "div",
|
|
976
988
|
fragment: "div",
|
|
@@ -1689,6 +1701,23 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
1689
1701
|
dom.appendChild(parentDom, el2);
|
|
1690
1702
|
return instance2;
|
|
1691
1703
|
}
|
|
1704
|
+
if (graphNode.type === "code") {
|
|
1705
|
+
const source = String(graphNode.getProp("text") ?? "");
|
|
1706
|
+
const pre = dom.createElement("pre");
|
|
1707
|
+
const codeEl = dom.createElement("code");
|
|
1708
|
+
const textNode = dom.createTextNode(source);
|
|
1709
|
+
dom.appendChild(codeEl, textNode);
|
|
1710
|
+
dom.appendChild(pre, codeEl);
|
|
1711
|
+
applyNodeProps(ctx, graphNode, pre);
|
|
1712
|
+
const instance2 = new NodeInstance(graphNode, pre);
|
|
1713
|
+
ctx.instances.set(graphNode.id, instance2);
|
|
1714
|
+
wireEvents(dom, graph, graphNode, pre, instance2);
|
|
1715
|
+
if (graphNode.stateRefs.length !== 0) {
|
|
1716
|
+
wireSignalBindings(ctx, graphNode, instance2, textUpdate(dom, pre, textNode));
|
|
1717
|
+
}
|
|
1718
|
+
dom.appendChild(parentDom, pre);
|
|
1719
|
+
return instance2;
|
|
1720
|
+
}
|
|
1692
1721
|
if (graphNode.type === "link") {
|
|
1693
1722
|
const el2 = dom.createElement("a");
|
|
1694
1723
|
const href = graphNode.getProp("href");
|
|
@@ -1991,6 +2020,188 @@ function wireComponentBehavior(ctx, graphNode, instance) {
|
|
|
1991
2020
|
for (const cleanup of fn()) instance.trackCleanup(cleanup);
|
|
1992
2021
|
}
|
|
1993
2022
|
|
|
2023
|
+
// ../state/src/signal.ts
|
|
2024
|
+
var _activeConsumer = null;
|
|
2025
|
+
function withConsumer(consumer, fn) {
|
|
2026
|
+
const prev = _activeConsumer;
|
|
2027
|
+
_activeConsumer = consumer;
|
|
2028
|
+
try {
|
|
2029
|
+
return fn();
|
|
2030
|
+
} finally {
|
|
2031
|
+
_activeConsumer = prev;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
var _batchDepth = 0;
|
|
2035
|
+
var _pendingFlushes = /* @__PURE__ */ new Map();
|
|
2036
|
+
function _enqueueBatchFlush(sig, value) {
|
|
2037
|
+
_pendingFlushes.set(sig, { signal: sig, value });
|
|
2038
|
+
}
|
|
2039
|
+
var Signal = class {
|
|
2040
|
+
_value;
|
|
2041
|
+
_subscribers = /* @__PURE__ */ new Set();
|
|
2042
|
+
_consumers = /* @__PURE__ */ new Set();
|
|
2043
|
+
constructor(initial) {
|
|
2044
|
+
this._value = initial;
|
|
2045
|
+
}
|
|
2046
|
+
get() {
|
|
2047
|
+
if (_activeConsumer !== null) {
|
|
2048
|
+
this._consumers.add(_activeConsumer);
|
|
2049
|
+
_activeConsumer._addSource(this);
|
|
2050
|
+
}
|
|
2051
|
+
return this._value;
|
|
2052
|
+
}
|
|
2053
|
+
peek() {
|
|
2054
|
+
return this._value;
|
|
2055
|
+
}
|
|
2056
|
+
set(value) {
|
|
2057
|
+
if (Object.is(this._value, value)) return;
|
|
2058
|
+
this._value = value;
|
|
2059
|
+
if (_batchDepth > 0) {
|
|
2060
|
+
_enqueueBatchFlush(this, value);
|
|
2061
|
+
} else {
|
|
2062
|
+
this._flush(value);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
update(fn) {
|
|
2066
|
+
this.set(fn(this._value));
|
|
2067
|
+
}
|
|
2068
|
+
subscribe(fn) {
|
|
2069
|
+
this._subscribers.add(fn);
|
|
2070
|
+
return () => {
|
|
2071
|
+
this._subscribers.delete(fn);
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
_removeConsumer(consumer) {
|
|
2075
|
+
this._consumers.delete(consumer);
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Called by the batch machinery after the batch has completed.
|
|
2079
|
+
* Notifies subscribers with the final coalesced value.
|
|
2080
|
+
*/
|
|
2081
|
+
_flushBatch(value) {
|
|
2082
|
+
this._flush(value);
|
|
2083
|
+
}
|
|
2084
|
+
_flush(value) {
|
|
2085
|
+
for (const sub of [...this._subscribers]) sub(value);
|
|
2086
|
+
for (const consumer of [...this._consumers]) consumer._invalidate();
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* @internal DevTools inspection only. The number of live observers
|
|
2090
|
+
* (direct subscribers plus derived/effect consumers). Read-only; never
|
|
2091
|
+
* mutates reactive state.
|
|
2092
|
+
*/
|
|
2093
|
+
_observerCount() {
|
|
2094
|
+
return this._subscribers.size + this._consumers.size;
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
var DerivedSignal = class {
|
|
2098
|
+
_value = void 0;
|
|
2099
|
+
_dirty = true;
|
|
2100
|
+
_disposed = false;
|
|
2101
|
+
_fn;
|
|
2102
|
+
_subscribers = /* @__PURE__ */ new Set();
|
|
2103
|
+
/** All upstream sources this derived currently reads from. */
|
|
2104
|
+
_sources = /* @__PURE__ */ new Set();
|
|
2105
|
+
/** Downstream consumers that depend on this derived. */
|
|
2106
|
+
_consumers = /* @__PURE__ */ new Set();
|
|
2107
|
+
constructor(fn) {
|
|
2108
|
+
this._fn = fn;
|
|
2109
|
+
}
|
|
2110
|
+
get() {
|
|
2111
|
+
if (_activeConsumer !== null) {
|
|
2112
|
+
this._consumers.add(_activeConsumer);
|
|
2113
|
+
_activeConsumer._addSource(this);
|
|
2114
|
+
}
|
|
2115
|
+
if (this._dirty) this._recompute();
|
|
2116
|
+
return this._value;
|
|
2117
|
+
}
|
|
2118
|
+
peek() {
|
|
2119
|
+
if (this._dirty) this._recompute();
|
|
2120
|
+
return this._value;
|
|
2121
|
+
}
|
|
2122
|
+
subscribe(fn) {
|
|
2123
|
+
if (this._dirty) this._recompute();
|
|
2124
|
+
this._subscribers.add(fn);
|
|
2125
|
+
return () => {
|
|
2126
|
+
this._subscribers.delete(fn);
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
_addSource(src) {
|
|
2130
|
+
this._sources.add(src);
|
|
2131
|
+
}
|
|
2132
|
+
_removeConsumer(consumer) {
|
|
2133
|
+
this._consumers.delete(consumer);
|
|
2134
|
+
}
|
|
2135
|
+
_invalidate() {
|
|
2136
|
+
if (this._disposed) return;
|
|
2137
|
+
this._dirty = true;
|
|
2138
|
+
const newVal = this.peek();
|
|
2139
|
+
for (const sub of [...this._subscribers]) sub(newVal);
|
|
2140
|
+
for (const consumer of [...this._consumers]) consumer._invalidate();
|
|
2141
|
+
}
|
|
2142
|
+
_recompute() {
|
|
2143
|
+
for (const src of this._sources) src._removeConsumer(this);
|
|
2144
|
+
this._sources.clear();
|
|
2145
|
+
this._value = withConsumer(this, this._fn);
|
|
2146
|
+
this._dirty = false;
|
|
2147
|
+
}
|
|
2148
|
+
dispose() {
|
|
2149
|
+
this._disposed = true;
|
|
2150
|
+
for (const src of this._sources) src._removeConsumer(this);
|
|
2151
|
+
this._sources.clear();
|
|
2152
|
+
this._subscribers.clear();
|
|
2153
|
+
this._consumers.clear();
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* @internal DevTools inspection only. Live observers (subscribers plus
|
|
2157
|
+
* downstream consumers). Read-only.
|
|
2158
|
+
*/
|
|
2159
|
+
_observerCount() {
|
|
2160
|
+
return this._subscribers.size + this._consumers.size;
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
var Effect = class {
|
|
2164
|
+
_fn;
|
|
2165
|
+
_cleanup = void 0;
|
|
2166
|
+
_disposed = false;
|
|
2167
|
+
_sources = /* @__PURE__ */ new Set();
|
|
2168
|
+
constructor(fn) {
|
|
2169
|
+
this._fn = fn;
|
|
2170
|
+
this._run();
|
|
2171
|
+
}
|
|
2172
|
+
_addSource(src) {
|
|
2173
|
+
this._sources.add(src);
|
|
2174
|
+
}
|
|
2175
|
+
_invalidate() {
|
|
2176
|
+
if (this._disposed) return;
|
|
2177
|
+
this._run();
|
|
2178
|
+
}
|
|
2179
|
+
_run() {
|
|
2180
|
+
for (const src of this._sources) src._removeConsumer(this);
|
|
2181
|
+
this._sources.clear();
|
|
2182
|
+
if (typeof this._cleanup === "function") this._cleanup();
|
|
2183
|
+
const result = withConsumer(this, this._fn);
|
|
2184
|
+
this._cleanup = typeof result === "function" ? result : void 0;
|
|
2185
|
+
}
|
|
2186
|
+
dispose() {
|
|
2187
|
+
this._disposed = true;
|
|
2188
|
+
for (const src of this._sources) src._removeConsumer(this);
|
|
2189
|
+
this._sources.clear();
|
|
2190
|
+
if (typeof this._cleanup === "function") this._cleanup();
|
|
2191
|
+
this._cleanup = void 0;
|
|
2192
|
+
}
|
|
2193
|
+
};
|
|
2194
|
+
function signal(initial) {
|
|
2195
|
+
return new Signal(initial);
|
|
2196
|
+
}
|
|
2197
|
+
function derived(fn) {
|
|
2198
|
+
return new DerivedSignal(fn);
|
|
2199
|
+
}
|
|
2200
|
+
function effect(fn) {
|
|
2201
|
+
const e = new Effect(fn);
|
|
2202
|
+
return () => e.dispose();
|
|
2203
|
+
}
|
|
2204
|
+
|
|
1994
2205
|
// ../renderer/src/hydration-diagnostics.ts
|
|
1995
2206
|
function formatHydrationDiagnostic(d) {
|
|
1996
2207
|
const at = ` at ${d.path}`;
|
|
@@ -2070,6 +2281,27 @@ function hydrateNode(ctx, graphNode, domNode, path) {
|
|
|
2070
2281
|
}
|
|
2071
2282
|
return instance;
|
|
2072
2283
|
}
|
|
2284
|
+
case "code": {
|
|
2285
|
+
let codeEl = dom.firstChild(domNode);
|
|
2286
|
+
if (codeEl === null || dom.isTextNode(codeEl)) {
|
|
2287
|
+
const createdCode = dom.createElement("code");
|
|
2288
|
+
dom.appendChild(domNode, createdCode);
|
|
2289
|
+
codeEl = createdCode;
|
|
2290
|
+
}
|
|
2291
|
+
let textNode = dom.firstChild(codeEl);
|
|
2292
|
+
if (textNode === null || !dom.isTextNode(textNode)) {
|
|
2293
|
+
const created = dom.createTextNode(String(graphNode.getProp("text") ?? ""));
|
|
2294
|
+
dom.appendChild(codeEl, created);
|
|
2295
|
+
textNode = created;
|
|
2296
|
+
}
|
|
2297
|
+
const instance = new NodeInstance(graphNode, domNode);
|
|
2298
|
+
ctx.instances.set(graphNode.id, instance);
|
|
2299
|
+
wireEvents(dom, graph, graphNode, domNode, instance);
|
|
2300
|
+
if (graphNode.stateRefs.length !== 0) {
|
|
2301
|
+
wireSignalBindings(ctx, graphNode, instance, textUpdate(dom, domNode, textNode));
|
|
2302
|
+
}
|
|
2303
|
+
return instance;
|
|
2304
|
+
}
|
|
2073
2305
|
case "image":
|
|
2074
2306
|
case "link": {
|
|
2075
2307
|
const instance = new NodeInstance(graphNode, domNode);
|
|
@@ -2221,6 +2453,8 @@ function expectedTag(ctx, graphNode) {
|
|
|
2221
2453
|
return "img";
|
|
2222
2454
|
case "link":
|
|
2223
2455
|
return "a";
|
|
2456
|
+
case "code":
|
|
2457
|
+
return "pre";
|
|
2224
2458
|
case "button":
|
|
2225
2459
|
return "button";
|
|
2226
2460
|
default:
|
|
@@ -2930,188 +3164,6 @@ function resolveHead(config) {
|
|
|
2930
3164
|
return { entries };
|
|
2931
3165
|
}
|
|
2932
3166
|
|
|
2933
|
-
// ../state/src/signal.ts
|
|
2934
|
-
var _activeConsumer = null;
|
|
2935
|
-
function withConsumer(consumer, fn) {
|
|
2936
|
-
const prev = _activeConsumer;
|
|
2937
|
-
_activeConsumer = consumer;
|
|
2938
|
-
try {
|
|
2939
|
-
return fn();
|
|
2940
|
-
} finally {
|
|
2941
|
-
_activeConsumer = prev;
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
var _batchDepth = 0;
|
|
2945
|
-
var _pendingFlushes = /* @__PURE__ */ new Map();
|
|
2946
|
-
function _enqueueBatchFlush(sig, value) {
|
|
2947
|
-
_pendingFlushes.set(sig, { signal: sig, value });
|
|
2948
|
-
}
|
|
2949
|
-
var Signal = class {
|
|
2950
|
-
_value;
|
|
2951
|
-
_subscribers = /* @__PURE__ */ new Set();
|
|
2952
|
-
_consumers = /* @__PURE__ */ new Set();
|
|
2953
|
-
constructor(initial) {
|
|
2954
|
-
this._value = initial;
|
|
2955
|
-
}
|
|
2956
|
-
get() {
|
|
2957
|
-
if (_activeConsumer !== null) {
|
|
2958
|
-
this._consumers.add(_activeConsumer);
|
|
2959
|
-
_activeConsumer._addSource(this);
|
|
2960
|
-
}
|
|
2961
|
-
return this._value;
|
|
2962
|
-
}
|
|
2963
|
-
peek() {
|
|
2964
|
-
return this._value;
|
|
2965
|
-
}
|
|
2966
|
-
set(value) {
|
|
2967
|
-
if (Object.is(this._value, value)) return;
|
|
2968
|
-
this._value = value;
|
|
2969
|
-
if (_batchDepth > 0) {
|
|
2970
|
-
_enqueueBatchFlush(this, value);
|
|
2971
|
-
} else {
|
|
2972
|
-
this._flush(value);
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
update(fn) {
|
|
2976
|
-
this.set(fn(this._value));
|
|
2977
|
-
}
|
|
2978
|
-
subscribe(fn) {
|
|
2979
|
-
this._subscribers.add(fn);
|
|
2980
|
-
return () => {
|
|
2981
|
-
this._subscribers.delete(fn);
|
|
2982
|
-
};
|
|
2983
|
-
}
|
|
2984
|
-
_removeConsumer(consumer) {
|
|
2985
|
-
this._consumers.delete(consumer);
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* Called by the batch machinery after the batch has completed.
|
|
2989
|
-
* Notifies subscribers with the final coalesced value.
|
|
2990
|
-
*/
|
|
2991
|
-
_flushBatch(value) {
|
|
2992
|
-
this._flush(value);
|
|
2993
|
-
}
|
|
2994
|
-
_flush(value) {
|
|
2995
|
-
for (const sub of [...this._subscribers]) sub(value);
|
|
2996
|
-
for (const consumer of [...this._consumers]) consumer._invalidate();
|
|
2997
|
-
}
|
|
2998
|
-
/**
|
|
2999
|
-
* @internal DevTools inspection only. The number of live observers
|
|
3000
|
-
* (direct subscribers plus derived/effect consumers). Read-only; never
|
|
3001
|
-
* mutates reactive state.
|
|
3002
|
-
*/
|
|
3003
|
-
_observerCount() {
|
|
3004
|
-
return this._subscribers.size + this._consumers.size;
|
|
3005
|
-
}
|
|
3006
|
-
};
|
|
3007
|
-
var DerivedSignal = class {
|
|
3008
|
-
_value = void 0;
|
|
3009
|
-
_dirty = true;
|
|
3010
|
-
_disposed = false;
|
|
3011
|
-
_fn;
|
|
3012
|
-
_subscribers = /* @__PURE__ */ new Set();
|
|
3013
|
-
/** All upstream sources this derived currently reads from. */
|
|
3014
|
-
_sources = /* @__PURE__ */ new Set();
|
|
3015
|
-
/** Downstream consumers that depend on this derived. */
|
|
3016
|
-
_consumers = /* @__PURE__ */ new Set();
|
|
3017
|
-
constructor(fn) {
|
|
3018
|
-
this._fn = fn;
|
|
3019
|
-
}
|
|
3020
|
-
get() {
|
|
3021
|
-
if (_activeConsumer !== null) {
|
|
3022
|
-
this._consumers.add(_activeConsumer);
|
|
3023
|
-
_activeConsumer._addSource(this);
|
|
3024
|
-
}
|
|
3025
|
-
if (this._dirty) this._recompute();
|
|
3026
|
-
return this._value;
|
|
3027
|
-
}
|
|
3028
|
-
peek() {
|
|
3029
|
-
if (this._dirty) this._recompute();
|
|
3030
|
-
return this._value;
|
|
3031
|
-
}
|
|
3032
|
-
subscribe(fn) {
|
|
3033
|
-
if (this._dirty) this._recompute();
|
|
3034
|
-
this._subscribers.add(fn);
|
|
3035
|
-
return () => {
|
|
3036
|
-
this._subscribers.delete(fn);
|
|
3037
|
-
};
|
|
3038
|
-
}
|
|
3039
|
-
_addSource(src) {
|
|
3040
|
-
this._sources.add(src);
|
|
3041
|
-
}
|
|
3042
|
-
_removeConsumer(consumer) {
|
|
3043
|
-
this._consumers.delete(consumer);
|
|
3044
|
-
}
|
|
3045
|
-
_invalidate() {
|
|
3046
|
-
if (this._disposed) return;
|
|
3047
|
-
this._dirty = true;
|
|
3048
|
-
const newVal = this.peek();
|
|
3049
|
-
for (const sub of [...this._subscribers]) sub(newVal);
|
|
3050
|
-
for (const consumer of [...this._consumers]) consumer._invalidate();
|
|
3051
|
-
}
|
|
3052
|
-
_recompute() {
|
|
3053
|
-
for (const src of this._sources) src._removeConsumer(this);
|
|
3054
|
-
this._sources.clear();
|
|
3055
|
-
this._value = withConsumer(this, this._fn);
|
|
3056
|
-
this._dirty = false;
|
|
3057
|
-
}
|
|
3058
|
-
dispose() {
|
|
3059
|
-
this._disposed = true;
|
|
3060
|
-
for (const src of this._sources) src._removeConsumer(this);
|
|
3061
|
-
this._sources.clear();
|
|
3062
|
-
this._subscribers.clear();
|
|
3063
|
-
this._consumers.clear();
|
|
3064
|
-
}
|
|
3065
|
-
/**
|
|
3066
|
-
* @internal DevTools inspection only. Live observers (subscribers plus
|
|
3067
|
-
* downstream consumers). Read-only.
|
|
3068
|
-
*/
|
|
3069
|
-
_observerCount() {
|
|
3070
|
-
return this._subscribers.size + this._consumers.size;
|
|
3071
|
-
}
|
|
3072
|
-
};
|
|
3073
|
-
var Effect = class {
|
|
3074
|
-
_fn;
|
|
3075
|
-
_cleanup = void 0;
|
|
3076
|
-
_disposed = false;
|
|
3077
|
-
_sources = /* @__PURE__ */ new Set();
|
|
3078
|
-
constructor(fn) {
|
|
3079
|
-
this._fn = fn;
|
|
3080
|
-
this._run();
|
|
3081
|
-
}
|
|
3082
|
-
_addSource(src) {
|
|
3083
|
-
this._sources.add(src);
|
|
3084
|
-
}
|
|
3085
|
-
_invalidate() {
|
|
3086
|
-
if (this._disposed) return;
|
|
3087
|
-
this._run();
|
|
3088
|
-
}
|
|
3089
|
-
_run() {
|
|
3090
|
-
for (const src of this._sources) src._removeConsumer(this);
|
|
3091
|
-
this._sources.clear();
|
|
3092
|
-
if (typeof this._cleanup === "function") this._cleanup();
|
|
3093
|
-
const result = withConsumer(this, this._fn);
|
|
3094
|
-
this._cleanup = typeof result === "function" ? result : void 0;
|
|
3095
|
-
}
|
|
3096
|
-
dispose() {
|
|
3097
|
-
this._disposed = true;
|
|
3098
|
-
for (const src of this._sources) src._removeConsumer(this);
|
|
3099
|
-
this._sources.clear();
|
|
3100
|
-
if (typeof this._cleanup === "function") this._cleanup();
|
|
3101
|
-
this._cleanup = void 0;
|
|
3102
|
-
}
|
|
3103
|
-
};
|
|
3104
|
-
function signal(initial) {
|
|
3105
|
-
return new Signal(initial);
|
|
3106
|
-
}
|
|
3107
|
-
function derived(fn) {
|
|
3108
|
-
return new DerivedSignal(fn);
|
|
3109
|
-
}
|
|
3110
|
-
function effect(fn) {
|
|
3111
|
-
const e = new Effect(fn);
|
|
3112
|
-
return () => e.dispose();
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
3167
|
// ../dsl/src/builders.ts
|
|
3116
3168
|
function isSignal(v) {
|
|
3117
3169
|
return v !== null && typeof v === "object" && typeof v["get"] === "function" && typeof v["subscribe"] === "function";
|
|
@@ -3336,6 +3388,16 @@ var ContentBuilderBase = class {
|
|
|
3336
3388
|
node.addEvent({ type: "click", handlerKey });
|
|
3337
3389
|
}
|
|
3338
3390
|
}
|
|
3391
|
+
code(source, options = {}) {
|
|
3392
|
+
const props = {};
|
|
3393
|
+
if (options.language !== void 0) props["data-language"] = options.language;
|
|
3394
|
+
if (options.class !== void 0) props["class"] = options.class;
|
|
3395
|
+
if (options.id !== void 0) props["id"] = options.id;
|
|
3396
|
+
applyA11yProps(props, options);
|
|
3397
|
+
const node = this._graph.createNode("code", { parent: this._node, props });
|
|
3398
|
+
const resolved = bindValue(this._graph, node, "text", source);
|
|
3399
|
+
node.setProp("text", resolved);
|
|
3400
|
+
}
|
|
3339
3401
|
};
|
|
3340
3402
|
var ContainerBuilderBase = class extends ContentBuilderBase {
|
|
3341
3403
|
section(key, builder, options = {}) {
|
|
@@ -4072,7 +4134,7 @@ function trigger(el, type, init = {}) {
|
|
|
4072
4134
|
}
|
|
4073
4135
|
|
|
4074
4136
|
// src/version.ts
|
|
4075
|
-
var VERSION = "2.
|
|
4137
|
+
var VERSION = "2.7.0";
|
|
4076
4138
|
export {
|
|
4077
4139
|
VERSION,
|
|
4078
4140
|
analyzeGraph,
|