Skip to content

Commit

Permalink
fix(svelte-types): add html props from the native element each compon…
Browse files Browse the repository at this point in the history
…ent inherits from. (#66)
  • Loading branch information
Darkle authored Aug 4, 2022
1 parent 65ac09d commit aa1193e
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion scripts/build-svelte-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,56 @@
const fs = require('fs-extra');
const path = require('path');

const componentNativeElementInheritance = {
Actions: 'HTMLDivElement',
ActionsButton: 'HTMLButtonElement',
ActionsGroup: 'HTMLDivElement',
ActionsLabel: 'HTMLDivElement',
App: 'HTMLDivElement',
Badge: 'HTMLSpanElement',
Block: 'HTMLDivElement',
BlockFooter: 'HTMLDivElement',
BlockHeader: 'HTMLDivElement',
BlockTitle: 'HTMLDivElement',
Breadcrumbs: 'HTMLDivElement',
BreadcrumbsCollapsed: 'HTMLDivElement',
BreadcrumbsItem: 'HTMLDivElement',
BreadcrumbsSeparator: 'HTMLDivElement',
Button: 'HTMLButtonElement',
Card: 'HTMLDivElement',
Checkbox: 'HTMLLabelElement',
Chip: 'HTMLDivElement',
Fab: 'HTMLAnchorElement',
Icon: 'HTMLElement',
Link: 'HTMLAnchorElement',
List: 'HTMLDivElement',
ListButton: 'HTMLLIElement',
ListGroup: 'HTMLLIElement',
ListInput: 'HTMLLIElement',
ListItem: 'HTMLLIElement',
MenuList: 'HTMLDivElement',
MenuListItem: 'HTMLLIElement',
Navbar: 'HTMLDivElement',
NavbarBackLink: 'HTMLAnchorElement',
Page: 'HTMLDivElement',
Panel: 'HTMLDivElement',
Popover: 'HTMLDivElement',
Popup: 'HTMLDivElement',
Preloader: 'HTMLSpanElement',
Progressbar: 'HTMLSpanElement',
Radio: 'HTMLLabelElement',
Range: 'HTMLDivElement',
Segmented: 'HTMLDivElement',
SegmentedButton: 'HTMLButtonElement',
Sheet: 'HTMLDivElement',
Stepper: 'HTMLDivElement',
Tabbar: 'HTMLAnchorElement',
TabbarLink: 'HTMLAnchorElement',
Toast: 'HTMLDivElement',
Toggle: 'HTMLLabelElement',
Toolbar: 'HTMLDivElement',
}

const addOnClick = [
'Badge',
'Button',
Expand Down Expand Up @@ -84,7 +134,7 @@ interface ${componentName}Props {}
interface ${componentName}Props extends Props {}
declare class ${componentName} extends SvelteComponentTyped<
${componentName}Props,
${componentName}Props${componentNativeElementInheritance[componentName] ? ` & HTMLProps<${componentNativeElementInheritance[componentName]}>`:''},
{ },
{
${slotsContent}
Expand Down

0 comments on commit aa1193e

Please sign in to comment.