@coorax/react 0.0.0-canary.1 → 0.0.0-canary.3

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 (168) hide show
  1. package/dist/components/commons/button.d.ts +8 -0
  2. package/dist/components/corax-context-provider.d.ts +6 -0
  3. package/dist/components/corax-flow.d.ts +4 -0
  4. package/dist/components/fallbacks/image.fallback.d.ts +3 -0
  5. package/dist/components/slots/buttons/block-actions-button.d.ts +3 -0
  6. package/dist/components/slots/buttons/toolbar-button.d.ts +3 -0
  7. package/dist/components/slots/maps/block-actions.d.ts +1 -0
  8. package/dist/components/slots/maps/overlays.d.ts +1 -0
  9. package/dist/components/slots/maps/text-inspector.d.ts +2 -0
  10. package/dist/components/slots/maps/toolbar.d.ts +1 -0
  11. package/dist/components/slots/overlays/focus-overlay.d.ts +3 -0
  12. package/dist/components/slots/overlays/hover-overlay.d.ts +3 -0
  13. package/dist/components/slots/overlays/selection-overlay.d.ts +3 -0
  14. package/dist/components/slots/slot-button.d.ts +6 -0
  15. package/dist/components/slots/slot-component.d.ts +5 -0
  16. package/dist/components/slots/slots.d.ts +4 -0
  17. package/dist/constants/field.constants.d.ts +2 -0
  18. package/dist/hooks/custom/use-custom-ref.d.ts +1 -0
  19. package/dist/hooks/custom/use-isomorphic-layout-effect.d.ts +2 -0
  20. package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -0
  21. package/dist/hooks/use-block-entry.d.ts +2 -0
  22. package/dist/hooks/use-block.d.ts +2 -0
  23. package/dist/hooks/use-flow.d.ts +17 -0
  24. package/dist/hooks/use-keyboard.d.ts +10 -0
  25. package/dist/hooks/use-registry.d.ts +3 -0
  26. package/dist/hooks/use-renderer.d.ts +2 -0
  27. package/dist/hooks/use-slice.d.ts +2 -0
  28. package/dist/hooks/use-slots.d.ts +2 -0
  29. package/dist/hooks/use-tasks.d.ts +7 -0
  30. package/dist/hooks/use-text-input.d.ts +2 -0
  31. package/dist/hooks/use-ui-context.d.ts +2 -0
  32. package/dist/hooks/useSelection.d.ts +2 -0
  33. package/{src/index.ts → dist/index.d.ts} +3 -4
  34. package/dist/index.js +2751 -0
  35. package/dist/lib/comp.utils.d.ts +4 -0
  36. package/dist/lib/func.utils.d.ts +3 -0
  37. package/dist/lib/selection.utils.d.ts +5 -0
  38. package/dist/lib/slots.utils.d.ts +4 -0
  39. package/dist/lifecycle/fields/focus.events/onbeforeinput.d.ts +3 -0
  40. package/dist/lifecycle/fields/focus.events/onblur.d.ts +3 -0
  41. package/dist/lifecycle/fields/focus.events/onfocus.d.ts +3 -0
  42. package/dist/lifecycle/fields/keyboard.events/onkeydown.d.ts +3 -0
  43. package/dist/lifecycle/fields/lifecycle.fields.d.ts +12 -0
  44. package/dist/lifecycle/fields/lifecycle.fields.types.d.ts +15 -0
  45. package/dist/lifecycle/fields/lifecycle.utils.d.ts +2 -0
  46. package/dist/lifecycle/fields/mouse.events/onclick.d.ts +3 -0
  47. package/dist/lifecycle/fields/mouse.events/ondoubleclick.d.ts +4 -0
  48. package/dist/lifecycle/fields/mouse.events/onmouseenter.d.ts +3 -0
  49. package/dist/lifecycle/fields/mouse.events/onmouseleave.d.ts +3 -0
  50. package/dist/lifecycle/fields/synthetic.events/onload.d.ts +3 -0
  51. package/dist/lifecycle/fields/synthetic.events/onselect.d.ts +3 -0
  52. package/dist/lifecycle/index.d.ts +1 -0
  53. package/dist/modules/autosave.module.d.ts +31 -0
  54. package/dist/modules/fallbacks.module.d.ts +7 -0
  55. package/dist/modules/slots.module.d.ts +7 -0
  56. package/dist/modules/ui-primitives.module.d.ts +7 -0
  57. package/dist/primitives/fields/field.primitives.d.ts +2 -0
  58. package/dist/primitives/index.d.ts +3 -0
  59. package/{src/registry/fallbacks.registry.tsx → dist/registry/fallbacks.registry.d.ts} +3 -4
  60. package/dist/registry/primitives.registry.d.ts +22 -0
  61. package/dist/registry/registry.d.ts +15 -0
  62. package/dist/registry/slots.registry.d.ts +4 -0
  63. package/{src/registry/ui.primitives.registry.tsx → dist/registry/ui.primitives.registry.d.ts} +3 -4
  64. package/dist/renderer/renderer.d.ts +23 -0
  65. package/dist/renderer/renderer.test.d.ts +1 -0
  66. package/{src/renderer/renderer.types.ts → dist/renderer/renderer.types.d.ts} +0 -1
  67. package/dist/renderer/renderer.utils.d.ts +14 -0
  68. package/dist/renderer/utils/divider.renderer.utils.d.ts +6 -0
  69. package/dist/services/localdb/db/db.d.ts +74 -0
  70. package/dist/services/localdb/db/db.test.d.ts +1 -0
  71. package/dist/services/localdb/lexer/lexer.d.ts +14 -0
  72. package/dist/services/localdb/lexer/lexer.test.d.ts +1 -0
  73. package/dist/services/localdb/lexer/lexer.types.d.ts +5 -0
  74. package/dist/services/localdb/operator/operator.d.ts +10 -0
  75. package/dist/services/localdb/parser/parser.constants.d.ts +3 -0
  76. package/dist/services/localdb/parser/parser.d.ts +14 -0
  77. package/dist/services/localdb/parser/parser.test.d.ts +1 -0
  78. package/dist/services/localdb/parser/parser.types.d.ts +43 -0
  79. package/dist/services/localdb/sheet/sheet.constants.d.ts +3 -0
  80. package/dist/services/localdb/sheet/sheet.d.ts +14 -0
  81. package/dist/services/localdb/sheet/sheet.types.d.ts +13 -0
  82. package/dist/styles.css +1094 -0
  83. package/package.json +29 -12
  84. package/.oxlintrc.json +0 -8
  85. package/src/components/commons/button.tsx +0 -59
  86. package/src/components/corax-context-provider.tsx +0 -47
  87. package/src/components/corax-flow.tsx +0 -44
  88. package/src/components/fallbacks/image.fallback.tsx +0 -23
  89. package/src/components/slots/buttons/block-actions-button.tsx +0 -85
  90. package/src/components/slots/buttons/toolbar-button.tsx +0 -40
  91. package/src/components/slots/maps/block-actions.tsx +0 -84
  92. package/src/components/slots/maps/overlays.tsx +0 -9
  93. package/src/components/slots/maps/text-inspector.tsx +0 -5
  94. package/src/components/slots/maps/toolbar.tsx +0 -79
  95. package/src/components/slots/overlays/focus-overlay.tsx +0 -30
  96. package/src/components/slots/overlays/hover-overlay.tsx +0 -18
  97. package/src/components/slots/overlays/selection-overlay.tsx +0 -20
  98. package/src/components/slots/slot-button.tsx +0 -20
  99. package/src/components/slots/slot-component.tsx +0 -17
  100. package/src/components/slots/slots.tsx +0 -29
  101. package/src/constants/field.constants.ts +0 -3
  102. package/src/hooks/custom/use-custom-ref.ts +0 -11
  103. package/src/hooks/use-block-entry.ts +0 -44
  104. package/src/hooks/use-block.ts +0 -11
  105. package/src/hooks/use-flow.ts +0 -83
  106. package/src/hooks/use-keyboard.ts +0 -66
  107. package/src/hooks/use-registry.ts +0 -18
  108. package/src/hooks/use-renderer.ts +0 -8
  109. package/src/hooks/use-slice.ts +0 -13
  110. package/src/hooks/use-slots.ts +0 -13
  111. package/src/hooks/use-tasks.ts +0 -33
  112. package/src/hooks/use-text-input.ts +0 -83
  113. package/src/hooks/use-ui-context.ts +0 -16
  114. package/src/hooks/useSelection.ts +0 -27
  115. package/src/lib/comp.utils.tsx +0 -44
  116. package/src/lib/func.utils.ts +0 -15
  117. package/src/lib/selection.utils.ts +0 -33
  118. package/src/lib/slots.utils.tsx +0 -23
  119. package/src/lifecycle/fields/focus.events/onbeforeinput.ts +0 -21
  120. package/src/lifecycle/fields/focus.events/onblur.ts +0 -19
  121. package/src/lifecycle/fields/focus.events/onfocus.ts +0 -16
  122. package/src/lifecycle/fields/keyboard.events/onkeydown.ts +0 -128
  123. package/src/lifecycle/fields/lifecycle.fields.ts +0 -116
  124. package/src/lifecycle/fields/lifecycle.fields.types.ts +0 -33
  125. package/src/lifecycle/fields/lifecycle.utils.ts +0 -26
  126. package/src/lifecycle/fields/mouse.events/onclick.ts +0 -79
  127. package/src/lifecycle/fields/mouse.events/ondoubleclick.ts +0 -27
  128. package/src/lifecycle/fields/mouse.events/onmouseenter.ts +0 -27
  129. package/src/lifecycle/fields/mouse.events/onmouseleave.ts +0 -21
  130. package/src/lifecycle/fields/synthetic.events/onload.ts +0 -16
  131. package/src/lifecycle/fields/synthetic.events/onselect.ts +0 -57
  132. package/src/lifecycle/index.ts +0 -1
  133. package/src/modules/autosave.module.ts +0 -238
  134. package/src/modules/fallbacks.module.tsx +0 -19
  135. package/src/modules/slots.module.tsx +0 -28
  136. package/src/modules/ui-primitives.module.tsx +0 -20
  137. package/src/primitives/fields/field.primitives.tsx +0 -86
  138. package/src/primitives/index.ts +0 -8
  139. package/src/registry/primitives.registry.tsx +0 -57
  140. package/src/registry/registry.ts +0 -44
  141. package/src/registry/slots.registry.tsx +0 -6
  142. package/src/renderer/renderer.test.ts +0 -34
  143. package/src/renderer/renderer.tsx +0 -164
  144. package/src/renderer/renderer.utils.tsx +0 -139
  145. package/src/renderer/utils/divider.renderer.utils.tsx +0 -53
  146. package/src/services/localdb/db/db.test.ts +0 -351
  147. package/src/services/localdb/db/db.ts +0 -628
  148. package/src/services/localdb/lexer/lexer.test.ts +0 -123
  149. package/src/services/localdb/lexer/lexer.ts +0 -173
  150. package/src/services/localdb/lexer/lexer.types.ts +0 -34
  151. package/src/services/localdb/operator/operator.ts +0 -16
  152. package/src/services/localdb/parser/parser.constants.ts +0 -23
  153. package/src/services/localdb/parser/parser.test.ts +0 -172
  154. package/src/services/localdb/parser/parser.ts +0 -427
  155. package/src/services/localdb/parser/parser.types.ts +0 -56
  156. package/src/services/localdb/sheet/sheet.constants.ts +0 -32
  157. package/src/services/localdb/sheet/sheet.ts +0 -47
  158. package/src/services/localdb/sheet/sheet.types.ts +0 -38
  159. package/tsconfig.app.json +0 -26
  160. package/tsconfig.json +0 -9
  161. package/tsconfig.node.json +0 -9
  162. package/tsconfig.tsbuildinfo +0 -1
  163. package/vite.config.ts +0 -9
  164. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  165. /package/{src/components/slots/index.ts → dist/components/slots/index.d.ts} +0 -0
  166. /package/{src/components/slots/maps/index.ts → dist/components/slots/maps/index.d.ts} +0 -0
  167. /package/{src/modules/index.ts → dist/modules/index.d.ts} +0 -0
  168. /package/{src/registry/index.ts → dist/registry/index.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ import type { SlotIcon } from "@coorax/core";
2
+ export declare function CoraxIcon({ icon }: {
3
+ icon: SlotIcon;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { BlockId, Engine } from "@coorax/core";
2
+ export declare function focusDomBLockById(engine: Engine, id: BlockId): void;
3
+ export declare function focusDomElement(id: string): void;
@@ -0,0 +1,5 @@
1
+ export declare function rangeToOffsets(root: HTMLElement, range: Range): {
2
+ start: number;
3
+ end: number;
4
+ };
5
+ export declare function offsetsToRange(root: HTMLElement, start: number, end: number): Range | null;
@@ -0,0 +1,4 @@
1
+ import type { SliceValue } from "@coorax/core";
2
+ import type React from "react";
3
+ import type { Button } from "../components/commons/button";
4
+ export declare function getBlockActionsProps(isOpen: SliceValue<"insertion">, index: number): React.ComponentProps<typeof Button>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnBeforeInput: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onBeforeInput">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnBlur: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onBlur">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnFocus: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onFocus">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { type Block, type BlockTag, type Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnKeyDown: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onKeyDown">>) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ import { type Block, type Engine, type BlockTag } from "@coorax/core";
2
+ import type { FieldLifeCycleEvents, FnParams, NativeCallback } from "./lifecycle.fields.types";
3
+ export declare function getFieldTypeAndTargetId(engine: Engine, ev: FnParams<NativeCallback>, block: Block): {
4
+ fieldType: keyof import("@coorax/core").FieldTMap;
5
+ target: import("@coorax/core").FieldId | import("@coorax/core").ComponentId | import("@coorax/core").ContainerId;
6
+ emit: () => Promise<void>;
7
+ } | null;
8
+ declare function getFieldLifeCycleEvents<K extends BlockTag = BlockTag>(engine: Engine, tag: K, block: Block): FieldLifeCycleEvents<K>;
9
+ export declare const FLC: {
10
+ getFieldLifeCycleEvents: typeof getFieldLifeCycleEvents;
11
+ };
12
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { BlockId, BlockTag, BlockType, Engine, Field, FieldType } from "@coorax/core";
2
+ import type { DOMAttributes } from "react";
3
+ export type FieldElementOf<T extends BlockTag> = HTMLElementTagNameMap[T];
4
+ export interface FieldLifeCycleEvents<T extends BlockTag = BlockTag> extends Omit<DOMAttributes<FieldElementOf<T>>, "dangerouslySetInnerHTML" | "children"> {
5
+ }
6
+ export type FieldLifeCycleLiterals<T extends BlockTag = BlockTag> = keyof FieldLifeCycleEvents<T>;
7
+ export type NativeCallback<T extends BlockTag = BlockTag, K extends FieldLifeCycleLiterals<T> = FieldLifeCycleLiterals<T>> = FieldLifeCycleEvents<T>[K];
8
+ export type LifeCycleCallback<T extends BlockTag = BlockTag, A extends FieldType = FieldType, K extends FieldLifeCycleLiterals<T> = FieldLifeCycleLiterals<T>> = (engine: Engine, field: Field<A>, event: FnParams<NativeCallback<T, K>>) => void;
9
+ export type FnParams<T extends ((event: never) => void) | undefined> = T extends (event: infer R) => void ? R : never;
10
+ export type FieldLifeCycleEvProps<T extends BlockTag = BlockTag> = {
11
+ target: BlockId;
12
+ fieldType: BlockType;
13
+ type: FieldLifeCycleLiterals<T>;
14
+ cycleEvent: FnParams<NativeCallback<T, FieldLifeCycleLiterals<T>>>;
15
+ };
@@ -0,0 +1,2 @@
1
+ import type { BlockId, BlockRect } from "@coorax/core";
2
+ export declare function blockRectFromBlockId(id: BlockId): BlockRect | null;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnClick: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onClick">>) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { BlockTag, Block } from "@coorax/core";
2
+ import { Engine } from "@coorax/core";
3
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
4
+ export declare const createOnDoubleClick: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onDoubleClick">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnMouseEnter: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onMouseEnter">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnMouseLeave: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onMouseLeave">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnLoad: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onLoad">>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Block, BlockTag, Engine } from "@coorax/core";
2
+ import type { FnParams, NativeCallback } from "../lifecycle.fields.types";
3
+ export declare const createOnSelect: <K extends BlockTag = keyof import("@coorax/core").FieldMap | import("@coorax/core").ContainerTag>(engine: Engine, block: Block, ev: FnParams<NativeCallback<K, "onSelect">>) => Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { type TModule } from "@coorax/core";
2
+ import { LocalDB } from "../services/localdb/db/db";
3
+ declare module "@coorax/core" {
4
+ interface ModuleMap {
5
+ autosave: {
6
+ loadDocument(id: string): Promise<any>;
7
+ saveMedia(media: {
8
+ id: string;
9
+ document_id: string;
10
+ name: string;
11
+ type: string;
12
+ size: number;
13
+ data: File | Blob;
14
+ }): Promise<any>;
15
+ };
16
+ }
17
+ }
18
+ declare module "@coorax/core" {
19
+ interface StateMap {
20
+ localdbState: {
21
+ isDBReady: boolean;
22
+ };
23
+ }
24
+ }
25
+ declare module "@coorax/core" {
26
+ interface TaskMap {
27
+ "autosave:persist": true;
28
+ }
29
+ }
30
+ export declare function loadCompleteDocument(db: LocalDB, documentId: string): Promise<any>;
31
+ export declare const AutoSaveModule: TModule;
@@ -0,0 +1,7 @@
1
+ import { type TModule } from "@coorax/core";
2
+ declare module "@coorax/core" {
3
+ interface ModuleMap {
4
+ fallbacks: {};
5
+ }
6
+ }
7
+ export declare const FallbacksModule: TModule;
@@ -0,0 +1,7 @@
1
+ import { type TModule } from "@coorax/core";
2
+ declare module "@coorax/core" {
3
+ interface ModuleMap {
4
+ slots: {};
5
+ }
6
+ }
7
+ export declare const SlotsModule: TModule;
@@ -0,0 +1,7 @@
1
+ import { type TModule } from "@coorax/core";
2
+ declare module "@coorax/core" {
3
+ interface ModuleMap {
4
+ "ui-primitives": {};
5
+ }
6
+ }
7
+ export declare const UIPrimitivesModule: TModule;
@@ -0,0 +1,2 @@
1
+ import type { RComponentProps } from "../../registry/primitives.registry";
2
+ export declare function FieldPrimitive({ blockId }: RComponentProps): import("react").JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import type { BlockVariant } from "@coorax/core";
2
+ import type { RComponent } from "../registry/primitives.registry";
3
+ export declare const FieldsPrimitives: Partial<Record<BlockVariant, RComponent>>;
@@ -1,9 +1,8 @@
1
1
  import type { JSXElementConstructor } from "react";
2
2
  import { GenericRegistry } from "./registry";
3
3
  import type { Block, BlockType, NodeCommonProps } from "@coorax/core";
4
-
5
- export interface FallbackComponentMap extends Record<BlockType, any> {}
4
+ export interface FallbackComponentMap extends Record<BlockType, any> {
5
+ }
6
6
  export type FallbackKey = keyof FallbackComponentMap;
7
7
  export type FallbackComponent = JSXElementConstructor<Block & NodeCommonProps>;
8
-
9
- export const FallbackComponentsRegistry = new GenericRegistry<FallbackKey, FallbackComponent>();
8
+ export declare const FallbackComponentsRegistry: GenericRegistry<keyof FallbackComponentMap, FallbackComponent>;
@@ -0,0 +1,22 @@
1
+ import type { BlockTag, BlockId, BlockVariant } from "@coorax/core";
2
+ import type { FieldLifeCycleEvents } from "../lifecycle/fields/lifecycle.fields.types";
3
+ export type RComponentProps<T extends BlockTag = BlockTag> = FieldLifeCycleEvents<T> & {
4
+ blockId: BlockId;
5
+ };
6
+ export type RComponent<T extends BlockTag = BlockTag> = (props: RComponentProps<T>) => React.ReactNode;
7
+ interface CR {
8
+ get<T extends BlockTag = BlockTag>(name: BlockVariant): RComponent<T> | null;
9
+ post<T extends BlockTag = BlockTag>(name: BlockVariant, comp: RComponent<T>): void;
10
+ getAll(names: BlockVariant[]): (RComponent | null)[];
11
+ batch(comps: Record<BlockVariant, RComponent>): void;
12
+ delete(name: BlockVariant): void;
13
+ }
14
+ export declare class PrimitivesComponentsRegistry implements CR {
15
+ private components;
16
+ get<T extends BlockTag = BlockTag>(name: BlockVariant): RComponent<T> | null;
17
+ getAll(names: BlockVariant[]): (RComponent | null)[];
18
+ post<T extends BlockTag = BlockTag>(name: BlockVariant, comp: RComponent<T>): void;
19
+ delete(name: BlockVariant): void;
20
+ batch(comps: Record<BlockVariant, RComponent>): void;
21
+ }
22
+ export {};
@@ -0,0 +1,15 @@
1
+ export type RegistryListener = () => void;
2
+ export type RegistryDisposer = () => void;
3
+ export interface GenericRegistryInterface<K, V> {
4
+ get(key: K): V | undefined;
5
+ register(key: K, value: V): RegistryDisposer;
6
+ subscribe(key: K, fn: RegistryListener): RegistryDisposer;
7
+ }
8
+ export declare class GenericRegistry<K, V> implements GenericRegistryInterface<K, V> {
9
+ private items;
10
+ private listeners;
11
+ private notify;
12
+ get(key: K): V | undefined;
13
+ register(key: K, value: V): RegistryDisposer;
14
+ subscribe(key: K, fn: RegistryListener): RegistryDisposer;
15
+ }
@@ -0,0 +1,4 @@
1
+ import type { SlotKey } from "@coorax/core";
2
+ import { GenericRegistry } from "./registry";
3
+ import type { JSXElementConstructor } from "react";
4
+ export declare const SlotsComponentRegistry: GenericRegistry<SlotKey, JSXElementConstructor<any>>;
@@ -1,9 +1,8 @@
1
1
  import type { JSXElementConstructor } from "react";
2
2
  import { GenericRegistry } from "./registry";
3
3
  import type { SlotKey } from "@coorax/core";
4
-
5
- export interface UIPrimitivesComponentMap extends Record<SlotKey, any> {}
4
+ export interface UIPrimitivesComponentMap extends Record<SlotKey, any> {
5
+ }
6
6
  export type UIPrimitivesKey = keyof UIPrimitivesComponentMap;
7
7
  export type UIPrimitivesComponent = JSXElementConstructor<any>;
8
-
9
- export const UIPrimitivesRegistry = new GenericRegistry<UIPrimitivesKey, UIPrimitivesComponent>();
8
+ export declare const UIPrimitivesRegistry: GenericRegistry<keyof UIPrimitivesComponentMap, UIPrimitivesComponent>;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { Engine, type Field, type FieldId, type FieldType, type TNode, type TNodeType, type Container, type TextField, type MediaField, type DividerField } from "@coorax/core";
3
+ import { PrimitivesComponentsRegistry } from "../registry/primitives.registry";
4
+ interface RendererInterface {
5
+ renderField(field: Field | FieldId, key?: null | number): React.ReactElement;
6
+ renderContainer(contanier: Container): React.ReactElement;
7
+ renderTree(key?: number): React.ReactElement;
8
+ }
9
+ export declare class ReactRenderer implements RendererInterface {
10
+ private engine;
11
+ readonly primitives: PrimitivesComponentsRegistry;
12
+ constructor(engine: Engine);
13
+ renderContainer(contanier: Container): React.ReactElement;
14
+ renderTree(key?: number): React.ReactElement;
15
+ renderTextField(field: TextField, key?: null): React.ReactElement;
16
+ renderMediaField(field: MediaField, key?: null): React.ReactElement;
17
+ renderDividerField(field: DividerField, key?: null): React.ReactElement;
18
+ renderField<T extends FieldType = FieldType>(_field: Field<T> | FieldId, key?: null): React.ReactElement;
19
+ private renderSegment;
20
+ private renderTextContent;
21
+ renderNode<T extends TNodeType = TNodeType>(node: TNode<T>, key?: null): React.ReactElement;
22
+ }
23
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,2 @@
1
1
  import type { Block } from "@coorax/core";
2
-
3
2
  export type ReactFieldProps<T extends Block["tag"]> = React.ComponentProps<T>;
@@ -0,0 +1,14 @@
1
+ import { type FieldType, type ContainerId, type Engine, type MediaField, type TextField, type CoraxCSSPseudos } from "@coorax/core";
2
+ import type { ReactFieldProps } from "./renderer.types";
3
+ export declare function getTextFieldProps<T extends TextField = TextField>(engine: Engine, block: T): ReactFieldProps<T["tag"]> & {
4
+ "data-block-type": FieldType;
5
+ "data-containerId"?: ContainerId;
6
+ "data-placeholder"?: string;
7
+ "data-text-path"?: string;
8
+ };
9
+ export declare function getMediaFieldProps<T extends MediaField = MediaField>(engine: Engine, block: T): ReactFieldProps<T["tag"]> & {
10
+ "data-block-type": FieldType;
11
+ "data-containerId"?: ContainerId;
12
+ };
13
+ export declare function resolveCoraxPseudoStyle(style?: CoraxCSSPseudos): string | undefined;
14
+ export declare function normalizeCoraxPseudoStyles<T extends CoraxCSSPseudos = CoraxCSSPseudos>(style: T): T;
@@ -0,0 +1,6 @@
1
+ import type { ContainerId, DividerField, Engine, FieldType } from "@coorax/core";
2
+ import type { ReactFieldProps } from "../renderer.types";
3
+ export declare function getDividerFieldProps<T extends DividerField = DividerField>(engine: Engine, block: T): ReactFieldProps<T["tag"]> & {
4
+ "data-block-type": FieldType;
5
+ "data-containerId"?: ContainerId;
6
+ };
@@ -0,0 +1,74 @@
1
+ export type LocalDBErrorType = Error | DOMException;
2
+ interface DB {
3
+ isAvailable: boolean;
4
+ isError: Error | null;
5
+ QueryDB<T extends any>(query: string, params?: any[]): Promise<LocalDBErrorType | T[]>;
6
+ DeleteDB(): Promise<LocalDBErrorType | null>;
7
+ MigrateDB(query: string): Promise<LocalDBErrorType | null>;
8
+ }
9
+ export declare class LocalDB implements DB {
10
+ private DBName;
11
+ private DBVersion;
12
+ private readonly defaultStores;
13
+ private readonly DBTypesStoreName;
14
+ readonly isAvailable: boolean;
15
+ isError: Error | null;
16
+ private db;
17
+ private client;
18
+ private sheet;
19
+ constructor(DbName?: string);
20
+ /**
21
+ *
22
+ * @param ev `Event`
23
+ * @param cb `resolve` or `reject` or any other callback
24
+ * But in our case `reject`
25
+ */
26
+ private onDBError;
27
+ /**
28
+ *
29
+ * @param ev `Event`
30
+ * @param cb `resolve` or `reject` or any other callback
31
+ * But in our case `resolve`
32
+ */
33
+ private onDBSuccess;
34
+ private closeConnection;
35
+ private ensureObjectStores;
36
+ private bumpVersion;
37
+ DeleteDB(): Promise<LocalDBErrorType | null>;
38
+ private init;
39
+ /**
40
+ * Récupère toutes les données d'une table IndexedDB
41
+ * @param objectStore Le object store de la table
42
+ * @param columns Les colonnes à récupérer (["*"] pour toutes)
43
+ * @returns Promise avec les données récupérées (T représente le tableau de résultats)
44
+ */
45
+ private retrieveData;
46
+ /**
47
+ * Récupère une donnée par son ID dans une table IndexedDB
48
+ * @param objectStore Le object store de la table
49
+ * @param id L'identifiant de l'enregistrement
50
+ * @param columns Les colonnes à récupérer (["*"] pour toutes)
51
+ * @returns Promise avec la donnée récupérée ou null si non trouvée
52
+ */
53
+ private retrieveById;
54
+ /**
55
+ * Insère ou met à jour des données dans une table IndexedDB
56
+ * @param objectStore Le object store de la table
57
+ * @param data Les données à insérer
58
+ * @returns Promise avec null ou Error
59
+ */
60
+ private insertData;
61
+ /**
62
+ * Ouvre une transaction sur une ou plusieurs tables IndexedDB
63
+ * @param tableNames Nom(s) de table(s)
64
+ * @param reject Fonction reject pour la gestion d'erreurs
65
+ * @param mode IDBTransactionMode ("readwrite" ou "readonly")
66
+ * @returns L'object store de la première table
67
+ */
68
+ private openTx;
69
+ private convertFieldValueType;
70
+ private executeQuery;
71
+ QueryDB<T extends any = any>(query: string, params?: any[]): Promise<LocalDBErrorType | T[]>;
72
+ MigrateDB(query: string): Promise<Error | null>;
73
+ }
74
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Token } from "./lexer.types";
2
+ interface Lex {
3
+ lex: (sqlString: string) => Token[];
4
+ }
5
+ export declare class Lexer implements Lex {
6
+ private pos;
7
+ private word;
8
+ private tokensTypes;
9
+ private cleanWord;
10
+ private bumpPos;
11
+ private flushWord;
12
+ lex(sql: string): Token[];
13
+ }
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type TokenType = "SELECT" | "FROM" | "WHERE" | "JOIN" | "INNER" | "LEFT" | "RIGHT" | "FULL" | "CROSS" | "ON" | "AND" | "OR" | "AS" | "IDENTIFIER" | "COMMA" | "SEMICOLON" | "STAR" | "INSERT" | "INTO" | "VALUES" | "BRACKETS" | "CREATE" | "TABLE" | "EQUALS" | "DOT" | "STRING" | "NUMBER" | "QUESTION_MARK";
2
+ export type Token = {
3
+ type: TokenType;
4
+ value: string;
5
+ };
@@ -0,0 +1,10 @@
1
+ import type { Statement } from "../parser/parser.types";
2
+ interface Client {
3
+ NewRequest(query: string, params?: any[]): Statement[];
4
+ }
5
+ export declare class DBClient implements Client {
6
+ private lexer;
7
+ private parser;
8
+ NewRequest(query: string, params?: any[]): Statement[];
9
+ }
10
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { LocalDBType } from "../sheet/sheet.types";
2
+ export declare const TYPES_DEFS: readonly ["TEXT", "DATETIME", "INTEGER", "UUID", "OBJECT", "ARRAY[STRING]", "FILE", "BLOB"];
3
+ export declare const TYPES_DEFS_MAPPING: Record<(typeof TYPES_DEFS)[number], LocalDBType>;
@@ -0,0 +1,14 @@
1
+ import type { Token } from "../lexer/lexer.types";
2
+ import type { Statement, StatementType } from "./parser.types";
3
+ interface Parse {
4
+ parse<T extends StatementType>(tokens: Token[], params?: any[]): Statement<T>[];
5
+ }
6
+ export declare class Parser implements Parse {
7
+ private statementTypes;
8
+ private foundTable;
9
+ private parseSelect;
10
+ private parseInsert;
11
+ private parseCreate;
12
+ parse<T extends StatementType = StatementType>(tokens: Token[], params?: any[]): Statement<T>[];
13
+ }
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import type { LocalDBType } from "../sheet/sheet.types";
2
+ export type StatementType = "SELECT" | "INSERT" | "CREATE";
3
+ export type JoinType = "INNER" | "LEFT" | "RIGHT" | "FULL" | "CROSS" | "JOIN";
4
+ export type JoinCondition = {
5
+ leftTable?: string;
6
+ leftColumn: string;
7
+ operator: "=";
8
+ rightTable?: string;
9
+ rightColumn: string;
10
+ };
11
+ export type JoinClause = {
12
+ type: JoinType;
13
+ table: string;
14
+ alias?: string;
15
+ on?: JoinCondition;
16
+ };
17
+ export type WhereCondition = {
18
+ table?: string;
19
+ column: string;
20
+ operator: "=" | "!=" | ">" | "<" | ">=" | "<=";
21
+ value: any;
22
+ };
23
+ export type SelectStatement = {
24
+ type: "SELECT";
25
+ columns: string[];
26
+ table: string;
27
+ alias?: string;
28
+ joins?: JoinClause[];
29
+ where?: WhereCondition[];
30
+ };
31
+ export type InsertStatement = {
32
+ type: "INSERT";
33
+ columns: string[];
34
+ table: string;
35
+ fields?: string[];
36
+ values?: any[];
37
+ };
38
+ export type CreateStatement = {
39
+ type: "CREATE";
40
+ columns: `${string}:${LocalDBType}`[];
41
+ table: string;
42
+ };
43
+ export type Statement<T extends StatementType = StatementType> = T extends "SELECT" ? SelectStatement : T extends "INSERT" ? InsertStatement : CreateStatement;
@@ -0,0 +1,3 @@
1
+ import type { LocalDBType } from "./sheet.types";
2
+ import z from "zod";
3
+ export declare const DEFAULT_FIELDS_SCHEMA: Map<LocalDBType, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
@@ -0,0 +1,14 @@
1
+ import type { Statement } from "../parser/parser.types";
2
+ import type { Table } from "./sheet.types";
3
+ interface Sheet {
4
+ RegisterSheet(...objects: object[]): Promise<Table[]>;
5
+ GetTables(): Table[];
6
+ }
7
+ export declare class TablesSheet implements Sheet {
8
+ private tables;
9
+ constructor();
10
+ private statementToTable;
11
+ RegisterSheet(statements: Statement<"CREATE">[]): Promise<Table[]>;
12
+ GetTables(): Table[];
13
+ }
14
+ export {};
@@ -0,0 +1,13 @@
1
+ export type LocalDBType = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "uuid" | "array.string" | "file" | "blob";
2
+ export type LocalDBNativeType = string | number | bigint | boolean | symbol | object | Blob | File | null | undefined;
3
+ export type Field<T extends LocalDBType = LocalDBType> = T;
4
+ export type FieldType = LocalDBType;
5
+ export interface LocalDBTableMap {
6
+ "__db.types": {};
7
+ }
8
+ export type LocalDBTableName = keyof LocalDBTableMap | string;
9
+ export type Table = {
10
+ name: LocalDBTableName;
11
+ fields: Record<string, Field>;
12
+ order: string[];
13
+ };