BuilderIO/mitosis

core: add new fields to MitosisComponent type: slots

Open

#325 opened on May 8, 2022

View on GitHub
 (10 comments) (0 reactions) (0 assignees)TypeScript (411 forks)batch import
coreenhancementhelp wanted

Repository metrics

Stars
 (9,803 stars)
PR merge metrics
 (Avg merge 1d 1h) (6 merged PRs in 30d)

Description

export const createMitosisComponent = (
  options?: Partial<MitosisComponent>,
): MitosisComponent => ({
  '@type': '@builder.io/mitosis/component',
  imports: [],
  inputs: [],
  meta: {},
  state: {},
  children: [],
  hooks: {},
  context: { get: {}, set: {} },
  name: options?.name || 'MyComponent',
  subComponents: [],
  ...options,
});

a component needs to have all named slots available and I think it should be added here. and inside of children we need Slot nodes

'@type': '@builder.io/mitosis/component',
  slots: {
    mySelectorName: createMitosisComponent({})
  },
  children: [
    createMitosisNode({
      name: 'Slot',
      properties: {
        name: 'mySelectorName'
      } 
    });
  ],

Contributor guide