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.
- package/LICENSE +21 -21
- package/dist/alinea.d.ts +1 -1
- package/dist/alinea.js +1 -10
- package/dist/backend/Handler.js +2 -1
- package/dist/backend/resolver/EntryResolver.d.ts +3 -36
- package/dist/backend/resolver/EntryResolver.js +31 -105
- package/dist/backend/resolver/LinkResolver.d.ts +1 -1
- package/dist/backend/resolver/LinkResolver.js +3 -3
- package/dist/backend/resolver/ResolveContext.d.ts +38 -0
- package/dist/backend/resolver/ResolveContext.js +83 -0
- package/dist/chunks/{chunk-KDSPNPHI.js → chunk-LRUUF55J.js} +2 -2
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/GenerateDashboard.js +1 -1
- package/dist/cli.js +0 -0
- package/dist/cloud/server/CloudAuthServer.js +1 -1
- package/dist/core/Field.d.ts +0 -26
- package/dist/core/Field.js +0 -56
- package/dist/core/Graph.js +4 -4
- package/dist/core/Type.js +9 -3
- package/dist/core/View.js +2 -2
- package/dist/core/driver/NextDriver.server.js +2 -2
- package/dist/core/field/ListField.d.ts +8 -0
- package/dist/core/field/ListField.js +21 -0
- package/dist/core/field/RecordField.d.ts +5 -0
- package/dist/core/field/RecordField.js +12 -0
- package/dist/core/field/RichTextField.d.ts +9 -0
- package/dist/core/field/RichTextField.js +16 -0
- package/dist/core/field/ScalarField.d.ts +4 -0
- package/dist/core/field/ScalarField.js +16 -0
- package/dist/core/field/UnionField.d.ts +8 -0
- package/dist/core/field/UnionField.js +21 -0
- package/dist/core/pages/CreateExprData.d.ts +2 -0
- package/dist/core/pages/CreateExprData.js +24 -0
- package/dist/core/pages/CreateSelection.d.ts +2 -0
- package/dist/core/pages/CreateSelection.js +54 -0
- package/dist/core/pages/Cursor.d.ts +2 -1
- package/dist/core/pages/Cursor.js +14 -7
- package/dist/core/pages/Expr.d.ts +2 -95
- package/dist/core/pages/Expr.js +51 -160
- package/dist/core/pages/ExprData.d.ts +94 -0
- package/dist/core/pages/ExprData.js +130 -0
- package/dist/core/pages/Selection.d.ts +3 -4
- package/dist/core/pages/Selection.js +11 -55
- package/dist/core/pages/Target.d.ts +3 -7
- package/dist/core/pages/Target.js +10 -20
- package/dist/core/pages/TargetData.d.ts +6 -0
- package/dist/core/pages/TargetData.js +21 -0
- package/dist/core/pages/index.d.ts +4 -0
- package/dist/core/pages/index.js +4 -0
- package/dist/core.d.ts +6 -1
- package/dist/core.js +6 -1
- package/dist/dashboard/App.js +2 -1
- package/dist/dashboard/atoms/DashboardAtoms.js +1 -1
- package/dist/dashboard/atoms/DbAtoms.js +3 -3
- package/dist/dashboard/atoms/LocationAtoms.js +20 -12
- package/dist/dashboard/atoms/NavigationAtoms.js +3 -3
- package/dist/dashboard/view/entry/NewEntry.js +10 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/input/check/CheckField.d.ts +3 -2
- package/dist/input/check/CheckField.js +3 -2
- package/dist/input/code/CodeField.d.ts +3 -2
- package/dist/input/code/CodeField.js +3 -2
- package/dist/input/date/DateField.d.ts +3 -2
- package/dist/input/date/DateField.js +3 -2
- package/dist/input/hidden/HiddenField.d.ts +2 -2
- package/dist/input/hidden/HiddenField.js +2 -2
- package/dist/input/json/JsonField.d.ts +3 -2
- package/dist/input/json/JsonField.js +3 -2
- package/dist/input/link/LinkConstructors.js +2 -1
- package/dist/input/link/LinkField.d.ts +5 -3
- package/dist/input/link/LinkField.js +5 -3
- package/dist/input/list/ListField.browser.d.ts +4 -3
- package/dist/input/list/ListField.d.ts +3 -5
- package/dist/input/list/ListField.js +2 -4
- package/dist/input/metadata/MetadataField.d.ts +3 -2
- package/dist/input/metadata/MetadataField.js +3 -2
- package/dist/input/number/NumberField.d.ts +3 -2
- package/dist/input/number/NumberField.js +3 -2
- package/dist/input/object/ObjectField.d.ts +3 -2
- package/dist/input/object/ObjectField.js +3 -2
- package/dist/input/path/PathField.d.ts +3 -2
- package/dist/input/path/PathField.js +2 -2
- package/dist/input/richtext/RichTextField.browser.d.ts +3 -2
- package/dist/input/richtext/RichTextField.d.ts +3 -5
- package/dist/input/richtext/RichTextField.js +2 -4
- package/dist/input/select/SelectField.d.ts +3 -2
- package/dist/input/select/SelectField.js +2 -2
- package/dist/input/text/TextField.d.ts +3 -2
- package/dist/input/text/TextField.js +2 -2
- 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 {
|
|
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(
|
|
33
|
+
ExprData.BinOp(
|
|
34
|
+
field[Expr.Data],
|
|
35
|
+
BinaryOp.Equals,
|
|
36
|
+
createExprData(value)
|
|
37
|
+
)
|
|
47
38
|
);
|
|
48
|
-
}) : input.map((ev) => Expr(
|
|
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,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';
|
package/dist/core/pages/index.js
CHANGED
|
@@ -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";
|
package/dist/dashboard/App.js
CHANGED
|
@@ -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
|
|
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 {
|
|
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
|
|
20
|
-
|
|
21
|
-
location
|
|
22
|
-
|
|
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
|
|
53
|
-
const match = matcher.pattern.exec(
|
|
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(([,
|
|
94
|
-
return Type.meta(
|
|
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
|
|
123
|
-
const types = !parent ? root.contains || [] :
|
|
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
|
|
130
|
-
return [typeKey, Type.label(
|
|
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
|
-
[
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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 {
|
|
5
|
-
|
|
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 {
|
|
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
|
|
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 {
|
|
5
|
-
|
|
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 {
|
|
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
|
|
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 {
|
|
5
|
-
|
|
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
|
|
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 {
|
|
5
|
-
var HiddenField = class extends
|
|
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 {
|
|
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
|
|
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 {
|
|
5
|
-
|
|
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({
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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,
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
9
|
+
var MetadataField = class extends RecordField {
|
|
9
10
|
};
|
|
10
11
|
function metadata(options = {}) {
|
|
11
12
|
const fields = type("Fields", {
|