alinea 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{chunk-B6H4DO6X.js → chunk-KWP47LDR.js} +1 -1
- 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/static/dashboard/entry.js +2 -4
- package/dist/cloud/server/CloudAuthServer.js +1 -1
- package/dist/core/CMS.d.ts +1 -2
- package/dist/core/CMS.js +0 -6
- package/dist/core/Config.d.ts +7 -0
- package/dist/core/Config.js +6 -1
- package/dist/dashboard/view/media/FileSummary.js +2 -2
- package/dist/input/link/LinkField.browser.js +28 -18
- package/dist/picker/url/UrlPicker.browser.d.ts +1 -1
- package/dist/picker/url/UrlPicker.browser.js +13 -5
- package/package.json +1 -1
package/dist/cli/Serve.js
CHANGED
package/dist/cli/bin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {CMS} from 'alinea/core'
|
|
2
1
|
import {Client} from 'alinea/core/Client'
|
|
3
2
|
import 'alinea/css'
|
|
4
3
|
import {App} from 'alinea/dashboard/App'
|
|
@@ -19,8 +18,7 @@ export async function boot(handlerUrl) {
|
|
|
19
18
|
async function loadConfig() {
|
|
20
19
|
const configModule = './config.js?' + Math.random()
|
|
21
20
|
const exports = await import(configModule)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
21
|
+
if ('cms' in exports) return exports.cms.config
|
|
22
|
+
if ('config' in exports) return exports.config
|
|
25
23
|
throw new Error(`No config found in "/config.js"`)
|
|
26
24
|
}
|
package/dist/core/CMS.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Store } from 'alinea/backend/Store';
|
|
2
2
|
import { Resolver } from 'alinea/core';
|
|
3
|
-
import { Config
|
|
3
|
+
import { Config } from './Config.js';
|
|
4
4
|
import { Graph, GraphRealm, GraphRealmApi } from './Graph.js';
|
|
5
5
|
import { Root } from './Root.js';
|
|
6
6
|
import { Workspace } from './Workspace.js';
|
|
@@ -10,7 +10,6 @@ export interface CMSApi extends GraphRealmApi {
|
|
|
10
10
|
}
|
|
11
11
|
export declare abstract class CMS extends GraphRealm implements CMSApi {
|
|
12
12
|
#private;
|
|
13
|
-
dashboard: DashboardConfig;
|
|
14
13
|
graph: Graph;
|
|
15
14
|
config: Config;
|
|
16
15
|
constructor(config: Config);
|
package/dist/core/CMS.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import "../chunks/chunk-U5RRZUYZ.js";
|
|
2
2
|
|
|
3
3
|
// src/core/CMS.ts
|
|
4
|
-
import { CloudAuthView } from "alinea/cloud/view/CloudAuth";
|
|
5
4
|
import { createConfig } from "./Config.js";
|
|
6
5
|
import { Graph, GraphRealm } from "./Graph.js";
|
|
7
6
|
import { entries } from "./util/Objects.js";
|
|
8
7
|
var attached = /* @__PURE__ */ new WeakMap();
|
|
9
8
|
var CMS = class extends GraphRealm {
|
|
10
|
-
dashboard;
|
|
11
9
|
graph;
|
|
12
10
|
config;
|
|
13
11
|
constructor(config) {
|
|
@@ -17,10 +15,6 @@ var CMS = class extends GraphRealm {
|
|
|
17
15
|
return cnx.resolve(params);
|
|
18
16
|
});
|
|
19
17
|
this.config = normalizedConfig;
|
|
20
|
-
this.dashboard = {
|
|
21
|
-
auth: CloudAuthView,
|
|
22
|
-
...config.dashboard
|
|
23
|
-
};
|
|
24
18
|
this.graph = new Graph(normalizedConfig, async (params) => {
|
|
25
19
|
const { resolve } = await this.resolver();
|
|
26
20
|
return resolve(params);
|
package/dist/core/Config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CloudAuthView } from 'alinea/cloud/view/CloudAuth';
|
|
1
2
|
import { ComponentType } from 'react';
|
|
2
3
|
import { Auth } from './Auth.js';
|
|
3
4
|
import { Entry } from './Entry.js';
|
|
@@ -61,4 +62,10 @@ export declare function createConfig<Definition extends Config>(definition: Defi
|
|
|
61
62
|
thumbHash: import("../input/hidden.js").HiddenField<string>;
|
|
62
63
|
}>;
|
|
63
64
|
};
|
|
65
|
+
dashboard: {
|
|
66
|
+
handlerUrl?: string | undefined;
|
|
67
|
+
dashboardUrl?: string | undefined;
|
|
68
|
+
auth: typeof CloudAuthView | Auth.View;
|
|
69
|
+
staticFile?: string | undefined;
|
|
70
|
+
};
|
|
64
71
|
};
|
package/dist/core/Config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../chunks/chunk-U5RRZUYZ.js";
|
|
2
2
|
|
|
3
3
|
// src/core/Config.ts
|
|
4
|
+
import { CloudAuthView } from "alinea/cloud/view/CloudAuth";
|
|
4
5
|
import { MediaSchema } from "alinea/core/media/MediaSchema";
|
|
5
6
|
import { Workspace } from "./Workspace.js";
|
|
6
7
|
var Config;
|
|
@@ -22,7 +23,11 @@ var Config;
|
|
|
22
23
|
function createConfig(definition) {
|
|
23
24
|
return {
|
|
24
25
|
...definition,
|
|
25
|
-
schema: { ...MediaSchema, ...definition.schema }
|
|
26
|
+
schema: { ...MediaSchema, ...definition.schema },
|
|
27
|
+
dashboard: {
|
|
28
|
+
auth: CloudAuthView,
|
|
29
|
+
...definition.dashboard
|
|
30
|
+
}
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
33
|
export {
|
|
@@ -120,9 +120,9 @@ var FileSummaryThumb = view(
|
|
|
120
120
|
/* @__PURE__ */ jsxs("div", { className: styles.thumb.footer(), children: [
|
|
121
121
|
/* @__PURE__ */ jsx("p", { className: styles.thumb.footer.title(), children: renderLabel(file.title) }),
|
|
122
122
|
/* @__PURE__ */ jsxs("p", { className: styles.thumb.footer.details(), children: [
|
|
123
|
-
file.extension
|
|
123
|
+
file.extension?.slice(1).toUpperCase(),
|
|
124
124
|
file.width && file.height && ` - ${file.width}x${file.height}`,
|
|
125
|
-
/* @__PURE__ */ jsx("span", { style: { marginLeft: "auto" }, children: prettyBytes(file.size) })
|
|
125
|
+
file.size && /* @__PURE__ */ jsx("span", { style: { marginLeft: "auto" }, children: prettyBytes(file.size) })
|
|
126
126
|
] })
|
|
127
127
|
] })
|
|
128
128
|
] });
|
|
@@ -30,6 +30,7 @@ import { TextLabel, fromModule } from "alinea/ui";
|
|
|
30
30
|
import { Sink } from "alinea/ui/Sink";
|
|
31
31
|
import { IcRoundClose } from "alinea/ui/icons/IcRoundClose";
|
|
32
32
|
import IcRoundDragHandle from "alinea/ui/icons/IcRoundDragHandle";
|
|
33
|
+
import { IcRoundEdit } from "alinea/ui/icons/IcRoundEdit";
|
|
33
34
|
import { IcRoundLink } from "alinea/ui/icons/IcRoundLink";
|
|
34
35
|
import { Suspense, useState } from "react";
|
|
35
36
|
import {
|
|
@@ -100,7 +101,8 @@ function LinkInput({ field }) {
|
|
|
100
101
|
fields: options.pickers[value.type].fields,
|
|
101
102
|
picker: options.pickers[value.type],
|
|
102
103
|
reference: value,
|
|
103
|
-
onRemove: () => mutator.replace(void 0)
|
|
104
|
+
onRemove: () => mutator.replace(void 0),
|
|
105
|
+
onEdit: () => setPickFrom(value.type)
|
|
104
106
|
}
|
|
105
107
|
) : /* @__PURE__ */ jsx("div", { className: styles.create(), children: /* @__PURE__ */ jsx(Create.Root, { children: entries(options.pickers).map(([name, picker2]) => {
|
|
106
108
|
return /* @__PURE__ */ jsx(
|
|
@@ -125,28 +127,24 @@ function LinksInput({
|
|
|
125
127
|
const { options, value, mutator, label } = useField(field);
|
|
126
128
|
const { width, inline, optional, help } = options;
|
|
127
129
|
const [pickFrom, setPickFrom] = useState();
|
|
128
|
-
const picker = pickFrom ? options.pickers[pickFrom] : void 0;
|
|
130
|
+
const picker = pickFrom ? options.pickers[pickFrom.type] : void 0;
|
|
129
131
|
function handleConfirm(links) {
|
|
130
132
|
if (!pickFrom || !picker || !links)
|
|
131
133
|
return;
|
|
132
134
|
const seen = /* @__PURE__ */ new Set();
|
|
133
135
|
for (const link of links) {
|
|
134
|
-
if (link.type !== pickFrom)
|
|
136
|
+
if (link.type !== pickFrom.type)
|
|
135
137
|
continue;
|
|
136
138
|
seen.add(link.id);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
else
|
|
142
|
-
mutator.push(link);
|
|
143
|
-
} else {
|
|
139
|
+
const index = value.findIndex((v) => v.id === link.id);
|
|
140
|
+
if (index > -1)
|
|
141
|
+
mutator.replace(link.id, link);
|
|
142
|
+
else
|
|
144
143
|
mutator.push(link);
|
|
145
|
-
}
|
|
146
144
|
}
|
|
147
145
|
if (picker.handlesMultiple)
|
|
148
146
|
for (const link of value) {
|
|
149
|
-
if (link.type !== pickFrom)
|
|
147
|
+
if (link.type !== pickFrom.type)
|
|
150
148
|
continue;
|
|
151
149
|
if (seen.has(link.id))
|
|
152
150
|
continue;
|
|
@@ -176,12 +174,18 @@ function LinksInput({
|
|
|
176
174
|
const showLinkPicker = options.max ? value.length < options.max : true;
|
|
177
175
|
const PickerView = picker && picker.view;
|
|
178
176
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
179
|
-
PickerView && /* @__PURE__ */ jsx(
|
|
177
|
+
pickFrom && PickerView && /* @__PURE__ */ jsx(
|
|
180
178
|
PickerView,
|
|
181
179
|
{
|
|
182
|
-
type: pickFrom,
|
|
180
|
+
type: pickFrom.type,
|
|
183
181
|
options: picker.options,
|
|
184
|
-
selection: value.filter((ref) =>
|
|
182
|
+
selection: value.filter((ref) => {
|
|
183
|
+
if (ref.id === pickFrom.id)
|
|
184
|
+
return true;
|
|
185
|
+
if (picker.handlesMultiple)
|
|
186
|
+
return ref.type === pickFrom.type;
|
|
187
|
+
return false;
|
|
188
|
+
}),
|
|
185
189
|
onConfirm: handleConfirm,
|
|
186
190
|
onCancel: () => setPickFrom(void 0)
|
|
187
191
|
}
|
|
@@ -223,6 +227,7 @@ function LinksInput({
|
|
|
223
227
|
picker: options.pickers[reference.type],
|
|
224
228
|
reference,
|
|
225
229
|
onRemove: () => mutator.remove(reference.id),
|
|
230
|
+
onEdit: () => setPickFrom(reference),
|
|
226
231
|
isSortable: options.max !== 1
|
|
227
232
|
},
|
|
228
233
|
reference.id
|
|
@@ -232,7 +237,7 @@ function LinksInput({
|
|
|
232
237
|
return /* @__PURE__ */ jsx(
|
|
233
238
|
Create.Button,
|
|
234
239
|
{
|
|
235
|
-
onClick: () => setPickFrom(name),
|
|
240
|
+
onClick: () => setPickFrom({ type: name }),
|
|
236
241
|
children: /* @__PURE__ */ jsx(TextLabel, { label: picker2.label })
|
|
237
242
|
},
|
|
238
243
|
name
|
|
@@ -257,6 +262,7 @@ function LinksInput({
|
|
|
257
262
|
picker: options.pickers[dragging.type],
|
|
258
263
|
reference: dragging,
|
|
259
264
|
onRemove: () => mutator.remove(dragging.id),
|
|
265
|
+
onEdit: () => setPickFrom(dragging),
|
|
260
266
|
isDragOverlay: true,
|
|
261
267
|
isSortable: options.max !== 1
|
|
262
268
|
}
|
|
@@ -303,6 +309,7 @@ function LinkInputRow({
|
|
|
303
309
|
picker,
|
|
304
310
|
fields,
|
|
305
311
|
reference,
|
|
312
|
+
onEdit,
|
|
306
313
|
onRemove,
|
|
307
314
|
handle,
|
|
308
315
|
rootRef,
|
|
@@ -332,7 +339,10 @@ function LinkInputRow({
|
|
|
332
339
|
}
|
|
333
340
|
) : /* @__PURE__ */ jsx("div", { className: styles.row.staticHandle(), children: /* @__PURE__ */ jsx(IcRoundLink, {}) }) }),
|
|
334
341
|
/* @__PURE__ */ jsx("div", { style: { flexGrow: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(RowView, { reference }) }) }),
|
|
335
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ jsxs(Sink.Options, { children: [
|
|
343
|
+
/* @__PURE__ */ jsx(IconButton, { icon: IcRoundEdit, onClick: onEdit }),
|
|
344
|
+
/* @__PURE__ */ jsx(IconButton, { icon: IcRoundClose, onClick: onRemove })
|
|
345
|
+
] })
|
|
336
346
|
] }),
|
|
337
347
|
fields && /* @__PURE__ */ jsx(Sink.Content, { children: /* @__PURE__ */ jsx(InputForm, { type: fields }) })
|
|
338
348
|
]
|
|
@@ -340,7 +350,7 @@ function LinkInputRow({
|
|
|
340
350
|
);
|
|
341
351
|
if (!fields)
|
|
342
352
|
return inner;
|
|
343
|
-
return /* @__PURE__ */ jsx(FormRow, { field,
|
|
353
|
+
return /* @__PURE__ */ jsx(FormRow, { field, type: fields, children: inner });
|
|
344
354
|
}
|
|
345
355
|
export {
|
|
346
356
|
createLink,
|
|
@@ -2,5 +2,5 @@ import { PickerProps } from 'alinea/core';
|
|
|
2
2
|
import { urlPicker as createUrlPicker } from './UrlPicker.js';
|
|
3
3
|
export * from './UrlPicker.js';
|
|
4
4
|
export declare const urlPicker: typeof createUrlPicker;
|
|
5
|
-
export declare function UrlPickerForm({ options, onConfirm, onCancel }: PickerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function UrlPickerForm({ selection, options, onConfirm, onCancel }: PickerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function UrlPickerModal(props: PickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,19 +24,27 @@ var linkForm = type("Link", {
|
|
|
24
24
|
optional: true,
|
|
25
25
|
help: "Text to display inside the link element"
|
|
26
26
|
}),
|
|
27
|
-
blank: check("
|
|
28
|
-
description: "
|
|
27
|
+
blank: check("Target", {
|
|
28
|
+
description: "Open link in new tab",
|
|
29
29
|
initialValue: true
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
|
-
function UrlPickerForm({
|
|
33
|
-
|
|
32
|
+
function UrlPickerForm({
|
|
33
|
+
selection,
|
|
34
|
+
options,
|
|
35
|
+
onConfirm,
|
|
36
|
+
onCancel
|
|
37
|
+
}) {
|
|
38
|
+
const preSelected = selection?.[0];
|
|
39
|
+
const form = useForm(linkForm, {
|
|
40
|
+
initialValue: preSelected ? { ...preSelected, blank: preSelected.target === "_blank" } : void 0
|
|
41
|
+
});
|
|
34
42
|
function handleSubmit(e) {
|
|
35
43
|
e.preventDefault();
|
|
36
44
|
e.stopPropagation();
|
|
37
45
|
const data = form.data();
|
|
38
46
|
const reference = {
|
|
39
|
-
id: createId(),
|
|
47
|
+
id: preSelected?.id ?? createId(),
|
|
40
48
|
type: "url",
|
|
41
49
|
ref: "url",
|
|
42
50
|
url: data.url,
|