Skip to content

Commit a384c59

Browse files
Merge branch 'dev'
2 parents e00acc4 + 59532c2 commit a384c59

36 files changed

+4594
-455
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 1.4.0
4+
- feature: adds indentation option into generated code
5+
- feature: adds single quotes option into generated code
6+
- feature: adds options to hide useless properties
7+
- change: property names in generated code are now without quotes where possible
8+
- adds types to the components
9+
- fix: UI crash in DOM (live) when object is proxy (e.g. array of layers in document)
10+
- improvement: adds history states and snapshots into DOM (live)
11+
- improvement: left column adjustable width is now expressed in pixels instead of percentage and it is remembered after panel reload
12+
13+
314
## 1.3.0
415
- adds raw data type support (needs to be enabled in Code > Options)
516
- adds grouping of items with same content
@@ -32,7 +43,7 @@
3243
- change: button menus in footer are now using dropdown so those can be shown out of panel boundary
3344

3445
## 0.27.0
35-
- improvement: shows error dialog when something failes outside of react error component
46+
- improvement: shows error dialog when something fails outside of react error component
3647
- workaround: allows to make production version of plugin. See: https://forums.adobeprerelease.com/photoshop/discussion/2138/severe-issue-with-listener-in-production-use#latest
3748
- improvement: adds info in footer whether this is production or development version of plugin. Also adds copyright.
3849
- improvement: generates "await" keyword for async batchplay
@@ -46,7 +57,7 @@
4657

4758
## 0.26.0
4859
- feature: adds partial support for raw data type (fake structure in views and attempt to generate code in code tab)
49-
- feature: adds posibility to enable/disable raw data type support
60+
- feature: adds possibility to enable/disable raw data type support
5061
- feature: add expand slider into tree views
5162
- improvement: breadcrumb in tree view is now at fixed position when scrolling
5263

