rask-ui 0.2.8 → 0.3.1

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/README.md CHANGED
@@ -966,7 +966,7 @@ RASK is designed for performance:
966
966
 
967
967
  - **Fine-grained reactivity**: Only components that access changed state re-render
968
968
  - **No wasted renders**: Components skip re-render if reactive dependencies haven't changed
969
- - **Efficient DOM updates**: Powered by a custom virtual DOM implementation optimized for reactive components
969
+ - **Efficient DOM updates**: Powered by Inferno's highly optimized virtual DOM reconciler
970
970
  - **No reconciler overhead for state**: State changes are direct, no diffing required
971
971
  - **Automatic cleanup**: Components and effects cleaned up automatically
972
972
 
@@ -977,7 +977,7 @@ RASK is designed for performance:
977
977
  | State management | Complex (hooks, closures) | Simple (signals) | Simple (proxies) |
978
978
  | UI expression | Excellent | Limited | Excellent |
979
979
  | Reactivity | Coarse (component level) | Fine-grained | Fine-grained |
980
- | Reconciler | Yes | Limited | Yes (custom) |
980
+ | Reconciler | Yes | Limited | Yes (Inferno) |
981
981
  | Syntax | JSX | JSX + special components | JSX |
982
982
  | Compiler required | No | Yes | No |
983
983
  | Learning curve | Steep | Moderate | Gentle |
