@coorax/core 0.0.0-canary.3 → 0.0.0-canary.5

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 (42) hide show
  1. package/dist/index.js +91 -41
  2. package/dist/modules/divider/divider.test.d.ts +1 -0
  3. package/dist/modules/media/media.test.d.ts +1 -0
  4. package/dist/modules/paragraph-theme/paragraph-theme.test.d.ts +1 -0
  5. package/package.json +10 -10
  6. package/dist/base/classes/component.class.d.ts +0 -23
  7. package/dist/base/classes/container.class.d.ts +0 -17
  8. package/dist/base/classes/field.class.d.ts +0 -15
  9. package/dist/base/classes/tnode.class.d.ts +0 -14
  10. package/dist/base/index.d.ts +0 -19
  11. package/dist/base/types/components/components.d.ts +0 -13
  12. package/dist/base/types/container/container.d.ts +0 -27
  13. package/dist/base/types/container/division.types.d.ts +0 -3
  14. package/dist/base/types/container/section.types.d.ts +0 -3
  15. package/dist/base/types/container/ul-list.types.d.ts +0 -3
  16. package/dist/base/types/css.types.d.ts +0 -23
  17. package/dist/base/types/field/divider.types.d.ts +0 -3
  18. package/dist/base/types/field/field.blockquote.types.d.ts +0 -4
  19. package/dist/base/types/field/field.d.ts +0 -50
  20. package/dist/base/types/field/field.image.types.d.ts +0 -3
  21. package/dist/base/types/field/field.media.types.d.ts +0 -5
  22. package/dist/base/types/field/field.text.types.d.ts +0 -8
  23. package/dist/base/types/field/field.video.types.d.ts +0 -8
  24. package/dist/base/types/field/fields.iframe.types.d.ts +0 -7
  25. package/dist/base/types/field/heading.types.d.ts +0 -3
  26. package/dist/base/types/field/paragraph.types.d.ts +0 -3
  27. package/dist/base/types/global.types.d.ts +0 -26
  28. package/dist/base/types/node/link.types.d.ts +0 -3
  29. package/dist/base/types/node/node.d.ts +0 -24
  30. package/dist/base/types/node/span.types.d.ts +0 -3
  31. package/dist/base/types/tree/tree.d.ts +0 -24
  32. package/dist/constants/field.constants.d.ts +0 -1
  33. package/dist/constants/index.d.ts +0 -1
  34. package/dist/modules/text-editing/text-editing.utils.d.ts +0 -6
  35. package/dist/services/text-marks/marks.types.d.ts +0 -35
  36. package/dist/services/ui/default-styles.d.ts +0 -3
  37. package/dist/utils/components.utils.d.ts +0 -10
  38. package/dist/utils/container.utils.d.ts +0 -13
  39. package/dist/utils/fields.utils.d.ts +0 -27
  40. package/dist/utils/global.utils.d.ts +0 -47
  41. package/dist/utils/tnode.utils.d.ts +0 -9
  42. package/dist/utils/tree.utils.d.ts +0 -11
package/dist/index.js CHANGED
@@ -566,95 +566,119 @@ function getIframeSrc(value) {
566
566
  return null;
567
567
  return `https://www.youtube.com/embed/${videoId}?enablejsapi=1`;
568
568
  }
569
+ function mergeFieldProps(defaults, overrides) {
570
+ if (!overrides)
571
+ return defaults;
572
+ const merged = { ...defaults, ...overrides };
573
+ if (defaults.style || overrides.style) {
574
+ merged.style = {
575
+ ...defaults.style,
576
+ ...overrides.style
577
+ };
578
+ }
579
+ if (defaults.pseudoStyle || overrides.pseudoStyle) {
580
+ merged.pseudoStyle = {
581
+ ...defaults.pseudoStyle,
582
+ ...overrides.pseudoStyle
583
+ };
584
+ }
585
+ return merged;
586
+ }
569
587
  function NewTextField(defaultValue) {
588
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
570
589
  return new FieldClass({
571
590
  id: UTILS.generateFieldId(),
572
591
  name: "Text field",
573
592
  type: "text",
574
593
  tag: "p",
575
594
  variant: "field",
576
- props: {
595
+ props: mergeFieldProps({
577
596
  children: { text: "", marks: [] },
578
597
  "data-text-path": "props.children",
579
598
  contentEditable: false,
580
599
  ...DEFAULT_STYLES["text"]
581
- },
582
- ...defaultValue
600
+ }, defaultProps),
601
+ ...restDefault
583
602
  });
584
603
  }
585
604
  function NewHeadingField(defaultValue) {
605
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
586
606
  return new FieldClass({
587
607
  id: UTILS.generateFieldId(),
588
608
  name: "Heading field",
589
609
  type: "heading",
590
610
  tag: "h1",
591
611
  variant: "field",
592
- props: {
612
+ props: mergeFieldProps({
593
613
  children: { text: "", marks: [] },
594
614
  "data-text-path": "props.children",
595
615
  contentEditable: false,
596
616
  ...DEFAULT_STYLES["heading"]
597
- },
598
- ...defaultValue
617
+ }, defaultProps),
618
+ ...restDefault
599
619
  });
600
620
  }
601
621
  function NewSubHeadingField(defaultValue) {
622
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
602
623
  return new FieldClass({
603
624
  id: UTILS.generateFieldId(),
604
625
  name: "Sub-heading field",
605
626
  type: "sub-heading",
606
627
  tag: "h2",
607
628
  variant: "field",
608
- props: {
629
+ props: mergeFieldProps({
609
630
  children: { text: "", marks: [] },
610
631
  "data-text-path": "props.children",
611
632
  contentEditable: false,
612
633
  ...DEFAULT_STYLES["sub-heading"]
613
- },
614
- ...defaultValue
634
+ }, defaultProps),
635
+ ...restDefault
615
636
  });
616
637
  }
