Socket
Socket
Sign inDemoInstall

@adobe/cc-ext-uxp-types

Package Overview
Dependencies
0
Maintainers
21
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @adobe/cc-ext-uxp-types

Typescript definitions for the Adobe UXP JS API


Version published
Maintainers
21
Install size
473 kB
Created

Readme

Source

cc-ext-uxp-types

Type Definitions for Adobe UXP (Unified Extensibility Platform).

UXP (Unified Extensibility Platform) is powered by a modern JavaScript engine, offers a curated selection of UI components and a more streamlined workflow for plugin developers to build plugins for the UXP-powered Host Applications(e.g Adobe Photoshop, Adobe InDesign and Adobe XD). UXP provides a set of common JavaScript APIs that are available in these Host Applications and the types are available for these common set of UXP JavaScript APIs in this repo.These types have been auto generated using an internal script within UXP codebase.

Note: Type definitions for the Host Application provided JavaScript APIs are present in separate repo and will need to be installed separately.

Installation

Instructions for how to download/install the UXP Type Definitions onto your machine.

Example:

npm install @adobe/cc-ext-uxp-types

Config

For using the UXP Type Definitions within your code editor, you need to create a tsconfig.json in your typescript project and add reference to the type declaration in compilerOptions.
To make sure that UXP types do not conflict with the available web standard DOM types, update the required lib options to exclude these standard types.(Refer: https://www.typescriptlang.org/tsconfig#lib)
Note: Please use jsconfig.json for JavaScript projects

ts/jsconfig.json:

{
  "compilerOptions": {
     ..., // your existing configuration 
    // typeRoots override defaults, so be sure to include the implicit @types as well
    "typeRoots": [
      "node_modules/@types",
      "node_modules/@adobe/cc-ext-uxp-types"
    ],
    // Note that "DOM" is not included in lib options to exclude web DOM types
    "lib": ["ES2015"] // required ES version
  }
}

Once you have setup the configuration, you will be able to leverage the type definitions for type suggestions, API usage and information, auto imports etc

Known Issues

  • UXP code is primarily written in JavaScript, and not all parameters in the type definitions are explicitly specified with the accurate types. Consequently, you may encounter "any" types for some parameters.
  • Type definitions for some of the UXP supported globals such as "window", "navigator" are not currently available.
    Please refer to the UXP documentation for the available types.
  • Inherited properties show the names of derived class and not base class (known issue on the internal library being used ) for eg
 const document = new Document();
 document.isConnected();

Type information will show isConnected as a property of Document (inherited) and not of the base class which is Node here.

  • Typedef API suggestions would not appear when the element is created with the document.createElement API for eg:
const img = document.createElement("img");

img would not show expected type suggestions as per the current limitation. However an element created through constructor as below would show the correct type as expected:

const imgElement = new HTMLImageElement();

Please note that we will be gradually improving the type definitions and adding accurate types for UXP APIs along with some of the issues mentioned above. If you encounter any issues or have suggestions for improvements, please feel free to report them as a github issue here.

Licensing

See LICENSE for more information.

Keywords

FAQs

Last updated on 19 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc