@gtkx/codegen 1.0.0-rc.4 → 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 +5 -5
- package/dist/analysis/descriptor-render.d.ts +8 -1
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +37 -24
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +1 -1
- package/dist/analysis/descriptor.d.ts.map +1 -1
- 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 +11 -4
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +40 -14
- package/dist/analysis/param-structure.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.map +1 -1
- package/dist/docs/api-reference.d.ts +2 -2
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +7 -14
- 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.js +2 -2
- 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 +84 -22
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +17 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +128 -43
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +1 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.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 -3
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -8
- 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/libraries.d.ts +1 -3
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +0 -1
- 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 -3
- 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.map +1 -1
- package/dist/gir/type-id.d.ts +35 -0
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +1 -0
- 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 +1 -0
- 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/khronos/args.d.ts +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +28 -6
- 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 +58 -27
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +3 -3
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +2 -2
- 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 +2 -2
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +1 -7
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +1 -1
- package/dist/store/compile-store.d.ts.map +1 -1
- 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 +12 -12
- 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 -2
- 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 +27 -12
- 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 +69 -26
- 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 +3 -1
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +6 -5
- 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 +3 -1
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +3 -2
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.js +1 -1
- 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/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 +14 -15
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -2
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +1 -1
- 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/jsx/element-components.d.ts +1 -1
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -4
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -3
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -1
- package/dist/store/jsx/element-prop-types.js.map +1 -1
- 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 +7 -6
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.js +2 -2
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +1 -1
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- 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 +14 -6
- package/dist/store/jsx/props.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 +48 -3
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +4 -4
- package/src/analysis/descriptor-render.ts +47 -28
- package/src/analysis/descriptor.ts +0 -3
- 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 +83 -23
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +1 -1
- package/src/docs/api-reference.ts +36 -25
- package/src/docs/element-page.ts +53 -47
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +2 -2
- package/src/docs/render.ts +146 -32
- package/src/docs/symbol-page.ts +224 -79
- package/src/fingerprint.ts +0 -1
- 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 -9
- package/src/gir/function.ts +15 -0
- package/src/gir/libraries.ts +11 -3
- package/src/gir/library.ts +51 -2
- package/src/gir/namespace.ts +41 -5
- package/src/gir/parameter.ts +47 -3
- 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 -3
- package/src/gir/type-id.ts +49 -3
- package/src/gir/type-ref.ts +1 -0
- package/src/gir/type.ts +50 -6
- package/src/khronos/args.ts +36 -13
- 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 +94 -41
- package/src/khronos/plan.ts +4 -5
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +2 -2
- package/src/runner.ts +1 -8
- package/src/store/compile-store.ts +1 -1
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +18 -12
- 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 -4
- 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 +43 -21
- package/src/store/gi/interface.ts +214 -26
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +98 -42
- 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 +9 -4
- package/src/store/gi/record-constructor.ts +6 -1
- package/src/store/gi/record-field-accessor.ts +5 -3
- package/src/store/gi/record-layout.ts +1 -1
- package/src/store/gi/record.ts +8 -2
- package/src/store/gi/registration.ts +3 -3
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +19 -20
- package/src/store/gi/value-marshalable.ts +1 -1
- package/src/store/gi/vtable.ts +361 -60
- package/src/store/jsx/element-components.ts +8 -5
- package/src/store/jsx/element-prop-imports.ts +1 -3
- package/src/store/jsx/element-prop-types.ts +10 -1
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +8 -6
- package/src/store/jsx/metadata.ts +2 -2
- package/src/store/jsx/pipeline.ts +1 -1
- package/src/store/jsx/props.ts +20 -7
- 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,22 +34,31 @@ 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
|
|
|
52
64
|
/** What every indexed GIR symbol carries, whatever its kind. */
|
|
@@ -61,16 +73,57 @@ type GiSymbolBase = {
|
|
|
61
73
|
|
|
62
74
|
/** A GIR symbol the reference indexes, discriminated by `kind` and carrying the GIR node its page renders from. */
|
|
63
75
|
type GiSymbolEntry =
|
|
64
|
-
| (GiSymbolBase & {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
(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" };
|
|
71
121
|
|
|
122
|
+
/** What {@link renderSymbolPage} needs besides the entry itself. */
|
|
72
123
|
type SymbolPageOptions = {
|
|
124
|
+
/** Parsed GIR the page resolves ancestry, interfaces, and referenced types against. */
|
|
73
125
|
library: Library;
|
|
126
|
+
/** Looks up the JSX element a class is also available as, undefined when it has none. */
|
|
74
127
|
elementNameFor: (namespaceName: string, className: string) => string | undefined;
|
|
75
128
|
};
|
|
76
129
|
|
|
@@ -95,11 +148,10 @@ type PropertyAccessorSetup = {
|
|
|
95
148
|
methodByName: Map<string, GirFunction>;
|
|
96
149
|
};
|
|
97
150
|
|
|
98
|
-
type MetaDocEntry = { name: string; meta: string; doc: string };
|
|
99
|
-
type SignalDocEntry = { name: string; signature: string; doc: string; origin: string | undefined };
|
|
100
151
|
type ResolvedRecordField = NonNullable<ReturnType<typeof resolveRecordFieldEntry>>;
|
|
101
152
|
|
|
102
153
|
const qualifiedName = (entry: GiSymbolBase): string => `${entry.namespace.name}.${entry.name}`;
|
|
154
|
+
const pageTagNotes = (spec: JsDocSpec): string[] => tagNotes({ ...spec, deprecated: undefined, since: undefined });
|
|
103
155
|
|
|
104
156
|
const frontmatter = (entry: GiSymbolBase, kindLabel: string): string => {
|
|
105
157
|
const sentence = firstSentence(entry.doc);
|
|
@@ -114,18 +166,46 @@ const kindLine = (kindLabel: string, namespace: GirNamespace): string =>
|
|
|
114
166
|
const importBlock = (entry: GiSymbolBase): string =>
|
|
115
167
|
`\`\`\`ts\nimport * as ${entry.namespace.name} from "@gtkx/gi/${namespaceDirectory(entry.namespace)}";\n\`\`\``;
|
|
116
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
|
+
|
|
117
196
|
const pageHeader = (entry: GiSymbolEntry, kindLabel: string): string[] => [
|
|
118
197
|
frontmatter(entry, kindLabel),
|
|
119
198
|
`# ${qualifiedName(entry)}`,
|
|
120
199
|
kindLine(kindLabel, entry.namespace),
|
|
121
200
|
docMarkdown(entry.doc),
|
|
201
|
+
...annotationNotes(entryAnnotations(entry)),
|
|
122
202
|
importBlock(entry),
|
|
123
203
|
];
|
|
124
204
|
|
|
125
205
|
const qualifiedClassName = (namespaceName: string, className: string): string =>
|
|
126
206
|
`${namespaceName}.${pascalCase(className)}`;
|
|
127
207
|
|
|
128
|
-
const elementNote = (entry:
|
|
208
|
+
const elementNote = (entry: ClassSymbol, options: SymbolPageOptions): string[] => {
|
|
129
209
|
const glibName = options.elementNameFor(entry.namespace.name, entry.klass.name);
|
|
130
210
|
|
|
131
211
|
if (glibName === undefined) {
|
|
@@ -139,7 +219,7 @@ const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolP
|
|
|
139
219
|
];
|
|
140
220
|
};
|
|
141
221
|
|
|
142
|
-
const hierarchySection = (entry:
|
|
222
|
+
const hierarchySection = (entry: ClassSymbol, library: Library): string[] => {
|
|
143
223
|
const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).toReversed();
|
|
144
224
|
|
|
145
225
|
const interfaces = implementedInterfaces(entry.klass, entry.namespace, library).map((iface) =>
|
|
@@ -166,7 +246,7 @@ const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Li
|
|
|
166
246
|
return lines;
|
|
167
247
|
};
|
|
168
248
|
|
|
169
|
-
const prerequisitesLine = (entry:
|
|
249
|
+
const prerequisitesLine = (entry: ClassSymbol, library: Library): string[] => {
|
|
170
250
|
const names = entry.klass.prerequisites.map((name) => {
|
|
171
251
|
const resolved = library.resolveType(entry.namespace.name, name);
|
|
172
252
|
|
|
@@ -184,33 +264,86 @@ const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: L
|
|
|
184
264
|
return [`Requires ${names.join(", ")}.`];
|
|
185
265
|
};
|
|
186
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
|
+
|
|
187
326
|
const staticSection = (options: StaticSectionOptions): string[] => {
|
|
188
|
-
const
|
|
327
|
+
const entries: SignatureEntry[] = [];
|
|
189
328
|
|
|
190
329
|
for (const callable of dedupeCallables(options.callables)) {
|
|
191
|
-
const
|
|
192
|
-
returnTypeOverride: options.returnTypeOverride,
|
|
193
|
-
siblings: options.siblings,
|
|
194
|
-
});
|
|
330
|
+
const entry = staticEntry(options, callable);
|
|
195
331
|
|
|
196
|
-
if (
|
|
197
|
-
|
|
332
|
+
if (entry !== undefined) {
|
|
333
|
+
entries.push(entry);
|
|
198
334
|
}
|
|
199
|
-
|
|
200
|
-
rendered.push({
|
|
201
|
-
name: signature.name,
|
|
202
|
-
block: signatureBlock(signature.name, signature.signature, [docMarkdown(callable.doc)]),
|
|
203
|
-
});
|
|
204
335
|
}
|
|
205
336
|
|
|
206
|
-
if (
|
|
337
|
+
if (entries.length === 0) {
|
|
207
338
|
return [];
|
|
208
339
|
}
|
|
209
340
|
|
|
210
|
-
|
|
341
|
+
const blocks = sortStringsBy(entries, (item) => item.name).map((item) => signatureEntryBlock(item));
|
|
342
|
+
|
|
343
|
+
return [options.title, options.intro, ...blocks];
|
|
211
344
|
};
|
|
212
345
|
|
|
213
|
-
const memberOwners = (entry:
|
|
346
|
+
const memberOwners = (entry: ClassSymbol, library: Library): MemberOwner[] => [
|
|
214
347
|
{ klass: entry.klass, namespace: entry.namespace, origin: undefined },
|
|
215
348
|
...newlyImplementedInterfaces(entry.klass, entry.namespace, library).map((iface) => ({
|
|
216
349
|
klass: iface.klass,
|
|
@@ -264,33 +397,14 @@ const propertyAccessorSetup = (
|
|
|
264
397
|
};
|
|
265
398
|
};
|
|
266
399
|
|
|
267
|
-
const
|
|
268
|
-
const meta: string[] = [`\`${accessor.tsType}\``];
|
|
269
|
-
|
|
270
|
-
if (property.defaultValue !== undefined) {
|
|
271
|
-
meta.push(`default \`${docsDefaultValue(property.defaultValue)}\``);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (property.constructOnly) {
|
|
275
|
-
meta.push("construct-only");
|
|
276
|
-
}
|
|
277
|
-
|
|
400
|
+
const getAccessNotes = (accessor: ResolvedAccessor): string[] => {
|
|
278
401
|
if (!accessor.isWritable) {
|
|
279
|
-
|
|
280
|
-
} else if (!accessor.hasGetter) {
|
|
281
|
-
meta.push("write-only");
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (origin !== undefined) {
|
|
285
|
-
meta.push(`from \`${origin}\``);
|
|
402
|
+
return ["read-only"];
|
|
286
403
|
}
|
|
287
404
|
|
|
288
|
-
return
|
|
405
|
+
return accessor.hasGetter ? [] : ["write-only"];
|
|
289
406
|
};
|
|
290
407
|
|
|
291
|
-
const sortedMetaBlocks = (entries: MetaDocEntry[]): string[] =>
|
|
292
|
-
sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
|
|
293
|
-
|
|
294
408
|
const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup, seen: Set<string>): MetaDocEntry[] => {
|
|
295
409
|
const entries: MetaDocEntry[] = [];
|
|
296
410
|
|
|
@@ -310,18 +424,21 @@ const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup,
|
|
|
310
424
|
|
|
311
425
|
entries.push({
|
|
312
426
|
name: accessor.jsName,
|
|
313
|
-
meta:
|
|
427
|
+
meta: propertyMetaLine({
|
|
428
|
+
type: accessor.tsType,
|
|
429
|
+
property,
|
|
430
|
+
accessNotes: getAccessNotes(accessor),
|
|
431
|
+
origin: owner.origin,
|
|
432
|
+
}),
|
|
314
433
|
doc: docMarkdown(property.doc),
|
|
434
|
+
tags: annotationSpec(property.annotations),
|
|
315
435
|
});
|
|
316
436
|
}
|
|
317
437
|
|
|
318
438
|
return entries;
|
|
319
439
|
};
|
|
320
440
|
|
|
321
|
-
const propertiesSection = (
|
|
322
|
-
entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
|
|
323
|
-
library: Library,
|
|
324
|
-
): string[] => {
|
|
441
|
+
const propertiesSection = (entry: ClassPageSymbol, library: Library): string[] => {
|
|
325
442
|
const seen: Set<string> = new Set();
|
|
326
443
|
const entries: MetaDocEntry[] = [];
|
|
327
444
|
|
|
@@ -343,8 +460,8 @@ const propertiesSection = (
|
|
|
343
460
|
return ["## Properties", intro, ...sortedMetaBlocks(entries)];
|
|
344
461
|
};
|
|
345
462
|
|
|
346
|
-
const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>):
|
|
347
|
-
const entries:
|
|
463
|
+
const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): OriginSignatureEntry[] => {
|
|
464
|
+
const entries: OriginSignatureEntry[] = [];
|
|
348
465
|
|
|
349
466
|
for (const signal of owner.klass.signals) {
|
|
350
467
|
if (seen.has(signal.name)) {
|
|
@@ -357,6 +474,7 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
|
|
|
357
474
|
name: signal.name,
|
|
358
475
|
signature: renderDocsSignalHandlerType(library, signal),
|
|
359
476
|
doc: docMarkdown(signal.doc),
|
|
477
|
+
tags: signalTags(signal, false),
|
|
360
478
|
origin: owner.origin,
|
|
361
479
|
});
|
|
362
480
|
}
|
|
@@ -364,9 +482,9 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
|
|
|
364
482
|
return entries;
|
|
365
483
|
};
|
|
366
484
|
|
|
367
|
-
const signalsSection = (entry:
|
|
485
|
+
const signalsSection = (entry: ClassSymbol, library: Library): string[] => {
|
|
368
486
|
const seen: Set<string> = new Set();
|
|
369
|
-
const entries:
|
|
487
|
+
const entries: OriginSignatureEntry[] = [];
|
|
370
488
|
|
|
371
489
|
for (const owner of memberOwners(entry, library)) {
|
|
372
490
|
entries.push(...ownerSignalEntries(owner, library, seen));
|
|
@@ -383,16 +501,13 @@ const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Libr
|
|
|
383
501
|
return ["## Signals", intro, ...originSignatureBlocks(entries)];
|
|
384
502
|
};
|
|
385
503
|
|
|
386
|
-
const classMethodsSection = (entry:
|
|
504
|
+
const classMethodsSection = (entry: ClassSymbol, library: Library): string[] =>
|
|
387
505
|
methodsSectionBlocks(
|
|
388
506
|
classMethodEntries(library, entry.namespace, entry.klass),
|
|
389
507
|
"Methods are called on instances. Methods inherited from ancestors are documented on their own pages.",
|
|
390
508
|
);
|
|
391
509
|
|
|
392
|
-
const classPage = (
|
|
393
|
-
entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
|
|
394
|
-
options: SymbolPageOptions,
|
|
395
|
-
): string => {
|
|
510
|
+
const classPage = (entry: ClassPageSymbol, options: SymbolPageOptions): string => {
|
|
396
511
|
const { library } = options;
|
|
397
512
|
const qualified = qualifiedName(entry);
|
|
398
513
|
const docsContext = docsSignatureContext(entry.namespace, library);
|
|
@@ -422,6 +537,7 @@ const classPage = (
|
|
|
422
537
|
...propertiesSection(entry, library),
|
|
423
538
|
...signalsSection(entry, library),
|
|
424
539
|
...classMethodsSection(entry, library),
|
|
540
|
+
...implementingSection(entry, library),
|
|
425
541
|
]);
|
|
426
542
|
};
|
|
427
543
|
|
|
@@ -462,7 +578,12 @@ const recordInstanceEntries = (context: ModuleContext, record: GirRecord): Signa
|
|
|
462
578
|
continue;
|
|
463
579
|
}
|
|
464
580
|
|
|
465
|
-
entries.push({
|
|
581
|
+
entries.push({
|
|
582
|
+
name: rendered.name,
|
|
583
|
+
signature: rendered.signature,
|
|
584
|
+
doc: docMarkdown(callable.doc),
|
|
585
|
+
tags: callableSpec(context, callable, {}),
|
|
586
|
+
});
|
|
466
587
|
}
|
|
467
588
|
|
|
468
589
|
return sortStringsBy(entries, (item) => item.name);
|
|
@@ -500,7 +621,11 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
|
|
|
500
621
|
};
|
|
501
622
|
|
|
502
623
|
const fieldMeta = (field: ResolvedRecordField): string =>
|
|
503
|
-
[
|
|
624
|
+
[
|
|
625
|
+
`\`${field.tsType}\``,
|
|
626
|
+
...(field.isWritable ? [] : ["read-only"]),
|
|
627
|
+
...deprecationMeta(field.annotations),
|
|
628
|
+
].join(" · ");
|
|
504
629
|
|
|
505
630
|
const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames: Set<string>): string[] => {
|
|
506
631
|
const { slots } = computeRecordFieldSlots(context, record.fields, record.isUnion);
|
|
@@ -513,7 +638,12 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
|
|
|
513
638
|
continue;
|
|
514
639
|
}
|
|
515
640
|
|
|
516
|
-
entries.push({
|
|
641
|
+
entries.push({
|
|
642
|
+
name: field.jsName,
|
|
643
|
+
meta: fieldMeta(field),
|
|
644
|
+
doc: docMarkdown(field.doc),
|
|
645
|
+
tags: annotationSpec(field.annotations),
|
|
646
|
+
});
|
|
517
647
|
}
|
|
518
648
|
|
|
519
649
|
if (entries.length === 0) {
|
|
@@ -523,16 +653,23 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
|
|
|
523
653
|
return ["## Fields", ...sortedMetaBlocks(entries)];
|
|
524
654
|
};
|
|
525
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
|
+
|
|
526
665
|
const enumPage = (entry: GiSymbolBase & { kind: "enum"; enumeration: GirEnum }): string => {
|
|
527
666
|
const { enumeration } = entry;
|
|
528
667
|
const kindLabel = enumeration.errorDomain === undefined ? enumeration.kind : "error domain";
|
|
529
668
|
const qualified = qualifiedName(entry);
|
|
530
669
|
|
|
531
|
-
const rows = enumeration.members.map(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${description} |`;
|
|
535
|
-
});
|
|
670
|
+
const rows = enumeration.members.map(
|
|
671
|
+
(member) => `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${memberDescription(member)} |`,
|
|
672
|
+
);
|
|
536
673
|
|
|
537
674
|
const usage =
|
|
538
675
|
enumeration.errorDomain === undefined
|
|
@@ -551,7 +688,12 @@ const callbackPage = (entry: GiSymbolBase & { kind: "callback"; callback: GirCal
|
|
|
551
688
|
const parameters = renderMethodSignature(docsContext, fn);
|
|
552
689
|
const signature = `type ${entry.name} = (${parameters}) => ${renderMethodReturnType(docsContext, fn)}`;
|
|
553
690
|
|
|
554
|
-
return joinSections([
|
|
691
|
+
return joinSections([
|
|
692
|
+
...pageHeader(entry, "callback"),
|
|
693
|
+
"## Signature",
|
|
694
|
+
`\`\`\`ts\n${signature}\n\`\`\``,
|
|
695
|
+
...pageTagNotes(callableSpec(docsContext, fn, {})),
|
|
696
|
+
]);
|
|
555
697
|
};
|
|
556
698
|
|
|
557
699
|
const aliasPage = (entry: GiSymbolBase & { kind: "alias"; alias: GirAlias }, library: Library): string => {
|
|
@@ -576,9 +718,12 @@ const functionSignature = (context: ModuleContext, name: string, fn: GirFunction
|
|
|
576
718
|
|
|
577
719
|
const functionPage = (entry: GiSymbolBase & { kind: "function"; fn: GirFunction }, library: Library): string => {
|
|
578
720
|
const docsContext = docsSignatureContext(entry.namespace, library);
|
|
579
|
-
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 });
|
|
580
725
|
|
|
581
|
-
return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n
|
|
726
|
+
return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``, ...pageTagNotes(spec)]);
|
|
582
727
|
};
|
|
583
728
|
|
|
584
729
|
const constantPage = (entry: GiSymbolBase & { kind: "constant"; constant: GirConstant }, library: Library): string => {
|
package/src/fingerprint.ts
CHANGED
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 };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { attr, getDoc, getDocDeprecated, isAttrTrue, nameAttr, type RawNode } from "./parse.js";
|
|
2
|
+
|
|
3
|
+
/** Release and deprecation annotations GIR carries on a documentable element. */
|
|
4
|
+
type GirAnnotations = {
|
|
5
|
+
/** Library release the symbol appeared in, from the `version` attribute. */
|
|
6
|
+
since: string | undefined;
|
|
7
|
+
/** Whether GIR marks the symbol deprecated. */
|
|
8
|
+
isDeprecated: boolean;
|
|
9
|
+
/** Release the symbol was deprecated in, from the `deprecated-version` attribute. */
|
|
10
|
+
deprecatedSince: string | undefined;
|
|
11
|
+
/** Prose from `<doc-deprecated>` naming what to use instead. */
|
|
12
|
+
deprecationDoc: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type DocumentedNode = {
|
|
16
|
+
name: string;
|
|
17
|
+
doc: string | undefined;
|
|
18
|
+
annotations: GirAnnotations;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const annotationsFromNode = (node: RawNode | undefined): GirAnnotations => ({
|
|
22
|
+
since: attr(node, "version"),
|
|
23
|
+
isDeprecated: isAttrTrue(node, "deprecated"),
|
|
24
|
+
deprecatedSince: attr(node, "deprecated-version"),
|
|
25
|
+
deprecationDoc: getDocDeprecated(node),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const documentedFromNode = (node: RawNode): DocumentedNode => ({
|
|
29
|
+
name: nameAttr(node),
|
|
30
|
+
doc: getDoc(node),
|
|
31
|
+
annotations: annotationsFromNode(node),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const hasAnnotations = (annotations: GirAnnotations): boolean =>
|
|
35
|
+
annotations.since !== undefined || annotations.isDeprecated || annotations.deprecatedSince !== undefined;
|
|
36
|
+
|
|
37
|
+
export { annotationsFromNode, documentedFromNode, hasAnnotations, type GirAnnotations };
|
package/src/gir/callback.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { RawNode } from "./parse.js";
|
|
|
3
3
|
import type { ParseContext } from "./type-id.js";
|
|
4
4
|
import { type GirCallable, parseCallable } from "./parameter.js";
|
|
5
5
|
|
|
6
|
+
/** The signature of a function pointer type GIR declares, whether named or anonymous. */
|
|
6
7
|
type GirCallback = GirCallable;
|
|
7
8
|
|
|
8
9
|
const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback => parseCallable(node, context);
|
|
@@ -10,6 +11,7 @@ const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback =>
|
|
|
10
11
|
const callbackAsFunction = (callback: GirCallback): GirFunction => ({
|
|
11
12
|
name: callback.name,
|
|
12
13
|
doc: callback.doc,
|
|
14
|
+
annotations: callback.annotations,
|
|
13
15
|
cIdentifier: undefined,
|
|
14
16
|
movedTo: undefined,
|
|
15
17
|
throws: callback.throws,
|