@aixnn/aixautots 0.0.0-stage → 0.5.3

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.
@@ -0,0 +1,60 @@
1
+ import { useAixNav } from '../chunk-5BMFMDQR.js';
2
+ import { useAixT } from '../chunk-64Q7BBIQ.js';
3
+ import { useScripts } from '../chunk-O34SNDQB.js';
4
+ import '../chunk-V4MXFPDX.js';
5
+ import '../chunk-IJVNII5N.js';
6
+ import '../chunk-UINEPEIE.js';
7
+ import '../chunk-OXIM6EYO.js';
8
+ import '../chunk-TATL3HTE.js';
9
+ import '../chunk-NWFYTFMI.js';
10
+ import { Pencil, Store } from 'lucide-react';
11
+ import { jsx, jsxs } from 'react/jsx-runtime';
12
+
13
+ function MarketPage(_props = {}) {
14
+ const t = useAixT();
15
+ const { navigate } = useAixNav();
16
+ const scriptsQuery = useScripts();
17
+ const scripts = (scriptsQuery.data ?? []).filter((s) => s.visibility === "system");
18
+ const loading = scriptsQuery.loading;
19
+ const error = scriptsQuery.error;
20
+ return /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto p-6", children: loading ? /* @__PURE__ */ jsx("div", { className: "flex h-32 items-center justify-center text-sm text-muted-foreground", children: t("common.loading") }) : error ? /* @__PURE__ */ jsx("div", { className: "flex h-32 items-center justify-center text-sm text-destructive", children: error.message }) : scripts.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex h-32 items-center justify-center text-sm text-muted-foreground", children: t("market.empty") }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: scripts.map((s) => /* @__PURE__ */ jsxs(
21
+ "div",
22
+ {
23
+ className: "group relative flex flex-col overflow-hidden rounded-lg border border-border bg-card text-left transition-colors hover:border-primary/50",
24
+ children: [
25
+ /* @__PURE__ */ jsxs(
26
+ "button",
27
+ {
28
+ type: "button",
29
+ onClick: () => navigate(`/editor/${s.id}`),
30
+ className: "absolute right-2 top-2 z-10 inline-flex items-center gap-1 rounded-md border border-border bg-card/90 px-2 py-1 text-xs text-foreground opacity-0 backdrop-blur transition-opacity hover:border-primary/50 group-hover:opacity-100",
31
+ "aria-label": t("market.editAria", { name: s.name }),
32
+ children: [
33
+ /* @__PURE__ */ jsx(Pencil, { className: "h-3 w-3" }),
34
+ t("common.edit")
35
+ ]
36
+ }
37
+ ),
38
+ /* @__PURE__ */ jsxs(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ onClick: () => navigate(`/editor/${s.id}`),
43
+ className: "flex flex-1 flex-col text-left",
44
+ children: [
45
+ s.cover_url ? /* @__PURE__ */ jsx("img", { src: s.cover_url, alt: "", className: "aspect-video w-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "flex aspect-video w-full items-center justify-center bg-gradient-to-br from-primary/20 to-secondary", children: /* @__PURE__ */ jsx(Store, { className: "h-8 w-8 text-muted-foreground" }) }),
46
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 p-4", children: [
47
+ /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold", children: s.name }),
48
+ s.description && /* @__PURE__ */ jsx("div", { className: "line-clamp-2 text-xs text-muted-foreground", children: s.description }),
49
+ s.platform && /* @__PURE__ */ jsx("span", { className: "mt-1 inline-flex w-fit rounded-full border border-border px-2 py-0.5 text-[10px] text-muted-foreground", children: s.platform })
50
+ ] })
51
+ ]
52
+ }
53
+ )
54
+ ]
55
+ },
56
+ s.id
57
+ )) }) });
58
+ }
59
+
60
+ export { MarketPage };
@@ -0,0 +1,3 @@
1
+ import '../chunk-OEZFYKL6.js';
2
+ export { ControlBar, MirrorView } from '../chunk-CVV7FOMQ.js';
3
+ import '../chunk-NWFYTFMI.js';
@@ -0,0 +1 @@
1
+ export { Badge, Button, Dialog, Drawer, Input, Popover, Select, ToastViewport, cn, useToast } from '../../chunk-EVHTAXQG.js';
@@ -0,0 +1,10 @@
1
+ export { CodeEditor, DeviceSelect, RunPanel, ScriptParamEditor, ScriptStudio, TimelineStep } from '../chunk-XNKC6HU3.js';
2
+ export { LogConsole } from '../chunk-FW23FLAF.js';
3
+ import '../chunk-EVHTAXQG.js';
4
+ import '../chunk-O34SNDQB.js';
5
+ import '../chunk-V4MXFPDX.js';
6
+ import '../chunk-IJVNII5N.js';
7
+ import '../chunk-UINEPEIE.js';
8
+ import '../chunk-OXIM6EYO.js';
9
+ import '../chunk-TATL3HTE.js';
10
+ import '../chunk-NWFYTFMI.js';
@@ -0,0 +1,210 @@
1
+ import { useAixNav } from '../chunk-5BMFMDQR.js';
2
+ import { useAixT } from '../chunk-64Q7BBIQ.js';
3
+ import { cn, Badge, Button, Input } from '../chunk-EVHTAXQG.js';
4
+ import { useScripts } from '../chunk-O34SNDQB.js';
5
+ import '../chunk-V4MXFPDX.js';
6
+ import '../chunk-IJVNII5N.js';
7
+ import '../chunk-UINEPEIE.js';
8
+ import '../chunk-OXIM6EYO.js';
9
+ import '../chunk-TATL3HTE.js';
10
+ import '../chunk-NWFYTFMI.js';
11
+ import { useState, useMemo } from 'react';
12
+ import { AppWindow, Monitor, Smartphone, FileText, Play, Copy, Trash2, PlusCircle, LayoutGrid, Plus, Search } from 'lucide-react';
13
+ import { jsxs, jsx } from 'react/jsx-runtime';
14
+
15
+ var platformMeta = {
16
+ ios: { label: "iOS", icon: Smartphone },
17
+ android: { label: "Android", icon: Smartphone },
18
+ macos: { label: "macOS", icon: Monitor },
19
+ windows: { label: "Windows", icon: AppWindow }
20
+ };
21
+ var previewTints = [
22
+ "from-primary/15 to-primary/5",
23
+ "from-success/15 to-success/5",
24
+ "from-warning/15 to-warning/5",
25
+ "from-secondary to-muted"
26
+ ];
27
+ function tintFor(id) {
28
+ let hash = 0;
29
+ for (let i = 0; i < id.length; i++) hash = hash * 31 + id.charCodeAt(i) | 0;
30
+ return previewTints[Math.abs(hash) % previewTints.length];
31
+ }
32
+ function ScriptCard({ script, onDelete, onDuplicate }) {
33
+ const { navigate } = useAixNav();
34
+ const t = useAixT();
35
+ const platform = script.platform ? platformMeta[script.platform.toLowerCase()] : void 0;
36
+ const PlatformIcon = platform?.icon ?? Smartphone;
37
+ return /* @__PURE__ */ jsxs("div", { className: "group flex flex-col overflow-hidden rounded-xl border border-border bg-card transition-all duration-300 hover:-translate-y-1 hover:border-primary/60 hover:shadow-lg", children: [
38
+ /* @__PURE__ */ jsxs(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ onClick: () => navigate(`/editor/${script.id}`),
43
+ className: cn(
44
+ "relative flex aspect-video w-full items-center justify-center overflow-hidden bg-gradient-to-br text-left",
45
+ tintFor(script.id)
46
+ ),
47
+ children: [
48
+ /* @__PURE__ */ jsx(FileText, { className: "h-9 w-9 text-foreground/15 transition-transform duration-500 group-hover:scale-110" }),
49
+ platform && /* @__PURE__ */ jsxs("span", { className: "absolute left-2 top-2 inline-flex items-center gap-1 rounded-md bg-card/70 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-foreground/80 backdrop-blur-md", children: [
50
+ /* @__PURE__ */ jsx(PlatformIcon, { className: "h-3 w-3" }),
51
+ platform.label
52
+ ] })
53
+ ]
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col p-4", children: [
57
+ /* @__PURE__ */ jsxs("div", { className: "mb-1.5 flex items-start justify-between gap-2", children: [
58
+ /* @__PURE__ */ jsx(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ onClick: () => navigate(`/editor/${script.id}`),
63
+ className: "truncate text-left text-headline-md font-semibold text-foreground transition-colors hover:text-primary",
64
+ children: script.name
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(Badge, { variant: "info", className: "flex-shrink-0", children: t("scripts.ready") })
68
+ ] }),
69
+ script.description && /* @__PURE__ */ jsx("p", { className: "mb-3 line-clamp-2 text-body-sm text-muted-foreground", children: script.description }),
70
+ /* @__PURE__ */ jsxs("div", { className: "mt-auto flex items-center justify-between border-t border-border pt-3", children: [
71
+ /* @__PURE__ */ jsx("span", { className: "text-body-sm text-muted-foreground", children: new Date(script.updated_at).toLocaleDateString() }),
72
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
73
+ /* @__PURE__ */ jsx(
74
+ Button,
75
+ {
76
+ variant: "ghost",
77
+ size: "icon",
78
+ onClick: () => navigate(`/editor/${script.id}`),
79
+ title: t("common.run"),
80
+ className: "hover:bg-primary/10 hover:text-primary",
81
+ children: /* @__PURE__ */ jsx(Play, { className: "h-3.5 w-3.5" })
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx(
85
+ Button,
86
+ {
87
+ variant: "ghost",
88
+ size: "icon",
89
+ onClick: () => onDuplicate(script.id),
90
+ title: t("scripts.duplicate"),
91
+ children: /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" })
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx(
95
+ Button,
96
+ {
97
+ variant: "ghost",
98
+ size: "icon",
99
+ onClick: () => onDelete(script.id),
100
+ title: t("common.delete"),
101
+ className: "hover:bg-destructive/10 hover:text-destructive",
102
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
103
+ }
104
+ )
105
+ ] })
106
+ ] })
107
+ ] })
108
+ ] });
109
+ }
110
+ function CreateTemplateCard({ onClick }) {
111
+ const t = useAixT();
112
+ return /* @__PURE__ */ jsxs(
113
+ "button",
114
+ {
115
+ type: "button",
116
+ onClick,
117
+ className: "group flex min-h-[220px] flex-col items-center justify-center rounded-xl border-2 border-dashed border-border bg-surface p-8 text-center transition-all duration-300 hover:border-primary/60 hover:bg-card",
118
+ children: [
119
+ /* @__PURE__ */ jsx("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-secondary text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary", children: /* @__PURE__ */ jsx(PlusCircle, { className: "h-7 w-7" }) }),
120
+ /* @__PURE__ */ jsx("span", { className: "text-headline-md font-semibold text-foreground transition-colors group-hover:text-primary", children: t("scripts.createFromTemplate") }),
121
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-body-sm text-muted-foreground", children: t("scripts.createFromTemplateDesc") })
122
+ ]
123
+ }
124
+ );
125
+ }
126
+ var PLATFORMS = ["all", "ios", "android", "macos", "windows"];
127
+ var platformIcons = {
128
+ all: LayoutGrid,
129
+ ios: Smartphone,
130
+ android: Smartphone,
131
+ macos: Monitor,
132
+ windows: Monitor
133
+ };
134
+ function ScriptsPage() {
135
+ const { data, loading, remove, duplicate } = useScripts();
136
+ const { navigate } = useAixNav();
137
+ const t = useAixT();
138
+ const [searchQuery, setSearchQuery] = useState("");
139
+ const [platformFilter, setPlatformFilter] = useState("all");
140
+ const scripts = data ?? [];
141
+ const platformPills = useMemo(
142
+ () => PLATFORMS.map((p) => ({
143
+ value: p,
144
+ label: p === "all" ? t("scripts.allPlatforms") : p === "ios" ? "iOS" : p === "android" ? "Android" : p === "macos" ? "macOS" : "Windows",
145
+ icon: platformIcons[p] ?? LayoutGrid
146
+ })),
147
+ [t]
148
+ );
149
+ const filteredScripts = scripts.filter((s) => {
150
+ const q = searchQuery.toLowerCase();
151
+ const matchesSearch = s.name.toLowerCase().includes(q) || (s.description ?? "").toLowerCase().includes(q);
152
+ const matchesPlatform = platformFilter === "all" || s.platform === platformFilter;
153
+ return matchesSearch && matchesPlatform;
154
+ });
155
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col", children: [
156
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-6 py-3", children: [
157
+ /* @__PURE__ */ jsx("span", { className: "text-body-sm text-muted-foreground", children: t("scripts.count", { n: scripts.length }) }),
158
+ /* @__PURE__ */ jsxs(Button, { onClick: () => navigate("/editor"), children: [
159
+ /* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
160
+ t("scripts.newScript")
161
+ ] })
162
+ ] }),
163
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 border-b border-border px-6 py-4 md:flex-row md:items-center md:justify-between", children: [
164
+ /* @__PURE__ */ jsx("div", { className: "w-full max-w-sm", children: /* @__PURE__ */ jsx(
165
+ Input,
166
+ {
167
+ icon: /* @__PURE__ */ jsx(Search, { className: "h-3.5 w-3.5" }),
168
+ placeholder: t("scripts.searchPlaceholder"),
169
+ value: searchQuery,
170
+ onChange: (e) => setSearchQuery(e.target.value)
171
+ }
172
+ ) }),
173
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-x-auto pb-0.5", children: platformPills.map((pill) => {
174
+ const active = platformFilter === pill.value;
175
+ const Icon = pill.icon;
176
+ return /* @__PURE__ */ jsxs(
177
+ "button",
178
+ {
179
+ type: "button",
180
+ onClick: () => setPlatformFilter(pill.value),
181
+ className: cn(
182
+ "inline-flex flex-shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",
183
+ active ? "border-primary/20 bg-primary/10 text-primary" : "border-border bg-card text-muted-foreground hover:border-primary/50 hover:text-foreground"
184
+ ),
185
+ children: [
186
+ /* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5" }),
187
+ pill.label
188
+ ]
189
+ },
190
+ pill.value
191
+ );
192
+ }) })
193
+ ] }),
194
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto p-6", children: loading ? /* @__PURE__ */ jsx("div", { className: "flex h-32 items-center justify-center text-sm text-muted-foreground", children: t("scripts.loading") }) : /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: [
195
+ filteredScripts.map((script) => /* @__PURE__ */ jsx(
196
+ ScriptCard,
197
+ {
198
+ script,
199
+ onDelete: remove,
200
+ onDuplicate: duplicate
201
+ },
202
+ script.id
203
+ )),
204
+ filteredScripts.length === 0 && (searchQuery || platformFilter !== "all") && /* @__PURE__ */ jsx("div", { className: "col-span-full flex h-32 items-center justify-center text-sm text-muted-foreground", children: t("scripts.noMatch") }),
205
+ /* @__PURE__ */ jsx(CreateTemplateCard, { onClick: () => navigate("/editor") })
206
+ ] }) })
207
+ ] });
208
+ }
209
+
210
+ export { CreateTemplateCard, ScriptCard, ScriptsPage };