@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 +25 -12
- package/dist/utilities/children.mjs +2 -2
- package/package.json +2 -2
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([
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 =
|
|
42
|
+
parentInstance.child = null;
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if ("content" in parentInstance) {
|
|
46
|
-
parentInstance.content =
|
|
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.
|
|
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.
|
|
23
|
+
"@peachy/core": "0.0.7"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/react": "^19.2.8",
|