Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved from JSDoc to type declarations for options objects #51

Merged
merged 39 commits into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6176251
- Moved from JSDoc to type declarations for additional options object…
pklaschka Jun 26, 2019
4b88c9f
- Fixed remaining "static classes"
pklaschka Jun 26, 2019
b775510
- Removed unnecessary additional `{object}` specs in JSDoc for option…
pklaschka Jun 26, 2019
d366aed
- Changed style of `uxp` module declaration
pklaschka Jun 28, 2019
977d2da
- Fixed "small typo" ;-)
pklaschka Jun 28, 2019
52eb0dd
- Another "typo" :laughing:
pklaschka Jun 28, 2019
64ae8c6
- Moved SceneNodeList to `scenegraph` module
pklaschka Jun 29, 2019
3cbb68b
- Fixed typos in `README.md`
pklaschka Jun 29, 2019
1d1bf72
- Fixed "typos" in `assets` module
pklaschka Jun 29, 2019
c4955f7
- Fixed "typos" in `assets` module
pklaschka Jun 29, 2019
860fa5b
- Fixed "typos" in `assets` module
pklaschka Jun 29, 2019
bf44c8c
- Some further enhancements
pklaschka Jun 29, 2019
105fe16
- Fixes in cloud module
pklaschka Jun 29, 2019
9c66992
- Fixes in `scenegraph` module
pklaschka Jun 29, 2019
7709a24
- Added `tsconfig.json` to enable linting in editors
pklaschka Jun 29, 2019
f462a54
- Fixed issues of the `cloud` module
pklaschka Jun 29, 2019
07a903c
- Moved type declarations to global namespace
pklaschka Jun 29, 2019
c0d3298
- "Refixed" interaction types
pklaschka Jun 29, 2019
d663c5a
- Fixed `viewport` "class"
pklaschka Jun 29, 2019
2b3ea03
- Fixed `commands` "class"
pklaschka Jun 29, 2019
63574ec
- Fixed `clipboard` "class"
pklaschka Jun 29, 2019
37b07a1
- Fixed `application` "class"
pklaschka Jun 29, 2019
419b4bf
- Added a Pull Request template
pklaschka Jun 29, 2019
8f7bd4f
- Removed unnecessary `export {}` in `index.d.ts`
pklaschka Jun 29, 2019
3d7477e
- Fixed export in `scenegraph`
pklaschka Jun 29, 2019
da6929f
- Removed tsconfig.json
pklaschka Jun 29, 2019
c1634c3
Revert "- Fixed export in `scenegraph`"
pklaschka Jun 29, 2019
d9a8a66
- Fixed uxp export yet again...
pklaschka Jun 29, 2019
3bfb154
- Added tsconfig.json back in...
pklaschka Jun 29, 2019
81d353f
- Yet another way to export stuff
pklaschka Jun 29, 2019
0bf2f1a
- Changed way `viewport` module gets exported
pklaschka Jun 29, 2019
3a83dba
- Changed way `interactions` module gets exported
pklaschka Jun 29, 2019
da3022f
- Changed way `commands` module gets exported
pklaschka Jun 29, 2019
fb1bd97
- Changed way `cloud` module gets exported
pklaschka Jun 29, 2019
f0a2e1b
- Changed way `clipboard` module gets exported
pklaschka Jun 29, 2019
bb138d0
- Changed way `assets` module gets exported
pklaschka Jun 29, 2019
7935286
- Changed way `application` module gets exported
pklaschka Jun 29, 2019
b0a1352
- Fixed (?) shell declaration
pklaschka Jun 29, 2019
bdf43da
- Increased package version number
pklaschka Jun 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Contents of this Pull Request
This PR makes changes to
- [ ] The typings in the `types` folder
- [ ] Configuration files (`tsconfig.json`, `jsconfig.json`, `.gitignore` etc.)
- [ ] The sample files (e.g., `sample.js`)
- [ ] The `README.md` or other files containing documentation
- [ ] Other

### Purpose of this Pull Request
\[Description of what this pull request achieves / why it should get merged\]

### Issues resolved by this Pull Request
- fixes \[issue id\]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# typings
Typings for Adobe XD API Surfaces

