@gtkx/runtime 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -40
- package/dist/descriptors.d.ts +2 -1
- package/dist/descriptors.d.ts.map +1 -1
- package/dist/descriptors.js +5 -1
- package/dist/descriptors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +17 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +13 -0
- package/dist/internal.js.map +1 -1
- package/dist/lifecycle.js +1 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/listeners.d.ts +3 -13
- package/dist/listeners.d.ts.map +1 -1
- package/dist/listeners.js +12 -12
- package/dist/listeners.js.map +1 -1
- package/dist/mixin.d.ts +5 -3
- package/dist/mixin.d.ts.map +1 -1
- package/dist/mixin.js +36 -9
- package/dist/mixin.js.map +1 -1
- package/dist/object.d.ts +14 -3
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +20 -27
- package/dist/object.js.map +1 -1
- package/dist/properties.d.ts +4 -2
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +69 -16
- package/dist/properties.js.map +1 -1
- package/dist/property-brand.d.ts +5 -0
- package/dist/property-brand.d.ts.map +1 -0
- package/dist/property-brand.js +5 -0
- package/dist/property-brand.js.map +1 -0
- package/dist/register-class.d.ts +102 -20
- package/dist/register-class.d.ts.map +1 -1
- package/dist/register-class.js +19 -37
- package/dist/register-class.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -4
- package/dist/registry.js.map +1 -1
- package/dist/signal-brand.d.ts +12 -0
- package/dist/signal-brand.d.ts.map +1 -0
- package/dist/signal-brand.js +6 -0
- package/dist/signal-brand.js.map +1 -0
- package/dist/signal.d.ts +39 -2
- package/dist/signal.d.ts.map +1 -1
- package/dist/signal.js +75 -5
- package/dist/signal.js.map +1 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js +1 -1
- package/dist/type.js.map +1 -1
- package/dist/value.d.ts +2 -1
- package/dist/value.d.ts.map +1 -1
- package/dist/value.js +28 -7
- package/dist/value.js.map +1 -1
- package/package.json +7 -5
- package/src/descriptors.ts +7 -0
- package/src/index.ts +2 -2
- package/src/internal.ts +42 -0
- package/src/lifecycle.ts +1 -1
- package/src/listeners.ts +21 -26
- package/src/mixin.ts +55 -9
- package/src/object.ts +57 -7
- package/src/properties.ts +94 -17
- package/src/property-brand.ts +5 -0
- package/src/register-class.ts +296 -95
- package/src/registry.ts +4 -4
- package/src/signal-brand.ts +29 -0
- package/src/signal.ts +177 -6
- package/src/type.ts +1 -1
- package/src/value.ts +40 -5
package/dist/properties.js
CHANGED
|
@@ -23,7 +23,7 @@ const paramSpecDefaultValue = bind(LIB, "g_param_spec_get_default_value", [PARAM
|
|
|
23
23
|
const paramSpecName = bind(LIB, "g_param_spec_get_name", [PARAM_T], stringT("borrowed"));
|
|
24
24
|
const typeClassRef = bind(LIB, "g_type_class_ref", [biguint64T], CLASS_T);
|
|
25
25
|
const typeClassUnref = bind(LIB, "g_type_class_unref", [CLASS_T], voidT);
|
|
26
|
-
const
|
|
26
|
+
const propertyChecks = new Map();
|
|
27
27
|
const classFindProperty = bind(LIB, "g_object_class_find_property", [CLASS_T, stringT("borrowed")], PARAM_T);
|
|
28
28
|
const classListProperties = bind(LIB, "g_object_class_list_properties", [CLASS_T, refT(uint32T)], sizedArrayT(PARAM_T, 1, "full"));
|
|
29
29
|
const defaultInterfaceRef = bind(LIB, "g_type_default_interface_ref", [biguint64T], CLASS_T);
|
|
@@ -105,7 +105,10 @@ const findSourceSpec = (source, name) => {
|
|
|
105
105
|
* @param source The GType, wrapper class or interface declaring the property.
|
|
106
106
|
* @returns Handle of the override spec.
|
|
107
107
|
*/
|
|
108
|
-
const newParamSpecOverride = (name, source) =>
|
|
108
|
+
const newParamSpecOverride = (name, source) => {
|
|
109
|
+
const canonicalName = canonicalCase(name);
|
|
110
|
+
return paramSpecOverrideNew(canonicalName, findSourceSpec(source, canonicalName));
|
|
111
|
+
};
|
|
109
112
|
function describeValue(value) {
|
|
110
113
|
if (typeof value === "string") {
|
|
111
114
|
return JSON.stringify(value);
|
|
@@ -151,6 +154,18 @@ function assertWritable(instance, check, value) {
|
|
|
151
154
|
}
|
|
152
155
|
throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, READ_ONLY_REASON)));
|
|
153
156
|
}
|
|
157
|
+
function assertReadable(instance, check) {
|
|
158
|
+
if (isParamReadable(check.flags)) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
throw new TypeError(propertyMessage(instance, check, `cannot read property '${check.propertyName}'; the property is write-only`));
|
|
162
|
+
}
|
|
163
|
+
function assertMutable(instance, check, value) {
|
|
164
|
+
assertWritable(instance, check, value);
|
|
165
|
+
if (isParamConstructOnly(check.flags)) {
|
|
166
|
+
throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, CONSTRUCT_ONLY_REASON)));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
154
169
|
function writeHeld(check, gValue, value) {
|
|
155
170
|
check.write ??= valueWriterFor(check.valueType);
|
|
156
171
|
check.write(gValue, check.narrowValue(value));
|
|
@@ -187,7 +202,7 @@ function isReadableProperty(gtype, propertyName) {
|
|
|
187
202
|
typeClassUnref(klass);
|
|
188
203
|
}
|
|
189
204
|
}
|
|
190
|
-
function
|
|
205
|
+
function lookupPropertyCheck(gtype, name) {
|
|
191
206
|
const klass = typeClassRef(gtype);
|
|
192
207
|
try {
|
|
193
208
|
const pspec = findPropertySpec(klass, name);
|
|
@@ -197,9 +212,27 @@ function lookupCoercionCheck(gtype, name) {
|
|
|
197
212
|
typeClassUnref(klass);
|
|
198
213
|
}
|
|
199
214
|
}
|
|
200
|
-
function
|
|
201
|
-
const checks =
|
|
202
|
-
return checks.getOrInsertComputed(name, () =>
|
|
215
|
+
function propertyCheckFor(gtype, name) {
|
|
216
|
+
const checks = propertyChecks.getOrInsertComputed(gtype, () => new Map());
|
|
217
|
+
return checks.getOrInsertComputed(name, () => lookupPropertyCheck(gtype, name));
|
|
218
|
+
}
|
|
219
|
+
function objectPropertyCheckFor(instance, name) {
|
|
220
|
+
const gtype = getInstanceType(instance);
|
|
221
|
+
const check = typeIsA(gtype, TYPE_OBJECT) ? propertyCheckFor(gtype, name) : null;
|
|
222
|
+
if (check === null) {
|
|
223
|
+
throw new TypeError(`${instanceClassName(instance)} has no GObject property named '${name}'`);
|
|
224
|
+
}
|
|
225
|
+
return check;
|
|
226
|
+
}
|
|
227
|
+
function readableObjectPropertyFor(instance, name) {
|
|
228
|
+
const check = objectPropertyCheckFor(instance, name);
|
|
229
|
+
assertReadable(instance, check);
|
|
230
|
+
return { name: check.propertyName, value: newValueForType(check.valueType) };
|
|
231
|
+
}
|
|
232
|
+
function writableObjectPropertyFor(instance, name, value) {
|
|
233
|
+
const check = objectPropertyCheckFor(instance, name);
|
|
234
|
+
assertMutable(instance, check, value);
|
|
235
|
+
return { name: check.propertyName, value: checkedValueFor(instance, check, value) };
|
|
203
236
|
}
|
|
204
237
|
function truncateToWhole(check, value) {
|
|
205
238
|
const range = WHOLE_NUMBER_RANGES.get(typeFundamental(check.valueType));
|
|
@@ -226,7 +259,7 @@ function coercePropertyValue(gtype, propertyName, value) {
|
|
|
226
259
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
227
260
|
return value;
|
|
228
261
|
}
|
|
229
|
-
const check =
|
|
262
|
+
const check = propertyCheckFor(gtype, propertyName);
|
|
230
263
|
return check === null ? value : coerceNumber(check, value);
|
|
231
264
|
}
|
|
232
265
|
/**
|
|
@@ -314,23 +347,39 @@ function checkedSetter(accessor) {
|
|
|
314
347
|
writeProperty(this, accessor, value);
|
|
315
348
|
};
|
|
316
349
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
350
|
+
function memberDescriptorFor(prototype, name) {
|
|
351
|
+
let current = prototype;
|
|
352
|
+
while (current !== null) {
|
|
353
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, name);
|
|
354
|
+
if (descriptor !== undefined) {
|
|
355
|
+
return descriptor;
|
|
356
|
+
}
|
|
357
|
+
current = Reflect.getPrototypeOf(current);
|
|
358
|
+
}
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
function isMemberAccessor(descriptor) {
|
|
362
|
+
return descriptor !== undefined && ("get" in descriptor || "set" in descriptor);
|
|
319
363
|
}
|
|
320
364
|
function defineAccessor(prototype, descriptor, alias) {
|
|
321
|
-
if (
|
|
365
|
+
if (Object.getOwnPropertyDescriptor(prototype, alias) !== undefined) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const parent = Reflect.getPrototypeOf(prototype);
|
|
369
|
+
const inherited = parent === null ? undefined : memberDescriptorFor(parent, alias);
|
|
370
|
+
if (inherited !== undefined && !isMemberAccessor(inherited)) {
|
|
322
371
|
return;
|
|
323
372
|
}
|
|
324
373
|
Object.defineProperty(prototype, alias, descriptor);
|
|
325
374
|
}
|
|
326
375
|
function installAccessors(klass, accessor) {
|
|
327
376
|
const prototype = klass.prototype;
|
|
328
|
-
accessor.
|
|
377
|
+
accessor.hasMemberAccessor = isMemberAccessor(Object.getOwnPropertyDescriptor(prototype, accessor.memberName));
|
|
329
378
|
const descriptor = {
|
|
330
379
|
configurable: true,
|
|
331
380
|
enumerable: true,
|
|
332
|
-
get: accessor.
|
|
333
|
-
set: accessor.
|
|
381
|
+
get: accessor.hasMemberAccessor ? memberGetter(accessor) : storedGetter(accessor),
|
|
382
|
+
set: accessor.hasMemberAccessor ? memberSetter(accessor) : checkedSetter(accessor),
|
|
334
383
|
};
|
|
335
384
|
for (const alias of accessorNames(accessor.name)) {
|
|
336
385
|
defineAccessor(prototype, descriptor, alias);
|
|
@@ -376,7 +425,11 @@ function callMember(instance, member, args) {
|
|
|
376
425
|
return fn.apply(instance, args);
|
|
377
426
|
}
|
|
378
427
|
function backingMemberFor(instance, accessor) {
|
|
379
|
-
if (accessor.
|
|
428
|
+
if (accessor.hasMemberAccessor) {
|
|
429
|
+
return accessor.memberName;
|
|
430
|
+
}
|
|
431
|
+
const descriptor = Object.getOwnPropertyDescriptor(instance, accessor.memberName);
|
|
432
|
+
if (descriptor === undefined || ("value" in descriptor && typeof descriptor.value === "function")) {
|
|
380
433
|
return undefined;
|
|
381
434
|
}
|
|
382
435
|
return accessor.memberName;
|
|
@@ -451,7 +504,7 @@ function buildAccessor(klass, name, pspec) {
|
|
|
451
504
|
...checkFor(getHandle(pspec), name),
|
|
452
505
|
memberName: camelCase(name),
|
|
453
506
|
storage: Symbol(`gtkx:property:${name}`),
|
|
454
|
-
|
|
507
|
+
hasMemberAccessor: false,
|
|
455
508
|
};
|
|
456
509
|
installAccessors(klass, accessor);
|
|
457
510
|
return accessor;
|
|
@@ -504,5 +557,5 @@ function toNativeProperties(properties) {
|
|
|
504
557
|
pspec: getHandle(pspec),
|
|
505
558
|
}));
|
|
506
559
|
}
|
|
507
|
-
export { buildPropertyDispatch, coerceObjectProperty, getDeclaredPropertyName, isReadableProperty, coercePropertyValue, constructPropertyFor, GET_PROPERTY_VFUNC, makeGetProperty, makeSetProperty, newParamSpecOverride, SET_PROPERTY_VFUNC, toNativeProperties, };
|
|
560
|
+
export { buildPropertyDispatch, coerceObjectProperty, getDeclaredPropertyName, isReadableProperty, coercePropertyValue, constructPropertyFor, GET_PROPERTY_VFUNC, makeGetProperty, makeSetProperty, newParamSpecOverride, readableObjectPropertyFor, SET_PROPERTY_VFUNC, toNativeProperties, writableObjectPropertyFor, };
|
|
508
561
|
//# sourceMappingURL=properties.js.map
|
package/dist/properties.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,SAAS,EAAE,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,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;AAC/F,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAc,EAAE,QAAgB;IAC7D,MAAM,QAAQ,GAAI,MAAuC,CAAC,cAAc,CAE3D,CAAC;IAEd,OAAO,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAwC;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACpD,EAAE,EAAE,KAAK,GAAG,iBAAiB;QAC7B,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,OAAO,EACH,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GAIrB,CAAC","sourcesContent":["import type { ExternalObject, Handle, RegisterClassProperty } from \"@gtkx/native\";\nimport { type AnyClass, camelCase, kebabCase, toCamelIdentifier } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { biguint64T, fundamentalT, refT, sizedArrayT, stringT, structT, uint32T, voidT } from \"./descriptors.js\";\nimport { LIB, PARAM_T, VALUE_T } from \"./library.js\";\nimport {\n getParamFlags,\n getParamValueType,\n isParamConstructOnly,\n isParamExplicitlyNotified,\n isParamLaxlyValidated,\n isParamReadable,\n isParamWritable,\n type ValueGuard,\n valueGuardFor,\n wasParamValueModified,\n WHOLE_NUMBER_RANGES,\n} from \"./param-spec.js\";\nimport {\n getClassType,\n getHandle,\n getInstanceType,\n getInterfaceProperties,\n instanceClassName,\n type InterfaceProperty,\n} from \"./registry.js\";\nimport { TYPE_INTERFACE, TYPE_INVALID, TYPE_OBJECT, typeFundamental, typeIsA, typeName } from \"./type.js\";\nimport {\n fromValue,\n newValueForType,\n valueGuardOverrideFor,\n type ValueNarrower,\n valueNarrowerFor,\n type ValueWriter,\n valueWriterFor,\n} from \"./value.js\";\n\ntype PropertyCheck = {\n name: string;\n propertyName: string;\n handle: ExternalObject<Handle>;\n flags: number;\n valueType: bigint;\n canHoldValue: ValueGuard;\n narrowValue: ValueNarrower;\n write?: ValueWriter;\n scratch?: ExternalObject<Handle>;\n};\n\ntype AccessorBase = PropertyCheck & {\n storage: symbol;\n delegate?: InterfaceProperty;\n};\n\ntype DeclaredAccessor = AccessorBase & {\n isInterfaceProperty?: false;\n memberName: string;\n hasGeneratedMember: boolean;\n};\n\ntype InterfaceAccessor = AccessorBase & { isInterfaceProperty: true };\ntype PropertyAccessor = DeclaredAccessor | InterfaceAccessor;\n/** A `GObject.ParamSpec` wrapper describing one property's name, type, flags and default. */\ntype PropertySpec = object;\n\ntype PropertyDispatch = {\n accessors: PropertyAccessor[];\n delegates: Map<string, InterfaceProperty>;\n};\n\ntype PropertyDispatchSource = {\n klass: AnyClass;\n properties: Record<string, PropertySpec>;\n adoptedTypes: bigint[];\n};\n\ntype ConstructProperty = {\n name: string;\n value: ExternalObject<Handle>;\n};\n\ntype NotifyingObject = { notify?: (propertyName: string) => void };\n\nconst FIRST_PROPERTY_ID = 1;\nconst GET_PROPERTY_VFUNC = \"vfuncGetProperty\";\nconst SET_PROPERTY_VFUNC = \"vfuncSetProperty\";\nconst READ_ONLY_REASON = \"the property is read-only\";\nconst CONSTRUCT_ONLY_REASON = \"the property can only be set when the object is constructed\";\nconst CLASS_T = structT(\"borrowed\");\nconst CANONICAL_NAME_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nconst DECLARED_NAMES = Symbol(\"gtkx:declaredPropertyNames\");\n\nconst OVERRIDE_PARAM_T = fundamentalT(LIB, \"g_param_spec_ref_sink\", \"g_param_spec_unref\", {\n ownership: \"borrowed\",\n typeName: \"GParam\",\n});\n\nconst interfaceStorages: Map<string, symbol> = new Map();\nconst paramSpecDefaultValue = bind(LIB, \"g_param_spec_get_default_value\", [PARAM_T], VALUE_T);\nconst paramSpecName = bind(LIB, \"g_param_spec_get_name\", [PARAM_T], stringT(\"borrowed\"));\nconst typeClassRef = bind(LIB, \"g_type_class_ref\", [biguint64T], CLASS_T);\nconst typeClassUnref = bind(LIB, \"g_type_class_unref\", [CLASS_T], voidT);\nconst coercionChecks: Map<bigint, Map<string, PropertyCheck | null>> = new Map();\nconst classFindProperty = bind(LIB, \"g_object_class_find_property\", [CLASS_T, stringT(\"borrowed\")], PARAM_T);\n\nconst classListProperties = bind(\n LIB,\n \"g_object_class_list_properties\",\n [CLASS_T, refT(uint32T)],\n sizedArrayT(PARAM_T, 1, \"full\"),\n);\n\nconst defaultInterfaceRef = bind(LIB, \"g_type_default_interface_ref\", [biguint64T], CLASS_T);\nconst defaultInterfaceUnref = bind(LIB, \"g_type_default_interface_unref\", [CLASS_T], voidT);\nconst interfaceFindProperty = bind(LIB, \"g_object_interface_find_property\", [CLASS_T, stringT(\"borrowed\")], PARAM_T);\nconst paramSpecOverrideNew = bind(LIB, \"g_param_spec_override\", [stringT(\"borrowed\"), PARAM_T], OVERRIDE_PARAM_T);\n\nconst getPropertyName = (pspec: PropertySpec): string => paramSpecName(getHandle(pspec)) as string;\nconst underscoreCase = (name: string): string => name.replaceAll(\"-\", \"_\");\nconst canonicalCase = (name: string): string => kebabCase(name).replaceAll(\"_\", \"-\");\nconst accessorNames = (name: string): string[] => [...new Set([name, underscoreCase(name), camelCase(name)])];\nconst typeLabel = (type: bigint): string => typeName(type) ?? String(type);\n\nconst defaultValueFor = (handle: ExternalObject<Handle>): ExternalObject<Handle> =>\n paramSpecDefaultValue(handle) as ExternalObject<Handle>;\n\nconst heldValue = (value: unknown): unknown => value ?? null;\n\nconst holdsReason = (check: PropertyCheck): string =>\n `the property holds values of type '${typeLabel(check.valueType)}'`;\n\nfunction checkFor(handle: ExternalObject<Handle>, name: string): PropertyCheck {\n const valueType = getParamValueType(handle);\n\n return {\n name,\n propertyName: paramSpecName(handle) as string,\n handle,\n flags: getParamFlags(handle),\n valueType,\n canHoldValue: valueGuardOverrideFor(valueType) ?? valueGuardFor(valueType),\n narrowValue: valueNarrowerFor(valueType),\n };\n}\n\nfunction accessorSpecs(klass: ExternalObject<Handle>): Map<string, ExternalObject<Handle>> {\n const specs: Map<string, ExternalObject<Handle>> = new Map();\n const countRef = { value: 0 };\n\n for (const pspec of classListProperties(klass, countRef) as ExternalObject<Handle>[]) {\n specs.set(toCamelIdentifier(paramSpecName(pspec) as string), pspec);\n }\n\n return specs;\n}\n\nfunction findPropertySpec(klass: ExternalObject<Handle>, name: string): ExternalObject<Handle> | null {\n const found = (classFindProperty(klass, name) ??\n classFindProperty(klass, canonicalCase(name))) as ExternalObject<Handle> | null;\n\n return found ?? accessorSpecs(klass).get(toCamelIdentifier(name)) ?? null;\n}\n\nconst sourceLabel = (source: bigint | AnyClass, gtype: bigint): string =>\n typeName(gtype) ?? (typeof source === \"function\" ? source.name : String(source));\n\nconst findInterfaceSpec = (gtype: bigint, name: string): ExternalObject<Handle> | null => {\n const vtable = defaultInterfaceRef(gtype) as ExternalObject<Handle>;\n\n try {\n return interfaceFindProperty(vtable, name) as ExternalObject<Handle> | null;\n } finally {\n defaultInterfaceUnref(vtable);\n }\n};\n\nconst findClassSpec = (gtype: bigint, name: string): ExternalObject<Handle> | null => {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n return classFindProperty(klass, name) as ExternalObject<Handle> | null;\n } finally {\n typeClassUnref(klass);\n }\n};\n\nconst findSourceSpec = (source: bigint | AnyClass, name: string): ExternalObject<Handle> => {\n const gtype = typeof source === \"bigint\" ? source : getClassType(source);\n const isInterface = typeIsA(gtype, TYPE_INTERFACE);\n\n if (!isInterface && !typeIsA(gtype, TYPE_OBJECT)) {\n throw new TypeError(\n `paramSpecOverride: '${sourceLabel(source, gtype)}' is neither a registered object class nor an interface`,\n );\n }\n\n const pspec = isInterface ? findInterfaceSpec(gtype, name) : findClassSpec(gtype, name);\n\n if (pspec === null) {\n throw new TypeError(`paramSpecOverride: type '${sourceLabel(source, gtype)}' has no property named '${name}'`);\n }\n\n return pspec;\n};\n\n/**\n * Creates the handle of a `GParamSpec` that redirects to the property `source` declares under\n * `name` — the equivalent of `g_param_spec_override`, which introspection does not expose.\n *\n * Throws when `source` is neither a GType nor a registered class or interface, and when it\n * declares no property under `name`.\n *\n * @param name Canonical name of the property to override.\n * @param source The GType, wrapper class or interface declaring the property.\n * @returns Handle of the override spec.\n */\nconst newParamSpecOverride = (name: string, source: bigint | AnyClass): ExternalObject<Handle> =>\n paramSpecOverrideNew(name, findSourceSpec(source, name)) as ExternalObject<Handle>;\n\nfunction describeValue(value: unknown): string {\n if (typeof value === \"string\") {\n return JSON.stringify(value);\n }\n\n if (typeof value === \"object\" && value !== null) {\n return instanceClassName(value);\n }\n\n return String(value);\n}\n\nfunction propertyMessage(instance: object, check: PropertyCheck, tail: string): string {\n return `${instanceClassName(instance)}.${check.name}: ${tail}`;\n}\n\nfunction refusalTail(check: PropertyCheck, value: unknown, reason: string): string {\n return `cannot set property '${check.propertyName}' to ${describeValue(value)}; ${reason}`;\n}\n\nfunction serveTail(check: PropertyCheck, value: unknown): string {\n return `cannot serve property '${check.propertyName}' from ${describeValue(value)}; ${holdsReason(check)}`;\n}\n\nfunction assertValueFits(instance: object, check: PropertyCheck, value: unknown): void {\n if (check.canHoldValue(value)) {\n return;\n }\n\n const tail = refusalTail(check, value, holdsReason(check));\n throw new TypeError(propertyMessage(instance, check, tail));\n}\n\nfunction assertValueServes(instance: object, check: PropertyCheck, value: unknown): void {\n if (check.canHoldValue(value)) {\n return;\n }\n\n throw new TypeError(propertyMessage(instance, check, serveTail(check, value)));\n}\n\nfunction assertValueValidates(\n instance: object,\n check: PropertyCheck,\n value: unknown,\n gValue: ExternalObject<Handle>,\n): void {\n if (!wasParamValueModified(check.handle, gValue) || isParamLaxlyValidated(check.flags)) {\n return;\n }\n\n const reason =\n `the value is invalid or out of range for type '${typeLabel(check.valueType)}', ` +\n `and GObject would put ${describeValue(fromValue(gValue))} in its place`;\n\n throw new RangeError(propertyMessage(instance, check, refusalTail(check, value, reason)));\n}\n\nfunction assertWritable(instance: object, check: PropertyCheck, value: unknown): void {\n if (isParamWritable(check.flags)) {\n return;\n }\n\n throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, READ_ONLY_REASON)));\n}\n\nfunction writeHeld(check: PropertyCheck, gValue: ExternalObject<Handle>, value: unknown): void {\n check.write ??= valueWriterFor(check.valueType);\n check.write(gValue, check.narrowValue(value));\n}\n\nfunction fillCheckedValue(\n instance: object,\n check: PropertyCheck,\n gValue: ExternalObject<Handle>,\n value: unknown,\n): void {\n assertValueFits(instance, check, value);\n writeHeld(check, gValue, value);\n assertValueValidates(instance, check, value, gValue);\n}\n\nfunction checkedValueFor(instance: object, check: PropertyCheck, value: unknown): ExternalObject<Handle> {\n const gValue = newValueForType(check.valueType);\n fillCheckedValue(instance, check, gValue, value);\n\n return gValue;\n}\n\nfunction assertValueAccepted(instance: object, check: PropertyCheck, value: unknown): void {\n check.scratch ??= newValueForType(check.valueType);\n fillCheckedValue(instance, check, check.scratch, value);\n}\n\nfunction constructValueFor(wrapper: object, check: PropertyCheck, value: unknown): ConstructProperty {\n assertWritable(wrapper, check, value);\n\n return { name: check.propertyName, value: checkedValueFor(wrapper, check, value) };\n}\n\n/**\n * Whether the type declares a readable GObject property under `propertyName`, asking GObject itself\n * rather than looking for a generated accessor, which codegen omits when a method shares the name.\n */\nfunction isReadableProperty(gtype: bigint, propertyName: string): boolean {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, propertyName);\n\n return pspec !== null && isParamReadable(getParamFlags(pspec));\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction lookupCoercionCheck(gtype: bigint, name: string): PropertyCheck | null {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, name);\n\n return pspec === null ? null : checkFor(pspec, name);\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction coercionCheckFor(gtype: bigint, name: string): PropertyCheck | null {\n const checks = coercionChecks.getOrInsertComputed(gtype, () => new Map<string, PropertyCheck | null>());\n\n return checks.getOrInsertComputed(name, () => lookupCoercionCheck(gtype, name));\n}\n\nfunction truncateToWhole(check: PropertyCheck, value: number): number {\n const range = WHOLE_NUMBER_RANGES.get(typeFundamental(check.valueType));\n\n if (range === undefined) {\n return value;\n }\n\n return Math.min(range[1], Math.max(range[0], Math.trunc(value)));\n}\n\nfunction validatedNumber(check: PropertyCheck, number: number): number {\n check.scratch ??= newValueForType(check.valueType);\n\n try {\n writeHeld(check, check.scratch, number);\n } catch {\n return number;\n }\n\n return wasParamValueModified(check.handle, check.scratch) ? (fromValue(check.scratch) as number) : number;\n}\n\nfunction coerceNumber(check: PropertyCheck, value: number): number {\n const number = truncateToWhole(check, value);\n\n return check.canHoldValue(number) ? validatedNumber(check, number) : value;\n}\n\nfunction coercePropertyValue(gtype: bigint, propertyName: string, value: unknown): unknown {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return value;\n }\n\n const check = coercionCheckFor(gtype, propertyName);\n\n return check === null ? value : coerceNumber(check, value);\n}\n\n/**\n * Fits a number to what a GObject property accepts, the way an animation writing a value on every\n * frame needs: a fractional number headed for a property that holds whole numbers, such as a\n * `gint`, an enum, or flags, is truncated toward zero, and a number outside the range the\n * property's `GObject.ParamSpec` allows is clamped to it, so the write that follows never trips\n * GObject's range check. Anything that is not a finite number, a number the property cannot hold\n * at all, and a name the object installs no property under come back unchanged.\n *\n * @param obj The object the value is about to be written to.\n * @param propertyName The property name, dashed or camelCased.\n * @param value The value about to be written.\n * @returns The value as the property accepts it.\n */\nfunction coerceObjectProperty(obj: object, propertyName: string, value: unknown): unknown {\n if (typeof value !== \"number\") {\n return value;\n }\n\n const gtype = getInstanceType(obj);\n\n return gtype === TYPE_INVALID ? value : coercePropertyValue(gtype, propertyName, value);\n}\n\nfunction constructPropertyFor(\n gtype: bigint,\n name: string,\n value: unknown,\n wrapper: object,\n): ConstructProperty | undefined {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, name);\n\n return pspec === null ? undefined : constructValueFor(wrapper, checkFor(pspec, name), value);\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction readStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor): unknown {\n if (!Object.hasOwn(instance, accessor.storage)) {\n instance[accessor.storage] = fromValue(defaultValueFor(accessor.handle));\n }\n\n return instance[accessor.storage];\n}\n\nfunction storeValue(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n instance[accessor.storage] = heldValue(value);\n}\n\nfunction writeStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n if (readStored(instance, accessor) === heldValue(value)) {\n return;\n }\n\n storeValue(instance, accessor, value);\n (instance as NotifyingObject).notify?.(accessor.propertyName);\n}\n\nfunction writeProperty(instance: object, accessor: PropertyAccessor, value: unknown): void {\n const stored = instance as Record<symbol, unknown>;\n\n if (readStored(stored, accessor) === heldValue(value)) {\n return;\n }\n\n assertValueAccepted(instance, accessor, value);\n writeStored(stored, accessor, accessor.narrowValue(value));\n}\n\nfunction storedGetter(accessor: PropertyAccessor): (this: object) => unknown {\n return function get(this: object) {\n return readStored(this as Record<symbol, unknown>, accessor);\n };\n}\n\nfunction memberGetter(accessor: DeclaredAccessor): (this: object) => unknown {\n return function get(this: object) {\n return (this as Record<string, unknown>)[accessor.memberName];\n };\n}\n\nfunction memberSetter(accessor: DeclaredAccessor): (this: object, value: unknown) => void {\n return function set(this: object, value: unknown) {\n (this as Record<string, unknown>)[accessor.memberName] = value;\n };\n}\n\nfunction refusalFor(accessor: PropertyAccessor, reason: string): (this: object, value: unknown) => void {\n return function set(this: object, value: unknown) {\n throw new TypeError(propertyMessage(this, accessor, refusalTail(accessor, value, reason)));\n };\n}\n\nfunction checkedSetter(accessor: DeclaredAccessor): (this: object, value: unknown) => void {\n if (!isParamWritable(accessor.flags)) {\n return refusalFor(accessor, READ_ONLY_REASON);\n }\n\n if (isParamConstructOnly(accessor.flags)) {\n return refusalFor(accessor, CONSTRUCT_ONLY_REASON);\n }\n\n return function set(this: object, value: unknown) {\n writeProperty(this, accessor, value);\n };\n}\n\nfunction hasOwnMember(prototype: object, alias: string): boolean {\n return Object.getOwnPropertyDescriptor(prototype, alias) !== undefined;\n}\n\nfunction defineAccessor(prototype: object, descriptor: PropertyDescriptor, alias: string): void {\n if (hasOwnMember(prototype, alias)) {\n return;\n }\n\n Object.defineProperty(prototype, alias, descriptor);\n}\n\nfunction installAccessors(klass: AnyClass, accessor: DeclaredAccessor): void {\n const prototype = (klass as { prototype: object }).prototype;\n accessor.hasGeneratedMember = !hasOwnMember(prototype, accessor.memberName);\n\n const descriptor: PropertyDescriptor = {\n configurable: true,\n enumerable: true,\n get: accessor.hasGeneratedMember ? storedGetter(accessor) : memberGetter(accessor),\n set: accessor.hasGeneratedMember ? checkedSetter(accessor) : memberSetter(accessor),\n };\n\n for (const alias of accessorNames(accessor.name)) {\n defineAccessor(prototype, descriptor, alias);\n }\n}\n\nfunction storageFor(propertyName: string): symbol {\n const existing = interfaceStorages.get(propertyName);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const created = Symbol(`gtkx:property:${propertyName}`);\n interfaceStorages.set(propertyName, created);\n\n return created;\n}\n\nfunction interfaceAccessorFor(dispatch: PropertyDispatch, pspec: PropertySpec): InterfaceAccessor {\n const handle = getHandle(pspec);\n const propertyName = paramSpecName(handle) as string;\n const delegate = dispatch.delegates.get(propertyName);\n\n const accessor: InterfaceAccessor = {\n ...checkFor(handle, propertyName),\n storage: storageFor(propertyName),\n isInterfaceProperty: true,\n };\n\n if (delegate !== undefined) {\n accessor.delegate = delegate;\n }\n\n return accessor;\n}\n\nfunction resolveAccessor(\n dispatch: PropertyDispatch,\n propertyId: number,\n pspec: PropertySpec,\n): PropertyAccessor {\n const accessor = dispatch.accessors[propertyId - FIRST_PROPERTY_ID];\n\n if (accessor !== undefined) {\n return accessor;\n }\n\n const created = interfaceAccessorFor(dispatch, pspec);\n dispatch.accessors[propertyId - FIRST_PROPERTY_ID] = created;\n\n return created;\n}\n\nfunction callMember(instance: object, member: string, args: unknown[]): unknown {\n const fn: unknown = (instance as Record<string, unknown>)[member];\n\n if (typeof fn !== \"function\") {\n throw new TypeError(`registerClass: ${instanceClassName(instance)} has no '${member}' member`);\n }\n\n return (fn as (...values: unknown[]) => unknown).apply(instance, args);\n}\n\nfunction backingMemberFor(instance: object, accessor: DeclaredAccessor): string | undefined {\n if (accessor.hasGeneratedMember && !Object.hasOwn(instance, accessor.memberName)) {\n return undefined;\n }\n\n return accessor.memberName;\n}\n\nfunction readCurrent(instance: object, accessor: PropertyAccessor): unknown {\n const getter = accessor.delegate?.getter;\n\n if (getter !== undefined) {\n return callMember(instance, getter, []);\n }\n\n if (accessor.isInterfaceProperty === true) {\n return readStored(instance as Record<symbol, unknown>, accessor);\n }\n\n const member = backingMemberFor(instance, accessor);\n\n return member === undefined\n ? readStored(instance as Record<symbol, unknown>, accessor)\n : (instance as Record<string, unknown>)[member];\n}\n\nfunction storeCurrent(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n if (isParamExplicitlyNotified(accessor.flags)) {\n writeStored(instance, accessor, value);\n } else {\n storeValue(instance, accessor, value);\n }\n}\n\nfunction writeCurrent(instance: object, accessor: PropertyAccessor, value: unknown): void {\n const setter = accessor.delegate?.setter;\n\n if (setter !== undefined) {\n callMember(instance, setter, [value]);\n\n return;\n }\n\n if (accessor.isInterfaceProperty === true) {\n writeStored(instance as Record<symbol, unknown>, accessor, value);\n\n return;\n }\n\n const member = backingMemberFor(instance, accessor);\n\n if (member === undefined) {\n storeCurrent(instance as Record<symbol, unknown>, accessor, value);\n\n return;\n }\n\n (instance as Record<string, unknown>)[member] = value;\n}\n\nfunction makeGetProperty(dispatch: PropertyDispatch) {\n return function getProperty(this: object, propertyId: number, value: object, pspec: PropertySpec): void {\n const accessor = resolveAccessor(dispatch, propertyId, pspec);\n const current = readCurrent(this, accessor);\n assertValueServes(this, accessor, current);\n writeHeld(accessor, getHandle(value), current);\n };\n}\n\nfunction makeSetProperty(dispatch: PropertyDispatch) {\n return function setProperty(this: object, propertyId: number, value: object, pspec: PropertySpec): void {\n const accessor = resolveAccessor(dispatch, propertyId, pspec);\n writeCurrent(this, accessor, fromValue(getHandle(value)));\n };\n}\n\nconst isCanonicalName = (name: string, propertyName: string): boolean =>\n CANONICAL_NAME_PATTERN.test(propertyName) && toCamelIdentifier(propertyName) === toCamelIdentifier(name);\n\nfunction assertCanonicalName(klass: AnyClass, name: string, propertyName: string): void {\n if (isCanonicalName(name, propertyName)) {\n return;\n }\n\n throw new TypeError(\n `registerClass: ${klass.name} keys the property '${name}' to a GObject.ParamSpec named ` +\n `'${propertyName}', which is the name GObject notifies under; name the ParamSpec '${canonicalCase(name)}'`,\n );\n}\n\nfunction assertCanonicalNames(klass: AnyClass, properties: Record<string, PropertySpec>): void {\n for (const [name, pspec] of Object.entries(properties)) {\n assertCanonicalName(klass, name, getPropertyName(pspec));\n }\n}\n\nfunction buildAccessor(klass: AnyClass, name: string, pspec: PropertySpec): DeclaredAccessor {\n const accessor: DeclaredAccessor = {\n ...checkFor(getHandle(pspec), name),\n memberName: camelCase(name),\n storage: Symbol(`gtkx:property:${name}`),\n hasGeneratedMember: false,\n };\n\n installAccessors(klass, accessor);\n\n return accessor;\n}\n\nfunction buildAccessors(source: PropertyDispatchSource): DeclaredAccessor[] {\n const { klass, properties } = source;\n assertCanonicalNames(klass, properties);\n\n return Object.entries(properties).map(([name, pspec]) => buildAccessor(klass, name, pspec));\n}\n\nfunction addInterfaceDelegates(delegates: Map<string, InterfaceProperty>, gtype: bigint): void {\n const properties = getInterfaceProperties(gtype) ?? {};\n\n for (const [name, delegate] of Object.entries(properties)) {\n if (!delegates.has(name)) {\n delegates.set(name, delegate);\n }\n }\n}\n\nfunction interfaceDelegatesFor(adoptedTypes: bigint[]): Map<string, InterfaceProperty> {\n const delegates: Map<string, InterfaceProperty> = new Map();\n\n for (const gtype of adoptedTypes) {\n addInterfaceDelegates(delegates, gtype);\n }\n\n return delegates;\n}\n\nfunction recordDeclaredNames(klass: AnyClass, accessors: DeclaredAccessor[]): void {\n const proto = klass.prototype as Record<PropertyKey, unknown>;\n const inherited = proto[DECLARED_NAMES] as Record<string, string> | undefined;\n const own: Record<string, string> = {};\n\n for (const accessor of accessors) {\n own[accessor.memberName] = accessor.propertyName;\n }\n\n Object.defineProperty(proto, DECLARED_NAMES, { value: { ...inherited, ...own }, enumerable: false });\n}\n\nfunction buildPropertyDispatch(source: PropertyDispatchSource): PropertyDispatch {\n const declared = buildAccessors(source);\n recordDeclaredNames(source.klass, declared);\n\n return { accessors: [...declared], delegates: interfaceDelegatesFor(source.adoptedTypes) };\n}\n\n/**\n * The GObject name a class registered with `registerClass` installed an accessor under, or\n * `undefined` when the accessor names no property the class declared itself.\n */\nfunction getDeclaredPropertyName(object: object, accessor: string): string | undefined {\n const declared = (object as Record<PropertyKey, unknown>)[DECLARED_NAMES] as\n | Record<string, string> |\n undefined;\n\n return declared?.[accessor];\n}\n\nfunction toNativeProperties(properties: Record<string, PropertySpec>): RegisterClassProperty[] {\n return Object.values(properties).map((pspec, index) => ({\n id: index + FIRST_PROPERTY_ID,\n pspec: getHandle(pspec),\n }));\n}\n\nexport {\n buildPropertyDispatch,\n coerceObjectProperty,\n getDeclaredPropertyName,\n isReadableProperty,\n coercePropertyValue,\n constructPropertyFor,\n GET_PROPERTY_VFUNC,\n makeGetProperty,\n makeSetProperty,\n newParamSpecOverride,\n SET_PROPERTY_VFUNC,\n toNativeProperties,\n type ConstructProperty,\n type PropertyDispatch,\n type Propert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,KAAK,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AACzG,CAAC;AAED,SAAS,qBAAqB,CAAC,MAA8B;IACzD,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE5C,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;AAC/F,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAc,EAAE,QAAgB;IAC7D,MAAM,QAAQ,GAAI,MAAuC,CAAC,cAAc,CAE3D,CAAC;IAEd,OAAO,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAwC;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACpD,EAAE,EAAE,KAAK,GAAG,iBAAiB;QAC7B,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,OAAO,EACH,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,GAI5B,CAAC","sourcesContent":["import type { ExternalObject, Handle, RegisterClassProperty } from \"@gtkx/native\";\nimport { type AnyClass, camelCase, kebabCase, toCamelIdentifier } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { biguint64T, fundamentalT, refT, sizedArrayT, stringT, structT, uint32T, voidT } from \"./descriptors.js\";\nimport { LIB, PARAM_T, VALUE_T } from \"./library.js\";\nimport {\n getParamFlags,\n getParamValueType,\n isParamConstructOnly,\n isParamExplicitlyNotified,\n isParamLaxlyValidated,\n isParamReadable,\n isParamWritable,\n type ValueGuard,\n valueGuardFor,\n wasParamValueModified,\n WHOLE_NUMBER_RANGES,\n} from \"./param-spec.js\";\nimport {\n getClassType,\n getHandle,\n getInstanceType,\n getInterfaceProperties,\n instanceClassName,\n type InterfaceProperty,\n} from \"./registry.js\";\nimport { TYPE_INTERFACE, TYPE_INVALID, TYPE_OBJECT, typeFundamental, typeIsA, typeName } from \"./type.js\";\nimport {\n fromValue,\n newValueForType,\n valueGuardOverrideFor,\n type ValueNarrower,\n valueNarrowerFor,\n type ValueWriter,\n valueWriterFor,\n} from \"./value.js\";\n\ntype PropertyCheck = {\n name: string;\n propertyName: string;\n handle: ExternalObject<Handle>;\n flags: number;\n valueType: bigint;\n canHoldValue: ValueGuard;\n narrowValue: ValueNarrower;\n write?: ValueWriter;\n scratch?: ExternalObject<Handle>;\n};\n\ntype AccessorBase = PropertyCheck & {\n storage: symbol;\n delegate?: InterfaceProperty;\n};\n\ntype DeclaredAccessor = AccessorBase & {\n isInterfaceProperty?: false;\n memberName: string;\n hasMemberAccessor: boolean;\n};\n\ntype InterfaceAccessor = AccessorBase & { isInterfaceProperty: true };\ntype PropertyAccessor = DeclaredAccessor | InterfaceAccessor;\n/** A `GObject.ParamSpec` wrapper describing one property's name, type, flags and default. */\ntype PropertySpec = object;\n\ntype PropertyDispatch = {\n accessors: PropertyAccessor[];\n delegates: Map<string, InterfaceProperty>;\n};\n\ntype PropertyDispatchSource = {\n klass: AnyClass;\n properties: Record<string, PropertySpec>;\n adoptedTypes: bigint[];\n};\n\ntype ConstructProperty = {\n name: string;\n value: ExternalObject<Handle>;\n};\n\ntype NotifyingObject = { notify?: (propertyName: string) => void };\n\nconst FIRST_PROPERTY_ID = 1;\nconst GET_PROPERTY_VFUNC = \"vfuncGetProperty\";\nconst SET_PROPERTY_VFUNC = \"vfuncSetProperty\";\nconst READ_ONLY_REASON = \"the property is read-only\";\nconst CONSTRUCT_ONLY_REASON = \"the property can only be set when the object is constructed\";\nconst CLASS_T = structT(\"borrowed\");\nconst CANONICAL_NAME_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nconst DECLARED_NAMES = Symbol(\"gtkx:declaredPropertyNames\");\n\nconst OVERRIDE_PARAM_T = fundamentalT(LIB, \"g_param_spec_ref_sink\", \"g_param_spec_unref\", {\n ownership: \"borrowed\",\n typeName: \"GParam\",\n});\n\nconst interfaceStorages: Map<string, symbol> = new Map();\nconst paramSpecDefaultValue = bind(LIB, \"g_param_spec_get_default_value\", [PARAM_T], VALUE_T);\nconst paramSpecName = bind(LIB, \"g_param_spec_get_name\", [PARAM_T], stringT(\"borrowed\"));\nconst typeClassRef = bind(LIB, \"g_type_class_ref\", [biguint64T], CLASS_T);\nconst typeClassUnref = bind(LIB, \"g_type_class_unref\", [CLASS_T], voidT);\nconst propertyChecks: Map<bigint, Map<string, PropertyCheck | null>> = new Map();\nconst classFindProperty = bind(LIB, \"g_object_class_find_property\", [CLASS_T, stringT(\"borrowed\")], PARAM_T);\n\nconst classListProperties = bind(\n LIB,\n \"g_object_class_list_properties\",\n [CLASS_T, refT(uint32T)],\n sizedArrayT(PARAM_T, 1, \"full\"),\n);\n\nconst defaultInterfaceRef = bind(LIB, \"g_type_default_interface_ref\", [biguint64T], CLASS_T);\nconst defaultInterfaceUnref = bind(LIB, \"g_type_default_interface_unref\", [CLASS_T], voidT);\nconst interfaceFindProperty = bind(LIB, \"g_object_interface_find_property\", [CLASS_T, stringT(\"borrowed\")], PARAM_T);\nconst paramSpecOverrideNew = bind(LIB, \"g_param_spec_override\", [stringT(\"borrowed\"), PARAM_T], OVERRIDE_PARAM_T);\n\nconst getPropertyName = (pspec: PropertySpec): string => paramSpecName(getHandle(pspec)) as string;\nconst underscoreCase = (name: string): string => name.replaceAll(\"-\", \"_\");\nconst canonicalCase = (name: string): string => kebabCase(name).replaceAll(\"_\", \"-\");\nconst accessorNames = (name: string): string[] => [...new Set([name, underscoreCase(name), camelCase(name)])];\nconst typeLabel = (type: bigint): string => typeName(type) ?? String(type);\n\nconst defaultValueFor = (handle: ExternalObject<Handle>): ExternalObject<Handle> =>\n paramSpecDefaultValue(handle) as ExternalObject<Handle>;\n\nconst heldValue = (value: unknown): unknown => value ?? null;\n\nconst holdsReason = (check: PropertyCheck): string =>\n `the property holds values of type '${typeLabel(check.valueType)}'`;\n\nfunction checkFor(handle: ExternalObject<Handle>, name: string): PropertyCheck {\n const valueType = getParamValueType(handle);\n\n return {\n name,\n propertyName: paramSpecName(handle) as string,\n handle,\n flags: getParamFlags(handle),\n valueType,\n canHoldValue: valueGuardOverrideFor(valueType) ?? valueGuardFor(valueType),\n narrowValue: valueNarrowerFor(valueType),\n };\n}\n\nfunction accessorSpecs(klass: ExternalObject<Handle>): Map<string, ExternalObject<Handle>> {\n const specs: Map<string, ExternalObject<Handle>> = new Map();\n const countRef = { value: 0 };\n\n for (const pspec of classListProperties(klass, countRef) as ExternalObject<Handle>[]) {\n specs.set(toCamelIdentifier(paramSpecName(pspec) as string), pspec);\n }\n\n return specs;\n}\n\nfunction findPropertySpec(klass: ExternalObject<Handle>, name: string): ExternalObject<Handle> | null {\n const found = (classFindProperty(klass, name) ??\n classFindProperty(klass, canonicalCase(name))) as ExternalObject<Handle> | null;\n\n return found ?? accessorSpecs(klass).get(toCamelIdentifier(name)) ?? null;\n}\n\nconst sourceLabel = (source: bigint | AnyClass, gtype: bigint): string =>\n typeName(gtype) ?? (typeof source === \"function\" ? source.name : String(source));\n\nconst findInterfaceSpec = (gtype: bigint, name: string): ExternalObject<Handle> | null => {\n const vtable = defaultInterfaceRef(gtype) as ExternalObject<Handle>;\n\n try {\n return interfaceFindProperty(vtable, name) as ExternalObject<Handle> | null;\n } finally {\n defaultInterfaceUnref(vtable);\n }\n};\n\nconst findClassSpec = (gtype: bigint, name: string): ExternalObject<Handle> | null => {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n return classFindProperty(klass, name) as ExternalObject<Handle> | null;\n } finally {\n typeClassUnref(klass);\n }\n};\n\nconst findSourceSpec = (source: bigint | AnyClass, name: string): ExternalObject<Handle> => {\n const gtype = typeof source === \"bigint\" ? source : getClassType(source);\n const isInterface = typeIsA(gtype, TYPE_INTERFACE);\n\n if (!isInterface && !typeIsA(gtype, TYPE_OBJECT)) {\n throw new TypeError(\n `paramSpecOverride: '${sourceLabel(source, gtype)}' is neither a registered object class nor an interface`,\n );\n }\n\n const pspec = isInterface ? findInterfaceSpec(gtype, name) : findClassSpec(gtype, name);\n\n if (pspec === null) {\n throw new TypeError(`paramSpecOverride: type '${sourceLabel(source, gtype)}' has no property named '${name}'`);\n }\n\n return pspec;\n};\n\n/**\n * Creates the handle of a `GParamSpec` that redirects to the property `source` declares under\n * `name` — the equivalent of `g_param_spec_override`, which introspection does not expose.\n *\n * Throws when `source` is neither a GType nor a registered class or interface, and when it\n * declares no property under `name`.\n *\n * @param name Canonical name of the property to override.\n * @param source The GType, wrapper class or interface declaring the property.\n * @returns Handle of the override spec.\n */\nconst newParamSpecOverride = (name: string, source: bigint | AnyClass): ExternalObject<Handle> => {\n const canonicalName = canonicalCase(name);\n\n return paramSpecOverrideNew(canonicalName, findSourceSpec(source, canonicalName)) as ExternalObject<Handle>;\n};\n\nfunction describeValue(value: unknown): string {\n if (typeof value === \"string\") {\n return JSON.stringify(value);\n }\n\n if (typeof value === \"object\" && value !== null) {\n return instanceClassName(value);\n }\n\n return String(value);\n}\n\nfunction propertyMessage(instance: object, check: PropertyCheck, tail: string): string {\n return `${instanceClassName(instance)}.${check.name}: ${tail}`;\n}\n\nfunction refusalTail(check: PropertyCheck, value: unknown, reason: string): string {\n return `cannot set property '${check.propertyName}' to ${describeValue(value)}; ${reason}`;\n}\n\nfunction serveTail(check: PropertyCheck, value: unknown): string {\n return `cannot serve property '${check.propertyName}' from ${describeValue(value)}; ${holdsReason(check)}`;\n}\n\nfunction assertValueFits(instance: object, check: PropertyCheck, value: unknown): void {\n if (check.canHoldValue(value)) {\n return;\n }\n\n const tail = refusalTail(check, value, holdsReason(check));\n throw new TypeError(propertyMessage(instance, check, tail));\n}\n\nfunction assertValueServes(instance: object, check: PropertyCheck, value: unknown): void {\n if (check.canHoldValue(value)) {\n return;\n }\n\n throw new TypeError(propertyMessage(instance, check, serveTail(check, value)));\n}\n\nfunction assertValueValidates(\n instance: object,\n check: PropertyCheck,\n value: unknown,\n gValue: ExternalObject<Handle>,\n): void {\n if (!wasParamValueModified(check.handle, gValue) || isParamLaxlyValidated(check.flags)) {\n return;\n }\n\n const reason =\n `the value is invalid or out of range for type '${typeLabel(check.valueType)}', ` +\n `and GObject would put ${describeValue(fromValue(gValue))} in its place`;\n\n throw new RangeError(propertyMessage(instance, check, refusalTail(check, value, reason)));\n}\n\nfunction assertWritable(instance: object, check: PropertyCheck, value: unknown): void {\n if (isParamWritable(check.flags)) {\n return;\n }\n\n throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, READ_ONLY_REASON)));\n}\n\nfunction assertReadable(instance: object, check: PropertyCheck): void {\n if (isParamReadable(check.flags)) {\n return;\n }\n\n throw new TypeError(\n propertyMessage(instance, check, `cannot read property '${check.propertyName}'; the property is write-only`),\n );\n}\n\nfunction assertMutable(instance: object, check: PropertyCheck, value: unknown): void {\n assertWritable(instance, check, value);\n\n if (isParamConstructOnly(check.flags)) {\n throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, CONSTRUCT_ONLY_REASON)));\n }\n}\n\nfunction writeHeld(check: PropertyCheck, gValue: ExternalObject<Handle>, value: unknown): void {\n check.write ??= valueWriterFor(check.valueType);\n check.write(gValue, check.narrowValue(value));\n}\n\nfunction fillCheckedValue(\n instance: object,\n check: PropertyCheck,\n gValue: ExternalObject<Handle>,\n value: unknown,\n): void {\n assertValueFits(instance, check, value);\n writeHeld(check, gValue, value);\n assertValueValidates(instance, check, value, gValue);\n}\n\nfunction checkedValueFor(instance: object, check: PropertyCheck, value: unknown): ExternalObject<Handle> {\n const gValue = newValueForType(check.valueType);\n fillCheckedValue(instance, check, gValue, value);\n\n return gValue;\n}\n\nfunction assertValueAccepted(instance: object, check: PropertyCheck, value: unknown): void {\n check.scratch ??= newValueForType(check.valueType);\n fillCheckedValue(instance, check, check.scratch, value);\n}\n\nfunction constructValueFor(wrapper: object, check: PropertyCheck, value: unknown): ConstructProperty {\n assertWritable(wrapper, check, value);\n\n return { name: check.propertyName, value: checkedValueFor(wrapper, check, value) };\n}\n\n/**\n * Whether the type declares a readable GObject property under `propertyName`, asking GObject itself\n * rather than looking for a generated accessor, which codegen omits when a method shares the name.\n */\nfunction isReadableProperty(gtype: bigint, propertyName: string): boolean {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, propertyName);\n\n return pspec !== null && isParamReadable(getParamFlags(pspec));\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction lookupPropertyCheck(gtype: bigint, name: string): PropertyCheck | null {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, name);\n\n return pspec === null ? null : checkFor(pspec, name);\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction propertyCheckFor(gtype: bigint, name: string): PropertyCheck | null {\n const checks = propertyChecks.getOrInsertComputed(gtype, () => new Map<string, PropertyCheck | null>());\n\n return checks.getOrInsertComputed(name, () => lookupPropertyCheck(gtype, name));\n}\n\nfunction objectPropertyCheckFor(instance: object, name: string): PropertyCheck {\n const gtype = getInstanceType(instance);\n const check = typeIsA(gtype, TYPE_OBJECT) ? propertyCheckFor(gtype, name) : null;\n\n if (check === null) {\n throw new TypeError(`${instanceClassName(instance)} has no GObject property named '${name}'`);\n }\n\n return check;\n}\n\nfunction readableObjectPropertyFor(instance: object, name: string): ConstructProperty {\n const check = objectPropertyCheckFor(instance, name);\n assertReadable(instance, check);\n\n return { name: check.propertyName, value: newValueForType(check.valueType) };\n}\n\nfunction writableObjectPropertyFor(instance: object, name: string, value: unknown): ConstructProperty {\n const check = objectPropertyCheckFor(instance, name);\n assertMutable(instance, check, value);\n\n return { name: check.propertyName, value: checkedValueFor(instance, check, value) };\n}\n\nfunction truncateToWhole(check: PropertyCheck, value: number): number {\n const range = WHOLE_NUMBER_RANGES.get(typeFundamental(check.valueType));\n\n if (range === undefined) {\n return value;\n }\n\n return Math.min(range[1], Math.max(range[0], Math.trunc(value)));\n}\n\nfunction validatedNumber(check: PropertyCheck, number: number): number {\n check.scratch ??= newValueForType(check.valueType);\n\n try {\n writeHeld(check, check.scratch, number);\n } catch {\n return number;\n }\n\n return wasParamValueModified(check.handle, check.scratch) ? (fromValue(check.scratch) as number) : number;\n}\n\nfunction coerceNumber(check: PropertyCheck, value: number): number {\n const number = truncateToWhole(check, value);\n\n return check.canHoldValue(number) ? validatedNumber(check, number) : value;\n}\n\nfunction coercePropertyValue(gtype: bigint, propertyName: string, value: unknown): unknown {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return value;\n }\n\n const check = propertyCheckFor(gtype, propertyName);\n\n return check === null ? value : coerceNumber(check, value);\n}\n\n/**\n * Fits a number to what a GObject property accepts, the way an animation writing a value on every\n * frame needs: a fractional number headed for a property that holds whole numbers, such as a\n * `gint`, an enum, or flags, is truncated toward zero, and a number outside the range the\n * property's `GObject.ParamSpec` allows is clamped to it, so the write that follows never trips\n * GObject's range check. Anything that is not a finite number, a number the property cannot hold\n * at all, and a name the object installs no property under come back unchanged.\n *\n * @param obj The object the value is about to be written to.\n * @param propertyName The property name, dashed or camelCased.\n * @param value The value about to be written.\n * @returns The value as the property accepts it.\n */\nfunction coerceObjectProperty(obj: object, propertyName: string, value: unknown): unknown {\n if (typeof value !== \"number\") {\n return value;\n }\n\n const gtype = getInstanceType(obj);\n\n return gtype === TYPE_INVALID ? value : coercePropertyValue(gtype, propertyName, value);\n}\n\nfunction constructPropertyFor(\n gtype: bigint,\n name: string,\n value: unknown,\n wrapper: object,\n): ConstructProperty | undefined {\n const klass = typeClassRef(gtype) as ExternalObject<Handle>;\n\n try {\n const pspec = findPropertySpec(klass, name);\n\n return pspec === null ? undefined : constructValueFor(wrapper, checkFor(pspec, name), value);\n } finally {\n typeClassUnref(klass);\n }\n}\n\nfunction readStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor): unknown {\n if (!Object.hasOwn(instance, accessor.storage)) {\n instance[accessor.storage] = fromValue(defaultValueFor(accessor.handle));\n }\n\n return instance[accessor.storage];\n}\n\nfunction storeValue(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n instance[accessor.storage] = heldValue(value);\n}\n\nfunction writeStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n if (readStored(instance, accessor) === heldValue(value)) {\n return;\n }\n\n storeValue(instance, accessor, value);\n (instance as NotifyingObject).notify?.(accessor.propertyName);\n}\n\nfunction writeProperty(instance: object, accessor: PropertyAccessor, value: unknown): void {\n const stored = instance as Record<symbol, unknown>;\n\n if (readStored(stored, accessor) === heldValue(value)) {\n return;\n }\n\n assertValueAccepted(instance, accessor, value);\n writeStored(stored, accessor, accessor.narrowValue(value));\n}\n\nfunction storedGetter(accessor: PropertyAccessor): (this: object) => unknown {\n return function get(this: object) {\n return readStored(this as Record<symbol, unknown>, accessor);\n };\n}\n\nfunction memberGetter(accessor: DeclaredAccessor): (this: object) => unknown {\n return function get(this: object) {\n return (this as Record<string, unknown>)[accessor.memberName];\n };\n}\n\nfunction memberSetter(accessor: DeclaredAccessor): (this: object, value: unknown) => void {\n return function set(this: object, value: unknown) {\n (this as Record<string, unknown>)[accessor.memberName] = value;\n };\n}\n\nfunction refusalFor(accessor: PropertyAccessor, reason: string): (this: object, value: unknown) => void {\n return function set(this: object, value: unknown) {\n throw new TypeError(propertyMessage(this, accessor, refusalTail(accessor, value, reason)));\n };\n}\n\nfunction checkedSetter(accessor: DeclaredAccessor): (this: object, value: unknown) => void {\n if (!isParamWritable(accessor.flags)) {\n return refusalFor(accessor, READ_ONLY_REASON);\n }\n\n if (isParamConstructOnly(accessor.flags)) {\n return refusalFor(accessor, CONSTRUCT_ONLY_REASON);\n }\n\n return function set(this: object, value: unknown) {\n writeProperty(this, accessor, value);\n };\n}\n\nfunction memberDescriptorFor(prototype: object, name: string): PropertyDescriptor | undefined {\n let current: object | null = prototype;\n\n while (current !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(current, name);\n\n if (descriptor !== undefined) {\n return descriptor;\n }\n\n current = Reflect.getPrototypeOf(current);\n }\n\n return undefined;\n}\n\nfunction isMemberAccessor(descriptor: PropertyDescriptor | undefined): boolean {\n return descriptor !== undefined && (\"get\" in descriptor || \"set\" in descriptor);\n}\n\nfunction defineAccessor(prototype: object, descriptor: PropertyDescriptor, alias: string): void {\n if (Object.getOwnPropertyDescriptor(prototype, alias) !== undefined) {\n return;\n }\n\n const parent = Reflect.getPrototypeOf(prototype);\n const inherited = parent === null ? undefined : memberDescriptorFor(parent, alias);\n\n if (inherited !== undefined && !isMemberAccessor(inherited)) {\n return;\n }\n\n Object.defineProperty(prototype, alias, descriptor);\n}\n\nfunction installAccessors(klass: AnyClass, accessor: DeclaredAccessor): void {\n const prototype = (klass as { prototype: object }).prototype;\n accessor.hasMemberAccessor = isMemberAccessor(Object.getOwnPropertyDescriptor(prototype, accessor.memberName));\n\n const descriptor: PropertyDescriptor = {\n configurable: true,\n enumerable: true,\n get: accessor.hasMemberAccessor ? memberGetter(accessor) : storedGetter(accessor),\n set: accessor.hasMemberAccessor ? memberSetter(accessor) : checkedSetter(accessor),\n };\n\n for (const alias of accessorNames(accessor.name)) {\n defineAccessor(prototype, descriptor, alias);\n }\n}\n\nfunction storageFor(propertyName: string): symbol {\n const existing = interfaceStorages.get(propertyName);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const created = Symbol(`gtkx:property:${propertyName}`);\n interfaceStorages.set(propertyName, created);\n\n return created;\n}\n\nfunction interfaceAccessorFor(dispatch: PropertyDispatch, pspec: PropertySpec): InterfaceAccessor {\n const handle = getHandle(pspec);\n const propertyName = paramSpecName(handle) as string;\n const delegate = dispatch.delegates.get(propertyName);\n\n const accessor: InterfaceAccessor = {\n ...checkFor(handle, propertyName),\n storage: storageFor(propertyName),\n isInterfaceProperty: true,\n };\n\n if (delegate !== undefined) {\n accessor.delegate = delegate;\n }\n\n return accessor;\n}\n\nfunction resolveAccessor(\n dispatch: PropertyDispatch,\n propertyId: number,\n pspec: PropertySpec,\n): PropertyAccessor {\n const accessor = dispatch.accessors[propertyId - FIRST_PROPERTY_ID];\n\n if (accessor !== undefined) {\n return accessor;\n }\n\n const created = interfaceAccessorFor(dispatch, pspec);\n dispatch.accessors[propertyId - FIRST_PROPERTY_ID] = created;\n\n return created;\n}\n\nfunction callMember(instance: object, member: string, args: unknown[]): unknown {\n const fn: unknown = (instance as Record<string, unknown>)[member];\n\n if (typeof fn !== \"function\") {\n throw new TypeError(`registerClass: ${instanceClassName(instance)} has no '${member}' member`);\n }\n\n return (fn as (...values: unknown[]) => unknown).apply(instance, args);\n}\n\nfunction backingMemberFor(instance: object, accessor: DeclaredAccessor): string | undefined {\n if (accessor.hasMemberAccessor) {\n return accessor.memberName;\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(instance, accessor.memberName);\n\n if (descriptor === undefined || (\"value\" in descriptor && typeof descriptor.value === \"function\")) {\n return undefined;\n }\n\n return accessor.memberName;\n}\n\nfunction readCurrent(instance: object, accessor: PropertyAccessor): unknown {\n const getter = accessor.delegate?.getter;\n\n if (getter !== undefined) {\n return callMember(instance, getter, []);\n }\n\n if (accessor.isInterfaceProperty === true) {\n return readStored(instance as Record<symbol, unknown>, accessor);\n }\n\n const member = backingMemberFor(instance, accessor);\n\n return member === undefined\n ? readStored(instance as Record<symbol, unknown>, accessor)\n : (instance as Record<string, unknown>)[member];\n}\n\nfunction storeCurrent(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n if (isParamExplicitlyNotified(accessor.flags)) {\n writeStored(instance, accessor, value);\n } else {\n storeValue(instance, accessor, value);\n }\n}\n\nfunction writeCurrent(instance: object, accessor: PropertyAccessor, value: unknown): void {\n const setter = accessor.delegate?.setter;\n\n if (setter !== undefined) {\n callMember(instance, setter, [value]);\n\n return;\n }\n\n if (accessor.isInterfaceProperty === true) {\n writeStored(instance as Record<symbol, unknown>, accessor, value);\n\n return;\n }\n\n const member = backingMemberFor(instance, accessor);\n\n if (member === undefined) {\n storeCurrent(instance as Record<symbol, unknown>, accessor, value);\n\n return;\n }\n\n (instance as Record<string, unknown>)[member] = value;\n}\n\nfunction makeGetProperty(dispatch: PropertyDispatch) {\n return function getProperty(this: object, propertyId: number, value: object, pspec: PropertySpec): void {\n const accessor = resolveAccessor(dispatch, propertyId, pspec);\n const current = readCurrent(this, accessor);\n assertValueServes(this, accessor, current);\n writeHeld(accessor, getHandle(value), current);\n };\n}\n\nfunction makeSetProperty(dispatch: PropertyDispatch) {\n return function setProperty(this: object, propertyId: number, value: object, pspec: PropertySpec): void {\n const accessor = resolveAccessor(dispatch, propertyId, pspec);\n writeCurrent(this, accessor, fromValue(getHandle(value)));\n };\n}\n\nconst isCanonicalName = (name: string, propertyName: string): boolean =>\n CANONICAL_NAME_PATTERN.test(propertyName) && toCamelIdentifier(propertyName) === toCamelIdentifier(name);\n\nfunction assertCanonicalName(klass: AnyClass, name: string, propertyName: string): void {\n if (isCanonicalName(name, propertyName)) {\n return;\n }\n\n throw new TypeError(\n `registerClass: ${klass.name} keys the property '${name}' to a GObject.ParamSpec named ` +\n `'${propertyName}', which is the name GObject notifies under; name the ParamSpec '${canonicalCase(name)}'`,\n );\n}\n\nfunction assertCanonicalNames(klass: AnyClass, properties: Record<string, PropertySpec>): void {\n for (const [name, pspec] of Object.entries(properties)) {\n assertCanonicalName(klass, name, getPropertyName(pspec));\n }\n}\n\nfunction buildAccessor(klass: AnyClass, name: string, pspec: PropertySpec): DeclaredAccessor {\n const accessor: DeclaredAccessor = {\n ...checkFor(getHandle(pspec), name),\n memberName: camelCase(name),\n storage: Symbol(`gtkx:property:${name}`),\n hasMemberAccessor: false,\n };\n\n installAccessors(klass, accessor);\n\n return accessor;\n}\n\nfunction buildAccessors(source: PropertyDispatchSource): DeclaredAccessor[] {\n const { klass, properties } = source;\n assertCanonicalNames(klass, properties);\n\n return Object.entries(properties).map(([name, pspec]) => buildAccessor(klass, name, pspec));\n}\n\nfunction addInterfaceDelegates(delegates: Map<string, InterfaceProperty>, gtype: bigint): void {\n const properties = getInterfaceProperties(gtype) ?? {};\n\n for (const [name, delegate] of Object.entries(properties)) {\n if (!delegates.has(name)) {\n delegates.set(name, delegate);\n }\n }\n}\n\nfunction interfaceDelegatesFor(adoptedTypes: bigint[]): Map<string, InterfaceProperty> {\n const delegates: Map<string, InterfaceProperty> = new Map();\n\n for (const gtype of adoptedTypes) {\n addInterfaceDelegates(delegates, gtype);\n }\n\n return delegates;\n}\n\nfunction recordDeclaredNames(klass: AnyClass, accessors: DeclaredAccessor[]): void {\n const proto = klass.prototype as Record<PropertyKey, unknown>;\n const inherited = proto[DECLARED_NAMES] as Record<string, string> | undefined;\n const own: Record<string, string> = {};\n\n for (const accessor of accessors) {\n own[accessor.memberName] = accessor.propertyName;\n }\n\n Object.defineProperty(proto, DECLARED_NAMES, { value: { ...inherited, ...own }, enumerable: false });\n}\n\nfunction buildPropertyDispatch(source: PropertyDispatchSource): PropertyDispatch {\n const declared = buildAccessors(source);\n recordDeclaredNames(source.klass, declared);\n\n return { accessors: [...declared], delegates: interfaceDelegatesFor(source.adoptedTypes) };\n}\n\n/**\n * The GObject name a class registered with `registerClass` installed an accessor under, or\n * `undefined` when the accessor names no property the class declared itself.\n */\nfunction getDeclaredPropertyName(object: object, accessor: string): string | undefined {\n const declared = (object as Record<PropertyKey, unknown>)[DECLARED_NAMES] as\n | Record<string, string> |\n undefined;\n\n return declared?.[accessor];\n}\n\nfunction toNativeProperties(properties: Record<string, PropertySpec>): RegisterClassProperty[] {\n return Object.values(properties).map((pspec, index) => ({\n id: index + FIRST_PROPERTY_ID,\n pspec: getHandle(pspec),\n }));\n}\n\nexport {\n buildPropertyDispatch,\n coerceObjectProperty,\n getDeclaredPropertyName,\n isReadableProperty,\n coercePropertyValue,\n constructPropertyFor,\n GET_PROPERTY_VFUNC,\n makeGetProperty,\n makeSetProperty,\n newParamSpecOverride,\n readableObjectPropertyFor,\n SET_PROPERTY_VFUNC,\n toNativeProperties,\n writableObjectPropertyFor,\n type ConstructProperty,\n type PropertyDispatch,\n type PropertySpec,\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const propertyMapOverride: unique symbol;
|
|
2
|
+
declare const writablePropertyMapOverride: unique symbol;
|
|
3
|
+
declare const descriptorFreePropertySpec: unique symbol;
|
|
4
|
+
export { descriptorFreePropertySpec, propertyMapOverride, writablePropertyMapOverride };
|
|
5
|
+
//# sourceMappingURL=property-brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-brand.d.ts","sourceRoot":"","sources":["../src/property-brand.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,mBAAmB,EAAE,OAAO,MAA2C,CAAC;AAC9E,QAAA,MAAM,2BAA2B,EAAE,OAAO,MAAmD,CAAC;AAC9F,QAAA,MAAM,0BAA0B,EAAE,OAAO,MAAkD,CAAC;AAE5F,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const propertyMapOverride = Symbol("gtkx.propertyMapOverride");
|
|
2
|
+
const writablePropertyMapOverride = Symbol("gtkx.writablePropertyMapOverride");
|
|
3
|
+
const descriptorFreePropertySpec = Symbol("gtkx.descriptorFreePropertySpec");
|
|
4
|
+
export { descriptorFreePropertySpec, propertyMapOverride, writablePropertyMapOverride };
|
|
5
|
+
//# sourceMappingURL=property-brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-brand.js","sourceRoot":"","sources":["../src/property-brand.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAkB,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC9E,MAAM,2BAA2B,GAAkB,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAC9F,MAAM,0BAA0B,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAE5F,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,CAAC","sourcesContent":["const propertyMapOverride: unique symbol = Symbol(\"gtkx.propertyMapOverride\");\nconst writablePropertyMapOverride: unique symbol = Symbol(\"gtkx.writablePropertyMapOverride\");\nconst descriptorFreePropertySpec: unique symbol = Symbol(\"gtkx.descriptorFreePropertySpec\");\n\nexport { descriptorFreePropertySpec, propertyMapOverride, writablePropertyMapOverride };\n"]}
|
package/dist/register-class.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type AnyClass } from "@gtkx/utils";
|
|
2
2
|
import { type PropertySpec } from "./properties.js";
|
|
3
|
+
import { descriptorFreePropertySpec, propertyMapOverride, writablePropertyMapOverride } from "./property-brand.js";
|
|
4
|
+
import { classSignalMember, naturalSignalMember, signalEmitMapOverride, signalMapOverride } from "./signal-brand.js";
|
|
3
5
|
import { type TypedClass } from "./type.js";
|
|
4
6
|
/** A generated interface value, such as `Gio.ListModel`, accepted by {@link registerClass}. */
|
|
5
|
-
type Interface<TImpl> = AnyClass & {
|
|
7
|
+
type Interface<TImpl, TInstance = object> = AnyClass & {
|
|
6
8
|
/** Type-level slot holding the interface's `Impl` type; no value ever carries it. */
|
|
7
|
-
__impl__: (impl: Partial<TImpl> & object) =>
|
|
9
|
+
__impl__: (impl: Partial<TImpl> & object) => TInstance;
|
|
8
10
|
};
|
|
9
11
|
/** Converts underscores in a property name to canonical dashes. */
|
|
10
12
|
type Dashed<TName extends string> = TName extends `${infer THead}_${infer TTail}` ? Dashed<`${THead}-${TTail}`> : TName;
|
|
@@ -17,24 +19,104 @@ type DeclaredSignalBase<TSignals> = (keyof TSignals & string) | Dashed<keyof TSi
|
|
|
17
19
|
/** Declared signal names, including detailed forms. */
|
|
18
20
|
type DeclaredSignalName<TSignals> = DeclaredSignalBase<TSignals> | `${DeclaredSignalBase<TSignals>}::${string}`;
|
|
19
21
|
/** Signal methods added for declared names. */
|
|
20
|
-
type DeclaredSignalMethods<TSignals> = {
|
|
22
|
+
type DeclaredSignalMethods<TSignals, TBlockedMembers extends PropertyKey> = {
|
|
21
23
|
/** Type-level map used by signal hooks. */
|
|
22
|
-
__signals__?: Record<
|
|
23
|
-
|
|
24
|
+
__signals__?: Record<DeclaredSignalName<TSignals>, (...args: never[]) => unknown>;
|
|
25
|
+
} & Pick<{
|
|
24
26
|
connect(signal: DeclaredSignalName<TSignals>, handler: (...args: never[]) => unknown, isAfter?: boolean): number;
|
|
25
|
-
/** Emits a signal. */
|
|
26
27
|
emit(sigName: DeclaredSignalName<TSignals>, ...args: unknown[]): unknown;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** Disconnects a handler. */
|
|
32
|
-
off(sigName: DeclaredSignalName<TSignals>, callback: (...args: unknown[]) => unknown): unknown;
|
|
33
|
-
};
|
|
28
|
+
on(sigName: DeclaredSignalName<TSignals>, callback: (...args: never[]) => unknown, isAfter?: boolean): unknown;
|
|
29
|
+
once(sigName: DeclaredSignalName<TSignals>, callback: (...args: never[]) => unknown, isAfter?: boolean): unknown;
|
|
30
|
+
off(sigName: DeclaredSignalName<TSignals>, callback: (...args: never[]) => unknown): unknown;
|
|
31
|
+
}, Exclude<"connect" | "emit" | "off" | "on" | "once", TBlockedMembers>>;
|
|
34
32
|
/** A registered instance with declared signal methods and property metadata. */
|
|
35
|
-
type RegisteredInstance<TInstance, TProperties, TSignals
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
type RegisteredInstance<TInstance, TProperties, TSignals, TInterfaces extends readonly Interface<TInstance>[], TRemainingInterfaces extends readonly Interface<TInstance>[] = TInterfaces, TMemberSurface = object, TSignalSurface = TInstance extends {
|
|
34
|
+
[signalMapOverride]?: infer TResolver;
|
|
35
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInstance extends {
|
|
36
|
+
__signals__?: infer TMap;
|
|
37
|
+
} ? NonNullable<TMap> : object : TInstance extends {
|
|
38
|
+
__signals__?: infer TMap;
|
|
39
|
+
} ? NonNullable<TMap> : object, TSignalEmitSurface = TInstance extends {
|
|
40
|
+
[signalEmitMapOverride]?: infer TResolver;
|
|
41
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInstance extends {
|
|
42
|
+
__signalEmit__?: infer TMap;
|
|
43
|
+
} ? NonNullable<TMap> : object : TInstance extends {
|
|
44
|
+
__signalEmit__?: infer TMap;
|
|
45
|
+
} ? NonNullable<TMap> : object, TPropertySurface = TInstance extends {
|
|
46
|
+
[propertyMapOverride]?: infer TResolver;
|
|
47
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInstance extends {
|
|
48
|
+
__properties__?: infer TMap;
|
|
49
|
+
} ? NonNullable<TMap> : object : TInstance extends {
|
|
50
|
+
__properties__?: infer TMap;
|
|
51
|
+
} ? NonNullable<TMap> : object, TWritablePropertySurface = TInstance extends {
|
|
52
|
+
[writablePropertyMapOverride]?: infer TResolver;
|
|
53
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInstance extends {
|
|
54
|
+
__writableProperties__?: infer TMap;
|
|
55
|
+
} ? NonNullable<TMap> : object : TInstance extends {
|
|
56
|
+
__writableProperties__?: infer TMap;
|
|
57
|
+
} ? NonNullable<TMap> : object, TNaturalInstanceMembers extends PropertyKey = TInstance extends {
|
|
58
|
+
[naturalSignalMember]?: infer TMembers;
|
|
59
|
+
} ? keyof NonNullable<TMembers> : never, TClassInstanceSignals extends PropertyKey = TInstance extends {
|
|
60
|
+
[classSignalMember]?: infer TMembers;
|
|
61
|
+
} ? keyof NonNullable<TMembers> : never, TLegacySignalMembers extends PropertyKey = "connect" | "disconnect" | "emit" | "off" | "on" | "once", TInstalledPropertyCandidate = TInstance & TMemberSurface, TRegisteredPropertySurface = Omit<TPropertySurface, InstalledNames<TProperties>> & Pick<TInstalledPropertyCandidate, (string extends keyof TProperties ? never : {
|
|
62
|
+
[K in keyof TProperties & string]: TProperties[K] extends {
|
|
63
|
+
readonly [descriptorFreePropertySpec]: true;
|
|
64
|
+
} ? Camelized<Dashed<K>> : never;
|
|
65
|
+
}[keyof TProperties & string]) & {
|
|
66
|
+
[K in keyof TInstalledPropertyCandidate]-?: Extract<TInstalledPropertyCandidate[K], (...args: never[]) => unknown> extends never ? K : never;
|
|
67
|
+
}[keyof TInstalledPropertyCandidate]>, TRegisteredWritablePropertySurface = Omit<TWritablePropertySurface, InstalledNames<TProperties>> & Pick<TInstalledPropertyCandidate, (string extends keyof TProperties ? never : {
|
|
68
|
+
[K in keyof TProperties & string]: TProperties[K] extends {
|
|
69
|
+
readonly [descriptorFreePropertySpec]: true;
|
|
70
|
+
} ? Camelized<Dashed<K>> : never;
|
|
71
|
+
}[keyof TProperties & string]) & {
|
|
72
|
+
[K in keyof TInstalledPropertyCandidate]-?: Extract<TInstalledPropertyCandidate[K], (...args: never[]) => unknown> extends never ? (<U>(probe: U) => U extends {
|
|
73
|
+
[P in K]: TInstalledPropertyCandidate[P];
|
|
74
|
+
} ? 1 : 2) extends (<U>(probe: U) => U extends {
|
|
75
|
+
-readonly [P in K]: TInstalledPropertyCandidate[P];
|
|
76
|
+
} ? 1 : 2) ? K : never : never;
|
|
77
|
+
}[keyof TInstalledPropertyCandidate]>> = TRemainingInterfaces extends readonly [
|
|
78
|
+
infer TInterface extends Interface<TInstance>,
|
|
79
|
+
...infer TRest extends readonly Interface<TInstance>[]
|
|
80
|
+
] ? (ReturnType<TInterface["__impl__"]> extends infer TInterfaceInstance extends object ? RegisteredInstance<TInstance, TProperties, TSignals, TInterfaces, TRest, TMemberSurface & Omit<TInterfaceInstance, keyof TInstance | keyof TMemberSurface | "__properties__" | "__writableProperties__" | "__signalEmit__" | "__signals__" | TLegacySignalMembers> & {
|
|
81
|
+
[K in Extract<TInterfaceInstance extends {
|
|
82
|
+
[naturalSignalMember]?: infer TMembers;
|
|
83
|
+
} ? keyof NonNullable<TMembers> : never, TLegacySignalMembers> as K extends TNaturalInstanceMembers | keyof TMemberSurface ? never : K]: K extends keyof TInterfaceInstance ? TInterfaceInstance[K] : never;
|
|
84
|
+
}, TInterfaceInstance extends {
|
|
85
|
+
__signals__?: infer TNextSignalMap;
|
|
86
|
+
} ? Omit<TSignalSurface, keyof {
|
|
87
|
+
[K in keyof NonNullable<TNextSignalMap> as K extends string ? Dashed<K extends `${infer TBase}::${string}` ? TBase : K> extends TClassInstanceSignals | Dashed<keyof TSignals & string> ? never : K : K]: NonNullable<TNextSignalMap>[K];
|
|
88
|
+
}> & {
|
|
89
|
+
[K in keyof NonNullable<TNextSignalMap> as K extends string ? Dashed<K extends `${infer TBase}::${string}` ? TBase : K> extends TClassInstanceSignals | Dashed<keyof TSignals & string> ? never : K : K]: NonNullable<TNextSignalMap>[K];
|
|
90
|
+
} : TSignalSurface, TInterfaceInstance extends {
|
|
91
|
+
__signalEmit__?: infer TNextSignalEmitMap;
|
|
92
|
+
} ? Omit<TSignalEmitSurface, keyof {
|
|
93
|
+
[K in keyof NonNullable<TNextSignalEmitMap> as K extends string ? Dashed<K extends `${infer TBase}::${string}` ? TBase : K> extends TClassInstanceSignals | Dashed<keyof TSignals & string> ? never : K : K]: NonNullable<TNextSignalEmitMap>[K];
|
|
94
|
+
}> & {
|
|
95
|
+
[K in keyof NonNullable<TNextSignalEmitMap> as K extends string ? Dashed<K extends `${infer TBase}::${string}` ? TBase : K> extends TClassInstanceSignals | Dashed<keyof TSignals & string> ? never : K : K]: NonNullable<TNextSignalEmitMap>[K];
|
|
96
|
+
} : TSignalEmitSurface, TPropertySurface & Omit<TInterfaceInstance extends {
|
|
97
|
+
[propertyMapOverride]?: infer TResolver;
|
|
98
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInterfaceInstance extends {
|
|
99
|
+
__properties__?: infer TMap;
|
|
100
|
+
} ? NonNullable<TMap> : object : TInterfaceInstance extends {
|
|
101
|
+
__properties__?: infer TMap;
|
|
102
|
+
} ? NonNullable<TMap> : object, keyof TPropertySurface>, TWritablePropertySurface & Omit<TInterfaceInstance extends {
|
|
103
|
+
[writablePropertyMapOverride]?: infer TResolver;
|
|
104
|
+
} ? TResolver extends () => infer TMap ? NonNullable<TMap> : TInterfaceInstance extends {
|
|
105
|
+
__writableProperties__?: infer TMap;
|
|
106
|
+
} ? NonNullable<TMap> : object : TInterfaceInstance extends {
|
|
107
|
+
__writableProperties__?: infer TMap;
|
|
108
|
+
} ? NonNullable<TMap> : object, keyof TWritablePropertySurface>, TNaturalInstanceMembers, TClassInstanceSignals, TLegacySignalMembers> : never) : TInstance & TMemberSurface & DeclaredSignalMethods<TSignals, TNaturalInstanceMembers | Extract<keyof TMemberSurface, TLegacySignalMembers>> & {
|
|
109
|
+
[naturalSignalMember]?: Record<TNaturalInstanceMembers | Extract<keyof TMemberSurface, TLegacySignalMembers>, true>;
|
|
110
|
+
[classSignalMember]?: Record<TClassInstanceSignals | Dashed<keyof TSignals & string>, true>;
|
|
111
|
+
[signalMapOverride]?: () => Omit<TSignalSurface, DeclaredSignalName<TSignals>> & Record<DeclaredSignalName<TSignals>, (...args: never[]) => unknown>;
|
|
112
|
+
[signalEmitMapOverride]?: () => Omit<TSignalEmitSurface, DeclaredSignalName<TSignals>> & Record<DeclaredSignalName<TSignals>, {
|
|
113
|
+
args: unknown[];
|
|
114
|
+
result: unknown;
|
|
115
|
+
}>;
|
|
116
|
+
[propertyMapOverride]?: () => TRegisteredPropertySurface;
|
|
117
|
+
[writablePropertyMapOverride]?: () => TRegisteredWritablePropertySurface;
|
|
118
|
+
__properties__: TRegisteredPropertySurface;
|
|
119
|
+
__writableProperties__: TRegisteredWritablePropertySurface;
|
|
38
120
|
};
|
|
39
121
|
/** A registered class's construct signature and prototype. */
|
|
40
122
|
type RegisteredConstructor<TClass, TArgs extends unknown[], TInstance> = {
|
|
@@ -44,7 +126,7 @@ type RegisteredConstructor<TClass, TArgs extends unknown[], TInstance> = {
|
|
|
44
126
|
/** The statics a registered class keeps from the class it was, joined with {@link RegisteredConstructor}. */
|
|
45
127
|
type RegisteredParts<TClass, TArgs extends unknown[], TInstance> = Omit<TClass, "prototype"> & RegisteredConstructor<TClass, TArgs, TInstance>;
|
|
46
128
|
/** The registered class with its declared properties and signals. */
|
|
47
|
-
type RegisteredClass<TClass extends AnyClass, TProperties, TSignals> = TClass extends abstract new (...args: infer TArgs) => infer TInstance ? RegisteredParts<TClass, TArgs, RegisteredInstance<TInstance, TProperties, TSignals>> : never;
|
|
129
|
+
type RegisteredClass<TClass extends AnyClass, TProperties, TSignals, TInterfaces extends readonly Interface<TClass["prototype"]>[]> = TClass extends abstract new (...args: infer TArgs) => infer TInstance ? RegisteredParts<TClass, TArgs, RegisteredInstance<TInstance, TProperties, TSignals, TInterfaces>> : never;
|
|
48
130
|
/** A numeric GType or a generated or registered wrapper class. */
|
|
49
131
|
type SignalGType = bigint | AnyClass<TypedClass>;
|
|
50
132
|
/** A signal installed by {@link registerClass}. */
|
|
@@ -59,7 +141,7 @@ type SignalSpec = {
|
|
|
59
141
|
accumulator?: "first-wins" | "true-handled";
|
|
60
142
|
};
|
|
61
143
|
/** What {@link registerClass} adds to the new GType beyond the vtable slots it discovers on the class. */
|
|
62
|
-
type RegisterClassOptions<TInstance extends object, TProperties extends Record<string, PropertySpec>, TSignals extends Record<string, SignalSpec
|
|
144
|
+
type RegisterClassOptions<TInstance extends object, TProperties extends Record<string, PropertySpec>, TSignals extends Record<string, SignalSpec>, TInterfaces extends readonly Interface<TInstance>[]> = {
|
|
63
145
|
/** Registered GType name, defaulting to the class name. */
|
|
64
146
|
typeName?: string;
|
|
65
147
|
/** Prevents direct construction while allowing registered subclasses. */
|
|
@@ -72,7 +154,7 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
72
154
|
*/
|
|
73
155
|
classInit?(typeStruct: object): void;
|
|
74
156
|
/** Interfaces implemented through matching `vfunc` methods. */
|
|
75
|
-
implements?:
|
|
157
|
+
implements?: TInterfaces;
|
|
76
158
|
/**
|
|
77
159
|
* ParamSpecs keyed by their JavaScript property names. Keys and ParamSpec names must canonicalize
|
|
78
160
|
* to the same member. Writes validate flags, types, and ranges and notify only on changes.
|
|
@@ -101,6 +183,6 @@ type RegisterClassOptions<TInstance extends object, TProperties extends Record<s
|
|
|
101
183
|
* @throws For invalid parents, names, interfaces, vfuncs, properties, signals, or widget options.
|
|
102
184
|
* A `classInit` exception propagates after the static type has been registered and cannot be undone.
|
|
103
185
|
*/
|
|
104
|
-
declare function registerClass<T extends AnyClass, TProperties extends Record<string, PropertySpec> = Record<never, PropertySpec>, TSignals extends Record<string, SignalSpec> = Record<never, SignalSpec
|
|
186
|
+
declare function registerClass<T extends AnyClass, TProperties extends Record<string, PropertySpec> = Record<never, PropertySpec>, TSignals extends Record<string, SignalSpec> = Record<never, SignalSpec>, const TInterfaces extends readonly Interface<T["prototype"]>[] = readonly Interface<T["prototype"]>[]>(klass: T, options?: RegisterClassOptions<T["prototype"], TProperties, TSignals, TInterfaces>): RegisteredClass<T, TProperties, TSignals, TInterfaces>;
|
|
105
187
|
export { type Interface, registerClass, type SignalGType, type SignalSpec };
|
|
106
188
|
//# sourceMappingURL=register-class.d.ts.map
|