alinea 0.4.0 → 0.4.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.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/dist/alinea.d.ts +1 -1
  3. package/dist/alinea.js +1 -10
  4. package/dist/backend/Handler.js +2 -1
  5. package/dist/backend/resolver/EntryResolver.d.ts +3 -36
  6. package/dist/backend/resolver/EntryResolver.js +31 -105
  7. package/dist/backend/resolver/LinkResolver.d.ts +1 -1
  8. package/dist/backend/resolver/LinkResolver.js +3 -3
  9. package/dist/backend/resolver/ResolveContext.d.ts +38 -0
  10. package/dist/backend/resolver/ResolveContext.js +83 -0
  11. package/dist/chunks/{chunk-KDSPNPHI.js → chunk-LRUUF55J.js} +2 -2
  12. package/dist/cli/Serve.js +1 -1
  13. package/dist/cli/bin.js +1 -1
  14. package/dist/cli/generate/GenerateDashboard.js +1 -1
  15. package/dist/cli.js +0 -0
  16. package/dist/cloud/server/CloudAuthServer.js +1 -1
  17. package/dist/core/Field.d.ts +0 -26
  18. package/dist/core/Field.js +0 -56
  19. package/dist/core/Graph.js +4 -4
  20. package/dist/core/Type.js +9 -3
  21. package/dist/core/View.js +2 -2
  22. package/dist/core/driver/NextDriver.server.js +2 -2
  23. package/dist/core/field/ListField.d.ts +8 -0
  24. package/dist/core/field/ListField.js +21 -0
  25. package/dist/core/field/RecordField.d.ts +5 -0
  26. package/dist/core/field/RecordField.js +12 -0
  27. package/dist/core/field/RichTextField.d.ts +9 -0
  28. package/dist/core/field/RichTextField.js +16 -0
  29. package/dist/core/field/ScalarField.d.ts +4 -0
  30. package/dist/core/field/ScalarField.js +16 -0
  31. package/dist/core/field/UnionField.d.ts +8 -0
  32. package/dist/core/field/UnionField.js +21 -0
  33. package/dist/core/pages/CreateExprData.d.ts +2 -0
  34. package/dist/core/pages/CreateExprData.js +24 -0
  35. package/dist/core/pages/CreateSelection.d.ts +2 -0
  36. package/dist/core/pages/CreateSelection.js +54 -0
  37. package/dist/core/pages/Cursor.d.ts +2 -1
  38. package/dist/core/pages/Cursor.js +14 -7
  39. package/dist/core/pages/Expr.d.ts +2 -95
  40. package/dist/core/pages/Expr.js +51 -160
  41. package/dist/core/pages/ExprData.d.ts +94 -0
  42. package/dist/core/pages/ExprData.js +130 -0
  43. package/dist/core/pages/Selection.d.ts +3 -4
  44. package/dist/core/pages/Selection.js +11 -55
  45. package/dist/core/pages/Target.d.ts +3 -7
  46. package/dist/core/pages/Target.js +10 -20
  47. package/dist/core/pages/TargetData.d.ts +6 -0
  48. package/dist/core/pages/TargetData.js +21 -0
  49. package/dist/core/pages/index.d.ts +4 -0
  50. package/dist/core/pages/index.js +4 -0
  51. package/dist/core.d.ts +6 -1
  52. package/dist/core.js +6 -1
  53. package/dist/dashboard/App.js +2 -1
  54. package/dist/dashboard/atoms/DashboardAtoms.js +1 -1
  55. package/dist/dashboard/atoms/DbAtoms.js +3 -3
  56. package/dist/dashboard/atoms/LocationAtoms.js +20 -12
  57. package/dist/dashboard/atoms/NavigationAtoms.js +3 -3
  58. package/dist/dashboard/view/entry/NewEntry.js +10 -9
  59. package/dist/index.d.ts +0 -1
  60. package/dist/index.js +0 -2
  61. package/dist/input/check/CheckField.d.ts +3 -2
  62. package/dist/input/check/CheckField.js +3 -2
  63. package/dist/input/code/CodeField.d.ts +3 -2
  64. package/dist/input/code/CodeField.js +3 -2
  65. package/dist/input/date/DateField.d.ts +3 -2
  66. package/dist/input/date/DateField.js +3 -2
  67. package/dist/input/hidden/HiddenField.d.ts +2 -2
  68. package/dist/input/hidden/HiddenField.js +2 -2
  69. package/dist/input/json/JsonField.d.ts +3 -2
  70. package/dist/input/json/JsonField.js +3 -2
  71. package/dist/input/link/LinkConstructors.js +2 -1
  72. package/dist/input/link/LinkField.d.ts +5 -3
  73. package/dist/input/link/LinkField.js +5 -3
  74. package/dist/input/list/ListField.browser.d.ts +4 -3
  75. package/dist/input/list/ListField.d.ts +3 -5
  76. package/dist/input/list/ListField.js +2 -4
  77. package/dist/input/metadata/MetadataField.d.ts +3 -2
  78. package/dist/input/metadata/MetadataField.js +3 -2
  79. package/dist/input/number/NumberField.d.ts +3 -2
  80. package/dist/input/number/NumberField.js +3 -2
  81. package/dist/input/object/ObjectField.d.ts +3 -2
  82. package/dist/input/object/ObjectField.js +3 -2
  83. package/dist/input/path/PathField.d.ts +3 -2
  84. package/dist/input/path/PathField.js +2 -2
  85. package/dist/input/richtext/RichTextField.browser.d.ts +3 -2
  86. package/dist/input/richtext/RichTextField.d.ts +3 -5
  87. package/dist/input/richtext/RichTextField.js +2 -4
  88. package/dist/input/select/SelectField.d.ts +3 -2
  89. package/dist/input/select/SelectField.js +2 -2
  90. package/dist/input/text/TextField.d.ts +3 -2
  91. package/dist/input/text/TextField.js +2 -2
  92. package/package.json +2 -2
