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

Xd 29 updates #77

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
29 changes: 20 additions & 9 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Artboard, SceneNode} from "./scenegraph";
import {Artboard, SceneNode} from "scenegraph";

declare global {
/**
Expand All @@ -7,7 +7,7 @@ declare global {
*/
function require(module: string): void;

let module: {exports:any};
let module: { exports: any };

/**
* The selection object represents the currently selected set of nodes in the UI. You can set the selection to use it as input for commands, or to determine what is left selected for the user when your plugin’s edit operation completes.
Expand Down Expand Up @@ -37,26 +37,37 @@ declare global {
/**
* Array representing the current selection plus any locked items that the user has attempted to select.
*/
itemsIncludingLocked: Array<SceneNode>;
readonly itemsIncludingLocked: Array<SceneNode>;
pklaschka marked this conversation as resolved.
Show resolved Hide resolved
/**
* True if the selection isn’t empty and consists of one or more non-Artboards. Never true at the same time as hasArtboards.
*/
hasArtwork: boolean;
readonly hasArtwork: boolean;
/**
* True if the selection isn’t empty and consists of one or more Artboards. Never true at the same time as hasArtwork.
*/
hasArtboards: boolean;
readonly hasArtboards: boolean;
/**
* The context in which selection and edit operations must occur. If the user hasn’t drilled into any container node, this value is the document root, and its scope includes all immediate children of the pasteboard (including Artboards), and all immediate children of all those Artboards.
*/
editContext: SceneNode;
readonly editContext: SceneNode;
/**
* The preferred parent to insert newly added content into. Takes into account the current edit context as well as the “focused artboard” if in the root context.
* The preferred parent to insert newly added content into. Takes into account the current edit context as well as the "focused artboard" if in the root context.
Typically this is the same parent where, for example, XD's shape drawing tools would add items.
*
* _Selected items are not necessarily all immediate children of the `insertionParent`._ They can be anywhere within the [edit context's](/reference/core/edit-context.md) scope.
pklaschka marked this conversation as resolved.
Show resolved Hide resolved
*/
insertionParent: SceneNode;
readonly insertionParent: SceneNode;
/**
* The artboard the user is currently most focused on (via recent selection or edit operations). May be null, for example if no artboards exist or if the user just deleted an artboard.
*/
focusedArtboard: Artboard | null | undefined;
readonly focusedArtboard: Artboard | null | undefined;

/**
* Returns true if the node is accessible for editing in the scope of the current edit context.
* If false, the node cannot be edited given the user's current selection.
* Nodes that are currently selected are always in the current edit context.
* @param node
*/
isInEditContext(node: SceneNode): boolean;
pklaschka marked this conversation as resolved.
Show resolved Hide resolved
}
}