@printstack/print-studio 0.1.2 → 0.1.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/README.md +8 -2
- package/assets/{render.worker-DkH7TepL.js → render.worker-Dl59Xk1a.js} +11 -11
- package/components/button-group/ButtonGroup.d.ts +1 -1
- package/core/index.d.ts +1 -0
- package/core.js +10 -10
- package/designer/facade/entities.d.ts +4 -4
- package/designer/facade/use-print-studio.d.ts +1 -1
- package/designer/stores/editor-store.d.ts +2 -2
- package/designer/stores/selection-store.d.ts +1 -1
- package/designer.js +1 -1
- package/elements/index.d.ts +2 -4
- package/{registries-sg39PGF1.js → elements-YX-XUHtf.js} +2480 -3026
- package/host-oKlYakgn.js +123 -0
- package/index.d.ts +3 -1
- package/index.js +9 -8
- package/{mount-print-designer-DnHTrBE9.js → mount-print-designer-CAqO0T0k.js} +3 -3
- package/{mount-print-preview-Bcb08lJ-.js → mount-print-preview-DgDHL3E8.js} +2 -2
- package/package.json +19 -2
- package/parser/index.d.ts +1 -1
- package/parser/registry.d.ts +8 -0
- package/parser/render-runtime.d.ts +1 -1
- package/{presets-BunYODhE.js → presets-DmCp_Doe.js} +1 -1
- package/printer.d.ts +17 -0
- package/printer.js +3 -0
- package/registries-CyjYSHA7.js +1841 -0
- package/runtime/print-renderer.d.ts +3 -2
- package/runtime/registries.d.ts +1 -0
- package/runtime.js +31 -27
- package/{studio-B3B6zI06.js → studio-DHusmJyL.js} +1035 -1032
- package/studio.d.ts +1 -1
- package/style.css +1 -1
- package/vue.d.ts +1 -1
- package/vue.js +3158 -3158
- package/document-model-Cc5RoO4j.js +0 -1283
- package/host-OAp3gFDx.js +0 -123
|
@@ -7,7 +7,7 @@ import { RegistryOptions } from './registries';
|
|
|
7
7
|
export interface PrintRendererOptions extends RegistryOptions, RuntimeConfigOptions {
|
|
8
8
|
errors?: ErrorRuntime;
|
|
9
9
|
}
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function createPrinter(options?: PrintRendererOptions): {
|
|
11
11
|
preview: (template: PrintDocument, data: Record<string, unknown>, outputOptions?: BrowserOutputOptions) => Promise<{
|
|
12
12
|
warnings: string[];
|
|
13
13
|
close(): void;
|
|
@@ -23,4 +23,5 @@ export declare function createPrintRenderer(options?: PrintRendererOptions): {
|
|
|
23
23
|
dispose: () => void;
|
|
24
24
|
errors: ErrorRuntime;
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type Printer = ReturnType<typeof createPrinter>;
|
|
27
|
+
export type PrintRenderer = Printer;
|
package/runtime/registries.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ElementDefinition, ElementRegistry } from '../core/element-registry';
|
|
2
2
|
import { DocumentParser, ParserRegistry } from '../parser/types';
|
|
3
3
|
export interface RegistryOptions {
|
|
4
|
+
builtinElements?: ElementDefinition[];
|
|
4
5
|
elements?: ElementDefinition[];
|
|
5
6
|
parsers?: DocumentParser<unknown, unknown>[];
|
|
6
7
|
}
|
package/runtime.js
CHANGED
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import { t as e } from "./cloneDeep-waBDTGc3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as t, h as n, i as r, n as i, s as a, t as o } from "./registries-CyjYSHA7.js";
|
|
3
|
+
import { t as s } from "./elements-YX-XUHtf.js";
|
|
3
4
|
// src/runtime/print-renderer.ts
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
...
|
|
7
|
-
|
|
5
|
+
function c(c = {}) {
|
|
6
|
+
let l = a(c), u = c.errors ?? t(), d = o({
|
|
7
|
+
...c,
|
|
8
|
+
builtinElements: c.elements ? [] : s
|
|
9
|
+
}), f = r({
|
|
10
|
+
...d,
|
|
11
|
+
config: () => l.rendering,
|
|
8
12
|
snapshot: e
|
|
9
|
-
}),
|
|
10
|
-
if (
|
|
13
|
+
}), p = i(), m = !1, h = n(f, p, () => {
|
|
14
|
+
if (m) throw Error("Print renderer has been disposed");
|
|
11
15
|
});
|
|
12
|
-
async function
|
|
13
|
-
if (
|
|
16
|
+
async function g(e, t) {
|
|
17
|
+
if (m) throw Error("Print renderer has been disposed");
|
|
14
18
|
try {
|
|
15
19
|
return await t();
|
|
16
20
|
} catch (t) {
|
|
17
|
-
throw await
|
|
21
|
+
throw await u.capture(t, { source: e }), t;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
|
-
function g(t, n, r, i) {
|
|
21
|
-
return h("runtime.html", () => m.toHTML(e(t), e(n), r, i));
|
|
22
|
-
}
|
|
23
24
|
function _(t, n, r, i) {
|
|
24
|
-
return
|
|
25
|
+
return g("runtime.html", () => h.toHTML(e(t), e(n), r, i));
|
|
25
26
|
}
|
|
26
|
-
function v(t, n, r) {
|
|
27
|
-
return
|
|
27
|
+
function v(t, n, r, i) {
|
|
28
|
+
return g("runtime.pdf", () => h.toPDF(e(t), e(n), r, i));
|
|
28
29
|
}
|
|
29
30
|
function y(t, n, r) {
|
|
30
|
-
return
|
|
31
|
+
return g("runtime.preview", () => h.preview(e(t), e(n), r));
|
|
32
|
+
}
|
|
33
|
+
function b(t, n, r) {
|
|
34
|
+
return g("runtime.print", () => h.print(e(t), e(n), r));
|
|
31
35
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
36
|
+
function x() {
|
|
37
|
+
m || (m = !0, f.dispose(), p.dispose());
|
|
34
38
|
}
|
|
35
39
|
return {
|
|
36
|
-
dispose:
|
|
37
|
-
errors:
|
|
38
|
-
...
|
|
39
|
-
preview:
|
|
40
|
-
print:
|
|
41
|
-
toHTML:
|
|
42
|
-
toPDF:
|
|
40
|
+
dispose: x,
|
|
41
|
+
errors: u,
|
|
42
|
+
...d,
|
|
43
|
+
preview: y,
|
|
44
|
+
print: b,
|
|
45
|
+
toHTML: _,
|
|
46
|
+
toPDF: v
|
|
43
47
|
};
|
|
44
48
|
}
|
|
45
|
-
export {
|
|
49
|
+
export { c as createPrinter };
|