kempo-ui 0.0.42 → 0.0.62

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.
Files changed (255) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/workflows/publish.yml +66 -0
  3. package/CONTRIBUTING.md +70 -0
  4. package/dist/components/Accordion.js +1 -1
  5. package/dist/components/ContentSlider.js +2 -2
  6. package/dist/components/Dialog.js +9 -8
  7. package/dist/components/HtmlEditor.js +91 -0
  8. package/dist/components/Icon.js +34 -2
  9. package/dist/components/Main.js +24 -0
  10. package/dist/components/PhotoViewer.js +2 -2
  11. package/dist/components/ShadowComponent.js +1 -1
  12. package/dist/components/ShowMore.js +8 -8
  13. package/dist/components/SideMenu.js +1 -1
  14. package/dist/components/SidePanel.js +235 -0
  15. package/dist/components/Table.js +1 -1
  16. package/dist/components/htmlEditorControls/AlignCenter.js +12 -0
  17. package/dist/components/htmlEditorControls/AlignJustify.js +12 -0
  18. package/dist/components/htmlEditorControls/AlignLeft.js +12 -0
  19. package/dist/components/htmlEditorControls/AlignRight.js +12 -0
  20. package/dist/components/htmlEditorControls/Bold.js +12 -0
  21. package/dist/components/htmlEditorControls/BulletList.js +12 -0
  22. package/dist/components/htmlEditorControls/CharacterCount.js +18 -0
  23. package/dist/components/htmlEditorControls/ClearFormatting.js +12 -0
  24. package/dist/components/htmlEditorControls/CodeBlock.js +12 -0
  25. package/dist/components/htmlEditorControls/ControlGroup.js +14 -0
  26. package/dist/components/htmlEditorControls/ControlSpacer.js +6 -0
  27. package/dist/components/htmlEditorControls/CreateLink.js +15 -0
  28. package/dist/components/htmlEditorControls/DropdownControl.js +57 -0
  29. package/dist/components/htmlEditorControls/FormatBlock.js +12 -0
  30. package/dist/components/htmlEditorControls/HtmlEditorControl.js +44 -0
  31. package/dist/components/htmlEditorControls/InlineCode.js +12 -0
  32. package/dist/components/htmlEditorControls/InsertTable.js +15 -0
  33. package/dist/components/htmlEditorControls/Italic.js +12 -0
  34. package/dist/components/htmlEditorControls/Mode.js +9 -0
  35. package/dist/components/htmlEditorControls/NumberList.js +12 -0
  36. package/dist/components/htmlEditorControls/Strikethrough.js +12 -0
  37. package/dist/components/htmlEditorControls/TextBackgroundColor.js +97 -0
  38. package/dist/components/htmlEditorControls/TextColor.js +97 -0
  39. package/dist/components/htmlEditorControls/Underline.js +12 -0
  40. package/dist/components/htmlEditorControls/WordCount.js +18 -0
  41. package/dist/components/tableControls/FirstPage.js +1 -1
  42. package/dist/components/tableControls/LastPage.js +1 -1
  43. package/dist/components/tableControls/NextPage.js +1 -1
  44. package/dist/components/tableControls/PrevPage.js +1 -1
  45. package/dist/utils/formatCode.js +1 -0
  46. package/dist/utils/theme.js +1 -1
  47. package/docs/components/dropdown.html +2 -2
  48. package/docs/components/html-editor.html +442 -0
  49. package/docs/components/icon.html +52 -12
  50. package/docs/components/photo-viewer.html +14 -14
  51. package/docs/components/side-menu.html +32 -0
  52. package/docs/components/side-panel-basic.html +44 -0
  53. package/docs/components/side-panel-dual.html +70 -0
  54. package/docs/components/side-panel-menu.html +50 -0
  55. package/docs/components/side-panel-scroll.html +176 -0
  56. package/docs/components/side-panel.html +226 -0
  57. package/docs/components/table.html +24 -24
  58. package/docs/dev.config.json +8 -0
  59. package/docs/icons/account-circle.svg +1 -0
  60. package/docs/icons/arrow-circle.svg +1 -0
  61. package/docs/icons/arrow-line.svg +1 -0
  62. package/docs/icons/arrow_drop_down.svg +1 -0
  63. package/docs/icons/chevron-double.svg +1 -0
  64. package/docs/icons/chevron-line.svg +1 -0
  65. package/docs/icons/circle.svg +1 -0
  66. package/docs/icons/code.svg +1 -0
  67. package/docs/icons/code_blocks.svg +1 -0
  68. package/docs/icons/copy.svg +1 -0
  69. package/docs/icons/dot.svg +1 -0
  70. package/docs/icons/format_align_center.svg +1 -0
  71. package/docs/icons/format_align_justify.svg +1 -0
  72. package/docs/icons/format_align_left.svg +1 -0
  73. package/docs/icons/format_align_right.svg +1 -0
  74. package/docs/icons/format_bold.svg +1 -0
  75. package/docs/icons/format_clear.svg +1 -0
  76. package/docs/icons/format_color_fill.svg +1 -0
  77. package/docs/icons/format_color_text.svg +1 -0
  78. package/docs/icons/format_h1.svg +1 -0
  79. package/docs/icons/format_h2.svg +1 -0
  80. package/docs/icons/format_h3.svg +1 -0
  81. package/docs/icons/format_h4.svg +1 -0
  82. package/docs/icons/format_h5.svg +1 -0
  83. package/docs/icons/format_h6.svg +1 -0
  84. package/docs/icons/format_italic.svg +1 -0
  85. package/docs/icons/format_list_bulleted.svg +1 -0
  86. package/docs/icons/format_list_numbered.svg +1 -0
  87. package/docs/icons/format_paragraph.svg +1 -0
  88. package/docs/icons/format_underlined.svg +1 -0
  89. package/docs/icons/help.svg +1 -0
  90. package/docs/icons/key.svg +1 -0
  91. package/docs/icons/link.svg +1 -0
  92. package/docs/icons/login.svg +1 -0
  93. package/docs/icons/logout.svg +1 -0
  94. package/docs/icons/more_vert.svg +1 -0
  95. package/docs/icons/strikethrough_s.svg +1 -0
  96. package/docs/icons/table.svg +1 -0
  97. package/docs/icons/wysiwyg.svg +1 -0
  98. package/docs/index.html +12 -0
  99. package/docs/nav-1.inc.html +2 -0
  100. package/docs/nav.inc.html +2 -0
  101. package/docs/prod.config.json +4 -0
  102. package/docs/src/components/Accordion.js +1 -1
  103. package/docs/src/components/ContentSlider.js +2 -2
  104. package/docs/src/components/Dialog.js +9 -8
  105. package/docs/src/components/HtmlEditor.js +91 -0
  106. package/docs/src/components/Icon.js +34 -2
  107. package/docs/src/components/Main.js +24 -0
  108. package/docs/src/components/PhotoViewer.js +2 -2
  109. package/docs/src/components/ShadowComponent.js +1 -1
  110. package/docs/src/components/ShowMore.js +8 -8
  111. package/docs/src/components/SideMenu.js +1 -1
  112. package/docs/src/components/SidePanel.js +235 -0
  113. package/docs/src/components/Table.js +1 -1
  114. package/docs/src/components/htmlEditorControls/AlignCenter.js +12 -0
  115. package/docs/src/components/htmlEditorControls/AlignJustify.js +12 -0
  116. package/docs/src/components/htmlEditorControls/AlignLeft.js +12 -0
  117. package/docs/src/components/htmlEditorControls/AlignRight.js +12 -0
  118. package/docs/src/components/htmlEditorControls/Bold.js +12 -0
  119. package/docs/src/components/htmlEditorControls/BulletList.js +12 -0
  120. package/docs/src/components/htmlEditorControls/CharacterCount.js +18 -0
  121. package/docs/src/components/htmlEditorControls/ClearFormatting.js +12 -0
  122. package/docs/src/components/htmlEditorControls/CodeBlock.js +12 -0
  123. package/docs/src/components/htmlEditorControls/ControlGroup.js +14 -0
  124. package/docs/src/components/htmlEditorControls/ControlSpacer.js +6 -0
  125. package/docs/src/components/htmlEditorControls/CreateLink.js +15 -0
  126. package/docs/src/components/htmlEditorControls/DropdownControl.js +57 -0
  127. package/docs/src/components/htmlEditorControls/FormatBlock.js +12 -0
  128. package/docs/src/components/htmlEditorControls/HtmlEditorControl.js +44 -0
  129. package/docs/src/components/htmlEditorControls/InlineCode.js +12 -0
  130. package/docs/src/components/htmlEditorControls/InsertTable.js +15 -0
  131. package/docs/src/components/htmlEditorControls/Italic.js +12 -0
  132. package/docs/src/components/htmlEditorControls/Mode.js +9 -0
  133. package/docs/src/components/htmlEditorControls/NumberList.js +12 -0
  134. package/docs/src/components/htmlEditorControls/Strikethrough.js +12 -0
  135. package/docs/src/components/htmlEditorControls/TextBackgroundColor.js +97 -0
  136. package/docs/src/components/htmlEditorControls/TextColor.js +97 -0
  137. package/docs/src/components/htmlEditorControls/Underline.js +12 -0
  138. package/docs/src/components/htmlEditorControls/WordCount.js +18 -0
  139. package/docs/src/components/tableControls/FirstPage.js +1 -1
  140. package/docs/src/components/tableControls/LastPage.js +1 -1
  141. package/docs/src/components/tableControls/NextPage.js +1 -1
  142. package/docs/src/components/tableControls/PrevPage.js +1 -1
  143. package/docs/src/utils/formatCode.js +1 -0
  144. package/docs/src/utils/theme.js +1 -1
  145. package/icons/account-circle.svg +1 -0
  146. package/icons/arrow-circle.svg +1 -0
  147. package/icons/arrow-line.svg +1 -0
  148. package/icons/arrow_drop_down.svg +1 -0
  149. package/icons/chevron-double.svg +1 -0
  150. package/icons/chevron-line.svg +1 -0
  151. package/icons/circle.svg +1 -0
  152. package/icons/code.svg +1 -0
  153. package/icons/code_blocks.svg +1 -0
  154. package/icons/copy.svg +1 -0
  155. package/icons/dot.svg +1 -0
  156. package/icons/format_align_center.svg +1 -0
  157. package/icons/format_align_justify.svg +1 -0
  158. package/icons/format_align_left.svg +1 -0
  159. package/icons/format_align_right.svg +1 -0
  160. package/icons/format_bold.svg +1 -0
  161. package/icons/format_clear.svg +1 -0
  162. package/icons/format_color_fill.svg +1 -0
  163. package/icons/format_color_text.svg +1 -0
  164. package/icons/format_h1.svg +1 -0
  165. package/icons/format_h2.svg +1 -0
  166. package/icons/format_h3.svg +1 -0
  167. package/icons/format_h4.svg +1 -0
  168. package/icons/format_h5.svg +1 -0
  169. package/icons/format_h6.svg +1 -0
  170. package/icons/format_italic.svg +1 -0
  171. package/icons/format_list_bulleted.svg +1 -0
  172. package/icons/format_list_numbered.svg +1 -0
  173. package/icons/format_paragraph.svg +1 -0
  174. package/icons/format_underlined.svg +1 -0
  175. package/icons/help.svg +1 -0
  176. package/icons/key.svg +1 -0
  177. package/icons/link.svg +1 -0
  178. package/icons/login.svg +1 -0
  179. package/icons/logout.svg +1 -0
  180. package/icons/more_vert.svg +1 -0
  181. package/icons/strikethrough_s.svg +1 -0
  182. package/icons/table.svg +1 -0
  183. package/icons/wysiwyg.svg +1 -0
  184. package/package.json +6 -5
  185. package/scripts/build.js +0 -7
  186. package/scripts/getIcon.js +52 -0
  187. package/src/components/Accordion.js +1 -1
  188. package/src/components/ContentSlider.js +2 -2
  189. package/src/components/Dialog.js +25 -10
  190. package/src/components/HtmlEditor.js +1548 -0
  191. package/src/components/Icon.js +64 -5
  192. package/src/components/Main.js +86 -0
  193. package/src/components/PhotoViewer.js +2 -2
  194. package/src/components/ShadowComponent.js +0 -1
  195. package/src/components/ShowMore.js +8 -8
  196. package/src/components/SideMenu.js +10 -0
  197. package/src/components/SidePanel.js +497 -0
  198. package/src/components/Table.js +1 -1
  199. package/src/components/htmlEditorControls/AlignCenter.js +65 -0
  200. package/src/components/htmlEditorControls/AlignJustify.js +65 -0
  201. package/src/components/htmlEditorControls/AlignLeft.js +65 -0
  202. package/src/components/htmlEditorControls/AlignRight.js +65 -0
  203. package/src/components/htmlEditorControls/Bold.js +65 -0
  204. package/src/components/htmlEditorControls/BulletList.js +65 -0
  205. package/src/components/htmlEditorControls/CharacterCount.js +75 -0
  206. package/src/components/htmlEditorControls/ClearFormatting.js +65 -0
  207. package/src/components/htmlEditorControls/CodeBlock.js +72 -0
  208. package/src/components/htmlEditorControls/ControlGroup.js +95 -0
  209. package/src/components/htmlEditorControls/ControlSpacer.js +23 -0
  210. package/src/components/htmlEditorControls/CreateLink.js +121 -0
  211. package/src/components/htmlEditorControls/DropdownControl.js +149 -0
  212. package/src/components/htmlEditorControls/FormatBlock.js +108 -0
  213. package/src/components/htmlEditorControls/HtmlEditorControl.js +126 -0
  214. package/src/components/htmlEditorControls/InlineCode.js +77 -0
  215. package/src/components/htmlEditorControls/InsertTable.js +171 -0
  216. package/src/components/htmlEditorControls/Italic.js +65 -0
  217. package/src/components/htmlEditorControls/Mode.js +66 -0
  218. package/src/components/htmlEditorControls/NumberList.js +65 -0
  219. package/src/components/htmlEditorControls/Strikethrough.js +65 -0
  220. package/src/components/htmlEditorControls/TextBackgroundColor.js +195 -0
  221. package/src/components/htmlEditorControls/TextColor.js +195 -0
  222. package/src/components/htmlEditorControls/Underline.js +65 -0
  223. package/src/components/htmlEditorControls/WordCount.js +76 -0
  224. package/src/components/tableControls/FirstPage.js +1 -1
  225. package/src/components/tableControls/LastPage.js +1 -1
  226. package/src/components/tableControls/NextPage.js +1 -1
  227. package/src/components/tableControls/PrevPage.js +1 -1
  228. package/src/utils/formatCode.js +87 -0
  229. package/src/utils/theme.js +22 -9
  230. package/tests/components/Icon.browser-test.js +205 -0
  231. package/tests/components/Main.browser-test.js +406 -0
  232. package/tests/components/SidePanel.browser-test.js +520 -0
  233. package/tests/components/tableControls/PaginationControls.browser-test.js +10 -10
  234. package/.github/workflows/publish-major.yml +0 -39
  235. package/.github/workflows/publish-minor.yml +0 -39
  236. package/.github/workflows/publish-patch.yml +0 -45
  237. package/dist/kempo-vars.css +0 -1
  238. package/docs/icons/arrow-back.svg +0 -1
  239. package/docs/icons/arrow-down-double.svg +0 -1
  240. package/docs/icons/arrow-down.svg +0 -1
  241. package/docs/icons/arrow-up-double.svg +0 -1
  242. package/docs/icons/arrow-up.svg +0 -1
  243. package/docs/icons/chevron-left.svg +0 -1
  244. package/docs/src/kempo-vars.css +0 -1
  245. package/icons/arrow-back.svg +0 -1
  246. package/icons/arrow-down-double.svg +0 -1
  247. package/icons/arrow-down.svg +0 -1
  248. package/icons/arrow-up-double.svg +0 -1
  249. package/icons/arrow-up.svg +0 -1
  250. package/icons/chevron-left.svg +0 -1
  251. package/src/kempo-vars.css +0 -1
  252. /package/docs/icons/{arrow-forward.svg → arrow.svg} +0 -0
  253. /package/docs/icons/{chevron-right.svg → chevron.svg} +0 -0
  254. /package/icons/{arrow-forward.svg → arrow.svg} +0 -0
  255. /package/icons/{chevron-right.svg → chevron.svg} +0 -0
