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

Add vite-vue3-tsx-sample #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This repository contains a library of sample Photoshop plugins to help you on yo
| ui-react-starter | Spectrum UXP, React | Shows how to use React in a simple plugin | UXP 4.1 / PS 22.0.0 |
| ui-svelte-starter | Spectrum UXP, Svelte | Shows how to use Svelte in a simple plugin | UXP 4.1 / PS 22.0.0 |
| ui-vue-starter | Spectrum UXP, Vue | Shows how to use Vue in a simple plugin | UXP 4.1 / PS 22.0.0 |
| vite-vue3-tsx-sample | Spectrum UXP, Vue | Creates an UXP project by using Vite, Vue 3, TSX | PS 23.0.0 |
| wasm-rust-sample | Spectrum UXP, Rust, WebAssembly | Uses wasm-bindgen and Rust to leverage WebAssembly in a UXP plugin | UXP 4.1 / PS 22.0.0 |
| web-service-call-js-sample | Spectrum UXP, Fetch, BatchPlay | Creates a text layer in Photoshop containing data fetched from a web API | UXP 4.1 / PS 22.0.0 |

Expand Down
36 changes: 36 additions & 0 deletions vite-vue3-tsx-sample/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# Use 4 spaces for the Python files
[*.py]
indent_size = 4
max_line_length = 80

# The JSON files contain newlines inconsistently
[*.json]
insert_final_newline = ignore

# Minified JavaScript files shouldn't be changed
[**.min.js]
indent_style = ignore
insert_final_newline = ignore

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab

# Batch files use tabs for indentation
[*.bat]
indent_style = tab

[*.md]
trim_trailing_whitespace = false

12 changes: 12 additions & 0 deletions vite-vue3-tsx-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Node.
node_modules/

# IDEs.
.vscode/
.idea/

# Dist.
dist/

# Envs.
.env
74 changes: 74 additions & 0 deletions vite-vue3-tsx-sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Adobe UXP Vite Vue3 TSX Sample

This is an UXP sample that mainly consists of Vite and Vue 3 with TSX.

## Quick start

1. Clone this sample.

2. Make sure to change the `id` and `name` in `manifest.json`.

3. After the building process, open the project in UXP Developer Tools.

## NPM scripts

- `build`: Build the UXP plugin.
- `watch`: Just for your development. Invoke `npm run build` after some file was changed.

## Vue single file component

This template has been configured with `@vitejs/plugin-vue` so SFC should work out of box.

## SWC

You can switch to swc by using [unplugin-swc](https://github.com/unplugin/unplugin-swc) to make `emitDecoratorMetadata` work.

### vite.config.ts

```ts
import vue from '@vitejs/plugin-vue'
import swc from 'unplugin-swc'
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
esbuild: false, // ESBuild must be disabled.

plugins: [
swc.vite() // Add unplugin-swc.
],

build: {
minify: 'terser', // You have to add a minifier after disabling ESBuild.
},
})
```

### .swcrc

```json
{
"isModule": true,
"jsc": {
"target": "es2020",
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"experimental": {
"plugins": [
["swc-plugin-vue-jsx", {}] // If you want to use Vue 3 in J/TSX form.
]
}
}
}
```

## Notice

Some libs like `Vue-i18n`, `Vue-Router` are not working in UXP environment, take care.
Binary file added vite-vue3-tsx-sample/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vite-vue3-tsx-sample/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vite-vue3-tsx-sample/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vite-vue3-tsx-sample/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions vite-vue3-tsx-sample/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>UXP Vite Template</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
106 changes: 106 additions & 0 deletions vite-vue3-tsx-sample/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"id": "vite-vue3-tsx",
"name": "vite-vue3-tsx",
"version": "1.0.0",
"main": "dist/index.html",
"host": [
{
"app": "PS",
"minVersion": "23.0.0"
}
],
"manifestVersion": 5,
"entrypoints": [
{
"type": "command",
"id": "showAlert",
"label": "Show alert"
},
{
"type": "panel",
"id": "vanilla",
"minimumSize": {
"width": 230,
"height": 200
},
"maximumSize": {
"width": 2000,
"height": 2000
},
"preferredDockedSize": {
"width": 230,
"height": 300
},
"preferredFloatingSize": {
"width": 230,
"height": 300
},
"icons": [
{
"width": 32,
"height": 32,
"path": "icons/icon_D.png",
"scale": [
1,
2
],
"theme": [
"dark",
"darkest"
],
"species": [
"generic"
]
},
{
"width": 32,
"height": 32,
"path": "icons/icon_N.png",
"scale": [
1,
2
],
"theme": [
"lightest",
"light"
],
"species": [
"generic"
]
}
],
"label": {
"default": "Starter Panel"
}
}
],
"icons": [
{
"width": 23,
"height": 23,
"path": "icons/dark.png",
"scale": [
1,
2
],
"theme": [
"darkest",
"dark",
"medium"
]
},
{
"width": 23,
"height": 23,
"path": "icons/light.png",
"scale": [
1,
2
],
"theme": [
"lightest",
"light"
]
}
]
}
Loading