@atlaskit/code 14.3.9 → 14.4.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/bidi-warning/package.json +8 -1
  3. package/bidi-warning-decorator/package.json +8 -1
  4. package/block/package.json +8 -1
  5. package/constants/package.json +8 -1
  6. package/dist/cjs/bidi-warning/ui/styled.js +4 -4
  7. package/dist/cjs/code-block.js +3 -3
  8. package/dist/cjs/code.js +7 -7
  9. package/dist/cjs/internal/theme/styles.js +4 -9
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/bidi-warning/ui/styled.js +1 -1
  12. package/dist/es2019/code-block.js +2 -2
  13. package/dist/es2019/code.js +2 -2
  14. package/dist/es2019/internal/theme/styles.js +4 -9
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/bidi-warning/ui/styled.js +1 -1
  17. package/dist/esm/code-block.js +2 -2
  18. package/dist/esm/code.js +2 -2
  19. package/dist/esm/internal/theme/styles.js +4 -9
  20. package/dist/esm/version.json +1 -1
  21. package/dist/types/bidi-warning/ui/styled.d.ts +2 -1
  22. package/dist/types/code.d.ts +1 -1
  23. package/dist/types/internal/theme/styles.d.ts +10 -2
  24. package/dist/types-ts4.0/bidi-warning/bidi-warning-decorator.d.ts +5 -0
  25. package/dist/types-ts4.0/bidi-warning/index.d.ts +1 -0
  26. package/dist/types-ts4.0/bidi-warning/ui/index.d.ts +3 -0
  27. package/dist/types-ts4.0/bidi-warning/ui/styled.d.ts +8 -0
  28. package/dist/types-ts4.0/bidi-warning/ui/types.d.ts +33 -0
  29. package/dist/types-ts4.0/code-block.d.ts +13 -0
  30. package/dist/types-ts4.0/code.d.ts +16 -0
  31. package/dist/types-ts4.0/constants.d.ts +625 -0
  32. package/dist/types-ts4.0/entry-points/block.d.ts +2 -0
  33. package/dist/types-ts4.0/entry-points/constants.d.ts +1 -0
  34. package/dist/types-ts4.0/entry-points/inline.d.ts +2 -0
  35. package/dist/types-ts4.0/entry-points/types.d.ts +1 -0
  36. package/dist/types-ts4.0/extract-react-types/code-block.d.ts +37 -0
  37. package/dist/types-ts4.0/extract-react-types/code.d.ts +2 -0
  38. package/dist/types-ts4.0/index.d.ts +4 -0
  39. package/dist/types-ts4.0/internal/hooks/use-highlight.d.ts +6 -0
  40. package/dist/types-ts4.0/internal/theme/constants.d.ts +8 -0
  41. package/dist/types-ts4.0/internal/theme/get-theme.d.ts +7 -0
  42. package/dist/types-ts4.0/internal/theme/styles.d.ts +27 -0
  43. package/dist/types-ts4.0/internal/theme/types.d.ts +57 -0
  44. package/dist/types-ts4.0/internal/types.d.ts +57 -0
  45. package/dist/types-ts4.0/internal/utils/get-normalized-language.d.ts +2 -0
  46. package/dist/types-ts4.0/react-syntax-highlighter-bidi-warning-renderer.d.ts +9 -0
  47. package/dist/types-ts4.0/types.d.ts +32 -0
  48. package/inline/package.json +8 -1
  49. package/package.json +15 -7
  50. package/report.api.md +130 -112
  51. package/types/package.json +8 -1
