@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.
- package/dist/actions-MFI2V4DX.mjs +116 -0
- package/dist/atoms/index.d.mts +2 -2
- package/dist/atoms/index.d.ts +2 -2
- package/dist/atoms/index.js +1 -1
- package/dist/atoms/index.mjs +1 -1
- package/dist/builtin-atoms-C-sNyYJl.d.mts +647 -0
- package/dist/builtin-atoms-C-sNyYJl.d.ts +647 -0
- package/dist/builtin-atoms-DCKrjG7i.d.mts +96 -0
- package/dist/builtin-atoms-DCKrjG7i.d.ts +96 -0
- package/dist/builtin-atoms-DRD3EwG6.d.mts +648 -0
- package/dist/builtin-atoms-DRD3EwG6.d.ts +648 -0
- package/dist/builtin-atoms-jt04b7Rw.d.mts +643 -0
- package/dist/builtin-atoms-jt04b7Rw.d.ts +643 -0
- package/dist/chunk-247T4GDJ.mjs +677 -0
- package/dist/chunk-3H6CR7E7.mjs +1924 -0
- package/dist/chunk-3PL6FL6I.mjs +96 -0
- package/dist/chunk-3SJSW3C4.mjs +2039 -0
- package/dist/chunk-5OI2VI57.mjs +1964 -0
- package/dist/chunk-CL6FYZ43.mjs +105 -0
- package/dist/chunk-ENQOCZI5.mjs +1938 -0
- package/dist/chunk-FB3WCZAU.mjs +512 -0
- package/dist/chunk-GLJ7VC7Z.mjs +684 -0
- package/dist/chunk-HHMWR6NA.mjs +504 -0
- package/dist/chunk-HULEMSN2.mjs +120 -0
- package/dist/chunk-J5MW6CRU.mjs +1938 -0
- package/dist/chunk-PNTTKNYU.mjs +677 -0
- package/dist/chunk-TY5OTJP4.mjs +684 -0
- package/dist/chunk-WV7DVCP6.mjs +513 -0
- package/dist/chunk-YFMPTGUF.mjs +677 -0
- package/dist/{chunk-2VJQJM7S.mjs → chunk-ZDWACXZN.mjs} +1 -1
- package/dist/composition-BJ6QQTWT.mjs +12 -0
- package/dist/composition-XBGKKCI7.mjs +57 -0
- package/dist/content-QVPFUG4P.mjs +246 -0
- package/dist/control-flow-CBREHWJW.mjs +35 -0
- package/dist/control-flow-FWBOI6SM.mjs +35 -0
- package/dist/control-flow-ZWUGCDSP.mjs +35 -0
- package/dist/data-WCMIZYKD.mjs +97 -0
- package/dist/grouping-E6F377VZ.mjs +204 -0
- package/dist/grouping-FRPOEXO3.mjs +233 -0
- package/dist/index.d.mts +4 -433
- package/dist/index.d.ts +4 -433
- package/dist/index.js +3648 -581
- package/dist/index.mjs +335 -1040
- package/dist/input-PUOZDNSI.mjs +222 -0
- package/dist/layout-RATDMCLP.mjs +106 -0
- package/dist/navigation-VCT7ZBMA.mjs +15 -0
- package/dist/navigation-WFV7YWOU.mjs +14 -0
- package/dist/player/index.d.mts +37 -11
- package/dist/player/index.d.ts +37 -11
- package/dist/player/index.js +3280 -174
- package/dist/player/index.mjs +55 -5
- package/package.json +4 -4
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// src/player/atoms/actions.tsx
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var VARIANT_STYLES = {
|
|
5
|
+
primary: { background: "#3182ce", color: "#fff", border: "1px solid #3182ce" },
|
|
6
|
+
secondary: { background: "#edf2f7", color: "#4a5568", border: "1px solid #e2e8f0" },
|
|
7
|
+
outline: { background: "transparent", color: "#3182ce", border: "1px solid #3182ce" },
|
|
8
|
+
ghost: { background: "transparent", color: "#4a5568", border: "1px solid transparent" },
|
|
9
|
+
danger: { background: "#e53e3e", color: "#fff", border: "1px solid #e53e3e" },
|
|
10
|
+
destructive: { background: "#e53e3e", color: "#fff", border: "1px solid #e53e3e" },
|
|
11
|
+
success: { background: "#38a169", color: "#fff", border: "1px solid #38a169" },
|
|
12
|
+
link: { background: "transparent", color: "#3182ce", border: "none", textDecoration: "underline" },
|
|
13
|
+
default: { background: "#fff", color: "#1a202c", border: "1px solid #e2e8f0" }
|
|
14
|
+
};
|
|
15
|
+
var SIZE_STYLES = {
|
|
16
|
+
xs: { padding: "2px 8px", fontSize: 11 },
|
|
17
|
+
sm: { padding: "4px 12px", fontSize: 13 },
|
|
18
|
+
md: { padding: "6px 16px", fontSize: 14 },
|
|
19
|
+
lg: { padding: "8px 24px", fontSize: 16 },
|
|
20
|
+
xl: { padding: "12px 32px", fontSize: 18 }
|
|
21
|
+
};
|
|
22
|
+
var Button = ({
|
|
23
|
+
children,
|
|
24
|
+
label,
|
|
25
|
+
value,
|
|
26
|
+
onClick,
|
|
27
|
+
variant,
|
|
28
|
+
size,
|
|
29
|
+
disabled,
|
|
30
|
+
loading: loadingProp,
|
|
31
|
+
icon,
|
|
32
|
+
iconRight,
|
|
33
|
+
fullWidth,
|
|
34
|
+
className,
|
|
35
|
+
style
|
|
36
|
+
}) => {
|
|
37
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
38
|
+
const text = children ?? label ?? value;
|
|
39
|
+
const isDisabled = Boolean(disabled) || isLoading || Boolean(loadingProp);
|
|
40
|
+
const vs = VARIANT_STYLES[variant ?? "default"] ?? VARIANT_STYLES.default;
|
|
41
|
+
const ss = SIZE_STYLES[size ?? "md"] ?? SIZE_STYLES.md;
|
|
42
|
+
const handleClick = useCallback(async (e) => {
|
|
43
|
+
if (isDisabled) return;
|
|
44
|
+
if (typeof onClick === "function") {
|
|
45
|
+
const result = onClick(e);
|
|
46
|
+
if (result && typeof result === "object" && typeof result.then === "function") {
|
|
47
|
+
setIsLoading(true);
|
|
48
|
+
try {
|
|
49
|
+
await result;
|
|
50
|
+
} finally {
|
|
51
|
+
setIsLoading(false);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, [onClick, isDisabled]);
|
|
56
|
+
return /* @__PURE__ */ jsxs(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
className,
|
|
60
|
+
disabled: isDisabled,
|
|
61
|
+
onClick: handleClick,
|
|
62
|
+
style: {
|
|
63
|
+
...vs,
|
|
64
|
+
...ss,
|
|
65
|
+
borderRadius: 6,
|
|
66
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
67
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
68
|
+
fontWeight: 500,
|
|
69
|
+
display: "inline-flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
gap: 6,
|
|
73
|
+
width: fullWidth ? "100%" : void 0,
|
|
74
|
+
transition: "opacity 0.15s, background 0.15s",
|
|
75
|
+
...style
|
|
76
|
+
},
|
|
77
|
+
children: [
|
|
78
|
+
isLoading || loadingProp ? "\u23F3" : icon ? String(icon) : null,
|
|
79
|
+
text != null ? String(text) : null,
|
|
80
|
+
iconRight ? String(iconRight) : null
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
var Link = ({ children, href, to, label, onClick, external, className, style }) => {
|
|
86
|
+
const text = children ?? label;
|
|
87
|
+
const target = href ?? to;
|
|
88
|
+
const handleClick = useCallback((e) => {
|
|
89
|
+
if (typeof onClick === "function") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
onClick(e);
|
|
92
|
+
}
|
|
93
|
+
}, [onClick]);
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
"a",
|
|
96
|
+
{
|
|
97
|
+
href: target ?? "#",
|
|
98
|
+
className,
|
|
99
|
+
onClick: handleClick,
|
|
100
|
+
target: external ? "_blank" : void 0,
|
|
101
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
102
|
+
style: {
|
|
103
|
+
color: "#3182ce",
|
|
104
|
+
textDecoration: "none",
|
|
105
|
+
cursor: "pointer",
|
|
106
|
+
fontSize: 14,
|
|
107
|
+
...style
|
|
108
|
+
},
|
|
109
|
+
children: text != null ? String(text) : target ?? "Link"
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
Button,
|
|
115
|
+
Link
|
|
116
|
+
};
|
package/dist/atoms/index.d.mts
CHANGED
|
@@ -4,12 +4,12 @@ import { FC, ReactNode } from 'react';
|
|
|
4
4
|
* Compile-Time Atom Stubs — markers for the compiler to recognize.
|
|
5
5
|
*
|
|
6
6
|
* These are NOT runtime components — they are compile-time type stubs that
|
|
7
|
-
* the @
|
|
7
|
+
* the @mmapp/react-compiler recognizes in JSX and maps to IRExperienceNode
|
|
8
8
|
* entries. At runtime, the frontend's ComponentTreeRenderer resolves the
|
|
9
9
|
* component name string to the actual registered React component.
|
|
10
10
|
*
|
|
11
11
|
* Usage in .workflow.tsx files:
|
|
12
|
-
* import { Stack, Row, Text, Button, TextInput } from '@
|
|
12
|
+
* import { Stack, Row, Text, Button, TextInput } from '@mmapp/react/atoms';
|
|
13
13
|
*
|
|
14
14
|
* return (
|
|
15
15
|
* <Stack gap={4}>
|
package/dist/atoms/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { FC, ReactNode } from 'react';
|
|
|
4
4
|
* Compile-Time Atom Stubs — markers for the compiler to recognize.
|
|
5
5
|
*
|
|
6
6
|
* These are NOT runtime components — they are compile-time type stubs that
|
|
7
|
-
* the @
|
|
7
|
+
* the @mmapp/react-compiler recognizes in JSX and maps to IRExperienceNode
|
|
8
8
|
* entries. At runtime, the frontend's ComponentTreeRenderer resolves the
|
|
9
9
|
* component name string to the actual registered React component.
|
|
10
10
|
*
|
|
11
11
|
* Usage in .workflow.tsx files:
|
|
12
|
-
* import { Stack, Row, Text, Button, TextInput } from '@
|
|
12
|
+
* import { Stack, Row, Text, Button, TextInput } from '@mmapp/react/atoms';
|
|
13
13
|
*
|
|
14
14
|
* return (
|
|
15
15
|
* <Stack gap={4}>
|
package/dist/atoms/index.js
CHANGED
|
@@ -78,7 +78,7 @@ module.exports = __toCommonJS(atoms_exports);
|
|
|
78
78
|
function stub(displayName) {
|
|
79
79
|
const Component = () => {
|
|
80
80
|
throw new Error(
|
|
81
|
-
`<${displayName}> is a compile-time stub from @
|
|
81
|
+
`<${displayName}> is a compile-time stub from @mmapp/react/atoms. It should only appear in .workflow.tsx files processed by the compiler. At runtime, use the ComponentTreeRenderer which resolves "${displayName}" from the component registry.`
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
84
|
Component.displayName = displayName;
|