@tooark/wysiwyg 1.9.4 → 1.10.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/README.md +1 -1
- package/README.pt-BR.md +1 -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.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 +283 -0
- package/dist/styles.cjs.map +1 -0
- package/dist/styles.js +279 -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/security.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Regras de segurança do conteúdo: o JSON do Tiptap vem de fora (banco, API,
|
|
2
|
+
// outro usuário), então URLs e cores entram por lista de permissão e nós ou
|
|
3
|
+
// marcas fora do schema caem, em vez de derrubar o documento inteiro.
|
|
4
|
+
const SAFE_PROTOCOLS = new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
5
|
+
// Caracteres de controle e espaços no meio da URL são o truque clássico para passar `java\tscript:`.
|
|
6
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: a faixa de controle é justamente o que se remove
|
|
7
|
+
const STRIP = /[\x00-\x1F\x7F-\x9F\s]/g;
|
|
8
|
+
/**
|
|
9
|
+
* URL aceita em `href`/`src`/`poster`: absoluta em http(s), mailto ou tel, ou relativa (`/caminho`, `#ancora`,
|
|
10
|
+
* `?busca`, `./` e `../`). Fora: `javascript:`, `data:`, `blob:`, `vbscript:` e qualquer outro esquema.
|
|
11
|
+
*/
|
|
12
|
+
function isSafeUrl(value) {
|
|
13
|
+
if (typeof value !== "string")
|
|
14
|
+
return false;
|
|
15
|
+
const url = value.replace(STRIP, "");
|
|
16
|
+
if (!url)
|
|
17
|
+
return false;
|
|
18
|
+
if (/^(\/|#|\?|\.\.?\/)/.test(url))
|
|
19
|
+
return true;
|
|
20
|
+
try {
|
|
21
|
+
return SAFE_PROTOCOLS.has(new URL(url).protocol);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Nome de host sem esquema ("exemplo.com/pagina"), a que o formulário de link acrescenta `https://`. */
|
|
28
|
+
function looksLikeHostname(value) {
|
|
29
|
+
return /^[a-z0-9-]+(\.[a-z0-9-]+)+(:\d+)?([/?#].*)?$/i.test(value.trim());
|
|
30
|
+
}
|
|
31
|
+
/** Valor de cor aceito em `color`: hex, nome CSS ou função rgb/hsl sem `;` (evita injetar outras declarações). */
|
|
32
|
+
function isSafeColor(value) {
|
|
33
|
+
return (typeof value === "string" &&
|
|
34
|
+
/^(#[0-9a-f]{3,8}|[a-z]{3,24}|(rgb|rgba|hsl|hsla)\([0-9.,%\s/]{1,40}\))$/i.test(value.trim()));
|
|
35
|
+
}
|
|
36
|
+
const ALIGNMENTS = new Set(["left", "center", "right", "justify"]);
|
|
37
|
+
function sanitizeMark(mark, schema) {
|
|
38
|
+
if (!mark || typeof mark.type !== "string" || !schema.marks[mark.type])
|
|
39
|
+
return null;
|
|
40
|
+
const attrs = { ...(mark.attrs ?? {}) };
|
|
41
|
+
if (mark.type === "link") {
|
|
42
|
+
if (!isSafeUrl(attrs.href))
|
|
43
|
+
return null;
|
|
44
|
+
attrs.href = attrs.href.replace(STRIP, "");
|
|
45
|
+
}
|
|
46
|
+
if (mark.type === "textStyle" || mark.type === "highlight") {
|
|
47
|
+
if (attrs.color != null && !isSafeColor(attrs.color))
|
|
48
|
+
delete attrs.color;
|
|
49
|
+
if (attrs.backgroundColor != null && !isSafeColor(attrs.backgroundColor))
|
|
50
|
+
delete attrs.backgroundColor;
|
|
51
|
+
}
|
|
52
|
+
const next = { ...mark };
|
|
53
|
+
if (Object.keys(attrs).length > 0) {
|
|
54
|
+
next.attrs = attrs;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
delete next.attrs;
|
|
58
|
+
}
|
|
59
|
+
return next;
|
|
60
|
+
}
|
|
61
|
+
function sanitizeNode(node, schema) {
|
|
62
|
+
if (!node || typeof node.type !== "string" || !schema.nodes[node.type])
|
|
63
|
+
return null;
|
|
64
|
+
const attrs = { ...(node.attrs ?? {}) };
|
|
65
|
+
if (node.type === "image" || node.type === "video") {
|
|
66
|
+
if (!isSafeUrl(attrs.src))
|
|
67
|
+
return null;
|
|
68
|
+
attrs.src = attrs.src.replace(STRIP, "");
|
|
69
|
+
if (attrs.poster != null && !isSafeUrl(attrs.poster))
|
|
70
|
+
delete attrs.poster;
|
|
71
|
+
}
|
|
72
|
+
if (attrs.textAlign != null && !ALIGNMENTS.has(String(attrs.textAlign)))
|
|
73
|
+
delete attrs.textAlign;
|
|
74
|
+
if (node.type === "heading") {
|
|
75
|
+
const level = Number(attrs.level);
|
|
76
|
+
attrs.level = Number.isInteger(level) ? Math.min(4, Math.max(1, level)) : 1;
|
|
77
|
+
}
|
|
78
|
+
const marks = Array.isArray(node.marks)
|
|
79
|
+
? node.marks.map((mark) => sanitizeMark(mark, schema)).filter((mark) => mark !== null)
|
|
80
|
+
: undefined;
|
|
81
|
+
const content = Array.isArray(node.content)
|
|
82
|
+
? node.content.map((child) => sanitizeNode(child, schema)).filter((child) => child !== null)
|
|
83
|
+
: undefined;
|
|
84
|
+
const next = { ...node };
|
|
85
|
+
if (Object.keys(attrs).length > 0) {
|
|
86
|
+
next.attrs = attrs;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
delete next.attrs;
|
|
90
|
+
}
|
|
91
|
+
if (marks)
|
|
92
|
+
next.marks = marks;
|
|
93
|
+
if (content)
|
|
94
|
+
next.content = content;
|
|
95
|
+
return next;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Sanitiza um documento do Tiptap contra o schema do editor: nós e marcas desconhecidos são removidos (com os
|
|
99
|
+
* filhos), links, imagens e vídeos com URL fora da lista de permissão caem, cores inválidas somem e `textAlign`
|
|
100
|
+
* e `level` ficam nos valores previstos. `null` continua `null`.
|
|
101
|
+
*/
|
|
102
|
+
function sanitizeWysiwygContent(content, schema) {
|
|
103
|
+
if (!content)
|
|
104
|
+
return null;
|
|
105
|
+
const doc = sanitizeNode(content, schema);
|
|
106
|
+
if (!doc)
|
|
107
|
+
return null;
|
|
108
|
+
return doc;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { isSafeColor, isSafeUrl, looksLikeHostname, sanitizeWysiwygContent };
|
|
112
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sources":["../src/security.ts"],"sourcesContent":["// Regras de segurança do conteúdo: o JSON do Tiptap vem de fora (banco, API,\n// outro usuário), então URLs e cores entram por lista de permissão e nós ou\n// marcas fora do schema caem, em vez de derrubar o documento inteiro.\n\nimport type { JSONContent } from \"@tiptap/core\";\nimport type { Schema } from \"@tiptap/pm/model\";\n\nconst SAFE_PROTOCOLS = new Set([\"http:\", \"https:\", \"mailto:\", \"tel:\"]);\n\n// Caracteres de controle e espaços no meio da URL são o truque clássico para passar `java\\tscript:`.\n// biome-ignore lint/suspicious/noControlCharactersInRegex: a faixa de controle é justamente o que se remove\nconst STRIP = /[\\x00-\\x1F\\x7F-\\x9F\\s]/g;\n\n/**\n * URL aceita em `href`/`src`/`poster`: absoluta em http(s), mailto ou tel, ou relativa (`/caminho`, `#ancora`,\n * `?busca`, `./` e `../`). Fora: `javascript:`, `data:`, `blob:`, `vbscript:` e qualquer outro esquema.\n */\nexport function isSafeUrl(value: unknown): value is string {\n if (typeof value !== \"string\") return false;\n const url = value.replace(STRIP, \"\");\n if (!url) return false;\n if (/^(\\/|#|\\?|\\.\\.?\\/)/.test(url)) return true;\n try {\n return SAFE_PROTOCOLS.has(new URL(url).protocol);\n } catch {\n return false;\n }\n}\n\n/** Nome de host sem esquema (\"exemplo.com/pagina\"), a que o formulário de link acrescenta `https://`. */\nexport function looksLikeHostname(value: string): boolean {\n return /^[a-z0-9-]+(\\.[a-z0-9-]+)+(:\\d+)?([/?#].*)?$/i.test(value.trim());\n}\n\n/** Valor de cor aceito em `color`: hex, nome CSS ou função rgb/hsl sem `;` (evita injetar outras declarações). */\nexport function isSafeColor(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n /^(#[0-9a-f]{3,8}|[a-z]{3,24}|(rgb|rgba|hsl|hsla)\\([0-9.,%\\s/]{1,40}\\))$/i.test(value.trim())\n );\n}\n\nconst ALIGNMENTS = new Set([\"left\", \"center\", \"right\", \"justify\"]);\n\ntype JSONMark = NonNullable<JSONContent[\"marks\"]>[number];\n\nfunction sanitizeMark(mark: JSONMark, schema: Schema): JSONMark | null {\n if (!mark || typeof mark.type !== \"string\" || !schema.marks[mark.type]) return null;\n const attrs = { ...(mark.attrs ?? {}) };\n if (mark.type === \"link\") {\n if (!isSafeUrl(attrs.href)) return null;\n attrs.href = (attrs.href as string).replace(STRIP, \"\");\n }\n if (mark.type === \"textStyle\" || mark.type === \"highlight\") {\n if (attrs.color != null && !isSafeColor(attrs.color)) delete attrs.color;\n if (attrs.backgroundColor != null && !isSafeColor(attrs.backgroundColor)) delete attrs.backgroundColor;\n }\n const next: JSONMark = { ...mark };\n if (Object.keys(attrs).length > 0) {\n next.attrs = attrs;\n } else {\n delete next.attrs;\n }\n return next;\n}\n\nfunction sanitizeNode(node: JSONContent, schema: Schema): JSONContent | null {\n if (!node || typeof node.type !== \"string\" || !schema.nodes[node.type]) return null;\n const attrs = { ...(node.attrs ?? {}) };\n\n if (node.type === \"image\" || node.type === \"video\") {\n if (!isSafeUrl(attrs.src)) return null;\n attrs.src = (attrs.src as string).replace(STRIP, \"\");\n if (attrs.poster != null && !isSafeUrl(attrs.poster)) delete attrs.poster;\n }\n if (attrs.textAlign != null && !ALIGNMENTS.has(String(attrs.textAlign))) delete attrs.textAlign;\n if (node.type === \"heading\") {\n const level = Number(attrs.level);\n attrs.level = Number.isInteger(level) ? Math.min(4, Math.max(1, level)) : 1;\n }\n\n const marks = Array.isArray(node.marks)\n ? node.marks.map((mark) => sanitizeMark(mark, schema)).filter((mark): mark is JSONMark => mark !== null)\n : undefined;\n const content = Array.isArray(node.content)\n ? node.content.map((child) => sanitizeNode(child, schema)).filter((child): child is JSONContent => child !== null)\n : undefined;\n\n const next: JSONContent = { ...node };\n if (Object.keys(attrs).length > 0) {\n next.attrs = attrs;\n } else {\n delete next.attrs;\n }\n if (marks) next.marks = marks;\n if (content) next.content = content;\n return next;\n}\n\n/**\n * Sanitiza um documento do Tiptap contra o schema do editor: nós e marcas desconhecidos são removidos (com os\n * filhos), links, imagens e vídeos com URL fora da lista de permissão caem, cores inválidas somem e `textAlign`\n * e `level` ficam nos valores previstos. `null` continua `null`.\n */\nexport function sanitizeWysiwygContent(content: JSONContent | null | undefined, schema: Schema): JSONContent | null {\n if (!content) return null;\n const doc = sanitizeNode(content, schema);\n if (!doc) return null;\n return doc;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AAKA,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAEtE;AACA;AACA,MAAM,KAAK,GAAG,yBAAyB;AAEvC;;;AAGG;AACG,SAAU,SAAS,CAAC,KAAc,EAAA;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AACpC,IAAA,IAAI,CAAC,GAAG;AAAE,QAAA,OAAO,KAAK;AACtB,IAAA,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,IAAI;AAC/C,IAAA,IAAI;AACF,QAAA,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IAClD;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;AAEA;AACM,SAAU,iBAAiB,CAAC,KAAa,EAAA;IAC7C,OAAO,+CAA+C,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC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styles.cjs
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
4
|
+
/**
|
|
5
|
+
* CSS base do editor/viewer. Plano e independente de Tailwind para que o pacote
|
|
6
|
+
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
7
|
+
*/
|
|
8
|
+
const wysiwygCss = `
|
|
9
|
+
.ark-wysiwyg {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 8px;
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
color: #0f172a;
|
|
15
|
+
}
|
|
16
|
+
.ark-wysiwyg[data-ark-theme="dark"] { color: #e2e8f0; }
|
|
17
|
+
|
|
18
|
+
/* ---------- Toolbar ---------- */
|
|
19
|
+
.ark-wysiwyg__toolbar {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
padding: 6px;
|
|
25
|
+
border: 1px solid #e2e8f0;
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
background: #f8fafc;
|
|
28
|
+
}
|
|
29
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__toolbar {
|
|
30
|
+
border-color: #334155;
|
|
31
|
+
background: #1e293b;
|
|
32
|
+
}
|
|
33
|
+
.ark-wysiwyg__group {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 2px;
|
|
37
|
+
}
|
|
38
|
+
.ark-wysiwyg__item {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
.ark-wysiwyg__separator {
|
|
43
|
+
width: 1px;
|
|
44
|
+
align-self: stretch;
|
|
45
|
+
margin: 4px 2px;
|
|
46
|
+
background: #e2e8f0;
|
|
47
|
+
}
|
|
48
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__separator { background: #334155; }
|
|
49
|
+
|
|
50
|
+
.ark-wysiwyg__btn {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
min-width: 32px;
|
|
56
|
+
height: 32px;
|
|
57
|
+
padding: 0 6px;
|
|
58
|
+
border: 1px solid transparent;
|
|
59
|
+
border-radius: 6px;
|
|
60
|
+
background: transparent;
|
|
61
|
+
color: inherit;
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: 1;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: background 120ms ease, border-color 120ms ease;
|
|
67
|
+
}
|
|
68
|
+
.ark-wysiwyg__btn svg { width: 18px; height: 18px; }
|
|
69
|
+
.ark-wysiwyg__btn--text { padding: 0 10px; font-size: 13px; }
|
|
70
|
+
.ark-wysiwyg__btn:hover { background: rgba(100, 116, 139, 0.15); }
|
|
71
|
+
.ark-wysiwyg__btn:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
72
|
+
.ark-wysiwyg__btn[aria-pressed="true"] {
|
|
73
|
+
background: rgba(99, 102, 241, 0.16);
|
|
74
|
+
border-color: rgba(99, 102, 241, 0.5);
|
|
75
|
+
}
|
|
76
|
+
.ark-wysiwyg__btn:disabled {
|
|
77
|
+
opacity: 0.45;
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
background: transparent;
|
|
80
|
+
}
|
|
81
|
+
/* Barra com a cor atual sob o icone de cor do texto e de marca-texto. */
|
|
82
|
+
.ark-wysiwyg__btn--swatch::after {
|
|
83
|
+
content: "";
|
|
84
|
+
position: absolute;
|
|
85
|
+
left: 7px;
|
|
86
|
+
right: 7px;
|
|
87
|
+
bottom: 4px;
|
|
88
|
+
height: 3px;
|
|
89
|
+
border-radius: 2px;
|
|
90
|
+
background: var(--ark-wysiwyg-swatch, transparent);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ark-wysiwyg__select {
|
|
94
|
+
height: 32px;
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
border: 1px solid #cbd5e1;
|
|
97
|
+
border-radius: 6px;
|
|
98
|
+
background: #ffffff;
|
|
99
|
+
color: inherit;
|
|
100
|
+
font: inherit;
|
|
101
|
+
font-size: 13px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
.ark-wysiwyg__select:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
105
|
+
.ark-wysiwyg__select:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
106
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__select {
|
|
107
|
+
border-color: #475569;
|
|
108
|
+
background: #0f172a;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* ---------- Popovers (paletas e link) ---------- */
|
|
112
|
+
/* Redefine o que o UA da a [popover]; left/top vem inline, calculados a partir do botao. */
|
|
113
|
+
.ark-wysiwyg__popover {
|
|
114
|
+
position: fixed;
|
|
115
|
+
inset: auto;
|
|
116
|
+
margin: 0;
|
|
117
|
+
padding: 8px;
|
|
118
|
+
border: 1px solid #e2e8f0;
|
|
119
|
+
border-radius: 8px;
|
|
120
|
+
background: #ffffff;
|
|
121
|
+
color: #0f172a;
|
|
122
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
123
|
+
font-family: inherit;
|
|
124
|
+
}
|
|
125
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__popover {
|
|
126
|
+
border-color: #334155;
|
|
127
|
+
background: #1e293b;
|
|
128
|
+
color: #e2e8f0;
|
|
129
|
+
}
|
|
130
|
+
.ark-wysiwyg__swatches {
|
|
131
|
+
display: grid;
|
|
132
|
+
grid-template-columns: repeat(5, 24px);
|
|
133
|
+
gap: 6px;
|
|
134
|
+
}
|
|
135
|
+
.ark-wysiwyg__swatch {
|
|
136
|
+
width: 24px;
|
|
137
|
+
height: 24px;
|
|
138
|
+
padding: 0;
|
|
139
|
+
border: 1px solid rgba(15, 23, 42, 0.15);
|
|
140
|
+
border-radius: 6px;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
color: inherit;
|
|
146
|
+
background: transparent;
|
|
147
|
+
}
|
|
148
|
+
.ark-wysiwyg__swatch svg { width: 16px; height: 16px; }
|
|
149
|
+
.ark-wysiwyg__swatch:hover { transform: scale(1.1); }
|
|
150
|
+
.ark-wysiwyg__swatch:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
151
|
+
.ark-wysiwyg__link {
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
gap: 6px;
|
|
155
|
+
}
|
|
156
|
+
.ark-wysiwyg__input {
|
|
157
|
+
width: 16rem;
|
|
158
|
+
max-width: 60vw;
|
|
159
|
+
height: 32px;
|
|
160
|
+
padding: 0 8px;
|
|
161
|
+
border: 1px solid #cbd5e1;
|
|
162
|
+
border-radius: 6px;
|
|
163
|
+
background: #ffffff;
|
|
164
|
+
color: inherit;
|
|
165
|
+
font: inherit;
|
|
166
|
+
font-size: 13px;
|
|
167
|
+
}
|
|
168
|
+
.ark-wysiwyg__input:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
|
|
169
|
+
.ark-wysiwyg__input[aria-invalid="true"] { border-color: #dc2626; }
|
|
170
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__input {
|
|
171
|
+
border-color: #475569;
|
|
172
|
+
background: #0f172a;
|
|
173
|
+
}
|
|
174
|
+
.ark-wysiwyg__error {
|
|
175
|
+
margin: 6px 0 0;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
color: #dc2626;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* ---------- Conteudo ---------- */
|
|
181
|
+
.ark-wysiwyg__content {
|
|
182
|
+
border: 1px solid #e2e8f0;
|
|
183
|
+
border-radius: 8px;
|
|
184
|
+
background: #ffffff;
|
|
185
|
+
}
|
|
186
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ark-wysiwyg__content {
|
|
187
|
+
border-color: #334155;
|
|
188
|
+
background: #0f172a;
|
|
189
|
+
}
|
|
190
|
+
.ark-wysiwyg--viewer .ark-wysiwyg__content {
|
|
191
|
+
border: none;
|
|
192
|
+
background: transparent;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.ark-wysiwyg .ProseMirror {
|
|
196
|
+
min-height: 120px;
|
|
197
|
+
padding: 12px 14px;
|
|
198
|
+
outline: none;
|
|
199
|
+
line-height: 1.6;
|
|
200
|
+
}
|
|
201
|
+
.ark-wysiwyg--viewer .ProseMirror { min-height: 0; padding: 0; }
|
|
202
|
+
.ark-wysiwyg .ProseMirror > * + * { margin-top: 0.6em; }
|
|
203
|
+
.ark-wysiwyg .ProseMirror h1 { font-size: 1.6em; font-weight: 700; }
|
|
204
|
+
.ark-wysiwyg .ProseMirror h2 { font-size: 1.35em; font-weight: 700; }
|
|
205
|
+
.ark-wysiwyg .ProseMirror h3 { font-size: 1.15em; font-weight: 700; }
|
|
206
|
+
.ark-wysiwyg .ProseMirror h4 { font-size: 1em; font-weight: 700; }
|
|
207
|
+
.ark-wysiwyg .ProseMirror ul,
|
|
208
|
+
.ark-wysiwyg .ProseMirror ol { padding-left: 1.4em; }
|
|
209
|
+
.ark-wysiwyg .ProseMirror ul { list-style: disc; }
|
|
210
|
+
.ark-wysiwyg .ProseMirror ol { list-style: decimal; }
|
|
211
|
+
.ark-wysiwyg .ProseMirror blockquote {
|
|
212
|
+
border-left: 3px solid #cbd5e1;
|
|
213
|
+
padding-left: 12px;
|
|
214
|
+
color: #475569;
|
|
215
|
+
}
|
|
216
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror blockquote {
|
|
217
|
+
border-left-color: #475569;
|
|
218
|
+
color: #94a3b8;
|
|
219
|
+
}
|
|
220
|
+
.ark-wysiwyg .ProseMirror code {
|
|
221
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
222
|
+
font-size: 0.9em;
|
|
223
|
+
background: rgba(100, 116, 139, 0.18);
|
|
224
|
+
padding: 0.1em 0.3em;
|
|
225
|
+
border-radius: 4px;
|
|
226
|
+
}
|
|
227
|
+
.ark-wysiwyg .ProseMirror hr {
|
|
228
|
+
border: none;
|
|
229
|
+
border-top: 1px solid #cbd5e1;
|
|
230
|
+
margin: 1em 0;
|
|
231
|
+
}
|
|
232
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror hr { border-top-color: #475569; }
|
|
233
|
+
.ark-wysiwyg .ProseMirror a {
|
|
234
|
+
color: #2563eb;
|
|
235
|
+
text-decoration: underline;
|
|
236
|
+
text-underline-offset: 2px;
|
|
237
|
+
}
|
|
238
|
+
.ark-wysiwyg[data-ark-theme="dark"] .ProseMirror a { color: #93c5fd; }
|
|
239
|
+
/* Marca-texto: fundo pastel com texto escuro nos dois temas, para ler sempre. */
|
|
240
|
+
.ark-wysiwyg .ProseMirror mark {
|
|
241
|
+
color: #0f172a;
|
|
242
|
+
border-radius: 2px;
|
|
243
|
+
padding: 0 0.1em;
|
|
244
|
+
}
|
|
245
|
+
.ark-wysiwyg .ProseMirror img,
|
|
246
|
+
.ark-wysiwyg .ProseMirror video {
|
|
247
|
+
display: block;
|
|
248
|
+
max-width: 100%;
|
|
249
|
+
height: auto;
|
|
250
|
+
border-radius: 6px;
|
|
251
|
+
}
|
|
252
|
+
.ark-wysiwyg .ProseMirror img.ProseMirror-selectednode,
|
|
253
|
+
.ark-wysiwyg .ProseMirror video.ProseMirror-selectednode {
|
|
254
|
+
outline: 2px solid #6366f1;
|
|
255
|
+
outline-offset: 2px;
|
|
256
|
+
}
|
|
257
|
+
.ark-wysiwyg[aria-busy="true"] .ark-wysiwyg__content { cursor: progress; }
|
|
258
|
+
|
|
259
|
+
/* Placeholder (extension-placeholder) */
|
|
260
|
+
.ark-wysiwyg .ProseMirror p.is-editor-empty:first-child::before {
|
|
261
|
+
content: attr(data-placeholder);
|
|
262
|
+
float: left;
|
|
263
|
+
height: 0;
|
|
264
|
+
pointer-events: none;
|
|
265
|
+
color: #94a3b8;
|
|
266
|
+
}
|
|
267
|
+
`;
|
|
268
|
+
/** Injeta o CSS base no <head> uma única vez. */
|
|
269
|
+
function ensureWysiwygStyles() {
|
|
270
|
+
if (typeof document === "undefined")
|
|
271
|
+
return;
|
|
272
|
+
if (document.getElementById(WYSIWYG_STYLE_ID))
|
|
273
|
+
return;
|
|
274
|
+
const style = document.createElement("style");
|
|
275
|
+
style.id = WYSIWYG_STYLE_ID;
|
|
276
|
+
style.textContent = wysiwygCss;
|
|
277
|
+
document.head.appendChild(style);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
exports.WYSIWYG_STYLE_ID = WYSIWYG_STYLE_ID;
|
|
281
|
+
exports.ensureWysiwygStyles = ensureWysiwygStyles;
|
|
282
|
+
exports.wysiwygCss = wysiwygCss;
|
|
283
|
+
//# sourceMappingURL=styles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.cjs","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.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqQ1B;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;;;;"}
|