@@ -0,0 +1,235 @@
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css,nothing}from"../lit-all.min.js";import"./Icon.js";class SidePanel extends ShadowComponent{static properties={collapsed:{type:Boolean,reflect:!0},side:{type:String,reflect:!0}};constructor(){super(),this.collapsed=!1,this.side="left"}toggleClick=()=>this.toggle();updated(e){if(super.updated(e),e.has("collapsed")){const e=this.collapsed?"collapse":"expand";this.dispatchEvent(new CustomEvent(e)),this.dispatchEvent(new CustomEvent("change",{detail:e})),window.dispatchEvent(new CustomEvent("side-panel-change",{detail:{collapsed:this.collapsed,width:this.collapsed?"3.5rem":"16rem",side:this.side}}))}}expand=()=>this.collapsed=!1;collapse=()=>this.collapsed=!0;toggle(){this.collapsed=!this.collapsed,this.dispatchEvent(new CustomEvent("toggle"))}render(){return html`
2
+ <div id="header">
3
+ <slot name="logo"></slot>
4
+ <button id="toggle" @click=${this.toggleClick} aria-label="${this.collapsed?"Expand panel":"Collapse panel"}">
5
+ <k-icon name="arrow-line" direction="${this.collapsed?"right":"left"}"></k-icon>
6
+ </button>
7
+ </div>
8
+ <div id="content">
9
+ <slot></slot>
10
+ </div>
11
+ `}static styles=css`
12
+ :host {
13
+ --bg: var(--c_bg);
14
+ --width-expanded: 16rem;
15
+ --transition-duration: var(--animation_ms, 256ms);
16
+ display: block;
17
+ position: fixed;
18
+ top: 0;
19
+ left: 0;
20
+ height: 100vh;
21
+ width: var(--width-expanded);
22
+ transition: width var(--transition-duration);
23
+ background: var(--bg);
24
+ border-right: 1px solid var(--c_border);
25
+ z-index: 1000;
26
+ }
27
+ :host([collapsed]) {
28
+ width: auto;
29
+ }
30
+ :host([side="right"]) {
31
+ left: auto;
32
+ right: 0;
33
+ border-right: none;
34
+ border-left: 1px solid var(--c_border);
35
+ }
36
+ #header {
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: flex-end;
40
+ gap: var(--spacer_h);
41
+ padding: var(--spacer_h);
42
+ border-bottom: 1px solid var(--c_border);
43
+ }
44
+ ::slotted([slot="logo"]) {
45
+ margin-right: auto;
46
+ }
47
+ ::slotted([slot="logo"]) {
48
+ flex: 1;
49
+ min-width: 0;
50
+ opacity: 1;
51
+ transition: opacity var(--transition-duration);
52
+ }
53
+ :host([collapsed]) ::slotted([slot="logo"]) {
54
+ display: none;
55
+ }
56
+ #toggle {
57
+ flex-shrink: 0;
58
+ width: 2rem;
59
+ height: 2rem;
60
+ border: none;
61
+ background: transparent;
62
+ color: var(--c_text);
63
+ cursor: pointer;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ border-radius: var(--radius);
68
+ }
69
+ #toggle:hover {
70
+ background: var(--c_bg_hover);
71
+ }
72
+ #content {
73
+ height: calc(100% - 3rem);
74
+ overflow-y: auto;
75
+ overflow-x: hidden;
76
+ display: flex;
77
+ flex-direction: column;
78
+ }
79
+ :host([collapsed]) #content {
80
+ align-items: flex-start;
81
+ }
82
+ :host(:not([collapsed])) #content {
83
+ /* scrollbar-gutter: stable; */
84
+ }
85
+ `}class SidePanelItem extends ShadowComponent{static properties={icon:{type:String},href:{type:String},active:{type:Boolean,reflect:!0},collapsed:{type:Boolean,reflect:!0},"no-expand":{type:Boolean,attribute:"no-expand"},"hide-when-collapsed":{type:Boolean,attribute:"hide-when-collapsed"}};constructor(){super(),this.icon="",this.href="#",this.active=!1,this.collapsed=!1,this["no-expand"]=!1,this["hide-when-collapsed"]=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};handleClick=e=>{this.collapsed&&!this["no-expand"]&&this.panel&&(e.preventDefault(),this.panel.expand())};render(){return html`
86
+ <a href="${this.href}" class="item ${this.active?"active bg-primary":""}" @click=${this.handleClick}>
87
+ ${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
88
+ ${this.collapsed?nothing:html`<span class="label"><slot></slot></span>`}
89
+ </a>
90
+ `}static styles=css`
91
+ :host {
92
+ display: block;
93
+ }
94
+ :host([collapsed][hide-when-collapsed]) {
95
+ display: none;
96
+ }
97
+ .item {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: var(--spacer_h);
101
+ padding: var(--spacer_h);
102
+ color: var(--c_text);
103
+ text-decoration: none;
104
+ border-radius: var(--radius);
105
+ margin: 0 var(--spacer_h);
106
+ transition: background var(--animation_ms), color var(--animation_ms);
107
+ white-space: nowrap;
108
+ }
109
+ :host([collapsed]) .item {
110
+ }
111
+ .item:hover {
112
+ background: var(--c_bg_hover);
113
+ }
114
+ .item.active {
115
+ color: var(--tc_on_primary);
116
+ }
117
+ .item.active:hover {
118
+ background: var(--c_primary);
119
+ filter: brightness(1.1);
120
+ }
121
+ k-icon {
122
+ flex-shrink: 0;
123
+ }
124
+ .label {
125
+ min-width: 0;
126
+ overflow: hidden;
127
+ text-overflow: ellipsis;
128
+ }
129
+ `}class SidePanelLabel extends ShadowComponent{static properties={collapsed:{type:Boolean,reflect:!0}};constructor(){super(),this.collapsed=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};render(){return this.collapsed?html`<hr>`:html`<div class="label"><slot></slot></div>`}static styles=css`
130
+ :host {
131
+ display: block;
132
+ margin: var(--spacer_h) 0;
133
+ }
134
+ :host([collapsed]) {
135
+ margin: 0 var(--spacer_h);
136
+ align-self: stretch;
137
+ }
138
+ .label {
139
+ padding: 0 var(--spacer);
140
+ font-size: 0.75rem;
141
+ font-weight: 600;
142
+ text-transform: uppercase;
143
+ color: var(--c_text_muted);
144
+ letter-spacing: 0.05em;
145
+ }
146
+ hr {
147
+ border: none;
148
+ border-top: 1px solid var(--c_border);
149
+ margin: var(--spacer_h) var(--spacer);
150
+ }
151
+ :host([collapsed]) hr {
152
+ margin: var(--spacer_h) 0;
153
+ }
154
+ `}class SidePanelMenu extends ShadowComponent{static properties={icon:{type:String},label:{type:String},open:{type:Boolean,reflect:!0},collapsed:{type:Boolean,reflect:!0},"no-expand":{type:Boolean,attribute:"no-expand"},"hide-when-collapsed":{type:Boolean,attribute:"hide-when-collapsed"}};constructor(){super(),this.icon="",this.label="",this.open=!1,this.collapsed=!1,this["no-expand"]=!1,this["hide-when-collapsed"]=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.open=!1,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};toggleMenu=()=>{this.collapsed&&!this["no-expand"]&&this.panel?this.panel.expand():this.collapsed||(this.open=!this.open)};render(){return html`
155
+ <div class="menu-container">
156
+ <button class="no-btn menu-header ${this.open?"open":""}" @click=${this.toggleMenu}>
157
+ ${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
158
+ ${this.collapsed?nothing:html`<span class="label">${this.label}</span>`}
159
+ ${this.collapsed?nothing:html`<k-icon class="chevron" name="chevron" direction="${this.open?"down":"right"}"></k-icon>`}
160
+ </button>
161
+ <div class="menu-content ${this.open&&!this.collapsed?"open":""}">
162
+ <slot></slot>
163
+ </div>
164
+ </div>
165
+ `}static styles=css`
166
+ :host {
167
+ display: block;
168
+ }
169
+ :host([collapsed][hide-when-collapsed]) {
170
+ display: none;
171
+ }
172
+ .menu-container {
173
+ margin: 0;
174
+ }
175
+ .menu-header {
176
+ display: flex !important;
177
+ align-items: center;
178
+ gap: var(--spacer_h);
179
+ padding-top: var(--spacer_h) !important;
180
+ padding-bottom: var(--spacer_h) !important;
181
+ padding-left: var(--spacer_h) !important;
182
+ padding-right: var(--spacer_h) !important;
183
+ color: var(--c_text);
184
+ background: transparent;
185
+ border: none;
186
+ border-radius: var(--radius);
187
+ margin: 0 var(--spacer_h);
188
+ width: calc(100% - var(--spacer));
189
+ cursor: pointer;
190
+ text-align: left;
191
+ white-space: nowrap;
192
+ transition: background var(--animation_ms);
193
+ }
194
+ :host([collapsed]) .menu-header {
195
+ width: auto;
196
+ }
197
+ .menu-header:hover {
198
+ background: var(--c_bg_hover);
199
+ }
200
+ k-icon {
201
+ flex-shrink: 0;
202
+ }
203
+ .label {
204
+ flex: 1;
205
+ min-width: 0;
206
+ overflow: hidden;
207
+ text-overflow: ellipsis;
208
+ }
209
+ .chevron {
210
+ transition: transform var(--animation_ms);
211
+ }
212
+ .menu-content {
213
+ max-height: 0;
214
+ overflow: hidden;
215
+ transition: max-height var(--animation_ms);
216
+ padding-left: calc(var(--spacer_h) * 2);
217
+ }
218
+ :host([collapsed]) .menu-content {
219
+ padding-left: 0;
220
+ }
221
+ .menu-content.open {
222
+ max-height: 500px;
223
+ }
224
+ ::slotted(*) {
225
+ margin: 0.25rem 0;
226
+ }
227
+ `}class SidePanelSpacer extends ShadowComponent{render(){return html`<div class="spacer"></div>`}static styles=css`
228
+ :host {
229
+ display: block;
230
+ flex: 1;
231
+ }
232
+ .spacer {
233
+ height: 100%;
234
+ }
235
+ `}customElements.define("k-side-panel",SidePanel),customElements.define("k-side-panel-item",SidePanelItem),customElements.define("k-side-panel-label",SidePanelLabel),customElements.define("k-side-panel-menu",SidePanelMenu),customElements.define("k-side-panel-spacer",SidePanelSpacer);export default SidePanel;
@@ -15,7 +15,7 @@ import{html,css,unsafeStatic,literal}from"../lit-all.min.js";import ShadowCompon
15
15
  @click=${this.enableSorting?()=>this.handleFieldClick(t):null}
