adjacent-core 0.1.0
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 +15 -0
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/config.d.ts +281 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +117 -0
- package/dist/config.js.map +1 -0
- package/dist/dev-protocol.d.ts +19 -0
- package/dist/dev-protocol.d.ts.map +1 -0
- package/dist/dev-protocol.js +26 -0
- package/dist/dev-protocol.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/resolve-manifest.d.ts +18 -0
- package/dist/manifest/resolve-manifest.d.ts.map +1 -0
- package/dist/manifest/resolve-manifest.js +124 -0
- package/dist/manifest/resolve-manifest.js.map +1 -0
- package/dist/manifest/schema.d.ts +355 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +141 -0
- package/dist/manifest/schema.js.map +1 -0
- package/dist/metadata.d.ts +54 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +37 -0
- package/dist/metadata.js.map +1 -0
- package/dist/worker-protocol.d.ts +22 -0
- package/dist/worker-protocol.d.ts.map +1 -0
- package/dist/worker-protocol.js +6 -0
- package/dist/worker-protocol.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AdjacentConfig } from "./config.js";
|
|
2
|
+
export interface ResolvedMetadata {
|
|
3
|
+
readonly appleWebApp: {
|
|
4
|
+
readonly capable: true;
|
|
5
|
+
readonly statusBarStyle: "default";
|
|
6
|
+
readonly title: string;
|
|
7
|
+
};
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly icons: {
|
|
10
|
+
readonly apple: {
|
|
11
|
+
readonly sizes: "180x180";
|
|
12
|
+
readonly type: "image/png";
|
|
13
|
+
readonly url: string;
|
|
14
|
+
}[];
|
|
15
|
+
readonly icon: {
|
|
16
|
+
readonly sizes?: "96x96";
|
|
17
|
+
readonly type: "image/png" | "image/svg+xml";
|
|
18
|
+
readonly url: string;
|
|
19
|
+
}[];
|
|
20
|
+
readonly shortcut: string;
|
|
21
|
+
};
|
|
22
|
+
readonly manifest: "/manifest.webmanifest";
|
|
23
|
+
/**
|
|
24
|
+
* A template rather than a string, so a page exporting `title: "Settings"`
|
|
25
|
+
* reads as "Settings · App" instead of losing the application's name. A page
|
|
26
|
+
* that exports none falls back to `default`.
|
|
27
|
+
*/
|
|
28
|
+
readonly title: {
|
|
29
|
+
readonly default: string;
|
|
30
|
+
readonly template: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface ThemeColorDescriptor {
|
|
34
|
+
readonly color: string;
|
|
35
|
+
readonly media: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ResolvedViewport {
|
|
38
|
+
/**
|
|
39
|
+
* Android shrinks the layout viewport for the software keyboard, which lets
|
|
40
|
+
* the shell's grid re-run instead of leaving fixed chrome underneath it.
|
|
41
|
+
*/
|
|
42
|
+
readonly interactiveWidget: "resizes-content";
|
|
43
|
+
/**
|
|
44
|
+
* One colour, or one per colour scheme. A document may carry several
|
|
45
|
+
* `theme-color` values as long as each says which scheme it is for, and the
|
|
46
|
+
* browser takes the first that matches.
|
|
47
|
+
*/
|
|
48
|
+
readonly themeColor: string | ThemeColorDescriptor[];
|
|
49
|
+
/** Safe-area insets report zero until the viewport covers the display cutout. */
|
|
50
|
+
readonly viewportFit: "cover";
|
|
51
|
+
}
|
|
52
|
+
export declare function resolveMetadata(config: AdjacentConfig): ResolvedMetadata;
|
|
53
|
+
export declare function resolveViewport(config: AdjacentConfig): ResolvedViewport;
|
|
54
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"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,oBAAoB,EAAE,CAAC;IACrD,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAmBxE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAgBxE"}
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function resolveMetadata(config) {
|
|
2
|
+
return {
|
|
3
|
+
appleWebApp: {
|
|
4
|
+
capable: true,
|
|
5
|
+
statusBarStyle: "default",
|
|
6
|
+
title: config.app.shortName ?? config.app.name,
|
|
7
|
+
},
|
|
8
|
+
description: config.app.description,
|
|
9
|
+
icons: {
|
|
10
|
+
apple: [{ sizes: "180x180", type: "image/png", url: "/apple-touch-icon.png" }],
|
|
11
|
+
icon: [
|
|
12
|
+
{ sizes: "96x96", type: "image/png", url: "/favicon-96x96.png" },
|
|
13
|
+
{ type: "image/svg+xml", url: "/favicon.svg" },
|
|
14
|
+
],
|
|
15
|
+
shortcut: "/favicon.ico",
|
|
16
|
+
},
|
|
17
|
+
manifest: "/manifest.webmanifest",
|
|
18
|
+
title: { default: config.app.name, template: `%s · ${config.app.name}` },
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function resolveViewport(config) {
|
|
22
|
+
const light = config.appearance?.themeColor ?? "#ffffff";
|
|
23
|
+
const dark = config.appearance?.themeColorDark;
|
|
24
|
+
return {
|
|
25
|
+
interactiveWidget: "resizes-content",
|
|
26
|
+
// A bare string while there is one colour, because a single unconditional
|
|
27
|
+
// `theme-color` is what every browser has always understood.
|
|
28
|
+
themeColor: dark
|
|
29
|
+
? [
|
|
30
|
+
{ color: light, media: "(prefers-color-scheme: light)" },
|
|
31
|
+
{ color: dark, media: "(prefers-color-scheme: dark)" },
|
|
32
|
+
]
|
|
33
|
+
: light,
|
|
34
|
+
viewportFit: "cover",
|
|
35
|
+
};
|
|
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AK,EAAE,+BAA+B,EAAE;gBACxD,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,8BAA8B,EAAE;aACvD;YACH,CAAC,CAAC,KAAK;QACT,WAAW,EAAE,OAAO;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const WORKER_COMMAND: {
|
|
2
|
+
readonly activateUpdate: "ADJACENT_ACTIVATE_UPDATE";
|
|
3
|
+
readonly clearCache: "ADJACENT_CLEAR_CACHE";
|
|
4
|
+
readonly revalidate: "ADJACENT_REVALIDATE";
|
|
5
|
+
};
|
|
6
|
+
export type AdjacentCacheTarget = "all" | "assets" | "pages";
|
|
7
|
+
export type AdjacentWorkerCommand = {
|
|
8
|
+
readonly type: typeof WORKER_COMMAND.activateUpdate;
|
|
9
|
+
} | {
|
|
10
|
+
readonly target: AdjacentCacheTarget;
|
|
11
|
+
readonly type: typeof WORKER_COMMAND.clearCache;
|
|
12
|
+
} | {
|
|
13
|
+
readonly type: typeof WORKER_COMMAND.revalidate;
|
|
14
|
+
readonly urls: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export type AdjacentWorkerResponse = {
|
|
17
|
+
readonly ok: true;
|
|
18
|
+
} | {
|
|
19
|
+
readonly error: string;
|
|
20
|
+
readonly ok: false;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=worker-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["../src/worker-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,cAAc,CAAC,cAAc,CAAA;CAAE,GACvD;IACE,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,cAAc,CAAC,UAAU,CAAC;CACjD,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,cAAc,CAAC,UAAU,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAEN,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-protocol.js","sourceRoot":"","sources":["../src/worker-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,cAAc,EAAE,0BAA0B;IAC1C,UAAU,EAAE,sBAAsB;IAClC,UAAU,EAAE,qBAAqB;CACzB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adjacent-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Configuration contract, web app manifest, and metadata primitives for Adjacent.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pwa",
|
|
7
|
+
"progressive-web-app",
|
|
8
|
+
"manifest",
|
|
9
|
+
"nextjs",
|
|
10
|
+
"adjacent"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Eric Kweyunga",
|
|
14
|
+
"homepage": "https://github.com/erickweyunga/adjacent-framework/blob/main/docs/configuration.md",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/erickweyunga/adjacent-framework.git",
|
|
18
|
+
"directory": "packages/adjacent-core"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/erickweyunga/adjacent-framework/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"CHANGELOG.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.9.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
|
+
"test": "bun test",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"prepublishOnly": "npm run build"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"zod": "^4.1.5"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/bun": "^1.3.13",
|
|
55
|
+
"typescript": "^5"
|
|
56
|
+
},
|
|
57
|
+
"main": "./dist/index.js",
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"sideEffects": false
|
|
60
|
+
}
|