@gtkx/runtime 1.0.0-rc.3 → 1.0.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.
Files changed (141) hide show
  1. package/README.md +8 -9
  2. package/dist/application-class.d.ts +32 -0
  3. package/dist/application-class.d.ts.map +1 -0
  4. package/dist/application-class.js +68 -0
  5. package/dist/application-class.js.map +1 -0
  6. package/dist/arg.d.ts +9 -3
  7. package/dist/arg.d.ts.map +1 -1
  8. package/dist/arg.js +4 -3
  9. package/dist/arg.js.map +1 -1
  10. package/dist/bind.d.ts +11 -0
  11. package/dist/bind.d.ts.map +1 -1
  12. package/dist/bind.js +11 -0
  13. package/dist/bind.js.map +1 -1
  14. package/dist/callback.d.ts +2 -1
  15. package/dist/callback.d.ts.map +1 -1
  16. package/dist/callback.js +119 -21
  17. package/dist/callback.js.map +1 -1
  18. package/dist/closure.d.ts +26 -0
  19. package/dist/closure.d.ts.map +1 -0
  20. package/dist/closure.js +99 -0
  21. package/dist/closure.js.map +1 -0
  22. package/dist/descriptors.d.ts +105 -6
  23. package/dist/descriptors.d.ts.map +1 -1
  24. package/dist/descriptors.js +56 -12
  25. package/dist/descriptors.js.map +1 -1
  26. package/dist/error.d.ts +7 -0
  27. package/dist/error.d.ts.map +1 -1
  28. package/dist/error.js +1 -1
  29. package/dist/error.js.map +1 -1
  30. package/dist/fn.d.ts +24 -3
  31. package/dist/fn.d.ts.map +1 -1
  32. package/dist/fn.js +70 -33
  33. package/dist/fn.js.map +1 -1
  34. package/dist/index.d.ts +29 -7
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +26 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/internal.d.ts +1 -0
  39. package/dist/internal.d.ts.map +1 -1
  40. package/dist/internal.js +1 -0
  41. package/dist/internal.js.map +1 -1
  42. package/dist/library.d.ts +2 -1
  43. package/dist/library.d.ts.map +1 -1
  44. package/dist/library.js +2 -1
  45. package/dist/library.js.map +1 -1
  46. package/dist/lifecycle.d.ts +52 -10
  47. package/dist/lifecycle.d.ts.map +1 -1
  48. package/dist/lifecycle.js +62 -18
  49. package/dist/lifecycle.js.map +1 -1
  50. package/dist/listeners.d.ts +6 -0
  51. package/dist/listeners.d.ts.map +1 -1
  52. package/dist/listeners.js +3 -1
  53. package/dist/listeners.js.map +1 -1
  54. package/dist/mixin.d.ts +16 -2
  55. package/dist/mixin.d.ts.map +1 -1
  56. package/dist/mixin.js +18 -6
  57. package/dist/mixin.js.map +1 -1
  58. package/dist/native-value.d.ts +8 -0
  59. package/dist/native-value.d.ts.map +1 -1
  60. package/dist/native-value.js +12 -3
  61. package/dist/native-value.js.map +1 -1
  62. package/dist/object.d.ts +34 -6
  63. package/dist/object.d.ts.map +1 -1
  64. package/dist/object.js +89 -25
  65. package/dist/object.js.map +1 -1
  66. package/dist/param-spec.d.ts +11 -0
  67. package/dist/param-spec.d.ts.map +1 -0
  68. package/dist/param-spec.js +149 -0
  69. package/dist/param-spec.js.map +1 -0
  70. package/dist/promisify.d.ts +3 -5
  71. package/dist/promisify.d.ts.map +1 -1
  72. package/dist/promisify.js +4 -3
  73. package/dist/promisify.js.map +1 -1
  74. package/dist/properties.d.ts +39 -7
  75. package/dist/properties.d.ts.map +1 -1
  76. package/dist/properties.js +305 -42
  77. package/dist/properties.js.map +1 -1
  78. package/dist/register-class.d.ts +119 -14
  79. package/dist/register-class.d.ts.map +1 -1
  80. package/dist/register-class.js +109 -80
  81. package/dist/register-class.js.map +1 -1
  82. package/dist/registry.d.ts +81 -17
  83. package/dist/registry.d.ts.map +1 -1
  84. package/dist/registry.js +72 -26
  85. package/dist/registry.js.map +1 -1
  86. package/dist/signal.d.ts +22 -3
  87. package/dist/signal.d.ts.map +1 -1
  88. package/dist/signal.js +64 -8
  89. package/dist/signal.js.map +1 -1
  90. package/dist/t.d.ts +44 -0
  91. package/dist/t.d.ts.map +1 -1
  92. package/dist/t.js.map +1 -1
  93. package/dist/type.d.ts +2 -2
  94. package/dist/type.d.ts.map +1 -1
  95. package/dist/type.js +2 -0
  96. package/dist/type.js.map +1 -1
  97. package/dist/value.d.ts +10 -10
  98. package/dist/value.d.ts.map +1 -1
  99. package/dist/value.js +44 -22
  100. package/dist/value.js.map +1 -1
  101. package/dist/vfunc-call.d.ts +37 -0
  102. package/dist/vfunc-call.d.ts.map +1 -0
  103. package/dist/vfunc-call.js +168 -0
  104. package/dist/vfunc-call.js.map +1 -0
  105. package/dist/vfunc-seeds.d.ts +12 -0
  106. package/dist/vfunc-seeds.d.ts.map +1 -0
  107. package/dist/vfunc-seeds.js +19 -0
  108. package/dist/vfunc-seeds.js.map +1 -0
  109. package/dist/vfunc.d.ts +8 -0
  110. package/dist/vfunc.d.ts.map +1 -0
  111. package/dist/vfunc.js +23 -0
  112. package/dist/vfunc.js.map +1 -0
  113. package/package.json +4 -4
  114. package/src/application-class.ts +116 -0
  115. package/src/arg.ts +11 -5
  116. package/src/bind.ts +11 -0
  117. package/src/callback.ts +163 -23
  118. package/src/closure.ts +136 -0
  119. package/src/descriptors.ts +137 -41
  120. package/src/error.ts +8 -1
  121. package/src/fn.ts +104 -39
  122. package/src/index.ts +36 -7
  123. package/src/internal.ts +1 -0
  124. package/src/library.ts +2 -1
  125. package/src/lifecycle.ts +99 -22
  126. package/src/listeners.ts +9 -1
  127. package/src/mixin.ts +27 -8
  128. package/src/native-value.ts +13 -3
  129. package/src/object.ts +128 -34
  130. package/src/param-spec.ts +235 -0
  131. package/src/promisify.ts +8 -8
  132. package/src/properties.ts +459 -45
  133. package/src/register-class.ts +329 -114
  134. package/src/registry.ts +150 -38
  135. package/src/signal.ts +101 -17
  136. package/src/t.ts +44 -0
  137. package/src/type.ts +3 -2
  138. package/src/value.ts +57 -19
  139. package/src/vfunc-call.ts +243 -0
  140. package/src/vfunc-seeds.ts +36 -0
  141. package/src/vfunc.ts +31 -0
