@pyreon/kinetic 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.js +3 -52
- package/package.json +7 -6
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Show, createRef, h, onMount, onUnmount } from "@pyreon/core";
|
|
2
2
|
import { runUntracked, signal, watch } from "@pyreon/reactivity";
|
|
3
|
+
import { jsx } from "@pyreon/core/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/useAnimationEnd.ts
|
|
5
6
|
const DEFAULT_TIMEOUT = 5e3;
|
|
@@ -59,55 +60,6 @@ function useReducedMotion() {
|
|
|
59
60
|
return matches;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region ../../node_modules/.bun/@pyreon+core@0.7.0/node_modules/@pyreon/core/lib/jsx-runtime.js
|
|
64
|
-
/**
|
|
65
|
-
* Hyperscript function — the compiled output of JSX.
|
|
66
|
-
* `<div class="x">hello</div>` → `h("div", { class: "x" }, "hello")`
|
|
67
|
-
*
|
|
68
|
-
* Generic on P so TypeScript validates props match the component's signature
|
|
69
|
-
* at the call site, then stores the result in the loosely-typed VNode.
|
|
70
|
-
*/
|
|
71
|
-
/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */
|
|
72
|
-
const EMPTY_PROPS = {};
|
|
73
|
-
function h$1(type, props, ...children) {
|
|
74
|
-
return {
|
|
75
|
-
type,
|
|
76
|
-
props: props ?? EMPTY_PROPS,
|
|
77
|
-
children: normalizeChildren(children),
|
|
78
|
-
key: props?.key ?? null
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function normalizeChildren(children) {
|
|
82
|
-
for (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);
|
|
83
|
-
return children;
|
|
84
|
-
}
|
|
85
|
-
function flattenChildren(children) {
|
|
86
|
-
const result = [];
|
|
87
|
-
for (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));
|
|
88
|
-
else result.push(child);
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* JSX automatic runtime.
|
|
93
|
-
*
|
|
94
|
-
* When tsconfig has `"jsxImportSource": "@pyreon/core"`, the TS/bundler compiler
|
|
95
|
-
* rewrites JSX to imports from this file automatically:
|
|
96
|
-
* <div class="x" /> → jsx("div", { class: "x" })
|
|
97
|
-
*/
|
|
98
|
-
function jsx(type, props, key) {
|
|
99
|
-
const { children, ...rest } = props;
|
|
100
|
-
const propsWithKey = key != null ? {
|
|
101
|
-
...rest,
|
|
102
|
-
key
|
|
103
|
-
} : rest;
|
|
104
|
-
if (typeof type === "function") return h$1(type, children !== void 0 ? {
|
|
105
|
-
...propsWithKey,
|
|
106
|
-
children
|
|
107
|
-
} : propsWithKey);
|
|
108
|
-
return h$1(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
63
|
//#endregion
|
|
112
64
|
//#region src/kinetic/CollapseRenderer.tsx
|
|
113
65
|
/**
|
|
@@ -469,12 +421,11 @@ const GroupRenderer = ({ config, htmlProps, appear, timeout, callbacks, children
|
|
|
469
421
|
const effectiveTimeout = timeout ?? config.timeout ?? 5e3;
|
|
470
422
|
const prevMap = /* @__PURE__ */ new Map();
|
|
471
423
|
const leavingMap = /* @__PURE__ */ new Map();
|
|
472
|
-
let initialKeys = null;
|
|
473
424
|
const forceUpdateSignal = signal(0);
|
|
474
425
|
const currentKeyed = getKeyedChildren(children);
|
|
475
426
|
const currentMap = /* @__PURE__ */ new Map();
|
|
476
427
|
for (const { key, element } of currentKeyed) currentMap.set(key, element);
|
|
477
|
-
|
|
428
|
+
const initialKeys = new Set(currentMap.keys());
|
|
478
429
|
for (const [key, child] of prevMap) if (!currentMap.has(key)) leavingMap.set(key, child);
|
|
479
430
|
for (const key of currentMap.keys()) leavingMap.delete(key);
|
|
480
431
|
prevMap.clear();
|
|
@@ -490,7 +441,7 @@ const GroupRenderer = ({ config, htmlProps, appear, timeout, callbacks, children
|
|
|
490
441
|
element
|
|
491
442
|
});
|
|
492
443
|
const groupedChildren = allEntries.map(({ key, element }) => {
|
|
493
|
-
const isInitial = initialKeys
|
|
444
|
+
const isInitial = initialKeys.has(key);
|
|
494
445
|
const isShowing = currentMap.has(key);
|
|
495
446
|
return /* @__PURE__ */ jsx(TransitionItem, {
|
|
496
447
|
show: () => isShowing,
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/kinetic",
|
|
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/kinetic"
|
|
7
|
+
"directory": "packages/ui-system/kinetic"
|
|
8
8
|
},
|
|
9
9
|
"description": "CSS-transition-based animation 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,11 +42,11 @@
|
|
|
41
42
|
"typecheck": "tsc --noEmit"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@pyreon/core": "
|
|
45
|
-
"@pyreon/reactivity": "
|
|
45
|
+
"@pyreon/core": "^0.11.0",
|
|
46
|
+
"@pyreon/reactivity": "^0.11.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@vitus-labs/tools-rolldown": "^1.15.3",
|
|
49
|
-
"@
|
|
50
|
+
"@pyreon/typescript": "^0.11.0"
|
|
50
51
|
}
|
|
51
52
|
}
|