frontend-hamroun 1.2.85 → 1.2.89
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/batch.d.ts +4 -0
- package/dist/batch.d.ts.map +1 -0
- package/dist/batch.js +22 -0
- package/dist/client-router.d.ts +61 -0
- package/dist/client-router.d.ts.map +1 -0
- package/dist/client-router.js +209 -0
- package/dist/component.d.ts +15 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +84 -0
- package/dist/components/Counter.d.ts +1 -0
- package/dist/components/Counter.d.ts.map +1 -0
- package/dist/components/Counter.js +2 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +23 -0
- package/dist/event-bus.d.ts +24 -0
- package/dist/event-bus.d.ts.map +1 -0
- package/dist/event-bus.js +74 -0
- package/dist/forms.d.ts +41 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +147 -0
- package/dist/hooks.d.ts +12 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +142 -0
- package/dist/index.cjs +1231 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.client.d.ts +13 -0
- package/dist/index.client.d.ts.map +1 -0
- package/dist/index.client.js +12 -25
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1153 -265
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +102 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +3 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +96 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts +5 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime/jsx-runtime.js +40 -0
- package/dist/jsx-runtime.cjs +112 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.ts +18 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +90 -79
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/lifecycle-events.d.ts +109 -0
- package/dist/lifecycle-events.d.ts.map +1 -0
- package/dist/lifecycle-events.js +176 -0
- package/dist/renderComponent.d.ts +14 -0
- package/dist/renderComponent.d.ts.map +1 -0
- package/dist/renderComponent.js +29 -0
- package/dist/renderer.d.ts +4 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +49 -0
- package/dist/router.d.ts +56 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +165 -0
- package/dist/server-renderer.d.ts +2 -0
- package/dist/server-renderer.d.ts.map +1 -0
- package/dist/server-renderer.js +111 -5
- package/dist/server-types.d.ts +43 -0
- package/dist/server-types.d.ts.map +1 -0
- package/dist/server-types.js +5 -0
- package/dist/store.d.ts +42 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +98 -0
- package/dist/types.d.ts +272 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +47 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +143 -0
- package/dist/vdom.d.ts +9 -0
- package/dist/vdom.d.ts.map +1 -0
- package/dist/vdom.js +21 -0
- package/dist/wasm.d.ts +37 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +158 -0
- package/package.json +54 -83
- package/dist/index.client.cjs +0 -2
- package/dist/index.client.cjs.map +0 -1
- package/dist/index.client.js.map +0 -1
- package/dist/renderer-DaVfBeVi.cjs +0 -2
- package/dist/renderer-DaVfBeVi.cjs.map +0 -1
- package/dist/renderer-nfT7XSpo.js +0 -61
- package/dist/renderer-nfT7XSpo.js.map +0 -1
- package/dist/server-renderer-B5b0Q0ck.cjs +0 -2
- package/dist/server-renderer-B5b0Q0ck.cjs.map +0 -1
- package/dist/server-renderer-C4MB-jAp.js +0 -248
- package/dist/server-renderer-C4MB-jAp.js.map +0 -1
- package/dist/server-renderer.cjs +0 -2
- package/dist/server-renderer.cjs.map +0 -1
- package/dist/server-renderer.js.map +0 -1
package/dist/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/vdom.ts","../src/component.ts","../src/wasm.ts","../src/index.ts"],"sourcesContent":["interface VNode {\r\n type: string | Function;\r\n props: Record<string, any>;\r\n key?: string | number;\r\n}\r\n\r\nfunction arePropsEqual(oldProps: any, newProps: any): boolean {\r\n const oldKeys = Object.keys(oldProps).filter(k => k !== 'children');\r\n const newKeys = Object.keys(newProps).filter(k => k !== 'children');\r\n \r\n if (oldKeys.length !== newKeys.length) return false;\r\n return oldKeys.every(key => oldProps[key] === newProps[key]);\r\n}\r\n\r\nexport function diff(oldNode: VNode | any, newNode: VNode | any): boolean {\r\n if (oldNode == null || newNode == null) return oldNode !== newNode;\r\n if (typeof oldNode !== typeof newNode) return true;\r\n if (typeof newNode === 'string' || typeof newNode === 'number')\r\n return oldNode !== newNode;\r\n if (newNode.type !== oldNode.type) return true;\r\n return !arePropsEqual(oldNode.props, newNode.props);\r\n}\r\n\r\nexport function shouldComponentUpdate(oldProps: any, newProps: any): boolean {\r\n return !arePropsEqual(oldProps, newProps);\r\n}\r\n","import { createElement } from './jsx-runtime.js';\r\n\r\nexport class Component {\r\n state: any = {};\r\n props: any;\r\n element: HTMLElement | null = null;\r\n private _mounted: boolean = false;\r\n\r\n constructor(props: any = {}) {\r\n this.props = props;\r\n }\r\n\r\n componentDidMount() {\r\n // Hook for after component is mounted\r\n }\r\n\r\n async setState(newState: any) {\r\n const prevState = { ...this.state };\r\n this.state = { ...prevState, ...newState };\r\n console.log(`${this.constructor.name} state updated:`, {\r\n prev: prevState,\r\n next: this.state\r\n });\r\n \r\n await Promise.resolve(); // Ensure state is updated before re-render\r\n if (this._mounted) {\r\n await this.update();\r\n } else {\r\n await this.update();\r\n }\r\n }\r\n\r\n private _replayEvents(oldElement: HTMLElement, newElement: HTMLElement) {\r\n const oldEvents = (oldElement as any).__events || {};\r\n Object.entries(oldEvents).forEach(([event, handler]) => {\r\n newElement.addEventListener(event as keyof HTMLElementEventMap, handler as EventListener);\r\n });\r\n (newElement as any).__events = oldEvents;\r\n }\r\n\r\n private _deepCloneWithEvents(node: HTMLElement): HTMLElement {\r\n const clone = node.cloneNode(false) as HTMLElement;\r\n \r\n // Copy events from original element\r\n const events = (node as any).__events || {};\r\n (clone as any).__events = events;\r\n Object.entries(events).forEach(([event, handler]) => {\r\n clone.addEventListener(event as keyof HTMLElementEventMap, handler as EventListener);\r\n });\r\n\r\n // Clone children\r\n Array.from(node.childNodes).forEach(child => {\r\n if (child instanceof HTMLElement) {\r\n clone.appendChild(this._deepCloneWithEvents(child));\r\n } else {\r\n clone.appendChild(child.cloneNode(true));\r\n }\r\n });\r\n\r\n return clone;\r\n }\r\n\r\n async update() {\r\n const vdom = this.render();\r\n if (!vdom) return document.createTextNode('');\r\n \r\n const rendered = await createElement(vdom);\r\n if (rendered instanceof HTMLElement) {\r\n return this._updateElement(rendered);\r\n }\r\n \r\n const wrapper = document.createElement('div');\r\n wrapper.appendChild(rendered);\r\n return this._updateElement(wrapper);\r\n }\r\n\r\n private async _updateElement(rendered: HTMLElement) {\r\n const newElement = this._deepCloneWithEvents(rendered);\r\n (newElement as any).__instance = this;\r\n \r\n if (!this.element) {\r\n this.element = newElement;\r\n if (!this._mounted) {\r\n this._mounted = true;\r\n queueMicrotask(() => this.componentDidMount());\r\n }\r\n } else if (this.element.parentNode) {\r\n this.element.parentNode.replaceChild(newElement, this.element);\r\n this.element = newElement;\r\n }\r\n \r\n return this.element;\r\n }\r\n\r\n render(): any {\r\n throw new Error('Component must implement render() method');\r\n }\r\n}\r\n","/**\r\n * Go WebAssembly Integration Utilities\r\n * \r\n * This module provides tools for loading and interacting with Go WASM modules\r\n * in browser and server environments.\r\n */\r\n\r\n// Type definitions for Go WASM integration\r\nexport interface GoWasmInstance {\r\n instance: WebAssembly.Instance;\r\n module: WebAssembly.Module;\r\n exports: any;\r\n functions: Record<string, Function>;\r\n}\r\n\r\nexport interface GoWasmOptions {\r\n importObject?: WebAssembly.Imports;\r\n goWasmPath?: string;\r\n loadGo?: boolean;\r\n onLoad?: (instance: GoWasmInstance) => void;\r\n debug?: boolean;\r\n}\r\n\r\nconst DEFAULT_GO_WASM_PATH = '/wasm_exec.js';\r\n\r\n/**\r\n * Load a Go WASM module from a URL\r\n */\r\nexport async function loadGoWasm(\r\n wasmUrl: string, \r\n options: GoWasmOptions = {}\r\n): Promise<GoWasmInstance> {\r\n const {\r\n importObject = {},\r\n goWasmPath = DEFAULT_GO_WASM_PATH,\r\n loadGo = true,\r\n onLoad,\r\n debug = false\r\n } = options;\r\n\r\n // In browser environment, load the Go WASM runtime\r\n if (typeof window !== 'undefined' && loadGo) {\r\n await loadGoRuntime(goWasmPath);\r\n }\r\n\r\n try {\r\n // Create Go instance for WASM\r\n // @ts-ignore - Go is loaded from the global scope\r\n const go = typeof Go !== 'undefined' ? new Go() : null;\r\n \r\n // Fetch and instantiate the WASM module\r\n if (debug) console.log(`[WASM] Loading module from ${wasmUrl}`);\r\n \r\n const response = await fetch(wasmUrl);\r\n \r\n if (!response.ok) {\r\n throw new Error(`Failed to fetch WASM module: ${response.statusText}`);\r\n }\r\n \r\n const buffer = await response.arrayBuffer();\r\n const module = await WebAssembly.compile(buffer);\r\n \r\n // Create imports object, combining Go runtime with custom imports\r\n const finalImportObject = go ? {\r\n ...go.importObject,\r\n ...importObject\r\n } : importObject;\r\n \r\n // Instantiate the WASM module\r\n const instance = await WebAssembly.instantiate(module, finalImportObject);\r\n \r\n // Initialize Go runtime if available\r\n if (go) {\r\n go.run(instance);\r\n }\r\n \r\n // Extract exported functions\r\n const exports = instance.exports;\r\n const functions: Record<string, Function> = {};\r\n \r\n // Generate wrapper functions for all exports that are functions\r\n for (const key in exports) {\r\n if (typeof exports[key] === 'function') {\r\n // Type assertion to ensure the exports[key] is callable\r\n const exportedFn = exports[key] as unknown as Function;\r\n functions[key] = (...args: any[]) => exportedFn(...args);\r\n \r\n if (debug) {\r\n const originalFn = functions[key];\r\n functions[key] = (...args: any[]) => {\r\n console.log(`[WASM] Calling ${key}(${args.join(', ')})`);\r\n const result = originalFn(...args);\r\n console.log(`[WASM] ${key} returned:`, result);\r\n return result;\r\n };\r\n }\r\n }\r\n }\r\n\r\n // Add any globally exported functions from Go\r\n if (typeof window !== 'undefined') {\r\n for (const key in window) {\r\n if (key.startsWith('go') && typeof (window as any)[key] === 'function') {\r\n // Type assertion to ensure the window[key] is callable\r\n const globalFn = (window as any)[key] as Function;\r\n functions[key] = (...args: any[]) => globalFn(...args);\r\n \r\n if (debug) {\r\n const originalFn = functions[key];\r\n functions[key] = (...args: any[]) => {\r\n console.log(`[WASM] Calling global ${key}(${args.join(', ')})`);\r\n const result = originalFn(...args);\r\n console.log(`[WASM] ${key} returned:`, result);\r\n return result;\r\n };\r\n }\r\n }\r\n }\r\n }\r\n \r\n const wasmInstance: GoWasmInstance = {\r\n instance,\r\n module,\r\n exports,\r\n functions\r\n };\r\n \r\n // Run onLoad callback if provided\r\n if (onLoad) {\r\n onLoad(wasmInstance);\r\n }\r\n \r\n return wasmInstance;\r\n } catch (error) {\r\n console.error('[WASM] Failed to load Go WASM module:', error);\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * Load the Go WASM runtime script\r\n */\r\nasync function loadGoRuntime(path: string = DEFAULT_GO_WASM_PATH): Promise<void> {\r\n if (typeof window === 'undefined') return;\r\n \r\n // Check if Go runtime is already loaded\r\n if (typeof (window as any).Go !== 'undefined') {\r\n return;\r\n }\r\n \r\n // Load the Go WASM runtime script\r\n return new Promise((resolve, reject) => {\r\n const script = document.createElement('script');\r\n script.src = path;\r\n script.onload = () => resolve();\r\n script.onerror = () => reject(new Error(`Failed to load Go WASM runtime from ${path}`));\r\n document.head.appendChild(script);\r\n });\r\n}\r\n\r\n/**\r\n * Create a TypeScript-friendly wrapper for Go WASM functions\r\n */\r\nexport function createTypedWasmFunction<T extends (...args: any[]) => any>(\r\n instance: GoWasmInstance,\r\n functionName: string\r\n): T {\r\n if (!instance.functions[functionName]) {\r\n throw new Error(`WASM function \"${functionName}\" not found`);\r\n }\r\n \r\n return instance.functions[functionName] as T;\r\n}\r\n\r\n/**\r\n * Helper to convert JavaScript values to Go-compatible formats\r\n */\r\nexport const goValues = {\r\n // Convert JS string to Go string (returns memory pointer)\r\n stringToGo: (instance: GoWasmInstance, str: string): number => {\r\n if (!instance.functions.__stringToGo) {\r\n throw new Error('__stringToGo function not found in WASM module');\r\n }\r\n return instance.functions.__stringToGo(str);\r\n },\r\n \r\n // Convert Go string (memory pointer) to JS string\r\n stringFromGo: (instance: GoWasmInstance, ptr: number): string => {\r\n if (!instance.functions.__stringFromGo) {\r\n throw new Error('__stringFromGo function not found in WASM module');\r\n }\r\n return instance.functions.__stringFromGo(ptr);\r\n },\r\n \r\n // Convert JS object to Go (returns memory pointer)\r\n objectToGo: (instance: GoWasmInstance, obj: any): number => {\r\n if (!instance.functions.__objectToGo) {\r\n throw new Error('__objectToGo function not found in WASM module');\r\n }\r\n return instance.functions.__objectToGo(JSON.stringify(obj));\r\n },\r\n \r\n // Convert Go object (memory pointer) to JS object\r\n objectFromGo: (instance: GoWasmInstance, ptr: number): any => {\r\n if (!instance.functions.__objectFromGo) {\r\n throw new Error('__objectFromGo function not found in WASM module');\r\n }\r\n const str = instance.functions.__objectFromGo(ptr);\r\n return JSON.parse(str);\r\n }\r\n};\r\n","// Core JSX and rendering functions\r\nexport { jsx, jsxs, jsxDEV, Fragment, createElement } from './jsx-runtime.js';\r\nexport { render, hydrate } from './renderer.js';\r\n\r\n// React-like hooks\r\nexport { \r\n useState, \r\n useEffect,\r\n useMemo, \r\n useRef, \r\n useContext,\r\n useErrorBoundary\r\n} from './hooks.js';\r\n\r\n// Context API\r\nexport { createContext } from './context.js';\r\n\r\n// Server-side rendering\r\nexport { renderToString } from './server-renderer.js';\r\n\r\n// Batch updates utility\r\nexport { batchUpdates } from './batch.js';\r\n\r\n// VDOM utilities\r\nexport { diff, shouldComponentUpdate } from './vdom.js';\r\n\r\n// Component class\r\nexport { Component } from './component.js';\r\n\r\n// WASM functionality\r\nexport { \r\n loadGoWasm, \r\n createTypedWasmFunction, \r\n goValues \r\n} from './wasm.js';\r\n\r\n// Import everything for the default export object\r\nimport { jsx, jsxs, jsxDEV, Fragment, createElement } from './jsx-runtime.js';\r\nimport { render, hydrate } from './renderer.js';\r\nimport { \r\n useState, \r\n useEffect,\r\n useMemo, \r\n useRef, \r\n useContext,\r\n useErrorBoundary\r\n} from './hooks.js';\r\nimport { createContext } from './context.js';\r\nimport { renderToString } from './server-renderer.js';\r\nimport { batchUpdates } from './batch.js';\r\nimport { diff, shouldComponentUpdate } from './vdom.js';\r\nimport { Component } from './component.js';\r\nimport { \r\n loadGoWasm, \r\n createTypedWasmFunction, \r\n goValues \r\n} from './wasm.js';\r\n\r\n// Type exports\r\nexport type { VNode, ComponentType, ReactElement, Key, Ref } from './types.js';\r\nexport type { Context } from './types.js';\r\nexport type { GoWasmInstance, GoWasmOptions } from './wasm.js';\r\nexport type { \r\n StateSetter, \r\n StateHook, \r\n EffectCallback, \r\n DependencyList, \r\n MemoFactory,\r\n RefObject,\r\n MutableRefObject \r\n} from './types.js';\r\n\r\n// Default export object for compatibility\r\nconst frontendHamroun = {\r\n // JSX\r\n jsx,\r\n jsxs: jsx,\r\n jsxDEV: jsx,\r\n Fragment,\r\n createElement,\r\n \r\n // Rendering\r\n render,\r\n hydrate,\r\n \r\n // Hooks\r\n useState,\r\n useEffect,\r\n useMemo,\r\n useRef,\r\n useContext,\r\n useErrorBoundary,\r\n \r\n // Context\r\n createContext,\r\n \r\n // Server rendering\r\n renderToString,\r\n \r\n // Utilities\r\n batchUpdates,\r\n diff,\r\n shouldComponentUpdate,\r\n \r\n // Component class\r\n Component,\r\n \r\n // WASM\r\n loadGoWasm,\r\n createTypedWasmFunction,\r\n goValues\r\n};\r\n\r\nexport default frontendHamroun;"],"names":["arePropsEqual","oldProps","newProps","oldKeys","Object","keys","filter","k","newKeys","length","every","key","diff","oldNode","newNode","type","props","shouldComponentUpdate","Component","constructor","this","state","element","_mounted","componentDidMount","setState","newState","prevState","console","log","name","prev","next","Promise","resolve","update","_replayEvents","oldElement","newElement","oldEvents","__events","entries","forEach","event","handler","addEventListener","_deepCloneWithEvents","node","clone","cloneNode","events","Array","from","childNodes","child","HTMLElement","appendChild","vdom","render","document","createTextNode","rendered","createElement","_updateElement","wrapper","__instance","parentNode","replaceChild","queueMicrotask","Error","DEFAULT_GO_WASM_PATH","async","loadGoWasm","wasmUrl","options","importObject","goWasmPath","loadGo","onLoad","debug","window","path","Go","reject","script","src","onload","onerror","head","loadGoRuntime","go","response","fetch","ok","statusText","buffer","arrayBuffer","module","WebAssembly","compile","finalImportObject","instance","instantiate","run","exports","functions","exportedFn","args","originalFn","join","result","startsWith","globalFn","wasmInstance","error","createTypedWasmFunction","functionName","goValues","stringToGo","str","__stringToGo","stringFromGo","ptr","__stringFromGo","objectToGo","obj","__objectToGo","JSON","stringify","objectFromGo","__objectFromGo","parse","frontendHamroun","jsx","jsxs","jsxDEV","Fragment","hydrate","useState","useEffect","useMemo","useRef","useContext","useErrorBoundary","createContext","renderToString","batchUpdates"],"mappings":"kOAMA,SAASA,EAAcC,EAAeC,GAC9B,MAAAC,EAAUC,OAAOC,KAAKJ,GAAUK,QAAOC,GAAW,aAANA,IAC5CC,EAAUJ,OAAOC,KAAKH,GAAUI,QAAOC,GAAW,aAANA,IAElD,OAAIJ,EAAQM,SAAWD,EAAQC,QACxBN,EAAQO,OAAaC,GAAAV,EAASU,KAAST,EAASS,IACzD,CAEgB,SAAAC,EAAKC,EAAsBC,GACzC,OAAe,MAAXD,GAA8B,MAAXC,EAAwBD,IAAYC,SAChDD,UAAmBC,IACP,iBAAZA,GAA2C,iBAAZA,EACjCD,IAAYC,EACjBA,EAAQC,OAAS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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export { useState, useEffect, useMemo, useRef, useErrorBoundary } from './hooks.js';
|
2
|
+
export { createContext, useContext } from './context.js';
|
3
|
+
export { batchUpdates } from './batch.js';
|
4
|
+
export { jsx, jsxs, Fragment } from './jsx-runtime.js';
|
5
|
+
export { render, hydrate } from './renderer.js';
|
6
|
+
export { renderToString } from './server-renderer.js';
|
7
|
+
export type { Context } from './types.js';
|
8
|
+
export type { VNode } from './types.js';
|
9
|
+
export type { Server, ServerConfig, User, DbConfig, MiddlewareFunction } from './server-types.js';
|
10
|
+
export declare const server: {
|
11
|
+
getServer(): Promise<never>;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=index.client.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,YAAY,EACV,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAG3B,eAAO,MAAM,MAAM;;CAIlB,CAAC"}
|
package/dist/index.client.js
CHANGED
@@ -1,26 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
export { useState, useEffect, useMemo, useRef, useErrorBoundary } from './hooks.js';
|
2
|
+
export { createContext, useContext } from './context.js';
|
3
|
+
export { batchUpdates } from './batch.js';
|
4
|
+
export { jsx, jsxs, Fragment } from './jsx-runtime.js';
|
5
|
+
export { render, hydrate } from './renderer.js';
|
6
|
+
export { renderToString } from './server-renderer.js';
|
7
|
+
// Provide placeholder server functionality
|
8
|
+
export const server = {
|
9
|
+
async getServer() {
|
10
|
+
throw new Error('Server module can only be used in Node.js environment');
|
11
|
+
}
|
8
12
|
};
|
9
|
-
|
10
|
-
Fragment,
|
11
|
-
b as batchUpdates,
|
12
|
-
c2 as createContext,
|
13
|
-
h as hydrate,
|
14
|
-
jsx,
|
15
|
-
jsx2 as jsxs,
|
16
|
-
r2 as render,
|
17
|
-
r as renderToString,
|
18
|
-
server,
|
19
|
-
u2 as useContext,
|
20
|
-
d as useEffect,
|
21
|
-
u as useErrorBoundary,
|
22
|
-
c as useMemo,
|
23
|
-
a as useRef,
|
24
|
-
e as useState
|
25
|
-
};
|
26
|
-
//# sourceMappingURL=index.client.js.map
|
13
|
+
let isHydrating = false;
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
export { jsx, jsxs, jsxDEV, Fragment, createElement } from './jsx-runtime.js';
|
2
|
+
export { render, hydrate } from './renderer.js';
|
3
|
+
export { renderToString } from './server-renderer.js';
|
4
|
+
export { useState, useEffect, useMemo, useRef, useContext, useErrorBoundary } from './hooks.js';
|
5
|
+
export { createContext } from './context.js';
|
6
|
+
export { batchUpdates } from './batch.js';
|
7
|
+
export { diff, shouldComponentUpdate } from './vdom.js';
|
8
|
+
export { Component } from './component.js';
|
9
|
+
export { RouterProvider, Route, Switch, Link, Redirect, useLocation, useParams, useNavigate } from './client-router.js';
|
10
|
+
export { useForm } from './forms.js';
|
11
|
+
export { createEventBus, useEvent, eventBus } from './event-bus.js';
|
12
|
+
export { createStore, StoreProvider, useSelector, useDispatch, useStore, logger, thunk } from './store.js';
|
13
|
+
export { LifecycleEvents, emitAppInit, emitAppMounted, emitAppUpdated, emitAppError, emitAppDestroyed, emitComponentCreated, emitComponentMounted, emitComponentUpdated, emitComponentError, emitComponentUnmounted, onAppInit, onAppMounted, onAppUpdated, onAppError, onAppDestroyed, onComponentCreated, onComponentMounted, onComponentUpdated, onComponentError, onComponentUnmounted } from './lifecycle-events.js';
|
14
|
+
import { jsx, createElement } from './jsx-runtime.js';
|
15
|
+
import { render, hydrate } from './renderer.js';
|
16
|
+
import { renderToString } from './server-renderer.js';
|
17
|
+
import { useState, useEffect, useMemo, useRef, useContext, useErrorBoundary } from './hooks.js';
|
18
|
+
import { createContext } from './context.js';
|
19
|
+
import { batchUpdates } from './batch.js';
|
20
|
+
import { diff, shouldComponentUpdate } from './vdom.js';
|
21
|
+
import { Component } from './component.js';
|
22
|
+
import { RouterProvider, Route, Switch, Link, Redirect, useLocation, useParams, useNavigate } from './client-router.js';
|
23
|
+
import { useForm } from './forms.js';
|
24
|
+
import { createEventBus, useEvent } from './event-bus.js';
|
25
|
+
export type { VNode, ComponentType, ReactElement, Key, Ref } from './types.js';
|
26
|
+
export type { Context } from './types.js';
|
27
|
+
export type { StateSetter, StateHook, EffectCallback, DependencyList, MemoFactory, RefObject, MutableRefObject } from './types.js';
|
28
|
+
export type { Route as RouteType, RouterState, NavigateOptions } from './client-router.js';
|
29
|
+
export type { FormField, FormState, FormOptions, FormConfig } from './forms.js';
|
30
|
+
export type { EventHandler, EventBus } from './event-bus.js';
|
31
|
+
export type { Action, Reducer, Selector, Dispatch, Middleware, Store, AsyncAction } from './store.js';
|
32
|
+
declare const frontendHamroun: {
|
33
|
+
jsx: typeof jsx;
|
34
|
+
jsxs: typeof jsx;
|
35
|
+
jsxDEV: typeof jsx;
|
36
|
+
Fragment: ({ children }: {
|
37
|
+
children: any;
|
38
|
+
}) => any;
|
39
|
+
createElement: typeof createElement;
|
40
|
+
render: typeof render;
|
41
|
+
hydrate: typeof hydrate;
|
42
|
+
renderToString: typeof renderToString;
|
43
|
+
useState: typeof useState;
|
44
|
+
useEffect: typeof useEffect;
|
45
|
+
useMemo: typeof useMemo;
|
46
|
+
useRef: typeof useRef;
|
47
|
+
useContext: typeof useContext;
|
48
|
+
useErrorBoundary: typeof useErrorBoundary;
|
49
|
+
createContext: typeof createContext;
|
50
|
+
batchUpdates: typeof batchUpdates;
|
51
|
+
diff: typeof diff;
|
52
|
+
shouldComponentUpdate: typeof shouldComponentUpdate;
|
53
|
+
Component: typeof Component;
|
54
|
+
RouterProvider: typeof RouterProvider;
|
55
|
+
Route: typeof Route;
|
56
|
+
Switch: typeof Switch;
|
57
|
+
Link: typeof Link;
|
58
|
+
Redirect: typeof Redirect;
|
59
|
+
useLocation: typeof useLocation;
|
60
|
+
useParams: typeof useParams;
|
61
|
+
useNavigate: typeof useNavigate;
|
62
|
+
useForm: typeof useForm;
|
63
|
+
createEventBus: typeof createEventBus;
|
64
|
+
useEvent: typeof useEvent;
|
65
|
+
eventBus: import("./event-bus.js").EventBus;
|
66
|
+
};
|
67
|
+
export default frontendHamroun;
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EACL,QAAQ,EACR,SAAS,EACT,OAA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