@gtkx/codegen 1.0.0-rc.1 → 1.0.0-rc.2
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/dist/analysis/descriptor-render.d.ts +18 -11
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +275 -152
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +37 -34
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +34 -30
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +16 -16
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +139 -84
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/param-structure.d.ts +14 -13
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +104 -53
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +6 -5
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +69 -23
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/compile.d.ts +5 -5
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +70 -63
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +12 -11
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +194 -121
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +6 -9
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +68 -133
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/pipeline.d.ts +8 -7
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +79 -53
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +21 -19
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +80 -71
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +6 -6
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +126 -84
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +28 -5
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +66 -13
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +13 -0
- package/dist/gi.d.ts.map +1 -0
- package/dist/gi.js +21 -0
- package/dist/gi.js.map +1 -0
- package/dist/gir/ancestry.d.ts +4 -3
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +12 -15
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/callback.d.ts +6 -11
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +6 -7
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +7 -5
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +14 -12
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +3 -3
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +7 -6
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +8 -3
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +30 -7
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +6 -3
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +23 -7
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +2 -1
- package/dist/gir/gir-path.d.ts.map +1 -1
- package/dist/gir/gir-path.js +26 -10
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/libraries.d.ts +3 -2
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +39 -27
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +17 -11
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +116 -92
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +10 -10
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +21 -20
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/nullable-overrides.d.ts +3 -0
- package/dist/gir/nullable-overrides.d.ts.map +1 -0
- package/dist/gir/nullable-overrides.js +5 -0
- package/dist/gir/nullable-overrides.js.map +1 -0
- package/dist/gir/parameter.d.ts +14 -12
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +27 -18
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +12 -13
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +50 -40
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +5 -4
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js +4 -3
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +5 -4
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +10 -9
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +5 -4
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +13 -12
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +6 -5
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +49 -47
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +17 -15
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +5 -1
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts +3 -2
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +36 -25
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +3 -2
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +26 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +40 -0
- package/dist/jsx.js.map +1 -0
- package/dist/khronos/args.d.ts +7 -7
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +88 -67
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/jsdoc.d.ts +4 -4
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +29 -16
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +8 -7
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +94 -59
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +4 -3
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +40 -25
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/param-pair.d.ts +11 -0
- package/dist/khronos/param-pair.d.ts.map +1 -0
- package/dist/khronos/param-pair.js +6 -0
- package/dist/khronos/param-pair.js.map +1 -0
- package/dist/khronos/parse.d.ts +7 -8
- package/dist/khronos/parse.d.ts.map +1 -1
- package/dist/khronos/parse.js +17 -16
- package/dist/khronos/parse.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +4 -4
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +97 -56
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +11 -10
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +109 -45
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +5 -4
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +106 -59
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +4 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +30 -19
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +17 -0
- package/dist/react/element-config.d.ts.map +1 -0
- package/dist/react/element-config.js +61 -0
- package/dist/react/element-config.js.map +1 -0
- package/dist/runner.d.ts +17 -10
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +45 -43
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +5 -3
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +24 -22
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/async.d.ts +2 -1
- package/dist/store/gi/async.d.ts.map +1 -1
- package/dist/store/gi/async.js +28 -24
- package/dist/store/gi/async.js.map +1 -1
- package/dist/store/gi/callables.d.ts +26 -20
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +162 -100
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts +3 -2
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +6 -3
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class-struct-record.d.ts +4 -3
- package/dist/store/gi/class-struct-record.d.ts.map +1 -1
- package/dist/store/gi/class-struct-record.js +33 -15
- package/dist/store/gi/class-struct-record.js.map +1 -1
- package/dist/store/gi/class.d.ts +2 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +86 -47
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/companion.d.ts +2 -1
- package/dist/store/gi/companion.d.ts.map +1 -1
- package/dist/store/gi/companion.js +8 -5
- package/dist/store/gi/companion.js.map +1 -1
- package/dist/store/gi/constant.d.ts +3 -2
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +25 -8
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts +3 -2
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +17 -10
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/enum.d.ts +3 -2
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +14 -11
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts +5 -4
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +50 -23
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/gtype-binding.d.ts +4 -4
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +15 -11
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/interface.d.ts +2 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +36 -18
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts +3 -2
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +33 -21
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +13 -13
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +187 -130
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +7 -6
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +26 -13
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts +2 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +38 -23
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts +2 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +6 -4
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +11 -10
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +86 -60
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts +3 -2
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +36 -25
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +8 -8
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +171 -99
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts +6 -5
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +75 -39
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts +2 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +19 -13
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +3 -3
- package/dist/store/gi/registration.d.ts.map +1 -1
- package/dist/store/gi/registration.js +3 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.d.ts +2 -2
- package/dist/store/gi/return-wrap.d.ts.map +1 -1
- package/dist/store/gi/return-wrap.js +43 -22
- 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 +6 -3
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts +3 -2
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +113 -66
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +2 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +60 -30
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +5 -4
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +4 -2
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +23 -0
- package/dist/store/jsx/element-components.d.ts.map +1 -0
- package/dist/store/jsx/element-components.js +86 -0
- package/dist/store/jsx/element-components.js.map +1 -0
- package/dist/store/jsx/element-prop-imports.d.ts +17 -0
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-imports.js +15 -0
- package/dist/store/jsx/element-prop-imports.js.map +1 -0
- package/dist/store/jsx/element-prop-types.d.ts +10 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-types.js +41 -0
- package/dist/store/jsx/element-prop-types.js.map +1 -0
- package/dist/store/jsx/gir-index.d.ts +16 -0
- package/dist/store/jsx/gir-index.d.ts.map +1 -0
- package/dist/store/jsx/gir-index.js +33 -0
- package/dist/store/jsx/gir-index.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +27 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
- package/dist/store/jsx/intrinsic-elements.js +128 -0
- package/dist/store/jsx/intrinsic-elements.js.map +1 -0
- package/dist/store/{react → jsx}/jsx.d.ts +2 -4
- package/dist/store/jsx/jsx.d.ts.map +1 -0
- package/dist/store/{react → jsx}/jsx.js +110 -71
- package/dist/store/jsx/jsx.js.map +1 -0
- package/dist/store/jsx/metadata.d.ts +4 -0
- package/dist/store/jsx/metadata.d.ts.map +1 -0
- package/dist/store/{react → jsx}/metadata.js +148 -69
- package/dist/store/jsx/metadata.js.map +1 -0
- package/dist/store/jsx/pipeline.d.ts +21 -0
- package/dist/store/jsx/pipeline.d.ts.map +1 -0
- package/dist/store/{react → jsx}/pipeline.js +36 -15
- package/dist/store/jsx/pipeline.js.map +1 -0
- package/dist/store/{react → jsx}/props.d.ts +9 -12
- package/dist/store/jsx/props.d.ts.map +1 -0
- package/dist/store/jsx/props.js +158 -0
- package/dist/store/jsx/props.js.map +1 -0
- package/dist/store/jsx-store.d.ts +5 -3
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +4 -1
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +14 -12
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +9 -7
- 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 +12 -6
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc.d.ts +2 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +13 -7
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/emit.d.ts +8 -7
- package/dist/writer/emit.d.ts.map +1 -1
- package/dist/writer/emit.js +13 -10
- package/dist/writer/emit.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +2 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +29 -18
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/imports.d.ts +4 -2
- package/dist/writer/imports.d.ts.map +1 -1
- package/dist/writer/imports.js +35 -24
- package/dist/writer/imports.js.map +1 -1
- package/dist/writer/module.d.ts +3 -2
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +16 -9
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +4 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +10 -0
- package/dist/xml.js.map +1 -0
- package/overrides/cairo/context.ts.ejs +7 -7
- package/overrides/cairo/matrix.ts.ejs +2 -2
- package/overrides/cairo/recording-surface.ts.ejs +2 -2
- package/overrides/cairo/region.ts.ejs +1 -1
- package/overrides/cairo/scaled-font.ts.ejs +3 -3
- package/package.json +15 -9
- package/src/analysis/descriptor-render.ts +484 -168
- package/src/analysis/descriptor.ts +162 -125
- package/src/analysis/inheritance.ts +286 -98
- package/src/analysis/param-structure.ts +188 -57
- package/src/analysis/ts-type.ts +112 -26
- package/src/compile.ts +103 -76
- package/src/docs/api-reference.ts +340 -144
- package/src/docs/element-page.ts +137 -146
- package/src/docs/pipeline.ts +132 -73
- package/src/docs/render.ts +151 -87
- package/src/docs/symbol-page.ts +268 -123
- package/src/fingerprint.ts +127 -29
- package/src/gi.ts +26 -0
- package/src/gir/ancestry.ts +26 -14
- package/src/gir/callback.ts +10 -15
- package/src/gir/class.ts +20 -16
- package/src/gir/enum.ts +9 -7
- package/src/gir/field.ts +37 -8
- package/src/gir/function.ts +33 -9
- package/src/gir/gir-path.ts +36 -12
- package/src/gir/libraries.ts +56 -31
- package/src/gir/library.ts +200 -97
- package/src/gir/namespace.ts +42 -26
- package/src/gir/nullable-overrides.ts +5 -0
- package/src/gir/parameter.ts +80 -42
- package/src/gir/parse.ts +102 -47
- package/src/gir/primitives.ts +25 -23
- package/src/gir/property.ts +13 -11
- package/src/gir/record.ts +16 -14
- package/src/gir/size.ts +91 -58
- package/src/gir/type-id.ts +33 -18
- package/src/gir/type-ref.ts +62 -26
- package/src/gir/type.ts +10 -8
- package/src/index.ts +7 -0
- package/src/jsx.ts +70 -0
- package/src/khronos/args.ts +158 -89
- package/src/khronos/jsdoc.ts +67 -29
- package/src/khronos/model.ts +154 -53
- package/src/khronos/modules.ts +67 -27
- package/src/khronos/param-pair.ts +14 -0
- package/src/khronos/parse.ts +37 -17
- package/src/khronos/pipeline.ts +193 -90
- package/src/khronos/plan.ts +235 -86
- package/src/khronos/render.ts +208 -71
- package/src/khronos/select.ts +48 -18
- package/src/react/element-config.ts +91 -0
- package/src/runner.ts +93 -57
- package/src/store/compile-store.ts +32 -26
- package/src/store/gi/async.ts +48 -21
- package/src/store/gi/callables.ts +345 -136
- package/src/store/gi/callback.ts +13 -4
- package/src/store/gi/class-struct-record.ts +49 -17
- package/src/store/gi/class.ts +186 -64
- package/src/store/gi/companion.ts +15 -6
- package/src/store/gi/constant.ts +42 -8
- package/src/store/gi/constructor-props.ts +42 -16
- package/src/store/gi/enum.ts +28 -13
- package/src/store/gi/function.ts +90 -24
- package/src/store/gi/gtype-binding.ts +31 -18
- package/src/store/gi/interface.ts +101 -36
- package/src/store/gi/item-comparators.ts +74 -26
- package/src/store/gi/method.ts +376 -159
- package/src/store/gi/param-marshal.ts +38 -15
- package/src/store/gi/pipeline.ts +72 -22
- package/src/store/gi/properties.ts +16 -5
- package/src/store/gi/property-accessor.ts +192 -84
- package/src/store/gi/record-constructor.ts +62 -30
- package/src/store/gi/record-field-accessor.ts +380 -167
- package/src/store/gi/record-layout.ts +130 -43
- package/src/store/gi/record.ts +37 -14
- package/src/store/gi/registration.ts +15 -9
- package/src/store/gi/return-wrap.ts +71 -23
- package/src/store/gi/runtime-override.ts +13 -3
- package/src/store/gi/signal.ts +244 -104
- package/src/store/gi/vtable.ts +117 -41
- package/src/store/gi-store.ts +26 -13
- package/src/store/jsx/element-components.ts +152 -0
- package/src/store/jsx/element-prop-imports.ts +24 -0
- package/src/store/jsx/element-prop-types.ts +59 -0
- package/src/store/jsx/gir-index.ts +62 -0
- package/src/store/jsx/intrinsic-elements.ts +262 -0
- package/src/store/{react → jsx}/jsx.ts +213 -99
- package/src/store/jsx/metadata.ts +385 -0
- package/src/store/jsx/pipeline.ts +145 -0
- package/src/store/jsx/props.ts +274 -0
- package/src/store/jsx-store.ts +15 -3
- package/src/store/store-fs.ts +36 -20
- package/src/writer/context.ts +25 -6
- package/src/writer/doc.ts +19 -5
- package/src/writer/emit.ts +20 -11
- package/src/writer/gtk-doc.ts +48 -21
- package/src/writer/imports.ts +63 -28
- package/src/writer/module.ts +35 -11
- package/src/xml.ts +12 -0
- package/dist/store/react/built-ins.d.ts +0 -9
- package/dist/store/react/built-ins.d.ts.map +0 -1
- package/dist/store/react/built-ins.js +0 -226
- package/dist/store/react/built-ins.js.map +0 -1
- package/dist/store/react/element-components.d.ts +0 -15
- package/dist/store/react/element-components.d.ts.map +0 -1
- package/dist/store/react/element-components.js +0 -92
- package/dist/store/react/element-components.js.map +0 -1
- package/dist/store/react/element-prop-types.d.ts +0 -19
- package/dist/store/react/element-prop-types.d.ts.map +0 -1
- package/dist/store/react/element-prop-types.js +0 -244
- package/dist/store/react/element-prop-types.js.map +0 -1
- package/dist/store/react/element-props.d.ts +0 -4
- package/dist/store/react/element-props.d.ts.map +0 -1
- package/dist/store/react/element-props.js +0 -178
- package/dist/store/react/element-props.js.map +0 -1
- package/dist/store/react/gir-index.d.ts +0 -25
- package/dist/store/react/gir-index.d.ts.map +0 -1
- package/dist/store/react/gir-index.js +0 -55
- package/dist/store/react/gir-index.js.map +0 -1
- package/dist/store/react/intrinsic-elements.d.ts +0 -26
- package/dist/store/react/intrinsic-elements.d.ts.map +0 -1
- package/dist/store/react/intrinsic-elements.js +0 -107
- package/dist/store/react/intrinsic-elements.js.map +0 -1
- package/dist/store/react/jsx.d.ts.map +0 -1
- package/dist/store/react/jsx.js.map +0 -1
- package/dist/store/react/metadata.d.ts +0 -4
- package/dist/store/react/metadata.d.ts.map +0 -1
- package/dist/store/react/metadata.js.map +0 -1
- package/dist/store/react/pipeline.d.ts +0 -14
- package/dist/store/react/pipeline.d.ts.map +0 -1
- package/dist/store/react/pipeline.js.map +0 -1
- package/dist/store/react/props.d.ts.map +0 -1
- package/dist/store/react/props.js +0 -133
- package/dist/store/react/props.js.map +0 -1
- package/overrides/gtk/constants.ts.ejs +0 -3
- package/overrides/gtk/index.ts.ejs +0 -2
- package/src/store/react/built-ins.ts +0 -260
- package/src/store/react/element-components.ts +0 -138
- package/src/store/react/element-prop-types.ts +0 -280
- package/src/store/react/element-props.ts +0 -204
- package/src/store/react/gir-index.ts +0 -85
- package/src/store/react/intrinsic-elements.ts +0 -161
- package/src/store/react/metadata.ts +0 -197
- package/src/store/react/pipeline.ts +0 -90
- package/src/store/react/props.ts +0 -197
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtk-doc.d.ts","sourceRoot":"","sources":["../../src/writer/gtk-doc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gtk-doc.d.ts","sourceRoot":"","sources":["../../src/writer/gtk-doc.ts"],"names":[],"mappings":"AAyEA,QAAA,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,MAyBvC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/writer/gtk-doc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { camelCase } from "@gtkx/utils";
|
|
2
2
|
const CONSTANT_MAP = { TRUE: "true", FALSE: "false", NULL: "null" };
|
|
3
3
|
const CALLABLE_LINK_KINDS = new Set(["method", "func", "ctor", "vfunc"]);
|
|
4
|
-
const SENTINEL = String.
|
|
4
|
+
const SENTINEL = String.fromCodePoint(0xE0_00);
|
|
5
5
|
const CODE_BLOCK_OPEN = "|[";
|
|
6
6
|
const CODE_BLOCK_CLOSE = "]|";
|
|
7
7
|
const CODE_LANGUAGE_PATTERN = /^\s*<!--\s*language="([^"]*)"\s*-->/;
|
|
@@ -15,17 +15,24 @@ const FUNCTION_REF_PATTERN = /\b([a-z_][a-z0-9_]*)\(\)/g;
|
|
|
15
15
|
const renderLink = (kind, target) => {
|
|
16
16
|
const segments = target.split(/::|[.:]/);
|
|
17
17
|
const lastIndex = segments.length - 1;
|
|
18
|
-
if (
|
|
19
|
-
segments[lastIndex] =
|
|
18
|
+
if (kind === "property" || CALLABLE_LINK_KINDS.has(kind)) {
|
|
19
|
+
segments[lastIndex] = camelCase(segments[lastIndex] ?? "");
|
|
20
20
|
}
|
|
21
21
|
const symbol = segments.join(".");
|
|
22
22
|
return `\`${symbol}${CALLABLE_LINK_KINDS.has(kind) ? "()" : ""}\``;
|
|
23
23
|
};
|
|
24
|
+
const trimTrailingNewlines = (value) => {
|
|
25
|
+
let end = value.length;
|
|
26
|
+
while (end > 0 && value[end - 1] === "\n") {
|
|
27
|
+
end -= 1;
|
|
28
|
+
}
|
|
29
|
+
return value.slice(0, end);
|
|
30
|
+
};
|
|
24
31
|
const renderCodeFence = (body) => {
|
|
25
|
-
const languageMatch =
|
|
32
|
+
const languageMatch = CODE_LANGUAGE_PATTERN.exec(body);
|
|
26
33
|
const fence = (languageMatch?.[1] ?? "").trim().toLowerCase();
|
|
27
34
|
const rest = languageMatch === null ? body : body.slice(languageMatch[0].length);
|
|
28
|
-
const code = rest.
|
|
35
|
+
const code = trimTrailingNewlines(rest.trimStart());
|
|
29
36
|
return `\`\`\`${fence}\n${code}\n\`\`\``;
|
|
30
37
|
};
|
|
31
38
|
const protectCodeBlocks = (raw, protect) => {
|
|
@@ -33,35 +40,39 @@ const protectCodeBlocks = (raw, protect) => {
|
|
|
33
40
|
let cursor = 0;
|
|
34
41
|
while (cursor < raw.length) {
|
|
35
42
|
const open = raw.indexOf(CODE_BLOCK_OPEN, cursor);
|
|
36
|
-
if (open === -1)
|
|
43
|
+
if (open === -1) {
|
|
37
44
|
break;
|
|
45
|
+
}
|
|
38
46
|
const close = raw.indexOf(CODE_BLOCK_CLOSE, open + CODE_BLOCK_OPEN.length);
|
|
39
|
-
if (close === -1)
|
|
47
|
+
if (close === -1) {
|
|
40
48
|
break;
|
|
49
|
+
}
|
|
41
50
|
result += raw.slice(cursor, open);
|
|
42
51
|
result += protect(renderCodeFence(raw.slice(open + CODE_BLOCK_OPEN.length, close)));
|
|
43
52
|
cursor = close + CODE_BLOCK_CLOSE.length;
|
|
44
53
|
}
|
|
45
54
|
return result + raw.slice(cursor);
|
|
46
55
|
};
|
|
47
|
-
|
|
56
|
+
const gtkDocToMarkdown = (raw) => {
|
|
48
57
|
const stash = [];
|
|
49
58
|
const protect = (value) => {
|
|
50
|
-
const token = `${SENTINEL}${stash.length}${SENTINEL}`;
|
|
59
|
+
const token = `${SENTINEL}${String(stash.length)}${SENTINEL}`;
|
|
51
60
|
stash.push(value);
|
|
52
61
|
return token;
|
|
53
62
|
};
|
|
54
63
|
let text = protectCodeBlocks(raw, protect);
|
|
55
|
-
text = text.
|
|
56
|
-
text = text.
|
|
57
|
-
text = text.
|
|
58
|
-
text = text.
|
|
59
|
-
text = text.
|
|
60
|
-
text = text.
|
|
61
|
-
text = text.
|
|
64
|
+
text = text.replaceAll(FENCED_BLOCK_PATTERN, (block) => protect(block));
|
|
65
|
+
text = text.replaceAll(INLINE_CODE_PATTERN, (span) => protect(span));
|
|
66
|
+
text = text.replaceAll(LINK_PATTERN, (_match, kind, target) => protect(renderLink(kind, target)));
|
|
67
|
+
text = text.replaceAll(CONSTANT_PATTERN, (_match, name) => protect(`\`${CONSTANT_MAP[name] ?? name}\``));
|
|
68
|
+
text = text.replaceAll(TYPE_REF_PATTERN, (_match, name) => protect(`\`${name}\``));
|
|
69
|
+
text = text.replaceAll(PARAM_REF_PATTERN, (_match, name) => protect(`\`${name}\``));
|
|
70
|
+
text = text.replaceAll(FUNCTION_REF_PATTERN, (_match, name) => protect(`\`${name}()\``));
|
|
62
71
|
for (let index = stash.length - 1; index >= 0; index -= 1) {
|
|
63
|
-
|
|
72
|
+
const value = stash[index] ?? "";
|
|
73
|
+
text = text.replaceAll(`${SENTINEL}${String(index)}${SENTINEL}`, () => value);
|
|
64
74
|
}
|
|
65
75
|
return text;
|
|
66
76
|
};
|
|
77
|
+
export { gtkDocToMarkdown };
|
|
67
78
|
//# sourceMappingURL=gtk-doc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtk-doc.js","sourceRoot":"","sources":["../../src/writer/gtk-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"gtk-doc.js","sourceRoot":"","sources":["../../src/writer/gtk-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,YAAY,GAA2B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5F,MAAM,mBAAmB,GAAgB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACtF,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC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,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;IACjH,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;IAC3F,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;IAEjG,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { camelCase } from \"@gtkx/utils\";\n\nconst CONSTANT_MAP: Record<string, string> = { TRUE: \"true\", FALSE: \"false\", NULL: \"null\" };\nconst CALLABLE_LINK_KINDS: Set<string> = new Set([\"method\", \"func\", \"ctor\", \"vfunc\"]);\nconst SENTINEL = String.fromCodePoint(0xE0_00);\nconst CODE_BLOCK_OPEN = \"|[\";\nconst CODE_BLOCK_CLOSE = \"]|\";\nconst CODE_LANGUAGE_PATTERN = /^\\s*<!--\\s*language=\"([^\"]*)\"\\s*-->/;\nconst FENCED_BLOCK_PATTERN = /```[\\s\\S]*?```/g;\nconst INLINE_CODE_PATTERN = /`[^`\\n]*`/g;\nconst LINK_PATTERN = /\\[(\\w+)@([\\w.:%#-]+)\\]/g;\nconst CONSTANT_PATTERN = /(?<!\\w)%(\\w+)/g;\nconst TYPE_REF_PATTERN = /(?<!\\w)#(\\w+)/g;\nconst PARAM_REF_PATTERN = /(?<!\\w)@(\\w+)/g;\nconst FUNCTION_REF_PATTERN = /\\b([a-z_][a-z0-9_]*)\\(\\)/g;\n\nconst renderLink = (kind: string, target: string): string => {\n const segments = target.split(/::|[.:]/);\n const lastIndex = segments.length - 1;\n\n if (kind === \"property\" || CALLABLE_LINK_KINDS.has(kind)) {\n segments[lastIndex] = camelCase(segments[lastIndex] ?? \"\");\n }\n\n const symbol = segments.join(\".\");\n\n return `\\`${symbol}${CALLABLE_LINK_KINDS.has(kind) ? \"()\" : \"\"}\\``;\n};\n\nconst trimTrailingNewlines = (value: string): string => {\n let end = value.length;\n\n while (end > 0 && value[end - 1] === \"\\n\") {\n end -= 1;\n }\n\n return value.slice(0, end);\n};\n\nconst renderCodeFence = (body: string): string => {\n const languageMatch = CODE_LANGUAGE_PATTERN.exec(body);\n const fence = (languageMatch?.[1] ?? \"\").trim().toLowerCase();\n const rest = languageMatch === null ? body : body.slice(languageMatch[0].length);\n const code = trimTrailingNewlines(rest.trimStart());\n\n return `\\`\\`\\`${fence}\\n${code}\\n\\`\\`\\``;\n};\n\nconst protectCodeBlocks = (raw: string, protect: (value: string) => string): string => {\n let result = \"\";\n let cursor = 0;\n\n while (cursor < raw.length) {\n const open = raw.indexOf(CODE_BLOCK_OPEN, cursor);\n\n if (open === -1) {\n break;\n }\n\n const close = raw.indexOf(CODE_BLOCK_CLOSE, open + CODE_BLOCK_OPEN.length);\n\n if (close === -1) {\n break;\n }\n\n result += raw.slice(cursor, open);\n result += protect(renderCodeFence(raw.slice(open + CODE_BLOCK_OPEN.length, close)));\n cursor = close + CODE_BLOCK_CLOSE.length;\n }\n\n return result + raw.slice(cursor);\n};\n\nconst gtkDocToMarkdown = (raw: string): string => {\n const stash: string[] = [];\n\n const protect = (value: string): string => {\n const token = `${SENTINEL}${String(stash.length)}${SENTINEL}`;\n stash.push(value);\n\n return token;\n };\n\n let text = protectCodeBlocks(raw, protect);\n text = text.replaceAll(FENCED_BLOCK_PATTERN, (block) => protect(block));\n text = text.replaceAll(INLINE_CODE_PATTERN, (span) => protect(span));\n text = text.replaceAll(LINK_PATTERN, (_match, kind: string, target: string) => protect(renderLink(kind, target)));\n text = text.replaceAll(CONSTANT_PATTERN, (_match, name: string) => protect(`\\`${CONSTANT_MAP[name] ?? name}\\``));\n text = text.replaceAll(TYPE_REF_PATTERN, (_match, name: string) => protect(`\\`${name}\\``));\n text = text.replaceAll(PARAM_REF_PATTERN, (_match, name: string) => protect(`\\`${name}\\``));\n text = text.replaceAll(FUNCTION_REF_PATTERN, (_match, name: string) => protect(`\\`${name}()\\``));\n\n for (let index = stash.length - 1; index >= 0; index -= 1) {\n const value = stash[index] ?? \"\";\n text = text.replaceAll(`${SENTINEL}${String(index)}${SENTINEL}`, () => value);\n }\n\n return text;\n};\n\nexport { gtkDocToMarkdown };\n"]}
|
package/dist/writer/imports.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
declare class ImportsBuilder {
|
|
2
2
|
private named;
|
|
3
3
|
private namespaces;
|
|
4
4
|
private sideEffects;
|
|
5
|
-
|
|
5
|
+
private specifierLine;
|
|
6
|
+
addNamed(specifier: string, name: string, isType?: boolean, alias?: string): void;
|
|
6
7
|
addNamespace(specifier: string, alias: string, isType?: boolean): void;
|
|
7
8
|
addSideEffect(specifier: string): void;
|
|
8
9
|
toSource(): string;
|
|
9
10
|
}
|
|
11
|
+
export { ImportsBuilder };
|
|
10
12
|
//# sourceMappingURL=imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/writer/imports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/writer/imports.ts"],"names":[],"mappings":"AAoBA,cAAM,cAAc;IAChB,OAAO,CAAC,KAAK,CAAoD;IACjE,OAAO,CAAC,UAAU,CAA2C;IAC7D,OAAO,CAAC,WAAW,CAA0B;IAE7C,OAAO,CAAC,aAAa;IAyBrB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAa/E,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,IAAI;IAMpE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAItC,QAAQ,IAAI,MAAM;CAkBrB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/writer/imports.js
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { sortStrings, sortStringsBy, sourceStringLiteral } from "@gtkx/utils";
|
|
2
|
-
|
|
2
|
+
function formatNamedNames(namedNames) {
|
|
3
|
+
return sortStringsBy(namedNames.entries(), ([local]) => local).map(([local, entry]) => {
|
|
4
|
+
const spec = entry.name === local ? entry.name : `${entry.name} as ${local}`;
|
|
5
|
+
return entry.isType ? `type ${spec}` : spec;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
class ImportsBuilder {
|
|
3
9
|
named = new Map();
|
|
4
10
|
namespaces = new Map();
|
|
5
11
|
sideEffects = new Set();
|
|
6
|
-
|
|
12
|
+
specifierLine(specifier) {
|
|
13
|
+
const namespaceImport = this.namespaces.get(specifier);
|
|
14
|
+
const namedNames = this.named.get(specifier);
|
|
15
|
+
if (namespaceImport?.isType === true) {
|
|
16
|
+
return `import type * as ${namespaceImport.alias} from ${sourceStringLiteral(specifier)};`;
|
|
17
|
+
}
|
|
18
|
+
const parts = [];
|
|
19
|
+
if (namespaceImport !== undefined) {
|
|
20
|
+
parts.push(`* as ${namespaceImport.alias}`);
|
|
21
|
+
}
|
|
22
|
+
if (namedNames !== undefined && namedNames.size > 0) {
|
|
23
|
+
parts.push(`{ ${formatNamedNames(namedNames).join(", ")} }`);
|
|
24
|
+
}
|
|
25
|
+
if (parts.length === 0) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return `import ${parts.join(", ")} from ${sourceStringLiteral(specifier)};`;
|
|
29
|
+
}
|
|
30
|
+
addNamed(specifier, name, isType = false, alias) {
|
|
31
|
+
const local = alias ?? name;
|
|
7
32
|
let bucket = this.named.get(specifier);
|
|
8
33
|
if (bucket === undefined) {
|
|
9
34
|
bucket = new Map();
|
|
10
35
|
this.named.set(specifier, bucket);
|
|
11
36
|
}
|
|
12
|
-
|
|
37
|
+
const existing = bucket.get(local);
|
|
38
|
+
bucket.set(local, { name, isType: (existing?.isType ?? true) && isType });
|
|
13
39
|
}
|
|
14
40
|
addNamespace(specifier, alias, isType = false) {
|
|
15
41
|
if (!this.namespaces.has(specifier)) {
|
|
@@ -20,31 +46,16 @@ export class ImportsBuilder {
|
|
|
20
46
|
this.sideEffects.add(specifier);
|
|
21
47
|
}
|
|
22
48
|
toSource() {
|
|
23
|
-
const lines =
|
|
24
|
-
for (const specifier of this.sideEffects) {
|
|
25
|
-
lines.push(`import ${sourceStringLiteral(specifier)};`);
|
|
26
|
-
}
|
|
49
|
+
const lines = Array.from(this.sideEffects, (specifier) => `import ${sourceStringLiteral(specifier)};`);
|
|
27
50
|
const specifiers = new Set([...this.named.keys(), ...this.namespaces.keys()]);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (namespaceImport?.isType === true) {
|
|
33
|
-
lines.push(`import type * as ${namespaceImport.alias} from ${sourceStringLiteral(specifier)};`);
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const parts = [];
|
|
37
|
-
if (namespaceImport !== undefined)
|
|
38
|
-
parts.push(`* as ${namespaceImport.alias}`);
|
|
39
|
-
if (namedNames !== undefined && namedNames.size > 0) {
|
|
40
|
-
const sortedNames = sortStringsBy(namedNames.entries(), ([name]) => name).map(([name, isType]) => isType ? `type ${name}` : name);
|
|
41
|
-
parts.push(`{ ${sortedNames.join(", ")} }`);
|
|
51
|
+
for (const specifier of sortStrings(specifiers)) {
|
|
52
|
+
const line = this.specifierLine(specifier);
|
|
53
|
+
if (line !== undefined) {
|
|
54
|
+
lines.push(line);
|
|
42
55
|
}
|
|
43
|
-
if (parts.length === 0)
|
|
44
|
-
continue;
|
|
45
|
-
lines.push(`import ${parts.join(", ")} from ${sourceStringLiteral(specifier)};`);
|
|
46
56
|
}
|
|
47
57
|
return lines.length === 0 ? "" : `${lines.join("\n")}\n`;
|
|
48
58
|
}
|
|
49
59
|
}
|
|
60
|
+
export { ImportsBuilder };
|
|
50
61
|
//# sourceMappingURL=imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/writer/imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/writer/imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAY9E,SAAS,gBAAgB,CAAC,UAAoC;IAC1D,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE;QAClF,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CA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,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAE3F,KAAK,MAAM,SAAS,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YAE3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7D,CAAC;CACJ;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { sortStrings, sortStringsBy, sourceStringLiteral } from \"@gtkx/utils\";\n\ntype NamespaceImport = {\n alias: string;\n isType: boolean;\n};\n\ntype NamedImport = {\n name: string;\n isType: boolean;\n};\n\nfunction formatNamedNames(namedNames: Map<string, NamedImport>): string[] {\n return sortStringsBy(namedNames.entries(), ([local]) => local).map(([local, entry]) => {\n const spec = entry.name === local ? entry.name : `${entry.name} as ${local}`;\n\n return entry.isType ? `type ${spec}` : spec;\n });\n}\n\nclass ImportsBuilder {\n private named: Map<string, Map<string, NamedImport>> = new Map();\n private namespaces: Map<string, NamespaceImport> = new Map();\n private sideEffects: Set<string> = new Set();\n\n private specifierLine(specifier: string): string | undefined {\n const namespaceImport = this.namespaces.get(specifier);\n const namedNames = this.named.get(specifier);\n\n if (namespaceImport?.isType === true) {\n return `import type * as ${namespaceImport.alias} from ${sourceStringLiteral(specifier)};`;\n }\n\n const parts: string[] = [];\n\n if (namespaceImport !== undefined) {\n parts.push(`* as ${namespaceImport.alias}`);\n }\n\n if (namedNames !== undefined && namedNames.size > 0) {\n parts.push(`{ ${formatNamedNames(namedNames).join(\", \")} }`);\n }\n\n if (parts.length === 0) {\n return undefined;\n }\n\n return `import ${parts.join(\", \")} from ${sourceStringLiteral(specifier)};`;\n }\n\n addNamed(specifier: string, name: string, isType = false, alias?: string): void {\n const local = alias ?? name;\n let bucket = this.named.get(specifier);\n\n if (bucket === undefined) {\n bucket = new Map();\n this.named.set(specifier, bucket);\n }\n\n const existing = bucket.get(local);\n bucket.set(local, { name, isType: (existing?.isType ?? true) && isType });\n }\n\n addNamespace(specifier: string, alias: string, isType = false): void {\n if (!this.namespaces.has(specifier)) {\n this.namespaces.set(specifier, { alias, isType });\n }\n }\n\n addSideEffect(specifier: string): void {\n this.sideEffects.add(specifier);\n }\n\n toSource(): string {\n const lines: string[] = Array.from(\n this.sideEffects,\n (specifier) => `import ${sourceStringLiteral(specifier)};`,\n );\n\n const specifiers: Set<string> = new Set([...this.named.keys(), ...this.namespaces.keys()]);\n\n for (const specifier of sortStrings(specifiers)) {\n const line = this.specifierLine(specifier);\n\n if (line !== undefined) {\n lines.push(line);\n }\n }\n\n return lines.length === 0 ? \"\" : `${lines.join(\"\\n\")}\\n`;\n }\n}\n\nexport { ImportsBuilder };\n"]}
|
package/dist/writer/module.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ImportsBuilder } from "./imports.js";
|
|
2
|
-
|
|
3
|
-
imports: ImportsBuilder;
|
|
2
|
+
declare class ModuleBuilder {
|
|
4
3
|
private bindings;
|
|
5
4
|
private bindingNames;
|
|
6
5
|
private hoistedDescriptors;
|
|
7
6
|
private declarations;
|
|
8
7
|
private registrations;
|
|
8
|
+
imports: ImportsBuilder;
|
|
9
9
|
appendBinding(code: string, name?: string): void;
|
|
10
10
|
hoistDescriptor(expression: string): string;
|
|
11
11
|
appendDeclaration(code: string): void;
|
|
12
12
|
appendRegistration(code: string): void;
|
|
13
13
|
toSource(): string;
|
|
14
14
|
}
|
|
15
|
+
export { ModuleBuilder };
|
|
15
16
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,cAAM,aAAa;IACf,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAgB;IAC9B,OAAO,EAAE,cAAc,CAAwB;IAEtD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAYhD,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAc3C,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIrC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAItC,QAAQ,IAAI,MAAM;CAsBrB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/writer/module.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { ImportsBuilder } from "./imports.js";
|
|
2
|
-
|
|
3
|
-
imports = new ImportsBuilder();
|
|
2
|
+
class ModuleBuilder {
|
|
4
3
|
bindings = [];
|
|
5
4
|
bindingNames = new Set();
|
|
6
5
|
hoistedDescriptors = new Map();
|
|
7
6
|
declarations = [];
|
|
8
7
|
registrations = [];
|
|
8
|
+
imports = new ImportsBuilder();
|
|
9
9
|
appendBinding(code, name) {
|
|
10
10
|
if (name !== undefined) {
|
|
11
|
-
if (this.bindingNames.has(name))
|
|
11
|
+
if (this.bindingNames.has(name)) {
|
|
12
12
|
return;
|
|
13
|
+
}
|
|
13
14
|
this.bindingNames.add(name);
|
|
14
15
|
}
|
|
15
16
|
this.bindings.push(code);
|
|
16
17
|
}
|
|
17
18
|
hoistDescriptor(expression) {
|
|
18
19
|
const existing = this.hoistedDescriptors.get(expression);
|
|
19
|
-
if (existing !== undefined)
|
|
20
|
+
if (existing !== undefined) {
|
|
20
21
|
return existing;
|
|
21
|
-
|
|
22
|
+
}
|
|
23
|
+
const name = `_desc${String(this.hoistedDescriptors.size)}`;
|
|
22
24
|
this.hoistedDescriptors.set(expression, name);
|
|
23
25
|
this.appendBinding(`const ${name} = ${expression};`, name);
|
|
24
26
|
return name;
|
|
@@ -32,15 +34,20 @@ export class ModuleBuilder {
|
|
|
32
34
|
toSource() {
|
|
33
35
|
const sections = [];
|
|
34
36
|
const importsBlock = this.imports.toSource();
|
|
35
|
-
if (importsBlock.length > 0)
|
|
37
|
+
if (importsBlock.length > 0) {
|
|
36
38
|
sections.push(importsBlock.trimEnd());
|
|
37
|
-
|
|
39
|
+
}
|
|
40
|
+
if (this.declarations.length > 0) {
|
|
38
41
|
sections.push(this.declarations.join("\n\n"));
|
|
39
|
-
|
|
42
|
+
}
|
|
43
|
+
if (this.bindings.length > 0) {
|
|
40
44
|
sections.push(this.bindings.join("\n\n"));
|
|
41
|
-
|
|
45
|
+
}
|
|
46
|
+
if (this.registrations.length > 0) {
|
|
42
47
|
sections.push(this.registrations.join("\n\n"));
|
|
48
|
+
}
|
|
43
49
|
return `${sections.join("\n\n")}\n`;
|
|
44
50
|
}
|
|
45
51
|
}
|
|
52
|
+
export { ModuleBuilder };
|
|
46
53
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/writer/module.ts"],"names":[],"mappings":"AAAA,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AAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,QAAQ;QACJ,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QAE7C,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACxC,CAAC;CACJ;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { ImportsBuilder } from \"./imports.js\";\n\nclass ModuleBuilder {\n private bindings: string[] = [];\n private bindingNames: Set<string> = new Set();\n private hoistedDescriptors: Map<string, string> = new Map();\n private declarations: string[] = [];\n private registrations: string[] = [];\n public imports: ImportsBuilder = new ImportsBuilder();\n\n appendBinding(code: string, name?: string): void {\n if (name !== undefined) {\n if (this.bindingNames.has(name)) {\n return;\n }\n\n this.bindingNames.add(name);\n }\n\n this.bindings.push(code);\n }\n\n hoistDescriptor(expression: string): string {\n const existing = this.hoistedDescriptors.get(expression);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const name = `_desc${String(this.hoistedDescriptors.size)}`;\n this.hoistedDescriptors.set(expression, name);\n this.appendBinding(`const ${name} = ${expression};`, name);\n\n return name;\n }\n\n appendDeclaration(code: string): void {\n this.declarations.push(code);\n }\n\n appendRegistration(code: string): void {\n this.registrations.push(code);\n }\n\n toSource(): string {\n const sections: string[] = [];\n const importsBlock = this.imports.toSource();\n\n if (importsBlock.length > 0) {\n sections.push(importsBlock.trimEnd());\n }\n\n if (this.declarations.length > 0) {\n sections.push(this.declarations.join(\"\\n\\n\"));\n }\n\n if (this.bindings.length > 0) {\n sections.push(this.bindings.join(\"\\n\\n\"));\n }\n\n if (this.registrations.length > 0) {\n sections.push(this.registrations.join(\"\\n\\n\"));\n }\n\n return `${sections.join(\"\\n\\n\")}\\n`;\n }\n}\n\nexport { ModuleBuilder };\n"]}
|
package/dist/xml.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,QAAA,MAAM,eAAe,GAAI,SAAS,OAAO,CAAC,UAAU,CAAC,KAAG,SAOlD,CAAC;AAEP,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/xml.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { XMLParser } from "fast-xml-parser";
|
|
2
|
+
const createXmlParser = (options) => new XMLParser({
|
|
3
|
+
ignoreAttributes: false,
|
|
4
|
+
attributeNamePrefix: "@_",
|
|
5
|
+
parseAttributeValue: false,
|
|
6
|
+
parseTagValue: false,
|
|
7
|
+
...options,
|
|
8
|
+
});
|
|
9
|
+
export { createXmlParser };
|
|
10
|
+
//# sourceMappingURL=xml.js.map
|
package/dist/xml.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml.js","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,eAAe,GAAG,CAAC,OAA4B,EAAa,EAAE,CAChE,IAAI,SAAS,CAAC;IACV,gBAAgB,EAAE,KAAK;IACvB,mBAAmB,EAAE,IAAI;IACzB,mBAAmB,EAAE,KAAK;IAC1B,aAAa,EAAE,KAAK;IACpB,GAAG,OAAO;CACb,CAAC,CAAC;AAEP,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { type X2jOptions, XMLParser } from \"fast-xml-parser\";\n\nconst createXmlParser = (options: Partial<X2jOptions>): XMLParser =>\n new XMLParser({\n ignoreAttributes: false,\n attributeNamePrefix: \"@_\",\n parseAttributeValue: false,\n parseTagValue: false,\n ...options,\n });\n\nexport { createXmlParser };\n"]}
|
|
@@ -27,7 +27,7 @@ export type CairoGlyph = { index: number; x: number; y: number };
|
|
|
27
27
|
export type CairoTextCluster = { numBytes: number; numGlyphs: number };
|
|
28
28
|
|
|
29
29
|
export const allocGlyphBuffer = (glyphs: CairoGlyph[]): ExternalObject<Handle> => {
|
|
30
|
-
const buf = alloc(glyphs.length * 24
|
|
30
|
+
const buf = alloc(glyphs.length * 24);
|
|
31
31
|
let offset = 0;
|
|
32
32
|
for (const glyph of glyphs) {
|
|
33
33
|
write(buf, t.uint64, offset, glyph.index);
|
|
@@ -39,7 +39,7 @@ export const allocGlyphBuffer = (glyphs: CairoGlyph[]): ExternalObject<Handle> =
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const allocClusterBuffer = (clusters: CairoTextCluster[]): ExternalObject<Handle> => {
|
|
42
|
-
const buf = alloc(clusters.length * 8
|
|
42
|
+
const buf = alloc(clusters.length * 8);
|
|
43
43
|
let offset = 0;
|
|
44
44
|
for (const cluster of clusters) {
|
|
45
45
|
write(buf, t.int32, offset, cluster.numBytes);
|
|
@@ -471,7 +471,7 @@ const DOUBLE_BUFFER_T = t.boxed("double[]", { ownership: "borrowed", sharedLibra
|
|
|
471
471
|
|
|
472
472
|
const cairoSetDash = bind("libcairo.so.2", "cairo_set_dash", [CONTEXT_T, DOUBLE_BUFFER_T, t.int32, t.float64], t.void);
|
|
473
473
|
Context.prototype.setDash = function (dashes: number[], offset: number): void {
|
|
474
|
-
const dashBuf = alloc(dashes.length * 8
|
|
474
|
+
const dashBuf = alloc(dashes.length * 8);
|
|
475
475
|
for (let i = 0; i < dashes.length; i++) {
|
|
476
476
|
write(dashBuf, t.float64, i * 8, dashes[i]);
|
|
477
477
|
}
|
|
@@ -489,7 +489,7 @@ Context.prototype.getDash = function (): { dashes: number[]; offset: number } {
|
|
|
489
489
|
if (count === 0) {
|
|
490
490
|
return { dashes: [], offset: 0 };
|
|
491
491
|
}
|
|
492
|
-
const dashBuf = alloc(count * 8
|
|
492
|
+
const dashBuf = alloc(count * 8);
|
|
493
493
|
const offsetRef = { value: 0 };
|
|
494
494
|
cairoGetDash(getHandle(this), dashBuf, offsetRef);
|
|
495
495
|
const dashes: number[] = [];
|
|
@@ -600,7 +600,7 @@ const cairoTextExtents = bind(
|
|
|
600
600
|
t.void,
|
|
601
601
|
);
|
|
602
602
|
Context.prototype.textExtents = function (text: string): TextExtents {
|
|
603
|
-
const extents = alloc(48
|
|
603
|
+
const extents = alloc(48);
|
|
604
604
|
cairoTextExtents(getHandle(this), text, extents);
|
|
605
605
|
return readTextExtents(extents);
|
|
606
606
|
};
|
|
@@ -612,7 +612,7 @@ const cairoFontExtents = bind(
|
|
|
612
612
|
t.void,
|
|
613
613
|
);
|
|
614
614
|
Context.prototype.fontExtents = function (): FontExtents {
|
|
615
|
-
const extents = alloc(40
|
|
615
|
+
const extents = alloc(40);
|
|
616
616
|
cairoFontExtents(getHandle(this), extents);
|
|
617
617
|
return readFontExtents(extents);
|
|
618
618
|
};
|
|
@@ -1140,7 +1140,7 @@ const cairoGlyphExtents = bind(
|
|
|
1140
1140
|
);
|
|
1141
1141
|
Context.prototype.glyphExtents = function (glyphs: Array<{ index: number; x: number; y: number }>): TextExtents {
|
|
1142
1142
|
const buf = allocGlyphBuffer(glyphs);
|
|
1143
|
-
const extents = alloc(48
|
|
1143
|
+
const extents = alloc(48);
|
|
1144
1144
|
cairoGlyphExtents(getHandle(this), buf, glyphs.length, extents);
|
|
1145
1145
|
return readTextExtents(extents);
|
|
1146
1146
|
};
|
|
@@ -4,7 +4,7 @@ import type { Status } from "../cairo.js";
|
|
|
4
4
|
const { bind } = t;
|
|
5
5
|
|
|
6
6
|
export const allocMatrix = (): { handle: ExternalObject<Handle>; obj: Matrix } => {
|
|
7
|
-
const handle = alloc(48
|
|
7
|
+
const handle = alloc(48);
|
|
8
8
|
const obj = wrapHandle(handle, Matrix);
|
|
9
9
|
return { handle, obj };
|
|
10
10
|
};
|
|
@@ -104,7 +104,7 @@ const cairoMatrixInit = bind(
|
|
|
104
104
|
|
|
105
105
|
export class Matrix {
|
|
106
106
|
constructor(xx: number, yx: number, xy: number, yy: number, x0: number, y0: number) {
|
|
107
|
-
const handle = alloc(48
|
|
107
|
+
const handle = alloc(48);
|
|
108
108
|
setHandle(this, handle);
|
|
109
109
|
cairoMatrixInit(handle, xx, yx, xy, yy, x0, y0);
|
|
110
110
|
}
|
|
@@ -60,7 +60,7 @@ export class RecordingSurface extends Surface {
|
|
|
60
60
|
super();
|
|
61
61
|
let handle: ExternalObject<Handle>;
|
|
62
62
|
if (extents) {
|
|
63
|
-
const rect = alloc(32
|
|
63
|
+
const rect = alloc(32);
|
|
64
64
|
write(rect, t.float64, 0, extents.x);
|
|
65
65
|
write(rect, t.float64, 8, extents.y);
|
|
66
66
|
write(rect, t.float64, 16, extents.width);
|
|
@@ -89,7 +89,7 @@ export class RecordingSurface extends Surface {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
getExtents(): { x: number; y: number; width: number; height: number } | null {
|
|
92
|
-
const rect = alloc(32
|
|
92
|
+
const rect = alloc(32);
|
|
93
93
|
const result = cairoRecordingSurfaceGetExtents(getHandle(this), rect) as boolean;
|
|
94
94
|
if (!result) return null;
|
|
95
95
|
return {
|
|
@@ -86,7 +86,7 @@ class RegionImpl extends Region {
|
|
|
86
86
|
if (rects.length === 0) {
|
|
87
87
|
return RegionImpl.empty();
|
|
88
88
|
}
|
|
89
|
-
const buf = alloc(rects.length * 16
|
|
89
|
+
const buf = alloc(rects.length * 16);
|
|
90
90
|
let offset = 0;
|
|
91
91
|
for (const rect of rects) {
|
|
92
92
|
write(buf, t.int32, offset, rect.x);
|
|
@@ -106,7 +106,7 @@ const cairoScaledFontExtents = bind(
|
|
|
106
106
|
t.void,
|
|
107
107
|
);
|
|
108
108
|
ScaledFont.prototype.extents = function (): FontExtents {
|
|
109
|
-
const ext = alloc(40
|
|
109
|
+
const ext = alloc(40);
|
|
110
110
|
cairoScaledFontExtents(getHandle(this), ext);
|
|
111
111
|
return readFontExtents(ext);
|
|
112
112
|
};
|
|
@@ -122,7 +122,7 @@ const cairoScaledFontTextExtents = bind(
|
|
|
122
122
|
t.void,
|
|
123
123
|
);
|
|
124
124
|
ScaledFont.prototype.textExtents = function (text: string): TextExtents {
|
|
125
|
-
const ext = alloc(48
|
|
125
|
+
const ext = alloc(48);
|
|
126
126
|
cairoScaledFontTextExtents(getHandle(this), text, ext);
|
|
127
127
|
return readTextExtents(ext);
|
|
128
128
|
};
|
|
@@ -140,7 +140,7 @@ const cairoScaledFontGlyphExtents = bind(
|
|
|
140
140
|
);
|
|
141
141
|
ScaledFont.prototype.glyphExtents = function (glyphs: Array<{ index: number; x: number; y: number }>): TextExtents {
|
|
142
142
|
const buf = allocGlyphBuffer(glyphs);
|
|
143
|
-
const ext = alloc(48
|
|
143
|
+
const ext = alloc(48);
|
|
144
144
|
cairoScaledFontGlyphExtents(getHandle(this), buf, glyphs.length, ext);
|
|
145
145
|
return readTextExtents(ext);
|
|
146
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/codegen",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"description": "Generates the typed GTKX bindings and API reference from GIR and OpenGL registry data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
".": {
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./gi": {
|
|
33
|
+
"types": "./dist/gi.d.ts",
|
|
34
|
+
"default": "./dist/gi.js"
|
|
35
|
+
},
|
|
36
|
+
"./jsx": {
|
|
37
|
+
"types": "./dist/jsx.d.ts",
|
|
38
|
+
"default": "./dist/jsx.js"
|
|
31
39
|
}
|
|
32
40
|
},
|
|
33
41
|
"sideEffects": false,
|
|
@@ -40,16 +48,14 @@
|
|
|
40
48
|
"node": ">=24"
|
|
41
49
|
},
|
|
42
50
|
"dependencies": {
|
|
43
|
-
"@types/node": "^26.1.
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@gtkx/
|
|
48
|
-
"@gtkx/utils": "1.0.0-rc.
|
|
51
|
+
"@types/node": "^26.1.2",
|
|
52
|
+
"fast-xml-parser": "^5.10.1",
|
|
53
|
+
"typescript": "^6.0.3",
|
|
54
|
+
"@gtkx/config": "1.0.0-rc.2",
|
|
55
|
+
"@gtkx/react": "1.0.0-rc.2",
|
|
56
|
+
"@gtkx/utils": "1.0.0-rc.2"
|
|
49
57
|
},
|
|
50
58
|
"scripts": {
|
|
51
|
-
"build": "tsc -b tsconfig.lib.json",
|
|
52
|
-
"typecheck": "tsc -b --emitDeclarationOnly",
|
|
53
59
|
"release": "tsx ../../scripts/release-package.ts"
|
|
54
60
|
}
|
|
55
61
|
}
|