@atlaskit/code 14.6.9 → 15.0.0

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.
@@ -1,7 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { borderRadius } from '@atlaskit/theme/constants';
5
4
  import { CODE_FONT_SIZE, CODE_LINE_HEIGHT, HIGHLIGHT_BORDER_WIDTH, LINE_NUMBER_GUTTER, SPACING, VAR_CODE_BG_COLOR, VAR_CODE_LINE_NUMBER_BG_COLOR } from './constants';
6
5
  import { getBaseTheme, getColorPalette } from './get-theme';
7
6
  export var getLineNumWidth = function getLineNumWidth(numLines) {
@@ -197,7 +196,7 @@ export var getBaseCodeStyles = function getBaseCodeStyles(theme) {
197
196
  backgroundColor: "var(".concat(VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
198
197
  color: theme.textColor,
199
198
  borderStyle: 'none',
200
- borderRadius: "".concat(borderRadius(), "px")
199
+ borderRadius: "var(--ds-border-radius, 3px)"
201
200
  };
202
201
  };
203
202
 
@@ -295,10 +294,8 @@ export var getCodeBlockStyles = function getCodeBlockStyles(theme) {
295
294
  });
296
295
  };
297
296
  };
298
- export var getCodeStyles = function getCodeStyles(globalTheme) {
299
- // Required to have proper compatibility with styled components interpolations
300
- var akTheme = 'theme' in globalTheme ? globalTheme.theme : globalTheme;
301
- var theme = getBaseTheme(akTheme);
297
+ export var getCodeStyles = function getCodeStyles() {
298
+ var theme = getBaseTheme();
302
299
  var baseStyles = getBaseCodeStyles(theme);
303
300
  return _objectSpread(_objectSpread({}, baseStyles), {}, {
304
301
  display: 'inline',
@@ -310,8 +307,8 @@ export var getCodeStyles = function getCodeStyles(globalTheme) {
310
307
  whiteSpace: 'pre-wrap'
311
308
  });
312
309
  };
313
- export var getCodeBlockTheme = function getCodeBlockTheme(globalTheme, maxLines) {
314
- return _objectSpread(_objectSpread(_objectSpread({}, getBaseTheme(globalTheme)), getColorPalette(globalTheme)), {}, {
310
+ export var getCodeBlockTheme = function getCodeBlockTheme(maxLines) {
311
+ return _objectSpread(_objectSpread(_objectSpread({}, getBaseTheme()), getColorPalette()), {}, {
315
312
  lineNumberWidth: maxLines ? getLineNumWidth(maxLines) : undefined
316
313
  });
317
314
  };
@@ -1,7 +1,6 @@
1
- import type { Theme } from '@atlaskit/theme/types';
2
1
  import type { CodeBlockTheme, CodeTheme } from './types';
3
- export declare const getBaseTheme: (theme: Theme) => CodeTheme;
2
+ export declare const getBaseTheme: () => CodeTheme;
4
3
  export declare const defaultBaseTheme: CodeTheme;
5
- export declare const getColorPalette: import("memoize-one").MemoizedFn<(theme: Theme) => CodeBlockTheme>;
6
- declare const getTheme: (theme: Theme) => CodeBlockTheme;
4
+ export declare const getColorPalette: import("memoize-one").MemoizedFn<() => CodeBlockTheme>;
5
+ declare const getTheme: () => CodeBlockTheme;
7
6
  export default getTheme;
@@ -1,5 +1,4 @@
1
1
  import type { CSSObject } from '@emotion/react';
2
- import type { Theme } from '@atlaskit/theme/types';
3
2
  import type { CodeBlockTheme, CodeTheme } from './types';
4
3
  export declare const getLineNumWidth: (numLines: number) => string;
5
4
  /**
@@ -12,7 +11,7 @@ export declare const getBaseCodeStyles: (theme: CodeTheme) => {
12
11
  backgroundColor: string;
13
12
  color: string | undefined;
14
13
  borderStyle: string;
15
- borderRadius: string;
14
+ borderRadius: "var(--ds-border-radius)";
16
15
  };
17
16
  /**
18
17
  * Takes an implemented CodeBlock theme, and returns styles required for
@@ -21,7 +20,5 @@ export declare const getBaseCodeStyles: (theme: CodeTheme) => {
21
20
  * @param theme
22
21
  */
23
22
  export declare const getCodeBlockStyles: (theme: CodeBlockTheme) => (highlightedStartText: string, highlightedEndText: string, showLineNumbers: boolean, shouldWrapLongLines: boolean) => CSSObject;
24
- export declare const getCodeStyles: (globalTheme: Theme | {
25
- theme: Theme;
26
- }) => CSSObject;
27
- export declare const getCodeBlockTheme: (globalTheme: Theme, maxLines?: number) => CodeBlockTheme;
23
+ export declare const getCodeStyles: () => CSSObject;
24
+ export declare const getCodeBlockTheme: (maxLines?: number) => CodeBlockTheme;
@@ -1,7 +1,6 @@
1
- import type { Theme } from '@atlaskit/theme/types';
2
1
  import type { CodeBlockTheme, CodeTheme } from './types';
3
- export declare const getBaseTheme: (theme: Theme) => CodeTheme;
2
+ export declare const getBaseTheme: () => CodeTheme;
4
3
  export declare const defaultBaseTheme: CodeTheme;
5
- export declare const getColorPalette: import("memoize-one").MemoizedFn<(theme: Theme) => CodeBlockTheme>;
6
- declare const getTheme: (theme: Theme) => CodeBlockTheme;
4
+ export declare const getColorPalette: import("memoize-one").MemoizedFn<() => CodeBlockTheme>;
5
+ declare const getTheme: () => CodeBlockTheme;
7
6
  export default getTheme;
@@ -1,5 +1,4 @@
1
1
  import type { CSSObject } from '@emotion/react';
2
- import type { Theme } from '@atlaskit/theme/types';
3
2
  import type { CodeBlockTheme, CodeTheme } from './types';
4
3
  export declare const getLineNumWidth: (numLines: number) => string;
5
4
  /**
@@ -12,7 +11,7 @@ export declare const getBaseCodeStyles: (theme: CodeTheme) => {
12
11
  backgroundColor: string;
13
12
  color: string | undefined;
14
13
  borderStyle: string;
15
- borderRadius: string;
14
+ borderRadius: "var(--ds-border-radius)";
16
15
  };
17
16
  /**
18
17
  * Takes an implemented CodeBlock theme, and returns styles required for
@@ -21,7 +20,5 @@ export declare const getBaseCodeStyles: (theme: CodeTheme) => {
21
20
  * @param theme
22
21
  */
23
22
  export declare const getCodeBlockStyles: (theme: CodeBlockTheme) => (highlightedStartText: string, highlightedEndText: string, showLineNumbers: boolean, shouldWrapLongLines: boolean) => CSSObject;
24
- export declare const getCodeStyles: (globalTheme: Theme | {
25
- theme: Theme;
26
- }) => CSSObject;
27
- export declare const getCodeBlockTheme: (globalTheme: Theme, maxLines?: number) => CodeBlockTheme;
23
+ export declare const getCodeStyles: () => CSSObject;
24
+ export declare const getCodeBlockTheme: (maxLines?: number) => CodeBlockTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.6.9",
3
+ "version": "15.0.0",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -22,7 +22,6 @@ import type { HTMLProps } from 'react';
22
22
  import { NamedExoticComponent } from 'react';
23
23
  import { default as React_2 } from 'react';
24
24
  import type { ReactNode } from 'react';
25
- import type { Theme } from '@atlaskit/theme/types';
26
25
 
27
26
  // @public
28
27
  export const Code: React_2.MemoExoticComponent<
@@ -426,13 +425,7 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
426
425
  }
427
426
 
428
427
  // @public (undocumented)
429
- export const getCodeStyles: (
430
- globalTheme:
431
- | Theme
432
- | {
433
- theme: Theme;
434
- },
435
- ) => CSSObject;
428
+ export const getCodeStyles: () => CSSObject;
436
429
 
437
430
  // @public (undocumented)
438
431
  export type Language = (typeof SUPPORTED_LANGUAGES)[number];
@@ -11,7 +11,6 @@ import type { HTMLProps } from 'react';
11
11
  import { NamedExoticComponent } from 'react';
12
12
  import { default as React_2 } from 'react';
13
13
  import type { ReactNode } from 'react';
14
- import type { Theme } from '@atlaskit/theme/types';
15
14
 
16
15
  // @public
17
16
  export const Code: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Pick<CodeProps, "about" | "accept" | "acceptCharset" | "accessKey" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "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" | "as" | "async" | "autoCapitalize" | "autoComplete" | "autoCorrect" | "autoFocus" | "autoPlay" | "autoSave" | "capture" | "cellPadding" | "cellSpacing" | "challenge" | "charSet" | "checked" | "children" | "cite" | "classID" | "className" | "codeBidiWarningLabel" | "codeBidiWarningTooltipEnabled" | "codeBidiWarnings" | "colSpan" | "color" | "cols" | "content" | "contentEditable" | "contextMenu" | "controls" | "coords" | "crossOrigin" | "dangerouslySetInnerHTML" | "data" | "datatype" | "dateTime" | "default" | "defaultChecked" | "defaultValue" | "defer" | "dir" | "disabled" | "download" | "draggable" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "hidden" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "id" | "inlist" | "inputMode" | "integrity" | "is" | "itemID" | "itemProp" | "itemRef" | "itemScope" | "itemType" | "key" | "keyParams" | "keyType" | "kind" | "label" | "lang" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "nonce" | "onAbort" | "onAbortCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAuxClick" | "onAuxClickCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onBlur" | "onBlurCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onChange" | "onChangeCapture" | "onClick" | "onClickCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onContextMenu" | "onContextMenuCapture" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onError" | "onErrorCapture" | "onFocus" | "onFocusCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onInput" | "onInputCapture" | "onInvalid" | "onInvalidCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onLoad" | "onLoadCapture" | "onLoadStart" | "onLoadStartCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onPaste" | "onPasteCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerOut" | "onPointerOutCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerUp" | "onPointerUpCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onReset" | "onResetCapture" | "onScroll" | "onScrollCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onSelect" | "onSelectCapture" | "onStalled" | "onStalledCapture" | "onSubmit" | "onSubmitCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onWheel" | "onWheelCapture" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "prefix" | "preload" | "property" | "radioGroup" | "readOnly" | "rel" | "required" | "resource" | "results" | "reversed" | "role" | "rowSpan" | "rows" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "security" | "selected" | "shape" | "size" | "sizes" | "slot" | "span" | "spellCheck" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "style" | "summary" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "tabIndex" | "target" | "testId" | "title" | "translate" | "type" | "typeof" | "unselectable" | "useMap" | "value" | "vocab" | "width" | "wmode" | "wrap"> & React_2.RefAttributes<HTMLElement>>>;
@@ -44,9 +43,7 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
44
43
  }
45
44
 
46
45
  // @public (undocumented)
47
- export const getCodeStyles: (globalTheme: Theme | {
48
- theme: Theme;
49
- }) => CSSObject;
46
+ export const getCodeStyles: () => CSSObject;
50
47
 
51
48
  // @public (undocumented)
52
49
  export type Language = (typeof SUPPORTED_LANGUAGES)[number];