@phosart/common 0.4.40 → 0.4.41
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.
|
@@ -15,6 +15,9 @@ declare const ZMultiSelectionOption: z.ZodObject<{
|
|
|
15
15
|
declare const ZStringOption: z.ZodObject<{
|
|
16
16
|
type: z.ZodLiteral<"string">;
|
|
17
17
|
}, z.z.core.$strip>;
|
|
18
|
+
declare const ZBoolOption: z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"boolean">;
|
|
20
|
+
}, z.z.core.$strip>;
|
|
18
21
|
declare const ZTagsOption: z.ZodObject<{
|
|
19
22
|
type: z.ZodLiteral<"tag-list">;
|
|
20
23
|
}, z.z.core.$strip>;
|
|
@@ -37,6 +40,8 @@ export declare const ZThemeSettingsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<r
|
|
|
37
40
|
type: z.ZodLiteral<"string-list">;
|
|
38
41
|
}, z.z.core.$strip>, z.ZodObject<{
|
|
39
42
|
type: z.ZodLiteral<"string">;
|
|
43
|
+
}, z.z.core.$strip>, z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"boolean">;
|
|
40
45
|
}, z.z.core.$strip>]>>;
|
|
41
46
|
export type ThemeSettingsSchema = z.infer<typeof ZThemeSettingsSchema>;
|
|
42
47
|
export declare const builtinSettings: {
|
|
@@ -47,9 +52,12 @@ export declare const builtinSettings: {
|
|
|
47
52
|
readonly type: "selection";
|
|
48
53
|
readonly options: ["static", "vercel"];
|
|
49
54
|
};
|
|
55
|
+
readonly supportsComics: {
|
|
56
|
+
readonly type: "boolean";
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
export type BuiltinSettings = typeof builtinSettings;
|
|
52
|
-
type MaterializedOptionFor<T extends ThemeSettingsSchema[string]> = T extends z.infer<typeof ZColorOption> ? `#${string}` : T extends z.infer<typeof ZSelectionOption> ? [...T['options']] : T extends z.infer<typeof ZMultiSelectionOption> ? Array<[...T['options']]> : T extends z.infer<typeof ZStringList> ? Array<string> : T extends z.infer<typeof ZTagsOption> ? Array<string> : T extends z.infer<typeof ZStringOption> ? string : never;
|
|
60
|
+
type MaterializedOptionFor<T extends ThemeSettingsSchema[string]> = T extends z.infer<typeof ZColorOption> ? `#${string}` : T extends z.infer<typeof ZSelectionOption> ? [...T['options']] : T extends z.infer<typeof ZMultiSelectionOption> ? Array<[...T['options']]> : T extends z.infer<typeof ZStringList> ? Array<string> : T extends z.infer<typeof ZTagsOption> ? Array<string> : T extends z.infer<typeof ZStringOption> ? string : T extends z.infer<typeof ZBoolOption> ? boolean | undefined : never;
|
|
53
61
|
export type SettingsFor<T extends ThemeSettingsSchema> = {
|
|
54
62
|
[K in keyof T]: MaterializedOptionFor<T[K]>;
|
|
55
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/lib/server/theme/schema.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAC;AAcpB,QAAA,MAAM,YAAY;;mBAAyC,CAAC;AAC5D,QAAA,MAAM,gBAAgB;;;;mBAIpB,CAAC;AACH,QAAA,MAAM,qBAAqB;;;;mBAIzB,CAAC;AACH,QAAA,MAAM,aAAa;;mBAA0C,CAAC;AAC9D,QAAA,MAAM,WAAW;;mBAA4C,CAAC;AAC9D,QAAA,MAAM,WAAW;;mBAA+C,CAAC;AACjE,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/lib/server/theme/schema.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAC;AAcpB,QAAA,MAAM,YAAY;;mBAAyC,CAAC;AAC5D,QAAA,MAAM,gBAAgB;;;;mBAIpB,CAAC;AACH,QAAA,MAAM,qBAAqB;;;;mBAIzB,CAAC;AACH,QAAA,MAAM,aAAa;;mBAA0C,CAAC;AAC9D,QAAA,MAAM,WAAW;;mBAA2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wBAAsB,eAAe,CAAC,CAAC,SAAS,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,CAqBjF;AAyCD,wBAAgB,cAAc,CAAC,CAAC,SAAS,mBAAmB,EAC3D,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,OAAO,GACV,GAAG,IAAI,WAAW,CAAC,CAAC,GAAG,eAAe,CAAC,CAEzC;AAoGD,wBAAsB,eAAe,CAAC,CAAC,SAAS,mBAAmB,EAClE,MAAM,EAAE,CAAC,GACP,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAoB3C;AAED,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,mBAAmB,EACnE,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,WAAW,CAAC,CAAC,GAAG,eAAe,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -25,6 +25,7 @@ const ZMultiSelectionOption = z.object({
|
|
|
25
25
|
multi: z.literal(true)
|
|
26
26
|
});
|
|
27
27
|
const ZStringOption = z.object({ type: z.literal('string') });
|
|
28
|
+
const ZBoolOption = z.object({ type: z.literal('boolean') });
|
|
28
29
|
const ZTagsOption = z.object({ type: z.literal('tag-list') });
|
|
29
30
|
const ZStringList = z.object({ type: z.literal('string-list') });
|
|
30
31
|
export const ZThemeSettingsSchema = z.record(z.string(), z.union([
|
|
@@ -33,11 +34,13 @@ export const ZThemeSettingsSchema = z.record(z.string(), z.union([
|
|
|
33
34
|
ZMultiSelectionOption,
|
|
34
35
|
ZTagsOption,
|
|
35
36
|
ZStringList,
|
|
36
|
-
ZStringOption
|
|
37
|
+
ZStringOption,
|
|
38
|
+
ZBoolOption
|
|
37
39
|
]));
|
|
38
40
|
export const builtinSettings = {
|
|
39
41
|
defaultArtist: { type: 'string' },
|
|
40
|
-
websiteMode: { type: 'selection', options: ['static', 'vercel'] }
|
|
42
|
+
websiteMode: { type: 'selection', options: ['static', 'vercel'] },
|
|
43
|
+
supportsComics: { type: 'boolean' }
|
|
41
44
|
};
|
|
42
45
|
export async function readThemeSchema() {
|
|
43
46
|
let text;
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ const ZMultiSelectionOption = z.object({
|
|
|
27
27
|
multi: z.literal(true)
|
|
28
28
|
});
|
|
29
29
|
const ZStringOption = z.object({ type: z.literal('string') });
|
|
30
|
+
const ZBoolOption = z.object({ type: z.literal('boolean') });
|
|
30
31
|
const ZTagsOption = z.object({ type: z.literal('tag-list') });
|
|
31
32
|
const ZStringList = z.object({ type: z.literal('string-list') });
|
|
32
33
|
export const ZThemeSettingsSchema = z.record(
|
|
@@ -37,7 +38,8 @@ export const ZThemeSettingsSchema = z.record(
|
|
|
37
38
|
ZMultiSelectionOption,
|
|
38
39
|
ZTagsOption,
|
|
39
40
|
ZStringList,
|
|
40
|
-
ZStringOption
|
|
41
|
+
ZStringOption,
|
|
42
|
+
ZBoolOption
|
|
41
43
|
])
|
|
42
44
|
);
|
|
43
45
|
|
|
@@ -45,7 +47,8 @@ export type ThemeSettingsSchema = z.infer<typeof ZThemeSettingsSchema>;
|
|
|
45
47
|
|
|
46
48
|
export const builtinSettings = {
|
|
47
49
|
defaultArtist: { type: 'string' },
|
|
48
|
-
websiteMode: { type: 'selection', options: ['static', 'vercel'] }
|
|
50
|
+
websiteMode: { type: 'selection', options: ['static', 'vercel'] },
|
|
51
|
+
supportsComics: { type: 'boolean' }
|
|
49
52
|
} as const satisfies ThemeSettingsSchema;
|
|
50
53
|
export type BuiltinSettings = typeof builtinSettings;
|
|
51
54
|
|
|
@@ -62,7 +65,9 @@ type MaterializedOptionFor<T extends ThemeSettingsSchema[string]> =
|
|
|
62
65
|
? Array<string>
|
|
63
66
|
: T extends z.infer<typeof ZStringOption>
|
|
64
67
|
? string
|
|
65
|
-
:
|
|
68
|
+
: T extends z.infer<typeof ZBoolOption>
|
|
69
|
+
? boolean | undefined
|
|
70
|
+
: never;
|
|
66
71
|
|
|
67
72
|
export type SettingsFor<T extends ThemeSettingsSchema> = {
|
|
68
73
|
[K in keyof T]: MaterializedOptionFor<T[K]>;
|