@@ -1,25 +1,12 @@
1
- import {
2
- object,
3
- string,
4
- type
5
- } from "../../chunks/chunk-7LBNER34.js";
6
1
  import "../../chunks/chunk-U5RRZUYZ.js";
7
2
 
8
3
  // src/core/pages/Target.ts
9
4
  import { createId } from "alinea/core/Id";
5
+ import { createExprData } from "./CreateExprData.js";
10
6
  import { Cursor } from "./Cursor.js";
11
- import { BinaryOp, Expr, ExprData, and } from "./Expr.js";
7
+ import { Expr, and } from "./Expr.js";
8
+ import { BinaryOp, ExprData } from "./ExprData.js";
12
9
  var { create, entries } = Object;
13
- var TT = type(
14
- (value) => value && typeof value === "object"
15
- );
16
- var TargetData = object(
17
- class {
18
- name = string.optional;
19
- // alias? = string.optional
20
- type = TT.optional;
21
- }
22
- );
23
10
  var Target = class {
24
11
  constructor(data) {
25
12
  this.data = data;
@@ -43,9 +30,13 @@ var Target = class {
43
30
  const conditions = isConditionalRecord ? entries(input[0]).map(([key, value]) => {
44
31
  const field = Expr(ExprData.Field(this.data, key));
45
32
  return Expr(
46
- ExprData.BinOp(field[Expr.Data], BinaryOp.Equals, ExprData(value))
33
+ ExprData.BinOp(
34
+ field[Expr.Data],
35
+ BinaryOp.Equals,
36
+ createExprData(value)
37
+ )
47
38
  );
48
- }) : input.map((ev) => Expr(ExprData(ev)));
39
+ }) : input.map((ev) => Expr(createExprData(ev)));
49
40
  return and(...conditions)[Expr.Data];
50
41
  }
51
42
  get(field) {
@@ -82,6 +73,5 @@ var Target = class {
82
73
  }
83
74
  };
84
75
  export {
85
- Target,
86
- TargetData
76
+ Target
87
77
  };
@@ -0,0 +1,6 @@
1
+ import { TypeTarget } from 'alinea/core/Type';
2
+ export type TargetData = typeof TargetData.infer;
3
+ export declare const TargetData: import("cito").Type<{
4
+ name?: string | undefined;
5
+ type?: TypeTarget | undefined;
6
+ }>;
@@ -0,0 +1,21 @@
1
+ import {
2
+ object,
3
+ string,
4
+ type
5
+ } from "../../chunks/chunk-7LBNER34.js";
6
+ import "../../chunks/chunk-U5RRZUYZ.js";
7
+
8
+ // src/core/pages/TargetData.ts
9
+ var TT = type(
10
+ (value) => value && typeof value === "object"
11
+ );
12
+ var TargetData = object(
13
+ class {
14
+ name = string.optional;
15
+ // alias? = string.optional
16
+ type = TT.optional;
17
+ }
18
+ );
19
+ export {
20
+ TargetData
21
+ };
@@ -1,8 +1,12 @@
1
1
  export * from '../Page.js';
