rask-ui 0.2.8 → 0.3.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.
@@ -0,0 +1,31 @@
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(): {
15
+ getContext: (context: any) => any;
16
+ };
17
+ onMounts: Array<() => void>;
18
+ onCleanups: Array<() => void>;
19
+ componentDidMount(): void;
20
+ componentWillReceiveProps(nextProps: Readonly<{
21
+ children?: InfernoNode;
22
+ } & P & {
23
+ __component: RaskFunctionComponent<P>;
24
+ }>): void;
25
+ componentWillUnmount(): void;
26
+ shouldComponentUpdate(): boolean;
27
+ render(): any;
28
+ }
29
+ export declare function createComponent(props: Props<any>, key?: string): VNode;
30
+ export {};
31
+ //# 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,uBAQlC;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,QAQrC;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,QAQvC;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;8BAEW,GAAG;;IAK7B,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;CAoBP;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,SAQ9D"}
@@ -0,0 +1,111 @@
1
+ import { createComponentVNode, Component, } from "inferno";
2
+ import { getCurrentObserver, Observer, Signal } from "./observation";
3
+ const componentStack = [];
4
+ export function getCurrentComponent() {
5
+ const currentComponent = componentStack[0];
6
+ if (!currentComponent) {
7
+ throw new Error("No current component");
8
+ }
9
+ return currentComponent;
10
+ }
11
+ export function onMount(cb) {
12
+ const current = componentStack[0];
13
+ if (!current) {
14
+ throw new Error("Only use onCleanup in component setup");
15
+ }
16
+ current.onMounts.push(cb);
17
+ }
18
+ export function onCleanup(cb) {
19
+ const current = componentStack[0];
20
+ if (!current) {
21
+ throw new Error("Only use onCleanup in component setup");
22
+ }
23
+ current.onCleanups.push(cb);
24
+ }
25
+ class RaskComponent extends Component {
26
+ renderFn;
27
+ reactiveProps;
28
+ prevChildren;
29
+ observer = new Observer(() => {
30
+ this.forceUpdate();
31
+ });
32
+ contexts = new Map();
33
+ getChildContext() {
34
+ return {
35
+ getContext: (context) => {
36
+ return this.contexts.get(context);
37
+ },
38
+ };
39
+ }
40
+ onMounts = [];
41
+ onCleanups = [];
42
+ componentDidMount() {
43
+ this.onMounts.forEach((cb) => cb());
44
+ }
45
+ componentWillReceiveProps(nextProps) {
46
+ if (this.props.children === nextProps.children) {
47
+ for (const prop in nextProps) {
48
+ if (prop === "children") {
49
+ continue;
50
+ }
51
+ // @ts-ignore
52
+ this.reactiveProps[prop] = nextProps[prop];
53
+ }
54
+ }
55
+ else {
56
+ this.prevChildren = this.props.children;
57
+ }
58
+ }
59
+ componentWillUnmount() {
60
+ this.onCleanups.forEach((cb) => cb());
61
+ }
62
+ shouldComponentUpdate() {
63
+ return this.prevChildren !== this.props.children;
64
+ }
65
+ render() {
66
+ if (!this.renderFn) {
67
+ componentStack.unshift(this);
68
+ this.reactiveProps = createReactiveProps(this.props);
69
+ this.renderFn = this.props.__component(this.reactiveProps);
70
+ componentStack.shift();
71
+ }
72
+ const stopObserving = this.observer.observe();
73
+ let result = null;
74
+ try {
75
+ result = this.renderFn();
76
+ }
77
+ catch (error) {
78
+ this.context.notifyError(error);
79
+ }
80
+ finally {
81
+ stopObserving();
82
+ }
83
+ return result;
84
+ }
85
+ }
86
+ export function createComponent(props, key) {
87
+ console.log(props);
88
+ return createComponentVNode(4 /* VNodeFlags.ComponentClass */, RaskComponent, props, key);
89
+ }
90
+ function createReactiveProps(props) {
91
+ const reactiveProps = {};
92
+ for (const prop in props) {
93
+ const signal = new Signal();
94
+ Object.defineProperty(reactiveProps, prop, {
95
+ get() {
96
+ const observer = getCurrentObserver();
97
+ if (observer) {
98
+ observer.subscribeSignal(signal);
99
+ }
100
+ return props[prop];
101
+ },
102
+ set(value) {
103
+ if (props[prop] !== value) {
104
+ props[prop] = value;
105
+ signal.notify();
106
+ }
107
+ },
108
+ });
109
+ }
110
+ return reactiveProps;
111
+ }
@@ -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;EAYX"}
@@ -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,7 @@ 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;
50
- }
51
- throw new Error("Could not find context in parent components");
40
+ return currentComponent.context.getContext(context);
52
41
  },
53
42
  };
54
43
  return context;
package/dist/error.d.ts CHANGED
@@ -1,5 +1,15 @@
1
- export declare function ErrorBoundary(props: {
2
- error: (error: unknown) => ChildNode | ChildNode[];
1
+ import { Component } from "inferno";
2
+ export declare class ErrorBoundary extends Component<{
3
3
  children: any;
4
- }): () => any;
4
+ }, {
5
+ hasError: boolean;
6
+ }> {
7
+ getChildContext(): {
8
+ notifyError: (error: unknown) => void;
9
+ };
10
+ state: {
11
+ hasError: boolean;
12
+ };
13
+ render(): any;
14
+ }
5
15
  //# 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,MAAM,SAAS,CAAC;AAEpC,qBAAa,aAAc,SAAQ,SAAS,CAC1C;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,EACjB;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CACtB;IACC,eAAe;6BAEU,OAAO;;IAKhC,KAAK;;MAAuB;IAE5B,MAAM;CAOP"}
package/dist/error.js CHANGED
@@ -1,20 +1,18 @@
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 { jsx as _jsx } from "./jsx-runtime";
2
+ import { Component } from "inferno";
3
+ export class ErrorBoundary extends Component {
4
+ getChildContext() {
5
+ return {
6
+ notifyError: (error) => {
7
+ this.setState({ hasError: true });
8
+ },
9
+ };
10
+ }
11
+ state = { hasError: false };
12
+ render() {
13
+ if (this.state.hasError) {
14
+ return _jsx("div", { style: "color: red", children: "Something went wrong." });
7
15
  }
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
- };
16
+ return this.props.children;
17
+ }
20
18
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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";
@@ -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,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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";
@@ -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,5 +1,5 @@
1
1
  import type { JSXInternal } from "./jsx";
2
- export { Fragment } from "./vdom/FragmentVNode";
2
+ export { Fragment } from "inferno";
3
3
  export declare function jsx(type: string, props: JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes & Record<string, any>, key?: string): any;
4
4
  export declare function jsx<P>(type: (props: P) => any, props: P & {
5
5
  children?: 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":"AAGA,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,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;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.0",
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
  }