alinea 0.5.5 → 0.5.7

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 (66) hide show
  1. package/dist/alinea.d.ts +1 -1
  2. package/dist/alinea.js +2 -0
  3. package/dist/backend/Database.js +3 -2
  4. package/dist/backend/Handler.d.ts +1 -1
  5. package/dist/backend/Handler.js +8 -4
  6. package/dist/backend/Store.js +1 -1
  7. package/dist/backend/resolver/EntryResolver.d.ts +1 -0
  8. package/dist/backend/resolver/EntryResolver.js +23 -2
  9. package/dist/chunks/{chunk-ULWFKWBM.js → chunk-3MWKUYTW.js} +1 -1
  10. package/dist/chunks/{chunk-TY7XOXM3.js → chunk-AAR2W5FM.js} +4 -1
  11. package/dist/chunks/{chunk-VRXHB6DJ.js → chunk-LMUDRU2U.js} +2 -1
  12. package/dist/chunks/{sql.js-75HGQX6U.js → sql.js-RSY2XONK.js} +1 -1
  13. package/dist/cli/Generate.js +9 -9
  14. package/dist/cli/Serve.js +1 -1
  15. package/dist/cli/bin.js +1 -1
  16. package/dist/cli/generate/GenerateDashboard.js +1 -1
  17. package/dist/cloud/server/CloudAuthServer.js +1 -1
  18. package/dist/core/CMS.d.ts +0 -1
  19. package/dist/core/Config.d.ts +3 -1
  20. package/dist/core/Connection.d.ts +1 -0
  21. package/dist/core/EntrySearch.d.ts +1 -0
  22. package/dist/core/EntrySearch.js +1 -0
  23. package/dist/core/Graph.d.ts +12 -0
  24. package/dist/core/Graph.js +24 -0
  25. package/dist/core/Resolver.d.ts +1 -0
  26. package/dist/core/Shape.d.ts +1 -1
  27. package/dist/core/Type.d.ts +1 -0
  28. package/dist/core/Type.js +4 -0
  29. package/dist/core/Type.test.d.ts +1 -0
  30. package/dist/core/driver/DefaultDriver.d.ts +0 -1
  31. package/dist/core/driver/DefaultDriver.js +0 -3
  32. package/dist/core/driver/DefaultDriver.server.d.ts +0 -1
  33. package/dist/core/driver/DefaultDriver.server.js +1 -5
  34. package/dist/core/driver/NextDriver.server.js +1 -0
  35. package/dist/core/driver/TestDriver.js +1 -1
  36. package/dist/core/field/RichTextField.d.ts +3 -1
  37. package/dist/core/field/RichTextField.js +2 -1
  38. package/dist/core/field/ScalarField.d.ts +3 -1
  39. package/dist/core/field/ScalarField.js +5 -1
  40. package/dist/core/pages/ExprData.d.ts +9 -1
  41. package/dist/core/pages/ExprData.js +12 -1
  42. package/dist/core/pages/Serialize.js +2 -0
  43. package/dist/core/pages/Snippet.d.ts +2 -0
  44. package/dist/core/pages/Snippet.js +18 -0
  45. package/dist/core/pages/index.d.ts +1 -0
  46. package/dist/core/pages/index.js +1 -0
  47. package/dist/core/shape/ListShape.d.ts +1 -0
  48. package/dist/core/shape/ListShape.js +13 -0
  49. package/dist/core/shape/RecordShape.d.ts +1 -0
  50. package/dist/core/shape/RecordShape.js +8 -0
  51. package/dist/core/shape/RichTextShape.d.ts +5 -2
  52. package/dist/core/shape/RichTextShape.js +26 -1
  53. package/dist/core/shape/ScalarShape.d.ts +3 -1
  54. package/dist/core/shape/ScalarShape.js +8 -1
  55. package/dist/core/shape/UnionShape.d.ts +1 -0
  56. package/dist/core/shape/UnionShape.js +16 -0
  57. package/dist/core/util/EntryRows.js +4 -1
  58. package/dist/core.d.ts +1 -0
  59. package/dist/core.js +1 -0
  60. package/dist/dashboard/util/PersistentStore.js +1 -1
  61. package/dist/input/richtext/RichTextField.d.ts +2 -6
  62. package/dist/input/text/TextField.d.ts +2 -0
  63. package/dist/ui/icons/IcRoundSearch.d.ts +0 -1
  64. package/dist/ui/icons/IcRoundSearch.js +1 -3
  65. package/dist/ui/util/TextareaAutosize.d.ts +1 -1
  66. package/package.json +1 -1
package/dist/alinea.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { createConfig as config, Meta as meta, page, root, schema, track, type, workspace } from 'alinea/core';
1
+ export { createConfig as config, Meta as meta, page, root, schema, snippet, track, type, workspace } from 'alinea/core';
2
2
  export type { Infer as infer } from 'alinea/core';
3
3
  export { createMediaRoot as media } from 'alinea/core/media/MediaRoot';
4
4
  export * from './input.js';
package/dist/alinea.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  page,
8
8
  root,
9
9
  schema,
10
+ snippet,
10
11
  track,
11
12
  type,
12
13
  workspace
@@ -20,6 +21,7 @@ export {
20
21
  page,
21
22
  root,
22
23
  schema,
24
+ snippet,
23
25
  track,
24
26
  type,
25
27
  workspace
@@ -5,7 +5,7 @@ import {
5
5
  alias,
6
6
  create,
7
7
  exists
8
- } from "../chunks/chunk-TY7XOXM3.js";
8
+ } from "../chunks/chunk-AAR2W5FM.js";
9
9
  import {
10
10
  Expr
11
11
  } from "../chunks/chunk-4JLFL6LD.js";
