anim-3d-obj 2.0.1 → 2.0.4
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/dist/index.cjs +264 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +35 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +151 -146
- package/dist/index.js.map +1 -1
- package/package.json +23 -26
- package/dist/components/Obj.d.mts +0 -50
- package/dist/components/Obj.d.ts +0 -50
- package/dist/components/Obj.js +0 -231
- package/dist/components/Obj.js.map +0 -1
- package/dist/components/Obj.mjs +0 -206
- package/dist/components/Obj.mjs.map +0 -1
- package/dist/index.mjs +0 -205
- package/dist/index.mjs.map +0 -1
- package/dist/obj-PY72GEW6.css +0 -39
package/dist/index.js
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
Obj: () => Obj_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
26
3
|
|
|
27
4
|
// src/components/Obj.tsx
|
|
28
|
-
var import_react = require("react");
|
|
29
5
|
|
|
30
6
|
// src/keyframes.ts
|
|
31
7
|
function ensureStyleTag() {
|
|
@@ -91,142 +67,171 @@ function toAnimationShorthand(cfg) {
|
|
|
91
67
|
const play = cfg.animationPlayState ?? "running";
|
|
92
68
|
return `${name} ${dur} ${timing} ${delay} ${iter} ${dir} ${fill} ${play}`;
|
|
93
69
|
}
|
|
94
|
-
|
|
95
|
-
// src/components/Obj.tsx
|
|
96
|
-
var import_obj = require("./obj-PY72GEW6.css");
|
|
97
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
98
70
|
function faceTransform(name, w, h, d) {
|
|
99
|
-
const
|
|
71
|
+
const hw = w / 2;
|
|
72
|
+
const hh = h / 2;
|
|
73
|
+
const hd = d / 2;
|
|
100
74
|
switch (name) {
|
|
101
75
|
case "front":
|
|
102
|
-
return `
|
|
76
|
+
return `translate(-50%, -50%) translateZ(${hd}px)`;
|
|
103
77
|
case "back":
|
|
104
|
-
return `
|
|
78
|
+
return `translate(-50%, -50%) rotateY(180deg) translateZ(${hd}px)`;
|
|
105
79
|
case "left":
|
|
106
|
-
return `
|
|
80
|
+
return `translate(-50%, -50%) rotateY(-90deg) translateZ(${hw}px)`;
|
|
107
81
|
case "right":
|
|
108
|
-
return `
|
|
82
|
+
return `translate(-50%, -50%) rotateY(90deg) translateZ(${hw}px)`;
|
|
109
83
|
case "top":
|
|
110
|
-
return `
|
|
84
|
+
return `translate(-50%, -50%) rotateX(90deg) translateZ(${hh}px)`;
|
|
111
85
|
case "bottom":
|
|
112
|
-
return `
|
|
113
|
-
//
|
|
86
|
+
return `translate(-50%, -50%) rotateX(-90deg) translateZ(${hh}px)`;
|
|
87
|
+
// Legacy names – map to angled half-faces
|
|
114
88
|
case "top_front":
|
|
115
|
-
return `
|
|
89
|
+
return `translate(-50%, -50%) rotateX(45deg) translateZ(${hh}px)`;
|
|
116
90
|
case "top_rear":
|
|
117
|
-
return `
|
|
91
|
+
return `translate(-50%, -50%) rotateX(135deg) translateZ(${hh}px)`;
|
|
118
92
|
case "bottom_front":
|
|
119
|
-
return `
|
|
93
|
+
return `translate(-50%, -50%) rotateX(-45deg) translateZ(${hh}px)`;
|
|
120
94
|
case "bottom_rear":
|
|
121
|
-
return `
|
|
95
|
+
return `translate(-50%, -50%) rotateX(-135deg) translateZ(${hh}px)`;
|
|
122
96
|
default:
|
|
123
|
-
return `
|
|
97
|
+
return `translate(-50%, -50%) translateZ(${hd}px)`;
|
|
124
98
|
}
|
|
125
99
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return out;
|
|
100
|
+
function parseCssText(css) {
|
|
101
|
+
if (!css) return {};
|
|
102
|
+
const style = {};
|
|
103
|
+
css.split(";").forEach((rule) => {
|
|
104
|
+
const [prop, ...rest] = rule.split(":");
|
|
105
|
+
if (!prop || rest.length === 0) return;
|
|
106
|
+
const key = prop.trim().replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
107
|
+
style[key] = rest.join(":").trim();
|
|
108
|
+
});
|
|
109
|
+
return style;
|
|
137
110
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const content = face.body ?? global?.body ?? null;
|
|
154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
-
"div",
|
|
156
|
-
{
|
|
157
|
-
className: `anim3d-face ${face.className ?? ""}`,
|
|
158
|
-
style: {
|
|
159
|
-
transform: faceTransform(face.name, w, h, d),
|
|
160
|
-
...merged
|
|
161
|
-
},
|
|
162
|
-
"data-face": face.name,
|
|
163
|
-
children: typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: content }) : content
|
|
164
|
-
}
|
|
165
|
-
);
|
|
111
|
+
function faceDimensions(name, w, h, d) {
|
|
112
|
+
switch (name) {
|
|
113
|
+
case "left":
|
|
114
|
+
case "right":
|
|
115
|
+
return { width: d, height: h };
|
|
116
|
+
case "top":
|
|
117
|
+
case "bottom":
|
|
118
|
+
case "top_front":
|
|
119
|
+
case "top_rear":
|
|
120
|
+
case "bottom_front":
|
|
121
|
+
case "bottom_rear":
|
|
122
|
+
return { width: w, height: d };
|
|
123
|
+
default:
|
|
124
|
+
return { width: w, height: h };
|
|
125
|
+
}
|
|
166
126
|
}
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
127
|
+
var DEFAULT_FACE_NAMES = [
|
|
128
|
+
"front",
|
|
129
|
+
"back",
|
|
130
|
+
"left",
|
|
131
|
+
"right",
|
|
132
|
+
"top",
|
|
133
|
+
"bottom"
|
|
134
|
+
];
|
|
135
|
+
var Obj = React.memo(
|
|
136
|
+
({
|
|
137
|
+
width = 160,
|
|
138
|
+
height = 160,
|
|
139
|
+
depth = 150,
|
|
140
|
+
perspective = 600,
|
|
141
|
+
perspectiveOrigin = "50% 50%",
|
|
142
|
+
faces,
|
|
143
|
+
global: globalDef,
|
|
144
|
+
anim1,
|
|
145
|
+
anim2,
|
|
146
|
+
showCenterDiv = false,
|
|
147
|
+
className,
|
|
148
|
+
style
|
|
149
|
+
}) => {
|
|
150
|
+
const w = typeof width === "number" ? width : parseFloat(width);
|
|
151
|
+
const h = typeof height === "number" ? height : parseFloat(height);
|
|
152
|
+
const d = typeof depth === "number" ? depth : parseFloat(depth);
|
|
153
|
+
const animation1 = toAnimationShorthand(anim1) ?? void 0;
|
|
154
|
+
const animation2 = toAnimationShorthand(anim2) ?? void 0;
|
|
155
|
+
const faceList = faces && faces.length > 0 ? faces : DEFAULT_FACE_NAMES.map((name) => ({ name }));
|
|
156
|
+
const renderFace = (face, i) => {
|
|
157
|
+
const dims = faceDimensions(face.name, w, h, d);
|
|
158
|
+
const transform = faceTransform(face.name, w, h, d);
|
|
159
|
+
const globalStyle = parseCssText(globalDef?.css);
|
|
160
|
+
const faceInlineStyle = parseCssText(face.css);
|
|
161
|
+
const mergedStyle = {
|
|
162
|
+
...globalStyle,
|
|
163
|
+
...globalDef?.style ?? {},
|
|
164
|
+
...faceInlineStyle,
|
|
165
|
+
...face.style ?? {},
|
|
166
|
+
width: dims.width,
|
|
167
|
+
height: dims.height,
|
|
168
|
+
transform
|
|
169
|
+
};
|
|
170
|
+
const body = face.body ?? globalDef?.body ?? null;
|
|
171
|
+
const faceClassName = [
|
|
172
|
+
"anim3d-face",
|
|
173
|
+
face.className
|
|
174
|
+
].filter(Boolean).join(" ");
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: faceClassName,
|
|
179
|
+
style: mergedStyle,
|
|
180
|
+
children: body
|
|
181
|
+
},
|
|
182
|
+
face.name + "-" + i
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
const cssVars = {
|
|
186
|
+
"--obj-w": w + "px",
|
|
187
|
+
"--obj-h": h + "px",
|
|
188
|
+
"--obj-d": d + "px"
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
className: ["anim3d-stage", className].filter(Boolean).join(" "),
|
|
194
|
+
style: {
|
|
195
|
+
perspective,
|
|
196
|
+
perspectiveOrigin,
|
|
197
|
+
...cssVars,
|
|
198
|
+
...style
|
|
199
|
+
},
|
|
200
|
+
"data-anim-3d-obj": true,
|
|
201
|
+
role: "img",
|
|
202
|
+
"aria-label": "3D object",
|
|
203
|
+
children: /* @__PURE__ */ jsx(
|
|
204
|
+
"div",
|
|
214
205
|
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
})
|
|
206
|
+
className: "anim3d-wrapper",
|
|
207
|
+
style: {
|
|
208
|
+
...cssVars,
|
|
209
|
+
animation: animation1,
|
|
210
|
+
transformStyle: "preserve-3d"
|
|
211
|
+
},
|
|
212
|
+
children: /* @__PURE__ */ jsxs(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
className: "anim3d-wrapper",
|
|
216
|
+
style: {
|
|
217
|
+
...cssVars,
|
|
218
|
+
animation: animation2,
|
|
219
|
+
transformStyle: "preserve-3d"
|
|
220
|
+
},
|
|
221
|
+
children: [
|
|
222
|
+
showCenterDiv && /* @__PURE__ */ jsx("div", { className: "anim3d-center" }),
|
|
223
|
+
faceList.map(renderFace)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
Obj.displayName = "Obj";
|
|
234
|
+
|
|
235
|
+
export { Obj, Obj as default, resolveAnimation, toAnimationShorthand };
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
232
237
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/Obj.tsx","../src/keyframes.ts"],"sourcesContent":["export { default as Obj } from \"./components/Obj\";\nexport type {\n ObjProps,\n FaceDef,\n GlobalDef,\n AnimationConfig,\n FaceName,\n BuiltInAnimName,\n} from \"./types\";\n","import React, { useMemo } from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { FaceDef, GlobalDef, ObjProps, FaceName } from \"../types\";\nimport { toAnimationShorthand } from \"../keyframes\";\nimport \"../styles/obj.css\";\n\n/** Map face name -> transform so it sits on a rectangular prism */\nfunction faceTransform(name: string, w: number, h: number, d: number): string {\n const z = d / 2;\n switch (name as FaceName) {\n case \"front\":\n return `translate3d(-50%, -50%, ${z}px)`;\n case \"back\":\n return `translate3d(-50%, -50%, ${-z}px) rotateY(180deg)`;\n case \"left\":\n return `translate3d(-50%, -50%, 0) rotateY(-90deg) translateZ(${\n w / 2\n }px)`;\n case \"right\":\n return `translate3d(-50%, -50%, 0) rotateY(90deg) translateZ(${\n w / 2\n }px)`;\n case \"top\":\n return `translate3d(-50%, -50%, 0) rotateX(90deg) translateZ(${\n h / 2\n }px)`;\n case \"bottom\":\n return `translate3d(-50%, -50%, 0) rotateX(-90deg) translateZ(${\n h / 2\n }px)`;\n // legacy/extra – position near top/bottom, front/back edges\n case \"top_front\":\n return `translate3d(-50%, -50%, ${z / 2}px) rotateX(75deg)`;\n case \"top_rear\":\n return `translate3d(-50%, -50%, ${-z / 2}px) rotateX(105deg)`;\n case \"bottom_front\":\n return `translate3d(-50%, -50%, ${z / 2}px) rotateX(-75deg)`;\n case \"bottom_rear\":\n return `translate3d(-50%, -50%, ${-z / 2}px) rotateX(-105deg)`;\n default:\n return `translate3d(-50%, -50%, ${z}px)`;\n }\n}\n\n/** Merge legacy CSS string + style object */\nfunction mergeStyles(inlineCSS?: string, style?: CSSProperties): CSSProperties {\n const out: CSSProperties = { ...(style ?? {}) };\n if (inlineCSS) {\n // naive parser: split by ;, then key:value\n inlineCSS\n .split(\";\")\n .map((s) => s.trim())\n .filter(Boolean)\n .forEach((rule) => {\n const [k, v] = rule.split(\":\");\n if (!k || !v) return;\n const key = k\n .trim()\n .replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n (out as any)[key] = v.trim();\n });\n }\n return out;\n}\n\nfunction Face({\n w,\n h,\n d,\n face,\n global,\n}: {\n w: number;\n h: number;\n d: number;\n face: FaceDef;\n global?: GlobalDef;\n}) {\n const base = useMemo(\n () => mergeStyles(global?.css, global?.style),\n [global]\n );\n const merged = useMemo(\n () => ({ ...base, ...mergeStyles(face.css, face.style) }),\n [base, face.css, face.style]\n );\n\n const content: ReactNode = face.body ?? global?.body ?? null;\n\n return (\n <div\n className={`anim3d-face ${face.className ?? \"\"}`}\n style={{\n transform: faceTransform(face.name, w, h, d),\n ...merged,\n }}\n data-face={face.name}\n >\n {typeof content === \"string\" ? <span>{content}</span> : content}\n </div>\n );\n}\n\nconst Obj: React.FC<ObjProps> = ({\n width = 160,\n height = 160,\n depth = 150,\n perspective = 500,\n perspectiveOrigin = \"50% 50%\",\n faces = [\n { name: \"front\", body: \"FRONT\" },\n { name: \"back\", body: \"BACK\" },\n { name: \"left\", body: \"LEFT\" },\n { name: \"right\", body: \"RIGHT\" },\n { name: \"top\", body: \"TOP\" },\n { name: \"bottom\", body: \"BOTTOM\" },\n ],\n global,\n anim1,\n anim2,\n showCenterDiv = false,\n className,\n style,\n}) => {\n const resolvedAnim1 = toAnimationShorthand(anim1);\n const resolvedAnim2 = toAnimationShorthand(anim2);\n const animation = [resolvedAnim1, resolvedAnim2].filter(Boolean).join(\", \");\n\n const stageStyle: CSSProperties = {\n perspective: `${perspective}px`,\n perspectiveOrigin,\n };\n\n const wrapperStyle: CSSProperties = {\n // consumed by CSS var\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n \"--obj-w\": `${width}px`,\n \"--obj-h\": `${height}px`,\n width,\n height,\n \"animation\": animation || undefined,\n };\n\n return (\n <div\n className={`anim3d-stage ${className ?? \"\"}`}\n style={{ ...stageStyle, ...style }}\n >\n <div className='anim3d-wrapper' style={wrapperStyle as any}>\n {showCenterDiv && <div className='anim3d-center' />}\n {faces.map((f, i) => (\n <Face\n key={`${f.name}-${i}`}\n w={width}\n h={height}\n d={depth}\n face={f}\n global={global}\n />\n ))}\n </div>\n </div>\n );\n};\n\nexport default Obj;\nexport { Obj };\n","import type { AnimationConfig } from \"./types\";\n\nlet counter = 0;\nconst uid = () => (++counter).toString(36);\n\n/** Create (or reuse) a <style> tag for dynamic keyframes */\nfunction ensureStyleTag(): HTMLStyleElement {\n let tag = document.getElementById(\n \"anim3d-keyframes\"\n ) as HTMLStyleElement | null;\n if (!tag) {\n tag = document.createElement(\"style\");\n tag.id = \"anim3d-keyframes\";\n document.head.appendChild(tag);\n }\n return tag;\n}\n\nfunction inject(css: string) {\n if (typeof document === \"undefined\") return; // SSR\n const tag = ensureStyleTag();\n tag.appendChild(document.createTextNode(css));\n}\n\n/** Keyframes text for built-ins */\nfunction builtInKeyframes(name: string, cfg: AnimationConfig) {\n const hi = cfg.degreesHi ?? 15;\n const lo = cfg.degreesLow ?? -15;\n switch (name) {\n case \"Y360\":\n return `@keyframes Y360 { from { transform: rotateY(0deg) } to { transform: rotateY(360deg) } }`;\n case \"X360\":\n return `@keyframes X360 { from { transform: rotateX(0deg) } to { transform: rotateX(360deg) } }`;\n case \"Z360\":\n return `@keyframes Z360 { from { transform: rotateZ(0deg) } to { transform: rotateZ(360deg) } }`;\n case \"rockY\":\n return `@keyframes rockY { 0%{ transform: rotateY(${lo}deg) } 50%{ transform: rotateY(${hi}deg) } 100%{ transform: rotateY(${lo}deg) } }`;\n case \"rockX\":\n return `@keyframes rockX { 0%{ transform: rotateX(${lo}deg) } 50%{ transform: rotateX(${hi}deg) } 100%{ transform: rotateX(${lo}deg) } }`;\n default:\n // Custom names: let authors supply their own @keyframes in global CSS with that name.\n return \"\";\n }\n}\n\n/** Returns a concrete animation-name and ensures keyframes exist (for built-ins) */\nexport function resolveAnimation(cfg?: AnimationConfig): string | null {\n if (!cfg) return null;\n const name = cfg.name;\n const builtIn = builtInKeyframes(name, cfg);\n if (builtIn) {\n // Ensure single injection per built-in name\n const marker = `/*kf-${name}*/`;\n if (typeof document !== \"undefined\") {\n const tag = ensureStyleTag();\n if (!tag.innerHTML.includes(marker)) {\n inject(`${builtIn}\\n${marker}`);\n }\n }\n return name; // use built-in name as animation-name\n }\n // custom: use author-provided @keyframes by name\n return name;\n}\n\n/** Build the full CSS animation shorthand from a config and resolved name */\nexport function toAnimationShorthand(cfg?: AnimationConfig): string | null {\n const name = resolveAnimation(cfg);\n if (!cfg || !name) return null;\n const dur = (cfg.duration ?? 10) + \"s\";\n const delay = (cfg.delay ?? 0) + \"s\";\n const iter = cfg.iterationCount ?? \"infinite\";\n const dir = cfg.direction ?? \"normal\";\n const timing = cfg.timing ?? \"linear\";\n const fill = cfg.fillMode ?? \"forwards\";\n const play = cfg.animationPlayState ?? \"running\";\n // name duration timing delay iteration-count direction fill-mode play-state\n return `${name} ${dur} ${timing} ${delay} ${iter} ${dir} ${fill} ${play}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA+B;;;ACM/B,SAAS,iBAAmC;AACzC,MAAI,MAAM,SAAS;AAAA,IAChB;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;AAAA,aACnB;AAAA,YAGA,QAAA,kBAAA,IAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACE,SAAA,EAAU,gBAAA;AAAA,gBACV,KAAA,EAAO;AAAA,kBACJ,GAAG,OAAA;AAAA,kBACH,SAAA,EAAW,UAAA;AAAA,kBACX,cAAA,EAAgB;AAAA,iBACnB;AAAA,gBAEC,QAAA,EAAA;AAAA,kBAAA,aAAA,oBAAiB,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,eAAA,EAAgB,CAAA;AAAA,kBAChD,QAAA,CAAS,IAAI,UAAU;AAAA;AAAA;AAAA;AAC3B;AAAA;AACH;AAAA,KACH;AAAA,EAEN;AACH;AAEA,GAAA,CAAI,WAAA,GAAc,KAAA","file":"index.js","sourcesContent":["import type { AnimationConfig } from \"./types\";\n\n/** Create (or reuse) a <style> tag for dynamic keyframes */\nfunction ensureStyleTag(): HTMLStyleElement {\n let tag = document.getElementById(\n \"anim3d-keyframes\"\n ) as HTMLStyleElement | null;\n if (!tag) {\n tag = document.createElement(\"style\");\n tag.id = \"anim3d-keyframes\";\n document.head.appendChild(tag);\n }\n return tag;\n}\n\nfunction inject(css: string) {\n if (typeof document === \"undefined\") return; // SSR\n const tag = ensureStyleTag();\n tag.appendChild(document.createTextNode(css));\n}\n\n/** Keyframes text for built-ins */\nfunction builtInKeyframes(name: string, cfg: AnimationConfig) {\n const hi = cfg.degreesHi ?? 15;\n const lo = cfg.degreesLow ?? -15;\n switch (name) {\n case \"Y360\":\n return `@keyframes Y360 { from { transform: rotateY(0deg) } to { transform: rotateY(360deg) } }`;\n case \"X360\":\n return `@keyframes X360 { from { transform: rotateX(0deg) } to { transform: rotateX(360deg) } }`;\n case \"Z360\":\n return `@keyframes Z360 { from { transform: rotateZ(0deg) } to { transform: rotateZ(360deg) } }`;\n case \"rockY\":\n return `@keyframes rockY { 0%{ transform: rotateY(${lo}deg) } 50%{ transform: rotateY(${hi}deg) } 100%{ transform: rotateY(${lo}deg) } }`;\n case \"rockX\":\n return `@keyframes rockX { 0%{ transform: rotateX(${lo}deg) } 50%{ transform: rotateX(${hi}deg) } 100%{ transform: rotateX(${lo}deg) } }`;\n default:\n // Custom names: let authors supply their own @keyframes in global CSS with that name.\n return \"\";\n }\n}\n\n/** Returns a concrete animation-name and ensures keyframes exist (for built-ins) */\nexport function resolveAnimation(cfg?: AnimationConfig): string | null {\n if (!cfg) return null;\n const name = cfg.name;\n const builtIn = builtInKeyframes(name, cfg);\n if (builtIn) {\n // Ensure single injection per built-in name\n const marker = `/*kf-${name}*/`;\n if (typeof document !== \"undefined\") {\n const tag = ensureStyleTag();\n if (!tag.innerHTML.includes(marker)) {\n inject(`${builtIn}\\n${marker}`);\n }\n }\n return name; // use built-in name as animation-name\n }\n // custom: use author-provided @keyframes by name\n return name;\n}\n\n/** Build the full CSS animation shorthand from a config and resolved name */\nexport function toAnimationShorthand(cfg?: AnimationConfig): string | null {\n const name = resolveAnimation(cfg);\n if (!cfg || !name) return null;\n const dur = (cfg.duration ?? 10) + \"s\";\n const delay = (cfg.delay ?? 0) + \"s\";\n const iter = cfg.iterationCount ?? \"infinite\";\n const dir = cfg.direction ?? \"normal\";\n const timing = cfg.timing ?? \"linear\";\n const fill = cfg.fillMode ?? \"forwards\";\n const play = cfg.animationPlayState ?? \"running\";\n // name duration timing delay iteration-count direction fill-mode play-state\n return `${name} ${dur} ${timing} ${delay} ${iter} ${dir} ${fill} ${play}`;\n}\n","import * as React from \"react\";\nimport type {\n ObjProps,\n FaceDef,\n FaceName,\n GlobalDef,\n} from \"../types\";\nimport { toAnimationShorthand } from \"../keyframes\";\nimport \"../styles/obj.css\";\n\n// Re-export the canonical ObjProps from types.ts\nexport type { ObjProps } from \"../types\";\n\n/* ------------------------------------------------------------------ */\n/* Face transform map */\n/* ------------------------------------------------------------------ */\n\nfunction faceTransform(\n name: string,\n w: number,\n h: number,\n d: number\n): string {\n const hw = w / 2;\n const hh = h / 2;\n const hd = d / 2;\n\n switch (name as FaceName) {\n case \"front\":\n return `translate(-50%, -50%) translateZ(${hd}px)`;\n case \"back\":\n return `translate(-50%, -50%) rotateY(180deg) translateZ(${hd}px)`;\n case \"left\":\n return `translate(-50%, -50%) rotateY(-90deg) translateZ(${hw}px)`;\n case \"right\":\n return `translate(-50%, -50%) rotateY(90deg) translateZ(${hw}px)`;\n case \"top\":\n return `translate(-50%, -50%) rotateX(90deg) translateZ(${hh}px)`;\n case \"bottom\":\n return `translate(-50%, -50%) rotateX(-90deg) translateZ(${hh}px)`;\n // Legacy names – map to angled half-faces\n case \"top_front\":\n return `translate(-50%, -50%) rotateX(45deg) translateZ(${hh}px)`;\n case \"top_rear\":\n return `translate(-50%, -50%) rotateX(135deg) translateZ(${hh}px)`;\n case \"bottom_front\":\n return `translate(-50%, -50%) rotateX(-45deg) translateZ(${hh}px)`;\n case \"bottom_rear\":\n return `translate(-50%, -50%) rotateX(-135deg) translateZ(${hh}px)`;\n default:\n return `translate(-50%, -50%) translateZ(${hd}px)`;\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Parse a legacy CSS text string into a CSSProperties object */\n/* ------------------------------------------------------------------ */\n\nfunction parseCssText(css?: string): React.CSSProperties {\n if (!css) return {};\n const style: Record<string, string> = {};\n css.split(\";\").forEach((rule) => {\n const [prop, ...rest] = rule.split(\":\");\n if (!prop || rest.length === 0) return;\n const key = prop\n .trim()\n .replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n style[key] = rest.join(\":\").trim();\n });\n return style as React.CSSProperties;\n}\n\n/* ------------------------------------------------------------------ */\n/* Resolve face dimensions for non-standard faces */\n/* ------------------------------------------------------------------ */\n\nfunction faceDimensions(\n name: string,\n w: number,\n h: number,\n d: number\n): { width: number; height: number } {\n switch (name as FaceName) {\n case \"left\":\n case \"right\":\n return { width: d, height: h };\n case \"top\":\n case \"bottom\":\n case \"top_front\":\n case \"top_rear\":\n case \"bottom_front\":\n case \"bottom_rear\":\n return { width: w, height: d };\n default:\n return { width: w, height: h };\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Default 6-sided cube when no faces are provided */\n/* ------------------------------------------------------------------ */\n\nconst DEFAULT_FACE_NAMES: FaceName[] = [\n \"front\",\n \"back\",\n \"left\",\n \"right\",\n \"top\",\n \"bottom\",\n];\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const Obj: React.FC<ObjProps> = React.memo(\n ({\n width = 160,\n height = 160,\n depth = 150,\n perspective = 600,\n perspectiveOrigin = \"50% 50%\",\n faces,\n global: globalDef,\n anim1,\n anim2,\n showCenterDiv = false,\n className,\n style,\n }) => {\n const w = typeof width === \"number\" ? width : parseFloat(width);\n const h = typeof height === \"number\" ? height : parseFloat(height);\n const d = typeof depth === \"number\" ? depth : parseFloat(depth);\n\n // Resolve animation shorthands\n const animation1 = toAnimationShorthand(anim1) ?? undefined;\n const animation2 = toAnimationShorthand(anim2) ?? undefined;\n\n // Determine which faces to render\n const faceList: FaceDef[] =\n faces && faces.length > 0\n ? faces\n : DEFAULT_FACE_NAMES.map((name) => ({ name }));\n\n // Merge global defaults into each face\n const renderFace = (face: FaceDef, i: number) => {\n const dims = faceDimensions(face.name, w, h, d);\n const transform = faceTransform(face.name, w, h, d);\n\n const globalStyle = parseCssText(globalDef?.css);\n const faceInlineStyle = parseCssText(face.css);\n\n const mergedStyle: React.CSSProperties = {\n ...globalStyle,\n ...(globalDef?.style ?? {}),\n ...faceInlineStyle,\n ...(face.style ?? {}),\n width: dims.width,\n height: dims.height,\n transform,\n };\n\n const body = face.body ?? globalDef?.body ?? null;\n const faceClassName = [\n \"anim3d-face\",\n face.className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n key={face.name + \"-\" + i}\n className={faceClassName}\n style={mergedStyle}\n >\n {body}\n </div>\n );\n };\n\n const cssVars = {\n \"--obj-w\": w + \"px\",\n \"--obj-h\": h + \"px\",\n \"--obj-d\": d + \"px\",\n } as React.CSSProperties;\n\n return (\n <div\n className={[\"anim3d-stage\", className].filter(Boolean).join(\" \")}\n style={{\n perspective,\n perspectiveOrigin,\n ...cssVars,\n ...style,\n }}\n data-anim-3d-obj\n role=\"img\"\n aria-label=\"3D object\"\n >\n {/* Outer animation wrapper (anim1) */}\n <div\n className=\"anim3d-wrapper\"\n style={{\n ...cssVars,\n animation: animation1,\n transformStyle: \"preserve-3d\",\n }}\n >\n {/* Inner animation wrapper (anim2) */}\n <div\n className=\"anim3d-wrapper\"\n style={{\n ...cssVars,\n animation: animation2,\n transformStyle: \"preserve-3d\",\n }}\n >\n {showCenterDiv && <div className=\"anim3d-center\" />}\n {faceList.map(renderFace)}\n </div>\n </div>\n </div>\n );\n }\n);\n\nObj.displayName = \"Obj\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anim-3d-obj",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Configurable 3D object with animated rotations and face content",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "mdnelles",
|
|
@@ -8,39 +8,36 @@
|
|
|
8
8
|
"dist/**/*.css",
|
|
9
9
|
"src/styles/obj.css"
|
|
10
10
|
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"types": "dist/
|
|
11
|
+
"main": "dist/index.cjs",
|
|
12
|
+
"module": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"import": "./dist/esm/components/Obj.js",
|
|
22
|
-
"require": "./dist/cjs/components/Obj.cjs",
|
|
23
|
-
"types": "./dist/esm/components/Obj.d.ts"
|
|
24
|
-
},
|
|
25
|
-
"./dist/cjs/components/Obj": "./dist/cjs/components/Obj.cjs"
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
26
21
|
},
|
|
27
22
|
"files": [
|
|
28
|
-
"dist"
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
29
26
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsup",
|
|
32
|
-
"clean": "rm -rf dist",
|
|
33
|
-
"dev": "tsup --watch",
|
|
34
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
35
|
-
},
|
|
36
27
|
"peerDependencies": {
|
|
37
|
-
"react": ">=17 || >=18",
|
|
38
|
-
"react-dom": ">=17 || >=18"
|
|
28
|
+
"react": ">=17 || >=18 || >=19",
|
|
29
|
+
"react-dom": ">=17 || >=18 || >=19"
|
|
39
30
|
},
|
|
40
31
|
"devDependencies": {
|
|
41
|
-
"@types/react": "^
|
|
42
|
-
"@types/react-dom": "^
|
|
32
|
+
"@types/react": "^19.0.0",
|
|
33
|
+
"@types/react-dom": "^19.0.0",
|
|
43
34
|
"tsup": "^8.5.0",
|
|
44
|
-
"typescript": "^5.
|
|
35
|
+
"typescript": "^5.4.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"build": "tsup",
|
|
40
|
+
"dev": "tsup --watch",
|
|
41
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
45
42
|
}
|
|
46
43
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AnimationDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
|
|
4
|
-
type AnimationFill = "none" | "forwards" | "backwards" | "both";
|
|
5
|
-
type AnimationPlayState = "running" | "paused";
|
|
6
|
-
type TimingFn = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | string;
|
|
7
|
-
type BuiltInAnimName = "Y360" | "X360" | "Z360" | "rockY" | "rockX";
|
|
8
|
-
type AnimationConfig = {
|
|
9
|
-
name: BuiltInAnimName | string;
|
|
10
|
-
degreesHi?: number;
|
|
11
|
-
degreesLow?: number;
|
|
12
|
-
duration?: number;
|
|
13
|
-
delay?: number;
|
|
14
|
-
iterationCount?: number | "infinite";
|
|
15
|
-
direction?: AnimationDirection;
|
|
16
|
-
timing?: TimingFn;
|
|
17
|
-
fillMode?: AnimationFill;
|
|
18
|
-
animationPlayState?: AnimationPlayState;
|
|
19
|
-
};
|
|
20
|
-
type FaceName = "front" | "back" | "left" | "right" | "top" | "bottom" | "top_rear" | "top_front" | "bottom_rear" | "bottom_front";
|
|
21
|
-
type FaceDef = {
|
|
22
|
-
name: FaceName | string;
|
|
23
|
-
css?: string;
|
|
24
|
-
style?: CSSProperties;
|
|
25
|
-
body?: ReactNode | string;
|
|
26
|
-
className?: string;
|
|
27
|
-
};
|
|
28
|
-
type GlobalDef = {
|
|
29
|
-
css?: string;
|
|
30
|
-
style?: CSSProperties;
|
|
31
|
-
body?: ReactNode | string;
|
|
32
|
-
};
|
|
33
|
-
type ObjProps = {
|
|
34
|
-
width?: number;
|
|
35
|
-
height?: number;
|
|
36
|
-
depth?: number;
|
|
37
|
-
perspective?: number;
|
|
38
|
-
perspectiveOrigin?: string;
|
|
39
|
-
faces?: FaceDef[];
|
|
40
|
-
global?: GlobalDef;
|
|
41
|
-
anim1?: AnimationConfig;
|
|
42
|
-
anim2?: AnimationConfig;
|
|
43
|
-
showCenterDiv?: boolean;
|
|
44
|
-
className?: string;
|
|
45
|
-
style?: CSSProperties;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
declare const Obj: React.FC<ObjProps>;
|
|
49
|
-
|
|
50
|
-
export { type AnimationConfig as A, type BuiltInAnimName as B, type FaceDef as F, type GlobalDef as G, type ObjProps as O, Obj, type FaceName as a, Obj as default };
|
package/dist/components/Obj.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AnimationDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
|
|
4
|
-
type AnimationFill = "none" | "forwards" | "backwards" | "both";
|
|
5
|
-
type AnimationPlayState = "running" | "paused";
|
|
6
|
-
type TimingFn = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | string;
|
|
7
|
-
type BuiltInAnimName = "Y360" | "X360" | "Z360" | "rockY" | "rockX";
|
|
8
|
-
type AnimationConfig = {
|
|
9
|
-
name: BuiltInAnimName | string;
|
|
10
|
-
degreesHi?: number;
|
|
11
|
-
degreesLow?: number;
|
|
12
|
-
duration?: number;
|
|
13
|
-
delay?: number;
|
|
14
|
-
iterationCount?: number | "infinite";
|
|
15
|
-
direction?: AnimationDirection;
|
|
16
|
-
timing?: TimingFn;
|
|
17
|
-
fillMode?: AnimationFill;
|
|
18
|
-
animationPlayState?: AnimationPlayState;
|
|
19
|
-
};
|
|
20
|
-
type FaceName = "front" | "back" | "left" | "right" | "top" | "bottom" | "top_rear" | "top_front" | "bottom_rear" | "bottom_front";
|
|
21
|
-
type FaceDef = {
|
|
22
|
-
name: FaceName | string;
|
|
23
|
-
css?: string;
|
|
24
|
-
style?: CSSProperties;
|
|
25
|
-
body?: ReactNode | string;
|
|
26
|
-
className?: string;
|
|
27
|
-
};
|
|
28
|
-
type GlobalDef = {
|
|
29
|
-
css?: string;
|
|
30
|
-
style?: CSSProperties;
|
|
31
|
-
body?: ReactNode | string;
|
|
32
|
-
};
|
|
33
|
-
type ObjProps = {
|
|
34
|
-
width?: number;
|
|
35
|
-
height?: number;
|
|
36
|
-
depth?: number;
|
|
37
|
-
perspective?: number;
|
|
38
|
-
perspectiveOrigin?: string;
|
|
39
|
-
faces?: FaceDef[];
|
|
40
|
-
global?: GlobalDef;
|
|
41
|
-
anim1?: AnimationConfig;
|
|
42
|
-
anim2?: AnimationConfig;
|
|
43
|
-
showCenterDiv?: boolean;
|
|
44
|
-
className?: string;
|
|
45
|
-
style?: CSSProperties;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
declare const Obj: React.FC<ObjProps>;
|
|
49
|
-
|
|
50
|
-
export { type AnimationConfig as A, type BuiltInAnimName as B, type FaceDef as F, type GlobalDef as G, type ObjProps as O, Obj, type FaceName as a, Obj as default };
|