alinea 0.9.0 → 0.9.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.
@@ -2,7 +2,7 @@
2
2
  var package_default = {
3
3
  bin: "./dist/cli.js",
4
4
  name: "alinea",
5
- version: "0.9.0",
5
+ version: "0.9.2",
6
6
  license: "MIT",
7
7
  type: "module",
8
8
  scripts: {
package/dist/cli/Serve.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunks/chunk-UJJSVROY.js";
4
4
  import {
5
5
  package_default
6
- } from "../chunks/chunk-ZOF2XAUZ.js";
6
+ } from "../chunks/chunk-74APDWPS.js";
7
7
  import "../chunks/chunk-U5RRZUYZ.js";
8
8
 
9
9
  // src/cli/Serve.ts
package/dist/cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-ZOF2XAUZ.js";
3
+ } from "../chunks/chunk-74APDWPS.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // node_modules/mri/lib/index.mjs
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../../chunks/chunk-ZOF2XAUZ.js";
3
+ } from "../../chunks/chunk-74APDWPS.js";
4
4
  import {
5
5
  __commonJS,
6
6
  __toESM
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunks/chunk-IKINPSS5.js";
4
4
  import {
5
5
  package_default
6
- } from "../../chunks/chunk-ZOF2XAUZ.js";
6
+ } from "../../chunks/chunk-74APDWPS.js";
7
7
  import "../../chunks/chunk-U5RRZUYZ.js";
8
8
 
9
9
  // src/cloud/server/CloudAuthServer.ts
@@ -9,11 +9,13 @@ var Node;
9
9
  }
10
10
  Node2.isText = isText;
11
11
  function isElement(node) {
12
- return node[Node2.type] !== "text" && node[Node2.type][0]?.toLowerCase() === node[Node2.type][0];
12
+ const typeName = node[Node2.type];
13
+ return typeof typeName === "string" && typeName !== "text" && typeName[0]?.toLowerCase() === typeName[0];
13
14
  }
14
15
  Node2.isElement = isElement;
15
16
  function isBlock(node) {
16
- return node[Node2.type] !== "text" && node[Node2.type][0]?.toUpperCase() === node[Node2.type][0];
17
+ const typeName = node[Node2.type];
18
+ return typeof typeName === "string" && typeName !== "text" && typeName[0]?.toUpperCase() === typeName[0];
17
19
  }
18
20
  Node2.isBlock = isBlock;
19
21
  })(Node || (Node = {}));
@@ -41,7 +41,7 @@ var Operation = class _Operation {
41
41
  const typeNames = Schema.typeNames(config.schema);
42
42
  const typeName = typeNames.get(type);
43
43
  if (!typeName)
44
- throw new Error(`Type not found: ${type}`);
44
+ throw new Error(`Type "${Type.label(type)}" not found in Schema`);
45
45
  return typeName;
46
46
  }
47
47
  };
package/dist/core/Type.js CHANGED
@@ -195,14 +195,7 @@ See: https://alinea.sh/docs/configuration/schema/type#fields-must-be-unique`
195
195
  return Expr.and(...conditions)[Expr.Data];
196
196
  }
197
197
  call(...input) {
198
- const isConditionalRecord = input.length === 1 && !Expr.isExpr(input[0]);
199
- if (isConditionalRecord)
200
- return new Cursor.Typed(this.target, input[0]);
201
- else
202
- return new Cursor.Find({
203
- target: { type: this.target },
204
- where: this.condition(input)
205
- });
198
+ return new Cursor.Typed(this.target, input[0]);
206
199
  }