@@ -17,6 +17,7 @@ import {
17
17
  PageSeed,
18
18
  Root,
19
19
  Schema,
20
+ Type,
20
21
  Workspace,
21
22
  createId,
22
23
  unreachable
@@ -438,7 +439,7 @@ ${JSON.stringify(mutation)}`
438
439
  ...data,
439
440
  path: pathData
440
441
  };
441
- const searchableText = "";
442
+ const searchableText = Type.searchableText(type, entryData);
442
443
  return {
443
444
  workspace: meta.workspace,
444
445
  root: meta.root,
@@ -59,7 +59,7 @@ export declare class Handler implements Resolver {
59
59
  url: string;
60
60
  searchableText: string;
61
61
  } | undefined>;
62
- periodicSync(): Promise<void>;
62
+ periodicSync(syncInterval?: number): Promise<void>;
63
63
  syncPending(): Promise<{
64
64
  commitHash: string;
65
65
  contentHash: string;
@@ -54,8 +54,10 @@ var Handler = class {
54
54
  resolver;
55
55
  resolve = async (params) => {
56
56
  const { resolveDefaults } = this.options;
57
- await this.periodicSync();
58
- return this.resolver.resolve({ ...resolveDefaults, ...params });
57
+ const resolveParams = { ...resolveDefaults, ...params };
58
+ const { syncInterval } = resolveParams;
59
+ await this.periodicSync(syncInterval);
60
+ return this.resolver.resolve(resolveParams);
59
61
  };
60
62
  previewAuth() {
61
63
  return {
@@ -88,9 +90,11 @@ var Handler = class {
88
90
  const entryData = parseYDoc(type, doc);
89
91
  return { ...entry, ...entryData, path: entry.path };
90
92
  }
91
- async periodicSync() {
93
+ async periodicSync(syncInterval = 5) {
94
+ if (syncInterval === Infinity)
95
+ return;
92
96
  const now = Date.now();
93
- if (now - this.lastSync < 5e3)
97
+ if (now - this.lastSync < syncInterval * 1e3)
94
98
  return;
95
99
  this.lastSync = now;
96
100
  try {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  connect
3
- } from "../chunks/chunk-VRXHB6DJ.js";
3
+ } from "../chunks/chunk-LMUDRU2U.js";
4
4
  import "../chunks/chunk-FLZ4KUMA.js";
5
5
  import "../chunks/chunk-4JLFL6LD.js";
6
6
  import "../chunks/chunk-U5RRZUYZ.js";
@@ -27,6 +27,7 @@ export declare class EntryResolver {
27
27
  exprValue(ctx: ResolveContext, { value }: pages.ExprData.Value): ExprData;
28
28
  exprRecord(ctx: ResolveContext, { fields }: pages.ExprData.Record): ExprData;
29
29
  exprCase(ctx: ResolveContext, { expr, cases, defaultCase }: pages.ExprData.Case): ExprData;
30
+ exprCall(ctx: ResolveContext, { method, args }: pages.ExprData.Call): ExprData;
30
31
  expr(ctx: ResolveContext, expr: pages.ExprData): ExprData;
31
32
  selectRecord(ctx: ResolveContext, { fields }: pages.Selection.Record): ExprData;
32
33
  selectRow(ctx: ResolveContext, { target }: pages.Selection.Row): ExprData;
@@ -1,9 +1,11 @@
1
1
  import {
2
+ bm25,
2
3
  count,
3
4
  iif,
4
5
  match,
6
+ snippet,
5
7
  withRecursive
6
- } from "../../chunks/chunk-TY7XOXM3.js";
8
+ } from "../../chunks/chunk-AAR2W5FM.js";
7
9
  import {
8
10
  BinOpType,
9
11
  Expr,
@@ -130,6 +132,21 @@ var EntryResolver = class {
130
132
  );
131
133
  return res[Expr.Data];
132
134
  }
135
+ exprCall(ctx, { method, args }) {
136
+ switch (method) {
137
+ case "snippet":
138
+ return snippet(
139
+ EntrySearch,
140
+ 1,
141
+ new Expr(this.expr(ctx, args[0])),
142
+ new Expr(this.expr(ctx, args[1])),
143
+ new Expr(this.expr(ctx, args[2])),
144
+ new Expr(this.expr(ctx, args[3]))
145
+ )[Expr.Data];
146
+ default:
147
+ throw new Error(`Unknown method: "${method}"`);
148
+ }
149
+ }
133
150
  expr(ctx, expr) {
134
151
  switch (expr.type) {
135
152
  case "unop":
@@ -146,6 +163,8 @@ var EntryResolver = class {
146
163
  return this.exprRecord(ctx, expr);
147
164
  case "case":
148
165
  return this.exprCase(ctx, expr);
166
+ case "call":
167
+ return this.exprCall(ctx, expr);
149
168
  }
150
169
  }
151
170
  selectRecord(ctx, { fields }) {
@@ -365,7 +384,9 @@ var EntryResolver = class {
365
384
  extra.singleResult = true;
366
385
  if (groupBy)
367
386
  extra.groupBy = groupBy.map((expr) => this.expr(ctx, expr));
368
- if (orderBy)
387
+ if (searchTerms)
388
+ extra.orderBy = [bm25(EntrySearch, 20, 1).asc()];
389
+ else if (orderBy)
369
390
  extra.orderBy = this.orderBy(ctx, orderBy);
370
391
  return query[Query.Data].with(extra);
371
392
  }
@@ -2,7 +2,7 @@
2
2
  var package_default = {
3
3
  bin: "./dist/cli.js",
4
4
  name: "alinea",
5
- version: "0.5.5",
5
+ version: "0.5.7",
6
6
  license: "MIT",
7
7
  type: "module",
8
8
  scripts: {
@@ -36,6 +36,7 @@ var {
36
36
  iif,
37
37
  exists,
38
38
  match,
39
+ bm25,
39
40
  highlight,
40
41
  snippet,
41
42
  cast,
@@ -112,5 +113,7 @@ export {
112
113
  count,
113
114
  iif,
114
115
  exists,
115
- match
116
+ match,
117
+ bm25,
118
+ snippet
116
119
  };
@@ -335,8 +335,8 @@ var AsyncDriver = class extends DriverBase {
335
335
  }
336
336
  }
337
337
  async transaction(run) {
338
- const id = `t${this.transactionId++}`;
339
338
  const [connection, release] = await this.isolate();
339
+ const id = `t${this.transactionId++}`;
340
340
  await connection.executeQuery(
341
341
  new QueryData.Transaction({ op: QueryData.TransactionOperation.Begin, id })
342
342
  );
@@ -1353,6 +1353,7 @@ var SqliteFormatter = class extends Formatter {
1353
1353
  stmt.raw(" MATCH ");
1354
1354
  this.formatExprValue(ctx, query);
1355
1355
  return stmt;
1356
+ case "bm25":
1356
1357
  case "highlight":
1357
1358
  case "snippet":
1358
1359
  stmt.identifier(expr.method);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SqlJsDriver,
3
3
  connect
4
- } from "./chunk-VRXHB6DJ.js";
4
+ } from "./chunk-LMUDRU2U.js";
5
5
  import "./chunk-FLZ4KUMA.js";
6
6
  import "./chunk-4JLFL6LD.js";
7
7
  import "./chunk-U5RRZUYZ.js";
@@ -1,6 +1,8 @@
1
1
  import "../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/cli/Generate.ts
4
+ import { exportStore } from "alinea/cli/util/ExportStore.server";
5
+ import { join } from "alinea/core/util/Paths";
4
6
  import fs from "node:fs";
5
7
  import { createRequire } from "node:module";
6
8
  import path from "node:path";
@@ -27,7 +29,7 @@ function generatePackage(context, config) {
27
29
  async function createDb() {
28
30
  const { default: sqlite } = await import("@alinea/sqlite-wasm");
29
31
  const { Database } = await sqlite();
30
- const { connect } = await import("../chunks/sql.js-75HGQX6U.js");
32
+ const { connect } = await import("../chunks/sql.js-RSY2XONK.js");
31
33
  const db = new Database();
32
34
  const store = connect(db).toAsync();
33
35
  return [store, () => db.export()];
@@ -62,14 +64,17 @@ async function* generate(options) {
62
64
  const builds = compileConfig(context)[Symbol.asyncIterator]();
63
65
  let nextBuild = builds.next();
64
66
  let afterGenerateCalled = false;
65
- const [store, exportStore] = await createDb();
67
+ function writeStore(data) {
68
+ return exportStore(data, join(context.outDir, "store.js"));
69
+ }
70
+ const [store, storeData] = await createDb();
66
71
  await copyStaticFiles(context);
67
72
  while (true) {
68
73
  const { done } = await nextBuild;
69
74
  nextBuild = builds.next();
70
75
  try {
71
76
  const cms = await loadCMS(context.outDir);
72
- cms.exportStore(context.outDir, new Uint8Array());
77
+ await writeStore(new Uint8Array());
73
78
  const fileData = new LocalData({
74
79
  config: cms.config,
75
80
  fs: fs.promises,
@@ -84,11 +89,6 @@ async function* generate(options) {
84
89
  nextBuild
85
90
  )) {
86
91
  yield { cms, db, localData: fileData };
87
- if (process.env.NODE_ENV === "development")
88
- fs.writeFileSync(
89
- path.join(context.outDir, "content.sqlite"),
90
- exportStore()
91
- );
92
92
  if (onAfterGenerate && !afterGenerateCalled) {
93
93
  afterGenerateCalled = true;
94
94
  onAfterGenerate();
@@ -97,7 +97,7 @@ async function* generate(options) {
97
97
  if (done) {
98
98
  await Promise.all([
99
99
  generatePackage(context, cms.config),
100
- cms.exportStore(context.outDir, exportStore())
100
+ writeStore(storeData())
101
101
  ]);
102
102
  break;
103
103
  }
package/dist/cli/Serve.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-ULWFKWBM.js";
3
+ } from "../chunks/chunk-3MWKUYTW.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // 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-ULWFKWBM.js";
3
+ } from "../chunks/chunk-3MWKUYTW.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-ULWFKWBM.js";
3
+ } from "../../chunks/chunk-3MWKUYTW.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-ULWFKWBM.js";
6
+ } from "../../chunks/chunk-3MWKUYTW.js";
7
7
  import "../../chunks/chunk-U5RRZUYZ.js";
8
8
 
9
9
  // src/cloud/server/CloudAuthServer.ts
@@ -14,7 +14,6 @@ export declare abstract class CMS extends GraphRealm implements CMSApi {
14
14
  config: Config;
15
15
  constructor(config: Config);
16
16
  abstract resolver(): Promise<Resolver>;
17
- abstract exportStore(cwd: string, store: Uint8Array): Promise<void>;
18
17
  abstract readStore(): Promise<Store>;
19
18
  get schema(): import("alinea/core").Schema<{}>;
20
19
  get workspaces(): Record<string, Workspace>;
@@ -25,8 +25,10 @@ export interface Config {
25
25
  }>;
26
26
  /** Every edit will pass through a draft phase before being published */
27
27
  enableDrafts?: boolean;
28
+ /** The interval in seconds at which the frontend will poll for updates */
29
+ syncInterval?: number;
28
30
  /**
29
- publicDir?: string
31
+ publicDir?: string
30
32
  dashboardFile?: string
31
33
  handlerUrl?:
32
34
  */
@@ -54,6 +54,7 @@ export declare namespace Connection {
54
54
  selection: Selection;
55
55
  location?: Array<string>;
56
56
  locale?: string;
57
+ syncInterval?: number;
57
58
  }
58
59
  type MediaUploadParams = {
59
60
  buffer: ArrayBuffer;
@@ -2,5 +2,6 @@ import { table } from 'rado';
2
2
  export declare const EntrySearch: import("rado").Table<{
3
3
  title: import("rado").ValueColumn<string>;
4
4
  searchableText: import("rado").ValueColumn<string>;
5
+ rank: import("rado").ValueColumn<number>;
5
6
  }>;
6
7
  export type EntrySearch = table<typeof EntrySearch>;
@@ -9,6 +9,7 @@ var EntrySearch = table({
9
9
  EntrySearch: class {
10
10
  title = column.string;
11
11
  searchableText = column.string;
12
+ rank = column.number;
12
13
  }
13
14
  });
14
15
  export {
@@ -10,11 +10,21 @@ import { Projection } from './pages/Projection.js';
10
10
  import { Selection } from './pages/Selection.js';
11
11
  export type Location = Root | Workspace | PageSeed;
12
12
  export interface GraphRealmApi {
13
+ /** Filter results by location */
13
14
  in(location: Location): GraphRealmApi;
15
+ /** Filter results by locale */
14
16
  locale(locale: string): GraphRealmApi;
17
+ /** Find a single entry or null */
15
18
  maybeGet<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S> | null>;
19
+ /** Find a single entry */
16
20
  get<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S>>;
21
+ /** Find a set of entries */
17
22
  find<S extends Projection | Type>(select: S): Promise<Selection.Infer<S>>;
23
+ /** The time in seconds to poll for updates to content */
24
+ syncInterval(interval: number): GraphRealmApi;
25
+ /** Disable polling for updates to content */
26
+ disableSync(): GraphRealmApi;
27
+ /** The amount of results found */
18
28
  count(cursor: Cursor.Find<any>): Promise<number>;
19
29
  }
20
30
  export interface GraphOrigin {
@@ -27,6 +37,8 @@ export declare class GraphRealm implements GraphRealmApi {
27
37
  private origin;
28
38
  targets: Schema.Targets;
29
39
  constructor(config: Config, resolve: (params: Connection.ResolveParams) => Promise<unknown>, origin?: GraphOrigin);
40
+ disableSync(): GraphRealm;
41
+ syncInterval(interval: number): GraphRealm;
30
42
  in(location: Location): GraphRealmApi;
31
43
  locale(locale: string): GraphRealm;
32
44
  maybeGet<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S> | null>;
@@ -15,6 +15,30 @@ var GraphRealm = class _GraphRealm {
15
15
  this.targets = Schema.targets(config.schema);
16
16
  }
17
17
  targets;
18
+ disableSync() {
19
+ return new _GraphRealm(
20
+ this.config,
21
+ (params) => {
22
+ return this.resolve({
23
+ ...params,
24
+ syncInterval: Infinity
25
+ });
26
+ },
27
+ this.origin
28
+ );
29
+ }
30
+ syncInterval(interval) {
31
+ return new _GraphRealm(
32
+ this.config,
33
+ (params) => {
34
+ return this.resolve({
35
+ ...params,
36
+ syncInterval: interval
37
+ });
38
+ },
39
+ this.origin
40
+ );
41
+ }
18
42
  in(location) {
19
43
  return new _GraphRealm(this.config, this.resolve, { ...this.origin, location });
20
44
  }
@@ -9,6 +9,7 @@ export interface PreviewUpdate {
9
9
  export interface ResolveDefaults {
10
10
  realm?: Realm;
11
11
  preview?: PreviewUpdate;
12
+ syncInterval?: number;
12
13
  }
13
14
  export interface Resolver {
14
15
  resolve(params: Connection.ResolveParams): Promise<unknown>;
@@ -12,7 +12,7 @@ export interface Shape<Value = any, Mutator = any> {
12
12
  init(parent: YType, key: string): void;
13
13
  watch(parent: YType, key: string): (fun: () => void) => () => void;
14
14
  mutator(parent: YType, key: string, readOnly: boolean): Mutator;
15
- toString(): string;
16
15
  applyLinks(value: Value, loader: LinkResolver): Promise<void>;
16
+ searchableText(value: Value): string;
17
17
  }
18
18
  export {};
@@ -64,6 +64,7 @@ export declare namespace Type {
64
64
  function label(type: Type): Label;
65
65
  function meta(type: Type): TypeMeta;
66
66
  function shape(type: Type): RecordShape;
67
+ function searchableText(type: Type, value: any): string;
67
68
  function fields(type: Type): Record<string, Field>;
68
69
  function hint(type: Type): Hint;
69
70
  function sections(type: Type): Section[];
package/dist/core/Type.js CHANGED
@@ -34,6 +34,10 @@ var Type;
34
34
  return type2[Type2.Data].shape;
35
35
  }
36
36
  Type2.shape = shape;
37
+ function searchableText(type2, value) {
38
+ return shape(type2).searchableText(value).trim();
39
+ }
40
+ Type2.searchableText = searchableText;
37
41
  function fields(type2) {
38
42
  return type2;
39
43
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,6 @@ import { CMS, CMSApi } from '../CMS.js';
3
3
  import { Config } from '../Config.js';
4
4
  import { Resolver } from '../Resolver.js';
5
5
  export declare class DefaultDriver extends CMS {
6
- exportStore(outDir: string, data: Uint8Array): Promise<void>;
7
6
  readStore(): Promise<Store>;
8
7
  resolver(): Promise<Resolver>;
9
8
  }
@@ -3,9 +3,6 @@ import "../../chunks/chunk-U5RRZUYZ.js";
3
3
  // src/core/driver/DefaultDriver.tsx
4
4
  import { CMS } from "../CMS.js";
5
5
  var DefaultDriver = class extends CMS {
6
- exportStore(outDir, data) {
7
- throw new Error("Not implemented");
8
- }
9
6
  async readStore() {
10
7
  throw new Error("Not implemented");
11
8
  }
@@ -6,7 +6,6 @@ import { Config } from '../Config.js';
6
6
  import { Resolver } from '../Resolver.js';
7
7
  export declare class DefaultDriver extends CMS {
8
8
  db: PLazy<Database>;
9
- exportStore(outDir: string, data: Uint8Array): Promise<void>;
10
9
  readStore(): Promise<Store>;
11
10
  resolver(): Promise<Resolver>;
12
11
  private createDb;
@@ -7,17 +7,12 @@ import "../../chunks/chunk-U5RRZUYZ.js";
7
7
  import { Database } from "alinea/backend";
8
8
  import { createStore } from "alinea/backend/Store";
9
9
  import { EntryResolver } from "alinea/backend/resolver/EntryResolver";
10
- import { exportStore } from "alinea/cli/util/ExportStore";
11
10
  import { base64 } from "alinea/core/util/Encoding";
12
11
  import { CMS } from "../CMS.js";
13
12
  import { Client } from "../Client.js";
14
13
  import { Realm } from "../pages/Realm.js";
15
- import { join } from "../util/Paths.js";
16
14
  var DefaultDriver = class extends CMS {
17
15
  db = PLazy.from(this.createDb.bind(this));
18
- exportStore(outDir, data) {
19
- return exportStore(data, join(outDir, "store.js"));
20
- }
21
16
  async readStore() {
22
17
  const { storeData } = await import("@alinea/generated/store.js");
23
18
  return createStore(new Uint8Array(base64.parse(storeData)));
@@ -29,6 +24,7 @@ var DefaultDriver = class extends CMS {
29
24
  config: this.config,
30
25
  url: devUrl,
31
26
  resolveDefaults: {
27
+ syncInterval: this.config.syncInterval ?? 60,
32
28
  realm: Realm.Published
33
29
  }
34
30
  });
@@ -38,6 +38,7 @@ var NextDriver = class extends DefaultDriver {
38
38
  const [draftStatus] = outcome(() => draftMode());
39
39
  const isDraft = draftStatus?.isEnabled;
40
40
  const resolveDefaults = {
41
+ syncInterval: this.config.syncInterval ?? 60,
41
42
  realm: Realm.Published
42
43
  };
43
44
  if (isDraft) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  connect
3
- } from "../../chunks/chunk-VRXHB6DJ.js";
3
+ } from "../../chunks/chunk-LMUDRU2U.js";
4
4
  import "../../chunks/chunk-FLZ4KUMA.js";
5
5
  import "../../chunks/chunk-4JLFL6LD.js";
6
6
  import "../../chunks/chunk-U5RRZUYZ.js";
@@ -2,7 +2,9 @@ import { RichTextMutator } from 'alinea/core';
2
2
  import { Field, FieldMeta, FieldOptions } from '../Field.js';
3
3
  import { TextDoc } from '../TextDoc.js';
4
4
  import { RecordShape } from '../shape/RecordShape.js';
5
- export declare class RichTextField<Blocks, Options extends FieldOptions<TextDoc<Blocks>>> extends Field<TextDoc<Blocks>, RichTextMutator<Blocks>, Options> {
5
+ export declare class RichTextField<Blocks, Options extends FieldOptions<TextDoc<Blocks>> & {
6
+ searchable?: boolean;
7
+ }> extends Field<TextDoc<Blocks>, RichTextMutator<Blocks>, Options> {
6
8
  constructor(shape: {
7
9
  [key: string]: RecordShape<any>;
8
10
  } | undefined, meta: FieldMeta<TextDoc<Blocks>, RichTextMutator<Blocks>, Options>);
@@ -9,7 +9,8 @@ var RichTextField = class extends Field {
9
9
  shape: new RichTextShape(
10
10
  meta.options.label,
11
11
  shape,
12
- meta.options.initialValue
12
+ meta.options.initialValue,
13
+ meta.options.searchable
13
14
  ),
14
15
  ...meta
15
16
  });
@@ -1,4 +1,6 @@
1
1
  import { Field, FieldMeta, FieldOptions } from '../Field.js';
2
- export declare class ScalarField<Value, Options extends FieldOptions<Value>> extends Field<Value, (value: Value) => void, Options> {
2
+ export declare class ScalarField<Value, Options extends FieldOptions<Value> & {
3
+ searchable?: boolean;
4
+ }> extends Field<Value, (value: Value) => void, Options> {
3
5
  constructor(meta: FieldMeta<Value, (value: Value) => void, Options>);
4
6
  }
@@ -6,7 +6,11 @@ import { ScalarShape } from "../shape/ScalarShape.js";
6
6
  var ScalarField = class extends Field {
7
7
  constructor(meta) {
8
8
  super({
9
- shape: new ScalarShape(meta.options.label, meta.options.initialValue),
9
+ shape: new ScalarShape(
10
+ meta.options.label,
11
+ meta.options.initialValue,
12
+ meta.options.searchable
13
+ ),
10
14
  ...meta
11
15
  });
12
16
  }
@@ -24,7 +24,7 @@ export declare enum BinaryOp {
24
24
  NotIn = "NotIn",
25
25
  Concat = "Concat"
26
26
  }
27
- export type ExprData = ExprData.UnOp | ExprData.BinOp | ExprData.Field | ExprData.Access | ExprData.Value | ExprData.Record | ExprData.Case;
27
+ export type ExprData = ExprData.UnOp | ExprData.BinOp | ExprData.Field | ExprData.Access | ExprData.Value | ExprData.Record | ExprData.Case | ExprData.Call;
28
28
  export declare namespace ExprData {
29
29
  namespace types {
30
30
  class UnOp {
@@ -65,6 +65,11 @@ export declare namespace ExprData {
65
65
  cases: Type<[ExprData, Selection<T>][]>;
66
66
  defaultCase?: Type<Selection<T> | undefined> | undefined;
67
67
  }
68
+ class Call {
69
+ type: Type<"call">;
70
+ method: Type<string>;
71
+ args: Type<ExprData[]>;
72
+ }
68
73
  }
69
74
  export interface UnOp extends Infer<types.UnOp> {
70
75
  }
@@ -89,6 +94,9 @@ export declare namespace ExprData {
89
94
  export interface Case extends Infer<types.Case> {
90
95
  }
91
96
  export function Case(expr: ExprData, cases: Array<[ExprData, Selection]>, defaultCase?: Selection): ExprData;
97
+ export interface Call extends Infer<types.Call> {
98
+ }
99
+ export function Call(method: string, args: Array<ExprData>): ExprData;
92
100
  export const adt: Type<ExprData>;
93
101
  export {};
94
102
  }
@@ -84,6 +84,12 @@ var ExprData;
84
84
  defaultCase = Selection.adt.optional;
85
85
  }
86
86
  types2.Case = Case2;
87
+ class Call2 {
88
+ type = literal("call");
89
+ method = string;
90
+ args = array(ExprData2.adt);
91
+ }
92
+ types2.Call = Call2;
87
93
  })(types || (types = {}));
88
94
  function UnOp(op, expr) {
89
95
  return { type: "unop", op, expr };
@@ -113,6 +119,10 @@ var ExprData;
113
119
  return { type: "case", expr, cases, defaultCase };
114
120
  }
115
121
  ExprData2.Case = Case;
122
+ function Call(method, args) {
123
+ return { type: "call", method, args };
124
+ }
125
+ ExprData2.Call = Call;
116
126
  ExprData2.adt = union(
117
127
  types.UnOp,
118
128
  types.BinOp,
@@ -120,7 +130,8 @@ var ExprData;
120
130
  types.Access,
121
131
  types.Value,
122
132
  types.Record,
123
- types.Case
133
+ types.Case,
134
+ types.Call
124
135
  );
125
136
  })(ExprData || (ExprData = {}));
126
137
  export {
@@ -96,6 +96,8 @@ function seralizeExpr(targets, expr) {
96
96
  if (expr.defaultCase)
97
97
  serializeSelection(targets, expr.defaultCase);
98
98
  return;
99
+ case "call":
100
+ return;
99
101
  default:
100
102
  unreachable(expr);
101
103
  }
@@ -0,0 +1,2 @@
1
+ import { Expr } from './Expr.js';
2
+ export declare function snippet(start?: string, end?: string, cutOff?: string, limit?: number): Expr<unknown>;
@@ -0,0 +1,18 @@
1
+ import "../../chunks/chunk-U5RRZUYZ.js";
2
+
3
+ // src/core/pages/Snippet.ts
4
+ import { Expr } from "./Expr.js";
5
+ import { ExprData } from "./ExprData.js";
6
+ function snippet(start = "<mark>", end = "</mark>", cutOff = "...", limit = 64) {
7
+ return Expr(
8
+ ExprData.Call("snippet", [
9
+ ExprData.Value(start),
10
+ ExprData.Value(end),
11
+ ExprData.Value(cutOff),
12
+ ExprData.Value(limit)
13
+ ])
14
+ );
15
+ }
16
+ export {
17
+ snippet
18
+ };
@@ -7,6 +7,7 @@ export * from './ExprData.js';
7
7
  export * from './Fields.js';
8
8
  export * from './Projection.js';
9
9
  export * from './Selection.js';
10
+ export * from './Snippet.js';
10
11
  export * from './Target.js';
11
12
  export * from './TargetData.js';
12
13
  export * from './Tree.js';
@@ -8,6 +8,7 @@ export * from "./ExprData.js";
8
8
  export * from "./Fields.js";
9
9
  export * from "./Projection.js";
10
10
  export * from "./Selection.js";
11
+ export * from "./Snippet.js";
11
12
  export * from "./Target.js";
12
13
  export * from "./TargetData.js";
13
14
  export * from "./Tree.js";
@@ -36,4 +36,5 @@ export declare class ListShape<T extends ListRow> implements Shape<Array<T>, Lis
36
36
  move: (oldIndex: number, newIndex: number) => void;
37
37
  };
38
38
  applyLinks(value: Array<T>, loader: LinkResolver): Promise<void>;
39
+ searchableText(value: Array<T>): string;
39
40
  }
@@ -206,6 +206,19 @@ var ListShape = class {
206
206
  if (this.postProcess)
207
207
  await this.postProcess(value, loader);
208
208
  }
209
+ searchableText(value) {
210
+ let res = "";
211
+ const rows = Array.isArray(value) ? value : [];
212
+ for (const row of rows) {
213
+ const id = row.id;
214
+ const type = row.type;
215
+ const shape = this.values[type];
216
+ if (!id || !type || !shape)
217
+ continue;
218
+ res += shape.searchableText(row);
219
+ }
220
+ return res;
221
+ }
209
222
  };
210
223
  export {
211
224
  ListShape
@@ -21,4 +21,5 @@ export declare class RecordShape<T = object> implements Shape<T, RecordMutator<T
21
21
  set: <K extends keyof T>(k: K, v: T[K]) => void;
22
22
  };
23
23
  applyLinks(value: T, loader: LinkResolver): Promise<void>;
24
+ searchableText(value: T): string;
24
25
  }
@@ -81,6 +81,14 @@ var RecordShape = class _RecordShape {
81
81
  }
82
82
  await Promise.all(tasks);
83
83
  }
84
+ searchableText(value) {
85
+ let res = "";
86
+ const self = value || {};
87
+ for (const key of keys(this.properties)) {
88
+ res += this.properties[key].searchableText(self[key]);
89
+ }
90
+ return res;
91
+ }
84
92
  };
85
93
  export {
86
94
  RecordShape
@@ -2,7 +2,7 @@ import { LinkResolver } from 'alinea/backend/resolver/LinkResolver';
2
2
  import * as Y from 'yjs';
3
3
  import { Label } from '../Label.js';
4
4
  import { Shape } from '../Shape.js';
5
- import { TextDoc } from '../TextDoc.js';
5
+ import { TextDoc, TextNode } from '../TextDoc.js';
6
6
  import { RecordShape } from './RecordShape.js';
7
7
  export type RichTextMutator<R> = {
8
8
  readOnly: boolean;
@@ -25,8 +25,9 @@ export declare class RichTextShape<Blocks> implements Shape<TextDoc<Blocks>, Ric
25
25
  label: Label;
26
26
  shapes?: Record<string, RecordShape<object>> | undefined;
27
27
  initialValue?: TextDoc<Blocks> | undefined;
28
+ searchable?: boolean | undefined;
28
29
  values: Record<string, RecordShape>;
29
- constructor(label: Label, shapes?: Record<string, RecordShape<object>> | undefined, initialValue?: TextDoc<Blocks> | undefined);
30
+ constructor(label: Label, shapes?: Record<string, RecordShape<object>> | undefined, initialValue?: TextDoc<Blocks> | undefined, searchable?: boolean | undefined);
30
31
  create(): TextDoc<Blocks>;
31
32
  toXml(rows: TextDoc<Blocks>): (Y.XmlElement<{
32
33
  [key: string]: string;
@@ -43,4 +44,6 @@ export declare class RichTextShape<Blocks> implements Shape<TextDoc<Blocks>, Ric
43
44
  insert: (id: string, block: string) => void;
44
45
  };
45
46
  applyLinks(doc: TextDoc<Blocks>, loader: LinkResolver): Promise<void>;
47
+ searchableText(value: TextDoc<Blocks>): string;
48
+ textOf(node: TextNode<any>): string;
46
49
  }
@@ -76,10 +76,11 @@ function unserialize(node) {
76
76
  }
77
77
  var linkInfoFields = void 0;
78
78
  var RichTextShape = class {
79
- constructor(label, shapes, initialValue) {
79
+ constructor(label, shapes, initialValue, searchable) {
80
80
  this.label = label;
81
81
  this.shapes = shapes;
82
82
  this.initialValue = initialValue;
83
+ this.searchable = searchable;
83
84
  this.values = shapes ? fromEntries(
84
85
  entries(shapes).map(([key, value]) => {
85
86
  return [
@@ -298,6 +299,30 @@ var RichTextShape = class {
298
299
  )
299
300
  );
300
301
  }
302
+ searchableText(value) {
303
+ let res = "";
304
+ if (!this.searchable)
305
+ return res;
306
+ if (!Array.isArray(value))
307
+ return res;
308
+ return value.reduce((acc, node) => {
309
+ return acc + this.textOf(node);
310
+ }, "");
311
+ }
312
+ textOf(node) {
313
+ if (this.values[node.type]) {
314
+ const shape = this.values[node.type];
315
+ return shape.searchableText(node);
316
+ }
317
+ if (node.type === "text")
318
+ return " " + node.text;
319
+ if ("content" in node && Array.isArray(node.content)) {
320
+ return node.content.reduce((acc, node2) => {
321
+ return acc + this.textOf(node2);
322
+ }, "");
323
+ }
324
+ return "";
325
+ }
301
326
  };
302
327
  function iterMarks(doc, fn) {
303
328
  for (const row of doc) {
@@ -5,7 +5,8 @@ export type ScalarMutator<T> = (value: T) => void;
5
5
  export declare class ScalarShape<T> implements Shape<T, ScalarMutator<T>> {
6
6
  label: Label;
7
7
  initialValue?: T | undefined;
8
- constructor(label: Label, initialValue?: T | undefined);
8
+ searchable?: boolean | undefined;
9
+ constructor(label: Label, initialValue?: T | undefined, searchable?: boolean | undefined);
9
10
  create(): T;
10
11
  toY(value: T): T;
11
12
  fromY(yValue: any): any;
@@ -14,4 +15,5 @@ export declare class ScalarShape<T> implements Shape<T, ScalarMutator<T>> {
14
15
  watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
15
16
  mutator(parent: Y.Map<any>, key: string, readOnly?: boolean): (value: T) => void;
16
17
  applyLinks(): Promise<void>;
18
+ searchableText(value: T): string;
17
19
  }
@@ -2,9 +2,10 @@ import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/core/shape/ScalarShape.ts
4
4
  var ScalarShape = class {
5
- constructor(label, initialValue) {
5
+ constructor(label, initialValue, searchable) {
6
6
  this.label = label;
7
7
  this.initialValue = initialValue;
8
+ this.searchable = searchable;
8
9
  }
9
10
  create() {
10
11
  return this.initialValue;
@@ -43,6 +44,12 @@ var ScalarShape = class {
43
44
  }
44
45
  async applyLinks() {
45
46
  }
47
+ searchableText(value) {
48
+ if (!this.searchable)
49
+ return "";
50
+ const stringified = String(value ?? "");
51
+ return stringified ? " " + stringified : "";
52
+ }
46
53
  };
47
54
  export {
48
55
  ScalarShape
@@ -26,4 +26,5 @@ export declare class UnionShape<T extends UnionRow> implements Shape<T, UnionMut
26
26
  watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
27
27
  mutator(parent: Y.Map<any>, key: string, readOnly: boolean): UnionMutator<T>;
28
28
  applyLinks(value: T, loader: LinkResolver): Promise<void>;
29
+ searchableText(value: T): string;
29
30
  }
@@ -122,6 +122,22 @@ var UnionShape = class {
122
122
  if (this.postProcess)
123
123
  await this.postProcess(value, loader);
124
124
  }
125
+ searchableText(value) {
126
+ let res = "";
127
+ if (Array.isArray(value))
128
+ value = value[0] ?? {};
129
+ else
130
+ value = value ?? {};
131
+ const type = value.type;
132
+ const shape = this.shapes[type];
133
+ const self = value || {};
134
+ if (!shape)
135
+ return "";
136
+ for (const [key, field] of entries(shape.properties)) {
137
+ res += field.searchableText(self[key]);
138
+ }
139
+ return res;
140
+ }
125
141
  };
126
142
  export {
127
143
  UnionShape
@@ -8,12 +8,15 @@ import { entryFilepath, entryInfo, entryUrl } from "../EntryFilenames.js";
8
8
  import { createRecord } from "../EntryRecord.js";
9
9
  import { EntryPhase } from "../EntryRow.js";
10
10
  import { Root } from "../Root.js";
11
+ import { Type } from "../Type.js";
11
12
  async function createEntryRow(config, input) {
12
13
  const record = createRecord(input);
13
14
  const fileContents = JsonLoader.format(config.schema, record);
14
15
  const fileHash = await createFileHash(fileContents);
15
16
  const rowHash = await createRowHash({ ...input, fileHash });
16
- return { ...input, fileHash, rowHash };
17
+ const type = config.schema[input.type];
18
+ const searchableText = Type.searchableText(type, input.data);
19
+ return { ...input, searchableText, fileHash, rowHash };
17
20
  }
18
21
  function entryParentPaths(config, entry) {
19
22
  const root = Root.data(config.workspaces[entry.workspace][entry.root]);
package/dist/core.d.ts CHANGED
@@ -36,6 +36,7 @@ export * from './core/field/RecordField.js';
36
36
  export * from './core/field/RichTextField.js';
37
37
  export * from './core/field/ScalarField.js';
38
38
  export * from './core/field/UnionField.js';
39
+ export * from './core/pages/Snippet.js';
39
40
  export * from './core/shape/ListShape.js';
40
41
  export * from './core/shape/RichTextShape.js';
41
42
  export * from './core/util/Async.js';
package/dist/core.js CHANGED
@@ -37,6 +37,7 @@ export * from "./core/field/RecordField.js";
37
37
  export * from "./core/field/RichTextField.js";
38
38
  export * from "./core/field/ScalarField.js";
39
39
  export * from "./core/field/UnionField.js";
40
+ export * from "./core/pages/Snippet.js";
40
41
  export * from "./core/shape/ListShape.js";
41
42
  export * from "./core/shape/RichTextShape.js";
42
43
  export * from "./core/util/Async.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunks/chunk-7YXWNKGS.js";
4
4
  import {
5
5
  connect
6
- } from "../../chunks/chunk-VRXHB6DJ.js";
6
+ } from "../../chunks/chunk-LMUDRU2U.js";
7
7
  import "../../chunks/chunk-FLZ4KUMA.js";
8
8
  import {
9
9
  create,
@@ -12,12 +12,8 @@ export interface RichTextOptions<Blocks extends Schema> extends FieldOptions<Tex
12
12
  optional?: boolean;
13
13
  /** Display a minimal version */
14
14
  inline?: boolean;
15
- /** A default value */
16
- initialValue?: TextDoc<Blocks>;
17
- /** Hide this rich text field */
18
- hidden?: boolean;
19
- /** Make this rich text field read-only */
20
- readOnly?: boolean;
15
+ /** Index the text value of this field */
16
+ searchable?: boolean;
21
17
  }
22
18
  /** Create a rich text field configuration */
23
19
  export declare function richText<Blocks extends Schema = {}>(label: string, options?: WithoutLabel<RichTextOptions<Blocks>>): RichTextField<Blocks, RichTextOptions<Blocks>>;
@@ -19,6 +19,8 @@ export interface TextOptions extends FieldOptions<string> {
19
19
  iconRight?: ComponentType;
20
20
  /** Focus this input automatically */
21
21
  autoFocus?: boolean;
22
+ /** Index the text value of this field */
23
+ searchable?: boolean;
22
24
  }
23
25
  export declare class TextField extends ScalarField<string, TextOptions> {
24
26
  }
@@ -1,3 +1,2 @@
1
1
  import { SVGProps } from 'react';
2
2
  export declare function IcRoundSearch(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
3
- export default IcRoundSearch;
@@ -11,8 +11,6 @@ function IcRoundSearch(props) {
11
11
  }
12
12
  ) });
13
13
  }
14
- var IcRoundSearch_default = IcRoundSearch;
15
14
  export {
16
- IcRoundSearch,
17
- IcRoundSearch_default as default
15
+ IcRoundSearch
18
16
  };
@@ -22,7 +22,7 @@ export declare namespace TextareaAutosize {
22
22
  lineHeight: number | null;
23
23
  };
24
24
  }
25
- export declare const TextareaAutosize: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLTextAreaElement>, "data" | "value" | "default" | "manifest" | "style" | "key" | "name" | "type" | "title" | "target" | "is" | "children" | "form" | "cite" | "label" | "slot" | "span" | "summary" | "pattern" | "hidden" | "readOnly" | "as" | "className" | "disabled" | "size" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "wrap" | "open" | "multiple" | "list" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "noValidate" | "optimum" | "playsInline" | "poster" | "preload" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "width" | "wmode"> & {
25
+ export declare const TextareaAutosize: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLTextAreaElement>, "data" | "value" | "default" | "manifest" | "style" | "key" | "name" | "type" | "title" | "target" | "method" | "is" | "children" | "form" | "cite" | "label" | "slot" | "span" | "summary" | "pattern" | "hidden" | "readOnly" | "as" | "className" | "disabled" | "size" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "wrap" | "open" | "multiple" | "list" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "min" | "minLength" | "muted" | "noValidate" | "optimum" | "playsInline" | "poster" | "preload" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "width" | "wmode"> & {
26
26
  /** Called whenever the textarea resizes */
27
27
  onResize?: ((e: Event) => void) | undefined;
28
28
  /** Minimum number of visible rows */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bin": "./dist/cli.js",
3
3
  "name": "alinea",
4
- "version": "0.5.5",
4
+ "version": "0.5.7",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "scripts": {