pawajs 1.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Allisboy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,354 @@
1
+ # pawajs
2
+ pawajs - power the web (reactivity and html runtime)
3
+
4
+ # PawaJS
5
+
6
+ **A lightweight and reactive JavaScript library for building modern web interfaces with a simple, declarative syntax.**
7
+
8
+ PawaJS is a JavaScript library designed for building dynamic user interfaces. It combines a component-based architecture and progressive enhancement with a powerful reactivity system no v-dom. Its intuitive, directive-based templating feels familiar and makes it easy to create interactive applications, from simple widgets to complex single-page apps. With built-in support for server-side rendering, PawaJS is equipped for performance and scalability.
9
+
10
+ ---
11
+
12
+ ## Features
13
+
14
+ - **Declarative Rendering:** Use a clean, HTML-based template syntax with powerful directives (`if`, `for`, `on-event`, etc.) to describe your UI.
15
+ - **Reactive State Management:** Effortlessly create reactive state that automatically updates the DOM when it changes using the `$state` utility.
16
+ - **Component-Based Architecture:** Build encapsulated components that manage their own state, making your code more reusable and maintainable.
17
+ - **Async Components:** First-class support for asynchronous components, allowing you to fetch data directly within your component definition.
18
+ - **Efficient List Rendering:** Render lists of data with the `for` directive, including support for keyed updates for optimal performance.
19
+ - **Lifecycle Hooks:** Tap into a component's lifecycle with `mount` and `unmount` directives, or the `runEffect` hook for more complex side effects.
20
+ - **Context API:** Pass data through the component tree without having to pass props down manually at every level.
21
+ - **Server-Side Rendering (SSR) Isomorphic architecture:** PawaJS is built with SSR in mind, featuring a "resuming" mechanism to efficiently continue server-rendered HTML on the client.
22
+ - **Plugin System:** Extend PawaJS's core functionality with custom directives and lifecycle behaviors.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ Install PawaJS into your project using npm:
29
+
30
+ ```bash
31
+ npm install pawajs
32
+ ```
33
+ CDN
34
+
35
+ ```html
36
+ <head>
37
+ <script type="module" href="https://cdn.jsdelivr.net/npm/pawajs@1.2.0/cdn/index.js"></script>
38
+ </head>
39
+ <body>
40
+ <div id="app"></div>
41
+ <script type="module">
42
+ window.$pawa.pawaStartApp(document.getElementById('app'));
43
+ </script>
44
+ </body>
45
+ ```
46
+
47
+ OR
48
+
49
+ Then, you can import it into your application: through npm
50
+
51
+ ```javascript
52
+ import { pawaStartApp, $state, RegisterComponent, html } from 'pawajs';
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Getting Started: A Simple Counter
58
+
59
+ Here's a basic example to show you how PawaJS works.
60
+
61
+ **`index.html`**
62
+ ```html
63
+ <!DOCTYPE html>
64
+ <html lang="en">
65
+ <head>
66
+ <title>PawaJS Counter</title>
67
+ </head>
68
+ <body>
69
+ <div id="app">
70
+ <h1 state-name="'PAWAJS'">@{name.value}</h1>
71
+ <!-- The component will be rendered here -->
72
+ <counter-app></counter-app>
73
+ </div>
74
+ <script type="module" src="app.js"></script>
75
+ </body>
76
+ </html>
77
+ ```
78
+
79
+ **`app.js`**
80
+ ```javascript
81
+ import { pawaStartApp, $state, useInsert, RegisterComponent, html } from './pawajs/index.js';
82
+
83
+ // 1. Define a component
84
+ const CounterApp = () => {
85
+ // 2. Create reactive state
86
+ const count = $state(0);
87
+
88
+ // 3. Define methods to modify the state
89
+ const increment = () => {
90
+ count.value++;
91
+ };
92
+ const decrement = () => {
93
+ count.value--;
94
+ };
95
+
96
+ // 4. Expose state and methods to the template
97
+ useInsert({ count, increment, decrement });
98
+
99
+ // 5. Return the component's template
100
+ return html`
101
+ <div>
102
+ <h1>PawaJS Counter</h1>
103
+ <p>Current count: <strong>@{count.value}</strong></p>
104
+ <button on-click="increment()">Increment +</button>
105
+ <button on-click="decrement()">Decrement -</button>
106
+ </div>
107
+ `;
108
+ }
109
+
110
+ // 6. Register the component
111
+ // PawaJS converts PascalCase component names to kebab-case for use in HTML.
112
+ RegisterComponent(CounterApp);
113
+
114
+ // 7. Start the PawaJS application
115
+ const appElement = document.getElementById('app');
116
+ pawaStartApp(appElement);
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Core Concepts
122
+
123
+ ### State Management with `$state`
124
+
125
+ The `$state` function is the heart of PawaJS's reactivity. It creates a reactive object whose `value` property can be read and written to. Any changes to `.value` will automatically trigger updates in the parts of your application that depend on it (fine-granded) no component re-rendering or diffing. `$state` can be global when used outside a component. Also inline state in the html or template `state-*="any js types"`
126
+
127
+ ```html
128
+ <!--- number-->
129
+ <div state-count="0">@{count.value}<div>
130
+ <!--- string-->
131
+ <div state-name="'PAWAJS'">@{name.value}<div>
132
+ <!--- object-->
133
+ <div state-object="{name:'pawajs'}">@{object.value.name}<div>
134
+ <!--- boolean-->
135
+ <div state-login="false">@{login.value? 'Welcome back!':'Please login'}<div>
136
+ <!--- array-->
137
+ <span state-splitname="['P','A','W','A','J','S']" for="item in splitname.value">@{item}<div>
138
+ ```
139
+
140
+ ```javascript
141
+ // Create a simple state
142
+ const name = $state('Pawa');
143
+ console.log(name.value); // "Pawa"
144
+ name.value = 'PawaJS'; // The UI will update automatically
145
+
146
+ // State can hold any data type
147
+ const user = $state({ name: 'Alex', loggedIn: false });
148
+ user.value.loggedIn = true; // This is also reactive
149
+
150
+ // Persist state to localStorage
151
+ // The state will be saved under the key 'session' and reloaded on page refresh.
152
+ const session = $state({ id: null }, 'session');
153
+
154
+ // Compute state - must be used inside a component
155
+ // when ever count changes the state update
156
+ const doubleCount=$state(()=>count.value * 2,[count])
157
+
158
+ //AutoCompute
159
+ // Any function that uses any reactive state for reactive bindings or direcives becomes computed function
160
+ const doubleCount=()=>count.value * 2
161
+ ```
162
+
163
+ ### Components
164
+
165
+ Components are the building blocks of your application. In PawaJS, a component is a JavaScript function that returns an HTML template string or not.
166
+
167
+ - **Defining:** Create a function that returns a template or not.
168
+ - **Registering:** Use `RegisterComponent(MyComponent)` to make it available globally. In HTML, you can then use it as `<my-component>`.
169
+ - **`useInsert`:** To make variables, state, and functions from your component's setup available in its template, pass them in an object to `useInsert()`.
170
+
171
+ ### Asynchronous Components
172
+
173
+ PawaJS supports async components ( `useAsync()` hook) out of the box. You can define a component as an `async` function, allowing you to perform asynchronous operations (like fetching data) before the component renders.
174
+ wrap any pawajs hook with $async after any await call
175
+
176
+ ```javascript
177
+ const UserProfile = async () => {
178
+ // Async hook store the current component instance for $async to use
179
+ const {$async}=useAsync()
180
+ // The component will wait for this promise to resolve before rendering
181
+ const data = await fetch('/api/user').then(res => res.json());
182
+ const user = $async(()=>$state(data);)
183
+ $async(()=>useInsert({user}))
184
+
185
+ return html`
186
+ <div class="profile">
187
+ <h1>@{user.value.name}</h1>
188
+ </div>
189
+ `;
190
+ }
191
+ ```
192
+
193
+ ### Templating
194
+
195
+ PawaJS uses a simple `@{...}` syntax to embed dynamic JavaScript expressions directly into your HTML.
196
+
197
+ ```html
198
+ <!-- Bind to text content -->
199
+ <p>@{user.name}</p>
200
+
201
+ <!-- Bind to attributes -->
202
+ <div class="user-card @{user.value.isActive ? 'active' : 'inactive'}">
203
+ <input value="@{user.value.name}" on-input="user.value.name = e.target.value">
204
+ </div>
205
+ ```
206
+
207
+ ### Directives
208
+
209
+ Directives are special attributes that apply reactive behavior to DOM elements.
210
+
211
+ #### `state-*`
212
+ create inline state for the element and children
213
+
214
+ ```html
215
+ <div state-count="0">
216
+ <button on-click="count.value++">@{count.value}</button>
217
+ </div>
218
+
219
+ ```
220
+
221
+
222
+ #### `if` / `else` / `else-if`
223
+ For conditional rendering.
224
+
225
+ ```html
226
+ <div if="user.value.loggedIn">
227
+ Welcome back, @{user.name.value}!
228
+ </div>
229
+ <div else-if="user.value.isGuest">
230
+ You are browsing as a guest.
231
+ </div>
232
+ <div else>
233
+ Please log in to continue.
234
+ </div>
235
+ ```
236
+ #### `switch` / `case` / `default`
237
+ switch conditional rendering.
238
+
239
+ ```html
240
+ <div switch="user.value.type" case="'admin'">
241
+ Welcome back, @{user.name.value}!
242
+ </div>
243
+ <div case="'guest">
244
+ You are browsing as a guest.
245
+ </div>
246
+ <div default>
247
+ Please log in to continue.
248
+ </div>
249
+ ```
250
+ #### `key`
251
+ re-renders the element/component when the reactivity changes
252
+
253
+ ```html
254
+ <user-component key="user.value.type"></user-component>
255
+
256
+ ```
257
+
258
+ #### `is-exit`
259
+ makes pawajs engine to wait before removing the element until the animation/transition is done.
260
+
261
+ ```html
262
+ <div if="user.value.loggedIn" class="user-card @{user.value.isActive ? 'active' : 'inactive'}" is-exit>
263
+ <input value="@{user.value.name}" on-input="user.value.value = e.target.value">
264
+ </div>
265
+ ```
266
+ #### `for`
267
+ For rendering lists from an array. Use `for-key` to give each element a unique identity, which helps PawaJS optimize rendering.
268
+
269
+ ```html
270
+ <ul>
271
+ <li for="todo, i in todos.value" for-key="{{todo.id}}">
272
+ <span>@{i + 1}. @{todo.text}</span>
273
+ </li>
274
+ </ul>
275
+ ```
276
+
277
+ #### `on-<event>`
278
+ For handling DOM events.
279
+
280
+ ```html
281
+ <button on-click="addTodo()">Add Todo</button>
282
+ <input on-input="newTodoText.value = e.target.value" />
283
+ ```
284
+
285
+ ### Component Props
286
+
287
+ You can pass data from a parent component to a child component using props. To declare a prop, prefix the attribute with a colon (`:`).
288
+ Children are passed by default in pawajs, they are not functional prop.
289
+ For rest props pass `--` to the element that needs the attributes.
290
+ **Parent Component (`app.js`)**
291
+ ```javascript
292
+ // ...
293
+ const message = $state('This is a message from the parent!');
294
+ useInsert({ message });
295
+
296
+ return html`
297
+ <todo-list :title="'My Todo List'" :message="message.value" class="to the rest prop">Children in here</todo-list>
298
+ `;
299
+ ```
300
+
301
+ **Child Component (`todo-list.js`)**
302
+ ```javascript
303
+ export const TodoList = ({ title, message,children }) => {
304
+ // Props are passed as functions that return the reactive value
305
+ useInsert({ title, message });
306
+
307
+ return html`
308
+ <div -->
309
+ <h2>@{title()}</h2>
310
+ <p>@{message()}</p>
311
+ ${children}
312
+ </div>
313
+ `;
314
+ }
315
+
316
+ // You can also validate props
317
+ useValidateComponent(TodoList, {
318
+ title: {
319
+ type: String,
320
+ strict: true // This prop is required
321
+ },
322
+ message: {
323
+ type: String,
324
+ default: 'Default message'
325
+ }
326
+ });
327
+ ```
328
+
329
+ ---
330
+
331
+ ## API Reference
332
+
333
+ ### Core Functions
334
+ - `pawaStartApp(rootElement, initialContext)`: Initializes the PawaJS application on a given root DOM element.
335
+ - `RegisterComponent(...components)`: Registers one or more components to be used in templates.
336
+ - `$state(initialValue, localStorageKey?)`: Creates a new reactive state object.
337
+ - `html`: A tagged template literal for syntax highlighting and potential future optimizations.
338
+
339
+ ### Component Hooks
340
+ - `useInsert(object)`: Exposes data and functions from a component's setup to its template.
341
+ - `runEffect(callback, dependencies?)`: Runs a side effect after or before the component renders, and re-runs it when its dependencies change .
342
+ - `useContext(contextObject)` & `setContext()`: A mechanism for providing and consuming data throughout a component tree.
343
+ - `useRef()`: Creates a reference object that can be attached to a DOM element using the `ref` directive.
344
+ - `useValidateComponent(Component, rules)`: Defines validation rules for a component's props.
345
+
346
+ ---
347
+
348
+ ## Contributing
349
+
350
+ Contributions are welcome! If you have a feature request, bug report, or want to contribute to the code, please feel free to open an issue or pull request on the GitHub repository.
351
+
352
+ ## License
353
+
354
+ This project is licensed under the MIT License.
package/cdn/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import Pawa from '../index.js'
2
+
3
+ // this is for cdn file
4
+
5
+ window.$pawa=Pawa
package/index.d.ts ADDED
@@ -0,0 +1,291 @@
1
+ export interface PawaElement extends HTMLElement {
2
+ _running: boolean;
3
+ _context: any;
4
+ _staticContext: any[];
5
+ _resetEffects: Set<Function>;
6
+ _avoidPawaRender: boolean;
7
+ _el: HTMLElement;
8
+ _out: boolean;
9
+ _terminateEffects: Set<Function>;
10
+ _deleteEffects: () => void;
11
+ _slots: DocumentFragment;
12
+ _mainAttribute: Record<string, any>;
13
+ _preRenderAvoid: string[];
14
+ _lazy: boolean;
15
+ _await: boolean;
16
+ _hasForOrIf: () => boolean;
17
+ _elementContent: string | null;
18
+ _textContent: Record<string, string>;
19
+ _attributes: ({ name: string; value: string } | Attr)[];
20
+ _template: string;
21
+ _exitAnimation: (() => Promise<void>) | null;
22
+ _component: any;
23
+ _unMountFunctions: Function[];
24
+ _MountFunctions: Function[];
25
+ _elementType: string;
26
+ _getNode: () => Element | null;
27
+ _componentOrTemplate: boolean;
28
+ _props: Record<string, any>;
29
+ _isView: any;
30
+ _isElementComponent: boolean;
31
+ _pawaAttribute: Record<string, string>;
32
+ _setUnMount: (func: Function) => void;
33
+ _componentName: string;
34
+ _attrElement: (attrName: string) => HTMLElement;
35
+ _attr: Record<string, string>;
36
+ _checkStatic: () => void;
37
+ _callMount: () => void;
38
+ _callUnMOunt: () => Promise<void>;
39
+ _remove: (callback?: Function) => Promise<any>;
40
+ _componentChildren: string;
41
+ _pawaElementComponent: any;
42
+ _componentTerminate: Function | null;
43
+ _cacheSetUp: boolean;
44
+ _effectsCache: HTMLElement | null;
45
+ _effectsCarrier: any;
46
+ _pawaElementComponentName: string;
47
+ _reCallEffect: () => void;
48
+ _ElementEffects: Map<any, any>;
49
+ _deCompositionElement: boolean;
50
+ _restProps: Record<string, any>;
51
+ _kill: Function | null;
52
+ _isKill: boolean;
53
+ _scriptFetching: boolean;
54
+ _scriptDone: boolean;
55
+ _underControl: any;
56
+ _reactiveProps: Record<string, any>;
57
+ getChildrenTree(): Element[];
58
+ reCallEffect(): void;
59
+ setPawaAttr(): void;
60
+ findPawaAttribute(): void;
61
+ setUnMounts(func: Function): void;
62
+ isPawaElementComponent(): void;
63
+ getNode(): Element | null;
64
+ terminateEffects(): void;
65
+ getNewElementByRemovingAttr(attrName: string): HTMLElement;
66
+ setAttri(): void;
67
+ hasForOrIf(): boolean;
68
+ cache(): void;
69
+ effectsCache(): HTMLElement | null;
70
+ reCheckStaticContext(): void;
71
+ remove(callback?: Function): Promise<any>;
72
+ unMount(): Promise<void>;
73
+ mount(): void;
74
+ elementType(): void;
75
+ setProps(): void;
76
+ }
77
+
78
+ export interface AttriPlugin {
79
+ startsWith?: string;
80
+ fullName?: string;
81
+ mode?: null | 'client' | 'server';
82
+ dependency?: string[];
83
+ plugin: (el: HTMLElement | PawaElement, attr: { name: string; value: string }, stateContext?: any, notRender?: any, stopResume?: any) => void;
84
+ }
85
+
86
+ export interface PluginObject {
87
+ attribute?: {
88
+ register: AttriPlugin[];
89
+ };
90
+ component?: {
91
+ beforeCall?: (stateContext: any, app: any) => void;
92
+ afterCall?: (stateContext: any, el: HTMLElement) => void;
93
+ };
94
+ renderSystem?: {
95
+ beforePawa?: (el: HTMLElement, context: any) => void;
96
+ afterPawa?: (el: PawaElement) => void;
97
+ beforeChildRender?: (el: PawaElement) => void;
98
+ };
99
+ }
100
+
101
+ export type StateInput<T> = T | (() => T) | (() => Promise<T>);
102
+
103
+ export interface State<T> {
104
+ value: T;
105
+ readonly id: string;
106
+ async?: boolean;
107
+ failed?: boolean;
108
+ retry?: () => void;
109
+ }
110
+
111
+ export function setErrorCALLER(callback: (message: any) => void): void;
112
+
113
+ export function pluginsMap(): {
114
+ compoAfterCall: Set<Function>;
115
+ compoBeforeCall: Set<Function>;
116
+ renderAfterPawa: Set<Function>;
117
+ renderBeforePawa: Set<Function>;
118
+ renderBeforeChild: Set<Function>;
119
+ startsWithSet: Set<string>;
120
+ fullNamePlugin: Set<string>;
121
+ externalPlugin: Record<string, Function>;
122
+ externalPluginMap: Map<string, string[]>;
123
+ };
124
+
125
+ export const escapePawaAttribute: Set<string>;
126
+ export const dependentPawaAttribute: Set<string>;
127
+
128
+ /**
129
+ * Removes a plugin by name.
130
+ * @param {...string} pluginName - Names of plugins to remove.
131
+ */
132
+ export function removePlugin(...pluginName: string[]): void;
133
+
134
+ /**
135
+ * Registers plugins to extend PawaJS capabilities.
136
+ * @param {...(() => PluginObject)} func - Functions returning plugin definitions.
137
+ */
138
+ export function PluginSystem(...func: (() => PluginObject)[]): void;
139
+
140
+ export function keepContext(context: any): void;
141
+
142
+ export const components: Map<string, Function>;
143
+
144
+ export function getCurrentContext(): any;
145
+
146
+ export function setPawaAttributes(...attr: string[]): void;
147
+
148
+ export function getDependentAttribute(): Set<string>;
149
+
150
+ export function getPawaAttributes(): Set<string>;
151
+
152
+ export function setError(params: { error: any }): void;
153
+
154
+ /**
155
+ * Registers components for use in templates.
156
+ * @param {...(string | Function)} args - Component functions or (name, function - done by pawajs-vite-plugin automaticly) pairs.
157
+ */
158
+ export function RegisterComponent(...args: (string | Function)[]): void;
159
+
160
+ /**
161
+ * Runs a side effect or lifecycle hook.
162
+ * @param {() => void | (() => void)} callback - Effect function, optionally returning cleanup.
163
+ * @param {any[] | object | number | null} [deps] - Dependencies or hook type (null=mount).
164
+ */
165
+ export function runEffect(callback: () => void | (() => void), deps?: any[] | object | number | null): void;
166
+
167
+ export interface PropValidation {
168
+ strict?: boolean;
169
+ err?: string;
170
+ default?: any;
171
+ type?: Function | Function[];
172
+ }
173
+
174
+ export function useValidateComponent(component: Function, object: Record<string, PropValidation>): void;
175
+
176
+ export interface ContextHandle<T = any> {
177
+ id: string;
178
+ setValue: (val?: T) => void;
179
+ }
180
+
181
+ /**
182
+ * Creates a context provider handle.
183
+ * @template T
184
+ * @returns {ContextHandle<T>} Handle to set context values.
185
+ */
186
+ export function setContext<T = any>(): ContextHandle<T>;
187
+
188
+ /**
189
+ * Consumes a context value.
190
+ * @template T
191
+ * @param {ContextHandle<T>} context - The context handle.
192
+ * @returns {T} The context value.
193
+ */
194
+ export function useContext<T = any>(context: ContextHandle<T>): T;
195
+
196
+ /**
197
+ * Gets the context from the parent Element
198
+ * @template T
199
+ * @returns {T}
200
+ */
201
+ export function useInnerContext<T=any>(): T;
202
+
203
+ /**
204
+ * Tells pawa-ssr to serialize the children prop.
205
+ * Then pawajs adds it into the component unpon re-execution
206
+ * @returns {()=>void}
207
+ */
208
+ export function accessChild(): (()=>void);
209
+ /**
210
+ * Tells pawa-ssr to serialized data from useInsert.
211
+ * Then pawajs continuity model de-serializes it and adds to the rendering context
212
+ * @returns {void}
213
+ * Note: meant for server-only component
214
+ */
215
+ export function useServer(): (() => void) | undefined;
216
+
217
+ /**
218
+ * Stores the component instance into the returned $async hook.
219
+ * Used in async component.
220
+ * Must be called before any await call
221
+ */
222
+ export function useAsync(): { $async: <T>(callback: () => T) => T };
223
+
224
+ /**
225
+ * Returns TRUE when pawajs is in continous rendering mode from ssr
226
+ */
227
+ export function isResume(): boolean;
228
+
229
+ /**
230
+ * Exposes variables to the template scope.
231
+ * @param {Record<string, any>} [obj] - Variables to expose.
232
+ */
233
+ export function useInsert(obj?: Record<string, any>): void;
234
+
235
+ export function setStateContext(context: any): any;
236
+
237
+ /**
238
+ * Creates a reactive state.
239
+ * @template T
240
+ * @param {StateInput<T>} initialValue - Initial value or generator function.
241
+ * @param {string | null | string[]} [section] - Persistence key or dependency array.
242
+ * @returns {State<T>} Reactive state object.
243
+ */
244
+ export function $state<T>(initialValue: StateInput<T>, section?: string | null | string[]): State<T>;
245
+
246
+ export function restoreContext(state_context: any): void;
247
+
248
+ /**
249
+ * Creates a reference object.
250
+ * @template T
251
+ * @returns {{ value: T | null }} Ref object.
252
+ */
253
+ export function useRef<T = any>(): { value: T | null };
254
+
255
+ /**
256
+ * Renders a component or element.
257
+ * @param {HTMLElement} el - Target element.
258
+ * @param {object} [contexts] - Context.
259
+ * @param {any} [notRender] - Internal.
260
+ * @param {boolean} [isName] - Internal.
261
+ */
262
+ export function render(el: HTMLElement, contexts?: object, notRender?: any, isName?: boolean): void;
263
+
264
+ /**
265
+ * Initializes and starts the Pawa application.
266
+ * @param {HTMLElement} app - Root element.
267
+ * @param {Record<string, any>} [context] - Initial context.
268
+ */
269
+ export function pawaStartApp(app: HTMLElement, context?: Record<string, any>): void;
270
+
271
+ /**
272
+ * Tagged template literal for HTML strings. Enables syntax highlighting in compatible editors.
273
+ * @param {TemplateStringsArray} strings
274
+ * @param {...any} values
275
+ */
276
+ export function html(strings: TemplateStringsArray, ...values: any[]): string;
277
+
278
+ declare const Pawa: {
279
+ useInsert: typeof useInsert;
280
+ useContext: typeof useContext;
281
+ useValidateComponent: typeof useValidateComponent;
282
+ setPawaAttributes: typeof setPawaAttributes;
283
+ setContext: typeof setContext;
284
+ $state: typeof $state;
285
+ pawaStartApp: typeof pawaStartApp;
286
+ RegisterComponent: typeof RegisterComponent;
287
+ runEffect: typeof runEffect;
288
+ html: typeof html;
289
+ };
290
+
291
+ export default Pawa;