@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
package/dist/store/gi/vtable.js
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
import { pascalCase, sourceStringLiteral
|
|
1
|
+
import { pascalCase, sourceStringLiteral } from "@gtkx/utils";
|
|
2
2
|
import { isInlineCallbackRef, isScalarRef, renderDescriptor, renderParamDescriptor, } from "../../analysis/descriptor-render.js";
|
|
3
|
-
import {
|
|
3
|
+
import { foldedLengthParameters, handlerParameters, parameterIdentifier, renamesWithInstance, renderHandlerParameters, renderHandlerResultType, } from "../../analysis/param-structure.js";
|
|
4
|
+
import { renderTsType } from "../../analysis/ts-type.js";
|
|
5
|
+
import { ancestorChain, resolveInterfaces } from "../../gir/ancestry.js";
|
|
6
|
+
import { renderJsDoc } from "../../writer/doc.js";
|
|
7
|
+
import { renderBlock, renderBraced } from "../../writer/emit.js";
|
|
8
|
+
import { handlerSpec, THROWS_TEXT } from "./doc-spec.js";
|
|
4
9
|
import { computeRecordFieldSlots } from "./record-layout.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
10
|
+
const PADDING_FIELD_NAME = /^(?:reserved|padding)\d*$/i;
|
|
11
|
+
const UNCALLABLE_SLOT_KEYS = new Set([
|
|
12
|
+
"vfuncDispose",
|
|
13
|
+
"vfuncFinalize",
|
|
14
|
+
"vfuncGetProperty",
|
|
15
|
+
"vfuncSetProperty",
|
|
16
|
+
]);
|
|
17
|
+
const PROTECTED_SLOT_NOTE = "It is `protected`, so only a subclass chaining up reaches it.";
|
|
18
|
+
const PUBLIC_SLOT_NOTE = "Calling it from anywhere else re-enters the slot on a live instance.";
|
|
19
|
+
const vfuncMemberName = (fieldName) => `vfunc${pascalCase(fieldName)}`;
|
|
20
|
+
const vfuncOverrideNote = (slot, isProtected) => [
|
|
21
|
+
`Invokes the \`${slot.field.name}\` vtable slot. Override it on a class passed to \`registerClass\``,
|
|
22
|
+
`and chain up with \`super.${slot.key}()\`.`,
|
|
23
|
+
isProtected ? PROTECTED_SLOT_NOTE : PUBLIC_SLOT_NOTE,
|
|
24
|
+
].join("\n");
|
|
25
|
+
const vfuncRequirementNote = (slot, ownerRef) => [
|
|
26
|
+
`Fills the \`${slot.field.name}\` vtable slot. Declare it on a class passed to \`registerClass\``,
|
|
27
|
+
`with \`${ownerRef}\` in \`implements\`, which installs it in the interface vtable. Leaving it out`,
|
|
28
|
+
"keeps whatever the interface installs by default, the way it does for a C implementer.",
|
|
29
|
+
].join("\n");
|
|
30
|
+
const vfuncMemberNote = (options) => options.mode === "requirement"
|
|
31
|
+
? vfuncRequirementNote(options.slot, options.ownerRef)
|
|
32
|
+
: vfuncOverrideNote(options.slot, options.isProtected);
|
|
33
|
+
const isPaddingField = (field) => field.name.startsWith("_") || PADDING_FIELD_NAME.test(field.name);
|
|
17
34
|
const vtableCallbackType = (context, field) => {
|
|
18
35
|
if (field.type === undefined) {
|
|
19
36
|
return undefined;
|
|
@@ -25,12 +42,15 @@ const vtableCallbackType = (context, field) => {
|
|
|
25
42
|
return type.value;
|
|
26
43
|
};
|
|
27
44
|
const vtableSlotEntry = (context, field, claimedNames) => {
|
|
45
|
+
if (field.name === "constructor" || isPaddingField(field)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
28
48
|
const callback = vtableCallbackType(context, field);
|
|
29
49
|
if (callback === undefined) {
|
|
30
50
|
return undefined;
|
|
31
51
|
}
|
|
32
|
-
const key =
|
|
33
|
-
if (
|
|
52
|
+
const key = vfuncMemberName(field.name);
|
|
53
|
+
if (claimedNames.has(key)) {
|
|
34
54
|
return undefined;
|
|
35
55
|
}
|
|
36
56
|
if (!isVtableSlotEligible(context, callback)) {
|
|
@@ -38,42 +58,182 @@ const vtableSlotEntry = (context, field, claimedNames) => {
|
|
|
38
58
|
}
|
|
39
59
|
return { key, callback };
|
|
40
60
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
if (resolved?.kind !== "record") {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
const { slots, size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);
|
|
61
|
+
const collectVtableSlots = (context, fields, isUnion) => {
|
|
62
|
+
const { slots, size } = computeRecordFieldSlots(context, fields, isUnion);
|
|
47
63
|
const entries = [];
|
|
48
64
|
const claimedNames = new Set();
|
|
49
65
|
for (const { field, slot } of slots) {
|
|
50
66
|
const entry = vtableSlotEntry(context, field, claimedNames);
|
|
51
|
-
if (entry
|
|
52
|
-
|
|
67
|
+
if (entry !== undefined) {
|
|
68
|
+
claimedNames.add(entry.key);
|
|
69
|
+
entries.push({ ...entry, field, vfunc: undefined, byteOffset: slot.byteOffset });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { slots: entries, vtableSize: size };
|
|
73
|
+
};
|
|
74
|
+
const resolveVtableRecord = (context, namespaceName, klass) => {
|
|
75
|
+
const typeStruct = klass.glibTypeStruct;
|
|
76
|
+
const resolved = typeStruct === undefined ? undefined : context.library.resolveType(namespaceName, typeStruct);
|
|
77
|
+
if (typeStruct === undefined || resolved?.kind !== "record" || resolved.value.fields.length === 0) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return { typeStruct, record: resolved.value };
|
|
81
|
+
};
|
|
82
|
+
const attachVirtualMethods = (slots, klass) => {
|
|
83
|
+
const byKey = new Map(klass.vfuncs.map((vfunc) => [vfuncMemberName(vfunc.name), vfunc]));
|
|
84
|
+
return slots.map((slot) => ({ ...slot, vfunc: byKey.get(slot.key) }));
|
|
85
|
+
};
|
|
86
|
+
const collectVtable = (context, namespaceName, klass) => {
|
|
87
|
+
const resolved = resolveVtableRecord(context, namespaceName, klass);
|
|
88
|
+
if (resolved === undefined) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const { slots, vtableSize } = collectVtableSlots(context, resolved.record.fields, resolved.record.isUnion);
|
|
92
|
+
if (slots.length === 0) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
structName: pascalCase(resolved.typeStruct),
|
|
97
|
+
kind: klass.isInterface ? "interface" : "class",
|
|
98
|
+
vtableSize,
|
|
99
|
+
slots: attachVirtualMethods(slots, klass),
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const vfuncMemberNames = (context, namespaceName, klass) => collectVtable(context, namespaceName, klass)?.slots.map((slot) => slot.key) ?? [];
|
|
103
|
+
const renderVfuncMetadata = (context, klass) => {
|
|
104
|
+
const vtable = collectVtable(context, context.namespace.name, klass);
|
|
105
|
+
if (vtable === undefined) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
const entries = vtable.slots.map((slot) => renderVtableSlotDescriptor(context, vtable, slot));
|
|
109
|
+
return renderBraced(entries.join("\n"));
|
|
110
|
+
};
|
|
111
|
+
const slotIdentity = (slot) => `${slot.key}:${String(slot.byteOffset)}`;
|
|
112
|
+
const inheritedSlotIdentities = (context, namespaceName, klass) => {
|
|
113
|
+
const identities = new Set();
|
|
114
|
+
const [, ...ancestors] = [...ancestorChain(context.library, klass, namespaceName)];
|
|
115
|
+
for (const ancestor of ancestors) {
|
|
116
|
+
const vtable = collectVtable(context, ancestor.namespaceName, ancestor.klass);
|
|
117
|
+
const slots = vtable?.slots ?? [];
|
|
118
|
+
for (const slot of slots) {
|
|
119
|
+
identities.add(slotIdentity(slot));
|
|
53
120
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
121
|
+
}
|
|
122
|
+
return identities;
|
|
123
|
+
};
|
|
124
|
+
const addInterfaceSlotKeys = (context, iface, keys, seen) => {
|
|
125
|
+
const identity = `${iface.namespaceName}.${iface.klass.name}`;
|
|
126
|
+
if (seen.has(identity)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
seen.add(identity);
|
|
130
|
+
for (const key of vfuncMemberNames(context, iface.namespaceName, iface.klass)) {
|
|
131
|
+
keys.add(key);
|
|
132
|
+
}
|
|
133
|
+
for (const ref of resolveInterfaces(context.library, iface.namespaceName, iface.klass.prerequisites)) {
|
|
134
|
+
addInterfaceSlotKeys(context, ref, keys, seen);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const implementedSlotKeys = (context, namespaceName, klass) => {
|
|
138
|
+
const keys = new Set();
|
|
139
|
+
const seen = new Set();
|
|
140
|
+
for (const ancestor of ancestorChain(context.library, klass, namespaceName)) {
|
|
141
|
+
for (const ref of resolveInterfaces(context.library, ancestor.namespaceName, ancestor.klass.implements)) {
|
|
142
|
+
addInterfaceSlotKeys(context, ref, keys, seen);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return keys;
|
|
146
|
+
};
|
|
147
|
+
const protectedSlotKeys = (options, slots) => {
|
|
148
|
+
const { context, klass } = options;
|
|
149
|
+
if (klass.isInterface) {
|
|
150
|
+
return new Set();
|
|
151
|
+
}
|
|
152
|
+
const shared = implementedSlotKeys(context, context.namespace.name, klass);
|
|
153
|
+
return new Set(slots.map((slot) => slot.key).filter((key) => !shared.has(key)));
|
|
154
|
+
};
|
|
155
|
+
const callableVfuncSlots = (context, namespaceName, klass) => {
|
|
156
|
+
const vtable = collectVtable(context, namespaceName, klass);
|
|
157
|
+
if (vtable === undefined) {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
const inherited = inheritedSlotIdentities(context, namespaceName, klass);
|
|
161
|
+
return vtable.slots.filter((slot) => isCallableSlot(context, slot) && !inherited.has(slotIdentity(slot)));
|
|
162
|
+
};
|
|
163
|
+
const hasCallableVfuncSlots = (context, namespaceName, klass) => callableVfuncSlots(context, namespaceName, klass).length > 0;
|
|
164
|
+
const slotDoc = (slot) => slot.vfunc?.doc ?? slot.field.doc ?? slot.callback.doc;
|
|
165
|
+
const slotDocParameters = (slot) => {
|
|
166
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
167
|
+
const vfuncParameters = slot.vfunc?.parameters ?? [];
|
|
168
|
+
return parameters.map((parameter, index) => ({ ...parameter, doc: vfuncParameters[index]?.doc ?? parameter.doc }));
|
|
169
|
+
};
|
|
170
|
+
const slotDocSpec = (slot) => {
|
|
171
|
+
const parameters = slotDocParameters(slot);
|
|
172
|
+
const source = slot.vfunc ?? slot.callback;
|
|
173
|
+
return {
|
|
174
|
+
...handlerSpec(source, parameters, renamesWithInstance(parameters, slot.callback.parameters[0])),
|
|
175
|
+
returns: slot.vfunc?.returnValue.doc ?? slot.callback.returnValue.doc,
|
|
176
|
+
throws: slot.callback.throws ? THROWS_TEXT : undefined,
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const vfuncEntries = (context, namespaceName, klass) => callableVfuncSlots(context, namespaceName, klass).map((slot) => ({
|
|
180
|
+
name: slot.key,
|
|
181
|
+
signature: vfuncSlotSignature(context, slot).header,
|
|
182
|
+
doc: slotDoc(slot),
|
|
183
|
+
}));
|
|
184
|
+
const renderVfuncMembers = (options) => {
|
|
185
|
+
const { context, klass, mode } = options;
|
|
186
|
+
const ownerRef = pascalCase(klass.name);
|
|
187
|
+
const slots = callableVfuncSlots(context, context.namespace.name, klass);
|
|
188
|
+
if (slots.length === 0) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
if (mode === "implementation") {
|
|
192
|
+
context.addRuntimeImport("callVfunc");
|
|
193
|
+
}
|
|
194
|
+
const protectedKeys = protectedSlotKeys(options, slots);
|
|
195
|
+
return slots.map((slot) => renderVfuncMember({ context, ownerRef, slot, mode, isProtected: protectedKeys.has(slot.key) }));
|
|
196
|
+
};
|
|
197
|
+
const hasUnannotatedPointerParam = (context, slot) => {
|
|
198
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
199
|
+
return parameters.some((parameter) => parameter.direction === "in" &&
|
|
200
|
+
parameter.cType?.endsWith("*") === true &&
|
|
201
|
+
isScalarRef(context.library, parameter.type));
|
|
202
|
+
};
|
|
203
|
+
const isCallableSlot = (context, slot) => !UNCALLABLE_SLOT_KEYS.has(slot.key) && !hasUnannotatedPointerParam(context, slot);
|
|
204
|
+
const vfuncSlotSignature = (context, slot, isOptional = false) => {
|
|
205
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
206
|
+
const renderType = (ref, isNullable) => renderTsType(context, ref, isNullable);
|
|
207
|
+
const signature = renderHandlerParameters(parameters, renderType).join(", ");
|
|
208
|
+
const folded = foldedLengthParameters(context.library, slot.callback);
|
|
209
|
+
const returnType = renderHandlerResultType({
|
|
210
|
+
library: context.library,
|
|
211
|
+
signal: { ...slot.callback, parameters },
|
|
212
|
+
renderType,
|
|
213
|
+
shouldIncludeCallerAllocated: true,
|
|
214
|
+
isOptOut: false,
|
|
215
|
+
shouldExcludeOut: (parameter) => folded.has(parameter),
|
|
216
|
+
});
|
|
217
|
+
return { header: `${slot.key}${isOptional ? "?" : ""}(${signature}): ${returnType}`, returnType };
|
|
218
|
+
};
|
|
219
|
+
const renderVfuncMember = (options) => {
|
|
220
|
+
const { context, ownerRef, slot, mode, isProtected } = options;
|
|
221
|
+
const { header, returnType } = vfuncSlotSignature(context, slot, mode === "requirement");
|
|
222
|
+
const declaration = `${isProtected ? "protected " : ""}${header}`;
|
|
223
|
+
const doc = renderJsDoc(slotDoc(slot), vfuncMemberNote(options), slotDocSpec(slot));
|
|
224
|
+
if (mode !== "implementation") {
|
|
225
|
+
return `${doc}${declaration};`;
|
|
226
|
+
}
|
|
227
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
228
|
+
const inputs = handlerParameters(parameters).map((parameter, index) => parameterIdentifier(parameter, index));
|
|
229
|
+
const call = `callVfunc(${ownerRef}, ${sourceStringLiteral(slot.key)}, this, [${inputs.join(", ")}])`;
|
|
230
|
+
const body = returnType === "void" ? `${call};` : `return ${call} as ${returnType};`;
|
|
231
|
+
return `${doc}${renderBlock(declaration, body)}`;
|
|
232
|
+
};
|
|
70
233
|
const isEligibleVtableParam = (context, param) => {
|
|
71
234
|
if (param.isVarargs) {
|
|
72
235
|
return false;
|
|
73
236
|
}
|
|
74
|
-
if (isUnsupportedOutParam(context, param)) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
237
|
return !isInlineCallbackRef(context.library, param.type);
|
|
78
238
|
};
|
|
79
239
|
const isVtableSlotEligible = (context, callback) => {
|
|
@@ -87,22 +247,25 @@ const isVtableSlotEligible = (context, callback) => {
|
|
|
87
247
|
}
|
|
88
248
|
return !isInlineCallbackRef(context.library, callback.returnValue.type);
|
|
89
249
|
};
|
|
90
|
-
const renderVtableSlotDescriptor = (context,
|
|
91
|
-
const { key,
|
|
250
|
+
const renderVtableSlotDescriptor = (context, vtable, slot) => {
|
|
251
|
+
const { key, field, callback, byteOffset } = slot;
|
|
92
252
|
const argDescriptors = callback.parameters
|
|
93
253
|
.map((param) => renderParamDescriptor(context, param, param.type))
|
|
94
254
|
.join(", ");
|
|
95
255
|
const returnDescriptor = renderDescriptor(context, callback.returnValue.type, callback.returnValue.transferOwnership);
|
|
96
256
|
const lines = [
|
|
97
|
-
`
|
|
98
|
-
`className: ${sourceStringLiteral(structName)},`,
|
|
257
|
+
`className: ${sourceStringLiteral(vtable.structName)},`,
|
|
99
258
|
`vfuncName: ${sourceStringLiteral(field.name)},`,
|
|
100
259
|
`byteOffset: ${String(byteOffset)},`,
|
|
101
|
-
`vtableSize: ${String(vtableSize)},`,
|
|
102
|
-
`argDescriptors: [${argDescriptors}],`,
|
|
103
|
-
`returnDescriptor: ${returnDescriptor},`,
|
|
104
260
|
];
|
|
261
|
+
if (vtable.kind === "interface") {
|
|
262
|
+
lines.push(`vtableSize: ${String(vtable.vtableSize)},`);
|
|
263
|
+
}
|
|
264
|
+
lines.push(`argDescriptors: [${argDescriptors}],`, `returnDescriptor: ${returnDescriptor},`);
|
|
265
|
+
if (callback.throws) {
|
|
266
|
+
lines.push("canThrow: true,");
|
|
267
|
+
}
|
|
105
268
|
return `${key}: ${renderBraced(lines.join("\n"))},`;
|
|
106
269
|
};
|
|
107
|
-
export { renderVfuncMetadata };
|
|
270
|
+
export { hasCallableVfuncSlots, renderVfuncMembers, renderVfuncMetadata, vfuncEntries, vfuncMemberNames, };
|
|
108
271
|
//# sourceMappingURL=vtable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vtable.js","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMjF,OAAO,EACH,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAc7D,MAAM,mBAAmB,GAAG,CAAC,OAAsB,EAAE,KAAe,EAAsB,EAAE;IACxF,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpD,MAAM,IAAI,GAAe,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;IACnE,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE/E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,YAAY,CAAC,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AAG,gBAAgB,CACrC,OAAO,EACP,QAAQ,CAAC,WAAW,CAAC,IAAI,EACzB,QAAQ,CAAC,WAAW,CAAC,iBAAiB,CACzC,CAAC;IAEF,MAAM,KAAK,GAAG;QACV,SAAS,mBAAmB,CAAC,IAAI,CAAC,YAAY;QAC9C,cAAc,mBAAmB,CAAC,UAAU,CAAC,GAAG;QAChD,cAAc,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;QAChD,eAAe,MAAM,CAAC,UAAU,CAAC,GAAG;QACpC,eAAe,MAAM,CAAC,UAAU,CAAC,GAAG;QACpC,oBAAoB,cAAc,IAAI;QACtC,qBAAqB,gBAAgB,GAAG;KAC3C,CAAC;IAEF,OAAO,GAAG,GAAG,KAAK,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { pascalCase, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirCallback } from \"../../gir/callback.js\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirField } from \"../../gir/field.js\";\nimport type { GirParameter } from \"../../gir/parameter.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport {\n isInlineCallbackRef,\n isScalarRef,\n renderDescriptor,\n renderParamDescriptor,\n} from \"../../analysis/descriptor-render.js\";\nimport { renderBraced } from \"../../writer/emit.js\";\nimport { computeRecordFieldSlots } from \"./record-layout.js\";\n\ntype VtableKind = \"class\" | \"interface\";\n\ntype RenderVtableSlotDescriptorOptions = {\n key: string;\n structName: string;\n kind: VtableKind;\n field: GirField;\n callback: GirCallback;\n byteOffset: number;\n vtableSize: number;\n};\n\nconst renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {\n if (klass.glibTypeStruct === undefined) {\n return undefined;\n }\n\n const structName = pascalCase(klass.glibTypeStruct);\n const kind: VtableKind = klass.isInterface ? \"interface\" : \"class\";\n const entries = vtableEntries(context, structName, kind, klass.glibTypeStruct);\n\n if (entries.length === 0) {\n return undefined;\n }\n\n return renderBraced(entries.join(\"\\n\"));\n};\n\nconst vtableCallbackType = (context: ModuleContext, field: GirField): GirCallback | undefined => {\n if (field.type === undefined) {\n return undefined;\n }\n\n const type = context.library.typeFor(field.type);\n\n if (type?.kind !== \"callback\" || context.library.nameFor(field.type) !== undefined) {\n return undefined;\n }\n\n return type.value;\n};\n\nconst vtableSlotEntry = (\n context: ModuleContext,\n field: GirField,\n claimedNames: Set<string>,\n): { key: string; callback: GirCallback } | undefined => {\n const callback = vtableCallbackType(context, field);\n\n if (callback === undefined) {\n return undefined;\n }\n\n const key = toCamelIdentifier(field.name);\n\n if (key === \"constructor\" || claimedNames.has(key)) {\n return undefined;\n }\n\n if (!isVtableSlotEligible(context, callback)) {\n return undefined;\n }\n\n return { key, callback };\n};\n\nconst vtableEntries = (context: ModuleContext, structName: string, kind: VtableKind, typeStruct: string): string[] => {\n const resolved = context.library.resolveType(context.namespace.name, typeStruct);\n\n if (resolved?.kind !== \"record\") {\n return [];\n }\n\n const { slots, size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);\n const entries: string[] = [];\n const claimedNames: Set<string> = new Set();\n\n for (const { field, slot } of slots) {\n const entry = vtableSlotEntry(context, field, claimedNames);\n\n if (entry === undefined) {\n continue;\n }\n\n claimedNames.add(entry.key);\n\n entries.push(\n renderVtableSlotDescriptor(context, {\n key: entry.key,\n structName,\n kind,\n field,\n callback: entry.callback,\n byteOffset: slot.byteOffset,\n vtableSize: size,\n }),\n );\n }\n\n return entries;\n};\n\nconst isUnsupportedOutParam = (context: ModuleContext, param: GirParameter): boolean =>\n (param.direction === \"out\" || param.direction === \"inout\") &&\n !param.callerAllocates &&\n !isScalarRef(context.library, param.type);\n\nconst isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {\n if (param.isVarargs) {\n return false;\n }\n\n if (isUnsupportedOutParam(context, param)) {\n return false;\n }\n\n return !isInlineCallbackRef(context.library, param.type);\n};\n\nconst isVtableSlotEligible = (context: ModuleContext, callback: GirCallback): boolean => {\n if (!callback.introspectable) {\n return false;\n }\n\n for (const param of callback.parameters) {\n if (!isEligibleVtableParam(context, param)) {\n return false;\n }\n }\n\n return !isInlineCallbackRef(context.library, callback.returnValue.type);\n};\n\nconst renderVtableSlotDescriptor = (context: ModuleContext, options: RenderVtableSlotDescriptorOptions): string => {\n const { key, structName, kind, field, callback, byteOffset, vtableSize } = options;\n\n const argDescriptors = callback.parameters\n .map((param) => renderParamDescriptor(context, param, param.type))\n .join(\", \");\n\n const returnDescriptor = renderDescriptor(\n context,\n callback.returnValue.type,\n callback.returnValue.transferOwnership,\n );\n\n const lines = [\n `kind: ${sourceStringLiteral(kind)} as const,`,\n `className: ${sourceStringLiteral(structName)},`,\n `vfuncName: ${sourceStringLiteral(field.name)},`,\n `byteOffset: ${String(byteOffset)},`,\n `vtableSize: ${String(vtableSize)},`,\n `argDescriptors: [${argDescriptors}],`,\n `returnDescriptor: ${returnDescriptor},`,\n ];\n\n return `${key}: ${renderBraced(lines.join(\"\\n\"))},`;\n};\n\nexport { renderVfuncMetadata };\n"]}
|
|
1
|
+
{"version":3,"file":"vtable.js","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAS9D,OAAO,EACH,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAyB,iBAAiB,EAAE,MAAM,uBAAuB,CAA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CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,GAAG,GAAG,KAAK,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,GAEnB,CAAC","sourcesContent":["import { pascalCase, sourceStringLiteral } from \"@gtkx/utils\";\nimport type { GirCallback } from \"../../gir/callback.js\";\nimport type { GirClass, GirVirtualMethod } from \"../../gir/class.js\";\nimport type { GirField } from \"../../gir/field.js\";\nimport type { GirParameter } from \"../../gir/parameter.js\";\nimport type { GirRecord } from \"../../gir/record.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport type { JsDocSpec } from \"../../writer/doc.js\";\nimport {\n isInlineCallbackRef,\n isScalarRef,\n renderDescriptor,\n renderParamDescriptor,\n} from \"../../analysis/descriptor-render.js\";\nimport {\n foldedLengthParameters,\n handlerParameters,\n parameterIdentifier,\n renamesWithInstance,\n renderHandlerParameters,\n renderHandlerResultType,\n} from \"../../analysis/param-structure.js\";\nimport { renderTsType } from \"../../analysis/ts-type.js\";\nimport { ancestorChain, type ResolvedAncestor, resolveInterfaces } from \"../../gir/ancestry.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { renderBlock, renderBraced } from \"../../writer/emit.js\";\nimport { handlerSpec, THROWS_TEXT } from \"./doc-spec.js\";\nimport { computeRecordFieldSlots } from \"./record-layout.js\";\n\ntype VtableKind = \"class\" | \"interface\";\ntype VfuncMemberMode = \"implementation\" | \"requirement\" | \"signature\";\n\ntype VtableSlot = {\n key: string;\n field: GirField;\n callback: GirCallback;\n vfunc: GirVirtualMethod | undefined;\n byteOffset: number;\n};\n\ntype VfuncMemberOptions = {\n context: ModuleContext;\n ownerRef: string;\n slot: VtableSlot;\n mode: VfuncMemberMode;\n isProtected: boolean;\n};\n\ntype VfuncMembersOptions = {\n context: ModuleContext;\n klass: GirClass;\n mode: VfuncMemberMode;\n};\n\ntype VfuncSignature = {\n header: string;\n returnType: string;\n};\n\ntype VfuncEntry = {\n name: string;\n signature: string;\n doc: string | undefined;\n};\n\ntype Vtable = {\n structName: string;\n kind: VtableKind;\n vtableSize: number;\n slots: VtableSlot[];\n};\n\nconst PADDING_FIELD_NAME = /^(?:reserved|padding)\\d*$/i;\n\nconst UNCALLABLE_SLOT_KEYS: Set<string> = new Set([\n \"vfuncDispose\",\n \"vfuncFinalize\",\n \"vfuncGetProperty\",\n \"vfuncSetProperty\",\n]);\n\nconst PROTECTED_SLOT_NOTE = \"It is `protected`, so only a subclass chaining up reaches it.\";\nconst PUBLIC_SLOT_NOTE = \"Calling it from anywhere else re-enters the slot on a live instance.\";\n\nconst vfuncMemberName = (fieldName: string): string => `vfunc${pascalCase(fieldName)}`;\n\nconst vfuncOverrideNote = (slot: VtableSlot, isProtected: boolean): string =>\n [\n `Invokes the \\`${slot.field.name}\\` vtable slot. Override it on a class passed to \\`registerClass\\``,\n `and chain up with \\`super.${slot.key}()\\`.`,\n isProtected ? PROTECTED_SLOT_NOTE : PUBLIC_SLOT_NOTE,\n ].join(\"\\n\");\n\nconst vfuncRequirementNote = (slot: VtableSlot, ownerRef: string): string =>\n [\n `Fills the \\`${slot.field.name}\\` vtable slot. Declare it on a class passed to \\`registerClass\\``,\n `with \\`${ownerRef}\\` in \\`implements\\`, which installs it in the interface vtable. Leaving it out`,\n \"keeps whatever the interface installs by default, the way it does for a C implementer.\",\n ].join(\"\\n\");\n\nconst vfuncMemberNote = (options: VfuncMemberOptions): string =>\n options.mode === \"requirement\"\n ? vfuncRequirementNote(options.slot, options.ownerRef)\n : vfuncOverrideNote(options.slot, options.isProtected);\n\nconst isPaddingField = (field: GirField): boolean =>\n field.name.startsWith(\"_\") || PADDING_FIELD_NAME.test(field.name);\n\nconst vtableCallbackType = (context: ModuleContext, field: GirField): GirCallback | undefined => {\n if (field.type === undefined) {\n return undefined;\n }\n\n const type = context.library.typeFor(field.type);\n\n if (type?.kind !== \"callback\" || context.library.nameFor(field.type) !== undefined) {\n return undefined;\n }\n\n return type.value;\n};\n\nconst vtableSlotEntry = (\n context: ModuleContext,\n field: GirField,\n claimedNames: Set<string>,\n): { key: string; callback: GirCallback } | undefined => {\n if (field.name === \"constructor\" || isPaddingField(field)) {\n return undefined;\n }\n\n const callback = vtableCallbackType(context, field);\n\n if (callback === undefined) {\n return undefined;\n }\n\n const key = vfuncMemberName(field.name);\n\n if (claimedNames.has(key)) {\n return undefined;\n }\n\n if (!isVtableSlotEligible(context, callback)) {\n return undefined;\n }\n\n return { key, callback };\n};\n\nconst collectVtableSlots = (\n context: ModuleContext,\n fields: GirField[],\n isUnion: boolean,\n): { slots: VtableSlot[]; vtableSize: number } => {\n const { slots, size } = computeRecordFieldSlots(context, fields, isUnion);\n const entries: VtableSlot[] = [];\n const claimedNames: Set<string> = new Set();\n\n for (const { field, slot } of slots) {\n const entry = vtableSlotEntry(context, field, claimedNames);\n\n if (entry !== undefined) {\n claimedNames.add(entry.key);\n entries.push({ ...entry, field, vfunc: undefined, byteOffset: slot.byteOffset });\n }\n }\n\n return { slots: entries, vtableSize: size };\n};\n\nconst resolveVtableRecord = (\n context: ModuleContext,\n namespaceName: string,\n klass: GirClass,\n): { typeStruct: string; record: GirRecord } | undefined => {\n const typeStruct = klass.glibTypeStruct;\n const resolved = typeStruct === undefined ? undefined : context.library.resolveType(namespaceName, typeStruct);\n\n if (typeStruct === undefined || resolved?.kind !== \"record\" || resolved.value.fields.length === 0) {\n return undefined;\n }\n\n return { typeStruct, record: resolved.value };\n};\n\nconst attachVirtualMethods = (slots: VtableSlot[], klass: GirClass): VtableSlot[] => {\n const byKey: Map<string, GirVirtualMethod> = new Map(\n klass.vfuncs.map((vfunc) => [vfuncMemberName(vfunc.name), vfunc]),\n );\n\n return slots.map((slot) => ({ ...slot, vfunc: byKey.get(slot.key) }));\n};\n\nconst collectVtable = (context: ModuleContext, namespaceName: string, klass: GirClass): Vtable | undefined => {\n const resolved = resolveVtableRecord(context, namespaceName, klass);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const { slots, vtableSize } = collectVtableSlots(context, resolved.record.fields, resolved.record.isUnion);\n\n if (slots.length === 0) {\n return undefined;\n }\n\n return {\n structName: pascalCase(resolved.typeStruct),\n kind: klass.isInterface ? \"interface\" : \"class\",\n vtableSize,\n slots: attachVirtualMethods(slots, klass),\n };\n};\n\nconst vfuncMemberNames = (context: ModuleContext, namespaceName: string, klass: GirClass): string[] =>\n collectVtable(context, namespaceName, klass)?.slots.map((slot) => slot.key) ?? [];\n\nconst renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {\n const vtable = collectVtable(context, context.namespace.name, klass);\n\n if (vtable === undefined) {\n return undefined;\n }\n\n const entries = vtable.slots.map((slot) => renderVtableSlotDescriptor(context, vtable, slot));\n\n return renderBraced(entries.join(\"\\n\"));\n};\n\nconst slotIdentity = (slot: VtableSlot): string => `${slot.key}:${String(slot.byteOffset)}`;\n\nconst inheritedSlotIdentities = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> => {\n const identities: Set<string> = new Set();\n const [, ...ancestors] = [...ancestorChain(context.library, klass, namespaceName)];\n\n for (const ancestor of ancestors) {\n const vtable = collectVtable(context, ancestor.namespaceName, ancestor.klass);\n const slots = vtable?.slots ?? [];\n\n for (const slot of slots) {\n identities.add(slotIdentity(slot));\n }\n }\n\n return identities;\n};\n\nconst addInterfaceSlotKeys = (\n context: ModuleContext,\n iface: ResolvedAncestor,\n keys: Set<string>,\n seen: Set<string>,\n): void => {\n const identity = `${iface.namespaceName}.${iface.klass.name}`;\n\n if (seen.has(identity)) {\n return;\n }\n\n seen.add(identity);\n\n for (const key of vfuncMemberNames(context, iface.namespaceName, iface.klass)) {\n keys.add(key);\n }\n\n for (const ref of resolveInterfaces(context.library, iface.namespaceName, iface.klass.prerequisites)) {\n addInterfaceSlotKeys(context, ref, keys, seen);\n }\n};\n\nconst implementedSlotKeys = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> => {\n const keys: Set<string> = new Set();\n const seen: Set<string> = new Set();\n\n for (const ancestor of ancestorChain(context.library, klass, namespaceName)) {\n for (const ref of resolveInterfaces(context.library, ancestor.namespaceName, ancestor.klass.implements)) {\n addInterfaceSlotKeys(context, ref, keys, seen);\n }\n }\n\n return keys;\n};\n\nconst protectedSlotKeys = (options: VfuncMembersOptions, slots: VtableSlot[]): Set<string> => {\n const { context, klass } = options;\n\n if (klass.isInterface) {\n return new Set();\n }\n\n const shared = implementedSlotKeys(context, context.namespace.name, klass);\n\n return new Set(slots.map((slot) => slot.key).filter((key) => !shared.has(key)));\n};\n\nconst callableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): VtableSlot[] => {\n const vtable = collectVtable(context, namespaceName, klass);\n\n if (vtable === undefined) {\n return [];\n }\n\n const inherited = inheritedSlotIdentities(context, namespaceName, klass);\n\n return vtable.slots.filter((slot) => isCallableSlot(context, slot) && !inherited.has(slotIdentity(slot)));\n};\n\nconst hasCallableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): boolean =>\n callableVfuncSlots(context, namespaceName, klass).length > 0;\n\nconst slotDoc = (slot: VtableSlot): string | undefined => slot.vfunc?.doc ?? slot.field.doc ?? slot.callback.doc;\n\nconst slotDocParameters = (slot: VtableSlot): GirParameter[] => {\n const [, ...parameters] = slot.callback.parameters;\n const vfuncParameters = slot.vfunc?.parameters ?? [];\n\n return parameters.map((parameter, index) => ({ ...parameter, doc: vfuncParameters[index]?.doc ?? parameter.doc }));\n};\n\nconst slotDocSpec = (slot: VtableSlot): JsDocSpec => {\n const parameters = slotDocParameters(slot);\n const source = slot.vfunc ?? slot.callback;\n\n return {\n ...handlerSpec(source, parameters, renamesWithInstance(parameters, slot.callback.parameters[0])),\n returns: slot.vfunc?.returnValue.doc ?? slot.callback.returnValue.doc,\n throws: slot.callback.throws ? THROWS_TEXT : undefined,\n };\n};\n\nconst vfuncEntries = (context: ModuleContext, namespaceName: string, klass: GirClass): VfuncEntry[] =>\n callableVfuncSlots(context, namespaceName, klass).map((slot) => ({\n name: slot.key,\n signature: vfuncSlotSignature(context, slot).header,\n doc: slotDoc(slot),\n }));\n\nconst renderVfuncMembers = (options: VfuncMembersOptions): string[] => {\n const { context, klass, mode } = options;\n const ownerRef = pascalCase(klass.name);\n const slots = callableVfuncSlots(context, context.namespace.name, klass);\n\n if (slots.length === 0) {\n return [];\n }\n\n if (mode === \"implementation\") {\n context.addRuntimeImport(\"callVfunc\");\n }\n\n const protectedKeys = protectedSlotKeys(options, slots);\n\n return slots.map((slot) =>\n renderVfuncMember({ context, ownerRef, slot, mode, isProtected: protectedKeys.has(slot.key) }));\n};\n\nconst hasUnannotatedPointerParam = (context: ModuleContext, slot: VtableSlot): boolean => {\n const [, ...parameters] = slot.callback.parameters;\n\n return parameters.some(\n (parameter) =>\n parameter.direction === \"in\" &&\n parameter.cType?.endsWith(\"*\") === true &&\n isScalarRef(context.library, parameter.type),\n );\n};\n\nconst isCallableSlot = (context: ModuleContext, slot: VtableSlot): boolean =>\n !UNCALLABLE_SLOT_KEYS.has(slot.key) && !hasUnannotatedPointerParam(context, slot);\n\nconst vfuncSlotSignature = (context: ModuleContext, slot: VtableSlot, isOptional = false): VfuncSignature => {\n const [, ...parameters] = slot.callback.parameters;\n\n const renderType = (ref: TypeId | undefined, isNullable: boolean): string =>\n renderTsType(context, ref, isNullable);\n\n const signature = renderHandlerParameters(parameters, renderType).join(\", \");\n const folded = foldedLengthParameters(context.library, slot.callback);\n\n const returnType = renderHandlerResultType({\n library: context.library,\n signal: { ...slot.callback, parameters },\n renderType,\n shouldIncludeCallerAllocated: true,\n isOptOut: false,\n shouldExcludeOut: (parameter) => folded.has(parameter),\n });\n\n return { header: `${slot.key}${isOptional ? \"?\" : \"\"}(${signature}): ${returnType}`, returnType };\n};\n\nconst renderVfuncMember = (options: VfuncMemberOptions): string => {\n const { context, ownerRef, slot, mode, isProtected } = options;\n const { header, returnType } = vfuncSlotSignature(context, slot, mode === \"requirement\");\n const declaration = `${isProtected ? \"protected \" : \"\"}${header}`;\n const doc = renderJsDoc(slotDoc(slot), vfuncMemberNote(options), slotDocSpec(slot));\n\n if (mode !== \"implementation\") {\n return `${doc}${declaration};`;\n }\n\n const [, ...parameters] = slot.callback.parameters;\n\n const inputs = handlerParameters(parameters).map((parameter, index) =>\n parameterIdentifier(parameter, index));\n\n const call = `callVfunc(${ownerRef}, ${sourceStringLiteral(slot.key)}, this, [${inputs.join(\", \")}])`;\n const body = returnType === \"void\" ? `${call};` : `return ${call} as ${returnType};`;\n\n return `${doc}${renderBlock(declaration, body)}`;\n};\n\nconst isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {\n if (param.isVarargs) {\n return false;\n }\n\n return !isInlineCallbackRef(context.library, param.type);\n};\n\nconst isVtableSlotEligible = (context: ModuleContext, callback: GirCallback): boolean => {\n if (!callback.introspectable) {\n return false;\n }\n\n for (const param of callback.parameters) {\n if (!isEligibleVtableParam(context, param)) {\n return false;\n }\n }\n\n return !isInlineCallbackRef(context.library, callback.returnValue.type);\n};\n\nconst renderVtableSlotDescriptor = (context: ModuleContext, vtable: Vtable, slot: VtableSlot): string => {\n const { key, field, callback, byteOffset } = slot;\n\n const argDescriptors = callback.parameters\n .map((param) => renderParamDescriptor(context, param, param.type))\n .join(\", \");\n\n const returnDescriptor = renderDescriptor(\n context,\n callback.returnValue.type,\n callback.returnValue.transferOwnership,\n );\n\n const lines = [\n `className: ${sourceStringLiteral(vtable.structName)},`,\n `vfuncName: ${sourceStringLiteral(field.name)},`,\n `byteOffset: ${String(byteOffset)},`,\n ];\n\n if (vtable.kind === \"interface\") {\n lines.push(`vtableSize: ${String(vtable.vtableSize)},`);\n }\n\n lines.push(`argDescriptors: [${argDescriptors}],`, `returnDescriptor: ${returnDescriptor},`);\n\n if (callback.throws) {\n lines.push(\"canThrow: true,\");\n }\n\n return `${key}: ${renderBraced(lines.join(\"\\n\"))},`;\n};\n\nexport {\n hasCallableVfuncSlots,\n renderVfuncMembers,\n renderVfuncMetadata,\n vfuncEntries,\n vfuncMemberNames,\n type VfuncMemberMode,\n};\n"]}
|
package/dist/store/gi-store.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type GiFingerprint } from "../fingerprint.js";
|
|
2
2
|
import { type StoreOptions } from "./store-fs.js";
|
|
3
|
-
type GiStoreOptions = StoreOptions;
|
|
4
3
|
type GiNamespaceInput = {
|
|
5
4
|
directory: string;
|
|
6
5
|
rawSource: string;
|
|
7
6
|
};
|
|
8
|
-
declare const writeGiStore: (options:
|
|
9
|
-
export { writeGiStore, type
|
|
7
|
+
declare const writeGiStore: (options: StoreOptions, namespaces: GiNamespaceInput[], fingerprint: GiFingerprint) => void;
|
|
8
|
+
export { writeGiStore, type GiNamespaceInput };
|
|
10
9
|
//# sourceMappingURL=gi-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAiB,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE5F,KAAK,
|
|
1
|
+
{"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAiB,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE5F,KAAK,gBAAgB,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AA2DF,QAAA,MAAM,YAAY,GACd,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,aAAa,aAAa,KAC3B,IAeF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gi-store.js","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAsB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAqB,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"gi-store.js","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAsB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAqB,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAY5F,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAEjG,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAY,EAAE;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAE5C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC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W;YACjC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC;SAClC,CAAC,CAAC;QAEH,UAAU,CAAC,KAAK,SAAS,EAAE,CAAC,GAAG,aAAa,CAAC,GAAG,SAAS,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CACjB,OAAqB,EACrB,UAA8B,EAC9B,WAA0B,EACtB,EAAE;IACN,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAElE,UAAU,CAAC;QACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,aAAa,CAAC;YACpB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,UAAU;YACnB,gBAAgB,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE;SAC7C,CAAC;QACF,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;KAC3G,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAyB,CAAC","sourcesContent":["import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { FINGERPRINT_FILENAME, type GiFingerprint } from \"../fingerprint.js\";\nimport { buildManifest, type StoreOptions, subpathExport, writeStore } from \"./store-fs.js\";\n\ntype GiNamespaceInput = {\n directory: string;\n rawSource: string;\n};\n\ntype CollectedFile = {\n fileName: string;\n source: string;\n};\n\nconst OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), \"..\", \"..\", \"overrides\");\n\nconst overrideFiles = (directory: string): string[] => {\n const dir = join(OVERRIDES_ROOT, directory);\n\n if (!existsSync(dir)) {\n return [];\n }\n\n return readdirSync(dir).filter((name) => name.endsWith(\".ejs\") && name !== \"index.ts.ejs\");\n};\n\nconst barrelSource = (directory: string): string => {\n const overrideIndex = join(OVERRIDES_ROOT, directory, \"index.ts.ejs\");\n\n if (!existsSync(overrideIndex)) {\n return `export * from \"./${directory}.js\";\\n`;\n }\n\n return readFileSync(overrideIndex, \"utf8\");\n};\n\nconst collectStoreSources = (\n namespaces: GiNamespaceInput[],\n): { collected: CollectedFile[]; exportsMap: Record<string, unknown> } => {\n const exportsMap: Record<string, unknown> = {};\n const collected: CollectedFile[] = [];\n\n for (const { directory, rawSource } of namespaces) {\n collected.push({\n fileName: `${directory}/${directory}.ts`,\n source: rawSource,\n });\n\n for (const file of overrideFiles(directory)) {\n collected.push({\n fileName: `${directory}/overrides/${file.replace(/\\.ejs$/, \"\")}`,\n source: readFileSync(join(OVERRIDES_ROOT, directory, file), \"utf8\"),\n });\n }\n\n collected.push({\n fileName: `${directory}/index.ts`,\n source: barrelSource(directory),\n });\n\n exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);\n }\n\n return { collected, exportsMap };\n};\n\nconst writeGiStore = (\n options: StoreOptions,\n namespaces: GiNamespaceInput[],\n fingerprint: GiFingerprint,\n): void => {\n const { collected, exportsMap } = collectStoreSources(namespaces);\n\n writeStore({\n storeDir: options.storeDir,\n linkDir: options.linkDir,\n files: collected,\n manifest: buildManifest({\n name: \"@gtkx/gi\",\n version: options.version,\n exports: exportsMap,\n peerDependencies: { \"@gtkx/runtime\": \"*\" },\n }),\n rawFiles: [{ relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(fingerprint, null, 2)}\\n` }],\n });\n};\n\nexport { writeGiStore, type GiNamespaceInput };\n"]}
|
|
@@ -3,12 +3,10 @@ import type { GirNamespace } from "../../gir/namespace.js";
|
|
|
3
3
|
import type { ImportsBuilder } from "../../writer/imports.js";
|
|
4
4
|
import type { LazyElementSpec } from "./element-prop-types.js";
|
|
5
5
|
import { type GlibNamedClass } from "./intrinsic-elements.js";
|
|
6
|
-
/** A component that wraps a generated element, keyed by GLib type name (built-in or user-provided). */
|
|
7
6
|
type ElementComponent = {
|
|
8
7
|
module: string;
|
|
9
8
|
export: string;
|
|
10
9
|
};
|
|
11
|
-
/** Component wrappers keyed by GLib type name; the framework's built-ins merged with the project's own. */
|
|
12
10
|
type ElementComponentOverrides = Record<string, ElementComponent>;
|
|
13
11
|
declare const generateElementComponentsSection: (targetNamespace: GirNamespace, library: Library, options: {
|
|
14
12
|
imports: ImportsBuilder;
|
|
@@ -19,5 +17,5 @@ declare const generateElementComponentsSection: (targetNamespace: GirNamespace,
|
|
|
19
17
|
source: string;
|
|
20
18
|
exportedNames: Set<string>;
|
|
21
19
|
};
|
|
22
|
-
export { generateElementComponentsSection, type
|
|
20
|
+
export { generateElementComponentsSection, type ElementComponentOverrides };
|
|
23
21
|
//# sourceMappingURL=element-components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-components.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/element-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEjF,
|
|
1
|
+
{"version":3,"file":"element-components.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/element-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEjF,KAAK,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3D,KAAK,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAgBlE,QAAA,MAAM,gCAAgC,GAClC,iBAAiB,YAAY,EAC7B,SAAS,OAAO,EAChB,SAAS;IACL,OAAO,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,iBAAiB,EAAE,cAAc,EAAE,CAAC;IACpC,UAAU,EAAE,yBAAyB,CAAC;CACzC,KACF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAiB9C,CAAC;AAiGF,OAAO,EAAE,gCAAgC,EAAE,KAAK,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sourceStringLiteral } from "@gtkx/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { getDoc } from "../gi/doc-spec.js";
|
|
3
3
|
import { ancestorGlibNames } from "./intrinsic-elements.js";
|
|
4
4
|
const generateElementComponentsSection = (targetNamespace, library, options) => {
|
|
5
5
|
const collector = { imports: options.imports, exportedNames: new Set(), exportLines: [] };
|
|
@@ -28,9 +28,6 @@ const appendCandidateExport = (collector, candidate, options) => {
|
|
|
28
28
|
collector.exportLines.push(line);
|
|
29
29
|
collector.exportedNames.add(candidate.glibName);
|
|
30
30
|
};
|
|
31
|
-
// An abstract GType cannot be instantiated: `g_object_new` on one is a fatal GObject error rather
|
|
32
|
-
// than a NULL return. Its props interface and metadata still have to be emitted, since every
|
|
33
|
-
// concrete subclass extends them, so only the constructible component export is withheld.
|
|
34
31
|
const collectCandidateExports = (collector, options) => {
|
|
35
32
|
for (const candidate of options.intrinsicElements) {
|
|
36
33
|
if (candidate.klass.isAbstract) {
|
|
@@ -48,9 +45,10 @@ const collectLazyElementExports = (collector, lazyElements) => {
|
|
|
48
45
|
}
|
|
49
46
|
};
|
|
50
47
|
const renderLazyElementExport = (spec) => {
|
|
48
|
+
const doc = getDoc(spec);
|
|
51
49
|
const factory = `createElementComponent(${sourceStringLiteral(spec.element)})`;
|
|
52
|
-
const component =
|
|
53
|
-
return `${spec.typeSource}\n\n${component}`;
|
|
50
|
+
const component = `${doc}export const ${spec.element}: (props: ${spec.typeName}) => ReactNode = ${factory};`;
|
|
51
|
+
return `${doc}${spec.typeSource}\n\n${component}`;
|
|
54
52
|
};
|
|
55
53
|
const renderCandidateExport = (candidate, library, imports, components) => {
|
|
56
54
|
const { glibName, klass, namespace } = candidate;
|
|
@@ -61,9 +59,9 @@ const renderCandidateExport = (candidate, library, imports, components) => {
|
|
|
61
59
|
if (component !== undefined) {
|
|
62
60
|
imports.addNamed(component.module, component.export, false);
|
|
63
61
|
}
|
|
64
|
-
|
|
62
|
+
const doc = getDoc(klass);
|
|
63
|
+
return `${doc}${renderElementComponentExport(glibName, component)}`;
|
|
65
64
|
};
|
|
66
|
-
/** The component for the nearest ancestry match, most-derived first; user overrides win on their exact type. */
|
|
67
65
|
const resolveElementComponent = (ancestry, components) => {
|
|
68
66
|
for (const name of ancestry) {
|
|
69
67
|
const found = components[name];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-components.js","sourceRoot":"","sources":["../../../src/store/jsx/element-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"element-components.js","sourceRoot":"","sources":["../../../src/store/j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C,CAAC;QAE/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,SAAuC,EAAU,EAAE;IACvG,MAAM,SAAS,GAAG,GAAG,QAAQ,OAAO,CAAC;IACrC,MAAM,UAAU,GAAG,WAAW,SAAS,gBAAgB,CAAC;IACxD,MAAM,WAAW,GAAG,0BAA0B,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC;IAE/E,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,gBAAgB,QAAQ,KAAK,UAAU,MAAM,WAAW,GAAG,CAAC;IACvE,CAAC;IAED,OAAO,gBAAgB,QAAQ,KAAK,UAAU,MAAM,SAAS,CAAC,MAAM,IAAI,WAAW,IAAI,CAAC;AAC5F,CAAC,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAkC,CAAC","sourcesContent":["import { sourceStringLiteral } from \"@gtkx/utils\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport type { ImportsBuilder } from \"../../writer/imports.js\";\nimport type { LazyElementSpec } from \"./element-prop-types.js\";\nimport { getDoc } from \"../gi/doc-spec.js\";\nimport { ancestorGlibNames, type GlibNamedClass } from \"./intrinsic-elements.js\";\n\ntype ElementComponent = { module: string; export: string };\ntype ElementComponentOverrides = Record<string, ElementComponent>;\n\ntype ExportCollector = {\n imports: ImportsBuilder;\n exportedNames: Set<string>;\n exportLines: string[];\n};\n\ntype CandidateExportOptions = {\n targetNamespace: GirNamespace;\n library: Library;\n virtualNames: Set<string>;\n intrinsicElements: GlibNamedClass[];\n components: Record<string, ElementComponent>;\n};\n\nconst generateElementComponentsSection = (\n targetNamespace: GirNamespace,\n library: Library,\n options: {\n imports: ImportsBuilder;\n lazyElements: LazyElementSpec[];\n intrinsicElements: GlibNamedClass[];\n components: ElementComponentOverrides;\n },\n): { source: string; exportedNames: Set<string> } => {\n const collector: ExportCollector = { imports: options.imports, exportedNames: new Set(), exportLines: [] };\n const lazyElements = options.lazyElements;\n const virtualNames = new Set(lazyElements.map((entry) => entry.element));\n\n collectCandidateExports(collector, {\n targetNamespace,\n library,\n virtualNames,\n intrinsicElements: options.intrinsicElements,\n components: options.components,\n });\n\n collectLazyElementExports(collector, lazyElements);\n const source = collector.exportLines.join(\"\\n\\n\");\n\n return { source, exportedNames: collector.exportedNames };\n};\n\nconst appendCandidateExport = (\n collector: ExportCollector,\n candidate: GlibNamedClass,\n options: CandidateExportOptions,\n): void => {\n const { targetNamespace, library, virtualNames, components } = options;\n\n if (candidate.namespace.name !== targetNamespace.name) {\n return;\n }\n\n if (virtualNames.has(candidate.glibName)) {\n return;\n }\n\n const line = renderCandidateExport(candidate, library, collector.imports, components);\n collector.exportLines.push(line);\n collector.exportedNames.add(candidate.glibName);\n};\n\nconst collectCandidateExports = (collector: ExportCollector, options: CandidateExportOptions): void => {\n for (const candidate of options.intrinsicElements) {\n if (candidate.klass.isAbstract) {\n continue;\n }\n\n appendCandidateExport(collector, candidate, options);\n }\n};\n\nconst collectLazyElementExports = (collector: ExportCollector, lazyElements: LazyElementSpec[]): void => {\n for (const spec of lazyElements) {\n collector.imports.addNamed(\"@gtkx/react/internal\", \"createElementComponent\", false);\n collector.imports.addNamed(\"react\", \"ReactNode\", true);\n collector.exportLines.push(renderLazyElementExport(spec));\n collector.exportedNames.add(spec.element);\n }\n};\n\nconst renderLazyElementExport = (spec: LazyElementSpec): string => {\n const doc = getDoc(spec);\n const factory = `createElementComponent(${sourceStringLiteral(spec.element)})`;\n const component = `${doc}export const ${spec.element}: (props: ${spec.typeName}) => ReactNode = ${factory};`;\n\n return `${doc}${spec.typeSource}\\n\\n${component}`;\n};\n\nconst renderCandidateExport = (\n candidate: GlibNamedClass,\n library: Library,\n imports: ImportsBuilder,\n components: Record<string, ElementComponent>,\n): string => {\n const { glibName, klass, namespace } = candidate;\n const ancestry = ancestorGlibNames(klass, namespace, library);\n const component = resolveElementComponent(ancestry, components);\n imports.addNamed(\"@gtkx/react/internal\", \"createElementComponent\", false);\n imports.addNamed(\"react\", \"ReactNode\", true);\n\n if (component !== undefined) {\n imports.addNamed(component.module, component.export, false);\n }\n\n const doc = getDoc(klass);\n\n return `${doc}${renderElementComponentExport(glibName, component)}`;\n};\n\nconst resolveElementComponent = (\n ancestry: string[],\n components: Record<string, ElementComponent>,\n): ElementComponent | undefined => {\n for (const name of ancestry) {\n const found = components[name];\n\n if (found !== undefined) {\n return found;\n }\n }\n\n return undefined;\n};\n\nconst renderElementComponentExport = (glibName: string, component: ElementComponent | undefined): string => {\n const propsType = `${glibName}Props`;\n const annotation = `(props: ${propsType}) => ReactNode`;\n const factoryCall = `createElementComponent(${sourceStringLiteral(glibName)})`;\n\n if (component === undefined) {\n return `export const ${glibName}: ${annotation} = ${factoryCall};`;\n }\n\n return `export const ${glibName}: ${annotation} = ${component.export}(${factoryCall});`;\n};\n\nexport { generateElementComponentsSection, type ElementComponentOverrides };\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Props interface a generated element's props extend, declared by hand in `@gtkx/react`. */
|
|
2
1
|
type ElementPropTypeRef = {
|
|
3
2
|
type: string;
|
|
4
3
|
module: string;
|
|
@@ -9,9 +8,7 @@ type ElementProps = Record<string, {
|
|
|
9
8
|
module: string;
|
|
10
9
|
export: string;
|
|
11
10
|
}>;
|
|
12
|
-
/** Installs the base props each element extends (GLib type name → `{ module, export }`); set once per run. */
|
|
13
11
|
declare const setElementProps: (props: ElementProps) => void;
|
|
14
|
-
/** The base props interface an element extends, when its element config declares one. */
|
|
15
12
|
declare const elementPropTypeFor: (glibName: string) => ElementPropTypeRef | undefined;
|
|
16
|
-
export { setElementProps, elementPropTypeFor, type
|
|
13
|
+
export { setElementProps, elementPropTypeFor, type ElementProps };
|
|
17
14
|
//# sourceMappingURL=element-prop-imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-prop-imports.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/element-prop-imports.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"element-prop-imports.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/element-prop-imports.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,kGAAkG;AAClG,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAIH,QAAA,MAAM,eAAe,GAAI,OAAO,YAAY,KAAG,IAM9C,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,kBAAkB,GAAG,SAInE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const elementProps = new Map();
|
|
2
|
-
/** Installs the base props each element extends (GLib type name → `{ module, export }`); set once per run. */
|
|
3
2
|
const setElementProps = (props) => {
|
|
4
3
|
elementProps.clear();
|
|
5
4
|
for (const [glibName, ref] of Object.entries(props)) {
|
|
6
5
|
elementProps.set(glibName, ref);
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
|
-
/** The base props interface an element extends, when its element config declares one. */
|
|
10
8
|
const elementPropTypeFor = (glibName) => {
|
|
11
9
|
const ref = elementProps.get(glibName);
|
|
12
10
|
return ref === undefined ? undefined : { type: glibName, module: ref.module, export: ref.export };
|