@papit/create 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -0
- package/asset/component-templates/browser/src/component.ts +7 -0
- package/asset/component-templates/browser/src/index.ts +3 -0
- package/asset/component-templates/browser/src/types.ts +1 -0
- package/asset/component-templates/browser/tests/index.html +15 -0
- package/asset/component-templates/browser/tests/main.js +1 -0
- package/asset/component-templates/browser/tests/public/icons/.gitkeep +0 -0
- package/asset/component-templates/browser/tests/public/images/.gitkeep +0 -0
- package/asset/component-templates/browser/tests/public/translations/en.json +7 -0
- package/asset/component-templates/browser/tests/snapshot.test.ts +12 -0
- package/asset/component-templates/browser/tests/unit.test.ts +69 -0
- package/asset/component-templates/browser/views/index.html +29 -0
- package/asset/component-templates/browser/views/main.js +13 -0
- package/asset/component-templates/browser/views/public/icons/.gitkeep +0 -0
- package/asset/component-templates/browser/views/public/images/.gitkeep +0 -0
- package/asset/component-templates/browser/views/public/translations/en.json +7 -0
- package/asset/component-templates/browser/views/style.css +28 -0
- package/asset/component-templates/game/src/component.ts +7 -0
- package/asset/component-templates/game/src/index.ts +3 -0
- package/asset/component-templates/game/src/types.ts +1 -0
- package/asset/component-templates/game/tests/index.html +15 -0
- package/asset/component-templates/game/tests/main.js +34 -0
- package/asset/component-templates/game/tests/public/models/.gitkeep +0 -0
- package/asset/component-templates/game/tests/public/textures/.gitkeep +0 -0
- package/asset/component-templates/game/tests/public/translations/en.json +7 -0
- package/asset/component-templates/game/tests/snapshot.test.ts +12 -0
- package/asset/component-templates/game/tests/unit.test.ts +18 -0
- package/asset/component-templates/game/views/index.html +22 -0
- package/asset/component-templates/game/views/main.js +34 -0
- package/asset/component-templates/game/views/public/models/.gitkeep +0 -0
- package/asset/component-templates/game/views/public/textures/.gitkeep +0 -0
- package/asset/component-templates/game/views/public/translations/en.json +7 -0
- package/asset/component-templates/game/views/style.css +9 -0
- package/asset/component-templates/node/src/component.ts +7 -0
- package/asset/component-templates/node/src/index.ts +3 -0
- package/asset/component-templates/node/src/types.ts +1 -0
- package/asset/component-templates/node/tests/unit.test.js +10 -0
- package/asset/component-templates/theme/lib/theme.css +80 -0
- package/asset/component-templates/theme/src/theme.css +205 -0
- package/asset/component-templates/theme/tests/index.html +15 -0
- package/asset/component-templates/theme/tests/main.js +1 -0
- package/asset/component-templates/theme/tests/public/icons/.gitkeep +0 -0
- package/asset/component-templates/theme/tests/public/images/.gitkeep +0 -0
- package/asset/component-templates/theme/tests/public/translations/en.json +7 -0
- package/asset/component-templates/theme/tests/snapshot.test.ts +12 -0
- package/asset/component-templates/theme/tests/unit.test.ts +67 -0
- package/asset/component-templates/theme/views/index.html +110 -0
- package/asset/component-templates/theme/views/main.js +14 -0
- package/asset/component-templates/theme/views/style.css +241 -0
- package/asset/component-templates/web-component/src/component.ts +31 -0
- package/asset/component-templates/web-component/src/index.ts +15 -0
- package/asset/component-templates/web-component/src/style.css +4 -0
- package/asset/component-templates/web-component/src/types.ts +1 -0
- package/asset/component-templates/web-component/tests/index.html +17 -0
- package/asset/component-templates/web-component/tests/main.js +1 -0
- package/asset/component-templates/web-component/tests/public/icons/.gitkeep +0 -0
- package/asset/component-templates/web-component/tests/public/images/.gitkeep +0 -0
- package/asset/component-templates/web-component/tests/public/translations/en.json +7 -0
- package/asset/component-templates/web-component/tests/snapshot.test.ts +12 -0
- package/asset/component-templates/web-component/tests/unit.test.ts +69 -0
- package/asset/component-templates/web-component/views/index.html +28 -0
- package/asset/component-templates/web-component/views/main.js +14 -0
- package/asset/component-templates/web-component/views/public/icons/.gitkeep +0 -0
- package/asset/component-templates/web-component/views/public/images/.gitkeep +0 -0
- package/asset/component-templates/web-component/views/public/translations/en.json +7 -0
- package/asset/component-templates/web-component/views/style.css +28 -0
- package/asset/package-templates/browser/README.md +44 -0
- package/asset/package-templates/browser/asset/icons/.gitkeep +0 -0
- package/asset/package-templates/browser/asset/images/.gitkeep +0 -0
- package/asset/package-templates/browser/asset/translations/en.json +7 -0
- package/asset/package-templates/browser/package.json +76 -0
- package/asset/package-templates/browser/src/.gitkeep +0 -0
- package/asset/package-templates/browser/tests/playwright.config.ts +81 -0
- package/asset/package-templates/browser/tests/tsconfig.json +9 -0
- package/asset/package-templates/browser/tsconfig.json +41 -0
- package/asset/package-templates/browser/tsconfig.prod.json +9 -0
- package/asset/package-templates/game/README.md +40 -0
- package/asset/package-templates/game/asset/models/.gitkeep +0 -0
- package/asset/package-templates/game/asset/textures/.gitkeep +0 -0
- package/asset/package-templates/game/asset/translations/en.json +7 -0
- package/asset/package-templates/game/package.json +78 -0
- package/asset/package-templates/game/src/.gitkeep +0 -0
- package/asset/package-templates/game/tests/playwright.config.ts +80 -0
- package/asset/package-templates/game/tests/tsconfig.json +9 -0
- package/asset/package-templates/game/tsconfig.json +41 -0
- package/asset/package-templates/game/tsconfig.prod.json +9 -0
- package/asset/package-templates/game/views/.gitkeep +0 -0
- package/asset/package-templates/game/views/tsconfig.json +9 -0
- package/asset/package-templates/node/README.md +40 -0
- package/asset/package-templates/node/asset/translations/en.json +7 -0
- package/asset/package-templates/node/package.json +70 -0
- package/asset/package-templates/node/src/.gitkeep +0 -0
- package/asset/package-templates/node/tests/.gitkeep +0 -0
- package/asset/package-templates/node/tests/tsconfig.json +9 -0
- package/asset/package-templates/node/tsconfig.json +38 -0
- package/asset/package-templates/node/tsconfig.prod.json +9 -0
- package/asset/package-templates/theme/README.md +44 -0
- package/asset/package-templates/theme/asset/icons/.gitkeep +0 -0
- package/asset/package-templates/theme/asset/images/.gitkeep +0 -0
- package/asset/package-templates/theme/asset/translations/en.json +7 -0
- package/asset/package-templates/theme/package.json +70 -0
- package/asset/package-templates/theme/tests/playwright.config.ts +81 -0
- package/asset/package-templates/theme/tsconfig.json +39 -0
- package/asset/package-templates/theme/tsconfig.prod.json +9 -0
- package/asset/package-templates/web-component/README.md +55 -0
- package/asset/package-templates/web-component/asset/icons/.gitkeep +0 -0
- package/asset/package-templates/web-component/asset/images/.gitkeep +0 -0
- package/asset/package-templates/web-component/asset/translations/en.json +7 -0
- package/asset/package-templates/web-component/package.json +79 -0
- package/asset/package-templates/web-component/src/global-css.d.ts +4 -0
- package/asset/package-templates/web-component/tests/playwright.config.ts +81 -0
- package/asset/package-templates/web-component/tests/tsconfig.json +9 -0
- package/asset/package-templates/web-component/tsconfig.json +42 -0
- package/asset/package-templates/web-component/tsconfig.prod.json +9 -0
- package/asset/package-templates/web-component/views/.gitkeep +0 -0
- package/asset/package-templates/web-component/views/tsconfig.json +9 -0
- package/asset/project-template/.eslintrc +26 -0
- package/asset/project-template/.gitattributes +1 -0
- package/asset/project-template/.github/ISSUE_TEMPLATE/CONTRIBUTING.md +101 -0
- package/asset/project-template/.github/workflows/build-cache.yml +30 -0
- package/asset/project-template/.github/workflows/initialise.yml +49 -0
- package/asset/project-template/.github/workflows/publish.yml +59 -0
- package/asset/project-template/.github/workflows/pull-request.yml +73 -0
- package/asset/project-template/.github/workflows/update-snapshots.yml +80 -0
- package/asset/project-template/.nvmrc +1 -0
- package/asset/project-template/.vscode/settings.json +19 -0
- package/asset/project-template/.vscode/web-components.code-workspace +25 -0
- package/asset/project-template/README.md +45 -0
- package/asset/project-template/bin/clean.mjs +28 -0
- package/asset/project-template/bin/runners/example-runner/runner.js +4 -0
- package/asset/project-template/bin/spawn-command.mjs +31 -0
- package/asset/project-template/bin/test.mjs +94 -0
- package/asset/project-template/package.json +42 -0
- package/asset/project-template/packages/atoms/.gitkeep +0 -0
- package/asset/project-template/packages/molecules/.gitkeep +0 -0
- package/asset/project-template/packages/organisms/.gitkeep +0 -0
- package/asset/project-template/packages/pages/.gitkeep +0 -0
- package/asset/project-template/packages/templates/.gitkeep +0 -0
- package/lib/bundle.d.ts +1 -0
- package/lib/bundle.js +4 -0
- package/package.json +72 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
@import "@papit/theme";
|
|
2
|
+
@import "VARIABLE_FULL_NAME";
|
|
3
|
+
|
|
4
|
+
*,
|
|
5
|
+
*::before,
|
|
6
|
+
*::after {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body,
|
|
13
|
+
div.theme-opposite {
|
|
14
|
+
font-family: monospace;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
background: var(--background, light-dark(oklch(96% 0 0), oklch(17% 0 0)));
|
|
17
|
+
color: var(--foreground);
|
|
18
|
+
padding: var(--space-8);
|
|
19
|
+
display: grid;
|
|
20
|
+
gap: var(--space-16);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* ── Section ── */
|
|
24
|
+
|
|
25
|
+
.showcase-section {
|
|
26
|
+
display: grid;
|
|
27
|
+
gap: var(--space-4);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.showcase-title {
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
font-weight: normal;
|
|
33
|
+
letter-spacing: 0.2em;
|
|
34
|
+
text-transform: uppercase;
|
|
35
|
+
color: var(--tertiary);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* ── Swatches ── */
|
|
39
|
+
|
|
40
|
+
.swatch-row {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
gap: var(--space-2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.swatch {
|
|
47
|
+
width: 96px;
|
|
48
|
+
border-radius: var(--radius-small);
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
border: 1px solid var(--background-dark, light-dark(oklch(90% 0 0), oklch(12% 0 0)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.swatch::before {
|
|
54
|
+
content: '';
|
|
55
|
+
display: block;
|
|
56
|
+
height: 56px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.swatch-label {
|
|
60
|
+
display: block;
|
|
61
|
+
padding: var(--space-1) var(--space-2);
|
|
62
|
+
background: var(--background-light, light-dark(oklch(99% 0 0), oklch(22% 0 0)));
|
|
63
|
+
color: var(--tertiary);
|
|
64
|
+
font-size: 10px;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* brand */
|
|
71
|
+
.swatch--primary::before {
|
|
72
|
+
background: var(--primary);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.swatch--secondary::before {
|
|
76
|
+
background: var(--secondary);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.swatch--tertiary::before {
|
|
80
|
+
background: var(--tertiary);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* semantic */
|
|
84
|
+
.swatch--success::before {
|
|
85
|
+
background: var(--success);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.swatch--info::before {
|
|
89
|
+
background: var(--info);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.swatch--warning::before {
|
|
93
|
+
background: var(--warning);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.swatch--error::before {
|
|
97
|
+
background: var(--error);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* backgrounds */
|
|
101
|
+
|
|
102
|
+
.swatch--background-light::before {
|
|
103
|
+
background: var(--background-light, light-dark(oklch(99% 0 0), oklch(22% 0 0)));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.swatch--background::before {
|
|
107
|
+
background: var(--background, light-dark(oklch(96% 0 0), oklch(17% 0 0)));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.swatch--background-dark::before {
|
|
111
|
+
background: var(--background-dark, light-dark(oklch(90% 0 0), oklch(12% 0 0)));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/* foregrounds */
|
|
116
|
+
|
|
117
|
+
.swatch--foreground-light::before {
|
|
118
|
+
background: var(--foreground-light);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.swatch--foreground::before {
|
|
122
|
+
background: var(--foreground);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.swatch--foreground-dark::before {
|
|
126
|
+
background: var(--foreground-dark);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ── Spacing ── */
|
|
130
|
+
|
|
131
|
+
.space-list {
|
|
132
|
+
display: grid;
|
|
133
|
+
gap: var(--space-2);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.space-item {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: var(--space-4);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.space-item::before {
|
|
143
|
+
content: '';
|
|
144
|
+
display: block;
|
|
145
|
+
height: var(--space-4);
|
|
146
|
+
background: var(--primary);
|
|
147
|
+
border-radius: var(--radius-small);
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.space-label {
|
|
152
|
+
color: var(--tertiary);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.space-item--1::before {
|
|
156
|
+
width: var(--space-1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.space-item--2::before {
|
|
160
|
+
width: var(--space-2);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.space-item--3::before {
|
|
164
|
+
width: var(--space-3);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.space-item--4::before {
|
|
168
|
+
width: var(--space-4);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.space-item--5::before {
|
|
172
|
+
width: var(--space-5);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.space-item--6::before {
|
|
176
|
+
width: var(--space-6);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.space-item--7::before {
|
|
180
|
+
width: var(--space-7);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.space-item--8::before {
|
|
184
|
+
width: var(--space-8);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.space-item--9::before {
|
|
188
|
+
width: var(--space-9);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.space-item--10::before {
|
|
192
|
+
width: var(--space-10);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.space-item--12::before {
|
|
196
|
+
width: var(--space-12);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.space-item--16::before {
|
|
200
|
+
width: var(--space-16);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.space-item--20::before {
|
|
204
|
+
width: var(--space-20);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ── Radius ── */
|
|
208
|
+
|
|
209
|
+
.swatch-row:has(.radius-item) {
|
|
210
|
+
align-items: flex-end;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.radius-item {
|
|
214
|
+
width: 96px;
|
|
215
|
+
height: 96px;
|
|
216
|
+
background: var(--background-dark, light-dark(oklch(90% 0 0), oklch(12% 0 0)));
|
|
217
|
+
display: flex;
|
|
218
|
+
align-items: flex-end;
|
|
219
|
+
padding: var(--space-2);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.radius-label {
|
|
223
|
+
color: var(--tertiary);
|
|
224
|
+
font-size: 10px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.radius-item--small {
|
|
228
|
+
border-radius: var(--radius-small);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.radius-item--medium {
|
|
232
|
+
border-radius: var(--radius-medium);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.radius-item--large {
|
|
236
|
+
border-radius: var(--radius-large);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.radius-item--full {
|
|
240
|
+
border-radius: var(--radius-full);
|
|
241
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// import statements
|
|
2
|
+
// system
|
|
3
|
+
import { CustomElement, html, property } from "@papit/web-component";
|
|
4
|
+
|
|
5
|
+
// local
|
|
6
|
+
import sheet from "./style.css" assert { type: "css" };
|
|
7
|
+
import { ClickEvent } from "./types";
|
|
8
|
+
|
|
9
|
+
export class VARIABLE_CLASS_NAME extends CustomElement {
|
|
10
|
+
static sheet = sheet;
|
|
11
|
+
|
|
12
|
+
// properties
|
|
13
|
+
@property({ type: Boolean }) foo: boolean = false;
|
|
14
|
+
|
|
15
|
+
// event handlers
|
|
16
|
+
private handleclick = () => {
|
|
17
|
+
this.dispatchEvent(new CustomEvent<ClickEvent>("main-click", { detail: { timestamp: performance.now() } }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return html`
|
|
22
|
+
<p @click="${this.handleclick}">Llama Trauma Baby Mama</p>
|
|
23
|
+
`
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
"VARIABLE_HTML_NAME": VARIABLE_CLASS_NAME;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VARIABLE_CLASS_NAME } from './component.js';
|
|
2
|
+
|
|
3
|
+
// export
|
|
4
|
+
export * from "./component";
|
|
5
|
+
export * from "./types";
|
|
6
|
+
|
|
7
|
+
// Register the element with the browser
|
|
8
|
+
|
|
9
|
+
if (!window.customElements) {
|
|
10
|
+
throw new Error('Custom Elements not supported');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!window.customElements.get('VARIABLE_HTML_NAME')) {
|
|
14
|
+
window.customElements.define('VARIABLE_HTML_NAME', VARIABLE_CLASS_NAME);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ClickEvent = { timestamp: number };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<html lang="en">
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>VARIABLE_NAME test</title>
|
|
7
|
+
|
|
8
|
+
<script type="module" defer src="main.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<VARIABLE_HTML_NAME data-testid="base-target">
|
|
13
|
+
fallback
|
|
14
|
+
</VARIABLE_HTML_NAME>
|
|
15
|
+
</body>
|
|
16
|
+
|
|
17
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'VARIABLE_FULL_NAME';
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
test.beforeEach(async ({ page }) => {
|
|
4
|
+
// Navigate to your test page
|
|
5
|
+
await page.goto('tests/VARIABLE_NAME/');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test.describe("VARIABLE_FULL_NAME visual regression", () => {
|
|
9
|
+
test('default snapshot', async ({ page }) => {
|
|
10
|
+
await expect(page).toHaveScreenshot();
|
|
11
|
+
});
|
|
12
|
+
})
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
test.beforeEach(async ({ page }) => {
|
|
4
|
+
// Navigate to your test page
|
|
5
|
+
await page.goto('tests/VARIABLE_NAME/');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
EVENT_EMITTED: any;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
test.describe("VARIABLE_FULL_NAME unit tests", () => {
|
|
15
|
+
test('available in DOM', async ({ page }) => {
|
|
16
|
+
// Interact with your component and make assertions
|
|
17
|
+
const component = await page.$('VARIABLE_HTML_NAME');
|
|
18
|
+
expect(component).not.toBeNull();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test.describe.skip("helpers", () => {
|
|
23
|
+
test("wait for event : enter press", async ({ page }) => {
|
|
24
|
+
const target = page.getByTestId("base-target");
|
|
25
|
+
await page.evaluate(() => {
|
|
26
|
+
window.EVENT_EMITTED = null;
|
|
27
|
+
const target = document.querySelector<HTMLElement>("*[data-testid='base-target']");
|
|
28
|
+
if (!target) return;
|
|
29
|
+
|
|
30
|
+
target.addEventListener("event-name", () => {
|
|
31
|
+
window.EVENT_EMITTED = true;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
target.focus();
|
|
35
|
+
target.dispatchEvent(new KeyboardEvent("up", { key: "Enter" }));
|
|
36
|
+
// enter is tricky to capture so we make sure to dispatch inside evalute
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await target.focus();
|
|
40
|
+
await target.press("Enter");
|
|
41
|
+
|
|
42
|
+
expect(await page.evaluate(() => window.EVENT_EMITTED)).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("should submit a form", async ({ page }) => {
|
|
46
|
+
// NOTE this requires in main.js you have form.onsubmit = (e) => { e.preventDefault() }
|
|
47
|
+
// setting this in evaluate did not work.. (maybe with page.evalute)
|
|
48
|
+
|
|
49
|
+
await page.getByTestId("a").fill("hello");
|
|
50
|
+
await page.getByTestId("submit").click();
|
|
51
|
+
|
|
52
|
+
const results = await page.evaluate(() => {
|
|
53
|
+
const form = document.querySelector("form");
|
|
54
|
+
if (!form) return null;
|
|
55
|
+
|
|
56
|
+
const formdata = new FormData(form);
|
|
57
|
+
return {
|
|
58
|
+
a: formdata.get("a"),
|
|
59
|
+
b: formdata.get("b"),
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
expect(results).not.toBe(null);
|
|
64
|
+
expect(results).toMatchObject({
|
|
65
|
+
a: "hello",
|
|
66
|
+
b: "value",
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<title>VARIABLE_CLASS_NAME | experiment</title>
|
|
9
|
+
|
|
10
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
11
|
+
|
|
12
|
+
<!-- Styles -->
|
|
13
|
+
<link rel="stylesheet" href="style.css" />
|
|
14
|
+
|
|
15
|
+
<script defer type="module" src="main.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
|
|
18
|
+
<body>
|
|
19
|
+
<h1>VARIABLE_CLASS_NAME | experiment</h1>
|
|
20
|
+
<section>
|
|
21
|
+
<h2>Example</h2>
|
|
22
|
+
<pap-codeblock>
|
|
23
|
+
<VARIABLE_HTML_NAME></VARIABLE_HTML_NAME>
|
|
24
|
+
</pap-codeblock>
|
|
25
|
+
</section>
|
|
26
|
+
</body>
|
|
27
|
+
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// core
|
|
2
|
+
import { translator } from '@papit/translator';
|
|
3
|
+
import "@papit/codeblock";
|
|
4
|
+
|
|
5
|
+
// component
|
|
6
|
+
import 'VARIABLE_FULL_NAME';
|
|
7
|
+
|
|
8
|
+
window.onload = () => {
|
|
9
|
+
console.log('[demo]: window loaded');
|
|
10
|
+
|
|
11
|
+
translator.add({ id: "en", url: "/en.json" });
|
|
12
|
+
translator.change("en");
|
|
13
|
+
}
|
|
14
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import "@papit/theme";
|
|
2
|
+
|
|
3
|
+
body {
|
|
4
|
+
background-color: var(--background, light-dark(oklch(96% 0 0), oklch(17% 0 0)));
|
|
5
|
+
color: var(--text, light-dark(oklch(10% 0 0), oklch(95% 0 0)));
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--space-4, 16px);
|
|
9
|
+
|
|
10
|
+
padding-block: 5rem;
|
|
11
|
+
|
|
12
|
+
h1 {
|
|
13
|
+
max-width: 1200px;
|
|
14
|
+
margin-inline: auto;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
section {
|
|
19
|
+
max-width: 1200px;
|
|
20
|
+
margin-inline: auto;
|
|
21
|
+
width: 100%;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
padding: 1rem 2rem;
|
|
24
|
+
border-radius: 1rem;
|
|
25
|
+
border: 1px solid light-dark(oklch(88% 0.01 264), oklch(28% 0.015 264));
|
|
26
|
+
background-color: var(--background-light, light-dark(oklch(99% 0 0), oklch(22% 0 0)));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# VARIABLE_FULL_NAME
|
|
2
|
+
|
|
3
|
+
VARIABLE_DESCRIPTION
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
[](VARIABLE_GITHUB_REPO/actions/workflows/pull-request.yml)
|
|
11
|
+
[](https://www.npmjs.com/package/VARIABLE_FULL_NAME)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install VARIABLE_FULL_NAME
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Contributing
|
|
22
|
+
|
|
23
|
+
Contributions are welcome! Please follow the development guidelines above and ensure all tests pass before submitting a pull request.
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
Licensed under the @Papit License 1.0 - Copyright (c) 2024 Henry Pap (@onkelhoy)
|
|
28
|
+
|
|
29
|
+
**Key points:**
|
|
30
|
+
|
|
31
|
+
- ✅ Free to use in commercial projects
|
|
32
|
+
- ✅ Free to modify and distribute
|
|
33
|
+
- ✅ Attribution required
|
|
34
|
+
- ❌ Cannot resell the component itself as a standalone product
|
|
35
|
+
|
|
36
|
+
See the [LICENSE](https://github.com/onkelhoy/papit/blob/main/LICENSE) file for full details.
|
|
37
|
+
|
|
38
|
+
## Related Components
|
|
39
|
+
|
|
40
|
+
- [@papit/web-component](https://github.com/onkelhoy/papit/tree/main/packages/system/core): Core utilities, decorators, and base component class
|
|
41
|
+
|
|
42
|
+
## Support
|
|
43
|
+
|
|
44
|
+
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/onkelhoy/papit).
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "VARIABLE_FULL_NAME",
|
|
3
|
+
"description": "VARIABLE_DESCRIPTION",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"papit",
|
|
6
|
+
"web-component",
|
|
7
|
+
"typescript",
|
|
8
|
+
"VARIABLE_NAME"
|
|
9
|
+
],
|
|
10
|
+
"version": "0.0.1",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npx @papit/build -- --error --ancestors",
|
|
13
|
+
"watch": "tsc -w",
|
|
14
|
+
"start": "npx @papit/server --info --live",
|
|
15
|
+
"test": "npx playwright test -c tests/playwright.config.ts $@",
|
|
16
|
+
"preversion": "papit-version",
|
|
17
|
+
"postversion": "papit-version",
|
|
18
|
+
"component": "npm create @papit -- --component",
|
|
19
|
+
"test:update-snapshots": "npx playwright test --update-snapshots -c tests/playwright.config.ts",
|
|
20
|
+
"test:chrome": "npm test -- --project=chromium"
|
|
21
|
+
},
|
|
22
|
+
"main": "./lib/bundle.js",
|
|
23
|
+
"types": "./lib/bundle.d.ts",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"files": [
|
|
26
|
+
"asset/",
|
|
27
|
+
"lib/"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./lib/bundle.js",
|
|
32
|
+
"types": "./lib/bundle.d.ts"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"author": "VARIABLE_USER",
|
|
36
|
+
"private": false,
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"registry": "https://registry.npmjs.org/"
|
|
40
|
+
},
|
|
41
|
+
"license": "VARIABLE_PROJECTLICENSE",
|
|
42
|
+
"homepage": "VARIABLE_GITHUB_REPO/tree/main/VARIABLE_LOCAL_DESTINATION",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "VARIABLE_GITHUB_REPO/issues"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "VARIABLE_GITHUB_REPO.git",
|
|
49
|
+
"directory": "VARIABLE_LOCAL_DESTINATION"
|
|
50
|
+
},
|
|
51
|
+
"sideEffects": true,
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@playwright/test": "1.58.0",
|
|
58
|
+
"playwright": "1.58.0",
|
|
59
|
+
"typescript": "5.9.3",
|
|
60
|
+
"@papit/theme": "*",
|
|
61
|
+
"@papit/translator": "*",
|
|
62
|
+
"@papit/codeblock": "*"
|
|
63
|
+
},
|
|
64
|
+
"browserslist": [
|
|
65
|
+
"defaults",
|
|
66
|
+
"not IE 11",
|
|
67
|
+
"not dead"
|
|
68
|
+
],
|
|
69
|
+
"papit": {
|
|
70
|
+
"publish": true,
|
|
71
|
+
"type": "browser",
|
|
72
|
+
"main": "VARIABLE_NAME",
|
|
73
|
+
"htmlprefix": "VARIABLE_HTML_PREFIX",
|
|
74
|
+
"components": {}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
File without changes
|