@@ -1,73 +1,336 @@
1
- import { camelCase } from "@gtkx/utils";
1
+ import { camelCase, kebabCase } from "@gtkx/utils";
2
2
  import { bind } from "./bind.js";
3
+ import { biguint64T, stringT, structT, voidT } from "./descriptors.js";
3
4
  import { LIB, PARAM_T, VALUE_T } from "./library.js";
4
- import { getHandle } from "./registry.js";
5
- import { fromValue, intoValue } from "./value.js";
5
+ import { getParamFlags, getParamValueType, isParamConstructOnly, isParamLaxlyValidated, isParamWritable, valueGuardFor, wasParamValueModified, } from "./param-spec.js";
6
+ import { getHandle, getInterfaceProperties, instanceClassName } from "./registry.js";
7
+ import { typeName } from "./type.js";
8
+ import { fromValue, intoValue, newValueForType, valueWriterFor } from "./value.js";
6
9
  const FIRST_PROPERTY_ID = 1;
10
+ const GET_PROPERTY_VFUNC = "vfuncGetProperty";
11
+ const SET_PROPERTY_VFUNC = "vfuncSetProperty";
12
+ const READ_ONLY_REASON = "the property is read-only";
13
+ const CONSTRUCT_ONLY_REASON = "the property can only be set when the object is constructed";
14
+ const CLASS_T = structT("borrowed");
15
+ const interfaceStorages = new Map();
7
16
  const paramSpecDefaultValue = bind(LIB, "g_param_spec_get_default_value", [PARAM_T], VALUE_T);
17
+ const paramSpecName = bind(LIB, "g_param_spec_get_name", [PARAM_T], stringT("borrowed"));
18
+ const typeClassRef = bind(LIB, "g_type_class_ref", [biguint64T], CLASS_T);
19
+ const typeClassUnref = bind(LIB, "g_type_class_unref", [CLASS_T], voidT);
20
+ const classFindProperty = bind(LIB, "g_object_class_find_property", [CLASS_T, stringT("borrowed")], PARAM_T);
21
+ const getPropertyName = (pspec) => paramSpecName(getHandle(pspec));
8
22
  const underscoreCase = (name) => name.replaceAll("-", "_");
23
+ const canonicalCase = (name) => kebabCase(name).replaceAll("_", "-");
9
24
  const accessorNames = (name) => [...new Set([name, underscoreCase(name), camelCase(name)])];
