@estjs/template 0.0.16-beta.8 → 0.0.16
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/chunk-3SR36LGP.js +1 -0
- package/dist/{chunk-OEKE4VTS.dev.esm.js → chunk-R6JICOKI.dev.js} +23 -26
- package/dist/chunk-R6JICOKI.dev.js.map +1 -0
- package/dist/internal.cjs +1 -0
- package/dist/{internal.dev.cjs.js → internal.dev.cjs} +23 -26
- package/dist/internal.dev.cjs.map +1 -0
- package/dist/internal.dev.js +3 -0
- package/dist/{internal.dev.esm.js.map → internal.dev.js.map} +1 -1
- package/dist/internal.js +1 -0
- package/dist/template.cjs +2 -0
- package/dist/template.d.cts +112 -18
- package/dist/template.d.ts +112 -18
- package/dist/{template.dev.cjs.js → template.dev.cjs} +894 -110
- package/dist/template.dev.cjs.map +1 -0
- package/dist/{template.dev.esm.js → template.dev.js} +864 -86
- package/dist/template.dev.js.map +1 -0
- package/dist/template.js +2 -0
- package/package.json +21 -22
- package/dist/chunk-IA4OZ7NW.esm.js +0 -1
- package/dist/chunk-OEKE4VTS.dev.esm.js.map +0 -1
- package/dist/internal.cjs.js +0 -1
- package/dist/internal.dev.cjs.js.map +0 -1
- package/dist/internal.dev.esm.js +0 -3
- package/dist/internal.esm.js +0 -1
- package/dist/template.cjs.js +0 -2
- package/dist/template.dev.cjs.js.map +0 -1
- package/dist/template.dev.esm.js.map +0 -1
- package/dist/template.esm.js +0 -2
package/dist/template.d.ts
CHANGED
|
@@ -22,12 +22,21 @@ declare enum COMPONENT_TYPE {
|
|
|
22
22
|
FRAGMENT = "fragment",
|
|
23
23
|
PORTAL = "portal",
|
|
24
24
|
SUSPENSE = "suspense",
|
|
25
|
-
FOR = "for"
|
|
25
|
+
FOR = "for",
|
|
26
|
+
TRANSITION = "transition",
|
|
27
|
+
TRANSITION_GROUP = "transition-group"
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
type AnyNode = Node | Component<any> | Element | string | number | boolean | null | undefined | AnyNode[] | (() => AnyNode) | Signal<AnyNode> | Computed<AnyNode>;
|
|
29
31
|
type ComponentProps = Record<string, unknown>;
|
|
30
32
|
type ComponentFn<P = ComponentProps> = (props: P) => AnyNode;
|
|
33
|
+
/** A mounted application instance returned by createApp() and hydrate(). */
|
|
34
|
+
interface AppInstance {
|
|
35
|
+
/** The root Component wrapper (undefined if mounting produced raw nodes). */
|
|
36
|
+
root: Component | undefined;
|
|
37
|
+
/** Tear down the application: dispose scopes, remove DOM nodes. */
|
|
38
|
+
unmount: () => void;
|
|
39
|
+
}
|
|
31
40
|
|
|
32
41
|
declare class Component<P extends ComponentProps = {}> {
|
|
33
42
|
readonly component: ComponentFn<P>;
|
|
@@ -171,20 +180,21 @@ declare function onDestroy(hook: LifecycleHook): void;
|
|
|
171
180
|
* Modifiers for `bind:*` two-way bindings.
|
|
172
181
|
*
|
|
173
182
|
* - `trim` — strip surrounding whitespace
|
|
174
|
-
* - `number` — coerce numeric strings to numbers (no-op on NaN)
|
|
183
|
+
* - `number` — coerce numeric strings to numbers (no-op on NaN / blank)
|
|
175
184
|
* - `lazy` — commit on `change` instead of `input`
|
|
185
|
+
*
|
|
186
|
+
* Unknown keys are ignored at runtime; the compiler rejects them at build time.
|
|
176
187
|
*/
|
|
177
188
|
interface BindModifiers {
|
|
178
189
|
trim?: boolean;
|
|
179
190
|
number?: boolean;
|
|
180
191
|
lazy?: boolean;
|
|
181
|
-
[key: string]: boolean | undefined;
|
|
182
192
|
}
|
|
183
193
|
/**
|
|
184
194
|
* Creates a two-way binding between a DOM element property and a reactive model.
|
|
185
195
|
*
|
|
186
|
-
* -
|
|
187
|
-
* -
|
|
196
|
+
* - Model → DOM via a reactive `effect()`.
|
|
197
|
+
* - DOM → Model via an event listener that calls `setter`.
|
|
188
198
|
*
|
|
189
199
|
* @param node Target element. `null` is tolerated (no-op).
|
|
190
200
|
* @param prop Bound property (`value` / `checked` / `files` / custom).
|
|
@@ -198,13 +208,13 @@ declare function bindElement(node: Element | null, prop: 'value' | 'checked' | '
|
|
|
198
208
|
* Set up event delegation for specified event types.
|
|
199
209
|
*
|
|
200
210
|
* @param eventNames - Array of event names to delegate.
|
|
201
|
-
* @param document - Document to attach events to (defaults to
|
|
211
|
+
* @param document - Document to attach events to (defaults to the global document).
|
|
202
212
|
*/
|
|
203
213
|
declare function delegateEvents(eventNames: string[], document?: Document): void;
|
|
204
214
|
/**
|
|
205
215
|
* Clear all delegated events from document.
|
|
206
216
|
*
|
|
207
|
-
* @param document - Document to clear events from (defaults to
|
|
217
|
+
* @param document - Document to clear events from (defaults to the global document).
|
|
208
218
|
*/
|
|
209
219
|
declare function clearDelegatedEvents(document?: Document): void;
|
|
210
220
|
/**
|
|
@@ -265,17 +275,7 @@ declare function next(node: Node | null, step?: number): Node | null;
|
|
|
265
275
|
*/
|
|
266
276
|
declare function nthChild(node: Node | null, index: number): Node | null;
|
|
267
277
|
|
|
268
|
-
/**
|
|
269
|
-
* Returns a new hydration key.
|
|
270
|
-
*
|
|
271
|
-
* @returns The new hydration key as a string.
|
|
272
|
-
*/
|
|
273
278
|
declare function getHydrationKey(): string;
|
|
274
|
-
/**
|
|
275
|
-
* Resets the client-side hydration key counter.
|
|
276
|
-
*
|
|
277
|
-
* @returns {void}
|
|
278
|
-
*/
|
|
279
279
|
declare function resetHydrationKey(): void;
|
|
280
280
|
/**
|
|
281
281
|
* Returns whether the runtime is currently in the hydration first-pass.
|
|
@@ -303,6 +303,8 @@ declare function beginHydration(root: Element): void;
|
|
|
303
303
|
* @returns {void}
|
|
304
304
|
*/
|
|
305
305
|
declare function endHydration(): void;
|
|
306
|
+
declare function hydrationMarker(parent: Node | null, index: number): Comment | null;
|
|
307
|
+
declare function hydrationAnchor(parent: Node | null, index: number): Node | null;
|
|
306
308
|
/**
|
|
307
309
|
* Returns a factory function that, when called at component render time:
|
|
308
310
|
* - During hydration: increments the key, looks up the pre-built registry,
|
|
@@ -678,4 +680,96 @@ interface ForProps<T> {
|
|
|
678
680
|
declare function For<T>(props: ForProps<T>): Node;
|
|
679
681
|
declare namespace For { }
|
|
680
682
|
|
|
681
|
-
|
|
683
|
+
interface TransitionProps {
|
|
684
|
+
name?: string;
|
|
685
|
+
css?: boolean;
|
|
686
|
+
type?: 'transition' | 'animation';
|
|
687
|
+
appear?: boolean;
|
|
688
|
+
duration?: number | {
|
|
689
|
+
enter: number;
|
|
690
|
+
leave: number;
|
|
691
|
+
};
|
|
692
|
+
enterFromClass?: string;
|
|
693
|
+
enterActiveClass?: string;
|
|
694
|
+
enterToClass?: string;
|
|
695
|
+
appearFromClass?: string;
|
|
696
|
+
appearActiveClass?: string;
|
|
697
|
+
appearToClass?: string;
|
|
698
|
+
leaveFromClass?: string;
|
|
699
|
+
leaveActiveClass?: string;
|
|
700
|
+
leaveToClass?: string;
|
|
701
|
+
onBeforeEnter?: (el: Element) => void;
|
|
702
|
+
onEnter?: (el: Element, done: () => void) => void;
|
|
703
|
+
onAfterEnter?: (el: Element) => void;
|
|
704
|
+
onEnterCancelled?: (el: Element) => void;
|
|
705
|
+
onBeforeLeave?: (el: Element) => void;
|
|
706
|
+
onLeave?: (el: Element, done: () => void) => void;
|
|
707
|
+
onAfterLeave?: (el: Element) => void;
|
|
708
|
+
onLeaveCancelled?: (el: Element) => void;
|
|
709
|
+
children?: AnyNode | (() => AnyNode);
|
|
710
|
+
}
|
|
711
|
+
declare function Transition(props: TransitionProps): Node;
|
|
712
|
+
/**
|
|
713
|
+
* Check if a node is a Transition component.
|
|
714
|
+
*
|
|
715
|
+
* @param node - Node to check.
|
|
716
|
+
* @returns True if node is a Transition.
|
|
717
|
+
*/
|
|
718
|
+
declare function isTransition(node: unknown): boolean;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Props for `<TransitionGroup>`.
|
|
722
|
+
*
|
|
723
|
+
* Inherits every enter/leave knob from {@link TransitionProps} (name, css,
|
|
724
|
+
* type, duration, JS hooks, custom class overrides) and adds:
|
|
725
|
+
*
|
|
726
|
+
* - `each` / `key` — same shape as `<For>`; required for stable identity.
|
|
727
|
+
* - `tag` — wrapper element. Required so we have a layout root to measure
|
|
728
|
+
* positions against and to anchor leaving items absolutely. Defaults to
|
|
729
|
+
* `'div'`.
|
|
730
|
+
* - `moveClass` — class applied to elements during the FLIP move animation.
|
|
731
|
+
* Defaults to `${name}-move`.
|
|
732
|
+
* - `children` — render function per item. May return an Element or a
|
|
733
|
+
* Component instance (the latter is mounted, its first rendered Element
|
|
734
|
+
* participates in the animations).
|
|
735
|
+
*
|
|
736
|
+
* `appear` is intentionally NOT supported: items mounted on the initial
|
|
737
|
+
* render do NOT animate. The appear-related props from {@link TransitionProps}
|
|
738
|
+
* are therefore omitted from this type. If you need first-frame animation,
|
|
739
|
+
* mount the group with an empty list and push items after mount.
|
|
740
|
+
*/
|
|
741
|
+
type GroupBaseProps = Omit<TransitionProps, 'children' | 'appear' | 'appearFromClass' | 'appearActiveClass' | 'appearToClass'>;
|
|
742
|
+
interface TransitionGroupProps<T = unknown> extends GroupBaseProps {
|
|
743
|
+
each: T[] | Signal<T[]> | (() => T[]);
|
|
744
|
+
key: (item: T, index: number) => unknown;
|
|
745
|
+
tag?: string;
|
|
746
|
+
moveClass?: string;
|
|
747
|
+
children: (item: T, index: number) => unknown;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Animated keyed list with three coordinated animations:
|
|
751
|
+
*
|
|
752
|
+
* - **enter** — new items fade/slide in using `${name}-enter-*` classes
|
|
753
|
+
* - **leave** — removed items animate out (positioned absolutely so the
|
|
754
|
+
* remaining items can reflow under FLIP), then are detached
|
|
755
|
+
* - **move** — items that stayed but changed position run FLIP: snapshot
|
|
756
|
+
* `getBoundingClientRect()` before reconcile, compute delta after,
|
|
757
|
+
* invert via `transform`, then transition to identity under `moveClass`
|
|
758
|
+
*
|
|
759
|
+
* Each row owns its own scope (mirroring `<For>`), so signals/effects
|
|
760
|
+
* created inside `children()` are torn down when the row leaves.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```tsx
|
|
764
|
+
* <TransitionGroup name="list" each={items} key={(it) => it.id} tag="ul">
|
|
765
|
+
* {(item) => <li>{item.label}</li>}
|
|
766
|
+
* </TransitionGroup>
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
declare function TransitionGroup<T>(props: TransitionGroupProps<T>): Element;
|
|
770
|
+
/**
|
|
771
|
+
* Type guard for the TransitionGroup component reference.
|
|
772
|
+
*/
|
|
773
|
+
declare function isTransitionGroup(node: unknown): boolean;
|
|
774
|
+
|
|
775
|
+
export { type AppInstance, type AsyncComponentOptions, Component, type ComponentFn, type ComponentProps, For, Fragment, Portal, Suspense, Transition, TransitionGroup, type TransitionGroupProps, type TransitionProps, addEvent, addEventListener, beginHydration, bindElement, child, clearDelegatedEvents, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, defineAsyncComponent, delegateEvents, endHydration, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, insert, isComponent, isFragment, isHydrating, isPortal, isSuspense, isTransition, isTransitionGroup, next, normalizeClass, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, resetHydrationKey, setStyle, template };
|