@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/src/docs/symbol-page.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { pascalCase, sortStringsBy } from "@gtkx/utils";
|
|
1
|
+
import { pascalCase, sortStringsBy, upperFirst } from "@gtkx/utils";
|
|
2
|
+
import type { GirAnnotations } from "../gir/annotations.js";
|
|
2
3
|
import type { GirClass } from "../gir/class.js";
|
|
3
|
-
import type { GirEnum } from "../gir/enum.js";
|
|
4
|
+
import type { EnumMember, GirEnum } from "../gir/enum.js";
|
|
4
5
|
import type { GirFunction } from "../gir/function.js";
|
|
5
6
|
import type { Library } from "../gir/library.js";
|
|
6
|
-
import type { GirProperty } from "../gir/property.js";
|
|
7
7
|
import type { GirRecord } from "../gir/record.js";
|
|
8
8
|
import type { ModuleContext } from "../writer/context.js";
|
|
9
|
+
import type { JsDocSpec } from "../writer/doc.js";
|
|
9
10
|
import { reservedSignalMemberRename } from "../analysis/inheritance.js";
|
|
10
11
|
import { renderTsType } from "../analysis/ts-type.js";
|
|
11
12
|
import { ancestorChain } from "../gir/ancestry.js";
|
|
12
13
|
import { callbackAsFunction, type GirCallback } from "../gir/callback.js";
|
|
13
14
|
import { type GirAlias, type GirConstant, type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
|
|
14
15
|
import { PRIMITIVE_TS_TYPE, primitiveCategory } from "../gir/primitives.js";
|
|
16
|
+
import { callableSpec } from "../store/gi/callable-doc.js";
|
|
15
17
|
import {
|
|
16
18
|
dedupeCallables,
|
|
17
19
|
indexMethodsByName,
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
renderStaticSignature,
|
|
22
24
|
} from "../store/gi/callables.js";
|
|
23
25
|
import { constantLiteral } from "../store/gi/constant.js";
|
|
26
|
+
import { annotationSpec } from "../store/gi/doc-spec.js";
|
|
24
27
|
import { enumMemberKey } from "../store/gi/enum.js";
|
|
25
28
|
import {
|
|
26
29
|
methodExportName,
|
|
@@ -31,41 +34,96 @@ import {
|
|
|
31
34
|
import { resolveAccessor, type ResolvedAccessor } from "../store/gi/property-accessor.js";
|
|
32
35
|
import { resolveRecordFieldEntry } from "../store/gi/record-field-accessor.js";
|
|
33
36
|
import { computeRecordFieldSlots } from "../store/gi/record-layout.js";
|
|
37
|
+
import { vfuncEntries } from "../store/gi/vtable.js";
|
|
34
38
|
import { implementedInterfaces, newlyImplementedInterfaces } from "../store/jsx/intrinsic-elements.js";
|
|
35
39
|
import {
|
|
40
|
+
annotationNotes,
|
|
36
41
|
classMethodEntries,
|
|
42
|
+
deprecationMeta,
|
|
37
43
|
docMarkdown,
|
|
38
|
-
docsDefaultValue,
|
|
39
44
|
docsSignatureContext,
|
|
40
45
|
firstSentence,
|
|
41
46
|
implementsLine,
|
|
42
47
|
joinSections,
|
|
43
|
-
|
|
48
|
+
type MetaDocEntry,
|
|
44
49
|
methodsSectionBlocks,
|
|
45
50
|
originSignatureBlocks,
|
|
51
|
+
type OriginSignatureEntry,
|
|
52
|
+
plainText,
|
|
53
|
+
propertyMetaLine,
|
|
46
54
|
renderDocsSignalHandlerType,
|
|
47
55
|
renderDocsType,
|
|
56
|
+
signalTags,
|
|
48
57
|
signatureBlock,
|
|
49
58
|
type SignatureEntry,
|
|
59
|
+
signatureEntryBlock,
|
|
60
|
+
sortedMetaBlocks,
|
|
61
|
+
tagNotes,
|
|
50
62
|
} from "./render.js";
|
|
51
63
|
|
|
64
|
+
/** What every indexed GIR symbol carries, whatever its kind. */
|
|
52
65
|
type GiSymbolBase = {
|
|
66
|
+
/** GIR namespace declaring the symbol. */
|
|
53
67
|
namespace: GirNamespace;
|
|
68
|
+
/** Name the bindings export it under: camelCase for functions, PascalCase for classes, the GIR name otherwise. */
|
|
54
69
|
name: string;
|
|
70
|
+
/** Raw gtk-doc text from the GIR, undefined when the symbol is undocumented. */
|
|
55
71
|
doc: string | undefined;
|
|
56
72
|
};
|
|
57
73
|
|
|
74
|
+
/** A GIR symbol the reference indexes, discriminated by `kind` and carrying the GIR node its page renders from. */
|
|
58
75
|
type GiSymbolEntry =
|
|
59
|
-
| (GiSymbolBase & {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
(GiSymbolBase & {
|
|
76
|
+
| (GiSymbolBase & {
|
|
77
|
+
/** Renders the class page: hierarchy, constructors, static methods, properties, signals, and methods. */
|
|
78
|
+
kind: "class" | "interface";
|
|
79
|
+
/** Supplies the ancestry, members, and, on an interface, the vtable slots an implementer fills. */
|
|
80
|
+
klass: GirClass;
|
|
81
|
+
}) |
|
|
82
|
+
(GiSymbolBase & {
|
|
83
|
+
/** Renders the record page, labeled `union` when the record is one. */
|
|
84
|
+
kind: "record";
|
|
85
|
+
/** Supplies the constructors, static methods, fields, and instance methods. */
|
|
86
|
+
record: GirRecord;
|
|
87
|
+
}) |
|
|
88
|
+
(GiSymbolBase & {
|
|
89
|
+
/** Renders the page for an enumeration, a flags type, or an error domain, as a table of members. */
|
|
90
|
+
kind: "enum";
|
|
91
|
+
/** Supplies the members, their values, and the GError domain when the enum carries one. */
|
|
92
|
+
enumeration: GirEnum;
|
|
93
|
+
}) |
|
|
94
|
+
(GiSymbolBase & {
|
|
95
|
+
/** Renders the callback page as a single function type signature. */
|
|
96
|
+
kind: "callback";
|
|
97
|
+
/** Supplies the parameters and return type the signature is rendered from. */
|
|
98
|
+
callback: GirCallback;
|
|
99
|
+
}) |
|
|
100
|
+
(GiSymbolBase & {
|
|
101
|
+
/** Renders the alias page as the type the alias resolves to. */
|
|
102
|
+
kind: "alias";
|
|
103
|
+
/** Supplies the target type the page prints. */
|
|
104
|
+
alias: GirAlias;
|
|
105
|
+
}) |
|
|
106
|
+
(GiSymbolBase & {
|
|
107
|
+
/** Renders the page for a namespace-level function, promisified when a finish function matches it. */
|
|
108
|
+
kind: "function";
|
|
109
|
+
/** Supplies the parameters and return type the signature is rendered from. */
|
|
110
|
+
fn: GirFunction;
|
|
111
|
+
}) |
|
|
112
|
+
(GiSymbolBase & {
|
|
113
|
+
/** Renders the page for a namespace-level constant, showing its type and literal value. */
|
|
114
|
+
kind: "constant";
|
|
115
|
+
/** Supplies the type and the value the literal is emitted from. */
|
|
116
|
+
constant: GirConstant;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
type ClassSymbol = GiSymbolBase & { klass: GirClass };
|
|
120
|
+
type ClassPageSymbol = ClassSymbol & { kind: "class" | "interface" };
|
|
66
121
|
|
|
122
|
+
/** What {@link renderSymbolPage} needs besides the entry itself. */
|
|
67
123
|
type SymbolPageOptions = {
|
|
124
|
+
/** Parsed GIR the page resolves ancestry, interfaces, and referenced types against. */
|
|
68
125
|
library: Library;
|
|
126
|
+
/** Looks up the JSX element a class is also available as, undefined when it has none. */
|
|
69
127
|
elementNameFor: (namespaceName: string, className: string) => string | undefined;
|
|
70
128
|
};
|
|
71
129
|
|
|
@@ -90,11 +148,10 @@ type PropertyAccessorSetup = {
|
|
|
90
148
|
methodByName: Map<string, GirFunction>;
|
|
91
149
|
};
|
|
92
150
|
|
|
93
|
-
type MetaDocEntry = { name: string; meta: string; doc: string };
|
|
94
|
-
type SignalDocEntry = { name: string; signature: string; doc: string; origin: string | undefined };
|
|
95
151
|
type ResolvedRecordField = NonNullable<ReturnType<typeof resolveRecordFieldEntry>>;
|
|
96
152
|
|
|
97
153
|
const qualifiedName = (entry: GiSymbolBase): string => `${entry.namespace.name}.${entry.name}`;
|
|
154
|
+
const pageTagNotes = (spec: JsDocSpec): string[] => tagNotes({ ...spec, deprecated: undefined, since: undefined });
|
|
98
155
|
|
|
99
156
|
const frontmatter = (entry: GiSymbolBase, kindLabel: string): string => {
|
|
100
157
|
const sentence = firstSentence(entry.doc);
|
|
@@ -109,18 +166,46 @@ const kindLine = (kindLabel: string, namespace: GirNamespace): string =>
|
|
|
109
166
|
const importBlock = (entry: GiSymbolBase): string =>
|
|
110
167
|
`\`\`\`ts\nimport * as ${entry.namespace.name} from "@gtkx/gi/${namespaceDirectory(entry.namespace)}";\n\`\`\``;
|
|
111
168
|
|
|
169
|
+
const entryAnnotations = (entry: GiSymbolEntry): GirAnnotations => {
|
|
170
|
+
switch (entry.kind) {
|
|
171
|
+
case "class":
|
|
172
|
+
case "interface": {
|
|
173
|
+
return entry.klass.annotations;
|
|
174
|
+
}
|
|
175
|
+
case "record": {
|
|
176
|
+
return entry.record.annotations;
|
|
177
|
+
}
|
|
178
|
+
case "enum": {
|
|
179
|
+
return entry.enumeration.annotations;
|
|
180
|
+
}
|
|
181
|
+
case "callback": {
|
|
182
|
+
return entry.callback.annotations;
|
|
183
|
+
}
|
|
184
|
+
case "alias": {
|
|
185
|
+
return entry.alias.annotations;
|
|
186
|
+
}
|
|
187
|
+
case "function": {
|
|
188
|
+
return entry.fn.annotations;
|
|
189
|
+
}
|
|
190
|
+
case "constant": {
|
|
191
|
+
return entry.constant.annotations;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
112
196
|
const pageHeader = (entry: GiSymbolEntry, kindLabel: string): string[] => [
|
|
113
197
|
frontmatter(entry, kindLabel),
|
|
114
198
|
`# ${qualifiedName(entry)}`,
|
|
115
199
|
kindLine(kindLabel, entry.namespace),
|
|
116
200
|
docMarkdown(entry.doc),
|
|
201
|
+
...annotationNotes(entryAnnotations(entry)),
|
|
117
202
|
importBlock(entry),
|
|
118
203
|
];
|
|
119
204
|
|
|
120
205
|
const qualifiedClassName = (namespaceName: string, className: string): string =>
|
|
121
206
|
`${namespaceName}.${pascalCase(className)}`;
|
|
122
207
|
|
|
123
|
-
const elementNote = (entry:
|
|
208
|
+
const elementNote = (entry: ClassSymbol, options: SymbolPageOptions): string[] => {
|
|
124
209
|
const glibName = options.elementNameFor(entry.namespace.name, entry.klass.name);
|
|
125
210
|
|
|
126
211
|
if (glibName === undefined) {
|
|
@@ -134,7 +219,7 @@ const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolP
|
|
|
134
219
|
];
|
|
135
220
|
};
|
|
136
221
|
|
|
137
|
-
const hierarchySection = (entry:
|
|
222
|
+
const hierarchySection = (entry: ClassSymbol, library: Library): string[] => {
|
|
138
223
|
const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).toReversed();
|
|
139
224
|
|
|
140
225
|
const interfaces = implementedInterfaces(entry.klass, entry.namespace, library).map((iface) =>
|
|
@@ -161,7 +246,7 @@ const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Li
|
|
|
161
246
|
return lines;
|
|
162
247
|
};
|
|
163
248
|
|
|
164
|
-
const prerequisitesLine = (entry:
|
|
249
|
+
const prerequisitesLine = (entry: ClassSymbol, library: Library): string[] => {
|
|
165
250
|
const names = entry.klass.prerequisites.map((name) => {
|
|
166
251
|
const resolved = library.resolveType(entry.namespace.name, name);
|
|
167
252
|
|
|
@@ -179,33 +264,86 @@ const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: L
|
|
|
179
264
|
return [`Requires ${names.join(", ")}.`];
|
|
180
265
|
};
|
|
181
266
|
|
|
267
|
+
const interfaceImplementingIntro = (entry: ClassSymbol): string => {
|
|
268
|
+
const qualified = qualifiedName(entry);
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
`A class fills these vtable slots to adopt the interface: declare \`implements ${qualified}Impl\` ` +
|
|
272
|
+
`on it and pass \`${qualified}\` in the \`implements\` option of \`registerClass\`. Every slot is ` +
|
|
273
|
+
"optional, and one the class leaves out keeps whatever the interface installs by default. The " +
|
|
274
|
+
"methods, properties, and signals above come from GLib dispatch."
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const classImplementingIntro = (entry: ClassSymbol): string => {
|
|
279
|
+
const qualified = qualifiedName(entry);
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
"A subclass declared with `registerClass` overrides these virtual methods to change what " +
|
|
283
|
+
`\`${qualified}\` does: define the slot as a method on the subclass and call \`super.<slot>(...)\` ` +
|
|
284
|
+
"to chain up to the inherited implementation. A slot the subclass leaves out keeps that " +
|
|
285
|
+
"implementation unchanged."
|
|
286
|
+
);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const implementingIntro = (entry: ClassPageSymbol): string =>
|
|
290
|
+
entry.kind === "interface" ? interfaceImplementingIntro(entry) : classImplementingIntro(entry);
|
|
291
|
+
|
|
292
|
+
const implementingSection = (entry: ClassPageSymbol, library: Library): string[] => {
|
|
293
|
+
const context = docsSignatureContext(entry.namespace, library);
|
|
294
|
+
const entries = vfuncEntries(context, entry.namespace.name, entry.klass);
|
|
295
|
+
|
|
296
|
+
if (entries.length === 0) {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const blocks = sortStringsBy(entries, (item) => item.name).map((item) =>
|
|
301
|
+
signatureBlock(item.name, item.signature, [docMarkdown(item.doc)]));
|
|
302
|
+
|
|
303
|
+
return ["## Implementing", implementingIntro(entry), ...blocks];
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const staticEntry = (options: StaticSectionOptions, callable: GirFunction): SignatureEntry | undefined => {
|
|
307
|
+
const signature = renderStaticSignature(options.context, callable, {
|
|
308
|
+
returnTypeOverride: options.returnTypeOverride,
|
|
309
|
+
siblings: options.siblings,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
if (signature === undefined) {
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const finishFn = matchStaticFinishFunction(options.context, callable, options.siblings);
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
name: signature.name,
|
|
320
|
+
signature: signature.signature,
|
|
321
|
+
doc: docMarkdown(callable.doc),
|
|
322
|
+
tags: callableSpec(options.context, callable, { finishFn }),
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
|
|
182
326
|
const staticSection = (options: StaticSectionOptions): string[] => {
|
|
183
|
-
const
|
|
327
|
+
const entries: SignatureEntry[] = [];
|
|
184
328
|
|
|
185
329
|
for (const callable of dedupeCallables(options.callables)) {
|
|
186
|
-
const
|
|
187
|
-
returnTypeOverride: options.returnTypeOverride,
|
|
188
|
-
siblings: options.siblings,
|
|
189
|
-
});
|
|
330
|
+
const entry = staticEntry(options, callable);
|
|
190
331
|
|
|
191
|
-
if (
|
|
192
|
-
|
|
332
|
+
if (entry !== undefined) {
|
|
333
|
+
entries.push(entry);
|
|
193
334
|
}
|
|
194
|
-
|
|
195
|
-
rendered.push({
|
|
196
|
-
name: signature.name,
|
|
197
|
-
block: signatureBlock(signature.name, signature.signature, [docMarkdown(callable.doc)]),
|
|
198
|
-
});
|
|
199
335
|
}
|
|
200
336
|
|
|
201
|
-
if (
|
|
337
|
+
if (entries.length === 0) {
|
|
202
338
|
return [];
|
|
203
339
|
}
|
|
204
340
|
|
|
205
|
-
|
|
341
|
+
const blocks = sortStringsBy(entries, (item) => item.name).map((item) => signatureEntryBlock(item));
|
|
342
|
+
|
|
343
|
+
return [options.title, options.intro, ...blocks];
|
|
206
344
|
};
|
|
207
345
|
|
|
208
|
-
const memberOwners = (entry:
|
|
346
|
+
const memberOwners = (entry: ClassSymbol, library: Library): MemberOwner[] => [
|
|
209
347
|
{ klass: entry.klass, namespace: entry.namespace, origin: undefined },
|
|
210
348
|
...newlyImplementedInterfaces(entry.klass, entry.namespace, library).map((iface) => ({
|
|
211
349
|
klass: iface.klass,
|
|
@@ -259,33 +397,14 @@ const propertyAccessorSetup = (
|
|
|
259
397
|
};
|
|
260
398
|
};
|
|
261
399
|
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (property.defaultValue !== undefined) {
|
|
266
|
-
meta.push(`default \`${docsDefaultValue(property.defaultValue)}\``);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (property.constructOnly) {
|
|
270
|
-
meta.push("construct-only");
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (!accessor.writable) {
|
|
274
|
-
meta.push("read-only");
|
|
275
|
-
} else if (!accessor.hasGetter) {
|
|
276
|
-
meta.push("write-only");
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (origin !== undefined) {
|
|
280
|
-
meta.push(`from \`${origin}\``);
|
|
400
|
+
const getAccessNotes = (accessor: ResolvedAccessor): string[] => {
|
|
401
|
+
if (!accessor.isWritable) {
|
|
402
|
+
return ["read-only"];
|
|
281
403
|
}
|
|
282
404
|
|
|
283
|
-
return
|
|
405
|
+
return accessor.hasGetter ? [] : ["write-only"];
|
|
284
406
|
};
|
|
285
407
|
|
|
286
|
-
const sortedMetaBlocks = (entries: MetaDocEntry[]): string[] =>
|
|
287
|
-
sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
|
|
288
|
-
|
|
289
408
|
const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup, seen: Set<string>): MetaDocEntry[] => {
|
|
290
409
|
const entries: MetaDocEntry[] = [];
|
|
291
410
|
|
|
@@ -305,18 +424,21 @@ const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup,
|
|
|
305
424
|
|
|
306
425
|
entries.push({
|
|
307
426
|
name: accessor.jsName,
|
|
308
|
-
meta:
|
|
427
|
+
meta: propertyMetaLine({
|
|
428
|
+
type: accessor.tsType,
|
|
429
|
+
property,
|
|
430
|
+
accessNotes: getAccessNotes(accessor),
|
|
431
|
+
origin: owner.origin,
|
|
432
|
+
}),
|
|
309
433
|
doc: docMarkdown(property.doc),
|
|
434
|
+
tags: annotationSpec(property.annotations),
|
|
310
435
|
});
|
|
311
436
|
}
|
|
312
437
|
|
|
313
438
|
return entries;
|
|
314
439
|
};
|
|
315
440
|
|
|
316
|
-
const propertiesSection = (
|
|
317
|
-
entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
|
|
318
|
-
library: Library,
|
|
319
|
-
): string[] => {
|
|
441
|
+
const propertiesSection = (entry: ClassPageSymbol, library: Library): string[] => {
|
|
320
442
|
const seen: Set<string> = new Set();
|
|
321
443
|
const entries: MetaDocEntry[] = [];
|
|
322
444
|
|
|
@@ -338,8 +460,8 @@ const propertiesSection = (
|
|
|
338
460
|
return ["## Properties", intro, ...sortedMetaBlocks(entries)];
|
|
339
461
|
};
|
|
340
462
|
|
|
341
|
-
const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>):
|
|
342
|
-
const entries:
|
|
463
|
+
const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): OriginSignatureEntry[] => {
|
|
464
|
+
const entries: OriginSignatureEntry[] = [];
|
|
343
465
|
|
|
344
466
|
for (const signal of owner.klass.signals) {
|
|
345
467
|
if (seen.has(signal.name)) {
|
|
@@ -352,6 +474,7 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
|
|
|
352
474
|
name: signal.name,
|
|
353
475
|
signature: renderDocsSignalHandlerType(library, signal),
|
|
354
476
|
doc: docMarkdown(signal.doc),
|
|
477
|
+
tags: signalTags(signal, false),
|
|
355
478
|
origin: owner.origin,
|
|
356
479
|
});
|
|
357
480
|
}
|
|
@@ -359,9 +482,9 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
|
|
|
359
482
|
return entries;
|
|
360
483
|
};
|
|
361
484
|
|
|
362
|
-
const signalsSection = (entry:
|
|
485
|
+
const signalsSection = (entry: ClassSymbol, library: Library): string[] => {
|
|
363
486
|
const seen: Set<string> = new Set();
|
|
364
|
-
const entries:
|
|
487
|
+
const entries: OriginSignatureEntry[] = [];
|
|
365
488
|
|
|
366
489
|
for (const owner of memberOwners(entry, library)) {
|
|
367
490
|
entries.push(...ownerSignalEntries(owner, library, seen));
|
|
@@ -378,16 +501,13 @@ const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Libr
|
|
|
378
501
|
return ["## Signals", intro, ...originSignatureBlocks(entries)];
|
|
379
502
|
};
|
|
380
503
|
|
|
381
|
-
const classMethodsSection = (entry:
|
|
504
|
+
const classMethodsSection = (entry: ClassSymbol, library: Library): string[] =>
|
|
382
505
|
methodsSectionBlocks(
|
|
383
506
|
classMethodEntries(library, entry.namespace, entry.klass),
|
|
384
507
|
"Methods are called on instances. Methods inherited from ancestors are documented on their own pages.",
|
|
385
508
|
);
|
|
386
509
|
|
|
387
|
-
const classPage = (
|
|
388
|
-
entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
|
|
389
|
-
options: SymbolPageOptions,
|
|
390
|
-
): string => {
|
|
510
|
+
const classPage = (entry: ClassPageSymbol, options: SymbolPageOptions): string => {
|
|
391
511
|
const { library } = options;
|
|
392
512
|
const qualified = qualifiedName(entry);
|
|
393
513
|
const docsContext = docsSignatureContext(entry.namespace, library);
|
|
@@ -417,6 +537,7 @@ const classPage = (
|
|
|
417
537
|
...propertiesSection(entry, library),
|
|
418
538
|
...signalsSection(entry, library),
|
|
419
539
|
...classMethodsSection(entry, library),
|
|
540
|
+
...implementingSection(entry, library),
|
|
420
541
|
]);
|
|
421
542
|
};
|
|
422
543
|
|
|
@@ -457,7 +578,12 @@ const recordInstanceEntries = (context: ModuleContext, record: GirRecord): Signa
|
|
|
457
578
|
continue;
|
|
458
579
|
}
|
|
459
580
|
|
|
460
|
-
entries.push({
|
|
581
|
+
entries.push({
|
|
582
|
+
name: rendered.name,
|
|
583
|
+
signature: rendered.signature,
|
|
584
|
+
doc: docMarkdown(callable.doc),
|
|
585
|
+
tags: callableSpec(context, callable, {}),
|
|
586
|
+
});
|
|
461
587
|
}
|
|
462
588
|
|
|
463
589
|
return sortStringsBy(entries, (item) => item.name);
|
|
@@ -495,7 +621,11 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
|
|
|
495
621
|
};
|
|
496
622
|
|
|
497
623
|
const fieldMeta = (field: ResolvedRecordField): string =>
|
|
498
|
-
[
|
|
624
|
+
[
|
|
625
|
+
`\`${field.tsType}\``,
|
|
626
|
+
...(field.isWritable ? [] : ["read-only"]),
|
|
627
|
+
...deprecationMeta(field.annotations),
|
|
628
|
+
].join(" · ");
|
|
499
629
|
|
|
500
630
|
const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames: Set<string>): string[] => {
|
|
501
631
|
const { slots } = computeRecordFieldSlots(context, record.fields, record.isUnion);
|
|
@@ -508,7 +638,12 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
|
|
|
508
638
|
continue;
|
|
509
639
|
}
|
|
510
640
|
|
|
511
|
-
entries.push({
|
|
641
|
+
entries.push({
|
|
642
|
+
name: field.jsName,
|
|
643
|
+
meta: fieldMeta(field),
|
|
644
|
+
doc: docMarkdown(field.doc),
|
|
645
|
+
tags: annotationSpec(field.annotations),
|
|
646
|
+
});
|
|
512
647
|
}
|
|
513
648
|
|
|
514
649
|
if (entries.length === 0) {
|
|
@@ -518,16 +653,23 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
|
|
|
518
653
|
return ["## Fields", ...sortedMetaBlocks(entries)];
|
|
519
654
|
};
|
|
520
655
|
|
|
656
|
+
const memberDescription = (member: EnumMember): string => {
|
|
657
|
+
const markers = deprecationMeta(member.annotations).map((note) => `**${upperFirst(note)}.**`);
|
|
658
|
+
|
|
659
|
+
return [...markers, plainText(member.doc)]
|
|
660
|
+
.filter((part) => part.length > 0)
|
|
661
|
+
.join(" ")
|
|
662
|
+
.replaceAll("|", String.raw`\|`);
|
|
663
|
+
};
|
|
664
|
+
|
|
521
665
|
const enumPage = (entry: GiSymbolBase & { kind: "enum"; enumeration: GirEnum }): string => {
|
|
522
666
|
const { enumeration } = entry;
|
|
523
667
|
const kindLabel = enumeration.errorDomain === undefined ? enumeration.kind : "error domain";
|
|
524
668
|
const qualified = qualifiedName(entry);
|
|
525
669
|
|
|
526
|
-
const rows = enumeration.members.map(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${description} |`;
|
|
530
|
-
});
|
|
670
|
+
const rows = enumeration.members.map(
|
|
671
|
+
(member) => `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${memberDescription(member)} |`,
|
|
672
|
+
);
|
|
531
673
|
|
|
532
674
|
const usage =
|
|
533
675
|
enumeration.errorDomain === undefined
|
|
@@ -546,7 +688,12 @@ const callbackPage = (entry: GiSymbolBase & { kind: "callback"; callback: GirCal
|
|
|
546
688
|
const parameters = renderMethodSignature(docsContext, fn);
|
|
547
689
|
const signature = `type ${entry.name} = (${parameters}) => ${renderMethodReturnType(docsContext, fn)}`;
|
|
548
690
|
|
|
549
|
-
return joinSections([
|
|
691
|
+
return joinSections([
|
|
692
|
+
...pageHeader(entry, "callback"),
|
|
693
|
+
"## Signature",
|
|
694
|
+
`\`\`\`ts\n${signature}\n\`\`\``,
|
|
695
|
+
...pageTagNotes(callableSpec(docsContext, fn, {})),
|
|
696
|
+
]);
|
|
550
697
|
};
|
|
551
698
|
|
|
552
699
|
const aliasPage = (entry: GiSymbolBase & { kind: "alias"; alias: GirAlias }, library: Library): string => {
|
|
@@ -571,9 +718,12 @@ const functionSignature = (context: ModuleContext, name: string, fn: GirFunction
|
|
|
571
718
|
|
|
572
719
|
const functionPage = (entry: GiSymbolBase & { kind: "function"; fn: GirFunction }, library: Library): string => {
|
|
573
720
|
const docsContext = docsSignatureContext(entry.namespace, library);
|
|
574
|
-
const
|
|
721
|
+
const siblings = entry.namespace.functions;
|
|
722
|
+
const signature = functionSignature(docsContext, entry.name, entry.fn, siblings);
|
|
723
|
+
const finishFn = matchStaticFinishFunction(docsContext, entry.fn, siblings);
|
|
724
|
+
const spec = callableSpec(docsContext, entry.fn, { finishFn });
|
|
575
725
|
|
|
576
|
-
return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n
|
|
726
|
+
return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``, ...pageTagNotes(spec)]);
|
|
577
727
|
};
|
|
578
728
|
|
|
579
729
|
const constantPage = (entry: GiSymbolBase & { kind: "constant"; constant: GirConstant }, library: Library): string => {
|
package/src/fingerprint.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { createRequire } from "node:module";
|
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
8
|
-
/** The freshness sentinel of the `@gtkx/gi` store, derived purely from the GIR inputs. */
|
|
9
8
|
type GiFingerprint = {
|
|
10
9
|
value: string;
|
|
11
10
|
girFiles: string[];
|
|
@@ -15,16 +14,14 @@ type GiFingerprint = {
|
|
|
15
14
|
|
|
16
15
|
type ModuleExport = { module: string; export: string };
|
|
17
16
|
|
|
18
|
-
/** The `@gtkx/react` element config that shapes the generated `@gtkx/jsx` store. */
|
|
19
17
|
type JsxFingerprintInput = {
|
|
20
18
|
reactVersion: string;
|
|
21
19
|
components: Record<string, ModuleExport>;
|
|
22
20
|
lazyElements: string[];
|
|
23
21
|
props: Record<string, ModuleExport>;
|
|
24
|
-
|
|
22
|
+
omittedProps: Record<string, string[]>;
|
|
25
23
|
};
|
|
26
24
|
|
|
27
|
-
/** The freshness sentinel of the `@gtkx/jsx` store, derived from the React element config. */
|
|
28
25
|
type JsxFingerprint = {
|
|
29
26
|
value: string;
|
|
30
27
|
intrinsicElementCount: number;
|
|
@@ -37,8 +34,6 @@ const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "o
|
|
|
37
34
|
|
|
38
35
|
const sortAlpha = (values: string[]): string => sortStrings(values).join(",");
|
|
39
36
|
|
|
40
|
-
// The overrides are copied verbatim into the store, so editing one changes the output even though no
|
|
41
|
-
// GIR file moved. Without them in the hash a stale override survives every non-forced run.
|
|
42
37
|
const overrideFiles = (): string[] => {
|
|
43
38
|
if (!existsSync(OVERRIDES_ROOT)) {
|
|
44
39
|
return [];
|
|
@@ -116,7 +111,7 @@ const hasMatchingRecordedInputs = (sentinel: GiFingerprint, libraries: string[],
|
|
|
116
111
|
const serializeModuleExports = (map: Record<string, ModuleExport>): [string, string, string][] =>
|
|
117
112
|
sortStrings(Object.keys(map)).map((type) => [type, map[type]?.module ?? "", map[type]?.export ?? ""]);
|
|
118
113
|
|
|
119
|
-
const
|
|
114
|
+
const serializeOmittedProps = (map: Record<string, string[]>): [string, string][] =>
|
|
120
115
|
sortStrings(Object.keys(map)).map((type) => [type, sortAlpha(map[type] ?? [])]);
|
|
121
116
|
|
|
122
117
|
const hashJsx = (input: JsxFingerprintInput): string =>
|
|
@@ -128,7 +123,7 @@ const hashJsx = (input: JsxFingerprintInput): string =>
|
|
|
128
123
|
serializeModuleExports(input.components),
|
|
129
124
|
sortStrings(input.lazyElements),
|
|
130
125
|
serializeModuleExports(input.props),
|
|
131
|
-
|
|
126
|
+
serializeOmittedProps(input.omittedProps),
|
|
132
127
|
]),
|
|
133
128
|
)
|
|
134
129
|
.digest("hex");
|
|
@@ -141,11 +136,11 @@ const computeJsxFingerprint = (input: JsxFingerprintInput, intrinsicElementCount
|
|
|
141
136
|
const jsxStoreFreshness = (
|
|
142
137
|
jsxStoreDir: string,
|
|
143
138
|
input: JsxFingerprintInput,
|
|
144
|
-
): {
|
|
139
|
+
): { isFresh: boolean; intrinsicElementCount: number } => {
|
|
145
140
|
const sentinelPath = join(jsxStoreDir, FINGERPRINT_FILENAME);
|
|
146
141
|
|
|
147
142
|
if (!existsSync(sentinelPath)) {
|
|
148
|
-
return {
|
|
143
|
+
return { isFresh: false, intrinsicElementCount: 0 };
|
|
149
144
|
}
|
|
150
145
|
|
|
151
146
|
let sentinel: JsxFingerprint;
|
|
@@ -153,12 +148,12 @@ const jsxStoreFreshness = (
|
|
|
153
148
|
try {
|
|
154
149
|
sentinel = JSON.parse(readFileSync(sentinelPath, "utf8")) as JsxFingerprint;
|
|
155
150
|
} catch {
|
|
156
|
-
return {
|
|
151
|
+
return { isFresh: false, intrinsicElementCount: 0 };
|
|
157
152
|
}
|
|
158
153
|
|
|
159
154
|
return sentinel.value === hashJsx(input)
|
|
160
|
-
? {
|
|
161
|
-
: {
|
|
155
|
+
? { isFresh: true, intrinsicElementCount: sentinel.intrinsicElementCount }
|
|
156
|
+
: { isFresh: false, intrinsicElementCount: 0 };
|
|
162
157
|
};
|
|
163
158
|
|
|
164
159
|
export {
|
|
@@ -169,5 +164,4 @@ export {
|
|
|
169
164
|
jsxStoreFreshness,
|
|
170
165
|
type GiFingerprint,
|
|
171
166
|
type JsxFingerprintInput,
|
|
172
|
-
type JsxFingerprint,
|
|
173
167
|
};
|
package/src/gi.ts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import type { Library } from "./gir/library.js";
|
|
2
|
+
import type { StoreOptions } from "./store/store-fs.js";
|
|
2
3
|
import { computeGiFingerprint } from "./fingerprint.js";
|
|
3
4
|
import { namespaceDirectory } from "./gir/namespace.js";
|
|
4
|
-
import { type GiNamespaceInput,
|
|
5
|
+
import { type GiNamespaceInput, writeGiStore } from "./store/gi-store.js";
|
|
5
6
|
import { generateNamespaceModule } from "./store/gi/pipeline.js";
|
|
6
7
|
|
|
7
8
|
type GiCodegenOptions = {
|
|
8
|
-
gi:
|
|
9
|
+
gi: StoreOptions;
|
|
9
10
|
libraries: string[];
|
|
10
11
|
girPath: string[];
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
* Generates the `@gtkx/gi` store from the loaded GIR library and links it into the project. This is the
|
|
15
|
-
* react-free half of codegen: it can run before `@gtkx/gi` (or `@gtkx/react`) exists, since it produces them.
|
|
16
|
-
*
|
|
17
|
-
* @returns The number of namespaces written.
|
|
18
|
-
*/
|
|
19
14
|
const runGiCodegen = (library: Library, options: GiCodegenOptions): number => {
|
|
20
15
|
const { gi, libraries, girPath } = options;
|
|
21
16
|
|
|
@@ -30,6 +25,4 @@ const runGiCodegen = (library: Library, options: GiCodegenOptions): number => {
|
|
|
30
25
|
return library.namespaces.size;
|
|
31
26
|
};
|
|
32
27
|
|
|
33
|
-
export {
|
|
34
|
-
export type { GiStoreOptions } from "./store/gi-store.js";
|
|
35
|
-
export { runGiCodegen, type GiCodegenOptions };
|
|
28
|
+
export { runGiCodegen };
|
package/src/gir/ancestry.ts
CHANGED
|
@@ -28,6 +28,20 @@ const resolveInterface = (
|
|
|
28
28
|
return resolved?.kind === "interface" ? getAncestor(resolved) : undefined;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
const resolveInterfaces = (library: Library, defaultNamespace: string, names: string[]): ResolvedAncestor[] => {
|
|
32
|
+
const interfaces: ResolvedAncestor[] = [];
|
|
33
|
+
|
|
34
|
+
for (const name of names) {
|
|
35
|
+
const iface = resolveInterface(library, defaultNamespace, name);
|
|
36
|
+
|
|
37
|
+
if (iface !== undefined) {
|
|
38
|
+
interfaces.push(iface);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return interfaces;
|
|
43
|
+
};
|
|
44
|
+
|
|
31
45
|
function* ancestorChain(library: Library, klass: GirClass, namespaceName: string): Generator<ResolvedAncestor> {
|
|
32
46
|
const visited: Set<string> = new Set();
|
|
33
47
|
let current: ResolvedAncestor | undefined = { klass, namespaceName };
|
|
@@ -50,4 +64,4 @@ function* ancestorChain(library: Library, klass: GirClass, namespaceName: string
|
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
|
|
53
|
-
export {
|
|
67
|
+
export { resolveInterfaces, ancestorChain, type ResolvedAncestor };
|