@unsetsoft/ryunixjs 0.1.11 → 0.1.12-beta.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.
package/lib/component.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { scheduleUpdate } from "./reconciler";
2
+
2
3
  export class Component {
3
4
  constructor(props) {
4
5
  this.props = props;
@@ -12,3 +13,13 @@ export class Component {
12
13
  );
13
14
  }
14
15
  }
16
+
17
+ export class Fragment {
18
+ constructor(props) {
19
+ this.props = props;
20
+ }
21
+
22
+ render() {
23
+ return this.props.children;
24
+ }
25
+ }
package/lib/reconciler.js CHANGED
@@ -448,6 +448,12 @@ export function scheduleUpdate(instance, partialState) {
448
448
  });
449
449
  }
450
450
 
451
+ let rootElement;
452
+
453
+ export const createRoot = (parentDom) => {
454
+ rootElement = parentDom;
455
+ };
456
+
451
457
  /**
452
458
  * The `render` function takes in elements and a parent DOM node, and schedules a reconciliation
453
459
  * process to update the DOM with the new elements.
@@ -455,6 +461,16 @@ export function scheduleUpdate(instance, partialState) {
455
461
  * @param parentDom - parentDom is a reference to the DOM element where the rendered elements will be
456
462
  * appended as children. It is the container element for the rendered components.
457
463
  */
464
+
465
+ export function rootClient(elements) {
466
+ workQueue.push({
467
+ from: "root",
468
+ dom: rootElement,
469
+ newProps: { children: elements },
470
+ });
471
+ requestIdleCallback(performWork);
472
+ }
473
+
458
474
  export function render(elements, parentDom) {
459
475
  workQueue.push({
460
476
  from: HOST_ROOT,
package/lib/ryunix.js CHANGED
@@ -1,10 +1,13 @@
1
- import { render } from "./reconciler";
1
+ import { render, rootClient, createRoot } from "./reconciler";
2
2
  import { createElement } from "./element";
3
- import { Component } from "./component";
3
+ import { Component, Fragment } from "./component";
4
4
  import { useLoaded } from "./hooks";
5
- export { createElement, render, Component, useLoaded };
5
+ export { createElement, render, Component, useLoaded, Fragment };
6
6
  export default {
7
7
  render,
8
8
  createElement,
9
9
  Component,
10
+ Fragment,
11
+ rootClient,
12
+ createRoot,
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "0.1.11",
3
+ "version": "0.1.12-beta.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.js",
6
6
  "private": false,