oxiui-lib 0.2.1 → 0.2.3

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.
@@ -1,6 +1,6 @@
1
1
  declare const Animation_base: {
2
2
  new (props?: import("../types/html.js").CommonProps | undefined): {
3
- "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<any>>;
3
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
4
4
  type: "div";
5
5
  props: import("../types/html.js").CommonProps;
6
6
  up?: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>;
@@ -13,11 +13,11 @@ declare const Animation_base: {
13
13
  withProps<T extends Partial<import("../types/html.js").CommonProps>>(newProps: T): /*elided*/ any;
14
14
  withStyle(style: Partial<CSSStyleDeclaration>): /*elided*/ any;
15
15
  withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
16
+ withState(): /*elided*/ any;
16
17
  };
17
18
  };
18
19
  export declare class Animation extends Animation_base {
19
20
  #private;
20
- constructor();
21
21
  transition(sec: number, type: "ease" | "ease-in-out"): this;
22
22
  translate(direction: "vertical" | "horizontal" | "perpendicular", target: number): this;
23
23
  translateX(target: number): this;
@@ -7,10 +7,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
7
7
  var _Animation_instances, _Animation_transforms, _Animation_applyTransforms;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Animation = void 0;
10
- const AbaComponent_js_1 = require("./AbaComponent.js");
11
- class Animation extends (0, AbaComponent_js_1.intrinsic)("div") {
10
+ const OxiComponent_js_1 = require("./OxiComponent.js");
11
+ class Animation extends (0, OxiComponent_js_1.intrinsic)("div") {
12
12
  constructor() {
13
- super();
13
+ super(...arguments);
14
14
  _Animation_instances.add(this);
15
15
  _Animation_transforms.set(this, new Map());
16
16
  }
@@ -77,7 +77,7 @@ _Animation_transforms = new WeakMap(), _Animation_instances = new WeakSet(), _An
77
77
  this.withStyle({ transform: undefined });
78
78
  }
79
79
  else {
80
- const transformString = Array.from(__classPrivateFieldGet(this, _Animation_transforms, "f").values()).join(' ');
80
+ const transformString = Array.from(__classPrivateFieldGet(this, _Animation_transforms, "f").values()).join(" ");
81
81
  this.withStyle({ transform: transformString });
82
82
  }
83
83
  };
@@ -1,7 +1,7 @@
1
1
  import type { ButtonProps } from "../types/html.js";
2
2
  declare const Button_base: {
3
3
  new (props?: ButtonProps | undefined): {
4
- "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<any>>;
4
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
5
5
  type: "button";
6
6
  props: ButtonProps;
7
7
  up?: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>;
@@ -14,6 +14,7 @@ declare const Button_base: {
14
14
  withProps<T extends Partial<ButtonProps>>(newProps: T): /*elided*/ any;
15
15
  withStyle(style: Partial<CSSStyleDeclaration>): /*elided*/ any;
16
16
  withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
17
+ withState(): /*elided*/ any;
17
18
  };
18
19
  };
19
20
  export declare class Button extends Button_base {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Button = void 0;
4
- const AbaComponent_js_1 = require("./AbaComponent.js");
5
- class Button extends (0, AbaComponent_js_1.intrinsic)("button") {
4
+ const OxiComponent_js_1 = require("./OxiComponent.js");
5
+ class Button extends (0, OxiComponent_js_1.intrinsic)("button") {
6
6
  constructor(text, props) {
7
7
  super();
8
8
  this.withProps({ content: text !== null && text !== void 0 ? text : props === null || props === void 0 ? void 0 : props.content });
@@ -1,6 +1,6 @@
1
1
  declare const TextInput_base: {
2
2
  new (props?: import("../types/html.js").InputProps | undefined): {
3
- "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<any>>;
3
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
4
4
  type: "input";
5
5
  props: import("../types/html.js").InputProps;
6
6
  up?: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>;
@@ -13,10 +13,10 @@ declare const TextInput_base: {
13
13
  withProps<T extends Partial<import("../types/html.js").InputProps>>(newProps: T): /*elided*/ any;
14
14
  withStyle(style: Partial<CSSStyleDeclaration>): /*elided*/ any;
15
15
  withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
16
+ withState(): /*elided*/ any;
16
17
  };
17
18
  };
18
19
  export declare class TextInput extends TextInput_base {
19
- constructor();
20
20
  value(value: string | number): this;
21
21
  placeholder(text: string): this;
22
22
  required(required?: boolean): this;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextInput = void 0;
4
- const AbaComponent_js_1 = require("./AbaComponent.js");
5
- class TextInput extends (0, AbaComponent_js_1.intrinsic)("input") {
6
- constructor() {
7
- super();
8
- }
4
+ const OxiComponent_js_1 = require("./OxiComponent.js");
5
+ class TextInput extends (0, OxiComponent_js_1.intrinsic)("input") {
9
6
  value(value) {
10
7
  this.props.value = value;
11
8
  return this;
@@ -0,0 +1,56 @@
1
+ import { Signal } from "../signals.js";
2
+ import type { IComponent, StyleProp } from "../types/component.js";
3
+ import type { IntrinsicElements } from "../types/html.js";
4
+ export declare class OxiComponent<K extends keyof IntrinsicElements> implements IComponent<K> {
5
+ #private;
6
+ type: K;
7
+ props: IntrinsicElements[K];
8
+ up?: IComponent<keyof IntrinsicElements>;
9
+ down: IComponent<keyof IntrinsicElements>[];
10
+ cursors: Set<string>;
11
+ index: string;
12
+ view?: (() => void) | undefined;
13
+ constructor(type: K, props?: IntrinsicElements[K]);
14
+ body(fn?: (component: this) => void): this;
15
+ onAppear(fn: (component: this) => void): this;
16
+ withProps<T extends Partial<IntrinsicElements[K]>>(newProps: T): this;
17
+ withStyle(style: StyleProp<IntrinsicElements[K]>): this;
18
+ withExtension(extension: (component: this) => void): this;
19
+ withState(): this;
20
+ }
21
+ export declare function intrinsic<K extends keyof IntrinsicElements>(type: K): {
22
+ new (props?: IntrinsicElements[K]): {
23
+ "__#private@#__states": Map<string | symbol, Signal<unknown>>;
24
+ type: K;
25
+ props: IntrinsicElements[K];
26
+ up?: IComponent<keyof IntrinsicElements>;
27
+ down: IComponent<keyof IntrinsicElements>[];
28
+ cursors: Set<string>;
29
+ index: string;
30
+ view?: (() => void) | undefined;
31
+ body(fn?: ((component: /*elided*/ any) => void) | undefined): /*elided*/ any;
32
+ onAppear(fn: (component: /*elided*/ any) => void): /*elided*/ any;
33
+ withProps<T extends Partial<IntrinsicElements[K]>>(newProps: T): /*elided*/ any;
34
+ withStyle(style: StyleProp<IntrinsicElements[K]>): /*elided*/ any;
35
+ withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
36
+ withState(): /*elided*/ any;
37
+ };
38
+ };
39
+ export declare function intrinsicState<K extends keyof IntrinsicElements>(type: K): {
40
+ new (props?: IntrinsicElements[K]): {
41
+ "__#private@#__states": Map<string | symbol, Signal<unknown>>;
42
+ type: K;
43
+ props: IntrinsicElements[K];
44
+ up?: IComponent<keyof IntrinsicElements>;
45
+ down: IComponent<keyof IntrinsicElements>[];
46
+ cursors: Set<string>;
47
+ index: string;
48
+ view?: (() => void) | undefined;
49
+ body(fn?: ((component: /*elided*/ any) => void) | undefined): /*elided*/ any;
50
+ onAppear(fn: (component: /*elided*/ any) => void): /*elided*/ any;
51
+ withProps<T extends Partial<IntrinsicElements[K]>>(newProps: T): /*elided*/ any;
52
+ withStyle(style: StyleProp<IntrinsicElements[K]>): /*elided*/ any;
53
+ withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
54
+ withState(): /*elided*/ any;
55
+ };
56
+ };
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _OxiComponent___states;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OxiComponent = void 0;
10
+ exports.intrinsic = intrinsic;
11
+ exports.intrinsicState = intrinsicState;
12
+ const scheduler_js_1 = require("../scheduler.js");
13
+ const signals_js_1 = require("../signals.js");
14
+ const tree_js_1 = require("../tree.js");
15
+ class OxiComponent {
16
+ constructor(type, props) {
17
+ _OxiComponent___states.set(this, new Map());
18
+ this.down = [];
19
+ this.cursors = new Set();
20
+ const parent = (0, tree_js_1.current)();
21
+ this.type = type;
22
+ this.props = props !== null && props !== void 0 ? props : {};
23
+ this.up = parent;
24
+ const position = parent ? parent.down.length : 0;
25
+ this.index = parent ? `${parent.index}.${position}` : "0";
26
+ parent === null || parent === void 0 ? void 0 : parent.down.push(this);
27
+ }
28
+ body(fn) {
29
+ (0, tree_js_1.open)(this);
30
+ if (this.view) {
31
+ this.view();
32
+ }
33
+ else {
34
+ fn === null || fn === void 0 ? void 0 : fn(this);
35
+ }
36
+ (0, tree_js_1.close)();
37
+ return this;
38
+ }
39
+ onAppear(fn) {
40
+ (0, tree_js_1.open)(this);
41
+ (0, scheduler_js_1.scheduleEffect)(() => fn(this));
42
+ (0, tree_js_1.close)();
43
+ return this;
44
+ }
45
+ withProps(newProps) {
46
+ (0, tree_js_1.open)(this);
47
+ this.props = { ...this.props, ...newProps };
48
+ (0, tree_js_1.close)();
49
+ return this;
50
+ }
51
+ withStyle(style) {
52
+ (0, tree_js_1.open)(this);
53
+ const currentStyle = this.props.style;
54
+ if (typeof style === "object" && typeof currentStyle === "object") {
55
+ this.props = {
56
+ ...this.props,
57
+ style: { ...currentStyle, ...style },
58
+ };
59
+ }
60
+ else {
61
+ this.props = {
62
+ ...this.props,
63
+ style,
64
+ };
65
+ }
66
+ (0, tree_js_1.close)();
67
+ return this;
68
+ }
69
+ withExtension(extension) {
70
+ (0, tree_js_1.open)(this);
71
+ extension(this);
72
+ (0, tree_js_1.close)();
73
+ return this;
74
+ }
75
+ withState() {
76
+ return new Proxy(this, {
77
+ get(target, prop, receiver) {
78
+ if (typeof prop === "string" && prop.startsWith("$")) {
79
+ let signal = __classPrivateFieldGet(target, _OxiComponent___states, "f").get(prop);
80
+ if (!signal) {
81
+ (0, tree_js_1.open)(target);
82
+ signal = new signals_js_1.Signal(Reflect.get(target, prop, receiver));
83
+ __classPrivateFieldGet(target, _OxiComponent___states, "f").set(prop, signal);
84
+ (0, tree_js_1.close)();
85
+ }
86
+ return signal.value;
87
+ }
88
+ return Reflect.get(target, prop, receiver);
89
+ },
90
+ set(target, prop, value, receiver) {
91
+ if (typeof prop === "string" && prop.startsWith("$")) {
92
+ let signal = __classPrivateFieldGet(target, _OxiComponent___states, "f").get(prop);
93
+ (0, tree_js_1.open)(target);
94
+ if (!signal) {
95
+ signal = new signals_js_1.Signal(value);
96
+ __classPrivateFieldGet(target, _OxiComponent___states, "f").set(prop, signal);
97
+ }
98
+ else {
99
+ signal.value = value;
100
+ }
101
+ (0, tree_js_1.close)();
102
+ return true;
103
+ }
104
+ return Reflect.set(target, prop, value, receiver);
105
+ },
106
+ });
107
+ }
108
+ }
109
+ exports.OxiComponent = OxiComponent;
110
+ _OxiComponent___states = new WeakMap();
111
+ function intrinsic(type) {
112
+ return class extends OxiComponent {
113
+ constructor(props) {
114
+ super(type, props);
115
+ }
116
+ };
117
+ }
118
+ function intrinsicState(type) {
119
+ return class extends OxiComponent {
120
+ constructor(props) {
121
+ super(type, props);
122
+ // biome-ignore lint: correctness/noConstructorReturn
123
+ return this.withState();
124
+ }
125
+ };
126
+ }
@@ -0,0 +1,21 @@
1
+ declare const DivContainer_base: {
2
+ new (props?: import("../types/html.js").CommonProps | undefined): {
3
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
4
+ type: "div";
5
+ props: import("../types/html.js").CommonProps;
6
+ up?: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>;
7
+ down: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>[];
8
+ cursors: Set<string>;
9
+ index: string;
10
+ view?: (() => void) | undefined;
11
+ body(fn?: ((component: /*elided*/ any) => void) | undefined): /*elided*/ any;
12
+ onAppear(fn: (component: /*elided*/ any) => void): /*elided*/ any;
13
+ withProps<T extends Partial<import("../types/html.js").CommonProps>>(newProps: T): /*elided*/ any;
14
+ withStyle(style: Partial<CSSStyleDeclaration>): /*elided*/ any;
15
+ withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
16
+ withState(): /*elided*/ any;
17
+ };
18
+ };
19
+ export declare class DivContainer extends DivContainer_base {
20
+ }
21
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DivContainer = void 0;
4
+ const OxiComponent_js_1 = require("./OxiComponent.js");
5
+ class DivContainer extends (0, OxiComponent_js_1.intrinsic)("div") {
6
+ }
7
+ exports.DivContainer = DivContainer;
@@ -1,6 +1,6 @@
1
1
  declare const Stack_base: {
2
2
  new (props?: import("../types/html.js").CommonProps | undefined): {
3
- "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<any>>;
3
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
4
4
  type: "div";
5
5
  props: import("../types/html.js").CommonProps;
6
6
  up?: import("../types/component.js").IComponent<keyof import("../types/html.js").IntrinsicElements>;
@@ -13,6 +13,7 @@ declare const Stack_base: {
13
13
  withProps<T extends Partial<import("../types/html.js").CommonProps>>(newProps: T): /*elided*/ any;
14
14
  withStyle(style: Partial<CSSStyleDeclaration>): /*elided*/ any;
15
15
  withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
16
+ withState(): /*elided*/ any;
16
17
  };
17
18
  };
18
19
  export declare class Stack extends Stack_base {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Stack = void 0;
4
- const AbaComponent_js_1 = require("./AbaComponent.js");
5
- class Stack extends (0, AbaComponent_js_1.intrinsic)("div") {
4
+ const OxiComponent_js_1 = require("./OxiComponent.js");
5
+ class Stack extends (0, OxiComponent_js_1.intrinsic)("div") {
6
6
  constructor() {
7
7
  super();
8
8
  this.withStyle({
@@ -4,7 +4,7 @@ declare const Text_base: {
4
4
  type: keyof SemanticText;
5
5
  props: import("../types/html.js").CommonProps;
6
6
  } | undefined): {
7
- "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<any>>;
7
+ "__#private@#__states": Map<string | symbol, import("../signals.js").Signal<unknown>>;
8
8
  type: "semanticText";
9
9
  props: {
10
10
  type: keyof SemanticText;
@@ -23,6 +23,7 @@ declare const Text_base: {
23
23
  }>>(newProps: T): /*elided*/ any;
24
24
  withStyle(style: string | Partial<CSSStyleDeclaration>): /*elided*/ any;
25
25
  withExtension(extension: (component: /*elided*/ any) => void): /*elided*/ any;
26
+ withState(): /*elided*/ any;
26
27
  };
27
28
  };
28
29
  export declare class Text extends Text_base {
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Text = void 0;
4
- const AbaComponent_js_1 = require("./AbaComponent.js");
5
- class Text extends (0, AbaComponent_js_1.intrinsic)("semanticText") {
4
+ const OxiComponent_js_1 = require("./OxiComponent.js");
5
+ class Text extends (0, OxiComponent_js_1.intrinsic)("semanticText") {
6
6
  constructor(text) {
7
7
  super();
8
8
  this.props = {
9
9
  type: "span",
10
10
  props: {
11
- content: text
12
- }
11
+ content: text,
12
+ },
13
13
  };
14
14
  }
15
15
  withStyle(style) {
@@ -1,10 +1,10 @@
1
- export * from "./AbaComponent.js";
2
- export * from "./AbaStateFull.js";
3
1
  export * from "./Animation.js";
4
2
  export * from "./Button.js";
5
3
  export * from "./HRow.js";
6
- export * from "./VRow.js";
7
4
  export * from "./InputText.js";
5
+ export * from "./OxiComponent.js";
6
+ export * from "./OxiStateFull.js";
8
7
  export * from "./Stack.js";
9
8
  export * from "./Text.js";
10
9
  export * from "./ui.js";
10
+ export * from "./VRow.js";
@@ -14,13 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./AbaComponent.js"), exports);
18
- __exportStar(require("./AbaStateFull.js"), exports);
19
17
  __exportStar(require("./Animation.js"), exports);
20
18
  __exportStar(require("./Button.js"), exports);
21
19
  __exportStar(require("./HRow.js"), exports);
22
- __exportStar(require("./VRow.js"), exports);
23
20
  __exportStar(require("./InputText.js"), exports);
21
+ __exportStar(require("./OxiComponent.js"), exports);
22
+ __exportStar(require("./OxiStateFull.js"), exports);
24
23
  __exportStar(require("./Stack.js"), exports);
25
24
  __exportStar(require("./Text.js"), exports);
26
25
  __exportStar(require("./ui.js"), exports);
26
+ __exportStar(require("./VRow.js"), exports);
@@ -1,5 +1,5 @@
1
1
  import type { IComponent } from "../types/component.js";
2
- import { type IntrinsicElements } from "../types/html.js";
2
+ import type { IntrinsicElements } from "../types/html.js";
3
3
  export declare class HTMLRenderer {
4
4
  private rootBody;
5
5
  private oldRoot?;
@@ -24,8 +24,7 @@ class HTMLRenderer {
24
24
  this.replaceNode(index, newNode);
25
25
  this.oldRoot = this.cloneTree(tree);
26
26
  this.nodeMap.forEach((e, k) => {
27
- // clean map
28
- if (!this.findByIndex(this.oldRoot, k)) {
27
+ if (!this.oldRoot || !this.findByIndex(this.oldRoot, k)) {
29
28
  this.nodeMap.delete(k);
30
29
  }
31
30
  });
@@ -89,7 +88,7 @@ class HTMLRenderer {
89
88
  };
90
89
  }
91
90
  renderNode(node) {
92
- if (node.type === 'semanticText')
91
+ if (node.type === "semanticText")
93
92
  return this.renderTextNode(node);
94
93
  const element = document.createElement(node.type);
95
94
  element.setAttribute("id", node.index);
@@ -119,9 +118,9 @@ class HTMLRenderer {
119
118
  this.rootBody.replaceChildren(fragment);
120
119
  }
121
120
  replaceNode(index, node) {
122
- if (index === '0')
121
+ if (index === "0")
123
122
  this.replaceRoot(node);
124
- const oldNode = this.findByIndex(this.oldRoot, index);
123
+ const oldNode = this.oldRoot && this.findByIndex(this.oldRoot, index);
125
124
  if (!oldNode)
126
125
  return;
127
126
  const domNode = this.nodeMap.get(oldNode.index);
@@ -154,9 +153,7 @@ class HTMLRenderer {
154
153
  applyCommonProps(element, props) {
155
154
  var _a, _b, _c, _d, _e, _f;
156
155
  if (props.content !== undefined) {
157
- const value = typeof props.content === "function"
158
- ? props.content()
159
- : props.content;
156
+ const value = typeof props.content === "function" ? props.content() : props.content;
160
157
  element.textContent = String(value);
161
158
  }
162
159
  this.applyStyle(element, props.style);
@@ -0,0 +1 @@
1
+ export * from "./html";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./html"), exports);
@@ -1,4 +1,4 @@
1
- import type { DivContainer } from "./elements/AbaStateFull";
1
+ import type { DivContainer } from "./elements";
2
2
  import type { IComponent } from "./types/component";
3
3
  import type { IntrinsicElements } from "./types/html";
4
4
  type RenderCallback = (stateId: string, readers: Set<string>, root: IComponent<keyof IntrinsicElements>) => void;
@@ -50,7 +50,9 @@ function performRender(stateId, readers) {
50
50
  (0, renderer_1.resetCursor)();
51
51
  app.body();
52
52
  renderCallback(stateId, readers, app);
53
- postRenderQueue.forEach((fn) => fn());
53
+ postRenderQueue.forEach((fn) => {
54
+ fn();
55
+ });
54
56
  postRenderQueue.length = 0;
55
57
  clearCursors(app);
56
58
  }
@@ -86,7 +88,9 @@ function startImmediateMode() {
86
88
  (0, renderer_1.resetCursor)();
87
89
  app.body();
88
90
  renderCallback === null || renderCallback === void 0 ? void 0 : renderCallback("", new Set(), app);
89
- postRenderQueue.forEach((fn) => fn());
91
+ postRenderQueue.forEach((fn) => {
92
+ fn();
93
+ });
90
94
  postRenderQueue.length = 0;
91
95
  clearCursors(app);
92
96
  frameId = requestAnimationFrame(loop);
@@ -17,9 +17,7 @@ function isCommonProps(props) {
17
17
  return false;
18
18
  if ("content" in props) {
19
19
  const c = props.content;
20
- const valid = typeof c === "string" ||
21
- typeof c === "number" ||
22
- typeof c === "function";
20
+ const valid = typeof c === "string" || typeof c === "number" || typeof c === "function";
23
21
  if (!valid)
24
22
  return false;
25
23
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./core/elements";
2
+ export * from "./core/renderers";
2
3
  export * from "./core/scheduler";
3
4
  export * from "./core/signals";
package/dist/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./core/elements"), exports);
18
+ __exportStar(require("./core/renderers"), exports);
18
19
  __exportStar(require("./core/scheduler"), exports);
19
20
  __exportStar(require("./core/signals"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxiui-lib",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "module": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import type { DivContainer } from "./elements/AbaStateFull";
1
+ import type { DivContainer } from "./elements";
2
2
  import { resetCursor } from "./renderer";
3
3
  import type { IComponent } from "./types/component";
4
4
  import type { IntrinsicElements } from "./types/html";
@@ -64,7 +64,9 @@ function performRender(stateId: string, readers: Set<string>) {
64
64
  resetCursor();
65
65
  app.body();
66
66
  renderCallback(stateId, readers, app as IComponent<keyof IntrinsicElements>);
67
- postRenderQueue.forEach((fn) => fn());
67
+ postRenderQueue.forEach((fn) => {
68
+ fn();
69
+ });
68
70
  postRenderQueue.length = 0;
69
71
  clearCursors(app as IComponent<keyof IntrinsicElements>);
70
72
  }
@@ -105,7 +107,9 @@ export function startImmediateMode() {
105
107
  resetCursor();
106
108
  app.body();
107
109
  renderCallback?.("", new Set(), app as IComponent<keyof IntrinsicElements>);
108
- postRenderQueue.forEach((fn) => fn());
110
+ postRenderQueue.forEach((fn) => {
111
+ fn();
112
+ });
109
113
  postRenderQueue.length = 0;
110
114
  clearCursors(app as IComponent<keyof IntrinsicElements>);
111
115
  frameId = requestAnimationFrame(loop);