@univerjs/slides-ui 0.25.0 → 1.0.0-alpha.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.
Files changed (38) hide show
  1. package/lib/cjs/index.js +214 -181
  2. package/lib/cjs/locale/ru-RU.js +2 -21
  3. package/lib/cjs/locale/vi-VN.js +2 -21
  4. package/lib/cjs/locale/zh-HK.js +2 -21
  5. package/lib/cjs/locale/zh-TW.js +2 -21
  6. package/lib/es/index.js +218 -183
  7. package/lib/es/locale/ru-RU.js +2 -21
  8. package/lib/es/locale/vi-VN.js +2 -21
  9. package/lib/es/locale/zh-HK.js +2 -21
  10. package/lib/es/locale/zh-TW.js +2 -21
  11. package/lib/index.css +0 -4
  12. package/lib/index.js +218 -183
  13. package/lib/locale/ru-RU.js +2 -21
  14. package/lib/locale/vi-VN.js +2 -21
  15. package/lib/locale/zh-HK.js +2 -21
  16. package/lib/locale/zh-TW.js +2 -21
  17. package/lib/types/controllers/components.controller.d.ts +24 -0
  18. package/lib/types/controllers/{slide-ui.controller.d.ts → ui.controller.d.ts} +2 -4
  19. package/lib/types/index.d.ts +1 -3
  20. package/lib/types/locale/ru-RU.d.ts +2 -2
  21. package/lib/types/locale/types.d.ts +18 -0
  22. package/lib/types/locale/vi-VN.d.ts +2 -2
  23. package/lib/types/locale/zh-HK.d.ts +2 -2
  24. package/lib/types/locale/zh-TW.d.ts +2 -2
  25. package/lib/types/menu/image.menu.d.ts +3 -2
  26. package/lib/types/menu/shape.menu.d.ts +4 -3
  27. package/lib/types/menu/text.menu.d.ts +2 -1
  28. package/lib/types/views/editor-container/EditorContainer.d.ts +1 -1
  29. package/lib/types/{components → views}/image-popup-menu/ImagePopupMenu.d.ts +1 -1
  30. package/lib/types/{components → views}/panels/ArrangePanel.d.ts +1 -1
  31. package/lib/types/{components → views}/panels/FillPanel.d.ts +1 -1
  32. package/lib/types/{components → views}/panels/TransformPanel.d.ts +1 -1
  33. package/lib/types/{components → views}/sidebar/Sidebar.d.ts +1 -1
  34. package/lib/types/{components → views}/slide-bar/SlideBar.d.ts +1 -1
  35. package/lib/umd/index.js +1 -1
  36. package/package.json +12 -12
  37. /package/lib/types/{model → models}/info-bar-model.d.ts +0 -0
  38. /package/lib/types/{components → views}/image-popup-menu/component-name.d.ts +0 -0
