Skip to content

Commit a5305e1

Browse files
authored
v20.1 – Merge pull request #51 from AdobeXD/uxp-options-fix
Moved from JSDoc to type declarations for options objects
2 parents 2bc1dca + bdf43da commit a5305e1

15 files changed

+672
-701
lines changed

PULL_REQUEST_TEMPLATE.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Contents of this Pull Request
2+
This PR makes changes to
3+
- [ ] The typings in the `types` folder
4+
- [ ] Configuration files (`tsconfig.json`, `jsconfig.json`, `.gitignore` etc.)
5+
- [ ] The sample files (e.g., `sample.js`)
6+
- [ ] The `README.md` or other files containing documentation
7+
- [ ] Other
8+
9+
### Purpose of this Pull Request
10+
\[Description of what this pull request achieves / why it should get merged\]
11+
12+
### Issues resolved by this Pull Request
13+
- fixes \[issue id\]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# typings
22
Typings for Adobe XD API Surfaces
33

4-
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).
4+
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).
55

66
## Download
77

8-
The best option to download the typings is to download the latest release from https://github.com/AdobeXD/typings/releases.
8+
The best option to download the typings is to download the latest release from <https://github.com/AdobeXD/typings/releases>.

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobexd/typings",
3-
"version": "19.0.0",
3+
"version": "20.1.0",
44
"typings": "./types/index.d.ts",
55
"description": "Typings for Adobe XD CC",
66
"repository": {
@@ -27,6 +27,11 @@
2727
"email": "[email protected]",
2828
"url": "https://github.com/pklaschka"
2929
},
30+
{
31+
"name": "Eric Robinson",
32+
"email": "[email protected]",
33+
"url": "https://github.com/ericdrobinson"
34+
},
3035
{
3136
"name": "Kerri Shotts",
3237
"email": "[email protected]",

sample.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ const {Text, Ellipse, Color, RootNode} = require("scenegraph");
22
const clipboard = require("clipboard");
33
const shell = require("uxp").shell;
44
const fs = require("uxp").storage.localFileSystem;
5+
const assets = require('assets');
56

67
/**
78
* @param {Selection} selection
89
* @param {RootNode} documentRoot
910
*/
1011
async function test(selection, documentRoot) {
11-
selection.items.forEach(node => {
12+
selection.items.forEach(async node => {
1213
console.log("Hello world: ", node);
1314
if (node instanceof Text) {
1415
clipboard.copyText(node.text);
1516
} else if (node instanceof Ellipse) {
1617
node.fill = new Color("#ffaaee");
17-
shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
18+
await shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
1819
}
1920
});
2021
const tempFolder = await fs.getTemporaryFolder();
@@ -28,6 +29,9 @@ async function test(selection, documentRoot) {
2829
} else if (anotherFile.isFolder) {
2930
console.log("That's a folder. It shouldn't be a folder. What have you done?")
3031
}
32+
33+
const colors = assets.colors.get();
34+
console.log(colors);
3135
}
3236

3337
module.exports = {

tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true,
4+
"target": "es2015",
5+
"baseUrl": "./",
6+
"lib": [
7+
"es2015",
8+
"dom"
9+
],
10+
"paths": {
11+
"*": [
12+
"types/*"
13+
]
14+
}
15+
}
16+
}

types/application.d.ts

+20-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Color, SceneNode} from "./scenegraph";
1+
import {Color, SceneNode} from "scenegraph";
22

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

5151
/**
52-
* The application module exposes useful information about XD's state, along with APIs for exporting content.
52+
* Generate renditions of nodes in the document in a batch. Overwrites any existing files without warning.
53+
*
54+
* 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.
55+
*
56+
* @param renditions List of renditions to generate
57+
* @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.
5358
*/
54-
declare class application {
59+
export function createRenditions(renditions: RenditionSettings[]): Promise<RenditionResult[] | string>;
5560

56-
/**
57-
* Generate renditions of nodes in the document in a batch. Overwrites any existing files without warning.
58-
*
59-
* 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.
60-
*
61-
* @param renditions List of renditions to generate
62-
* @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.
63-
*/
64-
static createRenditions(renditions: RenditionSettings[]): Promise<RenditionResult[] | string>;
65-
66-
/**
67-
* Adobe XD version number in the form "major.minor.patch.build"
68-
*/
69-
static readonly version: string;
70-
71-
/**
72-
* 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").
73-
*/
74-
static readonly appLanguage: string;
61+
/**
62+
* Adobe XD version number in the form "major.minor.patch.build"
63+
*/
64+
export const version: string;
7565

76-
/**
77-
* 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").
78-
*/
79-
static readonly systemLocale: string;
80-
}
66+
/**
67+
* 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").
68+
*/
69+
export const appLanguage: string;
8170

82-
export = application;
71+
/**
72+
* 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").
73+
*/
74+
export const systemLocale: string;

0 commit comments

Comments
 (0)