@valerius_petrini/corekit-ui 0.1.86 → 0.1.87

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.
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { sizeStyleParts, textStyle, type SizeStyleTheme } from "../../../styles/size";
3
+ import { multiAction } from "../../../utils/multiAction.js";
3
4
  import type { TextProps } from "./types.js";
4
5
  import { twMerge } from "tailwind-merge";
5
6
 
@@ -10,6 +11,7 @@
10
11
  tag = "p",
11
12
  shrink = undefined,
12
13
  size = "none",
14
+ use = [],
13
15
  ...restProps
14
16
  }: TextProps = $props();
15
17
 
@@ -61,6 +63,6 @@
61
63
  ));
62
64
  </script>
63
65
 
64
- <svelte:element bind:this={element} this={tag} style={shrinkStyle} class={combinedClass} {...restProps}>
66
+ <svelte:element bind:this={element} this={tag} style={shrinkStyle} class={combinedClass} {...restProps} use:multiAction={use}>
65
67
  {@render children?.()}
66
68
  </svelte:element>
@@ -1,9 +1,11 @@
1
+ import type { Action } from "svelte/action";
1
2
  import type { SizeStyle } from "../styles/size";
2
3
  import type { Component } from "svelte";
3
4
  export interface BaseComponentProps {
4
5
  children?: any;
5
6
  class?: string;
6
7
  element?: HTMLElement;
8
+ use?: [Action, any?][];
7
9
  [key: string]: any;
8
10
  }
9
11
  export type InputVariant = "default" | "floating";
@@ -0,0 +1,4 @@
1
+ import type { Action } from "svelte/action";
2
+ export declare function multiAction(node: HTMLElement, actions: [Action, any?][]): {
3
+ destroy(): void;
4
+ };
@@ -0,0 +1,8 @@
1
+ export function multiAction(node, actions) {
2
+ const instances = actions.map(([action, params]) => action(node, params));
3
+ return {
4
+ destroy() {
5
+ instances.forEach(isnt => isnt?.destroy?.());
6
+ }
7
+ };
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",