617
638
  function NewImageField(defaultValue) {
639
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
618
640
  return new FieldClass({
619
641
  id: UTILS.generateFieldId(),
620
642
  name: "Image field",
621
643
  type: "image",
622
644
  tag: "img",
623
645
  variant: "field",
624
- props: {
646
+ props: mergeFieldProps({
625
647
  src: "",
626
648
  alt: "image",
627
649
  ...DEFAULT_STYLES["image"]
628
- },
629
- ...defaultValue
650
+ }, defaultProps),
651
+ ...restDefault
630
652
  });
631
653
  }
632
654
  function NewVideoField(defaultValue) {
655
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
633
656
  return new FieldClass({
634
657
  id: UTILS.generateFieldId(),
635
658
  name: "Video field",
636
659
  type: "video",
637
660
  tag: "video",
638
661
  variant: "field",
639
- props: {
662
+ props: mergeFieldProps({
640
663
  src: "",
641
664
  alt: "video",
642
665
  controlsList: "nodownload nofullscreen noremoteplayback noplaybackrate",
643
666
  preload: "metadata",
644
667
  controls: true,
645
668
  ...DEFAULT_STYLES["video"]
646
- },
647
- ...defaultValue
669
+ }, defaultProps),
670
+ ...restDefault
648
671
  });
649
672
  }
