@gtkx/gir 0.12.1 → 0.13.1
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/dist/internal/parser.js +29 -11
- package/dist/types.d.ts +2 -0
- package/dist/types.js +4 -0
- package/package.json +1 -1
package/dist/internal/parser.js
CHANGED
|
@@ -366,17 +366,35 @@ export class RawGirParser {
|
|
|
366
366
|
if (!properties || !Array.isArray(properties)) {
|
|
367
367
|
return [];
|
|
368
368
|
}
|
|
369
|
-
return properties.map((prop) =>
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
369
|
+
return properties.map((prop) => {
|
|
370
|
+
let getter = prop["@_getter"] ? String(prop["@_getter"]) : undefined;
|
|
371
|
+
let setter = prop["@_setter"] ? String(prop["@_setter"]) : undefined;
|
|
372
|
+
const attributes = prop.attribute;
|
|
373
|
+
if (attributes) {
|
|
374
|
+
const attrList = Array.isArray(attributes) ? attributes : [attributes];
|
|
375
|
+
for (const attr of attrList) {
|
|
376
|
+
const attrName = attr["@_name"];
|
|
377
|
+
const attrValue = attr["@_value"];
|
|
378
|
+
if (attrName === "org.gtk.Property.get" && attrValue) {
|
|
379
|
+
getter = String(attrValue);
|
|
380
|
+
}
|
|
381
|
+
else if (attrName === "org.gtk.Property.set" && attrValue) {
|
|
382
|
+
setter = String(attrValue);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
name: String(prop["@_name"] ?? ""),
|
|
388
|
+
type: this.parseType((prop.type ?? prop.array)),
|
|
389
|
+
readable: prop["@_readable"] !== "0",
|
|
390
|
+
writable: prop["@_writable"] === "1",
|
|
391
|
+
constructOnly: prop["@_construct-only"] === "1",
|
|
392
|
+
hasDefault: prop["@_default-value"] !== undefined,
|
|
393
|
+
getter,
|
|
394
|
+
setter,
|
|
395
|
+
doc: extractDoc(prop),
|
|
396
|
+
};
|
|
397
|
+
});
|
|
380
398
|
}
|
|
381
399
|
parseSignals(signals) {
|
|
382
400
|
if (!signals || !Array.isArray(signals)) {
|
package/dist/types.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ export declare class GirClass {
|
|
|
146
146
|
getAllSignals(): GirSignal[];
|
|
147
147
|
/** Finds a method by name, searching up the inheritance chain. */
|
|
148
148
|
findMethod(name: string): GirMethod | null;
|
|
149
|
+
/** Finds a method by its C identifier. */
|
|
150
|
+
getMethodByCIdentifier(cIdentifier: string): GirMethod | null;
|
|
149
151
|
/** Finds a property by name, searching up the inheritance chain. */
|
|
150
152
|
findProperty(name: string): GirProperty | null;
|
|
151
153
|
/** Finds a signal by name, searching up the inheritance chain. */
|
package/dist/types.js
CHANGED
|
@@ -199,6 +199,10 @@ export class GirClass {
|
|
|
199
199
|
return own;
|
|
200
200
|
return this.getParent()?.findMethod(name) ?? null;
|
|
201
201
|
}
|
|
202
|
+
/** Finds a method by its C identifier. */
|
|
203
|
+
getMethodByCIdentifier(cIdentifier) {
|
|
204
|
+
return this.methods.find((m) => m.cIdentifier === cIdentifier) ?? null;
|
|
205
|
+
}
|
|
202
206
|
/** Finds a property by name, searching up the inheritance chain. */
|
|
203
207
|
findProperty(name) {
|
|
204
208
|
const own = this.getProperty(name);
|