@girs/gtksource-300 4.1.0 → 4.3.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 CHANGED
@@ -5,25 +5,25 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gtksource-300)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for GtkSource-300, generated from library version 300.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.1.0.
8
+ GJS TypeScript type definitions for GtkSource-300 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.0.
9
9
 
10
10
  ## Install
11
11
 
12
- To use this type definitions, install them with NPM:
12
+ Install the type definitions with npm:
13
13
  ```bash
14
14
  npm install @girs/gtksource-300
15
15
  ```
16
16
 
17
17
  ## Usage
18
18
 
19
- You can import this package into your project like this:
19
+ Import it like any other module:
20
20
  ```ts
21
21
  import GtkSource from '@girs/gtksource-300';
22
22
  ```
23
23
 
24
24
  ### Ambient Modules
25
25
 
26
- You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
26
+ [Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
27
27
  For this you need to include `@girs/gtksource-300` or `@girs/gtksource-300/ambient` in your `tsconfig` or entry point Typescript file:
28
28
 
29
29
  `index.ts`:
@@ -42,7 +42,7 @@ import '@girs/gtksource-300'
42
42
  }
43
43
  ```
44
44
 
45
- Now you can import the ambient module with TypeScript support:
45
+ The ambient module now resolves with types:
46
46
 
47
47
  ```ts
48
48
  import GtkSource from 'gi://GtkSource?version=300';
@@ -50,7 +50,7 @@ import GtkSource from 'gi://GtkSource?version=300';
50
50
 
51
51
  ### Global import
52
52
 
53
- You can also import the module with Typescript support using the global `imports.gi` object of GJS.
53
+ GJS's global `imports.gi` works too, with types.
54
54
  For this you need to include `@girs/gtksource-300` or `@girs/gtksource-300/import` in your `tsconfig` or entry point Typescript file:
55
55
 
56
56
  `index.ts`:
@@ -69,7 +69,7 @@ import '@girs/gtksource-300'
69
69
  }
70
70
  ```
71
71
 
72
- Now you have also type support for this, too:
72
+ That form carries types as well:
73
73
 
74
74
  ```ts
75
75
  const GtkSource = imports.gi.GtkSource;
@@ -77,7 +77,7 @@ const GtkSource = imports.gi.GtkSource;
77
77
 
78
78
  ### Bundle
79
79
 
80
- Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
80
+ Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
81
81
 
82
82
  ## Other packages
83
83
 