16
16
  >
17
17
  ${s}
18
- ${o?html`<k-icon name="${r.asc?"arrow-down":"arrow-up"}" class="icon-sort"></k-icon>`:""}
18
+ ${o?html`<k-icon name="arrow" direction="${r.asc?"down":"up"}" class="icon-sort"></k-icon>`:""}
19
19
  </div>
20
20
  `)}),this.hasAfterControls()&&e.push(html`
21
21
  <div class="field cell field-after-controls" style="width: ${this.columnSizes.afterControls}px"></div>
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class AlignCenter extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.alignCenter()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_align_center"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-align-center",AlignCenter);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class AlignJustify extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.alignJustify()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_align_justify"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-align-justify",AlignJustify);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class AlignLeft extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.alignLeft()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_align_left"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-align-left",AlignLeft);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class AlignRight extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.alignRight()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_align_right"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-align-right",AlignRight);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class Bold extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.bold()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_bold"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-bold",Bold);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class BulletList extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.unorderedList()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_list_bulleted"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-bullet-list",BulletList);
@@ -0,0 +1,18 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";export default class CharacterCount extends HtmlEditorControl{static properties={count:{type:Number,state:!0}};constructor(){super(),this.count=0}connectedCallback(){super.connectedCallback(),this.editor&&(this.editor.addEventListener("ready",()=>{this.updateCount()}),this.editor.addEventListener("change",()=>{this.updateCount()}),setTimeout(()=>this.updateCount(),0))}updateCount=()=>{if(!this.editor)return;const t=(new DOMParser).parseFromString(this.editor.getValue(),"text/html").body.innerText||"";this.count=t.length};render(){return html`
2
+ <span class="character-count">
3
+ <slot name="label">Characters:</slot> ${this.count}
4
+ </span>
5
+ `}static styles=[HtmlEditorControl.styles,css`
6
+ :host {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ padding: 0 0.5rem;
10
+ font-size: 0.875rem;
11
+ color: var(--text-color-secondary, #666);
12
+ }
13
+ .character-count {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 0.25rem;
17
+ }
18
+ `]}customElements.define("k-hec-character-count",CharacterCount);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class ClearFormatting extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.removeFormat()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_clear"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-clear-formatting",ClearFormatting);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class CodeBlock extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleMouseDown=t=>{const o=window.getSelection()?.toString();t.preventDefault(),t.stopPropagation(),this.editor&&(o?this.editor.wrapSelection("<pre>","</pre>",o):this.editor.formatBlock("pre"))};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @mousedown="${this.handleMouseDown}">
7
+ <slot name="icon">
8
+ <k-icon name="code_blocks"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-code-block",CodeBlock);
@@ -0,0 +1,14 @@
1
+ import ShadowComponent from"../ShadowComponent.js";import{html,css}from"../../lit-all.min.js";export default class ControlGroup extends ShadowComponent{static properties={editorMode:{type:String,state:!0},hidden:{type:Boolean,reflect:!0}};constructor(){super()}connectedCallback(){super.connectedCallback(),this.hasAttribute("class")||this.setAttribute("class","b r mq"),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}get editor(){return this.closest("k-html-editor")}updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode,this.requestUpdate())}hasVisibleChildren(){return Array.from(this.children).filter(t=>t.tagName.startsWith("K-HEC-")&&"K-HEC-SPACER"!==t.tagName).some(t=>{if(!1===t.hidden||void 0===t.hidden){return"none"!==window.getComputedStyle(t).display}return!1})}static styles=css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+
6
+ :host([hidden]) {
7
+ display: none !important;
8
+ }
9
+
10
+ ::slotted(*) {
11
+ margin-top: -1px;
12
+ margin-bottom: -1px;
13
+ }
14
+ `;render(){return html`<slot></slot>`}updated(){super.updated(),requestAnimationFrame(()=>{this.hidden=!this.hasVisibleChildren()})}}customElements.define("k-hec-group",ControlGroup);
@@ -0,0 +1,6 @@
1
+ import ShadowComponent from"../ShadowComponent.js";import{html,css}from"../../lit-all.min.js";export default class ControlSpacer extends ShadowComponent{static styles=css`
2
+ :host {
3
+ display: inline-flex;
4
+ flex: 1;
5
+ }
6
+ `;render(){return html``}}customElements.define("k-hec-spacer",ControlSpacer);
@@ -0,0 +1,15 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";import Dialog from"../Dialog.js";export default class CreateLink extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};constructor(){super()}connectedCallback(){super.connectedCallback(),this.editor&&(this.editorMode=this.editor.mode,this.editor?.addEventListener("mode-changed",()=>{this.editor&&(this.editorMode=this.editor.mode)}))}handleMouseDown=t=>{if(!this.editor)return;t.preventDefault(),t.stopPropagation();const e=this.editor.selection?.text||"",o=document.createElement("input");o.type="text",o.placeholder="https://example.com",o.style.cssText="padding: 0.5rem; border: 1px solid var(--border-color, #ccc); border-radius: 4px; font-size: 1rem;";const i=document.createElement("input");i.type="text",i.placeholder="Enter link text",i.value=e,i.style.cssText="padding: 0.5rem; border: 1px solid var(--border-color, #ccc); border-radius: 4px; font-size: 1rem;";const n=document.createElement("div");n.className="p",n.style.cssText="display: flex; flex-direction: column; gap: 1rem;",n.innerHTML='\n\t\t\t<div style="display: flex; flex-direction: column; gap: 0.5rem;">\n\t\t\t\t<label style="font-weight: bold;">URL</label>\n\t\t\t</div>\n\t\t\t<div style="display: flex; flex-direction: column; gap: 0.5rem;">\n\t\t\t\t<label style="font-weight: bold;">Link Text</label>\n\t\t\t</div>\n\t\t',n.children[0].appendChild(o),n.children[1].appendChild(i),Dialog.create(n,{title:"Create Link",cancelText:"Cancel",confirmText:"Insert Link",confirmClasses:"success ml",confirmAction:t=>{const e=o.value.trim(),n=i.value.trim();if(!e)return void(t.keepDialogOpen=!0);const l=document.createElement("a");l.href=e,l.textContent=n||e,this.editor.selection?this.editor.replaceSelectionWithElement(l,!0):this.editor.insertElementAtCursor(l,!0)}})};render(){return this.hidden="code"===this.editorMode,html`
2
+ <button
3
+ class="${this.buttonClasses}"
4
+ @mousedown="${this.handleMouseDown}"
5
+ >
6
+ <slot name="icon">
7
+ <k-icon name="link"></k-icon>
8
+ </slot>
9
+ <slot></slot>
10
+ </button>
11
+ `}static styles=[HtmlEditorControl.styles,css`
12
+ :host {
13
+ display: inline-flex;
14
+ }
15
+ `]}customElements.define("k-hec-create-link",CreateLink);
@@ -0,0 +1,57 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Dropdown.js";import"../Icon.js";export default class DropdownControl extends HtmlEditorControl{static properties={opened:{type:Boolean,reflect:!0},editorMode:{type:String,state:!0}};constructor(){super(),this.opened=!1}connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}updated(t){super.updated(t),t.has("editorMode")&&requestAnimationFrame(()=>{this.hidden="code"===this.editorMode&&!this.hasVisibleChildren()})}updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}hasVisibleChildren(){return Array.from(this.children).filter(t=>!t.hasAttribute("slot")).some(t=>{if(!1===t.hidden||void 0===t.hidden){return"none"!==window.getComputedStyle(t).display}return!1})}static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+
6
+ k-dropdown {
7
+ display: inline-flex;
8
+ }
9
+
10
+ /* Override fixed sizing for dropdown trigger */
11
+ button[slot="trigger"] {
12
+ width: auto !important;
13
+ height: auto !important;
14
+ min-width: 40px;
15
+ min-height: 40px;
16
+ }
17
+
18
+ /* Style slotted items (not icon or label) */
19
+ ::slotted(:not([slot="icon"]):not([slot="label"])) {
20
+ display: block !important;
21
+ }
22
+
23
+ ::slotted(:not([slot="icon"]):not([slot="label"])) .icon-btn,
24
+ ::slotted(:not([slot="icon"]):not([slot="label"])) button {
25
+ display: flex !important;
26
+ width: 100% !important;
27
+ height: auto !important;
28
+ justify-content: flex-start !important;
29
+ padding: 0.5rem 0.75rem !important;
30
+ margin: 0 !important;
31
+ border: none !important;
32
+ border-radius: 0 !important;
33
+ border-bottom: 1px solid var(--c_border) !important;
34
+ }
35
+
36
+ ::slotted(:not([slot="icon"]):not([slot="label"]):last-of-type) .icon-btn,
37
+ ::slotted(:not([slot="icon"]):not([slot="label"]):last-of-type) button {
38
+ border-bottom: none !important;
39
+ }
40
+ `];handleToggle=()=>{this.opened=!this.opened};handleOpened=()=>{this.opened=!0};handleClosed=()=>{this.opened=!1};render(){return html`
41
+ <k-dropdown
42
+ ?opened=${this.opened}
43
+ @opened=${this.handleOpened}
44
+ @closed=${this.handleClosed}
45
+ >
46
+ <button
47
+ slot="trigger"
48
+ class="${this.buttonClasses}"
49
+ >
50
+ <slot name="icon">
51
+ <k-icon name="arrow_drop_down"></k-icon>
52
+ </slot>
53
+ <slot name="label"></slot>
54
+ </button>
55
+ <slot></slot>
56
+ </k-dropdown>
57
+ `}}customElements.define("k-hec-dropdown",DropdownControl);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class FormatBlock extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0},tag:{type:String},label:{type:String}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];constructor(){super(),this.tag="p",this.label=""}connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.formatBlock(this.tag)};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){this.hidden="code"===this.editorMode;this.label||this.getDefaultLabel();const t=this.getDefaultIcon();return html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="${t}"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}getDefaultLabel(){return{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",p:"Paragraph"}[this.tag]||this.tag.toUpperCase()}getDefaultIcon(){return{h1:"format_h1",h2:"format_h2",h3:"format_h3",h4:"format_h4",h5:"format_h5",h6:"format_h6",p:"format_paragraph"}[this.tag]||"format_paragraph"}}customElements.define("k-hec-format-block",FormatBlock);
@@ -0,0 +1,44 @@
1
+ import ShadowComponent from"../ShadowComponent.js";import{html,css}from"../../lit-all.min.js";export default class HtmlEditorControl extends ShadowComponent{static properties={btnClass:{type:String,attribute:"btn-class"},groupBtnClass:{type:String,attribute:"group-btn-class"},groupLastBtnClass:{type:String,attribute:"group-last-btn-class"},hidden:{type:Boolean,reflect:!0}};constructor(){super(),this.btnClass="b r mq ph",this.groupBtnClass="br ph",this.groupLastBtnClass="ph"}get editor(){let t=this.getRootNode();for(;t instanceof ShadowRoot;){const o=t.host,n=o.closest("k-html-editor");if(n)return n;t=o.getRootNode()}return this.closest("k-html-editor")}get isInGroup(){const t=this.parentElement;return t&&"K-HEC-GROUP"===t.tagName}get isInDropdown(){const t=this.parentElement;return t&&"K-HEC-DROPDOWN"===t.tagName}get isLastInGroup(){if(!this.isInGroup)return!1;const t=this.parentElement,o=Array.from(t.children).filter(t=>t.tagName.startsWith("K-HEC-")&&"K-HEC-SPACER"!==t.tagName);return o[o.length-1]===this}get buttonClasses(){let t;return t=this.isInDropdown?"dropdown-item":this.isInGroup?this.isLastInGroup?this.groupLastBtnClass:this.groupBtnClass:this.btnClass,`no-btn icon-btn ${t}`.trim()}static styles=css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+
6
+ :host([hidden]) {
7
+ display: none !important;
8
+ }
9
+
10
+ .icon-btn {
11
+ display: inline-flex !important;
12
+ align-items: center;
13
+ justify-content: center;
14
+ width: 40px;
15
+ height: 40px;
16
+ gap: 0.5rem;
17
+ }
18
+ .icon-btn:disabled {
19
+ opacity: 0.6;
20
+ }
21
+
22
+ .icon-btn:has(slot:not([name])) {
23
+ width: auto;
24
+ padding-left: 0.75rem;
25
+ padding-right: 0.75rem;
26
+ }
27
+
28
+ /* Styles for controls in dropdown */
29
+ .icon-btn.dropdown-item {
30
+ display: flex !important;
31
+ width: 100% !important;
32
+ height: auto !important;
33
+ justify-content: flex-start !important;
34
+ padding: 0.5rem 0.75rem !important;
35
+ margin: 0 !important;
36
+ border: none !important;
37
+ border-radius: 0 !important;
38
+ border-bottom: 1px solid var(--c_border) !important;
39
+ }
40
+
41
+ :host(:last-child) .icon-btn.dropdown-item {
42
+ border-bottom: none !important;
43
+ }
44
+ `}customElements.define("k-html-editor-control",HtmlEditorControl);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class InlineCode extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleMouseDown=t=>{if(!this.editor)return;t.preventDefault(),t.stopPropagation();const e=document.createElement("code"),o=this.editor.getValueWithSelectionMarkers();o.hasSelection?(e.textContent=o.selectedText,this.editor.replaceSelectionWithElement(e,!0)):(e.textContent="​",this.editor.insertElementAtCursor(e,!0))};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @mousedown="${this.handleMouseDown}">
7
+ <slot name="icon">
8
+ <k-icon name="code_blocks"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-inline-code",InlineCode);
@@ -0,0 +1,15 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";import Dialog from"../Dialog.js";export default class InsertTable extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};constructor(){super()}connectedCallback(){super.connectedCallback(),this.editor&&(this.editorMode=this.editor.mode,this.editor?.addEventListener("mode-changed",()=>{this.editor&&(this.editorMode=this.editor.mode)}))}handleMouseDown=e=>{if(!this.editor)return;e.preventDefault(),e.stopPropagation();const t=this.editor.shadowRoot.getSelection()||window.getSelection();let o=null,l=null;if(t.rangeCount){let e=t.getRangeAt(0).startContainer;e.nodeType===Node.TEXT_NODE&&(e=e.parentElement),o=e.closest("table")}const n=!!o;let r=3,s=3,i=!0;if(n){const e=o.querySelector("thead"),t=o.querySelector("tbody"),n=!!e;if(l=[],n){const t=e.querySelector("tr"),o=Array.from(t.cells).map(e=>e.innerHTML);l.push(o),s=o.length}const d=t.querySelectorAll("tr");d.forEach(e=>{const t=Array.from(e.cells).map(e=>e.innerHTML);l.push(t),t.length>s&&(s=t.length)}),r=d.length,i=n,o.remove()}const d=document.createElement("input");d.type="number",d.min="1",d.max="20",d.value=r.toString(),d.style.cssText="padding: 0.5rem; border: 1px solid var(--border-color, #ccc); border-radius: 4px; font-size: 1rem;";const c=document.createElement("input");c.type="number",c.min="1",c.max="10",c.value=s.toString(),c.style.cssText="padding: 0.5rem; border: 1px solid var(--border-color, #ccc); border-radius: 4px; font-size: 1rem;";const a=document.createElement("input");a.type="checkbox",a.checked=i,a.id="table-headers-checkbox";const m=document.createElement("div");m.className="p",m.style.cssText="display: flex; flex-direction: column; gap: 1rem;",m.innerHTML='\n\t\t\t<div style="display: flex; flex-direction: column; gap: 0.5rem;">\n\t\t\t\t<label style="font-weight: bold;">Rows</label>\n\t\t\t</div>\n\t\t\t<div style="display: flex; flex-direction: column; gap: 0.5rem;">\n\t\t\t\t<label style="font-weight: bold;">Columns</label>\n\t\t\t</div>\n\t\t\t<div style="display: flex; align-items: center; gap: 0.5rem;">\n\t\t\t\t<label for="table-headers-checkbox" style="font-weight: bold;">Include Headers</label>\n\t\t\t</div>\n\t\t',m.children[0].appendChild(d),m.children[1].appendChild(c),m.children[2].insertBefore(a,m.children[2].firstChild),Dialog.create(m,{title:n?"Edit Table":"Insert Table",cancelText:"Cancel",confirmText:n?"Update Table":"Insert Table",confirmClasses:"success",confirmAction:()=>{const e=parseInt(d.value)||3,t=parseInt(c.value)||3,o=a.checked;this.editor.insertTable(e,t,o,l)}})};render(){return this.hidden="code"===this.editorMode,html`
2
+ <button
3
+ class="${this.buttonClasses}"
4
+ @mousedown="${this.handleMouseDown}"
5
+ >
6
+ <slot name="icon">
7
+ <k-icon name="table"></k-icon>
8
+ </slot>
9
+ <slot></slot>
10
+ </button>
11
+ `}static styles=[HtmlEditorControl.styles,css`
12
+ :host {
13
+ display: inline-flex;
14
+ }
15
+ `]}customElements.define("k-hec-insert-table",InsertTable);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class Italic extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.italic()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_italic"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-italic",Italic);
@@ -0,0 +1,9 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class Mode extends HtmlEditorControl{static properties={mode:{type:String,reflect:!0}};connectedCallback(){super.connectedCallback(),this.updateMode(),this.editor?.addEventListener("mode-changed",()=>this.updateMode())}handleClick=()=>{this.editor&&(this.editor.mode="visual"===this.editor.mode?"code":"visual")};updateMode(){this.editor&&(this.mode=this.editor.mode)}static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];render(){const t="code"===this.mode?`${this.buttonClasses} bg-primary`:this.buttonClasses;return html`
6
+ <button class="${t}" @click="${this.handleClick}">
7
+ <k-icon name="code"></k-icon>
8
+ </button>
9
+ `}}customElements.define("k-hec-mode",Mode);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class NumberList extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.orderedList()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="format_list_numbered"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-number-list",NumberList);
@@ -0,0 +1,12 @@
1
+ import HtmlEditorControl from"./HtmlEditorControl.js";import{html,css}from"../../lit-all.min.js";import"../Icon.js";export default class Strikethrough extends HtmlEditorControl{static properties={editorMode:{type:String,state:!0}};static styles=[HtmlEditorControl.styles,css`
2
+ :host {
3
+ display: inline-flex;
4
+ }
5
+ `];connectedCallback(){super.connectedCallback(),this.updateEditorMode(),this.editor?.addEventListener("mode-changed",()=>this.updateEditorMode())}handleClick=()=>{this.editor&&this.editor.strikethrough()};updateEditorMode(){this.editor&&(this.editorMode=this.editor.mode)}render(){return this.hidden="code"===this.editorMode,html`
6
+ <button class="${this.buttonClasses}" @click="${this.handleClick}">
7
+ <slot name="icon">
8
+ <k-icon name="strikethrough_s"></k-icon>
9
+ </slot>
10
+ <slot></slot>
11
+ </button>
12
+ `}}customElements.define("k-hec-strikethrough",Strikethrough);