@@ -1,20 +1,5 @@
1
- //#region src/locale/en-US.ts
2
- /**
3
- * Copyright 2023-present DreamNum Co., Ltd.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- const locale$1 = { "slides-ui": {
1
+ //#region src/locale/zh-HK.ts
2
+ const locale = { "slides-ui": {
18
3
  append: "Append Slide",
19
4
  text: { insert: { title: "Insert Text" } },
20
5
  shape: { insert: {
@@ -55,9 +40,5 @@ const locale$1 = { "slides-ui": {
55
40
  panel: { fill: { title: "Fill Color" } }
56
41
  } };
57
42
 
58
- //#endregion
59
- //#region src/locale/zh-HK.ts
60
- const locale = locale$1;
61
-
62
43
  //#endregion
63
44
  export { locale as default };
@@ -1,20 +1,5 @@
1
- //#region src/locale/en-US.ts
2
- /**
3
- * Copyright 2023-present DreamNum Co., Ltd.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- const locale$1 = { "slides-ui": {
1
+ //#region src/locale/zh-TW.ts
2
+ const locale = { "slides-ui": {
18
3
  append: "Append Slide",
19
4
  text: { insert: { title: "Insert Text" } },
20
5
  shape: { insert: {
@@ -55,9 +40,5 @@ const locale$1 = { "slides-ui": {
55
40
  panel: { fill: { title: "Fill Color" } }
56
41
  } };
57
42
 
58
- //#endregion
59
- //#region src/locale/zh-TW.ts
60
- const locale = locale$1;
61
-
62
43
  //#endregion
63
44
  export { locale as default };
package/lib/index.css CHANGED
@@ -204,10 +204,6 @@
204
204
  line-height: 1.25rem;
205
205
  }
206
206
 
207
- .univer-leading-8 {
208
- line-height: 2rem;
209
- }
210
-
211
207
  .univer-text-gray-400 {
212
208
  color: var(--univer-gray-400);
213
209
  }
package/lib/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { CommandType, DEFAULT_EMPTY_DOCUMENT_VALUE, Direction, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, HorizontalAlign, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, RxDisposable, UniverInstanceType, VerticalAlign, WrapStrategy, createIdentifier, createInternalEditorID, debounce, generateRandomId, getColorStyle, merge, mergeOverrideWithDependencies, toDisposable } from "@univerjs/core";
1
+ import { CommandType, DEFAULT_EMPTY_DOCUMENT_VALUE, Direction, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, HorizontalAlign, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, RxDisposable, UniverInstanceType, VerticalAlign, WrapStrategy, createIdentifier, createInternalEditorID, createParagraphId, debounce, generateRandomId, getColorStyle, merge, mergeOverrideWithDependencies, toDisposable } from "@univerjs/core";
2
2
  import { DeviceInputEventType, FIX_ONE_PIXEL_BLUR_OFFSET, IRenderManagerService, ObjectType, Rect, Scene, ScrollBar, Slide, Viewport, convertTextRotation, fixLineWidthByScale, getCurrentTypeOfRenderer, pxToNum } from "@univerjs/engine-render";
3
3
  import { BasicShapes, ObjectProvider, PageElementType, SLIDE_KEY } from "@univerjs/slides";
4
4
  import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, IImageIoService, getImageSize } from "@univerjs/drawing";
5
- import { BuiltInUIPart, ComponentManager, DISABLE_AUTO_FOCUS_KEY, ICanvasPopupService, ILayoutService, ILocalFileService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, KeyCode, MenuItemType, MetaKeys, RibbonStartGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
5
+ import { BuiltInUIPart, ComponentManager, DISABLE_AUTO_FOCUS_KEY, ICanvasPopupService, ILayoutService, ILocalFileService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, RibbonStartGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
6
6
  import { Button, ColorPicker, Dropdown, InputNumber, borderClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
7
- import { AutofillDoubleIcon, BottomIcon, GraphIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, PaintBucketDoubleIcon, TextIcon, TopmostIcon } from "@univerjs/icons";
7
+ import { AddImageIcon, AutofillDoubleIcon, BottomIcon, GraphIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, PaintBucketDoubleIcon, TextIcon, TopmostIcon } from "@univerjs/icons";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { createRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
10
10
  import { DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DeleteLeftCommand, DocSelectionRenderService, IEditorService, MoveCursorOperation, MoveSelectionOperation, VIEWPORT_KEY } from "@univerjs/docs-ui";
11
11
  import { BehaviorSubject, Subject, filter, takeUntil } from "rxjs";
12
12
  import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from "@univerjs/docs";
13
13
 
14
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
14
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
15
15
  function _typeof(o) {
16
16
  "@babel/helpers - typeof";
17
17
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -22,7 +22,7 @@ function _typeof(o) {
22
22
  }
23
23
 
24
24
  //#endregion
25
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
25
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
26
26
  function toPrimitive(t, r) {
27
27
  if ("object" != _typeof(t) || !t) return t;
28
28
  var e = t[Symbol.toPrimitive];
@@ -35,14 +35,14 @@ function toPrimitive(t, r) {
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
38
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
39
39
  function toPropertyKey(t) {
40
40
  var i = toPrimitive(t, "string");
41
41
  return "symbol" == _typeof(i) ? i : i + "";
42
42
  }
43
43
 
44
44
  //#endregion
45
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
45
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
46
46
  function _defineProperty(e, r, t) {
47
47
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
48
48
  value: t,
@@ -53,7 +53,7 @@ function _defineProperty(e, r, t) {
53
53
  }
54
54
 
55
55
  //#endregion
56
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
56
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
57
57
  function __decorateParam(paramIndex, decorator) {
58
58
  return function(target, key) {
59
59
  decorator(target, key, paramIndex);
@@ -61,7 +61,7 @@ function __decorateParam(paramIndex, decorator) {
61
61
  }
62
62
 
63
63
  //#endregion
64
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
64
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
65
65
  function __decorate(decorators, target, key, desc) {
66
66
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67
67
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -524,7 +524,7 @@ const UpdateSlideElementOperation = {
524
524
  };
525
525
 
526
526
  //#endregion
527
- //#region src/components/panels/ArrangePanel.tsx
527
+ //#region src/views/panels/ArrangePanel.tsx
528
528
  function ArrangePanel$1(props) {
529
529
  const { pageId, unitId } = props;
530
530
  const localeService = useDependency(LocaleService);
@@ -621,7 +621,7 @@ function ArrangePanel$1(props) {
621
621
  }
622
622
 
623
623
  //#endregion
624
- //#region src/components/panels/FillPanel.tsx
624
+ //#region src/views/panels/FillPanel.tsx
625
625
  /**
626
626
  *
627
627
  * @param props
@@ -687,7 +687,7 @@ function ArrangePanel(props) {
687
687
  }
688
688
 
689
689
  //#endregion
690
- //#region src/components/panels/TransformPanel.tsx
690
+ //#region src/views/panels/TransformPanel.tsx
691
691
  function TransformPanel(props) {
692
692
  const { pageId, unitId } = props;
693
693
  const localeService = useDependency(LocaleService);
@@ -836,7 +836,7 @@ function TransformPanel(props) {
836
836
  }
837
837
 
838
838
  //#endregion
839
- //#region src/components/sidebar/Sidebar.tsx
839
+ //#region src/views/sidebar/Sidebar.tsx
840
840
  const COMPONENT_SLIDE_SIDEBAR = "COMPONENT_SLIDE_SIDEBAR";
841
841
  function RectSidebar() {
842
842
  var _currentSlide$getActi, _univerInstanceServic, _page$scene;
@@ -1058,84 +1058,6 @@ const SetSlidePageThumbOperation = {
1058
1058
  }
1059
1059
  };
1060
1060
 
1061
- //#endregion
1062
- //#region src/components/slide-bar/SlideBar.tsx
1063
- /**
1064
- * This components works as the root component of the left Sidebar of Slide.
1065
- */
1066
- function SlideSideBar() {
1067
- var _currentSlide$getActi, _currentSlide$getActi2;
1068
- const univerInstanceService = useDependency(IUniverInstanceService);
1069
- const commandService = useDependency(ICommandService);
1070
- const renderManagerService = useDependency(IRenderManagerService);
1071
- const localeService = useDependency(LocaleService);
1072
- const slideBarRef = useRef(null);
1073
- const currentSlide = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SLIDE);
1074
- const pages = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getPages();
1075
- const pageOrder = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getPageOrder();
1076
- if (!pages || !pageOrder) return null;
1077
- const slideList = pageOrder.map((id) => pages[id]);
1078
- const [activatePageId, setActivatePageId] = useState((_currentSlide$getActi = currentSlide === null || currentSlide === void 0 || (_currentSlide$getActi2 = currentSlide.getActivePage()) === null || _currentSlide$getActi2 === void 0 ? void 0 : _currentSlide$getActi2.id) !== null && _currentSlide$getActi !== void 0 ? _currentSlide$getActi : null);
1079
- const divRefs = useMemo(() => slideList.map(() => createRef()), [slideList]);
1080
- useEffect(() => {
1081
- const subscriber = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.activePage$.subscribe((page) => {
1082
- var _page$id;
1083
- const id = (_page$id = page === null || page === void 0 ? void 0 : page.id) !== null && _page$id !== void 0 ? _page$id : null;
1084
- id && setActivatePageId(id);
1085
- });
1086
- return () => {
1087
- subscriber === null || subscriber === void 0 || subscriber.unsubscribe();
1088
- };
1089
- }, []);
1090
- useEffect(() => {
1091
- divRefs.forEach((ref, index) => {
1092
- if (ref.current) {
1093
- var _renderManagerService;
1094
- const slide = slideList[index];
1095
- (_renderManagerService = renderManagerService.getRenderById(slide.id)) === null || _renderManagerService === void 0 || _renderManagerService.engine.setContainer(ref.current);
1096
- }
1097
- });
1098
- if (divRefs.length > 0) commandService.syncExecuteCommand(SetSlidePageThumbOperation.id, { unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId() });
1099
- }, [
1100
- divRefs,
1101
- slideList,
1102
- renderManagerService,
1103
- commandService,
1104
- currentSlide
1105
- ]);
1106
- const activatePage = useCallback((page) => {
1107
- commandService.syncExecuteCommand(ActivateSlidePageOperation.id, {
1108
- id: page,
1109
- unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId()
1110
- });
1111
- }, [commandService, currentSlide]);
1112
- const handleAppendSlide = useCallback(() => {
1113
- commandService.syncExecuteCommand(AppendSlideOperation.id, { unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId() });
1114
- }, [commandService, currentSlide]);
1115
- return /* @__PURE__ */ jsx("aside", {
1116
- ref: slideBarRef,
1117
- className: clsx("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden", scrollbarClassName),
1118
- children: /* @__PURE__ */ jsxs("div", {
1119
- className: "univer-px-4",
1120
- children: [/* @__PURE__ */ jsx("header", {
1121
- className: "univer-flex univer-justify-center univer-pt-4",
1122
- children: /* @__PURE__ */ jsx("a", {
1123
- className: clsx("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8 univer-transition-colors", borderClassName),
1124
- onClick: handleAppendSlide,
1125
- children: localeService.t("slides-ui.append")
1126
- })
1127
- }), slideList.map((item, index) => /* @__PURE__ */ jsxs("div", {
1128
- className: clsx("univer-my-4 univer-flex univer-gap-2", { "[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600": item.id === activatePageId }),
1129
- onClick: () => activatePage(item.id),
1130
- children: [/* @__PURE__ */ jsx("span", { children: index + 1 }), /* @__PURE__ */ jsx("div", {
1131
- ref: divRefs[index],
1132
- className: clsx("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600", borderClassName)
1133
- })]
1134
- }, item.id))]
1135
- })
1136
- });
1137
- }
1138
-
1139
1061
  //#endregion
