vobi_document 1.0.1 → 1.1.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.
Files changed (102) hide show
  1. package/README.md +23 -6
  2. package/dist/blocks.cjs +100 -0
  3. package/dist/blocks.cjs.map +1 -0
  4. package/dist/blocks.d.cts +201 -0
  5. package/dist/blocks.d.ts +201 -0
  6. package/dist/blocks.js +7 -0
  7. package/dist/blocks.js.map +1 -0
  8. package/dist/catalogContext-DenbX-OW.d.cts +15 -0
  9. package/dist/catalogContext-HGMU-w_4.d.ts +15 -0
  10. package/dist/chunk-2EBYURIX.js +90 -0
  11. package/dist/chunk-2EBYURIX.js.map +1 -0
  12. package/dist/chunk-6GRYRVU5.js +824 -0
  13. package/dist/chunk-6GRYRVU5.js.map +1 -0
  14. package/dist/chunk-ABIEQHS2.js +159 -0
  15. package/dist/chunk-ABIEQHS2.js.map +1 -0
  16. package/dist/chunk-AQ5FAAP6.cjs +168 -0
  17. package/dist/chunk-AQ5FAAP6.cjs.map +1 -0
  18. package/dist/chunk-ERKU5FDV.cjs +407 -0
  19. package/dist/chunk-ERKU5FDV.cjs.map +1 -0
  20. package/dist/chunk-FKX46GKE.cjs +36 -0
  21. package/dist/chunk-FKX46GKE.cjs.map +1 -0
  22. package/dist/chunk-GVBGVF6Y.js +3 -0
  23. package/dist/{chunk-SY4NYXKN.js.map → chunk-GVBGVF6Y.js.map} +1 -1
  24. package/dist/chunk-HMTCQOEV.js +1319 -0
  25. package/dist/chunk-HMTCQOEV.js.map +1 -0
  26. package/dist/chunk-IRFFN74K.cjs +89 -0
  27. package/dist/chunk-IRFFN74K.cjs.map +1 -0
  28. package/dist/chunk-IUDN2CGP.js +863 -0
  29. package/dist/chunk-IUDN2CGP.js.map +1 -0
  30. package/dist/chunk-JEVWEGSE.js +95 -0
  31. package/dist/chunk-JEVWEGSE.js.map +1 -0
  32. package/dist/chunk-KCZKC3OG.js +61 -0
  33. package/dist/chunk-KCZKC3OG.js.map +1 -0
  34. package/dist/chunk-KUB3TYG2.cjs +102 -0
  35. package/dist/chunk-KUB3TYG2.cjs.map +1 -0
  36. package/dist/chunk-L5FXGEKX.cjs +114 -0
  37. package/dist/chunk-L5FXGEKX.cjs.map +1 -0
  38. package/dist/chunk-LNBAFOVK.cjs +14 -0
  39. package/dist/chunk-LNBAFOVK.cjs.map +1 -0
  40. package/dist/chunk-M2TPAU2F.js +79 -0
  41. package/dist/chunk-M2TPAU2F.js.map +1 -0
  42. package/dist/chunk-MHTTFNK2.cjs +890 -0
  43. package/dist/chunk-MHTTFNK2.cjs.map +1 -0
  44. package/dist/chunk-NDHTMYPA.cjs +844 -0
  45. package/dist/chunk-NDHTMYPA.cjs.map +1 -0
  46. package/dist/chunk-PLQNNXS2.js +382 -0
  47. package/dist/chunk-PLQNNXS2.js.map +1 -0
  48. package/dist/chunk-QYBWIJXZ.js +98 -0
  49. package/dist/chunk-QYBWIJXZ.js.map +1 -0
  50. package/dist/chunk-U56KVTK5.cjs +68 -0
  51. package/dist/chunk-U56KVTK5.cjs.map +1 -0
  52. package/dist/chunk-X2BLERM5.cjs +1346 -0
  53. package/dist/chunk-X2BLERM5.cjs.map +1 -0
  54. package/dist/chunk-ZOJBDFKU.js +12 -0
  55. package/dist/chunk-ZOJBDFKU.js.map +1 -0
  56. package/dist/chunk-ZXWOZZXO.cjs +94 -0
  57. package/dist/chunk-ZXWOZZXO.cjs.map +1 -0
  58. package/dist/editor.cjs +60 -0
  59. package/dist/editor.cjs.map +1 -0
  60. package/dist/editor.d.cts +190 -0
  61. package/dist/editor.d.ts +190 -0
  62. package/dist/editor.js +7 -0
  63. package/dist/editor.js.map +1 -0
  64. package/dist/index.cjs +418 -3746
  65. package/dist/index.cjs.map +1 -1
  66. package/dist/index.d.cts +73 -7893
  67. package/dist/index.d.ts +73 -7893
  68. package/dist/index.js +23 -3658
  69. package/dist/index.js.map +1 -1
  70. package/dist/messages-Bi0JxNIH.d.cts +23 -0
  71. package/dist/messages-Bi0JxNIH.d.ts +23 -0
  72. package/dist/print.cjs +354 -0
  73. package/dist/print.cjs.map +1 -0
  74. package/dist/print.d.cts +43 -0
  75. package/dist/print.d.ts +43 -0
  76. package/dist/print.js +336 -0
  77. package/dist/print.js.map +1 -0
  78. package/dist/puck.cjs +11 -7
  79. package/dist/puck.cjs.map +1 -1
  80. package/dist/puck.d.cts +1 -1
  81. package/dist/puck.d.ts +1 -1
  82. package/dist/puck.js +1 -1
  83. package/dist/render.cjs +72 -0
  84. package/dist/render.cjs.map +1 -0
  85. package/dist/render.d.cts +93 -0
  86. package/dist/render.d.ts +93 -0
  87. package/dist/render.js +7 -0
  88. package/dist/render.js.map +1 -0
  89. package/dist/theme-BuEFpQeZ.d.cts +112 -0
  90. package/dist/theme-BuEFpQeZ.d.ts +112 -0
  91. package/dist/types-BgIugNWW.d.cts +25 -0
  92. package/dist/types-BgIugNWW.d.ts +25 -0
  93. package/dist/types-CvKSS1Sy.d.cts +38 -0
  94. package/dist/types-CvKSS1Sy.d.ts +38 -0
  95. package/dist/variables.cjs +95 -0
  96. package/dist/variables.cjs.map +1 -0
  97. package/dist/variables.d.cts +74 -0
  98. package/dist/variables.d.ts +74 -0
  99. package/dist/variables.js +6 -0
  100. package/dist/variables.js.map +1 -0
  101. package/package.json +39 -8
  102. package/dist/chunk-SY4NYXKN.js +0 -3