@@ -0,0 +1,625 @@
1
+ export declare const SUPPORTED_LANGUAGES: readonly [
2
+ {
3
+ readonly name: "PHP";
4
+ readonly alias: readonly [
5
+ "php",
6
+ "php3",
7
+ "php4",
8
+ "php5"
9
+ ];
10
+ readonly value: "php";
11
+ },
12
+ {
13
+ readonly name: "Java";
14
+ readonly alias: readonly [
15
+ "java"
16
+ ];
17
+ readonly value: "java";
18
+ },
19
+ {
20
+ readonly name: "CSharp";
21
+ readonly alias: readonly [
22
+ "csharp",
23
+ "c#"
24
+ ];
25
+ readonly value: "cs";
26
+ },
27
+ {
28
+ readonly name: "Python";
29
+ readonly alias: readonly [
30
+ "python",
31
+ "py"
32
+ ];
33
+ readonly value: "python";
34
+ },
35
+ {
36
+ readonly name: "JavaScript";
37
+ readonly alias: readonly [
38
+ "javascript",
39
+ "js"
40
+ ];
41
+ readonly value: "javascript";
42
+ },
43
+ {
44
+ readonly name: "Html";
45
+ readonly alias: readonly [
46
+ "html"
47
+ ];
48
+ readonly value: "xml";
49
+ },
50
+ {
51
+ readonly name: "C++";
52
+ readonly alias: readonly [
53
+ "c++",
54
+ "cpp",
55
+ "clike"
56
+ ];
57
+ readonly value: "cpp";
58
+ },
59
+ {
60
+ readonly name: "Ruby";
61
+ readonly alias: readonly [
62
+ "ruby",
63
+ "rb",
64
+ "duby"
65
+ ];
66
+ readonly value: "ruby";
67
+ },
68
+ {
69
+ readonly name: "Objective-C";
70
+ readonly alias: readonly [
71
+ "objective-c",
72
+ "objectivec",
73
+ "obj-c",
74
+ "objc"
75
+ ];
76
+ readonly value: "objectivec";
77
+ },
78
+ {
79
+ readonly name: "C";
80
+ readonly alias: readonly [
81
+ "c"
82
+ ];
83
+ readonly value: "cpp";
84
+ },
85
+ {
86
+ readonly name: "Swift";
87
+ readonly alias: readonly [
88
+ "swift"
89
+ ];
90
+ readonly value: "swift";
91
+ },
92
+ {
93
+ readonly name: "TeX";
94
+ readonly alias: readonly [
95
+ "tex",
96
+ "latex"
97
+ ];
98
+ readonly value: "tex";
99
+ },
100
+ {
101
+ readonly name: "Shell";
102
+ readonly alias: readonly [
103
+ "shell",
104
+ "bash",
105
+ "sh",
106
+ "ksh",
107
+ "zsh"
108
+ ];
109
+ readonly value: "shell";
110
+ },
111
+ {
112
+ readonly name: "Scala";
113
+ readonly alias: readonly [
114
+ "scala"
115
+ ];
116
+ readonly value: "scala";
117
+ },
118
+ {
119
+ readonly name: "Go";
120
+ readonly alias: readonly [
121
+ "go"
122
+ ];
123
+ readonly value: "go";
124
+ },
125
+ {
126
+ readonly name: "ActionScript";
127
+ readonly alias: readonly [
128
+ "actionscript",
129
+ "actionscript3",
130
+ "as"
131
+ ];
132
+ readonly value: "actionscript";
133
+ },
134
+ {
135
+ readonly name: "ColdFusion";
136
+ readonly alias: readonly [
137
+ "coldfusion"
138
+ ];
139
+ readonly value: "xml";
140
+ },
141
+ {
142
+ readonly name: "JavaFX";
143
+ readonly alias: readonly [
144
+ "javafx",
145
+ "jfx"
146
+ ];
147
+ readonly value: "java";
148
+ },
149
+ {
150
+ readonly name: "VbNet";
151
+ readonly alias: readonly [
152
+ "vbnet",
153
+ "vb.net",
154
+ "vfp",
155
+ "clipper",
156
+ "xbase"
157
+ ];
158
+ readonly value: "vbnet";
159
+ },
160
+ {
161
+ readonly name: "JSON";
162
+ readonly alias: readonly [
163
+ "json"
164
+ ];
165
+ readonly value: "json";
166
+ },
167
+ {
168
+ readonly name: "MATLAB";
169
+ readonly alias: readonly [
170
+ "matlab"
171
+ ];
172
+ readonly value: "matlab";
173
+ },
174
+ {
175
+ readonly name: "Groovy";
176
+ readonly alias: readonly [
177
+ "groovy"
178
+ ];
179
+ readonly value: "groovy";
180
+ },
181
+ {
182
+ readonly name: "SQL";
183
+ readonly alias: readonly [
184
+ "sql",
185
+ "postgresql",
186
+ "postgres",
187
+ "plpgsql",
188
+ "psql",
189
+ "postgresql-console",
190
+ "postgres-console",
191
+ "tsql",
192
+ "t-sql",
193
+ "mysql",
194
+ "sqlite"
195
+ ];
196
+ readonly value: "sql";
197
+ },
198
+ {
199
+ readonly name: "R";
200
+ readonly alias: readonly [
201
+ "r"
202
+ ];
203
+ readonly value: "r";
204
+ },
205
+ {
206
+ readonly name: "Perl";
207
+ readonly alias: readonly [
208
+ "perl",
209
+ "pl"
210
+ ];
211
+ readonly value: "perl";
212
+ },
213
+ {
214
+ readonly name: "Lua";
215
+ readonly alias: readonly [
216
+ "lua"
217
+ ];
218
+ readonly value: "lua";
219
+ },
220
+ {
221
+ readonly name: "Pascal";
222
+ readonly alias: readonly [
223
+ "pas",
224
+ "pascal",
225
+ "objectpascal",
226
+ "delphi"
227
+ ];
228
+ readonly value: "pascal";
229
+ },
230
+ {
231
+ readonly name: "XML";
232
+ readonly alias: readonly [
233
+ "xml"
234
+ ];
235
+ readonly value: "xml";
236
+ },
237
+ {
238
+ readonly name: "TypeScript";
239
+ readonly alias: readonly [
240
+ "typescript",
241
+ "ts"
242
+ ];
243
+ readonly value: "typescript";
244
+ },
245
+ {
246
+ readonly name: "CoffeeScript";
247
+ readonly alias: readonly [
248
+ "coffeescript",
249
+ "coffee-script",
250
+ "coffee"
251
+ ];
252
+ readonly value: "coffeescript";
253
+ },
254
+ {
255
+ readonly name: "Haskell";
256
+ readonly alias: readonly [
257
+ "haskell",
258
+ "hs"
259
+ ];
260
+ readonly value: "haskell";
261
+ },
262
+ {
263
+ readonly name: "Puppet";
264
+ readonly alias: readonly [
265
+ "puppet"
266
+ ];
267
+ readonly value: "puppet";
268
+ },
269
+ {
270
+ readonly name: "Arduino";
271
+ readonly alias: readonly [
272
+ "arduino"
273
+ ];
274
+ readonly value: "arduino";
275
+ },
276
+ {
277
+ readonly name: "Fortran";
278
+ readonly alias: readonly [
279
+ "fortran"
280
+ ];
281
+ readonly value: "fortran";
282
+ },
283
+ {
284
+ readonly name: "Erlang";
285
+ readonly alias: readonly [
286
+ "erlang",
287
+ "erl"
288
+ ];
289
+ readonly value: "erlang";
290
+ },
291
+ {
292
+ readonly name: "PowerShell";
293
+ readonly alias: readonly [
294
+ "powershell",
295
+ "posh",
296
+ "ps1",
297
+ "psm1"
298
+ ];
299
+ readonly value: "powershell";
300
+ },
301
+ {
302
+ readonly name: "Haxe";
303
+ readonly alias: readonly [
304
+ "haxe",
305
+ "hx",
306
+ "hxsl"
307
+ ];
308
+ readonly value: "haxe";
309
+ },
310
+ {
311
+ readonly name: "Elixir";
312
+ readonly alias: readonly [
313
+ "elixir",
314
+ "ex",
315
+ "exs"
316
+ ];
317
+ readonly value: "elixir";
318
+ },
319
+ {
320
+ readonly name: "Verilog";
321
+ readonly alias: readonly [
322
+ "verilog",
323
+ "v"
324
+ ];
325
+ readonly value: "verilog";
326
+ },
327
+ {
328
+ readonly name: "Rust";
329
+ readonly alias: readonly [
330
+ "rust"
331
+ ];
332
+ readonly value: "rust";
333
+ },
334
+ {
335
+ readonly name: "VHDL";
336
+ readonly alias: readonly [
337
+ "vhdl"
338
+ ];
339
+ readonly value: "vhdl";
340
+ },
341
+ {
342
+ readonly name: "Sass";
343
+ readonly alias: readonly [
344
+ "sass"
345
+ ];
346
+ readonly value: "less";
347
+ },
348
+ {
349
+ readonly name: "OCaml";
350
+ readonly alias: readonly [
351
+ "ocaml"
352
+ ];
353
+ readonly value: "ocaml";
354
+ },
355
+ {
356
+ readonly name: "Dart";
357
+ readonly alias: readonly [
358
+ "dart"
359
+ ];
360
+ readonly value: "dart";
361
+ },
362
+ {
363
+ readonly name: "CSS";
364
+ readonly alias: readonly [
365
+ "css"
366
+ ];
367
+ readonly value: "css";
368
+ },
369
+ {
370
+ readonly name: "reStructuredText";
371
+ readonly alias: readonly [
372
+ "restructuredtext",
373
+ "rst",
374
+ "rest"
375
+ ];
376
+ readonly value: "rest";
377
+ },
378
+ {
379
+ readonly name: "Kotlin";
380
+ readonly alias: readonly [
381
+ "kotlin"
382
+ ];
383
+ readonly value: "kotlin";
384
+ },
385
+ {
386
+ readonly name: "D";
387
+ readonly alias: readonly [
388
+ "d"
389
+ ];
390
+ readonly value: "d";
391
+ },
392
+ {
393
+ readonly name: "Octave";
394
+ readonly alias: readonly [
395
+ "octave"
396
+ ];
397
+ readonly value: "matlab";
398
+ },
399
+ {
400
+ readonly name: "QML";
401
+ readonly alias: readonly [
402
+ "qbs",
403
+ "qml"
404
+ ];
405
+ readonly value: "qml";
406
+ },
407
+ {
408
+ readonly name: "Prolog";
409
+ readonly alias: readonly [
410
+ "prolog"
411
+ ];
412
+ readonly value: "prolog";
413
+ },
414
+ {
415
+ readonly name: "FoxPro";
416
+ readonly alias: readonly [
417
+ "foxpro",
418
+ "purebasic"
419
+ ];
420
+ readonly value: "purebasic";
421
+ },
422
+ {
423
+ readonly name: "Scheme";
424
+ readonly alias: readonly [
425
+ "scheme",
426
+ "scm"
427
+ ];
428
+ readonly value: "scheme";
429
+ },
430
+ {
431
+ readonly name: "CUDA";
432
+ readonly alias: readonly [
433
+ "cuda",
434
+ "cu"
435
+ ];
436
+ readonly value: "cpp";
437
+ },
438
+ {
439
+ readonly name: "Julia";
440
+ readonly alias: readonly [
441
+ "julia",
442
+ "jl"
443
+ ];
444
+ readonly value: "julia";
445
+ },
446
+ {
447
+ readonly name: "Racket";
448
+ readonly alias: readonly [
449
+ "racket",
450
+ "rkt"
451
+ ];
452
+ readonly value: "lisp";
453
+ },
454
+ {
455
+ readonly name: "Ada";
456
+ readonly alias: readonly [
457
+ "ada",
458
+ "ada95",
459
+ "ada2005"
460
+ ];
461
+ readonly value: "ada";
462
+ },
463
+ {
464
+ readonly name: "Tcl";
465
+ readonly alias: readonly [
466
+ "tcl"
467
+ ];
468
+ readonly value: "tcl";
469
+ },
470
+ {
471
+ readonly name: "Mathematica";
472
+ readonly alias: readonly [
473
+ "mathematica",
474
+ "mma",
475
+ "nb"
476
+ ];
477
+ readonly value: "mathematica";
478
+ },
479
+ {
480
+ readonly name: "Autoit";
481
+ readonly alias: readonly [
482
+ "autoit"
483
+ ];
484
+ readonly value: "autoit";
485
+ },
486
+ {
487
+ readonly name: "StandardML";
488
+ readonly alias: readonly [
489
+ "standardmL",
490
+ "sml",
491
+ "standardml"
492
+ ];
493
+ readonly value: "sml";
494
+ },
495
+ {
496
+ readonly name: "Objective-J";
497
+ readonly alias: readonly [
498
+ "objective-j",
499
+ "objectivej",
500
+ "obj-j",
501
+ "objj"
502
+ ];
503
+ readonly value: "objectivec";
504
+ },
505
+ {
506
+ readonly name: "Smalltalk";
507
+ readonly alias: readonly [
508
+ "smalltalk",
509
+ "squeak",
510
+ "st"
511
+ ];
512
+ readonly value: "smalltalk";
513
+ },
514
+ {
515
+ readonly name: "Vala";
516
+ readonly alias: readonly [
517
+ "vala",
518
+ "vapi"
519
+ ];
520
+ readonly value: "vala";
521
+ },
522
+ {
523
+ readonly name: "ABAP";
524
+ readonly alias: readonly [
525
+ "abap"
526
+ ];
527
+ readonly value: "sql";
528
+ },
529
+ {
530
+ readonly name: "LiveScript";
531
+ readonly alias: readonly [
532
+ "livescript",
533
+ "live-script"
534
+ ];
535
+ readonly value: "livescript";
536
+ },
537
+ {
538
+ readonly name: "XQuery";
539
+ readonly alias: readonly [
540
+ "xquery",
541
+ "xqy",
542
+ "xq",
543
+ "xql",
544
+ "xqm"
545
+ ];
546
+ readonly value: "xquery";
547
+ },
548
+ {
549
+ readonly name: "PlainText";
550
+ readonly alias: readonly [
551
+ "text",
552
+ "plaintext"
553
+ ];
554
+ readonly value: "text";
555
+ },
556
+ {
557
+ readonly name: "Yaml";
558
+ readonly alias: readonly [
559
+ "yaml",
560
+ "yml"
561
+ ];
562
+ readonly value: "yaml";
563
+ },
564
+ {
565
+ readonly name: "GraphQL";
566
+ readonly alias: readonly [
567
+ "graphql"
568
+ ];
569
+ readonly value: "graphql";
570
+ },
571
+ {
572
+ readonly name: "AppleScript";
573
+ readonly alias: readonly [
574
+ "applescript"
575
+ ];
576
+ readonly value: "applescript";
577
+ },
578
+ {
579
+ readonly name: "Clojure";
580
+ readonly alias: readonly [
581
+ "clojure"
582
+ ];
583
+ readonly value: "clojure";
584
+ },
585
+ {
586
+ readonly name: "Diff";
587
+ readonly alias: readonly [
588
+ "diff"
589
+ ];
590
+ readonly value: "diff";
591
+ },
592
+ {
593
+ readonly name: "VisualBasic";
594
+ readonly alias: readonly [
595
+ "visualbasic"
596
+ ];
597
+ readonly value: "visual-basic";
598
+ },
599
+ {
600
+ readonly name: "JSX";
601
+ readonly alias: readonly [
602
+ "jsx"
603
+ ];
604
+ readonly value: "jsx";
605
+ },
606
+ {
607
+ readonly name: "TSX";
608
+ readonly alias: readonly [
609
+ "tsx"
610
+ ];
611
+ readonly value: "tsx";
612
+ },
613
+ {
614
+ readonly name: "SplunkSPL";
615
+ readonly alias: readonly [
616
+ "splunk-spl"
617
+ ];
618
+ readonly value: "splunk-spl";
619
+ }
620
+ ];
621
+ export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
622
+ export declare type Language = typeof SUPPORTED_LANGUAGES[number];
623
+ export declare type LanguageAlias = typeof SUPPORTED_LANGUAGES[number]['alias'][number];
624
+ export declare type LanguageName = typeof SUPPORTED_LANGUAGES[number]['name'];
625
+ export declare type SupportedLanguages = LanguageName | LanguageAlias;
@@ -0,0 +1,2 @@
1
+ export { default } from '../code-block';
2
+ export type { CodeBlockProps } from '../types';
@@ -0,0 +1 @@
1
+ export { SUPPORTED_LANGUAGES } from '../constants';
@@ -0,0 +1,2 @@
1
+ export { default, getCodeStyles } from '../code';
2
+ export type { CodeBlockProps } from '../types';
@@ -0,0 +1 @@
1
+ export type { CodeBlockProps, CodeProps, SupportedLanguages, LanguageAlias, Language, } from '../types';
@@ -0,0 +1,37 @@
1
+ export default function CodeBlock(__: {
2
+ /**
3
+ * The code to be formatted
4
+ */
5
+ text: string;
6
+ /**
7
+ * A unique string that appears as a data attribute `data-testid`
8
+ * in the rendered code. Serves as a hook for automated tests.
9
+ */
10
+ testId?: string;
11
+ /**
12
+ * Whether to showLineNumbers or not, defaults to true
13
+ */
14
+ showLineNumbers?: boolean;
15
+ /**
16
+ * The language in which the code is written
17
+ * @see `SupportedLanguages` for type information in src
18
+ */
19
+ language?: string;
20
+ /**
21
+ * Lines to highlight comma delimited.
22
+ *
23
+ * Example uses:
24
+ * - To highlight one line `highlight="3"`
25
+ * - To highlight a group of lines `highlight="1-5"`
26
+ * - To highlight multiple groups `highlight="1-5,7,10,15-20"`
27
+ */
28
+ highlight?: string;
29
+ /**
30
+ * Screen reader text for the start of a highlighted line
31
+ */
32
+ highlightedStartText?: string;
33
+ /**
34
+ * Screen reader text for the end of a highlighted line
35
+ */
36
+ highlightedEndText?: string;
37
+ }): null;
@@ -0,0 +1,2 @@
1
+ import type { CodeProps } from '../types';
2
+ export default function _(__: CodeProps): null;
@@ -0,0 +1,4 @@
1
+ export { default as Code, getCodeStyles } from './code';
2
+ export { default as CodeBlock } from './code-block';
3
+ export type { CodeBlockProps, CodeProps, SupportedLanguages, LanguageAlias, Language, } from './types';
4
+ export { SUPPORTED_LANGUAGES } from './constants';
@@ -0,0 +1,6 @@
1
+ import { HTMLProps } from 'react';
2
+ import type { CodeBlockProps } from '../types';
3
+ export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, 'highlight' | 'testId'>) => {
4
+ getHighlightStyles: (lineNumber: number, highlightedLines: number[]) => HTMLProps<HTMLElement>;
5
+ highlightedLines: number[];
6
+ };
@@ -0,0 +1,8 @@
1
+ export declare const CODE_FONT_SIZE = 12;
2
+ export declare const CODE_LINE_HEIGHT = "20px";
3
+ export declare const HIGHLIGHT_BORDER_WIDTH = "4px";
4
+ export declare const SPACING: number;
5
+ export declare const LINE_NUMBER_GUTTER: number;
6
+ export declare const VAR_CODE_LINE_NUMBER_BG_COLOR = "--ds--code--line-number-bg-color";
7
+ export declare const VAR_CODE_BG_COLOR = "--ds--code--bg-color";
8
+ export declare const CODE_BLOCK_SELECTOR = "data-ds--code--code-block";
@@ -0,0 +1,7 @@
1
+ import type { Theme } from '@atlaskit/theme/types';
2
+ import type { CodeBlockTheme, CodeTheme } from './types';
3
+ export declare const getBaseTheme: (theme: Theme) => CodeTheme;
4
+ export declare const defaultBaseTheme: CodeTheme;
5
+ export declare const getColorPalette: import("memoize-one").MemoizedFn<(theme: Theme) => CodeBlockTheme>;
6
+ declare const getTheme: (theme: Theme) => CodeBlockTheme;
7
+ export default getTheme;