@vue-pdf-viewer/shared 1.0.0-beta.2 → 1.0.0-beta.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/const.d.ts CHANGED
@@ -7,8 +7,8 @@ export declare const PLUGIN_ID: {
7
7
  export declare const Locales: Record<LocaleKey, Localization>;
8
8
  export declare const SYMBOL_SHARED_UI: InjectionKey<Reactive<PluginContext["shared"]["ui"]>>;
9
9
  export declare const SYMBOL_LOCALIZATION: InjectionKey<ComputedRef<Localization> | undefined>;
10
- export declare const SYMBOL_VIEWER_CORE_STATE: InjectionKey<Reactive<ViewerCoreState>>;
10
+ export declare const SYMBOL_VIEWER_CORE_STATE: InjectionKey<ViewerCoreState>;
11
11
  export declare const EVENT_ANNOTATION: typeof EventAnnotation;
12
12
  export declare const DEFAULT_HIGHLIGHT_COLORS: Record<HighlightColor, string>;
13
13
  export declare const DEFAULT_FREE_TEXT_FONT_COLORS: Record<FreeTextFontColor, string>;
14
- export declare const DEFAULT_VIEWER_CORE_STATE: Reactive<ViewerCoreState>;
14
+ export declare const DEFAULT_VIEWER_CORE_STATE: ViewerCoreState;
package/dist/const.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reactive, ref, } from "vue";
1
+ import { ref, } from "vue";
2
2
  import { EventAnnotation, FreeTextFontColor, HighlightColor, } from "./enumerators";
3
3
  import en from "./locales/en_US.json";
4
4
  import cn from "./locales/zh_CN.json";
@@ -42,12 +42,28 @@ export const DEFAULT_FREE_TEXT_FONT_COLORS = {
42
42
  [FreeTextFontColor.Yellow]: "Yellow",
43
43
  [FreeTextFontColor.Green]: "Green",
44
44
  };
45
- export const DEFAULT_VIEWER_CORE_STATE = reactive({
45
+ export const DEFAULT_VIEWER_CORE_STATE = {
46
46
  currentPageIndex: ref(0),
47
+ firstPageRotation: ref(0),
47
48
  scale: ref(1),
48
49
  isEditing: ref(false),
49
50
  rotation: ref(0),
50
51
  update: (state) => {
51
- Object.assign(DEFAULT_VIEWER_CORE_STATE, state);
52
+ if (state.currentPageIndex !== undefined) {
53
+ DEFAULT_VIEWER_CORE_STATE.currentPageIndex.value = state.currentPageIndex;
54
+ }
55
+ if (state.firstPageRotation !== undefined) {
56
+ DEFAULT_VIEWER_CORE_STATE.firstPageRotation.value =
57
+ state.firstPageRotation;
58
+ }
59
+ if (state.rotation !== undefined) {
60
+ DEFAULT_VIEWER_CORE_STATE.rotation.value = state.rotation;
61
+ }
62
+ if (state.scale !== undefined) {
63
+ DEFAULT_VIEWER_CORE_STATE.scale.value = state.scale;
64
+ }
65
+ if (state.isEditing !== undefined) {
66
+ DEFAULT_VIEWER_CORE_STATE.isEditing.value = state.isEditing;
67
+ }
52
68
  },
53
- });
69
+ };
package/dist/types.d.ts CHANGED
@@ -1,11 +1,15 @@
1
- import type { Component, ComponentInternalInstance, ComputedRef, Reactive, Ref } from "vue";
1
+ import type { Component, ComponentInternalInstance, ComputedRef, Ref } from "vue";
2
2
  export interface ViewerCoreState {
3
3
  currentPageIndex: Ref<number>;
4
+ firstPageRotation: Ref<number>;
4
5
  scale: Ref<number>;
5
6
  isEditing: Ref<boolean>;
6
7
  rotation: Ref<number>;
7
- update: (state: Partial<ViewerCoreState>) => void;
8
+ update: (state: Partial<ViewerCoreValues>) => void;
8
9
  }
10
+ export type ViewerCoreValues = {
11
+ [K in keyof Omit<ViewerCoreState, "update">]: ViewerCoreState[K] extends Ref<infer V> ? V : never;
12
+ };
9
13
  export type LocaleKey = "en_US" | "zh_CN" | "it_IT" | "pt_PT" | "th_TH" | string;
10
14
  export type Localization = {
11
15
  searchButtonTooltip: string;
@@ -122,7 +126,7 @@ export interface PluginContext {
122
126
  };
123
127
  shared: {
124
128
  localization: ComputedRef<Localization>;
125
- viewerCoreState: Reactive<ViewerCoreState>;
129
+ viewerCoreState: ViewerCoreState;
126
130
  ui: {
127
131
  AppButton?: Component;
128
132
  AppTooltip?: Component;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/shared",
3
3
  "private": false,
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",