kempo-css 1.0.8 → 1.0.10

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 (43) hide show
  1. package/.github/copilot-instructions.md +165 -0
  2. package/docs/.config.json +15 -0
  3. package/docs/components/ThemePropertyInput.js +47 -0
  4. package/docs/demo.inc.html +182 -0
  5. package/docs/docs.inc.html +823 -0
  6. package/{examples → docs/examples}/responsive-grid.html +3 -1
  7. package/docs/index.html +105 -0
  8. package/docs/init.js +4 -0
  9. package/docs/kempo-hljs.min.css +1 -0
  10. package/docs/kempo.min.css +1 -0
  11. package/docs/manifest.json +87 -0
  12. package/docs/nav.js +17 -0
  13. package/docs/theme-editor.html +847 -0
  14. package/package.json +8 -6
  15. package/{build.js → scripts/build.js} +75 -2
  16. package/src/components/ThemePropertyInput.js +154 -0
  17. package/src/kempo-hljs.css +125 -0
  18. package/src/kempo.css +1027 -0
  19. package/index.html +0 -1101
  20. package/src/ColorEditor.js +0 -26
  21. package/src/CssVar.js +0 -56
  22. package/src/lit-all.min.js +0 -120
  23. package/theme-builder.html +0 -286
  24. /package/{kempo-hljs.css → docs/kempo-hljs.css} +0 -0
  25. /package/{kempo.css → docs/kempo.css} +0 -0
  26. /package/{media → docs/media}/hexagon.svg +0 -0
  27. /package/{media → docs/media}/icon-maskable.png +0 -0
  28. /package/{media → docs/media}/icon.svg +0 -0
  29. /package/{media → docs/media}/icon128.png +0 -0
  30. /package/{media → docs/media}/icon144.png +0 -0
  31. /package/{media → docs/media}/icon152.png +0 -0
  32. /package/{media → docs/media}/icon16-48.svg +0 -0
  33. /package/{media → docs/media}/icon16.png +0 -0
  34. /package/{media → docs/media}/icon192.png +0 -0
  35. /package/{media → docs/media}/icon256.png +0 -0
  36. /package/{media → docs/media}/icon32.png +0 -0
  37. /package/{media → docs/media}/icon384.png +0 -0
  38. /package/{media → docs/media}/icon48.png +0 -0
  39. /package/{media → docs/media}/icon512.png +0 -0
  40. /package/{media → docs/media}/icon64.png +0 -0
  41. /package/{media → docs/media}/icon72.png +0 -0
  42. /package/{media → docs/media}/icon96.png +0 -0
  43. /package/{media → docs/media}/kempo-fist.svg +0 -0
