@gtkx/react 0.20.0 → 0.21.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 +26 -62
- package/dist/components/compound.d.ts +40 -0
- package/dist/components/compound.d.ts.map +1 -0
- package/dist/components/compound.js +46 -0
- package/dist/components/compound.js.map +1 -0
- package/dist/components/list.d.ts +42 -2
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +42 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/slot-widget.d.ts +15 -0
- package/dist/components/slot-widget.d.ts.map +1 -0
- package/dist/components/slot-widget.js +37 -0
- package/dist/components/slot-widget.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -6
- package/dist/errors.js.map +1 -1
- package/dist/generated/compounds.d.ts +2672 -0
- package/dist/generated/compounds.d.ts.map +1 -0
- package/dist/generated/compounds.js +2624 -0
- package/dist/generated/compounds.js.map +1 -0
- package/dist/generated/internal.d.ts +2 -2
- package/dist/generated/internal.d.ts.map +1 -1
- package/dist/generated/internal.js +2751 -4748
- package/dist/generated/internal.js.map +1 -1
- package/dist/generated/jsx.d.ts +2042 -4592
- package/dist/generated/jsx.d.ts.map +1 -1
- package/dist/generated/jsx.js +919 -3478
- package/dist/generated/jsx.js.map +1 -1
- package/dist/generated/registry.d.ts +1 -0
- package/dist/generated/registry.d.ts.map +1 -1
- package/dist/generated/registry.js +0 -1
- package/dist/generated/registry.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +116 -414
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +5 -328
- package/dist/jsx.js.map +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js.map +1 -1
- package/dist/nodes/alert-dialog.d.ts +14 -0
- package/dist/nodes/alert-dialog.d.ts.map +1 -0
- package/dist/nodes/alert-dialog.js +41 -0
- package/dist/nodes/alert-dialog.js.map +1 -0
- package/dist/nodes/animation.d.ts +5 -4
- package/dist/nodes/animation.d.ts.map +1 -1
- package/dist/nodes/animation.js +65 -49
- package/dist/nodes/animation.js.map +1 -1
- package/dist/nodes/column-view-column.js +2 -2
- package/dist/nodes/column-view-column.js.map +1 -1
- package/dist/nodes/container-slot.d.ts +3 -1
- package/dist/nodes/container-slot.d.ts.map +1 -1
- package/dist/nodes/container-slot.js +28 -16
- package/dist/nodes/container-slot.js.map +1 -1
- package/dist/nodes/drawing-area.d.ts +3 -1
- package/dist/nodes/drawing-area.d.ts.map +1 -1
- package/dist/nodes/drawing-area.js +20 -22
- package/dist/nodes/drawing-area.js.map +1 -1
- package/dist/nodes/event-controller.d.ts.map +1 -1
- package/dist/nodes/event-controller.js +3 -7
- package/dist/nodes/event-controller.js.map +1 -1
- package/dist/nodes/fixed-child.d.ts +1 -0
- package/dist/nodes/fixed-child.d.ts.map +1 -1
- package/dist/nodes/fixed-child.js +13 -0
- package/dist/nodes/fixed-child.js.map +1 -1
- package/dist/nodes/grid-child.d.ts +1 -0
- package/dist/nodes/grid-child.d.ts.map +1 -1
- package/dist/nodes/grid-child.js +13 -0
- package/dist/nodes/grid-child.js.map +1 -1
- package/dist/nodes/internal/construct.js +2 -2
- package/dist/nodes/internal/construct.js.map +1 -1
- package/dist/nodes/internal/widget.d.ts.map +1 -1
- package/dist/nodes/internal/widget.js +5 -9
- package/dist/nodes/internal/widget.js.map +1 -1
- package/dist/nodes/list-item-node.d.ts +6 -6
- package/dist/nodes/list-item-node.d.ts.map +1 -1
- package/dist/nodes/list-item-node.js +27 -5
- package/dist/nodes/list-item-node.js.map +1 -1
- package/dist/nodes/notebook-page.js +2 -2
- package/dist/nodes/notebook-page.js.map +1 -1
- package/dist/nodes/overlay-child.d.ts +2 -0
- package/dist/nodes/overlay-child.d.ts.map +1 -1
- package/dist/nodes/overlay-child.js +29 -8
- package/dist/nodes/overlay-child.js.map +1 -1
- package/dist/nodes/spin-row.d.ts +14 -0
- package/dist/nodes/spin-row.d.ts.map +1 -0
- package/dist/nodes/spin-row.js +46 -0
- package/dist/nodes/spin-row.js.map +1 -0
- package/dist/nodes/switch-row.d.ts +11 -0
- package/dist/nodes/switch-row.d.ts.map +1 -0
- package/dist/nodes/switch-row.js +15 -0
- package/dist/nodes/switch-row.js.map +1 -0
- package/dist/nodes/text-anchor.d.ts.map +1 -1
- package/dist/nodes/text-anchor.js +10 -0
- package/dist/nodes/text-anchor.js.map +1 -1
- package/dist/nodes/text-tag.d.ts.map +1 -1
- package/dist/nodes/text-tag.js +45 -39
- package/dist/nodes/text-tag.js.map +1 -1
- package/dist/nodes/toggle-group.d.ts +12 -6
- package/dist/nodes/toggle-group.d.ts.map +1 -1
- package/dist/nodes/toggle-group.js +53 -4
- package/dist/nodes/toggle-group.js.map +1 -1
- package/dist/nodes/widget.d.ts.map +1 -1
- package/dist/nodes/widget.js +7 -14
- package/dist/nodes/widget.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -5
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/use-property.d.ts +29 -0
- package/dist/use-property.d.ts.map +1 -0
- package/dist/use-property.js +44 -0
- package/dist/use-property.js.map +1 -0
- package/dist/use-setting.d.ts +36 -0
- package/dist/use-setting.d.ts.map +1 -0
- package/dist/use-setting.js +68 -0
- package/dist/use-setting.js.map +1 -0
- package/package.json +3 -3
- package/src/components/compound.tsx +57 -0
- package/src/components/list.tsx +59 -2
- package/src/components/slot-widget.tsx +46 -0
- package/src/errors.ts +8 -7
- package/src/generated/compounds.ts +2741 -0
- package/src/generated/internal.ts +2752 -4754
- package/src/generated/jsx.ts +2495 -5012
- package/src/generated/registry.ts +2 -1
- package/src/index.ts +2 -0
- package/src/jsx.ts +121 -443
- package/src/metadata.ts +1 -1
- package/src/nodes/alert-dialog.ts +55 -0
- package/src/nodes/animation.ts +67 -60
- package/src/nodes/column-view-column.ts +2 -2
- package/src/nodes/container-slot.ts +30 -17
- package/src/nodes/drawing-area.ts +23 -32
- package/src/nodes/event-controller.ts +3 -7
- package/src/nodes/fixed-child.ts +13 -0
- package/src/nodes/grid-child.ts +13 -0
- package/src/nodes/internal/construct.ts +2 -2
- package/src/nodes/internal/widget.ts +6 -12
- package/src/nodes/list-item-node.ts +33 -9
- package/src/nodes/notebook-page.ts +2 -2
- package/src/nodes/overlay-child.ts +30 -9
- package/src/nodes/spin-row.ts +72 -0
- package/src/nodes/switch-row.ts +26 -0
- package/src/nodes/text-anchor.ts +9 -0
- package/src/nodes/text-tag.ts +45 -40
- package/src/nodes/toggle-group.ts +63 -9
- package/src/nodes/widget.ts +6 -13
- package/src/registry.ts +7 -5
- package/src/types.ts +1 -0
- package/src/use-property.ts +58 -0
- package/src/use-setting.ts +96 -0
package/README.md
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
|
|
2
|
+
<img src="https://raw.githubusercontent.com/eugeniodepalo/gtkx/main/logo.svg" alt="GTKX" width="100" height="100">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">GTKX</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
|
|
8
|
+
<strong>Linux application development for the modern age powered by GTK4 and React</strong>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
<a href="https://www.npmjs.com/package/@gtkx/react"><img src="https://img.shields.io/npm/v/@gtkx/react.svg" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/gtkx-org/gtkx/actions"><img src="https://img.shields.io/github/actions/workflow/status/eugeniodepalo/gtkx/ci.yml" alt="CI"></a>
|
|
14
|
+
<a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License"></a>
|
|
15
|
+
<a href="https://github.com/gtkx-org/gtkx/discussions"><img src="https://img.shields.io/badge/discussions-GitHub-blue" alt="GitHub Discussions"></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="https://raw.githubusercontent.com/eugeniodepalo/gtkx/main/demo.gif" alt="GTKX Demo" width="100%">
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
GTKX is a modern framework for building native Linux applications using React and GTK. It provides the full range of GTK4, GLib, and Node.js APIs, allowing you to create rich, performant desktop applications with the tools and libraries you already know.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **React 19** — Hooks, concurrent features, and the component model you know
|
|
31
|
+
- **Fully native Node.js environment** - Runs on vanilla Node.js, with the help of a Neon native module
|
|
32
|
+
- **TypeScript first** — Full type safety with auto-generated bindings
|
|
33
|
+
- **Rich GLib support** — Provides bindings for most modern GLib/GObject libraries, including Adwaita
|
|
34
|
+
- **HMR** — Fast refresh during development powered by Vite
|
|
35
|
+
- **CSS-in-JS styling** — Easy styling with GTK CSS powered by Emotion
|
|
36
|
+
- **Testing library** — Testing Library-inspired API for testing components and E2E
|
|
21
37
|
|
|
22
38
|
## Quick Start
|
|
23
39
|
|
|
@@ -27,66 +43,14 @@ cd my-app
|
|
|
27
43
|
npm run dev
|
|
28
44
|
```
|
|
29
45
|
|
|
30
|
-
## Example
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import {
|
|
34
|
-
GtkApplicationWindow,
|
|
35
|
-
GtkBox,
|
|
36
|
-
GtkButton,
|
|
37
|
-
GtkLabel,
|
|
38
|
-
quit,
|
|
39
|
-
render,
|
|
40
|
-
} from "@gtkx/react";
|
|
41
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
42
|
-
import { useState } from "react";
|
|
43
|
-
|
|
44
|
-
const App = () => {
|
|
45
|
-
const [count, setCount] = useState(0);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<GtkApplicationWindow
|
|
49
|
-
title="Counter"
|
|
50
|
-
defaultWidth={300}
|
|
51
|
-
defaultHeight={200}
|
|
52
|
-
onClose={quit}
|
|
53
|
-
>
|
|
54
|
-
<GtkBox
|
|
55
|
-
orientation={Gtk.Orientation.VERTICAL}
|
|
56
|
-
spacing={20}
|
|
57
|
-
valign={Gtk.Align.CENTER}
|
|
58
|
-
>
|
|
59
|
-
<GtkLabel label={`Count: ${count}`} cssClasses={["title-1"]} />
|
|
60
|
-
<GtkButton label="Increment" onClicked={() => setCount((c) => c + 1)} />
|
|
61
|
-
</GtkBox>
|
|
62
|
-
</GtkApplicationWindow>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
render(<App />, "com.example.counter");
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Features
|
|
70
|
-
|
|
71
|
-
- **React 19** — Hooks, concurrent features, and the component model you know
|
|
72
|
-
- **Native GTK4 widgets** — Real native controls, not web components in a webview
|
|
73
|
-
- **Adwaita support** — Modern GNOME styling with Libadwaita components
|
|
74
|
-
- **Declarative animations** — Framer Motion-like API using native Adwaita animations
|
|
75
|
-
- **Hot Module Replacement** — Fast refresh during development
|
|
76
|
-
- **TypeScript first** — Full type safety with auto-generated bindings
|
|
77
|
-
- **CSS-in-JS styling** — Familiar styling patterns adapted for GTK
|
|
78
|
-
- **Testing utilities** — Component testing similar to Testing Library
|
|
79
|
-
|
|
80
46
|
## Examples
|
|
81
47
|
|
|
82
48
|
Explore complete applications in the [`examples/`](./examples) directory:
|
|
83
49
|
|
|
84
|
-
- **[gtk-demo](./examples/gtk-demo)** — Full replica of the official GTK demo app
|
|
85
50
|
- **[hello-world](./examples/hello-world)** — Minimal application showing a counter
|
|
86
|
-
- **[
|
|
87
|
-
- **[
|
|
51
|
+
- **[gtk-demo](./examples/gtk-demo)** — Full replica of the official GTK demo app
|
|
52
|
+
- **[tutorial](./examples/tutorial)** — Notes app from the tutorial with GSettings and Adwaita
|
|
88
53
|
- **[browser](./examples/browser)** — Simple browser using WebKitWebView
|
|
89
|
-
- **[deploying](./examples/deploying)** — Example of packaging and distributing a GTKX app
|
|
90
54
|
|
|
91
55
|
## Documentation
|
|
92
56
|
|
|
@@ -94,7 +58,7 @@ Visit [https://gtkx.dev](https://gtkx.dev) for the full documentation.
|
|
|
94
58
|
|
|
95
59
|
## Contributing
|
|
96
60
|
|
|
97
|
-
Contributions are welcome! Please see the [contributing guidelines](./CONTRIBUTING.md)
|
|
61
|
+
Contributions are welcome! Please see the [contributing guidelines](./CONTRIBUTING.md).
|
|
98
62
|
|
|
99
63
|
## Community
|
|
100
64
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
type ContainerSlotChild = (props: {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}) => ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a compound child component that delegates to a ContainerSlot
|
|
7
|
+
* with a specific method name.
|
|
8
|
+
*
|
|
9
|
+
* @param methodName - The container slot method name (e.g., "packStart", "addPrefix")
|
|
10
|
+
*/
|
|
11
|
+
export declare function createContainerSlotChild(methodName: string): ContainerSlotChild;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a compound child component that delegates to an existing
|
|
14
|
+
* virtual node intrinsic element.
|
|
15
|
+
*
|
|
16
|
+
* @param intrinsicName - The intrinsic element name (e.g., "StackPage", "GridChild")
|
|
17
|
+
*/
|
|
18
|
+
export declare function createVirtualChild<P extends Record<string, unknown>>(intrinsicName: string): (props: P & {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}) => ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a compound child component for NavigationPage that automatically
|
|
23
|
+
* sets the `for` discriminant based on the parent widget type.
|
|
24
|
+
*
|
|
25
|
+
* @param forValue - The `for` discriminant value (e.g., "AdwNavigationView")
|
|
26
|
+
*/
|
|
27
|
+
export declare function createNavigationPageChild<P extends Record<string, unknown>>(forValue: string): (props: P & {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}) => ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a compound child component for menu items that delegates to
|
|
32
|
+
* an existing menu intrinsic element.
|
|
33
|
+
*
|
|
34
|
+
* @param intrinsicName - "MenuItem", "MenuSection", or "MenuSubmenu"
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMenuChild<P extends Record<string, unknown>>(intrinsicName: string): (props: P & {
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}) => ReactNode;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=compound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound.d.ts","sourceRoot":"","sources":["../../src/components/compound.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAI/E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,aAAa,EAAE,MAAM,GACtB,CAAC,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CAIpD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,QAAQ,EAAE,MAAM,GACjB,CAAC,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CAIpD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,aAAa,EAAE,MAAM,GACtB,CAAC,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CAIpD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a compound child component that delegates to a ContainerSlot
|
|
4
|
+
* with a specific method name.
|
|
5
|
+
*
|
|
6
|
+
* @param methodName - The container slot method name (e.g., "packStart", "addPrefix")
|
|
7
|
+
*/
|
|
8
|
+
export function createContainerSlotChild(methodName) {
|
|
9
|
+
return (props) => {
|
|
10
|
+
return createElement("ContainerSlot", { id: methodName }, props.children);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a compound child component that delegates to an existing
|
|
15
|
+
* virtual node intrinsic element.
|
|
16
|
+
*
|
|
17
|
+
* @param intrinsicName - The intrinsic element name (e.g., "StackPage", "GridChild")
|
|
18
|
+
*/
|
|
19
|
+
export function createVirtualChild(intrinsicName) {
|
|
20
|
+
return (props) => {
|
|
21
|
+
return createElement(intrinsicName, props, props.children);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a compound child component for NavigationPage that automatically
|
|
26
|
+
* sets the `for` discriminant based on the parent widget type.
|
|
27
|
+
*
|
|
28
|
+
* @param forValue - The `for` discriminant value (e.g., "AdwNavigationView")
|
|
29
|
+
*/
|
|
30
|
+
export function createNavigationPageChild(forValue) {
|
|
31
|
+
return (props) => {
|
|
32
|
+
return createElement("NavigationPage", { ...props, for: forValue }, props.children);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a compound child component for menu items that delegates to
|
|
37
|
+
* an existing menu intrinsic element.
|
|
38
|
+
*
|
|
39
|
+
* @param intrinsicName - "MenuItem", "MenuSection", or "MenuSubmenu"
|
|
40
|
+
*/
|
|
41
|
+
export function createMenuChild(intrinsicName) {
|
|
42
|
+
return (props) => {
|
|
43
|
+
return createElement(intrinsicName, props, props.children);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=compound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound.js","sourceRoot":"","sources":["../../src/components/compound.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAItD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACvD,OAAO,CAAC,KAA+B,EAAa,EAAE;QAClD,OAAO,aAAa,CAAC,eAAe,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAC9B,aAAqB;IAErB,OAAO,CAAC,KAAmC,EAAa,EAAE;QACtD,OAAO,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACrC,QAAgB;IAEhB,OAAO,CAAC,KAAmC,EAAa,EAAE;QACtD,OAAO,aAAa,CAAC,gBAAgB,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC3B,aAAqB;IAErB,OAAO,CAAC,KAAmC,EAAa,EAAE;QACtD,OAAO,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type * as Adw from "@gtkx/ffi/adw";
|
|
|
2
2
|
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
3
3
|
import { type ReactNode, type Ref } from "react";
|
|
4
4
|
import type { AdwComboRowProps, GtkColumnViewProps, GtkDropDownProps, GtkGridViewProps, GtkListViewProps } from "../generated/jsx.js";
|
|
5
|
-
import type { DropDownProps, GridViewProps, ListItem, ListViewProps } from "../jsx.js";
|
|
5
|
+
import type { ColumnViewColumnProps, DropDownProps, GridViewProps, ListItem, ListViewProps, MenuItemProps, MenuSectionProps, MenuSubmenuProps } from "../jsx.js";
|
|
6
6
|
type GenericListViewProps<T, S> = Omit<GtkListViewProps, keyof ListViewProps> & ListViewProps<T, S>;
|
|
7
7
|
type GenericGridViewProps<T> = Omit<GtkGridViewProps, keyof GridViewProps> & GridViewProps<T>;
|
|
8
8
|
type GenericDropDownProps<T, S> = Omit<GtkDropDownProps, keyof DropDownProps> & DropDownProps<T, S>;
|
|
@@ -11,22 +11,62 @@ type GenericColumnViewProps<T, S> = Omit<GtkColumnViewProps, "items" | "renderHe
|
|
|
11
11
|
items?: ListItem<T, S>[];
|
|
12
12
|
renderHeader?: ((item: S) => ReactNode) | null;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Virtualized scrollable list that renders items from a flat or tree data model.
|
|
16
|
+
*
|
|
17
|
+
* Wraps `GtkListView` with React-managed item rendering via portals,
|
|
18
|
+
* supporting single/multi selection, section headers, and tree expansion.
|
|
19
|
+
*/
|
|
14
20
|
export declare function GtkListView<T = unknown, S = unknown>(props: GenericListViewProps<T, S> & {
|
|
15
21
|
children?: ReactNode;
|
|
16
22
|
ref?: Ref<Gtk.ListView>;
|
|
17
23
|
}): ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Virtualized scrollable grid that renders items in a multi-column layout.
|
|
26
|
+
*
|
|
27
|
+
* Wraps `GtkGridView` with React-managed item rendering via portals,
|
|
28
|
+
* supporting single/multi selection.
|
|
29
|
+
*/
|
|
18
30
|
export declare function GtkGridView<T = unknown>(props: GenericGridViewProps<T> & {
|
|
19
31
|
children?: ReactNode;
|
|
20
32
|
ref?: Ref<Gtk.GridView>;
|
|
21
33
|
}): ReactNode;
|
|
22
|
-
|
|
34
|
+
/** @internal */
|
|
35
|
+
declare function GtkColumnViewBase<T = unknown, S = unknown>(props: GenericColumnViewProps<T, S> & {
|
|
23
36
|
children?: ReactNode;
|
|
24
37
|
ref?: Ref<Gtk.ColumnView>;
|
|
25
38
|
}): ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Multi-column sortable list with React-managed cell rendering.
|
|
41
|
+
*
|
|
42
|
+
* Wraps `GtkColumnView` with portal-based factories. Use the
|
|
43
|
+
* `GtkColumnView.Column` compound component to define columns,
|
|
44
|
+
* and the `MenuItem` / `MenuSection` / `MenuSubmenu` compounds
|
|
45
|
+
* for the column header context menu.
|
|
46
|
+
*/
|
|
47
|
+
export declare const GtkColumnView: typeof GtkColumnViewBase & {
|
|
48
|
+
Column: <T = unknown>(props: ColumnViewColumnProps<T>) => ReactNode;
|
|
49
|
+
MenuItem: (props: MenuItemProps) => ReactNode;
|
|
50
|
+
MenuSection: (props: MenuSectionProps) => ReactNode;
|
|
51
|
+
MenuSubmenu: (props: MenuSubmenuProps) => ReactNode;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Single-selection dropdown widget with React-managed item rendering.
|
|
55
|
+
*
|
|
56
|
+
* Wraps `GtkDropDown` with portal-based factories, supporting custom
|
|
57
|
+
* item templates, separate list-item templates, and section headers.
|
|
58
|
+
*/
|
|
26
59
|
export declare function GtkDropDown<T = unknown, S = unknown>(props: GenericDropDownProps<T, S> & {
|
|
27
60
|
children?: ReactNode;
|
|
28
61
|
ref?: Ref<Gtk.DropDown>;
|
|
29
62
|
}): ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Libadwaita combo row with React-managed item rendering.
|
|
65
|
+
*
|
|
66
|
+
* Wraps `AdwComboRow` with portal-based factories, providing a
|
|
67
|
+
* preferences-style dropdown row with custom item templates and
|
|
68
|
+
* section headers.
|
|
69
|
+
*/
|
|
30
70
|
export declare function AdwComboRow<T = unknown, S = unknown>(props: GenericComboRowProps<T, S> & {
|
|
31
71
|
children?: ReactNode;
|
|
32
72
|
ref?: Ref<Adw.ComboRow>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,GAAG,EAAsB,MAAM,OAAO,CAAC;AAC9F,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,GAAG,EAAsB,MAAM,OAAO,CAAC;AAC9F,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACR,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,WAAW,CAAC;AA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G,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAE,GACtF,SAAS,CAEX"}
|
package/dist/components/list.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createElement, Fragment, useReducer, useRef } from "react";
|
|
2
2
|
import { createPortal } from "../portal.js";
|
|
3
|
+
import { createMenuChild } from "./compound.js";
|
|
3
4
|
function useListHandle() {
|
|
4
5
|
const [, rerender] = useReducer((x) => x + 1, 0);
|
|
5
6
|
const boundItemsRef = useRef([]);
|
|
@@ -22,18 +23,58 @@ function renderListElement(intrinsicName, handle, props) {
|
|
|
22
23
|
__headerBoundItemsRef: headerBoundItemsRef,
|
|
23
24
|
}), ...portals);
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Virtualized scrollable list that renders items from a flat or tree data model.
|
|
28
|
+
*
|
|
29
|
+
* Wraps `GtkListView` with React-managed item rendering via portals,
|
|
30
|
+
* supporting single/multi selection, section headers, and tree expansion.
|
|
31
|
+
*/
|
|
25
32
|
export function GtkListView(props) {
|
|
26
33
|
return renderListElement("GtkListView", useListHandle(), props);
|
|
27
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Virtualized scrollable grid that renders items in a multi-column layout.
|
|
37
|
+
*
|
|
38
|
+
* Wraps `GtkGridView` with React-managed item rendering via portals,
|
|
39
|
+
* supporting single/multi selection.
|
|
40
|
+
*/
|
|
28
41
|
export function GtkGridView(props) {
|
|
29
42
|
return renderListElement("GtkGridView", useListHandle(), props);
|
|
30
43
|
}
|
|
31
|
-
|
|
44
|
+
/** @internal */
|
|
45
|
+
function GtkColumnViewBase(props) {
|
|
32
46
|
return renderListElement("GtkColumnView", useListHandle(), props);
|
|
33
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Multi-column sortable list with React-managed cell rendering.
|
|
50
|
+
*
|
|
51
|
+
* Wraps `GtkColumnView` with portal-based factories. Use the
|
|
52
|
+
* `GtkColumnView.Column` compound component to define columns,
|
|
53
|
+
* and the `MenuItem` / `MenuSection` / `MenuSubmenu` compounds
|
|
54
|
+
* for the column header context menu.
|
|
55
|
+
*/
|
|
56
|
+
export const GtkColumnView = Object.assign(GtkColumnViewBase, {
|
|
57
|
+
Column: (props) => createElement("ColumnViewColumn", props, props.children),
|
|
58
|
+
MenuItem: createMenuChild("MenuItem"),
|
|
59
|
+
MenuSection: createMenuChild("MenuSection"),
|
|
60
|
+
MenuSubmenu: createMenuChild("MenuSubmenu"),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Single-selection dropdown widget with React-managed item rendering.
|
|
64
|
+
*
|
|
65
|
+
* Wraps `GtkDropDown` with portal-based factories, supporting custom
|
|
66
|
+
* item templates, separate list-item templates, and section headers.
|
|
67
|
+
*/
|
|
34
68
|
export function GtkDropDown(props) {
|
|
35
69
|
return renderListElement("GtkDropDown", useListHandle(), props);
|
|
36
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Libadwaita combo row with React-managed item rendering.
|
|
73
|
+
*
|
|
74
|
+
* Wraps `AdwComboRow` with portal-based factories, providing a
|
|
75
|
+
* preferences-style dropdown row with custom item templates and
|
|
76
|
+
* section headers.
|
|
77
|
+
*/
|
|
37
78
|
export function AdwComboRow(props) {
|
|
38
79
|
return renderListElement("AdwComboRow", useListHandle(), props);
|
|
39
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAA4B,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAA4B,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmB9F,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C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AO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACvB,KAAkF;IAElF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,gBAAgB;AAChB,SAAS,iBAAiB,CACtB,KAAyF;IAEzF,OAAO,iBAAiB,CAAC,eAAe,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAKtB,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IACjC,MAAM,EAAE,CAAc,KAA+B,EAAa,EAAE,CAChE,aAAa,CAAC,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5D,QAAQ,EAAE,eAAe,CAAgB,UAAU,CAAC;IACpD,WAAW,EAAE,eAAe,CAAmB,aAAa,CAAC;IAC7D,WAAW,EAAE,eAAe,CAAmB,aAAa,CAAC;CAChE,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACvB,KAAqF;IAErF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACvB,KAAqF;IAErF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function component for a widget that has named property slots.
|
|
4
|
+
*
|
|
5
|
+
* The returned component extracts slot props (ReactNode values), forwards
|
|
6
|
+
* remaining props to the underlying intrinsic element, and appends internal
|
|
7
|
+
* Slot children for each non-null slot prop.
|
|
8
|
+
*
|
|
9
|
+
* @param intrinsicName - The intrinsic element name (e.g., "GtkWindow")
|
|
10
|
+
* @param slotNames - Array of camelCase slot prop names (e.g., ["titlebar", "startChild"])
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSlotWidget<P = any>(intrinsicName: string, slotNames: readonly string[]): (props: P & {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
//# sourceMappingURL=slot-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-widget.d.ts","sourceRoot":"","sources":["../../src/components/slot-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD;;;;;;;;;GASG;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EACpC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC7B,CAAC,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CA2BpD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function component for a widget that has named property slots.
|
|
4
|
+
*
|
|
5
|
+
* The returned component extracts slot props (ReactNode values), forwards
|
|
6
|
+
* remaining props to the underlying intrinsic element, and appends internal
|
|
7
|
+
* Slot children for each non-null slot prop.
|
|
8
|
+
*
|
|
9
|
+
* @param intrinsicName - The intrinsic element name (e.g., "GtkWindow")
|
|
10
|
+
* @param slotNames - Array of camelCase slot prop names (e.g., ["titlebar", "startChild"])
|
|
11
|
+
*/
|
|
12
|
+
// biome-ignore lint/suspicious/noExplicitAny: Props interfaces don't satisfy Record<string, unknown>
|
|
13
|
+
export function createSlotWidget(intrinsicName, slotNames) {
|
|
14
|
+
const slotSet = new Set(slotNames);
|
|
15
|
+
return (props) => {
|
|
16
|
+
const forwardedProps = {};
|
|
17
|
+
const slotChildren = [];
|
|
18
|
+
const propsRecord = props;
|
|
19
|
+
for (const key in propsRecord) {
|
|
20
|
+
if (slotSet.has(key)) {
|
|
21
|
+
const value = propsRecord[key];
|
|
22
|
+
if (value != null) {
|
|
23
|
+
slotChildren.push(createElement("Slot", { key: `__slot_${key}`, id: key }, value));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
forwardedProps[key] = propsRecord[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const { children } = props;
|
|
31
|
+
if (slotChildren.length > 0) {
|
|
32
|
+
return createElement(intrinsicName, forwardedProps, children, ...slotChildren);
|
|
33
|
+
}
|
|
34
|
+
return createElement(intrinsicName, forwardedProps, children);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=slot-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-widget.js","sourceRoot":"","sources":["../../src/components/slot-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAItD;;;;;;;;;GASG;AACH,qGAAqG;AACrG,MAAM,UAAU,gBAAgB,CAC5B,aAAqB,EACrB,SAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAEnC,OAAO,CAAC,KAAmC,EAAa,EAAE;QACtD,MAAM,cAAc,GAA4B,EAAE,CAAC;QACnD,MAAM,YAAY,GAAgB,EAAE,CAAC;QACrC,MAAM,WAAW,GAAG,KAAgC,CAAC;QAErD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAkB,CAAC;gBAChD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;oBAChB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;gBACvF,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,cAAc,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAC3C,CAAC;QACL,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAE3B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC;QACnF,CAAC;QAED,OAAO,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC,CAAC;AACN,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error subclass thrown by the GTKX reconciler and rendering pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Carries optional context about the widget type that failed and the
|
|
5
|
+
* React component stack at the point of failure.
|
|
6
|
+
*/
|
|
1
7
|
export declare class GtkxError extends Error {
|
|
2
8
|
widgetType?: string | undefined;
|
|
3
9
|
componentStack?: string | undefined;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAGrB,UAAU,CAAC,EAAE,MAAM;IACnB,cAAc,CAAC,EAAE,MAAM;gBAF9B,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,cAAc,CAAC,EAAE,MAAM,YAAA;IAUzB,QAAQ,IAAI,MAAM;CAa9B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAGrB,UAAU,CAAC,EAAE,MAAM;IACnB,cAAc,CAAC,EAAE,MAAM;gBAF9B,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,cAAc,CAAC,EAAE,MAAM,YAAA;IAUzB,QAAQ,IAAI,MAAM;CAa9B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAQhF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAO7D"}
|
package/dist/errors.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error subclass thrown by the GTKX reconciler and rendering pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Carries optional context about the widget type that failed and the
|
|
5
|
+
* React component stack at the point of failure.
|
|
6
|
+
*/
|
|
1
7
|
export class GtkxError extends Error {
|
|
2
8
|
widgetType;
|
|
3
9
|
componentStack;
|
|
@@ -25,18 +31,14 @@ export function formatRenderError(error, widgetType) {
|
|
|
25
31
|
if (error instanceof GtkxError) {
|
|
26
32
|
return error;
|
|
27
33
|
}
|
|
28
|
-
if (error instanceof Error) {
|
|
29
|
-
console.error("[formatRenderError] Original error stack:", error.stack);
|
|
30
|
-
}
|
|
31
34
|
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
-
|
|
33
|
-
return new GtkxError(formattedMessage, widgetType);
|
|
35
|
+
return new GtkxError(message, widgetType);
|
|
34
36
|
}
|
|
35
37
|
export function formatBoundaryError(error) {
|
|
36
38
|
if (error instanceof GtkxError) {
|
|
37
39
|
return error;
|
|
38
40
|
}
|
|
39
41
|
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
-
return new GtkxError(
|
|
42
|
+
return new GtkxError(message);
|
|
41
43
|
}
|
|
42
44
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGrB;IACA;IAHX,YACI,OAAe,EACR,UAAmB,EACnB,cAAuB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,mBAAc,GAAd,cAAc,CAAS;QAG9B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QAExB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAEQ,QAAQ;QACb,MAAM,KAAK,GAAG,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,qBAAqB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACJ;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,UAAmB;IACjE,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAA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