@acdh-oeaw/keystatic-lib 0.6.0 → 0.7.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.
Files changed (51) hide show
  1. package/dist/_virtual/rolldown_runtime.js +27 -0
  2. package/dist/config.d.ts +6 -5
  3. package/dist/config.js +1 -3
  4. package/dist/create-asset-options.d.ts +7 -7
  5. package/dist/create-asset-options.js +15 -2
  6. package/dist/create-asset-options.js.map +1 -1
  7. package/dist/create-component.d.ts +6 -5
  8. package/dist/create-component.js +9 -2
  9. package/dist/create-component.js.map +1 -1
  10. package/dist/create-content-field-options.d.ts +10 -10
  11. package/dist/create-content-field-options.js +19 -3
  12. package/dist/create-content-field-options.js.map +1 -1
  13. package/dist/create-label.d.ts +4 -2
  14. package/dist/create-label.js +7 -2
  15. package/dist/create-label.js.map +1 -1
  16. package/dist/index.d.ts +8 -9
  17. package/dist/index.js +8 -8
  18. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.development.js +718 -0
  19. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.development.js.map +1 -0
  20. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.production.js +354 -0
  21. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.production.js.map +1 -0
  22. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/index.js +15 -0
  23. package/dist/node_modules/.pnpm/react@19.1.1/node_modules/react/index.js.map +1 -0
  24. package/dist/preview/index.d.ts +7 -5
  25. package/dist/preview/index.js +21 -20
  26. package/dist/preview/index.js.map +1 -1
  27. package/dist/reader.d.ts +41 -38
  28. package/dist/reader.js +85 -84
  29. package/dist/reader.js.map +1 -1
  30. package/dist/resources.d.ts +14 -12
  31. package/dist/resources.js +34 -2
  32. package/dist/resources.js.map +1 -1
  33. package/dist/with-i18n-prefix.d.ts +5 -3
  34. package/dist/with-i18n-prefix.js +7 -2
  35. package/dist/with-i18n-prefix.js.map +1 -1
  36. package/license +1 -1
  37. package/package.json +44 -33
  38. package/dist/chunk-CI4JBTGG.js +0 -8
  39. package/dist/chunk-CI4JBTGG.js.map +0 -1
  40. package/dist/chunk-EEB35F4L.js +0 -15
  41. package/dist/chunk-EEB35F4L.js.map +0 -1
  42. package/dist/chunk-ENT7N2ZS.js +0 -16
  43. package/dist/chunk-ENT7N2ZS.js.map +0 -1
  44. package/dist/chunk-M7J4ISS4.js +0 -8
  45. package/dist/chunk-M7J4ISS4.js.map +0 -1
  46. package/dist/chunk-ZN3LEWB6.js +0 -35
  47. package/dist/chunk-ZN3LEWB6.js.map +0 -1
  48. package/dist/chunk-ZWZCXCMD.js +0 -10
  49. package/dist/chunk-ZWZCXCMD.js.map +0 -1
  50. package/dist/config.js.map +0 -1
  51. package/dist/index.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+ export { __commonJS, __toESM };
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region src/config.d.ts
1
2
  /**
2
3
  * Provide supported locales by augmenting the interface:
3
4
  *
@@ -7,10 +8,10 @@
7
8
  * }
8
9
  * ```
9
10
  */
10
- interface KeystaticConfig {
11
- }
11
+ interface KeystaticConfig {}
12
12
  type Locale = KeystaticConfig extends {
13
- locales: string;
13
+ locales: string;
14
14
  } ? KeystaticConfig["locales"] : string;
15
-
16
- export type { KeystaticConfig, Locale };
15
+ //#endregion
16
+ export { KeystaticConfig, Locale };
17
+ //# sourceMappingURL=config.d.ts.map
package/dist/config.js CHANGED
@@ -1,3 +1 @@
1
-
2
- //# sourceMappingURL=config.js.map
3
- //# sourceMappingURL=config.js.map
1
+ export { };
@@ -1,11 +1,11 @@
1
- import { Paths } from './resources.js';
2
- import '@keystatic/core';
3
- import './config.js';
1
+ import { Paths } from "./resources.js";
4
2
 
