@atlaskit/code 14.6.0 → 14.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/bidi-warning/package.json +2 -2
- package/bidi-warning-decorator/package.json +2 -2
- package/block/package.json +2 -2
- package/constants/package.json +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/bidi-warning/ui/types.d.ts +1 -1
- package/dist/types/constants.d.ts +4 -4
- package/dist/types/internal/theme/styles.d.ts +1 -1
- package/dist/types/internal/utils/get-normalized-language.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
- package/dist/types/syntax-highlighter/types.d.ts +3 -3
- package/dist/types-ts4.5/bidi-warning/bidi-warning-decorator.d.ts +12 -0
- package/dist/types-ts4.5/bidi-warning/index.d.ts +1 -0
- package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +11 -0
- package/dist/types-ts4.5/bidi-warning/ui/styled.d.ts +8 -0
- package/dist/types-ts4.5/bidi-warning/ui/types.d.ts +29 -0
- package/dist/types-ts4.5/code-block.d.ts +13 -0
- package/dist/types-ts4.5/code.d.ts +16 -0
- package/dist/types-ts4.5/constants.d.ts +625 -0
- package/dist/types-ts4.5/entry-points/block.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/constants.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/inline.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/types.d.ts +1 -0
- package/dist/types-ts4.5/extract-react-types/code-block.d.ts +47 -0
- package/dist/types-ts4.5/extract-react-types/code.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +4 -0
- package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +6 -0
- package/dist/types-ts4.5/internal/theme/constants.d.ts +8 -0
- package/dist/types-ts4.5/internal/theme/get-theme.d.ts +7 -0
- package/dist/types-ts4.5/internal/theme/styles.d.ts +27 -0
- package/dist/types-ts4.5/internal/theme/types.d.ts +57 -0
- package/dist/types-ts4.5/internal/types.d.ts +70 -0
- package/dist/types-ts4.5/internal/utils/get-normalized-language.d.ts +2 -0
- package/dist/types-ts4.5/syntax-highlighter/async.d.ts +3 -0
- package/dist/types-ts4.5/syntax-highlighter/index.d.ts +36 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +12 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +9 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line.d.ts +3 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/flatten-code-tree.d.ts +2 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-code-tree.d.ts +2 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-inline-line-number.d.ts +2 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/process/index.d.ts +17 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-children.d.ts +3 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-element.d.ts +7 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/index.d.ts +15 -0
- package/dist/types-ts4.5/syntax-highlighter/types.d.ts +129 -0
- package/dist/types-ts4.5/types.d.ts +31 -0
- package/inline/package.json +2 -2
- package/package.json +11 -3
- package/types/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/code
|
|
2
2
|
|
|
3
|
+
## 14.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
8
|
+
|
|
9
|
+
## 14.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
14
|
+
|
|
3
15
|
## 14.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "../dist/types/bidi-warning/bidi-warning-decorator.d.ts",
|
|
8
8
|
"typesVersions": {
|
|
9
|
-
">=4.
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
10
|
"*": [
|
|
11
|
-
"../dist/types-ts4.
|
|
11
|
+
"../dist/types-ts4.5/bidi-warning/bidi-warning-decorator.d.ts"
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
}
|
package/block/package.json
CHANGED
package/constants/package.json
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "../dist/types/entry-points/constants.d.ts",
|
|
8
8
|
"typesVersions": {
|
|
9
|
-
">=4.
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
10
|
"*": [
|
|
11
|
-
"../dist/types-ts4.
|
|
11
|
+
"../dist/types-ts4.5/entry-points/constants.d.ts"
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
}
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -308,7 +308,7 @@ export declare const SUPPORTED_LANGUAGES: readonly [{
|
|
|
308
308
|
readonly value: "splunk-spl";
|
|
309
309
|
}];
|
|
310
310
|
export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
|
|
311
|
-
export
|
|
312
|
-
export
|
|
313
|
-
export
|
|
314
|
-
export
|
|
311
|
+
export type Language = (typeof SUPPORTED_LANGUAGES)[number];
|
|
312
|
+
export type LanguageAlias = (typeof SUPPORTED_LANGUAGES)[number]['alias'][number];
|
|
313
|
+
export type LanguageName = (typeof SUPPORTED_LANGUAGES)[number]['name'];
|
|
314
|
+
export type SupportedLanguages = LanguageName | LanguageAlias;
|
|
@@ -24,4 +24,4 @@ export declare const getCodeBlockStyles: (theme: CodeBlockTheme) => (highlighted
|
|
|
24
24
|
export declare const getCodeStyles: (globalTheme: Theme | {
|
|
25
25
|
theme: Theme;
|
|
26
26
|
}) => CSSObject;
|
|
27
|
-
export declare const getCodeBlockTheme: (globalTheme: Theme, maxLines?: number
|
|
27
|
+
export declare const getCodeBlockTheme: (globalTheme: Theme, maxLines?: number) => CodeBlockTheme;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SupportedLanguages } from '../types';
|
|
2
|
-
export declare const normalizeLanguage: import("memoize-one").MemoizedFn<(language?: SupportedLanguages
|
|
2
|
+
export declare const normalizeLanguage: import("memoize-one").MemoizedFn<(language?: SupportedLanguages) => string>;
|
|
@@ -8,13 +8,13 @@ export declare class SyntaxHighlighter extends React.PureComponent<SyntaxHighlig
|
|
|
8
8
|
* Function that receives current line number as argument and returns a
|
|
9
9
|
* line props object to be applied to each `span` wrapping code line.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
type lineTagPropsFunction = (lineNumber?: number) => AST.Properties;
|
|
12
12
|
/**
|
|
13
13
|
* Props to be passed to the `span` wrapping each code line. Can be an
|
|
14
14
|
* object or a function that receives current line number as argument and
|
|
15
15
|
* returns a props object.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type SyntaxHighlighterLineProps = lineTagPropsFunction | AST.Properties;
|
|
18
18
|
export interface SyntaxHighlighterProps {
|
|
19
19
|
/**
|
|
20
20
|
* A unique string that appears as a data attribute `data-testid`
|
|
@@ -126,4 +126,4 @@ export interface CodeBidiWarningConfig {
|
|
|
126
126
|
interface IAstGenerator {
|
|
127
127
|
highlight: (code: string, language: string) => RefractorNode[];
|
|
128
128
|
}
|
|
129
|
-
export
|
|
129
|
+
export type AstGenerator = IAstGenerator | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const bidiCharacterRegex: RegExp;
|
|
2
|
+
/**
|
|
3
|
+
* __Code Bidi Warning Decorator__
|
|
4
|
+
*
|
|
5
|
+
* Checks the code to see if it contains any bidi characters.
|
|
6
|
+
* In case if bidi characters found - returns children with decorated
|
|
7
|
+
* bidi characters. If no bidi characters found - original text returned.
|
|
8
|
+
*/
|
|
9
|
+
export default function codeBidiWarningDecorator<DecoratorOutput>(originalText: string, decorate: (options: {
|
|
10
|
+
bidiCharacter: string;
|
|
11
|
+
index?: number;
|
|
12
|
+
}) => DecoratorOutput): string | (string | DecoratorOutput)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ui';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CodeBidiWarningProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Bidi Warning__
|
|
5
|
+
*
|
|
6
|
+
* A component used to render a bidi character warning.
|
|
7
|
+
* A bidi character can be used to perform a "bidi override attack".
|
|
8
|
+
*
|
|
9
|
+
* See https://hello.atlassian.net/wiki/spaces/PRODSEC/pages/1347434677/PSHELP-2943+Investigate+Trojan+Source+Attack+Vulnerability#1)-Providing-visual-cues-for-our-Customers-in-our-affected-products
|
|
10
|
+
*/
|
|
11
|
+
export default function BidiWarning({ testId, bidiCharacter, skipChildren, tooltipEnabled, label, }: CodeBidiWarningProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type CodeBidiWarningProps = {
|
|
2
|
+
/**
|
|
3
|
+
* A unique string that appears as a data attribute `data-testid`
|
|
4
|
+
* in the rendered code. Serves as a hook for automated tests.
|
|
5
|
+
*/
|
|
6
|
+
testId?: string;
|
|
7
|
+
/**
|
|
8
|
+
* A bidi character which can be used to perform a "bidi override attack". See https://hello.atlassian.net/wiki/spaces/PRODSEC/pages/1347434677/PSHELP-2943+Investigate+Trojan+Source+Attack+Vulnerability#1
|
|
9
|
+
*/
|
|
10
|
+
bidiCharacter: string;
|
|
11
|
+
/**
|
|
12
|
+
* Sets whether to render tooltip with the warning or not.
|
|
13
|
+
* Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
|
|
14
|
+
* where the tooltip could end up being cut off or otherwise not work as expected.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
tooltipEnabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Sets whether bidi character should be wrapped in decorator.
|
|
20
|
+
* Useful when wrapping the bidi character with the decoration is not achievable.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
skipChildren?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Label for the bidi warning tooltip.
|
|
26
|
+
* @default "Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code."
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CodeBlockProps } from './internal/types';
|
|
3
|
+
/**
|
|
4
|
+
* __Code block__
|
|
5
|
+
*
|
|
6
|
+
* A code block highlights an entire block of code and keeps the formatting.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/code/code-block/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/code/code-block/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/code/code-block/usage)
|
|
11
|
+
*/
|
|
12
|
+
declare const CodeBlock: import("react").NamedExoticComponent<CodeBlockProps>;
|
|
13
|
+
export default CodeBlock;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getCodeStyles } from './internal/theme/styles';
|
|
4
|
+
import type { CodeProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* __Code__
|
|
7
|
+
*
|
|
8
|
+
* Code highlights short strings of code snippets inline with body text.
|
|
9
|
+
*
|
|
10
|
+
* - [Examples](https://atlassian.design/components/code/examples)
|
|
11
|
+
* - [Code](https://atlassian.design/components/code/code)
|
|
12
|
+
* - [Usage](https://atlassian.design/components/code/usage)
|
|
13
|
+
*/
|
|
14
|
+
declare const Code: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CodeProps, "headers" | "method" | "as" | "name" | "testId" | "codeBidiWarnings" | "codeBidiWarningLabel" | "codeBidiWarningTooltipEnabled" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLElement>>>;
|
|
15
|
+
export { getCodeStyles };
|
|
16
|
+
export default Code;
|