@pluv/crdt-yjs 0.4.1 → 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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +19 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/package.json +3 -3
- package/src/index.ts +7 -7
- package/src/object.ts +6 -8
- package/src/types.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/crdt-yjs@0.4.
|
|
2
|
+
> @pluv/crdt-yjs@0.4.2 build /home/runner/work/pluv/pluv/packages/crdt-yjs
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
[32mCJS[39m [1mdist/index.js [22m[32m4.87 KB[39m
|
|
12
12
|
[32mCJS[39m ⚡️ Build success in 73ms
|
|
13
13
|
[32mESM[39m [1mdist/index.mjs [22m[32m3.68 KB[39m
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 74ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1374ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.11 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.11 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @pluv/crdt-yjs
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
|
|
8
|
+
|
|
9
|
+
- Renamed type `unstable_YObject` to `YObject`.
|
|
10
|
+
- Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { y } from "@pluv/client";
|
|
14
|
+
// or
|
|
15
|
+
import { y } from "@pluv/react";
|
|
16
|
+
|
|
17
|
+
y.xmlElement("MyElement", {});
|
|
18
|
+
y.xmlFragment({});
|
|
19
|
+
y.xmlText("hello world");
|
|
20
|
+
```
|
|
21
|
+
|
|
3
22
|
## 0.4.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Array,
|
|
1
|
+
import { Array, AbstractType, Map, Text, XmlElement, XmlFragment, XmlText, Doc, Transaction } from 'yjs';
|
|
2
2
|
export { AbstractType, Array, Map, Text } from 'yjs';
|
|
3
3
|
import { JsonPrimitive } from '@pluv/types';
|
|
4
4
|
|
|
5
5
|
declare const array: <T extends unknown>(value?: readonly T[]) => Array<T>;
|
|
6
6
|
|
|
7
|
-
type
|
|
8
|
-
type
|
|
7
|
+
type YObjectValue = Record<string, NonNullable<JsonPrimitive> | AbstractType<any>>;
|
|
8
|
+
type YObject<T extends YObjectValue> = Map<T[keyof T]> & {
|
|
9
9
|
__$type: T;
|
|
10
10
|
};
|
|
11
|
-
declare const object: <T extends
|
|
11
|
+
declare const object: <T extends YObjectValue = {}>(value: T) => YObject<T>;
|
|
12
12
|
|
|
13
13
|
type InferYjsDocJson<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer ITypes> ? {
|
|
14
14
|
[P in keyof ITypes]: InferYjsSharedTypeJson<ITypes[P]>;
|
|
@@ -16,7 +16,7 @@ type InferYjsDocJson<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer IType
|
|
|
16
16
|
type InferYjsDocSharedType<TDoc extends YjsDoc<any>, TKey extends keyof InferYjsDocSharedTypes<TDoc> = keyof InferYjsDocSharedTypes<TDoc>> = InferYjsDocSharedTypes<TDoc>[TKey];
|
|
17
17
|
type InferYjsDocSharedTypeJson<TDoc extends YjsDoc<any>, TKey extends keyof InferYjsDocSharedTypes<TDoc> = keyof InferYjsDocSharedTypes<TDoc>> = InferYjsSharedTypeJson<InferYjsDocSharedTypes<TDoc>[TKey]>;
|
|
18
18
|
type InferYjsDocSharedTypes<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer ITypes> ? ITypes : never;
|
|
19
|
-
type InferYjsSharedTypeJson<TShared extends unknown> = TShared extends AbstractType<any> ? TShared extends Array<infer IItem> ? readonly InferYjsSharedTypeJson<IItem>[] : TShared extends
|
|
19
|
+
type InferYjsSharedTypeJson<TShared extends unknown> = TShared extends AbstractType<any> ? TShared extends Array<infer IItem> ? readonly InferYjsSharedTypeJson<IItem>[] : TShared extends YObject<infer IObject> ? {
|
|
20
20
|
[P in keyof IObject]: InferYjsSharedTypeJson<IObject[P]>;
|
|
21
21
|
} : TShared extends Map<infer IItem> ? Record<string, InferYjsSharedTypeJson<IItem>> : TShared extends Text | XmlElement | XmlFragment | XmlText ? string : never : TShared;
|
|
22
22
|
|
|
@@ -53,4 +53,4 @@ declare const xmlFragment: (params?: XmlFragmentParams) => XmlFragment;
|
|
|
53
53
|
|
|
54
54
|
declare const xmlText: (value?: string) => XmlText;
|
|
55
55
|
|
|
56
|
-
export { InferYjsDocJson, InferYjsDocSharedType, InferYjsDocSharedTypeJson, InferYjsDocSharedTypes, InferYjsSharedTypeJson, XmlElementParams, XmlFragmentParams, YjsDoc, array, doc, map, object, text,
|
|
56
|
+
export { InferYjsDocJson, InferYjsDocSharedType, InferYjsDocSharedTypeJson, InferYjsDocSharedTypes, InferYjsSharedTypeJson, XmlElementParams, XmlFragmentParams, YObject, YObjectValue, YjsDoc, array, doc, map, object, text, xmlElement, xmlFragment, xmlText };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Array,
|
|
1
|
+
import { Array, AbstractType, Map, Text, XmlElement, XmlFragment, XmlText, Doc, Transaction } from 'yjs';
|
|
2
2
|
export { AbstractType, Array, Map, Text } from 'yjs';
|
|
3
3
|
import { JsonPrimitive } from '@pluv/types';
|
|
4
4
|
|
|
5
5
|
declare const array: <T extends unknown>(value?: readonly T[]) => Array<T>;
|
|
6
6
|
|
|
7
|
-
type
|
|
8
|
-
type
|
|
7
|
+
type YObjectValue = Record<string, NonNullable<JsonPrimitive> | AbstractType<any>>;
|
|
8
|
+
type YObject<T extends YObjectValue> = Map<T[keyof T]> & {
|
|
9
9
|
__$type: T;
|
|
10
10
|
};
|
|
11
|
-
declare const object: <T extends
|
|
11
|
+
declare const object: <T extends YObjectValue = {}>(value: T) => YObject<T>;
|
|
12
12
|
|
|
13
13
|
type InferYjsDocJson<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer ITypes> ? {
|
|
14
14
|
[P in keyof ITypes]: InferYjsSharedTypeJson<ITypes[P]>;
|
|
@@ -16,7 +16,7 @@ type InferYjsDocJson<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer IType
|
|
|
16
16
|
type InferYjsDocSharedType<TDoc extends YjsDoc<any>, TKey extends keyof InferYjsDocSharedTypes<TDoc> = keyof InferYjsDocSharedTypes<TDoc>> = InferYjsDocSharedTypes<TDoc>[TKey];
|
|
17
17
|
type InferYjsDocSharedTypeJson<TDoc extends YjsDoc<any>, TKey extends keyof InferYjsDocSharedTypes<TDoc> = keyof InferYjsDocSharedTypes<TDoc>> = InferYjsSharedTypeJson<InferYjsDocSharedTypes<TDoc>[TKey]>;
|
|
18
18
|
type InferYjsDocSharedTypes<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<infer ITypes> ? ITypes : never;
|
|
19
|
-
type InferYjsSharedTypeJson<TShared extends unknown> = TShared extends AbstractType<any> ? TShared extends Array<infer IItem> ? readonly InferYjsSharedTypeJson<IItem>[] : TShared extends
|
|
19
|
+
type InferYjsSharedTypeJson<TShared extends unknown> = TShared extends AbstractType<any> ? TShared extends Array<infer IItem> ? readonly InferYjsSharedTypeJson<IItem>[] : TShared extends YObject<infer IObject> ? {
|
|
20
20
|
[P in keyof IObject]: InferYjsSharedTypeJson<IObject[P]>;
|
|
21
21
|
} : TShared extends Map<infer IItem> ? Record<string, InferYjsSharedTypeJson<IItem>> : TShared extends Text | XmlElement | XmlFragment | XmlText ? string : never : TShared;
|
|
22
22
|
|
|
@@ -53,4 +53,4 @@ declare const xmlFragment: (params?: XmlFragmentParams) => XmlFragment;
|
|
|
53
53
|
|
|
54
54
|
declare const xmlText: (value?: string) => XmlText;
|
|
55
55
|
|
|
56
|
-
export { InferYjsDocJson, InferYjsDocSharedType, InferYjsDocSharedTypeJson, InferYjsDocSharedTypes, InferYjsSharedTypeJson, XmlElementParams, XmlFragmentParams, YjsDoc, array, doc, map, object, text,
|
|
56
|
+
export { InferYjsDocJson, InferYjsDocSharedType, InferYjsDocSharedTypeJson, InferYjsDocSharedTypes, InferYjsSharedTypeJson, XmlElementParams, XmlFragmentParams, YObject, YObjectValue, YjsDoc, array, doc, map, object, text, xmlElement, xmlFragment, xmlText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/crdt-yjs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "yjs for @pluv/io",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsup": "^7.1.0",
|
|
29
29
|
"typescript": "^5.1.6",
|
|
30
|
-
"yjs": "^13.6.
|
|
31
|
-
"@pluv/tsconfig": "^0.
|
|
30
|
+
"yjs": "^13.6.7",
|
|
31
|
+
"@pluv/tsconfig": "^0.2.0",
|
|
32
32
|
"eslint-config-pluv": "^0.1.14"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
export type { AbstractType, Array, Map, Text } from "yjs";
|
|
2
2
|
export { array } from "./array";
|
|
3
|
-
export {
|
|
3
|
+
export { YjsDoc, doc } from "./doc";
|
|
4
4
|
export { map } from "./map";
|
|
5
|
-
export type { unstable__YObject } from "./object";
|
|
6
5
|
export { object } from "./object";
|
|
6
|
+
export type { YObject, YObjectValue } from "./object";
|
|
7
7
|
export { text } from "./text";
|
|
8
|
-
export type { XmlElementParams } from "./xmlElement";
|
|
9
|
-
export { xmlElement } from "./xmlElement";
|
|
10
|
-
export type { XmlFragmentParams } from "./xmlFragment";
|
|
11
|
-
export { xmlFragment } from "./xmlFragment";
|
|
12
|
-
export { xmlText } from "./xmlText";
|
|
13
8
|
export type {
|
|
14
9
|
InferYjsDocJson,
|
|
15
10
|
InferYjsDocSharedType,
|
|
@@ -17,3 +12,8 @@ export type {
|
|
|
17
12
|
InferYjsDocSharedTypes,
|
|
18
13
|
InferYjsSharedTypeJson,
|
|
19
14
|
} from "./types";
|
|
15
|
+
export { xmlElement } from "./xmlElement";
|
|
16
|
+
export type { XmlElementParams } from "./xmlElement";
|
|
17
|
+
export { xmlFragment } from "./xmlFragment";
|
|
18
|
+
export type { XmlFragmentParams } from "./xmlFragment";
|
|
19
|
+
export { xmlText } from "./xmlText";
|
package/src/object.ts
CHANGED
|
@@ -2,17 +2,15 @@ import type { JsonPrimitive } from "@pluv/types";
|
|
|
2
2
|
import type { AbstractType } from "yjs";
|
|
3
3
|
import { Map as YMap } from "yjs";
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type YObjectValue = Record<
|
|
6
6
|
string,
|
|
7
7
|
NonNullable<JsonPrimitive> | AbstractType<any>
|
|
8
8
|
>;
|
|
9
9
|
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export type YObject<T extends YObjectValue> = YMap<T[keyof T]> & {
|
|
11
|
+
__$type: T;
|
|
12
|
+
};
|
|
13
13
|
|
|
14
|
-
export const object = <T extends
|
|
15
|
-
value
|
|
16
|
-
): unstable__YObject<T> => {
|
|
17
|
-
return new YMap(Object.entries(value)) as unstable__YObject<T>;
|
|
14
|
+
export const object = <T extends YObjectValue = {}>(value: T): YObject<T> => {
|
|
15
|
+
return new YMap(Object.entries(value)) as YObject<T>;
|
|
18
16
|
};
|
package/src/types.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
XmlText as YXmlText,
|
|
9
9
|
} from "yjs";
|
|
10
10
|
import type { YjsDoc } from "./doc";
|
|
11
|
-
import type {
|
|
11
|
+
import type { YObject } from "./object";
|
|
12
12
|
|
|
13
13
|
export type InferYjsDocJson<TDoc extends YjsDoc<any>> = TDoc extends YjsDoc<
|
|
14
14
|
infer ITypes
|
|
@@ -35,7 +35,7 @@ export type InferYjsSharedTypeJson<TShared extends unknown> =
|
|
|
35
35
|
TShared extends AbstractType<any>
|
|
36
36
|
? TShared extends YArray<infer IItem>
|
|
37
37
|
? readonly InferYjsSharedTypeJson<IItem>[]
|
|
38
|
-
: TShared extends
|
|
38
|
+
: TShared extends YObject<infer IObject>
|
|
39
39
|
? { [P in keyof IObject]: InferYjsSharedTypeJson<IObject[P]> }
|
|
40
40
|
: TShared extends YMap<infer IItem>
|
|
41
41
|
? Record<string, InferYjsSharedTypeJson<IItem>>
|