3
+ //#region src/create-asset-options.d.ts
5
4
  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}`;
8
- transformFilename(originalFilename: string): string;
5
+ directory: `./public/assets/content/assets/${string}${TPath}` | `./public/assets/content/downloads/${string}${TPath}`;
6
+ publicPath: `/assets/content/assets/${string}${TPath}` | `/assets/content/downloads/${string}${TPath}`;
7
+ transformFilename(originalFilename: string): string;
9
8
  };
10
-
9
+ //#endregion
11
10
  export { createAssetOptions };
11
+ //# sourceMappingURL=create-asset-options.d.ts.map
@@ -1,3 +1,16 @@
1
- export { createAssetOptions } from './chunk-ENT7N2ZS.js';
2
- //# sourceMappingURL=create-asset-options.js.map
1
+ import slugify from "@sindresorhus/slugify";
2
+
3
+ //#region src/create-asset-options.ts
4
+ function createAssetOptions(path) {
5
+ return {
6
+ directory: `./public/assets${path}`,
7
+ publicPath: `/assets${path}`,
8
+ transformFilename(originalFilename) {
9
+ return slugify(originalFilename, { preserveCharacters: ["."] });
10
+ }
11
+ };
12
+ }
13
+
14
+ //#endregion
15
+ export { createAssetOptions };
3
16
  //# sourceMappingURL=create-asset-options.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"create-asset-options.js"}
1
+ {"version":3,"file":"create-asset-options.js","names":[],"sources":["../src/create-asset-options.ts"],"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"],"mappings":";;;AAIA,SAAgB,mBACf,MACC;AACD,QAAO;EACN,WAAW,kBAAkB;EAC7B,YAAY,UAAU;EACtB,kBAAkB,kBAA0B;AAC3C,UAAO,QAAQ,kBAAkB,EAAE,oBAAoB,CAAC"}
@@ -1,8 +1,9 @@
1
- import { ContentComponent } from '@keystatic/core/content-components';
2
- import { Locale } from './config.js';
3
- import { Paths } from './resources.js';
4
- import '@keystatic/core';
1
+ import { Locale } from "./config.js";
2
+ import { Paths } from "./resources.js";
3
+ import { ContentComponent } from "@keystatic/core/content-components";
5
4
 
5
+ //#region src/create-component.d.ts
6
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;
7
-
7
+ //#endregion
8
8
  export { createComponent };
9
+ //# sourceMappingURL=create-component.d.ts.map
@@ -1,3 +1,10 @@
1
- export { createComponent } from './chunk-ZWZCXCMD.js';
2
- //# sourceMappingURL=create-component.js.map
1
+ //#region src/create-component.ts
2
+ function createComponent(createComponentFactory) {
3
+ return function createComponent$1(paths, locale) {
4
+ return createComponentFactory(paths, locale);
5
+ };
6
+ }
7
+
8
+ //#endregion
9
+ export { createComponent };
3
10
  //# sourceMappingURL=create-component.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"create-component.js"}
1
+ {"version":3,"file":"create-component.js","names":["createComponent"],"sources":["../src/create-component.ts"],"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"],"mappings":";AAKA,SAAgB,gBAId,wBAA+E;AAChF,QAAO,SAASA,kBAAgB,OAAqB,QAAiB;AACrE,SAAO,uBAAuB,OAAO"}
@@ -1,14 +1,14 @@
1
- import { Paths } from './resources.js';
2
- import '@keystatic/core';
3
- import './config.js';
1
+ import { Paths } from "./resources.js";
4
2
 
3
+ //#region src/create-content-field-options.d.ts
5
4
  declare function createContentFieldOptions<TPath extends `/${string}/`>(paths: Paths<TPath>): {
6
- heading: readonly [2, 3, 4, 5];
7
- image: {
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}`;
10
- transformFilename(originalFilename: string): string;
11
- };
5
+ heading: readonly [2, 3, 4, 5];
6
+ image: {
7
+ directory: `./public/assets/content/assets/${string}${TPath}` | `./public/assets/content/downloads/${string}${TPath}`;
8
+ publicPath: `/assets/content/assets/${string}${TPath}` | `/assets/content/downloads/${string}${TPath}`;
9
+ transformFilename(originalFilename: string): string;
10
+ };
12
11
  };
13
-
12
+ //#endregion
14
13
  export { createContentFieldOptions };
14
+ //# sourceMappingURL=create-content-field-options.d.ts.map
@@ -1,4 +1,20 @@
1
- export { createContentFieldOptions } from './chunk-EEB35F4L.js';
2
- import './chunk-ENT7N2ZS.js';
3
- //# sourceMappingURL=create-content-field-options.js.map
1
+ import { createAssetOptions } from "./create-asset-options.js";
2
+
3
+ //#region src/create-content-field-options.ts
4
+ function createContentFieldOptions(paths) {
5
+ const assetPaths = createAssetOptions(paths.assetPath);
6
+ const headingLevels = [
7
+ 2,
8
+ 3,
9
+ 4,
10
+ 5
11
+ ];
12
+ return {
13
+ heading: headingLevels,
14
+ image: assetPaths
15
+ };
16
+ }
17
+
18
+ //#endregion
19
+ export { createContentFieldOptions };
4
20
  //# sourceMappingURL=create-content-field-options.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"create-content-field-options.js"}
