@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 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mapp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,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAkBtG;AAED;;;;;;;GAOG;AACH,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAK7F;AAED;;;;;;;;GAQG;AACH,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5G;AAED,OAAO,EACH,uBAAuB,EACvB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACzB,CAAC"}
package/dist/object.js CHANGED
@@ -1,41 +1,105 @@
1
+ import { newObject } from "@gtkx/native";
2
+ import { getParentClass } from "@gtkx/utils";
1
3
  import { bind } from "./bind.js";
2
- import { biguint64T, objectT, sizedArrayT, stringT, uint32T, voidT } from "./descriptors.js";
3
- import { LIB, VALUE_SIZE, VALUE_T } from "./library.js";
4
- import { getHandle } from "./registry.js";
4
+ import { objectT, stringT, voidT } from "./descriptors.js";
5
+ import { LIB, VALUE_T } from "./library.js";
6
+ import { constructPropertyFor } from "./properties.js";
7
+ import { getHandle, registerWrapper } from "./registry.js";
5
8
  import { fromValue, newValueForDescriptor, toValue } from "./value.js";
6
- const gObjectNewWithProperties = bind(LIB, "g_object_new_with_properties", [
7
- biguint64T,
8
- uint32T,
9
- sizedArrayT(stringT("borrowed"), 1, "borrowed"),
10
- sizedArrayT(VALUE_T, 1, "borrowed", VALUE_SIZE),
11
- ], objectT("full"));
9
+ const declaredBindings = new WeakMap();
10
+ const resolvedBindings = new WeakMap();
11
+ const declarations = { generation: 0 };
12
+ const NO_BINDINGS = Object.create(null);
12
13
  const gObjectGetProperty = bind(LIB, "g_object_get_property", [objectT("borrowed"), stringT("borrowed"), VALUE_T], voidT);
13
14
  const gObjectSetProperty = bind(LIB, "g_object_set_property", [objectT("borrowed"), stringT("borrowed"), VALUE_T], voidT);
15
+ function collectDeclaredBindings(cls) {
16
+ const declared = [];
17
+ let current = cls;
18
+ while (current !== null) {
19
+ const own = declaredBindings.get(current);
20
+ if (own !== undefined) {
21
+ declared.push(own);
22
+ }
23
+ current = getParentClass(current);
24
+ }
25
+ return declared;
26
+ }
27
+ function mergeDeclaredBindings(cls) {
28
+ const declared = collectDeclaredBindings(cls);
29
+ const merged = Object.create(null);
30
+ for (let index = declared.length - 1; index >= 0; index--) {
31
+ Object.assign(merged, declared[index]);
32
+ }
33
+ return merged;
34
+ }
35
+ function constructBindingsFor(cls) {
36
+ if (cls === undefined) {
37
+ return NO_BINDINGS;
38
+ }
39
+ const cached = resolvedBindings.get(cls);
40
+ if (cached?.generation === declarations.generation) {
41
+ return cached.bindings;
42
+ }
43
+ const bindings = mergeDeclaredBindings(cls);
44
+ resolvedBindings.set(cls, { generation: declarations.generation, bindings });
45
+ return bindings;
46
+ }
47
+ /**
48
+ * Declares the construct properties a wrapper class accepts, so `newObjectWithProperties`
49
+ * marshals each one through its descriptor rather than resolving it from the
50
+ * `GObject.ParamSpec` the type installs. A class inherits the declarations of its ancestors.
51
+ * Registering takes effect immediately, including for classes already constructed from and for
52
+ * subclasses that already inherited an earlier declaration.
53
+ *
54
+ * @param cls The wrapper class the properties are declared on.
55
+ * @param bindings CamelCased property names mapped to their canonical name and descriptor.
56
+ */
57
+ function registerConstructProperties(cls, bindings) {
58
+ declaredBindings.set(cls, bindings);
59
+ declarations.generation += 1;
60
+ }
61
+ function constructPropertyForEntry(source, name, value) {
62
+ if (value === undefined) {
63
+ return undefined;
64
+ }
65
+ const binding = source.bindings[name];
66
+ if (binding === undefined) {
67
+ return constructPropertyFor(source.gtype, name, value, source.wrapper);
68
+ }
69
+ return { name: binding[0], value: toValue(binding[1], value) };
70
+ }
14
71
  /**
15
72
  * Constructs a new GObject of the given type, setting the supplied construct
16
- * properties. Entries whose value is `undefined` or not a `[descriptor, value]`
17
- * pair are skipped.
73
+ * properties, and binds `wrapper` to it. A property the wrapper's class declares
74
+ * through `registerConstructProperties` is marshalled through its descriptor; any
75
+ * other one is marshalled through the `GObject.ParamSpec` the type installs under
76
+ * that name, dashed or camelCased, and is skipped when the type installs none.
77
+ * A value that ParamSpec would refuse throws before GObject sees it: a `TypeError`
78
+ * for a read-only property and for a value of a type the property cannot hold, and
79
+ * a `RangeError` for a value the ParamSpec rejects.
80
+ * Properties whose value is `undefined` are skipped. A type registered with
81
+ * `registerClass` binds the wrapper before its `constructed` slot runs, so an
82
+ * override of that slot already sees a usable instance.
18
83
  *
19
84
  * @param gtype The GType of the object to construct.
20
- * @param props Property names mapped to `[descriptor, value]` pairs.
85
+ * @param props Property names mapped to the values to set them to.
86
+ * @param wrapper The wrapper instance to bind to the new object.
21
87
  * @returns The handle of the newly created object.
22
88
  */
