kempo-ui 0.0.2 → 0.0.3
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/copilot-instructions.md +149 -149
- package/.github/workflows/publish-npm.yml +44 -44
- package/CONTRIBUTING.md +149 -149
- package/README.md +0 -0
- package/dist/kempo-vars.css +0 -0
- package/dist/src/components/FocusCapture.js +7 -0
- package/dist/src/components/Icon.js +10 -0
- package/dist/src/components/Import.js +1 -0
- package/dist/src/components/ShadowComponent.js +1 -0
- package/dist/src/components/SideMenu.js +97 -0
- package/dist/src/lit-all.min.js +120 -0
- package/docs/components/accordion.html +122 -0
- package/docs/components/card.html +91 -0
- package/docs/components/component.html +90 -0
- package/docs/components/content-slider.html +193 -0
- package/docs/components/dialog.html +245 -0
- package/docs/components/directory-viewer.html +90 -0
- package/docs/components/focus-capture.html +68 -0
- package/docs/components/icon.html +161 -0
- package/docs/components/import.html +78 -0
- package/docs/components/lazy-component.html +84 -0
- package/docs/components/reactive-component.html +69 -0
- package/docs/components/reactive-lazy-component.html +69 -0
- package/docs/components/resize.html +152 -0
- package/docs/components/search.html +102 -0
- package/docs/components/show-more.html +123 -0
- package/docs/components/side-menu.html +168 -0
- package/docs/components/sortable.html +96 -0
- package/docs/components/split.html +126 -0
- package/docs/components/table.html +312 -0
- package/docs/components/tableControls.html +77 -0
- package/docs/components/tableCustomFields.html +113 -0
- package/docs/components/tableFetchRecords.html +114 -0
- package/docs/components/tableFieldSortHide.html +75 -0
- package/docs/components/tablePagination.html +100 -0
- package/docs/components/tableRecordEditing.html +144 -0
- package/docs/components/tableRecordFiltering.html +75 -0
- package/docs/components/tableRecordHiding.html +80 -0
- package/docs/components/tableRecordSearching.html +75 -0
- package/docs/components/tableRecordSelection.html +75 -0
- package/docs/components/tableRowControls.html +78 -0
- package/docs/components/tableSorting.html +73 -0
- package/docs/components/tabs.html +163 -0
- package/docs/components/tags.html +94 -0
- package/docs/components/theme-switcher.html +129 -0
- package/docs/components/timestamp.html +86 -0
- package/docs/components/toast.html +328 -0
- package/docs/components/toggle.html +155 -0
- package/docs/dev.config.json +20 -0
- package/docs/icons/add.svg +1 -0
- package/docs/icons/arrow-back.svg +1 -0
- package/docs/icons/arrow-down-double.svg +1 -0
- package/docs/icons/arrow-down.svg +1 -0
- package/docs/icons/arrow-forward.svg +1 -0
- package/docs/icons/arrow-up-double.svg +1 -0
- package/docs/icons/arrow-up.svg +1 -0
- package/docs/icons/cards.svg +1 -0
- package/docs/icons/check.svg +1 -0
- package/docs/icons/chevron-left.svg +1 -0
- package/docs/icons/chevron-right.svg +1 -0
- package/docs/icons/close.svg +2 -0
- package/docs/icons/compare.svg +1 -0
- package/docs/icons/delete.svg +1 -0
- package/docs/icons/drag-handle.svg +1 -0
- package/docs/icons/drawing2.svg +124 -0
- package/docs/icons/edit.svg +1 -0
- package/docs/icons/error.svg +1 -0
- package/docs/icons/export-file.svg +1 -0
- package/docs/icons/file-text.svg +1 -0
- package/docs/icons/file.svg +1 -0
- package/docs/icons/filter-off.svg +1 -0
- package/docs/icons/filter.svg +1 -0
- package/docs/icons/first.svg +1 -0
- package/docs/icons/folder-clear.svg +1 -0
- package/docs/icons/folder-create.svg +1 -0
- package/docs/icons/folder-open.svg +1 -0
- package/docs/icons/folder.svg +1 -0
- package/docs/icons/hide.svg +1 -0
- package/docs/icons/image.svg +1 -0
- package/docs/icons/label-add.svg +1 -0
- package/docs/icons/label.svg +1 -0
- package/docs/icons/last.svg +1 -0
- package/docs/icons/menu.svg +1 -0
- package/docs/icons/mode-auto.svg +1 -0
- package/docs/icons/mode-dark.svg +1 -0
- package/docs/icons/mode-light.svg +1 -0
- package/docs/icons/open-in-browser.svg +1 -0
- package/docs/icons/pause.svg +1 -0
- package/docs/icons/play.svg +1 -0
- package/docs/icons/refresh.svg +1 -0
- package/docs/icons/remove.svg +1 -0
- package/docs/icons/save.svg +1 -0
- package/docs/icons/search.svg +1 -0
- package/docs/icons/settings.svg +1 -0
- package/docs/icons/show.svg +1 -0
- package/docs/icons/storage.svg +1 -0
- package/docs/icons/table-visibility.svg +1 -0
- package/docs/icons/tag.svg +1 -0
- package/docs/icons/tools.svg +1 -0
- package/docs/icons/trash-x.svg +1 -0
- package/docs/icons/warning.svg +1 -0
- package/docs/index.html +28 -21
- package/docs/nav.inc.html +73 -0
- package/docs/nav.inc.js +4 -0
- package/{config/production.json → docs/prod.config.json} +20 -16
- package/docs/src/components/FocusCapture.js +7 -0
- package/docs/src/components/HybridComponent.js +1 -0
- package/docs/src/components/Icon.js +10 -0
- package/docs/src/components/Import.js +1 -0
- package/docs/src/components/LightComponent.js +1 -0
- package/docs/src/components/ShadowComponent.js +1 -0
- package/docs/src/components/SideMenu.js +97 -0
- package/docs/src/lit-all.min.js +120 -0
- package/docs/src/utils/cli.js +1 -0
- package/docs/src/utils/fs-utils.js +1 -0
- package/docs/styles.css +6 -0
- package/icons/add.svg +1 -0
- package/icons/arrow-back.svg +1 -0
- package/icons/arrow-down-double.svg +1 -0
- package/icons/arrow-down.svg +1 -0
- package/icons/arrow-forward.svg +1 -0
- package/icons/arrow-up-double.svg +1 -0
- package/icons/arrow-up.svg +1 -0
- package/icons/cards.svg +1 -0
- package/icons/check.svg +1 -0
- package/icons/chevron-left.svg +1 -0
- package/icons/chevron-right.svg +1 -0
- package/icons/close.svg +2 -0
- package/icons/compare.svg +1 -0
- package/icons/delete.svg +1 -0
- package/icons/drag-handle.svg +1 -0
- package/icons/drawing2.svg +124 -0
- package/icons/edit.svg +1 -0
- package/icons/error.svg +1 -0
- package/icons/export-file.svg +1 -0
- package/icons/file-text.svg +1 -0
- package/icons/file.svg +1 -0
- package/icons/filter-off.svg +1 -0
- package/icons/filter.svg +1 -0
- package/icons/first.svg +1 -0
- package/icons/folder-clear.svg +1 -0
- package/icons/folder-create.svg +1 -0
- package/icons/folder-open.svg +1 -0
- package/icons/folder.svg +1 -0
- package/icons/hide.svg +1 -0
- package/icons/image.svg +1 -0
- package/icons/label-add.svg +1 -0
- package/icons/label.svg +1 -0
- package/icons/last.svg +1 -0
- package/icons/menu.svg +1 -0
- package/icons/mode-auto.svg +1 -0
- package/icons/mode-dark.svg +1 -0
- package/icons/mode-light.svg +1 -0
- package/icons/open-in-browser.svg +1 -0
- package/icons/pause.svg +1 -0
- package/icons/play.svg +1 -0
- package/icons/refresh.svg +1 -0
- package/icons/remove.svg +1 -0
- package/icons/save.svg +1 -0
- package/icons/search.svg +1 -0
- package/icons/settings.svg +1 -0
- package/icons/show.svg +1 -0
- package/icons/storage.svg +1 -0
- package/icons/table-visibility.svg +1 -0
- package/icons/tag.svg +1 -0
- package/icons/tools.svg +1 -0
- package/icons/trash-x.svg +1 -0
- package/icons/warning.svg +1 -0
- package/package.json +2 -2
- package/scripts/build.js +109 -138
- package/scripts/docs.js +60 -60
- package/src/components/Card.js +66 -0
- package/src/components/FocusCapture.js +23 -0
- package/src/components/HybridComponent.js +40 -40
- package/src/components/Icon.js +155 -0
- package/src/components/Import.js +104 -0
- package/src/components/LightComponent.js +32 -32
- package/src/components/ShadowComponent.js +30 -17
- package/src/components/SideMenu.js +167 -0
- package/src/components/ThemeSwitcher.js +108 -0
- package/src/kempo-hljs.css +146 -0
- package/src/utils/cli.js +43 -43
- package/src/utils/fs-utils.js +41 -41
- package/src/utils/propConverters.js +11 -0
- package/tests/HybridComponent.browser-test.js +214 -214
- package/tests/LightComponent.browser-test.js +169 -169
- package/tests/ShadowComponent.browser-test.js +130 -130
- package/config/development.json +0 -14
- package/docs/components/ShadowComponent.js +0 -1
- /package/{docs → dist/src}/components/HybridComponent.js +0 -0
- /package/{docs → dist/src}/components/LightComponent.js +0 -0
- /package/{docs → dist/src}/utils/cli.js +0 -0
- /package/{docs → dist/src}/utils/fs-utils.js +0 -0
|
@@ -1,149 +1,149 @@
|
|
|
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).
|
|
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).
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
name: Publish Package to npmjs
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches:
|
|
7
|
-
- main
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
publish:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
permissions:
|
|
14
|
-
contents: write
|
|
15
|
-
id-token: write # enables npm provenance
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
with:
|
|
19
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
|
|
21
|
-
# Setup Node and create an .npmrc that uses the token from NODE_AUTH_TOKEN
|
|
22
|
-
- uses: actions/setup-node@v4
|
|
23
|
-
with:
|
|
24
|
-
node-version: '20.x'
|
|
25
|
-
registry-url: 'https://registry.npmjs.org'
|
|
26
|
-
|
|
27
|
-
- run: npm ci
|
|
28
|
-
|
|
29
|
-
# Auto-increment patch version, commit, and push
|
|
30
|
-
- name: Bump patch version
|
|
31
|
-
run: |
|
|
32
|
-
git config --global user.name "github-actions"
|
|
33
|
-
git config --global user.email "github-actions@github.com"
|
|
34
|
-
npm version patch --no-git-tag-version
|
|
35
|
-
git add package.json package-lock.json || true
|
|
36
|
-
git commit -m "ci: bump patch version [skip ci]" || echo "No changes to commit"
|
|
37
|
-
git push origin HEAD:main || echo "No changes to push"
|
|
38
|
-
env:
|
|
39
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
-
|
|
41
|
-
# If your package is public and scoped (e.g., @scope/name), keep --access public.
|
|
42
|
-
# For unscoped public packages, you can omit --access.
|
|
43
|
-
- run: npm publish --provenance --access public
|
|
44
|
-
env:
|
|
1
|
+
|
|
2
|
+
name: Publish Package to npmjs
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write # enables npm provenance
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
|
|
21
|
+
# Setup Node and create an .npmrc that uses the token from NODE_AUTH_TOKEN
|
|
22
|
+
- uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: '20.x'
|
|
25
|
+
registry-url: 'https://registry.npmjs.org'
|
|
26
|
+
|
|
27
|
+
- run: npm ci
|
|
28
|
+
|
|
29
|
+
# Auto-increment patch version, commit, and push
|
|
30
|
+
- name: Bump patch version
|
|
31
|
+
run: |
|
|
32
|
+
git config --global user.name "github-actions"
|
|
33
|
+
git config --global user.email "github-actions@github.com"
|
|
34
|
+
npm version patch --no-git-tag-version
|
|
35
|
+
git add package.json package-lock.json || true
|
|
36
|
+
git commit -m "ci: bump patch version [skip ci]" || echo "No changes to commit"
|
|
37
|
+
git push origin HEAD:main || echo "No changes to push"
|
|
38
|
+
env:
|
|
39
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
+
|
|
41
|
+
# If your package is public and scoped (e.g., @scope/name), keep --access public.
|
|
42
|
+
# For unscoped public packages, you can omit --access.
|
|
43
|
+
- run: npm publish --provenance --access public
|
|
44
|
+
env:
|
|
45
45
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|