@pyreon/attrs 0.2.0 → 0.11.0

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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { VNode } from "@pyreon/core";
1
+ import { VNode, VNodeChild } from "@pyreon/core";
2
2
 
3
3
  //#region src/types/attrs.d.ts
4
4
  /** Callback form of `.attrs()` — receives current props and returns partial overrides. */
@@ -9,9 +9,10 @@ type TObj = Record<string, unknown>;
9
9
  type TFn = (...args: any) => any;
10
10
  /**
11
11
  * A Pyreon component function that accepts additional static properties.
12
- * In Pyreon, components are plain functions: (props: P) => VNode | null.
12
+ * Aligned with @pyreon/core's ComponentFn returns VNodeChild (not just VNode | null)
13
+ * to support components returning strings, numbers, undefined, etc.
13
14
  */
14
- type ComponentFn<P = any> = ((props: P) => VNode | null) & Partial<Record<string, any>>;
15
+ type ComponentFn<P = any> = ((props: P) => VNodeChild) & Partial<Record<string, any>>;
15
16
  /**
16
17
  * An element type — either a Pyreon component function or an intrinsic tag string.
17
18
  */
@@ -80,9 +81,9 @@ interface AttrsComponent<C extends ElementType = ElementType, OA extends TObj =
80
81
  component: NC,
81
82
  DEBUG
82
83
  }: ConfigAttrs<NC>) => NC extends ElementType ? AttrsComponent<NC, ExtractProps<NC>, EA, S, HOC> : AttrsComponent<C, OA, EA, S, HOC>;
83
- attrs: <P extends TObj | unknown = unknown>(param: P extends TObj ? Partial<MergeTypes<[DFP, P]>> | AttrsCb<MergeTypes<[DFP, P]>> : Partial<DFP> | AttrsCb<DFP>, config?: Partial<{
84
+ attrs: <P extends TObj | unknown = unknown>(param: P extends TObj ? Partial<DFP & P> | AttrsCb<DFP & P> : Partial<DFP> | AttrsCb<DFP>, config?: Partial<{
84
85
  priority: boolean;
85
- filter: unknown extends P ? string[] : (keyof MergeTypes<[EA, P]>)[];
86
+ filter: unknown extends P ? string[] : (keyof (EA & P))[];
86
87
  }>) => P extends TObj ? AttrsComponent<C, OA, MergeTypes<[EA, P]>, S, HOC> : AttrsComponent<C, OA, EA, S, HOC>;
87
88
  compose: <P extends ComposeParam>(param: P) => P extends TObj ? AttrsComponent<C, OA, EA, S, MergeTypes<[HOC, P]>> : AttrsComponent<C, OA, EA, S, HOC>;
88
89
  statics: <P extends TObj | unknown = unknown>(param: P) => P extends TObj ? AttrsComponent<C, OA, EA, MergeTypes<[S, P]>, HOC> : AttrsComponent<C, OA, EA, S, HOC>;
package/lib/index.js CHANGED
@@ -164,7 +164,7 @@ const attrs = ({ name, component }) => {
164
164
  //#region src/isAttrsComponent.ts
165
165
  /** Runtime type guard — checks if a component was created by `attrs()`. */
166
166
  const isAttrsComponent = (component) => {
167
- if (component && (typeof component === "object" || typeof component === "function") && component !== null && Object.hasOwn(component, "IS_ATTRS")) return true;
167
+ if (component && (typeof component === "object" || typeof component === "function") && Object.hasOwn(component, "IS_ATTRS")) return true;
168
168
  return false;
169
169
  };
170
170
 
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@pyreon/attrs",
3
- "version": "0.2.0",
3
+ "version": "0.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/pyreon/ui-system",
7
- "directory": "packages/attrs"
7
+ "directory": "packages/ui-system/attrs"
8
8
  },
9
9
  "description": "Attrs HOC chaining for Pyreon components",
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "sideEffects": false,
13
13
  "exports": {
14
+ "bun": "./src/index.ts",
14
15
  "source": "./src/index.ts",
15
16
  "import": "./lib/index.js",
16
17
  "types": "./lib/index.d.ts"
@@ -25,7 +26,7 @@
25
26
  "LICENSE"
26
27
  ],
27
28
  "engines": {
28
- "node": ">= 18"
29
+ "node": ">= 22"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
@@ -41,11 +42,11 @@
41
42
  "typecheck": "tsc --noEmit"
42
43
  },
43
44
  "peerDependencies": {
44
- "@pyreon/core": ">=0.4.0 <1.0.0",
45
- "@pyreon/ui-core": ">=0.2.0"
45
+ "@pyreon/core": "^0.11.0",
46
+ "@pyreon/ui-core": "^0.11.0"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@vitus-labs/tools-rolldown": "^1.15.3",
49
- "@vitus-labs/tools-typescript": "^1.15.3"
50
+ "@pyreon/typescript": "^0.11.0"
50
51
  }
51
52
  }