kempo-ui 0.1.6 → 0.2.2
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/.github/skills/highlight-code/SKILL.md +22 -6
- package/.github/skills/new-component/SKILL.md +68 -4
- package/AGENTS.md +11 -0
- package/bin/highlight_code.js +7 -15
- package/dist/components/Aside.js +326 -0
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/Main.js +2 -2
- package/dist/components/Nav.js +27 -0
- package/dist/components/PhotoViewer.js +1 -1
- package/dist/components/ShadowComponent.js +1 -1
- package/dist/components/ThemeSwitcher.js +1 -0
- package/dist/components/Toast.js +1 -1
- package/docs/components/accordion.html +4 -3
- package/docs/components/aside-items.html +43 -0
- package/docs/components/aside-menu.html +43 -0
- package/docs/components/aside-push.html +26 -0
- package/docs/components/aside.html +567 -0
- package/docs/components/card.html +4 -3
- package/docs/components/color-picker.html +4 -3
- package/docs/components/content-slider.html +4 -3
- package/docs/components/dialog.html +4 -3
- package/docs/components/dropdown.html +4 -3
- package/docs/components/filter-list.html +4 -3
- package/docs/components/focus-capture.html +6 -5
- package/docs/components/html-editor.html +5 -4
- package/docs/components/hybrid-component.html +5 -4
- package/docs/components/icon.html +4 -3
- package/docs/components/import.html +5 -4
- package/docs/components/light-component.html +4 -3
- package/docs/components/nav.html +117 -0
- package/docs/components/photo-viewer.html +5 -4
- package/docs/components/resize.html +5 -4
- package/docs/components/shadow-component.html +4 -3
- package/docs/components/show-more.html +5 -4
- package/docs/components/sortable.html +4 -3
- package/docs/components/spinner.html +4 -3
- package/docs/components/split.html +5 -4
- package/docs/components/table.html +4 -3
- package/docs/components/tableControls.html +4 -3
- package/docs/components/tableCustomFields.html +4 -3
- package/docs/components/tableFetchRecords.html +5 -4
- package/docs/components/tableFieldSortHide.html +5 -4
- package/docs/components/tablePagination.html +4 -3
- package/docs/components/tableRecordEditing.html +4 -3
- package/docs/components/tableRecordFiltering.html +5 -4
- package/docs/components/tableRecordHiding.html +4 -3
- package/docs/components/tableRecordSearching.html +5 -4
- package/docs/components/tableRecordSelection.html +4 -3
- package/docs/components/tableRowControls.html +4 -3
- package/docs/components/tableServerSync.html +5 -4
- package/docs/components/tableSorting.html +5 -4
- package/docs/components/tabs.html +4 -3
- package/docs/components/tags.html +4 -3
- package/docs/components/theme-select.html +4 -3
- package/docs/components/theme-switcher.html +5 -4
- package/docs/components/timestamp.html +4 -3
- package/docs/components/toast.html +4 -3
- package/docs/components/toggle.html +5 -4
- package/docs/components/tree.html +5 -4
- package/docs/index.html +22 -21
- package/docs/nav-1.inc.html +18 -12
- package/docs/nav.inc.html +20 -13
- package/docs/nav.inc.js +1 -1
- package/docs/src/components/Aside.js +326 -0
- package/docs/src/components/Dialog.js +1 -1
- package/docs/src/components/Dropdown.js +1 -1
- package/docs/src/components/Main.js +2 -2
- package/docs/src/components/Nav.js +27 -0
- package/docs/src/components/PhotoViewer.js +1 -1
- package/docs/src/components/ShadowComponent.js +1 -1
- package/docs/src/components/ThemeSwitcher.js +1 -0
- package/docs/src/components/Toast.js +1 -1
- package/docs/utils/context.html +4 -3
- package/docs/utils/cookie.html +4 -3
- package/docs/utils/debounce.html +4 -3
- package/docs/utils/drag.html +4 -3
- package/docs/utils/elevation.html +156 -0
- package/docs/utils/formatTimestamp.html +4 -3
- package/docs/utils/object.html +4 -3
- package/docs/utils/propConverters.html +4 -3
- package/docs/utils/string.html +4 -3
- package/docs/utils/theme.html +4 -3
- package/docs/utils/toTitleCase.html +4 -3
- package/docs/utils/type.html +4 -3
- package/docs/utils/wait.html +4 -3
- package/llm.txt +247 -0
- package/package.json +3 -4
- package/src/components/Aside.js +726 -0
- package/src/components/Dialog.js +1 -1
- package/src/components/Dropdown.js +1 -1
- package/src/components/Main.js +34 -30
- package/src/components/Nav.js +53 -0
- package/src/components/PhotoViewer.js +1 -1
- package/src/components/ShadowComponent.js +1 -1
- package/src/components/ThemeSwitcher.js +1 -0
- package/src/components/Toast.js +1 -1
- package/tests/bin/get_icon.node-test.js +26 -0
- package/tests/bin/highlight_code.node-test.js +108 -0
- package/tests/bin/list_icons.node-test.js +26 -0
- package/tests/components/Aside.browser-test.js +778 -0
- package/tests/components/Main.browser-test.js +115 -283
- package/dist/components/SideMenu.js +0 -97
- package/dist/components/SidePanel.js +0 -236
- package/docs/components/side-menu.html +0 -189
- package/docs/components/side-panel-basic.html +0 -44
- package/docs/components/side-panel-dual.html +0 -70
- package/docs/components/side-panel-menu.html +0 -50
- package/docs/components/side-panel-persistent.html +0 -90
- package/docs/components/side-panel-scroll.html +0 -176
- package/docs/components/side-panel.html +0 -245
- package/docs/src/components/SideMenu.js +0 -97
- package/docs/src/components/SidePanel.js +0 -236
- package/scripts/update-kempo-css.js +0 -53
- package/src/components/SideMenu.js +0 -178
- package/src/components/SidePanel.js +0 -513
- package/tests/components/SideMenu.browser-test.js +0 -667
- package/tests/components/SidePanel.browser-test.js +0 -520
- package/tools/highlight.js +0 -51
|
@@ -1,236 +0,0 @@
|
|
|
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},persistentId:{type:String,reflect:!0,attribute:"persistent-id"}};constructor(){super(),this.collapsed=!1,this.side="left",this.persistentId=null,this.isInitialLoad=!0}toggleClick=()=>this.toggle();updated(e){if(super.updated(e),e.has("persistentId")&&this.persistentId&&window?.localStorage){const e=`side-panel-persistent-id-${this.persistentId}`,t=window.localStorage.getItem(e);null!==t&&(this.collapsed="true"===t,this.isInitialLoad=!1)}if(e.has("collapsed")){if(this.persistentId&&window?.localStorage&&!this.isInitialLoad){const e=`side-panel-persistent-id-${this.persistentId}`;window.localStorage.setItem(e,this.collapsed.toString())}this.isInitialLoad=!1;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="${(()=>"right"===this.side?this.collapsed?"left":"right":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: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
position: fixed;
|
|
19
|
-
top: 0;
|
|
20
|
-
left: 0;
|
|
21
|
-
height: 100vh;
|
|
22
|
-
width: var(--width-expanded);
|
|
23
|
-
transition: width var(--transition-duration);
|
|
24
|
-
background: var(--bg);
|
|
25
|
-
border-right: 1px solid var(--c_border);
|
|
26
|
-
z-index: 99;
|
|
27
|
-
}
|
|
28
|
-
:host([collapsed]) {
|
|
29
|
-
width: auto;
|
|
30
|
-
}
|
|
31
|
-
:host([side="right"]) {
|
|
32
|
-
left: auto;
|
|
33
|
-
right: 0;
|
|
34
|
-
border-right: none;
|
|
35
|
-
border-left: 1px solid var(--c_border);
|
|
36
|
-
}
|
|
37
|
-
#header {
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: flex-end;
|
|
41
|
-
gap: var(--spacer_h);
|
|
42
|
-
padding: var(--spacer_h);
|
|
43
|
-
border-bottom: 1px solid var(--c_border);
|
|
44
|
-
flex-shrink: 0;
|
|
45
|
-
}
|
|
46
|
-
::slotted([slot="logo"]) {
|
|
47
|
-
margin-right: auto;
|
|
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
|
-
flex: 1;
|
|
74
|
-
min-height: 0;
|
|
75
|
-
overflow-y: auto;
|
|
76
|
-
overflow-x: hidden;
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
}
|
|
80
|
-
:host([collapsed]) #content {
|
|
81
|
-
align-items: flex-start;
|
|
82
|
-
}
|
|
83
|
-
:host(:not([collapsed])) #content {
|
|
84
|
-
/* scrollbar-gutter: stable; */
|
|
85
|
-
}
|
|
86
|
-
`}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`
|
|
87
|
-
<a href="${this.href}" class="item ${this.active?"active bg-primary":""}" @click=${this.handleClick}>
|
|
88
|
-
${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
|
|
89
|
-
${this.collapsed?nothing:html`<span class="label"><slot></slot></span>`}
|
|
90
|
-
</a>
|
|
91
|
-
`}static styles=css`
|
|
92
|
-
:host {
|
|
93
|
-
display: block;
|
|
94
|
-
}
|
|
95
|
-
:host([collapsed][hide-when-collapsed]) {
|
|
96
|
-
display: none;
|
|
97
|
-
}
|
|
98
|
-
.item {
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: center;
|
|
101
|
-
gap: var(--spacer_h);
|
|
102
|
-
padding: var(--spacer_h);
|
|
103
|
-
color: var(--c_text);
|
|
104
|
-
text-decoration: none;
|
|
105
|
-
border-radius: var(--radius);
|
|
106
|
-
margin: 0 var(--spacer_h);
|
|
107
|
-
transition: background var(--animation_ms), color var(--animation_ms);
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
}
|
|
110
|
-
:host([collapsed]) .item {
|
|
111
|
-
}
|
|
112
|
-
.item:hover {
|
|
113
|
-
background: var(--c_bg_hover);
|
|
114
|
-
}
|
|
115
|
-
.item.active {
|
|
116
|
-
color: var(--tc_on_primary);
|
|
117
|
-
}
|
|
118
|
-
.item.active:hover {
|
|
119
|
-
background: var(--c_primary);
|
|
120
|
-
filter: brightness(1.1);
|
|
121
|
-
}
|
|
122
|
-
k-icon {
|
|
123
|
-
flex-shrink: 0;
|
|
124
|
-
}
|
|
125
|
-
.label {
|
|
126
|
-
min-width: 0;
|
|
127
|
-
overflow: hidden;
|
|
128
|
-
text-overflow: ellipsis;
|
|
129
|
-
}
|
|
130
|
-
`}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`
|
|
131
|
-
:host {
|
|
132
|
-
display: block;
|
|
133
|
-
margin: var(--spacer_h) 0;
|
|
134
|
-
}
|
|
135
|
-
:host([collapsed]) {
|
|
136
|
-
margin: 0 var(--spacer_h);
|
|
137
|
-
align-self: stretch;
|
|
138
|
-
}
|
|
139
|
-
.label {
|
|
140
|
-
padding: 0 var(--spacer);
|
|
141
|
-
font-size: 0.75rem;
|
|
142
|
-
font-weight: 600;
|
|
143
|
-
text-transform: uppercase;
|
|
144
|
-
color: var(--c_text_muted);
|
|
145
|
-
letter-spacing: 0.05em;
|
|
146
|
-
}
|
|
147
|
-
hr {
|
|
148
|
-
border: none;
|
|
149
|
-
border-top: 1px solid var(--c_border);
|
|
150
|
-
margin: var(--spacer_h) var(--spacer);
|
|
151
|
-
}
|
|
152
|
-
:host([collapsed]) hr {
|
|
153
|
-
margin: var(--spacer_h) 0;
|
|
154
|
-
}
|
|
155
|
-
`}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`
|
|
156
|
-
<div class="menu-container">
|
|
157
|
-
<button class="no-btn menu-header ${this.open?"open":""}" @click=${this.toggleMenu}>
|
|
158
|
-
${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
|
|
159
|
-
${this.collapsed?nothing:html`<span class="label">${this.label}</span>`}
|
|
160
|
-
${this.collapsed?nothing:html`<k-icon class="chevron" name="chevron" direction="${this.open?"down":"right"}"></k-icon>`}
|
|
161
|
-
</button>
|
|
162
|
-
<div class="menu-content ${this.open&&!this.collapsed?"open":""}">
|
|
163
|
-
<slot></slot>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
`}static styles=css`
|
|
167
|
-
:host {
|
|
168
|
-
display: block;
|
|
169
|
-
}
|
|
170
|
-
:host([collapsed][hide-when-collapsed]) {
|
|
171
|
-
display: none;
|
|
172
|
-
}
|
|
173
|
-
.menu-container {
|
|
174
|
-
margin: 0;
|
|
175
|
-
}
|
|
176
|
-
.menu-header {
|
|
177
|
-
display: flex !important;
|
|
178
|
-
align-items: center;
|
|
179
|
-
gap: var(--spacer_h);
|
|
180
|
-
padding-top: var(--spacer_h) !important;
|
|
181
|
-
padding-bottom: var(--spacer_h) !important;
|
|
182
|
-
padding-left: var(--spacer_h) !important;
|
|
183
|
-
padding-right: var(--spacer_h) !important;
|
|
184
|
-
color: var(--c_text);
|
|
185
|
-
background: transparent;
|
|
186
|
-
border: none;
|
|
187
|
-
border-radius: var(--radius);
|
|
188
|
-
margin: 0 var(--spacer_h);
|
|
189
|
-
width: calc(100% - var(--spacer));
|
|
190
|
-
cursor: pointer;
|
|
191
|
-
text-align: left;
|
|
192
|
-
white-space: nowrap;
|
|
193
|
-
transition: background var(--animation_ms);
|
|
194
|
-
}
|
|
195
|
-
:host([collapsed]) .menu-header {
|
|
196
|
-
width: auto;
|
|
197
|
-
}
|
|
198
|
-
.menu-header:hover {
|
|
199
|
-
background: var(--c_bg_hover);
|
|
200
|
-
}
|
|
201
|
-
k-icon {
|
|
202
|
-
flex-shrink: 0;
|
|
203
|
-
}
|
|
204
|
-
.label {
|
|
205
|
-
flex: 1;
|
|
206
|
-
min-width: 0;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
text-overflow: ellipsis;
|
|
209
|
-
}
|
|
210
|
-
.chevron {
|
|
211
|
-
transition: transform var(--animation_ms);
|
|
212
|
-
}
|
|
213
|
-
.menu-content {
|
|
214
|
-
max-height: 0;
|
|
215
|
-
overflow: hidden;
|
|
216
|
-
transition: max-height var(--animation_ms);
|
|
217
|
-
padding-left: calc(var(--spacer_h) * 2);
|
|
218
|
-
}
|
|
219
|
-
:host([collapsed]) .menu-content {
|
|
220
|
-
padding-left: 0;
|
|
221
|
-
}
|
|
222
|
-
.menu-content.open {
|
|
223
|
-
max-height: 500px;
|
|
224
|
-
}
|
|
225
|
-
::slotted(*) {
|
|
226
|
-
margin: 0.25rem 0;
|
|
227
|
-
}
|
|
228
|
-
`}class SidePanelSpacer extends ShadowComponent{render(){return html`<div class="spacer"></div>`}static styles=css`
|
|
229
|
-
:host {
|
|
230
|
-
display: block;
|
|
231
|
-
flex: 1;
|
|
232
|
-
}
|
|
233
|
-
.spacer {
|
|
234
|
-
height: 100%;
|
|
235
|
-
}
|
|
236
|
-
`}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;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { promptUser } from 'kempo-server/utils/cli';
|
|
4
|
-
|
|
5
|
-
const getFiles = async (dir, extensions) => {
|
|
6
|
-
const files = [];
|
|
7
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
8
|
-
for(const entry of entries){
|
|
9
|
-
const fullPath = path.join(dir, entry.name);
|
|
10
|
-
if(entry.isDirectory()){
|
|
11
|
-
files.push(...await getFiles(fullPath, extensions));
|
|
12
|
-
} else if(extensions.some(ext => entry.name.endsWith(ext))){
|
|
13
|
-
files.push(fullPath);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return files;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const rootDir = path.resolve('.');
|
|
20
|
-
const docsDir = path.resolve('./docs');
|
|
21
|
-
const srcDir = path.resolve('./src');
|
|
22
|
-
const cdnPattern = /https:\/\/cdn\.jsdelivr\.net\/npm\/kempo-css@[\d.]+\/dist\/kempo\.min\.css/g;
|
|
23
|
-
|
|
24
|
-
const newVersion = await promptUser('Enter the new kempo-css version (e.g., 1.3.1)');
|
|
25
|
-
if(!newVersion || !/^\d+\.\d+\.\d+$/.test(newVersion)){
|
|
26
|
-
console.error('Invalid version format. Please use semantic versioning (e.g., 1.3.1)');
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const newCdnUrl = `https://cdn.jsdelivr.net/npm/kempo-css@${newVersion}/dist/kempo.min.css`;
|
|
31
|
-
|
|
32
|
-
console.log(`\nUpdating kempo-css CDN references to version ${newVersion}...`);
|
|
33
|
-
|
|
34
|
-
const docsFiles = await getFiles(docsDir, ['.html']);
|
|
35
|
-
const srcFiles = await getFiles(srcDir, ['.js']);
|
|
36
|
-
const allFiles = [...docsFiles, ...srcFiles];
|
|
37
|
-
|
|
38
|
-
let updatedCount = 0;
|
|
39
|
-
for(const file of allFiles){
|
|
40
|
-
const content = await fs.readFile(file, 'utf-8');
|
|
41
|
-
if(cdnPattern.test(content)){
|
|
42
|
-
const newContent = content.replace(cdnPattern, newCdnUrl);
|
|
43
|
-
await fs.writeFile(file, newContent, 'utf-8');
|
|
44
|
-
console.log(`Updated: ${path.relative(rootDir, file)}`);
|
|
45
|
-
updatedCount++;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if(updatedCount === 0){
|
|
50
|
-
console.log('No files found with kempo-css CDN references.');
|
|
51
|
-
} else {
|
|
52
|
-
console.log(`\nDone! Updated ${updatedCount} file(s).`);
|
|
53
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import ShadowComponent from './ShadowComponent.js';
|
|
2
|
-
import { html, css } from '../lit-all.min.js';
|
|
3
|
-
import { boolTrueFalse } from '../utils/propConverters.js';
|
|
4
|
-
import './FocusCapture.js';
|
|
5
|
-
import './Icon.js';
|
|
6
|
-
|
|
7
|
-
export default class SideMenu extends ShadowComponent {
|
|
8
|
-
/* Properties */
|
|
9
|
-
static properties = {
|
|
10
|
-
opened: { type: Boolean, reflect: true },
|
|
11
|
-
overlayClose: { type: Boolean, reflect: true, attribute: 'overlay-close', converter: boolTrueFalse },
|
|
12
|
-
escClose: { type: Boolean, reflect: true, attribute: 'esc-close', converter: boolTrueFalse },
|
|
13
|
-
side: { type: String, reflect: true }
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
this.opened = false;
|
|
19
|
-
this.overlayClose = true;
|
|
20
|
-
this.escClose = true;
|
|
21
|
-
this.side = 'left';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
Event Handlers
|
|
26
|
-
*/
|
|
27
|
-
overlayClick = () => {
|
|
28
|
-
if(this.overlayClose) this.close();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
handleKeyDown = (e) => {
|
|
32
|
-
if(this.escClose && e.key === 'Escape') {
|
|
33
|
-
this.close();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
Lifecycle Callbacks
|
|
39
|
-
*/
|
|
40
|
-
updated(changedProperties) {
|
|
41
|
-
super.updated(changedProperties);
|
|
42
|
-
|
|
43
|
-
if(changedProperties.has('opened')) {
|
|
44
|
-
if(this.opened) {
|
|
45
|
-
document.body.classList.add('no-scroll');
|
|
46
|
-
document.addEventListener('keydown', this.handleKeyDown);
|
|
47
|
-
this.dispatchEvent(new CustomEvent('change', { detail: 'open' }));
|
|
48
|
-
this.dispatchEvent(new CustomEvent('open'));
|
|
49
|
-
} else {
|
|
50
|
-
document.body.classList.remove('no-scroll');
|
|
51
|
-
document.removeEventListener('keydown', this.handleKeyDown);
|
|
52
|
-
this.dispatchEvent(new CustomEvent('change', { detail: 'close' }));
|
|
53
|
-
this.dispatchEvent(new CustomEvent('close'));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/*
|
|
59
|
-
Methods
|
|
60
|
-
*/
|
|
61
|
-
open() {
|
|
62
|
-
this.opened = true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
close() {
|
|
66
|
-
this.opened = false;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
toggle() {
|
|
70
|
-
this.opened ? this.close() : this.open();
|
|
71
|
-
this.dispatchEvent(new CustomEvent('toggle'));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/*
|
|
75
|
-
Rendering
|
|
76
|
-
*/
|
|
77
|
-
render() {
|
|
78
|
-
return html`
|
|
79
|
-
<k-focus-capture>
|
|
80
|
-
<div id="container">
|
|
81
|
-
<button id="overlay" @click=${this.overlayClick}>
|
|
82
|
-
<div id="overlay-x"><k-icon name="close"></k-icon></div>
|
|
83
|
-
</button>
|
|
84
|
-
<div id="menu">
|
|
85
|
-
<slot></slot>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</k-focus-capture>
|
|
89
|
-
`;
|
|
90
|
-
}
|
|
91
|
-
static styles = css`
|
|
92
|
-
:host {
|
|
93
|
-
--bg: var(--c_bg);
|
|
94
|
-
--width: 20rem;
|
|
95
|
-
|
|
96
|
-
position: fixed;
|
|
97
|
-
top: 0;
|
|
98
|
-
left: 0;
|
|
99
|
-
width: 100vw;
|
|
100
|
-
max-width: 100%;
|
|
101
|
-
height: 100vh;
|
|
102
|
-
z-index: 100;
|
|
103
|
-
pointer-events: none;
|
|
104
|
-
}
|
|
105
|
-
:host([opened]) {
|
|
106
|
-
pointer-events: auto;
|
|
107
|
-
}
|
|
108
|
-
k-focus-capture {
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: 100%;
|
|
111
|
-
}
|
|
112
|
-
#container {
|
|
113
|
-
position: relative;
|
|
114
|
-
width: 100%;
|
|
115
|
-
height: 100%;
|
|
116
|
-
opacity: 0;
|
|
117
|
-
transition: opacity var(--animation_ms, 256ms);
|
|
118
|
-
}
|
|
119
|
-
:host([opened]) #container {
|
|
120
|
-
opacity: 1;
|
|
121
|
-
}
|
|
122
|
-
#overlay {
|
|
123
|
-
position: absolute;
|
|
124
|
-
width: 100%;
|
|
125
|
-
height: 100%;
|
|
126
|
-
left: 0;
|
|
127
|
-
top: 0;
|
|
128
|
-
background: var(--overlay, rgba(0, 0, 0, 0.5));
|
|
129
|
-
border: none;
|
|
130
|
-
padding: 0;
|
|
131
|
-
cursor: pointer;
|
|
132
|
-
z-index: 1;
|
|
133
|
-
}
|
|
134
|
-
#overlay-x {
|
|
135
|
-
position: absolute;
|
|
136
|
-
top: var(--spacer_h);
|
|
137
|
-
right: var(--spacer_h);
|
|
138
|
-
font-size: 1.75rem;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
color: var(--tc_light);
|
|
141
|
-
}
|
|
142
|
-
:host([overlay-close="false"]) #overlay-x {
|
|
143
|
-
display: none;
|
|
144
|
-
}
|
|
145
|
-
:host([overlay-close="false"]) #overlay {
|
|
146
|
-
cursor: default;
|
|
147
|
-
}
|
|
148
|
-
#menu {
|
|
149
|
-
position: absolute;
|
|
150
|
-
width: var(--width);
|
|
151
|
-
max-width: calc(100vw - 6rem);
|
|
152
|
-
height: 100vh;
|
|
153
|
-
overflow-y: auto;
|
|
154
|
-
left: calc(var(--width) * -1);
|
|
155
|
-
top: 0;
|
|
156
|
-
background: var(--bg);
|
|
157
|
-
transition: left var(--animation_ms, 256ms);
|
|
158
|
-
padding: var(--menu_padding, var(--spacer));
|
|
159
|
-
z-index: 2;
|
|
160
|
-
}
|
|
161
|
-
:host([opened]) #menu {
|
|
162
|
-
left: 0;
|
|
163
|
-
}
|
|
164
|
-
:host([side="right"]) #menu {
|
|
165
|
-
left: auto;
|
|
166
|
-
transition: right var(--animation_ms, 256ms);
|
|
167
|
-
right: calc(var(--width) * -1);
|
|
168
|
-
}
|
|
169
|
-
:host([opened][side="right"]) #menu {
|
|
170
|
-
right: 0;
|
|
171
|
-
}
|
|
172
|
-
:host([side="right"]) #overlay-x {
|
|
173
|
-
right: auto;
|
|
174
|
-
left: var(--spacer_h);
|
|
175
|
-
}
|
|
176
|
-
`;
|
|
177
|
-
}
|
|
178
|
-
window.customElements.define('k-side-menu', SideMenu);
|