@gtkx/runtime 1.1.0 → 1.2.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/dist/closure.js +1 -1
- package/dist/closure.js.map +1 -1
- package/dist/descriptors.d.ts +10 -8
- package/dist/descriptors.d.ts.map +1 -1
- package/dist/descriptors.js +12 -9
- package/dist/descriptors.js.map +1 -1
- package/dist/register-class.d.ts +3 -3
- package/dist/register-class.js.map +1 -1
- package/dist/registry.d.ts +6 -5
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js.map +1 -1
- package/dist/t.d.ts +1 -1
- package/dist/t.d.ts.map +1 -1
- package/dist/t.js.map +1 -1
- package/package.json +4 -4
- package/src/closure.ts +1 -1
- package/src/descriptors.ts +31 -17
- package/src/register-class.ts +3 -3
- package/src/registry.ts +6 -5
- package/src/t.ts +1 -1
package/dist/closure.js
CHANGED
|
@@ -25,7 +25,7 @@ const MARSHAL_T = callbackT([
|
|
|
25
25
|
CLOSURE_T,
|
|
26
26
|
MARSHAL_VALUE_T,
|
|
27
27
|
uint32T,
|
|
28
|
-
sizedArrayT(MARSHAL_VALUE_T, N_PARAM_VALUES_INDEX, "borrowed", VALUE_SIZE),
|
|
28
|
+
sizedArrayT(MARSHAL_VALUE_T, N_PARAM_VALUES_INDEX, "borrowed", { elementSize: VALUE_SIZE }),
|
|
29
29
|
uint64T,
|
|
30
30
|
uint64T,
|
|
31
31
|
], voidT, {
|
package/dist/closure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closure.js","sourceRoot":"","sources":["../src/closure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAiB,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,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K,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,aAAa,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnG,CAAC;AAED,oGAAoG;AACpG,SAAS,YAAY,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,sGAAsG;AACtG,MAAM,mBAAoB,SAAQ,SAAS;IACvC,6EAA6E;IAC7D,IAAI,GAAG,qBAAqB,CAAC;CAChD;AAED,OAAO,EAAwB,mBAAmB,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { type ExternalObject, type Handle, read } from \"@gtkx/native\";\nimport { type AnyClass } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { boxedT, callbackT, sizedArrayT, structT, uint32T, uint64T, voidT } from \"./descriptors.js\";\nimport { CLOSURE_SIZE, LIB, VALUE_SIZE, VALUE_T } from \"./library.js\";\nimport { getClassType, getHandle, getWrapperClass, instanceClassName, wrapHandle } from \"./registry.js\";\nimport { resolveBoxedType, typeIsA } from \"./type.js\";\nimport { fromValue, getValueType, intoValue } from \"./value.js\";\n\n/**\n * Handler backing a `GClosure`. It receives the closure's parameters already converted from their\n * `GValue`s, and its result is written back into the closure's return `GValue` when it has one.\n *\n * A parameter that is itself a `GValue`, such as the target a property binding transform fills in,\n * arrives as the caller's own `GObject.Value` rather than a copy, so writing to it is how the\n * handler produces that parameter's value. It stops being valid once the handler returns.\n */\ntype ClosureCallback = (...args: never[]) => unknown;\n\nconst CCLOSURE_CALLBACK_OFFSET = CLOSURE_SIZE;\nconst N_PARAM_VALUES_INDEX = 2;\nconst MARSHAL_DATA_INDEX = 5;\nconst CLOSURE_T = boxedT(\"GClosure\", { sharedLibrary: LIB, getTypeFnName: \"g_closure_get_type\" });\n\nconst OWNED_CLOSURE_T = boxedT(\"GClosure\", {\n ownership: \"full\",\n sharedLibrary: LIB,\n getTypeFnName: \"g_closure_get_type\",\n});\n\nconst MARSHAL_VALUE_T = boxedT(\"GValue\", {\n sharedLibrary: LIB,\n getTypeFnName: \"g_value_get_type\",\n size: VALUE_SIZE,\n isCallerAllocated: true,\n});\n\nconst MARSHAL_T = callbackT(\n [\n CLOSURE_T,\n MARSHAL_VALUE_T,\n uint32T,\n sizedArrayT(MARSHAL_VALUE_T, N_PARAM_VALUES_INDEX, \"borrowed\", { elementSize: VALUE_SIZE }),\n uint64T,\n uint64T,\n ],\n voidT,\n {\n hasUserData: true,\n userDataIndex: MARSHAL_DATA_INDEX,\n hasDestroy: true,\n destroyKind: \"closureNotify\",\n scope: \"notified\",\n },\n);\n\nconst NESTED_VALUE_T = structT(\"borrowed\");\nconst gCclosureNew = bind(LIB, \"g_cclosure_new\", [MARSHAL_T], OWNED_CLOSURE_T);\nconst gValueGetBoxed = bind(LIB, \"g_value_get_boxed\", [VALUE_T], NESTED_VALUE_T);\nconst gClosureRef = bind(LIB, \"g_closure_ref\", [CLOSURE_T], uint64T);\nconst gClosureSink = bind(LIB, \"g_closure_sink\", [CLOSURE_T], voidT);\nconst gClosureSetMarshal = bind(LIB, \"g_closure_set_marshal\", [CLOSURE_T, uint64T], voidT);\n\nconst isClosureInstance = (value: object): boolean =>\n typeIsA(getClassType(value.constructor as AnyClass), resolveBoxedType(CLOSURE_T));\n\nconst getNestedValue = (param: ExternalObject<Handle>): object | null =>\n wrapHandle(gValueGetBoxed(param) as ExternalObject<Handle> | null, getWrapperClass(resolveBoxedType(VALUE_T)));\n\nconst fromParamValue = (param: ExternalObject<Handle>): unknown =>\n getValueType(param) === resolveBoxedType(VALUE_T) ? getNestedValue(param) : fromValue(param);\n\nfunction describeValue(value: unknown): string {\n if (value === null) {\n return \"null\";\n }\n\n if (typeof value !== \"object\") {\n return typeof value;\n }\n\n return instanceClassName(value);\n}\n\nfunction marshalFor(callback: ClosureCallback): (...args: unknown[]) => void {\n return (_closure: unknown, returnValue: unknown, _count: unknown, paramValues: unknown): void => {\n const values = paramValues as ExternalObject<Handle>[];\n const args = values.map((value) => fromParamValue(value));\n const result = (callback as (...values: unknown[]) => unknown)(...(args as never[]));\n\n if (returnValue !== null) {\n intoValue(returnValue as ExternalObject<Handle>, result);\n }\n };\n}\n\nfunction newClosure(callback: ClosureCallback): ExternalObject<Handle> {\n const handle = gCclosureNew(marshalFor(callback)) as ExternalObject<Handle>;\n const marshal = read(handle, uint64T, CCLOSURE_CALLBACK_OFFSET);\n gClosureRef(handle);\n gClosureSink(handle);\n gClosureSetMarshal(handle, marshal);\n\n return handle;\n}\n\n/**\n * Marshals a value passed where a `GObject.Closure` is expected into a closure handle: a function\n * becomes a new `GClosure` dispatching into it, and an existing closure yields its own handle.\n * @param value Function to wrap, or an already-built closure.\n * @throws {ClosureMarshalError} When the value is neither.\n */\nfunction toClosure(value: unknown): ExternalObject<Handle> {\n if (typeof value === \"function\") {\n return newClosure(value as ClosureCallback);\n }\n\n if (typeof value === \"object\" && value !== null && isClosureInstance(value)) {\n return getHandle(value);\n }\n\n throw new ClosureMarshalError(`Cannot marshal ${describeValue(value)} into a GObject.Closure`);\n}\n\n/** Same as {@link toClosure}, but passes a null or undefined value through as no closure at all. */\nfunction tryToClosure(value: unknown): ExternalObject<Handle> | undefined {\n return value == null ? undefined : toClosure(value);\n}\n\n/** Thrown when a value passed where a `GObject.Closure` is expected cannot be marshalled into one. */\nclass ClosureMarshalError extends TypeError {\n /** Name callers match on when the error is caught as a plain `TypeError`. */\n public override name = \"ClosureMarshalError\";\n}\n\nexport { type ClosureCallback, ClosureMarshalError, toClosure, tryToClosure };\n"]}
|
package/dist/descriptors.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ type ArrayOptions = {
|
|
|
162
162
|
sizeParamIndex?: number | undefined;
|
|
163
163
|
/** Element count of a fixed-length array. */
|
|
164
164
|
fixedSize?: number | undefined;
|
|
165
|
+
/** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */
|
|
166
|
+
isBytes?: boolean | undefined;
|
|
165
167
|
};
|
|
166
168
|
/** Where a cursor array's base buffer and total length come from. */
|
|
167
169
|
type CursorBounds = {
|
|
@@ -256,24 +258,24 @@ declare const fundamentalT: (sharedLibrary: string, refFnName: string, unrefFnNa
|
|
|
256
258
|
/** Builds a descriptor for an array of items in one of the supported container layouts. */
|
|
257
259
|
declare const arrayT: (itemDescriptor: Descriptor, arrayKind?: ArrayKind, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
258
260
|
/** Builds a descriptor for a `GList` of items. */
|
|
259
|
-
declare const listT: (itemDescriptor: Descriptor, ownership?: Ownership) => ArrayDescriptor;
|
|
261
|
+
declare const listT: (itemDescriptor: Descriptor, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
260
262
|
/** Builds a descriptor for a `GSList` of items. */
|
|
261
|
-
declare const slistT: (itemDescriptor: Descriptor, ownership?: Ownership) => ArrayDescriptor;
|
|
263
|
+
declare const slistT: (itemDescriptor: Descriptor, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
262
264
|
/** Builds a descriptor for a `GPtrArray` of items. */
|
|
263
|
-
declare const ptrArrayT: (itemDescriptor: Descriptor, ownership?: Ownership) => ArrayDescriptor;
|
|
264
|
-
/** Builds a descriptor for a `GArray` of items
|
|
265
|
-
declare const gArrayT: (itemDescriptor: Descriptor, ownership?: Ownership,
|
|
265
|
+
declare const ptrArrayT: (itemDescriptor: Descriptor, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
266
|
+
/** Builds a descriptor for a `GArray` of items. */
|
|
267
|
+
declare const gArrayT: (itemDescriptor: Descriptor, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
266
268
|
/** Builds a descriptor for a `GByteArray`. */
|
|
267
269
|
declare const byteArrayT: (ownership?: Ownership) => ArrayDescriptor;
|
|
268
270
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
269
|
-
declare const sizedArrayT: (itemDescriptor: Descriptor, sizeParamIndex: number, ownership?: Ownership,
|
|
271
|
+
declare const sizedArrayT: (itemDescriptor: Descriptor, sizeParamIndex: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
270
272
|
/**
|
|
271
273
|
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
272
274
|
* elements from where it points to the end of that buffer.
|
|
273
275
|
*/
|
|
274
|
-
declare const cursorArrayT: (itemDescriptor: Descriptor, bounds: CursorBounds, ownership?: Ownership,
|
|
276
|
+
declare const cursorArrayT: (itemDescriptor: Descriptor, bounds: CursorBounds, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
275
277
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
276
|
-
declare const fixedArrayT: (itemDescriptor: Descriptor, fixedSize: number, ownership?: Ownership,
|
|
278
|
+
declare const fixedArrayT: (itemDescriptor: Descriptor, fixedSize: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
277
279
|
/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */
|
|
278
280
|
declare const callbackT: (argDescriptors: Descriptor[], returnDescriptor: Descriptor, options?: CallbackOptions) => CallbackDescriptor;
|
|
279
281
|
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, float32T, float64T, booleanT, voidT, unicharT, bufferT, stringT, objectT, refT, hashTableT, enumT, flagsT, boxedT, structT, fundamentalLifecycleFor, fundamentalT, arrayT, listT, slistT, ptrArrayT, gArrayT, byteArrayT, sizedArrayT, fixedArrayT, cursorArrayT, callbackT, type BoxedDescriptor, type StructDescriptor, type FundamentalDescriptor, type ArrayDescriptor, type HashTableDescriptor, type CallbackDesc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K,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACrB,CAAC"}
|
package/dist/descriptors.js
CHANGED
|
@@ -150,27 +150,30 @@ const arrayT = (itemDescriptor, arrayKind = "array", ownership = "borrowed", opt
|
|
|
150
150
|
if (options?.fixedSize !== undefined) {
|
|
151
151
|
result.fixedSize = options.fixedSize;
|
|
152
152
|
}
|
|
153
|
+
if (options?.isBytes === true) {
|
|
154
|
+
result.isBytes = true;
|
|
155
|
+
}
|
|
153
156
|
return result;
|
|
154
157
|
};
|
|
155
158
|
/** Builds a descriptor for a `GList` of items. */
|
|
156
|
-
const listT = (itemDescriptor, ownership = "borrowed") => arrayT(itemDescriptor, "glist", ownership);
|
|
159
|
+
const listT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "glist", ownership, options);
|
|
157
160
|
/** Builds a descriptor for a `GSList` of items. */
|
|
158
|
-
const slistT = (itemDescriptor, ownership = "borrowed") => arrayT(itemDescriptor, "gslist", ownership);
|
|
161
|
+
const slistT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "gslist", ownership, options);
|
|
159
162
|
/** Builds a descriptor for a `GPtrArray` of items. */
|
|
160
|
-
const ptrArrayT = (itemDescriptor, ownership = "borrowed") => arrayT(itemDescriptor, "gptrarray", ownership);
|
|
161
|
-
/** Builds a descriptor for a `GArray` of items
|
|
162
|
-
const gArrayT = (itemDescriptor, ownership = "borrowed",
|
|
163
|
+
const ptrArrayT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "gptrarray", ownership, options);
|
|
164
|
+
/** Builds a descriptor for a `GArray` of items. */
|
|
165
|
+
const gArrayT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "garray", ownership, options);
|
|
163
166
|
/** Builds a descriptor for a `GByteArray`. */
|
|
164
|
-
const byteArrayT = (ownership = "borrowed") => arrayT(uint8T, "gbytearray", ownership);
|
|
167
|
+
const byteArrayT = (ownership = "borrowed") => arrayT(uint8T, "gbytearray", ownership, { isBytes: true });
|
|
165
168
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
166
|
-
const sizedArrayT = (itemDescriptor, sizeParamIndex, ownership = "borrowed",
|
|
169
|
+
const sizedArrayT = (itemDescriptor, sizeParamIndex, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "sized", ownership, { ...options, sizeParamIndex });
|
|
167
170
|
/**
|
|
168
171
|
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
169
172
|
* elements from where it points to the end of that buffer.
|
|
170
173
|
*/
|
|
171
|
-
const cursorArrayT = (itemDescriptor, bounds, ownership = "borrowed",
|
|
174
|
+
const cursorArrayT = (itemDescriptor, bounds, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "cursor", ownership, { ...options, ...bounds });
|
|
172
175
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
173
|
-
const fixedArrayT = (itemDescriptor, fixedSize, ownership = "borrowed",
|
|
176
|
+
const fixedArrayT = (itemDescriptor, fixedSize, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "fixed", ownership, { ...options, fixedSize });
|
|
174
177
|
const applyClosureOptions = (result, options) => {
|
|
175
178
|
if (options.hasDestroy !== undefined) {
|
|
176
179
|
result.hasDestroy = options.hasDestroy;
|
package/dist/descriptors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../src/descriptors.ts"],"names":[],"mappings":"AA8JA,wDAAwD;AACxD,MAAM,KAAK,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AClB,CAAC;IAED,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,GAQZ,CAAC","sourcesContent":["import type { ArrayKind, Descriptor, Ownership } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\n\n/** Descriptor variant for a `gint8`. */\ntype Int8Descriptor = Extract<Descriptor, { kind: \"int8\" }>;\n/** Descriptor variant for a `guint8`. */\ntype Uint8Descriptor = Extract<Descriptor, { kind: \"uint8\" }>;\n/** Descriptor variant for a `gint16`. */\ntype Int16Descriptor = Extract<Descriptor, { kind: \"int16\" }>;\n/** Descriptor variant for a `guint16`. */\ntype Uint16Descriptor = Extract<Descriptor, { kind: \"uint16\" }>;\n/** Descriptor variant for a `gint32`. */\ntype Int32Descriptor = Extract<Descriptor, { kind: \"int32\" }>;\n/** Descriptor variant for a `guint32`. */\ntype Uint32Descriptor = Extract<Descriptor, { kind: \"uint32\" }>;\n/** Descriptor variant for a `gint64` marshalled as a number. */\ntype Int64Descriptor = Extract<Descriptor, { kind: \"int64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a number. */\ntype Uint64Descriptor = Extract<Descriptor, { kind: \"uint64\" }>;\n/** Descriptor variant for a `gint64` marshalled as a bigint. */\ntype BigInt64Descriptor = Extract<Descriptor, { kind: \"bigint64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a bigint. */\ntype BigUint64Descriptor = Extract<Descriptor, { kind: \"biguint64\" }>;\n/** Descriptor variant for a `gfloat`. */\ntype Float32Descriptor = Extract<Descriptor, { kind: \"float32\" }>;\n/** Descriptor variant for a `gdouble`. */\ntype Float64Descriptor = Extract<Descriptor, { kind: \"float64\" }>;\n/** Descriptor variant for an enumeration, carrying the library and `get_type` symbol its GType comes from. */\ntype EnumDescriptor = Extract<Descriptor, { kind: \"enum\" }>;\n/** Descriptor variant for a flags type, carrying the library and `get_type` symbol its GType comes from. */\ntype FlagsDescriptor = Extract<Descriptor, { kind: \"flags\" }>;\n/** Descriptor variant for a `gboolean`. */\ntype BooleanDescriptor = Extract<Descriptor, { kind: \"boolean\" }>;\n/** Descriptor variant for a C string. */\ntype StringDescriptor = Extract<Descriptor, { kind: \"string\" }>;\n/** Descriptor variant for a `GObject`. */\ntype ObjectDescriptor = Extract<Descriptor, { kind: \"object\" }>;\n/** Descriptor variant for a `gunichar`. */\ntype UnicharDescriptor = Extract<Descriptor, { kind: \"unichar\" }>;\n/** Descriptor variant for the absence of a value. */\ntype VoidDescriptor = Extract<Descriptor, { kind: \"void\" }>;\n/** Descriptor variant for an opaque `gpointer`. */\ntype BufferDescriptor = Extract<Descriptor, { kind: \"buffer\" }>;\n/** Descriptor variant for a `GBoxed` value. */\ntype BoxedDescriptor = Extract<Descriptor, { kind: \"boxed\" }>;\n\n/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */\ntype StructDescriptor = Extract<Descriptor, { kind: \"struct\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the value's own GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for a ref-counted fundamental type, extended with the class its decoded value is wrapped in. */\ntype FundamentalDescriptor = Extract<Descriptor, { kind: \"fundamental\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for an array of items in one of the supported container layouts. */\ntype ArrayDescriptor = Extract<Descriptor, { kind: \"array\" }>;\n/** Descriptor variant for a `GHashTable`, marshalled as an array of key/value pairs. */\ntype HashTableDescriptor = Extract<Descriptor, { kind: \"hashtable\" }>;\n/** Descriptor variant for a function pointer a JavaScript function is marshalled into. */\ntype CallbackDescriptor = Extract<Descriptor, { kind: \"callback\" }>;\n/** Descriptor variant for a pointer to another descriptor's value, for an output or inout argument. */\ntype RefDescriptor = Extract<Descriptor, { kind: \"ref\" }>;\n\n/** Descriptor for a `GType`: a `guint64` marked so it resolves to `G_TYPE_GTYPE` rather than an integer. */\ntype TypeDescriptor = BigUint64Descriptor & {\n /** Distinguishes a GType from a plain `guint64` when the GLib type and the GValue type are resolved. */\n type: true;\n};\n\n/** How a boxed value is stored, and where its GType and free function are resolved from. */\ntype BoxedOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** Library `getTypeFnName` and `freeFnName` are resolved in. */\n sharedLibrary?: string;\n /** Symbol returning the boxed GType, used when the type is not already registered under its name. */\n getTypeFnName?: string;\n /** Symbol that frees the value, for a boxed type with no GType of its own. */\n freeFnName?: string;\n /** Byte size of the value, needed to copy it into an inline field. */\n size?: number;\n};\n\n/**\n * What the bindings do with a callback's return value, how the callee takes its closure, and how\n * long that closure has to stay alive.\n */\ntype CallbackOptions = {\n /** The callee also takes a destroy notify, which frees the closure once it is done with it. */\n hasDestroy?: boolean;\n /** Signature of that destroy notify; defaults to `destroyNotify`, a one-argument `GDestroyNotify`. */\n destroyKind?: CallbackDescriptor[\"destroyKind\"];\n /** The callee also takes a `user_data` pointer; without one the closure can never be freed. */\n hasUserData?: boolean;\n /** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */\n userDataIndex?: number;\n /** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */\n scope?: CallbackDescriptor[\"scope\"];\n};\n\n/** The lengths and strides a C array layout needs beyond its element type. */\ntype ArrayOptions = {\n /** Stride in bytes between elements stored inline in the array. */\n elementSize?: number | undefined;\n /** Position of the argument whose buffer a cursor array points into. */\n baseParamIndex?: number | undefined;\n /** Position of the argument carrying the element count, for a length-bounded array. */\n sizeParamIndex?: number | undefined;\n /** Element count of a fixed-length array. */\n fixedSize?: number | undefined;\n};\n\n/** Where a cursor array's base buffer and total length come from. */\ntype CursorBounds = {\n /** Position of the argument holding the buffer the cursor points into. */\n baseParamIndex: number;\n /** Position of the argument carrying that buffer's element count. */\n sizeParamIndex: number;\n};\n\n/** How a ref-counted fundamental value is named, wrapped and stored. */\ntype FundamentalOptions = {\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** GLib type name the wrapper class is looked up by. */\n typeName?: string;\n /** Class a decoded value is wrapped in, instead of the one registered for `typeName`. */\n wrapperClass?: AnyClass;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n};\n\ntype FundamentalLifecycle = {\n sharedLibrary: string;\n refFnName: string;\n unrefFnName: string;\n};\n\n/** How a plain C struct is stored and wrapped. */\ntype StructOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Byte size of the struct, needed to copy it rather than borrow the pointer. */\n size?: number;\n /** Class a decoded value is wrapped in, instead of the one registered for its GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor for a `gint8`, marshalled as a number. */\nconst int8T: Int8Descriptor = { kind: \"int8\" };\n/** Descriptor for a `guint8`, marshalled as a number. */\nconst uint8T: Uint8Descriptor = { kind: \"uint8\" };\n/** Descriptor for a `gint16`, marshalled as a number. */\nconst int16T: Int16Descriptor = { kind: \"int16\" };\n/** Descriptor for a `guint16`, marshalled as a number. */\nconst uint16T: Uint16Descriptor = { kind: \"uint16\" };\n/** Descriptor for a `gint32`, marshalled as a number. */\nconst int32T: Int32Descriptor = { kind: \"int32\" };\n/** Descriptor for a `guint32`, marshalled as a number. */\nconst uint32T: Uint32Descriptor = { kind: \"uint32\" };\n/** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst int64T: Int64Descriptor = { kind: \"int64\" };\n/** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst uint64T: Uint64Descriptor = { kind: \"uint64\" };\n/** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst bigint64T: BigInt64Descriptor = { kind: \"bigint64\" };\n/** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst biguint64T: BigUint64Descriptor = { kind: \"biguint64\" };\n/** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\nconst gtypeT: TypeDescriptor = { kind: \"biguint64\", type: true };\n/** Descriptor for a `gfloat`. */\nconst float32T: Float32Descriptor = { kind: \"float32\" };\n/** Descriptor for a `gdouble`. */\nconst float64T: Float64Descriptor = { kind: \"float64\" };\n/** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\nconst booleanT: BooleanDescriptor = { kind: \"boolean\" };\n/** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\nconst voidT: VoidDescriptor = { kind: \"void\" };\n/** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\nconst unicharT: UnicharDescriptor = { kind: \"unichar\" };\n/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */\nconst bufferT: BufferDescriptor = { kind: \"buffer\" };\nconst fundamentalLifecycles: Map<string, FundamentalLifecycle> = new Map();\n\n/**\n * Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer\n * used when the string is passed by reference.\n */\nconst stringT = (ownership: Ownership = \"borrowed\", length?: number): StringDescriptor =>\n length === undefined ? { kind: \"string\", ownership } : { kind: \"string\", ownership, length };\n\n/** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */\nconst objectT = (ownership: Ownership = \"borrowed\"): ObjectDescriptor => ({ kind: \"object\", ownership });\n\n/** Wraps a descriptor in a pointer to it, for an output or inout argument. */\nconst refT = (innerDescriptor: Descriptor, isInout = false): RefDescriptor =>\n isInout ? { kind: \"ref\", innerDescriptor, inout: true } : { kind: \"ref\", innerDescriptor };\n\n/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\nconst hashTableT = (\n keyDescriptor: Descriptor,\n valueDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n): HashTableDescriptor => ({\n kind: \"hashtable\",\n keyDescriptor,\n valueDescriptor,\n ownership,\n});\n\n/** Builds a descriptor for an enumeration, resolving its GType from the named `get_type` function. */\nconst enumT = (sharedLibrary: string, typeFnName: string, isSigned: boolean): EnumDescriptor => ({\n kind: \"enum\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n});\n\n/** Builds a descriptor for a flags type, resolving its GType from the named `get_type` function. */\nconst flagsT = (sharedLibrary: string, typeFnName: string, isSigned: boolean): FlagsDescriptor => ({\n kind: \"flags\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n});\n\nconst applyBoxedNames = (result: BoxedDescriptor, options: BoxedOptions): void => {\n if (options.sharedLibrary !== undefined) {\n result.sharedLibrary = options.sharedLibrary;\n }\n\n if (options.getTypeFnName !== undefined) {\n result.getTypeFnName = options.getTypeFnName;\n }\n\n if (options.freeFnName !== undefined) {\n result.freeFnName = options.freeFnName;\n }\n};\n\nconst applyBoxedOptions = (result: BoxedDescriptor, options: BoxedOptions): void => {\n applyBoxedNames(result, options);\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n};\n\n/** Builds a descriptor for a `GBoxed` value of the named type. */\nconst boxedT = (typeName: string, options: BoxedOptions = {}): BoxedDescriptor => {\n const result: BoxedDescriptor = {\n kind: \"boxed\",\n ownership: options.ownership ?? \"borrowed\",\n typeName,\n };\n\n applyBoxedOptions(result, options);\n\n return result;\n};\n\n/** Builds a descriptor for a plain C struct. */\nconst structT = (ownership: Ownership = \"borrowed\", options: StructOptions = {}): StructDescriptor => {\n const result: StructDescriptor = { kind: \"struct\", ownership };\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\nconst recordFundamentalLifecycle = (typeName: string, lifecycle: FundamentalLifecycle): void => {\n if (!fundamentalLifecycles.has(typeName)) {\n fundamentalLifecycles.set(typeName, lifecycle);\n }\n};\n\nconst fundamentalLifecycleFor = (typeName: string): FundamentalLifecycle | undefined =>\n fundamentalLifecycles.get(typeName);\n\n/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\nconst fundamentalT = (\n sharedLibrary: string,\n refFnName: string,\n unrefFnName: string,\n options: FundamentalOptions = {},\n): FundamentalDescriptor => {\n const ownership = options.ownership ?? \"borrowed\";\n const result: FundamentalDescriptor = { kind: \"fundamental\", ownership, sharedLibrary, refFnName, unrefFnName };\n\n if (options.typeName !== undefined) {\n result.typeName = options.typeName;\n recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\n/** Builds a descriptor for an array of items in one of the supported container layouts. */\nconst arrayT = (\n itemDescriptor: Descriptor,\n arrayKind: ArrayKind = \"array\",\n ownership: Ownership = \"borrowed\",\n options?: ArrayOptions,\n): ArrayDescriptor => {\n const result: ArrayDescriptor = { kind: \"array\", itemDescriptor, arrayKind, ownership };\n\n if (options?.elementSize !== undefined) {\n result.elementSize = options.elementSize;\n }\n\n if (options?.baseParamIndex !== undefined) {\n result.baseParamIndex = options.baseParamIndex;\n }\n\n if (options?.sizeParamIndex !== undefined) {\n result.sizeParamIndex = options.sizeParamIndex;\n }\n\n if (options?.fixedSize !== undefined) {\n result.fixedSize = options.fixedSize;\n }\n\n return result;\n};\n\n/** Builds a descriptor for a `GList` of items. */\nconst listT = (itemDescriptor: Descriptor, ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(itemDescriptor, \"glist\", ownership);\n\n/** Builds a descriptor for a `GSList` of items. */\nconst slistT = (itemDescriptor: Descriptor, ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(itemDescriptor, \"gslist\", ownership);\n\n/** Builds a descriptor for a `GPtrArray` of items. */\nconst ptrArrayT = (itemDescriptor: Descriptor, ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(itemDescriptor, \"gptrarray\", ownership);\n\n/** Builds a descriptor for a `GArray` of items, optionally with an explicit element size. */\nconst gArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n elementSize?: number,\n): ArrayDescriptor =>\n arrayT(itemDescriptor, \"garray\", ownership, elementSize === undefined ? undefined : { elementSize });\n\n/** Builds a descriptor for a `GByteArray`. */\nconst byteArrayT = (ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(uint8T, \"gbytearray\", ownership);\n\n/** Builds a descriptor for a C array whose length is carried by another argument. */\nconst sizedArrayT = (\n itemDescriptor: Descriptor,\n sizeParamIndex: number,\n ownership: Ownership = \"borrowed\",\n elementSize?: number,\n): ArrayDescriptor => arrayT(itemDescriptor, \"sized\", ownership, { sizeParamIndex, elementSize });\n\n/**\n * Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the\n * elements from where it points to the end of that buffer.\n */\nconst cursorArrayT = (\n itemDescriptor: Descriptor,\n bounds: CursorBounds,\n ownership: Ownership = \"borrowed\",\n elementSize?: number,\n): ArrayDescriptor => arrayT(itemDescriptor, \"cursor\", ownership, { ...bounds, elementSize });\n\n/** Builds a descriptor for a C array of a fixed length. */\nconst fixedArrayT = (\n itemDescriptor: Descriptor,\n fixedSize: number,\n ownership: Ownership = \"borrowed\",\n elementSize?: number,\n): ArrayDescriptor => arrayT(itemDescriptor, \"fixed\", ownership, { fixedSize, elementSize });\n\nconst applyClosureOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n if (options.hasDestroy !== undefined) {\n result.hasDestroy = options.hasDestroy;\n }\n\n if (options.destroyKind !== undefined) {\n result.destroyKind = options.destroyKind;\n }\n\n if (options.hasUserData !== undefined) {\n result.hasUserData = options.hasUserData;\n }\n\n if (options.userDataIndex !== undefined) {\n result.userDataIndex = options.userDataIndex;\n }\n\n if (options.scope !== undefined) {\n result.scope = options.scope;\n }\n};\n\n/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */\nconst callbackT = (\n argDescriptors: Descriptor[],\n returnDescriptor: Descriptor,\n options?: CallbackOptions,\n): CallbackDescriptor => {\n const result: CallbackDescriptor = { kind: \"callback\", argDescriptors, returnDescriptor };\n\n if (options === undefined) {\n return result;\n }\n\n applyClosureOptions(result, options);\n\n return result;\n};\n\nexport {\n int8T,\n uint8T,\n int16T,\n uint16T,\n int32T,\n uint32T,\n int64T,\n uint64T,\n bigint64T,\n biguint64T,\n gtypeT,\n float32T,\n float64T,\n booleanT,\n voidT,\n unicharT,\n bufferT,\n stringT,\n objectT,\n refT,\n hashTableT,\n enumT,\n flagsT,\n boxedT,\n structT,\n fundamentalLifecycleFor,\n fundamentalT,\n arrayT,\n listT,\n slistT,\n ptrArrayT,\n gArrayT,\n byteArrayT,\n sizedArrayT,\n fixedArrayT,\n cursorArrayT,\n callbackT,\n type BoxedDescriptor,\n type StructDescriptor,\n type FundamentalDescriptor,\n type ArrayDescriptor,\n type HashTableDescript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SAAS,EAAE,CAAC;QAC9B,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IACjC,CAAC;AACL,CAAC,CAAC;AAEF,2GAA2G;AAC3G,MAAM,SAAS,GAAG,CACd,cAA4B,EAC5B,gBAA4B,EAC5B,OAAyB,EACP,EAAE;IACpB,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;IAE1F,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,GAQZ,CAAC","sourcesContent":["import type { ArrayKind, Descriptor, Ownership } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\n\n/** Descriptor variant for a `gint8`. */\ntype Int8Descriptor = Extract<Descriptor, { kind: \"int8\" }>;\n/** Descriptor variant for a `guint8`. */\ntype Uint8Descriptor = Extract<Descriptor, { kind: \"uint8\" }>;\n/** Descriptor variant for a `gint16`. */\ntype Int16Descriptor = Extract<Descriptor, { kind: \"int16\" }>;\n/** Descriptor variant for a `guint16`. */\ntype Uint16Descriptor = Extract<Descriptor, { kind: \"uint16\" }>;\n/** Descriptor variant for a `gint32`. */\ntype Int32Descriptor = Extract<Descriptor, { kind: \"int32\" }>;\n/** Descriptor variant for a `guint32`. */\ntype Uint32Descriptor = Extract<Descriptor, { kind: \"uint32\" }>;\n/** Descriptor variant for a `gint64` marshalled as a number. */\ntype Int64Descriptor = Extract<Descriptor, { kind: \"int64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a number. */\ntype Uint64Descriptor = Extract<Descriptor, { kind: \"uint64\" }>;\n/** Descriptor variant for a `gint64` marshalled as a bigint. */\ntype BigInt64Descriptor = Extract<Descriptor, { kind: \"bigint64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a bigint. */\ntype BigUint64Descriptor = Extract<Descriptor, { kind: \"biguint64\" }>;\n/** Descriptor variant for a `gfloat`. */\ntype Float32Descriptor = Extract<Descriptor, { kind: \"float32\" }>;\n/** Descriptor variant for a `gdouble`. */\ntype Float64Descriptor = Extract<Descriptor, { kind: \"float64\" }>;\n/** Descriptor variant for an enumeration, carrying the library and `get_type` symbol its GType comes from. */\ntype EnumDescriptor = Extract<Descriptor, { kind: \"enum\" }>;\n/** Descriptor variant for a flags type, carrying the library and `get_type` symbol its GType comes from. */\ntype FlagsDescriptor = Extract<Descriptor, { kind: \"flags\" }>;\n/** Descriptor variant for a `gboolean`. */\ntype BooleanDescriptor = Extract<Descriptor, { kind: \"boolean\" }>;\n/** Descriptor variant for a C string. */\ntype StringDescriptor = Extract<Descriptor, { kind: \"string\" }>;\n/** Descriptor variant for a `GObject`. */\ntype ObjectDescriptor = Extract<Descriptor, { kind: \"object\" }>;\n/** Descriptor variant for a `gunichar`. */\ntype UnicharDescriptor = Extract<Descriptor, { kind: \"unichar\" }>;\n/** Descriptor variant for the absence of a value. */\ntype VoidDescriptor = Extract<Descriptor, { kind: \"void\" }>;\n/** Descriptor variant for an opaque `gpointer`. */\ntype BufferDescriptor = Extract<Descriptor, { kind: \"buffer\" }>;\n/** Descriptor variant for a `GBoxed` value. */\ntype BoxedDescriptor = Extract<Descriptor, { kind: \"boxed\" }>;\n\n/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */\ntype StructDescriptor = Extract<Descriptor, { kind: \"struct\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the value's own GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for a ref-counted fundamental type, extended with the class its decoded value is wrapped in. */\ntype FundamentalDescriptor = Extract<Descriptor, { kind: \"fundamental\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for an array of items in one of the supported container layouts. */\ntype ArrayDescriptor = Extract<Descriptor, { kind: \"array\" }>;\n/** Descriptor variant for a `GHashTable`, marshalled as an array of key/value pairs. */\ntype HashTableDescriptor = Extract<Descriptor, { kind: \"hashtable\" }>;\n/** Descriptor variant for a function pointer a JavaScript function is marshalled into. */\ntype CallbackDescriptor = Extract<Descriptor, { kind: \"callback\" }>;\n/** Descriptor variant for a pointer to another descriptor's value, for an output or inout argument. */\ntype RefDescriptor = Extract<Descriptor, { kind: \"ref\" }>;\n\n/** Descriptor for a `GType`: a `guint64` marked so it resolves to `G_TYPE_GTYPE` rather than an integer. */\ntype TypeDescriptor = BigUint64Descriptor & {\n /** Distinguishes a GType from a plain `guint64` when the GLib type and the GValue type are resolved. */\n type: true;\n};\n\n/** How a boxed value is stored, and where its GType and free function are resolved from. */\ntype BoxedOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** Library `getTypeFnName` and `freeFnName` are resolved in. */\n sharedLibrary?: string;\n /** Symbol returning the boxed GType, used when the type is not already registered under its name. */\n getTypeFnName?: string;\n /** Symbol that frees the value, for a boxed type with no GType of its own. */\n freeFnName?: string;\n /** Byte size of the value, needed to copy it into an inline field. */\n size?: number;\n};\n\n/**\n * What the bindings do with a callback's return value, how the callee takes its closure, and how\n * long that closure has to stay alive.\n */\ntype CallbackOptions = {\n /** The callee also takes a destroy notify, which frees the closure once it is done with it. */\n hasDestroy?: boolean;\n /** Signature of that destroy notify; defaults to `destroyNotify`, a one-argument `GDestroyNotify`. */\n destroyKind?: CallbackDescriptor[\"destroyKind\"];\n /** The callee also takes a `user_data` pointer; without one the closure can never be freed. */\n hasUserData?: boolean;\n /** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */\n userDataIndex?: number;\n /** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */\n scope?: CallbackDescriptor[\"scope\"];\n};\n\n/** The lengths and strides a C array layout needs beyond its element type. */\ntype ArrayOptions = {\n /** Stride in bytes between elements stored inline in the array. */\n elementSize?: number | undefined;\n /** Position of the argument whose buffer a cursor array points into. */\n baseParamIndex?: number | undefined;\n /** Position of the argument carrying the element count, for a length-bounded array. */\n sizeParamIndex?: number | undefined;\n /** Element count of a fixed-length array. */\n fixedSize?: number | undefined;\n /** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */\n isBytes?: boolean | undefined;\n};\n\n/** Where a cursor array's base buffer and total length come from. */\ntype CursorBounds = {\n /** Position of the argument holding the buffer the cursor points into. */\n baseParamIndex: number;\n /** Position of the argument carrying that buffer's element count. */\n sizeParamIndex: number;\n};\n\n/** How a ref-counted fundamental value is named, wrapped and stored. */\ntype FundamentalOptions = {\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** GLib type name the wrapper class is looked up by. */\n typeName?: string;\n /** Class a decoded value is wrapped in, instead of the one registered for `typeName`. */\n wrapperClass?: AnyClass;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n};\n\ntype FundamentalLifecycle = {\n sharedLibrary: string;\n refFnName: string;\n unrefFnName: string;\n};\n\n/** How a plain C struct is stored and wrapped. */\ntype StructOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Byte size of the struct, needed to copy it rather than borrow the pointer. */\n size?: number;\n /** Class a decoded value is wrapped in, instead of the one registered for its GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor for a `gint8`, marshalled as a number. */\nconst int8T: Int8Descriptor = { kind: \"int8\" };\n/** Descriptor for a `guint8`, marshalled as a number. */\nconst uint8T: Uint8Descriptor = { kind: \"uint8\" };\n/** Descriptor for a `gint16`, marshalled as a number. */\nconst int16T: Int16Descriptor = { kind: \"int16\" };\n/** Descriptor for a `guint16`, marshalled as a number. */\nconst uint16T: Uint16Descriptor = { kind: \"uint16\" };\n/** Descriptor for a `gint32`, marshalled as a number. */\nconst int32T: Int32Descriptor = { kind: \"int32\" };\n/** Descriptor for a `guint32`, marshalled as a number. */\nconst uint32T: Uint32Descriptor = { kind: \"uint32\" };\n/** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst int64T: Int64Descriptor = { kind: \"int64\" };\n/** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst uint64T: Uint64Descriptor = { kind: \"uint64\" };\n/** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst bigint64T: BigInt64Descriptor = { kind: \"bigint64\" };\n/** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst biguint64T: BigUint64Descriptor = { kind: \"biguint64\" };\n/** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\nconst gtypeT: TypeDescriptor = { kind: \"biguint64\", type: true };\n/** Descriptor for a `gfloat`. */\nconst float32T: Float32Descriptor = { kind: \"float32\" };\n/** Descriptor for a `gdouble`. */\nconst float64T: Float64Descriptor = { kind: \"float64\" };\n/** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\nconst booleanT: BooleanDescriptor = { kind: \"boolean\" };\n/** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\nconst voidT: VoidDescriptor = { kind: \"void\" };\n/** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\nconst unicharT: UnicharDescriptor = { kind: \"unichar\" };\n/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */\nconst bufferT: BufferDescriptor = { kind: \"buffer\" };\nconst fundamentalLifecycles: Map<string, FundamentalLifecycle> = new Map();\n\n/**\n * Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer\n * used when the string is passed by reference.\n */\nconst stringT = (ownership: Ownership = \"borrowed\", length?: number): StringDescriptor =>\n length === undefined ? { kind: \"string\", ownership } : { kind: \"string\", ownership, length };\n\n/** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */\nconst objectT = (ownership: Ownership = \"borrowed\"): ObjectDescriptor => ({ kind: \"object\", ownership });\n\n/** Wraps a descriptor in a pointer to it, for an output or inout argument. */\nconst refT = (innerDescriptor: Descriptor, isInout = false): RefDescriptor =>\n isInout ? { kind: \"ref\", innerDescriptor, inout: true } : { kind: \"ref\", innerDescriptor };\n\n/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\nconst hashTableT = (\n keyDescriptor: Descriptor,\n valueDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n): HashTableDescriptor => ({\n kind: \"hashtable\",\n keyDescriptor,\n valueDescriptor,\n ownership,\n});\n\n/** Builds a descriptor for an enumeration, resolving its GType from the named `get_type` function. */\nconst enumT = (sharedLibrary: string, typeFnName: string, isSigned: boolean): EnumDescriptor => ({\n kind: \"enum\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n});\n\n/** Builds a descriptor for a flags type, resolving its GType from the named `get_type` function. */\nconst flagsT = (sharedLibrary: string, typeFnName: string, isSigned: boolean): FlagsDescriptor => ({\n kind: \"flags\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n});\n\nconst applyBoxedNames = (result: BoxedDescriptor, options: BoxedOptions): void => {\n if (options.sharedLibrary !== undefined) {\n result.sharedLibrary = options.sharedLibrary;\n }\n\n if (options.getTypeFnName !== undefined) {\n result.getTypeFnName = options.getTypeFnName;\n }\n\n if (options.freeFnName !== undefined) {\n result.freeFnName = options.freeFnName;\n }\n};\n\nconst applyBoxedOptions = (result: BoxedDescriptor, options: BoxedOptions): void => {\n applyBoxedNames(result, options);\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n};\n\n/** Builds a descriptor for a `GBoxed` value of the named type. */\nconst boxedT = (typeName: string, options: BoxedOptions = {}): BoxedDescriptor => {\n const result: BoxedDescriptor = {\n kind: \"boxed\",\n ownership: options.ownership ?? \"borrowed\",\n typeName,\n };\n\n applyBoxedOptions(result, options);\n\n return result;\n};\n\n/** Builds a descriptor for a plain C struct. */\nconst structT = (ownership: Ownership = \"borrowed\", options: StructOptions = {}): StructDescriptor => {\n const result: StructDescriptor = { kind: \"struct\", ownership };\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\nconst recordFundamentalLifecycle = (typeName: string, lifecycle: FundamentalLifecycle): void => {\n if (!fundamentalLifecycles.has(typeName)) {\n fundamentalLifecycles.set(typeName, lifecycle);\n }\n};\n\nconst fundamentalLifecycleFor = (typeName: string): FundamentalLifecycle | undefined =>\n fundamentalLifecycles.get(typeName);\n\n/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\nconst fundamentalT = (\n sharedLibrary: string,\n refFnName: string,\n unrefFnName: string,\n options: FundamentalOptions = {},\n): FundamentalDescriptor => {\n const ownership = options.ownership ?? \"borrowed\";\n const result: FundamentalDescriptor = { kind: \"fundamental\", ownership, sharedLibrary, refFnName, unrefFnName };\n\n if (options.typeName !== undefined) {\n result.typeName = options.typeName;\n recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\n/** Builds a descriptor for an array of items in one of the supported container layouts. */\nconst arrayT = (\n itemDescriptor: Descriptor,\n arrayKind: ArrayKind = \"array\",\n ownership: Ownership = \"borrowed\",\n options?: ArrayOptions,\n): ArrayDescriptor => {\n const result: ArrayDescriptor = { kind: \"array\", itemDescriptor, arrayKind, ownership };\n\n if (options?.elementSize !== undefined) {\n result.elementSize = options.elementSize;\n }\n\n if (options?.baseParamIndex !== undefined) {\n result.baseParamIndex = options.baseParamIndex;\n }\n\n if (options?.sizeParamIndex !== undefined) {\n result.sizeParamIndex = options.sizeParamIndex;\n }\n\n if (options?.fixedSize !== undefined) {\n result.fixedSize = options.fixedSize;\n }\n\n if (options?.isBytes === true) {\n result.isBytes = true;\n }\n\n return result;\n};\n\n/** Builds a descriptor for a `GList` of items. */\nconst listT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"glist\", ownership, options);\n\n/** Builds a descriptor for a `GSList` of items. */\nconst slistT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gslist\", ownership, options);\n\n/** Builds a descriptor for a `GPtrArray` of items. */\nconst ptrArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gptrarray\", ownership, options);\n\n/** Builds a descriptor for a `GArray` of items. */\nconst gArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"garray\", ownership, options);\n\n/** Builds a descriptor for a `GByteArray`. */\nconst byteArrayT = (ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(uint8T, \"gbytearray\", ownership, { isBytes: true });\n\n/** Builds a descriptor for a C array whose length is carried by another argument. */\nconst sizedArrayT = (\n itemDescriptor: Descriptor,\n sizeParamIndex: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"sized\", ownership, { ...options, sizeParamIndex });\n\n/**\n * Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the\n * elements from where it points to the end of that buffer.\n */\nconst cursorArrayT = (\n itemDescriptor: Descriptor,\n bounds: CursorBounds,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"cursor\", ownership, { ...options, ...bounds });\n\n/** Builds a descriptor for a C array of a fixed length. */\nconst fixedArrayT = (\n itemDescriptor: Descriptor,\n fixedSize: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"fixed\", ownership, { ...options, fixedSize });\n\nconst applyClosureOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n if (options.hasDestroy !== undefined) {\n result.hasDestroy = options.hasDestroy;\n }\n\n if (options.destroyKind !== undefined) {\n result.destroyKind = options.destroyKind;\n }\n\n if (options.hasUserData !== undefined) {\n result.hasUserData = options.hasUserData;\n }\n\n if (options.userDataIndex !== undefined) {\n result.userDataIndex = options.userDataIndex;\n }\n\n if (options.scope !== undefined) {\n result.scope = options.scope;\n }\n};\n\n/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */\nconst callbackT = (\n argDescriptors: Descriptor[],\n returnDescriptor: Descriptor,\n options?: CallbackOptions,\n): CallbackDescriptor => {\n const result: CallbackDescriptor = { kind: \"callback\", argDescriptors, returnDescriptor };\n\n if (options === undefined) {\n return result;\n }\n\n applyClosureOptions(result, options);\n\n return result;\n};\n\nexport {\n int8T,\n uint8T,\n int16T,\n uint16T,\n int32T,\n uint32T,\n int64T,\n uint64T,\n bigint64T,\n biguint64T,\n gtypeT,\n float32T,\n float64T,\n booleanT,\n voidT,\n unicharT,\n bufferT,\n stringT,\n objectT,\n refT,\n hashTableT,\n enumT,\n flagsT,\n boxedT,\n structT,\n fundamentalLifecycleFor,\n fundamentalT,\n arrayT,\n listT,\n slistT,\n ptrArrayT,\n gArrayT,\n byteArrayT,\n sizedArrayT,\n fixedArrayT,\n cursorArrayT,\n callbackT,\n type BoxedDescriptor,\n type StructDescriptor,\n type FundamentalDescriptor,\n type ArrayDescriptor,\n type HashTableDescriptor,\n type CallbackDescriptor,\n type RefDescriptor,\n};\n"]}
|
package/dist/register-class.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ type Dashed<TName extends string> = TName extends `${infer THead}_${infer TTail}
|
|
|
26
26
|
type Camelized<TName extends string> = TName extends `${infer THead}-${infer TTail}` ? `${THead}${Capitalize<Camelized<TTail>>}` : TName;
|
|
27
27
|
/**
|
|
28
28
|
* The names a registered class carries in its property map: every key of
|
|
29
|
-
* `RegisterClassOptions.properties` in camelCase, whichever
|
|
29
|
+
* `RegisterClassOptions.properties` in camelCase, whichever spelling it was written in.
|
|
30
30
|
* A `properties` object given a type of its own rather than left to inference has `string` for its key
|
|
31
31
|
* type and names nothing, because a name only known as `string` addresses no member in particular.
|
|
32
32
|
*/
|
|
@@ -83,7 +83,7 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
83
83
|
* A write the ParamSpec would refuse throws rather than reaching GObject, which reports such a
|
|
84
84
|
* write as a GLib critical and drops it: a `TypeError` for a read-only or construct-only
|
|
85
85
|
* property and for a value of a type the property cannot hold, and a `RangeError` for a value
|
|
86
|
-
* the ParamSpec rejects. The same
|
|
86
|
+
* the ParamSpec rejects. The same checks run over a value handed to the constructor, where
|
|
87
87
|
* a construct-only property is the one that is writable. An accepted write emits one `notify`,
|
|
88
88
|
* which a `freeze_notify` batch collects; a write of the value the property already holds is
|
|
89
89
|
* dropped and emits none.
|
|
@@ -119,7 +119,7 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
119
119
|
* write of `null` to that member both land 0, where a `gint` installed here refuses both.
|
|
120
120
|
*
|
|
121
121
|
* A class that defines the camelCase member itself owns the property: its own accessor decides
|
|
122
|
-
* what a write means, the other
|
|
122
|
+
* what a write means, the other spellings forward to it, and the type's property slots read
|
|
123
123
|
* and write it rather than the generated storage.
|
|
124
124
|
*/
|
|
125
125
|
properties?: TProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-class.js","sourceRoot":"","sources":["../src/register-class.ts"],"names":[],"mappings":"AACA,OAAO,EACH,aAAa,IAAI,mBAAmB,GAIvC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAiB,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAGf,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAEpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AA4KpF,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1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I,CAAC,aAAa,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAA+B,EAAE,CAAC;IAE/C,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,cAAc,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO,CAAC,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,OAAO,EAAkB,aAAa,EAAE,CAAC","sourcesContent":["import type { Descriptor } from \"@gtkx/native\";\nimport {\n registerClass as nativeRegisterClass,\n type RegisterClassInterface as NativeRegisterClassInterface,\n type RegisterClassOptions as NativeRegisterClassOptions,\n type RegisterClassVfunc as NativeRegisterClassVfunc,\n} from \"@gtkx/native\";\nimport { type AnyClass, getParentClass, walkClassChain } from \"@gtkx/utils\";\nimport { wrapCallback } from \"./callback.js\";\nimport { insertMixinLayer } from \"./mixin.js\";\nimport {\n buildPropertyDispatch,\n GET_PROPERTY_VFUNC,\n makeGetProperty,\n makeSetProperty,\n type PropertyDispatch,\n type PropertySpec,\n SET_PROPERTY_VFUNC,\n toNativeProperties,\n} from \"./properties.js\";\nimport {\n getClassType,\n getInterfaceMixin,\n markDerivedClass,\n registerClassType,\n type VfuncDescriptor,\n} from \"./registry.js\";\nimport { TYPE_INTERFACE, TYPE_INVALID, typeFundamental, typeInterfaces, typeIsA } from \"./type.js\";\nimport { findClassVfuncDescriptor, findInterfaceVfuncDescriptor } from \"./vfunc.js\";\n\n/**\n * A generated interface value, such as `Gio.ListModel`, in the form {@link registerClass} takes it.\n * `__impl__` exists only in the type system: it carries the interface's `Impl` type, of which a class\n * has to match every member it declares itself, which rejects a class value and a member whose\n * signature does not fit the slot it fills. Leaving a slot to the interface is not rejected,\n * because `registerClass` does not reject it either: every member of an `Impl` type is optional,\n * and the `Partial` holds that open whatever the type declares. The `object` beside it keeps\n * TypeScript from also demanding one member in common. An interface that introspection describes\n * no vtable for carries `unknown`, since it has no slot a class could fill.\n */\ntype Interface<TImpl> = AnyClass & {\n /** Type-level slot holding the interface's `Impl` type; no value ever carries it. */\n __impl__: (impl: Partial<TImpl> & object) => void;\n};\n\n/**\n * One key of `RegisterClassOptions.properties` with every underscore turned into the dash a canonical\n * GObject property name separates its words with.\n */\ntype Dashed<TName extends string> = TName extends `${infer THead}_${infer TTail}`\n ? Dashed<`${THead}-${TTail}`>\n : TName;\n\n/**\n * One dashed key in the camelCase spelling the accessors {@link registerClass} installs carry, which is\n * the spelling the hooks that address a property by name take.\n */\ntype Camelized<TName extends string> = TName extends `${infer THead}-${infer TTail}`\n ? `${THead}${Capitalize<Camelized<TTail>>}`\n : TName;\n\n/**\n * The names a registered class carries in its property map: every key of\n * `RegisterClassOptions.properties` in camelCase, whichever of the three spellings it was written in.\n * A `properties` object given a type of its own rather than left to inference has `string` for its key\n * type and names nothing, because a name only known as `string` addresses no member in particular.\n */\ntype InstalledNames<TProperties> = string extends keyof TProperties\n ? never\n : Camelized<Dashed<keyof TProperties & string>>;\n\n/**\n * An instance of a registered class: everything the class itself declares, plus the property map the\n * hooks that address a property by name, such as `useProperty` from `@gtkx/react`, read the installed\n * names off. Each name is typed with the value type the class declares for the member of that name,\n * so a property the class does not `declare` contributes nothing.\n */\ntype RegisteredInstance<TInstance, TProperties> = TInstance & {\n /** Type-level map from installed property name to value type; no value ever carries it. */\n __properties__: Pick<TInstance, InstalledNames<TProperties> & keyof TInstance>;\n};\n\n/**\n * The construct signature and prototype a registered class carries, both giving\n * {@link RegisteredInstance}. The signature stays abstract for as long as the class itself is, so\n * registering an abstract base leaves it as impossible to construct as it was.\n */\ntype RegisteredConstructor<TClass, TArgs extends unknown[], TInstance> = {\n /** Object the class's instances inherit from. */\n prototype: TInstance;\n} & (TClass extends new (...args: never) => unknown\n ? new (...args: TArgs) => TInstance\n : abstract new (...args: TArgs) => TInstance);\n\n/**\n * The class {@link registerClass} hands back: the same class, with the same statics, whose instances\n * carry the properties `RegisterClassOptions.properties` installed. Binding the call to a name, rather\n * than discarding it, is what carries those names into the type system.\n */\ntype RegisteredClass<TClass extends AnyClass, TProperties> =\n TClass extends abstract new (...args: infer TArgs) => infer TInstance\n ? Omit<TClass, \"prototype\"> & RegisteredConstructor<TClass, TArgs, RegisteredInstance<TInstance, TProperties>>\n : never;\n\n/** What {@link registerClass} adds to the new GType beyond the vtable slots it discovers on the class. */\ntype RegisterClassOptions<TInstance extends object, TProperties extends Record<string, PropertySpec>> = {\n /** Name to register the new GType under, defaulting to the class's own name. */\n typeName?: string;\n /**\n * Interfaces the new type implements on top of the ones it inherits, given as the interface values\n * themselves, such as `Gio.ListModel`. Their vtable slots are filled from the `vfunc`-prefixed methods on\n * the class's prototype chain, each of which has to match the interface's `Impl` type, such as\n * `Gio.ListModelImpl`.\n */\n implements?: Interface<TInstance>[];\n /**\n * Properties to install on the new type, keyed by the name JavaScript addresses each one by and\n * valued with the `GObject.ParamSpec` describing it. A key is read in camelCase however it is\n * written, so `dewPoint`, `dew_point` and `dew-point` all name the same member, and the ParamSpec\n * has to carry the canonical spelling of that name, `dew-point`, or registration throws: the\n * ParamSpec's name is the one GObject emits `notify` with, and a name the key does not spell\n * reaches nothing that listens for it. Every property gains prototype accessors, one for the key\n * as written, one for it with dashes turned into underscores and one for it in camelCase, each\n * unless the class already defines that name. They serve the value from storage of their own on\n * the instance, which is also what the type's `get_property` and `set_property` slots read and\n * write, so a value set from JavaScript, from `g_object_set_property` and at construction all\n * land in the same place.\n *\n * A write the ParamSpec would refuse throws rather than reaching GObject, which reports such a\n * write as a GLib critical and drops it: a `TypeError` for a read-only or construct-only\n * property and for a value of a type the property cannot hold, and a `RangeError` for a value\n * the ParamSpec rejects. The same two checks run over a value handed to the constructor, where\n * a construct-only property is the one that is writable. An accepted write emits one `notify`,\n * which a `freeze_notify` batch collects; a write of the value the property already holds is\n * dropped and emits none.\n *\n * `null` and `undefined` both mean NULL, and mean it only where the ParamSpec's own type holds\n * NULL, which is a string, string-array, boxed, object, interface, param, variant or pointer\n * property. Such a property holds the `null` either spelling wrote, so the member, the type's\n * `get_property` slot and `g_object_get_property` serve the same thing, and writing the other\n * spelling over it emits no `notify`. Every other property, so every integer, floating-point,\n * boolean, enum, flags and GType one, refuses both with the same `TypeError` it refuses a\n * string with, and keeps the value it already holds. It refuses them for what it holds rather\n * than for its range, whatever that range is: the type is checked before the range, so a\n * `gint` whose range excludes 0 answers a nullish with that same `TypeError` and never with\n * the `RangeError` that names the value GObject would put in its place. The one place\n * `undefined` means something else is the constructor, which reads it as the property not\n * being given at all and leaves it at the ParamSpec's default, so a property is never handed a\n * value it cannot serve back.\n *\n * A floating-point property takes every JavaScript number, `NaN` and both infinities\n * included, and its ParamSpec alone rules on which of them the range admits: a `gdouble`\n * bounded by `-Infinity` and `Infinity` holds either infinity, and a magnitude a bounded\n * one excludes, like any `NaN`, comes back as the `RangeError` that names what GObject\n * would put in its place rather than as the `TypeError` a type the property cannot hold\n * earns. A `gfloat` property holds what GObject narrows the double to, so it serves `0.1`\n * back as `0.10000000149011612` and a finite magnitude no `gfloat` reaches as an infinity,\n * which the range then rules on in turn. That narrowing belongs to the property alone: the\n * same magnitude written to a `gfloat` through a generated binding, a signal argument or a\n * closure return is refused outright rather than narrowed.\n *\n * A generated property of a wrapped type answers a nullish differently, and the two halves of\n * the API disagree here: that property marshals what it is written through its descriptor\n * rather than through the checks above, so `new Gtk.Label({ widthRequest: null })` and a later\n * write of `null` to that member both land 0, where a `gint` installed here refuses both.\n *\n * A class that defines the camelCase member itself owns the property: its own accessor decides\n * what a write means, the other two spellings forward to it, and the type's property slots read\n * and write it rather than the generated storage.\n */\n properties?: TProperties;\n};\n\n/** {@link RegisterClassOptions} with the widest instance and property types {@link registerClass} accepts. */\ntype AnyRegisterClassOptions = RegisterClassOptions<object, Record<string, PropertySpec>>;\ntype VfuncFn = NativeRegisterClassVfunc[\"fn\"];\ntype DiscoveredVfunc = VfuncDescriptor & { methodName: string; fn: VfuncFn };\ntype MethodTable = Map<string, VfuncFn>;\ntype InstanceMembers = { methods: MethodTable; names: Set<string>; inheritedNames: Set<string> };\n\ntype InterfaceVfuncBinding = {\n gtype: bigint;\n vfuncs: DiscoveredVfunc[];\n};\n\ntype PropertyVfuncSource = {\n klass: AnyClass;\n methods: MethodTable;\n dispatch: PropertyDispatch;\n adoptedTypes: bigint[];\n};\n\ntype PropertyVfuncSpec = {\n methodName: string;\n isValueOut: boolean;\n makeDispatch: (dispatch: PropertyDispatch) => VfuncFn;\n};\n\ntype ArgPatch = { isCallerAllocated: true } | { isCallScoped: true };\n\nconst INSTANCE_ARG_INDEX = 0;\nconst VALUE_ARG_INDEX = 2;\nconst TEARDOWN_VFUNC_NAMES: Set<string> = new Set([\"dispose\", \"finalize\"]);\n\nconst PROPERTY_VFUNC_SPECS: PropertyVfuncSpec[] = [\n { methodName: GET_PROPERTY_VFUNC, isValueOut: true, makeDispatch: makeGetProperty },\n { methodName: SET_PROPERTY_VFUNC, isValueOut: false, makeDispatch: makeSetProperty },\n];\n\nconst PROPERTY_VFUNC_NAMES: Set<string> = new Set(PROPERTY_VFUNC_SPECS.map((spec) => spec.methodName));\n\n/**\n * Registers a subclass of a wrapper class as a new GType, wiring up any class and interface\n * virtual functions it overrides, both for the interfaces it inherits and for the ones\n * `RegisterClassOptions.implements` names.\n *\n * Throws when the class does not extend a registered wrapper class, when it has no derivable type\n * name, when an entry in `RegisterClassOptions.implements` is not a registered interface, when a\n * listed interface has a prerequisite that neither the parent type nor another listed interface meets,\n * and when an entry in `RegisterClassOptions.properties` names its `GObject.ParamSpec` something other\n * than the canonical spelling of the key it sits under.\n *\n * A slot is filled from the `vfunc`-prefixed methods on the class's prototype chain, up to but not\n * including the registered ancestor the class extends, so a method an intermediate base class\n * declares fills a slot the same way one the class itself declares does. A slot nothing on that\n * chain fills is left untouched.\n *\n * Declare every slot as a method: a class field holding a function, such as `vfuncGetNItems = () => 1`,\n * is assigned to each instance after registration and never reaches the vtable.\n *\n * An override of `vfuncConstructed` runs from inside the base constructor, before JavaScript\n * installs the subclass's field initializers and runs its constructor body, so a field still\n * reads `undefined` there and reading a `#private` field throws. Declare state the override\n * touches without an initializer, and assign private state from the constructor body after\n * `super()`. An instance a native caller creates, through `GObject.newv` or `Gtk.Builder`,\n * never runs the subclass constructor at all, so its declared fields stay uninitialized for\n * the object's whole life.\n *\n * @param klass The subclass to register.\n * @param options What the new GType gains beyond the vtable slots the class overrides.\n * @returns The same class, now registered, with every name in `options.properties` in its property map.\n */\nfunction registerClass<\n T extends AnyClass,\n TProperties extends Record<string, PropertySpec> = Record<never, PropertySpec>,\n>(klass: T, options?: RegisterClassOptions<T[\"prototype\"], TProperties>): RegisteredClass<T, TProperties>;\n\nfunction registerClass(klass: AnyClass, options: AnyRegisterClassOptions = {}): AnyClass {\n const parentType = resolveParentType(klass);\n\n if (parentType === TYPE_INVALID) {\n throw new TypeError(`registerClass: ${klass.name} must extend a registered wrapper class`);\n }\n\n const name = options.typeName ?? klass.name;\n\n if (!name) {\n throw new Error(\"registerClass: cannot derive a GType name (anonymous class with no typeName option)\");\n }\n\n const declaredTypes = resolveInterfaceTypes(klass, options.implements ?? []);\n const adoptedTypes = declaredTypes.filter((gtype) => !typeIsA(parentType, gtype));\n const properties = options.properties ?? {};\n const { methods, inheritedNames } = collectInstanceMembers(klass);\n const dispatch = buildPropertyDispatch({ klass, properties, adoptedTypes });\n\n const classVfuncs = [\n ...discoverClassVfuncs(klass, methods),\n ...propertyVfuncs({ klass, methods, dispatch, adoptedTypes }),\n ];\n\n const claimedMethodNames = new Set(classVfuncs.map((vfunc) => vfunc.methodName));\n const interfaceBindings = discoverInterfaceBindings(methods, parentType, declaredTypes, claimedMethodNames);\n const nativeOptions = toNativeOptions(classVfuncs, interfaceBindings, properties);\n const newType: bigint = nativeRegisterClass(name, parentType, nativeOptions);\n registerClassType(klass, newType);\n markDerivedClass(klass);\n applyInterfaceMixins(klass, adoptedTypes, inheritedNames);\n\n return klass;\n}\n\nfunction resolveInterfaceType(klass: AnyClass, entry: AnyClass): bigint {\n const gtype = getClassType(entry);\n\n if (typeFundamental(gtype) !== TYPE_INTERFACE) {\n const label = typeof entry === \"function\" ? entry.name : String(entry);\n\n throw new TypeError(\n `registerClass: ${klass.name} lists '${label}' in implements, which is not a registered interface`,\n );\n }\n\n return gtype;\n}\n\nfunction resolveInterfaceTypes(klass: AnyClass, entries: AnyClass[]): bigint[] {\n return [...new Set(entries.map((entry) => resolveInterfaceType(klass, entry)))];\n}\n\nfunction applyInterfaceMixins(klass: AnyClass, adoptedTypes: bigint[], inheritedNames: Set<string>): void {\n for (const gtype of adoptedTypes) {\n const mixin = getInterfaceMixin(gtype);\n\n if (mixin !== undefined) {\n insertMixinLayer(klass, mixin, inheritedNames);\n }\n }\n}\n\nfunction resolveParentType(klass: AnyClass): bigint {\n return (\n walkClassChain(getParentClass(klass), (cls) => {\n const gtype = getClassType(cls);\n\n return gtype === TYPE_INVALID ? undefined : gtype;\n }) ?? TYPE_INVALID\n );\n}\n\nfunction addOwnMember(members: InstanceMembers, proto: object, name: string, isInherited: boolean): void {\n if (name === \"constructor\") {\n return;\n }\n\n if (isInherited) {\n members.inheritedNames.add(name);\n }\n\n if (members.names.has(name)) {\n return;\n }\n\n members.names.add(name);\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\n if (typeof descriptor?.value === \"function\") {\n members.methods.set(name, descriptor.value as VfuncFn);\n }\n}\n\nfunction addOwnMembers(members: InstanceMembers, klass: AnyClass, isInherited: boolean): void {\n const proto = (klass as { prototype?: object }).prototype;\n\n if (proto === undefined) {\n return;\n }\n\n for (const name of Object.getOwnPropertyNames(proto)) {\n addOwnMember(members, proto, name, isInherited);\n }\n}\n\nfunction collectInstanceMembers(klass: AnyClass): InstanceMembers {\n const members: InstanceMembers = { methods: new Map(), names: new Set(), inheritedNames: new Set() };\n let cls: AnyClass | null = klass;\n\n while (cls !== null && getClassType(cls) === TYPE_INVALID) {\n addOwnMembers(members, cls, cls !== klass);\n cls = getParentClass(cls);\n }\n\n return members;\n}\n\nfunction buildDiscoveredVfunc(\n fn: VfuncFn,\n methodName: string,\n resolveDescriptor: (methodName: string) => VfuncDescriptor | undefined,\n skip: Set<string> | undefined,\n): DiscoveredVfunc | undefined {\n if (skip?.has(methodName)) {\n return undefined;\n }\n\n const descriptor = resolveDescriptor(methodName);\n\n if (!descriptor) {\n return undefined;\n }\n\n const argDescriptors = slotArgDescriptors(descriptor);\n\n return {\n ...descriptor,\n methodName,\n argDescriptors,\n fn: wrapVfunc(fn, argDescriptors, descriptor),\n };\n}\n\nfunction collectDiscoveredVfuncs(\n methods: MethodTable,\n resolveDescriptor: (methodName: string) => VfuncDescriptor | undefined,\n skip?: Set<string>,\n): DiscoveredVfunc[] {\n const result: DiscoveredVfunc[] = [];\n\n for (const [methodName, fn] of methods) {\n const discovered = buildDiscoveredVfunc(fn, methodName, resolveDescriptor, skip);\n\n if (discovered) {\n result.push(discovered);\n }\n }\n\n return result;\n}\n\nfunction discoverClassVfuncs(klass: AnyClass, methods: MethodTable): DiscoveredVfunc[] {\n return collectDiscoveredVfuncs(\n methods,\n (methodName) => findClassVfuncDescriptor(klass, methodName) ?? undefined,\n PROPERTY_VFUNC_NAMES,\n );\n}\n\nfunction wrapVfunc(\n fn: VfuncFn,\n argDescriptors: NativeRegisterClassVfunc[\"argDescriptors\"],\n descriptor: VfuncDescriptor,\n): VfuncFn {\n return wrapCallback(\n fn as (...args: unknown[]) => unknown,\n { argDescriptors, returnDescriptor: descriptor.returnDescriptor },\n \"vfunc\",\n );\n}\n\nfunction discoverInterfaceBindings(\n methods: MethodTable,\n parentGtype: bigint,\n declaredTypes: bigint[],\n claimedMethodNames: Set<string>,\n): InterfaceVfuncBinding[] {\n const declared: Set<bigint> = new Set(declaredTypes);\n const gtypes: Set<bigint> = new Set([...typeInterfaces(parentGtype), ...declaredTypes]);\n const bindings: InterfaceVfuncBinding[] = [];\n\n for (const gtype of gtypes) {\n const vfuncs = discoverInterfaceVfuncs(methods, gtype, claimedMethodNames);\n\n if (vfuncs.length > 0 || declared.has(gtype)) {\n bindings.push({ gtype, vfuncs });\n }\n }\n\n return bindings;\n}\n\nfunction discoverInterfaceVfuncs(\n methods: MethodTable,\n interfaceGtype: bigint,\n claimedMethodNames: Set<string>,\n): DiscoveredVfunc[] {\n return collectDiscoveredVfuncs(\n methods,\n (methodName) => findInterfaceVfuncDescriptor(interfaceGtype, methodName),\n claimedMethodNames,\n );\n}\n\nconst hasDispatchedProperties = (dispatch: PropertyDispatch, adoptedTypes: bigint[]): boolean =>\n dispatch.accessors.length > 0 || adoptedTypes.length > 0;\n\nfunction propertyVfuncFor(\n source: PropertyVfuncSource,\n spec: PropertyVfuncSpec,\n): DiscoveredVfunc | undefined {\n const { klass, methods, dispatch, adoptedTypes } = source;\n\n const dispatched = hasDispatchedProperties(dispatch, adoptedTypes)\n ? spec.makeDispatch(dispatch)\n : undefined;\n\n const fn = methods.get(spec.methodName) ?? dispatched;\n\n return fn === undefined ? undefined : buildPropertyVfunc(klass, spec.methodName, fn, spec.isValueOut);\n}\n\nfunction propertyVfuncs(source: PropertyVfuncSource): DiscoveredVfunc[] {\n return PROPERTY_VFUNC_SPECS.map((spec) => propertyVfuncFor(source, spec)).filter(\n (vfunc) => vfunc !== undefined,\n );\n}\n\nfunction markArg(argDescriptors: Descriptor[], index: number, patch: ArgPatch): Descriptor[] {\n return argDescriptors.map((arg, at) => (at === index ? { ...arg, ...patch } : arg));\n}\n\nfunction isTeardownSlot(descriptor: VfuncDescriptor): boolean {\n return (\n TEARDOWN_VFUNC_NAMES.has(descriptor.vfuncName) &&\n descriptor.argDescriptors[INSTANCE_ARG_INDEX]?.kind === \"object\"\n );\n}\n\nfunction slotArgDescriptors(descriptor: VfuncDescriptor): Descriptor[] {\n if (!isTeardownSlot(descriptor)) {\n return descriptor.argDescriptors;\n }\n\n return markArg(descriptor.argDescriptors, INSTANCE_ARG_INDEX, { isCallScoped: true });\n}\n\nfunction buildPropertyVfunc(\n klass: AnyClass,\n methodName: string,\n fn: VfuncFn,\n isValueOut: boolean,\n): DiscoveredVfunc {\n const descriptor = findClassVfuncDescriptor(klass, methodName);\n\n if (!descriptor) {\n throw new Error(`registerClass: the parent class exposes no '${methodName}' vtable slot`);\n }\n\n const argDescriptors = isValueOut\n ? markArg(descriptor.argDescriptors, VALUE_ARG_INDEX, { isCallerAllocated: true })\n : descriptor.argDescriptors;\n\n return {\n ...descriptor,\n methodName,\n argDescriptors,\n fn: wrapVfunc(fn, argDescriptors, descriptor),\n };\n}\n\nfunction toNativeInterface(binding: InterfaceVfuncBinding): NativeRegisterClassInterface {\n const nativeInterface: NativeRegisterClassInterface = {\n type: binding.gtype,\n vfuncs: [...binding.vfuncs],\n };\n\n const vtableSize = binding.vfuncs[0]?.vtableSize;\n\n if (vtableSize !== undefined) {\n nativeInterface.vtableSize = vtableSize;\n }\n\n return nativeInterface;\n}\n\nfunction toNativeOptions(\n classVfuncs: DiscoveredVfunc[],\n interfaceBindings: InterfaceVfuncBinding[],\n properties: Record<string, PropertySpec>,\n): NativeRegisterClassOptions | undefined {\n const hasInterfaces = interfaceBindings.length > 0;\n const hasClassVfuncs = classVfuncs.length > 0;\n const hasProperties = Object.keys(properties).length > 0;\n\n if (!hasClassVfuncs && !hasInterfaces && !hasProperties) {\n return undefined;\n }\n\n const options: NativeRegisterClassOptions = {};\n\n if (hasProperties) {\n options.properties = toNativeProperties(properties);\n }\n\n if (hasClassVfuncs) {\n options.vfuncs = [...classVfuncs];\n }\n\n if (hasInterfaces) {\n options.interfaces = interfaceBindings.map((binding) => toNativeInterface(binding));\n }\n\n return options;\n}\n\nexport { type Interface, registerClass };\n"]}
|
|
1
|
+
{"version":3,"file":"register-class.js","sourceRoot":"","sources":["../src/register-class.ts"],"names":[],"mappings":"AACA,OAAO,EACH,aAAa,IAAI,mBAAmB,GAIvC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAiB,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAGf,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAEpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AA4KpF,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAE3E,MAAM,oBAAoB,GAAwB;IAC9C,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE;IACnF,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE;CACvF,CAAC;AAEF,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;AAsCvG,SAAS,aAAa,C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IACxF,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,OAAO,EAAkB,aAAa,EAAE,CAAC","sourcesContent":["import type { Descriptor } from \"@gtkx/native\";\nimport {\n registerClass as nativeRegisterClass,\n type RegisterClassInterface as NativeRegisterClassInterface,\n type RegisterClassOptions as NativeRegisterClassOptions,\n type RegisterClassVfunc as NativeRegisterClassVfunc,\n} from \"@gtkx/native\";\nimport { type AnyClass, getParentClass, walkClassChain } from \"@gtkx/utils\";\nimport { wrapCallback } from \"./callback.js\";\nimport { insertMixinLayer } from \"./mixin.js\";\nimport {\n buildPropertyDispatch,\n GET_PROPERTY_VFUNC,\n makeGetProperty,\n makeSetProperty,\n type PropertyDispatch,\n type PropertySpec,\n SET_PROPERTY_VFUNC,\n toNativeProperties,\n} from \"./properties.js\";\nimport {\n getClassType,\n getInterfaceMixin,\n markDerivedClass,\n registerClassType,\n type VfuncDescriptor,\n} from \"./registry.js\";\nimport { TYPE_INTERFACE, TYPE_INVALID, typeFundamental, typeInterfaces, typeIsA } from \"./type.js\";\nimport { findClassVfuncDescriptor, findInterfaceVfuncDescriptor } from \"./vfunc.js\";\n\n/**\n * A generated interface value, such as `Gio.ListModel`, in the form {@link registerClass} takes it.\n * `__impl__` exists only in the type system: it carries the interface's `Impl` type, of which a class\n * has to match every member it declares itself, which rejects a class value and a member whose\n * signature does not fit the slot it fills. Leaving a slot to the interface is not rejected,\n * because `registerClass` does not reject it either: every member of an `Impl` type is optional,\n * and the `Partial` holds that open whatever the type declares. The `object` beside it keeps\n * TypeScript from also demanding one member in common. An interface that introspection describes\n * no vtable for carries `unknown`, since it has no slot a class could fill.\n */\ntype Interface<TImpl> = AnyClass & {\n /** Type-level slot holding the interface's `Impl` type; no value ever carries it. */\n __impl__: (impl: Partial<TImpl> & object) => void;\n};\n\n/**\n * One key of `RegisterClassOptions.properties` with every underscore turned into the dash a canonical\n * GObject property name separates its words with.\n */\ntype Dashed<TName extends string> = TName extends `${infer THead}_${infer TTail}`\n ? Dashed<`${THead}-${TTail}`>\n : TName;\n\n/**\n * One dashed key in the camelCase spelling the accessors {@link registerClass} installs carry, which is\n * the spelling the hooks that address a property by name take.\n */\ntype Camelized<TName extends string> = TName extends `${infer THead}-${infer TTail}`\n ? `${THead}${Capitalize<Camelized<TTail>>}`\n : TName;\n\n/**\n * The names a registered class carries in its property map: every key of\n * `RegisterClassOptions.properties` in camelCase, whichever spelling it was written in.\n * A `properties` object given a type of its own rather than left to inference has `string` for its key\n * type and names nothing, because a name only known as `string` addresses no member in particular.\n */\ntype InstalledNames<TProperties> = string extends keyof TProperties\n ? never\n : Camelized<Dashed<keyof TProperties & string>>;\n\n/**\n * An instance of a registered class: everything the class itself declares, plus the property map the\n * hooks that address a property by name, such as `useProperty` from `@gtkx/react`, read the installed\n * names off. Each name is typed with the value type the class declares for the member of that name,\n * so a property the class does not `declare` contributes nothing.\n */\ntype RegisteredInstance<TInstance, TProperties> = TInstance & {\n /** Type-level map from installed property name to value type; no value ever carries it. */\n __properties__: Pick<TInstance, InstalledNames<TProperties> & keyof TInstance>;\n};\n\n/**\n * The construct signature and prototype a registered class carries, both giving\n * {@link RegisteredInstance}. The signature stays abstract for as long as the class itself is, so\n * registering an abstract base leaves it as impossible to construct as it was.\n */\ntype RegisteredConstructor<TClass, TArgs extends unknown[], TInstance> = {\n /** Object the class's instances inherit from. */\n prototype: TInstance;\n} & (TClass extends new (...args: never) => unknown\n ? new (...args: TArgs) => TInstance\n : abstract new (...args: TArgs) => TInstance);\n\n/**\n * The class {@link registerClass} hands back: the same class, with the same statics, whose instances\n * carry the properties `RegisterClassOptions.properties` installed. Binding the call to a name, rather\n * than discarding it, is what carries those names into the type system.\n */\ntype RegisteredClass<TClass extends AnyClass, TProperties> =\n TClass extends abstract new (...args: infer TArgs) => infer TInstance\n ? Omit<TClass, \"prototype\"> & RegisteredConstructor<TClass, TArgs, RegisteredInstance<TInstance, TProperties>>\n : never;\n\n/** What {@link registerClass} adds to the new GType beyond the vtable slots it discovers on the class. */\ntype RegisterClassOptions<TInstance extends object, TProperties extends Record<string, PropertySpec>> = {\n /** Name to register the new GType under, defaulting to the class's own name. */\n typeName?: string;\n /**\n * Interfaces the new type implements on top of the ones it inherits, given as the interface values\n * themselves, such as `Gio.ListModel`. Their vtable slots are filled from the `vfunc`-prefixed methods on\n * the class's prototype chain, each of which has to match the interface's `Impl` type, such as\n * `Gio.ListModelImpl`.\n */\n implements?: Interface<TInstance>[];\n /**\n * Properties to install on the new type, keyed by the name JavaScript addresses each one by and\n * valued with the `GObject.ParamSpec` describing it. A key is read in camelCase however it is\n * written, so `dewPoint`, `dew_point` and `dew-point` all name the same member, and the ParamSpec\n * has to carry the canonical spelling of that name, `dew-point`, or registration throws: the\n * ParamSpec's name is the one GObject emits `notify` with, and a name the key does not spell\n * reaches nothing that listens for it. Every property gains prototype accessors, one for the key\n * as written, one for it with dashes turned into underscores and one for it in camelCase, each\n * unless the class already defines that name. They serve the value from storage of their own on\n * the instance, which is also what the type's `get_property` and `set_property` slots read and\n * write, so a value set from JavaScript, from `g_object_set_property` and at construction all\n * land in the same place.\n *\n * A write the ParamSpec would refuse throws rather than reaching GObject, which reports such a\n * write as a GLib critical and drops it: a `TypeError` for a read-only or construct-only\n * property and for a value of a type the property cannot hold, and a `RangeError` for a value\n * the ParamSpec rejects. The same checks run over a value handed to the constructor, where\n * a construct-only property is the one that is writable. An accepted write emits one `notify`,\n * which a `freeze_notify` batch collects; a write of the value the property already holds is\n * dropped and emits none.\n *\n * `null` and `undefined` both mean NULL, and mean it only where the ParamSpec's own type holds\n * NULL, which is a string, string-array, boxed, object, interface, param, variant or pointer\n * property. Such a property holds the `null` either spelling wrote, so the member, the type's\n * `get_property` slot and `g_object_get_property` serve the same thing, and writing the other\n * spelling over it emits no `notify`. Every other property, so every integer, floating-point,\n * boolean, enum, flags and GType one, refuses both with the same `TypeError` it refuses a\n * string with, and keeps the value it already holds. It refuses them for what it holds rather\n * than for its range, whatever that range is: the type is checked before the range, so a\n * `gint` whose range excludes 0 answers a nullish with that same `TypeError` and never with\n * the `RangeError` that names the value GObject would put in its place. The one place\n * `undefined` means something else is the constructor, which reads it as the property not\n * being given at all and leaves it at the ParamSpec's default, so a property is never handed a\n * value it cannot serve back.\n *\n * A floating-point property takes every JavaScript number, `NaN` and both infinities\n * included, and its ParamSpec alone rules on which of them the range admits: a `gdouble`\n * bounded by `-Infinity` and `Infinity` holds either infinity, and a magnitude a bounded\n * one excludes, like any `NaN`, comes back as the `RangeError` that names what GObject\n * would put in its place rather than as the `TypeError` a type the property cannot hold\n * earns. A `gfloat` property holds what GObject narrows the double to, so it serves `0.1`\n * back as `0.10000000149011612` and a finite magnitude no `gfloat` reaches as an infinity,\n * which the range then rules on in turn. That narrowing belongs to the property alone: the\n * same magnitude written to a `gfloat` through a generated binding, a signal argument or a\n * closure return is refused outright rather than narrowed.\n *\n * A generated property of a wrapped type answers a nullish differently, and the two halves of\n * the API disagree here: that property marshals what it is written through its descriptor\n * rather than through the checks above, so `new Gtk.Label({ widthRequest: null })` and a later\n * write of `null` to that member both land 0, where a `gint` installed here refuses both.\n *\n * A class that defines the camelCase member itself owns the property: its own accessor decides\n * what a write means, the other spellings forward to it, and the type's property slots read\n * and write it rather than the generated storage.\n */\n properties?: TProperties;\n};\n\n/** {@link RegisterClassOptions} with the widest instance and property types {@link registerClass} accepts. */\ntype AnyRegisterClassOptions = RegisterClassOptions<object, Record<string, PropertySpec>>;\ntype VfuncFn = NativeRegisterClassVfunc[\"fn\"];\ntype DiscoveredVfunc = VfuncDescriptor & { methodName: string; fn: VfuncFn };\ntype MethodTable = Map<string, VfuncFn>;\ntype InstanceMembers = { methods: MethodTable; names: Set<string>; inheritedNames: Set<string> };\n\ntype InterfaceVfuncBinding = {\n gtype: bigint;\n vfuncs: DiscoveredVfunc[];\n};\n\ntype PropertyVfuncSource = {\n klass: AnyClass;\n methods: MethodTable;\n dispatch: PropertyDispatch;\n adoptedTypes: bigint[];\n};\n\ntype PropertyVfuncSpec = {\n methodName: string;\n isValueOut: boolean;\n makeDispatch: (dispatch: PropertyDispatch) => VfuncFn;\n};\n\ntype ArgPatch = { isCallerAllocated: true } | { isCallScoped: true };\n\nconst INSTANCE_ARG_INDEX = 0;\nconst VALUE_ARG_INDEX = 2;\nconst TEARDOWN_VFUNC_NAMES: Set<string> = new Set([\"dispose\", \"finalize\"]);\n\nconst PROPERTY_VFUNC_SPECS: PropertyVfuncSpec[] = [\n { methodName: GET_PROPERTY_VFUNC, isValueOut: true, makeDispatch: makeGetProperty },\n { methodName: SET_PROPERTY_VFUNC, isValueOut: false, makeDispatch: makeSetProperty },\n];\n\nconst PROPERTY_VFUNC_NAMES: Set<string> = new Set(PROPERTY_VFUNC_SPECS.map((spec) => spec.methodName));\n\n/**\n * Registers a subclass of a wrapper class as a new GType, wiring up any class and interface\n * virtual functions it overrides, both for the interfaces it inherits and for the ones\n * `RegisterClassOptions.implements` names.\n *\n * Throws when the class does not extend a registered wrapper class, when it has no derivable type\n * name, when an entry in `RegisterClassOptions.implements` is not a registered interface, when a\n * listed interface has a prerequisite that neither the parent type nor another listed interface meets,\n * and when an entry in `RegisterClassOptions.properties` names its `GObject.ParamSpec` something other\n * than the canonical spelling of the key it sits under.\n *\n * A slot is filled from the `vfunc`-prefixed methods on the class's prototype chain, up to but not\n * including the registered ancestor the class extends, so a method an intermediate base class\n * declares fills a slot the same way one the class itself declares does. A slot nothing on that\n * chain fills is left untouched.\n *\n * Declare every slot as a method: a class field holding a function, such as `vfuncGetNItems = () => 1`,\n * is assigned to each instance after registration and never reaches the vtable.\n *\n * An override of `vfuncConstructed` runs from inside the base constructor, before JavaScript\n * installs the subclass's field initializers and runs its constructor body, so a field still\n * reads `undefined` there and reading a `#private` field throws. Declare state the override\n * touches without an initializer, and assign private state from the constructor body after\n * `super()`. An instance a native caller creates, through `GObject.newv` or `Gtk.Builder`,\n * never runs the subclass constructor at all, so its declared fields stay uninitialized for\n * the object's whole life.\n *\n * @param klass The subclass to register.\n * @param options What the new GType gains beyond the vtable slots the class overrides.\n * @returns The same class, now registered, with every name in `options.properties` in its property map.\n */\nfunction registerClass<\n T extends AnyClass,\n TProperties extends Record<string, PropertySpec> = Record<never, PropertySpec>,\n>(klass: T, options?: RegisterClassOptions<T[\"prototype\"], TProperties>): RegisteredClass<T, TProperties>;\n\nfunction registerClass(klass: AnyClass, options: AnyRegisterClassOptions = {}): AnyClass {\n const parentType = resolveParentType(klass);\n\n if (parentType === TYPE_INVALID) {\n throw new TypeError(`registerClass: ${klass.name} must extend a registered wrapper class`);\n }\n\n const name = options.typeName ?? klass.name;\n\n if (!name) {\n throw new Error(\"registerClass: cannot derive a GType name (anonymous class with no typeName option)\");\n }\n\n const declaredTypes = resolveInterfaceTypes(klass, options.implements ?? []);\n const adoptedTypes = declaredTypes.filter((gtype) => !typeIsA(parentType, gtype));\n const properties = options.properties ?? {};\n const { methods, inheritedNames } = collectInstanceMembers(klass);\n const dispatch = buildPropertyDispatch({ klass, properties, adoptedTypes });\n\n const classVfuncs = [\n ...discoverClassVfuncs(klass, methods),\n ...propertyVfuncs({ klass, methods, dispatch, adoptedTypes }),\n ];\n\n const claimedMethodNames = new Set(classVfuncs.map((vfunc) => vfunc.methodName));\n const interfaceBindings = discoverInterfaceBindings(methods, parentType, declaredTypes, claimedMethodNames);\n const nativeOptions = toNativeOptions(classVfuncs, interfaceBindings, properties);\n const newType: bigint = nativeRegisterClass(name, parentType, nativeOptions);\n registerClassType(klass, newType);\n markDerivedClass(klass);\n applyInterfaceMixins(klass, adoptedTypes, inheritedNames);\n\n return klass;\n}\n\nfunction resolveInterfaceType(klass: AnyClass, entry: AnyClass): bigint {\n const gtype = getClassType(entry);\n\n if (typeFundamental(gtype) !== TYPE_INTERFACE) {\n const label = typeof entry === \"function\" ? entry.name : String(entry);\n\n throw new TypeError(\n `registerClass: ${klass.name} lists '${label}' in implements, which is not a registered interface`,\n );\n }\n\n return gtype;\n}\n\nfunction resolveInterfaceTypes(klass: AnyClass, entries: AnyClass[]): bigint[] {\n return [...new Set(entries.map((entry) => resolveInterfaceType(klass, entry)))];\n}\n\nfunction applyInterfaceMixins(klass: AnyClass, adoptedTypes: bigint[], inheritedNames: Set<string>): void {\n for (const gtype of adoptedTypes) {\n const mixin = getInterfaceMixin(gtype);\n\n if (mixin !== undefined) {\n insertMixinLayer(klass, mixin, inheritedNames);\n }\n }\n}\n\nfunction resolveParentType(klass: AnyClass): bigint {\n return (\n walkClassChain(getParentClass(klass), (cls) => {\n const gtype = getClassType(cls);\n\n return gtype === TYPE_INVALID ? undefined : gtype;\n }) ?? TYPE_INVALID\n );\n}\n\nfunction addOwnMember(members: InstanceMembers, proto: object, name: string, isInherited: boolean): void {\n if (name === \"constructor\") {\n return;\n }\n\n if (isInherited) {\n members.inheritedNames.add(name);\n }\n\n if (members.names.has(name)) {\n return;\n }\n\n members.names.add(name);\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\n if (typeof descriptor?.value === \"function\") {\n members.methods.set(name, descriptor.value as VfuncFn);\n }\n}\n\nfunction addOwnMembers(members: InstanceMembers, klass: AnyClass, isInherited: boolean): void {\n const proto = (klass as { prototype?: object }).prototype;\n\n if (proto === undefined) {\n return;\n }\n\n for (const name of Object.getOwnPropertyNames(proto)) {\n addOwnMember(members, proto, name, isInherited);\n }\n}\n\nfunction collectInstanceMembers(klass: AnyClass): InstanceMembers {\n const members: InstanceMembers = { methods: new Map(), names: new Set(), inheritedNames: new Set() };\n let cls: AnyClass | null = klass;\n\n while (cls !== null && getClassType(cls) === TYPE_INVALID) {\n addOwnMembers(members, cls, cls !== klass);\n cls = getParentClass(cls);\n }\n\n return members;\n}\n\nfunction buildDiscoveredVfunc(\n fn: VfuncFn,\n methodName: string,\n resolveDescriptor: (methodName: string) => VfuncDescriptor | undefined,\n skip: Set<string> | undefined,\n): DiscoveredVfunc | undefined {\n if (skip?.has(methodName)) {\n return undefined;\n }\n\n const descriptor = resolveDescriptor(methodName);\n\n if (!descriptor) {\n return undefined;\n }\n\n const argDescriptors = slotArgDescriptors(descriptor);\n\n return {\n ...descriptor,\n methodName,\n argDescriptors,\n fn: wrapVfunc(fn, argDescriptors, descriptor),\n };\n}\n\nfunction collectDiscoveredVfuncs(\n methods: MethodTable,\n resolveDescriptor: (methodName: string) => VfuncDescriptor | undefined,\n skip?: Set<string>,\n): DiscoveredVfunc[] {\n const result: DiscoveredVfunc[] = [];\n\n for (const [methodName, fn] of methods) {\n const discovered = buildDiscoveredVfunc(fn, methodName, resolveDescriptor, skip);\n\n if (discovered) {\n result.push(discovered);\n }\n }\n\n return result;\n}\n\nfunction discoverClassVfuncs(klass: AnyClass, methods: MethodTable): DiscoveredVfunc[] {\n return collectDiscoveredVfuncs(\n methods,\n (methodName) => findClassVfuncDescriptor(klass, methodName) ?? undefined,\n PROPERTY_VFUNC_NAMES,\n );\n}\n\nfunction wrapVfunc(\n fn: VfuncFn,\n argDescriptors: NativeRegisterClassVfunc[\"argDescriptors\"],\n descriptor: VfuncDescriptor,\n): VfuncFn {\n return wrapCallback(\n fn as (...args: unknown[]) => unknown,\n { argDescriptors, returnDescriptor: descriptor.returnDescriptor },\n \"vfunc\",\n );\n}\n\nfunction discoverInterfaceBindings(\n methods: MethodTable,\n parentGtype: bigint,\n declaredTypes: bigint[],\n claimedMethodNames: Set<string>,\n): InterfaceVfuncBinding[] {\n const declared: Set<bigint> = new Set(declaredTypes);\n const gtypes: Set<bigint> = new Set([...typeInterfaces(parentGtype), ...declaredTypes]);\n const bindings: InterfaceVfuncBinding[] = [];\n\n for (const gtype of gtypes) {\n const vfuncs = discoverInterfaceVfuncs(methods, gtype, claimedMethodNames);\n\n if (vfuncs.length > 0 || declared.has(gtype)) {\n bindings.push({ gtype, vfuncs });\n }\n }\n\n return bindings;\n}\n\nfunction discoverInterfaceVfuncs(\n methods: MethodTable,\n interfaceGtype: bigint,\n claimedMethodNames: Set<string>,\n): DiscoveredVfunc[] {\n return collectDiscoveredVfuncs(\n methods,\n (methodName) => findInterfaceVfuncDescriptor(interfaceGtype, methodName),\n claimedMethodNames,\n );\n}\n\nconst hasDispatchedProperties = (dispatch: PropertyDispatch, adoptedTypes: bigint[]): boolean =>\n dispatch.accessors.length > 0 || adoptedTypes.length > 0;\n\nfunction propertyVfuncFor(\n source: PropertyVfuncSource,\n spec: PropertyVfuncSpec,\n): DiscoveredVfunc | undefined {\n const { klass, methods, dispatch, adoptedTypes } = source;\n\n const dispatched = hasDispatchedProperties(dispatch, adoptedTypes)\n ? spec.makeDispatch(dispatch)\n : undefined;\n\n const fn = methods.get(spec.methodName) ?? dispatched;\n\n return fn === undefined ? undefined : buildPropertyVfunc(klass, spec.methodName, fn, spec.isValueOut);\n}\n\nfunction propertyVfuncs(source: PropertyVfuncSource): DiscoveredVfunc[] {\n return PROPERTY_VFUNC_SPECS.map((spec) => propertyVfuncFor(source, spec)).filter(\n (vfunc) => vfunc !== undefined,\n );\n}\n\nfunction markArg(argDescriptors: Descriptor[], index: number, patch: ArgPatch): Descriptor[] {\n return argDescriptors.map((arg, at) => (at === index ? { ...arg, ...patch } : arg));\n}\n\nfunction isTeardownSlot(descriptor: VfuncDescriptor): boolean {\n return (\n TEARDOWN_VFUNC_NAMES.has(descriptor.vfuncName) &&\n descriptor.argDescriptors[INSTANCE_ARG_INDEX]?.kind === \"object\"\n );\n}\n\nfunction slotArgDescriptors(descriptor: VfuncDescriptor): Descriptor[] {\n if (!isTeardownSlot(descriptor)) {\n return descriptor.argDescriptors;\n }\n\n return markArg(descriptor.argDescriptors, INSTANCE_ARG_INDEX, { isCallScoped: true });\n}\n\nfunction buildPropertyVfunc(\n klass: AnyClass,\n methodName: string,\n fn: VfuncFn,\n isValueOut: boolean,\n): DiscoveredVfunc {\n const descriptor = findClassVfuncDescriptor(klass, methodName);\n\n if (!descriptor) {\n throw new Error(`registerClass: the parent class exposes no '${methodName}' vtable slot`);\n }\n\n const argDescriptors = isValueOut\n ? markArg(descriptor.argDescriptors, VALUE_ARG_INDEX, { isCallerAllocated: true })\n : descriptor.argDescriptors;\n\n return {\n ...descriptor,\n methodName,\n argDescriptors,\n fn: wrapVfunc(fn, argDescriptors, descriptor),\n };\n}\n\nfunction toNativeInterface(binding: InterfaceVfuncBinding): NativeRegisterClassInterface {\n const nativeInterface: NativeRegisterClassInterface = {\n type: binding.gtype,\n vfuncs: [...binding.vfuncs],\n };\n\n const vtableSize = binding.vfuncs[0]?.vtableSize;\n\n if (vtableSize !== undefined) {\n nativeInterface.vtableSize = vtableSize;\n }\n\n return nativeInterface;\n}\n\nfunction toNativeOptions(\n classVfuncs: DiscoveredVfunc[],\n interfaceBindings: InterfaceVfuncBinding[],\n properties: Record<string, PropertySpec>,\n): NativeRegisterClassOptions | undefined {\n const hasInterfaces = interfaceBindings.length > 0;\n const hasClassVfuncs = classVfuncs.length > 0;\n const hasProperties = Object.keys(properties).length > 0;\n\n if (!hasClassVfuncs && !hasInterfaces && !hasProperties) {\n return undefined;\n }\n\n const options: NativeRegisterClassOptions = {};\n\n if (hasProperties) {\n options.properties = toNativeProperties(properties);\n }\n\n if (hasClassVfuncs) {\n options.vfuncs = [...classVfuncs];\n }\n\n if (hasInterfaces) {\n options.interfaces = interfaceBindings.map((binding) => toNativeInterface(binding));\n }\n\n return options;\n}\n\nexport { type Interface, registerClass };\n"]}
|
package/dist/registry.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { type AnyClass } from "@gtkx/utils";
|
|
|
3
3
|
import type { Mixin } from "./mixin.js";
|
|
4
4
|
import { type TypedClass } from "./type.js";
|
|
5
5
|
/**
|
|
6
|
-
* Static side of class `C` with its construct signature preserved but the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Static side of class `C` with its construct signature preserved but the members named `K`
|
|
7
|
+
* removed. A generated class lists every static it declares itself, so a static it narrows never
|
|
8
|
+
* has to stay assignable to the one it shadows. The signature is kept abstract so an abstract `C`
|
|
9
|
+
* survives it: a subclass extends the result, and only the subclass's own declarations decide
|
|
10
|
+
* which statics reach it.
|
|
10
11
|
*/
|
|
11
|
-
type StaticBase<C, K extends PropertyKey
|
|
12
|
+
type StaticBase<C, K extends PropertyKey> = Omit<C, K> & (C extends abstract new (...args: infer A) => infer R ? abstract new (...args: A) => R : never);
|
|
12
13
|
/** One overridable vtable slot: where it sits in the vtable struct and how it is marshalled. */
|
|
13
14
|
type VfuncDescriptor = {
|
|
14
15
|
/** GIR name of the type struct holding the slot, without its namespace, such as `WidgetClass`. */
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,cAAc,EAGnB,KAAK,MAAM,EACX,KAAK,kBAAkB,IAAI,wBAAwB,EAEtD,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAgB,KAAK,UAAU,EAAiD,MAAM,WAAW,CAAC;AAEzG
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,cAAc,EAGnB,KAAK,MAAM,EACX,KAAK,kBAAkB,IAAI,wBAAwB,EAEtD,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAgB,KAAK,UAAU,EAAiD,MAAM,WAAW,CAAC;AAEzG;;;;;;GAMG;AACH,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAClD,CAAC,CAAC,SAAS,QAAQ,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,C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,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,GAIb,CAAC","sourcesContent":["import {\n type ExternalObject,\n getType,\n getWrapper,\n type Handle,\n type RegisterClassVfunc as NativeRegisterClassVfunc,\n setWrapper,\n} from \"@gtkx/native\";\nimport { type AnyClass, walkClassChain } from \"@gtkx/utils\";\nimport type { Mixin, MixinReceiver } from \"./mixin.js\";\nimport { TYPE_INVALID, type TypedClass, typeInterfaces, typeIsA, typeName, typeParent } from \"./type.js\";\n\n/**\n * Static side of class `C` with its construct signature preserved but the member\n * named `K` (default `\"new\"`) removed. The signature is kept abstract so an abstract\n * `C` survives it: a subclass extends the result, and only the subclass's own\n * declaration decides whether `new` reaches it.\n */\ntype StaticBase<C, K extends PropertyKey = \"new\"> = Omit<C, K> &\n (C extends abstract new (...args: infer A) => infer R ? abstract new (...args: A) => R : never);\n\n/** One overridable vtable slot: where it sits in the vtable struct and how it is marshalled. */\ntype VfuncDescriptor = {\n /** GIR name of the type struct holding the slot, without its namespace, such as `WidgetClass`. */\n className: string;\n /** Name of the slot's field in that struct. */\n vfuncName: string;\n /** Byte offset of the slot within the struct. */\n byteOffset: number;\n /**\n * Byte size of an interface's vtable struct, used to bounds-check `VfuncDescriptor.byteOffset`.\n * A class struct is bounds-checked against the size `g_type_query` reports for it, so a slot in\n * one carries no size of its own.\n */\n vtableSize?: number;\n /** Descriptor for each argument the slot receives, starting with the instance. */\n argDescriptors: NativeRegisterClassVfunc[\"argDescriptors\"];\n /** Descriptor for the value the slot returns. */\n returnDescriptor: NativeRegisterClassVfunc[\"returnDescriptor\"];\n /**\n * GIR marks the slot's return value as one the bindings do not surface, so a call through the\n * slot drops it and an implementation of the slot reports success in its place, while\n * `VfuncDescriptor.returnDescriptor` keeps the C type the slot is called against either way.\n */\n isReturnSkipped?: boolean;\n /**\n * The slot takes a trailing `GError**` that `VfuncDescriptor.argDescriptors` leaves out, the\n * way GIR leaves it out of a callable's parameters. A call through the slot has to append it\n * or it passes one argument fewer than the implementation reads.\n */\n canThrow?: boolean;\n};\n\n/**\n * The vtable slots a wrapper class or interface exposes, keyed by the JavaScript method name that\n * overrides each one.\n */\ntype VfuncRegistry = Record<string, VfuncDescriptor>;\ntype WrapperBinding = (handle: ExternalObject<Handle>, instance: object) => void;\n\n/**\n * How one property an interface declares reaches the vtable, given as the interface's own accessor\n * members. A direction introspection does not route through a vtable slot is left out, and the\n * property owns that direction's state itself.\n */\ntype InterfaceProperty = {\n /** Member reading the slot the property's value comes from, such as `getEnabled`. */\n getter?: string;\n /** Member writing the slot the property's value goes to, such as `setActionName`. */\n setter?: string;\n};\n\n/**\n * What an interface's vtable struct looks like, for the classes that adopt the interface.\n * `g_type_query` reports no size for an interface, so each slot's generated metadata carries the\n * struct's byte size to bounds-check the slot's offset; an interface introspection describes no\n * vtable for simply contributes no slots.\n */\ntype InterfaceLayout = {\n /** The slots the struct declares, keyed by the JavaScript method name that fills each one. */\n vfuncs?: VfuncRegistry;\n /**\n * The properties a vtable slot backs, keyed by canonical property name, so a class adopting the\n * interface answers `g_object_get` and `g_object_set` with what the slot holds.\n */\n properties?: Record<string, InterfaceProperty>;\n};\n\nconst classRegistry: Map<bigint, AnyClass> = new Map();\nconst interfaceMixinRegistry: Map<bigint, Mixin> = new Map();\nconst composedClassRegistry: Map<bigint, AnyClass> = new Map();\nconst handleMap: WeakMap<object, ExternalObject<Handle>> = new WeakMap();\nconst vfuncRegistry: WeakMap<object, VfuncRegistry> = new WeakMap();\nconst interfaceLayoutRegistry: Map<bigint, InterfaceLayout> = new Map();\nconst wrapperClasses: WeakSet<AnyClass> = new WeakSet();\nconst derivedClasses: WeakSet<AnyClass> = new WeakSet();\n\nfunction setClassType(cls: AnyClass, type: bigint): void {\n (cls.prototype as { [K in keyof TypedClass]: TypedClass[K] }).__type__ = type;\n}\n\n/**\n * Returns the GType a class was registered under, or the invalid type when it carries none. The tag is\n * read off the class's own prototype, so a subclass that never went through `registerClass` reports the\n * invalid type rather than inheriting the one its parent was registered with.\n */\nfunction getClassType(cls: AnyClass | undefined): bigint {\n const proto: object | undefined = cls?.prototype;\n\n if (proto === undefined || !Object.hasOwn(proto, \"__type__\")) {\n return TYPE_INVALID;\n }\n\n return (proto as TypedClass).__type__;\n}\n\n/**\n * Returns the GType the given instance's handle carries, or the invalid type when it has no handle.\n * This is the object's own type rather than the type of the class it was wrapped as, and the two differ\n * for an object GTK created itself, such as the row widget inside a `Gtk.ListView`, which GTKX wraps as\n * the nearest registered ancestor.\n */\nfunction getInstanceType(instance: object): bigint {\n const handle = handleMap.get(instance);\n\n return handle === undefined ? TYPE_INVALID : getType(handle);\n}\n\nfunction registerClassType(cls: AnyClass, type: bigint): void {\n if (type === TYPE_INVALID) {\n return;\n }\n\n classRegistry.set(type, cls);\n setClassType(cls, type);\n}\n\n/**\n * Registers a wrapper class as the JS representation of a GType, optionally\n * installing a registry of virtual functions.\n * @param cls Wrapper class to associate with the type.\n * @param type GType the class wraps.\n * @param vfuncs Vtable slots the class exposes, so `registerClass` can bind the ones a subclass\n * overrides.\n */\nfunction registerWrapperClass(cls: AnyClass, type: bigint, vfuncs?: VfuncRegistry): void {\n registerClassType(cls, type);\n\n if (type !== TYPE_INVALID) {\n wrapperClasses.add(cls);\n }\n\n if (vfuncs) {\n registerVfuncRegistry(cls, vfuncs);\n }\n}\n\nfunction markDerivedClass(cls: AnyClass): void {\n derivedClasses.add(cls);\n}\n\nfunction resolveAncestorType(ancestor: AnyClass): bigint | undefined {\n if (derivedClasses.has(ancestor) || !wrapperClasses.has(ancestor)) {\n return undefined;\n }\n\n return getClassType(ancestor);\n}\n\nfunction resolveWrapperType(instance: object): bigint {\n const cls = instance.constructor as AnyClass | undefined;\n\n if (cls === undefined) {\n return TYPE_INVALID;\n }\n\n return walkClassChain(cls, (ancestor) => resolveAncestorType(ancestor)) ?? TYPE_INVALID;\n}\n\n/**\n * Registers a GInterface, associating its GType with a mixin used to compose the\n * interface onto wrapper classes and, when introspection describes its vtable, that layout.\n * @param cls Class carrying the interface's GType tag.\n * @param type GType of the interface.\n * @param mixin Mixin that applies the interface to a wrapper class.\n * @param layout The interface's vtable struct, so `registerClass` can bind the slots an\n * implementing class overrides and take over the ones it leaves alone.\n */\nfunction registerInterface(cls: AnyClass, type: bigint, mixin: Mixin, layout?: InterfaceLayout): void {\n if (type === TYPE_INVALID) {\n return;\n }\n\n setClassType(cls, type);\n interfaceMixinRegistry.set(type, mixin);\n\n if (layout) {\n interfaceLayoutRegistry.set(type, layout);\n }\n}\n\n/**\n * Wraps a native handle in a JS wrapper instance. With no class, resolves and\n * reuses the wrapper for the handle's runtime GType (composing interface mixins),\n * and hands back an instance that already carries a handle unchanged; with an\n * explicit class, creates a bare instance backed by the handle. Returns null for\n * a null or undefined handle.\n * @param handle Native handle to wrap.\n * @param cls Wrapper class to instantiate, or omitted to resolve it from the runtime type.\n */\nfunction wrapHandle(handle: null | undefined, cls?: AnyClass): null;\nfunction wrapHandle<T extends object>(handle: ExternalObject<Handle>, cls: AnyClass<T>): T;\n\nfunction wrapHandle<T extends object>(\n handle: ExternalObject<Handle> | null | undefined,\n cls: AnyClass<T>,\n): T | null;\n\nfunction wrapHandle(handle: ExternalObject<Handle>, cls?: AnyClass): TypedClass;\nfunction wrapHandle(handle: ExternalObject<Handle> | null | undefined, cls?: AnyClass): TypedClass | null;\n\nfunction wrapHandle(handle: ExternalObject<Handle> | null | undefined, cls?: AnyClass): object | null {\n if (handle === null || handle === undefined) {\n return null;\n }\n\n if (cls === undefined) {\n return getOrCreateWrapper(handle);\n }\n\n const instance: object = Object.create(cls.prototype) as object;\n setHandle(instance, handle);\n\n return instance;\n}\n\n/**\n * Returns the wrapper class registered for a GType, walking up to ancestor types,\n * and throws if none is registered.\n */\nfunction getWrapperClass(type: bigint): AnyClass {\n const cls = resolveWrapperClass(type);\n\n if (!cls) {\n throw new Error(`No registered wrapper class for type '${typeName(type) ?? String(type)}'`);\n }\n\n return cls;\n}\n\nfunction resolveWrapperClass(type: bigint): AnyClass | null {\n let currentType = type;\n\n while (currentType !== TYPE_INVALID) {\n const cls = classRegistry.get(currentType);\n\n if (cls) {\n return cls;\n }\n\n currentType = typeParent(currentType);\n }\n\n return null;\n}\n\nfunction getInterfaceMixin(type: bigint): Mixin | undefined {\n return interfaceMixinRegistry.get(type);\n}\n\nfunction applyInterfaceMixin(cls: AnyClass, type: bigint, baseType: bigint, applied: Set<bigint>): AnyClass {\n if (applied.has(type) || typeIsA(baseType, type)) {\n return cls;\n }\n\n const mixin = getInterfaceMixin(type);\n\n if (mixin === undefined) {\n return cls;\n }\n\n applied.add(type);\n\n return mixin(cls as AnyClass<MixinReceiver>);\n}\n\nfunction createComposedClass(base: AnyClass, runtimeType: bigint): AnyClass {\n const baseType = getClassType(base);\n const applied: Set<bigint> = new Set();\n let cls: AnyClass = base;\n\n for (const type of typeInterfaces(runtimeType)) {\n cls = applyInterfaceMixin(cls, type, baseType, applied);\n }\n\n return applied.size === 0 ? base : cls;\n}\n\nfunction resolveComposedClass(runtimeType: bigint): AnyClass | null {\n const exact = classRegistry.get(runtimeType);\n\n if (exact) {\n return exact;\n }\n\n const cached = composedClassRegistry.get(runtimeType);\n\n if (cached) {\n return cached;\n }\n\n const base = resolveWrapperClass(runtimeType);\n\n if (base === null) {\n return null;\n }\n\n const composed = createComposedClass(base, runtimeType);\n\n if (composed === base) {\n return base;\n }\n\n setClassType(composed, runtimeType);\n wrapperClasses.add(composed);\n composedClassRegistry.set(runtimeType, composed);\n\n return composed;\n}\n\nfunction wrapObject(value: unknown): object | null {\n return value == null ? null : getOrCreateWrapper(value as ExternalObject<Handle>);\n}\n\nfunction wrapCallScopedObject(value: unknown): object | null {\n return value == null ? null : wrapperFor(value as ExternalObject<Handle>, bindCallScopedWrapper);\n}\n\nfunction existingWrapperFor(handle: ExternalObject<Handle>): object | null {\n return handleMap.has(handle) ? handle : getWrapper(handle);\n}\n\nfunction createWrapper(handle: ExternalObject<Handle>): object {\n const runtimeType: bigint = getType(handle);\n\n if (runtimeType === TYPE_INVALID) {\n throw new Error(\"Cannot resolve runtime GLib type from handle\");\n }\n\n const cls = resolveComposedClass(runtimeType);\n\n if (!cls) {\n throw new Error(`Expected registered GLib type, got type ${String(runtimeType)}`);\n }\n\n return Object.create(cls.prototype) as object;\n}\n\nfunction wrapperFor(handle: ExternalObject<Handle>, bind: WrapperBinding): object {\n const existing = existingWrapperFor(handle);\n\n if (existing) {\n return existing;\n }\n\n const instance = createWrapper(handle);\n bind(handle, instance);\n\n return instance;\n}\n\nfunction getOrCreateWrapper(handle: ExternalObject<Handle>): object {\n return wrapperFor(handle, registerWrapper);\n}\n\nfunction instanceClassName(instance: object): string {\n return (instance as { constructor?: { name?: string } }).constructor?.name ?? \"object\";\n}\n\n/** Returns the native handle bound to a wrapper instance, throwing if none is set. */\nfunction getHandle(instance: object): ExternalObject<Handle> {\n const handle = handleMap.get(instance);\n\n if (handle === undefined) {\n throw new Error(`No native handle associated with ${instanceClassName(instance)}`);\n }\n\n return handle;\n}\n\n/** Associates a native handle with a wrapper instance. */\nfunction setHandle(instance: object, handle: ExternalObject<Handle>): void {\n handleMap.set(instance, handle);\n}\n\nfunction bindCallScopedWrapper(handle: ExternalObject<Handle>, instance: object): void {\n setHandle(instance, handle);\n}\n\nfunction registerWrapper(handle: ExternalObject<Handle>, instance: object): void {\n setHandle(instance, handle);\n setWrapper(handle, instance);\n}\n\nfunction registerVfuncRegistry(cls: object, registry: VfuncRegistry): void {\n vfuncRegistry.set(cls, registry);\n}\n\nfunction getVfuncRegistry(cls: object): VfuncRegistry | undefined {\n return vfuncRegistry.get(cls);\n}\n\nfunction getInterfaceVfuncRegistry(type: bigint): VfuncRegistry | undefined {\n return interfaceLayoutRegistry.get(type)?.vfuncs;\n}\n\nfunction getInterfaceProperties(type: bigint): Record<string, InterfaceProperty> | undefined {\n return interfaceLayoutRegistry.get(type)?.properties;\n}\n\nexport {\n getClassType,\n getInstanceType,\n markDerivedClass,\n registerClassType,\n registerWrapperClass,\n registerInterface,\n wrapHandle,\n getWrapperClass,\n resolveWrapperClass,\n getHandle,\n setHandle,\n getVfuncRegistry,\n getInterfaceMixin,\n getInterfaceProperties,\n getInterfaceVfuncRegistry,\n instanceClassName,\n registerWrapper,\n resolveWrapperType,\n wrapCallScopedObject,\n wrapObject,\n type InterfaceProperty,\n type StaticBase,\n type VfuncDescriptor,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EACP,UAAU,EAGV,UAAU,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAmB,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA+EzG,MAAM,aAAa,GAA0B,IAAI,GAAG,EAAE,CAAC;AACvD,MAAM,sBAAsB,GAAuB,IAAI,GAAG,EAAE,CAAC;AAC7D,MAAM,qBAAqB,GAA0B,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,SAAS,GAA4C,IAAI,OAAO,EAAE,CAAC;AACzE,MAAM,aAAa,GAAmC,IAAI,OAAO,EAAE,CAAC;AACpE,MAAM,uBAAuB,GAAiC,IAAI,GAAG,EAAE,CAAC;AACxE,MAAM,cAAc,GAAsB,IAAI,OAAO,EAAE,CAAC;AACxD,MAAM,cAAc,GAAsB,IAAI,OAAO,EAAE,CAAC;AAExD,SAAS,YAAY,CAAC,GAAa,EAAE,IAAY;IAC5C,GAAG,CAAC,SAAwD,CAAC,QAAQ,GAAG,IAAI,CAAC;AAClF,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAyB;IAC3C,MAAM,KAAK,GAAuB,GAAG,EAAE,SAAS,CAAC;IAEjD,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC;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EACV,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,GAIb,CAAC","sourcesContent":["import {\n type ExternalObject,\n getType,\n getWrapper,\n type Handle,\n type RegisterClassVfunc as NativeRegisterClassVfunc,\n setWrapper,\n} from \"@gtkx/native\";\nimport { type AnyClass, walkClassChain } from \"@gtkx/utils\";\nimport type { Mixin, MixinReceiver } from \"./mixin.js\";\nimport { TYPE_INVALID, type TypedClass, typeInterfaces, typeIsA, typeName, typeParent } from \"./type.js\";\n\n/**\n * Static side of class `C` with its construct signature preserved but the members named `K`\n * removed. A generated class lists every static it declares itself, so a static it narrows never\n * has to stay assignable to the one it shadows. The signature is kept abstract so an abstract `C`\n * survives it: a subclass extends the result, and only the subclass's own declarations decide\n * which statics reach it.\n */\ntype StaticBase<C, K extends PropertyKey> = Omit<C, K> &\n (C extends abstract new (...args: infer A) => infer R ? abstract new (...args: A) => R : never);\n\n/** One overridable vtable slot: where it sits in the vtable struct and how it is marshalled. */\ntype VfuncDescriptor = {\n /** GIR name of the type struct holding the slot, without its namespace, such as `WidgetClass`. */\n className: string;\n /** Name of the slot's field in that struct. */\n vfuncName: string;\n /** Byte offset of the slot within the struct. */\n byteOffset: number;\n /**\n * Byte size of an interface's vtable struct, used to bounds-check `VfuncDescriptor.byteOffset`.\n * A class struct is bounds-checked against the size `g_type_query` reports for it, so a slot in\n * one carries no size of its own.\n */\n vtableSize?: number;\n /** Descriptor for each argument the slot receives, starting with the instance. */\n argDescriptors: NativeRegisterClassVfunc[\"argDescriptors\"];\n /** Descriptor for the value the slot returns. */\n returnDescriptor: NativeRegisterClassVfunc[\"returnDescriptor\"];\n /**\n * GIR marks the slot's return value as one the bindings do not surface, so a call through the\n * slot drops it and an implementation of the slot reports success in its place, while\n * `VfuncDescriptor.returnDescriptor` keeps the C type the slot is called against either way.\n */\n isReturnSkipped?: boolean;\n /**\n * The slot takes a trailing `GError**` that `VfuncDescriptor.argDescriptors` leaves out, the\n * way GIR leaves it out of a callable's parameters. A call through the slot has to append it\n * or it passes one argument fewer than the implementation reads.\n */\n canThrow?: boolean;\n};\n\n/**\n * The vtable slots a wrapper class or interface exposes, keyed by the JavaScript method name that\n * overrides each one.\n */\ntype VfuncRegistry = Record<string, VfuncDescriptor>;\ntype WrapperBinding = (handle: ExternalObject<Handle>, instance: object) => void;\n\n/**\n * How one property an interface declares reaches the vtable, given as the interface's own accessor\n * members. A direction introspection does not route through a vtable slot is left out, and the\n * property owns that direction's state itself.\n */\ntype InterfaceProperty = {\n /** Member reading the slot the property's value comes from, such as `getEnabled`. */\n getter?: string;\n /** Member writing the slot the property's value goes to, such as `setActionName`. */\n setter?: string;\n};\n\n/**\n * What an interface's vtable struct looks like, for the classes that adopt the interface.\n * `g_type_query` reports no size for an interface, so each slot's generated metadata carries the\n * struct's byte size to bounds-check the slot's offset; an interface introspection describes no\n * vtable for simply contributes no slots.\n */\ntype InterfaceLayout = {\n /** The slots the struct declares, keyed by the JavaScript method name that fills each one. */\n vfuncs?: VfuncRegistry;\n /**\n * The properties a vtable slot backs, keyed by canonical property name, so a class adopting the\n * interface answers `g_object_get` and `g_object_set` with what the slot holds.\n */\n properties?: Record<string, InterfaceProperty>;\n};\n\nconst classRegistry: Map<bigint, AnyClass> = new Map();\nconst interfaceMixinRegistry: Map<bigint, Mixin> = new Map();\nconst composedClassRegistry: Map<bigint, AnyClass> = new Map();\nconst handleMap: WeakMap<object, ExternalObject<Handle>> = new WeakMap();\nconst vfuncRegistry: WeakMap<object, VfuncRegistry> = new WeakMap();\nconst interfaceLayoutRegistry: Map<bigint, InterfaceLayout> = new Map();\nconst wrapperClasses: WeakSet<AnyClass> = new WeakSet();\nconst derivedClasses: WeakSet<AnyClass> = new WeakSet();\n\nfunction setClassType(cls: AnyClass, type: bigint): void {\n (cls.prototype as { [K in keyof TypedClass]: TypedClass[K] }).__type__ = type;\n}\n\n/**\n * Returns the GType a class was registered under, or the invalid type when it carries none. The tag is\n * read off the class's own prototype, so a subclass that never went through `registerClass` reports the\n * invalid type rather than inheriting the one its parent was registered with.\n */\nfunction getClassType(cls: AnyClass | undefined): bigint {\n const proto: object | undefined = cls?.prototype;\n\n if (proto === undefined || !Object.hasOwn(proto, \"__type__\")) {\n return TYPE_INVALID;\n }\n\n return (proto as TypedClass).__type__;\n}\n\n/**\n * Returns the GType the given instance's handle carries, or the invalid type when it has no handle.\n * This is the object's own type rather than the type of the class it was wrapped as, and the two differ\n * for an object GTK created itself, such as the row widget inside a `Gtk.ListView`, which GTKX wraps as\n * the nearest registered ancestor.\n */\nfunction getInstanceType(instance: object): bigint {\n const handle = handleMap.get(instance);\n\n return handle === undefined ? TYPE_INVALID : getType(handle);\n}\n\nfunction registerClassType(cls: AnyClass, type: bigint): void {\n if (type === TYPE_INVALID) {\n return;\n }\n\n classRegistry.set(type, cls);\n setClassType(cls, type);\n}\n\n/**\n * Registers a wrapper class as the JS representation of a GType, optionally\n * installing a registry of virtual functions.\n * @param cls Wrapper class to associate with the type.\n * @param type GType the class wraps.\n * @param vfuncs Vtable slots the class exposes, so `registerClass` can bind the ones a subclass\n * overrides.\n */\nfunction registerWrapperClass(cls: AnyClass, type: bigint, vfuncs?: VfuncRegistry): void {\n registerClassType(cls, type);\n\n if (type !== TYPE_INVALID) {\n wrapperClasses.add(cls);\n }\n\n if (vfuncs) {\n registerVfuncRegistry(cls, vfuncs);\n }\n}\n\nfunction markDerivedClass(cls: AnyClass): void {\n derivedClasses.add(cls);\n}\n\nfunction resolveAncestorType(ancestor: AnyClass): bigint | undefined {\n if (derivedClasses.has(ancestor) || !wrapperClasses.has(ancestor)) {\n return undefined;\n }\n\n return getClassType(ancestor);\n}\n\nfunction resolveWrapperType(instance: object): bigint {\n const cls = instance.constructor as AnyClass | undefined;\n\n if (cls === undefined) {\n return TYPE_INVALID;\n }\n\n return walkClassChain(cls, (ancestor) => resolveAncestorType(ancestor)) ?? TYPE_INVALID;\n}\n\n/**\n * Registers a GInterface, associating its GType with a mixin used to compose the\n * interface onto wrapper classes and, when introspection describes its vtable, that layout.\n * @param cls Class carrying the interface's GType tag.\n * @param type GType of the interface.\n * @param mixin Mixin that applies the interface to a wrapper class.\n * @param layout The interface's vtable struct, so `registerClass` can bind the slots an\n * implementing class overrides and take over the ones it leaves alone.\n */\nfunction registerInterface(cls: AnyClass, type: bigint, mixin: Mixin, layout?: InterfaceLayout): void {\n if (type === TYPE_INVALID) {\n return;\n }\n\n setClassType(cls, type);\n interfaceMixinRegistry.set(type, mixin);\n\n if (layout) {\n interfaceLayoutRegistry.set(type, layout);\n }\n}\n\n/**\n * Wraps a native handle in a JS wrapper instance. With no class, resolves and\n * reuses the wrapper for the handle's runtime GType (composing interface mixins),\n * and hands back an instance that already carries a handle unchanged; with an\n * explicit class, creates a bare instance backed by the handle. Returns null for\n * a null or undefined handle.\n * @param handle Native handle to wrap.\n * @param cls Wrapper class to instantiate, or omitted to resolve it from the runtime type.\n */\nfunction wrapHandle(handle: null | undefined, cls?: AnyClass): null;\nfunction wrapHandle<T extends object>(handle: ExternalObject<Handle>, cls: AnyClass<T>): T;\n\nfunction wrapHandle<T extends object>(\n handle: ExternalObject<Handle> | null | undefined,\n cls: AnyClass<T>,\n): T | null;\n\nfunction wrapHandle(handle: ExternalObject<Handle>, cls?: AnyClass): TypedClass;\nfunction wrapHandle(handle: ExternalObject<Handle> | null | undefined, cls?: AnyClass): TypedClass | null;\n\nfunction wrapHandle(handle: ExternalObject<Handle> | null | undefined, cls?: AnyClass): object | null {\n if (handle === null || handle === undefined) {\n return null;\n }\n\n if (cls === undefined) {\n return getOrCreateWrapper(handle);\n }\n\n const instance: object = Object.create(cls.prototype) as object;\n setHandle(instance, handle);\n\n return instance;\n}\n\n/**\n * Returns the wrapper class registered for a GType, walking up to ancestor types,\n * and throws if none is registered.\n */\nfunction getWrapperClass(type: bigint): AnyClass {\n const cls = resolveWrapperClass(type);\n\n if (!cls) {\n throw new Error(`No registered wrapper class for type '${typeName(type) ?? String(type)}'`);\n }\n\n return cls;\n}\n\nfunction resolveWrapperClass(type: bigint): AnyClass | null {\n let currentType = type;\n\n while (currentType !== TYPE_INVALID) {\n const cls = classRegistry.get(currentType);\n\n if (cls) {\n return cls;\n }\n\n currentType = typeParent(currentType);\n }\n\n return null;\n}\n\nfunction getInterfaceMixin(type: bigint): Mixin | undefined {\n return interfaceMixinRegistry.get(type);\n}\n\nfunction applyInterfaceMixin(cls: AnyClass, type: bigint, baseType: bigint, applied: Set<bigint>): AnyClass {\n if (applied.has(type) || typeIsA(baseType, type)) {\n return cls;\n }\n\n const mixin = getInterfaceMixin(type);\n\n if (mixin === undefined) {\n return cls;\n }\n\n applied.add(type);\n\n return mixin(cls as AnyClass<MixinReceiver>);\n}\n\nfunction createComposedClass(base: AnyClass, runtimeType: bigint): AnyClass {\n const baseType = getClassType(base);\n const applied: Set<bigint> = new Set();\n let cls: AnyClass = base;\n\n for (const type of typeInterfaces(runtimeType)) {\n cls = applyInterfaceMixin(cls, type, baseType, applied);\n }\n\n return applied.size === 0 ? base : cls;\n}\n\nfunction resolveComposedClass(runtimeType: bigint): AnyClass | null {\n const exact = classRegistry.get(runtimeType);\n\n if (exact) {\n return exact;\n }\n\n const cached = composedClassRegistry.get(runtimeType);\n\n if (cached) {\n return cached;\n }\n\n const base = resolveWrapperClass(runtimeType);\n\n if (base === null) {\n return null;\n }\n\n const composed = createComposedClass(base, runtimeType);\n\n if (composed === base) {\n return base;\n }\n\n setClassType(composed, runtimeType);\n wrapperClasses.add(composed);\n composedClassRegistry.set(runtimeType, composed);\n\n return composed;\n}\n\nfunction wrapObject(value: unknown): object | null {\n return value == null ? null : getOrCreateWrapper(value as ExternalObject<Handle>);\n}\n\nfunction wrapCallScopedObject(value: unknown): object | null {\n return value == null ? null : wrapperFor(value as ExternalObject<Handle>, bindCallScopedWrapper);\n}\n\nfunction existingWrapperFor(handle: ExternalObject<Handle>): object | null {\n return handleMap.has(handle) ? handle : getWrapper(handle);\n}\n\nfunction createWrapper(handle: ExternalObject<Handle>): object {\n const runtimeType: bigint = getType(handle);\n\n if (runtimeType === TYPE_INVALID) {\n throw new Error(\"Cannot resolve runtime GLib type from handle\");\n }\n\n const cls = resolveComposedClass(runtimeType);\n\n if (!cls) {\n throw new Error(`Expected registered GLib type, got type ${String(runtimeType)}`);\n }\n\n return Object.create(cls.prototype) as object;\n}\n\nfunction wrapperFor(handle: ExternalObject<Handle>, bind: WrapperBinding): object {\n const existing = existingWrapperFor(handle);\n\n if (existing) {\n return existing;\n }\n\n const instance = createWrapper(handle);\n bind(handle, instance);\n\n return instance;\n}\n\nfunction getOrCreateWrapper(handle: ExternalObject<Handle>): object {\n return wrapperFor(handle, registerWrapper);\n}\n\nfunction instanceClassName(instance: object): string {\n return (instance as { constructor?: { name?: string } }).constructor?.name ?? \"object\";\n}\n\n/** Returns the native handle bound to a wrapper instance, throwing if none is set. */\nfunction getHandle(instance: object): ExternalObject<Handle> {\n const handle = handleMap.get(instance);\n\n if (handle === undefined) {\n throw new Error(`No native handle associated with ${instanceClassName(instance)}`);\n }\n\n return handle;\n}\n\n/** Associates a native handle with a wrapper instance. */\nfunction setHandle(instance: object, handle: ExternalObject<Handle>): void {\n handleMap.set(instance, handle);\n}\n\nfunction bindCallScopedWrapper(handle: ExternalObject<Handle>, instance: object): void {\n setHandle(instance, handle);\n}\n\nfunction registerWrapper(handle: ExternalObject<Handle>, instance: object): void {\n setHandle(instance, handle);\n setWrapper(handle, instance);\n}\n\nfunction registerVfuncRegistry(cls: object, registry: VfuncRegistry): void {\n vfuncRegistry.set(cls, registry);\n}\n\nfunction getVfuncRegistry(cls: object): VfuncRegistry | undefined {\n return vfuncRegistry.get(cls);\n}\n\nfunction getInterfaceVfuncRegistry(type: bigint): VfuncRegistry | undefined {\n return interfaceLayoutRegistry.get(type)?.vfuncs;\n}\n\nfunction getInterfaceProperties(type: bigint): Record<string, InterfaceProperty> | undefined {\n return interfaceLayoutRegistry.get(type)?.properties;\n}\n\nexport {\n getClassType,\n getInstanceType,\n markDerivedClass,\n registerClassType,\n registerWrapperClass,\n registerInterface,\n wrapHandle,\n getWrapperClass,\n resolveWrapperClass,\n getHandle,\n setHandle,\n getVfuncRegistry,\n getInterfaceMixin,\n getInterfaceProperties,\n getInterfaceVfuncRegistry,\n instanceClassName,\n registerWrapper,\n resolveWrapperType,\n wrapCallScopedObject,\n wrapObject,\n type InterfaceProperty,\n type StaticBase,\n type VfuncDescriptor,\n};\n"]}
|
package/dist/t.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ type T = {
|
|
|
68
68
|
slist: typeof helpers.slistT;
|
|
69
69
|
/** Builds a descriptor for a `GPtrArray` of items. */
|
|
70
70
|
ptrArray: typeof helpers.ptrArrayT;
|
|
71
|
-
/** Builds a descriptor for a `GArray` of items
|
|
71
|
+
/** Builds a descriptor for a `GArray` of items. */
|
|
72
72
|
gArray: typeof helpers.gArrayT;
|
|
73
73
|
/** Builds a descriptor for a `GByteArray`. */
|
|
74
74
|
byteArray: typeof helpers.byteArrayT;
|
package/dist/t.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../src/t.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0EAA0E;AAC1E,KAAK,CAAC,GAAG;IACL,qGAAqG;IACrG,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,wDAAwD;IACxD,IAAI,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC3B,yDAAyD;IACzD,KAAK,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC7B,yDAAyD;IACzD,KAAK,EAAE,OAAO,O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;AAEF,OAAO,EAAE,CAAC,EAAE,CAAC","sourcesContent":["import { bind } from \"./bind.js\";\nimport * as helpers from \"./descriptors.js\";\nimport { fn } from \"./fn.js\";\n\n/** The descriptor factories and function binders exposed as {@link t}. */\ntype T = {\n /** Binds a symbol in a shared library to a callable that marshals its arguments and return value. */\n bind: typeof bind;\n /** Descriptor for a `gint8`, marshalled as a number. */\n int8: typeof helpers.int8T;\n /** Descriptor for a `guint8`, marshalled as a number. */\n uint8: typeof helpers.uint8T;\n /** Descriptor for a `gint16`, marshalled as a number. */\n int16: typeof helpers.int16T;\n /** Descriptor for a `guint16`, marshalled as a number. */\n uint16: typeof helpers.uint16T;\n /** Descriptor for a `gint32`, marshalled as a number. */\n int32: typeof helpers.int32T;\n /** Descriptor for a `guint32`, marshalled as a number. */\n uint32: typeof helpers.uint32T;\n /** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\n int64: typeof helpers.int64T;\n /** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\n uint64: typeof helpers.uint64T;\n /** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\n bigint64: typeof helpers.bigint64T;\n /** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\n biguint64: typeof helpers.biguint64T;\n /** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\n gtype: typeof helpers.gtypeT;\n /** Descriptor for a `gfloat`. */\n float32: typeof helpers.float32T;\n /** Descriptor for a `gdouble`. */\n float64: typeof helpers.float64T;\n /** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\n boolean: typeof helpers.booleanT;\n /** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\n void: typeof helpers.voidT;\n /** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\n unichar: typeof helpers.unicharT;\n /** Descriptor for an opaque `gpointer` argument, taken from a typed array's memory or a numeric address. */\n buffer: typeof helpers.bufferT;\n /**\n * Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer\n * used when the string is passed by reference.\n */\n string: typeof helpers.stringT;\n /** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */\n object: typeof helpers.objectT;\n /** Builds a descriptor for a `GBoxed` value of the named type. */\n boxed: typeof helpers.boxedT;\n /** Builds a descriptor for a plain C struct. */\n struct: typeof helpers.structT;\n /** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\n fundamental: typeof helpers.fundamentalT;\n /** Wraps a descriptor in a pointer to it, for an output or inout argument. */\n ref: typeof helpers.refT;\n /** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\n hashTable: typeof helpers.hashTableT;\n /** Builds a descriptor for an enumeration, resolving its GType from the named `get_type` function. */\n enum: typeof helpers.enumT;\n /** Builds a descriptor for a flags type, resolving its GType from the named `get_type` function. */\n flags: typeof helpers.flagsT;\n /** Builds a descriptor for an array of items in one of the supported container layouts. */\n array: typeof helpers.arrayT;\n /** Builds a descriptor for a `GList` of items. */\n list: typeof helpers.listT;\n /** Builds a descriptor for a `GSList` of items. */\n slist: typeof helpers.slistT;\n /** Builds a descriptor for a `GPtrArray` of items. */\n ptrArray: typeof helpers.ptrArrayT;\n /** Builds a descriptor for a `GArray` of items
|
|
1
|
+
{"version":3,"file":"t.js","sourceRoot":"","sources":["../src/t.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAwF7B;;;;GAIG;AACH,MAAM,CAAC,GAAM;IACT,IAAI;IACJ,IAAI,EAAE,OAAO,CAAC,KAAK;IACnB,KAAK,EAAE,OAAO,CAAC,MAAM;IACrB,KAAK,EAAE,OAAO,CAAC,MAAM;IACrB,MAAM,EAAE,OAAO,CAAC,OAAO;IACvB,KAAK,EAAE,OAAO,CAAC,MAAM;IACrB,MA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riptors.js\";\nimport { fn } from \"./fn.js\";\n\n/** The descriptor factories and function binders exposed as {@link t}. */\ntype T = {\n /** Binds a symbol in a shared library to a callable that marshals its arguments and return value. */\n bind: typeof bind;\n /** Descriptor for a `gint8`, marshalled as a number. */\n int8: typeof helpers.int8T;\n /** Descriptor for a `guint8`, marshalled as a number. */\n uint8: typeof helpers.uint8T;\n /** Descriptor for a `gint16`, marshalled as a number. */\n int16: typeof helpers.int16T;\n /** Descriptor for a `guint16`, marshalled as a number. */\n uint16: typeof helpers.uint16T;\n /** Descriptor for a `gint32`, marshalled as a number. */\n int32: typeof helpers.int32T;\n /** Descriptor for a `guint32`, marshalled as a number. */\n uint32: typeof helpers.uint32T;\n /** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\n int64: typeof helpers.int64T;\n /** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\n uint64: typeof helpers.uint64T;\n /** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\n bigint64: typeof helpers.bigint64T;\n /** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\n biguint64: typeof helpers.biguint64T;\n /** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\n gtype: typeof helpers.gtypeT;\n /** Descriptor for a `gfloat`. */\n float32: typeof helpers.float32T;\n /** Descriptor for a `gdouble`. */\n float64: typeof helpers.float64T;\n /** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\n boolean: typeof helpers.booleanT;\n /** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\n void: typeof helpers.voidT;\n /** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\n unichar: typeof helpers.unicharT;\n /** Descriptor for an opaque `gpointer` argument, taken from a typed array's memory or a numeric address. */\n buffer: typeof helpers.bufferT;\n /**\n * Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer\n * used when the string is passed by reference.\n */\n string: typeof helpers.stringT;\n /** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */\n object: typeof helpers.objectT;\n /** Builds a descriptor for a `GBoxed` value of the named type. */\n boxed: typeof helpers.boxedT;\n /** Builds a descriptor for a plain C struct. */\n struct: typeof helpers.structT;\n /** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\n fundamental: typeof helpers.fundamentalT;\n /** Wraps a descriptor in a pointer to it, for an output or inout argument. */\n ref: typeof helpers.refT;\n /** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\n hashTable: typeof helpers.hashTableT;\n /** Builds a descriptor for an enumeration, resolving its GType from the named `get_type` function. */\n enum: typeof helpers.enumT;\n /** Builds a descriptor for a flags type, resolving its GType from the named `get_type` function. */\n flags: typeof helpers.flagsT;\n /** Builds a descriptor for an array of items in one of the supported container layouts. */\n array: typeof helpers.arrayT;\n /** Builds a descriptor for a `GList` of items. */\n list: typeof helpers.listT;\n /** Builds a descriptor for a `GSList` of items. */\n slist: typeof helpers.slistT;\n /** Builds a descriptor for a `GPtrArray` of items. */\n ptrArray: typeof helpers.ptrArrayT;\n /** Builds a descriptor for a `GArray` of items. */\n gArray: typeof helpers.gArrayT;\n /** Builds a descriptor for a `GByteArray`. */\n byteArray: typeof helpers.byteArrayT;\n /** Builds a descriptor for a C array whose length is carried by another argument. */\n sizedArray: typeof helpers.sizedArrayT;\n /** Builds a descriptor for a C array of a fixed length. */\n fixedArray: typeof helpers.fixedArrayT;\n /** Builds a descriptor for an out pointer into the buffer another argument supplied. */\n cursorArray: typeof helpers.cursorArrayT;\n /** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */\n callback: typeof helpers.callbackT;\n /**\n * Binds a native function, wiring up argument directions, `GError` checking, and packing output\n * arguments into the result.\n */\n fn: typeof fn;\n};\n\n/**\n * Type descriptor builder: a collection of factory helpers that describe C types for\n * FFI marshalling, plus `bind` to bind a native function and `fn` to describe a\n * function signature.\n */\nconst t: T = {\n bind,\n int8: helpers.int8T,\n uint8: helpers.uint8T,\n int16: helpers.int16T,\n uint16: helpers.uint16T,\n int32: helpers.int32T,\n uint32: helpers.uint32T,\n int64: helpers.int64T,\n uint64: helpers.uint64T,\n bigint64: helpers.bigint64T,\n biguint64: helpers.biguint64T,\n gtype: helpers.gtypeT,\n float32: helpers.float32T,\n float64: helpers.float64T,\n boolean: helpers.booleanT,\n void: helpers.voidT,\n unichar: helpers.unicharT,\n buffer: helpers.bufferT,\n string: helpers.stringT,\n object: helpers.objectT,\n boxed: helpers.boxedT,\n struct: helpers.structT,\n fundamental: helpers.fundamentalT,\n ref: helpers.refT,\n hashTable: helpers.hashTableT,\n enum: helpers.enumT,\n flags: helpers.flagsT,\n array: helpers.arrayT,\n list: helpers.listT,\n slist: helpers.slistT,\n ptrArray: helpers.ptrArrayT,\n gArray: helpers.gArrayT,\n byteArray: helpers.byteArrayT,\n sizedArray: helpers.sizedArrayT,\n fixedArray: helpers.fixedArrayT,\n cursorArray: helpers.cursorArrayT,\n callback: helpers.callbackT,\n fn,\n};\n\nexport { t };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "FFI runtime the generated GTKX bindings call into: type descriptors, GValue marshalling, signals, GObject lifecycle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"node": ">=24"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@gtkx/
|
|
59
|
-
"@gtkx/
|
|
58
|
+
"@gtkx/utils": "1.2.0",
|
|
59
|
+
"@gtkx/native": "1.2.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@gtkx/vitest": "1.
|
|
62
|
+
"@gtkx/vitest": "1.2.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"release": "tsx ../../scripts/release-package.ts"
|
package/src/closure.ts
CHANGED
|
@@ -40,7 +40,7 @@ const MARSHAL_T = callbackT(
|
|
|
40
40
|
CLOSURE_T,
|
|
41
41
|
MARSHAL_VALUE_T,
|
|
42
42
|
uint32T,
|
|
43
|
-
sizedArrayT(MARSHAL_VALUE_T, N_PARAM_VALUES_INDEX, "borrowed", VALUE_SIZE),
|
|
43
|
+
sizedArrayT(MARSHAL_VALUE_T, N_PARAM_VALUES_INDEX, "borrowed", { elementSize: VALUE_SIZE }),
|
|
44
44
|
uint64T,
|
|
45
45
|
uint64T,
|
|
46
46
|
],
|
package/src/descriptors.ts
CHANGED
|
@@ -116,6 +116,8 @@ type ArrayOptions = {
|
|
|
116
116
|
sizeParamIndex?: number | undefined;
|
|
117
117
|
/** Element count of a fixed-length array. */
|
|
118
118
|
fixedSize?: number | undefined;
|
|
119
|
+
/** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */
|
|
120
|
+
isBytes?: boolean | undefined;
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
/** Where a cursor array's base buffer and total length come from. */
|
|
@@ -360,40 +362,52 @@ const arrayT = (
|
|
|
360
362
|
result.fixedSize = options.fixedSize;
|
|
361
363
|
}
|
|
362
364
|
|
|
365
|
+
if (options?.isBytes === true) {
|
|
366
|
+
result.isBytes = true;
|
|
367
|
+
}
|
|
368
|
+
|
|
363
369
|
return result;
|
|
364
370
|
};
|
|
365
371
|
|
|
366
372
|
/** Builds a descriptor for a `GList` of items. */
|
|
367
|
-
const listT = (
|
|
368
|
-
|
|
373
|
+
const listT = (
|
|
374
|
+
itemDescriptor: Descriptor,
|
|
375
|
+
ownership: Ownership = "borrowed",
|
|
376
|
+
options: ArrayOptions = {},
|
|
377
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "glist", ownership, options);
|
|
369
378
|
|
|
370
379
|
/** Builds a descriptor for a `GSList` of items. */
|
|
371
|
-
const slistT = (
|
|
372
|
-
|
|
380
|
+
const slistT = (
|
|
381
|
+
itemDescriptor: Descriptor,
|
|
382
|
+
ownership: Ownership = "borrowed",
|
|
383
|
+
options: ArrayOptions = {},
|
|
384
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "gslist", ownership, options);
|
|
373
385
|
|
|
374
386
|
/** Builds a descriptor for a `GPtrArray` of items. */
|
|
375
|
-
const ptrArrayT = (
|
|
376
|
-
|
|
387
|
+
const ptrArrayT = (
|
|
388
|
+
itemDescriptor: Descriptor,
|
|
389
|
+
ownership: Ownership = "borrowed",
|
|
390
|
+
options: ArrayOptions = {},
|
|
391
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "gptrarray", ownership, options);
|
|
377
392
|
|
|
378
|
-
/** Builds a descriptor for a `GArray` of items
|
|
393
|
+
/** Builds a descriptor for a `GArray` of items. */
|
|
379
394
|
const gArrayT = (
|
|
380
395
|
itemDescriptor: Descriptor,
|
|
381
396
|
ownership: Ownership = "borrowed",
|
|
382
|
-
|
|
383
|
-
): ArrayDescriptor =>
|
|
384
|
-
arrayT(itemDescriptor, "garray", ownership, elementSize === undefined ? undefined : { elementSize });
|
|
397
|
+
options: ArrayOptions = {},
|
|
398
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "garray", ownership, options);
|
|
385
399
|
|
|
386
400
|
/** Builds a descriptor for a `GByteArray`. */
|
|
387
401
|
const byteArrayT = (ownership: Ownership = "borrowed"): ArrayDescriptor =>
|
|
388
|
-
arrayT(uint8T, "gbytearray", ownership);
|
|
402
|
+
arrayT(uint8T, "gbytearray", ownership, { isBytes: true });
|
|
389
403
|
|
|
390
404
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
391
405
|
const sizedArrayT = (
|
|
392
406
|
itemDescriptor: Descriptor,
|
|
393
407
|
sizeParamIndex: number,
|
|
394
408
|
ownership: Ownership = "borrowed",
|
|
395
|
-
|
|
396
|
-
): ArrayDescriptor => arrayT(itemDescriptor, "sized", ownership, {
|
|
409
|
+
options: ArrayOptions = {},
|
|
410
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "sized", ownership, { ...options, sizeParamIndex });
|
|
397
411
|
|
|
398
412
|
/**
|
|
399
413
|
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
@@ -403,16 +417,16 @@ const cursorArrayT = (
|
|
|
403
417
|
itemDescriptor: Descriptor,
|
|
404
418
|
bounds: CursorBounds,
|
|
405
419
|
ownership: Ownership = "borrowed",
|
|
406
|
-
|
|
407
|
-
): ArrayDescriptor => arrayT(itemDescriptor, "cursor", ownership, { ...
|
|
420
|
+
options: ArrayOptions = {},
|
|
421
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "cursor", ownership, { ...options, ...bounds });
|
|
408
422
|
|
|
409
423
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
410
424
|
const fixedArrayT = (
|
|
411
425
|
itemDescriptor: Descriptor,
|
|
412
426
|
fixedSize: number,
|
|
413
427
|
ownership: Ownership = "borrowed",
|
|
414
|
-
|
|
415
|
-
): ArrayDescriptor => arrayT(itemDescriptor, "fixed", ownership, {
|
|
428
|
+
options: ArrayOptions = {},
|
|
429
|
+
): ArrayDescriptor => arrayT(itemDescriptor, "fixed", ownership, { ...options, fixedSize });
|
|
416
430
|
|
|
417
431
|
const applyClosureOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {
|
|
418
432
|
if (options.hasDestroy !== undefined) {
|
package/src/register-class.ts
CHANGED
|
@@ -61,7 +61,7 @@ type Camelized<TName extends string> = TName extends `${infer THead}-${infer TTa
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* The names a registered class carries in its property map: every key of
|
|
64
|
-
* `RegisterClassOptions.properties` in camelCase, whichever
|
|
64
|
+
* `RegisterClassOptions.properties` in camelCase, whichever spelling it was written in.
|
|
65
65
|
* A `properties` object given a type of its own rather than left to inference has `string` for its key
|
|
66
66
|
* type and names nothing, because a name only known as `string` addresses no member in particular.
|
|
67
67
|
*/
|
|
@@ -129,7 +129,7 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
129
129
|
* A write the ParamSpec would refuse throws rather than reaching GObject, which reports such a
|
|
130
130
|
* write as a GLib critical and drops it: a `TypeError` for a read-only or construct-only
|
|
131
131
|
* property and for a value of a type the property cannot hold, and a `RangeError` for a value
|
|
132
|
-
* the ParamSpec rejects. The same
|
|
132
|
+
* the ParamSpec rejects. The same checks run over a value handed to the constructor, where
|
|
133
133
|
* a construct-only property is the one that is writable. An accepted write emits one `notify`,
|
|
134
134
|
* which a `freeze_notify` batch collects; a write of the value the property already holds is
|
|
135
135
|
* dropped and emits none.
|
|
@@ -165,7 +165,7 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
165
165
|
* write of `null` to that member both land 0, where a `gint` installed here refuses both.
|
|
166
166
|
*
|
|
167
167
|
* A class that defines the camelCase member itself owns the property: its own accessor decides
|
|
168
|
-
* what a write means, the other
|
|
168
|
+
* what a write means, the other spellings forward to it, and the type's property slots read
|
|
169
169
|
* and write it rather than the generated storage.
|
|
170
170
|
*/
|
|
171
171
|
properties?: TProperties;
|
package/src/registry.ts
CHANGED
|
@@ -11,12 +11,13 @@ import type { Mixin, MixinReceiver } from "./mixin.js";
|
|
|
11
11
|
import { TYPE_INVALID, type TypedClass, typeInterfaces, typeIsA, typeName, typeParent } from "./type.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Static side of class `C` with its construct signature preserved but the
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Static side of class `C` with its construct signature preserved but the members named `K`
|
|
15
|
+
* removed. A generated class lists every static it declares itself, so a static it narrows never
|
|
16
|
+
* has to stay assignable to the one it shadows. The signature is kept abstract so an abstract `C`
|
|
17
|
+
* survives it: a subclass extends the result, and only the subclass's own declarations decide
|
|
18
|
+
* which statics reach it.
|
|
18
19
|
*/
|
|
19
|
-
type StaticBase<C, K extends PropertyKey
|
|
20
|
+
type StaticBase<C, K extends PropertyKey> = Omit<C, K> &
|
|
20
21
|
(C extends abstract new (...args: infer A) => infer R ? abstract new (...args: A) => R : never);
|
|
21
22
|
|
|
22
23
|
/** One overridable vtable slot: where it sits in the vtable struct and how it is marshalled. */
|
package/src/t.ts
CHANGED
|
@@ -69,7 +69,7 @@ type T = {
|
|
|
69
69
|
slist: typeof helpers.slistT;
|
|
70
70
|
/** Builds a descriptor for a `GPtrArray` of items. */
|
|
71
71
|
ptrArray: typeof helpers.ptrArrayT;
|
|
72
|
-
/** Builds a descriptor for a `GArray` of items
|
|
72
|
+
/** Builds a descriptor for a `GArray` of items. */
|
|
73
73
|
gArray: typeof helpers.gArrayT;
|
|
74
74
|
/** Builds a descriptor for a `GByteArray`. */
|
|
75
75
|
byteArray: typeof helpers.byteArrayT;
|