1
+ {"version":3,"file":"create-content-field-options.js","names":[],"sources":["../src/create-content-field-options.ts"],"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"],"mappings":";;;AAGA,SAAgB,0BAAuD,OAAqB;CAC3F,MAAM,aAAa,mBAAmB,MAAM;CAC5C,MAAM,gBAAgB;EAAC;EAAG;EAAG;EAAG;;AAEhC,QAAO;EACN,SAAS;EACT,OAAO"}
@@ -1,5 +1,7 @@
1
- import { Locale } from './config.js';
1
+ import { Locale } from "./config.js";
2
2
 
3
+ //#region src/create-label.d.ts
3
4
  declare function createLabel(label: string, locale: Locale): string;
4
-
5
+ //#endregion
5
6
  export { createLabel };
7
+ //# sourceMappingURL=create-label.d.ts.map
@@ -1,3 +1,8 @@
1
- export { createLabel } from './chunk-CI4JBTGG.js';
2
- //# sourceMappingURL=create-label.js.map
1
+ //#region src/create-label.ts
2
+ function createLabel(label, locale) {
3
+ return `${label} (${locale})`;
4
+ }
5
+
6
+ //#endregion
7
+ export { createLabel };
3
8
  //# sourceMappingURL=create-label.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"create-label.js"}
1
+ {"version":3,"file":"create-label.js","names":[],"sources":["../src/create-label.ts"],"sourcesContent":["import type { Locale } from \"./config\";\n\nexport function createLabel(label: string, locale: Locale) {\n\treturn `${label} (${locale})`;\n}\n"],"mappings":";AAEA,SAAgB,YAAY,OAAe,QAAgB;AAC1D,QAAO,GAAG,MAAM,IAAI,OAAO"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { KeystaticConfig } from './config.js';
2
- export { createAssetOptions } from './create-asset-options.js';
3
- export { createComponent } from './create-component.js';
4
- export { createContentFieldOptions } from './create-content-field-options.js';
5
- export { createLabel } from './create-label.js';
6
- export { Paths, createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './resources.js';
7
- export { WithoutI18nPrefix, withI18nPrefix } from './with-i18n-prefix.js';
8
- import '@keystatic/core/content-components';
9
- import '@keystatic/core';
1
+ import { KeystaticConfig } from "./config.js";
2
+ import { Paths, createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from "./resources.js";
3
+ import { createAssetOptions } from "./create-asset-options.js";
4
+ import { createComponent } from "./create-component.js";
5
+ import { createContentFieldOptions } from "./create-content-field-options.js";
6
+ import { createLabel } from "./create-label.js";
7
+ import { WithoutI18nPrefix, withI18nPrefix } from "./with-i18n-prefix.js";
8
+ export { type KeystaticConfig, type Paths, type WithoutI18nPrefix, createAssetOptions, createCollection, createCollectionPaths, createComponent, createContentFieldOptions, createLabel, createSingleton, createSingletonPaths, withI18nPrefix };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { createComponent } from './chunk-ZWZCXCMD.js';
2
- export { createContentFieldOptions } from './chunk-EEB35F4L.js';
3
- export { createAssetOptions } from './chunk-ENT7N2ZS.js';
4
- export { createLabel } from './chunk-CI4JBTGG.js';
5
- export { withI18nPrefix } from './chunk-M7J4ISS4.js';
6
- export { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from './chunk-ZN3LEWB6.js';
7
- //# sourceMappingURL=index.js.map
8
- //# sourceMappingURL=index.js.map
1
+ import { createAssetOptions } from "./create-asset-options.js";
2
+ import { createComponent } from "./create-component.js";
3
+ import { createContentFieldOptions } from "./create-content-field-options.js";
4
+ import { createLabel } from "./create-label.js";
5
+ import { createCollection, createCollectionPaths, createSingleton, createSingletonPaths } from "./resources.js";
6
+ import { withI18nPrefix } from "./with-i18n-prefix.js";
7
+
8
+ export { createAssetOptions, createCollection, createCollectionPaths, createComponent, createContentFieldOptions, createLabel, createSingleton, createSingletonPaths, withI18nPrefix };