@stackframe/stack-shared 2.8.51 → 2.8.52

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.8.52
4
+
5
+ ### Patch Changes
6
+
7
+ - Various changes
8
+
3
9
  ## 2.8.51
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,26 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { AppId } from './apps-config.mjs';
3
+
4
+ declare const appSquareWidthExpression = "max(min(11vw,180px),80px)";
5
+ declare const appSquarePaddingExpression = "max(min(1vw,1.5rem),0.25rem)";
6
+ type AppIconProps = {
7
+ appId: AppId;
8
+ /**
9
+ * Icon component from the app frontend config
10
+ */
11
+ IconComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
12
+ /**
13
+ * Optional logo component from the app frontend config
14
+ */
15
+ LogoComponent?: React.FunctionComponent<{}>;
16
+ className?: string;
17
+ disabled?: boolean;
18
+ style?: React.CSSProperties;
19
+ /**
20
+ * cn utility function for className merging (e.g., from stack-ui or tailwind-merge)
21
+ */
22
+ cn: (...inputs: any[]) => string;
23
+ };
24
+ declare function AppIcon({ appId, IconComponent, LogoComponent, className, disabled, style, cn, }: AppIconProps): react_jsx_runtime.JSX.Element;
25
+
26
+ export { AppIcon, type AppIconProps, appSquarePaddingExpression, appSquareWidthExpression };
@@ -0,0 +1,26 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { AppId } from './apps-config.js';
3
+
4
+ declare const appSquareWidthExpression = "max(min(11vw,180px),80px)";
5
+ declare const appSquarePaddingExpression = "max(min(1vw,1.5rem),0.25rem)";
6
+ type AppIconProps = {
7
+ appId: AppId;
8
+ /**
9
+ * Icon component from the app frontend config
10
+ */
11
+ IconComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
12
+ /**
13
+ * Optional logo component from the app frontend config
14
+ */
15
+ LogoComponent?: React.FunctionComponent<{}>;
16
+ className?: string;
17
+ disabled?: boolean;
18
+ style?: React.CSSProperties;
19
+ /**
20
+ * cn utility function for className merging (e.g., from stack-ui or tailwind-merge)
21
+ */
22
+ cn: (...inputs: any[]) => string;
23
+ };
24
+ declare function AppIcon({ appId, IconComponent, LogoComponent, className, disabled, style, cn, }: AppIconProps): react_jsx_runtime.JSX.Element;
25
+
26
+ export { AppIcon, type AppIconProps, appSquarePaddingExpression, appSquareWidthExpression };
@@ -0,0 +1,110 @@
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
+
20
+ // src/apps/apps-ui.tsx
21
+ var apps_ui_exports = {};
22
+ __export(apps_ui_exports, {
23
+ AppIcon: () => AppIcon,
24
+ appSquarePaddingExpression: () => appSquarePaddingExpression,
25
+ appSquareWidthExpression: () => appSquareWidthExpression
26
+ });
27
+ module.exports = __toCommonJS(apps_ui_exports);
28
+ var import_arrays = require("../utils/arrays.js");
29
+ var import_apps_config = require("./apps-config.js");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var appSquareWidthExpression = "max(min(11vw,180px),80px)";
32
+ var appSquarePaddingExpression = "max(min(1vw,1.5rem),0.25rem)";
33
+ function AppIcon({
34
+ appId,
35
+ IconComponent,
36
+ LogoComponent,
37
+ className,
38
+ disabled,
39
+ style,
40
+ cn
41
+ }) {
42
+ const svgGradients = (gradients) => {
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "0", height: "0", children: Object.entries(gradients).map(([id, gradient]) => {
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("linearGradient", { id, x1: "100%", y1: "100%", x2: "0%", y2: "0%", children: gradient.map((color, index) => {
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: color, offset: `${index * 100 / (gradient.length - 1)}%` }, index);
46
+ }) }, id);
47
+ }) });
48
+ };
49
+ const app = import_apps_config.ALL_APPS[appId];
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
51
+ "div",
52
+ {
53
+ style,
54
+ className: cn(
55
+ "relative w-24 h-24 rounded-[24.154%] overflow-hidden select-none",
56
+ !disabled && "bg-[linear-gradient(45deg,#dde,#fff)] dark:bg-[linear-gradient(45deg,#222,#666)]",
57
+ disabled && "border-gray-400/70 border-dashed border-4",
58
+ className
59
+ ),
60
+ children: [
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("w-full h-full isolate relative"), children: LogoComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
+ "div",
63
+ {
64
+ className: "absolute inset-[20%] w-[60%] h-[60%] rounded-[24.154%] overflow-hidden flex items-center justify-center border",
65
+ style: {
66
+ opacity: disabled ? 0.6 : 1
67
+ },
68
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogoComponent, {})
69
+ }
70
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "0", height: "0", children: svgGradients({
72
+ "app-icon-gradient-light": ["#c0f", "#66f", "#4af"],
73
+ "app-icon-gradient-dark": ["#3ec", "#9af", "#a5f"],
74
+ "app-icon-gradient-light-expert": ["#f0c", "#f66", "#fa4"],
75
+ "app-icon-gradient-dark-expert": ["#f0c", "#f66", "#fa4"],
76
+ "app-icon-gradient-light-integration": ["#E5AB00", "#FFBA00", "#F8DF80"],
77
+ "app-icon-gradient-dark-integration": ["#E5AB00", "#FFBA00", "#F8DF80"]
78
+ }) }),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ IconComponent,
81
+ {
82
+ opacity: disabled ? 0.75 : 1,
83
+ className: cn(
84
+ "inset-[20%] w-[60%] h-[60%] bg-clip-text text-transparent text-white absolute",
85
+ (0, import_arrays.typedIncludes)(app.tags, "expert") ? "stroke-[url(#app-icon-gradient-light-expert)] dark:stroke-[url(#app-icon-gradient-dark-expert)]" : (0, import_arrays.typedIncludes)(app.tags, "integration") ? "stroke-[url(#app-icon-gradient-light-integration)] dark:stroke-[url(#app-icon-gradient-dark-integration)]" : "stroke-[url(#app-icon-gradient-light)] dark:stroke-[url(#app-icon-gradient-dark)]"
86
+ )
87
+ }
88
+ )
89
+ ] }) }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-0 left-[-100%] right-0 flex flex-col gap-1 [transform:_rotate(-45deg)_translateY(24px)] [transform-origin:top_center]", children: app.stage !== "stable" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
+ "div",
92
+ {
93
+ className: cn(
94
+ "h-4 uppercase text-xs font-bold font-mono tracking-widest text-center",
95
+ disabled ? "bg-gray-400/80 text-white" : app.stage === "alpha" ? "bg-red-500 text-white" : "bg-yellow-600 text-white"
96
+ ),
97
+ children: app.stage
98
+ }
99
+ ) })
100
+ ]
101
+ }
102
+ );
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ AppIcon,
107
+ appSquarePaddingExpression,
108
+ appSquareWidthExpression
109
+ });
110
+ //# sourceMappingURL=apps-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/apps/apps-ui.tsx"],"sourcesContent":["import { typedIncludes } from \"../utils/arrays\";\nimport { ALL_APPS, AppId } from \"./apps-config\";\n\nexport const appSquareWidthExpression = \"max(min(11vw,180px),80px)\";\nexport const appSquarePaddingExpression = \"max(min(1vw,1.5rem),0.25rem)\";\n\nexport type AppIconProps = {\n appId: AppId,\n /**\n * Icon component from the app frontend config\n */\n IconComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>,\n /**\n * Optional logo component from the app frontend config\n */\n LogoComponent?: React.FunctionComponent<{}>,\n className?: string,\n disabled?: boolean,\n style?: React.CSSProperties,\n /**\n * cn utility function for className merging (e.g., from stack-ui or tailwind-merge)\n */\n cn: (...inputs: any[]) => string,\n};\n\nexport function AppIcon({\n appId,\n IconComponent,\n LogoComponent,\n className,\n disabled,\n style,\n cn,\n}: AppIconProps) {\n const svgGradients = (gradients: Record<string, string[]>) => {\n return (\n <svg width=\"0\" height=\"0\">\n {Object.entries(gradients).map(([id, gradient]) => {\n return (\n <linearGradient key={id} id={id} x1=\"100%\" y1=\"100%\" x2=\"0%\" y2=\"0%\">\n {gradient.map((color, index) => {\n return <stop key={index} stopColor={color} offset={`${index * 100 / (gradient.length - 1)}%`} />;\n })}\n </linearGradient>\n );\n })}\n </svg>\n );\n };\n\n const app = ALL_APPS[appId];\n\n return (\n <div\n style={style}\n className={cn(\n \"relative w-24 h-24 rounded-[24.154%] overflow-hidden select-none\",\n !disabled && \"bg-[linear-gradient(45deg,#dde,#fff)] dark:bg-[linear-gradient(45deg,#222,#666)]\",\n disabled && 'border-gray-400/70 border-dashed border-4',\n className,\n )}\n >\n <div className={cn(\"w-full h-full isolate relative\")}>\n {LogoComponent ? (\n <div\n className=\"absolute inset-[20%] w-[60%] h-[60%] rounded-[24.154%] overflow-hidden flex items-center justify-center border\"\n style={{\n opacity: disabled ? 0.6 : 1,\n }}\n >\n <LogoComponent />\n </div>\n ) : (\n <>\n <svg width=\"0\" height=\"0\">\n {svgGradients({\n \"app-icon-gradient-light\": [\"#c0f\", \"#66f\", \"#4af\"],\n \"app-icon-gradient-dark\": [\"#3ec\", \"#9af\", \"#a5f\"],\n \"app-icon-gradient-light-expert\": [\"#f0c\", \"#f66\", \"#fa4\"],\n \"app-icon-gradient-dark-expert\": [\"#f0c\", \"#f66\", \"#fa4\"],\n \"app-icon-gradient-light-integration\": [\"#E5AB00\", \"#FFBA00\", \"#F8DF80\"],\n \"app-icon-gradient-dark-integration\": [\"#E5AB00\", \"#FFBA00\", \"#F8DF80\"],\n })}\n </svg>\n <IconComponent\n opacity={disabled ? 0.75 : 1}\n className={cn(\n \"inset-[20%] w-[60%] h-[60%] bg-clip-text text-transparent text-white absolute\",\n (typedIncludes(app.tags, \"expert\")\n ? \"stroke-[url(#app-icon-gradient-light-expert)] dark:stroke-[url(#app-icon-gradient-dark-expert)]\"\n : typedIncludes(app.tags, \"integration\")\n ? \"stroke-[url(#app-icon-gradient-light-integration)] dark:stroke-[url(#app-icon-gradient-dark-integration)]\"\n : \"stroke-[url(#app-icon-gradient-light)] dark:stroke-[url(#app-icon-gradient-dark)]\"\n )\n )}\n />\n </>\n )}\n </div>\n <div className=\"absolute top-0 left-[-100%] right-0 flex flex-col gap-1 [transform:_rotate(-45deg)_translateY(24px)] [transform-origin:top_center]\">\n {app.stage !== \"stable\" && (\n <div className={cn(\n \"h-4 uppercase text-xs font-bold font-mono tracking-widest text-center\",\n disabled\n ? \"bg-gray-400/80 text-white\"\n : app.stage === \"alpha\"\n ? \"bg-red-500 text-white\"\n : \"bg-yellow-600 text-white\"\n )}\n >\n {app.stage}\n </div>\n )}\n </div>\n </div>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,yBAAgC;AAwCT;AAtChB,IAAM,2BAA2B;AACjC,IAAM,6BAA6B;AAqBnC,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA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