@embedpdf/core 1.0.11 → 1.0.12

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 (74) hide show
  1. package/dist/index.cjs +2 -1335
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +1 -585
  4. package/dist/index.js +55 -84
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/base/base-plugin.d.ts +98 -0
  7. package/dist/lib/index.d.ts +14 -0
  8. package/dist/lib/registry/plugin-registry.d.ts +100 -0
  9. package/dist/lib/store/actions.d.ts +39 -0
  10. package/dist/lib/store/index.d.ts +6 -0
  11. package/dist/lib/store/initial-state.d.ts +11 -0
  12. package/dist/lib/store/plugin-store.d.ts +48 -0
  13. package/dist/lib/store/reducer.d.ts +4 -0
  14. package/dist/lib/store/selectors.d.ts +3 -0
  15. package/dist/lib/store/store.d.ts +105 -0
  16. package/dist/lib/store/types.d.ts +28 -0
  17. package/dist/lib/types/errors.d.ts +21 -0
  18. package/dist/lib/types/plugin.d.ts +49 -0
  19. package/dist/lib/utils/dependency-resolver.d.ts +6 -0
  20. package/dist/lib/utils/event-control.d.ts +23 -0
  21. package/dist/lib/utils/eventing.d.ts +19 -0
  22. package/dist/lib/utils/math.d.ts +22 -0
  23. package/dist/lib/utils/plugin-helpers.d.ts +6 -0
  24. package/dist/lib/utils/typed-object.d.ts +12 -0
  25. package/dist/preact/adapter.d.ts +4 -0
  26. package/dist/preact/index.cjs +2 -188
  27. package/dist/preact/index.cjs.map +1 -1
  28. package/dist/preact/index.d.ts +1 -71
  29. package/dist/preact/index.js +11 -27
  30. package/dist/preact/index.js.map +1 -1
  31. package/dist/react/adapter.d.ts +2 -0
  32. package/dist/react/index.cjs +2 -188
  33. package/dist/react/index.cjs.map +1 -1
  34. package/dist/react/index.d.ts +1 -70
  35. package/dist/react/index.js +11 -28
  36. package/dist/react/index.js.map +1 -1
  37. package/dist/shared-preact/components/embed-pdf.d.ts +12 -0
  38. package/dist/shared-preact/components/index.d.ts +1 -0
  39. package/dist/shared-preact/context.d.ts +7 -0
  40. package/dist/shared-preact/hooks/index.d.ts +5 -0
  41. package/dist/shared-preact/hooks/use-capability.d.ts +16 -0
  42. package/dist/shared-preact/hooks/use-core-state.d.ts +6 -0
  43. package/dist/shared-preact/hooks/use-plugin.d.ts +16 -0
  44. package/dist/shared-preact/hooks/use-registry.d.ts +6 -0
  45. package/dist/shared-preact/hooks/use-store-state.d.ts +6 -0
  46. package/dist/shared-preact/index.d.ts +3 -0
  47. package/dist/shared-react/components/embed-pdf.d.ts +12 -0
  48. package/dist/shared-react/components/index.d.ts +1 -0
  49. package/dist/shared-react/context.d.ts +7 -0
  50. package/dist/shared-react/hooks/index.d.ts +5 -0
  51. package/dist/shared-react/hooks/use-capability.d.ts +16 -0
  52. package/dist/shared-react/hooks/use-core-state.d.ts +6 -0
  53. package/dist/shared-react/hooks/use-plugin.d.ts +16 -0
  54. package/dist/shared-react/hooks/use-registry.d.ts +6 -0
  55. package/dist/shared-react/hooks/use-store-state.d.ts +6 -0
  56. package/dist/shared-react/index.d.ts +3 -0
  57. package/dist/vue/components/embed-pdf.vue.d.ts +23 -0
  58. package/dist/vue/components/index.d.ts +1 -0
  59. package/dist/vue/composables/index.d.ts +5 -0
  60. package/dist/vue/composables/use-capability.d.ts +15 -0
  61. package/dist/vue/composables/use-core-state.d.ts +2 -0
  62. package/dist/vue/composables/use-plugin.d.ts +8 -0
  63. package/dist/vue/composables/use-registry.d.ts +1 -0
  64. package/dist/vue/composables/use-store-state.d.ts +10 -0
  65. package/dist/vue/context.d.ts +8 -0
  66. package/dist/vue/index.cjs +2 -0
  67. package/dist/vue/index.cjs.map +1 -0
  68. package/dist/vue/index.d.ts +2 -0
  69. package/dist/vue/index.js +115 -0
  70. package/dist/vue/index.js.map +1 -0
  71. package/package.json +20 -12
  72. package/dist/index.d.cts +0 -585
  73. package/dist/preact/index.d.cts +0 -71
  74. package/dist/react/index.d.cts +0 -70
