@deijose/nix-js 2.5.3 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deijose/nix-js",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "description": "A lightweight, fully reactive micro-framework — no virtual DOM, no compiler, just signals and tagged templates.",
5
5
  "license": "MIT",
6
6
  "author": "Deiver Vasquez",
@@ -1,116 +0,0 @@
1
- import type { NixComponent } from "./lifecycle";
2
- export interface NixTemplate {
3
- readonly __isNixTemplate: true;
4
- /** Mounts the template into a container element (public / root API). */
5
- mount(container: Element | string): NixMountHandle;
6
- /** @internal Renders before `before` node (or appends to `parent`). Returns cleanup. */
7
- _render(parent: Node, before: Node | null): () => void;
8
- }
9
- export interface NixMountHandle {
10
- unmount(): void;
11
- }
12
- /** Direct reference to a DOM element, assigned on mount and cleared on unmount. */
13
- export interface NixRef<T extends Element = Element> {
14
- el: T | null;
15
- }
16
- /** Creates an empty `NixRef`. Use as `ref` attribute value in templates. */
17
- export declare function ref<T extends Element = Element>(): NixRef<T>;
18
- /** Toggles element visibility via `display: none` without unmounting. */
19
- export declare function showWhen(el: HTMLElement, condition: boolean): void;
20
- /** Keyed list result for efficient DOM diffing via `repeat()`. */
21
- export interface KeyedList<T = unknown> {
22
- readonly __isKeyedList: true;
23
- readonly items: T[];
24
- readonly keyFn: (item: T, index: number) => string | number;
25
- readonly renderFn: (item: T, index: number) => NixTemplate | NixComponent;
26
- }
27
- /**
28
- * Creates a keyed list for efficient DOM reconciliation.
29
- * Use instead of `.map()` when the list changes frequently.
30
- */
31
- export declare function repeat<T>(items: T[], keyFn: (item: T, index: number) => string | number, renderFn: (item: T, index: number) => NixTemplate | NixComponent): KeyedList<T>;
32
- /**
33
- * Renders `content` into `target` instead of the current tree position.
34
- * Useful for modals, tooltips, and overlays that must escape overflow clipping.
35
- * Returns a NixTemplate — works inside reactive conditionals.
36
- *
37
- * @param content Template or component to render.
38
- * @param target CSS selector, Element, PortalOutlet, or NixRef. Defaults to `document.body`.
39
- */
40
- /** Opaque token for a named portal target. */
41
- export interface PortalOutlet {
42
- readonly __isPortalOutlet: true;
43
- /** @internal */
44
- _container: Element | null;
45
- }
46
- /** Creates a PortalOutlet token for decoupled portal targeting. */
47
- export declare function createPortalOutlet(): PortalOutlet;
48
- /** Declares the DOM anchor for a PortalOutlet inside a template. */
49
- export declare function portalOutlet(outlet: PortalOutlet): NixTemplate;
50
- export declare function portal(content: NixTemplate | NixComponent, target?: Element | string | PortalOutlet | NixRef<Element>): NixTemplate;
51
- /** Provides a PortalOutlet to descendant components via dependency injection. */
52
- export declare function provideOutlet(outlet: PortalOutlet): void;
53
- /** Injects the nearest PortalOutlet provided by an ancestor. */
54
- export declare function injectOutlet(): PortalOutlet | undefined;
55
- /** Fallback: a static template/component, or a factory receiving the error. */
56
- export type ErrorFallback = NixTemplate | NixComponent | ((err: unknown) => NixTemplate | NixComponent);
57
- /**
58
- * Wraps `content` in an error boundary. If rendering or a reactive update
59
- * throws, the boundary tears down the broken subtree and renders `fallback`.
60
- */
61
- export declare function createErrorBoundary(content: NixTemplate | NixComponent, fallback: ErrorFallback): NixTemplate;
62
- /**
63
- * Options for `transition()`. All class-name overrides are optional — by
64
- * default they are derived from `name` (default `"nix"`).
65
- *
66
- * | phase | from class | active class | to class |
67
- * |--------------|-------------------|---------------------|-----------------|
68
- * | enter | `{n}-enter-from` | `{n}-enter-active` | `{n}-enter-to` |
69
- * | leave | `{n}-leave-from` | `{n}-leave-active` | `{n}-leave-to` |
70
- */
71
- export interface TransitionOptions {
72
- /**
73
- * Prefix for all generated CSS classes. Default `"nix"`.
74
- * e.g. `name: "fade"` generates `.fade-enter-from`, `.fade-leave-to`, …
75
- */
76
- name?: string;
77
- /** Override the enter-from class individually. */
78
- enterFrom?: string;
79
- /** Override the enter-active class individually. */
80
- enterActive?: string;
81
- /** Override the enter-to class individually. */
82
- enterTo?: string;
83
- /** Override the leave-from class individually. */
84
- leaveFrom?: string;
85
- /** Override the leave-active class individually. */
86
- leaveActive?: string;
87
- /** Override the leave-to class individually. */
88
- leaveTo?: string;
89
- /**
90
- * When `true` the enter transition also plays on the very first render
91
- * (similar to Vue's `appear`). Default `false`.
92
- */
93
- appear?: boolean;
94
- /**
95
- * Fallback duration in **milliseconds** used when no `transition-duration`
96
- * or `animation-duration` is found on the element via `getComputedStyle`.
97
- */
98
- duration?: number;
99
- /** Called synchronously right before the enter classes are added. */
100
- onBeforeEnter?: (el: Element) => void;
101
- /** Called after the enter transition has fully completed. */
102
- onAfterEnter?: (el: Element) => void;
103
- /** Called synchronously right before the leave classes are added. */
104
- onBeforeLeave?: (el: Element) => void;
105
- /** Called after the leave transition has fully completed and the DOM is removed. */
106
- onAfterLeave?: (el: Element) => void;
107
- }
108
- /** Content that can be wrapped with `transition()`. */
109
- export type TransitionContent = NixTemplate | NixComponent | (() => NixTemplate | NixComponent | null);
110
- /**
111
- * Wraps content with CSS class-based enter/leave transitions.
112
- * Static content plays enter on mount (only with `appear: true`).
113
- * Reactive `() => Template | null` auto-animates enter/leave on toggle.
114
- */
115
- export declare function transition(content: TransitionContent, options?: TransitionOptions): NixTemplate;
116
- export declare function html(strings: TemplateStringsArray, ...values: unknown[]): NixTemplate;