@tooark/wysiwyg 1.10.0 → 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/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles.cjs +5 -0
- package/dist/styles.cjs.map +1 -1
- package/dist/styles.js +5 -0
- package/dist/styles.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ Pick the toolbar groups per instance with `toolbar` and, to enable images and vi
|
|
|
70
70
|
- Properties: `content` (Tiptap JSON, sanitized; setting it does not emit `ark-wysiwyg-change` and stays out of the undo history), `uploadFile`, `colors`, `highlights` (an array, or the attribute's JSON string, which is what a framework assigns), `resolvedTheme`, `editor` (the Tiptap instance); `insertFile(file)`.
|
|
71
71
|
- Events: `ark-wysiwyg-change` (`detail` = JSON), `ark-wysiwyg-upload-error` (`detail: { reason, file, error? }`, reasons `no-uploader`, `unsupported-type`, `too-large`, `invalid-src`, `failed`).
|
|
72
72
|
- Hooks: the root carries `data-ark="wysiwyg-editor"`, the toolbar `wysiwyg-editor-toolbar` and the editable content `wysiwyg-editor-content`; with `testid`, `data-testid` is the testid and `<testid>-toolbar`/`<testid>-content`.
|
|
73
|
+
- Layout: the host is `display: block` (the package's own stylesheet sets it, for the viewer too), so a `width` on it sizes the editor.
|
|
73
74
|
|
|
74
75
|
### `ark-wysiwyg-viewer`
|
|
75
76
|
|
|
@@ -132,7 +133,7 @@ Installed automatically unless marked as peer; peer dependencies are yours to in
|
|
|
132
133
|
| [`@tiptap/extension-text-style`](https://www.npmjs.com/package/@tiptap/extension-text-style) | ^3.34.0 | Text style mark with color |
|
|
133
134
|
| [`@tiptap/pm`](https://www.npmjs.com/package/@tiptap/pm) | ^3.34.0 | ProseMirror packages used by Tiptap |
|
|
134
135
|
| [`@tiptap/starter-kit`](https://www.npmjs.com/package/@tiptap/starter-kit) | ^3.34.0 | Base nodes and marks (paragraph, heading, lists, bold, link, underline…) |
|
|
135
|
-
| [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.10.
|
|
136
|
+
| [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.10.1 | Design tokens (colors, sizes, motion) and primitive types |
|
|
136
137
|
| [`tslib`](https://www.npmjs.com/package/tslib) | ^2.9.1 | TypeScript runtime helpers |
|
|
137
138
|
|
|
138
139
|
---
|
package/README.pt-BR.md
CHANGED
|
@@ -70,6 +70,7 @@ Escolha os grupos da toolbar por instância com `toolbar` e, para ligar imagens
|
|
|
70
70
|
- Propriedades: `content` (JSON do Tiptap, sanitizado; atribuir não emite `ark-wysiwyg-change` e fica fora do histórico), `uploadFile`, `colors`, `highlights` (um array, ou a string JSON do atributo, que é o que um framework atribui), `resolvedTheme`, `editor` (a instância do Tiptap); `insertFile(file)`.
|
|
71
71
|
- Eventos: `ark-wysiwyg-change` (`detail` = JSON), `ark-wysiwyg-upload-error` (`detail: { reason, file, error? }`, motivos `no-uploader`, `unsupported-type`, `too-large`, `invalid-src`, `failed`).
|
|
72
72
|
- Hooks: a raiz leva `data-ark="wysiwyg-editor"`, a toolbar `wysiwyg-editor-toolbar` e o conteúdo editável `wysiwyg-editor-content`; com `testid`, o `data-testid` é o testid e `<testid>-toolbar`/`<testid>-content`.
|
|
73
|
+
- Layout: o host é `display: block` (a folha de estilo do próprio pacote define, também para o viewer), então um `width` nele dimensiona o editor.
|
|
73
74
|
|
|
74
75
|
### `ark-wysiwyg-viewer`
|
|
75
76
|
|
|
@@ -132,7 +133,7 @@ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta
|
|
|
132
133
|
| [`@tiptap/extension-text-style`](https://www.npmjs.com/package/@tiptap/extension-text-style) | ^3.34.0 | Marca de estilo de texto com cor |
|
|
133
134
|
| [`@tiptap/pm`](https://www.npmjs.com/package/@tiptap/pm) | ^3.34.0 | Pacotes ProseMirror usados pelo Tiptap |
|
|
134
135
|
| [`@tiptap/starter-kit`](https://www.npmjs.com/package/@tiptap/starter-kit) | ^3.34.0 | Nós e marcas base (parágrafo, título, listas, negrito, link, sublinhado…) |
|
|
135
|
-
| [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.10.
|
|
136
|
+
| [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.10.1 | Design tokens (cores, tamanhos, motion) e tipos primitivos |
|
|
136
137
|
| [`tslib`](https://www.npmjs.com/package/tslib) | ^2.9.1 | Helpers de runtime do TypeScript |
|
|
137
138
|
|
|
138
139
|
---
|
package/dist/index.d.cts
CHANGED
|
@@ -344,7 +344,7 @@ declare const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
|
344
344
|
* CSS base do editor/viewer. Plano e independente de Tailwind para que o pacote
|
|
345
345
|
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
346
346
|
*/
|
|
347
|
-
declare 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";
|
|
347
|
+
declare 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";
|
|
348
348
|
/** Injeta o CSS base no <head> uma única vez. */
|
|
349
349
|
declare function ensureWysiwygStyles(): void;
|
|
350
350
|
|
package/dist/index.d.ts
CHANGED
|
@@ -344,7 +344,7 @@ declare const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
|
344
344
|
* CSS base do editor/viewer. Plano e independente de Tailwind para que o pacote
|
|
345
345
|
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
346
346
|
*/
|
|
347
|
-
declare 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";
|
|
347
|
+
declare 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";
|
|
348
348
|
/** Injeta o CSS base no <head> uma única vez. */
|
|
349
349
|
declare function ensureWysiwygStyles(): void;
|
|
350
350
|
|
package/dist/styles.cjs
CHANGED
|
@@ -6,6 +6,11 @@ const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
|
6
6
|
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
7
7
|
*/
|
|
8
8
|
const wysiwygCss = `
|
|
9
|
+
/* O host nasce inline, e num inline width/max-width nao valem: como bloco, a largura do host passa a valer. */
|
|
10
|
+
ark-wysiwyg-editor,
|
|
11
|
+
ark-wysiwyg-viewer {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
9
14
|
.ark-wysiwyg {
|
|
10
15
|
display: flex;
|
|
11
16
|
flex-direction: column;
|
package/dist/styles.cjs.map
CHANGED
|
@@ -1 +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
|
|
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/* 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;;;;"}
|
package/dist/styles.js
CHANGED
|
@@ -4,6 +4,11 @@ const WYSIWYG_STYLE_ID = "ark-wysiwyg-styles";
|
|
|
4
4
|
* funcione em qualquer projeto. Temas via atributo `data-ark-theme`.
|
|
5
5
|
*/
|
|
6
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
|
+
}
|
|
7
12
|
.ark-wysiwyg {
|
|
8
13
|
display: flex;
|
|
9
14
|
flex-direction: column;
|
package/dist/styles.js.map
CHANGED
|
@@ -1 +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.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
|
|
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;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tooark/wysiwyg",
|
|
3
|
-
"version": "1.10.
|
|
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,7 +74,7 @@
|
|
|
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.10.
|
|
77
|
+
"@tooark/tokens": "^1.10.1",
|
|
78
78
|
"tslib": "^2.9.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|