@cosmicdrift/kumiko-samples 0.418.0 → 0.420.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/package.json +1 -1
- package/packages/bundled-features/package.json +11 -1
- package/packages/bundled-features/src/shared/index.ts +6 -0
- package/packages/bundled-features/src/shared/tenant-scoped-subject.ts +28 -0
- package/packages/bundled-features/src/signature/changes.json +6 -0
- package/packages/bundled-features/src/signature/feature.ts +1 -1
- package/packages/bundled-features/src/signature/grant.ts +13 -14
- package/packages/bundled-features/src/signature/png.ts +33 -12
- package/packages/bundled-features/src/template-resolver/api.ts +17 -7
- package/packages/bundled-features/src/template-resolver/changes.json +62 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +10 -9
- package/packages/bundled-features/src/template-resolver/compile-document-styles.ts +170 -0
- package/packages/bundled-features/src/template-resolver/document-frames.ts +68 -0
- package/packages/bundled-features/src/template-resolver/document-op-blocks.ts +682 -0
- package/packages/bundled-features/src/template-resolver/document-ops.ts +170 -128
- package/packages/bundled-features/src/template-resolver/document-print-only.ts +65 -0
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +53 -19
- package/packages/bundled-features/src/template-resolver/feature.ts +15 -0
- package/packages/bundled-features/src/template-resolver/handlers/apply-layout.write.ts +137 -0
- package/packages/bundled-features/src/template-resolver/handlers/create-layout.write.ts +87 -0
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +13 -8
- package/packages/bundled-features/src/template-resolver/handlers/document-region.ts +47 -0
- package/packages/bundled-features/src/template-resolver/handlers/failure-reason.ts +13 -0
- package/packages/bundled-features/src/template-resolver/handlers/import-bundle-system.write.ts +3 -0
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +17 -5
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +16 -4
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +20 -6
- package/packages/bundled-features/src/template-resolver/handlers/publish-templates.write.ts +69 -0
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +7 -0
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +15 -3
- package/packages/bundled-features/src/template-resolver/handlers/tenant-settings.ts +159 -0
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +25 -10
- package/packages/bundled-features/src/template-resolver/handlers/upsert-system.write.ts +7 -3
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +131 -18
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +10 -0
- package/packages/bundled-features/src/template-resolver/i18n.ts +3 -0
- package/packages/bundled-features/src/template-resolver/index.ts +39 -0
- package/packages/bundled-features/src/template-resolver/layout-regions.ts +54 -16
- package/packages/bundled-features/src/template-resolver/print-document.ts +3 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +4 -0
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +11 -1
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +37 -1
- package/packages/bundled-features/src/template-resolver/template-meta.ts +31 -6
- package/packages/bundled-features/src/template-resolver/template-preview.ts +29 -9
- package/packages/bundled-features/src/template-resolver/template-validation.ts +10 -3
- package/packages/bundled-features/src/template-resolver/web/constants.ts +33 -0
- package/packages/bundled-features/src/template-resolver/web/document-blocks.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +93 -25
- package/packages/bundled-features/src/template-resolver/web/document-editor-fonts.ts +13 -0
- package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +4 -1
- package/packages/bundled-features/src/template-resolver/web/document-fonts.ts +21 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-control.ts +428 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-node-view.tsx +207 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-decorations.ts +246 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-defaults.ts +59 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-style.ts +381 -0
- package/packages/bundled-features/src/template-resolver/web/document-repeat-strip.ts +80 -0
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +87 -19
- package/packages/bundled-features/src/template-resolver/web/document-style-css.ts +214 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +185 -16
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +70 -7
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +13 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +25 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +276 -23
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +449 -10
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +108 -17
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +20 -0
- package/packages/bundled-features/src/template-resolver/web/fontsource-css.d.ts +2 -0
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +32 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +38 -0
- package/packages/bundled-features/src/template-resolver/web/pdf-constants.ts +16 -0
- package/packages/bundled-features/src/template-resolver/web/placeholder-text.ts +6 -3
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +74 -5
- package/packages/bundled-features/src/tenant/company-config.ts +48 -0
- package/packages/bundled-features/src/tenant/feature.ts +11 -0
- package/packages/bundled-features/src/tenant/i18n.ts +14 -0
- package/samples/apps/ui-walkthrough/src/app/auth-constants.ts +51 -0
- package/samples/apps/ui-walkthrough/src/app/seed-print-editor-tenants.ts +118 -0
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +2 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +9 -1
- package/samples/apps/ui-walkthrough/src/app/template-seed-data.ts +27 -1
- package/samples/apps/ui-walkthrough/src/features/rental/i18n.ts +8 -0
- package/samples/apps/ui-walkthrough/src/features/rental/screens.ts +1 -0
- package/samples/apps/ui-walkthrough/src/run-config.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +236 -0
- package/samples/recipes/pdf-letterhead/README.md +23 -0
- package/samples/recipes/pdf-letterhead/package.json +12 -0
- package/samples/recipes/pdf-letterhead/src/letterhead.ts +92 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
|
+
import { parseTemplateDraft } from "../template-draft.ts";
|
|
6
|
+
import {
|
|
7
|
+
refuseTemplateEdit,
|
|
8
|
+
type TemplateEditPolicy,
|
|
9
|
+
templateEditAccess,
|
|
10
|
+
} from "../template-edit-policy.ts";
|
|
11
|
+
import { TemplateResolverErrors } from "../web/qualified-names.ts";
|
|
12
|
+
import { failureReason } from "./failure-reason.ts";
|
|
13
|
+
import { kindSchema, localeSchema, templateSlugSchema } from "./shared.ts";
|
|
14
|
+
import { changeRowStatus } from "./toggle-status.write.ts";
|
|
15
|
+
|
|
16
|
+
const MAX_PUBLISHED_TEMPLATES = 200;
|
|
17
|
+
|
|
18
|
+
const templateRefSchema = z.object({
|
|
19
|
+
slug: templateSlugSchema,
|
|
20
|
+
kind: kindSchema,
|
|
21
|
+
locale: localeSchema,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
type TemplateRef = z.infer<typeof templateRefSchema>;
|
|
25
|
+
type FailedTemplate = TemplateRef & { readonly reason: string };
|
|
26
|
+
|
|
27
|
+
export function makePublishTemplatesWrite(policy: TemplateEditPolicy) {
|
|
28
|
+
return defineWriteHandler({
|
|
29
|
+
name: "publish-templates",
|
|
30
|
+
schema: z.object({
|
|
31
|
+
templates: z.array(templateRefSchema).min(1).max(MAX_PUBLISHED_TEMPLATES),
|
|
32
|
+
}),
|
|
33
|
+
access: templateEditAccess(policy.tenantEditable),
|
|
34
|
+
description:
|
|
35
|
+
"Publishes the open drafts of several tenant templates in one call, each exactly as publish would: the same edit right per template and the same gate (unknown placeholders, unused required variables). A template that is refused or fails the gate lands in failed with the reason and does not stop the others; a template without an open draft that is already active is reported as failed with template_already_active. Returns published and failed.",
|
|
36
|
+
handler: async (event, ctx) => {
|
|
37
|
+
const published: TemplateRef[] = [];
|
|
38
|
+
const failed: FailedTemplate[] = [];
|
|
39
|
+
const seen = new Set<string>();
|
|
40
|
+
for (const ref of event.payload.templates) {
|
|
41
|
+
const key = `${ref.kind}\u0000${ref.slug}\u0000${ref.locale}`;
|
|
42
|
+
if (seen.has(key)) continue;
|
|
43
|
+
seen.add(key);
|
|
44
|
+
const refused = refuseTemplateEdit(policy, event.user, ref);
|
|
45
|
+
if (refused !== null) {
|
|
46
|
+
failed.push({ ...ref, reason: failureReason(refused) });
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const row = await fetchOne<TemplateResourceRow>(ctx.db, templateResourcesTable, {
|
|
50
|
+
tenantId: event.user.tenantId,
|
|
51
|
+
...ref,
|
|
52
|
+
});
|
|
53
|
+
if (row === undefined || row.scope !== "tenant") {
|
|
54
|
+
failed.push({ ...ref, reason: TemplateResolverErrors.notFound });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (row.status === "active" && parseTemplateDraft(row.draft) === null) {
|
|
58
|
+
failed.push({ ...ref, reason: TemplateResolverErrors.alreadyActive });
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const ownRowTarget = { db: ctx.db, scoped: null };
|
|
62
|
+
const result = await changeRowStatus(ctx, event.user, ownRowTarget, row, "active");
|
|
63
|
+
if (result.isSuccess) published.push(ref);
|
|
64
|
+
else failed.push({ ...ref, reason: failureReason(result) });
|
|
65
|
+
}
|
|
66
|
+
return { isSuccess: true as const, data: { published, failed } };
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -9,6 +9,7 @@ import * as z from "zod";
|
|
|
9
9
|
import { requireForTenant } from "../../shared/index.ts";
|
|
10
10
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
11
11
|
import {
|
|
12
|
+
refuseReservedSystemLayoutSlug,
|
|
12
13
|
refuseTemplateEdit,
|
|
13
14
|
type TemplateEditPolicy,
|
|
14
15
|
templateEditAccess,
|
|
@@ -78,6 +79,12 @@ export function makeSetWrite(policy: TemplateEditPolicy) {
|
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
const scope = tenantId === SYSTEM_TENANT_ID ? ("system" as const) : ("tenant" as const);
|
|
82
|
+
const reserved = refuseReservedSystemLayoutSlug(
|
|
83
|
+
scope,
|
|
84
|
+
{ slug: event.payload.slug, kind },
|
|
85
|
+
"slug",
|
|
86
|
+
);
|
|
87
|
+
if (reserved !== null) return reserved;
|
|
81
88
|
let content = event.payload.content;
|
|
82
89
|
if (isOneOf(UPSERT_KINDS, kind)) {
|
|
83
90
|
const gated = gateTemplateWrite(
|
|
@@ -19,6 +19,7 @@ import { requireForTenant } from "../../shared/index.ts";
|
|
|
19
19
|
import type { TemplateWriteScope } from "../layout-regions.ts";
|
|
20
20
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
21
21
|
import { activationChanges, serializeTemplateDraft } from "../template-draft.ts";
|
|
22
|
+
import { refuseReservedSystemLayoutSlug } from "../template-edit-policy.ts";
|
|
22
23
|
import { isSystemOnlyTemplate } from "../template-system-only.ts";
|
|
23
24
|
import type { TemplateValidation } from "../template-validation.ts";
|
|
24
25
|
import type { ContentFormat, TemplateKind } from "../web/constants.ts";
|
|
@@ -169,6 +170,19 @@ function versionConflictFor(
|
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
function refuseScopeViolation(
|
|
174
|
+
registry: HandlerContext["registry"],
|
|
175
|
+
scope: TemplateWriteScope,
|
|
176
|
+
tenantId: TenantId,
|
|
177
|
+
payload: TemplateRowWrite["payload"],
|
|
178
|
+
): WriteResult<never> | WriteFailure | null {
|
|
179
|
+
return (
|
|
180
|
+
refuseTenantScopeUnderSystemTenant(scope, tenantId) ??
|
|
181
|
+
refuseReservedSystemLayoutSlug(scope, payload, "slug") ??
|
|
182
|
+
refuseSystemOnlyTenantOverride(registry, scope, payload.slug, payload.kind)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
172
186
|
// Shared by every template write: validate through the one pipeline, then
|
|
173
187
|
// create or update the (tenant, slug, kind, locale) row via the event-store
|
|
174
188
|
// executor. linkedResources is never part of an update; resources are attached
|
|
@@ -177,9 +191,7 @@ export async function writeTemplateRow(
|
|
|
177
191
|
args: TemplateRowWrite,
|
|
178
192
|
): Promise<WriteResult<WrittenTemplateRow>> {
|
|
179
193
|
const { ctx, user, tenantId, scope, status, payload } = args;
|
|
180
|
-
const refused =
|
|
181
|
-
refuseTenantScopeUnderSystemTenant(scope, tenantId) ??
|
|
182
|
-
refuseSystemOnlyTenantOverride(ctx.registry, scope, payload.slug, payload.kind);
|
|
194
|
+
const refused = refuseScopeViolation(ctx.registry, scope, tenantId, payload);
|
|
183
195
|
if (refused !== null) return refused;
|
|
184
196
|
const { db, streamTenantId } = requireForTenant(ctx, tenantId);
|
|
185
197
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { HandlerContext } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { toKebab } from "@cosmicdrift/kumiko-types/kebab-case";
|
|
3
|
+
import { createTemplateResolverApi, TemplateNotFoundError, type TemplateResource } from "../api.ts";
|
|
4
|
+
import { withParsedDocument } from "../document-sanitizer.ts";
|
|
5
|
+
import { parseTemplateMeta, readPdfTemplateMeta } from "../template-meta.ts";
|
|
6
|
+
import {
|
|
7
|
+
COMPANY_PLACEHOLDERS,
|
|
8
|
+
DEFAULT_PDF_LAYOUT_SLUG,
|
|
9
|
+
DEFAULT_PDF_LAYOUT_SLUG_CONFIG_KEY,
|
|
10
|
+
FALLBACK_LOCALE,
|
|
11
|
+
} from "../web/constants.ts";
|
|
12
|
+
|
|
13
|
+
const TENANT_CONFIG_PREFIX = "tenant:config:";
|
|
14
|
+
|
|
15
|
+
export function companyConfigKey(name: string): string {
|
|
16
|
+
return `${TENANT_CONFIG_PREFIX}${toKebab(name)}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// A key only exists in the registry when its feature is mounted; reading an unregistered key
|
|
20
|
+
// through the accessor would throw instead of falling back.
|
|
21
|
+
export async function readTenantConfigText(
|
|
22
|
+
ctx: Pick<HandlerContext, "config" | "registry">,
|
|
23
|
+
qualifiedKey: string,
|
|
24
|
+
): Promise<string> {
|
|
25
|
+
if (ctx.config === undefined || ctx.registry.getConfigKey(qualifiedKey) === undefined) return "";
|
|
26
|
+
const value = await ctx.config(qualifiedKey);
|
|
27
|
+
return typeof value === "string" ? value : "";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type DefaultLayoutContext = Pick<HandlerContext, "config" | "registry"> & {
|
|
31
|
+
readonly db: Parameters<typeof createTemplateResolverApi>[0];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// A configured default that no longer resolves (archived or deleted) must not leave documents
|
|
35
|
+
// without letterhead, so it falls back to the built-in layout.
|
|
36
|
+
export type DefaultPdfLayout = {
|
|
37
|
+
readonly slug: string;
|
|
38
|
+
// Set only when the configured default was resolved to check it; the built-in fallback is not looked up here.
|
|
39
|
+
readonly resolved: TemplateResource | null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export async function resolveDefaultPdfLayout(
|
|
43
|
+
ctx: DefaultLayoutContext,
|
|
44
|
+
tenantId: string,
|
|
45
|
+
locale: string = FALLBACK_LOCALE,
|
|
46
|
+
working = false,
|
|
47
|
+
): Promise<DefaultPdfLayout> {
|
|
48
|
+
const slug = await readTenantConfigText(ctx, DEFAULT_PDF_LAYOUT_SLUG_CONFIG_KEY);
|
|
49
|
+
if (slug === "") return { slug: DEFAULT_PDF_LAYOUT_SLUG, resolved: null };
|
|
50
|
+
try {
|
|
51
|
+
const resolved = await createTemplateResolverApi(ctx.db, ctx.registry).resolveLayout({
|
|
52
|
+
tenantId,
|
|
53
|
+
slug,
|
|
54
|
+
kind: "pdf-layout",
|
|
55
|
+
locale,
|
|
56
|
+
working,
|
|
57
|
+
});
|
|
58
|
+
return { slug, resolved };
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (e instanceof TemplateNotFoundError) {
|
|
61
|
+
return { slug: DEFAULT_PDF_LAYOUT_SLUG, resolved: null };
|
|
62
|
+
}
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// A layout the document names itself wins; only without one is the tenant default resolved (once, so callers reuse it).
|
|
68
|
+
export async function effectivePdfLayout(
|
|
69
|
+
ctx: DefaultLayoutContext,
|
|
70
|
+
tenantId: string,
|
|
71
|
+
ownSlug: string | undefined,
|
|
72
|
+
locale: string = FALLBACK_LOCALE,
|
|
73
|
+
working = false,
|
|
74
|
+
): Promise<DefaultPdfLayout> {
|
|
75
|
+
if (ownSlug !== undefined) return { slug: ownSlug, resolved: null };
|
|
76
|
+
return resolveDefaultPdfLayout(ctx, tenantId, locale, working);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function defaultPdfLayoutSlug(
|
|
80
|
+
ctx: DefaultLayoutContext,
|
|
81
|
+
tenantId: string,
|
|
82
|
+
locale: string = FALLBACK_LOCALE,
|
|
83
|
+
): Promise<string> {
|
|
84
|
+
return (await resolveDefaultPdfLayout(ctx, tenantId, locale)).slug;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function isCompanyPlaceholder(name: string): boolean {
|
|
88
|
+
return COMPANY_PLACEHOLDERS.some((candidate) => candidate === name);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function companyPlaceholdersIn(html: string): readonly string[] {
|
|
92
|
+
return withParsedDocument(html, (body) => [
|
|
93
|
+
...Array.from(body.querySelectorAll("span[data-variable]")).flatMap((element) => {
|
|
94
|
+
const name = element.getAttribute("data-variable") ?? "";
|
|
95
|
+
return isCompanyPlaceholder(name) ? [name] : [];
|
|
96
|
+
}),
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// The layout the document is rendered into: its own choice, else the tenant default, else the built-in one.
|
|
101
|
+
async function layoutHtmlOf(
|
|
102
|
+
ctx: HandlerContext,
|
|
103
|
+
tenantId: string,
|
|
104
|
+
meta: unknown,
|
|
105
|
+
locale: string | undefined,
|
|
106
|
+
): Promise<string> {
|
|
107
|
+
const parsedMeta = parseTemplateMeta("document-pdf", meta);
|
|
108
|
+
const pdfMeta = parsedMeta.ok ? readPdfTemplateMeta(parsedMeta.meta) : null;
|
|
109
|
+
const effectiveLocale = locale ?? FALLBACK_LOCALE;
|
|
110
|
+
const { slug, resolved } = await effectivePdfLayout(
|
|
111
|
+
ctx,
|
|
112
|
+
tenantId,
|
|
113
|
+
pdfMeta?.layoutSlug,
|
|
114
|
+
effectiveLocale,
|
|
115
|
+
);
|
|
116
|
+
try {
|
|
117
|
+
const layout =
|
|
118
|
+
resolved ??
|
|
119
|
+
(await createTemplateResolverApi(ctx.db, ctx.registry).resolveLayout({
|
|
120
|
+
tenantId,
|
|
121
|
+
slug,
|
|
122
|
+
kind: "pdf-layout",
|
|
123
|
+
locale: effectiveLocale,
|
|
124
|
+
}));
|
|
125
|
+
return layout.content ?? "";
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (e instanceof TemplateNotFoundError) return "";
|
|
128
|
+
throw e;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Company placeholders the draft or its layout prints without the tenant having entered a value.
|
|
133
|
+
export async function emptyCompanyData(
|
|
134
|
+
ctx: HandlerContext,
|
|
135
|
+
input: {
|
|
136
|
+
readonly kind: string;
|
|
137
|
+
readonly body: string;
|
|
138
|
+
readonly meta: unknown;
|
|
139
|
+
readonly locale: string | undefined;
|
|
140
|
+
readonly tenantId: string;
|
|
141
|
+
},
|
|
142
|
+
): Promise<readonly string[]> {
|
|
143
|
+
if (input.kind !== "document-pdf" && input.kind !== "pdf-layout") return [];
|
|
144
|
+
const layoutHtml =
|
|
145
|
+
input.kind === "document-pdf"
|
|
146
|
+
? await layoutHtmlOf(ctx, input.tenantId, input.meta, input.locale)
|
|
147
|
+
: "";
|
|
148
|
+
const used = new Set([
|
|
149
|
+
...companyPlaceholdersIn(input.body),
|
|
150
|
+
...companyPlaceholdersIn(layoutHtml),
|
|
151
|
+
]);
|
|
152
|
+
const empty: string[] = [];
|
|
153
|
+
for (const name of COMPANY_PLACEHOLDERS) {
|
|
154
|
+
if (!used.has(name)) continue;
|
|
155
|
+
const value = await readTenantConfigText(ctx, companyConfigKey(name));
|
|
156
|
+
if (value.trim() === "") empty.push(name);
|
|
157
|
+
}
|
|
158
|
+
return empty;
|
|
159
|
+
}
|
|
@@ -2,7 +2,9 @@ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import {
|
|
3
3
|
defineWriteHandler,
|
|
4
4
|
type HandlerContext,
|
|
5
|
+
type SessionUser,
|
|
5
6
|
SYSTEM_TENANT_ID,
|
|
7
|
+
type WriteResult,
|
|
6
8
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
9
|
import {
|
|
8
10
|
NotFoundError,
|
|
@@ -72,6 +74,28 @@ function planStatusChange(
|
|
|
72
74
|
return { ok: true, changes: { ...parseTemplateDraft(row.draft), ...activationChanges(row) } };
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
type LoadedTarget = Pick<Awaited<ReturnType<typeof loadTargetRow>>, "db" | "scoped">;
|
|
78
|
+
|
|
79
|
+
// The gated status change every publish and archive path shares.
|
|
80
|
+
export async function changeRowStatus(
|
|
81
|
+
ctx: HandlerContext,
|
|
82
|
+
user: SessionUser,
|
|
83
|
+
target: LoadedTarget,
|
|
84
|
+
row: TemplateResourceRow,
|
|
85
|
+
status: TemplateStatus,
|
|
86
|
+
): Promise<WriteResult<{ readonly id: string; readonly status: TemplateStatus }>> {
|
|
87
|
+
const plan = planStatusChange(ctx, row, status);
|
|
88
|
+
if (!plan.ok) return plan.failure;
|
|
89
|
+
const result = await executor.update(
|
|
90
|
+
{ id: row.id, version: row.version, changes: plan.changes },
|
|
91
|
+
user,
|
|
92
|
+
target.db,
|
|
93
|
+
target.scoped ? { streamTenantId: target.scoped.streamTenantId } : undefined,
|
|
94
|
+
);
|
|
95
|
+
if (!result.isSuccess) return result;
|
|
96
|
+
return { isSuccess: true, data: { id: String(row.id), status } };
|
|
97
|
+
}
|
|
98
|
+
|
|
75
99
|
function createStatusUpdateHandler(
|
|
76
100
|
policy: TemplateEditPolicy,
|
|
77
101
|
name: string,
|
|
@@ -96,16 +120,7 @@ function createStatusUpdateHandler(
|
|
|
96
120
|
const refused = refuseTemplateEdit(policy, event.user, row);
|
|
97
121
|
if (refused !== null) return refused;
|
|
98
122
|
}
|
|
99
|
-
|
|
100
|
-
if (!plan.ok) return plan.failure;
|
|
101
|
-
const result = await executor.update(
|
|
102
|
-
{ id: row.id, version: row.version, changes: plan.changes },
|
|
103
|
-
event.user,
|
|
104
|
-
db,
|
|
105
|
-
scoped ? { streamTenantId: scoped.streamTenantId } : undefined,
|
|
106
|
-
);
|
|
107
|
-
if (!result.isSuccess) return result;
|
|
108
|
-
return { isSuccess: true as const, data: { id: String(row.id), status } };
|
|
123
|
+
return changeRowStatus(ctx, event.user, { db, scoped }, row, status);
|
|
109
124
|
},
|
|
110
125
|
});
|
|
111
126
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineWriteHandler, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { refuseReservedLayoutSlug } from "../template-edit-policy.ts";
|
|
2
3
|
import { resolveTemplateVariables } from "../template-validation.ts";
|
|
3
4
|
import { upsertPayloadSchema } from "./shared.ts";
|
|
4
5
|
import { writeTemplateRow } from "./template-write.ts";
|
|
@@ -12,8 +13,10 @@ export const upsertSystemWrite = defineWriteHandler({
|
|
|
12
13
|
access: { roles: ["SystemAdmin"] },
|
|
13
14
|
description:
|
|
14
15
|
"Creates or overwrites a system-default template under the system tenant with its full variable schema (resource files go through the resource upload), active straight away with no draft stage; SystemAdmin only, since tenants shadow these defaults through upsert-tenant instead.",
|
|
15
|
-
handler: (event, ctx) =>
|
|
16
|
-
|
|
16
|
+
handler: async (event, ctx) => {
|
|
17
|
+
const refused = refuseReservedLayoutSlug(event.payload, "slug");
|
|
18
|
+
if (refused !== null) return refused;
|
|
19
|
+
return writeTemplateRow({
|
|
17
20
|
ctx,
|
|
18
21
|
user: event.user,
|
|
19
22
|
tenantId: SYSTEM_TENANT_ID,
|
|
@@ -25,5 +28,6 @@ export const upsertSystemWrite = defineWriteHandler({
|
|
|
25
28
|
event.payload.variableSchema,
|
|
26
29
|
),
|
|
27
30
|
payload: event.payload,
|
|
28
|
-
})
|
|
31
|
+
});
|
|
32
|
+
},
|
|
29
33
|
});
|
|
@@ -1,15 +1,127 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { defineQueryHandler, type HandlerContext } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
5
|
import { deliveryPolicyOf } from "../template-delivery-policy.ts";
|
|
6
|
+
import { draftViewerTenantId, parseTemplateDraft, servedVersionOf } from "../template-draft.ts";
|
|
6
7
|
import type { TemplateEditPolicy } from "../template-edit-policy.ts";
|
|
7
8
|
import { templateSlugSchema } from "../template-meta.ts";
|
|
8
9
|
import { collectTemplateUsage } from "../template-usage.ts";
|
|
9
10
|
import { TEMPLATE_KINDS } from "../web/constants.ts";
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
effectiveMailLayoutSlugs,
|
|
13
|
+
effectiveRowsOf,
|
|
14
|
+
isRowVisibleToCaller,
|
|
15
|
+
ownLayoutSlugOf,
|
|
16
|
+
} from "./overview.query.ts";
|
|
17
|
+
import { storedRecord } from "./template-gates.ts";
|
|
18
|
+
import { defaultPdfLayoutSlug } from "./tenant-settings.ts";
|
|
11
19
|
|
|
12
|
-
const
|
|
20
|
+
const USAGE_ROW_LIMIT = 5000;
|
|
21
|
+
|
|
22
|
+
export type PdfLayoutUser = {
|
|
23
|
+
readonly slug: string;
|
|
24
|
+
readonly locale: string;
|
|
25
|
+
readonly title: string;
|
|
26
|
+
readonly hasOwnLayout: boolean;
|
|
27
|
+
readonly isSystem: boolean;
|
|
28
|
+
/** "draft" when an open draft names this layout, else the served status. */
|
|
29
|
+
readonly status: "draft" | "active";
|
|
30
|
+
readonly version: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
async function visibleRowsOfKind(
|
|
34
|
+
ctx: HandlerContext,
|
|
35
|
+
policy: TemplateEditPolicy,
|
|
36
|
+
user: Parameters<typeof isRowVisibleToCaller>[1],
|
|
37
|
+
kind: "mail" | "document-pdf",
|
|
38
|
+
): Promise<TemplateResourceRow[]> {
|
|
39
|
+
const fetchedRows = await selectMany<TemplateResourceRow>(
|
|
40
|
+
ctx.db,
|
|
41
|
+
templateResourcesTable,
|
|
42
|
+
{ kind },
|
|
43
|
+
{ orderBy: { col: "id", direction: "asc" }, limit: USAGE_ROW_LIMIT + 1 },
|
|
44
|
+
);
|
|
45
|
+
if (fetchedRows.length > USAGE_ROW_LIMIT) {
|
|
46
|
+
ctx.obs.log?.warn("template usage: row limit reached, result is incomplete", {
|
|
47
|
+
limit: USAGE_ROW_LIMIT,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return fetchedRows
|
|
51
|
+
.slice(0, USAGE_ROW_LIMIT)
|
|
52
|
+
.filter((row) => isRowVisibleToCaller(policy, user, ctx.registry, row));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// An open draft lives beside the served row, so its layout choice sits in the draft's own meta.
|
|
56
|
+
function draftLayoutOf(
|
|
57
|
+
user: Parameters<typeof draftViewerTenantId>[0],
|
|
58
|
+
row: TemplateResourceRow,
|
|
59
|
+
): { readonly layoutSlug: string | null } | null {
|
|
60
|
+
if (row.tenantId !== draftViewerTenantId(user, row)) return null;
|
|
61
|
+
const draft = parseTemplateDraft(row.draft);
|
|
62
|
+
if (draft === null) return null;
|
|
63
|
+
const layoutSlug = storedRecord(draft.meta)["layoutSlug"];
|
|
64
|
+
return { layoutSlug: typeof layoutSlug === "string" ? layoutSlug : null };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function servedRowOf(
|
|
68
|
+
group: readonly TemplateResourceRow[],
|
|
69
|
+
policy: ReturnType<typeof deliveryPolicyOf>,
|
|
70
|
+
): { readonly served: TemplateResourceRow; readonly isSystem: boolean } | null {
|
|
71
|
+
const effective = effectiveRowsOf(group, policy);
|
|
72
|
+
if (effective === null || (effective.lockedOverride && effective.origin === "tenant"))
|
|
73
|
+
return null;
|
|
74
|
+
const served = effective.rows[0];
|
|
75
|
+
if (served === undefined || served.status === "archived") return null;
|
|
76
|
+
return { served, isSystem: effective.origin === "system" };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function pdfLayoutUserOf(
|
|
80
|
+
group: readonly TemplateResourceRow[],
|
|
81
|
+
layoutSlug: string,
|
|
82
|
+
defaultSlug: string,
|
|
83
|
+
policy: ReturnType<typeof deliveryPolicyOf>,
|
|
84
|
+
user: Parameters<typeof draftViewerTenantId>[0],
|
|
85
|
+
): PdfLayoutUser | null {
|
|
86
|
+
const found = servedRowOf(group, policy);
|
|
87
|
+
if (found === null) return null;
|
|
88
|
+
const { served, isSystem } = found;
|
|
89
|
+
const ownLayout = ownLayoutSlugOf(served);
|
|
90
|
+
const servedUses = (ownLayout ?? defaultSlug) === layoutSlug;
|
|
91
|
+
const draft = draftLayoutOf(user, served);
|
|
92
|
+
const draftUses = draft !== null && (draft.layoutSlug ?? defaultSlug) === layoutSlug;
|
|
93
|
+
if (!servedUses && !draftUses) return null;
|
|
94
|
+
return {
|
|
95
|
+
slug: served.slug,
|
|
96
|
+
locale: served.locale,
|
|
97
|
+
title: served.title ?? served.slug,
|
|
98
|
+
hasOwnLayout: draftUses ? draft.layoutSlug !== null : ownLayout !== null,
|
|
99
|
+
isSystem,
|
|
100
|
+
status: draftUses || served.status === "draft" ? "draft" : "active",
|
|
101
|
+
version: draftUses ? served.version : servedVersionOf(served),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// The served version of every document and locale decides: its own layout, else the tenant default.
|
|
106
|
+
// A saved draft that names the layout counts too, so a template shows up as soon as it is applied.
|
|
107
|
+
function pdfLayoutUsers(
|
|
108
|
+
rows: readonly TemplateResourceRow[],
|
|
109
|
+
layoutSlug: string,
|
|
110
|
+
defaultSlug: string,
|
|
111
|
+
policy: ReturnType<typeof deliveryPolicyOf>,
|
|
112
|
+
user: Parameters<typeof draftViewerTenantId>[0],
|
|
113
|
+
): PdfLayoutUser[] {
|
|
114
|
+
const groups = new Map<string, TemplateResourceRow[]>();
|
|
115
|
+
for (const row of rows) {
|
|
116
|
+
const key = `${row.slug}\u0000${row.locale}`;
|
|
117
|
+
groups.set(key, [...(groups.get(key) ?? []), row]);
|
|
118
|
+
}
|
|
119
|
+
const users = [...groups.values()].flatMap((group) => {
|
|
120
|
+
const layoutUser = pdfLayoutUserOf(group, layoutSlug, defaultSlug, policy, user);
|
|
121
|
+
return layoutUser === null ? [] : [layoutUser];
|
|
122
|
+
});
|
|
123
|
+
return users.sort((a, b) => a.slug.localeCompare(b.slug) || a.locale.localeCompare(b.locale));
|
|
124
|
+
}
|
|
13
125
|
|
|
14
126
|
export function makeUsageQuery(policy: TemplateEditPolicy) {
|
|
15
127
|
return defineQueryHandler({
|
|
@@ -17,24 +129,25 @@ export function makeUsageQuery(policy: TemplateEditPolicy) {
|
|
|
17
129
|
schema: z.object({ slug: templateSlugSchema, kind: z.enum(TEMPLATE_KINDS) }),
|
|
18
130
|
access: { roles: ["TenantAdmin", "SystemAdmin"] },
|
|
19
131
|
description:
|
|
20
|
-
"Lists
|
|
132
|
+
"Lists what uses one template: a mail template is used by the notification whose qualified name is its slug and that has a code template, a mail layout by every mail notification whose effective template (own override, else system) names it, or whose code meta does when no stored template exists, or that falls back to the default layout (`usedBy`); a PDF layout is used by every visible PDF template and locale whose served version names it or, naming none, falls back to it through the tenant's default PDF layout (`usedByTemplates` with slug, locale, title, `hasOwnLayout`, `isSystem`, `status` and `version`; a template whose saved draft names the layout is listed too, with status draft); use it to show what a change to a template affects.",
|
|
21
133
|
handler: async (query, ctx) => {
|
|
22
134
|
const { slug, kind } = query.payload;
|
|
23
|
-
if (kind
|
|
24
|
-
|
|
25
|
-
ctx.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
135
|
+
if (kind === "pdf-layout") {
|
|
136
|
+
const defaultSlug = await defaultPdfLayoutSlug(ctx, query.user.tenantId);
|
|
137
|
+
const rows = await visibleRowsOfKind(ctx, policy, query.user, "document-pdf");
|
|
138
|
+
return {
|
|
139
|
+
usedBy: [],
|
|
140
|
+
usedByTemplates: pdfLayoutUsers(
|
|
141
|
+
rows,
|
|
142
|
+
slug,
|
|
143
|
+
defaultSlug,
|
|
144
|
+
deliveryPolicyOf(ctx.registry),
|
|
145
|
+
query.user,
|
|
146
|
+
),
|
|
147
|
+
};
|
|
34
148
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.filter((row) => isRowVisibleToCaller(policy, query.user, ctx.registry, row));
|
|
149
|
+
if (kind !== "mail-layout") return { usedBy: collectTemplateUsage(ctx.registry, slug, kind) };
|
|
150
|
+
const visibleRows = await visibleRowsOfKind(ctx, policy, query.user, "mail");
|
|
38
151
|
return {
|
|
39
152
|
usedBy: collectTemplateUsage(
|
|
40
153
|
ctx.registry,
|
|
@@ -16,6 +16,7 @@ import { resolveTemplateVariables, systemPlaceholdersFor } from "../template-val
|
|
|
16
16
|
import type { ContentFormat, UpsertKind } from "../web/constants.ts";
|
|
17
17
|
import { contentFormatSchema, kindSchema, localeSchema, templateSlugSchema } from "./shared.ts";
|
|
18
18
|
import { evaluateTemplateWrite } from "./template-gates.ts";
|
|
19
|
+
import { emptyCompanyData } from "./tenant-settings.ts";
|
|
19
20
|
|
|
20
21
|
async function knownResourceKeys(
|
|
21
22
|
db: Parameters<typeof selectMany>[0],
|
|
@@ -116,6 +117,15 @@ export async function validateTemplateDraft(
|
|
|
116
117
|
})),
|
|
117
118
|
variables,
|
|
118
119
|
systemPlaceholders: [...systemPlaceholdersFor(kind)].sort(),
|
|
120
|
+
emptyCompanyData: [
|
|
121
|
+
...(await emptyCompanyData(ctx, {
|
|
122
|
+
kind,
|
|
123
|
+
body: payload.contentFormat === "html" ? payload.content : "",
|
|
124
|
+
meta: payload.meta,
|
|
125
|
+
locale,
|
|
126
|
+
tenantId: user.tenantId,
|
|
127
|
+
})),
|
|
128
|
+
],
|
|
119
129
|
};
|
|
120
130
|
return { response, evaluation };
|
|
121
131
|
}
|
|
@@ -22,4 +22,7 @@ export const TEMPLATE_RESOLVER_I18N: Readonly<Record<string, { readonly en: stri
|
|
|
22
22
|
[handlerTitleKey(H.resourceLinkPdf)]: { en: "Attach PDF template" },
|
|
23
23
|
[handlerTitleKey(H.sendTest)]: { en: "Send test mail" },
|
|
24
24
|
[handlerTitleKey(H.patchDraft)]: { en: "Edit template draft" },
|
|
25
|
+
[handlerTitleKey(H.applyLayout)]: { en: "Apply PDF layout" },
|
|
26
|
+
[handlerTitleKey(H.createLayout)]: { en: "Create PDF layout" },
|
|
27
|
+
[handlerTitleKey(H.publishTemplates)]: { en: "Publish several templates" },
|
|
25
28
|
};
|
|
@@ -14,6 +14,11 @@ export {
|
|
|
14
14
|
compileDocumentBodyToHandlebars,
|
|
15
15
|
toResourceDataUri,
|
|
16
16
|
} from "./compile-document-body.ts";
|
|
17
|
+
export {
|
|
18
|
+
flattenAddressSenderLine,
|
|
19
|
+
flattenFramesForPreview,
|
|
20
|
+
readTopLevelFrames,
|
|
21
|
+
} from "./document-frames.ts";
|
|
17
22
|
export {
|
|
18
23
|
type DocumentViolation,
|
|
19
24
|
type DocumentViolationCode,
|
|
@@ -34,6 +39,13 @@ export type {
|
|
|
34
39
|
OverviewUsage,
|
|
35
40
|
} from "./handlers/overview.query.ts";
|
|
36
41
|
export { localeSchema } from "./handlers/shared.ts";
|
|
42
|
+
export {
|
|
43
|
+
companyConfigKey,
|
|
44
|
+
defaultPdfLayoutSlug,
|
|
45
|
+
effectivePdfLayout,
|
|
46
|
+
readTenantConfigText,
|
|
47
|
+
resolveDefaultPdfLayout,
|
|
48
|
+
} from "./handlers/tenant-settings.ts";
|
|
37
49
|
export {
|
|
38
50
|
isHexColor,
|
|
39
51
|
type MailLayoutAppearance,
|
|
@@ -84,10 +96,12 @@ export {
|
|
|
84
96
|
type MailLayoutMeta,
|
|
85
97
|
type MailTemplateMeta,
|
|
86
98
|
type MailTone,
|
|
99
|
+
type PdfLayoutMeta,
|
|
87
100
|
type PdfTemplateMeta,
|
|
88
101
|
parseTemplateMeta,
|
|
89
102
|
pdfAttachmentFileNamePatternSchema,
|
|
90
103
|
readMailLayoutMeta,
|
|
104
|
+
readPdfLayoutMeta,
|
|
91
105
|
readPdfTemplateMeta,
|
|
92
106
|
type TemplateMeta,
|
|
93
107
|
type TemplateMetaIssue,
|
|
@@ -112,28 +126,38 @@ export {
|
|
|
112
126
|
userContentEntryEntity,
|
|
113
127
|
} from "./user-content-table.ts";
|
|
114
128
|
export {
|
|
129
|
+
COMPANY_PLACEHOLDERS,
|
|
115
130
|
CONTENT_FORMATS,
|
|
116
131
|
type ContentFormat,
|
|
117
132
|
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
118
133
|
DEFAULT_PDF_LAYOUT_SLUG,
|
|
134
|
+
DEFAULT_PDF_LAYOUT_SLUG_CONFIG_KEY,
|
|
119
135
|
DOCUMENT_HTML_KINDS,
|
|
120
136
|
type DocumentHtmlKind,
|
|
121
137
|
FALLBACK_LOCALE,
|
|
122
138
|
NON_RENDER_KINDS,
|
|
123
139
|
type NonRenderKind,
|
|
140
|
+
PDF_CORNER_MARK_INSET_MM,
|
|
141
|
+
PDF_CORNER_MARK_LEG_MM,
|
|
142
|
+
PDF_DEFAULT_FONT_SIZE_PT,
|
|
124
143
|
PDF_DEFAULT_MARGIN_MM,
|
|
144
|
+
PDF_FOLD_MARKS,
|
|
125
145
|
PDF_FOOTER_MARGIN_MM,
|
|
126
146
|
PDF_HEADER_MARGIN_MM,
|
|
127
147
|
PDF_ORIENTATIONS,
|
|
128
148
|
PDF_PAGE_FORMATS,
|
|
149
|
+
PDF_TABLE_STYLES,
|
|
150
|
+
type PdfFoldMarks,
|
|
129
151
|
type PdfOrientation,
|
|
130
152
|
type PdfPageFormat,
|
|
153
|
+
type PdfTableStyle,
|
|
131
154
|
RENDER_KINDS,
|
|
132
155
|
type RenderKind,
|
|
133
156
|
SYSTEM_TENANT_ID,
|
|
134
157
|
TEMPLATE_KINDS,
|
|
135
158
|
TEMPLATE_SCOPES,
|
|
136
159
|
TEMPLATE_STATUSES,
|
|
160
|
+
TENANT_LAYOUT_SLUG_PREFIX,
|
|
137
161
|
TEXT_BLOCK_KIND,
|
|
138
162
|
type TemplateKind,
|
|
139
163
|
type TemplateScope,
|
|
@@ -141,6 +165,13 @@ export {
|
|
|
141
165
|
UPSERT_KINDS,
|
|
142
166
|
type UpsertKind,
|
|
143
167
|
} from "./web/constants.ts";
|
|
168
|
+
export {
|
|
169
|
+
DOCUMENT_FONT_LABELS,
|
|
170
|
+
DOCUMENT_FONT_PRINT_STACKS,
|
|
171
|
+
DOCUMENT_FONTS,
|
|
172
|
+
type DocumentFont,
|
|
173
|
+
} from "./web/document-fonts.ts";
|
|
174
|
+
export type { DocumentFrameAttributes } from "./web/document-print-style.ts";
|
|
144
175
|
export {
|
|
145
176
|
DOCUMENT_CONDITION_ATTRIBUTE,
|
|
146
177
|
DOCUMENT_NODE_NAMES,
|
|
@@ -165,6 +196,14 @@ export {
|
|
|
165
196
|
isDocumentReferenceName,
|
|
166
197
|
isDocumentResourceKey,
|
|
167
198
|
} from "./web/document-schema.ts";
|
|
199
|
+
export {
|
|
200
|
+
addressParagraphCss,
|
|
201
|
+
DOCUMENT_LINE_VARIABLE,
|
|
202
|
+
documentLinePt,
|
|
203
|
+
FRAME_FLOW_GAP_MM,
|
|
204
|
+
PARAGRAPH_DEFAULT_LINE_HEIGHT,
|
|
205
|
+
SENDER_LINE_SIZE_PT,
|
|
206
|
+
} from "./web/document-style-css.ts";
|
|
168
207
|
export {
|
|
169
208
|
TEMPLATE_RESOLVER_FEATURE,
|
|
170
209
|
TemplateResolverErrors,
|