@@ -0,0 +1,824 @@
1
+ import { DEFAULT_DOCUMENT_COLORS, buildConfig, useDocumentFont, DocumentThemeProvider, fontStack } from './chunk-PLQNNXS2.js';
2
+ import { resolveDocumentVariables } from './chunk-2EBYURIX.js';
3
+ import { extractBindingKeys, CatalogProvider, ResolvedProvider } from './chunk-M2TPAU2F.js';
4
+ import { createContext, useContext, useMemo, useState, useEffect } from 'react';
5
+ import { Render } from '@puckeditor/core';
6
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+ import styled6 from 'styled-components';
8
+
9
+ function DocumentRenderer({
10
+ registry,
11
+ data,
12
+ theme = {},
13
+ catalog = [],
14
+ resolver,
15
+ ctx = {},
16
+ resolvedVariables,
17
+ unresolvedDisplay = "placeholder",
18
+ metadata
19
+ }) {
20
+ const config = useMemo(() => buildConfig(registry), [registry]);
21
+ const [resolved, setResolved] = useState(resolvedVariables ?? {});
22
+ useDocumentFont(theme.documentFont);
23
+ const keysHash = useMemo(() => extractBindingKeys(data).sort().join("|"), [data]);
24
+ const ctxHash = JSON.stringify(ctx);
25
+ useEffect(() => {
26
+ if (resolvedVariables || !resolver || keysHash === "") return void 0;
27
+ let active = true;
28
+ resolveDocumentVariables(data, catalog, resolver, ctx).then((next) => {
29
+ if (active) setResolved(next);
30
+ });
31
+ return () => {
32
+ active = false;
33
+ };
34
+ }, [resolvedVariables, resolver, catalog, keysHash, ctxHash]);
35
+ const effective = resolvedVariables ?? resolved;
36
+ return /* @__PURE__ */ jsx(DocumentThemeProvider, { theme, children: /* @__PURE__ */ jsx(CatalogProvider, { catalog, children: /* @__PURE__ */ jsx(ResolvedProvider, { resolved: effective, unresolvedDisplay, children: /* @__PURE__ */ jsx(Render, { config, data, metadata }) }) }) });
37
+ }
38
+ var CoverEditContext = createContext({ editable: false });
39
+ function CoverField({ name, value, placeholder, as: Tag = "span", className }) {
40
+ const { editable, onFieldChange } = useContext(CoverEditContext);
41
+ if (!editable) return value ? /* @__PURE__ */ jsx(Tag, { className, children: value }) : null;
42
+ return /* @__PURE__ */ jsx(
43
+ Tag,
44
+ {
45
+ className,
46
+ "data-cover-field": name,
47
+ "data-placeholder": placeholder,
48
+ contentEditable: true,
49
+ suppressContentEditableWarning: true,
50
+ onBlur: (e) => onFieldChange?.(name, e.currentTarget.textContent?.trim() ?? ""),
51
+ onKeyDown: (e) => {
52
+ if (e.key === "Enter") {
53
+ e.preventDefault();
54
+ e.currentTarget.blur();
55
+ }
56
+ },
57
+ children: value
58
+ }
59
+ );
60
+ }
61
+ function CoverImage({ src, className }) {
62
+ const { editable, onImagePick } = useContext(CoverEditContext);
63
+ if (!editable) {
64
+ return src ? /* @__PURE__ */ jsx("div", { className, "data-cover-image": true, children: /* @__PURE__ */ jsx("img", { src, alt: "" }) }) : null;
65
+ }
66
+ return /* @__PURE__ */ jsx(
67
+ "div",
68
+ {
69
+ className,
70
+ "data-cover-image": true,
71
+ role: "button",
72
+ tabIndex: 0,
73
+ onClick: () => onImagePick?.(),
74
+ onKeyDown: (e) => {
75
+ if (e.key === "Enter" || e.key === " ") {
76
+ e.preventDefault();
77
+ onImagePick?.();
78
+ }
79
+ },
80
+ children: src ? /* @__PURE__ */ jsx("img", { src, alt: "" }) : /* @__PURE__ */ jsx("span", { children: "Adicionar imagem" })
81
+ }
82
+ );
83
+ }
84
+ var CoverFrame = styled6.div`
85
+ position: relative;
86
+ width: 100%;
87
+ height: 100%;
88
+ display: flex;
89
+ flex-direction: column;
90
+ overflow: hidden;
91
+ font-family: ${(p) => p.$font};
92
+ background: ${(p) => p.$bg ?? "#FFFFFF"};
93
+ color: ${(p) => p.$color ?? "#111827"};
94
+ overflow-wrap: break-word;
95
+
96
+ [data-cover-field][contenteditable] {
97
+ cursor: text;
98
+ border-radius: 3px;
99
+ outline: 1px dashed transparent;
100
+ outline-offset: 3px;
101
+ transition: outline-color 0.12s ease;
102
+ }
103
+ [data-cover-field][contenteditable]:hover {
104
+ outline-color: rgba(0, 90, 195, 0.45);
105
+ }
106
+ [data-cover-field][contenteditable]:focus {
107
+ outline: 1px solid rgba(0, 90, 195, 0.8);
108
+ }
109
+ [data-cover-field][contenteditable]:empty::before {
110
+ content: attr(data-placeholder);
111
+ opacity: 0.45;
112
+ font-style: italic;
113
+ }
114
+ [data-cover-image][role='button'] {
115
+ cursor: pointer;
116
+ outline: 1px dashed transparent;
117
+ outline-offset: 3px;
118
+ transition: outline-color 0.12s ease;
119
+ }
120
+ [data-cover-image][role='button']:hover {
121
+ outline-color: rgba(0, 90, 195, 0.45);
122
+ }
123
+ [data-cover-image] img {
124
+ width: 100%;
125
+ height: 100%;
126
+ object-fit: cover;
127
+ display: block;
128
+ }
129
+ `;
130
+ var FullBleedImage = styled6.div`
131
+ position: absolute;
132
+ inset: 0;
133
+
134
+ & > [data-cover-image] {
135
+ position: absolute;
136
+ inset: 0;
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ color: #ffffff;
141
+ }
142
+
143
+ &::after {
144
+ content: '';
145
+ position: absolute;
146
+ inset: 0;
147
+ background: ${(p) => p.$overlay};
148
+ opacity: ${(p) => p.$overlayOpacity ?? 0.55};
149
+ }
150
+ `;
151
+ var CoverLogoImg = styled6.img`
152
+ max-height: 48px;
153
+ max-width: 160px;
154
+ object-fit: contain;
155
+ `;
156
+ styled6.div`
157
+ font-size: 11px;
158
+ letter-spacing: 0.04em;
159
+ opacity: 0.8;
160
+ `;
161
+ var HAIRLINE = "#d9d9d9";
162
+ var Chrome = styled6.div`
163
+ position: relative;
164
+ display: flex;
165
+ flex-direction: column;
166
+ justify-content: space-between;
167
+ height: 100%;
168
+ padding: 0 7cqw 8cqw;
169
+ `;
170
+ var TopRow = styled6.div`
171
+ display: flex;
172
+ justify-content: space-between;
173
+ align-items: flex-start;
174
+ gap: 4cqw;
175
+ `;
176
+ var Logo = styled6(CoverLogoImg)`
177
+ max-width: 17cqw;
178
+ max-height: 17cqw;
179
+ `;
180
+ var Company = styled6(CoverField)`
181
+ display: block;
182
+ margin-top: 5cqw;
183
+ max-width: 45cqw;
184
+ font-size: 2.94cqw;
185
+ font-weight: 800;
186
+ line-height: 1.15;
187
+ letter-spacing: 0.3cqw;
188
+ text-align: right;
189
+ text-transform: uppercase;
190
+ `;
191
+ var Head = styled6.div`
192
+ display: flex;
193
+ flex-direction: column;
194
+
195
+ &::before,
196
+ &::after {
197
+ content: '';
198
+ width: 19cqw;
199
+ height: 0.9cqw;
200
+ background: ${HAIRLINE};
201
+ }
202
+ &::before {
203
+ margin-bottom: 6cqw;
204
+ }
205
+ &::after {
206
+ margin-top: 6cqw;
207
+ }
208
+ `;
209
+ var Title = styled6(CoverField)`
210
+ display: block;
211
+ font-size: 8.82cqw;
212
+ font-weight: 800;
213
+ line-height: 1.15;
214
+ letter-spacing: 0.88cqw;
215
+ text-transform: uppercase;
216
+ `;
217
+ var Subtitle = styled6(CoverField)`
218
+ display: block;
219
+ margin-top: 3cqw;
220
+ font-size: 3.53cqw;
221
+ font-weight: 400;
222
+ line-height: 1.3;
223
+ `;
224
+ function Model1({ fields, theme, accent, textColor, bgColor }) {
225
+ return /* @__PURE__ */ jsxs(CoverFrame, { $font: fontStack(theme?.documentFont), $bg: fields.imageUrl ? void 0 : bgColor, $color: textColor, children: [
226
+ fields.imageUrl ? /* @__PURE__ */ jsx(FullBleedImage, { $overlay: accent, $overlayOpacity: 0.85, children: /* @__PURE__ */ jsx(CoverImage, { src: fields.imageUrl }) }) : null,
227
+ /* @__PURE__ */ jsxs(Chrome, { children: [
228
+ /* @__PURE__ */ jsxs(TopRow, { children: [
229
+ theme?.logo?.url ? /* @__PURE__ */ jsx(Logo, { src: theme.logo.url, alt: "" }) : /* @__PURE__ */ jsx("span", {}),
230
+ /* @__PURE__ */ jsx(Company, { name: "presentedBy", value: fields.presentedBy, placeholder: "Nome da empresa" })
231
+ ] }),
232
+ /* @__PURE__ */ jsxs(Head, { children: [
233
+ /* @__PURE__ */ jsx(Title, { name: "title", value: fields.title, placeholder: "Digite o t\xEDtulo..." }),
234
+ /* @__PURE__ */ jsx(Subtitle, { name: "subtitle", value: fields.subtitle, placeholder: "Digite o subt\xEDtulo..." })
235
+ ] })
236
+ ] })
237
+ ] });
238
+ }
239
+ var BAND_BG = "#e8ecf1";
240
+ var HAIRLINE2 = "#d5dae1";
241
+ var Hairline = styled6.div`
242
+ position: absolute;
243
+ left: 4.7%;
244
+ top: 3%;
245
+ height: 94%;
246
+ width: 1px;
247
+ background: ${HAIRLINE2};
248
+ `;
249
+ var Logo2 = styled6(CoverLogoImg)`
250
+ position: absolute;
251
+ left: 10.9%;
252
+ top: 6%;
253
+ max-height: 13.6cqw;
254
+ max-width: 32.7cqw;
255
+ `;
256
+ var AccentBar = styled6.div`
257
+ position: absolute;
258
+ left: 4.7%;
259
+ top: 22.3%;
260
+ width: 1.13cqw;
261
+ height: 28.7%;
262
+ background: ${(p) => p.$accent};
263
+ `;
264
+ var Head2 = styled6.div`
265
+ position: absolute;
266
+ left: 10.9%;
267
+ right: 6%;
268
+ top: 22.3%;
269
+ display: flex;
270
+ flex-direction: column;
271
+ `;
272
+ var Title2 = styled6(CoverField)`
273
+ display: block;
274
+ font-weight: 800;
275
+ font-size: 12.6cqw;
276
+ line-height: 1.2;
277
+ letter-spacing: -0.63cqw;
278
+ text-transform: uppercase;
279
+ `;
280
+ var DateLine = styled6(CoverField)`
281
+ display: block;
282
+ margin-top: 3.3cqw;
283
+ font-size: 4.5cqw;
284
+ font-weight: 400;
285
+ `;
286
+ var Band = styled6.div`
287
+ position: absolute;
288
+ left: 0;
289
+ bottom: 0;
290
+ width: 100%;
291
+ height: 29.2%;
292
+ background: ${BAND_BG};
293
+ display: flex;
294
+ flex-direction: column;
295
+ justify-content: center;
296
+ gap: 4.3cqw;
297
+ padding-left: 10.9%;
298
+ padding-right: 6%;
299
+ box-sizing: border-box;
300
+ `;
301
+ var Label = styled6.div`
302
+ font-size: 2.77cqw;
303
+ font-weight: 400;
304
+ `;
305
+ var Value = styled6(CoverField)`
306
+ display: block;
307
+ margin-top: 1cqw;
308
+ font-size: 3.4cqw;
309
+ font-weight: 700;
310
+ line-height: 1.3;
311
+ text-transform: uppercase;
312
+ `;
313
+ function Model2({ fields, theme, accent, textColor, bgColor }) {
314
+ const { editable } = useContext(CoverEditContext);
315
+ const showHead = editable || Boolean(fields.title || fields.date);
316
+ const showPrepared = editable || Boolean(fields.preparedFor);
317
+ const showPresented = editable || Boolean(fields.presentedBy);
318
+ const hasBand = showPrepared || showPresented;
319
+ return /* @__PURE__ */ jsxs(CoverFrame, { $font: fontStack(theme?.documentFont), $bg: bgColor, $color: textColor, children: [
320
+ theme?.logo?.url ? /* @__PURE__ */ jsx(Logo2, { src: theme.logo.url, alt: "" }) : null,
321
+ showHead ? /* @__PURE__ */ jsxs(Fragment, { children: [
322
+ /* @__PURE__ */ jsx(AccentBar, { $accent: accent }),
323
+ /* @__PURE__ */ jsxs(Head2, { "data-cover-head": true, children: [
324
+ /* @__PURE__ */ jsx(Title2, { name: "title", value: fields.title, placeholder: "Digite o t\xEDtulo..." }),
325
+ /* @__PURE__ */ jsx(DateLine, { name: "date", value: fields.date, placeholder: "M\xEAs e ano" })
326
+ ] })
327
+ ] }) : null,
328
+ hasBand ? /* @__PURE__ */ jsxs(Band, { "data-cover-band": true, children: [
329
+ showPrepared ? /* @__PURE__ */ jsxs("div", { children: [
330
+ /* @__PURE__ */ jsx(Label, { children: "Preparada para" }),
331
+ /* @__PURE__ */ jsx(Value, { name: "preparedFor", value: fields.preparedFor, placeholder: "Nome do cliente" })
332
+ ] }) : null,
333
+ showPresented ? /* @__PURE__ */ jsxs("div", { children: [
334
+ /* @__PURE__ */ jsx(Label, { children: "Apresentada por" }),
335
+ /* @__PURE__ */ jsx(Value, { name: "presentedBy", value: fields.presentedBy, placeholder: "Nome da empresa" })
336
+ ] }) : null
337
+ ] }) : null,
338
+ /* @__PURE__ */ jsx(Hairline, {})
339
+ ] });
340
+ }
341
+ var ImageBand = styled6.div`
342
+ position: relative;
343
+ width: 100%;
344
+ height: 42.9cqw;
345
+ flex-shrink: 0;
346
+ overflow: hidden;
347
+ background: #1a1a1a;
348
+
349
+ & > [data-cover-image] {
350
+ position: absolute;
351
+ inset: 0;
352
+ }
353
+ `;
354
+ var Logo3 = styled6(CoverLogoImg)`
355
+ position: absolute;
356
+ top: 1.2cqw;
357
+ right: 5.9cqw;
358
+ max-width: 14.7cqw;
359
+ max-height: 14.7cqw;
360
+ `;
361
+ var Body = styled6.div`
362
+ flex: 1;
363
+ display: flex;
364
+ flex-direction: column;
365
+ padding: 11.5cqw 9.4cqw 7.35cqw;
366
+ `;
367
+ var DateField = styled6(CoverField)`
368
+ display: block;
369
+ font-size: 2.94cqw;
370
+ font-weight: 400;
371
+ opacity: 0.5;
372
+ `;
373
+ var Title3 = styled6(CoverField)`
374
+ display: block;
375
+ margin-top: 2.35cqw;
376
+ font-size: 10.6cqw;
377
+ font-weight: 800;
378
+ line-height: 1.2;
379
+ text-transform: uppercase;
380
+ `;
381
+ var Subtitle2 = styled6(CoverField)`
382
+ display: block;
383
+ margin-top: 4.7cqw;
384
+ font-size: 3.53cqw;
385
+ font-weight: 400;
386
+ opacity: 0.62;
387
+ `;
388
+ var Parties = styled6.div`
389
+ margin-top: 13.8cqw;
390
+ display: flex;
391
+ flex-direction: column;
392
+ gap: 4.7cqw;
393
+ `;
394
+ var Label2 = styled6.div`
395
+ font-size: 3.53cqw;
396
+ font-weight: 600;
397
+ `;
398
+ var Value2 = styled6(CoverField)`
399
+ display: block;
400
+ margin-top: 0.7cqw;
401
+ font-size: 3.53cqw;
402
+ font-weight: 400;
403
+ opacity: 0.62;
404
+ `;
405
+ function Model3({ fields, theme, textColor, bgColor }) {
406
+ const { editable } = useContext(CoverEditContext);
407
+ const showPresented = editable || Boolean(fields.presentedBy);
408
+ const showPrepared = editable || Boolean(fields.preparedFor);
409
+ return /* @__PURE__ */ jsxs(CoverFrame, { $font: fontStack(theme?.documentFont), $bg: bgColor, $color: textColor, children: [
410
+ /* @__PURE__ */ jsxs(ImageBand, { children: [
411
+ fields.imageUrl ? /* @__PURE__ */ jsx(CoverImage, { src: fields.imageUrl }) : null,
412
+ theme?.logo?.url ? /* @__PURE__ */ jsx(Logo3, { src: theme.logo.url, alt: "" }) : null
413
+ ] }),
414
+ /* @__PURE__ */ jsxs(Body, { children: [
415
+ /* @__PURE__ */ jsx(DateField, { name: "date", value: fields.date, placeholder: "M\xEAs e ano" }),
416
+ /* @__PURE__ */ jsx(Title3, { name: "title", value: fields.title, placeholder: "Digite o t\xEDtulo..." }),
417
+ /* @__PURE__ */ jsx(Subtitle2, { name: "subtitle", value: fields.subtitle, placeholder: "Digite o subt\xEDtulo..." }),
418
+ showPresented || showPrepared ? /* @__PURE__ */ jsxs(Parties, { "data-cover-parties": true, children: [
419
+ showPresented ? /* @__PURE__ */ jsxs("div", { children: [
420
+ /* @__PURE__ */ jsx(Label2, { children: "Apresentada por" }),
421
+ /* @__PURE__ */ jsx(Value2, { name: "presentedBy", value: fields.presentedBy, placeholder: "Nome da empresa" })
422
+ ] }) : null,
423
+ showPrepared ? /* @__PURE__ */ jsxs("div", { children: [
424
+ /* @__PURE__ */ jsx(Label2, { children: "Preparada para" }),
425
+ /* @__PURE__ */ jsx(Value2, { name: "preparedFor", value: fields.preparedFor, placeholder: "Nome do cliente" })
426
+ ] }) : null
427
+ ] }) : null
428
+ ] })
429
+ ] });
430
+ }
431
+ var Body2 = styled6.div`
432
+ display: flex;
433
+ flex-direction: column;
434
+ height: 100%;
435
+ padding: 4.12cqw 9.4cqw 0;
436
+ `;
437
+ var Logo4 = styled6(CoverLogoImg)`
438
+ max-width: 14.7cqw;
439
+ max-height: 14.7cqw;
440
+ `;
441
+ var Head3 = styled6.div`
442
+ margin-top: 23.2cqw;
443
+ display: flex;
444
+ flex-direction: column;
445
+ align-items: flex-start;
446
+ `;
447
+ var DateChip = styled6(CoverField)`
448
+ display: inline-block;
449
+ align-self: flex-start;
450
+ max-width: 100%;
451
+ background: ${(p) => p.$accent};
452
+ border-radius: 1000px;
453
+ padding: 1.18cqw 2.94cqw;
454
+ font-size: 2.94cqw;
455
+ font-weight: 400;
456
+ letter-spacing: -0.29cqw;
457
+ color: #ffffff;
458
+ `;
459
+ var Title4 = styled6(CoverField)`
460
+ display: block;
461
+ align-self: stretch;
462
+ margin-top: 3.5cqw;
463
+ font-size: 14.1cqw;
464
+ font-weight: 300;
465
+ line-height: 1.1;
466
+ letter-spacing: -1.41cqw;
467
+ `;
468
+ var Footer = styled6.div`
469
+ margin-top: auto;
470
+ padding-bottom: 11cqw;
471
+ display: flex;
472
+ gap: 6cqw;
473
+ `;
474
+ var Party = styled6.div`
475
+ flex: 1;
476
+ min-width: 0;
477
+ `;
478
+ var Label3 = styled6.div`
479
+ font-size: 3.53cqw;
480
+ font-weight: 300;
481
+ letter-spacing: -0.35cqw;
482
+ opacity: 0.72;
483
+ `;
484
+ var Value3 = styled6(CoverField)`
485
+ display: block;
486
+ margin-top: 1.5cqw;
487
+ font-size: 4.12cqw;
488
+ font-weight: 500;
489
+ letter-spacing: -0.41cqw;
490
+ `;
491
+ function Model4({ fields, theme, accent, textColor, bgColor }) {
492
+ const { editable } = useContext(CoverEditContext);
493
+ const showPrepared = editable || Boolean(fields.preparedFor);
494
+ const showPresented = editable || Boolean(fields.presentedBy);
495
+ return /* @__PURE__ */ jsx(CoverFrame, { $font: fontStack(theme?.documentFont), $bg: bgColor, $color: textColor, children: /* @__PURE__ */ jsxs(Body2, { children: [
496
+ theme?.logo?.url ? /* @__PURE__ */ jsx(Logo4, { src: theme.logo.url, alt: "" }) : /* @__PURE__ */ jsx("span", {}),
497
+ /* @__PURE__ */ jsxs(Head3, { children: [
498
+ /* @__PURE__ */ jsx(DateChip, { name: "date", value: fields.date, placeholder: "M\xEAs e ano", $accent: accent }),
499
+ /* @__PURE__ */ jsx(Title4, { name: "title", value: fields.title, placeholder: "Digite o t\xEDtulo..." })
500
+ ] }),
501
+ showPrepared || showPresented ? /* @__PURE__ */ jsxs(Footer, { "data-cover-footer": true, children: [
502
+ showPrepared ? /* @__PURE__ */ jsxs(Party, { children: [
503
+ /* @__PURE__ */ jsx(Label3, { children: "Apresentada para" }),
504
+ /* @__PURE__ */ jsx(Value3, { name: "preparedFor", value: fields.preparedFor, placeholder: "Nome do cliente" })
505
+ ] }) : null,
506
+ showPresented ? /* @__PURE__ */ jsxs(Party, { children: [
507
+ /* @__PURE__ */ jsx(Label3, { children: "Apresentada por" }),
508
+ /* @__PURE__ */ jsx(Value3, { name: "presentedBy", value: fields.presentedBy, placeholder: "Nome da empresa" })
509
+ ] }) : null
510
+ ] }) : null
511
+ ] }) });
512
+ }
513
+ var Spacer = styled6.div`
514
+ height: 24.4cqw;
515
+ flex-shrink: 0;
516
+ `;
517
+ var ImageBand2 = styled6.div`
518
+ position: relative;
519
+ width: 100%;
520
+ height: 64.4cqw;
521
+ flex-shrink: 0;
522
+ overflow: hidden;
523
+ background: #e8eef7;
524
+ `;
525
+ var Bar = styled6.div`
526
+ position: absolute;
527
+ width: 47.9cqw;
528
+ height: 2.06cqw;
529
+ background: ${(p) => p.$accent};
530
+ `;
531
+ var BarTop = styled6(Bar)`
532
+ top: 0;
533
+ right: 0;
534
+ `;
535
+ var BarBottom = styled6(Bar)`
536
+ bottom: 0;
537
+ left: 0;
538
+ `;
539
+ var Bottom = styled6.div`
540
+ flex: 1;
541
+ display: flex;
542
+ align-items: center;
543
+ gap: 7cqw;
544
+ padding: 0 4.7cqw 4cqw 7cqw;
545
+ `;
546
+ var LogoCol = styled6.div`
547
+ flex-shrink: 0;
548
+ width: 29.4cqw;
549
+ `;
550
+ var Logo5 = styled6(CoverLogoImg)`
551
+ max-width: 29.4cqw;
552
+ max-height: 29.4cqw;
553
+ `;
554
+ var TextCol = styled6.div`
555
+ flex: 1;
556
+ min-width: 0;
557
+ `;
558
+ var Title5 = styled6(CoverField)`
559
+ display: block;
560
+ font-size: 7.06cqw;
561
+ font-weight: 700;
562
+ line-height: 1.2;
563
+ text-transform: uppercase;
564
+ `;
565
+ var Subtitle3 = styled6(CoverField)`
566
+ display: block;
567
+ margin-top: 2.47cqw;
568
+ font-size: 2.94cqw;
569
+ font-weight: 400;
570
+ line-height: 1.2;
571
+ opacity: 0.72;
572
+ `;
573
+ var Presented = styled6.div`
574
+ margin-top: 3.5cqw;
575
+ font-size: 2.94cqw;
576
+ font-weight: 600;
577
+ line-height: 1.2;
578
+ `;
579
+ var PresentedValue = styled6(CoverField)`
580
+ font-weight: 600;
581
+ `;
582
+ function Model5({ fields, theme, accent, textColor, bgColor }) {
583
+ const { editable } = useContext(CoverEditContext);
584
+ const showPresented = editable || Boolean(fields.presentedBy);
585
+ return /* @__PURE__ */ jsxs(CoverFrame, { $font: fontStack(theme?.documentFont), $bg: bgColor, $color: textColor, children: [
586
+ /* @__PURE__ */ jsx(Spacer, {}),
587
+ /* @__PURE__ */ jsx(ImageBand2, { children: fields.imageUrl ? /* @__PURE__ */ jsx(FullBleedImage, { $overlay: accent, $overlayOpacity: 0.5, children: /* @__PURE__ */ jsx(CoverImage, { src: fields.imageUrl }) }) : null }),
588
+ /* @__PURE__ */ jsxs(Bottom, { children: [
589
+ /* @__PURE__ */ jsx(LogoCol, { children: theme?.logo?.url ? /* @__PURE__ */ jsx(Logo5, { src: theme.logo.url, alt: "" }) : null }),
590
+ /* @__PURE__ */ jsxs(TextCol, { children: [
591
+ /* @__PURE__ */ jsx(Title5, { name: "title", value: fields.title, placeholder: "Digite o t\xEDtulo..." }),
592
+ /* @__PURE__ */ jsx(Subtitle3, { name: "subtitle", value: fields.subtitle, placeholder: "Digite o subt\xEDtulo..." }),
593
+ showPresented ? /* @__PURE__ */ jsxs(Presented, { children: [
594
+ "Apresentada por:",
595
+ " ",
596
+ /* @__PURE__ */ jsx(PresentedValue, { name: "presentedBy", value: fields.presentedBy, placeholder: "Nome da empresa" })
597
+ ] }) : null
598
+ ] })
599
+ ] }),
600
+ /* @__PURE__ */ jsx(BarTop, { $accent: accent }),
601
+ /* @__PURE__ */ jsx(BarBottom, { $accent: accent })
602
+ ] });
603
+ }
604
+
605
+ // src/render/chrome/covers/index.ts
606
+ var COVER_TEMPLATES = {
607
+ "model-1": Model1,
608
+ "model-2": Model2,
609
+ "model-3": Model3,
610
+ "model-4": Model4,
611
+ "model-5": Model5
612
+ };
613
+ var COVER_TEMPLATE_IDS = Object.keys(COVER_TEMPLATES);
614
+ var resolveCoverAccent = (accent, theme) => accent ?? theme?.colors?.brand ?? DEFAULT_DOCUMENT_COLORS.brand;
615
+ var COVER_SURFACES = {
616
+ "model-1": "brand",
617
+ "model-2": "background",
618
+ "model-3": "brand",
619
+ "model-4": "brand",
620
+ "model-5": "background"
621
+ };
622
+ var ON_BRAND_TEXT = "#FFFFFF";
623
+ var resolveCoverColors = (templateId, { accent, textColor, bgColor }, theme) => {
624
+ const colors = { ...DEFAULT_DOCUMENT_COLORS, ...theme?.colors };
625
+ const onBrand = (COVER_SURFACES[templateId ?? ""] ?? COVER_SURFACES["model-1"]) === "brand";
626
+ const resolvedAccent = resolveCoverAccent(accent, theme);
627
+ return {
628
+ accent: resolvedAccent,
629
+ textColor: textColor ?? (onBrand ? ON_BRAND_TEXT : colors.text),
630
+ bgColor: bgColor ?? (onBrand ? resolvedAccent : colors.background)
631
+ };
632
+ };
633
+ function CoverPage({ templateId, accent, fields, theme, textColor, bgColor }) {
634
+ if (!templateId) return null;
635
+ const colors = { ...DEFAULT_DOCUMENT_COLORS, ...theme?.colors };
636
+ const vars = {
637
+ ["--doc-brand"]: colors.brand,
638
+ ["--doc-text"]: colors.text,
639
+ ["--doc-bg"]: colors.background
640
+ };
641
+ const Template = COVER_TEMPLATES[templateId] ?? COVER_TEMPLATES["model-1"];
642
+ const resolved = resolveCoverColors(templateId, { accent, textColor, bgColor }, theme);
643
+ return /* @__PURE__ */ jsx("section", { className: "dg-cover", style: vars, children: /* @__PURE__ */ jsx(Template, { fields: fields ?? {}, theme, ...resolved }) });
644
+ }
645
+ var BOX = { width: 14, height: 14, "aria-hidden": true };
646
+ var stroke = (inner) => /* @__PURE__ */ jsx(
647
+ "svg",
648
+ {
649
+ ...BOX,
650
+ viewBox: "0 0 24 24",
651
+ fill: "none",
652
+ stroke: "currentColor",
653
+ strokeWidth: 2,
654
+ strokeLinecap: "round",
655
+ strokeLinejoin: "round",
656
+ dangerouslySetInnerHTML: { __html: inner }
657
+ }
658
+ );
659
+ var brand = (viewBox, d) => /* @__PURE__ */ jsx("svg", { ...BOX, viewBox, fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d }) });
660
+ var COMPANY_INFO_ICONS = {
661
+ companyName: stroke(
662
+ '<path d="M12 10h.01" /><path d="M12 14h.01" /><path d="M12 6h.01" /><path d="M16 10h.01" /><path d="M16 14h.01" /><path d="M16 6h.01" /><path d="M8 10h.01" /><path d="M8 14h.01" /><path d="M8 6h.01" /><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" /><rect x="4" y="2" width="16" height="20" rx="2" />'
663
+ ),
664
+ cnpj: stroke(
665
+ '<path d="M16 10h2" /><path d="M16 14h2" /><path d="M6.17 15a3 3 0 0 1 5.66 0" /><circle cx="9" cy="11" r="2" /><rect x="2" y="5" width="20" height="14" rx="2" />'
666
+ ),
667
+ phone: stroke(
668
+ '<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" />'
669
+ ),
670
+ email: stroke(
671
+ '<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" /><rect x="2" y="4" width="20" height="16" rx="2" />'
672
+ ),
673
+ address: stroke(
674
+ '<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx="12" cy="10" r="3" />'
675
+ ),
676
+ site: stroke(
677
+ '<circle cx="12" cy="12" r="10" /><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /><path d="M2 12h20" />'
678
+ ),
679
+ instagram: brand(
680
+ "0 0 448 512",
681
+ "M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"
682
+ ),
683
+ facebook: brand(
684
+ "0 0 320 512",
685
+ "M80 299.3V512H196V299.3h86.5l18-97.8H196V166.9c0-51.7 20.3-71.5 72.7-71.5c16.3 0 29.4 .4 37 1.2V7.9C291.4 4 256.4 0 236.2 0C129.3 0 80 50.5 80 159.4v42.1H14v97.8H80z"
686
+ ),
687
+ twitter: brand(
688
+ "0 0 512 512",
689
+ "M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"
690
+ ),
691
+ linkedin: brand(
692
+ "0 0 448 512",
693
+ "M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"
694
+ )
695
+ };
696
+ var HeaderRoot = styled6.header`
697
+ height: 100%;
698
+ color: ${(props) => props.$color};
699
+ font-family: ${(props) => props.$font};
700
+ line-height: 1.5;
701
+ `;
702
+ var HeaderLayout = styled6.div`
703
+ display: flex;
704
+ align-items: center;
705
+ justify-content: space-between;
706
+ flex-direction: ${(props) => props.$reverse ? "row-reverse" : "row"};
707
+ gap: 16px;
708
+ height: 100%;
709
+ padding: 12px 0;
710
+ `;
711
+ var HeaderInfo = styled6.div`
712
+ display: flex;
713
+ flex-direction: column;
714
+ justify-content: center;
715
+ align-items: ${(props) => props.$alignEnd ? "flex-end" : "flex-start"};
716
+ min-width: 0;
717
+ font-size: 12px;
718
+ text-align: ${(props) => props.$alignEnd ? "right" : "left"};
719
+ `;
720
+ var InfoLine = styled6.span`
721
+ display: flex;
722
+ flex-direction: ${(props) => props.$iconAfter ? "row-reverse" : "row"};
723
+ align-items: center;
724
+ gap: 8px;
725
+ height: 22px;
726
+ font-weight: ${(props) => props.$strong ? 600 : 400};
727
+ font-size: ${(props) => props.$strong ? "12.5px" : "12px"};
728
+
729
+ svg {
730
+ flex-shrink: 0;
731
+ }
732
+ `;
733
+ var HeaderLogo = styled6.img`
734
+ max-height: 44px;
735
+ max-width: 180px;
736
+ object-fit: contain;
737
+ `;
738
+ var FooterRoot = styled6.footer`
739
+ height: 100%;
740
+ color: ${(props) => props.$color};
741
+ font-family: ${(props) => props.$font};
742
+ line-height: 1.5;
743
+ `;
744
+ var FooterLayout = styled6.div`
745
+ display: flex;
746
+ flex-direction: column;
747
+ justify-content: center;
748
+ height: 100%;
749
+ padding: 12px 0;
750
+ `;
751
+ var FooterInfoRows = styled6.div`
752
+ display: flex;
753
+ align-items: center;
754
+ justify-content: ${(props) => props.$justify};
755
+ flex-wrap: wrap;
756
+ column-gap: 24px;
757
+ font-size: 12px;
758
+ `;
759
+ var FooterItem = styled6.span`
760
+ display: inline-flex;
761
+ align-items: center;
762
+ gap: 6px;
763
+ height: 22px;
764
+ white-space: nowrap;
765
+
766
+ svg {
767
+ flex-shrink: 0;
768
+ }
769
+ `;
770
+ var HEADER_INFO_ORDER = ["companyName", "cnpj", "phone", "email", "address"];
771
+ function HeaderBar({ config, companyInfo = {}, logoUrl, documentFont }) {
772
+ if (!config?.enabled) return null;
773
+ const lines = HEADER_INFO_ORDER.filter(
774
+ (key) => config.info?.[key] && companyInfo[key]
775
+ );
776
+ const logoLeft = config.logoPosition === "left";
777
+ return /* @__PURE__ */ jsx(HeaderRoot, { className: "dg-running-header", $color: config.color ?? "#3F4759", $font: fontStack(documentFont), children: /* @__PURE__ */ jsxs(HeaderLayout, { $reverse: logoLeft, children: [
778
+ /* @__PURE__ */ jsx(HeaderInfo, { $alignEnd: logoLeft, children: lines.map((key) => /* @__PURE__ */ jsxs(InfoLine, { $strong: key === "companyName", $iconAfter: logoLeft, children: [
779
+ COMPANY_INFO_ICONS[key],
780
+ /* @__PURE__ */ jsx("span", { children: companyInfo[key] })
781
+ ] }, key)) }),
782
+ logoUrl ? /* @__PURE__ */ jsx(HeaderLogo, { src: logoUrl, alt: "" }) : null
783
+ ] }) });
784
+ }
785
+ var FOOTER_INFO_ORDER = [
786
+ "phone",
787
+ "site",
788
+ "instagram",
789
+ "facebook",
790
+ "twitter",
791
+ "linkedin",
792
+ "email",
793
+ "address"
794
+ ];
795
+ var ALIGNMENT_TO_JUSTIFY = {
796
+ left: "flex-start",
797
+ center: "center",
798
+ right: "flex-end"
799
+ };
800
+ function FooterBar({ config, companyInfo = {}, documentFont }) {
801
+ const showBand = Boolean(config?.enabled);
802
+ const showPageNumber = Boolean(config?.pageNumber);
803
+ if (!showBand && !showPageNumber) return null;
804
+ const lines = showBand ? FOOTER_INFO_ORDER.filter(
805
+ (key) => config?.info?.[key] && companyInfo[key]
806
+ ) : [];
807
+ const justify = ALIGNMENT_TO_JUSTIFY[config?.alignment ?? "center"];
808
+ return /* @__PURE__ */ jsxs(FooterRoot, { className: "dg-running-footer", $color: config?.color ?? "#3F4759", $font: fontStack(documentFont), children: [
809
+ showPageNumber ? /* @__PURE__ */ jsx("span", { className: "dg-page-number" }) : null,
810
+ showBand ? /* @__PURE__ */ jsx(FooterLayout, { children: lines.length ? /* @__PURE__ */ jsx(FooterInfoRows, { $justify: justify, children: lines.map((key) => /* @__PURE__ */ jsxs(FooterItem, { children: [
811
+ COMPANY_INFO_ICONS[key],
812
+ /* @__PURE__ */ jsx("span", { children: companyInfo[key] })
813
+ ] }, key)) }) : null }) : null
814
+ ] });
815
+ }
816
+
817
+ // src/render/messages.ts
818
+ var DG_MESSAGE_SOURCE = "document-generator";
819
+ var DG_READY = "dg-ready";
820
+ var DG_ERROR = "dg-error";
821
+
822
+ export { COMPANY_INFO_ICONS, COVER_TEMPLATES, COVER_TEMPLATE_IDS, CoverEditContext, CoverPage, DG_ERROR, DG_MESSAGE_SOURCE, DG_READY, DocumentRenderer, FOOTER_INFO_ORDER, FooterBar, HEADER_INFO_ORDER, HeaderBar, resolveCoverAccent, resolveCoverColors };
823
+ //# sourceMappingURL=chunk-6GRYRVU5.js.map
824
+ //# sourceMappingURL=chunk-6GRYRVU5.js.map