23
- function newObjectWithProperties(gtype, props) {
89
+ function newObjectWithProperties(gtype, props, wrapper) {
24
90
  const names = [];
25
91
  const values = [];
26
- for (const name in props) {
27
- const entry = props[name];
28
- if (!Array.isArray(entry)) {
29
- continue;
30
- }
31
- const [descriptor, value] = entry;
32
- if (value === undefined) {
33
- continue;
92
+ const bindings = constructBindingsFor(wrapper.constructor);
93
+ const source = { gtype, bindings, wrapper };
94
+ for (const name of Object.keys(props)) {
95
+ const property = constructPropertyForEntry(source, name, Reflect.get(props, name));
96
+ if (property !== undefined) {
97
+ names.push(property.name);
98
+ values.push(property.value);
34
99
  }
35
- names.push(name);
36
- values.push(toValue(descriptor, value));
37
100
  }
38
- return gObjectNewWithProperties(gtype, names.length, names, values);
101
+ newObject(gtype, names, values, wrapper, registerWrapper);
102
+ return getHandle(wrapper);
39
103
  }
40
104
  /**
41
105
  * Reads a GObject property and converts it to its JavaScript value using the
@@ -62,5 +126,5 @@ function getObjectProperty(obj, propertyName, descriptor) {
62
126
  function setObjectProperty(obj, propertyName, descriptor, jsValue) {
63
127
  gObjectSetProperty(getHandle(obj), propertyName, toValue(descriptor, jsValue));
64
128
  }
65
- export { newObjectWithProperties, getObjectProperty, setObjectProperty };
129
+ export { newObjectWithProperties, getObjectProperty, registerConstructProperties, setObjectProperty, };
66
130
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,wBAAwB,GAAG,IAAI,CACjC,GAAG,EACH,8BAA8B,EAC9B;IACI,UAAU;IACV,OAAO;IACP,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC;IAC/C,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC;CAClD,EACD,OAAO,CAAC,MAAM,CAAC,CAClB,CAAC;AAEF,MAAM,kBAAkB,GAAG,IAAI,CAC3B,GAAG,EACH,uBAAuB,EACvB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EACnD,KAAK,CACR,CAAC;AAEF,MAAM,kBAAkB,GAAG,IAAI,CAC3B,GAAG,EACH,uBAAuB,EACvB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EACnD,KAAK,CACR,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAS,uBAAuB,CAAC,KAAa,EAAE,KAA8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/native\";\nimport { bind } from \"./bind.js\";\nimport { biguint64T, objectT, sizedArrayT, stringT, uint32T, voidT } from \"./descriptors.js\";\nimport { LIB, VALUE_SIZE, VALUE_T } from \"./library.js\";\nimport { getHandle } from \"./registry.js\";\nimport { fromValue, newValueForDescriptor, toValue } from \"./value.js\";\n\nconst gObjectNewWithProperties = bind(\n LIB,\n \"g_object_new_with_properties\",\n [\n biguint64T,\n uint32T,\n sizedArrayT(stringT(\"borrowed\"), 1, \"borrowed\"),\n sizedArrayT(VALUE_T, 1, \"borrowed\", VALUE_SIZE),\n ],\n objectT(\"full\"),\n);\n\nconst gObjectGetProperty = bind(\n LIB,\n \"g_object_get_property\",\n [objectT(\"borrowed\"), stringT(\"borrowed\"), VALUE_T],\n voidT,\n);\n\nconst gObjectSetProperty = bind(\n LIB,\n \"g_object_set_property\",\n [objectT(\"borrowed\"), stringT(\"borrowed\"), VALUE_T],\n voidT,\n);\n\n/**\n * Constructs a new GObject of the given type, setting the supplied construct\n * properties. Entries whose value is `undefined` or not a `[descriptor, value]`\n * pair are skipped.\n *\n * @param gtype The GType of the object to construct.\n * @param props Property names mapped to `[descriptor, value]` pairs.\n * @returns The handle of the newly created object.\n */\nfunction newObjectWithProperties(gtype: bigint, props: Record<string, unknown>): ExternalObject<Handle> {\n const names: string[] = [];\n const values: ExternalObject<Handle>[] = [];\n\n for (const name in props) {\n const entry: unknown = props[name];\n\n if (!Array.isArray(entry)) {\n continue;\n }\n\n const [descriptor, value] = entry as [Descriptor, unknown];\n\n if (value === undefined) {\n continue;\n }\n\n names.push(name);\n values.push(toValue(descriptor, value));\n }\n\n return gObjectNewWithProperties(gtype, names.length, names, values) as ExternalObject<Handle>;\n}\n\n/**\n * Reads a GObject property and converts it to its JavaScript value using the\n * descriptor.\n *\n * @param obj The object to read from.\n * @param propertyName The property name.\n * @param descriptor Describes the property's type.\n */\nfunction getObjectProperty(obj: object, propertyName: string, descriptor: Descriptor): unknown {\n const value = newValueForDescriptor(descriptor);\n gObjectGetProperty(getHandle(obj), propertyName, value);\n\n return fromValue(value);\n}\n\n/**\n * Writes a JavaScript value to a GObject property, converting it to native form\n * using the descriptor.\n *\n * @param obj The object to write to.\n * @param propertyName The property name.\n * @param descriptor Describes the property's type.\n * @param jsValue The value to set.\n */\nfunction setObjectProperty(obj: object, propertyName: string, descriptor: Descriptor, jsValue: unknown): void {\n gObjectSetProperty(getHandle(obj), propertyName, toValue(descriptor, jsValue));\n}\n\nexport { newObjectWithProperties, getObjectProperty, setObjectProperty };\n"]}
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAA0B,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAWvE,MAAM,gBAAgB,GAAyC,IAAI,OAAO,EAAE,CAAC;AAC7E,MAAM,gBAAgB,GAAwC,IAAI,OAAO,EAAE,CAAC;AAC5E,MAAM,YAAY,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AACvC,MAAM,WAAW,GAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAsB,CAAC;AAEhF,MAAM,kBAAkB,GAAG,IAAI,CAC3B,GAAG,EACH,uBAAuB,EACvB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE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yClass, getParentClass } from \"@gtkx/utils\";\nimport { bind } from \"./bind.js\";\nimport { objectT, stringT, voidT } from \"./descriptors.js\";\nimport { LIB, VALUE_T } from \"./library.js\";\nimport { type ConstructProperty, constructPropertyFor } from \"./properties.js\";\nimport { getHandle, registerWrapper } from \"./registry.js\";\nimport { fromValue, newValueForDescriptor, toValue } from \"./value.js\";\n\n/**\n * One construct property a wrapper class accepts: the canonical `GObject` name it is set under,\n * and the descriptor its value is marshalled through.\n */\ntype ConstructBinding = [name: string, descriptor: Descriptor];\n/** The construct properties a wrapper class accepts, keyed by the camelCased name callers give them. */\ntype ConstructBindings = Record<string, ConstructBinding>;\ntype ResolvedBindings = { generation: number; bindings: ConstructBindings };\n\nconst declaredBindings: WeakMap<AnyClass, ConstructBindings> = new WeakMap();\nconst resolvedBindings: WeakMap<AnyClass, ResolvedBindings> = new WeakMap();\nconst declarations = { generation: 0 };\nconst NO_BINDINGS: ConstructBindings = Object.create(null) as ConstructBindings;\n\nconst gObjectGetProperty = bind(\n LIB,\n \"g_object_get_property\",\n [objectT(\"borrowed\"), stringT(\"borrowed\"), VALUE_T],\n voidT,\n);\n\nconst gObjectSetProperty = bind(\n LIB,\n \"g_object_set_property\",\n [objectT(\"borrowed\"), stringT(\"borrowed\"), VALUE_T],\n voidT,\n);\n\nfunction collectDeclaredBindings(cls: AnyClass): ConstructBindings[] {\n const declared: ConstructBindings[] = [];\n let current: AnyClass | null = cls;\n\n while (current !== null) {\n const own = declaredBindings.get(current);\n\n if (own !== undefined) {\n declared.push(own);\n }\n\n current = getParentClass(current);\n }\n\n return declared;\n}\n\nfunction mergeDeclaredBindings(cls: AnyClass): ConstructBindings {\n const declared = collectDeclaredBindings(cls);\n const merged: ConstructBindings = Object.create(null) as ConstructBindings;\n\n for (let index = declared.length - 1; index >= 0; index--) {\n Object.assign(merged, declared[index]);\n }\n\n return merged;\n}\n\nfunction constructBindingsFor(cls: AnyClass | undefined): ConstructBindings {\n if (cls === undefined) {\n return NO_BINDINGS;\n }\n\n const cached = resolvedBindings.get(cls);\n\n if (cached?.generation === declarations.generation) {\n return cached.bindings;\n }\n\n const bindings = mergeDeclaredBindings(cls);\n resolvedBindings.set(cls, { generation: declarations.generation, bindings });\n\n return bindings;\n}\n\n/**\n * Declares the construct properties a wrapper class accepts, so `newObjectWithProperties`\n * marshals each one through its descriptor rather than resolving it from the\n * `GObject.ParamSpec` the type installs. A class inherits the declarations of its ancestors.\n * Registering takes effect immediately, including for classes already constructed from and for\n * subclasses that already inherited an earlier declaration.\n *\n * @param cls The wrapper class the properties are declared on.\n * @param bindings CamelCased property names mapped to their canonical name and descriptor.\n */\nfunction registerConstructProperties(cls: AnyClass, bindings: ConstructBindings): void {\n declaredBindings.set(cls, bindings);\n declarations.generation += 1;\n}\n\nfunction constructPropertyForEntry(\n source: { gtype: bigint; bindings: ConstructBindings; wrapper: object },\n name: string,\n value: unknown,\n): ConstructProperty | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n const binding = source.bindings[name];\n\n if (binding === undefined) {\n return constructPropertyFor(source.gtype, name, value, source.wrapper);\n }\n\n return { name: binding[0], value: toValue(binding[1], value) };\n}\n\n/**\n * Constructs a new GObject of the given type, setting the supplied construct\n * properties, and binds `wrapper` to it. A property the wrapper's class declares\n * through `registerConstructProperties` is marshalled through its descriptor; any\n * other one is marshalled through the `GObject.ParamSpec` the type installs under\n * that name, dashed or camelCased, and is skipped when the type installs none.\n * A value that ParamSpec would refuse throws before GObject sees it: a `TypeError`\n * for a read-only property and for a value of a type the property cannot hold, and\n * a `RangeError` for a value the ParamSpec rejects.\n * Properties whose value is `undefined` are skipped. A type registered with\n * `registerClass` binds the wrapper before its `constructed` slot runs, so an\n * override of that slot already sees a usable instance.\n *\n * @param gtype The GType of the object to construct.\n * @param props Property names mapped to the values to set them to.\n * @param wrapper The wrapper instance to bind to the new object.\n * @returns The handle of the newly created object.\n */\nfunction newObjectWithProperties(gtype: bigint, props: object, wrapper: object): ExternalObject<Handle> {\n const names: string[] = [];\n const values: ExternalObject<Handle>[] = [];\n const bindings = constructBindingsFor(wrapper.constructor as AnyClass | undefined);\n const source = { gtype, bindings, wrapper };\n\n for (const name of Object.keys(props)) {\n const property = constructPropertyForEntry(source, name, Reflect.get(props, name));\n\n if (property !== undefined) {\n names.push(property.name);\n values.push(property.value);\n }\n }\n\n newObject(gtype, names, values, wrapper, registerWrapper);\n\n return getHandle(wrapper);\n}\n\n/**\n * Reads a GObject property and converts it to its JavaScript value using the\n * descriptor.\n *\n * @param obj The object to read from.\n * @param propertyName The property name.\n * @param descriptor Describes the property's type.\n */\nfunction getObjectProperty(obj: object, propertyName: string, descriptor: Descriptor): unknown {\n const value = newValueForDescriptor(descriptor);\n gObjectGetProperty(getHandle(obj), propertyName, value);\n\n return fromValue(value);\n}\n\n/**\n * Writes a JavaScript value to a GObject property, converting it to native form\n * using the descriptor.\n *\n * @param obj The object to write to.\n * @param propertyName The property name.\n * @param descriptor Describes the property's type.\n * @param jsValue The value to set.\n */\nfunction setObjectProperty(obj: object, propertyName: string, descriptor: Descriptor, jsValue: unknown): void {\n gObjectSetProperty(getHandle(obj), propertyName, toValue(descriptor, jsValue));\n}\n\nexport {\n newObjectWithProperties,\n getObjectProperty,\n registerConstructProperties,\n setObjectProperty,\n type ConstructBinding,\n type ConstructBindings,\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import { type ExternalObject, type Handle } from "@gtkx/native";
2
+ type ValueGuard = (value: unknown) => boolean;
3
+ declare const getParamFlags: (pspec: ExternalObject<Handle>) => number;
4
+ declare const getParamValueType: (pspec: ExternalObject<Handle>) => bigint;
5
+ declare const isParamWritable: (flags: number) => boolean;
6
+ declare const isParamConstructOnly: (flags: number) => boolean;
7
+ declare const isParamLaxlyValidated: (flags: number) => boolean;
8
+ declare const wasParamValueModified: (pspec: ExternalObject<Handle>, value: ExternalObject<Handle>) => boolean;
9
+ declare function valueGuardFor(valueType: bigint): ValueGuard;
10
+ export { getParamFlags, getParamValueType, isParamConstructOnly, isParamLaxlyValidated, isParamWritable, type ValueGuard, valueGuardFor, wasParamValueModified, };
11
+ //# sourceMappingURL=param-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"param-spec.d.ts","sourceRoot":"","sources":["../src/param-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAQ,MAAM,cAAc,CAAC;AAiCtE,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AA4D9C,QAAA,MAAM,aAAa,GAAI,OAAO,cAAc,CAAC,MAAM,CAAC,KAAG,MAA2D,CAAC;AAEnH,QAAA,MAAM,iBAAiB,GAAI,OAAO,cAAc,CAAC,MAAM,CAAC,KAAG,MACE,CAAC;AAE9D,QAAA,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,OAAyC,CAAC;AACnF,QAAA,MAAM,oBAAoB,GAAI,OAAO,MAAM,KAAG,OAA+C,CAAC;AAC9F,QAAA,MAAM,qBAAqB,GAAI,OAAO,MAAM,KAAG,OAA+C,CAAC;AAE/F,QAAA,MAAM,qBAAqB,GAAI,OAAO,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC,KAAG,OAC/C,CAAC;AAwEhD,iBAAS,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAcpD;AAoCD,OAAO,EACH,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,KAAK,UAAU,EACf,aAAa,EACb,qBAAqB,GACxB,CAAC"}
@@ -0,0 +1,149 @@
1
+ import { read } from "@gtkx/native";
2
+ import { bind } from "./bind.js";
3
+ import { biguint64T, booleanT, stringT, uint32T, voidT } from "./descriptors.js";
4
+ import { LIB, PARAM_T, VALUE_T } from "./library.js";
5
+ import { getInstanceType } from "./registry.js";
6
+ import { getStrvType, isTypedClass, TYPE_BOOLEAN, TYPE_BOXED, TYPE_CHAR, TYPE_DOUBLE, TYPE_ENUM, TYPE_FLAGS, TYPE_FLOAT, TYPE_INT, TYPE_INT64, TYPE_INTERFACE, TYPE_INVALID, TYPE_LONG, TYPE_OBJECT, TYPE_PARAM, TYPE_POINTER, TYPE_STRING, TYPE_UCHAR, TYPE_UINT, TYPE_UINT64, TYPE_ULONG, TYPE_VARIANT, typeFundamental, typeIsA, } from "./type.js";
7
+ const PARAM_READABLE = 1;
8
+ const PARAM_WRITABLE = 2;
9
+ const PARAM_CONSTRUCT_ONLY = 8;
10
+ const PARAM_LAX_VALIDATION = 16;
11
+ const READ_FLAGS = PARAM_READABLE | PARAM_WRITABLE | PARAM_CONSTRUCT_ONLY | PARAM_LAX_VALIDATION;
12
+ const FLAGS_BYTE_OFFSET = 16;
13
+ const VALUE_TYPE_BYTE_OFFSET = 24;
14
+ const LAYOUT_PROBE_NAME = "gtkx-param-layout";
15
+ const INT8_MINIMUM = -128;
16
+ const INT8_MAXIMUM = 127;
17
+ const UINT8_MAXIMUM = 255;
18
+ const INT32_MINIMUM = -2_147_483_648;
19
+ const INT32_MAXIMUM = 2_147_483_647;
20
+ const UINT32_MAXIMUM = 4_294_967_295;
21
+ const INT64_MINIMUM = -(2n ** 63n);
22
+ const INT64_MAXIMUM = 2n ** 63n - 1n;
23
+ const UINT64_MAXIMUM = 2n ** 64n - 1n;
24
+ const FLOAT_MAXIMUM = 3.4028234663852886e38;
25
+ const WRAPPED_FUNDAMENTALS = new Set([
26
+ TYPE_BOXED,
27
+ TYPE_INTERFACE,
28
+ TYPE_OBJECT,
29
+ TYPE_PARAM,
30
+ TYPE_VARIANT,
31
+ ]);
32
+ const SCALAR_GUARDS = new Map([
33
+ [TYPE_BOOLEAN, isBooleanValue],
34
+ [TYPE_STRING, isStringValue],
35
+ [TYPE_CHAR, integerGuardFor(INT8_MINIMUM, INT8_MAXIMUM)],
36
+ [TYPE_UCHAR, integerGuardFor(0, UINT8_MAXIMUM)],
37
+ [TYPE_INT, integerGuardFor(INT32_MINIMUM, INT32_MAXIMUM)],
38
+ [TYPE_UINT, integerGuardFor(0, UINT32_MAXIMUM)],
39
+ [TYPE_ENUM, integerGuardFor(INT32_MINIMUM, INT32_MAXIMUM)],
40
+ [TYPE_FLAGS, integerGuardFor(0, UINT32_MAXIMUM)],
41
+ [TYPE_LONG, wideIntegerGuardFor(INT64_MINIMUM, INT64_MAXIMUM)],
42
+ [TYPE_ULONG, wideIntegerGuardFor(0n, UINT64_MAXIMUM)],
43
+ [TYPE_INT64, wideIntegerGuardFor(INT64_MINIMUM, INT64_MAXIMUM)],
44
+ [TYPE_UINT64, wideIntegerGuardFor(0n, UINT64_MAXIMUM)],
45
+ [TYPE_FLOAT, isFloatValue],
46
+ [TYPE_DOUBLE, isDoubleValue],
47
+ [TYPE_POINTER, isNullValue],
48
+ ]);
49
+ const layout = { wasChecked: false };
50
+ const paramValueValidate = bind(LIB, "g_param_value_validate", [PARAM_T, VALUE_T], booleanT);
51
+ const paramSpecUnref = bind(LIB, "g_param_spec_unref", [PARAM_T], voidT);
52
+ const paramSpecRefSink = bind(LIB, "g_param_spec_ref_sink", [PARAM_T], PARAM_T);
53
+ const newParamSpecBoolean = bind(LIB, "g_param_spec_boolean", [stringT("borrowed"), stringT("borrowed"), stringT("borrowed"), booleanT, uint32T], PARAM_T);
54
+ const getParamFlags = (pspec) => read(pspec, uint32T, FLAGS_BYTE_OFFSET);
55
+ const getParamValueType = (pspec) => read(pspec, biguint64T, VALUE_TYPE_BYTE_OFFSET);
56
+ const isParamWritable = (flags) => (flags & PARAM_WRITABLE) !== 0;
57
+ const isParamConstructOnly = (flags) => (flags & PARAM_CONSTRUCT_ONLY) !== 0;
58
+ const isParamLaxlyValidated = (flags) => (flags & PARAM_LAX_VALIDATION) !== 0;
59
+ const wasParamValueModified = (pspec, value) => paramValueValidate(pspec, value);
60
+ function isBooleanValue(value) {
61
+ return typeof value === "boolean";
62
+ }
63
+ function isStringValue(value) {
64
+ return value == null || typeof value === "string";
65
+ }
66
+ function isStrvValue(value) {
67
+ return value == null || (Array.isArray(value) && value.every((item) => typeof item === "string"));
68
+ }
69
+ function isDoubleValue(value) {
70
+ return value == null || (typeof value === "number" && Number.isFinite(value));
71
+ }
72
+ function isFloatValue(value) {
73
+ return isDoubleValue(value) && (value == null || Math.abs(value) <= FLOAT_MAXIMUM);
74
+ }
75
+ function isAnyValue() {
76
+ return true;
77
+ }
78
+ function isNullValue(value) {
79
+ return value == null;
80
+ }
81
+ function isIntegerWithin(value, minimum, maximum) {
82
+ return Number.isSafeInteger(value) && value >= minimum && value <= maximum;
83
+ }
84
+ function integerGuardFor(minimum, maximum) {
85
+ return (value) => value == null || isIntegerWithin(value, minimum, maximum);
86
+ }
87
+ function toWideInteger(value) {
88
+ if (typeof value === "bigint") {
89
+ return value;
90
+ }
91
+ return Number.isSafeInteger(value) ? BigInt(value) : undefined;
92
+ }
93
+ function wideIntegerGuardFor(minimum, maximum) {
94
+ return (value) => {
95
+ if (value == null) {
96
+ return true;
97
+ }
98
+ const wide = toWideInteger(value);
99
+ return wide !== undefined && wide >= minimum && wide <= maximum;
100
+ };
101
+ }
102
+ function resolveGtype(value) {
103
+ const instanceType = getInstanceType(value);
104
+ if (instanceType !== TYPE_INVALID) {
105
+ return instanceType;
106
+ }
107
+ return isTypedClass(value) ? value.__type__ : TYPE_INVALID;
108
+ }
109
+ function wrappedGuardFor(valueType) {
110
+ return (value) => value == null || typeIsA(resolveGtype(value), valueType);
111
+ }
112
+ function valueGuardFor(valueType) {
113
+ assertParamLayout();
114
+ if (valueType === getStrvType()) {
115
+ return isStrvValue;
116
+ }
117
+ const fundamental = typeFundamental(valueType);
118
+ if (WRAPPED_FUNDAMENTALS.has(fundamental)) {
119
+ return wrappedGuardFor(valueType);
120
+ }
121
+ return SCALAR_GUARDS.get(fundamental) ?? isAnyValue;
122
+ }
123
+ function readProbeLayout(flags) {
124
+ const probe = newParamSpecBoolean(LAYOUT_PROBE_NAME, null, null, false, flags);
125
+ paramSpecRefSink(probe);
126
+ try {
127
+ return { flags: getParamFlags(probe), valueType: getParamValueType(probe) };
128
+ }
129
+ finally {
130
+ paramSpecUnref(probe);
131
+ }
132
+ }
133
+ function isLayoutIntact(flags) {
134
+ const layout = readProbeLayout(flags);
135
+ return (layout.flags & READ_FLAGS) === flags && layout.valueType === TYPE_BOOLEAN;
136
+ }
137
+ function assertParamLayout() {
138
+ if (layout.wasChecked) {
139
+ return;
140
+ }
141
+ layout.wasChecked = true;
142
+ const readWrite = PARAM_READABLE | PARAM_WRITABLE;
143
+ if (isLayoutIntact(readWrite) && isLayoutIntact(readWrite | PARAM_CONSTRUCT_ONLY | PARAM_LAX_VALIDATION)) {
144
+ return;
145
+ }
146
+ throw new Error("GParamSpec does not match the memory layout this build reads a property's flags and value type at");
147
+ }
148
+ export { getParamFlags, getParamValueType, isParamConstructOnly, isParamLaxlyValidated, isParamWritable, valueGuardFor, wasParamValueModified, };
149
+ //# sourceMappingURL=param-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"param-spec.js","sourceRoot":"","sources":["../src/param-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACH,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,E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ACP,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACjC,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,SAAS,KAAK,YAAY,CAAC;AACtF,CAAC;AAED,SAAS,iBAAiB;IACtB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACpB,OAAO;IACX,CAAC;IAED,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,MAAM,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC;IAElD,IAAI,cAAc,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,SAAS,GAAG,oBAAoB,GAAG,oBAAoB,CAAC,EAAE,CAAC;QACvG,OAAO;IACX,CAAC;IAED,MAAM,IAAI,KAAK,CACX,mGAAmG,CACtG,CAAC;AACN,CAAC;AAED,OAAO,EACH,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EAEf,aAAa,EACb,qBAAqB,GACxB,CAAC","sourcesContent":["import { type ExternalObject, type Handle, read } from \"@gtkx/native\";\nimport { bind } from \"./bind.js\";\nimport { biguint64T, booleanT, stringT, uint32T, voidT } from \"./descriptors.js\";\nimport { LIB, PARAM_T, VALUE_T } from \"./library.js\";\nimport { getInstanceType } from \"./registry.js\";\nimport {\n getStrvType,\n isTypedClass,\n TYPE_BOOLEAN,\n TYPE_BOXED,\n TYPE_CHAR,\n TYPE_DOUBLE,\n TYPE_ENUM,\n TYPE_FLAGS,\n TYPE_FLOAT,\n TYPE_INT,\n TYPE_INT64,\n TYPE_INTERFACE,\n TYPE_INVALID,\n TYPE_LONG,\n TYPE_OBJECT,\n TYPE_PARAM,\n TYPE_POINTER,\n TYPE_STRING,\n TYPE_UCHAR,\n TYPE_UINT,\n TYPE_UINT64,\n TYPE_ULONG,\n TYPE_VARIANT,\n typeFundamental,\n typeIsA,\n} from \"./type.js\";\n\ntype ValueGuard = (value: unknown) => boolean;\ntype ParamLayout = { flags: number; valueType: bigint };\n\nconst PARAM_READABLE = 1;\nconst PARAM_WRITABLE = 2;\nconst PARAM_CONSTRUCT_ONLY = 8;\nconst PARAM_LAX_VALIDATION = 16;\nconst READ_FLAGS = PARAM_READABLE | PARAM_WRITABLE | PARAM_CONSTRUCT_ONLY | PARAM_LAX_VALIDATION;\nconst FLAGS_BYTE_OFFSET = 16;\nconst VALUE_TYPE_BYTE_OFFSET = 24;\nconst LAYOUT_PROBE_NAME = \"gtkx-param-layout\";\nconst INT8_MINIMUM = -128;\nconst INT8_MAXIMUM = 127;\nconst UINT8_MAXIMUM = 255;\nconst INT32_MINIMUM = -2_147_483_648;\nconst INT32_MAXIMUM = 2_147_483_647;\nconst UINT32_MAXIMUM = 4_294_967_295;\nconst INT64_MINIMUM = -(2n ** 63n);\nconst INT64_MAXIMUM = 2n ** 63n - 1n;\nconst UINT64_MAXIMUM = 2n ** 64n - 1n;\nconst FLOAT_MAXIMUM = 3.4028234663852886e38;\n\nconst WRAPPED_FUNDAMENTALS: Set<bigint> = new Set([\n TYPE_BOXED,\n TYPE_INTERFACE,\n TYPE_OBJECT,\n TYPE_PARAM,\n TYPE_VARIANT,\n]);\n\nconst SCALAR_GUARDS: Map<bigint, ValueGuard> = new Map([\n [TYPE_BOOLEAN, isBooleanValue],\n [TYPE_STRING, isStringValue],\n [TYPE_CHAR, integerGuardFor(INT8_MINIMUM, INT8_MAXIMUM)],\n [TYPE_UCHAR, integerGuardFor(0, UINT8_MAXIMUM)],\n [TYPE_INT, integerGuardFor(INT32_MINIMUM, INT32_MAXIMUM)],\n [TYPE_UINT, integerGuardFor(0, UINT32_MAXIMUM)],\n [TYPE_ENUM, integerGuardFor(INT32_MINIMUM, INT32_MAXIMUM)],\n [TYPE_FLAGS, integerGuardFor(0, UINT32_MAXIMUM)],\n [TYPE_LONG, wideIntegerGuardFor(INT64_MINIMUM, INT64_MAXIMUM)],\n [TYPE_ULONG, wideIntegerGuardFor(0n, UINT64_MAXIMUM)],\n [TYPE_INT64, wideIntegerGuardFor(INT64_MINIMUM, INT64_MAXIMUM)],\n [TYPE_UINT64, wideIntegerGuardFor(0n, UINT64_MAXIMUM)],\n [TYPE_FLOAT, isFloatValue],\n [TYPE_DOUBLE, isDoubleValue],\n [TYPE_POINTER, isNullValue],\n]);\n\nconst layout = { wasChecked: false };\nconst paramValueValidate = bind(LIB, \"g_param_value_validate\", [PARAM_T, VALUE_T], booleanT);\nconst paramSpecUnref = bind(LIB, \"g_param_spec_unref\", [PARAM_T], voidT);\nconst paramSpecRefSink = bind(LIB, \"g_param_spec_ref_sink\", [PARAM_T], PARAM_T);\n\nconst newParamSpecBoolean = bind(\n LIB,\n \"g_param_spec_boolean\",\n [stringT(\"borrowed\"), stringT(\"borrowed\"), stringT(\"borrowed\"), booleanT, uint32T],\n PARAM_T,\n);\n\nconst getParamFlags = (pspec: ExternalObject<Handle>): number => read(pspec, uint32T, FLAGS_BYTE_OFFSET) as number;\n\nconst getParamValueType = (pspec: ExternalObject<Handle>): bigint =>\n read(pspec, biguint64T, VALUE_TYPE_BYTE_OFFSET) as bigint;\n\nconst isParamWritable = (flags: number): boolean => (flags & PARAM_WRITABLE) !== 0;\nconst isParamConstructOnly = (flags: number): boolean => (flags & PARAM_CONSTRUCT_ONLY) !== 0;\nconst isParamLaxlyValidated = (flags: number): boolean => (flags & PARAM_LAX_VALIDATION) !== 0;\n\nconst wasParamValueModified = (pspec: ExternalObject<Handle>, value: ExternalObject<Handle>): boolean =>\n paramValueValidate(pspec, value) as boolean;\n\nfunction isBooleanValue(value: unknown): boolean {\n return typeof value === \"boolean\";\n}\n\nfunction isStringValue(value: unknown): boolean {\n return value == null || typeof value === \"string\";\n}\n\nfunction isStrvValue(value: unknown): boolean {\n return value == null || (Array.isArray(value) && value.every((item) => typeof item === \"string\"));\n}\n\nfunction isDoubleValue(value: unknown): boolean {\n return value == null || (typeof value === \"number\" && Number.isFinite(value));\n}\n\nfunction isFloatValue(value: unknown): boolean {\n return isDoubleValue(value) && (value == null || Math.abs(value as number) <= FLOAT_MAXIMUM);\n}\n\nfunction isAnyValue(): boolean {\n return true;\n}\n\nfunction isNullValue(value: unknown): boolean {\n return value == null;\n}\n\nfunction isIntegerWithin(value: unknown, minimum: number, maximum: number): boolean {\n return Number.isSafeInteger(value) && (value as number) >= minimum && (value as number) <= maximum;\n}\n\nfunction integerGuardFor(minimum: number, maximum: number): ValueGuard {\n return (value) => value == null || isIntegerWithin(value, minimum, maximum);\n}\n\nfunction toWideInteger(value: unknown): bigint | undefined {\n if (typeof value === \"bigint\") {\n return value;\n }\n\n return Number.isSafeInteger(value) ? BigInt(value as number) : undefined;\n}\n\nfunction wideIntegerGuardFor(minimum: bigint, maximum: bigint): ValueGuard {\n return (value) => {\n if (value == null) {\n return true;\n }\n\n const wide = toWideInteger(value);\n\n return wide !== undefined && wide >= minimum && wide <= maximum;\n };\n}\n\nfunction resolveGtype(value: unknown): bigint {\n const instanceType = getInstanceType(value as object);\n\n if (instanceType !== TYPE_INVALID) {\n return instanceType;\n }\n\n return isTypedClass(value) ? value.__type__ : TYPE_INVALID;\n}\n\nfunction wrappedGuardFor(valueType: bigint): ValueGuard {\n return (value) => value == null || typeIsA(resolveGtype(value), valueType);\n}\n\nfunction valueGuardFor(valueType: bigint): ValueGuard {\n assertParamLayout();\n\n if (valueType === getStrvType()) {\n return isStrvValue;\n }\n\n const fundamental = typeFundamental(valueType);\n\n if (WRAPPED_FUNDAMENTALS.has(fundamental)) {\n return wrappedGuardFor(valueType);\n }\n\n return SCALAR_GUARDS.get(fundamental) ?? isAnyValue;\n}\n\nfunction readProbeLayout(flags: number): ParamLayout {\n const probe = newParamSpecBoolean(LAYOUT_PROBE_NAME, null, null, false, flags) as ExternalObject<Handle>;\n paramSpecRefSink(probe);\n\n try {\n return { flags: getParamFlags(probe), valueType: getParamValueType(probe) };\n } finally {\n paramSpecUnref(probe);\n }\n}\n\nfunction isLayoutIntact(flags: number): boolean {\n const layout = readProbeLayout(flags);\n\n return (layout.flags & READ_FLAGS) === flags && layout.valueType === TYPE_BOOLEAN;\n}\n\nfunction assertParamLayout(): void {\n if (layout.wasChecked) {\n return;\n }\n\n layout.wasChecked = true;\n const readWrite = PARAM_READABLE | PARAM_WRITABLE;\n\n if (isLayoutIntact(readWrite) && isLayoutIntact(readWrite | PARAM_CONSTRUCT_ONLY | PARAM_LAX_VALIDATION)) {\n return;\n }\n\n throw new Error(\n \"GParamSpec does not match the memory layout this build reads a property's flags and value type at\",\n );\n}\n\nexport {\n getParamFlags,\n getParamValueType,\n isParamConstructOnly,\n isParamLaxlyValidated,\n isParamWritable,\n type ValueGuard,\n valueGuardFor,\n wasParamValueModified,\n};\n"]}
@@ -1,8 +1,6 @@
1
1
  /**
2
- * Extracts the finished value from the async result a GIO-style operation completes with.
3
- *
4
- * @template R - The async result type passed to the completion callback.
5
- * @template T - The finished value type.
2
+ * Extracts the value of a completed asynchronous operation from its `GAsyncResult`, throwing when
3
+ * the operation failed.
6
4
  */
7
5
  type FinishResult<R extends object, T> = (result: R) => T;
8
6
  /**
@@ -17,5 +15,5 @@ type FinishResult<R extends object, T> = (result: R) => T;
17
15
  * @returns A promise resolving to the finished result, or rejecting if `finish` throws.
18
16
  */
19
17
  declare const promisify: <R extends object, T>(asyncFn: (...args: unknown[]) => void, finish: FinishResult<R, T>, cancellable: object | null | undefined, ...leading: unknown[]) => Promise<T>;
20
- export { promisify, type FinishResult };
18
+ export { promisify };
21
19
  //# sourceMappingURL=promisify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/promisify.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AAgC1D;;;;;;;;;;GAUG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,EAClC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EACrC,QAAQ,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,aAAa,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,GAAG,SAAS,OAAO,EAAE,KACtB,OAAO,CAAC,CAAC,CAQN,CAAC;AAEP,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/promisify.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AAgC1D;;;;;;;;;;GAUG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,EAClC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EACrC,QAAQ,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,aAAa,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,GAAG,SAAS,OAAO,EAAE,KACtB,OAAO,CAAC,CAAC,CAUN,CAAC;AAEP,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/dist/promisify.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tryGetHandle } from "./registry.js";
1
+ import { getHandle } from "./registry.js";
2
2
  const attachCreationStack = (error, creationStack) => {
3
3
  if (creationStack === undefined || !(error instanceof Error)) {
4
4
  return;
@@ -30,8 +30,9 @@ const settle = (settlement, asyncResult) => {
30
30
  * @returns A promise resolving to the finished result, or rejecting if `finish` throws.
31
31
  */
32
32
  const promisify = (asyncFn, finish, cancellable, ...leading) => new Promise((resolve, reject) => {
33
- const creationStack = process.env.NODE_ENV === "production" ? undefined : new Error("gtkx async operation started here");
34
- asyncFn(...leading, tryGetHandle(cancellable), (_source, asyncResult) => {
33
+ const creationStack = process.env.NODE_ENV === "production" ? undefined : new Error("GTKX async operation started here");
34
+ const cancellableHandle = cancellable == null ? null : getHandle(cancellable);
35
+ asyncFn(...leading, cancellableHandle, (_source, asyncResult) => {
35
36
  settle({ finish, creationStack, resolve, reject }, asyncResult);
36
37
  });
37
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"promisify.js","sourceRoot":"","sources":["../src/promisify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB7C,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAE,aAAgC,EAAQ,EAAE;IACnF,IAAI,aAAa,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO;IACX,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO;IACX,CAAC;IAED,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAsB,UAA4B,EAAE,WAAmB,EAAQ,EAAE;IAC5F,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAE9D,IAAI,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,WAAgB,CAAC,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,SAAS,GAAG,CACd,OAAqC,EACrC,MAA0B,EAC1B,WAAsC,EACtC,GAAG,OAAkB,EACX,EAAE,CACZ,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/B,MAAM,aAAa,GACf,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAEvG,OAAO,CAAC,GAAG,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,OAAsB,EAAE,WAAmB,EAAE,EAAE;QAC3F,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEP,OAAO,EAAE,SAAS,EAAqB,CAAC","sourcesContent":["import { tryGetHandle } from \"./registry.js\";\n\n/**\n * Extracts the finished value from the async result a GIO-style operation completes with.\n *\n * @template R - The async result type passed to the completion callback.\n * @template T - The finished value type.\n */\ntype FinishResult<R extends object, T> = (result: R) => T;\n\ntype Settlement<R extends object, T> = {\n finish: FinishResult<R, T>;\n creationStack: Error | undefined;\n resolve: (value: T) => void;\n reject: (reason: Error) => void;\n};\n\nconst attachCreationStack = (error: unknown, creationStack: Error | undefined): void => {\n if (creationStack === undefined || !(error instanceof Error)) {\n return;\n }\n\n if (error.cause !== undefined || !Object.isExtensible(error)) {\n return;\n }\n\n error.cause = creationStack;\n};\n\nconst settle = <R extends object, T>(settlement: Settlement<R, T>, asyncResult: object): void => {\n const { finish, creationStack, resolve, reject } = settlement;\n\n try {\n resolve(finish(asyncResult as R));\n } catch (error) {\n attachCreationStack(error, creationStack);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n};\n\n/**\n * Wraps a GIO-style asynchronous function that takes a completion callback into a\n * promise, invoking the finish function to extract the result. Outside production,\n * the call site's stack is captured and attached as the rejection error's cause.\n *\n * @param asyncFn The async function, called with the leading arguments, the cancellable, and a completion callback.\n * @param finish Extracts the result from the async result passed to the completion callback.\n * @param cancellable A cancellable object, or null/undefined for none.\n * @param leading Arguments passed to `asyncFn` before the cancellable and callback.\n * @returns A promise resolving to the finished result, or rejecting if `finish` throws.\n */\nconst promisify = <R extends object, T>(\n asyncFn: (...args: unknown[]) => void,\n finish: FinishResult<R, T>,\n cancellable: object | null | undefined,\n ...leading: unknown[]\n): Promise<T> =>\n new Promise<T>((resolve, reject) => {\n const creationStack =\n process.env.NODE_ENV === \"production\" ? undefined : new Error(\"gtkx async operation started here\");\n\n asyncFn(...leading, tryGetHandle(cancellable), (_source: object | null, asyncResult: object) => {\n settle({ finish, creationStack, resolve, reject }, asyncResult);\n });\n });\n\nexport { promisify, type FinishResult };\n"]}
1
+ {"version":3,"file":"promisify.js","sourceRoot":"","sources":["../src/promisify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAe1C,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAE,aAAgC,EAAQ,EAAE;IACnF,IAAI,aAAa,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO;IACX,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO;IACX,CAAC;IAED,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAsB,UAA4B,EAAE,WAAmB,EAAQ,EAAE;IAC5F,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAE9D,IAAI,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,WAAgB,CAAC,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,SAAS,GAAG,CACd,OAAqC,EACrC,MAA0B,EAC1B,WAAsC,EACtC,GAAG,OAAkB,EACX,EAAE,CACZ,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/B,MAAM,aAAa,GACf,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAEvG,MAAM,iBAAiB,GAAG,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE9E,OAAO,CAAC,GAAG,OAAO,EAAE,iBAAiB,EAAE,CAAC,OAAsB,EAAE,WAAmB,EAAE,EAAE;QACnF,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEP,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { getHandle } from \"./registry.js\";\n\n/**\n * Extracts the value of a completed asynchronous operation from its `GAsyncResult`, throwing when\n * the operation failed.\n */\ntype FinishResult<R extends object, T> = (result: R) => T;\n\ntype Settlement<R extends object, T> = {\n finish: FinishResult<R, T>;\n creationStack: Error | undefined;\n resolve: (value: T) => void;\n reject: (reason: Error) => void;\n};\n\nconst attachCreationStack = (error: unknown, creationStack: Error | undefined): void => {\n if (creationStack === undefined || !(error instanceof Error)) {\n return;\n }\n\n if (error.cause !== undefined || !Object.isExtensible(error)) {\n return;\n }\n\n error.cause = creationStack;\n};\n\nconst settle = <R extends object, T>(settlement: Settlement<R, T>, asyncResult: object): void => {\n const { finish, creationStack, resolve, reject } = settlement;\n\n try {\n resolve(finish(asyncResult as R));\n } catch (error) {\n attachCreationStack(error, creationStack);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n};\n\n/**\n * Wraps a GIO-style asynchronous function that takes a completion callback into a\n * promise, invoking the finish function to extract the result. Outside production,\n * the call site's stack is captured and attached as the rejection error's cause.\n *\n * @param asyncFn The async function, called with the leading arguments, the cancellable, and a completion callback.\n * @param finish Extracts the result from the async result passed to the completion callback.\n * @param cancellable A cancellable object, or null/undefined for none.\n * @param leading Arguments passed to `asyncFn` before the cancellable and callback.\n * @returns A promise resolving to the finished result, or rejecting if `finish` throws.\n */\nconst promisify = <R extends object, T>(\n asyncFn: (...args: unknown[]) => void,\n finish: FinishResult<R, T>,\n cancellable: object | null | undefined,\n ...leading: unknown[]\n): Promise<T> =>\n new Promise<T>((resolve, reject) => {\n const creationStack =\n process.env.NODE_ENV === \"production\" ? undefined : new Error(\"GTKX async operation started here\");\n\n const cancellableHandle = cancellable == null ? null : getHandle(cancellable);\n\n asyncFn(...leading, cancellableHandle, (_source: object | null, asyncResult: object) => {\n settle({ finish, creationStack, resolve, reject }, asyncResult);\n });\n });\n\nexport { promisify };\n"]}
@@ -1,14 +1,46 @@
1
- import type { RegisterClassProperty } from "@gtkx/native";
1
+ import type { ExternalObject, Handle, RegisterClassProperty } from "@gtkx/native";
2
2
  import type { AnyClass } from "@gtkx/utils";
3
- type PropertyAccessor = {
3
+ import { type ValueGuard } from "./param-spec.js";
4
+ import { type InterfaceProperty } from "./registry.js";
5
+ import { type ValueWriter } from "./value.js";
6
+ type PropertyCheck = {
4
7
  name: string;
8
+ propertyName: string;
9
+ handle: ExternalObject<Handle>;
10
+ flags: number;
11
+ valueType: bigint;
12
+ canHoldValue: ValueGuard;
13
+ write?: ValueWriter;
14
+ scratch?: ExternalObject<Handle>;
15
+ };
16
+ type PropertyAccessor = PropertyCheck & {
17
+ memberName: string;
5
18
  storage: symbol;
6
- pspec: object;
19
+ hasGeneratedMember: boolean;
20
+ isInterfaceProperty?: boolean;
21
+ delegate?: InterfaceProperty;
7
22
  };
23
+ /** A `GObject.ParamSpec` wrapper describing one property's name, type, flags and default. */
8
24
  type PropertySpec = object;
9
- declare function makeGetProperty(accessors: PropertyAccessor[]): (this: object, propertyId: number, value: object) => void;
10
- declare function makeSetProperty(accessors: PropertyAccessor[]): (this: object, propertyId: number, value: object) => void;
11
- declare function buildAccessors(klass: AnyClass, properties: Record<string, PropertySpec>): PropertyAccessor[];
25
+ type PropertyDispatch = {
26
+ accessors: PropertyAccessor[];
27
+ delegates: Map<string, InterfaceProperty>;
28
+ };
29
+ type PropertyDispatchSource = {
30
+ klass: AnyClass;
31
+ properties: Record<string, PropertySpec>;
32
+ adoptedTypes: bigint[];
33
+ };
34
+ type ConstructProperty = {
35
+ name: string;
36
+ value: ExternalObject<Handle>;
37
+ };
38
+ declare const GET_PROPERTY_VFUNC = "vfuncGetProperty";
39
+ declare const SET_PROPERTY_VFUNC = "vfuncSetProperty";
40
+ declare function constructPropertyFor(gtype: bigint, name: string, value: unknown, wrapper: object): ConstructProperty | undefined;
41
+ declare function makeGetProperty(dispatch: PropertyDispatch): (this: object, propertyId: number, value: object, pspec: PropertySpec) => void;
42
+ declare function makeSetProperty(dispatch: PropertyDispatch): (this: object, propertyId: number, value: object, pspec: PropertySpec) => void;
43
+ declare function buildPropertyDispatch(source: PropertyDispatchSource): PropertyDispatch;
12
44
  declare function toNativeProperties(properties: Record<string, PropertySpec>): RegisterClassProperty[];
13
- export { buildAccessors, makeGetProperty, makeSetProperty, toNativeProperties, type PropertyAccessor, type PropertySpec, };
45
+ export { buildPropertyDispatch, constructPropertyFor, GET_PROPERTY_VFUNC, makeGetProperty, makeSetProperty, SET_PROPERTY_VFUNC, toNativeProperties, type ConstructProperty, type PropertyDispatch, type PropertySpec, };
14
46
  //# sourceMappingURL=properties.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAO5C,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC;AA0D3B,iBAAS,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,IACtB,MAAM,MAAM,EAAE,YAAY,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAKrF;AAED,iBAAS,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,IACtB,MAAM,MAAM,EAAE,YAAY,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAKrF;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,gBAAgB,EAAE,CAUrG;AAED,iBAAS,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,qBAAqB,EAAE,CAK7F;AAED,OAAO,EACH,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GACpB,CAAC"}
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK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