@peachy/react 0.0.5 → 0.0.7

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/dist/extra.mjs CHANGED
@@ -3,18 +3,31 @@ import Gtk from "gi://Gtk?version=4.0";
3
3
 
4
4
  //#region src/extra.ts
5
5
  let builder;
6
- const extraMap = new Map([[Gtk.Buildable.$gtype, { appendChild: (parentInstance, child) => {
7
- builder ??= Gtk.Builder.new();
8
- const metadata = getMetadata(child);
9
- parentInstance.vfunc_add_child(builder, child, metadata?.childType ?? null);
10
- } }], [Gtk.Window.$gtype, {
11
- appendChild: (parentInstance, child) => {
12
- parentInstance.set_child(child);
13
- },
14
- removeChild: (parentInstance) => {
15
- parentInstance.set_child(null);
16
- }
17
- }]]);
6
+ const extraMap = new Map([
7
+ [Gtk.Buildable.$gtype, { appendChild: (parentInstance, child) => {
8
+ builder ??= Gtk.Builder.new();
9
+ const metadata = getMetadata(child);
10
+ parentInstance.vfunc_add_child(builder, child, metadata?.childType ?? null);
11
+ } }],
12
+ [Gtk.Window.$gtype, {
13
+ appendChild: (parentInstance, child) => {
14
+ parentInstance.set_child(child);
15
+ },
16
+ removeChild: (parentInstance) => {
17
+ parentInstance.set_child(null);
18
+ }
19
+ }],
20
+ [Gtk.Overlay.$gtype, {
21
+ appendChild(parentInstance, child) {
22
+ if (getMetadata(child)?.childType === "overlay") parentInstance.add_overlay(child);
23
+ else parentInstance.set_child(child);
24
+ },
25
+ removeChild(parentInstance, child) {
26
+ if (getMetadata(child)?.childType === "overlay") parentInstance.remove_overlay(child);
27
+ else parentInstance.set_child(null);
28
+ }
29
+ }]
30
+ ]);
18
31
 
19
32
  //#endregion
20
33
  export { extraMap };
@@ -39,11 +39,11 @@ function removeChild(parentInstance, child) {
39
39
  if (props.removeChild) return props.removeChild(parentInstance, child);
40
40
  }
41
41
  if ("child" in parentInstance) {
42
- parentInstance.child = void 0;
42
+ parentInstance.child = null;
43
43
  return;
44
44
  }
45
45
  if ("content" in parentInstance) {
46
- parentInstance.content = void 0;
46
+ parentInstance.content = null;
47
47
  return;
48
48
  }
49
49
  child.unparent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peachy/react",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Run GJS applications with react",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
@@ -20,7 +20,7 @@
20
20
  "react": "^19.2.3",
21
21
  "react-reconciler": "^0.33.0",
22
22
  "reflect-metadata": "^0.2.2",
23
- "@peachy/core": "0.0.5"
23
+ "@peachy/core": "0.0.7"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/react": "^19.2.8",