@medialane/ui 0.5.4 → 0.6.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/components/portfolio-subnav.cjs +94 -0
- package/dist/components/portfolio-subnav.cjs.map +1 -0
- package/dist/components/portfolio-subnav.d.cts +27 -0
- package/dist/components/portfolio-subnav.d.ts +27 -0
- package/dist/components/portfolio-subnav.js +60 -0
- package/dist/components/portfolio-subnav.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/portfolio-counts.cjs +45 -0
- package/dist/utils/portfolio-counts.cjs.map +1 -0
- package/dist/utils/portfolio-counts.d.cts +33 -0
- package/dist/utils/portfolio-counts.d.ts +33 -0
- package/dist/utils/portfolio-counts.js +21 -0
- package/dist/utils/portfolio-counts.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var portfolio_subnav_exports = {};
|
|
31
|
+
__export(portfolio_subnav_exports, {
|
|
32
|
+
PortfolioSubnav: () => PortfolioSubnav
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(portfolio_subnav_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
37
|
+
var import_cn = require("../utils/cn.js");
|
|
38
|
+
const BADGE_VARIANT_CLASS = {
|
|
39
|
+
destructive: "bg-destructive text-destructive-foreground",
|
|
40
|
+
primary: "bg-primary text-primary-foreground",
|
|
41
|
+
warning: "bg-amber-500 text-white"
|
|
42
|
+
};
|
|
43
|
+
function PortfolioSubnav({
|
|
44
|
+
groups,
|
|
45
|
+
pathname,
|
|
46
|
+
badgeCounts = {},
|
|
47
|
+
className
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
"nav",
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_cn.cn)(
|
|
53
|
+
"overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8 border-b border-border/60",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center min-w-max gap-0", children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center", children: [
|
|
57
|
+
group.items.map((item) => {
|
|
58
|
+
const active = pathname === item.href || pathname.startsWith(item.href + "/");
|
|
59
|
+
const count = item.badge ? badgeCounts[item.badge.key] ?? 0 : 0;
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
61
|
+
import_link.default,
|
|
62
|
+
{
|
|
63
|
+
href: item.href,
|
|
64
|
+
className: (0, import_cn.cn)(
|
|
65
|
+
"relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10",
|
|
66
|
+
active ? "border-primary text-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
67
|
+
),
|
|
68
|
+
children: [
|
|
69
|
+
item.label,
|
|
70
|
+
item.badge && count > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
className: (0, import_cn.cn)(
|
|
74
|
+
"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1",
|
|
75
|
+
BADGE_VARIANT_CLASS[item.badge.variant ?? "primary"]
|
|
76
|
+
),
|
|
77
|
+
children: count
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
item.href
|
|
83
|
+
);
|
|
84
|
+
}),
|
|
85
|
+
groupIndex < groups.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w-px h-4 bg-border/40 mx-1 self-center shrink-0" })
|
|
86
|
+
] }, group.label)) })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
PortfolioSubnav
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=portfolio-subnav.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-subnav.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"next/link\";\nimport { cn } from \"../utils/cn.js\";\n\nexport type PortfolioBadgeVariant = \"destructive\" | \"primary\" | \"warning\";\n\nexport interface PortfolioNavItem {\n label: string;\n href: string;\n /** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */\n badge?: { key: string; variant?: PortfolioBadgeVariant };\n}\n\nexport interface PortfolioNavGroup {\n label: string;\n items: PortfolioNavItem[];\n}\n\nexport interface PortfolioSubnavProps {\n groups: PortfolioNavGroup[];\n /** Current pathname — caller passes `usePathname()`. */\n pathname: string;\n /** Badge counts keyed by `item.badge.key`. A badge renders only when > 0. */\n badgeCounts?: Record<string, number>;\n className?: string;\n}\n\nconst BADGE_VARIANT_CLASS: Record<PortfolioBadgeVariant, string> = {\n destructive: \"bg-destructive text-destructive-foreground\",\n primary: \"bg-primary text-primary-foreground\",\n warning: \"bg-amber-500 text-white\",\n};\n\nexport function PortfolioSubnav({\n groups,\n pathname,\n badgeCounts = {},\n className,\n}: PortfolioSubnavProps) {\n return (\n <nav\n className={cn(\n \"overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8 border-b border-border/60\",\n className,\n )}\n >\n <div className=\"flex items-center min-w-max gap-0\">\n {groups.map((group, groupIndex) => (\n <div key={group.label} className=\"flex items-center\">\n {group.items.map((item) => {\n const active =\n pathname === item.href || pathname.startsWith(item.href + \"/\");\n const count = item.badge ? badgeCounts[item.badge.key] ?? 0 : 0;\n return (\n <Link\n key={item.href}\n href={item.href}\n className={cn(\n \"relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10\",\n active\n ? \"border-primary text-foreground font-medium\"\n : \"border-transparent text-muted-foreground hover:text-foreground\",\n )}\n >\n {item.label}\n {item.badge && count > 0 && (\n <span\n className={cn(\n \"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1\",\n BADGE_VARIANT_CLASS[item.badge.variant ?? \"primary\"],\n )}\n >\n {count}\n </span>\n )}\n </Link>\n );\n })}\n {groupIndex < groups.length - 1 && (\n <span className=\"w-px h-4 bg-border/40 mx-1 self-center shrink-0\" />\n )}\n </div>\n ))}\n </div>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuDgB;AArDhB,kBAAiB;AACjB,gBAAmB;AAyBnB,MAAM,sBAA6D;AAAA,EACjE,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AACX;AAEO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,cAAc,CAAC;AAAA,EACf;AACF,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA,sDAAC,SAAI,WAAU,qCACZ,iBAAO,IAAI,CAAC,OAAO,eAClB,6CAAC,SAAsB,WAAU,qBAC9B;AAAA,cAAM,MAAM,IAAI,CAAC,SAAS;AACzB,gBAAM,SACJ,aAAa,KAAK,QAAQ,SAAS,WAAW,KAAK,OAAO,GAAG;AAC/D,gBAAM,QAAQ,KAAK,QAAQ,YAAY,KAAK,MAAM,GAAG,KAAK,IAAI;AAC9D,iBACE;AAAA,YAAC,YAAAA;AAAA,YAAA;AAAA,cAEC,MAAM,KAAK;AAAA,cACX,eAAW;AAAA,gBACT;AAAA,gBACA,SACI,+CACA;AAAA,cACN;AAAA,cAEC;AAAA,qBAAK;AAAA,gBACL,KAAK,SAAS,QAAQ,KACrB;AAAA,kBAAC;AAAA;AAAA,oBACC,eAAW;AAAA,sBACT;AAAA,sBACA,oBAAoB,KAAK,MAAM,WAAW,SAAS;AAAA,oBACrD;AAAA,oBAEC;AAAA;AAAA,gBACH;AAAA;AAAA;AAAA,YAlBG,KAAK;AAAA,UAoBZ;AAAA,QAEJ,CAAC;AAAA,QACA,aAAa,OAAO,SAAS,KAC5B,4CAAC,UAAK,WAAU,mDAAkD;AAAA,WA/B5D,MAAM,KAiChB,CACD,GACH;AAAA;AAAA,EACF;AAEJ;","names":["Link"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type PortfolioBadgeVariant = "destructive" | "primary" | "warning";
|
|
4
|
+
interface PortfolioNavItem {
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
/** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */
|
|
8
|
+
badge?: {
|
|
9
|
+
key: string;
|
|
10
|
+
variant?: PortfolioBadgeVariant;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PortfolioNavGroup {
|
|
14
|
+
label: string;
|
|
15
|
+
items: PortfolioNavItem[];
|
|
16
|
+
}
|
|
17
|
+
interface PortfolioSubnavProps {
|
|
18
|
+
groups: PortfolioNavGroup[];
|
|
19
|
+
/** Current pathname — caller passes `usePathname()`. */
|
|
20
|
+
pathname: string;
|
|
21
|
+
/** Badge counts keyed by `item.badge.key`. A badge renders only when > 0. */
|
|
22
|
+
badgeCounts?: Record<string, number>;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function PortfolioSubnav({ groups, pathname, badgeCounts, className, }: PortfolioSubnavProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { type PortfolioBadgeVariant, type PortfolioNavGroup, type PortfolioNavItem, PortfolioSubnav, type PortfolioSubnavProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type PortfolioBadgeVariant = "destructive" | "primary" | "warning";
|
|
4
|
+
interface PortfolioNavItem {
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
/** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */
|
|
8
|
+
badge?: {
|
|
9
|
+
key: string;
|
|
10
|
+
variant?: PortfolioBadgeVariant;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PortfolioNavGroup {
|
|
14
|
+
label: string;
|
|
15
|
+
items: PortfolioNavItem[];
|
|
16
|
+
}
|
|
17
|
+
interface PortfolioSubnavProps {
|
|
18
|
+
groups: PortfolioNavGroup[];
|
|
19
|
+
/** Current pathname — caller passes `usePathname()`. */
|
|
20
|
+
pathname: string;
|
|
21
|
+
/** Badge counts keyed by `item.badge.key`. A badge renders only when > 0. */
|
|
22
|
+
badgeCounts?: Record<string, number>;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function PortfolioSubnav({ groups, pathname, badgeCounts, className, }: PortfolioSubnavProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { type PortfolioBadgeVariant, type PortfolioNavGroup, type PortfolioNavItem, PortfolioSubnav, type PortfolioSubnavProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
|
+
const BADGE_VARIANT_CLASS = {
|
|
6
|
+
destructive: "bg-destructive text-destructive-foreground",
|
|
7
|
+
primary: "bg-primary text-primary-foreground",
|
|
8
|
+
warning: "bg-amber-500 text-white"
|
|
9
|
+
};
|
|
10
|
+
function PortfolioSubnav({
|
|
11
|
+
groups,
|
|
12
|
+
pathname,
|
|
13
|
+
badgeCounts = {},
|
|
14
|
+
className
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
"nav",
|
|
18
|
+
{
|
|
19
|
+
className: cn(
|
|
20
|
+
"overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8 border-b border-border/60",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex items-center min-w-max gap-0", children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
24
|
+
group.items.map((item) => {
|
|
25
|
+
const active = pathname === item.href || pathname.startsWith(item.href + "/");
|
|
26
|
+
const count = item.badge ? badgeCounts[item.badge.key] ?? 0 : 0;
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
Link,
|
|
29
|
+
{
|
|
30
|
+
href: item.href,
|
|
31
|
+
className: cn(
|
|
32
|
+
"relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10",
|
|
33
|
+
active ? "border-primary text-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
34
|
+
),
|
|
35
|
+
children: [
|
|
36
|
+
item.label,
|
|
37
|
+
item.badge && count > 0 && /* @__PURE__ */ jsx(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
className: cn(
|
|
41
|
+
"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1",
|
|
42
|
+
BADGE_VARIANT_CLASS[item.badge.variant ?? "primary"]
|
|
43
|
+
),
|
|
44
|
+
children: count
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
item.href
|
|
50
|
+
);
|
|
51
|
+
}),
|
|
52
|
+
groupIndex < groups.length - 1 && /* @__PURE__ */ jsx("span", { className: "w-px h-4 bg-border/40 mx-1 self-center shrink-0" })
|
|
53
|
+
] }, group.label)) })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
PortfolioSubnav
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=portfolio-subnav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-subnav.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"next/link\";\nimport { cn } from \"../utils/cn.js\";\n\nexport type PortfolioBadgeVariant = \"destructive\" | \"primary\" | \"warning\";\n\nexport interface PortfolioNavItem {\n label: string;\n href: string;\n /** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */\n badge?: { key: string; variant?: PortfolioBadgeVariant };\n}\n\nexport interface PortfolioNavGroup {\n label: string;\n items: PortfolioNavItem[];\n}\n\nexport interface PortfolioSubnavProps {\n groups: PortfolioNavGroup[];\n /** Current pathname — caller passes `usePathname()`. */\n pathname: string;\n /** Badge counts keyed by `item.badge.key`. A badge renders only when > 0. */\n badgeCounts?: Record<string, number>;\n className?: string;\n}\n\nconst BADGE_VARIANT_CLASS: Record<PortfolioBadgeVariant, string> = {\n destructive: \"bg-destructive text-destructive-foreground\",\n primary: \"bg-primary text-primary-foreground\",\n warning: \"bg-amber-500 text-white\",\n};\n\nexport function PortfolioSubnav({\n groups,\n pathname,\n badgeCounts = {},\n className,\n}: PortfolioSubnavProps) {\n return (\n <nav\n className={cn(\n \"overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8 border-b border-border/60\",\n className,\n )}\n >\n <div className=\"flex items-center min-w-max gap-0\">\n {groups.map((group, groupIndex) => (\n <div key={group.label} className=\"flex items-center\">\n {group.items.map((item) => {\n const active =\n pathname === item.href || pathname.startsWith(item.href + \"/\");\n const count = item.badge ? badgeCounts[item.badge.key] ?? 0 : 0;\n return (\n <Link\n key={item.href}\n href={item.href}\n className={cn(\n \"relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10\",\n active\n ? \"border-primary text-foreground font-medium\"\n : \"border-transparent text-muted-foreground hover:text-foreground\",\n )}\n >\n {item.label}\n {item.badge && count > 0 && (\n <span\n className={cn(\n \"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1\",\n BADGE_VARIANT_CLASS[item.badge.variant ?? \"primary\"],\n )}\n >\n {count}\n </span>\n )}\n </Link>\n );\n })}\n {groupIndex < groups.length - 1 && (\n <span className=\"w-px h-4 bg-border/40 mx-1 self-center shrink-0\" />\n )}\n </div>\n ))}\n </div>\n </nav>\n );\n}\n"],"mappings":";AAuDgB,SAYI,KAZJ;AArDhB,OAAO,UAAU;AACjB,SAAS,UAAU;AAyBnB,MAAM,sBAA6D;AAAA,EACjE,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AACX;AAEO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,cAAc,CAAC;AAAA,EACf;AACF,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA,8BAAC,SAAI,WAAU,qCACZ,iBAAO,IAAI,CAAC,OAAO,eAClB,qBAAC,SAAsB,WAAU,qBAC9B;AAAA,cAAM,MAAM,IAAI,CAAC,SAAS;AACzB,gBAAM,SACJ,aAAa,KAAK,QAAQ,SAAS,WAAW,KAAK,OAAO,GAAG;AAC/D,gBAAM,QAAQ,KAAK,QAAQ,YAAY,KAAK,MAAM,GAAG,KAAK,IAAI;AAC9D,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC,MAAM,KAAK;AAAA,cACX,WAAW;AAAA,gBACT;AAAA,gBACA,SACI,+CACA;AAAA,cACN;AAAA,cAEC;AAAA,qBAAK;AAAA,gBACL,KAAK,SAAS,QAAQ,KACrB;AAAA,kBAAC;AAAA;AAAA,oBACC,WAAW;AAAA,sBACT;AAAA,sBACA,oBAAoB,KAAK,MAAM,WAAW,SAAS;AAAA,oBACrD;AAAA,oBAEC;AAAA;AAAA,gBACH;AAAA;AAAA;AAAA,YAlBG,KAAK;AAAA,UAoBZ;AAAA,QAEJ,CAAC;AAAA,QACA,aAAa,OAAO,SAAS,KAC5B,oBAAC,UAAK,WAAU,mDAAkD;AAAA,WA/B5D,MAAM,KAiChB,CACD,GACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
MotionCard: () => import_motion_primitives.MotionCard,
|
|
56
56
|
NavCommandMenu: () => import_nav_command_menu.NavCommandMenu,
|
|
57
57
|
PageContainer: () => import_page_container.PageContainer,
|
|
58
|
+
PortfolioSubnav: () => import_portfolio_subnav.PortfolioSubnav,
|
|
58
59
|
SPRING: () => import_motion_primitives.SPRING,
|
|
59
60
|
ScrollSection: () => import_scroll_section.ScrollSection,
|
|
60
61
|
ShareButton: () => import_share_button.ShareButton,
|
|
@@ -64,6 +65,7 @@ __export(index_exports, {
|
|
|
64
65
|
TokenCard: () => import_token_card.TokenCard,
|
|
65
66
|
TokenCardSkeleton: () => import_token_card.TokenCardSkeleton,
|
|
66
67
|
cn: () => import_cn.cn,
|
|
68
|
+
derivePortfolioCounts: () => import_portfolio_counts.derivePortfolioCounts,
|
|
67
69
|
formatDisplayPrice: () => import_format.formatDisplayPrice,
|
|
68
70
|
ipfsToHttp: () => import_ipfs.ipfsToHttp,
|
|
69
71
|
shortenAddress: () => import_address.shortenAddress,
|
|
@@ -105,6 +107,8 @@ var import_discover_feed_section = require("./components/discover-feed-section.j
|
|
|
105
107
|
var import_launchpad_services = require("./components/launchpad-services.js");
|
|
106
108
|
var import_launchpad_services2 = require("./data/launchpad-services.js");
|
|
107
109
|
var import_nav_command_menu = require("./components/nav-command-menu.js");
|
|
110
|
+
var import_portfolio_subnav = require("./components/portfolio-subnav.js");
|
|
111
|
+
var import_portfolio_counts = require("./utils/portfolio-counts.js");
|
|
108
112
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
113
|
0 && (module.exports = {
|
|
110
114
|
ACTIVITY_TYPE_CONFIG,
|
|
@@ -144,6 +148,7 @@ var import_nav_command_menu = require("./components/nav-command-menu.js");
|
|
|
144
148
|
MotionCard,
|
|
145
149
|
NavCommandMenu,
|
|
146
150
|
PageContainer,
|
|
151
|
+
PortfolioSubnav,
|
|
147
152
|
SPRING,
|
|
148
153
|
ScrollSection,
|
|
149
154
|
ShareButton,
|
|
@@ -153,6 +158,7 @@ var import_nav_command_menu = require("./components/nav-command-menu.js");
|
|
|
153
158
|
TokenCard,
|
|
154
159
|
TokenCardSkeleton,
|
|
155
160
|
cn,
|
|
161
|
+
derivePortfolioCounts,
|
|
156
162
|
formatDisplayPrice,
|
|
157
163
|
ipfsToHttp,
|
|
158
164
|
shortenAddress,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Utils ─────────────────────────────────────────────────────────────────────\nexport { cn } from \"./utils/cn.js\";\nexport { formatDisplayPrice } from \"./utils/format.js\";\nexport { shortenAddress } from \"./utils/address.js\";\nexport { ipfsToHttp } from \"./utils/ipfs.js\";\n\n// ── Data (server-safe — no React, safe in Server Components) ──────────────────\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"./data/ip-types.js\";\nexport type { IpTypeData } from \"./data/ip-types.js\";\nexport { BRAND } from \"./data/brand.js\";\n\n// ── Components (client-only — all have \"use client\") ─────────────────────────\nexport { CurrencyIcon, CurrencyAmount } from \"./components/currency-icon.js\";\nexport type { CurrencyIconProps, CurrencyAmountProps } from \"./components/currency-icon.js\";\n\nexport { IpTypeBadge, IP_TYPE_CONFIG, IP_TYPE_MAP } from \"./components/ip-type-badge.js\";\nexport type { IpTypeBadgeProps, IpTypeConfig } from \"./components/ip-type-badge.js\";\n\nexport { AddressDisplay } from \"./components/address-display.js\";\nexport type { AddressDisplayProps } from \"./components/address-display.js\";\n\nexport { MedialaneIcon } from \"./components/brand-icon.js\";\nexport type { MedialaneIconProps } from \"./components/brand-icon.js\";\nexport { MedialaneLogoFull } from \"./components/brand-logo.js\";\nexport type { MedialaneLogoFullProps } from \"./components/brand-logo.js\";\n\n// ── v0.2 additions ────────────────────────────────────────────────────────────\nexport { MotionCard, FadeIn, Stagger, StaggerItem, KineticWords, SPRING, EASE_OUT } from \"./components/motion-primitives.js\";\nexport { PageContainer } from \"./components/page-container.js\";\nexport type { PageContainerProps } from \"./components/page-container.js\";\nexport { ScrollSection } from \"./components/scroll-section.js\";\nexport type { ScrollSectionProps } from \"./components/scroll-section.js\";\nexport { ShareButton } from \"./components/share-button.js\";\nexport type { ShareButtonProps } from \"./components/share-button.js\";\nexport { CollectionCard, CollectionCardSkeleton } from \"./components/collection-card.js\";\nexport type { CollectionCardProps } from \"./components/collection-card.js\";\nexport { TokenCard, TokenCardSkeleton } from \"./components/token-card.js\";\nexport type { TokenCardProps, RarityTier } from \"./components/token-card.js\";\n\n// ── v0.3 additions ────────────────────────────────────────────────────────────\nexport { timeAgo } from \"./utils/time.js\";\nexport { ACTIVITY_TYPE_CONFIG, TYPE_FILTERS } from \"./data/activity.js\";\nexport type { ActivityTypeConfig } from \"./data/activity.js\";\nexport { HeroSlider, HeroSliderSkeleton } from \"./components/hero-slider.js\";\nexport type { HeroSliderProps } from \"./components/hero-slider.js\";\nexport { ActivityTicker } from \"./components/activity-ticker.js\";\nexport type { ActivityTickerProps } from \"./components/activity-ticker.js\";\nexport { ListingCard, ListingCardSkeleton } from \"./components/listing-card.js\";\nexport type { ListingCardProps } from \"./components/listing-card.js\";\nexport { ActivityRow } from \"./components/activity-row.js\";\nexport type { ActivityRowProps } from \"./components/activity-row.js\";\nexport { ActivityFeedShell } from \"./components/activity-feed-shell.js\";\nexport type { ActivityFeedShellProps } from \"./components/activity-feed-shell.js\";\nexport { LaunchpadGrid } from \"./components/launchpad-grid.js\";\nexport type { LaunchpadGridProps, FeatureItem } from \"./components/launchpad-grid.js\";\nexport { CtaCardGrid } from \"./components/cta-card-grid.js\";\nexport type { CtaCardGridProps, CtaCardItem } from \"./components/cta-card-grid.js\";\n\n// ── v0.3.2 additions ─────────────────────────────────────────────────────────\nexport { DiscoverHero } from \"./components/discover-hero.js\";\nexport type { DiscoverHeroProps } from \"./components/discover-hero.js\";\nexport { FeaturedCarousel, FeaturedCarouselSkeleton } from \"./components/featured-carousel.js\";\nexport type { FeaturedCarouselProps } from \"./components/featured-carousel.js\";\nexport { DiscoverCollectionsStrip } from \"./components/discover-collections-strip.js\";\nexport type { DiscoverCollectionsStripProps } from \"./components/discover-collections-strip.js\";\nexport { DiscoverCreatorsStrip } from \"./components/discover-creators-strip.js\";\nexport type { DiscoverCreatorsStripProps } from \"./components/discover-creators-strip.js\";\nexport { DiscoverFeedSection } from \"./components/discover-feed-section.js\";\nexport type { DiscoverFeedSectionProps } from \"./components/discover-feed-section.js\";\n\n// ── v0.4 additions ────────────────────────────────────────────────────────────\nexport { LaunchpadServicesGrid } from \"./components/launchpad-services.js\";\nexport type { LaunchpadServicesGridProps, ServiceCardProps } from \"./components/launchpad-services.js\";\nexport { LAUNCHPAD_SERVICE_DEFINITIONS } from \"./data/launchpad-services.js\";\nexport type { ServiceDefinition, ServiceStatus, ServiceCategory } from \"./data/launchpad-services.js\";\n\n// ── v0.5.0 additions ─────────────────────────────────────────────────────────\nexport { NavCommandMenu, useNavCommandMenu } from \"./components/nav-command-menu.js\";\nexport type { NavCommand, NavCommandGroup, NavCommandMenuProps } from \"./components/nav-command-menu.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAmB;AACnB,oBAAmC;AACnC,qBAA+B;AAC/B,kBAA2B;AAG3B,sBAA+C;AAE/C,mBAAsB;AAGtB,2BAA6C;AAG7C,2BAAyD;AAGzD,6BAA+B;AAG/B,wBAA8B;AAE9B,wBAAkC;AAIlC,+BAAyF;AACzF,4BAA8B;AAE9B,4BAA8B;AAE9B,0BAA4B;AAE5B,6BAAuD;AAEvD,wBAA6C;AAI7C,kBAAwB;AACxB,sBAAmD;AAEnD,yBAA+C;AAE/C,6BAA+B;AAE/B,0BAAiD;AAEjD,0BAA4B;AAE5B,iCAAkC;AAElC,4BAA8B;AAE9B,2BAA4B;AAI5B,2BAA6B;AAE7B,+BAA2D;AAE3D,wCAAyC;AAEzC,qCAAsC;AAEtC,mCAAoC;AAIpC,gCAAsC;AAEtC,IAAAA,6BAA8C;AAI9C,8BAAkD;","names":["import_launchpad_services"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Utils ─────────────────────────────────────────────────────────────────────\nexport { cn } from \"./utils/cn.js\";\nexport { formatDisplayPrice } from \"./utils/format.js\";\nexport { shortenAddress } from \"./utils/address.js\";\nexport { ipfsToHttp } from \"./utils/ipfs.js\";\n\n// ── Data (server-safe — no React, safe in Server Components) ──────────────────\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"./data/ip-types.js\";\nexport type { IpTypeData } from \"./data/ip-types.js\";\nexport { BRAND } from \"./data/brand.js\";\n\n// ── Components (client-only — all have \"use client\") ─────────────────────────\nexport { CurrencyIcon, CurrencyAmount } from \"./components/currency-icon.js\";\nexport type { CurrencyIconProps, CurrencyAmountProps } from \"./components/currency-icon.js\";\n\nexport { IpTypeBadge, IP_TYPE_CONFIG, IP_TYPE_MAP } from \"./components/ip-type-badge.js\";\nexport type { IpTypeBadgeProps, IpTypeConfig } from \"./components/ip-type-badge.js\";\n\nexport { AddressDisplay } from \"./components/address-display.js\";\nexport type { AddressDisplayProps } from \"./components/address-display.js\";\n\nexport { MedialaneIcon } from \"./components/brand-icon.js\";\nexport type { MedialaneIconProps } from \"./components/brand-icon.js\";\nexport { MedialaneLogoFull } from \"./components/brand-logo.js\";\nexport type { MedialaneLogoFullProps } from \"./components/brand-logo.js\";\n\n// ── v0.2 additions ────────────────────────────────────────────────────────────\nexport { MotionCard, FadeIn, Stagger, StaggerItem, KineticWords, SPRING, EASE_OUT } from \"./components/motion-primitives.js\";\nexport { PageContainer } from \"./components/page-container.js\";\nexport type { PageContainerProps } from \"./components/page-container.js\";\nexport { ScrollSection } from \"./components/scroll-section.js\";\nexport type { ScrollSectionProps } from \"./components/scroll-section.js\";\nexport { ShareButton } from \"./components/share-button.js\";\nexport type { ShareButtonProps } from \"./components/share-button.js\";\nexport { CollectionCard, CollectionCardSkeleton } from \"./components/collection-card.js\";\nexport type { CollectionCardProps } from \"./components/collection-card.js\";\nexport { TokenCard, TokenCardSkeleton } from \"./components/token-card.js\";\nexport type { TokenCardProps, RarityTier } from \"./components/token-card.js\";\n\n// ── v0.3 additions ────────────────────────────────────────────────────────────\nexport { timeAgo } from \"./utils/time.js\";\nexport { ACTIVITY_TYPE_CONFIG, TYPE_FILTERS } from \"./data/activity.js\";\nexport type { ActivityTypeConfig } from \"./data/activity.js\";\nexport { HeroSlider, HeroSliderSkeleton } from \"./components/hero-slider.js\";\nexport type { HeroSliderProps } from \"./components/hero-slider.js\";\nexport { ActivityTicker } from \"./components/activity-ticker.js\";\nexport type { ActivityTickerProps } from \"./components/activity-ticker.js\";\nexport { ListingCard, ListingCardSkeleton } from \"./components/listing-card.js\";\nexport type { ListingCardProps } from \"./components/listing-card.js\";\nexport { ActivityRow } from \"./components/activity-row.js\";\nexport type { ActivityRowProps } from \"./components/activity-row.js\";\nexport { ActivityFeedShell } from \"./components/activity-feed-shell.js\";\nexport type { ActivityFeedShellProps } from \"./components/activity-feed-shell.js\";\nexport { LaunchpadGrid } from \"./components/launchpad-grid.js\";\nexport type { LaunchpadGridProps, FeatureItem } from \"./components/launchpad-grid.js\";\nexport { CtaCardGrid } from \"./components/cta-card-grid.js\";\nexport type { CtaCardGridProps, CtaCardItem } from \"./components/cta-card-grid.js\";\n\n// ── v0.3.2 additions ─────────────────────────────────────────────────────────\nexport { DiscoverHero } from \"./components/discover-hero.js\";\nexport type { DiscoverHeroProps } from \"./components/discover-hero.js\";\nexport { FeaturedCarousel, FeaturedCarouselSkeleton } from \"./components/featured-carousel.js\";\nexport type { FeaturedCarouselProps } from \"./components/featured-carousel.js\";\nexport { DiscoverCollectionsStrip } from \"./components/discover-collections-strip.js\";\nexport type { DiscoverCollectionsStripProps } from \"./components/discover-collections-strip.js\";\nexport { DiscoverCreatorsStrip } from \"./components/discover-creators-strip.js\";\nexport type { DiscoverCreatorsStripProps } from \"./components/discover-creators-strip.js\";\nexport { DiscoverFeedSection } from \"./components/discover-feed-section.js\";\nexport type { DiscoverFeedSectionProps } from \"./components/discover-feed-section.js\";\n\n// ── v0.4 additions ────────────────────────────────────────────────────────────\nexport { LaunchpadServicesGrid } from \"./components/launchpad-services.js\";\nexport type { LaunchpadServicesGridProps, ServiceCardProps } from \"./components/launchpad-services.js\";\nexport { LAUNCHPAD_SERVICE_DEFINITIONS } from \"./data/launchpad-services.js\";\nexport type { ServiceDefinition, ServiceStatus, ServiceCategory } from \"./data/launchpad-services.js\";\n\n// ── v0.5.0 additions ─────────────────────────────────────────────────────────\nexport { NavCommandMenu, useNavCommandMenu } from \"./components/nav-command-menu.js\";\nexport type { NavCommand, NavCommandGroup, NavCommandMenuProps } from \"./components/nav-command-menu.js\";\n\n// ── v0.6.0 additions — portfolio subnav + counts ────────────────────────────\nexport { PortfolioSubnav } from \"./components/portfolio-subnav.js\";\nexport type {\n PortfolioSubnavProps,\n PortfolioNavItem,\n PortfolioNavGroup,\n PortfolioBadgeVariant,\n} from \"./components/portfolio-subnav.js\";\nexport { derivePortfolioCounts } from \"./utils/portfolio-counts.js\";\nexport type { PortfolioCounts, CountableOrder } from \"./utils/portfolio-counts.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAmB;AACnB,oBAAmC;AACnC,qBAA+B;AAC/B,kBAA2B;AAG3B,sBAA+C;AAE/C,mBAAsB;AAGtB,2BAA6C;AAG7C,2BAAyD;AAGzD,6BAA+B;AAG/B,wBAA8B;AAE9B,wBAAkC;AAIlC,+BAAyF;AACzF,4BAA8B;AAE9B,4BAA8B;AAE9B,0BAA4B;AAE5B,6BAAuD;AAEvD,wBAA6C;AAI7C,kBAAwB;AACxB,sBAAmD;AAEnD,yBAA+C;AAE/C,6BAA+B;AAE/B,0BAAiD;AAEjD,0BAA4B;AAE5B,iCAAkC;AAElC,4BAA8B;AAE9B,2BAA4B;AAI5B,2BAA6B;AAE7B,+BAA2D;AAE3D,wCAAyC;AAEzC,qCAAsC;AAEtC,mCAAoC;AAIpC,gCAAsC;AAEtC,IAAAA,6BAA8C;AAI9C,8BAAkD;AAIlD,8BAAgC;AAOhC,8BAAsC;","names":["import_launchpad_services"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -32,6 +32,8 @@ export { DiscoverFeedSection, DiscoverFeedSectionProps } from './components/disc
|
|
|
32
32
|
export { LaunchpadServicesGrid, LaunchpadServicesGridProps, ServiceCardProps } from './components/launchpad-services.cjs';
|
|
33
33
|
export { LAUNCHPAD_SERVICE_DEFINITIONS, ServiceCategory, ServiceDefinition, ServiceStatus } from './data/launchpad-services.cjs';
|
|
34
34
|
export { NavCommand, NavCommandGroup, NavCommandMenu, NavCommandMenuProps, useNavCommandMenu } from './components/nav-command-menu.cjs';
|
|
35
|
+
export { PortfolioBadgeVariant, PortfolioNavGroup, PortfolioNavItem, PortfolioSubnav, PortfolioSubnavProps } from './components/portfolio-subnav.cjs';
|
|
36
|
+
export { CountableOrder, PortfolioCounts, derivePortfolioCounts } from './utils/portfolio-counts.cjs';
|
|
35
37
|
import 'clsx';
|
|
36
38
|
import 'react/jsx-runtime';
|
|
37
39
|
import 'framer-motion';
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export { DiscoverFeedSection, DiscoverFeedSectionProps } from './components/disc
|
|
|
32
32
|
export { LaunchpadServicesGrid, LaunchpadServicesGridProps, ServiceCardProps } from './components/launchpad-services.js';
|
|
33
33
|
export { LAUNCHPAD_SERVICE_DEFINITIONS, ServiceCategory, ServiceDefinition, ServiceStatus } from './data/launchpad-services.js';
|
|
34
34
|
export { NavCommand, NavCommandGroup, NavCommandMenu, NavCommandMenuProps, useNavCommandMenu } from './components/nav-command-menu.js';
|
|
35
|
+
export { PortfolioBadgeVariant, PortfolioNavGroup, PortfolioNavItem, PortfolioSubnav, PortfolioSubnavProps } from './components/portfolio-subnav.js';
|
|
36
|
+
export { CountableOrder, PortfolioCounts, derivePortfolioCounts } from './utils/portfolio-counts.js';
|
|
35
37
|
import 'clsx';
|
|
36
38
|
import 'react/jsx-runtime';
|
|
37
39
|
import 'framer-motion';
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,8 @@ import { DiscoverFeedSection } from "./components/discover-feed-section.js";
|
|
|
32
32
|
import { LaunchpadServicesGrid } from "./components/launchpad-services.js";
|
|
33
33
|
import { LAUNCHPAD_SERVICE_DEFINITIONS } from "./data/launchpad-services.js";
|
|
34
34
|
import { NavCommandMenu, useNavCommandMenu } from "./components/nav-command-menu.js";
|
|
35
|
+
import { PortfolioSubnav } from "./components/portfolio-subnav.js";
|
|
36
|
+
import { derivePortfolioCounts } from "./utils/portfolio-counts.js";
|
|
35
37
|
export {
|
|
36
38
|
ACTIVITY_TYPE_CONFIG,
|
|
37
39
|
ActivityFeedShell,
|
|
@@ -70,6 +72,7 @@ export {
|
|
|
70
72
|
MotionCard,
|
|
71
73
|
NavCommandMenu,
|
|
72
74
|
PageContainer,
|
|
75
|
+
PortfolioSubnav,
|
|
73
76
|
SPRING,
|
|
74
77
|
ScrollSection,
|
|
75
78
|
ShareButton,
|
|
@@ -79,6 +82,7 @@ export {
|
|
|
79
82
|
TokenCard,
|
|
80
83
|
TokenCardSkeleton,
|
|
81
84
|
cn,
|
|
85
|
+
derivePortfolioCounts,
|
|
82
86
|
formatDisplayPrice,
|
|
83
87
|
ipfsToHttp,
|
|
84
88
|
shortenAddress,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Utils ─────────────────────────────────────────────────────────────────────\nexport { cn } from \"./utils/cn.js\";\nexport { formatDisplayPrice } from \"./utils/format.js\";\nexport { shortenAddress } from \"./utils/address.js\";\nexport { ipfsToHttp } from \"./utils/ipfs.js\";\n\n// ── Data (server-safe — no React, safe in Server Components) ──────────────────\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"./data/ip-types.js\";\nexport type { IpTypeData } from \"./data/ip-types.js\";\nexport { BRAND } from \"./data/brand.js\";\n\n// ── Components (client-only — all have \"use client\") ─────────────────────────\nexport { CurrencyIcon, CurrencyAmount } from \"./components/currency-icon.js\";\nexport type { CurrencyIconProps, CurrencyAmountProps } from \"./components/currency-icon.js\";\n\nexport { IpTypeBadge, IP_TYPE_CONFIG, IP_TYPE_MAP } from \"./components/ip-type-badge.js\";\nexport type { IpTypeBadgeProps, IpTypeConfig } from \"./components/ip-type-badge.js\";\n\nexport { AddressDisplay } from \"./components/address-display.js\";\nexport type { AddressDisplayProps } from \"./components/address-display.js\";\n\nexport { MedialaneIcon } from \"./components/brand-icon.js\";\nexport type { MedialaneIconProps } from \"./components/brand-icon.js\";\nexport { MedialaneLogoFull } from \"./components/brand-logo.js\";\nexport type { MedialaneLogoFullProps } from \"./components/brand-logo.js\";\n\n// ── v0.2 additions ────────────────────────────────────────────────────────────\nexport { MotionCard, FadeIn, Stagger, StaggerItem, KineticWords, SPRING, EASE_OUT } from \"./components/motion-primitives.js\";\nexport { PageContainer } from \"./components/page-container.js\";\nexport type { PageContainerProps } from \"./components/page-container.js\";\nexport { ScrollSection } from \"./components/scroll-section.js\";\nexport type { ScrollSectionProps } from \"./components/scroll-section.js\";\nexport { ShareButton } from \"./components/share-button.js\";\nexport type { ShareButtonProps } from \"./components/share-button.js\";\nexport { CollectionCard, CollectionCardSkeleton } from \"./components/collection-card.js\";\nexport type { CollectionCardProps } from \"./components/collection-card.js\";\nexport { TokenCard, TokenCardSkeleton } from \"./components/token-card.js\";\nexport type { TokenCardProps, RarityTier } from \"./components/token-card.js\";\n\n// ── v0.3 additions ────────────────────────────────────────────────────────────\nexport { timeAgo } from \"./utils/time.js\";\nexport { ACTIVITY_TYPE_CONFIG, TYPE_FILTERS } from \"./data/activity.js\";\nexport type { ActivityTypeConfig } from \"./data/activity.js\";\nexport { HeroSlider, HeroSliderSkeleton } from \"./components/hero-slider.js\";\nexport type { HeroSliderProps } from \"./components/hero-slider.js\";\nexport { ActivityTicker } from \"./components/activity-ticker.js\";\nexport type { ActivityTickerProps } from \"./components/activity-ticker.js\";\nexport { ListingCard, ListingCardSkeleton } from \"./components/listing-card.js\";\nexport type { ListingCardProps } from \"./components/listing-card.js\";\nexport { ActivityRow } from \"./components/activity-row.js\";\nexport type { ActivityRowProps } from \"./components/activity-row.js\";\nexport { ActivityFeedShell } from \"./components/activity-feed-shell.js\";\nexport type { ActivityFeedShellProps } from \"./components/activity-feed-shell.js\";\nexport { LaunchpadGrid } from \"./components/launchpad-grid.js\";\nexport type { LaunchpadGridProps, FeatureItem } from \"./components/launchpad-grid.js\";\nexport { CtaCardGrid } from \"./components/cta-card-grid.js\";\nexport type { CtaCardGridProps, CtaCardItem } from \"./components/cta-card-grid.js\";\n\n// ── v0.3.2 additions ─────────────────────────────────────────────────────────\nexport { DiscoverHero } from \"./components/discover-hero.js\";\nexport type { DiscoverHeroProps } from \"./components/discover-hero.js\";\nexport { FeaturedCarousel, FeaturedCarouselSkeleton } from \"./components/featured-carousel.js\";\nexport type { FeaturedCarouselProps } from \"./components/featured-carousel.js\";\nexport { DiscoverCollectionsStrip } from \"./components/discover-collections-strip.js\";\nexport type { DiscoverCollectionsStripProps } from \"./components/discover-collections-strip.js\";\nexport { DiscoverCreatorsStrip } from \"./components/discover-creators-strip.js\";\nexport type { DiscoverCreatorsStripProps } from \"./components/discover-creators-strip.js\";\nexport { DiscoverFeedSection } from \"./components/discover-feed-section.js\";\nexport type { DiscoverFeedSectionProps } from \"./components/discover-feed-section.js\";\n\n// ── v0.4 additions ────────────────────────────────────────────────────────────\nexport { LaunchpadServicesGrid } from \"./components/launchpad-services.js\";\nexport type { LaunchpadServicesGridProps, ServiceCardProps } from \"./components/launchpad-services.js\";\nexport { LAUNCHPAD_SERVICE_DEFINITIONS } from \"./data/launchpad-services.js\";\nexport type { ServiceDefinition, ServiceStatus, ServiceCategory } from \"./data/launchpad-services.js\";\n\n// ── v0.5.0 additions ─────────────────────────────────────────────────────────\nexport { NavCommandMenu, useNavCommandMenu } from \"./components/nav-command-menu.js\";\nexport type { NavCommand, NavCommandGroup, NavCommandMenuProps } from \"./components/nav-command-menu.js\";\n"],"mappings":"AACA,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAG3B,SAAS,cAAc,wBAAwB;AAE/C,SAAS,aAAa;AAGtB,SAAS,cAAc,sBAAsB;AAG7C,SAAS,aAAa,gBAAgB,mBAAmB;AAGzD,SAAS,sBAAsB;AAG/B,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAIlC,SAAS,YAAY,QAAQ,SAAS,aAAa,cAAc,QAAQ,gBAAgB;AACzF,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAE9B,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,8BAA8B;AAEvD,SAAS,WAAW,yBAAyB;AAI7C,SAAS,eAAe;AACxB,SAAS,sBAAsB,oBAAoB;AAEnD,SAAS,YAAY,0BAA0B;AAE/C,SAAS,sBAAsB;AAE/B,SAAS,aAAa,2BAA2B;AAEjD,SAAS,mBAAmB;AAE5B,SAAS,yBAAyB;AAElC,SAAS,qBAAqB;AAE9B,SAAS,mBAAmB;AAI5B,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB,gCAAgC;AAE3D,SAAS,gCAAgC;AAEzC,SAAS,6BAA6B;AAEtC,SAAS,2BAA2B;AAIpC,SAAS,6BAA6B;AAEtC,SAAS,qCAAqC;AAI9C,SAAS,gBAAgB,yBAAyB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Utils ─────────────────────────────────────────────────────────────────────\nexport { cn } from \"./utils/cn.js\";\nexport { formatDisplayPrice } from \"./utils/format.js\";\nexport { shortenAddress } from \"./utils/address.js\";\nexport { ipfsToHttp } from \"./utils/ipfs.js\";\n\n// ── Data (server-safe — no React, safe in Server Components) ──────────────────\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"./data/ip-types.js\";\nexport type { IpTypeData } from \"./data/ip-types.js\";\nexport { BRAND } from \"./data/brand.js\";\n\n// ── Components (client-only — all have \"use client\") ─────────────────────────\nexport { CurrencyIcon, CurrencyAmount } from \"./components/currency-icon.js\";\nexport type { CurrencyIconProps, CurrencyAmountProps } from \"./components/currency-icon.js\";\n\nexport { IpTypeBadge, IP_TYPE_CONFIG, IP_TYPE_MAP } from \"./components/ip-type-badge.js\";\nexport type { IpTypeBadgeProps, IpTypeConfig } from \"./components/ip-type-badge.js\";\n\nexport { AddressDisplay } from \"./components/address-display.js\";\nexport type { AddressDisplayProps } from \"./components/address-display.js\";\n\nexport { MedialaneIcon } from \"./components/brand-icon.js\";\nexport type { MedialaneIconProps } from \"./components/brand-icon.js\";\nexport { MedialaneLogoFull } from \"./components/brand-logo.js\";\nexport type { MedialaneLogoFullProps } from \"./components/brand-logo.js\";\n\n// ── v0.2 additions ────────────────────────────────────────────────────────────\nexport { MotionCard, FadeIn, Stagger, StaggerItem, KineticWords, SPRING, EASE_OUT } from \"./components/motion-primitives.js\";\nexport { PageContainer } from \"./components/page-container.js\";\nexport type { PageContainerProps } from \"./components/page-container.js\";\nexport { ScrollSection } from \"./components/scroll-section.js\";\nexport type { ScrollSectionProps } from \"./components/scroll-section.js\";\nexport { ShareButton } from \"./components/share-button.js\";\nexport type { ShareButtonProps } from \"./components/share-button.js\";\nexport { CollectionCard, CollectionCardSkeleton } from \"./components/collection-card.js\";\nexport type { CollectionCardProps } from \"./components/collection-card.js\";\nexport { TokenCard, TokenCardSkeleton } from \"./components/token-card.js\";\nexport type { TokenCardProps, RarityTier } from \"./components/token-card.js\";\n\n// ── v0.3 additions ────────────────────────────────────────────────────────────\nexport { timeAgo } from \"./utils/time.js\";\nexport { ACTIVITY_TYPE_CONFIG, TYPE_FILTERS } from \"./data/activity.js\";\nexport type { ActivityTypeConfig } from \"./data/activity.js\";\nexport { HeroSlider, HeroSliderSkeleton } from \"./components/hero-slider.js\";\nexport type { HeroSliderProps } from \"./components/hero-slider.js\";\nexport { ActivityTicker } from \"./components/activity-ticker.js\";\nexport type { ActivityTickerProps } from \"./components/activity-ticker.js\";\nexport { ListingCard, ListingCardSkeleton } from \"./components/listing-card.js\";\nexport type { ListingCardProps } from \"./components/listing-card.js\";\nexport { ActivityRow } from \"./components/activity-row.js\";\nexport type { ActivityRowProps } from \"./components/activity-row.js\";\nexport { ActivityFeedShell } from \"./components/activity-feed-shell.js\";\nexport type { ActivityFeedShellProps } from \"./components/activity-feed-shell.js\";\nexport { LaunchpadGrid } from \"./components/launchpad-grid.js\";\nexport type { LaunchpadGridProps, FeatureItem } from \"./components/launchpad-grid.js\";\nexport { CtaCardGrid } from \"./components/cta-card-grid.js\";\nexport type { CtaCardGridProps, CtaCardItem } from \"./components/cta-card-grid.js\";\n\n// ── v0.3.2 additions ─────────────────────────────────────────────────────────\nexport { DiscoverHero } from \"./components/discover-hero.js\";\nexport type { DiscoverHeroProps } from \"./components/discover-hero.js\";\nexport { FeaturedCarousel, FeaturedCarouselSkeleton } from \"./components/featured-carousel.js\";\nexport type { FeaturedCarouselProps } from \"./components/featured-carousel.js\";\nexport { DiscoverCollectionsStrip } from \"./components/discover-collections-strip.js\";\nexport type { DiscoverCollectionsStripProps } from \"./components/discover-collections-strip.js\";\nexport { DiscoverCreatorsStrip } from \"./components/discover-creators-strip.js\";\nexport type { DiscoverCreatorsStripProps } from \"./components/discover-creators-strip.js\";\nexport { DiscoverFeedSection } from \"./components/discover-feed-section.js\";\nexport type { DiscoverFeedSectionProps } from \"./components/discover-feed-section.js\";\n\n// ── v0.4 additions ────────────────────────────────────────────────────────────\nexport { LaunchpadServicesGrid } from \"./components/launchpad-services.js\";\nexport type { LaunchpadServicesGridProps, ServiceCardProps } from \"./components/launchpad-services.js\";\nexport { LAUNCHPAD_SERVICE_DEFINITIONS } from \"./data/launchpad-services.js\";\nexport type { ServiceDefinition, ServiceStatus, ServiceCategory } from \"./data/launchpad-services.js\";\n\n// ── v0.5.0 additions ─────────────────────────────────────────────────────────\nexport { NavCommandMenu, useNavCommandMenu } from \"./components/nav-command-menu.js\";\nexport type { NavCommand, NavCommandGroup, NavCommandMenuProps } from \"./components/nav-command-menu.js\";\n\n// ── v0.6.0 additions — portfolio subnav + counts ────────────────────────────\nexport { PortfolioSubnav } from \"./components/portfolio-subnav.js\";\nexport type {\n PortfolioSubnavProps,\n PortfolioNavItem,\n PortfolioNavGroup,\n PortfolioBadgeVariant,\n} from \"./components/portfolio-subnav.js\";\nexport { derivePortfolioCounts } from \"./utils/portfolio-counts.js\";\nexport type { PortfolioCounts, CountableOrder } from \"./utils/portfolio-counts.js\";\n"],"mappings":"AACA,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAG3B,SAAS,cAAc,wBAAwB;AAE/C,SAAS,aAAa;AAGtB,SAAS,cAAc,sBAAsB;AAG7C,SAAS,aAAa,gBAAgB,mBAAmB;AAGzD,SAAS,sBAAsB;AAG/B,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAIlC,SAAS,YAAY,QAAQ,SAAS,aAAa,cAAc,QAAQ,gBAAgB;AACzF,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAE9B,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,8BAA8B;AAEvD,SAAS,WAAW,yBAAyB;AAI7C,SAAS,eAAe;AACxB,SAAS,sBAAsB,oBAAoB;AAEnD,SAAS,YAAY,0BAA0B;AAE/C,SAAS,sBAAsB;AAE/B,SAAS,aAAa,2BAA2B;AAEjD,SAAS,mBAAmB;AAE5B,SAAS,yBAAyB;AAElC,SAAS,qBAAqB;AAE9B,SAAS,mBAAmB;AAI5B,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB,gCAAgC;AAE3D,SAAS,gCAAgC;AAEzC,SAAS,6BAA6B;AAEtC,SAAS,2BAA2B;AAIpC,SAAS,6BAA6B;AAEtC,SAAS,qCAAqC;AAI9C,SAAS,gBAAgB,yBAAyB;AAIlD,SAAS,uBAAuB;AAOhC,SAAS,6BAA6B;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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
|
+
var portfolio_counts_exports = {};
|
|
20
|
+
__export(portfolio_counts_exports, {
|
|
21
|
+
derivePortfolioCounts: () => derivePortfolioCounts
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(portfolio_counts_exports);
|
|
24
|
+
function derivePortfolioCounts(orders, remixOffers, address) {
|
|
25
|
+
const list = Array.isArray(orders) ? orders : [];
|
|
26
|
+
const addr = (address ?? "").toLowerCase();
|
|
27
|
+
const received = list.filter(
|
|
28
|
+
(o) => o.status === "ACTIVE" && o.offer.itemType === "ERC20" && o.offerer.toLowerCase() !== addr
|
|
29
|
+
).length;
|
|
30
|
+
const listings = list.filter(
|
|
31
|
+
(o) => (o.offer.itemType === "ERC721" || o.offer.itemType === "ERC1155") && o.status === "ACTIVE"
|
|
32
|
+
).length;
|
|
33
|
+
const remix = Array.isArray(remixOffers) ? remixOffers.filter(
|
|
34
|
+
(o) => o.status === "PENDING" || o.status === "AUTO_PENDING"
|
|
35
|
+
).length : 0;
|
|
36
|
+
const counter = list.filter(
|
|
37
|
+
(o) => o.offer.itemType === "ERC20" && o.offerer.toLowerCase() === addr && o.hasActiveCounterOffer === true
|
|
38
|
+
).length;
|
|
39
|
+
return { received, listings, remix, counter };
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
derivePortfolioCounts
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=portfolio-counts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["/**\n * Minimal structural shape of a marketplace order needed to derive portfolio\n * counts. `ApiOrder` from `@medialane/sdk` is structurally assignable to this,\n * so callers pass their `ApiOrder[]` directly and the package stays decoupled\n * from any specific SDK version.\n */\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n /** Active ERC-20 offers made by others on the user's assets. */\n received: number;\n /** Active ERC-721/ERC-1155 listings the user is selling. */\n listings: number;\n /** Pending remix offers awaiting the user's action. */\n remix: number;\n /** The user's bids that a seller has countered. */\n counter: number;\n}\n\n/**\n * Derive the portfolio header/subnav counts from the user's orders and remix\n * offers. Pure and server-safe (no React). Guards nullish inputs.\n */\nexport function derivePortfolioCounts(\n orders: ReadonlyArray<CountableOrder> | null | undefined,\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined,\n address: string | null | undefined,\n): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = (address ?? \"\").toLowerCase();\n\n const received = list.filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n o.offerer.toLowerCase() !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n o.offerer.toLowerCase() === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, remix, counter };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,SAAS,sBACd,QACA,aACA,SACiB;AACjB,QAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC/C,QAAM,QAAQ,WAAW,IAAI,YAAY;AAEzC,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,MACC,EAAE,WAAW,YACb,EAAE,MAAM,aAAa,WACrB,EAAE,QAAQ,YAAY,MAAM;AAAA,EAChC,EAAE;AAEF,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,OACE,EAAE,MAAM,aAAa,YAAY,EAAE,MAAM,aAAa,cACvD,EAAE,WAAW;AAAA,EACjB,EAAE;AAEF,QAAM,QAAQ,MAAM,QAAQ,WAAW,IACnC,YAAY;AAAA,IACV,CAAC,MAAM,EAAE,WAAW,aAAa,EAAE,WAAW;AAAA,EAChD,EAAE,SACF;AAEJ,QAAM,UAAU,KAAK;AAAA,IACnB,CAAC,MACC,EAAE,MAAM,aAAa,WACrB,EAAE,QAAQ,YAAY,MAAM,QAC5B,EAAE,0BAA0B;AAAA,EAChC,EAAE;AAEF,SAAO,EAAE,UAAU,UAAU,OAAO,QAAQ;AAC9C;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal structural shape of a marketplace order needed to derive portfolio
|
|
3
|
+
* counts. `ApiOrder` from `@medialane/sdk` is structurally assignable to this,
|
|
4
|
+
* so callers pass their `ApiOrder[]` directly and the package stays decoupled
|
|
5
|
+
* from any specific SDK version.
|
|
6
|
+
*/
|
|
7
|
+
interface CountableOrder {
|
|
8
|
+
status: string;
|
|
9
|
+
offerer: string;
|
|
10
|
+
offer: {
|
|
11
|
+
itemType: string;
|
|
12
|
+
};
|
|
13
|
+
hasActiveCounterOffer?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface PortfolioCounts {
|
|
16
|
+
/** Active ERC-20 offers made by others on the user's assets. */
|
|
17
|
+
received: number;
|
|
18
|
+
/** Active ERC-721/ERC-1155 listings the user is selling. */
|
|
19
|
+
listings: number;
|
|
20
|
+
/** Pending remix offers awaiting the user's action. */
|
|
21
|
+
remix: number;
|
|
22
|
+
/** The user's bids that a seller has countered. */
|
|
23
|
+
counter: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Derive the portfolio header/subnav counts from the user's orders and remix
|
|
27
|
+
* offers. Pure and server-safe (no React). Guards nullish inputs.
|
|
28
|
+
*/
|
|
29
|
+
declare function derivePortfolioCounts(orders: ReadonlyArray<CountableOrder> | null | undefined, remixOffers: ReadonlyArray<{
|
|
30
|
+
status: string;
|
|
31
|
+
}> | null | undefined, address: string | null | undefined): PortfolioCounts;
|
|
32
|
+
|
|
33
|
+
export { type CountableOrder, type PortfolioCounts, derivePortfolioCounts };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal structural shape of a marketplace order needed to derive portfolio
|
|
3
|
+
* counts. `ApiOrder` from `@medialane/sdk` is structurally assignable to this,
|
|
4
|
+
* so callers pass their `ApiOrder[]` directly and the package stays decoupled
|
|
5
|
+
* from any specific SDK version.
|
|
6
|
+
*/
|
|
7
|
+
interface CountableOrder {
|
|
8
|
+
status: string;
|
|
9
|
+
offerer: string;
|
|
10
|
+
offer: {
|
|
11
|
+
itemType: string;
|
|
12
|
+
};
|
|
13
|
+
hasActiveCounterOffer?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface PortfolioCounts {
|
|
16
|
+
/** Active ERC-20 offers made by others on the user's assets. */
|
|
17
|
+
received: number;
|
|
18
|
+
/** Active ERC-721/ERC-1155 listings the user is selling. */
|
|
19
|
+
listings: number;
|
|
20
|
+
/** Pending remix offers awaiting the user's action. */
|
|
21
|
+
remix: number;
|
|
22
|
+
/** The user's bids that a seller has countered. */
|
|
23
|
+
counter: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Derive the portfolio header/subnav counts from the user's orders and remix
|
|
27
|
+
* offers. Pure and server-safe (no React). Guards nullish inputs.
|
|
28
|
+
*/
|
|
29
|
+
declare function derivePortfolioCounts(orders: ReadonlyArray<CountableOrder> | null | undefined, remixOffers: ReadonlyArray<{
|
|
30
|
+
status: string;
|
|
31
|
+
}> | null | undefined, address: string | null | undefined): PortfolioCounts;
|
|
32
|
+
|
|
33
|
+
export { type CountableOrder, type PortfolioCounts, derivePortfolioCounts };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function derivePortfolioCounts(orders, remixOffers, address) {
|
|
2
|
+
const list = Array.isArray(orders) ? orders : [];
|
|
3
|
+
const addr = (address ?? "").toLowerCase();
|
|
4
|
+
const received = list.filter(
|
|
5
|
+
(o) => o.status === "ACTIVE" && o.offer.itemType === "ERC20" && o.offerer.toLowerCase() !== addr
|
|
6
|
+
).length;
|
|
7
|
+
const listings = list.filter(
|
|
8
|
+
(o) => (o.offer.itemType === "ERC721" || o.offer.itemType === "ERC1155") && o.status === "ACTIVE"
|
|
9
|
+
).length;
|
|
10
|
+
const remix = Array.isArray(remixOffers) ? remixOffers.filter(
|
|
11
|
+
(o) => o.status === "PENDING" || o.status === "AUTO_PENDING"
|
|
12
|
+
).length : 0;
|
|
13
|
+
const counter = list.filter(
|
|
14
|
+
(o) => o.offer.itemType === "ERC20" && o.offerer.toLowerCase() === addr && o.hasActiveCounterOffer === true
|
|
15
|
+
).length;
|
|
16
|
+
return { received, listings, remix, counter };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
derivePortfolioCounts
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=portfolio-counts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["/**\n * Minimal structural shape of a marketplace order needed to derive portfolio\n * counts. `ApiOrder` from `@medialane/sdk` is structurally assignable to this,\n * so callers pass their `ApiOrder[]` directly and the package stays decoupled\n * from any specific SDK version.\n */\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n /** Active ERC-20 offers made by others on the user's assets. */\n received: number;\n /** Active ERC-721/ERC-1155 listings the user is selling. */\n listings: number;\n /** Pending remix offers awaiting the user's action. */\n remix: number;\n /** The user's bids that a seller has countered. */\n counter: number;\n}\n\n/**\n * Derive the portfolio header/subnav counts from the user's orders and remix\n * offers. Pure and server-safe (no React). Guards nullish inputs.\n */\nexport function derivePortfolioCounts(\n orders: ReadonlyArray<CountableOrder> | null | undefined,\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined,\n address: string | null | undefined,\n): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = (address ?? \"\").toLowerCase();\n\n const received = list.filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n o.offerer.toLowerCase() !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n o.offerer.toLowerCase() === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, remix, counter };\n}\n"],"mappings":"AA4BO,SAAS,sBACd,QACA,aACA,SACiB;AACjB,QAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC/C,QAAM,QAAQ,WAAW,IAAI,YAAY;AAEzC,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,MACC,EAAE,WAAW,YACb,EAAE,MAAM,aAAa,WACrB,EAAE,QAAQ,YAAY,MAAM;AAAA,EAChC,EAAE;AAEF,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,OACE,EAAE,MAAM,aAAa,YAAY,EAAE,MAAM,aAAa,cACvD,EAAE,WAAW;AAAA,EACjB,EAAE;AAEF,QAAM,QAAQ,MAAM,QAAQ,WAAW,IACnC,YAAY;AAAA,IACV,CAAC,MAAM,EAAE,WAAW,aAAa,EAAE,WAAW;AAAA,EAChD,EAAE,SACF;AAEJ,QAAM,UAAU,KAAK;AAAA,IACnB,CAAC,MACC,EAAE,MAAM,aAAa,WACrB,EAAE,QAAQ,YAAY,MAAM,QAC5B,EAAE,0BAA0B;AAAA,EAChC,EAAE;AAEF,SAAO,EAAE,UAAU,UAAU,OAAO,QAAQ;AAC9C;","names":[]}
|