@mmapp/react 0.1.0-alpha.18 → 0.1.0-alpha.19

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.
Files changed (52) hide show
  1. package/dist/actions-MFI2V4DX.mjs +116 -0
  2. package/dist/atoms/index.d.mts +2 -2
  3. package/dist/atoms/index.d.ts +2 -2
  4. package/dist/atoms/index.js +1 -1
  5. package/dist/atoms/index.mjs +1 -1
  6. package/dist/builtin-atoms-C-sNyYJl.d.mts +647 -0
  7. package/dist/builtin-atoms-C-sNyYJl.d.ts +647 -0
  8. package/dist/builtin-atoms-DCKrjG7i.d.mts +96 -0
  9. package/dist/builtin-atoms-DCKrjG7i.d.ts +96 -0
  10. package/dist/builtin-atoms-DRD3EwG6.d.mts +648 -0
  11. package/dist/builtin-atoms-DRD3EwG6.d.ts +648 -0
  12. package/dist/builtin-atoms-jt04b7Rw.d.mts +643 -0
  13. package/dist/builtin-atoms-jt04b7Rw.d.ts +643 -0
  14. package/dist/chunk-247T4GDJ.mjs +677 -0
  15. package/dist/chunk-3H6CR7E7.mjs +1924 -0
  16. package/dist/chunk-3PL6FL6I.mjs +96 -0
  17. package/dist/chunk-3SJSW3C4.mjs +2039 -0
  18. package/dist/chunk-5OI2VI57.mjs +1964 -0
  19. package/dist/chunk-CL6FYZ43.mjs +105 -0
  20. package/dist/chunk-ENQOCZI5.mjs +1938 -0
  21. package/dist/chunk-FB3WCZAU.mjs +512 -0
  22. package/dist/chunk-GLJ7VC7Z.mjs +684 -0
  23. package/dist/chunk-HHMWR6NA.mjs +504 -0
  24. package/dist/chunk-HULEMSN2.mjs +120 -0
  25. package/dist/chunk-J5MW6CRU.mjs +1938 -0
  26. package/dist/chunk-PNTTKNYU.mjs +677 -0
  27. package/dist/chunk-TY5OTJP4.mjs +684 -0
  28. package/dist/chunk-WV7DVCP6.mjs +513 -0
  29. package/dist/chunk-YFMPTGUF.mjs +677 -0
  30. package/dist/{chunk-2VJQJM7S.mjs → chunk-ZDWACXZN.mjs} +1 -1
  31. package/dist/composition-BJ6QQTWT.mjs +12 -0
  32. package/dist/composition-XBGKKCI7.mjs +57 -0
  33. package/dist/content-QVPFUG4P.mjs +246 -0
  34. package/dist/control-flow-CBREHWJW.mjs +35 -0
  35. package/dist/control-flow-FWBOI6SM.mjs +35 -0
  36. package/dist/control-flow-ZWUGCDSP.mjs +35 -0
  37. package/dist/data-WCMIZYKD.mjs +97 -0
  38. package/dist/grouping-E6F377VZ.mjs +204 -0
  39. package/dist/grouping-FRPOEXO3.mjs +233 -0
  40. package/dist/index.d.mts +4 -433
  41. package/dist/index.d.ts +4 -433
  42. package/dist/index.js +3648 -581
  43. package/dist/index.mjs +335 -1040
  44. package/dist/input-PUOZDNSI.mjs +222 -0
  45. package/dist/layout-RATDMCLP.mjs +106 -0
  46. package/dist/navigation-VCT7ZBMA.mjs +15 -0
  47. package/dist/navigation-WFV7YWOU.mjs +14 -0
  48. package/dist/player/index.d.mts +37 -11
  49. package/dist/player/index.d.ts +37 -11
  50. package/dist/player/index.js +3280 -174
  51. package/dist/player/index.mjs +55 -5
  52. package/package.json +4 -4
