@gtkx/react 1.3.0 → 1.5.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/README.md +5 -4
- package/dist/adw/dialog.js +2 -2
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +19 -107
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +3 -3
- package/dist/components/application.js.map +1 -1
- package/dist/components/window.js +3 -3
- package/dist/components/window.js.map +1 -1
- package/dist/element-behaviors.js +55 -60
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.js +1 -1
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +3 -2
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-property.d.ts +1 -1
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +5 -1
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/prop-types.d.ts +9 -1
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts +2 -1
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +59 -24
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +19 -3
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +73 -17
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +2 -1
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +6 -1
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +39 -6
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/placement.js +4 -4
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +2 -0
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +3 -2
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +49 -16
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/style.d.ts +2 -1
- package/dist/reconciler/style.d.ts.map +1 -1
- package/dist/reconciler/style.js +4 -3
- package/dist/reconciler/style.js.map +1 -1
- package/dist/reconciler/text.js +3 -3
- package/dist/reconciler/text.js.map +1 -1
- package/env.d.ts +10 -7
- package/package.json +6 -6
- package/src/adw/dialog.tsx +2 -2
- package/src/adw/element-behaviors.ts +22 -162
- package/src/components/application.tsx +18 -3
- package/src/components/window.tsx +3 -3
- package/src/element-behaviors.ts +75 -96
- package/src/element-config.ts +1 -1
- package/src/hooks/use-bind-setting.ts +3 -2
- package/src/hooks/use-property.ts +6 -2
- package/src/prop-types.ts +10 -0
- package/src/reconciler/apply-props.ts +73 -26
- package/src/reconciler/behaviors.ts +130 -33
- package/src/reconciler/host-config.ts +3 -1
- package/src/reconciler/metadata.ts +62 -6
- package/src/reconciler/placement.ts +4 -4
- package/src/reconciler/registry.ts +2 -0
- package/src/reconciler/root.ts +1 -1
- package/src/reconciler/signals.ts +62 -17
- package/src/reconciler/style.ts +4 -3
- package/src/reconciler/text.ts +3 -3
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<h1 align="center">GTKX</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
The React framework for Linux.<br />
|
|
9
|
-
Write native
|
|
10
|
-
|
|
8
|
+
The React framework for Linux, built on GTK.<br />
|
|
9
|
+
Write native GTK4 desktop applications with React and TypeScript.
|
|
10
|
+
Real GTK widgets, the GNOME stack, and standard web tooling.
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
@@ -98,7 +98,7 @@ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing r
|
|
|
98
98
|
- a React reconciler that exposes every GObject as a JSX element,
|
|
99
99
|
- a CLI for scaffolding, development, and production builds,
|
|
100
100
|
- a dev server with Fast Refresh that patches your running UI in place,
|
|
101
|
-
- CSS-in-JS styling, React Spring animations, and high-level list, grid, and dialog components,
|
|
101
|
+
- CSS-in-JS styling, React Hook Form-powered Adwaita controls, gettext-backed react-i18next localization, React Spring animations, React Navigation stack, tab, drawer, and split view navigators, and high-level list, grid, and dialog components,
|
|
102
102
|
- a Testing Library-style API for querying and driving your widgets in tests,
|
|
103
103
|
- and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
|
|
104
104
|
|
|
@@ -158,6 +158,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
|
158
158
|
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
|
|
159
159
|
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
|
|
160
160
|
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): a tour of `@gtkx/animated`, React Spring animations driven by the GTK frame clock.
|
|
161
|
+
- [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
|
|
161
162
|
- [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
|
|
162
163
|
|
|
163
164
|
## Status
|
package/dist/adw/dialog.js
CHANGED
|
@@ -2,9 +2,9 @@ import { useCallback } from "react";
|
|
|
2
2
|
import { createPortaledComponent } from "../components/portaled.js";
|
|
3
3
|
import { useParentWindow } from "../hooks/use-parent-window.js";
|
|
4
4
|
import { createPresentedComponent } from "../hooks/use-presented-instance.js";
|
|
5
|
-
import {
|
|
5
|
+
import { applyMutation } from "../reconciler/signals.js";
|
|
6
6
|
const closeDialog = (dialog) => {
|
|
7
|
-
|
|
7
|
+
applyMutation(() => {
|
|
8
8
|
dialog.forceClose();
|
|
9
9
|
});
|
|
10
10
|
};
|
package/dist/adw/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoC,WAAW,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoC,WAAW,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAQ,EAAE;IAC7C,aAAa,CAAC,GAAG,EAAE;QACf,MAAM,CAAC,UAAU,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,GAAmC,EAAE;IAC1D,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IAEjC,OAAO,WAAW,CACd,CAAC,MAAkB,EAAE,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,EACD,CAAC,MAAM,CAAC,CACX,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,SAAsB,EAAgD,EAAE,CACnG,uBAAuB,CACnB,wBAAwB,CAAa,SAAS,EAAE;IAC5C,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,WAAW;CACvB,CAAC,CACL,CAAC;AAEN,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport { type ElementType, type ReactNode, useCallback } from \"react\";\nimport { createPortaledComponent } from \"../components/portaled.js\";\nimport { useParentWindow } from \"../hooks/use-parent-window.js\";\nimport { createPresentedComponent, type PresentedProps } from \"../hooks/use-presented-instance.js\";\nimport { applyMutation } from \"../reconciler/signals.js\";\n\ntype DialogComponentProps = PresentedProps<Adw.Dialog>;\n\nconst closeDialog = (dialog: Adw.Dialog): void => {\n applyMutation(() => {\n dialog.forceClose();\n });\n};\n\nconst usePresentDialog = (): ((dialog: Adw.Dialog) => void) => {\n const parent = useParentWindow();\n\n return useCallback(\n (dialog: Adw.Dialog) => {\n dialog.present(parent);\n },\n [parent],\n );\n};\n\nconst createDialogComponent = (Component: ElementType): ((props: DialogComponentProps) => ReactNode) =>\n createPortaledComponent(\n createPresentedComponent<Adw.Dialog>(Component, {\n usePresent: usePresentDialog,\n dismiss: closeDialog,\n }),\n );\n\n/** @internal */\nexport { createDialogComponent };\n"]}
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import * as Adw from "@gtkx/gi/adw";
|
|
2
|
-
import {
|
|
2
|
+
import { applicationCreator, boxSlot, childMatcher, childSetterSlot, contentSetterSlot, deferred, indexedSlot, list, methodSlot, setterSlot, slot, } from "../reconciler/behaviors.js";
|
|
3
3
|
import { forTypes, registerElements } from "../reconciler/registry.js";
|
|
4
4
|
import { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from "./element-config.js";
|
|
5
5
|
const SLOT_SUFFIX = "Slot";
|
|
6
6
|
const childSetter = childSetterSlot();
|
|
7
7
|
const contentSetter = contentSetterSlot();
|
|
8
|
-
const breakpoints =
|
|
9
|
-
attach: (host, breakpoint) => {
|
|
10
|
-
host.addBreakpoint(breakpoint);
|
|
11
|
-
},
|
|
12
|
-
});
|
|
8
|
+
const breakpoints = methodSlot("breakpoints", "AdwBreakpoint", "addBreakpoint");
|
|
13
9
|
const prefixSuffix = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, (row, child) => {
|
|
17
|
-
row.remove(child);
|
|
18
|
-
}),
|
|
19
|
-
addRemoveSlot("suffix", "GtkWidget", (row, child) => {
|
|
20
|
-
row.addSuffix(child);
|
|
21
|
-
}, (row, child) => {
|
|
22
|
-
row.remove(child);
|
|
23
|
-
}),
|
|
10
|
+
methodSlot("prefix", "GtkWidget", "addPrefix", "remove"),
|
|
11
|
+
methodSlot("suffix", "GtkWidget", "addSuffix", "remove"),
|
|
24
12
|
];
|
|
25
|
-
const preferencesDialogChildren =
|
|
26
|
-
|
|
27
|
-
}, (dialog, page) => {
|
|
28
|
-
dialog.remove(page);
|
|
29
|
-
});
|
|
30
|
-
const alertDialogExtraChild = slot("children", "GtkWidget", {
|
|
31
|
-
attach: (dialog, child) => {
|
|
32
|
-
dialog.setExtraChild(child);
|
|
33
|
-
},
|
|
34
|
-
detach: (dialog) => {
|
|
35
|
-
dialog.setExtraChild(null);
|
|
36
|
-
},
|
|
37
|
-
});
|
|
13
|
+
const preferencesDialogChildren = methodSlot("children", "AdwPreferencesPage", "add", "remove");
|
|
14
|
+
const alertDialogExtraChild = setterSlot("children", "GtkWidget", "setExtraChild");
|
|
38
15
|
const sidebarSections = indexedSlot("children", "AdwSidebarSection");
|
|
39
16
|
const sidebarItems = indexedSlot("children", "AdwSidebarItem");
|
|
40
17
|
const isWidget = childMatcher("GtkWidget");
|
|
@@ -90,14 +67,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
90
67
|
},
|
|
91
68
|
AdwClampScrollable: {
|
|
92
69
|
behaviors: [
|
|
93
|
-
|
|
94
|
-
attach: (clamp, child) => {
|
|
95
|
-
clamp.setChild(child);
|
|
96
|
-
},
|
|
97
|
-
detach: (clamp) => {
|
|
98
|
-
clamp.setChild(null);
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
70
|
+
setterSlot("children", "GtkScrollable", "setChild"),
|
|
101
71
|
],
|
|
102
72
|
},
|
|
103
73
|
...forTypes(CHILD_SETTER_TYPES, {
|
|
@@ -118,11 +88,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
118
88
|
AdwBreakpointBin: {
|
|
119
89
|
behaviors: [
|
|
120
90
|
childSetter,
|
|
121
|
-
|
|
122
|
-
bin.addBreakpoint(breakpoint);
|
|
123
|
-
}, (bin, breakpoint) => {
|
|
124
|
-
bin.removeBreakpoint(breakpoint);
|
|
125
|
-
}),
|
|
91
|
+
methodSlot("breakpoints", "AdwBreakpoint", "addBreakpoint", "removeBreakpoint"),
|
|
126
92
|
],
|
|
127
93
|
},
|
|
128
94
|
AdwActionRow: {
|
|
@@ -134,11 +100,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
134
100
|
AdwExpanderRow: {
|
|
135
101
|
behaviors: [
|
|
136
102
|
...prefixSuffix,
|
|
137
|
-
|
|
138
|
-
row.addRow(child);
|
|
139
|
-
}, (row, child) => {
|
|
140
|
-
row.remove(child);
|
|
141
|
-
}),
|
|
103
|
+
methodSlot("rows", "GtkWidget", "addRow", "remove"),
|
|
142
104
|
],
|
|
143
105
|
},
|
|
144
106
|
AdwNavigationSplitView: {
|
|
@@ -178,13 +140,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
178
140
|
behaviors: [preferencesDialogChildren],
|
|
179
141
|
},
|
|
180
142
|
AdwPreferencesGroup: {
|
|
181
|
-
behaviors: [
|
|
182
|
-
addRemoveSlot("children", "GtkWidget", (group, child) => {
|
|
183
|
-
group.add(child);
|
|
184
|
-
}, (group, child) => {
|
|
185
|
-
group.remove(child);
|
|
186
|
-
}),
|
|
187
|
-
],
|
|
143
|
+
behaviors: [methodSlot("children", "GtkWidget", "add", "remove")],
|
|
188
144
|
},
|
|
189
145
|
AdwTabView: {
|
|
190
146
|
behaviors: [
|
|
@@ -206,81 +162,37 @@ const BUILTIN_BEHAVIORS = {
|
|
|
206
162
|
},
|
|
207
163
|
AdwNavigationView: {
|
|
208
164
|
behaviors: [
|
|
209
|
-
|
|
210
|
-
view.add(page);
|
|
211
|
-
}, (view, page) => {
|
|
212
|
-
view.remove(page);
|
|
213
|
-
}),
|
|
165
|
+
methodSlot("children", "AdwNavigationPage", "add", "remove"),
|
|
214
166
|
],
|
|
215
167
|
},
|
|
216
168
|
AdwViewStack: {
|
|
217
169
|
behaviors: [
|
|
218
|
-
|
|
219
|
-
stack.remove(child);
|
|
220
|
-
}),
|
|
170
|
+
methodSlot("children", "GtkWidget", "add", "remove"),
|
|
221
171
|
deferred("visibleChildName", (stack, name) => stack.getChildByName(name) !== null),
|
|
222
172
|
],
|
|
223
173
|
},
|
|
224
174
|
AdwToolbarView: {
|
|
225
175
|
behaviors: [
|
|
226
176
|
contentSetterSlot(),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}, (view, child) => {
|
|
230
|
-
view.remove(child);
|
|
231
|
-
}),
|
|
232
|
-
addRemoveSlot("bottomBar", "GtkWidget", (view, child) => {
|
|
233
|
-
view.addBottomBar(child);
|
|
234
|
-
}, (view, child) => {
|
|
235
|
-
view.remove(child);
|
|
236
|
-
}),
|
|
177
|
+
methodSlot("topBar", "GtkWidget", "addTopBar", "remove"),
|
|
178
|
+
methodSlot("bottomBar", "GtkWidget", "addBottomBar", "remove"),
|
|
237
179
|
],
|
|
238
180
|
},
|
|
239
181
|
AdwHeaderBar: {
|
|
240
182
|
behaviors: [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
bar.packStart(child);
|
|
244
|
-
},
|
|
245
|
-
detach: (bar, child) => {
|
|
246
|
-
bar.remove(child);
|
|
247
|
-
},
|
|
248
|
-
}),
|
|
249
|
-
slot("end", "GtkWidget", {
|
|
250
|
-
attach: (bar, child) => {
|
|
251
|
-
bar.packEnd(child);
|
|
252
|
-
},
|
|
253
|
-
detach: (bar, child) => {
|
|
254
|
-
bar.remove(child);
|
|
255
|
-
},
|
|
256
|
-
}),
|
|
183
|
+
methodSlot("start", "GtkWidget", "packStart", "remove"),
|
|
184
|
+
methodSlot("end", "GtkWidget", "packEnd", "remove"),
|
|
257
185
|
],
|
|
258
186
|
},
|
|
259
187
|
AdwShortcutsDialog: {
|
|
260
|
-
behaviors: [
|
|
261
|
-
slot("children", "AdwShortcutsSection", {
|
|
262
|
-
attach: (dialog, section) => {
|
|
263
|
-
dialog.add(section);
|
|
264
|
-
},
|
|
265
|
-
}),
|
|
266
|
-
],
|
|
188
|
+
behaviors: [methodSlot("children", "AdwShortcutsSection", "add")],
|
|
267
189
|
},
|
|
268
190
|
AdwShortcutsSection: {
|
|
269
|
-
behaviors: [
|
|
270
|
-
slot("children", "AdwShortcutsItem", {
|
|
271
|
-
attach: (section, item) => {
|
|
272
|
-
section.add(item);
|
|
273
|
-
},
|
|
274
|
-
}),
|
|
275
|
-
],
|
|
191
|
+
behaviors: [methodSlot("children", "AdwShortcutsItem", "add")],
|
|
276
192
|
},
|
|
277
193
|
AdwToggleGroup: {
|
|
278
194
|
behaviors: [
|
|
279
|
-
|
|
280
|
-
group.add(toggle);
|
|
281
|
-
}, (group, toggle) => {
|
|
282
|
-
group.remove(toggle);
|
|
283
|
-
}),
|
|
195
|
+
methodSlot("children", "AdwToggle", "add", "remove"),
|
|
284
196
|
deferred("activeName", (group, name) => group.getToggleByName(name) !== null),
|
|
285
197
|
deferred("active"),
|
|
286
198
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../../src/adw/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC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IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACnC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport * as Adw from \"@gtkx/gi/adw\";\nimport type { AlertDialogResponse } from \"./prop-types.js\";\nimport {\n addRemoveSlot,\n adoptedChildrenSlot,\n applicationCreator,\n boxSlot,\n childMatcher,\n childSetterSlot,\n contentSetterSlot,\n deferred,\n indexedSlot,\n list,\n slot,\n} from \"../reconciler/behaviors.js\";\nimport { type ElementBehavior, type ElementConfig, forTypes, registerElements } from \"../reconciler/registry.js\";\nimport { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from \"./element-config.js\";\n\ntype AdwChildSetter =\n | Adw.Bin |\n Adw.BreakpointBin |\n Adw.Clamp |\n Adw.Dialog |\n Adw.NavigationPage |\n Adw.SplitButton |\n Adw.StatusPage |\n Adw.TabOverview |\n Adw.ToastOverlay |\n Adw.Toggle;\n\ntype AdwContentSetter = Adw.ApplicationWindow | Adw.BottomSheet | Adw.OverlaySplitView | Adw.Window;\ntype BreakpointHost = Adw.ApplicationWindow | Adw.Window | Adw.Dialog;\ntype PrefixSuffixRow = Adw.ActionRow | Adw.EntryRow | Adw.ExpanderRow;\n\nconst SLOT_SUFFIX = \"Slot\";\nconst childSetter = childSetterSlot<AdwChildSetter>();\nconst contentSetter = contentSetterSlot<AdwContentSetter>();\n\nconst breakpoints = slot<BreakpointHost, Adw.Breakpoint>(\"breakpoints\", \"AdwBreakpoint\", {\n attach: (host, breakpoint) => {\n host.addBreakpoint(breakpoint);\n },\n});\n\nconst prefixSuffix = [\n addRemoveSlot<Gtk.Widget, PrefixSuffixRow>(\n \"prefix\",\n \"GtkWidget\",\n (row, child) => {\n row.addPrefix(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, PrefixSuffixRow>(\n \"suffix\",\n \"GtkWidget\",\n (row, child) => {\n row.addSuffix(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n];\n\nconst preferencesDialogChildren = addRemoveSlot<Adw.PreferencesPage, Adw.PreferencesDialog>(\n \"children\",\n \"AdwPreferencesPage\",\n (dialog, page) => {\n dialog.add(page);\n },\n (dialog, page) => {\n dialog.remove(page);\n },\n);\n\nconst alertDialogExtraChild = slot<Adw.AlertDialog, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (dialog, child) => {\n dialog.setExtraChild(child);\n },\n detach: (dialog) => {\n dialog.setExtraChild(null);\n },\n});\n\nconst sidebarSections = indexedSlot<Adw.Sidebar, Adw.SidebarSection>(\"children\", \"AdwSidebarSection\");\nconst sidebarItems = indexedSlot<Adw.SidebarSection, Adw.SidebarItem>(\"children\", \"AdwSidebarItem\");\nconst isWidget = childMatcher(\"GtkWidget\");\n\nconst multiLayoutSlots: ElementBehavior<Adw.MultiLayoutView> = {\n attach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n view.setChild(id, child as Gtk.Widget);\n\n return true;\n },\n detach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n const widget = child as Gtk.Widget;\n\n if (view.getChild(id) === widget) {\n widget.unparent();\n }\n },\n};\n\nconst multiLayoutLayouts = slot<Adw.MultiLayoutView, Gtk.Widget>(\"layouts\", \"GtkWidget\", {\n attach: (view, content) => {\n const layout = new Adw.Layout({ content });\n view.addLayout(layout);\n\n return layout;\n },\n reorder: (_view, _content, info) => info.adopted,\n detach: (view, _content, info) => {\n if (info.adopted instanceof Adw.Layout) {\n view.removeLayout(info.adopted);\n }\n },\n});\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n AdwApplication: {\n behaviors: [applicationCreator(Adw.Application)],\n },\n AdwSidebar: {\n behaviors: [sidebarSections],\n },\n AdwSidebarSection: {\n behaviors: [sidebarItems],\n },\n AdwMultiLayoutView: {\n behaviors: [\n multiLayoutLayouts,\n multiLayoutSlots,\n deferred<Adw.MultiLayoutView, string>(\"layoutName\", (view, name) => view.getLayoutByName(name) !== null),\n ],\n },\n AdwClampScrollable: {\n behaviors: [\n slot<Adw.ClampScrollable, Gtk.Scrollable & Gtk.Widget>(\"children\", \"GtkScrollable\", {\n attach: (clamp, child) => {\n clamp.setChild(child);\n },\n detach: (clamp) => {\n clamp.setChild(null);\n },\n }),\n ],\n },\n ...forTypes(CHILD_SETTER_TYPES, {\n behaviors: [childSetter],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n behaviors: [contentSetter],\n }),\n AdwDialog: {\n behaviors: [childSetter, breakpoints],\n },\n AdwApplicationWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwBreakpointBin: {\n behaviors: [\n childSetter,\n addRemoveSlot<Adw.Breakpoint, Adw.BreakpointBin>(\n \"breakpoints\",\n \"AdwBreakpoint\",\n (bin, breakpoint) => {\n bin.addBreakpoint(breakpoint);\n },\n (bin, breakpoint) => {\n bin.removeBreakpoint(breakpoint);\n },\n ),\n ],\n },\n AdwActionRow: {\n behaviors: prefixSuffix,\n },\n AdwEntryRow: {\n behaviors: prefixSuffix,\n },\n AdwExpanderRow: {\n behaviors: [\n ...prefixSuffix,\n addRemoveSlot<Gtk.Widget, Adw.ExpanderRow>(\n \"rows\",\n \"GtkWidget\",\n (row, child) => {\n row.addRow(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n ],\n },\n AdwNavigationSplitView: {\n behaviors: [contentSetterSlot<Adw.NavigationSplitView, Adw.NavigationPage>(\"AdwNavigationPage\")],\n },\n AdwWrapBox: {\n behaviors: [boxSlot<Adw.WrapBox>()],\n },\n AdwCarousel: {\n behaviors: [\n slot<Adw.Carousel, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (carousel, child, info) => {\n carousel.insert(child, info.index);\n },\n detach: (carousel, child) => {\n carousel.remove(child);\n },\n reorder: (carousel, child, info) => {\n carousel.reorder(child, info.index);\n },\n }),\n ],\n },\n AdwPreferencesPage: {\n behaviors: [\n slot<Adw.PreferencesPage, Adw.PreferencesGroup>(\"children\", \"AdwPreferencesGroup\", {\n attach: (page, group, info) => {\n page.insert(group, info.index);\n },\n detach: (page, group) => {\n page.remove(group);\n },\n }),\n ],\n },\n AdwPreferencesDialog: {\n behaviors: [preferencesDialogChildren],\n },\n AdwPreferencesGroup: {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Adw.PreferencesGroup>(\n \"children\",\n \"GtkWidget\",\n (group, child) => {\n group.add(child);\n },\n (group, child) => {\n group.remove(child);\n },\n ),\n ],\n },\n AdwTabView: {\n behaviors: [\n slot<Adw.TabView, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (view, child, info) => view.insert(child, info.index),\n reorder: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.reorderPage(info.adopted, info.index);\n }\n },\n detach: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.closePage(info.adopted);\n }\n },\n resolve: (view, child) => view.getPage(child),\n }),\n ],\n },\n AdwNavigationView: {\n behaviors: [\n addRemoveSlot<Adw.NavigationPage, Adw.NavigationView>(\n \"children\",\n \"AdwNavigationPage\",\n (view, page) => {\n view.add(page);\n },\n (view, page) => {\n view.remove(page);\n },\n ),\n ],\n },\n AdwViewStack: {\n behaviors: [\n adoptedChildrenSlot<Adw.ViewStack, Gtk.Widget>(\n \"GtkWidget\",\n (stack, child) => stack.add(child),\n (stack, child) => {\n stack.remove(child);\n },\n ),\n deferred<Adw.ViewStack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n AdwToolbarView: {\n behaviors: [\n contentSetterSlot<Adw.ToolbarView>(),\n addRemoveSlot<Gtk.Widget, Adw.ToolbarView>(\n \"topBar\",\n \"GtkWidget\",\n (view, child) => {\n view.addTopBar(child);\n },\n (view, child) => {\n view.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, Adw.ToolbarView>(\n \"bottomBar\",\n \"GtkWidget\",\n (view, child) => {\n view.addBottomBar(child);\n },\n (view, child) => {\n view.remove(child);\n },\n ),\n ],\n },\n AdwHeaderBar: {\n behaviors: [\n slot<Adw.HeaderBar, Gtk.Widget>(\"start\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packStart(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n slot<Adw.HeaderBar, Gtk.Widget>(\"end\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packEnd(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n ],\n },\n AdwShortcutsDialog: {\n behaviors: [\n slot<Adw.ShortcutsDialog, Adw.ShortcutsSection>(\"children\", \"AdwShortcutsSection\", {\n attach: (dialog, section) => {\n dialog.add(section);\n },\n }),\n ],\n },\n AdwShortcutsSection: {\n behaviors: [\n slot<Adw.ShortcutsSection, Adw.ShortcutsItem>(\"children\", \"AdwShortcutsItem\", {\n attach: (section, item) => {\n section.add(item);\n },\n }),\n ],\n },\n AdwToggleGroup: {\n behaviors: [\n addRemoveSlot<Adw.Toggle, Adw.ToggleGroup>(\n \"children\",\n \"AdwToggle\",\n (group, toggle) => {\n group.add(toggle);\n },\n (group, toggle) => {\n group.remove(toggle);\n },\n ),\n deferred<Adw.ToggleGroup, string>(\"activeName\", (group, name) => group.getToggleByName(name) !== null),\n deferred(\"active\"),\n ],\n },\n AdwAlertDialog: {\n behaviors: [\n alertDialogExtraChild,\n list<Adw.AlertDialog, AlertDialogResponse>(\"responses\", {\n add: (dialog, response) => {\n dialog.addResponse(response.id, response.label);\n\n if (response.appearance !== undefined) {\n dialog.setResponseAppearance(response.id, response.appearance);\n }\n\n if (response.isEnabled !== undefined) {\n dialog.setResponseEnabled(response.id, response.isEnabled);\n }\n },\n remove: (dialog, response) => {\n dialog.removeResponse(response.id);\n },\n }),\n ],\n },\n};\n\nfunction getSlotId(name: string): string | null {\n if (name.length <= SLOT_SUFFIX.length || !name.endsWith(SLOT_SUFFIX)) {\n return null;\n }\n\n return name.slice(0, -SLOT_SUFFIX.length);\n}\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
|
|
1
|
+
{"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../../src/adw/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EACH,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,UAAU,EACV,UAAU,EACV,IAAI,GACP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAA4C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAkBjG,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,eAAe,EAAkB,CAAC;AACtD,MAAM,aAAa,GAAG,iBAAiB,EAAoB,CAAC;AAC5D,MAAM,WAAW,GAAG,UAAU,CAAiC,aAAa,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;AAEhH,MAAM,YAAY,GAAG;IACjB,UAAU,CAA8B,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC;IACrF,UAAU,CAA8B,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC;CACxF,CAAC;AAEF,MAAM,yBAAyB,GAAG,UAAU,CACxC,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,CACpD,CAAC;AAEF,MAAM,qBAAqB,GAAG,UAAU,CAA8B,UAAU,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op-types.js\";\nimport {\n applicationCreator,\n boxSlot,\n childMatcher,\n childSetterSlot,\n contentSetterSlot,\n deferred,\n indexedSlot,\n list,\n methodSlot,\n setterSlot,\n slot,\n} from \"../reconciler/behaviors.js\";\nimport { type ElementBehavior, type ElementConfig, forTypes, registerElements } from \"../reconciler/registry.js\";\nimport { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from \"./element-config.js\";\n\ntype AdwChildSetter =\n | Adw.Bin |\n Adw.BreakpointBin |\n Adw.Clamp |\n Adw.Dialog |\n Adw.NavigationPage |\n Adw.SplitButton |\n Adw.StatusPage |\n Adw.TabOverview |\n Adw.ToastOverlay |\n Adw.Toggle;\n\ntype AdwContentSetter = Adw.ApplicationWindow | Adw.BottomSheet | Adw.OverlaySplitView | Adw.Window;\ntype BreakpointHost = Adw.ApplicationWindow | Adw.Window | Adw.Dialog;\ntype PrefixSuffixRow = Adw.ActionRow | Adw.EntryRow | Adw.ExpanderRow;\n\nconst SLOT_SUFFIX = \"Slot\";\nconst childSetter = childSetterSlot<AdwChildSetter>();\nconst contentSetter = contentSetterSlot<AdwContentSetter>();\nconst breakpoints = methodSlot<BreakpointHost, Adw.Breakpoint>(\"breakpoints\", \"AdwBreakpoint\", \"addBreakpoint\");\n\nconst prefixSuffix = [\n methodSlot<PrefixSuffixRow, Gtk.Widget>(\"prefix\", \"GtkWidget\", \"addPrefix\", \"remove\"),\n methodSlot<PrefixSuffixRow, Gtk.Widget>(\"suffix\", \"GtkWidget\", \"addSuffix\", \"remove\"),\n];\n\nconst preferencesDialogChildren = methodSlot<Adw.PreferencesDialog, Adw.PreferencesPage>(\n \"children\", \"AdwPreferencesPage\", \"add\", \"remove\",\n);\n\nconst alertDialogExtraChild = setterSlot<Adw.AlertDialog, Gtk.Widget>(\"children\", \"GtkWidget\", \"setExtraChild\");\nconst sidebarSections = indexedSlot<Adw.Sidebar, Adw.SidebarSection>(\"children\", \"AdwSidebarSection\");\nconst sidebarItems = indexedSlot<Adw.SidebarSection, Adw.SidebarItem>(\"children\", \"AdwSidebarItem\");\nconst isWidget = childMatcher(\"GtkWidget\");\n\nconst multiLayoutSlots: ElementBehavior<Adw.MultiLayoutView> = {\n attach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n view.setChild(id, child as Gtk.Widget);\n\n return true;\n },\n detach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n const widget = child as Gtk.Widget;\n\n if (view.getChild(id) === widget) {\n widget.unparent();\n }\n },\n};\n\nconst multiLayoutLayouts = slot<Adw.MultiLayoutView, Gtk.Widget>(\"layouts\", \"GtkWidget\", {\n attach: (view, content) => {\n const layout = new Adw.Layout({ content });\n view.addLayout(layout);\n\n return layout;\n },\n reorder: (_view, _content, info) => info.adopted,\n detach: (view, _content, info) => {\n if (info.adopted instanceof Adw.Layout) {\n view.removeLayout(info.adopted);\n }\n },\n});\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n AdwApplication: {\n behaviors: [applicationCreator(Adw.Application)],\n },\n AdwSidebar: {\n behaviors: [sidebarSections],\n },\n AdwSidebarSection: {\n behaviors: [sidebarItems],\n },\n AdwMultiLayoutView: {\n behaviors: [\n multiLayoutLayouts,\n multiLayoutSlots,\n deferred<Adw.MultiLayoutView, string>(\"layoutName\", (view, name) => view.getLayoutByName(name) !== null),\n ],\n },\n AdwClampScrollable: {\n behaviors: [\n setterSlot<Adw.ClampScrollable, Gtk.Scrollable & Gtk.Widget>(\"children\", \"GtkScrollable\", \"setChild\"),\n ],\n },\n ...forTypes(CHILD_SETTER_TYPES, {\n behaviors: [childSetter],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n behaviors: [contentSetter],\n }),\n AdwDialog: {\n behaviors: [childSetter, breakpoints],\n },\n AdwApplicationWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwBreakpointBin: {\n behaviors: [\n childSetter,\n methodSlot<Adw.BreakpointBin, Adw.Breakpoint>(\n \"breakpoints\", \"AdwBreakpoint\", \"addBreakpoint\", \"removeBreakpoint\",\n ),\n ],\n },\n AdwActionRow: {\n behaviors: prefixSuffix,\n },\n AdwEntryRow: {\n behaviors: prefixSuffix,\n },\n AdwExpanderRow: {\n behaviors: [\n ...prefixSuffix,\n methodSlot<Adw.ExpanderRow, Gtk.Widget>(\"rows\", \"GtkWidget\", \"addRow\", \"remove\"),\n ],\n },\n AdwNavigationSplitView: {\n behaviors: [contentSetterSlot<Adw.NavigationSplitView, Adw.NavigationPage>(\"AdwNavigationPage\")],\n },\n AdwWrapBox: {\n behaviors: [boxSlot<Adw.WrapBox>()],\n },\n AdwCarousel: {\n behaviors: [\n slot<Adw.Carousel, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (carousel, child, info) => {\n carousel.insert(child, info.index);\n },\n detach: (carousel, child) => {\n carousel.remove(child);\n },\n reorder: (carousel, child, info) => {\n carousel.reorder(child, info.index);\n },\n }),\n ],\n },\n AdwPreferencesPage: {\n behaviors: [\n slot<Adw.PreferencesPage, Adw.PreferencesGroup>(\"children\", \"AdwPreferencesGroup\", {\n attach: (page, group, info) => {\n page.insert(group, info.index);\n },\n detach: (page, group) => {\n page.remove(group);\n },\n }),\n ],\n },\n AdwPreferencesDialog: {\n behaviors: [preferencesDialogChildren],\n },\n AdwPreferencesGroup: {\n behaviors: [methodSlot<Adw.PreferencesGroup, Gtk.Widget>(\"children\", \"GtkWidget\", \"add\", \"remove\")],\n },\n AdwTabView: {\n behaviors: [\n slot<Adw.TabView, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (view, child, info) => view.insert(child, info.index),\n reorder: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.reorderPage(info.adopted, info.index);\n }\n },\n detach: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.closePage(info.adopted);\n }\n },\n resolve: (view, child) => view.getPage(child),\n }),\n ],\n },\n AdwNavigationView: {\n behaviors: [\n methodSlot<Adw.NavigationView, Adw.NavigationPage>(\"children\", \"AdwNavigationPage\", \"add\", \"remove\"),\n ],\n },\n AdwViewStack: {\n behaviors: [\n methodSlot<Adw.ViewStack, Gtk.Widget>(\"children\", \"GtkWidget\", \"add\", \"remove\"),\n deferred<Adw.ViewStack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n AdwToolbarView: {\n behaviors: [\n contentSetterSlot<Adw.ToolbarView>(),\n methodSlot<Adw.ToolbarView, Gtk.Widget>(\"topBar\", \"GtkWidget\", \"addTopBar\", \"remove\"),\n methodSlot<Adw.ToolbarView, Gtk.Widget>(\"bottomBar\", \"GtkWidget\", \"addBottomBar\", \"remove\"),\n ],\n },\n AdwHeaderBar: {\n behaviors: [\n methodSlot<Adw.HeaderBar, Gtk.Widget>(\"start\", \"GtkWidget\", \"packStart\", \"remove\"),\n methodSlot<Adw.HeaderBar, Gtk.Widget>(\"end\", \"GtkWidget\", \"packEnd\", \"remove\"),\n ],\n },\n AdwShortcutsDialog: {\n behaviors: [methodSlot<Adw.ShortcutsDialog, Adw.ShortcutsSection>(\"children\", \"AdwShortcutsSection\", \"add\")],\n },\n AdwShortcutsSection: {\n behaviors: [methodSlot<Adw.ShortcutsSection, Adw.ShortcutsItem>(\"children\", \"AdwShortcutsItem\", \"add\")],\n },\n AdwToggleGroup: {\n behaviors: [\n methodSlot<Adw.ToggleGroup, Adw.Toggle>(\"children\", \"AdwToggle\", \"add\", \"remove\"),\n deferred<Adw.ToggleGroup, string>(\"activeName\", (group, name) => group.getToggleByName(name) !== null),\n deferred(\"active\"),\n ],\n },\n AdwAlertDialog: {\n behaviors: [\n alertDialogExtraChild,\n list<Adw.AlertDialog, AlertDialogResponse>(\"responses\", {\n add: (dialog, response) => {\n dialog.addResponse(response.id, response.label);\n\n if (response.appearance !== undefined) {\n dialog.setResponseAppearance(response.id, response.appearance);\n }\n\n if (response.isEnabled !== undefined) {\n dialog.setResponseEnabled(response.id, response.isEnabled);\n }\n },\n remove: (dialog, response) => {\n dialog.removeResponse(response.id);\n },\n }),\n ],\n },\n};\n\nfunction getSlotId(name: string): string | null {\n if (name.length <= SLOT_SUFFIX.length || !name.endsWith(SLOT_SUFFIX)) {\n return null;\n }\n\n return name.slice(0, -SLOT_SUFFIX.length);\n}\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;AA4G9F,QAAA,MAAM,0BAA0B,GAAI,WAAW,WAAW,KAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAC3B,CAAC;AAEjE,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { quitApplication, runApplication } from "@gtkx/runtime";
|
|
|
3
3
|
import { pickBy, warn } from "@gtkx/utils";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { useLayoutEffect, useState } from "react";
|
|
6
|
-
import { applicationId as defaultApplicationId } from "virtual:gtkx-config";
|
|
6
|
+
import { applicationId as defaultApplicationId, resourceBasePath as defaultResourceBasePath, } from "virtual:gtkx-config";
|
|
7
7
|
import { ApplicationContext } from "../hooks/use-application.js";
|
|
8
8
|
import { useMergedRef } from "../hooks/use-merged-refs.js";
|
|
9
9
|
import { createPortaledComponent } from "./portaled.js";
|
|
@@ -49,13 +49,13 @@ const applicationChildren = (application, children) => {
|
|
|
49
49
|
return _jsx(ApplicationContext.Provider, { value: application, children: children });
|
|
50
50
|
};
|
|
51
51
|
const createApplicationElement = (Component) => {
|
|
52
|
-
return ({ applicationId = defaultApplicationId, children, ref, ...rest }) => {
|
|
52
|
+
return ({ applicationId = defaultApplicationId, children, ref, resourceBasePath = defaultResourceBasePath, ...rest }) => {
|
|
53
53
|
const [application, setApplication] = useState(null);
|
|
54
54
|
const [activated, setActivated] = useState(false);
|
|
55
55
|
useApplicationLifecycle(application, setActivated, applicationId);
|
|
56
56
|
const mergedRef = useMergedRef(ref, setApplication);
|
|
57
57
|
const appliedProps = activated ? rest : pickBy(rest, (_value, key) => !POST_ACTIVATE_PROPS.has(key));
|
|
58
|
-
return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, children: activated ? applicationChildren(application, children) : null }));
|
|
58
|
+
return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, resourceBasePath: resourceBasePath, children: activated ? applicationChildren(application, children) : null }));
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
const createApplicationComponent = (Component) => createPortaledComponent(createApplicationElement(Component));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAA8C,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,IA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,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAErG,OAAO,CACH,KAAC,SAAS,IACN,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,aAAa,KACxB,YAAY,EAChB,gBAAgB,EAAE,gBAAgB,YAEjC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GACtD,CACf,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,SAAsB,EAAmC,EAAE,CAC3F,uBAAuB,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;AAEjE,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { quitApplication, runApplication } from \"@gtkx/runtime\";\nimport { pickBy, warn } from \"@gtkx/utils\";\nimport process from \"node:process\";\nimport { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from \"react\";\nimport {\n applicationId as defaultApplicationId,\n resourceBasePath as defaultResourceBasePath,\n} from \"virtual:gtkx-config\";\nimport { ApplicationContext } from \"../hooks/use-application.js\";\nimport { useMergedRef } from \"../hooks/use-merged-refs.js\";\nimport { createPortaledComponent } from \"./portaled.js\";\n\ntype ApplicationComponentProps = {\n applicationId?: string | null | undefined;\n children?: ReactNode | undefined;\n ref?: Ref<Gtk.Application | null> | undefined;\n resourceBasePath?: string | null | undefined;\n};\n\nconst POST_ACTIVATE_PROPS = new Set([\"menubar\"]);\n\nconst commandLine = (applicationId: string | null): string[] => [\n applicationId?.split(\".\").at(-1) ?? \"gtkx\",\n ...process.argv.slice(2),\n];\n\nconst reportOwnedApplicationId = (application: Gtk.Application): void => {\n if (!application.getIsRegistered() || !application.getIsRemote()) {\n return;\n }\n\n warn(\n `Another process already owns ${application.applicationId ?? \"this application ID\"}, so this process ` +\n \"registered as a remote instance and can never show a window. Quit that instance or change \" +\n \"applicationId, then start this application again.\",\n );\n};\n\nconst startApplication = (\n application: Gtk.Application,\n setActivated: (isActivated: boolean) => void,\n applicationId: string | null,\n): void => {\n application.on(\"activate\", () => {\n setActivated(true);\n });\n\n const { exitStatus } = runApplication(application, commandLine(applicationId));\n reportOwnedApplicationId(application);\n\n if (exitStatus !== 0) {\n process.exitCode = exitStatus;\n }\n};\n\nconst useApplicationLifecycle = (\n application: Gtk.Application | null,\n setActivated: (isActivated: boolean) => void,\n applicationId: string | null,\n): void => {\n useLayoutEffect(() => {\n if (!application) {\n return;\n }\n\n startApplication(application, setActivated, applicationId);\n\n return () => {\n quitApplication(application);\n setActivated(false);\n };\n }, [application, setActivated, applicationId]);\n};\n\nconst applicationChildren = (application: Gtk.Application | null, children: ReactNode): ReactNode => {\n if (!application) {\n return null;\n }\n\n return <ApplicationContext.Provider value={application}>{children}</ApplicationContext.Provider>;\n};\n\nconst createApplicationElement = (\n Component: ElementType,\n): ((props: ApplicationComponentProps) => ReactNode) => {\n return ({\n applicationId = defaultApplicationId,\n children,\n ref,\n resourceBasePath = defaultResourceBasePath,\n ...rest\n }: ApplicationComponentProps): ReactNode => {\n const [application, setApplication] = useState<Gtk.Application | null>(null);\n const [activated, setActivated] = useState(false);\n useApplicationLifecycle(application, setActivated, applicationId);\n const mergedRef = useMergedRef(ref, setApplication);\n const appliedProps = activated ? rest : pickBy(rest, (_value, key) => !POST_ACTIVATE_PROPS.has(key));\n\n return (\n <Component\n ref={mergedRef}\n applicationId={applicationId}\n {...appliedProps}\n resourceBasePath={resourceBasePath}\n >\n {activated ? applicationChildren(application, children) : null}\n </Component>\n );\n };\n};\n\nconst createApplicationComponent = (Component: ElementType): ((props: unknown) => ReactNode) =>\n createPortaledComponent(createApplicationElement(Component));\n\n/** @internal */\nexport { createApplicationComponent };\n"]}
|
|
@@ -2,15 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { use } from "react";
|
|
3
3
|
import { ParentWindowContext } from "../hooks/use-parent-window.js";
|
|
4
4
|
import { createPresentedComponent } from "../hooks/use-presented-instance.js";
|
|
5
|
-
import {
|
|
5
|
+
import { applyMutation } from "../reconciler/signals.js";
|
|
6
6
|
import { createPortaledComponent } from "./portaled.js";
|
|
7
7
|
const presentWindow = (window) => {
|
|
8
|
-
|
|
8
|
+
applyMutation(() => {
|
|
9
9
|
window.present();
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
const destroyWindow = (window) => {
|
|
13
|
-
|
|
13
|
+
applyMutation(() => {
|
|
14
14
|
window.destroy();
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":";AACA,OAAO,EAAuD,GAAG,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":";AACA,OAAO,EAAuD,GAAG,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAA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G,OAAO,EAAE,8BAA8B,EAAE,CAAC;AAC1C,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type ElementType, type ReactElement, type ReactNode, use } from \"react\";\nimport { ParentWindowContext } from \"../hooks/use-parent-window.js\";\nimport { createPresentedComponent, type PresentedProps } from \"../hooks/use-presented-instance.js\";\nimport { applyMutation } from \"../reconciler/signals.js\";\nimport { createPortaledComponent } from \"./portaled.js\";\n\ntype WindowComponentProps = PresentedProps<Gtk.Window> & {\n // eslint-disable-next-line gtkx/accessor-naming\n transientFor?: Gtk.Window | ReactElement | null | undefined;\n};\n\nconst presentWindow = (window: Gtk.Window): void => {\n applyMutation(() => {\n window.present();\n });\n};\n\nconst destroyWindow = (window: Gtk.Window): void => {\n applyMutation(() => {\n window.destroy();\n });\n};\n\nconst usePresentWindow = (): ((window: Gtk.Window) => void) => presentWindow;\n\nconst createPresentedWindowComponent = (Component: ElementType): ((props: PresentedProps<Gtk.Window>) => ReactNode) =>\n createPresentedComponent<Gtk.Window>(Component, {\n usePresent: usePresentWindow,\n dismiss: destroyWindow,\n wrap: (element, window) => (\n <ParentWindowContext.Provider value={window}>{element}</ParentWindowContext.Provider>\n ),\n });\n\nconst withDefaultTransientFor = (Component: ElementType): ((props: WindowComponentProps) => ReactNode) => {\n return (props: WindowComponentProps): ReactNode => {\n const parent = use(ParentWindowContext);\n const isDefaulted = props.transientFor === undefined && parent !== null;\n\n return <Component {...(isDefaulted ? { ...props, transientFor: parent } : props)} />;\n };\n};\n\nconst createWindowComponent = (Component: ElementType): ((props: unknown) => ReactNode) =>\n createPortaledComponent(withDefaultTransientFor(createPresentedWindowComponent(Component)));\n\nexport { createPresentedWindowComponent };\n/** @internal */\nexport { createWindowComponent };\n"]}
|