1140
1062
  //#region src/const.ts
1141
1063
  /**
@@ -1163,79 +1085,6 @@ const SetTextEditArrowOperation = {
1163
1085
  handler: () => true
1164
1086
  };
1165
1087
 
1166
- //#endregion
1167
- //#region src/components/image-popup-menu/component-name.ts
1168
- /**
1169
- * Copyright 2023-present DreamNum Co., Ltd.
1170
- *
1171
- * Licensed under the Apache License, Version 2.0 (the "License");
1172
- * you may not use this file except in compliance with the License.
1173
- * You may obtain a copy of the License at
1174
- *
1175
- * http://www.apache.org/licenses/LICENSE-2.0
1176
- *
1177
- * Unless required by applicable law or agreed to in writing, software
1178
- * distributed under the License is distributed on an "AS IS" BASIS,
1179
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1180
- * See the License for the specific language governing permissions and
1181
- * limitations under the License.
1182
- */
1183
- const COMPONENT_SLIDE_IMAGE_POPUP_MENU = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
1184
-
1185
- //#endregion
1186
- //#region src/components/image-popup-menu/ImagePopupMenu.tsx
1187
- function SlideImagePopupMenu(props) {
1188
- var _props$popup;
1189
- const menuItems = (_props$popup = props.popup) === null || _props$popup === void 0 || (_props$popup = _props$popup.extraProps) === null || _props$popup === void 0 ? void 0 : _props$popup.menuItems;
1190
- if (!menuItems) return null;
1191
- const commandService = useDependency(ICommandService);
1192
- const localeService = useDependency(LocaleService);
1193
- const [visible, setVisible] = useState(false);
1194
- const [isHovered, setHovered] = useState(false);
1195
- const handleMouseEnter = () => {
1196
- setHovered(true);
1197
- };
1198
- const handleMouseLeave = () => {
1199
- setHovered(false);
1200
- };
1201
- const onVisibleChange = (visible) => {
1202
- setVisible(visible);
1203
- };
1204
- const handleClick = (item) => {
1205
- commandService.executeCommand(item.commandId, item.commandParams);
1206
- setVisible(false);
1207
- };
1208
- const showMore = visible || isHovered;
1209
- const availableMenu = menuItems.filter((item) => !item.disable);
1210
- return /* @__PURE__ */ jsx("div", {
1211
- onMouseEnter: handleMouseEnter,
1212
- onMouseLeave: handleMouseLeave,
1213
- children: /* @__PURE__ */ jsx(Dropdown, {
1214
- align: "start",
1215
- overlay: /* @__PURE__ */ jsx("ul", {
1216
- className: clsx("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg", borderClassName),
1217
- children: availableMenu.map((item) => /* @__PURE__ */ jsx("li", {
1218
- className: "univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",
1219
- onClick: () => handleClick(item),
1220
- children: /* @__PURE__ */ jsx("span", {
1221
- className: "univer-px-2 univer-py-1.5 univer-align-middle",
1222
- children: localeService.t(item.label)
1223
- })
1224
- }, item.index))
1225
- }),
1226
- open: visible,
1227
- onOpenChange: onVisibleChange,
1228
- children: /* @__PURE__ */ jsxs("div", {
1229
- className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
1230
- "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
1231
- "univer-bg-white dark:!univer-bg-gray-900": !visible
1232
- }),
1233
- children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
1234
- })
1235
- })
1236
- });
1237
- }
1238
-
1239
1088
  //#endregion
