@dontfeedmachines/fieldkit 0.4.1 → 0.4.2
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/CHANGELOG.md +6 -1
- package/config/menu.default.json +6 -0
- package/config/wiki.default.json +32 -0
- package/package.json +2 -1
- package/src/node/wiki.ts +45 -0
- package/src/wiki/virtual.d.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
# Changelog
|
|
1
|
+
# Changelog // @dontfeedmachines/fieldkit
|
|
2
|
+
|
|
3
|
+
## [0.4.2] - 2026-11-12
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Included `src/node/wiki.ts`, `src/wiki/virtual.d.ts`, and `config/{wiki,menu}.default.json` so `fieldkitWiki` can provide `virtual:dfm-fieldkit/wiki`.
|
|
2
7
|
|
|
3
8
|
## [0.4.0] - 2026-11-12
|
|
4
9
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"site": {
|
|
3
|
+
"title": "Wiki",
|
|
4
|
+
"logo": "",
|
|
5
|
+
"logo_darkmode": "",
|
|
6
|
+
"logo_width": "100",
|
|
7
|
+
"logo_height": "100",
|
|
8
|
+
"logo_text": "WIKI",
|
|
9
|
+
"status_name": "WIKI"
|
|
10
|
+
},
|
|
11
|
+
"settings": {
|
|
12
|
+
"search": true,
|
|
13
|
+
"theme_switcher": true
|
|
14
|
+
},
|
|
15
|
+
"params": {
|
|
16
|
+
"footer_contact": { "enable": false, "action": "#" },
|
|
17
|
+
"copyright": ""
|
|
18
|
+
},
|
|
19
|
+
"navigation_button": {
|
|
20
|
+
"enable": false,
|
|
21
|
+
"label": "Get started",
|
|
22
|
+
"link": "/"
|
|
23
|
+
},
|
|
24
|
+
"cta": {
|
|
25
|
+
"enable": false,
|
|
26
|
+
"title": "",
|
|
27
|
+
"description": "",
|
|
28
|
+
"background": "",
|
|
29
|
+
"fill_button": { "enable": false, "label": "Get started", "link": "/" },
|
|
30
|
+
"outline_button": { "enable": false, "label": "Learn more", "link": "/" }
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dontfeedmachines/fieldkit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "shared Astro components, base CSS, elements, and build helpers for DontFeedMachines sites.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://dontfeedmachines.com",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
|
+
"config",
|
|
9
10
|
"css",
|
|
10
11
|
"pouches",
|
|
11
12
|
"src",
|
package/src/node/wiki.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import defaultConfig from "../../config/wiki.default.json" with { type: "json" };
|
|
2
|
+
import defaultMenu from "../../config/menu.default.json" with { type: "json" };
|
|
3
|
+
|
|
4
|
+
type Plain = Record<string, any>;
|
|
5
|
+
|
|
6
|
+
export type WikiOptions = {
|
|
7
|
+
config?: Plain;
|
|
8
|
+
menu?: Record<string, Plain>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const isPlain = (v: unknown): v is Plain => !!v && typeof v === "object" && !Array.isArray(v);
|
|
12
|
+
|
|
13
|
+
// arrays are replaced whole, objects merge key by key
|
|
14
|
+
function merge(base: Plain, over: Plain): Plain {
|
|
15
|
+
const out: Plain = { ...base };
|
|
16
|
+
for (const [k, v] of Object.entries(over)) out[k] = isPlain(v) && isPlain(base[k]) ? merge(base[k], v) : v;
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ID = "virtual:dfm-fieldkit/wiki";
|
|
21
|
+
|
|
22
|
+
export function fieldkitWiki(options: WikiOptions = {}) {
|
|
23
|
+
const payload = {
|
|
24
|
+
config: merge(defaultConfig, options.config ?? {}),
|
|
25
|
+
menu: { en: defaultMenu, ...(options.menu ?? {}) },
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
name: "dfm-fieldkit-wiki",
|
|
29
|
+
hooks: {
|
|
30
|
+
"astro:config:setup": ({ updateConfig }: { updateConfig: (c: Plain) => void }) => {
|
|
31
|
+
updateConfig({
|
|
32
|
+
vite: {
|
|
33
|
+
plugins: [
|
|
34
|
+
{
|
|
35
|
+
name: "dfm-fieldkit-wiki",
|
|
36
|
+
resolveId: (id: string) => (id === ID ? "\0" + ID : null),
|
|
37
|
+
load: (id: string) => (id === "\0" + ID ? `export default ${JSON.stringify(payload)};` : null),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|