summaryrefslogtreecommitdiff
path: root/node_modules/postcss/lib/container.d.ts
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
commite29b244aeab08ea36fb385c7beb2ad0560217039 (patch)
treec66b744dc29573f1acc871862937a23f1b80e6bf /node_modules/postcss/lib/container.d.ts
parent62c2881629e6413a8fec6d3dd092e4568e2a81dc (diff)
bump: @babel/cli 7.25.6 → 7.25.7, @babel/core 7.25.2 → 7.25.8, @babel/preset-env 7.25.4 → 7.25.8, postcss 8.4.41 → 8.4.47, swup 4.7.0 → 4.8.1
Diffstat (limited to 'node_modules/postcss/lib/container.d.ts')
-rw-r--r--node_modules/postcss/lib/container.d.ts95
1 files changed, 44 insertions, 51 deletions
diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts
index dfe55f20..692bd696 100644
--- a/node_modules/postcss/lib/container.d.ts
+++ b/node_modules/postcss/lib/container.d.ts
@@ -20,13 +20,26 @@ declare namespace Container {
/**
* An array of property names.
*/
- props?: string[]
+ props?: readonly string[]
}
export interface ContainerProps extends NodeProps {
- nodes?: (Node | ChildProps)[]
+ nodes?: readonly (ChildProps | Node)[]
}
+ /**
+ * All types that can be passed into container methods to create or add a new
+ * child node.
+ */
+ export type NewChild =
+ | ChildProps
+ | Node
+ | readonly ChildProps[]
+ | readonly Node[]
+ | readonly string[]
+ | string
+ | undefined
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Container_ as default }
}
@@ -52,6 +65,26 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
nodes: Child[] | undefined
/**
+ * An internal method that converts a {@link NewChild} into a list of actual
+ * child nodes that can then be added to this container.
+ *
+ * This ensures that the nodes' parent is set to this container, that they use
+ * the correct prototype chain, and that they're marked as dirty.
+ *
+ * @param mnodes The new node or nodes to add.
+ * @param sample A node from whose raws the new node's `before` raw should be
+ * taken.
+ * @param type This should be set to `'prepend'` if the new nodes will be
+ * inserted at the beginning of the container.
+ * @hidden
+ */
+ protected normalize(
+ nodes: Container.NewChild,
+ sample: Node | undefined,
+ type?: 'prepend' | false
+ ): Child[]
+
+ /**
* Inserts new nodes to the end of the container.
*
* ```js
@@ -71,21 +104,11 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* @param nodes New nodes.
* @return This node for methods chain.
*/
- append(
- ...nodes: (
- | ChildProps
- | ChildProps[]
- | Node
- | Node[]
- | string
- | string[]
- | undefined
- )[]
- ): this
-
+ append(...nodes: Container.NewChild[]): this
assign(overrides: Container.ContainerProps | object): this
clone(overrides?: Partial<Container.ContainerProps>): this
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
+
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
/**
@@ -124,7 +147,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
each(
callback: (node: Child, index: number) => false | void
): false | undefined
-
/**
* Returns `true` if callback returns `true`
* for all of the container’s children.
@@ -139,6 +161,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
every(
condition: (node: Child, index: number, nodes: Child[]) => boolean
): boolean
+
/**
* Returns a `child`’s index within the `Container#nodes` array.
*
@@ -150,7 +173,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* @return Child index.
*/
index(child: Child | number): number
-
/**
* Insert new node after old node within the container.
*
@@ -158,17 +180,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* @param newNode New node.
* @return This node for methods chain.
*/
- insertAfter(
- oldNode: Child | number,
- newNode:
- | Node
- | Node[]
- | ChildProps
- | ChildProps[]
- | string
- | string[]
- | undefined
- ): this
+ insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
+
/**
* Insert new node before old node within the container.
*
@@ -180,17 +193,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* @param newNode New node.
* @return This node for methods chain.
*/
- insertBefore(
- oldNode: Child | number,
- newNode:
- | Node
- | Node[]
- | ChildProps
- | ChildProps[]
- | string
- | string[]
- | undefined
- ): this
+ insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
/**
* Traverses the container’s descendant nodes, calling callback
@@ -229,17 +232,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* @param nodes New nodes.
* @return This node for methods chain.
*/
- prepend(
- ...nodes: (
- | ChildProps
- | ChildProps[]
- | Node
- | Node[]
- | string
- | string[]
- | undefined
- )[]
- ): this
+ prepend(...nodes: Container.NewChild[]): this
/**
* Add child to the end of the node.
*
@@ -301,8 +294,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
* ```
*
* @param pattern Replace pattern.
- * @param {object} opts Options to speed up the search.
- * @param callback String to replace pattern or callback
+ * @param {object} options Options to speed up the search.
+ * @param replaced String to replace pattern or callback
* that returns a new value. The callback
* will receive the same arguments
* as those passed to a function parameter