@@ -0,0 +1,165 @@
1
+ # Code Contribution Guidelines
2
+
3
+ ## Project Structure
4
+
5
+ - All code should be in the `src/` directory, with the exception of npm scripts.
6
+ - All components should be in the `src/components/` directory.
7
+ - All utility function module files should be in the `src/utils/` directory.
8
+ - All documnentation should be in the `docs/` directory. This directory is used by GitHub as the "GitHub Pages", so all links need to be relative, and there will be a build script which copies all code to the `docs/` directory.
9
+
10
+ ## Coding Style Guidelines
11
+
12
+ ### Code Organization
13
+ Use multi-line comments to separate code into logical sections. Group related functionality together.
14
+ - Example: In Lit components, group lifecycle callbacks, event handlers, public methods, utility functions, and rendering logic separately.
15
+
16
+ ```javascript
17
+ /*
18
+ Lifecycle Callbacks
19
+ */
20
+ ```
21
+
22
+ ### Avoid single-use variables/functions
23
+ Avoid defining a variable or function to only use it once; inline the logic where needed. Some exceptions include:
24
+ - recursion
25
+ - scope encapsulation (IIFE)
26
+ - context changes
27
+
28
+ ### Minimal Comments, Empty Lines, and Spacing
29
+
30
+ Use minimal comments. Assume readers understand the language. Some exceptions include:
31
+ - complex logic
32
+ - anti-patterns
33
+ - code organization
34
+
35
+ Do not put random empty lines within code; put them where they make sense for readability, for example:
36
+ - above and below definitions for functions and classes.
37
+ - to help break up large sections of logic to be more readable. If there are 100 lines of code with no breaks, it gets hard to read.
38
+ - above multi-line comments to indicate the comment belongs to the code below
39
+
40
+ No empty lines in css.
41
+
42
+ End each file with an empty line.
43
+
44
+ End each line with a `;` when possible, even if it is optional.
45
+
46
+ Avoid unnecessary spacing, for example:
47
+ - after the word `if`
48
+ - within parentheses for conditional statements
49
+
50
+ ```javascript
51
+ let count = 1;
52
+
53
+ const incrementOdd = (n) => {
54
+ if(n % 2 !== 0){
55
+ return n++;
56
+ }
57
+ return n;
58
+ };
59
+
60
+ count = incrementOdd(count);
61
+ ```
62
+
63
+ ### Prefer Arrow Functions
64
+ Prefer the use of arrow functions when possible, especially for class methods to avoid binding. Use normal functions if needed for preserving the proper context.
65
+ - For very basic logic, use implicit returns
66
+ - If there is a single parameter, omit the parentheses.
67
+ ```javascript
68
+ const addOne = n => n + 1;
69
+ ```
70
+
71
+ ### Module Exports
72
+ - If a module has only one export, use the "default" export, not a named export.
73
+ - Do not declare the default export as a const or give it a name; just export the value.
74
+
75
+ ```javascript
76
+ export default (n) => n + 1;
77
+ ```
78
+ - If a module has multiple exports, use named exports and do not use a "default" export.
79
+
80
+ ### Code Reuse
81
+ Create utility functions for shared logic.
82
+ - If the shared logic is used in a single file, define a utility function in that file.
83
+ - If the shared logic is used in multiple files, create a utility function module file in `src/utils/`.
84
+
85
+ ### Naming
86
+ Do not prefix identifiers with underscores.
87
+ - Never use leading underscores (`_`) for variable, property, method, or function names.
88
+ - Use clear, descriptive names without prefixes.
89
+ - When true privacy is needed inside classes, prefer native JavaScript private fields (e.g., `#myField`) instead of simulated privacy via underscores.
90
+
91
+ ## Components
92
+
93
+ ### Base Component Architecture
94
+
95
+ The project provides three base components for different rendering strategies. Choose the appropriate base component and extend it:
96
+
97
+ #### ShadowComponent
98
+ For components that need shadow DOM encapsulation and automatic `/kempo.css` stylesheet injection.
99
+
100
+ ```javascript
101
+ import ShadowComponent from './ShadowComponent.js';
102
+
103
+ export default class MyComponent extends ShadowComponent {
104
+ render() {
105
+ return html`<p>Shadow DOM content with scoped styles</p>`;
106
+ }
107
+ }
108
+ ```
109
+
110
+ #### LightComponent
111
+ For components that render directly to light DOM without shadow DOM encapsulation.
112
+
113
+ ```javascript
114
+ import LightComponent from './LightComponent.js';
115
+
116
+ export default class MyComponent extends LightComponent {
117
+ renderLightDom() {
118
+ return html`<p>Light DOM content</p>`;
119
+ }
120
+ }
121
+ ```
122
+
123
+ #### HybridComponent
124
+ For components that need both shadow DOM (with automatic `/kempo.css`) and light DOM rendering.
125
+
126
+ ```javascript
127
+ import HybridComponent from './HybridComponent.js';
128
+
129
+ export default class MyComponent extends HybridComponent {
130
+ render() {
131
+ return html`<p>Shadow DOM content</p>`;
132
+ }
133
+
134
+ renderLightDom() {
135
+ return html`<p>Light DOM content alongside natural children</p>`;
136
+ }
137
+ }
138
+ ```
139
+
140
+ **Important:** Always call `super.updated()` when overriding the `updated()` method in LightComponent or HybridComponent to ensure proper rendering.
141
+
142
+ ### Component Architecture and Communication
143
+
144
+ - Use methods to cause actions; do not emit events to trigger logic. Events are for notifying that something already happened.
145
+ - Prefer `el.closest('ktf-test-framework')?.enqueueSuite({...})` over firing an `enqueue` event.
146
+
147
+ - Wrap dependent components inside a parent `ktf-test-framework` element. Children find it via `closest('ktf-test-framework')` and call its methods. The framework can query its subtree to orchestrate children.
148
+
149
+ - Avoid `window` globals and global custom events for coordination. If broadcast is needed, scope events to the framework element; reserve window events for global, non-visual concerns (e.g., settings changes).
150
+
151
+ ## Development Workflow
152
+
153
+ ### Local Development Server
154
+ - **DO NOT** start a development server - one is already running
155
+ - Default port: **8083**
156
+ - Base URL: `http://localhost:8083`
157
+ - Documentation URLs follow the directory/file structure in `docs/` (e.g., `docs/components/color-picker.html` → `http://localhost:8083/components/color-picker.html`)
158
+ - Use this server for all testing and verification
159
+
160
+ ### Testing and Verification
161
+ - **ALWAYS** verify changes using the live documentation on the running server
162
+ - Use Chrome DevTools Protocol (chrome-devtools-mcp) for interactive testing
163
+ - **DO NOT** create one-off test files or framework-less tests
164
+ - Test components in their natural documentation environment
165
+ - Validate both functionality and visual appearance
@@ -0,0 +1,15 @@
1
+ {
2
+ "customRoutes": {
3
+ "/kempo.min.css": "../src/kempo.css",
4
+ "/kempo-hljs.min.css": "../src/kempo-hljs.css"
5
+ },
6
+ "middleware": {
7
+ "logging": {
8
+ "enabled": true,
9
+ "includeResponseTime": true
10
+ },
11
+ "security": {
12
+ "enabled": false
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,47 @@
1
+ import ShadowComponent from"https://cdn.jsdelivr.net/npm/kempo-ui@0.0.36/dist/components/ShadowComponent.js";import{html,css}from"https://cdn.jsdelivr.net/npm/kempo-ui@0.0.36/dist/lit-all.min.js";export default class ThemePropertyInput extends ShadowComponent{static properties={propName:{type:String,attribute:"prop-name"},value:{type:String},availableProperties:{type:Array,attribute:"available-properties"},mode:{type:String},initialColor:{type:String,attribute:"initial-color"}};static styles=css`
2
+ :host {
3
+ display: block;
4
+ }
5
+ label {
6
+ display: block;
7
+ margin-bottom: 0.25rem;
8
+ }
9
+ .input-wrapper {
10
+ display: flex;
11
+ gap: 0.5rem;
12
+ align-items: center;
13
+ }
14
+ .mode-select {
15
+ width: 100px;
16
+ flex-shrink: 0;
17
+ }
18
+ .value-input {
19
+ flex: 1;
20
+ }
21
+ `;constructor(){super(),this.propName="",this.value="",this.availableProperties=[],this.mode="color",this.initialColor=""}connectedCallback(){super.connectedCallback(),this.value?.startsWith("var(")&&(this.mode="var")}firstUpdated(){this.attachColorPickerListener()}updated(e){super.updated?.(e),this.attachColorPickerListener()}attachColorPickerListener(){if("color"===this.mode){const e=this.shadowRoot?.querySelector("k-color-picker");e&&!e._hasChangeListener&&(e._hasChangeListener=!0,e.addEventListener("change",this.handleColorChange),e.addEventListener("input",this.handleColorChange))}}handleModeChange=e=>{this.mode=e.target.value,"var"!==this.mode||this.value.startsWith("var(")?"color"===this.mode&&this.value.startsWith("var(")&&(this.value=this.initialColor||"#000000"):this.value=this.availableProperties[0]?`var(${this.availableProperties[0]})`:"",this.emitChange()};handleVarInput=e=>{const t=e.target.value;this.value=t.startsWith("var(")?t:`var(${t})`,this.emitChange()};handleColorChange=e=>{this.value=e.target.value,this.emitChange()};emitChange(){this.dispatchEvent(new CustomEvent("value-change",{detail:{propName:this.propName,value:this.value},bubbles:!0,composed:!0}))}render(){const e=`${this.propName}-datalist`,t=this.value?.startsWith("var(")?this.value.slice(4,-1).trim():"";return html`
22
+ <label>${this.propName}</label>
23
+ <div class="input-wrapper">
24
+ <select class="mode-select" .value=${this.mode} @change=${this.handleModeChange}>
25
+ <option value="var">Var</option>
26
+ <option value="color">Color</option>
27
+ </select>
28
+
29
+ ${"var"===this.mode?html`
30
+ <input
31
+ class="value-input"
32
+ list=${e}
33
+ .value=${t}
34
+ @input=${this.handleVarInput}
35
+ placeholder="--property-name"
36
+ />
37
+ <datalist id=${e}>
38
+ ${this.availableProperties.map(e=>html`<option value=${e}></option>`)}
39
+ </datalist>
40
+ `:html`
41
+ <k-color-picker
42
+ class="value-input"
43
+ value=${this.value}
44
+ ></k-color-picker>
45
+ `}
46
+ </div>
47
+ `}}customElements.define("k-theme-property-input",ThemePropertyInput);
@@ -0,0 +1,182 @@
1
+ <h1>Colors</h1>
2
+ <h2>Background Colors</h2>
3
+ <div class="d-f gap fw mb">
4
+ <div class="p bg-alt">bg-alt</div>
5
+ <div class="p bg-inv">bg-inv</div>
6
+ <div class="p bg-primary tc-on_primary">bg-primary</div>
7
+ <div class="p bg-secondary tc-on_secondary">bg-secondary</div>
8
+ <div class="p bg-success tc-on_success">bg-success</div>
9
+ <div class="p bg-warning tc-on_warning">bg-warning</div>
10
+ <div class="p bg-danger tc-on_danger">bg-danger</div>
11
+ </div>
12
+ <h2>Text Colors</h2>
13
+ <div class="mb">
14
+ <p>Normal text color</p>
15
+ <p class="tc-muted">Muted text color</p>
16
+ <p class="tc-primary">Primary text color</p>
17
+ <p class="tc-secondary">Secondary text color</p>
18
+ <p class="tc-success">Success text color</p>
19
+ <p class="tc-warning">Warning text color</p>
20
+ <p class="tc-danger">Danger text color</p>
21
+ </div>
22
+ <div class="p bg-inv mb">
23
+ <p class="tc-inv">Inverse text color on inverse background</p>
24
+ </div>
25
+
26
+ <h1>Border Colors</h1>
27
+ <div class="d-f gap fw mb">
28
+ <div class="p b">Default border</div>
29
+ <div class="p b bg-inv" style="border-color: var(--c_border__inv);">Inverse border</div>
30
+ </div>
31
+
32
+ <h1>Link Colors</h1>
33
+ <p>
34
+ <a href="#">This is a link</a> - normal link styling
35
+ </p>
36
+ <div class="p bg-inv mb">
37
+ <a href="#" class="tc-link__inv">Inverse link</a> - for use on dark backgrounds
38
+ </div>
39
+
40
+ <h1>Buttons</h1>
41
+ <h2>Button Types</h2>
42
+ <div class="mb">
43
+ <button class="mb mr">button</button>
44
+ <input type="button" value="input" class="mb mr" />
45
+ <input type="submit" value="submit" class="mb mr" />
46
+ <a href="#" class="btn mb mr">a.btn</a>
47
+ </div>
48
+
49
+ <h2>Button Colors</h2>
50
+ <div class="mb">
51
+ <button class="mb mr">Default</button>
52
+ <button class="primary mb mr">Primary</button>
53
+ <button class="secondary mb mr">Secondary</button>
54
+ <button class="success mb mr">Success</button>
55
+ <button class="warning mb mr">Warning</button>
56
+ <button class="danger mb mr">Danger</button>
57
+ </div>
58
+
59
+ <h2>Button Sizes</h2>
60
+ <div class="d-f fw ai-center mb">
61
+ <button class="small mb mr">Small</button>
62
+ <button class="mb mr">Normal</button>
63
+ <button class="large mb mr">Large</button>
64
+ </div>
65
+
66
+ <h2>Button Groups</h2>
67
+ <div class="btn-grp mb">
68
+ <button>One</button>
69
+ <button>Two</button>
70
+ <button>Three</button>
71
+ </div>
72
+
73
+ <h1>Inputs</h1>
74
+ <div class="mb">
75
+ <label>Text Input</label>
76
+ <input type="text" placeholder="Enter text..." />
77
+ </div>
78
+ <div class="mb">
79
+ <label>Textarea</label>
80
+ <textarea placeholder="Enter longer text..."></textarea>
81
+ </div>
82
+ <div class="mb">
83
+ <label>Select</label>
84
+ <select>
85
+ <option>Option 1</option>
86
+ <option>Option 2</option>
87
+ <option>Option 3</option>
88
+ </select>
89
+ </div>
90
+ <div class="mb">
91
+ <input type="checkbox" id="demo-check1" />
92
+ <label for="demo-check1" class="checkbox">Checkbox 1</label>
93
+ <input type="checkbox" id="demo-check2" />
94
+ <label for="demo-check2" class="checkbox">Checkbox 2</label>
95
+ </div>
96
+ <div class="mb">
97
+ <input type="radio" name="demo-radios" id="demo-rad1" />
98
+ <label for="demo-rad1" class="checkbox">Radio 1</label>
99
+ <input type="radio" name="demo-radios" id="demo-rad2" />
100
+ <label for="demo-rad2" class="checkbox">Radio 2</label>
101
+ </div>
102
+
103
+ <h1>Focus & Effects</h1>
104
+ <p>Click or tab to inputs and buttons to see focus styles.</p>
105
+ <div class="mb">
106
+ <input type="text" class="mb mr" placeholder="Focus me..." />
107
+ <button class="mb mr">Focus me</button>
108
+ <button class="primary mb mr">Focus me</button>
109
+ </div>
110
+ <div class="p bg-alt drop-shadow mb" style="display: inline-block;">
111
+ Drop shadow effect
112
+ </div>
113
+
114
+ <h1>Typography</h1>
115
+ <h2>Headings</h2>
116
+ <h1>Heading 1</h1>
117
+ <h2>Heading 2</h2>
118
+ <h3>Heading 3</h3>
119
+ <h4>Heading 4</h4>
120
+ <h5>Heading 5</h5>
121
+ <h6>Heading 6</h6>
122
+
123
+ <h2>Paragraph Text</h2>
124
+ <p>This is a paragraph of text demonstrating the base font family and size. The quick brown fox jumps over the lazy dog. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
125
+ <p><small>This is small text.</small></p>
126
+ <p><strong>This is bold text.</strong></p>
127
+
128
+ <h2>Monospace</h2>
129
+ <p><code>Inline code uses the monospace font family.</code></p>
130
+ <pre>Preformatted text also uses monospace.</pre>
131
+
132
+ <h1>Spacing & Layout</h1>
133
+ <h2>Key</h2>
134
+ <ul class="mb">
135
+ <li><strong class="tc-success">Green</strong> = Padding</li>
136
+ <li><strong class="tc-warning">Orange</strong> = Margins</li>
137
+ </ul>
138
+
139
+ <h2>Padding</h2>
140
+ <div class="mb">
141
+ <div class="d-ib bg-success mr mb p"><div class="d-ib bg-alt pq">p</div></div>
142
+ <div class="d-ib bg-success mr mb pt"><div class="d-ib bg-alt pq">pt</div></div>
143
+ <div class="d-ib bg-success mr mb pr"><div class="d-ib bg-alt pq">pr</div></div>
144
+ <div class="d-ib bg-success mr mb pb"><div class="d-ib bg-alt pq">pb</div></div>
145
+ <div class="d-ib bg-success mr mb pl"><div class="d-ib bg-alt pq">pl</div></div>
146
+ <div class="d-ib bg-success mr mb px"><div class="d-ib bg-alt pq">px</div></div>
147
+ <div class="d-ib bg-success mr mb py"><div class="d-ib bg-alt pq">py</div></div>
148
+ </div>
149
+
150
+ <h2>Margins</h2>
151
+ <div class="mb">
152
+ <div class="d-ib bg-warning mr mb p"><div class="d-ib bg-alt pq">m</div></div>
153
+ <div class="d-ib bg-warning mr mb pt"><div class="d-ib bg-alt pq">mt</div></div>
154
+ <div class="d-ib bg-warning mr mb pr"><div class="d-ib bg-alt pq">mr</div></div>
155
+ <div class="d-ib bg-warning mr mb pb"><div class="d-ib bg-alt pq">mb</div></div>
156
+ <div class="d-ib bg-warning mr mb pl"><div class="d-ib bg-alt pq">ml</div></div>
157
+ <div class="d-ib bg-warning mr mb px"><div class="d-ib bg-alt pq">mx</div></div>
158
+ <div class="d-ib bg-warning mr mb py"><div class="d-ib bg-alt pq">my</div></div>
159
+ </div>
160
+
161
+ <h2>Container</h2>
162
+ <p>The <code>.container</code> class limits content width.</p>
163
+
164
+ <h1>Effects & Animation</h1>
165
+ <h2>Border Radius</h2>
166
+ <div class="mb">
167
+ <div class="d-ib bg-alt p mr mb b r">r</div>
168
+ <div class="d-ib bg-alt p mr mb b round">round</div>
169
+ </div>
170
+ <div class="mb">
171
+ <div class="d-ib bg-alt p mr mb b rtl">rtl</div>
172
+ <div class="d-ib bg-alt p mr mb b rtr">rtr</div>
173
+ <div class="d-ib bg-alt p mr mb b rbr">rbr</div>
174
+ <div class="d-ib bg-alt p mr mb b rbl">rbl</div>
175
+ </div>
176
+ <div class="mb">
177
+ <div class="d-ib bg-alt p mr mb b rt">rt</div>
178
+ <div class="d-ib bg-alt p mr mb b rb">rb</div>
179
+ <div class="d-ib bg-alt p mr mb b rl">rl</div>
180
+ <div class="d-ib bg-alt p mr mb b rr">rr</div>
181
+ </div>
182
+ <p><small><strong>Note:</strong> Add <code>0</code> suffix (e.g., <code>r0</code>, <code>rt0</code>) to cancel border radius.</small></p>