@gtkx/codegen 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.
- package/README.md +8 -9
- package/dist/analysis/descriptor-render.d.ts +9 -4
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +51 -61
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +7 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +7 -7
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +1 -2
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +25 -22
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
- package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
- package/dist/analysis/nul-terminated-bytes.js +18 -0
- package/dist/analysis/nul-terminated-bytes.js.map +1 -0
- package/dist/analysis/param-capability.d.ts +5 -0
- package/dist/analysis/param-capability.d.ts.map +1 -0
- package/dist/analysis/param-capability.js +130 -0
- package/dist/analysis/param-capability.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +13 -6
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +44 -20
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +3 -5
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-shape.d.ts +8 -0
- package/dist/analysis/type-shape.d.ts.map +1 -0
- package/dist/analysis/type-shape.js +12 -0
- package/dist/analysis/type-shape.js.map +1 -0
- package/dist/compile.d.ts +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -1
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +79 -3
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +68 -13
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +4 -4
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +32 -20
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/handwritten-props.d.ts +9 -0
- package/dist/docs/handwritten-props.d.ts.map +1 -0
- package/dist/docs/handwritten-props.js +149 -0
- package/dist/docs/handwritten-props.js.map +1 -0
- package/dist/docs/pipeline.d.ts +4 -4
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +6 -6
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +25 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +90 -28
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +22 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +129 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +3 -6
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +6 -8
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +3 -11
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +0 -7
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +2 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +11 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +22 -0
- package/dist/gir/annotations.d.ts.map +1 -0
- package/dist/gir/annotations.js +15 -0
- package/dist/gir/annotations.js.map +1 -0
- package/dist/gir/callback.d.ts +1 -0
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +1 -0
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +32 -1
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +8 -3
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +21 -1
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +9 -9
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +19 -4
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -11
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -0
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +7 -0
- package/dist/gir/gir-path.d.ts.map +1 -1
- package/dist/gir/gir-path.js +7 -0
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/libraries.d.ts +13 -2
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +11 -0
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +36 -0
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +34 -0
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +38 -0
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +4 -5
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +39 -0
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +7 -7
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +3 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +6 -3
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +1 -0
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -0
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +3 -3
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +22 -0
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +3 -2
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +5 -4
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +0 -3
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +36 -1
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +2 -3
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +2 -1
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +20 -0
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/index.d.ts +18 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -0
- package/dist/jsx.d.ts +7 -12
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +18 -19
- package/dist/jsx.js.map +1 -1
- package/dist/khronos/args.d.ts +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +29 -7
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/doc-context.d.ts +29 -0
- package/dist/khronos/doc-context.d.ts.map +1 -0
- package/dist/khronos/doc-context.js +29 -0
- package/dist/khronos/doc-context.js.map +1 -0
- package/dist/khronos/extensions.d.ts +13 -0
- package/dist/khronos/extensions.d.ts.map +1 -0
- package/dist/khronos/extensions.js +49 -0
- package/dist/khronos/extensions.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +17 -11
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +104 -46
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +42 -3
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +218 -63
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +9 -6
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +96 -26
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/notes.d.ts +19 -0
- package/dist/khronos/notes.d.ts.map +1 -0
- package/dist/khronos/notes.js +35 -0
- package/dist/khronos/notes.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +1 -1
- package/dist/khronos/param-pair.d.ts.map +1 -1
- package/dist/khronos/param-pair.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +3 -1
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +59 -28
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +5 -5
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +8 -8
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +8 -6
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +35 -26
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +21 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +47 -34
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +16 -10
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js +22 -15
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +33 -21
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +19 -20
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +2 -3
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +2 -2
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callable-doc.d.ts +11 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -0
- package/dist/store/gi/callable-doc.js +62 -0
- package/dist/store/gi/callable-doc.js.map +1 -0
- package/dist/store/gi/callables.d.ts +3 -1
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +16 -16
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +2 -2
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +5 -3
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/closure-invocation.d.ts +4 -0
- package/dist/store/gi/closure-invocation.d.ts.map +1 -0
- package/dist/store/gi/closure-invocation.js +22 -0
- package/dist/store/gi/closure-invocation.js.map +1 -0
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +3 -4
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +18 -20
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/doc-spec.d.ts +14 -0
- package/dist/store/gi/doc-spec.d.ts.map +1 -0
- package/dist/store/gi/doc-spec.js +23 -0
- package/dist/store/gi/doc-spec.js.map +1 -0
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +29 -16
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +28 -17
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +130 -16
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +3 -5
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +9 -1
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +92 -47
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +4 -1
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +5 -1
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +3 -2
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +2 -2
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +4 -2
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +10 -11
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +3 -1
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +4 -2
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +6 -11
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +1 -5
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +3 -2
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +2 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.d.ts +1 -1
- package/dist/store/gi/return-wrap.d.ts.map +1 -1
- package/dist/store/gi/return-wrap.js +4 -4
- package/dist/store/gi/return-wrap.js.map +1 -1
- package/dist/store/gi/runtime-override.d.ts +2 -1
- package/dist/store/gi/runtime-override.d.ts.map +1 -1
- package/dist/store/gi/runtime-override.js +8 -5
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +27 -31
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -10
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +1 -10
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +16 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +214 -51
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +2 -3
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +1 -3
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -8
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -4
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js +0 -2
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -1
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -2
- package/dist/store/jsx/element-prop-types.js.map +1 -1
- package/dist/store/jsx/generated-elements.d.ts +29 -0
- package/dist/store/jsx/generated-elements.d.ts.map +1 -0
- package/dist/store/jsx/generated-elements.js +30 -0
- package/dist/store/jsx/generated-elements.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
- package/dist/store/jsx/intrinsic-elements.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +13 -12
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.js +9 -9
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/omitted-props.d.ts +2 -4
- package/dist/store/jsx/omitted-props.d.ts.map +1 -1
- package/dist/store/jsx/omitted-props.js +2 -4
- package/dist/store/jsx/omitted-props.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +4 -2
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- package/dist/store/jsx/pipeline.js +3 -2
- package/dist/store/jsx/pipeline.js.map +1 -1
- package/dist/store/jsx/props.d.ts +1 -7
- package/dist/store/jsx/props.d.ts.map +1 -1
- package/dist/store/jsx/props.js +16 -8
- package/dist/store/jsx/props.js.map +1 -1
- package/dist/store/jsx-store.d.ts +2 -3
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -3
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +28 -0
- package/dist/store/resolve-store.d.ts.map +1 -0
- package/dist/store/resolve-store.js +65 -0
- package/dist/store/resolve-store.js.map +1 -0
- package/dist/store/store-fs.d.ts +5 -1
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +6 -4
- package/dist/store/store-fs.js.map +1 -1
- package/dist/writer/context.d.ts +2 -1
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +3 -0
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc-tags.d.ts +21 -0
- package/dist/writer/doc-tags.d.ts.map +1 -0
- package/dist/writer/doc-tags.js +38 -0
- package/dist/writer/doc-tags.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +19 -6
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +64 -15
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/module.d.ts +8 -2
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +13 -1
- package/dist/writer/module.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +26 -0
- package/overrides/gobject/object.ts.ejs +56 -11
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +7 -11
- package/src/analysis/descriptor-render.ts +67 -73
- package/src/analysis/descriptor.ts +13 -16
- package/src/analysis/inheritance.ts +35 -34
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +172 -0
- package/src/analysis/param-structure.ts +90 -32
- package/src/analysis/ts-type.ts +4 -6
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +3 -2
- package/src/docs/api-reference.ts +162 -28
- package/src/docs/element-page.ts +53 -47
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +10 -10
- package/src/docs/render.ts +153 -39
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +8 -14
- package/src/gi.ts +4 -11
- package/src/gir/ancestry.ts +15 -1
- package/src/gir/annotations.ts +37 -0
- package/src/gir/callback.ts +2 -0
- package/src/gir/class.ts +42 -4
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -13
- package/src/gir/function.ts +15 -0
- package/src/gir/gir-path.ts +7 -0
- package/src/gir/libraries.ts +23 -2
- package/src/gir/library.ts +51 -2
- package/src/gir/namespace.ts +41 -5
- package/src/gir/parameter.ts +47 -7
- package/src/gir/parse.ts +8 -2
- package/src/gir/primitives.ts +1 -0
- package/src/gir/property.ts +18 -3
- package/src/gir/record.ts +24 -2
- package/src/gir/size.ts +8 -6
- package/src/gir/type-id.ts +51 -7
- package/src/gir/type-ref.ts +2 -1
- package/src/gir/type.ts +50 -6
- package/src/index.ts +18 -16
- package/src/internal.ts +2 -0
- package/src/jsx.ts +26 -26
- package/src/khronos/args.ts +37 -14
- package/src/khronos/doc-context.ts +62 -0
- package/src/khronos/extensions.ts +85 -0
- package/src/khronos/jsdoc.ts +152 -56
- package/src/khronos/model.ts +314 -69
- package/src/khronos/modules.ts +134 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +12 -13
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +21 -18
- package/src/runner.ts +51 -40
- package/src/store/compile-store.ts +4 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +23 -17
- package/src/store/gi/callback.ts +3 -2
- package/src/store/gi/class.ts +6 -3
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/constant.ts +3 -6
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +55 -20
- package/src/store/gi/function.ts +44 -26
- package/src/store/gi/interface.ts +214 -26
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +126 -68
- package/src/store/gi/param-marshal.ts +15 -1
- package/src/store/gi/pipeline.ts +7 -2
- package/src/store/gi/properties.ts +3 -2
- package/src/store/gi/property-accessor.ts +14 -11
- package/src/store/gi/record-constructor.ts +6 -1
- package/src/store/gi/record-field-accessor.ts +9 -13
- package/src/store/gi/record-layout.ts +1 -5
- package/src/store/gi/record.ts +8 -2
- package/src/store/gi/registration.ts +3 -3
- package/src/store/gi/return-wrap.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +36 -37
- package/src/store/gi/value-marshalable.ts +1 -10
- package/src/store/gi/vtable.ts +361 -60
- package/src/store/gi-store.ts +2 -4
- package/src/store/jsx/element-components.ts +8 -11
- package/src/store/jsx/element-prop-imports.ts +6 -5
- package/src/store/jsx/element-prop-types.ts +10 -2
- package/src/store/jsx/generated-elements.ts +60 -0
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +15 -13
- package/src/store/jsx/metadata.ts +10 -10
- package/src/store/jsx/omitted-props.ts +2 -4
- package/src/store/jsx/pipeline.ts +6 -4
- package/src/store/jsx/props.ts +22 -9
- package/src/store/jsx-store.ts +5 -7
- package/src/store/resolve-store.ts +100 -0
- package/src/store/store-fs.ts +12 -5
- package/src/writer/context.ts +5 -1
- package/src/writer/doc-tags.ts +70 -0
- package/src/writer/doc.ts +29 -6
- package/src/writer/gtk-doc.ts +82 -15
- package/src/writer/module.ts +25 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"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","sourcesContent":["import { ImportsBuilder } from \"./imports.js\";\n\ntype DeclaredType = {\n name: string;\n owner: string;\n};\n\nclass ModuleBuilder {\n private bindings: string[] = [];\n private bindingNames: Set<string> = new Set();\n private hoistedDescriptors: Map<string, string> = new Map();\n private declarations: string[] = [];\n private declaredTypes: Map<string, string> = new Map();\n private registrations: string[] = [];\n public imports: ImportsBuilder = new ImportsBuilder();\n\n private claimTypeName(declared: DeclaredType): void {\n const owner = this.declaredTypes.get(declared.name);\n\n if (owner !== undefined && owner !== declared.owner) {\n throw new Error(\n `The generated type '${declared.name}' is declared for both ${owner} and ${declared.owner}. ` +\n \"Rename one of them, or drop the namespace from the configuration.\",\n );\n }\n\n this.declaredTypes.set(declared.name, declared.owner);\n }\n\n appendBinding(code: string, name?: string): void {\n if (name !== undefined) {\n if (this.bindingNames.has(name)) {\n return;\n }\n\n this.bindingNames.add(name);\n }\n\n this.bindings.push(code);\n }\n\n hoistDescriptor(expression: string): string {\n const existing = this.hoistedDescriptors.get(expression);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const name = `_desc${String(this.hoistedDescriptors.size)}`;\n this.hoistedDescriptors.set(expression, name);\n this.appendBinding(`const ${name} = ${expression};`, name);\n\n return name;\n }\n\n appendDeclaration(code: string, declared?: DeclaredType): void {\n if (declared !== undefined) {\n this.claimTypeName(declared);\n }\n\n this.declarations.push(code);\n }\n\n appendRegistration(code: string): void {\n this.registrations.push(code);\n }\n\n toSource(): string {\n const sections: string[] = [];\n const importsBlock = this.imports.toSource();\n\n if (importsBlock.length > 0) {\n sections.push(importsBlock.trimEnd());\n }\n\n if (this.declarations.length > 0) {\n sections.push(this.declarations.join(\"\\n\\n\"));\n }\n\n if (this.bindings.length > 0) {\n sections.push(this.bindings.join(\"\\n\\n\"));\n }\n\n if (this.registrations.length > 0) {\n sections.push(this.registrations.join(\"\\n\\n\"));\n }\n\n return `${sections.join(\"\\n\\n\")}\\n`;\n }\n}\n\nexport { type DeclaredType, ModuleBuilder };\n"]}
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { RGBA as GeneratedRGBA } from "../gdk.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Parses a CSS color string into a new `RGBA`.
|
|
5
|
+
*
|
|
6
|
+
* @param value a CSS color string, such as `#rgb`, `rgb(r,g,b)`, or a named color
|
|
7
|
+
* @returns the parsed color
|
|
8
|
+
*/
|
|
3
9
|
const create = (value: string): GeneratedRGBA => {
|
|
4
10
|
const rgba = new GeneratedRGBA();
|
|
5
11
|
rgba.parse(value);
|
|
6
12
|
return rgba;
|
|
7
13
|
};
|
|
8
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Represents a color, in a way that is compatible with cairo's notion of color.
|
|
17
|
+
*
|
|
18
|
+
* `GdkRGBA` is a convenient way to pass colors around. It's based on
|
|
19
|
+
* cairo's way to deal with colors and mirrors its behavior. All values
|
|
20
|
+
* are in the range from 0.0 to 1.0 inclusive. So the color
|
|
21
|
+
* (0.0, 0.0, 0.0, 0.0) represents transparent black and
|
|
22
|
+
* (1.0, 1.0, 1.0, 1.0) is opaque white. Other values will
|
|
23
|
+
* be clamped to this range when drawing.
|
|
24
|
+
*/
|
|
9
25
|
export const RGBA: typeof GeneratedRGBA & { create: typeof create } = Object.assign(GeneratedRGBA, { create });
|
|
10
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Represents a color, in a way that is compatible with cairo's notion of color.
|
|
29
|
+
*
|
|
30
|
+
* `GdkRGBA` is a convenient way to pass colors around. It's based on
|
|
31
|
+
* cairo's way to deal with colors and mirrors its behavior. All values
|
|
32
|
+
* are in the range from 0.0 to 1.0 inclusive. So the color
|
|
33
|
+
* (0.0, 0.0, 0.0, 0.0) represents transparent black and
|
|
34
|
+
* (1.0, 1.0, 1.0, 1.0) is opaque white. Other values will
|
|
35
|
+
* be clamped to this range when drawing.
|
|
36
|
+
*/
|
|
11
37
|
export type RGBA = GeneratedRGBA;
|
|
@@ -1,42 +1,87 @@
|
|
|
1
|
-
import { offSignal, onceSignal, onSignal } from "@gtkx/runtime";
|
|
2
|
-
import { Object as GObject,
|
|
1
|
+
import { disconnectSignal, offSignal, onceSignal, onSignal } from "@gtkx/runtime";
|
|
2
|
+
import { Object as GObject, type Type } from "../gobject.js";
|
|
3
3
|
|
|
4
4
|
type Listener = (...args: unknown[]) => unknown;
|
|
5
5
|
|
|
6
6
|
declare module "../gobject.js" {
|
|
7
7
|
interface Object {
|
|
8
|
+
/** GType the instance's class is registered under, carried on the prototype. */
|
|
8
9
|
__type__: Type;
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Disconnects the handler `connect` returned the given id for.
|
|
13
|
+
*
|
|
14
|
+
* @param handlerId Id of the handler to disconnect.
|
|
15
|
+
*/
|
|
10
16
|
disconnect(handlerId: number): void;
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Connects a handler that runs on every emission of `sigName`, remembering it so `off` can
|
|
20
|
+
* take the same callback back off again.
|
|
21
|
+
*
|
|
22
|
+
* @param sigName Signal to connect to.
|
|
23
|
+
* @param callback Handler invoked on each emission.
|
|
24
|
+
* @param isAfter Run the handler after the default handler rather than before it.
|
|
25
|
+
* @returns The same object, so calls chain.
|
|
26
|
+
*/
|
|
27
|
+
on(sigName: string, callback: (...args: unknown[]) => unknown, isAfter?: boolean): Object;
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Connects a handler that runs at most once and disconnects itself after the first emission.
|
|
31
|
+
*
|
|
32
|
+
* @param sigName Signal to connect to.
|
|
33
|
+
* @param callback Handler invoked on the first emission.
|
|
34
|
+
* @param isAfter Run the handler after the default handler rather than before it.
|
|
35
|
+
* @returns The same object, so calls chain.
|
|
36
|
+
*/
|
|
37
|
+
once(sigName: string, callback: (...args: unknown[]) => unknown, isAfter?: boolean): Object;
|
|
15
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Disconnects a handler previously connected with `on` or `once`, given the same callback.
|
|
41
|
+
*
|
|
42
|
+
* @param sigName Signal the handler was connected to.
|
|
43
|
+
* @param callback The handler that was connected.
|
|
44
|
+
* @returns The same object, so calls chain.
|
|
45
|
+
*/
|
|
16
46
|
off(sigName: string, callback: (...args: unknown[]) => unknown): Object;
|
|
17
47
|
|
|
18
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Alias of `on`, for callers who prefer the DOM spelling.
|
|
50
|
+
*
|
|
51
|
+
* @param sigName Signal to connect to.
|
|
52
|
+
* @param callback Handler invoked on each emission.
|
|
53
|
+
* @param isAfter Run the handler after the default handler rather than before it.
|
|
54
|
+
* @returns The same object, so calls chain.
|
|
55
|
+
*/
|
|
56
|
+
addEventListener(sigName: string, callback: (...args: unknown[]) => unknown, isAfter?: boolean): Object;
|
|
19
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Alias of `off`, for callers who prefer the DOM spelling.
|
|
60
|
+
*
|
|
61
|
+
* @param sigName Signal the handler was connected to.
|
|
62
|
+
* @param callback The handler that was connected.
|
|
63
|
+
* @returns The same object, so calls chain.
|
|
64
|
+
*/
|
|
20
65
|
removeEventListener(sigName: string, callback: (...args: unknown[]) => unknown): Object;
|
|
21
66
|
}
|
|
22
67
|
}
|
|
23
68
|
|
|
24
69
|
type GObjectWithConnect = GObject & {
|
|
25
|
-
connect(sigName: string, callback: Listener,
|
|
70
|
+
connect(sigName: string, callback: Listener, isAfter?: boolean): number;
|
|
26
71
|
};
|
|
27
72
|
|
|
28
73
|
GObject.prototype.disconnect = function disconnect(handlerId: number): void {
|
|
29
|
-
|
|
74
|
+
disconnectSignal(this, handlerId);
|
|
30
75
|
};
|
|
31
76
|
|
|
32
|
-
function onImpl(this: GObjectWithConnect, sigName: string, callback: Listener,
|
|
33
|
-
onSignal(this, sigName, callback,
|
|
77
|
+
function onImpl(this: GObjectWithConnect, sigName: string, callback: Listener, isAfter?: boolean): GObject {
|
|
78
|
+
onSignal(this, sigName, callback, isAfter);
|
|
34
79
|
return this;
|
|
35
80
|
}
|
|
36
81
|
GObject.prototype.on = onImpl;
|
|
37
82
|
|
|
38
|
-
function onceImpl(this: GObjectWithConnect, sigName: string, callback: Listener,
|
|
39
|
-
onceSignal(this, sigName, callback,
|
|
83
|
+
function onceImpl(this: GObjectWithConnect, sigName: string, callback: Listener, isAfter?: boolean): GObject {
|
|
84
|
+
onceSignal(this, sigName, callback, isAfter);
|
|
40
85
|
return this;
|
|
41
86
|
}
|
|
42
87
|
GObject.prototype.once = onceImpl;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { getBoxedValue, getHandle, setBoxedValue } from "@gtkx/runtime";
|
|
2
2
|
import { type Type, Value } from "../gobject.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Allocates a `Value`, initializes it to `gtype`, and hands it to `populate` to fill in.
|
|
6
|
+
*
|
|
7
|
+
* @param gtype GType the value holds.
|
|
8
|
+
* @param populate Called with the initialized value to write the contents.
|
|
9
|
+
* @returns The populated value.
|
|
10
|
+
*/
|
|
4
11
|
export const buildValue = (gtype: Type, populate: (value: Value) => void): Value => {
|
|
5
12
|
const value = new Value();
|
|
6
13
|
value.init(gtype);
|
|
@@ -1,37 +1,92 @@
|
|
|
1
1
|
import { Point as GeneratedPoint, Rect as GeneratedRect, Size as GeneratedSize } from "../graphene.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Allocates a new `Point` and initializes it to the given coordinates.
|
|
5
|
+
*
|
|
6
|
+
* @param x the X coordinate
|
|
7
|
+
* @param y the Y coordinate
|
|
8
|
+
* @returns the initialized point
|
|
9
|
+
*/
|
|
3
10
|
const createPoint = (x: number, y: number): GeneratedPoint => {
|
|
4
11
|
const point = GeneratedPoint.alloc();
|
|
5
12
|
point.init(x, y);
|
|
6
13
|
return point;
|
|
7
14
|
};
|
|
8
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Allocates a new `Rect` and initializes it to the given origin and size.
|
|
18
|
+
*
|
|
19
|
+
* @param x the X coordinate of the origin
|
|
20
|
+
* @param y the Y coordinate of the origin
|
|
21
|
+
* @param width the width of the rectangle
|
|
22
|
+
* @param height the height of the rectangle
|
|
23
|
+
* @returns the initialized rectangle
|
|
24
|
+
*/
|
|
9
25
|
const createRect = (x: number, y: number, width: number, height: number): GeneratedRect => {
|
|
10
26
|
const rect = GeneratedRect.alloc();
|
|
11
27
|
rect.init(x, y, width, height);
|
|
12
28
|
return rect;
|
|
13
29
|
};
|
|
14
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Allocates a new `Size` and initializes it to the given width and height.
|
|
33
|
+
*
|
|
34
|
+
* @param width the width
|
|
35
|
+
* @param height the height
|
|
36
|
+
* @returns the initialized size
|
|
37
|
+
*/
|
|
15
38
|
const createSize = (width: number, height: number): GeneratedSize => {
|
|
16
39
|
const size = GeneratedSize.alloc();
|
|
17
40
|
size.init(width, height);
|
|
18
41
|
return size;
|
|
19
42
|
};
|
|
20
43
|
|
|
44
|
+
/** A point with two coordinates. */
|
|
21
45
|
export const Point: typeof GeneratedPoint & { create: typeof createPoint } = Object.assign(GeneratedPoint, {
|
|
22
46
|
create: createPoint,
|
|
23
47
|
});
|
|
24
48
|
|
|
49
|
+
/** A point with two coordinates. */
|
|
25
50
|
export type Point = GeneratedPoint;
|
|
26
51
|
|
|
52
|
+
/**
|
|
53
|
+
* The location and size of a rectangle region.
|
|
54
|
+
*
|
|
55
|
+
* The width and height of a `graphene_rect_t` can be negative; for instance,
|
|
56
|
+
* a `graphene_rect_t` with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is
|
|
57
|
+
* equivalent to a `graphene_rect_t` with an origin of [ 10, 10 ] and a size
|
|
58
|
+
* of [ -10, -10 ].
|
|
59
|
+
*
|
|
60
|
+
* Application code can normalize rectangles using `graphene_rect_normalize()`;
|
|
61
|
+
* this function will ensure that the width and height of a rectangle are
|
|
62
|
+
* positive values. All functions taking a `graphene_rect_t` as an argument
|
|
63
|
+
* will internally operate on a normalized copy; all functions returning a
|
|
64
|
+
* `graphene_rect_t` will always return a normalized rectangle.
|
|
65
|
+
*/
|
|
27
66
|
export const Rect: typeof GeneratedRect & { create: typeof createRect } = Object.assign(GeneratedRect, {
|
|
28
67
|
create: createRect,
|
|
29
68
|
});
|
|
30
69
|
|
|
70
|
+
/**
|
|
71
|
+
* The location and size of a rectangle region.
|
|
72
|
+
*
|
|
73
|
+
* The width and height of a `graphene_rect_t` can be negative; for instance,
|
|
74
|
+
* a `graphene_rect_t` with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is
|
|
75
|
+
* equivalent to a `graphene_rect_t` with an origin of [ 10, 10 ] and a size
|
|
76
|
+
* of [ -10, -10 ].
|
|
77
|
+
*
|
|
78
|
+
* Application code can normalize rectangles using `graphene_rect_normalize()`;
|
|
79
|
+
* this function will ensure that the width and height of a rectangle are
|
|
80
|
+
* positive values. All functions taking a `graphene_rect_t` as an argument
|
|
81
|
+
* will internally operate on a normalized copy; all functions returning a
|
|
82
|
+
* `graphene_rect_t` will always return a normalized rectangle.
|
|
83
|
+
*/
|
|
31
84
|
export type Rect = GeneratedRect;
|
|
32
85
|
|
|
86
|
+
/** A size. */
|
|
33
87
|
export const Size: typeof GeneratedSize & { create: typeof createSize } = Object.assign(GeneratedSize, {
|
|
34
88
|
create: createSize,
|
|
35
89
|
});
|
|
36
90
|
|
|
91
|
+
/** A size. */
|
|
37
92
|
export type Size = GeneratedSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/codegen",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Generates the typed GTKX bindings and API reference from GIR and OpenGL registry data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -29,13 +29,9 @@
|
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
31
|
},
|
|
32
|
-
"./
|
|
33
|
-
"types": "./dist/
|
|
34
|
-
"default": "./dist/
|
|
35
|
-
},
|
|
36
|
-
"./jsx": {
|
|
37
|
-
"types": "./dist/jsx.d.ts",
|
|
38
|
-
"default": "./dist/jsx.js"
|
|
32
|
+
"./internal": {
|
|
33
|
+
"types": "./dist/internal.d.ts",
|
|
34
|
+
"default": "./dist/internal.js"
|
|
39
35
|
}
|
|
40
36
|
},
|
|
41
37
|
"sideEffects": false,
|
|
@@ -48,11 +44,11 @@
|
|
|
48
44
|
"node": ">=24"
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
51
|
-
"@types/node": "^26.
|
|
47
|
+
"@types/node": "^26.2.0",
|
|
52
48
|
"fast-xml-parser": "^5.10.1",
|
|
53
49
|
"typescript": "^6.0.3",
|
|
54
|
-
"@gtkx/
|
|
55
|
-
"@gtkx/
|
|
50
|
+
"@gtkx/utils": "1.0.0",
|
|
51
|
+
"@gtkx/react": "1.0.0"
|
|
56
52
|
},
|
|
57
53
|
"scripts": {
|
|
58
54
|
"release": "tsx ../../scripts/release-package.ts"
|
|
@@ -48,20 +48,21 @@ import {
|
|
|
48
48
|
tUint64,
|
|
49
49
|
tVoid,
|
|
50
50
|
} from "./descriptor.js";
|
|
51
|
+
import { carrayFor, isUnboundedArray, primitiveCategoryFor } from "./type-shape.js";
|
|
51
52
|
|
|
52
53
|
type RenderDescriptorOptions = {
|
|
53
54
|
argIndexOffset?: number;
|
|
54
|
-
/** GIR parameter index to emitted argument index, for callables that drop parameters. */
|
|
55
55
|
argIndexMap?: Map<number, number> | undefined;
|
|
56
|
-
|
|
56
|
+
hasOutIndirection?: boolean;
|
|
57
|
+
isCallerAllocated?: boolean;
|
|
57
58
|
isInline?: boolean;
|
|
58
|
-
/** Set on the return value of a callable with no instance parameter, which creates what it returns. */
|
|
59
59
|
isNewlyCreated?: boolean;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
type ArgIndexOptions = {
|
|
63
63
|
argIndexOffset: number;
|
|
64
64
|
argIndexMap: Map<number, number> | undefined;
|
|
65
|
+
hasOutIndirection: boolean;
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
type RecordPlacement = {
|
|
@@ -76,7 +77,7 @@ type FundamentalDescriptor = {
|
|
|
76
77
|
typeName: string | undefined;
|
|
77
78
|
ownership: Ownership;
|
|
78
79
|
wrapperClass?: string | undefined;
|
|
79
|
-
|
|
80
|
+
isInline?: boolean | undefined;
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
type AncestorFundamental = {
|
|
@@ -94,7 +95,7 @@ type FundamentalRecordOptions = {
|
|
|
94
95
|
unrefFunc: string;
|
|
95
96
|
ownership: Ownership;
|
|
96
97
|
wrapperClass: string | undefined;
|
|
97
|
-
|
|
98
|
+
isInline: boolean;
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
const LIST_HELPERS: Record<Exclude<ListFlavor, "gbytearray">, ListDescriptorName> = {
|
|
@@ -104,17 +105,8 @@ const LIST_HELPERS: Record<Exclude<ListFlavor, "gbytearray">, ListDescriptorName
|
|
|
104
105
|
garray: "gArray",
|
|
105
106
|
};
|
|
106
107
|
|
|
107
|
-
/**
|
|
108
|
-
* `glib:type-name` of every fundamental whose instances are born with a floating reference, so a
|
|
109
|
-
* callable that creates one hands back a claim nobody has taken rather than an owned reference.
|
|
110
|
-
* GIR annotates those returns `transfer-ownership="full"` all the same, so the annotation alone
|
|
111
|
-
* cannot tell them apart from a genuinely owned return such as `g_param_spec_ref`.
|
|
112
|
-
*/
|
|
113
108
|
const FLOATING_FUNDAMENTALS: Set<string> = new Set(["GParam"]);
|
|
114
109
|
|
|
115
|
-
// A callable that drops parameters (varargs, and the closure/destroy slots folded into a callback)
|
|
116
|
-
// shifts every later parameter left, so a GIR length index has to be looked up in the emitted list
|
|
117
|
-
// rather than shifted by the instance offset alone.
|
|
118
110
|
const mapArgIndex = (options: ArgIndexOptions, girIndex: number): number =>
|
|
119
111
|
options.argIndexMap?.get(girIndex) ?? girIndex + options.argIndexOffset;
|
|
120
112
|
|
|
@@ -133,15 +125,8 @@ const transferOwnership = (transfer: ParameterTransfer): Ownership => {
|
|
|
133
125
|
const deriveElementTransfer = (transfer: ParameterTransfer): ParameterTransfer =>
|
|
134
126
|
transfer === "container" ? "none" : transfer;
|
|
135
127
|
|
|
136
|
-
const isVoidRef = (library: Library, ref: TypeId | undefined): boolean =>
|
|
137
|
-
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const type = library.typeFor(ref);
|
|
142
|
-
|
|
143
|
-
return type?.kind === "primitive" && type.category === "void";
|
|
144
|
-
};
|
|
128
|
+
const isVoidRef = (library: Library, ref: TypeId | undefined): boolean =>
|
|
129
|
+
ref === undefined || primitiveCategoryFor(library, ref) === "void";
|
|
145
130
|
|
|
146
131
|
const isInlineCallbackRef = (library: Library, ref: TypeId | undefined): boolean =>
|
|
147
132
|
ref !== undefined && library.typeFor(ref)?.kind === "callback" && library.nameFor(ref) === undefined;
|
|
@@ -149,6 +134,12 @@ const isInlineCallbackRef = (library: Library, ref: TypeId | undefined): boolean
|
|
|
149
134
|
const shouldOmitPrimaryReturn = (library: Library, returnValue: GirReturnValue): boolean =>
|
|
150
135
|
isVoidRef(library, returnValue.type) || returnValue.skip;
|
|
151
136
|
|
|
137
|
+
const argIndexOptions = (options: RenderDescriptorOptions): ArgIndexOptions => ({
|
|
138
|
+
argIndexOffset: options.argIndexOffset ?? 0,
|
|
139
|
+
argIndexMap: options.argIndexMap,
|
|
140
|
+
hasOutIndirection: options.hasOutIndirection === true,
|
|
141
|
+
});
|
|
142
|
+
|
|
152
143
|
const renderDescriptor = (
|
|
153
144
|
context: ModuleContext,
|
|
154
145
|
ref: TypeId | undefined,
|
|
@@ -159,8 +150,7 @@ const renderDescriptor = (
|
|
|
159
150
|
return tVoid;
|
|
160
151
|
}
|
|
161
152
|
|
|
162
|
-
const
|
|
163
|
-
const indexOptions: ArgIndexOptions = { argIndexOffset, argIndexMap: options.argIndexMap };
|
|
153
|
+
const indexOptions = argIndexOptions(options);
|
|
164
154
|
const ownership = transferOwnership(transfer);
|
|
165
155
|
const type = context.library.typeFor(ref);
|
|
166
156
|
|
|
@@ -175,9 +165,6 @@ const renderDescriptor = (
|
|
|
175
165
|
case "varargs": {
|
|
176
166
|
return tVoid;
|
|
177
167
|
}
|
|
178
|
-
// A callback in a slot no `renderCallbackType` covers (a vtable entry, a signal argument, a
|
|
179
|
-
// record field) is still a function pointer occupying a pointer-sized slot. `t.void` would
|
|
180
|
-
// hand the implementation `undefined` where the pointer belongs.
|
|
181
168
|
case "callback": {
|
|
182
169
|
return tUint64;
|
|
183
170
|
}
|
|
@@ -269,8 +256,19 @@ const isScalarRef = (library: Library, ref: TypeId | undefined): boolean => {
|
|
|
269
256
|
return type !== undefined && isScalarType(library, type);
|
|
270
257
|
};
|
|
271
258
|
|
|
259
|
+
const isStrvRef = (library: Library, ref: TypeId | undefined): boolean => {
|
|
260
|
+
const type = carrayFor(library, ref);
|
|
261
|
+
|
|
262
|
+
if (type === undefined) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return isUnboundedArray(type) && primitiveCategoryFor(library, type.element) === "string";
|
|
267
|
+
};
|
|
268
|
+
|
|
272
269
|
const isCellInout = (library: Library, parameter: GirParameter): boolean =>
|
|
273
|
-
isInoutParameter(parameter) &&
|
|
270
|
+
isInoutParameter(parameter) &&
|
|
271
|
+
(isScalarRef(library, parameter.type) || isStrvRef(library, parameter.type));
|
|
274
272
|
|
|
275
273
|
const renderParamDescriptor = (
|
|
276
274
|
context: ModuleContext,
|
|
@@ -278,23 +276,22 @@ const renderParamDescriptor = (
|
|
|
278
276
|
ref: TypeId | undefined,
|
|
279
277
|
argIndex: Partial<ArgIndexOptions> = {},
|
|
280
278
|
): string => {
|
|
279
|
+
const behindRef: RenderDescriptorOptions = { ...argIndex, hasOutIndirection: true };
|
|
280
|
+
|
|
281
281
|
if (isCellInout(context.library, parameter)) {
|
|
282
|
-
return tRef(renderDescriptor(context, ref, parameter.transferOwnership,
|
|
282
|
+
return tRef(renderDescriptor(context, ref, parameter.transferOwnership, behindRef), true);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
if (isOutParameter(parameter)) {
|
|
286
|
-
return tRef(renderDescriptor(context, ref, parameter.transferOwnership,
|
|
286
|
+
return tRef(renderDescriptor(context, ref, parameter.transferOwnership, behindRef));
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
return renderDescriptor(context, ref, parameter.transferOwnership, {
|
|
290
290
|
...argIndex,
|
|
291
|
-
|
|
291
|
+
isCallerAllocated: isCallerAllocatedOut(parameter) || isRecordInout(context, parameter),
|
|
292
292
|
});
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
-
// `closure=` on a callback's own parameter states which slot carries the user data, and it is what
|
|
296
|
-
// the TypeScript signature already goes by. The name scan stays as a fallback: 88 callbacks across
|
|
297
|
-
// the installed GIRs carry no `closure=` at all.
|
|
298
295
|
const userDataIndexByName = (parameters: GirParameter[]): number | undefined => {
|
|
299
296
|
let userDataIndex: number | undefined;
|
|
300
297
|
|
|
@@ -320,6 +317,10 @@ const callbackOptionsArg = (owningParameter: GirParameter, userDataIndex: number
|
|
|
320
317
|
options.push("hasDestroy: true");
|
|
321
318
|
}
|
|
322
319
|
|
|
320
|
+
if (owningParameter.closureIndex !== undefined) {
|
|
321
|
+
options.push("hasUserData: true");
|
|
322
|
+
}
|
|
323
|
+
|
|
323
324
|
if (userDataIndex !== undefined) {
|
|
324
325
|
options.push(`userDataIndex: ${String(userDataIndex)}`);
|
|
325
326
|
}
|
|
@@ -379,19 +380,16 @@ const primitiveExpression = (category: PrimitiveCategory, ownership: Ownership):
|
|
|
379
380
|
};
|
|
380
381
|
|
|
381
382
|
const renderFundamental = (descriptor: FundamentalDescriptor): string => {
|
|
382
|
-
const { lib, refFunc, unrefFunc, typeName, ownership, wrapperClass,
|
|
383
|
+
const { lib, refFunc, unrefFunc, typeName, ownership, wrapperClass, isInline } = descriptor;
|
|
383
384
|
|
|
384
385
|
return tFundamental(lib, refFunc, unrefFunc, {
|
|
385
386
|
ownership,
|
|
386
387
|
typeName,
|
|
387
388
|
wrapperClass,
|
|
388
|
-
|
|
389
|
+
isInline,
|
|
389
390
|
});
|
|
390
391
|
};
|
|
391
392
|
|
|
392
|
-
// A freshly created floating instance is claimed by sinking it, which is what the fundamental's
|
|
393
|
-
// declared ref function does, so it is marshalled as transfer-none: adopting the floating reference
|
|
394
|
-
// instead would leave the handle releasing a claim it never took.
|
|
395
393
|
const sunkOwnership = (
|
|
396
394
|
ancestor: AncestorFundamental,
|
|
397
395
|
ownership: Ownership,
|
|
@@ -404,8 +402,6 @@ const sunkOwnership = (
|
|
|
404
402
|
return FLOATING_FUNDAMENTALS.has(ancestor.typeName) ? "borrowed" : ownership;
|
|
405
403
|
};
|
|
406
404
|
|
|
407
|
-
// GIR marks only the root of a fundamental hierarchy with `glib:fundamental` and its ref/unref pair,
|
|
408
|
-
// so a derived type such as GtkPropertyExpression carries neither and has to inherit both.
|
|
409
405
|
const classOrInterfaceExpression = (
|
|
410
406
|
context: ModuleContext,
|
|
411
407
|
resolved: Extract<EntityType, { kind: "class" | "interface" }>,
|
|
@@ -480,10 +476,11 @@ const fundamentalAncestor = (
|
|
|
480
476
|
const classSelfDescriptor = (
|
|
481
477
|
context: ModuleContext,
|
|
482
478
|
type: Extract<EntityType, { kind: "class" | "interface" }>,
|
|
479
|
+
ownership: Ownership,
|
|
483
480
|
): string => {
|
|
484
481
|
const ancestor = fundamentalAncestor(context, type);
|
|
485
482
|
|
|
486
|
-
return ancestor === undefined ? tObject(
|
|
483
|
+
return ancestor === undefined ? tObject(ownership) : renderFundamental({ ...ancestor, ownership });
|
|
487
484
|
};
|
|
488
485
|
|
|
489
486
|
const renderSelfDescriptor = (context: ModuleContext, instance: GirParameter): string => {
|
|
@@ -500,7 +497,7 @@ const renderSelfDescriptor = (context: ModuleContext, instance: GirParameter): s
|
|
|
500
497
|
}
|
|
501
498
|
|
|
502
499
|
if (isClassOrInterface(type)) {
|
|
503
|
-
return classSelfDescriptor(context, type);
|
|
500
|
+
return classSelfDescriptor(context, type, transferOwnership(instance.transferOwnership));
|
|
504
501
|
}
|
|
505
502
|
|
|
506
503
|
if (type.kind === "record") {
|
|
@@ -510,9 +507,6 @@ const renderSelfDescriptor = (context: ModuleContext, instance: GirParameter): s
|
|
|
510
507
|
return tObject("borrowed");
|
|
511
508
|
};
|
|
512
509
|
|
|
513
|
-
// A record expresses its acquire/release pair as `copy-function`/`free-function`: no `<record>` in
|
|
514
|
-
// any installed GIR carries `glib:ref-func`, and GVariant's copy function really is
|
|
515
|
-
// `g_variant_ref_sink`.
|
|
516
510
|
const recordRefPair = (record: ResolvedRecord): { refFunc: string | undefined; unrefFunc: string | undefined } => ({
|
|
517
511
|
refFunc: record.glibRefFunc ?? record.copyFunc,
|
|
518
512
|
unrefFunc: record.glibUnrefFunc ?? record.freeFunc,
|
|
@@ -532,7 +526,7 @@ const structExpression = (
|
|
|
532
526
|
context: ModuleContext,
|
|
533
527
|
resolved: Extract<EntityType, { kind: "record" }>,
|
|
534
528
|
ownership: Ownership,
|
|
535
|
-
options: {
|
|
529
|
+
options: { isCallerAllocated: boolean; isInline: boolean },
|
|
536
530
|
): string => {
|
|
537
531
|
const { size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);
|
|
538
532
|
const wrapperClass = context.qualify(resolved.namespace.name, resolved.value.name);
|
|
@@ -541,13 +535,13 @@ const structExpression = (
|
|
|
541
535
|
return tStruct(ownership, {
|
|
542
536
|
size: isCopyable && size > 0 ? size : undefined,
|
|
543
537
|
wrapperClass,
|
|
544
|
-
|
|
545
|
-
|
|
538
|
+
isCallerAllocated: options.isCallerAllocated,
|
|
539
|
+
isInline: options.isInline,
|
|
546
540
|
});
|
|
547
541
|
};
|
|
548
542
|
|
|
549
543
|
const fundamentalRecordExpression = (options: FundamentalRecordOptions): string => {
|
|
550
|
-
const { resolved, refFunc, unrefFunc, ownership, wrapperClass,
|
|
544
|
+
const { resolved, refFunc, unrefFunc, ownership, wrapperClass, isInline } = options;
|
|
551
545
|
|
|
552
546
|
return renderFundamental({
|
|
553
547
|
lib: resolved.namespace.sharedLibrary ?? "",
|
|
@@ -556,7 +550,7 @@ const fundamentalRecordExpression = (options: FundamentalRecordOptions): string
|
|
|
556
550
|
typeName: resolved.value.glibTypeName,
|
|
557
551
|
ownership,
|
|
558
552
|
wrapperClass,
|
|
559
|
-
|
|
553
|
+
isInline,
|
|
560
554
|
});
|
|
561
555
|
};
|
|
562
556
|
|
|
@@ -564,11 +558,11 @@ const boxedRecordExpression = (options: {
|
|
|
564
558
|
context: ModuleContext;
|
|
565
559
|
resolved: Extract<EntityType, { kind: "record" }>;
|
|
566
560
|
ownership: Ownership;
|
|
567
|
-
|
|
568
|
-
|
|
561
|
+
isCallerAllocated: boolean;
|
|
562
|
+
isInline: boolean;
|
|
569
563
|
typeFnName: string;
|
|
570
564
|
}): string => {
|
|
571
|
-
const { context, resolved, ownership,
|
|
565
|
+
const { context, resolved, ownership, isCallerAllocated, isInline, typeFnName } = options;
|
|
572
566
|
const record = resolved.value;
|
|
573
567
|
const glibName = record.glibTypeName ?? record.cType ?? record.name;
|
|
574
568
|
const { size } = computeRecordFieldSlots(context, record.fields, record.isUnion);
|
|
@@ -577,8 +571,8 @@ const boxedRecordExpression = (options: {
|
|
|
577
571
|
ownership,
|
|
578
572
|
sharedLibrary: resolved.namespace.sharedLibrary,
|
|
579
573
|
getTypeFnName: typeFnName,
|
|
580
|
-
|
|
581
|
-
|
|
574
|
+
isCallerAllocated,
|
|
575
|
+
isInline,
|
|
582
576
|
size: size > 0 ? size : undefined,
|
|
583
577
|
});
|
|
584
578
|
};
|
|
@@ -592,8 +586,8 @@ const plainRecordExpression = (
|
|
|
592
586
|
const record = resolved.value;
|
|
593
587
|
|
|
594
588
|
const layout = {
|
|
595
|
-
|
|
596
|
-
|
|
589
|
+
isCallerAllocated: placement.isCallerAllocated ?? false,
|
|
590
|
+
isInline: placement.isInline ?? false,
|
|
597
591
|
};
|
|
598
592
|
|
|
599
593
|
if (record.glibGetType === undefined) {
|
|
@@ -623,7 +617,7 @@ const recordExpression = (
|
|
|
623
617
|
unrefFunc,
|
|
624
618
|
ownership,
|
|
625
619
|
wrapperClass,
|
|
626
|
-
|
|
620
|
+
isInline: placement.isInline ?? false,
|
|
627
621
|
});
|
|
628
622
|
}
|
|
629
623
|
|
|
@@ -660,7 +654,7 @@ const expressionForResolved = (
|
|
|
660
654
|
}
|
|
661
655
|
case "record": {
|
|
662
656
|
return recordExpression(context, resolved, ownership, {
|
|
663
|
-
isCallerAllocated: options.
|
|
657
|
+
isCallerAllocated: options.isCallerAllocated ?? false,
|
|
664
658
|
isInline: options.isInline ?? false,
|
|
665
659
|
});
|
|
666
660
|
}
|
|
@@ -684,8 +678,9 @@ const arrayExpression = (
|
|
|
684
678
|
}
|
|
685
679
|
|
|
686
680
|
const ownership = transferOwnership(transfer);
|
|
687
|
-
const
|
|
688
|
-
const
|
|
681
|
+
const elementOptions: ArgIndexOptions = { ...options, hasOutIndirection: false };
|
|
682
|
+
const element = renderDescriptor(context, ref.element, deriveElementTransfer(transfer), elementOptions);
|
|
683
|
+
const size = inlineElementSize(context, ref, options.hasOutIndirection);
|
|
689
684
|
|
|
690
685
|
if (ref.lengthParameterIndex !== undefined) {
|
|
691
686
|
return tSizedArray(element, mapArgIndex(options, ref.lengthParameterIndex), ownership, size);
|
|
@@ -708,20 +703,18 @@ const recordInlineSize = (context: ModuleContext, record: ResolvedRecord): numbe
|
|
|
708
703
|
return size > 0 ? size : undefined;
|
|
709
704
|
};
|
|
710
705
|
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
if (element === undefined) {
|
|
717
|
-
return undefined;
|
|
718
|
-
}
|
|
706
|
+
const elementPointerDepth = (elementCType: string | undefined, hasOutIndirection: boolean): number => {
|
|
707
|
+
const declared = elementCType === undefined ? 0 : elementCType.split("*").length - 1;
|
|
708
|
+
|
|
709
|
+
return hasOutIndirection ? declared - 1 : declared;
|
|
710
|
+
};
|
|
719
711
|
|
|
720
|
-
|
|
712
|
+
const inlineElementSize = (context: ModuleContext, ref: CArrayType, hasOutIndirection: boolean): number | undefined => {
|
|
713
|
+
if (elementPointerDepth(ref.elementCType, hasOutIndirection) > 0) {
|
|
721
714
|
return undefined;
|
|
722
715
|
}
|
|
723
716
|
|
|
724
|
-
const type = context.library.typeFor(element);
|
|
717
|
+
const type = context.library.typeFor(ref.element);
|
|
725
718
|
|
|
726
719
|
if (type?.kind !== "record") {
|
|
727
720
|
return undefined;
|
|
@@ -749,6 +742,7 @@ export {
|
|
|
749
742
|
renderDescriptor,
|
|
750
743
|
isScalarRef,
|
|
751
744
|
isCellInout,
|
|
745
|
+
recordInlineSize,
|
|
752
746
|
renderParamDescriptor,
|
|
753
747
|
renderCallbackType,
|
|
754
748
|
renderSelfDescriptor,
|