1240
1089
  //#region src/menu/image.menu.ts
1241
1090
  const SLIDES_IMAGE_MENU_ID = "slide.menu.image";
@@ -1389,7 +1238,7 @@ function SlideEditorContainer() {
1389
1238
  const editorService = useDependency(IEditorService);
1390
1239
  const contextService = useDependency(IContextService);
1391
1240
  const disableAutoFocus = useObservable(() => contextService.subscribeContextValue$(DISABLE_AUTO_FOCUS_KEY), false, void 0, [contextService, DISABLE_AUTO_FOCUS_KEY]);
1392
- `${DEFAULT_EMPTY_DOCUMENT_VALUE}`, DocumentFlavor.UNSPECIFIED;
1241
+ `${DEFAULT_EMPTY_DOCUMENT_VALUE}`, createParagraphId(/* @__PURE__ */ new Set()), DocumentFlavor.UNSPECIFIED;
1393
1242
  useEffect(() => {
1394
1243
  slideEditorManagerService.state$.subscribe((param) => {
1395
1244
  if (param == null) return;
@@ -1428,6 +1277,84 @@ function SlideEditorContainer() {
1428
1277
  });
1429
1278
  }
1430
1279
 
1280
+ //#endregion
1281
+ //#region src/views/slide-bar/SlideBar.tsx
1282
+ /**
1283
+ * This components works as the root component of the left Sidebar of Slide.
1284
+ */
1285
+ function SlideSideBar() {
1286
+ var _currentSlide$getActi, _currentSlide$getActi2;
1287
+ const univerInstanceService = useDependency(IUniverInstanceService);
1288
+ const commandService = useDependency(ICommandService);
1289
+ const renderManagerService = useDependency(IRenderManagerService);
1290
+ const localeService = useDependency(LocaleService);
1291
+ const slideBarRef = useRef(null);
1292
+ const currentSlide = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SLIDE);
1293
+ const pages = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getPages();
1294
+ const pageOrder = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getPageOrder();
1295
+ if (!pages || !pageOrder) return null;
1296
+ const slideList = pageOrder.map((id) => pages[id]);
1297
+ const [activatePageId, setActivatePageId] = useState((_currentSlide$getActi = currentSlide === null || currentSlide === void 0 || (_currentSlide$getActi2 = currentSlide.getActivePage()) === null || _currentSlide$getActi2 === void 0 ? void 0 : _currentSlide$getActi2.id) !== null && _currentSlide$getActi !== void 0 ? _currentSlide$getActi : null);
1298
+ const divRefs = useMemo(() => slideList.map(() => createRef()), [slideList]);
1299
+ useEffect(() => {
1300
+ const subscriber = currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.activePage$.subscribe((page) => {
1301
+ var _page$id;
1302
+ const id = (_page$id = page === null || page === void 0 ? void 0 : page.id) !== null && _page$id !== void 0 ? _page$id : null;
1303
+ id && setActivatePageId(id);
1304
+ });
1305
+ return () => {
1306
+ subscriber === null || subscriber === void 0 || subscriber.unsubscribe();
1307
+ };
1308
+ }, []);
1309
+ useEffect(() => {
1310
+ divRefs.forEach((ref, index) => {
1311
+ if (ref.current) {
1312
+ var _renderManagerService;
1313
+ const slide = slideList[index];
1314
+ (_renderManagerService = renderManagerService.getRenderById(slide.id)) === null || _renderManagerService === void 0 || _renderManagerService.engine.setContainer(ref.current);
1315
+ }
1316
+ });
1317
+ if (divRefs.length > 0) commandService.syncExecuteCommand(SetSlidePageThumbOperation.id, { unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId() });
1318
+ }, [
1319
+ divRefs,
1320
+ slideList,
1321
+ renderManagerService,
1322
+ commandService,
1323
+ currentSlide
1324
+ ]);
1325
+ const activatePage = useCallback((page) => {
1326
+ commandService.syncExecuteCommand(ActivateSlidePageOperation.id, {
1327
+ id: page,
1328
+ unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId()
1329
+ });
1330
+ }, [commandService, currentSlide]);
1331
+ const handleAppendSlide = useCallback(() => {
1332
+ commandService.syncExecuteCommand(AppendSlideOperation.id, { unitId: currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getUnitId() });
1333
+ }, [commandService, currentSlide]);
1334
+ return /* @__PURE__ */ jsx("aside", {
1335
+ ref: slideBarRef,
1336
+ className: clsx("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden", scrollbarClassName),
1337
+ children: /* @__PURE__ */ jsxs("div", {
1338
+ className: "univer-px-4",
1339
+ children: [/* @__PURE__ */ jsx("header", {
1340
+ className: "univer-flex univer-justify-center univer-pt-4",
1341
+ children: /* @__PURE__ */ jsx("a", {
1342
+ className: clsx("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-transition-colors", borderClassName),
1343
+ onClick: handleAppendSlide,
1344
+ children: localeService.t("slides-ui.append")
1345
+ })
1346
+ }), slideList.map((item, index) => /* @__PURE__ */ jsxs("div", {
1347
+ className: clsx("univer-my-4 univer-flex univer-gap-2", { "[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600": item.id === activatePageId }),
1348
+ onClick: () => activatePage(item.id),
1349
+ children: [/* @__PURE__ */ jsx("span", { children: index + 1 }), /* @__PURE__ */ jsx("div", {
1350
+ ref: divRefs[index],
1351
+ className: clsx("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600", borderClassName)
1352
+ })]
1353
+ }, item.id))]
1354
+ })
1355
+ });
1356
+ }
1357
+
1431
1358
  //#endregion
1432
1359
  //#region src/controllers/shortcuts/utils.ts
1433
1360
  function whenEditorActivated(contextService) {
@@ -1492,7 +1419,7 @@ const EditorDeleteLeftShortcut = {
1492
1419
  };
1493
1420
 
1494
1421
  //#endregion
1495
- //#region src/controllers/slide-ui.controller.ts
1422
+ //#region src/controllers/ui.controller.ts
1496
1423
  /**
1497
1424
  * Copyright 2023-present DreamNum Co., Ltd.
1498
1425
  *
@@ -1509,16 +1436,14 @@ const EditorDeleteLeftShortcut = {
1509
1436
  * limitations under the License.
1510
1437
  */
1511
1438
  let SlidesUIController = class SlidesUIController extends Disposable {
1512
- constructor(_injector, _menuManagerService, _componentManager, _uiPartsService, _commandService, _shortcutService) {
1439
+ constructor(_injector, _menuManagerService, _uiPartsService, _commandService, _shortcutService) {
1513
1440
  super();
1514
1441
  this._injector = _injector;
1515
1442
  this._menuManagerService = _menuManagerService;
1516
- this._componentManager = _componentManager;
1517
1443
  this._uiPartsService = _uiPartsService;
1518
1444
  this._commandService = _commandService;
1519
1445
  this._shortcutService = _shortcutService;
1520
1446
  this._initCommands();
1521
- this._initCustomComponents();
1522
1447
  this._initUIComponents();
1523
1448
  this._initMenus();
1524
1449
  this._initShortcuts();
@@ -1526,13 +1451,6 @@ let SlidesUIController = class SlidesUIController extends Disposable {
1526
1451
  _initMenus() {
1527
1452
  this._menuManagerService.mergeMenu(menuSchema);
1528
1453
  }
1529
- _initCustomComponents() {
1530
- const componentManager = this._componentManager;
1531
- this.disposeWithMe(componentManager.register("TextIcon", TextIcon));
1532
- this.disposeWithMe(componentManager.register("GraphIcon", GraphIcon));
1533
- this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_IMAGE_POPUP_MENU, SlideImagePopupMenu));
1534
- this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_SIDEBAR, RectSidebar));
1535
- }
1536
1454
  _initCommands() {
1537
1455
  [
1538
1456
  AppendSlideOperation,
@@ -1564,16 +1482,15 @@ let SlidesUIController = class SlidesUIController extends Disposable {
1564
1482
  SlidesUIController = __decorate([
1565
1483
  __decorateParam(0, Inject(Injector)),
1566
1484
  __decorateParam(1, IMenuManagerService),
1567
- __decorateParam(2, Inject(ComponentManager)),
1568
- __decorateParam(3, IUIPartsService),
1569
- __decorateParam(4, ICommandService),
1570
- __decorateParam(5, IShortcutService)
1485
+ __decorateParam(2, IUIPartsService),
1486
+ __decorateParam(3, ICommandService),
1487
+ __decorateParam(4, IShortcutService)
1571
1488
  ], SlidesUIController);
1572
1489
 
1573
1490
  //#endregion
1574
1491
  //#region package.json
1575
1492
  var name = "@univerjs/slides-ui";
1576
- var version = "0.25.0";
1493
+ var version = "1.0.0-alpha.0";
1577
1494
 
1578
1495
  //#endregion
1579
1496
  //#region src/config/config.ts
@@ -1581,6 +1498,119 @@ const SLIDES_UI_PLUGIN_CONFIG_KEY = "slides-ui.config";
1581
1498
  const configSymbol = Symbol(SLIDES_UI_PLUGIN_CONFIG_KEY);
1582
1499
  const defaultPluginConfig = {};
1583
1500
 
1501
+ //#endregion
1502
+ //#region src/views/image-popup-menu/component-name.ts
1503
+ /**
1504
+ * Copyright 2023-present DreamNum Co., Ltd.
1505
+ *
1506
+ * Licensed under the Apache License, Version 2.0 (the "License");
1507
+ * you may not use this file except in compliance with the License.
1508
+ * You may obtain a copy of the License at
1509
+ *
1510
+ * http://www.apache.org/licenses/LICENSE-2.0
1511
+ *
1512
+ * Unless required by applicable law or agreed to in writing, software
1513
+ * distributed under the License is distributed on an "AS IS" BASIS,
1514
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
+ * See the License for the specific language governing permissions and
1516
+ * limitations under the License.
1517
+ */
1518
+ const COMPONENT_SLIDE_IMAGE_POPUP_MENU = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
1519
+
1520
+ //#endregion
1521
+ //#region src/views/image-popup-menu/ImagePopupMenu.tsx
1522
+ function SlideImagePopupMenu(props) {
1523
+ var _props$popup;
1524
+ const menuItems = (_props$popup = props.popup) === null || _props$popup === void 0 || (_props$popup = _props$popup.extraProps) === null || _props$popup === void 0 ? void 0 : _props$popup.menuItems;
1525
+ if (!menuItems) return null;
1526
+ const commandService = useDependency(ICommandService);
1527
+ const localeService = useDependency(LocaleService);
1528
+ const [visible, setVisible] = useState(false);
1529
+ const [isHovered, setHovered] = useState(false);
1530
+ const handleMouseEnter = () => {
1531
+ setHovered(true);
1532
+ };
1533
+ const handleMouseLeave = () => {
1534
+ setHovered(false);
1535
+ };
1536
+ const onVisibleChange = (visible) => {
1537
+ setVisible(visible);
1538
+ };
1539
+ const handleClick = (item) => {
1540
+ commandService.executeCommand(item.commandId, item.commandParams);
1541
+ setVisible(false);
1542
+ };
1543
+ const showMore = visible || isHovered;
1544
+ const availableMenu = menuItems.filter((item) => !item.disable);
1545
+ return /* @__PURE__ */ jsx("div", {
1546
+ onMouseEnter: handleMouseEnter,
1547
+ onMouseLeave: handleMouseLeave,
1548
+ children: /* @__PURE__ */ jsx(Dropdown, {
1549
+ align: "start",
1550
+ overlay: /* @__PURE__ */ jsx("ul", {
1551
+ className: clsx("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg", borderClassName),
1552
+ children: availableMenu.map((item) => /* @__PURE__ */ jsx("li", {
1553
+ className: "univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",
1554
+ onClick: () => handleClick(item),
1555
+ children: /* @__PURE__ */ jsx("span", {
1556
+ className: "univer-px-2 univer-py-1.5 univer-align-middle",
1557
+ children: localeService.t(item.label)
1558
+ })
1559
+ }, item.index))
1560
+ }),
1561
+ open: visible,
1562
+ onOpenChange: onVisibleChange,
1563
+ children: /* @__PURE__ */ jsxs("div", {
1564
+ className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
1565
+ "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
1566
+ "univer-bg-white dark:!univer-bg-gray-900": !visible
1567
+ }),
1568
+ children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
1569
+ })
1570
+ })
1571
+ });
1572
+ }
1573
+
1574
+ //#endregion
1575
+ //#region src/controllers/components.controller.ts
1576
+ /**
1577
+ * Copyright 2023-present DreamNum Co., Ltd.
1578
+ *
1579
+ * Licensed under the Apache License, Version 2.0 (the "License");
1580
+ * you may not use this file except in compliance with the License.
1581
+ * You may obtain a copy of the License at
1582
+ *
1583
+ * http://www.apache.org/licenses/LICENSE-2.0
1584
+ *
1585
+ * Unless required by applicable law or agreed to in writing, software
1586
+ * distributed under the License is distributed on an "AS IS" BASIS,
1587
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1588
+ * See the License for the specific language governing permissions and
1589
+ * limitations under the License.
1590
+ */
1591
+ let ComponentsController = class ComponentsController extends Disposable {
1592
+ constructor(_componentManager, _iconManager) {
1593
+ super();
1594
+ this._componentManager = _componentManager;
1595
+ this._iconManager = _iconManager;
1596
+ this._registerParts();
1597
+ this._registerIcons();
1598
+ }
1599
+ _registerParts() {
1600
+ const componentManager = this._componentManager;
1601
+ this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_IMAGE_POPUP_MENU, SlideImagePopupMenu));
1602
+ this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_SIDEBAR, RectSidebar));
1603
+ }
1604
+ _registerIcons() {
1605
+ this.disposeWithMe(this._iconManager.register({
1606
+ AddImageIcon,
1607
+ TextIcon,
1608
+ GraphIcon
1609
+ }));
1610
+ }
1611
+ };
1612
+ ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
1613
+
1584
1614
  //#endregion
