@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.
- package/dist/components/commons/button.d.ts +8 -0
- package/dist/components/corax-context-provider.d.ts +6 -0
- package/dist/components/corax-flow.d.ts +4 -0
- package/dist/components/fallbacks/image.fallback.d.ts +3 -0
- package/dist/components/slots/buttons/block-actions-button.d.ts +3 -0
- package/dist/components/slots/buttons/toolbar-button.d.ts +3 -0
- package/dist/components/slots/maps/block-actions.d.ts +1 -0
- package/dist/components/slots/maps/overlays.d.ts +1 -0
- package/dist/components/slots/maps/text-inspector.d.ts +2 -0
- package/dist/components/slots/maps/toolbar.d.ts +1 -0
- package/dist/components/slots/overlays/focus-overlay.d.ts +3 -0
- package/dist/components/slots/overlays/hover-overlay.d.ts +3 -0
- package/dist/components/slots/overlays/selection-overlay.d.ts +3 -0
- package/dist/components/slots/slot-button.d.ts +6 -0
- package/dist/components/slots/slot-component.d.ts +5 -0
- package/dist/components/slots/slots.d.ts +4 -0
- package/dist/constants/field.constants.d.ts +2 -0
- package/dist/hooks/custom/use-custom-ref.d.ts +1 -0
- package/dist/hooks/custom/use-isomorphic-layout-effect.d.ts +2 -0
- package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -0
- package/dist/hooks/use-block-entry.d.ts +2 -0
- package/dist/hooks/use-block.d.ts +2 -0
- package/dist/hooks/use-flow.d.ts +17 -0
- package/dist/hooks/use-keyboard.d.ts +10 -0
- package/dist/hooks/use-registry.d.ts +3 -0
- package/dist/hooks/use-renderer.d.ts +2 -0
- package/dist/hooks/use-slice.d.ts +2 -0
- package/dist/hooks/use-slots.d.ts +2 -0
- package/dist/hooks/use-tasks.d.ts +7 -0
- package/dist/hooks/use-text-input.d.ts +2 -0
- package/dist/hooks/use-ui-context.d.ts +2 -0
- package/dist/hooks/useSelection.d.ts +2 -0
- package/{src/index.ts → dist/index.d.ts} +3 -4
- package/dist/index.js +2751 -0
- package/dist/lib/comp.utils.d.ts +4 -0
- package/dist/lib/func.utils.d.ts +3 -0
- package/dist/lib/selection.utils.d.ts +5 -0
- package/dist/lib/slots.utils.d.ts +4 -0
- package/dist/lifecycle/fields/focus.events/onbeforeinput.d.ts +3 -0
- package/dist/lifecycle/fields/focus.events/onblur.d.ts +3 -0
- package/dist/lifecycle/fields/focus.events/onfocus.d.ts +3 -0
- package/dist/lifecycle/fields/keyboard.events/onkeydown.d.ts +3 -0
- package/dist/lifecycle/fields/lifecycle.fields.d.ts +12 -0
- package/dist/lifecycle/fields/lifecycle.fields.types.d.ts +15 -0
- package/dist/lifecycle/fields/lifecycle.utils.d.ts +2 -0
- package/dist/lifecycle/fields/mouse.events/onclick.d.ts +3 -0
- package/dist/lifecycle/fields/mouse.events/ondoubleclick.d.ts +4 -0
- package/dist/lifecycle/fields/mouse.events/onmouseenter.d.ts +3 -0
- package/dist/lifecycle/fields/mouse.events/onmouseleave.d.ts +3 -0
- package/dist/lifecycle/fields/synthetic.events/onload.d.ts +3 -0
- package/dist/lifecycle/fields/synthetic.events/onselect.d.ts +3 -0
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/modules/autosave.module.d.ts +31 -0
- package/dist/modules/fallbacks.module.d.ts +7 -0
- package/dist/modules/slots.module.d.ts +7 -0
- package/dist/modules/ui-primitives.module.d.ts +7 -0
- package/dist/primitives/fields/field.primitives.d.ts +2 -0
- package/dist/primitives/index.d.ts +3 -0
- package/{src/registry/fallbacks.registry.tsx → dist/registry/fallbacks.registry.d.ts} +3 -4
- package/dist/registry/primitives.registry.d.ts +22 -0
- package/dist/registry/registry.d.ts +15 -0
- package/dist/registry/slots.registry.d.ts +4 -0
- package/{src/registry/ui.primitives.registry.tsx → dist/registry/ui.primitives.registry.d.ts} +3 -4
- package/dist/renderer/renderer.d.ts +23 -0
- package/dist/renderer/renderer.test.d.ts +1 -0
- package/{src/renderer/renderer.types.ts → dist/renderer/renderer.types.d.ts} +0 -1
- package/dist/renderer/renderer.utils.d.ts +14 -0
- package/dist/renderer/utils/divider.renderer.utils.d.ts +6 -0
- package/dist/services/localdb/db/db.d.ts +74 -0
- package/dist/services/localdb/db/db.test.d.ts +1 -0
- package/dist/services/localdb/lexer/lexer.d.ts +14 -0
- package/dist/services/localdb/lexer/lexer.test.d.ts +1 -0
- package/dist/services/localdb/lexer/lexer.types.d.ts +5 -0
- package/dist/services/localdb/operator/operator.d.ts +10 -0
- package/dist/services/localdb/parser/parser.constants.d.ts +3 -0
- package/dist/services/localdb/parser/parser.d.ts +14 -0
- package/dist/services/localdb/parser/parser.test.d.ts +1 -0
- package/dist/services/localdb/parser/parser.types.d.ts +43 -0
- package/dist/services/localdb/sheet/sheet.constants.d.ts +3 -0
- package/dist/services/localdb/sheet/sheet.d.ts +14 -0
- package/dist/services/localdb/sheet/sheet.types.d.ts +13 -0
- package/dist/styles.css +1094 -0
- package/package.json +29 -12
- package/.oxlintrc.json +0 -8
- package/src/components/commons/button.tsx +0 -59
- package/src/components/corax-context-provider.tsx +0 -47
- package/src/components/corax-flow.tsx +0 -44
- package/src/components/fallbacks/image.fallback.tsx +0 -23
- package/src/components/slots/buttons/block-actions-button.tsx +0 -85
- package/src/components/slots/buttons/toolbar-button.tsx +0 -40
- package/src/components/slots/maps/block-actions.tsx +0 -84
- package/src/components/slots/maps/overlays.tsx +0 -9
- package/src/components/slots/maps/text-inspector.tsx +0 -5
- package/src/components/slots/maps/toolbar.tsx +0 -79
- package/src/components/slots/overlays/focus-overlay.tsx +0 -30
- package/src/components/slots/overlays/hover-overlay.tsx +0 -18
- package/src/components/slots/overlays/selection-overlay.tsx +0 -20
- package/src/components/slots/slot-button.tsx +0 -20
- package/src/components/slots/slot-component.tsx +0 -17
- package/src/components/slots/slots.tsx +0 -29
- package/src/constants/field.constants.ts +0 -3
- package/src/hooks/custom/use-custom-ref.ts +0 -11
- package/src/hooks/use-block-entry.ts +0 -44
- package/src/hooks/use-block.ts +0 -11
- package/src/hooks/use-flow.ts +0 -83
- package/src/hooks/use-keyboard.ts +0 -66
- package/src/hooks/use-registry.ts +0 -18
- package/src/hooks/use-renderer.ts +0 -8
- package/src/hooks/use-slice.ts +0 -13
- package/src/hooks/use-slots.ts +0 -13
- package/src/hooks/use-tasks.ts +0 -33
- package/src/hooks/use-text-input.ts +0 -83
- package/src/hooks/use-ui-context.ts +0 -16
- package/src/hooks/useSelection.ts +0 -27
- package/src/lib/comp.utils.tsx +0 -44
- package/src/lib/func.utils.ts +0 -15
- package/src/lib/selection.utils.ts +0 -33
- package/src/lib/slots.utils.tsx +0 -23
- package/src/lifecycle/fields/focus.events/onbeforeinput.ts +0 -21
- package/src/lifecycle/fields/focus.events/onblur.ts +0 -19
- package/src/lifecycle/fields/focus.events/onfocus.ts +0 -16
- package/src/lifecycle/fields/keyboard.events/onkeydown.ts +0 -128
- package/src/lifecycle/fields/lifecycle.fields.ts +0 -116
- package/src/lifecycle/fields/lifecycle.fields.types.ts +0 -33
- package/src/lifecycle/fields/lifecycle.utils.ts +0 -26
- package/src/lifecycle/fields/mouse.events/onclick.ts +0 -79
- package/src/lifecycle/fields/mouse.events/ondoubleclick.ts +0 -27
- package/src/lifecycle/fields/mouse.events/onmouseenter.ts +0 -27
- package/src/lifecycle/fields/mouse.events/onmouseleave.ts +0 -21
- package/src/lifecycle/fields/synthetic.events/onload.ts +0 -16
- package/src/lifecycle/fields/synthetic.events/onselect.ts +0 -57
- package/src/lifecycle/index.ts +0 -1
- package/src/modules/autosave.module.ts +0 -238
- package/src/modules/fallbacks.module.tsx +0 -19
- package/src/modules/slots.module.tsx +0 -28
- package/src/modules/ui-primitives.module.tsx +0 -20
- package/src/primitives/fields/field.primitives.tsx +0 -86
- package/src/primitives/index.ts +0 -8
- package/src/registry/primitives.registry.tsx +0 -57
- package/src/registry/registry.ts +0 -44
- package/src/registry/slots.registry.tsx +0 -6
- package/src/renderer/renderer.test.ts +0 -34
- package/src/renderer/renderer.tsx +0 -164
- package/src/renderer/renderer.utils.tsx +0 -139
- package/src/renderer/utils/divider.renderer.utils.tsx +0 -53
- package/src/services/localdb/db/db.test.ts +0 -351
- package/src/services/localdb/db/db.ts +0 -628
- package/src/services/localdb/lexer/lexer.test.ts +0 -123
- package/src/services/localdb/lexer/lexer.ts +0 -173
- package/src/services/localdb/lexer/lexer.types.ts +0 -34
- package/src/services/localdb/operator/operator.ts +0 -16
- package/src/services/localdb/parser/parser.constants.ts +0 -23
- package/src/services/localdb/parser/parser.test.ts +0 -172
- package/src/services/localdb/parser/parser.ts +0 -427
- package/src/services/localdb/parser/parser.types.ts +0 -56
- package/src/services/localdb/sheet/sheet.constants.ts +0 -32
- package/src/services/localdb/sheet/sheet.ts +0 -47
- package/src/services/localdb/sheet/sheet.types.ts +0 -38
- package/tsconfig.app.json +0 -26
- package/tsconfig.json +0 -9
- package/tsconfig.node.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -9
- /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
- /package/{src/components/slots/index.ts → dist/components/slots/index.d.ts} +0 -0
- /package/{src/components/slots/maps/index.ts → dist/components/slots/maps/index.d.ts} +0 -0
- /package/{src/modules/index.ts → dist/modules/index.d.ts} +0 -0
- /package/{src/registry/index.ts → dist/registry/index.d.ts} +0 -0
|
@@ -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,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;
|
|
@@ -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
|
-
|
|
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
|
+
}
|
package/{src/registry/ui.primitives.registry.tsx → dist/registry/ui.primitives.registry.d.ts}
RENAMED
|
@@ -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
|
-
|
|
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 {};
|
|
@@ -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,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
|
+
};
|