@gtkx/codegen 1.0.0-rc.4 → 1.1.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 +13 -9
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +80 -50
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +16 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +15 -3
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +4 -3
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +103 -58
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/interface-conflicts.d.ts +23 -0
- package/dist/analysis/interface-conflicts.d.ts.map +1 -0
- package/dist/analysis/interface-conflicts.js +144 -0
- package/dist/analysis/interface-conflicts.js.map +1 -0
- 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 +129 -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 +42 -16
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +10 -17
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-key.d.ts +5 -0
- package/dist/analysis/type-key.d.ts.map +1 -0
- package/dist/analysis/type-key.js +9 -0
- package/dist/analysis/type-key.js.map +1 -0
- 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 +12 -3
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -24
- 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 +17 -23
- 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 +36 -22
- 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.map +1 -1
- package/dist/docs/pipeline.js +87 -20
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +26 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +88 -25
- 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 +132 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +12 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +44 -28
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +1 -0
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +8 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +19 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +21 -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/cursor-overrides.d.ts +8 -0
- package/dist/gir/cursor-overrides.d.ts.map +1 -0
- package/dist/gir/cursor-overrides.js +6 -0
- package/dist/gir/cursor-overrides.js.map +1 -0
- package/dist/gir/emittable.d.ts +7 -0
- package/dist/gir/emittable.d.ts.map +1 -0
- package/dist/gir/emittable.js +3 -0
- package/dist/gir/emittable.js.map +1 -0
- 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 +28 -2
- 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 +35 -1
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +43 -1
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +8 -7
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +52 -1
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +8 -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 +9 -9
- 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/guards.d.ts +16 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +11 -0
- package/dist/guards.js.map +1 -0
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -1
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +11 -0
- package/dist/json.js.map +1 -0
- 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 +112 -27
- 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/parse.d.ts.map +1 -1
- package/dist/khronos/parse.js +3 -4
- package/dist/khronos/parse.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +4 -2
- 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 -9
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +3 -3
- 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 +6 -8
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +16 -0
- package/dist/runner.js.map +1 -1
- package/dist/staging.d.ts +5 -0
- package/dist/staging.d.ts.map +1 -0
- package/dist/staging.js +57 -0
- package/dist/staging.js.map +1 -0
- 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 +4 -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 +9 -2
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +35 -40
- 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 +10 -6
- 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 +63 -40
- 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/companion.d.ts.map +1 -1
- package/dist/store/gi/companion.js +6 -6
- package/dist/store/gi/companion.js.map +1 -1
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +12 -3
- 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 +52 -19
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts +1 -3
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +50 -29
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +4 -1
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +155 -26
- 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 +11 -2
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +80 -45
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +6 -2
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +54 -5
- 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 +23 -11
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts +2 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +7 -4
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +12 -5
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +98 -46
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts +8 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +34 -11
- 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 +8 -3
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts +6 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +9 -2
- 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 +21 -9
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +4 -4
- 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 +2 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +42 -37
- 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 +3 -2
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +19 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +257 -51
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +1 -0
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +15 -20
- package/dist/store/gi-store.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/generated-elements.d.ts +2 -1
- package/dist/store/jsx/generated-elements.d.ts.map +1 -1
- package/dist/store/jsx/generated-elements.js +13 -7
- package/dist/store/jsx/generated-elements.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 +10 -9
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.d.ts.map +1 -1
- package/dist/store/jsx/metadata.js +5 -3
- 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/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 +14 -3
- package/dist/store/resolve-store.d.ts.map +1 -1
- package/dist/store/resolve-store.js +98 -15
- package/dist/store/resolve-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +9 -6
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +59 -25
- package/dist/store/store-fs.js.map +1 -1
- package/dist/store/store-links.d.ts +3 -0
- package/dist/store/store-links.d.ts.map +1 -0
- package/dist/store/store-links.js +39 -0
- package/dist/store/store-links.js.map +1 -0
- package/dist/writer/comparison-context.d.ts +4 -0
- package/dist/writer/comparison-context.d.ts.map +1 -0
- package/dist/writer/comparison-context.js +13 -0
- package/dist/writer/comparison-context.js.map +1 -0
- package/dist/writer/context.d.ts +3 -2
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +11 -3
- 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 +17 -3
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +72 -3
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +7 -1
- package/dist/xml.d.ts.map +1 -1
- package/dist/xml.js +43 -1
- package/dist/xml.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 +15 -4
- package/src/analysis/descriptor-render.ts +130 -66
- package/src/analysis/descriptor.ts +35 -11
- package/src/analysis/inheritance.ts +166 -75
- package/src/analysis/interface-conflicts.ts +237 -0
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +169 -0
- package/src/analysis/param-structure.ts +85 -25
- package/src/analysis/ts-type.ts +13 -17
- package/src/analysis/type-key.ts +14 -0
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +110 -26
- package/src/docs/api-reference.ts +46 -34
- package/src/docs/element-page.ts +58 -49
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +131 -21
- package/src/docs/render.ts +153 -35
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +86 -32
- package/src/gi.ts +1 -0
- package/src/gir/ancestry.ts +31 -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/cursor-overrides.ts +12 -0
- package/src/gir/emittable.ts +8 -0
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -9
- package/src/gir/function.ts +60 -9
- package/src/gir/libraries.ts +11 -3
- package/src/gir/library.ts +52 -3
- package/src/gir/namespace.ts +49 -7
- package/src/gir/parameter.ts +62 -3
- package/src/gir/parse.ts +13 -9
- 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/guards.ts +23 -0
- package/src/internal.ts +2 -0
- package/src/json.ts +11 -0
- 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 +150 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/parse.ts +3 -4
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +4 -6
- 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 +20 -9
- package/src/staging.ts +69 -0
- package/src/store/compile-store.ts +7 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +58 -44
- package/src/store/gi/callback.ts +10 -9
- package/src/store/gi/class.ts +83 -49
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/companion.ts +7 -6
- package/src/store/gi/constant.ts +14 -5
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +75 -26
- package/src/store/gi/function.ts +72 -44
- package/src/store/gi/gtype-binding.ts +7 -2
- package/src/store/gi/interface.ts +244 -37
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +124 -69
- package/src/store/gi/param-marshal.ts +91 -6
- package/src/store/gi/pipeline.ts +28 -13
- package/src/store/gi/properties.ts +10 -5
- package/src/store/gi/property-accessor.ts +163 -75
- package/src/store/gi/record-constructor.ts +56 -19
- package/src/store/gi/record-field-accessor.ts +13 -4
- package/src/store/gi/record-layout.ts +12 -2
- package/src/store/gi/record.ts +24 -10
- package/src/store/gi/registration.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +54 -57
- package/src/store/gi/value-marshalable.ts +4 -2
- package/src/store/gi/vtable.ts +439 -61
- package/src/store/gi-store.ts +26 -31
- 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/generated-elements.ts +17 -8
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +11 -9
- package/src/store/jsx/metadata.ts +6 -3
- package/src/store/jsx/pipeline.ts +1 -1
- package/src/store/jsx/props.ts +20 -7
- package/src/store/jsx-store.ts +3 -3
- package/src/store/resolve-store.ts +133 -18
- package/src/store/store-fs.ts +87 -34
- package/src/store/store-links.ts +49 -0
- package/src/writer/comparison-context.ts +18 -0
- package/src/writer/context.ts +14 -4
- 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 +114 -4
- package/src/xml.ts +61 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sanitizeIdentifier, sanitizeTypeIdentifier, sortStrings, sortStringsBy } from "@gtkx/utils";
|
|
2
2
|
import type { GirClass } from "../gir/class.js";
|
|
3
3
|
import type { GirFunction } from "../gir/function.js";
|
|
4
4
|
import type { GirRecord } from "../gir/record.js";
|
|
5
|
+
import { isEmittableEntity } from "../gir/emittable.js";
|
|
5
6
|
import { Library } from "../gir/library.js";
|
|
6
7
|
import { type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
|
|
7
8
|
import { dedupeCallables, isEmittableCallable } from "../store/gi/callables.js";
|
|
@@ -9,7 +10,7 @@ import { namespaceFunctionExportName } from "../store/gi/function.js";
|
|
|
9
10
|
import { type ElementProps, setElementProps } from "../store/jsx/element-prop-imports.js";
|
|
10
11
|
import { collectIntrinsicElementClasses, type GlibNamedClass } from "../store/jsx/intrinsic-elements.js";
|
|
11
12
|
import { type OmittedProps, setOmittedProps } from "../store/jsx/omitted-props.js";
|
|
12
|
-
import {
|
|
13
|
+
import { type ElementPageContext, renderElementPage } from "./element-page.js";
|
|
13
14
|
import { docsSignatureContext, firstSentence, namespaceOrder } from "./render.js";
|
|
14
15
|
import { type GiSymbolEntry, renderSymbolPage, type SymbolPageOptions } from "./symbol-page.js";
|
|
15
16
|
|
|
@@ -34,7 +35,16 @@ type ApiSymbolQuery = {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
/** What an indexed symbol is: one of the GIR symbol kinds, or a JSX element. */
|
|
37
|
-
type ApiSymbolKind =
|
|
38
|
+
type ApiSymbolKind =
|
|
39
|
+
"alias" |
|
|
40
|
+
"callback" |
|
|
41
|
+
"class" |
|
|
42
|
+
"constant" |
|
|
43
|
+
"element" |
|
|
44
|
+
"enum" |
|
|
45
|
+
"function" |
|
|
46
|
+
"interface" |
|
|
47
|
+
"record";
|
|
38
48
|
|
|
39
49
|
/** An indexed symbol, without its reference page. */
|
|
40
50
|
type ApiSymbol = {
|
|
@@ -93,16 +103,30 @@ type ApiSearchOptions = {
|
|
|
93
103
|
limit?: number;
|
|
94
104
|
};
|
|
95
105
|
|
|
106
|
+
/** An indexed JSX element, carrying the widget class its page renders from. */
|
|
96
107
|
type ElementEntry = {
|
|
108
|
+
/** Discriminant marking the entry as a JSX element rather than a GIR symbol. */
|
|
97
109
|
kind: "element";
|
|
110
|
+
/** GIR namespace declaring the widget class. */
|
|
98
111
|
namespace: GirNamespace;
|
|
112
|
+
/** Element name, which is the class's GLib type name such as `GtkButton`. */
|
|
99
113
|
name: string;
|
|
114
|
+
/** Documentation text carried by the widget class's GIR node. */
|
|
100
115
|
doc: string | undefined;
|
|
116
|
+
/** The widget class the element is generated from. */
|
|
101
117
|
element: GlibNamedClass;
|
|
102
118
|
};
|
|
103
119
|
|
|
120
|
+
/** Anything the index holds: a GIR symbol or a JSX element. */
|
|
104
121
|
type SymbolEntry = GiSymbolEntry | ElementEntry;
|
|
105
|
-
|
|
122
|
+
|
|
123
|
+
/** A search hit: an indexed entry and how well its name answered the query. */
|
|
124
|
+
type ScoredEntry = {
|
|
125
|
+
/** Match strength, ranked best first: an exact name, then a prefix, then a substring. */
|
|
126
|
+
score: number;
|
|
127
|
+
/** The entry that matched. */
|
|
128
|
+
entry: SymbolEntry;
|
|
129
|
+
};
|
|
106
130
|
|
|
107
131
|
/** Every kind the reference indexes, in the order a namespace overview groups its symbols. */
|
|
108
132
|
const API_SYMBOL_KINDS: ApiSymbolKind[] = [
|
|
@@ -139,6 +163,9 @@ const compareNames = (a: string, b: string): number => {
|
|
|
139
163
|
return a > b ? 1 : 0;
|
|
140
164
|
};
|
|
141
165
|
|
|
166
|
+
const symbolKindSet = (kinds: ApiSymbolKind[] | undefined): Set<ApiSymbolKind> | undefined =>
|
|
167
|
+
kinds === undefined ? undefined : new Set(kinds);
|
|
168
|
+
|
|
142
169
|
const isQueriedEntry = (
|
|
143
170
|
entry: SymbolEntry,
|
|
144
171
|
namespaceFilter: string | undefined,
|
|
@@ -188,13 +215,13 @@ const functionEntry = (
|
|
|
188
215
|
};
|
|
189
216
|
|
|
190
217
|
const classEntry = (namespace: GirNamespace, klass: GirClass): GiSymbolEntry | undefined => {
|
|
191
|
-
if (!klass
|
|
218
|
+
if (!isEmittableEntity(klass)) {
|
|
192
219
|
return undefined;
|
|
193
220
|
}
|
|
194
221
|
|
|
195
222
|
const kind = klass.isInterface ? "interface" : "class";
|
|
196
223
|
|
|
197
|
-
return { kind, namespace, name:
|
|
224
|
+
return { kind, namespace, name: sanitizeTypeIdentifier(klass.name), doc: klass.doc, klass };
|
|
198
225
|
};
|
|
199
226
|
|
|
200
227
|
const classEntries = (namespace: GirNamespace): GiSymbolEntry[] => {
|
|
@@ -212,11 +239,11 @@ const classEntries = (namespace: GirNamespace): GiSymbolEntry[] => {
|
|
|
212
239
|
};
|
|
213
240
|
|
|
214
241
|
const recordEntry = (namespace: GirNamespace, record: GirRecord): GiSymbolEntry | undefined => {
|
|
215
|
-
if (
|
|
242
|
+
if (record.isVtable || !isEmittableEntity(record)) {
|
|
216
243
|
return undefined;
|
|
217
244
|
}
|
|
218
245
|
|
|
219
|
-
return { kind: "record", namespace, name: record.name, doc: record.doc, record };
|
|
246
|
+
return { kind: "record", namespace, name: sanitizeTypeIdentifier(record.name), doc: record.doc, record };
|
|
220
247
|
};
|
|
221
248
|
|
|
222
249
|
const recordEntries = (namespace: GirNamespace): GiSymbolEntry[] => {
|
|
@@ -239,7 +266,7 @@ const valueEntries = (namespace: GirNamespace): GiSymbolEntry[] => [
|
|
|
239
266
|
.map<GiSymbolEntry>((enumeration) => ({
|
|
240
267
|
kind: "enum",
|
|
241
268
|
namespace,
|
|
242
|
-
name: enumeration.name,
|
|
269
|
+
name: sanitizeTypeIdentifier(enumeration.name),
|
|
243
270
|
doc: enumeration.doc,
|
|
244
271
|
enumeration,
|
|
245
272
|
})),
|
|
@@ -248,21 +275,21 @@ const valueEntries = (namespace: GirNamespace): GiSymbolEntry[] => [
|
|
|
248
275
|
.map<GiSymbolEntry>((callback) => ({
|
|
249
276
|
kind: "callback",
|
|
250
277
|
namespace,
|
|
251
|
-
name: callback.name,
|
|
278
|
+
name: sanitizeTypeIdentifier(callback.name),
|
|
252
279
|
doc: callback.doc,
|
|
253
280
|
callback,
|
|
254
281
|
})),
|
|
255
282
|
...namespace.aliases.map<GiSymbolEntry>((alias) => ({
|
|
256
283
|
kind: "alias",
|
|
257
284
|
namespace,
|
|
258
|
-
name: alias.name,
|
|
285
|
+
name: sanitizeTypeIdentifier(alias.name),
|
|
259
286
|
doc: alias.doc,
|
|
260
287
|
alias,
|
|
261
288
|
})),
|
|
262
289
|
...namespace.constants.map<GiSymbolEntry>((constant) => ({
|
|
263
290
|
kind: "constant",
|
|
264
291
|
namespace,
|
|
265
|
-
name: constant.name,
|
|
292
|
+
name: sanitizeIdentifier(constant.name),
|
|
266
293
|
doc: constant.doc,
|
|
267
294
|
constant,
|
|
268
295
|
})),
|
|
@@ -280,29 +307,13 @@ const narrowToExactMatches = (candidates: SymbolEntry[], trimmed: string, isQual
|
|
|
280
307
|
return exact.length > 0 ? exact : candidates;
|
|
281
308
|
};
|
|
282
309
|
|
|
283
|
-
const isSearchFilterMatch = (
|
|
284
|
-
entry: SymbolEntry,
|
|
285
|
-
namespaceFilter: string | undefined,
|
|
286
|
-
kinds: ApiSymbolKind[] | undefined,
|
|
287
|
-
): boolean => {
|
|
288
|
-
if (namespaceFilter !== undefined && entry.namespace.name.toLowerCase() !== namespaceFilter) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (kinds !== undefined && !kinds.includes(entry.kind)) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return true;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
310
|
const getScoredEntry = (
|
|
300
311
|
entry: SymbolEntry,
|
|
301
312
|
query: string,
|
|
302
313
|
namespaceFilter: string | undefined,
|
|
303
|
-
kinds: ApiSymbolKind
|
|
314
|
+
kinds: Set<ApiSymbolKind> | undefined,
|
|
304
315
|
): ScoredEntry | undefined => {
|
|
305
|
-
if (!
|
|
316
|
+
if (!isQueriedEntry(entry, namespaceFilter, kinds)) {
|
|
306
317
|
return undefined;
|
|
307
318
|
}
|
|
308
319
|
|
|
@@ -355,12 +366,13 @@ class ApiReference {
|
|
|
355
366
|
private props: ElementProps;
|
|
356
367
|
private omittedProps: OmittedProps;
|
|
357
368
|
|
|
369
|
+
/** Indexes every symbol and JSX element in the GIR data the options point at. */
|
|
358
370
|
constructor(options: ApiReferenceOptions) {
|
|
359
371
|
this.libraries = options.libraries;
|
|
360
372
|
this.props = options.props ?? {};
|
|
361
373
|
this.omittedProps = options.omittedProps ?? {};
|
|
362
374
|
this.library = Library.load(options.libraries, options.girPath);
|
|
363
|
-
this.elementContext =
|
|
375
|
+
this.elementContext = { library: this.library, linkFor: (): string | undefined => undefined };
|
|
364
376
|
this.buildIndex();
|
|
365
377
|
}
|
|
366
378
|
|
|
@@ -484,7 +496,7 @@ class ApiReference {
|
|
|
484
496
|
private scoreEntries(
|
|
485
497
|
query: string,
|
|
486
498
|
namespaceFilter: string | undefined,
|
|
487
|
-
kinds: ApiSymbolKind
|
|
499
|
+
kinds: Set<ApiSymbolKind> | undefined,
|
|
488
500
|
): ScoredEntry[] {
|
|
489
501
|
const scored: ScoredEntry[] = [];
|
|
490
502
|
|
|
@@ -535,7 +547,7 @@ class ApiReference {
|
|
|
535
547
|
/** Every indexed symbol the query keeps, ordered by namespace (Gtk, then Adw, then alphabetically) and name. */
|
|
536
548
|
symbols(query: ApiSymbolQuery = {}): ApiSymbol[] {
|
|
537
549
|
const namespaceFilter = query.namespace?.toLowerCase();
|
|
538
|
-
const kinds =
|
|
550
|
+
const kinds = symbolKindSet(query.kinds);
|
|
539
551
|
|
|
540
552
|
return this.entries
|
|
541
553
|
.filter((entry) => isQueriedEntry(entry, namespaceFilter, kinds))
|
|
@@ -556,7 +568,7 @@ class ApiReference {
|
|
|
556
568
|
|
|
557
569
|
const limit = Math.max(1, Math.floor(options.limit ?? DEFAULT_SEARCH_LIMIT));
|
|
558
570
|
const namespaceFilter = options.namespace?.toLowerCase();
|
|
559
|
-
const scored = this.scoreEntries(query, namespaceFilter, options.kinds);
|
|
571
|
+
const scored = this.scoreEntries(query, namespaceFilter, symbolKindSet(options.kinds));
|
|
560
572
|
scored.sort(compareScoredEntries);
|
|
561
573
|
|
|
562
574
|
return scored.slice(0, limit).map((item) => this.toApiSymbol(item.entry));
|
package/src/docs/element-page.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toCamelIdentifier, upperFirst } from "@gtkx/utils";
|
|
2
2
|
import type { GirClass } from "../gir/class.js";
|
|
3
3
|
import type { Library } from "../gir/library.js";
|
|
4
|
+
import type { HandwrittenProp } from "./handwritten-props.js";
|
|
4
5
|
import { ancestorChain } from "../gir/ancestry.js";
|
|
5
6
|
import { type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
|
|
6
7
|
import { type GirProperty, isConstructableProperty } from "../gir/property.js";
|
|
8
|
+
import { annotationSpec } from "../store/gi/doc-spec.js";
|
|
7
9
|
import { elementPropTypeFor } from "../store/jsx/element-prop-imports.js";
|
|
8
|
-
import { buildGirIndex, type GirIndex } from "../store/jsx/gir-index.js";
|
|
9
10
|
import {
|
|
10
11
|
getGlibName,
|
|
11
12
|
type GlibNamedClass,
|
|
@@ -15,23 +16,31 @@ import {
|
|
|
15
16
|
} from "../store/jsx/intrinsic-elements.js";
|
|
16
17
|
import { isOmittedProp } from "../store/jsx/omitted-props.js";
|
|
17
18
|
import { isObjectProp } from "../store/jsx/props.js";
|
|
19
|
+
import { handwrittenPropsFor } from "./handwritten-props.js";
|
|
18
20
|
import {
|
|
21
|
+
annotationNotes,
|
|
19
22
|
classMethodEntries,
|
|
20
23
|
docMarkdown,
|
|
21
|
-
docsDefaultValue,
|
|
22
24
|
firstSentence,
|
|
23
25
|
implementsLine,
|
|
24
26
|
joinSections,
|
|
25
|
-
|
|
27
|
+
type MetaDocEntry,
|
|
26
28
|
methodsSectionBlocks,
|
|
27
29
|
originSignatureBlocks,
|
|
30
|
+
type OriginSignatureEntry,
|
|
31
|
+
propertyMetaLine,
|
|
32
|
+
qualifiedClassName,
|
|
28
33
|
renderDocsSignalSignature,
|
|
29
34
|
renderDocsType,
|
|
35
|
+
signalTags,
|
|
36
|
+
sortedMetaBlocks,
|
|
30
37
|
} from "./render.js";
|
|
31
38
|
|
|
39
|
+
/** Shared state an element's reference page renders from. */
|
|
32
40
|
type ElementPageContext = {
|
|
41
|
+
/** Parsed GIR the element, its ancestors, and the interfaces it implements are read from. */
|
|
33
42
|
library: Library;
|
|
34
|
-
|
|
43
|
+
/** Resolves a GLib type name to the URL of its page, undefined when it has none. */
|
|
35
44
|
linkFor: (glibName: string) => string | undefined;
|
|
36
45
|
};
|
|
37
46
|
|
|
@@ -42,24 +51,6 @@ type MemberOwner = {
|
|
|
42
51
|
glibName: string | undefined;
|
|
43
52
|
};
|
|
44
53
|
|
|
45
|
-
type PropEntry = {
|
|
46
|
-
name: string;
|
|
47
|
-
meta: string;
|
|
48
|
-
doc: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
type SignalEntry = {
|
|
52
|
-
name: string;
|
|
53
|
-
signature: string;
|
|
54
|
-
doc: string;
|
|
55
|
-
origin: string | undefined;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const createElementPageContext = (
|
|
59
|
-
library: Library,
|
|
60
|
-
linkFor: (glibName: string) => string | undefined,
|
|
61
|
-
): ElementPageContext => ({ library, girIndex: buildGirIndex(library), linkFor });
|
|
62
|
-
|
|
63
54
|
const frontmatter = (entry: GlibNamedClass): string => {
|
|
64
55
|
const sentence = firstSentence(entry.klass.doc);
|
|
65
56
|
const description = sentence.length > 0 ? sentence : `API reference for the ${entry.glibName} element.`;
|
|
@@ -86,7 +77,9 @@ const hierarchySection = (entry: GlibNamedClass, context: ElementPageContext): s
|
|
|
86
77
|
const parts = ancestors.map((ancestor) => {
|
|
87
78
|
const glib = getGlibName(ancestor.klass);
|
|
88
79
|
|
|
89
|
-
return glib === undefined
|
|
80
|
+
return glib === undefined
|
|
81
|
+
? `\`${qualifiedClassName(ancestor.namespaceName, ancestor.klass.name)}\``
|
|
82
|
+
: glibLabel(context, glib);
|
|
90
83
|
});
|
|
91
84
|
|
|
92
85
|
parts.push(`**${entry.glibName}**`);
|
|
@@ -120,29 +113,45 @@ const propertyEntry = (
|
|
|
120
113
|
owner: MemberOwner,
|
|
121
114
|
property: GirProperty,
|
|
122
115
|
jsName: string,
|
|
123
|
-
):
|
|
116
|
+
): MetaDocEntry => {
|
|
124
117
|
const isObject = isObjectProp(context.library, property);
|
|
125
118
|
const baseType = renderDocsType(context.library, property.type, false);
|
|
126
119
|
const type = isObject ? `${baseType} | ReactElement` : baseType;
|
|
127
|
-
const meta: string[] = [`\`${type}\``];
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
const accessNotes = isConstructableProperty(property)
|
|
122
|
+
? []
|
|
123
|
+
: [`read-only, observe with \`onNotify${upperFirst(jsName)}\``];
|
|
132
124
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
125
|
+
return {
|
|
126
|
+
name: jsName,
|
|
127
|
+
meta: propertyMetaLine({ type, property, accessNotes, origin: owner.origin }),
|
|
128
|
+
doc: docMarkdown(property.doc),
|
|
129
|
+
tags: annotationSpec(property.annotations),
|
|
130
|
+
};
|
|
131
|
+
};
|
|
136
132
|
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
const handwrittenPropMeta = (prop: HandwrittenProp, owner: MemberOwner): string =>
|
|
134
|
+
[`\`${prop.type}\``, ...(owner.origin === undefined ? [] : [`from \`${owner.origin}\``])].join(" · ");
|
|
135
|
+
|
|
136
|
+
const handwrittenPropEntries = (owner: MemberOwner, seen: Set<string>): MetaDocEntry[] => {
|
|
137
|
+
const declared = owner.glibName === undefined ? undefined : elementPropTypeFor(owner.glibName);
|
|
138
|
+
|
|
139
|
+
if (declared === undefined) {
|
|
140
|
+
return [];
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
const entries: MetaDocEntry[] = [];
|
|
144
|
+
|
|
145
|
+
for (const prop of handwrittenPropsFor(declared)) {
|
|
146
|
+
if (seen.has(prop.name)) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
seen.add(prop.name);
|
|
151
|
+
entries.push({ name: prop.name, meta: handwrittenPropMeta(prop, owner), doc: prop.doc });
|
|
143
152
|
}
|
|
144
153
|
|
|
145
|
-
return
|
|
154
|
+
return entries;
|
|
146
155
|
};
|
|
147
156
|
|
|
148
157
|
const propJsName = (property: GirProperty, owner: MemberOwner, seen: Set<string>): string | undefined => {
|
|
@@ -161,8 +170,8 @@ const propJsName = (property: GirProperty, owner: MemberOwner, seen: Set<string>
|
|
|
161
170
|
return jsName;
|
|
162
171
|
};
|
|
163
172
|
|
|
164
|
-
const ownerPropEntries = (context: ElementPageContext, owner: MemberOwner, seen: Set<string>):
|
|
165
|
-
const entries:
|
|
173
|
+
const ownerPropEntries = (context: ElementPageContext, owner: MemberOwner, seen: Set<string>): MetaDocEntry[] => {
|
|
174
|
+
const entries: MetaDocEntry[] = [...handwrittenPropEntries(owner, seen)];
|
|
166
175
|
|
|
167
176
|
for (const property of owner.klass.properties) {
|
|
168
177
|
const jsName = propJsName(property, owner, seen);
|
|
@@ -175,8 +184,8 @@ const ownerPropEntries = (context: ElementPageContext, owner: MemberOwner, seen:
|
|
|
175
184
|
return entries;
|
|
176
185
|
};
|
|
177
186
|
|
|
178
|
-
const propertyEntries = (entry: GlibNamedClass, context: ElementPageContext, seen: Set<string>):
|
|
179
|
-
const entries:
|
|
187
|
+
const propertyEntries = (entry: GlibNamedClass, context: ElementPageContext, seen: Set<string>): MetaDocEntry[] => {
|
|
188
|
+
const entries: MetaDocEntry[] = [];
|
|
180
189
|
|
|
181
190
|
for (const owner of memberOwners(entry, context)) {
|
|
182
191
|
entries.push(...ownerPropEntries(context, owner, seen));
|
|
@@ -200,9 +209,7 @@ const propsSection = (entry: GlibNamedClass, context: ElementPageContext, selfTy
|
|
|
200
209
|
return ["## Props", intro];
|
|
201
210
|
}
|
|
202
211
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return ["## Props", intro, ...sorted.map((item) => metaBlock(item.name, item.meta, item.doc))];
|
|
212
|
+
return ["## Props", intro, ...sortedMetaBlocks(entries)];
|
|
206
213
|
};
|
|
207
214
|
|
|
208
215
|
const ownerSignalEntries = (
|
|
@@ -210,8 +217,8 @@ const ownerSignalEntries = (
|
|
|
210
217
|
owner: MemberOwner,
|
|
211
218
|
selfType: string,
|
|
212
219
|
seen: Set<string>,
|
|
213
|
-
):
|
|
214
|
-
const entries:
|
|
220
|
+
): OriginSignatureEntry[] => {
|
|
221
|
+
const entries: OriginSignatureEntry[] = [];
|
|
215
222
|
|
|
216
223
|
for (const signal of owner.klass.signals) {
|
|
217
224
|
const name = signalHandlerName(signal.name);
|
|
@@ -226,6 +233,7 @@ const ownerSignalEntries = (
|
|
|
226
233
|
name,
|
|
227
234
|
signature: renderDocsSignalSignature(context.library, signal, selfType),
|
|
228
235
|
doc: docMarkdown(signal.doc),
|
|
236
|
+
tags: signalTags(signal, true),
|
|
229
237
|
origin: owner.origin,
|
|
230
238
|
});
|
|
231
239
|
}
|
|
@@ -235,7 +243,7 @@ const ownerSignalEntries = (
|
|
|
235
243
|
|
|
236
244
|
const signalsSection = (entry: GlibNamedClass, context: ElementPageContext, selfType: string): string[] => {
|
|
237
245
|
const seen: Set<string> = new Set();
|
|
238
|
-
const entries:
|
|
246
|
+
const entries: OriginSignatureEntry[] = [];
|
|
239
247
|
|
|
240
248
|
for (const owner of memberOwners(entry, context)) {
|
|
241
249
|
entries.push(...ownerSignalEntries(context, owner, selfType, seen));
|
|
@@ -260,12 +268,13 @@ const methodsSection = (entry: GlibNamedClass, context: ElementPageContext, self
|
|
|
260
268
|
};
|
|
261
269
|
|
|
262
270
|
const renderElementPage = (entry: GlibNamedClass, context: ElementPageContext): string => {
|
|
263
|
-
const selfType =
|
|
271
|
+
const selfType = qualifiedClassName(entry.namespace.name, entry.klass.name);
|
|
264
272
|
|
|
265
273
|
return joinSections([
|
|
266
274
|
frontmatter(entry),
|
|
267
275
|
`# ${entry.glibName}`,
|
|
268
276
|
docMarkdown(entry.klass.doc),
|
|
277
|
+
...annotationNotes(entry.klass.annotations),
|
|
269
278
|
importBlock(entry),
|
|
270
279
|
...hierarchySection(entry, context),
|
|
271
280
|
...propsSection(entry, context, selfType),
|
|
@@ -274,4 +283,4 @@ const renderElementPage = (entry: GlibNamedClass, context: ElementPageContext):
|
|
|
274
283
|
]);
|
|
275
284
|
};
|
|
276
285
|
|
|
277
|
-
export {
|
|
286
|
+
export { renderElementPage, type ElementPageContext };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { ModuleExport } from "@gtkx/react/config";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
|
|
5
|
+
type HandwrittenProp = {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
doc: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type AliasSite = {
|
|
12
|
+
sourceFile: ts.SourceFile;
|
|
13
|
+
declaration: ts.TypeAliasDeclaration;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type NamedBinding = ts.ImportSpecifier | ts.ExportSpecifier;
|
|
17
|
+
|
|
18
|
+
const RESOLUTION_OPTIONS: ts.CompilerOptions = {
|
|
19
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
20
|
+
customConditions: ["source"],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const CONTAINING_FILE = fileURLToPath(import.meta.url);
|
|
24
|
+
const WHITESPACE_RUN = /\s+/g;
|
|
25
|
+
const propsByRef: Map<string, HandwrittenProp[]> = new Map();
|
|
26
|
+
|
|
27
|
+
const moduleFileFor = (specifier: string, containingFile: string): string | undefined =>
|
|
28
|
+
ts.resolveModuleName(specifier, containingFile, RESOLUTION_OPTIONS, ts.sys).resolvedModule?.resolvedFileName;
|
|
29
|
+
|
|
30
|
+
const parseModule = (filePath: string): ts.SourceFile =>
|
|
31
|
+
ts.createSourceFile(filePath, ts.sys.readFile(filePath) ?? "", ts.ScriptTarget.Latest, true);
|
|
32
|
+
|
|
33
|
+
const specifierText = (node: ts.Expression | undefined): string | undefined =>
|
|
34
|
+
node !== undefined && ts.isStringLiteral(node) ? node.text : undefined;
|
|
35
|
+
|
|
36
|
+
const boundName = (elements: readonly NamedBinding[], name: string): string | undefined => {
|
|
37
|
+
for (const element of elements) {
|
|
38
|
+
if (element.name.text === name) {
|
|
39
|
+
return (element.propertyName ?? element.name).text;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const findAliasInModule = (specifier: string, sourceFile: ts.SourceFile, name: string): AliasSite | undefined => {
|
|
47
|
+
const filePath = moduleFileFor(specifier, sourceFile.fileName);
|
|
48
|
+
|
|
49
|
+
return filePath === undefined ? undefined : findAlias(parseModule(filePath), name);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const importedAlias = (
|
|
53
|
+
statement: ts.ImportDeclaration,
|
|
54
|
+
sourceFile: ts.SourceFile,
|
|
55
|
+
name: string,
|
|
56
|
+
): AliasSite | undefined => {
|
|
57
|
+
const bindings = statement.importClause?.namedBindings;
|
|
58
|
+
const specifier = specifierText(statement.moduleSpecifier);
|
|
59
|
+
|
|
60
|
+
if (specifier === undefined || bindings === undefined || !ts.isNamedImports(bindings)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const imported = boundName(bindings.elements, name);
|
|
65
|
+
|
|
66
|
+
return imported === undefined ? undefined : findAliasInModule(specifier, sourceFile, imported);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const exportedAlias = (
|
|
70
|
+
statement: ts.ExportDeclaration,
|
|
71
|
+
sourceFile: ts.SourceFile,
|
|
72
|
+
name: string,
|
|
73
|
+
): AliasSite | undefined => {
|
|
74
|
+
const specifier = specifierText(statement.moduleSpecifier);
|
|
75
|
+
|
|
76
|
+
if (specifier === undefined) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const clause = statement.exportClause;
|
|
81
|
+
|
|
82
|
+
if (clause === undefined) {
|
|
83
|
+
return findAliasInModule(specifier, sourceFile, name);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const exported = ts.isNamedExports(clause) ? boundName(clause.elements, name) : undefined;
|
|
87
|
+
|
|
88
|
+
return exported === undefined ? undefined : findAliasInModule(specifier, sourceFile, exported);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const statementAlias = (statement: ts.Statement, sourceFile: ts.SourceFile, name: string): AliasSite | undefined => {
|
|
92
|
+
if (ts.isTypeAliasDeclaration(statement)) {
|
|
93
|
+
return statement.name.text === name ? { sourceFile, declaration: statement } : undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (ts.isImportDeclaration(statement)) {
|
|
97
|
+
return importedAlias(statement, sourceFile, name);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return ts.isExportDeclaration(statement) ? exportedAlias(statement, sourceFile, name) : undefined;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const propType = (type: ts.TypeNode, sourceFile: ts.SourceFile): string => {
|
|
104
|
+
const parts: readonly ts.TypeNode[] = ts.isUnionTypeNode(type) ? type.types : [type];
|
|
105
|
+
|
|
106
|
+
return parts
|
|
107
|
+
.filter((part) => part.kind !== ts.SyntaxKind.UndefinedKeyword)
|
|
108
|
+
.map((part) => part.getText(sourceFile).replaceAll(WHITESPACE_RUN, " "))
|
|
109
|
+
.join(" | ");
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const propDoc = (member: ts.TypeElement): string => {
|
|
113
|
+
const comments = ts
|
|
114
|
+
.getJSDocCommentsAndTags(member)
|
|
115
|
+
.map((node) => (ts.isJSDoc(node) ? ts.getTextOfJSDocComment(node.comment) : undefined));
|
|
116
|
+
|
|
117
|
+
return comments.filter((text) => text !== undefined).join(" ").replaceAll(WHITESPACE_RUN, " ").trim();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const propertyProp = (member: ts.PropertySignature, sourceFile: ts.SourceFile): HandwrittenProp | undefined => {
|
|
121
|
+
const { name, type } = member;
|
|
122
|
+
|
|
123
|
+
if (type === undefined || !(ts.isIdentifier(name) || ts.isStringLiteral(name))) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return { name: name.text, type: propType(type, sourceFile), doc: propDoc(member) };
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const indexProp = (member: ts.IndexSignatureDeclaration, sourceFile: ts.SourceFile): HandwrittenProp | undefined => {
|
|
131
|
+
const keyType = member.parameters[0]?.type;
|
|
132
|
+
|
|
133
|
+
if (keyType === undefined) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
name: keyType.getText(sourceFile).replaceAll("`", ""),
|
|
139
|
+
type: propType(member.type, sourceFile),
|
|
140
|
+
doc: propDoc(member),
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const memberProp = (member: ts.TypeElement, sourceFile: ts.SourceFile): HandwrittenProp | undefined => {
|
|
145
|
+
if (ts.isPropertySignature(member)) {
|
|
146
|
+
return propertyProp(member, sourceFile);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return ts.isIndexSignatureDeclaration(member) ? indexProp(member, sourceFile) : undefined;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const literalProps = (type: ts.TypeLiteralNode, sourceFile: ts.SourceFile): HandwrittenProp[] => {
|
|
153
|
+
const props: HandwrittenProp[] = [];
|
|
154
|
+
|
|
155
|
+
for (const member of type.members) {
|
|
156
|
+
const prop = memberProp(member, sourceFile);
|
|
157
|
+
|
|
158
|
+
if (prop !== undefined) {
|
|
159
|
+
props.push(prop);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return props;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const referenceProps = (type: ts.TypeReferenceNode, sourceFile: ts.SourceFile): HandwrittenProp[] => {
|
|
167
|
+
if (!ts.isIdentifier(type.typeName)) {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const site = findAlias(sourceFile, type.typeName.text);
|
|
172
|
+
|
|
173
|
+
return site === undefined ? [] : typeNodeProps(site.declaration.type, site.sourceFile);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const declaredProps = (ref: ModuleExport): HandwrittenProp[] => {
|
|
177
|
+
const filePath = moduleFileFor(ref.module, CONTAINING_FILE);
|
|
178
|
+
|
|
179
|
+
if (filePath === undefined) {
|
|
180
|
+
throw new Error(`Cannot resolve ${ref.module}, which declares the ${ref.export} element props`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const site = findAlias(parseModule(filePath), ref.export);
|
|
184
|
+
|
|
185
|
+
if (site === undefined) {
|
|
186
|
+
throw new Error(`${ref.module} declares no type named ${ref.export}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return typeNodeProps(site.declaration.type, site.sourceFile);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const handwrittenPropsFor = (ref: ModuleExport): HandwrittenProp[] => {
|
|
193
|
+
const key = `${ref.module}#${ref.export}`;
|
|
194
|
+
const cached = propsByRef.get(key);
|
|
195
|
+
|
|
196
|
+
if (cached !== undefined) {
|
|
197
|
+
return cached;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const props = declaredProps(ref);
|
|
201
|
+
propsByRef.set(key, props);
|
|
202
|
+
|
|
203
|
+
return props;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
function findAlias(sourceFile: ts.SourceFile, name: string): AliasSite | undefined {
|
|
207
|
+
for (const statement of sourceFile.statements) {
|
|
208
|
+
const site = statementAlias(statement, sourceFile, name);
|
|
209
|
+
|
|
210
|
+
if (site !== undefined) {
|
|
211
|
+
return site;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function typeNodeProps(type: ts.TypeNode, sourceFile: ts.SourceFile): HandwrittenProp[] {
|
|
219
|
+
if (ts.isTypeLiteralNode(type)) {
|
|
220
|
+
return literalProps(type, sourceFile);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (ts.isIntersectionTypeNode(type)) {
|
|
224
|
+
return type.types.flatMap((part) => typeNodeProps(part, sourceFile));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return ts.isTypeReferenceNode(type) ? referenceProps(type, sourceFile) : [];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export { handwrittenPropsFor, type HandwrittenProp };
|