### UXP Plugin Setup Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/EntryPoints.md
Demonstrates the structure for setting up UXP plugins, including lifecycle methods for the plugin and panels, menu item definitions, and command handling.
```js
const { entrypoints } = require("uxp");
entrypoints.setup({
plugin: {
create() {..},
destroy() {..}
},
panels: {
"panel1": {
create() {..},
show() {..},
hide() {..},
destroy() {..},
invokeMenu() {..},
update() {..}, // customEntrypoint example
validatNode() {..} // customEntrypoint example
menuItems: [
{
id: "signIn",
label: "Sign In...",
enabled: false,
checked: false,
submenu: [
{ id: "submenu1", label: "submenu1", enabled: false, checked: false},
{ "submenu2" }
]
},
"-", // separator.
"Sign out", // by default enabled, and the id will be same with the label.
]
},
"panel2": {..}
},
commands: {
"command1": {
run() {..},
cancel() {..}
},
"command2": function(){..}
}
});
```
--------------------------------
### UXP Plugin Manager Usage Example (Photoshop)
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/Plugin Manager/PluginManager.md
An example demonstrating how to use the UXP Plugin Manager to query plugin information, specifically for Photoshop.
```html
```
--------------------------------
### UXP Plugin Manager Usage Example (Photoshop)
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Plugin Manager/PluginManager.md
An example demonstrating how to use the UXP Plugin Manager to query plugin information, specifically for Photoshop.
```html
```
--------------------------------
### UXP Plugin Setup API Documentation
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/EntryPoints.md
Provides details on the `setup` function for UXP plugins, including parameters for defining plugin, panels, and commands, along with their associated lifecycle methods.
```APIDOC
setup(entrypoints)
API for plugin to add handlers and menu items for entrypoints defined in manifest.
This API can only be called once and there after other apis can be used to modify menu items.
The function throws in case of any error in entrypoints data or if its called more than once.
Parameters:
entrypoints (Object): it consists of mainly three objects - 'plugin', 'panels' and 'commands'.
plugin (Object): This can be an object or a function. If this is a function, it is assumed as the 'create' handler.
create (function): This is called after plugin is loaded. 'this' can be used to access UxpPluginInfo object. If 'plugin' object is defined, 'create' must be defined. To signal failure, throw an exception.
destroy (function): This is called before plugin is unloaded. 'this' can be used to access UxpPluginInfo object.
panels (Array): This contains a list of key-value pairs where each key is a panel id (string) and value is the data for the panel whose type can be object/function. If a function, it is assumed to be the 'show' method. If an object, it can contain following properties but it is must to define either of 'create' or 'show'.
create (function): This is called when a panel is created. 'this' can be used to access UxpPanelInfo object. This function can return a promise. To signal failure, throw an exception or return a rejected promise. This has a default Timeout of 300 MSec from manifest v5 onwards.
Parameters:
create(event) {}, till Manifest Version V4
create(rootNode) {}, from v5 onwards
show (function): This is called when a panel is shown. 'this' can be used to access UxpPanelInfo object. This function can return a promise. To signal failure, throw an exception or return a rejected promise. This has a default Timeout of 300 MSec from manifest v5 onwards.
Parameters:
show(event) {}, till Manifest Version V4
show(rootNode, data) {}, from v5 onwards
hide (function): This is called when a panel is hidden. 'this' can be used to access UxpPanelInfo object. This function can return a promise. To signal failure, throw an exception or return a rejected promise. This has a default Timeout of 300 MSec from manifest v5 onwards.
Parameters:
hide(event) {}, till Manifest Version V4
hide(rootNode, data) {}, from v5 onwards
destroy (function): This is called when a panel is going to be destroyed. 'this' can be used to access UxpPanelInfo object. To signal failure, throw an exception.
Parameters:
destroy(event) {}, till Manifest Version V4
destroy(rootNode) {}, from v5 onwards
invokeMenu (function): This is called when a panel menu item is invoked. Menu id is passed as the first argument to this function. 'this' can be used to access UxpPanelInfo object. This function can return a promise. To signal failure, throw an exception or return a rejected promise.
```
--------------------------------
### WebSocket Data Transfer Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Global Members/Data Transfers/WebSocket.md
Demonstrates how to use the WebSocket API for data transfer within UXP, with an example querying product information.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Global Members/Data Transfers/WebSocket";
```
--------------------------------
### Content Query Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Global Members/HTML Events/GestureEvent.md
Example of querying content within UXP, likely for Adobe XD.
```html
```
--------------------------------
### UXP Content Rendering Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-css/Styles/font-weight.md
An example of rendering UXP content, likely a component or page, with a specific query parameter. The 'product=xd' query suggests it's configured for Adobe XD.
```html
```
--------------------------------
### Accessing Host Information in UXP
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Host Information/Host.md
Demonstrates how to import and use the Host Information module to get details about the Adobe product hosting the UXP plugin. This example specifically queries for product information.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/Host Information/Host";
```
--------------------------------
### Copy Entry Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Persistent File Storage/storage.md
Provides examples of copying a UXP Entry to another folder, including options for overwriting and copying folders.
```javascript
await someFile.copyTo(someFolder);
await someFile.copyTo(someFolder, {overwrite: true});
await someFolder.copyTo(anotherFolder, {overwrite: true, allowFolderCopy: true});
```
--------------------------------
### UXP Content Component Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-html/Hierarchy/h6.md
Demonstrates the usage of the UXP Content component to query product information.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-html/Hierarchy/h6";
```
--------------------------------
### Fetch Data Transfer Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Global Members/Data Transfers/fetch.md
Demonstrates how to fetch data using the UXP API, specifically for product information. This example utilizes a Content component to query product data.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Global Members/Data Transfers/fetch";
```
```html
```
--------------------------------
### Spectrum UXP Widget Typography Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-spectrum/Spectrum UXP Widgets/Typography/sp-detail.md
Demonstrates how to import and use a Spectrum UXP Widget component for typography, with an example of querying product information.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-spectrum/Spectrum UXP Widgets/Typography/sp-detail";
```
```jsx
```
--------------------------------
### CSS Padding Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-css/Styles/padding.md
Demonstrates how to apply padding to an element using CSS. This example shows setting different padding values for top/bottom and left/right.
```css
.someElement {
padding: 3px 1em;
}
```
--------------------------------
### UXP XMP Module Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/XMP/getting-started/index.md
Demonstrates how to use the XMP module within UXP, specifically querying for Photoshop products.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/XMP/getting-started/xmp.md";
```
--------------------------------
### Content Query Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Global Members/Streams/WritableStreamDefaultWriter.md
Demonstrates how to query content, specifically for Adobe XD.
```html
```
--------------------------------
### WebSocket Constructor and Usage Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/Data Transfers/WebSocket.md
Demonstrates how to create a new WebSocket connection with a specified URL and protocols, and includes an example of sending data as a typed array.
```javascript
var ws = new WebSocket("wss://demos.kaazing.com/echo","wss");
ws.send(new Float32Array([ 5, 2, 1, 3, 6, -1 ]));
ws.send(new Int32Array([5,-1]).buffer)
```
--------------------------------
### CSS Background Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-css/Styles/background.md
Demonstrates how to set a background using a URL to a plugin asset and a color.
```css
.someElement {
background: url('plugin://assets/star.png') red;
}
```
--------------------------------
### Install and Import SWC Button Component
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-spectrum/swc/index.md
This example demonstrates how to install a Spectrum Web Component (SWC) using npm and then import it into your JavaScript code. It specifically shows the installation of the SWC button component and its subsequent import for use in an HTML structure.
```javascript
npm install @swc-uxp-wrappers/button
```
```javascript
import '@swc-uxp-wrappers/button/sp-button.js';
```
```html
I'm a button
```
--------------------------------
### Get List of Plugins
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Plugin Manager/PluginManager.md
Retrieves the current list of installed plugins from the Plugin Manager. The `plugins` property returns a Set containing Plugin objects.
```javascript
const plugins = require("uxp").pluginManager.plugins;
// plugins is a Set of Plugin objects
```
--------------------------------
### XMLHttpRequest timeout
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/Data Transfers/XMLHttpRequest.md
Sets or gets the timeout in milliseconds for an XMLHttpRequest. A value of 0 means no timeout. The example demonstrates setting a 2-second timeout and logging if it occurs.
```javascript
const xhr = new XMLHttpRequest();
xhr.open("GET", "https://www.adobe.com");
xhr.ontimeout = (e) => {
console.log("xhr timed out");
};
xhr.timeout = 2000; // 2,000 milliseconds
xhr.send();
```
--------------------------------
### Unsupported Elements Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-html/General/Unsupported Elements.md
Demonstrates how to query unsupported elements within UXP, likely for reporting or debugging purposes.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-html/General/Unsupported Elements";
```
--------------------------------
### UXP OS Module Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/os/index.md
Demonstrates how to import and use the 'os' module from the UXP JavaScript API to query product information. This snippet shows a typical import and a query for product details.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/os/index.md";
```
--------------------------------
### UXP CustomElementRegistry Example
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Global Members/HTML DOM/CustomElementRegistry.md
Demonstrates how to use the CustomElementRegistry in UXP to define and manage custom HTML elements. This example specifically queries for product=xd.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Global Members/HTML DOM/CustomElementRegistry";
```
--------------------------------
### UXP Entry Points Module
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Entry Points/EntryPoints.md
Imports the Content component from the uxp-documentation library to display UXP API reference information. The query parameter specifies the product for which to fetch documentation.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/EntryPoints";
```
--------------------------------
### Importing and Using the OS Module
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/os/OS.md
Demonstrates how to import the OS module and use its components, specifically rendering content related to Photoshop.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/os/OS";
```
--------------------------------
### Element Attribute Management: get, set, remove, has
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLDialogElement.md
Methods for interacting with element attributes, including getting, setting, removing, and checking for their existence.
```APIDOC
## getAttribute(name)
Retrieves the value of a specified attribute.
Returns: string
Parameters:
- name: string - Name of the attribute whose value you want to get.
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
## setAttribute(name, value)
Sets the value of a specified attribute.
Parameters:
- name: string - Name of the attribute whose value is to be set.
- value: string - Value to assign to the attribute.
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
## removeAttribute(name)
Removes a specified attribute from the element.
Parameters:
- name: string - The name of the attribute to remove.
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
## hasAttribute(name)
Checks if the element has a specified attribute.
Returns: boolean
Parameters:
- name: string - The name of the attribute to check for.
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
## hasAttributes()
Returns a boolean value indicating whether the current element has any attributes or not.
Returns: boolean
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
## getAttributeNames()
Returns the attribute names of the element as an Array of strings.
Returns: Array
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
## getAttributeNode(name)
Retrieves the attribute node with the specified name.
Returns: *
Parameters:
- name: string
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNode
## setAttributeNode(newAttr)
Adds or replaces an attribute node.
Parameters:
- newAttr: *
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNode
## removeAttributeNode(oldAttr)
Removes the specified attribute node.
Parameters:
- oldAttr: *
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNode
```
--------------------------------
### window.fetch API Documentation
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/Data Transfers/fetch.md
Documentation for the `window.fetch` method, including its parameters, return values, and potential errors. It also covers the required network permissions in `manifest.json` and limitations on wildcard usage.
```APIDOC
window.fetch(input, [init])
Fetches a resource from the network.
Returns: Promise Promise that resolves to a Response object.
Throws:
- TypeError: If init.body is set and init.method is either "GET" or "HEAD".
- TypeError: If either network error or network time-out occurs after a http request is made.
- TypeError: If there is a failure in reading files in FormData during posting FormData.
Parameters:
- input: Either the URL string to connect with or a Request object having the URL and the init option.
- [init]: (Optional) Custom settings for a HTTP request.
- [init.method]: HTTP request method. The default value is "GET".
- [init.headers]: HTTP request headers to add.
- [init.body]: Body to add to HTTP request. Can be string, ArrayBuffer, TypedArray, Blob, FormData, or URLSearchParams.
- [init.credentials]: Indicates whether to send cookies. The default value is "include". Possible values: "omit" (cookies are NOT sent), "include" (cookies are sent).
See: Headers, Request and Response
```
```json
{
"permissions": {
"network": {
"domains": [
"https://www.adobe.com",
"https://*.adobeprerelease.com",
"wss://*.myplugin.com"
]
}
}
}
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLScriptElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### CSS :enabled Pseudo-class Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-css/Pseudo-classes/empty.md
Demonstrates how to use the :enabled pseudo-class in CSS to style elements that have no children. This example applies a blue border to empty div elements.
```css
div:empty {
border: 1px solid blue;
}
```
--------------------------------
### UXP Entry Points for Photoshop
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/Entry Points/EntryPoints.md
Demonstrates how to import and use the UXP EntryPoints module to interact with Photoshop. This snippet shows a typical import statement and a component usage with a query parameter specifying the product.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/EntryPoints";
```
--------------------------------
### Example Usage: Filtering Entry Points by Product
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Entry Points/index.md
Demonstrates how to use the Content component to display entry point documentation specific to Adobe XD.
```markup
```
--------------------------------
### Load UXP FAQs for Photoshop
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-spectrum/faqs/index.md
Imports and renders the UXP FAQs component, specifically querying for Photoshop-related content. This is useful for developers looking for answers to common questions about using UXP with Photoshop.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-spectrum/faqs/index.md";
```
--------------------------------
### UXP GUID Generation
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/changelog3P.md
A new GUID feature is available for uniquely identifying Creative Cloud Users, currently supported only in Photoshop. This is accessed via the uxp.User Information module.
```javascript
// Accessing GUID (example)
const userId = uxp.UserInformation.GUID;
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLStyleElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### UXP Photoshop Entry Points
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/Entry Points/index.md
This snippet demonstrates how to access UXP entry points for Photoshop. It utilizes a query parameter to specify the product.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/index.md";
```
--------------------------------
### Display UXP Product Documentation
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Entry Points/EntryPoints.md
Renders the Content component to display documentation for a specific product within UXP. The 'product=xd' query parameter indicates that documentation for Adobe XD should be loaded.
```html
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLProgressElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLLinkElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Importing and Using UXP Content Component
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-css/Styles/min-height.md
Demonstrates how to import and use the `Content` component from the UXP documentation library, specifically for applying styles or queries to a product like Photoshop.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-css/Styles/min-height";
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLOptionElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Content Component Usage for Photoshop
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Global Members/Streams/ReadableStreamDefaultController.md
Demonstrates the usage of the Content component, querying for product information specific to Adobe Photoshop.
```html
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLMenuElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLButtonElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Create and Serialize XMP Metadata
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/XMP/getting-started/xmp.md
Demonstrates creating a new XMPMeta object, setting a 'CreatorTool' property, and serializing the XMP packet to an XML string. It also shows how to retrieve a property and log its details.
```javascript
const {XMPMeta, XMPConst} = require("uxp").xmp;
let xmp = new XMPMeta();
xmp.setProperty( XMPConst.NS_XMP, "CreatorTool", "My Script" );
let xmpStr = xmp.serialize(); // Serialize the XMP packet to XML
// Retrieve property
let prop = xmp.getProperty(XMPConst.NS_XMP, "CreatorTool");
console.log( `namespace: ${prop.namespace}, property path + name: ${prop.path}, value: ${prop.value}`);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### UXP Content Query for Photoshop
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/Entry Points/UxpMenuItem.md
Demonstrates how to use the Content component with a query parameter to specify integration with Adobe Photoshop.
```html
```
--------------------------------
### UXP CSS Reference - General
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-css/General/index.md
Imports and renders the general CSS reference documentation for UXP, allowing queries for specific product contexts.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-css//General/index.md";
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLAnchorElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### UXP API Reference - Content Module
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/index.md
Imports and renders the UXP API reference documentation for the Content module, specifically querying for product=xd.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/index.md";
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLImageElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLHtmlElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Importing and Using Content Component
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-css/Styles/padding-top.md
Demonstrates how to import and use the Content component from the uxp-documentation library, specifically for applying styles or querying product-specific information.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-css/Styles/padding-top";
```
--------------------------------
### Get UXP Entrypoints Instance
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Entry Points/EntryPoints.md
This snippet shows how to obtain an instance of the UXP entrypoints module. It is a fundamental step for interacting with UXP functionalities.
```javascript
require("uxp").entrypoints
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLVideoElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Content Query for UXP
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/Entry Points/UxpMenuItems.md
Demonstrates how to query content within the UXP environment, specifically for the 'xd' product. This is likely used to retrieve or display product-specific information or assets.
```html
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLTextAreaElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Import UXP XMP Module
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/XMP/getting-started/xmp.md
Imports the XMP module from the UXP library, enabling access to XMP functionalities.
```javascript
const xmp = require("uxp").xmp;
```
--------------------------------
### UXP Documentation - Photoshop Module
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-js/Modules/uxp/index.md
Imports and renders the UXP documentation content specifically for Photoshop. This component likely displays API details, examples, and usage instructions for Photoshop plugins.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/index.md";
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLSelectElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLLabelElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Entry Class Overview and Usage
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Modules/uxp/Persistent File Storage/Entry.md
Demonstrates how to obtain an Entry instance (File or Folder) using localFileSystem and interact with its base properties and methods.
```javascript
const fs = require('uxp').storage.localFileSystem;
const folder = await fs.getPluginFolder(); // returns a Folder instance
const folderEntry = await folder.getEntry("entryName.txt");
// Now we can use folderEntry to invoke the APIs provided by Entry
console.log(folderEntry.isEntry); // isEntry is an API of Entry, in this example it will return true
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLHeadElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Pointer Interaction Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-js/Global Members/HTML Elements/HTMLBodyElement.md
Demonstrates how to use `setPointerCapture` and `releasePointerCapture` to implement a sliding element functionality. This example includes event listeners for pointer down, move, and up events.
```javascript
// HTML
//
// SLIDE ME
// JS
function beginSliding(e) {
slider.setPointerCapture(e.pointerId);
slider.addEventListener("pointermove", slide);
}
function stopSliding(e) {
slider.releasePointerCapture(e.pointerId);
slider.removeEventListener("pointermove", slide);
}
function slide(e) {
slider.style.left = e.clientX;
}
const slider = document.getElementById("slider");
slider.addEventListener("pointerdown", beginSliding);
slider.addEventListener("pointerup", stopSliding);
```
--------------------------------
### Using UXP Widgets with React
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-spectrum/Spectrum UXP Widgets/Using with React.md
Demonstrates how to import and use UXP components within a React application. The example shows how to query for specific product integrations, such as Photoshop.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-spectrum/Spectrum UXP Widgets/Using with React";
```
--------------------------------
### CSS Class Selector Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-css/Selectors/Class selector.md
Demonstrates how to apply styles to elements with specific classes using CSS in UXP. This example targets a `sp-action-button` with the class `icon-only`.
```css
sp-action-button.icon-only {
padding: 0;
}
```
--------------------------------
### UXP Shell Module Usage
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/xd/uxp/reference-js/Modules/uxp/shell/index.md
Demonstrates how to import and use the UXP Shell module to execute commands with specific product queries.
```javascript
import Content from "uxp-documentation/src/pages/uxp-api/reference-js/Modules/uxp/shell/index.md";
```
--------------------------------
### Content Component Usage
Source: https://github.com/adobedocs/uxp/blob/main/_transclusions/photoshop/uxp/reference-html/Hierarchy/h4.md
Demonstrates how to use the Content component with a product query parameter.
```html
```
--------------------------------
### Installing and Importing Spectrum Web Component Button
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-spectrum/index.md
Shows the process of installing an individual Spectrum Web Component (SWC) using npm and then importing it for use in UXP. This is required for using SWC components.
```bash
npm i @swc-uxp-wrappers/button
```
```javascript
import '@swc-uxp-wrappers/button/sp-button.js';
```
--------------------------------
### CSS Descendant Combinator Example
Source: https://github.com/adobedocs/uxp/blob/main/src/pages/uxp-api/reference-css/Selectors/Descendant combinator.md
Demonstrates the usage of the CSS descendant combinator to style specific elements within a UXP component. This example targets 'sp-button' elements that are descendants of a 'footer' element.
```css
footer sp-button {
margin: 12px;
}
```