create-wirejs-app 2.0.12 → 2.0.13
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
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-wirejs-app",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"description": "Initializes a wirejs package.",
|
|
5
5
|
"author": "Jon Wire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"bin.js",
|
|
19
19
|
"package.json",
|
|
20
|
+
"README.md",
|
|
20
21
|
"templates/*"
|
|
21
22
|
]
|
|
22
|
-
}
|
|
23
|
+
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"dompurify": "^3.2.3",
|
|
12
12
|
"marked": "^15.0.6",
|
|
13
13
|
"wirejs-dom": "^1.0.38",
|
|
14
|
-
"wirejs-resources": "^0.1.
|
|
14
|
+
"wirejs-resources": "^0.1.12"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"wirejs-scripts": "^3.0.
|
|
17
|
+
"wirejs-scripts": "^3.0.10",
|
|
18
18
|
"typescript": "^5.7.3"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
"start": "wirejs-scripts start",
|
|
24
24
|
"build": "wirejs-scripts build"
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
@@ -5,32 +5,32 @@ import type { AuthenticationMachineState, Context } from 'wirejs-resources';
|
|
|
5
5
|
import { accountMenu } from '../../components/account-menu.js';
|
|
6
6
|
import { auth, wiki } from 'my-api';
|
|
7
7
|
|
|
8
|
-
type WithoutNodes<T> =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
type WithoutNodes<T> = undefined | (
|
|
9
|
+
T extends object ? {
|
|
10
|
+
[K in keyof T
|
|
11
|
+
as T[K] extends Node ? never : K]: WithoutNodes<T[K]>
|
|
12
|
+
} : T
|
|
13
|
+
);
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Shallow check for a `data` hydration property. If present, returns the
|
|
16
17
|
* argument typed according to the given `T`.
|
|
17
18
|
*/
|
|
18
|
-
function initData<T
|
|
19
|
-
return arg0
|
|
19
|
+
function initData<T>(arg0: any): WithoutNodes<T> | undefined {
|
|
20
|
+
return arg0;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
async function Wiki(init: { context?: Context, data?: any }) {
|
|
23
|
-
const { context } = init;
|
|
24
|
+
const { context, data } = init;
|
|
24
25
|
|
|
25
|
-
const data = initData<typeof self>(init);
|
|
26
|
-
|
|
27
|
-
console.log('Wiki init', init);
|
|
28
26
|
const filepath = (context || window).location.pathname;
|
|
29
27
|
|
|
30
|
-
const content =
|
|
28
|
+
const content: string =
|
|
29
|
+
data?.content ?? await wiki.read(context, filepath);
|
|
30
|
+
|
|
31
31
|
const initialState: AuthenticationMachineState =
|
|
32
|
-
data?.initialAuthState
|
|
33
|
-
|
|
32
|
+
data?.initialAuthState ?? await auth.getState(context);
|
|
33
|
+
|
|
34
34
|
const accountMenuNode = accountMenu({ api: auth, initialState });
|
|
35
35
|
|
|
36
36
|
let markdown: string = content ?? `This page doesn't exist yet`;
|
|
@@ -82,7 +82,7 @@ async function Wiki(init: { context?: Context, data?: any }) {
|
|
|
82
82
|
}
|
|
83
83
|
${node('editor', invisibleDiv)}
|
|
84
84
|
${node('actions', actionsFor(initialState))}
|
|
85
|
-
</div>`.extend(
|
|
85
|
+
</div>`.extend(_ => ({
|
|
86
86
|
data: {
|
|
87
87
|
initialAuthState: initialState
|
|
88
88
|
}
|