207
200
  field(def, name) {
208
201
  return assign(Expr(ExprData.Field({ type: this.target }, name)), {
@@ -48,6 +48,7 @@ var Cursor = class _Cursor {
48
48
  whereId(entryId) {
49
49
  return new Get(
50
50
  this.with({
51
+ first: true,
51
52
  where: Expr(ExprData.Field({}, "entryId")).is(entryId)[Expr.Data]
52
53
  })
53
54
  );
@@ -375,8 +375,14 @@ var RichTextShape = class {
375
375
  if (!this.blocks)
376
376
  throw new Error("No types defined");
377
377
  const shape = this.blocks[block];
378
- const row = { ...shape.create(), id, type: block };
379
- map.set(id, shape.toY(row));
378
+ map.set(
379
+ id,
380
+ shape.toY({
381
+ ...shape.create(),
382
+ [Node.type]: block,
383
+ [BlockNode.id]: id
384
+ })
385
+ );
380
386
  }
381
387
  };
382
388
  }
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunks/chunk-7YXWNKGS.js";
4
4
  import {
5
5
  package_default
6
- } from "../../chunks/chunk-ZOF2XAUZ.js";
6
+ } from "../../chunks/chunk-74APDWPS.js";
7
7
  import {
8
8
  connect
9
9
  } from "../../chunks/chunk-LMUDRU2U.js";
@@ -1727,10 +1727,8 @@ function InsertMenu({ editor, schema, onInsert }) {
1727
1727
  onClick: () => {
1728
1728
  onInsert(id, key);
1729
1729
  editor.chain().focus().insertContent({
1730
- [Node2.type]: key,
1731
- attrs: {
1732
- [BlockNode.id]: id
1733
- }
1730
+ type: key,
1731
+ attrs: { [BlockNode.id]: id }
1734
1732
  }).run();
1735
1733
  },
1736
1734
  children: /* @__PURE__ */ jsxs(HStack, { center: true, gap: 8, children: [
@@ -4,9 +4,10 @@ import "../../chunks/chunk-U5RRZUYZ.js";
4
4
  import { Hint } from "alinea/core/Hint";
5
5
  import { Reference } from "alinea/core/Reference";
6
6
  import { Type, type } from "alinea/core/Type";
7
+ import { ListRow } from "alinea/core/shape/ListShape";
7
8
  import { RecordShape } from "alinea/core/shape/RecordShape";
8
9
  import { ScalarShape } from "alinea/core/shape/ScalarShape";
9
- import { assign } from "alinea/core/util/Objects";
10
+ import { assign, keys } from "alinea/core/util/Objects";
10
11
  import { EntryReference } from "./EntryReference.js";
11
12
  function entryPicker(options) {
12
13
  const fieldType = Type.isType(options.fields) ? options.fields : options.fields && type({ fields: options.fields });
@@ -27,11 +28,11 @@ function entryPicker(options) {
27
28
  [Reference.id]: id,
28
29
  [Reference.type]: type2,
29
30
  [EntryReference.entry]: entryId,
31
+ [ListRow.index]: index,
30
32
  ...fields
31
33
  } = row;
32
- for (const key of Object.keys(fields))
34
+ for (const key of keys(fields))
33
35
  delete row[key];
34
- row.id = entryId;
35
36
  row.fields = fields;
36
37
  if (!entryId)
37
38
  return;
@@ -4,6 +4,7 @@ import "../../chunks/chunk-U5RRZUYZ.js";
4
4
  import { Hint } from "alinea/core/Hint";
5
5
  import { Reference } from "alinea/core/Reference";
6
6
  import { Type, type } from "alinea/core/Type";
7
+ import { ListRow } from "alinea/core/shape/ListShape";
7
8
  import { RecordShape } from "alinea/core/shape/RecordShape";
8
9
  import { ScalarShape } from "alinea/core/shape/ScalarShape";
9
10
  import { keys } from "alinea/core/util/Objects";
@@ -40,6 +41,7 @@ function urlPicker(options) {
40
41
  [UrlReference.url]: url,
41
42
  [UrlReference.title]: title,
42
43
  [UrlReference.target]: target,
44
+ [ListRow.index]: index,
43
45
  ...fields
44
46
  } = row;
45
47
  const fieldKeys = keys(fields);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bin": "./dist/cli.js",
3
3
  "name": "alinea",
4
- "version": "0.9.0",
4
+ "version": "0.9.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "scripts": {