@@ -0,0 +1,183 @@
1
+ /**
2
+ * The GIR-derived widget VOCABULARY for GtkSource-300.
3
+ *
4
+ * GENERATED — do not edit. Provenance: GtkSource-300 — dropped empty base(s): GObject.InitiallyUnowned GObject.Object Atk.ImplementorIface
5
+ *
6
+ * 2 concrete widgets, 2 declarations, 9 enum nick unions, 0 slot candidates.
7
+ *
8
+ * Module-scoped exports only. There is no `JSX` namespace here, no tag spelling and
9
+ * no `on<Signal>` prop name: those are DIALECT, and every framework answers them
10
+ * differently. The shape to avoid is the GLOBAL AUGMENT — a `declare global` on
11
+ * `React.JSX` collides with every other library on a shared tag — while a
12
+ * module-scoped `JSX` behind a `jsxImportSource` does not. This package is used by
13
+ * projects that want nothing to do with JSX, so it emits neither; a consumer declaring
14
+ * a module-scoped namespace over these names is doing it right.
15
+ *
16
+ * Three things this is and `ConstructorProps` is not: WRITABLE-only (measured on
17
+ * Gtk-4.0, `ConstructorProps` offers 150 read-only properties across 68 classes as
18
+ * settable, and GTK's failure mode for writing one is exit 0), OPTIONAL, and keyed
19
+ * by the name GObject actually REGISTERED — the dashed spelling `g_object_set`,
20
+ * GtkBuilder XML and Blueprint all use.
21
+ *
22
+ * Signal handler types are not re-derived: `X.SignalSignatures`, which this package
23
+ * already emits for every class with the parent chain, every implemented interface
24
+ * and the `notify::` keys folded in, is what `Widgets[G]['signals']` points at.
25
+ */
26
+
27
+ import type GtkSource from './gtksource-300.js';
28
+ import type { GtkBinConstructOnly, GtkBinProps, GtkBuildableConstructOnly, GtkBuildableProps, GtkContainerConstructOnly, GtkContainerProps, GtkScrollableConstructOnly, GtkScrollableProps, GtkTextViewConstructOnly, GtkTextViewProps, GtkWidgetConstructOnly, GtkWidgetProps, GtkWindowConstructOnly, GtkWindowProps } from '@girs/gtk-3.0/surface';
29
+
30
+ // ---------------------------------------------------------------------------
31
+ // Enum nicks — the string vocabulary GObject registered, from GIR's `glib:nick`.
32
+ //
33
+ // Not derived from the member name. Substituting underscores for dashes is not a law:
34
+ // some nicks keep an underscore the substitution would have replaced, and only the
35
+ // attribute knows which. Gtk-4.0 and Adw-1 contradict no derivation at all, which is
36
+ // how a derived nick passes review and breaks elsewhere.
37
+ // Re-measure with `scripts/check-nick-derivation.mjs` in ts-for-gir.
38
+ // ---------------------------------------------------------------------------
39
+
40
+ export type GtkSourceBracketMatchTypeNick = 'none' | 'out-of-range' | 'not-found' | 'found';
41
+ export type GtkSourceChangeCaseTypeNick = 'lower' | 'upper' | 'toggle' | 'title';
42
+ export type GtkSourceCompressionTypeNick = 'none' | 'gzip';
43
+ export type GtkSourceEncodingDuplicatesNick = 'first' | 'last';
44
+ export type GtkSourceGutterRendererAlignmentModeNick = 'cell' | 'first' | 'last';
45
+ export type GtkSourceNewlineTypeNick = 'lf' | 'cr' | 'cr-lf';
46
+ export type GtkSourceSmartHomeEndTypeNick = 'disabled' | 'before' | 'after' | 'always';
47
+ export type GtkSourceStyleSchemeKindNick = 'light' | 'dark' | 'light-only' | 'dark-only';
48
+ export type GtkSourceViewGutterPositionNick = 'lines' | 'marks';
49
+
50
+ // ---------------------------------------------------------------------------
51
+ // Property surfaces — one interface per GIR DECLARATION, mirroring GIR's own
52
+ // inheritance rather than flattening per widget.
53
+ //
54
+ // The interfaces are load-bearing, not tidiness: `GtkBox` declares four properties
55
+ // of its own and `orientation` is not among them — it lives on `Gtk.Orientable`,
56
+ // because GObject installs interface properties on the implementor at runtime while
57
+ // GIR keeps them once, on the interface.
58
+ // ---------------------------------------------------------------------------
59
+
60
+ export interface GtkSourceCompletionInfoProps extends GtkWindowProps, GtkBuildableProps {
61
+ }
62
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
63
+ export type GtkSourceCompletionInfoConstructOnly = GtkWindowConstructOnly | GtkBuildableConstructOnly;
64
+
65
+ export interface GtkSourceViewProps extends GtkTextViewProps, GtkBuildableProps, GtkScrollableProps {
66
+ /** Whether to enable auto indentation. */
67
+ 'auto-indent'?: boolean;
68
+ /** Whether to highlight the current line. */
69
+ 'highlight-current-line'?: boolean;
70
+ /** Whether to indent the selected text when the tab key is pressed. */
71
+ 'indent-on-tab'?: boolean;
72
+ /** Width of an indentation step expressed in number of spaces. */
73
+ 'indent-width'?: number;
74
+ /** Whether to insert spaces instead of tabs. */
75
+ 'insert-spaces-instead-of-tabs'?: boolean;
76
+ /** The width in characters where to position the right margin. */
77
+ 'right-margin-position'?: number;
78
+ /** Whether to display line mark pixbufs beside the text. */
79
+ 'show-line-marks'?: boolean;
80
+ /** Whether to display line numbers beside the text. */
81
+ 'show-line-numbers'?: boolean;
82
+ /** Whether to display the right margin. */
83
+ 'show-right-margin'?: boolean;
84
+ /**
85
+ * Whether smart Backspace should be used.
86
+ * @since 3.18
87
+ */
88
+ 'smart-backspace'?: boolean;
89
+ /**
90
+ * Set the behavior of the HOME and END keys.
91
+ * @since 2.0
92
+ */
93
+ 'smart-home-end'?: GtkSourceSmartHomeEndTypeNick | GtkSource.SmartHomeEndType;
94
+ /** The width of a tabulation character expressed in number of spaces. */
95
+ 'tab-width'?: number;
96
+ }
97
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
98
+ export type GtkSourceViewConstructOnly = GtkTextViewConstructOnly | GtkBuildableConstructOnly | GtkScrollableConstructOnly;
99
+
100
+ // ---------------------------------------------------------------------------
101
+ // The GType-keyed widget map.
102
+ //
103
+ // Keyed by GType because that is also the GtkBuilder XML key and the typelib key. A
104
+ // consumer maps GTypes to tags in ITS convention — kebab for JSX intrinsics, Pascal
105
+ // for a Vue `GlobalComponents`, the class itself for a renderer whose element type
106
+ // is the class. None of those is baked in here.
107
+ //
108
+ // `slotCandidates` is a candidate list and never an answer: derived from methods
109
+ // taking exactly one widget argument. The GIR cannot tell adoption from reference —
110
+ // `set_title_widget` parents its argument and `set_activatable_widget` does not, and
111
+ // both are `void f(GtkWidget*)` at `transfer-ownership="none"`. Curation decides;
112
+ // this is what notices when a release adds a candidate.
113
+ // ---------------------------------------------------------------------------
114
+
115
+ export interface Widgets {
116
+ GtkSourceCompletionInfo: {
117
+ class: GtkSource.CompletionInfo;
118
+ props: GtkSourceCompletionInfoProps;
119
+ signals: GtkSource.CompletionInfo.SignalSignatures;
120
+ constructOnly: GtkSourceCompletionInfoConstructOnly;
121
+ slotCandidates: {};
122
+ };
123
+ GtkSourceView: {
124
+ class: GtkSource.View;
125
+ props: GtkSourceViewProps;
126
+ signals: GtkSource.View.SignalSignatures;
127
+ constructOnly: GtkSourceViewConstructOnly;
128
+ slotCandidates: {};
129
+ };
130
+ }
131
+
132
+ /** Every GType this namespace can create. A consumer derives its own tag map. */
133
+ export type WidgetGType = keyof Widgets;
134
+
135
+ /** The writable, optional, GObject-keyed property surface of one GType. */
136
+ export type PropsOf<G extends WidgetGType> = Widgets[G]['props'];
137
+
138
+ /** The signal table this package already emits, reached by GType. */
139
+ export type SignalsOf<G extends WidgetGType> = Widgets[G]['signals'];
140
+
141
+ /** The instance type — what a `ref`-shaped prop should infer. */
142
+ export type InstanceOf<G extends WidgetGType> = Widgets[G]['class'];
143
+
144
+ /** Property names that can only be set at construction. */
145
+ export type ConstructOnlyOf<G extends WidgetGType> = Widgets[G]['constructOnly'];
146
+
147
+ /** Candidate child slots — see the note above; curation decides. */
148
+ export type SlotCandidatesOf<G extends WidgetGType> = keyof Widgets[G]['slotCandidates'];
149
+
150
+ /**
151
+ * The same facts as runtime data, for a consumer that CHECKS them.
152
+ *
153
+ * Types are erased, so a spec that asks the installed GTK whether every property
154
+ * here is a writable ParamSpec, every signal resolvable by `GObject.signal_lookup`
155
+ * and every nick resolvable through an enum lookup cannot read the interfaces
156
+ * above. Emitted headlessly with no GTK present, which is exactly why the checking
157
+ * belongs to the consumer and the DATA belongs here.
158
+ */
159
+ export const SURFACE_PROVENANCE: string;
160
+
161
+ /** Declaration GType -> its own settable properties, as GObject registered them. */
162
+ export const OWN_PROPS: Readonly<Record<string, readonly string[]>>;
163
+
164
+ /** Widget GType -> its own signals. */
165
+ export const OWN_SIGNALS: Readonly<Record<string, readonly string[]>>;
166
+
167
+ /** Widget GType -> every declaration its members come from, self first. */
168
+ export const DECLS: Readonly<Record<string, readonly string[]>>;
169
+
170
+ /** Enum GType -> the nicks this surface offers. */
171
+ export const ENUM_NICKS: Readonly<Record<string, readonly string[]>>;
172
+
173
+ /** Widget GType -> slot name -> the method that may adopt a child there. */
174
+ export const SLOT_CANDIDATES: Readonly<Record<string, Readonly<Record<string, string>>>>;
175
+
176
+ /**
177
+ * `Type.property` -> the release that introduced it.
178
+ *
179
+ * What keeps a runtime cross-check honest across a version gap without an
180
+ * allowlist: a member the installed library lacks is a defect UNLESS the version
181
+ * here is newer than the one running.
182
+ */
183
+ export const SINCE: Readonly<Record<string, string>>;
@@ -0,0 +1,41 @@
1
+ // The widget vocabulary of GtkSource-300 as runtime data.
2
+ //
3
+ // GENERATED — do not edit. Provenance: GtkSource-300 — dropped empty base(s): GObject.InitiallyUnowned GObject.Object Atk.ImplementorIface
4
+ //
5
+ // The type half of this subpath is the sibling `.d.ts`. This file exists because
6
+ // types are erased: a consumer that wants to ask the installed library whether every
7
+ // name here is real needs values, not declarations.
8
+
9
+ export const SURFACE_PROVENANCE = 'GtkSource-300 — dropped empty base(s): GObject.InitiallyUnowned GObject.Object Atk.ImplementorIface';
10
+
11
+ export const OWN_PROPS = {
12
+ GtkSourceView: ['auto-indent', 'highlight-current-line', 'indent-on-tab', 'indent-width', 'insert-spaces-instead-of-tabs', 'right-margin-position', 'show-line-marks', 'show-line-numbers', 'show-right-margin', 'smart-backspace', 'smart-home-end', 'tab-width'],
13
+ };
14
+
15
+ export const OWN_SIGNALS = {
16
+ GtkSourceView: ['change-case', 'change-number', 'join-lines', 'line-mark-activated', 'move-lines', 'move-to-matching-bracket', 'move-words', 'redo', 'show-completion', 'smart-home-end', 'undo'],
17
+ };
18
+
19
+ export const DECLS = {
20
+ GtkSourceCompletionInfo: ['GtkSourceCompletionInfo', 'GtkWindow', 'GtkBin', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
21
+ GtkSourceView: ['GtkSourceView', 'GtkTextView', 'GtkContainer', 'GtkWidget', 'GtkBuildable', 'GtkScrollable'],
22
+ };
23
+
24
+ export const ENUM_NICKS = {
25
+ GtkSourceBracketMatchType: ['none', 'out-of-range', 'not-found', 'found'],
26
+ GtkSourceChangeCaseType: ['lower', 'upper', 'toggle', 'title'],
27
+ GtkSourceCompressionType: ['none', 'gzip'],
28
+ GtkSourceEncodingDuplicates: ['first', 'last'],
29
+ GtkSourceGutterRendererAlignmentMode: ['cell', 'first', 'last'],
30
+ GtkSourceNewlineType: ['lf', 'cr', 'cr-lf'],
31
+ GtkSourceSmartHomeEndType: ['disabled', 'before', 'after', 'always'],
32
+ GtkSourceStyleSchemeKind: ['light', 'dark', 'light-only', 'dark-only'],
33
+ GtkSourceViewGutterPosition: ['lines', 'marks'],
34
+ };
35
+
36
+ export const SLOT_CANDIDATES = {};
37
+
38
+ export const SINCE = {
39
+ 'GtkSourceView.smart-backspace': '3.18',
40
+ 'GtkSourceView.smart-home-end': '2.0',
41
+ };
@@ -998,6 +998,13 @@ export namespace GtkSource {
998
998
  emit<K extends keyof Buffer.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Buffer.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
999
999
  emit(signal: string, ...args: any[]): void;
1000
1000
 
1001
+ // Static methods
1002
+ /**
1003
+ * Removes one trailing newline of `buffer` if it contains at least one.
1004
+ * @param buffer a {@link Gtk.TextBuffer}.
1005
+ */
1006
+ static remove_trailing_newline(buffer: Gtk.TextBuffer): void;
1007
+
1001
1008
  // Virtual methods
1002
1009
  /**
1003
1010
  * @param iter
@@ -2020,10 +2027,9 @@ export namespace GtkSource {
2020
2027
 
2021
2028
  // Methods
2022
2029
  /**
2023
- * Moves the {@link GtkSource.CompletionInfo} to `iter`. If `iter` is `null` `info` is
2024
- * moved to the cursor position. Moving will respect the {@link Gdk.Gravity} setting
2025
- * of the info window and will ensure the line at `iter` is not occluded by
2026
- * the window.
2030
+ * Moves the {@link GtkSource.CompletionInfo} to `iter`. If `iter` is `null` `info` is moved
2031
+ * to the cursor position. Moving will respect the {@link Gdk.Gravity} setting of the
2032
+ * info window and will ensure the line at `iter` is not occluded by the window.
2027
2033
  * @param view a {@link Gtk.TextView} on which the info window should be positioned.
2028
2034
  * @param iter a {@link Gtk.TextIter}.
2029
2035
  */
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@girs/gtksource-300",
3
- "version": "4.1.0",
4
- "libraryVersion": "300.0.0",
5
- "description": "GJS TypeScript type definitions for GtkSource-300, generated from library version 300.0.0",
3
+ "version": "4.3.0",
4
+ "description": "GJS TypeScript type definitions for GtkSource-300",
6
5
  "type": "module",
7
6
  "module": "gtksource-300.js",
8
7
  "main": "gtksource-300.js",
@@ -17,6 +16,11 @@
17
16
  "import": "./gtksource-300-import.js",
18
17
  "default": "./gtksource-300-import.js"
19
18
  },
19
+ "./surface": {
20
+ "types": "./gtksource-300-surface.d.ts",
21
+ "import": "./gtksource-300-surface.js",
22
+ "default": "./gtksource-300-surface.js"
23
+ },
20
24
  "./gtksource-300": {
21
25
  "types": "./gtksource-300.d.ts",
22
26
  "import": "./gtksource-300.js",
@@ -32,20 +36,20 @@
32
36
  "test": "tsc --project tsconfig.json"
33
37
  },
34
38
  "dependencies": {
35
- "@girs/gjs": "^4.1.0",
36
- "@girs/gtk-3.0": "^4.1.0",
37
- "@girs/xlib-2.0": "^4.1.0",
38
- "@girs/gdk-3.0": "^4.1.0",
39
- "@girs/cairo-1.0": "^4.1.0",
40
- "@girs/gobject-2.0": "^4.1.0",
41
- "@girs/glib-2.0": "^4.1.0",
42
- "@girs/pango-1.0": "^4.1.0",
43
- "@girs/harfbuzz-0.0": "^4.1.0",
44
- "@girs/freetype2-2.0": "^4.1.0",
45
- "@girs/gio-2.0": "^4.1.0",
46
- "@girs/gmodule-2.0": "^4.1.0",
47
- "@girs/gdkpixbuf-2.0": "^4.1.0",
48
- "@girs/atk-1.0": "^4.1.0" },
39
+ "@girs/gjs": "^4.3.0",
40
+ "@girs/gtk-3.0": "^4.3.0",
41
+ "@girs/xlib-2.0": "^4.3.0",
42
+ "@girs/gdk-3.0": "^4.3.0",
43
+ "@girs/cairo-1.0": "^4.3.0",
44
+ "@girs/gobject-2.0": "^4.3.0",
45
+ "@girs/glib-2.0": "^4.3.0",
46
+ "@girs/pango-1.0": "^4.3.0",
47
+ "@girs/harfbuzz-0.0": "^4.3.0",
48
+ "@girs/freetype2-2.0": "^4.3.0",
49
+ "@girs/gio-2.0": "^4.3.0",
50
+ "@girs/gmodule-2.0": "^4.3.0",
51
+ "@girs/gdkpixbuf-2.0": "^4.3.0",
52
+ "@girs/atk-1.0": "^4.3.0" },
49
53
  "devDependencies": {
50
54
  "typescript": "*"
51
55
  },
package/tsconfig.json CHANGED
@@ -62,7 +62,7 @@
62
62
  ]
63
63
  }
64
64
  },
65
- "include": ["./gtksource-300.d.ts"]
65
+ "include": ["./gtksource-300.d.ts","./gtksource-300-surface.d.ts"]
66
66
  }
67
67
 
68
68