dsh-cool-theme 0.5.0 → 0.6.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/README.md +2 -1
- package/README.zh.md +2 -1
- package/lib/client.js +476 -32
- package/lib/index.js +532 -6
- package/lib/types/client/components.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +22 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/presets.d.ts +8 -836
- package/lib/types/client/presets.d.ts.map +1 -1
- package/lib/types/client/theme-files.d.ts +14 -0
- package/lib/types/client/theme-files.d.ts.map +1 -1
- package/lib/types/client/theme.d.ts.map +1 -1
- package/lib/types/contract.d.ts +35 -0
- package/lib/types/contract.d.ts.map +1 -1
- package/lib/types/host/index.d.ts.map +1 -1
- package/lib/types/host/theme-files.d.ts +6 -0
- package/lib/types/host/theme-files.d.ts.map +1 -1
- package/lib/types/host/theme-share.d.ts +47 -0
- package/lib/types/host/theme-share.d.ts.map +1 -0
- package/lib/types/host/zip.d.ts +39 -0
- package/lib/types/host/zip.d.ts.map +1 -0
- package/lib/types/presets-ids.d.ts +17 -0
- package/lib/types/presets-ids.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/client/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/client/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAqCpE,gEAAgE;AAChE,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,SAAS,CAmCtD,CAAA;AAED,+FAA+F;AAC/F,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,OAAO,GAAG,QAAQ,CAAA;AAEtD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,QAAQ,CAAwC,CAAA;AAE1F,eAAO,MAAM,aAAa,EAAE;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAQ7D,CAAA"}
|
|
@@ -25,6 +25,20 @@ export declare function fetchThemes(fallbackFor: (base: string) => CustomTheme):
|
|
|
25
25
|
export declare function pushThemes(entries: SavedTheme[], fallbackFor: (base: string) => CustomTheme): Promise<SavedTheme[]>;
|
|
26
26
|
/** Remove one theme's directory. */
|
|
27
27
|
export declare function removeTheme(id: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Download one theme as an archive. The response is the archive itself rather
|
|
30
|
+
* than JSON, so this is the one call that does not go through {@link callApi}.
|
|
31
|
+
*/
|
|
32
|
+
export declare function exportTheme(id: string, name: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Upload one archive. The Host validates it, names the theme and stores it, so
|
|
35
|
+
* a success means the roster already has the theme — the answer carries what to
|
|
36
|
+
* report, not what the client still has to write.
|
|
37
|
+
*/
|
|
38
|
+
export declare function importTheme(file: File): Promise<{
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}>;
|
|
28
42
|
/**
|
|
29
43
|
* The themes a browser saved before files became the store, minus those the
|
|
30
44
|
* Host already has.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-files.d.ts","sourceRoot":"","sources":["../../../src/client/theme-files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"theme-files.d.ts","sourceRoot":"","sources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,UAAU,EAAE,UAAU,EAAE,GACvB,UAAU,EAAE,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/client/theme.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/client/theme.tsx"],"names":[],"mappings":"AA8MA,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,QAmhBrC"}
|
package/lib/types/contract.d.ts
CHANGED
|
@@ -46,4 +46,39 @@ export type ThemeDocument = {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare const THEME_API_PREFIX = "/cool-theme/api";
|
|
48
48
|
export declare const THEME_API_PATH_THEMES = "/cool-theme/api/themes";
|
|
49
|
+
/**
|
|
50
|
+
* Share archive: one theme directory zipped. The document keeps the name it has
|
|
51
|
+
* on disk, so an archive is a copy of the directory rather than a new format,
|
|
52
|
+
* and media added later travels with it under {@link THEME_ARCHIVE_ASSETS_DIR}.
|
|
53
|
+
*/
|
|
54
|
+
export declare const THEME_ARCHIVE_DOCUMENT = "theme.json";
|
|
55
|
+
export declare const THEME_ARCHIVE_ASSETS_DIR = "assets";
|
|
56
|
+
/** Content type of an exported archive, and the extension a name gets. */
|
|
57
|
+
export declare const THEME_ARCHIVE_MIME = "application/zip";
|
|
58
|
+
export declare const THEME_ARCHIVE_EXTENSION = ".zip";
|
|
59
|
+
/**
|
|
60
|
+
* Import bounds. A theme is a small JSON document, so anything past these caps
|
|
61
|
+
* is refused before it is parsed rather than after it has been held in memory.
|
|
62
|
+
*/
|
|
63
|
+
export declare const THEME_ARCHIVE_MAX_BYTES: number;
|
|
64
|
+
export declare const THEME_ARCHIVE_MAX_ENTRIES = 256;
|
|
65
|
+
/** Cap on one uncompressed entry, so a zip bomb cannot expand without bound. */
|
|
66
|
+
export declare const THEME_ARCHIVE_MAX_ENTRY_BYTES: number;
|
|
67
|
+
/** Route segments below {@link THEME_API_PATH_THEMES}: `/<id>/export`, `/import`. */
|
|
68
|
+
export declare const THEME_API_SEGMENT_EXPORT = "export";
|
|
69
|
+
export declare const THEME_API_PATH_IMPORT = "/cool-theme/api/themes/import";
|
|
70
|
+
/**
|
|
71
|
+
* Name the Host suggests for a downloaded archive. The archive keeps the
|
|
72
|
+
* theme's name so a user can tell two exports apart, with the characters a
|
|
73
|
+
* filesystem refuses folded to spaces; the id is the fallback for a name that
|
|
74
|
+
* folds away to nothing.
|
|
75
|
+
*/
|
|
76
|
+
export declare function archiveFileName(name: string, id: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* `base`, else `${base} 2`, `${base} 3`, … An imported theme keeps the name it
|
|
79
|
+
* was shared under — that name is the point of the share — so a clash is
|
|
80
|
+
* resolved by numbering rather than by renaming the incoming theme. The Host
|
|
81
|
+
* owns this because it owns the roster the names have to be free in.
|
|
82
|
+
*/
|
|
83
|
+
export declare function freeThemeName(base: string, taken: readonly string[]): string;
|
|
49
84
|
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD,eAAO,MAAM,wBAAwB,yBAAyB,CAAA;AAG9D,eAAO,MAAM,gBAAgB,WAAW,CAAA;AAKxC,eAAO,MAAM,wBAAwB,sBAAsB,CAAA;AAG3D,eAAO,MAAM,uBAAuB,2BAA2B,CAAA;AAI/D,eAAO,MAAM,yBAAyB,6BAA6B,CAAA;AAInE,eAAO,MAAM,2BAA2B,+BAA+B,CAAA;AAMvE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAA;AAE9C,mEAAmE;AACnE,MAAM,MAAM,UAAU,GAAG;IACvB,2DAA2D;IAC3D,IAAI,EAAE,MAAM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ot":"","sources":["../../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,eAAO,MAAM,IAAI,mBAAmB,CAAA;AAEpC,eAAO,MAAM,MAAM,UAAgB,CAAA;AAwKnC,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA0DpC"}
|
|
@@ -33,6 +33,12 @@ export declare function putTheme(input: {
|
|
|
33
33
|
}): Promise<ThemeDocument>;
|
|
34
34
|
/** Remove one theme directory. A missing directory is already the goal. */
|
|
35
35
|
export declare function deleteTheme(id: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* A fresh theme id. The same shape the client mints (`ct_` + time + noise), so
|
|
38
|
+
* an id never says which half created it, and `isThemeId` is the only rule both
|
|
39
|
+
* halves apply.
|
|
40
|
+
*/
|
|
41
|
+
export declare function newThemeId(): string;
|
|
36
42
|
/** Absolute path of a theme's media directory; used once themes carry media. */
|
|
37
43
|
export declare function assetsDir(id: string): string;
|
|
38
44
|
//# sourceMappingURL=theme-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-files.d.ts","sourceRoot":"","sources":["../../../src/host/theme-files.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAc/D,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAGpC;AAED,kCAAkC;AAClC,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE3C;AAgED,6FAA6F;AAC7F,wBAAsB,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAkB3D;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAA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AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme sharing: packing one stored theme into an archive and reading one back.
|
|
3
|
+
*
|
|
4
|
+
* An archive is the theme directory itself — the same `theme.json` and `assets/`
|
|
5
|
+
* a theme occupies on disk — so sharing never invents a second format. The Host
|
|
6
|
+
* owns both halves because the browser can neither read the theme's files nor
|
|
7
|
+
* decompress an archive on its behalf.
|
|
8
|
+
*
|
|
9
|
+
* Reading is deliberately strict: an archive either validates as one of ours or
|
|
10
|
+
* is refused with a reason. Nothing half-valid is ever handed to the client to
|
|
11
|
+
* repair, because a foreign or damaged file must not be able to seed the roster.
|
|
12
|
+
*/
|
|
13
|
+
import type { ThemeAsset, ThemeDocument } from '../contract.js';
|
|
14
|
+
/** The document as it is packed; the timestamps are the Host's own bookkeeping. */
|
|
15
|
+
type PackedDocument = Pick<ThemeDocument, 'id' | 'name' | 'base' | 'theme' | 'assets'>;
|
|
16
|
+
/** A share refused for a reason worth showing the user. */
|
|
17
|
+
export declare class ArchiveError extends Error {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Pack one theme directory. A theme with no media still gets an archive holding
|
|
21
|
+
* its document alone, so sharing a plain theme needs no second code path.
|
|
22
|
+
*/
|
|
23
|
+
export declare function packTheme(id: string): Promise<{
|
|
24
|
+
fileName: string;
|
|
25
|
+
bytes: Buffer;
|
|
26
|
+
document: PackedDocument;
|
|
27
|
+
}>;
|
|
28
|
+
/** An archive's document, validated; anything else throws {@link ArchiveError}. */
|
|
29
|
+
export type UnpackedTheme = {
|
|
30
|
+
/** Created document, ready for the client to give a fresh id and name. */
|
|
31
|
+
document: PackedDocument;
|
|
32
|
+
/** Media carried beside the document, already bounds-checked. */
|
|
33
|
+
assets: {
|
|
34
|
+
name: string;
|
|
35
|
+
bytes: Buffer;
|
|
36
|
+
kind: ThemeAsset['kind'];
|
|
37
|
+
mime: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Read an archive back into a theme. Only the document and its media are
|
|
42
|
+
* accepted; every path is required to be exactly one of those two shapes, so a
|
|
43
|
+
* directory entry or a nested path is refused rather than normalised.
|
|
44
|
+
*/
|
|
45
|
+
export declare function unpackTheme(archive: Buffer): UnpackedTheme;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=theme-share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-share.d.ts","sourceRoot":"","sources":["../../../src/host/theme-share.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI/D,mFAAmF;AACnF,KAAK,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAA;AAmBtF,2DAA2D;AAC3D,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAC,CAyCD;AAOD,mFAAmF;AACnF,MAAM,MAAM,aAAa,GAAG;IAC1B,0EAA0E;IAC1E,QAAQ,EAAE,cAAc,CAAA;IACxB,iEAAiE;IACjE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAClF,CAAA;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CA+E1D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The little of ZIP that sharing a theme needs.
|
|
3
|
+
*
|
|
4
|
+
* A theme is one small JSON document plus whatever media sits beside it, so the
|
|
5
|
+
* archive format is worth exactly this much: a writer that emits stored/deflated
|
|
6
|
+
* entries with a central directory, and a reader that walks that directory back.
|
|
7
|
+
* Node owns the compression (`zlib.deflateRawSync` / `inflateRawSync`); the two
|
|
8
|
+
* checksums and the record layout are all that has to be written here, which
|
|
9
|
+
* keeps the plugin dependency-free.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately unsupported, because nothing this plugin writes ever produces
|
|
12
|
+
* them: zip64, encrypted entries, multi-disk archives, and data descriptors.
|
|
13
|
+
*/
|
|
14
|
+
export type ZipEntry = {
|
|
15
|
+
/** Path inside the archive, always with forward slashes. */
|
|
16
|
+
name: string;
|
|
17
|
+
data: Buffer;
|
|
18
|
+
};
|
|
19
|
+
/** How a read should select and bound the entries it inflates. */
|
|
20
|
+
export type ReadZipOptions = {
|
|
21
|
+
filter?: (name: string) => boolean;
|
|
22
|
+
/** Largest uncompressed entry to accept; a bigger one is a refusal, not a skip. */
|
|
23
|
+
maxEntryBytes?: number;
|
|
24
|
+
};
|
|
25
|
+
/** CRC-32 of one entry, as the archive records it. */
|
|
26
|
+
export declare function crc32(data: Buffer): number;
|
|
27
|
+
/**
|
|
28
|
+
* Pack entries into one archive. Directory entries are not emitted: every
|
|
29
|
+
* consumer this format targets infers them from the entry paths.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createZip(entries: ZipEntry[]): Buffer;
|
|
32
|
+
/**
|
|
33
|
+
* Entry bytes from one archive, with `filter` deciding which entries are worth
|
|
34
|
+
* inflating. Throws on anything this writer would not have produced, so a file
|
|
35
|
+
* that is not one of our archives fails as "unreadable" rather than as a
|
|
36
|
+
* half-parsed theme.
|
|
37
|
+
*/
|
|
38
|
+
export declare function readZip(input: Buffer, options?: ReadZipOptions): ZipEntry[];
|
|
39
|
+
//# sourceMappingURL=zip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../../src/host/zip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsBH,MAAM,MAAM,QAAQ,GAAG;IACrB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IAClC,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAcD,sDAAsD;AACtD,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAwErD;AAUD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,QAAQ,EAAE,CA0D/E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The preset ids, in one place both halves can read.
|
|
3
|
+
*
|
|
4
|
+
* `presets.ts` carries the colour maps and is client-only; the Host needs the
|
|
5
|
+
* same id vocabulary to tell an archive that derives from a preset we ship from
|
|
6
|
+
* one that does not, so the names live here and that file checks itself against
|
|
7
|
+
* them.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PRESET_IDS: readonly ["aura", "ayu", "catppuccin", "catppuccin-frappe", "catppuccin-macchiato", "cobalt2", "cursor", "dracula", "dsh", "everforest", "flexoki", "github", "gruvbox", "kanagawa", "lucent-orng", "material", "matrix", "mercury", "monokai", "nightowl", "nord", "onedark", "opencode", "orng", "osaka-jade", "palenight", "rosepine", "solarized", "synthwave84", "system", "tokyonight", "vercel", "vesper", "zenburn"];
|
|
10
|
+
/** One shipped preset id. `native` is a storage alias, not a preset. */
|
|
11
|
+
export type BuiltinPresetId = (typeof PRESET_IDS)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Whether a theme may name `base` and still be resolved here. `native` is the
|
|
14
|
+
* legacy alias for `dsh`, so a theme that carries it stays usable.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isKnownBase(value: string): boolean;
|
|
17
|
+
//# sourceMappingURL=presets-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets-ids.d.ts","sourceRoot":"","sources":["../../src/presets-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,UAAU,8ZAmCb,CAAA;AAEV,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD"}
|