Skip to content

Commit

Permalink
Fixes auto imports of visual ui, now imports are relative
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecmart committed Jul 10, 2024
1 parent c87bfa8 commit 3a378f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/protolib/src/visualui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import Video from '../components/Video'
//import { unwrapText } from '../components/unwrapText'
import HCenterStack from '../components/HCenterStack'

import { getComponentWrapper, BasicPlaceHolder } from './visualuiWrapper'
import { BasicPlaceHolder, UIWrapRelative } from './visualuiWrapper'
import { AlertDialog } from '../components/AlertDialog'

import htmlBasicElements from './htmlBasics'
Expand All @@ -93,7 +93,7 @@ import molecules from './molecules'
import { Pressable } from '../components/Pressable'
import { Icon } from '../components/Icon'

const cw = getComponentWrapper('protolib')
const cw = UIWrapRelative('protolib/components')

const nonDraggable = { custom: { hidden: true } }

Expand Down
7 changes: 7 additions & 0 deletions packages/protolib/src/visualui/visualuiWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export const UIWrapLib = (importName) => {
return cw(Component, icon, name, defaultProps, uiData, visualUIOnlyFallbackProps, editableText)
}
}
export const UIWrapRelative = (path) => {
return (Component, icon, name, defaultProps = {}, uiData = {}, visualUIOnlyFallbackProps: any = {}, editableText = false) => {
const cw = getComponentWrapper(path + "/" + name)
return cw(Component, icon, name, defaultProps, uiData, visualUIOnlyFallbackProps, editableText)
}
}

export const getComponentWrapper = (importName) => (Component, icon, name, defaultProps = {}, uiData = {}, visualUIOnlyFallbackProps: any = {}, editableText = false) => {
const importInfo = {
moduleSpecifier: importName,
Expand Down

0 comments on commit 3a378f9

Please sign in to comment.