@@ -55,7 +66,7 @@
5566
- improvement: adds new icon (made by Petr Štefek https://www.behance.net/phob )
5667
- improvement: removes right bottom artifact
5768
- improvement: cleaner path to the pinned property in generated source code
58-
- improvement: now it shows autoselected descriptor underline for only autocative items. 2 for difference 1 for others
69+
- improvement: now it shows autoselected descriptor underline for only autoactive items. 2 for difference 1 for others
5970
- fix: initial text flash from black to theme color
6071

6172

TODO.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

dist/index.js

Lines changed: 4066 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.LICENSE.txt

Lines changed: 0 additions & 71 deletions
This file was deleted.

dist/manifest.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
"name": "Alchemist",
33
"id": "2bcdb900",
44
"main": "index.html",
5-
"version": "1.3.0",
6-
"manifestVersion": 4,
7-
"host": {
5+
"version": "1.4.0",
6+
"manifestVersion": 5,
7+
"host": [{
88
"app": "PS",
9-
"minVersion": "22.2.0"
9+
"minVersion": "22.5.0",
10+
"data": {
11+
"apiVersion": 2
12+
}
13+
}],
14+
"requiredPermissions": {
15+
"clipboard": "readAndWrite",
16+
"allowCodeGenerationFromStrings": true
1017
},
1118
"entrypoints": [{
1219
"type": "panel",
@@ -58,13 +65,13 @@
5865
"path": "icons/lightPlugin.png",
5966
"scale": [1, 2],
6067
"theme": ["darkest", "dark", "medium"],
61-
"species": [ "pluginList" ]
68+
"species": ["pluginList"]
6269
}, {
6370
"width": 48,
6471
"height": 48,
6572
"path": "icons/darkPlugin.png",
6673
"scale": [1, 2],
6774
"theme": ["lightest", "light"],
68-
"species": [ "pluginList" ]
75+
"species": ["pluginList"]
6976
}]
7077
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@types/react": "^16.9.38",
1313
"@types/react-dom": "^16.9.8",
1414
"@types/semver": "^7.3.6",
15+
"@types/stringify-object": "^3.3.1",
1516
"@typescript-eslint/eslint-plugin": "^3.3.0",
1617
"@typescript-eslint/parser": "^3.3.0",
1718
"babel-loader": "^8.1.0",
@@ -50,17 +51,19 @@
5051
"jss-vendor-prefixer": "^8.0.1",
5152
"lodash": "^4.17.15",
5253
"prismjs": "^1.20.0",
53-
"react": "^16.13.1",
54+
"react": "^17.0.2",
5455
"react-dom": "^16.13.1",
5556
"react-json-tree": "^0.11.2",
5657
"react-notifications": "^1.7.2",
5758
"react-redux": "^7.2.0",
58-
"react-split": "^2.0.9",
59+
"react-split-pane": "^0.1.92",
60+
"react-uxp-spectrum": "github:jardicc/react-uxp-spectrum",
5961
"redux": "^4.0.5",
6062
"redux-devtools-extension": "^2.13.8",
6163
"redux-devtools-themes": "^1.0.0",
6264
"reselect": "^4.0.0",
6365
"semver": "^7.3.5",
66+
"stringify-object": "^3.3.0",
6467
"styled-components": "^5.1.1",
6568
"sval": "^0.4.8",
6669
"terser-webpack-plugin": "^5.1.4",

src/inspector/actions/inspectorActions.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { TActiveSection, TActiveInspectorTab, IDescriptor, TTargetReference, TSelectDescriptorOperation, ITargetReference, TSubTypes, ITreeDataTabs, TPath, TFilterEvents, TImportItems, IInspectorState, TGenericViewType, TCodeViewType, IAMCoverter, TFontSizeSettings, IDescriptorSettings } from "../model/types";
1+
import { TActiveSection, TActiveInspectorTab, IDescriptor, TTargetReference, TSelectDescriptorOperation, ITargetReference, TSubTypes, ITreeDataTabs, TPath, TFilterEvents, TImportItems, IInspectorState, TGenericViewType, TCodeViewType, IAMCoverter, TFontSizeSettings, IDescriptorSettings, ISettings } from "../model/types";
22
import { TState } from "../components/FilterButton/FilterButton";
33
import { IRootState } from "../../shared/store";
4-
import { CommandOptions } from "photoshop/dist/types/UXP";
54

65
export interface ISetMainTab {
76
type: "SET_MAIN_TAB"
@@ -270,6 +269,18 @@ export interface IToggleDescriptorsGroupingAction{
270269
payload:null
271270
}
272271

272+
export interface ISetSettingsAction{
273+
type: "SET_SETTINGS",
274+
payload: Partial<ISettings>
275+
}
276+
277+
export function setSettingsAction(settings:Partial<ISettings>): ISetSettingsAction{
278+
return {
279+
type: "SET_SETTINGS",
280+
payload: settings,
281+
};
282+
}
283+
273284
export function toggleDescriptorsGroupingAction():IToggleDescriptorsGroupingAction {
274285
return {
275286
type: "TOGGLE_DESCRIPTORS_GROUPING",
@@ -653,4 +664,5 @@ export type TActions = ISetMainTab |
653664
ISetConverterInfoAction |
654665
ISetFontSizeAction |
655666
ISetNeverRecordActionNamesAction |
656-
IToggleDescriptorsGroupingAction
667+
IToggleDescriptorsGroupingAction |
668+
ISetSettingsAction

src/inspector/classes/GetDOM.ts

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export class GetDOM{
1414
return null;
1515
}
1616

17+
if (res[0]._ref === "historyState" || res[0]._ref === "snapshot") {
18+
return GetDOM.getHistoryDom(res[0]._id, res[1]?._id);
19+
}
20+
1721
if (res[0]._ref === "application") {
1822
return GetDOM.getAppDom();
1923
}
@@ -39,30 +43,48 @@ export class GetDOM{
3943
return null;
4044
}
4145

46+
private static sanitizeDocId(docId?: number) {
47+
if (typeof docId !== "number") {
48+
if (!photoshop.app.activeDocument) {
49+
return null;
50+
}
51+
docId = photoshop.app.activeDocument._id;
52+
}
53+
return docId;
54+
}
55+
4256
private static getAppDom():Photoshop {
4357
const appDom = new photoshop.app.Photoshop();
4458
return appDom;
4559
}
4660

47-
private static getLayerDom(layer: number, doc?: number): Layer|null {
48-
if (doc === undefined) {
49-
doc = photoshop.app.activeDocument._id;
61+
private static getDocumentDom(doc: number):Document|null {
62+
const docDom = new photoshop.app.Document(doc);
63+
if (!docDom) { return null;}
64+
const extraDom = new DocumentExtra(docDom);
65+
if (!extraDom.exists) {
66+
return null;
5067
}
51-
const layerDom = new photoshop.app.Layer(layer, doc);
68+
return docDom;
69+
}
70+
71+
private static getLayerDom(layer: number, docId?: number): Layer|null {
72+
docId = GetDOM.sanitizeDocId(docId);
73+
if (!docId) { return null;}
74+
const layerDom = new photoshop.app.Layer(layer, docId);
5275
const layerExtra = new LayerExtra(layerDom);
5376
if (!layerExtra.exists) {
5477
return null;
5578
}
5679
return layerDom;
5780
}
5881

59-
private static getDocumentDom(doc: number):Document|null {
60-
const docDom = new photoshop.app.Document(doc);
61-
const extraDom = new DocumentExtra(docDom);
62-
if (!extraDom.exists) {
63-
return null;
64-
}
65-
return docDom;
82+
private static getHistoryDom(historyId: number, docId?: number) {
83+
docId = GetDOM.sanitizeDocId(docId);
84+
if (!docId) { return null;}
85+
const doc = GetDOM.getDocumentDom(docId);
86+
const found = (doc as any).historyStates.find((h: any) => historyId === h.id) || null;
87+
return found;
6688
}
6789

6890
private static actionSetDom(actionSetID: number):ActionSet {

src/inspector/classes/Listener.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ export class ListenerClass{
2626
this.listenerCb = cb;
2727
ListenerClass.addAMConverterHack();
2828
if (Main.devMode) {
29-
app.eventNotifier = this.listenerCb;
29+
//app.eventNotifier = this.listenerCb;
30+
action.addNotificationListener(["$All "] as any, this.listenerCb);
3031
} else {
31-
action.addNotificationListener(this.allEventsArray, this.listenerCb);
32+
action.addNotificationListener(this.allEventsArray, this.listenerCb);
3233
}
3334
}
3435

3536
public static stopListener(): void{
3637
this.removeAMConverterHack();
3738
if (Main.devMode) {
38-
app.eventNotifier = () => { };
39+
//app.eventNotifier = () => { };
40+
action.removeNotificationListener(["$All "] as any, this.listenerCb);
3941
} else {
4042
action.removeNotificationListener(this.allEventsArray, this.listenerCb);
4143
}

0 commit comments

Comments
 (0)