@tooark/wysiwyg 1.9.4 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/README.pt-BR.md +2 -1
- package/dist/components/ark-wysiwyg-editor.cjs +830 -0
- package/dist/components/ark-wysiwyg-editor.cjs.map +1 -0
- package/dist/components/ark-wysiwyg-editor.js +828 -0
- package/dist/components/ark-wysiwyg-editor.js.map +1 -0
- package/dist/components/ark-wysiwyg-viewer.cjs +125 -0
- package/dist/components/ark-wysiwyg-viewer.cjs.map +1 -0
- package/dist/components/ark-wysiwyg-viewer.js +123 -0
- package/dist/components/ark-wysiwyg-viewer.js.map +1 -0
- package/dist/components/html-element-base.cjs +11 -0
- package/dist/components/html-element-base.cjs.map +1 -0
- package/dist/components/html-element-base.js +9 -0
- package/dist/components/html-element-base.js.map +1 -0
- package/dist/components/test-hooks.cjs +19 -0
- package/dist/components/test-hooks.cjs.map +1 -0
- package/dist/components/test-hooks.js +17 -0
- package/dist/components/test-hooks.js.map +1 -0
- package/dist/components/upgrade-properties.cjs +31 -0
- package/dist/components/upgrade-properties.cjs.map +1 -0
- package/dist/components/upgrade-properties.js +29 -0
- package/dist/components/upgrade-properties.js.map +1 -0
- package/dist/engine/index.cjs +278 -0
- package/dist/engine/index.cjs.map +1 -0
- package/dist/engine/index.js +269 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/i18n.cjs +139 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.js +137 -0
- package/dist/i18n.js.map +1 -0
- package/dist/icons.cjs +34 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.js +32 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +31 -1856
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -1837
- package/dist/index.js.map +1 -1
- package/dist/register.cjs +23 -0
- package/dist/register.cjs.map +1 -0
- package/dist/register.js +21 -0
- package/dist/register.js.map +1 -0
- package/dist/security.cjs +117 -0
- package/dist/security.cjs.map +1 -0
- package/dist/security.js +112 -0
- package/dist/security.js.map +1 -0
- package/dist/styles.cjs +288 -0
- package/dist/styles.cjs.map +1 -0
- package/dist/styles.js +284 -0
- package/dist/styles.js.map +1 -0
- package/dist/types/index.cjs +29 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.js +26 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +3 -3
package/dist/styles.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
2
|
+
/**
|
|
3
|
+
* CSS base do editor/viewer. Plano e independente de Tailwind para que o pacote
|
|
4
|
+
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
5
|
+
*/
|
|
6
|
+
const wysiwygCss = `
|
|
7
|
+
/* O host nasce inline, e num inline width/max-width nao valem: como bloco, a largura do host passa a valer. */
|
|
8
|
+
ark-wysiwyg-editor,
|
|
9
|
+
ark-wysiwyg-viewer {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
.ark-wysiwyg {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
font-family: inherit;
|
|
17
|
+
color: #0f172a;
|
|
18
|
+
}
|
|
19
|
+
.ark-wysiwyg[data-ark-theme="dark"] { color: #e2e8f0; }
|
|
20
|
+
|
|
21
|
+
/* ---------- Toolbar ---------- */
|
|
22
|
+
.ark-wysiwyg__toolbar {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 4px;
|
|
27
|
+
padding: 6px;
|
|
28
|
+
border: 1px solid #e2e8f0;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
background: #f8fafc;
|
|
31
|
+
}
|
|
32
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__toolbar {
|
|
33
|
+
border-color: #334155;
|
|
34
|
+
background: #1e293b;
|
|
35
|
+
}
|
|
36
|
+
.ark-wysiwyg__group {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 2px;
|
|
40
|
+
}
|
|
41
|
+
.ark-wysiwyg__item {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
position: relative;
|
|
44
|
+
}
|
|
45
|
+
.ark-wysiwyg__separator {
|
|
46
|
+
width: 1px;
|
|
47
|
+
align-self: stretch;
|
|
48
|
+
margin: 4px 2px;
|
|
49
|
+
background: #e2e8f0;
|
|
50
|
+
}
|
|
51
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__separator { background: #334155; }
|
|
52
|
+
|
|
53
|
+
.ark-wysiwyg__btn {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
min-width: 32px;
|
|
59
|
+
height: 32px;
|
|
60
|
+
padding: 0 6px;
|
|
61
|
+
border: 1px solid transparent;
|
|
62
|
+
border-radius: 6px;
|
|
63
|
+
background: transparent;
|
|
64
|
+
color: inherit;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
line-height: 1;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
transition: background 120ms ease, border-color 120ms ease;
|
|
70
|
+
}
|
|
71
|
+
.ark-wysiwyg__btn svg { width: 18px; height: 18px; }
|
|
72
|
+
.ark-wysiwyg__btn--text { padding: 0 10px; font-size: 13px; }
|
|
73
|
+
.ark-wysiwyg__btn:hover { background: rgba(100, 116, 139, 0.15); }
|
|
74
|
+
.ark-wysiwyg__btn:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
75
|
+
.ark-wysiwyg__btn[aria-pressed="true"] {
|
|
76
|
+
background: rgba(99, 102, 241, 0.16);
|
|
77
|
+
border-color: rgba(99, 102, 241, 0.5);
|
|
78
|
+
}
|
|
79
|
+
.ark-wysiwyg__btn:disabled {
|
|
80
|
+
opacity: 0.45;
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
background: transparent;
|
|
83
|
+
}
|
|
84
|
+
/* Barra com a cor atual sob o icone de cor do texto e de marca-texto. */
|
|
85
|
+
.ark-wysiwyg__btn--swatch::after {
|
|
86
|
+
content: "";
|
|
87
|
+
position: absolute;
|
|
88
|
+
left: 7px;
|
|
89
|
+
right: 7px;
|
|
90
|
+
bottom: 4px;
|
|
91
|
+
height: 3px;
|
|
92
|
+
border-radius: 2px;
|
|
93
|
+
background: var(--ark-wysiwyg-swatch, transparent);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ark-wysiwyg__select {
|
|
97
|
+
height: 32px;
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
border: 1px solid #cbd5e1;
|
|
100
|
+
border-radius: 6px;
|
|
101
|
+
background: #ffffff;
|
|
102
|
+
color: inherit;
|
|
103
|
+
font: inherit;
|
|
104
|
+
font-size: 13px;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
}
|
|
107
|
+
.ark-wysiwyg__select:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
108
|
+
.ark-wysiwyg__select:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
109
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__select {
|
|
110
|
+
border-color: #475569;
|
|
111
|
+
background: #0f172a;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ---------- Popovers (paletas e link) ---------- */
|
|
115
|
+
/* Redefine o que o UA da a [popover]; left/top vem inline, calculados a partir do botao. */
|
|
116
|
+
.ark-wysiwyg__popover {
|
|
117
|
+
position: fixed;
|
|
118
|
+
inset: auto;
|
|
119
|
+
margin: 0;
|
|
120
|
+
padding: 8px;
|
|
121
|
+
border: 1px solid #e2e8f0;
|
|
122
|
+
border-radius: 8px;
|
|
123
|
+
background: #ffffff;
|
|
124
|
+
color: #0f172a;
|
|
125
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
126
|
+
font-family: inherit;
|
|
127
|
+
}
|
|
128
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__popover {
|
|
129
|
+
border-color: #334155;
|
|
130
|
+
background: #1e293b;
|
|
131
|
+
color: #e2e8f0;
|
|
132
|
+
}
|
|
133
|
+
.ark-wysiwyg__swatches {
|
|
134
|
+
display: grid;
|
|
135
|
+
grid-template-columns: repeat(5, 24px);
|
|
136
|
+
gap: 6px;
|
|
137
|
+
}
|
|
138
|
+
.ark-wysiwyg__swatch {
|
|
139
|
+
width: 24px;
|
|
140
|
+
height: 24px;
|
|
141
|
+
padding: 0;
|
|
142
|
+
border: 1px solid rgba(15, 23, 42, 0.15);
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
color: inherit;
|
|
149
|
+
background: transparent;
|
|
150
|
+
}
|
|
151
|
+
.ark-wysiwyg__swatch svg { width: 16px; height: 16px; }
|
|
152
|
+
.ark-wysiwyg__swatch:hover { transform: scale(1.1); }
|
|
153
|
+
.ark-wysiwyg__swatch:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
154
|
+
.ark-wysiwyg__link {
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: 6px;
|
|
158
|
+
}
|
|
159
|
+
.ark-wysiwyg__input {
|
|
160
|
+
width: 16rem;
|
|
161
|
+
max-width: 60vw;
|
|
162
|
+
height: 32px;
|
|
163
|
+
padding: 0 8px;
|
|
164
|
+
border: 1px solid #cbd5e1;
|
|
165
|
+
border-radius: 6px;
|
|
166
|
+
background: #ffffff;
|
|
167
|
+
color: inherit;
|
|
168
|
+
font: inherit;
|
|
169
|
+
font-size: 13px;
|
|
170
|
+
}
|
|
171
|
+
.ark-wysiwyg__input:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
172
|
+
.ark-wysiwyg__input[aria-invalid="true"] { border-color: #dc2626; }
|
|
173
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__input {
|
|
174
|
+
border-color: #475569;
|
|
175
|
+
background: #0f172a;
|
|
176
|
+
}
|
|
177
|
+
.ark-wysiwyg__error {
|
|
178
|
+
margin: 6px 0 0;
|
|
179
|
+
font-size: 12px;
|
|
180
|
+
color: #dc2626;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* ---------- Conteudo ---------- */
|
|
184
|
+
.ark-wysiwyg__content {
|
|
185
|
+
border: 1px solid #e2e8f0;
|
|
186
|
+
border-radius: 8px;
|
|
187
|
+
background: #ffffff;
|
|
188
|
+
}
|
|
189
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__content {
|
|
190
|
+
border-color: #334155;
|
|
191
|
+
background: #0f172a;
|
|
192
|
+
}
|
|
193
|
+
.ark-wysiwyg--viewer .ark-wysiwyg__content {
|
|
194
|
+
border: none;
|
|
195
|
+
background: transparent;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ark-wysiwyg .ProseMirror {
|
|
199
|
+
min-height: 120px;
|
|
200
|
+
padding: 12px 14px;
|
|
201
|
+
outline: none;
|
|
202
|
+
line-height: 1.6;
|
|
203
|
+
}
|
|
204
|
+
.ark-wysiwyg--viewer .ProseMirror { min-height: 0; padding: 0; }
|
|
205
|
+
.ark-wysiwyg .ProseMirror > * + * { margin-top: 0.6em; }
|
|
206
|
+
.ark-wysiwyg .ProseMirror h1 { font-size: 1.6em; font-weight: 700; }
|
|
207
|
+
.ark-wysiwyg .ProseMirror h2 { font-size: 1.35em; font-weight: 700; }
|
|
208
|
+
.ark-wysiwyg .ProseMirror h3 { font-size: 1.15em; font-weight: 700; }
|
|
209
|
+
.ark-wysiwyg .ProseMirror h4 { font-size: 1em; font-weight: 700; }
|
|
210
|
+
.ark-wysiwyg .ProseMirror ul,
|
|
211
|
+
.ark-wysiwyg .ProseMirror ol { padding-left: 1.4em; }
|
|
212
|
+
.ark-wysiwyg .ProseMirror ul { list-style: disc; }
|
|
213
|
+
.ark-wysiwyg .ProseMirror ol { list-style: decimal; }
|
|
214
|
+
.ark-wysiwyg .ProseMirror blockquote {
|
|
215
|
+
border-left: 3px solid #cbd5e1;
|
|
216
|
+
padding-left: 12px;
|
|
217
|
+
color: #475569;
|
|
218
|
+
}
|
|
219
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror blockquote {
|
|
220
|
+
border-left-color: #475569;
|
|
221
|
+
color: #94a3b8;
|
|
222
|
+
}
|
|
223
|
+
.ark-wysiwyg .ProseMirror code {
|
|
224
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
225
|
+
font-size: 0.9em;
|
|
226
|
+
background: rgba(100, 116, 139, 0.18);
|
|
227
|
+
padding: 0.1em 0.3em;
|
|
228
|
+
border-radius: 4px;
|
|
229
|
+
}
|
|
230
|
+
.ark-wysiwyg .ProseMirror hr {
|
|
231
|
+
border: none;
|
|
232
|
+
border-top: 1px solid #cbd5e1;
|
|
233
|
+
margin: 1em 0;
|
|
234
|
+
}
|
|
235
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror hr { border-top-color: #475569; }
|
|
236
|
+
.ark-wysiwyg .ProseMirror a {
|
|
237
|
+
color: #2563eb;
|
|
238
|
+
text-decoration: underline;
|
|
239
|
+
text-underline-offset: 2px;
|
|
240
|
+
}
|
|
241
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror a { color: #93c5fd; }
|
|
242
|
+
/* Marca-texto: fundo pastel com texto escuro nos dois temas, para ler sempre. */
|
|
243
|
+
.ark-wysiwyg .ProseMirror mark {
|
|
244
|
+
color: #0f172a;
|
|
245
|
+
border-radius: 2px;
|
|
246
|
+
padding: 0 0.1em;
|
|
247
|
+
}
|
|
248
|
+
.ark-wysiwyg .ProseMirror img,
|
|
249
|
+
.ark-wysiwyg .ProseMirror video {
|
|
250
|
+
display: block;
|
|
251
|
+
max-width: 100%;
|
|
252
|
+
height: auto;
|
|
253
|
+
border-radius: 6px;
|
|
254
|
+
}
|
|
255
|
+
.ark-wysiwyg .ProseMirror img.ProseMirror-selectednode,
|
|
256
|
+
.ark-wysiwyg .ProseMirror video.ProseMirror-selectednode {
|
|
257
|
+
outline: 2px solid #6366f1;
|
|
258
|
+
outline-offset: 2px;
|
|
259
|
+
}
|
|
260
|
+
.ark-wysiwyg[aria-busy="true"] .ark-wysiwyg__content { cursor: progress; }
|
|
261
|
+
|
|
262
|
+
/* Placeholder (extension-placeholder) */
|
|
263
|
+
.ark-wysiwyg .ProseMirror p.is-editor-empty:first-child::before {
|
|
264
|
+
content: attr(data-placeholder);
|
|
265
|
+
float: left;
|
|
266
|
+
height: 0;
|
|
267
|
+
pointer-events: none;
|
|
268
|
+
color: #94a3b8;
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
/** Injeta o CSS base no <head> uma única vez. */
|
|
272
|
+
function ensureWysiwygStyles() {
|
|
273
|
+
if (typeof document === "undefined")
|
|
274
|
+
return;
|
|
275
|
+
if (document.getElementById(WYSIWYG_STYLE_ID))
|
|
276
|
+
return;
|
|
277
|
+
const style = document.createElement("style");
|
|
278
|
+
style.id = WYSIWYG_STYLE_ID;
|
|
279
|
+
style.textContent = wysiwygCss;
|
|
280
|
+
document.head.appendChild(style);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export { WYSIWYG_STYLE_ID, ensureWysiwygStyles, wysiwygCss };
|
|
284
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../src/styles.ts"],"sourcesContent":["export const WYSIWYG_STYLE_ID = \"ark-wysiwyg-styles\";\n\n/**\n * CSS base do editor/viewer. Plano e independente de Tailwind para que o pacote\n * funcione em qualquer projeto. Temas via atributo `data-ark-theme`.\n */\nexport const wysiwygCss = `\n/* O host nasce inline, e num inline width/max-width nao valem: como bloco, a largura do host passa a valer. */\nark-wysiwyg-editor,\nark-wysiwyg-viewer {\n display: block;\n}\n.ark-wysiwyg {\n display: flex;\n flex-direction: column;\n gap: 8px;\n font-family: inherit;\n color: #0f172a;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] { color: #e2e8f0; }\n\n/* ---------- Toolbar ---------- */\n.ark-wysiwyg__toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px;\n padding: 6px;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n background: #f8fafc;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__toolbar {\n border-color: #334155;\n background: #1e293b;\n}\n.ark-wysiwyg__group {\n display: flex;\n align-items: center;\n gap: 2px;\n}\n.ark-wysiwyg__item {\n display: inline-flex;\n position: relative;\n}\n.ark-wysiwyg__separator {\n width: 1px;\n align-self: stretch;\n margin: 4px 2px;\n background: #e2e8f0;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__separator { background: #334155; }\n\n.ark-wysiwyg__btn {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 32px;\n height: 32px;\n padding: 0 6px;\n border: 1px solid transparent;\n border-radius: 6px;\n background: transparent;\n color: inherit;\n font-size: 14px;\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n transition: background 120ms ease, border-color 120ms ease;\n}\n.ark-wysiwyg__btn svg { width: 18px; height: 18px; }\n.ark-wysiwyg__btn--text { padding: 0 10px; font-size: 13px; }\n.ark-wysiwyg__btn:hover { background: rgba(100, 116, 139, 0.15); }\n.ark-wysiwyg__btn:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }\n.ark-wysiwyg__btn[aria-pressed=\"true\"] {\n background: rgba(99, 102, 241, 0.16);\n border-color: rgba(99, 102, 241, 0.5);\n}\n.ark-wysiwyg__btn:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n background: transparent;\n}\n/* Barra com a cor atual sob o icone de cor do texto e de marca-texto. */\n.ark-wysiwyg__btn--swatch::after {\n content: \"\";\n position: absolute;\n left: 7px;\n right: 7px;\n bottom: 4px;\n height: 3px;\n border-radius: 2px;\n background: var(--ark-wysiwyg-swatch, transparent);\n}\n\n.ark-wysiwyg__select {\n height: 32px;\n padding: 0 8px;\n border: 1px solid #cbd5e1;\n border-radius: 6px;\n background: #ffffff;\n color: inherit;\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.ark-wysiwyg__select:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }\n.ark-wysiwyg__select:disabled { opacity: 0.45; cursor: not-allowed; }\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__select {\n border-color: #475569;\n background: #0f172a;\n}\n\n/* ---------- Popovers (paletas e link) ---------- */\n/* Redefine o que o UA da a [popover]; left/top vem inline, calculados a partir do botao. */\n.ark-wysiwyg__popover {\n position: fixed;\n inset: auto;\n margin: 0;\n padding: 8px;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n background: #ffffff;\n color: #0f172a;\n box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n font-family: inherit;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__popover {\n border-color: #334155;\n background: #1e293b;\n color: #e2e8f0;\n}\n.ark-wysiwyg__swatches {\n display: grid;\n grid-template-columns: repeat(5, 24px);\n gap: 6px;\n}\n.ark-wysiwyg__swatch {\n width: 24px;\n height: 24px;\n padding: 0;\n border: 1px solid rgba(15, 23, 42, 0.15);\n border-radius: 6px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: inherit;\n background: transparent;\n}\n.ark-wysiwyg__swatch svg { width: 16px; height: 16px; }\n.ark-wysiwyg__swatch:hover { transform: scale(1.1); }\n.ark-wysiwyg__swatch:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }\n.ark-wysiwyg__link {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.ark-wysiwyg__input {\n width: 16rem;\n max-width: 60vw;\n height: 32px;\n padding: 0 8px;\n border: 1px solid #cbd5e1;\n border-radius: 6px;\n background: #ffffff;\n color: inherit;\n font: inherit;\n font-size: 13px;\n}\n.ark-wysiwyg__input:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }\n.ark-wysiwyg__input[aria-invalid=\"true\"] { border-color: #dc2626; }\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__input {\n border-color: #475569;\n background: #0f172a;\n}\n.ark-wysiwyg__error {\n margin: 6px 0 0;\n font-size: 12px;\n color: #dc2626;\n}\n\n/* ---------- Conteudo ---------- */\n.ark-wysiwyg__content {\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n background: #ffffff;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ark-wysiwyg__content {\n border-color: #334155;\n background: #0f172a;\n}\n.ark-wysiwyg--viewer .ark-wysiwyg__content {\n border: none;\n background: transparent;\n}\n\n.ark-wysiwyg .ProseMirror {\n min-height: 120px;\n padding: 12px 14px;\n outline: none;\n line-height: 1.6;\n}\n.ark-wysiwyg--viewer .ProseMirror { min-height: 0; padding: 0; }\n.ark-wysiwyg .ProseMirror > * + * { margin-top: 0.6em; }\n.ark-wysiwyg .ProseMirror h1 { font-size: 1.6em; font-weight: 700; }\n.ark-wysiwyg .ProseMirror h2 { font-size: 1.35em; font-weight: 700; }\n.ark-wysiwyg .ProseMirror h3 { font-size: 1.15em; font-weight: 700; }\n.ark-wysiwyg .ProseMirror h4 { font-size: 1em; font-weight: 700; }\n.ark-wysiwyg .ProseMirror ul,\n.ark-wysiwyg .ProseMirror ol { padding-left: 1.4em; }\n.ark-wysiwyg .ProseMirror ul { list-style: disc; }\n.ark-wysiwyg .ProseMirror ol { list-style: decimal; }\n.ark-wysiwyg .ProseMirror blockquote {\n border-left: 3px solid #cbd5e1;\n padding-left: 12px;\n color: #475569;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ProseMirror blockquote {\n border-left-color: #475569;\n color: #94a3b8;\n}\n.ark-wysiwyg .ProseMirror code {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 0.9em;\n background: rgba(100, 116, 139, 0.18);\n padding: 0.1em 0.3em;\n border-radius: 4px;\n}\n.ark-wysiwyg .ProseMirror hr {\n border: none;\n border-top: 1px solid #cbd5e1;\n margin: 1em 0;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ProseMirror hr { border-top-color: #475569; }\n.ark-wysiwyg .ProseMirror a {\n color: #2563eb;\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.ark-wysiwyg[data-ark-theme=\"dark\"] .ProseMirror a { color: #93c5fd; }\n/* Marca-texto: fundo pastel com texto escuro nos dois temas, para ler sempre. */\n.ark-wysiwyg .ProseMirror mark {\n color: #0f172a;\n border-radius: 2px;\n padding: 0 0.1em;\n}\n.ark-wysiwyg .ProseMirror img,\n.ark-wysiwyg .ProseMirror video {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: 6px;\n}\n.ark-wysiwyg .ProseMirror img.ProseMirror-selectednode,\n.ark-wysiwyg .ProseMirror video.ProseMirror-selectednode {\n outline: 2px solid #6366f1;\n outline-offset: 2px;\n}\n.ark-wysiwyg[aria-busy=\"true\"] .ark-wysiwyg__content { cursor: progress; }\n\n/* Placeholder (extension-placeholder) */\n.ark-wysiwyg .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n height: 0;\n pointer-events: none;\n color: #94a3b8;\n}\n`;\n\n/** Injeta o CSS base no <head> uma única vez. */\nexport function ensureWysiwygStyles(): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(WYSIWYG_STYLE_ID)) return;\n\n const style = document.createElement(\"style\");\n style.id = WYSIWYG_STYLE_ID;\n style.textContent = wysiwygCss;\n document.head.appendChild(style);\n}\n"],"names":[],"mappings":"AAAO,MAAM,gBAAgB,GAAG;AAEhC;;;AAGG;AACI,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Q1B;SACgB,mBAAmB,GAAA;IACjC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE;AACrC,IAAA,IAAI,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC;QAAE;IAE/C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,IAAA,KAAK,CAAC,EAAE,GAAG,gBAAgB;AAC3B,IAAA,KAAK,CAAC,WAAW,GAAG,UAAU;AAC9B,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAClC;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** Itens de cada grupo, na ordem em que aparecem. */
|
|
4
|
+
const ARK_WYSIWYG_TOOLBAR_GROUPS = {
|
|
5
|
+
style: ["heading"],
|
|
6
|
+
marks: ["bold", "italic", "underline", "strike", "code"],
|
|
7
|
+
color: ["text-color", "highlight"],
|
|
8
|
+
align: ["align-left", "align-center", "align-right", "align-justify"],
|
|
9
|
+
lists: ["bullet-list", "ordered-list", "outdent", "indent"],
|
|
10
|
+
link: ["link"],
|
|
11
|
+
media: ["image", "video"],
|
|
12
|
+
blocks: ["blockquote", "horizontal-rule"],
|
|
13
|
+
clear: ["clear-format"],
|
|
14
|
+
history: ["undo", "redo"]
|
|
15
|
+
};
|
|
16
|
+
/** Grupos exibidos sem o atributo `toolbar`; cor, alinhamento e mídia são opt-in. */
|
|
17
|
+
const ARK_WYSIWYG_DEFAULT_TOOLBAR = [
|
|
18
|
+
"style",
|
|
19
|
+
"marks",
|
|
20
|
+
"lists",
|
|
21
|
+
"link",
|
|
22
|
+
"blocks",
|
|
23
|
+
"clear",
|
|
24
|
+
"history"
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
exports.ARK_WYSIWYG_DEFAULT_TOOLBAR = ARK_WYSIWYG_DEFAULT_TOOLBAR;
|
|
28
|
+
exports.ARK_WYSIWYG_TOOLBAR_GROUPS = ARK_WYSIWYG_TOOLBAR_GROUPS;
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/types/index.ts"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport type { ArkThemeSelected } from \"@tooark/tokens\";\n\n/** Tema do editor/viewer. \"auto\" segue o color-scheme do host, ou a preferência do sistema sem lado fixo. */\nexport type ArkWysiwygTheme = \"auto\" | ArkThemeSelected;\n\n/**\n * Conteúdo armazenado: JSON do Tiptap/ProseMirror.\n *\n * Optamos por JSON (e não HTML cru) por segurança — é o formato nativo do\n * ProseMirror e evita a superfície de XSS associada a importar HTML arbitrário.\n * Ao entrar (propriedade `content`, `setContent`), o JSON passa por\n * `sanitizeWysiwygContent`: nós e marcas fora do schema caem, `href`/`src`\n * ficam restritos a http(s), mailto, tel e caminhos relativos, e cores só\n * entram em formato de cor.\n */\nexport type ArkWysiwygContent = JSONContent;\n\n/** Idiomas dos rótulos da toolbar; \"custom\" usa `locale-json` sobre o inglês. */\nexport type ArkWysiwygLang = \"en\" | \"pt\" | \"es\" | \"custom\";\n\n/** Rótulos da toolbar (tooltips, nomes acessíveis, formulário de link). */\nexport type ArkWysiwygLabels = {\n textStyle: string;\n paragraph: string;\n heading: string;\n bold: string;\n italic: string;\n underline: string;\n strike: string;\n code: string;\n textColor: string;\n highlight: string;\n noColor: string;\n alignLeft: string;\n alignCenter: string;\n alignRight: string;\n alignJustify: string;\n bulletList: string;\n orderedList: string;\n indent: string;\n outdent: string;\n link: string;\n linkUrl: string;\n apply: string;\n remove: string;\n invalidUrl: string;\n image: string;\n video: string;\n blockquote: string;\n horizontalRule: string;\n clearFormat: string;\n undo: string;\n redo: string;\n uploading: string;\n};\n\n/** Itens individuais da toolbar do editor. */\nexport type ArkWysiwygToolbarItem =\n | \"heading\"\n | \"heading-1\"\n | \"heading-2\"\n | \"heading-3\"\n | \"heading-4\"\n | \"bold\"\n | \"italic\"\n | \"underline\"\n | \"strike\"\n | \"code\"\n | \"text-color\"\n | \"highlight\"\n | \"align-left\"\n | \"align-center\"\n | \"align-right\"\n | \"align-justify\"\n | \"bullet-list\"\n | \"ordered-list\"\n | \"outdent\"\n | \"indent\"\n | \"link\"\n | \"image\"\n | \"video\"\n | \"blockquote\"\n | \"horizontal-rule\"\n | \"clear-format\"\n | \"undo\"\n | \"redo\";\n\n/** Grupos da toolbar: cada um liga ou desliga um conjunto de itens, separados visualmente. */\nexport type ArkWysiwygToolbarGroup =\n | \"style\"\n | \"marks\"\n | \"color\"\n | \"align\"\n | \"lists\"\n | \"link\"\n | \"media\"\n | \"blocks\"\n | \"clear\"\n | \"history\";\n\n/** Itens de cada grupo, na ordem em que aparecem. */\nexport const ARK_WYSIWYG_TOOLBAR_GROUPS: Record<ArkWysiwygToolbarGroup, ArkWysiwygToolbarItem[]> = {\n style: [\"heading\"],\n marks: [\"bold\", \"italic\", \"underline\", \"strike\", \"code\"],\n color: [\"text-color\", \"highlight\"],\n align: [\"align-left\", \"align-center\", \"align-right\", \"align-justify\"],\n lists: [\"bullet-list\", \"ordered-list\", \"outdent\", \"indent\"],\n link: [\"link\"],\n media: [\"image\", \"video\"],\n blocks: [\"blockquote\", \"horizontal-rule\"],\n clear: [\"clear-format\"],\n history: [\"undo\", \"redo\"]\n};\n\n/** Grupos exibidos sem o atributo `toolbar`; cor, alinhamento e mídia são opt-in. */\nexport const ARK_WYSIWYG_DEFAULT_TOOLBAR: ArkWysiwygToolbarGroup[] = [\n \"style\",\n \"marks\",\n \"lists\",\n \"link\",\n \"blocks\",\n \"clear\",\n \"history\"\n];\n\n/** Tipo de arquivo que o editor envia ao gancho de upload. */\nexport type ArkWysiwygUploadKind = \"image\" | \"video\";\n\n/**\n * O que o gancho de upload devolve: a URL final e metadados opcionais. A URL é http(s) ou relativa iniciada por `/`,\n * `#`, `?`, `./` ou `../`; base64, `blob:` ou caminho sem prefixo falham com \"invalid-src\".\n */\nexport type ArkWysiwygUploadResult = {\n /** URL onde o arquivo ficou. */\n src: string;\n /** Texto alternativo (imagem). */\n alt?: string;\n /** Título/legenda. */\n title?: string;\n /** Imagem de capa (vídeo). */\n poster?: string;\n};\n\n/**\n * Gancho de upload fornecido pelo app: recebe o arquivo, guarda onde quiser e devolve a URL. Sem ele o editor não\n * aceita arquivos (nem colados, nem arrastados) e a toolbar não mostra imagem/vídeo.\n */\nexport type ArkWysiwygUploader = (file: File, kind: ArkWysiwygUploadKind) => Promise<ArkWysiwygUploadResult>;\n\n/** Motivo de um arquivo recusado ou de um upload que falhou. */\nexport type ArkWysiwygUploadErrorReason = \"no-uploader\" | \"unsupported-type\" | \"too-large\" | \"invalid-src\" | \"failed\";\n\n/** Detalhe do evento `ark-wysiwyg-upload-error` e do callback `onUploadError`. */\nexport type ArkWysiwygUploadError = {\n reason: ArkWysiwygUploadErrorReason;\n file: File;\n /** Erro lançado pelo gancho, quando `reason` é \"failed\". */\n error?: unknown;\n};\n\nexport type ArkWysiwygEditorOptions = {\n /** Conteúdo inicial (JSON do Tiptap), sanitizado ao entrar. */\n content?: ArkWysiwygContent | null;\n /** Tema visual. Padrão: \"auto\". */\n theme?: ArkWysiwygTheme;\n /** Texto exibido quando o editor está vazio. */\n placeholder?: string;\n /** Nome acessível do conteúdo editável (`aria-label`), para quem não tem um rótulo visível. Padrão: nenhum. */\n label?: string;\n /** Se o conteúdo é editável. Padrão: true. */\n editable?: boolean;\n /** Gancho de upload de imagem/vídeo; sem ele arquivos são recusados. */\n uploadFile?: ArkWysiwygUploader;\n /** Tamanho máximo de arquivo aceito, em bytes. Padrão: 10 MiB. */\n maxFileSize?: number;\n /** Chamado a cada edição do usuário (não em `setContent`). */\n onChange?: (content: ArkWysiwygContent) => void;\n /** Chamado quando um arquivo é recusado ou o upload falha. */\n onUploadError?: (error: ArkWysiwygUploadError) => void;\n /** Chamado quando o número de uploads em andamento muda. */\n onUploadingChange?: (count: number) => void;\n};\n\nexport type ArkWysiwygViewerOptions = {\n /** Conteúdo a renderizar (JSON do Tiptap), sanitizado ao entrar. */\n content?: ArkWysiwygContent | null;\n /** Tema visual. Padrão: \"auto\". */\n theme?: ArkWysiwygTheme;\n};\n\n/** Re-export do tipo nativo do Tiptap para conveniência. */\nexport type { JSONContent };\n"],"names":[],"mappings":";;AAqGA;AACO,MAAM,0BAA0B,GAA4D;IACjG,KAAK,EAAE,CAAC,SAAS,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;AACxD,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IAClC,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,CAAC;IACrE,KAAK,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC3D,IAAI,EAAE,CAAC,MAAM,CAAC;AACd,IAAA,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AACzB,IAAA,MAAM,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,KAAK,EAAE,CAAC,cAAc,CAAC;AACvB,IAAA,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM;;AAG1B;AACO,MAAM,2BAA2B,GAA6B;IACnE,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Itens de cada grupo, na ordem em que aparecem. */
|
|
2
|
+
const ARK_WYSIWYG_TOOLBAR_GROUPS = {
|
|
3
|
+
style: ["heading"],
|
|
4
|
+
marks: ["bold", "italic", "underline", "strike", "code"],
|
|
5
|
+
color: ["text-color", "highlight"],
|
|
6
|
+
align: ["align-left", "align-center", "align-right", "align-justify"],
|
|
7
|
+
lists: ["bullet-list", "ordered-list", "outdent", "indent"],
|
|
8
|
+
link: ["link"],
|
|
9
|
+
media: ["image", "video"],
|
|
10
|
+
blocks: ["blockquote", "horizontal-rule"],
|
|
11
|
+
clear: ["clear-format"],
|
|
12
|
+
history: ["undo", "redo"]
|
|
13
|
+
};
|
|
14
|
+
/** Grupos exibidos sem o atributo `toolbar`; cor, alinhamento e mídia são opt-in. */
|
|
15
|
+
const ARK_WYSIWYG_DEFAULT_TOOLBAR = [
|
|
16
|
+
"style",
|
|
17
|
+
"marks",
|
|
18
|
+
"lists",
|
|
19
|
+
"link",
|
|
20
|
+
"blocks",
|
|
21
|
+
"clear",
|
|
22
|
+
"history"
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export { ARK_WYSIWYG_DEFAULT_TOOLBAR, ARK_WYSIWYG_TOOLBAR_GROUPS };
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/types/index.ts"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport type { ArkThemeSelected } from \"@tooark/tokens\";\n\n/** Tema do editor/viewer. \"auto\" segue o color-scheme do host, ou a preferência do sistema sem lado fixo. */\nexport type ArkWysiwygTheme = \"auto\" | ArkThemeSelected;\n\n/**\n * Conteúdo armazenado: JSON do Tiptap/ProseMirror.\n *\n * Optamos por JSON (e não HTML cru) por segurança — é o formato nativo do\n * ProseMirror e evita a superfície de XSS associada a importar HTML arbitrário.\n * Ao entrar (propriedade `content`, `setContent`), o JSON passa por\n * `sanitizeWysiwygContent`: nós e marcas fora do schema caem, `href`/`src`\n * ficam restritos a http(s), mailto, tel e caminhos relativos, e cores só\n * entram em formato de cor.\n */\nexport type ArkWysiwygContent = JSONContent;\n\n/** Idiomas dos rótulos da toolbar; \"custom\" usa `locale-json` sobre o inglês. */\nexport type ArkWysiwygLang = \"en\" | \"pt\" | \"es\" | \"custom\";\n\n/** Rótulos da toolbar (tooltips, nomes acessíveis, formulário de link). */\nexport type ArkWysiwygLabels = {\n textStyle: string;\n paragraph: string;\n heading: string;\n bold: string;\n italic: string;\n underline: string;\n strike: string;\n code: string;\n textColor: string;\n highlight: string;\n noColor: string;\n alignLeft: string;\n alignCenter: string;\n alignRight: string;\n alignJustify: string;\n bulletList: string;\n orderedList: string;\n indent: string;\n outdent: string;\n link: string;\n linkUrl: string;\n apply: string;\n remove: string;\n invalidUrl: string;\n image: string;\n video: string;\n blockquote: string;\n horizontalRule: string;\n clearFormat: string;\n undo: string;\n redo: string;\n uploading: string;\n};\n\n/** Itens individuais da toolbar do editor. */\nexport type ArkWysiwygToolbarItem =\n | \"heading\"\n | \"heading-1\"\n | \"heading-2\"\n | \"heading-3\"\n | \"heading-4\"\n | \"bold\"\n | \"italic\"\n | \"underline\"\n | \"strike\"\n | \"code\"\n | \"text-color\"\n | \"highlight\"\n | \"align-left\"\n | \"align-center\"\n | \"align-right\"\n | \"align-justify\"\n | \"bullet-list\"\n | \"ordered-list\"\n | \"outdent\"\n | \"indent\"\n | \"link\"\n | \"image\"\n | \"video\"\n | \"blockquote\"\n | \"horizontal-rule\"\n | \"clear-format\"\n | \"undo\"\n | \"redo\";\n\n/** Grupos da toolbar: cada um liga ou desliga um conjunto de itens, separados visualmente. */\nexport type ArkWysiwygToolbarGroup =\n | \"style\"\n | \"marks\"\n | \"color\"\n | \"align\"\n | \"lists\"\n | \"link\"\n | \"media\"\n | \"blocks\"\n | \"clear\"\n | \"history\";\n\n/** Itens de cada grupo, na ordem em que aparecem. */\nexport const ARK_WYSIWYG_TOOLBAR_GROUPS: Record<ArkWysiwygToolbarGroup, ArkWysiwygToolbarItem[]> = {\n style: [\"heading\"],\n marks: [\"bold\", \"italic\", \"underline\", \"strike\", \"code\"],\n color: [\"text-color\", \"highlight\"],\n align: [\"align-left\", \"align-center\", \"align-right\", \"align-justify\"],\n lists: [\"bullet-list\", \"ordered-list\", \"outdent\", \"indent\"],\n link: [\"link\"],\n media: [\"image\", \"video\"],\n blocks: [\"blockquote\", \"horizontal-rule\"],\n clear: [\"clear-format\"],\n history: [\"undo\", \"redo\"]\n};\n\n/** Grupos exibidos sem o atributo `toolbar`; cor, alinhamento e mídia são opt-in. */\nexport const ARK_WYSIWYG_DEFAULT_TOOLBAR: ArkWysiwygToolbarGroup[] = [\n \"style\",\n \"marks\",\n \"lists\",\n \"link\",\n \"blocks\",\n \"clear\",\n \"history\"\n];\n\n/** Tipo de arquivo que o editor envia ao gancho de upload. */\nexport type ArkWysiwygUploadKind = \"image\" | \"video\";\n\n/**\n * O que o gancho de upload devolve: a URL final e metadados opcionais. A URL é http(s) ou relativa iniciada por `/`,\n * `#`, `?`, `./` ou `../`; base64, `blob:` ou caminho sem prefixo falham com \"invalid-src\".\n */\nexport type ArkWysiwygUploadResult = {\n /** URL onde o arquivo ficou. */\n src: string;\n /** Texto alternativo (imagem). */\n alt?: string;\n /** Título/legenda. */\n title?: string;\n /** Imagem de capa (vídeo). */\n poster?: string;\n};\n\n/**\n * Gancho de upload fornecido pelo app: recebe o arquivo, guarda onde quiser e devolve a URL. Sem ele o editor não\n * aceita arquivos (nem colados, nem arrastados) e a toolbar não mostra imagem/vídeo.\n */\nexport type ArkWysiwygUploader = (file: File, kind: ArkWysiwygUploadKind) => Promise<ArkWysiwygUploadResult>;\n\n/** Motivo de um arquivo recusado ou de um upload que falhou. */\nexport type ArkWysiwygUploadErrorReason = \"no-uploader\" | \"unsupported-type\" | \"too-large\" | \"invalid-src\" | \"failed\";\n\n/** Detalhe do evento `ark-wysiwyg-upload-error` e do callback `onUploadError`. */\nexport type ArkWysiwygUploadError = {\n reason: ArkWysiwygUploadErrorReason;\n file: File;\n /** Erro lançado pelo gancho, quando `reason` é \"failed\". */\n error?: unknown;\n};\n\nexport type ArkWysiwygEditorOptions = {\n /** Conteúdo inicial (JSON do Tiptap), sanitizado ao entrar. */\n content?: ArkWysiwygContent | null;\n /** Tema visual. Padrão: \"auto\". */\n theme?: ArkWysiwygTheme;\n /** Texto exibido quando o editor está vazio. */\n placeholder?: string;\n /** Nome acessível do conteúdo editável (`aria-label`), para quem não tem um rótulo visível. Padrão: nenhum. */\n label?: string;\n /** Se o conteúdo é editável. Padrão: true. */\n editable?: boolean;\n /** Gancho de upload de imagem/vídeo; sem ele arquivos são recusados. */\n uploadFile?: ArkWysiwygUploader;\n /** Tamanho máximo de arquivo aceito, em bytes. Padrão: 10 MiB. */\n maxFileSize?: number;\n /** Chamado a cada edição do usuário (não em `setContent`). */\n onChange?: (content: ArkWysiwygContent) => void;\n /** Chamado quando um arquivo é recusado ou o upload falha. */\n onUploadError?: (error: ArkWysiwygUploadError) => void;\n /** Chamado quando o número de uploads em andamento muda. */\n onUploadingChange?: (count: number) => void;\n};\n\nexport type ArkWysiwygViewerOptions = {\n /** Conteúdo a renderizar (JSON do Tiptap), sanitizado ao entrar. */\n content?: ArkWysiwygContent | null;\n /** Tema visual. Padrão: \"auto\". */\n theme?: ArkWysiwygTheme;\n};\n\n/** Re-export do tipo nativo do Tiptap para conveniência. */\nexport type { JSONContent };\n"],"names":[],"mappings":"AAqGA;AACO,MAAM,0BAA0B,GAA4D;IACjG,KAAK,EAAE,CAAC,SAAS,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;AACxD,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IAClC,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,CAAC;IACrE,KAAK,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC3D,IAAI,EAAE,CAAC,MAAM,CAAC;AACd,IAAA,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AACzB,IAAA,MAAM,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,KAAK,EAAE,CAAC,cAAc,CAAC;AACvB,IAAA,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM;;AAG1B;AACO,MAAM,2BAA2B,GAA6B;IACnE,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tooark/wysiwyg",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "Tooark WYSIWYG — rich text editor and viewer (<ark-wysiwyg-editor>, <ark-wysiwyg-viewer>) built on Tiptap, featuring sanitized JSON content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tooark",
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"@tiptap/extension-text-style": "^3.34.0",
|
|
75
75
|
"@tiptap/pm": "^3.34.0",
|
|
76
76
|
"@tiptap/starter-kit": "^3.34.0",
|
|
77
|
-
"@tooark/tokens": "^1.
|
|
77
|
+
"@tooark/tokens": "^1.10.1",
|
|
78
78
|
"tslib": "^2.9.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/node": "^26.6.6"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
|
-
"build": "rollup -c",
|
|
84
|
+
"build": "rollup -c && node ../../scripts/check-treeshake.mjs dist/index.js --export createWysiwygEditor --export sanitizeWysiwygContent --without ArkWysiwygEditor --without ArkWysiwygViewer",
|
|
85
85
|
"dev": "rollup -c -w",
|
|
86
86
|
"clean": "rimraf dist"
|
|
87
87
|
}
|