@w-lfpup/wctk 0.2.4 → 0.2.5
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 +9 -11
- package/dist/events.d.ts +2 -2
- package/package.json +1 -1
- package/src/events.ts +2 -4
- package/.github/workflows/browsers.macos.json +0 -51
- package/.github/workflows/browsers.ubuntu.json +0 -37
- package/.github/workflows/tests.yml +0 -27
- package/.prettierignore +0 -5
- package/.prettierrc +0 -5
- package/jr.json +0 -25
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Wctk-JS
|
|
2
2
|
|
|
3
|
-
An SSR friendly
|
|
3
|
+
An SSR friendly webcomponent tool kit without dependencies.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/w-lfpup/wctk-js/actions/workflows/tests.yml)
|
|
6
6
|
|
|
7
7
|
## About
|
|
8
8
|
|
|
9
|
-
The `wctk` is a collection of bare-metal facades over
|
|
9
|
+
The `wctk` is a collection of bare-metal facades over web apis. They provide the basics for
|
|
10
10
|
events, reactivity, and forms.
|
|
11
11
|
|
|
12
12
|
There are no base classes, decorators, or mixins.
|
|
@@ -20,25 +20,23 @@ Four (4) controllers help developers:
|
|
|
20
20
|
- listen for [events](./docs/events.md)
|
|
21
21
|
- cache selector [queries](./docs/query_selector.md)
|
|
22
22
|
|
|
23
|
-
Controllers are flexible and not restricted to webcomponents. The can be used on any `HTMLElement`.
|
|
24
|
-
|
|
25
23
|
## Install
|
|
26
24
|
|
|
27
|
-
Install
|
|
25
|
+
Install from npm:
|
|
28
26
|
|
|
29
27
|
```bash
|
|
30
|
-
npm install --save-dev
|
|
28
|
+
npm install --save-dev @w-lfpup/wctk
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
Install
|
|
31
|
+
Install directly from github:
|
|
34
32
|
|
|
35
33
|
```bash
|
|
36
|
-
npm install --save-dev
|
|
34
|
+
npm install --save-dev https://github.com/w-lfpup/wctk-js/
|
|
37
35
|
```
|
|
38
36
|
|
|
39
37
|
## Create a webcomponent
|
|
40
38
|
|
|
41
|
-
Add a `Wc` controller to a custom element
|
|
39
|
+
Add a `Wc` controller to a custom element.
|
|
42
40
|
|
|
43
41
|
```ts
|
|
44
42
|
import { Wc } from "wctk";
|
|
@@ -67,7 +65,7 @@ If you know vanilla javascript and the DOM you are good to go.
|
|
|
67
65
|
The `wctk` is designed with SSR and declarative shadow dom in mind. Developers
|
|
68
66
|
can pick up what the HTML threw down with interactive SSR friendly webcomponents.
|
|
69
67
|
|
|
70
|
-
Templating is not provided.
|
|
68
|
+
Templating is not provided. But before you reach for lit-html or vue or react, consider the majority
|
|
71
69
|
of components only have a few moving pieces. Do you really need templating for that custom button?
|
|
72
70
|
Do you really need a flux-pattern for that checkbox?
|
|
73
71
|
|
package/dist/events.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface GenericEventListenerObject<E extends Event> extends EventListenerObjec
|
|
|
5
5
|
handleEvent(object: E): void;
|
|
6
6
|
}
|
|
7
7
|
type GenericCallbacks<E extends Event> = GenericEventListener<E> | GenericEventListenerObject<E>;
|
|
8
|
-
type EventMaps = DocumentEventMap &
|
|
8
|
+
type EventMaps = DocumentEventMap & HTMLElementEventMap;
|
|
9
9
|
type ListenerMap = Partial<{
|
|
10
10
|
[Property in keyof EventMaps]: GenericCallbacks<EventMaps[Property]>;
|
|
11
11
|
}> | Record<string, EventListenerOrEventListenerObject>;
|
|
@@ -14,8 +14,8 @@ interface EventElementInterface {
|
|
|
14
14
|
removeEventListener: Element["removeEventListener"];
|
|
15
15
|
}
|
|
16
16
|
export interface EventParamsInterface {
|
|
17
|
-
listeners: ListenerMap;
|
|
18
17
|
connected?: boolean;
|
|
18
|
+
listeners: ListenerMap;
|
|
19
19
|
target: EventElementInterface;
|
|
20
20
|
}
|
|
21
21
|
export interface EventsInterface {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "dist/mod.js",
|
|
5
5
|
"description": "A bare-metal webcomponent toolkit",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.5",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"prepare": "npm run build",
|
|
10
10
|
"build": "npm run build:src && npm run build:tests && npm run build:examples",
|
package/src/events.ts
CHANGED
|
@@ -12,9 +12,7 @@ type GenericCallbacks<E extends Event> =
|
|
|
12
12
|
| GenericEventListener<E>
|
|
13
13
|
| GenericEventListenerObject<E>;
|
|
14
14
|
|
|
15
|
-
type EventMaps = DocumentEventMap &
|
|
16
|
-
GlobalEventHandlersEventMap &
|
|
17
|
-
ElementEventMap;
|
|
15
|
+
type EventMaps = DocumentEventMap & HTMLElementEventMap;
|
|
18
16
|
|
|
19
17
|
type ListenerMap =
|
|
20
18
|
| Partial<{
|
|
@@ -32,8 +30,8 @@ interface EventElementInterface {
|
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
export interface EventParamsInterface {
|
|
35
|
-
listeners: ListenerMap;
|
|
36
33
|
connected?: boolean;
|
|
34
|
+
listeners: ListenerMap;
|
|
37
35
|
target: EventElementInterface;
|
|
38
36
|
}
|
|
39
37
|
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jackrabbit_url": "http://127.0.0.1:4000",
|
|
3
|
-
"runAsynchronusly": false,
|
|
4
|
-
"webdrivers": [
|
|
5
|
-
{
|
|
6
|
-
"command": "safaridriver -p 4001",
|
|
7
|
-
"title": "Safari",
|
|
8
|
-
"timeout_ms": 30000,
|
|
9
|
-
"webdriver_url": "http://localhost:4001"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"command": "$GECKOWEBDRIVER/geckodriver -p 4001",
|
|
13
|
-
"title": "Firefox",
|
|
14
|
-
"timeout_ms": 30000,
|
|
15
|
-
"webdriver_url": "http://127.0.0.1:4001",
|
|
16
|
-
"capabilities": {
|
|
17
|
-
"alwaysMatch": {
|
|
18
|
-
"moz:firefoxOptions": {
|
|
19
|
-
"args": ["-headless"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"command": "$CHROMEWEBDRIVER/chromedriver --port=4001",
|
|
26
|
-
"title": "Chrome",
|
|
27
|
-
"timeout_ms": 30000,
|
|
28
|
-
"webdriver_url": "http://localhost:4001",
|
|
29
|
-
"capabilities": {
|
|
30
|
-
"alwaysMatch": {
|
|
31
|
-
"goog:chromeOptions": {
|
|
32
|
-
"args": ["--headless"]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"command": "$EDGEWEBDRIVER/msedgedriver --port=4001",
|
|
39
|
-
"title": "Edge",
|
|
40
|
-
"timeout_ms": 30000,
|
|
41
|
-
"webdriver_url": "http://localhost:4001",
|
|
42
|
-
"capabilities": {
|
|
43
|
-
"alwaysMatch": {
|
|
44
|
-
"ms:edgeOptions": {
|
|
45
|
-
"args": ["--headless"]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jackrabbit_url": "http://127.0.0.1:4000",
|
|
3
|
-
"runAsynchronusly": false,
|
|
4
|
-
"webdrivers": [
|
|
5
|
-
{
|
|
6
|
-
"title": "Firefox",
|
|
7
|
-
"command": "$GECKOWEBDRIVER/geckodriver -p 4001",
|
|
8
|
-
"timeout_ms": 30000,
|
|
9
|
-
"webdriver_url": "http://localhost:4001",
|
|
10
|
-
"capabilities": {
|
|
11
|
-
"alwaysMatch": {
|
|
12
|
-
"moz:firefoxOptions": {
|
|
13
|
-
"args": ["-headless"]
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"title": "Chrome",
|
|
20
|
-
"command": "$CHROMEWEBDRIVER/chromedriver --port=4005",
|
|
21
|
-
"timeout_ms": 30000,
|
|
22
|
-
"webdriver_url": "http://localhost:4005",
|
|
23
|
-
"capabilities": {
|
|
24
|
-
"alwaysMatch": {
|
|
25
|
-
"goog:chromeOptions": {
|
|
26
|
-
"args": [
|
|
27
|
-
"--headless",
|
|
28
|
-
"--disbale-gpu",
|
|
29
|
-
"--disable-dev-shm-usage",
|
|
30
|
-
"--start-maximized"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: ["main"]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: ["main"]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build_and_test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v6
|
|
14
|
-
- uses: actions/setup-node@v6
|
|
15
|
-
- name: Install
|
|
16
|
-
run: npm ci
|
|
17
|
-
- name: Test browsers
|
|
18
|
-
run: npx jackrabbit_webdriver .github/workflows/browsers.ubuntu.json tests/dist/mod.js
|
|
19
|
-
build_and_test_macos:
|
|
20
|
-
runs-on: macos-latest
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v6
|
|
23
|
-
- uses: actions/setup-node@v6
|
|
24
|
-
- name: Install
|
|
25
|
-
run: npm ci
|
|
26
|
-
- name: Test browsers
|
|
27
|
-
run: npx jackrabbit_webdriver .github/workflows/browsers.macos.json tests/dist/mod.js
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/jr.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jackrabbit_url": "http://localhost:4000",
|
|
3
|
-
"run_asynchronously": false,
|
|
4
|
-
"webdrivers": [
|
|
5
|
-
{
|
|
6
|
-
"command": "safaridriver -p 4001",
|
|
7
|
-
"title": "Safari",
|
|
8
|
-
"timeout_ms": 20000,
|
|
9
|
-
"webdriver_url": "http://localhost:4001"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"command": "geckodriver -p 4001",
|
|
13
|
-
"title": "Firefox",
|
|
14
|
-
"timeout_ms": 20000,
|
|
15
|
-
"webdriver_url": "http://localhost:4001",
|
|
16
|
-
"capabilities": {
|
|
17
|
-
"alwaysMatch": {
|
|
18
|
-
"moz:firefoxOptions": {
|
|
19
|
-
"args": ["-headless"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|