streetui 2.6.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/testing.cjs CHANGED
@@ -971,6 +971,13 @@ function applyProp(dom, element, name, value) {
971
971
  }
972
972
  return;
973
973
  }
974
+ if (name.startsWith("style.")) {
975
+ const el = element;
976
+ const prop = name.slice("style.".length);
977
+ if (value === null || value === void 0) el.style.removeProperty(prop);
978
+ else el.style.setProperty(prop, String(value));
979
+ return;
980
+ }
974
981
  if (value === null || value === void 0 || value === false) {
975
982
  dom.removeAttribute(element, name);
976
983
  return;
@@ -2063,6 +2070,188 @@ function wireComponentBehavior(ctx, graphNode, instance) {
2063
2070
  for (const cleanup of fn()) instance.trackCleanup(cleanup);
2064
2071
  }
2065
2072
 
2073
+ // ../state/src/signal.ts
2074
+ var _activeConsumer = null;
2075
+ function withConsumer(consumer, fn) {
2076
+ const prev = _activeConsumer;
2077
+ _activeConsumer = consumer;
2078
+ try {
2079
+ return fn();
2080
+ } finally {
2081
+ _activeConsumer = prev;
2082
+ }
2083
+ }
2084
+ var _batchDepth = 0;
2085
+ var _pendingFlushes = /* @__PURE__ */ new Map();
2086
+ function _enqueueBatchFlush(sig, value) {
2087
+ _pendingFlushes.set(sig, { signal: sig, value });
2088
+ }
2089
+ var Signal = class {
2090
+ _value;
2091
+ _subscribers = /* @__PURE__ */ new Set();
2092
+ _consumers = /* @__PURE__ */ new Set();
2093
+ constructor(initial) {
2094
+ this._value = initial;
2095
+ }
2096
+ get() {
2097
+ if (_activeConsumer !== null) {
2098
+ this._consumers.add(_activeConsumer);
2099
+ _activeConsumer._addSource(this);
2100
+ }
2101
+ return this._value;
2102
+ }
2103
+ peek() {
2104
+ return this._value;
2105
+ }
2106
+ set(value) {
2107
+ if (Object.is(this._value, value)) return;
2108
+ this._value = value;
2109
+ if (_batchDepth > 0) {
2110
+ _enqueueBatchFlush(this, value);
2111
+ } else {
2112
+ this._flush(value);
2113
+ }
2114
+ }
2115
+ update(fn) {
2116
+ this.set(fn(this._value));
2117
+ }
2118
+ subscribe(fn) {
2119
+ this._subscribers.add(fn);
2120
+ return () => {
2121
+ this._subscribers.delete(fn);
2122
+ };
2123
+ }
2124
+ _removeConsumer(consumer) {
2125
+ this._consumers.delete(consumer);
2126
+ }
2127
+ /**
2128
+ * Called by the batch machinery after the batch has completed.
2129
+ * Notifies subscribers with the final coalesced value.
2130
+ */
2131
+ _flushBatch(value) {
2132
+ this._flush(value);
2133
+ }
2134
+ _flush(value) {
2135
+ for (const sub of [...this._subscribers]) sub(value);
2136
+ for (const consumer of [...this._consumers]) consumer._invalidate();
2137
+ }
2138
+ /**
2139
+ * @internal DevTools inspection only. The number of live observers
2140
+ * (direct subscribers plus derived/effect consumers). Read-only; never
2141
+ * mutates reactive state.
2142
+ */
2143
+ _observerCount() {
2144
+ return this._subscribers.size + this._consumers.size;
2145
+ }
2146
+ };
2147
+ var DerivedSignal = class {
2148
+ _value = void 0;
2149
+ _dirty = true;
2150
+ _disposed = false;
2151
+ _fn;
2152
+ _subscribers = /* @__PURE__ */ new Set();
2153
+ /** All upstream sources this derived currently reads from. */
2154
+ _sources = /* @__PURE__ */ new Set();
2155
+ /** Downstream consumers that depend on this derived. */
2156
+ _consumers = /* @__PURE__ */ new Set();
2157
+ constructor(fn) {
2158
+ this._fn = fn;
2159
+ }
2160
+ get() {
2161
+ if (_activeConsumer !== null) {
2162
+ this._consumers.add(_activeConsumer);
2163
+ _activeConsumer._addSource(this);
2164
+ }
2165
+ if (this._dirty) this._recompute();
2166
+ return this._value;
2167
+ }
2168
+ peek() {
2169
+ if (this._dirty) this._recompute();
2170
+ return this._value;
2171
+ }
2172
+ subscribe(fn) {
2173
+ if (this._dirty) this._recompute();
2174
+ this._subscribers.add(fn);
2175
+ return () => {
2176
+ this._subscribers.delete(fn);
2177
+ };
2178
+ }
2179
+ _addSource(src) {
2180
+ this._sources.add(src);
2181
+ }
2182
+ _removeConsumer(consumer) {
2183
+ this._consumers.delete(consumer);
2184
+ }
2185
+ _invalidate() {
2186
+ if (this._disposed) return;
2187
+ this._dirty = true;
2188
+ const newVal = this.peek();
2189
+ for (const sub of [...this._subscribers]) sub(newVal);
2190
+ for (const consumer of [...this._consumers]) consumer._invalidate();
2191
+ }
2192
+ _recompute() {
2193
+ for (const src of this._sources) src._removeConsumer(this);
2194
+ this._sources.clear();
2195
+ this._value = withConsumer(this, this._fn);
2196
+ this._dirty = false;
2197
+ }
2198
+ dispose() {
2199
+ this._disposed = true;
2200
+ for (const src of this._sources) src._removeConsumer(this);
2201
+ this._sources.clear();
2202
+ this._subscribers.clear();
2203
+ this._consumers.clear();
2204
+ }
2205
+ /**
2206
+ * @internal DevTools inspection only. Live observers (subscribers plus
2207
+ * downstream consumers). Read-only.
2208
+ */
2209
+ _observerCount() {
2210
+ return this._subscribers.size + this._consumers.size;
2211
+ }
2212
+ };
2213
+ var Effect = class {
2214
+ _fn;
2215
+ _cleanup = void 0;
2216
+ _disposed = false;
2217
+ _sources = /* @__PURE__ */ new Set();
2218
+ constructor(fn) {
2219
+ this._fn = fn;
2220
+ this._run();
2221
+ }
2222
+ _addSource(src) {
2223
+ this._sources.add(src);
2224
+ }
2225
+ _invalidate() {
2226
+ if (this._disposed) return;
2227
+ this._run();
2228
+ }
2229
+ _run() {
2230
+ for (const src of this._sources) src._removeConsumer(this);
2231
+ this._sources.clear();
2232
+ if (typeof this._cleanup === "function") this._cleanup();
2233
+ const result = withConsumer(this, this._fn);
2234
+ this._cleanup = typeof result === "function" ? result : void 0;
2235
+ }
2236
+ dispose() {
2237
+ this._disposed = true;
2238
+ for (const src of this._sources) src._removeConsumer(this);
2239
+ this._sources.clear();
2240
+ if (typeof this._cleanup === "function") this._cleanup();
2241
+ this._cleanup = void 0;
2242
+ }
2243
+ };
2244
+ function signal(initial) {
2245
+ return new Signal(initial);
2246
+ }
2247
+ function derived(fn) {
2248
+ return new DerivedSignal(fn);
2249
+ }
2250
+ function effect(fn) {
2251
+ const e = new Effect(fn);
2252
+ return () => e.dispose();
2253
+ }
2254
+
2066
2255
  // ../renderer/src/hydration-diagnostics.ts
2067
2256
  function formatHydrationDiagnostic(d) {
2068
2257
  const at = ` at ${d.path}`;
@@ -3025,188 +3214,6 @@ function resolveHead(config) {
3025
3214
  return { entries };
3026
3215
  }
3027
3216
 
3028
- // ../state/src/signal.ts
3029
- var _activeConsumer = null;
3030
- function withConsumer(consumer, fn) {
3031
- const prev = _activeConsumer;
3032
- _activeConsumer = consumer;
3033
- try {
3034
- return fn();
3035
- } finally {
3036
- _activeConsumer = prev;
3037
- }
3038
- }
3039
- var _batchDepth = 0;
3040
- var _pendingFlushes = /* @__PURE__ */ new Map();
3041
- function _enqueueBatchFlush(sig, value) {
3042
- _pendingFlushes.set(sig, { signal: sig, value });
3043
- }
3044
- var Signal = class {
3045
- _value;
3046
- _subscribers = /* @__PURE__ */ new Set();
3047
- _consumers = /* @__PURE__ */ new Set();
3048
- constructor(initial) {
3049
- this._value = initial;
3050
- }
3051
- get() {
3052
- if (_activeConsumer !== null) {
3053
- this._consumers.add(_activeConsumer);
3054
- _activeConsumer._addSource(this);
3055
- }
3056
- return this._value;
3057
- }
3058
- peek() {
3059
- return this._value;
3060
- }
3061
- set(value) {
3062
- if (Object.is(this._value, value)) return;
3063
- this._value = value;
3064
- if (_batchDepth > 0) {
3065
- _enqueueBatchFlush(this, value);
3066
- } else {
3067
- this._flush(value);
3068
- }
3069
- }
3070
- update(fn) {
3071
- this.set(fn(this._value));
3072
- }
3073
- subscribe(fn) {
3074
- this._subscribers.add(fn);
3075
- return () => {
3076
- this._subscribers.delete(fn);
3077
- };
3078
- }
3079
- _removeConsumer(consumer) {
3080
- this._consumers.delete(consumer);
3081
- }
3082
- /**
3083
- * Called by the batch machinery after the batch has completed.
3084
- * Notifies subscribers with the final coalesced value.
3085
- */
3086
- _flushBatch(value) {
3087
- this._flush(value);
3088
- }
3089
- _flush(value) {
3090
- for (const sub of [...this._subscribers]) sub(value);
3091
- for (const consumer of [...this._consumers]) consumer._invalidate();
3092
- }
3093
- /**
3094
- * @internal DevTools inspection only. The number of live observers
3095
- * (direct subscribers plus derived/effect consumers). Read-only; never
3096
- * mutates reactive state.
3097
- */
3098
- _observerCount() {
3099
- return this._subscribers.size + this._consumers.size;
3100
- }
3101
- };
3102
- var DerivedSignal = class {
3103
- _value = void 0;
3104
- _dirty = true;
3105
- _disposed = false;
3106
- _fn;
3107
- _subscribers = /* @__PURE__ */ new Set();
3108
- /** All upstream sources this derived currently reads from. */
3109
- _sources = /* @__PURE__ */ new Set();
3110
- /** Downstream consumers that depend on this derived. */
3111
- _consumers = /* @__PURE__ */ new Set();
3112
- constructor(fn) {
3113
- this._fn = fn;
3114
- }
3115
- get() {
3116
- if (_activeConsumer !== null) {
3117
- this._consumers.add(_activeConsumer);
3118
- _activeConsumer._addSource(this);
3119
- }
3120
- if (this._dirty) this._recompute();
3121
- return this._value;
3122
- }
3123
- peek() {
3124
- if (this._dirty) this._recompute();
3125
- return this._value;
3126
- }
3127
- subscribe(fn) {
3128
- if (this._dirty) this._recompute();
3129
- this._subscribers.add(fn);
3130
- return () => {
3131
- this._subscribers.delete(fn);
3132
- };
3133
- }
3134
- _addSource(src) {
3135
- this._sources.add(src);
3136
- }
3137
- _removeConsumer(consumer) {
3138
- this._consumers.delete(consumer);
3139
- }
3140
- _invalidate() {
3141
- if (this._disposed) return;
3142
- this._dirty = true;
3143
- const newVal = this.peek();
3144
- for (const sub of [...this._subscribers]) sub(newVal);
3145
- for (const consumer of [...this._consumers]) consumer._invalidate();
3146
- }
3147
- _recompute() {
3148
- for (const src of this._sources) src._removeConsumer(this);
3149
- this._sources.clear();
3150
- this._value = withConsumer(this, this._fn);
3151
- this._dirty = false;
3152
- }
3153
- dispose() {
3154
- this._disposed = true;
3155
- for (const src of this._sources) src._removeConsumer(this);
3156
- this._sources.clear();
3157
- this._subscribers.clear();
3158
- this._consumers.clear();
3159
- }
3160
- /**
3161
- * @internal DevTools inspection only. Live observers (subscribers plus
3162
- * downstream consumers). Read-only.
3163
- */
3164
- _observerCount() {
3165
- return this._subscribers.size + this._consumers.size;
3166
- }
3167
- };
3168
- var Effect = class {
3169
- _fn;
3170
- _cleanup = void 0;
3171
- _disposed = false;
3172
- _sources = /* @__PURE__ */ new Set();
3173
- constructor(fn) {
3174
- this._fn = fn;
3175
- this._run();
3176
- }
3177
- _addSource(src) {
3178
- this._sources.add(src);
3179
- }
3180
- _invalidate() {
3181
- if (this._disposed) return;
3182
- this._run();
3183
- }
3184
- _run() {
3185
- for (const src of this._sources) src._removeConsumer(this);
3186
- this._sources.clear();
3187
- if (typeof this._cleanup === "function") this._cleanup();
3188
- const result = withConsumer(this, this._fn);
3189
- this._cleanup = typeof result === "function" ? result : void 0;
3190
- }
3191
- dispose() {
3192
- this._disposed = true;
3193
- for (const src of this._sources) src._removeConsumer(this);
3194
- this._sources.clear();
3195
- if (typeof this._cleanup === "function") this._cleanup();
3196
- this._cleanup = void 0;
3197
- }
3198
- };
3199
- function signal(initial) {
3200
- return new Signal(initial);
3201
- }
3202
- function derived(fn) {
3203
- return new DerivedSignal(fn);
3204
- }
3205
- function effect(fn) {
3206
- const e = new Effect(fn);
3207
- return () => e.dispose();
3208
- }
3209
-
3210
3217
  // ../dsl/src/builders.ts
3211
3218
  function isSignal(v) {
3212
3219
  return v !== null && typeof v === "object" && typeof v["get"] === "function" && typeof v["subscribe"] === "function";
@@ -4177,7 +4184,7 @@ function trigger(el, type, init = {}) {
4177
4184
  }
4178
4185
 
4179
4186
  // src/version.ts
4180
- var VERSION = "2.6.0";
4187
+ var VERSION = "2.7.0";
4181
4188
  // Annotate the CommonJS export names for ESM import in node:
4182
4189
  0 && (module.exports = {
4183
4190
  VERSION,