{serverComponentType() !== null ? (
isCompositeWithSlots() ? (
<>
{(expanded() ?? false) ? (
) : null}
>
) : (
<>
{rest.label}:{' '}
{displayValue(value())}
>
)
) : subEntryPages().length ? (
<>
{(expanded() ?? false) ? (
subEntryPages().length === 1 ? (
{subEntries().map((entry, index) => handleEntry(entry))}
) : (
{subEntryPages().map((entries, index) => {
return (
{expandedPages().includes(index) ? (
{entries.map((entry) => handleEntry(entry))}
) : null}
)
})}
)
) : null}
>
) : type() === 'function' ? (
<>
{rest.label} 🔄{' '}
}
value={valueSnapshot}
defaultExpanded={{}}
/>
>
) : (
<>
{rest.label}:{' '}
{displayValue(value())}
>
)}
)
}
const stylesFactory = (shadowDOMTarget?: ShadowRoot) => {
const { colors, font, size, border } = tokens
const { fontFamily, lineHeight, size: fontSize } = font
const css = shadowDOMTarget
? goober.css.bind({ target: shadowDOMTarget })
: goober.css
return {
entry: css`
font-family: ${fontFamily.mono};
font-size: ${fontSize.xs};
line-height: ${lineHeight.sm};
outline: none;
word-break: break-word;
`,
labelButton: css`
cursor: pointer;
color: inherit;
font: inherit;
outline: inherit;
background: transparent;
border: none;
padding: 0;
`,
expander: css`
display: inline-flex;
align-items: center;
justify-content: center;
width: ${size[3]};
height: ${size[3]};
padding-left: 3px;
box-sizing: content-box;
`,
expanderIcon: (expanded: boolean) => {
if (expanded) {
return css`
transform: rotate(90deg);
transition: transform 0.1s ease;
`
}
return css`
transform: rotate(0deg);
transition: transform 0.1s ease;
`
},
expandButton: css`
display: flex;
gap: ${size[1]};
align-items: center;
cursor: pointer;
color: inherit;
font: inherit;
outline: inherit;
background: transparent;
border: none;
padding: 0;
`,
value: css`
color: ${colors.purple[400]};
`,
compositeComponent: css`
display: inline-flex;
align-items: center;
padding: 1px ${size[1]};
border-radius: ${border.radius.full};
border: 1px solid ${colors.darkGray[500]};
background: ${colors.darkGray[700]};
color: ${colors.cyan[300]};
font-style: normal;
font-weight: ${font.weight.medium};
`,
renderableComponent: css`
display: inline-flex;
align-items: center;
padding: 1px ${size[1]};
border-radius: ${border.radius.full};
border: 1px solid ${colors.darkGray[500]};
background: ${colors.darkGray[700]};
color: ${colors.teal[300]};
font-style: normal;
font-weight: ${font.weight.medium};
`,
rscMetaRow: css`
display: flex;
gap: ${size[1]};
align-items: flex-start;
margin-left: calc(${size[3]} + ${size[1]});
margin-top: ${size[0.5]};
flex-wrap: wrap;
`,
rscMetaLabel: css`
color: ${colors.gray[500]};
font-size: ${fontSize['2xs']};
text-transform: uppercase;
letter-spacing: 0.06em;
padding-top: 2px;
`,
rscChipRow: css`
display: flex;
gap: ${size[1]};
flex-wrap: wrap;
`,
rscChip: css`
display: inline-flex;
align-items: center;
gap: ${size[0.5]};
padding: 1px ${size[1]};
border-radius: ${border.radius.full};
border: 1px solid ${colors.darkGray[500]};
background: ${colors.darkGray[800]};
color: ${colors.gray[200]};
font-size: ${fontSize['2xs']};
line-height: ${lineHeight.xs};
`,
rscChipName: css`
color: ${colors.gray[100]};
`,
rscChipMeta: css`
color: ${colors.gray[400]};
font-size: ${fontSize['2xs']};
`,
subEntries: css`
margin-left: ${size[2]};
padding-left: ${size[2]};
border-left: 2px solid ${colors.darkGray[400]};
`,
info: css`
color: ${colors.gray[500]};
font-size: ${fontSize['2xs']};
padding-left: ${size[1]};
`,
refreshValueBtn: css`
appearance: none;
border: 0;
cursor: pointer;
background: transparent;
color: inherit;
padding: 0;
font-family: ${fontFamily.mono};
font-size: ${fontSize.xs};
`,
}
}
function useStyles() {
const shadowDomTarget = useContext(ShadowDomTargetContext)
const [_styles] = createSignal(stylesFactory(shadowDomTarget))
return _styles
}