@cosmicdrift/kumiko-document-designer 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/dist/web/apply-layout-dialog.d.ts +7 -0
- package/dist/web/apply-layout-dialog.js +95 -0
- package/dist/web/company-data-rail.d.ts +5 -0
- package/dist/web/company-data-rail.js +51 -0
- package/dist/web/constants.d.ts +1 -0
- package/dist/web/constants.js +2 -0
- package/dist/web/default-translations.js +3 -0
- package/dist/web/frame-position.d.ts +18 -0
- package/dist/web/frame-position.js +28 -0
- package/dist/web/frame-settings-section.d.ts +13 -0
- package/dist/web/frame-settings-section.js +57 -0
- package/dist/web/i18n.js +285 -3
- package/dist/web/index.d.ts +1 -1
- package/dist/web/index.js +1 -1
- package/dist/web/layout-appearance-section.d.ts +8 -0
- package/dist/web/layout-appearance-section.js +64 -0
- package/dist/web/layout-editor-body.js +5 -2
- package/dist/web/layout-editor-logic.d.ts +3 -1
- package/dist/web/layout-editor-logic.js +15 -7
- package/dist/web/layout-editor-paper.d.ts +1 -1
- package/dist/web/layout-editor-paper.js +43 -8
- package/dist/web/layout-html.js +2 -2
- package/dist/web/layout-meta.d.ts +49 -0
- package/dist/web/layout-meta.js +155 -1
- package/dist/web/layout-rails.d.ts +7 -1
- package/dist/web/layout-rails.js +10 -5
- package/dist/web/layout-types.d.ts +2 -2
- package/dist/web/layout-usage-section.d.ts +4 -0
- package/dist/web/layout-usage-section.js +71 -0
- package/dist/web/page-canvas.d.ts +6 -3
- package/dist/web/page-canvas.js +23 -32
- package/dist/web/page-ruler.d.ts +6 -0
- package/dist/web/page-ruler.js +33 -0
- package/dist/web/paper-geometry.d.ts +72 -0
- package/dist/web/paper-geometry.js +134 -0
- package/dist/web/paper-sheet.d.ts +11 -0
- package/dist/web/paper-sheet.js +36 -0
- package/dist/web/pdf-editor-chrome.js +3 -3
- package/dist/web/pdf-editor-context.d.ts +2 -0
- package/dist/web/pdf-editor-panes.js +5 -4
- package/dist/web/pdf-editor-view.d.ts +4 -0
- package/dist/web/pdf-editor-view.js +23 -3
- package/dist/web/pdf-left-rail.d.ts +8 -0
- package/dist/web/pdf-left-rail.js +23 -3
- package/dist/web/pdf-template-editor.js +25 -2
- package/dist/web/settings-panel.d.ts +10 -2
- package/dist/web/settings-panel.js +32 -17
- package/dist/web/use-apply-layout.d.ts +28 -0
- package/dist/web/use-apply-layout.js +13 -0
- package/dist/web/use-layout-editor-state.d.ts +5 -0
- package/dist/web/use-layout-editor-state.js +38 -15
- package/dist/web/use-pdf-editor-state.d.ts +5 -0
- package/dist/web/use-pdf-editor-state.js +42 -10
- package/package.json +6 -6
- package/src/changes.json +31 -0
package/dist/web/i18n.js
CHANGED
|
@@ -58,6 +58,10 @@ export const DOCUMENT_DESIGNER_I18N = {
|
|
|
58
58
|
en: "No template uses this layout yet.",
|
|
59
59
|
de: "Noch keine Vorlage nutzt dieses Layout.",
|
|
60
60
|
},
|
|
61
|
+
"documentDesigner.usedBy.publishHint": {
|
|
62
|
+
en: "Publishing puts each listed template's whole draft live, including text changes made outside this layout.",
|
|
63
|
+
de: "Beim Veröffentlichen geht der gesamte Entwurf jeder aufgeführten Vorlage live, auch Textänderungen, die nicht aus diesem Layout stammen.",
|
|
64
|
+
},
|
|
61
65
|
"documentDesigner.overriddenBy.tenants": { en: "{active} tenants", de: "{active} Mandanten" },
|
|
62
66
|
"documentDesigner.overriddenBy.ofTotal": {
|
|
63
67
|
en: "{active} of {total} tenants",
|
|
@@ -84,12 +88,25 @@ export const DOCUMENT_DESIGNER_I18N = {
|
|
|
84
88
|
de: "Layout-Platzhalter",
|
|
85
89
|
},
|
|
86
90
|
"documentDesigner.placeholders.content": { en: "Template content", de: "Inhalt der Vorlage" },
|
|
87
|
-
"documentDesigner.placeholder.tenantName": { en: "
|
|
91
|
+
"documentDesigner.placeholder.tenantName": { en: "Company name", de: "Firmenname" },
|
|
88
92
|
"documentDesigner.placeholder.signature": { en: "Signature", de: "Signatur" },
|
|
89
93
|
"documentDesigner.placeholder.imprint": { en: "Imprint", de: "Impressum" },
|
|
90
94
|
"documentDesigner.placeholder.unsubscribeUrl": { en: "Unsubscribe link", de: "Abmeldelink" },
|
|
91
|
-
"documentDesigner.placeholder.page": { en: "Page number", de: "
|
|
92
|
-
"documentDesigner.placeholder.pages": { en: "Page count", de: "
|
|
95
|
+
"documentDesigner.placeholder.page": { en: "Page number", de: "Seite" },
|
|
96
|
+
"documentDesigner.placeholder.pages": { en: "Page count", de: "Seiten" },
|
|
97
|
+
"documentDesigner.placeholder.companyAddress": { en: "Address", de: "Anschrift" },
|
|
98
|
+
"documentDesigner.placeholder.companyPhone": { en: "Phone", de: "Telefon" },
|
|
99
|
+
"documentDesigner.placeholder.companyEmail": { en: "Email", de: "E-Mail" },
|
|
100
|
+
"documentDesigner.placeholder.companyWebsite": { en: "Website", de: "Website" },
|
|
101
|
+
"documentDesigner.placeholder.companyRegister": {
|
|
102
|
+
en: "Commercial register",
|
|
103
|
+
de: "Handelsregister",
|
|
104
|
+
},
|
|
105
|
+
"documentDesigner.placeholder.companyVatId": { en: "VAT ID", de: "USt-IdNr." },
|
|
106
|
+
"documentDesigner.placeholder.companyManagement": { en: "Management", de: "Geschäftsführung" },
|
|
107
|
+
"documentDesigner.placeholder.companyBank": { en: "Bank", de: "Bank" },
|
|
108
|
+
"documentDesigner.placeholder.companyIban": { en: "IBAN", de: "IBAN" },
|
|
109
|
+
"documentDesigner.placeholder.companyBic": { en: "BIC", de: "BIC" },
|
|
93
110
|
"documentDesigner.appearance.title": { en: "Appearance", de: "Darstellung" },
|
|
94
111
|
"documentDesigner.appearance.width": { en: "Width", de: "Breite" },
|
|
95
112
|
"documentDesigner.appearance.font": { en: "Font", de: "Schrift" },
|
|
@@ -228,6 +245,14 @@ export const DOCUMENT_DESIGNER_I18N = {
|
|
|
228
245
|
"documentDesigner.editor.region.content": { en: "Template content", de: "Inhalt der Vorlage" },
|
|
229
246
|
"documentDesigner.editor.region.signature": { en: "Signature area", de: "Signatur-Bereich" },
|
|
230
247
|
"documentDesigner.editor.region.footer": { en: "Footer", de: "Fuß" },
|
|
248
|
+
"documentDesigner.editor.region.footerColumns.one": {
|
|
249
|
+
en: "Footer · 1 column",
|
|
250
|
+
de: "Fuß · 1 Spalte",
|
|
251
|
+
},
|
|
252
|
+
"documentDesigner.editor.region.footerColumns.other": {
|
|
253
|
+
en: "Footer · {count} columns",
|
|
254
|
+
de: "Fuß · {count} Spalten",
|
|
255
|
+
},
|
|
231
256
|
"documentDesigner.editor.slot.mail": {
|
|
232
257
|
en: "The content of every mail template is inserted here. Subject and preview text come from the template.",
|
|
233
258
|
de: "Hier wird der Inhalt jeder Mail-Vorlage eingesetzt. Betreff und Vorschautext kommen aus der Vorlage.",
|
|
@@ -240,6 +265,14 @@ export const DOCUMENT_DESIGNER_I18N = {
|
|
|
240
265
|
en: "Checking the layout …",
|
|
241
266
|
de: "Layout wird geprüft …",
|
|
242
267
|
},
|
|
268
|
+
"documentDesigner.editor.footer.okMail.none": {
|
|
269
|
+
en: "Content placeholder present.",
|
|
270
|
+
de: "Inhalts-Platzhalter vorhanden.",
|
|
271
|
+
},
|
|
272
|
+
"documentDesigner.editor.footer.okPdf.none": {
|
|
273
|
+
en: "Content placeholder present.",
|
|
274
|
+
de: "Inhalts-Platzhalter vorhanden.",
|
|
275
|
+
},
|
|
243
276
|
"documentDesigner.editor.footer.okMail.one": {
|
|
244
277
|
en: "Content placeholder present. After publishing, the change applies to 1 template.",
|
|
245
278
|
de: "Inhalts-Platzhalter vorhanden. Änderung wirkt nach Veröffentlichen auf 1 Vorlage.",
|
|
@@ -873,4 +906,253 @@ export const DOCUMENT_DESIGNER_I18N = {
|
|
|
873
906
|
en: "Too many test mails, please try again later.",
|
|
874
907
|
de: "Zu viele Test-Mails, bitte später erneut versuchen.",
|
|
875
908
|
},
|
|
909
|
+
"documentDesigner.editor.frame.addressFormA": {
|
|
910
|
+
en: "Address field · DIN 5008 form A",
|
|
911
|
+
de: "Adressfeld · DIN 5008 Form A",
|
|
912
|
+
},
|
|
913
|
+
"documentDesigner.editor.frame.addressFormB": {
|
|
914
|
+
en: "Address field · DIN 5008 form B",
|
|
915
|
+
de: "Adressfeld · DIN 5008 Form B",
|
|
916
|
+
},
|
|
917
|
+
"documentDesigner.editor.frame.address": { en: "Address field", de: "Adressfeld" },
|
|
918
|
+
"documentDesigner.editor.frame.text": { en: "Text frame", de: "Textrahmen" },
|
|
919
|
+
"documentDesigner.editor.blockMenu": { en: "Building blocks", de: "Baustein" },
|
|
920
|
+
"documentDesigner.editor.block.address": { en: "Address field", de: "Adressfeld" },
|
|
921
|
+
"documentDesigner.editor.block.textFrame": { en: "Text frame", de: "Textrahmen" },
|
|
922
|
+
"documentDesigner.editor.block.columns": { en: "Columns", de: "Spalten" },
|
|
923
|
+
"documentDesigner.editor.block.address.hint": {
|
|
924
|
+
en: "Sender and recipient positioned for window envelopes",
|
|
925
|
+
de: "Absender und Empfänger an der Position fürs Fensterkuvert",
|
|
926
|
+
},
|
|
927
|
+
"documentDesigner.editor.block.textFrame.hint": {
|
|
928
|
+
en: "Freely placeable block on page 1",
|
|
929
|
+
de: "Frei platzierbarer Block auf Seite 1",
|
|
930
|
+
},
|
|
931
|
+
"documentDesigner.editor.block.columns.hint": {
|
|
932
|
+
en: "Borderless table, for header and footer in the layout",
|
|
933
|
+
de: "Randlose Tabelle, im Layout für Kopf und Fuß",
|
|
934
|
+
},
|
|
935
|
+
"documentDesigner.editor.table.repeatStrip": {
|
|
936
|
+
en: "Repeat · {name}",
|
|
937
|
+
de: "Wiederholung · {name}",
|
|
938
|
+
},
|
|
939
|
+
"documentDesigner.applyLayout.submitNone": {
|
|
940
|
+
en: "Select templates",
|
|
941
|
+
de: "Vorlagen auswählen",
|
|
942
|
+
},
|
|
943
|
+
"documentDesigner.pdf.lookFromLayout": {
|
|
944
|
+
en: "Fonts and colors come from the layout.",
|
|
945
|
+
de: "Schrift und Farben kommen aus dem Layout.",
|
|
946
|
+
},
|
|
947
|
+
"documentDesigner.editor.colorReset": { en: "Remove colour", de: "Farbe entfernen" },
|
|
948
|
+
"documentDesigner.editor.defaultSize": { en: "{value} pt", de: "{value} pt" },
|
|
949
|
+
"documentDesigner.editor.defaultLineHeight": { en: "{value}", de: "{value}" },
|
|
950
|
+
"documentDesigner.editor.defaultSpaceBefore": { en: "Before {value} pt", de: "Davor {value} pt" },
|
|
951
|
+
"documentDesigner.editor.defaultSpaceAfter": {
|
|
952
|
+
en: "Spacing {value} pt",
|
|
953
|
+
de: "Abstand {value} pt",
|
|
954
|
+
},
|
|
955
|
+
"documentDesigner.editor.font": { en: "Font", de: "Schrift" },
|
|
956
|
+
"documentDesigner.editor.fontSize": { en: "Font size (pt)", de: "Schriftgröße (pt)" },
|
|
957
|
+
"documentDesigner.editor.textColor": { en: "Text colour", de: "Textfarbe" },
|
|
958
|
+
"documentDesigner.editor.lineHeight": { en: "Line spacing", de: "Zeilenabstand" },
|
|
959
|
+
"documentDesigner.editor.spaceBefore": { en: "Space before (pt)", de: "Abstand davor (pt)" },
|
|
960
|
+
"documentDesigner.editor.spaceAfter": { en: "Space after (pt)", de: "Abstand danach (pt)" },
|
|
961
|
+
"documentDesigner.editor.lineHeightShort": { en: "Line", de: "Zeile" },
|
|
962
|
+
"documentDesigner.editor.spaceBeforeShort": { en: "Before", de: "Davor" },
|
|
963
|
+
"documentDesigner.editor.spaceAfterShort": { en: "Spacing", de: "Abstand" },
|
|
964
|
+
"documentDesigner.editor.tableBorders": { en: "Borders", de: "Rahmen" },
|
|
965
|
+
"documentDesigner.editor.cellColor": { en: "Cell colour", de: "Zellfarbe" },
|
|
966
|
+
"documentDesigner.editor.table.addColumn": { en: "Add column", de: "Spalte hinzufügen" },
|
|
967
|
+
"documentDesigner.editor.table.removeColumn": { en: "Remove column", de: "Spalte entfernen" },
|
|
968
|
+
"documentDesigner.editor.imageBleed": { en: "Full bleed", de: "Bis an den Rand" },
|
|
969
|
+
"documentDesigner.editor.imageWidth": { en: "Width (mm)", de: "Breite (mm)" },
|
|
970
|
+
"documentDesigner.editor.imageAlign.left": { en: "Left", de: "Links" },
|
|
971
|
+
"documentDesigner.editor.imageAlign.center": { en: "Centre", de: "Mitte" },
|
|
972
|
+
"documentDesigner.editor.imageAlign.right": { en: "Right", de: "Rechts" },
|
|
973
|
+
"documentDesigner.editor.divider": { en: "Divider", de: "Trennlinie" },
|
|
974
|
+
"documentDesigner.editor.dividerColor": { en: "Line colour", de: "Linienfarbe" },
|
|
975
|
+
"documentDesigner.editor.dividerWeight": { en: "Line weight (pt)", de: "Linienstärke (pt)" },
|
|
976
|
+
"documentDesigner.editor.table.addRow": { en: "Add row", de: "Zeile hinzufügen" },
|
|
977
|
+
"documentDesigner.editor.table.removeRow": { en: "Remove row", de: "Zeile entfernen" },
|
|
978
|
+
"documentDesigner.editor.placeholderTitle": { en: "Placeholder", de: "Platzhalter" },
|
|
979
|
+
"documentDesigner.editor.dateFormat": { en: "Date format", de: "Datumsformat" },
|
|
980
|
+
"documentDesigner.editor.dateFormat.short": { en: "Short", de: "Kurz" },
|
|
981
|
+
"documentDesigner.editor.dateFormat.long": { en: "Long", de: "Lang" },
|
|
982
|
+
"documentDesigner.editor.table.cellPadding": { en: "Cell padding (mm)", de: "Zellabstand (mm)" },
|
|
983
|
+
"documentDesigner.editor.table.width": { en: "Width (mm)", de: "Breite (mm)" },
|
|
984
|
+
"documentDesigner.editor.table.lineAbove": { en: "Line above", de: "Linie über" },
|
|
985
|
+
"documentDesigner.editor.table.lineBelow": { en: "Line below", de: "Linie unter" },
|
|
986
|
+
"documentDesigner.editor.table.lineWeight": { en: "Line weight (pt)", de: "Linienstärke (pt)" },
|
|
987
|
+
"documentDesigner.appearance.cornerMarks": { en: "Corner marks", de: "Eckmarken" },
|
|
988
|
+
"documentDesigner.appearance.paperColor": { en: "Paper colour", de: "Papierfarbe" },
|
|
989
|
+
"documentDesigner.appearance.paperColorReset": { en: "White", de: "Weiß" },
|
|
990
|
+
"documentDesigner.editor.region.fromPage2": { en: "from page 2", de: "ab Seite 2" },
|
|
991
|
+
"documentDesigner.appearance.tableLine": { en: "Table line colour", de: "Tabellenlinienfarbe" },
|
|
992
|
+
"documentDesigner.appearance.foldMarks": { en: "Fold marks", de: "Falzmarken" },
|
|
993
|
+
"documentDesigner.appearance.foldMarks.none": { en: "None", de: "Keine" },
|
|
994
|
+
"documentDesigner.appearance.foldMarks.din-a": { en: "DIN 5008 form A", de: "DIN 5008 Form A" },
|
|
995
|
+
"documentDesigner.appearance.foldMarks.din-b": { en: "DIN 5008 form B", de: "DIN 5008 Form B" },
|
|
996
|
+
"documentDesigner.appearance.headerOnFirstPage": {
|
|
997
|
+
en: "Header on page 1",
|
|
998
|
+
de: "Kopf auf Seite 1",
|
|
999
|
+
},
|
|
1000
|
+
"documentDesigner.appearance.footerOnFirstPage": {
|
|
1001
|
+
en: "Footer on page 1",
|
|
1002
|
+
de: "Fuß auf Seite 1",
|
|
1003
|
+
},
|
|
1004
|
+
"documentDesigner.frame.title": { en: "Frame", de: "Rahmen" },
|
|
1005
|
+
"documentDesigner.frame.titleAddress": { en: "Address field", de: "Adressfeld" },
|
|
1006
|
+
"documentDesigner.frame.position": { en: "Position", de: "Lage" },
|
|
1007
|
+
"documentDesigner.frame.positionMm": { en: "Position in mm", de: "Position in mm" },
|
|
1008
|
+
"documentDesigner.frame.position.form-a": { en: "DIN 5008 form A", de: "DIN 5008 Form A" },
|
|
1009
|
+
"documentDesigner.frame.position.form-b": { en: "DIN 5008 form B", de: "DIN 5008 Form B" },
|
|
1010
|
+
"documentDesigner.frame.position.free": { en: "Free", de: "Frei" },
|
|
1011
|
+
"documentDesigner.frame.left": { en: "Left", de: "Links" },
|
|
1012
|
+
"documentDesigner.frame.top": { en: "Top", de: "Oben" },
|
|
1013
|
+
"documentDesigner.frame.width": { en: "Width", de: "Breite" },
|
|
1014
|
+
"documentDesigner.frame.height": { en: "Height", de: "Höhe" },
|
|
1015
|
+
"documentDesigner.frame.sender": {
|
|
1016
|
+
en: "Sender above the address",
|
|
1017
|
+
de: "Absender über der Anschrift",
|
|
1018
|
+
},
|
|
1019
|
+
"documentDesigner.frame.recipient": { en: "Recipient", de: "Empfänger" },
|
|
1020
|
+
"documentDesigner.frame.recipientNone": { en: "None", de: "Keiner" },
|
|
1021
|
+
"documentDesigner.frame.reserveFlow": { en: "Text starts below", de: "Text beginnt darunter" },
|
|
1022
|
+
"documentDesigner.frame.remove": { en: "Remove frame", de: "Rahmen entfernen" },
|
|
1023
|
+
"documentDesigner.frame.removeAddress": {
|
|
1024
|
+
en: "Remove address field",
|
|
1025
|
+
de: "Adressfeld entfernen",
|
|
1026
|
+
},
|
|
1027
|
+
"documentDesigner.frame.positionHint": {
|
|
1028
|
+
en: 'Form A and B differ in the head height: 27 or 45 mm. Changing the values switches to "Free".',
|
|
1029
|
+
de: "Form A und B unterscheiden sich in der Kopfhöhe: 27 oder 45 mm. Wer die Werte ändert, wechselt auf „Frei“.",
|
|
1030
|
+
},
|
|
1031
|
+
"documentDesigner.frame.intoMargin": {
|
|
1032
|
+
en: "The frame reaches into the top margin and can cover the header.",
|
|
1033
|
+
de: "Der Rahmen ragt in den oberen Rand und kann den Kopf überdecken.",
|
|
1034
|
+
},
|
|
1035
|
+
"documentDesigner.frame.beyondPaper": {
|
|
1036
|
+
en: "The frame extends beyond the paper.",
|
|
1037
|
+
de: "Der Rahmen ragt über das Papier hinaus.",
|
|
1038
|
+
},
|
|
1039
|
+
"documentDesigner.appearance.pdfTitle": { en: "Appearance", de: "Aussehen" },
|
|
1040
|
+
"documentDesigner.appearance.fontSizePt": { en: "Size", de: "Größe" },
|
|
1041
|
+
"documentDesigner.appearance.textColor": { en: "Text color", de: "Textfarbe" },
|
|
1042
|
+
"documentDesigner.appearance.tableStyle": { en: "Tables", de: "Tabellen" },
|
|
1043
|
+
"documentDesigner.appearance.tableStyle.plain": { en: "No lines", de: "Ohne Linien" },
|
|
1044
|
+
"documentDesigner.appearance.tableStyle.lines": { en: "Row lines", de: "Zeilenlinien" },
|
|
1045
|
+
"documentDesigner.appearance.tableStyle.grid": { en: "Grid", de: "Gitter" },
|
|
1046
|
+
"documentDesigner.appearance.tableStyle.header": {
|
|
1047
|
+
en: "Line under header",
|
|
1048
|
+
de: "Linie unter dem Kopf",
|
|
1049
|
+
},
|
|
1050
|
+
"documentDesigner.appearance.tableHeader": {
|
|
1051
|
+
en: "Table header background",
|
|
1052
|
+
de: "Tabellenkopf-Hintergrund",
|
|
1053
|
+
},
|
|
1054
|
+
"documentDesigner.appearance.pdfInvalid": {
|
|
1055
|
+
en: "Colors must be #rrggbb, the font size 6 to 24 pt and margins 0 to 100 mm.",
|
|
1056
|
+
de: "Farben als #rrggbb, Schriftgröße 6 bis 24 pt und Ränder 0 bis 100 mm angeben.",
|
|
1057
|
+
},
|
|
1058
|
+
"documentDesigner.margins.legend": {
|
|
1059
|
+
en: "Margins in mm (top, right, bottom, left)",
|
|
1060
|
+
de: "Ränder in mm (oben, rechts, unten, links)",
|
|
1061
|
+
},
|
|
1062
|
+
"documentDesigner.margins.legendShort": { en: "Margins in mm", de: "Ränder in mm" },
|
|
1063
|
+
"documentDesigner.margins.top": { en: "Top (mm)", de: "Oben (mm)" },
|
|
1064
|
+
"documentDesigner.margins.right": { en: "Right (mm)", de: "Rechts (mm)" },
|
|
1065
|
+
"documentDesigner.margins.bottom": { en: "Bottom (mm)", de: "Unten (mm)" },
|
|
1066
|
+
"documentDesigner.margins.left": { en: "Left (mm)", de: "Links (mm)" },
|
|
1067
|
+
"documentDesigner.margins.layoutHint": {
|
|
1068
|
+
en: "Templates take this over. A template only stores what differs.",
|
|
1069
|
+
de: "Vorlagen übernehmen das. Eine Vorlage speichert nur, was bei ihr anders ist.",
|
|
1070
|
+
},
|
|
1071
|
+
"documentDesigner.margins.fromLayout": {
|
|
1072
|
+
en: "From layout: {margins}",
|
|
1073
|
+
de: "Aus Layout: {margins}",
|
|
1074
|
+
},
|
|
1075
|
+
"documentDesigner.margins.override": {
|
|
1076
|
+
en: "Change for this template",
|
|
1077
|
+
de: "Für diese Vorlage ändern",
|
|
1078
|
+
},
|
|
1079
|
+
"documentDesigner.margins.useLayout": { en: "Use the layout's margins", de: "Wie im Layout" },
|
|
1080
|
+
"documentDesigner.company.title": { en: "Company data", de: "Firmendaten" },
|
|
1081
|
+
"documentDesigner.company.edit": { en: "Edit", de: "Bearbeiten" },
|
|
1082
|
+
"documentDesigner.company.enter": { en: "enter", de: "eintragen" },
|
|
1083
|
+
"documentDesigner.company.hint": {
|
|
1084
|
+
en: "Maintain once, every template and layout inserts them as placeholders.",
|
|
1085
|
+
de: "Einmal pflegen, jede Vorlage und jedes Layout setzt sie als Platzhalter ein.",
|
|
1086
|
+
},
|
|
1087
|
+
"documentDesigner.applyLayout.open": {
|
|
1088
|
+
en: "Apply to more templates",
|
|
1089
|
+
de: "Auf weitere Vorlagen anwenden",
|
|
1090
|
+
},
|
|
1091
|
+
"documentDesigner.applyLayout.title": {
|
|
1092
|
+
en: "Apply “{name}” to more templates",
|
|
1093
|
+
de: "„{name}“ auf weitere Vorlagen anwenden",
|
|
1094
|
+
},
|
|
1095
|
+
"documentDesigner.applyLayout.intro": {
|
|
1096
|
+
en: "Header, footer, font and colors then come from this layout. The text of the templates stays as it is.",
|
|
1097
|
+
de: "Kopf, Fuß, Schrift und Farben kommen danach aus diesem Layout. Der Text der Vorlagen bleibt, wie er ist.",
|
|
1098
|
+
},
|
|
1099
|
+
"documentDesigner.applyLayout.all": { en: "All PDF templates", de: "Alle PDF-Vorlagen" },
|
|
1100
|
+
"documentDesigner.applyLayout.allHint": {
|
|
1101
|
+
en: "Becomes the default layout of the tenant. No copies are made, new texts of system templates keep arriving.",
|
|
1102
|
+
de: "Wird das Standard-Layout des Mandanten. Es entstehen keine Kopien, neue Texte von System-Vorlagen kommen weiter an.",
|
|
1103
|
+
},
|
|
1104
|
+
"documentDesigner.applyLayout.selected": { en: "Only these templates", de: "Nur diese Vorlagen" },
|
|
1105
|
+
"documentDesigner.applyLayout.selectedHint": {
|
|
1106
|
+
en: "Creates one draft per template and language.",
|
|
1107
|
+
de: "Legt je Vorlage und Sprache einen Entwurf an.",
|
|
1108
|
+
},
|
|
1109
|
+
"documentDesigner.applyLayout.note": {
|
|
1110
|
+
en: "Mail templates do not appear here. You need the right to edit every chosen template.",
|
|
1111
|
+
de: "Mail-Vorlagen erscheinen hier nicht. Du brauchst das Bearbeitungsrecht auf jede gewählte Vorlage.",
|
|
1112
|
+
},
|
|
1113
|
+
"documentDesigner.applyLayout.cancel": { en: "Cancel", de: "Abbrechen" },
|
|
1114
|
+
"documentDesigner.applyLayout.tooMany": {
|
|
1115
|
+
en: "{count} entries selected, at most {max} per run. Choose fewer templates.",
|
|
1116
|
+
de: "{count} Einträge gewählt, höchstens {max} pro Durchgang. Wähle weniger Vorlagen aus.",
|
|
1117
|
+
},
|
|
1118
|
+
"documentDesigner.applyLayout.close": { en: "Close", de: "Schließen" },
|
|
1119
|
+
"documentDesigner.applyLayout.submitAll": {
|
|
1120
|
+
en: "Set as default layout",
|
|
1121
|
+
de: "Als Standard-Layout setzen",
|
|
1122
|
+
},
|
|
1123
|
+
"documentDesigner.applyLayout.allDone": {
|
|
1124
|
+
en: "The layout is now the default layout of the tenant.",
|
|
1125
|
+
de: "Das Layout ist jetzt das Standard-Layout des Mandanten.",
|
|
1126
|
+
},
|
|
1127
|
+
"documentDesigner.applyLayout.skipped": { en: "Skipped", de: "Übersprungen" },
|
|
1128
|
+
"documentDesigner.applyLayout.failed": { en: "Not published", de: "Nicht veröffentlicht" },
|
|
1129
|
+
"documentDesigner.applyLayout.systemWarning.one": {
|
|
1130
|
+
en: "1 system template becomes an adjustment of your tenant. New texts of it then no longer arrive automatically.",
|
|
1131
|
+
de: "1 System-Vorlage wird zur Anpassung deines Mandanten. Neue Texte dieser System-Vorlage kommen dann nicht mehr automatisch an.",
|
|
1132
|
+
},
|
|
1133
|
+
"documentDesigner.applyLayout.systemWarning.other": {
|
|
1134
|
+
en: "{count} system templates become adjustments of your tenant. New texts of these system templates then no longer arrive automatically.",
|
|
1135
|
+
de: "{count} System-Vorlagen werden zu Anpassungen deines Mandanten. Neue Texte dieser System-Vorlagen kommen dann nicht mehr automatisch an.",
|
|
1136
|
+
},
|
|
1137
|
+
"documentDesigner.applyLayout.submit.one": {
|
|
1138
|
+
en: "Create draft for 1 template",
|
|
1139
|
+
de: "Entwurf für 1 Vorlage anlegen",
|
|
1140
|
+
},
|
|
1141
|
+
"documentDesigner.applyLayout.submit.other": {
|
|
1142
|
+
en: "Create drafts for {count} templates",
|
|
1143
|
+
de: "Entwürfe für {count} Vorlagen anlegen",
|
|
1144
|
+
},
|
|
1145
|
+
"documentDesigner.applyLayout.drafted.one": { en: "1 draft created.", de: "1 Entwurf angelegt." },
|
|
1146
|
+
"documentDesigner.applyLayout.drafted.other": {
|
|
1147
|
+
en: "{count} drafts created.",
|
|
1148
|
+
de: "{count} Entwürfe angelegt.",
|
|
1149
|
+
},
|
|
1150
|
+
"documentDesigner.applyLayout.publish.one": {
|
|
1151
|
+
en: "Publish 1 draft",
|
|
1152
|
+
de: "1 Entwurf veröffentlichen",
|
|
1153
|
+
},
|
|
1154
|
+
"documentDesigner.applyLayout.publish.other": {
|
|
1155
|
+
en: "Publish {count} drafts",
|
|
1156
|
+
de: "{count} Entwürfe veröffentlichen",
|
|
1157
|
+
},
|
|
876
1158
|
};
|
package/dist/web/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type DocumentDesignerClientOptions, documentDesignerClient, PdfTemplateEditorScreen, } from "./client-plugin.tsx";
|
|
2
2
|
export { composeLayoutHtml, type LayoutRegionValues } from "./compose-layout.ts";
|
|
3
|
-
export { DOCUMENT_DESIGNER_FEATURE, MAIL_EDITOR_SCREEN_ID, PDF_TEMPLATE_EDITOR_SCREEN_ID, TEMPLATE_EDITOR_SCREENS, type TemplateEditorKind, } from "./constants.ts";
|
|
3
|
+
export { DOCUMENT_DESIGNER_FEATURE, MAIL_EDITOR_SCREEN_ID, PDF_TEMPLATE_EDITOR_SCREEN_ID, TEMPLATE_EDITOR_SCREENS, TEMPLATE_IMPORT_CLIENT_ACTION, type TemplateEditorKind, } from "./constants.ts";
|
|
4
4
|
export { documentDesignerTranslations } from "./default-translations.ts";
|
|
5
5
|
export { PdfTemplateEditor, type PdfTemplateEditorProps } from "./pdf-template-editor.tsx";
|
|
6
6
|
export { type PreviewRecordPicker, type PreviewRecordPickerProps, PreviewRecordPickerProvider, } from "./preview-record-picker.tsx";
|
package/dist/web/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { documentDesignerClient, PdfTemplateEditorScreen, } from "./client-plugin.js";
|
|
2
2
|
export { composeLayoutHtml } from "./compose-layout.js";
|
|
3
|
-
export { DOCUMENT_DESIGNER_FEATURE, MAIL_EDITOR_SCREEN_ID, PDF_TEMPLATE_EDITOR_SCREEN_ID, TEMPLATE_EDITOR_SCREENS, } from "./constants.js";
|
|
3
|
+
export { DOCUMENT_DESIGNER_FEATURE, MAIL_EDITOR_SCREEN_ID, PDF_TEMPLATE_EDITOR_SCREEN_ID, TEMPLATE_EDITOR_SCREENS, TEMPLATE_IMPORT_CLIENT_ACTION, } from "./constants.js";
|
|
4
4
|
export { documentDesignerTranslations } from "./default-translations.js";
|
|
5
5
|
export { PdfTemplateEditor } from "./pdf-template-editor.js";
|
|
6
6
|
export { PreviewRecordPickerProvider, } from "./preview-record-picker.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type PdfLayoutLook } from "./layout-meta.ts";
|
|
3
|
+
export declare function LayoutAppearanceSection({ look, hasHeader, hasFooter, onChange, }: {
|
|
4
|
+
readonly look: PdfLayoutLook;
|
|
5
|
+
readonly hasHeader: boolean;
|
|
6
|
+
readonly hasFooter: boolean;
|
|
7
|
+
readonly onChange: (next: PdfLayoutLook) => void;
|
|
8
|
+
}): ReactNode;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DOCUMENT_FONT_LABELS, DOCUMENT_FONTS, FONT_SIZES_PT, PDF_FOLD_MARKS, PDF_TABLE_STYLES, } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
+
import { useLocale, usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
4
|
+
import { isHexColor, PDF_LAYOUT_FONT_SIZE_RANGE } from "./layout-meta.js";
|
|
5
|
+
import { ColorSwatch } from "./layout-rails.js";
|
|
6
|
+
import { EMPTY_MARGIN_INPUT, resolveMarginsMm } from "./paper-geometry.js";
|
|
7
|
+
import { MARGIN_SIDES } from "./pdf-meta.js";
|
|
8
|
+
import { RailField, RailHint, RailSection } from "./rail.js";
|
|
9
|
+
const MARGIN_LABEL_KEYS = {
|
|
10
|
+
top: "documentDesigner.margins.top",
|
|
11
|
+
right: "documentDesigner.margins.right",
|
|
12
|
+
bottom: "documentDesigner.margins.bottom",
|
|
13
|
+
left: "documentDesigner.margins.left",
|
|
14
|
+
};
|
|
15
|
+
function fontSizeChoices(current) {
|
|
16
|
+
const { min, max } = PDF_LAYOUT_FONT_SIZE_RANGE;
|
|
17
|
+
const inRange = FONT_SIZES_PT.filter((size) => size >= min && size <= max);
|
|
18
|
+
return current === "" || inRange.includes(current)
|
|
19
|
+
? inRange
|
|
20
|
+
: [...inRange, current].sort((a, b) => a - b);
|
|
21
|
+
}
|
|
22
|
+
export function LayoutAppearanceSection({ look, hasHeader, hasFooter, onChange, }) {
|
|
23
|
+
const defaultMargins = resolveMarginsMm({
|
|
24
|
+
template: EMPTY_MARGIN_INPUT,
|
|
25
|
+
layout: {},
|
|
26
|
+
hasHeader,
|
|
27
|
+
hasFooter,
|
|
28
|
+
});
|
|
29
|
+
const t = useTranslation();
|
|
30
|
+
const { Button, Field, Input } = usePrimitives();
|
|
31
|
+
const locale = useLocale().locale();
|
|
32
|
+
const patch = (changes) => onChange({ ...look, ...changes });
|
|
33
|
+
const paperColorInvalid = look.paperColor !== "" && !isHexColor(look.paperColor);
|
|
34
|
+
const textColorInvalid = !isHexColor(look.textColor);
|
|
35
|
+
const lineInvalid = look.tableLineColor !== "" && !isHexColor(look.tableLineColor);
|
|
36
|
+
const headerInvalid = look.tableHeaderBackground !== "" && !isHexColor(look.tableHeaderBackground);
|
|
37
|
+
return (_jsxs(RailSection, { title: t("documentDesigner.appearance.pdfTitle"), testId: "layout-appearance", children: [_jsxs(RailField, { children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] gap-2", children: [_jsx("div", { "data-testid": "layout-font", children: _jsx(Field, { id: "dd-layout-pdf-font", label: t("documentDesigner.appearance.font"), children: _jsx(Input, { kind: "select", id: "dd-layout-pdf-font", name: "fontFamily", value: look.fontFamily, onChange: (value) => {
|
|
38
|
+
const fontFamily = DOCUMENT_FONTS.find((candidate) => candidate === value);
|
|
39
|
+
if (fontFamily !== undefined)
|
|
40
|
+
patch({ fontFamily });
|
|
41
|
+
}, display: "dropdown", options: DOCUMENT_FONTS.map((font) => ({
|
|
42
|
+
value: font,
|
|
43
|
+
label: DOCUMENT_FONT_LABELS[font],
|
|
44
|
+
})) }) }) }), _jsx("div", { "data-testid": "layout-font-size", children: _jsx(Field, { id: "dd-layout-pdf-font-size", label: t("documentDesigner.appearance.fontSizePt"), children: _jsx(Input, { kind: "select", id: "dd-layout-pdf-font-size", name: "fontSizePt", value: String(look.fontSizePt), onChange: (value) => patch({ fontSizePt: Number(value) }), display: "dropdown", options: fontSizeChoices(look.fontSizePt).map((size) => ({
|
|
45
|
+
value: String(size),
|
|
46
|
+
label: t("documentDesigner.editor.defaultSize", {
|
|
47
|
+
value: new Intl.NumberFormat(locale).format(size),
|
|
48
|
+
}),
|
|
49
|
+
})) }) }) })] }), _jsx(Field, { id: "dd-layout-pdf-text-color", label: t("documentDesigner.appearance.textColor"), children: _jsxs("div", { className: `relative${textColorInvalid ? "" : " [&_input]:pl-8"}`, children: [!textColorInvalid && (_jsx("span", { className: "pointer-events-none absolute inset-y-0 left-2.5 z-10 flex items-center", children: _jsx(ColorSwatch, { color: look.textColor }) })), _jsx(Input, { kind: "text", id: "dd-layout-pdf-text-color", name: "textColor", value: look.textColor, onChange: (textColor) => patch({ textColor }), hasError: textColorInvalid, testId: "layout-text-color" })] }) }), _jsx("div", { "data-testid": "layout-table-style", children: _jsx(Field, { id: "dd-layout-pdf-table-style", label: t("documentDesigner.appearance.tableStyle"), children: _jsx(Input, { kind: "select", id: "dd-layout-pdf-table-style", name: "tableStyle", value: look.tableStyle, onChange: (value) => {
|
|
50
|
+
const tableStyle = PDF_TABLE_STYLES.find((candidate) => candidate === value);
|
|
51
|
+
if (tableStyle !== undefined)
|
|
52
|
+
patch({ tableStyle });
|
|
53
|
+
}, display: "dropdown", options: PDF_TABLE_STYLES.map((style) => ({
|
|
54
|
+
value: style,
|
|
55
|
+
label: t(`documentDesigner.appearance.tableStyle.${style}`),
|
|
56
|
+
})) }) }) }), look.tableHeaderBackground !== "" && (_jsx(Field, { id: "dd-layout-pdf-table-header", label: t("documentDesigner.appearance.tableHeader"), children: _jsxs("div", { className: "flex items-center gap-2", children: [!headerInvalid && _jsx(ColorSwatch, { color: look.tableHeaderBackground }), _jsx(Input, { kind: "text", id: "dd-layout-pdf-table-header", name: "tableHeaderBackground", value: look.tableHeaderBackground, onChange: (tableHeaderBackground) => patch({ tableHeaderBackground }), hasError: headerInvalid, placeholder: "#e5e5e5", testId: "layout-table-header" })] }) })), _jsx(Field, { id: "dd-layout-pdf-table-line", label: t("documentDesigner.appearance.tableLine"), children: _jsxs("div", { className: "flex items-center gap-2", children: [look.tableLineColor !== "" && !lineInvalid && (_jsx(ColorSwatch, { color: look.tableLineColor })), _jsx(Input, { kind: "text", id: "dd-layout-pdf-table-line", name: "tableLineColor", value: look.tableLineColor, onChange: (tableLineColor) => patch({ tableLineColor }), hasError: lineInvalid, placeholder: "#bbbbbb", testId: "layout-table-line" })] }) }), _jsx(Field, { id: "dd-layout-pdf-paper-color", label: t("documentDesigner.appearance.paperColor"), children: _jsxs("div", { className: "flex items-center gap-2", children: [look.paperColor !== "" && !paperColorInvalid && (_jsx(ColorSwatch, { color: look.paperColor })), _jsx(Input, { kind: "text", id: "dd-layout-pdf-paper-color", name: "paperColor", value: look.paperColor, onChange: (paperColor) => patch({ paperColor }), hasError: paperColorInvalid, placeholder: "#ffffff", testId: "layout-paper-color" }), look.paperColor !== "" && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => patch({ paperColor: "" }), testId: "layout-paper-color-reset", children: t("documentDesigner.appearance.paperColorReset") }))] }) }), _jsx("div", { "data-testid": "layout-fold-marks", children: _jsx(Field, { id: "dd-layout-pdf-fold-marks", label: t("documentDesigner.appearance.foldMarks"), children: _jsx(Input, { kind: "select", id: "dd-layout-pdf-fold-marks", name: "foldMarks", value: look.foldMarks, onChange: (value) => {
|
|
57
|
+
const foldMarks = PDF_FOLD_MARKS.find((candidate) => candidate === value);
|
|
58
|
+
if (foldMarks !== undefined)
|
|
59
|
+
patch({ foldMarks });
|
|
60
|
+
}, display: "dropdown", options: PDF_FOLD_MARKS.map((marks) => ({
|
|
61
|
+
value: marks,
|
|
62
|
+
label: t(`documentDesigner.appearance.foldMarks.${marks}`),
|
|
63
|
+
})) }) }) }), _jsx(Field, { id: "dd-layout-pdf-corner-marks", layout: "inline", label: t("documentDesigner.appearance.cornerMarks"), children: _jsx(Input, { kind: "boolean", id: "dd-layout-pdf-corner-marks", name: "cornerMarks", value: look.cornerMarks, onChange: (cornerMarks) => patch({ cornerMarks }) }) }), _jsx(Field, { id: "dd-layout-pdf-header-first", layout: "inline", label: t("documentDesigner.appearance.headerOnFirstPage"), children: _jsx(Input, { kind: "boolean", id: "dd-layout-pdf-header-first", name: "headerOnFirstPage", value: look.headerOnFirstPage, onChange: (headerOnFirstPage) => patch({ headerOnFirstPage }) }) }), _jsx(Field, { id: "dd-layout-pdf-footer-first", layout: "inline", label: t("documentDesigner.appearance.footerOnFirstPage"), children: _jsx(Input, { kind: "boolean", id: "dd-layout-pdf-footer-first", name: "footerOnFirstPage", value: look.footerOnFirstPage, onChange: (footerOnFirstPage) => patch({ footerOnFirstPage }) }) }), _jsxs("fieldset", { className: "m-0 flex min-w-0 flex-col gap-1 border-0 p-0", children: [_jsx("legend", { className: "p-0 text-sm font-medium", children: t("documentDesigner.margins.legend") }), _jsx("div", { className: "grid grid-cols-4 gap-1", children: MARGIN_SIDES.map((side) => (_jsx(Field, { id: `dd-layout-margin-${side}`, label: t(MARGIN_LABEL_KEYS[side]), hideLabel: true, children: _jsx(Input, { kind: "number", id: `dd-layout-margin-${side}`, name: `layout-margin-${side}`, value: look.margins[side], onChange: (value) => patch({ margins: { ...look.margins, [side]: value ?? "" } }), placeholder: String(defaultMargins[side]), testId: `layout-margin-${side}` }) }, side))) })] })] }), _jsx(RailHint, { children: t("documentDesigner.margins.layoutHint") })] }));
|
|
64
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
3
3
|
import { ModeSwitch } from "@cosmicdrift/kumiko-renderer/web";
|
|
4
|
+
import { CompanyDataRail } from "./company-data-rail.js";
|
|
4
5
|
import { EditorHeader } from "./editor-header.js";
|
|
5
6
|
import { EditorBody, EditorFooter, EditorFrame } from "./editor-shell.js";
|
|
7
|
+
import { LayoutAppearanceSection } from "./layout-appearance-section.js";
|
|
6
8
|
import { renderCenter } from "./layout-editor-center.js";
|
|
7
9
|
import { AppearanceRail, BrandingRail, MjmlSourceRail, PlaceholderRail, RendererRail, UsedByRail, } from "./layout-rails.js";
|
|
10
|
+
import { LayoutUsageSection } from "./layout-usage-section.js";
|
|
8
11
|
import { OriginBar } from "./origin-bar.js";
|
|
9
12
|
import { useLayoutEditorState, } from "./use-layout-editor-state.js";
|
|
10
13
|
function renderLeftRail(props, m) {
|
|
11
14
|
const { branding } = m;
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx(BrandingRail, { data: branding.data, unavailable: branding.error !== null || (branding.data === null && !branding.loading) }), _jsx(PlaceholderRail, { validation: m.checked }), _jsx(RendererRail, { kind: props.kind })] }));
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandingRail, { data: branding.data, unavailable: branding.error !== null || (branding.data === null && !branding.loading) }), !m.isMail && _jsx(CompanyDataRail, { onInsert: m.insertIntoActiveRegion }), _jsx(PlaceholderRail, { validation: m.checked, isMail: m.isMail, regionsHtml: `${m.header}${m.footer}` }), _jsx(RendererRail, { kind: props.kind })] }));
|
|
13
16
|
}
|
|
14
17
|
function renderRightRail(props, m) {
|
|
15
|
-
return (_jsxs(_Fragment, { children: [m.isMail && (_jsx(AppearanceRail, { appearance: m.appearance, onChange: m.setAppearance, fromMjml: m.appearanceFromMjml })), m.isMail && !m.mjmlMode && _jsx(MjmlSourceRail, { mjmlSource: props.source.mjmlSource }), _jsx(UsedByRail, { layoutSlug: props.slug, kind: props.kind, rows: props.overviewRows })] }));
|
|
18
|
+
return (_jsxs(_Fragment, { children: [m.isMail && (_jsx(AppearanceRail, { appearance: m.appearance, onChange: m.setAppearance, fromMjml: m.appearanceFromMjml })), !m.isMail && (_jsx(LayoutAppearanceSection, { look: m.pdfLook, hasHeader: m.header.trim() !== "", hasFooter: m.footer.trim() !== "", onChange: m.setPdfLook })), m.isMail && !m.mjmlMode && _jsx(MjmlSourceRail, { mjmlSource: props.source.mjmlSource }), m.isMail ? (_jsx(UsedByRail, { layoutSlug: props.slug, kind: props.kind, rows: props.overviewRows })) : (_jsx(LayoutUsageSection, { slug: props.slug }))] }));
|
|
16
19
|
}
|
|
17
20
|
function renderKindSwitch(t, props, m) {
|
|
18
21
|
return (_jsx(ModeSwitch, { value: props.kind, onChange: m.requestKind, ariaLabel: t("documentDesigner.editor.kindSwitch"), testId: "document-designer-kind-switch", options: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type useMutation } from "@cosmicdrift/kumiko-renderer";
|
|
2
2
|
import type { Translate } from "@cosmicdrift/kumiko-renderer/headless";
|
|
3
3
|
import type { FooterTone } from "./editor-shell.tsx";
|
|
4
|
-
import { type LayoutAppearance, type LayoutWidth } from "./layout-meta.ts";
|
|
4
|
+
import { type LayoutAppearance, type LayoutWidth, type PdfLayoutMeta } from "./layout-meta.ts";
|
|
5
5
|
import type { BrandingView, LayoutKind, LayoutSourceView, LayoutValidation, UpsertResponse, ValidationIssue } from "./layout-types.ts";
|
|
6
6
|
export type EditorTab = "draft" | "mjml";
|
|
7
7
|
export type Region = "header" | "signature" | "footer";
|
|
@@ -59,6 +59,7 @@ export type SaveLayoutInput = {
|
|
|
59
59
|
readonly isSystemAdmin: boolean;
|
|
60
60
|
readonly appearanceEditable: boolean;
|
|
61
61
|
readonly appearance: LayoutAppearance;
|
|
62
|
+
readonly pdfMeta?: PdfLayoutMeta;
|
|
62
63
|
readonly t: Translate;
|
|
63
64
|
readonly upsertTenant: UpsertMutation;
|
|
64
65
|
readonly upsertSystem: UpsertMutation;
|
|
@@ -94,4 +95,5 @@ export declare function layoutSaveFlags(input: {
|
|
|
94
95
|
canSave: boolean;
|
|
95
96
|
canPublish: boolean;
|
|
96
97
|
};
|
|
98
|
+
export declare function footerColumnCount(footerHtml: string): number;
|
|
97
99
|
export {};
|
|
@@ -3,7 +3,7 @@ import { dispatcherErrorText } from "@cosmicdrift/kumiko-renderer";
|
|
|
3
3
|
import { pluralKey } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
4
|
import { composeLayoutHtml } from "./compose-layout.js";
|
|
5
5
|
import { fileUrl } from "./file-name.js";
|
|
6
|
-
import { isHexColor, metaToSave } from "./layout-meta.js";
|
|
6
|
+
import { isHexColor, metaToSave, } from "./layout-meta.js";
|
|
7
7
|
import { asRowStatus } from "./status-label.js";
|
|
8
8
|
export const REGION_EDITOR_IDS = {
|
|
9
9
|
header: "document-designer-region-header",
|
|
@@ -57,12 +57,12 @@ export function footerMessageOf(input) {
|
|
|
57
57
|
const blockingIssue = [...checked.issues, ...checked.publishIssues][0];
|
|
58
58
|
if (blockingIssue !== undefined)
|
|
59
59
|
return { tone: "bad", text: issueText(t, blockingIssue) };
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
60
|
+
const okKey = input.isMail
|
|
61
|
+
? "documentDesigner.editor.footer.okMail"
|
|
62
|
+
: "documentDesigner.editor.footer.okPdf";
|
|
63
|
+
if (userCount === 0)
|
|
64
|
+
return { tone: "ok", text: t(`${okKey}.none`) };
|
|
65
|
+
return { tone: "ok", text: t(pluralKey(okKey, userCount), { count: userCount }) };
|
|
66
66
|
}
|
|
67
67
|
// A layout region has no per-mail variables, so a steps block there could never show a stage and an images block no photos.
|
|
68
68
|
export function layoutBlocks(isMail) {
|
|
@@ -81,6 +81,8 @@ export function resourcePreviewsOf(branding, isMail, t) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
function metaOf(input) {
|
|
84
|
+
if (input.pdfMeta !== undefined)
|
|
85
|
+
return input.pdfMeta;
|
|
84
86
|
if (input.appearanceEditable)
|
|
85
87
|
return metaToSave(input.appearance, input.source.meta);
|
|
86
88
|
return input.isMail ? input.source.meta : {};
|
|
@@ -141,3 +143,9 @@ export function layoutSaveFlags(input) {
|
|
|
141
143
|
!busy,
|
|
142
144
|
};
|
|
143
145
|
}
|
|
146
|
+
const COLUMNS_FIRST_ROW = /<table[^>]*data-borders="none"[^>]*>[\s\S]*?<tr[^>]*>([\s\S]*?)<\/tr>/;
|
|
147
|
+
// The columns block is the borderless table; its first row says how many columns it has.
|
|
148
|
+
export function footerColumnCount(footerHtml) {
|
|
149
|
+
const firstRow = COLUMNS_FIRST_ROW.exec(footerHtml)?.[1];
|
|
150
|
+
return firstRow === undefined ? 0 : (firstRow.match(/<t[dh][\s>]/g) ?? []).length;
|
|
151
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Translate } from "@cosmicdrift/kumiko-renderer/headless";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { LayoutEditorModel } from "./use-layout-editor-state.ts";
|
|
4
4
|
export declare function renderPaper(t: Translate, m: LayoutEditorModel): ReactNode;
|
|
@@ -1,24 +1,59 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DocumentContentEditor } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
+
import { pluralKey } from "@cosmicdrift/kumiko-renderer/headless";
|
|
3
4
|
import { cn } from "@cosmicdrift/kumiko-renderer/web";
|
|
4
|
-
import { PAPER_WIDTH_CLASS, REGION_EDITOR_IDS } from "./layout-editor-logic.js";
|
|
5
|
+
import { footerColumnCount, PAPER_WIDTH_CLASS, REGION_EDITOR_IDS, } from "./layout-editor-logic.js";
|
|
6
|
+
import { layoutValuesOf } from "./layout-meta.js";
|
|
7
|
+
import { paperLookOf, paperSizeMm, resolveMarginsMm } from "./paper-geometry.js";
|
|
8
|
+
import { PaperSheet } from "./paper-sheet.js";
|
|
5
9
|
// A dashed, labelled area of the paper; the focused one owns the shared toolbar.
|
|
6
|
-
function PaperRegion({ label, testId, children, onFocus, }) {
|
|
7
|
-
return (_jsxs("div", { className: "relative rounded-sm
|
|
10
|
+
function PaperRegion({ label, testId, children, active, className, onFocus, }) {
|
|
11
|
+
return (_jsxs("div", { className: cn("relative rounded-sm p-3", active
|
|
12
|
+
? "border-[1.5px] border-solid border-primary bg-primary/5"
|
|
13
|
+
: "border border-dashed border-input", className), "data-testid": testId, "data-active": active, onFocusCapture: onFocus, children: [_jsx("span", { className: cn("absolute -top-2.5 left-2.5 bg-card px-1.5 text-[10px] uppercase tracking-wide", active ? "font-medium text-primary" : "text-muted-foreground"), children: label }), children] }));
|
|
8
14
|
}
|
|
15
|
+
// Chips at the draft's scale (8.5px on a 2.9 px/mm paper), so they stay proportional to the sheet.
|
|
16
|
+
const PAPER_SCALED_CHIPS_CLASS = "[&_[data-variable-chip]]:text-[length:calc(2.93*var(--paper-mm))] [&_[data-variable-chip]]:leading-[calc(4.14*var(--paper-mm))]";
|
|
9
17
|
function renderRegionEditor(m, region, value, onChange) {
|
|
10
18
|
const { resourcePreviews } = m;
|
|
11
|
-
return (_jsx(DocumentContentEditor, { id: REGION_EDITOR_IDS[region], value: value, onChange: onChange, variables: m.placeholders, variableLabels: m.placeholderLabels, systemVariables: m.placeholders, readOnly: false, blocks: m.blocks, ...(resourcePreviews && { resourcePreviews }), chrome: "canvas", toolbarHost: m.activeRegion === region ? m.toolbarHost : null }));
|
|
19
|
+
return (_jsx(DocumentContentEditor, { id: REGION_EDITOR_IDS[region], value: value, onChange: onChange, variables: m.placeholders, variableLabels: m.placeholderLabels, systemVariables: m.placeholders, readOnly: false, blocks: m.blocks, ...(resourcePreviews && { resourcePreviews }), ...(!m.isMail && { layoutValues: layoutValuesOf(m.pdfLook) }), chrome: "canvas", onEditorReady: m.registerRegion(region), toolbarHost: m.activeRegion === region ? m.toolbarHost : null }));
|
|
12
20
|
}
|
|
13
21
|
function renderContentSlot(t, isMail) {
|
|
14
|
-
return (_jsxs("div", { className: "rounded-sm border-2 border-dashed border-primary bg-primary/10 px-3
|
|
22
|
+
return (_jsxs("div", { className: cn("rounded-sm border-2 border-dashed border-primary bg-primary/10 px-3 text-center font-medium text-primary", isMail ? "py-9" : "flex min-h-40 flex-1 flex-col items-center justify-center py-9 text-sm"), "data-testid": "document-designer-region-content", children: ["\u229E ", t("documentDesigner.editor.region.content"), _jsx("small", { className: "mt-1 block text-xs font-normal opacity-85", children: t(isMail ? "documentDesigner.editor.slot.mail" : "documentDesigner.editor.slot.pdf") })] }));
|
|
15
23
|
}
|
|
16
24
|
function renderSignatureRegion(t, m) {
|
|
17
|
-
return (_jsx(PaperRegion, { label: t("documentDesigner.editor.region.signature"), testId: "document-designer-region-signature", onFocus: () => m.setActiveRegion("signature"), children: renderRegionEditor(m, "signature", m.signature, m.setSignature) }));
|
|
25
|
+
return (_jsx(PaperRegion, { label: t("documentDesigner.editor.region.signature"), testId: "document-designer-region-signature", active: m.activeRegion === "signature", onFocus: () => m.setActiveRegion("signature"), children: renderRegionEditor(m, "signature", m.signature, m.setSignature) }));
|
|
18
26
|
}
|
|
27
|
+
function footerLabel(t, m) {
|
|
28
|
+
const columns = m.isMail ? 0 : footerColumnCount(m.footer);
|
|
29
|
+
const label = columns === 0
|
|
30
|
+
? t("documentDesigner.editor.region.footer")
|
|
31
|
+
: t(pluralKey("documentDesigner.editor.region.footerColumns", columns), { count: columns });
|
|
32
|
+
return !m.isMail && !m.pdfLook.footerOnFirstPage
|
|
33
|
+
? `${label} · ${t("documentDesigner.editor.region.fromPage2")}`
|
|
34
|
+
: label;
|
|
35
|
+
}
|
|
36
|
+
// One sheet shows page 1, so a region that only prints from page 2 on is dimmed and labelled.
|
|
37
|
+
const SKIPPED_ON_FIRST_PAGE_CLASS = "opacity-50";
|
|
38
|
+
// The PDF footer sits 4 mm above the paper edge (CHROMIUM_REGION_PADDING_MM) at the page-margin columns, independent of the bottom margin.
|
|
39
|
+
const PDF_FOOTER_WRAPPER_CLASS = "absolute right-[calc(var(--paper-margin-right)-0.25rem)] bottom-[calc(4*var(--paper-mm))] left-[calc(var(--paper-margin-left)-0.25rem)] bg-card";
|
|
19
40
|
function renderFooterRegion(t, m) {
|
|
20
|
-
return (_jsx("div", { className: cn(m.isMail
|
|
41
|
+
return (_jsx("div", { className: cn(m.isMail ? "-mx-8 -mb-6 bg-muted px-8 py-4" : PDF_FOOTER_WRAPPER_CLASS), children: _jsx(PaperRegion, { label: footerLabel(t, m), testId: "document-designer-region-footer", active: m.activeRegion === "footer", className: cn(!m.isMail && "px-1 pt-1.5 pb-5", !m.isMail && PAPER_SCALED_CHIPS_CLASS, !m.isMail && !m.pdfLook.footerOnFirstPage && SKIPPED_ON_FIRST_PAGE_CLASS), onFocus: () => m.setActiveRegion("footer"), children: renderRegionEditor(m, "footer", m.footer, m.setFooter) }) }));
|
|
42
|
+
}
|
|
43
|
+
function renderPdfPaper(t, m) {
|
|
44
|
+
const size = paperSizeMm("A4", "portrait");
|
|
45
|
+
const margins = resolveMarginsMm({
|
|
46
|
+
template: m.pdfLook.margins,
|
|
47
|
+
layout: {},
|
|
48
|
+
hasHeader: m.header.trim() !== "",
|
|
49
|
+
hasFooter: m.footer.trim() !== "",
|
|
50
|
+
});
|
|
51
|
+
return (_jsx("div", { className: "mx-auto flex w-full flex-col items-center", children: _jsxs(PaperSheet, { size: size, margins: margins, look: paperLookOf(m.pdfLook), testId: "document-designer-paper", children: [_jsx("div", { className: "absolute top-[calc(1*var(--paper-mm))] right-[calc(var(--paper-margin-right)-0.25rem)] left-[calc(var(--paper-margin-left)-0.25rem)] bg-card", children: _jsx(PaperRegion, { label: m.pdfLook.headerOnFirstPage
|
|
52
|
+
? t("documentDesigner.editor.region.header")
|
|
53
|
+
: `${t("documentDesigner.editor.region.header")} · ${t("documentDesigner.editor.region.fromPage2")}`, testId: "document-designer-region-header", active: m.activeRegion === "header", className: cn("px-1 pt-[calc(3*var(--paper-mm))] pb-1", PAPER_SCALED_CHIPS_CLASS, !m.pdfLook.headerOnFirstPage && SKIPPED_ON_FIRST_PAGE_CLASS), onFocus: () => m.setActiveRegion("header"), children: renderRegionEditor(m, "header", m.header, m.setHeader) }) }), _jsx("div", { className: "flex min-h-0 flex-1 flex-col pt-(--paper-margin-top) pr-(--paper-margin-right) pb-(--paper-margin-bottom) pl-(--paper-margin-left)", children: renderContentSlot(t, false) }), renderFooterRegion(t, m)] }) }));
|
|
21
54
|
}
|
|
22
55
|
export function renderPaper(t, m) {
|
|
23
|
-
|
|
56
|
+
if (!m.isMail)
|
|
57
|
+
return renderPdfPaper(t, m);
|
|
58
|
+
return (_jsxs("div", { className: cn("mx-auto flex w-full flex-col gap-5 bg-card px-8 py-6 shadow-md", PAPER_WIDTH_CLASS[m.appearance.width], m.showAccentLine && "border-t-4 border-t-(--layout-accent)"), ref: (element) => element?.style.setProperty("--layout-accent", m.accentColor), "data-testid": "document-designer-paper", children: [_jsx(PaperRegion, { label: t("documentDesigner.editor.region.header"), testId: "document-designer-region-header", active: m.activeRegion === "header", onFocus: () => m.setActiveRegion("header"), children: renderRegionEditor(m, "header", m.header, m.setHeader) }), renderContentSlot(t, true), renderSignatureRegion(t, m), renderFooterRegion(t, m)] }));
|
|
24
59
|
}
|