@pyreon/elements 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 +5 -5
- package/lib/index.js +3 -54
- package/package.json +9 -8
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Provider } from "@pyreon/unistyle";
|
|
2
2
|
import * as _pyreon_core0 from "@pyreon/core";
|
|
3
|
-
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
3
|
+
import { ComponentFn, PyreonHTMLAttributes, VNodeChild } from "@pyreon/core";
|
|
4
4
|
import { BreakpointKeys, HTMLTags, HTMLTextTags, config, render } from "@pyreon/ui-core";
|
|
5
5
|
import * as _pyreon_reactivity0 from "@pyreon/reactivity";
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@ type Direction = ContentDirection | ContentDirection[] | Partial<Record<Breakpoi
|
|
|
25
25
|
type ResponsiveBoolType = ContentBoolean | ContentBoolean[] | Partial<Record<BreakpointKeys, ContentBoolean>>;
|
|
26
26
|
type Responsive = ContentSimpleValue | ContentSimpleValue[] | Partial<Record<BreakpointKeys, number | string>>;
|
|
27
27
|
type ExtendCss = Css | Css[] | Partial<Record<BreakpointKeys, Css>>;
|
|
28
|
-
type PyreonComponent<P extends Record<string, any> =
|
|
28
|
+
type PyreonComponent<P extends Record<string, any> = {}> = ComponentFn<P> & PyreonStatic;
|
|
29
29
|
interface PyreonStatic {
|
|
30
30
|
displayName?: string | undefined;
|
|
31
31
|
pkgName?: string;
|
|
@@ -157,8 +157,8 @@ type Props = Partial<{
|
|
|
157
157
|
* An additional prop for extending styling of the **afterContent** wrapper element.
|
|
158
158
|
*/
|
|
159
159
|
afterContentCss: ExtendCss;
|
|
160
|
-
}
|
|
161
|
-
type PyreonElement<P extends Record<string, unknown> =
|
|
160
|
+
}> & PyreonHTMLAttributes;
|
|
161
|
+
type PyreonElement<P extends Record<string, unknown> = {}> = ComponentFn<Props & P> & PyreonStatic;
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region src/Element/component.d.ts
|
|
164
164
|
declare const Component: PyreonElement;
|
|
@@ -400,7 +400,7 @@ type Props$5 = Partial<{
|
|
|
400
400
|
* If an additional styling needs to be added, it can be do so via injecting styles using this property.
|
|
401
401
|
*/
|
|
402
402
|
css: ExtendCss;
|
|
403
|
-
}> &
|
|
403
|
+
}> & PyreonHTMLAttributes;
|
|
404
404
|
declare const Component$5: PyreonComponent<Props$5> & {
|
|
405
405
|
isText?: true;
|
|
406
406
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Provider, alignContent, extendCss, makeItResponsive, value } from "@pyreon/unistyle";
|
|
2
2
|
import { Fragment, Portal, createContext, onMount, provide, useContext } from "@pyreon/core";
|
|
3
3
|
import { config, isEmpty, omit, pick, render, throttle } from "@pyreon/ui-core";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "@pyreon/core/jsx-runtime";
|
|
4
5
|
import { signal } from "@pyreon/reactivity";
|
|
5
6
|
|
|
6
7
|
//#region src/constants.ts
|
|
@@ -82,58 +83,6 @@ const StyledComponent = styled$2(component$1)`
|
|
|
82
83
|
})};
|
|
83
84
|
`;
|
|
84
85
|
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region ../../node_modules/.bun/@pyreon+core@0.7.0/node_modules/@pyreon/core/lib/jsx-runtime.js
|
|
87
|
-
/** Marker for fragment nodes — renders children without a wrapper element */
|
|
88
|
-
const Fragment$1 = Symbol("Pyreon.Fragment");
|
|
89
|
-
/**
|
|
90
|
-
* Hyperscript function — the compiled output of JSX.
|
|
91
|
-
* `<div class="x">hello</div>` → `h("div", { class: "x" }, "hello")`
|
|
92
|
-
*
|
|
93
|
-
* Generic on P so TypeScript validates props match the component's signature
|
|
94
|
-
* at the call site, then stores the result in the loosely-typed VNode.
|
|
95
|
-
*/
|
|
96
|
-
/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */
|
|
97
|
-
const EMPTY_PROPS = {};
|
|
98
|
-
function h(type, props, ...children) {
|
|
99
|
-
return {
|
|
100
|
-
type,
|
|
101
|
-
props: props ?? EMPTY_PROPS,
|
|
102
|
-
children: normalizeChildren(children),
|
|
103
|
-
key: props?.key ?? null
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function normalizeChildren(children) {
|
|
107
|
-
for (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);
|
|
108
|
-
return children;
|
|
109
|
-
}
|
|
110
|
-
function flattenChildren(children) {
|
|
111
|
-
const result = [];
|
|
112
|
-
for (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));
|
|
113
|
-
else result.push(child);
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* JSX automatic runtime.
|
|
118
|
-
*
|
|
119
|
-
* When tsconfig has `"jsxImportSource": "@pyreon/core"`, the TS/bundler compiler
|
|
120
|
-
* rewrites JSX to imports from this file automatically:
|
|
121
|
-
* <div class="x" /> → jsx("div", { class: "x" })
|
|
122
|
-
*/
|
|
123
|
-
function jsx(type, props, key) {
|
|
124
|
-
const { children, ...rest } = props;
|
|
125
|
-
const propsWithKey = key != null ? {
|
|
126
|
-
...rest,
|
|
127
|
-
key
|
|
128
|
-
} : rest;
|
|
129
|
-
if (typeof type === "function") return h(type, children !== void 0 ? {
|
|
130
|
-
...propsWithKey,
|
|
131
|
-
children
|
|
132
|
-
} : propsWithKey);
|
|
133
|
-
return h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);
|
|
134
|
-
}
|
|
135
|
-
const jsxs = jsx;
|
|
136
|
-
|
|
137
86
|
//#endregion
|
|
138
87
|
//#region src/helpers/Content/component.tsx
|
|
139
88
|
/**
|
|
@@ -568,7 +517,7 @@ const Component$7 = (props) => {
|
|
|
568
517
|
const renderChildren = () => {
|
|
569
518
|
if (!children) return null;
|
|
570
519
|
if (Array.isArray(children)) return children.map((item, i) => renderChild(item, children.length, i));
|
|
571
|
-
if (
|
|
520
|
+
if (typeof children === "object" && "type" in children && children.type === Fragment) {
|
|
572
521
|
const fragmentChildren = children.children;
|
|
573
522
|
const childrenLength = fragmentChildren.length;
|
|
574
523
|
return fragmentChildren.map((item, i) => renderChild(item, childrenLength, i));
|
|
@@ -664,7 +613,7 @@ const Component$1 = (({ rootElement = false, ref, ...props }) => {
|
|
|
664
613
|
const renderedList = /* @__PURE__ */ jsx(Iterator_default, { ...pick(props, Iterator_default.RESERVED_PROPS) });
|
|
665
614
|
if (!rootElement) return renderedList;
|
|
666
615
|
return /* @__PURE__ */ jsx(Component, {
|
|
667
|
-
ref,
|
|
616
|
+
...ref ? { ref } : {},
|
|
668
617
|
...omit(props, Iterator_default.RESERVED_PROPS),
|
|
669
618
|
children: renderedList
|
|
670
619
|
});
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/elements",
|
|
3
|
-
"version": "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/elements"
|
|
7
|
+
"directory": "packages/ui-system/elements"
|
|
8
8
|
},
|
|
9
9
|
"description": "Foundational UI components for Pyreon",
|
|
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": ">=
|
|
29
|
+
"node": ">= 22"
|
|
29
30
|
},
|
|
30
31
|
"publishConfig": {
|
|
31
32
|
"access": "public"
|
|
@@ -41,13 +42,13 @@
|
|
|
41
42
|
"typecheck": "tsc --noEmit"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@pyreon/core": "
|
|
45
|
-
"@pyreon/reactivity": "
|
|
46
|
-
"@pyreon/ui-core": "
|
|
47
|
-
"@pyreon/unistyle": "
|
|
45
|
+
"@pyreon/core": "^0.11.0",
|
|
46
|
+
"@pyreon/reactivity": "^0.11.0",
|
|
47
|
+
"@pyreon/ui-core": "^0.11.0",
|
|
48
|
+
"@pyreon/unistyle": "^0.11.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@vitus-labs/tools-rolldown": "^1.15.3",
|
|
51
|
-
"@
|
|
52
|
+
"@pyreon/typescript": "^0.11.0"
|
|
52
53
|
}
|
|
53
54
|
}
|