Giter VIP home page Giter VIP logo

uxp's Introduction

UXP Documentation

This repository contains the source files for the documentation of UXP. It consumes the md files generated from the internal torq-native repository.

It isn't intended to be hosted by itself, but instead should be imported into host-specific documentation for applications providing UXP-based extensibility (such as Photoshop and XD)

The documentation is based on the AdobeDocs/dev-site-documentation-template.

Documentation website using docs from this repository

Page Repository
https://developer.adobe.com/photoshop/uxp/ AdobeDocs/uxp-photoshop
https://developer.adobe.com/xd/uxp/ AdobeDocs/uxp-xd
https://developer.adobe.com/indesign/uxp/ AdobeDocs/uxp-indesign

Run this project

This repo is run manually and locally to pull-in markdowns generated from torq-native using JSDocs.

  1. You must first ensure that the markdowns in torq-native are available locally in your machine.
  2. Create an .env file and define UXP_REPO_SOURCE_DOCS pointing to the markdown folder. Example
UXP_REPO_SOURCE_DOCS="<path-to-torq-native>/docs/dist"
  1. Run npm run prepare-docs to copy over the files.

Working

Transclusions

  • Transclusions play an important role when the content from this repo has to be imported into AdobeDocs/uxp-photoshop, AdobeDocs/uxp-xd, and AdobeDocs/uxp-indesign. It carries the reference to the actual markdown content inside src/pages.
  • uxp_documentation is the alias name given to this repo when it is referred from other repos mentioned above.
  • It carries references to pages in src/pages location

Side navigation

The side navigation panel in the devsite is generated from the reference-*.js files.

uxp's People

Contributors

dependabot[bot] avatar icaraps avatar kerrishotts avatar padmkris123 avatar pklaschka avatar shazron avatar simonwex avatar timkim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uxp's Issues

Missing type information in `Blob.md`

Originally posted by @pklaschka in #61 (comment)

Low-level batchPlay powered API

Building extensions in Photoshop often requires to make operations as fast as possible.
While javascript API already offers some of the functionality, all of the functionality required is already available by running actions in batchPlay.

It would be great to get a javascript library with all functionality working as a wrapper on top of batchPlay, while still having access to low-level predefined batchPlay actions.

This would allow developers that don't need advanced functionality leverage power of batchPlay by using js wrapper directly and developers that do need advanced and fast operations chained together use pre-defined batchPlay actions directly and chan them in the necessary order without using javascript library methods directly.

As a more concrete example.
PS UXP JS library could expose builder methods that would allow to build ActionDescriptors for batchPlay like Layer.ActionDescriptors.rename(parameters) could return a descriptor that would rename a layer based on some parameters.
Or there could be Channels.ActionDescriptors.invert() or maybe even Calculations.ActionDescriptors.calculate(properties) or even prepared descriptors for Adjustment Layers and operations on them.

Then javascript UXP library could be using same low-level descriptors to have a more high-level set of methods like
renameLayer() could be internally using Layer.ActionDescriptors.rename(). And while low-lever descriptors are exposed, advanced users would be able to leverage them too directly.

Imaging APIs (Phase 1)

  • get/manipulate/set pixel data
  • Render host images in UXP UI
  • Stream host images to disk/network

Syntax error in object params

Issue in /src/pages/uxp/reference-js/Modules/uxp/Persistent File Storage/FileSystemProvider.md

It happens in a few instances on the page that object parameters use = instead of :, e.g.

const folder = await fs.getFolder({initialDomain = domains.userDocuments}); // ❌
const folder = await fs.getFolder({initialDomain: domains.userDocuments});  // ✅

React Spectrum 3 support

Use RS3 in your UXP plugins. Useful for plugins that are using React and rendering complex UI.

Launch External Applications

Enable UXP plugins to launch app associated with a specific file type.

This is not intended to enable intraprocess communication with spawned children, or allow control over the spawned application.

Grid Layout (v1)

Basic support for CSS Grid support. The spec is large, so this will require iteration to build out support.

unclosed tags in docs

note there are several unclosed tags (pattern <sp-...><sp-...> below) in docs as noted in AdobeDocs/uxp-photoshop#205 as shown at: https://developer.adobe.com/photoshop/uxp/uxp/reference-spectrum/User%20Interface/sp-textfield/#variants-and-states