2
+ export * from './CreateExprData.js';
3
+ export * from './CreateSelection.js';
2
4
  export * from './Cursor.js';
3
5
  export * from './Expr.js';
6
+ export * from './ExprData.js';
4
7
  export * from './Fields.js';
5
8
  export * from './Projection.js';
6
9
  export * from './Selection.js';
7
10
  export * from './Target.js';
11
+ export * from './TargetData.js';
8
12
  export * from './Tree.js';
@@ -1,9 +1,13 @@
1
1
  // src/core/pages/index.ts
2
2
  export * from "../Page.js";
3
+ export * from "./CreateExprData.js";
4
+ export * from "./CreateSelection.js";
3
5
  export * from "./Cursor.js";
4
6
  export * from "./Expr.js";
7
+ export * from "./ExprData.js";
5
8
  export * from "./Fields.js";
6
9
  export * from "./Projection.js";
7
10
  export * from "./Selection.js";
8
11
  export * from "./Target.js";
12
+ export * from "./TargetData.js";
9
13
  export * from "./Tree.js";
package/dist/core.d.ts CHANGED
@@ -12,12 +12,12 @@ export * from './core/Hint.js';
12
12
  export * from './core/HttpError.js';
13
13
  export * from './core/Id.js';
14
14
  export * from './core/Infer.js';
15
- export * from './core/Resolver.js';
16
15
  export * from './core/Label.js';
17
16
  export * from './core/Meta.js';
18
17
  export * from './core/Outcome.js';
19
18
  export * from './core/Page.js';
20
19
  export * from './core/Reference.js';
20
+ export * from './core/Resolver.js';
21
21
  export * from './core/Root.js';
22
22
  export * from './core/Schema.js';
23
23
  export * from './core/Section.js';
@@ -29,6 +29,11 @@ export * from './core/Type.js';
29
29
  export * from './core/User.js';
30
30
  export * from './core/View.js';
31
31
  export * from './core/Workspace.js';
32
+ export * from './core/field/ListField.js';
33
+ export * from './core/field/RecordField.js';
34
+ export * from './core/field/RichTextField.js';
35
+ export * from './core/field/ScalarField.js';
36
+ export * from './core/field/UnionField.js';
32
37
  export * from './core/shape/ListShape.js';
33
38
  export * from './core/shape/RichTextShape.js';
34
39
  export * from './core/util/Async.js';
package/dist/core.js CHANGED
@@ -13,12 +13,12 @@ export * from "./core/Hint.js";
13
13
  export * from "./core/HttpError.js";
14
14
  export * from "./core/Id.js";
15
15
  export * from "./core/Infer.js";
16
- export * from "./core/Resolver.js";
17
16
  export * from "./core/Label.js";
18
17
  export * from "./core/Meta.js";
19
18
  export * from "./core/Outcome.js";
20
19
  export * from "./core/Page.js";
21
20
  export * from "./core/Reference.js";
21
+ export * from "./core/Resolver.js";
22
22
  export * from "./core/Root.js";
23
23
  export * from "./core/Schema.js";
24
24
  export * from "./core/Section.js";
@@ -30,6 +30,11 @@ export * from "./core/Type.js";
30
30
  export * from "./core/User.js";
31
31
  export * from "./core/View.js";
32
32
  export * from "./core/Workspace.js";
33
+ export * from "./core/field/ListField.js";
34
+ export * from "./core/field/RecordField.js";
35
+ export * from "./core/field/RichTextField.js";
36
+ export * from "./core/field/ScalarField.js";
37
+ export * from "./core/field/UnionField.js";
33
38
  export * from "./core/shape/ListShape.js";
34
39
  export * from "./core/shape/RichTextShape.js";
35
40
  export * from "./core/util/Async.js";
