related: #4
Props
I'm going to work on props/emit from now on (I plan to separate them into separate PRs).
Regarding the design, there are already some points that I'm concerned about.
First, let's consider the design of propsOptions.
Based on some comments in previous PRs, I feel that components should be expressed as functions that return Block
.
Now, in order to implement props, we need to store the runtime types, default values, and user-defined props definitions somewhere.
Discussion 1
It is likely that the interface will be defined through defineProps for now, but I'm wondering if we are assuming that users will use Props Option in the Options API format.
Discussion 2
How should we store the options information of user-defined props in the component?
Since this is an internal matter, I think it will be stored in ComponentInternalInstance
.
The problem is how to store it.
Currently, in the compiler,
export default (props, { expose }) => {
// .
// .
return t0;
}; // satisfies BlockFn
code like this is planned to be outputted. (Currently, the output is represented as setup or render options, but referring to the interface Block
in runtime-vapor/render, it seems to be temporary.)
And ComponentInternalInstance
is generated in the form of receiving BlockFn
as follows:
export function render(
comp: BlockFn,
container: string | ParentNode
): ComponentInternalInstance {
const instance = createComponentInstance(comp);
// .
// .
}
So, we need to discuss how to store user-defined props options.
Drafts