@pyreon/elements 0.3.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.js +2 -53
- package/package.json +9 -8
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.12/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));
|
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
|
-
"@pyreon/typescript": "^0.
|
|
52
|
+
"@pyreon/typescript": "^0.11.0"
|
|
52
53
|
}
|
|
53
54
|
}
|