@gtkx/codegen 0.21.0 → 1.0.0-rc.2
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 +173 -0
- package/dist/analysis/descriptor-render.d.ts +25 -0
- package/dist/analysis/descriptor-render.d.ts.map +1 -0
- package/dist/analysis/descriptor-render.js +420 -0
- package/dist/analysis/descriptor-render.js.map +1 -0
- package/dist/analysis/descriptor.d.ts +62 -0
- package/dist/analysis/descriptor.d.ts.map +1 -0
- package/dist/analysis/descriptor.js +127 -0
- package/dist/analysis/descriptor.js.map +1 -0
- package/dist/analysis/inheritance.d.ts +38 -0
- package/dist/analysis/inheritance.d.ts.map +1 -0
- package/dist/analysis/inheritance.js +248 -0
- package/dist/analysis/inheritance.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +27 -0
- package/dist/analysis/param-structure.d.ts.map +1 -0
- package/dist/analysis/param-structure.js +158 -0
- package/dist/analysis/param-structure.js.map +1 -0
- package/dist/analysis/ts-type.d.ts +20 -0
- package/dist/analysis/ts-type.d.ts.map +1 -0
- package/dist/analysis/ts-type.js +111 -0
- package/dist/analysis/ts-type.js.map +1 -0
- package/dist/compile.d.ts +18 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +130 -0
- package/dist/compile.js.map +1 -0
- package/dist/docs/api-reference.d.ts +67 -0
- package/dist/docs/api-reference.d.ts.map +1 -0
- package/dist/docs/api-reference.js +372 -0
- package/dist/docs/api-reference.js.map +1 -0
- package/dist/docs/element-page.d.ts +12 -0
- package/dist/docs/element-page.d.ts.map +1 -0
- package/dist/docs/element-page.js +156 -0
- package/dist/docs/element-page.js.map +1 -0
- package/dist/docs/pipeline.d.ts +26 -0
- package/dist/docs/pipeline.d.ts.map +1 -0
- package/dist/docs/pipeline.js +156 -0
- package/dist/docs/pipeline.js.map +1 -0
- package/dist/docs/render.d.ts +34 -0
- package/dist/docs/render.d.ts.map +1 -0
- package/dist/docs/render.js +143 -0
- package/dist/docs/render.js.map +1 -0
- package/dist/docs/symbol-page.d.ts +41 -0
- package/dist/docs/symbol-page.d.ts.map +1 -0
- package/dist/docs/symbol-page.js +380 -0
- package/dist/docs/symbol-page.js.map +1 -0
- package/dist/fingerprint.d.ts +31 -28
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +84 -19
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +13 -0
- package/dist/gi.d.ts.map +1 -0
- package/dist/gi.js +21 -0
- package/dist/gi.js.map +1 -0
- package/dist/gir/ancestry.d.ts +10 -0
- package/dist/gir/ancestry.d.ts.map +1 -0
- package/dist/gir/ancestry.js +26 -0
- package/dist/gir/ancestry.js.map +1 -0
- package/dist/gir/callback.d.ts +8 -14
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +16 -16
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +25 -44
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +16 -26
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +16 -34
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +10 -16
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +16 -24
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +35 -18
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -43
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +26 -23
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +3 -0
- package/dist/gir/gir-path.d.ts.map +1 -0
- package/dist/gir/gir-path.js +57 -0
- package/dist/gir/gir-path.js.map +1 -0
- package/dist/gir/libraries.d.ts +5 -0
- package/dist/gir/libraries.d.ts.map +1 -0
- package/dist/gir/libraries.js +74 -0
- package/dist/gir/libraries.js.map +1 -0
- package/dist/gir/library.d.ts +43 -0
- package/dist/gir/library.d.ts.map +1 -0
- package/dist/gir/library.js +242 -0
- package/dist/gir/library.js.map +1 -0
- package/dist/gir/namespace.d.ts +40 -54
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +51 -40
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/nullable-overrides.d.ts +3 -0
- package/dist/gir/nullable-overrides.d.ts.map +1 -0
- package/dist/gir/nullable-overrides.js +5 -0
- package/dist/gir/nullable-overrides.js.map +1 -0
- package/dist/gir/parameter.d.ts +34 -76
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +47 -59
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +12 -77
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +65 -103
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +5 -35
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js +21 -36
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +18 -26
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +16 -12
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +28 -0
- package/dist/gir/record.d.ts.map +1 -0
- package/dist/gir/record.js +26 -0
- package/dist/gir/record.js.map +1 -0
- package/dist/gir/size.d.ts +15 -61
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +49 -72
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +51 -0
- package/dist/gir/type-id.d.ts.map +1 -0
- package/dist/gir/type-id.js +12 -0
- package/dist/gir/type-id.js.map +1 -0
- package/dist/gir/type-ref.d.ts +4 -77
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +58 -77
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +34 -0
- package/dist/gir/type.d.ts.map +1 -0
- package/dist/gir/type.js +2 -0
- package/dist/gir/type.js.map +1 -0
- package/dist/index.d.ts +7 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -11
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +26 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +40 -0
- package/dist/jsx.js.map +1 -0
- package/dist/khronos/args.d.ts +30 -0
- package/dist/khronos/args.d.ts.map +1 -0
- package/dist/khronos/args.js +171 -0
- package/dist/khronos/args.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +21 -0
- package/dist/khronos/jsdoc.d.ts.map +1 -0
- package/dist/khronos/jsdoc.js +72 -0
- package/dist/khronos/jsdoc.js.map +1 -0
- package/dist/khronos/model.d.ts +38 -0
- package/dist/khronos/model.d.ts.map +1 -0
- package/dist/khronos/model.js +167 -0
- package/dist/khronos/model.js.map +1 -0
- package/dist/khronos/modules.d.ts +12 -0
- package/dist/khronos/modules.d.ts.map +1 -0
- package/dist/khronos/modules.js +73 -0
- package/dist/khronos/modules.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +11 -0
- package/dist/khronos/param-pair.d.ts.map +1 -0
- package/dist/khronos/param-pair.js +6 -0
- package/dist/khronos/param-pair.js.map +1 -0
- package/dist/khronos/parse.d.ts +8 -0
- package/dist/khronos/parse.d.ts.map +1 -0
- package/dist/khronos/parse.js +62 -0
- package/dist/khronos/parse.js.map +1 -0
- package/dist/khronos/pipeline.d.ts +24 -0
- package/dist/khronos/pipeline.d.ts.map +1 -0
- package/dist/khronos/pipeline.js +223 -0
- package/dist/khronos/pipeline.js.map +1 -0
- package/dist/khronos/plan.d.ts +81 -0
- package/dist/khronos/plan.d.ts.map +1 -0
- package/dist/khronos/plan.js +200 -0
- package/dist/khronos/plan.js.map +1 -0
- package/dist/khronos/render.d.ts +17 -0
- package/dist/khronos/render.d.ts.map +1 -0
- package/dist/khronos/render.js +205 -0
- package/dist/khronos/render.js.map +1 -0
- package/dist/khronos/select.d.ts +15 -0
- package/dist/khronos/select.d.ts.map +1 -0
- package/dist/khronos/select.js +56 -0
- package/dist/khronos/select.js.map +1 -0
- package/dist/react/element-config.d.ts +17 -0
- package/dist/react/element-config.d.ts.map +1 -0
- package/dist/react/element-config.js +61 -0
- package/dist/react/element-config.js.map +1 -0
- package/dist/runner.d.ts +38 -49
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +81 -54
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +11 -0
- package/dist/store/compile-store.d.ts.map +1 -0
- package/dist/store/compile-store.js +40 -0
- package/dist/store/compile-store.js.map +1 -0
- package/dist/store/gi/async.d.ts +5 -0
- package/dist/store/gi/async.d.ts.map +1 -0
- package/dist/store/gi/async.js +45 -0
- package/dist/store/gi/async.js.map +1 -0
- package/dist/store/gi/callables.d.ts +42 -0
- package/dist/store/gi/callables.d.ts.map +1 -0
- package/dist/store/gi/callables.js +264 -0
- package/dist/store/gi/callables.js.map +1 -0
- package/dist/store/gi/callback.d.ts +5 -0
- package/dist/store/gi/callback.d.ts.map +1 -0
- package/dist/store/gi/callback.js +17 -0
- package/dist/store/gi/callback.js.map +1 -0
- package/dist/store/gi/class-struct-record.d.ts +10 -0
- package/dist/store/gi/class-struct-record.d.ts.map +1 -0
- package/dist/store/gi/class-struct-record.js +52 -0
- package/dist/store/gi/class-struct-record.js.map +1 -0
- package/dist/store/gi/class.d.ts +5 -0
- package/dist/store/gi/class.d.ts.map +1 -0
- package/dist/store/gi/class.js +208 -0
- package/dist/store/gi/class.js.map +1 -0
- package/dist/store/gi/companion.d.ts +5 -0
- package/dist/store/gi/companion.d.ts.map +1 -0
- package/dist/store/gi/companion.js +16 -0
- package/dist/store/gi/companion.js.map +1 -0
- package/dist/store/gi/constant.d.ts +6 -0
- package/dist/store/gi/constant.d.ts.map +1 -0
- package/dist/store/gi/constant.js +35 -0
- package/dist/store/gi/constant.js.map +1 -0
- package/dist/store/gi/constructor-props.d.ts +6 -0
- package/dist/store/gi/constructor-props.d.ts.map +1 -0
- package/dist/store/gi/constructor-props.js +71 -0
- package/dist/store/gi/constructor-props.js.map +1 -0
- package/dist/store/gi/enum.d.ts +6 -0
- package/dist/store/gi/enum.d.ts.map +1 -0
- package/dist/store/gi/enum.js +41 -0
- package/dist/store/gi/enum.js.map +1 -0
- package/dist/store/gi/function.d.ts +9 -0
- package/dist/store/gi/function.d.ts.map +1 -0
- package/dist/store/gi/function.js +114 -0
- package/dist/store/gi/function.js.map +1 -0
- package/dist/store/gi/gtype-binding.d.ts +10 -0
- package/dist/store/gi/gtype-binding.d.ts.map +1 -0
- package/dist/store/gi/gtype-binding.js +24 -0
- package/dist/store/gi/gtype-binding.js.map +1 -0
- package/dist/store/gi/interface.d.ts +5 -0
- package/dist/store/gi/interface.d.ts.map +1 -0
- package/dist/store/gi/interface.js +117 -0
- package/dist/store/gi/interface.js.map +1 -0
- package/dist/store/gi/item-comparators.d.ts +7 -0
- package/dist/store/gi/item-comparators.d.ts.map +1 -0
- package/dist/store/gi/item-comparators.js +88 -0
- package/dist/store/gi/item-comparators.js.map +1 -0
- package/dist/store/gi/method.d.ts +24 -0
- package/dist/store/gi/method.d.ts.map +1 -0
- package/dist/store/gi/method.js +336 -0
- package/dist/store/gi/method.js.map +1 -0
- package/dist/store/gi/param-marshal.d.ts +10 -0
- package/dist/store/gi/param-marshal.d.ts.map +1 -0
- package/dist/store/gi/param-marshal.js +50 -0
- package/dist/store/gi/param-marshal.js.map +1 -0
- package/dist/store/gi/pipeline.d.ts +5 -0
- package/dist/store/gi/pipeline.d.ts.map +1 -0
- package/dist/store/gi/pipeline.js +95 -0
- package/dist/store/gi/pipeline.js.map +1 -0
- package/dist/store/gi/properties.d.ts +6 -0
- package/dist/store/gi/properties.d.ts.map +1 -0
- package/dist/store/gi/properties.js +32 -0
- package/dist/store/gi/properties.js.map +1 -0
- package/dist/store/gi/property-accessor.d.ts +27 -0
- package/dist/store/gi/property-accessor.d.ts.map +1 -0
- package/dist/store/gi/property-accessor.js +158 -0
- package/dist/store/gi/property-accessor.js.map +1 -0
- package/dist/store/gi/record-constructor.d.ts +6 -0
- package/dist/store/gi/record-constructor.d.ts.map +1 -0
- package/dist/store/gi/record-constructor.js +76 -0
- package/dist/store/gi/record-constructor.js.map +1 -0
- package/dist/store/gi/record-field-accessor.d.ts +25 -0
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -0
- package/dist/store/gi/record-field-accessor.js +360 -0
- package/dist/store/gi/record-field-accessor.js.map +1 -0
- package/dist/store/gi/record-layout.d.ts +15 -0
- package/dist/store/gi/record-layout.d.ts.map +1 -0
- package/dist/store/gi/record-layout.js +132 -0
- package/dist/store/gi/record-layout.js.map +1 -0
- package/dist/store/gi/record.d.ts +5 -0
- package/dist/store/gi/record.d.ts.map +1 -0
- package/dist/store/gi/record.js +65 -0
- package/dist/store/gi/record.js.map +1 -0
- package/dist/store/gi/registration.d.ts +16 -0
- package/dist/store/gi/registration.d.ts.map +1 -0
- package/dist/store/gi/registration.js +21 -0
- package/dist/store/gi/registration.js.map +1 -0
- package/dist/store/gi/return-wrap.d.ts +10 -0
- package/dist/store/gi/return-wrap.d.ts.map +1 -0
- package/dist/store/gi/return-wrap.js +67 -0
- package/dist/store/gi/return-wrap.js.map +1 -0
- package/dist/store/gi/runtime-override.d.ts +4 -0
- package/dist/store/gi/runtime-override.d.ts.map +1 -0
- package/dist/store/gi/runtime-override.js +32 -0
- package/dist/store/gi/runtime-override.js.map +1 -0
- package/dist/store/gi/signal.d.ts +6 -0
- package/dist/store/gi/signal.d.ts.map +1 -0
- package/dist/store/gi/signal.js +280 -0
- package/dist/store/gi/signal.js.map +1 -0
- package/dist/store/gi/vtable.d.ts +5 -0
- package/dist/store/gi/vtable.d.ts.map +1 -0
- package/dist/store/gi/vtable.js +108 -0
- package/dist/store/gi/vtable.js.map +1 -0
- package/dist/store/gi-store.d.ts +10 -0
- package/dist/store/gi-store.d.ts.map +1 -0
- package/dist/store/gi-store.js +59 -0
- package/dist/store/gi-store.js.map +1 -0
- package/dist/store/jsx/element-components.d.ts +23 -0
- package/dist/store/jsx/element-components.d.ts.map +1 -0
- package/dist/store/jsx/element-components.js +86 -0
- package/dist/store/jsx/element-components.js.map +1 -0
- package/dist/store/jsx/element-prop-imports.d.ts +17 -0
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-imports.js +15 -0
- package/dist/store/jsx/element-prop-imports.js.map +1 -0
- package/dist/store/jsx/element-prop-types.d.ts +10 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-types.js +41 -0
- package/dist/store/jsx/element-prop-types.js.map +1 -0
- package/dist/store/jsx/gir-index.d.ts +16 -0
- package/dist/store/jsx/gir-index.d.ts.map +1 -0
- package/dist/store/jsx/gir-index.js +33 -0
- package/dist/store/jsx/gir-index.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +27 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
- package/dist/store/jsx/intrinsic-elements.js +128 -0
- package/dist/store/jsx/intrinsic-elements.js.map +1 -0
- package/dist/store/jsx/jsx.d.ts +16 -0
- package/dist/store/jsx/jsx.d.ts.map +1 -0
- package/dist/store/jsx/jsx.js +242 -0
- package/dist/store/jsx/jsx.js.map +1 -0
- package/dist/store/jsx/metadata.d.ts +4 -0
- package/dist/store/jsx/metadata.d.ts.map +1 -0
- package/dist/store/jsx/metadata.js +253 -0
- package/dist/store/jsx/metadata.js.map +1 -0
- package/dist/store/jsx/pipeline.d.ts +21 -0
- package/dist/store/jsx/pipeline.d.ts.map +1 -0
- package/dist/store/jsx/pipeline.js +81 -0
- package/dist/store/jsx/pipeline.js.map +1 -0
- package/dist/store/jsx/props.d.ts +33 -0
- package/dist/store/jsx/props.d.ts.map +1 -0
- package/dist/store/jsx/props.js +158 -0
- package/dist/store/jsx/props.js.map +1 -0
- package/dist/store/jsx-store.d.ts +7 -0
- package/dist/store/jsx-store.d.ts.map +1 -0
- package/dist/store/jsx-store.js +26 -0
- package/dist/store/jsx-store.js.map +1 -0
- package/dist/store/store-fs.d.ts +43 -0
- package/dist/store/store-fs.d.ts.map +1 -0
- package/dist/store/store-fs.js +73 -0
- package/dist/store/store-fs.js.map +1 -0
- package/dist/writer/context.d.ts +17 -0
- package/dist/writer/context.d.ts.map +1 -0
- package/dist/writer/context.js +50 -0
- package/dist/writer/context.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -0
- package/dist/writer/doc.d.ts.map +1 -0
- package/dist/writer/doc.js +18 -0
- package/dist/writer/doc.js.map +1 -0
- package/dist/writer/emit.d.ts +9 -0
- package/dist/writer/emit.d.ts.map +1 -0
- package/dist/writer/emit.js +24 -0
- package/dist/writer/emit.js.map +1 -0
- package/dist/writer/gtk-doc.d.ts +3 -0
- package/dist/writer/gtk-doc.d.ts.map +1 -0
- package/dist/writer/gtk-doc.js +78 -0
- package/dist/writer/gtk-doc.js.map +1 -0
- package/dist/writer/imports.d.ts +12 -0
- package/dist/writer/imports.d.ts.map +1 -0
- package/dist/writer/imports.js +61 -0
- package/dist/writer/imports.js.map +1 -0
- package/dist/writer/module.d.ts +16 -0
- package/dist/writer/module.d.ts.map +1 -0
- package/dist/writer/module.js +53 -0
- package/dist/writer/module.js.map +1 -0
- package/dist/xml.d.ts +4 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +10 -0
- package/dist/xml.js.map +1 -0
- package/overrides/cairo/context.ts.ejs +1269 -0
- package/overrides/cairo/font-face.ts.ejs +151 -0
- package/overrides/cairo/font-options.ts.ejs +199 -0
- package/overrides/cairo/image-surface.ts.ejs +132 -0
- package/overrides/cairo/index.ts.ejs +22 -0
- package/overrides/cairo/matrix.ts.ejs +171 -0
- package/overrides/cairo/pattern.ts.ejs +476 -0
- package/overrides/cairo/recording-surface.ts.ejs +102 -0
- package/overrides/cairo/region.ts.ejs +237 -0
- package/overrides/cairo/scaled-font.ts.ejs +330 -0
- package/overrides/cairo/surface.ts.ejs +296 -0
- package/overrides/gdk/index.ts.ejs +2 -0
- package/overrides/gdk/rgba.ts.ejs +11 -0
- package/overrides/gobject/index.ts.ejs +29 -0
- package/overrides/gobject/object.ts.ejs +51 -0
- package/overrides/gobject/value.ts.ejs +17 -0
- package/overrides/graphene/index.ts.ejs +2 -0
- package/overrides/graphene/structs.ts.ejs +37 -0
- package/package.json +21 -15
- package/src/analysis/descriptor-render.ts +723 -0
- package/src/analysis/descriptor.ts +300 -0
- package/src/analysis/inheritance.ts +430 -0
- package/src/analysis/param-structure.ts +258 -0
- package/src/analysis/ts-type.ts +174 -0
- package/src/compile.ts +179 -0
- package/src/docs/api-reference.ts +557 -0
- package/src/docs/element-page.ts +281 -0
- package/src/docs/pipeline.ts +241 -0
- package/src/docs/render.ts +255 -0
- package/src/docs/symbol-page.ts +589 -0
- package/src/fingerprint.ts +144 -35
- package/src/gi.ts +26 -0
- package/src/gir/ancestry.ts +53 -0
- package/src/gir/callback.ts +22 -24
- package/src/gir/class.ts +39 -61
- package/src/gir/enum.ts +25 -41
- package/src/gir/field.ts +51 -37
- package/src/gir/function.ts +44 -59
- package/src/gir/gir-path.ts +73 -0
- package/src/gir/libraries.ts +102 -0
- package/src/gir/library.ts +351 -0
- package/src/gir/namespace.ts +109 -88
- package/src/gir/nullable-overrides.ts +5 -0
- package/src/gir/parameter.ts +111 -102
- package/src/gir/parse.ts +124 -121
- package/src/gir/primitives.ts +43 -63
- package/src/gir/property.ts +33 -33
- package/src/gir/record.ts +55 -0
- package/src/gir/size.ts +93 -107
- package/src/gir/type-id.ts +64 -0
- package/src/gir/type-ref.ts +77 -146
- package/src/gir/type.ts +18 -0
- package/src/index.ts +27 -15
- package/src/jsx.ts +70 -0
- package/src/khronos/args.ts +271 -0
- package/src/khronos/jsdoc.ts +114 -0
- package/src/khronos/model.ts +267 -0
- package/src/khronos/modules.ts +115 -0
- package/src/khronos/param-pair.ts +14 -0
- package/src/khronos/parse.ts +86 -0
- package/src/khronos/pipeline.ts +337 -0
- package/src/khronos/plan.ts +340 -0
- package/src/khronos/registry/LICENSE +202 -0
- package/src/khronos/registry/gl.xml +47748 -0
- package/src/khronos/render.ts +330 -0
- package/src/khronos/select.ts +97 -0
- package/src/react/element-config.ts +91 -0
- package/src/runner.ts +153 -80
- package/src/store/compile-store.ts +55 -0
- package/src/store/gi/async.ts +69 -0
- package/src/store/gi/callables.ts +518 -0
- package/src/store/gi/callback.ts +24 -0
- package/src/store/gi/class-struct-record.ts +72 -0
- package/src/store/gi/class.ts +334 -0
- package/src/store/gi/companion.ts +22 -0
- package/src/store/gi/constant.ts +58 -0
- package/src/store/gi/constructor-props.ts +108 -0
- package/src/store/gi/enum.ts +64 -0
- package/src/store/gi/function.ts +173 -0
- package/src/store/gi/gtype-binding.ts +46 -0
- package/src/store/gi/interface.ts +222 -0
- package/src/store/gi/item-comparators.ts +138 -0
- package/src/store/gi/method.ts +634 -0
- package/src/store/gi/param-marshal.ts +71 -0
- package/src/store/gi/pipeline.ts +135 -0
- package/src/store/gi/properties.ts +50 -0
- package/src/store/gi/property-accessor.ts +302 -0
- package/src/store/gi/record-constructor.ts +119 -0
- package/src/store/gi/record-field-accessor.ts +607 -0
- package/src/store/gi/record-layout.ts +221 -0
- package/src/store/gi/record.ts +89 -0
- package/src/store/gi/registration.ts +44 -0
- package/src/store/gi/return-wrap.ts +100 -0
- package/src/store/gi/runtime-override.ts +46 -0
- package/src/store/gi/signal.ts +450 -0
- package/src/store/gi/vtable.ts +175 -0
- package/src/store/gi-store.ts +92 -0
- package/src/store/jsx/element-components.ts +152 -0
- package/src/store/jsx/element-prop-imports.ts +24 -0
- package/src/store/jsx/element-prop-types.ts +59 -0
- package/src/store/jsx/gir-index.ts +62 -0
- package/src/store/jsx/intrinsic-elements.ts +262 -0
- package/src/store/jsx/jsx.ts +408 -0
- package/src/store/jsx/metadata.ts +385 -0
- package/src/store/jsx/pipeline.ts +145 -0
- package/src/store/jsx/props.ts +274 -0
- package/src/store/jsx-store.ts +39 -0
- package/src/store/store-fs.ts +128 -0
- package/src/writer/context.ts +67 -0
- package/src/writer/doc.ts +25 -0
- package/src/writer/emit.ts +35 -0
- package/src/writer/gtk-doc.ts +101 -0
- package/src/writer/imports.ts +94 -0
- package/src/writer/module.ts +69 -0
- package/src/xml.ts +12 -0
- package/LICENSE +0 -373
- package/dist/dsl/context.d.ts +0 -104
- package/dist/dsl/context.d.ts.map +0 -1
- package/dist/dsl/context.js +0 -140
- package/dist/dsl/context.js.map +0 -1
- package/dist/dsl/emit.d.ts +0 -28
- package/dist/dsl/emit.d.ts.map +0 -1
- package/dist/dsl/emit.js +0 -41
- package/dist/dsl/emit.js.map +0 -1
- package/dist/dsl/identifier.d.ts +0 -28
- package/dist/dsl/identifier.d.ts.map +0 -1
- package/dist/dsl/identifier.js +0 -45
- package/dist/dsl/identifier.js.map +0 -1
- package/dist/dsl/imports.d.ts +0 -58
- package/dist/dsl/imports.d.ts.map +0 -1
- package/dist/dsl/imports.js +0 -107
- package/dist/dsl/imports.js.map +0 -1
- package/dist/dsl/module.d.ts +0 -53
- package/dist/dsl/module.d.ts.map +0 -1
- package/dist/dsl/module.js +0 -76
- package/dist/dsl/module.js.map +0 -1
- package/dist/ffi/pipeline.d.ts +0 -19
- package/dist/ffi/pipeline.d.ts.map +0 -1
- package/dist/ffi/pipeline.js +0 -107
- package/dist/ffi/pipeline.js.map +0 -1
- package/dist/gi-store.d.ts +0 -34
- package/dist/gi-store.d.ts.map +0 -1
- package/dist/gi-store.js +0 -154
- package/dist/gi-store.js.map +0 -1
- package/dist/gir/boxed.d.ts +0 -66
- package/dist/gir/boxed.d.ts.map +0 -1
- package/dist/gir/boxed.js +0 -49
- package/dist/gir/boxed.js.map +0 -1
- package/dist/gir/qualified-name.d.ts +0 -37
- package/dist/gir/qualified-name.d.ts.map +0 -1
- package/dist/gir/qualified-name.js +0 -39
- package/dist/gir/qualified-name.js.map +0 -1
- package/dist/gir/qualify.d.ts +0 -32
- package/dist/gir/qualify.d.ts.map +0 -1
- package/dist/gir/qualify.js +0 -60
- package/dist/gir/qualify.js.map +0 -1
- package/dist/gir/repository.d.ts +0 -82
- package/dist/gir/repository.d.ts.map +0 -1
- package/dist/gir/repository.js +0 -122
- package/dist/gir/repository.js.map +0 -1
- package/dist/gir/signal.d.ts +0 -22
- package/dist/gir/signal.d.ts.map +0 -1
- package/dist/gir/signal.js +0 -20
- package/dist/gir/signal.js.map +0 -1
- package/dist/jsx-store.d.ts +0 -22
- package/dist/jsx-store.d.ts.map +0 -1
- package/dist/jsx-store.js +0 -40
- package/dist/jsx-store.js.map +0 -1
- package/dist/react/compounds-meta.d.ts +0 -18
- package/dist/react/compounds-meta.d.ts.map +0 -1
- package/dist/react/compounds-meta.js +0 -93
- package/dist/react/compounds-meta.js.map +0 -1
- package/dist/react/compounds.d.ts +0 -27
- package/dist/react/compounds.d.ts.map +0 -1
- package/dist/react/compounds.js +0 -164
- package/dist/react/compounds.js.map +0 -1
- package/dist/react/internal.d.ts +0 -14
- package/dist/react/internal.d.ts.map +0 -1
- package/dist/react/internal.js +0 -79
- package/dist/react/internal.js.map +0 -1
- package/dist/react/jsx.d.ts +0 -22
- package/dist/react/jsx.d.ts.map +0 -1
- package/dist/react/jsx.js +0 -134
- package/dist/react/jsx.js.map +0 -1
- package/dist/react/pipeline.d.ts +0 -13
- package/dist/react/pipeline.d.ts.map +0 -1
- package/dist/react/pipeline.js +0 -25
- package/dist/react/pipeline.js.map +0 -1
- package/dist/react/props.d.ts +0 -38
- package/dist/react/props.d.ts.map +0 -1
- package/dist/react/props.js +0 -231
- package/dist/react/props.js.map +0 -1
- package/dist/react/slot-props.d.ts +0 -10
- package/dist/react/slot-props.d.ts.map +0 -1
- package/dist/react/slot-props.js +0 -56
- package/dist/react/slot-props.js.map +0 -1
- package/dist/react/widgets.d.ts +0 -83
- package/dist/react/widgets.d.ts.map +0 -1
- package/dist/react/widgets.js +0 -152
- package/dist/react/widgets.js.map +0 -1
- package/dist/store-fs.d.ts +0 -109
- package/dist/store-fs.d.ts.map +0 -1
- package/dist/store-fs.js +0 -98
- package/dist/store-fs.js.map +0 -1
- package/dist/transpile.d.ts +0 -32
- package/dist/transpile.d.ts.map +0 -1
- package/dist/transpile.js +0 -63
- package/dist/transpile.js.map +0 -1
- package/dist/typecheck-store.d.ts +0 -41
- package/dist/typecheck-store.d.ts.map +0 -1
- package/dist/typecheck-store.js +0 -102
- package/dist/typecheck-store.js.map +0 -1
- package/dist/writers/alias.d.ts +0 -13
- package/dist/writers/alias.d.ts.map +0 -1
- package/dist/writers/alias.js +0 -17
- package/dist/writers/alias.js.map +0 -1
- package/dist/writers/async.d.ts +0 -22
- package/dist/writers/async.d.ts.map +0 -1
- package/dist/writers/async.js +0 -48
- package/dist/writers/async.js.map +0 -1
- package/dist/writers/boxed-constructor.d.ts +0 -26
- package/dist/writers/boxed-constructor.d.ts.map +0 -1
- package/dist/writers/boxed-constructor.js +0 -85
- package/dist/writers/boxed-constructor.js.map +0 -1
- package/dist/writers/boxed-field-accessor.d.ts +0 -18
- package/dist/writers/boxed-field-accessor.d.ts.map +0 -1
- package/dist/writers/boxed-field-accessor.js +0 -260
- package/dist/writers/boxed-field-accessor.js.map +0 -1
- package/dist/writers/boxed-layout.d.ts +0 -27
- package/dist/writers/boxed-layout.d.ts.map +0 -1
- package/dist/writers/boxed-layout.js +0 -128
- package/dist/writers/boxed-layout.js.map +0 -1
- package/dist/writers/boxed.d.ts +0 -20
- package/dist/writers/boxed.d.ts.map +0 -1
- package/dist/writers/boxed.js +0 -71
- package/dist/writers/boxed.js.map +0 -1
- package/dist/writers/callables.d.ts +0 -124
- package/dist/writers/callables.d.ts.map +0 -1
- package/dist/writers/callables.js +0 -283
- package/dist/writers/callables.js.map +0 -1
- package/dist/writers/callback.d.ts +0 -16
- package/dist/writers/callback.d.ts.map +0 -1
- package/dist/writers/callback.js +0 -38
- package/dist/writers/callback.js.map +0 -1
- package/dist/writers/class-struct-record.d.ts +0 -31
- package/dist/writers/class-struct-record.d.ts.map +0 -1
- package/dist/writers/class-struct-record.js +0 -67
- package/dist/writers/class-struct-record.js.map +0 -1
- package/dist/writers/class-struct.d.ts +0 -22
- package/dist/writers/class-struct.d.ts.map +0 -1
- package/dist/writers/class-struct.js +0 -85
- package/dist/writers/class-struct.js.map +0 -1
- package/dist/writers/class.d.ts +0 -16
- package/dist/writers/class.d.ts.map +0 -1
- package/dist/writers/class.js +0 -307
- package/dist/writers/class.js.map +0 -1
- package/dist/writers/constant.d.ts +0 -15
- package/dist/writers/constant.d.ts.map +0 -1
- package/dist/writers/constant.js +0 -23
- package/dist/writers/constant.js.map +0 -1
- package/dist/writers/constants.d.ts +0 -15
- package/dist/writers/constants.d.ts.map +0 -1
- package/dist/writers/constants.js +0 -23
- package/dist/writers/constants.js.map +0 -1
- package/dist/writers/constructor-props.d.ts +0 -32
- package/dist/writers/constructor-props.d.ts.map +0 -1
- package/dist/writers/constructor-props.js +0 -110
- package/dist/writers/constructor-props.js.map +0 -1
- package/dist/writers/enum.d.ts +0 -21
- package/dist/writers/enum.d.ts.map +0 -1
- package/dist/writers/enum.js +0 -48
- package/dist/writers/enum.js.map +0 -1
- package/dist/writers/function.d.ts +0 -40
- package/dist/writers/function.d.ts.map +0 -1
- package/dist/writers/function.js +0 -127
- package/dist/writers/function.js.map +0 -1
- package/dist/writers/gtype-binding.d.ts +0 -19
- package/dist/writers/gtype-binding.d.ts.map +0 -1
- package/dist/writers/gtype-binding.js +0 -40
- package/dist/writers/gtype-binding.js.map +0 -1
- package/dist/writers/inheritance.d.ts +0 -48
- package/dist/writers/inheritance.d.ts.map +0 -1
- package/dist/writers/inheritance.js +0 -90
- package/dist/writers/inheritance.js.map +0 -1
- package/dist/writers/interface.d.ts +0 -16
- package/dist/writers/interface.d.ts.map +0 -1
- package/dist/writers/interface.js +0 -155
- package/dist/writers/interface.js.map +0 -1
- package/dist/writers/method.d.ts +0 -150
- package/dist/writers/method.d.ts.map +0 -1
- package/dist/writers/method.js +0 -510
- package/dist/writers/method.js.map +0 -1
- package/dist/writers/param-classify.d.ts +0 -93
- package/dist/writers/param-classify.d.ts.map +0 -1
- package/dist/writers/param-classify.js +0 -163
- package/dist/writers/param-classify.js.map +0 -1
- package/dist/writers/property-accessor.d.ts +0 -19
- package/dist/writers/property-accessor.d.ts.map +0 -1
- package/dist/writers/property-accessor.js +0 -117
- package/dist/writers/property-accessor.js.map +0 -1
- package/dist/writers/registration.d.ts +0 -27
- package/dist/writers/registration.d.ts.map +0 -1
- package/dist/writers/registration.js +0 -30
- package/dist/writers/registration.js.map +0 -1
- package/dist/writers/return-wrap.d.ts +0 -39
- package/dist/writers/return-wrap.d.ts.map +0 -1
- package/dist/writers/return-wrap.js +0 -152
- package/dist/writers/return-wrap.js.map +0 -1
- package/dist/writers/runtime-override.d.ts +0 -18
- package/dist/writers/runtime-override.d.ts.map +0 -1
- package/dist/writers/runtime-override.js +0 -44
- package/dist/writers/runtime-override.js.map +0 -1
- package/dist/writers/signal.d.ts +0 -21
- package/dist/writers/signal.d.ts.map +0 -1
- package/dist/writers/signal.js +0 -260
- package/dist/writers/signal.js.map +0 -1
- package/dist/writers/ts-type.d.ts +0 -50
- package/dist/writers/ts-type.d.ts.map +0 -1
- package/dist/writers/ts-type.js +0 -75
- package/dist/writers/ts-type.js.map +0 -1
- package/dist/writers/types-ts.d.ts +0 -27
- package/dist/writers/types-ts.d.ts.map +0 -1
- package/dist/writers/types-ts.js +0 -97
- package/dist/writers/types-ts.js.map +0 -1
- package/dist/writers/value.d.ts +0 -89
- package/dist/writers/value.d.ts.map +0 -1
- package/dist/writers/value.js +0 -402
- package/dist/writers/value.js.map +0 -1
- package/src/dsl/context.ts +0 -146
- package/src/dsl/emit.ts +0 -42
- package/src/dsl/identifier.ts +0 -52
- package/src/dsl/imports.ts +0 -109
- package/src/dsl/module.ts +0 -75
- package/src/ffi/pipeline.ts +0 -113
- package/src/gi-store.ts +0 -199
- package/src/gir/boxed.ts +0 -94
- package/src/gir/qualified-name.ts +0 -55
- package/src/gir/qualify.ts +0 -64
- package/src/gir/repository.ts +0 -149
- package/src/gir/signal.ts +0 -36
- package/src/jsx-store.ts +0 -53
- package/src/react/compounds-meta.ts +0 -99
- package/src/react/compounds.ts +0 -204
- package/src/react/internal.ts +0 -91
- package/src/react/jsx.ts +0 -155
- package/src/react/pipeline.ts +0 -29
- package/src/react/props.ts +0 -307
- package/src/react/slot-props.ts +0 -57
- package/src/react/widgets.ts +0 -185
- package/src/store-fs.ts +0 -157
- package/src/transpile.ts +0 -80
- package/src/typecheck-store.ts +0 -136
- package/src/writers/alias.ts +0 -19
- package/src/writers/async.ts +0 -44
- package/src/writers/boxed-constructor.ts +0 -105
- package/src/writers/boxed-field-accessor.ts +0 -306
- package/src/writers/boxed-layout.ts +0 -166
- package/src/writers/boxed.ts +0 -77
- package/src/writers/callables.ts +0 -339
- package/src/writers/callback.ts +0 -40
- package/src/writers/class-struct-record.ts +0 -75
- package/src/writers/class-struct.ts +0 -96
- package/src/writers/class.ts +0 -384
- package/src/writers/constant.ts +0 -29
- package/src/writers/constructor-props.ts +0 -130
- package/src/writers/enum.ts +0 -53
- package/src/writers/function.ts +0 -136
- package/src/writers/gtype-binding.ts +0 -48
- package/src/writers/inheritance.ts +0 -104
- package/src/writers/interface.ts +0 -168
- package/src/writers/method.ts +0 -678
- package/src/writers/param-classify.ts +0 -178
- package/src/writers/property-accessor.ts +0 -139
- package/src/writers/registration.ts +0 -42
- package/src/writers/return-wrap.ts +0 -180
- package/src/writers/runtime-override.ts +0 -59
- package/src/writers/signal.ts +0 -318
- package/src/writers/ts-type.ts +0 -115
- package/src/writers/value.ts +0 -485
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { FINGERPRINT_FILENAME, type GiFingerprint } from "../fingerprint.js";
|
|
5
|
+
import { buildManifest, type StoreOptions, subpathExport, writeStore } from "./store-fs.js";
|
|
6
|
+
|
|
7
|
+
type GiStoreOptions = StoreOptions;
|
|
8
|
+
|
|
9
|
+
type GiNamespaceInput = {
|
|
10
|
+
directory: string;
|
|
11
|
+
rawSource: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type CollectedFile = {
|
|
15
|
+
fileName: string;
|
|
16
|
+
source: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "overrides");
|
|
20
|
+
|
|
21
|
+
const overrideFiles = (directory: string): string[] => {
|
|
22
|
+
const dir = join(OVERRIDES_ROOT, directory);
|
|
23
|
+
|
|
24
|
+
if (!existsSync(dir)) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return readdirSync(dir).filter((name) => name.endsWith(".ejs") && name !== "index.ts.ejs");
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const barrelSource = (directory: string): string => {
|
|
32
|
+
const overrideIndex = join(OVERRIDES_ROOT, directory, "index.ts.ejs");
|
|
33
|
+
|
|
34
|
+
if (!existsSync(overrideIndex)) {
|
|
35
|
+
return `export * from "./${directory}.js";\n`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return readFileSync(overrideIndex, "utf8");
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const collectStoreSources = (
|
|
42
|
+
namespaces: GiNamespaceInput[],
|
|
43
|
+
): { collected: CollectedFile[]; exportsMap: Record<string, unknown> } => {
|
|
44
|
+
const exportsMap: Record<string, unknown> = {};
|
|
45
|
+
const collected: CollectedFile[] = [];
|
|
46
|
+
|
|
47
|
+
for (const { directory, rawSource } of namespaces) {
|
|
48
|
+
collected.push({
|
|
49
|
+
fileName: `${directory}/${directory}.ts`,
|
|
50
|
+
source: rawSource,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
for (const file of overrideFiles(directory)) {
|
|
54
|
+
collected.push({
|
|
55
|
+
fileName: `${directory}/overrides/${file.replace(/\.ejs$/, "")}`,
|
|
56
|
+
source: readFileSync(join(OVERRIDES_ROOT, directory, file), "utf8"),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
collected.push({
|
|
61
|
+
fileName: `${directory}/index.ts`,
|
|
62
|
+
source: barrelSource(directory),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return { collected, exportsMap };
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const writeGiStore = (
|
|
72
|
+
options: GiStoreOptions,
|
|
73
|
+
namespaces: GiNamespaceInput[],
|
|
74
|
+
fingerprint: GiFingerprint,
|
|
75
|
+
): void => {
|
|
76
|
+
const { collected, exportsMap } = collectStoreSources(namespaces);
|
|
77
|
+
|
|
78
|
+
writeStore({
|
|
79
|
+
storeDir: options.storeDir,
|
|
80
|
+
linkDir: options.linkDir,
|
|
81
|
+
files: collected,
|
|
82
|
+
manifest: buildManifest({
|
|
83
|
+
name: "@gtkx/gi",
|
|
84
|
+
version: options.version,
|
|
85
|
+
exports: exportsMap,
|
|
86
|
+
peerDependencies: { "@gtkx/runtime": "*" },
|
|
87
|
+
}),
|
|
88
|
+
rawFiles: [{ relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(fingerprint, null, 2)}\n` }],
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export { writeGiStore, type GiStoreOptions, type GiNamespaceInput };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { sourceStringLiteral } from "@gtkx/utils";
|
|
2
|
+
import type { Library } from "../../gir/library.js";
|
|
3
|
+
import type { GirNamespace } from "../../gir/namespace.js";
|
|
4
|
+
import type { ImportsBuilder } from "../../writer/imports.js";
|
|
5
|
+
import type { LazyElementSpec } from "./element-prop-types.js";
|
|
6
|
+
import { renderJsDoc } from "../../writer/doc.js";
|
|
7
|
+
import { ancestorGlibNames, type GlibNamedClass } from "./intrinsic-elements.js";
|
|
8
|
+
|
|
9
|
+
/** A component that wraps a generated element, keyed by GLib type name (built-in or user-provided). */
|
|
10
|
+
type ElementComponent = { module: string; export: string };
|
|
11
|
+
/** Component wrappers keyed by GLib type name; the framework's built-ins merged with the project's own. */
|
|
12
|
+
type ElementComponentOverrides = Record<string, ElementComponent>;
|
|
13
|
+
|
|
14
|
+
type ExportCollector = {
|
|
15
|
+
imports: ImportsBuilder;
|
|
16
|
+
exportedNames: Set<string>;
|
|
17
|
+
exportLines: string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type CandidateExportOptions = {
|
|
21
|
+
targetNamespace: GirNamespace;
|
|
22
|
+
library: Library;
|
|
23
|
+
virtualNames: Set<string>;
|
|
24
|
+
intrinsicElements: GlibNamedClass[];
|
|
25
|
+
components: Record<string, ElementComponent>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const generateElementComponentsSection = (
|
|
29
|
+
targetNamespace: GirNamespace,
|
|
30
|
+
library: Library,
|
|
31
|
+
options: {
|
|
32
|
+
imports: ImportsBuilder;
|
|
33
|
+
lazyElements: LazyElementSpec[];
|
|
34
|
+
intrinsicElements: GlibNamedClass[];
|
|
35
|
+
components: ElementComponentOverrides;
|
|
36
|
+
},
|
|
37
|
+
): { source: string; exportedNames: Set<string> } => {
|
|
38
|
+
const collector: ExportCollector = { imports: options.imports, exportedNames: new Set(), exportLines: [] };
|
|
39
|
+
const lazyElements = options.lazyElements;
|
|
40
|
+
const virtualNames = new Set(lazyElements.map((entry) => entry.element));
|
|
41
|
+
|
|
42
|
+
collectCandidateExports(collector, {
|
|
43
|
+
targetNamespace,
|
|
44
|
+
library,
|
|
45
|
+
virtualNames,
|
|
46
|
+
intrinsicElements: options.intrinsicElements,
|
|
47
|
+
components: options.components,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
collectLazyElementExports(collector, lazyElements);
|
|
51
|
+
const source = collector.exportLines.join("\n\n");
|
|
52
|
+
|
|
53
|
+
return { source, exportedNames: collector.exportedNames };
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const appendCandidateExport = (
|
|
57
|
+
collector: ExportCollector,
|
|
58
|
+
candidate: GlibNamedClass,
|
|
59
|
+
options: CandidateExportOptions,
|
|
60
|
+
): void => {
|
|
61
|
+
const { targetNamespace, library, virtualNames, components } = options;
|
|
62
|
+
|
|
63
|
+
if (candidate.namespace.name !== targetNamespace.name) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (virtualNames.has(candidate.glibName)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const line = renderCandidateExport(candidate, library, collector.imports, components);
|
|
72
|
+
collector.exportLines.push(line);
|
|
73
|
+
collector.exportedNames.add(candidate.glibName);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// An abstract GType cannot be instantiated: `g_object_new` on one is a fatal GObject error rather
|
|
77
|
+
// than a NULL return. Its props interface and metadata still have to be emitted, since every
|
|
78
|
+
// concrete subclass extends them, so only the constructible component export is withheld.
|
|
79
|
+
const collectCandidateExports = (collector: ExportCollector, options: CandidateExportOptions): void => {
|
|
80
|
+
for (const candidate of options.intrinsicElements) {
|
|
81
|
+
if (candidate.klass.isAbstract) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
appendCandidateExport(collector, candidate, options);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const collectLazyElementExports = (collector: ExportCollector, lazyElements: LazyElementSpec[]): void => {
|
|
90
|
+
for (const spec of lazyElements) {
|
|
91
|
+
collector.imports.addNamed("@gtkx/react/internal", "createElementComponent", false);
|
|
92
|
+
collector.imports.addNamed("react", "ReactNode", true);
|
|
93
|
+
collector.exportLines.push(renderLazyElementExport(spec));
|
|
94
|
+
collector.exportedNames.add(spec.element);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const renderLazyElementExport = (spec: LazyElementSpec): string => {
|
|
99
|
+
const factory = `createElementComponent(${sourceStringLiteral(spec.element)})`;
|
|
100
|
+
const component = `export const ${spec.element}: (props: ${spec.typeName}) => ReactNode = ${factory};`;
|
|
101
|
+
|
|
102
|
+
return `${spec.typeSource}\n\n${component}`;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const renderCandidateExport = (
|
|
106
|
+
candidate: GlibNamedClass,
|
|
107
|
+
library: Library,
|
|
108
|
+
imports: ImportsBuilder,
|
|
109
|
+
components: Record<string, ElementComponent>,
|
|
110
|
+
): string => {
|
|
111
|
+
const { glibName, klass, namespace } = candidate;
|
|
112
|
+
const ancestry = ancestorGlibNames(klass, namespace, library);
|
|
113
|
+
const component = resolveElementComponent(ancestry, components);
|
|
114
|
+
imports.addNamed("@gtkx/react/internal", "createElementComponent", false);
|
|
115
|
+
imports.addNamed("react", "ReactNode", true);
|
|
116
|
+
|
|
117
|
+
if (component !== undefined) {
|
|
118
|
+
imports.addNamed(component.module, component.export, false);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return `${renderJsDoc(klass.doc)}${renderElementComponentExport(glibName, component)}`;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** The component for the nearest ancestry match, most-derived first; user overrides win on their exact type. */
|
|
125
|
+
const resolveElementComponent = (
|
|
126
|
+
ancestry: string[],
|
|
127
|
+
components: Record<string, ElementComponent>,
|
|
128
|
+
): ElementComponent | undefined => {
|
|
129
|
+
for (const name of ancestry) {
|
|
130
|
+
const found = components[name];
|
|
131
|
+
|
|
132
|
+
if (found !== undefined) {
|
|
133
|
+
return found;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return undefined;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const renderElementComponentExport = (glibName: string, component: ElementComponent | undefined): string => {
|
|
141
|
+
const propsType = `${glibName}Props`;
|
|
142
|
+
const annotation = `(props: ${propsType}) => ReactNode`;
|
|
143
|
+
const factoryCall = `createElementComponent(${sourceStringLiteral(glibName)})`;
|
|
144
|
+
|
|
145
|
+
if (component === undefined) {
|
|
146
|
+
return `export const ${glibName}: ${annotation} = ${factoryCall};`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return `export const ${glibName}: ${annotation} = ${component.export}(${factoryCall});`;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export { generateElementComponentsSection, type ElementComponent, type ElementComponentOverrides };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Props interface a generated element's props extend, declared by hand in `@gtkx/react`. */
|
|
2
|
+
type ElementPropTypeRef = { type: string; module: string; export: string };
|
|
3
|
+
/** Base props interface each element extends, keyed by GLib type name (the module exports it). */
|
|
4
|
+
type ElementProps = Record<string, { module: string; export: string }>;
|
|
5
|
+
|
|
6
|
+
const elementProps: Map<string, { module: string; export: string }> = new Map();
|
|
7
|
+
|
|
8
|
+
/** Installs the base props each element extends (GLib type name → `{ module, export }`); set once per run. */
|
|
9
|
+
const setElementProps = (props: ElementProps): void => {
|
|
10
|
+
elementProps.clear();
|
|
11
|
+
|
|
12
|
+
for (const [glibName, ref] of Object.entries(props)) {
|
|
13
|
+
elementProps.set(glibName, ref);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** The base props interface an element extends, when its element config declares one. */
|
|
18
|
+
const elementPropTypeFor = (glibName: string): ElementPropTypeRef | undefined => {
|
|
19
|
+
const ref = elementProps.get(glibName);
|
|
20
|
+
|
|
21
|
+
return ref === undefined ? undefined : { type: glibName, module: ref.module, export: ref.export };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { setElementProps, elementPropTypeFor, type ElementPropTypeRef, type ElementProps };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { toCamelIdentifier } from "@gtkx/utils";
|
|
2
|
+
import type { GirClass } from "../../gir/class.js";
|
|
3
|
+
import { getChain, type GirIndex, type GirTypeEntry } from "./gir-index.js";
|
|
4
|
+
import { getGlibName } from "./intrinsic-elements.js";
|
|
5
|
+
|
|
6
|
+
type LazyElementSpec = {
|
|
7
|
+
element: string;
|
|
8
|
+
typeName: string;
|
|
9
|
+
typeSource: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const appendConstructOnlyNames = (klass: GirClass, names: string[]): void => {
|
|
13
|
+
for (const property of klass.properties) {
|
|
14
|
+
if (property.constructOnly) {
|
|
15
|
+
names.push(toCamelIdentifier(property.name));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const constructOnlyNames = (context: GirIndex, entry: GirTypeEntry): string[] => {
|
|
21
|
+
const names: string[] = [];
|
|
22
|
+
|
|
23
|
+
for (const klass of getChain(context, entry)) {
|
|
24
|
+
appendConstructOnlyNames(klass, names);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return names;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const createLazyElementSpec = (context: GirIndex, element: string, entry: GirTypeEntry): LazyElementSpec => {
|
|
31
|
+
const typeName = `${element}ElementProps`;
|
|
32
|
+
const baseName = getGlibName(entry.klass) ?? element;
|
|
33
|
+
const omitted = constructOnlyNames(context, entry);
|
|
34
|
+
const omitUnion = omitted.map((name) => JSON.stringify(name)).join(" | ");
|
|
35
|
+
const base = omitted.length === 0 ? `${baseName}Props` : `Omit<${baseName}Props, ${omitUnion}>`;
|
|
36
|
+
|
|
37
|
+
return { element, typeName, typeSource: `export type ${typeName} = ${base} & { children?: ReactNode };` };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Lazy element prop types to emit, grouped by the namespace declaring each element. */
|
|
41
|
+
const lazyElementSpecs = (context: GirIndex, lazyElements: string[]): Map<string, LazyElementSpec[]> => {
|
|
42
|
+
const specs: Map<string, LazyElementSpec[]> = new Map();
|
|
43
|
+
|
|
44
|
+
for (const element of lazyElements) {
|
|
45
|
+
const entry = context.index.get(element);
|
|
46
|
+
|
|
47
|
+
if (entry === undefined) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const list = specs.get(entry.namespace.name) ?? [];
|
|
52
|
+
list.push(createLazyElementSpec(context, element, entry));
|
|
53
|
+
specs.set(entry.namespace.name, list);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return specs;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { lazyElementSpecs, type LazyElementSpec };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { GirClass } from "../../gir/class.js";
|
|
2
|
+
import type { Library } from "../../gir/library.js";
|
|
3
|
+
import type { GirNamespace } from "../../gir/namespace.js";
|
|
4
|
+
import { ancestorChain } from "../../gir/ancestry.js";
|
|
5
|
+
import { getGlibName, implementedInterfaces } from "./intrinsic-elements.js";
|
|
6
|
+
|
|
7
|
+
type GirTypeEntry = {
|
|
8
|
+
klass: GirClass;
|
|
9
|
+
namespace: GirNamespace;
|
|
10
|
+
isInterface: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type GirIndex = {
|
|
14
|
+
library: Library;
|
|
15
|
+
index: Map<string, GirTypeEntry>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const indexClasses = (
|
|
19
|
+
index: Map<string, GirTypeEntry>,
|
|
20
|
+
classes: Iterable<GirClass>,
|
|
21
|
+
namespace: GirNamespace,
|
|
22
|
+
isInterface: boolean,
|
|
23
|
+
): void => {
|
|
24
|
+
for (const klass of classes) {
|
|
25
|
+
const glibName = getGlibName(klass);
|
|
26
|
+
|
|
27
|
+
if (glibName !== undefined && !index.has(glibName)) {
|
|
28
|
+
index.set(glibName, { klass, namespace, isInterface });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const buildGirIndex = (library: Library): GirIndex => {
|
|
34
|
+
const index: Map<string, GirTypeEntry> = new Map();
|
|
35
|
+
|
|
36
|
+
for (const namespace of library.namespaces.values()) {
|
|
37
|
+
indexClasses(index, namespace.classes, namespace, false);
|
|
38
|
+
indexClasses(index, namespace.interfaces, namespace, true);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { library, index };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getChain = (context: GirIndex, entry: GirTypeEntry): GirClass[] => {
|
|
45
|
+
if (entry.isInterface) {
|
|
46
|
+
return [entry.klass];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const chain: GirClass[] = [];
|
|
50
|
+
|
|
51
|
+
for (const { klass } of ancestorChain(context.library, entry.klass, entry.namespace.name)) {
|
|
52
|
+
chain.push(klass);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for (const iface of implementedInterfaces(entry.klass, entry.namespace, context.library)) {
|
|
56
|
+
chain.push(iface.klass);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return chain;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { buildGirIndex, getChain, type GirTypeEntry, type GirIndex };
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { sortStringsBy, toCamelIdentifier, upperFirst } from "@gtkx/utils";
|
|
2
|
+
import type { GirClass } from "../../gir/class.js";
|
|
3
|
+
import type { Library } from "../../gir/library.js";
|
|
4
|
+
import type { GirNamespace } from "../../gir/namespace.js";
|
|
5
|
+
import { ancestorChain } from "../../gir/ancestry.js";
|
|
6
|
+
|
|
7
|
+
type GlibNamedClass = {
|
|
8
|
+
glibName: string;
|
|
9
|
+
klass: GirClass;
|
|
10
|
+
namespace: GirNamespace;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type ResolvedQualifiedInterface = { klass: GirClass; namespace: GirNamespace };
|
|
14
|
+
|
|
15
|
+
type InterfaceVisitState = {
|
|
16
|
+
library: Library;
|
|
17
|
+
visited: Set<string>;
|
|
18
|
+
result: ResolvedQualifiedInterface[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type HasContainerProps = (glibName: string | undefined) => boolean;
|
|
22
|
+
|
|
23
|
+
type InterfacePropsCollector = {
|
|
24
|
+
library: Library;
|
|
25
|
+
targetNamespaceName: string;
|
|
26
|
+
hasContainerProps: HasContainerProps;
|
|
27
|
+
seen: Set<string>;
|
|
28
|
+
result: ResolvedQualifiedInterface[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const signalHandlerName = (signalName: string): string => `on${upperFirst(toCamelIdentifier(signalName))}`;
|
|
32
|
+
|
|
33
|
+
function* classesWithGlibNameIn(namespace: GirNamespace): IterableIterator<GlibNamedClass> {
|
|
34
|
+
for (const klass of namespace.classes) {
|
|
35
|
+
const glibName = getGlibName(klass);
|
|
36
|
+
|
|
37
|
+
if (glibName === undefined) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
yield { glibName, klass, namespace };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function* iterateClassesWithGlibName(library: Library): IterableIterator<GlibNamedClass> {
|
|
46
|
+
for (const namespace of library.namespaces.values()) {
|
|
47
|
+
yield* classesWithGlibNameIn(namespace);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function collectImplementedInterface(state: InterfaceVisitState, name: string, fromNamespace: GirNamespace): void {
|
|
52
|
+
const resolved = state.library.resolveType(fromNamespace.name, name);
|
|
53
|
+
|
|
54
|
+
if (resolved?.kind !== "interface") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const key = `${resolved.namespace.name}.${resolved.value.name}`;
|
|
59
|
+
|
|
60
|
+
if (state.visited.has(key)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
state.visited.add(key);
|
|
65
|
+
state.result.push({ klass: resolved.value, namespace: resolved.namespace });
|
|
66
|
+
visitImplementedInterfaces(state, resolved.value.prerequisites, resolved.namespace);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function visitImplementedInterfaces(state: InterfaceVisitState, names: string[], fromNamespace: GirNamespace): void {
|
|
70
|
+
for (const name of names) {
|
|
71
|
+
collectImplementedInterface(state, name, fromNamespace);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const implementedInterfaces = (
|
|
76
|
+
klass: GirClass,
|
|
77
|
+
namespace: GirNamespace,
|
|
78
|
+
library: Library,
|
|
79
|
+
): ResolvedQualifiedInterface[] => {
|
|
80
|
+
const state: InterfaceVisitState = { library, visited: new Set<string>(), result: [] };
|
|
81
|
+
visitImplementedInterfaces(state, klass.implements, namespace);
|
|
82
|
+
|
|
83
|
+
return state.result;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const getGlibName = (klass: GirClass): string | undefined => klass.glibTypeName ?? klass.cType;
|
|
87
|
+
const giNamespaceAlias = (namespaceName: string): string => `${namespaceName}$`;
|
|
88
|
+
const hasNoContainerProps: HasContainerProps = () => false;
|
|
89
|
+
|
|
90
|
+
const hasInterfacePropsBody = (
|
|
91
|
+
klass: GirClass,
|
|
92
|
+
hasContainerProps: HasContainerProps = hasNoContainerProps,
|
|
93
|
+
): boolean => klass.properties.length > 0 || klass.signals.length > 0 || hasContainerProps(getGlibName(klass));
|
|
94
|
+
|
|
95
|
+
const qualifiedInterfaceKey = (iface: ResolvedQualifiedInterface): string =>
|
|
96
|
+
`${iface.namespace.name}.${iface.klass.name}`;
|
|
97
|
+
|
|
98
|
+
const isCollectibleInterface = (
|
|
99
|
+
iface: ResolvedQualifiedInterface,
|
|
100
|
+
targetNamespaceName: string,
|
|
101
|
+
hasContainerProps: HasContainerProps,
|
|
102
|
+
): boolean => hasInterfacePropsBody(iface.klass, hasContainerProps) && iface.namespace.name === targetNamespaceName;
|
|
103
|
+
|
|
104
|
+
const parentImplementedInterfaceKeys = (klass: GirClass, namespace: GirNamespace, library: Library): Set<string> => {
|
|
105
|
+
const keys: Set<string> = new Set();
|
|
106
|
+
|
|
107
|
+
if (klass.parent === undefined) {
|
|
108
|
+
return keys;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const resolvedParent = library.resolveType(namespace.name, klass.parent);
|
|
112
|
+
|
|
113
|
+
if (resolvedParent?.kind !== "class") {
|
|
114
|
+
return keys;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (const iface of implementedInterfaces(resolvedParent.value, resolvedParent.namespace, library)) {
|
|
118
|
+
keys.add(qualifiedInterfaceKey(iface));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return keys;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const newlyImplementedInterfaces = (
|
|
125
|
+
klass: GirClass,
|
|
126
|
+
namespace: GirNamespace,
|
|
127
|
+
library: Library,
|
|
128
|
+
hasContainerProps: HasContainerProps = hasNoContainerProps,
|
|
129
|
+
): ResolvedQualifiedInterface[] => {
|
|
130
|
+
const inherited = parentImplementedInterfaceKeys(klass, namespace, library);
|
|
131
|
+
|
|
132
|
+
const own = implementedInterfaces(klass, namespace, library).filter(
|
|
133
|
+
(iface) =>
|
|
134
|
+
hasInterfacePropsBody(iface.klass, hasContainerProps) && !inherited.has(qualifiedInterfaceKey(iface)),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
return sortStringsBy(own, qualifiedInterfaceKey);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const collectInterfacePropsFromElement = (element: GlibNamedClass, collector: InterfacePropsCollector): void => {
|
|
141
|
+
const { library, targetNamespaceName, hasContainerProps, seen, result } = collector;
|
|
142
|
+
|
|
143
|
+
for (const iface of implementedInterfaces(element.klass, element.namespace, library)) {
|
|
144
|
+
const key = qualifiedInterfaceKey(iface);
|
|
145
|
+
|
|
146
|
+
if (seen.has(key)) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
seen.add(key);
|
|
151
|
+
|
|
152
|
+
if (isCollectibleInterface(iface, targetNamespaceName, hasContainerProps)) {
|
|
153
|
+
result.push(iface);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const collectInterfacePropsClasses = (
|
|
159
|
+
library: Library,
|
|
160
|
+
intrinsicElements: GlibNamedClass[],
|
|
161
|
+
targetNamespaceName: string,
|
|
162
|
+
hasContainerProps: HasContainerProps = hasNoContainerProps,
|
|
163
|
+
): ResolvedQualifiedInterface[] => {
|
|
164
|
+
const collector: InterfacePropsCollector = {
|
|
165
|
+
library,
|
|
166
|
+
targetNamespaceName,
|
|
167
|
+
hasContainerProps,
|
|
168
|
+
seen: new Set<string>(),
|
|
169
|
+
result: [],
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
for (const element of intrinsicElements) {
|
|
173
|
+
collectInterfacePropsFromElement(element, collector);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return sortStringsBy(collector.result, qualifiedInterfaceKey);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const ancestorGlibNames = (klass: GirClass, namespace: GirNamespace, library: Library): string[] => {
|
|
180
|
+
const names: string[] = [];
|
|
181
|
+
|
|
182
|
+
for (const { klass: ancestor } of ancestorChain(library, klass, namespace.name)) {
|
|
183
|
+
const glibName = getGlibName(ancestor);
|
|
184
|
+
|
|
185
|
+
if (glibName !== undefined) {
|
|
186
|
+
names.push(glibName);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return names;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const hasMatchingAncestor = (
|
|
194
|
+
klass: GirClass,
|
|
195
|
+
namespace: GirNamespace,
|
|
196
|
+
library: Library,
|
|
197
|
+
isMatch: (klass: GirClass, glibName: string) => boolean,
|
|
198
|
+
): boolean => {
|
|
199
|
+
for (const { klass: ancestor } of ancestorChain(library, klass, namespace.name)) {
|
|
200
|
+
const glibName = getGlibName(ancestor) ?? "";
|
|
201
|
+
|
|
202
|
+
if (isMatch(ancestor, glibName)) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return false;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const hasMatchingAncestorName = (
|
|
211
|
+
klass: GirClass,
|
|
212
|
+
namespace: GirNamespace,
|
|
213
|
+
library: Library,
|
|
214
|
+
isMatch: (glibName: string) => boolean,
|
|
215
|
+
): boolean => hasMatchingAncestor(klass, namespace, library, (_klass, glibName) => isMatch(glibName));
|
|
216
|
+
|
|
217
|
+
const hasExposedMethod = (
|
|
218
|
+
klass: GirClass,
|
|
219
|
+
namespace: GirNamespace,
|
|
220
|
+
library: Library,
|
|
221
|
+
methodName: string,
|
|
222
|
+
): boolean =>
|
|
223
|
+
hasMatchingAncestor(klass, namespace, library, (current) => current.methods.some((m) => m.name === methodName));
|
|
224
|
+
|
|
225
|
+
const isIntrinsicElementClass = (klass: GirClass, namespace: GirNamespace, library: Library): boolean =>
|
|
226
|
+
hasMatchingAncestorName(klass, namespace, library, (glibName) => glibName === "GObject");
|
|
227
|
+
|
|
228
|
+
const collectIntrinsicElementClasses = (library: Library): GlibNamedClass[] => {
|
|
229
|
+
const seen: Set<string> = new Set();
|
|
230
|
+
const entries: GlibNamedClass[] = [];
|
|
231
|
+
|
|
232
|
+
for (const candidate of iterateClassesWithGlibName(library)) {
|
|
233
|
+
const { glibName, klass, namespace } = candidate;
|
|
234
|
+
|
|
235
|
+
if (!isIntrinsicElementClass(klass, namespace, library) || seen.has(glibName)) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
seen.add(glibName);
|
|
240
|
+
entries.push(candidate);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return sortStringsBy(entries, (entry) => entry.glibName);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export {
|
|
247
|
+
signalHandlerName,
|
|
248
|
+
iterateClassesWithGlibName,
|
|
249
|
+
implementedInterfaces,
|
|
250
|
+
getGlibName,
|
|
251
|
+
giNamespaceAlias,
|
|
252
|
+
hasInterfacePropsBody,
|
|
253
|
+
newlyImplementedInterfaces,
|
|
254
|
+
collectInterfacePropsClasses,
|
|
255
|
+
ancestorGlibNames,
|
|
256
|
+
hasExposedMethod,
|
|
257
|
+
isIntrinsicElementClass,
|
|
258
|
+
collectIntrinsicElementClasses,
|
|
259
|
+
type GlibNamedClass,
|
|
260
|
+
type ResolvedQualifiedInterface,
|
|
261
|
+
type HasContainerProps,
|
|
262
|
+
};
|