create-kerf-component 4.4.0 → 4.5.0-beta.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 +33 -2
- package/catalog.js +773 -0
- package/component-catalog-v2.schema.json +246 -0
- package/component-metadata.schema.json +229 -0
- package/index.js +29 -3
- package/package.json +9 -2
- package/template/LICENSE +21 -0
- package/template/README.md +35 -9
- package/template/component-catalog-v2.json +142 -0
- package/template/kerf.components.json +71 -0
- package/template/package.json +11 -3
- package/template/src/counter.tsx +4 -1
- package/template/tsup.config.ts +10 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/brianwestphal/kerf/main/ui/ai/component-catalog-extension-v2.schema.json",
|
|
3
|
+
"schemaVersion": 2,
|
|
4
|
+
"package": "__PKG_NAME__",
|
|
5
|
+
"compatibility": {
|
|
6
|
+
"v1Catalog": "not-applicable",
|
|
7
|
+
"identity": "package:id"
|
|
8
|
+
},
|
|
9
|
+
"entries": [
|
|
10
|
+
{
|
|
11
|
+
"key": "__PKG_NAME__:counter",
|
|
12
|
+
"package": "__PKG_NAME__",
|
|
13
|
+
"id": "counter",
|
|
14
|
+
"name": "Counter",
|
|
15
|
+
"kind": "component",
|
|
16
|
+
"purpose": "Render a controlled counter with delegated increment and decrement actions.",
|
|
17
|
+
"publicExports": [
|
|
18
|
+
{
|
|
19
|
+
"name": "Counter",
|
|
20
|
+
"subpath": "."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "CounterProps",
|
|
24
|
+
"subpath": "."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "CounterState",
|
|
28
|
+
"subpath": "."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "CounterStore",
|
|
32
|
+
"subpath": "."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "createCounter",
|
|
36
|
+
"subpath": "."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "wireCounter",
|
|
40
|
+
"subpath": "."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Counter",
|
|
44
|
+
"subpath": "./counter"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "CounterProps",
|
|
48
|
+
"subpath": "./counter"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "CounterState",
|
|
52
|
+
"subpath": "./counter"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "CounterStore",
|
|
56
|
+
"subpath": "./counter"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "createCounter",
|
|
60
|
+
"subpath": "./counter"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "wireCounter",
|
|
64
|
+
"subpath": "./counter"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"sourceLinks": [
|
|
68
|
+
"README.md#use-it",
|
|
69
|
+
"src/counter.tsx"
|
|
70
|
+
],
|
|
71
|
+
"source": "src/counter.tsx",
|
|
72
|
+
"parents": {
|
|
73
|
+
"mode": "any",
|
|
74
|
+
"entries": []
|
|
75
|
+
},
|
|
76
|
+
"contexts": [
|
|
77
|
+
"controlled-counter"
|
|
78
|
+
],
|
|
79
|
+
"zones": [],
|
|
80
|
+
"children": {
|
|
81
|
+
"mode": "listed",
|
|
82
|
+
"concepts": [
|
|
83
|
+
"decrement-control",
|
|
84
|
+
"value",
|
|
85
|
+
"increment-control"
|
|
86
|
+
],
|
|
87
|
+
"requiredConcepts": [
|
|
88
|
+
"decrement-control",
|
|
89
|
+
"value",
|
|
90
|
+
"increment-control"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"state": [
|
|
94
|
+
{
|
|
95
|
+
"id": "count",
|
|
96
|
+
"owner": "controlled",
|
|
97
|
+
"required": true
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"wiring": {
|
|
101
|
+
"required": true,
|
|
102
|
+
"helpers": [
|
|
103
|
+
"wireCounter"
|
|
104
|
+
],
|
|
105
|
+
"obligations": [
|
|
106
|
+
"Retain and call the disposer returned by wireCounter."
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"responsive": {
|
|
110
|
+
"owner": "not-applicable",
|
|
111
|
+
"behaviors": []
|
|
112
|
+
},
|
|
113
|
+
"layout": {
|
|
114
|
+
"roles": [
|
|
115
|
+
"counter"
|
|
116
|
+
],
|
|
117
|
+
"geometry": {
|
|
118
|
+
"margin": "none",
|
|
119
|
+
"border": "none",
|
|
120
|
+
"padding": "none"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"accessibility": {
|
|
124
|
+
"obligations": [
|
|
125
|
+
"Keep increment and decrement controls named and expose the current count as output."
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"boundaries": {
|
|
129
|
+
"rootClass": "kerf-counter",
|
|
130
|
+
"publicClasses": [
|
|
131
|
+
"kerf-counter"
|
|
132
|
+
],
|
|
133
|
+
"publicTokens": []
|
|
134
|
+
},
|
|
135
|
+
"diagnostics": [],
|
|
136
|
+
"provenance": {
|
|
137
|
+
"selection": "README.md#use-it",
|
|
138
|
+
"composition": "README.md#the-rules-this-package-follows"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/brianwestphal/kerf/main/create-kerf-component/component-metadata.schema.json",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"v1Catalog": "not-applicable",
|
|
5
|
+
"components": [
|
|
6
|
+
{
|
|
7
|
+
"id": "counter",
|
|
8
|
+
"name": "Counter",
|
|
9
|
+
"kind": "component",
|
|
10
|
+
"purpose": "Render a controlled counter with delegated increment and decrement actions.",
|
|
11
|
+
"source": "src/counter.tsx",
|
|
12
|
+
"publicExports": [
|
|
13
|
+
{ "name": "Counter", "subpath": "." },
|
|
14
|
+
{ "name": "CounterProps", "subpath": "." },
|
|
15
|
+
{ "name": "CounterState", "subpath": "." },
|
|
16
|
+
{ "name": "CounterStore", "subpath": "." },
|
|
17
|
+
{ "name": "createCounter", "subpath": "." },
|
|
18
|
+
{ "name": "wireCounter", "subpath": "." },
|
|
19
|
+
{ "name": "Counter", "subpath": "./counter" },
|
|
20
|
+
{ "name": "CounterProps", "subpath": "./counter" },
|
|
21
|
+
{ "name": "CounterState", "subpath": "./counter" },
|
|
22
|
+
{ "name": "CounterStore", "subpath": "./counter" },
|
|
23
|
+
{ "name": "createCounter", "subpath": "./counter" },
|
|
24
|
+
{ "name": "wireCounter", "subpath": "./counter" }
|
|
25
|
+
],
|
|
26
|
+
"sourceLinks": ["README.md#use-it", "src/counter.tsx"],
|
|
27
|
+
"composition": {
|
|
28
|
+
"parents": { "mode": "any", "entries": [] },
|
|
29
|
+
"contexts": ["controlled-counter"],
|
|
30
|
+
"zones": [],
|
|
31
|
+
"children": {
|
|
32
|
+
"mode": "listed",
|
|
33
|
+
"concepts": ["decrement-control", "value", "increment-control"],
|
|
34
|
+
"requiredConcepts": [
|
|
35
|
+
"decrement-control",
|
|
36
|
+
"value",
|
|
37
|
+
"increment-control"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"state": [{ "id": "count", "owner": "controlled", "required": true }],
|
|
41
|
+
"wiring": {
|
|
42
|
+
"required": true,
|
|
43
|
+
"helpers": ["wireCounter"],
|
|
44
|
+
"obligations": [
|
|
45
|
+
"Retain and call the disposer returned by wireCounter."
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"responsive": { "owner": "not-applicable", "behaviors": [] },
|
|
49
|
+
"layout": {
|
|
50
|
+
"roles": ["counter"],
|
|
51
|
+
"geometry": { "margin": "none", "border": "none", "padding": "none" }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"boundaries": {
|
|
55
|
+
"rootClass": "kerf-counter",
|
|
56
|
+
"publicClasses": ["kerf-counter"],
|
|
57
|
+
"publicTokens": []
|
|
58
|
+
},
|
|
59
|
+
"accessibility": {
|
|
60
|
+
"obligations": [
|
|
61
|
+
"Keep increment and decrement controls named and expose the current count as output."
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"diagnostics": [],
|
|
65
|
+
"provenance": {
|
|
66
|
+
"selection": "README.md#use-it",
|
|
67
|
+
"composition": "README.md#the-rules-this-package-follows"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
package/template/package.json
CHANGED
|
@@ -16,19 +16,27 @@
|
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
19
|
+
"component-catalog-v2.json",
|
|
20
|
+
"kerf.components.json",
|
|
19
21
|
"README.md",
|
|
20
22
|
"LICENSE"
|
|
21
23
|
],
|
|
22
24
|
"scripts": {
|
|
23
25
|
"build": "tsup",
|
|
26
|
+
"catalog:generate": "node scripts/kerf-component-catalog.mjs --write",
|
|
27
|
+
"catalog:check": "node scripts/kerf-component-catalog.mjs --check",
|
|
24
28
|
"typecheck": "tsc --noEmit",
|
|
25
|
-
"prepublishOnly": "npm run build"
|
|
29
|
+
"prepublishOnly": "npm run catalog:check && npm run build"
|
|
30
|
+
},
|
|
31
|
+
"kerfComponentCatalog": {
|
|
32
|
+
"source": "./kerf.components.json",
|
|
33
|
+
"output": "./component-catalog-v2.json"
|
|
26
34
|
},
|
|
27
35
|
"peerDependencies": {
|
|
28
|
-
"kerfjs": "
|
|
36
|
+
"kerfjs": "^4.0.0-0"
|
|
29
37
|
},
|
|
30
38
|
"devDependencies": {
|
|
31
|
-
"kerfjs": "^
|
|
39
|
+
"kerfjs": "^4.5.0-beta.1",
|
|
32
40
|
"tsup": "^8",
|
|
33
41
|
"typescript": "^5 || ^6"
|
|
34
42
|
}
|
package/template/src/counter.tsx
CHANGED
|
@@ -61,7 +61,10 @@ export function Counter({ store, label = 'Count' }: CounterProps): SafeHtml {
|
|
|
61
61
|
* single listener survives every re-render. Returns the disposer `delegate()`
|
|
62
62
|
* hands back — call it when the host unmounts.
|
|
63
63
|
*/
|
|
64
|
-
export function wireCounter(
|
|
64
|
+
export function wireCounter(
|
|
65
|
+
root: HTMLElement,
|
|
66
|
+
store: CounterStore,
|
|
67
|
+
): () => void {
|
|
65
68
|
return delegate(root, 'click', '[data-action^="counter:"]', (_event, el) => {
|
|
66
69
|
const action = el.getAttribute('data-action');
|
|
67
70
|
if (action === 'counter:inc') store.actions.inc();
|
package/template/tsup.config.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { defineConfig } from 'tsup';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
|
|
4
|
+
// tsup injects `baseUrl` into declaration builds. TypeScript 6 reports that
|
|
5
|
+
// option as a TS 7 deprecation error, while TypeScript 5 rejects the future
|
|
6
|
+
// "6.0" threshold itself. Keep the workaround local to tsup and only enable it
|
|
7
|
+
// for the compiler generation that needs it.
|
|
8
|
+
const dtsCompilerOptions = ts.versionMajorMinor.startsWith('6.')
|
|
9
|
+
? { ignoreDeprecations: '6.0' }
|
|
10
|
+
: {};
|
|
2
11
|
|
|
3
12
|
// One entry per `exports` subpath. tsup emits ESM + `.d.ts` for each.
|
|
4
13
|
export default defineConfig({
|
|
5
14
|
entry: ['src/index.ts', 'src/counter.tsx'],
|
|
6
15
|
format: ['esm'],
|
|
7
|
-
dts:
|
|
16
|
+
dts: { compilerOptions: dtsCompilerOptions },
|
|
8
17
|
clean: true,
|
|
9
18
|
// THE hard rule: kerfjs must NEVER be bundled. A component returns `SafeHtml`
|
|
10
19
|
// and reads signals; both rely on the consumer and this package sharing ONE
|