Skip to content

Commit

Permalink
style(json-crdt-extensions): 💄 run Prettier and remove todo
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 2, 2024
1 parent 032bab1 commit 5240f08
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
3 changes: 1 addition & 2 deletions src/json-crdt-extensions/peritext/PeritextApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ import {NodeApi} from '../../json-crdt/model/api/nodes';
import type {PeritextNode} from './PeritextNode';
import type {ExtensionApi} from '../../json-crdt';

export class PeritextApi extends NodeApi<PeritextNode> implements ExtensionApi<PeritextNode> {
}
export class PeritextApi extends NodeApi<PeritextNode> implements ExtensionApi<PeritextNode> {}
38 changes: 18 additions & 20 deletions src/json-crdt-extensions/peritext/constants.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import {nodes, s} from "../../json-crdt-patch";
import {ExtensionId, ExtensionName} from "../constants";
import {SliceSchema} from "./slice/types";
import {nodes, s} from '../../json-crdt-patch';
import {ExtensionId, ExtensionName} from '../constants';
import {SliceSchema} from './slice/types';

export const enum Chars {
BlockSplitSentinel = '\n',
}

export const MNEMONIC = ExtensionName[ExtensionId.peritext];

export const BUILD_SCHEMA = (text: string) => (
s.vec<[
/**
* The text of the node. All rich-text textual data is stored in this node.
*/
str: nodes.str<string>,

/**
* The slices of the node. All rich-text annotations are stored in this
* node.
*/
slices: nodes.arr<SliceSchema>,
]>(
s.str<string>(text),
s.arr<SliceSchema>([]),
)
);
export const BUILD_SCHEMA = (text: string) =>
s.vec<
[
/**
* The text of the node. All rich-text textual data is stored in this node.
*/
str: nodes.str<string>,

/**
* The slices of the node. All rich-text annotations are stored in this
* node.
*/
slices: nodes.arr<SliceSchema>,
]
>(s.str<string>(text), s.arr<SliceSchema>([]));

export const SCHEMA = BUILD_SCHEMA('');
6 changes: 3 additions & 3 deletions src/json-crdt-extensions/peritext/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {SchemaToJsonNode} from "../../json-crdt/schema/types";
import type {SCHEMA} from "./constants";
import type {SchemaToJsonNode} from '../../json-crdt/schema/types';
import type {SCHEMA} from './constants';

/**
* Represents an object which state can change over time.
*
*
* @todo Move to /src/utils.
*/
export interface Stateful {
Expand Down
3 changes: 0 additions & 3 deletions src/json-crdt/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import {NodeBuilder} from '../../json-crdt-patch/builder/DelayedValueBuilder';
import {konst} from '../../json-crdt-patch/builder/Konst';
import type {ITimestampStruct} from '../../json-crdt-patch/clock';

/**
* @todo Replace this by `s` builder.
*/
export const ext = (extensionId: number, nodeBuilder: NodeBuilder) =>
new NodeBuilder((builder: PatchBuilder): ITimestampStruct => {
// Extension tuple starts with a 3-byte header:
Expand Down

0 comments on commit 5240f08

Please sign in to comment.