@embedpdf/plugin-render 2.0.0-next.0 → 2.0.0-next.2
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=class extends e.BasePlugin{constructor(e,t,n){super(e,t),this.withForms=!1,this.withAnnotations=!1,this.withForms=(null==n?void 0:n.withForms)??!1,this.withAnnotations=(null==n?void 0:n.withAnnotations)??!1}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e)}}renderPage({pageIndex:e,options:t},n){const i=n??this.getActiveDocumentId(),o=this.coreState.core.documents[i];if(!(null==o?void 0:o.document))throw new Error(`Document ${i} not loaded`);const r=o.document.pages.find(t=>t.index===e);if(!r)throw new Error(`Page ${e} not found in document ${i}`);const s={...t??{},withForms:(null==t?void 0:t.withForms)??this.withForms,withAnnotations:(null==t?void 0:t.withAnnotations)??this.withAnnotations};return this.engine.renderPage(o.document,r,s)}renderPageRect({pageIndex:e,rect:t,options:n},i){const o=i??this.getActiveDocumentId(),r=this.coreState.core.documents[o];if(!(null==r?void 0:r.document))throw new Error(`Document ${o} not loaded`);const s=r.document.pages.find(t=>t.index===e);if(!s)throw new Error(`Page ${e} not found in document ${o}`);const d={...n??{},withForms:(null==n?void 0:n.withForms)??this.withForms,withAnnotations:(null==n?void 0:n.withAnnotations)??this.withAnnotations};return this.engine.renderPageRect(r.document,s,t,d)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};t.id="render";let n=t;const i="render",o={manifest:{id:i,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=class extends e.BasePlugin{constructor(e,t,n){super(e,t),this.withForms=!1,this.withAnnotations=!1,this.withForms=(null==n?void 0:n.withForms)??!1,this.withAnnotations=(null==n?void 0:n.withAnnotations)??!1}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e)}}renderPage({pageIndex:e,options:t},n){const i=n??this.getActiveDocumentId(),o=this.coreState.core.documents[i];if(!(null==o?void 0:o.document))throw new Error(`Document ${i} not loaded`);const r=o.document.pages.find(t=>t.index===e);if(!r)throw new Error(`Page ${e} not found in document ${i}`);const s={...t??{},withForms:(null==t?void 0:t.withForms)??this.withForms,withAnnotations:(null==t?void 0:t.withAnnotations)??this.withAnnotations};return this.engine.renderPage(o.document,r,s)}renderPageRect({pageIndex:e,rect:t,options:n},i){const o=i??this.getActiveDocumentId(),r=this.coreState.core.documents[o];if(!(null==r?void 0:r.document))throw new Error(`Document ${o} not loaded`);const s=r.document.pages.find(t=>t.index===e);if(!s)throw new Error(`Page ${e} not found in document ${o}`);const d={...n??{},withForms:(null==n?void 0:n.withForms)??this.withForms,withAnnotations:(null==n?void 0:n.withAnnotations)??this.withAnnotations};return this.engine.renderPageRect(r.document,s,t,d)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};t.id="render";let n=t;const i="render",o={manifest:{id:i,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new n(i,e,t),reducer:()=>{},initialState:{}};exports.RenderPlugin=n,exports.RenderPluginPackage=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private withForms = false;\n private withAnnotations = false;\n\n constructor(id: string, registry: PluginRegistry, config?: RenderPluginConfig) {\n super(id, registry);\n\n this.withForms = config?.withForms ?? false;\n this.withAnnotations = config?.withAnnotations ?? false;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private withForms = false;\n private withAnnotations = false;\n\n constructor(id: string, registry: PluginRegistry, config?: RenderPluginConfig) {\n super(id, registry);\n\n this.withForms = config?.withForms ?? false;\n this.withAnnotations = config?.withAnnotations ?? false;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { PluginPackage } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\nimport { RenderPlugin } from './render-plugin';\nimport { manifest, RENDER_PLUGIN_ID } from './manifest';\n\nexport const RenderPluginPackage: PluginPackage<RenderPlugin, RenderPluginConfig> = {\n manifest,\n create: (registry, config) => new RenderPlugin(RENDER_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './render-plugin';\nexport * from './types';\n"],"names":["_RenderPlugin","BasePlugin","constructor","id","registry","config","super","this","withForms","withAnnotations","buildCapability","renderPage","options","renderPageRect","forDocument","documentId","createRenderScope","pageIndex","getActiveDocumentId","coreDoc","coreState","core","documents","document","Error","page","pages","find","p","index","mergedOptions","engine","rect","initialize","_config","logger","info","destroy","RenderPlugin","RENDER_PLUGIN_ID","RenderPluginPackage","manifest","name","version","provides","requires","optional","defaultConfig","create","reducer","initialState"],"mappings":"kHAeaA,EAAN,cAA2BC,EAA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AAMsB,EAAON,EAAQI,SAASG,MAAMC,KAAMC,GAAMA,EAAEC,QAAUZ,GAC5D,IAAKQ,EACH,MAAM,IAAID,MAAM,QAAQP,2BAAmCd,KAG7D,MAAM2B,EAAgB,IAChBlB,GAAW,CAAA,EACfJ,WAAW,MAAAI,OAAA,EAAAA,EAASJ,YAAaD,KAAKC,UACtCC,iBAAiB,MAAAG,OAAA,EAAAA,EAASH,kBAAmBF,KAAKE,iBAGpD,OAAOF,KAAKwB,OAAOlB,eAAeM,EAAQI,SAAUE,EAAMO,EAAMF,EAClE,CAMA,gBAAMG,CAAWC,GACf3B,KAAK4B,OAAOC,KAAK,eAAgB,aAAc,4BACjD,CAEA,aAAMC,GACJ/B,MAAM+B,SACR,GA9FArC,EAAgBG,GAAK,SADhB,IAAMmC,EAANtC,ECZA,MAAMuC,EAAmB,SCEnBC,EAAuE,CAClFC,SDD0D,CAC1DtC,GAAIoC,EACJG,KAAM,gBACNC,QAAS,QACTC,SAAU,CAAC,UACXC,SAAU,GACVC,SAAU,GACVC,cAAe,CAAA,GCLfC,OAAQ,CAAC5C,EAAUC,IAAW,IAAIiC,EAAaC,EAAkBnC,EAAUC,GAC3E4C,QAAS,OACTC,aAAc,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private withForms = false;\n private withAnnotations = false;\n\n constructor(id: string, registry: PluginRegistry, config?: RenderPluginConfig) {\n super(id, registry);\n\n this.withForms = config?.withForms ?? false;\n this.withAnnotations = config?.withAnnotations ?? false;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private withForms = false;\n private withAnnotations = false;\n\n constructor(id: string, registry: PluginRegistry, config?: RenderPluginConfig) {\n super(id, registry);\n\n this.withForms = config?.withForms ?? false;\n this.withAnnotations = config?.withAnnotations ?? false;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.withForms,\n withAnnotations: options?.withAnnotations ?? this.withAnnotations,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { PluginPackage } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\nimport { RenderPlugin } from './render-plugin';\nimport { manifest, RENDER_PLUGIN_ID } from './manifest';\n\nexport const RenderPluginPackage: PluginPackage<RenderPlugin, RenderPluginConfig> = {\n manifest,\n create: (registry, config) => new RenderPlugin(RENDER_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './render-plugin';\nexport * from './types';\n"],"names":[],"mappings":";AAeO,MAAM,gBAAN,MAAM,sBAAqB,WAAiD;AAAA,EAMjF,YAAY,IAAY,UAA0B,QAA6B;AAC7E,UAAM,IAAI,QAAQ;AAJpB,SAAQ,YAAY;AACpB,SAAQ,kBAAkB;AAKxB,SAAK,aAAY,iCAAQ,cAAa;AACtC,SAAK,mBAAkB,iCAAQ,oBAAmB;AAAA,EACpD;AAAA;AAAA,EAIU,kBAAoC;AAC5C,WAAO;AAAA;AAAA,MAEL,YAAY,CAAC,YAA+B,KAAK,WAAW,OAAO;AAAA,MACnE,gBAAgB,CAAC,YAAmC,KAAK,eAAe,OAAO;AAAA;AAAA,MAG/E,aAAa,CAAC,eAAuB,KAAK,kBAAkB,UAAU;AAAA,IAAA;AAAA,EAE1E;AAAA;AAAA;AAAA;AAAA,EAMQ,kBAAkB,YAAiC;AACzD,WAAO;AAAA,MACL,YAAY,CAAC,YAA+B,KAAK,WAAW,SAAS,UAAU;AAAA,MAC/E,gBAAgB,CAAC,YAAmC,KAAK,eAAe,SAAS,UAAU;AAAA,IAAA;AAAA,EAE/F;AAAA;AAAA;AAAA;AAAA,EAMQ,WAAW,EAAE,WAAW,QAAA,GAA8B,YAAqB;AACjF,UAAM,KAAK,cAAc,KAAK,oBAAA;AAC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5E;AAAA,EAEA,MAAM,UAAyB;AAC7B,UAAM,QAAA;AAAA,EACR;AACF;AA/FE,cAAgB,KAAK;AADhB,IAAM,eAAN;ACZA,MAAM,mBAAmB;AAEzB,MAAM,WAA+C;AAAA,EAC1D,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU,CAAC,QAAQ;AAAA,EACnB,UAAU,CAAA;AAAA,EACV,UAAU,CAAA;AAAA,EACV,eAAe,CAAA;AACjB;ACRO,MAAM,sBAAuE;AAAA,EAClF;AAAA,EACA,QAAQ,CAAC,UAAU,WAAW,IAAI,aAAa,kBAAkB,UAAU,MAAM;AAAA,EACjF,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,cAAc,CAAA;AAChB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-render",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@embedpdf/models": "2.0.0-next.
|
|
38
|
+
"@embedpdf/models": "2.0.0-next.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^18.2.0",
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
|
-
"@embedpdf/
|
|
44
|
-
"@embedpdf/
|
|
43
|
+
"@embedpdf/build": "1.1.0",
|
|
44
|
+
"@embedpdf/core": "2.0.0-next.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"preact": "^10.26.4",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": ">=16.8.0",
|
|
50
50
|
"vue": ">=3.2.0",
|
|
51
51
|
"svelte": ">=5 <6",
|
|
52
|
-
"@embedpdf/core": "2.0.0-next.
|
|
52
|
+
"@embedpdf/core": "2.0.0-next.2"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist",
|