@@ -0,0 +1,29 @@
1
+ import { VNode, Component, Props, InfernoNode } from "inferno";
2
+ export declare function getCurrentComponent(): RaskComponent<any>;
3
+ export declare function onMount(cb: () => void): void;
4
+ export declare function onCleanup(cb: () => void): void;
5
+ export type RaskFunctionComponent<P extends Props<any>> = (() => () => VNode) | ((props: P) => () => VNode);
6
+ declare class RaskComponent<P extends Props<any>> extends Component<P & {
7
+ __component: RaskFunctionComponent<P>;
8
+ }> {
9
+ private renderFn?;
10
+ private reactiveProps?;
11
+ private prevChildren;
12
+ private observer;
13
+ contexts: Map<any, any>;
14
+ getChildContext(): any;
15
+ onMounts: Array<() => void>;
16
+ onCleanups: Array<() => void>;
17
+ componentDidMount(): void;
18
+ componentWillReceiveProps(nextProps: Readonly<{
19
+ children?: InfernoNode;
20
+ } & P & {
21
+ __component: RaskFunctionComponent<P>;
22
+ }>): void;
23
+ componentWillUnmount(): void;
24
+ shouldComponentUpdate(): boolean;
25
+ render(): any;
26
+ }
27
+ export declare function createComponent(props: Props<any>, key?: string): VNode;
28
+ export {};
29
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACZ,MAAM,SAAS,CAAC;AAMjB,wBAAgB,mBAAmB,uBAMlC;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,QAMrC;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,QAMvC;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAClD,CAAC,MAAM,MAAM,KAAK,CAAC,GACnB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,KAAK,CAAC,CAAC;AAEhC,cAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,CAAE,SAAQ,SAAS,CACzD,CAAC,GAAG;IAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;CAAE,CAC9C;IACC,OAAO,CAAC,QAAQ,CAAC,CAAc;IAC/B,OAAO,CAAC,aAAa,CAAC,CAAa;IACnC,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAEb;IACH,QAAQ,gBAAa;IACrB,eAAe;IAUf,QAAQ,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAM;IACjC,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAM;IACnC,iBAAiB,IAAI,IAAI;IAGzB,yBAAyB,CACvB,SAAS,EAAE,QAAQ,CACjB;QAAE,QAAQ,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,CAAC,GAAG;QAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;KAAE,CAC3E,GACA,IAAI;IAaP,oBAAoB,IAAI,IAAI;IAG5B,qBAAqB,IAAI,OAAO;IAGhC,MAAM;CAuCP;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,SAQ9D"}
@@ -0,0 +1,125 @@
1
+ import { createComponentVNode, Component, } from "inferno";
2
+ import { getCurrentObserver, Observer, Signal } from "./observation";
3
+ let currentComponent;
4
+ export function getCurrentComponent() {
5
+ if (!currentComponent) {
6
+ throw new Error("No current component");
7
+ }
8
+ return currentComponent;
9
+ }
10
+ export function onMount(cb) {
11
+ if (!currentComponent) {
12
+ throw new Error("Only use onCleanup in component setup");
13
+ }
14
+ currentComponent.onMounts.push(cb);
15
+ }
16
+ export function onCleanup(cb) {
17
+ if (!currentComponent) {
18
+ throw new Error("Only use onCleanup in component setup");
19
+ }
20
+ currentComponent.onCleanups.push(cb);
21
+ }
22
+ class RaskComponent extends Component {
23
+ renderFn;
24
+ reactiveProps;
25
+ prevChildren;
26
+ observer = new Observer(() => {
27
+ this.forceUpdate();
28
+ });
29
+ contexts = new Map();
30
+ getChildContext() {
31
+ const parentGetContext = this.context.getContext;
32
+ return {
33
+ ...this.context,
34
+ getContext: (context) => {
35
+ return this.contexts.get(context) || parentGetContext(context);
36
+ },
37
+ };
38
+ }
39
+ onMounts = [];
40
+ onCleanups = [];
41
+ componentDidMount() {
42
+ this.onMounts.forEach((cb) => cb());
43
+ }
44
+ componentWillReceiveProps(nextProps) {
45
+ if (this.props.children === nextProps.children) {
46
+ for (const prop in nextProps) {
47
+ if (prop === "children") {
48
+ continue;
49
+ }
50
+ // @ts-ignore
51
+ this.reactiveProps[prop] = nextProps[prop];
52
+ }
53
+ }
54
+ else {
55
+ this.prevChildren = this.props.children;
56
+ }
57
+ }
58
+ componentWillUnmount() {
59
+ this.onCleanups.forEach((cb) => cb());
60
+ }
61
+ shouldComponentUpdate() {
62
+ return this.prevChildren !== this.props.children;
63
+ }
64
+ render() {
65
+ if (!this.renderFn) {
66
+ this.reactiveProps = createReactiveProps(this.props);
67
+ currentComponent = this;
68
+ try {
69
+ this.renderFn = this.props.__component(this.reactiveProps);
70
+ if (typeof this.renderFn !== "function") {
71
+ throw new Error("Component must return a render function");
72
+ }
73
+ }
74
+ catch (error) {
75
+ if (typeof this.context.notifyError !== "function") {
76
+ throw error;
77
+ }
78
+ this.context.notifyError(error);
79
+ return null;
80
+ }
81
+ currentComponent = undefined;
82
+ }
83
+ const stopObserving = this.observer.observe();
84
+ let result = null;
85
+ try {
86
+ result = this.renderFn();
87
+ }
88
+ catch (error) {
89
+ if (typeof this.context.notifyError !== "function") {
90
+ throw error;
91
+ }
92
+ this.context.notifyError(error);
93
+ }
94
+ finally {
95
+ stopObserving();
96
+ }
97
+ return result;
98
+ }
99
+ }
100
+ export function createComponent(props, key) {
101
+ console.log(props);
102
+ return createComponentVNode(4 /* VNodeFlags.ComponentClass */, RaskComponent, props, key);
103
+ }
104
+ function createReactiveProps(props) {
105
+ const reactiveProps = {};
106
+ for (const prop in props) {
107
+ const signal = new Signal();
108
+ Object.defineProperty(reactiveProps, prop, {
109
+ get() {
110
+ const observer = getCurrentObserver();
111
+ if (observer) {
112
+ observer.subscribeSignal(signal);
113
+ }
114
+ return props[prop];
115
+ },
116
+ set(value) {
117
+ if (props[prop] !== value) {
118
+ props[prop] = value;
119
+ signal.notify();
120
+ }
121
+ },
122
+ });
123
+ }
124
+ return reactiveProps;
125
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../src/createContext.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,CAAC;kBAEb,CAAC;WAaR,CAAC;EAoBX"}
1
+ {"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../src/createContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,wBAAgB,aAAa,CAAC,CAAC;kBAEb,CAAC;WASR,CAAC;EA0BX"}
@@ -1,5 +1,3 @@
1
- import { getCurrentComponent, } from "./vdom/ComponentVNode";
2
- import { findComponentVNode } from "./vdom/utils";
3
1
  /**
4
2
  * Creates a context object for providing and consuming values across component trees.
5
3
  *
@@ -24,6 +22,7 @@ import { findComponentVNode } from "./vdom/utils";
24
22
  *
25
23
  * @returns Context object with inject() and get() methods
26
24
  */
25
+ import { getCurrentComponent } from "./component";
27
26
  export function createContext() {
28
27
  const context = {
29
28
  inject(value) {
@@ -31,9 +30,6 @@ export function createContext() {
31
30
  if (!currentComponent) {
32
31
  throw new Error("You can not inject context outside component setup");
33
32
  }
34
- if (!currentComponent.contexts) {
35
- currentComponent.contexts = new Map();
36
- }
37
33
  currentComponent.contexts.set(context, value);
38
34
  },
39
35
  get() {
@@ -41,14 +37,14 @@ export function createContext() {
41
37
  if (!currentComponent) {
42
38
  throw new Error("You can not get context outside component setup");
43
39
  }
44
- while (currentComponent) {
45
- if (currentComponent.contexts?.has(context)) {
46
- return currentComponent.contexts.get(context);
47
- }
48
- const componentNode = findComponentVNode(currentComponent.parent);
49
- currentComponent = componentNode?.instance ?? null;
40
+ if (typeof currentComponent.context.getContext !== "function") {
41
+ throw new Error("There is no parent context");
42
+ }
43
+ const contextValue = currentComponent.context.getContext(context);
44
+ if (!contextValue) {
45
+ throw new Error("There is a parent context, but not the one you are using");
50
46
  }
51
- throw new Error("Could not find context in parent components");
47
+ return contextValue;
52
48
  },
53
49
  };
54
50
  return context;
package/dist/error.d.ts CHANGED
@@ -1,5 +1,16 @@
1
- export declare function ErrorBoundary(props: {
2
- error: (error: unknown) => ChildNode | ChildNode[];
1
+ import { Component, VNode } from "inferno";
2
+ export declare class ErrorBoundary extends Component<{
3
3
  children: any;
4
- }): () => any;
4
+ error: (error: unknown) => VNode;
5
+ }, {
6
+ error: unknown;
7
+ }> {
8
+ getChildContext(): {
9
+ notifyError: (error: unknown) => void;
10
+ };
11
+ state: {
12
+ error: null;
13
+ };
14
+ render(): any;
15
+ }
5
16
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,GAAG,SAAS,EAAE,CAAC;IACnD,QAAQ,EAAE,GAAG,CAAC;CACf,aAqBA"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,aAAc,SAAQ,SAAS,CAC1C;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAA;CAAE,EACnD;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CACnB;IACC,eAAe;6BAEU,OAAO;;IAKhC,KAAK;;MAAmB;IAExB,MAAM;CAOP"}
package/dist/error.js CHANGED
@@ -1,20 +1,17 @@
1
- import { getCurrentComponent } from "./vdom/ComponentVNode";
2
- export function ErrorBoundary(props) {
3
- const component = getCurrentComponent();
4
- return () => {
5
- if (component.error) {
6
- return props.error(component.error);
1
+ import { Component } from "inferno";
2
+ export class ErrorBoundary extends Component {
3
+ getChildContext() {
4
+ return {
5
+ notifyError: (error) => {
6
+ this.setState({ error });
7
+ },
8
+ };
9
+ }
10
+ state = { error: null };
11
+ render() {
12
+ if (this.state.error) {
13
+ return this.props.error(this.state.error);
7
14
  }
8
- // Fix parent relationship: children vnodes were created with wrong parent,
9
- // we need to update them to point to this ErrorBoundary component
10
- const children = Array.isArray(props.children)
11
- ? props.children
12
- : [props.children];
13
- children.forEach((child) => {
14
- if (child?.data?.parentComponent) {
15
- child.data.parentComponent = component;
16
- }
17
- });
18
- return props.children;
19
- };
15
+ return this.props.children;
16
+ }
20
17
  }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { render } from "./vdom";
2
- export { onCleanup, onMount } from "./vdom/ComponentVNode";
1
+ export { render } from "inferno";
2
+ export { onCleanup, onMount } from "./component";
3
3
  export { createContext } from "./createContext";
4
4
  export { createState } from "./createState";
5
5
  export { createAsync } from "./createAsync";
6
6
  export { ErrorBoundary } from "./error";
7
7
  export { createQuery } from "./createQuery";
8
8
  export { createMutation } from "./createMutation";
9
- export { createRef } from "./createRef";
9
+ export { createRef } from "inferno";
10
10
  export { createView } from "./createView";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export { render } from "./vdom";
2
- export { onCleanup, onMount } from "./vdom/ComponentVNode";
1
+ export { render } from "inferno";
2
+ export { onCleanup, onMount } from "./component";
3
3
  export { createContext } from "./createContext";
4
4
  export { createState } from "./createState";
5
5
  export { createAsync } from "./createAsync";
6
6
  export { ErrorBoundary } from "./error";
7
7
  export { createQuery } from "./createQuery";
8
8
  export { createMutation } from "./createMutation";
9
- export { createRef } from "./createRef";
9
+ export { createRef } from "inferno";
10
10
  export { createView } from "./createView";
@@ -1,4 +1,5 @@
1
- export { jsx, jsxs, Fragment } from "./jsx-runtime";
1
+ export { jsx, jsxs } from "./jsx-runtime";
2
2
  export type { JSX } from "./jsx-runtime";
3
- export { jsx as jsxDEV } from "./vdom";
3
+ export { Fragment } from "inferno";
4
+ export { jsx as jsxDEV } from "./jsx-runtime";
4
5
  //# sourceMappingURL=jsx-dev-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // JSX dev runtime - adds jsxDEV for development mode
2
- export { jsx, jsxs, Fragment } from "./jsx-runtime";
2
+ export { jsx, jsxs } from "./jsx-runtime";
3
+ export { Fragment } from "inferno";
3
4
  // In development mode, TypeScript uses jsxDEV instead of jsx
4
5
  // We just alias it to jsx since we don't need the extra dev-mode params
5
- export { jsx as jsxDEV } from "./vdom";
6
+ export { jsx as jsxDEV } from "./jsx-runtime";
@@ -1,7 +1,8 @@
1
+ import { Component } from "inferno";
1
2
  import type { JSXInternal } from "./jsx";
2
- export { Fragment } from "./vdom/FragmentVNode";
3
+ export { Fragment } from "inferno";
3
4
  export declare function jsx(type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any>, key?: string): any;
4
- export declare function jsx<P>(type: (props: P) => any, props: P & {
5
+ export declare function jsx<P>(type: ((props: P) => any) | (new () => Component), props: P & {
5
6
  children?: any;
6
7
  }, key?: string): any;
7
8
  export declare function jsxs(type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any>, key?: string): any;
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,wBAAgB,GAAG,CACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,cAAc,GAC/B,WAAW,CAAC,aAAa,GACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AACP,wBAAgB,GAAG,CAAC,CAAC,EACnB,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EACvB,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,EAC7B,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AAKP,wBAAgB,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,cAAc,GAC/B,WAAW,CAAC,aAAa,GACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AACP,wBAAgB,IAAI,CAAC,CAAC,EACpB,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EACvB,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,EAC/B,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AAMP,YAAY,EAAE,WAAW,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,wBAAgB,GAAG,CACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,cAAc,GAC/B,WAAW,CAAC,aAAa,GACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AACP,wBAAgB,GAAG,CAAC,CAAC,EACnB,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,UAAU,SAAS,CAAC,EACjD,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,EAC7B,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AAmBP,wBAAgB,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,cAAc,GAC/B,WAAW,CAAC,aAAa,GACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AACP,wBAAgB,IAAI,CAAC,CAAC,EACpB,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EACvB,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,EAC/B,GAAG,CAAC,EAAE,MAAM,GACX,GAAG,CAAC;AAMP,YAAY,EAAE,WAAW,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC"}
@@ -1,7 +1,18 @@
1
- import { jsx as internalJsx } from "./vdom";
2
- export { Fragment } from "./vdom/FragmentVNode";
3
- export function jsx(type, props, key) {
4
- return internalJsx(type, props, key);
1
+ // JSX runtime implementation
2
+ import { createComponentVNode } from "inferno";
3
+ import { createElement } from "inferno-create-element";
4
+ import { createComponent } from "./component";
5
+ import { ErrorBoundary } from "./error";
6
+ export { Fragment } from "inferno";
7
+ export function jsx(type, { children, ...props }, key) {
8
+ if (typeof type === "string") {
9
+ return createElement(type, { ...props, key }, ...children);
10
+ }
11
+ if (type === ErrorBoundary) {
12
+ console.log("WTF");
13
+ return createComponentVNode(14 /* VNodeFlags.Component */, ErrorBoundary, { ...props, children }, key);
14
+ }
15
+ return createComponent({ ...props, children, __component: type }, key);
5
16
  }
6
17
  export function jsxs(type, props, key) {
7
18
  return jsx(type, props, key);
@@ -1 +1 @@
1
- {"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,aAEjC;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CAAyB;IAC5C,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI;IAOxB,MAAM;CAGP;AAED,qBAAa,QAAQ;IACnB,UAAU,UAAS;IACnB,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,QAAQ,CAAa;gBACjB,QAAQ,EAAE,MAAM,IAAI;IAGhC,eAAe,CAAC,MAAM,EAAE,MAAM;IAG9B,OAAO;IAOP,OAAO;CAIR"}
1
+ {"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,aAEjC;AAKD,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CAAyB;IAC5C,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI;IAOxB,MAAM;CAgBP;AAED,qBAAa,QAAQ;IACnB,UAAU,UAAS;IACnB,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,QAAQ,CAAa;gBACjB,QAAQ,EAAE,MAAM,IAAI;IAGhC,eAAe,CAAC,MAAM,EAAE,MAAM;IAG9B,OAAO;IAOP,OAAO;CAIR"}
@@ -2,6 +2,8 @@ const observerStack = [];
2
2
  export function getCurrentObserver() {
3
3
  return observerStack[0];
4
4
  }
5
+ let isQueuingNotify = false;
6
+ let notifyQueue = [];
5
7
  export class Signal {
6
8
  subscribers = new Set();
7
9
  subscribe(cb) {
@@ -11,7 +13,19 @@ export class Signal {
11
13
  };
12
14
  }
13
15
  notify() {
14
- this.subscribers.forEach((cb) => cb());
16
+ const currentSubscribers = Array.from(this.subscribers);
17
+ notifyQueue.push(() => {
18
+ currentSubscribers.forEach((cb) => cb());
19
+ });
20
+ if (!isQueuingNotify) {
21
+ isQueuingNotify = true;
22
+ queueMicrotask(() => {
23
+ isQueuingNotify = false;
24
+ const queue = notifyQueue;
25
+ notifyQueue = [];
26
+ queue.forEach((cb) => cb());
27
+ });
28
+ }
15
29
  }
16
30
  }
17
31
  export class Observer {
@@ -1,4 +1,4 @@
1
- import { VNode } from "./vdom/types";
1
+ import { VNode } from "inferno";
2
2
  /**
3
3
  * Test helper to render a component and provide easy cleanup
4
4
  *
@@ -9,7 +9,7 @@ import { VNode } from "./vdom/types";
9
9
  */
10
10
  export declare function renderComponent(vnode: VNode): {
11
11
  container: HTMLElement;
12
- vnode: import("./vdom/RootVNode").RootVNode;
12
+ vnode: void;
13
13
  unmount: () => void;
14
14
  rerender: (newVnode: VNode) => void;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAUrC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK;;;;yBAmBnB,KAAK;EAI7B"}
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,EAAE,MAAM,SAAS,CAAC;AAUxC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK;;;;yBAoBnB,KAAK;EAI7B"}
@@ -1,6 +1,6 @@
1
1
  // Test setup file for vitest
2
2
  import { afterEach } from "vitest";
3
- import { render } from "./vdom";
3
+ import { render } from "inferno";
4
4
  // Clean up after each test
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
@@ -19,6 +19,7 @@ export function renderComponent(vnode) {
19
19
  const container = document.createElement("div");
20
20
  document.body.appendChild(container);
21
21
  let currentVnode = render(vnode, container);
22
+ // @ts-ignore
22
23
  const actualElement = currentVnode.elm;
23
24
  return {
24
25
  // The actual rendered DOM element (after patch replaces container)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rask-ui",
3
- "version": "0.2.8",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -35,5 +35,10 @@
35
35
  "jsdom": "^27.1.0",
36
36
  "typescript": "^5.7.3",
37
37
  "vitest": "^4.0.7"
38
+ },
39
+ "dependencies": {
40
+ "inferno": "^9.0.4",
41
+ "inferno-create-element": "^9.0.4",
42
+ "inferno-vnode-flags": "^9.0.4"
38
43
  }
39
44
  }