@aquera/nile-elements 1.9.7 → 1.9.9
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 +6 -0
- package/dist/{index-249de90a.esm.js → index-289706c7.esm.js} +1 -1
- package/dist/{index-df196058.cjs.js → index-d7e6f1c6.cjs.js} +2 -2
- package/dist/index-d7e6f1c6.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1587 -1276
- package/dist/katex-44476ab4.esm.js +1 -0
- package/dist/katex-f4186f87.cjs.js +2 -0
- package/dist/katex-f4186f87.cjs.js.map +1 -0
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/index.esm.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js.map +1 -1
- package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +52 -44
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +23 -22
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +22 -3
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
- package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +23 -15
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +0 -3
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +225 -24
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +9 -9
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +115 -13
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +13 -12
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +9 -1
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-virtual-select/renderer.js +1 -0
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/index.js +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +36 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
- package/dist/src/nile-wysiwyg-editor/types.js +2 -2
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/xml-25c4108a.esm.js +1 -0
- package/dist/xml-90fd974e.cjs.js +2 -0
- package/dist/xml-90fd974e.cjs.js.map +1 -0
- package/package.json +2 -1
- package/rollup.config.js +1 -0
- package/src/index.ts +8 -0
- package/src/nile-color-picker/nile-color-picker.ts +1 -0
- package/src/nile-select/virtual-scroll-helper.ts +9 -1
- package/src/nile-virtual-select/renderer.ts +1 -1
- package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
- package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
- package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
- package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
- package/src/nile-wysiwyg-editor/index.ts +5 -0
- package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
- package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
- package/src/nile-wysiwyg-editor/types.ts +6 -4
- package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
- package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
- package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
- package/vscode-html-custom-data.json +75 -6
- package/dist/index-df196058.cjs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-wysiwyg-toolbar.css.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"nile-wysiwyg-toolbar.css.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NxB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Toolbar styled to match nile-rich-text-editor: white toolbar, 32×32\n * borderless buttons, dropdown-button selects with menu panels,\n * swatch-palette color pickers, 24px dividers.\n */\nexport const styles = css`\n :host {\n display: block;\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n }\n\n .toolbar {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n padding: 8px;\n border-bottom: 1px solid\n var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border-radius: 8px 8px 0 0;\n box-sizing: border-box;\n }\n\n .toolbar__divider {\n width: 1px;\n height: 24px;\n margin: 0 4px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n }\n\n button.toolbar__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0 6px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n }\n\n button.toolbar__button:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__button[data-active] {\n background: var(--nile-colors-primary-50, var(--ng-componentcolors-utility-blue-50, #eff4ff));\n }\n\n button.toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n /* --- Dropdown selects (heading / font / size), nile-rte-select style --- */\n .toolbar__dropdown {\n position: relative;\n display: inline-flex;\n }\n\n button.toolbar__dd-trigger {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 32px;\n height: 32px;\n padding: 0 6px 0 10px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 13px;\n white-space: nowrap;\n }\n\n button.toolbar__dd-trigger:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__dd-trigger:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .toolbar__dd-menu {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 30;\n min-width: 140px;\n max-height: 260px;\n overflow-y: auto;\n padding: 4px;\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__dd-item {\n display: flex;\n align-items: center;\n padding: 6px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 13px;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n white-space: nowrap;\n }\n\n .toolbar__dd-item:hover {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n .toolbar__dd-item[data-active] {\n background: var(\n --nile-colors-primary-50,\n var(--ng-componentcolors-utility-blue-50, #eff4ff)\n );\n color: var(--nile-colors-primary-700, #1d4ed8);\n }\n\n /* --- Color pickers, nile-rte-color style --- */\n .toolbar__color {\n position: relative;\n display: inline-flex;\n }\n\n .toolbar__color .glyph-stack {\n display: grid;\n align-items: center;\n justify-items: center;\n line-height: 1;\n pointer-events: none;\n }\n\n .toolbar__color .glyph {\n font-size: 14px;\n margin-bottom: 2px;\n font-weight: 400;\n }\n\n .toolbar__color .underline {\n width: 18px;\n height: 3px;\n border-radius: 2px;\n }\n\n .toolbar__color .swatch-box {\n width: 18px;\n height: 16px;\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.35);\n pointer-events: none;\n box-sizing: border-box;\n }\n\n /* Floating panel that hosts the inline nile-color-picker. */\n .toolbar__color-panel {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 30;\n background: var(--nile-colors-white-base, #ffffff);\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n /* --- Overflow (\"more\" / 3-dot) menu --- */\n /* The 3-dot button stays in its normal place in the toolbar flow. */\n .toolbar__overflow {\n position: relative;\n display: inline-flex;\n }\n\n /* Panel drops directly beneath the 3-dot button, aligned to its left edge and\n extending right, so it opens wherever the button sits. width:max-content\n sizes it to exactly its controls (rather than collapsing to the 32px\n button's shrink-to-fit width); the max-width cap wraps a full menu onto\n multiple rows instead of running off-screen. */\n .toolbar__overflow-panel {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n right: auto;\n width: max-content;\n max-width: min(360px, calc(100vw - 32px));\n z-index: 31;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n padding: 8px;\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__overflow-divider {\n width: 1px;\n height: 24px;\n margin: 0 4px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n }\n`;\n"]}
|
|
@@ -2,6 +2,21 @@ import { TemplateResult, CSSResultArray } from 'lit';
|
|
|
2
2
|
import NileElement from '../../internal/nile-element';
|
|
3
3
|
import type { ToolbarState } from '../engine/selection-state';
|
|
4
4
|
import '../ui/table-grid-picker';
|
|
5
|
+
import '../../nile-color-picker/nile-color-picker';
|
|
6
|
+
/**
|
|
7
|
+
* A single control in an author-supplied (light-DOM) toolbar. `name` is a
|
|
8
|
+
* built-in control key (the same names the `config` string accepts) or `'|'`
|
|
9
|
+
* for a group divider; `label`/`icon` optionally override the built-in
|
|
10
|
+
* tooltip/glyph. Produced by the editor from `<nile-wysiwyg-toolbar-item>`
|
|
11
|
+
* children.
|
|
12
|
+
*/
|
|
13
|
+
export interface AuthoredToolbarItem {
|
|
14
|
+
name: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
/** When true, the control is placed in the 3-dot overflow menu. */
|
|
18
|
+
overflow?: boolean;
|
|
19
|
+
}
|
|
5
20
|
/**
|
|
6
21
|
* Config-driven toolbar. Renders from a single immutable ToolbarState
|
|
7
22
|
* snapshot; every interaction is dispatched to the host as a
|
|
@@ -12,17 +27,35 @@ import '../ui/table-grid-picker';
|
|
|
12
27
|
export declare class NileWysiwygToolbar extends NileElement {
|
|
13
28
|
/** Space-separated item names; `|` inserts a divider. */
|
|
14
29
|
config: string;
|
|
30
|
+
/**
|
|
31
|
+
* Structured item list authored in light DOM (from
|
|
32
|
+
* `<nile-wysiwyg-toolbar-item>` children). When set and non-empty it takes
|
|
33
|
+
* precedence over `config`, and each item may override the built-in
|
|
34
|
+
* label/icon.
|
|
35
|
+
*/
|
|
36
|
+
items?: AuthoredToolbarItem[];
|
|
15
37
|
disabled: boolean;
|
|
16
38
|
toolbarState?: ToolbarState;
|
|
17
39
|
/** Which dropdown/color panel is open (item name), if any. */
|
|
18
40
|
private openMenu;
|
|
19
|
-
/**
|
|
20
|
-
private
|
|
41
|
+
/** Whether the overflow ("more" / 3-dot) menu panel is open. */
|
|
42
|
+
private overflowOpen;
|
|
21
43
|
static get styles(): CSSResultArray;
|
|
44
|
+
/**
|
|
45
|
+
* True when this instance is an author's declarative `<nile-wysiwyg-toolbar>`
|
|
46
|
+
* container sitting in an editor's light DOM (holding
|
|
47
|
+
* `<nile-wysiwyg-toolbar-item>` children). Such an instance renders nothing
|
|
48
|
+
* and wires up no listeners — the editor reads the items and renders the real
|
|
49
|
+
* toolbar in its own shadow DOM. The editor's internal instance lives inside
|
|
50
|
+
* a shadow root, so `closest` (which stops at shadow boundaries) never
|
|
51
|
+
* matches it; a standalone toolbar on a page has no editor ancestor either.
|
|
52
|
+
*/
|
|
53
|
+
private get isAuthoringContainer();
|
|
22
54
|
connectedCallback(): void;
|
|
23
55
|
disconnectedCallback(): void;
|
|
24
56
|
private handleOutsideClick;
|
|
25
57
|
private toggleMenu;
|
|
58
|
+
private toggleOverflow;
|
|
26
59
|
private dispatchCommand;
|
|
27
60
|
/** Wraps a control in the design system's lightweight tooltip (same as
|
|
28
61
|
* the legacy rich text editor's toolbar). */
|
|
@@ -32,6 +65,21 @@ export declare class NileWysiwygToolbar extends NileElement {
|
|
|
32
65
|
private setColor;
|
|
33
66
|
private renderColor;
|
|
34
67
|
private renderItem;
|
|
68
|
+
/** Parses the `config` string into a flat token list, keeping the `|`
|
|
69
|
+
* (divider) and `>>` (overflow) markers as items. */
|
|
70
|
+
private itemsFromConfig;
|
|
71
|
+
/** Splits a flat item list into groups, breaking on `'|'` dividers. */
|
|
72
|
+
private groupItems;
|
|
73
|
+
/** Partitions the flat item list into the always-visible main groups and the
|
|
74
|
+
* overflow (3-dot menu) groups. Two forms are supported: a positional `>>`
|
|
75
|
+
* token in the `config` string (everything after it overflows), or a
|
|
76
|
+
* per-item `overflow` flag on authored items (each flagged item overflows,
|
|
77
|
+
* wherever it sits). Without either, everything stays on the main bar. */
|
|
78
|
+
private partitionGroups;
|
|
79
|
+
/** Renders the trailing 3-dot "more" button and its collapsible panel that
|
|
80
|
+
* hosts the overflow groups (everything after `>>` in the config). The panel
|
|
81
|
+
* drops directly beneath the button, wherever the button sits in the bar. */
|
|
82
|
+
private renderOverflow;
|
|
35
83
|
render(): TemplateResult;
|
|
36
84
|
}
|
|
37
85
|
declare global {
|
|
@@ -6,6 +6,7 @@ import { renderGlyph } from '../../internal/glyph';
|
|
|
6
6
|
import { styles } from './nile-wysiwyg-toolbar.css';
|
|
7
7
|
import { DEFAULT_TOOLBAR } from '../types';
|
|
8
8
|
import '../ui/table-grid-picker';
|
|
9
|
+
import '../../nile-color-picker/nile-color-picker';
|
|
9
10
|
const FONT_FAMILIES = [
|
|
10
11
|
'Arial',
|
|
11
12
|
'Georgia',
|
|
@@ -16,12 +17,6 @@ const FONT_FAMILIES = [
|
|
|
16
17
|
'Courier New',
|
|
17
18
|
];
|
|
18
19
|
const FONT_SIZES = ['10px', '12px', '14px', '16px', '18px', '20px', '24px', '28px', '32px', '48px'];
|
|
19
|
-
/** Same default palette as nile-rte-color. */
|
|
20
|
-
const COLOR_PALETTE = [
|
|
21
|
-
'#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#ffffff',
|
|
22
|
-
'#d32f2f', '#f44336', '#ff9800', '#ffeb3b', '#4caf50', '#2196f3', '#3f51b5', '#9c27b0',
|
|
23
|
-
'#03a9f4', '#00bcd4', '#009688', '#8bc34a', '#cddc39', '#ffc107', '#ff5722',
|
|
24
|
-
];
|
|
25
20
|
const ITEMS = {
|
|
26
21
|
undo: {
|
|
27
22
|
kind: 'button',
|
|
@@ -436,18 +431,38 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
436
431
|
this.disabled = false;
|
|
437
432
|
/** Which dropdown/color panel is open (item name), if any. */
|
|
438
433
|
this.openMenu = null;
|
|
439
|
-
/**
|
|
440
|
-
this.
|
|
434
|
+
/** Whether the overflow ("more" / 3-dot) menu panel is open. */
|
|
435
|
+
this.overflowOpen = false;
|
|
441
436
|
this.handleOutsideClick = (event) => {
|
|
442
|
-
if (this.openMenu && !event.composedPath().includes(this))
|
|
437
|
+
if ((this.openMenu || this.overflowOpen) && !event.composedPath().includes(this)) {
|
|
443
438
|
this.openMenu = null;
|
|
439
|
+
this.overflowOpen = false;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
this.toggleOverflow = () => {
|
|
443
|
+
this.overflowOpen = !this.overflowOpen;
|
|
444
|
+
this.openMenu = null;
|
|
444
445
|
};
|
|
445
446
|
}
|
|
446
447
|
static get styles() {
|
|
447
448
|
return [styles];
|
|
448
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* True when this instance is an author's declarative `<nile-wysiwyg-toolbar>`
|
|
452
|
+
* container sitting in an editor's light DOM (holding
|
|
453
|
+
* `<nile-wysiwyg-toolbar-item>` children). Such an instance renders nothing
|
|
454
|
+
* and wires up no listeners — the editor reads the items and renders the real
|
|
455
|
+
* toolbar in its own shadow DOM. The editor's internal instance lives inside
|
|
456
|
+
* a shadow root, so `closest` (which stops at shadow boundaries) never
|
|
457
|
+
* matches it; a standalone toolbar on a page has no editor ancestor either.
|
|
458
|
+
*/
|
|
459
|
+
get isAuthoringContainer() {
|
|
460
|
+
return !!this.closest('nile-wysiwyg-editor');
|
|
461
|
+
}
|
|
449
462
|
connectedCallback() {
|
|
450
463
|
super.connectedCallback();
|
|
464
|
+
if (this.isAuthoringContainer)
|
|
465
|
+
return;
|
|
451
466
|
document.addEventListener('mousedown', this.handleOutsideClick);
|
|
452
467
|
}
|
|
453
468
|
disconnectedCallback() {
|
|
@@ -458,26 +473,32 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
458
473
|
this.openMenu = this.openMenu === name ? null : name;
|
|
459
474
|
}
|
|
460
475
|
dispatchCommand(name, attrs) {
|
|
476
|
+
// A dispatched command means the user picked an action, so collapse the
|
|
477
|
+
// overflow "more" panel (a select/color trigger only opens a submenu — it
|
|
478
|
+
// doesn't dispatch — so it leaves the panel open until a value is chosen).
|
|
479
|
+
this.overflowOpen = false;
|
|
461
480
|
this.emit('wysiwyg-command', { name, attrs });
|
|
462
481
|
}
|
|
463
482
|
/** Wraps a control in the design system's lightweight tooltip (same as
|
|
464
483
|
* the legacy rich text editor's toolbar). */
|
|
465
484
|
withTooltip(label, control) {
|
|
466
485
|
return html `
|
|
467
|
-
<nile-lite-tooltip content=${label} placement="
|
|
486
|
+
<nile-lite-tooltip content=${label} placement="top">${control}</nile-lite-tooltip>
|
|
468
487
|
`;
|
|
469
488
|
}
|
|
470
|
-
renderButton(def) {
|
|
489
|
+
renderButton(def, overrides) {
|
|
471
490
|
const state = this.toolbarState;
|
|
472
491
|
const isActive = state && def.active ? def.active(state) : false;
|
|
473
492
|
const isDisabled = this.disabled || (state && def.disabled ? def.disabled(state) : false);
|
|
474
|
-
const
|
|
475
|
-
|
|
493
|
+
const label = overrides?.label ?? def.label;
|
|
494
|
+
const baseIcon = overrides?.icon ?? def.icon;
|
|
495
|
+
const icon = isActive && def.iconActive ? def.iconActive : baseIcon;
|
|
496
|
+
return this.withTooltip(label, html `
|
|
476
497
|
<button
|
|
477
498
|
type="button"
|
|
478
499
|
class="toolbar__button"
|
|
479
500
|
part="button"
|
|
480
|
-
aria-label=${
|
|
501
|
+
aria-label=${label}
|
|
481
502
|
aria-pressed=${isActive ? 'true' : 'false'}
|
|
482
503
|
?data-active=${isActive}
|
|
483
504
|
?disabled=${isDisabled}
|
|
@@ -488,20 +509,21 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
488
509
|
</button>
|
|
489
510
|
`);
|
|
490
511
|
}
|
|
491
|
-
renderSelect(name, def) {
|
|
512
|
+
renderSelect(name, def, overrides) {
|
|
492
513
|
const value = this.toolbarState ? def.value(this.toolbarState) : '';
|
|
493
514
|
const options = typeof def.options === 'function' ? def.options(this.toolbarState) : def.options;
|
|
494
515
|
const current = options.find(opt => opt.value === value) ?? options[0];
|
|
495
516
|
const isDisabled = this.disabled ||
|
|
496
517
|
(this.toolbarState && def.disabled ? def.disabled(this.toolbarState) : false);
|
|
497
518
|
const isFont = name === 'fontFamily';
|
|
519
|
+
const label = overrides?.label ?? def.label;
|
|
498
520
|
return html `
|
|
499
521
|
<span class="toolbar__dropdown" part="select">
|
|
500
|
-
${this.withTooltip(
|
|
522
|
+
${this.withTooltip(label, html `
|
|
501
523
|
<button
|
|
502
524
|
type="button"
|
|
503
525
|
class="toolbar__dd-trigger"
|
|
504
|
-
aria-label=${
|
|
526
|
+
aria-label=${label}
|
|
505
527
|
aria-expanded=${this.openMenu === name ? 'true' : 'false'}
|
|
506
528
|
?disabled=${isDisabled}
|
|
507
529
|
style=${isFont && value ? `font-family: ${value}` : ''}
|
|
@@ -535,27 +557,23 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
535
557
|
</span>
|
|
536
558
|
`;
|
|
537
559
|
}
|
|
538
|
-
setColor(
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
this.
|
|
542
|
-
...this.recentColors,
|
|
543
|
-
[name]: [color, ...recent.filter(c => c !== color)].slice(0, 8),
|
|
544
|
-
};
|
|
545
|
-
this.dispatchCommand(def.command, { color });
|
|
560
|
+
setColor(def, color) {
|
|
561
|
+
// nile-color-picker emits 'none' for the "No Fill" action; an empty color
|
|
562
|
+
// clears the mark in the command engine.
|
|
563
|
+
this.dispatchCommand(def.command, { color: color === 'none' ? '' : color });
|
|
546
564
|
}
|
|
547
|
-
renderColor(name, def) {
|
|
565
|
+
renderColor(name, def, overrides) {
|
|
548
566
|
const current = this.toolbarState ? def.value(this.toolbarState) : null;
|
|
549
567
|
const shown = current ?? '#000000';
|
|
550
|
-
const recent = this.recentColors[name] ?? [];
|
|
551
568
|
const isBg = def.command === 'bgColor';
|
|
569
|
+
const label = overrides?.label ?? def.label;
|
|
552
570
|
return html `
|
|
553
571
|
<span class="toolbar__color" part="color">
|
|
554
|
-
${this.withTooltip(
|
|
572
|
+
${this.withTooltip(label, html `
|
|
555
573
|
<button
|
|
556
574
|
type="button"
|
|
557
575
|
class="toolbar__button"
|
|
558
|
-
aria-label=${
|
|
576
|
+
aria-label=${label}
|
|
559
577
|
aria-expanded=${this.openMenu === name ? 'true' : 'false'}
|
|
560
578
|
?disabled=${this.disabled}
|
|
561
579
|
@mousedown=${(e) => e.preventDefault()}
|
|
@@ -573,76 +591,23 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
573
591
|
`)}
|
|
574
592
|
${this.openMenu === name
|
|
575
593
|
? html `
|
|
576
|
-
<div class="
|
|
577
|
-
<
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
style="background: ${color}"
|
|
585
|
-
title=${color}
|
|
586
|
-
@click=${() => this.setColor(name, def, color)}
|
|
587
|
-
>
|
|
588
|
-
${current === color
|
|
589
|
-
? html `<span class="checkmark">✓</span>`
|
|
590
|
-
: nothing}
|
|
591
|
-
</button>
|
|
592
|
-
`)}
|
|
593
|
-
</div>
|
|
594
|
-
</div>
|
|
595
|
-
${recent.length
|
|
596
|
-
? html `
|
|
597
|
-
<div class="section">
|
|
598
|
-
<div class="title">Recently Used</div>
|
|
599
|
-
<div class="swatches">
|
|
600
|
-
${recent.map(color => html `
|
|
601
|
-
<button
|
|
602
|
-
type="button"
|
|
603
|
-
class="swatch"
|
|
604
|
-
style="background: ${color}"
|
|
605
|
-
title=${color}
|
|
606
|
-
@click=${() => this.setColor(name, def, color)}
|
|
607
|
-
></button>
|
|
608
|
-
`)}
|
|
609
|
-
</div>
|
|
610
|
-
</div>
|
|
611
|
-
`
|
|
612
|
-
: nothing}
|
|
613
|
-
<div class="section">
|
|
614
|
-
<div class="title">Custom</div>
|
|
615
|
-
<div class="swatches">
|
|
616
|
-
<button
|
|
617
|
-
type="button"
|
|
618
|
-
class="swatch add"
|
|
619
|
-
@click=${(e) => {
|
|
620
|
-
const input = e.currentTarget
|
|
621
|
-
.closest('.toolbar__color')
|
|
622
|
-
.querySelector('input[type="color"]');
|
|
623
|
-
input?.click();
|
|
624
|
-
}}
|
|
625
|
-
>
|
|
626
|
-
+
|
|
627
|
-
</button>
|
|
628
|
-
</div>
|
|
629
|
-
</div>
|
|
594
|
+
<div class="toolbar__color-panel">
|
|
595
|
+
<nile-color-picker
|
|
596
|
+
mode="inline"
|
|
597
|
+
type="swatches"
|
|
598
|
+
.noFill=${isBg}
|
|
599
|
+
.value=${shown}
|
|
600
|
+
@nile-change=${(e) => this.setColor(def, e.detail.value)}
|
|
601
|
+
></nile-color-picker>
|
|
630
602
|
</div>
|
|
631
603
|
`
|
|
632
604
|
: nothing}
|
|
633
|
-
<input
|
|
634
|
-
type="color"
|
|
635
|
-
tabindex="-1"
|
|
636
|
-
aria-hidden="true"
|
|
637
|
-
.value=${shown}
|
|
638
|
-
@input=${(e) => this.setColor(name, def, e.target.value)}
|
|
639
|
-
/>
|
|
640
605
|
</span>
|
|
641
606
|
`;
|
|
642
607
|
}
|
|
643
|
-
renderItem(name) {
|
|
608
|
+
renderItem(name, overrides) {
|
|
644
609
|
if (name === 'table') {
|
|
645
|
-
return this.withTooltip('Insert table', html `
|
|
610
|
+
return this.withTooltip(overrides?.label ?? 'Insert table', html `
|
|
646
611
|
<nile-wysiwyg-table-picker
|
|
647
612
|
part="button"
|
|
648
613
|
?disabled=${this.disabled}
|
|
@@ -654,26 +619,114 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
654
619
|
return nothing;
|
|
655
620
|
switch (def.kind) {
|
|
656
621
|
case 'button':
|
|
657
|
-
return this.renderButton(def);
|
|
622
|
+
return this.renderButton(def, overrides);
|
|
658
623
|
case 'select':
|
|
659
|
-
return this.renderSelect(name, def);
|
|
624
|
+
return this.renderSelect(name, def, overrides);
|
|
660
625
|
case 'color':
|
|
661
|
-
return this.renderColor(name, def);
|
|
626
|
+
return this.renderColor(name, def, overrides);
|
|
662
627
|
default:
|
|
663
628
|
return nothing;
|
|
664
629
|
}
|
|
665
630
|
}
|
|
631
|
+
/** Parses the `config` string into a flat token list, keeping the `|`
|
|
632
|
+
* (divider) and `>>` (overflow) markers as items. */
|
|
633
|
+
itemsFromConfig(config) {
|
|
634
|
+
return config
|
|
635
|
+
.trim()
|
|
636
|
+
.split(/\s+/)
|
|
637
|
+
.filter(Boolean)
|
|
638
|
+
.map(name => ({ name }));
|
|
639
|
+
}
|
|
640
|
+
/** Splits a flat item list into groups, breaking on `'|'` dividers. */
|
|
641
|
+
groupItems(items) {
|
|
642
|
+
const groups = [[]];
|
|
643
|
+
for (const item of items) {
|
|
644
|
+
if (item.name === '|') {
|
|
645
|
+
if (groups[groups.length - 1].length)
|
|
646
|
+
groups.push([]);
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
groups[groups.length - 1].push(item);
|
|
650
|
+
}
|
|
651
|
+
return groups.filter(group => group.length > 0);
|
|
652
|
+
}
|
|
653
|
+
/** Partitions the flat item list into the always-visible main groups and the
|
|
654
|
+
* overflow (3-dot menu) groups. Two forms are supported: a positional `>>`
|
|
655
|
+
* token in the `config` string (everything after it overflows), or a
|
|
656
|
+
* per-item `overflow` flag on authored items (each flagged item overflows,
|
|
657
|
+
* wherever it sits). Without either, everything stays on the main bar. */
|
|
658
|
+
partitionGroups(items) {
|
|
659
|
+
const at = items.findIndex(item => item.name === '>>');
|
|
660
|
+
if (at !== -1) {
|
|
661
|
+
return {
|
|
662
|
+
main: this.groupItems(items.slice(0, at)),
|
|
663
|
+
overflow: this.groupItems(items.slice(at + 1)),
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
if (!items.some(item => item.overflow)) {
|
|
667
|
+
return { main: this.groupItems(items), overflow: [] };
|
|
668
|
+
}
|
|
669
|
+
return {
|
|
670
|
+
main: this.groupItems(items.filter(item => !item.overflow)),
|
|
671
|
+
overflow: this.groupItems(items.filter(item => item.overflow)),
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
/** Renders the trailing 3-dot "more" button and its collapsible panel that
|
|
675
|
+
* hosts the overflow groups (everything after `>>` in the config). The panel
|
|
676
|
+
* drops directly beneath the button, wherever the button sits in the bar. */
|
|
677
|
+
renderOverflow(hasMain, groups) {
|
|
678
|
+
const open = this.overflowOpen;
|
|
679
|
+
return html `
|
|
680
|
+
${hasMain ? html `<span class="toolbar__divider"></span>` : nothing}
|
|
681
|
+
<span class="toolbar__overflow" part="overflow">
|
|
682
|
+
${this.withTooltip('More', html `
|
|
683
|
+
<button
|
|
684
|
+
type="button"
|
|
685
|
+
class="toolbar__button"
|
|
686
|
+
aria-label="More"
|
|
687
|
+
aria-haspopup="true"
|
|
688
|
+
aria-expanded=${open ? 'true' : 'false'}
|
|
689
|
+
?data-active=${open}
|
|
690
|
+
?disabled=${this.disabled}
|
|
691
|
+
@mousedown=${(e) => e.preventDefault()}
|
|
692
|
+
@click=${this.toggleOverflow}
|
|
693
|
+
>
|
|
694
|
+
${renderGlyph('ng-dots-vertical', 18)}
|
|
695
|
+
</button>
|
|
696
|
+
`)}
|
|
697
|
+
${open
|
|
698
|
+
? html `
|
|
699
|
+
<div
|
|
700
|
+
class="toolbar__overflow-panel"
|
|
701
|
+
part="overflow-panel"
|
|
702
|
+
@mousedown=${(e) => e.preventDefault()}
|
|
703
|
+
>
|
|
704
|
+
${groups.map((group, index) => html `
|
|
705
|
+
${index > 0
|
|
706
|
+
? html `<span class="toolbar__overflow-divider"></span>`
|
|
707
|
+
: nothing}
|
|
708
|
+
${group.map(item => this.renderItem(item.name, { label: item.label, icon: item.icon }))}
|
|
709
|
+
`)}
|
|
710
|
+
</div>
|
|
711
|
+
`
|
|
712
|
+
: nothing}
|
|
713
|
+
</span>
|
|
714
|
+
`;
|
|
715
|
+
}
|
|
666
716
|
render() {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
717
|
+
// A declarative container in an editor's light DOM only carries authored
|
|
718
|
+
// <nile-wysiwyg-toolbar-item> children; the editor renders the real bar.
|
|
719
|
+
if (this.isAuthoringContainer)
|
|
720
|
+
return html ``;
|
|
721
|
+
const items = this.items && this.items.length ? this.items : this.itemsFromConfig(this.config);
|
|
722
|
+
const { main, overflow } = this.partitionGroups(items);
|
|
671
723
|
return html `
|
|
672
724
|
<div class="toolbar" part="toolbar" role="toolbar" aria-label="Text formatting">
|
|
673
|
-
${
|
|
725
|
+
${main.map((group, index) => html `
|
|
674
726
|
${index > 0 ? html `<span class="toolbar__divider"></span>` : nothing}
|
|
675
|
-
${group.map(
|
|
727
|
+
${group.map(item => this.renderItem(item.name, { label: item.label, icon: item.icon }))}
|
|
676
728
|
`)}
|
|
729
|
+
${overflow.length ? this.renderOverflow(main.length > 0, overflow) : nothing}
|
|
677
730
|
</div>
|
|
678
731
|
`;
|
|
679
732
|
}
|
|
@@ -681,6 +734,9 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
|
|
|
681
734
|
__decorate([
|
|
682
735
|
property({ type: String })
|
|
683
736
|
], NileWysiwygToolbar.prototype, "config", void 0);
|
|
737
|
+
__decorate([
|
|
738
|
+
property({ attribute: false })
|
|
739
|
+
], NileWysiwygToolbar.prototype, "items", void 0);
|
|
684
740
|
__decorate([
|
|
685
741
|
property({ type: Boolean, reflect: true })
|
|
686
742
|
], NileWysiwygToolbar.prototype, "disabled", void 0);
|
|
@@ -692,7 +748,7 @@ __decorate([
|
|
|
692
748
|
], NileWysiwygToolbar.prototype, "openMenu", void 0);
|
|
693
749
|
__decorate([
|
|
694
750
|
state()
|
|
695
|
-
], NileWysiwygToolbar.prototype, "
|
|
751
|
+
], NileWysiwygToolbar.prototype, "overflowOpen", void 0);
|
|
696
752
|
NileWysiwygToolbar = __decorate([
|
|
697
753
|
customElement('nile-wysiwyg-toolbar')
|
|
698
754
|
], NileWysiwygToolbar);
|