@acdh-oeaw/keystatic-lib 0.5.0 → 0.5.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/dist/{chunk-FK3EHKPW.js → chunk-54FVKF5V.js} +2 -2
- package/dist/chunk-54FVKF5V.js.map +1 -0
- package/dist/chunk-EEB35F4L.js +15 -0
- package/dist/chunk-EEB35F4L.js.map +1 -0
- package/dist/{chunk-5ZKY25OZ.js → chunk-ENT7N2ZS.js} +2 -2
- package/dist/chunk-ENT7N2ZS.js.map +1 -0
- package/dist/create-asset-options.d.ts +7 -3
- package/dist/create-asset-options.js +1 -1
- package/dist/create-content-field-options.d.ts +7 -3
- package/dist/create-content-field-options.js +2 -2
- package/dist/index.js +3 -3
- package/dist/resources.d.ts +0 -1
- package/dist/resources.js +1 -1
- package/package.json +1 -1
- package/readme.md +3 -3
- package/dist/chunk-5ZKY25OZ.js.map +0 -1
- package/dist/chunk-EAFZLNV4.js +0 -15
- package/dist/chunk-EAFZLNV4.js.map +0 -1
- package/dist/chunk-FK3EHKPW.js.map +0 -1
|
@@ -31,5 +31,5 @@ function createSingleton(path, createLocalisedSingletonFactory) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export { createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-54FVKF5V.js.map
|
|
35
|
+
//# sourceMappingURL=chunk-54FVKF5V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resources.ts"],"names":[],"mappings":";AAKO,SAAS,WAAA,CAAyC,MAAa,MAAgB,EAAA;AACrF,EAAO,OAAA;AAAA,IACN,SAAW,EAAA,CAAA,gBAAA,EAAmB,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IAC3C,YAAc,EAAA,CAAA,mBAAA,EAAsB,MAAM,CAAA,EAAG,IAAI,CAAA;AAAA,GAClD;AACD;AAIO,SAAS,qBAAA,CAAmD,MAAa,MAAgB,EAAA;AAC/F,EAAO,OAAA;AAAA,IACN,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,CAAA;AAAA,IAC3B,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA,EAAA;AAAA,GACxC;AACD;AAEO,SAAS,oBAAA,CAAkD,MAAa,MAAgB,EAAA;AAC9F,EAAO,OAAA;AAAA,IACN,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,CAAA;AAAA,IAC3B,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA;AAAA,GACxC;AACD;AAEO,SAAS,gBAAA,CAMf,MACA,gCAIC,EAAA;AACD,EAAO,OAAA,SAAS,0BAA0B,MAAiB,EAAA;AAC1D,IAAM,MAAA,KAAA,GAAQ,qBAAsB,CAAA,IAAA,EAAM,MAAM,CAAA;AAChD,IAAO,OAAA,gCAAA,CAAiC,OAAO,MAAM,CAAA;AAAA,GACtD;AACD;AAEO,SAAS,eAAA,CAKf,MACA,+BAIC,EAAA;AACD,EAAO,OAAA,SAAS,yBAAyB,MAAiB,EAAA;AACzD,IAAM,MAAA,KAAA,GAAQ,oBAAqB,CAAA,IAAA,EAAM,MAAM,CAAA;AAC/C,IAAO,OAAA,+BAAA,CAAgC,OAAO,MAAM,CAAA;AAAA,GACrD;AACD","file":"chunk-54FVKF5V.js","sourcesContent":["import type { Collection, ComponentSchema, Singleton } from \"@keystatic/core\";\n\nimport type { Locale } from \"./config\";\n\n/** @private */\nexport function createPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\tassetPath: `/content/assets/${locale}${path}`,\n\t\tdownloadPath: `/content/downloads/${locale}${path}`,\n\t} as const;\n}\n\nexport type Paths<TPath extends `/${string}/`> = ReturnType<typeof createPaths<TPath>>;\n\nexport function createCollectionPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\t...createPaths(path, locale),\n\t\tcontentPath: `./content/${locale}${path}*/`,\n\t} as const;\n}\n\nexport function createSingletonPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\t...createPaths(path, locale),\n\t\tcontentPath: `./content/${locale}${path}`,\n\t} as const;\n}\n\nexport function createCollection<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTSchema extends Record<string, ComponentSchema>,\n\tTSlugField extends string,\n>(\n\tpath: TPath,\n\tcreateLocalisedCollectionFactory: (\n\t\tpaths: ReturnType<typeof createCollectionPaths<TPath>>,\n\t\tlocale: TLocale,\n\t) => Collection<TSchema, TSlugField>,\n) {\n\treturn function createLocalisedCollection(locale: TLocale) {\n\t\tconst paths = createCollectionPaths(path, locale);\n\t\treturn createLocalisedCollectionFactory(paths, locale);\n\t};\n}\n\nexport function createSingleton<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTSchema extends Record<string, ComponentSchema>,\n>(\n\tpath: TPath,\n\tcreateLocalisedSingletonFactory: (\n\t\tpaths: ReturnType<typeof createSingletonPaths<TPath>>,\n\t\tlocale: TLocale,\n\t) => Singleton<TSchema>,\n) {\n\treturn function createLocalisedSingleton(locale: TLocale) {\n\t\tconst paths = createSingletonPaths(path, locale);\n\t\treturn createLocalisedSingletonFactory(paths, locale);\n\t};\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createAssetOptions } from './chunk-ENT7N2ZS.js';
|
|
2
|
+
|
|
3
|
+
// src/create-content-field-options.ts
|
|
4
|
+
function createContentFieldOptions(paths) {
|
|
5
|
+
const assetPaths = createAssetOptions(paths.assetPath);
|
|
6
|
+
const headingLevels = [2, 3, 4, 5];
|
|
7
|
+
return {
|
|
8
|
+
heading: headingLevels,
|
|
9
|
+
image: assetPaths
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { createContentFieldOptions };
|
|
14
|
+
//# sourceMappingURL=chunk-EEB35F4L.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-EEB35F4L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/create-content-field-options.ts"],"names":[],"mappings":";;;AAGO,SAAS,0BAAuD,KAAqB,EAAA;AAC3F,EAAM,MAAA,UAAA,GAAa,kBAAmB,CAAA,KAAA,CAAM,SAAS,CAAA;AACrD,EAAA,MAAM,aAAgB,GAAA,CAAC,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAEjC,EAAO,OAAA;AAAA,IACN,OAAS,EAAA,aAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACR;AACD","file":"chunk-EEB35F4L.js","sourcesContent":["import { createAssetOptions } from \"./create-asset-options\";\nimport type { Paths } from \"./resources\";\n\nexport function createContentFieldOptions<TPath extends `/${string}/`>(paths: Paths<TPath>) {\n\tconst assetPaths = createAssetOptions(paths.assetPath);\n\tconst headingLevels = [2, 3, 4, 5] as const;\n\n\treturn {\n\t\theading: headingLevels,\n\t\timage: assetPaths,\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/create-asset-options.ts"],"names":[],"mappings":";;;AAIO,SAAS,mBACf,IACC,EAAA;AACD,EAAO,OAAA;AAAA,IACN,SAAA,EAAW,kBAAkB,IAAI,CAAA,CAAA;AAAA,IACjC,UAAA,EAAY,UAAU,IAAI,CAAA,CAAA;AAAA,IAC1B,kBAAkB,gBAA0B,EAAA;AAC3C,MAAA,OAAO,QAAQ,gBAAkB,EAAA,EAAE,oBAAoB,CAAC,GAAG,GAAG,CAAA;AAAA;AAC/D,GACD;AACD","file":"chunk-ENT7N2ZS.js","sourcesContent":["import slugify from \"@sindresorhus/slugify\";\n\nimport type { Paths } from \"./resources\";\n\nexport function createAssetOptions<TPath extends `/${string}/`>(\n\tpath: Paths<TPath>[\"assetPath\"] | Paths<TPath>[\"downloadPath\"],\n) {\n\treturn {\n\t\tdirectory: `./public/assets${path}` as const,\n\t\tpublicPath: `/assets${path}` as const,\n\t\ttransformFilename(originalFilename: string) {\n\t\t\treturn slugify(originalFilename, { preserveCharacters: [\".\"] });\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Paths } from './resources.js';
|
|
2
|
+
import '@keystatic/core';
|
|
3
|
+
import './config.js';
|
|
4
|
+
|
|
5
|
+
declare function createAssetOptions<TPath extends `/${string}/`>(path: Paths<TPath>["assetPath"] | Paths<TPath>["downloadPath"]): {
|
|
6
|
+
directory: `./public/assets/content/assets/${string}${TPath}` | `./public/assets/content/downloads/${string}${TPath}`;
|
|
7
|
+
publicPath: `/assets/content/assets/${string}${TPath}` | `/assets/content/downloads/${string}${TPath}`;
|
|
4
8
|
transformFilename(originalFilename: string): string;
|
|
5
9
|
};
|
|
6
10
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { Paths } from './resources.js';
|
|
2
|
+
import '@keystatic/core';
|
|
3
|
+
import './config.js';
|
|
4
|
+
|
|
5
|
+
declare function createContentFieldOptions<TPath extends `/${string}/`>(paths: Paths<TPath>): {
|
|
2
6
|
heading: readonly [2, 3, 4, 5];
|
|
3
7
|
image: {
|
|
4
|
-
directory: `./public/assets${TPath}`;
|
|
5
|
-
publicPath: `/assets${TPath}`;
|
|
8
|
+
directory: `./public/assets/content/assets/${string}${TPath}` | `./public/assets/content/downloads/${string}${TPath}`;
|
|
9
|
+
publicPath: `/assets/content/assets/${string}${TPath}` | `/assets/content/downloads/${string}${TPath}`;
|
|
6
10
|
transformFilename(originalFilename: string): string;
|
|
7
11
|
};
|
|
8
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createContentFieldOptions } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { createContentFieldOptions } from './chunk-EEB35F4L.js';
|
|
2
|
+
import './chunk-ENT7N2ZS.js';
|
|
3
3
|
//# sourceMappingURL=create-content-field-options.js.map
|
|
4
4
|
//# sourceMappingURL=create-content-field-options.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createComponent } from './chunk-ZWZCXCMD.js';
|
|
2
|
-
export { createContentFieldOptions } from './chunk-
|
|
3
|
-
export { createAssetOptions } from './chunk-
|
|
2
|
+
export { createContentFieldOptions } from './chunk-EEB35F4L.js';
|
|
3
|
+
export { createAssetOptions } from './chunk-ENT7N2ZS.js';
|
|
4
4
|
export { createLabel } from './chunk-CI4JBTGG.js';
|
|
5
5
|
export { withI18nPrefix } from './chunk-M7J4ISS4.js';
|
|
6
|
-
export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './chunk-
|
|
6
|
+
export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './chunk-54FVKF5V.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/resources.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare function createPaths<TPath extends `/${string}/`>(path: TPath, locale: L
|
|
|
6
6
|
readonly assetPath: `/content/assets/${string}${TPath}`;
|
|
7
7
|
readonly downloadPath: `/content/downloads/${string}${TPath}`;
|
|
8
8
|
};
|
|
9
|
-
/** @private */
|
|
10
9
|
type Paths<TPath extends `/${string}/`> = ReturnType<typeof createPaths<TPath>>;
|
|
11
10
|
declare function createCollectionPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale): {
|
|
12
11
|
readonly contentPath: `./content/${string}${TPath}*/`;
|
package/dist/resources.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths } from './chunk-
|
|
1
|
+
export { createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths } from './chunk-54FVKF5V.js';
|
|
2
2
|
//# sourceMappingURL=resources.js.map
|
|
3
3
|
//# sourceMappingURL=resources.js.map
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -30,7 +30,7 @@ declare module "@acdh-oeaw/keystatic-lib" {
|
|
|
30
30
|
import { createComponent } from "@acdh-oeaw/keystatic-lib";
|
|
31
31
|
import { wrapper } from "@keystatic/core/content-components";
|
|
32
32
|
|
|
33
|
-
export const Video = createComponent((
|
|
33
|
+
export const Video = createComponent((paths, locale) => {
|
|
34
34
|
return wrapper({
|
|
35
35
|
label: "Video",
|
|
36
36
|
schema: {
|
|
@@ -78,9 +78,9 @@ export const pages = createCollection("/pages/", (paths, locale) => {
|
|
|
78
78
|
}),
|
|
79
79
|
content: fields.mdx({
|
|
80
80
|
label: "Content",
|
|
81
|
-
options: createContentFieldOptions(paths
|
|
81
|
+
options: createContentFieldOptions(paths),
|
|
82
82
|
components: {
|
|
83
|
-
Video: Video(paths
|
|
83
|
+
Video: Video(paths, locale),
|
|
84
84
|
},
|
|
85
85
|
}),
|
|
86
86
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/create-asset-options.ts"],"names":[],"mappings":";;;AAEO,SAAS,mBAAgD,IAAa,EAAA;AAC5E,EAAO,OAAA;AAAA,IACN,SAAA,EAAW,kBAAkB,IAAI,CAAA,CAAA;AAAA,IACjC,UAAA,EAAY,UAAU,IAAI,CAAA,CAAA;AAAA,IAC1B,kBAAkB,gBAA0B,EAAA;AAC3C,MAAA,OAAO,QAAQ,gBAAkB,EAAA,EAAE,oBAAoB,CAAC,GAAG,GAAG,CAAA;AAAA;AAC/D,GACD;AACD","file":"chunk-5ZKY25OZ.js","sourcesContent":["import slugify from \"@sindresorhus/slugify\";\n\nexport function createAssetOptions<TPath extends `/${string}/`>(path: TPath) {\n\treturn {\n\t\tdirectory: `./public/assets${path}` as const,\n\t\tpublicPath: `/assets${path}` as const,\n\t\ttransformFilename(originalFilename: string) {\n\t\t\treturn slugify(originalFilename, { preserveCharacters: [\".\"] });\n\t\t},\n\t};\n}\n"]}
|
package/dist/chunk-EAFZLNV4.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createAssetOptions } from './chunk-5ZKY25OZ.js';
|
|
2
|
-
|
|
3
|
-
// src/create-content-field-options.ts
|
|
4
|
-
function createContentFieldOptions(assetPath) {
|
|
5
|
-
const assetPaths = createAssetOptions(assetPath);
|
|
6
|
-
const headingLevels = [2, 3, 4, 5];
|
|
7
|
-
return {
|
|
8
|
-
heading: headingLevels,
|
|
9
|
-
image: assetPaths
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { createContentFieldOptions };
|
|
14
|
-
//# sourceMappingURL=chunk-EAFZLNV4.js.map
|
|
15
|
-
//# sourceMappingURL=chunk-EAFZLNV4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/create-content-field-options.ts"],"names":[],"mappings":";;;AAEO,SAAS,0BAAuD,SAAkB,EAAA;AACxF,EAAM,MAAA,UAAA,GAAa,mBAAmB,SAAS,CAAA;AAC/C,EAAA,MAAM,aAAgB,GAAA,CAAC,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAEjC,EAAO,OAAA;AAAA,IACN,OAAS,EAAA,aAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACR;AACD","file":"chunk-EAFZLNV4.js","sourcesContent":["import { createAssetOptions } from \"./create-asset-options\";\n\nexport function createContentFieldOptions<TPath extends `/${string}/`>(assetPath: TPath) {\n\tconst assetPaths = createAssetOptions(assetPath);\n\tconst headingLevels = [2, 3, 4, 5] as const;\n\n\treturn {\n\t\theading: headingLevels,\n\t\timage: assetPaths,\n\t};\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources.ts"],"names":[],"mappings":";AAKO,SAAS,WAAA,CAAyC,MAAa,MAAgB,EAAA;AACrF,EAAO,OAAA;AAAA,IACN,SAAW,EAAA,CAAA,gBAAA,EAAmB,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IAC3C,YAAc,EAAA,CAAA,mBAAA,EAAsB,MAAM,CAAA,EAAG,IAAI,CAAA;AAAA,GAClD;AACD;AAKO,SAAS,qBAAA,CAAmD,MAAa,MAAgB,EAAA;AAC/F,EAAO,OAAA;AAAA,IACN,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,CAAA;AAAA,IAC3B,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA,EAAA;AAAA,GACxC;AACD;AAEO,SAAS,oBAAA,CAAkD,MAAa,MAAgB,EAAA;AAC9F,EAAO,OAAA;AAAA,IACN,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,CAAA;AAAA,IAC3B,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA;AAAA,GACxC;AACD;AAEO,SAAS,gBAAA,CAMf,MACA,gCAIC,EAAA;AACD,EAAO,OAAA,SAAS,0BAA0B,MAAiB,EAAA;AAC1D,IAAM,MAAA,KAAA,GAAQ,qBAAsB,CAAA,IAAA,EAAM,MAAM,CAAA;AAChD,IAAO,OAAA,gCAAA,CAAiC,OAAO,MAAM,CAAA;AAAA,GACtD;AACD;AAEO,SAAS,eAAA,CAKf,MACA,+BAIC,EAAA;AACD,EAAO,OAAA,SAAS,yBAAyB,MAAiB,EAAA;AACzD,IAAM,MAAA,KAAA,GAAQ,oBAAqB,CAAA,IAAA,EAAM,MAAM,CAAA;AAC/C,IAAO,OAAA,+BAAA,CAAgC,OAAO,MAAM,CAAA;AAAA,GACrD;AACD","file":"chunk-FK3EHKPW.js","sourcesContent":["import type { Collection, ComponentSchema, Singleton } from \"@keystatic/core\";\n\nimport type { Locale } from \"./config\";\n\n/** @private */\nexport function createPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\tassetPath: `/content/assets/${locale}${path}`,\n\t\tdownloadPath: `/content/downloads/${locale}${path}`,\n\t} as const;\n}\n\n/** @private */\nexport type Paths<TPath extends `/${string}/`> = ReturnType<typeof createPaths<TPath>>;\n\nexport function createCollectionPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\t...createPaths(path, locale),\n\t\tcontentPath: `./content/${locale}${path}*/`,\n\t} as const;\n}\n\nexport function createSingletonPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\t...createPaths(path, locale),\n\t\tcontentPath: `./content/${locale}${path}`,\n\t} as const;\n}\n\nexport function createCollection<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTSchema extends Record<string, ComponentSchema>,\n\tTSlugField extends string,\n>(\n\tpath: TPath,\n\tcreateLocalisedCollectionFactory: (\n\t\tpaths: ReturnType<typeof createCollectionPaths<TPath>>,\n\t\tlocale: TLocale,\n\t) => Collection<TSchema, TSlugField>,\n) {\n\treturn function createLocalisedCollection(locale: TLocale) {\n\t\tconst paths = createCollectionPaths(path, locale);\n\t\treturn createLocalisedCollectionFactory(paths, locale);\n\t};\n}\n\nexport function createSingleton<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTSchema extends Record<string, ComponentSchema>,\n>(\n\tpath: TPath,\n\tcreateLocalisedSingletonFactory: (\n\t\tpaths: ReturnType<typeof createSingletonPaths<TPath>>,\n\t\tlocale: TLocale,\n\t) => Singleton<TSchema>,\n) {\n\treturn function createLocalisedSingleton(locale: TLocale) {\n\t\tconst paths = createSingletonPaths(path, locale);\n\t\treturn createLocalisedSingletonFactory(paths, locale);\n\t};\n}\n"]}
|