mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
43bbb249ab
* Allow paper core import in TypeScript Typings were missing when importing paper core version with: `import * as paper from 'paper/dist/paper-core'` syntax. This changes the generated TypeScript definition so that it exports two modules: `paper` and `paper/dist/paper-core`. In the same logic, `paper-core.d.ts` file is added to make sure that the corresponding definition is automatically loaded. This also takes care of the fact that `PaperScript` class is not available in paper core version, by removing it from the corresponding TypeScript definition. Finally, this also simplifies existing definition by directly exporting a `PaperScope` instance as the module instead of duplicating all `PaperScope` properties and methods on the module itself. Closes #1713
65 lines
1.4 KiB
Text
65 lines
1.4 KiB
Text
/*!
|
|
* Paper.js v{{version}} - The Swiss Army Knife of Vector Graphics Scripting.
|
|
* http://paperjs.org/
|
|
*
|
|
* Copyright (c) 2011 - 2019, Juerg Lehni & Jonathan Puckey
|
|
* http://scratchdisk.com/ & https://puckey.studio/
|
|
*
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* Date: {{date}}
|
|
*
|
|
* This is an auto-generated type definition.
|
|
*/
|
|
|
|
declare namespace paper {
|
|
{{#classes}}
|
|
|
|
{{#doc}}4{{/doc}}
|
|
class {{className}} {{#extends}}extends {{extends}}{{/extends}} {
|
|
{{#properties}}
|
|
{{#doc}}8{{/doc}}
|
|
{{static}}{{readOnly}}{{name}}{{type}}
|
|
|
|
{{/properties}}
|
|
{{#classesPointers}}
|
|
{{name}}: typeof {{name}}
|
|
{{/classesPointers}}
|
|
|
|
{{#methods}}
|
|
{{#doc}}8{{/doc}}
|
|
{{static}}{{name}}({{params}}){{type}}
|
|
|
|
{{/methods}}
|
|
}
|
|
{{#hasStaticConstructors}}
|
|
namespace {{className}} {
|
|
{{#staticConstructors}}
|
|
|
|
class {{name}} extends {{className}} {
|
|
{{#constructors}}
|
|
{{#doc}}12{{/doc}}
|
|
constructor({{params}})
|
|
|
|
{{/constructors}}
|
|
}
|
|
{{/staticConstructors}}
|
|
}
|
|
{{/hasStaticConstructors}}
|
|
{{/classes}}
|
|
}
|
|
|
|
|
|
declare module 'paper/dist/paper-core'
|
|
{
|
|
const paperCore: Pick<paper.PaperScope, Exclude<keyof paper.PaperScope, 'PaperScript'>>;
|
|
export = paperCore
|
|
}
|
|
|
|
declare module 'paper'
|
|
{
|
|
const paperFull: paper.PaperScope;
|
|
export = paperFull
|
|
}
|