{"_id":"@aire-ux/typed-mxgraph","_rev":"1-b9c8e73af2a88ab052f3bd8243d49e82","name":"@aire-ux/typed-mxgraph","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.4":{"name":"@aire-ux/typed-mxgraph","version":"1.0.4","author":{"name":"鸿则","email":"hungtcs@163.com"},"license":"MIT","scripts":{"pretest":"tsc --noEmit","test":"jest --verbose","eslint":"eslint \"**/*.d.ts\"","prettier":"prettier --write \"**/*.d.ts\"","prettier:check":"prettier --check \"**/*.d.ts\""},"devDependencies":{"@types/jest":"^26.0.19","@typescript-eslint/eslint-plugin":"^3.10.1","@typescript-eslint/parser":"^3.10.1","eslint":"^7.11.0","eslint-plugin-log":"^1.2.7","jest":"^26.6.3","mxgraph":"^4.2.2","prettier":"^2.1.2","ts-jest":"^26.4.4","ts-node":"^9.1.1","typescript":"^4.1.3"},"peerDependencies":{"@aire-ux/mxgraph":"^4.2.4"},"description":"mxGraph typescript declarations","main":"index.d.ts","dependencies":{},"repository":{"type":"git","url":"git+https://github.com/typed-mxgraph/typed-mxgraph.git"},"bugs":{"url":"https://github.com/typed-mxgraph/typed-mxgraph/issues"},"homepage":"https://github.com/typed-mxgraph/typed-mxgraph#readme","keywords":["mxgraph","types"],"gitHead":"14a7fbff0ef82d2067de7380349ebb412fa95ef2","_id":"@aire-ux/typed-mxgraph@1.0.4","_nodeVersion":"12.21.0","_npmVersion":"7.18.1","dist":{"integrity":"sha512-yLZz6kivy03S+NtcjgjWBnUOiSFM5/2J4H1zvNcUXxU3EW43OFdsPEU2p+vjQoR6M56wg0UXSjV3I1wlxHGgYQ==","shasum":"d239a286d6ba4ede73f2cc0e6282b4da563b6df5","tarball":"https://registry.npmjs.org/@aire-ux/typed-mxgraph/-/typed-mxgraph-1.0.4.tgz","fileCount":151,"unpackedSize":983536,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5198RCVs8QK6wPkdMVisVhtuDypSBrN6chLjB62ccuwIgSayyY0vIRiGjZoe7jCBfAS4cG2iBvpxNf2//UzuMsco="}]},"_npmUser":{"name":"sunshowerjoe","email":"josiah@sunshower.io"},"directories":{},"maintainers":[{"name":"sunshowerjoe","email":"josiah@sunshower.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-mxgraph_1.0.4_1637277143575_0.800107510464211"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-18T23:12:23.519Z","1.0.4":"2021-11-18T23:12:23.801Z","modified":"2022-04-04T12:21:53.809Z"},"maintainers":[{"name":"sunshowerjoe","email":"josiah@sunshower.io"}],"description":"mxGraph typescript declarations","homepage":"https://github.com/typed-mxgraph/typed-mxgraph#readme","keywords":["mxgraph","types"],"repository":{"type":"git","url":"git+https://github.com/typed-mxgraph/typed-mxgraph.git"},"author":{"name":"鸿则","email":"hungtcs@163.com"},"bugs":{"url":"https://github.com/typed-mxgraph/typed-mxgraph/issues"},"license":"MIT","readme":"Typed mxGraph\n====\n\n[![Build](https://github.com/typed-mxgraph/typed-mxgraph/workflows/Validation/badge.svg)](https://github.com/typed-mxgraph/typed-mxgraph/actions)\n[![npm version](https://badge.fury.io/js/%40typed-mxgraph%2Ftyped-mxgraph.svg)](https://www.npmjs.com/package/@typed-mxgraph/typed-mxgraph)\n[![GitHub license](https://img.shields.io/github/license/typed-mxgraph/typed-mxgraph)](https://github.com/typed-mxgraph/typed-mxgraph/blob/master/LICENSE)\n\nmxGraph Typescript Declarations For [Official mxGraph NPM Package][mxgraph].\n\n### Usage\n1. Add `mxgraph` and `@typed-mxgraph/typed-mxgraph` dependencies to your project:\n\n   npm:\n   ```shell\n    npm install --save mxgraph\n    npm install --save-dev @typed-mxgraph/typed-mxgraph\n    ```\n   yarn:\n   ```shell\n   yarn add mxgraph\n   yarn add --dev @typed-mxgraph/typed-mxgraph\n   ```\n2. Update `tsconfig.json` append `node_modules/@typed-mxgraph` to `typeRoots`:\n    ```json\n    {\n      \"compilerOptions\": {\n        \"target\": \"es5\",\n        \"module\": \"commonjs\",\n        \"esModuleInterop\": true,\n        \"typeRoots\": [\n          \"node_modules/@types\",\n          \"node_modules/@typed-mxgraph\"\n        ]\n      }\n    }\n    ```\n3. Import mxGraph factory:\n    ```typescript\n    import factory from 'mxgraph';\n\n    const mx = factory({\n      mxBasePath: '',\n    });\n    console.log(mx.mxClient.VERSION);\n    ```\n4. (optional) Create a helper to import mxgraph\n    ```ts\n    // src/mxgraph.ts\n    import factory from 'mxgraph';\n\n    (window as any)['mxBasePath'] = 'assets/mxgraph';\n\n    export default factory({\n      // not working see https://github.com/jgraph/mxgraph/issues/479\n      mxBasePath: 'assets/mxgraph',\n    });\n    ```\n    ```ts\n    // src/application.ts\n    import mx from './mxgraph';                       // <- import values from factory()\n    import { mxGraph, mxGraphModel } from 'mxgraph';  // <- import types only\n\n    export class Application {\n\n      constructor(container: HTMLElement) {\n        if(mx.mxClient.isBrowserSupported()) {\n          console.log('Yes! Yes!');\n        }\n\n        const graph: mxGraph = new mx.mxGraph(container);\n        const model: mxGraphModel = graph.getModel();\n        model.beginUpdate();\n        try {\n          graph.insertVertex(graph.getDefaultParent(), '', 'TEST', 0, 0, 100, 100);\n        } finally {\n          model.endUpdate();\n        }\n      }\n\n    }\n    ```\n\nDemos: \n- https://github.com/typed-mxgraph/typed-mxgraph-example-bundled-with-rollup\n- https://github.com/typed-mxgraph/typed-mxgraph-example-bundled-with-webpack\n\n\n\n### Implementation\n\nTypes have been initially created from mxGraph `4.1.0` by hand (1st hosting repository was [mxgraph-type-definitions]) and progressively updated when new mxgraph\nversions have been released.\n\nThe mxgraph lib is almost fully covered by types in this project. The issues you may encounter are\n* API changes in recent mxgraph have not been reported. We haven't decided how we will manage this in the future, so for now, they are updated when user detect issues\n* Function arguments types or 'mandatoriness' may not be accurate: even by reading the JS code, it is sometimes hard to figure out what is the correct type.\n* Historically, we try to avoid `any` and use optional when we don't know.\n* We expect user to provide feedbacks by creating GitHub issues and/or Pull Requests when they notice issue with the types.\n\n\n### Implementation Progress\n\nThe definitions target mxGraph `4.2.2`. See the implementation status in the following table.\n- progress: initial support\n  - not yet: no support at all\n  - partial: implementation started, but some classes/fields/methods are missing\n  - completed: all classes/fields/methods should exist (fill an issue and/or provide a Pull Request if you detect an issue) but\n    - TSDoc is not fully accurate\n    - some type declaration may be wrong\n- checked: a finest review has been conducted about TSDoc, mxGraph types used by functions/methods, fields, ...\n\n| Module         | Progress  | Checked |\n|:---------------|:---------:|:-------:|\n| editor         | partial   | no      |\n| handler        | completed | no      |\n| io             | completed | no      |\n| layout         | completed | no      |\n| model          | completed | no      |\n| shape          | completed | no      |\n| util           | partial   | no      |\n| view           | partial   | no      |\n| mxClient.d.ts  | completed | no      |\n\n\n### Development\n\n* converting mxGraph API documentation to TSDoc: see [regexp conversion helpers](./tsdoc-conversion-helpers.md) \n\n\n### Also See\n\nWe are actively developing, if you want to be a contributor, please refer to the following links\n\n- [mxgraph-road-to-DefinitelyTyped]\n- https://github.com/jgraph/mxgraph/issues/81\n- https://github.com/DefinitelyTyped/DefinitelyTyped/issues/5317\n\n[mxgraph]: https://www.npmjs.com/package/mxgraph\n[mxgraph-type-definitions]: https://github.com/hungtcs/mxgraph-type-definitions\n[mxgraph-road-to-DefinitelyTyped]: https://github.com/process-analytics/mxgraph-road-to-DefinitelyTyped\n","readmeFilename":"README.md"}