sygnal 5.3.1 → 5.3.2

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/index.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var xs$1 = require('xstream');
3
+ var xs$2 = require('xstream');
4
4
  var dropRepeatsModule = require('xstream/extra/dropRepeats.js');
5
5
  var concat$1 = require('xstream/extra/concat.js');
6
6
  var h_js = require('snabbdom/build/h.js');
@@ -34,7 +34,7 @@ function _interopNamespaceDefault(e) {
34
34
  return Object.freeze(n);
35
35
  }
36
36
 
37
- var xs__namespace = /*#__PURE__*/_interopNamespaceDefault(xs$1);
37
+ var xs__namespace = /*#__PURE__*/_interopNamespaceDefault(xs$2);
38
38
  var dropRepeatsModule__namespace = /*#__PURE__*/_interopNamespaceDefault(dropRepeatsModule);
39
39
  var concat__namespace = /*#__PURE__*/_interopNamespaceDefault(concat$1);
40
40
  var delayModule__namespace = /*#__PURE__*/_interopNamespaceDefault(delayModule);
@@ -115,7 +115,7 @@ function isolateAllSinks(sources, innerSinks, scopes) {
115
115
  source &&
116
116
  scopes[channel] !== null &&
117
117
  typeof source.isolateSink === 'function') {
118
- outerSinks[channel] = adapt(source.isolateSink(xs$1.fromObservable(innerSink), scopes[channel]));
118
+ outerSinks[channel] = adapt(source.isolateSink(xs$2.fromObservable(innerSink), scopes[channel]));
119
119
  }
