@acdh-oeaw/keystatic-lib 0.4.1 → 0.5.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/create-label.ts"],"names":[],"mappings":";AAEO,SAAS,WAAA,CAAY,OAAe,MAAgB,EAAA;AAC1D,EAAO,OAAA,CAAA,EAAG,KAAK,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,CAAA,CAAA;AAC3B","file":"chunk-CI4JBTGG.js","sourcesContent":["import type { Locale } from \"./config\";\n\nexport function createLabel(label: string, locale: Locale) {\n\treturn `${label} (${locale})`;\n}\n"]}
1
+ {"version":3,"sources":["../src/create-label.ts"],"names":[],"mappings":";AAEO,SAAS,WAAA,CAAY,OAAe,MAAgB,EAAA;AAC1D,EAAO,OAAA,CAAA,EAAG,KAAK,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,CAAA;AAC3B","file":"chunk-CI4JBTGG.js","sourcesContent":["import type { Locale } from \"./config\";\n\nexport function createLabel(label: string, locale: Locale) {\n\treturn `${label} (${locale})`;\n}\n"]}
@@ -1,13 +1,19 @@
1
1
  // src/resources.ts
2
+ function createPaths(path, locale) {
3
+ return {
4
+ assetPath: `/content/assets/${locale}${path}`,
5
+ downloadPath: `/content/downloads/${locale}${path}`
6
+ };
7
+ }
2
8
  function createCollectionPaths(path, locale) {
3
9
  return {
4
- assetPath: `/content/${locale}${path}`,
10
+ ...createPaths(path, locale),
5
11
  contentPath: `./content/${locale}${path}*/`
6
12
  };
7
13
  }
8
14
  function createSingletonPaths(path, locale) {
9
15
  return {
10
- assetPath: `/content/${locale}${path}`,
16
+ ...createPaths(path, locale),
11
17
  contentPath: `./content/${locale}${path}`
12
18
  };
13
19
  }
@@ -24,6 +30,6 @@ function createSingleton(path, createLocalisedSingletonFactory) {
24
30
  };
25
31
  }
26
32
 
27
- export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths };
28
- //# sourceMappingURL=chunk-TQSIK35I.js.map
29
- //# sourceMappingURL=chunk-TQSIK35I.js.map
33
+ export { createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths };
34
+ //# sourceMappingURL=chunk-FK3EHKPW.js.map
35
+ //# sourceMappingURL=chunk-FK3EHKPW.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;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"]}
@@ -0,0 +1,15 @@
1
+ import { createAssetOptions } from './chunk-PU3H6JFY.js';
2
+
3
+ // src/create-content-field-options.ts
4
+ function createContentFieldOptions(paths) {
5
+ const assetPaths = createAssetOptions(paths);
6
+ const headingLevels = [2, 3, 4, 5];
7
+ return {
8
+ heading: headingLevels,
9
+ image: assetPaths
10
+ };
11
+ }
12
+
13
+ export { createContentFieldOptions };
14
+ //# sourceMappingURL=chunk-H5A2VGUF.js.map
15
+ //# sourceMappingURL=chunk-H5A2VGUF.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,mBAAmB,KAAK,CAAA;AAC3C,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-H5A2VGUF.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);\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 +1 @@
1
- {"version":3,"sources":["../src/with-i18n-prefix.ts"],"names":[],"mappings":";AAEO,SAAS,cAAA,CACf,OACA,MACC,EAAA;AACD,EAAO,OAAA,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,CAAA;AAC1B","file":"chunk-M7J4ISS4.js","sourcesContent":["import type { Locale } from \"./config\";\n\nexport function withI18nPrefix<TLabel extends string, TLocale extends Locale>(\n\tlabel: TLabel,\n\tlocale: TLocale,\n) {\n\treturn `${locale}:${label}` as const;\n}\n\nexport type WithoutI18nPrefix<\n\tT extends string,\n\tTLocale extends Locale,\n> = T extends `${TLocale}:${infer U}` ? U : T;\n"]}
1
+ {"version":3,"sources":["../src/with-i18n-prefix.ts"],"names":[],"mappings":";AAEO,SAAS,cAAA,CACf,OACA,MACC,EAAA;AACD,EAAO,OAAA,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA;AAC1B","file":"chunk-M7J4ISS4.js","sourcesContent":["import type { Locale } from \"./config\";\n\nexport function withI18nPrefix<TLabel extends string, TLocale extends Locale>(\n\tlabel: TLabel,\n\tlocale: TLocale,\n) {\n\treturn `${locale}:${label}` as const;\n}\n\nexport type WithoutI18nPrefix<\n\tT extends string,\n\tTLocale extends Locale,\n> = T extends `${TLocale}:${infer U}` ? U : T;\n"]}
@@ -1,10 +1,10 @@
1
1
  import slugify from '@sindresorhus/slugify';
2
2
 
3
3
  // src/create-asset-options.ts