1585
1615
  //#region src/services/slide-editor-bridge.service.ts
1586
1616
  const ISlideEditorBridgeService = createIdentifier("univer.slide-editor-bridge.service");
@@ -2079,7 +2109,10 @@ let SlideEditingRenderController = class SlideEditingRenderController extends Di
2079
2109
  body.textRuns[0].ed = 1;
2080
2110
  } else body.textRuns = void 0;
2081
2111
  if (body.paragraphs != null) if (body.paragraphs.length === 1) body.paragraphs[0].startIndex = 0;
2082
- else body.paragraphs = [{ startIndex: 0 }];
2112
+ else body.paragraphs = [{
2113
+ startIndex: 0,
2114
+ paragraphId: createParagraphId(/* @__PURE__ */ new Set())
2115
+ }];
2083
2116
  if (body.sectionBreaks != null) body.sectionBreaks = void 0;
2084
2117
  if (body.tables != null) body.tables = void 0;
2085
2118
  if (body.customRanges != null) body.customRanges = void 0;
@@ -2630,6 +2663,8 @@ let UniverSlidesUIPlugin = class UniverSlidesUIPlugin extends Plugin {
2630
2663
  this._configService.setConfig(SLIDES_UI_PLUGIN_CONFIG_KEY, rest);
2631
2664
  }
