@kithinji/orca 1.0.22 → 1.0.24

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.
@@ -1066,7 +1066,16 @@ var kithinjiorca = (() => {
1066
1066
  }
1067
1067
  }
1068
1068
  const instance = componentInjector.resolve(ComponentClass);
1069
- instance.props = vnode.props || {};
1069
+ const mergedProps = Object.create(Object.getPrototypeOf(instance.props));
1070
+ Object.defineProperties(
1071
+ mergedProps,
1072
+ Object.getOwnPropertyDescriptors(instance.props)
1073
+ );
1074
+ Object.defineProperties(
1075
+ mergedProps,
1076
+ Object.getOwnPropertyDescriptors(vnode.props || {})
1077
+ );
1078
+ instance.props = mergedProps;
1070
1079
  const childVNode = instance.build();
1071
1080
  if (childVNode instanceof Promise) {
1072
1081
  return this.createPendingReference(vnode, childVNode, componentInjector);
@@ -1892,6 +1901,13 @@ var kithinjiorca = (() => {
1892
1901
  this.subscribers = /* @__PURE__ */ new Set();
1893
1902
  this._isCompleted = false;
1894
1903
  this._hasError = false;
1904
+ this._thrownError = null;
1905
+ }
1906
+ asObservable() {
1907
+ return new Observable((observer) => {
1908
+ const subscription = this.subscribe(observer);
1909
+ return () => subscription.unsubscribe();
1910
+ });
1895
1911
  }
1896
1912
  subscribe(observerOrNext, error, complete) {
1897
1913
  if (this._isCompleted) {
@@ -1928,16 +1944,10 @@ var kithinjiorca = (() => {
1928
1944
  error(err) {
1929
1945
  if (this._isCompleted || this._hasError) return;
1930
1946
  this._hasError = true;
1931
- const currentSubscribers = Array.from(this.subscribers);
1932
- currentSubscribers.forEach((observer) => {
1933
- if (observer.error) {
1934
- try {
1935
- observer.error(err);
1936
- } catch (e) {
1937
- console.error("Error in error handler:", e);
1938
- }
1939
- }
1940
- });
1947
+ this._thrownError = err;
1948
+ for (const observer of this.subscribers) {
1949
+ observer.error?.(err);
1950
+ }
1941
1951
  this.subscribers.clear();
1942
1952
  }
1943
1953
  complete() {
@@ -1966,22 +1976,23 @@ var kithinjiorca = (() => {
1966
1976
  get $value() {
1967
1977
  return this._value;
1968
1978
  }
1969
- setValue(value) {
1970
- this._value = value;
1971
- }
1972
1979
  next(value) {
1973
1980
  this._value = value;
1974
1981
  super.next(value);
1975
1982
  }
1976
1983
  subscribe(observerOrNext, error, complete) {
1977
1984
  const observer = typeof observerOrNext === "function" ? { next: observerOrNext, error, complete } : observerOrNext;
1978
- try {
1979
- observer.next(this._value);
1980
- } catch (err) {
1981
- if (observer.error) {
1982
- observer.error(err);
1983
- }
1985
+ if (this._hasError) {
1986
+ observer.error?.(this._thrownError);
1987
+ return { unsubscribe: () => {
1988
+ } };
1984
1989
  }
1990
+ if (this._isCompleted) {
1991
+ observer.complete?.();
1992
+ return { unsubscribe: () => {
1993
+ } };
1994
+ }
1995
+ observer.next(this._value);
1985
1996
  return super.subscribe(observer);
1986
1997
  }
1987
1998
  };
@@ -1991,6 +2002,8 @@ var kithinjiorca = (() => {
1991
2002
  constructor() {
1992
2003
  this.__cleanup = [];
1993
2004
  }
2005
+ onInit() {
2006
+ }
1994
2007
  onDestroy() {
1995
2008
  this.__cleanup.forEach((cb) => cb());
1996
2009
  }
@@ -3056,7 +3069,11 @@ var kithinjiorca = (() => {
3056
3069
  if (routePattern) {
3057
3070
  builtRoute = buildRouteFromProps(routePattern, props, ComponentClass.name);
3058
3071
  }
3059
- instance.props = props;
3072
+ const mergedProps = Object.create(Object.getPrototypeOf(instance.props));
3073
+ Object.defineProperties(mergedProps, Object.getOwnPropertyDescriptors(instance.props));
3074
+ Object.defineProperties(mergedProps, Object.getOwnPropertyDescriptors(props));
3075
+ instance.props = mergedProps;
3076
+ instance.onInit?.();
3060
3077
  const root = instance.build();
3061
3078
  if (!(root instanceof Node)) {
3062
3079
  throw new Error(`Component ${ComponentClass.name}.build() must return a DOM Node`);