650
673
  function NewIFrameField(defaultValue) {
674
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
651
675
  return new FieldClass({
652
676
  id: UTILS.generateFieldId(),
653
677
  name: "IFrame field",
654
678
  type: "iframe",
655
679
  tag: "iframe",
656
680
  variant: "field",
657
- props: {
681
+ props: mergeFieldProps({
658
682
  src: "",
659
683
  alt: "image",
660
684
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
@@ -662,86 +686,91 @@ function NewIFrameField(defaultValue) {
662
686
  allowFullScreen: false,
663
687
  frameBorder: 0,
664
688
  ...DEFAULT_STYLES["iframe"]
665
- },
666
- ...defaultValue
689
+ }, defaultProps),
690
+ ...restDefault
667
691
  });
668
692
  }
669
693
  function NewLinkField(defaultValue) {
694
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
670
695
  return new FieldClass({
671
696
  id: UTILS.generateFieldId(),
672
697
  name: "Link field",
673
698
  type: "link",
674
699
  tag: "a",
675
700
  variant: "field",
676
- props: {
701
+ props: mergeFieldProps({
677
702
  href: "#",
678
703
  alt: "Preview new link",
679
704
  "data-text-path": "props.children",
680
705
  children: { text: "Preview new link", marks: [] },
681
706
  ...DEFAULT_STYLES["link"]
682
- },
683
- ...defaultValue
707
+ }, defaultProps),
708
+ ...restDefault
684
709
  });
685
710
  }
686
711
  function NewBlockquoteField(defaultValue) {
712
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
687
713
  return new FieldClass({
688
714
  id: UTILS.generateFieldId(),
689
715
  name: "Blockquote field",
690
716
  type: "blockquote",
691
717
  tag: "blockquote",
692
718
  variant: "field",
693
- props: {
719
+ props: mergeFieldProps({
694
720
  "data-text-path": "props.children",
695
721
  children: { text: "", marks: [] },
696
722
  ...DEFAULT_STYLES["blockquote"]
697
- },
698
- ...defaultValue
723
+ }, defaultProps),
724
+ ...restDefault
699
725
  });
700
726
  }
701
727
  function NewDividerField(defaultValue) {
728
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
702
729
  return new FieldClass({
703
730
  id: UTILS.generateFieldId(),
704
731
  name: "Divider field",
705
732
  type: "divider",
706
733
  tag: "hr",
707
734
  variant: "field",
708
- props: {
735
+ props: mergeFieldProps({
709
736
  ...DEFAULT_STYLES["divider"]
710
- },
711
- ...defaultValue
737
+ }, defaultProps),
738
+ ...restDefault
712
739
  });
713
740
  }
714
741
  function NewCodeField(defaultValue) {
742
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
715
743
  return new FieldClass({
716
744
  id: UTILS.generateFieldId(),
717
745
  name: "Code field",
718
746
  type: "code",
719
747
  tag: "pre",
720
748
  variant: "field",
721
- props: {
749
+ props: mergeFieldProps({
722
750
  "data-text-path": "props.children",
723
751
  children: { text: "", marks: [] },
724
752
  theme: "dark",
725
753
  contentEditable: false,
726
754
  ...DEFAULT_STYLES["code"]
727
- },
728
- ...defaultValue
755
+ }, defaultProps),
756
+ ...restDefault
729
757
  });
730
758
  }
731
759
  function NewCaptionField(defaultValue) {
760
+ const { props: defaultProps, ...restDefault } = defaultValue ?? {};
732
761
  return new FieldClass({
733
762
  id: UTILS.generateFieldId(),
734
763
  name: "Caption field",
735
764
  type: "caption",
736
765
  tag: "figcaption",
737
766
  variant: "field",
738
- props: {
767
+ props: mergeFieldProps({
739
768
  "data-text-path": "props.children",
740
769
  children: { text: "", marks: [] },
741
770
  contentEditable: false,
742
771
  ...DEFAULT_STYLES["caption"]
743
- },
744
- ...defaultValue
772
+ }, defaultProps),
773
+ ...restDefault
745
774
  });
746
775
  }
747
776
  function NewField(type, defaultValue) {
@@ -773,6 +802,15 @@ function NewField(type, defaultValue) {
773
802
  }
774
803
  }
775
804
  function DeserializeField(field4) {
805
+ const defaultStyle = DEFAULT_STYLES[field4.type];
806
+ if (defaultStyle) {
807
+ return new FieldClass({
808
+ ...field4,
809
+ props: mergeFieldProps({
810
+ ...defaultStyle
811
+ }, field4.props)
812
+ });
813
+ }
776
814
  return new FieldClass(field4);
777
815
  }
778
816
  var FieldsUtils = {
@@ -1875,18 +1913,28 @@ class MutationsService {
1875
1913
  if (!(field instanceof FieldClass)) {
1876
1914
  throw new MutationPrototypeError(field.name);
1877
1915
  }
1878
- if (!isEditableField(field) || field.type === type) {
1879
- return tree;
1880
- }
1881
- const hasContent = !!field.props.children.text.length;
1882
- if (hasContent) {
1916
+ if (field.type === type) {
1883
1917
  return tree;
1884
1918
  }
1885
1919
  const order = new Set(tree.order);
1886
1920
  const pos = [...order].indexOf(fieldId);
1887
- return this.insertField(this.deleteField(tree, fieldId), FieldsUtils.NewField(type, { id: field.id }), pos);
1921
+ const isCurrentEditable = isEditableField(field);
1922
+ const isTargetEditable = isEditableType(type);
1923
+ let newField;
1924
+ if (isCurrentEditable && isTargetEditable) {
1925
+ const currentChildren = field.props.children;
1926
+ newField = FieldsUtils.NewField(type, {
1927
+ id: field.id,
1928
+ props: {
1929
+ children: currentChildren ?? { text: "", marks: [] }
1930
+ }
1931
+ });
1932
+ } else {
1933
+ newField = FieldsUtils.NewField(type, { id: field.id });
1934
+ }
1935
+ return this.insertField(this.deleteField(tree, fieldId), newField, pos);
1888
1936
  }
1889
- mutateField(tree, { id, keyValuePairs, autoMerge }) {
1937
+ mutateField(tree, { id, keyValuePairs, autoMerge = true }) {
1890
1938
  const hasFieldInOrder = tree.order.has(id);
1891
1939
  if (!hasFieldInOrder) {
1892
1940
  throw new MutationError(`Field ${id} doesn't exist on the tree`);
@@ -2499,7 +2547,9 @@ var InsertionModule = {
2499
2547
  if (block && block.type === "caption") {
2500
2548
  return;
2501
2549
  }
2502
- ctx.document.apply((tree) => ctx.mutations.changeField(tree, { fieldId, type }), { origin: isMediaType(type) || type === "link" ? "history" : "user" });
2550
+ ctx.document.apply((tree) => ctx.mutations.changeField(tree, { fieldId, type }), {
2551
+ origin: isMediaType(type) || type === "link" ? "history" : "user"
2552
+ });
2503
2553
  ctx.state.set("insertion", false);
2504
2554
  ctx.events.emit("fields:change", { fieldId, type });
2505
2555
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorax/core",
3
- "version": "0.0.0-canary.3",
3
+ "version": "0.0.0-canary.5",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -29,29 +29,29 @@
29
29
  "fmt:check": "oxfmt --check",
30
30
  "vtest": "vitest",
31
31
  "typecheck": "tsc --noEmit",
32
- "build:css": "bunx @tailwindcss/cli -i ./styles.css -o ./dist/styles.css --minify",
32
+ "build:css": "bunx tailwindcss -i ./styles.css -o ./dist/styles.css --minify",
33
33
  "build:types": "tsc --emitDeclarationOnly",
34
34
  "build:js": "bun build ./src/index.ts --outdir ./dist --target browser --external lodash --external cn",
35
35
  "build": "bun run build:types && bun run build:js && bun run build:css",
36
36
  "prepublishOnly": "bun run build"
37
37
  },
38
38
  "dependencies": {
39
- "@coorax/schema": "workspace:*",
40
- "@fontsource-variable/geist": "catalog:",
41
- "@tailwindcss/cli": "^4.3.5",
42
- "cn": "catalog:",
39
+ "@coorax/schema": "0.0.0-canary.3",
40
+ "@fontsource-variable/geist": "^5.3.0",
41
+ "cn": "^0.4.0",
43
42
  "lodash": "^4.18.1"
44
43
  },
45
44
  "devDependencies": {
46
- "@tailwindcss/vite": "catalog:",
45
+ "@tailwindcss/cli": "^4.3.5",
46
+ "@tailwindcss/vite": "4.3.3",
47
47
  "@types/lodash": "^4.17.27",
48
- "csstype": "catalog:",
48
+ "csstype": "^3.2.3",
49
49
  "oxfmt": "^0.71.0",
50
50
  "oxlint": "^1.86.0",
51
- "tailwindcss": "catalog:",
51
+ "tailwindcss": "4.3.3",
52
52
  "typescript": "~6.0.2",
53
53
  "vite": "^8.3.0",
54
- "vitest": "catalog:testing"
54
+ "vitest": "^5.0.3"
55
55
  },
56
56
  "packageManager": "bun@1.3.9"
57
57
  }
@@ -1,23 +0,0 @@
1
- import type { ContainerProps, ContainerTag, ContainerType } from "../types/container/container.ts";
2
- import type { Component, ComponentId } from "../types/components/components.ts";
3
- import type { BlockId, CoraxTree } from "../types/tree/tree.ts";
4
- import type { OmitComponentsMethods } from "../types/global.types.ts";
5
- export declare class ComponentClass<TType extends ContainerType = ContainerType, TTag extends ContainerTag = ContainerTag> implements Component<TType, TTag> {
6
- id: ComponentId;
7
- name: string;
8
- tag: TTag;
9
- type: TType;
10
- props: ContainerProps<TTag>;
11
- variant: "component";
12
- order: Set<BlockId>;
13
- instanceId?: ComponentId;
14
- count: number;
15
- updatedAt: number;
16
- createdAt: number;
17
- constructor(component: OmitComponentsMethods<Component<TType, TTag>>);
18
- isInstance(): boolean;
19
- getChildren(_tree: CoraxTree): Set<BlockId>;
20
- appendChild(tree: CoraxTree): CoraxTree;
21
- removeChild(tree: CoraxTree): CoraxTree;
22
- getCurrentComponentObject(): OmitComponentsMethods<Component<TType, TTag>>;
23
- }
@@ -1,17 +0,0 @@
1
- import type { Container, ContainerId, ContainerProps, ContainerTag, ContainerType } from "../types/container/container.ts";
2
- import type { OmitContainersMethods } from "../types/global.types.ts";
3
- import type { BlockId, CoraxTree } from "../types/tree/tree.ts";
4
- export declare class ContainerClass<TType extends ContainerType = ContainerType, TTag extends ContainerTag = ContainerTag> implements Container<TType, TTag> {
5
- id: ContainerId;
6
- name: string;
7
- tag: TTag;
8
- type: TType;
9
- props: ContainerProps<TTag>;
10
- variant: "container";
11
- order: Set<BlockId>;
12
- constructor(container: OmitContainersMethods<Container<TType, TTag>>);
13
- getChildren(_tree: CoraxTree): Set<BlockId>;
14
- appendChild(tree: CoraxTree): CoraxTree;
15
- removeChild(tree: CoraxTree): CoraxTree;
16
- getCurrentContainerObject(): OmitContainersMethods<Container<TType, TTag>>;
17
- }
@@ -1,15 +0,0 @@
1
- import type { Field, FieldId, FieldProps, FieldTag, FieldType } from "../types/field/field.ts";
2
- import type { ContainerId } from "../types/container/container.ts";
3
- import type { OmitFieldsMethods } from "../types/global.types.ts";
4
- export declare class FieldClass<TType extends FieldType = FieldType, TTag extends FieldTag = FieldTag> implements Field<TType, TTag> {
5
- id: FieldId;
6
- name: string;
7
- tag: TTag;
8
- type: TType;
9
- variant: "field";
10
- containerId?: ContainerId;
11
- props: FieldProps<TTag>;
12
- constructor(field: OmitFieldsMethods<Field<TType, TTag>>);
13
- isContainerized(): boolean;
14
- getCurrentFieldObject(): OmitFieldsMethods<Field<TType, TTag>>;
15
- }
@@ -1,14 +0,0 @@
1
- import type { TNode, TNodeId, TNodeProps, TNodeTag, TNodeType } from "../types/node/node.ts";
2
- import type { OmitTNodesMethods } from "../types/global.types.ts";
3
- import type { FieldId } from "../types/field/field.ts";
4
- export declare class TNodeClass<T extends TNodeType = TNodeType, A extends TNodeTag = TNodeTag> implements TNode<T, A> {
5
- id: TNodeId;
6
- tag: A;
7
- type: T;
8
- name: string;
9
- variant: "tnode";
10
- fieldId?: FieldId;
11
- props: TNodeProps<A>;
12
- constructor(tnode: OmitTNodesMethods<TNode<T, A>>);
13
- getCurrentNodeObject(): OmitTNodesMethods<TNode<T, A>>;
14
- }
@@ -1,19 +0,0 @@
1
- export * from "./classes/component.class";
2
- export * from "./classes/container.class";
3
- export * from "./classes/field.class";
4
- export * from "./classes/tnode.class";
5
- export * from "./types/components/components";
6
- export * from "./types/tree/tree";
7
- export * from "./types/container/container";
8
- export * from "./types/container/division.types";
9
- export * from "./types/container/section.types";
10
- export * from "./types/container/ul-list.types";
11
- export * from "./types/field/field";
12
- export * from "./types/field/field.text.types";
13
- export * from "./types/field/heading.types";
14
- export * from "./types/field/paragraph.types";
15
- export * from "./types/node/link.types";
16
- export * from "./types/node/node";
17
- export * from "./types/node/span.types";
18
- export * from "./types/global.types";
19
- export * from "./types/css.types";
@@ -1,13 +0,0 @@
1
- import type { Container, ContainerTag, ContainerType } from "../container/container.ts";
2
- import type { OmitComponentsMethods } from "../global.types.ts";
3
- export type ComponentId = `component:${string}-${string}-${string}-${string}-${string}` | `component:${string}`;
4
- export interface Component<T extends ContainerType = ContainerType, A extends ContainerTag = ContainerTag> extends Omit<Container<T, A>, "getCurrentContainerObject" | "variant" | "id"> {
5
- id: ComponentId;
6
- count: number;
7
- updatedAt: number;
8
- createdAt: number;
9
- variant: "component";
10
- instanceId?: ComponentId;
11
- getCurrentComponentObject(): OmitComponentsMethods<Component<T, A>>;
12
- isInstance(): boolean;
13
- }
@@ -1,27 +0,0 @@
1
- import type { UlListProps } from "./ul-list.types.ts";
2
- import type { SectionProps } from "./section.types.ts";
3
- import type { BlockId, CoraxTree } from "../tree/tree.ts";
4
- import type { OmitContainersMethods } from "../global.types.ts";
5
- import type { DivisionProps } from "./division.types.ts";
6
- export type ContainerType = "list" | "section" | "division";
7
- export type ContainerTag = "ul" | "section" | "div";
8
- export type ContainerId = `container:${string}-${string}-${string}-${string}-${string}` | `container:${string}`;
9
- export type ContainerGlobalProps = {
10
- ul: UlListProps;
11
- section: SectionProps;
12
- div: DivisionProps;
13
- };
14
- export type ContainerProps<A extends ContainerTag = ContainerTag> = ContainerGlobalProps[A];
15
- export interface Container<T extends ContainerType = ContainerType, A extends ContainerTag = ContainerTag> {
16
- id: ContainerId;
17
- tag: A;
18
- type: T;
19
- name: string;
20
- props: ContainerProps<A>;
21
- variant: "container";
22
- order: Set<BlockId>;
23
- getChildren(tree: CoraxTree): Set<BlockId>;
24
- removeChild(tree: CoraxTree): CoraxTree;
25
- appendChild(tree: CoraxTree): CoraxTree;
26
- getCurrentContainerObject(): OmitContainersMethods<Container<T, A>>;
27
- }
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types";
2
- export interface DivisionProps extends NodeCommonProps {
3
- }
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types.ts";
2
- export interface SectionProps extends NodeCommonProps {
3
- }
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types.ts";
2
- export interface UlListProps extends NodeCommonProps {
3
- }
@@ -1,23 +0,0 @@
1
- import type * as CSS from "csstype";
2
- export type CoraxCSSProperties = CSS.PropertiesFallback<number | string>;
3
- export type CoraxCSSPropertiesWithMultiValues = {
4
- [K in keyof CoraxCSSProperties]: CoraxCSSProperties[K] | ReadonlyArray<Extract<CoraxCSSProperties[K], string>>;
5
- };
6
- export type CoraxCSSPseudos = {
7
- [K in CSS.Pseudos]?: CoraxCSSObject;
8
- };
9
- export interface ArrayCSSInterpolation extends ReadonlyArray<CoraxCSSInterpolation> {
10
- }
11
- export type CoraxInterpolationPrimitive = null | undefined | boolean | number | string | CoraxKeyframes | CoraxCSSObject;
12
- export type CoraxCSSInterpolation = CoraxInterpolationPrimitive | ArrayCSSInterpolation;
13
- export interface CoraxCSSOthersObject {
14
- [propertiesName: string]: CoraxCSSInterpolation;
15
- }
16
- export interface CoraxCSSObject extends CoraxCSSPropertiesWithMultiValues, CoraxCSSPseudos, CoraxCSSOthersObject {
17
- }
18
- export type CoraxKeyframes = {
19
- name: string;
20
- styles: string;
21
- anim: number;
22
- toString: () => string;
23
- } & string;
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types";
2
- export interface DividerProps extends NodeCommonProps {
3
- }
@@ -1,4 +0,0 @@
1
- import type { TextCommonProps } from "./field.text.types";
2
- export interface BlockquoteFieldProps extends TextCommonProps {
3
- cite?: string;
4
- }
@@ -1,50 +0,0 @@
1
- import type { ParagraphProps } from "./paragraph.types.ts";
2
- import type { HeadingProps } from "./heading.types.ts";
3
- import type { ContainerId } from "../container/container.ts";
4
- import type { OmitFieldsMethods } from "../global.types.ts";
5
- import type { DividerProps } from "./divider.types";
6
- import type { VideoFieldProps } from "./field.video.types.js";
7
- import type { ImageFieldProps } from "./field.image.types.js";
8
- import type { IFrameFieldProps } from "./fields.iframe.types.js";
9
- import type { BlockquoteFieldProps } from "./field.blockquote.types.js";
10
- export type FieldType = keyof FieldTMap;
11
- export type FieldTag = keyof FieldMap;
12
- export type FieldId = `field:${string}-${string}-${string}-${string}-${string}` | `field:${string}`;
13
- export interface FieldMap {
14
- p: ParagraphProps;
15
- h1: HeadingProps;
16
- img: ImageFieldProps;
17
- video: VideoFieldProps;
18
- hr: DividerProps;
19
- iframe: IFrameFieldProps;
20
- blockquote: BlockquoteFieldProps;
21
- }
22
- export interface FieldTMap {
23
- text: {};
24
- heading: {};
25
- image: {};
26
- video: {};
27
- divider: {};
28
- iframe: {};
29
- blockquote: {};
30
- }
31
- export type FieldPropsByTag<T extends FieldTag = FieldTag> = FieldMap[T];
32
- export type FieldProps<A extends FieldTag = FieldTag> = FieldPropsByTag<A>;
33
- export interface Field<T extends FieldType = FieldType, A extends FieldTag = FieldTag> {
34
- id: FieldId;
35
- tag: A;
36
- type: T;
37
- name: string;
38
- variant: "field";
39
- containerId?: ContainerId;
40
- props: FieldProps<A>;
41
- isContainerized(): boolean;
42
- getCurrentFieldObject(): OmitFieldsMethods<Field<T, A>>;
43
- }
44
- export type TextField = Field<"heading" | "text", "h1" | "p">;
45
- export type MediaField = Field<"image" | "video", "img" | "video">;
46
- export type ImageField = Field<"image", "img">;
47
- export type VideoField = Field<"video", "video">;
48
- export type DividerField = Field<"divider", "hr">;
49
- export type IFrameField = Field<"iframe", "iframe">;
50
- export type BlockquoteField = Field<"blockquote", "blockquote">;
@@ -1,3 +0,0 @@
1
- import type { MediaCommonProps } from "./field.media.types";
2
- export interface ImageFieldProps extends MediaCommonProps {
3
- }
@@ -1,5 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types";
2
- export interface MediaCommonProps extends NodeCommonProps {
3
- src: string;
4
- alt: string;
5
- }
@@ -1,8 +0,0 @@
1
- import type { TextContent } from "../../../services/text-marks/marks.types";
2
- import type { NodeCommonProps } from "../global.types.ts";
3
- export interface TextCommonProps extends NodeCommonProps {
4
- children: TextContent;
5
- placeholder?: string;
6
- contentEditable?: boolean;
7
- "data-text-path": string;
8
- }
@@ -1,8 +0,0 @@
1
- import type { MediaCommonProps } from "./field.media.types";
2
- export interface VideoFieldProps extends MediaCommonProps {
3
- controls?: boolean;
4
- poster?: boolean;
5
- download?: string;
6
- controlsList?: string;
7
- preload?: "metadata" | "none" | "auto";
8
- }
@@ -1,7 +0,0 @@
1
- import type { MediaCommonProps } from "./field.media.types";
2
- export interface IFrameFieldProps extends MediaCommonProps {
3
- allow?: string;
4
- referrerPolicy?: string;
5
- allowFullScreen?: boolean;
6
- frameBorder?: number | string;
7
- }
@@ -1,3 +0,0 @@
1
- import type { TextCommonProps } from "./field.text.types.ts";
2
- export interface HeadingProps extends TextCommonProps {
3
- }
@@ -1,3 +0,0 @@
1
- import type { TextCommonProps } from "./field.text.types.ts";
2
- export interface ParagraphProps extends TextCommonProps {
3
- }
@@ -1,26 +0,0 @@
1
- import type * as CSS from "csstype";
2
- import type { Container } from "./container/container";
3
- import type { Field } from "./field/field";
4
- import type { Component } from "./components/components";
5
- import type { TNode } from "./node/node.ts";
6
- import type { CoraxCSSProperties, CoraxCSSPseudos } from "./css.types";
7
- export type PseudoSelectors = {
8
- [P in CSS.Pseudos]?: CSS.Properties;
9
- };
10
- export type NodeCommonProps<T extends CoraxCSSProperties = CoraxCSSProperties> = {
11
- title?: string;
12
- style?: T;
13
- pseudoStyle?: CoraxCSSPseudos;
14
- className?: string;
15
- isLoaded?: boolean;
16
- isError?: boolean;
17
- };
18
- export type OmitContainersMethods<T extends Container> = Omit<T, "getChildren" | "appendChild" | "removeChild" | "getCurrentContainerObject">;
19
- export type OmitComponentsMethods<T extends Component> = Omit<T, "getChildren" | "appendChild" | "removeChild" | "getCurrentComponentObject" | "isInstance">;
20
- export type OmitFieldsMethods<T extends Field> = Omit<T, "isContainerized" | "getCurrentFieldObject">;
21
- export type OmitTNodesMethods<T extends TNode> = Omit<T, "getCurrentNodeObject">;
22
- export type UnionSide<T, K extends any> = K extends T ? K : never;
23
- export type PathToProp<T, F, Prev extends string = ""> = {
24
- [K in keyof T]: T[K] extends F ? `${Prev}${Extract<K, string>}` : T[K] extends object ? PathToProp<T[K], F, `${Prev}${Extract<K, string>}.`> : never;
25
- }[keyof T];
26
- export type RMUndfined<T> = T extends undefined ? never : T;
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types.ts";
2
- export interface LinkProps extends NodeCommonProps {
3
- }
@@ -1,24 +0,0 @@
1
- import type { FieldId } from "../field/field.ts";
2
- import type { OmitTNodesMethods } from "../global.types.ts";
3
- import type { LinkProps } from "./link.types.ts";
4
- import type { SpanProps } from "./span.types.ts";
5
- export type TNodeType = "link" | "sub-field";
6
- export type TNodeTag = "a" | "span";
7
- export type TNodeId = `tnode:${string}-${string}-${string}-${string}-${string}` | `node:${string}`;
8
- export type TNodeGlobalProps = {
9
- a: LinkProps;
10
- span: SpanProps;
11
- };
12
- export type TNodeProps<A extends TNodeTag = TNodeTag> = TNodeGlobalProps[A] & {
13
- text: string;
14
- };
15
- export interface TNode<T extends TNodeType = TNodeType, A extends TNodeTag = TNodeTag> {
16
- id: TNodeId;
17
- tag: A;
18
- type: T;
19
- name: string;
20
- variant: "tnode";
21
- fieldId?: FieldId;
22
- props: TNodeProps<A>;
23
- getCurrentNodeObject(): OmitTNodesMethods<TNode<T, A>>;
24
- }
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types.ts";
2
- export interface SpanProps extends NodeCommonProps {
3
- }
@@ -1,24 +0,0 @@
1
- import type { Field, FieldId } from "../field/field.ts";
2
- import type { Container, ContainerId } from "../container/container.ts";
3
- import type { Component, ComponentId } from "../components/components.ts";
4
- import type { OmitComponentsMethods, OmitContainersMethods, OmitFieldsMethods } from "../global.types.ts";
5
- export type OmittedMethodsBlock = OmitFieldsMethods<Field> | OmitComponentsMethods<Component> | OmitContainersMethods<Container>;
6
- export type Block = Field | Component | Container;
7
- export type BlockId = Block["id"];
8
- export type BlockTag = Block["tag"];
9
- export type BlockType = Block["type"];
10
- export type BlockVariant = Block["variant"];
11
- export type CoraxTree = {
12
- id: string;
13
- version: `${number}.${number}.${number}`;
14
- fields: Map<FieldId, Field>;
15
- containers: Map<ContainerId, Container>;
16
- components: Map<ComponentId, Component>;
17
- order: Set<BlockId>;
18
- };
19
- export type JSONTree = Pick<CoraxTree, "id" | "version"> & {
20
- order: BlockId[];
21
- fields: Record<FieldId, OmitFieldsMethods<Field>>;
22
- containers: Record<ContainerId, OmitContainersMethods<Container>>;
23
- components: Record<ComponentId, OmitComponentsMethods<Component>>;
24
- };
@@ -1 +0,0 @@
1
- export declare const DEFAULT_IMAGE_PREVIEW = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/4QBWRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAAEsAAAAAQAAASwAAAAB/+0ALFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAPHAFaAAMbJUccAQAAAgAEAP/hDW9odHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvADw/eHBhY2tldCBiZWdpbj0n77u/JyBpZD0nVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkJz8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0nYWRvYmU6bnM6bWV0YS8nIHg6eG1wdGs9J0ltYWdlOjpFeGlmVG9vbCAxMi40MCc+CjxyZGY6UkRGIHhtbG5zOnJkZj0naHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyc+CgogPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9JycKICB4bWxuczp0aWZmPSdodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyc+CiAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICA8dGlmZjpYUmVzb2x1dGlvbj4zMDAvMTwvdGlmZjpYUmVzb2x1dGlvbj4KICA8dGlmZjpZUmVzb2x1dGlvbj4zMDAvMTwvdGlmZjpZUmVzb2x1dGlvbj4KIDwvcmRmOkRlc2NyaXB0aW9uPgoKIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PScnCiAgeG1sbnM6eG1wPSdodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvJz4KICA8eG1wOkNyZWF0b3JUb29sPkFkb2JlIFN0b2NrIFBsYXRmb3JtPC94bXA6Q3JlYXRvclRvb2w+CiA8L3JkZjpEZXNjcmlwdGlvbj4KCiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0nJwogIHhtbG5zOnhtcE1NPSdodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vJz4KICA8eG1wTU06RG9jdW1lbnRJRD54bXAuaWlkOmUzMWNkNzdmLTgzMjgtNDdhYS04NWI0LTRlMDBkZGUwYzI4YjwveG1wTU06RG9jdW1lbnRJRD4KICA8eG1wTU06SW5zdGFuY2VJRD5hZG9iZTpkb2NpZDpzdG9jazo2M2Y2NTBiOC0zMjM3LTQyODktYTgwZS1lMzdjNDlhOWI2MjA8L3htcE1NOkluc3RhbmNlSUQ+CiAgPHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD5hZG9iZTpkb2NpZDpzdG9jazoxNjc5NDQyMTk2PC94bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ+CiA8L3JkZjpEZXNjcmlwdGlvbj4KPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//Z";
@@ -1 +0,0 @@
1
- export * from "./field.constants";
@@ -1,6 +0,0 @@
1
- import type { Mark, TextContent } from "@coorax/schema";
2
- export interface Segment {
3
- text: string;
4
- marks: readonly Mark[];
5
- }
6
- export declare function segments({ text, marks }: TextContent): Segment[];
@@ -1,35 +0,0 @@
1
- import type { TextField } from "../../base";
2
- import type { NodeCommonProps, PathToProp } from "../../base/types/global.types";
3
- export interface MarkMap {
4
- bold: {};
5
- italic: {};
6
- underline: {};
7
- link: {
8
- href: string;
9
- };
10
- code: {};
11
- initial: {
12
- style: NodeCommonProps["style"];
13
- };
14
- }
15
- export type MarkType = keyof MarkMap;
16
- export type MarkAttrs<T extends MarkType = MarkType> = MarkMap[T];
17
- export interface Mark<T extends MarkType = MarkType> {
18
- type: T;
19
- start: number;
20
- end: number;
21
- attrs?: MarkAttrs<T>;
22
- }
23
- export interface MarkSpec<T extends MarkType = MarkType> {
24
- type: T;
25
- attrs?: MarkAttrs<T>;
26
- }
27
- export interface MarkBehavior {
28
- /** Un caractère tapé juste après la fin du mark l'étend-il ? */
29
- inclusive: boolean;
30
- }
31
- export interface TextContent {
32
- text: string;
33
- marks: readonly Mark[];
34
- }
35
- export type FieldTextContentPath = PathToProp<TextField, TextContent>;
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../../base/types/global.types";
2
- import type { StyleName } from "./ui.types";
3
- export declare const DEFAULT_STYLES: Partial<Record<StyleName, NodeCommonProps>>;
@@ -1,10 +0,0 @@
1
- import type { Component } from "../base/types/components/components";
2
- import type { Container, ContainerType } from "../base/types/container/container";
3
- import type { OmitComponentsMethods } from "../base/types/global.types";
4
- declare function NewComponent<T extends ContainerType = ContainerType>(container: Omit<Container<T>, "id" | "variant">, defaultValue?: Partial<Pick<Component, "count" | "createdAt" | "updatedAt">>): Component<T>;
5
- declare function DeserializeComponent(component: OmitComponentsMethods<Component>): Component;
6
- export declare const ComponentsUtils: {
7
- NewComponent: typeof NewComponent;
8
- DeserializeComponent: typeof DeserializeComponent;
9
- };
10
- export {};
@@ -1,13 +0,0 @@
1
- import type { Container, ContainerType } from "../base/types/container/container";
2
- import type { OmitContainersMethods } from "../base/types/global.types";
3
- declare function NewUlListContainer(defaultValue?: Partial<OmitContainersMethods<Container<"list">>>): Container<"list">;
4
- declare function NewSectionContainer(defaultValue?: Partial<OmitContainersMethods<Container<"section">>>): Container<"section">;
5
- declare function NewContainer<T extends ContainerType = ContainerType>(type: T, defaultValue?: Partial<OmitContainersMethods<Container<T>>>): Container;
6
- declare function DeserializeContainer(container: OmitContainersMethods<Container>): Container;
7
- export declare const ContainersUtils: {
8
- NewContainer: typeof NewContainer;
9
- DeserializeContainer: typeof DeserializeContainer;
10
- NewUlListContainer: typeof NewUlListContainer;
11
- NewSectionContainer: typeof NewSectionContainer;
12
- };
13
- export {};
@@ -1,27 +0,0 @@
1
- import type { Block } from "../base";
2
- import type { Field, FieldTag, FieldType } from "../base/types/field/field";
3
- import type { OmitFieldsMethods } from "../base/types/global.types";
4
- export declare function isEditableField<T extends Field = Field>(block: Block): block is T;
5
- export declare function isEditableType<T extends FieldType = FieldType>(type: T): boolean;
6
- export declare function isMediaField<T extends Field = Field>(block: Block): block is T;
7
- export declare function isMediaType<T extends FieldType = FieldType>(type: T): boolean;
8
- export declare function getIframeSrc(value: string): string | null;
9
- declare function NewTextField(defaultValue?: Partial<OmitFieldsMethods<Field<"text", FieldTag>>>): Field<"text">;
10
- declare function NewHeadingField(defaultValue?: Partial<OmitFieldsMethods<Field<"heading", FieldTag>>>): Field<"heading">;
11
- declare function NewImageField(defaultValue?: Partial<OmitFieldsMethods<Field<"image", FieldTag>>>): Field<"image">;
12
- declare function NewIFrameField(defaultValue?: Partial<OmitFieldsMethods<Field<"iframe", FieldTag>>>): Field<"iframe">;
13
- declare function NewBlockquoteField(defaultValue?: Partial<OmitFieldsMethods<Field<"blockquote", FieldTag>>>): Field<"blockquote">;
14
- declare function NewDividerField(defaultValue?: Partial<OmitFieldsMethods<Field<"divider", FieldTag>>>): Field<"divider">;
15
- declare function NewField<T extends FieldType = FieldType, A extends FieldTag = FieldTag>(type: T, defaultValue?: Partial<OmitFieldsMethods<Field<T, A>>>): Field;
16
- declare function DeserializeField(field: OmitFieldsMethods<Field>): Field;
17
- export declare const FieldsUtils: {
18
- NewField: typeof NewField;
19
- DeserializeField: typeof DeserializeField;
20
- NewTextField: typeof NewTextField;
21
- NewHeadingField: typeof NewHeadingField;
22
- NewImageField: typeof NewImageField;
23
- NewDividerField: typeof NewDividerField;
24
- NewIFrameField: typeof NewIFrameField;
25
- NewBlockquoteField: typeof NewBlockquoteField;
26
- };
27
- export {};
@@ -1,47 +0,0 @@
1
- declare function generateRandomId(): string;
2
- export type CustomID<T extends string> = `${T}:${string}-${string}-${string}-${string}-${string}`;
3
- declare function generateId<T extends string>(prefix: T): CustomID<T>;
4
- declare function generateFieldId(): `field:${string}-${string}-${string}-${string}-${string}`;
5
- declare function generateTNodeId(): `tnode:${string}-${string}-${string}-${string}-${string}`;
6
- declare function generateContainerId(): `container:${string}-${string}-${string}-${string}-${string}`;
7
- declare function generateComponentId(): `component:${string}-${string}-${string}-${string}-${string}`;
8
- declare function generateTreeId(): `tree:${string}-${string}-${string}-${string}-${string}`;
9
- declare function generateSubscriberId(): `subscriber:${string}-${string}-${string}-${string}-${string}`;
10
- declare function Capitalize(value: string): string;
11
- type EntriesKeyValuePair<T extends object, K extends keyof T = keyof T> = [K, T[K]][];
12
- /**
13
- * Because the native `Object.entries` dont infer correctly
14
- * the return type, the `keys` are always string.
15
- * So now if you pass a `Record<Key, Value>`, the Key type
16
- * will be inferred correctly
17
- *
18
- * @param obj `object`
19
- * @returns `EntriesKeyValuePair<T>`
20
- */
21
- declare function ObjectEntries<T extends object>(obj: T): EntriesKeyValuePair<T>;
22
- export declare class CustomObject<T extends object> {
23
- obj: T;
24
- constructor(obj: T);
25
- filter(predicate: (value: T[keyof T], key: keyof T) => boolean): CustomObject<Partial<T>>;
26
- pick<K extends keyof T>(...keys: K[]): CustomObject<Pick<T, K>>;
27
- get size(): number;
28
- has<K extends keyof T>(key: K): boolean;
29
- get keys(): (keyof T)[];
30
- get<K extends keyof T>(key: K): T[K];
31
- baseObject(): T;
32
- }
33
- export declare function areObjectsTheSame(objA: object, objB: object): boolean;
34
- export declare const UTILS: {
35
- generateRandomId: typeof generateRandomId;
36
- generateId: typeof generateId;
37
- generateContainerId: typeof generateContainerId;
38
- generateFieldId: typeof generateFieldId;
39
- generateTreeId: typeof generateTreeId;
40
- generateSubscriberId: typeof generateSubscriberId;
41
- generateComponentId: typeof generateComponentId;
42
- Capitalize: typeof Capitalize;
43
- generateTNodeId: typeof generateTNodeId;
44
- ObjectEntries: typeof ObjectEntries;
45
- isPlainObject: (v: unknown) => v is Record<string, unknown>;
46
- };
47
- export {};
@@ -1,9 +0,0 @@
1
- import type { OmitTNodesMethods } from "../base/types/global.types";
2
- import type { TNode, TNodeType } from "../base/types/node/node";
3
- declare function NewTNode<T extends TNodeType = TNodeType>(type: T, defaultValue?: Partial<OmitTNodesMethods<TNode<T>>>): TNode;
4
- declare function DeserializeTNode(tnode: OmitTNodesMethods<TNode>): TNode;
5
- export declare const TNodesUtils: {
6
- NewTNode: typeof NewTNode;
7
- DeserializeTNode: typeof DeserializeTNode;
8
- };
9
- export {};
@@ -1,11 +0,0 @@
1
- import type { BlockId, CoraxTree, JSONTree } from "../base/types/tree/tree";
2
- export declare function SerializeTree(tree: CoraxTree): JSONTree;
3
- export declare function DeserializeTree(tree: JSONTree): CoraxTree;
4
- export declare function GetDefaultTree(): CoraxTree;
5
- export type TreeDiff = {
6
- added: ReadonlySet<BlockId>;
7
- removed: ReadonlySet<BlockId>;
8
- changed: ReadonlySet<BlockId>;
9
- orderChanged: boolean;
10
- };
11
- export declare function coraxTreeDiffing(prev: CoraxTree, next: CoraxTree): TreeDiff;