sunpeak 0.5.35 → 0.5.39
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/bin/commands/build.mjs +10 -0
- package/bin/commands/dev.mjs +13 -1
- package/dist/index.cjs +62 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +62 -25
- package/dist/index.js.map +1 -1
- package/dist/style.css +86 -40
- package/package.json +1 -1
- package/template/dist/chatgpt/albums.js +14 -54
- package/template/dist/chatgpt/carousel.js +14 -54
- package/template/dist/chatgpt/counter.js +14 -54
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +13 -858
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js.map +4 -4
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js +33 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js.map +7 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Icon.js +4 -4
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Input.js +13 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +103 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js.map +7 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +1019 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js.map +7 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js +95 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js.map +7 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js +45 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js.map +7 -0
- package/template/node_modules/.vite/deps/_metadata.json +82 -25
- package/template/node_modules/.vite/deps/{chunk-TNWQ7JGO.js → chunk-4TLBUCVB.js} +2 -2
- package/template/node_modules/.vite/deps/chunk-BAG6OO6S.js +115 -0
- package/template/node_modules/.vite/deps/chunk-BAG6OO6S.js.map +7 -0
- package/template/node_modules/.vite/deps/chunk-CQ3GYAYB.js +112 -0
- package/template/node_modules/.vite/deps/chunk-CQ3GYAYB.js.map +7 -0
- package/template/node_modules/.vite/deps/chunk-EGRHWZRV.js +1 -0
- package/template/node_modules/.vite/deps/chunk-EGRHWZRV.js.map +7 -0
- package/template/node_modules/.vite/deps/chunk-EVJ3DVH5.js +628 -0
- package/template/node_modules/.vite/deps/chunk-EVJ3DVH5.js.map +7 -0
- package/template/node_modules/.vite/deps/{chunk-5WRI5ZAA.js → chunk-ILHRZGIS.js} +17 -2
- package/template/node_modules/.vite/deps/chunk-ILHRZGIS.js.map +7 -0
- package/template/node_modules/.vite/deps/{chunk-DUV225XW.js → chunk-KFGKZMLK.js} +3 -3
- package/template/node_modules/.vite/deps/{chunk-7IRBE5E4.js → chunk-PTVT3RFX.js} +3 -3
- package/template/node_modules/.vite/deps/chunk-QPJAV452.js +13 -0
- package/template/node_modules/.vite/deps/chunk-QPJAV452.js.map +7 -0
- package/template/node_modules/.vite/deps/chunk-SGWD4VEU.js +15195 -0
- package/template/node_modules/.vite/deps/chunk-SGWD4VEU.js.map +7 -0
- package/template/node_modules/.vite/deps/{chunk-D3BYX6F4.js → chunk-XB525PXG.js} +3 -3
- package/template/node_modules/.vite/deps/chunk-YOJ6QPGS.js +231 -0
- package/template/node_modules/.vite/deps/chunk-YOJ6QPGS.js.map +7 -0
- package/template/node_modules/.vite/deps/clsx.js +1 -1
- package/template/node_modules/.vite/deps/embla-carousel-react.js +2 -2
- package/template/node_modules/.vite/deps/embla-carousel-wheel-gestures.js +1 -1
- package/template/node_modules/.vite/deps/react-dom.js +3 -3
- package/template/node_modules/.vite/deps/react-dom_client.js +3 -3
- package/template/node_modules/.vite/deps/react.js +2 -2
- package/template/node_modules/.vite/deps/react_jsx-dev-runtime.js +2 -2
- package/template/node_modules/.vite/deps/react_jsx-runtime.js +3 -3
- package/template/node_modules/.vite/deps/tailwind-merge.js +1 -1
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/src/components/album/fullscreen-viewer.tsx +78 -16
- package/template/src/components/resources/counter-resource.test.tsx +4 -4
- package/template/src/components/resources/counter-resource.tsx +5 -5
- /package/template/node_modules/.vite/deps/{chunk-5WRI5ZAA.js.map → @openai_apps-sdk-ui_components_Input.js.map} +0 -0
- /package/template/node_modules/.vite/deps/{chunk-TNWQ7JGO.js.map → chunk-4TLBUCVB.js.map} +0 -0
- /package/template/node_modules/.vite/deps/{chunk-DUV225XW.js.map → chunk-KFGKZMLK.js.map} +0 -0
- /package/template/node_modules/.vite/deps/{chunk-7IRBE5E4.js.map → chunk-PTVT3RFX.js.map} +0 -0
- /package/template/node_modules/.vite/deps/{chunk-D3BYX6F4.js.map → chunk-XB525PXG.js.map} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_react
|
|
3
|
+
} from "./chunk-4TLBUCVB.js";
|
|
4
|
+
import {
|
|
5
|
+
__toESM
|
|
6
|
+
} from "./chunk-ILHRZGIS.js";
|
|
7
|
+
|
|
8
|
+
// ../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/lib/helpers.js
|
|
9
|
+
var import_react = __toESM(require_react());
|
|
10
|
+
|
|
11
|
+
// ../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/lib/environment.js
|
|
12
|
+
var META_ENV = typeof import.meta !== "undefined" ? import.meta.env : void 0;
|
|
13
|
+
var NODE_ENV = typeof process !== "undefined" && "development" ? "development" : "production";
|
|
14
|
+
var isDev = NODE_ENV === "development" || !!(META_ENV == null ? void 0 : META_ENV.DEV);
|
|
15
|
+
var isJSDomLike = typeof navigator !== "undefined" && /(jsdom|happy-dom)/i.test(navigator.userAgent) || typeof globalThis.happyDOM === "object";
|
|
16
|
+
var isTest = NODE_ENV === "test" || (META_ENV == null ? void 0 : META_ENV.MODE) === "test" || isJSDomLike;
|
|
17
|
+
var hasWindow = typeof window !== "undefined";
|
|
18
|
+
var hasDocument = typeof document !== "undefined";
|
|
19
|
+
var canUseDOM = hasWindow && hasDocument;
|
|
20
|
+
|
|
21
|
+
// ../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/lib/helpers.js
|
|
22
|
+
var handlePressableMouseEnter = (evt) => {
|
|
23
|
+
const target = evt.currentTarget;
|
|
24
|
+
if (!(target instanceof HTMLElement)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const elementWidth = target.offsetWidth;
|
|
28
|
+
let scale = 0.985;
|
|
29
|
+
if (elementWidth <= 80) {
|
|
30
|
+
scale = 0.96;
|
|
31
|
+
} else if (elementWidth <= 150) {
|
|
32
|
+
scale = 0.97;
|
|
33
|
+
} else if (elementWidth <= 220) {
|
|
34
|
+
scale = 0.98;
|
|
35
|
+
} else if (elementWidth > 600) {
|
|
36
|
+
scale = 0.995;
|
|
37
|
+
}
|
|
38
|
+
target.style.setProperty("--scale", scale.toString());
|
|
39
|
+
};
|
|
40
|
+
var waitForAnimationFrame = (cb, options) => {
|
|
41
|
+
const runAfterTick = () => {
|
|
42
|
+
const id = setTimeout(cb);
|
|
43
|
+
return () => {
|
|
44
|
+
clearTimeout(id);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
if (!canUseDOM || typeof window.requestAnimationFrame !== "function") {
|
|
48
|
+
return runAfterTick();
|
|
49
|
+
}
|
|
50
|
+
const visibilityHidden = hasDocument && document.visibilityState === "hidden";
|
|
51
|
+
if (visibilityHidden) {
|
|
52
|
+
return runAfterTick();
|
|
53
|
+
}
|
|
54
|
+
let frames = (options == null ? void 0 : options.frames) ?? 2;
|
|
55
|
+
let animationFrame = window.requestAnimationFrame(function recurse() {
|
|
56
|
+
frames -= 1;
|
|
57
|
+
if (frames === 0) {
|
|
58
|
+
cb();
|
|
59
|
+
} else {
|
|
60
|
+
animationFrame = window.requestAnimationFrame(recurse);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return () => {
|
|
64
|
+
if (typeof window.cancelAnimationFrame === "function") {
|
|
65
|
+
window.cancelAnimationFrame(animationFrame);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var toCssVariables = (variables) => {
|
|
70
|
+
const formattedVariables = Object.keys(variables).reduce((acc, variable) => {
|
|
71
|
+
const value = variables[variable];
|
|
72
|
+
if (value || value === 0) {
|
|
73
|
+
const prefix = variable.startsWith("--") ? "" : "--";
|
|
74
|
+
const formattedValue = typeof value === "number" ? `${value}px` : value;
|
|
75
|
+
acc[`${prefix}${variable}`] = formattedValue;
|
|
76
|
+
}
|
|
77
|
+
return acc;
|
|
78
|
+
}, {});
|
|
79
|
+
return formattedVariables;
|
|
80
|
+
};
|
|
81
|
+
var toAngle = (value) => typeof value === "number" ? `${value}deg` : value;
|
|
82
|
+
var toOpacityProperty = (opacity) => String(opacity);
|
|
83
|
+
var toMsDurationProperty = (duration) => `${duration}ms`;
|
|
84
|
+
var toTransformProperty = ({ x, y, scale, rotate, skewX, skewY } = {}) => {
|
|
85
|
+
const transforms = [
|
|
86
|
+
x == null ? null : `translateX(${x}px)`,
|
|
87
|
+
y == null ? null : `translateY(${y}px)`,
|
|
88
|
+
scale == null ? null : `scale(${scale})`,
|
|
89
|
+
rotate == null ? null : `rotate(${toAngle(rotate)})`,
|
|
90
|
+
skewX == null ? null : `skewX(${toAngle(skewX)})`,
|
|
91
|
+
skewY == null ? null : `skewY(${toAngle(skewY)})`
|
|
92
|
+
].filter(Boolean);
|
|
93
|
+
return transforms.length ? transforms.join(" ") : "none";
|
|
94
|
+
};
|
|
95
|
+
var toFilterProperty = ({ blur } = {}) => {
|
|
96
|
+
const filters = [blur == null ? null : `blur(${blur}px)`].filter(Boolean);
|
|
97
|
+
return filters.length ? filters.join(" ") : "none";
|
|
98
|
+
};
|
|
99
|
+
var preventDefaultHandler = (evt) => {
|
|
100
|
+
evt.preventDefault();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
isDev,
|
|
105
|
+
isTest,
|
|
106
|
+
handlePressableMouseEnter,
|
|
107
|
+
waitForAnimationFrame,
|
|
108
|
+
toCssVariables,
|
|
109
|
+
toOpacityProperty,
|
|
110
|
+
toMsDurationProperty,
|
|
111
|
+
toTransformProperty,
|
|
112
|
+
toFilterProperty,
|
|
113
|
+
preventDefaultHandler
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=chunk-BAG6OO6S.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/src/lib/helpers.ts", "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/src/lib/environment.ts"],
|
|
4
|
+
"sourcesContent": ["import { type CSSProperties } from \"react\"\nimport { canUseDOM, hasDocument, hasWindow } from \"./environment\"\nimport type { Pretty } from \"./utilityTypes\"\n\nexport const prefersReducedMotion = () => {\n if (!hasWindow || typeof window.matchMedia !== \"function\") {\n return false\n }\n\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n}\n\nexport const handlePressableMouseEnter = (evt: React.MouseEvent) => {\n const target = evt.currentTarget\n\n // Safely coerce type to HTMLElement so TS is peaceful with `evt.target`\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n const elementWidth = target.offsetWidth\n\n let scale = 0.985\n\n if (elementWidth <= 80) {\n scale = 0.96\n } else if (elementWidth <= 150) {\n scale = 0.97\n } else if (elementWidth <= 220) {\n scale = 0.98\n } else if (elementWidth > 600) {\n scale = 0.995\n }\n\n target.style.setProperty(\"--scale\", scale.toString())\n}\n\ninterface CancelAnimationFrame {\n (): void\n}\n\nexport const waitForAnimationFrame = (\n cb: () => void,\n options?: { frames: number },\n): CancelAnimationFrame => {\n const runAfterTick = () => {\n const id = setTimeout(cb)\n return () => {\n clearTimeout(id)\n }\n }\n\n if (!canUseDOM || typeof window.requestAnimationFrame !== \"function\") {\n return runAfterTick()\n }\n\n const visibilityHidden = hasDocument && document.visibilityState === \"hidden\"\n if (visibilityHidden) {\n return runAfterTick()\n }\n\n let frames = options?.frames ?? 2\n let animationFrame = window.requestAnimationFrame(function recurse() {\n frames -= 1\n if (frames === 0) {\n cb()\n } else {\n animationFrame = window.requestAnimationFrame(recurse)\n }\n })\n\n return () => {\n if (typeof window.cancelAnimationFrame === \"function\") {\n window.cancelAnimationFrame(animationFrame)\n }\n }\n}\n\nexport const toCssVariables = (\n variables: Record<string, string | number | undefined>,\n): CSSProperties => {\n const formattedVariables = Object.keys(variables).reduce(\n (acc, variable) => {\n // Ensure value is truthy\n const value = variables[variable]\n // Accept 0 as a valid value\n if (value || value === 0) {\n // Add the prefix if it wasn't already provided\n const prefix = variable.startsWith(\"--\") ? \"\" : \"--\"\n const formattedValue = typeof value === \"number\" ? `${value}px` : value\n\n acc[`${prefix}${variable}`] = formattedValue\n }\n\n return acc\n },\n {} as Record<string, string>,\n )\n\n // Safe casting because we know we've formatted an object of CSS Variable strings\n return formattedVariables as CSSProperties\n}\n\nexport const toAngle = (value: number | string): string =>\n typeof value === \"number\" ? `${value}deg` : value\n\nexport const toOpacityProperty = (opacity: number): string => String(opacity)\n\nexport const toMsDurationProperty = (duration: number): string => `${duration}ms`\n\nexport const toTransformProperty = ({\n x,\n y,\n scale,\n rotate,\n skewX,\n skewY,\n}: {\n x?: number\n y?: number\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n} = {}): string => {\n const transforms = [\n x == null ? null : `translateX(${x}px)`,\n y == null ? null : `translateY(${y}px)`,\n scale == null ? null : `scale(${scale})`,\n rotate == null ? null : `rotate(${toAngle(rotate)})`,\n skewX == null ? null : `skewX(${toAngle(skewX)})`,\n skewY == null ? null : `skewY(${toAngle(skewY)})`,\n ].filter(Boolean)\n\n return transforms.length ? transforms.join(\" \") : \"none\"\n}\n\nexport const toFilterProperty = ({ blur }: { blur?: number | undefined } = {}) => {\n // Maybe add more support in the future\n const filters = [blur == null ? null : `blur(${blur}px)`].filter(Boolean)\n\n return filters.length ? filters.join(\" \") : \"none\"\n}\n\nexport const preventDefaultHandler = (evt: Event) => {\n evt.preventDefault()\n}\n\n/*\n * Intentionally simple selector string. Purposeful exclusions: (for now)\n * - select, because our selects are better recognized as button\n * - unused selectors like iframe, object, .etc.\n * - states like [inert]\n */\nexport const focusableElements = (element: HTMLElement) =>\n element.querySelectorAll<HTMLElement>(\n 'a[href], input:not([disabled]):not([type=\"hidden\"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]',\n )\n\nexport const sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * Group an array of objects by a property, preserving the *first-seen* order\n * of each group.\n *\n * @example\n * groupByOrdered(people, \"team\")\n * // => [ { team: \"infra\", items:[...] }, { team:\"design\", items:[...] }, ... ]\n */\nexport function groupByProperty<T extends object, K extends keyof T, F = T[K]>(\n items: T[],\n key: K,\n format: (raw: T[K], item: T) => F = (raw) => raw as F,\n) {\n const groups: Pretty<{ [P in K]: F } & { items: T[] }>[] = []\n const indexMap = new Map<unknown, number>() // maps group value -> index in groups array\n\n for (const item of items) {\n const value = format(item[key], item)\n\n // Add to existing group\n const existing = indexMap.get(value)\n if (existing !== undefined) {\n groups[existing].items.push(item)\n continue\n }\n\n // Create new group\n const group = { [key]: value, items: [item] } as { [P in K]: F } & { items: T[] }\n indexMap.set(value, groups.length)\n groups.push(group)\n }\n\n return groups\n}\n", "const META_ENV = typeof import.meta !== \"undefined\" ? import.meta.env : undefined\n\nconst NODE_ENV =\n typeof process !== \"undefined\" && process.env?.NODE_ENV ? process.env?.NODE_ENV : \"production\"\n\nexport const isDev = NODE_ENV === \"development\" || !!META_ENV?.DEV\n\nexport const isJSDomLike =\n (typeof navigator !== \"undefined\" && /(jsdom|happy-dom)/i.test(navigator.userAgent)) ||\n typeof (globalThis as Record<string, unknown>).happyDOM === \"object\"\n\nexport const isTest = NODE_ENV === \"test\" || META_ENV?.MODE === \"test\" || isJSDomLike\n\nexport const hasWindow = typeof window !== \"undefined\"\nexport const hasDocument = typeof document !== \"undefined\"\nexport const canUseDOM = hasWindow && hasDocument\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA,mBAAmC;;;ACAnC,IAAM,WAAW,OAAO,gBAAgB,cAAc,YAAY,MAAM;AAExE,IAAM,WACJ,OAAO,YAAY,eAAe,gBAAwB,gBAAwB;AAE7E,IAAM,QAAQ,aAAa,iBAAiB,CAAC,EAAC,qCAAU;AAExD,IAAM,cACV,OAAO,cAAc,eAAe,qBAAqB,KAAK,UAAU,SAAS,KAClF,OAAQ,WAAuC,aAAa;AAEvD,IAAM,SAAS,aAAa,WAAU,qCAAU,UAAS,UAAU;AAEnE,IAAM,YAAY,OAAO,WAAW;AACpC,IAAM,cAAc,OAAO,aAAa;AACxC,IAAM,YAAY,aAAa;;;ADH/B,IAAM,4BAA4B,CAAC,QAAyB;AACjE,QAAM,SAAS,IAAI;AAGnB,MAAI,EAAE,kBAAkB,cAAc;AACpC;EACF;AAEA,QAAM,eAAe,OAAO;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OAAO,UAAU,WAAW,GAAG,KAAK,QAAQ;AAEvC,IAAM,oBAAoB,CAAC,YAA4B,OAAO,OAAO;AAErE,IAAM,uBAAuB,CAAC,aAA6B,GAAG,QAAQ;AAEtE,IAAM,sBAAsB,CAAC,EAClC,GACA,GACA,OACA,QACA,OACA,MAAK,IAQH,CAAA,MAAc;AAChB,QAAM,aAAa;IACjB,KAAK,OAAO,OAAO,cAAc,CAAC;IAClC,KAAK,OAAO,OAAO,cAAc,CAAC;IAClC,SAAS,OAAO,OAAO,SAAS,KAAK;IACrC,UAAU,OAAO,OAAO,UAAU,QAAQ,MAAM,CAAC;IACjD,SAAS,OAAO,OAAO,SAAS,QAAQ,KAAK,CAAC;IAC9C,SAAS,OAAO,OAAO,SAAS,QAAQ,KAAK,CAAC;IAC9C,OAAO,OAAO;AAEhB,SAAO,WAAW,SAAS,WAAW,KAAK,GAAG,IAAI;AACpD;AAEO,IAAM,mBAAmB,CAAC,EAAE,KAAI,IAAoC,CAAA,MAAM;AAE/E,QAAM,UAAU,CAAC,QAAQ,OAAO,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,OAAO;AAExE,SAAO,QAAQ,SAAS,QAAQ,KAAK,GAAG,IAAI;AAC9C;AAEO,IAAM,wBAAwB,CAAC,QAAc;AAClD,MAAI,eAAc;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
o
|
|
3
|
+
} from "./chunk-QPJAV452.js";
|
|
4
|
+
import {
|
|
5
|
+
clsx_default
|
|
6
|
+
} from "./chunk-CNYJBM5F.js";
|
|
7
|
+
import {
|
|
8
|
+
require_jsx_runtime
|
|
9
|
+
} from "./chunk-PTVT3RFX.js";
|
|
10
|
+
import {
|
|
11
|
+
require_react
|
|
12
|
+
} from "./chunk-4TLBUCVB.js";
|
|
13
|
+
import {
|
|
14
|
+
__toESM
|
|
15
|
+
} from "./chunk-ILHRZGIS.js";
|
|
16
|
+
|
|
17
|
+
// ../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Input/Input.js
|
|
18
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime());
|
|
19
|
+
var import_react = __toESM(require_react());
|
|
20
|
+
import s from "/home/runner/work/sunpeak/sunpeak/node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Input/Input.module.css";
|
|
21
|
+
var Input = (props) => {
|
|
22
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
23
|
+
const inputIdSuffix = (0, import_react.useId)();
|
|
24
|
+
const onePasswordPreventionId = `search-ui-input-${inputIdSuffix}`;
|
|
25
|
+
const {
|
|
26
|
+
id,
|
|
27
|
+
name,
|
|
28
|
+
type = "text",
|
|
29
|
+
variant = "outline",
|
|
30
|
+
size = "md",
|
|
31
|
+
gutterSize,
|
|
32
|
+
className,
|
|
33
|
+
autoComplete,
|
|
34
|
+
disabled = false,
|
|
35
|
+
readOnly = false,
|
|
36
|
+
invalid = false,
|
|
37
|
+
// Default to `true` when type="password" or presence of `name`
|
|
38
|
+
allowAutofillExtensions = type === "password" || !!name,
|
|
39
|
+
onFocus,
|
|
40
|
+
onBlur,
|
|
41
|
+
onAnimationStart,
|
|
42
|
+
onAutofill,
|
|
43
|
+
autoSelect,
|
|
44
|
+
startAdornment: StartAdornment,
|
|
45
|
+
endAdornment: EndAdornment,
|
|
46
|
+
pill,
|
|
47
|
+
opticallyAlign,
|
|
48
|
+
ref,
|
|
49
|
+
...restProps
|
|
50
|
+
} = props;
|
|
51
|
+
const handleMouseDown = (evt) => {
|
|
52
|
+
const input = inputRef.current;
|
|
53
|
+
if (!evt.target || !(evt.target instanceof Element) || !input) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (input.contains(evt.target)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (evt.target.closest("button, [type='button'], [role='button'], [role='menuitem']")) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
evt.preventDefault();
|
|
63
|
+
if (document.activeElement !== input) {
|
|
64
|
+
input.focus();
|
|
65
|
+
}
|
|
66
|
+
const { left, top } = input.getBoundingClientRect();
|
|
67
|
+
const { clientX, clientY } = evt;
|
|
68
|
+
const isBefore = clientY < top || clientX < left;
|
|
69
|
+
if (evt.detail === 1) {
|
|
70
|
+
if (isBefore) {
|
|
71
|
+
input.setSelectionRange(0, 0);
|
|
72
|
+
} else {
|
|
73
|
+
const length = input.value.length;
|
|
74
|
+
input.setSelectionRange(length, length);
|
|
75
|
+
}
|
|
76
|
+
} else if (evt.detail === 2) {
|
|
77
|
+
const words = input.value.match(/\w+|[^\w\s]/g) || [];
|
|
78
|
+
const selectedWord = isBefore ? words.at(0) : words.at(-1);
|
|
79
|
+
if (selectedWord) {
|
|
80
|
+
const wordIndex = isBefore ? input.value.indexOf(selectedWord) : input.value.lastIndexOf(selectedWord);
|
|
81
|
+
input.setSelectionRange(wordIndex, wordIndex + selectedWord.length);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
input.select();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const [focused, setFocused] = (0, import_react.useState)(false);
|
|
88
|
+
(0, import_react.useEffect)(() => {
|
|
89
|
+
var _a;
|
|
90
|
+
if (autoSelect) {
|
|
91
|
+
(_a = inputRef.current) == null ? void 0 : _a.select();
|
|
92
|
+
}
|
|
93
|
+
}, [autoSelect]);
|
|
94
|
+
const handleAnimationStart = (evt) => {
|
|
95
|
+
onAnimationStart == null ? void 0 : onAnimationStart(evt);
|
|
96
|
+
if (evt.animationName === "native-autofill-in") {
|
|
97
|
+
onAutofill == null ? void 0 : onAutofill();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return (0, import_jsx_runtime.jsxs)("div", { className: clsx_default(s.Container, className), "data-variant": variant, "data-size": size, "data-gutter-size": gutterSize, "data-focused": focused, "data-disabled": disabled ? "" : void 0, "data-readonly": readOnly ? "" : void 0, "data-invalid": invalid ? "" : void 0, "data-pill": pill ? "" : void 0, "data-optically-align": opticallyAlign, "data-has-start-adornment": StartAdornment ? "" : void 0, "data-has-end-adornment": EndAdornment ? "" : void 0, onMouseDown: handleMouseDown, children: [StartAdornment, (0, import_jsx_runtime.jsx)("input", { ...restProps, ref: o([ref, inputRef]), id: id || (allowAutofillExtensions ? void 0 : onePasswordPreventionId), className: s.Input, type, name, readOnly, disabled, onFocus: (evt) => {
|
|
101
|
+
setFocused(true);
|
|
102
|
+
onFocus == null ? void 0 : onFocus(evt);
|
|
103
|
+
}, onBlur: (evt) => {
|
|
104
|
+
setFocused(false);
|
|
105
|
+
onBlur == null ? void 0 : onBlur(evt);
|
|
106
|
+
}, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? void 0 : true, "data-1p-ignore": allowAutofillExtensions ? void 0 : true }), EndAdornment] });
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
Input
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-CQ3GYAYB.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/src/components/Input/Input.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useEffect, useId, useRef, useState } from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { type ControlSize, type Sizes, type Variants } from \"../../types\"\nimport s from \"./Input.module.css\"\n\nexport type InputProps = {\n /**\n * Visual style of the input\n * @default outline\n */\n variant?: Variants<\"outline\" | \"soft\">\n /**\n * Controls the size of the input\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * @default md\n */\n size?: ControlSize\n /**\n * Controls gutter on the edges of the input, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n gutterSize?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Mark the input as invalid\n * @default false\n */\n invalid?: boolean\n /**\n * Allow autofill extensions to appear in the input\n * @default false\n */\n allowAutofillExtensions?: boolean\n /**\n * Select all contents of the input when mounted.\n * @default false\n */\n autoSelect?: boolean\n /** Callback invoked when the input is autofilled by the browser */\n onAutofill?: () => void\n /** Content rendered at the start of the input */\n startAdornment?: React.ReactNode\n /** Content rendered at the end of the input */\n endAdornment?: React.ReactNode\n /**\n * Determines if the button should be a fully rounded pill shape\n * @default false\n */\n pill?: boolean\n /**\n * Applies a negative margin using the current gutter to optically align the input\n * with surrounding content.\n */\n opticallyAlign?: \"start\" | \"end\"\n /** Ref for the input */\n ref?: React.Ref<HTMLInputElement | null>\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"disabled\" | \"size\">\n\nexport const Input = (props: InputProps) => {\n const inputRef = useRef<HTMLInputElement | null>(null)\n const inputIdSuffix = useId()\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${inputIdSuffix}`\n const {\n id,\n name,\n type = \"text\",\n variant = \"outline\",\n size = \"md\",\n gutterSize,\n className,\n autoComplete,\n disabled = false,\n readOnly = false,\n invalid = false,\n // Default to `true` when type=\"password\" or presence of `name`\n allowAutofillExtensions = type === \"password\" || !!name,\n onFocus,\n onBlur,\n onAnimationStart,\n onAutofill,\n autoSelect,\n startAdornment: StartAdornment,\n endAdornment: EndAdornment,\n pill,\n opticallyAlign,\n ref,\n ...restProps\n } = props\n // Redirect clicks on the container and adornments\n const handleMouseDown = (evt: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current\n // Bail out if the target is not an element or the textarea is not found\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n // Bail out if the target is inside the textarea\n if (input.contains(evt.target)) {\n return\n }\n // Bail out if the target is a button\n if (evt.target.closest(\"button, [type='button'], [role='button'], [role='menuitem']\")) {\n return\n }\n\n evt.preventDefault()\n // If the textarea is not focused, focus it\n if (document.activeElement !== input) {\n input.focus()\n }\n\n const { left, top } = input.getBoundingClientRect()\n const { clientX, clientY } = evt\n // \"Before\" the input: top/left\n const isBefore = clientY < top || clientX < left\n\n // If this is the first click, clear the selection.\n if (evt.detail === 1) {\n if (isBefore) {\n input.setSelectionRange(0, 0)\n } else {\n const length = input.value.length\n input.setSelectionRange(length, length)\n }\n }\n // If this is the second click, select the first or last word\n else if (evt.detail === 2) {\n // Split the textarea value into words and non-word characters\n const words = input.value.match(/\\w+|[^\\w\\s]/g) || []\n const selectedWord = isBefore ? words.at(0) : words.at(-1)\n if (selectedWord) {\n const wordIndex = isBefore\n ? input.value.indexOf(selectedWord)\n : input.value.lastIndexOf(selectedWord)\n input.setSelectionRange(wordIndex, wordIndex + selectedWord.length)\n }\n }\n // If this is the third click or greater, select the entire input\n else {\n input.select()\n }\n }\n\n const [focused, setFocused] = useState<boolean>(false)\n\n useEffect(() => {\n if (autoSelect) {\n inputRef.current?.select()\n }\n }, [autoSelect])\n\n const handleAnimationStart = (evt: React.AnimationEvent<HTMLInputElement>) => {\n onAnimationStart?.(evt)\n if (evt.animationName === \"native-autofill-in\") {\n onAutofill?.()\n }\n }\n\n return (\n <div\n className={clsx(s.Container, className)}\n data-variant={variant}\n data-size={size}\n data-gutter-size={gutterSize}\n data-focused={focused}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-pill={pill ? \"\" : undefined}\n data-optically-align={opticallyAlign}\n data-has-start-adornment={StartAdornment ? \"\" : undefined}\n data-has-end-adornment={EndAdornment ? \"\" : undefined}\n onMouseDown={handleMouseDown}\n >\n {StartAdornment}\n <input\n {...restProps}\n ref={mergeRefs([ref, inputRef])}\n id={id || (allowAutofillExtensions ? undefined : onePasswordPreventionId)}\n className={s.Input}\n type={type}\n name={name}\n readOnly={readOnly}\n disabled={disabled}\n onFocus={(evt) => {\n setFocused(true)\n onFocus?.(evt)\n }}\n onBlur={(evt) => {\n setFocused(false)\n onBlur?.(evt)\n }}\n onAnimationStart={handleAnimationStart}\n // Prevent LastPass and 1Password from appearing\n data-lpignore={allowAutofillExtensions ? undefined : true}\n data-1p-ignore={allowAutofillExtensions ? undefined : true}\n />\n {EndAdornment}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAGA,mBAAmD;AAGnD,OAAO,OAAO;AAkEP,IAAM,QAAQ,CAAC,UAAqB;AACzC,QAAM,eAAW,qBAAgC,IAAI;AACrD,QAAM,oBAAgB,oBAAK;AAG3B,QAAM,0BAA0B,mBAAmB,aAAa;AAChE,QAAM;IACJ;IACA;IACA,OAAO;IACP,UAAU;IACV,OAAO;IACP;IACA;IACA;IACA,WAAW;IACX,WAAW;IACX,UAAU;;IAEV,0BAA0B,SAAS,cAAc,CAAC,CAAC;IACnD;IACA;IACA;IACA;IACA;IACA,gBAAgB;IAChB,cAAc;IACd;IACA;IACA;IACA,GAAG;EAAS,IACV;AAEJ,QAAM,kBAAkB,CAAC,QAAyC;AAChE,UAAM,QAAQ,SA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