@@ -1,71 +0,0 @@
1
- import * as preact from 'preact';
2
- import { ComponentChildren, h } from 'preact';
3
- import { PluginRegistry, PluginBatchRegistration, IPlugin, BasePlugin, CoreState, StoreState } from '@embedpdf/core';
4
- import { PdfEngine } from '@embedpdf/models';
5
-
6
- interface PDFContextState {
7
- registry: PluginRegistry | null;
8
- isInitializing: boolean;
9
- pluginsReady: boolean;
10
- }
11
- declare const PDFContext: preact.Context<PDFContextState>;
12
-
13
- /** @jsxImportSource preact */
14
-
15
- interface EmbedPDFProps {
16
- engine: PdfEngine;
17
- onInitialized?: (registry: PluginRegistry) => Promise<void>;
18
- plugins: PluginBatchRegistration<IPlugin<any>, any>[];
19
- children: ComponentChildren | ((state: PDFContextState) => ComponentChildren);
20
- }
21
- declare function EmbedPDF({ engine, onInitialized, plugins, children }: EmbedPDFProps): h.JSX.Element;
22
-
23
- type CapabilityState<T extends BasePlugin> = {
24
- provides: ReturnType<NonNullable<T['provides']>> | null;
25
- isLoading: boolean;
26
- ready: Promise<void>;
27
- };
28
- /**
29
- * Hook to access a plugin's capability.
30
- * @param pluginId The ID of the plugin to access
31
- * @returns The capability provided by the plugin or null during initialization
32
- * @example
33
- * // Get zoom capability
34
- * const zoom = useCapability<ZoomPlugin>(ZoomPlugin.id);
35
- */
36
- declare function useCapability<T extends BasePlugin>(pluginId: T['id']): CapabilityState<T>;
37
-
38
- /**
39
- * Hook to access the PDF registry.
40
- * @returns The PDF registry or null during initialization
41
- */
42
- declare function useRegistry(): PDFContextState;
43
-
44
- /**
45
- * Hook that provides access to the current global store state
46
- * and re-renders the component when the state changes
47
- */
48
- declare function useStoreState<T = CoreState>(): StoreState<T> | null;
49
-
50
- /**
51
- * Hook that provides access to the current core state
52
- * and re-renders the component only when the core state changes
53
- */
54
- declare function useCoreState(): CoreState | null;
55
-
56
- type PluginState<T extends BasePlugin> = {
57
- plugin: T | null;
58
- isLoading: boolean;
59
- ready: Promise<void>;
60
- };
61
- /**
62
- * Hook to access a plugin.
63
- * @param pluginId The ID of the plugin to access
64
- * @returns The plugin or null during initialization
65
- * @example
66
- * // Get zoom plugin
67
- * const zoom = usePlugin<ZoomPlugin>(ZoomPlugin.id);
68
- */
69
- declare function usePlugin<T extends BasePlugin>(pluginId: T['id']): PluginState<T>;
70
-
71
- export { EmbedPDF, PDFContext, type PDFContextState, useCapability, useCoreState, usePlugin, useRegistry, useStoreState };
@@ -1,70 +0,0 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
3
- import { PluginRegistry, PluginBatchRegistration, IPlugin, BasePlugin, CoreState, StoreState } from '@embedpdf/core';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { PdfEngine } from '@embedpdf/models';
6
-
7
- interface PDFContextState {
8
- registry: PluginRegistry | null;
9
- isInitializing: boolean;
10
- pluginsReady: boolean;
11
- }
12
- declare const PDFContext: React.Context<PDFContextState>;
13
-
14
- interface EmbedPDFProps {
15
- engine: PdfEngine;
16
- onInitialized?: (registry: PluginRegistry) => Promise<void>;
17
- plugins: PluginBatchRegistration<IPlugin<any>, any>[];
18
- children: React__default.ReactNode | ((state: PDFContextState) => React__default.ReactNode);
19
- }
20
- declare function EmbedPDF({ engine, onInitialized, plugins, children }: EmbedPDFProps): react_jsx_runtime.JSX.Element;
21
-
22
- type CapabilityState<T extends BasePlugin> = {
23
- provides: ReturnType<NonNullable<T['provides']>> | null;
24
- isLoading: boolean;
25
- ready: Promise<void>;
26
- };
27
- /**
28
- * Hook to access a plugin's capability.
29
- * @param pluginId The ID of the plugin to access
30
- * @returns The capability provided by the plugin or null during initialization
31
- * @example
32
- * // Get zoom capability
33
- * const zoom = useCapability<ZoomPlugin>(ZoomPlugin.id);
34
- */
35
- declare function useCapability<T extends BasePlugin>(pluginId: T['id']): CapabilityState<T>;
36
-
37
- /**
38
- * Hook to access the PDF registry.
39
- * @returns The PDF registry or null during initialization
40
- */
41
- declare function useRegistry(): PDFContextState;
42
-
43
- /**
44
- * Hook that provides access to the current global store state
45
- * and re-renders the component when the state changes
46
- */
47
- declare function useStoreState<T = CoreState>(): StoreState<T> | null;
48
-
49
- /**
50
- * Hook that provides access to the current core state
51
- * and re-renders the component only when the core state changes
52
- */
53
- declare function useCoreState(): CoreState | null;
54
-
55
- type PluginState<T extends BasePlugin> = {
56
- plugin: T | null;
57
- isLoading: boolean;
58
- ready: Promise<void>;
59
- };
60
- /**
61
- * Hook to access a plugin.
62
- * @param pluginId The ID of the plugin to access
63
- * @returns The plugin or null during initialization
64
- * @example
65
- * // Get zoom plugin
66
- * const zoom = usePlugin<ZoomPlugin>(ZoomPlugin.id);
67
- */
68
- declare function usePlugin<T extends BasePlugin>(pluginId: T['id']): PluginState<T>;
69
-
70
- export { EmbedPDF, PDFContext, type PDFContextState, useCapability, useCoreState, usePlugin, useRegistry, useStoreState };