@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
|
@@ -2,19 +2,28 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html, css } from 'lit';
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
4
|
import NileElement from '../../internal/nile-element';
|
|
5
|
-
|
|
6
|
-
const
|
|
5
|
+
/** Smallest grid shown before the pointer starts expanding it. */
|
|
6
|
+
const MIN_ROWS = 5;
|
|
7
|
+
const MIN_COLS = 5;
|
|
7
8
|
/**
|
|
8
|
-
* Toolbar item: a table button that opens
|
|
9
|
-
*
|
|
9
|
+
* Toolbar item: a table button that opens a hover grid which auto-expands as
|
|
10
|
+
* the pointer reaches the last row/column (up to `maxRows`×`maxCols`), plus a
|
|
11
|
+
* "Custom" rows×cols input for larger tables. Picking a cell or confirming the
|
|
12
|
+
* custom size emits `wysiwyg-command` with `insertTable { rows, cols }`.
|
|
10
13
|
*/
|
|
11
14
|
let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
12
15
|
constructor() {
|
|
13
16
|
super(...arguments);
|
|
14
17
|
this.disabled = false;
|
|
18
|
+
/** Hard cap on the number of rows selectable via grid or custom input. */
|
|
19
|
+
this.maxRows = 20;
|
|
20
|
+
/** Hard cap on the number of columns selectable via grid or custom input. */
|
|
21
|
+
this.maxCols = 20;
|
|
15
22
|
this.open = false;
|
|
16
23
|
this.hoverRows = 0;
|
|
17
24
|
this.hoverCols = 0;
|
|
25
|
+
this.customRows = '';
|
|
26
|
+
this.customCols = '';
|
|
18
27
|
this.handleOutside = (event) => {
|
|
19
28
|
if (this.open && !event.composedPath().includes(this))
|
|
20
29
|
this.open = false;
|
|
@@ -70,7 +79,6 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
70
79
|
|
|
71
80
|
.grid {
|
|
72
81
|
display: grid;
|
|
73
|
-
grid-template-columns: repeat(${MAX_COLS}, 14px);
|
|
74
82
|
gap: 2px;
|
|
75
83
|
}
|
|
76
84
|
|
|
@@ -94,6 +102,71 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
94
102
|
font-size: 12px;
|
|
95
103
|
color: var(--nile-colors-neutral-600, #475467);
|
|
96
104
|
}
|
|
105
|
+
|
|
106
|
+
.custom {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 6px;
|
|
110
|
+
margin-top: 8px;
|
|
111
|
+
padding-top: 8px;
|
|
112
|
+
border-top: 1px solid var(--nile-colors-neutral-300, #e4e7ec);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.custom input {
|
|
116
|
+
width: 44px;
|
|
117
|
+
height: 26px;
|
|
118
|
+
padding: 0 6px;
|
|
119
|
+
border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);
|
|
120
|
+
border-radius: 6px;
|
|
121
|
+
font-size: 12px;
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
text-align: center;
|
|
124
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));
|
|
125
|
+
font-family: inherit;
|
|
126
|
+
/* Hide native number spinners: they overlap the centered text in this
|
|
127
|
+
narrow field and a stray click on the arrows mutates the value. */
|
|
128
|
+
-moz-appearance: textfield;
|
|
129
|
+
appearance: textfield;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.custom input::-webkit-outer-spin-button,
|
|
133
|
+
.custom input::-webkit-inner-spin-button {
|
|
134
|
+
-webkit-appearance: none;
|
|
135
|
+
margin: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.custom input:focus {
|
|
139
|
+
outline: none;
|
|
140
|
+
border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.custom .times {
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
color: var(--nile-colors-neutral-600, #475467);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.custom button.insert {
|
|
149
|
+
margin-left: auto;
|
|
150
|
+
height: 26px;
|
|
151
|
+
padding: 0 12px;
|
|
152
|
+
border: none;
|
|
153
|
+
border-radius: 6px;
|
|
154
|
+
background: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));
|
|
155
|
+
color: #ffffff;
|
|
156
|
+
font-size: 12px;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
font-family: inherit;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.custom button.insert:hover:not(:disabled) {
|
|
163
|
+
background: var(--nile-colors-primary-700, #1d4ed8);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.custom button.insert:disabled {
|
|
167
|
+
opacity: 0.4;
|
|
168
|
+
cursor: default;
|
|
169
|
+
}
|
|
97
170
|
`,
|
|
98
171
|
];
|
|
99
172
|
}
|
|
@@ -107,15 +180,33 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
107
180
|
}
|
|
108
181
|
pick(rows, cols) {
|
|
109
182
|
this.open = false;
|
|
183
|
+
this.customRows = '';
|
|
184
|
+
this.customCols = '';
|
|
110
185
|
this.emit('wysiwyg-command', {
|
|
111
186
|
name: 'insertTable',
|
|
112
187
|
attrs: { rows, cols, withHeaderRow: true },
|
|
113
188
|
});
|
|
114
189
|
}
|
|
190
|
+
/** Clamp raw input to 1..max; returns 0 when empty/invalid. */
|
|
191
|
+
clamp(raw, max) {
|
|
192
|
+
const n = parseInt(raw, 10);
|
|
193
|
+
if (!Number.isFinite(n) || n < 1)
|
|
194
|
+
return 0;
|
|
195
|
+
return Math.min(n, max);
|
|
196
|
+
}
|
|
197
|
+
insertCustom() {
|
|
198
|
+
const rows = this.clamp(this.customRows, this.maxRows);
|
|
199
|
+
const cols = this.clamp(this.customCols, this.maxCols);
|
|
200
|
+
if (rows >= 1 && cols >= 1)
|
|
201
|
+
this.pick(rows, cols);
|
|
202
|
+
}
|
|
115
203
|
render() {
|
|
204
|
+
// Grow the grid by one row/col once the pointer reaches the edge, capped.
|
|
205
|
+
const visibleRows = Math.min(Math.max(MIN_ROWS, this.hoverRows + 1), this.maxRows);
|
|
206
|
+
const visibleCols = Math.min(Math.max(MIN_COLS, this.hoverCols + 1), this.maxCols);
|
|
116
207
|
const cells = [];
|
|
117
|
-
for (let r = 1; r <=
|
|
118
|
-
for (let c = 1; c <=
|
|
208
|
+
for (let r = 1; r <= visibleRows; r += 1) {
|
|
209
|
+
for (let c = 1; c <= visibleCols; c += 1) {
|
|
119
210
|
cells.push(html `
|
|
120
211
|
<span
|
|
121
212
|
class="cell ${r <= this.hoverRows && c <= this.hoverCols ? 'hot' : ''}"
|
|
@@ -128,6 +219,8 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
128
219
|
`);
|
|
129
220
|
}
|
|
130
221
|
}
|
|
222
|
+
const customValid = this.clamp(this.customRows, this.maxRows) >= 1 &&
|
|
223
|
+
this.clamp(this.customCols, this.maxCols) >= 1;
|
|
131
224
|
return html `
|
|
132
225
|
<button
|
|
133
226
|
type="button"
|
|
@@ -147,11 +240,62 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
147
240
|
</button>
|
|
148
241
|
${this.open
|
|
149
242
|
? html `
|
|
150
|
-
<div class="panel"
|
|
151
|
-
<div
|
|
152
|
-
|
|
243
|
+
<div class="panel">
|
|
244
|
+
<div
|
|
245
|
+
class="grid"
|
|
246
|
+
style="grid-template-columns: repeat(${visibleCols}, 14px)"
|
|
247
|
+
@mousedown=${(e) => e.preventDefault()}
|
|
248
|
+
@mouseleave=${() => {
|
|
249
|
+
this.hoverRows = 0;
|
|
250
|
+
this.hoverCols = 0;
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
253
|
+
${cells}
|
|
254
|
+
</div>
|
|
255
|
+
<div class="label" @mousedown=${(e) => e.preventDefault()}>
|
|
153
256
|
${this.hoverRows > 0 ? `${this.hoverRows} × ${this.hoverCols}` : 'Pick a size'}
|
|
154
257
|
</div>
|
|
258
|
+
<div class="custom">
|
|
259
|
+
<input
|
|
260
|
+
type="number"
|
|
261
|
+
min="1"
|
|
262
|
+
max=${this.maxRows}
|
|
263
|
+
aria-label="Rows"
|
|
264
|
+
placeholder="Rows"
|
|
265
|
+
.value=${this.customRows}
|
|
266
|
+
@input=${(e) => {
|
|
267
|
+
this.customRows = e.target.value;
|
|
268
|
+
}}
|
|
269
|
+
@keydown=${(e) => {
|
|
270
|
+
if (e.key === 'Enter')
|
|
271
|
+
this.insertCustom();
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
<span class="times">×</span>
|
|
275
|
+
<input
|
|
276
|
+
type="number"
|
|
277
|
+
min="1"
|
|
278
|
+
max=${this.maxCols}
|
|
279
|
+
aria-label="Columns"
|
|
280
|
+
placeholder="Cols"
|
|
281
|
+
.value=${this.customCols}
|
|
282
|
+
@input=${(e) => {
|
|
283
|
+
this.customCols = e.target.value;
|
|
284
|
+
}}
|
|
285
|
+
@keydown=${(e) => {
|
|
286
|
+
if (e.key === 'Enter')
|
|
287
|
+
this.insertCustom();
|
|
288
|
+
}}
|
|
289
|
+
/>
|
|
290
|
+
<button
|
|
291
|
+
type="button"
|
|
292
|
+
class="insert"
|
|
293
|
+
?disabled=${!customValid}
|
|
294
|
+
@click=${() => this.insertCustom()}
|
|
295
|
+
>
|
|
296
|
+
Insert
|
|
297
|
+
</button>
|
|
298
|
+
</div>
|
|
155
299
|
</div>
|
|
156
300
|
`
|
|
157
301
|
: ''}
|
|
@@ -161,6 +305,12 @@ let NileWysiwygTablePicker = class NileWysiwygTablePicker extends NileElement {
|
|
|
161
305
|
__decorate([
|
|
162
306
|
property({ type: Boolean, reflect: true })
|
|
163
307
|
], NileWysiwygTablePicker.prototype, "disabled", void 0);
|
|
308
|
+
__decorate([
|
|
309
|
+
property({ type: Number, attribute: 'max-rows', reflect: true })
|
|
310
|
+
], NileWysiwygTablePicker.prototype, "maxRows", void 0);
|
|
311
|
+
__decorate([
|
|
312
|
+
property({ type: Number, attribute: 'max-cols', reflect: true })
|
|
313
|
+
], NileWysiwygTablePicker.prototype, "maxCols", void 0);
|
|
164
314
|
__decorate([
|
|
165
315
|
state()
|
|
166
316
|
], NileWysiwygTablePicker.prototype, "open", void 0);
|
|
@@ -170,6 +320,12 @@ __decorate([
|
|
|
170
320
|
__decorate([
|
|
171
321
|
state()
|
|
172
322
|
], NileWysiwygTablePicker.prototype, "hoverCols", void 0);
|
|
323
|
+
__decorate([
|
|
324
|
+
state()
|
|
325
|
+
], NileWysiwygTablePicker.prototype, "customRows", void 0);
|
|
326
|
+
__decorate([
|
|
327
|
+
state()
|
|
328
|
+
], NileWysiwygTablePicker.prototype, "customCols", void 0);
|
|
173
329
|
NileWysiwygTablePicker = __decorate([
|
|
174
330
|
customElement('nile-wysiwyg-table-picker')
|
|
175
331
|
], NileWysiwygTablePicker);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-grid-picker.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/ui/table-grid-picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAEtD,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,WAAW;IAAhD;;QACuC,aAAQ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,EAAE,IAAI,EAAE,CAAC;wDAAkB;AAE5C;IAAhB,KAAK,EAAE;oDAAsB;AAEb;IAAhB,KAAK,EAAE;yDAAuB;AAEd;IAAhB,KAAK,EAAE;yDAAuB;AAPpB,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA0JlC","sourcesContent":["import { html, css, TemplateResult, CSSResultArray } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport NileElement from '../../internal/nile-element';\n\nconst MAX_ROWS = 8;\nconst MAX_COLS = 10;\n\n/**\n * Toolbar item: a table button that opens an N×M hover grid. Picking a cell\n * emits `wysiwyg-command` with `insertTable { rows, cols }`.\n */\n@customElement('nile-wysiwyg-table-picker')\nexport class NileWysiwygTablePicker extends NileElement {\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @state() private open = false;\n\n @state() private hoverRows = 0;\n\n @state() private hoverCols = 0;\n\n public static get styles(): CSSResultArray {\n return [\n css`\n :host {\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n position: relative;\n display: inline-flex;\n }\n\n button.trigger {\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 border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n background: transparent;\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n }\n\n button.trigger:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, #f2f4f7);\n }\n\n button.trigger:disabled {\n opacity: 0.4;\n cursor: default;\n }\n\n .panel {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 30;\n padding: 8px;\n background: var(--nile-wysiwyg-popover-bg, #ffffff);\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 8px;\n box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));\n }\n\n .grid {\n display: grid;\n grid-template-columns: repeat(${MAX_COLS}, 14px);\n gap: 2px;\n }\n\n .cell {\n width: 14px;\n height: 14px;\n border: 1px solid var(--nile-colors-neutral-300, #d0d5dd);\n border-radius: 2px;\n box-sizing: border-box;\n cursor: pointer;\n }\n\n .cell.hot {\n background: var(--nile-colors-primary-100, var(--ng-componentcolors-utility-blue-100, #dbeafe));\n border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));\n }\n\n .label {\n margin-top: 6px;\n text-align: center;\n font-size: 12px;\n color: var(--nile-colors-neutral-600, #475467);\n }\n `,\n ];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('mousedown', this.handleOutside);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('mousedown', this.handleOutside);\n }\n\n private handleOutside = (event: MouseEvent): void => {\n if (this.open && !event.composedPath().includes(this)) this.open = false;\n };\n\n private pick(rows: number, cols: number): void {\n this.open = false;\n this.emit('wysiwyg-command', {\n name: 'insertTable',\n attrs: { rows, cols, withHeaderRow: true },\n });\n }\n\n public render(): TemplateResult {\n const cells: TemplateResult[] = [];\n for (let r = 1; r <= MAX_ROWS; r += 1) {\n for (let c = 1; c <= MAX_COLS; c += 1) {\n cells.push(html`\n <span\n class=\"cell ${r <= this.hoverRows && c <= this.hoverCols ? 'hot' : ''}\"\n @mouseenter=${() => {\n this.hoverRows = r;\n this.hoverCols = c;\n }}\n @click=${() => this.pick(r, c)}\n ></span>\n `);\n }\n }\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n part=\"button\"\n aria-label=\"Insert table\"\n aria-expanded=${this.open ? 'true' : 'false'}\n ?disabled=${this.disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${() => {\n this.open = !this.open;\n this.hoverRows = 0;\n this.hoverCols = 0;\n }}\n >\n <nile-glyph name=\"grid-01\" size=\"18\" method=\"stroke\"></nile-glyph>\n </button>\n ${this.open\n ? html`\n <div class=\"panel\" @mousedown=${(e: Event) => e.preventDefault()}>\n <div class=\"grid\">${cells}</div>\n <div class=\"label\">\n ${this.hoverRows > 0 ? `${this.hoverRows} × ${this.hoverCols}` : 'Pick a size'}\n </div>\n </div>\n `\n : ''}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-wysiwyg-table-picker': NileWysiwygTablePicker;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"table-grid-picker.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/ui/table-grid-picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAEtD,kEAAkE;AAClE,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB;;;;;GAKG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,WAAW;IAAhD;;QACuC,aAAQ,GAAG,KAAK,CAAC;QAE7D,0EAA0E;QACR,YAAO,GAAG,EAAE,CAAC;QAE/E,6EAA6E;QACX,YAAO,GAAG,EAAE,CAAC;QAE9D,SAAI,GAAG,KAAK,CAAC;QAEb,cAAS,GAAG,CAAC,CAAC;QAEd,cAAS,GAAG,CAAC,CAAC;QAEd,eAAU,GAAG,EAAE,CAAC;QAEhB,eAAU,GAAG,EAAE,CAAC;QA0JzB,kBAAa,GAAG,CAAC,KAAiB,EAAQ,EAAE;YAClD,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAC3E,CAAC,CAAC;IAgIJ,CAAC;IA1RQ,MAAM,K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gB,EAAE,EAAE;gBAC9B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO;oBAAE,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7C,CAAC;;;;;;wBAMK,IAAI,CAAC,OAAO;;;2BAGT,IAAI,CAAC,UAAU;2BACf,CAAC,CAAQ,EAAE,EAAE;gBACpB,IAAI,CAAC,UAAU,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;YACzD,CAAC;6BACU,CAAC,CAAgB,EAAE,EAAE;gBAC9B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO;oBAAE,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7C,CAAC;;;;;8BAKW,CAAC,WAAW;2BACf,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;;;;;;WAMzC;YACH,CAAC,CAAC,EAAE;KACP,CAAC;IACJ,CAAC;CACF,CAAA;AA5S6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wDAAkB;AAGK;IAAjE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAAc;AAGb;IAAjE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAAc;AAE9D;IAAhB,KAAK,EAAE;oDAAsB;AAEb;IAAhB,KAAK,EAAE;yDAAuB;AAEd;IAAhB,KAAK,EAAE;yDAAuB;AAEd;IAAhB,KAAK,EAAE;0DAAyB;AAEhB;IAAhB,KAAK,EAAE;0DAAyB;AAjBtB,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA6SlC","sourcesContent":["import { html, css, TemplateResult, CSSResultArray } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport NileElement from '../../internal/nile-element';\n\n/** Smallest grid shown before the pointer starts expanding it. */\nconst MIN_ROWS = 5;\nconst MIN_COLS = 5;\n\n/**\n * Toolbar item: a table button that opens a hover grid which auto-expands as\n * the pointer reaches the last row/column (up to `maxRows`×`maxCols`), plus a\n * \"Custom\" rows×cols input for larger tables. Picking a cell or confirming the\n * custom size emits `wysiwyg-command` with `insertTable { rows, cols }`.\n */\n@customElement('nile-wysiwyg-table-picker')\nexport class NileWysiwygTablePicker extends NileElement {\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Hard cap on the number of rows selectable via grid or custom input. */\n @property({ type: Number, attribute: 'max-rows', reflect: true }) maxRows = 20;\n\n /** Hard cap on the number of columns selectable via grid or custom input. */\n @property({ type: Number, attribute: 'max-cols', reflect: true }) maxCols = 20;\n\n @state() private open = false;\n\n @state() private hoverRows = 0;\n\n @state() private hoverCols = 0;\n\n @state() private customRows = '';\n\n @state() private customCols = '';\n\n public static get styles(): CSSResultArray {\n return [\n css`\n :host {\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n position: relative;\n display: inline-flex;\n }\n\n button.trigger {\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 border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n background: transparent;\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n }\n\n button.trigger:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, #f2f4f7);\n }\n\n button.trigger:disabled {\n opacity: 0.4;\n cursor: default;\n }\n\n .panel {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 30;\n padding: 8px;\n background: var(--nile-wysiwyg-popover-bg, #ffffff);\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 8px;\n box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));\n }\n\n .grid {\n display: grid;\n gap: 2px;\n }\n\n .cell {\n width: 14px;\n height: 14px;\n border: 1px solid var(--nile-colors-neutral-300, #d0d5dd);\n border-radius: 2px;\n box-sizing: border-box;\n cursor: pointer;\n }\n\n .cell.hot {\n background: var(--nile-colors-primary-100, var(--ng-componentcolors-utility-blue-100, #dbeafe));\n border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));\n }\n\n .label {\n margin-top: 6px;\n text-align: center;\n font-size: 12px;\n color: var(--nile-colors-neutral-600, #475467);\n }\n\n .custom {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--nile-colors-neutral-300, #e4e7ec);\n }\n\n .custom input {\n width: 44px;\n height: 26px;\n padding: 0 6px;\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 6px;\n font-size: 12px;\n box-sizing: border-box;\n text-align: center;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n /* Hide native number spinners: they overlap the centered text in this\n narrow field and a stray click on the arrows mutates the value. */\n -moz-appearance: textfield;\n appearance: textfield;\n }\n\n .custom input::-webkit-outer-spin-button,\n .custom input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .custom input:focus {\n outline: none;\n border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));\n }\n\n .custom .times {\n font-size: 12px;\n color: var(--nile-colors-neutral-600, #475467);\n }\n\n .custom button.insert {\n margin-left: auto;\n height: 26px;\n padding: 0 12px;\n border: none;\n border-radius: 6px;\n background: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600, #2563eb));\n color: #ffffff;\n font-size: 12px;\n font-weight: 600;\n font-family: inherit;\n cursor: pointer;\n }\n\n .custom button.insert:hover:not(:disabled) {\n background: var(--nile-colors-primary-700, #1d4ed8);\n }\n\n .custom button.insert:disabled {\n opacity: 0.4;\n cursor: default;\n }\n `,\n ];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('mousedown', this.handleOutside);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('mousedown', this.handleOutside);\n }\n\n private handleOutside = (event: MouseEvent): void => {\n if (this.open && !event.composedPath().includes(this)) this.open = false;\n };\n\n private pick(rows: number, cols: number): void {\n this.open = false;\n this.customRows = '';\n this.customCols = '';\n this.emit('wysiwyg-command', {\n name: 'insertTable',\n attrs: { rows, cols, withHeaderRow: true },\n });\n }\n\n /** Clamp raw input to 1..max; returns 0 when empty/invalid. */\n private clamp(raw: string, max: number): number {\n const n = parseInt(raw, 10);\n if (!Number.isFinite(n) || n < 1) return 0;\n return Math.min(n, max);\n }\n\n private insertCustom(): void {\n const rows = this.clamp(this.customRows, this.maxRows);\n const cols = this.clamp(this.customCols, this.maxCols);\n if (rows >= 1 && cols >= 1) this.pick(rows, cols);\n }\n\n public render(): TemplateResult {\n // Grow the grid by one row/col once the pointer reaches the edge, capped.\n const visibleRows = Math.min(Math.max(MIN_ROWS, this.hoverRows + 1), this.maxRows);\n const visibleCols = Math.min(Math.max(MIN_COLS, this.hoverCols + 1), this.maxCols);\n\n const cells: TemplateResult[] = [];\n for (let r = 1; r <= visibleRows; r += 1) {\n for (let c = 1; c <= visibleCols; c += 1) {\n cells.push(html`\n <span\n class=\"cell ${r <= this.hoverRows && c <= this.hoverCols ? 'hot' : ''}\"\n @mouseenter=${() => {\n this.hoverRows = r;\n this.hoverCols = c;\n }}\n @click=${() => this.pick(r, c)}\n ></span>\n `);\n }\n }\n\n const customValid =\n this.clamp(this.customRows, this.maxRows) >= 1 &&\n this.clamp(this.customCols, this.maxCols) >= 1;\n\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n part=\"button\"\n aria-label=\"Insert table\"\n aria-expanded=${this.open ? 'true' : 'false'}\n ?disabled=${this.disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${() => {\n this.open = !this.open;\n this.hoverRows = 0;\n this.hoverCols = 0;\n }}\n >\n <nile-glyph name=\"grid-01\" size=\"18\" method=\"stroke\"></nile-glyph>\n </button>\n ${this.open\n ? html`\n <div class=\"panel\">\n <div\n class=\"grid\"\n style=\"grid-template-columns: repeat(${visibleCols}, 14px)\"\n @mousedown=${(e: Event) => e.preventDefault()}\n @mouseleave=${() => {\n this.hoverRows = 0;\n this.hoverCols = 0;\n }}\n >\n ${cells}\n </div>\n <div class=\"label\" @mousedown=${(e: Event) => e.preventDefault()}>\n ${this.hoverRows > 0 ? `${this.hoverRows} × ${this.hoverCols}` : 'Pick a size'}\n </div>\n <div class=\"custom\">\n <input\n type=\"number\"\n min=\"1\"\n max=${this.maxRows}\n aria-label=\"Rows\"\n placeholder=\"Rows\"\n .value=${this.customRows}\n @input=${(e: Event) => {\n this.customRows = (e.target as HTMLInputElement).value;\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.insertCustom();\n }}\n />\n <span class=\"times\">×</span>\n <input\n type=\"number\"\n min=\"1\"\n max=${this.maxCols}\n aria-label=\"Columns\"\n placeholder=\"Cols\"\n .value=${this.customCols}\n @input=${(e: Event) => {\n this.customCols = (e.target as HTMLInputElement).value;\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.insertCustom();\n }}\n />\n <button\n type=\"button\"\n class=\"insert\"\n ?disabled=${!customValid}\n @click=${() => this.insertCustom()}\n >\n Insert\n </button>\n </div>\n </div>\n `\n : ''}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-wysiwyg-table-picker': NileWysiwygTablePicker;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TemplateResult, CSSResultArray } from 'lit';
|
|
2
2
|
import NileElement from '../../internal/nile-element';
|
|
3
|
+
import '../../nile-lite-tooltip/nile-lite-tooltip';
|
|
3
4
|
/**
|
|
4
5
|
* Compact floating bar shown while the cursor is inside a table. The host
|
|
5
6
|
* positions it; operations bubble up as `wysiwyg-command` events.
|
|
@@ -3,6 +3,7 @@ import { html, css } from 'lit';
|
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import NileElement from '../../internal/nile-element';
|
|
5
5
|
import { renderGlyph } from '../../internal/glyph';
|
|
6
|
+
import '../../nile-lite-tooltip/nile-lite-tooltip';
|
|
6
7
|
const OPS = [
|
|
7
8
|
{ name: 'addRowBefore', label: 'Add row above', icon: 'ng-between-vertical-start' },
|
|
8
9
|
{ name: 'addRowAfter', label: 'Add row below', icon: 'ng-between-vertical-end' },
|
|
@@ -78,14 +79,15 @@ let NileWysiwygTableMenu = class NileWysiwygTableMenu extends NileElement {
|
|
|
78
79
|
return html `
|
|
79
80
|
<div class="menu" part="table-menu" @mousedown=${(e) => e.preventDefault()}>
|
|
80
81
|
${OPS.map(op => html `
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
<nile-lite-tooltip content=${op.label} placement="top">
|
|
83
|
+
<button
|
|
84
|
+
type="button"
|
|
85
|
+
aria-label=${op.label}
|
|
86
|
+
@click=${() => this.emit('wysiwyg-command', { name: op.name })}
|
|
87
|
+
>
|
|
88
|
+
${renderGlyph(op.icon, 16)}
|
|
89
|
+
</button>
|
|
90
|
+
</nile-lite-tooltip>
|
|
89
91
|
`)}
|
|
90
92
|
</div>
|
|
91
93
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-menu.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/ui/table-menu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,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AAE,KAAK,EAAE,kCAAkC,EAAE,IAAI,EAAE,aAAa,EAAE;IAC7F,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE;CACnE,CAAC;AAEF;;;GAGG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,WAAW;IAA9C;;QACuC,SAAI,GAAG,KAAK,CAAC;IAuE3D,CAAC;IArEQ,MAAM,KAAK,MAAM;QACtB,OAAO;YACL,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CF;SACF,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAA;uDACwC,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE;UAC7E,GAAG,CAAC,GAAG,CACP,EAAE,CAAC,EAAE,CAAC,IAAI,CAAA;yCACqB,EAAE,CAAC,KAAK;;;6BAGpB,EAAE,CAAC,KAAK;yBACZ,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;;kBAE5D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;;;WAG/B,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAc;AAD9C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC","sourcesContent":["import { html, css, TemplateResult, CSSResultArray } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport NileElement from '../../internal/nile-element';\nimport { renderGlyph } from '../../internal/glyph';\nimport type { CommandName } from '../engine/commands';\nimport '../../nile-lite-tooltip/nile-lite-tooltip';\n\ninterface TableOp {\n name: CommandName;\n label: string;\n icon: string;\n}\n\nconst OPS: TableOp[] = [\n { name: 'addRowBefore', label: 'Add row above', icon: 'ng-between-vertical-start' },\n { name: 'addRowAfter', label: 'Add row below', icon: 'ng-between-vertical-end' },\n { name: 'addColumnBefore', label: 'Add column left', icon: 'ng-between-horizontal-start' },\n { name: 'addColumnAfter', label: 'Add column right', icon: 'ng-between-horizontal-end' },\n { name: 'deleteRow', label: 'Delete row', icon: 'ng-rows-2' },\n { name: 'deleteColumn', label: 'Delete column', icon: 'ng-columns-2' },\n { name: 'mergeCells', label: 'Merge cells', icon: 'ng-table-cells-merge' },\n { name: 'splitCell', label: 'Split cell', icon: 'ng-table-cells-split' },\n { name: 'toggleHeaderRow', label: 'Toggle header row', icon: 'ng-panel-top' },\n { name: 'toggleLayoutTable', label: 'Toggle layout table (borderless)', icon: 'ng-grid-2x2' },\n { name: 'deleteTable', label: 'Delete table', icon: 'ng-trash-2' },\n];\n\n/**\n * Compact floating bar shown while the cursor is inside a table. The host\n * positions it; operations bubble up as `wysiwyg-command` events.\n */\n@customElement('nile-wysiwyg-table-menu')\nexport class NileWysiwygTableMenu extends NileElement {\n @property({ type: Boolean, reflect: true }) open = false;\n\n public static get styles(): CSSResultArray {\n return [\n css`\n :host {\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n position: absolute;\n z-index: 15;\n display: none;\n }\n\n :host([open]) {\n display: block;\n }\n\n .menu {\n display: flex;\n gap: 2px;\n padding: 4px;\n background: var(--nile-wysiwyg-popover-bg, #ffffff);\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 8px;\n box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));\n }\n\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 26px;\n height: 26px;\n padding: 0 4px;\n border: none;\n border-radius: 5px;\n background: transparent;\n cursor: pointer;\n font-size: 12px;\n font-weight: 600;\n color: var(--nile-colors-neutral-700, #344054);\n }\n\n button:hover {\n background: var(--nile-colors-neutral-100, #f2f4f7);\n }\n `,\n ];\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"menu\" part=\"table-menu\" @mousedown=${(e: Event) => e.preventDefault()}>\n ${OPS.map(\n op => html`\n <nile-lite-tooltip content=${op.label} placement=\"top\">\n <button\n type=\"button\"\n aria-label=${op.label}\n @click=${() => this.emit('wysiwyg-command', { name: op.name })}\n >\n ${renderGlyph(op.icon, 16)}\n </button>\n </nile-lite-tooltip>\n `\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-wysiwyg-table-menu': NileWysiwygTableMenu;\n }\n}\n"]}
|
package/dist/src/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Version utility - placeholders will be replaced during build
|
|
2
|
-
export const NILE_ELEMENTS_VERSION = '1.9.
|
|
2
|
+
export const NILE_ELEMENTS_VERSION = '1.9.9';
|
|
3
3
|
export const NILE_VERSION = '1.2.7';
|
|
4
4
|
// Set global versions for runtime access
|
|
5
5
|
if (typeof window !== 'undefined') {
|
package/dist/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C,yCAAyC;AACzC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,mBAAmB,GAAG,qBAAqB,CAAC;IAC3D,MAAc,CAAC,WAAW,GAAG,YAAY,CAAC;IAC3C,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,CAAC;AACzE,CAAC","sourcesContent":["// Version utility - placeholders will be replaced during build\nexport const NILE_ELEMENTS_VERSION = '1.9.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C,yCAAyC;AACzC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,mBAAmB,GAAG,qBAAqB,CAAC;IAC3D,MAAc,CAAC,WAAW,GAAG,YAAY,CAAC;IAC3C,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,CAAC;AACzE,CAAC","sourcesContent":["// Version utility - placeholders will be replaced during build\nexport const NILE_ELEMENTS_VERSION = '1.9.9';\nexport const NILE_VERSION = '1.2.7';\n\n// Set global versions for runtime access\nif (typeof window !== 'undefined') {\n (window as any).nileElementsVersion = NILE_ELEMENTS_VERSION;\n (window as any).nileVersion = NILE_VERSION;\n window.process = window.process || { env: { NODE_ENV: 'production' } };\n}\n"]}
|