@cos-design/photo-postcard 3.7.3 → 4.0.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/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +178 -0
- package/dist/core/packages/photoPostcard/src/core.d.ts +1 -0
- package/dist/core/packages/photoPostcard/src/element.d.ts +1 -0
- package/dist/core/packages/photoPostcard/src/react.d.ts +3 -0
- package/dist/core/packages/photoPostcard/src/vue.d.ts +2 -0
- package/dist/core/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/core/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/core/packages/shared/src/index.d.ts +11 -0
- package/dist/core/packages/shared/src/math.d.ts +2 -0
- package/dist/core/packages/shared/src/photo.d.ts +15 -0
- package/dist/core/packages/shared/src/pointer.d.ts +14 -0
- package/dist/core/packages/shared/src/react/index.d.ts +30 -0
- package/dist/core/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/core/packages/shared/src/size.d.ts +8 -0
- package/dist/core/packages/shared/src/visibility.d.ts +2 -0
- package/dist/core/src/components/photoPostcard/core/engine.d.ts +6 -0
- package/dist/core/src/components/photoPostcard/core/index.d.ts +2 -0
- package/dist/core/src/components/photoPostcard/core/types.d.ts +7 -0
- package/dist/core/src/components/photoPostcard/element/index.d.ts +13 -0
- package/dist/core/src/components/photoPostcard/index.d.ts +3 -0
- package/dist/{src/components/photoPostcard → core/src/components/photoPostcard/react}/index.d.ts +4 -2
- package/dist/{src → core/src}/components/photoPostcard/types.d.ts +2 -2
- package/dist/{src → core/src}/vite-env.d.ts +6 -0
- package/dist/element/element.css +1 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +254 -0
- package/dist/element/packages/photoPostcard/src/core.d.ts +1 -0
- package/dist/element/packages/photoPostcard/src/element.d.ts +1 -0
- package/dist/element/packages/photoPostcard/src/index.d.ts +3 -0
- package/dist/element/packages/photoPostcard/src/react.d.ts +3 -0
- package/dist/element/packages/photoPostcard/src/vue.d.ts +2 -0
- package/dist/element/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/element/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/element/packages/shared/src/index.d.ts +11 -0
- package/dist/element/packages/shared/src/math.d.ts +2 -0
- package/dist/element/packages/shared/src/photo.d.ts +15 -0
- package/dist/element/packages/shared/src/pointer.d.ts +14 -0
- package/dist/element/packages/shared/src/react/index.d.ts +30 -0
- package/dist/element/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/element/packages/shared/src/size.d.ts +8 -0
- package/dist/element/packages/shared/src/visibility.d.ts +2 -0
- package/dist/element/src/components/photoPostcard/core/engine.d.ts +6 -0
- package/dist/element/src/components/photoPostcard/core/index.d.ts +2 -0
- package/dist/element/src/components/photoPostcard/core/types.d.ts +7 -0
- package/dist/element/src/components/photoPostcard/element/index.d.ts +13 -0
- package/dist/element/src/components/photoPostcard/index.d.ts +3 -0
- package/dist/element/src/components/photoPostcard/react/index.d.ts +10 -0
- package/dist/element/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/element/src/vite-env.d.ts +45 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/{index.js → react/index.js} +35 -62
- package/dist/react/packages/photoPostcard/src/core.d.ts +1 -0
- package/dist/react/packages/photoPostcard/src/element.d.ts +1 -0
- package/dist/react/packages/photoPostcard/src/index.d.ts +3 -0
- package/dist/react/packages/photoPostcard/src/react.d.ts +3 -0
- package/dist/react/packages/photoPostcard/src/vue.d.ts +2 -0
- package/dist/react/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/react/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/react/packages/shared/src/index.d.ts +11 -0
- package/dist/react/packages/shared/src/math.d.ts +2 -0
- package/dist/react/packages/shared/src/photo.d.ts +15 -0
- package/dist/react/packages/shared/src/pointer.d.ts +14 -0
- package/dist/react/packages/shared/src/react/index.d.ts +30 -0
- package/dist/react/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/react/packages/shared/src/size.d.ts +8 -0
- package/dist/react/packages/shared/src/visibility.d.ts +2 -0
- package/dist/react/react.css +1 -0
- package/dist/react/src/components/photoPostcard/core/engine.d.ts +6 -0
- package/dist/react/src/components/photoPostcard/core/index.d.ts +2 -0
- package/dist/react/src/components/photoPostcard/core/types.d.ts +7 -0
- package/dist/react/src/components/photoPostcard/element/index.d.ts +13 -0
- package/dist/react/src/components/photoPostcard/index.d.ts +3 -0
- package/dist/react/src/components/photoPostcard/react/index.d.ts +10 -0
- package/dist/react/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/react/src/vite-env.d.ts +45 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +226 -0
- package/dist/vue/packages/photoPostcard/src/core.d.ts +1 -0
- package/dist/vue/packages/photoPostcard/src/element.d.ts +1 -0
- package/dist/vue/packages/photoPostcard/src/index.d.ts +3 -0
- package/dist/vue/packages/photoPostcard/src/react.d.ts +3 -0
- package/dist/vue/packages/photoPostcard/src/vue.d.ts +2 -0
- package/dist/vue/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/vue/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/vue/packages/shared/src/index.d.ts +11 -0
- package/dist/vue/packages/shared/src/math.d.ts +2 -0
- package/dist/vue/packages/shared/src/photo.d.ts +15 -0
- package/dist/vue/packages/shared/src/pointer.d.ts +14 -0
- package/dist/vue/packages/shared/src/react/index.d.ts +30 -0
- package/dist/vue/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/vue/packages/shared/src/size.d.ts +8 -0
- package/dist/vue/packages/shared/src/visibility.d.ts +2 -0
- package/dist/vue/src/components/photoPostcard/core/engine.d.ts +6 -0
- package/dist/vue/src/components/photoPostcard/core/index.d.ts +2 -0
- package/dist/vue/src/components/photoPostcard/core/types.d.ts +7 -0
- package/dist/vue/src/components/photoPostcard/element/index.d.ts +13 -0
- package/dist/vue/src/components/photoPostcard/index.d.ts +3 -0
- package/dist/vue/src/components/photoPostcard/react/index.d.ts +10 -0
- package/dist/vue/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/vue/src/vite-env.d.ts +45 -0
- package/dist/vue/vue.css +1 -0
- package/package.json +45 -10
- package/dist/index.cjs +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -3
- /package/dist/{packages → core/packages}/photoPostcard/src/index.d.ts +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { createElementBlock as e, defineComponent as t, onMounted as n, onUnmounted as r, openBlock as i, ref as a, watch as o } from "vue";
|
|
2
|
+
import { applyBlockHostBox as s, optionsFingerprint as c } from "@cos-design/shared";
|
|
3
|
+
import './vue.css';//#region src/components/photoPostcard/core/engine.ts
|
|
4
|
+
var l = "cos-photo-postcard", u = 6, d = 280, f = 320, p = (e, t) => t <= 0 ? 0 : (e % t + t) % t, m = (e, t) => t <= 0 ? 0 : Math.max(0, Math.min(t - 1, Math.floor(e))), h = (e) => {
|
|
5
|
+
let t = Math.sin(e * 127.1 + 31.7) * 43758.5453;
|
|
6
|
+
return t - Math.floor(t);
|
|
7
|
+
}, g = (e, t) => {
|
|
8
|
+
if (t) for (let [n, r] of Object.entries(t)) r != null && (n.startsWith("--") ? e.style.setProperty(n, String(r)) : e.style[n] = typeof r == "number" ? `${r}px` : String(r));
|
|
9
|
+
}, _ = (e, t, n) => {
|
|
10
|
+
let r = n && (t.title || t.description), i = t.title ? t.title : "Greetings from the road";
|
|
11
|
+
e.replaceChildren();
|
|
12
|
+
let a = document.createElement("div");
|
|
13
|
+
a.className = `${l}__face ${l}__front`;
|
|
14
|
+
let o = document.createElement("div");
|
|
15
|
+
o.className = `${l}__photo-frame${r ? ` ${l}__photo-frame-with-caption` : ""}`;
|
|
16
|
+
let s = document.createElement("div");
|
|
17
|
+
s.className = `${l}__photo-wrap`;
|
|
18
|
+
let c = document.createElement("img");
|
|
19
|
+
c.className = `${l}__photo`, c.src = t.src, c.alt = t.alt ?? t.title ?? "", c.draggable = !1, s.appendChild(c), o.appendChild(s);
|
|
20
|
+
let u = document.createElement("div");
|
|
21
|
+
if (u.className = `${l}__corner-stamp`, u.setAttribute("aria-hidden", "true"), a.append(o, u), r) {
|
|
22
|
+
let e = document.createElement("div");
|
|
23
|
+
if (e.className = `${l}__front-caption`, t.title) {
|
|
24
|
+
let n = document.createElement("p");
|
|
25
|
+
n.className = `${l}__front-caption-title`, n.textContent = t.title, e.appendChild(n);
|
|
26
|
+
}
|
|
27
|
+
if (t.description) {
|
|
28
|
+
let n = document.createElement("p");
|
|
29
|
+
n.className = `${l}__front-caption-desc`, n.textContent = t.description, e.appendChild(n);
|
|
30
|
+
}
|
|
31
|
+
a.appendChild(e);
|
|
32
|
+
}
|
|
33
|
+
let d = document.createElement("div");
|
|
34
|
+
d.className = `${l}__face ${l}__back`;
|
|
35
|
+
let f = document.createElement("div");
|
|
36
|
+
f.className = `${l}__divider`, f.setAttribute("aria-hidden", "true");
|
|
37
|
+
let p = document.createElement("div");
|
|
38
|
+
p.className = `${l}__lined-paper`;
|
|
39
|
+
let m = document.createElement("p");
|
|
40
|
+
m.className = `${l}__greeting`, m.textContent = i, p.appendChild(m);
|
|
41
|
+
let h = document.createElement("p");
|
|
42
|
+
t.description ? (h.className = `${l}__body-text`, h.textContent = t.description) : (h.className = `${l}__body-placeholder`, h.textContent = "Wish you were here…"), p.appendChild(h);
|
|
43
|
+
let g = document.createElement("div");
|
|
44
|
+
g.className = `${l}__back-footer`;
|
|
45
|
+
let _ = document.createElement("div");
|
|
46
|
+
_.className = `${l}__postmark`, _.setAttribute("aria-hidden", "true");
|
|
47
|
+
let v = document.createElement("span");
|
|
48
|
+
v.className = `${l}__postmark-text`, v.innerHTML = "TRAVEL<br>POST", _.appendChild(v);
|
|
49
|
+
let y = document.createElement("div");
|
|
50
|
+
y.className = `${l}__stamp-square`, y.setAttribute("aria-hidden", "true"), g.append(_, y), d.append(f, p, g), e.append(a, d);
|
|
51
|
+
};
|
|
52
|
+
function v(e, t = { photos: [] }) {
|
|
53
|
+
let n = {
|
|
54
|
+
width: 360,
|
|
55
|
+
height: 420,
|
|
56
|
+
cardWidth: 260,
|
|
57
|
+
cardHeight: 170,
|
|
58
|
+
pullThreshold: 80,
|
|
59
|
+
showCaption: !0,
|
|
60
|
+
initialIndex: 0,
|
|
61
|
+
initialFlipped: !1,
|
|
62
|
+
ariaLabel: "明信片",
|
|
63
|
+
...t,
|
|
64
|
+
photos: Array.isArray(t.photos) ? t.photos : []
|
|
65
|
+
}, r = !1, i = m(n.initialIndex ?? 0, n.photos.length), a = !!n.initialFlipped, o = 0, c = "idle", v = null, y = null, b = null, x = "", S = document.createElement("div"), C = document.createElement("div");
|
|
66
|
+
C.className = `${l}__stage`;
|
|
67
|
+
let w = document.createElement("div");
|
|
68
|
+
w.className = `${l}__empty`, w.textContent = "暂无明信片";
|
|
69
|
+
let T = document.createElement("div");
|
|
70
|
+
T.className = `${l}__stack`;
|
|
71
|
+
let E = document.createElement("div");
|
|
72
|
+
E.className = `${l}__card-slot`;
|
|
73
|
+
let D = document.createElement("div"), O = document.createElement("div");
|
|
74
|
+
O.className = `${l}__flip-inner`, D.appendChild(O), E.appendChild(D);
|
|
75
|
+
let k = document.createElement("div");
|
|
76
|
+
k.className = `${l}__hint`, k.textContent = "拖拽切换 · 点击查看背面", C.append(w, T, k), S.appendChild(C), e.appendChild(S);
|
|
77
|
+
let A = () => Array.isArray(n.photos) ? n.photos : [], j = () => A().length, M = (e, t) => e ? `${e.src}\0${e.title ?? ""}\0${e.description ?? ""}\0${e.alt ?? ""}\0${t}` : "", N = () => {
|
|
78
|
+
D.className = [
|
|
79
|
+
`${l}__card-active`,
|
|
80
|
+
a ? `${l}__flipped` : "",
|
|
81
|
+
c === "exiting" ? `${l}__card-exiting` : ""
|
|
82
|
+
].filter(Boolean).join(" "), D.style.transform = `translateX(${o}px)`, D.style.transition = c === "snapping" || c === "exiting" ? `transform ${c === "exiting" ? d : f}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${d}ms ease` : "none", D.style.opacity = c === "exiting" ? "0.55" : "1", D.setAttribute("aria-pressed", String(a));
|
|
83
|
+
let e = A()[i];
|
|
84
|
+
D.setAttribute("aria-label", e ? `${a ? "背面" : "正面"}:${e.alt ?? e.title ?? `明信片 ${i + 1}`}` : "");
|
|
85
|
+
}, P = (e, t, n) => {
|
|
86
|
+
let r = new Set([E]);
|
|
87
|
+
for (let e of [...T.children]) r.has(e) || e.remove();
|
|
88
|
+
let a = e <= 1 ? [] : [1, 2].slice(0, Math.min(2, e - 1)).map((e) => {
|
|
89
|
+
let t = i * 13.7 + e * 5.3;
|
|
90
|
+
return {
|
|
91
|
+
depth: e,
|
|
92
|
+
rot: (h(t) * 2 - 1) * 5.5,
|
|
93
|
+
dx: e * 5 + h(t + 1.1) * 4,
|
|
94
|
+
dy: e * 3 + h(t + 2.4) * 3
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
for (let { depth: e, rot: r, dx: i, dy: o } of a) {
|
|
98
|
+
let a = document.createElement("div");
|
|
99
|
+
a.className = `${l}__stack-card`, a.style.width = `${t}px`, a.style.height = `${n}px`, a.style.transform = `translate(calc(-50% + ${i}px), calc(-50% + ${o}px)) rotate(${r}deg)`, a.style.opacity = e === 1 ? "0.92" : "0.78", a.setAttribute("aria-hidden", "true"), T.insertBefore(a, E);
|
|
100
|
+
}
|
|
101
|
+
}, F = () => {
|
|
102
|
+
let t = A(), r = t.length, a = n.cardWidth ?? 260, o = n.cardHeight ?? 170, c = n.showCaption !== !1;
|
|
103
|
+
if (S.className = [l, n.className].filter(Boolean).join(" "), s(e, S, {
|
|
104
|
+
width: n.width ?? 360,
|
|
105
|
+
height: n.height ?? 420
|
|
106
|
+
}), g(S, n.style), S.setAttribute("role", "region"), S.setAttribute("aria-label", n.ariaLabel ?? "明信片"), S.tabIndex = 0, w.hidden = r > 0, T.hidden = r === 0, k.hidden = r <= 1, r === 0) {
|
|
107
|
+
O.replaceChildren(), x = "";
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
T.style.width = `${a}px`, T.style.height = `${o}px`, (!E.isConnected || E.parentElement !== T) && T.appendChild(E), P(r, a, o), E.style.width = `${a}px`, E.style.height = `${o}px`, D.style.width = `${a}px`, D.style.height = `${o}px`, D.setAttribute("role", "button");
|
|
111
|
+
let u = t[i], d = M(u, c);
|
|
112
|
+
u && d !== x ? (_(O, u, c), x = d) : u || (O.replaceChildren(), x = ""), N();
|
|
113
|
+
}, I = (e) => {
|
|
114
|
+
let t = A(), r = m(e, t.length);
|
|
115
|
+
i = r, a = !1, n.onFlipChange?.(!1);
|
|
116
|
+
let o = t[r];
|
|
117
|
+
o && n.onIndexChange?.(r, o);
|
|
118
|
+
}, L = (e) => {
|
|
119
|
+
I(e), o = 0, c = "idle", F();
|
|
120
|
+
}, R = (e) => {
|
|
121
|
+
let t = e * ((n.cardWidth ?? 260) * .55 + 48);
|
|
122
|
+
c = "exiting", o = t, N(), y != null && window.clearTimeout(y), y = window.setTimeout(() => {
|
|
123
|
+
L(p(i + e, A().length));
|
|
124
|
+
}, d);
|
|
125
|
+
}, z = () => {
|
|
126
|
+
c = "snapping", o = 0, N(), b != null && window.clearTimeout(b), b = window.setTimeout(() => {
|
|
127
|
+
c = "idle", N();
|
|
128
|
+
}, f);
|
|
129
|
+
}, B = (e) => {
|
|
130
|
+
A().length <= 1 || R(e > 0 ? 1 : -1);
|
|
131
|
+
}, V = () => {
|
|
132
|
+
a = !a, n.onFlipChange?.(a), N();
|
|
133
|
+
}, H = (e) => {
|
|
134
|
+
c === "exiting" || j() === 0 || (v = {
|
|
135
|
+
pointerId: e.pointerId,
|
|
136
|
+
startX: e.clientX,
|
|
137
|
+
moved: !1
|
|
138
|
+
}, c = "dragging", D.setPointerCapture(e.pointerId));
|
|
139
|
+
}, U = (e) => {
|
|
140
|
+
if (!v || v.pointerId !== e.pointerId || c === "exiting") return;
|
|
141
|
+
let t = e.clientX - v.startX;
|
|
142
|
+
Math.abs(t) > u && (v.moved = !0), o = j() <= 1 ? t * .22 : t, N();
|
|
143
|
+
}, W = (e) => {
|
|
144
|
+
if (!v || v.pointerId !== e.pointerId) return;
|
|
145
|
+
let t = v.startX, r = v.moved;
|
|
146
|
+
if (v = null, D.hasPointerCapture(e.pointerId) && D.releasePointerCapture(e.pointerId), c === "exiting") return;
|
|
147
|
+
let a = e.clientX - t;
|
|
148
|
+
if (!r) {
|
|
149
|
+
c = "idle", o = 0, V();
|
|
150
|
+
let e = A()[i];
|
|
151
|
+
e && n.onPhotoClick?.(i, e);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (Math.abs(a) >= (n.pullThreshold ?? 80) && j() > 1) {
|
|
155
|
+
R(a > 0 ? 1 : -1);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
z();
|
|
159
|
+
}, G = (e) => {
|
|
160
|
+
!v || v.pointerId !== e.pointerId || (v = null, D.hasPointerCapture(e.pointerId) && D.releasePointerCapture(e.pointerId), c !== "exiting" && z());
|
|
161
|
+
}, K = (e) => {
|
|
162
|
+
e.key === "ArrowRight" ? (e.preventDefault(), B(1)) : e.key === "ArrowLeft" ? (e.preventDefault(), B(-1)) : (e.key === " " || e.key === "Enter") && (e.preventDefault(), V());
|
|
163
|
+
};
|
|
164
|
+
return D.addEventListener("pointerdown", H), D.addEventListener("pointermove", U), D.addEventListener("pointerup", W), D.addEventListener("pointercancel", G), S.addEventListener("keydown", K), F(), {
|
|
165
|
+
update(e) {
|
|
166
|
+
let t = Array.isArray(e.photos) ? e.photos : e.photos === void 0 ? n.photos : [];
|
|
167
|
+
n = {
|
|
168
|
+
...n,
|
|
169
|
+
...e,
|
|
170
|
+
photos: t
|
|
171
|
+
}, i = m(i, A().length), F();
|
|
172
|
+
},
|
|
173
|
+
destroy() {
|
|
174
|
+
r || (r = !0, y != null && window.clearTimeout(y), b != null && window.clearTimeout(b), D.removeEventListener("pointerdown", H), D.removeEventListener("pointermove", U), D.removeEventListener("pointerup", W), D.removeEventListener("pointercancel", G), S.removeEventListener("keydown", K), S.remove());
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/components/photoPostcard/vue/PhotoPostcard.vue
|
|
180
|
+
var y = /* @__PURE__ */ t({
|
|
181
|
+
__name: "PhotoPostcard",
|
|
182
|
+
props: {
|
|
183
|
+
photos: {},
|
|
184
|
+
width: {},
|
|
185
|
+
height: {},
|
|
186
|
+
cardWidth: {},
|
|
187
|
+
cardHeight: {},
|
|
188
|
+
pullThreshold: {},
|
|
189
|
+
showCaption: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: !0
|
|
192
|
+
},
|
|
193
|
+
initialIndex: {},
|
|
194
|
+
initialFlipped: { type: Boolean },
|
|
195
|
+
onPhotoClick: {},
|
|
196
|
+
onIndexChange: {},
|
|
197
|
+
onFlipChange: {},
|
|
198
|
+
ariaLabel: {},
|
|
199
|
+
className: {},
|
|
200
|
+
style: {}
|
|
201
|
+
},
|
|
202
|
+
emits: [
|
|
203
|
+
"photo-click",
|
|
204
|
+
"index-change",
|
|
205
|
+
"flip-change"
|
|
206
|
+
],
|
|
207
|
+
setup(t, { expose: s, emit: l }) {
|
|
208
|
+
let u = t, d = l, f = a(), p = null, m = () => ({
|
|
209
|
+
...u,
|
|
210
|
+
onPhotoClick: (...e) => d("photo-click", ...e),
|
|
211
|
+
onIndexChange: (...e) => d("index-change", ...e),
|
|
212
|
+
onFlipChange: (...e) => d("flip-change", ...e)
|
|
213
|
+
});
|
|
214
|
+
return n(() => {
|
|
215
|
+
f.value && (p = v(f.value, m()));
|
|
216
|
+
}), o(() => c(u), () => p?.update(m())), r(() => {
|
|
217
|
+
p?.destroy(), p = null;
|
|
218
|
+
}), s({}), (t, n) => (i(), e("div", {
|
|
219
|
+
ref_key: "hostRef",
|
|
220
|
+
ref: f,
|
|
221
|
+
class: "cos-photoPostcard-host"
|
|
222
|
+
}, null, 512));
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
//#endregion
|
|
226
|
+
export { y as PhotoPostcard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/components/photoPostcard/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/components/photoPostcard/element';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ElementSize } from './size';
|
|
2
|
+
export interface CanvasBoxSizeInput {
|
|
3
|
+
/** 为 true 时跟随父容器尺寸(需父级有明确高度) */
|
|
4
|
+
fill?: boolean;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
defaultWidth: number;
|
|
8
|
+
defaultHeight: number;
|
|
9
|
+
measured: ElementSize;
|
|
10
|
+
}
|
|
11
|
+
export interface CanvasBoxSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
/** 是否处于 fill 模式且尚未量到有效尺寸 */
|
|
15
|
+
pending: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** 根据 fill / 显式宽高 / 测量结果解析画布逻辑尺寸 */
|
|
18
|
+
export declare const resolveCanvasBoxSize: ({ fill, width, height, defaultWidth, defaultHeight, measured, }: CanvasBoxSizeInput) => CanvasBoxSize;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Apply fill / explicit size to the adapter host and make the engine root fill it. */
|
|
2
|
+
export declare function applyCanvasHostBox(container: HTMLElement, root: HTMLElement, opts: {
|
|
3
|
+
fill: boolean;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}): void;
|
|
7
|
+
/**
|
|
8
|
+
* Size the adapter host (React/Vue div or custom element) so percentage widths
|
|
9
|
+
* don't collapse when the host is a shrink-wrapped flex child. Root fills the host
|
|
10
|
+
* unless `rootFillsHost` is false (e.g. PhotoAlbum sizes itself via CSS variables).
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyBlockHostBox(container: HTMLElement, root: HTMLElement, size: {
|
|
13
|
+
width?: number | string;
|
|
14
|
+
height?: number | string;
|
|
15
|
+
rootFillsHost?: boolean;
|
|
16
|
+
}): void;
|
|
17
|
+
/** Toggle empty-state nodes; author `display:` rules must not override `[hidden]`. */
|
|
18
|
+
export declare function setHidden(el: HTMLElement, hidden: boolean): void;
|
|
19
|
+
/** Stable JSON key for options, ignoring functions (callbacks). */
|
|
20
|
+
export declare function optionsFingerprint(value: unknown): string;
|
|
21
|
+
/** True when non-function fields differ (shallow). */
|
|
22
|
+
export declare function optionsVisualChanged(prev: Record<string, unknown>, next: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { clamp, lerp } from './math';
|
|
2
|
+
export { bindVisibilityPause } from './visibility';
|
|
3
|
+
export { prefersReducedMotion, bindPrefersReducedMotion } from './reduced-motion';
|
|
4
|
+
export { observeElementSize } from './size';
|
|
5
|
+
export type { ElementSize } from './size';
|
|
6
|
+
export { getRelativePointerPosition } from './pointer';
|
|
7
|
+
export type { PointerPosition } from './pointer';
|
|
8
|
+
export type { PhotoItem, PhotoIndexChangeHandler, PhotoFaceChangeHandler } from './photo';
|
|
9
|
+
export { resolveCanvasBoxSize } from './canvas-box';
|
|
10
|
+
export type { CanvasBoxSizeInput, CanvasBoxSize } from './canvas-box';
|
|
11
|
+
export { applyCanvasHostBox, applyBlockHostBox, setHidden, optionsFingerprint, optionsVisualChanged, } from './host-layout';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 图片预览组件通用照片项 */
|
|
2
|
+
export interface PhotoItem {
|
|
3
|
+
/** 图片地址 */
|
|
4
|
+
src: string;
|
|
5
|
+
/** 图片替代文本 */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** 照片标题 */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** 照片说明 */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
/** 线性浏览:当前索引变化(相册 / 胶卷 / 晾绳等) */
|
|
13
|
+
export type PhotoIndexChangeHandler<T = PhotoItem> = (index: number, photo: T) => void;
|
|
14
|
+
/** 环形浏览:正对镜头的面变化(走马灯 / 旋转木马等) */
|
|
15
|
+
export type PhotoFaceChangeHandler<T = PhotoItem> = (index: number, photo?: T) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PointerPosition {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
type PointLike = {
|
|
6
|
+
clientX: number;
|
|
7
|
+
clientY: number;
|
|
8
|
+
};
|
|
9
|
+
/** 相对元素左上角的指针坐标(兼容 mouse / touch / pointer) */
|
|
10
|
+
export declare const getRelativePointerPosition: (element: Element, event: PointLike | {
|
|
11
|
+
touches?: ArrayLike<PointLike>;
|
|
12
|
+
changedTouches?: ArrayLike<PointLike>;
|
|
13
|
+
}) => PointerPosition | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CSSProperties, RefObject } from 'react';
|
|
2
|
+
import { ElementSize } from '../size';
|
|
3
|
+
export type { CanvasBoxSize, CanvasBoxSizeInput } from '../canvas-box';
|
|
4
|
+
export { resolveCanvasBoxSize } from '../canvas-box';
|
|
5
|
+
export interface UseElementSizeOptions {
|
|
6
|
+
/** 为 false 时不观察 */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** 观察元素尺寸(clientWidth / clientHeight) */
|
|
10
|
+
export declare const useElementSize: <T extends Element>(ref: RefObject<T | null>, options?: UseElementSizeOptions) => ElementSize;
|
|
11
|
+
export interface UseCanvasBoxOptions {
|
|
12
|
+
/** 为 true 时铺满父容器(父级需有明确高度) */
|
|
13
|
+
fill?: boolean;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
defaultWidth: number;
|
|
17
|
+
defaultHeight: number;
|
|
18
|
+
}
|
|
19
|
+
export interface UseCanvasBoxResult {
|
|
20
|
+
hostRef: RefObject<HTMLDivElement | null>;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
/** 挂到宿主容器的样式(fill 时为 100%×100%) */
|
|
24
|
+
hostStyle: CSSProperties;
|
|
25
|
+
fill: boolean;
|
|
26
|
+
/** 是否处于 fill 模式且尚未量到有效尺寸 */
|
|
27
|
+
pending: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** 画布/效果宿主尺寸:fill 时跟随父容器,否则用显式宽高或默认值 */
|
|
30
|
+
export declare const useCanvasBox: ({ fill, width: widthProp, height: heightProp, defaultWidth, defaultHeight, }: UseCanvasBoxOptions) => UseCanvasBoxResult;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PhotoPostcardController, PhotoPostcardOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Imperative port of the v3.8.x PhotoPostcard React behavior.
|
|
4
|
+
* Motion updates only touch transform/opacity/class — never detach the active card.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createPhotoPostcard(container: HTMLElement, initial?: PhotoPostcardOptions): PhotoPostcardController;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PhotoPostcardItem, PhotoPostcardProps } from '../types';
|
|
2
|
+
export type { PhotoPostcardItem, PhotoPostcardProps };
|
|
3
|
+
export type PhotoPostcardOptions = PhotoPostcardProps;
|
|
4
|
+
export interface PhotoPostcardController {
|
|
5
|
+
update(options: Partial<PhotoPostcardOptions>): void;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PhotoPostcardOptions } from '../core';
|
|
2
|
+
declare const TAG = "cos-photo-postcard";
|
|
3
|
+
declare class CosPhotoPostcardElement extends HTMLElement {
|
|
4
|
+
private ctrl;
|
|
5
|
+
_photos?: PhotoPostcardOptions['photos'];
|
|
6
|
+
get photos(): PhotoPostcardOptions['photos'] | undefined;
|
|
7
|
+
set photos(value: PhotoPostcardOptions['photos']);
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
attributeChangedCallback(): void;
|
|
12
|
+
}
|
|
13
|
+
export { CosPhotoPostcardElement, TAG };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoPostcardProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 旅行明信片堆叠:单张特色明信片可 3D 翻转,水平拖拽切换上一张/下一张。
|
|
5
|
+
* React 端保持 v3.8.x 声明式实现与交互逻辑。
|
|
6
|
+
*/
|
|
7
|
+
declare const PhotoPostcard: React.FC<PhotoPostcardProps>;
|
|
8
|
+
export default PhotoPostcard;
|
|
9
|
+
export type { PhotoPostcardItem, PhotoPostcardProps } from '../types';
|
|
10
|
+
export type { PhotoPostcardOptions } from '../core/types';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type StyleMap = Record<string, string | number | undefined>;
|
|
2
|
+
/** 单张旅行明信片数据 */
|
|
3
|
+
export interface PhotoPostcardItem {
|
|
4
|
+
/** 图片地址 */
|
|
5
|
+
src: string;
|
|
6
|
+
/** 图片替代文本 */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** 明信片标题(背面问候语 / 正面说明标题) */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 明信片正文(背面书写区 / 正面说明) */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** PhotoPostcard 组件属性 */
|
|
14
|
+
export interface PhotoPostcardProps {
|
|
15
|
+
/** 明信片照片列表 */
|
|
16
|
+
photos: PhotoPostcardItem[];
|
|
17
|
+
/** 组件宽度 */
|
|
18
|
+
width?: number | string;
|
|
19
|
+
/** 组件高度 */
|
|
20
|
+
height?: number | string;
|
|
21
|
+
/** 单张明信片宽度(px) */
|
|
22
|
+
cardWidth?: number;
|
|
23
|
+
/** 单张明信片高度(px) */
|
|
24
|
+
cardHeight?: number;
|
|
25
|
+
/** 水平拖拽切换阈值(px) */
|
|
26
|
+
pullThreshold?: number;
|
|
27
|
+
/** 是否在正面底部显示标题与说明 */
|
|
28
|
+
showCaption?: boolean;
|
|
29
|
+
/** 初始展示索引 */
|
|
30
|
+
initialIndex?: number;
|
|
31
|
+
/** 初始是否背面朝上 */
|
|
32
|
+
initialFlipped?: boolean;
|
|
33
|
+
/** 点击当前明信片(几乎无位移时触发) */
|
|
34
|
+
onPhotoClick?: (index: number, photo: PhotoPostcardItem) => void;
|
|
35
|
+
/** 当前索引变化回调 */
|
|
36
|
+
onIndexChange?: (index: number, photo: PhotoPostcardItem) => void;
|
|
37
|
+
/** 正反面翻转状态变化回调 */
|
|
38
|
+
onFlipChange?: (flipped: boolean) => void;
|
|
39
|
+
/** 无障碍名称 */
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
/** 自定义类名 */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** 自定义样式 */
|
|
44
|
+
style?: StyleMap;
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue';
|
|
5
|
+
const component: DefineComponent<object, object, unknown>;
|
|
6
|
+
export default component;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '*.module.less' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.png' {
|
|
20
|
+
const src: string;
|
|
21
|
+
export default src;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.jpg' {
|
|
25
|
+
const src: string;
|
|
26
|
+
export default src;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.mp4' {
|
|
30
|
+
const src: string;
|
|
31
|
+
export default src;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.mp3' {
|
|
35
|
+
const src: string;
|
|
36
|
+
export default src;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.svg' {
|
|
40
|
+
import type { FC, SVGProps } from 'react';
|
|
41
|
+
|
|
42
|
+
export const ReactComponent: FC<SVGProps<SVGSVGElement>>;
|
|
43
|
+
const src: string;
|
|
44
|
+
export default src;
|
|
45
|
+
}
|
package/dist/vue/vue.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cos-photoPostcard-host,cos-photo-postcard{box-sizing:border-box;width:100%;max-width:100%;display:block}.cos-photo-postcard__empty[hidden]{display:none!important}.cos-photo-postcard{--card-stock:#f4f0e8;--card-edge:#e8e2d6;--ink:#3d4a4f;--ink-muted:#6b787d;--stamp-teal:#2a5f6f;--stamp-coral:#c97b6a;--line-color:#2a5f6f24;--shadow-soft:#23373e24;--shadow-deep:#1928301a;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:radial-gradient(120% 90% at 50% 108%,#2a5f6f1a 0%,#0000 58%),radial-gradient(70% 55% at 14% 8%,#ffffff6b 0%,#0000 62%),linear-gradient(168deg,#ece7de 0%,#e4dfd4 48%,#d9d3c8 100%);border-radius:14px;position:relative;overflow:hidden}.cos-photo-postcard:before{content:"";pointer-events:none;background:repeating-linear-gradient(92deg,#ffffff0d 0 1px,#0000 1px 9px),repeating-linear-gradient(8deg,#3c464b0a 0 2px,#0000 2px 16px);position:absolute;inset:0}.cos-photo-postcard__stage{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative}.cos-photo-postcard__stack{touch-action:none;position:relative}.cos-photo-postcard__stack-card{background:var(--card-stock);box-shadow:0 1px 0 #ffffff8c inset, 0 2px 4px var(--shadow-soft), 0 10px 24px var(--shadow-deep);pointer-events:none;will-change:transform;border-radius:3px;position:absolute;top:50%;left:50%}.cos-photo-postcard__stack-card:first-child{z-index:1}.cos-photo-postcard__stack-card:nth-child(2){z-index:2}.cos-photo-postcard__card-slot{z-index:3;perspective:900px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cos-photo-postcard__card-active{cursor:grab;will-change:transform;filter:drop-shadow(0 8px 18px var(--shadow-soft)) drop-shadow(0 2px 6px var(--shadow-deep));position:relative}.cos-photo-postcard__card-active:active{cursor:grabbing}.cos-photo-postcard__card-exiting{pointer-events:none}.cos-photo-postcard__flip-inner{width:100%;height:100%;transform-style:preserve-3d;transition:transform .58s cubic-bezier(.4,.12,.18,1);position:relative}.cos-photo-postcard__flipped .cos-photo-postcard__flip-inner{transform:rotateY(180deg)}.cos-photo-postcard__face{backface-visibility:hidden;transform-style:preserve-3d;background:var(--card-stock);border:1px solid var(--card-edge);border-radius:3px;position:absolute;inset:0;overflow:hidden}.cos-photo-postcard__front{transform:rotateY(0)}.cos-photo-postcard__back{flex-direction:column;display:flex;transform:rotateY(180deg)}.cos-photo-postcard__photo-frame{background:#fff;border:2px solid #fff;flex-direction:column;display:flex;position:absolute;inset:10px;box-shadow:0 0 0 1px #0000000d}.cos-photo-postcard__photo-frame-with-caption{bottom:52px}.cos-photo-postcard__photo-wrap{background:#dfe5e8;flex:1;min-height:0;position:relative;overflow:hidden}.cos-photo-postcard__photo{object-fit:cover;pointer-events:none;width:100%;height:100%;display:block}.cos-photo-postcard__corner-stamp{z-index:2;border:1.5px solid var(--stamp-teal);background:repeating-linear-gradient(0deg, var(--stamp-teal) 0 2px, transparent 2px 4px), linear-gradient(145deg, #2a5f6f2e 0%, #2a5f6f14 100%);opacity:.88;width:28px;height:34px;position:absolute;top:8px;right:8px;box-shadow:0 1px 2px #00000014;-webkit-mask-image:radial-gradient(circle at 0 0,#0000 2px,#000 2.5px),linear-gradient(#000 0 0);mask-image:radial-gradient(circle at 0 0,#0000 2px,#000 2.5px),linear-gradient(#000 0 0);-webkit-mask-position:0 0,0 0;mask-position:0 0,0 0;-webkit-mask-size:4px 4px,auto;mask-size:4px 4px,auto;-webkit-mask-repeat:repeat,repeat;mask-repeat:repeat,repeat;-webkit-mask-clip:border-box,border-box;mask-clip:border-box,border-box;-webkit-mask-origin:border-box,border-box;mask-origin:border-box,border-box;-webkit-mask-composite:xor;mask-composite:exclude;-webkit-mask-source-type:auto,auto;mask-mode:match-source,match-source}.cos-photo-postcard__corner-stamp:after{content:"";border:1px dashed #ffffff8c;position:absolute;inset:5px 4px}.cos-photo-postcard__front-caption{color:var(--ink);letter-spacing:.02em;border-top:1px solid #2a5f6f1f;padding:6px 8px;font-size:10px;line-height:1.35;position:absolute;bottom:8px;left:10px;right:10px}.cos-photo-postcard__front-caption-title{margin:0;font-size:11px;font-weight:600}.cos-photo-postcard__front-caption-desc{color:var(--ink-muted);margin:2px 0 0;font-size:9px}.cos-photo-postcard__lined-paper{background:repeating-linear-gradient(180deg, transparent 0, transparent 17px, var(--line-color) 17px, var(--line-color) 18px), linear-gradient(180deg, #ffffff59 0%, transparent 24%);border-radius:1px;flex:1;margin:14px 16px 10px;padding:12px 14px 8px;position:relative}.cos-photo-postcard__greeting{color:var(--stamp-teal);letter-spacing:.03em;margin:0 0 10px;font-family:Georgia,Times New Roman,serif;font-size:13px;font-style:italic;font-weight:600}.cos-photo-postcard__body-text{color:var(--ink);letter-spacing:.01em;white-space:pre-wrap;margin:0;font-family:Georgia,Times New Roman,serif;font-size:11px;line-height:18px}.cos-photo-postcard__body-placeholder{color:var(--ink-muted);opacity:.72;margin:0;font-family:Georgia,Times New Roman,serif;font-size:11px;font-style:italic;line-height:18px}.cos-photo-postcard__back-footer{flex-shrink:0;height:58px;margin:0 14px 12px;position:relative}.cos-photo-postcard__stamp-square{border:2px solid var(--stamp-teal);background:repeating-linear-gradient(-38deg,#2a5f6f38 0 3px,#c97b6a29 3px 6px),linear-gradient(160deg,#2a5f6f1f 0%,#c97b6a1a 100%);width:44px;height:52px;position:absolute;bottom:0;right:0;box-shadow:inset 0 0 0 3px #f4f0e8d9,0 1px 3px #0000001a}.cos-photo-postcard__stamp-square:before{content:"";border:1px dashed #2a5f6f73;position:absolute;inset:6px}.cos-photo-postcard__postmark{border:2px solid var(--stamp-coral);width:52px;height:52px;color:var(--stamp-coral);letter-spacing:.08em;text-transform:uppercase;opacity:.82;border-radius:50%;justify-content:center;align-items:center;font-size:7px;font-weight:700;display:flex;position:absolute;bottom:6px;left:4px;transform:rotate(-12deg)}.cos-photo-postcard__postmark:before{content:"";border:1px solid #c97b6a73;border-radius:50%;position:absolute;inset:5px}.cos-photo-postcard__postmark-text{z-index:1;text-align:center;line-height:1.2;position:relative}.cos-photo-postcard__divider{pointer-events:none;background:linear-gradient(#0000,#2a5f6f2e 18% 82%,#0000);width:1px;position:absolute;top:14px;bottom:14px;left:58%}.cos-photo-postcard__empty{color:#3d4a4f94;letter-spacing:.06em;justify-content:center;align-items:center;width:100%;height:100%;font-size:13px;display:flex}.cos-photo-postcard__hint{color:#3d4a4f6b;letter-spacing:.12em;text-transform:uppercase;pointer-events:none;white-space:nowrap;font-size:10px;position:absolute;bottom:12px;left:50%;transform:translate(-50%)}
|
package/package.json
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cos-design/photo-postcard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "PhotoPostcard component from cos-design",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"main": "./dist/react/index.cjs",
|
|
7
|
+
"module": "./dist/react/index.js",
|
|
8
|
+
"types": "./dist/react/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"default": "./dist/index.js"
|
|
12
|
+
"types": "./dist/react/index.d.ts",
|
|
13
|
+
"default": "./dist/react/index.js"
|
|
14
14
|
},
|
|
15
15
|
"require": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
16
|
+
"types": "./dist/react/index.d.ts",
|
|
17
|
+
"default": "./dist/react/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./vue": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/vue/index.d.ts",
|
|
23
|
+
"default": "./dist/vue/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./core": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/core/index.d.ts",
|
|
29
|
+
"default": "./dist/core/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./element": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/element/index.d.ts",
|
|
35
|
+
"default": "./dist/element/index.js"
|
|
18
36
|
}
|
|
19
37
|
}
|
|
20
38
|
},
|
|
@@ -24,11 +42,13 @@
|
|
|
24
42
|
],
|
|
25
43
|
"sideEffects": [
|
|
26
44
|
"**/*.css",
|
|
27
|
-
"**/*.less"
|
|
45
|
+
"**/*.less",
|
|
46
|
+
"./dist/element/index.js"
|
|
28
47
|
],
|
|
29
48
|
"keywords": [
|
|
30
49
|
"cos-design",
|
|
31
50
|
"react",
|
|
51
|
+
"vue",
|
|
32
52
|
"photoPostcard",
|
|
33
53
|
"PhotoPostcard"
|
|
34
54
|
],
|
|
@@ -45,10 +65,25 @@
|
|
|
45
65
|
"license": "MIT",
|
|
46
66
|
"peerDependencies": {
|
|
47
67
|
"react": ">=18.0.0",
|
|
48
|
-
"react-dom": ">=18.0.0"
|
|
68
|
+
"react-dom": ">=18.0.0",
|
|
69
|
+
"vue": ">=3.4.0"
|
|
49
70
|
},
|
|
50
71
|
"publishConfig": {
|
|
51
72
|
"access": "public",
|
|
52
73
|
"registry": "https://registry.npmjs.org"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react-dom": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"vue": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@cos-design/shared": "4.0.0"
|
|
53
88
|
}
|
|
54
89
|
}
|