pull/18058/head
paoloricciuti 5 months ago
parent 49cff549c7
commit ecffd81c22

@ -20,22 +20,21 @@ import { push_renderer } from './state.js';
* @property {(element: TElement, name: string)=>void} removeAttribute - Remove the attribute with the given name from the element * @property {(element: TElement, name: string)=>void} removeAttribute - Remove the attribute with the given name from the element
* @property {(element: TElement, name: string)=>boolean} hasAttribute - Return true if the element has an attribute with the given name * @property {(element: TElement, name: string)=>boolean} hasAttribute - Return true if the element has an attribute with the given name
* @property {(node: TNode, text: string)=>void} setText - Set the text content of the node to the given value. This should work for both text nodes and elements (setting text content on an element should replace all of it's children with a single text node) * @property {(node: TNode, text: string)=>void} setText - Set the text content of the node to the given value. This should work for both text nodes and elements (setting text content on an element should replace all of it's children with a single text node)
* @property {(element: TElement | TFragment)=>TNode} getFirstChild - Return the first child of the element, or null if it has no children. This should work for both elements and fragments * @property {(element: TElement | TFragment)=>TNode | null} getFirstChild - Return the first child of the element, or null if it has no children. This should work for both elements and fragments
* @property {(element: TElement | TFragment)=>TNode} getLastChild - Return the last child of the element, or null if it has no children. This should work for both elements and fragments * @property {(element: TElement | TFragment)=>TNode | null} getLastChild - Return the last child of the element, or null if it has no children. This should work for both elements and fragments
* @property {(element: TNode)=>TNode} getNextSibling - Return the next sibling of the node, or null if it has no next sibling * @property {(element: TNode)=>TNode | null} getNextSibling - Return the next sibling of the node, or null if it has no next sibling
* @property {(parent: TElement | TFragment, element: TNode, anchor: TNode | null)=>void} insert - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents * @property {(parent: TElement | TFragment, element: TNode, anchor: TNode | null)=>void} insert - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents
* @property {(node: TNode)=>void} remove - Remove the node from the tree * @property {(node: TNode)=>void} remove - Remove the node from the tree
* @property {(element: TNode)=>TNode} getParent - Return the parent of the element, or null if it has no parent * @property {(element: TNode)=>TNode | null} getParent - Return the parent of the element, or null if it has no parent
* @property {(node: TNode, deep: boolean)=>TNode} cloneNode - Return a clone of the node. If deep is true, all of the node's children should also be cloned
* @property {(target: TNode, type: string, handler: any, options?: any)=>void} addEventListener - Add an event listener of the given type and handler to the target node, with optional options * @property {(target: TNode, type: string, handler: any, options?: any)=>void} addEventListener - Add an event listener of the given type and handler to the target node, with optional options
* @property {(target: TNode, type: string, handler: any, options?: any)=>void} removeEventListener - Remove an event listener of the given type and handler from the target node, with optional options * @property {(target: TNode, type: string, handler: any, options?: any)=>void} removeEventListener - Remove an event listener of the given type and handler from the target node, with optional options
*/ */
/** /**
* @template [const TFragment=unknown] * @template [TFragment=unknown]
* @template [const TElement=unknown] * @template [TElement=unknown]
* @template [const TTextNode=unknown] * @template [TTextNode=unknown]
* @template [const TComment=unknown] * @template [TComment=unknown]
* @param {Renderer<TFragment, TElement, TTextNode, TComment>} renderer * @param {Renderer<TFragment, TElement, TTextNode, TComment>} renderer
* @returns {Renderer<TFragment, TElement, TTextNode, TComment> & { render: (Component: any, options: { target: TFragment | TElement | TTextNode | TComment, props?: any }) => () => void }} * @returns {Renderer<TFragment, TElement, TTextNode, TComment> & { render: (Component: any, options: { target: TFragment | TElement | TTextNode | TComment, props?: any }) => () => void }}
*/ */

@ -2568,7 +2568,7 @@ declare module 'svelte/reactivity/window' {
} }
declare module 'svelte/renderer' { declare module 'svelte/renderer' {
export function createRenderer<const TFragment = unknown, const TElement = unknown, const TTextNode = unknown, const TComment = unknown>(renderer: Renderer<TFragment, TElement, TTextNode, TComment>): Renderer<TFragment, TElement, TTextNode, TComment> & { export function createRenderer<TFragment = unknown, TElement = unknown, TTextNode = unknown, TComment = unknown>(renderer: Renderer<TFragment, TElement, TTextNode, TComment>): Renderer<TFragment, TElement, TTextNode, TComment> & {
render: (Component: any, options: { render: (Component: any, options: {
target: TFragment | TElement | TTextNode | TComment; target: TFragment | TElement | TTextNode | TComment;
props?: any; props?: any;
@ -2622,15 +2622,15 @@ declare module 'svelte/renderer' {
/** /**
* - Return the first child of the element, or null if it has no children. This should work for both elements and fragments * - Return the first child of the element, or null if it has no children. This should work for both elements and fragments
*/ */
getFirstChild: (element: TElement | TFragment) => TNode; getFirstChild: (element: TElement | TFragment) => TNode | null;
/** /**
* - Return the last child of the element, or null if it has no children. This should work for both elements and fragments * - Return the last child of the element, or null if it has no children. This should work for both elements and fragments
*/ */
getLastChild: (element: TElement | TFragment) => TNode; getLastChild: (element: TElement | TFragment) => TNode | null;
/** /**
* - Return the next sibling of the node, or null if it has no next sibling * - Return the next sibling of the node, or null if it has no next sibling
*/ */
getNextSibling: (element: TNode) => TNode; getNextSibling: (element: TNode) => TNode | null;
/** /**
* - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents * - Insert the element into the parent before the anchor (if the anchor is null, insert at the end). This should work for both elements and fragments as parents
*/ */
@ -2642,7 +2642,7 @@ declare module 'svelte/renderer' {
/** /**
* - Return the parent of the element, or null if it has no parent * - Return the parent of the element, or null if it has no parent
*/ */
getParent: (element: TNode) => TNode; getParent: (element: TNode) => TNode | null;
/** /**
* - Add an event listener of the given type and handler to the target node, with optional options * - Add an event listener of the given type and handler to the target node, with optional options
*/ */

Loading…
Cancel
Save