@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
|
@@ -2,26 +2,21 @@ import * as Gio from "@gtkx/gi/gio";
|
|
|
2
2
|
import * as GLib from "@gtkx/gi/glib";
|
|
3
3
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
4
|
import { BUILTIN_ELEMENTS, SINGLE_CHILD_TYPES } from "./element-config.js";
|
|
5
|
-
import {
|
|
5
|
+
import { applicationCreator, boxSlot, childSetterSlot, controlledText, deferred, deferredWith, list, methodSlot, setterSlot, slot, value, wrappingIndexedSlot, } from "./reconciler/behaviors.js";
|
|
6
6
|
import { forTypes, registerElements, } from "./reconciler/registry.js";
|
|
7
7
|
import { applyWrite } from "./reconciler/signals.js";
|
|
8
|
-
import { applyStyle, styleClass } from "./reconciler/style.js";
|
|
8
|
+
import { applyStyle, CSS_CLASSES_PROP, styleClass } from "./reconciler/style.js";
|
|
9
|
+
const SELECTED_INDEX_PROP = "selectedIndex";
|
|
10
|
+
const SELECTION_SIGNAL = "selected-rows-changed";
|
|
11
|
+
const NO_SELECTION = -1;
|
|
9
12
|
const BUILTIN_BEHAVIORS = {
|
|
10
13
|
...forTypes(SINGLE_CHILD_TYPES, {
|
|
11
14
|
behaviors: [childSetterSlot()],
|
|
12
15
|
}),
|
|
13
16
|
...forTypes(["GtkHeaderBar", "GtkActionBar"], {
|
|
14
17
|
behaviors: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, (bar, child) => {
|
|
18
|
-
bar.remove(child);
|
|
19
|
-
}),
|
|
20
|
-
addRemoveSlot("end", "GtkWidget", (bar, child) => {
|
|
21
|
-
bar.packEnd(child);
|
|
22
|
-
}, (bar, child) => {
|
|
23
|
-
bar.remove(child);
|
|
24
|
-
}),
|
|
18
|
+
methodSlot("start", "GtkWidget", "packStart", "remove"),
|
|
19
|
+
methodSlot("end", "GtkWidget", "packEnd", "remove"),
|
|
25
20
|
],
|
|
26
21
|
}),
|
|
27
22
|
GtkWindow: {
|
|
@@ -37,19 +32,8 @@ const BUILTIN_BEHAVIORS = {
|
|
|
37
32
|
popover.unparent();
|
|
38
33
|
},
|
|
39
34
|
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, (widget, controller) => {
|
|
43
|
-
widget.removeController(controller);
|
|
44
|
-
}),
|
|
45
|
-
slot("layoutManager", "GtkLayoutManager", {
|
|
46
|
-
attach: (widget, manager) => {
|
|
47
|
-
widget.setLayoutManager(manager);
|
|
48
|
-
},
|
|
49
|
-
detach: (widget) => {
|
|
50
|
-
widget.setLayoutManager(null);
|
|
51
|
-
},
|
|
52
|
-
}),
|
|
35
|
+
methodSlot("controllers", "GtkEventController", "addController", "removeController"),
|
|
36
|
+
setterSlot("layoutManager", "GtkLayoutManager", "setLayoutManager"),
|
|
53
37
|
slot("actionGroups", "GActionGroup", {
|
|
54
38
|
attach: (widget, group, info) => {
|
|
55
39
|
widget.insertActionGroup(info.props.prefix ?? "", group);
|
|
@@ -69,6 +53,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
69
53
|
wrappingIndexedSlot(Gtk.ListBoxRow, (row, inner) => {
|
|
70
54
|
row.setChild(inner);
|
|
71
55
|
}),
|
|
56
|
+
selectedIndexBehavior(),
|
|
72
57
|
],
|
|
73
58
|
},
|
|
74
59
|
GtkFlowBox: {
|
|
@@ -94,27 +79,14 @@ const BUILTIN_BEHAVIORS = {
|
|
|
94
79
|
},
|
|
95
80
|
GtkShortcutController: {
|
|
96
81
|
behaviors: [
|
|
97
|
-
|
|
98
|
-
controller.addShortcut(shortcut);
|
|
99
|
-
}, (controller, shortcut) => {
|
|
100
|
-
controller.removeShortcut(shortcut);
|
|
101
|
-
}),
|
|
82
|
+
methodSlot("shortcuts", "GtkShortcut", "addShortcut", "removeShortcut"),
|
|
102
83
|
],
|
|
103
84
|
},
|
|
104
85
|
GtkTextChildAnchor: {
|
|
105
86
|
behaviors: [{ create: () => Gtk.TextChildAnchor.new() }],
|
|
106
87
|
},
|
|
107
88
|
GtkTextView: {
|
|
108
|
-
behaviors: [
|
|
109
|
-
slot("children", "GtkTextBuffer", {
|
|
110
|
-
attach: (view, buffer) => {
|
|
111
|
-
view.setBuffer(buffer);
|
|
112
|
-
},
|
|
113
|
-
detach: (view) => {
|
|
114
|
-
view.setBuffer(null);
|
|
115
|
-
},
|
|
116
|
-
}),
|
|
117
|
-
],
|
|
89
|
+
behaviors: [setterSlot("children", "GtkTextBuffer", "setBuffer")],
|
|
118
90
|
},
|
|
119
91
|
GActionMap: {
|
|
120
92
|
behaviors: [
|
|
@@ -192,16 +164,8 @@ const BUILTIN_BEHAVIORS = {
|
|
|
192
164
|
},
|
|
193
165
|
GtkConstraintLayout: {
|
|
194
166
|
behaviors: [
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}, (layout, constraint) => {
|
|
198
|
-
layout.removeConstraint(constraint);
|
|
199
|
-
}),
|
|
200
|
-
addRemoveSlot("guides", "GtkConstraintGuide", (layout, guide) => {
|
|
201
|
-
layout.addGuide(guide);
|
|
202
|
-
}, (layout, guide) => {
|
|
203
|
-
layout.removeGuide(guide);
|
|
204
|
-
}),
|
|
167
|
+
methodSlot("constraints", "GtkConstraint", "addConstraint", "removeConstraint"),
|
|
168
|
+
methodSlot("guides", "GtkConstraintGuide", "addGuide", "removeGuide"),
|
|
205
169
|
list("vfl", {
|
|
206
170
|
add: (layout, item) => [
|
|
207
171
|
...layout.addConstraintsFromDescription(item.lines, item.hspacing ?? 0, item.vspacing ?? 0, item.views ?? new Map()),
|
|
@@ -216,9 +180,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
216
180
|
},
|
|
217
181
|
GtkStack: {
|
|
218
182
|
behaviors: [
|
|
219
|
-
|
|
220
|
-
stack.remove(child);
|
|
221
|
-
}),
|
|
183
|
+
methodSlot("children", "GtkWidget", "addChild", "remove"),
|
|
222
184
|
deferred("visibleChildName", (stack, name) => stack.getChildByName(name) !== null),
|
|
223
185
|
],
|
|
224
186
|
},
|
|
@@ -239,11 +201,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
239
201
|
GtkApplication: {
|
|
240
202
|
behaviors: [
|
|
241
203
|
applicationCreator(Gtk.Application),
|
|
242
|
-
|
|
243
|
-
application.addWindow(window);
|
|
244
|
-
}, (application, window) => {
|
|
245
|
-
application.removeWindow(window);
|
|
246
|
-
}),
|
|
204
|
+
methodSlot("children", "GtkWindow", "addWindow", "removeWindow"),
|
|
247
205
|
list("actionAccels", {
|
|
248
206
|
add: (application, item) => {
|
|
249
207
|
application.setAccelsForAction(item.detailedActionName, item.accels);
|
|
@@ -347,8 +305,8 @@ const didWriteCssClasses = (widget, prev, next, className) => {
|
|
|
347
305
|
if (className === null || !hasCssClassesChange(prev, next)) {
|
|
348
306
|
return false;
|
|
349
307
|
}
|
|
350
|
-
applyWrite(() => {
|
|
351
|
-
Reflect.set(widget,
|
|
308
|
+
applyWrite(CSS_CLASSES_PROP, () => {
|
|
309
|
+
Reflect.set(widget, CSS_CLASSES_PROP, withStyleClass(next.cssClasses, className));
|
|
352
310
|
});
|
|
353
311
|
return true;
|
|
354
312
|
};
|
|
@@ -369,6 +327,43 @@ function updateStyle(widget, prev, next) {
|
|
|
369
327
|
function styleBehavior() {
|
|
370
328
|
return { update: updateStyle };
|
|
371
329
|
}
|
|
330
|
+
function selectedRowIndex(box) {
|
|
331
|
+
return box.getSelectedRow()?.getIndex() ?? NO_SELECTION;
|
|
332
|
+
}
|
|
333
|
+
function selectedIndexError(value) {
|
|
334
|
+
return new Error("The 'selectedIndex' of a <GtkListBox> must be a whole number, or -1 to select no row; " +
|
|
335
|
+
`received ${String(value)}.`);
|
|
336
|
+
}
|
|
337
|
+
function desiredIndex(value) {
|
|
338
|
+
if (value === null) {
|
|
339
|
+
return NO_SELECTION;
|
|
340
|
+
}
|
|
341
|
+
if (typeof value !== "number") {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
if (!Number.isSafeInteger(value)) {
|
|
345
|
+
throw selectedIndexError(value);
|
|
346
|
+
}
|
|
347
|
+
return value;
|
|
348
|
+
}
|
|
349
|
+
function applySelectedIndex(box, index) {
|
|
350
|
+
if (index < 0) {
|
|
351
|
+
box.unselectAll();
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const row = box.getRowAtIndex(index);
|
|
355
|
+
if (row !== null) {
|
|
356
|
+
box.selectRow(row);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function selectedIndexBehavior() {
|
|
360
|
+
return deferredWith(SELECTED_INDEX_PROP, {
|
|
361
|
+
parse: desiredIndex,
|
|
362
|
+
read: selectedRowIndex,
|
|
363
|
+
write: applySelectedIndex,
|
|
364
|
+
signal: SELECTION_SIGNAL,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
372
367
|
const addMainOption = (application, option) => {
|
|
373
368
|
application.addMainOption(option.longName, option.shortName?.codePointAt(0) ?? 0, option.flags ?? GLib.OptionFlags.NONE, option.arg ?? GLib.OptionArg.NONE, option.description, option.argDescription ?? null);
|
|
374
369
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../src/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAWpC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACH,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,cAAc,EACd,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,mBAAmB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGH,QAAQ,EAER,gBAAgB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,iBAAiB,GAAyC;IAC5D,GAAG,QAAQ,CAAC,kBAAkB,EAAE;QAC5B,SAAS,EAAE,CAAC,eAAe,EAAE,CAAC;KACjC,CAAC;IACF,GAAG,QAAQ,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE;QAC1C,SAAS,EAAE;YACP,aAAa,CACT,OAAO,EACP,WAAW,EACX,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBACX,GAAG,CAAC,SAAS,CAAC,KAA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C;QAC7B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,OAAO;IACX,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,OAAO;IACX,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACnC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gio from \"@gtkx/gi/gio\";\nimport * as GLib from \"@gtkx/gi/glib\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n ActionAccel,\n CreditSection,\n DragSourceIcon,\n LevelBarOffset,\n MainOption,\n MenuItem,\n ScaleMark,\n VflConstraints,\n} from \"./prop-types.js\";\nimport { BUILTIN_ELEMENTS, SINGLE_CHILD_TYPES } from \"./element-config.js\";\nimport {\n addRemoveSlot,\n adoptedChildrenSlot,\n applicationCreator,\n boxSlot,\n childSetterSlot,\n controlledText,\n deferred,\n list,\n slot,\n value,\n wrappingIndexedSlot,\n} from \"./reconciler/behaviors.js\";\nimport {\n type ElementBehavior,\n type ElementConfig,\n forTypes,\n type Props,\n registerElements,\n} from \"./reconciler/registry.js\";\nimport { applyWrite } from \"./reconciler/signals.js\";\nimport { applyStyle, styleClass } from \"./reconciler/style.js\";\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n ...forTypes(SINGLE_CHILD_TYPES, {\n behaviors: [childSetterSlot()],\n }),\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Gtk.HeaderBar | Gtk.ActionBar>(\n \"start\",\n \"GtkWidget\",\n (bar, child) => {\n bar.packStart(child);\n },\n (bar, child) => {\n bar.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, Gtk.HeaderBar | Gtk.ActionBar>(\n \"end\",\n \"GtkWidget\",\n (bar, child) => {\n bar.packEnd(child);\n },\n (bar, child) => {\n bar.remove(child);\n },\n ),\n ],\n }),\n GtkWindow: {\n behaviors: [childSetterSlot()],\n },\n GtkWidget: {\n behaviors: [\n slot<Gtk.Widget, Gtk.Popover>(\"children\", \"GtkPopover\", {\n attach: (parent, popover) => {\n popover.setParent(parent);\n },\n detach: (_parent, popover) => {\n popover.unparent();\n },\n }),\n addRemoveSlot<Gtk.EventController, Gtk.Widget>(\n \"controllers\",\n \"GtkEventController\",\n (widget, controller) => {\n widget.addController(controller);\n },\n (widget, controller) => {\n widget.removeController(controller);\n },\n ),\n slot<Gtk.Widget, Gtk.LayoutManager>(\"layoutManager\", \"GtkLayoutManager\", {\n attach: (widget, manager) => {\n widget.setLayoutManager(manager);\n },\n detach: (widget) => {\n widget.setLayoutManager(null);\n },\n }),\n slot<Gtk.Widget, Gio.ActionGroup>(\"actionGroups\", \"GActionGroup\", {\n attach: (widget, group, info) => {\n widget.insertActionGroup((info.props.prefix as string | null) ?? \"\", group);\n },\n detach: (widget, _group, info) => {\n widget.insertActionGroup((info.props.prefix as string | null) ?? \"\", null);\n },\n }),\n styleBehavior(),\n ],\n },\n GtkBox: {\n behaviors: [boxSlot<Gtk.Box>()],\n },\n GtkListBox: {\n behaviors: [\n wrappingIndexedSlot(Gtk.ListBoxRow, (row, inner) => {\n row.setChild(inner);\n }),\n ],\n },\n GtkFlowBox: {\n behaviors: [\n wrappingIndexedSlot(Gtk.FlowBoxChild, (child, inner) => {\n child.setChild(inner);\n }),\n ],\n },\n GtkOverlay: {\n behaviors: [\n childSetterSlot<Gtk.Overlay>(),\n slot<Gtk.Overlay, Gtk.Widget>(\"overlays\", \"GtkWidget\", {\n attach: (overlay, child) => {\n overlay.addOverlay(child);\n },\n detach: (overlay, child) => {\n overlay.removeOverlay(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkShortcutController: {\n behaviors: [\n addRemoveSlot<Gtk.Shortcut, Gtk.ShortcutController>(\n \"shortcuts\",\n \"GtkShortcut\",\n (controller, shortcut) => {\n controller.addShortcut(shortcut);\n },\n (controller, shortcut) => {\n controller.removeShortcut(shortcut);\n },\n ),\n ],\n },\n GtkTextChildAnchor: {\n behaviors: [{ create: () => Gtk.TextChildAnchor.new() }],\n },\n GtkTextView: {\n behaviors: [\n slot<Gtk.TextView, Gtk.TextBuffer>(\"children\", \"GtkTextBuffer\", {\n attach: (view, buffer) => {\n view.setBuffer(buffer);\n },\n detach: (view) => {\n view.setBuffer(null);\n },\n }),\n ],\n },\n GActionMap: {\n behaviors: [\n slot<Gio.ActionMap, Gio.Action>(\"actions\", \"GAction\", {\n attach: (map, action) => {\n map.addAction(action);\n },\n detach: (map, _action, info) => {\n map.removeAction((info.props.name as string | null) ?? \"\");\n },\n }),\n ],\n },\n GMenu: {\n behaviors: [\n list<Gio.Menu, MenuItem>(\"items\", {\n clear: (menu) => {\n menu.removeAll();\n },\n add: (menu, item) => {\n appendMenuItem(menu, item);\n },\n }),\n ],\n },\n GtkColumnView: {\n behaviors: [\n slot<Gtk.ColumnView, Gtk.ColumnViewColumn>(\"children\", \"GtkColumnViewColumn\", {\n attach: (view, column, info) => {\n view.insertColumn(info.index, column);\n },\n detach: (view, column) => {\n view.removeColumn(column);\n },\n }),\n ],\n },\n GtkGrid: {\n behaviors: [\n slot<Gtk.Grid, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (grid, child) => {\n grid.attach(child, 0, 0, 1, 1);\n },\n detach: (grid, child) => {\n grid.remove(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkFixed: {\n behaviors: [\n slot<Gtk.Fixed, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (fixed, child) => {\n fixed.put(child, 0, 0);\n },\n detach: (fixed, child) => {\n fixed.remove(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkSizeGroup: {\n behaviors: [\n list<Gtk.SizeGroup, Gtk.Widget>(\"widgets\", {\n add: (group, widget) => {\n group.addWidget(widget);\n },\n remove: (group, widget) => {\n group.removeWidget(widget);\n },\n }),\n ],\n },\n GtkConstraintLayout: {\n behaviors: [\n addRemoveSlot<Gtk.Constraint, Gtk.ConstraintLayout>(\n \"constraints\",\n \"GtkConstraint\",\n (layout, constraint) => {\n layout.addConstraint(constraint);\n },\n (layout, constraint) => {\n layout.removeConstraint(constraint);\n },\n ),\n addRemoveSlot<Gtk.ConstraintGuide, Gtk.ConstraintLayout>(\n \"guides\",\n \"GtkConstraintGuide\",\n (layout, guide) => {\n layout.addGuide(guide);\n },\n (layout, guide) => {\n layout.removeGuide(guide);\n },\n ),\n list<Gtk.ConstraintLayout, VflConstraints, Gtk.Constraint[]>(\"vfl\", {\n add: (layout, item) => [\n ...layout.addConstraintsFromDescription(\n item.lines,\n item.hspacing ?? 0,\n item.vspacing ?? 0,\n item.views ?? new Map<string, Gtk.ConstraintTarget>(),\n ),\n ],\n remove: (layout, _item, constraints) => {\n for (const constraint of constraints) {\n layout.removeConstraint(constraint);\n }\n },\n }),\n ],\n },\n GtkStack: {\n behaviors: [\n adoptedChildrenSlot<Gtk.Stack, Gtk.Widget>(\n \"GtkWidget\",\n (stack, child) => stack.addChild(child),\n (stack, child) => {\n stack.remove(child);\n },\n ),\n deferred<Gtk.Stack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n GtkNotebook: {\n behaviors: [\n slot<Gtk.Notebook, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (notebook, child, info) => notebook.insertPage(child, null, info.index),\n reorder: (notebook, child, info) => {\n notebook.reorderChild(child, info.index);\n },\n detach: (notebook, child) => {\n notebook.detachTab(child);\n },\n resolve: (notebook, child) => notebook.getPage(child),\n }),\n ],\n },\n GtkApplication: {\n behaviors: [\n applicationCreator(Gtk.Application),\n addRemoveSlot<Gtk.Window, Gtk.Application>(\n \"children\",\n \"GtkWindow\",\n (application, window) => {\n application.addWindow(window);\n },\n (application, window) => {\n application.removeWindow(window);\n },\n ),\n list<Gtk.Application, ActionAccel>(\"actionAccels\", {\n add: (application, item) => {\n application.setAccelsForAction(item.detailedActionName, item.accels);\n },\n remove: (application, item) => {\n application.setAccelsForAction(item.detailedActionName, []);\n },\n }),\n list<Gtk.Application, MainOption>(\"mainOptions\", {\n add: (application, option) => {\n addMainOption(application, option);\n },\n }),\n ],\n },\n GtkAboutDialog: {\n behaviors: [\n list<Gtk.AboutDialog, CreditSection>(\"creditSections\", {\n add: (dialog, section) => {\n dialog.addCreditSection(section.sectionName, section.people);\n },\n }),\n ],\n },\n GtkScale: {\n behaviors: [\n list<Gtk.Scale, ScaleMark>(\"marks\", {\n add: (scale, mark) => {\n scale.addMark(mark.value ?? 0, mark.position, mark.markup ?? null);\n },\n clear: (scale) => {\n scale.clearMarks();\n },\n }),\n ],\n },\n GtkCalendar: {\n behaviors: [\n list<Gtk.Calendar, number>(\"markedDays\", {\n add: (calendar, day) => {\n calendar.markDay(day);\n },\n clear: (calendar) => {\n calendar.clearMarks();\n },\n }),\n ],\n },\n GtkLevelBar: {\n behaviors: [\n list<Gtk.LevelBar, LevelBarOffset>(\"offsets\", {\n add: (bar, offset) => {\n bar.addOffsetValue(offset.name, offset.value ?? 0);\n },\n remove: (bar, offset) => {\n bar.removeOffsetValue(offset.name);\n },\n }),\n ],\n },\n GtkDropTarget: {\n behaviors: [\n value<Gtk.DropTarget, GObject.Type[]>(\"types\", (target, types) => {\n target.setGtypes(types);\n }),\n ],\n },\n GtkDrawingArea: {\n behaviors: [\n value<Gtk.DrawingArea, Gtk.DrawingAreaDrawFunc>(\"drawFunc\", (area, draw) => {\n area.setDrawFunc(draw);\n area.queueDraw();\n }),\n ],\n },\n GtkDragSource: {\n behaviors: [\n value<Gtk.DragSource, DragSourceIcon>(\"icon\", (source, icon) => {\n source.setIcon(icon.paintable ?? null, icon.hotX ?? 0, icon.hotY ?? 0);\n }),\n ],\n },\n GtkEditable: {\n behaviors: [controlledText(\"text\")],\n },\n};\n\nfunction layoutChild(parent: Gtk.Widget, child: Gtk.Widget): GObject.Object | null {\n return parent.getLayoutManager()?.getLayoutChild(child) ?? null;\n}\n\nconst isNullish = (value: unknown): boolean => value === undefined || value === null;\nconst isInitialNull = (prevValue: unknown, value: unknown): boolean => value === null && prevValue === undefined;\n\nconst withStyleClass = (classes: unknown, className: string): string[] =>\n Array.isArray(classes) ? [...(classes as string[]), className] : [className];\n\nconst hasCssClassesChange = (prev: Props, next: Props): boolean => {\n const classes = next.cssClasses;\n\n if (classes === undefined || Object.is(prev.cssClasses, classes)) {\n return false;\n }\n\n return !isInitialNull(prev.cssClasses, classes);\n};\n\nconst didWriteCssClasses = (widget: Gtk.Widget, prev: Props, next: Props, className: string | null): boolean => {\n if (className === null || !hasCssClassesChange(prev, next)) {\n return false;\n }\n\n applyWrite(() => {\n Reflect.set(widget, \"cssClasses\", withStyleClass(next.cssClasses, className));\n });\n\n return true;\n};\n\nconst isRestyled = (prev: Props, next: Props): boolean => {\n if (isNullish(prev.style) && isNullish(next.style)) {\n return false;\n }\n\n return !Object.is(prev.style, next.style);\n};\n\nfunction updateStyle(widget: Gtk.Widget, prev: Props, next: Props): Iterable<string> | undefined {\n const isChanged = isRestyled(prev, next);\n const className = isChanged ? applyStyle(widget, next.style) : styleClass(widget);\n\n if (!isChanged && className === null) {\n return;\n }\n\n return didWriteCssClasses(widget, prev, next, className) ? [\"style\", \"cssClasses\"] : [\"style\"];\n}\n\nfunction styleBehavior(): ElementBehavior<Gtk.Widget> {\n return { update: updateStyle };\n}\n\nconst addMainOption = (application: Gtk.Application, option: MainOption): void => {\n application.addMainOption(\n option.longName,\n option.shortName?.codePointAt(0) ?? 0,\n option.flags ?? GLib.OptionFlags.NONE,\n option.arg ?? GLib.OptionArg.NONE,\n option.description,\n option.argDescription ?? null,\n );\n};\n\nconst buildMenu = (items: MenuItem[]): Gio.Menu => {\n const menu = Gio.Menu.new();\n\n for (const item of items) {\n appendMenuItem(menu, item);\n }\n\n return menu;\n};\n\nfunction appendMenuItem(menu: Gio.Menu, item: MenuItem): void {\n const label = item.label ?? null;\n\n if (item.submenu !== undefined) {\n menu.appendSubmenu(label, buildMenu(item.submenu));\n\n return;\n }\n\n if (item.section !== undefined) {\n menu.appendSection(label, buildMenu(item.section));\n\n return;\n }\n\n menu.append(label, item.action ?? null);\n}\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
|
|
1
|
+
{"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../src/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAWpC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACH,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,IAAI,EACJ,KAAK,EACL,mBAAmB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGH,QAAQ,EAER,gBAAgB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEjF,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAC5C,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC;AAExB,MAAM,iBAAiB,GAAyC;IAC5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AgB,CAAC,gBAAgB,CAAC,CAAC;AACnC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gio from \"@gtkx/gi/gio\";\nimport * as GLib from \"@gtkx/gi/glib\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n ActionAccel,\n CreditSection,\n DragSourceIcon,\n LevelBarOffset,\n MainOption,\n MenuItem,\n ScaleMark,\n VflConstraints,\n} from \"./prop-types.js\";\nimport { BUILTIN_ELEMENTS, SINGLE_CHILD_TYPES } from \"./element-config.js\";\nimport {\n applicationCreator,\n boxSlot,\n childSetterSlot,\n controlledText,\n deferred,\n deferredWith,\n list,\n methodSlot,\n setterSlot,\n slot,\n value,\n wrappingIndexedSlot,\n} from \"./reconciler/behaviors.js\";\nimport {\n type ElementBehavior,\n type ElementConfig,\n forTypes,\n type Props,\n registerElements,\n} from \"./reconciler/registry.js\";\nimport { applyWrite } from \"./reconciler/signals.js\";\nimport { applyStyle, CSS_CLASSES_PROP, styleClass } from \"./reconciler/style.js\";\n\nconst SELECTED_INDEX_PROP = \"selectedIndex\";\nconst SELECTION_SIGNAL = \"selected-rows-changed\";\nconst NO_SELECTION = -1;\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n ...forTypes(SINGLE_CHILD_TYPES, {\n behaviors: [childSetterSlot()],\n }),\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n behaviors: [\n methodSlot<Gtk.HeaderBar | Gtk.ActionBar, Gtk.Widget>(\"start\", \"GtkWidget\", \"packStart\", \"remove\"),\n methodSlot<Gtk.HeaderBar | Gtk.ActionBar, Gtk.Widget>(\"end\", \"GtkWidget\", \"packEnd\", \"remove\"),\n ],\n }),\n GtkWindow: {\n behaviors: [childSetterSlot()],\n },\n GtkWidget: {\n behaviors: [\n slot<Gtk.Widget, Gtk.Popover>(\"children\", \"GtkPopover\", {\n attach: (parent, popover) => {\n popover.setParent(parent);\n },\n detach: (_parent, popover) => {\n popover.unparent();\n },\n }),\n methodSlot<Gtk.Widget, Gtk.EventController>(\n \"controllers\", \"GtkEventController\", \"addController\", \"removeController\",\n ),\n setterSlot<Gtk.Widget, Gtk.LayoutManager>(\"layoutManager\", \"GtkLayoutManager\", \"setLayoutManager\"),\n slot<Gtk.Widget, Gio.ActionGroup>(\"actionGroups\", \"GActionGroup\", {\n attach: (widget, group, info) => {\n widget.insertActionGroup((info.props.prefix as string | null) ?? \"\", group);\n },\n detach: (widget, _group, info) => {\n widget.insertActionGroup((info.props.prefix as string | null) ?? \"\", null);\n },\n }),\n styleBehavior(),\n ],\n },\n GtkBox: {\n behaviors: [boxSlot<Gtk.Box>()],\n },\n GtkListBox: {\n behaviors: [\n wrappingIndexedSlot(Gtk.ListBoxRow, (row, inner) => {\n row.setChild(inner);\n }),\n selectedIndexBehavior(),\n ],\n },\n GtkFlowBox: {\n behaviors: [\n wrappingIndexedSlot(Gtk.FlowBoxChild, (child, inner) => {\n child.setChild(inner);\n }),\n ],\n },\n GtkOverlay: {\n behaviors: [\n childSetterSlot<Gtk.Overlay>(),\n slot<Gtk.Overlay, Gtk.Widget>(\"overlays\", \"GtkWidget\", {\n attach: (overlay, child) => {\n overlay.addOverlay(child);\n },\n detach: (overlay, child) => {\n overlay.removeOverlay(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkShortcutController: {\n behaviors: [\n methodSlot<Gtk.ShortcutController, Gtk.Shortcut>(\n \"shortcuts\", \"GtkShortcut\", \"addShortcut\", \"removeShortcut\",\n ),\n ],\n },\n GtkTextChildAnchor: {\n behaviors: [{ create: () => Gtk.TextChildAnchor.new() }],\n },\n GtkTextView: {\n behaviors: [setterSlot<Gtk.TextView, Gtk.TextBuffer>(\"children\", \"GtkTextBuffer\", \"setBuffer\")],\n },\n GActionMap: {\n behaviors: [\n slot<Gio.ActionMap, Gio.Action>(\"actions\", \"GAction\", {\n attach: (map, action) => {\n map.addAction(action);\n },\n detach: (map, _action, info) => {\n map.removeAction((info.props.name as string | null) ?? \"\");\n },\n }),\n ],\n },\n GMenu: {\n behaviors: [\n list<Gio.Menu, MenuItem>(\"items\", {\n clear: (menu) => {\n menu.removeAll();\n },\n add: (menu, item) => {\n appendMenuItem(menu, item);\n },\n }),\n ],\n },\n GtkColumnView: {\n behaviors: [\n slot<Gtk.ColumnView, Gtk.ColumnViewColumn>(\"children\", \"GtkColumnViewColumn\", {\n attach: (view, column, info) => {\n view.insertColumn(info.index, column);\n },\n detach: (view, column) => {\n view.removeColumn(column);\n },\n }),\n ],\n },\n GtkGrid: {\n behaviors: [\n slot<Gtk.Grid, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (grid, child) => {\n grid.attach(child, 0, 0, 1, 1);\n },\n detach: (grid, child) => {\n grid.remove(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkFixed: {\n behaviors: [\n slot<Gtk.Fixed, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (fixed, child) => {\n fixed.put(child, 0, 0);\n },\n detach: (fixed, child) => {\n fixed.remove(child);\n },\n resolve: layoutChild,\n }),\n ],\n },\n GtkSizeGroup: {\n behaviors: [\n list<Gtk.SizeGroup, Gtk.Widget>(\"widgets\", {\n add: (group, widget) => {\n group.addWidget(widget);\n },\n remove: (group, widget) => {\n group.removeWidget(widget);\n },\n }),\n ],\n },\n GtkConstraintLayout: {\n behaviors: [\n methodSlot<Gtk.ConstraintLayout, Gtk.Constraint>(\n \"constraints\", \"GtkConstraint\", \"addConstraint\", \"removeConstraint\",\n ),\n methodSlot<Gtk.ConstraintLayout, Gtk.ConstraintGuide>(\n \"guides\", \"GtkConstraintGuide\", \"addGuide\", \"removeGuide\",\n ),\n list<Gtk.ConstraintLayout, VflConstraints, Gtk.Constraint[]>(\"vfl\", {\n add: (layout, item) => [\n ...layout.addConstraintsFromDescription(\n item.lines,\n item.hspacing ?? 0,\n item.vspacing ?? 0,\n item.views ?? new Map<string, Gtk.ConstraintTarget>(),\n ),\n ],\n remove: (layout, _item, constraints) => {\n for (const constraint of constraints) {\n layout.removeConstraint(constraint);\n }\n },\n }),\n ],\n },\n GtkStack: {\n behaviors: [\n methodSlot<Gtk.Stack, Gtk.Widget>(\"children\", \"GtkWidget\", \"addChild\", \"remove\"),\n deferred<Gtk.Stack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n GtkNotebook: {\n behaviors: [\n slot<Gtk.Notebook, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (notebook, child, info) => notebook.insertPage(child, null, info.index),\n reorder: (notebook, child, info) => {\n notebook.reorderChild(child, info.index);\n },\n detach: (notebook, child) => {\n notebook.detachTab(child);\n },\n resolve: (notebook, child) => notebook.getPage(child),\n }),\n ],\n },\n GtkApplication: {\n behaviors: [\n applicationCreator(Gtk.Application),\n methodSlot<Gtk.Application, Gtk.Window>(\"children\", \"GtkWindow\", \"addWindow\", \"removeWindow\"),\n list<Gtk.Application, ActionAccel>(\"actionAccels\", {\n add: (application, item) => {\n application.setAccelsForAction(item.detailedActionName, item.accels);\n },\n remove: (application, item) => {\n application.setAccelsForAction(item.detailedActionName, []);\n },\n }),\n list<Gtk.Application, MainOption>(\"mainOptions\", {\n add: (application, option) => {\n addMainOption(application, option);\n },\n }),\n ],\n },\n GtkAboutDialog: {\n behaviors: [\n list<Gtk.AboutDialog, CreditSection>(\"creditSections\", {\n add: (dialog, section) => {\n dialog.addCreditSection(section.sectionName, section.people);\n },\n }),\n ],\n },\n GtkScale: {\n behaviors: [\n list<Gtk.Scale, ScaleMark>(\"marks\", {\n add: (scale, mark) => {\n scale.addMark(mark.value ?? 0, mark.position, mark.markup ?? null);\n },\n clear: (scale) => {\n scale.clearMarks();\n },\n }),\n ],\n },\n GtkCalendar: {\n behaviors: [\n list<Gtk.Calendar, number>(\"markedDays\", {\n add: (calendar, day) => {\n calendar.markDay(day);\n },\n clear: (calendar) => {\n calendar.clearMarks();\n },\n }),\n ],\n },\n GtkLevelBar: {\n behaviors: [\n list<Gtk.LevelBar, LevelBarOffset>(\"offsets\", {\n add: (bar, offset) => {\n bar.addOffsetValue(offset.name, offset.value ?? 0);\n },\n remove: (bar, offset) => {\n bar.removeOffsetValue(offset.name);\n },\n }),\n ],\n },\n GtkDropTarget: {\n behaviors: [\n value<Gtk.DropTarget, GObject.Type[]>(\"types\", (target, types) => {\n target.setGtypes(types);\n }),\n ],\n },\n GtkDrawingArea: {\n behaviors: [\n value<Gtk.DrawingArea, Gtk.DrawingAreaDrawFunc>(\"drawFunc\", (area, draw) => {\n area.setDrawFunc(draw);\n area.queueDraw();\n }),\n ],\n },\n GtkDragSource: {\n behaviors: [\n value<Gtk.DragSource, DragSourceIcon>(\"icon\", (source, icon) => {\n source.setIcon(icon.paintable ?? null, icon.hotX ?? 0, icon.hotY ?? 0);\n }),\n ],\n },\n GtkEditable: {\n behaviors: [controlledText(\"text\")],\n },\n};\n\nfunction layoutChild(parent: Gtk.Widget, child: Gtk.Widget): GObject.Object | null {\n return parent.getLayoutManager()?.getLayoutChild(child) ?? null;\n}\n\nconst isNullish = (value: unknown): boolean => value === undefined || value === null;\nconst isInitialNull = (prevValue: unknown, value: unknown): boolean => value === null && prevValue === undefined;\n\nconst withStyleClass = (classes: unknown, className: string): string[] =>\n Array.isArray(classes) ? [...(classes as string[]), className] : [className];\n\nconst hasCssClassesChange = (prev: Props, next: Props): boolean => {\n const classes = next.cssClasses;\n\n if (classes === undefined || Object.is(prev.cssClasses, classes)) {\n return false;\n }\n\n return !isInitialNull(prev.cssClasses, classes);\n};\n\nconst didWriteCssClasses = (widget: Gtk.Widget, prev: Props, next: Props, className: string | null): boolean => {\n if (className === null || !hasCssClassesChange(prev, next)) {\n return false;\n }\n\n applyWrite(CSS_CLASSES_PROP, () => {\n Reflect.set(widget, CSS_CLASSES_PROP, withStyleClass(next.cssClasses, className));\n });\n\n return true;\n};\n\nconst isRestyled = (prev: Props, next: Props): boolean => {\n if (isNullish(prev.style) && isNullish(next.style)) {\n return false;\n }\n\n return !Object.is(prev.style, next.style);\n};\n\nfunction updateStyle(widget: Gtk.Widget, prev: Props, next: Props): Iterable<string> | undefined {\n const isChanged = isRestyled(prev, next);\n const className = isChanged ? applyStyle(widget, next.style) : styleClass(widget);\n\n if (!isChanged && className === null) {\n return;\n }\n\n return didWriteCssClasses(widget, prev, next, className) ? [\"style\", \"cssClasses\"] : [\"style\"];\n}\n\nfunction styleBehavior(): ElementBehavior<Gtk.Widget> {\n return { update: updateStyle };\n}\n\nfunction selectedRowIndex(box: Gtk.ListBox): number {\n return box.getSelectedRow()?.getIndex() ?? NO_SELECTION;\n}\n\nfunction selectedIndexError(value: number): Error {\n return new Error(\n \"The 'selectedIndex' of a <GtkListBox> must be a whole number, or -1 to select no row; \" +\n `received ${String(value)}.`,\n );\n}\n\nfunction desiredIndex(value: unknown): number | undefined {\n if (value === null) {\n return NO_SELECTION;\n }\n\n if (typeof value !== \"number\") {\n return undefined;\n }\n\n if (!Number.isSafeInteger(value)) {\n throw selectedIndexError(value);\n }\n\n return value;\n}\n\nfunction applySelectedIndex(box: Gtk.ListBox, index: number): void {\n if (index < 0) {\n box.unselectAll();\n\n return;\n }\n\n const row = box.getRowAtIndex(index);\n\n if (row !== null) {\n box.selectRow(row);\n }\n}\n\nfunction selectedIndexBehavior(): ElementBehavior<Gtk.ListBox> {\n return deferredWith<Gtk.ListBox, number>(SELECTED_INDEX_PROP, {\n parse: desiredIndex,\n read: selectedRowIndex,\n write: applySelectedIndex,\n signal: SELECTION_SIGNAL,\n });\n}\n\nconst addMainOption = (application: Gtk.Application, option: MainOption): void => {\n application.addMainOption(\n option.longName,\n option.shortName?.codePointAt(0) ?? 0,\n option.flags ?? GLib.OptionFlags.NONE,\n option.arg ?? GLib.OptionArg.NONE,\n option.description,\n option.argDescription ?? null,\n );\n};\n\nconst buildMenu = (items: MenuItem[]): Gio.Menu => {\n const menu = Gio.Menu.new();\n\n for (const item of items) {\n appendMenuItem(menu, item);\n }\n\n return menu;\n};\n\nfunction appendMenuItem(menu: Gio.Menu, item: MenuItem): void {\n const label = item.label ?? null;\n\n if (item.submenu !== undefined) {\n menu.appendSubmenu(label, buildMenu(item.submenu));\n\n return;\n }\n\n if (item.section !== undefined) {\n menu.appendSection(label, buildMenu(item.section));\n\n return;\n }\n\n menu.append(label, item.action ?? null);\n}\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
|
package/dist/element-config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-config.js","sourceRoot":"","sources":["../src/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,kBAAkB,GAAa;IACjC,gBAAgB;IAChB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,gBAAgB,GAAkC;IACpD,GAAG,QAAQ,CAAC,kBAAkB,EAAE;QAC5B,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;QAChC,YAAY,EAAE,CAAC,OAAO,CAAC;KAC1B,CAAC;IACF,GAAG,QAAQ,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE;QAC1C,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC,CAAC;IACF,SAAS,EAAE;QACP,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;QAChC,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC;QAC5C,YAAY,EAAE,CAAC,OAAO,CAAC;KAC1B;IACD,oBAAoB,EAAE;QAClB,SAAS,EAAE,QAAQ,CAAC,kCAAkC,CAAC;KAC1D;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC;KAC7C;IACD,kBAAkB,EAAE;QAChB,MAAM,EAAE,IAAI;KACf;IACD,mBAAmB,EAAE;QACjB,MAAM,EAAE,IAAI;KACf;IACD,qBAAqB,EAAE;QACnB,MAAM,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACV,MAAM,EAAE,IAAI;KACf;IACD,eAAe,EAAE;QACb,MAAM,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACV,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACtC;IACD,SAAS,EAAE;QACP,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC;KACpC;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"element-config.js","sourceRoot":"","sources":["../src/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,kBAAkB,GAAa;IACjC,gBAAgB;IAChB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,g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WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACtC;IACD,WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACtC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;KACxC;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC;KACzC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;KACxC;CACJ,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { type ElementConfig, forTypes, internal } from \"./reconciler/registry.js\";\n\nconst SINGLE_CHILD_TYPES: string[] = [\n \"GtkAspectFrame\",\n \"GtkButton\",\n \"GtkCheckButton\",\n \"GtkDragIcon\",\n \"GtkExpander\",\n \"GtkFlowBoxChild\",\n \"GtkFrame\",\n \"GtkGraphicsOffload\",\n \"GtkListBoxRow\",\n \"GtkListHeader\",\n \"GtkListItem\",\n \"GtkMenuButton\",\n \"GtkPopover\",\n \"GtkPopoverBin\",\n \"GtkRevealer\",\n \"GtkScrolledWindow\",\n \"GtkSearchBar\",\n \"GtkTreeExpander\",\n \"GtkViewport\",\n \"GtkWindowHandle\",\n];\n\n/**\n * The framework's own element configuration for the GTK types it customizes: the base props interface each\n * generated element extends, the component that wraps it, the GObject properties left out of its generated\n * props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never\n * reaches the GObject bindings.\n */\nconst BUILTIN_ELEMENTS: Record<string, ElementConfig> = {\n ...forTypes(SINGLE_CHILD_TYPES, {\n props: internal(\"ChildrenProps\"),\n omittedProps: [\"child\"],\n }),\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n props: internal(\"GtkHeaderBarProps\"),\n }),\n GtkWindow: {\n props: internal(\"ChildrenProps\"),\n component: internal(\"createWindowComponent\"),\n omittedProps: [\"child\"],\n },\n GtkApplicationWindow: {\n component: internal(\"createApplicationWindowComponent\"),\n },\n GtkLabel: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextBuffer: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextTag: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextChildAnchor: {\n props: internal(\"GtkTextChildAnchorProps\"),\n },\n GtkGridLayoutChild: {\n isLazy: true,\n },\n GtkFixedLayoutChild: {\n isLazy: true,\n },\n GtkOverlayLayoutChild: {\n isLazy: true,\n },\n GtkStackPage: {\n isLazy: true,\n },\n GtkNotebookPage: {\n isLazy: true,\n },\n GActionGroup: {\n props: internal(\"ActionGroupProps\"),\n },\n GtkWidget: {\n props: internal(\"GtkWidgetProps\"),\n },\n GtkBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkListBox: {\n props: internal(\"GtkListBoxProps\"),\n },\n GtkFlowBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkOverlay: {\n props: internal(\"GtkOverlayProps\"),\n omittedProps: [\"child\"],\n },\n GtkShortcutController: {\n props: internal(\"GtkShortcutControllerProps\"),\n },\n GtkTextView: {\n props: internal(\"ChildrenProps\"),\n },\n GActionMap: {\n props: internal(\"ActionMapProps\"),\n },\n GMenu: {\n props: internal(\"MenuProps\"),\n },\n GtkColumnView: {\n props: internal(\"ChildrenProps\"),\n },\n GtkGrid: {\n props: internal(\"ChildrenProps\"),\n },\n GtkFixed: {\n props: internal(\"ChildrenProps\"),\n },\n GtkSizeGroup: {\n props: internal(\"GtkSizeGroupProps\"),\n component: internal(\"createPortaledComponent\"),\n },\n GtkConstraintLayout: {\n props: internal(\"GtkConstraintLayoutProps\"),\n },\n GtkStack: {\n props: internal(\"ChildrenProps\"),\n },\n GtkNotebook: {\n props: internal(\"ChildrenProps\"),\n },\n GtkApplication: {\n props: internal(\"GtkApplicationProps\"),\n component: internal(\"createApplicationComponent\"),\n },\n GtkAboutDialog: {\n props: internal(\"GtkAboutDialogProps\"),\n },\n GtkScale: {\n props: internal(\"GtkScaleProps\"),\n },\n GtkCalendar: {\n props: internal(\"GtkCalendarProps\"),\n },\n GtkLevelBar: {\n props: internal(\"GtkLevelBarProps\"),\n },\n GtkDropTarget: {\n props: internal(\"GtkDropTargetProps\"),\n },\n GtkDrawingArea: {\n props: internal(\"GtkDrawingAreaProps\"),\n },\n GtkDragSource: {\n props: internal(\"GtkDragSourceProps\"),\n },\n};\n\nexport { SINGLE_CHILD_TYPES, BUILTIN_ELEMENTS };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-bind-setting.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-bind-setting.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAGpE,0CAA0C;AAC1C,KAAK,qBAAqB,CAAC,CAAC,SAAS,kBAAkB,IAAI;IACvD,iDAAiD;IACjD,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IACtB,oGAAoG;IACpG,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,kGAAkG;IAClG,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,iBAAS,cAAc,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAClD,MAAM,EACN,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAqC,GACxC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI,CAiBjC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Gio from "@gtkx/gi/gio";
|
|
2
2
|
import { kebabCase } from "@gtkx/utils";
|
|
3
3
|
import { useLayoutEffect } from "react";
|
|
4
|
+
import { getPropertyName } from "../reconciler/metadata.js";
|
|
4
5
|
import { resolveRefProp } from "../utils/ref-prop.js";
|
|
5
6
|
import { useSettings } from "./use-setting.js";
|
|
6
7
|
/**
|
|
@@ -9,17 +10,17 @@ import { useSettings } from "./use-setting.js";
|
|
|
9
10
|
*/
|
|
10
11
|
function useBindSetting({ schema, key, object, property, flags = Gio.SettingsBindFlags.DEFAULT, }) {
|
|
11
12
|
const settings = useSettings(schema);
|
|
12
|
-
const propertyName = kebabCase(property);
|
|
13
13
|
useLayoutEffect(() => {
|
|
14
14
|
const resolved = resolveRefProp(object);
|
|
15
15
|
if (!resolved) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
+
const propertyName = getPropertyName(resolved, property) ?? kebabCase(property);
|
|
18
19
|
settings.bind(key, resolved, propertyName, flags);
|
|
19
20
|
return () => {
|
|
20
21
|
Gio.Settings.unbind(resolved, propertyName);
|
|
21
22
|
};
|
|
22
|
-
}, [settings, key, object,
|
|
23
|
+
}, [settings, key, object, property, flags]);
|
|
23
24
|
}
|
|
24
25
|
export { useBindSetting };
|
|
25
26
|
//# sourceMappingURL=use-bind-setting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-bind-setting.js","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgB/C;;;GAGG;AACH,SAAS,cAAc,CAA+B,EAClD,MAAM,EACN,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAK,GAAG,GAAG,CAAC,iBAAiB,CAAC,OAAO,GACd;IACvB,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"use-bind-setting.js","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgB/C;;;GAGG;AACH,SAAS,cAAc,CAA+B,EAClD,MAAM,EACN,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAK,GAAG,GAAG,CAAC,iBAAiB,CAAC,OAAO,GACd;IACvB,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,eAAe,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QAED,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;QAChF,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACR,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gio from \"@gtkx/gi/gio\";\nimport { kebabCase } from \"@gtkx/utils\";\nimport { useLayoutEffect } from \"react\";\nimport type { SettingsSchema, SettingsSchemaKeys } from \"../utils/settings.js\";\nimport { getPropertyName } from \"../reconciler/metadata.js\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\nimport { useSettings } from \"./use-setting.js\";\n\n/** Options for {@link useBindSetting}. */\ntype UseBindSettingOptions<K extends SettingsSchemaKeys> = {\n /** Schema the settings object is opened from. */\n schema: SettingsSchema<K>;\n /** Key of that schema to bind. */\n key: keyof K & string;\n /** Object holding the property, given directly or as a ref; nothing is bound while it is absent. */\n object: RefProp<GObject.Object>;\n /** camelCase name of the property to keep in sync with the key. */\n property: string;\n /** Direction and conversion behavior of the bind; defaults to `Gio.SettingsBindFlags.DEFAULT`. */\n flags?: Gio.SettingsBindFlags;\n};\n\n/**\n * Binds a GSettings key to a property of a GObject, keeping the two in sync until the component unmounts.\n * `property` is given in camelCase, and `flags` defaults to `Gio.SettingsBindFlags.DEFAULT`, a two-way bind.\n */\nfunction useBindSetting<K extends SettingsSchemaKeys>({\n schema,\n key,\n object,\n property,\n flags = Gio.SettingsBindFlags.DEFAULT,\n}: UseBindSettingOptions<K>): void {\n const settings = useSettings(schema);\n\n useLayoutEffect(() => {\n const resolved = resolveRefProp(object);\n\n if (!resolved) {\n return;\n }\n\n const propertyName = getPropertyName(resolved, property) ?? kebabCase(property);\n settings.bind(key, resolved, propertyName, flags);\n\n return () => {\n Gio.Settings.unbind(resolved, propertyName);\n };\n }, [settings, key, object, property, flags]);\n}\n\nexport { useBindSetting };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as GObject from "@gtkx/gi/gobject";
|
|
2
|
-
import type
|
|
2
|
+
import { type RefProp } from "../utils/ref-prop.js";
|
|
3
3
|
/** The property map `T` declares, from camelCase property name to value type. */
|
|
4
4
|
type Properties<T extends GObject.Object> = NonNullable<T["__properties__"]>;
|
|
5
5
|
/** Every property `T` declares that is also readable off the instance, in camelCase. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-property.d.ts","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-property.d.ts","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAGpE,iFAAiF;AACjF,KAAK,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAC7E,wFAAwF;AACxF,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,MAAM,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,YAAY,EAAE,CAAC,GAAG,MAAM,GACzB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAKlB;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { kebabCase } from "@gtkx/utils";
|
|
2
|
+
import { getPropertyName } from "../reconciler/metadata.js";
|
|
3
|
+
import { resolveRefProp } from "../utils/ref-prop.js";
|
|
2
4
|
import { useObjectValue } from "./use-object-value.js";
|
|
3
5
|
/**
|
|
4
6
|
* Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
|
|
@@ -7,7 +9,9 @@ import { useObjectValue } from "./use-object-value.js";
|
|
|
7
9
|
* @returns The current value, or `undefined` while the object is null or an unresolved ref.
|
|
8
10
|
*/
|
|
9
11
|
function useProperty(object, propertyName) {
|
|
10
|
-
|
|
12
|
+
const resolved = resolveRefProp(object);
|
|
13
|
+
const name = (resolved === null ? undefined : getPropertyName(resolved, propertyName)) ?? kebabCase(propertyName);
|
|
14
|
+
return useObjectValue(object, `notify::${name}`, (obj) => obj?.[propertyName]);
|
|
11
15
|
}
|
|
12
16
|
export { useProperty };
|
|
13
17
|
//# sourceMappingURL=use-property.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAOvD;;;;;GAKG;AACH,SAAS,WAAW,CAChB,MAAkB,EAClB,YAAwB;IAExB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;IAElH,OAAO,cAAc,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport { kebabCase } from \"@gtkx/utils\";\nimport { getPropertyName } from \"../reconciler/metadata.js\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\nimport { useObjectValue } from \"./use-object-value.js\";\n\n/** The property map `T` declares, from camelCase property name to value type. */\ntype Properties<T extends GObject.Object> = NonNullable<T[\"__properties__\"]>;\n/** Every property `T` declares that is also readable off the instance, in camelCase. */\ntype PropertyName<T extends GObject.Object> = keyof Properties<T> & keyof T;\n\n/**\n * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.\n *\n * @param propertyName The camelCase name of a readable property on the object.\n * @returns The current value, or `undefined` while the object is null or an unresolved ref.\n */\nfunction useProperty<T extends GObject.Object, P extends PropertyName<T>>(\n object: RefProp<T>,\n propertyName: P & string,\n): T[P] | undefined {\n const resolved = resolveRefProp(object);\n const name = (resolved === null ? undefined : getPropertyName(resolved, propertyName)) ?? kebabCase(propertyName);\n\n return useObjectValue(object, `notify::${name}`, (obj) => obj?.[propertyName]);\n}\n\nexport { useProperty };\n"]}
|
package/dist/prop-types.d.ts
CHANGED
|
@@ -152,6 +152,14 @@ type GtkScaleProps = {
|
|
|
152
152
|
/** Marks drawn along the scale, cleared and re-added whenever the list changes. */
|
|
153
153
|
marks?: ScaleMark[] | null | undefined;
|
|
154
154
|
};
|
|
155
|
+
/** Props of a `Gtk.ListBox` element. */
|
|
156
|
+
type GtkListBoxProps = {
|
|
157
|
+
/**
|
|
158
|
+
* Index of the row to select; `-1` or `null` selects none. Applied once the row exists, and
|
|
159
|
+
* re-applied whenever the box's own selection drifts from it. Left alone while the prop is absent.
|
|
160
|
+
*/
|
|
161
|
+
selectedIndex?: number | null | undefined;
|
|
162
|
+
} & ChildrenProps;
|
|
155
163
|
/** Props of a `Gtk.Calendar` element. */
|
|
156
164
|
type GtkCalendarProps = {
|
|
157
165
|
/** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */
|
|
@@ -200,5 +208,5 @@ type GtkDragSourceProps = {
|
|
|
200
208
|
/** Icon shown under the pointer while a drag started from this source is in flight. */
|
|
201
209
|
icon?: DragSourceIcon | null | undefined;
|
|
202
210
|
};
|
|
203
|
-
export { type MenuItem, type VflConstraints, type ScaleMark, type LevelBarOffset, type CreditSection, type MainOption, type ActionAccel, type DragSourceIcon, type ChildrenProps, type GtkWidgetProps, type Style, type StyleProperties, type ActionGroupProps, type ActionMapProps, type MenuProps, type GtkShortcutControllerProps, type GtkOverlayProps, type GtkTextChildAnchorProps, type GtkConstraintLayoutProps, type GtkHeaderBarProps, type GtkScaleProps, type GtkCalendarProps, type GtkLevelBarProps, type GtkSizeGroupProps, type GtkAboutDialogProps, type GtkApplicationProps, type GtkDropTargetProps, type GtkDrawingAreaProps, type GtkDragSourceProps, };
|
|
211
|
+
export { type MenuItem, type VflConstraints, type ScaleMark, type LevelBarOffset, type CreditSection, type MainOption, type ActionAccel, type DragSourceIcon, type ChildrenProps, type GtkWidgetProps, type Style, type StyleProperties, type ActionGroupProps, type ActionMapProps, type MenuProps, type GtkShortcutControllerProps, type GtkOverlayProps, type GtkTextChildAnchorProps, type GtkConstraintLayoutProps, type GtkHeaderBarProps, type GtkScaleProps, type GtkListBoxProps, type GtkCalendarProps, type GtkLevelBarProps, type GtkSizeGroupProps, type GtkAboutDialogProps, type GtkApplicationProps, type GtkDropTargetProps, type GtkDrawingAreaProps, type GtkDragSourceProps, };
|
|
204
212
|
//# sourceMappingURL=prop-types.d.ts.map
|
package/dist/prop-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,IAAI,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,yFAAyF;AACzF,KAAK,QAAQ,GAAG;IACZ,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,iGAAiG;IACjG,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,4EAA4E;AAC5E,KAAK,cAAc,GAAG;IAClB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF,iCAAiC;AACjC,KAAK,SAAS,GAAG;IACb,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,EAAE,GAAG,CAA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KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GAC1B,CAAC"}
|
package/dist/prop-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAgTA,OAAO,EA8BN,CAAC","sourcesContent":["/* eslint-disable gtkx/no-library-prefix */\nimport type * as Gdk from \"@gtkx/gi/gdk\";\nimport type * as GLib from \"@gtkx/gi/glib\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { CSSProperties, ReactNode } from \"react\";\n\n/** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */\ntype MenuItem = {\n /** Text shown for the entry, or the heading of the submenu or section it introduces. */\n label?: string | null;\n /** Detailed action name the entry activates, ignored when `submenu` or `section` is given. */\n action?: string | null;\n /** Entries of a separate menu the labelled entry opens. */\n submenu?: MenuItem[];\n /** Entries appended below the label as an inline section, used only when `submenu` is absent. */\n section?: MenuItem[];\n};\n\n/** One Visual Format Language block applied to a `Gtk.ConstraintLayout`. */\ntype VflConstraints = {\n /** Format lines, each describing every constraint on one row or column. */\n lines: string[];\n /** Default horizontal spacing the `-` operator stands for; defaults to 0. */\n hspacing?: number;\n /** Default vertical spacing the `-` operator stands for; defaults to 0. */\n vspacing?: number;\n /** Targets the view names in `lines` refer to; defaults to none. */\n views?: Map<string, Gtk.ConstraintTarget>;\n};\n\n/** One mark on a `Gtk.Scale`. */\ntype ScaleMark = {\n /** Point on the scale the mark is drawn at; defaults to 0. */\n value?: number;\n /** Side of the scale the mark and its label sit on. */\n position: Gtk.PositionType;\n /** Pango markup drawn beside the mark, or `null` for an unlabelled one. */\n markup?: string | null;\n};\n\n/** One labelled offset on a `Gtk.LevelBar`. */\ntype LevelBarOffset = {\n /** Style class applied to the bar's blocks while the value falls in this offset's interval. */\n name: string;\n /** Upper bound of that interval; defaults to 0. */\n value?: number;\n};\n\n/** One credit section on a `Gtk.AboutDialog`. */\ntype CreditSection = {\n /** Heading the names are listed under. */\n sectionName: string;\n /** Names listed in the section. */\n people: string[];\n};\n\n/** One command-line option a `Gtk.Application` accepts. */\ntype MainOption = {\n /** Name the option is spelled with after two dashes, such as `verbose` for `--verbose`. */\n longName: string;\n /** Single character the option is spelled with after one dash, such as `v` for `-v`; defaults to none. */\n shortName?: string | null;\n /** How the option itself is parsed and listed; defaults to `GLib.OptionFlags.NONE`. */\n flags?: GLib.OptionFlags;\n /** Type of argument the option takes; defaults to `GLib.OptionArg.NONE`, meaning it takes none. */\n arg?: GLib.OptionArg;\n /** Text describing the option in `--help`. */\n description: string;\n /** Placeholder standing for the option's argument in `--help`; defaults to none. */\n argDescription?: string | null;\n};\n\n/** One accelerator binding on a `Gtk.Application`. */\ntype ActionAccel = {\n /** Action the accelerators activate, such as `app.quit` or `win.open('file')`. */\n detailedActionName: string;\n /** Accelerators in `Gtk.acceleratorParse` syntax, cleared when the entry goes away. */\n accels: string[];\n};\n\n/** The drag icon of a `Gtk.DragSource`, with its hotspot. */\ntype DragSourceIcon = {\n /** Image shown under the pointer during the drag; defaults to none. */\n paintable?: Gdk.Paintable | null;\n /** Horizontal offset of the pointer within the image; defaults to 0. */\n hotX?: number;\n /** Vertical offset of the pointer within the image; defaults to 0. */\n hotY?: number;\n};\n\n/** Props of an element that accepts children. */\ntype ChildrenProps = {\n /** Elements attached to the element's default child slot, or its text for elements that hold text. */\n children?: ReactNode;\n};\n\n/** Paint and typography declarations GTK4 CSS accepts, spelled the way React DOM spells them. */\ntype StyleProperties = Pick<\n CSSProperties,\n | \"animation\" |\n \"animationDelay\" |\n \"animationDirection\" |\n \"animationDuration\" |\n \"animationFillMode\" |\n \"animationIterationCount\" |\n \"animationName\" |\n \"animationPlayState\" |\n \"animationTimingFunction\" |\n \"background\" |\n \"backgroundClip\" |\n \"backgroundColor\" |\n \"backgroundImage\" |\n \"backgroundOrigin\" |\n \"backgroundPosition\" |\n \"backgroundRepeat\" |\n \"backgroundSize\" |\n \"border\" |\n \"borderBottom\" |\n \"borderColor\" |\n \"borderLeft\" |\n \"borderRadius\" |\n \"borderRight\" |\n \"borderStyle\" |\n \"borderTop\" |\n \"borderWidth\" |\n \"boxShadow\" |\n \"caretColor\" |\n \"color\" |\n \"filter\" |\n \"font\" |\n \"fontFamily\" |\n \"fontSize\" |\n \"fontStyle\" |\n \"fontVariant\" |\n \"fontWeight\" |\n \"letterSpacing\" |\n \"lineHeight\" |\n \"margin\" |\n \"marginBottom\" |\n \"marginLeft\" |\n \"marginRight\" |\n \"marginTop\" |\n \"minHeight\" |\n \"minWidth\" |\n \"opacity\" |\n \"outline\" |\n \"outlineColor\" |\n \"outlineOffset\" |\n \"outlineStyle\" |\n \"outlineWidth\" |\n \"padding\" |\n \"paddingBottom\" |\n \"paddingLeft\" |\n \"paddingRight\" |\n \"paddingTop\" |\n \"textDecoration\" |\n \"textDecorationColor\" |\n \"textDecorationLine\" |\n \"textDecorationStyle\" |\n \"textShadow\" |\n \"textTransform\" |\n \"transform\" |\n \"transformOrigin\" |\n \"transition\" |\n \"transitionDelay\" |\n \"transitionDuration\" |\n \"transitionProperty\" |\n \"transitionTimingFunction\"\n>;\n\n/**\n * Style declarations for one widget. A key starting with `&` nests a block under a selector derived from\n * it, such as `\"&:hover\"` or `\"& label\"`. GTK4 CSS covers paint and typography only, so layout properties\n * such as `display`, `width` and `gap` are deliberately absent; use the widget's own layout props instead.\n */\ntype Style = StyleProperties & Partial<Record<`&${string}`, StyleProperties>>;\n\n/** Objects a widget takes through a method call rather than a property. */\ntype GtkWidgetProps = {\n /** `Gtk.EventController` elements added to the widget. */\n controllers?: ReactNode | null | undefined;\n /** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */\n actionGroups?: ReactNode | null | undefined;\n /** Style declarations applied to this widget alone, outranking any class in `cssClasses`. */\n style?: Style | null | undefined;\n} & ChildrenProps;\n\n/** Props of an action group placed in a widget's `actionGroups` slot. */\ntype ActionGroupProps = {\n /** Prefix the group's actions are addressed by, such as `win`; defaults to the empty string. */\n prefix?: string | null | undefined;\n};\n\n/** Props of an element implementing `Gio.ActionMap`. */\ntype ActionMapProps = {\n /** `Gio.Action` elements added to the map, removed again by their `name`. */\n actions?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gio.Menu` element. */\ntype MenuProps = {\n /** Entries the menu is rebuilt from whenever they change. */\n items?: MenuItem[] | null | undefined;\n};\n\n/** Props of a `Gtk.ShortcutController` element. */\ntype GtkShortcutControllerProps = {\n /** `Gtk.Shortcut` elements the controller watches for. */\n shortcuts?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Overlay` element, whose `children` is the widget the overlays sit above. */\ntype GtkOverlayProps = {\n /** Widgets stacked over the main child. */\n overlays?: ReactNode | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.ConstraintLayout` element. */\ntype GtkConstraintLayoutProps = {\n /** `Gtk.Constraint` elements added to the layout. */\n constraints?: ReactNode | null | undefined;\n /** `Gtk.ConstraintGuide` elements added to the layout as invisible spacers. */\n guides?: ReactNode | null | undefined;\n /** Visual Format Language blocks whose constraints are added alongside `constraints`. */\n vfl?: VflConstraints[] | null | undefined;\n};\n\n/** Props of `GtkTextChildAnchor`, which embeds either a child widget or a paintable in a text buffer. */\ntype GtkTextChildAnchorProps = {\n /** Image inserted into the buffer instead of an anchored widget; giving both is an error. */\n paintable?: Gdk.Paintable | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.HeaderBar` or `Gtk.ActionBar` element. */\ntype GtkHeaderBarProps = {\n /** Widgets packed at the start of the bar. */\n start?: ReactNode | null | undefined;\n /** Widgets packed at the end of the bar. */\n end?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Scale` element. */\ntype GtkScaleProps = {\n /** Marks drawn along the scale, cleared and re-added whenever the list changes. */\n marks?: ScaleMark[] | null | undefined;\n};\n\n/** Props of a `Gtk.Calendar` element. */\ntype GtkCalendarProps = {\n /** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */\n markedDays?: number[] | null | undefined;\n};\n\n/** Props of a `Gtk.LevelBar` element. */\ntype GtkLevelBarProps = {\n /** Offsets that split the bar's range into differently styled intervals. */\n offsets?: LevelBarOffset[] | null | undefined;\n};\n\n/** Props of a `Gtk.SizeGroup` element. */\ntype GtkSizeGroupProps = {\n /** Widgets the group keeps at a common size. */\n widgets?: Gtk.Widget[] | null | undefined;\n};\n\n/** Props of a `Gtk.AboutDialog` element. */\ntype GtkAboutDialogProps = {\n /**\n * Extra sections appended to the dialog's credits. GTK offers no way to remove one, so the list\n * cannot change once it has been applied.\n */\n creditSections?: CreditSection[] | null | undefined;\n};\n\n/** Props of a `Gtk.Application` element, whose `children` are the windows it owns. */\ntype GtkApplicationProps = {\n /** Accelerators bound to the application's actions. */\n actionAccels?: ActionAccel[] | null | undefined;\n /**\n * Command-line options the application parses, registered before it starts. GLib offers no way to\n * unregister one, so the list cannot change once it has been applied.\n */\n mainOptions?: MainOption[] | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.DropTarget` element. */\ntype GtkDropTargetProps = {\n /** GTypes the target accepts a drop of. */\n types?: GObject.Type[] | null | undefined;\n};\n\n/** Props of a `Gtk.DrawingArea` element. */\ntype GtkDrawingAreaProps = {\n /** Callback that draws the area's contents; setting it queues a redraw. */\n drawFunc?: Gtk.DrawingAreaDrawFunc | null | undefined;\n};\n\n/** Props of a `Gtk.DragSource` element. */\ntype GtkDragSourceProps = {\n /** Icon shown under the pointer while a drag started from this source is in flight. */\n icon?: DragSourceIcon | null | undefined;\n};\n\nexport {\n type MenuItem,\n type VflConstraints,\n type ScaleMark,\n type LevelBarOffset,\n type CreditSection,\n type MainOption,\n type ActionAccel,\n type DragSourceIcon,\n type ChildrenProps,\n type GtkWidgetProps,\n type Style,\n type StyleProperties,\n type ActionGroupProps,\n type ActionMapProps,\n type MenuProps,\n type GtkShortcutControllerProps,\n type GtkOverlayProps,\n type GtkTextChildAnchorProps,\n type GtkConstraintLayoutProps,\n type GtkHeaderBarProps,\n type GtkScaleProps,\n type GtkCalendarProps,\n type GtkLevelBarProps,\n type GtkSizeGroupProps,\n type GtkAboutDialogProps,\n type GtkApplicationProps,\n type GtkDropTargetProps,\n type GtkDrawingAreaProps,\n type GtkDragSourceProps,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAyTA,OAAO,EA+BN,CAAC","sourcesContent":["/* eslint-disable gtkx/no-library-prefix */\nimport type * as Gdk from \"@gtkx/gi/gdk\";\nimport type * as GLib from \"@gtkx/gi/glib\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { CSSProperties, ReactNode } from \"react\";\n\n/** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */\ntype MenuItem = {\n /** Text shown for the entry, or the heading of the submenu or section it introduces. */\n label?: string | null;\n /** Detailed action name the entry activates, ignored when `submenu` or `section` is given. */\n action?: string | null;\n /** Entries of a separate menu the labelled entry opens. */\n submenu?: MenuItem[];\n /** Entries appended below the label as an inline section, used only when `submenu` is absent. */\n section?: MenuItem[];\n};\n\n/** One Visual Format Language block applied to a `Gtk.ConstraintLayout`. */\ntype VflConstraints = {\n /** Format lines, each describing every constraint on one row or column. */\n lines: string[];\n /** Default horizontal spacing the `-` operator stands for; defaults to 0. */\n hspacing?: number;\n /** Default vertical spacing the `-` operator stands for; defaults to 0. */\n vspacing?: number;\n /** Targets the view names in `lines` refer to; defaults to none. */\n views?: Map<string, Gtk.ConstraintTarget>;\n};\n\n/** One mark on a `Gtk.Scale`. */\ntype ScaleMark = {\n /** Point on the scale the mark is drawn at; defaults to 0. */\n value?: number;\n /** Side of the scale the mark and its label sit on. */\n position: Gtk.PositionType;\n /** Pango markup drawn beside the mark, or `null` for an unlabelled one. */\n markup?: string | null;\n};\n\n/** One labelled offset on a `Gtk.LevelBar`. */\ntype LevelBarOffset = {\n /** Style class applied to the bar's blocks while the value falls in this offset's interval. */\n name: string;\n /** Upper bound of that interval; defaults to 0. */\n value?: number;\n};\n\n/** One credit section on a `Gtk.AboutDialog`. */\ntype CreditSection = {\n /** Heading the names are listed under. */\n sectionName: string;\n /** Names listed in the section. */\n people: string[];\n};\n\n/** One command-line option a `Gtk.Application` accepts. */\ntype MainOption = {\n /** Name the option is spelled with after two dashes, such as `verbose` for `--verbose`. */\n longName: string;\n /** Single character the option is spelled with after one dash, such as `v` for `-v`; defaults to none. */\n shortName?: string | null;\n /** How the option itself is parsed and listed; defaults to `GLib.OptionFlags.NONE`. */\n flags?: GLib.OptionFlags;\n /** Type of argument the option takes; defaults to `GLib.OptionArg.NONE`, meaning it takes none. */\n arg?: GLib.OptionArg;\n /** Text describing the option in `--help`. */\n description: string;\n /** Placeholder standing for the option's argument in `--help`; defaults to none. */\n argDescription?: string | null;\n};\n\n/** One accelerator binding on a `Gtk.Application`. */\ntype ActionAccel = {\n /** Action the accelerators activate, such as `app.quit` or `win.open('file')`. */\n detailedActionName: string;\n /** Accelerators in `Gtk.acceleratorParse` syntax, cleared when the entry goes away. */\n accels: string[];\n};\n\n/** The drag icon of a `Gtk.DragSource`, with its hotspot. */\ntype DragSourceIcon = {\n /** Image shown under the pointer during the drag; defaults to none. */\n paintable?: Gdk.Paintable | null;\n /** Horizontal offset of the pointer within the image; defaults to 0. */\n hotX?: number;\n /** Vertical offset of the pointer within the image; defaults to 0. */\n hotY?: number;\n};\n\n/** Props of an element that accepts children. */\ntype ChildrenProps = {\n /** Elements attached to the element's default child slot, or its text for elements that hold text. */\n children?: ReactNode;\n};\n\n/** Paint and typography declarations GTK4 CSS accepts, spelled the way React DOM spells them. */\ntype StyleProperties = Pick<\n CSSProperties,\n | \"animation\" |\n \"animationDelay\" |\n \"animationDirection\" |\n \"animationDuration\" |\n \"animationFillMode\" |\n \"animationIterationCount\" |\n \"animationName\" |\n \"animationPlayState\" |\n \"animationTimingFunction\" |\n \"background\" |\n \"backgroundClip\" |\n \"backgroundColor\" |\n \"backgroundImage\" |\n \"backgroundOrigin\" |\n \"backgroundPosition\" |\n \"backgroundRepeat\" |\n \"backgroundSize\" |\n \"border\" |\n \"borderBottom\" |\n \"borderColor\" |\n \"borderLeft\" |\n \"borderRadius\" |\n \"borderRight\" |\n \"borderStyle\" |\n \"borderTop\" |\n \"borderWidth\" |\n \"boxShadow\" |\n \"caretColor\" |\n \"color\" |\n \"filter\" |\n \"font\" |\n \"fontFamily\" |\n \"fontSize\" |\n \"fontStyle\" |\n \"fontVariant\" |\n \"fontWeight\" |\n \"letterSpacing\" |\n \"lineHeight\" |\n \"margin\" |\n \"marginBottom\" |\n \"marginLeft\" |\n \"marginRight\" |\n \"marginTop\" |\n \"minHeight\" |\n \"minWidth\" |\n \"opacity\" |\n \"outline\" |\n \"outlineColor\" |\n \"outlineOffset\" |\n \"outlineStyle\" |\n \"outlineWidth\" |\n \"padding\" |\n \"paddingBottom\" |\n \"paddingLeft\" |\n \"paddingRight\" |\n \"paddingTop\" |\n \"textDecoration\" |\n \"textDecorationColor\" |\n \"textDecorationLine\" |\n \"textDecorationStyle\" |\n \"textShadow\" |\n \"textTransform\" |\n \"transform\" |\n \"transformOrigin\" |\n \"transition\" |\n \"transitionDelay\" |\n \"transitionDuration\" |\n \"transitionProperty\" |\n \"transitionTimingFunction\"\n>;\n\n/**\n * Style declarations for one widget. A key starting with `&` nests a block under a selector derived from\n * it, such as `\"&:hover\"` or `\"& label\"`. GTK4 CSS covers paint and typography only, so layout properties\n * such as `display`, `width` and `gap` are deliberately absent; use the widget's own layout props instead.\n */\ntype Style = StyleProperties & Partial<Record<`&${string}`, StyleProperties>>;\n\n/** Objects a widget takes through a method call rather than a property. */\ntype GtkWidgetProps = {\n /** `Gtk.EventController` elements added to the widget. */\n controllers?: ReactNode | null | undefined;\n /** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */\n actionGroups?: ReactNode | null | undefined;\n /** Style declarations applied to this widget alone, outranking any class in `cssClasses`. */\n style?: Style | null | undefined;\n} & ChildrenProps;\n\n/** Props of an action group placed in a widget's `actionGroups` slot. */\ntype ActionGroupProps = {\n /** Prefix the group's actions are addressed by, such as `win`; defaults to the empty string. */\n prefix?: string | null | undefined;\n};\n\n/** Props of an element implementing `Gio.ActionMap`. */\ntype ActionMapProps = {\n /** `Gio.Action` elements added to the map, removed again by their `name`. */\n actions?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gio.Menu` element. */\ntype MenuProps = {\n /** Entries the menu is rebuilt from whenever they change. */\n items?: MenuItem[] | null | undefined;\n};\n\n/** Props of a `Gtk.ShortcutController` element. */\ntype GtkShortcutControllerProps = {\n /** `Gtk.Shortcut` elements the controller watches for. */\n shortcuts?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Overlay` element, whose `children` is the widget the overlays sit above. */\ntype GtkOverlayProps = {\n /** Widgets stacked over the main child. */\n overlays?: ReactNode | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.ConstraintLayout` element. */\ntype GtkConstraintLayoutProps = {\n /** `Gtk.Constraint` elements added to the layout. */\n constraints?: ReactNode | null | undefined;\n /** `Gtk.ConstraintGuide` elements added to the layout as invisible spacers. */\n guides?: ReactNode | null | undefined;\n /** Visual Format Language blocks whose constraints are added alongside `constraints`. */\n vfl?: VflConstraints[] | null | undefined;\n};\n\n/** Props of `GtkTextChildAnchor`, which embeds either a child widget or a paintable in a text buffer. */\ntype GtkTextChildAnchorProps = {\n /** Image inserted into the buffer instead of an anchored widget; giving both is an error. */\n paintable?: Gdk.Paintable | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.HeaderBar` or `Gtk.ActionBar` element. */\ntype GtkHeaderBarProps = {\n /** Widgets packed at the start of the bar. */\n start?: ReactNode | null | undefined;\n /** Widgets packed at the end of the bar. */\n end?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Scale` element. */\ntype GtkScaleProps = {\n /** Marks drawn along the scale, cleared and re-added whenever the list changes. */\n marks?: ScaleMark[] | null | undefined;\n};\n\n/** Props of a `Gtk.ListBox` element. */\ntype GtkListBoxProps = {\n /**\n * Index of the row to select; `-1` or `null` selects none. Applied once the row exists, and\n * re-applied whenever the box's own selection drifts from it. Left alone while the prop is absent.\n */\n selectedIndex?: number | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.Calendar` element. */\ntype GtkCalendarProps = {\n /** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */\n markedDays?: number[] | null | undefined;\n};\n\n/** Props of a `Gtk.LevelBar` element. */\ntype GtkLevelBarProps = {\n /** Offsets that split the bar's range into differently styled intervals. */\n offsets?: LevelBarOffset[] | null | undefined;\n};\n\n/** Props of a `Gtk.SizeGroup` element. */\ntype GtkSizeGroupProps = {\n /** Widgets the group keeps at a common size. */\n widgets?: Gtk.Widget[] | null | undefined;\n};\n\n/** Props of a `Gtk.AboutDialog` element. */\ntype GtkAboutDialogProps = {\n /**\n * Extra sections appended to the dialog's credits. GTK offers no way to remove one, so the list\n * cannot change once it has been applied.\n */\n creditSections?: CreditSection[] | null | undefined;\n};\n\n/** Props of a `Gtk.Application` element, whose `children` are the windows it owns. */\ntype GtkApplicationProps = {\n /** Accelerators bound to the application's actions. */\n actionAccels?: ActionAccel[] | null | undefined;\n /**\n * Command-line options the application parses, registered before it starts. GLib offers no way to\n * unregister one, so the list cannot change once it has been applied.\n */\n mainOptions?: MainOption[] | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.DropTarget` element. */\ntype GtkDropTargetProps = {\n /** GTypes the target accepts a drop of. */\n types?: GObject.Type[] | null | undefined;\n};\n\n/** Props of a `Gtk.DrawingArea` element. */\ntype GtkDrawingAreaProps = {\n /** Callback that draws the area's contents; setting it queues a redraw. */\n drawFunc?: Gtk.DrawingAreaDrawFunc | null | undefined;\n};\n\n/** Props of a `Gtk.DragSource` element. */\ntype GtkDragSourceProps = {\n /** Icon shown under the pointer while a drag started from this source is in flight. */\n icon?: DragSourceIcon | null | undefined;\n};\n\nexport {\n type MenuItem,\n type VflConstraints,\n type ScaleMark,\n type LevelBarOffset,\n type CreditSection,\n type MainOption,\n type ActionAccel,\n type DragSourceIcon,\n type ChildrenProps,\n type GtkWidgetProps,\n type Style,\n type StyleProperties,\n type ActionGroupProps,\n type ActionMapProps,\n type MenuProps,\n type GtkShortcutControllerProps,\n type GtkOverlayProps,\n type GtkTextChildAnchorProps,\n type GtkConstraintLayoutProps,\n type GtkHeaderBarProps,\n type GtkScaleProps,\n type GtkListBoxProps,\n type GtkCalendarProps,\n type GtkLevelBarProps,\n type GtkSizeGroupProps,\n type GtkAboutDialogProps,\n type GtkApplicationProps,\n type GtkDropTargetProps,\n type GtkDrawingAreaProps,\n type GtkDragSourceProps,\n};\n"]}
|