25
+ const typeLabel = (type) => typeName(type) ?? String(type);
26
+ const defaultValueFor = (handle) => paramSpecDefaultValue(handle);
27
+ const holdsReason = (check) => `the property holds values of type '${typeLabel(check.valueType)}'`;
28
+ function checkFor(handle, name) {
29
+ const valueType = getParamValueType(handle);
30
+ return {
31
+ name,
32
+ propertyName: paramSpecName(handle),
33
+ handle,
34
+ flags: getParamFlags(handle),
35
+ valueType,
36
+ canHoldValue: valueGuardFor(valueType),
37
+ };
38
+ }
39
+ function findPropertySpec(klass, name) {
40
+ const found = classFindProperty(klass, name);
41
+ return found ?? classFindProperty(klass, canonicalCase(name));
42
+ }
43
+ function describeValue(value) {
44
+ if (typeof value === "string") {
45
+ return JSON.stringify(value);
46
+ }
47
+ if (typeof value === "object" && value !== null) {
48
+ return instanceClassName(value);
49
+ }
50
+ return String(value);
51
+ }
52
+ function propertyMessage(instance, check, tail) {
53
+ return `${instanceClassName(instance)}.${check.name}: ${tail}`;
54
+ }
55
+ function refusalTail(check, value, reason) {
56
+ return `cannot set property '${check.propertyName}' to ${describeValue(value)}; ${reason}`;
57
+ }
58
+ function serveTail(check, value) {
59
+ return `cannot serve property '${check.propertyName}' from ${describeValue(value)}; ${holdsReason(check)}`;
60
+ }
61
+ function assertValueFits(instance, check, value) {
62
+ if (check.canHoldValue(value)) {
63
+ return;
64
+ }
65
+ const tail = refusalTail(check, value, holdsReason(check));
66
+ throw new TypeError(propertyMessage(instance, check, tail));
67
+ }
68
+ function assertValueServes(instance, check, value) {
69
+ if (check.canHoldValue(value)) {
70
+ return;
71
+ }
72
+ throw new TypeError(propertyMessage(instance, check, serveTail(check, value)));
73
+ }
74
+ function assertValueValidates(instance, check, value, gValue) {
75
+ if (!wasParamValueModified(check.handle, gValue) || isParamLaxlyValidated(check.flags)) {
76
+ return;
77
+ }
78
+ const reason = `the value is invalid or out of range for type '${typeLabel(check.valueType)}', ` +
79
+ `and GObject would put ${describeValue(fromValue(gValue))} in its place`;
80
+ throw new RangeError(propertyMessage(instance, check, refusalTail(check, value, reason)));
81
+ }
82
+ function assertWritable(instance, check, value) {
83
+ if (isParamWritable(check.flags)) {
84
+ return;
85
+ }
86
+ throw new TypeError(propertyMessage(instance, check, refusalTail(check, value, READ_ONLY_REASON)));
87
+ }
88
+ function fillCheckedValue(instance, check, gValue, value) {
89
+ assertValueFits(instance, check, value);
90
+ check.write ??= valueWriterFor(check.valueType);
91
+ check.write(gValue, value);
92
+ assertValueValidates(instance, check, value, gValue);
93
+ }
94
+ function checkedValueFor(instance, check, value) {
95
+ const gValue = newValueForType(check.valueType);
96
+ fillCheckedValue(instance, check, gValue, value);
97
+ return gValue;
98
+ }
99
+ function assertValueAccepted(instance, check, value) {
100
+ check.scratch ??= newValueForType(check.valueType);
101
+ fillCheckedValue(instance, check, check.scratch, value);
102
+ }
103
+ function constructValueFor(wrapper, check, value) {
104
+ assertWritable(wrapper, check, value);
105
+ return { name: check.propertyName, value: checkedValueFor(wrapper, check, value) };
106
+ }
107
+ function constructPropertyFor(gtype, name, value, wrapper) {
108
+ const klass = typeClassRef(gtype);
109
+ try {
110
+ const pspec = findPropertySpec(klass, name);
111
+ return pspec === null ? undefined : constructValueFor(wrapper, checkFor(pspec, name), value);
112
+ }
113
+ finally {
114
+ typeClassUnref(klass);
115
+ }
116
+ }
10
117
  function readStored(instance, accessor) {
11
118
  if (!Object.hasOwn(instance, accessor.storage)) {
12
- const defaults = paramSpecDefaultValue(getHandle(accessor.pspec));
13
- instance[accessor.storage] = fromValue(defaults);
119
+ instance[accessor.storage] = fromValue(defaultValueFor(accessor.handle));
14
120
  }
15
121
  return instance[accessor.storage];
16
122
  }