2632
2665
  onStarting() {
2666
+ this._injector.add([ComponentsController]);
2667
+ this._injector.get(ComponentsController);
2633
2668
  mergeOverrideWithDependencies([
2634
2669
  [SlideRenderService],
2635
2670
  [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
@@ -2682,4 +2717,4 @@ UniverSlidesUIPlugin = __decorate([
2682
2717
  ], UniverSlidesUIPlugin);
2683
2718
 
2684
2719
  //#endregion
2685
- export { ActivateSlidePageOperation, AppendSlideOperation, CanvasView, DeleteSlideElementOperation, ISlideEditorBridgeService, InsertSlideFloatImageCommand, InsertSlideShapeEllipseCommand, InsertSlideShapeEllipseOperation, InsertSlideShapeRectangleCommand, InsertSlideShapeRectangleOperation, SHAPE_MENU_ID, SLIDES_IMAGE_MENU_ID, SLIDE_EDITOR_ID, SetSlidePageThumbOperation, SlideAddTextCommand, SlideAddTextOperation, SlideCanvasPopMangerService, SlideEditorContainer, SlideSideBar, SlidesUIController, menuSchema as SlidesUIMenuSchema, UniverSlidesUIPlugin, UpdateSlideElementOperation };
2720
+ export { ActivateSlidePageOperation, AppendSlideOperation, CanvasView, DeleteSlideElementOperation, ISlideEditorBridgeService, InsertSlideFloatImageCommand, InsertSlideShapeEllipseCommand, InsertSlideShapeEllipseOperation, InsertSlideShapeRectangleCommand, InsertSlideShapeRectangleOperation, SHAPE_MENU_ID, SLIDES_IMAGE_MENU_ID, SLIDE_EDITOR_ID, SetSlidePageThumbOperation, SlideAddTextCommand, SlideAddTextOperation, SlideCanvasPopMangerService, SlidesUIController, menuSchema as SlidesUIMenuSchema, UniverSlidesUIPlugin, UpdateSlideElementOperation };
@@ -1,20 +1,5 @@
1
- //#region src/locale/en-US.ts
2
- /**
3
- * Copyright 2023-present DreamNum Co., Ltd.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- const locale$1 = { "slides-ui": {
1
+ //#region src/locale/ru-RU.ts
2
+ const locale = { "slides-ui": {
18
3
  append: "Append Slide",
19
4
  text: { insert: { title: "Insert Text" } },
20
5
  shape: { insert: {
@@ -55,9 +40,5 @@ const locale$1 = { "slides-ui": {
55
40
  panel: { fill: { title: "Fill Color" } }
56
41
  } };
57
42
 
58
- //#endregion
59
- //#region src/locale/ru-RU.ts
60
- const locale = locale$1;
61
-
62
43
  //#endregion
63
44
  export { locale as default };