Skip to content

Commit

Permalink
Merge pull request #87 from speee/update-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependent packages to the latest version
  • Loading branch information
Yuki Hattori authored Nov 13, 2019
2 parents 6ff098e + e43ad7c commit 8d06171
Show file tree
Hide file tree
Showing 12 changed files with 739 additions and 673 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Fix 413 error from Block Kit Builder when translated huge JSON on REPL demo ([#82](https://github.com/speee/jsx-slack/pull/82))
- Improve internal type definitions for overloaded props ([#83](https://github.com/speee/jsx-slack/pull/83))

### Changed

- Upgrade dependent packages to the latest version ([#87](https://github.com/speee/jsx-slack/pull/87))

## v0.11.0 - 2019-10-24

### Added
Expand Down
21 changes: 9 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,30 @@
"access": "public"
},
"devDependencies": {
"@types/jest": "^24.0.18",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.3.3",
"@types/jest": "^24.0.23",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0",
"codecov": "^3.6.1",
"codemirror": "^5.49.0",
"eslint": "^6.5.1",
"codemirror": "^5.49.2",
"eslint": "^6.6.0",
"eslint-config-airbnb-base": "14.0.0",
"eslint-config-prettier": "^6.4.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-import": "^2.18.2",
"jest": "^24.9.0",
"jest-junit": "^8.0.0",
"jest-junit": "^9.0.0",
"lodash.debounce": "^4.0.8",
"npm-run-all": "^4.1.5",
"parcel": "^1.12.4",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"ts-jest": "^24.1.0",
"typescript": "^3.6.4"
"typescript": "^3.7.2"
},
"dependencies": {
"@slack/types": "^1.2.1",
"he": "^1.2.0",
"htm": "^2.2.1",
"lodash.flattendeep": "^4.4.0",
"turndown": "^5.0.3"
},
"resolutions": {
"teeny-request": "^5.3.0"
}
}
11 changes: 7 additions & 4 deletions src/block-kit/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const basicBlocks = ['actions', 'context', 'divider', 'image', 'section']

// Blocks
knownBlocks.set(undefined, [...basicBlocks, 'file'])
knownActions.set(undefined, actionTypes.filter(t => t !== 'radio_buttons'))
knownActions.set(
undefined,
actionTypes.filter(t => t !== 'radio_buttons')
)
knownSectionAccessories.set(
undefined,
sectionAccessoryTypes.filter(t => t !== 'radio_buttons')
Expand Down Expand Up @@ -128,6 +131,6 @@ export const Blocks: JSXSlack.FC<BlocksProps> = props => {
return <ArrayOutput>{normalized}</ArrayOutput>
}

export const BlocksInternal: JSXSlack.FC<
BlocksProps & { [blockTypeSymbol]?: InternalBlockType }
> = props => Blocks(props)
export const BlocksInternal: JSXSlack.FC<BlocksProps & {
[blockTypeSymbol]?: InternalBlockType
}> = props => Blocks(props)
6 changes: 3 additions & 3 deletions src/block-kit/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ type ContextElement = ImageElement | MrkdwnElement

const endSymbol = Symbol('EndOfContext')

export const Context: JSXSlack.FC<
BlockComponentProps & { children: JSXSlack.Children<{}> }
> = ({ blockId, children, id }) => {
export const Context: JSXSlack.FC<BlockComponentProps & {
children: JSXSlack.Children<{}>
}> = ({ blockId, children, id }) => {
const elements: ContextElement[] = []
let current: (string | JSXSlack.Node)[] = []

Expand Down
6 changes: 3 additions & 3 deletions src/block-kit/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { JSXSlack } from '../jsx'
import { ObjectOutput } from '../utils'
import { BlockComponentProps } from './Blocks'

export const Divider: JSXSlack.FC<
BlockComponentProps & { children?: undefined }
> = ({ blockId, id }) => (
export const Divider: JSXSlack.FC<BlockComponentProps & {
children?: undefined
}> = ({ blockId, id }) => (
<ObjectOutput<DividerBlock> type="divider" block_id={id || blockId} />
)
8 changes: 4 additions & 4 deletions src/block-kit/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type InputProps = DistributedProps<InputPropsBase>
export type TextareaProps = Omit<InputComponentProps, 'type'>

// Helper type for input components
export type WithInputProps<T> = DistributedProps<T | T & InputCommonProps>
export type WithInputProps<T> = DistributedProps<T | (T & InputCommonProps)>

export const internalHiddenType = Symbol('jsx-slack-input-internal-hidden-type')
export const internalSubmitType = Symbol('jsx-slack-input-internal-submit-type')
Expand Down Expand Up @@ -98,9 +98,9 @@ export const wrapInInput = (
/>
)

const InputComponent: JSXSlack.FC<
InputComponentProps & { multiline?: boolean }
> = props =>
const InputComponent: JSXSlack.FC<InputComponentProps & {
multiline?: boolean
}> = props =>
wrapInInput(
<PlainTextInput
actionId={props.actionId || props.name}
Expand Down
6 changes: 3 additions & 3 deletions src/block-kit/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const sectionAccessoryTypes = [
'radio_buttons',
] as const

export const Section: JSXSlack.FC<
BlockComponentProps & { children: JSXSlack.Children<{}> }
> = ({ blockId, children, id }) => {
export const Section: JSXSlack.FC<BlockComponentProps & {
children: JSXSlack.Children<{}>
}> = ({ blockId, children, id }) => {
const normalized: (string | JSXSlack.Node)[] = []

let accessory: SectionBlock['accessory']
Expand Down
23 changes: 9 additions & 14 deletions src/block-kit/elements/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,17 @@ const createOption = ({ value, text }: OptionInternal): SlackOption => ({
})

const filter = <T extends {}>(children: JSXSlack.Children<T>) =>
JSXSlack.normalizeChildren(children).reduce(
(arr, n) => {
if (typeof n === 'string') return arr
JSXSlack.normalizeChildren(children).reduce((arr, n) => {
if (typeof n === 'string') return arr

// Convert intrinsic HTML elements
let e: JSXSlack.Node | undefined | null
// Convert intrinsic HTML elements
let e: JSXSlack.Node | undefined | null

if (n.type === 'option') e = aliasTo(Option, n)
if (n.type === 'optgroup') e = aliasTo(Optgroup, n)
if (n.type === 'option') e = aliasTo(Option, n)
if (n.type === 'optgroup') e = aliasTo(Optgroup, n)

return [...arr, e || n]
},
[] as JSXSlack.Node<T>[]
)
return [...arr, e || n]
}, [] as JSXSlack.Node<T>[])

const generateFragments = (
children: SelectFragmentProps['children']
Expand Down Expand Up @@ -338,9 +335,7 @@ export const UsersSelect: JSXSlack.FC<UsersSelectProps> = props => {
return props.label ? wrapInInput(element, props) : element
}

export const ConversationsSelect: JSXSlack.FC<
ConversationsSelectProps
> = props => {
export const ConversationsSelect: JSXSlack.FC<ConversationsSelectProps> = props => {
const element = props.multiple ? (
<ObjectOutput<MultiConversationsSelect>
type="multi_conversations_select"
Expand Down
4 changes: 1 addition & 3 deletions src/dialog/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ export const UsersSelect: JSXSlack.FC<UsersSelectProps> = props => (
)

/** @deprecated Classic dialog support was deprecated in favor of Slack Modals and will remove in v1. Please migrate into Modal provided by the main entry point. */
export const ConversationsSelect: JSXSlack.FC<
ConversationsSelectProps
> = props => (
export const ConversationsSelect: JSXSlack.FC<ConversationsSelectProps> = props => (
<ObjectOutput<ConversationsSelectElement>
{...baseProps(props)}
data_source="conversations"
Expand Down
17 changes: 7 additions & 10 deletions src/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ function parseJSX(node: JSXSlack.Node, context: ParseContext) {
ctx.mode !== ParseMode.HTML ? str : escapeEntity(str)

const toArray = (nextCtx = context): any[] =>
children.reduce(
(arr, c) => {
const ctx = { ...nextCtx, builts: arr }
const ret =
typeof c === 'string' ? processString(c, ctx) : parseJSX(c, ctx)

return [...ctx.builts, ...(ret ? [ret] : [])]
},
[] as any[]
)
children.reduce((arr, c) => {
const ctx = { ...nextCtx, builts: arr }
const ret =
typeof c === 'string' ? processString(c, ctx) : parseJSX(c, ctx)

return [...ctx.builts, ...(ret ? [ret] : [])]
}, [] as any[])

switch (node.type) {
case JSXSlack.NodeType.object:
Expand Down
5 changes: 4 additions & 1 deletion test/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ describe('Dialog support', () => {
name: 'name',
label: 'label',
optional: true,
options: [{ label: 'A', value: 'a' }, { label: 'B', value: 'b' }],
options: [
{ label: 'A', value: 'a' },
{ label: 'B', value: 'b' },
],
}

expect(
Expand Down
Loading

0 comments on commit 8d06171

Please sign in to comment.