@pingux/astro 2.110.1-alpha.0 → 2.111.0-alpha.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.
- package/lib/cjs/components/CodeView/CodeView.js +11 -1
- package/lib/cjs/components/CodeView/CodeView.stories.d.ts +1 -1
- package/lib/cjs/components/CodeView/CodeView.stories.js +25 -3
- package/lib/cjs/components/CodeView/CodeView.test.js +60 -2
- package/lib/cjs/components/Skeleton/Skeleton.d.ts +4 -0
- package/lib/cjs/components/Skeleton/Skeleton.js +125 -0
- package/lib/cjs/components/Skeleton/Skeleton.mdx +13 -0
- package/lib/cjs/components/Skeleton/Skeleton.stories.d.ts +7 -0
- package/lib/cjs/components/Skeleton/Skeleton.stories.js +85 -0
- package/lib/cjs/components/Skeleton/Skeleton.styles.d.ts +108 -0
- package/lib/cjs/components/Skeleton/Skeleton.styles.js +70 -0
- package/lib/cjs/components/Skeleton/Skeleton.test.d.ts +1 -0
- package/lib/cjs/components/Skeleton/Skeleton.test.js +130 -0
- package/lib/cjs/components/Skeleton/index.d.ts +1 -0
- package/lib/cjs/components/Skeleton/index.js +14 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +39 -20
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/skeleton.d.ts +15 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/skeleton.js +32 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +14 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +107 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +107 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +3 -1
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/types/codeView.d.ts +7 -2
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +20 -9
- package/lib/cjs/types/skeleton.d.ts +6 -0
- package/lib/cjs/types/skeleton.js +6 -0
- package/lib/components/CodeView/CodeView.js +13 -2
- package/lib/components/CodeView/CodeView.stories.js +23 -2
- package/lib/components/CodeView/CodeView.test.js +61 -3
- package/lib/components/Skeleton/Skeleton.js +113 -0
- package/lib/components/Skeleton/Skeleton.mdx +13 -0
- package/lib/components/Skeleton/Skeleton.stories.js +74 -0
- package/lib/components/Skeleton/Skeleton.styles.js +63 -0
- package/lib/components/Skeleton/Skeleton.test.js +127 -0
- package/lib/components/Skeleton/index.js +1 -0
- package/lib/index.js +2 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/skeleton.js +24 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/variants/variants.js +3 -1
- package/lib/styles/variants/variants.js +2 -0
- package/lib/types/index.js +1 -0
- package/lib/types/skeleton.js +1 -0
- package/package.json +1 -1
@@ -2646,6 +2646,113 @@ declare const _default: {
|
|
2646
2646
|
};
|
2647
2647
|
};
|
2648
2648
|
};
|
2649
|
+
skeleton: {
|
2650
|
+
base: {
|
2651
|
+
backgroundColor: string;
|
2652
|
+
position: string;
|
2653
|
+
overflow: string;
|
2654
|
+
'&.is-pulsate': {
|
2655
|
+
animation: string;
|
2656
|
+
};
|
2657
|
+
'&.is-wave': {
|
2658
|
+
webkitMaskImage: string;
|
2659
|
+
'&:after': {
|
2660
|
+
content: string;
|
2661
|
+
background: string;
|
2662
|
+
position: string;
|
2663
|
+
webkitTransform: string;
|
2664
|
+
mozTransform: string;
|
2665
|
+
msTransform: string;
|
2666
|
+
transform: string;
|
2667
|
+
bottom: string;
|
2668
|
+
left: string;
|
2669
|
+
right: string;
|
2670
|
+
top: string;
|
2671
|
+
animation: string;
|
2672
|
+
};
|
2673
|
+
};
|
2674
|
+
};
|
2675
|
+
text: {
|
2676
|
+
height: string;
|
2677
|
+
transform: string;
|
2678
|
+
borderRadius: string;
|
2679
|
+
backgroundColor: string;
|
2680
|
+
position: string;
|
2681
|
+
overflow: string;
|
2682
|
+
'&.is-pulsate': {
|
2683
|
+
animation: string;
|
2684
|
+
};
|
2685
|
+
'&.is-wave': {
|
2686
|
+
webkitMaskImage: string;
|
2687
|
+
'&:after': {
|
2688
|
+
content: string;
|
2689
|
+
background: string;
|
2690
|
+
position: string;
|
2691
|
+
webkitTransform: string;
|
2692
|
+
mozTransform: string;
|
2693
|
+
msTransform: string;
|
2694
|
+
transform: string;
|
2695
|
+
bottom: string;
|
2696
|
+
left: string;
|
2697
|
+
right: string;
|
2698
|
+
top: string;
|
2699
|
+
animation: string;
|
2700
|
+
};
|
2701
|
+
};
|
2702
|
+
};
|
2703
|
+
circular: {
|
2704
|
+
borderRadius: string;
|
2705
|
+
backgroundColor: string;
|
2706
|
+
position: string;
|
2707
|
+
overflow: string;
|
2708
|
+
'&.is-pulsate': {
|
2709
|
+
animation: string;
|
2710
|
+
};
|
2711
|
+
'&.is-wave': {
|
2712
|
+
webkitMaskImage: string;
|
2713
|
+
'&:after': {
|
2714
|
+
content: string;
|
2715
|
+
background: string;
|
2716
|
+
position: string;
|
2717
|
+
webkitTransform: string;
|
2718
|
+
mozTransform: string;
|
2719
|
+
msTransform: string;
|
2720
|
+
transform: string;
|
2721
|
+
bottom: string;
|
2722
|
+
left: string;
|
2723
|
+
right: string;
|
2724
|
+
top: string;
|
2725
|
+
animation: string;
|
2726
|
+
};
|
2727
|
+
};
|
2728
|
+
};
|
2729
|
+
rounded: {
|
2730
|
+
borderRadius: string;
|
2731
|
+
backgroundColor: string;
|
2732
|
+
position: string;
|
2733
|
+
overflow: string;
|
2734
|
+
'&.is-pulsate': {
|
2735
|
+
animation: string;
|
2736
|
+
};
|
2737
|
+
'&.is-wave': {
|
2738
|
+
webkitMaskImage: string;
|
2739
|
+
'&:after': {
|
2740
|
+
content: string;
|
2741
|
+
background: string;
|
2742
|
+
position: string;
|
2743
|
+
webkitTransform: string;
|
2744
|
+
mozTransform: string;
|
2745
|
+
msTransform: string;
|
2746
|
+
transform: string;
|
2747
|
+
bottom: string;
|
2748
|
+
left: string;
|
2749
|
+
right: string;
|
2750
|
+
top: string;
|
2751
|
+
animation: string;
|
2752
|
+
};
|
2753
|
+
};
|
2754
|
+
};
|
2755
|
+
};
|
2649
2756
|
};
|
2650
2757
|
images: {
|
2651
2758
|
avatar: {};
|
@@ -948,5 +948,112 @@ declare const _default: {
|
|
948
948
|
};
|
949
949
|
};
|
950
950
|
};
|
951
|
+
skeleton: {
|
952
|
+
base: {
|
953
|
+
backgroundColor: string;
|
954
|
+
position: string;
|
955
|
+
overflow: string;
|
956
|
+
'&.is-pulsate': {
|
957
|
+
animation: string;
|
958
|
+
};
|
959
|
+
'&.is-wave': {
|
960
|
+
webkitMaskImage: string;
|
961
|
+
'&:after': {
|
962
|
+
content: string;
|
963
|
+
background: string;
|
964
|
+
position: string;
|
965
|
+
webkitTransform: string;
|
966
|
+
mozTransform: string;
|
967
|
+
msTransform: string;
|
968
|
+
transform: string;
|
969
|
+
bottom: string;
|
970
|
+
left: string;
|
971
|
+
right: string;
|
972
|
+
top: string;
|
973
|
+
animation: string;
|
974
|
+
};
|
975
|
+
};
|
976
|
+
};
|
977
|
+
text: {
|
978
|
+
height: string;
|
979
|
+
transform: string;
|
980
|
+
borderRadius: string;
|
981
|
+
backgroundColor: string;
|
982
|
+
position: string;
|
983
|
+
overflow: string;
|
984
|
+
'&.is-pulsate': {
|
985
|
+
animation: string;
|
986
|
+
};
|
987
|
+
'&.is-wave': {
|
988
|
+
webkitMaskImage: string;
|
989
|
+
'&:after': {
|
990
|
+
content: string;
|
991
|
+
background: string;
|
992
|
+
position: string;
|
993
|
+
webkitTransform: string;
|
994
|
+
mozTransform: string;
|
995
|
+
msTransform: string;
|
996
|
+
transform: string;
|
997
|
+
bottom: string;
|
998
|
+
left: string;
|
999
|
+
right: string;
|
1000
|
+
top: string;
|
1001
|
+
animation: string;
|
1002
|
+
};
|
1003
|
+
};
|
1004
|
+
};
|
1005
|
+
circular: {
|
1006
|
+
borderRadius: string;
|
1007
|
+
backgroundColor: string;
|
1008
|
+
position: string;
|
1009
|
+
overflow: string;
|
1010
|
+
'&.is-pulsate': {
|
1011
|
+
animation: string;
|
1012
|
+
};
|
1013
|
+
'&.is-wave': {
|
1014
|
+
webkitMaskImage: string;
|
1015
|
+
'&:after': {
|
1016
|
+
content: string;
|
1017
|
+
background: string;
|
1018
|
+
position: string;
|
1019
|
+
webkitTransform: string;
|
1020
|
+
mozTransform: string;
|
1021
|
+
msTransform: string;
|
1022
|
+
transform: string;
|
1023
|
+
bottom: string;
|
1024
|
+
left: string;
|
1025
|
+
right: string;
|
1026
|
+
top: string;
|
1027
|
+
animation: string;
|
1028
|
+
};
|
1029
|
+
};
|
1030
|
+
};
|
1031
|
+
rounded: {
|
1032
|
+
borderRadius: string;
|
1033
|
+
backgroundColor: string;
|
1034
|
+
position: string;
|
1035
|
+
overflow: string;
|
1036
|
+
'&.is-pulsate': {
|
1037
|
+
animation: string;
|
1038
|
+
};
|
1039
|
+
'&.is-wave': {
|
1040
|
+
webkitMaskImage: string;
|
1041
|
+
'&:after': {
|
1042
|
+
content: string;
|
1043
|
+
background: string;
|
1044
|
+
position: string;
|
1045
|
+
webkitTransform: string;
|
1046
|
+
mozTransform: string;
|
1047
|
+
msTransform: string;
|
1048
|
+
transform: string;
|
1049
|
+
bottom: string;
|
1050
|
+
left: string;
|
1051
|
+
right: string;
|
1052
|
+
top: string;
|
1053
|
+
animation: string;
|
1054
|
+
};
|
1055
|
+
};
|
1056
|
+
};
|
1057
|
+
};
|
951
1058
|
};
|
952
1059
|
export default _default;
|
@@ -15,6 +15,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
15
15
|
exports["default"] = exports.badges = exports.badgeDeleteButton = void 0;
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
17
|
var _Attachment = _interopRequireDefault(require("../../../../components/AIComponents/Attachment/Attachment.styles"));
|
18
|
+
var _Skeleton = _interopRequireDefault(require("../../../../components/Skeleton/Skeleton.styles"));
|
18
19
|
var _codeView = _interopRequireDefault(require("../codeView/codeView"));
|
19
20
|
var _avatar = require("./avatar");
|
20
21
|
var _button = _interopRequireDefault(require("./button"));
|
@@ -334,6 +335,7 @@ var _default = {
|
|
334
335
|
overlayPanel: overlayPanel,
|
335
336
|
suggestions: _suggestions["default"],
|
336
337
|
suggestion: _suggestion["default"],
|
337
|
-
response: _response["default"]
|
338
|
+
response: _response["default"],
|
339
|
+
skeleton: _Skeleton["default"]
|
338
340
|
};
|
339
341
|
exports["default"] = _default;
|
@@ -52,6 +52,7 @@ var _RangeCalendar = _interopRequireDefault(require("../../components/RangeCalen
|
|
52
52
|
var _RockerButton = _interopRequireDefault(require("../../components/RockerButton/RockerButton.styles"));
|
53
53
|
var _ScrollBox = _interopRequireDefault(require("../../components/ScrollBox/ScrollBox.styles"));
|
54
54
|
var _Separator = _interopRequireDefault(require("../../components/Separator/Separator.styles"));
|
55
|
+
var _Skeleton = _interopRequireDefault(require("../../components/Skeleton/Skeleton.styles"));
|
55
56
|
var _Stepper = _interopRequireDefault(require("../../components/Stepper/Stepper.styles"));
|
56
57
|
var _Table = _interopRequireDefault(require("../../components/Table/Table.styles"));
|
57
58
|
var tab = _interopRequireWildcard(require("../../components/Tabs/Tabs.style"));
|
@@ -101,6 +102,7 @@ var _default = _objectSpread({
|
|
101
102
|
scrollBox: _ScrollBox["default"],
|
102
103
|
separator: _Separator["default"],
|
103
104
|
stepper: _Stepper["default"],
|
105
|
+
skeleton: _Skeleton["default"],
|
104
106
|
table: _Table["default"],
|
105
107
|
timefield: _TimeField["default"],
|
106
108
|
timeZone: _TimeZone["default"],
|
@@ -6,13 +6,18 @@ import { IconButtonProps } from './iconButton';
|
|
6
6
|
import { HoverProps, StyleProps } from './shared';
|
7
7
|
export type PrismProps = typeof PrismRR & typeof Prism;
|
8
8
|
export type PrismThemeProps = PrismTheme;
|
9
|
+
export interface PrismLib {
|
10
|
+
highlight: typeof Prism.highlight;
|
11
|
+
languages: typeof Prism.languages;
|
12
|
+
hooks: typeof Prism.hooks;
|
13
|
+
}
|
9
14
|
export interface CodeViewProps extends HoverProps, StyleProps {
|
10
15
|
children?: string;
|
11
16
|
className?: string;
|
12
17
|
hasLineNumbers?: boolean;
|
13
18
|
hasNoCopyButton?: boolean;
|
14
|
-
language?: Language;
|
15
|
-
Prism?: PrismProps;
|
19
|
+
language?: keyof typeof Prism.languages | Language;
|
20
|
+
Prism?: PrismLib | PrismProps;
|
16
21
|
textToCopy?: string;
|
17
22
|
sx?: ThemeUICSSObject;
|
18
23
|
stylesProp?: ThemeUICSSObject;
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54, _context55, _context56, _context57;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54, _context55, _context56, _context57, _context58;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -546,8 +546,19 @@ _forEachInstanceProperty(_context49 = _Object$keys(_shared)).call(_context49, fu
|
|
546
546
|
}
|
547
547
|
});
|
548
548
|
});
|
549
|
+
var _skeleton = require("./skeleton");
|
550
|
+
_forEachInstanceProperty(_context50 = _Object$keys(_skeleton)).call(_context50, function (key) {
|
551
|
+
if (key === "default" || key === "__esModule") return;
|
552
|
+
if (key in exports && exports[key] === _skeleton[key]) return;
|
553
|
+
_Object$defineProperty(exports, key, {
|
554
|
+
enumerable: true,
|
555
|
+
get: function get() {
|
556
|
+
return _skeleton[key];
|
557
|
+
}
|
558
|
+
});
|
559
|
+
});
|
549
560
|
var _switchField = require("./switchField");
|
550
|
-
_forEachInstanceProperty(
|
561
|
+
_forEachInstanceProperty(_context51 = _Object$keys(_switchField)).call(_context51, function (key) {
|
551
562
|
if (key === "default" || key === "__esModule") return;
|
552
563
|
if (key in exports && exports[key] === _switchField[key]) return;
|
553
564
|
_Object$defineProperty(exports, key, {
|
@@ -558,7 +569,7 @@ _forEachInstanceProperty(_context50 = _Object$keys(_switchField)).call(_context5
|
|
558
569
|
});
|
559
570
|
});
|
560
571
|
var _tab = require("./tab");
|
561
|
-
_forEachInstanceProperty(
|
572
|
+
_forEachInstanceProperty(_context52 = _Object$keys(_tab)).call(_context52, function (key) {
|
562
573
|
if (key === "default" || key === "__esModule") return;
|
563
574
|
if (key in exports && exports[key] === _tab[key]) return;
|
564
575
|
_Object$defineProperty(exports, key, {
|
@@ -569,7 +580,7 @@ _forEachInstanceProperty(_context51 = _Object$keys(_tab)).call(_context51, funct
|
|
569
580
|
});
|
570
581
|
});
|
571
582
|
var _table = require("./table");
|
572
|
-
_forEachInstanceProperty(
|
583
|
+
_forEachInstanceProperty(_context53 = _Object$keys(_table)).call(_context53, function (key) {
|
573
584
|
if (key === "default" || key === "__esModule") return;
|
574
585
|
if (key in exports && exports[key] === _table[key]) return;
|
575
586
|
_Object$defineProperty(exports, key, {
|
@@ -580,7 +591,7 @@ _forEachInstanceProperty(_context52 = _Object$keys(_table)).call(_context52, fun
|
|
580
591
|
});
|
581
592
|
});
|
582
593
|
var _tabs = require("./tabs");
|
583
|
-
_forEachInstanceProperty(
|
594
|
+
_forEachInstanceProperty(_context54 = _Object$keys(_tabs)).call(_context54, function (key) {
|
584
595
|
if (key === "default" || key === "__esModule") return;
|
585
596
|
if (key in exports && exports[key] === _tabs[key]) return;
|
586
597
|
_Object$defineProperty(exports, key, {
|
@@ -591,7 +602,7 @@ _forEachInstanceProperty(_context53 = _Object$keys(_tabs)).call(_context53, func
|
|
591
602
|
});
|
592
603
|
});
|
593
604
|
var _text = require("./text");
|
594
|
-
_forEachInstanceProperty(
|
605
|
+
_forEachInstanceProperty(_context55 = _Object$keys(_text)).call(_context55, function (key) {
|
595
606
|
if (key === "default" || key === "__esModule") return;
|
596
607
|
if (key in exports && exports[key] === _text[key]) return;
|
597
608
|
_Object$defineProperty(exports, key, {
|
@@ -602,7 +613,7 @@ _forEachInstanceProperty(_context54 = _Object$keys(_text)).call(_context54, func
|
|
602
613
|
});
|
603
614
|
});
|
604
615
|
var _textField = require("./textField");
|
605
|
-
_forEachInstanceProperty(
|
616
|
+
_forEachInstanceProperty(_context56 = _Object$keys(_textField)).call(_context56, function (key) {
|
606
617
|
if (key === "default" || key === "__esModule") return;
|
607
618
|
if (key in exports && exports[key] === _textField[key]) return;
|
608
619
|
_Object$defineProperty(exports, key, {
|
@@ -613,7 +624,7 @@ _forEachInstanceProperty(_context55 = _Object$keys(_textField)).call(_context55,
|
|
613
624
|
});
|
614
625
|
});
|
615
626
|
var _timefield = require("./timefield");
|
616
|
-
_forEachInstanceProperty(
|
627
|
+
_forEachInstanceProperty(_context57 = _Object$keys(_timefield)).call(_context57, function (key) {
|
617
628
|
if (key === "default" || key === "__esModule") return;
|
618
629
|
if (key in exports && exports[key] === _timefield[key]) return;
|
619
630
|
_Object$defineProperty(exports, key, {
|
@@ -624,7 +635,7 @@ _forEachInstanceProperty(_context56 = _Object$keys(_timefield)).call(_context56,
|
|
624
635
|
});
|
625
636
|
});
|
626
637
|
var _tooltipTrigger = require("./tooltipTrigger");
|
627
|
-
_forEachInstanceProperty(
|
638
|
+
_forEachInstanceProperty(_context58 = _Object$keys(_tooltipTrigger)).call(_context58, function (key) {
|
628
639
|
if (key === "default" || key === "__esModule") return;
|
629
640
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
630
641
|
_Object$defineProperty(exports, key, {
|
@@ -14,7 +14,7 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
14
14
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
15
15
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
16
16
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
17
|
-
import React, { forwardRef } from 'react';
|
17
|
+
import React, { forwardRef, useEffect } from 'react';
|
18
18
|
import { useFocusRing } from '@react-aria/focus';
|
19
19
|
import { useHover } from '@react-aria/interactions';
|
20
20
|
import { mergeProps } from '@react-aria/utils';
|
@@ -24,7 +24,10 @@ import { useStatusClasses } from '../../hooks';
|
|
24
24
|
import useGetTheme from '../../hooks/useGetTheme';
|
25
25
|
import codeViewStyle from '../../styles/themes/next-gen/codeView/codeView';
|
26
26
|
import styles from './CodeView.styles';
|
27
|
+
|
28
|
+
/* istanbul ignore next */
|
27
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
30
|
+
(typeof global !== 'undefined' ? global : window).Prism = Prism;
|
28
31
|
var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
29
32
|
var children = props.children,
|
30
33
|
outerClassName = props.className,
|
@@ -61,6 +64,14 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
61
64
|
};
|
62
65
|
var code = (children === null || children === void 0 ? void 0 : _trimInstanceProperty(children).call(children)) || '';
|
63
66
|
var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? codeViewStyle.theme : styles.theme);
|
67
|
+
useEffect(function () {
|
68
|
+
try {
|
69
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require
|
70
|
+
require("prismjs/components/prism-".concat(String(language)));
|
71
|
+
} catch (error) {
|
72
|
+
console.warn("Prism language module for \"".concat(String(language), "\" not found."));
|
73
|
+
}
|
74
|
+
}, [language]);
|
64
75
|
var content = ___EmotionJSX(Highlight, _extends({}, defaultProps, {
|
65
76
|
theme: codeViewTheme,
|
66
77
|
code: code,
|
@@ -116,7 +127,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
116
127
|
mb: "0",
|
117
128
|
mr: "sm",
|
118
129
|
py: "sm"
|
119
|
-
},
|
130
|
+
}, typeof language === 'string' ? language.toUpperCase() : ''), ___EmotionJSX(CopyText, {
|
120
131
|
ref: ref,
|
121
132
|
mode: "rightText",
|
122
133
|
textToCopy: textToCopy || children,
|
@@ -3,7 +3,6 @@ import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
|
|
3
3
|
import React from 'react';
|
4
4
|
import Prism from 'prismjs';
|
5
5
|
import { withDesign } from 'storybook-addon-designs';
|
6
|
-
import 'prismjs/components/prism-powershell';
|
7
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
8
7
|
import { CodeView } from '../../index';
|
9
8
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
@@ -114,7 +113,7 @@ WithCustomSize.parameters = {
|
|
114
113
|
};
|
115
114
|
export var WithAdditionalLanguage = function WithAdditionalLanguage() {
|
116
115
|
var _context;
|
117
|
-
var cssCode = _trimInstanceProperty(_context = "\n body {\n margin: 0;\n font-family: Roboto, sans-serif;\n }\n \n h1 {\n color: red;\n margin-left: 40px;\n }
|
116
|
+
var cssCode = _trimInstanceProperty(_context = "\n body {\n margin: 0;\n font-family: Roboto, sans-serif;\n }\n \n h1 {\n color: red;\n margin-left: 40px;\n }\n ").call(_context);
|
118
117
|
return ___EmotionJSX(CodeView, {
|
119
118
|
language: "css",
|
120
119
|
Prism: Prism
|
@@ -147,4 +146,26 @@ WithChangedCopiedValue.parameters = {
|
|
147
146
|
}]
|
148
147
|
}
|
149
148
|
}
|
149
|
+
};
|
150
|
+
export var WithCustomLanguage = function WithCustomLanguage() {
|
151
|
+
var _context2, _context3;
|
152
|
+
var javaCode = _trimInstanceProperty(_context2 = "\n public class Factorial {\n public static void main(String[] args) {\n int num = 5;\n int factorial = 1;\n for (int i = 1; i <= num; i++) {\n factorial *= i;\n }\n System.out.println(\"Factorial of \" + num + \" is: \" + factorial);\n }\n}\n ").call(_context2);
|
153
|
+
var powershellCode = _trimInstanceProperty(_context3 = "\n Get-Process\n Get-Process -Name \"notepad\"\n Stop-Process -Name \"notepad\"\n Get-Service\n Start-Service -Name \"service_name\"\n Get-Date\n Get-Date -Format \"yyyy-MM-dd HH:mm:ss\"\n Get-WmiObject -Class Win32_OperatingSystem\n $env:COMPUTERNAME\n ").call(_context3);
|
154
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CodeView, {
|
155
|
+
language: "java",
|
156
|
+
Prism: Prism
|
157
|
+
}, javaCode), ___EmotionJSX(CodeView, {
|
158
|
+
language: "powershell",
|
159
|
+
Prism: Prism
|
160
|
+
}, powershellCode));
|
161
|
+
};
|
162
|
+
WithCustomLanguage.parameters = {
|
163
|
+
a11y: {
|
164
|
+
config: {
|
165
|
+
rules: [{
|
166
|
+
id: 'color-contrast',
|
167
|
+
enabled: false
|
168
|
+
}]
|
169
|
+
}
|
170
|
+
}
|
150
171
|
};
|
@@ -16,15 +16,15 @@ import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
|
16
16
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
17
17
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
18
18
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
19
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context9; _forEachInstanceProperty(_context9 = ["next", "throw", "return"]).call(_context9, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context10; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context10 = this.tryEntries).call(_context10, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
19
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context11; _forEachInstanceProperty(_context11 = ["next", "throw", "return"]).call(_context11, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context12; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context12 = this.tryEntries).call(_context12, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
20
20
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
21
21
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
22
22
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
23
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context9, _context10; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(source), !0)).call(_context9, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context10 = ownKeys(Object(source))).call(_context10, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
24
24
|
import React from 'react';
|
25
25
|
import userEvent from '@testing-library/user-event';
|
26
26
|
import { CodeView } from '../..';
|
27
|
-
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
27
|
+
import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
28
28
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
29
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
30
30
|
var testId = 'test-code-sample';
|
@@ -238,4 +238,62 @@ test('if textToCopy is provided it\'s copied to clipboard instead of children te
|
|
238
238
|
return _context6.stop();
|
239
239
|
}
|
240
240
|
}, _callee6);
|
241
|
+
})));
|
242
|
+
it('does not log a warning when the module is found (valid language)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
243
|
+
var warnSpy, language;
|
244
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
245
|
+
while (1) switch (_context7.prev = _context7.next) {
|
246
|
+
case 0:
|
247
|
+
jest.mock('prismjs/components/prism-javascript', function () {
|
248
|
+
return {};
|
249
|
+
}, {
|
250
|
+
virtual: true
|
251
|
+
});
|
252
|
+
warnSpy = jest.spyOn(console, 'warn').mockImplementation(function () {
|
253
|
+
// Intentionally left blank
|
254
|
+
});
|
255
|
+
language = 'jsx';
|
256
|
+
getComponent({
|
257
|
+
language: language
|
258
|
+
});
|
259
|
+
_context7.next = 6;
|
260
|
+
return waitFor(function () {
|
261
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
262
|
+
});
|
263
|
+
case 6:
|
264
|
+
warnSpy.mockRestore();
|
265
|
+
case 7:
|
266
|
+
case "end":
|
267
|
+
return _context7.stop();
|
268
|
+
}
|
269
|
+
}, _callee7);
|
270
|
+
})));
|
271
|
+
it('does log a warning when the module is not found (invalid language)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
272
|
+
var warnSpy, language;
|
273
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
274
|
+
while (1) switch (_context8.prev = _context8.next) {
|
275
|
+
case 0:
|
276
|
+
jest.mock('prismjs/components/prism-javascript', function () {
|
277
|
+
return {};
|
278
|
+
}, {
|
279
|
+
virtual: true
|
280
|
+
});
|
281
|
+
warnSpy = jest.spyOn(console, 'warn').mockImplementation(function () {
|
282
|
+
// Intentionally left blank
|
283
|
+
});
|
284
|
+
language = 'invalid';
|
285
|
+
getComponent({
|
286
|
+
language: language
|
287
|
+
});
|
288
|
+
_context8.next = 6;
|
289
|
+
return waitFor(function () {
|
290
|
+
expect(warnSpy).toHaveBeenCalledWith('Prism language module for "invalid" not found.');
|
291
|
+
});
|
292
|
+
case 6:
|
293
|
+
warnSpy.mockRestore();
|
294
|
+
case 7:
|
295
|
+
case "end":
|
296
|
+
return _context8.stop();
|
297
|
+
}
|
298
|
+
}, _callee8);
|
241
299
|
})));
|