@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
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# @papit/create
|
|
2
|
+
|
|
3
|
+
Project and package scaffolding tool for @papit — opinionated, consistent, and designed to kickstart Papit-based projects with the correct structure from day one.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
This package is intended to be used **from within a workspace or an empty directory**. Simply run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create @papit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
to generate a fully initialized Papit package, component, or project with zero or minimal configuration.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
[](https://github.com/onkelhoy/papit/actions/workflows/pull-request.yml)
|
|
19
|
+
[](https://www.npmjs.com/package/@papit/create)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## CLI Flags
|
|
24
|
+
|
|
25
|
+
| Flag | Description |
|
|
26
|
+
| ------------- | ----------------------------------- |
|
|
27
|
+
| `--package` | Create a package |
|
|
28
|
+
| `--component` | Create a component |
|
|
29
|
+
| `--project` | Create a project |
|
|
30
|
+
| `--agree` | Skip confirmations |
|
|
31
|
+
| `--install` | Install dependencies after creation |
|
|
32
|
+
| `--commit` | Create an initial git commit |
|
|
33
|
+
| `--verbose` | Show detailed output |
|
|
34
|
+
|
|
35
|
+
If no creation flag is provided, an interactive selector is shown.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
`@papit/create` presents a set of creation options. Some of these can be invoked directly via flags, but the tool is primarily interactive and focused on generating boilerplate code based on predefined templates.
|
|
42
|
+
|
|
43
|
+
There are currently three built-in runners:
|
|
44
|
+
|
|
45
|
+
1. `package`
|
|
46
|
+
2. `component`
|
|
47
|
+
3. `project`
|
|
48
|
+
|
|
49
|
+
**Note:** You can provide your own custom runners by placing them in the `bin` folder. Each runner must have a `runner.js` file with a default export, for example:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
<workspace-root>/bin/runners/<custom>/runner.js
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A runner is a function that receives two arguments:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
info: {
|
|
59
|
+
root: string; // Location of the workspace root
|
|
60
|
+
local: string; // Location of the current package (if any)
|
|
61
|
+
script: string | null; // Location of the @papit/create script
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
args: {
|
|
67
|
+
flags: Record<string, string | string[] | true | undefined>,
|
|
68
|
+
values: string[]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For more details on the structure and behavior of these arguments, see the
|
|
73
|
+
|
|
74
|
+
- `@papit/arguments`
|
|
75
|
+
- `@papit/information`
|
|
76
|
+
package.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Package
|
|
81
|
+
|
|
82
|
+
The **package runner** creates a new package at a selected location (sometimes referred to as layers or folders).
|
|
83
|
+
|
|
84
|
+
A template is selected — either one of the built-in templates or a custom template located at:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
<workspace-root>/bin/runners/package/*
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The selected template folder is copied, and all files are processed to replace supported variables.
|
|
91
|
+
|
|
92
|
+
The generated license file automatically references the same license as the workspace root.
|
|
93
|
+
|
|
94
|
+
### Available variables
|
|
95
|
+
|
|
96
|
+
- `VARIABLE_NAME`
|
|
97
|
+
- `VARIABLE_FULL_NAME`
|
|
98
|
+
- `VARIABLE_DESCRIPTION`
|
|
99
|
+
- `VARIABLE_LAYER_FOLDER`
|
|
100
|
+
- `VARIABLE_PROJECTLICENSE`
|
|
101
|
+
- `VARIABLE_GITHUB_REPO`
|
|
102
|
+
- `VARIABLE_LOCAL_DESTINATION`
|
|
103
|
+
- `VARIABLE_CLASS_NAME`
|
|
104
|
+
- `VARIABLE_HTML_PREFIX`
|
|
105
|
+
- `VARIABLE_USER`
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Component
|
|
110
|
+
|
|
111
|
+
The **component runner** creates a new component and is intended for adding sub-components to an existing package.
|
|
112
|
+
|
|
113
|
+
Like the package runner, it copies a selected template from either built-ins or:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
<workspace-root>/bin/runners/component/*
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Folder handling
|
|
120
|
+
|
|
121
|
+
- **views**
|
|
122
|
+
If a `views` folder exists in both the current package and the template, a new subfolder named after the component is created inside the package’s `views` directory and populated with the template content.
|
|
123
|
+
|
|
124
|
+
- **src**
|
|
125
|
+
If the current package already has a `src` folder with files, the template’s `src` content is typically placed under:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
src/components/<component-name>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Available variables
|
|
132
|
+
|
|
133
|
+
- `VARIABLE_NAME`
|
|
134
|
+
- `VARIABLE_FULL_NAME`
|
|
135
|
+
- `VARIABLE_HTML_NAME`
|
|
136
|
+
- `VARIABLE_CLASS_NAME`
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Project
|
|
141
|
+
|
|
142
|
+
> ⚠️ This runner is currently under development.
|
|
143
|
+
|
|
144
|
+
The **project runner** creates a raw monorepo project at a selected destination.
|
|
145
|
+
|
|
146
|
+
As with packages and components, custom templates can be provided at:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
<workspace-root>/bin/runners/project/*
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
You will be prompted to select a template during creation.
|
|
153
|
+
|
|
154
|
+
Licensing is handled interactively. You may provide an existing license file or omit it, in which case a standard MIT license is used.
|
|
155
|
+
|
|
156
|
+
### Available variables
|
|
157
|
+
|
|
158
|
+
- `VARIABLE_NAME`
|
|
159
|
+
- `VARIABLE_DESCRIPTION`
|
|
160
|
+
- `VARIABLE_PROJECTLICENSE`
|
|
161
|
+
- `VARIABLE_USER`
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Contributing
|
|
166
|
+
|
|
167
|
+
Contributions are welcome.
|
|
168
|
+
|
|
169
|
+
Please ensure that:
|
|
170
|
+
|
|
171
|
+
- Templates follow Papit conventions
|
|
172
|
+
- Runners remain deterministic
|
|
173
|
+
- Interactive prompts stay minimal
|
|
174
|
+
|
|
175
|
+
Open a pull request when ready 🚀
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
Licensed under the **@Papit License 1.0**
|
|
182
|
+
Copyright (c) 2024 Henry Pap (@onkelhoy)
|
|
183
|
+
|
|
184
|
+
**Key points:**
|
|
185
|
+
|
|
186
|
+
- ✅ Free to use in commercial projects
|
|
187
|
+
- ✅ Free to modify and distribute
|
|
188
|
+
- ✅ Attribution required
|
|
189
|
+
- ❌ Cannot resell the component itself as a standalone product
|
|
190
|
+
|
|
191
|
+
See the [LICENSE](https://github.com/onkelhoy/papit/blob/main/LICENSE) file for full details.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Support
|
|
196
|
+
|
|
197
|
+
For issues, questions, or contributions, please visit the
|
|
198
|
+
[GitHub repository](https://github.com/onkelhoy/papit).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { }
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
<h1>VARIABLE_NAME test</h1>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</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,29 @@
|
|
|
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
|
+
|
|
20
|
+
<h1>VARIABLE_CLASS_NAME | experiment</h1>
|
|
21
|
+
<section>
|
|
22
|
+
<h2>Example</h2>
|
|
23
|
+
<pap-codeblock>
|
|
24
|
+
<VARIABLE_HTML_NAME></VARIABLE_HTML_NAME>
|
|
25
|
+
</pap-codeblock>
|
|
26
|
+
</section>
|
|
27
|
+
</body>
|
|
28
|
+
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { translator } from '@papit/translator';
|
|
2
|
+
import "@papit/codeblock";
|
|
3
|
+
|
|
4
|
+
// component
|
|
5
|
+
import 'VARIABLE_FULL_NAME';
|
|
6
|
+
|
|
7
|
+
window.onload = () => {
|
|
8
|
+
console.log('[demo]: window loaded');
|
|
9
|
+
|
|
10
|
+
translator.add({ id: "en", url: "/en.json" });
|
|
11
|
+
translator.change("en");
|
|
12
|
+
}
|
|
13
|
+
|
|
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 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,15 @@
|
|
|
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>PLACEHOLDER_NAME test</title>
|
|
7
|
+
|
|
8
|
+
<script type="module" defer src="main.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<canvas>Your browser does not support HTML canvas</canvas>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// core
|
|
2
|
+
import { Engine } from '@papit/game-engine';
|
|
3
|
+
import { InputEvents } from "@papit/game-input-events";
|
|
4
|
+
|
|
5
|
+
// component
|
|
6
|
+
import 'VARIABLE_FULL_NAME';
|
|
7
|
+
|
|
8
|
+
let engine, events;
|
|
9
|
+
|
|
10
|
+
window.onload = () => {
|
|
11
|
+
engine = new Engine("canvas");
|
|
12
|
+
events = new InputEvents(engine.canvas, { mouse: { pointerlock: false } });
|
|
13
|
+
|
|
14
|
+
events.on("mouse-up", handlemouseup);
|
|
15
|
+
events.on("mouse-down", handlemousedown);
|
|
16
|
+
events.on("mouse-move", handlemousemove);
|
|
17
|
+
|
|
18
|
+
engine.loop(draw); // cool function
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function draw() {
|
|
22
|
+
engine.ctx.clearRect(0, 0, engine.width, engine.height);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// event handlers
|
|
26
|
+
function handlemousemove(e) {
|
|
27
|
+
// mouse move
|
|
28
|
+
}
|
|
29
|
+
function handlemousedown(e) {
|
|
30
|
+
// mouse down
|
|
31
|
+
}
|
|
32
|
+
function handlemouseup(e) {
|
|
33
|
+
// mouse up
|
|
34
|
+
}
|
|
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,18 @@
|
|
|
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.skip("VARIABLE_FULL_NAME unit tests", () => {
|
|
15
|
+
test('available in DOM', async ({ page }) => {
|
|
16
|
+
// honestly dont know what to test
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
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 type="module" defer src="main.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
|
|
18
|
+
<body>
|
|
19
|
+
<canvas>Your browser does not support HTML canvas</canvas>
|
|
20
|
+
</body>
|
|
21
|
+
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// core
|
|
2
|
+
import { Engine } from '@papit/game-engine';
|
|
3
|
+
import { InputEvents } from "@papit/game-input-events";
|
|
4
|
+
|
|
5
|
+
// component
|
|
6
|
+
import 'VARIABLE_FULL_NAME';
|
|
7
|
+
|
|
8
|
+
let engine, events;
|
|
9
|
+
|
|
10
|
+
window.onload = () => {
|
|
11
|
+
engine = new Engine("canvas");
|
|
12
|
+
events = new InputEvents(engine.canvas, { mouse: { pointerlock: false } });
|
|
13
|
+
|
|
14
|
+
events.on("mouse-up", handlemouseup);
|
|
15
|
+
events.on("mouse-down", handlemousedown);
|
|
16
|
+
events.on("mouse-move", handlemousemove);
|
|
17
|
+
|
|
18
|
+
engine.loop(draw); // cool function
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function draw() {
|
|
22
|
+
engine.ctx.clearRect(0, 0, engine.width, engine.height);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// event handlers
|
|
26
|
+
function handlemousemove(e) {
|
|
27
|
+
// mouse move
|
|
28
|
+
}
|
|
29
|
+
function handlemousedown(e) {
|
|
30
|
+
// mouse down
|
|
31
|
+
}
|
|
32
|
+
function handlemouseup(e) {
|
|
33
|
+
// mouse up
|
|
34
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
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, #080808);
|
|
6
|
+
margin: 0;
|
|
7
|
+
background-image: radial-gradient(circle at 50% 50%, var(--background-darkest) 1px, transparent 0);
|
|
8
|
+
background-size: 20px 20px;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|