uxp-photoshop currently has (this issue exists in):
3 "name": "uxp-documentation",
4 "version": "0.0.17",
5 "license": "Apache-2.0",
6 "repository": {
7 "type": "git",
8 "url": "https://github.com/AdobeDocs/uxp"

in ./src/pages/uxp/reference-spectrum/Typography/sp-detail.md
1 in line 16: <sp-detail>A NICE DIVIDER<sp-detail>

in ./src/pages/uxp/reference-spectrum/User Interface/sp-textfield.md
2 in line 33: <sp-textfield disabled placeholder="Phone Number"><sp-textfield>
2 in line 41: <sp-textfield valid placeholder="Phone Number"><sp-textfield>
2 in line 49: <sp-textfield invalid placeholder="Phone Number"><sp-textfield>
2 in line 57: <sp-textfield quiet placeholder="Phone Number"><sp-textfield>
2 in line 65: <sp-textfield type="number" placeholder="Age"><sp-textfield>
2 in line 73: <sp-textfield type="search" placeholder="Age"><sp-textfield>
2 in line 81: <sp-textfield type="password" placeholder="Age"><sp-textfield>

Unclear `JSON` type specification

## manifest ⇒ `JSON`
Get plugin manifest
**Returns**: `JSON`

## manifest ⇒ `JSON`
Get plugin manifest
**Returns**: `JSON`

Is this a JSON-serialized string? Or maybe a construct like type JSON = string | boolean | number | JSON[] | null | { [key: string | number]: JSON}?

Description in `Shell.md` requiring architectural knowledge of CC apps (not suitable for 3P)

## openPath(path, developerText)
Opens the given file or folder path in the system default application.<br/>
NOTE: UWP can access only files in the UWP App sandbox. see [File access permissions in UWP](https://docs.microsoft.com/en-us/windows/uwp/files/file-access-permissions)

Information not suitable for 3P as it would require deep knowledge of the architecture of various CC apps (which might be present with experienced 3P devs, but not with beginners)

Reported as part of the code review in #61

Webview Support (phase 1)

Enable use of the system webview to render high-fidelity web content.

First release will be limited to transient surfaces such as modal dialogs.

Missing type information in `HTMLWebViewElement.md`

## dataset
Access to all the custom data attributes (data-*) set.
**See**: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset

Missing type information, according to https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset should be DOMStringMap (assuming that we're compatible with these specs)

Originally posted by @pklaschka in #61 (comment)

Introspection APIs

Feature detection instead of version detection. Check if an API is supported before using it. Also returns information about the API.

Wrong parameters and examples in `FileSystemProvider.getFileForSaving()`

Expected Behaviour

In uxp/src/pages/uxp/reference-js/Modules/uxp/Persistent File Storage/FileSystemProvider.md, the documentation should reflect the APIs behavior, which (tested in both PS and XD in their current versions) differs between docs and actual behavior. The old XD docs actually document the correct behavior.

What the docs should look like (based on the actual behavior)

getFileForSaving(suggestedName, options)

Gets a file reference suitable for read-write by displaying a "Save" file
picker dialog to the user.

If the act of writing to the file would overwrite it, the file picker
will prompt the user to confirm before returning a result to you.

Returns: Promise<File> - returns the selected file, or null if canceled

Param Type Description
suggestedName string Required. The file extension should match one of the options specified in the types option.
options Object
[options.types] Array<string> Allowed file extensions, with no "." prefix.
[options.initialDomain] Symbol the preferred initial location of the file picker. If not defined, the most recently used domain from a file picker is used instead.

Example

const file = await fs.getFileForSaving("output.txt", { types: [ "txt" ]});
if (!file) {
    // file picker was cancelled
    return;
}
await file.write("It was a dark and stormy night");

Actual Behaviour

Issues with the current documentation:

  • suggestedName argument is not mentioned at all, but is required (also in the code example)
  • the return type is documented as File, but there's no mention that the function is async => it would probably be the easiest to document the return type as Promise<File>.
  • code example contains a syntax error (= has to be : in the options object)
  • code example destructures a file array where there is simply no array

=> Overall, without looking back at adobexdplatform.com (or my old code based on the info from there), there would have been no way for me to discover the actual working solution from either the docs or anywhere else (there's also no way to discover correct arguments via dev tools, etc., after all, meaning the only option would have been a lot of trial and error).

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

(both Windows 10)

  • XD, 42.0.22
  • PS, 22.4.3

Sample Code that illustrates the problem

// from docs example
const [file] = await fs.getFileForSaving({ types = [ "txt" ]}); // syntax error 😜 

// docs without syntax error
const [file] = await fs.getFileForSaving({ types: [ "txt" ]}); // doesn't work, fails silently

// works
const file = await fs.getFileForSaving({ types: [ "txt" ]}); // works

Logs taken while reproducing the problem

n/a

Missing description of `uxpContainer` in `HTMLWebViewElement.md`

## uxpContainer : `number`
**Read only**

Since UXP-specific, without a description, exposing this to 3P doesn't make a lot of sense. Don't get me wrong: I think if it makes sense we should expose this to 3P, but exposing it without any information doesn't add a lot of value.

Originally posted by @pklaschka in #61 (comment)

createPersistentToken() is actually asynchronous

Issue in /src/pages/uxp/reference-js/Modules/uxp/Persistent File Storage/FileSystemProvider.md

In createPersistentToken() it's said that it returns a String, very much like createSessionToken().
However createPersistentToken() is asynchronous, and it returns a Promise. In the doc it should be made clearer, with the use of await.
Besides, is it as designed that creating a session token is a synch operation and a permanent one is async?
Thanks!

Davide

Unclear types `bytesWritten` and `buffer`

bytesWritten and buffer in

  1. ## write(fd, buffer, offset, length, position, callback)
    Writes data in chunks to the file it refers to the file descriptor
    **Returns**: `Promise<Object>` - { bytesWritten, buffer }
  2. ## read(fd, buffer, offset, length, position, callback)
    Reads data in chunks from the file it refers to the file descriptor
    **Throws**:
    - `Error` if invalid file descriptor is passed.
    if invalid parameter format or value is passed.
    | Param | Type | Description |
    | --- | --- | --- |
    | fd | `int` | a file descriptor obtained from fs.open |
    | buffer | `ArrayBuffer` | the buffer where read bytes are written to |
    | offset | `int` | the offset to the buffer where read bytes are written from |
    | length | `int` | the length to read |
    | position | `int` | the position of the file to read from. if -1, the current file position to read from. when the bytes are read, the current file position advances by size of the read bytes. if the value is greater than or equal to 0, it specifies a file position to read from. after the bytes are read, a current file position stayed the same |
    | callback | `function` | if not provided, this function will return Promise object |
    **Returns**: `Promise<Object>` - { bytesRead, buffer }

Unclear return type specification of `cpus()` in `OS.md`

## cpus()
Gets the platform cpu information we are running on (eg. "{'Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz', 2900}")
**Returns**: `array` - the array of objects containing information about each logical CPU core
Currently only model and speed properties are supported. times property is not supported.
Access to CPU information, such as model string and frequency, is limited on UWP.
"ARM based architecture" or "X86 based architecture" is returned as a 'model' value on UWP.
0 is returned as a 'speed' value on UWP.

It isn't clear what kind of information is in the array. Even if we don't have a perfect type definition, specifiying that this is an Array<object> (or maybe Array<any>) already increases the understanding that one can get just from reading/scanning this).

"Some methods or properties may not be supportive for the return object due to the platform limitation" => which ones

Add more detail at:

## lstat(path, callback)
Gets information asynchronously from a file or a folder of the path
**Returns**: `Promise<Object>` - see [Stats](https://nodejs.org/api/fs.html#class-fsstats) class in Node.js
Note: Some methods or properties may not be supportive for the return object due to the platform limitation

## lstatSync(path)
Gets information synchronously from a file or a folder of the path
**Returns**: `Object` - see [Stats](https://nodejs.org/api/fs.html#class-fsstats) class in Node.js
Note: Some methods or properties may not be supportive for the return object due to the platform limitation

Originally posted by @pklaschka in #61 (comment)

Unclear types in `Plugin Manager/Plugin.md`

  • ## showPanel(panelId)
    Show panel with the given ID. This api may be routed to the host app which can chose to disallow it. Used for commmunicating with other plugins (IPC : Inter Plugin Communication)
    Note: There is API to hide a panel, panels can be shown but can not be hid.
    **Returns**: `Promise`
    Promise of/for what? void?
  • ## invokeCommand(commandId, ...params)
    Invoke command with given ID. This api may be routed to the host app which can chose to disallow it.
    Used for commmunicating with other plugins (IPC : Inter Plugin Communication)
    **Returns**: `Promise`
    Promise of/for what? void?
  • ## invokeCommand(commandId, ...params)
    Invoke command with given ID. This api may be routed to the host app which can chose to disallow it.
    Used for commmunicating with other plugins (IPC : Inter Plugin Communication)
    **Returns**: `Promise`
    | Param | Type | Description |
    | --- | --- | --- |
    | commandId | `String` | id of the command to be invoked |
    | ...params | | command arguments to be passed to invokeCommand |
    It isn't clear how parameters work in this context

Originally opened as part of the code review of #61

Table Layout (V1)

Support rendering tables using HTML elements and CSS. This will require multiple versions of iteration.

Unclear `Promise` types in `Clipboard.md`

Promises have to be for/of some type (that type can be void). This type should be explicityly mentioned (e.g., Promise<void>, Promise<string>, etc.)

Originally posted by @pklaschka in #61 (comment)

UXP FileSystemProvider getFolder documentation typo

Issue in /src/pages/uxp/reference-js/Modules/uxp/Persistent File Storage/FileSystemProvider.md
Typo link

Orignal code... Removed some part to reduce verbosity

const folder = await fs.getFolder();
const myNovel = (await fs.getEntries());

The correct code

const folder = await fs.getFolder();
const myNovel = (await folder.getEntries());

Linking to Photoshop documentation from general UXP documentation

# require('shell')
To get an instance: `require("uxp").shell`<br/>
These APIs require UXP Manifest v5 configurations. see [Launch Process](https://developer.adobe.com/photoshop/uxp/2022/guides/uxp_guide/uxp-misc/manifest-v5/#launch-process)

Given that these docs also get deployed for other host apps, linking to one specific host app is probelmatic.

It's not easy to solve this, but we should keep this in mind if an opportunity opens up to solve these kinds of issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.