@embedpdf/plugin-ui 2.2.0 → 2.4.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/index.js CHANGED
@@ -5,8 +5,7 @@ const manifest = {
5
5
  name: "UI Plugin",
6
6
  version: "1.0.0",
7
7
  provides: ["ui"],
8
- requires: ["commands"],
9
- // Depends on commands
8
+ requires: [],
10
9
  optional: ["i18n"],
11
10
  defaultConfig: {
12
11
  schema: {
@@ -64,9 +63,9 @@ const setSidebarTab = (documentId, sidebarId, tabId) => ({
64
63
  type: SET_SIDEBAR_TAB,
65
64
  payload: { documentId, sidebarId, tabId }
66
65
  });
67
- const openModal = (documentId, modalId) => ({
66
+ const openModal = (documentId, modalId, props) => ({
68
67
  type: OPEN_MODAL,
69
- payload: { documentId, modalId }
68
+ payload: { documentId, modalId, props }
70
69
  });
71
70
  const closeModal = (documentId) => ({
72
71
  type: CLOSE_MODAL,
@@ -922,7 +921,7 @@ const _UIPlugin = class _UIPlugin extends BasePlugin {
922
921
  setActiveToolbar: (placement, slot, toolbarId, documentId) => this.setToolbarForDocument(placement, slot, toolbarId, documentId),
923
922
  setActiveSidebar: (placement, slot, sidebarId, documentId, activeTab) => this.setSidebarForDocument(placement, slot, sidebarId, documentId, activeTab),
924
923
  toggleSidebar: (placement, slot, sidebarId, documentId, activeTab) => this.toggleSidebarForDocument(placement, slot, sidebarId, documentId, activeTab),
925
- openModal: (modalId, documentId) => this.openModalForDocument(modalId, documentId),
924
+ openModal: (modalId, props, documentId) => this.openModalForDocument(modalId, props, documentId),
926
925
  openMenu: (menuId, triggeredByCommandId, triggeredByItemId, documentId) => this.openMenuForDocument(menuId, triggeredByCommandId, triggeredByItemId, documentId),
927
926
  toggleMenu: (menuId, triggeredByCommandId, triggeredByItemId, documentId) => this.toggleMenuForDocument(menuId, triggeredByCommandId, triggeredByItemId, documentId),
928
927
  // Overlay operations
@@ -973,7 +972,7 @@ const _UIPlugin = class _UIPlugin extends BasePlugin {
973
972
  setSidebarTab: (sidebarId, tabId) => this.setSidebarTabForDocument(sidebarId, tabId, documentId),
974
973
  getSidebarTab: (sidebarId) => this.getSidebarTabForDocument(sidebarId, documentId),
975
974
  // ───── Modals (with animation lifecycle) ─────
976
- openModal: (modalId) => this.openModalForDocument(modalId, documentId),
975
+ openModal: (modalId, props) => this.openModalForDocument(modalId, props, documentId),
977
976
  closeModal: () => this.closeModalForDocument(documentId),
978
977
  clearModal: () => this.clearModalForDocument(documentId),
979
978
  getActiveModal: () => this.getActiveModalForDocument(documentId),
@@ -1089,9 +1088,9 @@ const _UIPlugin = class _UIPlugin extends BasePlugin {
1089
1088
  // ─────────────────────────────────────────────────────────
1090
1089
  // Core Operations - Modals (with animation lifecycle)
1091
1090
  // ─────────────────────────────────────────────────────────
1092
- openModalForDocument(modalId, documentId) {
1091
+ openModalForDocument(modalId, props, documentId) {
1093
1092
  const id = documentId ?? this.getActiveDocumentId();
1094
- this.dispatch(openModal(id, modalId));
1093
+ this.dispatch(openModal(id, modalId, props));
1095
1094
  this.modalChanged$.emit(id, { modalId, isOpen: true });
1096
1095
  }
1097
1096
  closeModalForDocument(documentId) {
@@ -1357,7 +1356,7 @@ const uiReducer = (state = initialState, action) => {
1357
1356
  // Modal Actions (with animation lifecycle)
1358
1357
  // ─────────────────────────────────────────────────────────
1359
1358
  case OPEN_MODAL: {
1360
- const { documentId, modalId } = action.payload;
1359
+ const { documentId, modalId, props } = action.payload;
1361
1360
  const docState = state.documents[documentId] || initialDocumentState;
1362
1361
  return {
1363
1362
  ...state,
@@ -1367,7 +1366,8 @@ const uiReducer = (state = initialState, action) => {
1367
1366
  ...docState,
1368
1367
  activeModal: {
1369
1368
  modalId,
1370
- isOpen: true
1369
+ isOpen: true,
1370
+ props
1371
1371
  },
1372
1372
  openMenus: {}
1373
1373
  // Close all menus when opening modal