Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
you guessed it, plus bunch of breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Dec 12, 2019
1 parent 38ca0ce commit b53e84f
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/src/components/CategoryColorSchemes.tsx
Expand Up @@ -28,7 +28,7 @@ export const colorVariantsStyles: ComponentSlotStylesInput<ColorVariantsProps> =

const CategoryColorSchemes = createComponent<ColorVariantsProps>({
displayName: 'ColorVariants',
render: ({ name, themes, headers, stardust: { classes } }) => {
render: ({ name, themes, headers, config: { classes } }) => {
if (themes.length === 0) return <></>

const colorSchemes = _.map(themes, theme => theme.siteVariables.categoryColorScheme[name])
Expand Down
9 changes: 1 addition & 8 deletions docs/src/components/ColorBox.tsx
Expand Up @@ -89,14 +89,7 @@ export const colorBoxStyles: ComponentSlotStylesInput<ColorBoxProps, ColorBoxVar

const ColorBox = createComponent<ColorBoxProps>({
displayName: 'ColorBox',
render: ({
children,
name,
value,
showColorValue,
copyToClipboardIcon,
stardust: { classes },
}) => (
render: ({ children, name, value, showColorValue, copyToClipboardIcon, config: { classes } }) => (
<div className={classes.root}>
<div className={classes.inner}>
<div className={classes.name}>{children || _.startCase(name)}</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ColorSchemes.tsx
Expand Up @@ -28,7 +28,7 @@ export const colorVariantsStyles: ComponentSlotStylesInput<ColorVariantsProps> =

const ColorSchemes = createComponent<ColorVariantsProps>({
displayName: 'ColorVariants',
render: ({ name, themes, headers, stardust: { classes } }) => {
render: ({ name, themes, headers, config: { classes } }) => {
if (themes.length === 0) return <></>

const colorSchemes = _.map(themes, theme => theme.siteVariables.colorScheme[name])
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ColorVariants.tsx
Expand Up @@ -20,7 +20,7 @@ export const colorVariantsStyles: ComponentSlotStylesInput<ColorVariantsProps> =

const ColorVariants = createComponent<ColorVariantsProps>({
displayName: 'ColorVariants',
render: ({ name, headerOnly, size, stardust: { classes } }) => (
render: ({ name, headerOnly, size, config: { classes } }) => (
<ProviderConsumer
render={({ siteVariables: { colors } }) => (
<div className={classes.root}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/Fader.tsx
Expand Up @@ -28,7 +28,7 @@ export const faderStyles: ComponentSlotStylesInput<FaderProps> = {

const Fader = createComponent<FaderProps>({
displayName: 'Fader',
render: ({ children, url, stardust: { classes } }) => {
render: ({ children, url, config: { classes } }) => {
return (
<Flex column hAlign="center" vAlign="center">
<div className={classes.fader}>{children}</div>
Expand Down
Expand Up @@ -46,7 +46,7 @@ export const NotificationProvider: React.FC = props => {

export const Notification = createComponent<NotificationProps>({
displayName: 'Notification',
render: ({ target, trigger, content, stardust: { classes } }) => {
render: ({ target, trigger, content, config: { classes } }) => {
const tooltipProps: TooltipProps = {
content,
open: true,
Expand Down
8 changes: 4 additions & 4 deletions jest.config.js
Expand Up @@ -3,14 +3,14 @@ const { rollup: lernaAliases } = require('lerna-alias')

// packages/react/src -> packages/react,
// as lernaAliases append 'src' by default
const stardustPackages = lernaAliases({ sourceDirectory: false })
const projectPackages = lernaAliases({ sourceDirectory: false })

// Excludes the non-stardust packages
// Excludes the non-project packages
const excluded = ['@fluentui/playground', '@fluentui/react-theming']

const projects = Object.keys(stardustPackages)
const projects = Object.keys(projectPackages)
.filter(p => !excluded.includes(p))
.map(packageName => stardustPackages[packageName])
.map(packageName => projectPackages[packageName])

module.exports = {
coverageReporters,
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/Debug/Debug.tsx
Expand Up @@ -65,7 +65,7 @@ class Debug extends React.Component<DebugProps, DebugState> {
)
return
}
if (!r.stardustDebug) {
if (!r.fluentUIDebug) {
console.error('Not a debuggable component. Try selecting some Stardust component.')
return
}
Expand All @@ -82,7 +82,7 @@ class Debug extends React.Component<DebugProps, DebugState> {
return
}

fiberNav = fiberNav.findOwner(fiber => fiber.stardustDebug)
fiberNav = fiberNav.findOwner(fiber => fiber.fluentUIDebug)

if (fiberNav !== this.state.fiberNav) {
this.setState({ fiberNav })
Expand Down Expand Up @@ -174,7 +174,7 @@ class Debug extends React.Component<DebugProps, DebugState> {
onClose={this.close}
// TODO: Integrate CSS in JS Styles for Host Components (DOM nodes)
// cssStyles={stylesForNode(stardustDOMNode)}
debugData={fiberNav.stardustDebug}
debugData={fiberNav.fluentUIDebug}
position={debugPanelPosition || 'right'}
onPositionLeft={this.positionLeft}
onPositionRight={this.positionRight}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Debug/DebugComponentViewer.tsx
Expand Up @@ -30,7 +30,7 @@ const DebugComponentViewer: React.FC<DebugComponentViewerProps> = props => {
let parentNav = fiberNav.parent

while (parentNav && !parentNav.isEqual(ownerNav)) {
if (parentNav.stardustDebug) parentNavs.unshift(parentNav)
if (parentNav.fluentUIDebug) parentNavs.unshift(parentNav)
parentNav = parentNav.parent
}
}
Expand All @@ -41,7 +41,7 @@ const DebugComponentViewer: React.FC<DebugComponentViewerProps> = props => {
<ScrollToBottom style={style}>
<DebugLine
indent={0}
{...(ownerNav.stardustDebug && {
{...(ownerNav.fluentUIDebug && {
actionable: true,
tabIndex: 0,
onClick: e => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Debug/FiberNavigator.ts
Expand Up @@ -341,8 +341,8 @@ class FiberNavigator {
return this.__fiber.elementType
}

get stardustDebug() {
return this.instance && this.instance.stardustDebug ? this.instance.stardustDebug : null
get fluentUIDebug() {
return this.instance && this.instance.fluentUIDebug ? this.instance.fluentUIDebug : null
}

get jsxString() {
Expand Down
Expand Up @@ -145,7 +145,7 @@ import send from './send'
import settings from './settings'
import speakerMute from './speakerMute'
import star from './star'
import stardustCircle from './stardustCircle'
import iconCircle from './iconCircle'
import sticker from './sticker'
import strike from './strike'
import sync from './sync'
Expand Down Expand Up @@ -178,7 +178,7 @@ import windowMinimize from './windowMinimize'
import windowRestore from './windowRestore'

export default {
'icon-circle': stardustCircle,
'icon-circle': iconCircle,
accept,
add,
'arrow-up': arrowUp,
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/themes/teams/withProcessedIcons.ts
Expand Up @@ -35,8 +35,8 @@ const theme: ThemeInput = {
'icon-arrow-up': processedIcons['triangle-up'],
'icon-arrow-down': processedIcons['triangle-down'],
'icon-arrow-end': processedIcons['triangle-right'],
'stardust-chevron-start': processedIcons['chevron-start'],
'stardust-chevron-end': processedIcons['chevron-end'],
'icon-chevron-start': processedIcons['chevron-start'],
'icon-chevron-end': processedIcons['chevron-end'],
},
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/utils/UIComponent.tsx
Expand Up @@ -31,7 +31,7 @@ class UIComponent<P, S = {}> extends React.Component<P, S> {
actionHandlers: AccessibilityActionHandlers

// stores debug information
stardustDebug: any = null
fluentUIDebug: any = null

constructor(props, context) {
super(props, context)
Expand Down Expand Up @@ -61,7 +61,7 @@ class UIComponent<P, S = {}> extends React.Component<P, S> {
state: this.state,
actionHandlers: this.actionHandlers,
render: this.renderComponent,
saveDebug: updatedDebug => (this.stardustDebug = updatedDebug),
saveDebug: updatedDebug => (this.fluentUIDebug = updatedDebug),
},
this.context,
)
Expand Down
16 changes: 8 additions & 8 deletions packages/react/src/utils/createComponent.ts
Expand Up @@ -39,7 +39,7 @@ const createComponent = <P extends ObjectOf<any> = any>({
...(defaultProps as any),
}

const StardustComponent: CreateComponentReturnType<P> = (props): React.ReactElement<P> => {
const FluentComponent: CreateComponentReturnType<P> = (props): React.ReactElement<P> => {
// Stores debug information for component.
// Note that this ref should go as the first one, to be discoverable by debug utils.
const ref = React.useRef(null)
Expand All @@ -55,26 +55,26 @@ const createComponent = <P extends ObjectOf<any> = any>({
state: {},
actionHandlers,
render: config => render(config, props),
saveDebug: stardustDebug => (ref.current = { stardustDebug }),
saveDebug: fluentUIDebug => (ref.current = { fluentUIDebug }),
},
context,
)
}

StardustComponent.className = className
FluentComponent.className = className

StardustComponent.create = createShorthandFactory({
FluentComponent.create = createShorthandFactory({
Component: mergedDefaultProps.as,
mappedProp: shorthandPropName,
})

StardustComponent.displayName = displayName
FluentComponent.displayName = displayName

StardustComponent.propTypes = propTypes // TODO: generate prop types
FluentComponent.propTypes = propTypes // TODO: generate prop types

StardustComponent.defaultProps = mergedDefaultProps
FluentComponent.defaultProps = mergedDefaultProps

return StardustComponent
return FluentComponent
}

export default createComponent
10 changes: 5 additions & 5 deletions packages/react/src/utils/createStardustComponent.tsx
Expand Up @@ -6,17 +6,17 @@ import { ComponentSlotClasses, ComponentSlotStylesPrepared } from '../themes/typ
import { ReactAccessibilityBehavior, AccessibilityActionHandlers } from './accessibility/reactTypes'
import { ObjectOf } from '../types'

export interface RenderStardustResultConfig {
export interface RenderResultConfig {
accessibility: ReactAccessibilityBehavior
classes: ComponentSlotClasses
rtl: boolean
styles: ComponentSlotStylesPrepared
}

export interface CreateStardustComponentConfig<P> {
export interface CreateComponentConfig<P> {
displayName: string
className?: string
render: (props: P & { stardust: RenderStardustResultConfig }) => React.ReactNode
render: (props: P & { config: RenderResultConfig }) => React.ReactNode
defaultProps?: any
actionHandlers?: AccessibilityActionHandlers
}
Expand All @@ -27,13 +27,13 @@ const createComponent = <P extends ObjectOf<any> = any>({
render,
defaultProps,
actionHandlers,
}: CreateStardustComponentConfig<P>): CreateComponentReturnType<P> => {
}: CreateComponentConfig<P>): CreateComponentReturnType<P> => {
return createComponentInternal<P>({
displayName,
className,
render: (config, props) => {
const filteredConfig = _.pick(config, ['accessibility', 'classes', 'rtl', 'styles'])
return render(Object.assign({ stardust: filteredConfig }, props))
return render(Object.assign({ config: filteredConfig }, props))
},
defaultProps,
actionHandlers,
Expand Down
10 changes: 5 additions & 5 deletions packages/react/src/utils/debug/debugEnabled.ts
Expand Up @@ -3,16 +3,16 @@ const isDebugEnabled = () => {
if (process.env.NODE_ENV !== 'production') {
try {
// eslint-disable-next-line no-undef
const stardustDebugEnabled = !!window.localStorage.stardustDebug
const fluentUIDebugEnabled = !!window.localStorage.fluentUIDebug

if (process.env.NODE_ENV !== 'test') {
if (stardustDebugEnabled) {
if (fluentUIDebugEnabled) {
/* eslint-disable-next-line no-console */
console.warn(
[
'@fluentui/react:',
`CSSinJS Debug data collection is enabled.`,
'To remove this override paste `delete window.localStorage.stardustDebug` to your browser console and reload the page.',
'To remove this override paste `delete window.localStorage.fluentUIDebug` to your browser console and reload the page.',
].join(' '),
)
} else {
Expand All @@ -21,13 +21,13 @@ const isDebugEnabled = () => {
[
'@fluentui/react:',
`CSSinJS Debug data collection is disabled.`,
'To enable data collection paste `window.localStorage.stardustDebug = true` to your browser console and reload the page.',
'To enable data collection paste `window.localStorage.fluentUIDebug = true` to your browser console and reload the page.',
].join(' '),
)
}
}

enabled = stardustDebugEnabled
enabled = fluentUIDebugEnabled
} catch {}
}

Expand Down

0 comments on commit b53e84f

Please sign in to comment.