17
- function defineAccessor(prototype, accessor, alias) {
18
- if (Object.getOwnPropertyDescriptor(prototype, alias) !== undefined) {
123
+ function storeValue(instance, accessor, value) {
124
+ instance[accessor.storage] = value;
125
+ }
126
+ function writeStored(instance, accessor, value) {
127
+ if (readStored(instance, accessor) === value) {
19
128
  return;
20
129
  }
21
- Object.defineProperty(prototype, alias, {
22
- configurable: true,
23
- enumerable: true,
24
- get() {
25
- return readStored(this, accessor);
26
- },
27
- set(value) {
28
- if (readStored(this, accessor) === value) {
29
- return;
30
- }
31
- this[accessor.storage] = value;
32
- this.notify?.(accessor.name);
33
- },
34
- });
130
+ storeValue(instance, accessor, value);
131
+ instance.notify?.(accessor.propertyName);
132
+ }
133
+ function writeProperty(instance, accessor, value) {
134
+ const stored = instance;
135
+ if (readStored(stored, accessor) === value) {
136
+ return;
137
+ }
138
+ assertValueAccepted(instance, accessor, value);
139
+ storeValue(stored, accessor, value);
140
+ instance.notify?.(accessor.propertyName);
141
+ }
142
+ function storedGetter(accessor) {
143
+ return function get() {
144
+ return readStored(this, accessor);
145
+ };
146
+ }
147
+ function memberGetter(accessor) {
148
+ return function get() {
149
+ return this[accessor.memberName];
150
+ };
151
+ }
152
+ function memberSetter(accessor) {
153
+ return function set(value) {
154
+ this[accessor.memberName] = value;
155
+ };
156
+ }
157
+ function refusalFor(accessor, reason) {
158
+ return function set(value) {
159
+ throw new TypeError(propertyMessage(this, accessor, refusalTail(accessor, value, reason)));
160
+ };
161
+ }
162
+ function checkedSetter(accessor) {
163
+ if (!isParamWritable(accessor.flags)) {
164
+ return refusalFor(accessor, READ_ONLY_REASON);
165
+ }
166
+ if (isParamConstructOnly(accessor.flags)) {
167
+ return refusalFor(accessor, CONSTRUCT_ONLY_REASON);
168
+ }
169
+ return function set(value) {
170
+ writeProperty(this, accessor, value);
171
+ };
172
+ }
173
+ function hasOwnMember(prototype, alias) {
174
+ return Object.getOwnPropertyDescriptor(prototype, alias) !== undefined;
175
+ }
176
+ function defineAccessor(prototype, descriptor, alias) {
177
+ if (hasOwnMember(prototype, alias)) {
178
+ return;
179
+ }
180
+ Object.defineProperty(prototype, alias, descriptor);
35
181
  }
36
182
  function installAccessors(klass, accessor) {
37
183
  const prototype = klass.prototype;
184
+ accessor.hasGeneratedMember = !hasOwnMember(prototype, accessor.memberName);
185
+ const descriptor = {
186
+ configurable: true,
187
+ enumerable: true,
188
+ get: accessor.hasGeneratedMember ? storedGetter(accessor) : memberGetter(accessor),
189
+ set: accessor.hasGeneratedMember ? checkedSetter(accessor) : memberSetter(accessor),
190
+ };
38
191
  for (const alias of accessorNames(accessor.name)) {
39
- defineAccessor(prototype, accessor, alias);
192
+ defineAccessor(prototype, descriptor, alias);
40
193
  }
41
194
  }
42
- function resolveAccessor(accessors, propertyId) {
43
- const accessor = accessors[propertyId - FIRST_PROPERTY_ID];
44
- if (accessor === undefined) {
45
- throw new RangeError(`registerClass: no property registered for id ${String(propertyId)}`);
195
+ function storageFor(propertyName) {
196
+ const existing = interfaceStorages.get(propertyName);
197
+ if (existing !== undefined) {
198
+ return existing;
199
+ }
200
+ const created = Symbol(`gtkx:property:${propertyName}`);
201
+ interfaceStorages.set(propertyName, created);
202
+ return created;
203
+ }
204
+ function interfaceAccessorFor(dispatch, pspec) {
205
+ const handle = getHandle(pspec);
206
+ const propertyName = paramSpecName(handle);
207
+ const delegate = dispatch.delegates.get(propertyName);
208
+ const accessor = {
209
+ ...checkFor(handle, propertyName),
210
+ memberName: camelCase(propertyName),
211
+ storage: storageFor(propertyName),
212
+ hasGeneratedMember: false,
213
+ isInterfaceProperty: true,
214
+ };
215
+ if (delegate !== undefined) {
216
+ accessor.delegate = delegate;
46
217
  }
47
218
  return accessor;
48
219
  }
49
- function makeGetProperty(accessors) {
50
- return function getProperty(propertyId, value) {
51
- const accessor = resolveAccessor(accessors, propertyId);
52
- const current = this[camelCase(accessor.name)];
220
+ function resolveAccessor(dispatch, propertyId, pspec) {
221
+ const accessor = dispatch.accessors[propertyId - FIRST_PROPERTY_ID];
222
+ if (accessor !== undefined) {
223
+ return accessor;
224
+ }
225
+ const created = interfaceAccessorFor(dispatch, pspec);
226
+ dispatch.accessors[propertyId - FIRST_PROPERTY_ID] = created;
227
+ return created;
228
+ }
229
+ function callMember(instance, member, args) {
230
+ const fn = instance[member];
231
+ if (typeof fn !== "function") {
232
+ throw new TypeError(`registerClass: ${instanceClassName(instance)} has no '${member}' member`);
233
+ }
234
+ return fn.apply(instance, args);
235
+ }
236
+ function backingMemberFor(instance, accessor) {
237
+ if (accessor.hasGeneratedMember && !Object.hasOwn(instance, accessor.memberName)) {
238
+ return undefined;
239
+ }
240
+ return accessor.memberName;
241
+ }
242
+ function readCurrent(instance, accessor) {
243
+ const getter = accessor.delegate?.getter;
244
+ if (getter !== undefined) {
245
+ return callMember(instance, getter, []);
246
+ }
247
+ if (accessor.isInterfaceProperty === true) {
248
+ return readStored(instance, accessor);
249
+ }
250
+ const member = backingMemberFor(instance, accessor);
251
+ return member === undefined
252
+ ? readStored(instance, accessor)
253
+ : instance[member];
254
+ }
255
+ function writeCurrent(instance, accessor, value) {
256
+ const setter = accessor.delegate?.setter;
257
+ if (setter !== undefined) {
258
+ callMember(instance, setter, [value]);
259
+ return;
260
+ }
261
+ if (accessor.isInterfaceProperty === true) {
262
+ writeStored(instance, accessor, value);
263
+ return;
264
+ }
265
+ const member = backingMemberFor(instance, accessor);
266
+ if (member === undefined) {
267
+ storeValue(instance, accessor, value);
268
+ return;
269
+ }
270
+ instance[member] = value;
271
+ }
272
+ function makeGetProperty(dispatch) {
273
+ return function getProperty(propertyId, value, pspec) {
274
+ const accessor = resolveAccessor(dispatch, propertyId, pspec);
275
+ const current = readCurrent(this, accessor);
276
+ assertValueServes(this, accessor, current);
53
277
  intoValue(getHandle(value), current);
54
278
  };
55
279
  }
56
- function makeSetProperty(accessors) {
57
- return function setProperty(propertyId, value) {
58
- const accessor = resolveAccessor(accessors, propertyId);
59
- const jsValue = fromValue(getHandle(value));
60
- this[camelCase(accessor.name)] = jsValue;
280
+ function makeSetProperty(dispatch) {
281
+ return function setProperty(propertyId, value, pspec) {
282
+ const accessor = resolveAccessor(dispatch, propertyId, pspec);
283
+ writeCurrent(this, accessor, fromValue(getHandle(value)));
61
284
  };
62
285
  }
63
- function buildAccessors(klass, properties) {
64
- const accessors = [];
286
+ function assertCanonicalName(klass, name, propertyName) {
287
+ const canonical = canonicalCase(name);
288
+ if (propertyName === canonical) {
289
+ return;
290
+ }
291
+ throw new TypeError(`registerClass: ${klass.name} keys the property '${name}' to a GObject.ParamSpec named ` +
292
+ `'${propertyName}', which is the name GObject notifies under; name the ParamSpec '${canonical}'`);
293
+ }
294
+ function assertCanonicalNames(klass, properties) {
65
295
  for (const [name, pspec] of Object.entries(properties)) {
66
- const accessor = { name, storage: Symbol(`gtkx:property:${name}`), pspec };
67
- installAccessors(klass, accessor);
68
- accessors.push(accessor);
296
+ assertCanonicalName(klass, name, getPropertyName(pspec));
69
297
  }
70
- return accessors;
298
+ }
299
+ function buildAccessor(klass, name, pspec) {
300
+ const accessor = {
301
+ ...checkFor(getHandle(pspec), name),
302
+ memberName: camelCase(name),
303
+ storage: Symbol(`gtkx:property:${name}`),
304
+ hasGeneratedMember: false,
305
+ };
306
+ installAccessors(klass, accessor);
307
+ return accessor;
308
+ }
309
+ function buildAccessors(source) {
310
+ const { klass, properties } = source;
311
+ assertCanonicalNames(klass, properties);
312
+ return Object.entries(properties).map(([name, pspec]) => buildAccessor(klass, name, pspec));
313
+ }
314
+ function addInterfaceDelegates(delegates, gtype) {
315
+ const properties = getInterfaceProperties(gtype) ?? {};
316
+ for (const [name, delegate] of Object.entries(properties)) {
317
+ if (!delegates.has(name)) {
318
+ delegates.set(name, delegate);
319
+ }
320
+ }
321
+ }
322
+ function interfaceDelegatesFor(adoptedTypes) {
323
+ const delegates = new Map();
324
+ for (const gtype of adoptedTypes) {
325
+ addInterfaceDelegates(delegates, gtype);
326
+ }
327
+ return delegates;
328
+ }
329
+ function buildPropertyDispatch(source) {
330
+ return {
331
+ accessors: buildAccessors(source),
332
+ delegates: interfaceDelegatesFor(source.adoptedTypes),
333
+ };
71
334
  }
72
335
  function toNativeProperties(properties) {
73
336
  return Object.values(properties).map((pspec, index) => ({
@@ -75,5 +338,5 @@ function toNativeProperties(properties) {
75
338
  pspec: getHandle(pspec),
76
339
  }));
77
340
  }
78
- export { buildAccessors, makeGetProperty, makeSetProperty, toNativeProperties, };
341
+ export { buildPropertyDispatch, constructPropertyFor, GET_PROPERTY_VFUNC, makeGetProperty, makeSetProperty, SET_PROPERTY_VFUNC, toNativeProperties, };
79
342
  //# sourceMappingURL=properties.js.map
@@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CAAC,KAAK,CAAC;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,OAAO,EACH,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,GAGrB,CAAC","sourcesContent":["import type { ExternalObject, Handle, RegisterClassProperty } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\nimport { camelCase } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { LIB, PARAM_T, VALUE_T } from \"./library.js\";\nimport { getHandle } from \"./registry.js\";\nimport { fromValue, intoValue } from \"./value.js\";\n\ntype PropertyAccessor = {\n name: string;\n storage: symbol;\n pspec: object;\n};\n\ntype PropertySpec = object;\ntype NotifyingObject = { notify?: (propertyName: string) => void };\n\nconst FIRST_PROPERTY_ID = 1;\nconst paramSpecDefaultValue = bind(LIB, \"g_param_spec_get_default_value\", [PARAM_T], VALUE_T);\n\nconst underscoreCase = (name: string): string => name.replaceAll(\"-\", \"_\");\nconst accessorNames = (name: string): string[] => [...new Set([name, underscoreCase(name), camelCase(name)])];\n\nfunction readStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor): unknown {\n if (!Object.hasOwn(instance, accessor.storage)) {\n const defaults = paramSpecDefaultValue(getHandle(accessor.pspec)) as ExternalObject<Handle>;\n instance[accessor.storage] = fromValue(defaults);\n }\n\n return instance[accessor.storage];\n}\n\nfunction defineAccessor(prototype: object, accessor: PropertyAccessor, alias: string): void {\n if (Object.getOwnPropertyDescriptor(prototype, alias) !== undefined) {\n return;\n }\n\n Object.defineProperty(prototype, alias, {\n configurable: true,\n enumerable: true,\n get(this: Record<symbol, unknown>) {\n return readStored(this, accessor);\n },\n set(this: Record<symbol, unknown>, value: unknown) {\n if (readStored(this, accessor) === value) {\n return;\n }\n\n this[accessor.storage] = value;\n (this as NotifyingObject).notify?.(accessor.name);\n },\n });\n}\n\nfunction installAccessors(klass: AnyClass, accessor: PropertyAccessor): void {\n const prototype = (klass as { prototype: object }).prototype;\n\n for (const alias of accessorNames(accessor.name)) {\n defineAccessor(prototype, accessor, alias);\n }\n}\n\nfunction resolveAccessor(accessors: PropertyAccessor[], propertyId: number): PropertyAccessor {\n const accessor = accessors[propertyId - FIRST_PROPERTY_ID];\n\n if (accessor === undefined) {\n throw new RangeError(`registerClass: no property registered for id ${String(propertyId)}`);\n }\n\n return accessor;\n}\n\nfunction makeGetProperty(accessors: PropertyAccessor[]) {\n return function getProperty(this: object, propertyId: number, value: object): void {\n const accessor = resolveAccessor(accessors, propertyId);\n const current = (this as Record<string, unknown>)[camelCase(accessor.name)];\n intoValue(getHandle(value), current);\n };\n}\n\nfunction makeSetProperty(accessors: PropertyAccessor[]) {\n return function setProperty(this: object, propertyId: number, value: object): void {\n const accessor = resolveAccessor(accessors, propertyId);\n const jsValue = fromValue(getHandle(value));\n (this as Record<string, unknown>)[camelCase(accessor.name)] = jsValue;\n };\n}\n\nfunction buildAccessors(klass: AnyClass, properties: Record<string, PropertySpec>): PropertyAccessor[] {\n const accessors: PropertyAccessor[] = [];\n\n for (const [name, pspec] of Object.entries(properties)) {\n const accessor: PropertyAccessor = { name, storage: Symbol(`gtkx:property:${name}`), pspec };\n installAccessors(klass, accessor);\n accessors.push(accessor);\n }\n\n return accessors;\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 buildAccessors,\n makeGetProperty,\n makeSetProperty,\n toNativeProperties,\n type PropertyAccessor,\n type PropertySpec,\n};\n"]}
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB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B,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GAIrB,CAAC","sourcesContent":["import type { ExternalObject, Handle, RegisterClassProperty } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\nimport { camelCase, kebabCase } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { biguint64T, stringT, structT, voidT } from \"./descriptors.js\";\nimport { LIB, PARAM_T, VALUE_T } from \"./library.js\";\nimport {\n getParamFlags,\n getParamValueType,\n isParamConstructOnly,\n isParamLaxlyValidated,\n isParamWritable,\n type ValueGuard,\n valueGuardFor,\n wasParamValueModified,\n} from \"./param-spec.js\";\nimport { getHandle, getInterfaceProperties, instanceClassName, type InterfaceProperty } from \"./registry.js\";\nimport { typeName } from \"./type.js\";\nimport { fromValue, intoValue, newValueForType, type ValueWriter, valueWriterFor } 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 write?: ValueWriter;\n scratch?: ExternalObject<Handle>;\n};\n\ntype PropertyAccessor = PropertyCheck & {\n memberName: string;\n storage: symbol;\n hasGeneratedMember: boolean;\n isInterfaceProperty?: boolean;\n delegate?: InterfaceProperty;\n};\n\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 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 classFindProperty = bind(LIB, \"g_object_class_find_property\", [CLASS_T, stringT(\"borrowed\")], 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 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: valueGuardFor(valueType),\n };\n}\n\nfunction findPropertySpec(klass: ExternalObject<Handle>, name: string): ExternalObject<Handle> | null {\n const found = classFindProperty(klass, name) as ExternalObject<Handle> | null;\n\n return found ?? (classFindProperty(klass, canonicalCase(name)) as ExternalObject<Handle> | null);\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 fillCheckedValue(\n instance: object,\n check: PropertyCheck,\n gValue: ExternalObject<Handle>,\n value: unknown,\n): void {\n assertValueFits(instance, check, value);\n check.write ??= valueWriterFor(check.valueType);\n check.write(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\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] = value;\n}\n\nfunction writeStored(instance: Record<symbol, unknown>, accessor: PropertyAccessor, value: unknown): void {\n if (readStored(instance, accessor) === 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) === value) {\n return;\n }\n\n assertValueAccepted(instance, accessor, value);\n storeValue(stored, accessor, value);\n (instance as NotifyingObject).notify?.(accessor.propertyName);\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: PropertyAccessor): (this: object) => unknown {\n return function get(this: object) {\n return (this as Record<string, unknown>)[accessor.memberName];\n };\n}\n\nfunction memberSetter(accessor: PropertyAccessor): (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: PropertyAccessor): (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: PropertyAccessor): 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): PropertyAccessor {\n const handle = getHandle(pspec);\n const propertyName = paramSpecName(handle) as string;\n const delegate = dispatch.delegates.get(propertyName);\n\n const accessor: PropertyAccessor = {\n ...checkFor(handle, propertyName),\n memberName: camelCase(propertyName),\n storage: storageFor(propertyName),\n hasGeneratedMember: false,\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: PropertyAccessor): 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 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 storeValue(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 intoValue(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\nfunction assertCanonicalName(klass: AnyClass, name: string, propertyName: string): void {\n const canonical = canonicalCase(name);\n\n if (propertyName === canonical) {\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 '${canonical}'`,\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): PropertyAccessor {\n const accessor: PropertyAccessor = {\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): PropertyAccessor[] {\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 buildPropertyDispatch(source: PropertyDispatchSource): PropertyDispatch {\n return {\n accessors: buildAccessors(source),\n delegates: interfaceDelegatesFor(source.adoptedTypes),\n };\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 constructPropertyFor,\n GET_PROPERTY_VFUNC,\n makeGetProperty,\n makeSetProperty,\n SET_PROPERTY_VFUNC,\n toNativeProperties,\n type ConstructProperty,\n type PropertyDispatch,\n type PropertySpec,\n};\n"]}
@@ -1,25 +1,130 @@
1
1
  import { type AnyClass } from "@gtkx/utils";
2
2
  import { type PropertySpec } from "./properties.js";
3
- type RegisterClassOptions = {
3
+ /**
4
+ * A generated interface value, such as `Gio.ListModel`, in the form {@link registerClass} takes it.
5
+ * `__impl__` exists only in the type system: it carries the interface's `Impl` type, of which a class
6
+ * has to match every member it declares itself, which rejects a class value and a member whose
7
+ * signature does not fit the slot it fills. Leaving a slot to the interface is not rejected,
8
+ * because `registerClass` does not reject it either: every member of an `Impl` type is optional,
9
+ * and the `Partial` holds that open whatever the type declares. The `object` beside it keeps
10
+ * TypeScript from also demanding one member in common. An interface that introspection describes
11
+ * no vtable for carries `unknown`, since it has no slot a class could fill.
12
+ */
13
+ type Interface<TImpl> = AnyClass & {
14
+ /** Type-level slot holding the interface's `Impl` type; no value ever carries it. */
15
+ __impl__: (impl: Partial<TImpl> & object) => void;
16
+ };
17
+ /**
18
+ * One key of `RegisterClassOptions.properties` with every underscore turned into the dash a canonical
19
+ * GObject property name separates its words with.
20
+ */
21
+ type Dashed<TName extends string> = TName extends `${infer THead}_${infer TTail}` ? Dashed<`${THead}-${TTail}`> : TName;
22
+ /**
23
+ * One dashed key in the camelCase spelling the accessors {@link registerClass} installs carry, which is
24
+ * the spelling the hooks that address a property by name take.
25
+ */
26
+ type Camelized<TName extends string> = TName extends `${infer THead}-${infer TTail}` ? `${THead}${Capitalize<Camelized<TTail>>}` : TName;
27
+ /**
28
+ * The names a registered class carries in its property map: every key of
29
+ * `RegisterClassOptions.properties` in camelCase, whichever of the three spellings it was written in.
30
+ * A `properties` object given a type of its own rather than left to inference has `string` for its key
31
+ * type and names nothing, because a name only known as `string` addresses no member in particular.
32
+ */
33
+ type InstalledNames<TProperties> = string extends keyof TProperties ? never : Camelized<Dashed<keyof TProperties & string>>;
34
+ /**
35
+ * An instance of a registered class: everything the class itself declares, plus the property map the
36
+ * hooks that address a property by name, such as `useProperty` from `@gtkx/react`, read the installed
37
+ * names off. Each name is typed with the value type the class declares for the member of that name,
38
+ * so a property the class does not `declare` contributes nothing.
39
+ */
40
+ type RegisteredInstance<TInstance, TProperties> = TInstance & {
41
+ /** Type-level map from installed property name to value type; no value ever carries it. */
42
+ __properties__: Pick<TInstance, InstalledNames<TProperties> & keyof TInstance>;
43
+ };
44
+ /**
45
+ * The construct signature and prototype a registered class carries, both giving
46
+ * {@link RegisteredInstance}. The signature stays abstract for as long as the class itself is, so
47
+ * registering an abstract base leaves it as impossible to construct as it was.
48
+ */
49
+ type RegisteredConstructor<TClass, TArgs extends unknown[], TInstance> = {
50
+ /** Object the class's instances inherit from. */
51
+ prototype: TInstance;
52
+ } & (TClass extends new (...args: never) => unknown ? new (...args: TArgs) => TInstance : abstract new (...args: TArgs) => TInstance);
53
+ /**
54
+ * The class {@link registerClass} hands back: the same class, with the same statics, whose instances
55
+ * carry the properties `RegisterClassOptions.properties` installed. Binding the call to a name, rather
56
+ * than discarding it, is what carries those names into the type system.
57
+ */
58
+ type RegisteredClass<TClass extends AnyClass, TProperties> = TClass extends abstract new (...args: infer TArgs) => infer TInstance ? Omit<TClass, "prototype"> & RegisteredConstructor<TClass, TArgs, RegisteredInstance<TInstance, TProperties>> : never;
59
+ /** What {@link registerClass} adds to the new GType beyond the vtable slots it discovers on the class. */
60
+ type RegisterClassOptions<TInstance extends object, TProperties extends Record<string, PropertySpec>> = {
61
+ /** Name to register the new GType under, defaulting to the class's own name. */
4
62
  typeName?: string;
5
63
  /**
6
- * Properties to install on the new type, keyed by canonical property name. Each value is the
7
- * `GObject.ParamSpec` describing it, for example `GObject.paramSpecString(...)`. Accessors are
8
- * generated on the prototype for the dashed, underscored and camelCased spellings of the name
9
- * unless the class already defines one, and writing through them emits `notify`.
64
+ * Interfaces the new type implements on top of the ones it inherits, given as the interface values
65
+ * themselves, such as `Gio.ListModel`. Their vtable slots are filled from the `vfunc`-prefixed methods on
66
+ * the class's prototype chain, each of which has to match the interface's `Impl` type, such as
67
+ * `Gio.ListModelImpl`.
10
68
  */
11
- properties?: Record<string, PropertySpec>;
69
+ implements?: Interface<TInstance>[];
70
+ /**
71
+ * Properties to install on the new type, keyed by the name JavaScript addresses each one by and
72
+ * valued with the `GObject.ParamSpec` describing it. A key is read in camelCase however it is
73
+ * written, so `dewPoint`, `dew_point` and `dew-point` all name the same member, and the ParamSpec
74
+ * has to carry the canonical spelling of that name, `dew-point`, or registration throws: the
75
+ * ParamSpec's name is the one GObject emits `notify` with, and a name the key does not spell
76
+ * reaches nothing that listens for it. Every property gains prototype accessors, one for the key
77
+ * as written, one for it with dashes turned into underscores and one for it in camelCase, each
78
+ * unless the class already defines that name. They serve the value from storage of their own on
79
+ * the instance, which is also what the type's `get_property` and `set_property` slots read and
80
+ * write, so a value set from JavaScript, from `g_object_set_property` and at construction all
81
+ * land in the same place.
82
+ *
83
+ * A write the ParamSpec would refuse throws rather than reaching GObject, which reports such a
84
+ * write as a GLib critical and drops it: a `TypeError` for a read-only or construct-only
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 two checks run over a value handed to the constructor, where
87
+ * a construct-only property is the one that is writable. An accepted write emits one `notify`,
88
+ * which a `freeze_notify` batch collects; a write of the value the property already holds is
89
+ * dropped and emits none.
90
+ *
91
+ * A class that defines the camelCase member itself owns the property: its own accessor decides
92
+ * what a write means, the other two spellings forward to it, and the type's property slots read
93
+ * and write it rather than the generated storage.
94
+ */
95
+ properties?: TProperties;
12
96
  };
13
97
  /**
14
- * Registers a subclass of a wrapper class as a new GType, wiring up any class and
15
- * inherited-interface virtual functions it overrides. Throws if the class does not
16
- * extend a registered wrapper class, has no derivable type name, or overrides an
17
- * unsupported construct-time vtable slot.
98
+ * Registers a subclass of a wrapper class as a new GType, wiring up any class and interface
99
+ * virtual functions it overrides, both for the interfaces it inherits and for the ones
100
+ * `RegisterClassOptions.implements` names.
101
+ *
102
+ * Throws when the class does not extend a registered wrapper class, when it has no derivable type
103
+ * name, when an entry in `RegisterClassOptions.implements` is not a registered interface, when a
104
+ * listed interface has a prerequisite that neither the parent type nor another listed interface meets,
105
+ * and when an entry in `RegisterClassOptions.properties` names its `GObject.ParamSpec` something other
106
+ * than the canonical spelling of the key it sits under.
107
+ *
108
+ * A slot is filled from the `vfunc`-prefixed methods on the class's prototype chain, up to but not
109
+ * including the registered ancestor the class extends, so a method an intermediate base class
110
+ * declares fills a slot the same way one the class itself declares does. A slot nothing on that
111
+ * chain fills is left untouched.
112
+ *
113
+ * Declare every slot as a method: a class field holding a function, such as `vfuncGetNItems = () => 1`,
114
+ * is assigned to each instance after registration and never reaches the vtable.
115
+ *
116
+ * An override of `vfuncConstructed` runs from inside the base constructor, before JavaScript
117
+ * installs the subclass's field initializers and runs its constructor body, so a field still
118
+ * reads `undefined` there and reading a `#private` field throws. Declare state the override
119
+ * touches without an initializer, and assign private state from the constructor body after
120
+ * `super()`. An instance a native caller creates, through `GObject.newv` or `Gtk.Builder`,
121
+ * never runs the subclass constructor at all, so its declared fields stay uninitialized for
122
+ * the object's whole life.
18
123
  *
19
124
  * @param klass The subclass to register.
20
- * @param options Registration options, such as an explicit type name.
21
- * @returns The same class, now registered.
125
+ * @param options What the new GType gains beyond the vtable slots the class overrides.
126
+ * @returns The same class, now registered, with every name in `options.properties` in its property map.
22
127
  */
23
- declare function registerClass<T extends AnyClass>(klass: T, options?: RegisterClassOptions): T;
24
- export { registerClass };
128
+ declare function registerClass<T extends AnyClass, TProperties extends Record<string, PropertySpec> = Record<never, PropertySpec>>(klass: T, options?: RegisterClassOptions<T["prototype"], TProperties>): RegisteredClass<T, TProperties>;
129
+ export { type Interface, registerClass };
25
130
  //# sourceMappingURL=register-class.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-class.d.ts","sourceRoot":"","sources":["../src/register-class.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,EAAkC,MAAM,aAAa,CAAC;AAE5E,OAAO,EAKH,KAAK,YAAY,EAEpB,MAAM,iBAAiB,CAAC;AAUzB,KAAK,oBAAoB,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC7C,CAAC;AAWF;;;;;;;;;GASG;AACH,iBAAS,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAE,oBAAyB,GAAG,CAAC,CAuB1F;AAkOD,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"register-class.d.ts","sourceRoot":"","sources":["../src/register-class.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAkC,MAAM,aAAa,CAAC;AAG5E,OAAO,EAMH,KAAK,YAAY,EAGpB,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;;;GASG;AACH,KAAK,SAAS,CAAC,KAAK,IAAI,QAAQ,GAAG;IAC/B,qFAAqF;IACrF,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO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