@adobe/cc-ext-uxp-types

中文文档
7.3.1发布于 2023/10/19零依赖近 30 天下载 2.1万

Typescript definitions for the Adobe UXP JS API

原始使用文档
文档目录5 节
  1. cc-ext-uxp-types
  2. Installation
  3. Config
  4. Known Issues
  5. Licensing

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.

版本与发布记录

@adobe/cc-ext-uxp-types 共发布 2 个版本,首次发布于 2023/10/14;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.3.1latest2023/10/193 年前
7.3.02023/10/143 年前

关于 @adobe/cc-ext-uxp-types 的常见问题

@adobe/cc-ext-uxp-types 是什么?

Typescript definitions for the Adobe UXP JS API

如何安装 @adobe/cc-ext-uxp-types?

在项目目录运行 npm install @adobe/cc-ext-uxp-types,或使用 pnpm add / yarn add / bun add。

@adobe/cc-ext-uxp-types 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__cc-ext-uxp-types 是否存在。

@adobe/cc-ext-uxp-types 可以商用吗?

@adobe/cc-ext-uxp-types 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/cc-ext-uxp-types 的下载量有多少?

根据 npm 官方下载统计,@adobe/cc-ext-uxp-types 在 2026/10/05 – 2026/11/03 这 30 天内被下载 20,991 次,日均约 700 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/cc-ext-uxp-types 还在维护吗?

最新版本 7.3.1 发布于 2023/10/19(3 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/10/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。