@lvce-editor/ports-view 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/portsViewWorkerMain.js +38 -29
- package/package.json +1 -1
|
@@ -1024,12 +1024,12 @@ const ClientX = 'event.clientX';
|
|
|
1024
1024
|
const ClientY = 'event.clientY';
|
|
1025
1025
|
const DeltaMode = 'event.deltaMode';
|
|
1026
1026
|
const DeltaY = 'event.deltaY';
|
|
1027
|
-
const Key = 'event.key';
|
|
1028
1027
|
const TargetName = 'event.target.name';
|
|
1029
1028
|
const TargetValue = 'event.target.value';
|
|
1030
1029
|
|
|
1031
1030
|
const Backspace = 1;
|
|
1032
1031
|
const Enter = 3;
|
|
1032
|
+
const Escape = 8;
|
|
1033
1033
|
const Space = 9;
|
|
1034
1034
|
const End = 255;
|
|
1035
1035
|
const Home = 12;
|
|
@@ -1044,6 +1044,7 @@ const None = 0;
|
|
|
1044
1044
|
|
|
1045
1045
|
const RendererWorker = 1;
|
|
1046
1046
|
|
|
1047
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
1047
1048
|
const SetCss = 'Viewlet.setCss';
|
|
1048
1049
|
const SetDom2 = 'Viewlet.setDom2';
|
|
1049
1050
|
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
@@ -1554,15 +1555,6 @@ const submitAddPort = state => {
|
|
|
1554
1555
|
editing: false
|
|
1555
1556
|
};
|
|
1556
1557
|
};
|
|
1557
|
-
const handleAddPortKeyDown = (state, key) => {
|
|
1558
|
-
if (key === 'Enter') {
|
|
1559
|
-
return submitAddPort(state);
|
|
1560
|
-
}
|
|
1561
|
-
if (key === 'Escape') {
|
|
1562
|
-
return cancelAddPort(state);
|
|
1563
|
-
}
|
|
1564
|
-
return state;
|
|
1565
|
-
};
|
|
1566
1558
|
|
|
1567
1559
|
const copyLink = async (state, href) => {
|
|
1568
1560
|
await writeClipBoardText(href);
|
|
@@ -1613,7 +1605,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir, parentUid) =>
|
|
|
1613
1605
|
};
|
|
1614
1606
|
|
|
1615
1607
|
const isFocusContextEqual = (oldState, newState) => {
|
|
1616
|
-
return oldState.focused === newState.focused
|
|
1608
|
+
return oldState.focused === newState.focused;
|
|
1617
1609
|
};
|
|
1618
1610
|
const isDomEqual = (oldState, newState) => {
|
|
1619
1611
|
return oldState.addPortError === newState.addPortError && oldState.addPortValue === newState.addPortValue && oldState.editing === newState.editing && oldState.focusedIndex === newState.focusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.ports === newState.ports;
|
|
@@ -1621,18 +1613,22 @@ const isDomEqual = (oldState, newState) => {
|
|
|
1621
1613
|
const isCssEqual = (oldState, newState) => {
|
|
1622
1614
|
return oldState.loaded && oldState.deltaY % oldState.itemHeight === newState.deltaY % newState.itemHeight && oldState.footerHeight === newState.footerHeight && oldState.headerHeight === newState.headerHeight && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.width === newState.width;
|
|
1623
1615
|
};
|
|
1616
|
+
const isEditingEqual = (oldState, newState) => {
|
|
1617
|
+
return oldState.editing === newState.editing;
|
|
1618
|
+
};
|
|
1624
1619
|
|
|
1625
1620
|
const RenderCss = 1;
|
|
1626
1621
|
const RenderDom = 2;
|
|
1627
1622
|
const RenderIncremental = 3;
|
|
1628
1623
|
const RenderFocusContext = 4;
|
|
1624
|
+
const RenderFocus = 5;
|
|
1629
1625
|
|
|
1630
1626
|
const diff2 = uid => {
|
|
1631
1627
|
const {
|
|
1632
1628
|
oldState
|
|
1633
1629
|
} = get(uid);
|
|
1634
1630
|
const domDiffType = oldState.loaded ? RenderIncremental : RenderDom;
|
|
1635
|
-
return diff(uid, [isDomEqual, isCssEqual, isFocusContextEqual], [domDiffType, RenderCss, RenderFocusContext]);
|
|
1631
|
+
return diff(uid, [isDomEqual, isCssEqual, isFocusContextEqual, isEditingEqual], [domDiffType, RenderCss, RenderFocusContext, RenderFocus]);
|
|
1636
1632
|
};
|
|
1637
1633
|
|
|
1638
1634
|
const setDeltaY = (state, deltaY) => {
|
|
@@ -2037,8 +2033,8 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
2037
2033
|
return removeTrailingNavigationPatches(patches);
|
|
2038
2034
|
};
|
|
2039
2035
|
|
|
2040
|
-
const Empty = 0;
|
|
2041
2036
|
const FocusPorts = 9000;
|
|
2037
|
+
const FocusPortsAddPort = 9001;
|
|
2042
2038
|
|
|
2043
2039
|
const getKeyBindings = () => {
|
|
2044
2040
|
return [{
|
|
@@ -2081,6 +2077,14 @@ const getKeyBindings = () => {
|
|
|
2081
2077
|
command: 'Ports.removeFocusedPort',
|
|
2082
2078
|
key: Backspace,
|
|
2083
2079
|
when: FocusPorts
|
|
2080
|
+
}, {
|
|
2081
|
+
command: 'Ports.submitAddPort',
|
|
2082
|
+
key: Enter,
|
|
2083
|
+
when: FocusPortsAddPort
|
|
2084
|
+
}, {
|
|
2085
|
+
command: 'Ports.cancelAddPort',
|
|
2086
|
+
key: Escape,
|
|
2087
|
+
when: FocusPortsAddPort
|
|
2084
2088
|
}];
|
|
2085
2089
|
};
|
|
2086
2090
|
|
|
@@ -2367,15 +2371,14 @@ const PortsTableRowOdd = 'PortsTableRowOdd';
|
|
|
2367
2371
|
const Viewlet = 'Viewlet';
|
|
2368
2372
|
|
|
2369
2373
|
const HandleAddPortInput = 1;
|
|
2370
|
-
const
|
|
2371
|
-
const
|
|
2372
|
-
const
|
|
2373
|
-
const
|
|
2374
|
-
const
|
|
2375
|
-
const
|
|
2376
|
-
const
|
|
2377
|
-
const
|
|
2378
|
-
const HandleContextMenu = 10;
|
|
2374
|
+
const HandleBlur = 2;
|
|
2375
|
+
const HandleCancelAddPort = 3;
|
|
2376
|
+
const HandleClick = 4;
|
|
2377
|
+
const HandleFocus = 5;
|
|
2378
|
+
const HandleStartAddPort = 6;
|
|
2379
|
+
const HandleSubmitAddPort = 7;
|
|
2380
|
+
const HandleWheel = 8;
|
|
2381
|
+
const HandleContextMenu = 9;
|
|
2379
2382
|
|
|
2380
2383
|
const errorMessage = {
|
|
2381
2384
|
childCount: 1,
|
|
@@ -2403,7 +2406,6 @@ const getPortInputDom = addPortValue => {
|
|
|
2403
2406
|
className: AddPortInput,
|
|
2404
2407
|
inputMode: 'numeric',
|
|
2405
2408
|
onInput: HandleAddPortInput,
|
|
2406
|
-
onKeyDown: HandleAddPortKeyDown,
|
|
2407
2409
|
placeholder: portNumber(),
|
|
2408
2410
|
type: Input,
|
|
2409
2411
|
value: addPortValue
|
|
@@ -2625,11 +2627,20 @@ const renderDom = (oldState, newState) => {
|
|
|
2625
2627
|
return [SetDom2, newState.uid, getPortsVirtualDom(newState)];
|
|
2626
2628
|
};
|
|
2627
2629
|
|
|
2630
|
+
const renderFocus = (oldState, newState) => {
|
|
2631
|
+
if (oldState.editing === newState.editing) {
|
|
2632
|
+
return [];
|
|
2633
|
+
}
|
|
2634
|
+
const selector = newState.editing ? '.AddPortInput' : '.Ports';
|
|
2635
|
+
return [FocusSelector, newState.uid, selector];
|
|
2636
|
+
};
|
|
2637
|
+
|
|
2628
2638
|
const renderFocusContext = (oldState, newState) => {
|
|
2629
2639
|
if (!newState.focused) {
|
|
2630
|
-
|
|
2640
|
+
const focusContext = oldState.editing ? FocusPortsAddPort : FocusPorts;
|
|
2641
|
+
return ['Viewlet.unsetAdditionalFocus', newState.uid, focusContext];
|
|
2631
2642
|
}
|
|
2632
|
-
return [SetFocusContext, newState.uid, newState.editing ?
|
|
2643
|
+
return [SetFocusContext, newState.uid, newState.editing ? FocusPortsAddPort : FocusPorts];
|
|
2633
2644
|
};
|
|
2634
2645
|
|
|
2635
2646
|
const renderIncremental = (oldState, newState) => {
|
|
@@ -2644,6 +2655,8 @@ const getRenderer = diffType => {
|
|
|
2644
2655
|
return renderCss;
|
|
2645
2656
|
case RenderDom:
|
|
2646
2657
|
return renderDom;
|
|
2658
|
+
case RenderFocus:
|
|
2659
|
+
return renderFocus;
|
|
2647
2660
|
case RenderFocusContext:
|
|
2648
2661
|
return renderFocusContext;
|
|
2649
2662
|
case RenderIncremental:
|
|
@@ -2665,9 +2678,6 @@ const renderEventListeners = () => {
|
|
|
2665
2678
|
return [{
|
|
2666
2679
|
name: HandleAddPortInput,
|
|
2667
2680
|
params: ['handleAddPortInput', TargetValue]
|
|
2668
|
-
}, {
|
|
2669
|
-
name: HandleAddPortKeyDown,
|
|
2670
|
-
params: ['handleAddPortKeyDown', Key]
|
|
2671
2681
|
}, {
|
|
2672
2682
|
name: HandleBlur,
|
|
2673
2683
|
params: ['handleBlur']
|
|
@@ -2752,7 +2762,6 @@ const commandMap = {
|
|
|
2752
2762
|
'Ports.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
2753
2763
|
'Ports.getMenuIds': getMenuIds,
|
|
2754
2764
|
'Ports.handleAddPortInput': wrapCommand(handleAddPortInput),
|
|
2755
|
-
'Ports.handleAddPortKeyDown': wrapCommand(handleAddPortKeyDown),
|
|
2756
2765
|
'Ports.handleBlur': wrapCommand(handleBlur),
|
|
2757
2766
|
'Ports.handleClick': wrapCommand(handleClick),
|
|
2758
2767
|
'Ports.handleContextMenu': wrapCommand(handleContextMenu),
|