@@ -78,7 +78,8 @@ function AppAuthenticated() {
78
78
  /* @__PURE__ */ jsxs(Sidebar.Nav, { children: [
79
79
  Object.entries(roots).map(([key, root], i) => {
80
80
  const isSelected = key === currentRoot;
81
- const link = entryLocation && entryLocation.root === key ? nav.entry(entryLocation) : nav.root({
81
+ const { entryId, ...location } = entryLocation;
82
+ const link = location.root === key ? nav.entry(location) : nav.root({
82
83
  workspace,
83
84
  root: key,
84
85
  locale: preferredLanguage
@@ -1,9 +1,9 @@
1
- import "../../chunks/chunk-ZHH24SIG.js";
2
1
  import {
3
2
  useAtomValue,
4
3
  useSetAtom,
5
4
  useStore
6
5
  } from "../../chunks/chunk-WF77DMLN.js";
6
+ import "../../chunks/chunk-ZHH24SIG.js";
7
7
  import {
8
8
  atom
9
9
  } from "../../chunks/chunk-OBOPLPUQ.js";
@@ -1,9 +1,9 @@
1
- import {
2
- atomFamily
3
- } from "../../chunks/chunk-ZHH24SIG.js";
4
1
  import {
5
2
  useSetAtom
6
3
  } from "../../chunks/chunk-WF77DMLN.js";
4
+ import {
5
+ atomFamily
6
+ } from "../../chunks/chunk-ZHH24SIG.js";
7
7
  import {
8
8
  atom
9
9
  } from "../../chunks/chunk-OBOPLPUQ.js";
@@ -1,11 +1,11 @@
1
- import {
2
- atomFamily
3
- } from "../../chunks/chunk-ZHH24SIG.js";
4
1
  import {
5
2
  useAtom,
6
3
  useAtomValue,
7
4
  useSetAtom
8
5
  } from "../../chunks/chunk-WF77DMLN.js";
6
+ import {
7
+ atomFamily
8
+ } from "../../chunks/chunk-ZHH24SIG.js";
9
9
  import {
10
10
  atom
11
11
  } from "../../chunks/chunk-OBOPLPUQ.js";
@@ -16,13 +16,21 @@ import "../../chunks/chunk-U5RRZUYZ.js";
16
16
 
17
17
  // src/dashboard/atoms/LocationAtoms.ts
18
18
  import { values } from "alinea/core/util/Objects";
19
- var hashAtom = atom(location.hash, (get, set, hash) => {
20
- if (get(hashAtom) !== hash)
21
- location.hash = hash;
22
- set(hashAtom, hash);
23
- });
19
+ var browser = {
20
+ get location() {
21
+ return globalThis?.location ?? { hash: "" };
22
+ }
23
+ };
24
+ var hashAtom = atom(
25
+ browser.location.hash,
26
+ (get, set, hash) => {
27
+ if (get(hashAtom) !== hash)
28
+ browser.location.hash = hash;
29
+ set(hashAtom, hash);
30
+ }
31
+ );
24
32
  hashAtom.onMount = (set) => {
25
- const listener = () => set(location.hash);
33
+ const listener = () => set(browser.location.hash);
26
34
  window.addEventListener("hashchange", listener);
27
35
  return () => window.removeEventListener("hashchange", listener);
28
36
  };
@@ -30,7 +38,7 @@ var locationAtom = atom(
30
38
  (get) => {
31
39
  const hash = get(hashAtom);
32
40
  const path = hash.slice(1) || "/";
33
- return new URL(path, location.href);
41
+ return new URL(path, browser.location.href);
34
42
  },
35
43
  (get, set, url) => {
36
44
  const hash = `#${url}`;
@@ -49,8 +57,8 @@ var matchAtoms = atomFamily(
49
57
  let current;
50
58
  const matcher = parse(route, loose);
51
59
  return atom((get) => {
52
- const location2 = get(locationAtom);
53
- const match = matcher.pattern.exec(location2.pathname);
60
+ const location = get(locationAtom);
61
+ const match = matcher.pattern.exec(location.pathname);
54
62
  if (match === null)
55
63
  return void 0;
56
64
  const result = createParams(matcher, match);
@@ -1,9 +1,9 @@
1
- import {
2
- atomWithStorage
3
- } from "../../chunks/chunk-ZHH24SIG.js";
4
1
  import {
5
2
  useAtom
6
3
  } from "../../chunks/chunk-WF77DMLN.js";
4
+ import {
5
+ atomWithStorage
6
+ } from "../../chunks/chunk-ZHH24SIG.js";
7
7
  import {
8
8
  atom
9
9
  } from "../../chunks/chunk-OBOPLPUQ.js";
@@ -90,8 +90,8 @@ function NewEntryForm({ parentId }) {
90
90
  const locale = useLocale();
91
91
  const mutate = useMutate();
92
92
  const { name: workspace } = useWorkspace();
93
- const containerTypes = entries(config.schema).filter(([, type2]) => {
94
- return Type.meta(type2).isContainer;
93
+ const containerTypes = entries(config.schema).filter(([, type]) => {
94
+ return Type.meta(type).isContainer;
95
95
  }).map((pair) => pair[0]);
96
96
  const root = useRoot();
97
97
  const parentField = useField(
@@ -119,20 +119,20 @@ function NewEntryForm({ parentId }) {
119
119
  { suspense: true, keepPreviousData: true, staleTime: 0 }
120
120
  );
121
121
  const parentPaths = parent ? parent.parentPaths.concat(parent.path) : [];
122
- const type = parent && config.schema[parent.type];
123
- const types = !parent ? root.contains || [] : type && Type.meta(type).contains || keys(config.schema);
122
+ const parentType = parent && config.schema[parent.type];
123
+ const types = !parent ? root.contains || [] : parentType && Type.meta(parentType).contains || keys(config.schema);
124
124
  const selectedType = useField(
125
125
  select(
126
126
  "Select type",
127
127
  fromEntries(
128
128
  types.map((typeKey) => {
129
- const type2 = config.schema[typeKey];
130
- return [typeKey, Type.label(type2) || typeKey];
129
+ const type = config.schema[typeKey];
130
+ return [typeKey, Type.label(type) || typeKey];
131
131
  })
132
132
  ),
133
133
  { initialValue: types[0] }
134
134
  ),
135
- [type]
135
+ [parentType]
136
136
  );
137
137
  const titleField = useField(text("Title", { autoFocus: true }));
138
138
  const [isCreating, setIsCreating] = useState(false);
@@ -141,7 +141,7 @@ function NewEntryForm({ parentId }) {
141
141
  e.preventDefault();
142
142
  const title = titleField();
143
143
  const selected = selectedType();
144
- if (!selected || !title || !type)
144
+ if (!selected || !title)
145
145
  return;
146
146
  setIsCreating(true);
147
147
  const path = slugify(title);
@@ -156,7 +156,8 @@ function NewEntryForm({ parentId }) {
156
156
  const filePath = entryFilepath(config, data, parentPaths);
157
157
  const childrenDir = entryChildrenDir(config, data, parentPaths);
158
158
  const parentDir = dirname(filePath);
159
- const url = entryUrl(type, { ...data, parentPaths });
159
+ const entryType = config.schema[selected];
160
+ const url = entryUrl(entryType, { ...data, parentPaths });
160
161
  const entry = await createEntryRow(config, {
161
162
  entryId,
162
163
  ...data,
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ export { Root, Workspace } from 'alinea/core';
2
2
  export type { Config, Infer, Schema, TextDoc, Type } from 'alinea/core';
3
3
  export * from 'alinea/core/driver/DefaultDriver';
4
4
  export * from 'alinea/core/driver/NextDriver';
5
- export { MediaSchema } from 'alinea/core/media/MediaSchema';
6
5
  export { alinea };
7
6
  import * as alinea from './alinea.js';
8
7
  export default alinea;
package/dist/index.js CHANGED
@@ -4,11 +4,9 @@ import "./chunks/chunk-U5RRZUYZ.js";
4
4
  import { Root, Workspace } from "alinea/core";
5
5
  export * from "alinea/core/driver/DefaultDriver";
6
6
  export * from "alinea/core/driver/NextDriver";
7
- import { MediaSchema } from "alinea/core/media/MediaSchema";
8
7
  import * as alinea from "./alinea.js";
9
8
  var src_default = alinea;
10
9
  export {
11
- MediaSchema,
12
10
  Root,
13
11
  Workspace,
14
12
  alinea,
@@ -1,4 +1,5 @@
1
- import { Field, FieldOptions, Label } from 'alinea/core';
1
+ import { FieldOptions, Label } from 'alinea/core';
2
+ import { ScalarField } from 'alinea/core/field/ScalarField';
2
3
  /** Optional settings to configure a text field */
3
4
  export interface CheckOptions extends FieldOptions {
4
5
  /** Label displayed next to the checkbox */
@@ -17,7 +18,7 @@ export interface CheckOptions extends FieldOptions {
17
18
  autoFocus?: boolean;
18
19
  }
19
20
  /** Internal representation of a text field */
20
- export declare class CheckField extends Field.Scalar<boolean, CheckOptions> {
21
+ export declare class CheckField extends ScalarField<boolean, CheckOptions> {
21
22
  }
22
23
  /** Create a text field configuration */
23
24
  export declare function check(label: Label, options?: CheckOptions): CheckField;
@@ -1,8 +1,9 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/check/CheckField.tsx
4
- import { Field, Hint } from "alinea/core";
5
- var CheckField = class extends Field.Scalar {
4
+ import { Hint } from "alinea/core";
5
+ import { ScalarField } from "alinea/core/field/ScalarField";
6
+ var CheckField = class extends ScalarField {
6
7
  };
7
8
  function check(label, options = {}) {
8
9
  return new CheckField({
@@ -1,4 +1,5 @@
1
- import { Field, FieldOptions, Label } from 'alinea/core';
1
+ import { FieldOptions, Label } from 'alinea/core';
2
+ import { ScalarField } from 'alinea/core/field/ScalarField';
2
3
  export interface CodeFieldOptions extends FieldOptions {
3
4
  width?: number;
4
5
  help?: Label;
@@ -7,6 +8,6 @@ export interface CodeFieldOptions extends FieldOptions {
7
8
  initialValue?: string;
8
9
  language?: string;
9
10
  }
10
- export declare class CodeField extends Field.Scalar<string, CodeFieldOptions> {
11
+ export declare class CodeField extends ScalarField<string, CodeFieldOptions> {
11
12
  }
12
13
  export declare function code(label: Label, options?: CodeFieldOptions): CodeField;
@@ -1,8 +1,9 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/code/CodeField.tsx
4
- import { Field, Hint } from "alinea/core";
5
- var CodeField = class extends Field.Scalar {
4
+ import { Hint } from "alinea/core";
5
+ import { ScalarField } from "alinea/core/field/ScalarField";
6
+ var CodeField = class extends ScalarField {
6
7
  };
7
8
  function code(label, options = {}) {
8
9
  return new CodeField({
@@ -1,4 +1,5 @@
1
- import { Field, FieldOptions, Label } from 'alinea/core';
1
+ import { FieldOptions, Label } from 'alinea/core';
2
+ import { ScalarField } from 'alinea/core/field/ScalarField';
2
3
  /** Optional settings to configure a text field */
3
4
  export interface DateOptions extends FieldOptions {
4
5
  /** Width of the field in the dashboard UI (0-1) */
@@ -19,7 +20,7 @@ export interface DateOptions extends FieldOptions {
19
20
  readOnly?: boolean;
20
21
  }
21
22
  /** Internal representation of a date field */
22
- export declare class DateField extends Field.Scalar<string, DateOptions> {
23
+ export declare class DateField extends ScalarField<string, DateOptions> {
23
24
  }
24
25
  /** Create a date field configuration */
25
26
  export declare function date(label: Label, options?: DateOptions): DateField;
@@ -1,8 +1,9 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/date/DateField.tsx
4
- import { Field, Hint } from "alinea/core";
5
- var DateField = class extends Field.Scalar {
4
+ import { Hint } from "alinea/core";
5
+ import { ScalarField } from "alinea/core/field/ScalarField";
6
+ var DateField = class extends ScalarField {
6
7
  };
7
8
  function date(label, options = {}) {
8
9
  return new DateField({
@@ -1,13 +1,13 @@
1
- import { Field } from 'alinea/core/Field';
2
1
  import { Hint } from 'alinea/core/Hint';
3
2
  import { Label } from 'alinea/core/Label';
3
+ import { ScalarField } from 'alinea/core/field/ScalarField';
4
4
  /** Optional settings to configure a hidden field */
5
5
  export type HiddenOptions<T> = {
6
6
  /** A default value */
7
7
  initialValue?: T;
8
8
  };
9
9
  /** Internal representation of a text field */
10
- export declare class HiddenField<T> extends Field.Scalar<T, {}> {
10
+ export declare class HiddenField<T> extends ScalarField<T, {}> {
11
11
  }
12
12
  /** Create a hidden field configuration */
13
13
  export declare function hidden<T>(label: Label, hint: Hint, options?: HiddenOptions<T>): HiddenField<T>;
@@ -1,8 +1,8 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/hidden/HiddenField.tsx
4
- import { Field } from "alinea/core/Field";
5
- var HiddenField = class extends Field.Scalar {
4
+ import { ScalarField } from "alinea/core/field/ScalarField";
5
+ var HiddenField = class extends ScalarField {
6
6
  };
7
7
  function hidden(label, hint, options = {}) {
8
8
  return new HiddenField({
@@ -1,4 +1,5 @@
1
- import { Field, FieldOptions, Label } from 'alinea/core';
1
+ import { FieldOptions, Label } from 'alinea/core';
2
+ import { ScalarField } from 'alinea/core/field/ScalarField';
2
3
  /** Optional settings to configure a JSON field */
3
4
  export interface JsonOptions<Value> extends FieldOptions {
4
5
  /** Width of the field in the dashboard UI (0-1) */
@@ -15,7 +16,7 @@ export interface JsonOptions<Value> extends FieldOptions {
15
16
  autoFocus?: boolean;
16
17
  }
17
18
  /** Internal representation of a text field */
18
- export declare class JsonField<Value> extends Field.Scalar<Value, JsonOptions<Value>> {
19
+ export declare class JsonField<Value> extends ScalarField<Value, JsonOptions<Value>> {
19
20
  }
20
21
  /** Create a text field configuration */
21
22
  export declare function json<T>(label: Label, options?: JsonOptions<T>): JsonField<T>;
@@ -1,8 +1,9 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/json/JsonField.tsx
4
- import { Field, Hint } from "alinea/core";
5
- var JsonField = class extends Field.Scalar {
4
+ import { Hint } from "alinea/core";
5
+ import { ScalarField } from "alinea/core/field/ScalarField";
6
+ var JsonField = class extends ScalarField {
6
7
  };
7
8
  function json(label, options = {}) {
8
9
  return new JsonField({
@@ -83,7 +83,8 @@ function link(label, options = {}) {
83
83
  title: "Select a page",
84
84
  selection: entryFields
85
85
  }),
86
- url: urlPicker(options)
86
+ url: urlPicker(options),
87
+ file: filePicker(true, options)
87
88
  }
88
89
  });
89
90
  }
@@ -1,4 +1,6 @@
1
- import { Field, FieldOptions, Label, Reference } from 'alinea/core';
1
+ import { FieldOptions, Label, Reference } from 'alinea/core';
2
+ import { ListField } from 'alinea/core/field/ListField';
3
+ import { UnionField } from 'alinea/core/field/UnionField';
2
4
  import type { Picker } from 'alinea/editor/Picker';
3
5
  /** Optional settings to configure a link field */
4
6
  export interface LinkFieldOptions extends FieldOptions {
@@ -15,11 +17,11 @@ export interface LinkFieldOptions extends FieldOptions {
15
17
  export interface LinkOptions<Row extends Reference> extends LinkFieldOptions {
16
18
  pickers: Record<string, Picker<any, any>>;
17
19
  }
18
- export declare class LinkField<Row extends Reference> extends Field.Union<Row, LinkOptions<Row>> {
20
+ export declare class LinkField<Row extends Reference> extends UnionField<Row, LinkOptions<Row>> {
19
21
  }
20
22
  export declare function createLink<Row extends Reference>(label: Label, options: LinkOptions<Row>): LinkField<Row>;
21
23
  /** Internal representation of a link field */
22
- export declare class LinksField<Row extends Reference> extends Field.List<Row, LinkOptions<Row> & {
24
+ export declare class LinksField<Row extends Reference> extends ListField<Row, LinkOptions<Row> & {
23
25
  max?: number;
24
26
  }> {
25
27
  }
@@ -1,9 +1,11 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/link/LinkField.tsx
4
- import { Field, Hint } from "alinea/core";
4
+ import { Hint } from "alinea/core";
5
+ import { ListField } from "alinea/core/field/ListField";
6
+ import { UnionField } from "alinea/core/field/UnionField";
5
7
  import { entries, fromEntries } from "alinea/core/util/Objects";
6
- var LinkField = class extends Field.Union {
8
+ var LinkField = class extends UnionField {
7
9
  };
8
10
  function createLink(label, options) {
9
11
  const pickers = entries(options.pickers);
@@ -26,7 +28,7 @@ function createLink(label, options) {
26
28
  }
27
29
  });
28
30
  }
29
- var LinksField = class extends Field.List {
31
+ var LinksField = class extends ListField {
30
32
  };
31
33
  function createLinks(label, options) {
32
34
  const pickers = entries(options.pickers);
@@ -1,10 +1,11 @@
1
- import { Schema } from 'alinea/core';
1
+ import { Infer, Schema } from 'alinea/core';
2
+ import { ListField } from 'alinea/core/field/ListField';
2
3
  import { InputState } from 'alinea/editor';
3
- import { list as createList, ListField } from './ListField.js';
4
+ import { list as createList, ListOptions } from './ListField.js';
4
5
  export * from './ListField.js';
5
6
  export declare const list: typeof createList;
6
7
  export interface ListInputProps {
7
8
  state: InputState<InputState.List<any>>;
8
- field: ListField<Schema>;
9
+ field: ListField<Infer<Schema>, ListOptions<Schema>>;
9
10
  }
10
11
  export declare function ListInput({ state, field }: ListInputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
- import { Field, FieldOptions, Label, Schema } from 'alinea/core';
1
+ import { FieldOptions, Label, Schema } from 'alinea/core';
2
2
  import { Infer } from 'alinea/core/Infer';
3
+ import { ListField } from 'alinea/core/field/ListField';
3
4
  /** Optional settings to configure a list field */
4
5
  export interface ListOptions<Definitions extends Schema> extends FieldOptions {
5
6
  /** Allow these types of blocks to be created */
@@ -20,8 +21,5 @@ export interface ListRow {
20
21
  index: string;
21
22
  type: string;
22
23
  }
23
- /** Internal representation of a list field */
24
- export declare class ListField<Definitions extends Schema> extends Field.List<Infer<Definitions>, ListOptions<Definitions>> {
25
- }
26
24
  /** Create a list field configuration */
27
- export declare function list<Definitions extends Schema>(label: Label, options: ListOptions<Definitions>): ListField<Definitions>;
25
+ export declare function list<Definitions extends Schema>(label: Label, options: ListOptions<Definitions>): ListField<Infer<Definitions>, ListOptions<Definitions>>;
@@ -1,10 +1,9 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/list/ListField.tsx
4
- import { Field, Schema } from "alinea/core";
4
+ import { Schema } from "alinea/core";
5
+ import { ListField } from "alinea/core/field/ListField";
5
6
  import { listHint } from "alinea/core/util/Hints";
6
- var ListField = class extends Field.List {
7
- };
8
7
  function list(label, options) {
9
8
  return new ListField(Schema.shapes(options.schema), {
10
9
  hint: listHint(options.schema),
@@ -13,6 +12,5 @@ function list(label, options) {
13
12
  });
14
13
  }
15
14
  export {
16
- ListField,
17
15
  list
18
16
  };
@@ -1,4 +1,5 @@
1
- import { Field, Type } from 'alinea/core';
1
+ import { Type } from 'alinea/core';
2
+ import { RecordField } from 'alinea/core/field/RecordField';
2
3
  import { ObjectField } from 'alinea/input/object';
3
4
  import { TextField } from 'alinea/input/text';
4
5
  import { ImageReference } from '../../picker/entry/EntryReference.js';
@@ -17,7 +18,7 @@ export interface MetadataFields {
17
18
  description: TextField;
18
19
  }>;
19
20
  }
20
- export declare class MetadataField extends Field.Record<Type.Infer<MetadataFields>, MetadataOptions & {
21
+ export declare class MetadataField extends RecordField<Type.Infer<MetadataFields>, MetadataOptions & {
21
22
  fields: Type<MetadataFields>;
22
23
  }> {
23
24
  }
@@ -1,11 +1,12 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/input/metadata/MetadataField.tsx
4
- import { Field, Type, type } from "alinea/core";
4
+ import { Type, type } from "alinea/core";
5
+ import { RecordField } from "alinea/core/field/RecordField";
5
6
  import { link } from "alinea/input/link";
6
7
  import { object } from "alinea/input/object";
7
8
  import { text } from "alinea/input/text";
8
- var MetadataField = class extends Field.Record {
9
+ var MetadataField = class extends RecordField {
9
10
  };
10
11
  function metadata(options = {}) {
11
12
  const fields = type("Fields", {