4
- function createAssetOptions(path) {
4
+ function createAssetOptions(paths) {
5
5
  return {
6
- directory: `./public/assets${path}`,
7
- publicPath: `/assets${path}`,
6
+ directory: `./public/assets${paths.assetPath}`,
7
+ publicPath: `/assets${paths.assetPath}`,
8
8
  transformFilename(originalFilename) {
9
9
  return slugify(originalFilename, { preserveCharacters: ["."] });
10
10
  }
@@ -12,5 +12,5 @@ function createAssetOptions(path) {
12
12
  }
13
13
 
14
14
  export { createAssetOptions };
15
- //# sourceMappingURL=chunk-5ZKY25OZ.js.map
16
- //# sourceMappingURL=chunk-5ZKY25OZ.js.map
15
+ //# sourceMappingURL=chunk-PU3H6JFY.js.map
16
+ //# sourceMappingURL=chunk-PU3H6JFY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/create-asset-options.ts"],"names":[],"mappings":";;;AAIO,SAAS,mBAAgD,KAAqB,EAAA;AACpF,EAAO,OAAA;AAAA,IACN,SAAA,EAAW,CAAkB,eAAA,EAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAAA,IAC5C,UAAA,EAAY,CAAU,OAAA,EAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAAA,IACrC,kBAAkB,gBAA0B,EAAA;AAC3C,MAAA,OAAO,QAAQ,gBAAkB,EAAA,EAAE,oBAAoB,CAAC,GAAG,GAAG,CAAA;AAAA;AAC/D,GACD;AACD","file":"chunk-PU3H6JFY.js","sourcesContent":["import slugify from \"@sindresorhus/slugify\";\n\nimport type { Paths } from \"./resources\";\n\nexport function createAssetOptions<TPath extends `/${string}/`>(paths: Paths<TPath>) {\n\treturn {\n\t\tdirectory: `./public/assets${paths.assetPath}` as const,\n\t\tpublicPath: `/assets${paths.assetPath}` as const,\n\t\ttransformFilename(originalFilename: string) {\n\t\t\treturn slugify(originalFilename, { preserveCharacters: [\".\"] });\n\t\t},\n\t};\n}\n"]}
@@ -0,0 +1,10 @@
1
+ // src/create-component.ts
2
+ function createComponent(createComponentFactory) {
3
+ return function createComponent2(paths, locale) {
4
+ return createComponentFactory(paths, locale);
5
+ };
6
+ }
7
+
8
+ export { createComponent };
9
+ //# sourceMappingURL=chunk-ZWZCXCMD.js.map
10
+ //# sourceMappingURL=chunk-ZWZCXCMD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/create-component.ts"],"names":["createComponent"],"mappings":";AAKO,SAAS,gBAId,sBAA+E,EAAA;AAChF,EAAO,OAAA,SAASA,gBAAgB,CAAA,KAAA,EAAqB,MAAiB,EAAA;AACrE,IAAO,OAAA,sBAAA,CAAuB,OAAO,MAAM,CAAA;AAAA,GAC5C;AACD","file":"chunk-ZWZCXCMD.js","sourcesContent":["import type { ContentComponent } from \"@keystatic/core/content-components\";\n\nimport type { Locale } from \"./config\";\nimport type { Paths } from \"./resources\";\n\nexport function createComponent<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTComponents extends Record<string, ContentComponent>,\n>(createComponentFactory: (paths: Paths<TPath>, locale: TLocale) => TComponents) {\n\treturn function createComponent(paths: Paths<TPath>, locale: TLocale) {\n\t\treturn createComponentFactory(paths, locale);\n\t};\n}\n"]}
@@ -1,6 +1,10 @@
1
- declare function createAssetOptions<TPath extends `/${string}/`>(path: TPath): {
2
- directory: `./public/assets${TPath}`;
3
- publicPath: `/assets${TPath}`;
1
+ import { Paths } from './resources.js';
2
+ import '@keystatic/core';
3
+ import './config.js';
4
+
5
+ declare function createAssetOptions<TPath extends `/${string}/`>(paths: Paths<TPath>): {
6
+ directory: `./public/assets/content/assets/${string}${TPath}`;
7
+ publicPath: `/assets/content/assets/${string}${TPath}`;
4
8
  transformFilename(originalFilename: string): string;
5
9
  };
6
10
 
@@ -1,3 +1,3 @@
1
- export { createAssetOptions } from './chunk-5ZKY25OZ.js';
1
+ export { createAssetOptions } from './chunk-PU3H6JFY.js';
2
2
  //# sourceMappingURL=create-asset-options.js.map
3
3
  //# sourceMappingURL=create-asset-options.js.map
@@ -1,6 +1,8 @@
1
1
  import { ContentComponent } from '@keystatic/core/content-components';
2
2
  import { Locale } from './config.js';
3
+ import { Paths } from './resources.js';
4
+ import '@keystatic/core';
3
5
 
4
- declare function createComponent<TPath extends `/${string}/`, TLocale extends Locale, TComponents extends Record<string, ContentComponent>>(createComponentFactory: (assetPath: TPath, locale: TLocale) => TComponents): (assetPath: TPath, locale: TLocale) => TComponents;
6
+ declare function createComponent<TPath extends `/${string}/`, TLocale extends Locale, TComponents extends Record<string, ContentComponent>>(createComponentFactory: (paths: Paths<TPath>, locale: TLocale) => TComponents): (paths: Paths<TPath>, locale: TLocale) => TComponents;
5
7
 
6
8
  export { createComponent };
@@ -1,3 +1,3 @@
1
- export { createComponent } from './chunk-X5LBXMLP.js';
1
+ export { createComponent } from './chunk-ZWZCXCMD.js';
2
2
  //# sourceMappingURL=create-component.js.map
3
3
  //# sourceMappingURL=create-component.js.map
@@ -1,8 +1,12 @@
1
- declare function createContentFieldOptions<TPath extends `/${string}/`>(assetPath: TPath): {
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}`;
9
+ publicPath: `/assets/content/assets/${string}${TPath}`;
6
10
  transformFilename(originalFilename: string): string;
7
11
  };
8
12
  };
@@ -1,4 +1,4 @@
1
- export { createContentFieldOptions } from './chunk-EAFZLNV4.js';
2
- import './chunk-5ZKY25OZ.js';
1
+ export { createContentFieldOptions } from './chunk-H5A2VGUF.js';
2
+ import './chunk-PU3H6JFY.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
- export { createComponent } from './chunk-X5LBXMLP.js';
2
- export { createContentFieldOptions } from './chunk-EAFZLNV4.js';
3
- export { createAssetOptions } from './chunk-5ZKY25OZ.js';
1
+ export { createComponent } from './chunk-ZWZCXCMD.js';
2
+ export { createContentFieldOptions } from './chunk-H5A2VGUF.js';
3
+ export { createAssetOptions } from './chunk-PU3H6JFY.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-TQSIK35I.js';
6
+ export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './chunk-FK3EHKPW.js';
7
7
  //# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/preview/index.ts"],"names":["url"],"mappings":";;;AASO,SAAS,aAAa,MAAmC,EAAA;AAC/D,EAAA,MAAM,OAAO,MAAQ,EAAA,IAAA,CAAA;AACrB,EAAA,MAAM,WAAc,GAAA,MAAA,EAAQ,SAAc,KAAA,KAAA,GAAQ,eAAkB,GAAA,KAAA,CAAA,CAAA;AAEpE,EAAA,MAAM,CAAC,GAAA,EAAK,MAAM,CAAA,GAAI,SAAwB,IAAI,CAAA,CAAA;AAElD,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,IAAI,QAAQ,IAAM,EAAA;AACjB,MAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AACX,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACR;AAEA,IAAA,MAAMA,OAAM,GAAI,CAAA,eAAA;AAAA,MACf,IAAI,IAAK,CAAA,CAAC,IAAI,CAAA,EAAG,cAAc,EAAE,IAAA,EAAM,WAAY,EAAA,GAAI,KAAS,CAAA,CAAA;AAAA,KACjE,CAAA;AACA,IAAA,MAAA,CAAOA,IAAG,CAAA,CAAA;AAEV,IAAA,OAAO,MAAM;AACZ,MAAA,GAAA,CAAI,gBAAgBA,IAAG,CAAA,CAAA;AAAA,KACxB,CAAA;AAAA,GACE,EAAA,CAAC,WAAa,EAAA,IAAI,CAAC,CAAA,CAAA;AAEtB,EAAO,OAAA,GAAA,CAAA;AACR","file":"index.js","sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport interface UseObjectUrlParams {\n\tdata: Uint8Array;\n\textension: string;\n\tfilename: string;\n}\n\n/** @see https://github.com/Thinkmill/keystatic/blob/main/packages/keystatic/src/form/fields/image/ui.tsx#L48-L63 */\nexport function useObjectUrl(params: UseObjectUrlParams | null) {\n\tconst data = params?.data;\n\tconst contentType = params?.extension === \"svg\" ? \"image/svg+xml\" : undefined;\n\n\tconst [url, setUrl] = useState<string | null>(null);\n\n\tuseEffect(() => {\n\t\tif (data == null) {\n\t\t\tsetUrl(null);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst url = URL.createObjectURL(\n\t\t\tnew Blob([data], contentType ? { type: contentType } : undefined),\n\t\t);\n\t\tsetUrl(url);\n\n\t\treturn () => {\n\t\t\tURL.revokeObjectURL(url);\n\t\t};\n\t}, [contentType, data]);\n\n\treturn url;\n}\n"]}
1
+ {"version":3,"sources":["../../src/preview/index.ts"],"names":["url"],"mappings":";;;AASO,SAAS,aAAa,MAAmC,EAAA;AAC/D,EAAA,MAAM,OAAO,MAAQ,EAAA,IAAA;AACrB,EAAA,MAAM,WAAc,GAAA,MAAA,EAAQ,SAAc,KAAA,KAAA,GAAQ,eAAkB,GAAA,KAAA,CAAA;AAEpE,EAAA,MAAM,CAAC,GAAA,EAAK,MAAM,CAAA,GAAI,SAAwB,IAAI,CAAA;AAElD,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,IAAI,QAAQ,IAAM,EAAA;AACjB,MAAA,MAAA,CAAO,IAAI,CAAA;AACX,MAAO,OAAA,KAAA,CAAA;AAAA;AAGR,IAAA,MAAMA,OAAM,GAAI,CAAA,eAAA;AAAA,MACf,IAAI,IAAK,CAAA,CAAC,IAAI,CAAA,EAAG,cAAc,EAAE,IAAA,EAAM,WAAY,EAAA,GAAI,KAAS,CAAA;AAAA,KACjE;AACA,IAAA,MAAA,CAAOA,IAAG,CAAA;AAEV,IAAA,OAAO,MAAM;AACZ,MAAA,GAAA,CAAI,gBAAgBA,IAAG,CAAA;AAAA,KACxB;AAAA,GACE,EAAA,CAAC,WAAa,EAAA,IAAI,CAAC,CAAA;AAEtB,EAAO,OAAA,GAAA;AACR","file":"index.js","sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport interface UseObjectUrlParams {\n\tdata: Uint8Array;\n\textension: string;\n\tfilename: string;\n}\n\n/** @see https://github.com/Thinkmill/keystatic/blob/main/packages/keystatic/src/form/fields/image/ui.tsx#L48-L63 */\nexport function useObjectUrl(params: UseObjectUrlParams | null) {\n\tconst data = params?.data;\n\tconst contentType = params?.extension === \"svg\" ? \"image/svg+xml\" : undefined;\n\n\tconst [url, setUrl] = useState<string | null>(null);\n\n\tuseEffect(() => {\n\t\tif (data == null) {\n\t\t\tsetUrl(null);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst url = URL.createObjectURL(\n\t\t\tnew Blob([data], contentType ? { type: contentType } : undefined),\n\t\t);\n\t\tsetUrl(url);\n\n\t\treturn () => {\n\t\t\tURL.revokeObjectURL(url);\n\t\t};\n\t}, [contentType, data]);\n\n\treturn url;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/reader.ts"],"names":["createLocalReader"],"mappings":"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","file":"reader.js","sourcesContent":["import assert from \"node:assert/strict\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { Collection, ComponentSchema, Config, Singleton } from \"@keystatic/core\";\nimport { createReader as createLocalReader } from \"@keystatic/core/reader\";\nimport { createGitHubReader } from \"@keystatic/core/reader/github\";\nimport type { MDXModule } from \"mdx/types\";\n\nimport type { Locale } from \"./config\";\nimport { withI18nPrefix, type WithoutI18nPrefix } from \"./with-i18n-prefix\";\n\ntype GitHubReaderConfig = Parameters<typeof createGitHubReader>[1];\n\nexport function createReader<\n\tTCollections extends Record<string, Collection<Record<string, ComponentSchema>, string>>,\n\tTSingletons extends Record<string, Singleton<Record<string, ComponentSchema>>>,\n>(\n\tconfig: Config<TCollections, TSingletons>,\n\tgetGitHubReaderConfig?: () => GitHubReaderConfig | null,\n) {\n\tconst gitHubConfig = getGitHubReaderConfig?.();\n\n\tif (gitHubConfig != null) {\n\t\treturn createGitHubReader(config, gitHubConfig);\n\t}\n\n\treturn createLocalReader(process.cwd(), config);\n}\n\nexport function createReaders<\n\tTCollections extends Record<string, Collection<Record<string, ComponentSchema>, string>>,\n\tTSingletons extends Record<string, Singleton<Record<string, ComponentSchema>>>,\n\tTLocale extends Locale,\n\tTMdxContent extends MDXModule,\n>(\n\tconfig: Config<TCollections, TSingletons>,\n\tgetMdxContent: (code: string, locale: TLocale, baseUrl: URL) => Promise<TMdxContent>,\n) {\n\tfunction createCollectionResource<\n\t\tTKeys extends WithoutI18nPrefix<keyof TCollections & string, TLocale>,\n\t>(name: TKeys, locale: TLocale) {\n\t\tconst reader = createReader(config);\n\t\tconst collectionName = withI18nPrefix(name, locale);\n\n\t\tconst collectionReader = reader.collections[collectionName];\n\t\tconst collectionConfig = reader.config.collections?.[collectionName];\n\n\t\tassert(collectionConfig?.path);\n\n\t\tfunction baseUrl(id: string) {\n\t\t\treturn pathToFileURL(join(process.cwd(), collectionConfig!.path!.replace(/\\*+/, id)));\n\t\t}\n\n\t\tasync function compile(id: string, code: string) {\n\t\t\treturn getMdxContent(code, locale, baseUrl(id));\n\t\t}\n\n\t\tfunction list() {\n\t\t\treturn collectionReader.list();\n\t\t}\n\n\t\tasync function read(id: string) {\n\t\t\tconst data = await collectionReader.readOrThrow(id, { resolveLinkedFiles: true });\n\n\t\t\treturn {\n\t\t\t\tcollection: name,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tcompile(code: string) {\n\t\t\t\t\treturn compile(id, code);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tasync function all() {\n\t\t\tconst ids = await list();\n\n\t\t\treturn Promise.all(ids.map(read));\n\t\t}\n\n\t\treturn {\n\t\t\tall,\n\t\t\tbaseUrl,\n\t\t\tcompile,\n\t\t\tlist,\n\t\t\tread,\n\t\t};\n\t}\n\n\tfunction createSingletonResource<\n\t\tTKeys extends WithoutI18nPrefix<keyof TSingletons & string, TLocale>,\n\t>(name: TKeys, locale: TLocale) {\n\t\tconst reader = createReader(config);\n\t\tconst i18nName = withI18nPrefix(name, locale);\n\n\t\tconst singletonReader = reader.singletons[i18nName];\n\t\tconst singletonConfig = reader.config.singletons?.[i18nName];\n\n\t\tassert(singletonConfig?.path);\n\n\t\tfunction baseUrl() {\n\t\t\treturn pathToFileURL(join(process.cwd(), singletonConfig!.path!));\n\t\t}\n\n\t\tasync function compile(code: string) {\n\t\t\treturn getMdxContent(code, locale, baseUrl());\n\t\t}\n\n\t\tasync function read() {\n\t\t\tconst data = await singletonReader.readOrThrow({ resolveLinkedFiles: true });\n\n\t\t\treturn {\n\t\t\t\tsingleton: name,\n\t\t\t\tdata,\n\t\t\t\tcompile,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tbaseUrl,\n\t\t\tcompile,\n\t\t\tread,\n\t\t};\n\t}\n\n\treturn {\n\t\tcreateCollectionResource,\n\t\tcreateSingletonResource,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../src/reader.ts"],"names":["createLocalReader"],"mappings":";;;;;;;AAcO,SAAS,YAAA,CAIf,QACA,qBACC,EAAA;AACD,EAAA,MAAM,eAAe,qBAAwB,IAAA;AAE7C,EAAA,IAAI,gBAAgB,IAAM,EAAA;AACzB,IAAO,OAAA,kBAAA,CAAmB,QAAQ,YAAY,CAAA;AAAA;AAG/C,EAAA,OAAOA,cAAkB,CAAA,OAAA,CAAQ,GAAI,EAAA,EAAG,MAAM,CAAA;AAC/C;AAEO,SAAS,aAAA,CAMf,QACA,aACC,EAAA;AACD,EAAS,SAAA,wBAAA,CAEP,MAAa,MAAiB,EAAA;AAC/B,IAAM,MAAA,MAAA,GAAS,aAAa,MAAM,CAAA;AAClC,IAAM,MAAA,cAAA,GAAiB,cAAe,CAAA,IAAA,EAAM,MAAM,CAAA;AAElD,IAAM,MAAA,gBAAA,GAAmB,MAAO,CAAA,WAAA,CAAY,cAAc,CAAA;AAC1D,IAAA,MAAM,gBAAmB,GAAA,MAAA,CAAO,MAAO,CAAA,WAAA,GAAc,cAAc,CAAA;AAEnE,IAAA,MAAA,CAAO,kBAAkB,IAAI,CAAA;AAE7B,IAAA,SAAS,QAAQ,EAAY,EAAA;AAC5B,MAAO,OAAA,aAAA,CAAc,IAAK,CAAA,OAAA,CAAQ,GAAI,EAAA,EAAG,gBAAkB,CAAA,IAAA,CAAM,OAAQ,CAAA,KAAA,EAAO,EAAE,CAAC,CAAC,CAAA;AAAA;AAGrF,IAAe,eAAA,OAAA,CAAQ,IAAY,IAAc,EAAA;AAChD,MAAA,OAAO,aAAc,CAAA,IAAA,EAAM,MAAQ,EAAA,OAAA,CAAQ,EAAE,CAAC,CAAA;AAAA;AAG/C,IAAA,SAAS,IAAO,GAAA;AACf,MAAA,OAAO,iBAAiB,IAAK,EAAA;AAAA;AAG9B,IAAA,eAAe,KAAK,EAAY,EAAA;AAC/B,MAAM,MAAA,IAAA,GAAO,MAAM,gBAAiB,CAAA,WAAA,CAAY,IAAI,EAAE,kBAAA,EAAoB,MAAM,CAAA;AAEhF,MAAO,OAAA;AAAA,QACN,UAAY,EAAA,IAAA;AAAA,QACZ,EAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAQ,IAAc,EAAA;AACrB,UAAO,OAAA,OAAA,CAAQ,IAAI,IAAI,CAAA;AAAA;AACxB,OACD;AAAA;AAGD,IAAA,eAAe,GAAM,GAAA;AACpB,MAAM,MAAA,GAAA,GAAM,MAAM,IAAK,EAAA;AAEvB,MAAA,OAAO,OAAQ,CAAA,GAAA,CAAI,GAAI,CAAA,GAAA,CAAI,IAAI,CAAC,CAAA;AAAA;AAGjC,IAAO,OAAA;AAAA,MACN,GAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACD;AAAA;AAGD,EAAS,SAAA,uBAAA,CAEP,MAAa,MAAiB,EAAA;AAC/B,IAAM,MAAA,MAAA,GAAS,aAAa,MAAM,CAAA;AAClC,IAAM,MAAA,QAAA,GAAW,cAAe,CAAA,IAAA,EAAM,MAAM,CAAA;AAE5C,IAAM,MAAA,eAAA,GAAkB,MAAO,CAAA,UAAA,CAAW,QAAQ,CAAA;AAClD,IAAA,MAAM,eAAkB,GAAA,MAAA,CAAO,MAAO,CAAA,UAAA,GAAa,QAAQ,CAAA;AAE3D,IAAA,MAAA,CAAO,iBAAiB,IAAI,CAAA;AAE5B,IAAA,SAAS,OAAU,GAAA;AAClB,MAAA,OAAO,cAAc,IAAK,CAAA,OAAA,CAAQ,KAAO,EAAA,eAAA,CAAiB,IAAK,CAAC,CAAA;AAAA;AAGjE,IAAA,eAAe,QAAQ,IAAc,EAAA;AACpC,MAAA,OAAO,aAAc,CAAA,IAAA,EAAM,MAAQ,EAAA,OAAA,EAAS,CAAA;AAAA;AAG7C,IAAA,eAAe,IAAO,GAAA;AACrB,MAAA,MAAM,OAAO,MAAM,eAAA,CAAgB,YAAY,EAAE,kBAAA,EAAoB,MAAM,CAAA;AAE3E,MAAO,OAAA;AAAA,QACN,SAAW,EAAA,IAAA;AAAA,QACX,IAAA;AAAA,QACA;AAAA,OACD;AAAA;AAGD,IAAO,OAAA;AAAA,MACN,OAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD;AAAA;AAGD,EAAO,OAAA;AAAA,IACN,wBAAA;AAAA,IACA;AAAA,GACD;AACD","file":"reader.js","sourcesContent":["import assert from \"node:assert/strict\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { Collection, ComponentSchema, Config, Singleton } from \"@keystatic/core\";\nimport { createReader as createLocalReader } from \"@keystatic/core/reader\";\nimport { createGitHubReader } from \"@keystatic/core/reader/github\";\nimport type { MDXModule } from \"mdx/types\";\n\nimport type { Locale } from \"./config\";\nimport { withI18nPrefix, type WithoutI18nPrefix } from \"./with-i18n-prefix\";\n\ntype GitHubReaderConfig = Parameters<typeof createGitHubReader>[1];\n\nexport function createReader<\n\tTCollections extends Record<string, Collection<Record<string, ComponentSchema>, string>>,\n\tTSingletons extends Record<string, Singleton<Record<string, ComponentSchema>>>,\n>(\n\tconfig: Config<TCollections, TSingletons>,\n\tgetGitHubReaderConfig?: () => GitHubReaderConfig | null,\n) {\n\tconst gitHubConfig = getGitHubReaderConfig?.();\n\n\tif (gitHubConfig != null) {\n\t\treturn createGitHubReader(config, gitHubConfig);\n\t}\n\n\treturn createLocalReader(process.cwd(), config);\n}\n\nexport function createReaders<\n\tTCollections extends Record<string, Collection<Record<string, ComponentSchema>, string>>,\n\tTSingletons extends Record<string, Singleton<Record<string, ComponentSchema>>>,\n\tTLocale extends Locale,\n\tTMdxContent extends MDXModule,\n>(\n\tconfig: Config<TCollections, TSingletons>,\n\tgetMdxContent: (code: string, locale: TLocale, baseUrl: URL) => Promise<TMdxContent>,\n) {\n\tfunction createCollectionResource<\n\t\tTKeys extends WithoutI18nPrefix<keyof TCollections & string, TLocale>,\n\t>(name: TKeys, locale: TLocale) {\n\t\tconst reader = createReader(config);\n\t\tconst collectionName = withI18nPrefix(name, locale);\n\n\t\tconst collectionReader = reader.collections[collectionName];\n\t\tconst collectionConfig = reader.config.collections?.[collectionName];\n\n\t\tassert(collectionConfig?.path);\n\n\t\tfunction baseUrl(id: string) {\n\t\t\treturn pathToFileURL(join(process.cwd(), collectionConfig!.path!.replace(/\\*+/, id)));\n\t\t}\n\n\t\tasync function compile(id: string, code: string) {\n\t\t\treturn getMdxContent(code, locale, baseUrl(id));\n\t\t}\n\n\t\tfunction list() {\n\t\t\treturn collectionReader.list();\n\t\t}\n\n\t\tasync function read(id: string) {\n\t\t\tconst data = await collectionReader.readOrThrow(id, { resolveLinkedFiles: true });\n\n\t\t\treturn {\n\t\t\t\tcollection: name,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tcompile(code: string) {\n\t\t\t\t\treturn compile(id, code);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tasync function all() {\n\t\t\tconst ids = await list();\n\n\t\t\treturn Promise.all(ids.map(read));\n\t\t}\n\n\t\treturn {\n\t\t\tall,\n\t\t\tbaseUrl,\n\t\t\tcompile,\n\t\t\tlist,\n\t\t\tread,\n\t\t};\n\t}\n\n\tfunction createSingletonResource<\n\t\tTKeys extends WithoutI18nPrefix<keyof TSingletons & string, TLocale>,\n\t>(name: TKeys, locale: TLocale) {\n\t\tconst reader = createReader(config);\n\t\tconst i18nName = withI18nPrefix(name, locale);\n\n\t\tconst singletonReader = reader.singletons[i18nName];\n\t\tconst singletonConfig = reader.config.singletons?.[i18nName];\n\n\t\tassert(singletonConfig?.path);\n\n\t\tfunction baseUrl() {\n\t\t\treturn pathToFileURL(join(process.cwd(), singletonConfig!.path!));\n\t\t}\n\n\t\tasync function compile(code: string) {\n\t\t\treturn getMdxContent(code, locale, baseUrl());\n\t\t}\n\n\t\tasync function read() {\n\t\t\tconst data = await singletonReader.readOrThrow({ resolveLinkedFiles: true });\n\n\t\t\treturn {\n\t\t\t\tsingleton: name,\n\t\t\t\tdata,\n\t\t\t\tcompile,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tbaseUrl,\n\t\t\tcompile,\n\t\t\tread,\n\t\t};\n\t}\n\n\treturn {\n\t\tcreateCollectionResource,\n\t\tcreateSingletonResource,\n\t};\n}\n"]}
@@ -1,15 +1,24 @@
1
1
  import { ComponentSchema, Collection, Singleton } from '@keystatic/core';
2
2
  import { Locale } from './config.js';
3
3
 
4
+ /** @private */
5
+ declare function createPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale): {
6
+ readonly assetPath: `/content/assets/${string}${TPath}`;
7
+ readonly downloadPath: `/content/downloads/${string}${TPath}`;
8
+ };
9
+ /** @private */
10
+ type Paths<TPath extends `/${string}/`> = ReturnType<typeof createPaths<TPath>>;
4
11
  declare function createCollectionPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale): {
5
- readonly assetPath: `/content/${string}${TPath}`;
6
12
  readonly contentPath: `./content/${string}${TPath}*/`;
13
+ readonly assetPath: `/content/assets/${string}${TPath}`;
14
+ readonly downloadPath: `/content/downloads/${string}${TPath}`;
7
15
  };
8
16
  declare function createSingletonPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale): {
9
- readonly assetPath: `/content/${string}${TPath}`;
10
17
  readonly contentPath: `./content/${string}${TPath}`;
18
+ readonly assetPath: `/content/assets/${string}${TPath}`;
19
+ readonly downloadPath: `/content/downloads/${string}${TPath}`;
11
20
  };
12
21
  declare function createCollection<TPath extends `/${string}/`, TLocale extends Locale, TSchema extends Record<string, ComponentSchema>, TSlugField extends string>(path: TPath, createLocalisedCollectionFactory: (paths: ReturnType<typeof createCollectionPaths<TPath>>, locale: TLocale) => Collection<TSchema, TSlugField>): (locale: TLocale) => Collection<TSchema, TSlugField>;
13
22
  declare function createSingleton<TPath extends `/${string}/`, TLocale extends Locale, TSchema extends Record<string, ComponentSchema>>(path: TPath, createLocalisedSingletonFactory: (paths: ReturnType<typeof createSingletonPaths<TPath>>, locale: TLocale) => Singleton<TSchema>): (locale: TLocale) => Singleton<TSchema>;
14
23
 
15
- export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths };
24
+ export { type Paths, createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths };
package/dist/resources.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './chunk-TQSIK35I.js';
1
+ export { createCollection, createCollectionPaths, createPaths, createSingleton, createSingletonPaths } from './chunk-FK3EHKPW.js';
2
2
  //# sourceMappingURL=resources.js.map
3
3
  //# sourceMappingURL=resources.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acdh-oeaw/keystatic-lib",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,29 +25,29 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@acdh-oeaw/commitlint-config": "^2.0.0",
28
- "@acdh-oeaw/eslint-config": "^2.0.1",
29
- "@acdh-oeaw/eslint-config-node": "^2.0.1",
30
- "@acdh-oeaw/eslint-config-react": "^2.0.2",
28
+ "@acdh-oeaw/eslint-config": "^2.0.5",
29
+ "@acdh-oeaw/eslint-config-node": "^2.0.5",
30
+ "@acdh-oeaw/eslint-config-react": "^2.0.6",
31
31
  "@acdh-oeaw/prettier-config": "^2.0.0",
32
32
  "@acdh-oeaw/tsconfig-lib": "^1.1.1",
33
33
  "@changesets/changelog-github": "^0.5.0",
34
- "@changesets/cli": "^2.27.8",
35
- "@commitlint/cli": "^19.5.0",
36
- "@keystatic/core": "^0.5.35",
37
- "@types/node": "^22.5.4",
38
- "@types/react": "^18.3.5",
39
- "eslint": "^9.10.0",
34
+ "@changesets/cli": "^2.27.10",
35
+ "@commitlint/cli": "^19.6.0",
36
+ "@keystatic/core": "^0.5.42",
37
+ "@types/node": "^22.10.1",
38
+ "@types/react": "^18.3.13",
39
+ "eslint": "^9.16.0",
40
40
  "eslint-config-flat-gitignore": "^0.3.0",
41
- "globals": "^15.9.0",
41
+ "globals": "^15.13.0",
42
42
  "is-ci": "^3.0.1",
43
43
  "lint-staged": "^15.2.10",
44
- "npm-run-all2": "^6.2.2",
45
- "prettier": "^3.3.3",
44
+ "npm-run-all2": "^7.0.1",
45
+ "prettier": "^3.4.2",
46
46
  "react": "^18.3.1",
47
47
  "simple-git-hooks": "^2.11.1",
48
- "tsup": "^8.2.4",
49
- "tsx": "^4.19.1",
50
- "typescript": "^5.6.2"
48
+ "tsup": "^8.3.5",
49
+ "tsx": "^4.19.2",
50
+ "typescript": "^5.7.2"
51
51
  },
52
52
  "commitlint": {
53
53
  "extends": "@acdh-oeaw/commitlint-config"
@@ -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,CAAA;AAAA,KAC/D;AAAA,GACD,CAAA;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"]}
@@ -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,CAAA;AAC/C,EAAA,MAAM,aAAgB,GAAA,CAAC,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA;AAEjC,EAAO,OAAA;AAAA,IACN,OAAS,EAAA,aAAA;AAAA,IACT,KAAO,EAAA,UAAA;AAAA,GACR,CAAA;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":";AAIO,SAAS,qBAAA,CAAmD,MAAa,MAAgB,EAAA;AAC/F,EAAO,OAAA;AAAA,IACN,SAAW,EAAA,CAAA,SAAA,EAAY,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IACpC,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA,EAAA,CAAA;AAAA,GACxC,CAAA;AACD,CAAA;AAEO,SAAS,oBAAA,CAAkD,MAAa,MAAgB,EAAA;AAC9F,EAAO,OAAA;AAAA,IACN,SAAW,EAAA,CAAA,SAAA,EAAY,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IACpC,WAAa,EAAA,CAAA,UAAA,EAAa,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,GACxC,CAAA;AACD,CAAA;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,CAAA;AAChD,IAAO,OAAA,gCAAA,CAAiC,OAAO,MAAM,CAAA,CAAA;AAAA,GACtD,CAAA;AACD,CAAA;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,CAAA;AAC/C,IAAO,OAAA,+BAAA,CAAgC,OAAO,MAAM,CAAA,CAAA;AAAA,GACrD,CAAA;AACD","file":"chunk-TQSIK35I.js","sourcesContent":["import type { Collection, ComponentSchema, Singleton } from \"@keystatic/core\";\n\nimport type { Locale } from \"./config\";\n\nexport function createCollectionPaths<TPath extends `/${string}/`>(path: TPath, locale: Locale) {\n\treturn {\n\t\tassetPath: `/content/${locale}${path}`,\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\tassetPath: `/content/${locale}${path}`,\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"]}
@@ -1,10 +0,0 @@
1
- // src/create-component.ts
2
- function createComponent(createComponentFactory) {
3
- return function createComponent2(assetPath, locale) {
4
- return createComponentFactory(assetPath, locale);
5
- };
6
- }
7
-
8
- export { createComponent };
9
- //# sourceMappingURL=chunk-X5LBXMLP.js.map
10
- //# sourceMappingURL=chunk-X5LBXMLP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/create-component.ts"],"names":["createComponent"],"mappings":";AAIO,SAAS,gBAId,sBAA4E,EAAA;AAC7E,EAAO,OAAA,SAASA,gBAAgB,CAAA,SAAA,EAAkB,MAAiB,EAAA;AAClE,IAAO,OAAA,sBAAA,CAAuB,WAAW,MAAM,CAAA,CAAA;AAAA,GAChD,CAAA;AACD","file":"chunk-X5LBXMLP.js","sourcesContent":["import type { ContentComponent } from \"@keystatic/core/content-components\";\n\nimport type { Locale } from \"./config\";\n\nexport function createComponent<\n\tTPath extends `/${string}/`,\n\tTLocale extends Locale,\n\tTComponents extends Record<string, ContentComponent>,\n>(createComponentFactory: (assetPath: TPath, locale: TLocale) => TComponents) {\n\treturn function createComponent(assetPath: TPath, locale: TLocale) {\n\t\treturn createComponentFactory(assetPath, locale);\n\t};\n}\n"]}