@coherent.js/core 1.0.0-rc.2 → 1.0.0-rc.4
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/README.md +13 -20
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +10 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -2
- package/types/index.d.ts +0 -151
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coherent.js/core",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
4
|
"description": "Core runtime for Coherent.js (SSR framework).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./types/index.d.ts",
|
|
12
|
-
"development": "./src/index.js",
|
|
13
12
|
"import": "./dist/index.js",
|
|
14
13
|
"require": "./dist/index.cjs"
|
|
15
14
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -564,15 +564,6 @@ export function checkPeerDependencies(
|
|
|
564
564
|
export function hasChildren(component: unknown): boolean;
|
|
565
565
|
export function normalizeChildren(children: unknown): unknown[];
|
|
566
566
|
|
|
567
|
-
/** Escape HTML characters in text */
|
|
568
|
-
export function escapeHtml(text: string): string;
|
|
569
|
-
|
|
570
|
-
/** Check if tag is a void element */
|
|
571
|
-
export function isVoidElement(tagName: string): boolean;
|
|
572
|
-
|
|
573
|
-
/** Format HTML attributes */
|
|
574
|
-
export function formatAttributes(attrs: HTMLAttributes): string;
|
|
575
|
-
|
|
576
567
|
/** Higher-order component for state management */
|
|
577
568
|
export const withState: WithStateHOC;
|
|
578
569
|
|
|
@@ -582,15 +573,6 @@ export function memo<T extends (...args: any[]) => any>(
|
|
|
582
573
|
options?: MemoOptions
|
|
583
574
|
): MemoizedFunction<T>;
|
|
584
575
|
|
|
585
|
-
/** Component memoization */
|
|
586
|
-
export function memoComponent<P extends ComponentProps>(
|
|
587
|
-
component: CoherentComponent<P>,
|
|
588
|
-
options?: { propsEqual?: (a: P, b: P) => boolean; name?: string }
|
|
589
|
-
): CoherentComponent<P>;
|
|
590
|
-
|
|
591
|
-
/** Higher-order component for props transformation */
|
|
592
|
-
export const withProps: WithPropsHOC;
|
|
593
|
-
|
|
594
576
|
/** Validate component structure */
|
|
595
577
|
export function validateComponent(obj: any, name?: string): boolean;
|
|
596
578
|
|
|
@@ -609,45 +591,10 @@ export function isLazy<T>(value: any): value is LazyWrapper<T>;
|
|
|
609
591
|
/** Evaluate lazy values recursively */
|
|
610
592
|
export function evaluateLazy<T>(obj: T, ...args: any[]): T;
|
|
611
593
|
|
|
612
|
-
/** Create lazy component */
|
|
613
|
-
export function lazyComponent<P extends ComponentProps>(
|
|
614
|
-
componentFactory: () => CoherentComponent<P>,
|
|
615
|
-
options?: LazyOptions
|
|
616
|
-
): LazyWrapper<CoherentComponent<P>>;
|
|
617
|
-
|
|
618
594
|
// ============================================================================
|
|
619
595
|
// Component System Classes and Functions
|
|
620
596
|
// ============================================================================
|
|
621
597
|
|
|
622
|
-
/** Component class constructor */
|
|
623
|
-
export class Component implements ComponentInstance {
|
|
624
|
-
constructor(definition?: ComponentDefinition);
|
|
625
|
-
|
|
626
|
-
name: string;
|
|
627
|
-
props: ComponentProps;
|
|
628
|
-
state: ComponentStateManager;
|
|
629
|
-
children: ComponentInstance[];
|
|
630
|
-
parent: ComponentInstance | null;
|
|
631
|
-
rendered: CoherentNode | null;
|
|
632
|
-
isMounted: boolean;
|
|
633
|
-
isDestroyed: boolean;
|
|
634
|
-
definition: ComponentDefinition;
|
|
635
|
-
hooks: Required<ComponentLifecycleHooks>;
|
|
636
|
-
methods: ComponentMethods;
|
|
637
|
-
computed: ComputedProperties;
|
|
638
|
-
computedCache: Map<string, any>;
|
|
639
|
-
watchers: ComponentWatchers;
|
|
640
|
-
|
|
641
|
-
render(props?: ComponentProps): CoherentNode;
|
|
642
|
-
mount(): ComponentInstance;
|
|
643
|
-
update(): ComponentInstance;
|
|
644
|
-
destroy(): ComponentInstance;
|
|
645
|
-
clone(overrides?: Partial<ComponentDefinition>): ComponentInstance;
|
|
646
|
-
getMetadata(): ComponentMetadata;
|
|
647
|
-
callHook(hookName: keyof ComponentLifecycleHooks, ...args: any[]): any;
|
|
648
|
-
handleError(error: Error, context?: string): void;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
598
|
/** Create a component instance */
|
|
652
599
|
export function createComponent(definition: ComponentDefinition | CoherentComponent): Component;
|
|
653
600
|
|
|
@@ -668,40 +615,10 @@ export function getComponent<P extends ComponentProps>(name: string): CoherentCo
|
|
|
668
615
|
/** Get all registered components */
|
|
669
616
|
export function getRegisteredComponents(): Map<string, CoherentComponent>;
|
|
670
617
|
|
|
671
|
-
/** Create a higher-order component */
|
|
672
|
-
export function createHOC<P extends ComponentProps, E extends ComponentProps>(
|
|
673
|
-
enhancer: (WrappedComponent: CoherentComponent<P>, props: E) => CoherentNode
|
|
674
|
-
): (WrappedComponent: CoherentComponent<P>) => CoherentComponent<E>;
|
|
675
|
-
|
|
676
618
|
// ============================================================================
|
|
677
619
|
// State Management Functions
|
|
678
620
|
// ============================================================================
|
|
679
621
|
|
|
680
|
-
/** Create a state container */
|
|
681
|
-
export function createState(initialState?: Record<string, any>): StateContainer;
|
|
682
|
-
|
|
683
|
-
/** Global state manager instance */
|
|
684
|
-
export const globalStateManager: GlobalStateManager;
|
|
685
|
-
|
|
686
|
-
/** Provide context to children */
|
|
687
|
-
export function provideContext<T>(key: string, value: T): void;
|
|
688
|
-
|
|
689
|
-
/** Create a context provider component */
|
|
690
|
-
export function createContextProvider<T>(
|
|
691
|
-
key: string,
|
|
692
|
-
value: T,
|
|
693
|
-
children: CoherentNode
|
|
694
|
-
): ContextProvider;
|
|
695
|
-
|
|
696
|
-
/** Restore context to previous value */
|
|
697
|
-
export function restoreContext(key: string): void;
|
|
698
|
-
|
|
699
|
-
/** Clear all context stacks */
|
|
700
|
-
export function clearAllContexts(): void;
|
|
701
|
-
|
|
702
|
-
/** Use context value */
|
|
703
|
-
export function useContext<T>(key: string): T | undefined;
|
|
704
|
-
|
|
705
622
|
// ============================================================================
|
|
706
623
|
// Virtual DOM Types (Additional)
|
|
707
624
|
// ============================================================================
|
|
@@ -714,14 +631,6 @@ export interface VNode {
|
|
|
714
631
|
key?: string | number;
|
|
715
632
|
}
|
|
716
633
|
|
|
717
|
-
/** VDOM operation types */
|
|
718
|
-
export const VDOM_OPERATIONS: {
|
|
719
|
-
CREATE: string;
|
|
720
|
-
REMOVE: string;
|
|
721
|
-
REPLACE: string;
|
|
722
|
-
UPDATE: string;
|
|
723
|
-
};
|
|
724
|
-
|
|
725
634
|
/** VDOM patch operation */
|
|
726
635
|
export interface VDOMPatch {
|
|
727
636
|
type: string;
|
|
@@ -731,54 +640,14 @@ export interface VDOMPatch {
|
|
|
731
640
|
props?: Record<string, any>;
|
|
732
641
|
}
|
|
733
642
|
|
|
734
|
-
/** Create a virtual node */
|
|
735
|
-
export function createVNode(type: string | Function, props?: Record<string, any>, children?: VNode[]): VNode;
|
|
736
|
-
|
|
737
|
-
/** Convert object to virtual node */
|
|
738
|
-
export function objectToVNode(component: CoherentNode, depth?: number): VNode;
|
|
739
|
-
|
|
740
|
-
/** Diff two virtual nodes */
|
|
741
|
-
export function diff(oldVNode: VNode, newVNode: VNode, patches?: VDOMPatch[], path?: (string | number)[]): VDOMPatch[];
|
|
742
|
-
|
|
743
|
-
/** Apply patches to DOM element */
|
|
744
|
-
export function patch(element: HTMLElement, patches: VDOMPatch[]): void;
|
|
745
|
-
|
|
746
|
-
/** VDOM differ class */
|
|
747
|
-
export class VDOMDiffer {
|
|
748
|
-
diff(oldVNode: VNode, newVNode: VNode): VDOMPatch[];
|
|
749
|
-
patch(element: HTMLElement, patches: VDOMPatch[]): void;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
643
|
// ============================================================================
|
|
753
644
|
// CSS Management (Additional)
|
|
754
645
|
// ============================================================================
|
|
755
646
|
|
|
756
|
-
/** CSS manager for component styles */
|
|
757
|
-
export class CSSManager {
|
|
758
|
-
addStyles(componentId: string, styles: string | Record<string, any>): void;
|
|
759
|
-
removeStyles(componentId: string): void;
|
|
760
|
-
getStyles(componentId?: string): string;
|
|
761
|
-
getAllStyles(): string;
|
|
762
|
-
clearStyles(): void;
|
|
763
|
-
hasStyles(componentId: string): boolean;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
647
|
// ============================================================================
|
|
767
648
|
// Performance Monitoring (Additional)
|
|
768
649
|
// ============================================================================
|
|
769
650
|
|
|
770
|
-
/** Performance monitor class */
|
|
771
|
-
export class PerformanceMonitor {
|
|
772
|
-
startRender(id?: string): string;
|
|
773
|
-
endRender(id: string): number;
|
|
774
|
-
recordRender(type: string, duration: number, metadata?: any): void;
|
|
775
|
-
getMetrics(): Record<string, any>;
|
|
776
|
-
clearMetrics(): void;
|
|
777
|
-
enableMonitoring(): void;
|
|
778
|
-
disableMonitoring(): void;
|
|
779
|
-
isEnabled(): boolean;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
651
|
/** Global performance monitor instance */
|
|
783
652
|
export const performanceMonitor: PerformanceMonitor;
|
|
784
653
|
|
|
@@ -804,27 +673,10 @@ export interface CacheManager {
|
|
|
804
673
|
prune(): void;
|
|
805
674
|
}
|
|
806
675
|
|
|
807
|
-
/** Create cache manager */
|
|
808
|
-
export function createCacheManager(options?: CacheManagerOptions): CacheManager;
|
|
809
|
-
|
|
810
|
-
/** Global cache manager instance */
|
|
811
|
-
export const cacheManager: CacheManager;
|
|
812
|
-
|
|
813
676
|
// ============================================================================
|
|
814
677
|
// Bundle Optimization (Additional)
|
|
815
678
|
// ============================================================================
|
|
816
679
|
|
|
817
|
-
/** Bundle optimizer class */
|
|
818
|
-
export class BundleOptimizer {
|
|
819
|
-
analyze(bundle: any): any;
|
|
820
|
-
optimize(bundle: any): any;
|
|
821
|
-
splitChunks(bundle: any): any[];
|
|
822
|
-
treeshake(bundle: any): any;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
/** Global bundle optimizer instance */
|
|
826
|
-
export const bundleOptimizer: BundleOptimizer;
|
|
827
|
-
|
|
828
680
|
// ============================================================================
|
|
829
681
|
// Component Cache (Additional)
|
|
830
682
|
// ============================================================================
|
|
@@ -850,9 +702,6 @@ export const VERSION: string;
|
|
|
850
702
|
/** Composition utilities */
|
|
851
703
|
export const compose: ComposeUtils;
|
|
852
704
|
|
|
853
|
-
/** Component utilities */
|
|
854
|
-
export const componentUtils: ComponentUtils;
|
|
855
|
-
|
|
856
705
|
/** Default export with all core functionality */
|
|
857
706
|
declare const coherent: {
|
|
858
707
|
render: typeof render;
|