120
120
  else if (Object.prototype.hasOwnProperty.call(innerSinks, channel)) {
121
121
  outerSinks[channel] = innerSinks[channel];
@@ -302,7 +302,7 @@ class PickMerge {
302
302
  for (let i = 0; i < n; ++i) {
303
303
  const sinks = arrSinks[i];
304
304
  const key = sinks._key;
305
- const sink = xs$1.fromObservable(sinks[sel] || xs$1.never());
305
+ const sink = xs$2.fromObservable(sinks[sel] || xs$2.never());
306
306
  if (!ils.has(key)) {
307
307
  ils.set(key, new PickMergeListener(out, this, sink));
308
308
  sink._add(ils.get(key));
@@ -335,7 +335,7 @@ class PickMerge {
335
335
  }
336
336
  function pickMerge(selector) {
337
337
  return function pickMergeOperator(inst$) {
338
- return new xs$1.Stream(new PickMerge(selector, inst$));
338
+ return new xs$2.Stream(new PickMerge(selector, inst$));
339
339
  };
340
340
  }
341
341
 
@@ -344,7 +344,7 @@ class PickCombineListener {
344
344
  this.key = key;
345
345
  this.out = out;
346
346
  this.p = p;
347
- this.val = xs$1.NO;
347
+ this.val = xs$2.NO;
348
348
  this.ins = ins;
349
349
  }
350
350
  _n(t) {
@@ -403,7 +403,7 @@ class PickCombine {
403
403
  return;
404
404
  }
405
405
  const val = ils.get(key).val;
406
- if (val === xs$1.NO) {
406
+ if (val === xs$2.NO) {
407
407
  return;
408
408
  }
409
409
  outArr[i] = val;
@@ -441,7 +441,7 @@ class PickCombine {
441
441
  if (!sinks[sel]) {
442
442
  throw new Error('pickCombine found an undefined child sink stream');
443
443
  }
444
- const sink = xs$1.fromObservable(sinks[sel]);
444
+ const sink = xs$2.fromObservable(sinks[sel]);
445
445
  if (!ils.has(key)) {
446
446
  ils.set(key, new PickCombineListener(key, out, this, sink));
447
447
  sink._add(ils.get(key));
@@ -468,7 +468,7 @@ class PickCombine {
468
468
  }
469
469
  function pickCombine(selector) {
470
470
  return function pickCombineOperator(inst$) {
471
- return new xs$1.Stream(new PickCombine(selector, inst$));
471
+ return new xs$2.Stream(new PickCombine(selector, inst$));
472
472
  };
473
473
  }
474
474
 
@@ -534,7 +534,7 @@ function makeCollection(opts) {
534
534
  const name = opts.channel || 'state';
535
535
  const itemKey = opts.itemKey;
536
536
  const itemScope = opts.itemScope || defaultItemScope;
537
- const state$ = xs$1.fromObservable(sources[name].stream);
537
+ const state$ = xs$2.fromObservable(sources[name].stream);
538
538
  const instances$ = state$.fold((acc, nextState) => {
539
539
  const dict = acc.dict;
540
540
  if (Array.isArray(nextState)) {
@@ -600,7 +600,7 @@ function makeCollection(opts) {
600
600
 
601
601
  function withState(main, name = 'state') {
602
602
  return function mainWithState(sources) {
603
- const reducerMimic$ = xs$1.create();
603
+ const reducerMimic$ = xs$2.create();
604
604
  const state$ = reducerMimic$
605
605
  .fold((state, reducer) => reducer(state), void 0)
606
606
  .drop(1);
@@ -608,7 +608,7 @@ function withState(main, name = 'state') {
608
608
  innerSources[name] = new StateSource(state$, name);
609
609
  const sinks = main(innerSources);
610
610
  if (sinks[name]) {
611
- const stream$ = concat$1(xs$1.fromObservable(sinks[name]), xs$1.never());
611
+ const stream$ = concat$1(xs$2.fromObservable(sinks[name]), xs$2.never());
612
612
  stream$.subscribe({
613
613
  next: i => queueMicrotask(() => reducerMimic$._n(i)),
614
614
  error: err => queueMicrotask(() => reducerMimic$._e(err)),
@@ -679,7 +679,7 @@ function thunk(sel, key, fn, args) {
679
679
 
680
680
  function fromEvent(element, eventName, useCapture = false, preventDefault = false, passive = false) {
681
681
  let next = null;
682
- return xs$1.Stream.create({
682
+ return xs$2.Stream.create({
683
683
  start: function start(listener) {
684
684
  if (preventDefault) {
685
685
  next = function _next(event) {
@@ -808,21 +808,21 @@ class DocumentDOMSource {
808
808
  }
809
809
  elements() {
810
810
  if (this._selector) {
811
- const out = adapt(xs$1.of(Array.from(document.querySelectorAll(this._selector))));
811
+ const out = adapt(xs$2.of(Array.from(document.querySelectorAll(this._selector))));
812
812
  out._isCycleSource = this._name;
813
813
  return out;
814
814
  }
815
- const out = adapt(xs$1.of([document]));
815
+ const out = adapt(xs$2.of([document]));
816
816
  out._isCycleSource = this._name;
817
817
  return out;
818
818
  }
819
819
  element() {
820
820
  if (this._selector) {
821
- const out = adapt(xs$1.of(document.querySelector(this._selector)));
821
+ const out = adapt(xs$2.of(document.querySelector(this._selector)));
822
822
  out._isCycleSource = this._name;
823
823
  return out;
824
824
  }
825
- const out = adapt(xs$1.of(document));
825
+ const out = adapt(xs$2.of(document));
826
826
  out._isCycleSource = this._name;
827
827
  return out;
828
828
  }
@@ -852,12 +852,12 @@ class BodyDOMSource {
852
852
  return this;
853
853
  }
854
854
  elements() {
855
- const out = adapt(xs$1.of([document.body]));
855
+ const out = adapt(xs$2.of([document.body]));
856
856
  out._isCycleSource = this._name;
857
857
  return out;
858
858
  }
859
859
  element() {
860
- const out = adapt(xs$1.of(document.body));
860
+ const out = adapt(xs$2.of(document.body));
861
861
  out._isCycleSource = this._name;
862
862
  return out;
863
863
  }
@@ -1540,7 +1540,7 @@ class EventDelegator {
1540
1540
  });
1541
1541
  }
1542
1542
  addEventListener(eventType, namespace, options, bubbles) {
1543
- const subject = xs$1.never();
1543
+ const subject = xs$2.never();
1544
1544
  let dest;
1545
1545
  const scopeChecker = new ScopeChecker(namespace, this.isolateModule);
1546
1546
  const shouldBubble = bubbles === undefined
@@ -1583,7 +1583,7 @@ class EventDelegator {
1583
1583
  }
1584
1584
  const self = this;
1585
1585
  let subscription = null;
1586
- return xs$1.create({
1586
+ return xs$2.create({
1587
1587
  start: listener => {
1588
1588
  subscription = nonBubbleSubject.subscribe(listener);
1589
1589
  },
@@ -1837,7 +1837,7 @@ function domDriverInputGuard(view$) {
1837
1837
  }
1838
1838
  }
1839
1839
  function dropCompletion(input) {
1840
- return xs$1.merge(input, xs$1.never());
1840
+ return xs$2.merge(input, xs$2.never());
1841
1841
  }
1842
1842
  function unwrapElementFromVNode(vnode) {
1843
1843
  return vnode.elm;
@@ -1846,7 +1846,7 @@ function defaultReportSnabbdomError(err) {
1846
1846
  (console.error || console.log)(err);
1847
1847
  }
1848
1848
  function makeDOMReady$() {
1849
- return xs$1.create({
1849
+ return xs$2.create({
1850
1850
  start(lis) {
1851
1851
  if (document.readyState === 'loading') {
1852
1852
  document.addEventListener('readystatechange', () => {
@@ -1880,7 +1880,7 @@ function makeDOMDriver(container, options = {}) {
1880
1880
  const domReady$ = makeDOMReady$();
1881
1881
  let vnodeWrapper;
1882
1882
  let mutationObserver;
1883
- const mutationConfirmed$ = xs$1.create({
1883
+ const mutationConfirmed$ = xs$2.create({
1884
1884
  start(listener) {
1885
1885
  mutationObserver = new MutationObserver(() => listener.next(null));
1886
1886
  },
@@ -1890,7 +1890,7 @@ function makeDOMDriver(container, options = {}) {
1890
1890
  });
1891
1891
  function DOMDriver(vnode$, name = 'DOM') {
1892
1892
  domDriverInputGuard(vnode$);
1893
- const sanitation$ = xs$1.create();
1893
+ const sanitation$ = xs$2.create();
1894
1894
  const firstRoot$ = domReady$.map(() => {
1895
1895
  const firstRoot = getValidNode(container) || document.body;
1896
1896
  vnodeWrapper = new VNodeWrapper(firstRoot);
@@ -1900,7 +1900,7 @@ function makeDOMDriver(container, options = {}) {
1900
1900
  rememberedVNode$.addListener({});
1901
1901
  mutationConfirmed$.addListener({});
1902
1902
  const elementAfterPatch$ = firstRoot$
1903
- .map(firstRoot => xs$1
1903
+ .map(firstRoot => xs$2
1904
1904
  .merge(rememberedVNode$.endWhen(sanitation$), sanitation$)
1905
1905
  .map(vnode => vnodeWrapper.call(vnode))
1906
1906
  .startWith(addRootScope(tovnode_js.toVNode(firstRoot)))
@@ -1943,7 +1943,7 @@ class MockedDOMSource {
1943
1943
  this._elements = _mockConfig.elements;
1944
1944
  }
1945
1945
  else {
1946
- this._elements = adapt(xs$1.empty());
1946
+ this._elements = adapt(xs$2.empty());
1947
1947
  }
1948
1948
  }
1949
1949
  elements() {
@@ -1963,7 +1963,7 @@ class MockedDOMSource {
1963
1963
  }
1964
1964
  events(eventType, options, bubbles) {
1965
1965
  const streamForEventType = this._mockConfig[eventType];
1966
- const out = adapt(streamForEventType || xs$1.empty());
1966
+ const out = adapt(streamForEventType || xs$2.empty());
1967
1967
  out._isCycleSource = 'MockedDOM';
1968
1968
  return out;
1969
1969
  }
@@ -1975,7 +1975,7 @@ class MockedDOMSource {
1975
1975
  return source.select('.' + SCOPE_PREFIX + scope);
1976
1976
  }
1977
1977
  isolateSink(sink, scope) {
1978
- return adapt(xs$1.fromObservable(sink).map((vnode) => {
1978
+ return adapt(xs$2.fromObservable(sink).map((vnode) => {
1979
1979
  if (vnode.sel && vnode.sel.indexOf(SCOPE_PREFIX + scope) !== -1) {
1980
1980
  return vnode;
1981
1981
  }
@@ -2070,10 +2070,10 @@ function getXs(namespaceValue) {
2070
2070
  }
2071
2071
  return value;
2072
2072
  }
2073
- const xs = getXs(xs__namespace);
2073
+ const xs$1 = getXs(xs__namespace);
2074
2074
  const Stream = xs__namespace.Stream ||
2075
2075
  (xs__namespace.default && xs__namespace.default.Stream) ||
2076
- (xs && xs.Stream);
2076
+ (xs$1 && xs$1.Stream);
2077
2077
 
2078
2078
  const dropRepeats$1 = resolveInteropDefault(dropRepeatsModule__namespace);
2079
2079
  function switchable(factories, name$, initial, opts = {}) {
@@ -2119,7 +2119,7 @@ function _switchable(factories, sources, name$, switched = ['DOM'], stateSourceN
2119
2119
  const sinks = Object.entries(factories).map(([name, factory]) => {
2120
2120
  if (sources[stateSourceName]) {
2121
2121
  const state$ = sources[stateSourceName].stream;
2122
- const switchedState = xs
2122
+ const switchedState = xs$1
2123
2123
  .combine(name$, state$)
2124
2124
  .filter(([newComponentName]) => newComponentName == name)
2125
2125
  .map(([, state]) => state)
@@ -2134,7 +2134,7 @@ function _switchable(factories, sources, name$, switched = ['DOM'], stateSourceN
2134
2134
  obj[sinkName] = name$
2135
2135
  .map((newComponentName) => {
2136
2136
  const sink = sinks.find(([componentName]) => componentName === newComponentName);
2137
- return (sink && sink[1][sinkName]) || xs.never();
2137
+ return (sink && sink[1][sinkName]) || xs$1.never();
2138
2138
  })
2139
2139
  .flatten()
2140
2140
  .remember()
@@ -2144,7 +2144,7 @@ function _switchable(factories, sources, name$, switched = ['DOM'], stateSourceN
2144
2144
  const definedSinks = sinks
2145
2145
  .filter(([, sink]) => sink[sinkName] !== undefined)
2146
2146
  .map(([, sink]) => sink[sinkName]);
2147
- obj[sinkName] = xs.merge(...definedSinks);
2147
+ obj[sinkName] = xs$1.merge(...definedSinks);
2148
2148
  }
2149
2149
  return obj;
2150
2150
  }, {});
@@ -2159,7 +2159,7 @@ Switchable.preventInstantiation = true;
2159
2159
 
2160
2160
  function createCommand() {
2161
2161
  const listener = { next: () => { } };
2162
- const _stream = xs.create({
2162
+ const _stream = xs$1.create({
2163
2163
  start(l) { listener.next = (val) => l.next(val); },
2164
2164
  stop() { listener.next = () => { }; },
2165
2165
  });
@@ -2455,7 +2455,7 @@ class Component {
2455
2455
  // This is necessary to ensure that the component tree's state sink is subscribed to
2456
2456
  if (!this.isSubComponent && typeof this.intent === 'undefined' && typeof this.model === 'undefined') {
2457
2457
  this.initialState = initialState || true;
2458
- this.intent = (_) => ({ __NOOP_ACTION__: xs.never() });
2458
+ this.intent = (_) => ({ __NOOP_ACTION__: xs$1.never() });
2459
2459
  this.model = {
2460
2460
  __NOOP_ACTION__: (state) => state
2461
2461
  };
@@ -2464,12 +2464,12 @@ class Component {
2464
2464
  this._activeSubComponents = new Map();
2465
2465
  this._childReadyState = {};
2466
2466
  this._readyChangedListener = null;
2467
- this._readyChanged$ = xs.create({
2467
+ this._readyChanged$ = xs$1.create({
2468
2468
  start: (listener) => { this._readyChangedListener = listener; },
2469
2469
  stop: () => { },
2470
2470
  });
2471
2471
  this._disposeListener = null;
2472
- this._dispose$ = xs.create({
2472
+ this._dispose$ = xs$1.create({
2473
2473
  start: (listener) => { this._disposeListener = listener; },
2474
2474
  stop: () => { },
2475
2475
  });
@@ -2572,7 +2572,7 @@ class Component {
2572
2572
  }
2573
2573
  initHmrActions() {
2574
2574
  if (typeof this.hmrActions === 'undefined') {
2575
- this.hmrAction$ = xs.of().filter((_) => false);
2575
+ this.hmrAction$ = xs$1.of().filter((_) => false);
2576
2576
  return;
2577
2577
  }
2578
2578
  if (typeof this.hmrActions === 'string') {
@@ -2584,12 +2584,12 @@ class Component {
2584
2584
  if (this.hmrActions.some(action => typeof action !== 'string')) {
2585
2585
  throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);
2586
2586
  }
2587
- this.hmrAction$ = xs.fromArray(this.hmrActions.map(action => ({ type: action })));
2587
+ this.hmrAction$ = xs$1.fromArray(this.hmrActions.map(action => ({ type: action })));
2588
2588
  }
2589
2589
  initAction$() {
2590
2590
  const requestSource = (this.sources && this.sources[this.requestSourceName]) || null;
2591
2591
  if (!this.intent$) {
2592
- this.action$ = xs.never();
2592
+ this.action$ = xs$1.never();
2593
2593
  return;
2594
2594
  }
2595
2595
  let runner;
@@ -2605,23 +2605,23 @@ class Component {
2605
2605
  }
2606
2606
  const mapped = Object.entries(this.intent$)
2607
2607
  .map(([type, data$]) => data$.map((data) => ({ type, data })));
2608
- runner = xs.merge(xs.never(), ...mapped);
2608
+ runner = xs$1.merge(xs$1.never(), ...mapped);
2609
2609
  }
2610
- const action$ = ((runner instanceof Stream) ? runner : (runner.apply && runner(this.sources) || xs.never()));
2611
- const bootstrap$ = xs.of({ type: BOOTSTRAP_ACTION }).compose(delay(10));
2610
+ const action$ = ((runner instanceof Stream) ? runner : (runner.apply && runner(this.sources) || xs$1.never()));
2611
+ const bootstrap$ = xs$1.of({ type: BOOTSTRAP_ACTION }).compose(delay(10));
2612
2612
  const _hmrUpdating = typeof window !== 'undefined' && window.__SYGNAL_HMR_UPDATING === true;
2613
- const hmrAction$ = _hmrUpdating ? this.hmrAction$ : xs.of().filter((_) => false);
2614
- const wrapped$ = (this.model[BOOTSTRAP_ACTION] && !_hmrUpdating) ? concat(bootstrap$, action$) : concat(xs.of().compose(delay(1)).filter((_) => false), hmrAction$, action$);
2613
+ const hmrAction$ = _hmrUpdating ? this.hmrAction$ : xs$1.of().filter((_) => false);
2614
+ const wrapped$ = (this.model[BOOTSTRAP_ACTION] && !_hmrUpdating) ? concat(bootstrap$, action$) : concat(xs$1.of().compose(delay(1)).filter((_) => false), hmrAction$, action$);
2615
2615
  let initialApiData;
2616
2616
  if (!_hmrUpdating && requestSource && typeof requestSource.select == 'function') {
2617
2617
  initialApiData = requestSource.select('initial')
2618
2618
  .flatten();
2619
2619
  }
2620
2620
  else {
2621
- initialApiData = xs.never();
2621
+ initialApiData = xs$1.never();
2622
2622
  }
2623
2623
  const hydrate$ = initialApiData.map((data) => ({ type: HYDRATE_ACTION, data }));
2624
- this.action$ = xs.merge(wrapped$, hydrate$)
2624
+ this.action$ = xs$1.merge(wrapped$, hydrate$)
2625
2625
  .compose(this.log(({ type }) => `<${type}> Action triggered`))
2626
2626
  .map((action) => {
2627
2627
  if (typeof window !== 'undefined' && window.__SYGNAL_DEVTOOLS__?.connected) {
@@ -2649,15 +2649,15 @@ class Component {
2649
2649
  }
2650
2650
  initContext() {
2651
2651
  if (!this.context && !this.sources.__parentContext$) {
2652
- this.context$ = xs.of({});
2652
+ this.context$ = xs$1.of({});
2653
2653
  return;
2654
2654
  }
2655
- const state$ = this.sources[this.stateSourceName]?.stream.startWith({}).compose(dropRepeats(objIsEqual)) || xs.never();
2656
- const parentContext$ = this.sources.__parentContext$?.startWith({}).compose(dropRepeats(objIsEqual)) || xs.of({});
2655
+ const state$ = this.sources[this.stateSourceName]?.stream.startWith({}).compose(dropRepeats(objIsEqual)) || xs$1.never();
2656
+ const parentContext$ = this.sources.__parentContext$?.startWith({}).compose(dropRepeats(objIsEqual)) || xs$1.of({});
2657
2657
  if (this.context && !isObj(this.context)) {
2658
2658
  console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`);
2659
2659
  }
2660
- this.context$ = xs.combine(state$, parentContext$)
2660
+ this.context$ = xs$1.combine(state$, parentContext$)
2661
2661
  .map(([_, parent]) => {
2662
2662
  const _parent = isObj(parent) ? parent : {};
2663
2663
  const context = isObj(this.context) ? this.context : {};
@@ -2696,7 +2696,7 @@ class Component {
2696
2696
  initModel$() {
2697
2697
  if (typeof this.model == 'undefined') {
2698
2698
  this.model$ = this.sourceNames.reduce((a, s) => {
2699
- a[s] = xs.never();
2699
+ a[s] = xs$1.never();
2700
2700
  return a;
2701
2701
  }, {});
2702
2702
  return;
@@ -2709,7 +2709,7 @@ class Component {
2709
2709
  }
2710
2710
  const hasInitialState = (typeof effectiveInitialState !== 'undefined');
2711
2711
  const shouldInjectInitialState = hasInitialState && (ENVIRONMENT?.__SYGNAL_HMR_UPDATING !== true || typeof hmrState !== 'undefined');
2712
- const shimmed$ = shouldInjectInitialState ? concat(xs.of(initial), this.action$).compose(delay(0)) : this.action$;
2712
+ const shimmed$ = shouldInjectInitialState ? concat(xs$1.of(initial), this.action$).compose(delay(0)) : this.action$;
2713
2713
  const onState = () => this.makeOnAction(shimmed$, true, this.action$);
2714
2714
  const onNormal = () => this.makeOnAction(this.action$, false, this.action$);
2715
2715
  const modelEntries = Object.entries(this.model);
@@ -2778,7 +2778,7 @@ class Component {
2778
2778
  });
2779
2779
  const model$ = Object.entries(reducers).reduce((acc, entry) => {
2780
2780
  const [sink, streams] = entry;
2781
- acc[sink] = xs.merge(xs.never(), ...streams);
2781
+ acc[sink] = xs$1.merge(xs$1.never(), ...streams);
2782
2782
  return acc;
2783
2783
  }, {});
2784
2784
  this.model$ = model$;
@@ -2808,13 +2808,13 @@ class Component {
2808
2808
  }
2809
2809
  initChildSources$() {
2810
2810
  let newSourcesNext;
2811
- const childSources$ = xs.create({
2811
+ const childSources$ = xs$1.create({
2812
2812
  start: (listener) => {
2813
2813
  newSourcesNext = listener.next.bind(listener);
2814
2814
  },
2815
2815
  stop: (_) => {
2816
2816
  }
2817
- }).map((sources) => xs.merge(...sources)).flatten();
2817
+ }).map((sources) => xs$1.merge(...sources)).flatten();
2818
2818
  this.sources[CHILD_SOURCE_NAME] = {
2819
2819
  select: (nameOrComponent) => {
2820
2820
  const all$ = childSources$;
@@ -2833,7 +2833,7 @@ class Component {
2833
2833
  };
2834
2834
  }
2835
2835
  initSubComponentSink$() {
2836
- const subComponentSink$ = xs.create({
2836
+ const subComponentSink$ = xs$1.create({
2837
2837
  start: (listener) => {
2838
2838
  this.newSubComponentSinks = listener.next.bind(listener);
2839
2839
  },
@@ -2844,7 +2844,7 @@ class Component {
2844
2844
  this.subComponentSink$ = subComponentSink$.filter((sinks) => Object.keys(sinks).length > 0);
2845
2845
  }
2846
2846
  initSubComponentsRendered$() {
2847
- const stream = xs.create({
2847
+ const stream = xs$1.create({
2848
2848
  start: (listener) => {
2849
2849
  this.triggerSubComponentsRendered = listener.next.bind(listener);
2850
2850
  },
@@ -2855,7 +2855,7 @@ class Component {
2855
2855
  }
2856
2856
  initVdom$() {
2857
2857
  if (typeof this.view != 'function') {
2858
- this.vdom$ = xs.of(null);
2858
+ this.vdom$ = xs$1.of(null);
2859
2859
  return;
2860
2860
  }
2861
2861
  const renderParameters$ = this.collectRenderParameters();
@@ -2894,12 +2894,12 @@ class Component {
2894
2894
  this.sinks = this.sourceNames.reduce((acc, name) => {
2895
2895
  if (name == this.DOMSourceName)
2896
2896
  return acc;
2897
- const subComponentSink$ = (this.subComponentSink$ && name !== PARENT_SINK_NAME) ? this.subComponentSink$.map((sinks) => sinks[name]).filter((sink) => !!sink).flatten() : xs.never();
2897
+ const subComponentSink$ = (this.subComponentSink$ && name !== PARENT_SINK_NAME) ? this.subComponentSink$.map((sinks) => sinks[name]).filter((sink) => !!sink).flatten() : xs$1.never();
2898
2898
  if (name === this.stateSourceName) {
2899
- acc[name] = xs.merge((this.model$[name] || xs.never()), subComponentSink$, this.sources[this.stateSourceName].stream.filter((_) => false), ...(this.peers$[name] || []));
2899
+ acc[name] = xs$1.merge((this.model$[name] || xs$1.never()), subComponentSink$, this.sources[this.stateSourceName].stream.filter((_) => false), ...(this.peers$[name] || []));
2900
2900
  }
2901
2901
  else {
2902
- acc[name] = xs.merge((this.model$[name] || xs.never()), subComponentSink$, ...(this.peers$[name] || []));
2902
+ acc[name] = xs$1.merge((this.model$[name] || xs$1.never()), subComponentSink$, ...(this.peers$[name] || []));
2903
2903
  }
2904
2904
  // Stamp EVENTS sink emissions with emitter component info for devtools
2905
2905
  if (name === 'EVENTS' && acc[name]) {
@@ -2910,7 +2910,7 @@ class Component {
2910
2910
  return acc;
2911
2911
  }, {});
2912
2912
  this.sinks[this.DOMSourceName] = this.vdom$;
2913
- this.sinks[PARENT_SINK_NAME] = this.model$[PARENT_SINK_NAME] || xs.never();
2913
+ this.sinks[PARENT_SINK_NAME] = this.model$[PARENT_SINK_NAME] || xs$1.never();
2914
2914
  // EFFECT sink: subscribe to trigger side effects but don't expose as a driver sink
2915
2915
  if (this.model$[EFFECT_SINK_NAME]) {
2916
2916
  const effectSub = this.model$[EFFECT_SINK_NAME].subscribe({
@@ -2932,7 +2932,7 @@ class Component {
2932
2932
  this.sinks[READY_SINK_NAME].__explicitReady = true;
2933
2933
  }
2934
2934
  else {
2935
- this.sinks[READY_SINK_NAME] = xs.of(true);
2935
+ this.sinks[READY_SINK_NAME] = xs$1.of(true);
2936
2936
  }
2937
2937
  }
2938
2938
  makeOnAction(action$, isStateSink = true, rootAction$) {
@@ -3123,7 +3123,7 @@ class Component {
3123
3123
  const state = this.sources[this.stateSourceName];
3124
3124
  const renderParams = { ...this.peers$[this.DOMSourceName] };
3125
3125
  const enhancedState = state && state.isolateSource(state, { get: (state) => this.addCalculated(state) });
3126
- const stateStream = (enhancedState && enhancedState.stream) || xs.never();
3126
+ const stateStream = (enhancedState && enhancedState.stream) || xs$1.never();
3127
3127
  renderParams.state = stateStream.compose(dropRepeats(objIsEqual));
3128
3128
  if (this.sources.props$) {
3129
3129
  renderParams.props = this.sources.props$.compose(dropRepeats(propsIsEqual));
@@ -3147,7 +3147,7 @@ class Component {
3147
3147
  names.push(name);
3148
3148
  streams.push(stream);
3149
3149
  });
3150
- const combined = xs.combine(...streams)
3150
+ const combined = xs$1.combine(...streams)
3151
3151
  .compose(debounce(1))
3152
3152
  // map the streams from an array back to an object with the render parameter names as the keys
3153
3153
  .map((arr) => {
@@ -3206,8 +3206,8 @@ class Component {
3206
3206
  addSinks(entry.sink$);
3207
3207
  return acc;
3208
3208
  }
3209
- const props$ = xs.create().startWith(props);
3210
- const children$ = xs.create().startWith(children);
3209
+ const props$ = xs$1.create().startWith(props);
3210
+ const children$ = xs$1.create().startWith(children);
3211
3211
  let instantiator;
3212
3212
  if (isCollection) {
3213
3213
  instantiator = this.instantiateCollection.bind(this);
@@ -3235,9 +3235,9 @@ class Component {
3235
3235
  console.error(`[${this.name}] Error in onError handler:`, fallbackErr);
3236
3236
  }
3237
3237
  }
3238
- sink$ = { [this.DOMSourceName]: xs.of(fallbackVNode) };
3238
+ sink$ = { [this.DOMSourceName]: xs$1.of(fallbackVNode) };
3239
3239
  }
3240
- sink$[this.DOMSourceName] = sink$[this.DOMSourceName] ? this.makeCoordinatedSubComponentDomSink(sink$[this.DOMSourceName]) : xs.never();
3240
+ sink$[this.DOMSourceName] = sink$[this.DOMSourceName] ? this.makeCoordinatedSubComponentDomSink(sink$[this.DOMSourceName]) : xs$1.never();
3241
3241
  acc[id] = { sink$, props$, children$ };
3242
3242
  this._activeSubComponents.set(id, acc[id]);
3243
3243
  addSinks(sink$);
@@ -3246,7 +3246,7 @@ class Component {
3246
3246
  const mergedSinksByType = Object.entries(sinkArrsByType).reduce((acc, [name, streamArr]) => {
3247
3247
  if (streamArr.length === 0)
3248
3248
  return acc;
3249
- acc[name] = streamArr.length === 1 ? streamArr[0] : xs.merge(...streamArr);
3249
+ acc[name] = streamArr.length === 1 ? streamArr[0] : xs$1.merge(...streamArr);
3250
3250
  return acc;
3251
3251
  }, {});
3252
3252
  // Dispose removed sub-components
@@ -3285,7 +3285,7 @@ class Component {
3285
3285
  filter,
3286
3286
  sort
3287
3287
  };
3288
- const state$ = xs.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState), props$.startWith(props))
3288
+ const state$ = xs$1.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState), props$.startWith(props))
3289
3289
  // this debounce is important. it forces state and prop updates to happen at the same time
3290
3290
  // without this, changes to sort or filter won't happen properly
3291
3291
  .compose(debounce(1))
@@ -3587,14 +3587,14 @@ class Component {
3587
3587
  return sink$;
3588
3588
  }
3589
3589
  renderVdom(componentInstances$) {
3590
- return xs.combine(this.subComponentsRendered$, componentInstances$, this._readyChanged$.startWith(null))
3590
+ return xs$1.combine(this.subComponentsRendered$, componentInstances$, this._readyChanged$.startWith(null))
3591
3591
  .compose(debounce(1))
3592
3592
  .map(([_, components]) => {
3593
3593
  const componentNames = Object.keys(this.components);
3594
3594
  const root = components['::ROOT::'];
3595
3595
  const entries = Object.entries(components).filter(([id]) => id !== '::ROOT::');
3596
3596
  if (entries.length === 0) {
3597
- return xs.of(processSuspensePost(root));
3597
+ return xs$1.of(processSuspensePost(root));
3598
3598
  }
3599
3599
  const ids = [];
3600
3600
  const vdom$ = entries
@@ -3603,7 +3603,7 @@ class Component {
3603
3603
  return val.sink$[this.DOMSourceName].startWith(undefined);
3604
3604
  });
3605
3605
  if (vdom$.length === 0)
3606
- return xs.of(root);
3606
+ return xs$1.of(root);
3607
3607
  // Track READY state on the component instance (persists across folds)
3608
3608
  for (const [id, val] of entries) {
3609
3609
  if (this._childReadyState[id] !== undefined)
@@ -3636,7 +3636,7 @@ class Component {
3636
3636
  this._childReadyState[id] = true;
3637
3637
  }
3638
3638
  }
3639
- return xs.combine(...vdom$)
3639
+ return xs$1.combine(...vdom$)
3640
3640
  .compose(debounce(1))
3641
3641
  .map((vdoms) => {
3642
3642
  const withIds = vdoms.reduce((acc, vdom, index) => {
@@ -4308,7 +4308,7 @@ function driverFromAsync(promiseReturningFunction, opts = {}) {
4308
4308
  }
4309
4309
  return (fromApp$) => {
4310
4310
  let sendFn = null;
4311
- const toApp$ = xs$1.create({
4311
+ const toApp$ = xs$2.create({
4312
4312
  start: (listener) => {
4313
4313
  sendFn = listener.next.bind(listener);
4314
4314
  },
@@ -4415,7 +4415,7 @@ function processForm(form, options = {}) {
4415
4415
  if (typeof events === 'string')
4416
4416
  events = [events];
4417
4417
  const eventStream$ = events.map((event) => form.events(event));
4418
- const merged$ = xs$1.merge(...eventStream$);
4418
+ const merged$ = xs$2.merge(...eventStream$);
4419
4419
  return merged$.map((e) => {
4420
4420
  if (preventDefault)
4421
4421
  e.preventDefault();
@@ -4447,22 +4447,22 @@ function processDrag({ draggable, dropZone } = {}, options = {}) {
4447
4447
  e.dataTransfer.effectAllowed = effectAllowed;
4448
4448
  return e;
4449
4449
  })
4450
- : xs$1.never();
4450
+ : xs$2.never();
4451
4451
  const dragEnd$ = draggable
4452
4452
  ? draggable.events('dragend').mapTo(null)
4453
- : xs$1.never();
4453
+ : xs$2.never();
4454
4454
  const dragOver$ = dropZone
4455
4455
  ? dropZone.events('dragover').map((e) => {
4456
4456
  e.preventDefault();
4457
4457
  return null;
4458
4458
  })
4459
- : xs$1.never();
4459
+ : xs$2.never();
4460
4460
  const drop$ = dropZone
4461
4461
  ? dropZone.events('drop').map((e) => {
4462
4462
  e.preventDefault();
4463
4463
  return e;
4464
4464
  })
4465
- : xs$1.never();
4465
+ : xs$2.never();
4466
4466
  return { dragStart$, dragEnd$, dragOver$, drop$ };
4467
4467
  }
4468
4468
 
@@ -4591,7 +4591,7 @@ function makeDragDriver() {
4591
4591
  events(eventType) {
4592
4592
  const busEventName = `${category}:${eventType}`;
4593
4593
  let handler;
4594
- const stream$ = xs$1.create({
4594
+ const stream$ = xs$2.create({
4595
4595
  start(listener) {
4596
4596
  handler = ({ detail }) => listener.next(detail);
4597
4597
  bus.addEventListener(busEventName, handler);
@@ -4625,7 +4625,7 @@ function makeSinkProxies(drivers) {
4625
4625
  const sinkProxies = {};
4626
4626
  for (const name in drivers) {
4627
4627
  if (Object.prototype.hasOwnProperty.call(drivers, name)) {
4628
- sinkProxies[name] = xs$1.create();
4628
+ sinkProxies[name] = xs$2.create();
4629
4629
  }
4630
4630
  }
4631
4631
  return sinkProxies;
@@ -4666,7 +4666,7 @@ function replicateMany(sinks, sinkProxies) {
4666
4666
  complete: () => { },
4667
4667
  };
4668
4668
  });
4669
- const subscriptions = sinkNames.map(name => xs$1.fromObservable(sinks[name]).subscribe(replicators[name]));
4669
+ const subscriptions = sinkNames.map(name => xs$2.fromObservable(sinks[name]).subscribe(replicators[name]));
4670
4670
  sinkNames.forEach(name => {
4671
4671
  const listener = sinkProxies[name];
4672
4672
  const next = (x) => {
@@ -4794,7 +4794,7 @@ function eventBusDriver(out$) {
4794
4794
  const all = !type;
4795
4795
  const _type = Array.isArray(type) ? type : [type];
4796
4796
  let cb;
4797
- const in$ = xs$1.create({
4797
+ const in$ = xs$2.create({
4798
4798
  start: (listener) => {
4799
4799
  cb = ({ detail: event }) => {
4800
4800
  const data = (event && event.data) || null;
@@ -5917,7 +5917,7 @@ function createRef() {
5917
5917
  }
5918
5918
  function createRef$() {
5919
5919
  const listener = { next: () => { } };
5920
- const stream = xs.createWithMemory({
5920
+ const stream = xs$1.createWithMemory({
5921
5921
  start(l) { listener.next = (val) => l.next(val); },
5922
5922
  stop() { listener.next = () => { }; },
5923
5923
  });
@@ -5962,7 +5962,7 @@ function renderComponent(componentDef, options = {}) {
5962
5962
  // The component's intent function will receive this as a source,
5963
5963
  // and we merge test actions with any real intent streams.
5964
5964
  const testActionListener = { next: () => { } };
5965
- const testAction$ = xs.create({
5965
+ const testAction$ = xs$1.create({
5966
5966
  start(listener) {
5967
5967
  testActionListener.next = (val) => listener.next(val);
5968
5968
  },
@@ -6058,7 +6058,7 @@ function renderComponent(componentDef, options = {}) {
6058
6058
  // Collect state values
6059
6059
  const states = [];
6060
6060
  let stateListener = null;
6061
- const stateStream = sources.STATE && sources.STATE.stream ? sources.STATE.stream : xs.never();
6061
+ const stateStream = sources.STATE && sources.STATE.stream ? sources.STATE.stream : xs$1.never();
6062
6062
  stateListener = {
6063
6063
  next: (s) => states.push(s),
6064
6064
  error: () => { },
@@ -6129,8 +6129,8 @@ function renderComponent(componentDef, options = {}) {
6129
6129
  };
6130
6130
  return {
6131
6131
  state$: stateStream,
6132
- dom$: sinks.DOM || xs.never(),
6133
- events$: sources.EVENTS || { select: () => xs.never() },
6132
+ dom$: sinks.DOM || xs$1.never(),
6133
+ events$: sources.EVENTS || { select: () => xs$1.never() },
6134
6134
  sinks,
6135
6135
  sources,
6136
6136
  simulateAction,
@@ -6197,6 +6197,7 @@ function emit(type, data) {
6197
6197
  };
6198
6198
  }
6199
6199
 
6200
+ const xs = xs$1;
6200
6201
  // ── makeServiceWorkerDriver ──────────────────────────────────
6201
6202
  function trackWorker(worker, events) {
6202
6203
  const emit = (type, data) => events.dispatchEvent(new CustomEvent('data', { detail: { type, data } }));
@@ -6263,7 +6264,7 @@ function makeServiceWorkerDriver(scriptUrl, options = {}) {
6263
6264
  return {
6264
6265
  select(type) {
6265
6266
  let cb;
6266
- const in$ = xs$1.create({
6267
+ const in$ = xs.create({
6267
6268
  start: (listener) => {
6268
6269
  cb = ({ detail }) => {
6269
6270
  if (!type || detail.type === type)
@@ -6282,30 +6283,30 @@ function makeServiceWorkerDriver(scriptUrl, options = {}) {
6282
6283
  };
6283
6284
  }
6284
6285
  // ── onlineStatus$ ────────────────────────────────────────────
6285
- function _createOnlineStatus() {
6286
- if (typeof window === 'undefined') {
6287
- return xs$1.of(true);
6288
- }
6289
- let cleanup;
6290
- return xs$1.create({
6291
- start(listener) {
6292
- listener.next(navigator.onLine);
6293
- const on = () => listener.next(true);
6294
- const off = () => listener.next(false);
6295
- window.addEventListener('online', on);
6296
- window.addEventListener('offline', off);
6297
- cleanup = () => {
6298
- window.removeEventListener('online', on);
6299
- window.removeEventListener('offline', off);
6300
- };
6301
- },
6302
- stop() {
6303
- cleanup?.();
6304
- cleanup = undefined;
6305
- },
6306
- });
6307
- }
6308
- const onlineStatus$ = _createOnlineStatus();
6286
+ // Lazy — the real stream is created on first subscribe so importing
6287
+ // sygnal in SSR doesn't eagerly reference window/navigator.
6288
+ let _onlineCleanup;
6289
+ const onlineStatus$ = xs.create({
6290
+ start(listener) {
6291
+ if (typeof window === 'undefined') {
6292
+ listener.next(true);
6293
+ return;
6294
+ }
6295
+ listener.next(navigator.onLine);
6296
+ const on = () => listener.next(true);
6297
+ const off = () => listener.next(false);
6298
+ window.addEventListener('online', on);
6299
+ window.addEventListener('offline', off);
6300
+ _onlineCleanup = () => {
6301
+ window.removeEventListener('online', on);
6302
+ window.removeEventListener('offline', off);
6303
+ };
6304
+ },
6305
+ stop() {
6306
+ _onlineCleanup?.();
6307
+ _onlineCleanup = undefined;
6308
+ },
6309
+ });
6309
6310
  // ── createInstallPrompt ──────────────────────────────────────
6310
6311
  function createInstallPrompt() {
6311
6312
  let deferredPrompt = null;
@@ -6324,7 +6325,7 @@ function createInstallPrompt() {
6324
6325
  return {
6325
6326
  select(type) {
6326
6327
  let cb;
6327
- const in$ = xs$1.create({
6328
+ const in$ = xs.create({
6328
6329
  start: (listener) => {
6329
6330
  cb = ({ detail }) => {
6330
6331
  if (detail.type === type)
@@ -7059,4 +7060,4 @@ exports.set = set;
7059
7060
  exports.switchable = switchable;
7060
7061
  exports.thunk = thunk;
7061
7062
  exports.toggle = toggle;
7062
- exports.xs = xs;
7063
+ exports.xs = xs$1;