@gtkx/codegen 1.0.0-rc.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/dist/analysis/descriptor-render.d.ts +9 -4
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +51 -61
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +7 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +7 -7
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +1 -2
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +25 -22
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
- package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
- package/dist/analysis/nul-terminated-bytes.js +18 -0
- package/dist/analysis/nul-terminated-bytes.js.map +1 -0
- package/dist/analysis/param-capability.d.ts +5 -0
- package/dist/analysis/param-capability.d.ts.map +1 -0
- package/dist/analysis/param-capability.js +130 -0
- package/dist/analysis/param-capability.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +13 -6
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +44 -20
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +3 -5
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-shape.d.ts +8 -0
- package/dist/analysis/type-shape.d.ts.map +1 -0
- package/dist/analysis/type-shape.js +12 -0
- package/dist/analysis/type-shape.js.map +1 -0
- package/dist/compile.d.ts +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -1
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +79 -3
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +68 -13
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +4 -4
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +32 -20
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/handwritten-props.d.ts +9 -0
- package/dist/docs/handwritten-props.d.ts.map +1 -0
- package/dist/docs/handwritten-props.js +149 -0
- package/dist/docs/handwritten-props.js.map +1 -0
- package/dist/docs/pipeline.d.ts +4 -4
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +6 -6
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +25 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +90 -28
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +22 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +129 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +3 -6
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +6 -8
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +3 -11
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +0 -7
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +2 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +11 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +22 -0
- package/dist/gir/annotations.d.ts.map +1 -0
- package/dist/gir/annotations.js +15 -0
- package/dist/gir/annotations.js.map +1 -0
- package/dist/gir/callback.d.ts +1 -0
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +1 -0
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +32 -1
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +8 -3
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +21 -1
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +9 -9
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +19 -4
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -11
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -0
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +7 -0
- package/dist/gir/gir-path.d.ts.map +1 -1
- package/dist/gir/gir-path.js +7 -0
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/libraries.d.ts +13 -2
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +11 -0
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +36 -0
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +34 -0
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +38 -0
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +4 -5
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +39 -0
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +7 -7
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +3 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +6 -3
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +1 -0
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -0
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +3 -3
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +22 -0
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +3 -2
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +5 -4
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +0 -3
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +36 -1
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +2 -3
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +2 -1
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +20 -0
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/index.d.ts +18 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -0
- package/dist/jsx.d.ts +7 -12
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +18 -19
- package/dist/jsx.js.map +1 -1
- package/dist/khronos/args.d.ts +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +29 -7
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/doc-context.d.ts +29 -0
- package/dist/khronos/doc-context.d.ts.map +1 -0
- package/dist/khronos/doc-context.js +29 -0
- package/dist/khronos/doc-context.js.map +1 -0
- package/dist/khronos/extensions.d.ts +13 -0
- package/dist/khronos/extensions.d.ts.map +1 -0
- package/dist/khronos/extensions.js +49 -0
- package/dist/khronos/extensions.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +17 -11
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +104 -46
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +42 -3
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +218 -63
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +9 -6
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +96 -26
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/notes.d.ts +19 -0
- package/dist/khronos/notes.d.ts.map +1 -0
- package/dist/khronos/notes.js +35 -0
- package/dist/khronos/notes.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +1 -1
- package/dist/khronos/param-pair.d.ts.map +1 -1
- package/dist/khronos/param-pair.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +3 -1
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +59 -28
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +5 -5
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +8 -8
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +8 -6
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +35 -26
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +21 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +47 -34
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +16 -10
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js +22 -15
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +33 -21
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +19 -20
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +2 -3
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +2 -2
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callable-doc.d.ts +11 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -0
- package/dist/store/gi/callable-doc.js +62 -0
- package/dist/store/gi/callable-doc.js.map +1 -0
- package/dist/store/gi/callables.d.ts +3 -1
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +16 -16
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +2 -2
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +5 -3
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/closure-invocation.d.ts +4 -0
- package/dist/store/gi/closure-invocation.d.ts.map +1 -0
- package/dist/store/gi/closure-invocation.js +22 -0
- package/dist/store/gi/closure-invocation.js.map +1 -0
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +3 -4
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +18 -20
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/doc-spec.d.ts +14 -0
- package/dist/store/gi/doc-spec.d.ts.map +1 -0
- package/dist/store/gi/doc-spec.js +23 -0
- package/dist/store/gi/doc-spec.js.map +1 -0
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +29 -16
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +28 -17
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +130 -16
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +3 -5
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +9 -1
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +92 -47
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +4 -1
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +5 -1
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +3 -2
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +2 -2
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +4 -2
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +10 -11
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +3 -1
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +4 -2
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +6 -11
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +1 -5
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +3 -2
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +2 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.d.ts +1 -1
- package/dist/store/gi/return-wrap.d.ts.map +1 -1
- package/dist/store/gi/return-wrap.js +4 -4
- package/dist/store/gi/return-wrap.js.map +1 -1
- package/dist/store/gi/runtime-override.d.ts +2 -1
- package/dist/store/gi/runtime-override.d.ts.map +1 -1
- package/dist/store/gi/runtime-override.js +8 -5
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +27 -31
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -10
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +1 -10
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +16 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +214 -51
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +2 -3
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +1 -3
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -8
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -4
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js +0 -2
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -1
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -2
- package/dist/store/jsx/element-prop-types.js.map +1 -1
- package/dist/store/jsx/generated-elements.d.ts +29 -0
- package/dist/store/jsx/generated-elements.d.ts.map +1 -0
- package/dist/store/jsx/generated-elements.js +30 -0
- package/dist/store/jsx/generated-elements.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
- package/dist/store/jsx/intrinsic-elements.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +13 -12
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.js +9 -9
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/omitted-props.d.ts +2 -4
- package/dist/store/jsx/omitted-props.d.ts.map +1 -1
- package/dist/store/jsx/omitted-props.js +2 -4
- package/dist/store/jsx/omitted-props.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +4 -2
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- package/dist/store/jsx/pipeline.js +3 -2
- package/dist/store/jsx/pipeline.js.map +1 -1
- package/dist/store/jsx/props.d.ts +1 -7
- package/dist/store/jsx/props.d.ts.map +1 -1
- package/dist/store/jsx/props.js +16 -8
- package/dist/store/jsx/props.js.map +1 -1
- package/dist/store/jsx-store.d.ts +2 -3
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -3
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +28 -0
- package/dist/store/resolve-store.d.ts.map +1 -0
- package/dist/store/resolve-store.js +65 -0
- package/dist/store/resolve-store.js.map +1 -0
- package/dist/store/store-fs.d.ts +5 -1
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +6 -4
- package/dist/store/store-fs.js.map +1 -1
- package/dist/writer/context.d.ts +2 -1
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +3 -0
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc-tags.d.ts +21 -0
- package/dist/writer/doc-tags.d.ts.map +1 -0
- package/dist/writer/doc-tags.js +38 -0
- package/dist/writer/doc-tags.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +19 -6
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +64 -15
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/module.d.ts +8 -2
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +13 -1
- package/dist/writer/module.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +26 -0
- package/overrides/gobject/object.ts.ejs +56 -11
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +7 -11
- package/src/analysis/descriptor-render.ts +67 -73
- package/src/analysis/descriptor.ts +13 -16
- package/src/analysis/inheritance.ts +35 -34
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +172 -0
- package/src/analysis/param-structure.ts +90 -32
- package/src/analysis/ts-type.ts +4 -6
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +3 -2
- package/src/docs/api-reference.ts +162 -28
- package/src/docs/element-page.ts +53 -47
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +10 -10
- package/src/docs/render.ts +153 -39
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +8 -14
- package/src/gi.ts +4 -11
- package/src/gir/ancestry.ts +15 -1
- package/src/gir/annotations.ts +37 -0
- package/src/gir/callback.ts +2 -0
- package/src/gir/class.ts +42 -4
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -13
- package/src/gir/function.ts +15 -0
- package/src/gir/gir-path.ts +7 -0
- package/src/gir/libraries.ts +23 -2
- package/src/gir/library.ts +51 -2
- package/src/gir/namespace.ts +41 -5
- package/src/gir/parameter.ts +47 -7
- package/src/gir/parse.ts +8 -2
- package/src/gir/primitives.ts +1 -0
- package/src/gir/property.ts +18 -3
- package/src/gir/record.ts +24 -2
- package/src/gir/size.ts +8 -6
- package/src/gir/type-id.ts +51 -7
- package/src/gir/type-ref.ts +2 -1
- package/src/gir/type.ts +50 -6
- package/src/index.ts +18 -16
- package/src/internal.ts +2 -0
- package/src/jsx.ts +26 -26
- package/src/khronos/args.ts +37 -14
- package/src/khronos/doc-context.ts +62 -0
- package/src/khronos/extensions.ts +85 -0
- package/src/khronos/jsdoc.ts +152 -56
- package/src/khronos/model.ts +314 -69
- package/src/khronos/modules.ts +134 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +12 -13
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +21 -18
- package/src/runner.ts +51 -40
- package/src/store/compile-store.ts +4 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +23 -17
- package/src/store/gi/callback.ts +3 -2
- package/src/store/gi/class.ts +6 -3
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/constant.ts +3 -6
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +55 -20
- package/src/store/gi/function.ts +44 -26
- package/src/store/gi/interface.ts +214 -26
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +126 -68
- package/src/store/gi/param-marshal.ts +15 -1
- package/src/store/gi/pipeline.ts +7 -2
- package/src/store/gi/properties.ts +3 -2
- package/src/store/gi/property-accessor.ts +14 -11
- package/src/store/gi/record-constructor.ts +6 -1
- package/src/store/gi/record-field-accessor.ts +9 -13
- package/src/store/gi/record-layout.ts +1 -5
- package/src/store/gi/record.ts +8 -2
- package/src/store/gi/registration.ts +3 -3
- package/src/store/gi/return-wrap.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +36 -37
- package/src/store/gi/value-marshalable.ts +1 -10
- package/src/store/gi/vtable.ts +361 -60
- package/src/store/gi-store.ts +2 -4
- package/src/store/jsx/element-components.ts +8 -11
- package/src/store/jsx/element-prop-imports.ts +6 -5
- package/src/store/jsx/element-prop-types.ts +10 -2
- package/src/store/jsx/generated-elements.ts +60 -0
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +15 -13
- package/src/store/jsx/metadata.ts +10 -10
- package/src/store/jsx/omitted-props.ts +2 -4
- package/src/store/jsx/pipeline.ts +6 -4
- package/src/store/jsx/props.ts +22 -9
- package/src/store/jsx-store.ts +5 -7
- package/src/store/resolve-store.ts +100 -0
- package/src/store/store-fs.ts +12 -5
- package/src/writer/context.ts +5 -1
- package/src/writer/doc-tags.ts +70 -0
- package/src/writer/doc.ts +29 -6
- package/src/writer/gtk-doc.ts +82 -15
- package/src/writer/module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AO,CAAC,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { sortStringsBy, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirEnum } from \"../../gir/enum.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { PrimitiveCategory } from \"../../gir/primitives.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { GirType } from \"../../gir/type.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport {\n implementedInterfaces,\n isIntrinsicElementClass,\n iterateClassesWithGlibName,\n signalHandlerName,\n} from \"./intrinsic-elements.js\";\n\ntype IntrinsicElementEntry = {\n glibName: string;\n signals: [string, string][];\n constructOnly: string[];\n constructable: string[];\n defaults: [string, string][];\n};\n\ntype PropNameCollector = {\n keep: (property: GirProperty) => boolean;\n seen: Set<string>;\n names: string[];\n};\n\ntype DefaultPropsCollector = {\n library: Library;\n seen: Set<string>;\n defaults: [string, string][];\n};\n\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst FLOAT_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i;\n\nconst generateMetadata = (library: Library): string => {\n const intrinsicElements = collectIntrinsicElements(library);\n\n const signalsEntries = intrinsicElements.map(\n ({ glibName, signals }) => ` \"${glibName}\": ${renderSignalsObject(signals)},`,\n );\n\n const constructOnlyEntries = intrinsicElements\n .filter(({ constructOnly }) => constructOnly.length > 0)\n .map(({ glibName, constructOnly }) => ` \"${glibName}\": ${renderStringSet(constructOnly)},`);\n\n const constructableEntries = intrinsicElements\n .filter(({ constructable }) => constructable.length > 0)\n .map(({ glibName, constructable }) => ` \"${glibName}\": ${renderStringSet(constructable)},`);\n\n const defaultsEntries = intrinsicElements\n .filter(({ defaults }) => defaults.length > 0)\n .map(({ glibName, defaults }) => ` \"${glibName}\": ${renderDefaultsObject(defaults)},`);\n\n return `${[\n `export const SIGNALS: Record<string, Record<string, string>> = {\\n${signalsEntries.join(\"\\n\")}\\n};`,\n `export const CONSTRUCT_ONLY_PROPS: Record<string, Set<string>> = {\\n${constructOnlyEntries.join(\"\\n\")}\\n};`,\n `export const CONSTRUCT_PROPS: Record<string, Set<string>> = {\\n${constructableEntries.join(\"\\n\")}\\n};`,\n `export const DEFAULT_PROPS: Record<string, Record<string, unknown>> = {\\n${defaultsEntries.join(\"\\n\")}\\n};`,\n ].join(\"\\n\\n\")}\\n`;\n};\n\nconst collectIntrinsicElements = (library: Library): IntrinsicElementEntry[] => {\n const entries: IntrinsicElementEntry[] = [];\n\n for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {\n if (!isIntrinsicElementClass(klass, namespace, library)) {\n continue;\n }\n\n const sources: GirClass[] = [\n klass,\n ...implementedInterfaces(klass, namespace, library).map((entry) => entry.klass),\n ];\n\n entries.push({\n glibName,\n signals: collectSignals(sources),\n constructOnly: collectConstructOnly(sources),\n constructable: collectConstructable(sources),\n defaults: collectDefaultProps(library, sources),\n });\n }\n\n return sortStringsBy(entries, (entry) => entry.glibName);\n};\n\nconst collectSignalsFromSource = (source: GirClass, seen: Set<string>, signals: [string, string][]): void => {\n for (const signal of source.signals) {\n const handlerName = signalHandlerName(signal.name);\n\n if (seen.has(handlerName)) {\n continue;\n }\n\n seen.add(handlerName);\n signals.push([handlerName, signal.name] as const);\n }\n};\n\nconst collectSignals = (sources: GirClass[]): [string, string][] => {\n const seen: Set<string> = new Set();\n const signals: [string, string][] = [];\n\n for (const source of sources) {\n collectSignalsFromSource(source, seen, signals);\n }\n\n return signals;\n};\n\nconst collectPropNamesFromSource = (source: GirClass, collector: PropNameCollector): void => {\n const { keep, seen, names } = collector;\n\n for (const property of source.properties) {\n if (!keep(property)) {\n continue;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n continue;\n }\n\n seen.add(jsName);\n names.push(jsName);\n }\n};\n\nconst collectPropNames = (sources: GirClass[], shouldKeep: (property: GirProperty) => boolean): string[] => {\n const collector: PropNameCollector = { keep: shouldKeep, seen: new Set<string>(), names: [] };\n\n for (const source of sources) {\n collectPropNamesFromSource(source, collector);\n }\n\n return collector.names;\n};\n\nconst collectConstructOnly = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => property.constructOnly && property.introspectable);\n\nconst collectConstructable = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => isConstructableProperty(property) && property.introspectable);\n\nconst renderObjectLiteral = (entries: [string, string][], renderValue: (value: string) => string): string => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const lines = entries.map(([key, value]) => ` ${sourceStringLiteral(key)}: ${renderValue(value)}`);\n\n return `{\\n${lines.join(\",\\n\")}\\n }`;\n};\n\nconst renderStringSet = (names: string[]): string =>\n `new Set([${names.map((name) => sourceStringLiteral(name)).join(\",\")}])`;\n\nconst renderSignalsObject = (entries: [string, string][]): string => renderObjectLiteral(entries, sourceStringLiteral);\n\nconst collectDefaultsFromClass = (klass: GirClass, collector: DefaultPropsCollector): void => {\n for (const property of klass.properties) {\n const entry = defaultPropEntry(collector.library, klass, property, collector.seen);\n\n if (entry !== undefined) {\n collector.defaults.push(entry);\n }\n }\n};\n\nconst collectDefaultProps = (library: Library, sources: GirClass[]): [string, string][] => {\n const collector: DefaultPropsCollector = { library, seen: new Set<string>(), defaults: [] };\n\n for (const klass of sources) {\n collectDefaultsFromClass(klass, collector);\n }\n\n return collector.defaults;\n};\n\nconst isDefaultCandidate = (property: GirProperty): boolean =>\n (property.writable || property.construct) && !property.constructOnly && property.introspectable;\n\nconst defaultPropEntry = (\n library: Library,\n klass: GirClass,\n property: GirProperty,\n seen: Set<string>,\n): [string, string] | undefined => {\n if (!isDefaultCandidate(property)) {\n return undefined;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n return undefined;\n }\n\n seen.add(jsName);\n const literal = renderDefaultLiteral(library, klass, property);\n\n if (literal === undefined) {\n return undefined;\n }\n\n return [jsName, literal];\n};\n\nconst willSetterRejectNull = (library: Library, klass: GirClass, property: GirProperty): boolean => {\n if (property.setter === undefined) {\n return false;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return false;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value !== undefined && !value.parameter.nullable && !value.parameter.optional;\n};\n\nconst setterValueRef = (library: Library, klass: GirClass, property: GirProperty): TypeId | undefined => {\n if (property.setter === undefined) {\n return undefined;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return undefined;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value?.parameter.type;\n};\n\nconst renderDefaultLiteral = (library: Library, klass: GirClass, property: GirProperty): string | undefined => {\n if (property.defaultValue === \"NULL\" && willSetterRejectNull(library, klass, property)) {\n return undefined;\n }\n\n const ref = setterValueRef(library, klass, property) ?? property.type;\n\n return resolveDefaultLiteral(library, ref, property.defaultValue);\n};\n\nconst resolveDefaultLiteral = (\n library: Library,\n ref: TypeId | undefined,\n raw: string | undefined,\n): string | undefined => {\n if (raw === undefined) {\n return undefined;\n }\n\n if (raw === \"NULL\") {\n return \"null\";\n }\n\n if (ref === undefined) {\n return undefined;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n return resolveTypeDefaultLiteral(library, resolved, raw);\n};\n\nconst resolveTypeDefaultLiteral = (library: Library, resolved: GirType, raw: string): string | undefined => {\n if (resolved.kind === \"primitive\") {\n return primitiveDefaultLiteral(resolved.category, raw);\n }\n\n if (resolved.kind === \"enum\") {\n return enumDefaultLiteral(resolved.value, raw);\n }\n\n if (resolved.kind === \"alias\") {\n return resolveDefaultLiteral(library, resolved.value.target, raw);\n }\n\n return undefined;\n};\n\nconst booleanDefaultLiteral = (raw: string): string | undefined => {\n if (raw === \"TRUE\") {\n return \"true\";\n }\n\n if (raw === \"FALSE\") {\n return \"false\";\n }\n\n return undefined;\n};\n\nconst integerDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n return INTEGER_PATTERN.test(trimmed) ? trimmed : undefined;\n};\n\nconst floatDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (!FLOAT_PATTERN.test(trimmed)) {\n return undefined;\n }\n\n const value = Number(trimmed);\n\n return Number.isFinite(value) ? String(value) : undefined;\n};\n\nconst primitiveDefaultLiteral = (category: PrimitiveCategory, raw: string): string | undefined => {\n switch (category) {\n case \"boolean\": {\n return booleanDefaultLiteral(raw);\n }\n case \"int8\":\n case \"int16\":\n case \"int32\":\n case \"uint8\":\n case \"uint16\":\n case \"uint32\":\n case \"int64\":\n case \"uint64\":\n case \"unichar\": {\n return integerDefaultLiteral(raw);\n }\n case \"float32\":\n case \"float64\": {\n return floatDefaultLiteral(raw);\n }\n case \"string\": {\n return sourceStringLiteral(raw);\n }\n case \"bigint64\":\n case \"biguint64\":\n case \"gtype\": {\n return bigintDefaultLiteral(raw);\n }\n case \"pointer\":\n case \"void\": {\n return undefined;\n }\n }\n};\n\nconst bigintDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n return INTEGER_PATTERN.test(trimmed) ? `${trimmed}n` : undefined;\n};\n\nconst enumDefaultLiteral = (enumType: GirEnum, raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (INTEGER_PATTERN.test(trimmed)) {\n return trimmed;\n }\n\n const member = enumType.members.find((entry) => entry.cIdentifier === trimmed || entry.name === trimmed);\n\n return member?.value;\n};\n\nconst renderDefaultsObject = (entries: [string, string][]): string =>\n renderObjectLiteral(entries, (literal) => literal);\n\nexport { generateMetadata };\n"]}
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAA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AC;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC,CAAC,CAAC;YACV,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAsB,EAAE;IAC7D,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,QAAiB,EAAE,GAAW,EAAsB,EAAE;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAEzG,OAAO,MAAM,EAAE,KAAK,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAA2B,EAAU,EAAE,CACjE,mBAAmB,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { sortStringsBy, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirEnum } from \"../../gir/enum.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { PrimitiveCategory } from \"../../gir/primitives.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { GirType } from \"../../gir/type.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport {\n implementedInterfaces,\n isIntrinsicElementClass,\n iterateClassesWithGlibName,\n signalHandlerName,\n} from \"./intrinsic-elements.js\";\n\ntype IntrinsicElementEntry = {\n glibName: string;\n signals: [string, string][];\n constructOnly: string[];\n constructable: string[];\n defaults: [string, string][];\n};\n\ntype PropNameCollector = {\n shouldKeep: (property: GirProperty) => boolean;\n seen: Set<string>;\n names: string[];\n};\n\ntype DefaultPropsCollector = {\n library: Library;\n seen: Set<string>;\n defaults: [string, string][];\n};\n\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst FLOAT_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i;\n\nconst generateMetadata = (library: Library): string => {\n const intrinsicElements = collectIntrinsicElements(library);\n\n const signalsEntries = intrinsicElements.map(\n ({ glibName, signals }) => ` \"${glibName}\": ${renderSignalsObject(signals)},`,\n );\n\n const constructOnlyEntries = intrinsicElements\n .filter(({ constructOnly }) => constructOnly.length > 0)\n .map(({ glibName, constructOnly }) => ` \"${glibName}\": ${renderStringSet(constructOnly)},`);\n\n const constructableEntries = intrinsicElements\n .filter(({ constructable }) => constructable.length > 0)\n .map(({ glibName, constructable }) => ` \"${glibName}\": ${renderStringSet(constructable)},`);\n\n const defaultsEntries = intrinsicElements\n .filter(({ defaults }) => defaults.length > 0)\n .map(({ glibName, defaults }) => ` \"${glibName}\": ${renderDefaultsObject(defaults)},`);\n\n return `${[\n `export const signals: Record<string, Record<string, string>> = {\\n${signalsEntries.join(\"\\n\")}\\n};`,\n `export const constructOnlyProps: Record<string, Set<string>> = {\\n${constructOnlyEntries.join(\"\\n\")}\\n};`,\n `export const constructProps: Record<string, Set<string>> = {\\n${constructableEntries.join(\"\\n\")}\\n};`,\n `export const defaultProps: Record<string, Record<string, unknown>> = {\\n${defaultsEntries.join(\"\\n\")}\\n};`,\n ].join(\"\\n\\n\")}\\n`;\n};\n\nconst collectIntrinsicElements = (library: Library): IntrinsicElementEntry[] => {\n const entries: IntrinsicElementEntry[] = [];\n\n for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {\n if (!isIntrinsicElementClass(klass, namespace, library)) {\n continue;\n }\n\n const sources: GirClass[] = [\n klass,\n ...implementedInterfaces(klass, namespace, library).map((entry) => entry.klass),\n ];\n\n entries.push({\n glibName,\n signals: collectSignals(sources),\n constructOnly: collectConstructOnly(sources),\n constructable: collectConstructable(sources),\n defaults: collectDefaultProps(library, sources),\n });\n }\n\n return sortStringsBy(entries, (entry) => entry.glibName);\n};\n\nconst collectSignalsFromSource = (source: GirClass, seen: Set<string>, signals: [string, string][]): void => {\n for (const signal of source.signals) {\n const handlerName = signalHandlerName(signal.name);\n\n if (seen.has(handlerName)) {\n continue;\n }\n\n seen.add(handlerName);\n signals.push([handlerName, signal.name] as const);\n }\n};\n\nconst collectSignals = (sources: GirClass[]): [string, string][] => {\n const seen: Set<string> = new Set();\n const signals: [string, string][] = [];\n\n for (const source of sources) {\n collectSignalsFromSource(source, seen, signals);\n }\n\n return signals;\n};\n\nconst collectPropNamesFromSource = (source: GirClass, collector: PropNameCollector): void => {\n const { shouldKeep, seen, names } = collector;\n\n for (const property of source.properties) {\n if (!shouldKeep(property)) {\n continue;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n continue;\n }\n\n seen.add(jsName);\n names.push(jsName);\n }\n};\n\nconst collectPropNames = (sources: GirClass[], shouldKeep: (property: GirProperty) => boolean): string[] => {\n const collector: PropNameCollector = { shouldKeep, seen: new Set<string>(), names: [] };\n\n for (const source of sources) {\n collectPropNamesFromSource(source, collector);\n }\n\n return collector.names;\n};\n\nconst collectConstructOnly = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => property.constructOnly && property.introspectable);\n\nconst collectConstructable = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => isConstructableProperty(property) && property.introspectable);\n\nconst renderObjectLiteral = (entries: [string, string][], renderValue: (value: string) => string): string => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const lines = entries.map(([key, value]) => ` ${sourceStringLiteral(key)}: ${renderValue(value)}`);\n\n return `{\\n${lines.join(\",\\n\")}\\n }`;\n};\n\nconst renderStringSet = (names: string[]): string =>\n `new Set([${names.map((name) => sourceStringLiteral(name)).join(\",\")}])`;\n\nconst renderSignalsObject = (entries: [string, string][]): string => renderObjectLiteral(entries, sourceStringLiteral);\n\nconst collectDefaultsFromClass = (klass: GirClass, collector: DefaultPropsCollector): void => {\n for (const property of klass.properties) {\n const entry = defaultPropEntry(collector.library, klass, property, collector.seen);\n\n if (entry !== undefined) {\n collector.defaults.push(entry);\n }\n }\n};\n\nconst collectDefaultProps = (library: Library, sources: GirClass[]): [string, string][] => {\n const collector: DefaultPropsCollector = { library, seen: new Set<string>(), defaults: [] };\n\n for (const klass of sources) {\n collectDefaultsFromClass(klass, collector);\n }\n\n return collector.defaults;\n};\n\nconst isDefaultCandidate = (property: GirProperty): boolean =>\n (property.writable || property.construct) && !property.constructOnly && property.introspectable;\n\nconst defaultPropEntry = (\n library: Library,\n klass: GirClass,\n property: GirProperty,\n seen: Set<string>,\n): [string, string] | undefined => {\n if (!isDefaultCandidate(property)) {\n return undefined;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n return undefined;\n }\n\n seen.add(jsName);\n const literal = renderDefaultLiteral(library, klass, property);\n\n if (literal === undefined) {\n return undefined;\n }\n\n return [jsName, literal];\n};\n\nconst willSetterRejectNull = (library: Library, klass: GirClass, property: GirProperty): boolean => {\n if (property.setter === undefined) {\n return false;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return false;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value !== undefined && !value.parameter.nullable && !value.parameter.optional;\n};\n\nconst setterValueRef = (library: Library, klass: GirClass, property: GirProperty): TypeId | undefined => {\n if (property.setter === undefined) {\n return undefined;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return undefined;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value?.parameter.type;\n};\n\nconst renderDefaultLiteral = (library: Library, klass: GirClass, property: GirProperty): string | undefined => {\n if (property.defaultValue === \"NULL\" && willSetterRejectNull(library, klass, property)) {\n return undefined;\n }\n\n const ref = setterValueRef(library, klass, property) ?? property.type;\n\n return resolveDefaultLiteral(library, ref, property.defaultValue);\n};\n\nconst resolveDefaultLiteral = (\n library: Library,\n ref: TypeId | undefined,\n raw: string | undefined,\n): string | undefined => {\n if (raw === undefined) {\n return undefined;\n }\n\n if (raw === \"NULL\") {\n return \"null\";\n }\n\n if (ref === undefined) {\n return undefined;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n return resolveTypeDefaultLiteral(library, resolved, raw);\n};\n\nconst resolveTypeDefaultLiteral = (library: Library, resolved: GirType, raw: string): string | undefined => {\n if (resolved.kind === \"primitive\") {\n return primitiveDefaultLiteral(resolved.category, raw);\n }\n\n if (resolved.kind === \"enum\") {\n return enumDefaultLiteral(resolved.value, raw);\n }\n\n if (resolved.kind === \"alias\") {\n return resolveDefaultLiteral(library, resolved.value.target, raw);\n }\n\n return undefined;\n};\n\nconst booleanDefaultLiteral = (raw: string): string | undefined => {\n if (raw === \"TRUE\") {\n return \"true\";\n }\n\n if (raw === \"FALSE\") {\n return \"false\";\n }\n\n return undefined;\n};\n\nconst integerDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n return INTEGER_PATTERN.test(trimmed) ? trimmed : undefined;\n};\n\nconst floatDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (!FLOAT_PATTERN.test(trimmed)) {\n return undefined;\n }\n\n const value = Number(trimmed);\n\n return Number.isFinite(value) ? String(value) : undefined;\n};\n\nconst primitiveDefaultLiteral = (category: PrimitiveCategory, raw: string): string | undefined => {\n switch (category) {\n case \"boolean\": {\n return booleanDefaultLiteral(raw);\n }\n case \"int8\":\n case \"int16\":\n case \"int32\":\n case \"uint8\":\n case \"uint16\":\n case \"uint32\":\n case \"int64\":\n case \"uint64\":\n case \"unichar\": {\n return integerDefaultLiteral(raw);\n }\n case \"float32\":\n case \"float64\": {\n return floatDefaultLiteral(raw);\n }\n case \"string\": {\n return sourceStringLiteral(raw);\n }\n case \"bigint64\":\n case \"biguint64\":\n case \"gtype\": {\n return bigintDefaultLiteral(raw);\n }\n case \"pointer\":\n case \"void\": {\n return undefined;\n }\n }\n};\n\nconst bigintDefaultLiteral = (raw: string): string | undefined => {\n const integer = integerDefaultLiteral(raw);\n\n return integer === undefined ? undefined : `${integer}n`;\n};\n\nconst enumDefaultLiteral = (enumType: GirEnum, raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (INTEGER_PATTERN.test(trimmed)) {\n return trimmed;\n }\n\n const member = enumType.members.find((entry) => entry.cIdentifier === trimmed || entry.name === trimmed);\n\n return member?.value;\n};\n\nconst renderDefaultsObject = (entries: [string, string][]): string =>\n renderObjectLiteral(entries, (literal) => literal);\n\nexport { generateMetadata };\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/** Props left out of the generated element props, keyed by GLib type name. */
|
|
2
2
|
type OmittedProps = Record<string, string[]>;
|
|
3
|
-
/** Installs the props each element omits (GLib type name → prop names); set once per run. */
|
|
4
3
|
declare const setOmittedProps: (props: OmittedProps) => void;
|
|
5
|
-
/** Whether the element config declares this prop omitted for the type that declares the property. */
|
|
6
4
|
declare const isOmittedProp: (glibName: string | undefined, jsName: string) => boolean;
|
|
7
5
|
/** Merges omitted-prop maps keyed by GLib type name, concatenating the names each map contributes. */
|
|
8
|
-
declare const
|
|
9
|
-
export { setOmittedProps, isOmittedProp,
|
|
6
|
+
declare const mergeOmittedProps: (...maps: OmittedProps[]) => OmittedProps;
|
|
7
|
+
export { setOmittedProps, isOmittedProp, mergeOmittedProps, type OmittedProps };
|
|
10
8
|
//# sourceMappingURL=omitted-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omitted-props.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/omitted-props.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAI7C,
|
|
1
|
+
{"version":3,"file":"omitted-props.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/omitted-props.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAI7C,QAAA,MAAM,eAAe,GAAI,OAAO,YAAY,KAAG,IAM9C,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,QAAQ,MAAM,KAAG,OACQ,CAAC;AAE/E,sGAAsG;AACtG,QAAA,MAAM,iBAAiB,GAAI,GAAG,MAAM,YAAY,EAAE,KAAG,YAUpD,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
const omittedProps = new Map();
|
|
2
|
-
/** Installs the props each element omits (GLib type name → prop names); set once per run. */
|
|
3
2
|
const setOmittedProps = (props) => {
|
|
4
3
|
omittedProps.clear();
|
|
5
4
|
for (const [glibName, names] of Object.entries(props)) {
|
|
6
5
|
omittedProps.set(glibName, new Set(names));
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
|
-
/** Whether the element config declares this prop omitted for the type that declares the property. */
|
|
10
8
|
const isOmittedProp = (glibName, jsName) => glibName !== undefined && omittedProps.get(glibName)?.has(jsName) === true;
|
|
11
9
|
/** Merges omitted-prop maps keyed by GLib type name, concatenating the names each map contributes. */
|
|
12
|
-
const
|
|
10
|
+
const mergeOmittedProps = (...maps) => {
|
|
13
11
|
const merged = {};
|
|
14
12
|
for (const map of maps) {
|
|
15
13
|
for (const [glibName, names] of Object.entries(map)) {
|
|
@@ -18,5 +16,5 @@ const mergeOmitProps = (...maps) => {
|
|
|
18
16
|
}
|
|
19
17
|
return merged;
|
|
20
18
|
};
|
|
21
|
-
export { setOmittedProps, isOmittedProp,
|
|
19
|
+
export { setOmittedProps, isOmittedProp, mergeOmittedProps };
|
|
22
20
|
//# sourceMappingURL=omitted-props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omitted-props.js","sourceRoot":"","sources":["../../../src/store/jsx/omitted-props.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"omitted-props.js","sourceRoot":"","sources":["../../../src/store/jsx/omitted-props.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;AAEzD,MAAM,eAAe,GAAG,CAAC,KAAmB,EAAQ,EAAE;IAClD,YAAY,CAAC,KAAK,EAAE,CAAC;IAErB,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,QAA4B,EAAE,MAAc,EAAW,EAAE,CAC5E,QAAQ,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAE/E,sGAAsG;AACtG,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAoB,EAAgB,EAAE;IAChE,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAClD,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAqB,CAAC","sourcesContent":["/** Props left out of the generated element props, keyed by GLib type name. */\ntype OmittedProps = Record<string, string[]>;\n\nconst omittedProps: Map<string, Set<string>> = new Map();\n\nconst setOmittedProps = (props: OmittedProps): void => {\n omittedProps.clear();\n\n for (const [glibName, names] of Object.entries(props)) {\n omittedProps.set(glibName, new Set(names));\n }\n};\n\nconst isOmittedProp = (glibName: string | undefined, jsName: string): boolean =>\n glibName !== undefined && omittedProps.get(glibName)?.has(jsName) === true;\n\n/** Merges omitted-prop maps keyed by GLib type name, concatenating the names each map contributes. */\nconst mergeOmittedProps = (...maps: OmittedProps[]): OmittedProps => {\n const merged: OmittedProps = {};\n\n for (const map of maps) {\n for (const [glibName, names] of Object.entries(map)) {\n merged[glibName] = [...(merged[glibName] ?? []), ...names];\n }\n }\n\n return merged;\n};\n\nexport { setOmittedProps, isOmittedProp, mergeOmittedProps, type OmittedProps };\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Library } from "../../gir/library.js";
|
|
2
2
|
import { type ElementComponentOverrides } from "./element-components.js";
|
|
3
3
|
import { type ElementProps } from "./element-prop-imports.js";
|
|
4
|
+
import { type GeneratedElement } from "./generated-elements.js";
|
|
4
5
|
import { type OmittedProps } from "./omitted-props.js";
|
|
5
6
|
type JsxNamespaceFile = {
|
|
6
7
|
directory: string;
|
|
@@ -10,14 +11,15 @@ type JsxFiles = {
|
|
|
10
11
|
namespaces: JsxNamespaceFile[];
|
|
11
12
|
metadata: string;
|
|
12
13
|
intrinsicElementCount: number;
|
|
14
|
+
elements: GeneratedElement[];
|
|
13
15
|
};
|
|
14
16
|
type JsxGenerationOptions = {
|
|
15
17
|
reactSubexports?: string[];
|
|
16
18
|
components?: ElementComponentOverrides;
|
|
17
19
|
props?: ElementProps;
|
|
18
|
-
|
|
20
|
+
omittedProps?: OmittedProps;
|
|
19
21
|
lazyElements?: string[];
|
|
20
22
|
};
|
|
21
23
|
declare const generateJsxFiles: (library: Library, options?: JsxGenerationOptions) => JsxFiles;
|
|
22
|
-
export { generateJsxFiles, type JsxNamespaceFile
|
|
24
|
+
export { generateJsxFiles, type JsxNamespaceFile };
|
|
23
25
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,KAAK,yBAAyB,EAAoC,MAAM,yBAAyB,CAAC;AAC3G,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,KAAK,yBAAyB,EAAoC,MAAM,yBAAyB,CAAC;AAC3G,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK1F,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAExE,KAAK,gBAAgB,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACZ,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAmBF,QAAA,MAAM,gBAAgB,GAAI,SAAS,OAAO,EAAE,UAAS,oBAAyB,KAAG,QAoBhF,CAAC;AA8EF,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { ImportsBuilder } from "../../writer/imports.js";
|
|
|
4
4
|
import { generateElementComponentsSection } from "./element-components.js";
|
|
5
5
|
import { setElementProps } from "./element-prop-imports.js";
|
|
6
6
|
import { lazyElementSpecs } from "./element-prop-types.js";
|
|
7
|
+
import { collectGeneratedElements } from "./generated-elements.js";
|
|
7
8
|
import { buildGirIndex } from "./gir-index.js";
|
|
8
9
|
import { collectIntrinsicElementClasses } from "./intrinsic-elements.js";
|
|
9
10
|
import { generateJsxSection } from "./jsx.js";
|
|
@@ -11,7 +12,7 @@ import { generateMetadata } from "./metadata.js";
|
|
|
11
12
|
import { setOmittedProps } from "./omitted-props.js";
|
|
12
13
|
const generateJsxFiles = (library, options = {}) => {
|
|
13
14
|
setElementProps(options.props ?? {});
|
|
14
|
-
setOmittedProps(options.
|
|
15
|
+
setOmittedProps(options.omittedProps ?? {});
|
|
15
16
|
const intrinsicElements = collectIntrinsicElementClasses(library);
|
|
16
17
|
const intrinsicElementByGlibName = new Map(intrinsicElements.map((entry) => [entry.glibName, entry]));
|
|
17
18
|
const girIndex = buildGirIndex(library);
|
|
@@ -25,7 +26,7 @@ const generateJsxFiles = (library, options = {}) => {
|
|
|
25
26
|
components: options.components ?? {},
|
|
26
27
|
});
|
|
27
28
|
const metadata = generateMetadata(library);
|
|
28
|
-
return { namespaces, metadata, intrinsicElementCount };
|
|
29
|
+
return { namespaces, metadata, intrinsicElementCount, elements: collectGeneratedElements(intrinsicElements) };
|
|
29
30
|
};
|
|
30
31
|
const orderedIntrinsicNamespaces = (intrinsicElements) => {
|
|
31
32
|
const namespacesWithIntrinsicElements = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/store/jsx/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAqB,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAkC,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3G,OAAO,EAAqB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAwB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAuB,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAqB,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"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;KAC7B,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IAE5D,IAAI,iBAAiB,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,KAAK,GAAG,iBAAiB,CAAC,aAAa,CAAC,IAAI,GAAG,cAAc,CAAC;IAEpE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAyB,CAAC","sourcesContent":["import { sortStringsBy } from \"@gtkx/utils\";\nimport type { Library } from \"../../gir/library.js\";\nimport { type GirNamespace, namespaceDirectory } from \"../../gir/namespace.js\";\nimport { ImportsBuilder } from \"../../writer/imports.js\";\nimport { type ElementComponentOverrides, generateElementComponentsSection } from \"./element-components.js\";\nimport { type ElementProps, setElementProps } from \"./element-prop-imports.js\";\nimport { type LazyElementSpec, lazyElementSpecs } from \"./element-prop-types.js\";\nimport { collectGeneratedElements, type GeneratedElement } from \"./generated-elements.js\";\nimport { buildGirIndex } from \"./gir-index.js\";\nimport { collectIntrinsicElementClasses, type GlibNamedClass } from \"./intrinsic-elements.js\";\nimport { generateJsxSection } from \"./jsx.js\";\nimport { generateMetadata } from \"./metadata.js\";\nimport { type OmittedProps, setOmittedProps } from \"./omitted-props.js\";\n\ntype JsxNamespaceFile = {\n directory: string;\n source: string;\n};\n\ntype JsxFiles = {\n namespaces: JsxNamespaceFile[];\n metadata: string;\n intrinsicElementCount: number;\n elements: GeneratedElement[];\n};\n\ntype JsxGenerationOptions = {\n reactSubexports?: string[];\n components?: ElementComponentOverrides;\n props?: ElementProps;\n omittedProps?: OmittedProps;\n lazyElements?: string[];\n};\n\ntype NamespaceFilesOptions = {\n library: Library;\n intrinsicElements: GlibNamedClass[];\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n lazyByNamespace: Map<string, LazyElementSpec[]>;\n reactSubexports: string[];\n components: ElementComponentOverrides;\n};\n\ntype JsxNamespaceContext = {\n lazyElements: LazyElementSpec[];\n intrinsicElements: GlibNamedClass[];\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n reactSubexports: string[];\n components: ElementComponentOverrides;\n};\n\nconst generateJsxFiles = (library: Library, options: JsxGenerationOptions = {}): JsxFiles => {\n setElementProps(options.props ?? {});\n setOmittedProps(options.omittedProps ?? {});\n const intrinsicElements = collectIntrinsicElementClasses(library);\n const intrinsicElementByGlibName = new Map(intrinsicElements.map((entry) => [entry.glibName, entry]));\n const girIndex = buildGirIndex(library);\n const lazyByNamespace = lazyElementSpecs(girIndex, options.lazyElements ?? []);\n\n const { namespaces, intrinsicElementCount } = generateNamespaceFiles({\n library,\n intrinsicElements,\n intrinsicElementByGlibName,\n lazyByNamespace,\n reactSubexports: options.reactSubexports ?? [],\n components: options.components ?? {},\n });\n\n const metadata = generateMetadata(library);\n\n return { namespaces, metadata, intrinsicElementCount, elements: collectGeneratedElements(intrinsicElements) };\n};\n\nconst orderedIntrinsicNamespaces = (intrinsicElements: GlibNamedClass[]): GirNamespace[] => {\n const namespacesWithIntrinsicElements: Map<string, GirNamespace> = new Map();\n\n for (const entry of intrinsicElements) {\n namespacesWithIntrinsicElements.set(entry.namespace.name, entry.namespace);\n }\n\n return sortStringsBy(namespacesWithIntrinsicElements.values(), (entry) => entry.name);\n};\n\nconst generateNamespaceFiles = (\n options: NamespaceFilesOptions,\n): { namespaces: JsxNamespaceFile[]; intrinsicElementCount: number } => {\n const { library, intrinsicElements, intrinsicElementByGlibName, lazyByNamespace, reactSubexports, components } =\n options;\n\n const namespaces: JsxNamespaceFile[] = [];\n let intrinsicElementCount = 0;\n\n for (const namespace of orderedIntrinsicNamespaces(intrinsicElements)) {\n const { source, count } = generateJsxNamespace(namespace, library, {\n lazyElements: lazyByNamespace.get(namespace.name) ?? [],\n intrinsicElements,\n intrinsicElementByGlibName,\n reactSubexports,\n components,\n });\n\n namespaces.push({ directory: namespaceDirectory(namespace), source });\n intrinsicElementCount += count;\n }\n\n return { namespaces, intrinsicElementCount };\n};\n\nconst generateJsxNamespace = (\n targetNamespace: GirNamespace,\n library: Library,\n context: JsxNamespaceContext,\n): { source: string; count: number } => {\n const { lazyElements, intrinsicElements, intrinsicElementByGlibName, reactSubexports, components } = context;\n const targetDirectory = namespaceDirectory(targetNamespace);\n const imports = new ImportsBuilder();\n imports.addSideEffect(`@gtkx/gi/${targetDirectory}`);\n\n if (reactSubexports.includes(targetDirectory)) {\n imports.addSideEffect(`@gtkx/react/${targetDirectory}`);\n }\n\n const elementComponents = generateElementComponentsSection(targetNamespace, library, {\n imports,\n lazyElements,\n intrinsicElements,\n components,\n });\n\n const excludeNames: Set<string> = new Set(elementComponents.exportedNames);\n\n const { source: jsxSection, intrinsicCount } = generateJsxSection(targetNamespace, library, {\n excludeNames,\n imports,\n intrinsicElements,\n intrinsicElementByGlibName,\n });\n\n const body = [imports.toSource().trimEnd(), \"\", jsxSection];\n\n if (elementComponents.source.length > 0) {\n body.push(\"\", elementComponents.source);\n }\n\n const count = elementComponents.exportedNames.size + intrinsicCount;\n\n return { source: `${body.join(\"\\n\")}\\n`, count };\n};\n\nexport { generateJsxFiles, type JsxNamespaceFile };\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { GirClass } from "../../gir/class.js";
|
|
2
2
|
import type { Library } from "../../gir/library.js";
|
|
3
3
|
import type { GirNamespace } from "../../gir/namespace.js";
|
|
4
|
-
import { type TsTypeTarget } from "../../analysis/ts-type.js";
|
|
5
4
|
import { type GirProperty } from "../../gir/property.js";
|
|
6
5
|
type IntrinsicElementPropsEntries = {
|
|
7
6
|
propLines: string[];
|
|
@@ -16,10 +15,6 @@ type IntrinsicElementScope = {
|
|
|
16
15
|
type IntrinsicElementPropsOptions = IntrinsicElementScope & {
|
|
17
16
|
isIntrinsicElementAncestor?: (candidate: GirClass) => boolean;
|
|
18
17
|
};
|
|
19
|
-
type PropTypeRenderContext = {
|
|
20
|
-
library: Library;
|
|
21
|
-
imports: Map<string, string>;
|
|
22
|
-
};
|
|
23
18
|
type InterfacePropsOptions = {
|
|
24
19
|
library: Library;
|
|
25
20
|
iface: GirClass;
|
|
@@ -28,6 +23,5 @@ type InterfacePropsOptions = {
|
|
|
28
23
|
declare const buildElementPropsEntries: (options: IntrinsicElementPropsOptions) => IntrinsicElementPropsEntries;
|
|
29
24
|
declare const buildInterfacePropsEntries: (options: InterfacePropsOptions) => IntrinsicElementPropsEntries;
|
|
30
25
|
declare const isObjectProp: (library: Library, property: GirProperty) => boolean;
|
|
31
|
-
|
|
32
|
-
export { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp, reactTarget };
|
|
26
|
+
export { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp };
|
|
33
27
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAMlF,KAAK,4BAA4B,GAAG;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;CAC3B,CAAC;AAEF,KAAK,4BAA4B,GAAG,qBAAqB,GAAG;IACxD,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,KAAK,OAAO,CAAC;CACjE,CAAC;AA6BF,KAAK,qBAAqB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;CAC3B,CAAC;AA6FF,QAAA,MAAM,wBAAwB,GAAI,SAAS,4BAA4B,KAAG,4BAczE,CAAC;AAEF,QAAA,MAAM,0BAA0B,GAAI,SAAS,qBAAqB,KAAG,4BAapE,CAAC;AAyCF,QAAA,MAAM,YAAY,GAAI,SAAS,OAAO,EAAE,UAAU,WAAW,KAAG,OAM/D,CAAC;AA0CF,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/store/jsx/props.js
CHANGED
|
@@ -4,22 +4,29 @@ import { renderHandlerParameters, renderHandlerResultType } from "../../analysis
|
|
|
4
4
|
import { recordTypeTarget, renderBaseType } from "../../analysis/ts-type.js";
|
|
5
5
|
import { isConstructableProperty } from "../../gir/property.js";
|
|
6
6
|
import { renderJsDoc } from "../../writer/doc.js";
|
|
7
|
+
import { annotationSpec, selfHandlerSpec } from "../gi/doc-spec.js";
|
|
7
8
|
import { getGlibName, giNamespaceAlias, isIntrinsicElementClass, signalHandlerName } from "./intrinsic-elements.js";
|
|
8
9
|
import { isOmittedProp } from "./omitted-props.js";
|
|
10
|
+
const notifyDoc = (property, jsName, spec) => {
|
|
11
|
+
const note = `Called with the new value when \`${jsName}\` changes.`;
|
|
12
|
+
const doc = property.doc;
|
|
13
|
+
const text = doc === undefined || doc.length === 0 ? note : `${note}\n\n${doc}`;
|
|
14
|
+
return renderJsDoc(text, undefined, spec);
|
|
15
|
+
};
|
|
9
16
|
const appendPropertyLines = (state, property, jsName) => {
|
|
10
17
|
const tsType = renderReactPropType(state.types, property.type, false);
|
|
11
|
-
const
|
|
18
|
+
const spec = annotationSpec(property.annotations);
|
|
19
|
+
const doc = renderJsDoc(property.doc, undefined, spec);
|
|
12
20
|
if (isObjectProp(state.owner.library, property)) {
|
|
13
21
|
state.propLines.push(`${doc}${jsName}?: ${tsType} | ReactElement | null | undefined;`);
|
|
14
22
|
state.objectPropNames.push(jsName);
|
|
15
23
|
return;
|
|
16
24
|
}
|
|
17
|
-
|
|
18
|
-
if (isSettable) {
|
|
25
|
+
if (isConstructableProperty(property)) {
|
|
19
26
|
state.propLines.push(`${doc}${jsName}?: ${tsType} | null | undefined;`);
|
|
20
27
|
}
|
|
21
28
|
const handlerType = `((value: ${tsType} | null, self: Self) => void) | null | undefined`;
|
|
22
|
-
state.propLines.push(`${
|
|
29
|
+
state.propLines.push(`${notifyDoc(property, jsName, spec)}onNotify${upperFirst(jsName)}?: ${handlerType};`);
|
|
23
30
|
};
|
|
24
31
|
const acceptCollectorProperty = (state, property) => {
|
|
25
32
|
if (!property.introspectable) {
|
|
@@ -39,7 +46,8 @@ const acceptCollectorSignal = (state, signal) => {
|
|
|
39
46
|
}
|
|
40
47
|
state.seen.add(handlerName);
|
|
41
48
|
const signature = renderSignalHandler({ types: state.types, signal, selfType: "Self" });
|
|
42
|
-
|
|
49
|
+
const doc = renderJsDoc(signal.doc, undefined, selfHandlerSpec(signal));
|
|
50
|
+
state.propLines.push(`${doc}${handlerName}?: (${signature}) | undefined;`);
|
|
43
51
|
};
|
|
44
52
|
const createPropEntryCollector = (owner) => {
|
|
45
53
|
const { library } = owner;
|
|
@@ -133,8 +141,8 @@ const renderSignalHandler = (options) => {
|
|
|
133
141
|
library: types.library,
|
|
134
142
|
signal,
|
|
135
143
|
renderType: (ref, nullable) => renderReactPropType(types, ref, nullable),
|
|
136
|
-
|
|
137
|
-
|
|
144
|
+
shouldIncludeCallerAllocated: false,
|
|
145
|
+
isOptOut: true,
|
|
138
146
|
});
|
|
139
147
|
return `(${params.join(", ")}) => ${result}`;
|
|
140
148
|
};
|
|
@@ -149,5 +157,5 @@ const renderReactPropType = (context, ref, isNullable) => {
|
|
|
149
157
|
const base = renderBaseType(context.library, reactTarget(context), ref);
|
|
150
158
|
return isNullable ? `${base} | null` : base;
|
|
151
159
|
};
|
|
152
|
-
export { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp
|
|
160
|
+
export { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp };
|
|
153
161
|
//# sourceMappingURL=props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/store/jsx/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAqB,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAoB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyDnD,MAAM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AAgB,EAAE,CACjE,gBAAgB,CACZ,OAAO,CAAC,OAAO,EACf,CAAC,IAAI,EAAE,EAAE;IACL,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAE9E,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;AACtE,CAAC,EACD,GAAG,EAAE;IACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC;AACjD,CAAC,CACJ,CAAC;AAEN,MAAM,mBAAmB,GAAG,CAAC,OAA8B,EAAE,GAAuB,EAAE,UAAmB,EAAU,EAAE;IACjH,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IAExE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { toCamelIdentifier, upperFirst } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport type { GirCallable } from \"../../gir/parameter.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport { forEachAncestor } from \"../../analysis/inheritance.js\";\nimport { renderHandlerParameters, renderHandlerResultType } from \"../../analysis/param-structure.js\";\nimport { recordTypeTarget, renderBaseType, type TsTypeTarget } from \"../../analysis/ts-type.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { getGlibName, giNamespaceAlias, isIntrinsicElementClass, signalHandlerName } from \"./intrinsic-elements.js\";\nimport { isOmittedProp } from \"./omitted-props.js\";\n\ntype IntrinsicElementPropsEntries = {\n propLines: string[];\n imports: Map<string, string>;\n objectPropNames: string[];\n};\n\ntype IntrinsicElementScope = {\n library: Library;\n klass: GirClass;\n namespace: GirNamespace;\n};\n\ntype IntrinsicElementPropsOptions = IntrinsicElementScope & {\n isIntrinsicElementAncestor?: (candidate: GirClass) => boolean;\n};\n\ntype PropTypeRenderContext = {\n library: Library;\n imports: Map<string, string>;\n};\n\ntype SignalRenderOptions = {\n types: PropTypeRenderContext;\n signal: GirCallable;\n selfType: string;\n};\n\ntype PropEntryCollector = {\n propLines: string[];\n imports: Map<string, string>;\n objectPropNames: string[];\n acceptProperty: (property: GirProperty) => void;\n acceptSignal: (signal: GirCallable) => void;\n};\n\ntype PropCollectorState = {\n owner: IntrinsicElementScope;\n types: PropTypeRenderContext;\n propLines: string[];\n objectPropNames: string[];\n seen: Set<string>;\n};\n\ntype InterfacePropsOptions = {\n library: Library;\n iface: GirClass;\n namespace: GirNamespace;\n};\n\ntype IntrinsicElementMemberWalk = IntrinsicElementScope & {\n isIntrinsicElementAncestor: (candidate: GirClass) => boolean;\n acceptProperty: (property: GirProperty) => void;\n acceptSignal: (signal: GirCallable) => void;\n};\n\nconst appendPropertyLines = (state: PropCollectorState, property: GirProperty, jsName: string): void => {\n const tsType = renderReactPropType(state.types, property.type, false);\n const doc = renderJsDoc(property.doc);\n\n if (isObjectProp(state.owner.library, property)) {\n state.propLines.push(`${doc}${jsName}?: ${tsType} | ReactElement | null | undefined;`);\n state.objectPropNames.push(jsName);\n\n return;\n }\n\n const isSettable = isConstructableProperty(property);\n\n if (isSettable) {\n state.propLines.push(`${doc}${jsName}?: ${tsType} | null | undefined;`);\n }\n\n const handlerType = `((value: ${tsType} | null, self: Self) => void) | null | undefined`;\n state.propLines.push(`${isSettable ? \"\" : doc}onNotify${upperFirst(jsName)}?: ${handlerType};`);\n};\n\nconst acceptCollectorProperty = (state: PropCollectorState, property: GirProperty): void => {\n if (!property.introspectable) {\n return;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (state.seen.has(jsName) || isOmittedProp(getGlibName(state.owner.klass), jsName)) {\n return;\n }\n\n state.seen.add(jsName);\n appendPropertyLines(state, property, jsName);\n};\n\nconst acceptCollectorSignal = (state: PropCollectorState, signal: GirCallable): void => {\n const handlerName = signalHandlerName(signal.name);\n\n if (state.seen.has(handlerName)) {\n return;\n }\n\n state.seen.add(handlerName);\n const signature = renderSignalHandler({ types: state.types, signal, selfType: \"Self\" });\n state.propLines.push(`${renderJsDoc(signal.doc)}${handlerName}?: (${signature}) | undefined;`);\n};\n\nconst createPropEntryCollector = (owner: IntrinsicElementScope): PropEntryCollector => {\n const { library } = owner;\n const imports: Map<string, string> = new Map();\n const types: PropTypeRenderContext = { library, imports };\n\n const state: PropCollectorState = {\n owner,\n types,\n propLines: [],\n objectPropNames: [],\n seen: new Set<string>(),\n };\n\n return {\n propLines: state.propLines,\n imports,\n objectPropNames: state.objectPropNames,\n acceptProperty: (property) => {\n acceptCollectorProperty(state, property);\n },\n acceptSignal: (signal) => {\n acceptCollectorSignal(state, signal);\n },\n };\n};\n\nconst buildElementPropsEntries = (options: IntrinsicElementPropsOptions): IntrinsicElementPropsEntries => {\n const { library, klass, namespace, isIntrinsicElementAncestor = () => false } = options;\n const collector = createPropEntryCollector({ library, klass, namespace });\n\n walkIntrinsicElementMembers({\n library,\n klass,\n namespace,\n isIntrinsicElementAncestor,\n acceptProperty: collector.acceptProperty,\n acceptSignal: collector.acceptSignal,\n });\n\n return { propLines: collector.propLines, imports: collector.imports, objectPropNames: collector.objectPropNames };\n};\n\nconst buildInterfacePropsEntries = (options: InterfacePropsOptions): IntrinsicElementPropsEntries => {\n const { library, iface, namespace } = options;\n const collector = createPropEntryCollector({ library, klass: iface, namespace });\n\n for (const property of iface.properties) {\n collector.acceptProperty(property);\n }\n\n for (const signal of iface.signals) {\n collector.acceptSignal(signal);\n }\n\n return { propLines: collector.propLines, imports: collector.imports, objectPropNames: collector.objectPropNames };\n};\n\nconst walkIntrinsicElementMembers = (walk: IntrinsicElementMemberWalk): void => {\n const { library, klass, namespace, isIntrinsicElementAncestor, acceptProperty, acceptSignal } = walk;\n\n const visitMembers = (memberClass: GirClass): void => {\n for (const property of memberClass.properties) {\n acceptProperty(property);\n }\n\n for (const signal of memberClass.signals) {\n acceptSignal(signal);\n }\n };\n\n const ancestry = { library, namespace };\n visitMembers(klass);\n\n forEachAncestor(ancestry, klass, (ancestor) => {\n visitMembers(ancestor.klass);\n }, isIntrinsicElementAncestor);\n};\n\nconst isGObjectType = (library: Library, ref: TypeId | undefined): boolean => {\n if (ref === undefined) {\n return false;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved?.kind === \"interface\") {\n return true;\n }\n\n if (resolved?.kind !== \"class\") {\n return false;\n }\n\n return isIntrinsicElementClass(resolved.value, resolved.namespace, library);\n};\n\nconst isObjectProp = (library: Library, property: GirProperty): boolean => {\n if (!property.writable || property.constructOnly) {\n return false;\n }\n\n return isGObjectType(library, property.type);\n};\n\nconst renderSignalHandler = (options: SignalRenderOptions): string => {\n const { types, signal, selfType } = options;\n\n const params = [\n ...renderHandlerParameters(signal.parameters, (ref, nullable) => renderReactPropType(types, ref, nullable)),\n `self: ${selfType}`,\n ];\n\n const result = renderHandlerResultType({\n library: types.library,\n signal,\n renderType: (ref, nullable) => renderReactPropType(types, ref, nullable),\n includeCallerAllocated: false,\n optOut: true,\n });\n\n return `(${params.join(\", \")}) => ${result}`;\n};\n\nconst reactTarget = (context: PropTypeRenderContext): TsTypeTarget =>\n recordTypeTarget(\n context.library,\n (name) => {\n context.imports.set(name.namespaceName, giNamespaceAlias(name.namespaceName));\n\n return `${giNamespaceAlias(name.namespaceName)}.${name.typeName}`;\n },\n () => {\n context.imports.set(\"GObject\", giNamespaceAlias(\"GObject\"));\n\n return `${giNamespaceAlias(\"GObject\")}.Type`;\n },\n );\n\nconst renderReactPropType = (context: PropTypeRenderContext, ref: TypeId | undefined, isNullable: boolean): string => {\n const base = renderBaseType(context.library, reactTarget(context), ref);\n\n return isNullable ? `${base} | null` : base;\n};\n\nexport { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp, reactTarget };\n"]}
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/store/jsx/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAqB,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAoB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyDnD,MAAM,SAAS,GAAG,CAAC,QAAqB,EAAE,MAAc,EAAE,IAAe,EAAU,EAAE;IACjF,MAAM,IAAI,GAAG,oCAAoC,MAAM,aAAa,CAAC;IACrE,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IACzB,MAAM,IAAI,GAAG,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,EAAE,CAAC;IAEhF,OA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,QAAQ,CAAC;QACxE,4BAA4B,EAAE,KAAK;QACnC,QAAQ,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,OAA8B,EAAgB,EAAE,CACjE,gBAAgB,CACZ,OAAO,CAAC,OAAO,EACf,CAAC,IAAI,EAAE,EAAE;IACL,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAE9E,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;AACtE,CAAC,EACD,GAAG,EAAE;IACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC;AACjD,CAAC,CACJ,CAAC;AAEN,MAAM,mBAAmB,GAAG,CAAC,OAA8B,EAAE,GAAuB,EAAE,UAAmB,EAAU,EAAE;IACjH,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IAExE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { toCamelIdentifier, upperFirst } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport type { GirCallable } from \"../../gir/parameter.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { JsDocSpec } from \"../../writer/doc.js\";\nimport { forEachAncestor } from \"../../analysis/inheritance.js\";\nimport { renderHandlerParameters, renderHandlerResultType } from \"../../analysis/param-structure.js\";\nimport { recordTypeTarget, renderBaseType, type TsTypeTarget } from \"../../analysis/ts-type.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { annotationSpec, selfHandlerSpec } from \"../gi/doc-spec.js\";\nimport { getGlibName, giNamespaceAlias, isIntrinsicElementClass, signalHandlerName } from \"./intrinsic-elements.js\";\nimport { isOmittedProp } from \"./omitted-props.js\";\n\ntype IntrinsicElementPropsEntries = {\n propLines: string[];\n imports: Map<string, string>;\n objectPropNames: string[];\n};\n\ntype IntrinsicElementScope = {\n library: Library;\n klass: GirClass;\n namespace: GirNamespace;\n};\n\ntype IntrinsicElementPropsOptions = IntrinsicElementScope & {\n isIntrinsicElementAncestor?: (candidate: GirClass) => boolean;\n};\n\ntype PropTypeRenderContext = {\n library: Library;\n imports: Map<string, string>;\n};\n\ntype SignalRenderOptions = {\n types: PropTypeRenderContext;\n signal: GirCallable;\n selfType: string;\n};\n\ntype PropEntryCollector = {\n propLines: string[];\n imports: Map<string, string>;\n objectPropNames: string[];\n acceptProperty: (property: GirProperty) => void;\n acceptSignal: (signal: GirCallable) => void;\n};\n\ntype PropCollectorState = {\n owner: IntrinsicElementScope;\n types: PropTypeRenderContext;\n propLines: string[];\n objectPropNames: string[];\n seen: Set<string>;\n};\n\ntype InterfacePropsOptions = {\n library: Library;\n iface: GirClass;\n namespace: GirNamespace;\n};\n\ntype IntrinsicElementMemberWalk = IntrinsicElementScope & {\n isIntrinsicElementAncestor: (candidate: GirClass) => boolean;\n acceptProperty: (property: GirProperty) => void;\n acceptSignal: (signal: GirCallable) => void;\n};\n\nconst notifyDoc = (property: GirProperty, jsName: string, spec: JsDocSpec): string => {\n const note = `Called with the new value when \\`${jsName}\\` changes.`;\n const doc = property.doc;\n const text = doc === undefined || doc.length === 0 ? note : `${note}\\n\\n${doc}`;\n\n return renderJsDoc(text, undefined, spec);\n};\n\nconst appendPropertyLines = (state: PropCollectorState, property: GirProperty, jsName: string): void => {\n const tsType = renderReactPropType(state.types, property.type, false);\n const spec = annotationSpec(property.annotations);\n const doc = renderJsDoc(property.doc, undefined, spec);\n\n if (isObjectProp(state.owner.library, property)) {\n state.propLines.push(`${doc}${jsName}?: ${tsType} | ReactElement | null | undefined;`);\n state.objectPropNames.push(jsName);\n\n return;\n }\n\n if (isConstructableProperty(property)) {\n state.propLines.push(`${doc}${jsName}?: ${tsType} | null | undefined;`);\n }\n\n const handlerType = `((value: ${tsType} | null, self: Self) => void) | null | undefined`;\n\n state.propLines.push(\n `${notifyDoc(property, jsName, spec)}onNotify${upperFirst(jsName)}?: ${handlerType};`,\n );\n};\n\nconst acceptCollectorProperty = (state: PropCollectorState, property: GirProperty): void => {\n if (!property.introspectable) {\n return;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (state.seen.has(jsName) || isOmittedProp(getGlibName(state.owner.klass), jsName)) {\n return;\n }\n\n state.seen.add(jsName);\n appendPropertyLines(state, property, jsName);\n};\n\nconst acceptCollectorSignal = (state: PropCollectorState, signal: GirCallable): void => {\n const handlerName = signalHandlerName(signal.name);\n\n if (state.seen.has(handlerName)) {\n return;\n }\n\n state.seen.add(handlerName);\n const signature = renderSignalHandler({ types: state.types, signal, selfType: \"Self\" });\n const doc = renderJsDoc(signal.doc, undefined, selfHandlerSpec(signal));\n state.propLines.push(`${doc}${handlerName}?: (${signature}) | undefined;`);\n};\n\nconst createPropEntryCollector = (owner: IntrinsicElementScope): PropEntryCollector => {\n const { library } = owner;\n const imports: Map<string, string> = new Map();\n const types: PropTypeRenderContext = { library, imports };\n\n const state: PropCollectorState = {\n owner,\n types,\n propLines: [],\n objectPropNames: [],\n seen: new Set<string>(),\n };\n\n return {\n propLines: state.propLines,\n imports,\n objectPropNames: state.objectPropNames,\n acceptProperty: (property) => {\n acceptCollectorProperty(state, property);\n },\n acceptSignal: (signal) => {\n acceptCollectorSignal(state, signal);\n },\n };\n};\n\nconst buildElementPropsEntries = (options: IntrinsicElementPropsOptions): IntrinsicElementPropsEntries => {\n const { library, klass, namespace, isIntrinsicElementAncestor = () => false } = options;\n const collector = createPropEntryCollector({ library, klass, namespace });\n\n walkIntrinsicElementMembers({\n library,\n klass,\n namespace,\n isIntrinsicElementAncestor,\n acceptProperty: collector.acceptProperty,\n acceptSignal: collector.acceptSignal,\n });\n\n return { propLines: collector.propLines, imports: collector.imports, objectPropNames: collector.objectPropNames };\n};\n\nconst buildInterfacePropsEntries = (options: InterfacePropsOptions): IntrinsicElementPropsEntries => {\n const { library, iface, namespace } = options;\n const collector = createPropEntryCollector({ library, klass: iface, namespace });\n\n for (const property of iface.properties) {\n collector.acceptProperty(property);\n }\n\n for (const signal of iface.signals) {\n collector.acceptSignal(signal);\n }\n\n return { propLines: collector.propLines, imports: collector.imports, objectPropNames: collector.objectPropNames };\n};\n\nconst walkIntrinsicElementMembers = (walk: IntrinsicElementMemberWalk): void => {\n const { library, klass, namespace, isIntrinsicElementAncestor, acceptProperty, acceptSignal } = walk;\n\n const visitMembers = (memberClass: GirClass): void => {\n for (const property of memberClass.properties) {\n acceptProperty(property);\n }\n\n for (const signal of memberClass.signals) {\n acceptSignal(signal);\n }\n };\n\n const ancestry = { library, namespace };\n visitMembers(klass);\n\n forEachAncestor(ancestry, klass, (ancestor) => {\n visitMembers(ancestor.klass);\n }, isIntrinsicElementAncestor);\n};\n\nconst isGObjectType = (library: Library, ref: TypeId | undefined): boolean => {\n if (ref === undefined) {\n return false;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved?.kind === \"interface\") {\n return true;\n }\n\n if (resolved?.kind !== \"class\") {\n return false;\n }\n\n return isIntrinsicElementClass(resolved.value, resolved.namespace, library);\n};\n\nconst isObjectProp = (library: Library, property: GirProperty): boolean => {\n if (!property.writable || property.constructOnly) {\n return false;\n }\n\n return isGObjectType(library, property.type);\n};\n\nconst renderSignalHandler = (options: SignalRenderOptions): string => {\n const { types, signal, selfType } = options;\n\n const params = [\n ...renderHandlerParameters(signal.parameters, (ref, nullable) => renderReactPropType(types, ref, nullable)),\n `self: ${selfType}`,\n ];\n\n const result = renderHandlerResultType({\n library: types.library,\n signal,\n renderType: (ref, nullable) => renderReactPropType(types, ref, nullable),\n shouldIncludeCallerAllocated: false,\n isOptOut: true,\n });\n\n return `(${params.join(\", \")}) => ${result}`;\n};\n\nconst reactTarget = (context: PropTypeRenderContext): TsTypeTarget =>\n recordTypeTarget(\n context.library,\n (name) => {\n context.imports.set(name.namespaceName, giNamespaceAlias(name.namespaceName));\n\n return `${giNamespaceAlias(name.namespaceName)}.${name.typeName}`;\n },\n () => {\n context.imports.set(\"GObject\", giNamespaceAlias(\"GObject\"));\n\n return `${giNamespaceAlias(\"GObject\")}.Type`;\n },\n );\n\nconst renderReactPropType = (context: PropTypeRenderContext, ref: TypeId | undefined, isNullable: boolean): string => {\n const base = renderBaseType(context.library, reactTarget(context), ref);\n\n return isNullable ? `${base} | null` : base;\n};\n\nexport { buildElementPropsEntries, buildInterfacePropsEntries, isObjectProp };\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { JsxNamespaceFile } from "./jsx/pipeline.js";
|
|
2
2
|
import type { RawFile } from "./store-fs.js";
|
|
3
3
|
import { type StoreOptions } from "./store-fs.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { writeJsxStore, type JsxStoreOptions };
|
|
4
|
+
declare const writeJsxStore: (options: StoreOptions, namespaces: JsxNamespaceFile[], metadata: string, rawFiles: RawFile[]) => void;
|
|
5
|
+
export { writeJsxStore };
|
|
7
6
|
//# sourceMappingURL=jsx-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-store.d.ts","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAiB,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE5F,
|
|
1
|
+
{"version":3,"file":"jsx-store.d.ts","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAiB,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE5F,QAAA,MAAM,aAAa,GACf,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,UAAU,MAAM,EAChB,UAAU,OAAO,EAAE,KACpB,IAyBF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/store/jsx-store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildManifest, subpathExport, writeStore } from "./store-fs.js";
|
|
2
|
-
const writeJsxStore = (options, namespaces, metadata,
|
|
2
|
+
const writeJsxStore = (options, namespaces, metadata, rawFiles) => {
|
|
3
3
|
const exportsMap = {
|
|
4
4
|
"./metadata": subpathExport("metadata"),
|
|
5
5
|
};
|
|
@@ -18,8 +18,8 @@ const writeJsxStore = (options, namespaces, metadata, fingerprint) => {
|
|
|
18
18
|
exports: exportsMap,
|
|
19
19
|
peerDependencies: { "@gtkx/gi": "*", "@gtkx/react": "*", react: "*" },
|
|
20
20
|
}),
|
|
21
|
-
rawFiles
|
|
22
|
-
|
|
21
|
+
rawFiles,
|
|
22
|
+
requiresEnvReference: true,
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
export { writeJsxStore };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-store.js","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAqB,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"jsx-store.js","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAqB,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5F,MAAM,aAAa,GAAG,CAClB,OAAqB,EACrB,UAA8B,EAC9B,QAAgB,EAChB,QAAmB,EACf,EAAE;IACN,MAAM,UAAU,GAA4B;QACxC,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC;KAC1C,CAAC;IAEF,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE9D,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,IAAI,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAClE,UAAU,CAAC,KAAK,SAAS,EAAE,CAAC,GAAG,aAAa,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,UAAU,CAAC;QACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK;QACL,QAAQ,EAAE,aAAa,CAAC;YACpB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,UAAU;YACnB,gBAAgB,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;SACxE,CAAC;QACF,QAAQ;QACR,oBAAoB,EAAE,IAAI;KAC7B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import type { JsxNamespaceFile } from \"./jsx/pipeline.js\";\nimport type { RawFile } from \"./store-fs.js\";\nimport { buildManifest, type StoreOptions, subpathExport, writeStore } from \"./store-fs.js\";\n\nconst writeJsxStore = (\n options: StoreOptions,\n namespaces: JsxNamespaceFile[],\n metadata: string,\n rawFiles: RawFile[],\n): void => {\n const exportsMap: Record<string, unknown> = {\n \"./metadata\": subpathExport(\"metadata\"),\n };\n\n const files = [{ fileName: \"metadata.ts\", source: metadata }];\n\n for (const { directory, source } of namespaces) {\n files.push({ fileName: `${directory}/${directory}.tsx`, source });\n exportsMap[`./${directory}`] = subpathExport(`${directory}/${directory}`);\n }\n\n writeStore({\n storeDir: options.storeDir,\n linkDir: options.linkDir,\n files,\n manifest: buildManifest({\n name: \"@gtkx/jsx\",\n version: options.version,\n exports: exportsMap,\n peerDependencies: { \"@gtkx/gi\": \"*\", \"@gtkx/react\": \"*\", react: \"*\" },\n }),\n rawFiles,\n requiresEnvReference: true,\n });\n};\n\nexport { writeJsxStore };\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StoreOptions } from "./store-fs.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where a project's generated stores live, ready to spread into `runCodegen`. `jsx` is null when the
|
|
4
|
+
* project has no `@gtkx/react` installed, in which case only the `@gtkx/gi` store can be generated.
|
|
5
|
+
*/
|
|
6
|
+
type ResolvedStore = {
|
|
7
|
+
/** Where the `@gtkx/gi` store goes, versioned by the installed `@gtkx/runtime`. */
|
|
8
|
+
gi: StoreOptions;
|
|
9
|
+
/** Where the `@gtkx/jsx` store goes, versioned by the installed `@gtkx/react`; null when it is absent. */
|
|
10
|
+
jsx: StoreOptions | null;
|
|
11
|
+
/** Subexport names of the installed `@gtkx/react`, empty when it is absent. */
|
|
12
|
+
reactSubexports: string[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The
|
|
16
|
+
* result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has
|
|
17
|
+
* already resolved those can spread it straight into the call.
|
|
18
|
+
*
|
|
19
|
+
* Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade
|
|
20
|
+
* invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.
|
|
21
|
+
*
|
|
22
|
+
* @param projectRoot Directory holding the project's `package.json` and `node_modules`.
|
|
23
|
+
* @returns The store locations and the React subexports that shape the jsx store.
|
|
24
|
+
* @throws If `@gtkx/runtime` cannot be resolved from the project.
|
|
25
|
+
*/
|
|
26
|
+
declare const resolveStore: (projectRoot: string) => ResolvedStore;
|
|
27
|
+
export { resolveStore, type ResolvedStore };
|
|
28
|
+
//# sourceMappingURL=resolve-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-store.d.ts","sourceRoot":"","sources":["../../src/store/resolve-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;GAGG;AACH,KAAK,aAAa,GAAG;IACjB,mFAAmF;IACnF,EAAE,EAAE,YAAY,CAAC;IACjB,0GAA0G;IAC1G,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;IACzB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAuDF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,YAAY,GAAI,aAAa,MAAM,KAAG,aAe3C,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
|
+
import { dirname, join, parse } from "node:path";
|
|
3
|
+
const STORE_DIR = ".gtkx";
|
|
4
|
+
const SCOPE = "@gtkx";
|
|
5
|
+
const readManifest = (path) => JSON.parse(readFileSync(path, "utf8"));
|
|
6
|
+
const subexportNames = (packageDir) => Object.keys(readManifest(join(packageDir, "package.json")).exports ?? {})
|
|
7
|
+
.filter((key) => key.startsWith("./") && key !== "./package.json")
|
|
8
|
+
.map((key) => key.slice(2));
|
|
9
|
+
const loadPackage = (manifest) => {
|
|
10
|
+
if (!existsSync(manifest)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const real = realpathSync(manifest);
|
|
14
|
+
return { dir: dirname(real), version: readManifest(real).version ?? "0.0.0" };
|
|
15
|
+
};
|
|
16
|
+
const nodeModulesChain = function* (projectRoot) {
|
|
17
|
+
const { root } = parse(projectRoot);
|
|
18
|
+
let current = projectRoot;
|
|
19
|
+
while (current !== root) {
|
|
20
|
+
yield join(current, "node_modules");
|
|
21
|
+
current = dirname(current);
|
|
22
|
+
}
|
|
23
|
+
yield join(root, "node_modules");
|
|
24
|
+
};
|
|
25
|
+
const resolvePackage = (projectRoot, packageName) => {
|
|
26
|
+
for (const nodeModules of nodeModulesChain(projectRoot)) {
|
|
27
|
+
const found = loadPackage(join(nodeModules, packageName, "package.json"));
|
|
28
|
+
if (found !== null) {
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return loadPackage(join(projectRoot, "packages", packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
33
|
+
};
|
|
34
|
+
const storeOptions = (nodeModules, name, version) => ({
|
|
35
|
+
storeDir: join(nodeModules, STORE_DIR, name),
|
|
36
|
+
linkDir: join(nodeModules, SCOPE, name),
|
|
37
|
+
version,
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The
|
|
41
|
+
* result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has
|
|
42
|
+
* already resolved those can spread it straight into the call.
|
|
43
|
+
*
|
|
44
|
+
* Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade
|
|
45
|
+
* invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.
|
|
46
|
+
*
|
|
47
|
+
* @param projectRoot Directory holding the project's `package.json` and `node_modules`.
|
|
48
|
+
* @returns The store locations and the React subexports that shape the jsx store.
|
|
49
|
+
* @throws If `@gtkx/runtime` cannot be resolved from the project.
|
|
50
|
+
*/
|
|
51
|
+
const resolveStore = (projectRoot) => {
|
|
52
|
+
const runtime = resolvePackage(projectRoot, "@gtkx/runtime");
|
|
53
|
+
if (runtime === null) {
|
|
54
|
+
throw new Error(`Cannot resolve @gtkx/runtime from ${projectRoot}; is it installed?`);
|
|
55
|
+
}
|
|
56
|
+
const react = resolvePackage(projectRoot, "@gtkx/react");
|
|
57
|
+
const nodeModules = join(projectRoot, "node_modules");
|
|
58
|
+
return {
|
|
59
|
+
gi: storeOptions(nodeModules, "gi", runtime.version),
|
|
60
|
+
jsx: react === null ? null : storeOptions(nodeModules, "jsx", react.version),
|
|
61
|
+
reactSubexports: react === null ? [] : subexportNames(react.dir),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export { resolveStore };
|
|
65
|
+
//# sourceMappingURL=resolve-store.js.map
|