@gtkx/react 1.0.0-rc.4 → 1.0.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 -5
- package/dist/adw/dialog.d.ts +3 -4
- package/dist/adw/dialog.d.ts.map +1 -1
- package/dist/adw/dialog.js +15 -21
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +102 -54
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +0 -6
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +15 -17
- package/dist/adw/element-config.js.map +1 -1
- package/dist/adw/prop-types.d.ts +34 -3
- package/dist/adw/prop-types.d.ts.map +1 -1
- package/dist/adw/prop-types.js.map +1 -1
- package/dist/components/application-window.d.ts +5 -0
- package/dist/components/application-window.d.ts.map +1 -0
- package/dist/components/application-window.js +7 -0
- package/dist/components/application-window.js.map +1 -0
- package/dist/components/application.d.ts +2 -8
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +21 -6
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +13 -1
- package/dist/components/element.d.ts.map +1 -1
- package/dist/components/element.js +39 -14
- package/dist/components/element.js.map +1 -1
- package/dist/components/portaled.d.ts +5 -0
- package/dist/components/portaled.d.ts.map +1 -0
- package/dist/components/portaled.js +8 -0
- package/dist/components/portaled.js.map +1 -0
- package/dist/components/window.d.ts +5 -5
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +16 -16
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/element-behaviors.js +11 -1
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.d.ts.map +1 -1
- package/dist/element-config.js +7 -4
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-merged-refs.d.ts +1 -4
- package/dist/hooks/use-merged-refs.d.ts.map +1 -1
- package/dist/hooks/use-merged-refs.js +1 -1
- package/dist/hooks/use-merged-refs.js.map +1 -1
- package/dist/hooks/use-presented-instance.d.ts +12 -0
- package/dist/hooks/use-presented-instance.d.ts.map +1 -0
- package/dist/hooks/use-presented-instance.js +27 -0
- package/dist/hooks/use-presented-instance.js.map +1 -0
- package/dist/hooks/use-property.d.ts +2 -1
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +2 -1
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +29 -5
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts +4 -4
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +62 -20
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +9 -5
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +40 -22
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/devtools.d.ts +6 -0
- package/dist/reconciler/devtools.d.ts.map +1 -0
- package/dist/reconciler/devtools.js +11 -0
- package/dist/reconciler/devtools.js.map +1 -0
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +17 -26
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.d.ts.map +1 -1
- package/dist/reconciler/instance.js +5 -3
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +1 -1
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +2 -4
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/node.d.ts +3 -2
- package/dist/reconciler/node.d.ts.map +1 -1
- package/dist/reconciler/node.js +7 -6
- package/dist/reconciler/node.js.map +1 -1
- package/dist/reconciler/placement.js +20 -20
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +9 -7
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root-element.d.ts +1 -0
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +3 -0
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +2 -0
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +1 -2
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +1 -1
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/utils/accessible-props.d.ts +8 -8
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js +11 -13
- package/dist/utils/accessible-props.js.map +1 -1
- package/dist/utils/settings.d.ts +2 -1
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/settings.js.map +1 -1
- package/dist/utils/variant.d.ts +33 -1
- package/dist/utils/variant.d.ts.map +1 -1
- package/dist/utils/variant.js.map +1 -1
- package/package.json +4 -4
- package/src/adw/dialog.tsx +22 -25
- package/src/adw/element-behaviors.ts +129 -57
- package/src/adw/element-config.ts +15 -17
- package/src/adw/prop-types.ts +35 -2
- package/src/components/application-window.tsx +10 -0
- package/src/components/application.tsx +31 -5
- package/src/components/element.tsx +52 -16
- package/src/components/portaled.tsx +14 -0
- package/src/components/window.tsx +24 -23
- package/src/config.ts +10 -1
- package/src/element-behaviors.ts +20 -0
- package/src/element-config.ts +7 -4
- package/src/hooks/use-merged-refs.ts +1 -1
- package/src/hooks/use-presented-instance.tsx +50 -0
- package/src/hooks/use-property.ts +2 -1
- package/src/hooks/use-signal.ts +2 -1
- package/src/internal.ts +5 -3
- package/src/prop-types.ts +34 -7
- package/src/reconciler/apply-props.ts +77 -24
- package/src/reconciler/behaviors.ts +72 -30
- package/src/reconciler/devtools.ts +18 -0
- package/src/reconciler/host-config.ts +19 -31
- package/src/reconciler/instance.ts +6 -3
- package/src/reconciler/metadata.ts +3 -6
- package/src/reconciler/node.ts +10 -7
- package/src/reconciler/placement.ts +25 -25
- package/src/reconciler/registry.ts +9 -7
- package/src/reconciler/root-element.ts +4 -1
- package/src/reconciler/root.ts +6 -0
- package/src/reconciler/signals.ts +0 -1
- package/src/utils/accessible-props.ts +21 -24
- package/src/utils/settings.ts +2 -1
- package/src/utils/variant.ts +33 -1
- package/dist/utils/accessible-metadata.d.ts +0 -5
- package/dist/utils/accessible-metadata.d.ts.map +0 -1
- package/dist/utils/accessible-metadata.js +0 -18
- package/dist/utils/accessible-metadata.js.map +0 -1
- package/src/utils/accessible-metadata.ts +0 -24
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ React Native and similar frameworks hide the native toolkit so one API can run e
|
|
|
108
108
|
|
|
109
109
|
### Why Node.js, and why generated bindings
|
|
110
110
|
|
|
111
|
-
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers
|
|
111
|
+
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
|
|
112
112
|
|
|
113
113
|
GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
|
|
114
114
|
|
|
@@ -121,10 +121,10 @@ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requiremen
|
|
|
121
121
|
Scaffold a new app with the `create-gtkx` initializer:
|
|
122
122
|
|
|
123
123
|
```sh
|
|
124
|
-
npm create gtkx
|
|
124
|
+
npm create gtkx
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
The same command works with other package managers: `pnpm create gtkx
|
|
127
|
+
The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
|
|
128
128
|
|
|
129
129
|
Then run your new app:
|
|
130
130
|
|
|
@@ -145,7 +145,7 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
|
|
|
145
145
|
|
|
146
146
|
GTKX is Linux-only. You need:
|
|
147
147
|
|
|
148
|
-
- Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later)
|
|
148
|
+
- Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
|
|
149
149
|
- Node.js 24 or later
|
|
150
150
|
|
|
151
151
|
The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
|
|
@@ -161,7 +161,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
|
161
161
|
|
|
162
162
|
## Status
|
|
163
163
|
|
|
164
|
-
GTKX 1.0 is
|
|
164
|
+
GTKX 1.0 is released.
|
|
165
165
|
|
|
166
166
|
## Contributing
|
|
167
167
|
|
package/dist/adw/dialog.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type * as Adw from "@gtkx/gi/adw";
|
|
2
|
-
import { type ElementType, type ReactNode
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
};
|
|
2
|
+
import { type ElementType, type ReactNode } from "react";
|
|
3
|
+
import { type PresentedProps } from "../hooks/use-presented-instance.js";
|
|
4
|
+
type DialogComponentProps = PresentedProps<Adw.Dialog>;
|
|
6
5
|
declare const createDialogComponent: (Component: ElementType) => ((props: DialogComponentProps) => ReactNode);
|
|
7
6
|
/** @internal */
|
|
8
7
|
export { createDialogComponent };
|
package/dist/adw/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAe,MAAM,OAAO,CAAC;AAGtE,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEnG,KAAK,oBAAoB,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAiBvD,QAAA,MAAM,qBAAqB,GAAI,WAAW,WAAW,KAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAM9F,CAAC;AAEN,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/adw/dialog.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useMergedRef } from "../hooks/use-merged-refs.js";
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { createPortaledComponent } from "../components/portaled.js";
|
|
4
3
|
import { useParentWindow } from "../hooks/use-parent-window.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return ({ ref, ...rest }) => {
|
|
9
|
-
const parent = useParentWindow();
|
|
10
|
-
const [dialog, setDialog] = useState(null);
|
|
11
|
-
useLayoutEffect(() => {
|
|
12
|
-
if (!dialog) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
dialog.present(parent);
|
|
16
|
-
return () => {
|
|
17
|
-
dialog.forceClose();
|
|
18
|
-
};
|
|
19
|
-
}, [dialog, parent]);
|
|
20
|
-
const mergedRef = useMergedRef(ref, setDialog);
|
|
21
|
-
return createPortal(_jsx(Component, { ref: mergedRef, ...rest }), rootElement);
|
|
22
|
-
};
|
|
4
|
+
import { createPresentedComponent } from "../hooks/use-presented-instance.js";
|
|
5
|
+
const closeDialog = (dialog) => {
|
|
6
|
+
dialog.forceClose();
|
|
23
7
|
};
|
|
8
|
+
const usePresentDialog = () => {
|
|
9
|
+
const parent = useParentWindow();
|
|
10
|
+
return useCallback((dialog) => {
|
|
11
|
+
dialog.present(parent);
|
|
12
|
+
}, [parent]);
|
|
13
|
+
};
|
|
14
|
+
const createDialogComponent = (Component) => createPortaledComponent(createPresentedComponent(Component, {
|
|
15
|
+
usePresent: usePresentDialog,
|
|
16
|
+
dismiss: closeDialog,
|
|
17
|
+
}));
|
|
24
18
|
/** @internal */
|
|
25
19
|
export { createDialogComponent };
|
|
26
20
|
//# sourceMappingURL=dialog.js.map
|
package/dist/adw/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"
|
|
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;AAInG,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAQ,EAAE;IAC7C,MAAM,CAAC,UAAU,EAAE,CAAC;AACxB,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\";\n\ntype DialogComponentProps = PresentedProps<Adw.Dialog>;\n\nconst closeDialog = (dialog: Adw.Dialog): void => {\n dialog.forceClose();\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,7 +1,8 @@
|
|
|
1
1
|
import * as Adw from "@gtkx/gi/adw";
|
|
2
|
-
import { addRemoveSlot, adoptedChildrenSlot, boxSlot, childSetterSlot, contentSetterSlot, deferred, list, slot, } from "../reconciler/behaviors.js";
|
|
2
|
+
import { addRemoveSlot, adoptedChildrenSlot, applicationCreator, boxSlot, childMatcher, childSetterSlot, contentSetterSlot, deferred, indexedSlot, list, 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
|
+
const SLOT_SUFFIX = "Slot";
|
|
5
6
|
const childSetter = childSetterSlot();
|
|
6
7
|
const contentSetter = contentSetterSlot();
|
|
7
8
|
const breakpoints = slot("breakpoints", "AdwBreakpoint", {
|
|
@@ -10,29 +11,95 @@ const breakpoints = slot("breakpoints", "AdwBreakpoint", {
|
|
|
10
11
|
},
|
|
11
12
|
});
|
|
12
13
|
const prefixSuffix = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
detach: (row, child) => {
|
|
18
|
-
row.remove(child);
|
|
19
|
-
},
|
|
14
|
+
addRemoveSlot("prefix", "GtkWidget", (row, child) => {
|
|
15
|
+
row.addPrefix(child);
|
|
16
|
+
}, (row, child) => {
|
|
17
|
+
row.remove(child);
|
|
20
18
|
}),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
detach: (row, child) => {
|
|
26
|
-
row.remove(child);
|
|
27
|
-
},
|
|
19
|
+
addRemoveSlot("suffix", "GtkWidget", (row, child) => {
|
|
20
|
+
row.addSuffix(child);
|
|
21
|
+
}, (row, child) => {
|
|
22
|
+
row.remove(child);
|
|
28
23
|
}),
|
|
29
24
|
];
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}, (
|
|
33
|
-
|
|
25
|
+
const preferencesDialogChildren = addRemoveSlot("children", "AdwPreferencesPage", (dialog, page) => {
|
|
26
|
+
dialog.add(page);
|
|
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
|
+
});
|
|
38
|
+
const sidebarSections = indexedSlot("children", "AdwSidebarSection");
|
|
39
|
+
const sidebarItems = indexedSlot("children", "AdwSidebarItem");
|
|
40
|
+
const isWidget = childMatcher("GtkWidget");
|
|
41
|
+
const multiLayoutSlots = {
|
|
42
|
+
attach: (view, child, info) => {
|
|
43
|
+
const id = getSlotId(info.slot);
|
|
44
|
+
if (id === null || !isWidget(child)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
view.setChild(id, child);
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
detach: (view, child, info) => {
|
|
51
|
+
const id = getSlotId(info.slot);
|
|
52
|
+
if (id === null || !isWidget(child)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const widget = child;
|
|
56
|
+
if (view.getChild(id) === widget) {
|
|
57
|
+
widget.unparent();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const multiLayoutLayouts = slot("layouts", "GtkWidget", {
|
|
62
|
+
attach: (view, content) => {
|
|
63
|
+
const layout = new Adw.Layout({ content });
|
|
64
|
+
view.addLayout(layout);
|
|
65
|
+
return layout;
|
|
66
|
+
},
|
|
67
|
+
reorder: (_view, _content, info) => info.adopted,
|
|
68
|
+
detach: (view, _content, info) => {
|
|
69
|
+
if (info.adopted instanceof Adw.Layout) {
|
|
70
|
+
view.removeLayout(info.adopted);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
34
73
|
});
|
|
35
74
|
const BUILTIN_BEHAVIORS = {
|
|
75
|
+
AdwApplication: {
|
|
76
|
+
behaviors: [applicationCreator(Adw.Application)],
|
|
77
|
+
},
|
|
78
|
+
AdwSidebar: {
|
|
79
|
+
behaviors: [sidebarSections],
|
|
80
|
+
},
|
|
81
|
+
AdwSidebarSection: {
|
|
82
|
+
behaviors: [sidebarItems],
|
|
83
|
+
},
|
|
84
|
+
AdwMultiLayoutView: {
|
|
85
|
+
behaviors: [
|
|
86
|
+
multiLayoutLayouts,
|
|
87
|
+
multiLayoutSlots,
|
|
88
|
+
deferred("layoutName", (view, name) => view.getLayoutByName(name) !== null),
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
AdwClampScrollable: {
|
|
92
|
+
behaviors: [
|
|
93
|
+
slot("children", "GtkScrollable", {
|
|
94
|
+
attach: (clamp, child) => {
|
|
95
|
+
clamp.setChild(child);
|
|
96
|
+
},
|
|
97
|
+
detach: (clamp) => {
|
|
98
|
+
clamp.setChild(null);
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
],
|
|
102
|
+
},
|
|
36
103
|
...forTypes(CHILD_SETTER_TYPES, {
|
|
37
104
|
behaviors: [childSetter],
|
|
38
105
|
}),
|
|
@@ -72,19 +139,11 @@ const BUILTIN_BEHAVIORS = {
|
|
|
72
139
|
}, (row, child) => {
|
|
73
140
|
row.remove(child);
|
|
74
141
|
}),
|
|
75
|
-
addRemoveSlot("actions", "GtkWidget", (row, child) => {
|
|
76
|
-
row.addAction(child);
|
|
77
|
-
}, (row, child) => {
|
|
78
|
-
row.remove(child);
|
|
79
|
-
}),
|
|
80
142
|
],
|
|
81
143
|
},
|
|
82
144
|
AdwNavigationSplitView: {
|
|
83
145
|
behaviors: [contentSetterSlot("AdwNavigationPage")],
|
|
84
146
|
},
|
|
85
|
-
AdwLeaflet: {
|
|
86
|
-
behaviors: [boxSlot()],
|
|
87
|
-
},
|
|
88
147
|
AdwWrapBox: {
|
|
89
148
|
behaviors: [boxSlot()],
|
|
90
149
|
},
|
|
@@ -116,10 +175,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
116
175
|
],
|
|
117
176
|
},
|
|
118
177
|
AdwPreferencesDialog: {
|
|
119
|
-
behaviors: [
|
|
120
|
-
},
|
|
121
|
-
AdwPreferencesWindow: {
|
|
122
|
-
behaviors: [pageHostChildren],
|
|
178
|
+
behaviors: [preferencesDialogChildren],
|
|
123
179
|
},
|
|
124
180
|
AdwPreferencesGroup: {
|
|
125
181
|
behaviors: [
|
|
@@ -130,15 +186,6 @@ const BUILTIN_BEHAVIORS = {
|
|
|
130
186
|
}),
|
|
131
187
|
],
|
|
132
188
|
},
|
|
133
|
-
AdwSqueezer: {
|
|
134
|
-
behaviors: [
|
|
135
|
-
addRemoveSlot("children", "GtkWidget", (squeezer, child) => {
|
|
136
|
-
squeezer.add(child);
|
|
137
|
-
}, (squeezer, child) => {
|
|
138
|
-
squeezer.remove(child);
|
|
139
|
-
}),
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
189
|
AdwTabView: {
|
|
143
190
|
behaviors: [
|
|
144
191
|
slot("children", "GtkWidget", {
|
|
@@ -177,21 +224,15 @@ const BUILTIN_BEHAVIORS = {
|
|
|
177
224
|
AdwToolbarView: {
|
|
178
225
|
behaviors: [
|
|
179
226
|
contentSetterSlot(),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
detach: (view, child) => {
|
|
185
|
-
view.remove(child);
|
|
186
|
-
},
|
|
227
|
+
addRemoveSlot("topBar", "GtkWidget", (view, child) => {
|
|
228
|
+
view.addTopBar(child);
|
|
229
|
+
}, (view, child) => {
|
|
230
|
+
view.remove(child);
|
|
187
231
|
}),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
detach: (view, child) => {
|
|
193
|
-
view.remove(child);
|
|
194
|
-
},
|
|
232
|
+
addRemoveSlot("bottomBar", "GtkWidget", (view, child) => {
|
|
233
|
+
view.addBottomBar(child);
|
|
234
|
+
}, (view, child) => {
|
|
235
|
+
view.remove(child);
|
|
195
236
|
}),
|
|
196
237
|
],
|
|
197
238
|
},
|
|
@@ -246,6 +287,7 @@ const BUILTIN_BEHAVIORS = {
|
|
|
246
287
|
},
|
|
247
288
|
AdwAlertDialog: {
|
|
248
289
|
behaviors: [
|
|
290
|
+
alertDialogExtraChild,
|
|
249
291
|
list("responses", {
|
|
250
292
|
add: (dialog, response) => {
|
|
251
293
|
dialog.addResponse(response.id, response.label);
|
|
@@ -263,6 +305,12 @@ const BUILTIN_BEHAVIORS = {
|
|
|
263
305
|
],
|
|
264
306
|
},
|
|
265
307
|
};
|
|
308
|
+
function getSlotId(name) {
|
|
309
|
+
if (name.length <= SLOT_SUFFIX.length || !name.endsWith(SLOT_SUFFIX)) {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
return name.slice(0, -SLOT_SUFFIX.length);
|
|
313
|
+
}
|
|
266
314
|
registerElements(BUILTIN_ELEMENTS);
|
|
267
315
|
registerElements(BUILTIN_BEHAVIORS);
|
|
268
316
|
//# sourceMappingURL=element-behaviors.js.map
|
|
@@ -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;AAEpC,OAAO,EACH,aAAa,EACb,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,IAAI,GACP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAoBjG,MAAM,WAAW,GAAG,eAAe,EAAkB,CAAC;AACtD,MAAM,aAAa,GAAG,iBAAiB,EAAoB,CAAC;AAE5D,MAAM,WAAW,GAAG,IAAI,CAAiC,aAAa,EAAE,eAAe,EAAE;IACrF,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,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@gtkx/gi/gtk\";\nimport * as Adw from \"@gtkx/gi/adw\";\nimport type { AlertDialogResponse } from \"./prop-types.js\";\nimport {\n addRemoveSlot,\n adoptedChildrenSlot,\n boxSlot,\n childSetterSlot,\n contentSetterSlot,\n deferred,\n list,\n slot,\n} from \"../reconciler/behaviors.js\";\nimport { 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.ClampScrollable |\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.Flap | Adw.OverlaySplitView | Adw.Window;\ntype BreakpointHost = Adw.ApplicationWindow | Adw.Window | Adw.Dialog;\ntype PageHost = Adw.PreferencesDialog | Adw.PreferencesWindow;\ntype PrefixSuffixRow = Adw.ActionRow | Adw.EntryRow | Adw.ExpanderRow;\n\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 slot<PrefixSuffixRow, Gtk.Widget>(\"prefix\", \"GtkWidget\", {\n attach: (row, child) => {\n row.addPrefix(child);\n },\n detach: (row, child) => {\n row.remove(child);\n },\n }),\n slot<PrefixSuffixRow, Gtk.Widget>(\"suffix\", \"GtkWidget\", {\n attach: (row, child) => {\n row.addSuffix(child);\n },\n detach: (row, child) => {\n row.remove(child);\n },\n }),\n];\n\nconst pageHostChildren = addRemoveSlot<Adw.PreferencesPage, PageHost>(\n \"children\",\n \"AdwPreferencesPage\",\n (host, page) => {\n host.add(page);\n },\n (host, page) => {\n host.remove(page);\n },\n);\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\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 addRemoveSlot<Gtk.Widget, Adw.ExpanderRow>(\n \"actions\",\n \"GtkWidget\",\n (row, child) => {\n row.addAction(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 AdwLeaflet: {\n behaviors: [boxSlot<Adw.Leaflet | Adw.WrapBox>()],\n },\n AdwWrapBox: {\n behaviors: [boxSlot<Adw.Leaflet | 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: [pageHostChildren],\n },\n AdwPreferencesWindow: {\n behaviors: [pageHostChildren],\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 AdwSqueezer: {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Adw.Squeezer>(\n \"children\",\n \"GtkWidget\",\n (squeezer, child) => {\n squeezer.add(child);\n },\n (squeezer, child) => {\n squeezer.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 slot<Adw.ToolbarView, Gtk.Widget>(\"topBar\", \"GtkWidget\", {\n attach: (view, child) => {\n view.addTopBar(child);\n },\n detach: (view, child) => {\n view.remove(child);\n },\n }),\n slot<Adw.ToolbarView, Gtk.Widget>(\"bottomBar\", \"GtkWidget\", {\n attach: (view, child) => {\n view.addBottomBar(child);\n },\n detach: (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 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\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,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,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;AAE5D,MAAM,WAAW,GAAG,IAAI,CAAiC,aAAa,EAAE,eAAe,EAAE;IACrF,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE;QACzB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG;IACjB,aAAa,CACT,QAAQ,EACR,WAAW,EACX,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACX,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,EACD,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACX,GAAG,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AC;gBACL,CAAC;gBACD,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;oBACzB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACvC,CAAC;aACJ,CAAC;SACL;KACJ;CACJ,CAAC;AAEF,SAAS,SAAS,CAAC,IAAY;IAC3B,IAAI,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,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,12 +1,6 @@
|
|
|
1
1
|
import { type ElementConfig } from "../reconciler/registry.js";
|
|
2
2
|
declare const CHILD_SETTER_TYPES: string[];
|
|
3
3
|
declare const CONTENT_SETTER_TYPES: string[];
|
|
4
|
-
/**
|
|
5
|
-
* The framework's own element configuration for the Adwaita types it customizes: the base props interface each
|
|
6
|
-
* generated element extends, the component that wraps it, the GObject properties left out of its generated
|
|
7
|
-
* props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
|
|
8
|
-
* reaches the GObject bindings.
|
|
9
|
-
*/
|
|
10
4
|
declare const BUILTIN_ELEMENTS: Record<string, ElementConfig>;
|
|
11
5
|
export { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
|
|
12
6
|
//# sourceMappingURL=element-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAyC,MAAM,2BAA2B,CAAC;AAEtG,QAAA,MAAM,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAyC,MAAM,2BAA2B,CAAC;AAEtG,QAAA,MAAM,kBAAkB,EAAE,MAAM,EAS/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,MAAM,EAA8C,CAAC;AAKjF,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAyGnD,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { forTypes, internal } from "../reconciler/registry.js";
|
|
|
2
2
|
const CHILD_SETTER_TYPES = [
|
|
3
3
|
"AdwBin",
|
|
4
4
|
"AdwClamp",
|
|
5
|
-
"AdwClampScrollable",
|
|
6
5
|
"AdwNavigationPage",
|
|
7
6
|
"AdwSplitButton",
|
|
8
7
|
"AdwStatusPage",
|
|
@@ -10,16 +9,10 @@ const CHILD_SETTER_TYPES = [
|
|
|
10
9
|
"AdwToastOverlay",
|
|
11
10
|
"AdwToggle",
|
|
12
11
|
];
|
|
13
|
-
const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "
|
|
12
|
+
const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "AdwOverlaySplitView"];
|
|
14
13
|
const childrenProps = internal("ChildrenProps");
|
|
15
14
|
const breakpointsProps = adw("AdwBreakpointsProps");
|
|
16
15
|
const preferencesRowProps = adw("AdwPreferencesRowProps");
|
|
17
|
-
/**
|
|
18
|
-
* The framework's own element configuration for the Adwaita types it customizes: the base props interface each
|
|
19
|
-
* generated element extends, the component that wraps it, the GObject properties left out of its generated
|
|
20
|
-
* props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
|
|
21
|
-
* reaches the GObject bindings.
|
|
22
|
-
*/
|
|
23
16
|
const BUILTIN_ELEMENTS = {
|
|
24
17
|
...forTypes(CHILD_SETTER_TYPES, {
|
|
25
18
|
props: childrenProps,
|
|
@@ -29,12 +22,25 @@ const BUILTIN_ELEMENTS = {
|
|
|
29
22
|
props: childrenProps,
|
|
30
23
|
omittedProps: ["content"],
|
|
31
24
|
}),
|
|
25
|
+
AdwClampScrollable: {
|
|
26
|
+
props: childrenProps,
|
|
27
|
+
omittedProps: ["child"],
|
|
28
|
+
},
|
|
32
29
|
AdwViewStackPage: {
|
|
33
30
|
isLazy: true,
|
|
34
31
|
},
|
|
35
32
|
AdwTabPage: {
|
|
36
33
|
isLazy: true,
|
|
37
34
|
},
|
|
35
|
+
AdwLayout: {
|
|
36
|
+
isLazy: true,
|
|
37
|
+
},
|
|
38
|
+
AdwSidebarSection: {
|
|
39
|
+
props: childrenProps,
|
|
40
|
+
},
|
|
41
|
+
AdwMultiLayoutView: {
|
|
42
|
+
props: adw("AdwMultiLayoutViewProps"),
|
|
43
|
+
},
|
|
38
44
|
AdwPreferencesRow: {
|
|
39
45
|
props: preferencesRowProps,
|
|
40
46
|
},
|
|
@@ -68,9 +74,6 @@ const BUILTIN_ELEMENTS = {
|
|
|
68
74
|
props: childrenProps,
|
|
69
75
|
omittedProps: ["content"],
|
|
70
76
|
},
|
|
71
|
-
AdwLeaflet: {
|
|
72
|
-
props: childrenProps,
|
|
73
|
-
},
|
|
74
77
|
AdwWrapBox: {
|
|
75
78
|
props: childrenProps,
|
|
76
79
|
},
|
|
@@ -83,15 +86,9 @@ const BUILTIN_ELEMENTS = {
|
|
|
83
86
|
AdwPreferencesDialog: {
|
|
84
87
|
props: childrenProps,
|
|
85
88
|
},
|
|
86
|
-
AdwPreferencesWindow: {
|
|
87
|
-
props: childrenProps,
|
|
88
|
-
},
|
|
89
89
|
AdwPreferencesGroup: {
|
|
90
90
|
props: childrenProps,
|
|
91
91
|
},
|
|
92
|
-
AdwSqueezer: {
|
|
93
|
-
props: childrenProps,
|
|
94
|
-
},
|
|
95
92
|
AdwTabView: {
|
|
96
93
|
props: childrenProps,
|
|
97
94
|
},
|
|
@@ -119,6 +116,7 @@ const BUILTIN_ELEMENTS = {
|
|
|
119
116
|
},
|
|
120
117
|
AdwAlertDialog: {
|
|
121
118
|
props: adw("AdwAlertDialogProps"),
|
|
119
|
+
omittedProps: ["extraChild"],
|
|
122
120
|
},
|
|
123
121
|
};
|
|
124
122
|
function adw(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAqB,MAAM,2BAA2B,CAAC;AAEtG,MAAM,kBAAkB,GAAa;IACjC,QAAQ;IACR,UAAU;IACV,
|
|
1
|
+
{"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAqB,MAAM,2BAA2B,CAAC;AAEtG,MAAM,kBAAkB,GAAa;IACjC,QAAQ;IACR,UAAU;IACV,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,WAAW;CACd,CAAC;AAEF,MAAM,oBAAoB,GAAa,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;AACjF,MAAM,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAChD,MAAM,gBAAgB,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACpD,MAAM,mBAAmB,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAE1D,MAAM,gBAAgB,GAAkC;IACpD,GAAG,QAAQ,CAAC,kBAAkB,EAAE;QAC5B,KAAK,EAAE,aAAa;QACpB,YAAY,EAAE,CAAC,OAAO,CAAC;KAC1B,CAAC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AAa;KACvB;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,aAAa;KACvB;IACD,oBAAoB,EAAE;QAClB,KAAK,EAAE,aAAa;KACvB;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,aAAa;KACvB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,aAAa;KACvB;IACD,iBAAiB,EAAE;QACf,KAAK,EAAE,aAAa;KACvB;IACD,YAAY,EAAE;QACV,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;QACjC,YAAY,EAAE,CAAC,SAAS,CAAC;KAC5B;IACD,YAAY,EAAE;QACV,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,aAAa;KACvB;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;QACjC,YAAY,EAAE,CAAC,YAAY,CAAC;KAC/B;CACJ,CAAC;AAEF,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { type ElementConfig, forTypes, internal, type ModuleExport } from \"../reconciler/registry.js\";\n\nconst CHILD_SETTER_TYPES: string[] = [\n \"AdwBin\",\n \"AdwClamp\",\n \"AdwNavigationPage\",\n \"AdwSplitButton\",\n \"AdwStatusPage\",\n \"AdwTabOverview\",\n \"AdwToastOverlay\",\n \"AdwToggle\",\n];\n\nconst CONTENT_SETTER_TYPES: string[] = [\"AdwBottomSheet\", \"AdwOverlaySplitView\"];\nconst childrenProps = internal(\"ChildrenProps\");\nconst breakpointsProps = adw(\"AdwBreakpointsProps\");\nconst preferencesRowProps = adw(\"AdwPreferencesRowProps\");\n\nconst BUILTIN_ELEMENTS: Record<string, ElementConfig> = {\n ...forTypes(CHILD_SETTER_TYPES, {\n props: childrenProps,\n omittedProps: [\"child\"],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n props: childrenProps,\n omittedProps: [\"content\"],\n }),\n AdwClampScrollable: {\n props: childrenProps,\n omittedProps: [\"child\"],\n },\n AdwViewStackPage: {\n isLazy: true,\n },\n AdwTabPage: {\n isLazy: true,\n },\n AdwLayout: {\n isLazy: true,\n },\n AdwSidebarSection: {\n props: childrenProps,\n },\n AdwMultiLayoutView: {\n props: adw(\"AdwMultiLayoutViewProps\"),\n },\n AdwPreferencesRow: {\n props: preferencesRowProps,\n },\n AdwDialog: {\n props: breakpointsProps,\n component: adw(\"createDialogComponent\"),\n omittedProps: [\"child\"],\n },\n AdwApplicationWindow: {\n props: breakpointsProps,\n omittedProps: [\"content\"],\n },\n AdwWindow: {\n props: breakpointsProps,\n omittedProps: [\"content\"],\n },\n AdwBreakpointBin: {\n props: breakpointsProps,\n omittedProps: [\"child\"],\n },\n AdwActionRow: {\n props: preferencesRowProps,\n },\n AdwEntryRow: {\n props: preferencesRowProps,\n },\n AdwExpanderRow: {\n props: adw(\"AdwExpanderRowProps\"),\n },\n AdwNavigationSplitView: {\n props: childrenProps,\n omittedProps: [\"content\"],\n },\n AdwWrapBox: {\n props: childrenProps,\n },\n AdwCarousel: {\n props: childrenProps,\n },\n AdwPreferencesPage: {\n props: childrenProps,\n },\n AdwPreferencesDialog: {\n props: childrenProps,\n },\n AdwPreferencesGroup: {\n props: childrenProps,\n },\n AdwTabView: {\n props: childrenProps,\n },\n AdwNavigationView: {\n props: childrenProps,\n },\n AdwViewStack: {\n props: childrenProps,\n },\n AdwToolbarView: {\n props: adw(\"AdwToolbarViewProps\"),\n omittedProps: [\"content\"],\n },\n AdwHeaderBar: {\n props: internal(\"GtkHeaderBarProps\"),\n },\n AdwShortcutsDialog: {\n props: childrenProps,\n },\n AdwShortcutsSection: {\n props: childrenProps,\n },\n AdwToggleGroup: {\n props: childrenProps,\n },\n AdwAlertDialog: {\n props: adw(\"AdwAlertDialogProps\"),\n omittedProps: [\"extraChild\"],\n },\n};\n\nfunction adw(name: string): ModuleExport {\n return { module: \"@gtkx/react/adw\", export: name };\n}\n\nexport { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };\n"]}
|
package/dist/adw/prop-types.d.ts
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
import type * as Adw from "@gtkx/gi/adw";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { ChildrenProps } from "../prop-types.js";
|
|
4
|
+
/** One button in an `Adw.AlertDialog`'s `responses` prop. */
|
|
4
5
|
type AlertDialogResponse = {
|
|
6
|
+
/** Name the dialog reports on `onResponse` when this button is chosen. */
|
|
5
7
|
id: string;
|
|
8
|
+
/** Text shown on the button. */
|
|
6
9
|
label: string;
|
|
10
|
+
/** Styling the button is given, such as suggested or destructive; defaults to the plain appearance. */
|
|
7
11
|
appearance?: Adw.ResponseAppearance;
|
|
12
|
+
/** Whether the button can be activated; defaults to true. */
|
|
8
13
|
isEnabled?: boolean;
|
|
9
14
|
};
|
|
15
|
+
/** Props of an `Adw.AlertDialog` element. */
|
|
10
16
|
type AdwAlertDialogProps = {
|
|
17
|
+
/** Buttons the dialog offers, added and removed as the list changes. */
|
|
11
18
|
responses?: AlertDialogResponse[] | null | undefined;
|
|
12
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Widget set as the dialog's extra child, shown below the `heading` and `body` and above the
|
|
21
|
+
* response buttons, leaving the dialog's own chrome in place.
|
|
22
|
+
*/
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/** Props of an `Adw.PreferencesRow` element. */
|
|
13
26
|
type AdwPreferencesRowProps = {
|
|
27
|
+
/** Widgets added at the start of the row, before its title. */
|
|
14
28
|
prefix?: ReactNode | null | undefined;
|
|
29
|
+
/** Widgets added at the end of the row. */
|
|
15
30
|
suffix?: ReactNode | null | undefined;
|
|
16
31
|
};
|
|
32
|
+
/** Props of an `Adw.ExpanderRow` element. */
|
|
17
33
|
type AdwExpanderRowProps = {
|
|
34
|
+
/** Widgets added to the area the row reveals when it expands. */
|
|
18
35
|
rows?: ReactNode | null | undefined;
|
|
19
|
-
actions?: ReactNode | null | undefined;
|
|
20
36
|
} & AdwPreferencesRowProps;
|
|
37
|
+
/** Props of an `Adw.ToolbarView` element, whose `children` is the content the bars surround. */
|
|
21
38
|
type AdwToolbarViewProps = {
|
|
39
|
+
/** Widgets stacked above the content. */
|
|
22
40
|
topBar?: ReactNode | null | undefined;
|
|
41
|
+
/** Widgets stacked below the content. */
|
|
23
42
|
bottomBar?: ReactNode | null | undefined;
|
|
24
43
|
} & ChildrenProps;
|
|
44
|
+
/** Props of an element that hosts breakpoints, such as `Adw.Window` or `Adw.BreakpointBin`. */
|
|
25
45
|
type AdwBreakpointsProps = {
|
|
46
|
+
/** `Adw.Breakpoint` elements added to the element, each applying while its condition holds. */
|
|
26
47
|
breakpoints?: ReactNode | null | undefined;
|
|
27
48
|
} & ChildrenProps;
|
|
28
|
-
|
|
49
|
+
/** Props of an `Adw.MultiLayoutView` element. */
|
|
50
|
+
type AdwMultiLayoutViewProps = {
|
|
51
|
+
/** `Adw.Layout` elements added to the view, each holding the content it lays out. */
|
|
52
|
+
layouts?: ReactNode | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Widget the view places in the `Adw.LayoutSlot` whose `id` is the prop name without its `Slot`
|
|
55
|
+
* suffix, so `sidebarSlot` fills the slot with id `sidebar` in whichever layout is current.
|
|
56
|
+
*/
|
|
57
|
+
[slot: `${string}Slot`]: ReactNode | null | undefined;
|
|
58
|
+
};
|
|
59
|
+
export { type AlertDialogResponse, type AdwAlertDialogProps, type AdwPreferencesRowProps, type AdwExpanderRowProps, type AdwToolbarViewProps, type AdwBreakpointsProps, type AdwMultiLayoutViewProps, };
|
|
29
60
|
//# sourceMappingURL=prop-types.d.ts.map
|