@lvce-editor/renderer-process 25.2.0 → 26.1.0
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/rendererProcessMain.js +522 -606
- package/package.json +1 -1
|
@@ -797,167 +797,92 @@ const VirtualDomElements = {
|
|
|
797
797
|
Video: Video$1
|
|
798
798
|
};
|
|
799
799
|
|
|
800
|
+
const elementTagMap = {
|
|
801
|
+
[A]: A$1,
|
|
802
|
+
[Article]: Article$1,
|
|
803
|
+
[Aside]: Aside$1,
|
|
804
|
+
[Audio$2]: Audio$3,
|
|
805
|
+
[BlockQuote]: BlockQuote$1,
|
|
806
|
+
[Br$1]: Br$2,
|
|
807
|
+
[Button]: Button$1,
|
|
808
|
+
[Canvas]: Canvas$1,
|
|
809
|
+
[Circle]: Circle$1,
|
|
810
|
+
[Cite]: Cite$1,
|
|
811
|
+
[Code$1]: Code$2,
|
|
812
|
+
[Col]: Col$1,
|
|
813
|
+
[ColGroup]: ColGroup$1,
|
|
814
|
+
[Data]: Data$1,
|
|
815
|
+
[Dd]: Dd$1,
|
|
816
|
+
[Defs]: Defs$1,
|
|
817
|
+
[Del]: Del$1,
|
|
818
|
+
[Div]: Div$1,
|
|
819
|
+
[Dl$1]: Dl$2,
|
|
820
|
+
[Dt$1]: Dt$2,
|
|
821
|
+
[Ellipse]: Ellipse$1,
|
|
822
|
+
[Em]: Em$1,
|
|
823
|
+
[Figcaption]: Figcaption$1,
|
|
824
|
+
[Figure]: Figure$1,
|
|
825
|
+
[Footer]: Footer$1,
|
|
826
|
+
[Form]: Form$1,
|
|
827
|
+
[G$1]: G$2,
|
|
828
|
+
[H1]: H1$1,
|
|
829
|
+
[H2]: H2$1,
|
|
830
|
+
[H3]: H3$1,
|
|
831
|
+
[H4]: H4$1,
|
|
832
|
+
[H5]: H5$1,
|
|
833
|
+
[H6]: H6$1,
|
|
834
|
+
[Head]: Head$1,
|
|
835
|
+
[Header]: Header$1,
|
|
836
|
+
[Hr]: Hr$1,
|
|
837
|
+
[Html]: Html$1,
|
|
838
|
+
[I]: I$1,
|
|
839
|
+
[Iframe]: Iframe$1,
|
|
840
|
+
[Img]: Img$1,
|
|
841
|
+
[Input]: Input$1,
|
|
842
|
+
[Ins]: Ins$1,
|
|
843
|
+
[Kbd]: Kbd$1,
|
|
844
|
+
[Label]: Label$1,
|
|
845
|
+
[Li$1]: Li$2,
|
|
846
|
+
[Line]: Line$1,
|
|
847
|
+
[Main]: Main$1,
|
|
848
|
+
[Meta]: Meta$1,
|
|
849
|
+
[Nav]: Nav$1,
|
|
850
|
+
[Ol$1]: Ol$2,
|
|
851
|
+
[Option]: Option$1,
|
|
852
|
+
[P]: P$1,
|
|
853
|
+
[Path]: Path$1,
|
|
854
|
+
[Polygon]: Polygon$1,
|
|
855
|
+
[Polyline]: Polyline$1,
|
|
856
|
+
[Pre]: Pre$1,
|
|
857
|
+
[Quote$2]: Quote$3,
|
|
858
|
+
[Rect]: Rect$1,
|
|
859
|
+
[Search]: Search$1,
|
|
860
|
+
[Section]: Section$1,
|
|
861
|
+
[Select]: Select$1,
|
|
862
|
+
[Span]: Span$1,
|
|
863
|
+
[Strong]: Strong$1,
|
|
864
|
+
[Style]: Style$1,
|
|
865
|
+
[Svg]: Svg$1,
|
|
866
|
+
[Table]: Table$1,
|
|
867
|
+
[TBody]: TBody$1,
|
|
868
|
+
[Td]: Td$1,
|
|
869
|
+
[TextArea]: TextArea$1,
|
|
870
|
+
[Tfoot]: Tfoot$1,
|
|
871
|
+
[Th]: Th$1,
|
|
872
|
+
[THead]: THead$1,
|
|
873
|
+
[Time]: Time$1,
|
|
874
|
+
[Title]: Title$1,
|
|
875
|
+
[Tr$1]: Tr$2,
|
|
876
|
+
[Ul]: Ul$1,
|
|
877
|
+
[Use]: Use$1,
|
|
878
|
+
[Video$1]: Video$2
|
|
879
|
+
};
|
|
800
880
|
const getElementTag$1 = type => {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
case Article:
|
|
805
|
-
return Article$1;
|
|
806
|
-
case Aside:
|
|
807
|
-
return Aside$1;
|
|
808
|
-
case Audio$2:
|
|
809
|
-
return Audio$3;
|
|
810
|
-
case BlockQuote:
|
|
811
|
-
return BlockQuote$1;
|
|
812
|
-
case Br$1:
|
|
813
|
-
return Br$2;
|
|
814
|
-
case Button:
|
|
815
|
-
return Button$1;
|
|
816
|
-
case Canvas:
|
|
817
|
-
return Canvas$1;
|
|
818
|
-
case Circle:
|
|
819
|
-
return Circle$1;
|
|
820
|
-
case Cite:
|
|
821
|
-
return Cite$1;
|
|
822
|
-
case Code$1:
|
|
823
|
-
return Code$2;
|
|
824
|
-
case Col:
|
|
825
|
-
return Col$1;
|
|
826
|
-
case ColGroup:
|
|
827
|
-
return ColGroup$1;
|
|
828
|
-
case Data:
|
|
829
|
-
return Data$1;
|
|
830
|
-
case Dd:
|
|
831
|
-
return Dd$1;
|
|
832
|
-
case Defs:
|
|
833
|
-
return Defs$1;
|
|
834
|
-
case Del:
|
|
835
|
-
return Del$1;
|
|
836
|
-
case Div:
|
|
837
|
-
return Div$1;
|
|
838
|
-
case Dl$1:
|
|
839
|
-
return Dl$2;
|
|
840
|
-
case Dt$1:
|
|
841
|
-
return Dt$2;
|
|
842
|
-
case Ellipse:
|
|
843
|
-
return Ellipse$1;
|
|
844
|
-
case Em:
|
|
845
|
-
return Em$1;
|
|
846
|
-
case Figcaption:
|
|
847
|
-
return Figcaption$1;
|
|
848
|
-
case Figure:
|
|
849
|
-
return Figure$1;
|
|
850
|
-
case Footer:
|
|
851
|
-
return Footer$1;
|
|
852
|
-
case Form:
|
|
853
|
-
return Form$1;
|
|
854
|
-
case G$1:
|
|
855
|
-
return G$2;
|
|
856
|
-
case H1:
|
|
857
|
-
return H1$1;
|
|
858
|
-
case H2:
|
|
859
|
-
return H2$1;
|
|
860
|
-
case H3:
|
|
861
|
-
return H3$1;
|
|
862
|
-
case H4:
|
|
863
|
-
return H4$1;
|
|
864
|
-
case H5:
|
|
865
|
-
return H5$1;
|
|
866
|
-
case H6:
|
|
867
|
-
return H6$1;
|
|
868
|
-
case Head:
|
|
869
|
-
return Head$1;
|
|
870
|
-
case Header:
|
|
871
|
-
return Header$1;
|
|
872
|
-
case Hr:
|
|
873
|
-
return Hr$1;
|
|
874
|
-
case Html:
|
|
875
|
-
return Html$1;
|
|
876
|
-
case I:
|
|
877
|
-
return I$1;
|
|
878
|
-
case Iframe:
|
|
879
|
-
return Iframe$1;
|
|
880
|
-
case Img:
|
|
881
|
-
return Img$1;
|
|
882
|
-
case Input:
|
|
883
|
-
return Input$1;
|
|
884
|
-
case Ins:
|
|
885
|
-
return Ins$1;
|
|
886
|
-
case Kbd:
|
|
887
|
-
return Kbd$1;
|
|
888
|
-
case Label:
|
|
889
|
-
return Label$1;
|
|
890
|
-
case Li$1:
|
|
891
|
-
return Li$2;
|
|
892
|
-
case Line:
|
|
893
|
-
return Line$1;
|
|
894
|
-
case Main:
|
|
895
|
-
return Main$1;
|
|
896
|
-
case Meta:
|
|
897
|
-
return Meta$1;
|
|
898
|
-
case Nav:
|
|
899
|
-
return Nav$1;
|
|
900
|
-
case Ol$1:
|
|
901
|
-
return Ol$2;
|
|
902
|
-
case Option:
|
|
903
|
-
return Option$1;
|
|
904
|
-
case P:
|
|
905
|
-
return P$1;
|
|
906
|
-
case Path:
|
|
907
|
-
return Path$1;
|
|
908
|
-
case Polygon:
|
|
909
|
-
return Polygon$1;
|
|
910
|
-
case Polyline:
|
|
911
|
-
return Polyline$1;
|
|
912
|
-
case Pre:
|
|
913
|
-
return Pre$1;
|
|
914
|
-
case Quote$2:
|
|
915
|
-
return Quote$3;
|
|
916
|
-
case Rect:
|
|
917
|
-
return Rect$1;
|
|
918
|
-
case Search:
|
|
919
|
-
return Search$1;
|
|
920
|
-
case Section:
|
|
921
|
-
return Section$1;
|
|
922
|
-
case Select:
|
|
923
|
-
return Select$1;
|
|
924
|
-
case Span:
|
|
925
|
-
return Span$1;
|
|
926
|
-
case Strong:
|
|
927
|
-
return Strong$1;
|
|
928
|
-
case Style:
|
|
929
|
-
return Style$1;
|
|
930
|
-
case Svg:
|
|
931
|
-
return Svg$1;
|
|
932
|
-
case Table:
|
|
933
|
-
return Table$1;
|
|
934
|
-
case TBody:
|
|
935
|
-
return TBody$1;
|
|
936
|
-
case Td:
|
|
937
|
-
return Td$1;
|
|
938
|
-
case TextArea:
|
|
939
|
-
return TextArea$1;
|
|
940
|
-
case Tfoot:
|
|
941
|
-
return Tfoot$1;
|
|
942
|
-
case Th:
|
|
943
|
-
return Th$1;
|
|
944
|
-
case THead:
|
|
945
|
-
return THead$1;
|
|
946
|
-
case Time:
|
|
947
|
-
return Time$1;
|
|
948
|
-
case Title:
|
|
949
|
-
return Title$1;
|
|
950
|
-
case Tr$1:
|
|
951
|
-
return Tr$2;
|
|
952
|
-
case Ul:
|
|
953
|
-
return Ul$1;
|
|
954
|
-
case Use:
|
|
955
|
-
return Use$1;
|
|
956
|
-
case Video$1:
|
|
957
|
-
return Video$2;
|
|
958
|
-
default:
|
|
959
|
-
throw new Error(`element tag not found ${type}`);
|
|
881
|
+
const elementTag = elementTagMap[type];
|
|
882
|
+
if (elementTag) {
|
|
883
|
+
return elementTag;
|
|
960
884
|
}
|
|
885
|
+
throw new Error(`element tag not found ${type}`);
|
|
961
886
|
};
|
|
962
887
|
|
|
963
888
|
const ElementTagMap = {
|
|
@@ -1146,189 +1071,100 @@ const Quote = 93;
|
|
|
1146
1071
|
const Star = 131;
|
|
1147
1072
|
const Plus = 132;
|
|
1148
1073
|
|
|
1074
|
+
const keyCodeMap = {
|
|
1075
|
+
[Backquote$1]: Backquote,
|
|
1076
|
+
[Backquote2]: Backquote,
|
|
1077
|
+
[Backslash$1]: Backslash,
|
|
1078
|
+
[Backspace$1]: Backspace,
|
|
1079
|
+
[BracketLeft$1]: BracketLeft,
|
|
1080
|
+
[BracketRight$1]: BracketRight,
|
|
1081
|
+
[Comma$1]: Comma,
|
|
1082
|
+
[Delete$1]: Delete,
|
|
1083
|
+
[Digit0$1]: Digit0,
|
|
1084
|
+
[Digit1$1]: Digit1,
|
|
1085
|
+
[Digit2$1]: Digit2,
|
|
1086
|
+
[Digit3$1]: Digit3,
|
|
1087
|
+
[Digit4$1]: Digit4,
|
|
1088
|
+
[Digit5$1]: Digit5,
|
|
1089
|
+
[Digit6$1]: Digit6,
|
|
1090
|
+
[Digit7$1]: Digit7,
|
|
1091
|
+
[Digit8$1]: Digit8,
|
|
1092
|
+
[Digit9$1]: Digit9,
|
|
1093
|
+
[DownArrow$1]: DownArrow,
|
|
1094
|
+
[End$1]: End,
|
|
1095
|
+
[Enter$1]: Enter,
|
|
1096
|
+
[Equal$1]: Equal,
|
|
1097
|
+
[Escape$1]: Escape,
|
|
1098
|
+
[F1$1]: F1,
|
|
1099
|
+
[F10$1]: F10,
|
|
1100
|
+
[F11$1]: F11,
|
|
1101
|
+
[F12$1]: F12,
|
|
1102
|
+
[F13$1]: F13,
|
|
1103
|
+
[F14$1]: F14,
|
|
1104
|
+
[F15$1]: F15,
|
|
1105
|
+
[F16$1]: F16,
|
|
1106
|
+
[F17$1]: F17,
|
|
1107
|
+
[F18$1]: F18,
|
|
1108
|
+
[F19$1]: F19,
|
|
1109
|
+
[F2$1]: F2,
|
|
1110
|
+
[F20$1]: F20,
|
|
1111
|
+
[F21$1]: F21,
|
|
1112
|
+
[F22$1]: F22,
|
|
1113
|
+
[F23$1]: F23,
|
|
1114
|
+
[F24$1]: F24,
|
|
1115
|
+
[F3$1]: F3,
|
|
1116
|
+
[F4$1]: F4,
|
|
1117
|
+
[F5$1]: F5,
|
|
1118
|
+
[F6$1]: F6,
|
|
1119
|
+
[F7$1]: F7,
|
|
1120
|
+
[F8$1]: F8,
|
|
1121
|
+
[F9$1]: F9,
|
|
1122
|
+
[Home$1]: Home,
|
|
1123
|
+
[Insert$1]: Insert,
|
|
1124
|
+
[KeyA$1]: KeyA,
|
|
1125
|
+
[KeyB$1]: KeyB,
|
|
1126
|
+
[KeyC$1]: KeyC,
|
|
1127
|
+
[KeyD$1]: KeyD,
|
|
1128
|
+
[KeyE$1]: KeyE,
|
|
1129
|
+
[KeyF$1]: KeyF,
|
|
1130
|
+
[KeyG$1]: KeyG,
|
|
1131
|
+
[KeyH$1]: KeyH,
|
|
1132
|
+
[KeyI$1]: KeyI,
|
|
1133
|
+
[KeyJ$1]: KeyJ,
|
|
1134
|
+
[KeyK$1]: KeyK,
|
|
1135
|
+
[KeyL$1]: KeyL,
|
|
1136
|
+
[KeyM$1]: KeyM,
|
|
1137
|
+
[KeyN$1]: KeyN,
|
|
1138
|
+
[KeyO$1]: KeyO,
|
|
1139
|
+
[KeyP$1]: KeyP,
|
|
1140
|
+
[KeyQ$1]: KeyQ,
|
|
1141
|
+
[KeyR$1]: KeyR,
|
|
1142
|
+
[KeyS$1]: KeyS,
|
|
1143
|
+
[KeyT$1]: KeyT,
|
|
1144
|
+
[KeyU$1]: KeyU,
|
|
1145
|
+
[KeyV$1]: KeyV,
|
|
1146
|
+
[KeyW$1]: KeyW,
|
|
1147
|
+
[KeyX$1]: KeyX,
|
|
1148
|
+
[KeyY$1]: KeyY,
|
|
1149
|
+
[KeyZ$1]: KeyZ,
|
|
1150
|
+
[LeftArrow$1]: LeftArrow,
|
|
1151
|
+
[Minus$1]: Minus,
|
|
1152
|
+
[PageDown$1]: PageDown,
|
|
1153
|
+
[PageUp$1]: PageUp,
|
|
1154
|
+
[Period$1]: Period,
|
|
1155
|
+
[Plus$1]: Plus,
|
|
1156
|
+
[Quote$1]: Quote,
|
|
1157
|
+
[RightArrow$1]: RightArrow,
|
|
1158
|
+
[SemiColon$1]: SemiColon,
|
|
1159
|
+
[Slash$1]: Slash,
|
|
1160
|
+
[Space$1]: Space,
|
|
1161
|
+
[Space2]: Space,
|
|
1162
|
+
[Star$1]: Star,
|
|
1163
|
+
[Tab$1]: Tab,
|
|
1164
|
+
[UpArrow$1]: UpArrow
|
|
1165
|
+
};
|
|
1149
1166
|
const getKeyCode = key => {
|
|
1150
|
-
|
|
1151
|
-
case Backquote$1:
|
|
1152
|
-
case Backquote2:
|
|
1153
|
-
return Backquote;
|
|
1154
|
-
case Backslash$1:
|
|
1155
|
-
return Backslash;
|
|
1156
|
-
case Backspace$1:
|
|
1157
|
-
return Backspace;
|
|
1158
|
-
case BracketLeft$1:
|
|
1159
|
-
return BracketLeft;
|
|
1160
|
-
case BracketRight$1:
|
|
1161
|
-
return BracketRight;
|
|
1162
|
-
case Comma$1:
|
|
1163
|
-
return Comma;
|
|
1164
|
-
case Delete$1:
|
|
1165
|
-
return Delete;
|
|
1166
|
-
case Digit0$1:
|
|
1167
|
-
return Digit0;
|
|
1168
|
-
case Digit1$1:
|
|
1169
|
-
return Digit1;
|
|
1170
|
-
case Digit2$1:
|
|
1171
|
-
return Digit2;
|
|
1172
|
-
case Digit3$1:
|
|
1173
|
-
return Digit3;
|
|
1174
|
-
case Digit4$1:
|
|
1175
|
-
return Digit4;
|
|
1176
|
-
case Digit5$1:
|
|
1177
|
-
return Digit5;
|
|
1178
|
-
case Digit6$1:
|
|
1179
|
-
return Digit6;
|
|
1180
|
-
case Digit7$1:
|
|
1181
|
-
return Digit7;
|
|
1182
|
-
case Digit8$1:
|
|
1183
|
-
return Digit8;
|
|
1184
|
-
case Digit9$1:
|
|
1185
|
-
return Digit9;
|
|
1186
|
-
case DownArrow$1:
|
|
1187
|
-
return DownArrow;
|
|
1188
|
-
case End$1:
|
|
1189
|
-
return End;
|
|
1190
|
-
case Enter$1:
|
|
1191
|
-
return Enter;
|
|
1192
|
-
case Equal$1:
|
|
1193
|
-
return Equal;
|
|
1194
|
-
case Escape$1:
|
|
1195
|
-
return Escape;
|
|
1196
|
-
case F1$1:
|
|
1197
|
-
return F1;
|
|
1198
|
-
case F10$1:
|
|
1199
|
-
return F10;
|
|
1200
|
-
case F11$1:
|
|
1201
|
-
return F11;
|
|
1202
|
-
case F12$1:
|
|
1203
|
-
return F12;
|
|
1204
|
-
case F13$1:
|
|
1205
|
-
return F13;
|
|
1206
|
-
case F14$1:
|
|
1207
|
-
return F14;
|
|
1208
|
-
case F15$1:
|
|
1209
|
-
return F15;
|
|
1210
|
-
case F16$1:
|
|
1211
|
-
return F16;
|
|
1212
|
-
case F17$1:
|
|
1213
|
-
return F17;
|
|
1214
|
-
case F18$1:
|
|
1215
|
-
return F18;
|
|
1216
|
-
case F19$1:
|
|
1217
|
-
return F19;
|
|
1218
|
-
case F2$1:
|
|
1219
|
-
return F2;
|
|
1220
|
-
case F20$1:
|
|
1221
|
-
return F20;
|
|
1222
|
-
case F21$1:
|
|
1223
|
-
return F21;
|
|
1224
|
-
case F22$1:
|
|
1225
|
-
return F22;
|
|
1226
|
-
case F23$1:
|
|
1227
|
-
return F23;
|
|
1228
|
-
case F24$1:
|
|
1229
|
-
return F24;
|
|
1230
|
-
case F3$1:
|
|
1231
|
-
return F3;
|
|
1232
|
-
case F4$1:
|
|
1233
|
-
return F4;
|
|
1234
|
-
case F5$1:
|
|
1235
|
-
return F5;
|
|
1236
|
-
case F6$1:
|
|
1237
|
-
return F6;
|
|
1238
|
-
case F7$1:
|
|
1239
|
-
return F7;
|
|
1240
|
-
case F8$1:
|
|
1241
|
-
return F8;
|
|
1242
|
-
case F9$1:
|
|
1243
|
-
return F9;
|
|
1244
|
-
case Home$1:
|
|
1245
|
-
return Home;
|
|
1246
|
-
case Insert$1:
|
|
1247
|
-
return Insert;
|
|
1248
|
-
case KeyA$1:
|
|
1249
|
-
return KeyA;
|
|
1250
|
-
case KeyB$1:
|
|
1251
|
-
return KeyB;
|
|
1252
|
-
case KeyC$1:
|
|
1253
|
-
return KeyC;
|
|
1254
|
-
case KeyD$1:
|
|
1255
|
-
return KeyD;
|
|
1256
|
-
case KeyE$1:
|
|
1257
|
-
return KeyE;
|
|
1258
|
-
case KeyF$1:
|
|
1259
|
-
return KeyF;
|
|
1260
|
-
case KeyG$1:
|
|
1261
|
-
return KeyG;
|
|
1262
|
-
case KeyH$1:
|
|
1263
|
-
return KeyH;
|
|
1264
|
-
case KeyI$1:
|
|
1265
|
-
return KeyI;
|
|
1266
|
-
case KeyJ$1:
|
|
1267
|
-
return KeyJ;
|
|
1268
|
-
case KeyK$1:
|
|
1269
|
-
return KeyK;
|
|
1270
|
-
case KeyL$1:
|
|
1271
|
-
return KeyL;
|
|
1272
|
-
case KeyM$1:
|
|
1273
|
-
return KeyM;
|
|
1274
|
-
case KeyN$1:
|
|
1275
|
-
return KeyN;
|
|
1276
|
-
case KeyO$1:
|
|
1277
|
-
return KeyO;
|
|
1278
|
-
case KeyP$1:
|
|
1279
|
-
return KeyP;
|
|
1280
|
-
case KeyQ$1:
|
|
1281
|
-
return KeyQ;
|
|
1282
|
-
case KeyR$1:
|
|
1283
|
-
return KeyR;
|
|
1284
|
-
case KeyS$1:
|
|
1285
|
-
return KeyS;
|
|
1286
|
-
case KeyT$1:
|
|
1287
|
-
return KeyT;
|
|
1288
|
-
case KeyU$1:
|
|
1289
|
-
return KeyU;
|
|
1290
|
-
case KeyV$1:
|
|
1291
|
-
return KeyV;
|
|
1292
|
-
case KeyW$1:
|
|
1293
|
-
return KeyW;
|
|
1294
|
-
case KeyX$1:
|
|
1295
|
-
return KeyX;
|
|
1296
|
-
case KeyY$1:
|
|
1297
|
-
return KeyY;
|
|
1298
|
-
case KeyZ$1:
|
|
1299
|
-
return KeyZ;
|
|
1300
|
-
case LeftArrow$1:
|
|
1301
|
-
return LeftArrow;
|
|
1302
|
-
case Minus$1:
|
|
1303
|
-
return Minus;
|
|
1304
|
-
case PageDown$1:
|
|
1305
|
-
return PageDown;
|
|
1306
|
-
case PageUp$1:
|
|
1307
|
-
return PageUp;
|
|
1308
|
-
case Period$1:
|
|
1309
|
-
return Period;
|
|
1310
|
-
case Plus$1:
|
|
1311
|
-
return Plus;
|
|
1312
|
-
case Quote$1:
|
|
1313
|
-
return Quote;
|
|
1314
|
-
case RightArrow$1:
|
|
1315
|
-
return RightArrow;
|
|
1316
|
-
case SemiColon$1:
|
|
1317
|
-
return SemiColon;
|
|
1318
|
-
case Slash$1:
|
|
1319
|
-
return Slash;
|
|
1320
|
-
case Space$1:
|
|
1321
|
-
case Space2:
|
|
1322
|
-
return Space;
|
|
1323
|
-
case Star$1:
|
|
1324
|
-
return Star;
|
|
1325
|
-
case Tab$1:
|
|
1326
|
-
return Tab;
|
|
1327
|
-
case UpArrow$1:
|
|
1328
|
-
return UpArrow;
|
|
1329
|
-
default:
|
|
1330
|
-
return Unknown;
|
|
1331
|
-
}
|
|
1167
|
+
return keyCodeMap[key] || Unknown;
|
|
1332
1168
|
};
|
|
1333
1169
|
|
|
1334
1170
|
const CtrlCmd = 1 << 11 >>> 0;
|
|
@@ -1464,114 +1300,91 @@ const setStyle = ($Element, styleString) => {
|
|
|
1464
1300
|
}
|
|
1465
1301
|
};
|
|
1466
1302
|
|
|
1303
|
+
const optionalAttributeProps = new Map([['ariaActivedescendant', 'aria-activedescendant'], ['ariaOwns', 'aria-owns']]);
|
|
1304
|
+
const mappedAttributeProps = new Map([['ariaControls', 'aria-controls'], ['ariaLabelledBy', 'aria-labelledby']]);
|
|
1305
|
+
const pixelStyleProps = new Set(['left', 'marginTop', 'paddingLeft', 'paddingRight', 'top']);
|
|
1306
|
+
const eventProps = new Set(['onBlur', 'onChange', 'onClick', 'onContextMenu', 'onBeforeInput', 'onDblClick', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onFocus', 'onFocusIn', 'onFocusOut', 'onInput', 'onKeydown', 'onKeyDown', 'onKeyUp', 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPointerDown', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onScroll', 'onSelectionChange', 'onSubmit', 'onWheel']);
|
|
1307
|
+
const setOptionalAttribute = ($Element, attributeName, value) => {
|
|
1308
|
+
if (value) {
|
|
1309
|
+
$Element.setAttribute(attributeName, value);
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
$Element.removeAttribute(attributeName);
|
|
1313
|
+
};
|
|
1314
|
+
const setDimension = ($Element, key, value) => {
|
|
1315
|
+
if ($Element instanceof HTMLImageElement) {
|
|
1316
|
+
$Element[key] = value;
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
$Element.style[key] = typeof value === 'number' ? `${value}px` : value;
|
|
1320
|
+
};
|
|
1321
|
+
const setPixelStyle = ($Element, key, value) => {
|
|
1322
|
+
$Element.style[key] = typeof value === 'number' ? `${value}px` : value;
|
|
1323
|
+
};
|
|
1324
|
+
const setEventProp = ($Element, key, value, eventMap, newEventMap) => {
|
|
1325
|
+
if (!eventMap || !value) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
const eventName = key.slice(2).toLowerCase();
|
|
1329
|
+
attachEvent$1($Element, eventMap, eventName, value, newEventMap);
|
|
1330
|
+
};
|
|
1467
1331
|
const setProp = ($Element, key, value, eventMap, newEventMap) => {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
if (value) {
|
|
1485
|
-
$Element.setAttribute('aria-owns', value);
|
|
1486
|
-
} else {
|
|
1487
|
-
$Element.removeAttribute('aria-owns');
|
|
1488
|
-
}
|
|
1489
|
-
break;
|
|
1490
|
-
case 'childCount':
|
|
1491
|
-
case 'type':
|
|
1492
|
-
break;
|
|
1493
|
-
case 'height':
|
|
1494
|
-
case 'width':
|
|
1495
|
-
if ($Element instanceof HTMLImageElement) {
|
|
1496
|
-
$Element[key] = value;
|
|
1497
|
-
} else if (typeof value === 'number') {
|
|
1498
|
-
$Element.style[key] = `${value}px`;
|
|
1499
|
-
} else {
|
|
1500
|
-
$Element.style[key] = value;
|
|
1501
|
-
}
|
|
1502
|
-
break;
|
|
1503
|
-
case 'id':
|
|
1504
|
-
if (value) {
|
|
1505
|
-
$Element[key] = value;
|
|
1506
|
-
} else {
|
|
1507
|
-
$Element.removeAttribute(key);
|
|
1508
|
-
}
|
|
1509
|
-
break;
|
|
1510
|
-
case 'inputType':
|
|
1511
|
-
// @ts-ignore
|
|
1512
|
-
$Element.type = value;
|
|
1513
|
-
break;
|
|
1514
|
-
case 'left':
|
|
1515
|
-
case 'marginTop':
|
|
1516
|
-
case 'paddingLeft':
|
|
1517
|
-
case 'paddingRight':
|
|
1518
|
-
case 'top':
|
|
1519
|
-
$Element.style[key] = typeof value === 'number' ? `${value}px` : value;
|
|
1520
|
-
break;
|
|
1521
|
-
case 'maskImage':
|
|
1522
|
-
$Element.style.maskImage = `url('${value}')`;
|
|
1523
|
-
$Element.style.webkitMaskImage = `url('${value}')`;
|
|
1524
|
-
break;
|
|
1525
|
-
case 'onBlur':
|
|
1526
|
-
case 'onChange':
|
|
1527
|
-
case 'onClick':
|
|
1528
|
-
case 'onContextMenu':
|
|
1529
|
-
case 'onDblClick':
|
|
1530
|
-
case 'onDragEnd':
|
|
1531
|
-
case 'onDragEnter':
|
|
1532
|
-
case 'onDragLeave':
|
|
1533
|
-
case 'onDragOver':
|
|
1534
|
-
case 'onDragStart':
|
|
1535
|
-
case 'onDrop':
|
|
1536
|
-
case 'onFocus':
|
|
1537
|
-
case 'onFocusIn':
|
|
1538
|
-
case 'onFocusOut':
|
|
1539
|
-
case 'onInput':
|
|
1540
|
-
case 'onKeydown':
|
|
1541
|
-
case 'onKeyDown':
|
|
1542
|
-
case 'onKeyUp':
|
|
1543
|
-
case 'onMouseDown':
|
|
1544
|
-
case 'onMouseMove':
|
|
1545
|
-
case 'onMouseOut':
|
|
1546
|
-
case 'onMouseOver':
|
|
1547
|
-
case 'onMouseUp':
|
|
1548
|
-
case 'onPointerDown':
|
|
1549
|
-
case 'onPointerMove':
|
|
1550
|
-
case 'onPointerOut':
|
|
1551
|
-
case 'onPointerOver':
|
|
1552
|
-
case 'onScroll':
|
|
1553
|
-
case 'onSelectionChange':
|
|
1554
|
-
case 'onSubmit':
|
|
1555
|
-
case 'onWheel':
|
|
1556
|
-
const eventName = key.slice(2).toLowerCase();
|
|
1557
|
-
if (!eventMap || !value) {
|
|
1558
|
-
return;
|
|
1559
|
-
}
|
|
1560
|
-
attachEvent$1($Element, eventMap, eventName, value, newEventMap);
|
|
1561
|
-
break;
|
|
1562
|
-
case 'style':
|
|
1563
|
-
setStyle($Element, value);
|
|
1564
|
-
break;
|
|
1565
|
-
case 'translate':
|
|
1566
|
-
$Element.style[key] = value;
|
|
1567
|
-
break;
|
|
1568
|
-
default:
|
|
1569
|
-
if (key.startsWith('data-')) {
|
|
1570
|
-
$Element.dataset[key.slice('data-'.length)] = value;
|
|
1571
|
-
} else {
|
|
1572
|
-
$Element[key] = value;
|
|
1573
|
-
}
|
|
1332
|
+
const optionalAttributeName = optionalAttributeProps.get(key);
|
|
1333
|
+
if (optionalAttributeName) {
|
|
1334
|
+
setOptionalAttribute($Element, optionalAttributeName, value);
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
const mappedAttributeName = mappedAttributeProps.get(key);
|
|
1338
|
+
if (mappedAttributeName) {
|
|
1339
|
+
$Element.setAttribute(mappedAttributeName, value);
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
if (key === 'childCount' || key === 'type') {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (key === 'height' || key === 'width') {
|
|
1346
|
+
setDimension($Element, key, value);
|
|
1347
|
+
return;
|
|
1574
1348
|
}
|
|
1349
|
+
if (key === 'id') {
|
|
1350
|
+
if (value) {
|
|
1351
|
+
$Element[key] = value;
|
|
1352
|
+
} else {
|
|
1353
|
+
$Element.removeAttribute(key);
|
|
1354
|
+
}
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
if (key === 'inputType') {
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
$Element.type = value;
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
if (pixelStyleProps.has(key)) {
|
|
1363
|
+
setPixelStyle($Element, key, value);
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
if (key === 'maskImage') {
|
|
1367
|
+
$Element.style.maskImage = `url('${value}')`;
|
|
1368
|
+
$Element.style.webkitMaskImage = `url('${value}')`;
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
if (eventProps.has(key)) {
|
|
1372
|
+
setEventProp($Element, key, value, eventMap, newEventMap);
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
if (key === 'style') {
|
|
1376
|
+
setStyle($Element, value);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
if (key === 'translate') {
|
|
1380
|
+
$Element.style[key] = value;
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
if (key.startsWith('data-')) {
|
|
1384
|
+
$Element.dataset[key.slice('data-'.length)] = value;
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
$Element[key] = value;
|
|
1575
1388
|
};
|
|
1576
1389
|
|
|
1577
1390
|
const setProps = ($Element, props, eventMap, newEventMap) => {
|
|
@@ -1716,117 +1529,136 @@ const RemoveChild = 9;
|
|
|
1716
1529
|
const NavigateSibling = 10;
|
|
1717
1530
|
const SetReferenceNodeUid = 11;
|
|
1718
1531
|
|
|
1532
|
+
const handleNavigateChild = (state, patches, patchIndex) => {
|
|
1533
|
+
const patch = patches[patchIndex];
|
|
1534
|
+
const $Children = state.current.childNodes;
|
|
1535
|
+
const $Child = $Children[patch.index];
|
|
1536
|
+
if ($Child) {
|
|
1537
|
+
state.current = $Child;
|
|
1538
|
+
return true;
|
|
1539
|
+
}
|
|
1540
|
+
const nextPatch = patches[patchIndex + 1];
|
|
1541
|
+
if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
|
|
1542
|
+
const $Placeholder = document.createComment('virtual-dom-placeholder');
|
|
1543
|
+
state.current.append($Placeholder);
|
|
1544
|
+
state.current = $Placeholder;
|
|
1545
|
+
return true;
|
|
1546
|
+
}
|
|
1547
|
+
console.error('Cannot navigate to child: child not found at index', {
|
|
1548
|
+
$Current: state.current,
|
|
1549
|
+
index: patch.index,
|
|
1550
|
+
childCount: $Children.length
|
|
1551
|
+
});
|
|
1552
|
+
return false;
|
|
1553
|
+
};
|
|
1554
|
+
const handleNavigateParent = state => {
|
|
1555
|
+
const $Parent = state.current.parentNode;
|
|
1556
|
+
if (!$Parent) {
|
|
1557
|
+
console.error('Cannot navigate to parent: current node has no parent', {
|
|
1558
|
+
$Current: state.current
|
|
1559
|
+
});
|
|
1560
|
+
return false;
|
|
1561
|
+
}
|
|
1562
|
+
state.current = $Parent;
|
|
1563
|
+
return true;
|
|
1564
|
+
};
|
|
1565
|
+
const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
|
|
1566
|
+
const $Parent = state.current.parentNode;
|
|
1567
|
+
if (!$Parent) {
|
|
1568
|
+
console.error('Cannot navigate to sibling: current node has no parent', {
|
|
1569
|
+
patchIndex
|
|
1570
|
+
});
|
|
1571
|
+
return false;
|
|
1572
|
+
}
|
|
1573
|
+
let $Sibling = $Parent.childNodes[patch.index];
|
|
1574
|
+
if (!$Sibling && !state.hasAppliedMutation && state.current !== $Element) {
|
|
1575
|
+
$Sibling = $Element.childNodes[patch.index];
|
|
1576
|
+
}
|
|
1577
|
+
if (!$Sibling) {
|
|
1578
|
+
console.error('Cannot navigate to sibling: sibling not found at index', {
|
|
1579
|
+
$Parent,
|
|
1580
|
+
index: patch.index,
|
|
1581
|
+
childCount: $Parent.childNodes.length
|
|
1582
|
+
});
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
state.current = $Sibling;
|
|
1586
|
+
return true;
|
|
1587
|
+
};
|
|
1588
|
+
const handleSetReferenceNodeUid = (state, patch) => {
|
|
1589
|
+
const instance = get$a(patch.uid);
|
|
1590
|
+
if (!instance || !instance.state) {
|
|
1591
|
+
console.error('Cannot set reference node uid: instance not found', {
|
|
1592
|
+
uid: patch.uid
|
|
1593
|
+
});
|
|
1594
|
+
return false;
|
|
1595
|
+
}
|
|
1596
|
+
const $NewNode = instance.state.$Viewlet;
|
|
1597
|
+
// @ts-ignore
|
|
1598
|
+
state.current.replaceWith($NewNode);
|
|
1599
|
+
state.current = $NewNode;
|
|
1600
|
+
state.hasAppliedMutation = true;
|
|
1601
|
+
return true;
|
|
1602
|
+
};
|
|
1603
|
+
const handleNavigationPatch = (state, patch, patches, patchIndex, $Element) => {
|
|
1604
|
+
switch (patch.type) {
|
|
1605
|
+
case NavigateChild:
|
|
1606
|
+
return handleNavigateChild(state, patches, patchIndex);
|
|
1607
|
+
case NavigateParent:
|
|
1608
|
+
return handleNavigateParent(state);
|
|
1609
|
+
case NavigateSibling:
|
|
1610
|
+
return handleNavigateSibling(state, patch, $Element, patchIndex);
|
|
1611
|
+
default:
|
|
1612
|
+
return true;
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
const applyMutationPatch = (state, patch, events) => {
|
|
1616
|
+
switch (patch.type) {
|
|
1617
|
+
case Add:
|
|
1618
|
+
add(state.current, patch.nodes, events);
|
|
1619
|
+
state.hasAppliedMutation = true;
|
|
1620
|
+
break;
|
|
1621
|
+
case RemoveAttribute:
|
|
1622
|
+
removeAttribute(state.current, patch.key);
|
|
1623
|
+
state.hasAppliedMutation = true;
|
|
1624
|
+
break;
|
|
1625
|
+
case RemoveChild:
|
|
1626
|
+
removeChild(state.current, patch.index);
|
|
1627
|
+
state.hasAppliedMutation = true;
|
|
1628
|
+
break;
|
|
1629
|
+
case Replace:
|
|
1630
|
+
state.current = replace(state.current, patch.nodes, events);
|
|
1631
|
+
state.hasAppliedMutation = true;
|
|
1632
|
+
break;
|
|
1633
|
+
case SetAttribute:
|
|
1634
|
+
setProp(state.current, patch.key, patch.value, events);
|
|
1635
|
+
state.hasAppliedMutation = true;
|
|
1636
|
+
break;
|
|
1637
|
+
case SetText:
|
|
1638
|
+
setText$3(state.current, patch.value);
|
|
1639
|
+
state.hasAppliedMutation = true;
|
|
1640
|
+
break;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1719
1643
|
const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
|
|
1720
1644
|
const events = getEventListenerMap(id) || eventMap;
|
|
1721
|
-
|
|
1722
|
-
|
|
1645
|
+
const state = {
|
|
1646
|
+
current: $Element,
|
|
1647
|
+
hasAppliedMutation: false
|
|
1648
|
+
};
|
|
1723
1649
|
for (let patchIndex = 0; patchIndex < patches.length; patchIndex++) {
|
|
1724
1650
|
const patch = patches[patchIndex];
|
|
1725
1651
|
try {
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
const $Child = $Children[patch.index];
|
|
1735
|
-
if (!$Child) {
|
|
1736
|
-
const nextPatch = patches[patchIndex + 1];
|
|
1737
|
-
if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
|
|
1738
|
-
const $Placeholder = document.createComment('virtual-dom-placeholder');
|
|
1739
|
-
$Current.append($Placeholder);
|
|
1740
|
-
$Current = $Placeholder;
|
|
1741
|
-
break;
|
|
1742
|
-
}
|
|
1743
|
-
console.error('Cannot navigate to child: child not found at index', {
|
|
1744
|
-
$Current,
|
|
1745
|
-
index: patch.index,
|
|
1746
|
-
childCount: $Children.length
|
|
1747
|
-
});
|
|
1748
|
-
return;
|
|
1749
|
-
}
|
|
1750
|
-
$Current = $Child;
|
|
1751
|
-
break;
|
|
1752
|
-
}
|
|
1753
|
-
case NavigateParent:
|
|
1754
|
-
{
|
|
1755
|
-
const $Parent = $Current.parentNode;
|
|
1756
|
-
if (!$Parent) {
|
|
1757
|
-
console.error('Cannot navigate to parent: current node has no parent', {
|
|
1758
|
-
$Current
|
|
1759
|
-
});
|
|
1760
|
-
return;
|
|
1761
|
-
}
|
|
1762
|
-
$Current = $Parent;
|
|
1763
|
-
break;
|
|
1764
|
-
}
|
|
1765
|
-
case NavigateSibling:
|
|
1766
|
-
{
|
|
1767
|
-
const $Parent = $Current.parentNode;
|
|
1768
|
-
if (!$Parent) {
|
|
1769
|
-
console.error('Cannot navigate to sibling: current node has no parent', {
|
|
1770
|
-
patchIndex
|
|
1771
|
-
});
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
let $Sibling = $Parent.childNodes[patch.index];
|
|
1775
|
-
if (!$Sibling && !hasAppliedMutation && $Current !== $Element) {
|
|
1776
|
-
$Sibling = $Element.childNodes[patch.index];
|
|
1777
|
-
}
|
|
1778
|
-
$Current = $Sibling;
|
|
1779
|
-
if (!$Current) {
|
|
1780
|
-
console.error('Cannot navigate to sibling: sibling not found at index', {
|
|
1781
|
-
$Parent,
|
|
1782
|
-
index: patch.index,
|
|
1783
|
-
childCount: $Parent.childNodes.length
|
|
1784
|
-
});
|
|
1785
|
-
return;
|
|
1786
|
-
}
|
|
1787
|
-
break;
|
|
1788
|
-
}
|
|
1789
|
-
case RemoveAttribute:
|
|
1790
|
-
removeAttribute($Current, patch.key);
|
|
1791
|
-
hasAppliedMutation = true;
|
|
1792
|
-
break;
|
|
1793
|
-
case RemoveChild:
|
|
1794
|
-
removeChild($Current, patch.index);
|
|
1795
|
-
hasAppliedMutation = true;
|
|
1796
|
-
break;
|
|
1797
|
-
case Replace:
|
|
1798
|
-
$Current = replace($Current, patch.nodes, events);
|
|
1799
|
-
hasAppliedMutation = true;
|
|
1800
|
-
break;
|
|
1801
|
-
case SetAttribute:
|
|
1802
|
-
setProp($Current, patch.key, patch.value, events);
|
|
1803
|
-
hasAppliedMutation = true;
|
|
1804
|
-
break;
|
|
1805
|
-
case SetReferenceNodeUid:
|
|
1806
|
-
{
|
|
1807
|
-
// Get the new reference node instance
|
|
1808
|
-
const instance = get$a(patch.uid);
|
|
1809
|
-
if (!instance || !instance.state) {
|
|
1810
|
-
console.error('Cannot set reference node uid: instance not found', {
|
|
1811
|
-
uid: patch.uid
|
|
1812
|
-
});
|
|
1813
|
-
return;
|
|
1814
|
-
}
|
|
1815
|
-
const $NewNode = instance.state.$Viewlet;
|
|
1816
|
-
// Replace the current reference node with the new viewlet
|
|
1817
|
-
// @ts-ignore
|
|
1818
|
-
$Current.replaceWith($NewNode);
|
|
1819
|
-
$Current = $NewNode;
|
|
1820
|
-
hasAppliedMutation = true;
|
|
1821
|
-
break;
|
|
1822
|
-
}
|
|
1823
|
-
case SetText:
|
|
1824
|
-
setText$3($Current, patch.value);
|
|
1825
|
-
hasAppliedMutation = true;
|
|
1826
|
-
break;
|
|
1827
|
-
default:
|
|
1828
|
-
break;
|
|
1652
|
+
if (!handleNavigationPatch(state, patch, patches, patchIndex, $Element)) {
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
if (patch.type === SetReferenceNodeUid) {
|
|
1656
|
+
if (!handleSetReferenceNodeUid(state, patch)) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
continue;
|
|
1829
1660
|
}
|
|
1661
|
+
applyMutationPatch(state, patch, events);
|
|
1830
1662
|
} catch (error) {
|
|
1831
1663
|
console.error('Error applying patch at index ' + patchIndex, patch, error);
|
|
1832
1664
|
throw error;
|
|
@@ -1857,71 +1689,96 @@ const focusElement = $Element => {
|
|
|
1857
1689
|
preventScroll: true
|
|
1858
1690
|
});
|
|
1859
1691
|
};
|
|
1860
|
-
const
|
|
1861
|
-
startIgnore();
|
|
1862
|
-
const oldLeft = $Viewlet.style.left;
|
|
1863
|
-
const oldTop = $Viewlet.style.top;
|
|
1864
|
-
const oldWidth = $Viewlet.style.width;
|
|
1865
|
-
const oldHeight = $Viewlet.style.height;
|
|
1866
|
-
const activeElement = getActiveElementInside($Viewlet);
|
|
1867
|
-
const isTreeFocused = activeElement?.getAttribute('role') === 'tree';
|
|
1868
|
-
const isRootTree = $Viewlet.getAttribute('role') === 'tree' && activeElement === $Viewlet;
|
|
1869
|
-
const focused = activeElement?.getAttribute('name');
|
|
1870
|
-
const $Hidden = document.createElement('div');
|
|
1871
|
-
$Hidden.style.display = 'none';
|
|
1872
|
-
if (focused) {
|
|
1873
|
-
if (document.body) {
|
|
1874
|
-
document.body.append($Hidden);
|
|
1875
|
-
}
|
|
1876
|
-
// @ts-ignore
|
|
1877
|
-
$Hidden.append(activeElement);
|
|
1878
|
-
}
|
|
1692
|
+
const getInputMap = $Viewlet => {
|
|
1879
1693
|
const $$Inputs = queryInputs($Viewlet);
|
|
1880
1694
|
const inputMap = Object.create(null);
|
|
1881
1695
|
for (const $Input of $$Inputs) {
|
|
1882
1696
|
inputMap[$Input.name] = $Input.value;
|
|
1883
1697
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
$Viewlet.replaceWith($New);
|
|
1893
|
-
if (focused) {
|
|
1894
|
-
const $NewFocused = $New.querySelector(`[name="${focused}"]`);
|
|
1895
|
-
if ($NewFocused) {
|
|
1896
|
-
const $Previous = $Hidden.firstChild;
|
|
1897
|
-
$Previous.className = $NewFocused.className;
|
|
1898
|
-
$Previous.placeholder = $NewFocused.placeholder;
|
|
1899
|
-
if ($NewFocused.childNodes) {
|
|
1900
|
-
$Previous.replaceChildren(...$NewFocused.childNodes);
|
|
1901
|
-
}
|
|
1902
|
-
$NewFocused.replaceWith($Previous);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
$Hidden.remove();
|
|
1906
|
-
$Viewlet = $New;
|
|
1907
|
-
} else {
|
|
1908
|
-
renderInto($Viewlet, dom, eventMap);
|
|
1698
|
+
return inputMap;
|
|
1699
|
+
};
|
|
1700
|
+
const createHiddenContainer = (activeElement, focused) => {
|
|
1701
|
+
const $Hidden = document.createElement('div');
|
|
1702
|
+
$Hidden.style.display = 'none';
|
|
1703
|
+
if (focused && activeElement && document.body) {
|
|
1704
|
+
document.body.append($Hidden);
|
|
1705
|
+
$Hidden.append(activeElement);
|
|
1909
1706
|
}
|
|
1707
|
+
return $Hidden;
|
|
1708
|
+
};
|
|
1709
|
+
const restoreFocusedElement = ($Hidden, $New, focused) => {
|
|
1710
|
+
const $NewFocused = $New.querySelector(`[name="${focused}"]`);
|
|
1711
|
+
if (!$NewFocused) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
const $Previous = $Hidden.firstChild;
|
|
1715
|
+
if (!$Previous) {
|
|
1716
|
+
return;
|
|
1717
|
+
}
|
|
1718
|
+
$Previous.className = $NewFocused.className;
|
|
1719
|
+
$Previous.placeholder = $NewFocused.placeholder;
|
|
1720
|
+
if ($NewFocused.childNodes) {
|
|
1721
|
+
$Previous.replaceChildren(...$NewFocused.childNodes);
|
|
1722
|
+
}
|
|
1723
|
+
$NewFocused.replaceWith($Previous);
|
|
1724
|
+
};
|
|
1725
|
+
const renderWithUid = ($Viewlet, dom, eventMap, uid, inputMap, focused, $Hidden) => {
|
|
1726
|
+
const newEventMap = getEventListenerMap(uid);
|
|
1727
|
+
const $New = render(dom, eventMap, newEventMap).firstChild;
|
|
1728
|
+
setComponentUid($New, uid);
|
|
1729
|
+
const $$NewInputs = queryInputs($New);
|
|
1730
|
+
for (const $Input of $$NewInputs) {
|
|
1731
|
+
$Input.value = inputMap[$Input.name] || $Input.value || '';
|
|
1732
|
+
}
|
|
1733
|
+
$Viewlet.replaceWith($New);
|
|
1734
|
+
if (focused) {
|
|
1735
|
+
restoreFocusedElement($Hidden, $New, focused);
|
|
1736
|
+
}
|
|
1737
|
+
return $New;
|
|
1738
|
+
};
|
|
1739
|
+
const restoreFocus = ($Viewlet, isRootTree, isTreeFocused, focused) => {
|
|
1910
1740
|
if (isRootTree) {
|
|
1911
1741
|
focusElement($Viewlet);
|
|
1912
|
-
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
if (isTreeFocused) {
|
|
1913
1745
|
const $Tree = $Viewlet.querySelector('[role="tree"]');
|
|
1914
1746
|
if ($Tree) {
|
|
1915
1747
|
// @ts-ignore
|
|
1916
1748
|
focusElement($Tree);
|
|
1917
1749
|
}
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1750
|
+
return;
|
|
1751
|
+
}
|
|
1752
|
+
if (!focused) {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
|
|
1756
|
+
if ($Focused) {
|
|
1757
|
+
// @ts-ignore
|
|
1758
|
+
focusElement($Focused);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
|
|
1762
|
+
startIgnore();
|
|
1763
|
+
const oldLeft = $Viewlet.style.left;
|
|
1764
|
+
const oldTop = $Viewlet.style.top;
|
|
1765
|
+
const oldWidth = $Viewlet.style.width;
|
|
1766
|
+
const oldHeight = $Viewlet.style.height;
|
|
1767
|
+
const activeElement = getActiveElementInside($Viewlet);
|
|
1768
|
+
const isTreeFocused = activeElement?.getAttribute('role') === 'tree';
|
|
1769
|
+
const isRootTree = $Viewlet.getAttribute('role') === 'tree' && activeElement === $Viewlet;
|
|
1770
|
+
const focused = activeElement?.getAttribute('name') || null;
|
|
1771
|
+
const $Hidden = createHiddenContainer(activeElement, focused);
|
|
1772
|
+
const inputMap = getInputMap($Viewlet);
|
|
1773
|
+
if (uid) {
|
|
1774
|
+
const numericUid = Number(uid);
|
|
1775
|
+
$Viewlet = renderWithUid($Viewlet, dom, eventMap, numericUid, inputMap, focused, $Hidden);
|
|
1776
|
+
$Hidden.remove();
|
|
1777
|
+
} else {
|
|
1778
|
+
renderInto($Viewlet, dom, eventMap);
|
|
1779
|
+
$Hidden.remove();
|
|
1924
1780
|
}
|
|
1781
|
+
restoreFocus($Viewlet, isRootTree, isTreeFocused, focused);
|
|
1925
1782
|
$Viewlet.style.top = oldTop;
|
|
1926
1783
|
$Viewlet.style.left = oldLeft;
|
|
1927
1784
|
$Viewlet.style.height = oldHeight;
|
|
@@ -4799,13 +4656,35 @@ const create$Overlay = () => {
|
|
|
4799
4656
|
$TestOverlay.style.contain = 'strict';
|
|
4800
4657
|
$TestOverlay.style.userSelect = 'text';
|
|
4801
4658
|
$TestOverlay.style.color = 'black';
|
|
4659
|
+
$TestOverlay.style.display = 'flex';
|
|
4660
|
+
$TestOverlay.style.gap = '10px';
|
|
4802
4661
|
return $TestOverlay;
|
|
4803
4662
|
};
|
|
4804
|
-
const
|
|
4663
|
+
const createAction = action => {
|
|
4664
|
+
const $action = document.createElement('button');
|
|
4665
|
+
$action.textContent = action.label;
|
|
4666
|
+
$action.style.flexShrink = '0';
|
|
4667
|
+
$action.style.background = 'dodgerblue';
|
|
4668
|
+
$action.style.paddingLeft = '6px';
|
|
4669
|
+
$action.style.paddingRight = '6px';
|
|
4670
|
+
$action.style.color = 'white';
|
|
4671
|
+
$action.style.border = 'none';
|
|
4672
|
+
$action.style.borderRadius = '5px';
|
|
4673
|
+
$action.addEventListener('click', () => {
|
|
4674
|
+
send(action.command);
|
|
4675
|
+
});
|
|
4676
|
+
return $action;
|
|
4677
|
+
};
|
|
4678
|
+
const showOverlay = (state, background, text, actions = []) => {
|
|
4805
4679
|
const $TestOverlay = create$Overlay();
|
|
4806
4680
|
$TestOverlay.dataset.state = state;
|
|
4807
4681
|
$TestOverlay.style.background = background;
|
|
4808
|
-
|
|
4682
|
+
const span = document.createElement('span');
|
|
4683
|
+
span.style.flex = '1';
|
|
4684
|
+
span.style.overflow = 'hidden';
|
|
4685
|
+
span.textContent = text;
|
|
4686
|
+
const $actions = actions.map(createAction);
|
|
4687
|
+
$TestOverlay.append(span, ...$actions);
|
|
4809
4688
|
document.body.append($TestOverlay);
|
|
4810
4689
|
};
|
|
4811
4690
|
const performAction = async (locator, fnName, options) => {
|
|
@@ -9117,6 +8996,11 @@ const setUid = (viewletId, uid) => {
|
|
|
9117
8996
|
} = instance.state;
|
|
9118
8997
|
set$3($Viewlet, uid);
|
|
9119
8998
|
};
|
|
8999
|
+
const emptyFocusCallback = {
|
|
9000
|
+
id: 0,
|
|
9001
|
+
selector: ''
|
|
9002
|
+
};
|
|
9003
|
+
let focusCallback = emptyFocusCallback;
|
|
9120
9004
|
const focusSelector = (viewletId, selector) => {
|
|
9121
9005
|
const instance = get$a(viewletId);
|
|
9122
9006
|
if (!instance) {
|
|
@@ -9129,7 +9013,16 @@ const focusSelector = (viewletId, selector) => {
|
|
|
9129
9013
|
if (!$Element) {
|
|
9130
9014
|
return;
|
|
9131
9015
|
}
|
|
9132
|
-
$Element
|
|
9016
|
+
if ($Element && $Element instanceof HTMLElement) {
|
|
9017
|
+
if ($Element.isConnected) {
|
|
9018
|
+
$Element.focus();
|
|
9019
|
+
} else {
|
|
9020
|
+
focusCallback = {
|
|
9021
|
+
id: viewletId,
|
|
9022
|
+
selector
|
|
9023
|
+
};
|
|
9024
|
+
}
|
|
9025
|
+
}
|
|
9133
9026
|
};
|
|
9134
9027
|
|
|
9135
9028
|
/**
|
|
@@ -9227,6 +9120,7 @@ const setPatches = (uid, patches) => {
|
|
|
9227
9120
|
return;
|
|
9228
9121
|
}
|
|
9229
9122
|
applyPatch($Viewlet, patches, {}, uid);
|
|
9123
|
+
applyLateFocusMaybe();
|
|
9230
9124
|
};
|
|
9231
9125
|
const waitForElement = selector => {
|
|
9232
9126
|
const element = document.querySelector(selector);
|
|
@@ -9408,6 +9302,7 @@ const append = (parentId, childId, referenceNodes) => {
|
|
|
9408
9302
|
if (childInstance.factory?.postAppend) {
|
|
9409
9303
|
childInstance.factory.postAppend(childInstance.state);
|
|
9410
9304
|
}
|
|
9305
|
+
applyLateFocusMaybe();
|
|
9411
9306
|
};
|
|
9412
9307
|
const replaceChildren = (parentId, childIds) => {
|
|
9413
9308
|
const parentInstance = get$a(parentId);
|
|
@@ -9420,11 +9315,32 @@ const replaceChildren = (parentId, childIds) => {
|
|
|
9420
9315
|
}
|
|
9421
9316
|
$Parent.replaceChildren($Fragment);
|
|
9422
9317
|
};
|
|
9318
|
+
const applyLateFocusMaybe = () => {
|
|
9319
|
+
if (focusCallback !== emptyFocusCallback) {
|
|
9320
|
+
const {
|
|
9321
|
+
id,
|
|
9322
|
+
selector
|
|
9323
|
+
} = focusCallback;
|
|
9324
|
+
focusCallback = emptyFocusCallback;
|
|
9325
|
+
const instance = get$a(id);
|
|
9326
|
+
if (instance) {
|
|
9327
|
+
const {
|
|
9328
|
+
$Viewlet
|
|
9329
|
+
} = instance.state;
|
|
9330
|
+
const $Element = $Viewlet.querySelector(selector);
|
|
9331
|
+
if ($Element) {
|
|
9332
|
+
$Element.focus();
|
|
9333
|
+
focusCallback = emptyFocusCallback;
|
|
9334
|
+
}
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
};
|
|
9423
9338
|
const appendToBody = childId => {
|
|
9424
9339
|
const $Parent = document.body;
|
|
9425
9340
|
const childInstance = get$a(childId);
|
|
9426
9341
|
const $Child = childInstance.state.$Viewlet;
|
|
9427
9342
|
$Parent.append($Child);
|
|
9343
|
+
applyLateFocusMaybe();
|
|
9428
9344
|
};
|
|
9429
9345
|
const executeCommands = commands => {
|
|
9430
9346
|
for (const [command, ...args] of commands) {
|