@aquera/nile-elements 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/{index-ccff99d6.esm.js → index-0fe57384.esm.js} +1 -1
- package/dist/index-f6944844.cjs.js +2 -0
- package/dist/{index-e43755f5.cjs.js.map → index-f6944844.cjs.js.map} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +616 -577
- package/dist/nile-code-editor/extensionSetup.cjs.js +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.esm.js +4 -4
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.esm.js +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.css.esm.js +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.cjs.js +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.cjs.js.map +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.esm.js +3 -3
- package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.cjs.js +1 -1
- package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.cjs.js.map +1 -1
- package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.esm.js +13 -7
- 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 +91 -58
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +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 +19 -19
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +14 -14
- 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 +13 -13
- 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 +12 -12
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +10 -10
- 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 +4 -4
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +11 -11
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +9 -9
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +11 -11
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +6 -6
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +14 -14
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +16 -16
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +8 -8
- 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 +4 -4
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +16 -16
- 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 +29 -29
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +8 -8
- 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 +23 -23
- 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 +7 -7
- package/dist/src/nile-code-editor/nile-code-editor.css.js +2 -2
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +15 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +65 -6
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +6 -117
- package/dist/src/nile-code-editor/theme.js +100 -147
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-combobox/nile-combobox.css.js +1 -1
- package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -1
- package/dist/src/nile-detail/nile-detail.css.js +1 -1
- package/dist/src/nile-detail/nile-detail.css.js.map +1 -1
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.css.js +3 -3
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.css.js.map +1 -1
- package/dist/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.js +11 -5
- package/dist/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +91 -58
- 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 +2 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +23 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +19 -19
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +10 -10
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +7 -7
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +5 -5
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +6 -6
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -4
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +6 -6
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +7 -7
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +6 -6
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +6 -6
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +7 -7
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +9 -9
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +8 -8
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +4 -4
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +9 -9
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +24 -24
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +4 -4
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +7 -7
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +16 -16
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +4 -4
- 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/package.json +1 -1
- package/src/nile-code-editor/nile-code-editor.css.ts +2 -2
- package/src/nile-code-editor/nile-code-editor.ts +68 -5
- package/src/nile-code-editor/theme.ts +129 -162
- package/src/nile-combobox/nile-combobox.css.ts +1 -1
- package/src/nile-detail/nile-detail.css.ts +1 -1
- package/src/nile-side-bar-footer/nile-side-bar-footer.css.ts +3 -3
- package/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.ts +11 -5
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +91 -58
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +21 -1
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +19 -19
- package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +10 -10
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +7 -7
- package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +5 -5
- package/src/nile-wysiwyg-editor/ui/embed-menu.ts +6 -6
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -4
- package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +6 -6
- package/src/nile-wysiwyg-editor/ui/find-replace.ts +7 -7
- package/src/nile-wysiwyg-editor/ui/image-menu.ts +6 -6
- package/src/nile-wysiwyg-editor/ui/image-panel.ts +6 -6
- package/src/nile-wysiwyg-editor/ui/insert-menu.ts +7 -7
- package/src/nile-wysiwyg-editor/ui/link-editor.ts +9 -9
- package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +8 -8
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +4 -4
- package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +9 -9
- package/src/nile-wysiwyg-editor/ui/source-view.ts +24 -24
- package/src/nile-wysiwyg-editor/ui/special-chars.ts +4 -4
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +7 -7
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +16 -16
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +4 -4
- package/vscode-html-custom-data.json +2 -2
- package/dist/index-e43755f5.cjs.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{css as
|
|
1
|
+
import{__decorate as t}from"tslib";import{css as r,html as e}from"lit";import{property as i,state as o,customElement as s}from"lit/decorators.js";import{N as n}from"../../internal/nile-element.esm.js";import"../../internal/accessibility/a11y.state.enum.esm.js";import"../../internal/accessibility/a11y.property.enum.esm.js";import"../../internal/accessibility/role.enum.esm.js";let a=class extends n{constructor(){super(...arguments),this.disabled=!1,this.maxRows=20,this.maxCols=20,this.open=!1,this.hoverRows=0,this.hoverCols=0,this.customRows="",this.customCols="",this.handleOutside=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}static get styles(){return[r`
|
|
2
2
|
:host {
|
|
3
3
|
font-family: var(
|
|
4
4
|
--nile-font-family-sans-serif,
|
|
@@ -20,11 +20,11 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
20
20
|
border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));
|
|
21
21
|
background: transparent;
|
|
22
22
|
cursor: pointer;
|
|
23
|
-
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900
|
|
23
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
button.trigger:hover:not(:disabled) {
|
|
27
|
-
background: var(--nile-colors-neutral-100,
|
|
27
|
+
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
button.trigger:disabled {
|
|
@@ -38,8 +38,8 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
38
38
|
left: 0;
|
|
39
39
|
z-index: 30;
|
|
40
40
|
padding: 8px;
|
|
41
|
-
background: var(--nile-wysiwyg-popover-bg,
|
|
42
|
-
border: 1px solid var(--nile-colors-neutral-400,
|
|
41
|
+
background: var(--nile-wysiwyg-popover-bg, var(--ng-colors-bg-primary));
|
|
42
|
+
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));
|
|
43
43
|
border-radius: 8px;
|
|
44
44
|
box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));
|
|
45
45
|
}
|
|
@@ -52,22 +52,22 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
52
52
|
.cell {
|
|
53
53
|
width: 14px;
|
|
54
54
|
height: 14px;
|
|
55
|
-
border: 1px solid var(--nile-colors-neutral-300,
|
|
55
|
+
border: 1px solid var(--nile-colors-neutral-300, var(--ng-colors-border-primary));
|
|
56
56
|
border-radius: 2px;
|
|
57
57
|
box-sizing: border-box;
|
|
58
58
|
cursor: pointer;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.cell.hot {
|
|
62
|
-
background: var(--nile-colors-primary-100, var(--ng-componentcolors-utility-blue-100
|
|
63
|
-
border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600
|
|
62
|
+
background: var(--nile-colors-primary-100, var(--ng-componentcolors-utility-blue-100));
|
|
63
|
+
border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.label {
|
|
67
67
|
margin-top: 6px;
|
|
68
68
|
text-align: center;
|
|
69
69
|
font-size: 12px;
|
|
70
|
-
color: var(--nile-colors-neutral-600,
|
|
70
|
+
color: var(--nile-colors-neutral-600, var(--ng-colors-text-tertiary-600));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.custom {
|
|
@@ -76,19 +76,19 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
76
76
|
gap: 6px;
|
|
77
77
|
margin-top: 8px;
|
|
78
78
|
padding-top: 8px;
|
|
79
|
-
border-top: 1px solid var(--nile-colors-neutral-300,
|
|
79
|
+
border-top: 1px solid var(--nile-colors-neutral-300, var(--ng-colors-border-secondary));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.custom input {
|
|
83
83
|
width: 44px;
|
|
84
84
|
height: 26px;
|
|
85
85
|
padding: 0 6px;
|
|
86
|
-
border: 1px solid var(--nile-colors-neutral-400,
|
|
86
|
+
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));
|
|
87
87
|
border-radius: 6px;
|
|
88
88
|
font-size: 12px;
|
|
89
89
|
box-sizing: border-box;
|
|
90
90
|
text-align: center;
|
|
91
|
-
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900
|
|
91
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
92
92
|
font-family: inherit;
|
|
93
93
|
/* Hide native number spinners: they overlap the centered text in this
|
|
94
94
|
narrow field and a stray click on the arrows mutates the value. */
|
|
@@ -104,12 +104,12 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
104
104
|
|
|
105
105
|
.custom input:focus {
|
|
106
106
|
outline: none;
|
|
107
|
-
border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600
|
|
107
|
+
border-color: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.custom .times {
|
|
111
111
|
font-size: 12px;
|
|
112
|
-
color: var(--nile-colors-neutral-600,
|
|
112
|
+
color: var(--nile-colors-neutral-600, var(--ng-colors-text-tertiary-600));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.custom button.insert {
|
|
@@ -118,8 +118,8 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
118
118
|
padding: 0 12px;
|
|
119
119
|
border: none;
|
|
120
120
|
border-radius: 6px;
|
|
121
|
-
background: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600
|
|
122
|
-
color:
|
|
121
|
+
background: var(--nile-colors-primary-600, var(--ng-componentcolors-utility-blue-600));
|
|
122
|
+
color: var(--ng-colors-text-white);
|
|
123
123
|
font-size: 12px;
|
|
124
124
|
font-weight: 600;
|
|
125
125
|
font-family: inherit;
|
|
@@ -127,20 +127,20 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
.custom button.insert:hover:not(:disabled) {
|
|
130
|
-
background: var(--nile-colors-primary-700,
|
|
130
|
+
background: var(--nile-colors-primary-700, var(--ng-componentcolors-utility-blue-700));
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
.custom button.insert:disabled {
|
|
134
134
|
opacity: 0.4;
|
|
135
135
|
cursor: default;
|
|
136
136
|
}
|
|
137
|
-
`]}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this.handleOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.handleOutside)}pick(t,
|
|
137
|
+
`]}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this.handleOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.handleOutside)}pick(t,r){this.open=!1,this.customRows="",this.customCols="",this.emit("wysiwyg-command",{name:"insertTable",attrs:{rows:t,cols:r,withHeaderRow:!0}})}clamp(t,r){const e=parseInt(t,10);return!Number.isFinite(e)||e<1?0:Math.min(e,r)}insertCustom(){const t=this.clamp(this.customRows,this.maxRows),r=this.clamp(this.customCols,this.maxCols);t>=1&&r>=1&&this.pick(t,r)}render(){const t=Math.min(Math.max(5,this.hoverRows+1),this.maxRows),r=Math.min(Math.max(5,this.hoverCols+1),this.maxCols),i=[];for(let o=1;o<=t;o+=1)for(let t=1;t<=r;t+=1)i.push(e`
|
|
138
138
|
<span
|
|
139
139
|
class="cell ${o<=this.hoverRows&&t<=this.hoverCols?"hot":""}"
|
|
140
140
|
@mouseenter=${()=>{this.hoverRows=o,this.hoverCols=t}}
|
|
141
141
|
@click=${()=>this.pick(o,t)}
|
|
142
142
|
></span>
|
|
143
|
-
`);const o=this.clamp(this.customRows,this.maxRows)>=1&&this.clamp(this.customCols,this.maxCols)>=1;return
|
|
143
|
+
`);const o=this.clamp(this.customRows,this.maxRows)>=1&&this.clamp(this.customCols,this.maxCols)>=1;return e`
|
|
144
144
|
<button
|
|
145
145
|
type="button"
|
|
146
146
|
class="trigger"
|
|
@@ -153,15 +153,15 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
153
153
|
>
|
|
154
154
|
<nile-glyph name="grid-01" size="18" method="stroke"></nile-glyph>
|
|
155
155
|
</button>
|
|
156
|
-
${this.open?
|
|
156
|
+
${this.open?e`
|
|
157
157
|
<div class="panel">
|
|
158
158
|
<div
|
|
159
159
|
class="grid"
|
|
160
|
-
style="grid-template-columns: repeat(${
|
|
160
|
+
style="grid-template-columns: repeat(${r}, 14px)"
|
|
161
161
|
@mousedown=${t=>t.preventDefault()}
|
|
162
162
|
@mouseleave=${()=>{this.hoverRows=0,this.hoverCols=0}}
|
|
163
163
|
>
|
|
164
|
-
${
|
|
164
|
+
${i}
|
|
165
165
|
</div>
|
|
166
166
|
<div class="label" @mousedown=${t=>t.preventDefault()}>
|
|
167
167
|
${this.hoverRows>0?`${this.hoverRows} × ${this.hoverCols}`:"Pick a size"}
|
|
@@ -199,4 +199,4 @@ import{__decorate as t}from"tslib";import{css as e,html as i}from"lit";import{pr
|
|
|
199
199
|
</div>
|
|
200
200
|
</div>
|
|
201
201
|
`:""}
|
|
202
|
-
`}};t([
|
|
202
|
+
`}};t([i({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),t([i({type:Number,attribute:"max-rows",reflect:!0})],a.prototype,"maxRows",void 0),t([i({type:Number,attribute:"max-cols",reflect:!0})],a.prototype,"maxCols",void 0),t([o()],a.prototype,"open",void 0),t([o()],a.prototype,"hoverRows",void 0),t([o()],a.prototype,"hoverCols",void 0),t([o()],a.prototype,"customRows",void 0),t([o()],a.prototype,"customCols",void 0),a=t([s("nile-wysiwyg-table-picker")],a);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","../../internal/nile-element.cjs.js","../../internal/glyph.cjs.js","../../nile-lite-tooltip/nile-lite-tooltip.cjs.js","../../internal/accessibility/a11y.state.enum.cjs.js","../../internal/accessibility/a11y.property.enum.cjs.js","../../internal/accessibility/role.enum.cjs.js","../../nile-lite-tooltip/nile-lite-tooltip.css.cjs.js","../../tippy.esm-78baa8f2.cjs.js","../../nile-lite-tooltip/utils.cjs.js","../../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var e,l,t,o,n,i,
|
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","../../internal/nile-element.cjs.js","../../internal/glyph.cjs.js","../../nile-lite-tooltip/nile-lite-tooltip.cjs.js","../../internal/accessibility/a11y.state.enum.cjs.js","../../internal/accessibility/a11y.property.enum.cjs.js","../../internal/accessibility/role.enum.cjs.js","../../nile-lite-tooltip/nile-lite-tooltip.css.cjs.js","../../tippy.esm-78baa8f2.cjs.js","../../nile-lite-tooltip/utils.cjs.js","../../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var e,l,t,o,n,i,r,_templateObject,_templateObject2,_templateObject3,a,s;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){l=_lit.css;t=_lit.html;},function(_litDecoratorsJs){o=_litDecoratorsJs.property;n=_litDecoratorsJs.customElement;},function(_internalNileElementCjsJs){i=_internalNileElementCjsJs.N;},function(_internalGlyphCjsJs){r=_internalGlyphCjsJs.r;},function(_nileLiteTooltipNileLiteTooltipCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileLiteTooltipNileLiteTooltipCssCjsJs){},function(_tippyEsm009CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){}],execute:function execute(){a=[{name:"addRowBefore",label:"Add row above",icon:"ng-between-vertical-start"},{name:"addRowAfter",label:"Add row below",icon:"ng-between-vertical-end"},{name:"addColumnBefore",label:"Add column left",icon:"ng-between-horizontal-start"},{name:"addColumnAfter",label:"Add column right",icon:"ng-between-horizontal-end"},{name:"deleteRow",label:"Delete row",icon:"ng-rows-2"},{name:"deleteColumn",label:"Delete column",icon:"ng-columns-2"},{name:"mergeCells",label:"Merge cells",icon:"ng-table-cells-merge"},{name:"splitCell",label:"Split cell",icon:"ng-table-cells-split"},{name:"toggleHeaderRow",label:"Toggle header row",icon:"ng-panel-top"},{name:"toggleLayoutTable",label:"Toggle layout table (borderless)",icon:"ng-grid-2x2"},{name:"deleteTable",label:"Delete table",icon:"ng-trash-2"}];s=/*#__PURE__*/function(_i){function s(){var _this;_classCallCheck(this,s);_this=_callSuper(this,s,arguments),_this.open=!1;return _this;}_inherits(s,_i);return _createClass(s,[{key:"render",value:function render(){var _this2=this;return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"menu\" part=\"table-menu\" @mousedown=",">\n ","\n </div>\n "])),function(e){return e.preventDefault();},a.map(function(e){return t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-lite-tooltip content="," placement=\"top\">\n <button\n type=\"button\"\n aria-label=","\n @click=","\n >\n ","\n </button>\n </nile-lite-tooltip>\n "])),e.label,e.label,function(){return _this2.emit("wysiwyg-command",{name:e.name});},r(e.icon,16));}));}}],[{key:"styles",get:function get(){return[l(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\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, var(--ng-colors-bg-primary));\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\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, var(--ng-colors-text-secondary-700));\n }\n\n button:hover {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary));\n }\n "])))];}}]);}(i);e([o({type:Boolean,reflect:!0})],s.prototype,"open",void 0),s=e([n("nile-wysiwyg-table-menu")],s);}};});
|
|
2
2
|
//# sourceMappingURL=table-menu.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-menu.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/ui/table-menu.ts"],"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,
|
|
1
|
+
{"version":3,"file":"table-menu.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/ui/table-menu.ts"],"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, var(--ng-colors-bg-primary));\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));\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, var(--ng-colors-text-secondary-700));\n }\n\n button:hover {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary));\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"],"names":["OPS","name","label","icon","NileWysiwygTableMenu","_i","s","constructor","this","open","_this","_inherits","_createClass","key","value","render","_this2","html","_templateObject","_taggedTemplateLiteral","e","preventDefault","map","op","_templateObject2","emit","renderGlyph","get","styles","css","_templateObject3","NileElement","__decorate","property","type","Boolean","reflect","prototype","customElement"],"mappings":"w5HAaMA,CAAAA,CAAiB,CACrB,CAAEC,IAAM,CAAA,cAAA,CAAgBC,KAAO,CAAA,eAAA,CAAiBC,KAAM,2BACtD,CAAA,CAAA,CAAEF,IAAM,CAAA,aAAA,CAAeC,KAAO,CAAA,eAAA,CAAiBC,IAAM,CAAA,yBAAA,CAAA,CACrD,CAAEF,IAAAA,CAAM,iBAAmBC,CAAAA,KAAAA,CAAO,iBAAmBC,CAAAA,IAAAA,CAAM,+BAC3D,CAAEF,IAAAA,CAAM,gBAAkBC,CAAAA,KAAAA,CAAO,kBAAoBC,CAAAA,IAAAA,CAAM,2BAC3D,CAAA,CAAA,CAAEF,IAAM,CAAA,WAAA,CAAaC,KAAO,CAAA,YAAA,CAAcC,IAAM,CAAA,WAAA,CAAA,CAChD,CAAEF,IAAM,CAAA,cAAA,CAAgBC,KAAO,CAAA,eAAA,CAAiBC,IAAM,CAAA,cAAA,CAAA,CACtD,CAAEF,IAAAA,CAAM,YAAcC,CAAAA,KAAAA,CAAO,aAAeC,CAAAA,IAAAA,CAAM,sBAClD,CAAA,CAAA,CAAEF,KAAM,WAAaC,CAAAA,KAAAA,CAAO,YAAcC,CAAAA,IAAAA,CAAM,sBAChD,CAAA,CAAA,CAAEF,IAAM,CAAA,iBAAA,CAAmBC,KAAO,CAAA,mBAAA,CAAqBC,IAAM,CAAA,cAAA,CAAA,CAC7D,CAAEF,IAAAA,CAAM,oBAAqBC,KAAO,CAAA,kCAAA,CAAoCC,IAAM,CAAA,aAAA,CAAA,CAC9E,CAAEF,IAAAA,CAAM,aAAeC,CAAAA,KAAAA,CAAO,cAAgBC,CAAAA,IAAAA,CAAM,YAQ/C,CAAA,CAAA,CAAMC,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCACuCC,KAAAA,CAAIC,IAAAA,CAAAA,CAAG,CAuEpD,QAAAC,KAAA,EArEQC,SAAA,CAAAL,CAAA,CAAAD,EAAA,SAAAO,YAAA,CAAAN,CAAA,GAAAO,GAAA,UAAAC,KAAA,CAkDA,SAAAC,MAAAA,CAAAA,CACL,KAAAC,MAAA,MAAA,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,wGACyCC,SAAAA,CAAAA,QAAaA,CAAAA,CAAEC,CAAAA,cAAAA,CAAAA,CAAAA,GAC7DrB,CAAIsB,CAAAA,GAAAA,CACJC,SAAAA,SAAMN,CAAAA,CAAI,CAAAO,gBAAA,GAAAA,gBAAA,CAAAL,sBAAA,wSACqBI,CAAGrB,CAAAA,KAAAA,CAGfqB,CAAGrB,CAAAA,KAAAA,CACP,iBAAMM,CAAAA,MAAKiB,CAAAA,IAAAA,CAAK,iBAAmB,CAAA,CAAExB,KAAMsB,CAAGtB,CAAAA,IAAAA,CAAAA,CAAAA,GAErDyB,CAAAA,CAAYH,EAAGpB,IAAM,CAAA,EAAA,CAAA,MAOpC,CAAA,KAAAU,GAAA,UAAAc,GAAA,CApEM,SAAAA,IAAA,CAAWC,CAChB,MAAO,CACLC,CAAG,CAAAC,gBAAA,GAAAA,gBAAA,CAAAX,sBAAA,g1CA8CN,EAEM,MArDiCY,GACIC,EAAA,CAA3CC,CAAAA,CAAS,CAAEC,IAAAA,CAAMC,QAASC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqBhC,CAAAiC,CAAAA,SAAAA,CAAA,WAAA,EAD9CjC,CAAAA,CAAAA,CAAAA,CAAoB4B,CAAA,CAAA,CADhCM,EAAc,yBACFlC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as e}from"tslib";import{css as l,html as t}from"lit";import{property as o,customElement as n}from"lit/decorators.js";import{N as i}from"../../internal/nile-element.esm.js";import{r
|
|
1
|
+
import{__decorate as e}from"tslib";import{css as l,html as t}from"lit";import{property as o,customElement as n}from"lit/decorators.js";import{N as i}from"../../internal/nile-element.esm.js";import{r}from"../../internal/glyph.esm.js";import"../../nile-lite-tooltip/nile-lite-tooltip.esm.js";import"../../internal/accessibility/a11y.state.enum.esm.js";import"../../internal/accessibility/a11y.property.enum.esm.js";import"../../internal/accessibility/role.enum.esm.js";import"../../nile-lite-tooltip/nile-lite-tooltip.css.esm.js";import"../../tippy.esm-57628c2b.esm.js";import"../../nile-lite-tooltip/utils.esm.js";import"../../utilities/visibility-manager.esm.js";const a=[{name:"addRowBefore",label:"Add row above",icon:"ng-between-vertical-start"},{name:"addRowAfter",label:"Add row below",icon:"ng-between-vertical-end"},{name:"addColumnBefore",label:"Add column left",icon:"ng-between-horizontal-start"},{name:"addColumnAfter",label:"Add column right",icon:"ng-between-horizontal-end"},{name:"deleteRow",label:"Delete row",icon:"ng-rows-2"},{name:"deleteColumn",label:"Delete column",icon:"ng-columns-2"},{name:"mergeCells",label:"Merge cells",icon:"ng-table-cells-merge"},{name:"splitCell",label:"Split cell",icon:"ng-table-cells-split"},{name:"toggleHeaderRow",label:"Toggle header row",icon:"ng-panel-top"},{name:"toggleLayoutTable",label:"Toggle layout table (borderless)",icon:"ng-grid-2x2"},{name:"deleteTable",label:"Delete table",icon:"ng-trash-2"}];let s=class extends i{constructor(){super(...arguments),this.open=!1}static get styles(){return[l`
|
|
2
2
|
:host {
|
|
3
3
|
font-family: var(
|
|
4
4
|
--nile-font-family-sans-serif,
|
|
@@ -17,8 +17,8 @@ import{__decorate as e}from"tslib";import{css as l,html as t}from"lit";import{pr
|
|
|
17
17
|
display: flex;
|
|
18
18
|
gap: 2px;
|
|
19
19
|
padding: 4px;
|
|
20
|
-
background: var(--nile-wysiwyg-popover-bg,
|
|
21
|
-
border: 1px solid var(--nile-colors-neutral-400,
|
|
20
|
+
background: var(--nile-wysiwyg-popover-bg, var(--ng-colors-bg-primary));
|
|
21
|
+
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-primary));
|
|
22
22
|
border-radius: 8px;
|
|
23
23
|
box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));
|
|
24
24
|
}
|
|
@@ -36,22 +36,22 @@ import{__decorate as e}from"tslib";import{css as l,html as t}from"lit";import{pr
|
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
font-size: 12px;
|
|
38
38
|
font-weight: 600;
|
|
39
|
-
color: var(--nile-colors-neutral-700,
|
|
39
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
button:hover {
|
|
43
|
-
background: var(--nile-colors-neutral-100,
|
|
43
|
+
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary));
|
|
44
44
|
}
|
|
45
45
|
`]}render(){return t`
|
|
46
46
|
<div class="menu" part="table-menu" @mousedown=${e=>e.preventDefault()}>
|
|
47
|
-
${
|
|
47
|
+
${a.map((e=>t`
|
|
48
48
|
<nile-lite-tooltip content=${e.label} placement="top">
|
|
49
49
|
<button
|
|
50
50
|
type="button"
|
|
51
51
|
aria-label=${e.label}
|
|
52
52
|
@click=${()=>this.emit("wysiwyg-command",{name:e.name})}
|
|
53
53
|
>
|
|
54
|
-
${
|
|
54
|
+
${r(e.icon,16)}
|
|
55
55
|
</button>
|
|
56
56
|
</nile-lite-tooltip>
|
|
57
57
|
`))}
|
|
@@ -26,7 +26,6 @@ export const styles = css `
|
|
|
26
26
|
border-radius: var(--nile-radius-sm, var(--ng-radius-md));
|
|
27
27
|
border: 1px solid var(--nile-colors-neutral-500, var(--ng-colors-border-secondary));
|
|
28
28
|
position: relative;
|
|
29
|
-
overflow: hidden;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
.no-scroller .cm-scroller{
|
|
@@ -66,7 +65,8 @@ export const styles = css `
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
.cm-gutters{
|
|
69
|
-
border-radius:
|
|
68
|
+
border-top-left-radius:var(--nile-spacing-spacing-none, var(--ng-radius-md));
|
|
69
|
+
border-bottom-left-radius:var(--nile-spacing-spacing-none, var(--ng-radius-md));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.expand__icon__container{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-code-editor.css.js","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * CodeEditor CSS\n */\nexport const styles = css`\n *{\n box-sizing:border-box;\n }\n\n :host {\n display: block;\n -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));\n -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n .code__editor__container {\n display: flex;\n padding: var(--nile-spacing-5px, var(--ng-spacing-none));\n border-radius: var(--nile-radius-sm, var(--ng-radius-md));\n border: 1px solid var(--nile-colors-neutral-500, var(--ng-colors-border-secondary));\n position: relative;\n
|
|
1
|
+
{"version":3,"file":"nile-code-editor.css.js","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * CodeEditor CSS\n */\nexport const styles = css`\n *{\n box-sizing:border-box;\n }\n\n :host {\n display: block;\n -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));\n -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n .code__editor__container {\n display: flex;\n padding: var(--nile-spacing-5px, var(--ng-spacing-none));\n border-radius: var(--nile-radius-sm, var(--ng-radius-md));\n border: 1px solid var(--nile-colors-neutral-500, var(--ng-colors-border-secondary));\n position: relative;\n }\n\n .no-scroller .cm-scroller{\n scrollbar-width: none;\n }\n\n .error {\n border-color: var(--nile-colors-red-500, var(--ng-componentcolors-utility-error-600));\n }\n\n .disabled {\n background-color: var(--nile-colors-dark-200, var(--ng-colors-bg-disabled-subtle));\n border-color: var(--nile-colors-neutral-500, var(--ng-colors-border-disabled));\n color: var(--nile-colors-dark-500, var(--ng-colors-text-disabled));\n cursor: not-allowed;\n opacity: var(--nile-opacity-50, var(--ng-opacity-50));\n user-select: none;\n -webkit-user-select: none;\n}\n\n .disabled .cm-editor {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .noborder {\n border: none;\n }\n\n .cm-editor {\n flex: 1;\n min-width: 0;\n }\n\n .ͼ1.cm-focused {\n outline: none;\n }\n\n .cm-gutters{\n border-top-left-radius:var(--nile-spacing-spacing-none, var(--ng-radius-md));\n border-bottom-left-radius:var(--nile-spacing-spacing-none, var(--ng-radius-md));\n }\n\n .expand__icon__container{\n display: none;\n position: absolute;\n border-radius: var(--nile-radius-base-standard, var(--ng-radius-none));\n cursor: pointer;\n right: var(--nile-spacing-none, var(--ng-spacing-1-5));\n top: 5px;\n z-index: 1;\n padding: var(--nile-spacing-5px, var(--ng-spacing-none));\n background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n }\n \n .code__editor__container:hover > .expand__icon__container{\n display: flex;\n }\n\n .code__editor__container.disabled .expand__icon__container{\n display: none;\n }\n`;\n\nexport default [styles];\n"]}
|
|
@@ -61,7 +61,11 @@ export declare class NileCodeEditor extends NileElement {
|
|
|
61
61
|
private themeComp;
|
|
62
62
|
private autoCompletionComp;
|
|
63
63
|
private autoCompleteStyleComp;
|
|
64
|
+
private darkThemeComp;
|
|
64
65
|
private isSpacePressed;
|
|
66
|
+
private themeObserver?;
|
|
67
|
+
private colorSchemeQuery?;
|
|
68
|
+
private onThemeChange;
|
|
65
69
|
/**
|
|
66
70
|
* The styles for CodeEditor
|
|
67
71
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
|
@@ -125,6 +129,17 @@ export declare class NileCodeEditor extends NileElement {
|
|
|
125
129
|
getReadOnlyExtension(): Extension[];
|
|
126
130
|
getSingleLineExtension(): Extension;
|
|
127
131
|
getPlaceholderExtension(): Extension;
|
|
132
|
+
/** Parses a token value (#rgb, #rrggbb, #rrggbbaa or rgb()/rgba()) into r/g/b. */
|
|
133
|
+
private parseColor;
|
|
134
|
+
/**
|
|
135
|
+
* An explicit `data-theme` on the document root wins. Otherwise decide from the
|
|
136
|
+
* tokens the page actually resolved to, NOT from `prefers-color-scheme` — a page
|
|
137
|
+
* can load the light-only token sheet on a dark-mode OS, and trusting the OS there
|
|
138
|
+
* paints a dark editor theme over a light page.
|
|
139
|
+
*/
|
|
140
|
+
private isDarkTheme;
|
|
141
|
+
/** Applied in dark only so light is untouched.*/
|
|
142
|
+
getDarkThemeExtension(): Extension;
|
|
128
143
|
getDefaultSyntaxHighlightingExtension(): Extension;
|
|
129
144
|
getCustomThemeExtension(): Extension;
|
|
130
145
|
getAutoCompleteStyleExtension(width?: number): Extension;
|
|
@@ -9,9 +9,9 @@ import { html, } from 'lit';
|
|
|
9
9
|
import { customElement, query, property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './nile-code-editor.css';
|
|
11
11
|
import { EditorView } from 'codemirror';
|
|
12
|
-
import { placeholder, tooltips } from '@codemirror/view';
|
|
12
|
+
import { placeholder, tooltips, highlightActiveLine } from '@codemirror/view';
|
|
13
13
|
import { Compartment, EditorState } from '@codemirror/state';
|
|
14
|
-
import { syntaxHighlighting, } from '@codemirror/language';
|
|
14
|
+
import { syntaxHighlighting, defaultHighlightStyle, } from '@codemirror/language';
|
|
15
15
|
import { lineNumbers } from '@codemirror/view';
|
|
16
16
|
import { javascript, javascriptLanguage, } from '@codemirror/lang-javascript';
|
|
17
17
|
import { sql } from '@codemirror/lang-sql';
|
|
@@ -21,7 +21,7 @@ import { autocompletion, acceptCompletion, closeCompletion, completionStatus } f
|
|
|
21
21
|
import NileElement from '../internal/nile-element';
|
|
22
22
|
import { basicSetup } from './extensionSetup';
|
|
23
23
|
import { classMap } from 'lit/directives/class-map.js';
|
|
24
|
-
import { customisedThemeCss, fontFamily, readOnlyTheme,
|
|
24
|
+
import { customisedThemeCss, fontFamily, readOnlyTheme, oneDarkTheme, oneDarkHighlightStyle } from './theme';
|
|
25
25
|
import { keymap } from '@codemirror/view';
|
|
26
26
|
// Choose the appropriate mode for your use case
|
|
27
27
|
/**
|
|
@@ -72,7 +72,16 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
|
|
|
72
72
|
this.themeComp = new Compartment();
|
|
73
73
|
this.autoCompletionComp = new Compartment();
|
|
74
74
|
this.autoCompleteStyleComp = new Compartment();
|
|
75
|
+
this.darkThemeComp = new Compartment();
|
|
75
76
|
this.isSpacePressed = false;
|
|
77
|
+
this.onThemeChange = () => {
|
|
78
|
+
this.view?.dispatch({
|
|
79
|
+
effects: [
|
|
80
|
+
this.darkThemeComp.reconfigure(this.getDarkThemeExtension()),
|
|
81
|
+
this.defaultSyntaxHighlightingComp.reconfigure(this.getDefaultSyntaxHighlightingExtension()),
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
76
85
|
/**
|
|
77
86
|
* Custom autocomplete handler for code editor suggestions
|
|
78
87
|
* @param context CompletionContext from CodeMirror
|
|
@@ -104,11 +113,17 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
|
|
|
104
113
|
}
|
|
105
114
|
connectedCallback() {
|
|
106
115
|
super.connectedCallback();
|
|
116
|
+
this.themeObserver = new MutationObserver(this.onThemeChange);
|
|
117
|
+
this.themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
|
|
118
|
+
this.colorSchemeQuery = window.matchMedia?.('(prefers-color-scheme: dark)');
|
|
119
|
+
this.colorSchemeQuery?.addEventListener('change', this.onThemeChange);
|
|
107
120
|
this.emit('nile-init', undefined, false);
|
|
108
121
|
}
|
|
109
122
|
disconnectedCallback() {
|
|
110
123
|
super.disconnectedCallback();
|
|
111
124
|
this.resizeObserver?.disconnect();
|
|
125
|
+
this.themeObserver?.disconnect();
|
|
126
|
+
this.colorSchemeQuery?.removeEventListener('change', this.onThemeChange);
|
|
112
127
|
this.view.destroy();
|
|
113
128
|
this.emit('nile-destroy', undefined, false);
|
|
114
129
|
}
|
|
@@ -259,7 +274,7 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
|
|
|
259
274
|
name="${this.expandIcon}"
|
|
260
275
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-fill))"
|
|
261
276
|
size="16"
|
|
262
|
-
color="
|
|
277
|
+
color="var(--nile-colors-dark-900, var(--ng-colors-fg-primary-900))"
|
|
263
278
|
></nile-glyph>
|
|
264
279
|
</div>`
|
|
265
280
|
: ''}
|
|
@@ -335,7 +350,8 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
|
|
|
335
350
|
defaultSyntaxHighlightingExtension,
|
|
336
351
|
this.autoCompletionComp.of(autocompletion({ aboveCursor: this.aboveCursor })),
|
|
337
352
|
language,
|
|
338
|
-
|
|
353
|
+
// Before customThemeExtension so the tokenised autocomplete popup styles still win.
|
|
354
|
+
this.darkThemeComp.of(this.getDarkThemeExtension()),
|
|
339
355
|
customThemeExtension,
|
|
340
356
|
autoCompleteStyleExtension,
|
|
341
357
|
this.getTabCompletionKeymap(),
|
|
@@ -515,8 +531,51 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
|
|
|
515
531
|
getPlaceholderExtension() {
|
|
516
532
|
return this.placeholder ? placeholder(this.placeholder) : [];
|
|
517
533
|
}
|
|
534
|
+
/** Parses a token value (#rgb, #rrggbb, #rrggbbaa or rgb()/rgba()) into r/g/b. */
|
|
535
|
+
parseColor(value) {
|
|
536
|
+
const hex = value.match(/^#([0-9a-f]{3,8})$/i)?.[1];
|
|
537
|
+
if (hex) {
|
|
538
|
+
const full = hex.length <= 4 ? hex.slice(0, 3).replace(/./g, c => c + c) : hex.slice(0, 6);
|
|
539
|
+
if (full.length !== 6)
|
|
540
|
+
return null;
|
|
541
|
+
return [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));
|
|
542
|
+
}
|
|
543
|
+
const parts = value.match(/^rgba?\(([^)]+)\)$/i)?.[1].split(/[\s,/]+/).map(Number);
|
|
544
|
+
return parts && parts.length >= 3 && parts.slice(0, 3).every(n => !isNaN(n))
|
|
545
|
+
? [parts[0], parts[1], parts[2]]
|
|
546
|
+
: null;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* An explicit `data-theme` on the document root wins. Otherwise decide from the
|
|
550
|
+
* tokens the page actually resolved to, NOT from `prefers-color-scheme` — a page
|
|
551
|
+
* can load the light-only token sheet on a dark-mode OS, and trusting the OS there
|
|
552
|
+
* paints a dark editor theme over a light page.
|
|
553
|
+
*/
|
|
554
|
+
isDarkTheme() {
|
|
555
|
+
const theme = document.documentElement.getAttribute('data-theme');
|
|
556
|
+
if (theme === 'dark')
|
|
557
|
+
return true;
|
|
558
|
+
if (theme === 'light')
|
|
559
|
+
return false;
|
|
560
|
+
const bg = getComputedStyle(document.documentElement)
|
|
561
|
+
.getPropertyValue('--ng-colors-bg-primary')
|
|
562
|
+
.trim();
|
|
563
|
+
const rgb = this.parseColor(bg);
|
|
564
|
+
// No NxtGen tokens on the page (e.g. the enterprise sheet, which has no dark mode).
|
|
565
|
+
if (!rgb)
|
|
566
|
+
return false;
|
|
567
|
+
// Rec. 601 luma; the surface is dark if the page background is dark.
|
|
568
|
+
return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 < 128;
|
|
569
|
+
}
|
|
570
|
+
/** Applied in dark only so light is untouched.*/
|
|
571
|
+
getDarkThemeExtension() {
|
|
572
|
+
return this.isDarkTheme() ? [oneDarkTheme, highlightActiveLine()] : [];
|
|
573
|
+
}
|
|
518
574
|
getDefaultSyntaxHighlightingExtension() {
|
|
519
|
-
|
|
575
|
+
if (this.disableSyntaxHighlighting)
|
|
576
|
+
return [];
|
|
577
|
+
const highlightStyle = this.isDarkTheme() ? oneDarkHighlightStyle : defaultHighlightStyle;
|
|
578
|
+
return syntaxHighlighting(highlightStyle, { fallback: true });
|
|
520
579
|
}
|
|
521
580
|
getCustomThemeExtension() {
|
|
522
581
|
if (this.customThemeCSS) {
|