@coherent.js/client 1.0.0-beta.5 → 1.0.0-beta.6
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/index.js +83 -30
- package/dist/index.js.map +2 -2
- package/package.json +24 -6
- package/src/index.js +62 -0
- package/types/hmr.d.ts +1 -0
- package/types/hydration.d.ts +66 -0
- package/types/index.d.ts +539 -46
- package/types/router.d.ts +167 -0
- package/src/hydration.js +0 -1791
package/package.json
CHANGED
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coherent.js/client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "Client-side hydration/HMR utilities for Coherent.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "src/
|
|
6
|
+
"main": "src/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"development": "./src/index.js",
|
|
11
12
|
"import": "./dist/index.js"
|
|
12
13
|
},
|
|
13
|
-
"./
|
|
14
|
-
|
|
14
|
+
"./hydration": {
|
|
15
|
+
"types": "./types/hydration.d.ts",
|
|
16
|
+
"default": "./src/hydration.js"
|
|
17
|
+
},
|
|
18
|
+
"./events": {
|
|
19
|
+
"types": "./types/events.d.ts",
|
|
20
|
+
"default": "./src/events/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./router": {
|
|
23
|
+
"types": "./types/router.d.ts",
|
|
24
|
+
"default": "./src/router.js"
|
|
25
|
+
},
|
|
26
|
+
"./hmr": {
|
|
27
|
+
"types": "./types/hmr.d.ts",
|
|
28
|
+
"default": "./src/hmr.js"
|
|
29
|
+
}
|
|
15
30
|
},
|
|
16
31
|
"types": "./types/index.d.ts",
|
|
17
32
|
"files": [
|
|
@@ -33,12 +48,15 @@
|
|
|
33
48
|
"registry": "https://registry.npmjs.org/"
|
|
34
49
|
},
|
|
35
50
|
"sideEffects": false,
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"expect-type": "1.3.0"
|
|
53
|
+
},
|
|
36
54
|
"scripts": {
|
|
37
55
|
"build": "node build.mjs",
|
|
38
56
|
"clean": "rm -rf dist/",
|
|
39
57
|
"test": "vitest run",
|
|
40
58
|
"test:watch": "vitest",
|
|
41
|
-
"typecheck": "tsc --noEmit",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
42
60
|
"test:coverage": "vitest run --coverage",
|
|
43
61
|
"test:vitest": "vitest run",
|
|
44
62
|
"test:node": "node --test test/*.test.js"
|
package/src/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coherent.js Client Package
|
|
3
|
+
*
|
|
4
|
+
* Public API for client-side hydration, event delegation, and state management.
|
|
5
|
+
*
|
|
6
|
+
* @module @coherent.js/client
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// New clean hydrate API (Phase 2)
|
|
10
|
+
export { hydrate } from './hydrate.js';
|
|
11
|
+
|
|
12
|
+
// Event delegation system (Plan 02-01)
|
|
13
|
+
export {
|
|
14
|
+
EventDelegation,
|
|
15
|
+
eventDelegation,
|
|
16
|
+
HandlerRegistry,
|
|
17
|
+
handlerRegistry,
|
|
18
|
+
wrapEvent,
|
|
19
|
+
} from './events/index.js';
|
|
20
|
+
|
|
21
|
+
// State serialization (Plan 02-02)
|
|
22
|
+
export {
|
|
23
|
+
serializeState,
|
|
24
|
+
deserializeState,
|
|
25
|
+
extractState,
|
|
26
|
+
serializeStateWithWarning,
|
|
27
|
+
} from './hydration/index.js';
|
|
28
|
+
|
|
29
|
+
// Mismatch detection (Plan 02-03)
|
|
30
|
+
export {
|
|
31
|
+
detectMismatch,
|
|
32
|
+
reportMismatches,
|
|
33
|
+
formatPath,
|
|
34
|
+
} from './hydration/index.js';
|
|
35
|
+
|
|
36
|
+
// Legacy exports for backward compatibility
|
|
37
|
+
export {
|
|
38
|
+
hydrate as legacyHydrate,
|
|
39
|
+
hydrateAll,
|
|
40
|
+
hydrateBySelector,
|
|
41
|
+
enableClientEvents,
|
|
42
|
+
makeHydratable,
|
|
43
|
+
autoHydrate,
|
|
44
|
+
registerEventHandler,
|
|
45
|
+
} from './hydration.js';
|
|
46
|
+
|
|
47
|
+
// HMR client (Phase 4)
|
|
48
|
+
export {
|
|
49
|
+
HMRClient,
|
|
50
|
+
hmrClient,
|
|
51
|
+
ModuleTracker,
|
|
52
|
+
moduleTracker,
|
|
53
|
+
createHotContext,
|
|
54
|
+
CleanupTracker,
|
|
55
|
+
cleanupTracker,
|
|
56
|
+
StateCapturer,
|
|
57
|
+
stateCapturer,
|
|
58
|
+
ErrorOverlay,
|
|
59
|
+
errorOverlay,
|
|
60
|
+
ConnectionIndicator,
|
|
61
|
+
connectionIndicator,
|
|
62
|
+
} from './hmr/index.js';
|
package/types/hmr.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coherent.js Client Hydration Types
|
|
3
|
+
*
|
|
4
|
+
* Re-exports hydration-specific types from the main index.d.ts.
|
|
5
|
+
* This module provides types for server-to-client hydration APIs.
|
|
6
|
+
*
|
|
7
|
+
* @module @coherent.js/client/hydration
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
// Hydration options and results
|
|
12
|
+
HydrationOptions,
|
|
13
|
+
HydrationMismatch,
|
|
14
|
+
HydrationResult,
|
|
15
|
+
BatchHydrationResult,
|
|
16
|
+
HydrateControl,
|
|
17
|
+
HydratedInstance,
|
|
18
|
+
MakeHydratableOptions,
|
|
19
|
+
// State types
|
|
20
|
+
SerializableState,
|
|
21
|
+
SerializablePrimitive,
|
|
22
|
+
StateTransforms,
|
|
23
|
+
StateValidators,
|
|
24
|
+
// Event handlers
|
|
25
|
+
EventHandler,
|
|
26
|
+
ClickHandler,
|
|
27
|
+
KeyHandler,
|
|
28
|
+
FocusHandler,
|
|
29
|
+
SubmitHandler,
|
|
30
|
+
ChangeHandler,
|
|
31
|
+
InputHandler,
|
|
32
|
+
MouseHandler,
|
|
33
|
+
StateAwareHandler,
|
|
34
|
+
// Client component
|
|
35
|
+
ClientComponent,
|
|
36
|
+
ComponentFactory,
|
|
37
|
+
ComponentRegistryEntry,
|
|
38
|
+
// Event delegation
|
|
39
|
+
EventDelegation,
|
|
40
|
+
HandlerRegistry,
|
|
41
|
+
} from './index';
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
// Main hydration functions
|
|
45
|
+
hydrate,
|
|
46
|
+
legacyHydrate,
|
|
47
|
+
hydrateAll,
|
|
48
|
+
hydrateBySelector,
|
|
49
|
+
autoHydrate,
|
|
50
|
+
enableClientEvents,
|
|
51
|
+
makeHydratable,
|
|
52
|
+
registerEventHandler,
|
|
53
|
+
// State serialization
|
|
54
|
+
serializeState,
|
|
55
|
+
deserializeState,
|
|
56
|
+
extractState,
|
|
57
|
+
serializeStateWithWarning,
|
|
58
|
+
// Mismatch detection
|
|
59
|
+
detectMismatch,
|
|
60
|
+
reportMismatches,
|
|
61
|
+
formatPath,
|
|
62
|
+
// Event delegation
|
|
63
|
+
eventDelegation,
|
|
64
|
+
handlerRegistry,
|
|
65
|
+
wrapEvent,
|
|
66
|
+
} from './index';
|