@@ -0,0 +1,204 @@
1
+ // src/player/atoms/grouping.tsx
2
+ import React, { useState, useCallback, useEffect } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var Card = ({ children, title, subtitle, padding, variant, className, style }) => /* @__PURE__ */ jsxs(
5
+ "div",
6
+ {
7
+ className,
8
+ style: {
9
+ background: variant === "outlined" ? "transparent" : "#fff",
10
+ border: "1px solid #e2e8f0",
11
+ borderRadius: 8,
12
+ padding: padding != null ? Number(padding) * 4 : 16,
13
+ boxShadow: variant === "elevated" ? "0 2px 8px rgba(0,0,0,0.08)" : void 0,
14
+ ...style
15
+ },
16
+ children: [
17
+ title ? /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 16, marginBottom: subtitle ? 2 : 12 }, children: String(title) }) : null,
18
+ subtitle ? /* @__PURE__ */ jsx("div", { style: { fontSize: 13, color: "#718096", marginBottom: 12 }, children: String(subtitle) }) : null,
19
+ children
20
+ ]
21
+ }
22
+ );
23
+ var Section = ({ children, title, description, collapsible, defaultOpen, className, style }) => {
24
+ const [open, setOpen] = useState(defaultOpen !== false);
25
+ return /* @__PURE__ */ jsxs("div", { className, style: { marginBottom: 16, ...style }, children: [
26
+ title ? /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ style: {
30
+ display: "flex",
31
+ alignItems: "center",
32
+ justifyContent: "space-between",
33
+ marginBottom: open ? 12 : 0,
34
+ cursor: collapsible ? "pointer" : void 0
35
+ },
36
+ onClick: collapsible ? () => setOpen((v) => !v) : void 0,
37
+ children: [
38
+ /* @__PURE__ */ jsxs("div", { children: [
39
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 15 }, children: String(title) }),
40
+ description ? /* @__PURE__ */ jsx("div", { style: { fontSize: 13, color: "#718096", marginTop: 2 }, children: String(description) }) : null
41
+ ] }),
42
+ collapsible ? /* @__PURE__ */ jsx("span", { style: { color: "#a0aec0", fontSize: 18 }, children: open ? "\u25BE" : "\u25B8" }) : null
43
+ ]
44
+ }
45
+ ) : null,
46
+ open ? children : null
47
+ ] });
48
+ };
49
+ var Tabs = ({ children, tabs, defaultTab, className, style }) => {
50
+ const tabList = Array.isArray(tabs) ? tabs.map((t) => typeof t === "string" ? { label: t, value: t } : t) : [];
51
+ const [active, setActive] = useState(defaultTab ?? tabList[0]?.value ?? "");
52
+ if (tabList.length === 0) {
53
+ return /* @__PURE__ */ jsx("div", { className, style, children });
54
+ }
55
+ const childArray = React.Children.toArray(children);
56
+ return /* @__PURE__ */ jsxs("div", { className, style, children: [
57
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", borderBottom: "2px solid #e2e8f0", marginBottom: 12, gap: 0 }, children: tabList.map((tab) => /* @__PURE__ */ jsx(
58
+ "button",
59
+ {
60
+ onClick: () => setActive(tab.value),
61
+ style: {
62
+ padding: "8px 16px",
63
+ fontSize: 14,
64
+ fontWeight: 500,
65
+ cursor: "pointer",
66
+ border: "none",
67
+ background: "none",
68
+ borderBottom: "2px solid transparent",
69
+ marginBottom: -2,
70
+ color: active === tab.value ? "#3182ce" : "#718096",
71
+ borderBottomColor: active === tab.value ? "#3182ce" : "transparent"
72
+ },
73
+ children: tab.label
74
+ },
75
+ tab.value
76
+ )) }),
77
+ childArray.map((child, i) => /* @__PURE__ */ jsx("div", { style: { display: tabList[i]?.value === active ? "block" : "none" }, children: child }, i))
78
+ ] });
79
+ };
80
+ var Accordion = ({ children, items, allowMultiple, className, style }) => {
81
+ const [openItems, setOpenItems] = useState(/* @__PURE__ */ new Set([0]));
82
+ const toggle = useCallback((index) => {
83
+ setOpenItems((prev) => {
84
+ const next = new Set(allowMultiple ? prev : []);
85
+ if (prev.has(index)) next.delete(index);
86
+ else next.add(index);
87
+ return next;
88
+ });
89
+ }, [allowMultiple]);
90
+ const itemList = Array.isArray(items) ? items : [];
91
+ if (itemList.length === 0) {
92
+ return /* @__PURE__ */ jsx("div", { className, style, children });
93
+ }
94
+ return /* @__PURE__ */ jsx("div", { className, style: { border: "1px solid #e2e8f0", borderRadius: 8, overflow: "hidden", ...style }, children: itemList.map((item, i) => {
95
+ const itm = item;
96
+ const isOpen = openItems.has(i);
97
+ return /* @__PURE__ */ jsxs("div", { style: { borderBottom: i < itemList.length - 1 ? "1px solid #e2e8f0" : "none" }, children: [
98
+ /* @__PURE__ */ jsxs(
99
+ "button",
100
+ {
101
+ onClick: () => toggle(i),
102
+ style: {
103
+ width: "100%",
104
+ padding: "12px 16px",
105
+ background: "none",
106
+ border: "none",
107
+ textAlign: "left",
108
+ cursor: "pointer",
109
+ display: "flex",
110
+ justifyContent: "space-between",
111
+ alignItems: "center",
112
+ fontSize: 14,
113
+ fontWeight: 500
114
+ },
115
+ children: [
116
+ /* @__PURE__ */ jsx("span", { children: String(itm.title ?? itm.label ?? `Item ${i + 1}`) }),
117
+ /* @__PURE__ */ jsx("span", { style: { color: "#a0aec0" }, children: isOpen ? "\u25BE" : "\u25B8" })
118
+ ]
119
+ }
120
+ ),
121
+ isOpen ? /* @__PURE__ */ jsx("div", { style: { padding: "0 16px 12px" }, children: itm.content ? String(itm.content) : null }) : null
122
+ ] }, i);
123
+ }) });
124
+ };
125
+ var Modal = ({ children, open, isOpen, onClose, title, size, className, style }) => {
126
+ const visible = Boolean(open ?? isOpen);
127
+ useEffect(() => {
128
+ if (visible) document.body.style.overflow = "hidden";
129
+ return () => {
130
+ document.body.style.overflow = "";
131
+ };
132
+ }, [visible]);
133
+ if (!visible) return null;
134
+ const widthMap = { sm: 400, md: 560, lg: 720, xl: 960, full: 9999 };
135
+ const maxWidth = widthMap[size ?? "md"] ?? 560;
136
+ return /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ style: {
140
+ position: "fixed",
141
+ inset: 0,
142
+ zIndex: 9999,
143
+ display: "flex",
144
+ alignItems: "center",
145
+ justifyContent: "center",
146
+ background: "rgba(0,0,0,0.4)"
147
+ },
148
+ onClick: (e) => {
149
+ if (e.target === e.currentTarget && typeof onClose === "function") onClose();
150
+ },
151
+ children: /* @__PURE__ */ jsxs(
152
+ "div",
153
+ {
154
+ className,
155
+ style: {
156
+ background: "#fff",
157
+ borderRadius: 12,
158
+ padding: 24,
159
+ maxWidth,
160
+ width: "90%",
161
+ maxHeight: "85vh",
162
+ overflow: "auto",
163
+ boxShadow: "0 20px 60px rgba(0,0,0,0.2)",
164
+ ...style
165
+ },
166
+ children: [
167
+ title || onClose ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [
168
+ title ? /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 18 }, children: String(title) }) : /* @__PURE__ */ jsx("div", {}),
169
+ typeof onClose === "function" ? /* @__PURE__ */ jsx(
170
+ "button",
171
+ {
172
+ onClick: () => onClose(),
173
+ style: { background: "none", border: "none", fontSize: 20, cursor: "pointer", color: "#a0aec0", padding: 4 },
174
+ children: "\u2715"
175
+ }
176
+ ) : null
177
+ ] }) : null,
178
+ children
179
+ ]
180
+ }
181
+ )
182
+ }
183
+ );
184
+ };
185
+ var ScrollArea = ({ children, maxHeight, className, style }) => /* @__PURE__ */ jsx(
186
+ "div",
187
+ {
188
+ className,
189
+ style: {
190
+ overflow: "auto",
191
+ maxHeight: maxHeight ? Number(maxHeight) : void 0,
192
+ ...style
193
+ },
194
+ children
195
+ }
196
+ );
197
+ export {
198
+ Accordion,
199
+ Card,
200
+ Modal,
201
+ ScrollArea,
202
+ Section,
203
+ Tabs
204
+ };
@@ -0,0 +1,233 @@
1
+ // src/player/atoms/grouping.tsx
2
+ import React, { useState, useCallback, useEffect } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var Card = ({ children, title, subtitle, padding, variant, className, style }) => /* @__PURE__ */ jsxs(
5
+ "div",
6
+ {
7
+ className,
8
+ style: {
9
+ background: variant === "outlined" ? "transparent" : "#fff",
10
+ border: "1px solid #e2e8f0",
11
+ borderRadius: 8,
12
+ padding: padding != null ? Number(padding) * 4 : 16,
13
+ boxShadow: variant === "elevated" ? "0 2px 8px rgba(0,0,0,0.08)" : void 0,
14
+ ...style
15
+ },
16
+ children: [
17
+ title ? /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 16, marginBottom: subtitle ? 2 : 12 }, children: String(title) }) : null,
18
+ subtitle ? /* @__PURE__ */ jsx("div", { style: { fontSize: 13, color: "#718096", marginBottom: 12 }, children: String(subtitle) }) : null,
19
+ children
20
+ ]
21
+ }
22
+ );
23
+ var Section = ({ children, title, description, collapsible, defaultOpen, className, style }) => {
24
+ const [open, setOpen] = useState(defaultOpen !== false);
25
+ return /* @__PURE__ */ jsxs("div", { className, style: { marginBottom: 16, ...style }, children: [
26
+ title ? /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ style: {
30
+ display: "flex",
31
+ alignItems: "center",
32
+ justifyContent: "space-between",
33
+ marginBottom: open ? 12 : 0,
34
+ cursor: collapsible ? "pointer" : void 0
35
+ },
36
+ onClick: collapsible ? () => setOpen((v) => !v) : void 0,
37
+ children: [
38
+ /* @__PURE__ */ jsxs("div", { children: [
39
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 15 }, children: String(title) }),
40
+ description ? /* @__PURE__ */ jsx("div", { style: { fontSize: 13, color: "#718096", marginTop: 2 }, children: String(description) }) : null
41
+ ] }),
42
+ collapsible ? /* @__PURE__ */ jsx("span", { style: { color: "#a0aec0", fontSize: 18 }, children: open ? "\u25BE" : "\u25B8" }) : null
43
+ ]
44
+ }
45
+ ) : null,
46
+ open ? children : null
47
+ ] });
48
+ };
49
+ var Tabs = ({ children, tabs, defaultTab, className, style }) => {
50
+ const tabList = Array.isArray(tabs) ? tabs.map((t) => typeof t === "string" ? { label: t, value: t } : t) : [];
51
+ const [active, setActive] = useState(defaultTab ?? tabList[0]?.value ?? "");
52
+ if (tabList.length === 0) {
53
+ return /* @__PURE__ */ jsx("div", { className, style, children });
54
+ }
55
+ const childArray = React.Children.toArray(children);
56
+ return /* @__PURE__ */ jsxs("div", { className, style, children: [
57
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", borderBottom: "2px solid #e2e8f0", marginBottom: 12, gap: 0 }, children: tabList.map((tab) => /* @__PURE__ */ jsx(
58
+ "button",
59
+ {
60
+ onClick: () => setActive(tab.value),
61
+ style: {
62
+ padding: "8px 16px",
63
+ fontSize: 14,
64
+ fontWeight: 500,
65
+ cursor: "pointer",
66
+ border: "none",
67
+ background: "none",
68
+ borderBottom: "2px solid transparent",
69
+ marginBottom: -2,
70
+ color: active === tab.value ? "#3182ce" : "#718096",
71
+ borderBottomColor: active === tab.value ? "#3182ce" : "transparent"
72
+ },
73
+ children: tab.label
74
+ },
75
+ tab.value
76
+ )) }),
77
+ childArray.map((child, i) => /* @__PURE__ */ jsx("div", { style: { display: tabList[i]?.value === active ? "block" : "none" }, children: child }, i))
78
+ ] });
79
+ };
80
+ var Accordion = ({ children, items, allowMultiple, className, style }) => {
81
+ const [openItems, setOpenItems] = useState(/* @__PURE__ */ new Set([0]));
82
+ const toggle = useCallback((index) => {
83
+ setOpenItems((prev) => {
84
+ const next = new Set(allowMultiple ? prev : []);
85
+ if (prev.has(index)) next.delete(index);
86
+ else next.add(index);
87
+ return next;
88
+ });
89
+ }, [allowMultiple]);
90
+ const itemList = Array.isArray(items) ? items : [];
91
+ if (itemList.length === 0) {
92
+ return /* @__PURE__ */ jsx("div", { className, style, children });
93
+ }
94
+ return /* @__PURE__ */ jsx("div", { className, style: { border: "1px solid #e2e8f0", borderRadius: 8, overflow: "hidden", ...style }, children: itemList.map((item, i) => {
95
+ const itm = item;
96
+ const isOpen = openItems.has(i);
97
+ return /* @__PURE__ */ jsxs("div", { style: { borderBottom: i < itemList.length - 1 ? "1px solid #e2e8f0" : "none" }, children: [
98
+ /* @__PURE__ */ jsxs(
99
+ "button",
100
+ {
101
+ onClick: () => toggle(i),
102
+ style: {
103
+ width: "100%",
104
+ padding: "12px 16px",
105
+ background: "none",
106
+ border: "none",
107
+ textAlign: "left",
108
+ cursor: "pointer",
109
+ display: "flex",
110
+ justifyContent: "space-between",
111
+ alignItems: "center",
112
+ fontSize: 14,
113
+ fontWeight: 500
114
+ },
115
+ children: [
116
+ /* @__PURE__ */ jsx("span", { children: String(itm.title ?? itm.label ?? `Item ${i + 1}`) }),
117
+ /* @__PURE__ */ jsx("span", { style: { color: "#a0aec0" }, children: isOpen ? "\u25BE" : "\u25B8" })
118
+ ]
119
+ }
120
+ ),
121
+ isOpen ? /* @__PURE__ */ jsx("div", { style: { padding: "0 16px 12px" }, children: itm.content ? String(itm.content) : null }) : null
122
+ ] }, i);
123
+ }) });
124
+ };
125
+ var Modal = ({ children, open, isOpen, onClose, title, size, id, nodeId, className, style }) => {
126
+ const modalId = id ?? nodeId;
127
+ const [eventOpen, setEventOpen] = useState(false);
128
+ useEffect(() => {
129
+ if (!modalId) return;
130
+ const handleOpen = (e) => {
131
+ const detail = e.detail;
132
+ if (detail === modalId || detail?.id === modalId) {
133
+ setEventOpen(true);
134
+ }
135
+ };
136
+ const handleClose = (e) => {
137
+ const detail = e.detail;
138
+ if (detail === modalId || detail?.id === modalId) {
139
+ setEventOpen(false);
140
+ }
141
+ };
142
+ window.addEventListener("openModal", handleOpen);
143
+ window.addEventListener("closeModal", handleClose);
144
+ return () => {
145
+ window.removeEventListener("openModal", handleOpen);
146
+ window.removeEventListener("closeModal", handleClose);
147
+ };
148
+ }, [modalId]);
149
+ const visible = Boolean(open ?? isOpen ?? eventOpen);
150
+ useEffect(() => {
151
+ if (visible) document.body.style.overflow = "hidden";
152
+ return () => {
153
+ document.body.style.overflow = "";
154
+ };
155
+ }, [visible]);
156
+ if (!visible) return null;
157
+ const widthMap = { sm: 400, md: 560, lg: 720, xl: 960, full: 9999 };
158
+ const maxWidth = widthMap[size ?? "md"] ?? 560;
159
+ return /* @__PURE__ */ jsx(
160
+ "div",
161
+ {
162
+ style: {
163
+ position: "fixed",
164
+ inset: 0,
165
+ zIndex: 9999,
166
+ display: "flex",
167
+ alignItems: "center",
168
+ justifyContent: "center",
169
+ background: "rgba(0,0,0,0.4)"
170
+ },
171
+ onClick: (e) => {
172
+ if (e.target === e.currentTarget) {
173
+ setEventOpen(false);
174
+ if (typeof onClose === "function") onClose();
175
+ }
176
+ },
177
+ children: /* @__PURE__ */ jsxs(
178
+ "div",
179
+ {
180
+ className,
181
+ style: {
182
+ background: "#fff",
183
+ borderRadius: 12,
184
+ padding: 24,
185
+ maxWidth,
186
+ width: "90%",
187
+ maxHeight: "85vh",
188
+ overflow: "auto",
189
+ boxShadow: "0 20px 60px rgba(0,0,0,0.2)",
190
+ ...style
191
+ },
192
+ children: [
193
+ title || onClose ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [
194
+ title ? /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: 18 }, children: String(title) }) : /* @__PURE__ */ jsx("div", {}),
195
+ typeof onClose === "function" ? /* @__PURE__ */ jsx(
196
+ "button",
197
+ {
198
+ onClick: () => {
199
+ setEventOpen(false);
200
+ onClose();
201
+ },
202
+ style: { background: "none", border: "none", fontSize: 20, cursor: "pointer", color: "#a0aec0", padding: 4 },
203
+ children: "\u2715"
204
+ }
205
+ ) : null
206
+ ] }) : null,
207
+ children
208
+ ]
209
+ }
210
+ )
211
+ }
212
+ );
213
+ };
214
+ var ScrollArea = ({ children, maxHeight, className, style }) => /* @__PURE__ */ jsx(
215
+ "div",
216
+ {
217
+ className,
218
+ style: {
219
+ overflow: "auto",
220
+ maxHeight: maxHeight ? Number(maxHeight) : void 0,
221
+ ...style
222
+ },
223
+ children
224
+ }
225
+ );
226
+ export {
227
+ Accordion,
228
+ Card,
229
+ Modal,
230
+ ScrollArea,
231
+ Section,
232
+ Tabs
233
+ };