Instructions for using these type defintions to get autocompletion features in editors and IDEs can be found in the [repository's wiki](https://github.com/AdobeXD/typings/wiki/Autocompletion-in-editors-and-IDEs).
Instructions for using these type definitions to get autocompletion features in editors and IDEs can be found in the [repository's wiki](https://github.com/AdobeXD/typings/wiki/Autocompletion-in-editors-and-IDEs).

## Download

The best option to download the typings is to download the latest release from https://github.com/AdobeXD/typings/releases.
The best option to download the typings is to download the latest release from <https://github.com/AdobeXD/typings/releases>.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobexd/typings",
"version": "19.0.0",
"version": "20.1.0",
"typings": "./types/index.d.ts",
"description": "Typings for Adobe XD CC",
"repository": {
Expand All @@ -27,6 +27,11 @@
"email": "[email protected]",
"url": "https://github.com/pklaschka"
},
{
"name": "Eric Robinson",
"email": "[email protected]",
"url": "https://github.com/ericdrobinson"
},
{
"name": "Kerri Shotts",
"email": "[email protected]",
Expand Down
8 changes: 6 additions & 2 deletions sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ const {Text, Ellipse, Color, RootNode} = require("scenegraph");
const clipboard = require("clipboard");
const shell = require("uxp").shell;
const fs = require("uxp").storage.localFileSystem;
const assets = require('assets');

/**
* @param {Selection} selection
* @param {RootNode} documentRoot
*/
async function test(selection, documentRoot) {
selection.items.forEach(node => {
selection.items.forEach(async node => {
console.log("Hello world: ", node);
if (node instanceof Text) {
clipboard.copyText(node.text);
} else if (node instanceof Ellipse) {
node.fill = new Color("#ffaaee");
shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
await shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
}
});
const tempFolder = await fs.getTemporaryFolder();
Expand All @@ -28,6 +29,9 @@ async function test(selection, documentRoot) {
} else if (anotherFile.isFolder) {
console.log("That's a folder. It shouldn't be a folder. What have you done?")
}

const colors = assets.colors.get();
console.log(colors);
}

module.exports = {
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"strict": true,
"target": "es2015",
"baseUrl": "./",
"lib": [
"es2015",
"dom"
],
"paths": {
"*": [
"types/*"
]
}
}
}
48 changes: 20 additions & 28 deletions types/application.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Color, SceneNode} from "./scenegraph";
import {Color, SceneNode} from "scenegraph";

/**
* All rendition settings fields are required (for a given rendition type) unless otherwise specified.
Expand Down Expand Up @@ -49,34 +49,26 @@ type RenditionResult = {
}

/**
* The application module exposes useful information about XD's state, along with APIs for exporting content.
* Generate renditions of nodes in the document in a batch. Overwrites any existing files without warning.
*
* A single createRenditions() call can generate any number of renditions, including multiple renditions of the same node (with different output settings) or renditions of multiple different nodes. Only one createRenditions() call can be executing at any given time, so wait for the Promise it returns before calling it again.
*
* @param renditions List of renditions to generate
* @return Promise<Array<RenditionResult>, string> - Promise which is fulfilled with an array of RenditionResults (pointing to the same outputFiles that were originally passed in, or rejected with an error string if one or more renditions failed for any reason.
*/
declare class application {
export function createRenditions(renditions: RenditionSettings[]): Promise<RenditionResult[] | string>;

/**
* Generate renditions of nodes in the document in a batch. Overwrites any existing files without warning.
*
* A single createRenditions() call can generate any number of renditions, including multiple renditions of the same node (with different output settings) or renditions of multiple different nodes. Only one createRenditions() call can be executing at any given time, so wait for the Promise it returns before calling it again.
*
* @param renditions List of renditions to generate
* @return Promise<Array<RenditionResult>, string> - Promise which is fulfilled with an array of RenditionResults (pointing to the same outputFiles that were originally passed in, or rejected with an error string if one or more renditions failed for any reason.
*/
static createRenditions(renditions: RenditionSettings[]): Promise<RenditionResult[] | string>;

/**
* Adobe XD version number in the form "major.minor.patch.build"
*/
static readonly version: string;

/**
* Current language the application UI is using. This may not equal the user's OS locale setting: it is the closest locale supported by XD - use this when you want your plugin's UI to be consistent with XD's UI. Specifies language only, with no region info (e.g. "fr", not "fr_FR").
*/
static readonly appLanguage: string;
/**
* Adobe XD version number in the form "major.minor.patch.build"
*/
export const version: string;

/**
* User's OS-wide locale setting. May not match the XD UI, since XD does not support all world languages. Includes both language and region (e.g. "fr_CA" or "en_US").
*/
static readonly systemLocale: string;
}
/**
* Current language the application UI is using. This may not equal the user's OS locale setting: it is the closest locale supported by XD - use this when you want your plugin's UI to be consistent with XD's UI. Specifies language only, with no region info (e.g. "fr", not "fr_FR").
*/
export const appLanguage: string;

export = application;
/**
* User's OS-wide locale setting. May not match the XD UI, since XD does not support all world languages. Includes both language and region (e.g. "fr_CA" or "en_US").
*/
export const systemLocale: string;
Loading